@hubspot/local-dev-lib 0.3.14 → 0.4.0-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.
- package/LICENSE +12 -0
- package/README.md +17 -0
- package/api/appsDev.d.ts +6 -0
- package/api/appsDev.js +29 -0
- package/api/customObjects.d.ts +8 -20
- package/api/customObjects.js +13 -16
- package/api/designManager.d.ts +4 -14
- package/api/designManager.js +5 -8
- package/api/devSecrets.d.ts +6 -0
- package/api/devSecrets.js +40 -0
- package/api/developerTestAccounts.d.ts +12 -5
- package/api/developerTestAccounts.js +17 -10
- package/api/fileManager.d.ts +5 -4
- package/api/fileManager.js +9 -9
- package/api/fileMapper.d.ts +8 -7
- package/api/fileMapper.js +16 -16
- package/api/fileTransport.d.ts +4 -3
- package/api/fileTransport.js +5 -5
- package/api/fireAlarm.d.ts +3 -0
- package/api/fireAlarm.js +11 -0
- package/api/functions.d.ts +7 -7
- package/api/functions.js +11 -14
- package/api/github.d.ts +8 -9
- package/api/github.js +30 -13
- package/api/hubdb.d.ts +11 -10
- package/api/hubdb.js +24 -21
- package/api/lighthouseScore.d.ts +4 -4
- package/api/lighthouseScore.js +7 -10
- package/api/localDevAuth.d.ts +9 -19
- package/api/localDevAuth.js +34 -9
- package/api/marketplaceValidation.d.ts +4 -4
- package/api/marketplaceValidation.js +4 -7
- package/api/projects.d.ts +47 -35
- package/api/projects.js +145 -57
- package/api/sandboxHubs.d.ts +6 -4
- package/api/sandboxHubs.js +9 -10
- package/api/sandboxSync.d.ts +4 -4
- package/api/sandboxSync.js +4 -13
- package/api/secrets.d.ts +6 -8
- package/api/secrets.js +9 -12
- package/api/validateHubl.d.ts +2 -1
- package/api/validateHubl.js +3 -6
- package/config/CLIConfiguration.d.ts +16 -9
- package/config/CLIConfiguration.js +148 -74
- package/config/configFile.js +8 -17
- package/config/configUtils.d.ts +2 -21
- package/config/configUtils.js +2 -2
- package/config/config_DEPRECATED.d.ts +10 -8
- package/config/config_DEPRECATED.js +62 -32
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +14 -8
- package/config/index.js +108 -59
- package/config/migrate.d.ts +22 -0
- package/config/migrate.js +178 -0
- package/constants/config.d.ts +13 -1
- package/constants/config.js +19 -2
- package/constants/extensions.d.ts +1 -0
- package/constants/extensions.js +2 -1
- package/constants/files.d.ts +2 -2
- package/constants/files.js +3 -3
- package/constants/projects.d.ts +12 -0
- package/constants/projects.js +15 -0
- package/errors/errors_DEPRECATED.d.ts +1 -5
- package/errors/errors_DEPRECATED.js +2 -2
- package/errors/index.d.ts +18 -0
- package/errors/index.js +63 -0
- package/http/addQueryParams.d.ts +2 -0
- package/http/addQueryParams.js +14 -0
- package/http/getAxiosConfig.d.ts +6 -3
- package/http/getAxiosConfig.js +45 -6
- package/http/index.d.ts +11 -10
- package/http/index.js +84 -33
- package/http/unauthed.d.ts +14 -0
- package/http/unauthed.js +38 -0
- package/lang/en.json +384 -376
- package/lib/archive.d.ts +3 -6
- package/lib/archive.js +26 -20
- package/lib/cms/functions.d.ts +6 -9
- package/lib/cms/functions.js +24 -19
- package/lib/cms/handleFieldsJS.d.ts +2 -2
- package/lib/cms/handleFieldsJS.js +13 -9
- package/lib/cms/modules.d.ts +5 -13
- package/lib/cms/modules.js +40 -23
- package/lib/cms/processFieldsJs.js +8 -7
- package/lib/cms/templates.d.ts +42 -0
- package/lib/cms/templates.js +48 -5
- package/lib/cms/uploadFolder.d.ts +3 -18
- package/lib/cms/uploadFolder.js +19 -17
- package/lib/cms/validate.js +1 -1
- package/lib/cms/watch.d.ts +2 -15
- package/lib/cms/watch.js +31 -23
- package/lib/customObjects.js +4 -15
- package/lib/fileManager.js +22 -22
- package/lib/fileMapper.d.ts +4 -13
- package/lib/fileMapper.js +47 -50
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +10 -6
- package/lib/github.d.ts +11 -11
- package/lib/github.js +44 -30
- package/lib/gitignore.d.ts +1 -6
- package/lib/gitignore.js +2 -2
- package/lib/hubdb.d.ts +3 -2
- package/lib/hubdb.js +11 -9
- package/lib/notify.js +2 -2
- package/lib/oauth.d.ts +1 -1
- package/lib/oauth.js +9 -18
- package/lib/path.d.ts +3 -0
- package/lib/path.js +46 -1
- package/lib/personalAccessKey.d.ts +5 -17
- package/lib/personalAccessKey.js +42 -32
- package/lib/portManager.d.ts +3 -5
- package/lib/portManager.js +18 -6
- package/lib/text.d.ts +1 -1
- package/lib/text.js +3 -0
- package/lib/trackUsage.js +13 -7
- package/models/FileSystemError.d.ts +6 -0
- package/models/FileSystemError.js +47 -0
- package/models/HubSpotHttpError.d.ts +26 -0
- package/models/HubSpotHttpError.js +208 -0
- package/models/OAuth2Manager.d.ts +2 -27
- package/models/OAuth2Manager.js +14 -29
- package/package.json +38 -35
- package/types/Accounts.d.ts +98 -3
- package/types/Apps.d.ts +77 -0
- package/types/Apps.js +2 -0
- package/types/Archive.d.ts +9 -0
- package/types/Archive.js +2 -0
- package/types/Build.d.ts +4 -2
- package/types/ComponentStructure.d.ts +30 -10
- package/types/Config.d.ts +21 -2
- package/types/Deploy.d.ts +3 -2
- package/types/DesignManager.d.ts +15 -0
- package/types/DesignManager.js +2 -0
- package/types/DevSecrets.d.ts +5 -0
- package/types/DevSecrets.js +2 -0
- package/types/Error.d.ts +9 -5
- package/types/FieldsJS.d.ts +1 -0
- package/types/FieldsJS.js +2 -0
- package/types/FileManager.d.ts +1 -1
- package/types/Files.d.ts +43 -4
- package/types/FireAlarm.d.ts +9 -0
- package/types/FireAlarm.js +2 -0
- package/types/Functions.d.ts +52 -0
- package/types/Github.d.ts +13 -0
- package/types/Http.d.ts +12 -11
- package/types/Hubdb.d.ts +9 -0
- package/types/MarketplaceValidation.d.ts +7 -3
- package/types/Migration.d.ts +30 -0
- package/types/Migration.js +12 -0
- package/types/Modules.d.ts +11 -0
- package/types/PortManager.d.ts +7 -0
- package/types/Project.d.ts +30 -0
- package/types/Sandbox.d.ts +25 -36
- package/types/Schemas.d.ts +56 -0
- package/types/Secrets.d.ts +3 -0
- package/types/Secrets.js +2 -0
- package/types/developerTestAccounts.d.ts +11 -0
- package/utils/PortManagerServer.d.ts +6 -7
- package/utils/PortManagerServer.js +15 -9
- package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
- package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
- package/utils/cms/fieldsJS.d.ts +1 -2
- package/utils/cms/modules.js +2 -2
- package/utils/detectPort.js +3 -3
- package/errors/apiErrors.d.ts +0 -25
- package/errors/apiErrors.js +0 -186
- package/errors/fileSystemErrors.d.ts +0 -6
- package/errors/fileSystemErrors.js +0 -35
- package/errors/standardErrors.d.ts +0 -21
- package/errors/standardErrors.js +0 -52
- package/lang/lang/en.json +0 -391
- package/lib/developerTestAccounts.d.ts +0 -4
- package/lib/developerTestAccounts.js +0 -35
- package/lib/sandboxes.d.ts +0 -14
- package/lib/sandboxes.js +0 -70
- package/models/HubSpotAuthError.d.ts +0 -12
- package/models/HubSpotAuthError.js +0 -20
package/types/FileManager.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export 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
|
};
|
|
@@ -69,3 +68,4 @@ export type FetchFolderResponse = {
|
|
|
69
68
|
objects: Array<Folder>;
|
|
70
69
|
total_count: number;
|
|
71
70
|
};
|
|
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 {
|
|
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
|
|
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:
|
|
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 {};
|
package/types/Functions.d.ts
CHANGED
|
@@ -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,17 @@ 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
|
+
hideLogs?: boolean;
|
|
76
|
+
};
|
|
64
77
|
export {};
|
package/types/Http.d.ts
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import { AxiosPromise, ResponseType } from 'axios';
|
|
2
6
|
import { ReadStream } from 'fs';
|
|
7
|
+
import { Stream } from 'stream';
|
|
8
|
+
export type HubSpotPromise<T = unknown> = AxiosPromise<T>;
|
|
3
9
|
export type Data = {
|
|
4
10
|
[key: string]: any;
|
|
5
11
|
};
|
|
6
12
|
export type QueryParams = {
|
|
7
13
|
[key: string]: string | number | boolean | undefined;
|
|
8
14
|
};
|
|
9
|
-
export type
|
|
15
|
+
export type FormData = {
|
|
16
|
+
[key: string]: string | ReadStream;
|
|
17
|
+
};
|
|
18
|
+
export type HttpOptions = {
|
|
10
19
|
baseURL?: string;
|
|
11
20
|
url: string;
|
|
12
21
|
env?: string;
|
|
13
22
|
localHostOverride?: boolean;
|
|
14
|
-
|
|
15
|
-
data?: Data;
|
|
23
|
+
data?: Data | string | ArrayBuffer | ArrayBufferView | URLSearchParams | Stream | Buffer;
|
|
16
24
|
resolveWithFullResponse?: boolean;
|
|
17
|
-
timeout?: number;
|
|
18
|
-
headers?: Data;
|
|
19
|
-
};
|
|
20
|
-
export type FormData = {
|
|
21
|
-
[key: string]: string | ReadStream;
|
|
22
|
-
};
|
|
23
|
-
export type HttpOptions = AxiosConfigOptions & {
|
|
24
25
|
params?: QueryParams;
|
|
25
26
|
timeout?: number;
|
|
26
|
-
responseType?:
|
|
27
|
+
responseType?: ResponseType;
|
|
27
28
|
headers?: {
|
|
28
29
|
[header: string]: string | string[] | undefined;
|
|
29
30
|
};
|
package/types/Hubdb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type Check = {
|
|
1
|
+
export type Check = {
|
|
2
2
|
check: string;
|
|
3
3
|
status: string;
|
|
4
4
|
title: string;
|
|
@@ -8,6 +8,11 @@ type Check = {
|
|
|
8
8
|
line: number | null;
|
|
9
9
|
file: string;
|
|
10
10
|
};
|
|
11
|
+
export interface ValidationError {
|
|
12
|
+
validationRequestId: number;
|
|
13
|
+
failureReasonType: string;
|
|
14
|
+
context: string;
|
|
15
|
+
}
|
|
11
16
|
export type GetValidationResultsResponse = {
|
|
12
17
|
validationRequestId: number;
|
|
13
18
|
assetPath: string;
|
|
@@ -22,7 +27,6 @@ export type GetValidationResultsResponse = {
|
|
|
22
27
|
results: Array<Check>;
|
|
23
28
|
};
|
|
24
29
|
};
|
|
25
|
-
errors: Array<
|
|
30
|
+
errors: Array<ValidationError>;
|
|
26
31
|
requestedAt: string;
|
|
27
32
|
};
|
|
28
|
-
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ValueOf } from './Utils';
|
|
2
|
+
import { ProjectStandardError } from './Project';
|
|
3
|
+
export declare const MIGRATION_STATUS: {
|
|
4
|
+
readonly BUILDING: "BUILDING";
|
|
5
|
+
readonly FAILURE: "FAILURE";
|
|
6
|
+
readonly PREPARING: "PREPARING";
|
|
7
|
+
readonly PENDING: "PENDING";
|
|
8
|
+
readonly SUCCESS: "SUCCESS";
|
|
9
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
10
|
+
readonly INPUT_REQUIRED: "INPUT_REQUIRED";
|
|
11
|
+
};
|
|
12
|
+
export type MigrateAppResponse = {
|
|
13
|
+
id: number;
|
|
14
|
+
status: ValueOf<typeof MIGRATION_STATUS>;
|
|
15
|
+
};
|
|
16
|
+
export type CloneAppResponse = {
|
|
17
|
+
exportId: number;
|
|
18
|
+
status: ValueOf<typeof MIGRATION_STATUS>;
|
|
19
|
+
};
|
|
20
|
+
export type PollAppResponse = {
|
|
21
|
+
id: number;
|
|
22
|
+
project?: {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
buildId: number;
|
|
26
|
+
deployId: number;
|
|
27
|
+
};
|
|
28
|
+
error: ProjectStandardError | null;
|
|
29
|
+
status: ValueOf<typeof MIGRATION_STATUS>;
|
|
30
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MIGRATION_STATUS = void 0;
|
|
4
|
+
exports.MIGRATION_STATUS = {
|
|
5
|
+
BUILDING: 'BUILDING',
|
|
6
|
+
FAILURE: 'FAILURE',
|
|
7
|
+
PREPARING: 'PREPARING',
|
|
8
|
+
PENDING: 'PENDING',
|
|
9
|
+
SUCCESS: 'SUCCESS',
|
|
10
|
+
IN_PROGRESS: 'IN_PROGRESS',
|
|
11
|
+
INPUT_REQUIRED: 'INPUT_REQUIRED',
|
|
12
|
+
};
|
package/types/Modules.d.ts
CHANGED
|
@@ -3,3 +3,14 @@ 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
|
+
availableForNewContent: boolean;
|
|
16
|
+
};
|
package/types/PortManager.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/types/Project.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Build } from './Build';
|
|
2
2
|
import { GithubSourceData } from './Github';
|
|
3
|
+
import { ProjectLog } from './ProjectLog';
|
|
3
4
|
export type Project = {
|
|
4
5
|
createdAt: number;
|
|
5
6
|
deletedAt: number;
|
|
@@ -33,6 +34,35 @@ export type UploadProjectResponse = {
|
|
|
33
34
|
};
|
|
34
35
|
};
|
|
35
36
|
};
|
|
37
|
+
export type UploadIRResponse = {
|
|
38
|
+
buildId?: number;
|
|
39
|
+
createdBuildId: number;
|
|
40
|
+
};
|
|
36
41
|
export type ProjectSettings = {
|
|
37
42
|
isAutoDeployEnabled: boolean;
|
|
38
43
|
};
|
|
44
|
+
export type FetchPlatformVersionResponse = {
|
|
45
|
+
defaultPlatformVersion: string;
|
|
46
|
+
activePlatformVersions: Array<string>;
|
|
47
|
+
};
|
|
48
|
+
export type ProjectStandardError = {
|
|
49
|
+
status: string;
|
|
50
|
+
id?: string;
|
|
51
|
+
category: string;
|
|
52
|
+
subCategory?: string;
|
|
53
|
+
message?: string;
|
|
54
|
+
errors?: Array<{
|
|
55
|
+
message: string;
|
|
56
|
+
in?: string;
|
|
57
|
+
code?: string;
|
|
58
|
+
subcateogy?: string;
|
|
59
|
+
context: object;
|
|
60
|
+
}>;
|
|
61
|
+
context: object;
|
|
62
|
+
links: {
|
|
63
|
+
[key: string]: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export type WarnLogsResponse = {
|
|
67
|
+
logs: Array<ProjectLog>;
|
|
68
|
+
};
|
package/types/Sandbox.d.ts
CHANGED
|
@@ -47,13 +47,13 @@ type MutationError = {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
type
|
|
50
|
+
type SyncMutationData = {
|
|
51
51
|
numRequests: number;
|
|
52
52
|
numSuccesses: number;
|
|
53
53
|
errors: Array<TaskError>;
|
|
54
54
|
mutationErrors: Array<MutationError>;
|
|
55
55
|
};
|
|
56
|
-
export type
|
|
56
|
+
export type CompositeSyncTask = {
|
|
57
57
|
id: string;
|
|
58
58
|
parentHubId: number;
|
|
59
59
|
sandboxHubId: number;
|
|
@@ -70,12 +70,29 @@ export type Task = {
|
|
|
70
70
|
startedAt: string;
|
|
71
71
|
completedAt: string;
|
|
72
72
|
error: MutationError;
|
|
73
|
-
creates:
|
|
74
|
-
updates:
|
|
75
|
-
deletes:
|
|
73
|
+
creates: SyncMutationData;
|
|
74
|
+
updates: SyncMutationData;
|
|
75
|
+
deletes: SyncMutationData;
|
|
76
76
|
diffSummary: string;
|
|
77
77
|
portableKeys: Array<string>;
|
|
78
78
|
};
|
|
79
|
+
export type SyncTask = {
|
|
80
|
+
id: string;
|
|
81
|
+
parentHubId: number;
|
|
82
|
+
sandboxHubId: number;
|
|
83
|
+
fromHubId: number;
|
|
84
|
+
toHubId: number;
|
|
85
|
+
command: string;
|
|
86
|
+
status: string;
|
|
87
|
+
result: string;
|
|
88
|
+
sandboxType: string;
|
|
89
|
+
requestedAt: string;
|
|
90
|
+
requestedByUserId: number;
|
|
91
|
+
requestedByUser: User;
|
|
92
|
+
startedAt: string;
|
|
93
|
+
completedAt: string;
|
|
94
|
+
tasks: Array<CompositeSyncTask>;
|
|
95
|
+
};
|
|
79
96
|
export type Sandbox = {
|
|
80
97
|
sandboxHubId: number;
|
|
81
98
|
parentHubId: number;
|
|
@@ -88,23 +105,7 @@ export type Sandbox = {
|
|
|
88
105
|
domain: string;
|
|
89
106
|
createdByUser: User;
|
|
90
107
|
updatedByUser?: User | null;
|
|
91
|
-
lastSync?:
|
|
92
|
-
id: string;
|
|
93
|
-
parentHubId: number;
|
|
94
|
-
sandboxHubId: number;
|
|
95
|
-
fromHubId: number;
|
|
96
|
-
toHubId: number;
|
|
97
|
-
command: string;
|
|
98
|
-
status: string;
|
|
99
|
-
result: string;
|
|
100
|
-
sandboxType: string;
|
|
101
|
-
requestedAt: string;
|
|
102
|
-
requestedByUserId: number;
|
|
103
|
-
requestedByUser: User;
|
|
104
|
-
startedAt: string;
|
|
105
|
-
completedAt: string;
|
|
106
|
-
tasks: Array<Task>;
|
|
107
|
-
};
|
|
108
|
+
lastSync?: SyncTask;
|
|
108
109
|
currentUserHasAccess?: boolean;
|
|
109
110
|
currentUserHasSuperAdminAccess?: boolean;
|
|
110
111
|
requestAccessFrom?: User | null;
|
|
@@ -129,26 +130,14 @@ export type Usage = {
|
|
|
129
130
|
export type SandboxUsageLimitsResponse = {
|
|
130
131
|
usage: Usage;
|
|
131
132
|
};
|
|
132
|
-
export type
|
|
133
|
+
export type TaskRequestData = {
|
|
133
134
|
type: string;
|
|
134
135
|
};
|
|
135
136
|
export type InitiateSyncResponse = {
|
|
136
137
|
links: {
|
|
137
138
|
status: string;
|
|
138
139
|
};
|
|
139
|
-
sync:
|
|
140
|
-
id: string;
|
|
141
|
-
parentHubId: number;
|
|
142
|
-
sandboxHubId: number;
|
|
143
|
-
fromHubId: number;
|
|
144
|
-
toHubId: number;
|
|
145
|
-
command: string;
|
|
146
|
-
status: string;
|
|
147
|
-
sandboxType: string;
|
|
148
|
-
requestedAt: string;
|
|
149
|
-
requestedByUserId: number;
|
|
150
|
-
tasks: Array<Task>;
|
|
151
|
-
};
|
|
140
|
+
sync: SyncTask;
|
|
152
141
|
id: string;
|
|
153
142
|
};
|
|
154
143
|
export type SandboxType = {
|
package/types/Schemas.d.ts
CHANGED
|
@@ -25,3 +25,59 @@ 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
|
+
};
|
|
40
|
+
export type SchemaDefinition = {
|
|
41
|
+
allowsSensitiveProperties?: boolean;
|
|
42
|
+
associatedObjects?: Array<string>;
|
|
43
|
+
description?: string;
|
|
44
|
+
labels: {
|
|
45
|
+
plural: string;
|
|
46
|
+
singular: string;
|
|
47
|
+
};
|
|
48
|
+
searchableProperties?: Array<string>;
|
|
49
|
+
secondaryDisplayProperties?: Array<string>;
|
|
50
|
+
name: string;
|
|
51
|
+
primaryDisplayProperty?: string;
|
|
52
|
+
properties: [
|
|
53
|
+
{
|
|
54
|
+
isPrimaryDisplayLabel: true;
|
|
55
|
+
label: string;
|
|
56
|
+
name: string;
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
requiredProperties: Array<string>;
|
|
60
|
+
};
|
|
61
|
+
export type ObjectDefinition = {
|
|
62
|
+
inputs: [
|
|
63
|
+
{
|
|
64
|
+
associations?: [
|
|
65
|
+
{
|
|
66
|
+
types: [
|
|
67
|
+
{
|
|
68
|
+
associationCategory: string;
|
|
69
|
+
associationTypeId: number;
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
to: {
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
objectWriteTraceId?: number;
|
|
78
|
+
properties: {
|
|
79
|
+
[key: string]: string;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
];
|
|
83
|
+
};
|
package/types/Secrets.js
ADDED
|
@@ -5,6 +5,17 @@ export type DeveloperTestAccount = {
|
|
|
5
5
|
createdAt: string;
|
|
6
6
|
updatedAt: string;
|
|
7
7
|
status: string;
|
|
8
|
+
id: number;
|
|
9
|
+
};
|
|
10
|
+
export type CreateDeveloperTestAccountResponse = {
|
|
11
|
+
id: number;
|
|
12
|
+
accountName: string;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
trialEndsAt: string;
|
|
16
|
+
status: string;
|
|
17
|
+
currentUserHasAccess: boolean;
|
|
18
|
+
personalAccessKey: string;
|
|
8
19
|
};
|
|
9
20
|
export type FetchDeveloperTestAccountsResponse = {
|
|
10
21
|
results: DeveloperTestAccount[];
|
|
@@ -1,11 +1,10 @@
|
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare class PortManagerServer {
|
|
4
|
+
import { RequestPortsData, ServerPortMap } from '../types/PortManager';
|
|
5
|
+
export declare const HEALTH_CHECK_PATH = "/port-manager-health-check";
|
|
6
|
+
export declare const SERVICE_HEALTHY = "OK";
|
|
7
|
+
declare class _PortManagerServer {
|
|
9
8
|
app?: Express;
|
|
10
9
|
server?: Server;
|
|
11
10
|
serverPortMap: ServerPortMap;
|
|
@@ -25,5 +24,5 @@ declare class PortManagerServer {
|
|
|
25
24
|
deleteServerInstance: (req: Request, res: Response) => void;
|
|
26
25
|
closeServer: (req: Request, res: Response) => void;
|
|
27
26
|
}
|
|
28
|
-
declare const
|
|
29
|
-
export
|
|
27
|
+
export declare const PortManagerServer: _PortManagerServer;
|
|
28
|
+
export {};
|
|
@@ -3,15 +3,18 @@ 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.PortManagerServer = exports.SERVICE_HEALTHY = exports.HEALTH_CHECK_PATH = void 0;
|
|
6
7
|
const express_1 = __importDefault(require("express"));
|
|
7
8
|
const cors_1 = __importDefault(require("cors"));
|
|
8
9
|
const detectPort_1 = require("./detectPort");
|
|
9
10
|
const ports_1 = require("../constants/ports");
|
|
10
|
-
const
|
|
11
|
+
const errors_1 = require("../errors");
|
|
11
12
|
const logger_1 = require("../lib/logger");
|
|
12
13
|
const lang_1 = require("./lang");
|
|
13
14
|
const i18nKey = 'utils.PortManagerServer';
|
|
14
|
-
|
|
15
|
+
exports.HEALTH_CHECK_PATH = '/port-manager-health-check';
|
|
16
|
+
exports.SERVICE_HEALTHY = 'OK';
|
|
17
|
+
class _PortManagerServer {
|
|
15
18
|
app;
|
|
16
19
|
server;
|
|
17
20
|
serverPortMap;
|
|
@@ -20,7 +23,7 @@ class PortManagerServer {
|
|
|
20
23
|
}
|
|
21
24
|
async init() {
|
|
22
25
|
if (this.app) {
|
|
23
|
-
(0,
|
|
26
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.duplicateInstance`));
|
|
24
27
|
}
|
|
25
28
|
this.app = (0, express_1.default)();
|
|
26
29
|
this.app.use(express_1.default.json());
|
|
@@ -28,15 +31,15 @@ class PortManagerServer {
|
|
|
28
31
|
this.setupRoutes();
|
|
29
32
|
try {
|
|
30
33
|
this.server = await this.listen();
|
|
34
|
+
logger_1.logger.debug(this.server);
|
|
31
35
|
}
|
|
32
36
|
catch (e) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.portInUse`, {
|
|
37
|
+
if ((0, errors_1.isSystemError)(e) && e.code === 'EADDRINUSE') {
|
|
38
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.portInUse`, {
|
|
36
39
|
port: ports_1.PORT_MANAGER_SERVER_PORT,
|
|
37
|
-
},
|
|
40
|
+
}), { cause: e });
|
|
38
41
|
}
|
|
39
|
-
throw
|
|
42
|
+
throw e;
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
reset() {
|
|
@@ -65,6 +68,9 @@ class PortManagerServer {
|
|
|
65
68
|
this.app.post('/servers', this.assignPortsToServers);
|
|
66
69
|
this.app.delete('/servers/:instanceId', this.deleteServerInstance);
|
|
67
70
|
this.app.post('/close', this.closeServer);
|
|
71
|
+
this.app.use(exports.HEALTH_CHECK_PATH, (req, res) => {
|
|
72
|
+
res.status(200).send({ status: exports.SERVICE_HEALTHY });
|
|
73
|
+
});
|
|
68
74
|
}
|
|
69
75
|
setPort(instanceId, port) {
|
|
70
76
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.setPort`, { instanceId, port }));
|
|
@@ -155,4 +161,4 @@ class PortManagerServer {
|
|
|
155
161
|
}
|
|
156
162
|
};
|
|
157
163
|
}
|
|
158
|
-
exports.
|
|
164
|
+
exports.PortManagerServer = new _PortManagerServer();
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { CLIAccount } 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;
|
|
8
3
|
export declare function getAccounts(config?: CLIConfig | null): Array<CLIAccount>;
|
|
9
4
|
export declare function getDefaultAccount(config?: CLIConfig | null): string | number | undefined;
|
|
10
|
-
export {};
|