@hubspot/cli 8.2.0-beta.0 → 8.3.0-beta.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/migrate.js +5 -1
- package/commands/account/auth.js +15 -5
- package/commands/account/use.js +14 -4
- package/commands/app/__tests__/migrate.test.js +2 -2
- package/commands/app/migrate.js +3 -3
- package/commands/auth.js +10 -6
- package/commands/cms/__tests__/upload.test.js +4 -0
- package/commands/getStarted.js +1 -1
- package/commands/hubdb/clear.js +4 -0
- package/commands/hubdb/delete.js +4 -0
- package/commands/hubdb/fetch.js +4 -0
- package/commands/init.js +4 -0
- package/commands/project/__tests__/create.test.js +2 -2
- package/commands/project/__tests__/migrate.test.js +3 -3
- package/commands/project/create.js +3 -3
- package/commands/project/dev/index.js +29 -19
- package/commands/project/download.js +5 -1
- package/commands/project/migrate.js +7 -7
- package/commands/sandbox/__tests__/create.test.js +1 -48
- package/commands/sandbox/create.js +3 -30
- package/commands/testAccount/create.js +4 -0
- package/lang/en.d.ts +3 -3
- package/lang/en.js +4 -4
- package/lib/__tests__/buildAccount.test.js +1 -52
- package/lib/__tests__/sandboxes.test.js +1 -29
- package/lib/accountAuth.js +4 -0
- package/lib/app/__tests__/migrate.test.js +1 -1
- package/lib/app/migrate.js +11 -6
- package/lib/buildAccount.d.ts +1 -6
- package/lib/buildAccount.js +9 -42
- package/lib/constants.d.ts +0 -2
- package/lib/constants.js +0 -2
- package/lib/errors/PromptExitError.d.ts +4 -0
- package/lib/errors/PromptExitError.js +8 -0
- package/lib/getStartedV2Actions.js +1 -1
- package/lib/projects/__tests__/components.test.js +14 -0
- package/lib/projects/components.js +12 -2
- package/lib/projects/localDev/AppDevModeInterface.js +4 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +4 -0
- package/lib/projects/localDev/helpers/account.js +5 -11
- package/lib/prompts/downloadProjectPrompt.js +11 -10
- package/lib/prompts/installAppPrompt.js +3 -2
- package/lib/prompts/personalAccessKeyPrompt.js +3 -2
- package/lib/prompts/projectDevTargetAccountPrompt.js +13 -16
- package/lib/prompts/selectHubDBTablePrompt.js +8 -4
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +12 -6
- package/lib/sandboxes.d.ts +1 -9
- package/lib/sandboxes.js +0 -21
- package/lib/theme/__tests__/migrate.test.js +7 -16
- package/lib/theme/migrate.d.ts +1 -1
- package/lib/theme/migrate.js +1 -5
- package/lib/ui/SpinniesManager.js +2 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +1 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +1 -0
- package/mcp-server/tools/project/CreateProjectTool.js +2 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +0 -1
- package/mcp-server/tools/project/constants.d.ts +1 -0
- package/mcp-server/tools/project/constants.js +2 -1
- package/package.json +2 -2
- package/lib/__tests__/sandboxSync.test.d.ts +0 -1
- package/lib/__tests__/sandboxSync.test.js +0 -147
- package/lib/sandboxSync.d.ts +0 -4
- package/lib/sandboxSync.js +0 -102
package/lib/sandboxSync.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import SpinniesManager from './ui/SpinniesManager.js';
|
|
2
|
-
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
3
|
-
import { uiLogger } from './ui/logger.js';
|
|
4
|
-
import { initiateSync } from '@hubspot/local-dev-lib/api/sandboxSync';
|
|
5
|
-
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
|
-
import { lib } from '../lang/en.js';
|
|
7
|
-
import { getAvailableSyncTypes, getSandboxTypeAsString } from './sandboxes.js';
|
|
8
|
-
import { debugError, logError, ApiErrorContext, } from './errorHandlers/index.js';
|
|
9
|
-
import { uiAccountDescription, uiLine, uiCommandDisabledBanner, } from './ui/index.js';
|
|
10
|
-
import { isDevelopmentSandbox } from './accountTypes.js';
|
|
11
|
-
export async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, slimInfoMessage = false) {
|
|
12
|
-
const accountId = accountConfig.accountId;
|
|
13
|
-
const parentAccountId = parentAccountConfig.accountId;
|
|
14
|
-
const isDevSandbox = isDevelopmentSandbox(accountConfig);
|
|
15
|
-
if (!accountId || !parentAccountId) {
|
|
16
|
-
throw new Error(lib.sandbox.sync.failure.invalidUser(uiAccountDescription(accountId), uiAccountDescription(parentAccountId)));
|
|
17
|
-
}
|
|
18
|
-
SpinniesManager.init({
|
|
19
|
-
succeedColor: 'white',
|
|
20
|
-
});
|
|
21
|
-
let availableSyncTasks = syncTasks;
|
|
22
|
-
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
23
|
-
const syncStatusUrl = `${baseUrl}/sandboxes-developer/${parentAccountId}/${getSandboxTypeAsString(accountConfig.accountType)}`;
|
|
24
|
-
try {
|
|
25
|
-
// If no sync tasks exist, fetch sync types based on default account. Parent account required for fetch
|
|
26
|
-
if (!availableSyncTasks ||
|
|
27
|
-
(typeof availableSyncTasks === 'object' &&
|
|
28
|
-
availableSyncTasks.length === 0)) {
|
|
29
|
-
availableSyncTasks = await getAvailableSyncTypes(parentAccountConfig, accountConfig);
|
|
30
|
-
}
|
|
31
|
-
SpinniesManager.add('sandboxSync', {
|
|
32
|
-
text: lib.sandbox.sync.loading.startSync,
|
|
33
|
-
});
|
|
34
|
-
await initiateSync(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
35
|
-
const spinniesText = isDevSandbox
|
|
36
|
-
? lib.sandbox.sync.loading.succeedDevSb(accountId)
|
|
37
|
-
: lib.sandbox.sync.loading.succeed(accountId);
|
|
38
|
-
SpinniesManager.succeed('sandboxSync', {
|
|
39
|
-
text: slimInfoMessage
|
|
40
|
-
? lib.sandbox.sync.loading.successDevSbInfo(accountId, syncStatusUrl)
|
|
41
|
-
: spinniesText,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
debugError(err);
|
|
46
|
-
SpinniesManager.fail('sandboxSync', {
|
|
47
|
-
text: lib.sandbox.sync.loading.fail(accountId),
|
|
48
|
-
});
|
|
49
|
-
uiLogger.log('');
|
|
50
|
-
if (isSpecifiedError(err, {
|
|
51
|
-
statusCode: 403,
|
|
52
|
-
category: 'BANNED',
|
|
53
|
-
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USER',
|
|
54
|
-
})) {
|
|
55
|
-
uiLogger.error(lib.sandbox.sync.failure.invalidUser(uiAccountDescription(accountId), uiAccountDescription(parentAccountId)));
|
|
56
|
-
}
|
|
57
|
-
else if (isSpecifiedError(err, {
|
|
58
|
-
statusCode: 429,
|
|
59
|
-
category: 'RATE_LIMITS',
|
|
60
|
-
subCategory: 'sandboxes-sync-api.SYNC_IN_PROGRESS',
|
|
61
|
-
})) {
|
|
62
|
-
uiLogger.error(lib.sandbox.sync.failure.syncInProgress(`${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`));
|
|
63
|
-
}
|
|
64
|
-
else if (isSpecifiedError(err, {
|
|
65
|
-
statusCode: 403,
|
|
66
|
-
category: 'BANNED',
|
|
67
|
-
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USERID',
|
|
68
|
-
})) {
|
|
69
|
-
// This will only trigger if a user is not a super admin of the target account.
|
|
70
|
-
uiLogger.error(lib.sandbox.sync.failure.notSuperAdmin(accountId));
|
|
71
|
-
}
|
|
72
|
-
else if (isSpecifiedError(err, {
|
|
73
|
-
statusCode: 404,
|
|
74
|
-
category: 'OBJECT_NOT_FOUND',
|
|
75
|
-
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
76
|
-
})) {
|
|
77
|
-
uiLogger.error(lib.sandbox.sync.failure.objectNotFound(accountId));
|
|
78
|
-
}
|
|
79
|
-
else if (isSpecifiedError(err, {
|
|
80
|
-
statusCode: 404,
|
|
81
|
-
})) {
|
|
82
|
-
uiCommandDisabledBanner('hs sandbox sync', 'https://developers.hubspot.com/docs/developer-tooling/local-development/hubspot-cli/project-commands');
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
logError(err, new ApiErrorContext({
|
|
86
|
-
accountId: parentAccountId,
|
|
87
|
-
request: 'sandbox sync',
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
uiLogger.log('');
|
|
91
|
-
throw err;
|
|
92
|
-
}
|
|
93
|
-
if (!slimInfoMessage) {
|
|
94
|
-
uiLogger.log('');
|
|
95
|
-
uiLine();
|
|
96
|
-
uiLogger.info(isDevSandbox
|
|
97
|
-
? lib.sandbox.sync.info.syncMessageDevSb(syncStatusUrl)
|
|
98
|
-
: lib.sandbox.sync.info.syncMessage(syncStatusUrl));
|
|
99
|
-
uiLine();
|
|
100
|
-
uiLogger.log('');
|
|
101
|
-
}
|
|
102
|
-
}
|