@hubspot/local-dev-lib 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,21 +10,21 @@ const SCHEMA_API_PATH = 'crm-object-schemas/v3/schemas';
10
10
  async function batchCreateObjects(accountId, objectTypeId, objects) {
11
11
  http_1.default.post(accountId, {
12
12
  url: `${CUSTOM_OBJECTS_API_PATH}/${objectTypeId}/batch/create`,
13
- body: objects,
13
+ data: objects,
14
14
  });
15
15
  }
16
16
  exports.batchCreateObjects = batchCreateObjects;
17
17
  async function createObjectSchema(accountId, schema) {
18
18
  return http_1.default.post(accountId, {
19
19
  url: SCHEMA_API_PATH,
20
- body: schema,
20
+ data: schema,
21
21
  });
22
22
  }
23
23
  exports.createObjectSchema = createObjectSchema;
24
24
  async function updateObjectSchema(accountId, schemaObjectType, schema) {
25
25
  return http_1.default.patch(accountId, {
26
26
  url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
27
- body: schema,
27
+ data: schema,
28
28
  });
29
29
  }
30
30
  exports.updateObjectSchema = updateObjectSchema;
package/api/functions.js CHANGED
@@ -18,7 +18,7 @@ async function buildPackage(accountId, folderPath) {
18
18
  headers: {
19
19
  Accept: 'text/plain',
20
20
  },
21
- body: {
21
+ data: {
22
22
  folderPath,
23
23
  },
24
24
  });
package/api/hubdb.js CHANGED
@@ -15,14 +15,14 @@ exports.fetchTable = fetchTable;
15
15
  async function createTable(accountId, schema) {
16
16
  return http_1.default.post(accountId, {
17
17
  url: `${HUBDB_API_PATH}/tables`,
18
- body: schema,
18
+ data: schema,
19
19
  });
20
20
  }
21
21
  exports.createTable = createTable;
22
22
  async function updateTable(accountId, tableId, schema) {
23
23
  return http_1.default.patch(accountId, {
24
24
  url: `${HUBDB_API_PATH}/tables/${tableId}/draft`,
25
- body: schema,
25
+ data: schema,
26
26
  });
27
27
  }
28
28
  exports.updateTable = updateTable;
@@ -41,7 +41,7 @@ exports.deleteTable = deleteTable;
41
41
  async function createRows(accountId, tableId, rows) {
42
42
  return http_1.default.post(accountId, {
43
43
  url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/create`,
44
- body: { inputs: rows },
44
+ data: { inputs: rows },
45
45
  });
46
46
  }
47
47
  exports.createRows = createRows;
@@ -55,7 +55,7 @@ exports.fetchRows = fetchRows;
55
55
  async function deleteRows(accountId, tableId, rowIds) {
56
56
  return http_1.default.post(accountId, {
57
57
  url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/purge`,
58
- body: { inputs: rowIds },
58
+ data: { inputs: rowIds },
59
59
  });
60
60
  }
61
61
  exports.deleteRows = deleteRows;
@@ -1,5 +1,5 @@
1
- import { Body, QueryParams } from '../types/Http';
1
+ import { Data, QueryParams } from '../types/Http';
2
2
  import { GetLighthouseScoreResponse, RequestLighthouseScoreResponse } from '../types/Lighthouse';
3
- export declare function requestLighthouseScore(accountId: number, body?: Body): Promise<RequestLighthouseScoreResponse>;
3
+ export declare function requestLighthouseScore(accountId: number, data?: Data): Promise<RequestLighthouseScoreResponse>;
4
4
  export declare function getLighthouseScoreStatus(accountId: number, query?: QueryParams): Promise<string>;
5
5
  export declare function getLighthouseScore(accountId: number, query?: QueryParams): Promise<GetLighthouseScoreResponse>;
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLighthouseScore = exports.getLighthouseScoreStatus = exports.requestLighthouseScore = void 0;
7
7
  const http_1 = __importDefault(require("../http"));
8
8
  const LIGHTHOUSE_SCORE_API_BASE = 'quality-engine/v1/lighthouse';
9
- async function requestLighthouseScore(accountId, body = {}) {
9
+ async function requestLighthouseScore(accountId, data = {}) {
10
10
  return http_1.default.post(accountId, {
11
11
  url: `${LIGHTHOUSE_SCORE_API_BASE}/request`,
12
- body,
12
+ data,
13
13
  });
14
14
  }
15
15
  exports.requestLighthouseScore = requestLighthouseScore;
@@ -2,10 +2,14 @@ import { Environment } from '../types/Config';
2
2
  import { ScopeData } from '../types/Accounts';
3
3
  type AccessTokenResponse = {
4
4
  hubId: number;
5
+ userId: number;
5
6
  oauthAccessToken: string;
6
7
  expiresAtMillis: number;
8
+ enabledFeatures?: {
9
+ [key: string]: number;
10
+ };
7
11
  scopeGroups: Array<string>;
8
- encodedOauthRefreshToken: string;
12
+ encodedOAuthRefreshToken: string;
9
13
  };
10
14
  export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): Promise<AccessTokenResponse>;
11
15
  export declare function fetchScopeData(accountId: number, scopeGroup: string): Promise<ScopeData>;
@@ -15,7 +15,7 @@ async function fetchAccessToken(personalAccessKey, env = environments_1.ENVIRONM
15
15
  env,
16
16
  localHostOverride: true,
17
17
  url: `${LOCALDEVAUTH_API_AUTH_PATH}/refresh`,
18
- body: {
18
+ data: {
19
19
  encodedOAuthRefreshToken: personalAccessKey,
20
20
  },
21
21
  params: query,
@@ -1,5 +1,5 @@
1
- import { Body, QueryParams } from '../types/Http';
1
+ import { Data, QueryParams } from '../types/Http';
2
2
  import { GetValidationResultsResponse } from '../types/MarketplaceValidation';
3
- export declare function requestValidation(accountId: number, body?: Body): Promise<number>;
3
+ export declare function requestValidation(accountId: number, data?: Data): Promise<number>;
4
4
  export declare function getValidationStatus(accountId: number, query?: QueryParams): Promise<string>;
5
5
  export declare function getValidationResults(accountId: number, query?: QueryParams): Promise<GetValidationResultsResponse>;
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getValidationResults = exports.getValidationStatus = exports.requestValidation = void 0;
7
7
  const http_1 = __importDefault(require("../http"));
8
8
  const VALIDATION_API_BASE = 'quality-engine/v1/validation';
9
- function requestValidation(accountId, body = {}) {
9
+ function requestValidation(accountId, data = {}) {
10
10
  return http_1.default.post(accountId, {
11
11
  url: `${VALIDATION_API_BASE}/request`,
12
- body,
12
+ data,
13
13
  });
14
14
  }
15
15
  exports.requestValidation = requestValidation;
package/api/projects.js CHANGED
@@ -18,7 +18,7 @@ exports.fetchProjects = fetchProjects;
18
18
  async function createProject(accountId, name) {
19
19
  return http_1.default.post(accountId, {
20
20
  url: PROJECTS_API_PATH,
21
- body: {
21
+ data: {
22
22
  name,
23
23
  },
24
24
  });
@@ -87,7 +87,7 @@ exports.getBuildStructure = getBuildStructure;
87
87
  async function deployProject(accountId, projectName, buildId) {
88
88
  return http_1.default.post(accountId, {
89
89
  url: `${PROJECTS_DEPLOY_API_PATH}/deploys/queue/async`,
90
- body: {
90
+ data: {
91
91
  projectName,
92
92
  buildId,
93
93
  },
@@ -13,7 +13,7 @@ const SANDBOX_API_PATH = 'sandbox-hubs/v1';
13
13
  const SANDBOX_API_PATH_V2 = 'sandbox-hubs/v2';
14
14
  async function createSandbox(accountId, name, type) {
15
15
  return http_1.default.post(accountId, {
16
- body: { name, type, generatePersonalAccessKey: true },
16
+ data: { name, type, generatePersonalAccessKey: true },
17
17
  timeout: api_1.SANDBOX_TIMEOUT,
18
18
  url: SANDBOX_API_PATH_V2, // Create uses v2 for sandbox type and PAK generation support
19
19
  });
@@ -9,7 +9,7 @@ const api_1 = require("../constants/api");
9
9
  const SANDBOXES_SYNC_API_PATH = 'sandboxes-sync/v1';
10
10
  async function initiateSync(fromHubId, toHubId, tasks, sandboxHubId) {
11
11
  return http_1.default.post(fromHubId, {
12
- body: {
12
+ data: {
13
13
  command: 'SYNC',
14
14
  fromHubId,
15
15
  toHubId,
package/api/secrets.js CHANGED
@@ -9,7 +9,7 @@ const SECRETS_API_PATH = 'cms/v3/functions/secrets';
9
9
  async function addSecret(accountId, key, value) {
10
10
  return http_1.default.post(accountId, {
11
11
  url: SECRETS_API_PATH,
12
- body: {
12
+ data: {
13
13
  key,
14
14
  secret: value,
15
15
  },
@@ -19,7 +19,7 @@ exports.addSecret = addSecret;
19
19
  async function updateSecret(accountId, key, value) {
20
20
  return http_1.default.put(accountId, {
21
21
  url: SECRETS_API_PATH,
22
- body: {
22
+ data: {
23
23
  key,
24
24
  secret: value,
25
25
  },
@@ -9,7 +9,7 @@ const HUBL_VALIDATE_API_PATH = 'cos-rendering/v1/internal/validate';
9
9
  async function validateHubl(accountId, sourceCode, hublValidationOptions) {
10
10
  return http_1.default.post(accountId, {
11
11
  url: HUBL_VALIDATE_API_PATH,
12
- body: {
12
+ data: {
13
13
  template_source: sourceCode,
14
14
  ...hublValidationOptions,
15
15
  },
@@ -377,7 +377,9 @@ function updateAccountConfig(configOptions) {
377
377
  tokenInfo,
378
378
  };
379
379
  }
380
- const env = (0, environment_1.getValidEnv)(environment || (accountConfig && accountConfig.env), undefined);
380
+ const env = (0, environment_1.getValidEnv)(environment ||
381
+ (configOptions && configOptions.env) ||
382
+ (accountConfig && accountConfig.env));
381
383
  const mode = defaultMode && defaultMode.toLowerCase();
382
384
  const nextAccountConfig = {
383
385
  ...accountConfig,
@@ -4,7 +4,7 @@ export declare function isApiStatusCodeError(err: GenericError): boolean;
4
4
  export declare function isMissingScopeError(err: GenericError): boolean;
5
5
  export declare function isGatingError(err: GenericError): boolean;
6
6
  export declare function isApiUploadValidationError(err: GenericError): boolean;
7
- export declare function isSpecifiedHubSpotAuthError(err: GenericError, { statusCode, category, subCategory }: Partial<HubSpotAuthError>): boolean;
7
+ export declare function isSpecifiedHubSpotAuthError(err: GenericError, { status, category, subCategory }: Partial<HubSpotAuthError>): boolean;
8
8
  /**
9
9
  * @throws
10
10
  */
@@ -6,33 +6,33 @@ const lang_1 = require("../utils/lang");
6
6
  const standardErrors_1 = require("./standardErrors");
7
7
  function isApiStatusCodeError(err) {
8
8
  return (err.name === 'StatusCodeError' ||
9
- (!!err.statusCode && err.statusCode >= 100 && err.statusCode < 600));
9
+ (!!err.status && err.status >= 100 && err.status < 600));
10
10
  }
11
11
  exports.isApiStatusCodeError = isApiStatusCodeError;
12
12
  function isMissingScopeError(err) {
13
13
  return (isApiStatusCodeError(err) &&
14
- err.statusCode === 403 &&
14
+ err.status === 403 &&
15
15
  !!err.error &&
16
16
  err.error.category === 'MISSING_SCOPES');
17
17
  }
18
18
  exports.isMissingScopeError = isMissingScopeError;
19
19
  function isGatingError(err) {
20
20
  return (isApiStatusCodeError(err) &&
21
- err.statusCode === 403 &&
21
+ err.status === 403 &&
22
22
  !!err.error &&
23
23
  err.error.category === 'GATED');
24
24
  }
25
25
  exports.isGatingError = isGatingError;
26
26
  function isApiUploadValidationError(err) {
27
27
  return (isApiStatusCodeError(err) &&
28
- err.statusCode === 400 &&
28
+ err.status === 400 &&
29
29
  !!err.response &&
30
30
  !!err.response.body &&
31
31
  !!(err.response.body.message || !!err.response.body.errors));
32
32
  }
33
33
  exports.isApiUploadValidationError = isApiUploadValidationError;
34
- function isSpecifiedHubSpotAuthError(err, { statusCode, category, subCategory }) {
35
- const statusCodeErr = !statusCode || err.statusCode === statusCode;
34
+ function isSpecifiedHubSpotAuthError(err, { status, category, subCategory }) {
35
+ const statusCodeErr = !status || err.status === status;
36
36
  const categoryErr = !category || err.category === category;
37
37
  const subCategoryErr = !subCategory || err.subCategory === subCategory;
38
38
  return Boolean(err.name === 'HubSpotAuthError' &&
@@ -70,9 +70,9 @@ function logValidationErrors(error) {
70
70
  * @throws
71
71
  */
72
72
  function throwStatusCodeError(error, context = {}) {
73
- const { statusCode, message, response } = error;
73
+ const { status, message, response } = error;
74
74
  const errorData = JSON.stringify({
75
- statusCode,
75
+ status,
76
76
  message,
77
77
  url: response ? response.request.href : null,
78
78
  method: response ? response.request.method : null,
@@ -88,7 +88,7 @@ exports.throwStatusCodeError = throwStatusCodeError;
88
88
  */
89
89
  function throwApiStatusCodeError(error, context = {}) {
90
90
  const i18nKey = 'errors.errorTypes.api';
91
- const { statusCode } = error;
91
+ const { status } = error;
92
92
  const { method } = error.options || {};
93
93
  const { projectName } = context;
94
94
  const isPutOrPost = method === 'PUT' || method === 'POST';
@@ -110,7 +110,7 @@ function throwApiStatusCodeError(error, context = {}) {
110
110
  }
111
111
  const isProjectMissingScopeError = isMissingScopeError(error) && projectName;
112
112
  const isProjectGatingError = isGatingError(error) && projectName;
113
- switch (statusCode) {
113
+ switch (status) {
114
114
  case 400:
115
115
  errorMessage.push((0, lang_1.i18n)(`${i18nKey}.codes.400`, { messageDetail }));
116
116
  break;
@@ -151,10 +151,10 @@ function throwApiStatusCodeError(error, context = {}) {
151
151
  errorMessage.push((0, lang_1.i18n)(`${i18nKey}.codes.503`, { messageDetail }));
152
152
  break;
153
153
  default:
154
- if (statusCode && statusCode >= 500 && statusCode < 600) {
154
+ if (status && status >= 500 && status < 600) {
155
155
  errorMessage.push((0, lang_1.i18n)(`${i18nKey}.codes.500Generic`, { messageDetail }));
156
156
  }
157
- else if (statusCode && statusCode >= 400 && statusCode < 500) {
157
+ else if (status && status >= 400 && status < 500) {
158
158
  errorMessage.push((0, lang_1.i18n)(`${i18nKey}.codes.400Generic`, { messageDetail }));
159
159
  }
160
160
  else {
@@ -6,9 +6,9 @@ function isSystemError(err) {
6
6
  }
7
7
  function debugErrorAndContext(error, context) {
8
8
  if (error.name === 'StatusCodeError') {
9
- const { statusCode, message, response } = error;
9
+ const { status, message, response } = error;
10
10
  console.debug('Error: %o', {
11
- statusCode,
11
+ status,
12
12
  message,
13
13
  url: response.request.href,
14
14
  method: response.request.method,
package/http/index.js CHANGED
@@ -119,6 +119,7 @@ function createGetRequestStream(contentType) {
119
119
  try {
120
120
  const { headers, ...opts } = await withAuth(accountId, axiosConfig);
121
121
  const res = await (0, axios_1.default)({
122
+ method: 'get',
122
123
  ...opts,
123
124
  headers: {
124
125
  ...headers,
package/lib/fileMapper.js CHANGED
@@ -197,7 +197,7 @@ async function writeFileMapperNode(accountId, filepath, node, mode, options = {}
197
197
  return true;
198
198
  }
199
199
  function isTimeout(err) {
200
- return !!err && (err.statusCode === 408 || err.code === 'ESOCKETTIMEDOUT');
200
+ return !!err && (err.status === 408 || err.code === 'ESOCKETTIMEDOUT');
201
201
  }
202
202
  async function downloadFile(accountId, src, destPath, mode, options = {}, logCallbacks) {
203
203
  const logger = (0, logger_1.makeTypedLogger)(logCallbacks, 'filemapper');
package/lib/hubdb.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Row } from '../types/Hubdb';
2
- export declare function addRowsToHubDbTable(accountId: number, tableId: string, rows: Array<Row>): Promise<{
2
+ export declare function addRowsToHubDbTable(accountId: number, tableId: string, rows?: Array<Row>): Promise<{
3
3
  tableId: string;
4
4
  rowCount: number;
5
5
  }>;
package/lib/hubdb.js CHANGED
@@ -28,7 +28,7 @@ function validateJsonFile(src) {
28
28
  }
29
29
  validateJsonPath(src);
30
30
  }
31
- async function addRowsToHubDbTable(accountId, tableId, rows) {
31
+ async function addRowsToHubDbTable(accountId, tableId, rows = []) {
32
32
  const rowsToUpdate = rows.map(row => {
33
33
  const values = row.values;
34
34
  return {
@@ -5,7 +5,7 @@ type AccessToken = {
5
5
  accessToken: string;
6
6
  expiresAt: string;
7
7
  scopeGroups: Array<string>;
8
- encodedOauthRefreshToken: string;
8
+ encodedOAuthRefreshToken: string;
9
9
  };
10
10
  export declare function getAccessToken(personalAccessKey: string, env?: Environment, accountId?: number): Promise<AccessToken>;
11
11
  export declare function accessTokenForPersonalAccessKey(accountId: number): Promise<string | undefined>;
@@ -22,7 +22,7 @@ async function getAccessToken(personalAccessKey, env = environments_1.ENVIRONMEN
22
22
  }
23
23
  catch (e) {
24
24
  const error = e;
25
- if (error.response) {
25
+ if (error.response && error.response.body) {
26
26
  (0, standardErrors_1.throwAuthErrorWithMessage)('personalAccessKey.invalidPersonalAccessKey', { errorMessage: error.response.body.message || '' }, error);
27
27
  }
28
28
  else {
@@ -34,7 +34,7 @@ async function getAccessToken(personalAccessKey, env = environments_1.ENVIRONMEN
34
34
  accessToken: response.oauthAccessToken,
35
35
  expiresAt: (0, moment_1.default)(response.expiresAtMillis).toISOString(),
36
36
  scopeGroups: response.scopeGroups,
37
- encodedOauthRefreshToken: response.encodedOauthRefreshToken,
37
+ encodedOAuthRefreshToken: response.encodedOAuthRefreshToken,
38
38
  };
39
39
  }
40
40
  exports.getAccessToken = getAccessToken;
@@ -89,7 +89,7 @@ async function accessTokenForPersonalAccessKey(accountId) {
89
89
  return auth?.tokenInfo?.accessToken;
90
90
  }
91
91
  exports.accessTokenForPersonalAccessKey = accessTokenForPersonalAccessKey;
92
- // Adds a account to the config using authType: personalAccessKey
92
+ // Adds an account to the config using authType: personalAccessKey
93
93
  const updateConfigWithPersonalAccessKey = async (personalAccessKey, name, env, makeDefault = false) => {
94
94
  const accountEnv = env || (0, config_1.getEnv)(name);
95
95
  let token;
package/lib/trackUsage.js CHANGED
@@ -37,7 +37,7 @@ async function trackUsage(eventName, eventClass, meta = {}, accountId) {
37
37
  (0, logger_1.debug)(`${i18nKey}.sendingEventAuthenticated`);
38
38
  return http_1.default.post(accountId, {
39
39
  url: `${path}/authenticated`,
40
- body: usageEvent,
40
+ data: usageEvent,
41
41
  resolveWithFullResponse: true,
42
42
  });
43
43
  }
@@ -46,7 +46,7 @@ async function trackUsage(eventName, eventClass, meta = {}, accountId) {
46
46
  http_1.default.post(accountId, {
47
47
  env,
48
48
  url: path,
49
- body: usageEvent,
49
+ data: usageEvent,
50
50
  resolveWithFullResponse: true,
51
51
  });
52
52
  }
@@ -1,6 +1,6 @@
1
1
  import { StatusCodeError } from '../types/Error';
2
2
  export declare class HubSpotAuthError extends Error {
3
- statusCode?: number;
3
+ status?: number;
4
4
  category?: string;
5
5
  subCategory?: string;
6
6
  constructor(message: string, { cause }: {
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HubSpotAuthError = void 0;
4
4
  class HubSpotAuthError extends Error {
5
- statusCode;
5
+ status;
6
6
  category;
7
7
  subCategory;
8
8
  constructor(message, { cause = {} }) {
9
9
  super(message);
10
10
  this.name = 'HubSpotAuthError';
11
- this.statusCode = cause.statusCode;
11
+ this.status = cause.status;
12
12
  this.category = cause?.response?.body?.category || undefined;
13
13
  this.subCategory =
14
14
  (cause.response &&
@@ -21,7 +21,7 @@ declare class OAuth2Manager {
21
21
  exchangeForTokens(exchangeProof: ExchangeProof): Promise<void>;
22
22
  refreshAccessToken(): Promise<void>;
23
23
  toObj(): {
24
- environment: "prod" | "qa";
24
+ env: import("../types/Config").Environment;
25
25
  clientSecret: string | undefined;
26
26
  clientId: string | undefined;
27
27
  scopes: string[] | undefined;
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
7
  const moment_1 = __importDefault(require("moment"));
8
- const environments_1 = require("../constants/environments");
9
8
  const urls_1 = require("../lib/urls");
10
9
  const environment_1 = require("../lib/environment");
11
10
  const logger_1 = require("../utils/logger");
@@ -18,9 +17,10 @@ class OAuth2Manager {
18
17
  writeTokenInfo;
19
18
  refreshTokenRequest;
20
19
  constructor(account, writeTokenInfo) {
21
- this.account = account;
22
20
  this.writeTokenInfo = writeTokenInfo;
23
21
  this.refreshTokenRequest = null;
22
+ this.account = account;
23
+ // NOTE: Potential issues by not using maskProductionValue = '' for env like in cli-lib
24
24
  }
25
25
  async accessToken() {
26
26
  if (!this.account.auth.tokenInfo?.refreshToken) {
@@ -106,7 +106,7 @@ class OAuth2Manager {
106
106
  }
107
107
  toObj() {
108
108
  return {
109
- environment: this.account.env ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD,
109
+ env: this.account.env,
110
110
  clientSecret: this.account.auth.clientSecret,
111
111
  clientId: this.account.auth.clientId,
112
112
  scopes: this.account.auth.scopes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "release:major": "yarn check-main && yarn version --major && yarn build && yarn pub && yarn push",
25
25
  "release:minor": "yarn check-main && yarn version --minor && yarn build && yarn pub && yarn push",
26
26
  "release:patch": "yarn check-main && yarn version --patch && yarn build && yarn pub && yarn push",
27
- "test": "jest --silent"
27
+ "test": "node --experimental-vm-modules ./node_modules/.bin/jest"
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "devDependencies": {
package/types/Error.d.ts CHANGED
@@ -9,13 +9,13 @@ export interface BaseError extends Error {
9
9
  code?: string | null;
10
10
  syscall?: string | null;
11
11
  reason?: string;
12
- statusCode?: number;
12
+ status?: number;
13
13
  error?: BaseError;
14
14
  errors?: Array<BaseError>;
15
15
  }
16
16
  export interface StatusCodeError extends BaseError {
17
17
  name: string;
18
- statusCode?: number;
18
+ status?: number;
19
19
  message: string;
20
20
  category?: string;
21
21
  subCategory?: string;
@@ -33,7 +33,7 @@ export interface StatusCodeError extends BaseError {
33
33
  headers: {
34
34
  [key: string]: string;
35
35
  };
36
- statusCode: number;
36
+ status: number;
37
37
  };
38
38
  options?: {
39
39
  method: HttpMethod;
package/types/Http.d.ts CHANGED
@@ -1,23 +1,20 @@
1
1
  /// <reference types="node" />
2
2
  import { ReadStream } from 'fs';
3
- export type Body = {
3
+ export type Data = {
4
4
  [key: string]: any;
5
5
  };
6
+ export type QueryParams = {
7
+ [key: string]: string | number | boolean | undefined;
8
+ };
6
9
  export type AxiosConfigOptions = {
10
+ baseURL?: string;
7
11
  url: string;
8
12
  env?: string;
9
13
  localHostOverride?: boolean;
10
- params?: {
11
- portalId?: number;
12
- buffer?: boolean;
13
- environmentId?: number;
14
- version?: string;
15
- };
16
- body?: Body | JSON;
14
+ params?: QueryParams;
15
+ data?: Data;
17
16
  resolveWithFullResponse?: boolean;
18
- };
19
- export type QueryParams = {
20
- [key: string]: string | number | boolean;
17
+ timeout?: number;
21
18
  };
22
19
  export type FormData = {
23
20
  [key: string]: string | ReadStream;
package/types/Hubdb.d.ts CHANGED
@@ -10,22 +10,25 @@ export type Schema = {
10
10
  export type Table = {
11
11
  id: string;
12
12
  name: string;
13
- portalId: number;
13
+ portalId?: number;
14
14
  createdAt: string;
15
15
  publishedAt: string;
16
16
  updatedAt: string;
17
17
  label: string;
18
18
  columns: Array<Column>;
19
- rows: Array<Row>;
20
- partitioningSettings?: null;
21
- published: boolean;
22
- cosObjectType: string;
23
- updated: number;
19
+ rows?: Array<Row>;
20
+ partitioningSettings?: {
21
+ teamIds: Array<any>;
22
+ userIds: Array<any>;
23
+ };
24
+ published?: boolean;
25
+ cosObjectType?: string;
26
+ updated?: number;
24
27
  archived: boolean;
25
- columnCount: number;
26
- cdnPurgeEmbargoTime: number | null;
28
+ columnCount?: number;
29
+ cdnPurgeEmbargoTime?: number | null;
27
30
  rowCount: number;
28
- createdBy: {
31
+ createdBy?: {
29
32
  id: string;
30
33
  email: string;
31
34
  firstName: string;
@@ -34,15 +37,17 @@ export type Table = {
34
37
  useForPages: boolean;
35
38
  allowChildTables: boolean;
36
39
  enableChildTablePages: boolean;
37
- crmObjectTypeId: number;
38
- dynamicMetaTags?: null;
40
+ crmObjectTypeId?: number;
41
+ dynamicMetaTags?: {
42
+ [key: string]: number;
43
+ };
39
44
  allowPublicApiAccess: boolean;
40
45
  };
41
46
  export type Column = {
42
47
  name: string;
43
48
  label: string;
44
- id: string;
45
- archived: boolean;
49
+ id?: string;
50
+ archived?: boolean;
46
51
  type: string;
47
52
  deleted?: boolean;
48
53
  foreignIdsByName?: {
@@ -66,7 +71,9 @@ export type Row = {
66
71
  updatedAt: string;
67
72
  publishedAt: string | null;
68
73
  values: {
69
- text_column: string;
74
+ text_column?: string;
75
+ number_column?: number;
76
+ multiselect?: Array<any>;
70
77
  };
71
78
  path: string | null;
72
79
  name: string | null;
@@ -76,8 +83,11 @@ export type Row = {
76
83
  export type CreateRowsResponse = {
77
84
  status: string;
78
85
  results: Array<Row>;
79
- startedAt: string;
80
- completedAt: string;
86
+ startedAt?: string;
87
+ completedAt?: string;
88
+ links?: {
89
+ [key: string]: any;
90
+ };
81
91
  };
82
92
  export type FetchRowsResponse = {
83
93
  total: number;
@@ -86,5 +96,5 @@ export type FetchRowsResponse = {
86
96
  next: {
87
97
  after: string | null;
88
98
  };
89
- };
99
+ } | null;
90
100
  };