@hubspot/cli 7.0.0-experimental.0 → 7.0.0-experimental.2
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/bin/cli.js +73 -12
- package/bin/hs +2 -0
- package/bin/hscms +2 -0
- package/bin/silenceErrors.d.ts +2 -0
- package/bin/silenceErrors.js +12 -0
- package/commands/account/clean.js +0 -2
- package/commands/account/info.js +0 -2
- package/commands/account/list.js +2 -5
- package/commands/account/remove.js +4 -7
- package/commands/account/rename.js +0 -2
- package/commands/account/use.js +3 -6
- package/commands/auth.js +2 -3
- package/commands/cms/lighthouseScore.js +0 -2
- package/commands/config/set.js +0 -2
- package/commands/create.js +2 -1
- package/commands/customObject/create.js +1 -2
- package/commands/customObject/schema/create.js +1 -2
- package/commands/customObject/schema/delete.js +0 -2
- package/commands/customObject/schema/fetch-all.js +0 -2
- package/commands/customObject/schema/fetch.js +0 -2
- package/commands/customObject/schema/list.js +0 -2
- package/commands/customObject/schema/update.js +1 -2
- package/commands/doctor.js +2 -2
- package/commands/fetch.js +2 -3
- package/commands/filemanager/fetch.js +0 -2
- package/commands/filemanager/upload.js +0 -2
- package/commands/filemanager.js +1 -4
- package/commands/function/deploy.js +0 -2
- package/commands/function/list.js +0 -2
- package/commands/function/server.js +0 -2
- package/commands/function.js +1 -5
- package/commands/hubdb/clear.js +0 -2
- package/commands/hubdb/create.js +1 -2
- package/commands/hubdb/delete.js +0 -2
- package/commands/hubdb/fetch.js +0 -2
- package/commands/lint.js +0 -2
- package/commands/list.js +0 -2
- package/commands/logs.js +0 -2
- package/commands/module/marketplace-validate.js +0 -2
- package/commands/mv.js +0 -2
- package/commands/project/add.js +0 -2
- package/commands/project/cloneApp.js +0 -2
- package/commands/project/create.js +0 -2
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev.js +7 -8
- package/commands/project/download.js +0 -2
- package/commands/project/listBuilds.js +2 -3
- package/commands/project/logs.js +1 -3
- package/commands/project/migrateApp.js +0 -2
- package/commands/project/open.js +2 -3
- package/commands/project/upload.js +3 -3
- package/commands/project/watch.js +5 -5
- package/commands/remove.js +0 -2
- package/commands/sandbox/create.js +0 -2
- package/commands/sandbox/delete.js +6 -9
- package/commands/sandbox.js +1 -4
- package/commands/secret/addSecret.js +1 -3
- package/commands/secret/deleteSecret.js +1 -3
- package/commands/secret/listSecrets.js +1 -3
- package/commands/secret/updateSecret.js +1 -3
- package/commands/theme/marketplace-validate.js +0 -2
- package/commands/theme/preview.js +1 -3
- package/commands/upload.js +6 -4
- package/commands/watch.js +2 -3
- package/lang/en.lyaml +25 -17
- package/lib/DevServerManager.js +1 -1
- package/lib/LocalDevManager.js +4 -4
- package/lib/buildAccount.js +2 -10
- package/lib/commonOpts.js +0 -1
- package/lib/configOptions.d.ts +13 -1
- package/lib/configOptions.js +46 -50
- package/lib/constants.d.ts +1 -4
- package/lib/dependencyManagement.d.ts +4 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/developerTestAccounts.d.ts +5 -1
- package/lib/developerTestAccounts.js +44 -41
- package/lib/doctor/DiagnosticInfoBuilder.js +8 -4
- package/lib/doctor/Doctor.js +11 -6
- package/lib/generateSelectors.d.ts +19 -0
- package/lib/generateSelectors.js +23 -23
- package/lib/localDev.js +3 -2
- package/lib/marketplaceValidate.d.ts +6 -1
- package/lib/marketplaceValidate.js +76 -77
- package/lib/oauth.d.ts +2 -1
- package/lib/oauth.js +49 -39
- package/lib/polling.d.ts +8 -0
- package/lib/polling.js +9 -12
- package/lib/projects/ProjectLogsManager.d.ts +20 -0
- package/lib/projects/ProjectLogsManager.js +105 -0
- package/lib/projects/buildAndDeploy.d.ts +16 -0
- package/lib/projects/buildAndDeploy.js +342 -0
- package/lib/projects/index.d.ts +24 -0
- package/lib/projects/index.js +256 -0
- package/lib/projects/structure.d.ts +78 -0
- package/lib/projects/structure.js +151 -0
- package/lib/projects/upload.d.ts +8 -0
- package/lib/projects/upload.js +107 -0
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +27 -0
- package/lib/{projectsWatch.js → projects/watch.js} +3 -3
- package/lib/prompts/accountNamePrompt.d.ts +11 -0
- package/lib/prompts/accountNamePrompt.js +45 -46
- package/lib/prompts/accountsPrompt.d.ts +1 -1
- package/lib/prompts/accountsPrompt.js +19 -21
- package/lib/prompts/cmsFieldPrompt.d.ts +1 -1
- package/lib/prompts/cmsFieldPrompt.js +23 -24
- package/lib/prompts/createApiSamplePrompt.d.ts +17 -0
- package/lib/prompts/createApiSamplePrompt.js +47 -44
- package/lib/prompts/createFunctionPrompt.d.ts +7 -0
- package/lib/prompts/createFunctionPrompt.js +17 -20
- package/lib/prompts/createModulePrompt.d.ts +8 -0
- package/lib/prompts/createModulePrompt.js +13 -16
- package/lib/prompts/createProjectPrompt.d.ts +13 -0
- package/lib/prompts/createProjectPrompt.js +46 -47
- package/lib/prompts/createTemplatePrompt.d.ts +8 -0
- package/lib/prompts/createTemplatePrompt.js +15 -17
- package/lib/prompts/downloadProjectPrompt.d.ts +8 -0
- package/lib/prompts/downloadProjectPrompt.js +25 -23
- package/lib/prompts/installPublicAppPrompt.d.ts +1 -1
- package/lib/prompts/installPublicAppPrompt.js +21 -19
- package/lib/prompts/personalAccessKeyPrompt.d.ts +28 -0
- package/lib/prompts/personalAccessKeyPrompt.js +46 -52
- package/lib/prompts/previewPrompt.d.ts +14 -0
- package/lib/prompts/previewPrompt.js +24 -24
- package/lib/prompts/projectAddPrompt.d.ts +9 -0
- package/lib/prompts/projectAddPrompt.js +11 -14
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +87 -70
- package/lib/prompts/projectsLogsPrompt.d.ts +11 -0
- package/lib/prompts/projectsLogsPrompt.js +8 -11
- package/lib/prompts/promptUtils.d.ts +5 -7
- package/lib/prompts/promptUtils.js +8 -7
- package/lib/prompts/sandboxesPrompt.d.ts +8 -0
- package/lib/prompts/sandboxesPrompt.js +41 -46
- package/lib/prompts/secretPrompt.d.ts +13 -3
- package/lib/prompts/selectHubDBTablePrompt.d.ts +5 -1
- package/lib/prompts/selectPublicAppPrompt.d.ts +8 -0
- package/lib/prompts/selectPublicAppPrompt.js +28 -27
- package/lib/prompts/setAsDefaultAccountPrompt.d.ts +1 -1
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -14
- package/lib/prompts/uploadPrompt.d.ts +8 -0
- package/lib/prompts/uploadPrompt.js +18 -18
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/usageTracking.d.ts +21 -2
- package/lib/usageTracking.js +53 -81
- package/lib/validation.d.ts +11 -1
- package/lib/validation.js +92 -86
- package/package.json +11 -6
- package/types/Projects.d.ts +43 -0
- package/types/Projects.js +2 -0
- package/types/Prompts.d.ts +25 -0
- package/types/Prompts.js +2 -0
- package/lib/ProjectLogsManager.js +0 -91
- package/lib/projectStructure.d.ts +0 -1
- package/lib/projectStructure.js +0 -116
- package/lib/projects.d.ts +0 -4
- package/lib/projects.js +0 -686
- package/lib/projectsWatch.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.d.ts +0 -1
- package/lib/prompts/cleanUploadPrompt.js +0 -20
- /package/lib/{ProjectLogsManager.d.ts → projects/watch.d.ts} +0 -0
package/lib/oauth.js
CHANGED
|
@@ -1,39 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
6
|
+
exports.authenticateWithOauth = authenticateWithOauth;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const open_1 = __importDefault(require("open"));
|
|
9
|
+
const OAuth2Manager_1 = require("@hubspot/local-dev-lib/models/OAuth2Manager");
|
|
10
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
+
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
12
|
+
const oauth_1 = require("@hubspot/local-dev-lib/oauth");
|
|
13
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
14
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
15
|
+
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
16
|
+
const auth_1 = require("@hubspot/local-dev-lib/constants/auth");
|
|
17
|
+
const process_1 = require("./process");
|
|
18
|
+
const lang_1 = require("./lang");
|
|
19
|
+
const exitCodes_1 = require("./enums/exitCodes");
|
|
14
20
|
const PORT = 3000;
|
|
15
21
|
const redirectUri = `http://localhost:${PORT}/oauth-callback`;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
const i18nKey = 'lib.oauth';
|
|
23
|
+
function buildAuthUrl(oauthManager) {
|
|
24
|
+
const { env: accountEnv, clientId, scopes: accountScopes, } = oauthManager.account;
|
|
25
|
+
const env = accountEnv || environments_1.ENVIRONMENTS.PROD;
|
|
26
|
+
const scopes = accountScopes || auth_1.DEFAULT_OAUTH_SCOPES;
|
|
27
|
+
if (!clientId) {
|
|
28
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.missingClientId`));
|
|
29
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
|
+
}
|
|
31
|
+
return (`${(0, urls_1.getHubSpotWebsiteOrigin)(env)}/oauth/${oauthManager.account.accountId}/authorize` +
|
|
32
|
+
`?client_id=${encodeURIComponent(clientId)}` + // app's client ID
|
|
33
|
+
`&scope=${encodeURIComponent(scopes.join(' '))}` + // scopes being requested by the app
|
|
20
34
|
`&redirect_uri=${encodeURIComponent(redirectUri)}` // where to send the user after the consent page
|
|
21
35
|
);
|
|
22
|
-
}
|
|
23
|
-
|
|
36
|
+
}
|
|
37
|
+
function handleServerOnProcessEnd(server) {
|
|
24
38
|
const shutdownServerIfRunning = () => {
|
|
25
39
|
server?.close();
|
|
26
40
|
};
|
|
27
|
-
handleExit(shutdownServerIfRunning);
|
|
28
|
-
}
|
|
29
|
-
|
|
41
|
+
(0, process_1.handleExit)(shutdownServerIfRunning);
|
|
42
|
+
}
|
|
43
|
+
async function authorize(oauthManager) {
|
|
30
44
|
if (process.env.BROWSER !== 'none') {
|
|
31
|
-
|
|
45
|
+
(0, open_1.default)(buildAuthUrl(oauthManager), { url: true });
|
|
32
46
|
}
|
|
33
47
|
// eslint-disable-next-line no-async-promise-executor
|
|
34
48
|
return new Promise(async (resolve, reject) => {
|
|
35
49
|
let server;
|
|
36
|
-
const app =
|
|
50
|
+
const app = (0, express_1.default)();
|
|
37
51
|
app.get('/oauth-callback', async (req, res) => {
|
|
38
52
|
if (req.query.code) {
|
|
39
53
|
const authCodeProof = {
|
|
@@ -70,25 +84,21 @@ const authorize = async (oauthManager) => {
|
|
|
70
84
|
reject();
|
|
71
85
|
}
|
|
72
86
|
});
|
|
73
|
-
server = app.listen(PORT, () => logger.log(`Waiting for authorization...`));
|
|
87
|
+
server = app.listen(PORT, () => logger_1.logger.log(`Waiting for authorization...`));
|
|
74
88
|
handleServerOnProcessEnd(server);
|
|
75
89
|
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
return new OAuth2Manager({
|
|
90
|
+
}
|
|
91
|
+
function setupOauth(accountConfig) {
|
|
92
|
+
const accountId = (0, getAccountIdentifier_1.getAccountIdentifier)(accountConfig);
|
|
93
|
+
const config = (0, config_1.getAccountConfig)(accountId);
|
|
94
|
+
return new OAuth2Manager_1.OAuth2Manager({
|
|
82
95
|
...accountConfig,
|
|
83
|
-
|
|
96
|
+
env: accountConfig.env || config?.env || environments_1.ENVIRONMENTS.PROD,
|
|
84
97
|
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const oauthManager = setupOauth(
|
|
88
|
-
logger.log('Authorizing');
|
|
98
|
+
}
|
|
99
|
+
async function authenticateWithOauth(accountConfig) {
|
|
100
|
+
const oauthManager = setupOauth(accountConfig);
|
|
101
|
+
logger_1.logger.log('Authorizing');
|
|
89
102
|
await authorize(oauthManager);
|
|
90
|
-
addOauthToAccountConfig(oauthManager);
|
|
91
|
-
}
|
|
92
|
-
module.exports = {
|
|
93
|
-
authenticateWithOauth,
|
|
94
|
-
};
|
|
103
|
+
(0, oauth_1.addOauthToAccountConfig)(oauthManager);
|
|
104
|
+
}
|
package/lib/polling.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
|
|
2
|
+
import { ValueOf } from '@hubspot/local-dev-lib/types/Utils';
|
|
3
|
+
import { POLLING_STATUS } from './constants';
|
|
4
|
+
type GenericPollingResponse = {
|
|
5
|
+
status: ValueOf<typeof POLLING_STATUS>;
|
|
6
|
+
};
|
|
7
|
+
type PollingCallback<T extends GenericPollingResponse> = (accountId: number, taskId: number | string) => HubSpotPromise<T>;
|
|
8
|
+
export declare function poll<T extends GenericPollingResponse>(callback: PollingCallback<T>, accountId: number, taskId: number | string): Promise<T>;
|
|
1
9
|
export {};
|
package/lib/polling.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
exports.poll = poll;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
function poll(callback, accountId, taskId) {
|
|
6
6
|
return new Promise((resolve, reject) => {
|
|
7
7
|
const pollInterval = setInterval(async () => {
|
|
8
8
|
try {
|
|
9
9
|
const { data: pollResp } = await callback(accountId, taskId);
|
|
10
10
|
const { status } = pollResp;
|
|
11
|
-
if (status === POLLING_STATUS.SUCCESS) {
|
|
11
|
+
if (status === constants_1.POLLING_STATUS.SUCCESS) {
|
|
12
12
|
clearInterval(pollInterval);
|
|
13
13
|
resolve(pollResp);
|
|
14
14
|
}
|
|
15
|
-
else if (status === POLLING_STATUS.ERROR ||
|
|
16
|
-
status === POLLING_STATUS.REVERTED ||
|
|
17
|
-
status === POLLING_STATUS.FAILURE) {
|
|
15
|
+
else if (status === constants_1.POLLING_STATUS.ERROR ||
|
|
16
|
+
status === constants_1.POLLING_STATUS.REVERTED ||
|
|
17
|
+
status === constants_1.POLLING_STATUS.FAILURE) {
|
|
18
18
|
clearInterval(pollInterval);
|
|
19
19
|
reject(pollResp);
|
|
20
20
|
}
|
|
@@ -23,9 +23,6 @@ const poll = (callback, accountId, taskId) => {
|
|
|
23
23
|
clearInterval(pollInterval);
|
|
24
24
|
reject(error);
|
|
25
25
|
}
|
|
26
|
-
}, POLLING_DELAY);
|
|
26
|
+
}, constants_1.POLLING_DELAY);
|
|
27
27
|
});
|
|
28
|
-
}
|
|
29
|
-
module.exports = {
|
|
30
|
-
poll,
|
|
31
|
-
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AppFunctionComponentMetadata } from '@hubspot/local-dev-lib/types/ComponentStructure';
|
|
2
|
+
declare class _ProjectLogsManager {
|
|
3
|
+
projectName: string | undefined;
|
|
4
|
+
projectId: number | undefined;
|
|
5
|
+
accountId: number | undefined;
|
|
6
|
+
functions: AppFunctionComponentMetadata[];
|
|
7
|
+
selectedFunction: AppFunctionComponentMetadata | undefined;
|
|
8
|
+
functionName: string | undefined;
|
|
9
|
+
appId: number | undefined;
|
|
10
|
+
isPublicFunction: boolean | undefined;
|
|
11
|
+
endpointName: string | undefined;
|
|
12
|
+
reset(): void;
|
|
13
|
+
constructor();
|
|
14
|
+
init(accountId: number): Promise<void>;
|
|
15
|
+
fetchFunctionDetails(): Promise<void>;
|
|
16
|
+
getFunctionNames(): string[];
|
|
17
|
+
setFunction(functionName: string): void;
|
|
18
|
+
}
|
|
19
|
+
export declare const ProjectLogsManager: _ProjectLogsManager;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectLogsManager = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
6
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
|
+
const lang_1 = require("../lang");
|
|
8
|
+
const ui_1 = require("../ui");
|
|
9
|
+
const i18nKey = 'commands.project.subcommands.logs';
|
|
10
|
+
class _ProjectLogsManager {
|
|
11
|
+
projectName;
|
|
12
|
+
projectId;
|
|
13
|
+
accountId;
|
|
14
|
+
functions;
|
|
15
|
+
selectedFunction;
|
|
16
|
+
functionName;
|
|
17
|
+
appId;
|
|
18
|
+
isPublicFunction;
|
|
19
|
+
endpointName;
|
|
20
|
+
reset() {
|
|
21
|
+
this.projectName = undefined;
|
|
22
|
+
this.projectId = undefined;
|
|
23
|
+
this.accountId = undefined;
|
|
24
|
+
this.functions = [];
|
|
25
|
+
this.selectedFunction = undefined;
|
|
26
|
+
this.functionName = undefined;
|
|
27
|
+
this.appId = undefined;
|
|
28
|
+
this.isPublicFunction = undefined;
|
|
29
|
+
this.endpointName = undefined;
|
|
30
|
+
}
|
|
31
|
+
constructor() {
|
|
32
|
+
this.functions = [];
|
|
33
|
+
}
|
|
34
|
+
async init(accountId) {
|
|
35
|
+
const { projectConfig } = await (0, index_1.getProjectConfig)();
|
|
36
|
+
if (!projectConfig || !projectConfig.name) {
|
|
37
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noProjectConfig`));
|
|
38
|
+
}
|
|
39
|
+
const { name: projectName } = projectConfig;
|
|
40
|
+
this.projectName = projectName;
|
|
41
|
+
this.accountId = accountId;
|
|
42
|
+
this.functions = [];
|
|
43
|
+
const { project } = await (0, index_1.ensureProjectExists)(this.accountId, this.projectName, {
|
|
44
|
+
allowCreate: false,
|
|
45
|
+
});
|
|
46
|
+
if (!project ||
|
|
47
|
+
!project.deployedBuild ||
|
|
48
|
+
!project.deployedBuild.subbuildStatuses) {
|
|
49
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.failedToFetchProjectDetails`));
|
|
50
|
+
}
|
|
51
|
+
this.projectId = project.id;
|
|
52
|
+
await this.fetchFunctionDetails();
|
|
53
|
+
}
|
|
54
|
+
async fetchFunctionDetails() {
|
|
55
|
+
if (!this.projectId) {
|
|
56
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noProjectConfig`));
|
|
57
|
+
}
|
|
58
|
+
if (!this.accountId) {
|
|
59
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.errors.projectLogsManagerNotInitialized`));
|
|
60
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.generic`));
|
|
61
|
+
}
|
|
62
|
+
const { data: { topLevelComponentMetadata }, } = await (0, projects_1.fetchProjectComponentsMetadata)(this.accountId, this.projectId);
|
|
63
|
+
const apps = topLevelComponentMetadata.filter(componentMetadata => {
|
|
64
|
+
const { type } = componentMetadata;
|
|
65
|
+
return type && type.name === 'PRIVATE_APP';
|
|
66
|
+
});
|
|
67
|
+
apps.forEach(app => {
|
|
68
|
+
this.functions.push(
|
|
69
|
+
// If component type is APP_FUNCTION, we can safely cast as AppFunctionComponentMetadata
|
|
70
|
+
...app.featureComponents.filter(component => component.type.name === 'APP_FUNCTION'));
|
|
71
|
+
});
|
|
72
|
+
if (this.functions.length === 0) {
|
|
73
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsInProject`, {
|
|
74
|
+
link: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsLinkText`), 'https://developers.hubspot.com/docs/platform/serverless-functions'),
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
getFunctionNames() {
|
|
79
|
+
return this.functions.map(serverlessFunction => serverlessFunction.componentName);
|
|
80
|
+
}
|
|
81
|
+
setFunction(functionName) {
|
|
82
|
+
if (!(this.functions.length > 0)) {
|
|
83
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsInProject`, {
|
|
84
|
+
link: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionsLinkText`), 'https://developers.hubspot.com/docs/platform/serverless-functions'),
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
this.selectedFunction = this.functions.find(serverlessFunction => serverlessFunction.componentName === functionName);
|
|
88
|
+
if (!this.selectedFunction) {
|
|
89
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.noFunctionWithName`, { name: functionName }));
|
|
90
|
+
}
|
|
91
|
+
this.functionName = functionName;
|
|
92
|
+
if (!this.selectedFunction.deployOutput) {
|
|
93
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.functionNotDeployed`, { name: functionName }));
|
|
94
|
+
}
|
|
95
|
+
this.appId = this.selectedFunction.deployOutput.appId;
|
|
96
|
+
if (this.selectedFunction.deployOutput.endpoint) {
|
|
97
|
+
this.endpointName = this.selectedFunction.deployOutput.endpoint.path;
|
|
98
|
+
this.isPublicFunction = true;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.isPublicFunction = false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.ProjectLogsManager = new _ProjectLogsManager();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FileResult } from 'tmp';
|
|
2
|
+
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
|
+
import { Deploy } from '@hubspot/local-dev-lib/types/Deploy';
|
|
4
|
+
import { ProjectConfig, ProjectTask } from '../../types/Projects';
|
|
5
|
+
type PollTaskStatusFunction<T extends ProjectTask> = (accountId: number, taskName: string, taskId: number, deployedBuildId: number | null, silenceLogs: boolean) => Promise<T>;
|
|
6
|
+
export declare const pollBuildStatus: PollTaskStatusFunction<Build>;
|
|
7
|
+
export declare const pollDeployStatus: PollTaskStatusFunction<Deploy>;
|
|
8
|
+
type ProjectPollResult = {
|
|
9
|
+
succeeded: boolean;
|
|
10
|
+
buildId: number;
|
|
11
|
+
buildResult: Build;
|
|
12
|
+
deployResult: Deploy | null;
|
|
13
|
+
};
|
|
14
|
+
export declare function displayWarnLogs(accountId: number, projectName: string, taskId: number, isDeploy?: boolean): Promise<void>;
|
|
15
|
+
export declare function pollProjectBuildAndDeploy(accountId: number, projectConfig: ProjectConfig, tempFile: FileResult, buildId: number, silenceLogs?: boolean): Promise<ProjectPollResult>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pollDeployStatus = exports.pollBuildStatus = void 0;
|
|
7
|
+
exports.displayWarnLogs = displayWarnLogs;
|
|
8
|
+
exports.pollProjectBuildAndDeploy = pollProjectBuildAndDeploy;
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
12
|
+
const constants_1 = require("../constants");
|
|
13
|
+
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
14
|
+
const lang_1 = require("../lang");
|
|
15
|
+
const errorHandlers_1 = require("../errorHandlers");
|
|
16
|
+
const ui_1 = require("../ui");
|
|
17
|
+
const urls_1 = require("./urls");
|
|
18
|
+
const i18nKey = 'lib.projectBuildAndDeploy';
|
|
19
|
+
const SPINNER_STATUS = {
|
|
20
|
+
SPINNING: 'spinning',
|
|
21
|
+
};
|
|
22
|
+
function getSubtasks(task) {
|
|
23
|
+
if ('subbuildStatuses' in task) {
|
|
24
|
+
return task.subbuildStatuses;
|
|
25
|
+
}
|
|
26
|
+
return task.subdeployStatuses;
|
|
27
|
+
}
|
|
28
|
+
function getSubtaskName(task) {
|
|
29
|
+
if ('buildName' in task) {
|
|
30
|
+
return task.buildName;
|
|
31
|
+
}
|
|
32
|
+
return task.deployName;
|
|
33
|
+
}
|
|
34
|
+
function getSubtaskType(task) {
|
|
35
|
+
if ('buildType' in task) {
|
|
36
|
+
return task.buildType;
|
|
37
|
+
}
|
|
38
|
+
return task.deployType;
|
|
39
|
+
}
|
|
40
|
+
function makePollTaskStatusFunc({ statusFn, structureFn, statusText, statusStrings, linkToHubSpot, }) {
|
|
41
|
+
return async function (accountId, taskName, taskId, deployedBuildId = null, silenceLogs = false) {
|
|
42
|
+
const displayId = deployedBuildId || taskId;
|
|
43
|
+
if (linkToHubSpot && !silenceLogs) {
|
|
44
|
+
logger_1.logger.log(`\n${linkToHubSpot(accountId, taskName, taskId, deployedBuildId)}\n`);
|
|
45
|
+
}
|
|
46
|
+
SpinniesManager_1.default.init();
|
|
47
|
+
const overallTaskSpinniesKey = `overallTaskStatus-${statusText.STATUS_TEXT}`;
|
|
48
|
+
SpinniesManager_1.default.add(overallTaskSpinniesKey, {
|
|
49
|
+
text: 'Beginning',
|
|
50
|
+
succeedColor: 'white',
|
|
51
|
+
failColor: 'white',
|
|
52
|
+
failPrefix: chalk_1.default.bold('!'),
|
|
53
|
+
});
|
|
54
|
+
const [{ data: initialTaskStatus }, { data: { topLevelComponentsWithChildren: taskStructure }, },] = await Promise.all([
|
|
55
|
+
statusFn(accountId, taskName, taskId),
|
|
56
|
+
structureFn(accountId, taskName, taskId),
|
|
57
|
+
]);
|
|
58
|
+
const subtasks = getSubtasks(initialTaskStatus);
|
|
59
|
+
const tasksById = subtasks.reduce((acc, subtask) => {
|
|
60
|
+
const { id, visible } = subtask;
|
|
61
|
+
if (visible) {
|
|
62
|
+
acc[id] = subtask;
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
65
|
+
}, {});
|
|
66
|
+
const structuredTasks = Object.keys(taskStructure).map(key => {
|
|
67
|
+
return {
|
|
68
|
+
...tasksById[key],
|
|
69
|
+
subtasks: taskStructure[key]
|
|
70
|
+
.filter(taskId => Boolean(tasksById[taskId]))
|
|
71
|
+
.map(taskId => tasksById[taskId]),
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
const numComponents = structuredTasks.length;
|
|
75
|
+
const componentCountText = silenceLogs
|
|
76
|
+
? ''
|
|
77
|
+
: (0, lang_1.i18n)(numComponents === 1
|
|
78
|
+
? `${i18nKey}.makePollTaskStatusFunc.componentCountSingular`
|
|
79
|
+
: `${i18nKey}.makePollTaskStatusFunc.componentCount`, { numComponents }) + '\n';
|
|
80
|
+
SpinniesManager_1.default.update(overallTaskSpinniesKey, {
|
|
81
|
+
text: `${statusStrings.INITIALIZE(taskName, displayId)}\n${componentCountText}`,
|
|
82
|
+
});
|
|
83
|
+
if (!silenceLogs) {
|
|
84
|
+
function addTaskSpinner(subtask, indent, newline) {
|
|
85
|
+
const taskName = getSubtaskName(subtask);
|
|
86
|
+
const taskType = getSubtaskType(subtask);
|
|
87
|
+
const formattedTaskType = constants_1.PROJECT_TASK_TYPES[taskType]
|
|
88
|
+
? `[${constants_1.PROJECT_TASK_TYPES[taskType]}]`
|
|
89
|
+
: '';
|
|
90
|
+
const text = `${indent <= 2 ? statusText.STATUS_TEXT : ''} ${chalk_1.default.bold(taskName)} ${formattedTaskType} ...${newline ? '\n' : ''}`;
|
|
91
|
+
SpinniesManager_1.default.add(subtask.id, {
|
|
92
|
+
text,
|
|
93
|
+
indent,
|
|
94
|
+
succeedColor: 'white',
|
|
95
|
+
failColor: 'white',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
structuredTasks.forEach(task => {
|
|
99
|
+
addTaskSpinner(task, 2, !task.subtasks || task.subtasks.length === 0);
|
|
100
|
+
task.subtasks.forEach((subtask, i) => addTaskSpinner(subtask, 4, i === task.subtasks.length - 1));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const pollInterval = setInterval(async () => {
|
|
105
|
+
let taskStatus;
|
|
106
|
+
try {
|
|
107
|
+
const { data } = await statusFn(accountId, taskName, taskId);
|
|
108
|
+
taskStatus = data;
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
logger_1.logger.debug(e);
|
|
112
|
+
(0, errorHandlers_1.logError)(e, new errorHandlers_1.ApiErrorContext({
|
|
113
|
+
accountId,
|
|
114
|
+
projectName: taskName,
|
|
115
|
+
}));
|
|
116
|
+
return reject(new Error((0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.errorFetchingTaskStatus`, {
|
|
117
|
+
taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
|
|
118
|
+
? 'build'
|
|
119
|
+
: 'deploy',
|
|
120
|
+
})));
|
|
121
|
+
}
|
|
122
|
+
const subtasks = getSubtasks(taskStatus);
|
|
123
|
+
if (!taskStatus || !taskStatus.status || !subtasks) {
|
|
124
|
+
return reject(new Error((0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.errorFetchingTaskStatus`, {
|
|
125
|
+
taskType: statusText.TYPE_KEY === constants_1.PROJECT_BUILD_TEXT.TYPE_KEY
|
|
126
|
+
? 'build'
|
|
127
|
+
: 'deploy',
|
|
128
|
+
})));
|
|
129
|
+
}
|
|
130
|
+
const { status } = taskStatus;
|
|
131
|
+
if (SpinniesManager_1.default.hasActiveSpinners()) {
|
|
132
|
+
subtasks.forEach(subtask => {
|
|
133
|
+
const { id, status } = subtask;
|
|
134
|
+
const spinner = SpinniesManager_1.default.pick(id);
|
|
135
|
+
if (!spinner || spinner.status !== SPINNER_STATUS.SPINNING) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const topLevelTask = structuredTasks.find(t => t.id == id);
|
|
139
|
+
if (status === statusText.STATES.SUCCESS ||
|
|
140
|
+
status === statusText.STATES.FAILURE) {
|
|
141
|
+
const taskStatusText = subtask.status === statusText.STATES.SUCCESS
|
|
142
|
+
? (0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.successStatusText`)
|
|
143
|
+
: (0, lang_1.i18n)(`${i18nKey}.makePollTaskStatusFunc.failedStatusText`);
|
|
144
|
+
const hasNewline = spinner?.text?.includes('\n') || Boolean(topLevelTask);
|
|
145
|
+
const updatedText = `${spinner?.text?.replace('\n', '')} ${taskStatusText}${hasNewline ? '\n' : ''}`;
|
|
146
|
+
if (status === statusText.STATES.SUCCESS) {
|
|
147
|
+
SpinniesManager_1.default.succeed(id, { text: updatedText });
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
SpinniesManager_1.default.fail(id, { text: updatedText });
|
|
151
|
+
}
|
|
152
|
+
if (topLevelTask) {
|
|
153
|
+
topLevelTask.subtasks.forEach(currentSubtask => SpinniesManager_1.default.remove(currentSubtask.id));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (status === statusText.STATES.SUCCESS) {
|
|
158
|
+
SpinniesManager_1.default.succeed(overallTaskSpinniesKey, {
|
|
159
|
+
text: statusStrings.SUCCESS(taskName, displayId),
|
|
160
|
+
});
|
|
161
|
+
clearInterval(pollInterval);
|
|
162
|
+
resolve(taskStatus);
|
|
163
|
+
}
|
|
164
|
+
else if (status === statusText.STATES.FAILURE) {
|
|
165
|
+
SpinniesManager_1.default.fail(overallTaskSpinniesKey, {
|
|
166
|
+
text: statusStrings.FAIL(taskName, displayId),
|
|
167
|
+
});
|
|
168
|
+
if (!silenceLogs) {
|
|
169
|
+
const failedSubtasks = subtasks.filter(subtask => subtask.status === 'FAILURE');
|
|
170
|
+
(0, ui_1.uiLine)();
|
|
171
|
+
logger_1.logger.log(`${statusStrings.SUBTASK_FAIL(failedSubtasks.length === 1
|
|
172
|
+
? getSubtaskName(failedSubtasks[0])
|
|
173
|
+
: failedSubtasks.length + ' components', displayId)}\n`);
|
|
174
|
+
logger_1.logger.log('See below for a summary of errors.');
|
|
175
|
+
(0, ui_1.uiLine)();
|
|
176
|
+
const displayErrors = failedSubtasks.filter(subtask => subtask?.standardError?.subCategory !==
|
|
177
|
+
constants_1.PROJECT_ERROR_TYPES.SUBBUILD_FAILED &&
|
|
178
|
+
subtask?.standardError?.subCategory !==
|
|
179
|
+
constants_1.PROJECT_ERROR_TYPES.SUBDEPLOY_FAILED);
|
|
180
|
+
displayErrors.forEach(subTask => {
|
|
181
|
+
logger_1.logger.log(`\n--- ${chalk_1.default.bold(getSubtaskName(subTask))} failed with the following error ---`);
|
|
182
|
+
logger_1.logger.error(subTask.errorMessage);
|
|
183
|
+
// Log nested errors
|
|
184
|
+
if (subTask.standardError && subTask.standardError.errors) {
|
|
185
|
+
logger_1.logger.log();
|
|
186
|
+
subTask.standardError.errors.forEach(error => {
|
|
187
|
+
logger_1.logger.log(error.message);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
clearInterval(pollInterval);
|
|
193
|
+
resolve(taskStatus);
|
|
194
|
+
}
|
|
195
|
+
else if (!subtasks.length) {
|
|
196
|
+
clearInterval(pollInterval);
|
|
197
|
+
resolve(taskStatus);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}, constants_1.POLLING_DELAY);
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function pollBuildAutodeployStatus(accountId, taskName, buildId) {
|
|
205
|
+
return new Promise((resolve, reject) => {
|
|
206
|
+
let maxIntervals = (30 * 1000) / constants_1.POLLING_DELAY; // Num of intervals in ~30s
|
|
207
|
+
const pollInterval = setInterval(async () => {
|
|
208
|
+
let build;
|
|
209
|
+
try {
|
|
210
|
+
const response = await (0, projects_1.getBuildStatus)(accountId, taskName, buildId);
|
|
211
|
+
build = response.data;
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
logger_1.logger.debug(e);
|
|
215
|
+
return reject(new Error((0, lang_1.i18n)(`${i18nKey}.pollBuildAutodeployStatusError`, { buildId })));
|
|
216
|
+
}
|
|
217
|
+
if (!build || !build.status) {
|
|
218
|
+
return reject(new Error((0, lang_1.i18n)(`${i18nKey}.pollBuildAutodeployStatusError`, { buildId })));
|
|
219
|
+
}
|
|
220
|
+
if (build.deployStatusTaskLocator || maxIntervals <= 0) {
|
|
221
|
+
clearInterval(pollInterval);
|
|
222
|
+
resolve(build);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
maxIntervals -= 1;
|
|
226
|
+
}
|
|
227
|
+
}, constants_1.POLLING_DELAY);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
exports.pollBuildStatus = makePollTaskStatusFunc({
|
|
231
|
+
linkToHubSpot: (accountId, taskName, taskId) => (0, ui_1.uiLink)(`View build #${taskId} in HubSpot`, (0, urls_1.getProjectBuildDetailUrl)(taskName, taskId, accountId)),
|
|
232
|
+
statusFn: projects_1.getBuildStatus,
|
|
233
|
+
structureFn: projects_1.getBuildStructure,
|
|
234
|
+
statusText: constants_1.PROJECT_BUILD_TEXT,
|
|
235
|
+
statusStrings: {
|
|
236
|
+
INITIALIZE: (name, buildId) => `Building ${chalk_1.default.bold(name)} #${buildId}`,
|
|
237
|
+
SUCCESS: (name, buildId) => `Built ${chalk_1.default.bold(name)} #${buildId}`,
|
|
238
|
+
FAIL: (name, buildId) => `Failed to build ${chalk_1.default.bold(name)} #${buildId}`,
|
|
239
|
+
SUBTASK_FAIL: (buildId, name) => `Build #${buildId} failed because there was a problem\nbuilding ${chalk_1.default.bold(name)}`,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
exports.pollDeployStatus = makePollTaskStatusFunc({
|
|
243
|
+
linkToHubSpot: (accountId, taskName, taskId, deployedBuildId) => (0, ui_1.uiLink)(`View deploy of build #${deployedBuildId} in HubSpot`, (0, urls_1.getProjectDeployDetailUrl)(taskName, taskId, accountId)),
|
|
244
|
+
statusFn: projects_1.getDeployStatus,
|
|
245
|
+
structureFn: projects_1.getDeployStructure,
|
|
246
|
+
statusText: constants_1.PROJECT_DEPLOY_TEXT,
|
|
247
|
+
statusStrings: {
|
|
248
|
+
INITIALIZE: (name, buildId) => `Deploying build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
249
|
+
SUCCESS: (name, buildId) => `Deployed build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
250
|
+
FAIL: (name, buildId) => `Failed to deploy build #${buildId} in ${chalk_1.default.bold(name)}`,
|
|
251
|
+
SUBTASK_FAIL: (deployedBuildId, name) => `Deploy for build #${deployedBuildId} failed because there was a\nproblem deploying ${chalk_1.default.bold(name)}`,
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
async function displayWarnLogs(accountId, projectName, taskId, isDeploy = false) {
|
|
255
|
+
let result;
|
|
256
|
+
if (isDeploy) {
|
|
257
|
+
try {
|
|
258
|
+
const { data } = await (0, projects_1.fetchDeployWarnLogs)(accountId, projectName, taskId);
|
|
259
|
+
result = data;
|
|
260
|
+
}
|
|
261
|
+
catch (e) {
|
|
262
|
+
(0, errorHandlers_1.logError)(e);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
try {
|
|
267
|
+
const { data } = await (0, projects_1.fetchBuildWarnLogs)(accountId, projectName, taskId);
|
|
268
|
+
result = data;
|
|
269
|
+
}
|
|
270
|
+
catch (e) {
|
|
271
|
+
(0, errorHandlers_1.logError)(e);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (result && result.logs) {
|
|
275
|
+
const logLength = result.logs.length;
|
|
276
|
+
result.logs.forEach((log, i) => {
|
|
277
|
+
logger_1.logger.warn(log.message);
|
|
278
|
+
if (i < logLength - 1) {
|
|
279
|
+
logger_1.logger.log('');
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
async function pollProjectBuildAndDeploy(accountId, projectConfig, tempFile, buildId, silenceLogs = false) {
|
|
285
|
+
let buildStatus = await (0, exports.pollBuildStatus)(accountId, projectConfig.name, buildId, null, silenceLogs);
|
|
286
|
+
if (!silenceLogs) {
|
|
287
|
+
(0, ui_1.uiLine)();
|
|
288
|
+
}
|
|
289
|
+
const result = {
|
|
290
|
+
succeeded: true,
|
|
291
|
+
buildId,
|
|
292
|
+
buildResult: buildStatus,
|
|
293
|
+
deployResult: null,
|
|
294
|
+
};
|
|
295
|
+
if (buildStatus.status === 'FAILURE') {
|
|
296
|
+
result.succeeded = false;
|
|
297
|
+
return result;
|
|
298
|
+
}
|
|
299
|
+
else if (buildStatus.isAutoDeployEnabled) {
|
|
300
|
+
if (!silenceLogs) {
|
|
301
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.pollProjectBuildAndDeploy.buildSucceededAutomaticallyDeploying`, {
|
|
302
|
+
accountIdentifier: (0, ui_1.uiAccountDescription)(accountId),
|
|
303
|
+
buildId,
|
|
304
|
+
}));
|
|
305
|
+
await displayWarnLogs(accountId, projectConfig.name, buildId);
|
|
306
|
+
}
|
|
307
|
+
// autoDeployId of 0 indicates a skipped deploy
|
|
308
|
+
const getIsDeploying = () => buildStatus.autoDeployId > 0 && buildStatus.deployStatusTaskLocator;
|
|
309
|
+
// Sometimes the deploys do not immediately initiate, give them a chance to kick off
|
|
310
|
+
if (!getIsDeploying()) {
|
|
311
|
+
buildStatus = await pollBuildAutodeployStatus(accountId, projectConfig.name, buildId);
|
|
312
|
+
}
|
|
313
|
+
if (getIsDeploying()) {
|
|
314
|
+
const deployStatus = await (0, exports.pollDeployStatus)(accountId, projectConfig.name, Number(buildStatus.deployStatusTaskLocator.id), buildId, silenceLogs);
|
|
315
|
+
result.deployResult = deployStatus;
|
|
316
|
+
if (deployStatus.status === 'FAILURE') {
|
|
317
|
+
result.succeeded = false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else if (!silenceLogs) {
|
|
321
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.pollProjectBuildAndDeploy.unableToFindAutodeployStatus`, {
|
|
322
|
+
buildId,
|
|
323
|
+
viewDeploysLink: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.pollProjectBuildAndDeploy.viewDeploys`), (0, urls_1.getProjectActivityUrl)(projectConfig.name, accountId)),
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
if (tempFile) {
|
|
329
|
+
tempFile.removeCallback();
|
|
330
|
+
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.pollProjectBuildAndDeploy.cleanedUpTempFile`, {
|
|
331
|
+
path: tempFile.name,
|
|
332
|
+
}));
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
logger_1.logger.error(e);
|
|
337
|
+
}
|
|
338
|
+
if (result && result.deployResult) {
|
|
339
|
+
await displayWarnLogs(accountId, projectConfig.name, result.deployResult.deployId, true);
|
|
340
|
+
}
|
|
341
|
+
return result;
|
|
342
|
+
}
|