@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
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{E as p,J as c,M as u}from"../chunk-
|
|
25
|
+
import{E as p,J as c,M as u}from"../chunk-RHU3Z7DA.js";import"../chunk-NUVXDVLJ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-CDEAY3VY.js";import{aa as i}from"../chunk-LVSZ3WTO.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-
|
|
25
|
+
import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-CDEAY3VY.js";import"../../chunk-LVSZ3WTO.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1310,15 +1310,6 @@ export declare interface AIGatewaySmartRouterResult {
|
|
|
1310
1310
|
profile: AIGatewaySmartRouterProfile;
|
|
1311
1311
|
usage: AIGatewaySmartRouterTokenUsage;
|
|
1312
1312
|
classifierModel: string;
|
|
1313
|
-
/**
|
|
1314
|
-
* Classifier cost in USD, separate from the routed model's cost. An unpriced
|
|
1315
|
-
* zero means unknown, not free. Optional for results written by older code.
|
|
1316
|
-
*/
|
|
1317
|
-
cost?: {
|
|
1318
|
-
costUsd: number;
|
|
1319
|
-
source: "provider" | "catalog" | "unpriced";
|
|
1320
|
-
accuracy: "exact" | "estimated" | "unpriced";
|
|
1321
|
-
};
|
|
1322
1313
|
routing: AIGatewaySmartRouterRoutingDecision;
|
|
1323
1314
|
durationMs: number;
|
|
1324
1315
|
promptSource: AIGatewaySmartRouterPromptSource;
|
|
@@ -1343,9 +1334,7 @@ export declare interface AIGatewaySmartRouterRoutingDecision {
|
|
|
1343
1334
|
}
|
|
1344
1335
|
|
|
1345
1336
|
/**
|
|
1346
|
-
* Classifier token usage
|
|
1347
|
-
* accounting headers produce zero counts, without a provider-body fallback.
|
|
1348
|
-
* Deprecated direct classifiers retain the provider-reported counts; for Jev,
|
|
1337
|
+
* Classifier token usage reported in the classifier response body. For Jev,
|
|
1349
1338
|
* input and output tokens map directly to these fields.
|
|
1350
1339
|
*
|
|
1351
1340
|
* @public
|
|
@@ -1354,18 +1343,6 @@ export declare interface AIGatewaySmartRouterTokenUsage {
|
|
|
1354
1343
|
inputTokens: number;
|
|
1355
1344
|
outputTokens: number;
|
|
1356
1345
|
totalTokens: number;
|
|
1357
|
-
/** Disjoint accounting categories already included in the totals above. */
|
|
1358
|
-
breakdown?: {
|
|
1359
|
-
uncachedInputTokens: number;
|
|
1360
|
-
cacheReadInputTokens?: number;
|
|
1361
|
-
/** Cache writes grouped by TTL when accounting reports that detail. */
|
|
1362
|
-
cacheWriteInput?: Array<{
|
|
1363
|
-
tokens: number;
|
|
1364
|
-
cacheTtl?: "5m" | "1h";
|
|
1365
|
-
}>;
|
|
1366
|
-
visibleOutputTokens: number;
|
|
1367
|
-
reasoningOutputTokens?: number;
|
|
1368
|
-
};
|
|
1369
1346
|
}
|
|
1370
1347
|
|
|
1371
1348
|
/**
|
|
@@ -4195,6 +4172,20 @@ declare interface CompatibilityFlags {
|
|
|
4195
4172
|
* discover tools with `tools/list`, as the MCP spec defines.
|
|
4196
4173
|
*/
|
|
4197
4174
|
removeMcpToolsCapabilityExtension: boolean;
|
|
4175
|
+
/**
|
|
4176
|
+
* Whether the MCP server handler reports a `tools/call` whose arguments fail
|
|
4177
|
+
* the tool's `inputSchema` as a tool result with `isError: true`, as
|
|
4178
|
+
* MCP 2025-11-25 specifies for input validation errors.
|
|
4179
|
+
*
|
|
4180
|
+
* Before this flag: Invalid arguments return a JSON-RPC `-32602` error.
|
|
4181
|
+
*
|
|
4182
|
+
* After this flag: When the request's `MCP-Protocol-Version` header is
|
|
4183
|
+
* `2025-11-25` or later, invalid arguments return a result with
|
|
4184
|
+
* `isError: true` and the validation message as text content, and the tool
|
|
4185
|
+
* is not called. Earlier or missing protocol versions still return
|
|
4186
|
+
* `-32602`. Unknown tools and malformed requests return `-32602` either way.
|
|
4187
|
+
*/
|
|
4188
|
+
returnMcpToolInputErrorsAsToolResults: boolean;
|
|
4198
4189
|
/**
|
|
4199
4190
|
* Whether OpenAPI schema combinators (`allOf`, `oneOf`, `anyOf`, `not`) are
|
|
4200
4191
|
* applied with JSON Schema semantics when an operation's schemas are turned
|
|
@@ -154,6 +154,20 @@ declare interface CompatibilityFlags {
|
|
|
154
154
|
* discover tools with `tools/list`, as the MCP spec defines.
|
|
155
155
|
*/
|
|
156
156
|
removeMcpToolsCapabilityExtension: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Whether the MCP server handler reports a `tools/call` whose arguments fail
|
|
159
|
+
* the tool's `inputSchema` as a tool result with `isError: true`, as
|
|
160
|
+
* MCP 2025-11-25 specifies for input validation errors.
|
|
161
|
+
*
|
|
162
|
+
* Before this flag: Invalid arguments return a JSON-RPC `-32602` error.
|
|
163
|
+
*
|
|
164
|
+
* After this flag: When the request's `MCP-Protocol-Version` header is
|
|
165
|
+
* `2025-11-25` or later, invalid arguments return a result with
|
|
166
|
+
* `isError: true` and the validation message as text content, and the tool
|
|
167
|
+
* is not called. Earlier or missing protocol versions still return
|
|
168
|
+
* `-32602`. Unknown tools and malformed requests return `-32602` either way.
|
|
169
|
+
*/
|
|
170
|
+
returnMcpToolInputErrorsAsToolResults: boolean;
|
|
157
171
|
/**
|
|
158
172
|
* Whether OpenAPI schema combinators (`allOf`, `oneOf`, `anyOf`, `not`) are
|
|
159
173
|
* applied with JSON Schema semantics when an operation's schemas are turned
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.1",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
"LICENSE.txt",
|
|
19
19
|
"dist/**",
|
|
20
20
|
"*.js",
|
|
21
|
-
"*.d.ts"
|
|
21
|
+
"*.d.ts",
|
|
22
|
+
"!dist/**/*.test.*",
|
|
23
|
+
"!dist/**/*.spec.*",
|
|
24
|
+
"!dist/**/__tests__/**"
|
|
22
25
|
],
|
|
23
26
|
"bin": {
|
|
24
27
|
"zup": "zup.js"
|
|
@@ -28,10 +31,10 @@
|
|
|
28
31
|
"@opentelemetry/api": "1.9.0",
|
|
29
32
|
"@opentelemetry/api-logs": "0.220.0",
|
|
30
33
|
"@swc/core": "1.10.18",
|
|
31
|
-
"@zuplo/core": "7.
|
|
34
|
+
"@zuplo/core": "7.11.1",
|
|
32
35
|
"@zuplo/editor": "1.0.33162667821",
|
|
33
|
-
"@zuplo/openapi-tools": "7.
|
|
34
|
-
"@zuplo/runtime": "7.
|
|
36
|
+
"@zuplo/openapi-tools": "7.11.1",
|
|
37
|
+
"@zuplo/runtime": "7.11.1",
|
|
35
38
|
"chalk": "5.4.1",
|
|
36
39
|
"chokidar": "3.5.3",
|
|
37
40
|
"cookie": "1.0.2",
|
|
@@ -62,15 +65,15 @@
|
|
|
62
65
|
"workerd": "1.20261002.1",
|
|
63
66
|
"yargs": "17.7.2",
|
|
64
67
|
"zod": "4.4.3",
|
|
65
|
-
"@zuplo/graphql": "7.
|
|
66
|
-
"@zuplo/otel": "7.
|
|
68
|
+
"@zuplo/graphql": "7.11.1",
|
|
69
|
+
"@zuplo/otel": "7.11.1"
|
|
67
70
|
},
|
|
68
71
|
"optionalDependencies": {
|
|
69
|
-
"@zuplo/lint-darwin-arm64": "7.
|
|
70
|
-
"@zuplo/lint-darwin-x64": "7.
|
|
71
|
-
"@zuplo/lint-linux-x64": "7.
|
|
72
|
-
"@zuplo/lint-linux-arm64": "7.
|
|
73
|
-
"@zuplo/lint-win32-x64": "7.
|
|
72
|
+
"@zuplo/lint-darwin-arm64": "7.11.1",
|
|
73
|
+
"@zuplo/lint-darwin-x64": "7.11.1",
|
|
74
|
+
"@zuplo/lint-linux-x64": "7.11.1",
|
|
75
|
+
"@zuplo/lint-linux-arm64": "7.11.1",
|
|
76
|
+
"@zuplo/lint-win32-x64": "7.11.1"
|
|
74
77
|
},
|
|
75
78
|
"bundleDependencies": [
|
|
76
79
|
"@inquirer/prompts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"archive-utils.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/archive-utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { describe, it } from "node:test";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { expect } from "chai";
|
|
5
|
-
import ignore from "ignore";
|
|
6
|
-
import { createIgnoreFunction, generateMetadata } from "../deploy/archive.js";
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
const basicTestsPath = path.join(__dirname, "..", "..", "..", "..", "test-fixtures", "basic");
|
|
10
|
-
describe("Archive utils", async function () {
|
|
11
|
-
it("should not ignore .zuplo using gitignore", function () {
|
|
12
|
-
const ignores = createIgnoreFunction(basicTestsPath);
|
|
13
|
-
const expectedRules = ignore().add(".git/");
|
|
14
|
-
expectedRules.add(".cache/");
|
|
15
|
-
expectedRules.add("dist/");
|
|
16
|
-
expectedRules.add("node_modules/");
|
|
17
|
-
expectedRules.add(".env");
|
|
18
|
-
expectedRules.add(".DS_Store");
|
|
19
|
-
expect(ignores._rules).to.deep.equal(expectedRules._rules);
|
|
20
|
-
});
|
|
21
|
-
it("should return default metadata values", async function () {
|
|
22
|
-
const results = await generateMetadata({
|
|
23
|
-
account: "zuplo-test",
|
|
24
|
-
project: "basic",
|
|
25
|
-
dir: basicTestsPath,
|
|
26
|
-
environment: "basic-1234",
|
|
27
|
-
authToken: "",
|
|
28
|
-
});
|
|
29
|
-
expect(results).to.not.be.empty;
|
|
30
|
-
expect(results.branch).to.equal("basic-1234");
|
|
31
|
-
expect(results.repoUrl).to.not.be.null;
|
|
32
|
-
expect(results.sha).to.not.be.null;
|
|
33
|
-
});
|
|
34
|
-
it("should allow metadata value override on repo url", async function () {
|
|
35
|
-
const results = await generateMetadata({
|
|
36
|
-
account: "zuplo-test",
|
|
37
|
-
project: "basic",
|
|
38
|
-
dir: basicTestsPath,
|
|
39
|
-
environment: "basic-1234",
|
|
40
|
-
authToken: "",
|
|
41
|
-
"override-repo-url": "https://github.com/zuplo/test-override",
|
|
42
|
-
});
|
|
43
|
-
expect(results).to.not.be.empty;
|
|
44
|
-
expect(results.branch).to.equal("basic-1234");
|
|
45
|
-
expect(results.repoUrl).to.not.be.null;
|
|
46
|
-
expect(results.repoUrl).to.equal("https://github.com/zuplo/test-override");
|
|
47
|
-
expect(results.sha).to.not.be.null;
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=archive-utils.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":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AC,CAAC;QAC3E,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import path from \"node:path\";\nimport { describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { expect } from \"chai\";\nimport ignore from \"ignore\";\nimport { createIgnoreFunction, generateMetadata } from \"../deploy/archive.js\";\n\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst basicTestsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"test-fixtures\",\n \"basic\"\n);\n\ndescribe(\"Archive utils\", async function () {\n it(\"should not ignore .zuplo using gitignore\", function () {\n const ignores = createIgnoreFunction(basicTestsPath);\n const expectedRules = (ignore as any)().add(\".git/\");\n expectedRules.add(\".cache/\");\n expectedRules.add(\"dist/\");\n expectedRules.add(\"node_modules/\");\n expectedRules.add(\".env\");\n expectedRules.add(\".DS_Store\");\n\n expect(ignores._rules).to.deep.equal(expectedRules._rules);\n });\n\n it(\"should return default metadata values\", async function () {\n const results = await generateMetadata({\n account: \"zuplo-test\",\n project: \"basic\",\n dir: basicTestsPath,\n environment: \"basic-1234\",\n authToken: \"\",\n });\n\n expect(results).to.not.be.empty;\n expect(results.branch).to.equal(\"basic-1234\");\n expect(results.repoUrl).to.not.be.null;\n expect(results.sha).to.not.be.null;\n });\n\n it(\"should allow metadata value override on repo url\", async function () {\n const results = await generateMetadata({\n account: \"zuplo-test\",\n project: \"basic\",\n dir: basicTestsPath,\n environment: \"basic-1234\",\n authToken: \"\",\n \"override-repo-url\": \"https://github.com/zuplo/test-override\",\n });\n\n expect(results).to.not.be.empty;\n expect(results.branch).to.equal(\"basic-1234\");\n expect(results.repoUrl).to.not.be.null;\n expect(results.repoUrl).to.equal(\"https://github.com/zuplo/test-override\");\n expect(results.sha).to.not.be.null;\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"import-openapi.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/import-openapi.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { afterEach, beforeEach, describe, it } from "node:test";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { expect } from "chai";
|
|
6
|
-
import { createSandbox } from "sinon";
|
|
7
|
-
import { importOpenApi } from "../open-api/merge/handler.js";
|
|
8
|
-
const baseRoutesFileOnImportTests = {
|
|
9
|
-
info: {
|
|
10
|
-
version: "v2",
|
|
11
|
-
title: "Zuplo test API V2",
|
|
12
|
-
description: "Test api v2",
|
|
13
|
-
contact: {
|
|
14
|
-
name: "Zuplo test",
|
|
15
|
-
url: "www.zuplo.com",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
openapi: "3.1.0",
|
|
19
|
-
components: {
|
|
20
|
-
parameters: {
|
|
21
|
-
userUid: {
|
|
22
|
-
name: "userUid",
|
|
23
|
-
in: "path",
|
|
24
|
-
description: "Unique UUID of the user.",
|
|
25
|
-
required: true,
|
|
26
|
-
schema: {
|
|
27
|
-
type: "string",
|
|
28
|
-
format: "uuid",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
securitySchemes: {
|
|
33
|
-
authorization: {
|
|
34
|
-
type: "http",
|
|
35
|
-
description: "Firebase JWT auth token",
|
|
36
|
-
scheme: "bearer",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
servers: [
|
|
41
|
-
{
|
|
42
|
-
url: "https://api.stage.example.com",
|
|
43
|
-
description: "Stage",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
url: "https://api.example.com",
|
|
47
|
-
description: "Prod",
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
security: [{}],
|
|
51
|
-
tags: [],
|
|
52
|
-
paths: {
|
|
53
|
-
"/v1/second/{userUid}/nature": {
|
|
54
|
-
post: {
|
|
55
|
-
summary: "Test route",
|
|
56
|
-
operationId: "12345",
|
|
57
|
-
parameters: [
|
|
58
|
-
{
|
|
59
|
-
$ref: "#/components/parameters/userUid",
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
responses: {
|
|
63
|
-
"200": {
|
|
64
|
-
description: "",
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
security: [{}],
|
|
68
|
-
servers: [
|
|
69
|
-
{
|
|
70
|
-
url: "https://api.stage.example.com",
|
|
71
|
-
description: "stage",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
url: "https://api.example.com",
|
|
75
|
-
description: "production",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
"/v2/second/{userUid}/nature": {
|
|
81
|
-
post: {
|
|
82
|
-
operationId: "67920",
|
|
83
|
-
summary: "Test route v2",
|
|
84
|
-
parameters: [
|
|
85
|
-
{
|
|
86
|
-
$ref: "#/components/parameters/userUid",
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
responses: {
|
|
90
|
-
"200": {
|
|
91
|
-
description: "",
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
99
|
-
const __dirname = path.dirname(__filename);
|
|
100
|
-
const testAssetsPath = path.join(__dirname, "..", "..", "src", "__tests__", "test-assets");
|
|
101
|
-
const testTmpPath = path.join(__dirname, "..", "..", "src", "__tests__", "test-tmp");
|
|
102
|
-
async function createOASFile(content, destinationPath) {
|
|
103
|
-
try {
|
|
104
|
-
const dir = path.dirname(destinationPath);
|
|
105
|
-
await fs.mkdir(dir, { recursive: true });
|
|
106
|
-
await fs.writeFile(destinationPath, content, "utf8");
|
|
107
|
-
console.log(`File created successfully at ${destinationPath}`);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.error(`Error creating file at ${destinationPath}:`, error);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
let sandbox;
|
|
114
|
-
describe("Import open api file", async function () {
|
|
115
|
-
let printExit;
|
|
116
|
-
beforeEach(async function () {
|
|
117
|
-
sandbox = createSandbox();
|
|
118
|
-
printExit = sandbox.stub(process, "exit");
|
|
119
|
-
});
|
|
120
|
-
afterEach(() => {
|
|
121
|
-
sandbox.restore();
|
|
122
|
-
});
|
|
123
|
-
it("should merge two existing files correctly", async function () {
|
|
124
|
-
const destinationPath = path.join(testTmpPath, "config", "routes-test-one.oas.json");
|
|
125
|
-
await createOASFile(JSON.stringify(baseRoutesFileOnImportTests), destinationPath);
|
|
126
|
-
await importOpenApi({
|
|
127
|
-
prompt: false,
|
|
128
|
-
source: path.join(testAssetsPath, "toimport.oas.json"),
|
|
129
|
-
destination: destinationPath,
|
|
130
|
-
});
|
|
131
|
-
const mergedContent = await fs.readFile(destinationPath, "utf-8");
|
|
132
|
-
const jsonContent = JSON.parse(mergedContent);
|
|
133
|
-
expect(jsonContent.paths).to.deep.equals({
|
|
134
|
-
"/v1/second/{userUid}/nature": {
|
|
135
|
-
post: {
|
|
136
|
-
summary: "Test route",
|
|
137
|
-
operationId: "12345",
|
|
138
|
-
parameters: [
|
|
139
|
-
{
|
|
140
|
-
$ref: "#/components/parameters/userUid",
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
responses: {
|
|
144
|
-
"200": {
|
|
145
|
-
description: "",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
security: [{}],
|
|
149
|
-
servers: [
|
|
150
|
-
{
|
|
151
|
-
url: "https://api.stage.example.com",
|
|
152
|
-
description: "stage",
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
url: "https://api.example.com",
|
|
156
|
-
description: "production",
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
"/v2/second/{userUid}/nature": {
|
|
162
|
-
post: {
|
|
163
|
-
operationId: "67920",
|
|
164
|
-
summary: "Test route v2",
|
|
165
|
-
parameters: [
|
|
166
|
-
{
|
|
167
|
-
$ref: "#/components/parameters/userUid",
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
responses: {
|
|
171
|
-
"200": {
|
|
172
|
-
description: "",
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
it("should import a file into a fs destination that does not yet exist", async function () {
|
|
180
|
-
const destinationPath = path.join(testTmpPath, "routes-test-two.oas.json");
|
|
181
|
-
await importOpenApi({
|
|
182
|
-
prompt: false,
|
|
183
|
-
source: path.join(testAssetsPath, "toimport.oas.json"),
|
|
184
|
-
destination: destinationPath,
|
|
185
|
-
});
|
|
186
|
-
const mergedContent = await fs.readFile(destinationPath, "utf-8");
|
|
187
|
-
const jsonContent = JSON.parse(mergedContent);
|
|
188
|
-
expect(jsonContent.info).to.deep.equals({
|
|
189
|
-
version: "v2",
|
|
190
|
-
title: "Zuplo test API V2",
|
|
191
|
-
description: "Test api v2",
|
|
192
|
-
contact: {
|
|
193
|
-
name: "Zuplo test",
|
|
194
|
-
url: "www.zuplo.com",
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
expect(jsonContent.openapi).to.equal("3.1.0");
|
|
198
|
-
expect(jsonContent.components).to.deep.equals({
|
|
199
|
-
parameters: {
|
|
200
|
-
userUid: {
|
|
201
|
-
name: "userUid",
|
|
202
|
-
in: "path",
|
|
203
|
-
description: "Unique UUID of the user.",
|
|
204
|
-
required: true,
|
|
205
|
-
schema: {
|
|
206
|
-
type: "string",
|
|
207
|
-
format: "uuid",
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
securitySchemes: {
|
|
212
|
-
authorization: {
|
|
213
|
-
type: "http",
|
|
214
|
-
description: "Firebase JWT auth token",
|
|
215
|
-
scheme: "bearer",
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
expect(jsonContent.servers).to.deep.equals([
|
|
220
|
-
{
|
|
221
|
-
url: "https://api.stage.example.com",
|
|
222
|
-
description: "Stage",
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
url: "https://api.example.com",
|
|
226
|
-
description: "Prod",
|
|
227
|
-
},
|
|
228
|
-
]);
|
|
229
|
-
expect(jsonContent.security).to.deep.equals([{}]);
|
|
230
|
-
expect(jsonContent.tags).to.deep.equals([]);
|
|
231
|
-
expect(jsonContent.paths).to.deep.equals({
|
|
232
|
-
"/v2/second/{userUid}/nature": {
|
|
233
|
-
post: {
|
|
234
|
-
summary: "Test route v2",
|
|
235
|
-
operationId: "67920",
|
|
236
|
-
parameters: [
|
|
237
|
-
{
|
|
238
|
-
$ref: "#/components/parameters/userUid",
|
|
239
|
-
},
|
|
240
|
-
],
|
|
241
|
-
responses: {
|
|
242
|
-
"200": {
|
|
243
|
-
description: "",
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
//# sourceMappingURL=import-openapi.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"import-openapi.test.js","sourceRoot":"","sources":["../../src/__tests__/import-openapi.test.ts"],"names":[],"mappings":"AAAA,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,MAAM,EAA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F;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { afterEach, beforeEach, describe, it } from \"node:test\";\nimport { fileURLToPath } from \"node:url\";\nimport { expect } from \"chai\";\nimport { createSandbox, SinonSandbox, SinonStub } from \"sinon\";\nimport { importOpenApi } from \"../open-api/merge/handler.js\";\n\nconst baseRoutesFileOnImportTests = {\n info: {\n version: \"v2\",\n title: \"Zuplo test API V2\",\n description: \"Test api v2\",\n contact: {\n name: \"Zuplo test\",\n url: \"www.zuplo.com\",\n },\n },\n openapi: \"3.1.0\",\n components: {\n parameters: {\n userUid: {\n name: \"userUid\",\n in: \"path\",\n description: \"Unique UUID of the user.\",\n required: true,\n schema: {\n type: \"string\",\n format: \"uuid\",\n },\n },\n },\n securitySchemes: {\n authorization: {\n type: \"http\",\n description: \"Firebase JWT auth token\",\n scheme: \"bearer\",\n },\n },\n },\n servers: [\n {\n url: \"https://api.stage.example.com\",\n description: \"Stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"Prod\",\n },\n ],\n security: [{}],\n tags: [],\n paths: {\n \"/v1/second/{userUid}/nature\": {\n post: {\n summary: \"Test route\",\n operationId: \"12345\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n security: [{}],\n servers: [\n {\n url: \"https://api.stage.example.com\",\n description: \"stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"production\",\n },\n ],\n },\n },\n \"/v2/second/{userUid}/nature\": {\n post: {\n operationId: \"67920\",\n summary: \"Test route v2\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n },\n};\n\nconst __filename = fileURLToPath(import.meta.url); // get the resolved path to the file\nconst __dirname = path.dirname(__filename); // get the name of the directory\n\nconst testAssetsPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-assets\"\n);\n\nconst testTmpPath = path.join(\n __dirname,\n \"..\",\n \"..\",\n \"src\",\n \"__tests__\",\n \"test-tmp\"\n);\n\nasync function createOASFile(content: string, destinationPath: string) {\n try {\n // Get the directory path of the file\n const dir = path.dirname(destinationPath);\n\n // Ensure that the directory exists (creates parent directories if necessary)\n await fs.mkdir(dir, { recursive: true });\n\n // Write the content to the file (creates the file if it doesn't exist)\n await fs.writeFile(destinationPath, content, \"utf8\");\n\n console.log(`File created successfully at ${destinationPath}`);\n } catch (error) {\n console.error(`Error creating file at ${destinationPath}:`, error);\n }\n}\n\nlet sandbox: SinonSandbox;\ndescribe(\"Import open api file\", async function () {\n let printExit: SinonStub;\n beforeEach(async function () {\n sandbox = createSandbox();\n // @NOTE - need to wrap this or else the cli code kills test run\n printExit = sandbox.stub(process, \"exit\");\n });\n\n afterEach(() => {\n sandbox.restore();\n });\n\n it(\"should merge two existing files correctly\", async function () {\n const destinationPath = path.join(\n testTmpPath,\n \"config\",\n \"routes-test-one.oas.json\"\n );\n // setup by creating the destination file first\n await createOASFile(\n JSON.stringify(baseRoutesFileOnImportTests),\n destinationPath\n );\n\n await importOpenApi({\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v1/second/{userUid}/nature\": {\n post: {\n summary: \"Test route\",\n operationId: \"12345\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n security: [{}],\n servers: [\n {\n url: \"https://api.stage.example.com\",\n description: \"stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"production\",\n },\n ],\n },\n },\n \"/v2/second/{userUid}/nature\": {\n post: {\n operationId: \"67920\",\n summary: \"Test route v2\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n\n it(\"should import a file into a fs destination that does not yet exist\", async function () {\n const destinationPath = path.join(testTmpPath, \"routes-test-two.oas.json\");\n\n await importOpenApi({\n prompt: false,\n source: path.join(testAssetsPath, \"toimport.oas.json\"),\n destination: destinationPath,\n });\n\n const mergedContent = await fs.readFile(destinationPath, \"utf-8\");\n\n const jsonContent = JSON.parse(mergedContent);\n\n expect(jsonContent.info).to.deep.equals({\n version: \"v2\",\n title: \"Zuplo test API V2\",\n description: \"Test api v2\",\n contact: {\n name: \"Zuplo test\",\n url: \"www.zuplo.com\",\n },\n });\n\n expect(jsonContent.openapi).to.equal(\"3.1.0\");\n\n expect(jsonContent.components).to.deep.equals({\n parameters: {\n userUid: {\n name: \"userUid\",\n in: \"path\",\n description: \"Unique UUID of the user.\",\n required: true,\n schema: {\n type: \"string\",\n format: \"uuid\",\n },\n },\n },\n securitySchemes: {\n authorization: {\n type: \"http\",\n description: \"Firebase JWT auth token\",\n scheme: \"bearer\",\n },\n },\n });\n\n expect(jsonContent.servers).to.deep.equals([\n {\n url: \"https://api.stage.example.com\",\n description: \"Stage\",\n },\n {\n url: \"https://api.example.com\",\n description: \"Prod\",\n },\n ]);\n\n expect(jsonContent.security).to.deep.equals([{}]);\n\n expect(jsonContent.tags).to.deep.equals([]);\n\n expect(jsonContent.paths).to.deep.equals({\n \"/v2/second/{userUid}/nature\": {\n post: {\n summary: \"Test route v2\",\n operationId: \"67920\",\n parameters: [\n {\n $ref: \"#/components/parameters/userUid\",\n },\n ],\n responses: {\n \"200\": {\n description: \"\",\n },\n },\n },\n },\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-linked-config.integration.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/confirm-linked-config.integration.test.ts"],"names":[],"mappings":""}
|