@zuplo/cli 7.10.0 → 7.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/worker-output.d.ts +7 -0
- package/dist/common/worker-output.d.ts.map +1 -1
- package/dist/common/worker-output.js +39 -0
- package/dist/common/worker-output.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@hono/node-server/README.md +2 -0
- package/node_modules/@hono/node-server/dist/index.cjs +1 -1
- package/node_modules/@hono/node-server/dist/index.mjs +1 -1
- package/node_modules/@hono/node-server/dist/serve-static.cjs +2 -1
- package/node_modules/@hono/node-server/dist/serve-static.mjs +2 -1
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.d.ts +9 -0
- package/node_modules/@posthog/core/dist/metrics/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/metrics/index.js +38 -3
- package/node_modules/@posthog/core/dist/metrics/index.mjs +38 -3
- package/node_modules/@posthog/core/dist/metrics/types.d.ts +7 -2
- package/node_modules/@posthog/core/dist/metrics/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/traces/ids.js +2 -2
- package/node_modules/@posthog/core/dist/traces/ids.mjs +2 -2
- package/node_modules/@posthog/core/dist/types.d.ts +1 -1
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/package.json +4 -3
- package/node_modules/@posthog/core/src/metrics/index.spec.ts +75 -0
- package/node_modules/@posthog/core/src/metrics/index.ts +60 -0
- package/node_modules/@posthog/core/src/metrics/types.ts +7 -1
- package/node_modules/@posthog/core/src/traces/ids.ts +4 -2
- package/node_modules/@posthog/core/src/types.ts +1 -1
- package/node_modules/@posthog/types/dist/capture-metric.d.ts +10 -0
- package/node_modules/@posthog/types/dist/capture-metric.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/capture.d.ts +1 -1
- package/node_modules/@posthog/types/dist/capture.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture-metric.ts +11 -0
- package/node_modules/@posthog/types/src/capture.ts +1 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +272 -261
- package/node_modules/@zuplo/core/index.minified.js +276 -265
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +5 -2
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js → chunk-CDEAY3VY.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js +37 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-LVSZ3WTO.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js → chunk-NUVXDVLJ.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js → chunk-RHU3Z7DA.js} +108 -108
- package/node_modules/@zuplo/runtime/out/esm/chunk-RHU3Z7DA.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +15 -24
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +14 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/package.json +15 -12
- package/dist/__tests__/archive-utils.test.d.ts +0 -2
- package/dist/__tests__/archive-utils.test.d.ts.map +0 -1
- package/dist/__tests__/archive-utils.test.js +0 -50
- package/dist/__tests__/archive-utils.test.js.map +0 -1
- package/dist/__tests__/import-openapi.test.d.ts +0 -2
- package/dist/__tests__/import-openapi.test.d.ts.map +0 -1
- package/dist/__tests__/import-openapi.test.js +0 -251
- package/dist/__tests__/import-openapi.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-linked-config.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js +0 -202
- package/dist/__tests__/integration/confirm-linked-config.integration.test.js.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js +0 -184
- package/dist/__tests__/integration/confirm-production-deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/custom-domain.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/custom-domain.integration.test.js +0 -563
- package/dist/__tests__/integration/custom-domain.integration.test.js.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/delete.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/delete.integration.test.js +0 -262
- package/dist/__tests__/integration/delete.integration.test.js.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/deploy.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/deploy.integration.test.js +0 -519
- package/dist/__tests__/integration/deploy.integration.test.js.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/get-project-param.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/get-project-param.integration.test.js +0 -305
- package/dist/__tests__/integration/get-project-param.integration.test.js.map +0 -1
- package/dist/__tests__/integration/info.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/info.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/info.integration.test.js +0 -293
- package/dist/__tests__/integration/info.integration.test.js.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-mocks-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-mocks-setup.js +0 -104
- package/dist/__tests__/integration/jest-mocks-setup.js.map +0 -1
- package/dist/__tests__/integration/jest-setup.d.ts +0 -2
- package/dist/__tests__/integration/jest-setup.d.ts.map +0 -1
- package/dist/__tests__/integration/jest-setup.js +0 -12
- package/dist/__tests__/integration/jest-setup.js.map +0 -1
- package/dist/__tests__/integration/link.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/link.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/link.integration.test.js +0 -395
- package/dist/__tests__/integration/link.integration.test.js.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/linked-config-cascade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js +0 -179
- package/dist/__tests__/integration/linked-config-cascade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/list.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/list.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/list.integration.test.js +0 -300
- package/dist/__tests__/integration/list.integration.test.js.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/source-upgrade.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/source-upgrade.integration.test.js +0 -100
- package/dist/__tests__/integration/source-upgrade.integration.test.js.map +0 -1
- package/dist/__tests__/integration/test-utils.d.ts +0 -30
- package/dist/__tests__/integration/test-utils.d.ts.map +0 -1
- package/dist/__tests__/integration/test-utils.js +0 -82
- package/dist/__tests__/integration/test-utils.js.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/tunnel.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/tunnel.integration.test.js +0 -486
- package/dist/__tests__/integration/tunnel.integration.test.js.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/variable.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/variable.integration.test.js +0 -258
- package/dist/__tests__/integration/variable.integration.test.js.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.d.ts +0 -2
- package/dist/__tests__/integration/whoami.integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration/whoami.integration.test.js +0 -116
- package/dist/__tests__/integration/whoami.integration.test.js.map +0 -1
- package/dist/__tests__/outdated.test.d.ts +0 -2
- package/dist/__tests__/outdated.test.d.ts.map +0 -1
- package/dist/__tests__/outdated.test.js +0 -67
- package/dist/__tests__/outdated.test.js.map +0 -1
- package/dist/__tests__/populate.test.d.ts +0 -2
- package/dist/__tests__/populate.test.d.ts.map +0 -1
- package/dist/__tests__/populate.test.js +0 -445
- package/dist/__tests__/populate.test.js.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.d.ts +0 -2
- package/dist/__tests__/tsconfig-upgrader.test.d.ts.map +0 -1
- package/dist/__tests__/tsconfig-upgrader.test.js +0 -31
- package/dist/__tests__/tsconfig-upgrader.test.js.map +0 -1
- package/dist/ca-certificate/validation.test.d.ts +0 -2
- package/dist/ca-certificate/validation.test.d.ts.map +0 -1
- package/dist/ca-certificate/validation.test.js +0 -131
- package/dist/ca-certificate/validation.test.js.map +0 -1
- package/dist/common/analytics/cli-invocation.test.d.ts +0 -2
- package/dist/common/analytics/cli-invocation.test.d.ts.map +0 -1
- package/dist/common/analytics/cli-invocation.test.js +0 -51
- package/dist/common/analytics/cli-invocation.test.js.map +0 -1
- package/dist/common/analytics/package-manager.test.d.ts +0 -2
- package/dist/common/analytics/package-manager.test.d.ts.map +0 -1
- package/dist/common/analytics/package-manager.test.js +0 -163
- package/dist/common/analytics/package-manager.test.js.map +0 -1
- package/dist/common/cli-dispatcher.test.d.ts +0 -2
- package/dist/common/cli-dispatcher.test.d.ts.map +0 -1
- package/dist/common/cli-dispatcher.test.js +0 -80
- package/dist/common/cli-dispatcher.test.js.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/middleware/check-pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/middleware/check-pnpm-lifecycle.test.js +0 -125
- package/dist/common/middleware/check-pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/middleware/get-environment-param.test.d.ts +0 -2
- package/dist/common/middleware/get-environment-param.test.d.ts.map +0 -1
- package/dist/common/middleware/get-environment-param.test.js +0 -57
- package/dist/common/middleware/get-environment-param.test.js.map +0 -1
- package/dist/common/read-linked-config.test.d.ts +0 -2
- package/dist/common/read-linked-config.test.d.ts.map +0 -1
- package/dist/common/read-linked-config.test.js +0 -363
- package/dist/common/read-linked-config.test.js.map +0 -1
- package/dist/common/terminal.test.d.ts +0 -2
- package/dist/common/terminal.test.d.ts.map +0 -1
- package/dist/common/terminal.test.js +0 -101
- package/dist/common/terminal.test.js.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts +0 -2
- package/dist/common/utils/build-environment-prompt-choices.test.d.ts.map +0 -1
- package/dist/common/utils/build-environment-prompt-choices.test.js +0 -97
- package/dist/common/utils/build-environment-prompt-choices.test.js.map +0 -1
- package/dist/common/utils/format-environment-type.test.d.ts +0 -2
- package/dist/common/utils/format-environment-type.test.d.ts.map +0 -1
- package/dist/common/utils/format-environment-type.test.js +0 -32
- package/dist/common/utils/format-environment-type.test.js.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.d.ts +0 -2
- package/dist/common/utils/pnpm-lifecycle.test.d.ts.map +0 -1
- package/dist/common/utils/pnpm-lifecycle.test.js +0 -196
- package/dist/common/utils/pnpm-lifecycle.test.js.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts +0 -2
- package/dist/common/utils/pretty-print-environment-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/pretty-print-environment-prompt.test.js +0 -42
- package/dist/common/utils/pretty-print-environment-prompt.test.js.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts +0 -2
- package/dist/common/utils/sort-environments-for-prompt.test.d.ts.map +0 -1
- package/dist/common/utils/sort-environments-for-prompt.test.js +0 -82
- package/dist/common/utils/sort-environments-for-prompt.test.js.map +0 -1
- package/dist/common/utils/stringify-config.test.d.ts +0 -2
- package/dist/common/utils/stringify-config.test.d.ts.map +0 -1
- package/dist/common/utils/stringify-config.test.js +0 -80
- package/dist/common/utils/stringify-config.test.js.map +0 -1
- package/dist/common/validators/argument-validators.spec.d.ts +0 -2
- package/dist/common/validators/argument-validators.spec.d.ts.map +0 -1
- package/dist/common/validators/argument-validators.spec.js +0 -181
- package/dist/common/validators/argument-validators.spec.js.map +0 -1
- package/dist/deploy/archive.local-registry.test.d.ts +0 -2
- package/dist/deploy/archive.local-registry.test.d.ts.map +0 -1
- package/dist/deploy/archive.local-registry.test.js +0 -100
- package/dist/deploy/archive.local-registry.test.js.map +0 -1
- package/dist/deploy/archive.test.d.ts +0 -2
- package/dist/deploy/archive.test.d.ts.map +0 -1
- package/dist/deploy/archive.test.js +0 -248
- package/dist/deploy/archive.test.js.map +0 -1
- package/dist/deploy/classify-build-probe.test.d.ts +0 -2
- package/dist/deploy/classify-build-probe.test.d.ts.map +0 -1
- package/dist/deploy/classify-build-probe.test.js +0 -51
- package/dist/deploy/classify-build-probe.test.js.map +0 -1
- package/dist/deploy/poll-deployment.test.d.ts +0 -2
- package/dist/deploy/poll-deployment.test.d.ts.map +0 -1
- package/dist/deploy/poll-deployment.test.js +0 -158
- package/dist/deploy/poll-deployment.test.js.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.d.ts +0 -2
- package/dist/dev/zuplo-local-gitignore.test.d.ts.map +0 -1
- package/dist/dev/zuplo-local-gitignore.test.js +0 -58
- package/dist/dev/zuplo-local-gitignore.test.js.map +0 -1
- package/dist/editor/e2e/editor.spec.d.ts +0 -2
- package/dist/editor/e2e/editor.spec.d.ts.map +0 -1
- package/dist/editor/e2e/editor.spec.js +0 -44
- package/dist/editor/e2e/editor.spec.js.map +0 -1
- package/dist/link/project-type.test.d.ts +0 -2
- package/dist/link/project-type.test.d.ts.map +0 -1
- package/dist/link/project-type.test.js +0 -225
- package/dist/link/project-type.test.js.map +0 -1
- package/dist/lint/resolve-binary.test.d.ts +0 -2
- package/dist/lint/resolve-binary.test.d.ts.map +0 -1
- package/dist/lint/resolve-binary.test.js +0 -155
- package/dist/lint/resolve-binary.test.js.map +0 -1
- package/dist/open-api/convert/handler.spec.d.ts +0 -2
- package/dist/open-api/convert/handler.spec.d.ts.map +0 -1
- package/dist/open-api/convert/handler.spec.js +0 -301
- package/dist/open-api/convert/handler.spec.js.map +0 -1
- package/dist/open-api/merge/handler.spec.d.ts +0 -2
- package/dist/open-api/merge/handler.spec.d.ts.map +0 -1
- package/dist/open-api/merge/handler.spec.js +0 -673
- package/dist/open-api/merge/handler.spec.js.map +0 -1
- package/dist/open-api/overlay/handler.spec.d.ts +0 -2
- package/dist/open-api/overlay/handler.spec.d.ts.map +0 -1
- package/dist/open-api/overlay/handler.spec.js +0 -346
- package/dist/open-api/overlay/handler.spec.js.map +0 -1
- package/dist/source/ai-gateway/files.test.d.ts +0 -2
- package/dist/source/ai-gateway/files.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/files.test.js +0 -135
- package/dist/source/ai-gateway/files.test.js.map +0 -1
- package/dist/source/ai-gateway/handler.test.d.ts +0 -2
- package/dist/source/ai-gateway/handler.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/handler.test.js +0 -113
- package/dist/source/ai-gateway/handler.test.js.map +0 -1
- package/dist/source/ai-gateway/package.test.d.ts +0 -2
- package/dist/source/ai-gateway/package.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/package.test.js +0 -30
- package/dist/source/ai-gateway/package.test.js.map +0 -1
- package/dist/source/ai-gateway/planner.test.d.ts +0 -2
- package/dist/source/ai-gateway/planner.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/planner.test.js +0 -330
- package/dist/source/ai-gateway/planner.test.js.map +0 -1
- package/dist/source/ai-gateway/release.test.d.ts +0 -2
- package/dist/source/ai-gateway/release.test.d.ts.map +0 -1
- package/dist/source/ai-gateway/release.test.js +0 -62
- package/dist/source/ai-gateway/release.test.js.map +0 -1
- package/dist/test/invoke-test.test.d.ts +0 -2
- package/dist/test/invoke-test.test.d.ts.map +0 -1
- package/dist/test/invoke-test.test.js +0 -150
- package/dist/test/invoke-test.test.js.map +0 -1
- package/dist/test/test-files.test.d.ts +0 -2
- package/dist/test/test-files.test.d.ts.map +0 -1
- package/dist/test/test-files.test.js +0 -57
- package/dist/test/test-files.test.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js +0 -289
- package/node_modules/@zuplo/openapi-tools/dist/file-format.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js +0 -181
- package/node_modules/@zuplo/openapi-tools/dist/merge-fixtures.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js +0 -399
- package/node_modules/@zuplo/openapi-tools/dist/merge.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js +0 -779
- package/node_modules/@zuplo/openapi-tools/dist/overlay.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js +0 -269
- package/node_modules/@zuplo/openapi-tools/dist/path-transform.spec.js.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts +0 -2
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.d.ts.map +0 -1
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js +0 -93
- package/node_modules/@zuplo/openapi-tools/dist/url-utils.spec.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-6YPRGG62.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js +0 -37
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ2BHVUH.js.map → chunk-CDEAY3VY.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-PBDT4FDO.js.LEGAL.txt → chunk-LVSZ3WTO.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-VTO3F6DK.js.map → chunk-NUVXDVLJ.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6YPRGG62.js.LEGAL.txt → chunk-RHU3Z7DA.js.LEGAL.txt} +0 -0
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert";
|
|
2
|
-
import fs from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { afterEach, beforeEach, describe, it } from "node:test";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { convertOpenAPI } from "./handler.js";
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
const testTmpPath = path.join(__dirname, "..", "..", "__tests__", "test-tmp", "convert-handler");
|
|
10
|
-
describe("Convert Handler", () => {
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
await fs.mkdir(testTmpPath, { recursive: true });
|
|
13
|
-
});
|
|
14
|
-
afterEach(async () => {
|
|
15
|
-
try {
|
|
16
|
-
await fs.rm(testTmpPath, { recursive: true, force: true });
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
describe("convertOpenAPI", () => {
|
|
22
|
-
it("should convert JSON to YAML using --format yaml", async () => {
|
|
23
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
24
|
-
const expectedOutputPath = path.join(testTmpPath, "api.yaml");
|
|
25
|
-
const inputDoc = {
|
|
26
|
-
openapi: "3.1.0",
|
|
27
|
-
info: {
|
|
28
|
-
title: "Test API",
|
|
29
|
-
version: "1.0.0",
|
|
30
|
-
},
|
|
31
|
-
paths: {},
|
|
32
|
-
};
|
|
33
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
34
|
-
await convertOpenAPI({
|
|
35
|
-
input: inputPath,
|
|
36
|
-
format: "yaml",
|
|
37
|
-
});
|
|
38
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
39
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
40
|
-
assert.strictEqual(outputContent.includes("title: Test API"), true);
|
|
41
|
-
});
|
|
42
|
-
it("should convert JSON to YAML using --yaml", async () => {
|
|
43
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
44
|
-
const expectedOutputPath = path.join(testTmpPath, "api.yaml");
|
|
45
|
-
const inputDoc = {
|
|
46
|
-
openapi: "3.1.0",
|
|
47
|
-
info: {
|
|
48
|
-
title: "Test API",
|
|
49
|
-
version: "1.0.0",
|
|
50
|
-
},
|
|
51
|
-
paths: {},
|
|
52
|
-
};
|
|
53
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
54
|
-
await convertOpenAPI({
|
|
55
|
-
input: inputPath,
|
|
56
|
-
yaml: true,
|
|
57
|
-
});
|
|
58
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
59
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
60
|
-
});
|
|
61
|
-
it("should convert YAML to JSON using --format json", async () => {
|
|
62
|
-
const inputPath = path.join(testTmpPath, "api.yaml");
|
|
63
|
-
const expectedOutputPath = path.join(testTmpPath, "api.json");
|
|
64
|
-
const inputDoc = `openapi: 3.1.0
|
|
65
|
-
info:
|
|
66
|
-
title: Test API
|
|
67
|
-
version: 1.0.0
|
|
68
|
-
paths: {}`;
|
|
69
|
-
await fs.writeFile(inputPath, inputDoc);
|
|
70
|
-
await convertOpenAPI({
|
|
71
|
-
input: inputPath,
|
|
72
|
-
format: "json",
|
|
73
|
-
});
|
|
74
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
75
|
-
const parsed = JSON.parse(outputContent);
|
|
76
|
-
assert.strictEqual(parsed.openapi, "3.1.0");
|
|
77
|
-
assert.strictEqual(parsed.info.title, "Test API");
|
|
78
|
-
});
|
|
79
|
-
it("should convert YAML to JSON using --json", async () => {
|
|
80
|
-
const inputPath = path.join(testTmpPath, "api.yml");
|
|
81
|
-
const expectedOutputPath = path.join(testTmpPath, "api.json");
|
|
82
|
-
const inputDoc = `openapi: 3.1.0
|
|
83
|
-
info:
|
|
84
|
-
title: Test API
|
|
85
|
-
version: 1.0.0
|
|
86
|
-
paths: {}`;
|
|
87
|
-
await fs.writeFile(inputPath, inputDoc);
|
|
88
|
-
await convertOpenAPI({
|
|
89
|
-
input: inputPath,
|
|
90
|
-
json: true,
|
|
91
|
-
});
|
|
92
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
93
|
-
const parsed = JSON.parse(outputContent);
|
|
94
|
-
assert.strictEqual(parsed.openapi, "3.1.0");
|
|
95
|
-
});
|
|
96
|
-
it("should handle files with multiple dots in name", async () => {
|
|
97
|
-
const inputPath = path.join(testTmpPath, "api.v1.0.json");
|
|
98
|
-
const expectedOutputPath = path.join(testTmpPath, "api.v1.0.yaml");
|
|
99
|
-
const inputDoc = {
|
|
100
|
-
openapi: "3.1.0",
|
|
101
|
-
info: {
|
|
102
|
-
title: "Test API",
|
|
103
|
-
version: "1.0.0",
|
|
104
|
-
},
|
|
105
|
-
paths: {},
|
|
106
|
-
};
|
|
107
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
108
|
-
await convertOpenAPI({
|
|
109
|
-
input: inputPath,
|
|
110
|
-
format: "yaml",
|
|
111
|
-
});
|
|
112
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
113
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
114
|
-
});
|
|
115
|
-
it("should preserve complex nested structures", async () => {
|
|
116
|
-
const inputPath = path.join(testTmpPath, "complex.json");
|
|
117
|
-
const expectedOutputPath = path.join(testTmpPath, "complex.yaml");
|
|
118
|
-
const inputDoc = {
|
|
119
|
-
openapi: "3.1.0",
|
|
120
|
-
info: {
|
|
121
|
-
title: "Complex API",
|
|
122
|
-
version: "1.0.0",
|
|
123
|
-
},
|
|
124
|
-
paths: {
|
|
125
|
-
"/users/{id}": {
|
|
126
|
-
get: {
|
|
127
|
-
parameters: [
|
|
128
|
-
{ name: "id", in: "path", required: true },
|
|
129
|
-
{ name: "fields", in: "query", required: false },
|
|
130
|
-
],
|
|
131
|
-
responses: {
|
|
132
|
-
"200": {
|
|
133
|
-
description: "Success",
|
|
134
|
-
content: {
|
|
135
|
-
"application/json": {
|
|
136
|
-
schema: {
|
|
137
|
-
type: "object",
|
|
138
|
-
properties: {
|
|
139
|
-
id: { type: "string" },
|
|
140
|
-
name: { type: "string" },
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
152
|
-
await convertOpenAPI({
|
|
153
|
-
input: inputPath,
|
|
154
|
-
format: "yaml",
|
|
155
|
-
});
|
|
156
|
-
await convertOpenAPI({
|
|
157
|
-
input: expectedOutputPath,
|
|
158
|
-
format: "json",
|
|
159
|
-
});
|
|
160
|
-
const finalContent = await fs.readFile(inputPath, "utf-8");
|
|
161
|
-
const finalDoc = JSON.parse(finalContent);
|
|
162
|
-
assert.deepStrictEqual(finalDoc, inputDoc);
|
|
163
|
-
});
|
|
164
|
-
it("should create output directory if it doesn't exist", async () => {
|
|
165
|
-
const inputPath = path.join(testTmpPath, "nested", "dir", "api.json");
|
|
166
|
-
const expectedOutputPath = path.join(testTmpPath, "nested", "dir", "api.yaml");
|
|
167
|
-
const inputDoc = {
|
|
168
|
-
openapi: "3.1.0",
|
|
169
|
-
info: {
|
|
170
|
-
title: "Test API",
|
|
171
|
-
version: "1.0.0",
|
|
172
|
-
},
|
|
173
|
-
paths: {},
|
|
174
|
-
};
|
|
175
|
-
await fs.mkdir(path.dirname(inputPath), { recursive: true });
|
|
176
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
177
|
-
await convertOpenAPI({
|
|
178
|
-
input: inputPath,
|
|
179
|
-
format: "yaml",
|
|
180
|
-
});
|
|
181
|
-
const outputContent = await fs.readFile(expectedOutputPath, "utf-8");
|
|
182
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
183
|
-
});
|
|
184
|
-
it("should throw error when no format is specified", async () => {
|
|
185
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
186
|
-
const inputDoc = {
|
|
187
|
-
openapi: "3.1.0",
|
|
188
|
-
info: {
|
|
189
|
-
title: "Test API",
|
|
190
|
-
version: "1.0.0",
|
|
191
|
-
},
|
|
192
|
-
paths: {},
|
|
193
|
-
};
|
|
194
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
195
|
-
await assert.rejects(() => convertOpenAPI({
|
|
196
|
-
input: inputPath,
|
|
197
|
-
}), /Output format must be specified/);
|
|
198
|
-
});
|
|
199
|
-
it("should throw error when input format cannot be determined", async () => {
|
|
200
|
-
const inputPath = path.join(testTmpPath, "api.txt");
|
|
201
|
-
await fs.writeFile(inputPath, "content");
|
|
202
|
-
await assert.rejects(() => convertOpenAPI({
|
|
203
|
-
input: inputPath,
|
|
204
|
-
format: "json",
|
|
205
|
-
}), /Unable to determine input format/);
|
|
206
|
-
});
|
|
207
|
-
it("should not convert if input and output formats are the same", async () => {
|
|
208
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
209
|
-
const inputDoc = {
|
|
210
|
-
openapi: "3.1.0",
|
|
211
|
-
info: {
|
|
212
|
-
title: "Test API",
|
|
213
|
-
version: "1.0.0",
|
|
214
|
-
},
|
|
215
|
-
paths: {},
|
|
216
|
-
};
|
|
217
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
218
|
-
await convertOpenAPI({
|
|
219
|
-
input: inputPath,
|
|
220
|
-
format: "json",
|
|
221
|
-
});
|
|
222
|
-
const content = await fs.readFile(inputPath, "utf-8");
|
|
223
|
-
const parsed = JSON.parse(content);
|
|
224
|
-
assert.deepStrictEqual(parsed, inputDoc);
|
|
225
|
-
});
|
|
226
|
-
it("should use custom output path when specified", async () => {
|
|
227
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
228
|
-
const customOutputPath = path.join(testTmpPath, "custom-name.yaml");
|
|
229
|
-
const inputDoc = {
|
|
230
|
-
openapi: "3.1.0",
|
|
231
|
-
info: {
|
|
232
|
-
title: "Test API",
|
|
233
|
-
version: "1.0.0",
|
|
234
|
-
},
|
|
235
|
-
paths: {},
|
|
236
|
-
};
|
|
237
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
238
|
-
await convertOpenAPI({
|
|
239
|
-
input: inputPath,
|
|
240
|
-
format: "yaml",
|
|
241
|
-
output: customOutputPath,
|
|
242
|
-
});
|
|
243
|
-
const outputContent = await fs.readFile(customOutputPath, "utf-8");
|
|
244
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
245
|
-
assert.strictEqual(outputContent.includes("title: Test API"), true);
|
|
246
|
-
});
|
|
247
|
-
it("should create output directory when using custom output path", async () => {
|
|
248
|
-
const inputPath = path.join(testTmpPath, "api.json");
|
|
249
|
-
const customOutputPath = path.join(testTmpPath, "custom", "output", "dir", "result.yaml");
|
|
250
|
-
const inputDoc = {
|
|
251
|
-
openapi: "3.1.0",
|
|
252
|
-
info: {
|
|
253
|
-
title: "Test API",
|
|
254
|
-
version: "1.0.0",
|
|
255
|
-
},
|
|
256
|
-
paths: {},
|
|
257
|
-
};
|
|
258
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
259
|
-
await convertOpenAPI({
|
|
260
|
-
input: inputPath,
|
|
261
|
-
format: "yaml",
|
|
262
|
-
output: customOutputPath,
|
|
263
|
-
});
|
|
264
|
-
const outputContent = await fs.readFile(customOutputPath, "utf-8");
|
|
265
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
266
|
-
});
|
|
267
|
-
it("should use custom output path with different location", async () => {
|
|
268
|
-
const inputPath = path.join(testTmpPath, "source", "api.json");
|
|
269
|
-
const customOutputPath = path.join(testTmpPath, "output", "api.yaml");
|
|
270
|
-
const inputDoc = {
|
|
271
|
-
openapi: "3.1.0",
|
|
272
|
-
info: {
|
|
273
|
-
title: "Test API",
|
|
274
|
-
version: "1.0.0",
|
|
275
|
-
},
|
|
276
|
-
paths: {},
|
|
277
|
-
};
|
|
278
|
-
await fs.mkdir(path.dirname(inputPath), { recursive: true });
|
|
279
|
-
await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));
|
|
280
|
-
await convertOpenAPI({
|
|
281
|
-
input: inputPath,
|
|
282
|
-
format: "yaml",
|
|
283
|
-
output: customOutputPath,
|
|
284
|
-
});
|
|
285
|
-
const outputContent = await fs.readFile(customOutputPath, "utf-8");
|
|
286
|
-
assert.strictEqual(outputContent.includes("openapi: 3.1.0"), true);
|
|
287
|
-
assert.strictEqual(outputContent.includes("title: Test API"), true);
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
describe("watch flag", () => {
|
|
291
|
-
it("should reject watch mode with non-existent input file", async () => {
|
|
292
|
-
const inputPath = path.join(testTmpPath, "nonexistent.json");
|
|
293
|
-
await assert.rejects(() => convertOpenAPI({
|
|
294
|
-
input: inputPath,
|
|
295
|
-
format: "yaml",
|
|
296
|
-
watch: true,
|
|
297
|
-
}), /Input file not found/);
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
//# sourceMappingURL=handler.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler.spec.js","sourceRoot":"","sources":["../../../src/open-api/convert/handler.spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC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M,EAAE,MAAM;gBACd,MAAM,EAAE,gBAAgB;aACzB,CAAC,CAAC;YAEH,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;YACnE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,CAAC;YACnE,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,uDAAuD,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;YAE7D,MAAM,MAAM,CAAC,OAAO,CAClB,GAAG,EAAE,CACH,cAAc,CAAC;gBACb,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,IAAI;aACZ,CAAC,EACJ,sBAAsB,CACvB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import assert from \"node:assert\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { afterEach, beforeEach, describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { convertOpenAPI } from \"./handler.js\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst testTmpPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"__tests__\",\n \"test-tmp\",\n \"convert-handler\"\n);\n\ndescribe(\"Convert Handler\", () => {\n beforeEach(async () => {\n // Ensure test-tmp directory exists\n await fs.mkdir(testTmpPath, { recursive: true });\n });\n\n afterEach(async () => {\n // Clean up test files\n try {\n await fs.rm(testTmpPath, { recursive: true, force: true });\n } catch {\n // Ignore cleanup errors\n }\n });\n\n describe(\"convertOpenAPI\", () => {\n it(\"should convert JSON to YAML using --format yaml\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n const expectedOutputPath = path.join(testTmpPath, \"api.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n assert.strictEqual(outputContent.includes(\"title: Test API\"), true);\n });\n\n it(\"should convert JSON to YAML using --yaml\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n const expectedOutputPath = path.join(testTmpPath, \"api.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n yaml: true,\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n });\n\n it(\"should convert YAML to JSON using --format json\", async () => {\n const inputPath = path.join(testTmpPath, \"api.yaml\");\n const expectedOutputPath = path.join(testTmpPath, \"api.json\");\n\n const inputDoc = `openapi: 3.1.0\ninfo:\n title: Test API\n version: 1.0.0\npaths: {}`;\n\n await fs.writeFile(inputPath, inputDoc);\n\n await convertOpenAPI({\n input: inputPath,\n format: \"json\",\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n const parsed = JSON.parse(outputContent);\n assert.strictEqual(parsed.openapi, \"3.1.0\");\n assert.strictEqual(parsed.info.title, \"Test API\");\n });\n\n it(\"should convert YAML to JSON using --json\", async () => {\n const inputPath = path.join(testTmpPath, \"api.yml\");\n const expectedOutputPath = path.join(testTmpPath, \"api.json\");\n\n const inputDoc = `openapi: 3.1.0\ninfo:\n title: Test API\n version: 1.0.0\npaths: {}`;\n\n await fs.writeFile(inputPath, inputDoc);\n\n await convertOpenAPI({\n input: inputPath,\n json: true,\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n const parsed = JSON.parse(outputContent);\n assert.strictEqual(parsed.openapi, \"3.1.0\");\n });\n\n it(\"should handle files with multiple dots in name\", async () => {\n const inputPath = path.join(testTmpPath, \"api.v1.0.json\");\n const expectedOutputPath = path.join(testTmpPath, \"api.v1.0.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n });\n\n it(\"should preserve complex nested structures\", async () => {\n const inputPath = path.join(testTmpPath, \"complex.json\");\n const expectedOutputPath = path.join(testTmpPath, \"complex.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Complex API\",\n version: \"1.0.0\",\n },\n paths: {\n \"/users/{id}\": {\n get: {\n parameters: [\n { name: \"id\", in: \"path\", required: true },\n { name: \"fields\", in: \"query\", required: false },\n ],\n responses: {\n \"200\": {\n description: \"Success\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n name: { type: \"string\" },\n },\n },\n },\n },\n },\n },\n },\n },\n },\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n });\n\n // Convert back to verify data preservation\n await convertOpenAPI({\n input: expectedOutputPath,\n format: \"json\",\n });\n\n const finalContent = await fs.readFile(inputPath, \"utf-8\");\n const finalDoc = JSON.parse(finalContent);\n assert.deepStrictEqual(finalDoc, inputDoc);\n });\n\n it(\"should create output directory if it doesn't exist\", async () => {\n const inputPath = path.join(testTmpPath, \"nested\", \"dir\", \"api.json\");\n const expectedOutputPath = path.join(\n testTmpPath,\n \"nested\",\n \"dir\",\n \"api.yaml\"\n );\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.mkdir(path.dirname(inputPath), { recursive: true });\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n });\n\n const outputContent = await fs.readFile(expectedOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n });\n\n it(\"should throw error when no format is specified\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await assert.rejects(\n () =>\n convertOpenAPI({\n input: inputPath,\n }),\n /Output format must be specified/\n );\n });\n\n it(\"should throw error when input format cannot be determined\", async () => {\n const inputPath = path.join(testTmpPath, \"api.txt\");\n\n await fs.writeFile(inputPath, \"content\");\n\n await assert.rejects(\n () =>\n convertOpenAPI({\n input: inputPath,\n format: \"json\",\n }),\n /Unable to determine input format/\n );\n });\n\n it(\"should not convert if input and output formats are the same\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n // Should complete without error and not create output file\n await convertOpenAPI({\n input: inputPath,\n format: \"json\",\n });\n\n // Verify original file still exists\n const content = await fs.readFile(inputPath, \"utf-8\");\n const parsed = JSON.parse(content);\n assert.deepStrictEqual(parsed, inputDoc);\n });\n\n it(\"should use custom output path when specified\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n const customOutputPath = path.join(testTmpPath, \"custom-name.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n output: customOutputPath,\n });\n\n const outputContent = await fs.readFile(customOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n assert.strictEqual(outputContent.includes(\"title: Test API\"), true);\n });\n\n it(\"should create output directory when using custom output path\", async () => {\n const inputPath = path.join(testTmpPath, \"api.json\");\n const customOutputPath = path.join(\n testTmpPath,\n \"custom\",\n \"output\",\n \"dir\",\n \"result.yaml\"\n );\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n output: customOutputPath,\n });\n\n const outputContent = await fs.readFile(customOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n });\n\n it(\"should use custom output path with different location\", async () => {\n const inputPath = path.join(testTmpPath, \"source\", \"api.json\");\n const customOutputPath = path.join(testTmpPath, \"output\", \"api.yaml\");\n\n const inputDoc = {\n openapi: \"3.1.0\",\n info: {\n title: \"Test API\",\n version: \"1.0.0\",\n },\n paths: {},\n };\n\n await fs.mkdir(path.dirname(inputPath), { recursive: true });\n await fs.writeFile(inputPath, JSON.stringify(inputDoc, null, 2));\n\n await convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n output: customOutputPath,\n });\n\n const outputContent = await fs.readFile(customOutputPath, \"utf-8\");\n assert.strictEqual(outputContent.includes(\"openapi: 3.1.0\"), true);\n assert.strictEqual(outputContent.includes(\"title: Test API\"), true);\n });\n });\n\n describe(\"watch flag\", () => {\n it(\"should reject watch mode with non-existent input file\", async () => {\n const inputPath = path.join(testTmpPath, \"nonexistent.json\");\n\n await assert.rejects(\n () =>\n convertOpenAPI({\n input: inputPath,\n format: \"yaml\",\n watch: true,\n }),\n /Input file not found/\n );\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handler.spec.d.ts","sourceRoot":"","sources":["../../../src/open-api/merge/handler.spec.ts"],"names":[],"mappings":""}
|