Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mondaycom/apps-sdk

Package Overview
Dependencies
Maintainers
8
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mondaycom/apps-sdk - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

2

dist/cjs/package.json
{
"name": "@mondaycom/apps-sdk",
"version": "0.0.5",
"version": "0.1.0",
"description": "monday apps SDK for NodeJS",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -61,3 +61,3 @@ "use strict";

var secureStorageFetch = function (path, connectionData, options) { return __awaiter(void 0, void 0, void 0, function () {
var _a, method, body, token, identityToken, fetchObj, result;
var _a, method, body, token, identityToken, fetchObj, result, error_1;
return __generator(this, function (_b) {

@@ -76,5 +76,14 @@ switch (_b.label) {

};
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, (0, fetch_wrapper_1.fetchWrapper)(path, fetchObj)];
case 1:
case 2:
result = _b.sent();
return [3 /*break*/, 4];
case 3:
error_1 = _b.sent();
logger.debug('[secureStorageFetch] Unexpected error occurred while communicating with secure storage', { error: error_1 });
throw new apps_sdk_error_1.InternalServerError('An issue occurred while accessing secure storage');
case 4:
if (!(0, guards_1.isDefined)(result)) {

@@ -84,3 +93,3 @@ return [2 /*return*/];

if ((0, guards_1.isDefined)(result.errors)) {
logger.debug("Errors occurred while communicating with secure storage.\nErrors: ".concat(result.errors.join()));
logger.debug("[secureStorageFetch] Errors occurred while communicating with secure storage.\nErrors: ".concat(result.errors.join()));
throw new apps_sdk_error_1.BadRequestError('Provided input is invalid');

@@ -245,2 +254,5 @@ }

logger.info("[SecureStorage] Got data for key from secure storage\nkey: ".concat(key), { mondayInternal: false });
if (!(0, guards_1.isDefined)(result === null || result === void 0 ? void 0 : result.data)) {
return [2 /*return*/, null];
}
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.data];

@@ -247,0 +259,0 @@ }

@@ -78,3 +78,3 @@ "use strict";

if (!(0, guards_1.isDefined)(encryptedValue)) {
throw new apps_sdk_error_1.NotFoundError("No data found for ".concat(key));
return [2 /*return*/, null];
}

@@ -81,0 +81,0 @@ stringifiedValue = (0, cipher_1.decrypt)(encryptedValue);

@@ -53,14 +53,8 @@ "use strict";

var guards_1 = require("../types/guards.js");
var env_1 = require("../utils/env.js");
var fetch_wrapper_1 = require("../utils/fetch-wrapper.js");
var logger_1 = require("../utils/logger.js");
var logger = new logger_1.Logger('Storage', { mondayInternal: true });
var LOGGER_TAG = 'Storage';
var getStorageUrl = function () {
var productionUrl = 'https://apps-storage.monday.com/app_storage_api/v2';
var developmentUrl = 'http://apps-storage.llama.fan/app_storage_api/v2';
if ((0, env_1.isDevelopmentEnvironment)()) {
return developmentUrl;
}
return productionUrl;
var url = process.env.STORAGE_URL || 'https://apps-storage.monday.com/app_storage_api/v2';
return url;
};

@@ -84,3 +78,3 @@ var getToken = function (token, options) {

var storageFetch = function (key, initToken, externalOptions, options) { return __awaiter(void 0, void 0, void 0, function () {
var method, body, token, stringifiedBody, url, headers, response;
var method, body, token, stringifiedBody, url, headers, response, error_1;
return __generator(this, function (_a) {

@@ -100,6 +94,14 @@ switch (_a.label) {

};
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, (0, fetch_wrapper_1.fetchWrapper)(url, __assign({ method: method, headers: headers }, (body && { body: stringifiedBody })))];
case 1:
case 2:
response = _a.sent();
return [2 /*return*/, response];
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
logger.debug('[storageFetch] Unexpected error occurred while communicating with storage', { error: error_1 });
throw new apps_sdk_error_1.InternalServerError('An issue occurred while accessing storage');
case 4: return [2 /*return*/, response];
}

@@ -120,3 +122,3 @@ });

_a.sent();
logger.info("[".concat(LOGGER_TAG, "] Deleted data for key from storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.delete] Deleted data for key from storage\nkey: ".concat(key), { mondayInternal: false });
return [2 /*return*/, true];

@@ -136,3 +138,6 @@ }

result = _a.sent();
logger.info("[".concat(LOGGER_TAG, "] Got data for key from storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.get] Got data for key from storage\nkey: ".concat(key), { mondayInternal: false });
if (!(0, guards_1.isDefined)(result)) {
return [2 /*return*/, null];
}
return [2 /*return*/, result];

@@ -159,3 +164,3 @@ }

result = _a.sent();
logger.info("[".concat(LOGGER_TAG, "] Set data for key in storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.set] Set data for key in storage\nkey: ".concat(key), { mondayInternal: false });
version = result.version;

@@ -162,0 +167,0 @@ return [2 /*return*/, { version: version }];

@@ -47,6 +47,3 @@ "use strict";

var handleFetchErrors = function (response) {
if (response.status == http_status_codes_1.StatusCodes.NOT_FOUND) {
throw new apps_sdk_error_1.NotFoundError('Resource not found');
}
else if (response.status == http_status_codes_1.StatusCodes.FORBIDDEN) {
if (response.status == http_status_codes_1.StatusCodes.FORBIDDEN) {
throw new apps_sdk_error_1.ForbiddenError('Forbidden action');

@@ -65,3 +62,3 @@ }

handleFetchErrors(response);
if (response.status === http_status_codes_1.StatusCodes.NO_CONTENT) {
if ([http_status_codes_1.StatusCodes.NO_CONTENT, http_status_codes_1.StatusCodes.NOT_FOUND].includes(response.status)) {
return [2 /*return*/];

@@ -68,0 +65,0 @@ }

@@ -99,3 +99,3 @@ "use strict";

}
throw new apps_sdk_error_1.NotFoundError("Data not found for '".concat(key, "'"));
return [2 /*return*/, null];
});

@@ -157,3 +157,3 @@ });

}
throw new apps_sdk_error_1.NotFoundError("Data not found for '".concat(key, "'"));
return [2 /*return*/, null];
});

@@ -160,0 +160,0 @@ });

{
"name": "@mondaycom/apps-sdk",
"version": "0.0.5",
"version": "0.1.0",
"description": "monday apps SDK for NodeJS",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

@@ -58,3 +58,3 @@ var __assign = (this && this.__assign) || function () {

var secureStorageFetch = function (path, connectionData, options) { return __awaiter(void 0, void 0, void 0, function () {
var _a, method, body, token, identityToken, fetchObj, result;
var _a, method, body, token, identityToken, fetchObj, result, error_1;
return __generator(this, function (_b) {

@@ -73,5 +73,14 @@ switch (_b.label) {

};
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, fetchWrapper(path, fetchObj)];
case 1:
case 2:
result = _b.sent();
return [3 /*break*/, 4];
case 3:
error_1 = _b.sent();
logger.debug('[secureStorageFetch] Unexpected error occurred while communicating with secure storage', { error: error_1 });
throw new InternalServerError('An issue occurred while accessing secure storage');
case 4:
if (!isDefined(result)) {

@@ -81,3 +90,3 @@ return [2 /*return*/];

if (isDefined(result.errors)) {
logger.debug("Errors occurred while communicating with secure storage.\nErrors: ".concat(result.errors.join()));
logger.debug("[secureStorageFetch] Errors occurred while communicating with secure storage.\nErrors: ".concat(result.errors.join()));
throw new BadRequestError('Provided input is invalid');

@@ -242,2 +251,5 @@ }

logger.info("[SecureStorage] Got data for key from secure storage\nkey: ".concat(key), { mondayInternal: false });
if (!isDefined(result === null || result === void 0 ? void 0 : result.data)) {
return [2 /*return*/, null];
}
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.data];

@@ -244,0 +256,0 @@ }

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { BadRequestError, NotFoundError } from '../errors/apps-sdk-error.js';
import { BadRequestError } from '../errors/apps-sdk-error.js';
import { isDefined } from '../types/guards.js';

@@ -76,3 +76,3 @@ import { decrypt, encrypt } from '../utils/cipher.js';

if (!isDefined(encryptedValue)) {
throw new NotFoundError("No data found for ".concat(key));
return [2 /*return*/, null];
}

@@ -79,0 +79,0 @@ stringifiedValue = decrypt(encryptedValue);

@@ -50,14 +50,8 @@ var __assign = (this && this.__assign) || function () {

import { isDefined } from '../types/guards.js';
import { isDevelopmentEnvironment } from '../utils/env.js';
import { fetchWrapper } from '../utils/fetch-wrapper.js';
import { Logger } from '../utils/logger.js';
var logger = new Logger('Storage', { mondayInternal: true });
var LOGGER_TAG = 'Storage';
var getStorageUrl = function () {
var productionUrl = 'https://apps-storage.monday.com/app_storage_api/v2';
var developmentUrl = 'http://apps-storage.llama.fan/app_storage_api/v2';
if (isDevelopmentEnvironment()) {
return developmentUrl;
}
return productionUrl;
var url = process.env.STORAGE_URL || 'https://apps-storage.monday.com/app_storage_api/v2';
return url;
};

@@ -81,3 +75,3 @@ var getToken = function (token, options) {

var storageFetch = function (key, initToken, externalOptions, options) { return __awaiter(void 0, void 0, void 0, function () {
var method, body, token, stringifiedBody, url, headers, response;
var method, body, token, stringifiedBody, url, headers, response, error_1;
return __generator(this, function (_a) {

@@ -97,6 +91,14 @@ switch (_a.label) {

};
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, fetchWrapper(url, __assign({ method: method, headers: headers }, (body && { body: stringifiedBody })))];
case 1:
case 2:
response = _a.sent();
return [2 /*return*/, response];
return [3 /*break*/, 4];
case 3:
error_1 = _a.sent();
logger.debug('[storageFetch] Unexpected error occurred while communicating with storage', { error: error_1 });
throw new InternalServerError('An issue occurred while accessing storage');
case 4: return [2 /*return*/, response];
}

@@ -117,3 +119,3 @@ });

_a.sent();
logger.info("[".concat(LOGGER_TAG, "] Deleted data for key from storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.delete] Deleted data for key from storage\nkey: ".concat(key), { mondayInternal: false });
return [2 /*return*/, true];

@@ -133,3 +135,6 @@ }

result = _a.sent();
logger.info("[".concat(LOGGER_TAG, "] Got data for key from storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.get] Got data for key from storage\nkey: ".concat(key), { mondayInternal: false });
if (!isDefined(result)) {
return [2 /*return*/, null];
}
return [2 /*return*/, result];

@@ -156,3 +161,3 @@ }

result = _a.sent();
logger.info("[".concat(LOGGER_TAG, "] Set data for key in storage\nkey: ").concat(key), { mondayInternal: false });
logger.info("[Storage.set] Set data for key in storage\nkey: ".concat(key), { mondayInternal: false });
version = result.version;

@@ -159,0 +164,0 @@ return [2 /*return*/, { version: version }];

@@ -39,8 +39,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import fetch from 'node-fetch';
import { ForbiddenError, NotFoundError } from '../errors/apps-sdk-error.js';
import { ForbiddenError } from '../errors/apps-sdk-error.js';
var handleFetchErrors = function (response) {
if (response.status == StatusCodes.NOT_FOUND) {
throw new NotFoundError('Resource not found');
}
else if (response.status == StatusCodes.FORBIDDEN) {
if (response.status == StatusCodes.FORBIDDEN) {
throw new ForbiddenError('Forbidden action');

@@ -59,3 +56,3 @@ }

handleFetchErrors(response);
if (response.status === StatusCodes.NO_CONTENT) {
if ([StatusCodes.NO_CONTENT, StatusCodes.NOT_FOUND].includes(response.status)) {
return [2 /*return*/];

@@ -62,0 +59,0 @@ }

@@ -41,3 +41,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import appRoot from 'app-root-path';
import { InternalServerError, NotFoundError } from '../errors/apps-sdk-error.js';
import { InternalServerError } from '../errors/apps-sdk-error.js';
import { isDefined } from '../types/guards.js';

@@ -93,3 +93,3 @@ import { Logger } from './logger.js';

}
throw new NotFoundError("Data not found for '".concat(key, "'"));
return [2 /*return*/, null];
});

@@ -151,3 +151,3 @@ });

}
throw new NotFoundError("Data not found for '".concat(key, "'"));
return [2 /*return*/, null];
});

@@ -154,0 +154,0 @@ });

@@ -6,4 +6,4 @@ import { ISecureStorageInstance } from '../types/secure-storage';

delete(key: string): Promise<boolean>;
get<T>(key: string): Promise<T>;
get<T>(key: string): Promise<T | null>;
set<T extends object>(key: string, value: T): Promise<boolean>;
}

@@ -6,4 +6,4 @@ import { ISecureStorageInstance } from '../types/secure-storage';

delete(key: string): Promise<boolean>;
get<T>(key: string): Promise<T>;
get<T>(key: string): Promise<T | null>;
set<T extends object>(key: string, value: T): Promise<boolean>;
}

@@ -6,3 +6,3 @@ import { IStorageInstance, Options } from '../types/storage';

delete(key: string, options?: Options): Promise<boolean>;
get<T>(key: string, options?: Options): Promise<T>;
get<T>(key: string, options?: Options): Promise<T | null>;
set(key: string, value: any, options?: Options): Promise<{

@@ -9,0 +9,0 @@ version: string;

export type Options = {
/** determines if the log should get streamed to a monday-code developer */
mondayInternal?: boolean;
error?: Error;
};

@@ -5,0 +6,0 @@ export declare enum LogMethods {

export type ISecureStorageInstance = {
set: <T extends object>(key: string, value: T) => Promise<boolean>;
get: <T extends object>(key: string) => Promise<T>;
get: <T extends object>(key: string) => Promise<T | null>;
delete: (key: string) => Promise<boolean>;

@@ -5,0 +5,0 @@ };

export type ILocalStorageInstance = {
set: <T>(key: string, value: T) => Promise<boolean>;
get: <T>(key: string) => Promise<T>;
get: <T>(key: string) => Promise<T | null>;
delete: (key: string) => Promise<boolean>;
};

@@ -11,4 +11,4 @@ export type Token = string;

set: <T extends object>(key: string, value: T, options?: Options) => Promise<SetResponse>;
get: <T extends object>(key: string, options?: Options) => Promise<T>;
get: <T extends object>(key: string, options?: Options) => Promise<T | null>;
delete: (key: string, options?: Options) => Promise<boolean>;
};

@@ -6,3 +6,3 @@ import { ILocalStorageInstance } from '../types/secure-storage.local';

delete(key: string): Promise<boolean>;
get<T>(key: string): Promise<T>;
get<T>(key: string): Promise<T | null>;
}

@@ -15,4 +15,4 @@ export declare class LocalDb implements ILocalStorageInstance {

delete(key: string): Promise<boolean>;
get<T>(key: string): Promise<T>;
get<T>(key: string): Promise<T | null>;
}
export declare const initDb: (dbName?: string) => LocalMemoryDb | LocalDb;
{
"name": "@mondaycom/apps-sdk",
"version": "0.0.5",
"version": "0.1.0",
"description": "monday apps SDK for NodeJS",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc