@hubspot/cli 8.0.10-experimental.6 → 8.0.10-experimental.7
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.d.ts +77 -0
- package/api/migrate.js +55 -0
- package/bin/cli.d.ts +2 -0
- package/bin/cli.js +136 -0
- package/bin/hs.d.ts +2 -0
- package/bin/hscms.d.ts +2 -0
- package/bin/silenceErrors.d.ts +2 -0
- package/bin/silenceErrors.js +11 -0
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +102 -0
- package/commands/account/clean.d.ts +6 -0
- package/commands/account/clean.js +125 -0
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +93 -0
- package/commands/account/info.d.ts +4 -0
- package/commands/account/info.js +75 -0
- package/commands/account/list.d.ts +4 -0
- package/commands/account/list.js +107 -0
- package/commands/account/remove.d.ts +6 -0
- package/commands/account/remove.js +87 -0
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +71 -0
- package/commands/account/rename.d.ts +7 -0
- package/commands/account/rename.js +51 -0
- package/commands/account/use.d.ts +6 -0
- package/commands/account/use.js +93 -0
- package/commands/account.d.ts +3 -0
- package/commands/account.js +35 -0
- package/commands/app/migrate.d.ts +6 -0
- package/commands/app/migrate.js +96 -0
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +63 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +86 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +63 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +76 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +26 -0
- package/commands/app.d.ts +3 -0
- package/commands/app.js +18 -0
- package/commands/auth.d.ts +9 -0
- package/commands/auth.js +190 -0
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +81 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/convertFields.d.ts +7 -0
- package/commands/cms/convertFields.js +97 -0
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +80 -0
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +59 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +136 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/getReactModule.d.ts +7 -0
- package/commands/cms/getReactModule.js +77 -0
- package/commands/cms/lighthouseScore.d.ts +8 -0
- package/commands/cms/lighthouseScore.js +281 -0
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +62 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +21 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +64 -0
- package/commands/cms/theme/preview.d.ts +11 -0
- package/commands/cms/theme/preview.js +126 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +13 -0
- package/commands/cms/watch.js +132 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.d.ts +3 -0
- package/commands/cms.js +49 -0
- package/commands/completion.d.ts +3 -0
- package/commands/completion.js +27 -0
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +70 -0
- package/commands/config/set.d.ts +11 -0
- package/commands/config/set.js +141 -0
- package/commands/config.d.ts +3 -0
- package/commands/config.js +18 -0
- package/commands/customObject/create.d.ts +7 -0
- package/commands/customObject/create.js +64 -0
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +55 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +70 -0
- package/commands/customObject.d.ts +3 -0
- package/commands/customObject.js +38 -0
- package/commands/doctor.d.ts +6 -0
- package/commands/doctor.js +70 -0
- package/commands/feedback.d.ts +4 -0
- package/commands/feedback.js +32 -0
- package/commands/filemanager/fetch.d.ts +8 -0
- package/commands/filemanager/fetch.js +58 -0
- package/commands/filemanager/upload.d.ts +7 -0
- package/commands/filemanager/upload.js +97 -0
- package/commands/filemanager.d.ts +3 -0
- package/commands/filemanager.js +18 -0
- package/commands/getStarted.d.ts +8 -0
- package/commands/getStarted.js +322 -0
- package/commands/hubdb/clear.d.ts +7 -0
- package/commands/hubdb/clear.js +58 -0
- package/commands/hubdb/create.d.ts +6 -0
- package/commands/hubdb/create.js +74 -0
- package/commands/hubdb/delete.d.ts +6 -0
- package/commands/hubdb/delete.js +68 -0
- package/commands/hubdb/fetch.d.ts +7 -0
- package/commands/hubdb/fetch.js +55 -0
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +79 -0
- package/commands/hubdb.d.ts +5 -0
- package/commands/hubdb.js +27 -0
- package/commands/init.d.ts +8 -0
- package/commands/init.js +200 -0
- package/commands/mcp/setup.d.ts +6 -0
- package/commands/mcp/setup.js +36 -0
- package/commands/mcp/start.d.ts +6 -0
- package/commands/mcp/start.js +72 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +20 -0
- package/commands/open.d.ts +7 -0
- package/commands/open.js +70 -0
- package/commands/project/add.d.ts +10 -0
- package/commands/project/add.js +79 -0
- package/commands/project/cloneApp.d.ts +1 -0
- package/commands/project/cloneApp.js +1 -0
- package/commands/project/create.d.ts +4 -0
- package/commands/project/create.js +175 -0
- package/commands/project/deploy.d.ts +11 -0
- package/commands/project/deploy.js +196 -0
- package/commands/project/dev/deprecatedFlow.d.ts +11 -0
- package/commands/project/dev/deprecatedFlow.js +135 -0
- package/commands/project/dev/index.d.ts +5 -0
- package/commands/project/dev/index.js +174 -0
- package/commands/project/dev/unifiedFlow.d.ts +14 -0
- package/commands/project/dev/unifiedFlow.js +162 -0
- package/commands/project/download.d.ts +8 -0
- package/commands/project/download.js +95 -0
- package/commands/project/installDeps.d.ts +6 -0
- package/commands/project/installDeps.js +80 -0
- package/commands/project/lint.d.ts +6 -0
- package/commands/project/lint.js +178 -0
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.d.ts +7 -0
- package/commands/project/listBuilds.js +120 -0
- package/commands/project/logs.d.ts +10 -0
- package/commands/project/logs.js +119 -0
- package/commands/project/migrate.d.ts +7 -0
- package/commands/project/migrate.js +91 -0
- package/commands/project/open.d.ts +6 -0
- package/commands/project/open.js +61 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +203 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +129 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +19 -0
- package/commands/project/updateDeps.d.ts +6 -0
- package/commands/project/updateDeps.js +80 -0
- package/commands/project/upload.d.ts +10 -0
- package/commands/project/upload.js +145 -0
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +156 -0
- package/commands/project/watch.d.ts +6 -0
- package/commands/project/watch.js +152 -0
- package/commands/project.d.ts +3 -0
- package/commands/project.js +72 -0
- package/commands/sandbox/create.d.ts +8 -0
- package/commands/sandbox/create.js +156 -0
- package/commands/sandbox/delete.d.ts +7 -0
- package/commands/sandbox/delete.js +189 -0
- package/commands/sandbox.d.ts +3 -0
- package/commands/sandbox.js +19 -0
- package/commands/secret/addSecret.d.ts +6 -0
- package/commands/secret/addSecret.js +58 -0
- package/commands/secret/deleteSecret.d.ts +7 -0
- package/commands/secret/deleteSecret.js +71 -0
- package/commands/secret/listSecret.d.ts +4 -0
- package/commands/secret/listSecret.js +43 -0
- package/commands/secret/updateSecret.d.ts +6 -0
- package/commands/secret/updateSecret.js +57 -0
- package/commands/secret.d.ts +3 -0
- package/commands/secret.js +25 -0
- package/commands/testAccount/create.d.ts +15 -0
- package/commands/testAccount/create.js +232 -0
- package/commands/testAccount/createConfig.d.ts +8 -0
- package/commands/testAccount/createConfig.js +92 -0
- package/commands/testAccount/delete.d.ts +7 -0
- package/commands/testAccount/delete.js +188 -0
- package/commands/testAccount/importData.d.ts +9 -0
- package/commands/testAccount/importData.js +61 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +25 -0
- package/commands/upgrade.d.ts +8 -0
- package/commands/upgrade.js +119 -0
- package/lang/en.d.ts +3990 -0
- package/lang/en.js +4013 -0
- package/lib/CLIWebSocketServer.d.ts +28 -0
- package/lib/CLIWebSocketServer.js +91 -0
- package/lib/accountAuth.d.ts +10 -0
- package/lib/accountAuth.js +109 -0
- package/lib/accountTypes.d.ts +9 -0
- package/lib/accountTypes.js +41 -0
- package/lib/app/migrate.d.ts +44 -0
- package/lib/app/migrate.js +389 -0
- package/lib/app/urls.d.ts +17 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +15 -0
- package/lib/buildAccount.js +184 -0
- package/lib/cliUpgradeUtils.d.ts +22 -0
- package/lib/cliUpgradeUtils.js +62 -0
- package/lib/cmsAssets/api-sample.d.ts +3 -0
- package/lib/cmsAssets/api-sample.js +60 -0
- package/lib/cmsAssets/app.d.ts +3 -0
- package/lib/cmsAssets/app.js +12 -0
- package/lib/cmsAssets/function.d.ts +3 -0
- package/lib/cmsAssets/function.js +11 -0
- package/lib/cmsAssets/index.d.ts +5 -0
- package/lib/cmsAssets/index.js +21 -0
- package/lib/cmsAssets/module.d.ts +3 -0
- package/lib/cmsAssets/module.js +20 -0
- package/lib/cmsAssets/react-app.d.ts +3 -0
- package/lib/cmsAssets/react-app.js +12 -0
- package/lib/cmsAssets/template.d.ts +3 -0
- package/lib/cmsAssets/template.js +20 -0
- package/lib/cmsAssets/vue-app.d.ts +3 -0
- package/lib/cmsAssets/vue-app.js +12 -0
- package/lib/cmsAssets/webpack-serverless.d.ts +3 -0
- package/lib/cmsAssets/webpack-serverless.js +12 -0
- package/lib/cmsAssets/website-theme.d.ts +3 -0
- package/lib/cmsAssets/website-theme.js +19 -0
- package/lib/commandSuggestion.d.ts +3 -0
- package/lib/commandSuggestion.js +39 -0
- package/lib/commonOpts.d.ts +25 -0
- package/lib/commonOpts.js +181 -0
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +182 -0
- package/lib/configOptions.d.ts +21 -0
- package/lib/configOptions.js +111 -0
- package/lib/constants.d.ts +145 -0
- package/lib/constants.js +146 -0
- package/lib/customObject.d.ts +3 -0
- package/lib/customObject.js +11 -0
- package/lib/dependencyManagement.d.ts +21 -0
- package/lib/dependencyManagement.js +243 -0
- package/lib/developerTestAccounts.d.ts +6 -0
- package/lib/developerTestAccounts.js +66 -0
- package/lib/doctor/Diagnosis.d.ts +27 -0
- package/lib/doctor/Diagnosis.js +113 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +69 -0
- package/lib/doctor/DiagnosticInfoBuilder.js +169 -0
- package/lib/doctor/Doctor.d.ts +35 -0
- package/lib/doctor/Doctor.js +566 -0
- package/lib/enums/exitCodes.d.ts +5 -0
- package/lib/enums/exitCodes.js +10 -0
- package/lib/errorHandlers/index.d.ts +19 -0
- package/lib/errorHandlers/index.js +99 -0
- package/lib/errorHandlers/suppressError.d.ts +2 -0
- package/lib/errorHandlers/suppressError.js +53 -0
- package/lib/errors/ProjectErrors.d.ts +15 -0
- package/lib/errors/ProjectErrors.js +30 -0
- package/lib/errors/ProjectValidationError.d.ts +4 -0
- package/lib/errors/ProjectValidationError.js +9 -0
- package/lib/errors/PromptExitError.d.ts +4 -0
- package/lib/errors/PromptExitError.js +8 -0
- package/lib/filesystem.d.ts +2 -0
- package/lib/filesystem.js +19 -0
- package/lib/generateSelectors.d.ts +20 -0
- package/lib/generateSelectors.js +110 -0
- package/lib/getStarted/getStartedV2.d.ts +7 -0
- package/lib/getStarted/getStartedV2.js +18 -0
- package/lib/getStartedV2Actions.d.ts +50 -0
- package/lib/getStartedV2Actions.js +199 -0
- package/lib/hasFeature.d.ts +4 -0
- package/lib/hasFeature.js +18 -0
- package/lib/http.d.ts +1 -0
- package/lib/http.js +28 -0
- package/lib/importData.d.ts +3 -0
- package/lib/importData.js +51 -0
- package/lib/interpolation.d.ts +7 -0
- package/lib/interpolation.js +84 -0
- package/lib/jsonLoader.d.ts +14 -0
- package/lib/jsonLoader.js +60 -0
- package/lib/links.d.ts +11 -0
- package/lib/links.js +107 -0
- package/lib/marketplaceValidate.d.ts +16 -0
- package/lib/marketplaceValidate.js +88 -0
- package/lib/mcp/setup.d.ts +17 -0
- package/lib/mcp/setup.js +345 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +4 -0
- package/lib/middleware/autoUpdateMiddleware.js +105 -0
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +76 -0
- package/lib/middleware/configMiddleware.d.ts +15 -0
- package/lib/middleware/configMiddleware.js +93 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +118 -0
- package/lib/middleware/gitMiddleware.d.ts +2 -0
- package/lib/middleware/gitMiddleware.js +21 -0
- package/lib/middleware/requestMiddleware.d.ts +1 -0
- package/lib/middleware/requestMiddleware.js +5 -0
- package/lib/middleware/spinniesMiddleware.d.ts +1 -0
- package/lib/middleware/spinniesMiddleware.js +4 -0
- package/lib/middleware/usageTrackingMiddleware.d.ts +13 -0
- package/lib/middleware/usageTrackingMiddleware.js +16 -0
- package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
- package/lib/middleware/yargsChecksMiddleware.js +18 -0
- package/lib/npm/npmCli.d.ts +17 -0
- package/lib/npm/npmCli.js +59 -0
- package/lib/npm/packageJson.d.ts +24 -0
- package/lib/npm/packageJson.js +102 -0
- package/lib/npm/workspaces.d.ts +12 -0
- package/lib/npm/workspaces.js +48 -0
- package/lib/oauth.d.ts +2 -0
- package/lib/oauth.js +93 -0
- package/lib/parsing.d.ts +1 -0
- package/lib/parsing.js +8 -0
- package/lib/polling.d.ts +21 -0
- package/lib/polling.js +48 -0
- package/lib/process.d.ts +13 -0
- package/lib/process.js +56 -0
- package/lib/projects/ProjectLogsManager.d.ts +29 -0
- package/lib/projects/ProjectLogsManager.js +155 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +46 -0
- package/lib/projects/add/v2AddComponent.d.ts +9 -0
- package/lib/projects/add/v2AddComponent.js +111 -0
- package/lib/projects/components.d.ts +16 -0
- package/lib/projects/components.js +252 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +73 -0
- package/lib/projects/create/index.d.ts +24 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/create/legacy.js +48 -0
- package/lib/projects/create/v2.d.ts +26 -0
- package/lib/projects/create/v2.js +158 -0
- package/lib/projects/deploy.d.ts +13 -0
- package/lib/projects/deploy.js +76 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +89 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +41 -0
- package/lib/projects/localDev/AppDevModeInterface.js +337 -0
- package/lib/projects/localDev/DevServerManager.d.ts +21 -0
- package/lib/projects/localDev/DevServerManager.js +64 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +128 -0
- package/lib/projects/localDev/DevSessionManager.d.ts +18 -0
- package/lib/projects/localDev/DevSessionManager.js +95 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +34 -0
- package/lib/projects/localDev/LocalDevLogger.js +178 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.d.ts +59 -0
- package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +387 -0
- package/lib/projects/localDev/LocalDevProcess.d.ts +39 -0
- package/lib/projects/localDev/LocalDevProcess.js +277 -0
- package/lib/projects/localDev/LocalDevState.d.ts +63 -0
- package/lib/projects/localDev/LocalDevState.js +139 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +48 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +21 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +169 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +14 -0
- package/lib/projects/localDev/helpers/account.js +222 -0
- package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
- package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +17 -0
- package/lib/projects/localDev/helpers/project.d.ts +16 -0
- package/lib/projects/localDev/helpers/project.js +216 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +8 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +19 -0
- package/lib/projects/platformVersion.d.ts +9 -0
- package/lib/projects/platformVersion.js +39 -0
- package/lib/projects/pollProjectBuildAndDeploy.d.ts +10 -0
- package/lib/projects/pollProjectBuildAndDeploy.js +344 -0
- package/lib/projects/projectProfiles.d.ts +17 -0
- package/lib/projects/projectProfiles.js +140 -0
- package/lib/projects/structure.d.ts +18 -0
- package/lib/projects/structure.js +130 -0
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +12 -0
- package/lib/projects/uieLinting.d.ts +33 -0
- package/lib/projects/uieLinting.js +220 -0
- package/lib/projects/upload.d.ts +33 -0
- package/lib/projects/upload.js +147 -0
- package/lib/projects/urls.d.ts +10 -0
- package/lib/projects/urls.js +42 -0
- package/lib/projects/watch.d.ts +5 -0
- package/lib/projects/watch.js +168 -0
- package/lib/prompts/accountNamePrompt.d.ts +11 -0
- package/lib/prompts/accountNamePrompt.js +64 -0
- package/lib/prompts/accountsPrompt.d.ts +2 -0
- package/lib/prompts/accountsPrompt.js +33 -0
- package/lib/prompts/cmsFieldPrompt.d.ts +1 -0
- package/lib/prompts/cmsFieldPrompt.js +40 -0
- package/lib/prompts/confirmImportDataPrompt.d.ts +1 -0
- package/lib/prompts/confirmImportDataPrompt.js +12 -0
- package/lib/prompts/createApiSamplePrompt.d.ts +10 -0
- package/lib/prompts/createApiSamplePrompt.js +58 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +25 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +162 -0
- package/lib/prompts/createFunctionPrompt.d.ts +9 -0
- package/lib/prompts/createFunctionPrompt.js +94 -0
- package/lib/prompts/createModulePrompt.d.ts +10 -0
- package/lib/prompts/createModulePrompt.js +116 -0
- package/lib/prompts/createTemplatePrompt.d.ts +6 -0
- package/lib/prompts/createTemplatePrompt.js +29 -0
- package/lib/prompts/downloadProjectPrompt.d.ts +10 -0
- package/lib/prompts/downloadProjectPrompt.js +53 -0
- package/lib/prompts/importDataFilePathPrompt.d.ts +1 -0
- package/lib/prompts/importDataFilePathPrompt.js +26 -0
- package/lib/prompts/importDataTestAccountSelectPrompt.d.ts +3 -0
- package/lib/prompts/importDataTestAccountSelectPrompt.js +28 -0
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +39 -0
- package/lib/prompts/personalAccessKeyPrompt.d.ts +29 -0
- package/lib/prompts/personalAccessKeyPrompt.js +135 -0
- package/lib/prompts/previewPrompt.d.ts +15 -0
- package/lib/prompts/previewPrompt.js +48 -0
- package/lib/prompts/projectAddPrompt.d.ts +15 -0
- package/lib/prompts/projectAddPrompt.js +82 -0
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +12 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +166 -0
- package/lib/prompts/projectNameAndDestPrompt.d.ts +3 -0
- package/lib/prompts/projectNameAndDestPrompt.js +53 -0
- package/lib/prompts/projectNamePrompt.d.ts +6 -0
- package/lib/prompts/projectNamePrompt.js +27 -0
- package/lib/prompts/projectsLogsPrompt.d.ts +12 -0
- package/lib/prompts/projectsLogsPrompt.js +20 -0
- package/lib/prompts/promptUtils.d.ts +32 -0
- package/lib/prompts/promptUtils.js +222 -0
- package/lib/prompts/sandboxesPrompt.d.ts +10 -0
- package/lib/prompts/sandboxesPrompt.js +63 -0
- package/lib/prompts/secretPrompt.d.ts +13 -0
- package/lib/prompts/secretPrompt.js +31 -0
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +37 -0
- package/lib/prompts/selectHubDBTablePrompt.d.ts +12 -0
- package/lib/prompts/selectHubDBTablePrompt.js +66 -0
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +27 -0
- package/lib/prompts/selectProjectTemplatePrompt.js +75 -0
- package/lib/prompts/selectPublicAppForMigrationPrompt.d.ts +9 -0
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +68 -0
- package/lib/prompts/setAsDefaultAccountPrompt.d.ts +1 -0
- package/lib/prompts/setAsDefaultAccountPrompt.js +26 -0
- package/lib/prompts/uploadPrompt.d.ts +9 -0
- package/lib/prompts/uploadPrompt.js +32 -0
- package/lib/sandboxes.d.ts +14 -0
- package/lib/sandboxes.js +105 -0
- package/lib/schema.d.ts +3 -0
- package/lib/schema.js +27 -0
- package/lib/serverlessLogs.d.ts +4 -0
- package/lib/serverlessLogs.js +154 -0
- package/lib/testUtils.d.ts +14 -0
- package/lib/testUtils.js +18 -0
- package/lib/theme/cmsDevServerProcess.d.ts +12 -0
- package/lib/theme/cmsDevServerProcess.js +148 -0
- package/lib/theme/cmsDevServerRunner.d.ts +14 -0
- package/lib/theme/cmsDevServerRunner.js +90 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +85 -0
- package/lib/ui/SpinniesManager.d.ts +39 -0
- package/lib/ui/SpinniesManager.js +259 -0
- package/lib/ui/git.d.ts +1 -0
- package/lib/ui/git.js +25 -0
- package/lib/ui/index.d.ts +31 -0
- package/lib/ui/index.js +150 -0
- package/lib/ui/logger.d.ts +11 -0
- package/lib/ui/logger.js +13 -0
- package/lib/ui/removeAnsiCodes.d.ts +1 -0
- package/lib/ui/removeAnsiCodes.js +4 -0
- package/lib/ui/serverlessFunctionLogs.d.ts +9 -0
- package/lib/ui/serverlessFunctionLogs.js +88 -0
- package/lib/ui/spinniesUtils.d.ts +32 -0
- package/lib/ui/spinniesUtils.js +151 -0
- package/lib/ui/supportHyperlinks.d.ts +7 -0
- package/lib/ui/supportHyperlinks.js +59 -0
- package/lib/ui/supportsColor.d.ts +17 -0
- package/lib/ui/supportsColor.js +97 -0
- package/lib/ui/uiMessages.d.ts +73 -0
- package/lib/ui/uiMessages.js +76 -0
- package/lib/upload.d.ts +1 -0
- package/lib/upload.js +49 -0
- package/lib/usageTracking.d.ts +32 -0
- package/lib/usageTracking.js +174 -0
- package/lib/utils/hasFlag.d.ts +1 -0
- package/lib/utils/hasFlag.js +9 -0
- package/lib/validation.d.ts +13 -0
- package/lib/validation.js +142 -0
- package/lib/yargsUtils.d.ts +16 -0
- package/lib/yargsUtils.js +49 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +13 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.d.ts +24 -0
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +105 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +20 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.js +127 -0
- package/mcp-server/tools/cms/HsCreateTemplateTool.d.ts +25 -0
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +84 -0
- package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +18 -0
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +75 -0
- package/mcp-server/tools/cms/HsListFunctionsTool.d.ts +15 -0
- package/mcp-server/tools/cms/HsListFunctionsTool.js +64 -0
- package/mcp-server/tools/cms/HsListTool.d.ts +15 -0
- package/mcp-server/tools/cms/HsListTool.js +64 -0
- package/mcp-server/tools/index.d.ts +3 -0
- package/mcp-server/tools/index.js +48 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +36 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +82 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +40 -0
- package/mcp-server/tools/project/CreateProjectTool.js +98 -0
- package/mcp-server/tools/project/CreateTestAccountTool.d.ts +51 -0
- package/mcp-server/tools/project/CreateTestAccountTool.js +170 -0
- package/mcp-server/tools/project/DeployProjectTool.d.ts +15 -0
- package/mcp-server/tools/project/DeployProjectTool.js +58 -0
- package/mcp-server/tools/project/DocFetchTool.d.ts +14 -0
- package/mcp-server/tools/project/DocFetchTool.js +57 -0
- package/mcp-server/tools/project/DocsSearchTool.d.ts +23 -0
- package/mcp-server/tools/project/DocsSearchTool.js +69 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +16 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +73 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +13 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +56 -0
- package/mcp-server/tools/project/GetBuildLogsTool.d.ts +21 -0
- package/mcp-server/tools/project/GetBuildLogsTool.js +124 -0
- package/mcp-server/tools/project/GetBuildStatusTool.d.ts +16 -0
- package/mcp-server/tools/project/GetBuildStatusTool.js +165 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +15 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +65 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +19 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +50 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +16 -0
- package/mcp-server/tools/project/UploadProjectTools.js +83 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +14 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +42 -0
- package/mcp-server/tools/project/constants.d.ts +18 -0
- package/mcp-server/tools/project/constants.js +29 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +13 -0
- package/mcp-server/utils/command.d.ts +8 -0
- package/mcp-server/utils/command.js +33 -0
- package/mcp-server/utils/config.d.ts +1 -0
- package/mcp-server/utils/config.js +10 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +24 -0
- package/mcp-server/utils/feedbackTracking.d.ts +1 -0
- package/mcp-server/utils/feedbackTracking.js +26 -0
- package/mcp-server/utils/toolUsageTracking.d.ts +3 -0
- package/mcp-server/utils/toolUsageTracking.js +24 -0
- package/package.json +2 -1
- package/types/Cms.d.ts +46 -0
- package/types/Cms.js +27 -0
- package/types/LocalDev.d.ts +47 -0
- package/types/LocalDev.js +1 -0
- package/types/PackageJson.d.ts +10 -0
- package/types/PackageJson.js +1 -0
- package/types/ProjectComponents.d.ts +23 -0
- package/types/ProjectComponents.js +2 -0
- package/types/Projects.d.ts +130 -0
- package/types/Projects.js +6 -0
- package/types/Prompts.d.ts +28 -0
- package/types/Prompts.js +1 -0
- package/types/Sandboxes.d.ts +5 -0
- package/types/Sandboxes.js +1 -0
- package/types/Yargs.d.ts +46 -0
- package/types/Yargs.js +1 -0
- package/ui/components/ActionSection.d.ts +12 -0
- package/ui/components/ActionSection.js +25 -0
- package/ui/components/BoxWithTitle.d.ts +11 -0
- package/ui/components/BoxWithTitle.js +9 -0
- package/ui/components/FullScreen.d.ts +6 -0
- package/ui/components/FullScreen.js +13 -0
- package/ui/components/HorizontalSelectPrompt.d.ts +8 -0
- package/ui/components/HorizontalSelectPrompt.js +30 -0
- package/ui/components/InputField.d.ts +10 -0
- package/ui/components/InputField.js +10 -0
- package/ui/components/SelectInput.d.ts +11 -0
- package/ui/components/SelectInput.js +59 -0
- package/ui/components/StatusIcon.d.ts +9 -0
- package/ui/components/StatusIcon.js +17 -0
- package/ui/components/StatusMessageBoxes.d.ts +13 -0
- package/ui/components/StatusMessageBoxes.js +31 -0
- package/ui/components/Table.d.ts +89 -0
- package/ui/components/Table.js +246 -0
- package/ui/components/getStarted/GetStartedFlow.d.ts +8 -0
- package/ui/components/getStarted/GetStartedFlow.js +213 -0
- package/ui/components/getStarted/reducer.d.ts +79 -0
- package/ui/components/getStarted/reducer.js +108 -0
- package/ui/components/getStarted/screens/InstallationScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/InstallationScreen.js +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.d.ts +16 -0
- package/ui/components/getStarted/screens/ProjectSetupScreen.js +40 -0
- package/ui/components/getStarted/screens/UploadScreen.d.ts +7 -0
- package/ui/components/getStarted/screens/UploadScreen.js +43 -0
- package/ui/components/getStarted/selectors.d.ts +2 -0
- package/ui/components/getStarted/selectors.js +1 -0
- package/ui/constants.d.ts +6 -0
- package/ui/constants.js +6 -0
- package/ui/lib/constants.d.ts +17 -0
- package/ui/lib/constants.js +17 -0
- package/ui/lib/table.d.ts +2 -0
- package/ui/lib/table.js +11 -0
- package/ui/lib/useTerminalSize.d.ts +13 -0
- package/ui/lib/useTerminalSize.js +31 -0
- package/ui/playground/Playground.d.ts +5 -0
- package/ui/playground/Playground.js +25 -0
- package/ui/playground/fixtures.d.ts +9 -0
- package/ui/playground/fixtures.js +126 -0
- package/ui/render.d.ts +23 -0
- package/ui/render.js +75 -0
- package/ui/styles.d.ts +21 -0
- package/ui/styles.js +21 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
|
+
import { commands } from '../../lang/en.js';
|
|
3
|
+
import { PROJECT_ERROR_TYPES } from '../constants.js';
|
|
4
|
+
import { deployProjectV1, deployProjectV2, } from '@hubspot/local-dev-lib/api/projects';
|
|
5
|
+
import { pollDeployStatus } from './pollProjectBuildAndDeploy.js';
|
|
6
|
+
export function validateBuildIdForDeploy(buildId, deployedBuildId, latestBuildId, projectName, accountId) {
|
|
7
|
+
if (Number(buildId) > latestBuildId) {
|
|
8
|
+
return commands.project.deploy.errors.buildIdDoesNotExist(accountId, buildId, projectName);
|
|
9
|
+
}
|
|
10
|
+
if (Number(buildId) === deployedBuildId) {
|
|
11
|
+
return commands.project.deploy.errors.buildAlreadyDeployed(accountId, buildId, projectName);
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
export function logDeployErrors(errorData) {
|
|
16
|
+
uiLogger.error(errorData.message);
|
|
17
|
+
errorData.errors.forEach(err => {
|
|
18
|
+
// This is how the pre-deploy check manifests itself in < 2025.2 projects
|
|
19
|
+
if (err.subCategory === PROJECT_ERROR_TYPES.DEPLOY_CONTAINS_REMOVALS) {
|
|
20
|
+
uiLogger.log(commands.project.deploy.errors.deployContainsRemovals(err.context.COMPONENT_NAME));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
uiLogger.log(err.message);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function handleBlockedDeploy(deployResp) {
|
|
28
|
+
const deployCanBeForced = deployResp.issues.every(issue => issue.blockingMessages.every(message => message.isWarning));
|
|
29
|
+
uiLogger.log('');
|
|
30
|
+
if (deployCanBeForced) {
|
|
31
|
+
uiLogger.warn(commands.project.deploy.errors.deployWarningsHeader);
|
|
32
|
+
uiLogger.log('');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
uiLogger.error(commands.project.deploy.errors.deployBlockedHeader);
|
|
36
|
+
uiLogger.log('');
|
|
37
|
+
}
|
|
38
|
+
deployResp.issues.forEach(issue => {
|
|
39
|
+
if (issue.blockingMessages.length > 0) {
|
|
40
|
+
issue.blockingMessages.forEach(message => {
|
|
41
|
+
uiLogger.log(commands.project.deploy.errors.deployIssueComponentWarning(issue.uid, issue.componentTypeName, message.message));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
uiLogger.log(commands.project.deploy.errors.deployIssueComponentGeneric(issue.uid, issue.componentTypeName));
|
|
46
|
+
}
|
|
47
|
+
uiLogger.log('');
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export async function handleProjectDeploy(targetAccountId, projectName, buildId, isV2Project, force) {
|
|
51
|
+
let deployId;
|
|
52
|
+
if (isV2Project) {
|
|
53
|
+
const { data: deployResp } = await deployProjectV2(targetAccountId, projectName, buildId, force);
|
|
54
|
+
if (!deployResp || deployResp.buildResultType !== 'DEPLOY_QUEUED') {
|
|
55
|
+
if (deployResp?.buildResultType === 'DEPLOY_BLOCKED') {
|
|
56
|
+
handleBlockedDeploy(deployResp);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
uiLogger.error(commands.project.deploy.errors.deploy);
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
deployId = deployResp.id;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const response = await deployProjectV1(targetAccountId, projectName, buildId, force);
|
|
67
|
+
const { data: deployResp } = response;
|
|
68
|
+
if (!deployResp) {
|
|
69
|
+
uiLogger.error(commands.project.deploy.errors.deploy);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
deployId = deployResp.id;
|
|
73
|
+
}
|
|
74
|
+
const deployResult = await pollDeployStatus(targetAccountId, projectName, Number(deployId), buildId);
|
|
75
|
+
return deployResult;
|
|
76
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Project } from '@hubspot/local-dev-lib/types/Project';
|
|
2
|
+
export declare function ensureProjectExists(accountId: number, projectName: string, { forceCreate, allowCreate, noLogs, withPolling, uploadCommand, }?: {
|
|
3
|
+
forceCreate?: boolean | undefined;
|
|
4
|
+
allowCreate?: boolean | undefined;
|
|
5
|
+
noLogs?: boolean | undefined;
|
|
6
|
+
withPolling?: boolean | undefined;
|
|
7
|
+
uploadCommand?: boolean | undefined;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
projectExists: boolean;
|
|
10
|
+
project?: Project;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createProject, fetchProject, } from '@hubspot/local-dev-lib/api/projects';
|
|
2
|
+
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
3
|
+
import { DEFAULT_POLLING_DELAY } from '../constants.js';
|
|
4
|
+
import { promptUser } from '../prompts/promptUtils.js';
|
|
5
|
+
import { uiAccountDescription } from '../ui/index.js';
|
|
6
|
+
import SpinniesManager from '../ui/SpinniesManager.js';
|
|
7
|
+
import { logError, ApiErrorContext } from '../errorHandlers/index.js';
|
|
8
|
+
import { lib } from '../../lang/en.js';
|
|
9
|
+
import { uiLogger } from '../ui/logger.js';
|
|
10
|
+
async function pollFetchProject(accountId, projectName) {
|
|
11
|
+
// Temporary solution for gating slowness. Retry on 403 statusCode
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
let pollCount = 0;
|
|
14
|
+
SpinniesManager.add('pollFetchProject', {
|
|
15
|
+
text: lib.projects.pollFetchProject.checkingProject(uiAccountDescription(accountId)),
|
|
16
|
+
});
|
|
17
|
+
const pollInterval = setInterval(async () => {
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetchProject(accountId, projectName);
|
|
20
|
+
if (response && response.data) {
|
|
21
|
+
SpinniesManager.remove('pollFetchProject');
|
|
22
|
+
clearInterval(pollInterval);
|
|
23
|
+
resolve(response);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
if (isSpecifiedError(err, {
|
|
28
|
+
statusCode: 403,
|
|
29
|
+
category: 'GATED',
|
|
30
|
+
subCategory: 'BuildPipelineErrorType.PORTAL_GATED',
|
|
31
|
+
}) &&
|
|
32
|
+
pollCount < 15) {
|
|
33
|
+
pollCount += 1;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
SpinniesManager.remove('pollFetchProject');
|
|
37
|
+
clearInterval(pollInterval);
|
|
38
|
+
reject(err);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, DEFAULT_POLLING_DELAY);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export async function ensureProjectExists(accountId, projectName, { forceCreate = false, allowCreate = true, noLogs = false, withPolling = false, uploadCommand = false, } = {}) {
|
|
45
|
+
const accountIdentifier = uiAccountDescription(accountId);
|
|
46
|
+
try {
|
|
47
|
+
const { data: project } = withPolling
|
|
48
|
+
? await pollFetchProject(accountId, projectName)
|
|
49
|
+
: await fetchProject(accountId, projectName);
|
|
50
|
+
return { projectExists: !!project, project };
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
if (isSpecifiedError(err, { statusCode: 404 })) {
|
|
54
|
+
let shouldCreateProject = forceCreate;
|
|
55
|
+
if (allowCreate && !shouldCreateProject) {
|
|
56
|
+
const promptLangFunction = uploadCommand
|
|
57
|
+
? lib.projects.ensureProjectExists.createPromptUpload
|
|
58
|
+
: lib.projects.ensureProjectExists.createPrompt;
|
|
59
|
+
const promptResult = await promptUser([
|
|
60
|
+
{
|
|
61
|
+
name: 'shouldCreateProject',
|
|
62
|
+
message: promptLangFunction(projectName, accountIdentifier),
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
},
|
|
65
|
+
]);
|
|
66
|
+
shouldCreateProject = promptResult.shouldCreateProject;
|
|
67
|
+
}
|
|
68
|
+
if (shouldCreateProject) {
|
|
69
|
+
try {
|
|
70
|
+
const { data: project } = await createProject(accountId, projectName);
|
|
71
|
+
uiLogger.success(lib.projects.ensureProjectExists.createSuccess(projectName, accountIdentifier));
|
|
72
|
+
return { projectExists: true, project };
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
logError(err, new ApiErrorContext({ accountId }));
|
|
76
|
+
return { projectExists: false };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
if (!noLogs) {
|
|
81
|
+
uiLogger.log(lib.projects.ensureProjectExists.notFound(projectName, accountIdentifier));
|
|
82
|
+
}
|
|
83
|
+
return { projectExists: false };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
logError(err, new ApiErrorContext({ accountId }));
|
|
87
|
+
return { projectExists: false };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AppIRNode } from '../../../types/ProjectComponents.js';
|
|
2
|
+
import LocalDevState from './LocalDevState.js';
|
|
3
|
+
import LocalDevLogger from './LocalDevLogger.js';
|
|
4
|
+
type AppDevModeInterfaceConstructorOptions = {
|
|
5
|
+
localDevState: LocalDevState;
|
|
6
|
+
localDevLogger: LocalDevLogger;
|
|
7
|
+
};
|
|
8
|
+
declare class AppDevModeInterface {
|
|
9
|
+
localDevState: LocalDevState;
|
|
10
|
+
localDevLogger: LocalDevLogger;
|
|
11
|
+
_appNode?: AppIRNode | null;
|
|
12
|
+
marketplaceAppInstalls?: number;
|
|
13
|
+
private appInstallResolve?;
|
|
14
|
+
constructor(options: AppDevModeInterfaceConstructorOptions);
|
|
15
|
+
private getAppNodeFromProjectNodes;
|
|
16
|
+
private get appNode();
|
|
17
|
+
private get appData();
|
|
18
|
+
private set appData(value);
|
|
19
|
+
private isStaticAuthApp;
|
|
20
|
+
private isOAuthApp;
|
|
21
|
+
private isAutomaticallyInstallable;
|
|
22
|
+
private getAppInstallUrl;
|
|
23
|
+
private fetchAppData;
|
|
24
|
+
private checkMarketplaceAppInstalls;
|
|
25
|
+
private waitUntilAppIsInstalled;
|
|
26
|
+
private autoInstallStaticAuthApp;
|
|
27
|
+
private installAppOrOpenInstallUrl;
|
|
28
|
+
private checkTestAccountAppInstallation;
|
|
29
|
+
private validateOauthAppRedirectUrl;
|
|
30
|
+
private resolveAppInstallPromise;
|
|
31
|
+
private handleAppInstallSuccessDevServerMessage;
|
|
32
|
+
private handleAppInstallInitiatedDevServerMessage;
|
|
33
|
+
private handleAppInstallFailureDevServerMessage;
|
|
34
|
+
private onDevServerMessage;
|
|
35
|
+
private onChangeProjectNodes;
|
|
36
|
+
private removeStateListeners;
|
|
37
|
+
setup(): Promise<void>;
|
|
38
|
+
start(): Promise<void>;
|
|
39
|
+
cleanup(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export default AppDevModeInterface;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { fetchAppInstallationData } from '@hubspot/local-dev-lib/api/localDevAuth';
|
|
2
|
+
import { fetchAppMetadataBySourceId, fetchPublicAppProductionInstallCounts, installStaticAuthAppOnTestAccount, } from '@hubspot/local-dev-lib/api/appsDev';
|
|
3
|
+
import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
|
|
4
|
+
import { APP_AUTH_TYPES, APP_DISTRIBUTION_TYPES, APP_INSTALLATION_STATES, LOCAL_DEV_SERVER_MESSAGE_TYPES, } from '../../constants.js';
|
|
5
|
+
import { EXIT_CODES } from '../../enums/exitCodes.js';
|
|
6
|
+
import { isAppIRNode } from '../../projects/structure.js';
|
|
7
|
+
import { uiLine } from '../../ui/index.js';
|
|
8
|
+
import { logError } from '../../errorHandlers/index.js';
|
|
9
|
+
import { PromptExitError } from '../../errors/PromptExitError.js';
|
|
10
|
+
import { installAppAutoPrompt, installAppBrowserPrompt, } from '../../prompts/installAppPrompt.js';
|
|
11
|
+
import { confirmPrompt } from '../../prompts/promptUtils.js';
|
|
12
|
+
import { lib } from '../../../lang/en.js';
|
|
13
|
+
import { uiLogger } from '../../ui/logger.js';
|
|
14
|
+
import { getOauthAppInstallUrl, getStaticAuthAppInstallUrl, } from '../../app/urls.js';
|
|
15
|
+
import { isDeveloperTestAccount, isSandbox } from '../../accountTypes.js';
|
|
16
|
+
import SpinniesManager from '../../ui/SpinniesManager.js';
|
|
17
|
+
import { isServerRunningAtUrl } from '../../http.js';
|
|
18
|
+
class AppDevModeInterface {
|
|
19
|
+
localDevState;
|
|
20
|
+
localDevLogger;
|
|
21
|
+
_appNode;
|
|
22
|
+
marketplaceAppInstalls;
|
|
23
|
+
appInstallResolve;
|
|
24
|
+
constructor(options) {
|
|
25
|
+
this.localDevState = options.localDevState;
|
|
26
|
+
this.localDevLogger = options.localDevLogger;
|
|
27
|
+
if (!this.localDevState.targetProjectAccountId ||
|
|
28
|
+
!this.localDevState.projectConfig ||
|
|
29
|
+
!this.localDevState.projectDir) {
|
|
30
|
+
uiLogger.error(lib.LocalDevManager.failedToInitialize);
|
|
31
|
+
process.exit(EXIT_CODES.ERROR);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
getAppNodeFromProjectNodes(projectNodes) {
|
|
35
|
+
return Object.values(projectNodes).find(isAppIRNode) || null;
|
|
36
|
+
}
|
|
37
|
+
// Assumes only one app per project
|
|
38
|
+
get appNode() {
|
|
39
|
+
if (this._appNode === undefined) {
|
|
40
|
+
this._appNode = this.getAppNodeFromProjectNodes(this.localDevState.projectNodes);
|
|
41
|
+
}
|
|
42
|
+
return this._appNode;
|
|
43
|
+
}
|
|
44
|
+
get appData() {
|
|
45
|
+
// These checks are primarily for type safety
|
|
46
|
+
// App data will never be accessed before being set
|
|
47
|
+
if (!this.appNode) {
|
|
48
|
+
uiLogger.log(lib.AppDevModeInterface.appDataNotFound);
|
|
49
|
+
process.exit(EXIT_CODES.ERROR);
|
|
50
|
+
}
|
|
51
|
+
const data = this.localDevState.getAppDataByUid(this.appNode.uid);
|
|
52
|
+
if (!data) {
|
|
53
|
+
uiLogger.log(lib.AppDevModeInterface.appDataNotFound);
|
|
54
|
+
process.exit(EXIT_CODES.ERROR);
|
|
55
|
+
}
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
set appData(appData) {
|
|
59
|
+
if (!this.appNode) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.localDevState.setAppDataForUid(this.appNode.uid, appData);
|
|
63
|
+
}
|
|
64
|
+
isStaticAuthApp() {
|
|
65
|
+
return (this.appNode?.config.auth.type.toLowerCase() === APP_AUTH_TYPES.STATIC);
|
|
66
|
+
}
|
|
67
|
+
isOAuthApp() {
|
|
68
|
+
return (this.appNode?.config.auth.type.toLowerCase() === APP_AUTH_TYPES.OAUTH);
|
|
69
|
+
}
|
|
70
|
+
isAutomaticallyInstallable() {
|
|
71
|
+
const targetTestingAccount = getConfigAccountById(this.localDevState.targetTestingAccountId);
|
|
72
|
+
if (!targetTestingAccount) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const isTestAccount = isDeveloperTestAccount(targetTestingAccount) ||
|
|
76
|
+
isSandbox(targetTestingAccount);
|
|
77
|
+
const hasCorrectParent = targetTestingAccount.parentAccountId ===
|
|
78
|
+
this.localDevState.targetProjectAccountId;
|
|
79
|
+
return isTestAccount && hasCorrectParent && this.isStaticAuthApp();
|
|
80
|
+
}
|
|
81
|
+
async getAppInstallUrl() {
|
|
82
|
+
if (this.appNode && this.isOAuthApp()) {
|
|
83
|
+
return getOauthAppInstallUrl({
|
|
84
|
+
targetAccountId: this.localDevState.targetTestingAccountId,
|
|
85
|
+
env: this.localDevState.env,
|
|
86
|
+
clientId: this.appData.clientId,
|
|
87
|
+
scopes: this.appNode.config.auth.requiredScopes,
|
|
88
|
+
redirectUrls: this.appNode.config.auth.redirectUrls,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return getStaticAuthAppInstallUrl({
|
|
92
|
+
targetAccountId: this.localDevState.targetTestingAccountId,
|
|
93
|
+
env: this.localDevState.env,
|
|
94
|
+
appId: this.appData.id,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async fetchAppData() {
|
|
98
|
+
SpinniesManager.add('fetchAppData', {
|
|
99
|
+
text: lib.AppDevModeInterface.fetchAppData.checking(this.appNode?.config.name || ''),
|
|
100
|
+
});
|
|
101
|
+
let appData;
|
|
102
|
+
try {
|
|
103
|
+
const { data } = await fetchAppMetadataBySourceId(this.localDevState.projectData.id, this.appNode.uid, this.localDevState.targetProjectAccountId);
|
|
104
|
+
appData = data;
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
SpinniesManager.fail('fetchAppData', {
|
|
108
|
+
text: lib.AppDevModeInterface.fetchAppData.error,
|
|
109
|
+
});
|
|
110
|
+
logError(e);
|
|
111
|
+
process.exit(EXIT_CODES.ERROR);
|
|
112
|
+
}
|
|
113
|
+
if (!appData) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const { data: { uniquePortalInstallCount }, } = await fetchPublicAppProductionInstallCounts(appData.id, this.localDevState.targetProjectAccountId);
|
|
117
|
+
this.appData = {
|
|
118
|
+
id: appData.id,
|
|
119
|
+
clientId: appData.clientId,
|
|
120
|
+
name: appData.name,
|
|
121
|
+
installationState: APP_INSTALLATION_STATES.UNKNOWN,
|
|
122
|
+
scopeGroupIds: appData.scopeGroupIds,
|
|
123
|
+
};
|
|
124
|
+
this.marketplaceAppInstalls = uniquePortalInstallCount;
|
|
125
|
+
}
|
|
126
|
+
async checkMarketplaceAppInstalls() {
|
|
127
|
+
if (!this.marketplaceAppInstalls) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
SpinniesManager.fail('fetchAppData', {
|
|
131
|
+
text: lib.AppDevModeInterface.fetchAppData.activeInstallations(this.appNode?.config.name || '', this.marketplaceAppInstalls),
|
|
132
|
+
failColor: 'yellow',
|
|
133
|
+
});
|
|
134
|
+
uiLine();
|
|
135
|
+
uiLogger.log(lib.LocalDevManager.activeInstallWarning.explanation);
|
|
136
|
+
uiLine();
|
|
137
|
+
const proceed = await confirmPrompt(lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
|
|
138
|
+
if (!proceed) {
|
|
139
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
140
|
+
}
|
|
141
|
+
this.localDevState.addUploadWarning(lib.AppDevModeInterface.defaultMarketplaceAppWarning(this.marketplaceAppInstalls));
|
|
142
|
+
}
|
|
143
|
+
async waitUntilAppIsInstalled(installUrl) {
|
|
144
|
+
uiLogger.log(lib.AppDevModeInterface.waitUntilAppIsInstalled.link(installUrl));
|
|
145
|
+
SpinniesManager.add('waitUntilAppIsInstalled', {
|
|
146
|
+
text: lib.AppDevModeInterface.waitUntilAppIsInstalled.waiting,
|
|
147
|
+
});
|
|
148
|
+
await new Promise(resolve => {
|
|
149
|
+
this.appInstallResolve = resolve;
|
|
150
|
+
});
|
|
151
|
+
SpinniesManager.succeed('waitUntilAppIsInstalled', {
|
|
152
|
+
text: lib.AppDevModeInterface.waitUntilAppIsInstalled.success(this.appNode?.config.name || '', this.localDevState.targetTestingAccountId),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async autoInstallStaticAuthApp() {
|
|
156
|
+
const shouldInstall = await installAppAutoPrompt();
|
|
157
|
+
if (!shouldInstall) {
|
|
158
|
+
uiLogger.log(lib.AppDevModeInterface.autoInstallDeclined);
|
|
159
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
160
|
+
}
|
|
161
|
+
uiLogger.log('');
|
|
162
|
+
SpinniesManager.add('autoInstallStaticAuthApp', {
|
|
163
|
+
text: lib.AppDevModeInterface.autoInstallStaticAuthApp.installing(this.appData.name, this.localDevState.targetTestingAccountId),
|
|
164
|
+
});
|
|
165
|
+
try {
|
|
166
|
+
await installStaticAuthAppOnTestAccount(this.appData.id, this.localDevState.targetTestingAccountId, this.appData.scopeGroupIds);
|
|
167
|
+
SpinniesManager.succeed('autoInstallStaticAuthApp', {
|
|
168
|
+
text: lib.AppDevModeInterface.autoInstallStaticAuthApp.success(this.appData.name, this.localDevState.targetTestingAccountId),
|
|
169
|
+
});
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
catch (e) {
|
|
173
|
+
SpinniesManager.fail('autoInstallStaticAuthApp', {
|
|
174
|
+
text: lib.AppDevModeInterface.autoInstallStaticAuthApp.error(this.appData.name, this.localDevState.targetTestingAccountId),
|
|
175
|
+
failColor: 'white',
|
|
176
|
+
});
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async installAppOrOpenInstallUrl(isReinstall) {
|
|
181
|
+
if (this.isAutomaticallyInstallable()) {
|
|
182
|
+
const installSuccess = await this.autoInstallStaticAuthApp();
|
|
183
|
+
if (installSuccess) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const installUrl = await this.getAppInstallUrl();
|
|
188
|
+
await installAppBrowserPrompt(installUrl, isReinstall);
|
|
189
|
+
if (!isReinstall) {
|
|
190
|
+
await this.waitUntilAppIsInstalled(installUrl);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async checkTestAccountAppInstallation() {
|
|
194
|
+
if (!this.appNode) {
|
|
195
|
+
return {};
|
|
196
|
+
}
|
|
197
|
+
const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await fetchAppInstallationData(this.localDevState.targetTestingAccountId, this.localDevState.projectId, this.appNode.uid, this.appNode.config.auth.requiredScopes, this.appNode.config.auth.optionalScopes);
|
|
198
|
+
const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
|
|
199
|
+
if (isInstalledWithScopeGroups) {
|
|
200
|
+
this.appData = {
|
|
201
|
+
...this.appData,
|
|
202
|
+
installationState: APP_INSTALLATION_STATES.INSTALLED,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
else if (isReinstall) {
|
|
206
|
+
this.appData = {
|
|
207
|
+
...this.appData,
|
|
208
|
+
installationState: APP_INSTALLATION_STATES.INSTALLED_WITH_OUTDATED_SCOPES,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
this.appData = {
|
|
213
|
+
...this.appData,
|
|
214
|
+
installationState: APP_INSTALLATION_STATES.NOT_INSTALLED,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
return { needsInstall: !isInstalledWithScopeGroups, isReinstall };
|
|
218
|
+
}
|
|
219
|
+
async validateOauthAppRedirectUrl() {
|
|
220
|
+
const redirectUrl = this.appNode?.config.auth.redirectUrls[0];
|
|
221
|
+
if (!redirectUrl) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const serverIsRunningAtRedirectUrl = await isServerRunningAtUrl(redirectUrl);
|
|
225
|
+
if (!serverIsRunningAtRedirectUrl) {
|
|
226
|
+
uiLogger.log('');
|
|
227
|
+
uiLogger.error(lib.AppDevModeInterface.oauthAppRedirectUrlError(redirectUrl));
|
|
228
|
+
process.exit(EXIT_CODES.ERROR);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
resolveAppInstallPromise() {
|
|
232
|
+
if (this.appInstallResolve) {
|
|
233
|
+
this.appInstallResolve();
|
|
234
|
+
this.appInstallResolve = undefined;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
handleAppInstallSuccessDevServerMessage() {
|
|
238
|
+
this.resolveAppInstallPromise();
|
|
239
|
+
this.appData = {
|
|
240
|
+
...this.appData,
|
|
241
|
+
installationState: APP_INSTALLATION_STATES.INSTALLED,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
handleAppInstallInitiatedDevServerMessage() {
|
|
245
|
+
this.resolveAppInstallPromise();
|
|
246
|
+
}
|
|
247
|
+
handleAppInstallFailureDevServerMessage() {
|
|
248
|
+
uiLogger.error(lib.AppDevModeInterface.installationFailed);
|
|
249
|
+
process.exit(EXIT_CODES.ERROR);
|
|
250
|
+
}
|
|
251
|
+
onDevServerMessage = async (message) => {
|
|
252
|
+
if (message === LOCAL_DEV_SERVER_MESSAGE_TYPES.WEBSOCKET_SERVER_CONNECTED) {
|
|
253
|
+
await this.checkTestAccountAppInstallation();
|
|
254
|
+
}
|
|
255
|
+
else if (message === LOCAL_DEV_SERVER_MESSAGE_TYPES.STATIC_AUTH_APP_INSTALL_SUCCESS) {
|
|
256
|
+
this.handleAppInstallSuccessDevServerMessage();
|
|
257
|
+
}
|
|
258
|
+
else if (message === LOCAL_DEV_SERVER_MESSAGE_TYPES.STATIC_AUTH_APP_INSTALL_FAILURE) {
|
|
259
|
+
this.handleAppInstallFailureDevServerMessage();
|
|
260
|
+
}
|
|
261
|
+
else if (message === LOCAL_DEV_SERVER_MESSAGE_TYPES.OAUTH_APP_INSTALL_INITIATED) {
|
|
262
|
+
this.handleAppInstallInitiatedDevServerMessage();
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
onChangeProjectNodes = (nodes) => {
|
|
266
|
+
const newAppNode = this.getAppNodeFromProjectNodes(nodes);
|
|
267
|
+
const oldDistribution = this.appNode?.config.distribution;
|
|
268
|
+
const newDistribution = newAppNode?.config.distribution;
|
|
269
|
+
const oldAuthType = this.appNode?.config.auth.type;
|
|
270
|
+
const newAuthType = newAppNode?.config.auth.type;
|
|
271
|
+
if (newDistribution?.toLowerCase() === APP_DISTRIBUTION_TYPES.MARKETPLACE &&
|
|
272
|
+
oldDistribution?.toLowerCase() !== APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
273
|
+
this.localDevState.addUploadWarning(lib.AppDevModeInterface.distributionChanged);
|
|
274
|
+
}
|
|
275
|
+
else if (newAuthType?.toLowerCase() === APP_AUTH_TYPES.OAUTH &&
|
|
276
|
+
oldAuthType?.toLowerCase() !== APP_AUTH_TYPES.OAUTH) {
|
|
277
|
+
this.localDevState.addUploadWarning(lib.AppDevModeInterface.authTypeChanged);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
removeStateListeners() {
|
|
281
|
+
this.localDevState.removeListener('devServerMessage', this.onDevServerMessage);
|
|
282
|
+
this.localDevState.removeListener('projectNodes', this.onChangeProjectNodes);
|
|
283
|
+
}
|
|
284
|
+
async setup() {
|
|
285
|
+
if (!this.appNode) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
await this.fetchAppData();
|
|
290
|
+
if (this.appNode.config.distribution === APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
291
|
+
await this.checkMarketplaceAppInstalls();
|
|
292
|
+
}
|
|
293
|
+
const { needsInstall, isReinstall } = await this.checkTestAccountAppInstallation();
|
|
294
|
+
if (needsInstall) {
|
|
295
|
+
if (SpinniesManager.pick('fetchAppData')) {
|
|
296
|
+
SpinniesManager.fail('fetchAppData', {
|
|
297
|
+
text: lib.AppDevModeInterface.fetchAppData.notInstalled(this.appNode.config.name, this.localDevState.targetTestingAccountId),
|
|
298
|
+
failColor: 'white',
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
if (this.isOAuthApp()) {
|
|
302
|
+
await this.validateOauthAppRedirectUrl();
|
|
303
|
+
}
|
|
304
|
+
this.localDevState.addListener('devServerMessage', this.onDevServerMessage);
|
|
305
|
+
await this.installAppOrOpenInstallUrl(isReinstall || false);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
if (SpinniesManager.pick('fetchAppData')) {
|
|
309
|
+
SpinniesManager.succeed('fetchAppData', {
|
|
310
|
+
text: lib.AppDevModeInterface.fetchAppData.success(this.appNode.config.name, this.localDevState.targetTestingAccountId),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
uiLogger.log('');
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
catch (e) {
|
|
317
|
+
if (e instanceof PromptExitError) {
|
|
318
|
+
throw e;
|
|
319
|
+
}
|
|
320
|
+
if (SpinniesManager.pick('fetchAppData')) {
|
|
321
|
+
SpinniesManager.fail('fetchAppData', {
|
|
322
|
+
text: lib.AppDevModeInterface.fetchAppData.error,
|
|
323
|
+
failColor: 'white',
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
logError(e);
|
|
327
|
+
process.exit(EXIT_CODES.ERROR);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
async start() {
|
|
331
|
+
this.localDevState.addListener('projectNodes', this.onChangeProjectNodes);
|
|
332
|
+
}
|
|
333
|
+
async cleanup() {
|
|
334
|
+
this.removeStateListeners();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
export default AppDevModeInterface;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import LocalDevState from './LocalDevState.js';
|
|
2
|
+
import LocalDevLogger from './LocalDevLogger.js';
|
|
3
|
+
type DevServerManagerConstructorOptions = {
|
|
4
|
+
localDevState: LocalDevState;
|
|
5
|
+
logger: LocalDevLogger;
|
|
6
|
+
};
|
|
7
|
+
declare class DevServerManager {
|
|
8
|
+
private initialized;
|
|
9
|
+
private started;
|
|
10
|
+
private devServers;
|
|
11
|
+
constructor(options: DevServerManagerConstructorOptions);
|
|
12
|
+
private iterateDevServers;
|
|
13
|
+
setup(): Promise<void>;
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
fileChange({ filePath, event, }: {
|
|
16
|
+
filePath: string;
|
|
17
|
+
event: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
cleanup(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export default DevServerManager;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import AppDevModeInterface from './AppDevModeInterface.js';
|
|
2
|
+
import { lib } from '../../../lang/en.js';
|
|
3
|
+
import UIExtensionsDevModeInterface from './UIExtensionsDevModeInterface.js';
|
|
4
|
+
class DevServerManager {
|
|
5
|
+
initialized;
|
|
6
|
+
started;
|
|
7
|
+
devServers;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.initialized = false;
|
|
10
|
+
this.started = false;
|
|
11
|
+
const AppsDevServer = new AppDevModeInterface({
|
|
12
|
+
localDevState: options.localDevState,
|
|
13
|
+
localDevLogger: options.logger,
|
|
14
|
+
});
|
|
15
|
+
const UIExtensionsDevServer = new UIExtensionsDevModeInterface({
|
|
16
|
+
localDevState: options.localDevState,
|
|
17
|
+
});
|
|
18
|
+
this.devServers = [AppsDevServer, UIExtensionsDevServer];
|
|
19
|
+
}
|
|
20
|
+
async iterateDevServers(callback) {
|
|
21
|
+
await Promise.all(this.devServers.map(devServer => callback(devServer)));
|
|
22
|
+
}
|
|
23
|
+
async setup() {
|
|
24
|
+
for (const devServer of this.devServers) {
|
|
25
|
+
if (devServer.setup) {
|
|
26
|
+
// Run setup functions in order
|
|
27
|
+
await devServer.setup();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this.initialized = true;
|
|
31
|
+
}
|
|
32
|
+
async start() {
|
|
33
|
+
if (this.initialized) {
|
|
34
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
35
|
+
if (serverInterface.start) {
|
|
36
|
+
await serverInterface.start();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
throw new Error(lib.DevServerManager.notInitialized);
|
|
42
|
+
}
|
|
43
|
+
this.started = true;
|
|
44
|
+
}
|
|
45
|
+
async fileChange({ filePath, event, }) {
|
|
46
|
+
if (this.started) {
|
|
47
|
+
this.iterateDevServers(async (serverInterface) => {
|
|
48
|
+
if (serverInterface.fileChange) {
|
|
49
|
+
await serverInterface.fileChange(filePath, event);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async cleanup() {
|
|
55
|
+
if (this.started) {
|
|
56
|
+
await this.iterateDevServers(async (serverInterface) => {
|
|
57
|
+
if (serverInterface.cleanup) {
|
|
58
|
+
await serverInterface.cleanup();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export default DevServerManager;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProjectConfig, ComponentTypes, Component } from '../../../types/Projects.js';
|
|
2
|
+
type DevServerInterface = {
|
|
3
|
+
setup?: Function;
|
|
4
|
+
start?: (options: object) => Promise<void>;
|
|
5
|
+
fileChange?: (filePath: string, event: string) => Promise<void>;
|
|
6
|
+
cleanup?: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
type ComponentsByType = {
|
|
9
|
+
[key in ComponentTypes]?: {
|
|
10
|
+
[key: string]: Component;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare class DevServerManager_DEPRECATED {
|
|
14
|
+
private initialized;
|
|
15
|
+
private started;
|
|
16
|
+
private componentsByType;
|
|
17
|
+
private devServers;
|
|
18
|
+
constructor();
|
|
19
|
+
iterateDevServers(callback: (serverInterface: DevServerInterface, compatibleComponents: {
|
|
20
|
+
[key: string]: Component;
|
|
21
|
+
}) => Promise<void>): Promise<void>;
|
|
22
|
+
arrangeComponentsByType(components: Component[]): ComponentsByType;
|
|
23
|
+
setup({ components, onUploadRequired, accountId, setActiveApp, }: {
|
|
24
|
+
components: Component[];
|
|
25
|
+
onUploadRequired: () => void;
|
|
26
|
+
accountId: number;
|
|
27
|
+
setActiveApp: (appUid: string | undefined) => Promise<void>;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
start({ accountId, projectConfig, }: {
|
|
30
|
+
accountId: number;
|
|
31
|
+
projectConfig: ProjectConfig;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
fileChange({ filePath, event, }: {
|
|
34
|
+
filePath: string;
|
|
35
|
+
event: string;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
cleanup(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
declare const Manager: DevServerManager_DEPRECATED;
|
|
40
|
+
export default Manager;
|