@hubspot/cli 7.7.19-experimental.3 → 7.7.20-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/api/__tests__/migrate.test.d.ts +1 -0
- package/api/__tests__/migrate.test.js +183 -0
- package/commands/__tests__/account.test.d.ts +1 -0
- package/commands/__tests__/account.test.js +74 -0
- package/commands/__tests__/auth.test.d.ts +1 -0
- package/commands/__tests__/auth.test.js +43 -0
- package/commands/__tests__/cms.test.d.ts +1 -0
- package/commands/__tests__/cms.test.js +49 -0
- package/commands/__tests__/config.test.d.ts +1 -0
- package/commands/__tests__/config.test.js +49 -0
- package/commands/__tests__/create.test.d.ts +1 -0
- package/commands/__tests__/create.test.js +38 -0
- package/commands/__tests__/customObject.test.d.ts +1 -0
- package/commands/__tests__/customObject.test.js +54 -0
- package/commands/__tests__/doctor.test.d.ts +1 -0
- package/commands/__tests__/doctor.test.js +139 -0
- package/commands/__tests__/feedback.test.d.ts +1 -0
- package/commands/__tests__/feedback.test.js +62 -0
- package/commands/__tests__/fetch.test.d.ts +1 -0
- package/commands/__tests__/fetch.test.js +56 -0
- package/commands/__tests__/filemanager.test.d.ts +1 -0
- package/commands/__tests__/filemanager.test.js +50 -0
- package/commands/__tests__/function.test.d.ts +1 -0
- package/commands/__tests__/function.test.js +51 -0
- package/commands/__tests__/getStarted.test.d.ts +1 -0
- package/commands/__tests__/getStarted.test.js +170 -0
- package/commands/__tests__/hubdb.test.d.ts +1 -0
- package/commands/__tests__/hubdb.test.js +55 -0
- package/commands/__tests__/init.test.d.ts +1 -0
- package/commands/__tests__/init.test.js +47 -0
- package/commands/__tests__/lint.test.d.ts +1 -0
- package/commands/__tests__/lint.test.js +38 -0
- package/commands/__tests__/list.test.d.ts +1 -0
- package/commands/__tests__/list.test.js +47 -0
- package/commands/__tests__/logs.test.d.ts +1 -0
- package/commands/__tests__/logs.test.js +70 -0
- package/commands/__tests__/mcp.test.d.ts +1 -0
- package/commands/__tests__/mcp.test.js +51 -0
- package/commands/__tests__/mv.test.d.ts +1 -0
- package/commands/__tests__/mv.test.js +84 -0
- package/commands/__tests__/open.test.d.ts +1 -0
- package/commands/__tests__/open.test.js +96 -0
- package/commands/__tests__/project.test.d.ts +1 -0
- package/commands/__tests__/project.test.js +100 -0
- package/commands/__tests__/remove.test.d.ts +1 -0
- package/commands/__tests__/remove.test.js +77 -0
- package/commands/__tests__/sandbox.test.d.ts +1 -0
- package/commands/__tests__/sandbox.test.js +49 -0
- package/commands/__tests__/secret.test.d.ts +1 -0
- package/commands/__tests__/secret.test.js +54 -0
- package/commands/__tests__/testAccount.test.d.ts +1 -0
- package/commands/__tests__/testAccount.test.js +60 -0
- package/commands/__tests__/theme.test.d.ts +1 -0
- package/commands/__tests__/theme.test.js +52 -0
- package/commands/account/__tests__/auth.test.d.ts +1 -0
- package/commands/account/__tests__/auth.test.js +31 -0
- package/commands/account/__tests__/clean.test.d.ts +1 -0
- package/commands/account/__tests__/clean.test.js +33 -0
- package/commands/account/__tests__/createOverride.test.d.ts +1 -0
- package/commands/account/__tests__/createOverride.test.js +37 -0
- package/commands/account/__tests__/info.test.d.ts +1 -0
- package/commands/account/__tests__/info.test.js +33 -0
- package/commands/account/__tests__/list.test.d.ts +1 -0
- package/commands/account/__tests__/list.test.js +33 -0
- package/commands/account/__tests__/remove.test.d.ts +1 -0
- package/commands/account/__tests__/remove.test.js +41 -0
- package/commands/account/__tests__/removeOverride.d.ts +1 -0
- package/commands/account/__tests__/removeOverride.js +30 -0
- package/commands/account/__tests__/rename.test.d.ts +1 -0
- package/commands/account/__tests__/rename.test.js +47 -0
- package/commands/account/__tests__/use.test.d.ts +1 -0
- package/commands/account/__tests__/use.test.js +37 -0
- package/commands/app/__tests__/migrate.test.d.ts +1 -0
- package/commands/app/__tests__/migrate.test.js +129 -0
- package/commands/app/secret/__tests__/add.test.d.ts +1 -0
- package/commands/app/secret/__tests__/add.test.js +33 -0
- package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
- package/commands/app/secret/__tests__/delete.test.js +33 -0
- package/commands/app/secret/__tests__/list.test.d.ts +1 -0
- package/commands/app/secret/__tests__/list.test.js +30 -0
- package/commands/app/secret/__tests__/update.test.d.ts +1 -0
- package/commands/app/secret/__tests__/update.test.js +33 -0
- package/commands/app.js +1 -6
- package/commands/customObject/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/__tests__/create.test.js +45 -0
- package/commands/customObject/__tests__/schema.test.d.ts +1 -0
- package/commands/customObject/__tests__/schema.test.js +58 -0
- package/commands/customObject/schema/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/create.test.js +33 -0
- package/commands/customObject/schema/__tests__/delete.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/delete.test.js +47 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch-all.test.js +46 -0
- package/commands/customObject/schema/__tests__/fetch.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/fetch.test.js +50 -0
- package/commands/customObject/schema/__tests__/list.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/list.test.js +34 -0
- package/commands/customObject/schema/__tests__/update.test.d.ts +1 -0
- package/commands/customObject/schema/__tests__/update.test.js +45 -0
- package/commands/fetch.js +0 -1
- package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
- package/commands/filemanager/__tests__/fetch.test.js +37 -0
- package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
- package/commands/filemanager/__tests__/upload.test.js +35 -0
- package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
- package/commands/hubdb/__tests__/clear.test.js +33 -0
- package/commands/hubdb/__tests__/create.test.d.ts +1 -0
- package/commands/hubdb/__tests__/create.test.js +33 -0
- package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
- package/commands/hubdb/__tests__/delete.test.js +33 -0
- package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
- package/commands/hubdb/__tests__/fetch.test.js +33 -0
- package/commands/hubdb/__tests__/list.test.d.ts +1 -0
- package/commands/hubdb/__tests__/list.test.js +101 -0
- package/commands/logs.js +0 -1
- package/commands/mcp/__tests__/setup.test.d.ts +1 -0
- package/commands/mcp/__tests__/setup.test.js +31 -0
- package/commands/mcp/__tests__/start.test.d.ts +1 -0
- package/commands/mcp/__tests__/start.test.js +32 -0
- package/commands/project/__tests__/add.test.d.ts +1 -0
- package/commands/project/__tests__/add.test.js +48 -0
- package/commands/project/__tests__/create.test.d.ts +1 -0
- package/commands/project/__tests__/create.test.js +45 -0
- package/commands/project/__tests__/deploy.test.d.ts +1 -0
- package/commands/project/__tests__/deploy.test.js +344 -0
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +419 -0
- package/commands/project/__tests__/download.test.d.ts +1 -0
- package/commands/project/__tests__/download.test.js +44 -0
- package/commands/project/__tests__/fixtures/exampleProject.json +33 -0
- package/commands/project/__tests__/installDeps.test.d.ts +1 -0
- package/commands/project/__tests__/installDeps.test.js +180 -0
- package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
- package/commands/project/__tests__/listBuilds.test.js +43 -0
- package/commands/project/__tests__/logs.test.d.ts +1 -0
- package/commands/project/__tests__/logs.test.js +246 -0
- package/commands/project/__tests__/migrate.test.d.ts +1 -0
- package/commands/project/__tests__/migrate.test.js +116 -0
- package/commands/project/__tests__/migrateApp.test.d.ts +1 -0
- package/commands/project/__tests__/migrateApp.test.js +87 -0
- package/commands/project/__tests__/open.test.d.ts +1 -0
- package/commands/project/__tests__/open.test.js +44 -0
- package/commands/project/__tests__/profile.test.d.ts +1 -0
- package/commands/project/__tests__/profile.test.js +47 -0
- package/commands/project/__tests__/upload.test.d.ts +1 -0
- package/commands/project/__tests__/upload.test.js +48 -0
- package/commands/project/__tests__/watch.test.d.ts +1 -0
- package/commands/project/__tests__/watch.test.js +40 -0
- package/commands/project/dev/unifiedFlow.js +1 -1
- package/commands/sandbox/__tests__/create.test.d.ts +1 -0
- package/commands/sandbox/__tests__/create.test.js +36 -0
- package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
- package/commands/sandbox/__tests__/delete.test.js +36 -0
- package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/addSecret.test.js +34 -0
- package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/deleteSecret.test.js +46 -0
- package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/listSecret.test.js +34 -0
- package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/updateSecret.test.js +34 -0
- package/commands/testAccount/__tests__/create.test.d.ts +1 -0
- package/commands/testAccount/__tests__/create.test.js +38 -0
- package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
- package/commands/testAccount/__tests__/createConfig.test.js +40 -0
- package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
- package/commands/testAccount/__tests__/delete.test.js +36 -0
- package/commands/testAccount/create.js +24 -14
- package/commands/theme/__tests__/generate-selectors.test.d.ts +1 -0
- package/commands/theme/__tests__/generate-selectors.test.js +33 -0
- package/commands/theme/__tests__/marketplace-validate.test.d.ts +1 -0
- package/commands/theme/__tests__/marketplace-validate.test.js +41 -0
- package/commands/theme/__tests__/preview.test.d.ts +1 -0
- package/commands/theme/__tests__/preview.test.js +65 -0
- package/lang/en.d.ts +6 -65
- package/lang/en.js +6 -65
- package/lib/__tests__/accountTypes.test.d.ts +1 -0
- package/lib/__tests__/accountTypes.test.js +100 -0
- package/lib/__tests__/buildAccount.test.d.ts +1 -0
- package/lib/__tests__/buildAccount.test.js +231 -0
- package/lib/__tests__/commonOpts.test.d.ts +1 -0
- package/lib/__tests__/commonOpts.test.js +87 -0
- package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
- package/lib/__tests__/dependencyManagement.test.js +180 -0
- package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
- package/lib/__tests__/developerTestAccounts.test.js +180 -0
- package/lib/__tests__/hasFeature.test.d.ts +1 -0
- package/lib/__tests__/hasFeature.test.js +37 -0
- package/lib/__tests__/npm.test.d.ts +1 -0
- package/lib/__tests__/npm.test.js +62 -0
- package/lib/__tests__/oauth.test.d.ts +1 -0
- package/lib/__tests__/oauth.test.js +113 -0
- package/lib/__tests__/parsing.test.d.ts +1 -0
- package/lib/__tests__/parsing.test.js +36 -0
- package/lib/__tests__/polling.test.d.ts +1 -0
- package/lib/__tests__/polling.test.js +78 -0
- package/lib/__tests__/process.test.d.ts +1 -0
- package/lib/__tests__/process.test.js +90 -0
- package/lib/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/__tests__/projectProfiles.test.js +134 -0
- package/lib/__tests__/sandboxSync.test.d.ts +1 -0
- package/lib/__tests__/sandboxSync.test.js +131 -0
- package/lib/__tests__/sandboxes.test.d.ts +1 -0
- package/lib/__tests__/sandboxes.test.js +148 -0
- package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
- package/lib/__tests__/serverlessLogs.test.js +154 -0
- package/lib/__tests__/usageTracking.test.d.ts +1 -0
- package/lib/__tests__/usageTracking.test.js +171 -0
- package/lib/__tests__/validation.test.d.ts +1 -0
- package/lib/__tests__/validation.test.js +145 -0
- package/lib/__tests__/yargsUtils.test.d.ts +1 -0
- package/lib/__tests__/yargsUtils.test.js +74 -0
- package/lib/app/__tests__/migrate.test.d.ts +1 -0
- package/lib/app/__tests__/migrate.test.js +495 -0
- package/lib/app/__tests__/migrate_legacy.test.d.ts +1 -0
- package/lib/app/__tests__/migrate_legacy.test.js +136 -0
- package/lib/buildAccount.d.ts +1 -7
- package/lib/buildAccount.js +4 -54
- package/lib/doctor/Diagnosis.js +11 -11
- package/lib/doctor/Doctor.js +42 -42
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
- package/lib/doctor/__tests__/Diagnosis.test.js +87 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +172 -0
- package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +398 -0
- package/lib/mcp/setup.js +18 -2
- package/lib/middleware/__test__/configMiddleware.test.js +12 -12
- package/lib/middleware/__test__/gitMiddleware.test.js +4 -4
- package/lib/middleware/__test__/notificationsMiddleware.test.js +2 -2
- package/lib/middleware/__test__/requestMiddleware.test.js +2 -2
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +7 -7
- package/lib/middleware/notificationsMiddleware.js +16 -13
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/AppDevModeInterface.test.js +517 -0
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +314 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +175 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.js +191 -0
- package/lib/projects/__tests__/buildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/buildAndDeploy.test.js +25 -0
- package/lib/projects/__tests__/components.test.d.ts +1 -0
- package/lib/projects/__tests__/components.test.js +186 -0
- package/lib/projects/__tests__/projects.test.d.ts +1 -0
- package/lib/projects/__tests__/projects.test.js +89 -0
- package/lib/projects/__tests__/structure.test.d.ts +1 -0
- package/lib/projects/__tests__/structure.test.js +249 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +206 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/v3AddComponent.test.js +190 -0
- package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
- package/lib/projects/create/__tests__/legacy.test.js +126 -0
- package/lib/projects/create/__tests__/v3.test.d.ts +1 -0
- package/lib/projects/create/__tests__/v3.test.js +80 -0
- package/lib/projects/localDev/DevServerManager.js +0 -1
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +2 -2
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/upload.d.ts +1 -2
- package/lib/projects/upload.js +0 -1
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +30 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +42 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +10 -9
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +43 -81
- package/lib/schema.js +5 -1
- package/lib/ui/SpinniesManager.js +0 -1
- package/lib/ui/supportHyperlinks.js +2 -2
- package/lib/ui/supportsColor.js +2 -2
- package/lib/utils/hasFlag.d.ts +1 -0
- package/lib/utils/hasFlag.js +15 -0
- package/lib/yargsUtils.d.ts +2 -1
- package/lib/yargsUtils.js +3 -13
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +152 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +129 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +120 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +127 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +108 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +111 -0
- package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/command.test.js +47 -0
- package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/project.test.js +81 -0
- package/package.json +8 -8
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -127
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
37
|
+
const github = __importStar(require("@hubspot/local-dev-lib/api/github"));
|
|
38
|
+
const exitCodes_1 = require("../../../enums/exitCodes");
|
|
39
|
+
const legacy_1 = require("../legacy");
|
|
40
|
+
const constants_1 = require("../../../constants");
|
|
41
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
42
|
+
vi.mock('@hubspot/local-dev-lib/api/github');
|
|
43
|
+
const mockedFetchRepoFile = vi.mocked(github.fetchRepoFile);
|
|
44
|
+
const repoConfig = {
|
|
45
|
+
[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]: [
|
|
46
|
+
{
|
|
47
|
+
label: 'Component 1',
|
|
48
|
+
path: 'component1',
|
|
49
|
+
type: 'Component',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
|
|
53
|
+
{
|
|
54
|
+
name: 'project1',
|
|
55
|
+
label: 'Project 1',
|
|
56
|
+
path: 'project1',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
describe('lib/projects/create/legacy', () => {
|
|
61
|
+
describe('getProjectComponentListFromRepo()', () => {
|
|
62
|
+
it('returns a list of components', async () => {
|
|
63
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
64
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
65
|
+
data: repoConfig,
|
|
66
|
+
});
|
|
67
|
+
const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
|
|
68
|
+
expect(components).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]);
|
|
69
|
+
});
|
|
70
|
+
it('returns an empty list if no components are found', async () => {
|
|
71
|
+
mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
|
|
72
|
+
const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
|
|
73
|
+
expect(components).toEqual([]);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('getProjectTemplateListFromRepo()', () => {
|
|
77
|
+
let exitMock;
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
// @ts-expect-error - Mocking process.exit
|
|
80
|
+
exitMock = vi
|
|
81
|
+
.spyOn(process, 'exit')
|
|
82
|
+
.mockImplementation(() => undefined);
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
exitMock.mockRestore();
|
|
86
|
+
});
|
|
87
|
+
it('returns a list of project templates', async () => {
|
|
88
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
89
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
90
|
+
data: repoConfig,
|
|
91
|
+
});
|
|
92
|
+
const templates = await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
93
|
+
expect(templates).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]);
|
|
94
|
+
});
|
|
95
|
+
it('Logs an error and exits the process if the request for the template list fails', async () => {
|
|
96
|
+
mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
|
|
97
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
98
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Failed to fetch the config.json file from the target repository/));
|
|
99
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
100
|
+
});
|
|
101
|
+
it('Logs an error and exits the process if there are no projects listed in the repo config', async () => {
|
|
102
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
103
|
+
mockedFetchRepoFile.mockResolvedValue({});
|
|
104
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
105
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Unable to find any projects in the target repository's config.json file/));
|
|
106
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
107
|
+
});
|
|
108
|
+
it('Logs an error and exits the process if any of the projects in the repo config are missing required properties', async () => {
|
|
109
|
+
// @ts-expect-error - Mocking AxiosResponse
|
|
110
|
+
mockedFetchRepoFile.mockResolvedValue({
|
|
111
|
+
data: {
|
|
112
|
+
...repoConfig,
|
|
113
|
+
[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
|
|
114
|
+
{
|
|
115
|
+
name: 'project1',
|
|
116
|
+
label: 'Project 1',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
|
|
122
|
+
expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Found misconfigured projects in the target repository's config.json file/));
|
|
123
|
+
expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const v3_1 = require("../v3");
|
|
4
|
+
vi.mock('@hubspot/local-dev-lib/logger');
|
|
5
|
+
vi.mock('@hubspot/local-dev-lib/api/github');
|
|
6
|
+
describe('lib/projects/create/v3', () => {
|
|
7
|
+
describe('calculateComponentTemplateChoices()', () => {
|
|
8
|
+
const mockComponents = [
|
|
9
|
+
{
|
|
10
|
+
label: 'Module Component',
|
|
11
|
+
path: 'module',
|
|
12
|
+
type: 'module',
|
|
13
|
+
supportedAuthTypes: ['oauth'],
|
|
14
|
+
supportedDistributions: ['private'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: 'Card Component',
|
|
18
|
+
path: 'card',
|
|
19
|
+
type: 'card',
|
|
20
|
+
supportedAuthTypes: ['oauth', 'static'],
|
|
21
|
+
supportedDistributions: ['private', 'marketplace'],
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
const mockProjectMetadataForChoices = {
|
|
25
|
+
hsMetaFiles: [],
|
|
26
|
+
components: {
|
|
27
|
+
module: { count: 0, maxCount: 5, hsMetaFiles: [] },
|
|
28
|
+
card: { count: 3, maxCount: 3, hsMetaFiles: [] },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
it('returns enabled components when they meet all requirements', () => {
|
|
32
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'private', mockProjectMetadataForChoices);
|
|
33
|
+
expect(choices).toHaveLength(3); // includes separator
|
|
34
|
+
expect(choices[0]).toEqual({
|
|
35
|
+
name: 'Module Component',
|
|
36
|
+
value: mockComponents[0],
|
|
37
|
+
});
|
|
38
|
+
expect(choices[2]).toEqual({
|
|
39
|
+
name: expect.stringContaining('Card Component'),
|
|
40
|
+
value: mockComponents[1],
|
|
41
|
+
disabled: expect.stringContaining('maximum'),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('disables components when auth type is not supported', () => {
|
|
45
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'privatekey', 'private', mockProjectMetadataForChoices);
|
|
46
|
+
// All components should be disabled, so they come after the separator
|
|
47
|
+
expect(choices[1]).toEqual({
|
|
48
|
+
name: expect.stringContaining('Module Component'),
|
|
49
|
+
value: mockComponents[0],
|
|
50
|
+
disabled: expect.stringContaining('privatekey'),
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it('disables components when distribution is not supported', () => {
|
|
54
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'enterprise', mockProjectMetadataForChoices);
|
|
55
|
+
// All components should be disabled, so they come after the separator
|
|
56
|
+
expect(choices[1]).toEqual({
|
|
57
|
+
name: expect.stringContaining('Module Component'),
|
|
58
|
+
value: mockComponents[0],
|
|
59
|
+
disabled: expect.stringContaining('enterprise'),
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('handles components without auth type or distribution restrictions', () => {
|
|
63
|
+
const componentsWithoutRestrictions = [
|
|
64
|
+
{
|
|
65
|
+
label: 'Unrestricted Component',
|
|
66
|
+
path: 'unrestricted',
|
|
67
|
+
type: 'module',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
const choices = (0, v3_1.calculateComponentTemplateChoices)(componentsWithoutRestrictions, 'oauth', 'private', {
|
|
71
|
+
hsMetaFiles: [],
|
|
72
|
+
components: { module: { count: 0, maxCount: 5, hsMetaFiles: [] } },
|
|
73
|
+
});
|
|
74
|
+
expect(choices[0]).toEqual({
|
|
75
|
+
name: 'Unrestricted Component',
|
|
76
|
+
value: componentsWithoutRestrictions[0],
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -11,7 +11,7 @@ export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount):
|
|
|
11
11
|
export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
|
|
12
12
|
export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
13
13
|
export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
14
|
-
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment
|
|
14
|
+
export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
|
|
15
15
|
export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
|
|
16
16
|
export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
|
|
17
17
|
export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIR?: boolean, profile?: string): Promise<Build>;
|
|
@@ -152,7 +152,7 @@ async function createSandboxForLocalDev(accountId, accountConfig, env) {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
// Create a developer test account and return its accountId
|
|
155
|
-
async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env
|
|
155
|
+
async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env) {
|
|
156
156
|
let currentPortalCount = 0;
|
|
157
157
|
let maxTestPortals = 10;
|
|
158
158
|
try {
|
|
@@ -182,7 +182,7 @@ async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, e
|
|
|
182
182
|
accountType: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
|
|
183
183
|
});
|
|
184
184
|
(0, usageTracking_1.trackCommandMetadataUsage)('developer-test-account-create', { step: 'project-dev' }, accountId);
|
|
185
|
-
const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals
|
|
185
|
+
const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals);
|
|
186
186
|
return result;
|
|
187
187
|
}
|
|
188
188
|
catch (err) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentTypes, Component, GenericComponentConfig, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects';
|
|
2
|
-
import {
|
|
2
|
+
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
3
3
|
import { AppIRNode } from '../../types/ProjectComponents';
|
|
4
4
|
export declare const CONFIG_FILES: {
|
|
5
5
|
[k in ComponentTypes]: string;
|
|
@@ -15,4 +15,4 @@ export declare function getProjectComponentTypes(components: Array<Component>):
|
|
|
15
15
|
export declare function getComponentUid(component?: Component | null): string | null;
|
|
16
16
|
export declare function componentIsApp(component?: Component | null): component is Component<PublicAppComponentConfig | PrivateAppComponentConfig>;
|
|
17
17
|
export declare function componentIsPublicApp(component?: Component | null): component is Component<PublicAppComponentConfig>;
|
|
18
|
-
export declare function isAppIRNode(component: IntermediateRepresentationNodeLocalDev
|
|
18
|
+
export declare function isAppIRNode(component: IntermediateRepresentationNodeLocalDev): component is AppIRNode;
|
package/lib/projects/upload.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FileResult } from 'tmp';
|
|
2
|
-
import { IntermediateRepresentation } from '@hubspot/project-parsing-lib';
|
|
3
2
|
import { ProjectConfig } from '../../types/Projects';
|
|
4
3
|
type ProjectUploadCallbackFunction<T> = (accountId: number, projectConfig: ProjectConfig, tempFile: FileResult, buildId: number) => Promise<T>;
|
|
5
4
|
type ProjectUploadResult<T> = {
|
|
@@ -21,5 +20,5 @@ type HandleProjectUploadArg<T> = {
|
|
|
21
20
|
export declare function handleProjectUpload<T>({ accountId, projectConfig, projectDir, callbackFunc, profile, uploadMessage, forceCreate, isUploadCommand, sendIR, skipValidation, }: HandleProjectUploadArg<T>): Promise<ProjectUploadResult<T>>;
|
|
22
21
|
export declare function validateSourceDirectory(srcDir: string, projectConfig: ProjectConfig): void;
|
|
23
22
|
export declare function validateNoHSMetaMismatch(srcDir: string, projectConfig: ProjectConfig): Promise<void>;
|
|
24
|
-
export declare function handleTranslate(projectDir: string, projectConfig: ProjectConfig, accountId: number, skipValidation: boolean, profile: string | undefined): Promise<
|
|
23
|
+
export declare function handleTranslate(projectDir: string, projectConfig: ProjectConfig, accountId: number, skipValidation: boolean, profile: string | undefined): Promise<unknown>;
|
|
25
24
|
export {};
|
package/lib/projects/upload.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
4
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
5
|
+
const downloadProjectPrompt_1 = require("../downloadProjectPrompt");
|
|
6
|
+
vi.mock('../promptUtils', () => ({
|
|
7
|
+
promptUser: vi.fn().mockResolvedValue({ project: 'test-project' }),
|
|
8
|
+
}));
|
|
9
|
+
vi.mock('@hubspot/local-dev-lib/api/projects', () => ({
|
|
10
|
+
fetchProjects: vi.fn().mockResolvedValue({
|
|
11
|
+
data: { results: [] },
|
|
12
|
+
}),
|
|
13
|
+
}));
|
|
14
|
+
vi.mock('@hubspot/local-dev-lib/config', () => ({
|
|
15
|
+
getAccountId: vi.fn().mockImplementation(() => 123456789),
|
|
16
|
+
}));
|
|
17
|
+
describe('lib/prompts/downloadProjectPrompt', () => {
|
|
18
|
+
it('should honor the account passed as an option', async () => {
|
|
19
|
+
const account = 'Prod';
|
|
20
|
+
await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
|
|
21
|
+
expect(config_1.getAccountId).toHaveBeenCalledTimes(1);
|
|
22
|
+
expect(config_1.getAccountId).toHaveBeenCalledWith(account);
|
|
23
|
+
});
|
|
24
|
+
it('should fetch the projects for the correct accountId', async () => {
|
|
25
|
+
const account = 'Prod';
|
|
26
|
+
await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
|
|
27
|
+
expect(projects_1.fetchProjects).toHaveBeenCalledTimes(1);
|
|
28
|
+
expect(projects_1.fetchProjects).toHaveBeenCalledWith(123456789);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
const projectsLogsPrompt_1 = require("../projectsLogsPrompt");
|
|
7
|
+
const promptUtils_1 = require("../promptUtils");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
vi.mock('../promptUtils');
|
|
10
|
+
describe('lib/prompts/projectsLogsPrompt', () => {
|
|
11
|
+
it('should return undefined functionName when functionChoices is undefined', async () => {
|
|
12
|
+
const actual = await (0, projectsLogsPrompt_1.projectLogsPrompt)({ functionChoices: undefined });
|
|
13
|
+
expect(actual).toEqual({});
|
|
14
|
+
expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
|
|
15
|
+
});
|
|
16
|
+
it('should return the functionName without prompting when there is only one functionChoice', async () => {
|
|
17
|
+
const functionChoice = 'this-is-the-only-function';
|
|
18
|
+
const { functionName } = await (0, projectsLogsPrompt_1.projectLogsPrompt)({
|
|
19
|
+
functionChoices: [functionChoice],
|
|
20
|
+
});
|
|
21
|
+
expect(functionName).toEqual(functionChoice);
|
|
22
|
+
expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
|
|
23
|
+
});
|
|
24
|
+
it('should prompt the user if there is more than one choice', async () => {
|
|
25
|
+
const functionChoices = ['choice 1', 'choice 2'];
|
|
26
|
+
const projectName = 'my cool project';
|
|
27
|
+
await (0, projectsLogsPrompt_1.projectLogsPrompt)({
|
|
28
|
+
functionChoices,
|
|
29
|
+
projectName,
|
|
30
|
+
});
|
|
31
|
+
expect(promptUtils_1.promptUser).toHaveBeenCalledTimes(1);
|
|
32
|
+
expect(promptUtils_1.promptUser).toHaveBeenLastCalledWith(expect.arrayContaining([
|
|
33
|
+
expect.objectContaining({
|
|
34
|
+
name: 'functionName',
|
|
35
|
+
type: 'list',
|
|
36
|
+
message: `[--function] Select function in ${chalk_1.default.bold(projectName)} project`,
|
|
37
|
+
when: expect.any(Function),
|
|
38
|
+
choices: functionChoices,
|
|
39
|
+
}),
|
|
40
|
+
]));
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
2
2
|
declare const hubs: {
|
|
3
|
-
MARKETING:
|
|
4
|
-
OPS:
|
|
5
|
-
SERVICE:
|
|
6
|
-
SALES:
|
|
7
|
-
CONTENT:
|
|
3
|
+
readonly MARKETING: "marketingLevel";
|
|
4
|
+
readonly OPS: "opsLevel";
|
|
5
|
+
readonly SERVICE: "serviceLevel";
|
|
6
|
+
readonly SALES: "salesLevel";
|
|
7
|
+
readonly CONTENT: "contentLevel";
|
|
8
8
|
};
|
|
9
|
-
type
|
|
10
|
-
|
|
9
|
+
type HubName = keyof typeof hubs;
|
|
10
|
+
type HubTier = 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE';
|
|
11
|
+
export type HubConfig = `${HubName}:${HubTier}`;
|
|
11
12
|
export declare function createDeveloperTestAccountConfigPrompt(args?: {
|
|
12
13
|
name?: string;
|
|
13
14
|
description?: string;
|
|
14
15
|
tiers?: HubConfig[];
|
|
15
|
-
}
|
|
16
|
+
}): Promise<DeveloperTestAccountConfig>;
|
|
16
17
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createDeveloperTestAccountConfigPrompt = createDeveloperTestAccountConfigPrompt;
|
|
4
|
-
const prompts_1 = require("@inquirer/prompts");
|
|
5
4
|
const en_1 = require("../../lang/en");
|
|
6
5
|
const promptUtils_1 = require("./promptUtils");
|
|
6
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
7
7
|
const hubs = {
|
|
8
8
|
MARKETING: 'marketingLevel',
|
|
9
9
|
OPS: 'opsLevel',
|
|
@@ -11,43 +11,32 @@ const hubs = {
|
|
|
11
11
|
SALES: 'salesLevel',
|
|
12
12
|
CONTENT: 'contentLevel',
|
|
13
13
|
};
|
|
14
|
-
const AccountTiers = {
|
|
15
|
-
FREE: 'FREE',
|
|
16
|
-
STARTER: 'STARTER',
|
|
17
|
-
PROFESSIONAL: 'PROFESSIONAL',
|
|
18
|
-
ENTERPRISE: 'ENTERPRISE',
|
|
19
|
-
};
|
|
20
|
-
const makeHubTiers = (hubKey) => {
|
|
21
|
-
const langKey = hubKey.toLowerCase();
|
|
22
|
-
const langObj = en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiers[langKey];
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
name: langObj.free,
|
|
26
|
-
value: `${hubKey.toUpperCase()}:${AccountTiers.FREE}`,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: langObj.starter,
|
|
30
|
-
value: `${hubKey.toUpperCase()}:${AccountTiers.STARTER}`,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: langObj.professional,
|
|
34
|
-
value: `${hubKey.toUpperCase()}:${AccountTiers.PROFESSIONAL}`,
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
};
|
|
38
14
|
const TEST_ACCOUNT_TIERS = [
|
|
39
|
-
|
|
15
|
+
{ name: 'Marketing STARTER', value: 'MARKETING:STARTER' },
|
|
16
|
+
{
|
|
17
|
+
name: 'Marketing PROFESSIONAL',
|
|
18
|
+
value: 'MARKETING:PROFESSIONAL',
|
|
19
|
+
},
|
|
20
|
+
{ name: 'Marketing ENTERPRISE', value: 'MARKETING:ENTERPRISE' },
|
|
40
21
|
new prompts_1.Separator(),
|
|
41
|
-
|
|
22
|
+
{ name: 'Ops STARTER', value: 'OPS:STARTER' },
|
|
23
|
+
{ name: 'Ops PROFESSIONAL', value: 'OPS:PROFESSIONAL' },
|
|
24
|
+
{ name: 'Ops ENTERPRISE', value: 'OPS:ENTERPRISE' },
|
|
42
25
|
new prompts_1.Separator(),
|
|
43
|
-
|
|
26
|
+
{ name: 'Service STARTER', value: 'SERVICE:STARTER' },
|
|
27
|
+
{ name: 'Service PROFESSIONAL', value: 'SERVICE:PROFESSIONAL' },
|
|
28
|
+
{ name: 'Service ENTERPRISE', value: 'SERVICE:ENTERPRISE' },
|
|
44
29
|
new prompts_1.Separator(),
|
|
45
|
-
|
|
30
|
+
{ name: 'Sales STARTER', value: 'SALES:STARTER' },
|
|
31
|
+
{ name: 'Sales PROFESSIONAL', value: 'SALES:PROFESSIONAL' },
|
|
32
|
+
{ name: 'Sales ENTERPRISE', value: 'SALES:ENTERPRISE' },
|
|
46
33
|
new prompts_1.Separator(),
|
|
47
|
-
|
|
34
|
+
{ name: 'Content STARTER', value: 'CONTENT:STARTER' },
|
|
35
|
+
{ name: 'Content PROFESSIONAL', value: 'CONTENT:PROFESSIONAL' },
|
|
36
|
+
{ name: 'Content ENTERPRISE', value: 'CONTENT:ENTERPRISE' },
|
|
48
37
|
new prompts_1.Separator(),
|
|
49
38
|
];
|
|
50
|
-
async function createDeveloperTestAccountConfigPrompt(args = {}
|
|
39
|
+
async function createDeveloperTestAccountConfigPrompt(args = {}) {
|
|
51
40
|
const { name, description, tiers } = args;
|
|
52
41
|
let accountName = name;
|
|
53
42
|
let accountDescription = description;
|
|
@@ -55,7 +44,7 @@ async function createDeveloperTestAccountConfigPrompt(args = {}, supportFlags =
|
|
|
55
44
|
if (!accountName) {
|
|
56
45
|
const namePromptResult = await (0, promptUtils_1.promptUser)({
|
|
57
46
|
name: 'accountName',
|
|
58
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt
|
|
47
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt,
|
|
59
48
|
type: 'input',
|
|
60
49
|
});
|
|
61
50
|
accountName = namePromptResult.accountName;
|
|
@@ -63,70 +52,43 @@ async function createDeveloperTestAccountConfigPrompt(args = {}, supportFlags =
|
|
|
63
52
|
if (!accountDescription) {
|
|
64
53
|
const descriptionPromptResult = await (0, promptUtils_1.promptUser)({
|
|
65
54
|
name: 'description',
|
|
66
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt
|
|
55
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt,
|
|
67
56
|
type: 'input',
|
|
68
57
|
});
|
|
69
58
|
accountDescription = descriptionPromptResult.description;
|
|
70
59
|
}
|
|
71
60
|
if (!accountLevelsArray) {
|
|
72
|
-
const
|
|
73
|
-
name: '
|
|
74
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.useDefaultAccountLevelsPrompt.manual,
|
|
86
|
-
value: 'manual',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
});
|
|
90
|
-
if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === 'manual') {
|
|
91
|
-
const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
92
|
-
name: 'testAccountLevels',
|
|
93
|
-
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt(supportFlags),
|
|
94
|
-
pageSize: 10,
|
|
95
|
-
type: 'checkbox',
|
|
96
|
-
choices: TEST_ACCOUNT_TIERS,
|
|
97
|
-
validate: choices => {
|
|
98
|
-
if (choices?.length > 1) {
|
|
99
|
-
const hubMap = {};
|
|
100
|
-
for (const choice of choices) {
|
|
101
|
-
const hub = choice.value.split(':')[0];
|
|
102
|
-
if (hubMap[hub]) {
|
|
103
|
-
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
104
|
-
.tiersError;
|
|
105
|
-
}
|
|
106
|
-
hubMap[hub] = true;
|
|
61
|
+
const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
|
|
62
|
+
name: 'testAccountLevels',
|
|
63
|
+
message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt,
|
|
64
|
+
type: 'checkbox',
|
|
65
|
+
choices: TEST_ACCOUNT_TIERS,
|
|
66
|
+
validate: choices => {
|
|
67
|
+
if (choices?.length > 1) {
|
|
68
|
+
const hubMap = {};
|
|
69
|
+
for (const choice of choices) {
|
|
70
|
+
const hub = choice.split(':')[0];
|
|
71
|
+
if (hubMap[hub]) {
|
|
72
|
+
return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
|
|
73
|
+
.tiersError;
|
|
107
74
|
}
|
|
75
|
+
hubMap[hub] = true;
|
|
108
76
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
accountLevelsArray = accountLevelsPromptResult.testAccountLevels;
|
|
114
82
|
}
|
|
115
83
|
if (!accountLevelsArray) {
|
|
116
84
|
accountLevelsArray = [];
|
|
117
85
|
}
|
|
118
86
|
const accountLevels = accountLevelsArray.reduce((acc, level) => {
|
|
119
|
-
const [
|
|
120
|
-
const hubLevel = hubs[
|
|
87
|
+
const [hubName, hubTier] = level.split(':');
|
|
88
|
+
const hubLevel = hubs[hubName];
|
|
121
89
|
acc[hubLevel] = hubTier;
|
|
122
90
|
return acc;
|
|
123
91
|
}, {});
|
|
124
|
-
Object.values(hubs).forEach(hubLevel => {
|
|
125
|
-
if (!accountLevels[hubLevel]) {
|
|
126
|
-
accountLevels[hubLevel] = AccountTiers.ENTERPRISE;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
console.log('accountLevels', accountLevels);
|
|
130
92
|
return {
|
|
131
93
|
accountName: accountName,
|
|
132
94
|
description: accountDescription,
|
package/lib/schema.js
CHANGED
|
@@ -13,6 +13,10 @@ function logSchemas(schemas) {
|
|
|
13
13
|
const data = schemas
|
|
14
14
|
.map(r => [r.labels.singular, r.name, r.objectTypeId || ''])
|
|
15
15
|
.sort((a, b) => (a[1] > b[1] ? 1 : -1));
|
|
16
|
+
if (data.length === 0) {
|
|
17
|
+
logger_1.logger.log('No Schemas were found');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
16
20
|
data.unshift([
|
|
17
21
|
chalk_1.default.bold('Label'),
|
|
18
22
|
chalk_1.default.bold('Name'),
|
|
@@ -22,7 +26,7 @@ function logSchemas(schemas) {
|
|
|
22
26
|
singleLine: true,
|
|
23
27
|
border: (0, table_1.getBorderCharacters)('honeywell'),
|
|
24
28
|
};
|
|
25
|
-
logger_1.logger.log(
|
|
29
|
+
logger_1.logger.log((0, table_1.table)(data, tableConfig));
|
|
26
30
|
}
|
|
27
31
|
async function listSchemas(accountId) {
|
|
28
32
|
const { data } = await (0, customObjects_1.fetchObjectSchemas)(accountId);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.supportsHyperlinkModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const hasFlag_1 = require("../utils/hasFlag");
|
|
5
5
|
//See https://github.com/jamestalmage/supports-hyperlinks (License: https://github.com/jamestalmage/supports-hyperlinks/blob/master/license)
|
|
6
6
|
function parseVersion(versionString) {
|
|
7
7
|
if (/^\d{3,4}$/.test(versionString)) {
|
|
@@ -22,7 +22,7 @@ function parseVersion(versionString) {
|
|
|
22
22
|
}
|
|
23
23
|
function supportsHyperlink(stream) {
|
|
24
24
|
const { env } = process;
|
|
25
|
-
if ((0,
|
|
25
|
+
if ((0, hasFlag_1.hasFlag)('noHyperlinks')) {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
if (stream && !stream.isTTY) {
|
package/lib/ui/supportsColor.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.supportsColor = void 0;
|
|
|
7
7
|
const process_1 = __importDefault(require("process"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const tty_1 = __importDefault(require("tty"));
|
|
10
|
-
const
|
|
10
|
+
const hasFlag_1 = require("../utils/hasFlag");
|
|
11
11
|
const { env } = process_1.default;
|
|
12
12
|
function translateLevel(level) {
|
|
13
13
|
if (level === 0) {
|
|
@@ -33,7 +33,7 @@ function _supportsColor(haveStream, { streamIsTTY } = {}) {
|
|
|
33
33
|
if (env.TERM === 'dumb') {
|
|
34
34
|
return min;
|
|
35
35
|
}
|
|
36
|
-
if ((0,
|
|
36
|
+
if ((0, hasFlag_1.hasFlag)('noColor')) {
|
|
37
37
|
return 0;
|
|
38
38
|
}
|
|
39
39
|
if (process_1.default.platform === 'win32') {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasFlag(flag: string, argv?: string[]): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
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.hasFlag = hasFlag;
|
|
7
|
+
const process_1 = __importDefault(require("process"));
|
|
8
|
+
// See https://github.com/sindresorhus/has-flag/blob/main/index.js (License: https://github.com/sindresorhus/has-flag/blob/main/license)
|
|
9
|
+
function hasFlag(flag, argv = process_1.default.argv) {
|
|
10
|
+
const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
|
|
11
|
+
const position = argv.indexOf(prefix + flag);
|
|
12
|
+
const terminatorPosition = argv.indexOf('--');
|
|
13
|
+
return (position !== -1 &&
|
|
14
|
+
(terminatorPosition === -1 || position < terminatorPosition));
|
|
15
|
+
}
|