@hubspot/local-dev-lib 0.3.15 → 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 +2 -2
- package/http/getAxiosConfig.js +31 -2
- package/http/index.d.ts +10 -10
- package/http/index.js +80 -34
- 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
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import { FlatAccountFields,
|
|
2
|
-
|
|
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
|
-
};
|
|
26
|
-
declare class OAuth2Manager {
|
|
1
|
+
import { FlatAccountFields, OAuth2ManagerAccountConfig, WriteTokenInfoFunction, RefreshTokenResponse, ExchangeProof } from '../types/Accounts';
|
|
2
|
+
export declare class OAuth2Manager {
|
|
27
3
|
account: OAuth2ManagerAccountConfig;
|
|
28
4
|
writeTokenInfo?: WriteTokenInfoFunction;
|
|
29
5
|
refreshTokenRequest: Promise<RefreshTokenResponse> | null;
|
|
@@ -34,4 +10,3 @@ declare class OAuth2Manager {
|
|
|
34
10
|
refreshAccessToken(): Promise<void>;
|
|
35
11
|
static fromConfig(accountConfig: FlatAccountFields, writeTokenInfo: WriteTokenInfoFunction): OAuth2Manager;
|
|
36
12
|
}
|
|
37
|
-
export default OAuth2Manager;
|
package/models/OAuth2Manager.js
CHANGED
|
@@ -3,14 +3,14 @@ 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.OAuth2Manager = void 0;
|
|
6
7
|
const axios_1 = __importDefault(require("axios"));
|
|
7
8
|
const moment_1 = __importDefault(require("moment"));
|
|
8
9
|
const urls_1 = require("../lib/urls");
|
|
9
10
|
const environment_1 = require("../lib/environment");
|
|
10
11
|
const logger_1 = require("../lib/logger");
|
|
11
|
-
const getAccountIdentifier_1 = require("../
|
|
12
|
+
const getAccountIdentifier_1 = require("../config/getAccountIdentifier");
|
|
12
13
|
const auth_1 = require("../constants/auth");
|
|
13
|
-
const standardErrors_1 = require("../errors/standardErrors");
|
|
14
14
|
const lang_1 = require("../utils/lang");
|
|
15
15
|
const i18nKey = 'models.OAuth2Manager';
|
|
16
16
|
class OAuth2Manager {
|
|
@@ -27,9 +27,9 @@ class OAuth2Manager {
|
|
|
27
27
|
}
|
|
28
28
|
async accessToken() {
|
|
29
29
|
if (!this.account.tokenInfo?.refreshToken) {
|
|
30
|
-
(0,
|
|
30
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.missingRefreshToken`, {
|
|
31
31
|
accountId: (0, getAccountIdentifier_1.getAccountIdentifier)(this.account),
|
|
32
|
-
});
|
|
32
|
+
}));
|
|
33
33
|
}
|
|
34
34
|
if (!this.account.tokenInfo?.accessToken ||
|
|
35
35
|
(0, moment_1.default)()
|
|
@@ -68,36 +68,21 @@ class OAuth2Manager {
|
|
|
68
68
|
}));
|
|
69
69
|
this.writeTokenInfo(this.account.tokenInfo);
|
|
70
70
|
}
|
|
71
|
-
this.refreshTokenRequest = null;
|
|
72
71
|
}
|
|
73
|
-
|
|
72
|
+
finally {
|
|
74
73
|
this.refreshTokenRequest = null;
|
|
75
|
-
(0, standardErrors_1.throwError)(e);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
76
|
async exchangeForTokens(exchangeProof) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
await this.refreshTokenRequest;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
await this.fetchAccessToken(exchangeProof);
|
|
89
|
-
}
|
|
77
|
+
if (this.refreshTokenRequest) {
|
|
78
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.refreshingAccessToken`, {
|
|
79
|
+
accountId: (0, getAccountIdentifier_1.getAccountIdentifier)(this.account),
|
|
80
|
+
clientId: this.account.clientId || '',
|
|
81
|
+
}));
|
|
82
|
+
await this.refreshTokenRequest;
|
|
90
83
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (error.response) {
|
|
94
|
-
(0, standardErrors_1.throwAuthErrorWithMessage)(`${i18nKey}.errors.auth`, {
|
|
95
|
-
token: error.response.data.message || '',
|
|
96
|
-
}, error);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
(0, standardErrors_1.throwError)(error);
|
|
100
|
-
}
|
|
84
|
+
else {
|
|
85
|
+
await this.fetchAccessToken(exchangeProof);
|
|
101
86
|
}
|
|
102
87
|
}
|
|
103
88
|
async refreshAccessToken() {
|
|
@@ -117,4 +102,4 @@ class OAuth2Manager {
|
|
|
117
102
|
}, writeTokenInfo);
|
|
118
103
|
}
|
|
119
104
|
}
|
|
120
|
-
exports.
|
|
105
|
+
exports.OAuth2Manager = OAuth2Manager;
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/local-dev-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-experimental.0",
|
|
4
4
|
"description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
5
|
"repository": {
|
|
7
6
|
"type": "git",
|
|
8
7
|
"url": "https://github.com/HubSpot/hubspot-local-dev-lib"
|
|
@@ -12,22 +11,16 @@
|
|
|
12
11
|
"access": "public"
|
|
13
12
|
},
|
|
14
13
|
"scripts": {
|
|
15
|
-
"build": "
|
|
16
|
-
"
|
|
17
|
-
"clear-postinstall": "cd dist && npm pkg delete scripts.postinstall",
|
|
18
|
-
"copy-files": "cp -r lang dist/lang",
|
|
19
|
-
"lint": "eslint --max-warnings=0 . && prettier --check ./**/*.ts",
|
|
14
|
+
"build": "ts-node ./scripts/build.ts",
|
|
15
|
+
"lint": "eslint --max-warnings=0 . && prettier . --check",
|
|
20
16
|
"local-dev": "yarn build && cd dist && yarn link && cd .. && tsc --watch --rootDir . --outdir dist",
|
|
21
|
-
"prettier:write": "prettier --write
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"release:major": "yarn check-main && yarn version --major && yarn build && yarn pub && yarn push",
|
|
25
|
-
"release:minor": "yarn check-main && yarn version --minor && yarn build && yarn pub && yarn push",
|
|
26
|
-
"release:patch": "yarn check-main && yarn version --patch && yarn build && yarn pub && yarn push",
|
|
27
|
-
"test": "node --experimental-vm-modules ./node_modules/.bin/jest"
|
|
17
|
+
"prettier:write": "prettier . --write",
|
|
18
|
+
"release": "ts-node ./scripts/release.ts release",
|
|
19
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ./node_modules/.bin/jest"
|
|
28
20
|
},
|
|
29
21
|
"license": "Apache-2.0",
|
|
30
22
|
"devDependencies": {
|
|
23
|
+
"@inquirer/prompts": "^7.0.1",
|
|
31
24
|
"@types/content-disposition": "^0.5.5",
|
|
32
25
|
"@types/cors": "^2.8.15",
|
|
33
26
|
"@types/debounce": "^1.2.1",
|
|
@@ -37,44 +30,54 @@
|
|
|
37
30
|
"@types/jest": "^29.5.0",
|
|
38
31
|
"@types/js-yaml": "^4.0.5",
|
|
39
32
|
"@types/node": "^18.14.2",
|
|
40
|
-
"@types/prettier": "^3.0.0",
|
|
41
33
|
"@types/unixify": "^1.0.0",
|
|
42
34
|
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
|
43
35
|
"@typescript-eslint/parser": "^5.59.7",
|
|
44
36
|
"eslint": "^8.35.0",
|
|
37
|
+
"eslint-plugin-import": "^2.29.1",
|
|
45
38
|
"husky": "^8.0.0",
|
|
46
39
|
"jest": "^29.5.0",
|
|
40
|
+
"open": "^8.4.2",
|
|
47
41
|
"ts-jest": "^29.0.5",
|
|
48
|
-
"
|
|
42
|
+
"ts-node": "^10.9.2",
|
|
43
|
+
"typescript": "^4.9.5",
|
|
44
|
+
"yargs": "^17.7.2"
|
|
49
45
|
},
|
|
50
46
|
"exports": {
|
|
51
47
|
"./*": "./lib/*.js",
|
|
52
48
|
"./api/*": "./api/*.js",
|
|
53
49
|
"./errors/*": "./errors/*.js",
|
|
54
50
|
"./http": "./http/index.js",
|
|
51
|
+
"./http/*": "./http/*.js",
|
|
52
|
+
"./config/getAccountIdentifier": "./config/getAccountIdentifier.js",
|
|
53
|
+
"./config/migrate": "./config/migrate.js",
|
|
55
54
|
"./config": "./config/index.js",
|
|
56
55
|
"./constants/*": "./constants/*.js",
|
|
57
|
-
"./models/*": "./models/*.js"
|
|
56
|
+
"./models/*": "./models/*.js",
|
|
57
|
+
"./types/*": {
|
|
58
|
+
"types": "./types/*.d.ts",
|
|
59
|
+
"default": "./types/*.js"
|
|
60
|
+
}
|
|
58
61
|
},
|
|
59
62
|
"dependencies": {
|
|
60
|
-
"address": "
|
|
61
|
-
"axios": "
|
|
62
|
-
"chalk": "
|
|
63
|
-
"chokidar": "
|
|
64
|
-
"content-disposition": "
|
|
65
|
-
"cors": "
|
|
66
|
-
"debounce": "
|
|
67
|
-
"express": "
|
|
68
|
-
"extract-zip": "
|
|
69
|
-
"findup-sync": "
|
|
70
|
-
"fs-extra": "
|
|
71
|
-
"ignore": "
|
|
72
|
-
"js-yaml": "
|
|
73
|
-
"moment": "
|
|
74
|
-
"p-queue": "
|
|
75
|
-
"prettier": "
|
|
76
|
-
"semver": "
|
|
77
|
-
"unixify": "
|
|
63
|
+
"address": "2.0.2",
|
|
64
|
+
"axios": "1.8.4",
|
|
65
|
+
"chalk": "2.4.2",
|
|
66
|
+
"chokidar": "3.6.0",
|
|
67
|
+
"content-disposition": "0.5.4",
|
|
68
|
+
"cors": "2.8.5",
|
|
69
|
+
"debounce": "1.2.1",
|
|
70
|
+
"express": "4.21.2",
|
|
71
|
+
"extract-zip": "2.0.1",
|
|
72
|
+
"findup-sync": "5.0.0",
|
|
73
|
+
"fs-extra": "11.2.0",
|
|
74
|
+
"ignore": "5.3.1",
|
|
75
|
+
"js-yaml": "4.1.0",
|
|
76
|
+
"moment": "2.30.1",
|
|
77
|
+
"p-queue": "6.6.2",
|
|
78
|
+
"prettier": "3.3.1",
|
|
79
|
+
"semver": "6.3.1",
|
|
80
|
+
"unixify": "1.0.0"
|
|
78
81
|
},
|
|
79
82
|
"engines": {
|
|
80
83
|
"node": ">=16.20.0"
|
package/types/Accounts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HUBSPOT_ACCOUNT_TYPES } from '../constants/config';
|
|
2
|
-
import {
|
|
2
|
+
import { CmsPublishMode } from './Files';
|
|
3
3
|
import { Environment } from './Config';
|
|
4
4
|
import { ValueOf } from './Utils';
|
|
5
5
|
export type AuthType = 'personalaccesskey' | 'apikey' | 'oauth2';
|
|
@@ -7,11 +7,13 @@ export interface CLIAccount_NEW {
|
|
|
7
7
|
name?: string;
|
|
8
8
|
accountId: number;
|
|
9
9
|
accountType?: AccountType;
|
|
10
|
-
|
|
10
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
11
11
|
env: Environment;
|
|
12
12
|
authType?: AuthType;
|
|
13
13
|
auth?: {
|
|
14
14
|
tokenInfo?: TokenInfo;
|
|
15
|
+
clientId?: string;
|
|
16
|
+
clientSecret?: string;
|
|
15
17
|
};
|
|
16
18
|
sandboxAccountType?: string | null;
|
|
17
19
|
parentAccountId?: number | null;
|
|
@@ -21,12 +23,14 @@ export interface CLIAccount_NEW {
|
|
|
21
23
|
export interface CLIAccount_DEPRECATED {
|
|
22
24
|
name?: string;
|
|
23
25
|
portalId?: number;
|
|
24
|
-
|
|
26
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
25
27
|
env: Environment;
|
|
26
28
|
accountType?: AccountType;
|
|
27
29
|
authType?: AuthType;
|
|
28
30
|
auth?: {
|
|
29
31
|
tokenInfo?: TokenInfo;
|
|
32
|
+
clientId?: string;
|
|
33
|
+
clientSecret?: string;
|
|
30
34
|
};
|
|
31
35
|
sandboxAccountType?: string | null;
|
|
32
36
|
parentAccountId?: number | null;
|
|
@@ -34,6 +38,10 @@ export interface CLIAccount_DEPRECATED {
|
|
|
34
38
|
personalAccessKey?: string;
|
|
35
39
|
}
|
|
36
40
|
export type CLIAccount = CLIAccount_NEW | CLIAccount_DEPRECATED;
|
|
41
|
+
export type GenericAccount = {
|
|
42
|
+
portalId?: number;
|
|
43
|
+
accountId?: number;
|
|
44
|
+
};
|
|
37
45
|
export type AccountType = ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
38
46
|
export type TokenInfo = {
|
|
39
47
|
accessToken?: string;
|
|
@@ -98,3 +106,90 @@ export type ScopeData = {
|
|
|
98
106
|
portalScopesInGroup: Array<string>;
|
|
99
107
|
userScopesInGroup: Array<string>;
|
|
100
108
|
};
|
|
109
|
+
export type ScopeAuthorizationResponse = {
|
|
110
|
+
results: Array<ScopeGroupAuthorization>;
|
|
111
|
+
};
|
|
112
|
+
export type ScopeGroupAuthorization = {
|
|
113
|
+
scopeGroup: ScopeGroup;
|
|
114
|
+
portalAuthorized: boolean;
|
|
115
|
+
userAuthorized: boolean;
|
|
116
|
+
};
|
|
117
|
+
export type ScopeGroup = {
|
|
118
|
+
name: string;
|
|
119
|
+
shortDescription: string;
|
|
120
|
+
longDescription: string;
|
|
121
|
+
};
|
|
122
|
+
export type AccessTokenResponse = {
|
|
123
|
+
hubId: number;
|
|
124
|
+
userId: number;
|
|
125
|
+
oauthAccessToken: string;
|
|
126
|
+
expiresAtMillis: number;
|
|
127
|
+
enabledFeatures?: {
|
|
128
|
+
[key: string]: number;
|
|
129
|
+
};
|
|
130
|
+
scopeGroups: Array<string>;
|
|
131
|
+
encodedOAuthRefreshToken: string;
|
|
132
|
+
hubName: string;
|
|
133
|
+
accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
134
|
+
};
|
|
135
|
+
export type EnabledFeaturesResponse = {
|
|
136
|
+
enabledFeatures: {
|
|
137
|
+
[key: string]: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
export type UpdateAccountConfigOptions = Partial<FlatAccountFields_DEPRECATED> & {
|
|
141
|
+
environment?: Environment;
|
|
142
|
+
};
|
|
143
|
+
export type PersonalAccessKeyOptions = {
|
|
144
|
+
accountId: number;
|
|
145
|
+
personalAccessKey: string;
|
|
146
|
+
env: Environment;
|
|
147
|
+
};
|
|
148
|
+
export type OAuthOptions = {
|
|
149
|
+
accountId: number;
|
|
150
|
+
clientId: string;
|
|
151
|
+
clientSecret: string;
|
|
152
|
+
refreshToken: string;
|
|
153
|
+
scopes: Array<string>;
|
|
154
|
+
env: Environment;
|
|
155
|
+
};
|
|
156
|
+
export type APIKeyOptions = {
|
|
157
|
+
accountId: number;
|
|
158
|
+
apiKey: string;
|
|
159
|
+
env: Environment;
|
|
160
|
+
};
|
|
161
|
+
export type AccessToken = {
|
|
162
|
+
portalId: number;
|
|
163
|
+
accessToken: string;
|
|
164
|
+
expiresAt: string;
|
|
165
|
+
scopeGroups: Array<string>;
|
|
166
|
+
enabledFeatures?: {
|
|
167
|
+
[key: string]: number;
|
|
168
|
+
};
|
|
169
|
+
encodedOAuthRefreshToken: string;
|
|
170
|
+
hubName: string;
|
|
171
|
+
accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
172
|
+
};
|
|
173
|
+
export type OAuth2ManagerAccountConfig = {
|
|
174
|
+
name?: string;
|
|
175
|
+
accountId?: number;
|
|
176
|
+
clientId?: string;
|
|
177
|
+
clientSecret?: string;
|
|
178
|
+
scopes?: Array<string>;
|
|
179
|
+
env?: Environment;
|
|
180
|
+
environment?: Environment;
|
|
181
|
+
tokenInfo?: TokenInfo;
|
|
182
|
+
authType?: 'oauth2';
|
|
183
|
+
};
|
|
184
|
+
export type WriteTokenInfoFunction = (tokenInfo: TokenInfo) => void;
|
|
185
|
+
export type RefreshTokenResponse = {
|
|
186
|
+
refresh_token: string;
|
|
187
|
+
access_token: string;
|
|
188
|
+
expires_in: string;
|
|
189
|
+
};
|
|
190
|
+
export type ExchangeProof = {
|
|
191
|
+
grant_type: string;
|
|
192
|
+
client_id?: string;
|
|
193
|
+
client_secret?: string;
|
|
194
|
+
refresh_token?: string;
|
|
195
|
+
};
|
package/types/Apps.d.ts
ADDED
|
@@ -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
|
+
};
|
package/types/Apps.js
ADDED
package/types/Archive.js
ADDED
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 {
|
|
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
|
|
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
|
|
10
|
-
|
|
9
|
+
export type ProjectComponentsMetadata = {
|
|
10
|
+
topLevelComponentMetadata: TopLevelComponents[];
|
|
11
|
+
};
|
|
12
|
+
export interface ComponentMetadata<T> {
|
|
11
13
|
componentName: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
appId: string;
|
|
14
|
+
type: {
|
|
15
|
+
name: T;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
export
|
|
19
|
-
|
|
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,14 @@
|
|
|
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;
|
|
8
|
+
allowAutoUpdates?: boolean;
|
|
7
9
|
defaultAccount?: string | number;
|
|
8
|
-
defaultMode?:
|
|
10
|
+
defaultMode?: CmsPublishMode;
|
|
11
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
9
12
|
httpTimeout?: number;
|
|
10
13
|
env?: Environment;
|
|
11
14
|
httpUseLocalhost?: boolean;
|
|
@@ -13,11 +16,27 @@ export interface CLIConfig_NEW {
|
|
|
13
16
|
export interface CLIConfig_DEPRECATED {
|
|
14
17
|
portals: Array<CLIAccount_DEPRECATED>;
|
|
15
18
|
allowUsageTracking?: boolean;
|
|
19
|
+
allowAutoUpdates?: boolean;
|
|
16
20
|
defaultPortal?: string | number;
|
|
17
|
-
defaultMode?:
|
|
21
|
+
defaultMode?: CmsPublishMode;
|
|
22
|
+
defaultCmsPublishMode?: CmsPublishMode;
|
|
18
23
|
httpTimeout?: number;
|
|
19
24
|
env?: Environment;
|
|
20
25
|
httpUseLocalhost?: boolean;
|
|
21
26
|
}
|
|
22
27
|
export type CLIConfig = CLIConfig_NEW | CLIConfig_DEPRECATED;
|
|
23
28
|
export type Environment = ValueOf<typeof ENVIRONMENTS> | '';
|
|
29
|
+
export type EnvironmentConfigVariables = {
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
clientId?: string;
|
|
32
|
+
clientSecret?: string;
|
|
33
|
+
personalAccessKey?: string;
|
|
34
|
+
accountId?: number;
|
|
35
|
+
refreshToken?: string;
|
|
36
|
+
env?: Environment;
|
|
37
|
+
};
|
|
38
|
+
export type GitInclusionResult = {
|
|
39
|
+
inGit: boolean;
|
|
40
|
+
configIgnored: boolean;
|
|
41
|
+
gitignoreFiles: Array<string>;
|
|
42
|
+
};
|
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 {
|
|
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
|
|
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,15 @@
|
|
|
1
|
+
export type FetchThemesResponse = {
|
|
2
|
+
limit: number;
|
|
3
|
+
offset: number;
|
|
4
|
+
total: number;
|
|
5
|
+
totalHubSpotThemes: number;
|
|
6
|
+
totalUsedThemes: number;
|
|
7
|
+
objects: Array<{
|
|
8
|
+
theme: {
|
|
9
|
+
path: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export type FetchBuiltinMappingResponse = {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
};
|
package/types/Error.d.ts
CHANGED
|
@@ -16,18 +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
24
|
filepath?: string;
|
|
22
|
-
|
|
23
|
-
read?: boolean;
|
|
25
|
+
operation?: 'write' | 'read';
|
|
24
26
|
accountId?: number;
|
|
25
27
|
dest?: string;
|
|
26
28
|
};
|
|
27
|
-
export
|
|
28
|
-
accountId?: number;
|
|
29
|
+
export interface HubSpotHttpErrorContext extends FileSystemErrorContext {
|
|
29
30
|
request?: string;
|
|
30
31
|
payload?: string;
|
|
31
32
|
projectName?: string;
|
|
32
|
-
}
|
|
33
|
+
}
|
|
33
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>>;
|