@zuplo/cli 6.60.21 → 6.60.23
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/dist/__tests__/engine.test.js.map +1 -1
- package/dist/__tests__/import-openapi-utils.test.js.map +1 -1
- package/dist/__tests__/integration/jest-setup.js.map +1 -1
- package/dist/__tests__/integration/test-utils.d.ts.map +1 -1
- package/dist/__tests__/integration/test-utils.js.map +1 -1
- package/dist/__tests__/outdated.test.js.map +1 -1
- package/dist/__tests__/populate.test.js.map +1 -1
- package/dist/__tests__/tsconfig-upgrader.test.js.map +1 -1
- package/dist/build/handler.d.ts.map +1 -1
- package/dist/build/handler.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/cmds/source/migrate/runner.d.ts.map +1 -1
- package/dist/cmds/source/migrate/runner.js.map +1 -1
- package/dist/cmds/source/migrate/types.d.ts.map +1 -1
- package/dist/cmds/source/migrate/types.js.map +1 -1
- package/dist/common/alias.d.ts.map +1 -1
- package/dist/common/alias.js.map +1 -1
- package/dist/common/analytics/lib.d.ts.map +1 -1
- package/dist/common/analytics/lib.js.map +1 -1
- package/dist/common/handler.d.ts.map +1 -1
- package/dist/common/handler.js.map +1 -1
- package/dist/common/logger.d.ts.map +1 -1
- package/dist/common/logger.js.map +1 -1
- package/dist/common/machine-id/lib.js.map +1 -1
- package/dist/common/middleware/get-account-param.d.ts.map +1 -1
- package/dist/common/middleware/get-account-param.js.map +1 -1
- package/dist/common/middleware/get-environment-param.js +1 -1
- package/dist/common/middleware/get-environment-param.js.map +1 -1
- package/dist/common/middleware/get-project-param.js.map +1 -1
- package/dist/common/middleware/logging.d.ts.map +1 -1
- package/dist/common/middleware/logging.js.map +1 -1
- package/dist/common/middleware/user-configuration.d.ts.map +1 -1
- package/dist/common/middleware/user-configuration.js.map +1 -1
- package/dist/common/middleware/user-identification.d.ts.map +1 -1
- package/dist/common/middleware/user-identification.js.map +1 -1
- package/dist/common/middleware/validate-fleet.d.ts.map +1 -1
- package/dist/common/middleware/validate-fleet.js.map +1 -1
- package/dist/common/outdated.d.ts.map +1 -1
- package/dist/common/outdated.js.map +1 -1
- package/dist/common/output.d.ts.map +1 -1
- package/dist/common/output.js.map +1 -1
- package/dist/common/settings.d.ts.map +1 -1
- package/dist/common/settings.js +4 -4
- package/dist/common/settings.js.map +1 -1
- package/dist/common/upgraders/vscode-settings-json-upgrader.js.map +1 -1
- package/dist/common/utils/box.js.map +1 -1
- package/dist/common/utils/ports.d.ts.map +1 -1
- package/dist/common/utils/ports.js.map +1 -1
- package/dist/common/validators/file-system-validator.d.ts.map +1 -1
- package/dist/common/validators/file-system-validator.js.map +1 -1
- package/dist/common/validators/lib.d.ts +1 -1
- package/dist/common/validators/lib.d.ts.map +1 -1
- package/dist/common/validators/lib.js.map +1 -1
- package/dist/common/worker-output.d.ts.map +1 -1
- package/dist/common/worker-output.js.map +1 -1
- package/dist/common/xdg/lib.d.ts.map +1 -1
- package/dist/common/xdg/lib.js.map +1 -1
- package/dist/compile/handler.d.ts.map +1 -1
- package/dist/compile/handler.js.map +1 -1
- package/dist/convert/engine.d.ts.map +1 -1
- package/dist/convert/engine.js.map +1 -1
- package/dist/delete/handler.js +1 -1
- package/dist/delete/handler.js.map +1 -1
- package/dist/delete/poll-deployment.d.ts.map +1 -1
- package/dist/delete/poll-deployment.js +0 -1
- package/dist/delete/poll-deployment.js.map +1 -1
- package/dist/deploy/archive.js +1 -1
- package/dist/deploy/archive.js.map +1 -1
- package/dist/deploy/handler.js +3 -3
- package/dist/deploy/handler.js.map +1 -1
- package/dist/deploy/poll-deployment.d.ts.map +1 -1
- package/dist/deploy/poll-deployment.js +8 -14
- package/dist/deploy/poll-deployment.js.map +1 -1
- package/dist/dev/handler.d.ts.map +1 -1
- package/dist/dev/handler.js.map +1 -1
- package/dist/editor/server/cors-plugin.js.map +1 -1
- package/dist/editor/server/server.d.ts.map +1 -1
- package/dist/editor/server/server.js.map +1 -1
- package/dist/editor/server/xfs.js +2 -2
- package/dist/editor/server/xfs.js.map +1 -1
- package/dist/list/handler.d.ts.map +1 -1
- package/dist/list/handler.js.map +1 -1
- package/dist/login/login.d.ts.map +1 -1
- package/dist/login/login.js +1 -1
- package/dist/login/login.js.map +1 -1
- package/dist/login/tokens.d.ts.map +1 -1
- package/dist/login/tokens.js.map +1 -1
- package/dist/project/create/handler.d.ts.map +1 -1
- package/dist/project/create/handler.js.map +1 -1
- package/dist/proxies/create/handler.d.ts.map +1 -1
- package/dist/proxies/create/handler.js.map +1 -1
- package/dist/proxies/delete/handler.d.ts.map +1 -1
- package/dist/proxies/delete/handler.js.map +1 -1
- package/dist/proxies/describe/handler.d.ts.map +1 -1
- package/dist/proxies/describe/handler.js.map +1 -1
- package/dist/proxies/update/handler.d.ts.map +1 -1
- package/dist/proxies/update/handler.js.map +1 -1
- package/dist/source/import-openapi/ajv.d.ts +34 -0
- package/dist/source/import-openapi/ajv.d.ts.map +1 -0
- package/dist/source/import-openapi/ajv.js +2 -0
- package/dist/source/import-openapi/ajv.js.map +1 -0
- package/dist/source/import-openapi/handler.js +2 -2
- package/dist/source/import-openapi/handler.js.map +1 -1
- package/dist/source/import-openapi/interfaces.d.ts +1 -1
- package/dist/source/import-openapi/interfaces.d.ts.map +1 -1
- package/dist/source/import-openapi/interfaces.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tunnel/create/handler.d.ts.map +1 -1
- package/dist/tunnel/create/handler.js.map +1 -1
- package/dist/tunnel/delete/handler.d.ts.map +1 -1
- package/dist/tunnel/delete/handler.js.map +1 -1
- package/dist/tunnel/delete/poll-teardown-operation.d.ts.map +1 -1
- package/dist/tunnel/delete/poll-teardown-operation.js.map +1 -1
- package/dist/tunnel/describe/handler.d.ts.map +1 -1
- package/dist/tunnel/describe/handler.js.map +1 -1
- package/dist/tunnel/list/handler.d.ts.map +1 -1
- package/dist/tunnel/list/handler.js.map +1 -1
- package/dist/tunnel/models.js.map +1 -1
- package/dist/tunnel/rotate-token/handler.d.ts.map +1 -1
- package/dist/tunnel/rotate-token/handler.js.map +1 -1
- package/dist/tunnel/services/describe/handler.d.ts.map +1 -1
- package/dist/tunnel/services/describe/handler.js.map +1 -1
- package/dist/tunnel/services/update/handler.d.ts.map +1 -1
- package/dist/tunnel/services/update/handler.js.map +1 -1
- package/dist/tunnel/services/update/poll-provisioning-operations.d.ts.map +1 -1
- package/dist/tunnel/services/update/poll-provisioning-operations.js.map +1 -1
- package/dist/variable/create/handler.d.ts.map +1 -1
- package/dist/variable/create/handler.js +1 -1
- package/dist/variable/create/handler.js.map +1 -1
- package/dist/variable/update/handler.d.ts.map +1 -1
- package/dist/variable/update/handler.js +1 -1
- package/dist/variable/update/handler.js.map +1 -1
- package/package.json +4 -4
- package/zup.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/common/analytics/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/common/analytics/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAqBjD,IAAI,QAA6B,CAAC;AAElC,SAAS,IAAI;IAEX,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ,GAAG,IAAI,OAAO,CAAC,oBAAoB,EAAE;QAC3C,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,CAAC;QACV,aAAa,EAAE,CAAC;KACjB,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EACjC,IAAI,EACJ,KAAK,EACL,UAAU,E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;AAC9B,CAAC","sourcesContent":["import { PostHog } from \"posthog-node\";\nimport { POST_HOG_CAPTURE_KEY, ZUPLO_USER_ID_ARGV_KEY } from \"../constants.js\";\nimport { machineId } from \"../machine-id/lib.js\";\n\ninterface IdentifyMessageV1 {\n distinctId: string;\n // biome-ignore lint/suspicious/noExplicitAny: Migrated from ESLint\n properties?: Record<string | number, any>;\n disableGeoip?: boolean;\n}\n\ninterface EventMessageV1 extends IdentifyMessageV1 {\n event: string;\n groups?: Record<string, string | number>;\n sendFeatureFlags?: boolean;\n timestamp?: Date;\n}\n\ninterface ZuploEventMessage extends Omit<EventMessageV1, \"distinctId\"> {\n // biome-ignore lint/suspicious/noExplicitAny: Migrated from ESLint\n argv: any;\n}\n\nlet _postHog: PostHog | undefined;\n\nfunction init(): PostHog | undefined {\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n if (process.env.ZUPLO_DO_NOT_TRACK) {\n return undefined;\n }\n\n _postHog = new PostHog(POST_HOG_CAPTURE_KEY, {\n host: \"https://app.posthog.com\",\n flushAt: 1,\n flushInterval: 1,\n });\n\n return _postHog;\n}\n\n// A convenience wrapper so that callers do not have to inject the distincId for each call to capture\nexport async function captureEvent({\n argv,\n event,\n properties,\n groups,\n sendFeatureFlags,\n timestamp,\n disableGeoip,\n}: ZuploEventMessage): Promise<void> {\n if (_postHog === undefined) {\n init();\n }\n\n if (_postHog) {\n properties = properties ?? {};\n properties.$set_once = properties.$set_once ?? {};\n\n // Set information about the user\n if (\n argv[ZUPLO_USER_ID_ARGV_KEY] &&\n typeof argv[ZUPLO_USER_ID_ARGV_KEY] === \"string\"\n ) {\n properties.$set_once[\"user-id\"] = argv[ZUPLO_USER_ID_ARGV_KEY];\n }\n if (argv.account && typeof argv.account === \"string\") {\n properties.$set_once[\"account\"] = argv[\"account\"];\n }\n if (argv.project && typeof argv.project === \"string\") {\n properties.$set_once[\"project\"] = argv[\"project\"];\n }\n\n // Nice to have: set information if this is in CI\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n if (process.env.CI) {\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n properties[\"ci\"] = process.env.CI;\n }\n\n _postHog?.capture({\n distinctId: (argv[ZUPLO_USER_ID_ARGV_KEY] as string) || machineId(),\n event,\n properties,\n groups,\n sendFeatureFlags,\n timestamp,\n disableGeoip,\n });\n }\n}\n\nexport async function shutdownAnalytics(): Promise<void> {\n return _postHog?.shutdown();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/common/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/common/handler.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,SAG3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/common/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/common/handler.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY;IAE1B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["export function groupHandler() {\n // biome-ignore lint/suspicious/noConsole: User output\n console.log(\"Run with --help to see available commands\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,eAAO,IAAI,MAAM,6BAGf,CAAC;AAGH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,IAAI,CAAC,uBAAuB,CAAA;CAAE,QAK5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/common/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,MAAM,CAAC,IAAI,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;IAE5B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,QAAQ;CACnD,CAAC,CAAC;AAGH,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAA2C;IAC3E,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC;QAEjB,KAAK,EAAE,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB;KAChD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as Pino from \"pino\";\n\n// Initialize the logger with a default level\nexport let logger = Pino.pino({\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n level: process.env.ZUPLO_CLI_LOG_LEVEL || \"silent\",\n});\n\n// Create a new logger once we call the init function\nexport function initLogger({ level }: { level: Pino.LevelWithSilentOrString }) {\n logger = Pino.pino({\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n level: level ?? process.env.ZUPLO_CLI_LOG_LEVEL,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/common/machine-id/lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/common/machine-id/lib.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE,oDAAoD;CAC5D,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AQ,EAAE;iBACV,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;iBAC5B,WAAW,EAAE,CAAC;QACnB;YACE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjE,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QACnE;YACE,OAAO,sCAAsC,CAAC;IAClD,CAAC;AACH,CAAC","sourcesContent":["/**\n * node-machine-id\n * Copyright (c) 2016 Aleksandr Komlev\n * MIT Licensed\n *\n * From https://github.com/automation-stack/node-machine-id\n */\nimport { execSync } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\n\nconst win32RegBinPath = {\n skipped: \"\",\n native: \"%windir%\\\\System32\",\n mixed: \"%windir%\\\\sysnative\\\\cmd.exe /c %windir%\\\\System32\",\n};\nconst guid = {\n darwin: \"ioreg -rd1 -c IOPlatformExpertDevice\",\n win32:\n `${\n win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]\n }\\\\REG.exe ` +\n \"QUERY HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Cryptography \" +\n \"/v MachineGuid\",\n linux:\n \"( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :\",\n};\n\nfunction isWindowsProcessMixedOrNativeArchitecture():\n | \"skipped\"\n | \"mixed\"\n | \"native\" {\n // detect if the node binary is the same arch as the Windows OS.\n // or if this is 32 bit node on 64 bit windows.\n if (process.platform !== \"win32\") {\n return \"skipped\";\n }\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n if (process.arch === \"ia32\" && process.env[\"PROCESSOR_ARCHITEW6432\"]) {\n return \"mixed\";\n }\n return \"native\";\n}\n\nfunction hash(guid: string): string {\n return createHash(\"sha256\").update(guid).digest(\"hex\");\n}\n\nfunction expose(result: string): string {\n switch (process.platform) {\n case \"darwin\":\n return result\n .split(\"IOPlatformUUID\")[1]\n .split(\"\\n\")[0]\n .replace(/=|\\s+]\"/gi, \"\")\n .toLowerCase();\n case \"win32\":\n return result\n .toString()\n .split(\"REG_SZ\")[1]\n .replace(/\\r+|\\n+|\\s+/gi, \"\")\n .toLowerCase();\n case \"linux\":\n return result\n .toString()\n .replace(/\\r+|\\n+|\\s+/gi, \"\")\n .toLowerCase();\n case \"freebsd\":\n return result\n .toString()\n .replace(/\\r+|\\n+|\\s+/gi, \"\")\n .toLowerCase();\n default:\n throw new Error(`Unsupported platform: ${process.platform}`);\n }\n}\n\nexport function machineId(): string {\n switch (process.platform) {\n case \"darwin\":\n case \"win32\":\n case \"linux\":\n return hash(expose(execSync(guid[process.platform]).toString()));\n default:\n return \"e16fc483-5593-4d71-b485-a6533693da9b\";\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-account-param.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/get-account-param.ts"],"names":[],"mappings":"AAYA,wBAAsB,YAAY,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"get-account-param.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/get-account-param.ts"],"names":[],"mappings":"AAYA,wBAAsB,YAAY,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,iBA4DlE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-account-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-account-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAStC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAgC;IACjE,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,QAAQ,CAAC,4BAA4B,cAAc,EACtD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"get-account-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-account-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAStC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAgC;IACjE,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,QAAQ,CAAC,4BAA4B,cAAc,EACtD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YAEP,aAAa,EAAE,UAAU,IAAI,CAAC,SAAS,EAAE;SAC1C;KACF,CAC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ClD,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { select } from \"@inquirer/prompts\";\nimport { logger } from \"../logger.js\";\nimport { printCriticalFailureToConsoleAndExit, textOrJson } from \"../output.js\";\nimport settings from \"../settings.js\";\n\n/**\n * Middleware that ensures an account is provided in argv. If not, prompts the user.\n *\n * NOTE: This middleware MUST come after the authenticate middleware\n * because the authenticate middleware gets the account if the user is\n * authenticating with an API key.\n */\nexport async function fetchAccount(argv: { [key: string]: unknown }) {\n if (argv.account && typeof argv.account === \"string\") {\n return;\n }\n // In the case where the user supplied an api-key, they don't need to supply an account.\n if (argv[\"api-key\"]) {\n return;\n }\n // Make a call to the API key\n const response = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts`,\n {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (response.ok) {\n const accountsJson: { data: { name: string }[] } = await response.json();\n\n try {\n argv.account = await select({\n message: \"Select the account\",\n choices: accountsJson.data\n .map((acc) => {\n return {\n name: acc.name,\n value: acc.name,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)),\n });\n } catch (error) {\n if (error.isTtyError || error.name === \"ExitPromptError\") {\n process.exit(0);\n }\n logger.trace(\"Failed to select account\", error);\n process.exit(1);\n }\n } else {\n if (response.status === 404) {\n await printCriticalFailureToConsoleAndExit(\n \"You don't have a Zuplo account. Create one at https://zuplo.com and try again.\"\n );\n }\n logger.trace(\n {\n status: response.status,\n statusText: response.statusText,\n response: textOrJson(await response.text()),\n },\n \"Failed to request accounts for user\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to request accounts for the user.\"\n );\n }\n}\n"]}
|
|
@@ -97,7 +97,7 @@ async function getGitBranch(argv) {
|
|
|
97
97
|
"--contains",
|
|
98
98
|
branchCommit.current,
|
|
99
99
|
]);
|
|
100
|
-
if (branchRef
|
|
100
|
+
if (branchRef?.all?.[0]) {
|
|
101
101
|
const originBranch = branchRef.all[0];
|
|
102
102
|
const cleanOriginBranch = originBranch.replace(/^origin\//, "");
|
|
103
103
|
if (!cleanOriginBranch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-environment-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-environment-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAM3F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAgC;IACrE,IAAI,IAAI,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAID,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAExC,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAE1C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,GAAG,QAAQ,C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AS,EAAE,CAAC;YAEd,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YACD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAI/B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;gBAEtB,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBAE3B,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC9C,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC;oBACjC,IAAI;oBACJ,YAAY;oBACZ,YAAY,CAAC,OAAO;iBACrB,CAAC,CAAC;gBACH,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnD,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACtC,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;oBAChE,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;oBACJ,CAAC;oBACD,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { select } from \"@inquirer/prompts\";\nimport { simpleGit } from \"simple-git\";\nimport { Environment } from \"../api/lib.js\";\nimport { logger } from \"../logger.js\";\nimport { printCriticalFailureToConsoleAndExit, textOrJson } from \"../output.js\";\nimport settings from \"../settings.js\";\nimport { prettyPrintEnvironmentPrompt } from \"../utils/pretty-print-environment-prompt.js\";\n\n/**\n * Middleware that ensures a environment is provided in argv. If not, prompts the user.\n * Note: must be called after get account param and get project param.\n */\nexport async function fetchEnvironment(argv: { [key: string]: unknown }) {\n if (argv.environment && typeof argv.environment === \"string\") {\n return;\n }\n\n if (!argv.account || typeof argv.account !== \"string\") {\n throw new Error(\"Invalid state: account is not set.\");\n }\n if (!argv.project || typeof argv.project !== \"string\") {\n throw new Error(\"Invalid state: project is not set.\");\n }\n\n // 1. Check if the dir argument is set and if we are in a git repository\n // If we are, get the current branch and use that as the environment name.\n const branch = await getGitBranch(argv);\n\n if (branch && !argv[\"fetch-environments\"]) {\n // If the branch is set, use that as the environment name\n argv.environment = branch;\n } else {\n const baseUrl = `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments`;\n\n const queryParams: Record<string, string> = {\n // This is safe because of the previous middleware where we set the account and project.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n accountName: argv.account!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n projectName: argv.project!,\n };\n\n // Create the query string using URLSearchParams\n const url = new URL(baseUrl);\n url.search = new URLSearchParams(queryParams).toString();\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${argv.authToken}`,\n },\n });\n\n if (response.ok) {\n const environmentJsonFromDeveloperAPI = (await response.json()) as {\n data: Environment[];\n };\n\n if (environmentJsonFromDeveloperAPI.data.length === 0) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: You don't have any preview or production environments for this project to link against. First, deploy this project using zuplo deploy and then link against that.\"\n );\n }\n\n // TODO: This logic doesn't work for working copies anymore due to\n // https://github.com/zuplo/core/blob/main/apps/tenant-api/prisma/migrations/v2_20250711155424_add-working-copy-main-check/migration.sql\n // and https://github.com/zuplo/core/blob/6595268b9d2e5edfb3a20cbb086ccd363cf115f9/apps/tenant-api/src/routes/managed-dedicated/environments.ts#L96-L102\n // Leaving this logic commented out for now since we may want to bring it back.\n // let numDevelopmentEnvironments =\n // environmentJsonFromDeveloperAPI.data.filter((env) => {\n // return env.environmentType === \"development\";\n // }).length;\n\n // if (numDevelopmentEnvironments <= 0) {\n // // Create one on-the-fly\n // const createDevelopmenEnvironmentResponse = await fetch(`${baseUrl}`, {\n // method: \"POST\",\n // headers: {\n // authorization: `Bearer ${argv.authToken}`,\n // \"Content-Type\": \"application/json\",\n // },\n // body: JSON.stringify({\n // accountName: argv.account,\n // projectName: argv.project,\n // environmentType: \"development\",\n // }),\n // });\n\n // if (!createDevelopmenEnvironmentResponse.ok) {\n // console.log(await createDevelopmenEnvironmentResponse.json());\n // logger.debug(\n // {\n // status: createDevelopmenEnvironmentResponse.status,\n // statusText: createDevelopmenEnvironmentResponse.statusText,\n // },\n // \"Failed to create a new instance of development environment\"\n // );\n // await printCriticalFailureToConsoleAndExit(\n // \"Failed to create a new development environment. Please try again later.\"\n // );\n // }\n\n // numDevelopmentEnvironments++;\n\n // // Re-fetch\n // const updatedResponse = await fetch(url, {\n // headers: {\n // authorization: `Bearer ${argv.authToken}`,\n // },\n // });\n\n // environmentJsonFromDeveloperAPI = (await updatedResponse.json()) as {\n // data: Environment[];\n // };\n // }\n\n const environments = environmentJsonFromDeveloperAPI.data\n .map((env) => {\n return {\n [prettyPrintEnvironmentPrompt(\n env,\n // TODO: This is hard coded to false for now while we figure out the UX for linking working copies.\n // This is because working copy linking is broken right now.\n false\n )]: env.name,\n };\n })\n .reduce((acc, curr) => {\n return { ...acc, ...curr };\n });\n\n try {\n argv.environment = await select({\n message: \"Select the environment\",\n choices: Object.entries(environments)\n .map(([key, value]) => {\n return {\n name: key,\n value: value,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)),\n });\n } catch (error) {\n if (error.isTtyError || error.name === \"ExitPromptError\") {\n process.exit(0);\n }\n logger.trace(\"Failed to select account\", error);\n process.exit(1);\n }\n } else {\n logger.trace(\n {\n status: response.status,\n statusText: response.statusText,\n response: textOrJson(await response.text()),\n },\n \"Failed to request environments for project\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to request environments for the project.\"\n );\n }\n }\n}\nasync function getGitBranch(argv: { [key: string]: unknown }) {\n let branch: string | undefined;\n const dir = argv.dir;\n if (dir && typeof dir === \"string\") {\n const git = simpleGit({ baseDir: dir });\n const isGitRepo = await git.checkIsRepo();\n if (isGitRepo) {\n // Get the current branch from Git\n const status = await git.status();\n if (!status.current) {\n throw new Error(\"Invalid state: Directory is in detached head state.\");\n }\n branch = status.current.trim();\n\n // @NOTE - gitlab returns HEAD as the current branch when running git.status()\n // https://forum.gitlab.com/t/why-i-cant-get-the-branch-name/72462/6\n if (branch === \"HEAD\") {\n // Fetch remote branches to ensure the latest information\n await git.fetch([\"--all\"]);\n\n const branchCommit = await git.branch([\"-a\"]);\n const branchRef = await git.branch([\n \"-r\",\n \"--contains\",\n branchCommit.current,\n ]);\n if (branchRef && branchRef.all && branchRef.all[0]) {\n const originBranch = branchRef.all[0];\n const cleanOriginBranch = originBranch.replace(/^origin\\//, \"\");\n if (!cleanOriginBranch) {\n throw new Error(\n \"Invalid state: Directory is in detached head state.\"\n );\n }\n branch = cleanOriginBranch.trim();\n }\n }\n }\n }\n return branch;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"get-environment-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-environment-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAM3F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAgC;IACrE,IAAI,IAAI,C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G,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACxB,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBACtC,MAAM,iBAAiB,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;oBAChE,IAAI,CAAC,iBAAiB,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;oBACJ,CAAC;oBACD,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC;gBACpC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { select } from \"@inquirer/prompts\";\nimport { simpleGit } from \"simple-git\";\nimport { Environment } from \"../api/lib.js\";\nimport { logger } from \"../logger.js\";\nimport { printCriticalFailureToConsoleAndExit, textOrJson } from \"../output.js\";\nimport settings from \"../settings.js\";\nimport { prettyPrintEnvironmentPrompt } from \"../utils/pretty-print-environment-prompt.js\";\n\n/**\n * Middleware that ensures a environment is provided in argv. If not, prompts the user.\n * Note: must be called after get account param and get project param.\n */\nexport async function fetchEnvironment(argv: { [key: string]: unknown }) {\n if (argv.environment && typeof argv.environment === \"string\") {\n return;\n }\n\n if (!argv.account || typeof argv.account !== \"string\") {\n throw new Error(\"Invalid state: account is not set.\");\n }\n if (!argv.project || typeof argv.project !== \"string\") {\n throw new Error(\"Invalid state: project is not set.\");\n }\n\n // 1. Check if the dir argument is set and if we are in a git repository\n // If we are, get the current branch and use that as the environment name.\n const branch = await getGitBranch(argv);\n\n if (branch && !argv[\"fetch-environments\"]) {\n // If the branch is set, use that as the environment name\n argv.environment = branch;\n } else {\n const baseUrl = `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/environments`;\n\n const queryParams: Record<string, string> = {\n // This is safe because of the previous middleware where we set the account and project.\n accountName: argv.account!,\n projectName: argv.project!,\n };\n\n // Create the query string using URLSearchParams\n const url = new URL(baseUrl);\n url.search = new URLSearchParams(queryParams).toString();\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${argv.authToken}`,\n },\n });\n\n if (response.ok) {\n const environmentJsonFromDeveloperAPI = (await response.json()) as {\n data: Environment[];\n };\n\n if (environmentJsonFromDeveloperAPI.data.length === 0) {\n await printCriticalFailureToConsoleAndExit(\n \"Error: You don't have any preview or production environments for this project to link against. First, deploy this project using zuplo deploy and then link against that.\"\n );\n }\n\n // TODO: This logic doesn't work for working copies anymore due to\n // https://github.com/zuplo/core/blob/main/apps/tenant-api/prisma/migrations/v2_20250711155424_add-working-copy-main-check/migration.sql\n // and https://github.com/zuplo/core/blob/6595268b9d2e5edfb3a20cbb086ccd363cf115f9/apps/tenant-api/src/routes/managed-dedicated/environments.ts#L96-L102\n // Leaving this logic commented out for now since we may want to bring it back.\n // let numDevelopmentEnvironments =\n // environmentJsonFromDeveloperAPI.data.filter((env) => {\n // return env.environmentType === \"development\";\n // }).length;\n\n // if (numDevelopmentEnvironments <= 0) {\n // // Create one on-the-fly\n // const createDevelopmenEnvironmentResponse = await fetch(`${baseUrl}`, {\n // method: \"POST\",\n // headers: {\n // authorization: `Bearer ${argv.authToken}`,\n // \"Content-Type\": \"application/json\",\n // },\n // body: JSON.stringify({\n // accountName: argv.account,\n // projectName: argv.project,\n // environmentType: \"development\",\n // }),\n // });\n\n // if (!createDevelopmenEnvironmentResponse.ok) {\n // console.log(await createDevelopmenEnvironmentResponse.json());\n // logger.debug(\n // {\n // status: createDevelopmenEnvironmentResponse.status,\n // statusText: createDevelopmenEnvironmentResponse.statusText,\n // },\n // \"Failed to create a new instance of development environment\"\n // );\n // await printCriticalFailureToConsoleAndExit(\n // \"Failed to create a new development environment. Please try again later.\"\n // );\n // }\n\n // numDevelopmentEnvironments++;\n\n // // Re-fetch\n // const updatedResponse = await fetch(url, {\n // headers: {\n // authorization: `Bearer ${argv.authToken}`,\n // },\n // });\n\n // environmentJsonFromDeveloperAPI = (await updatedResponse.json()) as {\n // data: Environment[];\n // };\n // }\n\n const environments = environmentJsonFromDeveloperAPI.data\n .map((env) => {\n return {\n [prettyPrintEnvironmentPrompt(\n env,\n // TODO: This is hard coded to false for now while we figure out the UX for linking working copies.\n // This is because working copy linking is broken right now.\n false\n )]: env.name,\n };\n })\n .reduce((acc, curr) => {\n // biome-ignore lint/performance/noAccumulatingSpread: Migrated from ESLint\n return { ...acc, ...curr };\n });\n\n try {\n argv.environment = await select({\n message: \"Select the environment\",\n choices: Object.entries(environments)\n .map(([key, value]) => {\n return {\n name: key,\n value: value,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)),\n });\n } catch (error) {\n if (error.isTtyError || error.name === \"ExitPromptError\") {\n process.exit(0);\n }\n logger.trace(\"Failed to select account\", error);\n process.exit(1);\n }\n } else {\n logger.trace(\n {\n status: response.status,\n statusText: response.statusText,\n response: textOrJson(await response.text()),\n },\n \"Failed to request environments for project\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to request environments for the project.\"\n );\n }\n }\n}\nasync function getGitBranch(argv: { [key: string]: unknown }) {\n let branch: string | undefined;\n const dir = argv.dir;\n if (dir && typeof dir === \"string\") {\n const git = simpleGit({ baseDir: dir });\n const isGitRepo = await git.checkIsRepo();\n if (isGitRepo) {\n // Get the current branch from Git\n const status = await git.status();\n if (!status.current) {\n throw new Error(\"Invalid state: Directory is in detached head state.\");\n }\n branch = status.current.trim();\n\n // @NOTE - gitlab returns HEAD as the current branch when running git.status()\n // https://forum.gitlab.com/t/why-i-cant-get-the-branch-name/72462/6\n if (branch === \"HEAD\") {\n // Fetch remote branches to ensure the latest information\n await git.fetch([\"--all\"]);\n\n const branchCommit = await git.branch([\"-a\"]);\n const branchRef = await git.branch([\n \"-r\",\n \"--contains\",\n branchCommit.current,\n ]);\n if (branchRef?.all?.[0]) {\n const originBranch = branchRef.all[0];\n const cleanOriginBranch = originBranch.replace(/^origin\\//, \"\");\n if (!cleanOriginBranch) {\n throw new Error(\n \"Invalid state: Directory is in detached head state.\"\n );\n }\n branch = cleanOriginBranch.trim();\n }\n }\n }\n }\n return branch;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-project-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAMhE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAgC;IACjE,IAAI,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,QAAQ,CAAC,4BAA4B,cAAc,CAAC;IACvE,MAAM,WAAW,GAA2B;
|
|
1
|
+
{"version":3,"file":"get-project-param.js","sourceRoot":"","sources":["../../../src/common/middleware/get-project-param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oCAAoC,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,QAAQ,MAA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AAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,MAAM,oCAAoC,CACxC,iHAAiH,CAClH,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,KAAK,CACV;YACE,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,QAAQ,EAAE,UAAU,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;SAC5C,EACD,wCAAwC,CACzC,CAAC;QACF,MAAM,oCAAoC,CACxC,oDAAoD,CACrD,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { select, input } from \"@inquirer/prompts\";\nimport { logger } from \"../logger.js\";\nimport { printCriticalFailureToConsoleAndExit, textOrJson } from \"../output.js\";\nimport settings from \"../settings.js\";\nimport { readFile } from \"node:fs/promises\";\nimport { createProject } from \"../../project/create/handler.js\";\n\n/**\n * Middleware that ensures a project is provided in argv. If not, prompts the user.\n * Note: must be called after get account param.\n */\nexport async function fetchProject(argv: { [key: string]: unknown }) {\n if (argv.project && typeof argv.project === \"string\") {\n return;\n }\n\n if (!argv.account || typeof argv.account !== \"string\") {\n throw new Error(\"Invalid state: account is not set.\");\n }\n\n const baseUrl = `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/projects`;\n const queryParams: Record<string, string> = {\n // This is safe because of the previous middleware where we set the account.\n accountName: argv.account!,\n };\n\n // Create the query string using URLSearchParams\n const url = new URL(baseUrl);\n url.search = new URLSearchParams(queryParams).toString();\n\n // Make a call to the API key\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${argv.authToken}`,\n },\n });\n\n if (response.ok) {\n const projectsJson: { data: { name: string }[] } = await response.json();\n if (projectsJson.data.length === 0) {\n let projectName: string | undefined;\n try {\n const packageJson = JSON.parse(await readFile(\"package.json\", \"utf-8\"));\n projectName = packageJson.name;\n } catch (error) {\n logger.trace(\"Failed to read package.json\", error);\n }\n const outputProjectName = await input({\n message:\n \"You don't have any projects configured for this account. Please enter a project name to create one.\",\n default: projectName,\n });\n\n await createProject({\n name: outputProjectName,\n account: argv.account,\n authToken: argv.authToken as string,\n });\n argv.project = outputProjectName;\n logger.trace(`Project ${outputProjectName} created successfully.`);\n } else {\n try {\n argv.project = await select({\n message: \"Select the project\",\n choices: projectsJson.data\n .map((project) => {\n return {\n name: project.name,\n value: project.name,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)),\n });\n } catch (error) {\n if (error.isTtyError || error.name === \"ExitPromptError\") {\n process.exit(0);\n }\n logger.trace(\"Failed to select project\", error);\n process.exit(1);\n }\n }\n } else {\n if (response.status === 404) {\n await printCriticalFailureToConsoleAndExit(\n \"You don't have any projects configured for this account. Create a project in the Zuplo dashboard and try again.\"\n );\n }\n logger.trace(\n {\n status: response.status,\n statusText: response.statusText,\n response: textOrJson(await response.text()),\n },\n \"Failed to request projects for account\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to request projects for the account.\"\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/logging.ts"],"names":[],"mappings":"AAEA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/logging.ts"],"names":[],"mappings":"AAEA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,iBAcxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/common/middleware/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/common/middleware/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAA0B;IACvD,MAAM,KAAK,GACT,IAAI,CAAC,OAAO,KAAK,CAAC;QAChB,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC;YAClB,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC;gBAClB,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,QAAQ,CAAC;IACnB,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QAEtB,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC;IAClC,CAAC;IACD,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import { initLogger } from \"../logger.js\";\n\nexport async function logLevel(argv: { verbose?: number }) {\n const level =\n argv.verbose === 1\n ? \"warn\"\n : argv.verbose === 2\n ? \"info\"\n : argv.verbose === 3\n ? \"debug\"\n : \"silent\";\n if (level === \"debug\") {\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n process.env.ZENO_DEBUG = \"true\";\n }\n initLogger({ level });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-configuration.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AA6BA,wBAAsB,SAAS,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"user-configuration.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AA6BA,wBAAsB,SAAS,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,iBAoD/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-configuration.js","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EACL,oCAAoC,EACpC,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAgBtC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAgC;IAI9D,MAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;IAG/C,MAAM,cAAc,GAAG,MAAM,KAAK,CAChC,GAAG,QAAQ,CAAC,4BAA4B,cAAc,EACtD;QACE,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"user-configuration.js","sourceRoot":"","sources":["../../../src/common/middleware/user-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAc,KAAK,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM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AC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, relative } from \"node:path\";\nimport { ParseError, parse } from \"jsonc-parser\";\nimport {\n ZUPLO_FALLBACK_JSON_FILE,\n ZUPLO_PREFERRED_JSON_FILE,\n} from \"../constants.js\";\nimport { logger } from \"../logger.js\";\nimport {\n printCriticalFailureToConsoleAndExit,\n printWarningToConsole,\n} from \"../output.js\";\nimport settings from \"../settings.js\";\n\n/**\n * This is the middleware to set the context for the CLI calls.\n *\n * It can be used to set sensible configurations such as account and project that are gotten from the API, zuplo.jsonc, --parameters\n *\n * The order of setting a configuration is\n * 1. API key\n * 2. zuplo.jsonc\n * 3. --parameters from the CLI invocation\n *\n * Note that --parameters objects can also come from .env file because of https://yargs.js.org/docs/#api-reference-envprefix\n *\n * @param argv - The yargs object\n */\nexport async function configure(argv: { [key: string]: unknown }) {\n // Clone the original value (for merging at the end)\n // The original is the most specific since it can only contain things from --parameters\n // It will always be applied last to override anything from zuplo.jsonc or the API key\n const cliParametersConfiguration = { ...argv };\n\n // Make a call to the API key\n const whoAmIResponse = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/who-am-i`,\n {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${argv.authToken}`,\n },\n }\n );\n\n if (whoAmIResponse.ok) {\n // Note that the algorithms below are based on \"addition\"\n // You cannot unset/remove a value from the configuration by setting it to null/undefined\n // Do be mindful of parameters that might be the same value since things might be overridden\n\n // Merge any non-null values from the API key\n const apiKeyMetadata = await whoAmIResponse.json();\n\n // The API key metadata response contains the account.\n Object.assign(argv, omitNull(apiKeyMetadata));\n\n // Merge any non-null values from zuplo.jsonc\n // For now, only merge project since zuplo.jsonc could have many keys that might conflict\n const { project: zuploJsoncProject } = await processZuploConfigurationFile(\n argv.dir as string | undefined\n );\n if (zuploJsoncProject) {\n printWarningToConsole(\n \"The project name in zuplo.jsonc is deprecated. Please remove the project key from zuplo.jsonc and use the --project flag or ZUPLO_PROJECT environment variable instead.\"\n );\n argv.project = zuploJsoncProject;\n }\n\n // Merge any non-null values from --parameters\n Object.assign(argv, cliParametersConfiguration);\n } else {\n logger.trace(\n { status: whoAmIResponse.status, statusText: whoAmIResponse.statusText },\n \"Failed to determine who-am-i\"\n );\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to validate the API key. Check your API key.\"\n );\n }\n}\n\nasync function processZuploConfigurationFile(\n sourceDirectory: string | undefined\n) {\n const normalizedDir = join(relative(process.cwd(), sourceDirectory ?? \".\"));\n const preferredPath = join(normalizedDir, ZUPLO_PREFERRED_JSON_FILE);\n const fallbackPath = join(normalizedDir, ZUPLO_FALLBACK_JSON_FILE);\n let fileContents = \"{}\";\n if (existsSync(preferredPath)) {\n fileContents = await readFile(preferredPath, \"utf-8\");\n } else if (existsSync(fallbackPath)) {\n fileContents = await readFile(fallbackPath, \"utf-8\");\n } else {\n logger.trace(\"No zuplo.jsonc file found\");\n return {};\n }\n\n // If we get here, we have a zuplo.jsonc (or, zuplo.json) file\n // That means we should report any issues with it.\n const errors: ParseError[] = [];\n const data = parse(fileContents, errors, { allowTrailingComma: true });\n if (errors.length > 0) {\n logger.trace(errors[0], \"Failed to parse zuplo.jsonc\");\n await printCriticalFailureToConsoleAndExit(\n \"Error: Failed to parse the values from zuplo.jsonc. Check your zuplo.jsonc file.\"\n );\n }\n return data;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: Migrated from ESLint\nconst omitNull = (obj: any) => {\n Object.keys(obj)\n .filter((k) => obj[k] === null)\n .forEach((k) => delete obj[k]);\n return obj;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-identification.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/user-identification.ts"],"names":[],"mappings":"AASA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"user-identification.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/user-identification.ts"],"names":[],"mappings":"AASA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,iBAsC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-identification.js","sourceRoot":"","sources":["../../../src/common/middleware/user-identification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAgC;
|
|
1
|
+
{"version":3,"file":"user-identification.js","sourceRoot":"","sources":["../../../src/common/middleware/user-identification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,oBAAoB,E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"@sentry/node\";\nimport * as jose from \"jose\";\nimport { ZUPLO_AUTH_FILE_NAME } from \"../constants.js\";\nimport { logger } from \"../logger.js\";\nimport { machineId } from \"../machine-id/lib.js\";\nimport { ZUPLO_XDG_STATE_HOME } from \"../xdg/lib.js\";\n\nexport async function identify(argv: { [key: string]: unknown }) {\n // 0. Respect GDPR and allow user to stop-tracking\n\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n if (process.env.ZUPLO_DO_NOT_TRACK) {\n logger.trace(\"Sentry traces will be sent without user identification.\");\n } else {\n // We will supplement any Sentry errors with user information\n let userId;\n\n // 1. Read from the result of `zuplo link` (if it exists)\n try {\n const rawAuth = await readFile(\n join(ZUPLO_XDG_STATE_HOME, ZUPLO_AUTH_FILE_NAME),\n \"utf-8\"\n );\n const authJson = JSON.parse(rawAuth);\n const decoded = jose.decodeJwt(authJson.access_token);\n userId = decoded.sub;\n } catch {\n // 2. Else generate an id from the machine\n userId = machineId();\n }\n\n // 4. Add information to sentry\n // 4a. Always use the machine id as the primary id so that we can relate events when the user is logged in or logged out\n Sentry.setUser({ id: machineId() });\n // 4b. If we have more information about the identity of the user, we can add it as tags\n Sentry.setTag(\"user-id\", userId);\n if (argv.account && typeof argv.account === \"string\") {\n Sentry.setTag(\"account\", argv.account);\n }\n if (argv.project && typeof argv.project === \"string\") {\n Sentry.setTag(\"project\", argv.project);\n }\n // 5. Now that we have identified the user, set it in argv for others to use\n argv[\"zuplo-user-id\"] = userId;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-fleet.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/validate-fleet.ts"],"names":[],"mappings":"AAUA,wBAAsB,aAAa,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"validate-fleet.d.ts","sourceRoot":"","sources":["../../../src/common/middleware/validate-fleet.ts"],"names":[],"mappings":"AAUA,wBAAsB,aAAa,CAAC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,iBAuEnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-fleet.js","sourceRoot":"","sources":["../../../src/common/middleware/validate-fleet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAQtC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAgC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAiB,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;IACnC,MAAM,SAAS,GAAG,IAAI,CAAC,SAAmB,CAAC;IAE3C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,yBAAyB,CAAC,8CAA8C,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC7D,yBAAyB,CAAC,4CAA4C,CAAC,CAAC;QACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,KAAK,CAC/B,GAAG,QAAQ,CAAC,4BAA4B,gBAAgB,OAAO,WAAW,KAAK,EAAE,EACjF;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"validate-fleet.js","sourceRoot":"","sources":["../../../src/common/midd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AC,CAAC;YACxD,MAAM,CAAC,KAAK,CACV;gBACE,MAAM,EAAE,aAAa,CAAC,MAAM;gBAC5B,UAAU,EAAE,aAAa,CAAC,UAAU;gBACpC,QAAQ;aACT,EACD,sBAAsB,CACvB,CAAC;YACF,yBAAyB,CACvB,iBAAiB,KAAK,iCAAiC,OAAO,IAAI,CACnE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAGD,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CACV;YACE,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,UAAU,EAAE,aAAa,CAAC,UAAU;YACpC,QAAQ;SACT,EACD,oCAAoC,CACrC,CAAC;QACF,yBAAyB,CACvB,uFAAuF,EACvF,QAAQ,CACT,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,sCAAsC,CAAC,CAAC;QAChE,yBAAyB,CACvB,wDAAwD,CACzD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC","sourcesContent":["import { logger } from \"../logger.js\";\nimport { printDiagnosticsToConsole, textOrJson } from \"../output.js\";\nimport settings from \"../settings.js\";\n\n/**\n * Middleware that validates a fleet exists for the given account.\n *\n * NOTE: This middleware MUST come after the authenticate middleware\n * because it needs the authToken to make API calls.\n */\nexport async function validateFleet(argv: { [key: string]: unknown }) {\n const account = argv.account as string;\n const fleet = argv.fleet as string;\n const authToken = argv.authToken as string;\n\n if (!account || typeof account !== \"string\") {\n logger.error(\"Missing or invalid required parameter: account\");\n printDiagnosticsToConsole(\"Error: Missing required parameter 'account'.\");\n process.exit(1);\n }\n\n if (!fleet || typeof fleet !== \"string\") {\n logger.error(\"Missing or invalid required parameter: fleet\");\n printDiagnosticsToConsole(\"Error: Missing required parameter 'fleet'.\");\n process.exit(1);\n }\n\n try {\n const fleetResponse = await fetch(\n `${settings.ZUPLO_DEVELOPER_API_ENDPOINT}/v1/accounts/${account}/fleets/${fleet}`,\n {\n method: \"GET\",\n headers: {\n // biome-ignore lint/style/useNamingConvention: External API property\n Authorization: `Bearer ${authToken}`,\n },\n }\n );\n\n if (fleetResponse.ok) {\n return;\n }\n\n if (fleetResponse.status === 404) {\n const response = textOrJson(await fleetResponse.text());\n logger.error(\n {\n status: fleetResponse.status,\n statusText: fleetResponse.statusText,\n response,\n },\n \"Fleet does not exist\"\n );\n printDiagnosticsToConsole(\n `Error: Fleet '${fleet}' does not exist for account '${account}'.`\n );\n process.exit(1);\n }\n\n // Handle other errors (401, 403, 500, etc.)\n const response = textOrJson(await fleetResponse.text());\n logger.error(\n {\n status: fleetResponse.status,\n statusText: fleetResponse.statusText,\n response,\n },\n \"Failed to validate fleet existence\"\n );\n printDiagnosticsToConsole(\n \"Error: Failed to validate fleet existence. Check your authentication and permissions.\",\n response\n );\n process.exit(1);\n } catch (error) {\n logger.error({ error }, \"Network error while validating fleet\");\n printDiagnosticsToConsole(\n \"Error: Network error while validating fleet existence.\"\n );\n process.exit(1);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outdated.d.ts","sourceRoot":"","sources":["../../src/common/outdated.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"outdated.d.ts","sourceRoot":"","sources":["../../src/common/outdated.ts"],"names":[],"mappings":"AAcA,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,MAAM,EACzB,kBAAkB,EAAE,MAAM,iBAY3B;AAED,wBAAsB,qBAAqB,CAAC,cAAc,EAAE,MAAM,oBA2BjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outdated.js","sourceRoot":"","sources":["../../src/common/outdated.ts"],"names":[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O,gBAAgB,CAAC,aAAa,KAAK,QAAQ,EAClD,CAAC;gBACD,gBAAgB,GAAG,SAAS,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAC7C,IAAI,GAAG,GAAG,SAAS,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;YAC1C,WAAW,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,gBAAgB,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAE/C,gBAAgB,GAAG;YACjB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,aAAa;SACd,CAAC;QACF,MAAM,SAAS,CACb,gBAAgB,EAChB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAChC,OAAO,CACR,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["import { existsSync, mkdirSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport { gt, inc, lt } from \"semver\";\nimport { ZUPLO_VERSION_CHECK_FILE } from \"./constants.js\";\nimport { printWarningToConsole } from \"./output.js\";\nimport box from \"./utils/box.js\";\nimport { ZUPLO_XDG_STATE_HOME } from \"./xdg/lib.js\";\n\ninterface VersionCheckInfo {\n lastCheck: number;\n latestVersion: string;\n}\nexport async function warnNodeVersion(\n currentCliVersion: string,\n desiredNodeVersion: string\n) {\n const currentNodeVersion = process.versions.node;\n if (lt(currentNodeVersion, desiredNodeVersion)) {\n const nextMajorCliVersion = inc(currentCliVersion, \"major\");\n printWarningToConsole(\n box(\n `You are using Node.js ${currentNodeVersion}. The recommended version for the @zuplo/cli is ${nextMajorCliVersion} or greater.\n Some features might not work as expected. Please update your Node.js version as soon as possible.`\n )\n );\n }\n}\n\nexport async function warnIfOutdatedVersion(currentVersion: string) {\n // Print update information, if available\n if (\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n !process.env.ZUPLO_OVERRIDE_CI_TO_TEST &&\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n (process.env.CI || process.env.ZUPLO_DISABLE_UPDATE_CHECK)\n ) {\n return false;\n }\n const versionCheckInfo = await getVersionCheckInfo();\n const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion);\n\n if (shouldWarn) {\n printWarningToConsole(\n box(\n `Update available! ${chalk.gray(`v${currentVersion}`)} ≫ ${chalk.green(\n `v${versionCheckInfo.latestVersion}`\n )}\nRun ${chalk.cyan(\"npm install zuplo@latest\")} to update.\n\n${chalk.gray(\"Older versions are unsupported and may not work as expected.\")}`\n )\n );\n }\n\n return shouldWarn;\n}\n\nasync function getLatestVersion(): Promise<string> {\n const response = await fetch(\n \"https://raw.githubusercontent.com/zuplo/zuplo/main/packages/zuplo/package.json\"\n );\n const result = await response.json();\n\n return result.dependencies[\"@zuplo/cli\"];\n}\n\nasync function getVersionCheckInfo(): Promise<VersionCheckInfo> {\n if (!existsSync(ZUPLO_XDG_STATE_HOME)) {\n mkdirSync(ZUPLO_XDG_STATE_HOME, { recursive: true });\n }\n const versionCheckPath = join(ZUPLO_XDG_STATE_HOME, ZUPLO_VERSION_CHECK_FILE);\n\n let versionCheckInfo: VersionCheckInfo | undefined;\n if (existsSync(versionCheckPath)) {\n try {\n versionCheckInfo = await readFile(versionCheckPath, \"utf-8\").then(\n JSON.parse\n );\n } catch {\n // Error reading or parsing file, ignore it\n }\n\n // Check if the file is valid, if not ignore it\n if (versionCheckInfo) {\n if (\n typeof versionCheckInfo.lastCheck !== \"number\" ||\n typeof versionCheckInfo.latestVersion !== \"string\"\n ) {\n versionCheckInfo = undefined;\n }\n }\n }\n\n let shouldCheck = true;\n if (versionCheckInfo) {\n const now = Date.now();\n const lastCheck = versionCheckInfo.lastCheck;\n if (now - lastCheck < 1000 * 60 * 60 * 24) {\n shouldCheck = false;\n }\n }\n\n if (!versionCheckInfo || shouldCheck) {\n const latestVersion = await getLatestVersion();\n\n versionCheckInfo = {\n lastCheck: Date.now(),\n latestVersion,\n };\n await writeFile(\n versionCheckPath,\n JSON.stringify(versionCheckInfo),\n \"utf-8\"\n );\n }\n\n return versionCheckInfo;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/common/output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/common/output.ts"],"names":[],"mappings":"AAIA,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAS/B,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG,QAwB1E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,MAAM,OAErD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,GAAG,QAElD;AAGD,wBAAsB,oCAAoC,CACxD,OAAO,CAAC,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,GAAG,iBAad;AAID,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,GAAG,QAEjD;AAID,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,QAE7C;AAED,wBAAsB,qCAAqC,CACzD,OAAO,CAAC,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,GAAG,iBAUd;AAED,wBAAsB,oCAAoC,CAAC,KAAK,EAAE,GAAG,iBAKpE;AAaD,MAAM,CAAC,OAAO,UAAU,WAAW,SAalC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,OAMtC;AAED,qBAAa,aAAa;IACxB,KAAK;wBACa,MAAM;wBACN,MAAM;yBACL,MAAM;MACtB;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/common/output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/common/output.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,MAAM,GAAG,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAMzC,MAAM,UAAU,yBAAyB,CAAC,OAAa,EAAE,YAAkB;IACzE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAExC,IACE,YAAY;QACZ,OAAO,YAAY,KAAK,QAAQ;QAChC,QAAQ,IAAI,YAAY;QACxB,OAAO,YAAY,CAAC,MAAM,KAAK,QAAQ,EACvC,CAAC;QAED,OAAO,CAAC,KAAK,CACX,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAC/D,CAAC;IACJ,CAAC;SAAM,IACL,YAAY;QACZ,OAAO,YAAY,KAAK,QAAQ;QAChC,OAAO,IAAI,YAAY;QACvB,OAAO,YAAY,CAAC,KAAK,KAAK,QAAQ,EACtC,CAAC;QAED,OAAO,CAAC,KAAK,CACX,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CACrE,CAAC;IACJ,CAAC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AAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAChD,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;KACnD,CAAC,CAAC;CACJ","sourcesContent":["/** biome-ignore-all lint/suspicious/noConsole: CLI output file */\n// biome-ignore-all lint/suspicious/noExplicitAny: Lots of any here\nimport * as Sentry from \"@sentry/node\";\nimport chalk from \"chalk\";\nimport ora, { Ora } from \"ora\";\nimport { MAX_WAIT_PENDING_TIME_MS } from \"./constants.js\";\n\nconst indent = ` ${chalk.gray(\"|\")} `;\n\n// We standardize printing to the terminal with this module\n\n// According to https://unix.stackexchange.com/questions/331611/do-progress-reports-logging-information-belong-on-stderr-or-stdout\n// any diagnostic information should go to stderr, and only the actual output goes to stdout\nexport function printDiagnosticsToConsole(message?: any, maybeProblem?: any) {\n console.error(chalk.bold.blue(message));\n\n if (\n maybeProblem &&\n typeof maybeProblem === \"object\" &&\n \"detail\" in maybeProblem &&\n typeof maybeProblem.detail === \"string\"\n ) {\n // The details are better to log if we have it\n console.error(\n indent + chalk.bold.red(JSON.stringify(maybeProblem, null, 2))\n );\n } else if (\n maybeProblem &&\n typeof maybeProblem === \"object\" &&\n \"title\" in maybeProblem &&\n typeof maybeProblem.title === \"string\"\n ) {\n // If we dont have details then log the title\n console.error(\n indent + chalk.bold.red(JSON.stringify(maybeProblem.title, null, 2))\n );\n }\n}\n\nexport function printSpinnerToConsole(message?: string) {\n return ora(message).start();\n}\n\nexport function printWarningToConsole(message?: any) {\n console.error(chalk.yellow(message));\n}\n\n// This information is displayed to the user, so it should be actionable.\nexport async function printCriticalFailureToConsoleAndExit(\n message?: any,\n spinner?: Ora\n) {\n if (spinner) {\n spinner?.fail(message);\n } else {\n console.error(chalk.bold.red(message));\n }\n Sentry.captureMessage(message, {\n level: \"error\",\n });\n await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {\n process.exit(1);\n });\n}\n\n// Only use this to output the actual result of a command\n// This outputs to STDOUT, which is reserved for the actual result of a command\nexport function printResultToConsole(message?: any) {\n console.log(chalk.bold.green(message));\n}\n\n// Only use this to output the actual result of a command\n// This outputs to STDOUT, which is reserved for the actual result of a command\nexport function printTableToConsole(table: any) {\n console.table(table);\n}\n\nexport async function printResultToConsoleAndExitGracefully(\n message?: any,\n spinner?: Ora\n) {\n if (spinner) {\n spinner?.succeed(message);\n } else {\n printResultToConsole(message);\n }\n await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {\n process.exit(0);\n });\n}\n\nexport async function printTableToConsoleAndExitGracefully(table: any) {\n printTableToConsole(table);\n await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {\n process.exit(0);\n });\n}\n\n// See https://nodejs.org/docs/latest-v18.x/api/process.html#a-note-on-process-io\n// We want to deliberately have STDOUT flush synchronously, so we can pipe the output to another command\n\ninterface WriteStreamWithHandle {\n _handle: {\n // biome-ignore lint/complexity/noBannedTypes: Migrated from ESLint\n setBlocking: Function;\n };\n isTTY: boolean;\n}\n\nexport default function setBlocking() {\n // Deno and browser have no process object:\n if (typeof process === \"undefined\") return;\n [process.stdout, process.stderr].forEach((_stream) => {\n const stream = _stream as any as WriteStreamWithHandle;\n if (\n stream._handle &&\n stream.isTTY &&\n typeof stream._handle.setBlocking === \"function\"\n ) {\n stream._handle.setBlocking(true);\n }\n });\n}\n\nexport function textOrJson(text: string) {\n try {\n return JSON.parse(text);\n } catch (_e) {\n return text;\n }\n}\n\nexport class ConsoleOutput {\n child = () => ({\n info: (message: string) => console.log(message),\n warn: (message: string) => console.warn(message),\n error: (message: string) => console.error(message),\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":"AAGA,cAAM,QAAQ;IACZ,IAAI,4BAA4B,IAAI,MAAM,CAEzC;IAED,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,IAAI,wBAAwB,IAAI,MAAM,CAErC;IAED,IAAI,0BAA0B,IAAI,MAAM,CAEvC;CACF;AAED,QAAA,MAAM,QAAQ,UAAiB,CAAC;AAChC,eAAe,QAAQ,CAAC"}
|
package/dist/common/settings.js
CHANGED
|
@@ -3,16 +3,16 @@ class Settings {
|
|
|
3
3
|
return process.env.ZUPLO_DEVELOPER_API_ENDPOINT ?? "https://dev.zuplo.com";
|
|
4
4
|
}
|
|
5
5
|
get MAX_POLL_RETRIES() {
|
|
6
|
-
return parseInt(process.env.MAX_POLL_RETRIES ?? "150");
|
|
6
|
+
return parseInt(process.env.MAX_POLL_RETRIES ?? "150", 10);
|
|
7
7
|
}
|
|
8
8
|
get POLL_INTERVAL() {
|
|
9
|
-
return parseInt(process.env.POLL_INTERVAL ?? "1000");
|
|
9
|
+
return parseInt(process.env.POLL_INTERVAL ?? "1000", 10);
|
|
10
10
|
}
|
|
11
11
|
get MAX_PROVISIONING_RETRIES() {
|
|
12
|
-
return parseInt(process.env.MAX_PROVISIONING_RETRIES ?? "60");
|
|
12
|
+
return parseInt(process.env.MAX_PROVISIONING_RETRIES ?? "60", 10);
|
|
13
13
|
}
|
|
14
14
|
get PROVISIONING_POLL_INTERVAL() {
|
|
15
|
-
return parseInt(process.env.PROVISIONING_INTERVAL ?? "15000");
|
|
15
|
+
return parseInt(process.env.PROVISIONING_INTERVAL ?? "15000", 10);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const settings = new Settings();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/common/settings.ts"],"names":[],"mappings":"AAGA,MAAM,QAAQ;IACZ,IAAI,4BAA4B;QAC9B,OAAO,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,uBAAuB,CAAC;IAC7E,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,KAAK,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,aAAa;QACf,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,0BAA0B;QAC5B,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;AAChC,eAAe,QAAQ,CAAC","sourcesContent":["/** biome-ignore-all lint/style/useNamingConvention: Environment variables */\n/** biome-ignore-all lint/style/noProcessEnv: Environment variables */\n\nclass Settings {\n get ZUPLO_DEVELOPER_API_ENDPOINT(): string {\n return process.env.ZUPLO_DEVELOPER_API_ENDPOINT ?? \"https://dev.zuplo.com\";\n }\n\n get MAX_POLL_RETRIES(): number {\n return parseInt(process.env.MAX_POLL_RETRIES ?? \"150\", 10);\n }\n\n get POLL_INTERVAL(): number {\n return parseInt(process.env.POLL_INTERVAL ?? \"1000\", 10);\n }\n\n get MAX_PROVISIONING_RETRIES(): number {\n return parseInt(process.env.MAX_PROVISIONING_RETRIES ?? \"60\", 10);\n }\n\n get PROVISIONING_POLL_INTERVAL(): number {\n return parseInt(process.env.PROVISIONING_INTERVAL ?? \"15000\", 10);\n }\n}\n\nconst settings = new Settings();\nexport default settings;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vscode-settings-json-upgrader.js","sourceRoot":"","sources":["../../../src/common/upgraders/vscode-settings-json-upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,YAAY,GAAG;IACnB;QACE,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChC,GAAG,EAAE,uDAAuD;KAC7D;IACD;QACE,SAAS,EAAE,CAAC,sBAAsB,CAAC;QACnC,GAAG,EAAE,6CAA6C;KACnD;IACD;QACE,SAAS,EAAE,CAAC,wBAAwB,CAAC;QACrC,GAAG,EAAE,+CAA+C;KACrD;IACD;QACE,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChC,GAAG,EAAE,4CAA4C;KAClD;CACF,CAAC;AAEF,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IAC9D,KAAK,CAAC,YAAY;QAChB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,mBAAmB,EAAE,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,kBAAkB,GAAG,IAAI,CAC7B,IAAI,CAAC,aAAa,EAClB,SAAS,EACT,e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writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { parse } from \"jsonc-parser\";\nimport { format } from \"prettier\";\nimport { Result } from \"../validators/lib.js\";\nimport { StandardUpgrader, VsCodeFolderMissing } from \"./lib.js\";\n\nconst zuploSchemas = [\n {\n fileMatch: [\"config/*.oas.json\"],\n url: \"https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json\",\n },\n {\n fileMatch: [\"config/policies.json\"],\n url: \"https://cdn.zuplo.com/schemas/policies.json\",\n },\n {\n fileMatch: [\"config/dev-portal.json\"],\n url: \"https://cdn.zuplo.com/schemas/dev-portal.json\",\n },\n {\n fileMatch: [\"docs/sidebar.json\"],\n url: \"https://cdn.zuplo.com/schemas/sidebar.json\",\n },\n];\n\nexport class VsCodeSettingsJsonUpgrader extends StandardUpgrader {\n async isApplicable(): Promise<Result> {\n const vsCodeFolder = join(this.normalizedDir, \".vscode\");\n if (existsSync(vsCodeFolder)) {\n return { ok: true };\n } else {\n return { ok: false, error: new VsCodeFolderMissing() };\n }\n }\n\n async upgrade(): Promise<void> {\n const vsCodeSettingsFile = join(\n this.normalizedDir,\n \".vscode\",\n \"settings.json\"\n );\n\n if (!existsSync(vsCodeSettingsFile)) {\n // Create a new one from scratch\n const content = `\n{\n\"json.schemas\": [\n {\n \"fileMatch\": [\"config/*.oas.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json\"\n },\n {\n \"fileMatch\": [\"config/policies.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/policies.json\"\n },\n {\n \"fileMatch\": [\"config/dev-portal.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/dev-portal.json\"\n },\n {\n \"fileMatch\": [\"docs/sidebar.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/sidebar.json\"\n }\n]\n}`;\n const formatted = await format(content, {\n parser: \"json\",\n quoteProps: \"as-needed\",\n });\n await writeFile(vsCodeSettingsFile, formatted);\n } else {\n // Upgrade the existing one (safely)\n // NOTE: For safety, I'm parsing this with comments. But, for simplicity, I'm not writing it back with comments.\n const settingsRaw = await readFile(vsCodeSettingsFile, \"utf-8\");\n const settingsJson = parse(settingsRaw, [], { allowTrailingComma: true });\n\n for (const schema of zuploSchemas) {\n const existingSchema = settingsJson[\"json.schemas\"].find(\n //
|
|
1
|
+
{"version":3,"file":"vscode-settings-json-upgrader.js","sourceRoot":"","sources":["../../../src/common/upgraders/vscode-settings-json-upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjE,MAAM,YAAY,GAAG;IACnB;QACE,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChC,GAAG,EAAE,uDAAuD;KAC7D;IACD;QACE,SAAS,EAAE,CAAC,sBAAsB,CAAC;QACnC,GAAG,EAAE,6CAA6C;KACnD;IACD;QACE,SAAS,EAAE,CAAC,wBAAwB,CAAC;QACrC,GAAG,EAAE,+CAA+C;KACrD;IACD;QACE,SAAS,EAAE,CAAC,mBAAmB,CAAC;QAChC,GAAG,EAAE,4CAA4C;KAClD;CACF,CAAC;AAEF,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IAC9D,KAAK,CAAC,YAAY;QAChB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QACzD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,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AC,EAAE;gBAC3D,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,WAAW;aACxB,CAAC,CAAC;YACH,MAAM,SAAS,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;CACF","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { parse } from \"jsonc-parser\";\nimport { format } from \"prettier\";\nimport { Result } from \"../validators/lib.js\";\nimport { StandardUpgrader, VsCodeFolderMissing } from \"./lib.js\";\n\nconst zuploSchemas = [\n {\n fileMatch: [\"config/*.oas.json\"],\n url: \"https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json\",\n },\n {\n fileMatch: [\"config/policies.json\"],\n url: \"https://cdn.zuplo.com/schemas/policies.json\",\n },\n {\n fileMatch: [\"config/dev-portal.json\"],\n url: \"https://cdn.zuplo.com/schemas/dev-portal.json\",\n },\n {\n fileMatch: [\"docs/sidebar.json\"],\n url: \"https://cdn.zuplo.com/schemas/sidebar.json\",\n },\n];\n\nexport class VsCodeSettingsJsonUpgrader extends StandardUpgrader {\n async isApplicable(): Promise<Result> {\n const vsCodeFolder = join(this.normalizedDir, \".vscode\");\n if (existsSync(vsCodeFolder)) {\n return { ok: true };\n } else {\n return { ok: false, error: new VsCodeFolderMissing() };\n }\n }\n\n async upgrade(): Promise<void> {\n const vsCodeSettingsFile = join(\n this.normalizedDir,\n \".vscode\",\n \"settings.json\"\n );\n\n if (!existsSync(vsCodeSettingsFile)) {\n // Create a new one from scratch\n const content = `\n{\n\"json.schemas\": [\n {\n \"fileMatch\": [\"config/*.oas.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/openapi-v3.1-zuplo.json\"\n },\n {\n \"fileMatch\": [\"config/policies.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/policies.json\"\n },\n {\n \"fileMatch\": [\"config/dev-portal.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/dev-portal.json\"\n },\n {\n \"fileMatch\": [\"docs/sidebar.json\"],\n \"url\": \"https://cdn.zuplo.com/schemas/sidebar.json\"\n }\n]\n}`;\n const formatted = await format(content, {\n parser: \"json\",\n quoteProps: \"as-needed\",\n });\n await writeFile(vsCodeSettingsFile, formatted);\n } else {\n // Upgrade the existing one (safely)\n // NOTE: For safety, I'm parsing this with comments. But, for simplicity, I'm not writing it back with comments.\n const settingsRaw = await readFile(vsCodeSettingsFile, \"utf-8\");\n const settingsJson = parse(settingsRaw, [], { allowTrailingComma: true });\n\n for (const schema of zuploSchemas) {\n const existingSchema = settingsJson[\"json.schemas\"].find(\n // biome-ignore lint/suspicious/noExplicitAny: Migrated from ESLint\n (s: any) => s.fileMatch[0] === schema.fileMatch[0]\n );\n if (existingSchema) {\n existingSchema.url = schema.url;\n } else {\n settingsJson[\"json.schemas\"].push(schema);\n }\n }\n\n const formatted = await format(JSON.stringify(settingsJson), {\n parser: \"json\",\n quoteProps: \"as-needed\",\n });\n await writeFile(vsCodeSettingsFile, formatted);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../../src/common/utils/box.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACnD,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AA2C9C,MAAM,CAAC,OAAO,UAAU,GAAG,CACzB,OAAe,EACf,EACE,WAAW,EACX,OAAO,GAAG,CAAC,EACX,aAAa,GAAG,QAAQ,EACxB,eAAe,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,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IAAI,CAAC;QAChC,IAAI;QACJ,SAAS;QACT,aAAa,CAAC,GAAG,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,EAAE,CAAC,CACrE,CAAC;AACJ,CAAC","sourcesContent":["// Source: https://github.com/vercel/vercel/blob/main/packages/cli/src/util/output/box.ts#L48\n// Copyright 2017 Vercel, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport chalk from \"chalk\";\nimport stripAnsi from \"strip-ansi\";\n\nconst border = [\"─\", \"╭\", \"╮\", \"│\", \"│\", \"╰\", \"╯\"];\nconst nothing = [\"─\", \"\", \"\", \"\", \"\", \"\", \"\"];\n\nexport interface BoxOptions {\n borderColor?:\n | \"black\"\n | \"red\"\n | \"green\"\n | \"yellow\"\n | \"blue\"\n | \"magenta\"\n | \"cyan\"\n | \"white\";\n padding?: number;\n textAlignment?: \"left\" | \"center\" | \"right\";\n terminalColumns?: number;\n}\n\n/**\n * Renders text centered inside a yellow box. If terminal is too narrow to fit\n * the text without wrapping, the box will only consist of a top and bottom\n * horizontal rule with the text left justified.\n *\n * @param message The multiline message to display\n * @param options Various formatting options\n * @returns The rendered string\n *\n * @example Simple box\n *\n * # Usage\n * ```\n * console.log(box('Hello world!\\nThe quick brown fox jumps over the lazy dog'));\n * ```\n *\n * # Result\n * ```\n * ╭─────────────────────────────────────────────────╮\n * │ │\n * │ Hello world! │\n * │ The quick brown fox jumps over the lazy dog │\n * │ │\n * ╰─────────────────────────────────────────────────╯\n * ```\n */\nexport default function box(\n message: string,\n {\n borderColor,\n padding = 1,\n textAlignment = \"center\",\n terminalColumns: cols = process.stdout.columns ||\n //
|
|
1
|
+
{"version":3,"file":"box.js","sourceRoot":"","sources":["../../../src/common/utils/box.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE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YACnB,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC;YACvB,IAAI;YACJ,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC;YACxB,aAAa,CAAC,KAAK,CAAC,CACrB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,aAAa,CAAC,GAAG,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,EAAE,CAAC;QAC9D,IAAI;QACJ,SAAS;QACT,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChC,IAAI;QACJ,SAAS;QACT,aAAa,CAAC,GAAG,UAAU,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,EAAE,CAAC,CACrE,CAAC;AACJ,CAAC","sourcesContent":["// Source: https://github.com/vercel/vercel/blob/main/packages/cli/src/util/output/box.ts#L48\n// Copyright 2017 Vercel, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport chalk from \"chalk\";\nimport stripAnsi from \"strip-ansi\";\n\nconst border = [\"─\", \"╭\", \"╮\", \"│\", \"│\", \"╰\", \"╯\"];\nconst nothing = [\"─\", \"\", \"\", \"\", \"\", \"\", \"\"];\n\nexport interface BoxOptions {\n borderColor?:\n | \"black\"\n | \"red\"\n | \"green\"\n | \"yellow\"\n | \"blue\"\n | \"magenta\"\n | \"cyan\"\n | \"white\";\n padding?: number;\n textAlignment?: \"left\" | \"center\" | \"right\";\n terminalColumns?: number;\n}\n\n/**\n * Renders text centered inside a yellow box. If terminal is too narrow to fit\n * the text without wrapping, the box will only consist of a top and bottom\n * horizontal rule with the text left justified.\n *\n * @param message The multiline message to display\n * @param options Various formatting options\n * @returns The rendered string\n *\n * @example Simple box\n *\n * # Usage\n * ```\n * console.log(box('Hello world!\\nThe quick brown fox jumps over the lazy dog'));\n * ```\n *\n * # Result\n * ```\n * ╭─────────────────────────────────────────────────╮\n * │ │\n * │ Hello world! │\n * │ The quick brown fox jumps over the lazy dog │\n * │ │\n * ╰─────────────────────────────────────────────────╯\n * ```\n */\nexport default function box(\n message: string,\n {\n borderColor,\n padding = 1,\n textAlignment = \"center\",\n terminalColumns: cols = process.stdout.columns ||\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n (process.env.COLUMNS && parseInt(process.env.COLUMNS, 10)) ||\n 80,\n }: BoxOptions = {}\n): string {\n const lines: [string, number][] = message\n .split(/\\r?\\n/)\n .map((line) => [line, stripAnsi(line).length]);\n const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);\n const borderColorFn = (borderColor && chalk[borderColor]) || chalk.yellow;\n const clampedSidePadding = Math.max(1, padding * 3);\n const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;\n const sidePadding = narrowMode ? 0 : clampedSidePadding;\n const innerWidth = Math.min(maxLine + sidePadding * 2, cols);\n const [hr, topLeft, topRight, left, right, bottomLeft, bottomRight] =\n narrowMode ? nothing : border;\n const spacerRow = narrowMode\n ? \"\\n\".repeat(padding)\n : `${borderColorFn(`${left}${\" \".repeat(innerWidth)}${right}`)}\\n`.repeat(\n padding\n );\n\n const renderLine = ([line, len]: [string, number]) => {\n let leftPadding = 0;\n let rightPadding = 0;\n\n if (!narrowMode) {\n leftPadding = sidePadding;\n rightPadding = sidePadding;\n\n if (textAlignment === \"center\") {\n leftPadding += Math.floor((maxLine - len) / 2);\n rightPadding += maxLine - len - leftPadding + sidePadding;\n } else if (textAlignment === \"right\") {\n leftPadding += maxLine - len;\n } else if (textAlignment === \"left\") {\n rightPadding += maxLine - len;\n }\n }\n\n return (\n borderColorFn(left) +\n \" \".repeat(leftPadding) +\n line +\n \" \".repeat(rightPadding) +\n borderColorFn(right)\n );\n };\n\n return (\n borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`) +\n \"\\n\" +\n spacerRow +\n lines.map(renderLine).join(\"\\n\") +\n \"\\n\" +\n spacerRow +\n borderColorFn(`${bottomLeft}${hr.repeat(innerWidth)}${bottomRight}`)\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/common/utils/ports.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/common/utils/ports.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkB5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../../src/common/utils/ports.ts"],"names":[],"mappings":"AAAA,OAAO,GAAe,MAAM,UAAU,CAAC;AAEvC,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAY;
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../../src/common/utils/ports.ts"],"names":[],"mappings":"AAAA,OAAO,GAAe,MAAM,UAAU,CAAC;AAEvC,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAY;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,MAAM,MAAM,GAAW,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAExC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAE3B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAExB,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAE1B,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import net, { Socket } from \"node:net\";\n\nexport function isPortAvailable(host: string, port: number): Promise<boolean> {\n return new Promise((resolve, _reject) => {\n const socket: Socket = new net.Socket();\n\n socket.connect(port, host);\n\n socket.on(\"connect\", () => {\n // If we can connect, that means that the port is not free\n socket.destroy(); // Close the socket\n resolve(false);\n });\n\n socket.on(\"error\", (_err) => {\n // If we cannot connect, that means that the port is not free\n socket.destroy(); // Close the socket\n resolve(true);\n });\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system-validator.d.ts","sourceRoot":"","sources":["../../../src/common/validators/file-system-validator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEtE,qBAAa,mCAAoC,SAAQ,KAAK;;CAO7D;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAK1C;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAO1C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;;CAOlD;AAED,qBAAa,YAAa,SAAQ,KAAK;;CAOtC;AAED,qBAAa,eAAgB,SAAQ,KAAK;;CAOzC;AAED,qBAAa,0BACX,YAAW,cAAc,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;IAEpC,QAAQ,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"file-system-validator.d.ts","sourceRoot":"","sources":["../../../src/common/validators/file-system-validator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEtE,qBAAa,mCAAoC,SAAQ,KAAK;;CAO7D;AAED,qBAAa,gBAAiB,SAAQ,K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