UNPKG

backendless-console-sdk

Version:

Backendless Console SDK for Node.js and browser

393 lines (391 loc) 21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.users = exports.userActivity = exports.tableColumns = exports.serverCode = exports.securityRoles = exports.security = exports.oauth2 = exports.oauth1 = exports.oauth0Config = exports.oauth0Binding = exports.oauth0 = exports.mobileSettingsAndroid = exports.mobileSettings = exports.messagingPushTemplates = exports.messagingPushTemplate = exports.messagingPushRecipientsCount = exports.messagingPushChannelTemplates = exports.messagingPushChannelTemplate = exports.messagingPushButtonTemplates = exports.messagingPushButtonTemplate = exports.messagingPush = exports.messagingChannels = exports.messagingChannel = exports.messaging = exports.marketplace = exports.mailSettings = exports.landingPage = exports.installEmailTemplate = exports.geo = exports.gamificationApp = exports.gamification = exports.files = exports.fileView = exports.fileUpload = exports.fileRename = exports.fileMove = exports.fileExists = exports.fileEdit = exports.fileDownload = exports.fileDelete = exports.fileCreate = exports.fileCopy = exports.emailTemplates = exports.downloadComplianceFile = exports.directoryView = exports.devTeam = exports["default"] = exports.dataViews = exports.dataToVisualize = exports.dataTables = exports.dataTableGroupCount = exports.dataTableGroup = exports.dataTableBulkUpsert = exports.dataTableBulkCreate = exports.dataTable = exports.dataRecord = exports.dataHives = exports.dataHiveStoreKey = exports.dataHiveStore = exports.dataHive = exports.dataConnectors = exports.dataConnectorTemplates = exports.dataConnectorTables = exports.dataConnectorTableEntries = exports.dataConnectorStoredProcedures = exports.dataConnectorStoredProcedureExecution = exports.dataConnector = exports.dataConfigs = exports.dataCell = exports.data = exports.createDir = exports.console = exports.codelessFunctions = exports.codelessFunctionSource = exports.codelessDeployModel = exports.codelessApiServices = exports.codeless = exports.cache = exports.blueprints = exports.blServicesClientDownload = exports.blProd = exports.blHandlersChain = exports.blHandlersCategory = exports.blDraftsProjectDownload = exports.blDraft = exports.blBasePath = exports.billing = exports.atomicCounters = exports.appInfo = exports.appConsole = exports.apiDocsService = exports.apiDocsMessagingChannel = exports.apiDocsGeo = exports.apiDocsFiles = exports.apiDocsDataTable = exports.apiDocs = void 0; var _path = require("./utils/path"); /* eslint-disable max-len */ var console = exports.console = function console(authKey) { return "/console".concat((0, _path.optional)(authKey)); }; var appConsole = exports.appConsole = function appConsole(appId, authKey) { return "/".concat(appId).concat(console(authKey)); }; var consoleSection = function consoleSection(section) { return function (appId) { return "".concat(appConsole(appId), "/").concat(section); }; }; var mailSettings = exports.mailSettings = consoleSection('mailsettings'); var security = exports.security = consoleSection('security'); var serverCode = exports.serverCode = consoleSection('servercode'); var blBasePath = exports.blBasePath = consoleSection('localservices'); var data = exports.data = consoleSection('data'); var geo = exports.geo = consoleSection('geo'); var files = exports.files = consoleSection('files'); var messaging = exports.messaging = consoleSection('messaging'); var dataTables = exports.dataTables = function dataTables(appId) { return "".concat(data(appId), "/tables"); }; var dataTable = exports.dataTable = function dataTable(appId, tableName) { return "".concat(data(appId), "/").concat(encodeURI(tableName)); }; var dataTableBulkCreate = exports.dataTableBulkCreate = function dataTableBulkCreate(appId, tableName) { return "".concat(data(appId), "/bulk/").concat(encodeURI(tableName)); }; var dataTableBulkUpsert = exports.dataTableBulkUpsert = function dataTableBulkUpsert(appId, tableName) { return "".concat(data(appId), "/bulkupsert/").concat(encodeURI(tableName)); }; var dataTableGroup = exports.dataTableGroup = function dataTableGroup(appId, tableName) { return "".concat(data(appId), "/data-grouping/").concat(encodeURI(tableName)); }; var dataTableGroupCount = exports.dataTableGroupCount = function dataTableGroupCount(appId, tableName) { return "".concat(dataTableGroup(appId, tableName), "/count"); }; var dataRecord = exports.dataRecord = function dataRecord(appId, tableName, recordId) { return "".concat(dataTable(appId, tableName), "/").concat(recordId); }; var dataCell = exports.dataCell = function dataCell(appId, tableName, recordId, columnName) { return "".concat(dataRecord(appId, tableName, recordId), "/").concat(columnName); }; var dataConfigs = exports.dataConfigs = function dataConfigs(appId) { return "".concat(data(appId), "/config"); }; var tableColumns = exports.tableColumns = function tableColumns(appId, tableName) { return "".concat(dataTables(appId), "/").concat(encodeURI(tableName), "/columns"); }; var securityRoles = exports.securityRoles = function securityRoles(appId) { return "".concat(security(appId), "/roles"); }; var generalizeEventCategory = function generalizeEventCategory(category) { return !category || category === 'TIMER' ? 'timers' : 'events'; }; var blHandlersCategory = exports.blHandlersCategory = function blHandlersCategory(appId, mode, category) { return "".concat(serverCode(appId), "/").concat(mode.toLowerCase(), "/").concat(generalizeEventCategory(category)); }; var blHandlersChain = exports.blHandlersChain = function blHandlersChain(appId, eventId, context) { return "".concat(serverCode(appId), "/chain/").concat(eventId, "/").concat(context); }; var composeFileUrl = function composeFileUrl(appId, operation, filePath) { var routeParts = [files(appId)]; if (operation) { routeParts.push(operation); } routeParts.push((0, _path.encodePath)(filePath), ''); return routeParts.join('/'); }; var fileExists = exports.fileExists = function fileExists(appId, filePath) { return composeFileUrl(appId, 'exists', filePath); }; var fileEdit = exports.fileEdit = function fileEdit(appId, filePath) { return composeFileUrl(appId, 'edit', filePath); }; var fileMove = exports.fileMove = function fileMove(appId, filePath) { return composeFileUrl(appId, 'move', filePath); }; var fileCopy = exports.fileCopy = function fileCopy(appId, filePath) { return composeFileUrl(appId, 'copy', filePath); }; var fileRename = exports.fileRename = function fileRename(appId, filePath) { return composeFileUrl(appId, 'rename', filePath); }; var fileDelete = exports.fileDelete = function fileDelete(appId, filePath) { return composeFileUrl(appId, null, filePath); }; var fileCreate = exports.fileCreate = function fileCreate(appId, filePath) { return composeFileUrl(appId, 'create', filePath); }; var fileUpload = exports.fileUpload = function fileUpload(appId, filePath) { return composeFileUrl(appId, 'upload', filePath); }; var fileView = exports.fileView = function fileView(appId, filePath) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (filePath && !filePath.startsWith('/')) { filePath = "/".concat(filePath); } return "".concat(options.host || '').concat(appConsole(appId), "/files/view").concat((0, _path.encodePath)(filePath)); }; var fileDownload = exports.fileDownload = function fileDownload(appId, filePath) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return "".concat(options.host || '').concat(appConsole(appId), "/files/download/").concat((0, _path.encodePath)(filePath)); }; var createDir = exports.createDir = function createDir(appId, path, folderName) { path = path ? "".concat(path, "/") : ''; var dirPath = (0, _path.encodePath)(path + folderName); return "".concat(files(appId), "/createdir/").concat(dirPath, "/"); }; var directoryView = exports.directoryView = function directoryView(appId, filePath) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; if (filePath && filePath.startsWith('/')) { filePath = filePath.slice(1); } if (filePath.endsWith('/')) { filePath = filePath.slice(0, -1); } return "".concat(options.host || '').concat(appConsole(appId), "/files/directory/view").concat((0, _path.optional)((0, _path.encodePath)(filePath))); }; var blProd = exports.blProd = function blProd(appId, language, model) { return "".concat(serverCode(appId), "/").concat(model, "/production/").concat(language); }; var blDraft = exports.blDraft = function blDraft(appId, language, model) { return "".concat(serverCode(appId), "/").concat(model, "/draft/").concat(language); }; var blDraftsProjectDownload = exports.blDraftsProjectDownload = function blDraftsProjectDownload(appId, authKey, language, model) { return "".concat(appConsole(appId, authKey), "/servercode/").concat(model, "/draft/").concat(language, "/download"); }; var blServicesClientDownload = exports.blServicesClientDownload = function blServicesClientDownload(appId, authKey, serviceId, language) { return "".concat(appConsole(appId, authKey), "/localservices/").concat(serviceId, "/").concat(language, "/download"); }; var messagingChannels = exports.messagingChannels = function messagingChannels(appId) { return "".concat(messaging(appId), "/channels"); }; var messagingPush = exports.messagingPush = function messagingPush(appId) { return "".concat(messaging(appId), "/push"); }; var messagingPushRecipientsCount = exports.messagingPushRecipientsCount = function messagingPushRecipientsCount(appId) { return "".concat(messaging(appId), "/pushsize"); }; var messagingPushTemplates = exports.messagingPushTemplates = function messagingPushTemplates(appId) { return "".concat(messagingPush(appId), "/templates"); }; var messagingPushTemplate = exports.messagingPushTemplate = function messagingPushTemplate(appId, name) { return "".concat(messagingPushTemplates(appId), "/").concat(name); }; var messagingPushButtonTemplates = exports.messagingPushButtonTemplates = function messagingPushButtonTemplates(appId) { return "".concat(messaging(appId), "/button-templates"); }; var messagingPushButtonTemplate = exports.messagingPushButtonTemplate = function messagingPushButtonTemplate(appId, name) { return "".concat(messagingPushButtonTemplates(appId), "/").concat(name); }; var messagingPushChannelTemplates = exports.messagingPushChannelTemplates = function messagingPushChannelTemplates(appId) { return "".concat(messaging(appId), "/channel-templates"); }; var messagingPushChannelTemplate = exports.messagingPushChannelTemplate = function messagingPushChannelTemplate(appId, name) { return "".concat(messagingPushChannelTemplates(appId), "/").concat(name); }; var messagingChannel = exports.messagingChannel = function messagingChannel(appId, channelId) { return "".concat(messagingChannels(appId), "/").concat(channelId); }; var mobileSettings = exports.mobileSettings = function mobileSettings(appId) { return "".concat(appConsole(appId), "/mobilesettings"); }; var mobileSettingsAndroid = exports.mobileSettingsAndroid = function mobileSettingsAndroid(appId, id) { return "".concat(mobileSettings(appId), "/android").concat((0, _path.optional)(id)); }; var billing = exports.billing = function billing(appId) { console.warn('DO NOT USE THE FUNCTION'); return "".concat(appConsole(appId), "/billing"); }; var marketplace = exports.marketplace = function marketplace(appId, name) { return "".concat(appConsole(appId), "/marketplace/").concat(name); }; var appInfo = exports.appInfo = function appInfo(appId) { return "".concat(appConsole(appId), "/app-info"); }; var blueprints = exports.blueprints = function blueprints(id) { return "".concat(console(), "/blueprints").concat((0, _path.optional)(id)); }; var landingPage = exports.landingPage = function landingPage(appId) { return "".concat(appConsole(appId), "/landing-page"); }; var codeless = exports.codeless = function codeless(appId) { return "".concat(appConsole(appId), "/codeless"); }; var codelessApiServices = exports.codelessApiServices = function codelessApiServices(appId) { return "".concat(codeless(appId), "/api-services"); }; var codelessFunctions = exports.codelessFunctions = function codelessFunctions(appId) { return "".concat(codeless(appId), "/functions"); }; var codelessFunctionSource = exports.codelessFunctionSource = function codelessFunctionSource(appId, name) { return "".concat(codelessFunctions(appId), "/").concat(name); }; var codelessDeployModel = exports.codelessDeployModel = function codelessDeployModel(appId, model) { return "".concat(codeless(appId), "/deploy/").concat(model); }; var dataViews = exports.dataViews = function dataViews(appId, id) { return "".concat(appConsole(appId), "/data/table-views").concat((0, _path.optional)(id)); }; var dataHives = exports.dataHives = function dataHives(appId) { return "".concat(appConsole(appId), "/hive"); }; var dataHive = exports.dataHive = function dataHive(appId, hiveName) { return "".concat(dataHives(appId), "/").concat(hiveName); }; var dataHiveStore = exports.dataHiveStore = function dataHiveStore(appId, hiveName, storeType) { return "".concat(dataHive(appId, hiveName), "/").concat(storeType); }; var dataHiveStoreKey = exports.dataHiveStoreKey = function dataHiveStoreKey(appId, hiveName, storeType, keyName) { return "".concat(dataHiveStore(appId, hiveName, storeType), "/").concat(keyName); }; var dataToVisualize = exports.dataToVisualize = function dataToVisualize(appId) { return "".concat(appConsole(appId), "/data-to-visualize"); }; var dataConnectors = exports.dataConnectors = function dataConnectors(appId) { return "".concat(appConsole(appId), "/dataconnectors"); }; var dataConnectorTemplates = exports.dataConnectorTemplates = function dataConnectorTemplates(appId) { return "".concat(dataConnectors(appId), "/templates"); }; var dataConnector = exports.dataConnector = function dataConnector(appId, connectorId) { return "".concat(dataConnectors(appId), "/").concat(connectorId); }; var dataConnectorTables = exports.dataConnectorTables = function dataConnectorTables(appId, connectorId) { return "".concat(dataConnector(appId, connectorId), "/tables"); }; var dataConnectorTableEntries = exports.dataConnectorTableEntries = function dataConnectorTableEntries(appId, connectorId, tableName) { return "".concat(dataConnectorTables(appId, connectorId), "/").concat(tableName, "/entries"); }; var dataConnectorStoredProcedures = exports.dataConnectorStoredProcedures = function dataConnectorStoredProcedures(appId, connectorId) { return "".concat(dataConnector(appId, connectorId), "/storedprocs"); }; var dataConnectorStoredProcedureExecution = exports.dataConnectorStoredProcedureExecution = function dataConnectorStoredProcedureExecution(appId, connectorId, procedureId) { return "".concat(dataConnectorStoredProcedures(appId, connectorId), "/").concat(procedureId, "/execution"); }; var emailTemplates = exports.emailTemplates = function emailTemplates(appId, templateName) { return "".concat(appConsole(appId), "/emailtemplate").concat((0, _path.optional)(templateName)); }; var installEmailTemplate = exports.installEmailTemplate = function installEmailTemplate(appId, productId) { return "".concat(appConsole(appId), "/email-templates/install/").concat(productId); }; var apiDocs = exports.apiDocs = function apiDocs(appId) { return "".concat(appConsole(appId), "/api-docs"); }; var apiDocsDataTable = exports.apiDocsDataTable = function apiDocsDataTable(appId, tableName) { return "".concat(apiDocs(appId), "/data/table/").concat(tableName); }; var apiDocsMessagingChannel = exports.apiDocsMessagingChannel = function apiDocsMessagingChannel(appId, channelName) { return "".concat(apiDocs(appId), "/messaging/channel/").concat(channelName); }; var apiDocsFiles = exports.apiDocsFiles = function apiDocsFiles(appId) { return "".concat(apiDocs(appId), "/files"); }; var apiDocsService = exports.apiDocsService = function apiDocsService(appId, serviceId, model) { return "".concat(apiDocs(appId), "/services/").concat(serviceId, "/").concat(model); }; var apiDocsGeo = exports.apiDocsGeo = function apiDocsGeo(appId) { return "".concat(apiDocs(appId), "/geo"); }; var cache = exports.cache = function cache(appId, key) { return "".concat(appConsole(appId), "/cache").concat((0, _path.optional)(key)); }; var atomicCounters = exports.atomicCounters = function atomicCounters(appId) { return "".concat(appConsole(appId), "/counters"); }; var gamification = exports.gamification = function gamification() { return "".concat(console(), "/gamification"); }; var gamificationApp = exports.gamificationApp = function gamificationApp(appId) { return "".concat(appConsole(appId), "/gamification"); }; var userActivity = exports.userActivity = function userActivity(appId) { return "".concat(appConsole(appId), "/user-activity"); }; var devTeam = exports.devTeam = function devTeam(appId, devId) { return "".concat(appConsole(appId), "/devteam").concat((0, _path.optional)(devId)); }; var users = exports.users = function users(appId) { return "".concat(appConsole(appId), "/users"); }; var oauth1 = exports.oauth1 = function oauth1(appId) { return "".concat(users(appId), "/oauth1"); }; var oauth2 = exports.oauth2 = function oauth2(appId) { return "".concat(users(appId), "/oauth2"); }; var oauth0 = exports.oauth0 = function oauth0(appId) { return "".concat(appConsole(appId), "/security/auth0"); }; var oauth0Config = exports.oauth0Config = function oauth0Config(appId) { return "".concat(oauth0(appId), "/config"); }; var oauth0Binding = exports.oauth0Binding = function oauth0Binding(appId) { return "".concat(oauth0(appId), "/scope-to-role"); }; var downloadComplianceFile = exports.downloadComplianceFile = function downloadComplianceFile(appId, complianceName) { return "".concat(security(appId), "/compliances/").concat(complianceName, "/download"); }; var _default = exports["default"] = { appConsole: appConsole, appInfo: appInfo, atomicCounters: atomicCounters, billing: billing, blBasePath: blBasePath, blDraft: blDraft, blDraftsProjectDownload: blDraftsProjectDownload, blHandlersCategory: blHandlersCategory, blHandlersChain: blHandlersChain, blProd: blProd, blServicesClientDownload: blServicesClientDownload, blueprints: blueprints, cache: cache, codelessApiServices: codelessApiServices, codelessDeployModel: codelessDeployModel, codelessFunctionSource: codelessFunctionSource, codelessFunctions: codelessFunctions, console: console, createDir: createDir, data: data, dataConfigs: dataConfigs, dataCell: dataCell, dataRecord: dataRecord, dataTable: dataTable, dataTableBulkCreate: dataTableBulkCreate, dataTableBulkUpsert: dataTableBulkUpsert, dataTables: dataTables, devTeam: devTeam, emailTemplates: emailTemplates, fileCopy: fileCopy, fileCreate: fileCreate, fileDelete: fileDelete, fileDownload: fileDownload, fileEdit: fileEdit, fileExists: fileExists, fileMove: fileMove, fileRename: fileRename, fileUpload: fileUpload, fileView: fileView, gamification: gamification, gamificationApp: gamificationApp, directoryView: directoryView, geo: geo, installEmailTemplate: installEmailTemplate, landingPage: landingPage, mailSettings: mailSettings, marketplace: marketplace, messaging: messaging, messagingChannel: messagingChannel, messagingChannels: messagingChannels, messagingPush: messagingPush, messagingPushRecipientsCount: messagingPushRecipientsCount, messagingPushTemplates: messagingPushTemplates, messagingPushTemplate: messagingPushTemplate, messagingPushButtonTemplates: messagingPushButtonTemplates, messagingPushButtonTemplate: messagingPushButtonTemplate, messagingPushChannelTemplates: messagingPushChannelTemplates, messagingPushChannelTemplate: messagingPushChannelTemplate, mobileSettings: mobileSettings, mobileSettingsAndroid: mobileSettingsAndroid, security: security, securityRoles: securityRoles, serverCode: serverCode, tableColumns: tableColumns, userActivity: userActivity, users: users, dataViews: dataViews, dataHives: dataHives, dataToVisualize: dataToVisualize, dataConnectors: dataConnectors, dataConnectorTemplates: dataConnectorTemplates, dataConnector: dataConnector, dataConnectorTables: dataConnectorTables, dataConnectorTableEntries: dataConnectorTableEntries, dataConnectorStoredProcedures: dataConnectorStoredProcedures, dataConnectorStoredProcedureExecution: dataConnectorStoredProcedureExecution, apiDocsDataTable: apiDocsDataTable, apiDocsMessagingChannel: apiDocsMessagingChannel, apiDocsFiles: apiDocsFiles, apiDocsService: apiDocsService, apiDocsGeo: apiDocsGeo, downloadComplianceFile: downloadComplianceFile };