@hubspot/local-dev-lib 0.2.1 → 0.2.2-experimental.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 (189) hide show
  1. package/LICENSE +12 -0
  2. package/README.md +17 -0
  3. package/api/appsDev.d.ts +6 -0
  4. package/api/appsDev.js +29 -0
  5. package/api/customObjects.d.ts +8 -7
  6. package/api/customObjects.js +13 -16
  7. package/api/designManager.d.ts +4 -13
  8. package/api/designManager.js +6 -9
  9. package/api/developerTestAccounts.d.ts +7 -0
  10. package/api/developerTestAccounts.js +48 -0
  11. package/api/fileManager.d.ts +5 -4
  12. package/api/fileManager.js +11 -11
  13. package/api/fileMapper.d.ts +8 -7
  14. package/api/fileMapper.js +17 -17
  15. package/api/fileTransport.d.ts +4 -0
  16. package/api/fileTransport.js +39 -0
  17. package/api/functions.d.ts +7 -4
  18. package/api/functions.js +22 -11
  19. package/api/github.d.ts +7 -9
  20. package/api/github.js +31 -13
  21. package/api/hubdb.d.ts +11 -10
  22. package/api/hubdb.js +28 -22
  23. package/api/lighthouseScore.d.ts +4 -4
  24. package/api/lighthouseScore.js +9 -12
  25. package/api/localDevAuth.d.ts +8 -16
  26. package/api/localDevAuth.js +34 -13
  27. package/api/marketplaceValidation.d.ts +4 -4
  28. package/api/marketplaceValidation.js +8 -11
  29. package/api/projects.d.ts +31 -24
  30. package/api/projects.js +164 -44
  31. package/api/sandboxHubs.d.ts +6 -4
  32. package/api/sandboxHubs.js +10 -11
  33. package/api/sandboxSync.d.ts +4 -4
  34. package/api/sandboxSync.js +4 -13
  35. package/api/secrets.d.ts +6 -8
  36. package/api/secrets.js +9 -12
  37. package/api/validateHubl.d.ts +2 -1
  38. package/api/validateHubl.js +3 -6
  39. package/config/CLIConfiguration.d.ts +15 -11
  40. package/config/CLIConfiguration.js +175 -90
  41. package/config/configFile.js +13 -21
  42. package/config/configUtils.d.ts +2 -21
  43. package/config/configUtils.js +5 -4
  44. package/config/config_DEPRECATED.d.ts +6 -8
  45. package/config/config_DEPRECATED.js +79 -25
  46. package/config/environment.js +5 -4
  47. package/config/getAccountIdentifier.d.ts +2 -0
  48. package/config/getAccountIdentifier.js +15 -0
  49. package/config/index.d.ts +13 -8
  50. package/config/index.js +97 -57
  51. package/config/migrate.d.ts +20 -0
  52. package/config/migrate.js +150 -0
  53. package/constants/config.d.ts +25 -1
  54. package/constants/config.js +32 -3
  55. package/constants/environments.d.ts +1 -0
  56. package/constants/environments.js +1 -0
  57. package/constants/extensions.d.ts +2 -0
  58. package/constants/extensions.js +3 -1
  59. package/constants/files.d.ts +2 -2
  60. package/constants/files.js +3 -3
  61. package/errors/errors_DEPRECATED.d.ts +1 -5
  62. package/errors/errors_DEPRECATED.js +2 -2
  63. package/errors/index.d.ts +18 -0
  64. package/errors/index.js +63 -0
  65. package/http/addQueryParams.d.ts +2 -0
  66. package/http/addQueryParams.js +14 -0
  67. package/http/getAxiosConfig.d.ts +6 -3
  68. package/http/getAxiosConfig.js +51 -7
  69. package/http/index.d.ts +11 -12
  70. package/http/index.js +35 -41
  71. package/http/unauthed.d.ts +14 -0
  72. package/http/unauthed.js +38 -0
  73. package/lang/en.json +384 -386
  74. package/lib/archive.d.ts +2 -8
  75. package/lib/archive.js +34 -30
  76. package/lib/cms/functions.d.ts +7 -12
  77. package/lib/cms/functions.js +49 -51
  78. package/lib/cms/handleFieldsJS.js +16 -14
  79. package/lib/cms/modules.d.ts +4 -15
  80. package/lib/cms/modules.js +81 -78
  81. package/lib/cms/processFieldsJs.js +10 -33
  82. package/lib/cms/templates.d.ts +43 -3
  83. package/lib/cms/templates.js +53 -11
  84. package/lib/cms/uploadFolder.d.ts +3 -14
  85. package/lib/cms/uploadFolder.js +58 -42
  86. package/lib/cms/validate.js +1 -1
  87. package/lib/cms/watch.d.ts +2 -18
  88. package/lib/cms/watch.js +63 -68
  89. package/lib/customObjects.js +4 -15
  90. package/lib/fileManager.d.ts +2 -6
  91. package/lib/fileManager.js +54 -65
  92. package/lib/fileMapper.d.ts +4 -15
  93. package/lib/fileMapper.js +67 -88
  94. package/lib/fs.d.ts +1 -1
  95. package/lib/fs.js +10 -6
  96. package/lib/github.d.ts +12 -14
  97. package/lib/github.js +70 -35
  98. package/lib/gitignore.d.ts +2 -0
  99. package/lib/gitignore.js +21 -4
  100. package/lib/hubdb.d.ts +3 -2
  101. package/lib/hubdb.js +11 -9
  102. package/{utils → lib}/notify.js +2 -2
  103. package/lib/oauth.d.ts +2 -5
  104. package/lib/oauth.js +14 -25
  105. package/lib/path.d.ts +3 -0
  106. package/lib/path.js +46 -1
  107. package/lib/personalAccessKey.d.ts +8 -11
  108. package/lib/personalAccessKey.js +76 -38
  109. package/lib/portManager.d.ts +3 -5
  110. package/lib/portManager.js +18 -6
  111. package/lib/trackUsage.js +18 -11
  112. package/lib/urls.js +5 -1
  113. package/models/FileSystemError.d.ts +6 -0
  114. package/models/FileSystemError.js +47 -0
  115. package/models/HubSpotHttpError.d.ts +24 -0
  116. package/models/HubSpotHttpError.js +197 -0
  117. package/models/OAuth2Manager.d.ts +5 -27
  118. package/models/OAuth2Manager.js +41 -64
  119. package/package.json +35 -35
  120. package/types/Accounts.d.ts +103 -3
  121. package/types/Apps.d.ts +77 -0
  122. package/types/Archive.d.ts +9 -0
  123. package/types/Archive.js +2 -0
  124. package/types/Build.d.ts +4 -2
  125. package/types/ComponentStructure.d.ts +30 -10
  126. package/types/Config.d.ts +19 -2
  127. package/types/Deploy.d.ts +3 -2
  128. package/types/DesignManager.d.ts +10 -0
  129. package/types/DesignManager.js +2 -0
  130. package/types/Error.d.ts +9 -5
  131. package/types/FieldsJS.d.ts +1 -0
  132. package/types/FieldsJS.js +2 -0
  133. package/types/FileManager.d.ts +1 -1
  134. package/types/Files.d.ts +43 -4
  135. package/types/Functions.d.ts +52 -0
  136. package/types/Github.d.ts +13 -0
  137. package/types/Http.d.ts +12 -11
  138. package/types/Hubdb.d.ts +9 -0
  139. package/types/MarketplaceValidation.d.ts +7 -3
  140. package/types/Migration.d.ts +28 -0
  141. package/types/Migration.js +10 -0
  142. package/types/Modules.d.ts +11 -0
  143. package/types/PortManager.d.ts +7 -0
  144. package/types/Project.d.ts +30 -0
  145. package/types/ProjectLog.d.ts +9 -0
  146. package/types/ProjectLog.js +2 -0
  147. package/types/Sandbox.d.ts +37 -47
  148. package/types/Schemas.d.ts +56 -0
  149. package/types/Secrets.d.ts +3 -0
  150. package/types/Secrets.js +2 -0
  151. package/types/developerTestAccounts.d.ts +13 -0
  152. package/types/developerTestAccounts.js +2 -0
  153. package/utils/PortManagerServer.d.ts +6 -7
  154. package/utils/PortManagerServer.js +22 -16
  155. package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
  156. package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
  157. package/utils/cms/fieldsJS.d.ts +1 -2
  158. package/utils/cms/modules.js +2 -2
  159. package/utils/detectPort.js +3 -3
  160. package/utils/git.d.ts +1 -7
  161. package/utils/git.js +2 -18
  162. package/errors/apiErrors.d.ts +0 -19
  163. package/errors/apiErrors.js +0 -179
  164. package/errors/fileSystemErrors.d.ts +0 -5
  165. package/errors/fileSystemErrors.js +0 -31
  166. package/errors/standardErrors.d.ts +0 -27
  167. package/errors/standardErrors.js +0 -59
  168. package/lang/lang/en.json +0 -401
  169. package/lib/logging/git.d.ts +0 -2
  170. package/lib/logging/git.js +0 -54
  171. package/lib/logging/logs.d.ts +0 -22
  172. package/lib/logging/logs.js +0 -86
  173. package/lib/logging/table.d.ts +0 -3
  174. package/lib/logging/table.js +0 -47
  175. package/lib/sandboxes.d.ts +0 -14
  176. package/lib/sandboxes.js +0 -71
  177. package/models/HubSpotAuthError.d.ts +0 -12
  178. package/models/HubSpotAuthError.js +0 -20
  179. package/types/LogCallbacks.d.ts +0 -7
  180. package/utils/logger.d.ts +0 -5
  181. package/utils/logger.js +0 -23
  182. package/utils/objectUtils.d.ts +0 -8
  183. package/utils/objectUtils.js +0 -33
  184. /package/{utils → lib}/escapeRegExp.d.ts +0 -0
  185. /package/{utils → lib}/escapeRegExp.js +0 -0
  186. /package/lib/{logging/logger.d.ts → logger.d.ts} +0 -0
  187. /package/lib/{logging/logger.js → logger.js} +0 -0
  188. /package/{utils → lib}/notify.d.ts +0 -0
  189. /package/types/{LogCallbacks.js → Apps.js} +0 -0
package/lib/sandboxes.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTypes = exports.fetchTaskStatus = exports.initiateSync = exports.getSandboxUsageLimits = exports.deleteSandbox = exports.createSandbox = void 0;
4
- const sandboxHubs_1 = require("../api/sandboxHubs");
5
- const sandboxSync_1 = require("../api/sandboxSync");
6
- const standardErrors_1 = require("../errors/standardErrors");
7
- const i18nKey = 'lib.sandboxes';
8
- async function createSandbox(accountId, name, type) {
9
- try {
10
- const resp = await (0, sandboxHubs_1.createSandbox)(accountId, name, type);
11
- return {
12
- name,
13
- ...resp,
14
- };
15
- }
16
- catch (err) {
17
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.createSandbox`, {}, err);
18
- }
19
- }
20
- exports.createSandbox = createSandbox;
21
- async function deleteSandbox(parentAccountId, sandboxAccountId) {
22
- try {
23
- await (0, sandboxHubs_1.deleteSandbox)(parentAccountId, sandboxAccountId);
24
- }
25
- catch (err) {
26
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.deleteSandbox`, {}, err);
27
- }
28
- return {
29
- parentAccountId,
30
- sandboxAccountId,
31
- };
32
- }
33
- exports.deleteSandbox = deleteSandbox;
34
- async function getSandboxUsageLimits(parentAccountId) {
35
- try {
36
- const resp = await (0, sandboxHubs_1.getSandboxUsageLimits)(parentAccountId);
37
- return resp && resp.usage;
38
- }
39
- catch (err) {
40
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.getSandboxUsageLimits`, {}, err);
41
- }
42
- }
43
- exports.getSandboxUsageLimits = getSandboxUsageLimits;
44
- async function initiateSync(fromHubId, toHubId, tasks, sandboxHubId) {
45
- try {
46
- return await (0, sandboxSync_1.initiateSync)(fromHubId, toHubId, tasks, sandboxHubId);
47
- }
48
- catch (err) {
49
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.initiateSync`, {}, err);
50
- }
51
- }
52
- exports.initiateSync = initiateSync;
53
- async function fetchTaskStatus(accountId, taskId) {
54
- try {
55
- return await (0, sandboxSync_1.fetchTaskStatus)(accountId, taskId);
56
- }
57
- catch (err) {
58
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.fetchTaskStatus`, {}, err);
59
- }
60
- }
61
- exports.fetchTaskStatus = fetchTaskStatus;
62
- async function fetchTypes(accountId, toHubId) {
63
- try {
64
- const resp = await (0, sandboxSync_1.fetchTypes)(accountId, toHubId);
65
- return resp && resp.results;
66
- }
67
- catch (err) {
68
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.fetchTypes`, {}, err);
69
- }
70
- }
71
- exports.fetchTypes = fetchTypes;
@@ -1,12 +0,0 @@
1
- import { AxiosError } from 'axios';
2
- export declare class HubSpotAuthError extends Error {
3
- status?: number;
4
- category?: string;
5
- subCategory?: string;
6
- constructor(message: string, { cause, }: {
7
- cause?: Partial<AxiosError<{
8
- category?: string;
9
- subCategory?: string;
10
- }>>;
11
- });
12
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubSpotAuthError = void 0;
4
- class HubSpotAuthError extends Error {
5
- status;
6
- category;
7
- subCategory;
8
- constructor(message, { cause = {}, }) {
9
- super(message);
10
- this.name = 'HubSpotAuthError';
11
- this.status = cause.response?.status;
12
- this.category = cause?.response?.data?.category || undefined;
13
- this.subCategory =
14
- (cause.response &&
15
- cause.response.data &&
16
- cause.response.data.subCategory) ||
17
- undefined;
18
- }
19
- }
20
- exports.HubSpotAuthError = HubSpotAuthError;
@@ -1,7 +0,0 @@
1
- import { InterpolationData } from './Lang';
2
- export type LogCallbacks<T extends string> = {
3
- [key in T]?: (interpolationData?: InterpolationData) => void;
4
- };
5
- export type LogCallbacksArg<T extends readonly string[]> = {
6
- [key in T[number]]?: () => void;
7
- };
package/utils/logger.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { LogCallbacks } from '../types/LogCallbacks';
2
- import { InterpolationData, LangKey } from '../types/Lang';
3
- export declare function log<T extends string>(key: T, callbacks?: LogCallbacks<T>, debugKey?: LangKey, interpolationData?: InterpolationData): void;
4
- export declare function makeTypedLogger<T extends readonly string[]>(callbacks?: LogCallbacks<T[number]>): (key: T[number], debugKey?: LangKey, interpolationData?: InterpolationData) => void;
5
- export declare function debug(identifier: LangKey, interpolationData?: InterpolationData): void;
package/utils/logger.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debug = exports.makeTypedLogger = exports.log = void 0;
4
- const lang_1 = require("./lang");
5
- const logger_1 = require("../lib/logging/logger");
6
- function log(key, callbacks, debugKey, interpolationData) {
7
- if (callbacks && callbacks[key]) {
8
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9
- callbacks[key](interpolationData);
10
- }
11
- else if (debugKey) {
12
- debug(debugKey, interpolationData);
13
- }
14
- }
15
- exports.log = log;
16
- function makeTypedLogger(callbacks) {
17
- return (key, debugKey, interpolationData) => log(key, callbacks, debugKey, interpolationData);
18
- }
19
- exports.makeTypedLogger = makeTypedLogger;
20
- function debug(identifier, interpolationData) {
21
- logger_1.logger.debug((0, lang_1.i18n)(identifier, interpolationData));
22
- }
23
- exports.debug = debug;
@@ -1,8 +0,0 @@
1
- export declare function isObject(item: any): any;
2
- export declare function mergeDeep(target: {
3
- [key: string]: any;
4
- }, ...sources: Array<{
5
- [key: string]: any;
6
- }>): {
7
- [key: string]: any;
8
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeDeep = exports.isObject = void 0;
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
- function isObject(item) {
6
- return item && typeof item === 'object' && !Array.isArray(item);
7
- }
8
- exports.isObject = isObject;
9
- function mergeDeep(
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- target,
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- ...sources
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- ) {
16
- if (!sources.length)
17
- return target;
18
- const source = sources.shift();
19
- if (isObject(target) && source && isObject(source)) {
20
- for (const key in source) {
21
- if (isObject(source[key])) {
22
- if (!target[key])
23
- Object.assign(target, { [key]: {} });
24
- mergeDeep(target[key], source[key]);
25
- }
26
- else {
27
- Object.assign(target, { [key]: source[key] });
28
- }
29
- }
30
- }
31
- return mergeDeep(target, ...sources);
32
- }
33
- exports.mergeDeep = mergeDeep;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes