@mondaycom/apps-sdk
Advanced tools
Comparing version 0.2.3 to 0.2.4
"use strict"; | ||
exports.__esModule = true; | ||
exports["default"] = { name: '@mondaycom/apps-sdk', version: '0.2.3' }; | ||
exports["default"] = { name: '@mondaycom/apps-sdk', version: '0.2.4' }; | ||
//# sourceMappingURL=minimal-package.js.map |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "monday apps SDK for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
"use strict"; | ||
exports.__esModule = true; | ||
exports.Queue = void 0; | ||
var env_1 = require("../utils/env.js"); | ||
var queue_1 = require("./queue.js"); | ||
exports.Queue = queue_1.Queue; | ||
var queue_dev_1 = require("./queue.dev.js"); | ||
var Queue = (0, env_1.isLocalEnvironment)() ? queue_dev_1.QueueDev : queue_1.QueueProd; | ||
exports.Queue = Queue; | ||
//# sourceMappingURL=index.js.map |
@@ -39,3 +39,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.Queue = void 0; | ||
exports.QueueProd = void 0; | ||
var pubsub_1 = require("@google-cloud/pubsub"); | ||
@@ -45,7 +45,7 @@ var apps_sdk_error_1 = require("../errors/apps-sdk-error.js"); | ||
var logger = new logger_1.Logger('Queue', { mondayInternal: true }); | ||
var Queue = /** @class */ (function () { | ||
function Queue() { | ||
var QueueProd = /** @class */ (function () { | ||
function QueueProd() { | ||
this.pubSubClient = new pubsub_1.PubSub(); | ||
} | ||
Queue.prototype.publishMessage = function (message, options) { | ||
QueueProd.prototype.publishMessage = function (message, options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -63,3 +63,3 @@ var topicName, data, messageId, err_1; | ||
_a.trys.push([1, 3, , 4]); | ||
data = (typeof message === 'string' || message instanceof String) ? Buffer.from(message) : message; | ||
data = (typeof message === 'string') ? Buffer.from(message) : message; | ||
return [4 /*yield*/, this.pubSubClient | ||
@@ -80,5 +80,16 @@ .topic(topicName) | ||
}; | ||
return Queue; | ||
QueueProd.prototype.validateMessageOrigin = function (secret) { | ||
var envMessageSecret = process.env.MNDY_TOPIC_MESSAGES_SECRET; | ||
if (!envMessageSecret) { | ||
throw new apps_sdk_error_1.BadRequestError('En environment variable name "MNDY_TOPIC_MESSAGES_SECRET" is required.'); | ||
} | ||
if (!secret) { | ||
throw new apps_sdk_error_1.BadRequestError('secret is required.'); | ||
} | ||
var topicMessageSecret = process.env.MNDY_TOPIC_MESSAGES_SECRET; | ||
return secret === topicMessageSecret; | ||
}; | ||
return QueueProd; | ||
}()); | ||
exports.Queue = Queue; | ||
exports.QueueProd = QueueProd; | ||
//# sourceMappingURL=queue.js.map |
"use strict"; | ||
exports.__esModule = true; | ||
exports.validateEnvironment = exports.getMondayCodeContext = exports.isLocalEnvironment = void 0; | ||
exports.validateEnvironment = exports.getMondayCodeContext = exports.localServerAddress = exports.isLocalEnvironment = void 0; | ||
var apps_sdk_error_1 = require("../errors/apps-sdk-error.js"); | ||
@@ -8,2 +8,12 @@ var guards_1 = require("../types/guards.js"); | ||
exports.isLocalEnvironment = isLocalEnvironment; | ||
var localServerAddress = function () { | ||
if (!(0, exports.isLocalEnvironment)()) { | ||
throw new Error('localServerAddress() can be used, this is not a development environment.'); | ||
} | ||
if (!process.env.MNDY_SERVER_ADDRESS) { | ||
throw new Error('En environment variable name "MNDY_SERVER_ADDRESS" is required, the value should be int the following format "(protocol)://{server_name}:{port}" e.g.: "http://localhost:8080".'); | ||
} | ||
return process.env.MNDY_SERVER_ADDRESS; | ||
}; | ||
exports.localServerAddress = localServerAddress; | ||
var getMondayCodeContext = function () { return ({ | ||
@@ -10,0 +20,0 @@ app: process.env.K_SERVICE, |
@@ -1,2 +0,2 @@ | ||
export default { name: '@mondaycom/apps-sdk', version: '0.2.3' }; | ||
export default { name: '@mondaycom/apps-sdk', version: '0.2.4' }; | ||
//# sourceMappingURL=minimal-package.js.map |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "monday apps SDK for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
@@ -1,3 +0,6 @@ | ||
import { Queue } from './queue.js'; | ||
import { isLocalEnvironment } from '../utils/env.js'; | ||
import { QueueProd } from './queue.js'; | ||
import { QueueDev } from './queue.dev.js'; | ||
var Queue = isLocalEnvironment() ? QueueDev : QueueProd; | ||
export { Queue }; | ||
//# sourceMappingURL=index.js.map |
@@ -41,7 +41,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var logger = new Logger('Queue', { mondayInternal: true }); | ||
var Queue = /** @class */ (function () { | ||
function Queue() { | ||
var QueueProd = /** @class */ (function () { | ||
function QueueProd() { | ||
this.pubSubClient = new PubSub(); | ||
} | ||
Queue.prototype.publishMessage = function (message, options) { | ||
QueueProd.prototype.publishMessage = function (message, options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -59,3 +59,3 @@ var topicName, data, messageId, err_1; | ||
_a.trys.push([1, 3, , 4]); | ||
data = (typeof message === 'string' || message instanceof String) ? Buffer.from(message) : message; | ||
data = (typeof message === 'string') ? Buffer.from(message) : message; | ||
return [4 /*yield*/, this.pubSubClient | ||
@@ -76,5 +76,16 @@ .topic(topicName) | ||
}; | ||
return Queue; | ||
QueueProd.prototype.validateMessageOrigin = function (secret) { | ||
var envMessageSecret = process.env.MNDY_TOPIC_MESSAGES_SECRET; | ||
if (!envMessageSecret) { | ||
throw new BadRequestError('En environment variable name "MNDY_TOPIC_MESSAGES_SECRET" is required.'); | ||
} | ||
if (!secret) { | ||
throw new BadRequestError('secret is required.'); | ||
} | ||
var topicMessageSecret = process.env.MNDY_TOPIC_MESSAGES_SECRET; | ||
return secret === topicMessageSecret; | ||
}; | ||
return QueueProd; | ||
}()); | ||
export { Queue }; | ||
export { QueueProd }; | ||
//# sourceMappingURL=queue.js.map |
import { ForbiddenError } from '../errors/apps-sdk-error.js'; | ||
import { isDefined } from '../types/guards.js'; | ||
export var isLocalEnvironment = function () { return !isDefined(process.env.K_SERVICE); }; | ||
export var localServerAddress = function () { | ||
if (!isLocalEnvironment()) { | ||
throw new Error('localServerAddress() can be used, this is not a development environment.'); | ||
} | ||
if (!process.env.MNDY_SERVER_ADDRESS) { | ||
throw new Error('En environment variable name "MNDY_SERVER_ADDRESS" is required, the value should be int the following format "(protocol)://{server_name}:{port}" e.g.: "http://localhost:8080".'); | ||
} | ||
return process.env.MNDY_SERVER_ADDRESS; | ||
}; | ||
export var getMondayCodeContext = function () { return ({ | ||
@@ -5,0 +14,0 @@ app: process.env.K_SERVICE, |
@@ -1,2 +0,3 @@ | ||
import { Queue } from './queue'; | ||
import { QueueDev } from './queue.dev'; | ||
declare const Queue: typeof QueueDev; | ||
export { Queue }; |
import { IQueue } from '../types/queue'; | ||
export declare class Queue implements IQueue { | ||
export declare class QueueProd implements IQueue { | ||
private pubSubClient; | ||
@@ -8,2 +8,3 @@ constructor(); | ||
}): Promise<string>; | ||
validateMessageOrigin(secret: string): boolean; | ||
} |
import { MondayCodeContext } from '../types/env'; | ||
export declare const isLocalEnvironment: () => boolean; | ||
export declare const localServerAddress: () => string; | ||
export declare const getMondayCodeContext: () => MondayCodeContext; | ||
export declare const validateEnvironment: () => void; |
{ | ||
"name": "@mondaycom/apps-sdk", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260270
185
3501
28
7