@hubspot/cli 8.0.10-experimental.7 → 8.0.11-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 +199 -0
- package/commands/__tests__/account.test.d.ts +1 -0
- package/commands/__tests__/account.test.js +69 -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 +87 -0
- package/commands/__tests__/config.test.d.ts +1 -0
- package/commands/__tests__/config.test.js +44 -0
- package/commands/__tests__/customObject.test.d.ts +1 -0
- package/commands/__tests__/customObject.test.js +68 -0
- package/commands/__tests__/doctor.test.d.ts +1 -0
- package/commands/__tests__/doctor.test.js +132 -0
- package/commands/__tests__/feedback.test.d.ts +1 -0
- package/commands/__tests__/feedback.test.js +24 -0
- package/commands/__tests__/filemanager.test.d.ts +1 -0
- package/commands/__tests__/filemanager.test.js +45 -0
- package/commands/__tests__/getStarted.test.d.ts +1 -0
- package/commands/__tests__/getStarted.test.js +173 -0
- package/commands/__tests__/hubdb.test.d.ts +1 -0
- package/commands/__tests__/hubdb.test.js +50 -0
- package/commands/__tests__/init.test.d.ts +1 -0
- package/commands/__tests__/init.test.js +42 -0
- package/commands/__tests__/mcp.test.d.ts +1 -0
- package/commands/__tests__/mcp.test.js +46 -0
- package/commands/__tests__/open.test.d.ts +1 -0
- package/commands/__tests__/open.test.js +58 -0
- package/commands/__tests__/project.test.d.ts +1 -0
- package/commands/__tests__/project.test.js +125 -0
- package/commands/__tests__/sandbox.test.d.ts +1 -0
- package/commands/__tests__/sandbox.test.js +44 -0
- package/commands/__tests__/secret.test.d.ts +1 -0
- package/commands/__tests__/secret.test.js +49 -0
- package/commands/__tests__/testAccount.test.d.ts +1 -0
- package/commands/__tests__/testAccount.test.js +57 -0
- package/commands/__tests__/upgrade.test.d.ts +1 -0
- package/commands/__tests__/upgrade.test.js +309 -0
- package/commands/account/__tests__/auth.test.d.ts +1 -0
- package/commands/account/__tests__/auth.test.js +206 -0
- package/commands/account/__tests__/clean.test.d.ts +1 -0
- package/commands/account/__tests__/clean.test.js +28 -0
- package/commands/account/__tests__/createOverride.test.d.ts +1 -0
- package/commands/account/__tests__/createOverride.test.js +32 -0
- package/commands/account/__tests__/info.test.d.ts +1 -0
- package/commands/account/__tests__/info.test.js +28 -0
- package/commands/account/__tests__/list.test.d.ts +1 -0
- package/commands/account/__tests__/list.test.js +153 -0
- package/commands/account/__tests__/remove.test.d.ts +1 -0
- package/commands/account/__tests__/remove.test.js +36 -0
- package/commands/account/__tests__/removeOverride.d.ts +1 -0
- package/commands/account/__tests__/removeOverride.js +25 -0
- package/commands/account/__tests__/rename.test.d.ts +1 -0
- package/commands/account/__tests__/rename.test.js +82 -0
- package/commands/account/__tests__/use.test.d.ts +1 -0
- package/commands/account/__tests__/use.test.js +170 -0
- package/commands/app/__tests__/migrate.test.d.ts +1 -0
- package/commands/app/__tests__/migrate.test.js +111 -0
- package/commands/app/secret/__tests__/add.test.d.ts +1 -0
- package/commands/app/secret/__tests__/add.test.js +140 -0
- package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
- package/commands/app/secret/__tests__/delete.test.js +28 -0
- package/commands/app/secret/__tests__/list.test.d.ts +1 -0
- package/commands/app/secret/__tests__/list.test.js +25 -0
- package/commands/app/secret/__tests__/update.test.d.ts +1 -0
- package/commands/app/secret/__tests__/update.test.js +28 -0
- package/commands/cms/__tests__/delete.test.d.ts +1 -0
- package/commands/cms/__tests__/delete.test.js +39 -0
- package/commands/cms/__tests__/fetch.test.d.ts +1 -0
- package/commands/cms/__tests__/fetch.test.js +156 -0
- package/commands/cms/__tests__/function.test.d.ts +1 -0
- package/commands/cms/__tests__/function.test.js +50 -0
- package/commands/cms/__tests__/lint.test.d.ts +1 -0
- package/commands/cms/__tests__/lint.test.js +33 -0
- package/commands/cms/__tests__/list.test.d.ts +1 -0
- package/commands/cms/__tests__/list.test.js +42 -0
- package/commands/cms/__tests__/module.test.d.ts +1 -0
- package/commands/cms/__tests__/module.test.js +45 -0
- package/commands/cms/__tests__/mv.test.d.ts +1 -0
- package/commands/cms/__tests__/mv.test.js +46 -0
- package/commands/cms/__tests__/theme.test.d.ts +1 -0
- package/commands/cms/__tests__/theme.test.js +54 -0
- package/commands/cms/__tests__/upload.test.d.ts +1 -0
- package/commands/cms/__tests__/upload.test.js +312 -0
- package/commands/cms/__tests__/watch.test.d.ts +1 -0
- package/commands/cms/__tests__/watch.test.js +204 -0
- package/commands/cms/function/__tests__/logs.test.d.ts +1 -0
- package/commands/cms/function/__tests__/logs.test.js +70 -0
- package/commands/cms/theme/__tests__/generate-selectors.test.d.ts +1 -0
- package/commands/cms/theme/__tests__/generate-selectors.test.js +28 -0
- package/commands/cms/theme/__tests__/marketplace-validate.test.d.ts +1 -0
- package/commands/cms/theme/__tests__/marketplace-validate.test.js +36 -0
- package/commands/cms/theme/__tests__/preview.test.d.ts +1 -0
- package/commands/cms/theme/__tests__/preview.test.js +54 -0
- package/commands/customObject/__tests__/create.test.d.ts +1 -0
- package/commands/customObject/__tests__/create.test.js +40 -0
- package/commands/customObject/__tests__/createSchema.test.d.ts +1 -0
- package/commands/customObject/__tests__/createSchema.test.js +28 -0
- package/commands/customObject/__tests__/deleteSchema.test.d.ts +1 -0
- package/commands/customObject/__tests__/deleteSchema.test.js +42 -0
- package/commands/customObject/__tests__/fetch-all-schemas.test.d.ts +1 -0
- package/commands/customObject/__tests__/fetch-all-schemas.test.js +41 -0
- package/commands/customObject/__tests__/fetchSchema.test.d.ts +1 -0
- package/commands/customObject/__tests__/fetchSchema.test.js +45 -0
- package/commands/customObject/__tests__/listSchemas.test.d.ts +1 -0
- package/commands/customObject/__tests__/listSchemas.test.js +29 -0
- package/commands/customObject/__tests__/updateSchema.test.d.ts +1 -0
- package/commands/customObject/__tests__/updateSchema.test.js +40 -0
- package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
- package/commands/filemanager/__tests__/fetch.test.js +32 -0
- package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
- package/commands/filemanager/__tests__/upload.test.js +191 -0
- package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
- package/commands/hubdb/__tests__/clear.test.js +28 -0
- package/commands/hubdb/__tests__/create.test.d.ts +1 -0
- package/commands/hubdb/__tests__/create.test.js +28 -0
- package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
- package/commands/hubdb/__tests__/delete.test.js +28 -0
- package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
- package/commands/hubdb/__tests__/fetch.test.js +28 -0
- package/commands/hubdb/__tests__/list.test.d.ts +1 -0
- package/commands/hubdb/__tests__/list.test.js +88 -0
- package/commands/mcp/__tests__/setup.test.d.ts +1 -0
- package/commands/mcp/__tests__/setup.test.js +26 -0
- package/commands/mcp/__tests__/start.test.d.ts +1 -0
- package/commands/mcp/__tests__/start.test.js +144 -0
- package/commands/project/__tests__/add.test.d.ts +1 -0
- package/commands/project/__tests__/add.test.js +107 -0
- package/commands/project/__tests__/create.test.d.ts +1 -0
- package/commands/project/__tests__/create.test.js +97 -0
- package/commands/project/__tests__/deploy.test.d.ts +1 -0
- package/commands/project/__tests__/deploy.test.js +307 -0
- package/commands/project/__tests__/dev.test.d.ts +1 -0
- package/commands/project/__tests__/dev.test.js +273 -0
- package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
- package/commands/project/__tests__/devUnifiedFlow.test.js +434 -0
- package/commands/project/__tests__/download.test.d.ts +1 -0
- package/commands/project/__tests__/download.test.js +39 -0
- package/commands/project/__tests__/info.test.d.ts +1 -0
- package/commands/project/__tests__/info.test.js +145 -0
- package/commands/project/__tests__/installDeps.test.d.ts +1 -0
- package/commands/project/__tests__/installDeps.test.js +140 -0
- package/commands/project/__tests__/lint.test.d.ts +1 -0
- package/commands/project/__tests__/lint.test.js +704 -0
- package/commands/project/__tests__/list.test.d.ts +1 -0
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
- package/commands/project/__tests__/listBuilds.test.js +38 -0
- package/commands/project/__tests__/logs.test.d.ts +1 -0
- package/commands/project/__tests__/logs.test.js +202 -0
- package/commands/project/__tests__/migrate.test.d.ts +1 -0
- package/commands/project/__tests__/migrate.test.js +106 -0
- package/commands/project/__tests__/open.test.d.ts +1 -0
- package/commands/project/__tests__/open.test.js +39 -0
- package/commands/project/__tests__/profile.test.d.ts +1 -0
- package/commands/project/__tests__/profile.test.js +42 -0
- package/commands/project/__tests__/updateDeps.test.d.ts +1 -0
- package/commands/project/__tests__/updateDeps.test.js +140 -0
- package/commands/project/__tests__/upload.test.d.ts +1 -0
- package/commands/project/__tests__/upload.test.js +234 -0
- package/commands/project/__tests__/validate.test.d.ts +1 -0
- package/commands/project/__tests__/validate.test.js +381 -0
- package/commands/project/__tests__/watch.test.d.ts +1 -0
- package/commands/project/__tests__/watch.test.js +35 -0
- package/commands/project/info.d.ts +4 -0
- package/commands/project/info.js +67 -0
- package/commands/project.js +2 -0
- package/commands/sandbox/__tests__/create.test.d.ts +1 -0
- package/commands/sandbox/__tests__/create.test.js +198 -0
- package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
- package/commands/sandbox/__tests__/delete.test.js +31 -0
- package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/addSecret.test.js +162 -0
- package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/deleteSecret.test.js +41 -0
- package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/listSecret.test.js +29 -0
- package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
- package/commands/secret/__tests__/updateSecret.test.js +29 -0
- package/commands/testAccount/__tests__/create.test.d.ts +1 -0
- package/commands/testAccount/__tests__/create.test.js +106 -0
- package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
- package/commands/testAccount/__tests__/createConfig.test.js +32 -0
- package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
- package/commands/testAccount/__tests__/delete.test.js +29 -0
- package/commands/testAccount/__tests__/importData.test.d.ts +1 -0
- package/commands/testAccount/__tests__/importData.test.js +92 -0
- package/lang/en.d.ts +31 -0
- package/lang/en.js +31 -0
- package/lib/__tests__/CLIWebSocketServer.test.d.ts +1 -0
- package/lib/__tests__/CLIWebSocketServer.test.js +252 -0
- package/lib/__tests__/accountAuth.test.d.ts +1 -0
- package/lib/__tests__/accountAuth.test.js +258 -0
- package/lib/__tests__/accountTypes.test.d.ts +1 -0
- package/lib/__tests__/accountTypes.test.js +98 -0
- package/lib/__tests__/buildAccount.test.d.ts +1 -0
- package/lib/__tests__/buildAccount.test.js +211 -0
- package/lib/__tests__/cliUpgradeUtils.test.d.ts +1 -0
- package/lib/__tests__/cliUpgradeUtils.test.js +131 -0
- package/lib/__tests__/commandSuggestion.test.d.ts +1 -0
- package/lib/__tests__/commandSuggestion.test.js +121 -0
- package/lib/__tests__/commonOpts.test.d.ts +1 -0
- package/lib/__tests__/commonOpts.test.js +80 -0
- package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
- package/lib/__tests__/dependencyManagement.test.js +1067 -0
- package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
- package/lib/__tests__/developerTestAccounts.test.js +156 -0
- package/lib/__tests__/hasFeature.test.d.ts +1 -0
- package/lib/__tests__/hasFeature.test.js +167 -0
- package/lib/__tests__/http.test.d.ts +1 -0
- package/lib/__tests__/http.test.js +40 -0
- package/lib/__tests__/importData.test.d.ts +1 -0
- package/lib/__tests__/importData.test.js +98 -0
- package/lib/__tests__/npmCli.test.d.ts +1 -0
- package/lib/__tests__/npmCli.test.js +84 -0
- package/lib/__tests__/oauth.test.d.ts +1 -0
- package/lib/__tests__/oauth.test.js +109 -0
- package/lib/__tests__/parsing.test.d.ts +1 -0
- package/lib/__tests__/parsing.test.js +34 -0
- package/lib/__tests__/polling.test.d.ts +1 -0
- package/lib/__tests__/polling.test.js +76 -0
- package/lib/__tests__/process.test.d.ts +1 -0
- package/lib/__tests__/process.test.js +89 -0
- package/lib/__tests__/sandboxes.test.d.ts +1 -0
- package/lib/__tests__/sandboxes.test.js +128 -0
- package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
- package/lib/__tests__/serverlessLogs.test.js +163 -0
- package/lib/__tests__/usageTracking.test.d.ts +1 -0
- package/lib/__tests__/usageTracking.test.js +197 -0
- package/lib/__tests__/validation.test.d.ts +1 -0
- package/lib/__tests__/validation.test.js +143 -0
- package/lib/__tests__/yargsUtils.test.d.ts +1 -0
- package/lib/__tests__/yargsUtils.test.js +124 -0
- package/lib/app/__tests__/migrate.test.d.ts +1 -0
- package/lib/app/__tests__/migrate.test.js +638 -0
- package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
- package/lib/doctor/__tests__/Diagnosis.test.js +84 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +177 -0
- package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
- package/lib/doctor/__tests__/Doctor.test.js +560 -0
- package/lib/errorHandlers/__tests__/index.test.d.ts +1 -0
- package/lib/errorHandlers/__tests__/index.test.js +278 -0
- package/lib/mcp/__tests__/setup.test.d.ts +1 -0
- package/lib/mcp/__tests__/setup.test.js +523 -0
- package/lib/middleware/__tests__/commandTargetingUtils.test.d.ts +1 -0
- package/lib/middleware/__tests__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__tests__/configMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/configMiddleware.test.js +118 -0
- package/lib/middleware/__tests__/gitMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/gitMiddleware.test.js +43 -0
- package/lib/middleware/__tests__/requestMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/requestMiddleware.test.js +15 -0
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/usageTrackingMiddleware.test.js +44 -0
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.d.ts +1 -0
- package/lib/middleware/__tests__/yargsChecksMiddleware.test.js +39 -0
- package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/AppDevModeInterface.test.js +541 -0
- package/lib/projects/__tests__/DevServerManager.test.d.ts +1 -0
- package/lib/projects/__tests__/DevServerManager.test.js +185 -0
- package/lib/projects/__tests__/DevSessionManager.test.d.ts +1 -0
- package/lib/projects/__tests__/DevSessionManager.test.js +250 -0
- package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +481 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +231 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
- package/lib/projects/__tests__/ProjectLogsManager.test.js +302 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +160 -0
- package/lib/projects/__tests__/components.test.d.ts +1 -0
- package/lib/projects/__tests__/components.test.js +440 -0
- package/lib/projects/__tests__/deploy.test.d.ts +1 -0
- package/lib/projects/__tests__/deploy.test.js +231 -0
- package/lib/projects/__tests__/localDevProjectHelpers.test.d.ts +1 -0
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +120 -0
- package/lib/projects/__tests__/platformVersion.test.d.ts +1 -0
- package/lib/projects/__tests__/platformVersion.test.js +63 -0
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.d.ts +1 -0
- package/lib/projects/__tests__/pollProjectBuildAndDeploy.test.js +328 -0
- package/lib/projects/__tests__/projectInfo.test.d.ts +1 -0
- package/lib/projects/__tests__/projectInfo.test.js +114 -0
- package/lib/projects/__tests__/projectProfiles.test.d.ts +1 -0
- package/lib/projects/__tests__/projectProfiles.test.js +441 -0
- package/lib/projects/__tests__/projects.test.d.ts +1 -0
- package/lib/projects/__tests__/projects.test.js +58 -0
- package/lib/projects/__tests__/structure.test.d.ts +1 -0
- package/lib/projects/__tests__/structure.test.js +210 -0
- package/lib/projects/__tests__/uieLinting.test.d.ts +1 -0
- package/lib/projects/__tests__/uieLinting.test.js +631 -0
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +183 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +245 -0
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/v2AddComponent.test.js +343 -0
- package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
- package/lib/projects/create/__tests__/legacy.test.js +72 -0
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/v2.test.js +257 -0
- package/lib/projects/projectInfo.d.ts +22 -0
- package/lib/projects/projectInfo.js +104 -0
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +157 -0
- package/lib/prompts/__tests__/createFunctionPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/createFunctionPrompt.test.js +129 -0
- package/lib/prompts/__tests__/createModulePrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/createModulePrompt.test.js +187 -0
- package/lib/prompts/__tests__/createTemplatePrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/createTemplatePrompt.test.js +102 -0
- package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +31 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +143 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +37 -0
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.d.ts +1 -0
- package/lib/prompts/__tests__/selectProjectTemplatePrompt.test.js +160 -0
- package/lib/theme/__tests__/migrate.test.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +247 -0
- package/lib/ui/__tests__/SpinniesManager.test.d.ts +1 -0
- package/lib/ui/__tests__/SpinniesManager.test.js +488 -0
- package/lib/ui/__tests__/removeAnsiCodes.test.d.ts +1 -0
- package/lib/ui/__tests__/removeAnsiCodes.test.js +84 -0
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +254 -0
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +227 -0
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +208 -0
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +186 -0
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +124 -0
- package/mcp-server/tools/cms/__tests__/HsListTool.test.d.ts +1 -0
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +124 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +157 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +131 -0
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +461 -0
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +125 -0
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +125 -0
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +210 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +146 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +124 -0
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +307 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +242 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +209 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +158 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +187 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +118 -0
- package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/command.test.js +275 -0
- package/mcp-server/utils/__tests__/content.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/content.test.js +164 -0
- package/mcp-server/utils/__tests__/feedbackTracking.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/feedbackTracking.test.js +69 -0
- package/package.json +2 -6
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { trackUsage } from '@hubspot/local-dev-lib/trackUsage';
|
|
2
|
+
import { getConfig, getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
3
|
+
import { API_KEY_AUTH_METHOD } from '@hubspot/local-dev-lib/constants/auth';
|
|
4
|
+
import { uiLogger } from '../ui/logger.js';
|
|
5
|
+
import { trackCommandUsage, trackHelpUsage, trackConvertFieldsUsage, trackAuthAction, trackCommandMetadataUsage, } from '../usageTracking.js';
|
|
6
|
+
import { pkg } from '../jsonLoader.js';
|
|
7
|
+
const version = pkg.version;
|
|
8
|
+
// Unmock the usageTracking module for this test file
|
|
9
|
+
vi.unmock('../usageTracking.js');
|
|
10
|
+
vi.mock('@hubspot/local-dev-lib/trackUsage');
|
|
11
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
12
|
+
const mockedTrackUsage = trackUsage;
|
|
13
|
+
const mockedGetConfig = getConfig;
|
|
14
|
+
const mockedGetConfigAccountById = getConfigAccountById;
|
|
15
|
+
const mockedUiLogger = uiLogger;
|
|
16
|
+
describe('lib/usageTracking', () => {
|
|
17
|
+
const mockPlatform = 'darwin';
|
|
18
|
+
const mockNodeVersion = 'v16.14.0';
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: true });
|
|
21
|
+
Object.defineProperty(process, 'platform', { value: mockPlatform });
|
|
22
|
+
Object.defineProperty(process, 'version', { value: mockNodeVersion });
|
|
23
|
+
delete process.env.DISABLE_USAGE_TRACKING;
|
|
24
|
+
});
|
|
25
|
+
afterEach(() => {
|
|
26
|
+
delete process.env.DISABLE_USAGE_TRACKING;
|
|
27
|
+
});
|
|
28
|
+
describe('trackCommandUsage()', () => {
|
|
29
|
+
const mockCommand = 'test-command';
|
|
30
|
+
const mockAccountId = 123;
|
|
31
|
+
it('should not track when tracking is disabled via config', async () => {
|
|
32
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: false });
|
|
33
|
+
await trackCommandUsage(mockCommand);
|
|
34
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
it('should not track when --disable-usage-tracking flag is set', async () => {
|
|
37
|
+
process.env.DISABLE_USAGE_TRACKING = 'true';
|
|
38
|
+
await trackCommandUsage(mockCommand, {}, mockAccountId);
|
|
39
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
40
|
+
expect(mockedUiLogger.debug).toHaveBeenCalledWith('Usage tracking is disabled via the --disable-usage-tracking flag, not sending usage events');
|
|
41
|
+
});
|
|
42
|
+
it('should track command usage with default auth type', async () => {
|
|
43
|
+
await trackCommandUsage(mockCommand, {}, mockAccountId);
|
|
44
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
45
|
+
action: 'cli-command',
|
|
46
|
+
command: mockCommand,
|
|
47
|
+
os: 'macos',
|
|
48
|
+
nodeVersion: mockNodeVersion,
|
|
49
|
+
nodeMajorVersion: 'v16',
|
|
50
|
+
version,
|
|
51
|
+
authType: API_KEY_AUTH_METHOD.value,
|
|
52
|
+
}), mockAccountId);
|
|
53
|
+
});
|
|
54
|
+
it('should track command usage with custom auth type', async () => {
|
|
55
|
+
mockedGetConfigAccountById.mockReturnValue({ authType: 'oauth2' });
|
|
56
|
+
await trackCommandUsage(mockCommand, {}, mockAccountId);
|
|
57
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
58
|
+
authType: 'oauth2',
|
|
59
|
+
}), mockAccountId);
|
|
60
|
+
});
|
|
61
|
+
it('should handle tracking errors gracefully', async () => {
|
|
62
|
+
const error = new Error('Tracking failed');
|
|
63
|
+
mockedTrackUsage.mockImplementationOnce(() => {
|
|
64
|
+
throw error;
|
|
65
|
+
});
|
|
66
|
+
await trackCommandUsage(mockCommand);
|
|
67
|
+
expect(mockedUiLogger.debug).toHaveBeenCalledWith(expect.stringContaining(error.message));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
describe('trackHelpUsage()', () => {
|
|
71
|
+
const mockCommand = 'help-command';
|
|
72
|
+
it('should not track when tracking is disabled via config', async () => {
|
|
73
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: false });
|
|
74
|
+
await trackHelpUsage(mockCommand);
|
|
75
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
76
|
+
});
|
|
77
|
+
it('should not track when --disable-usage-tracking flag is set', async () => {
|
|
78
|
+
process.env.DISABLE_USAGE_TRACKING = 'true';
|
|
79
|
+
await trackHelpUsage(mockCommand);
|
|
80
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
81
|
+
expect(mockedUiLogger.debug).toHaveBeenCalledWith('Usage tracking is disabled via the --disable-usage-tracking flag, not sending usage events');
|
|
82
|
+
});
|
|
83
|
+
it('should track help usage with command', async () => {
|
|
84
|
+
await trackHelpUsage(mockCommand);
|
|
85
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
86
|
+
action: 'cli-help',
|
|
87
|
+
command: mockCommand,
|
|
88
|
+
os: 'macos',
|
|
89
|
+
nodeVersion: mockNodeVersion,
|
|
90
|
+
nodeMajorVersion: 'v16',
|
|
91
|
+
version,
|
|
92
|
+
}), undefined);
|
|
93
|
+
});
|
|
94
|
+
it('should track main help usage without command', async () => {
|
|
95
|
+
await trackHelpUsage('');
|
|
96
|
+
expect(mockedUiLogger.debug).toHaveBeenCalledWith(expect.stringContaining('main command'));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('trackConvertFieldsUsage()', () => {
|
|
100
|
+
const mockCommand = 'convert-fields-command';
|
|
101
|
+
it('should not track when tracking is disabled via config', async () => {
|
|
102
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: false });
|
|
103
|
+
await trackConvertFieldsUsage(mockCommand);
|
|
104
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
it('should not track when --disable-usage-tracking flag is set', async () => {
|
|
107
|
+
process.env.DISABLE_USAGE_TRACKING = 'true';
|
|
108
|
+
await trackConvertFieldsUsage(mockCommand);
|
|
109
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
110
|
+
});
|
|
111
|
+
it('should track convert fields usage', async () => {
|
|
112
|
+
await trackConvertFieldsUsage(mockCommand);
|
|
113
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
114
|
+
action: 'cli-process-fields',
|
|
115
|
+
command: mockCommand,
|
|
116
|
+
os: 'macos',
|
|
117
|
+
nodeVersion: mockNodeVersion,
|
|
118
|
+
nodeMajorVersion: 'v16',
|
|
119
|
+
version,
|
|
120
|
+
}), undefined);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe('trackAuthAction()', () => {
|
|
124
|
+
const mockCommand = 'auth-command';
|
|
125
|
+
const mockAuthType = 'oauth2';
|
|
126
|
+
const mockStep = 'init';
|
|
127
|
+
const mockAccountId = 123;
|
|
128
|
+
it('should not track when tracking is disabled via config', async () => {
|
|
129
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: false });
|
|
130
|
+
await trackAuthAction(mockCommand, mockAuthType, mockStep, mockAccountId);
|
|
131
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
it('should not track when --disable-usage-tracking flag is set', async () => {
|
|
134
|
+
process.env.DISABLE_USAGE_TRACKING = 'true';
|
|
135
|
+
await trackAuthAction(mockCommand, mockAuthType, mockStep, mockAccountId);
|
|
136
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
137
|
+
});
|
|
138
|
+
it('should track auth action', async () => {
|
|
139
|
+
await trackAuthAction(mockCommand, mockAuthType, mockStep, mockAccountId);
|
|
140
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
141
|
+
action: 'cli-auth',
|
|
142
|
+
command: mockCommand,
|
|
143
|
+
authType: mockAuthType,
|
|
144
|
+
step: mockStep,
|
|
145
|
+
os: 'macos',
|
|
146
|
+
nodeVersion: mockNodeVersion,
|
|
147
|
+
nodeMajorVersion: 'v16',
|
|
148
|
+
version,
|
|
149
|
+
}), mockAccountId);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe('trackCommandMetadataUsage()', () => {
|
|
153
|
+
const mockCommand = 'metadata-command';
|
|
154
|
+
const mockMeta = { assetType: 'test-asset' };
|
|
155
|
+
const mockAccountId = 123;
|
|
156
|
+
it('should not track when tracking is disabled via config', async () => {
|
|
157
|
+
mockedGetConfig.mockReturnValue({ allowUsageTracking: false });
|
|
158
|
+
await trackCommandMetadataUsage(mockCommand, mockMeta, mockAccountId);
|
|
159
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
160
|
+
});
|
|
161
|
+
it('should not track when --disable-usage-tracking flag is set', async () => {
|
|
162
|
+
process.env.DISABLE_USAGE_TRACKING = 'true';
|
|
163
|
+
await trackCommandMetadataUsage(mockCommand, mockMeta, mockAccountId);
|
|
164
|
+
expect(mockedTrackUsage).not.toHaveBeenCalled();
|
|
165
|
+
expect(mockedUiLogger.debug).toHaveBeenCalledWith('Usage tracking is disabled via the --disable-usage-tracking flag, not sending usage events');
|
|
166
|
+
});
|
|
167
|
+
it('should track command metadata usage', async () => {
|
|
168
|
+
await trackCommandMetadataUsage(mockCommand, mockMeta, mockAccountId);
|
|
169
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith('cli-interaction', 'INTERACTION', expect.objectContaining({
|
|
170
|
+
action: 'cli-command-metadata',
|
|
171
|
+
command: mockCommand,
|
|
172
|
+
assetType: 'test-asset',
|
|
173
|
+
os: 'macos',
|
|
174
|
+
nodeVersion: mockNodeVersion,
|
|
175
|
+
nodeMajorVersion: 'v16',
|
|
176
|
+
version,
|
|
177
|
+
}), mockAccountId);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
describe('Platform detection', () => {
|
|
181
|
+
it('should return "macos" for darwin platform', async () => {
|
|
182
|
+
Object.defineProperty(process, 'platform', { value: 'darwin' });
|
|
183
|
+
await trackHelpUsage('test');
|
|
184
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith(expect.anything(), expect.anything(), expect.objectContaining({ os: 'macos' }), undefined);
|
|
185
|
+
});
|
|
186
|
+
it('should return "windows" for win32 platform', async () => {
|
|
187
|
+
Object.defineProperty(process, 'platform', { value: 'win32' });
|
|
188
|
+
await trackHelpUsage('test');
|
|
189
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith(expect.anything(), expect.anything(), expect.objectContaining({ os: 'windows' }), undefined);
|
|
190
|
+
});
|
|
191
|
+
it('should return platform name for other platforms', async () => {
|
|
192
|
+
Object.defineProperty(process, 'platform', { value: 'linux' });
|
|
193
|
+
await trackHelpUsage('test');
|
|
194
|
+
expect(mockedTrackUsage).toHaveBeenCalledWith(expect.anything(), expect.anything(), expect.objectContaining({ os: 'linux' }), undefined);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { getConfigAccountById, getConfigAccountIfExists, } from '@hubspot/local-dev-lib/config';
|
|
2
|
+
import { getOauthManager } from '@hubspot/local-dev-lib/oauth';
|
|
3
|
+
import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personalAccessKey';
|
|
4
|
+
import { validateAccount } from '../validation.js';
|
|
5
|
+
vi.mock('@hubspot/local-dev-lib/config');
|
|
6
|
+
vi.mock('../errorHandlers/index.js');
|
|
7
|
+
vi.mock('@hubspot/local-dev-lib/oauth');
|
|
8
|
+
vi.mock('@hubspot/local-dev-lib/personalAccessKey');
|
|
9
|
+
vi.mock('../commonOpts');
|
|
10
|
+
const yargsOption = (option) => ({
|
|
11
|
+
$0: '',
|
|
12
|
+
_: [''],
|
|
13
|
+
...option,
|
|
14
|
+
});
|
|
15
|
+
describe('lib/validation', () => {
|
|
16
|
+
const getConfigAccountIfExistsMock = getConfigAccountIfExists;
|
|
17
|
+
const getConfigAccountByIdMock = getConfigAccountById;
|
|
18
|
+
const getOauthManagerMock = getOauthManager;
|
|
19
|
+
const accessTokenForPersonalAccessKeyMock = accessTokenForPersonalAccessKey;
|
|
20
|
+
describe('validateAccount', () => {
|
|
21
|
+
it('returns false if an account is missing', async () => {
|
|
22
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce(null);
|
|
23
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
it('returns false if an account config is missing', async () => {
|
|
26
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
27
|
+
getConfigAccountByIdMock.mockReturnValueOnce(undefined);
|
|
28
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
it('returns false for oauth2 authType if auth is missing', async () => {
|
|
31
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
32
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
33
|
+
accountId: '123',
|
|
34
|
+
authType: 'oauth2',
|
|
35
|
+
});
|
|
36
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
it('returns false if OAuth is missing configuration', async () => {
|
|
39
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
40
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
41
|
+
accountId: '123',
|
|
42
|
+
authType: 'oauth2',
|
|
43
|
+
auth: {
|
|
44
|
+
clientId: 'foo',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
it('returns false if an access token was not retrieved', async () => {
|
|
50
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
51
|
+
getOauthManagerMock.mockReturnValueOnce({
|
|
52
|
+
accessToken() {
|
|
53
|
+
return null;
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
57
|
+
accountId: '123',
|
|
58
|
+
authType: 'oauth2',
|
|
59
|
+
auth: {
|
|
60
|
+
clientId: 'foo',
|
|
61
|
+
clientSecret: 'abc',
|
|
62
|
+
tokenInfo: {
|
|
63
|
+
refreshToken: 'def',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
it('returns false if an getting an access token throws', async () => {
|
|
70
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
71
|
+
getOauthManagerMock.mockReturnValueOnce({
|
|
72
|
+
accessToken() {
|
|
73
|
+
throw new Error('It failed');
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
77
|
+
accountId: '123',
|
|
78
|
+
authType: 'oauth2',
|
|
79
|
+
auth: {
|
|
80
|
+
clientId: 'foo',
|
|
81
|
+
clientSecret: 'abc',
|
|
82
|
+
tokenInfo: {
|
|
83
|
+
refreshToken: 'def',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
it('returns true if OAuth is configured and an access token is received', async () => {
|
|
90
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
91
|
+
getOauthManagerMock.mockReturnValueOnce({
|
|
92
|
+
accessToken() {
|
|
93
|
+
return 'yep';
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
97
|
+
accountId: '123',
|
|
98
|
+
authType: 'oauth2',
|
|
99
|
+
auth: {
|
|
100
|
+
clientId: 'foo',
|
|
101
|
+
clientSecret: 'abc',
|
|
102
|
+
tokenInfo: {
|
|
103
|
+
refreshToken: 'def',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
it('returns false if "personalaccesskey" configured and getting an access token throws', async () => {
|
|
110
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
111
|
+
accessTokenForPersonalAccessKeyMock.mockImplementationOnce(() => {
|
|
112
|
+
throw new Error('It failed');
|
|
113
|
+
});
|
|
114
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
115
|
+
accountId: '123',
|
|
116
|
+
authType: 'personalaccesskey',
|
|
117
|
+
personalAccessKey: 'foo',
|
|
118
|
+
});
|
|
119
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
it('returns true if "personalaccesskey" configured and an access token is received', async () => {
|
|
122
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
123
|
+
accessTokenForPersonalAccessKeyMock.mockImplementationOnce(() => {
|
|
124
|
+
return 'secret-stuff';
|
|
125
|
+
});
|
|
126
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
127
|
+
accountId: '123',
|
|
128
|
+
authType: 'personalaccesskey',
|
|
129
|
+
personalAccessKey: 'foo',
|
|
130
|
+
});
|
|
131
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
it('returns true if apiKey is configured and present', async () => {
|
|
134
|
+
getConfigAccountIfExistsMock.mockReturnValueOnce('123');
|
|
135
|
+
getConfigAccountByIdMock.mockReturnValueOnce({
|
|
136
|
+
accountId: '123',
|
|
137
|
+
authType: 'apikey',
|
|
138
|
+
apiKey: 'my-secret-key',
|
|
139
|
+
});
|
|
140
|
+
expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { hasFlag, makeYargsBuilder, strictEnforceBoolean, } from '../yargsUtils.js';
|
|
2
|
+
import * as commonOpts from '../commonOpts.js';
|
|
3
|
+
vi.mock('../commonOpts');
|
|
4
|
+
vi.mock('../../lang/en.js', () => ({
|
|
5
|
+
commands: {
|
|
6
|
+
config: {
|
|
7
|
+
subcommands: {
|
|
8
|
+
set: {
|
|
9
|
+
errors: {
|
|
10
|
+
invalidBoolean: (option, value) => `Invalid boolean value "${value}" for --${option}. Valid values are: true, false`,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
const argvWithFlag = ['hs', 'command', '--test'];
|
|
18
|
+
const argvWithoutFlag = ['hs', 'command'];
|
|
19
|
+
describe('lib/yargsUtils', () => {
|
|
20
|
+
describe('hasFlag()', () => {
|
|
21
|
+
it('should return true if the flag is present', () => {
|
|
22
|
+
const flag = hasFlag('test', argvWithFlag);
|
|
23
|
+
expect(flag).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it('should return false if argv is an empty array', () => {
|
|
26
|
+
const flag = hasFlag('test', []);
|
|
27
|
+
expect(flag).toBe(false);
|
|
28
|
+
});
|
|
29
|
+
it('should return false if the flag is not present', () => {
|
|
30
|
+
const flag = hasFlag('test', argvWithoutFlag);
|
|
31
|
+
expect(flag).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('makeYargsBuilder()', () => {
|
|
35
|
+
it('should add specified options', async () => {
|
|
36
|
+
const builder = makeYargsBuilder(yargs => yargs, 'command', 'describe', {
|
|
37
|
+
useAccountOptions: true,
|
|
38
|
+
useConfigOptions: true,
|
|
39
|
+
useEnvironmentOptions: true,
|
|
40
|
+
useTestingOptions: true,
|
|
41
|
+
useGlobalOptions: true,
|
|
42
|
+
});
|
|
43
|
+
await builder({});
|
|
44
|
+
expect(commonOpts.addGlobalOptions).toHaveBeenCalled();
|
|
45
|
+
expect(commonOpts.addAccountOptions).toHaveBeenCalled();
|
|
46
|
+
expect(commonOpts.addConfigOptions).toHaveBeenCalled();
|
|
47
|
+
expect(commonOpts.addUseEnvironmentOptions).toHaveBeenCalled();
|
|
48
|
+
expect(commonOpts.addTestingOptions).toHaveBeenCalled();
|
|
49
|
+
expect(commonOpts.addCustomHelpOutput).toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
describe('strictEnforceBoolean()', () => {
|
|
53
|
+
it('should validate valid boolean values (true/false, case-insensitive)', () => {
|
|
54
|
+
const validArgs = [
|
|
55
|
+
['hs', 'config', 'set', '--allow-usage-tracking=true'],
|
|
56
|
+
['hs', 'config', 'set', '--allow-usage-tracking=false'],
|
|
57
|
+
['hs', 'config', 'set', '--allow-usage-tracking=TRUE'],
|
|
58
|
+
['hs', 'config', 'set', '--allow-usage-tracking=False'],
|
|
59
|
+
];
|
|
60
|
+
validArgs.forEach(args => {
|
|
61
|
+
expect(() => strictEnforceBoolean(args, ['allow-usage-tracking'])).not.toThrow();
|
|
62
|
+
expect(strictEnforceBoolean(args, ['allow-usage-tracking'])).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
it('should reject invalid boolean values with descriptive error messages', () => {
|
|
66
|
+
const invalidCases = [
|
|
67
|
+
{
|
|
68
|
+
args: ['hs', 'config', 'set', '--allow-usage-tracking=yes'],
|
|
69
|
+
value: 'yes',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
args: ['hs', 'config', 'set', '--allow-usage-tracking=1'],
|
|
73
|
+
value: '1',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
args: ['hs', 'config', 'set', '--auto-open-browser=maybe'],
|
|
77
|
+
value: 'maybe',
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
invalidCases.forEach(({ args, value }) => {
|
|
81
|
+
const option = args[3].split('=')[0].replace('--', '');
|
|
82
|
+
expect(() => strictEnforceBoolean(args, [option])).toThrow(`Invalid boolean value "${value}" for --${option}. Valid values are: true, false`);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
it('should support multiple config values in a single command', () => {
|
|
86
|
+
const args = [
|
|
87
|
+
'hs',
|
|
88
|
+
'config',
|
|
89
|
+
'set',
|
|
90
|
+
'--allow-usage-tracking=true',
|
|
91
|
+
'--auto-open-browser=false',
|
|
92
|
+
'--allow-auto-updates=true',
|
|
93
|
+
'--http-timeout=5000',
|
|
94
|
+
'--default-cms-publish-mode=draft',
|
|
95
|
+
];
|
|
96
|
+
const booleanOptions = [
|
|
97
|
+
'allow-usage-tracking',
|
|
98
|
+
'auto-open-browser',
|
|
99
|
+
'allow-auto-updates',
|
|
100
|
+
];
|
|
101
|
+
expect(() => strictEnforceBoolean(args, booleanOptions)).not.toThrow();
|
|
102
|
+
expect(strictEnforceBoolean(args, booleanOptions)).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
it('should error when one of multiple values is invalid', () => {
|
|
105
|
+
const args = [
|
|
106
|
+
'hs',
|
|
107
|
+
'config',
|
|
108
|
+
'set',
|
|
109
|
+
'--allow-usage-tracking=true',
|
|
110
|
+
'--auto-open-browser=invalid',
|
|
111
|
+
'--http-timeout=5000',
|
|
112
|
+
];
|
|
113
|
+
const booleanOptions = ['allow-usage-tracking', 'auto-open-browser'];
|
|
114
|
+
expect(() => strictEnforceBoolean(args, booleanOptions)).toThrow('Invalid boolean value "invalid" for --auto-open-browser. Valid values are: true, false');
|
|
115
|
+
});
|
|
116
|
+
it('should maintain backwards compatability', () => {
|
|
117
|
+
expect(() => strictEnforceBoolean(['hs', 'config', 'set', '--allow-usage-tracking=true'], ['allow-usage-tracking'])).not.toThrow();
|
|
118
|
+
// No values provided (interactive mode)
|
|
119
|
+
expect(() => strictEnforceBoolean(['hs', 'config', 'set'], ['allow-usage-tracking'])).not.toThrow();
|
|
120
|
+
// Flag without equals sign (succeed with true)
|
|
121
|
+
expect(() => strictEnforceBoolean(['hs', 'config', 'set', '--allow-usage-tracking'], ['allow-usage-tracking'])).not.toThrow();
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|