UNPKG

quickbase

Version:

A lightweight, typed, promise-based Quickbase API, autogenerated from the OpenAPI spec

928 lines 36.7 kB
/*! * Package Name: quickbase * Package Description: A lightweight, typed, promise-based Quickbase API, autogenerated from the OpenAPI spec * Version: 6.0.0 * Build Timestamp: 2024-05-08T18:33:08.955Z * Package Homepage: https://github.com/tflanagan/node-quickbase * Git Location: git://github.com/tflanagan/node-quickbase.git * Authored By: Tristian Flanagan <contact@tristianflanagan.com> (https://github.com/tflanagan) * License: Apache-2.0 * * Copyright 2014 Tristian Flanagan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; 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.QuickBase = exports.QuickBaseError = void 0; /* Dependencies */ const deepmerge_1 = __importDefault(require("deepmerge")); const debug_1 = require("debug"); const generic_throttle_1 = require("generic-throttle"); const axios_1 = __importDefault(require("axios")); /* Debug */ const debugMain = (0, debug_1.debug)('quickbase:main'); const debugRequest = (0, debug_1.debug)('quickbase:request'); const debugResponse = (0, debug_1.debug)('quickbase:response'); /* Globals */ const VERSION = require('../package.json').version; const IS_BROWSER = typeof (window) !== 'undefined'; /* Helpers */ const delay = (time) => { return new Promise((resolve) => { setTimeout(resolve, +time); }); }; const getRetryDelay = (headers) => { const retryAfter = headers['retry-after']; if (retryAfter) { let retryDelay = Math.round(parseFloat(retryAfter) * 1000); if (isNaN(retryDelay)) { retryDelay = Math.max(0, new Date(retryAfter).valueOf() - new Date().valueOf()); } return retryDelay; } return +(headers['x-ratelimit-reset'] || 10000); }; const objKeysToLowercase = (obj) => { return Object.fromEntries(Object.entries(obj).map(([key, value]) => [ key.toLocaleLowerCase(), value ])); }; class QuickBaseError extends Error { /** * Extends the native JavaScript `Error` object for use with Quickbase API errors * * Example: * ```typescript * const qbErr = new QuickBaseError(403, 'Access Denied', 'User token is invalid', 'xxxx'); * ``` * * @param code Error code * @param message Error message * @param description Error description * @param rayId Quickbase API Ray ID */ constructor(code, message, description, rayId) { super(message); this.code = code; this.message = message; this.description = description; this.rayId = rayId; } /** * Serialize the QuickBaseError instance into JSON */ toJSON() { return { code: this.code, message: this.message, description: this.description, rayId: this.rayId }; } /** * Rebuild the QuickBaseError instance from serialized JSON * * @param json Serialized QuickBaseError class options */ fromJSON(json) { if (typeof (json) === 'string') { json = JSON.parse(json); } if (typeof (json) !== 'object') { throw new TypeError('json argument must be type of object or a valid JSON string'); } this.code = json.code; this.message = json.message; this.description = json.description; this.rayId = json.rayId; return this; } /** * Create a new QuickBase instance from serialized JSON * * @param json Serialized QuickBaseError class options */ static fromJSON(json) { if (typeof (json) === 'string') { json = JSON.parse(json); } if (typeof (json) !== 'object') { throw new TypeError('json argument must be type of object or a valid JSON string'); } return new QuickBaseError(json.code, json.message, json.description, json.rayId); } } exports.QuickBaseError = QuickBaseError; /* Main Class */ class QuickBase { constructor(options) { this.CLASS_NAME = 'QuickBase'; /** * The internal numerical id for API calls. * * Increments by 1 with each request. */ this._id = 0; this.settings = (0, deepmerge_1.default)(QuickBase.defaults, options || {}); this.throttle = new generic_throttle_1.Throttle(this.settings.connectionLimit, this.settings.connectionLimitPeriod, this.settings.errorOnConnectionLimit); debugMain('New Instance', this.settings); return this; } assignAuthorizationHeaders(headers, addToken = true) { if (!headers) { headers = {}; } if (this.settings.userToken) { if (addToken) { headers.Authorization = `QB-USER-TOKEN ${this.settings.userToken}`; } } else { if (this.settings.appToken) { headers['QB-App-Token'] = this.settings.appToken; } if (addToken && this.settings.tempToken) { headers.Authorization = `QB-TEMP-TOKEN ${this.settings.tempToken}`; } } return headers; } getBaseRequest() { return { method: 'GET', baseURL: `https://${this.settings.server}/${this.settings.version}`, headers: { 'Content-Type': 'application/json; charset=UTF-8', [IS_BROWSER ? 'X-User-Agent' : 'User-Agent']: `${this.settings.userAgent} node-quickbase/v${VERSION} ${IS_BROWSER ? (window.navigator ? window.navigator.userAgent : '') : 'nodejs/' + process.version}`.trim(), 'QB-Realm-Hostname': this.settings.realm }, proxy: this.settings.proxy }; } request(options_1) { return __awaiter(this, arguments, void 0, function* (options, attempt = 0) { var _a; const id = 0 + (++this._id); try { debugRequest(id, options); options.headers = this.assignAuthorizationHeaders(options.headers, !((_a = options.url) === null || _a === void 0 ? void 0 : _a.startsWith('/auth/temporary'))); const results = yield axios_1.default.request(options); debugResponse(id, results); return results; } catch (err) { if (err.response) { const headers = objKeysToLowercase(err.response.headers); const qbErr = new QuickBaseError(err.response.status, err.response.data.message, err.response.data.description, headers['qb-api-ray']); debugResponse(id, 'Quickbase Error', qbErr); if (this.settings.retryOnQuotaExceeded && qbErr.code === 429) { const delayMs = getRetryDelay(headers); debugResponse(id, `Waiting ${delayMs}ms until retrying...`); yield delay(delayMs); debugResponse(id, `Retrying...`); return yield this.request(options); } if (attempt >= 3) { throw qbErr; } const errDescription = '' + (qbErr.description || ''); if (this.settings.autoRenewTempTokens && this.settings.tempTokenDbid && (errDescription.match(/Your ticket has expired/i) || errDescription.match(/Invalid Authorization/i) || errDescription.match(/Required header 'authorization' not found/i))) { debugResponse(id, `Getting new temporary ticket for ${this.settings.tempTokenDbid}...`); const results = yield this.request(deepmerge_1.default.all([ this.getBaseRequest(), { url: `auth/temporary/${this.settings.tempTokenDbid}`, withCredentials: true } ]), attempt + 1); this.setTempToken(this.settings.tempTokenDbid, results.data.temporaryAuthorization); debugResponse(id, `Retrying...`); return yield this.request(options, attempt + 1); } throw qbErr; } debugResponse(id, 'Error', err); throw err; } }); } api(actOptions, reqOptions) { return __awaiter(this, void 0, void 0, function* () { return this.throttle.acquire(() => __awaiter(this, void 0, void 0, function* () { return yield this.request(deepmerge_1.default.all([ this.getBaseRequest(), actOptions, reqOptions || {} ])); })); }); } /** * Set the internally stored `tempToken` for use in subsequent API calls * * Example: * ```typescript * qb.setTempToken('xxxx.xxx[...]xxx', 'xxxxxxxxx'); * ``` * * @param dbid Quickbase Application ID or Table ID * @param tempToken Temporary Quickbase Authentication Token */ setTempToken(dbid, tempToken) { this.settings.tempTokenDbid = dbid; this.settings.tempToken = tempToken; return this; } /** * Rebuild the QuickBase instance from serialized JSON * * @param json QuickBase class options */ fromJSON(json) { if (typeof (json) === 'string') { json = JSON.parse(json); } if (typeof (json) !== 'object') { throw new TypeError('json argument must be type of object or a valid JSON string'); } this.settings = (0, deepmerge_1.default)(this.settings, json); return this; } /** * Serialize the QuickBase instance into JSON */ toJSON() { return (0, deepmerge_1.default)({}, this.settings); } /** * Create a new QuickBase instance from serialized JSON * * @param json QuickBase class options */ static fromJSON(json) { if (typeof (json) === 'string') { json = JSON.parse(json); } if (typeof (json) !== 'object') { throw new TypeError('json argument must be type of object or a valid JSON string'); } return new QuickBase(json); } /** * Test if a variable is a `quickbase` object * * @param obj A variable you'd like to test */ static IsQuickBase(obj) { return (obj || {}).CLASS_NAME === QuickBase.CLASS_NAME; } createApp(_a) { return __awaiter(this, void 0, void 0, function* () { var { requestOptions, returnAxios = false } = _a, body = __rest(_a, ["requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/apps`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } getApp(_a) { return __awaiter(this, arguments, void 0, function* ({ appId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/apps/${appId}`, }, requestOptions); return returnAxios ? results : results.data; }); } updateApp(_a) { return __awaiter(this, void 0, void 0, function* () { var { appId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["appId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/apps/${appId}`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } deleteApp(_a) { return __awaiter(this, void 0, void 0, function* () { var { appId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["appId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'DELETE', url: `/apps/${appId}`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } getAppEvents(_a) { return __awaiter(this, arguments, void 0, function* ({ appId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/apps/${appId}/events`, }, requestOptions); return returnAxios ? results : results.data; }); } copyApp(_a) { return __awaiter(this, void 0, void 0, function* () { var { appId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["appId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/apps/${appId}/copy`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } createTable(_a) { return __awaiter(this, void 0, void 0, function* () { var { appId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["appId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/tables`, data: body, params: { appId } }, requestOptions); return returnAxios ? results : results.data; }); } getAppTables(_a) { return __awaiter(this, arguments, void 0, function* ({ appId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/tables`, params: { appId } }, requestOptions); return returnAxios ? results : results.data; }); } getTable(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, appId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/tables/${tableId}`, params: { appId } }, requestOptions); return returnAxios ? results : results.data; }); } updateTable(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, appId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "appId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/tables/${tableId}`, data: body, params: { appId } }, requestOptions); return returnAxios ? results : results.data; }); } deleteTable(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, appId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/tables/${tableId}`, params: { appId } }, requestOptions); return returnAxios ? results : results.data; }); } getRelationships(_a) { return __awaiter(this, arguments, void 0, function* ({ childTableId, skip, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/tables/${childTableId}/relationships`, params: { skip } }, requestOptions); return returnAxios ? results : results.data; }); } createRelationship(_a) { return __awaiter(this, void 0, void 0, function* () { var { childTableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["childTableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/tables/${childTableId}/relationship`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } updateRelationship(_a) { return __awaiter(this, void 0, void 0, function* () { var { childTableId, relationshipId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["childTableId", "relationshipId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/tables/${childTableId}/relationship/${relationshipId}`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } deleteRelationship(_a) { return __awaiter(this, arguments, void 0, function* ({ childTableId, relationshipId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/tables/${childTableId}/relationship/${relationshipId}`, }, requestOptions); return returnAxios ? results : results.data; }); } getTableReports(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/reports`, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } getReport(_a) { return __awaiter(this, arguments, void 0, function* ({ reportId, tableId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/reports/${reportId}`, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } runReport(_a) { return __awaiter(this, arguments, void 0, function* ({ reportId, tableId, skip, top, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'POST', url: `/reports/${reportId}/run`, params: { tableId, skip, top } }, requestOptions); return returnAxios ? results : results.data; }); } getFields(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, includeFieldPerms, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/fields`, params: { tableId, includeFieldPerms } }, requestOptions); return returnAxios ? results : results.data; }); } createField(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/fields`, data: body, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } deleteFields(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'DELETE', url: `/fields`, data: body, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } getField(_a) { return __awaiter(this, arguments, void 0, function* ({ fieldId, tableId, includeFieldPerms, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/fields/${fieldId}`, params: { tableId, includeFieldPerms } }, requestOptions); return returnAxios ? results : results.data; }); } updateField(_a) { return __awaiter(this, void 0, void 0, function* () { var { fieldId, tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["fieldId", "tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/fields/${fieldId}`, data: body, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } getFieldsUsage(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, skip, top, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/fields/usage`, params: { tableId, skip, top } }, requestOptions); return returnAxios ? results : results.data; }); } getFieldUsage(_a) { return __awaiter(this, arguments, void 0, function* ({ fieldId, tableId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/fields/usage/${fieldId}`, params: { tableId } }, requestOptions); return returnAxios ? results : results.data; }); } runFormula(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/formula/run`, data: Object.assign({ from: tableId }, body), }, requestOptions); return returnAxios ? results : results.data; }); } upsert(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/records`, data: Object.assign({ to: tableId }, body), }, requestOptions); return returnAxios ? results : results.data; }); } deleteRecords(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'DELETE', url: `/records`, data: Object.assign({ from: tableId }, body), }, requestOptions); return returnAxios ? results : results.data; }); } runQuery(_a) { return __awaiter(this, void 0, void 0, function* () { var { tableId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["tableId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/records/query`, data: Object.assign({ from: tableId }, body), }, requestOptions); return returnAxios ? results : results.data; }); } getTempTokenDBID(_a) { return __awaiter(this, arguments, void 0, function* ({ dbid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/auth/temporary/${dbid}`, withCredentials: true, }, requestOptions); this.setTempToken(dbid, results.data.temporaryAuthorization); return returnAxios ? results : results.data; }); } exchangeSsoToken(_a) { return __awaiter(this, void 0, void 0, function* () { var { requestOptions, returnAxios = false } = _a, body = __rest(_a, ["requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/auth/oauth/token`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } cloneUserToken(_a) { return __awaiter(this, void 0, void 0, function* () { var { requestOptions, returnAxios = false } = _a, body = __rest(_a, ["requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/usertoken/clone`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } deactivateUserToken() { return __awaiter(this, arguments, void 0, function* ({ requestOptions, returnAxios = false } = {}) { const results = yield this.api({ method: 'POST', url: `/usertoken/deactivate`, }, requestOptions); return returnAxios ? results : results.data; }); } deleteUserToken() { return __awaiter(this, arguments, void 0, function* ({ requestOptions, returnAxios = false } = {}) { const results = yield this.api({ method: 'DELETE', url: `/usertoken`, }, requestOptions); return returnAxios ? results : results.data; }); } downloadFile(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, recordId, fieldId, versionNumber, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`, }, requestOptions); return returnAxios ? results : results.data; }); } deleteFile(_a) { return __awaiter(this, arguments, void 0, function* ({ tableId, recordId, fieldId, versionNumber, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`, }, requestOptions); return returnAxios ? results : results.data; }); } getUsers(_a) { return __awaiter(this, void 0, void 0, function* () { var { accountId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["accountId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/users`, data: body, params: { accountId } }, requestOptions); return returnAxios ? results : results.data; }); } denyUsers(_a) { return __awaiter(this, arguments, void 0, function* ({ accountId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'PUT', url: `/users/deny`, params: { accountId } }, requestOptions); return returnAxios ? results : results.data; }); } denyUsersAndGroups(_a) { return __awaiter(this, arguments, void 0, function* ({ shouldDeleteFromGroups, accountId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'PUT', url: `/users/deny/${shouldDeleteFromGroups}`, params: { accountId } }, requestOptions); return returnAxios ? results : results.data; }); } undenyUsers(_a) { return __awaiter(this, arguments, void 0, function* ({ accountId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'PUT', url: `/users/undeny`, params: { accountId } }, requestOptions); return returnAxios ? results : results.data; }); } addMembersToGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'POST', url: `/groups/${gid}/members`, }, requestOptions); return returnAxios ? results : results.data; }); } removeMembersFromGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/groups/${gid}/members`, }, requestOptions); return returnAxios ? results : results.data; }); } addManagersToGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'POST', url: `/groups/${gid}/managers`, }, requestOptions); return returnAxios ? results : results.data; }); } removeManagersFromGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/groups/${gid}/managers`, }, requestOptions); return returnAxios ? results : results.data; }); } addSubgroupsToGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'POST', url: `/groups/${gid}/subgroups`, }, requestOptions); return returnAxios ? results : results.data; }); } removeSubgroupsFromGroup(_a) { return __awaiter(this, arguments, void 0, function* ({ gid, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'DELETE', url: `/groups/${gid}/subgroups`, }, requestOptions); return returnAxios ? results : results.data; }); } audit(_a) { return __awaiter(this, void 0, void 0, function* () { var { requestOptions, returnAxios = false } = _a, body = __rest(_a, ["requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/audit`, data: body, }, requestOptions); return returnAxios ? results : results.data; }); } platformAnalyticReads(_a) { return __awaiter(this, arguments, void 0, function* ({ day, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/analytics/reads`, params: { day } }, requestOptions); return returnAxios ? results : results.data; }); } platformAnalyticEventSummaries(_a) { return __awaiter(this, void 0, void 0, function* () { var { accountId, requestOptions, returnAxios = false } = _a, body = __rest(_a, ["accountId", "requestOptions", "returnAxios"]); const results = yield this.api({ method: 'POST', url: `/analytics/events/summaries`, data: body, params: { accountId } }, requestOptions); return returnAxios ? results : results.data; }); } exportSolution(_a) { return __awaiter(this, arguments, void 0, function* ({ solutionId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'GET', url: `/solutions/${solutionId}`, }, requestOptions); return returnAxios ? results : results.data; }); } updateSolution(_a) { return __awaiter(this, arguments, void 0, function* ({ solutionId, requestOptions, returnAxios = false }) { const results = yield this.api({ method: 'PUT', url: `/solutions/${solutionId}`, }, requestOptions); return returnAxios ? results : results.data; }); } createSolution() { return __awaiter(this, arguments, void 0, function* ({ requestOptions, returnAxios = false } = {}) { const results = yield this.api({ method: 'POST', url: `/solutions`, }, requestOptions); return returnAxios ? results : results.data; }); } } exports.QuickBase = QuickBase; QuickBase.CLASS_NAME = 'QuickBase'; QuickBase.VERSION = VERSION; /** * The default settings of a `QuickBase` instance */ QuickBase.defaults = { server: 'api.quickbase.com', version: 'v1', realm: IS_BROWSER ? window.location.host.split('.')[0] : '', userToken: '', tempToken: '', tempTokenDbid: '', appToken: '', userAgent: '', autoRenewTempTokens: true, connectionLimit: 10, connectionLimitPeriod: 1000, errorOnConnectionLimit: false, retryOnQuotaExceeded: true, proxy: false }; /* Export to Browser */ if (IS_BROWSER) { window.QuickBase = exports; } //# sourceMappingURL=quickbase.js.map