@hubspot/local-dev-lib 4.0.4-beta.0 → 5.0.0-beta.0

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.
Files changed (194) hide show
  1. package/api/appsDev.d.ts +2 -2
  2. package/api/appsDev.js +13 -22
  3. package/api/crm.d.ts +2 -2
  4. package/api/crm.js +9 -16
  5. package/api/customObjects.d.ts +2 -2
  6. package/api/customObjects.js +13 -22
  7. package/api/designManager.d.ts +2 -2
  8. package/api/designManager.js +5 -10
  9. package/api/devSecrets.d.ts +2 -2
  10. package/api/devSecrets.js +9 -16
  11. package/api/developerTestAccounts.d.ts +3 -3
  12. package/api/developerTestAccounts.js +29 -40
  13. package/api/fileManager.d.ts +2 -2
  14. package/api/fileManager.js +14 -24
  15. package/api/fileMapper.d.ts +2 -2
  16. package/api/fileMapper.js +34 -49
  17. package/api/fileTransport.d.ts +1 -1
  18. package/api/fileTransport.js +12 -21
  19. package/api/fireAlarm.d.ts +2 -2
  20. package/api/fireAlarm.js +5 -9
  21. package/api/functions.d.ts +2 -2
  22. package/api/functions.js +11 -19
  23. package/api/github.d.ts +2 -4
  24. package/api/github.js +16 -27
  25. package/api/hubdb.d.ts +2 -2
  26. package/api/hubdb.js +19 -31
  27. package/api/lighthouseScore.d.ts +2 -2
  28. package/api/lighthouseScore.js +7 -13
  29. package/api/localDevAuth.d.ts +5 -5
  30. package/api/localDevAuth.js +17 -25
  31. package/api/marketplaceValidation.d.ts +2 -2
  32. package/api/marketplaceValidation.js +7 -13
  33. package/api/projects.d.ts +6 -8
  34. package/api/projects.js +65 -100
  35. package/api/sandboxHubs.d.ts +3 -3
  36. package/api/sandboxHubs.js +21 -30
  37. package/api/sandboxSync.d.ts +2 -2
  38. package/api/sandboxSync.js +7 -12
  39. package/api/secrets.d.ts +2 -2
  40. package/api/secrets.js +9 -16
  41. package/api/validateHubl.d.ts +2 -2
  42. package/api/validateHubl.js +3 -7
  43. package/config/defaultAccountOverride.js +18 -26
  44. package/config/index.d.ts +4 -4
  45. package/config/index.js +141 -177
  46. package/config/migrate.d.ts +2 -2
  47. package/config/migrate.js +26 -37
  48. package/config/state.d.ts +1 -1
  49. package/config/state.js +17 -45
  50. package/config/utils.d.ts +4 -4
  51. package/config/utils.js +85 -108
  52. package/constants/api.js +3 -6
  53. package/constants/auth.js +9 -12
  54. package/constants/config.js +37 -43
  55. package/constants/environments.js +1 -4
  56. package/constants/extensions.js +6 -9
  57. package/constants/files.js +5 -8
  58. package/constants/ports.js +3 -6
  59. package/constants/projects.js +2 -5
  60. package/enums/build.js +5 -8
  61. package/enums/deploy.js +2 -5
  62. package/enums/project.js +1 -4
  63. package/errors/errors_DEPRECATED.d.ts +1 -1
  64. package/errors/errors_DEPRECATED.js +2 -7
  65. package/errors/index.d.ts +4 -4
  66. package/errors/index.js +17 -31
  67. package/http/addQueryParams.d.ts +1 -1
  68. package/http/addQueryParams.js +1 -5
  69. package/http/client.js +16 -42
  70. package/http/getAxiosConfig.d.ts +1 -1
  71. package/http/getAxiosConfig.js +21 -31
  72. package/http/index.d.ts +2 -2
  73. package/http/index.js +39 -46
  74. package/http/unauthed.d.ts +1 -1
  75. package/http/unauthed.js +15 -18
  76. package/lib/archive.d.ts +1 -3
  77. package/lib/archive.js +38 -67
  78. package/lib/cms/functions.d.ts +1 -1
  79. package/lib/cms/functions.js +45 -55
  80. package/lib/cms/handleFieldsJS.js +36 -44
  81. package/lib/cms/modules.d.ts +2 -2
  82. package/lib/cms/modules.js +49 -59
  83. package/lib/cms/processFieldsJs.js +17 -32
  84. package/lib/cms/templates.js +17 -26
  85. package/lib/cms/themes.js +10 -18
  86. package/lib/cms/uploadFolder.d.ts +4 -4
  87. package/lib/cms/uploadFolder.js +55 -64
  88. package/lib/cms/validate.d.ts +1 -1
  89. package/lib/cms/validate.js +11 -18
  90. package/lib/cms/watch.d.ts +2 -2
  91. package/lib/cms/watch.js +66 -73
  92. package/lib/crm.d.ts +1 -1
  93. package/lib/crm.js +16 -23
  94. package/lib/customObjects.d.ts +1 -1
  95. package/lib/customObjects.js +15 -25
  96. package/lib/environment.d.ts +1 -1
  97. package/lib/environment.js +5 -11
  98. package/lib/escapeRegExp.js +1 -5
  99. package/lib/fileManager.js +43 -51
  100. package/lib/fileMapper.d.ts +1 -1
  101. package/lib/fileMapper.js +70 -84
  102. package/lib/fs.d.ts +1 -1
  103. package/lib/fs.js +18 -27
  104. package/lib/github.d.ts +1 -3
  105. package/lib/github.js +39 -51
  106. package/lib/gitignore.d.ts +1 -1
  107. package/lib/gitignore.js +16 -24
  108. package/lib/hubdb.d.ts +1 -1
  109. package/lib/hubdb.js +29 -40
  110. package/lib/ignoreRules.js +25 -34
  111. package/lib/isDeepEqual.js +1 -5
  112. package/lib/logger.d.ts +8 -20
  113. package/lib/logger.js +47 -59
  114. package/lib/notify.js +9 -16
  115. package/lib/oauth.d.ts +2 -2
  116. package/lib/oauth.js +12 -17
  117. package/lib/path.d.ts +0 -1
  118. package/lib/path.js +30 -48
  119. package/lib/personalAccessKey.d.ts +3 -3
  120. package/lib/personalAccessKey.js +47 -59
  121. package/lib/portManager.d.ts +2 -2
  122. package/lib/portManager.js +26 -41
  123. package/lib/text.js +2 -7
  124. package/lib/trackUsage.d.ts +2 -2
  125. package/lib/trackUsage.js +26 -29
  126. package/lib/urls.js +4 -9
  127. package/models/FileSystemError.d.ts +1 -1
  128. package/models/FileSystemError.js +12 -16
  129. package/models/HubSpotConfigError.d.ts +1 -1
  130. package/models/HubSpotConfigError.js +8 -12
  131. package/models/HubSpotHttpError.d.ts +1 -1
  132. package/models/HubSpotHttpError.js +22 -26
  133. package/models/OAuth2Manager.d.ts +1 -1
  134. package/models/OAuth2Manager.js +17 -24
  135. package/package.json +17 -16
  136. package/types/Accounts.d.ts +5 -5
  137. package/types/Accounts.js +1 -2
  138. package/types/Activity.d.ts +3 -3
  139. package/types/Activity.js +1 -2
  140. package/types/Api.d.ts +1 -1
  141. package/types/Api.js +1 -2
  142. package/types/Apps.js +1 -2
  143. package/types/Archive.js +1 -2
  144. package/types/Build.d.ts +5 -5
  145. package/types/Build.js +1 -2
  146. package/types/CLIOptions.js +1 -2
  147. package/types/ComponentStructure.d.ts +2 -2
  148. package/types/ComponentStructure.js +1 -2
  149. package/types/Config.d.ts +5 -5
  150. package/types/Config.js +1 -2
  151. package/types/Crm.js +1 -2
  152. package/types/Deploy.d.ts +5 -5
  153. package/types/Deploy.js +1 -2
  154. package/types/DesignManager.js +1 -2
  155. package/types/DevSecrets.js +1 -2
  156. package/types/Error.js +1 -2
  157. package/types/FieldsJS.js +1 -2
  158. package/types/FileManager.js +1 -2
  159. package/types/Files.d.ts +4 -4
  160. package/types/Files.js +1 -2
  161. package/types/FireAlarm.js +1 -2
  162. package/types/Functions.js +1 -2
  163. package/types/Github.d.ts +1 -1
  164. package/types/Github.js +1 -2
  165. package/types/Http.d.ts +0 -4
  166. package/types/Http.js +1 -2
  167. package/types/Hubdb.js +1 -2
  168. package/types/HublValidation.js +1 -2
  169. package/types/Lang.d.ts +1 -1
  170. package/types/Lang.js +1 -2
  171. package/types/Lighthouse.js +1 -2
  172. package/types/MarketplaceValidation.js +1 -2
  173. package/types/Migration.d.ts +2 -2
  174. package/types/Migration.js +1 -4
  175. package/types/Modules.js +1 -2
  176. package/types/PortManager.js +1 -2
  177. package/types/Project.d.ts +3 -3
  178. package/types/Project.js +1 -2
  179. package/types/ProjectLog.js +1 -2
  180. package/types/Sandbox.js +2 -5
  181. package/types/Schemas.js +1 -2
  182. package/types/Secrets.js +1 -2
  183. package/types/Utils.js +1 -2
  184. package/types/developerTestAccounts.js +1 -2
  185. package/utils/PortManagerServer.d.ts +1 -2
  186. package/utils/PortManagerServer.js +32 -38
  187. package/utils/cms/fieldsJS.d.ts +1 -1
  188. package/utils/cms/fieldsJS.js +1 -5
  189. package/utils/cms/modules.d.ts +1 -1
  190. package/utils/cms/modules.js +13 -22
  191. package/utils/detectPort.js +12 -19
  192. package/utils/git.js +17 -26
  193. package/utils/lang.d.ts +1 -1
  194. package/utils/lang.js +5 -14
@@ -1,4 +1,4 @@
1
- import { HubSpotPromise } from '../types/Http';
1
+ import { HubSpotPromise } from '../types/Http.js';
2
2
  export declare function createSchemaFromHubFile(accountId: number, filepath: string): HubSpotPromise;
3
3
  export declare function updateSchemaFromHubFile(accountId: number, filepath: string): HubSpotPromise;
4
4
  export declare function fetchHubFileSchema(accountId: number, objectName: string, path: string): HubSpotPromise;
@@ -1,17 +1,11 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchHubFileSchema = exports.updateSchemaFromHubFile = exports.createSchemaFromHubFile = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const path_2 = require("../lib/path");
10
- const http_1 = require("../http");
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getCwd } from '../lib/path.js';
4
+ import { http } from '../http/index.js';
11
5
  const HUBFILES_API_PATH = '/file-transport/v1/hubfiles';
12
- function createSchemaFromHubFile(accountId, filepath) {
13
- const file = fs_1.default.createReadStream(path_1.default.resolve((0, path_2.getCwd)(), filepath));
14
- return http_1.http.post(accountId, {
6
+ export function createSchemaFromHubFile(accountId, filepath) {
7
+ const file = fs.createReadStream(path.resolve(getCwd(), filepath));
8
+ return http.post(accountId, {
15
9
  url: `${HUBFILES_API_PATH}/object-schemas`,
16
10
  data: {
17
11
  file,
@@ -19,10 +13,9 @@ function createSchemaFromHubFile(accountId, filepath) {
19
13
  headers: { 'Content-Type': 'multipart/form-data' },
20
14
  });
21
15
  }
22
- exports.createSchemaFromHubFile = createSchemaFromHubFile;
23
- async function updateSchemaFromHubFile(accountId, filepath) {
24
- const file = fs_1.default.createReadStream(path_1.default.resolve((0, path_2.getCwd)(), filepath));
25
- return http_1.http.put(accountId, {
16
+ export async function updateSchemaFromHubFile(accountId, filepath) {
17
+ const file = fs.createReadStream(path.resolve(getCwd(), filepath));
18
+ return http.put(accountId, {
26
19
  url: `${HUBFILES_API_PATH}/object-schemas`,
27
20
  data: {
28
21
  file,
@@ -30,10 +23,8 @@ async function updateSchemaFromHubFile(accountId, filepath) {
30
23
  headers: { 'Content-Type': 'multipart/form-data' },
31
24
  });
32
25
  }
33
- exports.updateSchemaFromHubFile = updateSchemaFromHubFile;
34
- async function fetchHubFileSchema(accountId, objectName, path) {
35
- return http_1.http.getOctetStream(accountId, {
26
+ export async function fetchHubFileSchema(accountId, objectName, path) {
27
+ return http.getOctetStream(accountId, {
36
28
  url: `${HUBFILES_API_PATH}/object-schemas/${objectName}`,
37
29
  }, path);
38
30
  }
39
- exports.fetchHubFileSchema = fetchHubFileSchema;
@@ -1,4 +1,4 @@
1
- import { FireAlarm } from '../types/FireAlarm';
2
- import { HubSpotPromise } from '../types/Http';
1
+ import { FireAlarm } from '../types/FireAlarm.js';
2
+ import { HubSpotPromise } from '../types/Http.js';
3
3
  export declare const FIREALARM_API_AUTH_PATH = "firealarm/v4/alarm";
4
4
  export declare function fetchFireAlarms(accountId: number): HubSpotPromise<Array<FireAlarm>>;
package/api/fireAlarm.js CHANGED
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchFireAlarms = exports.FIREALARM_API_AUTH_PATH = void 0;
4
- const http_1 = require("../http");
5
- exports.FIREALARM_API_AUTH_PATH = 'firealarm/v4/alarm';
6
- function fetchFireAlarms(accountId) {
7
- return http_1.http.get(accountId, {
8
- url: `${exports.FIREALARM_API_AUTH_PATH}/hubspot-cli/${accountId}`,
1
+ import { http } from '../http/index.js';
2
+ export const FIREALARM_API_AUTH_PATH = 'firealarm/v4/alarm';
3
+ export function fetchFireAlarms(accountId) {
4
+ return http.get(accountId, {
5
+ url: `${FIREALARM_API_AUTH_PATH}/hubspot-cli/${accountId}`,
9
6
  });
10
7
  }
11
- exports.fetchFireAlarms = fetchFireAlarms;
@@ -1,5 +1,5 @@
1
- import { HubSpotPromise, QueryParams } from '../types/Http';
2
- import { GetBuildStatusResponse, FunctionLog, GetRoutesResponse, GetFunctionLogsResponse } from '../types/Functions';
1
+ import { HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { GetBuildStatusResponse, FunctionLog, GetRoutesResponse, GetFunctionLogsResponse } from '../types/Functions.js';
3
3
  export declare function getRoutes(accountId: number): HubSpotPromise<GetRoutesResponse>;
4
4
  export declare function getFunctionLogs(accountId: number, route: string, params?: QueryParams): HubSpotPromise<GetFunctionLogsResponse>;
5
5
  export declare function getLatestFunctionLog(accountId: number, route: string): HubSpotPromise<FunctionLog>;
package/api/functions.js CHANGED
@@ -1,30 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBuildStatus = exports.buildPackage = exports.getLatestFunctionLog = exports.getFunctionLogs = exports.getRoutes = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const FUNCTION_API_PATH = 'cms/v3/functions';
6
- function getRoutes(accountId) {
7
- return http_1.http.get(accountId, {
3
+ export function getRoutes(accountId) {
4
+ return http.get(accountId, {
8
5
  url: `${FUNCTION_API_PATH}/routes`,
9
6
  });
10
7
  }
11
- exports.getRoutes = getRoutes;
12
- function getFunctionLogs(accountId, route, params = {}) {
8
+ export function getFunctionLogs(accountId, route, params = {}) {
13
9
  const { limit = 5 } = params;
14
- return http_1.http.get(accountId, {
10
+ return http.get(accountId, {
15
11
  url: `${FUNCTION_API_PATH}/results/by-route/${encodeURIComponent(route)}`,
16
12
  params: { ...params, limit },
17
13
  });
18
14
  }
19
- exports.getFunctionLogs = getFunctionLogs;
20
- function getLatestFunctionLog(accountId, route) {
21
- return http_1.http.get(accountId, {
15
+ export function getLatestFunctionLog(accountId, route) {
16
+ return http.get(accountId, {
22
17
  url: `${FUNCTION_API_PATH}/results/by-route/${encodeURIComponent(route)}/latest`,
23
18
  });
24
19
  }
25
- exports.getLatestFunctionLog = getLatestFunctionLog;
26
- function buildPackage(accountId, folderPath) {
27
- return http_1.http.post(accountId, {
20
+ export function buildPackage(accountId, folderPath) {
21
+ return http.post(accountId, {
28
22
  url: `${FUNCTION_API_PATH}/build/async`,
29
23
  headers: {
30
24
  Accept: 'text/plain',
@@ -34,10 +28,8 @@ function buildPackage(accountId, folderPath) {
34
28
  },
35
29
  });
36
30
  }
37
- exports.buildPackage = buildPackage;
38
- function getBuildStatus(accountId, buildId) {
39
- return http_1.http.get(accountId, {
31
+ export function getBuildStatus(accountId, buildId) {
32
+ return http.get(accountId, {
40
33
  url: `${FUNCTION_API_PATH}/build/${buildId}/poll`,
41
34
  });
42
35
  }
43
- exports.getBuildStatus = getBuildStatus;
package/api/github.d.ts CHANGED
@@ -1,7 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { GithubReleaseData, GithubRepoFile, RepoPath } from '../types/Github';
4
- import { HubSpotPromise } from '../types/Http';
1
+ import { GithubReleaseData, GithubRepoFile, RepoPath } from '../types/Github.js';
2
+ import { HubSpotPromise } from '../types/Http.js';
5
3
  declare global {
6
4
  var githubToken: string;
7
5
  }
package/api/github.js CHANGED
@@ -1,12 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchRepoContents = exports.fetchRepoFileByDownloadUrl = exports.fetchRepoFile = exports.fetchRepoAsZip = exports.fetchRepoReleaseData = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const getAxiosConfig_1 = require("../http/getAxiosConfig");
9
- const errors_1 = require("../errors");
1
+ import axios from 'axios';
2
+ import { getDefaultUserAgentHeader } from '../http/getAxiosConfig.js';
3
+ import { isSpecifiedError } from '../errors/index.js';
10
4
  const GITHUB_REPOS_API = 'https://api.github.com/repos';
11
5
  const GITHUB_RAW_CONTENT_API_PATH = 'https://raw.githubusercontent.com';
12
6
  function getAdditionalHeaders() {
@@ -21,17 +15,17 @@ function getAdditionalHeaders() {
21
15
  }
22
16
  function githubRequestWithFallback(url, responseType) {
23
17
  const headersWithAuth = {
24
- ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(),
18
+ ...getDefaultUserAgentHeader(),
25
19
  ...getAdditionalHeaders(),
26
20
  };
27
21
  if (headersWithAuth.authorization) {
28
- return axios_1.default
22
+ return axios
29
23
  .get(url, { headers: headersWithAuth, responseType })
30
24
  .catch(error => {
31
25
  // 404 with an auth token might mean an SSO issue so retry without the authorization header
32
- if ((0, errors_1.isSpecifiedError)(error, { statusCode: 404 })) {
33
- return axios_1.default.get(url, {
34
- headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)() },
26
+ if (isSpecifiedError(error, { statusCode: 404 })) {
27
+ return axios.get(url, {
28
+ headers: { ...getDefaultUserAgentHeader() },
35
29
  responseType,
36
30
  });
37
31
  }
@@ -39,39 +33,34 @@ function githubRequestWithFallback(url, responseType) {
39
33
  });
40
34
  }
41
35
  // No auth token, proceed normally
42
- return axios_1.default.get(url, { headers: headersWithAuth, responseType });
36
+ return axios.get(url, { headers: headersWithAuth, responseType });
43
37
  }
44
38
  // Returns information about the repo's releases. Defaults to "latest" if no tag is provided
45
39
  // https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name
46
- function fetchRepoReleaseData(repoPath, tag = '') {
40
+ export function fetchRepoReleaseData(repoPath, tag = '') {
47
41
  const URL = `${GITHUB_REPOS_API}/${repoPath}/releases`;
48
42
  return githubRequestWithFallback(`${URL}/${tag ? `tags/${tag}` : 'latest'}`);
49
43
  }
50
- exports.fetchRepoReleaseData = fetchRepoReleaseData;
51
44
  // Returns the entire repo content as a zip, using the zipball_url from fetchRepoReleaseData()
52
45
  // https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-zip
53
- function fetchRepoAsZip(zipUrl) {
54
- return axios_1.default.get(zipUrl, {
46
+ export function fetchRepoAsZip(zipUrl) {
47
+ return axios.get(zipUrl, {
55
48
  responseType: 'arraybuffer',
56
- headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(), ...getAdditionalHeaders() },
49
+ headers: { ...getDefaultUserAgentHeader(), ...getAdditionalHeaders() },
57
50
  });
58
51
  }
59
- exports.fetchRepoAsZip = fetchRepoAsZip;
60
52
  // Returns the raw file contents via the raw.githubusercontent endpoint
61
- function fetchRepoFile(repoPath, filePath, ref) {
53
+ export function fetchRepoFile(repoPath, filePath, ref) {
62
54
  const url = `${GITHUB_RAW_CONTENT_API_PATH}/${repoPath}/${ref}/${filePath}`;
63
55
  return githubRequestWithFallback(url);
64
56
  }
65
- exports.fetchRepoFile = fetchRepoFile;
66
57
  // Returns the raw file contents via the raw.githubusercontent endpoint
67
- function fetchRepoFileByDownloadUrl(downloadUrl) {
58
+ export function fetchRepoFileByDownloadUrl(downloadUrl) {
68
59
  return githubRequestWithFallback(downloadUrl, 'arraybuffer');
69
60
  }
70
- exports.fetchRepoFileByDownloadUrl = fetchRepoFileByDownloadUrl;
71
61
  // Returns the contents of a file or directory in a repository by path
72
62
  // https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content
73
- function fetchRepoContents(repoPath, path, ref) {
63
+ export function fetchRepoContents(repoPath, path, ref) {
74
64
  const refQuery = ref ? `?ref=${ref}` : '';
75
65
  return githubRequestWithFallback(`${GITHUB_REPOS_API}/${repoPath}/contents/${path}${refQuery}`);
76
66
  }
77
- exports.fetchRepoContents = fetchRepoContents;
package/api/hubdb.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { HubSpotPromise, QueryParams } from '../types/Http';
2
- import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table, FetchTablesResponse } from '../types/Hubdb';
1
+ import { HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table, FetchTablesResponse } from '../types/Hubdb.js';
3
3
  export declare function fetchTables(accountId: number): HubSpotPromise<FetchTablesResponse>;
4
4
  export declare function fetchTable(accountId: number, tableId: string): HubSpotPromise<Table>;
5
5
  export declare function createTable(accountId: number, schema: Schema): HubSpotPromise<Table>;
package/api/hubdb.js CHANGED
@@ -1,67 +1,55 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteRows = exports.fetchRows = exports.createRows = exports.deleteTable = exports.publishTable = exports.updateTable = exports.createTable = exports.fetchTable = exports.fetchTables = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const HUBDB_API_PATH = 'cms/v3/hubdb';
6
- function fetchTables(accountId) {
7
- return http_1.http.get(accountId, {
3
+ export function fetchTables(accountId) {
4
+ return http.get(accountId, {
8
5
  url: `${HUBDB_API_PATH}/tables`,
9
6
  });
10
7
  }
11
- exports.fetchTables = fetchTables;
12
- function fetchTable(accountId, tableId) {
13
- return http_1.http.get(accountId, {
8
+ export function fetchTable(accountId, tableId) {
9
+ return http.get(accountId, {
14
10
  url: `${HUBDB_API_PATH}/tables/${tableId}`,
15
11
  });
16
12
  }
17
- exports.fetchTable = fetchTable;
18
- function createTable(accountId, schema) {
19
- return http_1.http.post(accountId, {
13
+ export function createTable(accountId, schema) {
14
+ return http.post(accountId, {
20
15
  url: `${HUBDB_API_PATH}/tables`,
21
16
  data: schema,
22
17
  });
23
18
  }
24
- exports.createTable = createTable;
25
- function updateTable(accountId, tableId, schema) {
26
- return http_1.http.patch(accountId, {
19
+ export function updateTable(accountId, tableId, schema) {
20
+ return http.patch(accountId, {
27
21
  url: `${HUBDB_API_PATH}/tables/${tableId}/draft`,
28
22
  data: schema,
29
23
  });
30
24
  }
31
- exports.updateTable = updateTable;
32
- function publishTable(accountId, tableId) {
33
- return http_1.http.post(accountId, {
25
+ export function publishTable(accountId, tableId) {
26
+ return http.post(accountId, {
34
27
  url: `${HUBDB_API_PATH}/tables/${tableId}/draft/publish`,
35
28
  headers: {
36
29
  'Content-Type': 'application/json',
37
30
  },
38
31
  });
39
32
  }
40
- exports.publishTable = publishTable;
41
- function deleteTable(accountId, tableId) {
42
- return http_1.http.delete(accountId, {
33
+ export function deleteTable(accountId, tableId) {
34
+ return http.delete(accountId, {
43
35
  url: `${HUBDB_API_PATH}/tables/${tableId}`,
44
36
  });
45
37
  }
46
- exports.deleteTable = deleteTable;
47
- function createRows(accountId, tableId, rows) {
48
- return http_1.http.post(accountId, {
38
+ export function createRows(accountId, tableId, rows) {
39
+ return http.post(accountId, {
49
40
  url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/create`,
50
41
  data: { inputs: rows },
51
42
  });
52
43
  }
53
- exports.createRows = createRows;
54
- function fetchRows(accountId, tableId, params = {}) {
55
- return http_1.http.get(accountId, {
44
+ export function fetchRows(accountId, tableId, params = {}) {
45
+ return http.get(accountId, {
56
46
  url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft`,
57
47
  params,
58
48
  });
59
49
  }
60
- exports.fetchRows = fetchRows;
61
- function deleteRows(accountId, tableId, rowIds) {
62
- return http_1.http.post(accountId, {
50
+ export function deleteRows(accountId, tableId, rowIds) {
51
+ return http.post(accountId, {
63
52
  url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/purge`,
64
53
  data: { inputs: rowIds },
65
54
  });
66
55
  }
67
- exports.deleteRows = deleteRows;
@@ -1,5 +1,5 @@
1
- import { Data, HubSpotPromise, QueryParams } from '../types/Http';
2
- import { GetLighthouseScoreResponse, RequestLighthouseScoreResponse } from '../types/Lighthouse';
1
+ import { Data, HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { GetLighthouseScoreResponse, RequestLighthouseScoreResponse } from '../types/Lighthouse.js';
3
3
  export declare function requestLighthouseScore(accountId: number, data?: Data): HubSpotPromise<RequestLighthouseScoreResponse>;
4
4
  export declare function getLighthouseScoreStatus(accountId: number, params?: QueryParams): HubSpotPromise<string>;
5
5
  export declare function getLighthouseScore(accountId: number, params?: QueryParams): HubSpotPromise<GetLighthouseScoreResponse>;
@@ -1,26 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getLighthouseScore = exports.getLighthouseScoreStatus = exports.requestLighthouseScore = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const LIGHTHOUSE_SCORE_API_BASE = 'quality-engine/v1/lighthouse';
6
- function requestLighthouseScore(accountId, data = {}) {
7
- return http_1.http.post(accountId, {
3
+ export function requestLighthouseScore(accountId, data = {}) {
4
+ return http.post(accountId, {
8
5
  url: `${LIGHTHOUSE_SCORE_API_BASE}/request`,
9
6
  data,
10
7
  });
11
8
  }
12
- exports.requestLighthouseScore = requestLighthouseScore;
13
- function getLighthouseScoreStatus(accountId, params = {}) {
14
- return http_1.http.get(accountId, {
9
+ export function getLighthouseScoreStatus(accountId, params = {}) {
10
+ return http.get(accountId, {
15
11
  url: `${LIGHTHOUSE_SCORE_API_BASE}/status`,
16
12
  params,
17
13
  });
18
14
  }
19
- exports.getLighthouseScoreStatus = getLighthouseScoreStatus;
20
- function getLighthouseScore(accountId, params = {}) {
21
- return http_1.http.get(accountId, {
15
+ export function getLighthouseScore(accountId, params = {}) {
16
+ return http.get(accountId, {
22
17
  url: `${LIGHTHOUSE_SCORE_API_BASE}/scores`,
23
18
  params,
24
19
  });
25
20
  }
26
- exports.getLighthouseScore = getLighthouseScore;
@@ -1,8 +1,8 @@
1
- import { Environment } from '../types/Config';
2
- import { ScopeData, AccessTokenResponse, EnabledFeaturesResponse, ScopeAuthorizationResponse } from '../types/Accounts';
3
- import { PublicAppInstallationData } from '../types/Apps';
4
- import { HubSpotPromise } from '../types/Http';
5
- export declare const LOCALDEVAUTH_ACCESS_TOKEN_PATH: string;
1
+ import { Environment } from '../types/Config.js';
2
+ import { ScopeData, AccessTokenResponse, EnabledFeaturesResponse, ScopeAuthorizationResponse } from '../types/Accounts.js';
3
+ import { PublicAppInstallationData } from '../types/Apps.js';
4
+ import { HubSpotPromise } from '../types/Http.js';
5
+ export declare const LOCALDEVAUTH_ACCESS_TOKEN_PATH = "localdevauth/v1/auth/refresh";
6
6
  export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): HubSpotPromise<AccessTokenResponse>;
7
7
  export declare function fetchScopeData(accountId: number, scopeGroup: string): HubSpotPromise<ScopeData>;
8
8
  export declare function fetchScopeAuthorizationData(accountId: number): HubSpotPromise<ScopeAuthorizationResponse>;
@@ -1,43 +1,37 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchEnabledFeatures = exports.fetchAppInstallationData = exports.fetchScopeAuthorizationData = exports.fetchScopeData = exports.fetchAccessToken = exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH = void 0;
4
- const getAxiosConfig_1 = require("../http/getAxiosConfig");
5
- const http_1 = require("../http");
6
- const environments_1 = require("../constants/environments");
7
- const client_1 = require("../http/client");
1
+ import { getAxiosConfig } from '../http/getAxiosConfig.js';
2
+ import { http } from '../http/index.js';
3
+ import { ENVIRONMENTS } from '../constants/environments.js';
4
+ import { httpClient } from '../http/client.js';
8
5
  const LOCALDEVAUTH_API_AUTH_PATH = 'localdevauth/v1/auth';
9
- exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH = `${LOCALDEVAUTH_API_AUTH_PATH}/refresh`;
10
- function fetchAccessToken(personalAccessKey, env = environments_1.ENVIRONMENTS.PROD, portalId) {
11
- const axiosConfig = (0, getAxiosConfig_1.getAxiosConfig)({
6
+ export const LOCALDEVAUTH_ACCESS_TOKEN_PATH = `${LOCALDEVAUTH_API_AUTH_PATH}/refresh`;
7
+ export function fetchAccessToken(personalAccessKey, env = ENVIRONMENTS.PROD, portalId) {
8
+ const axiosConfig = getAxiosConfig({
12
9
  env,
13
10
  localHostOverride: true,
14
- url: exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH,
11
+ url: LOCALDEVAUTH_ACCESS_TOKEN_PATH,
15
12
  data: {
16
13
  encodedOAuthRefreshToken: personalAccessKey,
17
14
  },
18
15
  params: portalId ? { portalId } : {},
19
16
  });
20
- return (0, client_1.httpClient)({
17
+ return httpClient({
21
18
  ...axiosConfig,
22
19
  method: 'post',
23
20
  });
24
21
  }
25
- exports.fetchAccessToken = fetchAccessToken;
26
- function fetchScopeData(accountId, scopeGroup) {
27
- return http_1.http.get(accountId, {
22
+ export function fetchScopeData(accountId, scopeGroup) {
23
+ return http.get(accountId, {
28
24
  url: `${LOCALDEVAUTH_API_AUTH_PATH}/check-scopes`,
29
25
  params: { scopeGroup },
30
26
  });
31
27
  }
32
- exports.fetchScopeData = fetchScopeData;
33
- async function fetchScopeAuthorizationData(accountId) {
34
- return http_1.http.get(accountId, {
28
+ export async function fetchScopeAuthorizationData(accountId) {
29
+ return http.get(accountId, {
35
30
  url: `${LOCALDEVAUTH_API_AUTH_PATH}/scope-groups/authorized`,
36
31
  });
37
32
  }
38
- exports.fetchScopeAuthorizationData = fetchScopeAuthorizationData;
39
- function fetchAppInstallationData(portalId, projectId, appUid, requiredScopeGroups, optionalScopeGroups = []) {
40
- return http_1.http.post(portalId, {
33
+ export function fetchAppInstallationData(portalId, projectId, appUid, requiredScopeGroups, optionalScopeGroups = []) {
34
+ return http.post(portalId, {
41
35
  url: `${LOCALDEVAUTH_API_AUTH_PATH}/install-info`,
42
36
  data: {
43
37
  portalId,
@@ -48,10 +42,8 @@ function fetchAppInstallationData(portalId, projectId, appUid, requiredScopeGrou
48
42
  },
49
43
  });
50
44
  }
51
- exports.fetchAppInstallationData = fetchAppInstallationData;
52
- async function fetchEnabledFeatures(accountId) {
53
- return http_1.http.get(accountId, {
45
+ export async function fetchEnabledFeatures(accountId) {
46
+ return http.get(accountId, {
54
47
  url: `${LOCALDEVAUTH_API_AUTH_PATH}/enabled-features`,
55
48
  });
56
49
  }
57
- exports.fetchEnabledFeatures = fetchEnabledFeatures;
@@ -1,5 +1,5 @@
1
- import { Data, HubSpotPromise, QueryParams } from '../types/Http';
2
- import { GetValidationResultsResponse } from '../types/MarketplaceValidation';
1
+ import { Data, HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { GetValidationResultsResponse } from '../types/MarketplaceValidation.js';
3
3
  export declare function requestValidation(accountId: number, data?: Data): HubSpotPromise<number>;
4
4
  export declare function getValidationStatus(accountId: number, params?: QueryParams): HubSpotPromise<string>;
5
5
  export declare function getValidationResults(accountId: number, params?: QueryParams): HubSpotPromise<GetValidationResultsResponse>;
@@ -1,26 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidationResults = exports.getValidationStatus = exports.requestValidation = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const VALIDATION_API_BASE = 'quality-engine/v1/validation';
6
- function requestValidation(accountId, data = {}) {
7
- return http_1.http.post(accountId, {
3
+ export function requestValidation(accountId, data = {}) {
4
+ return http.post(accountId, {
8
5
  url: `${VALIDATION_API_BASE}/request`,
9
6
  data,
10
7
  });
11
8
  }
12
- exports.requestValidation = requestValidation;
13
- function getValidationStatus(accountId, params = {}) {
14
- return http_1.http.get(accountId, {
9
+ export function getValidationStatus(accountId, params = {}) {
10
+ return http.get(accountId, {
15
11
  url: `${VALIDATION_API_BASE}/status`,
16
12
  params,
17
13
  });
18
14
  }
19
- exports.getValidationStatus = getValidationStatus;
20
- function getValidationResults(accountId, params = {}) {
21
- return http_1.http.get(accountId, {
15
+ export function getValidationResults(accountId, params = {}) {
16
+ return http.get(accountId, {
22
17
  url: `${VALIDATION_API_BASE}/results`,
23
18
  params,
24
19
  });
25
20
  }
26
- exports.getValidationResults = getValidationResults;
package/api/projects.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { HubSpotPromise, QueryParams } from '../types/Http';
4
- import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project';
5
- import { Build, FetchProjectBuildsResponse } from '../types/Build';
6
- import { ComponentStructureResponse, ProjectComponentsMetadata } from '../types/ComponentStructure';
7
- import { Deploy, ProjectDeployResponse, ProjectDeployResponseV1 } from '../types/Deploy';
8
- import { MigrateAppResponse, CloneAppResponse, PollAppResponse } from '../types/Migration';
1
+ import { HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project.js';
3
+ import { Build, FetchProjectBuildsResponse } from '../types/Build.js';
4
+ import { ComponentStructureResponse, ProjectComponentsMetadata } from '../types/ComponentStructure.js';
5
+ import { Deploy, ProjectDeployResponse, ProjectDeployResponseV1 } from '../types/Deploy.js';
6
+ import { MigrateAppResponse, CloneAppResponse, PollAppResponse } from '../types/Migration.js';
9
7
  export declare function fetchProjects(accountId: number): HubSpotPromise<FetchProjectResponse>;
10
8
  export declare function createProject(accountId: number, name: string): HubSpotPromise<Project>;
11
9
  export declare function uploadProject(accountId: number, projectName: string, projectFile: string, uploadMessage: string, platformVersion?: string, intermediateRepresentation?: unknown): HubSpotPromise<UploadProjectResponse | UploadIRResponse>;