New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@workerbase/sdk

Package Overview
Dependencies
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workerbase/sdk - npm Package Compare versions

Comparing version 0.1.15-beta.15 to 0.1.15-beta.16

22

dist/resources/Steps.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
InfoText: function (payload) {
var newButtons = [];
if (payload === null || payload === void 0 ? void 0 : payload.buttons) {
var index_1 = 0;
payload.buttons.forEach(function (button) {
var additionalData = { index: index_1 };
newButtons.push(__assign(__assign({}, button), additionalData));
index_1 += 1;
});
}
var stepId = Buffer.from(Math.random()

@@ -15,3 +35,3 @@ .toString()

description: payload === null || payload === void 0 ? void 0 : payload.description,
buttons: payload === null || payload === void 0 ? void 0 : payload.buttons,
buttons: newButtons,
};

@@ -18,0 +38,0 @@ },

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

create: function (spec) { return function (payload) { return __awaiter(void 0, void 0, void 0, function () {
var additionalData, data;
var newSteps, index_1, additionalData, finalPayload, data;
var _a;

@@ -92,6 +92,16 @@ return __generator(this, function (_b) {

case 0:
newSteps = [];
if (payload.steps) {
index_1 = 0;
payload.steps.forEach(function (step) {
var additionalData = { index: index_1 };
newSteps.push(__assign(__assign({}, step), additionalData));
index_1 += 1;
});
}
additionalData = { initialStepId: (_a = payload.steps) === null || _a === void 0 ? void 0 : _a[0].id };
finalPayload = __assign(__assign({}, payload), { steps: newSteps });
return [4 /*yield*/, doRequest_1.default(spec._api, spec.basePath + "/", {
method: 'POST',
data: __assign(__assign({}, payload), additionalData),
data: __assign(__assign({}, finalPayload), additionalData),
}, process.env.PROJECTS_SERVICE_HOST)];

@@ -98,0 +108,0 @@ case 1:

120

dist/utils/doRequest.js
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -49,20 +38,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.doRequest = void 0;
var axios_1 = __importDefault(require("axios"));
var parseurl_1 = __importDefault(require("parseurl"));
var apiVersion = 'v1';

@@ -73,75 +46,22 @@ exports.doRequest = function (api, endpoint, options, internalHostname) {

return __awaiter(void 0, void 0, void 0, function () {
var baseUrl, url, response, err_1, errorMessage, errorToThrow, _a, tmpVar1, tmpVar2, otherErrorData;
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
return __generator(this, function (_9) {
switch (_9.label) {
case 0:
if (!api.url) {
throw new Error('No WB_API_URL in environment or option found');
}
if (!api.accesstoken) {
throw new Error('No WB_ACCESS_TOKEN in environment or option found');
}
if (process.env.DEBUG) {
console.log({
WB_ENABLE_INTERNAL_ROUTING: process.env.WB_ENABLE_INTERNAL_ROUTING,
internalHostname: internalHostname,
});
}
if (process.env.WB_ENABLE_INTERNAL_ROUTING && internalHostname) {
// eslint-disable-next-line no-param-reassign
api.url = "http://" + internalHostname + ":3000/";
}
baseUrl = parseurl_1.default({ url: api.url }).href;
url = endpoint === 'graphql'
? baseUrl + "graphql"
: baseUrl + "api/" + apiVersion + "/" + endpoint;
_9.label = 1;
case 1:
_9.trys.push([1, 3, , 4]);
if (process.env.DEBUG) {
console.log(__assign({ url: url, headers: __assign({ accesstoken: api.accesstoken, 'User-Agent': "workerbase-sdk (" + api.version + ")", 'Content-Type': 'application/json' }, options.headers), method: 'GET' }, options));
}
return [4 /*yield*/, axios_1.default(__assign({ url: url, headers: __assign({ accesstoken: api.accesstoken, 'User-Agent': "workerbase-sdk (" + api.version + ")", 'Content-Type': 'application/json' }, options.headers), method: 'GET' }, options))];
case 2:
response = _9.sent();
return [2 /*return*/, response];
case 3:
err_1 = _9.sent();
errorMessage = err_1.message;
if (((_c = (_b = err_1.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.errorMessage) === 'HTTP Trigger failed' && ((_g = (_f = (_e = (_d = err_1.response) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.additionalData) === null || _g === void 0 ? void 0 : _g.errors)) {
errorMessage = (_l = (_k = (_j = (_h = err_1.response) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.error) === null || _k === void 0 ? void 0 : _k.additionalData) === null || _l === void 0 ? void 0 : _l.errors.map(function (ruleError) {
var _a, _b;
var ruleErrorReason = ((_a = ruleError === null || ruleError === void 0 ? void 0 : ruleError.err) === null || _a === void 0 ? void 0 : _a.message) ? ": " + ((_b = ruleError === null || ruleError === void 0 ? void 0 : ruleError.err) === null || _b === void 0 ? void 0 : _b.message) : "";
var message = "Connector triggering RuleId " + ruleError.ruleId + " failed " + ruleErrorReason;
return message.trim();
}).join(", ");
}
else if (((_o = (_m = err_1.response) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.errorMessage) &&
typeof ((_q = (_p = err_1.response) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.errorMessage) === 'string') {
errorMessage = (_s = (_r = err_1.response) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.errorMessage;
}
else if (((_u = (_t = err_1.response) === null || _t === void 0 ? void 0 : _t.data) === null || _u === void 0 ? void 0 : _u.errorMessage) &&
typeof ((_w = (_v = err_1.response) === null || _v === void 0 ? void 0 : _v.data) === null || _w === void 0 ? void 0 : _w.errorMessage) === 'object') {
errorMessage = JSON.stringify((_y = (_x = err_1.response) === null || _x === void 0 ? void 0 : _x.data) === null || _y === void 0 ? void 0 : _y.errorMessage);
}
else if ((_z = err_1.response) === null || _z === void 0 ? void 0 : _z.data) {
errorMessage = JSON.stringify((_0 = err_1.response) === null || _0 === void 0 ? void 0 : _0.data);
}
errorToThrow = new Error(errorMessage);
Object.assign(errorToThrow, {
requestUrl: ((_2 = (_1 = err_1 === null || err_1 === void 0 ? void 0 : err_1.request) === null || _1 === void 0 ? void 0 : _1.res) === null || _2 === void 0 ? void 0 : _2.responseUrl) || url,
requestMethod: (_3 = err_1 === null || err_1 === void 0 ? void 0 : err_1.request) === null || _3 === void 0 ? void 0 : _3.method,
requestData: (_4 = err_1 === null || err_1 === void 0 ? void 0 : err_1.config) === null || _4 === void 0 ? void 0 : _4.data,
requestParams: (_5 = err_1 === null || err_1 === void 0 ? void 0 : err_1.config) === null || _5 === void 0 ? void 0 : _5.params,
responseStatusCode: (_6 = err_1 === null || err_1 === void 0 ? void 0 : err_1.response) === null || _6 === void 0 ? void 0 : _6.status,
responseData: (_7 = err_1 === null || err_1 === void 0 ? void 0 : err_1.response) === null || _7 === void 0 ? void 0 : _7.data,
});
if ((_8 = err_1.response) === null || _8 === void 0 ? void 0 : _8.data) {
_a = err_1.response.data, tmpVar1 = _a.errorMessage, tmpVar2 = _a.success, otherErrorData = __rest(_a, ["errorMessage", "success"]);
Object.assign(errorToThrow, otherErrorData);
}
throw errorToThrow;
case 4: return [2 /*return*/];
}
return __generator(this, function (_a) {
return [2 /*return*/, {
data: {},
// `status` is the HTTP status code from the server response
status: 200,
// `statusText` is the HTTP status message from the server response
// As of HTTP/2 status text is blank or unsupported.
// (HTTP/2 RFC: https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2.4)
statusText: 'OK',
// `headers` the HTTP headers that the server responded with
// All header names are lower cased and can be accessed using the bracket notation.
// Example: `response.headers['content-type']`
headers: {},
// `config` is the config that was provided to `axios` for the request
config: {},
// `request` is the request that generated this response
// It is the last ClientRequest instance in node.js (in redirects)
// and an XMLHttpRequest instance in the browser
request: {},
}];
});

@@ -148,0 +68,0 @@ });

{
"name": "@workerbase/sdk",
"version": "0.1.15-beta.15",
"version": "0.1.15-beta.16",
"description": "",

@@ -5,0 +5,0 @@ "scripts": {

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