@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,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Doctor_1 = require("../Doctor");
|
|
4
|
+
const dependencyManagement_1 = require("../../dependencyManagement");
|
|
5
|
+
const portManager_1 = require("@hubspot/local-dev-lib/portManager");
|
|
6
|
+
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
7
|
+
const HubSpotHttpError_1 = require("@hubspot/local-dev-lib/models/HubSpotHttpError");
|
|
8
|
+
const axios_1 = require("axios");
|
|
9
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
10
|
+
const util_1 = require("util");
|
|
9
11
|
vi.mock('@hubspot/local-dev-lib/logger');
|
|
10
12
|
vi.mock('../Diagnosis');
|
|
11
13
|
vi.mock('../../ui/SpinniesManager');
|
|
@@ -16,13 +18,13 @@ vi.mock('@hubspot/local-dev-lib/portManager');
|
|
|
16
18
|
vi.mock('@hubspot/local-dev-lib/personalAccessKey');
|
|
17
19
|
vi.mock('@hubspot/local-dev-lib/errors/index');
|
|
18
20
|
vi.mock('util');
|
|
19
|
-
const hasMissingPackages = vi.mocked(
|
|
20
|
-
const isPortManagerPortAvailable = vi.mocked(
|
|
21
|
-
const utilPromisify = vi.mocked(
|
|
22
|
-
const accessTokenForPersonalAccessKey = vi.mocked(
|
|
23
|
-
const authorizedScopesForPortalAndUser = vi.mocked(
|
|
24
|
-
const scopesOnAccessToken = vi.mocked(
|
|
25
|
-
const isSpecifiedError = vi.mocked(
|
|
21
|
+
const hasMissingPackages = vi.mocked(dependencyManagement_1.hasMissingPackages);
|
|
22
|
+
const isPortManagerPortAvailable = vi.mocked(portManager_1.isPortManagerPortAvailable);
|
|
23
|
+
const utilPromisify = vi.mocked(util_1.promisify);
|
|
24
|
+
const accessTokenForPersonalAccessKey = vi.mocked(personalAccessKey_1.accessTokenForPersonalAccessKey);
|
|
25
|
+
const authorizedScopesForPortalAndUser = vi.mocked(personalAccessKey_1.authorizedScopesForPortalAndUser);
|
|
26
|
+
const scopesOnAccessToken = vi.mocked(personalAccessKey_1.scopesOnAccessToken);
|
|
27
|
+
const isSpecifiedError = vi.mocked(index_1.isSpecifiedError);
|
|
26
28
|
describe('lib/doctor/Doctor', () => {
|
|
27
29
|
let doctor;
|
|
28
30
|
// @ts-ignore
|
|
@@ -57,7 +59,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
57
59
|
},
|
|
58
60
|
};
|
|
59
61
|
beforeEach(() => {
|
|
60
|
-
doctor = new Doctor({
|
|
62
|
+
doctor = new Doctor_1.Doctor({
|
|
61
63
|
generateDiagnosticInfo: vi.fn().mockResolvedValue({
|
|
62
64
|
...diagnosticInfo,
|
|
63
65
|
}),
|
|
@@ -83,7 +85,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
83
85
|
});
|
|
84
86
|
});
|
|
85
87
|
it('should add error section if node version is not available', async () => {
|
|
86
|
-
doctor = new Doctor({
|
|
88
|
+
doctor = new Doctor_1.Doctor({
|
|
87
89
|
generateDiagnosticInfo: vi.fn().mockResolvedValue({
|
|
88
90
|
...diagnosticInfo,
|
|
89
91
|
versions: {},
|
|
@@ -97,7 +99,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
97
99
|
});
|
|
98
100
|
});
|
|
99
101
|
it('should add error section if minimum node version is not met', async () => {
|
|
100
|
-
doctor = new Doctor({
|
|
102
|
+
doctor = new Doctor_1.Doctor({
|
|
101
103
|
generateDiagnosticInfo: vi.fn().mockResolvedValue({
|
|
102
104
|
...diagnosticInfo,
|
|
103
105
|
versions: { node: '1.0.0' },
|
|
@@ -121,7 +123,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
121
123
|
});
|
|
122
124
|
});
|
|
123
125
|
it('should add error section if npm is not installed', async () => {
|
|
124
|
-
doctor = new Doctor({
|
|
126
|
+
doctor = new Doctor_1.Doctor({
|
|
125
127
|
generateDiagnosticInfo: vi.fn().mockResolvedValue({
|
|
126
128
|
...diagnosticInfo,
|
|
127
129
|
versions: {},
|
|
@@ -164,7 +166,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
164
166
|
});
|
|
165
167
|
});
|
|
166
168
|
it('should add an error section if it is unable to determine if the portal is active', async () => {
|
|
167
|
-
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError('Invalid token', { cause: new AxiosError() }));
|
|
169
|
+
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError_1.HubSpotHttpError('Invalid token', { cause: new axios_1.AxiosError() }));
|
|
168
170
|
await doctor.diagnose();
|
|
169
171
|
// @ts-expect-error Testing private method
|
|
170
172
|
expect(doctor.diagnosis.addCLIConfigSection).toHaveBeenCalledWith({
|
|
@@ -173,7 +175,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
173
175
|
});
|
|
174
176
|
});
|
|
175
177
|
it('should add an error section if the portal is inactive', async () => {
|
|
176
|
-
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError('Invalid token'));
|
|
178
|
+
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError_1.HubSpotHttpError('Invalid token'));
|
|
177
179
|
isSpecifiedError.mockImplementation((err, fields) => {
|
|
178
180
|
return (fields.statusCode === 401 &&
|
|
179
181
|
fields.category === 'INVALID_AUTHENTICATION' &&
|
|
@@ -188,7 +190,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
188
190
|
});
|
|
189
191
|
});
|
|
190
192
|
it('should add an error section if the portal is not found', async () => {
|
|
191
|
-
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError('Not found'));
|
|
193
|
+
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError_1.HubSpotHttpError('Not found'));
|
|
192
194
|
isSpecifiedError.mockImplementation((err, fields) => {
|
|
193
195
|
return (fields.statusCode === 404 &&
|
|
194
196
|
fields.category === 'INVALID_AUTHENTICATION' &&
|
|
@@ -203,7 +205,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
203
205
|
});
|
|
204
206
|
});
|
|
205
207
|
it('should add multiple sections if token is invalid but the portal is active', async () => {
|
|
206
|
-
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError('Not found'));
|
|
208
|
+
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError_1.HubSpotHttpError('Not found'));
|
|
207
209
|
isSpecifiedError.mockImplementation((err, fields) => {
|
|
208
210
|
return (fields.statusCode === 401 &&
|
|
209
211
|
fields.category === 'INVALID_AUTHENTICATION' &&
|
|
@@ -224,7 +226,7 @@ describe('lib/doctor/Doctor', () => {
|
|
|
224
226
|
});
|
|
225
227
|
});
|
|
226
228
|
it('should add an error section if we are unable to determine if the portal is active', async () => {
|
|
227
|
-
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError('Not found'));
|
|
229
|
+
accessTokenForPersonalAccessKey.mockRejectedValueOnce(new HubSpotHttpError_1.HubSpotHttpError('Not found'));
|
|
228
230
|
isSpecifiedError.mockReturnValue(false);
|
|
229
231
|
await doctor.diagnose();
|
|
230
232
|
// @ts-expect-error Testing private method
|
package/lib/enums/exitCodes.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXIT_CODES = void 0;
|
|
1
4
|
/*
|
|
2
5
|
* 0: Successful run
|
|
3
6
|
* 1: Config problem or internal error
|
|
4
7
|
* 2: Warnings or validation issues
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
exports.EXIT_CODES = {
|
|
7
10
|
SUCCESS: 0,
|
|
8
11
|
ERROR: 1,
|
|
9
12
|
WARNING: 2,
|
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.ApiErrorContext = void 0;
|
|
7
|
+
exports.logError = logError;
|
|
8
|
+
exports.debugError = debugError;
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
11
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
12
|
+
const suppressError_1 = require("./suppressError");
|
|
13
|
+
const lang_1 = require("../lang");
|
|
14
|
+
const util_1 = __importDefault(require("util"));
|
|
15
|
+
const ui_1 = require("../ui");
|
|
16
|
+
function logError(error, context) {
|
|
9
17
|
debugError(error, context);
|
|
10
18
|
if (isProjectValidationError(error)) {
|
|
11
|
-
logger.error(error.message);
|
|
19
|
+
logger_1.logger.error(error.message);
|
|
12
20
|
return;
|
|
13
21
|
}
|
|
14
|
-
if (shouldSuppressError(error, context)) {
|
|
22
|
+
if ((0, suppressError_1.shouldSuppressError)(error, context)) {
|
|
15
23
|
return;
|
|
16
24
|
}
|
|
17
|
-
if (isHubSpotHttpError(error) && 'context' in error) {
|
|
18
|
-
if (shouldSuppressError(error, error.context)) {
|
|
25
|
+
if ((0, index_1.isHubSpotHttpError)(error) && 'context' in error) {
|
|
26
|
+
if ((0, suppressError_1.shouldSuppressError)(error, error.context)) {
|
|
19
27
|
return;
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
|
-
if (isHubSpotHttpError(error) && context) {
|
|
30
|
+
if ((0, index_1.isHubSpotHttpError)(error) && context) {
|
|
23
31
|
error.updateContext(context);
|
|
24
32
|
}
|
|
25
|
-
if (isHubSpotHttpError(error) && isValidationError(error)) {
|
|
26
|
-
logger.error(error.formattedValidationErrors());
|
|
33
|
+
if ((0, index_1.isHubSpotHttpError)(error) && (0, index_1.isValidationError)(error)) {
|
|
34
|
+
logger_1.logger.error(error.formattedValidationErrors());
|
|
27
35
|
}
|
|
28
36
|
else if (isErrorWithMessageOrReason(error)) {
|
|
29
37
|
const message = [];
|
|
@@ -32,47 +40,47 @@ export function logError(error, context) {
|
|
|
32
40
|
message.push(msg);
|
|
33
41
|
}
|
|
34
42
|
});
|
|
35
|
-
logger.error(message.join(' '));
|
|
43
|
+
logger_1.logger.error(message.join(' '));
|
|
36
44
|
}
|
|
37
45
|
else {
|
|
38
46
|
// Unknown errors
|
|
39
|
-
logger.error(i18n(`lib.errorHandlers.index.unknownErrorOccurred`));
|
|
47
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.index.unknownErrorOccurred`));
|
|
40
48
|
}
|
|
41
|
-
if (isHubSpotHttpError(error) && error.code === 'ETIMEDOUT') {
|
|
42
|
-
const config = getConfig();
|
|
49
|
+
if ((0, index_1.isHubSpotHttpError)(error) && error.code === 'ETIMEDOUT') {
|
|
50
|
+
const config = (0, config_1.getConfig)();
|
|
43
51
|
const defaultTimeout = config?.httpTimeout;
|
|
44
52
|
// Timeout was caused by the default timeout
|
|
45
53
|
if (error.timeout && defaultTimeout === error.timeout) {
|
|
46
|
-
logger.error(i18n(`lib.errorHandlers.index.configTimeoutErrorOccurred`, {
|
|
54
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.index.configTimeoutErrorOccurred`, {
|
|
47
55
|
timeout: error.timeout,
|
|
48
|
-
configSetCommand: uiCommandReference('hs config set'),
|
|
56
|
+
configSetCommand: (0, ui_1.uiCommandReference)('hs config set'),
|
|
49
57
|
}));
|
|
50
58
|
}
|
|
51
59
|
// Timeout was caused by a custom timeout set by the CLI or LDL
|
|
52
60
|
else {
|
|
53
|
-
logger.error(i18n(`lib.errorHandlers.index.genericTimeoutErrorOccurred`));
|
|
61
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.index.genericTimeoutErrorOccurred`));
|
|
54
62
|
}
|
|
55
63
|
}
|
|
56
64
|
}
|
|
57
|
-
|
|
58
|
-
if (isHubSpotHttpError(error)) {
|
|
59
|
-
logger.debug(error.toString());
|
|
65
|
+
function debugError(error, context) {
|
|
66
|
+
if ((0, index_1.isHubSpotHttpError)(error)) {
|
|
67
|
+
logger_1.logger.debug(error.toString());
|
|
60
68
|
}
|
|
61
69
|
else {
|
|
62
|
-
logger.debug(i18n(`lib.errorHandlers.index.errorOccurred`, { error: String(error) }));
|
|
70
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.errorHandlers.index.errorOccurred`, { error: String(error) }));
|
|
63
71
|
}
|
|
64
|
-
if (error instanceof Error && error.cause && !isHubSpotHttpError(error)) {
|
|
65
|
-
logger.debug(i18n(`lib.errorHandlers.index.errorCause`, {
|
|
66
|
-
cause:
|
|
72
|
+
if (error instanceof Error && error.cause && !(0, index_1.isHubSpotHttpError)(error)) {
|
|
73
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.errorHandlers.index.errorCause`, {
|
|
74
|
+
cause: util_1.default.inspect(error.cause, false, null, true),
|
|
67
75
|
}));
|
|
68
76
|
}
|
|
69
77
|
if (context) {
|
|
70
|
-
logger.debug(i18n(`lib.errorHandlers.index.errorContext`, {
|
|
71
|
-
context:
|
|
78
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.errorHandlers.index.errorContext`, {
|
|
79
|
+
context: util_1.default.inspect(context, false, null, true),
|
|
72
80
|
}));
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
|
-
|
|
83
|
+
class ApiErrorContext {
|
|
76
84
|
accountId;
|
|
77
85
|
request;
|
|
78
86
|
payload;
|
|
@@ -84,6 +92,7 @@ export class ApiErrorContext {
|
|
|
84
92
|
this.projectName = props.projectName || '';
|
|
85
93
|
}
|
|
86
94
|
}
|
|
95
|
+
exports.ApiErrorContext = ApiErrorContext;
|
|
87
96
|
function isProjectValidationError(error) {
|
|
88
97
|
return error instanceof Error && error.name === 'ProjectValidationError';
|
|
89
98
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApiErrorContext } from './index
|
|
1
|
+
import { ApiErrorContext } from './index';
|
|
2
2
|
export declare function shouldSuppressError(err: unknown, context?: ApiErrorContext): boolean;
|
|
@@ -1,59 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldSuppressError = shouldSuppressError;
|
|
4
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
5
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const lang_1 = require("../lang");
|
|
8
|
+
const ui_1 = require("../ui");
|
|
6
9
|
function createPlatformVersionError(err, subCategory) {
|
|
7
10
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
8
11
|
let platformVersion = 'unspecified platformVersion';
|
|
9
12
|
const errorContext = err?.data?.context;
|
|
10
|
-
if (subCategory === PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED) {
|
|
13
|
+
if (subCategory === constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED) {
|
|
11
14
|
platformVersion = errorContext?.RETIRED_PLATFORM_VERSION ?? platformVersion;
|
|
12
15
|
translationKey = 'platformVersionRetired';
|
|
13
16
|
}
|
|
14
17
|
else if (subCategory ===
|
|
15
|
-
PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST) {
|
|
18
|
+
constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST) {
|
|
16
19
|
platformVersion = errorContext?.PLATFORM_VERSION ?? platformVersion;
|
|
17
20
|
translationKey = 'nonExistentPlatformVersion';
|
|
18
21
|
}
|
|
19
|
-
uiLine();
|
|
20
|
-
logger.error(i18n(`lib.errorHandlers.suppressErrors.platformVersionErrors.header`));
|
|
21
|
-
logger.log(i18n(`lib.errorHandlers.suppressErrors.platformVersionErrors.${translationKey}`, {
|
|
22
|
+
(0, ui_1.uiLine)();
|
|
23
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.header`));
|
|
24
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.${translationKey}`, {
|
|
22
25
|
platformVersion,
|
|
23
26
|
}));
|
|
24
|
-
logger.log(i18n(`lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject`));
|
|
25
|
-
logger.log(i18n(`lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink`, {
|
|
26
|
-
docsLink: uiLink(i18n(`lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink`), 'https://developers.hubspot.com/docs/platform/platform-versioning'),
|
|
27
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.updateProject`));
|
|
28
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.betaLink`, {
|
|
29
|
+
docsLink: (0, ui_1.uiLink)((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.platformVersionErrors.docsLink`), 'https://developers.hubspot.com/docs/platform/platform-versioning'),
|
|
27
30
|
}));
|
|
28
|
-
uiLine();
|
|
31
|
+
(0, ui_1.uiLine)();
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
if (isMissingScopeError(err)) {
|
|
32
|
-
logger.error(i18n(`lib.errorHandlers.suppressErrors.missingScopeError`, {
|
|
33
|
+
function shouldSuppressError(err, context) {
|
|
34
|
+
if ((0, index_1.isMissingScopeError)(err)) {
|
|
35
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.errorHandlers.suppressErrors.missingScopeError`, {
|
|
33
36
|
accountName: context?.accountId
|
|
34
|
-
? uiAccountDescription(context.accountId)
|
|
37
|
+
? (0, ui_1.uiAccountDescription)(context.accountId)
|
|
35
38
|
: '',
|
|
36
39
|
request: context?.request || 'request',
|
|
37
|
-
authCommand: uiCommandReference('hs auth'),
|
|
40
|
+
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
38
41
|
}));
|
|
39
42
|
return true;
|
|
40
43
|
}
|
|
41
|
-
if (isSpecifiedError(err, {
|
|
42
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED,
|
|
44
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
45
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED,
|
|
43
46
|
})) {
|
|
44
|
-
createPlatformVersionError(err, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
|
|
47
|
+
createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_NOT_SPECIFIED);
|
|
45
48
|
return true;
|
|
46
49
|
}
|
|
47
|
-
if (isSpecifiedError(err, {
|
|
48
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED,
|
|
50
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
51
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED,
|
|
49
52
|
})) {
|
|
50
|
-
createPlatformVersionError(err, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
|
|
53
|
+
createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_RETIRED);
|
|
51
54
|
return true;
|
|
52
55
|
}
|
|
53
|
-
if (isSpecifiedError(err, {
|
|
54
|
-
subCategory: PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
|
|
56
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
57
|
+
subCategory: constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST,
|
|
55
58
|
})) {
|
|
56
|
-
createPlatformVersionError(err, PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
|
|
59
|
+
createPlatformVersionError(err, constants_1.PLATFORM_VERSION_ERROR_TYPES.PLATFORM_VERSION_SPECIFIED_DOES_NOT_EXIST);
|
|
57
60
|
return true;
|
|
58
61
|
}
|
|
59
62
|
return false;
|
package/lib/filesystem.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.resolveLocalPath = resolveLocalPath;
|
|
7
|
+
exports.isPathFolder = isPathFolder;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
10
|
+
const extensions_1 = require("@hubspot/local-dev-lib/constants/extensions");
|
|
11
|
+
function resolveLocalPath(filepath) {
|
|
5
12
|
return filepath && typeof filepath === 'string'
|
|
6
|
-
?
|
|
13
|
+
? path_1.default.resolve((0, path_2.getCwd)(), filepath)
|
|
7
14
|
: // Use CWD if optional filepath is not passed.
|
|
8
|
-
getCwd();
|
|
15
|
+
(0, path_2.getCwd)();
|
|
9
16
|
}
|
|
10
|
-
|
|
17
|
+
function isPathFolder(path) {
|
|
11
18
|
const splitPath = path.split('/');
|
|
12
19
|
const fileOrFolderName = splitPath[splitPath.length - 1];
|
|
13
20
|
const splitName = fileOrFolderName.split('.');
|
|
14
21
|
if (splitName.length > 1 &&
|
|
15
|
-
FOLDER_DOT_EXTENSIONS.indexOf(splitName[1]) === -1) {
|
|
22
|
+
extensions_1.FOLDER_DOT_EXTENSIONS.indexOf(splitName[1]) === -1) {
|
|
16
23
|
return false;
|
|
17
24
|
}
|
|
18
25
|
return true;
|
package/lib/generateSelectors.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.getMaxFieldsDepth = getMaxFieldsDepth;
|
|
7
|
+
exports.findFieldsJsonPath = findFieldsJsonPath;
|
|
8
|
+
exports.combineThemeCss = combineThemeCss;
|
|
9
|
+
exports.setPreviewSelectors = setPreviewSelectors;
|
|
10
|
+
exports.generateInheritedSelectors = generateInheritedSelectors;
|
|
11
|
+
exports.generateSelectorsMap = generateSelectorsMap;
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const exitCodes_1 = require("./enums/exitCodes");
|
|
14
|
+
const en_1 = require("../lang/en");
|
|
15
|
+
const logger_1 = require("./ui/logger");
|
|
5
16
|
const CSS_COMMENTS_REGEX = new RegExp(/\/\*.*\*\//, 'g');
|
|
6
17
|
const CSS_PSEUDO_CLASS_REGEX = new RegExp(/:active|:checked|:disabled|:empty|:enabled|:first-of-type|:focus|:hover|:in-range|:invalid|:link|:optional|:out-of-range|:read-only|:read-write|:required|:target|:valid|:visited/, 'g');
|
|
7
18
|
let maxFieldsDepth = 0;
|
|
8
|
-
|
|
19
|
+
function getMaxFieldsDepth() {
|
|
9
20
|
return maxFieldsDepth;
|
|
10
21
|
}
|
|
11
|
-
|
|
22
|
+
function findFieldsJsonPath(basePath) {
|
|
12
23
|
const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
13
|
-
if (!
|
|
14
|
-
uiLogger.error(commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
15
|
-
process.exit(EXIT_CODES.ERROR);
|
|
24
|
+
if (!fs_1.default.existsSync(_path)) {
|
|
25
|
+
logger_1.uiLogger.error(en_1.commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
26
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
16
27
|
}
|
|
17
|
-
const files =
|
|
28
|
+
const files = fs_1.default.readdirSync(_path);
|
|
18
29
|
if (files.includes('fields.json')) {
|
|
19
30
|
return `${_path}/fields.json`;
|
|
20
31
|
}
|
|
21
32
|
for (let i = 0; i < files.length; i++) {
|
|
22
33
|
const fileName = files[i];
|
|
23
|
-
const isDirectory =
|
|
34
|
+
const isDirectory = fs_1.default.lstatSync(`${_path}/${fileName}`).isDirectory();
|
|
24
35
|
if (isDirectory && !fileName.includes('.module')) {
|
|
25
36
|
const fieldsJsonPath = findFieldsJsonPath(`${_path}/${fileName}`);
|
|
26
37
|
if (fieldsJsonPath)
|
|
@@ -29,22 +40,22 @@ export function findFieldsJsonPath(basePath) {
|
|
|
29
40
|
}
|
|
30
41
|
return null;
|
|
31
42
|
}
|
|
32
|
-
|
|
43
|
+
function combineThemeCss(basePath, cssString = '') {
|
|
33
44
|
const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
34
|
-
const isDirectory =
|
|
45
|
+
const isDirectory = fs_1.default.lstatSync(_path).isDirectory();
|
|
35
46
|
if (isDirectory) {
|
|
36
|
-
const filesList =
|
|
47
|
+
const filesList = fs_1.default.readdirSync(_path);
|
|
37
48
|
return filesList.reduce((css, fileName) => {
|
|
38
49
|
const newCss = combineThemeCss(`${_path}/${fileName}`);
|
|
39
50
|
return newCss ? `${css}\n${newCss}` : css;
|
|
40
51
|
}, cssString);
|
|
41
52
|
}
|
|
42
53
|
else if (_path.includes('.css') && !_path.includes('.module')) {
|
|
43
|
-
return `${cssString}\n${
|
|
54
|
+
return `${cssString}\n${fs_1.default.readFileSync(_path, 'utf8')}`;
|
|
44
55
|
}
|
|
45
56
|
return null;
|
|
46
57
|
}
|
|
47
|
-
|
|
58
|
+
function setPreviewSelectors(fields, fieldPath, selectors, depth = 0) {
|
|
48
59
|
fields.forEach((field, index) => {
|
|
49
60
|
if (field.name === fieldPath[0]) {
|
|
50
61
|
if (field.children && fieldPath.length > 0) {
|
|
@@ -70,7 +81,7 @@ export function setPreviewSelectors(fields, fieldPath, selectors, depth = 0) {
|
|
|
70
81
|
});
|
|
71
82
|
return fields;
|
|
72
83
|
}
|
|
73
|
-
|
|
84
|
+
function generateInheritedSelectors(fields) {
|
|
74
85
|
let finalFieldsJson = [...fields];
|
|
75
86
|
function _generateInheritedSelectors(fieldsToCheck) {
|
|
76
87
|
fieldsToCheck.forEach(field => {
|
|
@@ -92,7 +103,7 @@ export function generateInheritedSelectors(fields) {
|
|
|
92
103
|
_generateInheritedSelectors(fields);
|
|
93
104
|
return finalFieldsJson;
|
|
94
105
|
}
|
|
95
|
-
|
|
106
|
+
function generateSelectorsMap(fields, fieldKey = []) {
|
|
96
107
|
let selectorsMap = {};
|
|
97
108
|
fields.forEach(field => {
|
|
98
109
|
const { children, name, selectors } = field;
|
package/lib/hasFeature.d.ts
CHANGED
package/lib/hasFeature.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasFeature = hasFeature;
|
|
4
|
+
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
5
|
+
async function hasFeature(accountId, feature) {
|
|
6
|
+
const { data: { enabledFeatures }, } = await (0, localDevAuth_1.fetchEnabledFeatures)(accountId);
|
|
4
7
|
return Boolean(enabledFeatures[feature]);
|
|
5
8
|
}
|
package/lib/interpolation.js
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.helpers = void 0;
|
|
7
|
+
exports.interpolate = interpolate;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
exports.helpers = {
|
|
3
10
|
bold: function (stringValue) {
|
|
4
|
-
return
|
|
11
|
+
return chalk_1.default.bold(stringValue);
|
|
5
12
|
},
|
|
6
13
|
yellow: function (stringValue) {
|
|
7
|
-
return
|
|
14
|
+
return chalk_1.default.reset.yellow(stringValue);
|
|
8
15
|
},
|
|
9
16
|
green: function (stringValue) {
|
|
10
|
-
return
|
|
17
|
+
return chalk_1.default.reset.green(stringValue);
|
|
11
18
|
},
|
|
12
19
|
red: function (stringValue) {
|
|
13
|
-
return
|
|
20
|
+
return chalk_1.default.reset.red(stringValue);
|
|
14
21
|
},
|
|
15
22
|
cyan: function (stringValue) {
|
|
16
|
-
return
|
|
23
|
+
return chalk_1.default.cyan(stringValue);
|
|
17
24
|
},
|
|
18
25
|
orange: function (stringValue) {
|
|
19
|
-
return
|
|
26
|
+
return chalk_1.default.hex('#FC9900')(stringValue);
|
|
20
27
|
},
|
|
21
28
|
};
|
|
22
29
|
const delimiters = {
|
|
@@ -73,11 +80,11 @@ function compileHelper(stringValue, helperIdentifier, helperFn) {
|
|
|
73
80
|
return compiledString;
|
|
74
81
|
}
|
|
75
82
|
function compileHelpers(stringValue) {
|
|
76
|
-
return Object.keys(helpers).reduce((currentStringValue, helperIdentifier) => {
|
|
77
|
-
return compileHelper(currentStringValue, helperIdentifier, helpers[helperIdentifier]);
|
|
83
|
+
return Object.keys(exports.helpers).reduce((currentStringValue, helperIdentifier) => {
|
|
84
|
+
return compileHelper(currentStringValue, helperIdentifier, exports.helpers[helperIdentifier]);
|
|
78
85
|
}, stringValue);
|
|
79
86
|
}
|
|
80
|
-
|
|
87
|
+
function interpolate(stringValue, interpolationData) {
|
|
81
88
|
const interpolatedString = interpolation(stringValue, interpolationData);
|
|
82
89
|
const helperCompiledString = compileHelpers(interpolatedString);
|
|
83
90
|
return helperCompiledString;
|
package/lib/lang.d.ts
CHANGED