backendless-console-sdk
Version:
Backendless Console SDK for Node.js and browser
1,035 lines (976 loc) • 743 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("form-data"));
else if(typeof define === 'function' && define.amd)
define(["form-data"], factory);
else if(typeof exports === 'object')
exports["BackendlessConsoleSDK"] = factory(require("form-data"));
else
root["BackendlessConsoleSDK"] = factory(root["form-data"]);
})(global, (__WEBPACK_EXTERNAL_MODULE_form_data__) => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./src/activity-manager.js":
/*!*********************************!*\
!*** ./src/activity-manager.js ***!
\*********************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _urls = _interopRequireDefault(__webpack_require__(/*! ./urls */ "./src/urls.js"));
var _default = exports["default"] = function _default(req) {
return {
send: function send(appId, event) {
return req.post(_urls["default"].userActivity(appId), event);
}
};
};
/***/ }),
/***/ "./src/analytics.js":
/*!**************************!*\
!*** ./src/analytics.js ***!
\**************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
var _urls = _interopRequireDefault(__webpack_require__(/*! ./urls */ "./src/urls.js"));
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var year = 'YEAR';
var month = 'MONTH';
var lastDay = 'MONTH'; //no server analogue for now
var sixmo = 'HALF_YEAR';
var periods = {
lastDay: lastDay,
year: year,
month: month,
sixmo: sixmo
};
var transformPeriod = function transformPeriod(period) {
return periods[period] || month;
};
var buildSegmentsQuery = function buildSegmentsQuery(key, segments) {
var result = {};
if (segments) {
segments.forEach(function (segment) {
result["".concat(key, "[").concat(segment, "]")] = true;
});
}
return result;
};
var buildClientTypeSegmentsQuery = function buildClientTypeSegmentsQuery(clientTypes) {
return buildSegmentsQuery('apiKeyName', clientTypes);
};
var buildMessagingTypeSegmentsQuery = function buildMessagingTypeSegmentsQuery(messagingType) {
return buildSegmentsQuery('messagingType', messagingType);
};
var _default = exports["default"] = function _default(req) {
return {
getAppStats: function getAppStats(appId, period) {
return req.get("".concat(_urls["default"].appConsole(appId), "/application/stats")).query({
period: transformPeriod(period)
});
},
performance: function performance(appId, _ref) {
var aggInterval = _ref.aggInterval,
from = _ref.from,
to = _ref.to;
var params = {
aggregationPeriod: aggInterval.name,
startEpochSecond: from / 1000,
// the server expects timestamp in seconds, not in milliseconds
endEpochSecond: to / 1000
};
return req.get("".concat(_urls["default"].appConsole(appId), "/performance")).query(params).then(function (points) {
var result = {};
for (var i = from; i <= to; i += aggInterval.value) {
result[i] = points[i / 1000]; // the server return timestamp in seconds, not in milliseconds
}
return result;
});
},
concurrentRequests: function concurrentRequests(appId, _ref2) {
var aggInterval = _ref2.aggInterval,
from = _ref2.from,
to = _ref2.to;
var params = {
aggregationPeriod: aggInterval.name,
startEpochSecond: from / 1000,
// the server expects timestamp in seconds, not in milliseconds
endEpochSecond: to / 1000
};
return req.get("".concat(_urls["default"].appConsole(appId), "/concurrent-requests")).query(params).then(function (points) {
var result = {};
for (var i = from; i <= to; i += aggInterval.value) {
result[i] = points[i / 1000]; // the server return timestamp in seconds, not in milliseconds
}
return result;
});
},
apiCalls: function apiCalls(appId, _ref3) {
var clientTypes = _ref3.clientTypes,
_ref3$columns = _ref3.columns,
columns = _ref3$columns === void 0 ? {} : _ref3$columns,
period = _ref3.period,
from = _ref3.from,
to = _ref3.to;
period = period.toUpperCase();
var params = _objectSpread(_objectSpread({}, buildClientTypeSegmentsQuery(clientTypes)), {}, {
'withServiceName': columns.services,
'withMethodName': columns.methods,
'withSuccessCallCount': true,
//TODO: the server always return SuccessCallCount values
'withErrorCount': true,
//TODO: the server always return ErrorCount values
period: period
});
if (period === 'CUSTOM') {
params.dateFrom = from;
params.dateTo = to;
}
return req.get("".concat(_urls["default"].appConsole(appId), "/apicalls")).query(params);
},
messages: function messages(appId, _ref4) {
var clientTypes = _ref4.clientTypes,
messagingTypes = _ref4.messagingTypes,
period = _ref4.period,
from = _ref4.from,
to = _ref4.to;
period = period.toUpperCase();
var params = _objectSpread(_objectSpread(_objectSpread({}, buildClientTypeSegmentsQuery(clientTypes)), buildMessagingTypeSegmentsQuery(messagingTypes)), {}, {
period: period
});
if (period === 'CUSTOM') {
params.dateFrom = from;
params.dateTo = to;
}
return req.get("".concat(_urls["default"].appConsole(appId), "/messaging")).query(params);
},
users: function users(appId, _ref5) {
var period = _ref5.period,
from = _ref5.from,
to = _ref5.to;
period = period.toUpperCase();
var params = {
withActiveUsers: true,
//TODO: the server always return ActiveUsers values
withNewUsers: true,
//TODO: the server always return NewUsers values
withRegisteredUsers: true,
//TODO: the server always return RegisteredUsers values
withReturningUsers: true,
//TODO: the server always return ReturningUsers values
period: period
};
if (period === 'CUSTOM') {
params.dateFrom = from;
params.dateTo = to;
}
return req.get("".concat(_urls["default"].appConsole(appId), "/userstats")).query(params);
},
workers: function workers(appId, query) {
return req.get("".concat(_urls["default"].appConsole(appId), "/workers")).query(query);
}
};
};
/***/ }),
/***/ "./src/api-docs.js":
/*!*************************!*\
!*** ./src/api-docs.js ***!
\*************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _urls = _interopRequireDefault(__webpack_require__(/*! ./urls */ "./src/urls.js"));
var _default = exports["default"] = function _default(req) {
return {
generateDataTableApi: function generateDataTableApi(appId, tableName, options) {
return req.post(_urls["default"].apiDocsDataTable(appId, tableName), options);
},
generateMessagingChannelApi: function generateMessagingChannelApi(appId, channelName, options) {
return req.post(_urls["default"].apiDocsMessagingChannel(appId, channelName), options);
},
generateFilesApi: function generateFilesApi(appId, options) {
return req.post(_urls["default"].apiDocsFiles(appId), options);
},
generateServiceApi: function generateServiceApi(appId, serviceId, model, options) {
return req.post(_urls["default"].apiDocsService(appId, serviceId, model), options);
},
generateGeoApi: function generateGeoApi(appId, options) {
return req.post(_urls["default"].apiDocsGeo(appId), options);
}
};
};
/***/ }),
/***/ "./src/apps.js":
/*!*********************!*\
!*** ./src/apps.js ***!
\*********************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
var _routes = __webpack_require__(/*! ./utils/routes */ "./src/utils/routes.js");
var _baseService = _interopRequireDefault(__webpack_require__(/*! ./base/base-service */ "./src/base/base-service.js"));
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable max-len */
var routes = (0, _routes.prepareRoutes)({
apps: '/console/applications',
appFromZip: '/console/applications/from-zip',
appFromZipURL: '/console/applications/from-zip-url',
app: '/:appId/console/application',
appDevOptions: '/:appId/console/developer/options',
appReset: '/:appId/console/appreset',
appClone: '/:appId/console/cloneApp',
appCloneProcess: '/:appId/console/cloneApp/:processId',
appTransfer: '/:appId/console/application/transfer',
appsInfo: '/console/apps-info',
appInfo: '/:appId/console/app-info',
appInfoLogo: '/:appId/console/app-info/logos',
suggestedGeneratedDomains: '/console/applications/suggested-generated-domains'
});
var Apps = /*#__PURE__*/function (_BaseService) {
(0, _inherits2["default"])(Apps, _BaseService);
var _super = _createSuper(Apps);
function Apps(req) {
var _this;
(0, _classCallCheck2["default"])(this, Apps);
_this = _super.call(this, req);
_this.serviceName = 'apps';
return _this;
}
(0, _createClass2["default"])(Apps, [{
key: "createApp",
value: function createApp(app, query) {
return this.req.post(routes.apps(), app).query(query);
}
}, {
key: "createAppFromZIP",
value: function createAppFromZIP(app) {
return this.req.post(routes.appFromZip(), app);
}
}, {
key: "createAppFromZipUrl",
value: function createAppFromZipUrl(data) {
return this.req.post(routes.appFromZipURL(), data);
}
/**
* @aiToolName Get Applications
* @category Apps Management
* @description Retrieves a list of applications for the specified zone.
* @paramDef {"type":"string","name":"zone","label":"Zone","description":"The deployment zone. Valid values: 'US' or 'EU'","required":true}
* @sampleResult [{"version":"6.0.0","created":1700000000000,"subscriptionId":null,"originDomains":"*","customDomains":[],"showKitApiKey":null,"dbVersion":165,"lastDayOfUse":1700000001000,"ownerDeveloperId":"DEV-ID-123","zoneId":1,"oldGeoServiceEnabled":false,"type":"general","metaInfo":{"source":null,"enabledPanicModes":[],"compliance":{"hipaa":null},"mongoDbVersion":10,"useOldTableRelationsFormat":false},"id":"APP-ID-123","name":"MyApp"},{"version":"6.0.0","created":1700000002000,"subscriptionId":"SUB-456","originDomains":"*","customDomains":[],"showKitApiKey":null,"dbVersion":165,"lastDayOfUse":1700000003000,"ownerDeveloperId":"DEV-ID-123","zoneId":1,"oldGeoServiceEnabled":false,"type":"general","metaInfo":{"source":null,"enabledPanicModes":[],"compliance":{"hipaa":null},"mongoDbVersion":10,"useOldTableRelationsFormat":false},"id":"APP-ID-456","name":"TestApp"}]
*/
}, {
key: "getApps",
value: function getApps(zone) {
return this.req.get(routes.apps()).query({
zone: zone
});
}
}, {
key: "resetApp",
value: function resetApp(appId, resets) {
return this.req.post(routes.appReset(appId), resets);
}
/**
* @aiToolName Rename Application
* @category Apps Management
* @description Changes the name of an existing application.
* @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application to rename","required":true}
* @paramDef {"type":"string","name":"appName","label":"New App Name","description":"The new name for the application","required":true}
* @sampleResult {"appName":"RenamedApp","appId":"APP-ID-123","version":"6.0.0","created":1700000000000,"subscriptionId":"SUB-456","originDomains":"*","customDomains":[],"showKitApiKey":null,"dbVersion":165,"lastDayOfUse":1700000001000,"ownerDeveloperId":"DEV-ID-123","zoneId":1,"oldGeoServiceEnabled":false,"type":"general","metaInfo":{"source":null,"enabledPanicModes":[],"compliance":{"hipaa":null},"mongoDbVersion":10,"useOldTableRelationsFormat":false}}
*/
}, {
key: "renameApp",
value: function renameApp(appId, appName) {
return this.req.put(routes.app(appId), {
appName: appName
});
}
/**
* @aiToolName Delete Application
* @category Apps Management
* @description Permanently deletes an application and all its data.
* @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application to delete","required":true}
* @sampleResult {"success":true}
*/
}, {
key: "deleteApp",
value: function deleteApp(appId) {
return this.req["delete"](routes.app(appId));
}
}, {
key: "cloneApp",
value: function cloneApp(appId, newApp) {
return this.req.post(routes.appClone(appId), newApp);
}
/**
* @aiToolName Generate App ZIP
* @category Apps Management
* @description Generates a ZIP archive of the application for backup or transfer.
* @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application to archive","required":true}
* @sampleResult "Application transfer started. At the end, you will receive an email with the link to download zip file."
*/
}, {
key: "generateAppZIP",
value: function generateAppZIP(appId) {
return this.req.post(routes.appTransfer(appId));
}
}, {
key: "getCloningAppStatus",
value: function getCloningAppStatus(appId, processId) {
return this.req.get(routes.appCloneProcess(appId, processId));
}
}, {
key: "loadAppsMenuItems",
value: function loadAppsMenuItems() {
return this.req.get('/console/applications/menu-items');
}
}, {
key: "loadAppFavorites",
value: function loadAppFavorites(appId, devId) {
return this.req.get('/console/applications/app-favorites').query({
appId: appId,
devId: devId
});
}
/**
* @aiToolName Load Apps Info
* @category Apps Management
* @description Retrieves detailed information for multiple applications.
* @paramDef {"type":"array","name":"appsIds","label":"App IDs","description":"List of application identifiers","required":true}
* @sampleResult [{"id":"APP-ID-123","name":"MyApp","version":"6.0.0","created":1700000000000},{"id":"APP-ID-456","name":"TestApp","version":"6.0.0","created":1700000001000}]
*/
}, {
key: "loadAppsInfo",
value: function loadAppsInfo(appsIds) {
return this.req.get(routes.appsInfo()).query({
appsIds: appsIds
});
}
/**
* @typedef {Object} updateAppInfo__info
* @property {string} appName - The new name for the application
* @property {string} devEmail - Developer email address
*/
/**
* @aiToolName Update App Info
* @category Apps Management
* @description Updates the information and metadata of an application.
* @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application","required":true}
* @paramDef {"type":"updateAppInfo__info","name":"info","label":"App Information","description":"Object containing updated application information","required":true}
* @sampleResult {"appId":"APP-ID-123","devEmail":"developer@example.com","appName":"UpdatedAppName"}
*/
}, {
key: "updateAppInfo",
value: function updateAppInfo(appId, info) {
return this.req.post(routes.appInfo(appId), info);
}
}, {
key: "updateAppLogo",
value: function updateAppLogo(appId, logo) {
return this.req.post(routes.appInfoLogo(appId), logo);
}
}, {
key: "generateSubdomains",
value: function generateSubdomains(zone) {
return this.req.get(routes.suggestedGeneratedDomains()).query({
zone: zone
});
}
}, {
key: "getAppDevOptions",
value: function getAppDevOptions(appId) {
return this.req.get(routes.appDevOptions(appId));
}
}, {
key: "updateAppDevOptions",
value: function updateAppDevOptions(appId, options) {
return this.req.put(routes.appDevOptions(appId), options);
}
}]);
return Apps;
}(_baseService["default"]);
var _default = exports["default"] = function _default(req) {
return Apps.create(req);
};
/***/ }),
/***/ "./src/automation.js":
/*!***************************!*\
!*** ./src/automation.js ***!
\***************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _routes = __webpack_require__(/*! ./utils/routes */ "./src/utils/routes.js");
/* eslint-disable max-len */
var routes = (0, _routes.prepareRoutes)({
flows: '/api/app/:appId/automation/flow/version',
flowsWithElements: '/api/app/:appId/automation/flow/version/with-elements',
flowsWithElementsDetails: '/api/app/:appId/automation/flow/version/with-elements-details',
flowsElements: '/api/app/:appId/automation/flows/versions/elements',
flow: '/api/app/:appId/automation/flow/version/:versionId',
flowSchedule: '/api/app/:appId/automation/flow/version/:versionId/schedule',
newFlowVersion: '/api/app/:appId/automation/flow/version/:versionId/new-version',
flowState: '/api/app/:appId/automation/flow/version/:versionId/:state',
sharedMemory: '/api/app/:appId/automation/flow/version/:versionId/shared-memory',
flowGroupName: '/api/app/:appId/automation/flow/:flowId/name',
flowDescription: '/api/app/:appId/automation/flow/version/:versionId/description',
flowGroup: '/api/app/:appId/automation/flow/:flowId',
flowVersionAnalytics: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics',
flowVersionMetrics: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/version-metrics',
stepsMetrics: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/step-metrics',
flowInstances: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/find',
countInstances: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/count',
flowInstance: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId',
flowInstanceInitialData: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId/initial-and-static-data',
stopInstanceExecution: '/api/app/:appId/automation/flow/:flowId/version/:versionId/instances/:executionId/stop',
runDebugInstance: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/instance/run-new',
getFlowHistoricalConfig: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/version-history/:configId',
elementExecutionInfo: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/instances/:executionId/element/:elementId',
flowSlA: '/api/app/:appId/automation/flow/:flowId/version/:versionId/sla/goals',
flowSlAGoal: '/api/app/:appId/automation/flow/:flowId/version/:versionId/sla/goals/:id',
SLACalendars: '/api/app/:appId/automation/flow/sla/calendar',
SLACalendar: '/api/app/:appId/automation/flow/sla/calendar/:id',
errorHandlerAnalytics: '/api/app/:appId/automation/flow/:flowId/version/:versionId/analytics/error-handler/:errorHandlerId/recorded-errors',
customElements: '/api/node-server/manage/app/:appId/flowrunner/custom-elements',
flowrunnerAiAgentsProviders: '/api/node-server/manage/flowrunner/ai-agents/providers',
startDebugSession: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/start-session',
stopDebugSession: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/stop-session',
testMonitorHistory: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/history',
debugExecutionContext: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/test-monitor/execution-context',
runElementInDebugMode: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/run/element/:elementId',
stopTriggerInDebugMode: '/api/app/:appId/automation/flow/:flowId/version/:versionId/debug/stop/trigger/:triggerId',
registerAIAssistant: '/api/app/:appId/automation/ai/assistants/register',
aiAssistants: '/api/app/:appId/automation/ai/assistants',
aiAssistant: '/api/app/:appId/automation/ai/assistants/:id',
flowLogs: '/api/app/:appId/automation/flow/version/:id/logs/find',
flowLogsLevel: '/api/app/:appId/automation/:flowId/logging/level',
exportFlowVersion: '/api/app/:appId/automation/flow/version/:id/export',
importFlowVersion: '/api/app/:appId/automation/flow/:flowId/import',
createFlowFromJSON: '/api/app/:appId/automation/flow/import',
realtimeTriggerCallbackUrl: '/api/app/:appId/automation/flow/version/trigger/realtime/callback-url',
startLearningMode: '/api/app/:appId/automation/flow/:flowId/version/:id/debug/element/:elementId/learning/start',
stopLearningMode: '/api/app/:appId/automation/flow/:flowId/version/:id/debug/element/:elementId/learning/stop',
getElementsResults: '/api/app/:appId/automation/flow/:flowId/version/:id/debug/element/results',
getElementsLearningResults: '/api/app/:appId/automation/flow/:flowId/version/:id/debug/element/learning/all-results',
getElementLearningResult: '/api/app/:appId/automation/flow/:flowId/version/:id/debug/element/:elementId/learning/result',
installFlowProduct: '/api/app/:appId/automation/flow/marketplace/install/:productId',
uninstallFlowProduct: '/api/app/:appId/automation/flow/marketplace/uninstall/:productId',
createSubFlow: '/api/app/:appId/automation/version/:versionId/subflow',
getSubFlowByID: '/api/app/:appId/automation/version/:versionId/subflow/:subFlowId',
updateSubFlowName: '/api/app/:appId/automation/version/:versionId/subflow/:subFlowId/name',
updateSubFlowByID: '/api/app/:appId/automation/version/:versionId/subflow/:subFlowId',
deleteSubFlowByID: '/api/app/:appId/automation/version/:versionId/subflow/:subFlowId',
getSubFlows: '/api/app/:appId/automation/version/:versionId/subflow',
getSubFlowsWithElements: '/api/app/:appId/automation/version/:versionId/subflow/with-elements',
getSubFlowsWithElementsDetails: '/api/app/:appId/automation/version/:versionId/subflow/with-elements-details'
});
var _default = exports["default"] = function _default(req) {
return {
getFlows: function getFlows(appId) {
return req.automation.get(routes.flows(appId));
},
getFlowsElements: function getFlowsElements(appId, elementType, elementSubtype) {
return req.automation.get(routes.flowsElements(appId)).query({
elementType: elementType,
elementSubtype: elementSubtype
});
},
getFlowsWithElements: function getFlowsWithElements(appId) {
return req.automation.get(routes.flowsWithElements(appId));
},
getFlowsWithElementsDetails: function getFlowsWithElementsDetails(appId, status) {
return req.automation.get(routes.flowsWithElementsDetails(appId)).query({
status: status
});
},
getFlow: function getFlow(appId, id) {
return req.automation.get(routes.flow(appId, id));
},
createFlow: function createFlow(appId, flow) {
return req.automation.post(routes.flows(appId), flow);
},
updateFlow: function updateFlow(appId, flow) {
return req.automation.put(routes.flow(appId, flow.id), flow);
},
deleteFlow: function deleteFlow(appId, id) {
return req.automation["delete"](routes.flow(appId, id));
},
enableFlow: function enableFlow(appId, id) {
return req.automation.post(routes.flowState(appId, id, 'enable'));
},
pauseFlow: function pauseFlow(appId, id) {
return req.automation.post(routes.flowState(appId, id, 'pause'));
},
terminateFlow: function terminateFlow(appId, id) {
return req.automation.post(routes.flowState(appId, id, 'terminate'));
},
createNewVersion: function createNewVersion(appId, id) {
return req.automation.post(routes.newFlowVersion(appId, id));
},
editFlowsGroupName: function editFlowsGroupName(appId, groupId, name) {
return req.automation.put(routes.flowGroupName(appId, groupId), {
name: name
});
},
deleteFlowsGroup: function deleteFlowsGroup(appId, groupId) {
return req.automation["delete"](routes.flowGroup(appId, groupId));
},
updateFlowDescription: function updateFlowDescription(appId, versionId, description) {
return req.put(routes.flowDescription(appId, versionId, description), {
description: description
});
},
getFlowVersionMetrics: function getFlowVersionMetrics(appId, flowId, versionId, fromDate, toDate) {
return req.automation.get(routes.flowVersionMetrics(appId, flowId, versionId)).query({
fromDate: fromDate,
toDate: toDate
});
},
getFlowStepsMetrics: function getFlowStepsMetrics(appId, flowId, versionId, fromDate, toDate) {
return req.automation.get(routes.stepsMetrics(appId, flowId, versionId)).query({
fromDate: fromDate,
toDate: toDate
});
},
getFlowInstances: function getFlowInstances(appId, flowId, versionId, body) {
return req.automation.post(routes.flowInstances(appId, flowId, versionId), body);
},
getFlowInstanceInitialData: function getFlowInstanceInitialData(appId, flowId, versionId, executionId) {
return req.automation.get(routes.flowInstanceInitialData(appId, flowId, versionId, executionId));
},
runDebugInstance: function runDebugInstance(appId, flowId, versionId, body) {
return req.automation.post(routes.runDebugInstance(appId, flowId, versionId), body);
},
countFlowInstances: function countFlowInstances(appId, flowId, versionId, body) {
return req.automation.post(routes.countInstances(appId, flowId, versionId), body);
},
getFlowInstanceAnalytics: function getFlowInstanceAnalytics(appId, flowId, versionId, executionId) {
return req.automation.get(routes.flowInstance(appId, flowId, versionId, executionId));
},
stopFlowInstanceExecution: function stopFlowInstanceExecution(appId, flowId, versionId, executionId) {
return req.automation.post(routes.stopInstanceExecution(appId, flowId, versionId, executionId));
},
cleanFlowVersionAnalytics: function cleanFlowVersionAnalytics(appId, flowId, versionId) {
return req.automation["delete"](routes.flowVersionAnalytics(appId, flowId, versionId));
},
getElementExecutionInfo: function getElementExecutionInfo(appId, flowId, versionId, executionId, elementId) {
return req.automation.get(routes.elementExecutionInfo(appId, flowId, versionId, executionId, elementId));
},
loadErrorHandlerAnalytics: function loadErrorHandlerAnalytics(appId, flowId, versionId, errorHandlerId, fromDate, toDate) {
return req.automation.get(routes.errorHandlerAnalytics(appId, flowId, versionId, errorHandlerId)).query({
fromDate: fromDate,
toDate: toDate
});
},
getCustomElements: function getCustomElements(appId) {
return req.automation.get(routes.customElements(appId));
},
getAiAgentsProviders: function getAiAgentsProviders() {
return req.nodeAPI.get(routes.flowrunnerAiAgentsProviders());
},
getRealtimeTriggerCallbackUrl: function getRealtimeTriggerCallbackUrl(appId, scope, hostType, serviceName, modelName, lang) {
return req.automation.get(routes.realtimeTriggerCallbackUrl(appId)).query({
scope: scope,
hostType: hostType,
serviceName: serviceName,
modelName: modelName,
lang: lang
});
},
startDebugSession: function startDebugSession(appId, flowId, versionId, forceStart, fromSubFlowElementId) {
return req.automation.post(routes.startDebugSession(appId, flowId, versionId)).query({
forceStart: forceStart,
fromSubFlowElementId: fromSubFlowElementId
});
},
stopDebugSession: function stopDebugSession(appId, flowId, versionId, sessionId) {
return req.automation["delete"](routes.stopDebugSession(appId, flowId, versionId)).query({
sessionId: sessionId
});
},
loadTestMonitorHistory: function loadTestMonitorHistory(appId, flowId, versionId, sessionId) {
return req.automation.get(routes.testMonitorHistory(appId, flowId, versionId)).query({
sessionId: sessionId
});
},
clearTestMonitorHistory: function clearTestMonitorHistory(appId, flowId, versionId, sessionId) {
return req.automation["delete"](routes.testMonitorHistory(appId, flowId, versionId)).query({
sessionId: sessionId
});
},
loadDebugExecutionContext: function loadDebugExecutionContext(appId, flowId, versionId, sessionId) {
return req.automation.get(routes.debugExecutionContext(appId, flowId, versionId)).query({
sessionId: sessionId
});
},
updateDebugExecutionContext: function updateDebugExecutionContext(appId, flowId, versionId, context, sessionId) {
return req.automation.put(routes.debugExecutionContext(appId, flowId, versionId), context).query({
sessionId: sessionId
});
},
runElementInDebugMode: function runElementInDebugMode(appId, flowId, versionId, elementId, body, sessionId) {
return req.automation.post(routes.runElementInDebugMode(appId, flowId, versionId, elementId), body, sessionId).query({
sessionId: sessionId
});
},
stopTriggerInDebugMode: function stopTriggerInDebugMode(appId, flowId, versionId, tiggerId, sessionId) {
return req.automation["delete"](routes.stopTriggerInDebugMode(appId, flowId, versionId, tiggerId), sessionId).query({
sessionId: sessionId
});
},
getFlowSLAGoals: function getFlowSLAGoals(appId, flowId, versionId) {
return req.automation.get(routes.flowSlA(appId, flowId, versionId));
},
createFlowSLAGoal: function createFlowSLAGoal(appId, flowId, versionId, data) {
return req.automation.post(routes.flowSlA(appId, flowId, versionId), data);
},
updateFlowSLAGoal: function updateFlowSLAGoal(appId, flowId, versionId, data, id) {
return req.automation.put(routes.flowSlAGoal(appId, flowId, versionId, id), data);
},
deleteFlowSLAGoal: function deleteFlowSLAGoal(appId, flowId, versionId, id) {
return req.automation["delete"](routes.flowSlAGoal(appId, flowId, versionId, id));
},
getSLACalendars: function getSLACalendars(appId) {
return req.automation.get(routes.SLACalendars(appId));
},
createSLACalendar: function createSLACalendar(appId, data) {
return req.automation.post(routes.SLACalendars(appId), data);
},
updateSLACalendar: function updateSLACalendar(appId, data, id) {
return req.automation.put(routes.SLACalendar(appId, id), data);
},
deleteSLACalendar: function deleteSLACalendar(appId, id) {
return req.automation["delete"](routes.SLACalendar(appId, id));
},
registerAIAssistant: function registerAIAssistant(appId, openAiAssistantId) {
return req.automation.post(routes.registerAIAssistant(appId), {
openAiAssistantId: openAiAssistantId
});
},
createAIAssistant: function createAIAssistant(appId, assistant) {
return req.automation.post(routes.aiAssistants(appId), assistant);
},
updateAIAssistant: function updateAIAssistant(appId, assistant) {
return req.automation.put(routes.aiAssistant(appId, assistant.id), assistant);
},
deleteAIAssistant: function deleteAIAssistant(appId, assistantId) {
return req.automation["delete"](routes.aiAssistant(appId, assistantId));
},
getAIAssistants: function getAIAssistants(appId) {
return req.automation.get(routes.aiAssistants(appId));
},
loadFlowLogs: function loadFlowLogs(appId, versionId, data) {
return req.automation.post(routes.flowLogs(appId, versionId), data);
},
getFlowLogsLevel: function getFlowLogsLevel(appId, flowId) {
return req.automation.get(routes.flowLogsLevel(appId, flowId));
},
updateFlowLogsLevel: function updateFlowLogsLevel(appId, flowId, data) {
return req.automation.put(routes.flowLogsLevel(appId, flowId), data);
},
exportFlowVersion: function exportFlowVersion(appId, versionId) {
return req.automation.get(routes.exportFlowVersion(appId, versionId));
},
importFlowVersion: function importFlowVersion(appId, versionId, flow) {
return req.automation.post(routes.importFlowVersion(appId, versionId), flow);
},
createFlowFromJSON: function createFlowFromJSON(appId, flow) {
return req.automation.post(routes.createFlowFromJSON(appId), flow);
},
updateFlowSchedule: function updateFlowSchedule(appId, versionId, data) {
return req.automation.put(routes.flowSchedule(appId, versionId), data);
},
startLearningMode: function startLearningMode(appId, flowId, versionId, elementId) {
return req.automation.post(routes.startLearningMode(appId, flowId, versionId, elementId));
},
stopLearningMode: function stopLearningMode(appId, flowId, versionId, elementId) {
return req.automation.post(routes.stopLearningMode(appId, flowId, versionId, elementId));
},
getElementsResults: function getElementsResults(appId, flowId, versionId) {
return req.automation.get(routes.getElementsResults(appId, flowId, versionId));
},
getElementsLearningResults: function getElementsLearningResults(appId, flowId, versionId) {
return req.automation.get(routes.getElementsLearningResults(appId, flowId, versionId));
},
getElementLearningResult: function getElementLearningResult(appId, flowId, versionId, elementId) {
return req.automation.get(routes.getElementLearningResult(appId, flowId, versionId, elementId));
},
installFlowFromMarketplace: function installFlowFromMarketplace(appId, productId, version, data) {
return req.automation.post(routes.installFlowProduct(appId, productId), data).query({
version: version
});
},
uninstallFlowProduct: function uninstallFlowProduct(appId, productId, data) {
return req.automation["delete"](routes.uninstallFlowProduct(appId, productId), data);
},
updateSharedMemorySettings: function updateSharedMemorySettings(appId, versionId, data) {
return req.automation.put(routes.sharedMemory(appId, versionId), data);
},
createSubFlow: function createSubFlow(appId, versionId, data) {
return req.automation.post(routes.createSubFlow(appId, versionId), data);
},
getSubFlow: function getSubFlow(appId, versionId, subFlowVersionId) {
return req.automation.get(routes.getSubFlowByID(appId, versionId, subFlowVersionId));
},
updateSubFlow: function updateSubFlow(appId, versionId, subFlowVersionId, data) {
return req.automation.put(routes.updateSubFlowByID(appId, versionId, subFlowVersionId), data);
},
updateSubFlowName: function updateSubFlowName(appId, versionId, subFlowId, name) {
return req.automation.put(routes.updateSubFlowName(appId, versionId, subFlowId), {
name: name
});
},
deleteSubFlow: function deleteSubFlow(appId, versionId, subFlowId) {
return req.automation["delete"](routes.deleteSubFlowByID(appId, versionId, subFlowId));
},
getSubFlows: function getSubFlows(appId, versionId) {
return req.automation.get(routes.getSubFlows(appId, versionId));
},
getSubFlowsWithElements: function getSubFlowsWithElements(appId, versionId) {
return req.automation.get(routes.getSubFlowsWithElements(appId, versionId));
},
getSubFlowsWithElementsDetails: function getSubFlowsWithElementsDetails(appId, versionId) {
return req.automation.get(routes.getSubFlowsWithElementsDetails(appId, versionId));
},
getFlowHistoricalConfig: function getFlowHistoricalConfig(appId, flowId, versionId, configId) {
return req.automation.get(routes.getFlowHistoricalConfig(appId, flowId, versionId, configId));
}
};
};
/***/ }),
/***/ "./src/base/base-service.js":
/*!**********************************!*\
!*** ./src/base/base-service.js ***!
\**********************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ "./node_modules/@babel/runtime/helpers/construct.js"));
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
var BaseService = /*#__PURE__*/function () {
function BaseService(req) {
(0, _classCallCheck2["default"])(this, BaseService);
this.req = req;
}
(0, _createClass2["default"])(BaseService, null, [{
key: "create",
value: function create(req) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var instance = (0, _construct2["default"])(this, [req].concat(args));
var methods = Object.getOwnPropertyNames(this.prototype).filter(function (name) {
return name !== 'constructor' && typeof instance[name] === 'function';
});
return methods.reduce(function (obj, name) {
obj[name] = instance[name].bind(instance);
return obj;
}, {});
}
}]);
return BaseService;
}();
var _default = exports["default"] = BaseService;
/***/ }),
/***/ "./src/billing/index.js":
/*!******************************!*\
!*** ./src/billing/index.js ***!
\******************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.billingAPI = billingAPI;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
var _routes = __webpack_require__(/*! ./routes */ "./src/billing/routes.js");
var _payments = __webpack_require__(/*! ./payments */ "./src/billing/payments.js");
var _limits = __webpack_require__(/*! ./limits */ "./src/billing/limits.js");
var _plans = __webpack_require__(/*! ./plans */ "./src/billing/plans.js");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function billingAPI(req) {
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (0, _payments.billingPaymentsAPI)(req)), (0, _limits.billingLimitsAPI)(req)), (0, _plans.billingPlansAPI)(req)), {}, {
getAppBillingInfo: function getAppBillingInfo(appId) {
return req.billing.get(_routes.routes.appBillingInfo(appId));
},
getAutomationBillingInfo: function getAutomationBillingInfo(appId) {
return req.billing.get(_routes.routes.automationBillingInfo(appId));
},
getSubscriptionStatus: function getSubscriptionStatus(appId) {
return req.billing.get(_routes.routes.subscriptionStatus(appId));
},
loadSubscriptionsInfo: function loadSubscriptionsInfo() {
return req.billing.get(_routes.routes.devSubscriptionsInfo());
},
getAppBillingPeriodInfo: function getAppBillingPeriodInfo(appId) {
return req.billing.get(_routes.routes.appBillingPeriodInfo(appId));
},
getAutomationBillingPeriodInfo: function getAutomationBillingPeriodInfo(appId) {
return req.billing.get(_routes.routes.automationBillingPeriodInfo(appId));
} // TODO: seems like we do not use the function
// getInviteCode(appId) {
// return req.billing.get(routes.inviteCode(appId))
// },
});
}
/***/ }),
/***/ "./src/billing/limits.js":
/*!*******************************!*\
!*** ./src/billing/limits.js ***!
\*******************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.billingLimitsAPI = billingLimitsAPI;
var _routes = __webpack_require__(/*! ./routes */ "./src/billing/routes.js");
function billingLimitsAPI(req) {
return {
getAppPlanComponentsData: function getAppPlanComponentsData(appId, planId, billingPeriod) {
return req.billing.get(_routes.routes.appPlanComponentsData(appId, planId, billingPeriod));
},
getAppCurrentPlanComponentData: function getAppCurrentPlanComponentData(appId) {
return req.billing.get(_routes.routes.appPlanComponentsData(appId, 'current', 'current'));
},
getAutomationPlanComponentsData: function getAutomationPlanComponentsData(appId, planId, billingPeriod) {
return req.billing.get(_routes.routes.automationPlanComponentsData(appId, planId, billingPeriod));
},
getAutomationCurrentPlanComponentData: function getAutomationCurrentPlanComponentData(appId) {
return req.billing.get(_routes.routes.automationPlanComponentsData(appId, 'current', 'current'));
},
getComponentLimit: function getComponentLimit(appId, componentId) {
return req.billing.get(_routes.routes.componentLimit(appId, componentId));
},
apiCallsBlocked: function apiCallsBlocked(appId) {
return req.billing.get(_routes.routes.apiCallsBlocked(appId));
},
loadHiveUsage: function loadHiveUsage(appId) {
var cached = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return req.billing.get(_routes.routes.hiveUsage(appId)).query({
cached: cached
});
},
loadHiveLimit: function loadHiveLimit(appId) {
return req.billing.get(_routes.routes.hiveLimits(appId));
},
scalePlanePricingEstimate: function scalePlanePricingEstimate(appId, query) {
return req.billing.get(_routes.routes.tiersFloatPriceEstimation(appId)).query(query);
},
scaleFixedPlanePricingEstimate: function scaleFixedPlanePricingEstimate(appId, tierId, query) {
return req.billing.get(_routes.routes.tiersFixedPriceEstimation(appId, tierId)).query(query);
},
getMaxTier: function getMaxTier(appId) {
return req.billing.get(_routes.routes.maxTier(appId));
},
setMaxTier: function setMaxTier(appId, tierId) {
return req.billing.put(_routes.routes.maxTier(appId), {
tierId: tierId
});
},
getTiersList: function getTiersList(appId) {
return req.billing.get(_routes.routes.tiers(appId));
}
};
}
/***/ }),
/***/ "./src/billing/payments.js":
/*!*********************************!*\
!*** ./src/billing/payments.js ***!
\*********************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.billingPaymentsAPI = billingPaymentsAPI;
var _routes = __webpack_require__(/*! ./routes */ "./src/billing/routes.js");
function billingPaymentsAPI(req) {
return {
loadPaymentProfilesForCloneApp: function loadPaymentProfilesForCloneApp(appId) {
return req.billing.get(_routes.routes.paymentProfilesForCloneApp(appId));
},
confirmConsolidateApp: function confirmConsolidateApp(appId, _ref) {
var paymentProfileId = _ref.paymentProfileId,
newBillingPlan = _ref.newBillingPlan,
newBillingPeriod = _ref.newBillingPeriod;
return req.billing.put(_routes.routes.consolidateApp(appId, paymentProfileId)).query({
newBillingPlan: newBillingPlan,
newBillingPeriod: newBillingPeriod
});
},
loadPaymentProfiles: function loadPaymentProfiles() {
return req.billing.get(_routes.routes.devPaymentProfile());
},
setAppPaymentProfile: function setAppPaymentProfile(appId, paymentProfileId) {
return req.billing.put(_routes.routes.appPaymentProfileCard(appId, paymentProfileId));
},
setAutomationPaymentProfile: function setAutomationPaymentProfile(appId, paymentProfileId) {
return req.billing.put(_routes.routes.automationPaymentProfileCard(appId, paymentProfileId));
},
addPaymentProfile: function addPaymentProfile(data) {
return req.billing.post(_routes.routes.devPaymentProfile(), data);
},
updatePaymentProfile: function updatePaymentProfile(id, data) {
return req.billing.put(_routes.routes.devPaymentProfileById(id), data);
},
deletePaymentProfile: function deletePaymentProfile(id) {
return req.billing["delete"](_routes.routes.devPaymentProfileById(id));
},
exchangeBBtoUSD: function exchangeBBtoUSD(appId, bbAmount) {
return req.billing.post(_routes.routes.exchangeBB(appId), bbAmount).set({
'Content-Type': 'application/json'
});
}
};
}
/***/ }),
/***/ "./src/billing/plans.js":
/*!******************************!*\
!*** ./src/billing/plans.js ***!
\******************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.billingPlansAPI = billingPlansAPI;
var _routes = __webpack_require__(/*! ./routes */ "./src/billing/routes.js");
function billingPlansAPI(req) {
return {
getAppPlans: function getAppPlans(appId) {
return req.billing.get(_routes.routes.appBillingPlans(app