@hubspot/local-dev-lib 1.9.0 → 1.10.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 (53) hide show
  1. package/api/appsDev.d.ts +2 -1
  2. package/api/appsDev.js +7 -1
  3. package/api/customObjects.d.ts +1 -14
  4. package/api/designManager.d.ts +1 -11
  5. package/api/github.d.ts +1 -3
  6. package/api/localDevAuth.d.ts +1 -17
  7. package/api/projects.d.ts +1 -6
  8. package/api/projects.js +5 -5
  9. package/api/secrets.d.ts +1 -4
  10. package/config/configUtils.d.ts +2 -21
  11. package/config/config_DEPRECATED.d.ts +1 -5
  12. package/constants/extensions.d.ts +1 -0
  13. package/constants/extensions.js +2 -1
  14. package/errors/errors_DEPRECATED.d.ts +1 -5
  15. package/http/index.d.ts +5 -0
  16. package/http/index.js +30 -15
  17. package/lib/archive.d.ts +1 -6
  18. package/lib/cms/functions.d.ts +1 -10
  19. package/lib/cms/modules.d.ts +1 -12
  20. package/lib/cms/uploadFolder.d.ts +1 -16
  21. package/lib/cms/watch.d.ts +2 -15
  22. package/lib/fileMapper.d.ts +1 -10
  23. package/lib/fileMapper.js +5 -1
  24. package/lib/github.d.ts +1 -10
  25. package/lib/gitignore.d.ts +1 -6
  26. package/lib/personalAccessKey.d.ts +2 -15
  27. package/lib/personalAccessKey.js +15 -8
  28. package/lib/portManager.d.ts +1 -5
  29. package/models/OAuth2Manager.d.ts +1 -25
  30. package/package.json +3 -2
  31. package/types/Accounts.d.ts +73 -0
  32. package/types/Apps.d.ts +9 -5
  33. package/types/Archive.d.ts +9 -0
  34. package/types/Archive.js +2 -0
  35. package/types/Config.d.ts +14 -0
  36. package/types/DesignManager.d.ts +10 -0
  37. package/types/DesignManager.js +2 -0
  38. package/types/Error.d.ts +3 -0
  39. package/types/FieldsJS.d.ts +1 -0
  40. package/types/FieldsJS.js +2 -0
  41. package/types/FileManager.d.ts +1 -0
  42. package/types/Files.d.ts +39 -0
  43. package/types/Functions.d.ts +26 -0
  44. package/types/Github.d.ts +12 -0
  45. package/types/Modules.d.ts +10 -0
  46. package/types/PortManager.d.ts +7 -0
  47. package/types/Project.d.ts +4 -0
  48. package/types/Schemas.d.ts +12 -0
  49. package/types/Secrets.d.ts +3 -0
  50. package/types/Secrets.js +2 -0
  51. package/utils/PortManagerServer.d.ts +1 -4
  52. package/utils/cms/fieldsJS.d.ts +1 -2
  53. package/utils/getAccountIdentifier.d.ts +2 -7
package/api/appsDev.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { PublicApp, PublicAppDeveloperTestAccountInstallData } from '../types/Apps';
1
+ import { PublicApp, PublicAppInstallCounts, PublicAppDeveloperTestAccountInstallData } from '../types/Apps';
2
2
  export declare function fetchPublicAppsForPortal(accountId: number): Promise<Array<PublicApp>>;
3
3
  export declare function fetchPublicAppDeveloperTestAccountInstallData(appId: number, accountId: number): Promise<PublicAppDeveloperTestAccountInstallData>;
4
+ export declare function fetchPublicAppProductionInstallCounts(appId: number, accountId: number): Promise<PublicAppInstallCounts>;
4
5
  export declare function fetchPublicAppMetadata(appId: number, accountId: number): Promise<PublicApp>;
package/api/appsDev.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fetchPublicAppMetadata = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
6
+ exports.fetchPublicAppMetadata = exports.fetchPublicAppProductionInstallCounts = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
7
7
  const http_1 = __importDefault(require("../http"));
8
8
  const APPS_DEV_API_PATH = 'apps-dev/external/public/v3';
9
9
  async function fetchPublicAppsForPortal(accountId) {
@@ -19,6 +19,12 @@ function fetchPublicAppDeveloperTestAccountInstallData(appId, accountId) {
19
19
  });
20
20
  }
21
21
  exports.fetchPublicAppDeveloperTestAccountInstallData = fetchPublicAppDeveloperTestAccountInstallData;
22
+ function fetchPublicAppProductionInstallCounts(appId, accountId) {
23
+ return http_1.default.get(accountId, {
24
+ url: `${APPS_DEV_API_PATH}/${appId}/install-counts-without-test-portals`,
25
+ });
26
+ }
27
+ exports.fetchPublicAppProductionInstallCounts = fetchPublicAppProductionInstallCounts;
22
28
  function fetchPublicAppMetadata(appId, accountId) {
23
29
  return http_1.default.get(accountId, {
24
30
  url: `${APPS_DEV_API_PATH}/${appId}/full`,
@@ -1,20 +1,7 @@
1
- import { FetchSchemasResponse, Schema } from '../types/Schemas';
2
- type CreateObjectsResponse = {
3
- status: string;
4
- startedAt: string;
5
- completedAt: string;
6
- results: Array<{
7
- id: string;
8
- properties: Array<any>;
9
- createdAt: string;
10
- updatedAt: string;
11
- archived: boolean;
12
- }>;
13
- };
1
+ import { FetchSchemasResponse, Schema, CreateObjectsResponse } from '../types/Schemas';
14
2
  export declare function batchCreateObjects(accountId: number, objectTypeId: string, objects: JSON): Promise<CreateObjectsResponse>;
15
3
  export declare function createObjectSchema(accountId: number, schema: JSON): Promise<Schema>;
16
4
  export declare function updateObjectSchema(accountId: number, schemaObjectType: string, schema: Schema): Promise<Schema>;
17
5
  export declare function fetchObjectSchema(accountId: number, schemaObjectType: string): Promise<Schema>;
18
6
  export declare function fetchObjectSchemas(accountId: number): Promise<FetchSchemasResponse>;
19
7
  export declare function deleteObjectSchema(accountId: number, schemaObjectType: string): Promise<void>;
20
- export {};
@@ -1,14 +1,4 @@
1
1
  import { QueryParams } from '../types/Http';
2
- type FetchThemesResponse = {
3
- objects: Array<{
4
- theme: {
5
- path: string;
6
- };
7
- }>;
8
- };
2
+ import { FetchThemesResponse, FetchBuiltinMappingResponse } from '../types/DesignManager';
9
3
  export declare function fetchThemes(accountId: number, params?: QueryParams): Promise<FetchThemesResponse>;
10
- type FetchBuiltinMappingResponse = {
11
- [key: string]: string;
12
- };
13
4
  export declare function fetchBuiltinMapping(accountId: number): Promise<FetchBuiltinMappingResponse>;
14
- export {};
package/api/github.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { AxiosResponse } from 'axios';
3
- import { GithubReleaseData, GithubRepoFile } from '../types/Github';
3
+ import { GithubReleaseData, GithubRepoFile, RepoPath } from '../types/Github';
4
4
  declare global {
5
5
  var githubToken: string;
6
6
  }
7
- type RepoPath = `${string}/${string}`;
8
7
  export declare function fetchRepoReleaseData(repoPath: RepoPath, tag?: string): Promise<AxiosResponse<GithubReleaseData>>;
9
8
  export declare function fetchRepoAsZip(zipUrl: string): Promise<AxiosResponse<Buffer>>;
10
9
  export declare function fetchRepoFile(repoPath: RepoPath, filePath: string, ref: string): Promise<AxiosResponse<Buffer>>;
11
10
  export declare function fetchRepoFileByDownloadUrl(downloadUrl: string): Promise<AxiosResponse<Buffer>>;
12
11
  export declare function fetchRepoContents(repoPath: RepoPath, path: string, ref?: string): Promise<AxiosResponse<Array<GithubRepoFile>>>;
13
- export {};
@@ -1,22 +1,6 @@
1
1
  import { Environment } from '../types/Config';
2
- import { ScopeData } from '../types/Accounts';
3
- import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
4
- import { ValueOf } from '../types/Utils';
2
+ import { ScopeData, AccessTokenResponse } from '../types/Accounts';
5
3
  import { PublicAppInstallationData } from '../types/Apps';
6
- type AccessTokenResponse = {
7
- hubId: number;
8
- userId: number;
9
- oauthAccessToken: string;
10
- expiresAtMillis: number;
11
- enabledFeatures?: {
12
- [key: string]: number;
13
- };
14
- scopeGroups: Array<string>;
15
- encodedOAuthRefreshToken: string;
16
- hubName: string;
17
- accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
18
- };
19
4
  export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): Promise<AccessTokenResponse>;
20
5
  export declare function fetchScopeData(accountId: number, scopeGroup: string): Promise<ScopeData>;
21
6
  export declare function fetchAppInstallationData(portalId: number, projectId: number, appUid: string, requiredScopeGroups: Array<string>, optionalScopeGroups?: Array<string>): Promise<PublicAppInstallationData>;
22
- export {};
package/api/projects.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { QueryParams } from '../types/Http';
3
- import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings } from '../types/Project';
3
+ import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse } from '../types/Project';
4
4
  import { Build, FetchProjectBuildsResponse } from '../types/Build';
5
5
  import { ComponentMetadataResponse, ComponentStructureResponse } from '../types/ComponentStructure';
6
6
  import { Deploy, ProjectDeployResponse } from '../types/Deploy';
@@ -12,10 +12,6 @@ export declare function uploadProject(accountId: number, projectName: string, pr
12
12
  export declare function fetchProject(accountId: number, projectName: string): Promise<Project>;
13
13
  export declare function downloadProject(accountId: number, projectName: string, buildId: number): Promise<Buffer>;
14
14
  export declare function deleteProject(accountId: number, projectName: string): Promise<void>;
15
- type FetchPlatformVersionResponse = {
16
- defaultPlatformVersion: string;
17
- activePlatformVersions: Array<string>;
18
- };
19
15
  export declare function fetchPlatformVersions(accountId: number): Promise<FetchPlatformVersionResponse>;
20
16
  export declare function fetchProjectBuilds(accountId: number, projectName: string, params?: QueryParams): Promise<FetchProjectBuildsResponse>;
21
17
  export declare function getBuildStatus(accountId: number, projectName: string, buildId: number): Promise<Build>;
@@ -41,4 +37,3 @@ export declare function checkMigrationStatus(accountId: number, id: number): Pro
41
37
  export declare function cloneApp(accountId: number, appId: number): Promise<CloneAppResponse>;
42
38
  export declare function checkCloneStatus(accountId: number, exportId: number): Promise<CloneAppResponse>;
43
39
  export declare function downloadClonedProject(accountId: number, exportId: number): Promise<Buffer>;
44
- export {};
package/api/projects.js CHANGED
@@ -13,13 +13,13 @@ const DEVELOPER_PROJECTS_API_PATH = 'developer/projects/v1';
13
13
  const MIGRATIONS_API_PATH = 'dfs/migrations/v1';
14
14
  async function fetchProjects(accountId) {
15
15
  return http_1.default.get(accountId, {
16
- url: PROJECTS_API_PATH,
16
+ url: DEVELOPER_PROJECTS_API_PATH,
17
17
  });
18
18
  }
19
19
  exports.fetchProjects = fetchProjects;
20
20
  async function createProject(accountId, name) {
21
21
  return http_1.default.post(accountId, {
22
- url: PROJECTS_API_PATH,
22
+ url: DEVELOPER_PROJECTS_API_PATH,
23
23
  data: {
24
24
  name,
25
25
  },
@@ -44,7 +44,7 @@ async function uploadProject(accountId, projectName, projectFile, uploadMessage,
44
44
  exports.uploadProject = uploadProject;
45
45
  async function fetchProject(accountId, projectName) {
46
46
  return http_1.default.get(accountId, {
47
- url: `${PROJECTS_API_PATH}/${encodeURIComponent(projectName)}`,
47
+ url: `${DEVELOPER_PROJECTS_API_PATH}/by-name/${encodeURIComponent(projectName)}`,
48
48
  });
49
49
  }
50
50
  exports.fetchProject = fetchProject;
@@ -58,7 +58,7 @@ async function downloadProject(accountId, projectName, buildId) {
58
58
  exports.downloadProject = downloadProject;
59
59
  async function deleteProject(accountId, projectName) {
60
60
  return http_1.default.delete(accountId, {
61
- url: `${PROJECTS_API_PATH}/${encodeURIComponent(projectName)}`,
61
+ url: `${DEVELOPER_PROJECTS_API_PATH}/${encodeURIComponent(projectName)}`,
62
62
  });
63
63
  }
64
64
  exports.deleteProject = deleteProject;
@@ -111,7 +111,7 @@ async function getDeployStructure(accountId, projectName, deployId) {
111
111
  exports.getDeployStructure = getDeployStructure;
112
112
  async function fetchProjectSettings(accountId, projectName) {
113
113
  return http_1.default.get(accountId, {
114
- url: `${PROJECTS_API_PATH}/${encodeURIComponent(projectName)}/settings`,
114
+ url: `${DEVELOPER_PROJECTS_API_PATH}/${encodeURIComponent(projectName)}/settings`,
115
115
  });
116
116
  }
117
117
  exports.fetchProjectSettings = fetchProjectSettings;
package/api/secrets.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- type FetchSecretsResponse = {
2
- results: Array<string>;
3
- };
1
+ import { FetchSecretsResponse } from '../types/Secrets';
4
2
  export declare function addSecret(accountId: number, key: string, value: string): Promise<void>;
5
3
  export declare function updateSecret(accountId: number, key: string, value: string): Promise<void>;
6
4
  export declare function deleteSecret(accountId: number, key: string): Promise<void>;
7
5
  export declare function fetchSecrets(accountId: number): Promise<FetchSecretsResponse>;
8
- export {};
@@ -1,24 +1,5 @@
1
- import { CLIConfig_NEW, Environment } from '../types/Config';
2
- import { AuthType, CLIAccount_NEW } from '../types/Accounts';
1
+ import { CLIConfig_NEW } from '../types/Config';
2
+ import { AuthType, CLIAccount_NEW, PersonalAccessKeyOptions, OAuthOptions, APIKeyOptions } from '../types/Accounts';
3
3
  export declare function getOrderedAccount(unorderedAccount: CLIAccount_NEW): CLIAccount_NEW;
4
4
  export declare function getOrderedConfig(unorderedConfig: CLIConfig_NEW): CLIConfig_NEW;
5
- type PersonalAccessKeyOptions = {
6
- accountId: number;
7
- personalAccessKey: string;
8
- env: Environment;
9
- };
10
- type OAuthOptions = {
11
- accountId: number;
12
- clientId: string;
13
- clientSecret: string;
14
- refreshToken: string;
15
- scopes: Array<string>;
16
- env: Environment;
17
- };
18
- type APIKeyOptions = {
19
- accountId: number;
20
- apiKey: string;
21
- env: Environment;
22
- };
23
5
  export declare function generateConfig(type: AuthType, options: PersonalAccessKeyOptions | OAuthOptions | APIKeyOptions): CLIConfig_NEW | null;
24
- export {};
@@ -1,5 +1,5 @@
1
1
  import { CLIConfig_DEPRECATED, Environment } from '../types/Config';
2
- import { AccountType, CLIAccount_DEPRECATED, FlatAccountFields_DEPRECATED } from '../types/Accounts';
2
+ import { AccountType, CLIAccount_DEPRECATED, FlatAccountFields_DEPRECATED, UpdateAccountConfigOptions } from '../types/Accounts';
3
3
  import { Mode } from '../types/Files';
4
4
  import { CLIOptions, WriteConfigOptions } from '../types/CLIOptions';
5
5
  export declare const getConfig: () => CLIConfig_DEPRECATED | null;
@@ -34,9 +34,6 @@ export declare function getAccountId(nameOrId?: string | number): number | undef
34
34
  * @throws {Error}
35
35
  */
36
36
  export declare function removeSandboxAccountFromConfig(nameOrId: string | number): boolean;
37
- type UpdateAccountConfigOptions = Partial<FlatAccountFields_DEPRECATED> & {
38
- environment?: Environment;
39
- };
40
37
  /**
41
38
  * @throws {Error}
42
39
  */
@@ -76,4 +73,3 @@ export declare function loadConfigFromEnvironment({ useEnv, }?: {
76
73
  portals: Array<CLIAccount_DEPRECATED>;
77
74
  } | undefined;
78
75
  export declare function isConfigFlagEnabled(flag: keyof CLIConfig_DEPRECATED): boolean;
79
- export {};
@@ -1,4 +1,5 @@
1
1
  export declare const ALLOWED_EXTENSIONS: Set<string>;
2
+ export declare const JSR_ALLOWED_EXTENSIONS: Set<string>;
2
3
  export declare const HUBL_EXTENSIONS: Set<string>;
3
4
  export declare const MODULE_EXTENSION = "module";
4
5
  export declare const FUNCTIONS_EXTENSION = "functions";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FOLDER_DOT_EXTENSIONS = exports.FUNCTIONS_EXTENSION = exports.MODULE_EXTENSION = exports.HUBL_EXTENSIONS = exports.ALLOWED_EXTENSIONS = void 0;
3
+ exports.FOLDER_DOT_EXTENSIONS = exports.FUNCTIONS_EXTENSION = exports.MODULE_EXTENSION = exports.HUBL_EXTENSIONS = exports.JSR_ALLOWED_EXTENSIONS = exports.ALLOWED_EXTENSIONS = void 0;
4
4
  exports.ALLOWED_EXTENSIONS = new Set([
5
5
  'css',
6
6
  'js',
@@ -21,6 +21,7 @@ exports.ALLOWED_EXTENSIONS = new Set([
21
21
  'woff2',
22
22
  'graphql',
23
23
  ]);
24
+ exports.JSR_ALLOWED_EXTENSIONS = new Set(['jsx', 'tsx', 'ts']);
24
25
  exports.HUBL_EXTENSIONS = new Set(['css', 'html', 'js']);
25
26
  exports.MODULE_EXTENSION = 'module';
26
27
  exports.FUNCTIONS_EXTENSION = 'functions';
@@ -1,7 +1,3 @@
1
- import { BaseError, FileSystemErrorContext } from '../types/Error';
2
- type ErrorContext = {
3
- accountId?: number;
4
- };
1
+ import { BaseError, FileSystemErrorContext, ErrorContext } from '../types/Error';
5
2
  export declare function logErrorInstance(error: BaseError, context?: ErrorContext): void;
6
3
  export declare function logFileSystemErrorInstance(error: BaseError, context: FileSystemErrorContext): void;
7
- export {};
package/http/index.d.ts CHANGED
@@ -2,10 +2,15 @@ import { AxiosResponse } from 'axios';
2
2
  import { HttpOptions } from '../types/Http';
3
3
  export declare function addUserAgentHeader(key: string, value: string): void;
4
4
  declare function getRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
5
+ declare function getRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
5
6
  declare function postRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
7
+ declare function postRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
6
8
  declare function putRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
9
+ declare function putRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
7
10
  declare function patchRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
11
+ declare function patchRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
8
12
  declare function deleteRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
13
+ declare function deleteRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
9
14
  declare const http: {
10
15
  get: typeof getRequest;
11
16
  post: typeof postRequest;
package/http/index.js CHANGED
@@ -88,32 +88,47 @@ function addQueryParams(configOptions, queryParams = {}) {
88
88
  },
89
89
  };
90
90
  }
91
- async function getRequest(accountId, options) {
91
+ async function getRequest(accountId, options, withFullResponse) {
92
92
  const { params, ...rest } = options;
93
93
  const axiosConfig = addQueryParams(rest, params);
94
94
  const configWithAuth = await withAuth(accountId, axiosConfig);
95
- const { data } = await (0, axios_1.default)(configWithAuth);
96
- return data;
95
+ const response = await (0, axios_1.default)(configWithAuth);
96
+ if (withFullResponse) {
97
+ return response;
98
+ }
99
+ return response.data;
97
100
  }
98
- async function postRequest(accountId, options) {
101
+ async function postRequest(accountId, options, withFullResponse) {
99
102
  const configWithAuth = await withAuth(accountId, options);
100
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'post' });
101
- return data;
103
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'post' });
104
+ if (withFullResponse) {
105
+ return response;
106
+ }
107
+ return response.data;
102
108
  }
103
- async function putRequest(accountId, options) {
109
+ async function putRequest(accountId, options, withFullResponse) {
104
110
  const configWithAuth = await withAuth(accountId, options);
105
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
106
- return data;
111
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
112
+ if (withFullResponse) {
113
+ return response;
114
+ }
115
+ return response.data;
107
116
  }
108
- async function patchRequest(accountId, options) {
117
+ async function patchRequest(accountId, options, withFullResponse) {
109
118
  const configWithAuth = await withAuth(accountId, options);
110
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'patch' });
111
- return data;
119
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'patch' });
120
+ if (withFullResponse) {
121
+ return response;
122
+ }
123
+ return response.data;
112
124
  }
113
- async function deleteRequest(accountId, options) {
125
+ async function deleteRequest(accountId, options, withFullResponse = false) {
114
126
  const configWithAuth = await withAuth(accountId, options);
115
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'delete' });
116
- return data;
127
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'delete' });
128
+ if (withFullResponse) {
129
+ return response;
130
+ }
131
+ return response.data;
117
132
  }
118
133
  function createGetRequestStream(contentType) {
119
134
  return async (accountId, options, destPath) => {
package/lib/archive.d.ts CHANGED
@@ -1,8 +1,3 @@
1
1
  /// <reference types="node" />
2
- type CopySourceToDestOptions = {
3
- sourceDir?: string;
4
- includesRootDir?: boolean;
5
- hideLogs?: boolean;
6
- };
2
+ import { CopySourceToDestOptions } from '../types/Archive';
7
3
  export declare function extractZipArchive(zip: Buffer, name: string, dest: string, { sourceDir, includesRootDir, hideLogs }?: CopySourceToDestOptions): Promise<boolean>;
8
- export {};
@@ -1,11 +1,2 @@
1
- type FunctionInfo = {
2
- functionsFolder: string;
3
- filename: string;
4
- endpointPath: string;
5
- endpointMethod: string;
6
- };
7
- type FunctionOptions = {
8
- allowExistingFile?: boolean;
9
- };
1
+ import { FunctionInfo, FunctionOptions } from '../../types/Functions';
10
2
  export declare function createFunction(functionInfo: FunctionInfo, dest: string, options?: FunctionOptions): Promise<void>;
11
- export {};
@@ -1,4 +1,4 @@
1
- import { PathInput } from '../../types/Modules';
1
+ import { PathInput, ValidationResult, ModuleDefinition } from '../../types/Modules';
2
2
  export declare const ValidationIds: {
3
3
  SRC_REQUIRED: string;
4
4
  DEST_REQUIRED: string;
@@ -6,20 +6,9 @@ export declare const ValidationIds: {
6
6
  MODULE_TO_MODULE_NESTING: string;
7
7
  MODULE_NESTING: string;
8
8
  };
9
- type ValidationResult = {
10
- id: string;
11
- message: string;
12
- };
13
9
  export declare function validateSrcAndDestPaths(src?: PathInput, dest?: PathInput): Promise<Array<ValidationResult>>;
14
- type ModuleDefinition = {
15
- contentTypes: Array<string>;
16
- moduleLabel: string;
17
- reactType: boolean;
18
- global: boolean;
19
- };
20
10
  export declare function createModule(moduleDefinition: ModuleDefinition, name: string, dest: string, getInternalVersion: boolean, options?: {
21
11
  allowExistingDir: boolean;
22
12
  }): Promise<void>;
23
13
  export declare function retrieveDefaultModule(name: string | undefined, dest: string): Promise<import("../../types/Github").GithubRepoFile[] | undefined>;
24
14
  export declare const isModuleHTMLFile: (filePath: string) => boolean;
25
- export {};
@@ -1,22 +1,7 @@
1
- import { AxiosError } from 'axios';
2
1
  import { FieldsJs } from './handleFieldsJS';
3
2
  import { FileMapperInputOptions } from '../../types/Files';
4
- import { UploadFolderResults } from '../../types/Files';
3
+ import { UploadFolderResults, CommandOptions, FilePathsByType } from '../../types/Files';
5
4
  import { Mode } from '../../types/Files';
6
- type CommandOptions = {
7
- convertFields?: boolean;
8
- fieldOptions?: string;
9
- saveOutput?: boolean;
10
- onAttemptCallback?: (file: string | undefined, destPath: string) => void;
11
- onSuccessCallback?: (file: string | undefined, destPath: string) => void;
12
- onFirstErrorCallback?: (file: string, destPath: string, error: AxiosError) => void;
13
- onRetryCallback?: (file: string, destPath: string) => void;
14
- onFinalErrorCallback?: (accountId: number, file: string, destPath: string, error: AxiosError) => void;
15
- };
16
- type FilePathsByType = {
17
- [key: string]: Array<string>;
18
- };
19
5
  export declare function getFilesByType(filePaths: Array<string>, projectDir: string, rootWriteDir: string | null, commandOptions: CommandOptions): Promise<[FilePathsByType, Array<FieldsJs>]>;
20
6
  export declare function uploadFolder(accountId: number, src: string, dest: string, fileMapperOptions: FileMapperInputOptions, commandOptions?: CommandOptions, filePaths?: Array<string>, mode?: Mode | null): Promise<Array<UploadFolderResults>>;
21
7
  export declare function hasUploadErrors(results: Array<UploadFolderResults>): boolean;
22
- export {};
@@ -1,17 +1,4 @@
1
1
  import chokidar from 'chokidar';
2
- import { AxiosError } from 'axios';
3
- import { Mode } from '../../types/Files';
2
+ import { WatchOptions, WatchErrorHandler } from '../../types/Files';
4
3
  import { UploadFolderResults } from '../../types/Files';
5
- type WatchOptions = {
6
- mode?: Mode;
7
- remove?: boolean;
8
- disableInitial?: boolean;
9
- notify?: string;
10
- commandOptions: {
11
- convertFields?: boolean;
12
- };
13
- filePaths?: Array<string>;
14
- };
15
- type ErrorHandler = (error: AxiosError) => void;
16
- export declare function watch(accountId: number, src: string, dest: string, { mode, remove, disableInitial, notify, commandOptions, filePaths, }: WatchOptions, postInitialUploadCallback?: ((result: Array<UploadFolderResults>) => void) | null, onUploadFolderError?: ErrorHandler, onQueueAddError?: ErrorHandler, onUploadFileError?: (file: string, dest: string, accountId: number) => ErrorHandler): chokidar.FSWatcher;
17
- export {};
4
+ export declare function watch(accountId: number, src: string, dest: string, { mode, remove, disableInitial, notify, commandOptions, filePaths, }: WatchOptions, postInitialUploadCallback?: ((result: Array<UploadFolderResults>) => void) | null, onUploadFolderError?: WatchErrorHandler, onQueueAddError?: WatchErrorHandler, onUploadFileError?: (file: string, dest: string, accountId: number) => WatchErrorHandler): chokidar.FSWatcher;
@@ -1,18 +1,10 @@
1
- import { FileMapperNode, Mode, FileMapperOptions, FileMapperInputOptions } from '../types/Files';
1
+ import { FileMapperNode, Mode, FileMapperOptions, FileMapperInputOptions, PathTypeData, RecursiveFileMapperCallback } from '../types/Files';
2
2
  export declare function isPathToFile(filepath: string): boolean;
3
3
  export declare function isPathToModule(filepath: string): boolean;
4
4
  export declare function isPathToRoot(filepath: string): boolean;
5
5
  export declare function isPathToHubspot(filepath: string): boolean;
6
6
  export declare function getFileMapperQueryValues(mode?: Mode | null, { staging, assetVersion }?: FileMapperInputOptions): FileMapperOptions;
7
- type PathTypeData = {
8
- isModule: boolean;
9
- isHubspot: boolean;
10
- isFile: boolean;
11
- isRoot: boolean;
12
- isFolder: boolean;
13
- };
14
7
  export declare function getTypeDataFromPath(src: string): PathTypeData;
15
- type RecursiveFileMapperCallback = (node: FileMapperNode, filepath?: string, depth?: number) => boolean;
16
8
  export declare function recurseFolder(node: FileMapperNode, callback: RecursiveFileMapperCallback, filepath?: string, depth?: number): boolean;
17
9
  export declare function writeUtimes(accountId: number, filepath: string, node: FileMapperNode): Promise<void>;
18
10
  export declare function fetchFolderFromApi(accountId: number, src: string, mode?: Mode, options?: FileMapperInputOptions): Promise<FileMapperNode>;
@@ -24,4 +16,3 @@ export declare function fetchFolderFromApi(accountId: number, src: string, mode?
24
16
  * @returns {Promise}
25
17
  */
26
18
  export declare function downloadFileOrFolder(accountId: number, src: string, dest: string, mode?: Mode, options?: FileMapperInputOptions): Promise<void>;
27
- export {};
package/lib/fileMapper.js CHANGED
@@ -150,7 +150,7 @@ async function fetchAndWriteFileStream(accountId, srcPath, filepath, mode, optio
150
150
  logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.skippedExisting`, { filepath }));
151
151
  return;
152
152
  }
153
- if (!(0, path_2.isAllowedExtension)(srcPath)) {
153
+ if (!(0, path_2.isAllowedExtension)(srcPath, Array.from(extensions_1.JSR_ALLOWED_EXTENSIONS))) {
154
154
  (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.invalidFileType`, { srcPath });
155
155
  }
156
156
  let node;
@@ -272,6 +272,10 @@ async function downloadFolder(accountId, src, destPath, mode, options = {}) {
272
272
  const succeeded = await writeFileMapperNode(accountId, filepath || '', childNode, mode, options);
273
273
  if (succeeded === false) {
274
274
  success = false;
275
+ logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchFile`, {
276
+ src: childNode.path,
277
+ dest: filepath || '',
278
+ }));
275
279
  }
276
280
  });
277
281
  return success;
package/lib/github.d.ts CHANGED
@@ -1,17 +1,8 @@
1
1
  /// <reference types="node" />
2
- import { GithubReleaseData, GithubRepoFile } from '../types/Github';
3
- type RepoPath = `${string}/${string}`;
2
+ import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
4
3
  export declare function fetchFileFromRepository(repoPath: RepoPath, filePath: string, ref: string): Promise<Buffer>;
5
4
  export declare function fetchReleaseData(repoPath: RepoPath, tag?: string): Promise<GithubReleaseData>;
6
- type CloneGithubRepoOptions = {
7
- isRelease?: boolean;
8
- type?: string;
9
- branch?: string;
10
- tag?: string;
11
- sourceDir?: string;
12
- };
13
5
  export declare function cloneGithubRepo(repoPath: RepoPath, dest: string, options?: CloneGithubRepoOptions): Promise<boolean>;
14
6
  export declare function fetchGitHubRepoContentFromDownloadUrl(dest: string, downloadUrl: string): Promise<void>;
15
7
  export declare function downloadGithubRepoContents(repoPath: RepoPath, contentPath: string, dest: string, ref?: string, filter?: (contentPiecePath: string, downloadPath: string) => boolean): Promise<void>;
16
8
  export declare function listGithubRepoContents(repoPath: RepoPath, contentPath: string, fileFilter?: 'file' | 'dir'): Promise<GithubRepoFile[]>;
17
- export {};
@@ -1,8 +1,3 @@
1
+ import { GitInclusionResult } from '../types/Config';
1
2
  export declare function checkAndAddConfigToGitignore(configPath: string): void;
2
- type GitInclusionResult = {
3
- inGit: boolean;
4
- configIgnored: boolean;
5
- gitignoreFiles: Array<string>;
6
- };
7
3
  export declare function checkGitInclusion(configPath: string): GitInclusionResult;
8
- export {};
@@ -1,23 +1,10 @@
1
1
  import { CLIAccount } from '../types/Accounts';
2
2
  import { Environment } from '../types/Config';
3
- import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
4
- import { ValueOf } from '../types/Utils';
5
- type AccessToken = {
6
- portalId: number;
7
- accessToken: string;
8
- expiresAt: string;
9
- scopeGroups: Array<string>;
10
- enabledFeatures?: {
11
- [key: string]: number;
12
- };
13
- encodedOAuthRefreshToken: string;
14
- hubName: string;
15
- accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
16
- };
3
+ import { AccessToken } from '../types/Accounts';
17
4
  export declare function getAccessToken(personalAccessKey: string, env?: Environment, accountId?: number): Promise<AccessToken>;
18
5
  export declare function accessTokenForPersonalAccessKey(accountId: number): Promise<string | undefined>;
19
6
  export declare function enabledFeaturesForPersonalAccessKey(accountId: number): Promise<{
20
7
  [key: string]: number;
21
8
  } | undefined>;
9
+ export declare function scopesOnAccessToken(accountId: number): Promise<Array<string>>;
22
10
  export declare function updateConfigWithAccessToken(token: AccessToken, personalAccessKey: string, env?: Environment, name?: string, makeDefault?: boolean): Promise<CLIAccount | null>;
23
- export {};
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.updateConfigWithAccessToken = exports.enabledFeaturesForPersonalAccessKey = exports.accessTokenForPersonalAccessKey = exports.getAccessToken = void 0;
6
+ exports.updateConfigWithAccessToken = exports.scopesOnAccessToken = exports.enabledFeaturesForPersonalAccessKey = exports.accessTokenForPersonalAccessKey = exports.getAccessToken = void 0;
7
7
  const moment_1 = __importDefault(require("moment"));
8
8
  const environments_1 = require("../constants/environments");
9
9
  const auth_1 = require("../constants/auth");
@@ -83,6 +83,15 @@ async function getNewAccessToken(accountId, personalAccessKey, expiresAt, env) {
83
83
  }
84
84
  return accessTokenResponse;
85
85
  }
86
+ async function getNewAccessTokenByAccountId(accountId) {
87
+ const account = (0, config_1.getAccountConfig)(accountId);
88
+ if (!account) {
89
+ (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.accountNotFound`, { accountId });
90
+ }
91
+ const { auth, personalAccessKey, env } = account;
92
+ const accessTokenResponse = await getNewAccessToken(accountId, personalAccessKey, auth?.tokenInfo?.expiresAt, env);
93
+ return accessTokenResponse;
94
+ }
86
95
  async function accessTokenForPersonalAccessKey(accountId) {
87
96
  const account = (0, config_1.getAccountConfig)(accountId);
88
97
  if (!account) {
@@ -99,16 +108,14 @@ async function accessTokenForPersonalAccessKey(accountId) {
99
108
  }
100
109
  exports.accessTokenForPersonalAccessKey = accessTokenForPersonalAccessKey;
101
110
  async function enabledFeaturesForPersonalAccessKey(accountId) {
102
- const account = (0, config_1.getAccountConfig)(accountId);
103
- if (!account) {
104
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.accountNotFound`, { accountId });
105
- }
106
- const { auth, personalAccessKey, env } = account;
107
- const authTokenInfo = auth && auth.tokenInfo;
108
- const accessTokenResponse = await getNewAccessToken(accountId, personalAccessKey, authTokenInfo && authTokenInfo.expiresAt, env);
111
+ const accessTokenResponse = await getNewAccessTokenByAccountId(accountId);
109
112
  return accessTokenResponse?.enabledFeatures;
110
113
  }
111
114
  exports.enabledFeaturesForPersonalAccessKey = enabledFeaturesForPersonalAccessKey;
115
+ async function scopesOnAccessToken(accountId) {
116
+ return (await getNewAccessTokenByAccountId(accountId)).scopeGroups;
117
+ }
118
+ exports.scopesOnAccessToken = scopesOnAccessToken;
112
119
  async function updateConfigWithAccessToken(token, personalAccessKey, env, name, makeDefault = false) {
113
120
  const { portalId, accessToken, expiresAt, accountType } = token;
114
121
  const accountEnv = env || (0, config_1.getEnv)(name);
@@ -1,13 +1,9 @@
1
+ import { RequestPortsData } from '../types/PortManager';
1
2
  export declare const BASE_URL: string;
2
3
  export declare function startPortManagerServer(): Promise<void>;
3
4
  export declare function stopPortManagerServer(): Promise<void>;
4
- type RequestPortsData = {
5
- instanceId: string;
6
- port?: number;
7
- };
8
5
  export declare function requestPorts(portData: Array<RequestPortsData>): Promise<{
9
6
  [instanceId: string]: number;
10
7
  }>;
11
8
  export declare function deleteServerInstance(serverInstanceId: string): Promise<void>;
12
9
  export declare function portManagerHasActiveServers(): Promise<boolean>;
13
- export {};
@@ -1,28 +1,4 @@
1
- import { FlatAccountFields, TokenInfo } from '../types/Accounts';
2
- import { Environment } from '../types/Config';
3
- type OAuth2ManagerAccountConfig = {
4
- name?: string;
5
- accountId?: number;
6
- clientId?: string;
7
- clientSecret?: string;
8
- scopes?: Array<string>;
9
- env?: Environment;
10
- environment?: Environment;
11
- tokenInfo?: TokenInfo;
12
- authType?: 'oauth2';
13
- };
14
- type WriteTokenInfoFunction = (tokenInfo: TokenInfo) => void;
15
- type RefreshTokenResponse = {
16
- refresh_token: string;
17
- access_token: string;
18
- expires_in: string;
19
- };
20
- type ExchangeProof = {
21
- grant_type: string;
22
- client_id?: string;
23
- client_secret?: string;
24
- refresh_token?: string;
25
- };
1
+ import { FlatAccountFields, OAuth2ManagerAccountConfig, WriteTokenInfoFunction, RefreshTokenResponse, ExchangeProof } from '../types/Accounts';
26
2
  declare class OAuth2Manager {
27
3
  account: OAuth2ManagerAccountConfig;
28
4
  writeTokenInfo?: WriteTokenInfoFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -54,7 +54,8 @@
54
54
  "./http/*": "./http/*.js",
55
55
  "./config": "./config/index.js",
56
56
  "./constants/*": "./constants/*.js",
57
- "./models/*": "./models/*.js"
57
+ "./models/*": "./models/*.js",
58
+ "./types/*": "./types/*.d.ts"
58
59
  },
59
60
  "dependencies": {
60
61
  "address": "^2.0.1",
@@ -34,6 +34,10 @@ export interface CLIAccount_DEPRECATED {
34
34
  personalAccessKey?: string;
35
35
  }
36
36
  export type CLIAccount = CLIAccount_NEW | CLIAccount_DEPRECATED;
37
+ export type GenericAccount = {
38
+ portalId?: number;
39
+ accountId?: number;
40
+ };
37
41
  export type AccountType = ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
38
42
  export type TokenInfo = {
39
43
  accessToken?: string;
@@ -98,3 +102,72 @@ export type ScopeData = {
98
102
  portalScopesInGroup: Array<string>;
99
103
  userScopesInGroup: Array<string>;
100
104
  };
105
+ export type AccessTokenResponse = {
106
+ hubId: number;
107
+ userId: number;
108
+ oauthAccessToken: string;
109
+ expiresAtMillis: number;
110
+ enabledFeatures?: {
111
+ [key: string]: number;
112
+ };
113
+ scopeGroups: Array<string>;
114
+ encodedOAuthRefreshToken: string;
115
+ hubName: string;
116
+ accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
117
+ };
118
+ export type UpdateAccountConfigOptions = Partial<FlatAccountFields_DEPRECATED> & {
119
+ environment?: Environment;
120
+ };
121
+ export type PersonalAccessKeyOptions = {
122
+ accountId: number;
123
+ personalAccessKey: string;
124
+ env: Environment;
125
+ };
126
+ export type OAuthOptions = {
127
+ accountId: number;
128
+ clientId: string;
129
+ clientSecret: string;
130
+ refreshToken: string;
131
+ scopes: Array<string>;
132
+ env: Environment;
133
+ };
134
+ export type APIKeyOptions = {
135
+ accountId: number;
136
+ apiKey: string;
137
+ env: Environment;
138
+ };
139
+ export type AccessToken = {
140
+ portalId: number;
141
+ accessToken: string;
142
+ expiresAt: string;
143
+ scopeGroups: Array<string>;
144
+ enabledFeatures?: {
145
+ [key: string]: number;
146
+ };
147
+ encodedOAuthRefreshToken: string;
148
+ hubName: string;
149
+ accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
150
+ };
151
+ export type OAuth2ManagerAccountConfig = {
152
+ name?: string;
153
+ accountId?: number;
154
+ clientId?: string;
155
+ clientSecret?: string;
156
+ scopes?: Array<string>;
157
+ env?: Environment;
158
+ environment?: Environment;
159
+ tokenInfo?: TokenInfo;
160
+ authType?: 'oauth2';
161
+ };
162
+ export type WriteTokenInfoFunction = (tokenInfo: TokenInfo) => void;
163
+ export type RefreshTokenResponse = {
164
+ refresh_token: string;
165
+ access_token: string;
166
+ expires_in: string;
167
+ };
168
+ export type ExchangeProof = {
169
+ grant_type: string;
170
+ client_id?: string;
171
+ client_secret?: string;
172
+ refresh_token?: string;
173
+ };
package/types/Apps.d.ts CHANGED
@@ -13,6 +13,11 @@ export type PublicAppDeveloperTestAccountInstallData = {
13
13
  }>;
14
14
  testPortalInstallCount: string;
15
15
  };
16
+ export type PublicAppInstallCounts = {
17
+ uniquePortalInstallCount: number;
18
+ uniqueUserInstallCount: number;
19
+ uniqueBusinessUnitInstallCount: number;
20
+ };
16
21
  export type PublicApp = {
17
22
  id: number;
18
23
  name: string;
@@ -34,11 +39,7 @@ export type PublicApp = {
34
39
  supportPhone: string | null;
35
40
  extensionIconUrl: string | null;
36
41
  isAdvancedScopesSettingEnabled: boolean;
37
- publicApplicationInstallCounts: {
38
- uniquePortalInstallCount: number;
39
- uniqueUserInstallCount: number;
40
- uniqueBusinessUnitInstallCount: number;
41
- };
42
+ publicApplicationInstallCounts: PublicAppInstallCounts;
42
43
  redirectUrls: Array<string>;
43
44
  scopeGroupIds: Array<number>;
44
45
  requiredScopeInfo?: Array<{
@@ -71,3 +72,6 @@ export type PublicApp = {
71
72
  allowedExternalUrls: Array<string>;
72
73
  preventProjectMigrations?: boolean;
73
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/Config.d.ts CHANGED
@@ -21,3 +21,17 @@ export interface CLIConfig_DEPRECATED {
21
21
  }
22
22
  export type CLIConfig = CLIConfig_NEW | CLIConfig_DEPRECATED;
23
23
  export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
24
+ export type EnvironmentConfigVariables = {
25
+ apiKey?: string;
26
+ clientId?: string;
27
+ clientSecret?: string;
28
+ personalAccessKey?: string;
29
+ accountId?: number;
30
+ refreshToken?: string;
31
+ env?: Environment;
32
+ };
33
+ export type GitInclusionResult = {
34
+ inGit: boolean;
35
+ configIgnored: boolean;
36
+ gitignoreFiles: Array<string>;
37
+ };
@@ -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
@@ -31,3 +31,6 @@ export type AxiosErrorContext = {
31
31
  projectName?: string;
32
32
  };
33
33
  export type OptionalError = BaseError | null | undefined;
34
+ export type ErrorContext = {
35
+ accountId?: number;
36
+ };
@@ -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 });
@@ -68,3 +68,4 @@ export type FetchFolderResponse = {
68
68
  objects: Array<Folder>;
69
69
  total_count: number;
70
70
  };
71
+ export type SimplifiedFolder = Partial<Folder> & Pick<Folder, 'id' | 'name'>;
package/types/Files.d.ts CHANGED
@@ -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: AxiosError) => void;
55
+ onRetryCallback?: (file: string, destPath: string) => void;
56
+ onFinalErrorCallback?: (accountId: number, file: string, destPath: string, error: AxiosError) => 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
+ mode?: Mode;
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,30 @@ 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
+ };
40
66
  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 {};
@@ -3,3 +3,13 @@ export type PathInput = {
3
3
  isHubSpot?: boolean;
4
4
  path: string;
5
5
  };
6
+ export type ValidationResult = {
7
+ id: string;
8
+ message: string;
9
+ };
10
+ export type ModuleDefinition = {
11
+ contentTypes: Array<string>;
12
+ moduleLabel: string;
13
+ reactType: boolean;
14
+ global: boolean;
15
+ };
@@ -2,3 +2,10 @@ export type RequestPortsData = {
2
2
  instanceId: string;
3
3
  port?: number;
4
4
  };
5
+ export type NetError = Error & {
6
+ code: string;
7
+ };
8
+ export type ListenCallback = (error: NetError | null, port: number) => void;
9
+ export type ServerPortMap = {
10
+ [instanceId: string]: number;
11
+ };
@@ -36,3 +36,7 @@ export type UploadProjectResponse = {
36
36
  export type ProjectSettings = {
37
37
  isAutoDeployEnabled: boolean;
38
38
  };
39
+ export type FetchPlatformVersionResponse = {
40
+ defaultPlatformVersion: string;
41
+ activePlatformVersions: Array<string>;
42
+ };
@@ -25,3 +25,15 @@ export type Schema = {
25
25
  export type FetchSchemasResponse = {
26
26
  results: Array<Schema>;
27
27
  };
28
+ export type CreateObjectsResponse = {
29
+ status: string;
30
+ startedAt: string;
31
+ completedAt: string;
32
+ results: Array<{
33
+ id: string;
34
+ properties: Array<any>;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ archived: boolean;
38
+ }>;
39
+ };
@@ -0,0 +1,3 @@
1
+ export type FetchSecretsResponse = {
2
+ results: Array<string>;
3
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { Express, Request, Response } from 'express';
3
3
  import { Server } from 'http';
4
- import { RequestPortsData } from '../types/PortManager';
5
- type ServerPortMap = {
6
- [instanceId: string]: number;
7
- };
4
+ import { RequestPortsData, ServerPortMap } from '../types/PortManager';
8
5
  declare class PortManagerServer {
9
6
  app?: Express;
10
7
  server?: Server;
@@ -1,3 +1,2 @@
1
- type FieldsArray<T> = Array<T | FieldsArray<T>>;
1
+ import { FieldsArray } from '../../types/FieldsJS';
2
2
  export declare function fieldsArrayToJson<T>(fields: FieldsArray<T>): string;
3
- export {};
@@ -1,10 +1,5 @@
1
- import { CLIAccount } from '../types/Accounts';
1
+ import { CLIAccount, GenericAccount } from '../types/Accounts';
2
2
  import { CLIConfig } from '../types/Config';
3
- type Account = {
4
- portalId?: number;
5
- accountId?: number;
6
- };
7
- export declare function getAccountIdentifier(account?: Account | null): number | undefined;
3
+ export declare function getAccountIdentifier(account?: GenericAccount | null): number | undefined;
8
4
  export declare function getAccounts(config?: CLIConfig | null): Array<CLIAccount>;
9
5
  export declare function getDefaultAccount(config?: CLIConfig | null): string | number | undefined;
10
- export {};