@hubspot/cli 7.4.8 → 7.4.9-beta.1
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/commands/account/auth.d.ts +3 -7
- package/commands/account/auth.js +19 -9
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +35 -58
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +24 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +25 -12
- package/commands/config/migrate.d.ts +1 -1
- package/commands/config/migrate.js +16 -12
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +63 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -45
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +40 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +20 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +24 -10
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +44 -43
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -27
- package/commands/module.d.ts +3 -1
- package/commands/module.js +22 -10
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/create.js +3 -3
- package/commands/project/deploy.d.ts +1 -0
- package/commands/project/deploy.js +40 -12
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +44 -15
- package/commands/project/dev/unifiedFlow.d.ts +2 -1
- package/commands/project/dev/unifiedFlow.js +52 -20
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +190 -0
- package/commands/project/profile/remove.d.ts +6 -0
- package/commands/project/profile/remove.js +119 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +38 -8
- package/commands/project.js +2 -0
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +20 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +25 -48
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +14 -6
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +17 -10
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +16 -9
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +23 -46
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +118 -97
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +76 -65
- package/lang/en.d.ts +654 -558
- package/lang/en.js +443 -353
- package/lang/en.lyaml +23 -13
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +14 -3
- package/lib/app/migrate_legacy.js +5 -5
- package/lib/configMigrate.js +24 -10
- package/lib/constants.d.ts +6 -0
- package/lib/constants.js +7 -1
- package/lib/errorHandlers/suppressError.js +12 -19
- package/lib/filesystem.d.ts +1 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/middleware/configMiddleware.js +8 -0
- package/lib/projectProfiles.d.ts +6 -0
- package/lib/projectProfiles.js +65 -0
- package/lib/projects/buildAndDeploy.js +17 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +25 -0
- package/lib/projects/localDev/AppDevModeInterface.js +117 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +158 -0
- package/lib/projects/localDev/LocalDevManager.js +2 -3
- package/lib/projects/localDev/LocalDevProcess.d.ts +27 -0
- package/lib/projects/localDev/LocalDevProcess.js +171 -0
- package/lib/projects/localDev/LocalDevState.d.ts +37 -0
- package/lib/projects/localDev/LocalDevState.js +78 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +56 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +17 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +92 -0
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -1
- package/lib/projects/upload.d.ts +2 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/package.json +5 -3
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +24 -0
- package/types/LocalDev.js +2 -0
- package/types/Yargs.d.ts +8 -1
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type FunctionDeployArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
declare const functionDeployCommand: YargsCommandModule<unknown, FunctionDeployArgs>;
|
|
6
|
+
export default functionDeployCommand;
|
|
@@ -1,91 +1,111 @@
|
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
|
+
const functions_1 = require("@hubspot/local-dev-lib/api/functions");
|
|
8
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
10
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
11
|
+
const index_2 = require("../../lib/errorHandlers/index");
|
|
12
|
+
const ui_1 = require("../../lib/ui");
|
|
13
|
+
const polling_1 = require("../../lib/polling");
|
|
14
|
+
const serverlessLogs_1 = require("../../lib/serverlessLogs");
|
|
15
|
+
const lang_1 = require("../../lib/lang");
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
|
+
function isFunctionBuildError(e) {
|
|
18
|
+
return (typeof e === 'object' && e !== null && 'status' in e && e.status === 'ERROR');
|
|
19
|
+
}
|
|
20
|
+
const command = 'deploy <path>';
|
|
21
|
+
const describe = undefined;
|
|
22
|
+
async function handler(args) {
|
|
23
|
+
const { path: functionPath, derivedAccountId } = args;
|
|
19
24
|
const splitFunctionPath = functionPath.split('.');
|
|
20
|
-
trackCommandUsage('
|
|
25
|
+
(0, usageTracking_1.trackCommandUsage)('function-deploy', undefined, derivedAccountId);
|
|
21
26
|
if (!splitFunctionPath.length ||
|
|
22
27
|
splitFunctionPath[splitFunctionPath.length - 1] !== 'functions') {
|
|
23
|
-
logger.error(i18n('commands.function.subcommands.deploy.errors.notFunctionsFolder', {
|
|
28
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.function.subcommands.deploy.errors.notFunctionsFolder', {
|
|
24
29
|
functionPath,
|
|
25
30
|
}));
|
|
26
31
|
return;
|
|
27
32
|
}
|
|
28
|
-
logger.debug(i18n('commands.function.subcommands.deploy.debug.startingBuildAndDeploy', {
|
|
33
|
+
logger_1.logger.debug((0, lang_1.i18n)('commands.function.subcommands.deploy.debug.startingBuildAndDeploy', {
|
|
29
34
|
functionPath,
|
|
30
35
|
}));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
text: i18n('commands.function.subcommands.deploy.loading', {
|
|
34
|
-
account: uiAccountDescription(derivedAccountId),
|
|
36
|
+
SpinniesManager_1.default.init();
|
|
37
|
+
SpinniesManager_1.default.add('loading', {
|
|
38
|
+
text: (0, lang_1.i18n)('commands.function.subcommands.deploy.loading', {
|
|
39
|
+
account: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
35
40
|
functionPath,
|
|
36
41
|
}),
|
|
37
42
|
});
|
|
38
43
|
try {
|
|
39
|
-
const { data: buildId } = await buildPackage(derivedAccountId, functionPath);
|
|
40
|
-
const successResp = await poll(() => getBuildStatus(derivedAccountId, buildId));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const { data: buildId } = await (0, functions_1.buildPackage)(derivedAccountId, functionPath);
|
|
45
|
+
const successResp = await (0, polling_1.poll)(() => (0, functions_1.getBuildStatus)(derivedAccountId, Number(buildId)));
|
|
46
|
+
if (successResp) {
|
|
47
|
+
const buildTimeSeconds = successResp.buildTime
|
|
48
|
+
? (successResp.buildTime / 1000).toFixed(2)
|
|
49
|
+
: 0;
|
|
50
|
+
SpinniesManager_1.default.succeed('loading');
|
|
51
|
+
if (successResp.cdnUrl) {
|
|
52
|
+
await (0, serverlessLogs_1.outputBuildLog)(successResp.cdnUrl);
|
|
53
|
+
}
|
|
54
|
+
logger_1.logger.success((0, lang_1.i18n)('commands.function.subcommands.deploy.success.deployed', {
|
|
55
|
+
accountId: derivedAccountId,
|
|
56
|
+
buildTimeSeconds,
|
|
57
|
+
functionPath,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
49
60
|
}
|
|
50
61
|
catch (e) {
|
|
51
|
-
|
|
52
|
-
text: i18n('commands.function.subcommands.deploy.loadingFailed', {
|
|
53
|
-
account: uiAccountDescription(derivedAccountId),
|
|
62
|
+
SpinniesManager_1.default.fail('loading', {
|
|
63
|
+
text: (0, lang_1.i18n)('commands.function.subcommands.deploy.loadingFailed', {
|
|
64
|
+
account: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
54
65
|
functionPath,
|
|
55
66
|
}),
|
|
56
67
|
});
|
|
57
|
-
if (isHubSpotHttpError(e) && e.status === 404) {
|
|
58
|
-
logger.error(i18n('commands.function.subcommands.deploy.errors.noPackageJson', {
|
|
68
|
+
if ((0, index_1.isHubSpotHttpError)(e) && e.status === 404) {
|
|
69
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.function.subcommands.deploy.errors.noPackageJson', {
|
|
59
70
|
functionPath,
|
|
60
71
|
}));
|
|
61
72
|
}
|
|
62
|
-
else if (e
|
|
63
|
-
await outputBuildLog(e.cdnUrl);
|
|
64
|
-
logger.error(i18n('commands.function.subcommands.deploy.errors.buildError', {
|
|
65
|
-
details: e.errorReason,
|
|
73
|
+
else if (isFunctionBuildError(e)) {
|
|
74
|
+
await (0, serverlessLogs_1.outputBuildLog)(e.cdnUrl);
|
|
75
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.function.subcommands.deploy.errors.buildError', {
|
|
76
|
+
details: String(e.errorReason),
|
|
66
77
|
}));
|
|
67
78
|
}
|
|
68
79
|
else {
|
|
69
|
-
logError(e, new ApiErrorContext({
|
|
80
|
+
(0, index_2.logError)(e, new index_2.ApiErrorContext({
|
|
70
81
|
accountId: derivedAccountId,
|
|
71
82
|
request: functionPath,
|
|
72
83
|
}));
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
|
-
}
|
|
76
|
-
|
|
86
|
+
}
|
|
87
|
+
function functionDeployBuilder(yargs) {
|
|
77
88
|
yargs.positional('path', {
|
|
78
|
-
describe: i18n('commands.function.subcommands.deploy.positionals.path.describe'),
|
|
89
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.deploy.positionals.path.describe'),
|
|
79
90
|
type: 'string',
|
|
80
91
|
});
|
|
81
92
|
yargs.example([
|
|
82
93
|
[
|
|
83
94
|
'$0 functions deploy myFunctionFolder.functions',
|
|
84
|
-
i18n('commands.function.subcommands.deploy.examples.default'),
|
|
95
|
+
(0, lang_1.i18n)('commands.function.subcommands.deploy.examples.default'),
|
|
85
96
|
],
|
|
86
97
|
]);
|
|
87
|
-
addConfigOptions(yargs);
|
|
88
|
-
addAccountOptions(yargs);
|
|
89
|
-
addUseEnvironmentOptions(yargs);
|
|
90
98
|
return yargs;
|
|
99
|
+
}
|
|
100
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(functionDeployBuilder, command, describe, {
|
|
101
|
+
useConfigOptions: true,
|
|
102
|
+
useAccountOptions: true,
|
|
103
|
+
useEnvironmentOptions: true,
|
|
104
|
+
});
|
|
105
|
+
const functionDeployCommand = {
|
|
106
|
+
command,
|
|
107
|
+
describe,
|
|
108
|
+
handler,
|
|
109
|
+
builder,
|
|
91
110
|
};
|
|
111
|
+
exports.default = functionDeployCommand;
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type FunctionListArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
3
|
+
json?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const functionListCommand: YargsCommandModule<unknown, FunctionListArgs>;
|
|
6
|
+
export default functionListCommand;
|
|
@@ -1,30 +1,32 @@
|
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
6
|
+
const moment_1 = __importDefault(require("moment"));
|
|
7
|
+
const functions_1 = require("@hubspot/local-dev-lib/api/functions");
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const index_1 = require("../../lib/errorHandlers/index");
|
|
10
|
+
const table_1 = require("../../lib/ui/table");
|
|
11
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
|
+
const lang_1 = require("../../lib/lang");
|
|
13
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
15
|
+
const command = ['list', 'ls'];
|
|
16
|
+
const describe = (0, lang_1.i18n)('commands.function.subcommands.list.describe');
|
|
17
|
+
async function handler(args) {
|
|
18
|
+
const { derivedAccountId } = args;
|
|
19
|
+
(0, usageTracking_1.trackCommandUsage)('function-list', undefined, derivedAccountId);
|
|
20
|
+
logger_1.logger.debug((0, lang_1.i18n)('commands.function.subcommands.list.debug.gettingFunctions'));
|
|
21
|
+
const { data: routesResp } = await (0, functions_1.getRoutes)(derivedAccountId).catch(async (e) => {
|
|
22
|
+
(0, index_1.logError)(e, new index_1.ApiErrorContext({ accountId: derivedAccountId }));
|
|
23
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
22
24
|
});
|
|
23
25
|
if (!routesResp.objects.length) {
|
|
24
|
-
return logger.info(i18n('commands.function.subcommands.list.info.noFunctions'));
|
|
26
|
+
return logger_1.logger.info((0, lang_1.i18n)('commands.function.subcommands.list.info.noFunctions'));
|
|
25
27
|
}
|
|
26
|
-
if (
|
|
27
|
-
return logger.log(routesResp.objects);
|
|
28
|
+
if (args.json) {
|
|
29
|
+
return logger_1.logger.log(routesResp.objects);
|
|
28
30
|
}
|
|
29
31
|
const functionsAsArrays = routesResp.objects.map(func => {
|
|
30
32
|
const { route, method, created, updated, secretNames } = func;
|
|
@@ -32,21 +34,31 @@ exports.handler = async (options) => {
|
|
|
32
34
|
route,
|
|
33
35
|
method,
|
|
34
36
|
secretNames.join(', '),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
(0, moment_1.default)(created).format(),
|
|
38
|
+
(0, moment_1.default)(updated).format(),
|
|
37
39
|
];
|
|
38
40
|
});
|
|
39
|
-
functionsAsArrays.unshift(getTableHeader(['Route', 'Method', 'Secrets', 'Created', 'Updated']));
|
|
40
|
-
return logger.log(getTableContents(functionsAsArrays));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
addConfigOptions(yargs);
|
|
44
|
-
addAccountOptions(yargs);
|
|
45
|
-
addUseEnvironmentOptions(yargs);
|
|
41
|
+
functionsAsArrays.unshift((0, table_1.getTableHeader)(['Route', 'Method', 'Secrets', 'Created', 'Updated']));
|
|
42
|
+
return logger_1.logger.log((0, table_1.getTableContents)(functionsAsArrays));
|
|
43
|
+
}
|
|
44
|
+
function functionListBuilder(yargs) {
|
|
46
45
|
yargs.options({
|
|
47
46
|
json: {
|
|
48
|
-
describe: i18n('commands.function.subcommands.list.options.json.describe'),
|
|
47
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.list.options.json.describe'),
|
|
49
48
|
type: 'boolean',
|
|
50
49
|
},
|
|
51
50
|
});
|
|
51
|
+
return yargs;
|
|
52
|
+
}
|
|
53
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(functionListBuilder, command, describe, {
|
|
54
|
+
useConfigOptions: true,
|
|
55
|
+
useAccountOptions: true,
|
|
56
|
+
useEnvironmentOptions: true,
|
|
57
|
+
});
|
|
58
|
+
const functionListCommand = {
|
|
59
|
+
command,
|
|
60
|
+
describe,
|
|
61
|
+
handler,
|
|
62
|
+
builder,
|
|
52
63
|
};
|
|
64
|
+
exports.default = functionListCommand;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type FunctionServerArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
3
|
+
path: string;
|
|
4
|
+
port?: string;
|
|
5
|
+
contact?: boolean;
|
|
6
|
+
watch?: boolean;
|
|
7
|
+
'log-output'?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const functionServerCommand: YargsCommandModule<unknown, FunctionServerArgs>;
|
|
10
|
+
export default functionServerCommand;
|
|
@@ -1,57 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
3
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
// This package is not typed, so we need to use require
|
|
7
6
|
const { start: startTestServer } = require('@hubspot/serverless-dev-runtime');
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const lang_1 = require("../../lib/lang");
|
|
8
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
9
|
+
const command = 'server <path>';
|
|
10
|
+
const describe = undefined;
|
|
11
|
+
async function handler(args) {
|
|
12
|
+
const { path: functionPath, derivedAccountId } = args;
|
|
13
|
+
(0, usageTracking_1.trackCommandUsage)('functions-server', undefined, derivedAccountId);
|
|
14
|
+
logger_1.logger.debug((0, lang_1.i18n)('commands.function.subcommands.server.debug.startingServer', {
|
|
15
15
|
functionPath,
|
|
16
16
|
}));
|
|
17
17
|
startTestServer({
|
|
18
18
|
accountId: derivedAccountId,
|
|
19
|
-
...
|
|
19
|
+
...args,
|
|
20
20
|
});
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
}
|
|
22
|
+
function functionServerBuilder(yargs) {
|
|
23
23
|
yargs.positional('path', {
|
|
24
|
-
describe: i18n('commands.function.subcommands.server.positionals.path.describe'),
|
|
25
|
-
type: 'string',
|
|
26
|
-
});
|
|
27
|
-
yargs.option('port', {
|
|
28
|
-
describe: i18n('commands.function.subcommands.server.options.port.describe'),
|
|
24
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.server.positionals.path.describe'),
|
|
29
25
|
type: 'string',
|
|
30
|
-
default: 5432,
|
|
31
|
-
});
|
|
32
|
-
yargs.option('contact', {
|
|
33
|
-
describe: i18n('commands.function.subcommands.server.options.contact.describe'),
|
|
34
|
-
type: 'boolean',
|
|
35
|
-
default: true,
|
|
36
|
-
});
|
|
37
|
-
yargs.option('watch', {
|
|
38
|
-
describe: i18n('commands.function.subcommands.server.options.watch.describe'),
|
|
39
|
-
type: 'boolean',
|
|
40
|
-
default: true,
|
|
41
26
|
});
|
|
42
|
-
yargs.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
yargs.options({
|
|
28
|
+
port: {
|
|
29
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.server.options.port.describe'),
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 5432,
|
|
32
|
+
},
|
|
33
|
+
contact: {
|
|
34
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.server.options.contact.describe'),
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
38
|
+
watch: {
|
|
39
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.server.options.watch.describe'),
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
'log-output': {
|
|
44
|
+
describe: (0, lang_1.i18n)('commands.function.subcommands.server.options.logOutput.describe'),
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
46
48
|
});
|
|
47
49
|
yargs.example([
|
|
48
50
|
[
|
|
49
51
|
'$0 functions server ./tmp/myFunctionFolder.functions',
|
|
50
|
-
i18n('commands.function.subcommands.server.examples.default'),
|
|
52
|
+
(0, lang_1.i18n)('commands.function.subcommands.server.examples.default'),
|
|
51
53
|
],
|
|
52
54
|
]);
|
|
53
|
-
addConfigOptions(yargs);
|
|
54
|
-
addAccountOptions(yargs);
|
|
55
|
-
addUseEnvironmentOptions(yargs);
|
|
56
55
|
return yargs;
|
|
56
|
+
}
|
|
57
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(functionServerBuilder, command, describe, {
|
|
58
|
+
useConfigOptions: true,
|
|
59
|
+
useAccountOptions: true,
|
|
60
|
+
useEnvironmentOptions: true,
|
|
61
|
+
});
|
|
62
|
+
const functionServerCommand = {
|
|
63
|
+
command,
|
|
64
|
+
describe,
|
|
65
|
+
handler,
|
|
66
|
+
builder,
|
|
57
67
|
};
|
|
68
|
+
exports.default = functionServerCommand;
|
package/commands/function.d.ts
CHANGED
package/commands/function.js
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
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
|
|
6
|
+
exports.describe = exports.command = void 0;
|
|
7
|
+
const list_1 = __importDefault(require("./function/list"));
|
|
8
|
+
const deploy_1 = __importDefault(require("./function/deploy"));
|
|
9
|
+
const server_1 = __importDefault(require("./function/server"));
|
|
10
|
+
const lang_1 = require("../lib/lang");
|
|
11
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
9
12
|
exports.command = ['function', 'functions'];
|
|
10
|
-
exports.describe = i18n(`commands.function.describe`);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
yargs.command(list).command(deploy).command(server).demandCommand(1, '');
|
|
13
|
+
exports.describe = (0, lang_1.i18n)(`commands.function.describe`);
|
|
14
|
+
function functionBuilder(yargs) {
|
|
15
|
+
yargs.command(list_1.default).command(deploy_1.default).command(server_1.default).demandCommand(1, '');
|
|
14
16
|
return yargs;
|
|
17
|
+
}
|
|
18
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(functionBuilder, exports.command, exports.describe, {
|
|
19
|
+
useGlobalOptions: true,
|
|
20
|
+
});
|
|
21
|
+
const functionCommand = {
|
|
22
|
+
command: exports.command,
|
|
23
|
+
describe: exports.describe,
|
|
24
|
+
builder,
|
|
25
|
+
handler: () => { },
|
|
15
26
|
};
|
|
27
|
+
exports.default = functionCommand;
|
|
28
|
+
// TODO Remove this legacy export once we've migrated all commands to TS
|
|
29
|
+
module.exports = functionCommand;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "clear [table-id]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbClearArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbClearArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
tableId?: number;
|
|
8
4
|
dest?: string;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
6
|
+
declare const hubdbClearCommand: YargsCommandModule<unknown, HubdbClearArgs>;
|
|
7
|
+
export default hubdbClearCommand;
|
package/commands/hubdb/clear.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
4
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
8
5
|
const hubdb_1 = require("@hubspot/local-dev-lib/hubdb");
|
|
9
6
|
const hubdb_2 = require("@hubspot/local-dev-lib/api/hubdb");
|
|
10
7
|
const selectHubDBTablePrompt_1 = require("../../lib/prompts/selectHubDBTablePrompt");
|
|
11
8
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
13
9
|
const lang_1 = require("../../lib/lang");
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
11
|
+
const command = 'clear [table-id]';
|
|
12
|
+
const describe = (0, lang_1.i18n)('commands.hubdb.subcommands.clear.describe');
|
|
16
13
|
async function handler(args) {
|
|
17
14
|
const { derivedAccountId } = args;
|
|
18
15
|
(0, usageTracking_1.trackCommandUsage)('hubdb-clear', {}, derivedAccountId);
|
|
@@ -45,13 +42,23 @@ async function handler(args) {
|
|
|
45
42
|
(0, index_1.logError)(e);
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
|
-
function
|
|
49
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
50
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
51
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
45
|
+
function hubdbClearBuilder(yargs) {
|
|
52
46
|
yargs.positional('table-id', {
|
|
53
47
|
describe: (0, lang_1.i18n)('commands.hubdb.subcommands.clear.positionals.tableId.describe'),
|
|
54
48
|
type: 'string',
|
|
55
49
|
});
|
|
56
50
|
return yargs;
|
|
57
51
|
}
|
|
52
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbClearBuilder, command, describe, {
|
|
53
|
+
useGlobalOptions: true,
|
|
54
|
+
useConfigOptions: true,
|
|
55
|
+
useAccountOptions: true,
|
|
56
|
+
useEnvironmentOptions: true,
|
|
57
|
+
});
|
|
58
|
+
const hubdbClearCommand = {
|
|
59
|
+
command,
|
|
60
|
+
describe,
|
|
61
|
+
handler,
|
|
62
|
+
builder,
|
|
63
|
+
};
|
|
64
|
+
exports.default = hubdbClearCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "create";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbCreateArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
path?: string;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const hubdbCreateCommand: YargsCommandModule<unknown, HubdbCreateArgs>;
|
|
6
|
+
export default hubdbCreateCommand;
|
package/commands/hubdb/create.js
CHANGED
|
@@ -3,9 +3,6 @@ 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.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
|
-
exports.builder = builder;
|
|
9
6
|
const path_1 = __importDefault(require("path"));
|
|
10
7
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
8
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
@@ -14,11 +11,11 @@ const hubdb_1 = require("@hubspot/local-dev-lib/hubdb");
|
|
|
14
11
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
15
12
|
const validation_1 = require("../../lib/validation");
|
|
16
13
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
17
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
18
14
|
const lang_1 = require("../../lib/lang");
|
|
19
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
|
+
const command = 'create';
|
|
18
|
+
const describe = (0, lang_1.i18n)(`commands.hubdb.subcommands.create.describe`);
|
|
22
19
|
function selectPathPrompt(options) {
|
|
23
20
|
return (0, promptUtils_1.promptUser)([
|
|
24
21
|
{
|
|
@@ -66,13 +63,23 @@ async function handler(args) {
|
|
|
66
63
|
(0, index_1.logError)(e);
|
|
67
64
|
}
|
|
68
65
|
}
|
|
69
|
-
function
|
|
70
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
71
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
72
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
66
|
+
function hubdbCreateBuilder(yargs) {
|
|
73
67
|
yargs.options('path', {
|
|
74
68
|
describe: (0, lang_1.i18n)(`commands.hubdb.subcommands.create.options.path.describe`),
|
|
75
69
|
type: 'string',
|
|
76
70
|
});
|
|
77
71
|
return yargs;
|
|
78
72
|
}
|
|
73
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(hubdbCreateBuilder, command, describe, {
|
|
74
|
+
useGlobalOptions: true,
|
|
75
|
+
useConfigOptions: true,
|
|
76
|
+
useAccountOptions: true,
|
|
77
|
+
useEnvironmentOptions: true,
|
|
78
|
+
});
|
|
79
|
+
const hubdbCreateCommand = {
|
|
80
|
+
command,
|
|
81
|
+
describe,
|
|
82
|
+
handler,
|
|
83
|
+
builder,
|
|
84
|
+
};
|
|
85
|
+
exports.default = hubdbCreateCommand;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const command = "delete [table-id]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type HubdbDeleteArgs = CommonArgs & CombinedArgs & {
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
type HubdbDeleteArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
7
3
|
tableId?: number;
|
|
8
4
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
5
|
+
declare const hubdbDeleteCommand: YargsCommandModule<unknown, HubdbDeleteArgs>;
|
|
6
|
+
export default hubdbDeleteCommand;
|