@hubspot/cli 7.7.21-experimental.0 → 7.7.21-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/__tests__/migrate.test.js +29 -27
- package/api/migrate.js +22 -14
- package/bin/cli.js +101 -92
- package/bin/hs +2 -2
- package/bin/hscms +2 -2
- package/bin/silenceErrors.js +2 -1
- package/commands/__tests__/account.test.js +34 -29
- package/commands/__tests__/auth.test.js +16 -11
- package/commands/__tests__/cms.test.js +20 -15
- package/commands/__tests__/config.test.js +19 -14
- package/commands/__tests__/create.test.js +15 -10
- package/commands/__tests__/customObject.test.js +19 -14
- package/commands/__tests__/doctor.test.js +48 -43
- package/commands/__tests__/feedback.test.js +45 -7
- package/commands/__tests__/fetch.test.js +28 -29
- package/commands/__tests__/filemanager.test.js +19 -14
- package/commands/__tests__/function.test.js +21 -16
- package/commands/__tests__/getStarted.test.js +50 -55
- package/commands/__tests__/hubdb.test.js +22 -17
- package/commands/__tests__/init.test.js +17 -12
- package/commands/__tests__/lint.test.js +18 -13
- package/commands/__tests__/list.test.js +23 -18
- package/commands/__tests__/logs.test.js +27 -28
- package/commands/__tests__/mcp.test.js +19 -14
- package/commands/__tests__/mv.test.js +52 -14
- package/commands/__tests__/open.test.js +51 -13
- package/commands/__tests__/project.test.js +49 -44
- package/commands/__tests__/remove.test.js +51 -13
- package/commands/__tests__/sandbox.test.js +19 -14
- package/commands/__tests__/secret.test.js +21 -16
- package/commands/__tests__/testAccount.test.js +21 -16
- package/commands/__tests__/theme.test.js +20 -15
- package/commands/account/__tests__/auth.test.js +16 -11
- package/commands/account/__tests__/clean.test.js +17 -12
- package/commands/account/__tests__/createOverride.test.js +15 -10
- package/commands/account/__tests__/info.test.js +16 -11
- package/commands/account/__tests__/list.test.js +16 -11
- package/commands/account/__tests__/remove.test.js +18 -13
- package/commands/account/__tests__/removeOverride.js +13 -8
- package/commands/account/__tests__/rename.test.js +20 -15
- package/commands/account/__tests__/use.test.js +15 -10
- package/commands/account/auth.d.ts +1 -1
- package/commands/account/auth.js +67 -65
- package/commands/account/clean.d.ts +1 -1
- package/commands/account/clean.js +60 -55
- package/commands/account/createOverride.d.ts +1 -1
- package/commands/account/createOverride.js +57 -52
- package/commands/account/info.d.ts +1 -1
- package/commands/account/info.js +35 -33
- package/commands/account/list.d.ts +1 -1
- package/commands/account/list.js +45 -43
- package/commands/account/remove.d.ts +1 -1
- package/commands/account/remove.js +42 -37
- package/commands/account/removeOverride.d.ts +1 -1
- package/commands/account/removeOverride.js +43 -38
- package/commands/account/rename.d.ts +1 -1
- package/commands/account/rename.js +20 -18
- package/commands/account/use.d.ts +1 -1
- package/commands/account/use.js +31 -29
- package/commands/account.d.ts +1 -1
- package/commands/account.js +28 -23
- package/commands/app/__tests__/install.test.js +52 -0
- package/commands/app/__tests__/migrate.test.js +34 -29
- package/commands/app/install.d.ts +8 -0
- package/commands/app/install.js +127 -0
- package/commands/app/migrate.d.ts +2 -2
- package/commands/app/migrate.js +43 -40
- package/commands/app/secret/__tests__/add.test.js +11 -6
- package/commands/app/secret/__tests__/delete.test.js +11 -6
- package/commands/app/secret/__tests__/list.test.js +11 -6
- package/commands/app/secret/__tests__/update.test.js +11 -6
- package/commands/app/secret/add.d.ts +1 -1
- package/commands/app/secret/add.js +30 -28
- package/commands/app/secret/delete.d.ts +1 -1
- package/commands/app/secret/delete.js +36 -34
- package/commands/app/secret/list.d.ts +1 -1
- package/commands/app/secret/list.js +27 -25
- package/commands/app/secret/update.d.ts +1 -1
- package/commands/app/secret/update.js +34 -32
- package/commands/app/secret.d.ts +1 -1
- package/commands/app/secret.js +17 -12
- package/commands/app.d.ts +1 -1
- package/commands/app.js +16 -6
- package/commands/auth.d.ts +1 -1
- package/commands/auth.js +72 -70
- package/commands/cms/convertFields.d.ts +1 -1
- package/commands/cms/convertFields.js +39 -34
- package/commands/cms/getReactModule.d.ts +1 -1
- package/commands/cms/getReactModule.js +37 -32
- package/commands/cms/lighthouseScore.d.ts +1 -1
- package/commands/cms/lighthouseScore.js +72 -67
- package/commands/cms.d.ts +1 -1
- package/commands/cms.js +16 -11
- package/commands/completion.d.ts +1 -1
- package/commands/completion.js +15 -10
- package/commands/config/migrate.d.ts +1 -1
- package/commands/config/migrate.js +32 -27
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +25 -23
- package/commands/config.d.ts +1 -1
- package/commands/config.js +13 -8
- package/commands/create/api-sample.d.ts +1 -1
- package/commands/create/api-sample.js +33 -28
- package/commands/create/app.d.ts +1 -1
- package/commands/create/app.js +5 -3
- package/commands/create/function.d.ts +1 -1
- package/commands/create/function.js +11 -9
- package/commands/create/index.d.ts +1 -1
- package/commands/create/index.js +24 -19
- package/commands/create/module.d.ts +1 -1
- package/commands/create/module.js +14 -12
- package/commands/create/react-app.d.ts +1 -1
- package/commands/create/react-app.js +5 -3
- package/commands/create/template.d.ts +1 -1
- package/commands/create/template.js +14 -12
- package/commands/create/vue-app.d.ts +1 -1
- package/commands/create/vue-app.js +5 -3
- package/commands/create/webpack-serverless.d.ts +1 -1
- package/commands/create/webpack-serverless.js +5 -3
- package/commands/create/website-theme.d.ts +1 -1
- package/commands/create/website-theme.js +7 -5
- package/commands/create.d.ts +2 -2
- package/commands/create.js +35 -30
- package/commands/customObject/__tests__/create.test.js +18 -13
- package/commands/customObject/__tests__/schema.test.js +23 -18
- package/commands/customObject/create.d.ts +1 -1
- package/commands/customObject/create.js +30 -28
- package/commands/customObject/schema/__tests__/create.test.js +18 -13
- package/commands/customObject/schema/__tests__/delete.test.js +18 -13
- package/commands/customObject/schema/__tests__/fetch-all.test.js +18 -13
- package/commands/customObject/schema/__tests__/fetch.test.js +18 -13
- package/commands/customObject/schema/__tests__/list.test.js +18 -13
- package/commands/customObject/schema/__tests__/update.test.js +18 -13
- package/commands/customObject/schema/create.d.ts +1 -1
- package/commands/customObject/schema/create.js +30 -28
- package/commands/customObject/schema/delete.d.ts +1 -1
- package/commands/customObject/schema/delete.js +26 -24
- package/commands/customObject/schema/fetch-all.d.ts +1 -1
- package/commands/customObject/schema/fetch-all.js +24 -22
- package/commands/customObject/schema/fetch.d.ts +1 -1
- package/commands/customObject/schema/fetch.js +26 -24
- package/commands/customObject/schema/list.d.ts +1 -1
- package/commands/customObject/schema/list.js +15 -13
- package/commands/customObject/schema/update.d.ts +1 -1
- package/commands/customObject/schema/update.js +34 -32
- package/commands/customObject/schema.d.ts +1 -1
- package/commands/customObject/schema.js +22 -17
- package/commands/customObject.d.ts +1 -1
- package/commands/customObject.js +18 -13
- package/commands/doctor.d.ts +1 -1
- package/commands/doctor.js +33 -28
- package/commands/feedback.d.ts +1 -1
- package/commands/feedback.js +24 -19
- package/commands/fetch.d.ts +1 -1
- package/commands/fetch.js +30 -28
- package/commands/filemanager/__tests__/fetch.test.js +22 -17
- package/commands/filemanager/__tests__/upload.test.js +20 -15
- package/commands/filemanager/fetch.d.ts +1 -1
- package/commands/filemanager/fetch.js +25 -23
- package/commands/filemanager/upload.d.ts +1 -1
- package/commands/filemanager/upload.js +44 -39
- package/commands/filemanager.d.ts +1 -1
- package/commands/filemanager.js +13 -8
- package/commands/function/deploy.d.ts +1 -1
- package/commands/function/deploy.js +40 -35
- package/commands/function/list.d.ts +1 -1
- package/commands/function/list.js +29 -24
- package/commands/function/server.d.ts +1 -1
- package/commands/function/server.js +17 -15
- package/commands/function.d.ts +1 -1
- package/commands/function.js +18 -12
- package/commands/getStarted.d.ts +1 -1
- package/commands/getStarted.js +131 -140
- package/commands/hubdb/__tests__/clear.test.js +18 -13
- package/commands/hubdb/__tests__/create.test.js +18 -13
- package/commands/hubdb/__tests__/delete.test.js +18 -13
- package/commands/hubdb/__tests__/fetch.test.js +18 -13
- package/commands/hubdb/__tests__/list.test.js +28 -23
- package/commands/hubdb/clear.d.ts +1 -1
- package/commands/hubdb/clear.js +22 -20
- package/commands/hubdb/create.d.ts +1 -1
- package/commands/hubdb/create.js +35 -30
- package/commands/hubdb/delete.d.ts +1 -1
- package/commands/hubdb/delete.js +26 -24
- package/commands/hubdb/fetch.d.ts +1 -1
- package/commands/hubdb/fetch.js +19 -17
- package/commands/hubdb/list.d.ts +1 -1
- package/commands/hubdb/list.js +35 -33
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +24 -18
- package/commands/init.d.ts +1 -1
- package/commands/init.js +88 -83
- package/commands/lint.d.ts +1 -1
- package/commands/lint.js +26 -24
- package/commands/list.d.ts +1 -1
- package/commands/list.js +37 -32
- package/commands/logs.d.ts +1 -1
- package/commands/logs.js +37 -35
- package/commands/mcp/__tests__/setup.test.js +12 -7
- package/commands/mcp/__tests__/start.test.js +12 -7
- package/commands/mcp/setup.d.ts +1 -1
- package/commands/mcp/setup.js +20 -17
- package/commands/mcp/start.d.ts +5 -2
- package/commands/mcp/start.js +41 -31
- package/commands/mcp.d.ts +1 -1
- package/commands/mcp.js +12 -7
- package/commands/module/marketplace-validate.d.ts +1 -1
- package/commands/module/marketplace-validate.js +26 -21
- package/commands/module.d.ts +1 -1
- package/commands/module.js +13 -7
- package/commands/mv.d.ts +1 -1
- package/commands/mv.js +22 -20
- package/commands/open.d.ts +1 -1
- package/commands/open.js +21 -19
- package/commands/project/__tests__/add.test.js +15 -10
- package/commands/project/__tests__/create.test.js +19 -14
- package/commands/project/__tests__/deploy.test.js +143 -103
- package/commands/project/__tests__/devUnifiedFlow.test.js +157 -148
- package/commands/project/__tests__/download.test.js +19 -14
- package/commands/project/__tests__/installDeps.test.js +70 -32
- package/commands/project/__tests__/listBuilds.test.js +19 -14
- package/commands/project/__tests__/logs.test.js +94 -56
- package/commands/project/__tests__/migrate.test.js +30 -25
- package/commands/project/__tests__/migrateApp.test.js +22 -17
- package/commands/project/__tests__/open.test.js +21 -16
- package/commands/project/__tests__/profile.test.js +19 -14
- package/commands/project/__tests__/upload.test.js +23 -18
- package/commands/project/__tests__/watch.test.js +19 -14
- package/commands/project/add.d.ts +1 -1
- package/commands/project/add.js +36 -34
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +72 -67
- package/commands/project/create.d.ts +2 -2
- package/commands/project/create.js +68 -63
- package/commands/project/deploy.d.ts +3 -2
- package/commands/project/deploy.js +102 -91
- package/commands/project/dev/deprecatedFlow.d.ts +2 -2
- package/commands/project/dev/deprecatedFlow.js +58 -52
- package/commands/project/dev/index.d.ts +1 -1
- package/commands/project/dev/index.js +47 -44
- package/commands/project/dev/unifiedFlow.d.ts +3 -3
- package/commands/project/dev/unifiedFlow.js +74 -67
- package/commands/project/download.d.ts +1 -1
- package/commands/project/download.js +40 -35
- package/commands/project/installDeps.d.ts +1 -1
- package/commands/project/installDeps.js +34 -29
- package/commands/project/listBuilds.d.ts +1 -1
- package/commands/project/listBuilds.js +45 -40
- package/commands/project/logs.d.ts +1 -1
- package/commands/project/logs.js +54 -52
- package/commands/project/migrate.d.ts +1 -1
- package/commands/project/migrate.js +26 -24
- package/commands/project/migrateApp.d.ts +2 -2
- package/commands/project/migrateApp.js +20 -18
- package/commands/project/open.d.ts +1 -1
- package/commands/project/open.js +30 -25
- package/commands/project/profile/add.d.ts +1 -1
- package/commands/project/profile/add.js +73 -68
- package/commands/project/profile/delete.d.ts +1 -1
- package/commands/project/profile/delete.js +56 -51
- package/commands/project/profile.d.ts +1 -1
- package/commands/project/profile.js +14 -9
- package/commands/project/upload.d.ts +1 -1
- package/commands/project/upload.js +55 -50
- package/commands/project/validate.d.ts +1 -1
- package/commands/project/validate.js +40 -35
- package/commands/project/watch.d.ts +1 -1
- package/commands/project/watch.js +61 -59
- package/commands/project.d.ts +1 -1
- package/commands/project.js +43 -38
- package/commands/remove.d.ts +1 -1
- package/commands/remove.js +17 -15
- package/commands/sandbox/__tests__/create.test.js +20 -15
- package/commands/sandbox/__tests__/delete.test.js +20 -15
- package/commands/sandbox/create.d.ts +1 -1
- package/commands/sandbox/create.js +69 -67
- package/commands/sandbox/delete.d.ts +1 -1
- package/commands/sandbox/delete.js +96 -94
- package/commands/sandbox.d.ts +1 -1
- package/commands/sandbox.js +14 -9
- package/commands/secret/__tests__/addSecret.test.js +18 -13
- package/commands/secret/__tests__/deleteSecret.test.js +18 -13
- package/commands/secret/__tests__/listSecret.test.js +18 -13
- package/commands/secret/__tests__/updateSecret.test.js +18 -13
- package/commands/secret/addSecret.d.ts +1 -1
- package/commands/secret/addSecret.js +28 -26
- package/commands/secret/deleteSecret.d.ts +1 -1
- package/commands/secret/deleteSecret.js +29 -27
- package/commands/secret/listSecret.d.ts +1 -1
- package/commands/secret/listSecret.js +21 -19
- package/commands/secret/updateSecret.d.ts +1 -1
- package/commands/secret/updateSecret.js +27 -25
- package/commands/secret.d.ts +1 -1
- package/commands/secret.js +18 -13
- package/commands/testAccount/__tests__/create.test.js +22 -17
- package/commands/testAccount/__tests__/createConfig.test.js +11 -9
- package/commands/testAccount/__tests__/delete.test.js +20 -15
- package/commands/testAccount/create.d.ts +1 -1
- package/commands/testAccount/create.js +57 -62
- package/commands/testAccount/createConfig.d.ts +1 -3
- package/commands/testAccount/createConfig.js +47 -43
- package/commands/testAccount/delete.d.ts +1 -1
- package/commands/testAccount/delete.js +19 -17
- package/commands/testAccount.d.ts +1 -1
- package/commands/testAccount.js +15 -10
- package/commands/theme/__tests__/generate-selectors.test.js +12 -7
- package/commands/theme/__tests__/marketplace-validate.test.js +19 -14
- package/commands/theme/__tests__/preview.test.js +17 -12
- package/commands/theme/generate-selectors.d.ts +1 -1
- package/commands/theme/generate-selectors.js +28 -23
- package/commands/theme/marketplace-validate.d.ts +1 -1
- package/commands/theme/marketplace-validate.js +24 -19
- package/commands/theme/preview.d.ts +1 -1
- package/commands/theme/preview.js +65 -60
- package/commands/theme.d.ts +1 -1
- package/commands/theme.js +16 -11
- package/commands/upload.d.ts +1 -1
- package/commands/upload.js +82 -77
- package/commands/watch.d.ts +1 -1
- package/commands/watch.js +51 -45
- package/lang/en.d.ts +62 -23
- package/lang/en.js +434 -389
- package/lang/en.lyaml +0 -26
- package/lib/__tests__/accountTypes.test.js +22 -20
- package/lib/__tests__/buildAccount.test.js +90 -27
- package/lib/__tests__/commonOpts.test.js +22 -20
- package/lib/__tests__/dependencyManagement.test.js +51 -46
- package/lib/__tests__/developerTestAccounts.test.js +62 -27
- package/lib/__tests__/hasFeature.test.js +8 -6
- package/lib/__tests__/npm.test.js +20 -15
- package/lib/__tests__/oauth.test.js +28 -23
- package/lib/__tests__/parsing.test.js +20 -18
- package/lib/__tests__/polling.test.js +26 -24
- package/lib/__tests__/process.test.js +19 -14
- package/lib/__tests__/projectProfiles.test.js +39 -34
- package/lib/__tests__/sandboxSync.test.js +35 -30
- package/lib/__tests__/sandboxes.test.js +31 -29
- package/lib/__tests__/serverlessLogs.test.js +13 -8
- package/lib/__tests__/usageTracking.test.js +42 -47
- package/lib/__tests__/validation.test.js +20 -18
- package/lib/__tests__/yargsUtils.test.js +41 -6
- package/lib/accountTypes.js +34 -24
- package/lib/app/__tests__/migrate.test.js +99 -94
- package/lib/app/__tests__/migrate_legacy.test.js +31 -29
- package/lib/app/migrate.d.ts +3 -3
- package/lib/app/migrate.js +145 -127
- package/lib/app/migrate_legacy.d.ts +1 -1
- package/lib/app/migrate_legacy.js +78 -72
- package/lib/app/urls.js +9 -5
- package/lib/buildAccount.d.ts +8 -2
- package/lib/buildAccount.js +119 -61
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +59 -42
- package/lib/configMigrate.js +38 -34
- package/lib/configOptions.js +40 -34
- package/lib/constants.js +34 -31
- package/lib/customObject.js +6 -2
- package/lib/dependencyManagement.js +45 -37
- package/lib/developerTestAccounts.d.ts +1 -1
- package/lib/developerTestAccounts.js +39 -34
- package/lib/doctor/Diagnosis.d.ts +1 -1
- package/lib/doctor/Diagnosis.js +29 -25
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +37 -30
- package/lib/doctor/Doctor.d.ts +1 -1
- package/lib/doctor/Doctor.js +101 -94
- package/lib/doctor/__tests__/Diagnosis.test.js +14 -9
- package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +34 -29
- package/lib/doctor/__tests__/Doctor.test.js +26 -24
- package/lib/enums/exitCodes.js +4 -1
- package/lib/errorHandlers/index.js +41 -32
- package/lib/errorHandlers/suppressError.d.ts +1 -1
- package/lib/errorHandlers/suppressError.js +31 -28
- package/lib/filesystem.js +15 -8
- package/lib/generateSelectors.js +29 -18
- package/lib/hasFeature.d.ts +1 -1
- package/lib/hasFeature.js +6 -3
- package/lib/interpolation.js +18 -11
- package/lib/lang.d.ts +1 -1
- package/lib/lang.js +27 -22
- package/lib/links.js +24 -16
- package/lib/marketplaceValidate.js +39 -29
- package/lib/mcp/setup.js +105 -72
- package/lib/middleware/__test__/configMiddleware.test.js +55 -20
- package/lib/middleware/__test__/gitMiddleware.test.js +42 -7
- package/lib/middleware/__test__/notificationsMiddleware.test.js +4 -2
- package/lib/middleware/__test__/requestMiddleware.test.js +11 -6
- package/lib/middleware/__test__/utils.test.js +11 -9
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +44 -9
- package/lib/middleware/autoUpdateMiddleware.js +40 -33
- package/lib/middleware/configMiddleware.js +42 -36
- package/lib/middleware/fireAlarmMiddleware.js +18 -12
- package/lib/middleware/gitMiddleware.js +8 -5
- package/lib/middleware/notificationsMiddleware.js +23 -16
- package/lib/middleware/requestMiddleware.js +10 -4
- package/lib/middleware/utils.js +4 -1
- package/lib/middleware/yargsChecksMiddleware.js +13 -10
- package/lib/npm.js +23 -14
- package/lib/oauth.js +35 -29
- package/lib/parsing.js +6 -3
- package/lib/polling.js +15 -11
- package/lib/process.js +19 -11
- package/lib/projectProfiles.d.ts +2 -2
- package/lib/projectProfiles.js +42 -32
- package/lib/projects/ProjectLogsManager.js +21 -18
- package/lib/projects/__tests__/AppDevModeInterface.test.js +145 -140
- package/lib/projects/__tests__/LocalDevProcess.test.js +73 -68
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +37 -32
- package/lib/projects/__tests__/ProjectLogsManager.test.js +58 -56
- package/lib/projects/__tests__/buildAndDeploy.test.js +9 -7
- package/lib/projects/__tests__/components.test.js +14 -9
- package/lib/projects/__tests__/projects.test.js +40 -35
- package/lib/projects/__tests__/structure.test.js +81 -43
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +28 -26
- package/lib/projects/add/__tests__/v3AddComponent.test.js +30 -25
- package/lib/projects/add/legacyAddComponent.d.ts +1 -1
- package/lib/projects/add/legacyAddComponent.js +30 -24
- package/lib/projects/add/v3AddComponent.d.ts +1 -1
- package/lib/projects/add/v3AddComponent.js +42 -36
- package/lib/projects/buildAndDeploy.d.ts +1 -1
- package/lib/projects/buildAndDeploy.js +97 -88
- package/lib/projects/components.js +25 -19
- package/lib/projects/config.d.ts +1 -1
- package/lib/projects/config.js +41 -32
- package/lib/projects/create/__tests__/legacy.test.js +57 -22
- package/lib/projects/create/__tests__/v3.test.js +7 -5
- package/lib/projects/create/index.d.ts +3 -3
- package/lib/projects/create/index.js +22 -19
- package/lib/projects/create/legacy.d.ts +1 -1
- package/lib/projects/create/legacy.js +31 -25
- package/lib/projects/create/v3.d.ts +3 -3
- package/lib/projects/create/v3.js +59 -49
- package/lib/projects/ensureProjectExists.js +37 -31
- package/lib/projects/localDev/AppDevModeInterface.d.ts +3 -3
- package/lib/projects/localDev/AppDevModeInterface.js +60 -58
- package/lib/projects/localDev/DevServerManager.d.ts +1 -1
- package/lib/projects/localDev/DevServerManager.js +24 -24
- package/lib/projects/localDev/DevServerManagerV2.d.ts +2 -2
- package/lib/projects/localDev/DevServerManagerV2.js +20 -17
- package/lib/projects/localDev/LocalDevLogger.d.ts +1 -1
- package/lib/projects/localDev/LocalDevLogger.js +64 -59
- package/lib/projects/localDev/LocalDevManager.d.ts +1 -1
- package/lib/projects/localDev/LocalDevManager.js +111 -106
- package/lib/projects/localDev/LocalDevProcess.d.ts +4 -4
- package/lib/projects/localDev/LocalDevProcess.js +30 -25
- package/lib/projects/localDev/LocalDevState.d.ts +3 -3
- package/lib/projects/localDev/LocalDevState.js +5 -3
- package/lib/projects/localDev/LocalDevWatcher.d.ts +1 -1
- package/lib/projects/localDev/LocalDevWatcher.js +11 -6
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +1 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +27 -25
- package/lib/projects/localDev/helpers.d.ts +4 -4
- package/lib/projects/localDev/helpers.js +174 -156
- package/lib/projects/structure.d.ts +4 -4
- package/lib/projects/structure.js +78 -32
- package/lib/projects/ui.js +13 -10
- package/lib/projects/upload.d.ts +3 -2
- package/lib/projects/upload.js +65 -55
- package/lib/projects/urls.js +24 -14
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +54 -48
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +11 -9
- package/lib/prompts/__tests__/projectsLogsPrompt.test.js +16 -11
- package/lib/prompts/accountNamePrompt.d.ts +1 -1
- package/lib/prompts/accountNamePrompt.js +31 -26
- package/lib/prompts/accountsPrompt.js +15 -12
- package/lib/prompts/cmsFieldPrompt.js +19 -13
- package/lib/prompts/createApiSamplePrompt.d.ts +1 -1
- package/lib/prompts/createApiSamplePrompt.js +12 -9
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +11 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +88 -43
- package/lib/prompts/createFunctionPrompt.js +20 -17
- package/lib/prompts/createModulePrompt.js +15 -12
- package/lib/prompts/createTemplatePrompt.js +8 -5
- package/lib/prompts/downloadProjectPrompt.js +20 -17
- package/lib/prompts/installAppPrompt.js +26 -19
- package/lib/prompts/personalAccessKeyPrompt.d.ts +2 -2
- package/lib/prompts/personalAccessKeyPrompt.js +47 -40
- package/lib/prompts/previewPrompt.js +22 -15
- package/lib/prompts/projectAddPrompt.d.ts +1 -1
- package/lib/prompts/projectAddPrompt.js +18 -14
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +54 -48
- package/lib/prompts/projectNameAndDestPrompt.d.ts +1 -1
- package/lib/prompts/projectNameAndDestPrompt.js +29 -22
- package/lib/prompts/projectNamePrompt.js +14 -11
- package/lib/prompts/projectsLogsPrompt.js +8 -5
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/prompts/promptUtils.js +87 -70
- package/lib/prompts/sandboxesPrompt.d.ts +1 -1
- package/lib/prompts/sandboxesPrompt.js +30 -26
- package/lib/prompts/secretPrompt.js +15 -10
- package/lib/prompts/selectAppPrompt.js +14 -11
- package/lib/prompts/selectHubDBTablePrompt.js +30 -24
- package/lib/prompts/selectProjectTemplatePrompt.d.ts +1 -1
- package/lib/prompts/selectProjectTemplatePrompt.js +13 -10
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +25 -22
- package/lib/prompts/setAsDefaultAccountPrompt.js +16 -13
- package/lib/prompts/uploadPrompt.js +17 -11
- package/lib/sandboxSync.d.ts +1 -1
- package/lib/sandboxSync.js +65 -58
- package/lib/sandboxes.d.ts +1 -1
- package/lib/sandboxes.js +76 -68
- package/lib/schema.js +23 -12
- package/lib/serverlessLogs.js +52 -45
- package/lib/testUtils.js +8 -4
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/SpinniesManager.js +34 -29
- package/lib/ui/boxen.js +14 -11
- package/lib/ui/git.js +20 -14
- package/lib/ui/index.js +74 -56
- package/lib/ui/logger.js +13 -10
- package/lib/ui/serverlessFunctionLogs.js +20 -14
- package/lib/ui/spinniesUtils.js +39 -24
- package/lib/ui/supportHyperlinks.js +6 -3
- package/lib/ui/supportsColor.js +17 -11
- package/lib/ui/table.js +13 -6
- package/lib/upload.js +21 -15
- package/lib/usageTracking.d.ts +11 -0
- package/lib/usageTracking.js +95 -95
- package/lib/utils/hasFlag.js +8 -2
- package/lib/validation.js +87 -48
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +16 -13
- package/mcp-server/server.js +8 -6
- package/mcp-server/tools/index.js +16 -13
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +1 -1
- package/mcp-server/tools/project/AddFeatureToProject.js +41 -34
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +52 -45
- package/mcp-server/tools/project/DeployProject.d.ts +1 -1
- package/mcp-server/tools/project/DeployProject.js +24 -17
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +27 -20
- package/mcp-server/tools/project/UploadProjectTools.d.ts +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +21 -11
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +1 -1
- package/mcp-server/tools/project/ValidateProjectTool.js +19 -12
- package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +15 -12
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +16 -13
- package/mcp-server/tools/project/__tests__/DeployProject.test.js +9 -6
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +7 -4
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +7 -4
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +7 -4
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/types.js +5 -1
- package/mcp-server/utils/__tests__/command.test.js +11 -9
- package/mcp-server/utils/__tests__/project.test.js +26 -18
- package/mcp-server/utils/command.d.ts +1 -1
- package/mcp-server/utils/command.js +11 -4
- package/mcp-server/utils/content.d.ts +1 -1
- package/mcp-server/utils/content.js +6 -2
- package/mcp-server/utils/project.js +17 -8
- package/mcp-server/utils/toolUsageTracking.d.ts +1 -0
- package/mcp-server/utils/toolUsageTracking.js +25 -0
- package/package.json +13 -17
- package/types/{cms.d.ts → Cms.d.ts} +1 -1
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +4 -4
- package/types/LocalDev.js +2 -1
- package/types/ProjectComponents.d.ts +2 -2
- package/types/ProjectComponents.js +2 -1
- package/types/Projects.d.ts +1 -1
- package/types/Projects.js +5 -2
- package/types/Prompts.js +2 -1
- package/types/Sandboxes.js +2 -0
- package/types/Yargs.js +2 -1
- package/types/sandboxes.js +0 -1
- /package/{types/cms.js → commands/app/__tests__/install.test.d.ts} +0 -0
- /package/types/{sandboxes.d.ts → Sandboxes.d.ts} +0 -0
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureProjectExists = ensureProjectExists;
|
|
7
|
+
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
8
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
10
|
+
const promptUtils_1 = require("../prompts/promptUtils");
|
|
11
|
+
const exitCodes_1 = require("../enums/exitCodes");
|
|
12
|
+
const ui_1 = require("../ui");
|
|
13
|
+
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
14
|
+
const index_2 = require("../errorHandlers/index");
|
|
15
|
+
const en_1 = require("../../lang/en");
|
|
16
|
+
const logger_1 = require("../ui/logger");
|
|
11
17
|
async function pollFetchProject(accountId, projectName) {
|
|
12
18
|
// Temporary solution for gating slowness. Retry on 403 statusCode
|
|
13
19
|
return new Promise((resolve, reject) => {
|
|
14
20
|
let pollCount = 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
text: lib.projects.pollFetchProject.checkingProject(uiAccountDescription(accountId)),
|
|
21
|
+
SpinniesManager_1.default.init();
|
|
22
|
+
SpinniesManager_1.default.add('pollFetchProject', {
|
|
23
|
+
text: en_1.lib.projects.pollFetchProject.checkingProject((0, ui_1.uiAccountDescription)(accountId)),
|
|
18
24
|
});
|
|
19
25
|
const pollInterval = setInterval(async () => {
|
|
20
26
|
try {
|
|
21
|
-
const response = await fetchProject(accountId, projectName);
|
|
27
|
+
const response = await (0, projects_1.fetchProject)(accountId, projectName);
|
|
22
28
|
if (response && response.data) {
|
|
23
|
-
|
|
29
|
+
SpinniesManager_1.default.remove('pollFetchProject');
|
|
24
30
|
clearInterval(pollInterval);
|
|
25
31
|
resolve(response);
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
catch (err) {
|
|
29
|
-
if (isSpecifiedError(err, {
|
|
35
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
30
36
|
statusCode: 403,
|
|
31
37
|
category: 'GATED',
|
|
32
38
|
subCategory: 'BuildPipelineErrorType.PORTAL_GATED',
|
|
@@ -35,30 +41,30 @@ async function pollFetchProject(accountId, projectName) {
|
|
|
35
41
|
pollCount += 1;
|
|
36
42
|
}
|
|
37
43
|
else {
|
|
38
|
-
|
|
44
|
+
SpinniesManager_1.default.remove('pollFetchProject');
|
|
39
45
|
clearInterval(pollInterval);
|
|
40
46
|
reject(err);
|
|
41
47
|
}
|
|
42
48
|
}
|
|
43
|
-
}, DEFAULT_POLLING_DELAY);
|
|
49
|
+
}, constants_1.DEFAULT_POLLING_DELAY);
|
|
44
50
|
});
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
const accountIdentifier = uiAccountDescription(accountId);
|
|
52
|
+
async function ensureProjectExists(accountId, projectName, { forceCreate = false, allowCreate = true, noLogs = false, withPolling = false, uploadCommand = false, } = {}) {
|
|
53
|
+
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId);
|
|
48
54
|
try {
|
|
49
55
|
const { data: project } = withPolling
|
|
50
56
|
? await pollFetchProject(accountId, projectName)
|
|
51
|
-
: await fetchProject(accountId, projectName);
|
|
57
|
+
: await (0, projects_1.fetchProject)(accountId, projectName);
|
|
52
58
|
return { projectExists: !!project, project };
|
|
53
59
|
}
|
|
54
60
|
catch (err) {
|
|
55
|
-
if (isSpecifiedError(err, { statusCode: 404 })) {
|
|
61
|
+
if ((0, index_1.isSpecifiedError)(err, { statusCode: 404 })) {
|
|
56
62
|
let shouldCreateProject = forceCreate;
|
|
57
63
|
if (allowCreate && !shouldCreateProject) {
|
|
58
64
|
const promptLangFunction = uploadCommand
|
|
59
|
-
? lib.projects.ensureProjectExists.createPromptUpload
|
|
60
|
-
: lib.projects.ensureProjectExists.createPrompt;
|
|
61
|
-
const promptResult = await promptUser([
|
|
65
|
+
? en_1.lib.projects.ensureProjectExists.createPromptUpload
|
|
66
|
+
: en_1.lib.projects.ensureProjectExists.createPrompt;
|
|
67
|
+
const promptResult = await (0, promptUtils_1.promptUser)([
|
|
62
68
|
{
|
|
63
69
|
name: 'shouldCreateProject',
|
|
64
70
|
message: promptLangFunction(projectName, accountIdentifier),
|
|
@@ -69,23 +75,23 @@ export async function ensureProjectExists(accountId, projectName, { forceCreate
|
|
|
69
75
|
}
|
|
70
76
|
if (shouldCreateProject) {
|
|
71
77
|
try {
|
|
72
|
-
const { data: project } = await createProject(accountId, projectName);
|
|
73
|
-
uiLogger.success(lib.projects.ensureProjectExists.createSuccess(projectName, accountIdentifier));
|
|
78
|
+
const { data: project } = await (0, projects_1.createProject)(accountId, projectName);
|
|
79
|
+
logger_1.uiLogger.success(en_1.lib.projects.ensureProjectExists.createSuccess(projectName, accountIdentifier));
|
|
74
80
|
return { projectExists: true, project };
|
|
75
81
|
}
|
|
76
82
|
catch (err) {
|
|
77
|
-
logError(err, new ApiErrorContext({ accountId }));
|
|
83
|
+
(0, index_2.logError)(err, new index_2.ApiErrorContext({ accountId }));
|
|
78
84
|
return { projectExists: false };
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
else {
|
|
82
88
|
if (!noLogs) {
|
|
83
|
-
uiLogger.log(lib.projects.ensureProjectExists.notFound(projectName, accountIdentifier));
|
|
89
|
+
logger_1.uiLogger.log(en_1.lib.projects.ensureProjectExists.notFound(projectName, accountIdentifier));
|
|
84
90
|
}
|
|
85
91
|
return { projectExists: false };
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
|
-
logError(err, new ApiErrorContext({ accountId }));
|
|
89
|
-
process.exit(EXIT_CODES.ERROR);
|
|
94
|
+
(0, index_2.logError)(err, new index_2.ApiErrorContext({ accountId }));
|
|
95
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
90
96
|
}
|
|
91
97
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AppIRNode } from '../../../types/ProjectComponents
|
|
2
|
-
import LocalDevState from './LocalDevState
|
|
3
|
-
import LocalDevLogger from './LocalDevLogger
|
|
1
|
+
import { AppIRNode } from '../../../types/ProjectComponents';
|
|
2
|
+
import LocalDevState from './LocalDevState';
|
|
3
|
+
import LocalDevLogger from './LocalDevLogger';
|
|
4
4
|
type AppDevModeInterfaceConstructorOptions = {
|
|
5
5
|
localDevState: LocalDevState;
|
|
6
6
|
localDevLogger: LocalDevLogger;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
4
|
+
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
5
|
+
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
6
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
7
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
9
|
+
const exitCodes_1 = require("../../enums/exitCodes");
|
|
10
|
+
const structure_1 = require("../../projects/structure");
|
|
11
|
+
const ui_1 = require("../../ui");
|
|
12
|
+
const index_1 = require("../../errorHandlers/index");
|
|
13
|
+
const installAppPrompt_1 = require("../../prompts/installAppPrompt");
|
|
14
|
+
const promptUtils_1 = require("../../prompts/promptUtils");
|
|
15
|
+
const en_1 = require("../../../lang/en");
|
|
16
|
+
const logger_1 = require("../../ui/logger");
|
|
17
|
+
const urls_1 = require("../../app/urls");
|
|
18
|
+
const accountTypes_1 = require("../../accountTypes");
|
|
17
19
|
class AppDevModeInterface {
|
|
18
20
|
localDevState;
|
|
19
21
|
localDevLogger;
|
|
@@ -25,15 +27,15 @@ class AppDevModeInterface {
|
|
|
25
27
|
if (!this.localDevState.targetProjectAccountId ||
|
|
26
28
|
!this.localDevState.projectConfig ||
|
|
27
29
|
!this.localDevState.projectDir) {
|
|
28
|
-
uiLogger.error(lib.LocalDevManager.failedToInitialize);
|
|
29
|
-
process.exit(EXIT_CODES.ERROR);
|
|
30
|
+
logger_1.uiLogger.error(en_1.lib.LocalDevManager.failedToInitialize);
|
|
31
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
// Assumes only one app per project
|
|
33
35
|
get appNode() {
|
|
34
36
|
if (this._appNode === undefined) {
|
|
35
37
|
this._appNode =
|
|
36
|
-
Object.values(this.localDevState.projectNodes).find(isAppIRNode) ||
|
|
38
|
+
Object.values(this.localDevState.projectNodes).find(structure_1.isAppIRNode) ||
|
|
37
39
|
null;
|
|
38
40
|
}
|
|
39
41
|
return this._appNode;
|
|
@@ -51,21 +53,21 @@ class AppDevModeInterface {
|
|
|
51
53
|
this.localDevState.setAppDataForUid(this.appNode.uid, appData);
|
|
52
54
|
}
|
|
53
55
|
isAutomaticallyInstallable() {
|
|
54
|
-
const targetTestingAccount = getAccountConfig(this.localDevState.targetTestingAccountId);
|
|
56
|
+
const targetTestingAccount = (0, config_1.getAccountConfig)(this.localDevState.targetTestingAccountId);
|
|
55
57
|
if (!targetTestingAccount) {
|
|
56
58
|
return false;
|
|
57
59
|
}
|
|
58
|
-
const isTestAccount = isDeveloperTestAccount(targetTestingAccount) ||
|
|
59
|
-
isSandbox(targetTestingAccount);
|
|
60
|
+
const isTestAccount = (0, accountTypes_1.isDeveloperTestAccount)(targetTestingAccount) ||
|
|
61
|
+
(0, accountTypes_1.isSandbox)(targetTestingAccount);
|
|
60
62
|
const hasCorrectParent = targetTestingAccount.parentAccountId ===
|
|
61
63
|
this.localDevState.targetProjectAccountId;
|
|
62
64
|
return (isTestAccount &&
|
|
63
65
|
hasCorrectParent &&
|
|
64
|
-
this.appNode?.config.auth.type === APP_AUTH_TYPES.STATIC);
|
|
66
|
+
this.appNode?.config.auth.type === constants_1.APP_AUTH_TYPES.STATIC);
|
|
65
67
|
}
|
|
66
68
|
async getAppInstallUrl() {
|
|
67
|
-
if (this.appNode?.config.auth.type === APP_AUTH_TYPES.OAUTH) {
|
|
68
|
-
return getOauthAppInstallUrl({
|
|
69
|
+
if (this.appNode?.config.auth.type === constants_1.APP_AUTH_TYPES.OAUTH) {
|
|
70
|
+
return (0, urls_1.getOauthAppInstallUrl)({
|
|
69
71
|
targetAccountId: this.localDevState.targetTestingAccountId,
|
|
70
72
|
env: this.localDevState.env,
|
|
71
73
|
clientId: this.appData.clientId, // This is only called after checking that appData exists
|
|
@@ -73,30 +75,30 @@ class AppDevModeInterface {
|
|
|
73
75
|
redirectUrls: this.appNode.config.auth.redirectUrls,
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
|
-
const { data: { results }, } = await fetchPublicAppsForPortal(this.localDevState.targetProjectAccountId);
|
|
78
|
+
const { data: { results }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.localDevState.targetProjectAccountId);
|
|
77
79
|
const app = results.find(app => app.sourceId === this.appNode?.uid);
|
|
78
80
|
if (!app) {
|
|
79
|
-
uiLogger.error(lib.LocalDevManager.appNotFound(this.localDevState.targetProjectAccountId, this.appNode?.uid));
|
|
80
|
-
process.exit(EXIT_CODES.ERROR);
|
|
81
|
+
logger_1.uiLogger.error(en_1.lib.LocalDevManager.appNotFound(this.localDevState.targetProjectAccountId, this.appNode?.uid));
|
|
82
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
81
83
|
}
|
|
82
|
-
return getStaticAuthAppInstallUrl({
|
|
84
|
+
return (0, urls_1.getStaticAuthAppInstallUrl)({
|
|
83
85
|
targetAccountId: this.localDevState.targetTestingAccountId,
|
|
84
86
|
env: this.localDevState.env,
|
|
85
87
|
appId: app.id,
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
90
|
async fetchAppData() {
|
|
89
|
-
const { data: { results: portalApps }, } = await fetchPublicAppsForPortal(this.localDevState.targetProjectAccountId);
|
|
91
|
+
const { data: { results: portalApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(this.localDevState.targetProjectAccountId);
|
|
90
92
|
const appData = portalApps.find(({ sourceId }) => sourceId === this.appNode?.uid);
|
|
91
93
|
if (!appData) {
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
|
-
const { data: { uniquePortalInstallCount }, } = await fetchPublicAppProductionInstallCounts(appData.id, this.localDevState.targetProjectAccountId);
|
|
96
|
+
const { data: { uniquePortalInstallCount }, } = await (0, appsDev_1.fetchPublicAppProductionInstallCounts)(appData.id, this.localDevState.targetProjectAccountId);
|
|
95
97
|
this.appData = {
|
|
96
98
|
id: appData.id,
|
|
97
99
|
clientId: appData.clientId,
|
|
98
100
|
name: appData.name,
|
|
99
|
-
installationState: APP_INSTALLATION_STATES.NOT_INSTALLED,
|
|
101
|
+
installationState: constants_1.APP_INSTALLATION_STATES.NOT_INSTALLED,
|
|
100
102
|
scopeGroupIds: appData.scopeGroupIds,
|
|
101
103
|
};
|
|
102
104
|
this.marketplaceAppInstalls = uniquePortalInstallCount;
|
|
@@ -105,61 +107,61 @@ class AppDevModeInterface {
|
|
|
105
107
|
if (!this.appData || !this.marketplaceAppInstalls) {
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
108
|
-
uiLine();
|
|
109
|
-
uiLogger.warn(lib.LocalDevManager.activeInstallWarning.installCount(this.appData.name, this.marketplaceAppInstalls));
|
|
110
|
-
uiLogger.log(lib.LocalDevManager.activeInstallWarning.explanation);
|
|
111
|
-
uiLine();
|
|
112
|
-
const proceed = await confirmPrompt(lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
|
|
110
|
+
(0, ui_1.uiLine)();
|
|
111
|
+
logger_1.uiLogger.warn(en_1.lib.LocalDevManager.activeInstallWarning.installCount(this.appData.name, this.marketplaceAppInstalls));
|
|
112
|
+
logger_1.uiLogger.log(en_1.lib.LocalDevManager.activeInstallWarning.explanation);
|
|
113
|
+
(0, ui_1.uiLine)();
|
|
114
|
+
const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.LocalDevManager.activeInstallWarning.confirmationPrompt, { defaultAnswer: false });
|
|
113
115
|
if (!proceed) {
|
|
114
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
116
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
115
117
|
}
|
|
116
|
-
this.localDevLogger.addUploadWarning(lib.AppDevModeInterface.defaultMarketplaceAppWarning(this.marketplaceAppInstalls));
|
|
118
|
+
this.localDevLogger.addUploadWarning(en_1.lib.AppDevModeInterface.defaultMarketplaceAppWarning(this.marketplaceAppInstalls));
|
|
117
119
|
}
|
|
118
120
|
async autoInstallStaticAuthApp() {
|
|
119
|
-
const shouldInstall = await installAppAutoPrompt();
|
|
121
|
+
const shouldInstall = await (0, installAppPrompt_1.installAppAutoPrompt)();
|
|
120
122
|
if (!shouldInstall) {
|
|
121
|
-
uiLogger.log(lib.AppDevModeInterface.autoInstallDeclined);
|
|
122
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
123
|
+
logger_1.uiLogger.log(en_1.lib.AppDevModeInterface.autoInstallDeclined);
|
|
124
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
123
125
|
}
|
|
124
|
-
await installStaticAuthAppOnTestAccount(this.appData.id, this.localDevState.targetTestingAccountId, this.appData.scopeGroupIds);
|
|
126
|
+
await (0, appsDev_1.installStaticAuthAppOnTestAccount)(this.appData.id, this.localDevState.targetTestingAccountId, this.appData.scopeGroupIds);
|
|
125
127
|
}
|
|
126
128
|
async installAppOrOpenInstallUrl(isReinstall) {
|
|
127
129
|
if (this.isAutomaticallyInstallable()) {
|
|
128
130
|
try {
|
|
129
131
|
await this.autoInstallStaticAuthApp();
|
|
130
|
-
uiLogger.success(lib.AppDevModeInterface.autoInstallSuccess(this.appData.name, this.localDevState.targetTestingAccountId));
|
|
132
|
+
logger_1.uiLogger.success(en_1.lib.AppDevModeInterface.autoInstallSuccess(this.appData.name, this.localDevState.targetTestingAccountId));
|
|
131
133
|
return;
|
|
132
134
|
}
|
|
133
135
|
catch (e) {
|
|
134
|
-
uiLogger.error(lib.AppDevModeInterface.autoInstallError(this.appData.name, this.localDevState.targetTestingAccountId));
|
|
136
|
+
logger_1.uiLogger.error(en_1.lib.AppDevModeInterface.autoInstallError(this.appData.name, this.localDevState.targetTestingAccountId));
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
const installUrl = await this.getAppInstallUrl();
|
|
138
|
-
await installAppBrowserPrompt(installUrl, isReinstall);
|
|
140
|
+
await (0, installAppPrompt_1.installAppBrowserPrompt)(installUrl, isReinstall);
|
|
139
141
|
}
|
|
140
142
|
async checkTestAccountAppInstallation() {
|
|
141
143
|
if (!this.appNode || !this.appData) {
|
|
142
144
|
return {};
|
|
143
145
|
}
|
|
144
|
-
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);
|
|
146
|
+
const { data: { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups }, } = await (0, localDevAuth_1.fetchAppInstallationData)(this.localDevState.targetTestingAccountId, this.localDevState.projectId, this.appNode.uid, this.appNode.config.auth.requiredScopes, this.appNode.config.auth.optionalScopes);
|
|
145
147
|
const isReinstall = previouslyAuthorizedScopeGroups.length > 0;
|
|
146
148
|
if (isInstalledWithScopeGroups) {
|
|
147
149
|
this.appData = {
|
|
148
150
|
...this.appData,
|
|
149
|
-
installationState: APP_INSTALLATION_STATES.INSTALLED,
|
|
151
|
+
installationState: constants_1.APP_INSTALLATION_STATES.INSTALLED,
|
|
150
152
|
};
|
|
151
153
|
}
|
|
152
154
|
else if (isReinstall) {
|
|
153
155
|
this.appData = {
|
|
154
156
|
...this.appData,
|
|
155
|
-
installationState: APP_INSTALLATION_STATES.INSTALLED_WITH_OUTDATED_SCOPES,
|
|
157
|
+
installationState: constants_1.APP_INSTALLATION_STATES.INSTALLED_WITH_OUTDATED_SCOPES,
|
|
156
158
|
};
|
|
157
159
|
}
|
|
158
160
|
return { needsInstall: !isInstalledWithScopeGroups, isReinstall };
|
|
159
161
|
}
|
|
160
162
|
setUpLocalDevServerMessageListeners() {
|
|
161
163
|
this.localDevState.addListener('devServerMessage', message => {
|
|
162
|
-
if (message === LOCAL_DEV_SERVER_MESSAGE_TYPES.WEBSOCKET_SERVER_CONNECTED) {
|
|
164
|
+
if (message === constants_1.LOCAL_DEV_SERVER_MESSAGE_TYPES.WEBSOCKET_SERVER_CONNECTED) {
|
|
163
165
|
this.checkTestAccountAppInstallation();
|
|
164
166
|
}
|
|
165
167
|
});
|
|
@@ -172,7 +174,7 @@ class AppDevModeInterface {
|
|
|
172
174
|
}
|
|
173
175
|
try {
|
|
174
176
|
await this.fetchAppData();
|
|
175
|
-
if (this.appNode.config.distribution === APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
177
|
+
if (this.appNode.config.distribution === constants_1.APP_DISTRIBUTION_TYPES.MARKETPLACE) {
|
|
176
178
|
await this.checkMarketplaceAppInstalls();
|
|
177
179
|
}
|
|
178
180
|
const { needsInstall, isReinstall } = await this.checkTestAccountAppInstallation();
|
|
@@ -181,33 +183,33 @@ class AppDevModeInterface {
|
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
catch (e) {
|
|
184
|
-
logError(e);
|
|
186
|
+
(0, index_1.logError)(e);
|
|
185
187
|
}
|
|
186
188
|
this.setUpLocalDevServerMessageListeners();
|
|
187
|
-
return
|
|
189
|
+
return ui_extensions_dev_server_1.DevModeUnifiedInterface.setup(args);
|
|
188
190
|
}
|
|
189
191
|
async start() {
|
|
190
192
|
if (!this.appNode) {
|
|
191
193
|
return;
|
|
192
194
|
}
|
|
193
|
-
return
|
|
195
|
+
return ui_extensions_dev_server_1.DevModeUnifiedInterface.start({
|
|
194
196
|
accountId: this.localDevState.targetTestingAccountId,
|
|
195
197
|
// @ts-expect-error TODO: reconcile types between CLI and UIE Dev Server
|
|
196
198
|
projectConfig: this.localDevState.projectConfig,
|
|
197
|
-
requestPorts,
|
|
199
|
+
requestPorts: portManager_1.requestPorts,
|
|
198
200
|
});
|
|
199
201
|
}
|
|
200
202
|
async fileChange(filePath, event) {
|
|
201
203
|
if (!this.appNode) {
|
|
202
204
|
return;
|
|
203
205
|
}
|
|
204
|
-
return
|
|
206
|
+
return ui_extensions_dev_server_1.DevModeUnifiedInterface.fileChange(filePath, event);
|
|
205
207
|
}
|
|
206
208
|
async cleanup() {
|
|
207
209
|
if (!this.appNode) {
|
|
208
210
|
return;
|
|
209
211
|
}
|
|
210
|
-
return
|
|
212
|
+
return ui_extensions_dev_server_1.DevModeUnifiedInterface.cleanup();
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
|
-
|
|
215
|
+
exports.default = AppDevModeInterface;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
|
+
const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
|
|
5
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
6
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
7
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
|
+
const Projects_1 = require("../../../types/Projects");
|
|
9
|
+
const en_1 = require("../../../lang/en");
|
|
10
|
+
const logger_2 = require("../../ui/logger");
|
|
10
11
|
const SERVER_KEYS = {
|
|
11
12
|
privateApp: 'privateApp',
|
|
12
13
|
publicApp: 'publicApp',
|
|
@@ -22,12 +23,12 @@ class DevServerManager {
|
|
|
22
23
|
this.componentsByType = {};
|
|
23
24
|
this.devServers = {
|
|
24
25
|
[SERVER_KEYS.privateApp]: {
|
|
25
|
-
componentType: ComponentTypes.PrivateApp,
|
|
26
|
-
serverInterface:
|
|
26
|
+
componentType: Projects_1.ComponentTypes.PrivateApp,
|
|
27
|
+
serverInterface: ui_extensions_dev_server_1.DevModeInterface,
|
|
27
28
|
},
|
|
28
29
|
[SERVER_KEYS.publicApp]: {
|
|
29
|
-
componentType: ComponentTypes.PublicApp,
|
|
30
|
-
serverInterface:
|
|
30
|
+
componentType: Projects_1.ComponentTypes.PublicApp,
|
|
31
|
+
serverInterface: ui_extensions_dev_server_1.DevModeInterface,
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -41,7 +42,7 @@ class DevServerManager {
|
|
|
41
42
|
await callback(devServer.serverInterface, compatibleComponents);
|
|
42
43
|
}
|
|
43
44
|
else {
|
|
44
|
-
uiLogger.debug(lib.DevServerManager.noCompatibleComponents(serverKey));
|
|
45
|
+
logger_2.uiLogger.debug(en_1.lib.DevServerManager.noCompatibleComponents(serverKey));
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -59,21 +60,20 @@ class DevServerManager {
|
|
|
59
60
|
async setup({ components, onUploadRequired, accountId, setActiveApp, }) {
|
|
60
61
|
this.componentsByType = this.arrangeComponentsByType(components);
|
|
61
62
|
let env;
|
|
62
|
-
const accountConfig = getAccountConfig(accountId);
|
|
63
|
+
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
63
64
|
if (accountConfig) {
|
|
64
65
|
env = accountConfig.env;
|
|
65
66
|
}
|
|
66
|
-
await startPortManagerServer();
|
|
67
|
+
await (0, portManager_1.startPortManagerServer)();
|
|
67
68
|
await this.iterateDevServers(async (serverInterface, compatibleComponents) => {
|
|
68
69
|
if (serverInterface.setup) {
|
|
69
70
|
await serverInterface.setup({
|
|
70
71
|
components: compatibleComponents,
|
|
71
72
|
onUploadRequired,
|
|
72
|
-
|
|
73
|
-
logger,
|
|
73
|
+
logger: logger_1.logger,
|
|
74
74
|
urls: {
|
|
75
|
-
api: getHubSpotApiOrigin(env),
|
|
76
|
-
web: getHubSpotWebsiteOrigin(env),
|
|
75
|
+
api: (0, urls_1.getHubSpotApiOrigin)(env),
|
|
76
|
+
web: (0, urls_1.getHubSpotWebsiteOrigin)(env),
|
|
77
77
|
},
|
|
78
78
|
setActiveApp,
|
|
79
79
|
});
|
|
@@ -88,13 +88,13 @@ class DevServerManager {
|
|
|
88
88
|
await serverInterface.start({
|
|
89
89
|
accountId,
|
|
90
90
|
projectConfig,
|
|
91
|
-
requestPorts,
|
|
91
|
+
requestPorts: portManager_1.requestPorts,
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
throw new Error(lib.DevServerManager.notInitialized);
|
|
97
|
+
throw new Error(en_1.lib.DevServerManager.notInitialized);
|
|
98
98
|
}
|
|
99
99
|
this.started = true;
|
|
100
100
|
}
|
|
@@ -114,9 +114,9 @@ class DevServerManager {
|
|
|
114
114
|
await serverInterface.cleanup();
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
await stopPortManagerServer();
|
|
117
|
+
await (0, portManager_1.stopPortManagerServer)();
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
const Manager = new DevServerManager();
|
|
122
|
-
|
|
122
|
+
exports.default = Manager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import LocalDevState from './LocalDevState
|
|
2
|
-
import LocalDevLogger from './LocalDevLogger
|
|
1
|
+
import LocalDevState from './LocalDevState';
|
|
2
|
+
import LocalDevLogger from './LocalDevLogger';
|
|
3
3
|
type DevServerManagerV2ConstructorOptions = {
|
|
4
4
|
localDevState: LocalDevState;
|
|
5
5
|
logger: LocalDevLogger;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
8
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
10
|
+
const AppDevModeInterface_1 = __importDefault(require("./AppDevModeInterface"));
|
|
11
|
+
const en_1 = require("../../../lang/en");
|
|
8
12
|
class DevServerManagerV2 {
|
|
9
13
|
initialized;
|
|
10
14
|
started;
|
|
@@ -14,7 +18,7 @@ class DevServerManagerV2 {
|
|
|
14
18
|
this.initialized = false;
|
|
15
19
|
this.started = false;
|
|
16
20
|
this.localDevState = options.localDevState;
|
|
17
|
-
const AppsDevServer = new
|
|
21
|
+
const AppsDevServer = new AppDevModeInterface_1.default({
|
|
18
22
|
localDevState: options.localDevState,
|
|
19
23
|
localDevLogger: options.logger,
|
|
20
24
|
});
|
|
@@ -25,21 +29,20 @@ class DevServerManagerV2 {
|
|
|
25
29
|
}
|
|
26
30
|
async setup() {
|
|
27
31
|
let env;
|
|
28
|
-
const accountConfig = getAccountConfig(this.localDevState.targetTestingAccountId);
|
|
32
|
+
const accountConfig = (0, config_1.getAccountConfig)(this.localDevState.targetTestingAccountId);
|
|
29
33
|
if (accountConfig) {
|
|
30
34
|
env = accountConfig.env;
|
|
31
35
|
}
|
|
32
|
-
await startPortManagerServer();
|
|
36
|
+
await (0, portManager_1.startPortManagerServer)();
|
|
33
37
|
await this.iterateDevServers(async (serverInterface) => {
|
|
34
38
|
if (serverInterface.setup) {
|
|
35
39
|
// @TODO: In the future, update UIE Dev Server to use LocalDevState
|
|
36
40
|
await serverInterface.setup({
|
|
37
41
|
components: this.localDevState.projectNodes,
|
|
38
|
-
|
|
39
|
-
logger,
|
|
42
|
+
logger: logger_1.logger,
|
|
40
43
|
urls: {
|
|
41
|
-
api: getHubSpotApiOrigin(env),
|
|
42
|
-
web: getHubSpotWebsiteOrigin(env),
|
|
44
|
+
api: (0, urls_1.getHubSpotApiOrigin)(env),
|
|
45
|
+
web: (0, urls_1.getHubSpotWebsiteOrigin)(env),
|
|
43
46
|
},
|
|
44
47
|
});
|
|
45
48
|
}
|
|
@@ -55,7 +58,7 @@ class DevServerManagerV2 {
|
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
else {
|
|
58
|
-
throw new Error(lib.DevServerManager.notInitialized);
|
|
61
|
+
throw new Error(en_1.lib.DevServerManager.notInitialized);
|
|
59
62
|
}
|
|
60
63
|
this.started = true;
|
|
61
64
|
}
|
|
@@ -75,8 +78,8 @@ class DevServerManagerV2 {
|
|
|
75
78
|
await serverInterface.cleanup();
|
|
76
79
|
}
|
|
77
80
|
});
|
|
78
|
-
await stopPortManagerServer();
|
|
81
|
+
await (0, portManager_1.stopPortManagerServer)();
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
|
-
|
|
85
|
+
exports.default = DevServerManagerV2;
|