@hubspot/local-dev-lib 0.1.0 → 0.1.1-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 (191) 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 +6 -5
  12. package/api/fileManager.js +13 -12
  13. package/api/fileMapper.d.ts +8 -7
  14. package/api/fileMapper.js +19 -18
  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 +7 -15
  26. package/api/localDevAuth.js +28 -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 +166 -45
  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 +13 -10
  40. package/config/CLIConfiguration.js +129 -77
  41. package/config/configFile.js +12 -18
  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 +10 -7
  50. package/config/index.js +83 -55
  51. package/constants/config.d.ts +15 -1
  52. package/constants/config.js +17 -3
  53. package/constants/environments.d.ts +1 -0
  54. package/constants/environments.js +1 -0
  55. package/constants/extensions.d.ts +2 -0
  56. package/constants/extensions.js +3 -1
  57. package/constants/files.d.ts +2 -2
  58. package/constants/files.js +3 -3
  59. package/errors/errors_DEPRECATED.d.ts +1 -5
  60. package/errors/errors_DEPRECATED.js +2 -2
  61. package/errors/index.d.ts +18 -0
  62. package/errors/index.js +63 -0
  63. package/http/addQueryParams.d.ts +2 -0
  64. package/http/addQueryParams.js +14 -0
  65. package/http/getAxiosConfig.d.ts +6 -3
  66. package/http/getAxiosConfig.js +51 -7
  67. package/http/index.d.ts +11 -12
  68. package/http/index.js +35 -41
  69. package/http/unauthed.d.ts +14 -0
  70. package/http/unauthed.js +38 -0
  71. package/lang/en.json +374 -368
  72. package/lib/archive.d.ts +2 -8
  73. package/lib/archive.js +34 -30
  74. package/lib/cms/functions.d.ts +7 -12
  75. package/lib/cms/functions.js +49 -51
  76. package/lib/cms/handleFieldsJS.js +16 -14
  77. package/lib/cms/modules.d.ts +5 -15
  78. package/lib/cms/modules.js +116 -42
  79. package/lib/cms/processFieldsJs.js +10 -33
  80. package/lib/cms/templates.d.ts +43 -3
  81. package/lib/cms/templates.js +53 -11
  82. package/lib/cms/uploadFolder.d.ts +3 -14
  83. package/lib/cms/uploadFolder.js +58 -42
  84. package/lib/cms/validate.js +1 -1
  85. package/lib/cms/watch.d.ts +2 -18
  86. package/lib/cms/watch.js +63 -68
  87. package/lib/customObjects.js +4 -15
  88. package/lib/fileManager.d.ts +2 -0
  89. package/lib/fileManager.js +184 -0
  90. package/lib/fileMapper.d.ts +4 -15
  91. package/lib/fileMapper.js +68 -82
  92. package/lib/fs.d.ts +1 -1
  93. package/lib/fs.js +10 -6
  94. package/lib/github.d.ts +9 -14
  95. package/lib/github.js +61 -29
  96. package/lib/gitignore.d.ts +2 -0
  97. package/lib/gitignore.js +21 -4
  98. package/lib/hubdb.d.ts +3 -2
  99. package/lib/hubdb.js +11 -9
  100. package/lib/{logging/logger.d.ts → logger.d.ts} +20 -8
  101. package/{utils → lib}/notify.js +2 -2
  102. package/lib/oauth.d.ts +2 -5
  103. package/lib/oauth.js +14 -25
  104. package/lib/path.d.ts +3 -0
  105. package/lib/path.js +46 -1
  106. package/lib/personalAccessKey.d.ts +7 -10
  107. package/lib/personalAccessKey.js +74 -47
  108. package/lib/portManager.d.ts +3 -5
  109. package/lib/portManager.js +18 -6
  110. package/lib/text.d.ts +1 -0
  111. package/lib/text.js +9 -1
  112. package/lib/trackUsage.js +18 -11
  113. package/lib/urls.js +5 -1
  114. package/models/FileSystemError.d.ts +6 -0
  115. package/models/FileSystemError.js +47 -0
  116. package/models/HubSpotHttpError.d.ts +24 -0
  117. package/models/HubSpotHttpError.js +197 -0
  118. package/models/OAuth2Manager.d.ts +5 -27
  119. package/models/OAuth2Manager.js +41 -64
  120. package/package.json +19 -18
  121. package/types/Accounts.d.ts +90 -3
  122. package/types/Apps.d.ts +77 -0
  123. package/types/Archive.d.ts +9 -0
  124. package/types/Archive.js +2 -0
  125. package/types/Build.d.ts +4 -2
  126. package/types/ComponentStructure.d.ts +30 -10
  127. package/types/Config.d.ts +19 -2
  128. package/types/Deploy.d.ts +3 -2
  129. package/types/DesignManager.d.ts +10 -0
  130. package/types/DesignManager.js +2 -0
  131. package/types/Error.d.ts +11 -6
  132. package/types/FieldsJS.d.ts +1 -0
  133. package/types/FieldsJS.js +2 -0
  134. package/types/FileManager.d.ts +12 -7
  135. package/types/Files.d.ts +43 -4
  136. package/types/Functions.d.ts +52 -0
  137. package/types/Github.d.ts +12 -0
  138. package/types/Http.d.ts +12 -12
  139. package/types/Hubdb.d.ts +9 -0
  140. package/types/Lang.d.ts +3 -0
  141. package/types/MarketplaceValidation.d.ts +7 -3
  142. package/types/Migration.d.ts +28 -0
  143. package/types/Migration.js +10 -0
  144. package/types/Modules.d.ts +11 -0
  145. package/types/PortManager.d.ts +7 -0
  146. package/types/Project.d.ts +30 -0
  147. package/types/ProjectLog.d.ts +9 -0
  148. package/types/ProjectLog.js +2 -0
  149. package/types/Sandbox.d.ts +37 -47
  150. package/types/Schemas.d.ts +12 -0
  151. package/types/Secrets.d.ts +3 -0
  152. package/types/Secrets.js +2 -0
  153. package/types/developerTestAccounts.d.ts +13 -0
  154. package/types/developerTestAccounts.js +2 -0
  155. package/utils/PortManagerServer.d.ts +6 -7
  156. package/utils/PortManagerServer.js +22 -16
  157. package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
  158. package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
  159. package/utils/cms/fieldsJS.d.ts +1 -2
  160. package/utils/cms/modules.js +2 -2
  161. package/utils/detectPort.js +3 -3
  162. package/utils/git.d.ts +1 -7
  163. package/utils/git.js +2 -18
  164. package/utils/lang.d.ts +1 -5
  165. package/errors/apiErrors.d.ts +0 -19
  166. package/errors/apiErrors.js +0 -179
  167. package/errors/fileSystemErrors.d.ts +0 -5
  168. package/errors/fileSystemErrors.js +0 -31
  169. package/errors/standardErrors.d.ts +0 -27
  170. package/errors/standardErrors.js +0 -59
  171. package/lang/lang/en.json +0 -383
  172. package/lib/logging/git.d.ts +0 -2
  173. package/lib/logging/git.js +0 -54
  174. package/lib/logging/logs.d.ts +0 -22
  175. package/lib/logging/logs.js +0 -86
  176. package/lib/logging/table.d.ts +0 -3
  177. package/lib/logging/table.js +0 -47
  178. package/lib/sandboxes.d.ts +0 -14
  179. package/lib/sandboxes.js +0 -71
  180. package/models/HubSpotAuthError.d.ts +0 -12
  181. package/models/HubSpotAuthError.js +0 -20
  182. package/types/LogCallbacks.d.ts +0 -6
  183. package/utils/logger.d.ts +0 -11
  184. package/utils/logger.js +0 -23
  185. package/utils/objectUtils.d.ts +0 -8
  186. package/utils/objectUtils.js +0 -33
  187. /package/{utils → lib}/escapeRegExp.d.ts +0 -0
  188. /package/{utils → lib}/escapeRegExp.js +0 -0
  189. /package/lib/{logging/logger.js → logger.js} +0 -0
  190. /package/{utils → lib}/notify.d.ts +0 -0
  191. /package/types/{LogCallbacks.js → Apps.js} +0 -0
@@ -1,14 +1,19 @@
1
- import { Mode } from './Files';
1
+ import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
2
+ import { CmsPublishMode } from './Files';
2
3
  import { Environment } from './Config';
4
+ import { ValueOf } from './Utils';
3
5
  export type AuthType = 'personalaccesskey' | 'apikey' | 'oauth2';
4
6
  export interface CLIAccount_NEW {
5
7
  name?: string;
6
8
  accountId: number;
7
- defaultMode?: Mode;
9
+ accountType?: AccountType;
10
+ defaultCmsPublishMode?: CmsPublishMode;
8
11
  env: Environment;
9
12
  authType?: AuthType;
10
13
  auth?: {
11
14
  tokenInfo?: TokenInfo;
15
+ clientId?: string;
16
+ clientSecret?: string;
12
17
  };
13
18
  sandboxAccountType?: string | null;
14
19
  parentAccountId?: number | null;
@@ -18,11 +23,14 @@ export interface CLIAccount_NEW {
18
23
  export interface CLIAccount_DEPRECATED {
19
24
  name?: string;
20
25
  portalId?: number;
21
- defaultMode?: Mode;
26
+ defaultCmsPublishMode?: CmsPublishMode;
22
27
  env: Environment;
28
+ accountType?: AccountType;
23
29
  authType?: AuthType;
24
30
  auth?: {
25
31
  tokenInfo?: TokenInfo;
32
+ clientId?: string;
33
+ clientSecret?: string;
26
34
  };
27
35
  sandboxAccountType?: string | null;
28
36
  parentAccountId?: number | null;
@@ -30,6 +38,11 @@ export interface CLIAccount_DEPRECATED {
30
38
  personalAccessKey?: string;
31
39
  }
32
40
  export type CLIAccount = CLIAccount_NEW | CLIAccount_DEPRECATED;
41
+ export type GenericAccount = {
42
+ portalId?: number;
43
+ accountId?: number;
44
+ };
45
+ export type AccountType = ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
33
46
  export type TokenInfo = {
34
47
  accessToken?: string;
35
48
  expiresAt?: string;
@@ -93,3 +106,77 @@ export type ScopeData = {
93
106
  portalScopesInGroup: Array<string>;
94
107
  userScopesInGroup: Array<string>;
95
108
  };
109
+ export type AccessTokenResponse = {
110
+ hubId: number;
111
+ userId: number;
112
+ oauthAccessToken: string;
113
+ expiresAtMillis: number;
114
+ enabledFeatures?: {
115
+ [key: string]: number;
116
+ };
117
+ scopeGroups: Array<string>;
118
+ encodedOAuthRefreshToken: string;
119
+ hubName: string;
120
+ accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
121
+ };
122
+ export type EnabledFeaturesResponse = {
123
+ enabledFeatures: {
124
+ [key: string]: boolean;
125
+ };
126
+ };
127
+ export type UpdateAccountConfigOptions = Partial<FlatAccountFields_DEPRECATED> & {
128
+ environment?: Environment;
129
+ };
130
+ export type PersonalAccessKeyOptions = {
131
+ accountId: number;
132
+ personalAccessKey: string;
133
+ env: Environment;
134
+ };
135
+ export type OAuthOptions = {
136
+ accountId: number;
137
+ clientId: string;
138
+ clientSecret: string;
139
+ refreshToken: string;
140
+ scopes: Array<string>;
141
+ env: Environment;
142
+ };
143
+ export type APIKeyOptions = {
144
+ accountId: number;
145
+ apiKey: string;
146
+ env: Environment;
147
+ };
148
+ export type AccessToken = {
149
+ portalId: number;
150
+ accessToken: string;
151
+ expiresAt: string;
152
+ scopeGroups: Array<string>;
153
+ enabledFeatures?: {
154
+ [key: string]: number;
155
+ };
156
+ encodedOAuthRefreshToken: string;
157
+ hubName: string;
158
+ accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
159
+ };
160
+ export type OAuth2ManagerAccountConfig = {
161
+ name?: string;
162
+ accountId?: number;
163
+ clientId?: string;
164
+ clientSecret?: string;
165
+ scopes?: Array<string>;
166
+ env?: Environment;
167
+ environment?: Environment;
168
+ tokenInfo?: TokenInfo;
169
+ authType?: 'oauth2';
170
+ };
171
+ export type WriteTokenInfoFunction = (tokenInfo: TokenInfo) => void;
172
+ export type RefreshTokenResponse = {
173
+ refresh_token: string;
174
+ access_token: string;
175
+ expires_in: string;
176
+ };
177
+ export type ExchangeProof = {
178
+ grant_type: string;
179
+ client_id?: string;
180
+ client_secret?: string;
181
+ refresh_token?: string;
182
+ };
@@ -0,0 +1,77 @@
1
+ export type PublicAppInstallationData = {
2
+ appId: number;
3
+ isInstalledWithScopeGroups: boolean;
4
+ previouslyAuthorizedScopeGroups: Array<{
5
+ id: number;
6
+ name: string;
7
+ }>;
8
+ };
9
+ export type PublicAppDeveloperTestAccountInstallData = {
10
+ testPortalInstalls: Array<{
11
+ portalId: number;
12
+ accountName: string;
13
+ }>;
14
+ testPortalInstallCount: string;
15
+ };
16
+ export type PublicAppInstallCounts = {
17
+ uniquePortalInstallCount: number;
18
+ uniqueUserInstallCount: number;
19
+ uniqueBusinessUnitInstallCount: number;
20
+ };
21
+ export type PublicApp = {
22
+ id: number;
23
+ name: string;
24
+ description: string;
25
+ portalId: number;
26
+ updatedAt: number;
27
+ createdAt: number;
28
+ clientId: string;
29
+ iconUrl: string;
30
+ archived: boolean;
31
+ ownerId: number;
32
+ isUserLevel: boolean;
33
+ isBusinessUnitEnabled: boolean;
34
+ isFeatured: boolean;
35
+ isInternal: boolean;
36
+ documentationUrl: string | null;
37
+ supportUrl: string | null;
38
+ supportEmail: string | null;
39
+ supportPhone: string | null;
40
+ extensionIconUrl: string | null;
41
+ isAdvancedScopesSettingEnabled: boolean;
42
+ publicApplicationInstallCounts: PublicAppInstallCounts;
43
+ redirectUrls: Array<string>;
44
+ scopeGroupIds: Array<number>;
45
+ requiredScopeInfo?: Array<{
46
+ id: number;
47
+ name: string;
48
+ }>;
49
+ additionalScopeGroupIds: Array<number>;
50
+ additionalScopeInfo?: Array<{
51
+ id: number;
52
+ name: string;
53
+ }>;
54
+ optionalScopeGroupIds: Array<number>;
55
+ optionalScopeInfo?: Array<{
56
+ id: number;
57
+ name: string;
58
+ }>;
59
+ projectId: number | null;
60
+ sourceId: string | null;
61
+ providerInfo?: {
62
+ domain: string;
63
+ isVerified: boolean;
64
+ };
65
+ listingInfo?: {
66
+ listingUrl: string;
67
+ isCertified: boolean;
68
+ isPublished: boolean;
69
+ hasDraft: boolean;
70
+ inReview: boolean;
71
+ };
72
+ allowedExternalUrls: Array<string>;
73
+ preventProjectMigrations?: boolean;
74
+ };
75
+ export type FetchPublicAppsForPortalResponse = {
76
+ results: Array<PublicApp>;
77
+ };
@@ -0,0 +1,9 @@
1
+ export type ZipData = {
2
+ extractDir: string;
3
+ tmpDir: string;
4
+ };
5
+ export type CopySourceToDestOptions = {
6
+ sourceDir?: string;
7
+ includesRootDir?: boolean;
8
+ hideLogs?: boolean;
9
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types/Build.d.ts CHANGED
@@ -2,17 +2,18 @@ import { ValueOf } from './Utils';
2
2
  import { BUILD_STATUS, SUBBUILD_TYPES, DEPLOYABLE_STATES } from '../enums/build';
3
3
  import { ActivitySource } from './Activity';
4
4
  import { DeployStatusTaskLocator } from './Deploy';
5
- import { OptionalError } from './Error';
5
+ import { ProjectStandardError } from './Project';
6
6
  export type SubbuildStatus = {
7
7
  buildName: string;
8
8
  buildType: ValueOf<typeof SUBBUILD_TYPES>;
9
9
  errorMessage: string;
10
10
  finishedAt: string;
11
11
  rootPath: string;
12
- standardError?: OptionalError;
12
+ standardError: ProjectStandardError | null;
13
13
  startedAt: string;
14
14
  status: ValueOf<typeof BUILD_STATUS>;
15
15
  id: string;
16
+ visible: boolean;
16
17
  };
17
18
  export type Build = {
18
19
  activitySource: ActivitySource;
@@ -29,6 +30,7 @@ export type Build = {
29
30
  status: ValueOf<typeof BUILD_STATUS>;
30
31
  subbuildStatuses: Array<SubbuildStatus>;
31
32
  uploadMessage: string;
33
+ autoDeployId: number;
32
34
  };
33
35
  export type FetchProjectBuildsResponse = {
34
36
  results: Array<Build>;
@@ -6,15 +6,35 @@ export type ComponentStructure = {
6
6
  export type ComponentStructureResponse = {
7
7
  topLevelComponentsWithChildren: ComponentStructure;
8
8
  };
9
- export type ComponentMetadata = {
10
- componentIdentifier: string;
9
+ export type ProjectComponentsMetadata = {
10
+ topLevelComponentMetadata: TopLevelComponents[];
11
+ };
12
+ export interface ComponentMetadata<T> {
11
13
  componentName: string;
12
- componentType: ValueOf<typeof COMPONENT_TYPES> | ValueOf<typeof SUBCOMPONENT_TYPES>;
13
- metadata: {
14
- appId: string;
14
+ type: {
15
+ name: T;
15
16
  };
16
- parentComponentType: string;
17
- };
18
- export type ComponentMetadataResponse = {
19
- results: Array<ComponentMetadata>;
20
- };
17
+ deployOutput: unknown;
18
+ }
19
+ export interface TopLevelComponent extends ComponentMetadata<ValueOf<typeof COMPONENT_TYPES>> {
20
+ featureComponents: FeatureComponents[];
21
+ }
22
+ export interface PrivateAppComponentMetadata extends TopLevelComponent {
23
+ deployOutput: {
24
+ cardId: number;
25
+ appId: number;
26
+ };
27
+ }
28
+ export type TopLevelComponents = PrivateAppComponentMetadata | TopLevelComponent;
29
+ export interface FeatureComponent<T = unknown> extends ComponentMetadata<ValueOf<typeof SUBCOMPONENT_TYPES>> {
30
+ deployOutput: T;
31
+ }
32
+ export type AppFunctionComponentMetadata = FeatureComponent<{
33
+ appId: number;
34
+ appFunctionName: string;
35
+ endpoint?: {
36
+ path: string;
37
+ methods: string[];
38
+ };
39
+ }>;
40
+ export type FeatureComponents = FeatureComponent | AppFunctionComponentMetadata;
package/types/Config.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { ENVIRONMENTS } from '../constants/environments';
2
2
  import { CLIAccount_NEW, CLIAccount_DEPRECATED } from './Accounts';
3
+ import { CmsPublishMode } from './Files';
3
4
  import { ValueOf } from './Utils';
4
5
  export interface CLIConfig_NEW {
5
6
  accounts: Array<CLIAccount_NEW>;
6
7
  allowUsageTracking?: boolean;
7
8
  defaultAccount?: string | number;
8
- defaultMode?: string;
9
+ defaultMode?: CmsPublishMode;
10
+ defaultCmsPublishMode?: CmsPublishMode;
9
11
  httpTimeout?: number;
10
12
  env?: Environment;
11
13
  httpUseLocalhost?: boolean;
@@ -14,10 +16,25 @@ export interface CLIConfig_DEPRECATED {
14
16
  portals: Array<CLIAccount_DEPRECATED>;
15
17
  allowUsageTracking?: boolean;
16
18
  defaultPortal?: string | number;
17
- defaultMode?: string;
19
+ defaultMode?: CmsPublishMode;
20
+ defaultCmsPublishMode?: CmsPublishMode;
18
21
  httpTimeout?: number;
19
22
  env?: Environment;
20
23
  httpUseLocalhost?: boolean;
21
24
  }
22
25
  export type CLIConfig = CLIConfig_NEW | CLIConfig_DEPRECATED;
23
26
  export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
27
+ export type EnvironmentConfigVariables = {
28
+ apiKey?: string;
29
+ clientId?: string;
30
+ clientSecret?: string;
31
+ personalAccessKey?: string;
32
+ accountId?: number;
33
+ refreshToken?: string;
34
+ env?: Environment;
35
+ };
36
+ export type GitInclusionResult = {
37
+ inGit: boolean;
38
+ configIgnored: boolean;
39
+ gitignoreFiles: Array<string>;
40
+ };
package/types/Deploy.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ValueOf } from './Utils';
2
2
  import { ACTIVITY_SOURCE } from '../enums/project';
3
3
  import { DEPLOY_ACTION, DEPLOY_STATUS } from '../enums/deploy';
4
4
  import { COMPONENT_TYPES, SUBCOMPONENT_TYPES } from '../enums/build';
5
- import { OptionalError } from './Error';
5
+ import { ProjectStandardError } from './Project';
6
6
  export type DeployStatus = ValueOf<typeof DEPLOY_STATUS>;
7
7
  export type SubdeployStatus = {
8
8
  action: ValueOf<typeof DEPLOY_ACTION>;
@@ -10,10 +10,11 @@ export type SubdeployStatus = {
10
10
  deployType: ValueOf<typeof COMPONENT_TYPES> | ValueOf<typeof SUBCOMPONENT_TYPES>;
11
11
  errorMessage: string;
12
12
  finishedAt: string;
13
- standardError?: OptionalError;
13
+ standardError: ProjectStandardError | null;
14
14
  startedAt: string;
15
15
  status: DeployStatus;
16
16
  id: string;
17
+ visible: boolean;
17
18
  };
18
19
  export type Deploy = {
19
20
  buildId: number;
@@ -0,0 +1,10 @@
1
+ export type FetchThemesResponse = {
2
+ objects: Array<{
3
+ theme: {
4
+ path: string;
5
+ };
6
+ }>;
7
+ };
8
+ export type FetchBuiltinMappingResponse = {
9
+ [key: string]: string;
10
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types/Error.d.ts CHANGED
@@ -16,17 +16,22 @@ export interface ValidationError extends BaseError {
16
16
  errorTokens?: {
17
17
  line: number;
18
18
  };
19
+ context?: {
20
+ requiredScopes?: string[];
21
+ };
19
22
  }
20
23
  export type FileSystemErrorContext = {
21
- filepath: string;
22
- write?: boolean;
23
- read?: boolean;
24
+ filepath?: string;
25
+ operation?: 'write' | 'read';
24
26
  accountId?: number;
27
+ dest?: string;
25
28
  };
26
- export type AxiosErrorContext = {
27
- accountId?: number;
29
+ export interface HubSpotHttpErrorContext extends FileSystemErrorContext {
28
30
  request?: string;
29
31
  payload?: string;
30
32
  projectName?: string;
31
- };
33
+ }
32
34
  export type OptionalError = BaseError | null | undefined;
35
+ export type ErrorContext = {
36
+ accountId?: number;
37
+ };
@@ -0,0 +1 @@
1
+ export type FieldsArray<T> = Array<T | FieldsArray<T>>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- type File = {
1
+ export type File = {
2
2
  id: number;
3
3
  portal_id: number;
4
4
  name: string;
@@ -13,7 +13,6 @@ type File = {
13
13
  friendly_url: string;
14
14
  meta: {
15
15
  allows_anonymous_access: boolean;
16
- charset_guess: string;
17
16
  line_count: number;
18
17
  indexable: boolean;
19
18
  };
@@ -35,8 +34,8 @@ type File = {
35
34
  cdn_purge_embargo_time: number | null;
36
35
  file_hash: string;
37
36
  };
38
- type Folder = {
39
- id: number;
37
+ export type Folder = {
38
+ id: number | 'None';
40
39
  portal_id: number;
41
40
  name: string;
42
41
  deleted: boolean;
@@ -57,10 +56,16 @@ export type FetchStatResponse = {
57
56
  file: File | null;
58
57
  folder: Folder | null;
59
58
  };
60
- export type FetchFilesOrFolderResponse = {
59
+ export type FetchFilesResponse = {
60
+ limit: number;
61
+ offset: number;
62
+ objects: Array<File>;
63
+ total_count: number;
64
+ };
65
+ export type FetchFolderResponse = {
61
66
  limit: number;
62
67
  offset: number;
63
- objects: Array<File | Folder>;
68
+ objects: Array<Folder>;
64
69
  total_count: number;
65
70
  };
66
- export {};
71
+ export type SimplifiedFolder = Partial<Folder> & Pick<Folder, 'id' | 'name'>;
package/types/Files.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { AxiosError } from 'axios';
2
1
  import { ValueOf } from '../types/Utils';
3
2
  import { STAT_TYPES, FILE_TYPES, FILE_UPLOAD_RESULT_TYPES } from '../constants/files';
4
- import { MODE } from '../constants/files';
3
+ import { CMS_PUBLISH_MODE } from '../constants/files';
5
4
  import { HttpOptions } from './Http';
5
+ import { AxiosError } from 'axios';
6
6
  export type StatType = ValueOf<typeof STAT_TYPES>;
7
7
  export type FileData = {
8
8
  filepath: string;
@@ -18,7 +18,7 @@ export type FileMapperNode = {
18
18
  folder: boolean;
19
19
  children: Array<FileMapperNode>;
20
20
  };
21
- export type Mode = ValueOf<typeof MODE>;
21
+ export type CmsPublishMode = ValueOf<typeof CMS_PUBLISH_MODE>;
22
22
  export type FileMapperOptions = Omit<HttpOptions, 'url'>;
23
23
  export type FileMapperInputOptions = {
24
24
  staging?: boolean;
@@ -29,7 +29,7 @@ export type FileType = ValueOf<typeof FILE_TYPES>;
29
29
  type ResultType = ValueOf<typeof FILE_UPLOAD_RESULT_TYPES>;
30
30
  export type UploadFolderResults = {
31
31
  resultType: ResultType;
32
- error: AxiosError | null;
32
+ error: unknown;
33
33
  file: string;
34
34
  };
35
35
  export type FileTree = {
@@ -37,4 +37,43 @@ export type FileTree = {
37
37
  path: string;
38
38
  children: Array<FileTree>;
39
39
  };
40
+ export type PathTypeData = {
41
+ isModule: boolean;
42
+ isHubspot: boolean;
43
+ isFile: boolean;
44
+ isRoot: boolean;
45
+ isFolder: boolean;
46
+ };
47
+ export type RecursiveFileMapperCallback = (node: FileMapperNode, filepath?: string, depth?: number) => boolean;
48
+ export type CommandOptions = {
49
+ convertFields?: boolean;
50
+ fieldOptions?: string;
51
+ saveOutput?: boolean;
52
+ onAttemptCallback?: (file: string | undefined, destPath: string) => void;
53
+ onSuccessCallback?: (file: string | undefined, destPath: string) => void;
54
+ onFirstErrorCallback?: (file: string, destPath: string, error: unknown) => void;
55
+ onRetryCallback?: (file: string, destPath: string) => void;
56
+ onFinalErrorCallback?: (accountId: number, file: string, destPath: string, error: unknown) => void;
57
+ };
58
+ export type FilePathsByType = {
59
+ [key: string]: Array<string>;
60
+ };
61
+ export type UploadFileOptions = FileMapperInputOptions & {
62
+ src: string;
63
+ commandOptions: {
64
+ convertFields?: boolean;
65
+ };
66
+ fieldOptions?: string;
67
+ };
68
+ export type WatchOptions = {
69
+ cmsPublishMode?: CmsPublishMode;
70
+ remove?: boolean;
71
+ disableInitial?: boolean;
72
+ notify?: string;
73
+ commandOptions: {
74
+ convertFields?: boolean;
75
+ };
76
+ filePaths?: Array<string>;
77
+ };
78
+ export type WatchErrorHandler = (error: AxiosError) => void;
40
79
  export {};
@@ -37,4 +37,56 @@ export type GetBuildStatusResponse = {
37
37
  userId: number;
38
38
  deployId: number;
39
39
  };
40
+ export type FunctionConfig = {
41
+ runtime: string;
42
+ version: string;
43
+ environment: object;
44
+ secrets: Array<string>;
45
+ endpoints: {
46
+ [key: string]: {
47
+ method: string;
48
+ file: string;
49
+ };
50
+ };
51
+ };
52
+ export type FunctionConfigInfo = {
53
+ endpointPath: string;
54
+ endpointMethod: string;
55
+ functionFile: string;
56
+ };
57
+ export type FunctionInfo = {
58
+ functionsFolder: string;
59
+ filename: string;
60
+ endpointPath: string;
61
+ endpointMethod: string;
62
+ };
63
+ export type FunctionOptions = {
64
+ allowExistingFile?: boolean;
65
+ };
66
+ export type FunctionLog = {
67
+ id: string;
68
+ executionTime: number;
69
+ log: string;
70
+ error: {
71
+ message: string;
72
+ type: string;
73
+ stackTrace: string[][];
74
+ };
75
+ status: string;
76
+ createdAt: number;
77
+ memory: string;
78
+ };
79
+ export type GetFunctionLogsResponse = {
80
+ results: FunctionLog[];
81
+ paging: {
82
+ next: {
83
+ after: string;
84
+ link: string;
85
+ };
86
+ prev: {
87
+ before: string;
88
+ link: string;
89
+ };
90
+ };
91
+ };
40
92
  export {};
package/types/Github.d.ts CHANGED
@@ -61,4 +61,16 @@ export interface GithubSourceData {
61
61
  repositoryName: string;
62
62
  source: string;
63
63
  }
64
+ export type RepoPath = `${string}/${string}`;
65
+ export type DownloadGithubRepoZipOptions = {
66
+ branch?: string;
67
+ tag?: string;
68
+ };
69
+ export type CloneGithubRepoOptions = {
70
+ isRelease?: boolean;
71
+ type?: string;
72
+ branch?: string;
73
+ tag?: string;
74
+ sourceDir?: string;
75
+ };
64
76
  export {};
package/types/Http.d.ts CHANGED
@@ -1,29 +1,29 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { AxiosPromise, ResponseType } from 'axios';
2
5
  import { ReadStream } from 'fs';
6
+ import { Stream } from 'stream';
7
+ export type HubSpotPromise<T = unknown> = AxiosPromise<T>;
3
8
  export type Data = {
4
9
  [key: string]: any;
5
10
  };
6
11
  export type QueryParams = {
7
12
  [key: string]: string | number | boolean | undefined;
8
13
  };
9
- export type AxiosConfigOptions = {
14
+ export type FormData = {
15
+ [key: string]: string | ReadStream;
16
+ };
17
+ export type HttpOptions = {
10
18
  baseURL?: string;
11
19
  url: string;
12
20
  env?: string;
13
21
  localHostOverride?: boolean;
14
- params?: QueryParams;
15
- data?: Data;
22
+ data?: Data | string | ArrayBuffer | ArrayBufferView | URLSearchParams | Stream | Buffer;
16
23
  resolveWithFullResponse?: boolean;
24
+ params?: QueryParams;
17
25
  timeout?: number;
18
- };
19
- export type FormData = {
20
- [key: string]: string | ReadStream;
21
- };
22
- export type HttpOptions = AxiosConfigOptions & {
23
- query?: QueryParams;
24
- formData?: FormData;
25
- timeout?: number;
26
- encoding?: string | null;
26
+ responseType?: ResponseType;
27
27
  headers?: {
28
28
  [header: string]: string | string[] | undefined;
29
29
  };
package/types/Hubdb.d.ts CHANGED
@@ -98,3 +98,12 @@ export type FetchRowsResponse = {
98
98
  };
99
99
  } | null;
100
100
  };
101
+ export type FetchTablesResponse = {
102
+ total: number;
103
+ results: Array<Table>;
104
+ paging?: {
105
+ next: {
106
+ after: string | null;
107
+ };
108
+ } | null;
109
+ };
package/types/Lang.d.ts CHANGED
@@ -5,3 +5,6 @@ export type GenericLanguageObject = {
5
5
  };
6
6
  export type LanguageObject = typeof lang;
7
7
  export type LangKey = Leaves<LanguageObject>;
8
+ export type InterpolationData = {
9
+ [identifier: string]: string | number;
10
+ };