@zuplo/cli 6.68.7 → 6.68.9

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.
Files changed (54) hide show
  1. package/dist/__tests__/integration/custom-domain.integration.test.d.ts +2 -0
  2. package/dist/__tests__/integration/custom-domain.integration.test.d.ts.map +1 -0
  3. package/dist/__tests__/integration/custom-domain.integration.test.js +543 -0
  4. package/dist/__tests__/integration/custom-domain.integration.test.js.map +1 -0
  5. package/dist/__tests__/integration/jest-mocks-setup.js +2 -0
  6. package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
  7. package/dist/cli.js +2 -0
  8. package/dist/cli.js.map +1 -1
  9. package/dist/cmds/custom-domain/create.d.ts +9 -0
  10. package/dist/cmds/custom-domain/create.d.ts.map +1 -0
  11. package/dist/cmds/custom-domain/create.js +82 -0
  12. package/dist/cmds/custom-domain/create.js.map +1 -0
  13. package/dist/cmds/custom-domain/delete.d.ts +9 -0
  14. package/dist/cmds/custom-domain/delete.d.ts.map +1 -0
  15. package/dist/cmds/custom-domain/delete.js +72 -0
  16. package/dist/cmds/custom-domain/delete.js.map +1 -0
  17. package/dist/cmds/custom-domain/index.d.ts +4 -0
  18. package/dist/cmds/custom-domain/index.d.ts.map +1 -0
  19. package/dist/cmds/custom-domain/index.js +20 -0
  20. package/dist/cmds/custom-domain/index.js.map +1 -0
  21. package/dist/cmds/custom-domain/list.d.ts +9 -0
  22. package/dist/cmds/custom-domain/list.d.ts.map +1 -0
  23. package/dist/cmds/custom-domain/list.js +56 -0
  24. package/dist/cmds/custom-domain/list.js.map +1 -0
  25. package/dist/cmds/custom-domain/update.d.ts +9 -0
  26. package/dist/cmds/custom-domain/update.d.ts.map +1 -0
  27. package/dist/cmds/custom-domain/update.js +72 -0
  28. package/dist/cmds/custom-domain/update.js.map +1 -0
  29. package/dist/common/output.d.ts +4 -0
  30. package/dist/common/output.d.ts.map +1 -1
  31. package/dist/common/output.js +9 -0
  32. package/dist/common/output.js.map +1 -1
  33. package/dist/custom-domain/create/handler.d.ts +11 -0
  34. package/dist/custom-domain/create/handler.d.ts.map +1 -0
  35. package/dist/custom-domain/create/handler.js +50 -0
  36. package/dist/custom-domain/create/handler.js.map +1 -0
  37. package/dist/custom-domain/delete/handler.d.ts +9 -0
  38. package/dist/custom-domain/delete/handler.d.ts.map +1 -0
  39. package/dist/custom-domain/delete/handler.js +85 -0
  40. package/dist/custom-domain/delete/handler.js.map +1 -0
  41. package/dist/custom-domain/list/handler.d.ts +7 -0
  42. package/dist/custom-domain/list/handler.d.ts.map +1 -0
  43. package/dist/custom-domain/list/handler.js +105 -0
  44. package/dist/custom-domain/list/handler.js.map +1 -0
  45. package/dist/custom-domain/models.d.ts +37 -0
  46. package/dist/custom-domain/models.d.ts.map +1 -0
  47. package/dist/custom-domain/models.js +2 -0
  48. package/dist/custom-domain/models.js.map +1 -0
  49. package/dist/custom-domain/update/handler.d.ts +9 -0
  50. package/dist/custom-domain/update/handler.d.ts.map +1 -0
  51. package/dist/custom-domain/update/handler.js +47 -0
  52. package/dist/custom-domain/update/handler.js.map +1 -0
  53. package/dist/tsconfig.tsbuildinfo +1 -1
  54. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"jest-mocks-setup.js","sourceRoot":"","sources":["../../../src/__tests__/integration/jest-mocks-setup.ts"],"names":[],"mappings":"AAKA,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAG9C,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC;IACzC,qCAAqC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC7E,oCAAoC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC5E,oBAAoB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IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;QAC9C,YAAY,EAAE,eAAe;QAC7B,QAAQ,EAAE,eAAe;QACzB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,sBAAsB;KAC9B,CAAC;CACH,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Jest mocks setup - loaded before all test modules\n * This file contains all the Jest mocks that need to be applied before any modules are imported\n */\n\nconst TEST_AUTH_TOKEN = \"test-auth-token-123\";\n\n// Mock all output functions to prevent actual console output and process.exit calls\njest.mock(\"../../common/output.js\", () => ({\n __esModule: true,\n default: jest.fn((argv: unknown) => argv), // setBlocking middleware function\n printResultToConsoleAndExitGracefully: jest.fn().mockResolvedValue(undefined),\n printTableToConsoleAndExitGracefully: jest.fn().mockResolvedValue(undefined),\n printResultToConsole: jest.fn().mockResolvedValue(undefined),\n printDiagnosticsToConsole: jest.fn(),\n printWarningToConsole: jest.fn(),\n printSpinnerToConsole: jest.fn().mockReturnValue({ stop: jest.fn() }),\n printCriticalFailureToConsoleAndExit: jest.fn().mockImplementation(() => {\n throw new Error(\"Process would exit\");\n }),\n textOrJson: jest.fn((text: string) => {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }),\n}));\n\n// Mock analytics\njest.mock(\"../../common/analytics/lib.js\", () => ({\n captureEvent: jest.fn().mockResolvedValue(undefined),\n}));\n\n// Mock authentication middleware to add authToken\njest.mock(\"../../common/middleware/authentication.js\", () => ({\n authenticate: jest.fn((argv: Record<string, unknown>) => {\n return { ...argv, authToken: TEST_AUTH_TOKEN };\n }),\n}));\n\n// Mock inquirer prompts to return predictable values for tests\njest.mock(\"@inquirer/prompts\", () => ({\n select: jest.fn().mockImplementation(({ choices }) => {\n // Return the first choice by default, or a specific value based on the message\n if (Array.isArray(choices) && choices.length > 0) {\n return Promise.resolve(choices[0].value);\n }\n return Promise.resolve(\"test-default\");\n }),\n}));\n\n// Mock other middleware to pass through arguments\njest.mock(\"../../common/middleware/user-configuration.js\", () => ({\n configure: jest.fn((argv: unknown) => argv),\n}));\n\njest.mock(\"../../common/middleware/user-identification.js\", () => ({\n identify: jest.fn((argv: unknown) => argv),\n}));\n\n// Mock validators to pass through\njest.mock(\"../../common/validators/lib.js\", () => ({\n YargsChecker: jest.fn().mockImplementation(() => ({\n check: jest.fn().mockResolvedValue(true),\n })),\n}));\n\n// Mock group handler for commands with subcommands\njest.mock(\"../../common/handler.js\", () => ({\n groupHandler: jest.fn(),\n}));\n\n// Mock token functions to prevent file system and HTTP calls\njest.mock(\"../../login/tokens.js\", () => ({\n getAuthToken: jest.fn().mockResolvedValue(TEST_AUTH_TOKEN),\n refreshAccessToken: jest.fn().mockResolvedValue({\n access_token: TEST_AUTH_TOKEN,\n id_token: \"mock-id-token\",\n expires_in: 3600,\n token_type: \"Bearer\",\n scope: \"openid profile email\",\n }),\n}));\n"]}
1
+ {"version":3,"file":"jest-mocks-setup.js","sourceRoot":"","sources":["../../../src/__tests__/integration/jest-mocks-setup.ts"],"names":[],"mappings":"AAKA,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAG9C,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,IAAI,CAAC;IACzC,qCAAqC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC7E,oCAAoC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC5E,mCAAmC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC3E,oBAAoB,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC;IAC5D,kBAAkB,EAAE,IAAI,CAAC,EAAE,EAAE,CAA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iB,CAAC;QAC9C,YAAY,EAAE,eAAe;QAC7B,QAAQ,EAAE,eAAe;QACzB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,sBAAsB;KAC9B,CAAC;CACH,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Jest mocks setup - loaded before all test modules\n * This file contains all the Jest mocks that need to be applied before any modules are imported\n */\n\nconst TEST_AUTH_TOKEN = \"test-auth-token-123\";\n\n// Mock all output functions to prevent actual console output and process.exit calls\njest.mock(\"../../common/output.js\", () => ({\n __esModule: true,\n default: jest.fn((argv: unknown) => argv), // setBlocking middleware function\n printResultToConsoleAndExitGracefully: jest.fn().mockResolvedValue(undefined),\n printTableToConsoleAndExitGracefully: jest.fn().mockResolvedValue(undefined),\n printJsonToConsoleAndExitGracefully: jest.fn().mockResolvedValue(undefined),\n printResultToConsole: jest.fn().mockResolvedValue(undefined),\n printJsonToConsole: jest.fn().mockResolvedValue(undefined),\n printDiagnosticsToConsole: jest.fn(),\n printWarningToConsole: jest.fn(),\n printSpinnerToConsole: jest.fn().mockReturnValue({ stop: jest.fn() }),\n printCriticalFailureToConsoleAndExit: jest.fn().mockImplementation(() => {\n throw new Error(\"Process would exit\");\n }),\n textOrJson: jest.fn((text: string) => {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }),\n}));\n\n// Mock analytics\njest.mock(\"../../common/analytics/lib.js\", () => ({\n captureEvent: jest.fn().mockResolvedValue(undefined),\n}));\n\n// Mock authentication middleware to add authToken\njest.mock(\"../../common/middleware/authentication.js\", () => ({\n authenticate: jest.fn((argv: Record<string, unknown>) => {\n return { ...argv, authToken: TEST_AUTH_TOKEN };\n }),\n}));\n\n// Mock inquirer prompts to return predictable values for tests\njest.mock(\"@inquirer/prompts\", () => ({\n select: jest.fn().mockImplementation(({ choices }) => {\n // Return the first choice by default, or a specific value based on the message\n if (Array.isArray(choices) && choices.length > 0) {\n return Promise.resolve(choices[0].value);\n }\n return Promise.resolve(\"test-default\");\n }),\n}));\n\n// Mock other middleware to pass through arguments\njest.mock(\"../../common/middleware/user-configuration.js\", () => ({\n configure: jest.fn((argv: unknown) => argv),\n}));\n\njest.mock(\"../../common/middleware/user-identification.js\", () => ({\n identify: jest.fn((argv: unknown) => argv),\n}));\n\n// Mock validators to pass through\njest.mock(\"../../common/validators/lib.js\", () => ({\n YargsChecker: jest.fn().mockImplementation(() => ({\n check: jest.fn().mockResolvedValue(true),\n })),\n}));\n\n// Mock group handler for commands with subcommands\njest.mock(\"../../common/handler.js\", () => ({\n groupHandler: jest.fn(),\n}));\n\n// Mock token functions to prevent file system and HTTP calls\njest.mock(\"../../login/tokens.js\", () => ({\n getAuthToken: jest.fn().mockResolvedValue(TEST_AUTH_TOKEN),\n refreshAccessToken: jest.fn().mockResolvedValue({\n access_token: TEST_AUTH_TOKEN,\n id_token: \"mock-id-token\",\n expires_in: 3600,\n token_type: \"Bearer\",\n scope: \"openid profile email\",\n }),\n}));\n"]}
package/dist/cli.js CHANGED
@@ -10,6 +10,7 @@ import { hideBin } from "yargs/helpers";
10
10
  import yargs from "yargs/yargs";
11
11
  import build from "./cmds/build.js";
12
12
  import compile from "./cmds/compile.js";
13
+ import customDomain from "./cmds/custom-domain/index.js";
13
14
  import deleteZup from "./cmds/delete.js";
14
15
  import deploy from "./cmds/deploy.js";
15
16
  import dev from "./cmds/dev.js";
@@ -80,6 +81,7 @@ if (gte(process.versions.node, MIN_NODE_VERSION)) {
80
81
  })
81
82
  .middleware(logLevel)
82
83
  .command(compile)
84
+ .command(customDomain)
83
85
  .command(deleteZup)
84
86
  .command(deploy)
85
87
  .command(dev)
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,SA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,CAAC;SACf,OAAO,CAAC,QAAQ,CAAC;SACjB,OAAO,CAAC,KAAK,CAAC;SACd,OAAO,CAAC,OAAO,CAAC;SAChB,OAAO,CAAC;QACP,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,CAAC;KACF,CAAC;SACD,aAAa,EAAE;SACf,cAAc,EAAE;SAChB,OAAO,CAAC,UAAU,CAAC;SACnB,IAAI,CAAC,KAAK,CAAC;SACX,IAAI,EAAE,CAAC;IAEV,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,IAAI,CAAC;QAGf,KAAK,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAEvC,KAAK,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,oCAAoC,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;QAC/D,GAAG,CAAC,QAAQ,EAAE,CAAC;IACjB,CAAC;YAAS,CAAC;QACT,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;KAAM,CAAC;IACN,MAAM,oCAAoC,CACxC,4CAA4C,gBAAgB,oBAAoB,OAAO,CAAC,QAAQ,CAAC,IAAI;;oFAErB,CACjF,CAAC;AACJ,CAAC","sourcesContent":["import * as dotenv from \"dotenv\";\n\ndotenv.config();\n\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { confirm } from \"@inquirer/prompts\";\nimport * as Sentry from \"@sentry/node\";\nimport { gte } from \"semver\";\n// Undici must be imported first to set the global dispatcher\n// If fetch is used before undici, the process will crash\nimport undici from \"undici\";\nimport { hideBin } from \"yargs/helpers\";\nimport yargs from \"yargs/yargs\";\nimport build from \"./cmds/build.js\";\nimport compile from \"./cmds/compile.js\";\nimport deleteZup from \"./cmds/delete.js\";\nimport deploy from \"./cmds/deploy.js\";\nimport dev from \"./cmds/dev.js\";\nimport docs from \"./cmds/docs.js\";\nimport editor from \"./cmds/editor.js\";\nimport init from \"./cmds/init.js\";\nimport link from \"./cmds/link.js\";\nimport list from \"./cmds/list.js\";\nimport login from \"./cmds/login.js\";\nimport mtlsCertificates from \"./cmds/mtls-certificates/index.js\";\nimport oas from \"./cmds/open-api/index.js\";\nimport project from \"./cmds/project/index.js\";\nimport proxies from \"./cmds/proxies/index.js\";\nimport source from \"./cmds/source/index.js\";\nimport test from \"./cmds/test.js\";\nimport tunnel from \"./cmds/tunnel/index.js\";\nimport variable from \"./cmds/variable/index.js\";\nimport { shutdownAnalytics } from \"./common/analytics/lib.js\";\nimport { MAX_WAIT_PENDING_TIME_MS, SENTRY_DSN } from \"./common/constants.js\";\nimport { logger } from \"./common/logger.js\";\nimport { logLevel } from \"./common/middleware/logging.js\";\nimport { warnIfOutdatedVersion, warnNodeVersion } from \"./common/outdated.js\";\nimport { printCriticalFailureToConsoleAndExit } from \"./common/output.js\";\n\n// This allows us to stop the CLI from executing so we can connect the profiler\n\n// biome-ignore lint/style/noProcessEnv: Migrated from ESLint\nif (process.env.ZUPLO_CLI_PROFILING) {\n await confirm({ message: \"Continue executing CLI?\", default: true });\n}\n\n// Note: We cannot set this to be higher than 18.0.0 because of the way\n// our documentation works -- we tell them to use npx @zuplo/cli@latest (even in CI/CD jobs)\n// If we set this to be higher than 18.0.0, then we will break them.\n// Instead we set the value in package.json to be engine.node >= 20.0.0, so it will warn\nconst MIN_NODE_VERSION = \"18.0.0\";\nconst RECOMMENDED_NODE_VERSION = \"20.0.0\";\n\nif (gte(process.versions.node, MIN_NODE_VERSION)) {\n let cliVersion: string;\n try {\n const packageJson = JSON.parse(\n readFileSync(\n fileURLToPath(new URL(\"../package.json\", import.meta.url)),\n \"utf-8\"\n )\n );\n cliVersion = packageJson.version;\n } catch (e) {\n cliVersion = \"0.0.0\";\n logger.error(e);\n await printCriticalFailureToConsoleAndExit(\n `Unable to load @zuplo/cli. The package.json is missing or malformed.`\n );\n }\n\n await warnNodeVersion(cliVersion, RECOMMENDED_NODE_VERSION);\n\n undici.setGlobalDispatcher(\n undici.getGlobalDispatcher().compose((dispatch) => {\n return (opts, handler) => {\n opts.headers = {\n ...opts.headers,\n \"user-agent\": `ZuploCLI/${cliVersion}`,\n\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n ...(process.env.ZUPLO_CANARY ? { \"zp-canary\": \"true\" } : {}),\n };\n return dispatch(opts, handler);\n };\n })\n );\n\n Sentry.init({\n dsn: SENTRY_DSN,\n release: cliVersion,\n });\n\n const cli = yargs(hideBin(process.argv))\n // This means that all env vars will have to be prefixed with ZUPLO_\n .env(\"ZUPLO\")\n .option(\"prompt\", {\n type: \"boolean\",\n describe: \"Bypass confirmation prompts\",\n default: true,\n hidden: true,\n })\n .option(\"verbose\", {\n alias: \"v\",\n type: \"count\",\n describe: \"Increase verbosity level (-v, -vv, -vvv)\",\n default: 0,\n })\n .middleware(logLevel)\n .command(compile)\n .command(deleteZup) // delete is a reserved keyword in JavaScript, so we call this function deleteZup\n .command(deploy)\n .command(dev)\n .command(docs)\n .command(editor)\n .command(init)\n .command(list)\n .command(link)\n .command(login)\n .command(test)\n .command(oas)\n .command(mtlsCertificates)\n .command(project)\n .command(source)\n .command(tunnel)\n .command(variable)\n .command(build)\n .command(proxies)\n .command({\n command: \"hello\",\n handler: async () => {\n await fetch(\"https://393b4699ced44cc2ae87e4ad86184a29.api.mockbin.io/\");\n },\n })\n .demandCommand()\n .strictCommands()\n .version(cliVersion)\n .fail(false)\n .help();\n\n try {\n await cli.argv;\n\n // Don't block\n void warnIfOutdatedVersion(cliVersion);\n\n void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {\n process.exit(0);\n });\n } catch (err) {\n if (err instanceof Error) {\n Sentry.captureException(err);\n }\n await printCriticalFailureToConsoleAndExit(err.message ?? err);\n cli.showHelp();\n } finally {\n await shutdownAnalytics();\n }\n} else {\n await printCriticalFailureToConsoleAndExit(\n `The Zuplo CLI requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.\n\n Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`\n );\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAG7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,YAAY,MAAM,+BAA+B,CAAC;AACzD,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,IAAI,MAAM,gBAAgB,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GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,oCAAoC,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;QAC/D,GAAG,CAAC,QAAQ,EAAE,CAAC;IACjB,CAAC;YAAS,CAAC;QACT,MAAM,iBAAiB,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;KAAM,CAAC;IACN,MAAM,oCAAoC,CACxC,4CAA4C,gBAAgB,oBAAoB,OAAO,CAAC,QAAQ,CAAC,IAAI;;oFAErB,CACjF,CAAC;AACJ,CAAC","sourcesContent":["import * as dotenv from \"dotenv\";\n\ndotenv.config();\n\nimport { readFileSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\nimport { confirm } from \"@inquirer/prompts\";\nimport * as Sentry from \"@sentry/node\";\nimport { gte } from \"semver\";\n// Undici must be imported first to set the global dispatcher\n// If fetch is used before undici, the process will crash\nimport undici from \"undici\";\nimport { hideBin } from \"yargs/helpers\";\nimport yargs from \"yargs/yargs\";\nimport build from \"./cmds/build.js\";\nimport compile from \"./cmds/compile.js\";\nimport customDomain from \"./cmds/custom-domain/index.js\";\nimport deleteZup from \"./cmds/delete.js\";\nimport deploy from \"./cmds/deploy.js\";\nimport dev from \"./cmds/dev.js\";\nimport docs from \"./cmds/docs.js\";\nimport editor from \"./cmds/editor.js\";\nimport init from \"./cmds/init.js\";\nimport link from \"./cmds/link.js\";\nimport list from \"./cmds/list.js\";\nimport login from \"./cmds/login.js\";\nimport mtlsCertificates from \"./cmds/mtls-certificates/index.js\";\nimport oas from \"./cmds/open-api/index.js\";\nimport project from \"./cmds/project/index.js\";\nimport proxies from \"./cmds/proxies/index.js\";\nimport source from \"./cmds/source/index.js\";\nimport test from \"./cmds/test.js\";\nimport tunnel from \"./cmds/tunnel/index.js\";\nimport variable from \"./cmds/variable/index.js\";\nimport { shutdownAnalytics } from \"./common/analytics/lib.js\";\nimport { MAX_WAIT_PENDING_TIME_MS, SENTRY_DSN } from \"./common/constants.js\";\nimport { logger } from \"./common/logger.js\";\nimport { logLevel } from \"./common/middleware/logging.js\";\nimport { warnIfOutdatedVersion, warnNodeVersion } from \"./common/outdated.js\";\nimport { printCriticalFailureToConsoleAndExit } from \"./common/output.js\";\n\n// This allows us to stop the CLI from executing so we can connect the profiler\n\n// biome-ignore lint/style/noProcessEnv: Migrated from ESLint\nif (process.env.ZUPLO_CLI_PROFILING) {\n await confirm({ message: \"Continue executing CLI?\", default: true });\n}\n\n// Note: We cannot set this to be higher than 18.0.0 because of the way\n// our documentation works -- we tell them to use npx @zuplo/cli@latest (even in CI/CD jobs)\n// If we set this to be higher than 18.0.0, then we will break them.\n// Instead we set the value in package.json to be engine.node >= 20.0.0, so it will warn\nconst MIN_NODE_VERSION = \"18.0.0\";\nconst RECOMMENDED_NODE_VERSION = \"20.0.0\";\n\nif (gte(process.versions.node, MIN_NODE_VERSION)) {\n let cliVersion: string;\n try {\n const packageJson = JSON.parse(\n readFileSync(\n fileURLToPath(new URL(\"../package.json\", import.meta.url)),\n \"utf-8\"\n )\n );\n cliVersion = packageJson.version;\n } catch (e) {\n cliVersion = \"0.0.0\";\n logger.error(e);\n await printCriticalFailureToConsoleAndExit(\n `Unable to load @zuplo/cli. The package.json is missing or malformed.`\n );\n }\n\n await warnNodeVersion(cliVersion, RECOMMENDED_NODE_VERSION);\n\n undici.setGlobalDispatcher(\n undici.getGlobalDispatcher().compose((dispatch) => {\n return (opts, handler) => {\n opts.headers = {\n ...opts.headers,\n \"user-agent\": `ZuploCLI/${cliVersion}`,\n\n // biome-ignore lint/style/noProcessEnv: Migrated from ESLint\n ...(process.env.ZUPLO_CANARY ? { \"zp-canary\": \"true\" } : {}),\n };\n return dispatch(opts, handler);\n };\n })\n );\n\n Sentry.init({\n dsn: SENTRY_DSN,\n release: cliVersion,\n });\n\n const cli = yargs(hideBin(process.argv))\n // This means that all env vars will have to be prefixed with ZUPLO_\n .env(\"ZUPLO\")\n .option(\"prompt\", {\n type: \"boolean\",\n describe: \"Bypass confirmation prompts\",\n default: true,\n hidden: true,\n })\n .option(\"verbose\", {\n alias: \"v\",\n type: \"count\",\n describe: \"Increase verbosity level (-v, -vv, -vvv)\",\n default: 0,\n })\n .middleware(logLevel)\n .command(compile)\n .command(customDomain)\n .command(deleteZup) // delete is a reserved keyword in JavaScript, so we call this function deleteZup\n .command(deploy)\n .command(dev)\n .command(docs)\n .command(editor)\n .command(init)\n .command(list)\n .command(link)\n .command(login)\n .command(test)\n .command(oas)\n .command(mtlsCertificates)\n .command(project)\n .command(source)\n .command(tunnel)\n .command(variable)\n .command(build)\n .command(proxies)\n .command({\n command: \"hello\",\n handler: async () => {\n await fetch(\"https://393b4699ced44cc2ae87e4ad86184a29.api.mockbin.io/\");\n },\n })\n .demandCommand()\n .strictCommands()\n .version(cliVersion)\n .fail(false)\n .help();\n\n try {\n await cli.argv;\n\n // Don't block\n void warnIfOutdatedVersion(cliVersion);\n\n void Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {\n process.exit(0);\n });\n } catch (err) {\n if (err instanceof Error) {\n Sentry.captureException(err);\n }\n await printCriticalFailureToConsoleAndExit(err.message ?? err);\n cli.showHelp();\n } finally {\n await shutdownAnalytics();\n }\n} else {\n await printCriticalFailureToConsoleAndExit(\n `The Zuplo CLI requires at least node.js v${MIN_NODE_VERSION}. You are using v${process.versions.node}. Please update your version of node.js.\n\n Consider using a Node.js version manager such as https://github.com/nvm-sh/nvm.`\n );\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { Argv } from "yargs";
2
+ declare const _default: {
3
+ desc: string;
4
+ command: string;
5
+ builder: (yargs: Argv) => Argv<unknown>;
6
+ handler: (argv: unknown) => Promise<void>;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cmds/custom-domain/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAgBV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBA8Df,OAAO;;AAjE/B,wBA0EE"}
@@ -0,0 +1,82 @@
1
+ import { captureEvent } from "../../common/analytics/lib.js";
2
+ import { authenticate } from "../../common/middleware/authentication.js";
3
+ import { fetchAccount } from "../../common/middleware/get-account-param.js";
4
+ import { configure } from "../../common/middleware/user-configuration.js";
5
+ import { identify } from "../../common/middleware/user-identification.js";
6
+ import setBlocking from "../../common/output.js";
7
+ import { create } from "../../custom-domain/create/handler.js";
8
+ export default {
9
+ desc: "Creates a custom domain in your account",
10
+ command: "create",
11
+ builder: (yargs) => {
12
+ return yargs
13
+ .usage("$0 custom-domain create --hostname <hostname> [options]")
14
+ .option("hostname", {
15
+ type: "string",
16
+ describe: "The hostname for the custom domain",
17
+ })
18
+ .option("deployment-name", {
19
+ type: "string",
20
+ describe: "The deployment name to assign the custom domain to",
21
+ })
22
+ .option("custom-domain-type", {
23
+ type: "string",
24
+ describe: "The type of custom domain to create. Defaults to api server-side.",
25
+ choices: ["api", "dev-portal"],
26
+ })
27
+ .option("api-key", {
28
+ type: "string",
29
+ describe: "The API Key from Zuplo",
30
+ envVar: "API_KEY",
31
+ alias: "apikey",
32
+ })
33
+ .option("account", {
34
+ type: "string",
35
+ describe: "The account name",
36
+ })
37
+ .option("output", {
38
+ type: "string",
39
+ alias: "o",
40
+ describe: "Output format",
41
+ choices: ["default", "json"],
42
+ default: "default",
43
+ })
44
+ .demandOption(["hostname"])
45
+ .demandOption("api-key", "You must provide an API key with --api-key")
46
+ .example([
47
+ [
48
+ "$0 custom-domain create --hostname api.example.com",
49
+ "Create an unassigned custom domain",
50
+ ],
51
+ [
52
+ "$0 custom-domain create --hostname api.example.com --output json",
53
+ "Create a custom domain and output the result as JSON",
54
+ ],
55
+ [
56
+ "$0 custom-domain create --hostname api.example.com --deployment-name production-deployment",
57
+ "Create and assign a custom domain to a deployment",
58
+ ],
59
+ [
60
+ "$0 custom-domain create --hostname docs.example.com --deployment-name production-deployment --custom-domain-type dev-portal --account my-account",
61
+ "Create a dev portal custom domain on a specific account",
62
+ ],
63
+ ])
64
+ .middleware([
65
+ setBlocking,
66
+ authenticate,
67
+ configure,
68
+ fetchAccount,
69
+ identify,
70
+ ]);
71
+ },
72
+ handler: async (argv) => {
73
+ await captureEvent({ argv, event: "zuplo custom-domain create" });
74
+ const commandArguments = argv;
75
+ const handlerArguments = {
76
+ ...commandArguments,
77
+ stage: commandArguments["custom-domain-type"],
78
+ };
79
+ await create(handlerArguments);
80
+ },
81
+ };
82
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/cmds/custom-domain/create.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAM1E,eAAe;IACb,IAAI,EAAE,yCAAyC;IAC/C,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,KAAK,CAAC,yDAAyD,CAAC;aAChE,MAAM,CAAC,UAAU,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,oCAAoC;SAC/C,CAAC;aACD,MAAM,CAAC,iBAAiB,EAAE;YACzB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,oDAAoD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AC9C,CAAC;QACF,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACjC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, create } from \"../../custom-domain/create/handler.js\";\n\ninterface CommandArguments extends Omit<Arguments, \"stage\"> {\n \"custom-domain-type\"?: Arguments[\"stage\"];\n}\n\nexport default {\n desc: \"Creates a custom domain in your account\",\n command: \"create\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .usage(\"$0 custom-domain create --hostname <hostname> [options]\")\n .option(\"hostname\", {\n type: \"string\",\n describe: \"The hostname for the custom domain\",\n })\n .option(\"deployment-name\", {\n type: \"string\",\n describe: \"The deployment name to assign the custom domain to\",\n })\n .option(\"custom-domain-type\", {\n type: \"string\",\n describe:\n \"The type of custom domain to create. Defaults to api server-side.\",\n choices: [\"api\", \"dev-portal\"],\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n alias: \"apikey\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"output\", {\n type: \"string\",\n alias: \"o\",\n describe: \"Output format\",\n choices: [\"default\", \"json\"],\n default: \"default\",\n })\n .demandOption([\"hostname\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .example([\n [\n \"$0 custom-domain create --hostname api.example.com\",\n \"Create an unassigned custom domain\",\n ],\n [\n \"$0 custom-domain create --hostname api.example.com --output json\",\n \"Create a custom domain and output the result as JSON\",\n ],\n [\n \"$0 custom-domain create --hostname api.example.com --deployment-name production-deployment\",\n \"Create and assign a custom domain to a deployment\",\n ],\n [\n \"$0 custom-domain create --hostname docs.example.com --deployment-name production-deployment --custom-domain-type dev-portal --account my-account\",\n \"Create a dev portal custom domain on a specific account\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo custom-domain create\" });\n const commandArguments = argv as CommandArguments;\n const handlerArguments: Arguments = {\n ...commandArguments,\n stage: commandArguments[\"custom-domain-type\"],\n };\n await create(handlerArguments);\n },\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { Argv } from "yargs";
2
+ declare const _default: {
3
+ desc: string;
4
+ command: string;
5
+ builder: (yargs: Argv) => Argv<unknown>;
6
+ handler: (argv: unknown) => Promise<void>;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/cmds/custom-domain/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAeV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAyDf,OAAO;;AA5D/B,wBAgEE"}
@@ -0,0 +1,72 @@
1
+ import { captureEvent } from "../../common/analytics/lib.js";
2
+ import { authenticate } from "../../common/middleware/authentication.js";
3
+ import { fetchAccount } from "../../common/middleware/get-account-param.js";
4
+ import { configure } from "../../common/middleware/user-configuration.js";
5
+ import { identify } from "../../common/middleware/user-identification.js";
6
+ import setBlocking from "../../common/output.js";
7
+ import { deleteCustomDomain, } from "../../custom-domain/delete/handler.js";
8
+ export default {
9
+ desc: "Deletes a custom domain in your account",
10
+ command: "delete",
11
+ builder: (yargs) => {
12
+ return yargs
13
+ .usage("$0 custom-domain delete --hostname <hostname> [options]")
14
+ .option("hostname", {
15
+ type: "string",
16
+ describe: "The hostname for the custom domain",
17
+ })
18
+ .option("deployment-name", {
19
+ type: "string",
20
+ describe: "The deployment name for assigned domains. Required when the hostname is assigned to multiple deployments.",
21
+ })
22
+ .option("api-key", {
23
+ type: "string",
24
+ describe: "The API Key from Zuplo",
25
+ envVar: "API_KEY",
26
+ alias: "apikey",
27
+ })
28
+ .option("account", {
29
+ type: "string",
30
+ describe: "The account name",
31
+ })
32
+ .option("output", {
33
+ type: "string",
34
+ alias: "o",
35
+ describe: "Output format",
36
+ choices: ["default", "json"],
37
+ default: "default",
38
+ })
39
+ .demandOption(["hostname"])
40
+ .demandOption("api-key", "You must provide an API key with --api-key")
41
+ .example([
42
+ [
43
+ "$0 custom-domain delete --hostname api.example.com",
44
+ "Delete an unassigned custom domain or auto-resolve a single deployment assignment",
45
+ ],
46
+ [
47
+ "$0 custom-domain delete --hostname api.example.com --output json",
48
+ "Delete a custom domain and output the result as JSON",
49
+ ],
50
+ [
51
+ "$0 custom-domain delete --hostname api.example.com --deployment-name production-deployment",
52
+ "Delete a deployment-assigned custom domain explicitly",
53
+ ],
54
+ [
55
+ "$0 custom-domain delete --hostname docs.example.com --deployment-name portal-deployment --account my-account",
56
+ "Delete a custom domain from a specific account",
57
+ ],
58
+ ])
59
+ .middleware([
60
+ setBlocking,
61
+ authenticate,
62
+ configure,
63
+ fetchAccount,
64
+ identify,
65
+ ]);
66
+ },
67
+ handler: async (argv) => {
68
+ await captureEvent({ argv, event: "zuplo custom-domain delete" });
69
+ await deleteCustomDomain(argv);
70
+ },
71
+ };
72
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/cmds/custom-domain/delete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gDA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ACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC,CAAC;QAClE,MAAM,kBAAkB,CAAC,IAAiB,CAAC,CAAC;IAC9C,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport {\n Arguments,\n deleteCustomDomain,\n} from \"../../custom-domain/delete/handler.js\";\n\nexport default {\n desc: \"Deletes a custom domain in your account\",\n command: \"delete\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .usage(\"$0 custom-domain delete --hostname <hostname> [options]\")\n .option(\"hostname\", {\n type: \"string\",\n describe: \"The hostname for the custom domain\",\n })\n .option(\"deployment-name\", {\n type: \"string\",\n describe:\n \"The deployment name for assigned domains. Required when the hostname is assigned to multiple deployments.\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n alias: \"apikey\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"output\", {\n type: \"string\",\n alias: \"o\",\n describe: \"Output format\",\n choices: [\"default\", \"json\"],\n default: \"default\",\n })\n .demandOption([\"hostname\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .example([\n [\n \"$0 custom-domain delete --hostname api.example.com\",\n \"Delete an unassigned custom domain or auto-resolve a single deployment assignment\",\n ],\n [\n \"$0 custom-domain delete --hostname api.example.com --output json\",\n \"Delete a custom domain and output the result as JSON\",\n ],\n [\n \"$0 custom-domain delete --hostname api.example.com --deployment-name production-deployment\",\n \"Delete a deployment-assigned custom domain explicitly\",\n ],\n [\n \"$0 custom-domain delete --hostname docs.example.com --deployment-name portal-deployment --account my-account\",\n \"Delete a custom domain from a specific account\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo custom-domain delete\" });\n await deleteCustomDomain(argv as Arguments);\n },\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import { CommandModule } from "yargs";
2
+ declare const commands: CommandModule;
3
+ export default commands;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cmds/custom-domain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC,QAAA,MAAM,QAAQ,EAAE,aAYf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { groupHandler } from "../../common/handler.js";
2
+ import create from "./create.js";
3
+ import deleteCustomDomain from "./delete.js";
4
+ import list from "./list.js";
5
+ import update from "./update.js";
6
+ const commands = {
7
+ describe: "Custom domain commands",
8
+ command: "custom-domain",
9
+ builder: (yargs) => {
10
+ return yargs
11
+ .command(create)
12
+ .command(deleteCustomDomain)
13
+ .command(list)
14
+ .command(update)
15
+ .help();
16
+ },
17
+ handler: groupHandler,
18
+ };
19
+ export default commands;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cmds/custom-domain/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,kBAAkB,MAAM,aAAa,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,QAAQ,GAAkB;IAC9B,QAAQ,EAAE,wBAAwB;IAClC,OAAO,EAAE,eAAe;IACxB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QACjB,OAAO,KAAK;aACT,OAAO,CAAC,MAAM,CAAC;aACf,OAAO,CAAC,kBAAkB,CAAC;aAC3B,OAAO,CAAC,IAAI,CAAC;aACb,OAAO,CAAC,MAAM,CAAC;aACf,IAAI,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { CommandModule } from \"yargs\";\nimport { groupHandler } from \"../../common/handler.js\";\nimport create from \"./create.js\";\nimport deleteCustomDomain from \"./delete.js\";\nimport list from \"./list.js\";\nimport update from \"./update.js\";\n\nconst commands: CommandModule = {\n describe: \"Custom domain commands\",\n command: \"custom-domain\",\n builder: (yargs) => {\n return yargs\n .command(create)\n .command(deleteCustomDomain)\n .command(list)\n .command(update)\n .help();\n },\n handler: groupHandler,\n};\n\nexport default commands;\n"]}
@@ -0,0 +1,9 @@
1
+ import { Argv } from "yargs";
2
+ declare const _default: {
3
+ desc: string;
4
+ command: string;
5
+ builder: (yargs: Argv) => Argv<unknown>;
6
+ handler: (argv: unknown) => Promise<void>;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cmds/custom-domain/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAwCf,OAAO;;AA3C/B,wBA+CE"}
@@ -0,0 +1,56 @@
1
+ import { captureEvent } from "../../common/analytics/lib.js";
2
+ import { authenticate } from "../../common/middleware/authentication.js";
3
+ import { fetchAccount } from "../../common/middleware/get-account-param.js";
4
+ import { configure } from "../../common/middleware/user-configuration.js";
5
+ import { identify } from "../../common/middleware/user-identification.js";
6
+ import setBlocking from "../../common/output.js";
7
+ import { list } from "../../custom-domain/list/handler.js";
8
+ export default {
9
+ desc: "Lists the custom domains in your account",
10
+ command: "list",
11
+ builder: (yargs) => {
12
+ return yargs
13
+ .usage("$0 custom-domain list [options]")
14
+ .option("api-key", {
15
+ type: "string",
16
+ describe: "The API Key from Zuplo",
17
+ envVar: "API_KEY",
18
+ alias: "apikey",
19
+ })
20
+ .option("account", {
21
+ type: "string",
22
+ describe: "The account name",
23
+ })
24
+ .option("output", {
25
+ type: "string",
26
+ alias: "o",
27
+ describe: "Output format",
28
+ choices: ["default", "json"],
29
+ default: "default",
30
+ })
31
+ .demandOption("api-key", "You must provide an API key with --api-key")
32
+ .example([
33
+ ["$0 custom-domain list", "List all custom domains"],
34
+ [
35
+ "$0 custom-domain list --output json",
36
+ "List all custom domains as JSON",
37
+ ],
38
+ [
39
+ "$0 custom-domain list --account my-account",
40
+ "Explicitly specify the account",
41
+ ],
42
+ ])
43
+ .middleware([
44
+ setBlocking,
45
+ authenticate,
46
+ configure,
47
+ fetchAccount,
48
+ identify,
49
+ ]);
50
+ },
51
+ handler: async (argv) => {
52
+ await captureEvent({ argv, event: "zuplo custom-domain list" });
53
+ await list(argv);
54
+ },
55
+ };
56
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cmds/custom-domain/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,IAAI,EAAE,MAAM,qCAAqC,CAAC;AAEtE,eAAe;IACb,IAAI,EAAE,0CAA0C;IAChD,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,KAAK,CAAC,iCAAiC,CAAC;aACxC,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,QAAQ;SAChB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;YAC5B,OAAO,EAAE,SAAS;SACnB,CAAC;aACD,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,OAAO,CAAC;YACP,CAAC,uBAAuB,EAAE,yBAAyB,CAAC;YACpD;gBACE,qCAAqC;gBACrC,iCAAiC;aAClC;YACD;gBACE,4CAA4C;gBAC5C,gCAAgC;aACjC;SACF,CAAC;aACD,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,IAAiB,CAAC,CAAC;IAChC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, list } from \"../../custom-domain/list/handler.js\";\n\nexport default {\n desc: \"Lists the custom domains in your account\",\n command: \"list\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .usage(\"$0 custom-domain list [options]\")\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n alias: \"apikey\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"output\", {\n type: \"string\",\n alias: \"o\",\n describe: \"Output format\",\n choices: [\"default\", \"json\"],\n default: \"default\",\n })\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .example([\n [\"$0 custom-domain list\", \"List all custom domains\"],\n [\n \"$0 custom-domain list --output json\",\n \"List all custom domains as JSON\",\n ],\n [\n \"$0 custom-domain list --account my-account\",\n \"Explicitly specify the account\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo custom-domain list\" });\n await list(argv as Arguments);\n },\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import { Argv } from "yargs";
2
+ declare const _default: {
3
+ desc: string;
4
+ command: string;
5
+ builder: (yargs: Argv) => Argv<unknown>;
6
+ handler: (argv: unknown) => Promise<void>;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cmds/custom-domain/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;;;;qBAYV,IAAI,KAAG,IAAI,CAAC,OAAO,CAAC;oBAyDf,OAAO;;AA5D/B,wBAgEE"}
@@ -0,0 +1,72 @@
1
+ import { captureEvent } from "../../common/analytics/lib.js";
2
+ import { authenticate } from "../../common/middleware/authentication.js";
3
+ import { fetchAccount } from "../../common/middleware/get-account-param.js";
4
+ import { configure } from "../../common/middleware/user-configuration.js";
5
+ import { identify } from "../../common/middleware/user-identification.js";
6
+ import setBlocking from "../../common/output.js";
7
+ import { update } from "../../custom-domain/update/handler.js";
8
+ export default {
9
+ desc: "Updates the deployment assignment for a custom domain",
10
+ command: "update",
11
+ builder: (yargs) => {
12
+ return yargs
13
+ .usage("$0 custom-domain update --hostname <hostname> [options]")
14
+ .option("hostname", {
15
+ type: "string",
16
+ describe: "The hostname for the custom domain",
17
+ })
18
+ .option("deployment-name", {
19
+ type: "string",
20
+ describe: "The deployment name to assign the custom domain to. Omit to detach the current assignment.",
21
+ })
22
+ .option("api-key", {
23
+ type: "string",
24
+ describe: "The API Key from Zuplo",
25
+ envVar: "API_KEY",
26
+ alias: "apikey",
27
+ })
28
+ .option("account", {
29
+ type: "string",
30
+ describe: "The account name",
31
+ })
32
+ .option("output", {
33
+ type: "string",
34
+ alias: "o",
35
+ describe: "Output format",
36
+ choices: ["default", "json"],
37
+ default: "default",
38
+ })
39
+ .demandOption(["hostname"])
40
+ .demandOption("api-key", "You must provide an API key with --api-key")
41
+ .example([
42
+ [
43
+ "$0 custom-domain update --hostname api.example.com --deployment-name production-deployment",
44
+ "Reassign a custom domain to a deployment",
45
+ ],
46
+ [
47
+ "$0 custom-domain update --hostname api.example.com --output json",
48
+ "Update a custom domain and output the result as JSON",
49
+ ],
50
+ [
51
+ "$0 custom-domain update --hostname api.example.com",
52
+ "Detach the current deployment assignment while preserving the stage",
53
+ ],
54
+ [
55
+ "$0 custom-domain update --hostname docs.example.com --deployment-name portal-deployment --account my-account",
56
+ "Update a custom domain on a specific account",
57
+ ],
58
+ ])
59
+ .middleware([
60
+ setBlocking,
61
+ authenticate,
62
+ configure,
63
+ fetchAccount,
64
+ identify,
65
+ ]);
66
+ },
67
+ handler: async (argv) => {
68
+ await captureEvent({ argv, event: "zuplo custom-domain update" });
69
+ await update(argv);
70
+ },
71
+ };
72
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cmds/custom-domain/update.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,gDAAgD,CAAC;AAC1E,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAa,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE1E,eAAe;IACb,IAAI,EAAE,uDAAuD;IAC7D,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,CAAC,KAAW,EAAiB,EAAE;QACtC,OAAO,KAAK;aACT,KAAK,CAAC,yDAAyD,CAAC;aAChE,MAAM,CAAC,UAAU,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,oCAAoC;SAC/C,CAAC;aACD,MAAM,CAAC,iBAAiB,EAAE;YACzB,IAAI,EAAE,QAAQ;YACd,QAAQ,EACN,4FAA4F;SAC/F,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,wBAAwB;YAClC,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,QAAQ;SAChB,CAAC;aACD,MAAM,CAAC,SAAS,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;aACD,MAAM,CAAC,QAAQ,EAAE;YAChB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC;YAC5B,OAAO,EAAE,SAAS;SACnB,CAAC;aACD,YAAY,CAAC,CAAC,UAAU,CAAC,CAAC;aAC1B,YAAY,CAAC,SAAS,EAAE,4CAA4C,CAAC;aACrE,OAAO,CAAC;YACP;gBACE,4FAA4F;gBAC5F,0CAA0C;aAC3C;YACD;gBACE,kEAAkE;gBAClE,sDAAsD;aACvD;YACD;gBACE,oDAAoD;gBACpD,qEAAqE;aACtE;YACD;gBACE,8GAA8G;gBAC9G,8CAA8C;aAC/C;SACF,CAAC;aACD,UAAU,CAAC;YACV,WAAW;YACX,YAAY;YACZ,SAAS;YACT,YAAY;YACZ,QAAQ;SACT,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC,CAAC;QAClE,MAAM,MAAM,CAAC,IAAiB,CAAC,CAAC;IAClC,CAAC;CACF,CAAC","sourcesContent":["import { Argv } from \"yargs\";\nimport { captureEvent } from \"../../common/analytics/lib.js\";\nimport { authenticate } from \"../../common/middleware/authentication.js\";\nimport { fetchAccount } from \"../../common/middleware/get-account-param.js\";\nimport { configure } from \"../../common/middleware/user-configuration.js\";\nimport { identify } from \"../../common/middleware/user-identification.js\";\nimport setBlocking from \"../../common/output.js\";\nimport { Arguments, update } from \"../../custom-domain/update/handler.js\";\n\nexport default {\n desc: \"Updates the deployment assignment for a custom domain\",\n command: \"update\",\n builder: (yargs: Argv): Argv<unknown> => {\n return yargs\n .usage(\"$0 custom-domain update --hostname <hostname> [options]\")\n .option(\"hostname\", {\n type: \"string\",\n describe: \"The hostname for the custom domain\",\n })\n .option(\"deployment-name\", {\n type: \"string\",\n describe:\n \"The deployment name to assign the custom domain to. Omit to detach the current assignment.\",\n })\n .option(\"api-key\", {\n type: \"string\",\n describe: \"The API Key from Zuplo\",\n envVar: \"API_KEY\",\n alias: \"apikey\",\n })\n .option(\"account\", {\n type: \"string\",\n describe: \"The account name\",\n })\n .option(\"output\", {\n type: \"string\",\n alias: \"o\",\n describe: \"Output format\",\n choices: [\"default\", \"json\"],\n default: \"default\",\n })\n .demandOption([\"hostname\"])\n .demandOption(\"api-key\", \"You must provide an API key with --api-key\")\n .example([\n [\n \"$0 custom-domain update --hostname api.example.com --deployment-name production-deployment\",\n \"Reassign a custom domain to a deployment\",\n ],\n [\n \"$0 custom-domain update --hostname api.example.com --output json\",\n \"Update a custom domain and output the result as JSON\",\n ],\n [\n \"$0 custom-domain update --hostname api.example.com\",\n \"Detach the current deployment assignment while preserving the stage\",\n ],\n [\n \"$0 custom-domain update --hostname docs.example.com --deployment-name portal-deployment --account my-account\",\n \"Update a custom domain on a specific account\",\n ],\n ])\n .middleware([\n setBlocking,\n authenticate,\n configure,\n fetchAccount,\n identify,\n ]);\n },\n handler: async (argv: unknown) => {\n await captureEvent({ argv, event: \"zuplo custom-domain update\" });\n await update(argv as Arguments);\n },\n};\n"]}
@@ -10,6 +10,7 @@ export declare function printCriticalFailureToConsoleAndExit(
10
10
  spinner?: Ora
11
11
  ): Promise<void>;
12
12
  export declare function printResultToConsole(message?: any): void;
13
+ export declare function printJsonToConsole(value?: unknown): void;
13
14
  export declare function printTableToConsole(table: any): void;
14
15
  export declare function printResultToConsoleAndExitGracefully(
15
16
  message?: any,
@@ -18,6 +19,9 @@ export declare function printResultToConsoleAndExitGracefully(
18
19
  export declare function printTableToConsoleAndExitGracefully(
19
20
  table: any
20
21
  ): Promise<void>;
22
+ export declare function printJsonToConsoleAndExitGracefully(
23
+ value?: unknown
24
+ ): Promise<void>;
21
25
  export default function setBlocking(): void;
22
26
  export declare function textOrJson(text: string): any;
23
27
  export declare class ConsoleOutput {
@@ -1 +1 @@
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,CAA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BAAgB,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;AAED,wBAAsB,mCAAmC,CAAC,KAAK,CAAC,EAAE,OAAO,iBAKxE;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"}
@@ -41,6 +41,9 @@ export async function printCriticalFailureToConsoleAndExit(message, spinner) {
41
41
  export function printResultToConsole(message) {
42
42
  console.log(chalk.bold.green(message));
43
43
  }
44
+ export function printJsonToConsole(value) {
45
+ console.log(JSON.stringify(value, null, 2));
46
+ }
44
47
  export function printTableToConsole(table) {
45
48
  console.table(table);
46
49
  }
@@ -61,6 +64,12 @@ export async function printTableToConsoleAndExitGracefully(table) {
61
64
  process.exit(0);
62
65
  });
63
66
  }
67
+ export async function printJsonToConsoleAndExitGracefully(value) {
68
+ printJsonToConsole(value);
69
+ await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
70
+ process.exit(0);
71
+ });
72
+ }
64
73
  export default function setBlocking() {
65
74
  if (typeof process === "undefined")
66
75
  return;
@@ -1 +1 @@
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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OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,OAAuC,CAAC;QACvD,IACE,MAAM,CAAC,OAAO;YACd,MAAM,CAAC,KAAK;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU,EAChD,CAAC;YACD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,OAAO,aAAa;IACxB,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC;QACb,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,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
+ {"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,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E,OAAO;IAC3C,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,OAAuC,CAAC;QACvD,IACE,MAAM,CAAC,OAAO;YACd,MAAM,CAAC,KAAK;YACZ,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU,EAChD,CAAC;YACD,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,OAAO,aAAa;IACxB,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC;QACb,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,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\nexport function printJsonToConsole(value?: unknown) {\n console.log(JSON.stringify(value, null, 2));\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\nexport async function printJsonToConsoleAndExitGracefully(value?: unknown) {\n printJsonToConsole(value);\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"]}