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

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 (205) 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 +2 -4
  12. package/api/developerTestAccounts.js +23 -52
  13. package/api/fileManager.d.ts +2 -2
  14. package/api/fileManager.js +14 -24
  15. package/api/fileMapper.d.ts +2 -3
  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 -3
  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 +3 -6
  30. package/api/localDevAuth.js +10 -37
  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 +2 -5
  36. package/api/sandboxHubs.js +15 -42
  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.d.ts +2 -1
  44. package/config/defaultAccountOverride.js +16 -26
  45. package/config/index.d.ts +4 -4
  46. package/config/index.js +141 -177
  47. package/config/migrate.d.ts +2 -2
  48. package/config/migrate.js +26 -37
  49. package/config/state.d.ts +1 -1
  50. package/config/state.js +17 -45
  51. package/config/utils.d.ts +4 -4
  52. package/config/utils.js +85 -108
  53. package/constants/api.js +3 -6
  54. package/constants/auth.js +9 -12
  55. package/constants/config.js +37 -43
  56. package/constants/endpoints.d.ts +6 -0
  57. package/constants/endpoints.js +6 -0
  58. package/constants/environments.js +1 -4
  59. package/constants/extensions.js +6 -9
  60. package/constants/files.js +5 -8
  61. package/constants/ports.js +3 -6
  62. package/constants/projects.js +2 -5
  63. package/enums/build.d.ts +1 -0
  64. package/enums/build.js +6 -8
  65. package/enums/deploy.js +2 -5
  66. package/enums/project.js +1 -4
  67. package/errors/index.d.ts +4 -5
  68. package/errors/index.js +17 -39
  69. package/errors/isSystemError.d.ts +2 -0
  70. package/errors/isSystemError.js +9 -0
  71. package/http/addQueryParams.d.ts +1 -1
  72. package/http/addQueryParams.js +1 -5
  73. package/http/client.js +14 -42
  74. package/http/getAxiosConfig.d.ts +1 -1
  75. package/http/getAxiosConfig.js +21 -31
  76. package/http/index.d.ts +2 -2
  77. package/http/index.js +39 -46
  78. package/http/unauthed.d.ts +1 -1
  79. package/http/unauthed.js +15 -18
  80. package/lang/en.json +1 -1
  81. package/lib/archive.d.ts +1 -3
  82. package/lib/archive.js +37 -67
  83. package/lib/cms/functions.d.ts +1 -1
  84. package/lib/cms/functions.js +45 -55
  85. package/lib/cms/handleFieldsJS.js +36 -44
  86. package/lib/cms/modules.d.ts +2 -2
  87. package/lib/cms/modules.js +49 -59
  88. package/lib/cms/processFieldsJs.js +17 -32
  89. package/lib/cms/templates.js +17 -26
  90. package/lib/cms/themes.js +10 -18
  91. package/lib/cms/uploadFolder.d.ts +4 -4
  92. package/lib/cms/uploadFolder.js +55 -64
  93. package/lib/cms/validate.d.ts +1 -1
  94. package/lib/cms/validate.js +11 -18
  95. package/lib/cms/watch.d.ts +2 -2
  96. package/lib/cms/watch.js +66 -73
  97. package/lib/crm.d.ts +1 -1
  98. package/lib/crm.js +15 -23
  99. package/lib/customObjects.d.ts +1 -1
  100. package/lib/customObjects.js +15 -25
  101. package/lib/environment.d.ts +1 -1
  102. package/lib/environment.js +5 -11
  103. package/lib/escapeRegExp.js +1 -5
  104. package/lib/fileManager.js +43 -51
  105. package/lib/fileMapper.d.ts +1 -1
  106. package/lib/fileMapper.js +68 -84
  107. package/lib/fs.d.ts +1 -1
  108. package/lib/fs.js +18 -27
  109. package/lib/github.d.ts +1 -3
  110. package/lib/github.js +39 -51
  111. package/lib/gitignore.d.ts +1 -1
  112. package/lib/gitignore.js +16 -24
  113. package/lib/hubdb.d.ts +1 -1
  114. package/lib/hubdb.js +29 -40
  115. package/lib/ignoreRules.js +25 -34
  116. package/lib/isDeepEqual.js +1 -5
  117. package/lib/logger.d.ts +8 -20
  118. package/lib/logger.js +47 -59
  119. package/lib/notify.js +9 -16
  120. package/lib/oauth.d.ts +2 -2
  121. package/lib/oauth.js +12 -17
  122. package/lib/path.d.ts +0 -1
  123. package/lib/path.js +30 -48
  124. package/lib/personalAccessKey.d.ts +2 -4
  125. package/lib/personalAccessKey.js +43 -60
  126. package/lib/portManager.d.ts +2 -2
  127. package/lib/portManager.js +26 -41
  128. package/lib/text.js +2 -7
  129. package/lib/trackUsage.d.ts +0 -2
  130. package/lib/trackUsage.js +23 -29
  131. package/lib/urls.js +4 -9
  132. package/models/FileSystemError.d.ts +1 -1
  133. package/models/FileSystemError.js +12 -16
  134. package/models/HubSpotConfigError.d.ts +1 -1
  135. package/models/HubSpotConfigError.js +8 -12
  136. package/models/HubSpotHttpError.d.ts +1 -1
  137. package/models/HubSpotHttpError.js +22 -26
  138. package/models/OAuth2Manager.d.ts +1 -1
  139. package/models/OAuth2Manager.js +17 -24
  140. package/package.json +20 -16
  141. package/types/Accounts.d.ts +6 -5
  142. package/types/Accounts.js +1 -2
  143. package/types/Activity.d.ts +3 -3
  144. package/types/Activity.js +1 -2
  145. package/types/Api.d.ts +1 -1
  146. package/types/Api.js +1 -2
  147. package/types/Apps.js +1 -2
  148. package/types/Archive.js +1 -2
  149. package/types/Build.d.ts +4 -5
  150. package/types/Build.js +1 -2
  151. package/types/CLIOptions.js +1 -2
  152. package/types/ComponentStructure.d.ts +2 -2
  153. package/types/ComponentStructure.js +1 -2
  154. package/types/Config.d.ts +4 -6
  155. package/types/Config.js +1 -2
  156. package/types/Crm.js +1 -2
  157. package/types/Deploy.d.ts +5 -11
  158. package/types/Deploy.js +1 -2
  159. package/types/DesignManager.js +1 -2
  160. package/types/DevSecrets.js +1 -2
  161. package/types/Error.js +1 -2
  162. package/types/FieldsJS.js +1 -2
  163. package/types/FileManager.js +1 -2
  164. package/types/Files.d.ts +4 -4
  165. package/types/Files.js +1 -2
  166. package/types/FireAlarm.js +1 -2
  167. package/types/Functions.js +1 -2
  168. package/types/Github.d.ts +1 -1
  169. package/types/Github.js +1 -2
  170. package/types/Http.d.ts +0 -4
  171. package/types/Http.js +1 -2
  172. package/types/Hubdb.js +1 -2
  173. package/types/HublValidation.js +1 -2
  174. package/types/Lang.d.ts +1 -1
  175. package/types/Lang.js +1 -2
  176. package/types/Lighthouse.js +1 -2
  177. package/types/MarketplaceValidation.js +1 -2
  178. package/types/Migration.d.ts +2 -2
  179. package/types/Migration.js +1 -4
  180. package/types/Modules.js +1 -2
  181. package/types/PortManager.js +1 -2
  182. package/types/Project.d.ts +3 -21
  183. package/types/Project.js +1 -2
  184. package/types/ProjectComponents.d.ts +24 -0
  185. package/types/ProjectComponents.js +1 -0
  186. package/types/ProjectLog.js +1 -2
  187. package/types/Sandbox.js +2 -5
  188. package/types/Schemas.js +1 -2
  189. package/types/Secrets.js +1 -2
  190. package/types/Utils.js +1 -2
  191. package/types/developerTestAccounts.js +1 -2
  192. package/utils/PortManagerServer.d.ts +1 -2
  193. package/utils/PortManagerServer.js +32 -38
  194. package/utils/cms/fieldsJS.d.ts +1 -1
  195. package/utils/cms/fieldsJS.js +1 -5
  196. package/utils/cms/modules.d.ts +1 -1
  197. package/utils/cms/modules.js +13 -22
  198. package/utils/detectPort.js +12 -19
  199. package/utils/git.js +17 -26
  200. package/utils/lang.d.ts +1 -1
  201. package/utils/lang.js +5 -14
  202. package/utils/personalAccessKey.d.ts +8 -0
  203. package/utils/personalAccessKey.js +51 -0
  204. package/errors/errors_DEPRECATED.d.ts +0 -3
  205. package/errors/errors_DEPRECATED.js +0 -60
package/api/appsDev.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PublicApp, PublicAppInstallCounts, PublicAppDeveloperTestAccountInstallData, FetchPublicAppsForPortalResponse } from '../types/Apps';
2
- import { HubSpotPromise } from '../types/Http';
1
+ import { PublicApp, PublicAppInstallCounts, PublicAppDeveloperTestAccountInstallData, FetchPublicAppsForPortalResponse } from '../types/Apps.js';
2
+ import { HubSpotPromise } from '../types/Http.js';
3
3
  export declare function fetchPublicAppsForPortal(accountId: number): HubSpotPromise<FetchPublicAppsForPortalResponse>;
4
4
  export declare function fetchPublicAppDeveloperTestAccountInstallData(appId: number, accountId: number): HubSpotPromise<PublicAppDeveloperTestAccountInstallData>;
5
5
  export declare function fetchPublicAppProductionInstallCounts(appId: number, accountId: number): HubSpotPromise<PublicAppInstallCounts>;
package/api/appsDev.js CHANGED
@@ -1,35 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAppMetadataByUid = exports.installStaticAuthAppOnTestAccount = exports.fetchPublicAppMetadata = exports.fetchPublicAppProductionInstallCounts = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const APPS_DEV_API_PATH = 'apps-dev/external/public/v3';
6
3
  const APPS_HUBLETS_API_PATH = 'apps-hublets/external/static-token/v3';
7
- function fetchPublicAppsForPortal(accountId) {
8
- return http_1.http.get(accountId, {
4
+ export function fetchPublicAppsForPortal(accountId) {
5
+ return http.get(accountId, {
9
6
  url: `${APPS_DEV_API_PATH}/full/portal`,
10
7
  });
11
8
  }
12
- exports.fetchPublicAppsForPortal = fetchPublicAppsForPortal;
13
- function fetchPublicAppDeveloperTestAccountInstallData(appId, accountId) {
14
- return http_1.http.get(accountId, {
9
+ export function fetchPublicAppDeveloperTestAccountInstallData(appId, accountId) {
10
+ return http.get(accountId, {
15
11
  url: `${APPS_DEV_API_PATH}/${appId}/test-portal-installs`,
16
12
  });
17
13
  }
18
- exports.fetchPublicAppDeveloperTestAccountInstallData = fetchPublicAppDeveloperTestAccountInstallData;
19
- function fetchPublicAppProductionInstallCounts(appId, accountId) {
20
- return http_1.http.get(accountId, {
14
+ export function fetchPublicAppProductionInstallCounts(appId, accountId) {
15
+ return http.get(accountId, {
21
16
  url: `${APPS_DEV_API_PATH}/${appId}/install-counts-without-test-portals`,
22
17
  });
23
18
  }
24
- exports.fetchPublicAppProductionInstallCounts = fetchPublicAppProductionInstallCounts;
25
- function fetchPublicAppMetadata(appId, accountId) {
26
- return http_1.http.get(accountId, {
19
+ export function fetchPublicAppMetadata(appId, accountId) {
20
+ return http.get(accountId, {
27
21
  url: `${APPS_DEV_API_PATH}/${appId}/full`,
28
22
  });
29
23
  }
30
- exports.fetchPublicAppMetadata = fetchPublicAppMetadata;
31
- function installStaticAuthAppOnTestAccount(appId, accountId, scopeGroupIds) {
32
- return http_1.http.post(accountId, {
24
+ export function installStaticAuthAppOnTestAccount(appId, accountId, scopeGroupIds) {
25
+ return http.post(accountId, {
33
26
  url: APPS_HUBLETS_API_PATH,
34
27
  data: {
35
28
  appId,
@@ -38,13 +31,11 @@ function installStaticAuthAppOnTestAccount(appId, accountId, scopeGroupIds) {
38
31
  },
39
32
  });
40
33
  }
41
- exports.installStaticAuthAppOnTestAccount = installStaticAuthAppOnTestAccount;
42
- function fetchAppMetadataByUid(appUid, accountId) {
43
- return http_1.http.get(accountId, {
34
+ export function fetchAppMetadataByUid(appUid, accountId) {
35
+ return http.get(accountId, {
44
36
  url: `${APPS_DEV_API_PATH}/full/portal/sourceId`,
45
37
  params: {
46
38
  sourceId: appUid,
47
39
  },
48
40
  });
49
41
  }
50
- exports.fetchAppMetadataByUid = fetchAppMetadataByUid;
package/api/crm.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { HubSpotPromise } from '../types/Http';
2
- import { ImportRequest, ImportResponse } from '../types/Crm';
1
+ import { HubSpotPromise } from '../types/Http.js';
2
+ import { ImportRequest, ImportResponse } from '../types/Crm.js';
3
3
  export declare function createImport(accountId: number, importRequest: ImportRequest, dataFileNames: string[]): HubSpotPromise<ImportResponse>;
package/api/crm.js CHANGED
@@ -1,24 +1,18 @@
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.createImport = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const fs_extra_1 = __importDefault(require("fs-extra"));
9
- const form_data_1 = __importDefault(require("form-data"));
10
- const http_1 = require("../http");
11
- const path_2 = require("../lib/path");
1
+ import path from 'path';
2
+ import fs from 'fs-extra';
3
+ import FormData from 'form-data';
4
+ import { http } from '../http/index.js';
5
+ import { getCwd } from '../lib/path.js';
12
6
  const HUBSPOT_CRM_IMPORT_PATH = '/crm/v3/imports';
13
- function createImport(accountId, importRequest, dataFileNames) {
7
+ export function createImport(accountId, importRequest, dataFileNames) {
14
8
  const jsonImportRequest = JSON.stringify(importRequest);
15
- const formData = new form_data_1.default();
9
+ const formData = new FormData();
16
10
  formData.append('importRequest', jsonImportRequest);
17
11
  dataFileNames.forEach(file => {
18
- const stream = fs_extra_1.default.createReadStream(path_1.default.resolve((0, path_2.getCwd)(), file));
12
+ const stream = fs.createReadStream(path.resolve(getCwd(), file));
19
13
  formData.append('files', stream, file);
20
14
  });
21
- return http_1.http.post(accountId, {
15
+ return http.post(accountId, {
22
16
  url: `${HUBSPOT_CRM_IMPORT_PATH}`,
23
17
  data: formData,
24
18
  headers: {
@@ -26,4 +20,3 @@ function createImport(accountId, importRequest, dataFileNames) {
26
20
  },
27
21
  });
28
22
  }
29
- exports.createImport = createImport;
@@ -1,5 +1,5 @@
1
- import { FetchSchemasResponse, Schema, SchemaDefinition, ObjectDefinition, CreateObjectsResponse } from '../types/Schemas';
2
- import { HubSpotPromise } from '../types/Http';
1
+ import { FetchSchemasResponse, Schema, SchemaDefinition, ObjectDefinition, CreateObjectsResponse } from '../types/Schemas.js';
2
+ import { HubSpotPromise } from '../types/Http.js';
3
3
  export declare function batchCreateObjects(accountId: number, objectTypeId: string, objects: ObjectDefinition): HubSpotPromise<CreateObjectsResponse>;
4
4
  export declare function createObjectSchema(accountId: number, schema: SchemaDefinition): HubSpotPromise<Schema>;
5
5
  export declare function updateObjectSchema(accountId: number, schemaObjectType: string, schema: SchemaDefinition): HubSpotPromise<Schema>;
@@ -1,45 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteObjectSchema = exports.fetchObjectSchemas = exports.fetchObjectSchema = exports.updateObjectSchema = exports.createObjectSchema = exports.batchCreateObjects = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const CUSTOM_OBJECTS_API_PATH = 'crm/v3/objects';
6
3
  const SCHEMA_API_PATH = 'crm-object-schemas/v3/schemas';
7
- function batchCreateObjects(accountId, objectTypeId, objects) {
8
- return http_1.http.post(accountId, {
4
+ export function batchCreateObjects(accountId, objectTypeId, objects) {
5
+ return http.post(accountId, {
9
6
  url: `${CUSTOM_OBJECTS_API_PATH}/${objectTypeId}/batch/create`,
10
7
  data: objects,
11
8
  });
12
9
  }
13
- exports.batchCreateObjects = batchCreateObjects;
14
- function createObjectSchema(accountId, schema) {
15
- return http_1.http.post(accountId, {
10
+ export function createObjectSchema(accountId, schema) {
11
+ return http.post(accountId, {
16
12
  url: SCHEMA_API_PATH,
17
13
  data: schema,
18
14
  });
19
15
  }
20
- exports.createObjectSchema = createObjectSchema;
21
- function updateObjectSchema(accountId, schemaObjectType, schema) {
22
- return http_1.http.patch(accountId, {
16
+ export function updateObjectSchema(accountId, schemaObjectType, schema) {
17
+ return http.patch(accountId, {
23
18
  url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
24
19
  data: schema,
25
20
  });
26
21
  }
27
- exports.updateObjectSchema = updateObjectSchema;
28
- function fetchObjectSchema(accountId, schemaObjectType) {
29
- return http_1.http.get(accountId, {
22
+ export function fetchObjectSchema(accountId, schemaObjectType) {
23
+ return http.get(accountId, {
30
24
  url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
31
25
  });
32
26
  }
33
- exports.fetchObjectSchema = fetchObjectSchema;
34
- function fetchObjectSchemas(accountId) {
35
- return http_1.http.get(accountId, {
27
+ export function fetchObjectSchemas(accountId) {
28
+ return http.get(accountId, {
36
29
  url: SCHEMA_API_PATH,
37
30
  });
38
31
  }
39
- exports.fetchObjectSchemas = fetchObjectSchemas;
40
- function deleteObjectSchema(accountId, schemaObjectType) {
41
- return http_1.http.delete(accountId, {
32
+ export function deleteObjectSchema(accountId, schemaObjectType) {
33
+ return http.delete(accountId, {
42
34
  url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
43
35
  });
44
36
  }
45
- exports.deleteObjectSchema = deleteObjectSchema;
@@ -1,4 +1,4 @@
1
- import { HubSpotPromise, QueryParams } from '../types/Http';
2
- import { FetchThemesResponse, FetchBuiltinMappingResponse } from '../types/DesignManager';
1
+ import { HubSpotPromise, QueryParams } from '../types/Http.js';
2
+ import { FetchThemesResponse, FetchBuiltinMappingResponse } from '../types/DesignManager.js';
3
3
  export declare function fetchThemes(accountId: number, params?: QueryParams): HubSpotPromise<FetchThemesResponse>;
4
4
  export declare function fetchBuiltinMapping(accountId: number): HubSpotPromise<FetchBuiltinMappingResponse>;
@@ -1,18 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchBuiltinMapping = exports.fetchThemes = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const DESIGN_MANAGER_API_PATH = 'designmanager/v1';
6
- function fetchThemes(accountId, params = {}) {
7
- return http_1.http.get(accountId, {
3
+ export function fetchThemes(accountId, params = {}) {
4
+ return http.get(accountId, {
8
5
  url: `${DESIGN_MANAGER_API_PATH}/themes/combined`,
9
6
  params,
10
7
  });
11
8
  }
12
- exports.fetchThemes = fetchThemes;
13
- function fetchBuiltinMapping(accountId) {
14
- return http_1.http.get(accountId, {
9
+ export function fetchBuiltinMapping(accountId) {
10
+ return http.get(accountId, {
15
11
  url: `${DESIGN_MANAGER_API_PATH}/widgets/builtin-mapping`,
16
12
  });
17
13
  }
18
- exports.fetchBuiltinMapping = fetchBuiltinMapping;
@@ -1,5 +1,5 @@
1
- import { HubSpotPromise } from '../types/Http';
2
- import { FetchDevSecretsResponse } from '../types/DevSecrets';
1
+ import { HubSpotPromise } from '../types/Http.js';
2
+ import { FetchDevSecretsResponse } from '../types/DevSecrets.js';
3
3
  export declare function addAppSecret(accountId: number, appId: number, key: string, value: string): HubSpotPromise<void>;
4
4
  export declare function updateAppSecret(accountId: number, appId: number, key: string, value: string): HubSpotPromise<void>;
5
5
  export declare function deleteAppSecret(accountId: number, appId: number, key: string): HubSpotPromise<void>;
package/api/devSecrets.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchAppSecrets = exports.deleteAppSecret = exports.updateAppSecret = exports.addAppSecret = void 0;
4
- const http_1 = require("../http");
1
+ import { http } from '../http/index.js';
5
2
  const DEV_SECRETS_API_PATH = 'dev-secrets/management/v3';
6
- function addAppSecret(accountId, appId, key, value) {
7
- return http_1.http.post(accountId, {
3
+ export function addAppSecret(accountId, appId, key, value) {
4
+ return http.post(accountId, {
8
5
  url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
9
6
  data: {
10
7
  key,
@@ -12,9 +9,8 @@ function addAppSecret(accountId, appId, key, value) {
12
9
  },
13
10
  });
14
11
  }
15
- exports.addAppSecret = addAppSecret;
16
- function updateAppSecret(accountId, appId, key, value) {
17
- return http_1.http.patch(accountId, {
12
+ export function updateAppSecret(accountId, appId, key, value) {
13
+ return http.patch(accountId, {
18
14
  url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
19
15
  data: {
20
16
  key,
@@ -22,19 +18,16 @@ function updateAppSecret(accountId, appId, key, value) {
22
18
  },
23
19
  });
24
20
  }
25
- exports.updateAppSecret = updateAppSecret;
26
- function deleteAppSecret(accountId, appId, key) {
27
- return http_1.http.delete(accountId, {
21
+ export function deleteAppSecret(accountId, appId, key) {
22
+ return http.delete(accountId, {
28
23
  url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
29
24
  data: {
30
25
  key,
31
26
  },
32
27
  });
33
28
  }
34
- exports.deleteAppSecret = deleteAppSecret;
35
- function fetchAppSecrets(accountId, appId) {
36
- return http_1.http.get(accountId, {
29
+ export function fetchAppSecrets(accountId, appId) {
30
+ return http.get(accountId, {
37
31
  url: `${DEV_SECRETS_API_PATH}/keys/app/${appId}`,
38
32
  });
39
33
  }
40
- exports.fetchAppSecrets = fetchAppSecrets;
@@ -1,11 +1,9 @@
1
- import { DeveloperTestAccount, CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse, DeveloperTestAccountConfig, CreateDeveloperTestAccountV3Response, InstallOauthAppIntoDeveloperTestAccountResponse, TestPortalStatusResponse, GenerateDeveloperTestAccountPersonalAccessKeyResponse } from '../types/developerTestAccounts';
2
- import { Environment } from '../types/Config';
3
- import { HubSpotPromise } from '../types/Http';
1
+ import { CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse, DeveloperTestAccountConfig, CreateDeveloperTestAccountV3Response, InstallOauthAppIntoDeveloperTestAccountResponse, TestPortalStatusResponse, GenerateDeveloperTestAccountPersonalAccessKeyResponse } from '../types/developerTestAccounts.js';
2
+ import { HubSpotPromise } from '../types/Http.js';
4
3
  export declare function fetchDeveloperTestAccounts(accountId: number): HubSpotPromise<FetchDeveloperTestAccountsResponse>;
5
4
  export declare function createDeveloperTestAccount(accountId: number, accountInfo: string): HubSpotPromise<CreateDeveloperTestAccountResponse>;
6
5
  export declare function createDeveloperTestAccount(accountId: number, accountInfo: DeveloperTestAccountConfig): HubSpotPromise<CreateDeveloperTestAccountV3Response>;
7
6
  export declare function deleteDeveloperTestAccount(accountId: number, testAccountId: number, useV3?: boolean): HubSpotPromise<void>;
8
- export declare function fetchDeveloperTestAccountData(accessToken: string, accountId: number, env?: Environment): HubSpotPromise<DeveloperTestAccount>;
9
7
  export declare function installOauthAppIntoDeveloperTestAccount(accountId: number, testAccountId: number, projectName: string, appUId: string): HubSpotPromise<InstallOauthAppIntoDeveloperTestAccountResponse>;
10
8
  export declare function fetchDeveloperTestAccountOauthAppInstallStatus(accountId: number, projectName: string, appUId: string): HubSpotPromise<TestPortalStatusResponse>;
11
9
  export declare function fetchDeveloperTestAccountGateSyncStatus(accountId: number, testAccountId: number): HubSpotPromise<TestPortalStatusResponse>;
@@ -1,91 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateDeveloperTestAccountPersonalAccessKey = exports.fetchDeveloperTestAccountGateSyncStatus = exports.fetchDeveloperTestAccountOauthAppInstallStatus = exports.installOauthAppIntoDeveloperTestAccount = exports.fetchDeveloperTestAccountData = exports.deleteDeveloperTestAccount = exports.createDeveloperTestAccount = exports.fetchDeveloperTestAccounts = void 0;
4
- const client_1 = require("../http/client");
5
- const http_1 = require("../http");
6
- const getAxiosConfig_1 = require("../http/getAxiosConfig");
7
- const environments_1 = require("../constants/environments");
8
- const api_1 = require("../constants/api");
1
+ import { http } from '../http/index.js';
2
+ import { SANDBOX_TIMEOUT } from '../constants/api.js';
9
3
  const TEST_ACCOUNTS_API_PATH = 'integrators/test-portals/v2';
10
4
  const TEST_ACCOUNTS_API_PATH_V3 = 'integrators/test-portals/v3';
11
- function fetchDeveloperTestAccounts(accountId) {
12
- return http_1.http.get(accountId, {
5
+ export function fetchDeveloperTestAccounts(accountId) {
6
+ return http.get(accountId, {
13
7
  url: TEST_ACCOUNTS_API_PATH,
14
8
  });
15
9
  }
16
- exports.fetchDeveloperTestAccounts = fetchDeveloperTestAccounts;
17
- function createDeveloperTestAccount(accountId, accountInfo) {
10
+ export function createDeveloperTestAccount(accountId, accountInfo) {
18
11
  if (typeof accountInfo === 'object') {
19
- return http_1.http.post(accountId, {
12
+ return http.post(accountId, {
20
13
  url: TEST_ACCOUNTS_API_PATH_V3,
21
14
  data: accountInfo,
22
- timeout: api_1.SANDBOX_TIMEOUT,
15
+ timeout: SANDBOX_TIMEOUT,
23
16
  });
24
17
  }
25
- return http_1.http.post(accountId, {
18
+ return http.post(accountId, {
26
19
  url: TEST_ACCOUNTS_API_PATH,
27
- data: { accountName: accountInfo, generatePersonalAccessKey: true },
28
- timeout: api_1.SANDBOX_TIMEOUT,
20
+ data: { accountName: accountInfo, generatePersonalAccessKey: true }, // For CLI, generatePersonalAccessKey will always be true since we'll be saving the entry to the config
21
+ timeout: SANDBOX_TIMEOUT,
29
22
  });
30
23
  }
31
- exports.createDeveloperTestAccount = createDeveloperTestAccount;
32
- function deleteDeveloperTestAccount(accountId, testAccountId, useV3 = false) {
24
+ export function deleteDeveloperTestAccount(accountId, testAccountId, useV3 = false) {
33
25
  if (useV3) {
34
- return http_1.http.delete(accountId, {
26
+ return http.delete(accountId, {
35
27
  url: `${TEST_ACCOUNTS_API_PATH_V3}/${testAccountId}`,
36
28
  });
37
29
  }
38
- return http_1.http.delete(accountId, {
30
+ return http.delete(accountId, {
39
31
  url: `${TEST_ACCOUNTS_API_PATH}/${testAccountId}`,
40
32
  });
41
33
  }
42
- exports.deleteDeveloperTestAccount = deleteDeveloperTestAccount;
43
- function fetchDeveloperTestAccountData(accessToken, accountId, env = environments_1.ENVIRONMENTS.PROD) {
44
- const axiosConfig = (0, getAxiosConfig_1.getAxiosConfig)({
45
- env,
46
- url: `${TEST_ACCOUNTS_API_PATH}/self`,
47
- params: { portalId: accountId },
48
- });
49
- const reqWithToken = {
50
- ...axiosConfig,
51
- headers: {
52
- ...axiosConfig.headers,
53
- Authorization: `Bearer ${accessToken}`,
54
- },
55
- };
56
- return (0, client_1.httpClient)(reqWithToken);
57
- }
58
- exports.fetchDeveloperTestAccountData = fetchDeveloperTestAccountData;
59
- function installOauthAppIntoDeveloperTestAccount(accountId, testAccountId, projectName, appUId) {
60
- return http_1.http.post(accountId, {
34
+ export function installOauthAppIntoDeveloperTestAccount(accountId, testAccountId, projectName, appUId) {
35
+ return http.post(accountId, {
61
36
  url: `${TEST_ACCOUNTS_API_PATH_V3}/install-apps`,
62
37
  data: {
63
38
  testPortalId: testAccountId,
64
39
  developerQualifiedSymbol: { developerSymbol: appUId, projectName },
65
40
  },
66
- timeout: api_1.SANDBOX_TIMEOUT,
41
+ timeout: SANDBOX_TIMEOUT,
67
42
  });
68
43
  }
69
- exports.installOauthAppIntoDeveloperTestAccount = installOauthAppIntoDeveloperTestAccount;
70
- function fetchDeveloperTestAccountOauthAppInstallStatus(accountId, projectName, appUId) {
71
- return http_1.http.post(accountId, {
44
+ export function fetchDeveloperTestAccountOauthAppInstallStatus(accountId, projectName, appUId) {
45
+ return http.post(accountId, {
72
46
  url: `${TEST_ACCOUNTS_API_PATH_V3}/install-apps/readiness`,
73
47
  data: {
74
48
  developerQualifiedSymbol: { developerSymbol: appUId, projectName },
75
49
  },
76
- timeout: api_1.SANDBOX_TIMEOUT,
50
+ timeout: SANDBOX_TIMEOUT,
77
51
  });
78
52
  }
79
- exports.fetchDeveloperTestAccountOauthAppInstallStatus = fetchDeveloperTestAccountOauthAppInstallStatus;
80
- function fetchDeveloperTestAccountGateSyncStatus(accountId, testAccountId) {
81
- return http_1.http.get(accountId, {
53
+ export function fetchDeveloperTestAccountGateSyncStatus(accountId, testAccountId) {
54
+ return http.get(accountId, {
82
55
  url: `${TEST_ACCOUNTS_API_PATH_V3}/gate-sync-status/${testAccountId}`,
83
56
  });
84
57
  }
85
- exports.fetchDeveloperTestAccountGateSyncStatus = fetchDeveloperTestAccountGateSyncStatus;
86
- function generateDeveloperTestAccountPersonalAccessKey(accountId, testAccountId) {
87
- return http_1.http.get(accountId, {
58
+ export function generateDeveloperTestAccountPersonalAccessKey(accountId, testAccountId) {
59
+ return http.get(accountId, {
88
60
  url: `${TEST_ACCOUNTS_API_PATH_V3}/generate-pak/${testAccountId}`,
89
61
  });
90
62
  }
91
- exports.generateDeveloperTestAccountPersonalAccessKey = generateDeveloperTestAccountPersonalAccessKey;
@@ -1,5 +1,5 @@
1
- import { HubSpotPromise } from '../types/Http';
2
- import { FetchStatResponse, FetchFilesResponse, FetchFolderResponse, UploadResponse } from '../types/FileManager';
1
+ import { HubSpotPromise } from '../types/Http.js';
2
+ import { FetchStatResponse, FetchFilesResponse, FetchFolderResponse, UploadResponse } from '../types/FileManager.js';
3
3
  export declare function uploadFile(accountId: number, src: string, dest: string): HubSpotPromise<UploadResponse>;
4
4
  export declare function fetchStat(accountId: number, src: string): HubSpotPromise<FetchStatResponse>;
5
5
  export declare function fetchFiles(accountId: number, folderId: number | 'None', offset: number, archived?: boolean): HubSpotPromise<FetchFilesResponse>;
@@ -1,19 +1,13 @@
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.fetchFolders = exports.fetchFiles = exports.fetchStat = exports.uploadFile = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const http_1 = require("../http");
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { http } from '../http/index.js';
10
4
  const FILE_MANAGER_V2_API_PATH = 'filemanager/api/v2';
11
5
  const FILE_MANAGER_V3_API_PATH = 'filemanager/api/v3';
12
- function uploadFile(accountId, src, dest) {
13
- const directory = path_1.default.dirname(dest);
14
- const filename = path_1.default.basename(dest);
6
+ export function uploadFile(accountId, src, dest) {
7
+ const directory = path.dirname(dest);
8
+ const filename = path.basename(dest);
15
9
  const formData = {
16
- file: fs_1.default.createReadStream(src),
10
+ file: fs.createReadStream(src),
17
11
  fileName: filename,
18
12
  options: JSON.stringify({
19
13
  access: 'PUBLIC_INDEXABLE',
@@ -26,21 +20,19 @@ function uploadFile(accountId, src, dest) {
26
20
  else {
27
21
  formData.folderPath = '/';
28
22
  }
29
- return http_1.http.post(accountId, {
23
+ return http.post(accountId, {
30
24
  url: `${FILE_MANAGER_V3_API_PATH}/files/upload`,
31
25
  data: formData,
32
26
  headers: { 'Content-Type': 'multipart/form-data' },
33
27
  });
34
28
  }
35
- exports.uploadFile = uploadFile;
36
- function fetchStat(accountId, src) {
37
- return http_1.http.get(accountId, {
29
+ export function fetchStat(accountId, src) {
30
+ return http.get(accountId, {
38
31
  url: `${FILE_MANAGER_V2_API_PATH}/files/stat/${src}`,
39
32
  });
40
33
  }
41
- exports.fetchStat = fetchStat;
42
- function fetchFiles(accountId, folderId, offset, archived) {
43
- return http_1.http.get(accountId, {
34
+ export function fetchFiles(accountId, folderId, offset, archived) {
35
+ return http.get(accountId, {
44
36
  url: `${FILE_MANAGER_V2_API_PATH}/files/`,
45
37
  params: {
46
38
  hidden: 0,
@@ -50,9 +42,8 @@ function fetchFiles(accountId, folderId, offset, archived) {
50
42
  },
51
43
  });
52
44
  }
53
- exports.fetchFiles = fetchFiles;
54
- function fetchFolders(accountId, folderId) {
55
- return http_1.http.get(accountId, {
45
+ export function fetchFolders(accountId, folderId) {
46
+ return http.get(accountId, {
56
47
  url: `${FILE_MANAGER_V2_API_PATH}/folders/`,
57
48
  params: {
58
49
  hidden: 0,
@@ -60,4 +51,3 @@ function fetchFolders(accountId, folderId) {
60
51
  },
61
52
  });
62
53
  }
63
- exports.fetchFolders = fetchFolders;
@@ -1,7 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { FileMapperNode, FileMapperOptions, FileTree } from '../types/Files';
3
- import { HubSpotPromise } from '../types/Http';
4
- export declare const FILE_MAPPER_API_PATH = "content/filemapper/v1";
2
+ import { FileMapperNode, FileMapperOptions, FileTree } from '../types/Files.js';
3
+ import { HubSpotPromise } from '../types/Http.js';
5
4
  export declare function createFileMapperNodeFromStreamResponse(filePath: string, response: Partial<AxiosResponse>): FileMapperNode;
6
5
  export declare function upload(accountId: number, src: string, dest: string, options?: FileMapperOptions): HubSpotPromise<void>;
7
6
  export declare function fetchModule(accountId: number, moduleId: number, options?: FileMapperOptions): HubSpotPromise<FileTree>;