@zuplo/cli 7.15.26 → 7.15.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/source/ai-gateway/catalog.json +170 -1
  2. package/dist/source/ai-gateway/planner.d.ts +2 -2
  3. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwt/encrypt.js +5 -8
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +1 -1
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +2 -2
  7. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
  8. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/key.js +2 -0
  9. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  10. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +2 -2
  11. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwt/encrypt.js +5 -8
  12. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +1 -1
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +2 -2
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +1 -1
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/key.js +2 -0
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  17. package/node_modules/@posthog/core/dist/gzip.d.ts +2 -0
  18. package/node_modules/@posthog/core/dist/gzip.d.ts.map +1 -1
  19. package/node_modules/@posthog/core/dist/gzip.js +17 -1
  20. package/node_modules/@posthog/core/dist/gzip.mjs +15 -2
  21. package/node_modules/@posthog/core/package.json +2 -2
  22. package/node_modules/@posthog/core/src/gzip.ts +21 -4
  23. package/node_modules/@posthog/types/dist/posthog-config.d.ts +82 -0
  24. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  25. package/node_modules/@posthog/types/package.json +1 -1
  26. package/node_modules/@posthog/types/src/posthog-config.ts +84 -0
  27. package/node_modules/@zuplo/core/customer.cli.minified.js +296 -296
  28. package/node_modules/@zuplo/core/index.minified.js +305 -305
  29. package/node_modules/@zuplo/core/package.json +1 -1
  30. package/node_modules/@zuplo/graphql/package.json +1 -1
  31. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  32. package/node_modules/@zuplo/otel/package.json +1 -1
  33. package/node_modules/@zuplo/runtime/out/esm/{chunk-I65Y62VQ.js → chunk-3ITT2MYM.js} +10 -10
  34. package/node_modules/@zuplo/runtime/out/esm/chunk-3ITT2MYM.js.map +1 -0
  35. package/node_modules/@zuplo/runtime/out/esm/{chunk-5XXEIH5B.js → chunk-A7HRIAHJ.js} +2 -2
  36. package/node_modules/@zuplo/runtime/out/esm/{chunk-6KHAYHSW.js → chunk-C4ZTXG6P.js} +4 -4
  37. package/node_modules/@zuplo/runtime/out/esm/chunk-C4ZTXG6P.js.map +1 -0
  38. package/node_modules/@zuplo/runtime/out/esm/{chunk-APWLPHXH.js → chunk-JAY7SQGG.js} +2 -2
  39. package/node_modules/@zuplo/runtime/out/esm/{chunk-MWNVPFFM.js → chunk-YTDIY7PP.js} +2 -2
  40. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  41. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +1 -1
  42. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  43. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  44. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  45. package/node_modules/@zuplo/runtime/out/types/index.d.ts +16 -0
  46. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +16 -0
  47. package/node_modules/@zuplo/runtime/package.json +1 -1
  48. package/node_modules/express-rate-limit/dist/index.cjs +6 -4
  49. package/node_modules/express-rate-limit/dist/index.mjs +6 -4
  50. package/node_modules/express-rate-limit/package.json +1 -1
  51. package/node_modules/fast-copy/README.md +15 -0
  52. package/node_modules/fast-copy/dist/cjs/index.cjs +33 -8
  53. package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
  54. package/node_modules/fast-copy/dist/es/index.mjs +33 -8
  55. package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
  56. package/node_modules/fast-copy/dist/umd/index.js +33 -8
  57. package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
  58. package/node_modules/fast-copy/package.json +1 -1
  59. package/node_modules/object-inspect/CHANGELOG.md +31 -0
  60. package/node_modules/object-inspect/index.js +326 -24
  61. package/node_modules/object-inspect/package.json +22 -13
  62. package/node_modules/object-inspect/readme.markdown +4 -1
  63. package/node_modules/object-inspect/stringWidth.js +68 -0
  64. package/node_modules/object-inspect/stringWidthRanges.js +38 -0
  65. package/package.json +11 -11
  66. package/node_modules/@zuplo/runtime/out/esm/chunk-6KHAYHSW.js.map +0 -1
  67. package/node_modules/@zuplo/runtime/out/esm/chunk-I65Y62VQ.js.map +0 -1
  68. package/node_modules/object-inspect/.eslintrc +0 -53
  69. package/node_modules/object-inspect/.nycrc +0 -13
  70. package/node_modules/object-inspect/example/all.js +0 -23
  71. package/node_modules/object-inspect/example/circular.js +0 -6
  72. package/node_modules/object-inspect/example/fn.js +0 -5
  73. package/node_modules/object-inspect/example/inspect.js +0 -10
  74. package/node_modules/object-inspect/test/bigint.js +0 -58
  75. package/node_modules/object-inspect/test/browser/dom.js +0 -15
  76. package/node_modules/object-inspect/test/circular.js +0 -16
  77. package/node_modules/object-inspect/test/deep.js +0 -12
  78. package/node_modules/object-inspect/test/element.js +0 -53
  79. package/node_modules/object-inspect/test/err.js +0 -48
  80. package/node_modules/object-inspect/test/fakes.js +0 -29
  81. package/node_modules/object-inspect/test/fn.js +0 -76
  82. package/node_modules/object-inspect/test/global.js +0 -17
  83. package/node_modules/object-inspect/test/has.js +0 -15
  84. package/node_modules/object-inspect/test/holes.js +0 -15
  85. package/node_modules/object-inspect/test/indent-option.js +0 -271
  86. package/node_modules/object-inspect/test/inspect.js +0 -139
  87. package/node_modules/object-inspect/test/lowbyte.js +0 -12
  88. package/node_modules/object-inspect/test/number.js +0 -58
  89. package/node_modules/object-inspect/test/quoteStyle.js +0 -26
  90. package/node_modules/object-inspect/test/toStringTag.js +0 -40
  91. package/node_modules/object-inspect/test/undef.js +0 -12
  92. package/node_modules/object-inspect/test/values.js +0 -261
  93. package/node_modules/object-inspect/test-core-js.js +0 -26
  94. /package/node_modules/@zuplo/runtime/out/esm/{chunk-I65Y62VQ.js.LEGAL.txt → chunk-3ITT2MYM.js.LEGAL.txt} +0 -0
  95. /package/node_modules/@zuplo/runtime/out/esm/{chunk-5XXEIH5B.js.map → chunk-A7HRIAHJ.js.map} +0 -0
  96. /package/node_modules/@zuplo/runtime/out/esm/{chunk-6KHAYHSW.js.LEGAL.txt → chunk-C4ZTXG6P.js.LEGAL.txt} +0 -0
  97. /package/node_modules/@zuplo/runtime/out/esm/{chunk-APWLPHXH.js.map → chunk-JAY7SQGG.js.map} +0 -0
  98. /package/node_modules/@zuplo/runtime/out/esm/{chunk-MWNVPFFM.js.map → chunk-YTDIY7PP.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "formatVersion": 1,
3
- "target": "70b476fc2524c3c2ce0cc10ad5f91837a7aefceefb088542390c02754238693d",
3
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
4
4
  "snapshots": [
5
5
  {
6
6
  "revision": "f9f94ab6646b82abc66a167c95669a50b3e20a7dea224cac0d3893d4ddde6620",
@@ -88,6 +88,18 @@
88
88
  "tsconfig.json": "{\n \"include\": [\"modules/**/*\", \".zuplo/**/*\"],\n \"exclude\": [\"./node_modules\", \"./dist\", \"./docs\", \"./examples\"],\n \"compilerOptions\": {\n \"module\": \"ESNext\",\n \"target\": \"ES2022\",\n \"lib\": [\"ESNext\", \"WebWorker\", \"Webworker.Iterable\"],\n \"preserveConstEnums\": true,\n \"moduleResolution\": \"Bundler\",\n \"useUnknownInCatchVariables\": false,\n \"forceConsistentCasingInFileNames\": true,\n \"importHelpers\": true,\n \"removeComments\": true,\n \"esModuleInterop\": true,\n \"noEmit\": true,\n \"skipLibCheck\": true,\n \"strictNullChecks\": true,\n \"experimentalDecorators\": true\n }\n}\n",
89
89
  "zuplo.jsonc": "{\n \"version\": 1,\n \"compatibilityDate\": \"2026-03-01\"\n}\n"
90
90
  }
91
+ },
92
+ {
93
+ "revision": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
94
+ "sourceCommit": "66bbcc9070ec1ce76b9ed5d1f8d479ed23ef48cb",
95
+ "files": {
96
+ "README-template.md": "## Zuplo AI Gateway\n\nThis is a Zuplo AI Gateway that was created with\n[`create-zuplo-api`](https://zuplo.com/docs). It gives your applications one\nOpenAI-compatible API in front of many AI providers, with per-app keys, model\ncontrols, budgets, caching, and guardrails.\n\n## Getting Started\n\nThe gateway loads each app's configuration (providers, models, and policies)\nfrom your Zuplo account at request time, so the project must be linked to a\nZuplo project before it can serve requests.\n\n1. Link the project. This writes your project's settings to `.env.zuplo`, which\n is gitignored:\n\n ```bash\n npx zuplo link\n ```\n\n2. In the [Zuplo Portal](https://portal.zuplo.com), add a provider and create an\n app. Each app gets its own API URL and API key. See\n [Apps](https://zuplo.com/docs/ai-gateway/apps).\n\n3. Start the development server:\n\n ```bash\n npm run dev\n # or\n yarn dev\n # or\n pnpm dev\n ```\n\n4. Send a request to the local gateway. Replace `<app_id>` with the ID from your\n app's API URL and set `ZUPLO_APP_API_KEY` to the app's API key:\n\n ```bash\n curl http://localhost:9000/<app_id>/v1/chat/completions \\\n -H \"Authorization: Bearer $ZUPLO_APP_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"model\": \"openai/gpt-4o-mini\",\n \"messages\": [{ \"role\": \"user\", \"content\": \"Say hi\" }]\n }'\n ```\n\n## Endpoints\n\nEvery request is scoped to an app by the first path segment, `/{app_id}`. For\nthe supported endpoints and which providers serve each one, see the\n[AI Gateway documentation](https://zuplo.com/docs/ai-gateway/overview).\n\n## Project Structure\n\n| Path | What it does |\n| -------------------------- | ---------------------------------------------------------------------- |\n| `config/ai.oas.json` | The catch-all route that sends `/{app_id}/*` to the AI Gateway handler |\n| `config/policies.json` | The policies an app can select for its policy chain |\n| `modules/zuplo.runtime.ts` | Runtime plugins, such as tracing and logging |\n| `.env.example` | Sample environment variables. Copy it to `.env` for local development |\n\nAn app runs only the policies listed in its policy chain, and it can select only\npolicies declared in `config/policies.json`. To add your own policy, write it in\n`modules/` and declare it in `config/policies.json`.\n\n## Debugging\n\nIn VS Code, open **Run and Debug**, select **Launch & Attach Zuplo**, and click\nthe green play button.\n\nFor other editors and more details, see the\n[debugging guide](https://zuplo.com/docs/articles/local-development-debugging).\n\n## Deploying\n\nConnect the project to source control in the Zuplo Portal. Pushes to your\ndefault branch deploy the gateway to production.\n\n## Learn More\n\nTo learn more about the AI Gateway, visit the\n[AI Gateway documentation](https://zuplo.com/docs/ai-gateway/overview).\n\nTo connect with the community join [Discord](https://discord.zuplo.com).\n",
97
+ "config/ai.oas.json": "{\n \"openapi\": \"3.1.0\",\n \"info\": {\n \"version\": \"1.0.0\",\n \"title\": \"AI Gateway API\",\n \"description\": \"A unified API gateway for multiple AI providers. OpenAI-compatible ops are served under /{app_id}/v1/*, AWS Bedrock Runtime ops under /{app_id}/model/{modelId}/{operation}; other paths under /{app_id} are rejected.\"\n },\n \"paths\": {\n \"/u/:app_id/(.*)\": {\n \"x-zuplo-path\": {\n \"pathMode\": \"url-pattern\"\n },\n \"get,post,put,patch,delete,head\": {\n \"summary\": \"AI Gateway User App catch-all\",\n \"description\": \"Routes User App requests under /u/{app_id}/* to the AI Gateway handler. The configuration kind must be ai-user-app.\",\n \"operationId\": \"aiGatewayUserAppCatchAll\",\n \"responses\": {\n \"200\": {\n \"description\": \"Successful AI Gateway response\"\n },\n \"400\": {\n \"description\": \"Bad request\"\n },\n \"403\": {\n \"description\": \"Forbidden \\u2014 User App routes require a personal API key issued for this User App; application API keys cannot authenticate them\"\n },\n \"404\": {\n \"description\": \"Unsupported AI Gateway endpoint\"\n },\n \"500\": {\n \"description\": \"Internal server error\"\n }\n },\n \"x-zuplo-route\": {\n \"corsPolicy\": \"none\",\n \"handler\": {\n \"export\": \"aiGatewayHandlerV2\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"policies\": {\n \"inbound\": [\n \"ai-gateway-configuration-loader-inbound\",\n \"ai-gateway-configuration-executor-inbound\"\n ]\n }\n }\n }\n },\n \"/a/:app_id/(.*)\": {\n \"x-zuplo-path\": {\n \"pathMode\": \"url-pattern\"\n },\n \"get,post,put,patch,delete,head\": {\n \"summary\": \"AI Gateway AI App catch-all\",\n \"description\": \"Routes AI App requests under /a/{app_id}/* to the AI Gateway handler. The configuration kind must be ai-app.\",\n \"operationId\": \"aiGatewayAIAppCatchAll\",\n \"responses\": {\n \"200\": {\n \"description\": \"Successful AI Gateway response\"\n },\n \"400\": {\n \"description\": \"Bad request\"\n },\n \"401\": {\n \"description\": \"Unauthorized \\u2014 returned only when the application's inboundPolicyChain includes ai-gateway-auth-inbound, or authentication runs before the configuration loader\"\n },\n \"403\": {\n \"description\": \"Forbidden \\u2014 returned by per-app policies, such as an API key issued for a different app_id or a model the app does not allow\"\n },\n \"404\": {\n \"description\": \"Unsupported AI Gateway endpoint\"\n },\n \"500\": {\n \"description\": \"Internal server error\"\n }\n },\n \"x-zuplo-route\": {\n \"corsPolicy\": \"none\",\n \"handler\": {\n \"export\": \"aiGatewayHandlerV2\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"policies\": {\n \"inbound\": [\n \"ai-gateway-configuration-loader-inbound\",\n \"ai-gateway-configuration-executor-inbound\"\n ]\n }\n }\n }\n },\n \"/:app_id/(.*)\": {\n \"x-zuplo-path\": {\n \"pathMode\": \"url-pattern\"\n },\n \"get,post,put,patch,delete,head\": {\n \"summary\": \"AI Gateway catch-all\",\n \"description\": \"Routes AI requests under /{app_id}/* to the AI Gateway handler. The configuration loader loads the application configuration from the app_id path segment; the configuration executor then runs the application's inboundPolicyChain. Two path shapes succeed: a supported /v1/... operation (see resolveBasePath in packages/runtime/src/llm-translation/index.ts for the current set) and a Bedrock Runtime operation addressed AWS's way as /model/{modelId}/{operation} (see matchBedrockRuntimeRoute in packages/runtime/src/ai-gateway/bedrock-runtime-route.ts). Anything else under /{app_id} returns 404.\",\n \"operationId\": \"aiGatewayCatchAll\",\n \"responses\": {\n \"200\": {\n \"description\": \"Successful AI Gateway response\"\n },\n \"400\": {\n \"description\": \"Bad request\"\n },\n \"401\": {\n \"description\": \"Unauthorized \\u2014 returned only when the application's inboundPolicyChain includes ai-gateway-auth-inbound, or authentication runs before the configuration loader\"\n },\n \"403\": {\n \"description\": \"Forbidden \\u2014 returned by per-app policies, such as an API key issued for a different app_id or a model the app does not allow\"\n },\n \"404\": {\n \"description\": \"Unsupported AI Gateway endpoint\"\n },\n \"500\": {\n \"description\": \"Internal server error\"\n }\n },\n \"x-zuplo-route\": {\n \"corsPolicy\": \"none\",\n \"handler\": {\n \"export\": \"aiGatewayHandlerV2\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"policies\": {\n \"inbound\": [\n \"ai-gateway-configuration-loader-inbound\",\n \"ai-gateway-configuration-executor-inbound\"\n ]\n }\n }\n }\n }\n }\n}\n",
98
+ "config/policies.json": "{\n \"policies\": [\n {\n \"handler\": {\n \"export\": \"AIGatewayAuthInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"name\": \"ai-gateway-auth-inbound\",\n \"policyType\": \"ai-gateway-auth\"\n },\n {\n \"handler\": {\n \"export\": \"InternalOnlyInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"name\": \"internal-only-inbound\",\n \"policyType\": \"internal-only\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayConfigurationLoaderInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"cacheTtlSeconds\": 5\n }\n },\n \"name\": \"ai-gateway-configuration-loader-inbound\",\n \"policyType\": \"ai-gateway-configuration-loader\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayConfigurationExecutorInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"name\": \"ai-gateway-configuration-executor-inbound\",\n \"policyType\": \"ai-gateway-configuration-executor\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayMeteringInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {}\n },\n \"name\": \"ai-gateway-metering-inbound\",\n \"policyType\": \"ai-gateway-metering\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayModelOverrideInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"models\": {\n \"completions\": {\n \"default\": \"openai/gpt-4o-mini\"\n }\n }\n }\n },\n \"name\": \"ai-gateway-model-override-inbound\",\n \"policyType\": \"ai-gateway-model-override\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayModelFilteringInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"models\": {\n \"completions\": {\n \"allowList\": [\"openai/gpt-4o-mini\"]\n }\n }\n }\n },\n \"name\": \"ai-gateway-model-filtering-inbound\",\n \"policyType\": \"ai-gateway-model-filtering\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayLoadBalancingInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"strategy\": \"round-robin\",\n \"models\": {\n \"completions\": [\"openai/gpt-4o-mini\"]\n }\n }\n },\n \"name\": \"ai-gateway-load-balancing-inbound\",\n \"policyType\": \"ai-gateway-load-balancing\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayFallbackModelInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"models\": {\n \"completions\": {\n \"fallback\": \"openai/gpt-4o-mini\"\n }\n },\n \"fallbackTimeoutSeconds\": 60\n }\n },\n \"name\": \"ai-gateway-fallback-model-inbound\",\n \"policyType\": \"ai-gateway-fallback-model\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewaySemanticCacheInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"semanticTolerance\": 0.4,\n \"expirationSecondsTtl\": 3600\n }\n },\n \"name\": \"ai-gateway-semantic-cache-inbound\",\n \"policyType\": \"ai-gateway-semantic-cache\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayAkamaiFirewallInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"configurationId\": \"\",\n \"api-key\": \"\"\n }\n },\n \"name\": \"ai-gateway-akamai-firewall-inbound\",\n \"policyType\": \"ai-gateway-akamai-firewall\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayPromptInjectionPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"execution\": \"parallel\"\n }\n },\n \"name\": \"ai-gateway-prompt-injection\",\n \"policyType\": \"ai-gateway-prompt-injection\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayOpikTracingInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"apiKey\": \"\",\n \"projectName\": \"\",\n \"workspace\": \"\"\n }\n },\n \"name\": \"ai-gateway-opik-tracing-inbound\",\n \"policyType\": \"ai-gateway-opik-tracing\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayGalileoTracingInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"apiKey\": \"\",\n \"projectId\": \"\",\n \"logStreamId\": \"\"\n }\n },\n \"name\": \"ai-gateway-galileo-tracing-inbound\",\n \"policyType\": \"ai-gateway-galileo-tracing\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewayDlpInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"rules\": {\n \"inbound\": {\n \"pii\": {\n \"action\": \"mask\"\n },\n \"contact-email\": {\n \"action\": \"off\"\n },\n \"finance-credit-card\": {\n \"action\": \"mask\"\n },\n \"finance-iban\": {\n \"action\": \"mask\"\n }\n },\n \"outbound\": {\n \"pii\": {\n \"action\": \"mask\"\n },\n \"contact-email\": {\n \"action\": \"off\"\n },\n \"finance-credit-card\": {\n \"action\": \"mask\"\n },\n \"finance-iban\": {\n \"action\": \"mask\"\n }\n }\n }\n }\n },\n \"name\": \"ai-gateway-dlp-inbound\",\n \"policyType\": \"ai-gateway-dlp\"\n },\n {\n \"handler\": {\n \"export\": \"AIGatewaySmartRouterInboundPolicy\",\n \"module\": \"$import(@zuplo/runtime)\",\n \"options\": {\n \"classifier\": {\n \"app\": {\n \"appId\": \"\",\n \"model\": \"openai/gpt-4o-mini\"\n }\n },\n \"modelsByComplexity\": {\n \"low\": \"openai/gpt-4o-mini\",\n \"medium\": \"openai/gpt-4o\",\n \"high\": \"openai/gpt-5\"\n }\n }\n },\n \"name\": \"ai-gateway-smart-router-inbound\",\n \"policyType\": \"ai-gateway-smart-router\"\n }\n ]\n}\n",
99
+ "modules/zuplo.runtime.ts": "import type { RuntimeExtensions } from \"@zuplo/runtime\";\n\n/**\n * `runtimeInit` runs once when your gateway boots. Use it to register plugins\n * and lifecycle hooks. Docs:\n * https://zuplo.com/docs/programmable-api/runtime-extensions\n */\nexport function runtimeInit(runtime: RuntimeExtensions) {\n // `runtime` is unused until you enable a plugin below. This reference keeps\n // linters from flagging it; delete it once you call `runtime.addPlugin`.\n void runtime;\n\n // --- OpenTelemetry tracing (optional) ------------------------------------\n // Send traces to Zuplo's built-in tracing. This can also be configured to\n // send traces to a third-party service such as Honeycomb, Grafana, and\n // others. Docs: https://zuplo.com/docs/articles/opentelemetry\n //\n // To enable, run `npm install @zuplo/otel`, then import `OpenTelemetryPlugin`\n // from \"@zuplo/otel\" and `environment` from \"@zuplo/runtime\":\n // const isWorkingCopy =\n // environment.ZUPLO_ENVIRONMENT_STAGE === \"working-copy\";\n // runtime.addPlugin(\n // new OpenTelemetryPlugin({\n // sampling: {\n // headSampler: { ratio: isWorkingCopy ? 1 : 0.1 },\n // },\n // }),\n // );\n // --- Logging (optional) --------------------------------------------------\n // Ship request logs to Datadog. Other log integrations (New Relic, Splunk,\n // Loki, Dynatrace, and others) follow the same pattern — see the logging\n // overview at https://zuplo.com/docs/articles/logging.\n // Docs: https://zuplo.com/docs/articles/log-plugin-datadog\n //\n // To enable, import the plugin and `environment` from \"@zuplo/runtime\":\n // runtime.addPlugin(\n // new DataDogLoggingPlugin({\n // apiKey: environment.DATADOG_API_KEY,\n // source: \"my-ai-gateway\",\n // }),\n // );\n}\n",
100
+ "tsconfig.json": "{\n \"include\": [\"modules/**/*\", \".zuplo/**/*\"],\n \"exclude\": [\"./node_modules\", \"./dist\", \"./docs\", \"./examples\"],\n \"compilerOptions\": {\n \"module\": \"ESNext\",\n \"target\": \"ES2022\",\n \"lib\": [\"ESNext\", \"WebWorker\", \"Webworker.Iterable\"],\n \"preserveConstEnums\": true,\n \"moduleResolution\": \"Bundler\",\n \"useUnknownInCatchVariables\": false,\n \"forceConsistentCasingInFileNames\": true,\n \"importHelpers\": true,\n \"removeComments\": true,\n \"esModuleInterop\": true,\n \"noEmit\": true,\n \"skipLibCheck\": true,\n \"strictNullChecks\": true,\n \"experimentalDecorators\": true\n }\n}\n",
101
+ "zuplo.jsonc": "{\n \"version\": 1,\n \"compatibilityDate\": \"2026-11-06\"\n}\n"
102
+ }
91
103
  }
92
104
  ],
93
105
  "aliases": {
@@ -558,6 +570,158 @@
558
570
  "target": "70b476fc2524c3c2ce0cc10ad5f91837a7aefceefb088542390c02754238693d",
559
571
  "runtime": "release",
560
572
  "instructions": "Review the definition and application policy chains before adding it."
573
+ },
574
+ {
575
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:route:/u/:app_id/(.*)",
576
+ "kind": "route",
577
+ "key": "/u/:app_id/(.*)",
578
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
579
+ "runtime": "release",
580
+ "instructions": "Insert before /:app_id/(.*), with the displayed inbound policy order."
581
+ },
582
+ {
583
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:route:/a/:app_id/(.*)",
584
+ "kind": "route",
585
+ "key": "/a/:app_id/(.*)",
586
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
587
+ "runtime": "release",
588
+ "instructions": "Insert before /:app_id/(.*), with the displayed inbound policy order."
589
+ },
590
+ {
591
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:route:/:app_id/(.*)",
592
+ "kind": "route",
593
+ "key": "/:app_id/(.*)",
594
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
595
+ "runtime": "release",
596
+ "instructions": "Review the definition and application policy chains before adding it."
597
+ },
598
+ {
599
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-auth-inbound",
600
+ "kind": "policy",
601
+ "key": "ai-gateway-auth-inbound",
602
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
603
+ "runtime": "release",
604
+ "instructions": "Review the definition and application policy chains before adding it."
605
+ },
606
+ {
607
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-internal-only-inbound",
608
+ "kind": "policy",
609
+ "key": "internal-only-inbound",
610
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
611
+ "runtime": "release",
612
+ "instructions": "Add only if neither internal-only-inbound nor its historical AI Gateway alias is declared. Preserve existing declarations and application chain references."
613
+ },
614
+ {
615
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-configuration-loader-inbound",
616
+ "kind": "policy",
617
+ "key": "ai-gateway-configuration-loader-inbound",
618
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
619
+ "runtime": "release",
620
+ "instructions": "Review the definition and application policy chains before adding it."
621
+ },
622
+ {
623
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-configuration-executor-inbound",
624
+ "kind": "policy",
625
+ "key": "ai-gateway-configuration-executor-inbound",
626
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
627
+ "runtime": "release",
628
+ "instructions": "Review the definition and application policy chains before adding it."
629
+ },
630
+ {
631
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-metering-inbound",
632
+ "kind": "policy",
633
+ "key": "ai-gateway-metering-inbound",
634
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
635
+ "runtime": "release",
636
+ "instructions": "Review the definition and application policy chains before adding it."
637
+ },
638
+ {
639
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-model-override-inbound",
640
+ "kind": "policy",
641
+ "key": "ai-gateway-model-override-inbound",
642
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
643
+ "runtime": "release",
644
+ "instructions": "Review the definition and application policy chains before adding it."
645
+ },
646
+ {
647
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-model-filtering-inbound",
648
+ "kind": "policy",
649
+ "key": "ai-gateway-model-filtering-inbound",
650
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
651
+ "runtime": "release",
652
+ "instructions": "Review the definition and application policy chains before adding it."
653
+ },
654
+ {
655
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-load-balancing-inbound",
656
+ "kind": "policy",
657
+ "key": "ai-gateway-load-balancing-inbound",
658
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
659
+ "runtime": "release",
660
+ "instructions": "Add only if it is not declared. No route or app uses it until an app's inboundPolicyChain names it; review the default models list before an app does."
661
+ },
662
+ {
663
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-fallback-model-inbound",
664
+ "kind": "policy",
665
+ "key": "ai-gateway-fallback-model-inbound",
666
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
667
+ "runtime": "release",
668
+ "instructions": "Review the definition and application policy chains before adding it."
669
+ },
670
+ {
671
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-semantic-cache-inbound",
672
+ "kind": "policy",
673
+ "key": "ai-gateway-semantic-cache-inbound",
674
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
675
+ "runtime": "release",
676
+ "instructions": "Review the definition and application policy chains before adding it."
677
+ },
678
+ {
679
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-akamai-firewall-inbound",
680
+ "kind": "policy",
681
+ "key": "ai-gateway-akamai-firewall-inbound",
682
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
683
+ "runtime": "release",
684
+ "instructions": "Review the definition and application policy chains before adding it."
685
+ },
686
+ {
687
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-prompt-injection",
688
+ "kind": "policy",
689
+ "key": "ai-gateway-prompt-injection",
690
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
691
+ "runtime": "release",
692
+ "instructions": "Review the definition and application policy chains before adding it."
693
+ },
694
+ {
695
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-opik-tracing-inbound",
696
+ "kind": "policy",
697
+ "key": "ai-gateway-opik-tracing-inbound",
698
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
699
+ "runtime": "release",
700
+ "instructions": "Review the definition and application policy chains before adding it."
701
+ },
702
+ {
703
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-galileo-tracing-inbound",
704
+ "kind": "policy",
705
+ "key": "ai-gateway-galileo-tracing-inbound",
706
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
707
+ "runtime": "release",
708
+ "instructions": "Review the definition and application policy chains before adding it."
709
+ },
710
+ {
711
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-dlp-inbound",
712
+ "kind": "policy",
713
+ "key": "ai-gateway-dlp-inbound",
714
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
715
+ "runtime": "release",
716
+ "instructions": "Review the definition and application policy chains before adding it."
717
+ },
718
+ {
719
+ "id": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493:policy:ai-gateway-smart-router-inbound",
720
+ "kind": "policy",
721
+ "key": "ai-gateway-smart-router-inbound",
722
+ "target": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
723
+ "runtime": "release",
724
+ "instructions": "Review the definition and application policy chains before adding it."
561
725
  }
562
726
  ],
563
727
  "assessments": [
@@ -575,6 +739,11 @@
575
739
  "revision": "70b476fc2524c3c2ce0cc10ad5f91837a7aefceefb088542390c02754238693d",
576
740
  "classification": "additions",
577
741
  "instructions": "Adds the Model Load Balancing policy declaration, ai-gateway-load-balancing-inbound (AIGatewayLoadBalancingInboundPolicy, policyType ai-gateway-load-balancing). Declaring it changes no routing: an app uses it only when its inboundPolicyChain names it. Existing routes, declarations, and historical aliases are preserved. Other existing policy options and defaults still require separate review."
742
+ },
743
+ {
744
+ "revision": "b41992353931b1ac8f010c5469a2e45a1d94797bf5e2398f94511321086b7493",
745
+ "classification": "documentation-only",
746
+ "instructions": "New AI Gateway projects now start on compatibility date 2026-11-06, the current default, instead of 2026-03-01. No route or policy declaration changed, so there is nothing to add, and the upgrade never edits zuplo.jsonc: an existing project keeps its compatibility date. To move to 2026-11-06, review the behavior changes that date turns on (https://zuplo.com/docs/programmable-api/compatibility-dates), then set compatibilityDate in zuplo.jsonc yourself, build, and test. On 2026-11-06 a blank required string option fails the policy when it is created: an application whose inboundPolicyChain selects ai-gateway-akamai-firewall-inbound, ai-gateway-opik-tracing-inbound or ai-gateway-galileo-tracing-inbound must give that entry its credentials (in the entry's options or the declaration), or its requests fail with a configuration error. Before 2026-11-06 the Akamai firewall already failed such requests, while Opik and Galileo tracing let them run untraced. Other existing policy options and defaults still require separate review."
578
747
  }
579
748
  ]
580
749
  }
@@ -50,8 +50,8 @@ export declare const catalogSchema: z.ZodObject<
50
50
  revision: z.ZodString;
51
51
  classification: z.ZodEnum<{
52
52
  additions: "additions";
53
- manual: "manual";
54
53
  "documentation-only": "documentation-only";
54
+ manual: "manual";
55
55
  }>;
56
56
  instructions: z.ZodString;
57
57
  },
@@ -81,7 +81,7 @@ export declare const catalog: {
81
81
  }[];
82
82
  assessments: {
83
83
  revision: string;
84
- classification: "additions" | "manual" | "documentation-only";
84
+ classification: "additions" | "documentation-only" | "manual";
85
85
  instructions: string;
86
86
  }[];
87
87
  };
@@ -5,7 +5,7 @@ function isCloudflareWorkers() {
5
5
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
6
6
  }
7
7
  let USER_AGENT;
8
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.17");
8
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.18");
9
9
  const customFetch = /* @__PURE__ */ Symbol();
10
10
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
11
11
  const response = await fetchImpl(url, {
@@ -21,7 +21,7 @@ async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
21
21
  try {
22
22
  return await response.json();
23
23
  } catch (cause) {
24
- throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
24
+ throw signal.aborted ? new JWKSTimeout(void 0, { cause }) : new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
25
25
  }
26
26
  }
27
27
  const jwksCache = /* @__PURE__ */ Symbol();
@@ -29,15 +29,12 @@ class EncryptJWT extends EncryptJWT_base {
29
29
  return this.#replicateAudienceAsHeader = !0, this;
30
30
  }
31
31
  async encrypt(key, options) {
32
- const plaintext = jwtClaimsSetBytes(this);
33
- this.#input[1] && (this.#replicateIssuerAsHeader || this.#replicateSubjectAsHeader || this.#replicateAudienceAsHeader) && (this.#input[1] = {
34
- ...this.#input[1],
35
- iss: this.#replicateIssuerAsHeader ? jwtClaim(this, "iss") : void 0,
36
- sub: this.#replicateSubjectAsHeader ? jwtClaim(this, "sub") : void 0,
37
- aud: this.#replicateAudienceAsHeader ? jwtClaim(this, "aud") : void 0
38
- });
39
32
  const input = [...this.#input];
40
- return input[0] = plaintext, compactJWE(await createJWE(input, key, options));
33
+ if (input[0] = jwtClaimsSetBytes(this), input[1] && (this.#replicateIssuerAsHeader || this.#replicateSubjectAsHeader || this.#replicateAudienceAsHeader)) {
34
+ const header = { ...input[1] };
35
+ this.#replicateIssuerAsHeader && (header.iss = jwtClaim(this, "iss")), this.#replicateSubjectAsHeader && (header.sub = jwtClaim(this, "sub")), this.#replicateAudienceAsHeader && (header.aud = jwtClaim(this, "aud")), input[1] = header;
36
+ }
37
+ return compactJWE(await createJWE(input, key, options));
41
38
  }
42
39
  }
43
40
  export {
@@ -151,7 +151,7 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
151
151
  if (decompressionLimit === 0)
152
152
  throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
153
153
  plaintext = await decompress(plaintext, decompressionLimit).catch((cause) => {
154
- throw cause instanceof JWEInvalid ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
154
+ throw cause instanceof JWEInvalid || cause instanceof JOSENotSupported ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
155
155
  });
156
156
  }
157
157
  return {
@@ -1,7 +1,7 @@
1
1
  import { encode as b64u } from "../util/base64url.js";
2
2
  import { encrypt } from "./content_encryption.js";
3
3
  import { encryptKeyManagement } from "./key_management.js";
4
- import { JWEInvalid } from "../util/errors.js";
4
+ import { JOSENotSupported, JWEInvalid } from "../util/errors.js";
5
5
  import { assertUint8Array, isDisjoint, isObject, serializeJoseHeader, validateCrit, validateCritDuplicates, JWE_RECOGNIZED } from "./validate.js";
6
6
  import { encode } from "./buffer_utils.js";
7
7
  import { prepareKey } from "./key.js";
@@ -51,7 +51,7 @@ async function encryptJWE(input, checked, key) {
51
51
  const encodedProtectedHeader = protectedHeader ? b64u(JSON.stringify(protectedHeader)) : "", encodedAad = aad?.byteLength ? b64u(aad) : void 0, additionalAuthenticatedData = encode(encodedAad ? `${encodedProtectedHeader}.${encodedAad}` : encodedProtectedHeader);
52
52
  let plaintext = inputPlaintext;
53
53
  joseHeader.zip === "DEF" && (plaintext = await compress(plaintext).catch((cause) => {
54
- throw new JWEInvalid("Failed to compress plaintext", { cause });
54
+ throw cause instanceof JOSENotSupported ? cause : new JWEInvalid("Failed to compress plaintext", { cause });
55
55
  }));
56
56
  let ciphertext, tag, iv;
57
57
  algEntry.mode === "integrated-encryption" ? [encryptedKey, ciphertext] = await algEntry.encrypt(cek, plaintext, additionalAuthenticatedData, protectedHeader, joseHeader, keyManagementParameters) : { ciphertext, tag, iv } = await encrypt(encEntry, plaintext, cek, inputIv, additionalAuthenticatedData);
@@ -17,7 +17,7 @@ function secs(str) {
17
17
  const matched = REGEX.exec(str);
18
18
  (!matched || matched[4] && matched[1]) && invalidDuration();
19
19
  const value = parseFloat(matched[2]), durationSeconds = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
20
- return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -durationSeconds : durationSeconds;
20
+ return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4]?.toLowerCase() === "ago" ? -durationSeconds : durationSeconds;
21
21
  }
22
22
  function validateInput(label, input) {
23
23
  if (!Number.isFinite(input))
@@ -8,6 +8,8 @@ const tag = (key) => key[Symbol.toStringTag], jwkMatchesOp = (entry, key, usage)
8
8
  if (key.use !== expected)
9
9
  throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`);
10
10
  }
11
+ if (key.kty === "AKP" && key.alg === void 0)
12
+ throw new TypeError('missing "alg" (Algorithm) Parameter value');
11
13
  if (key.alg !== void 0 && key.alg !== alg)
12
14
  throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`);
13
15
  if (Array.isArray(key.key_ops)) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.17",
3
+ "version": "6.2.18",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",
@@ -5,7 +5,7 @@ function isCloudflareWorkers() {
5
5
  return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
6
6
  }
7
7
  let USER_AGENT;
8
- (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.17");
8
+ (typeof navigator > "u" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) && (USER_AGENT = "jose/v6.2.18");
9
9
  const customFetch = /* @__PURE__ */ Symbol();
10
10
  async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
11
11
  const response = await fetchImpl(url, {
@@ -21,7 +21,7 @@ async function fetchJwks(url, headers, signal, fetchImpl = fetch) {
21
21
  try {
22
22
  return await response.json();
23
23
  } catch (cause) {
24
- throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
24
+ throw signal.aborted ? new JWKSTimeout(void 0, { cause }) : new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON", { cause });
25
25
  }
26
26
  }
27
27
  const jwksCache = /* @__PURE__ */ Symbol();
@@ -29,15 +29,12 @@ class EncryptJWT extends EncryptJWT_base {
29
29
  return this.#replicateAudienceAsHeader = !0, this;
30
30
  }
31
31
  async encrypt(key, options) {
32
- const plaintext = jwtClaimsSetBytes(this);
33
- this.#input[1] && (this.#replicateIssuerAsHeader || this.#replicateSubjectAsHeader || this.#replicateAudienceAsHeader) && (this.#input[1] = {
34
- ...this.#input[1],
35
- iss: this.#replicateIssuerAsHeader ? jwtClaim(this, "iss") : void 0,
36
- sub: this.#replicateSubjectAsHeader ? jwtClaim(this, "sub") : void 0,
37
- aud: this.#replicateAudienceAsHeader ? jwtClaim(this, "aud") : void 0
38
- });
39
32
  const input = [...this.#input];
40
- return input[0] = plaintext, compactJWE(await createJWE(input, key, options));
33
+ if (input[0] = jwtClaimsSetBytes(this), input[1] && (this.#replicateIssuerAsHeader || this.#replicateSubjectAsHeader || this.#replicateAudienceAsHeader)) {
34
+ const header = { ...input[1] };
35
+ this.#replicateIssuerAsHeader && (header.iss = jwtClaim(this, "iss")), this.#replicateSubjectAsHeader && (header.sub = jwtClaim(this, "sub")), this.#replicateAudienceAsHeader && (header.aud = jwtClaim(this, "aud")), input[1] = header;
36
+ }
37
+ return compactJWE(await createJWE(input, key, options));
41
38
  }
42
39
  }
43
40
  export {
@@ -151,7 +151,7 @@ async function decryptJWE(jwe, shared, key, token = shareJWE(jwe)) {
151
151
  if (decompressionLimit === 0)
152
152
  throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
153
153
  plaintext = await decompress(plaintext, decompressionLimit).catch((cause) => {
154
- throw cause instanceof JWEInvalid ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
154
+ throw cause instanceof JWEInvalid || cause instanceof JOSENotSupported ? cause : new JWEInvalid("Failed to decompress plaintext", { cause });
155
155
  });
156
156
  }
157
157
  return {
@@ -1,7 +1,7 @@
1
1
  import { encode as b64u } from "../util/base64url.js";
2
2
  import { encrypt } from "./content_encryption.js";
3
3
  import { encryptKeyManagement } from "./key_management.js";
4
- import { JWEInvalid } from "../util/errors.js";
4
+ import { JOSENotSupported, JWEInvalid } from "../util/errors.js";
5
5
  import { assertUint8Array, isDisjoint, isObject, serializeJoseHeader, validateCrit, validateCritDuplicates, JWE_RECOGNIZED } from "./validate.js";
6
6
  import { encode } from "./buffer_utils.js";
7
7
  import { prepareKey } from "./key.js";
@@ -51,7 +51,7 @@ async function encryptJWE(input, checked, key) {
51
51
  const encodedProtectedHeader = protectedHeader ? b64u(JSON.stringify(protectedHeader)) : "", encodedAad = aad?.byteLength ? b64u(aad) : void 0, additionalAuthenticatedData = encode(encodedAad ? `${encodedProtectedHeader}.${encodedAad}` : encodedProtectedHeader);
52
52
  let plaintext = inputPlaintext;
53
53
  joseHeader.zip === "DEF" && (plaintext = await compress(plaintext).catch((cause) => {
54
- throw new JWEInvalid("Failed to compress plaintext", { cause });
54
+ throw cause instanceof JOSENotSupported ? cause : new JWEInvalid("Failed to compress plaintext", { cause });
55
55
  }));
56
56
  let ciphertext, tag, iv;
57
57
  algEntry.mode === "integrated-encryption" ? [encryptedKey, ciphertext] = await algEntry.encrypt(cek, plaintext, additionalAuthenticatedData, protectedHeader, joseHeader, keyManagementParameters) : { ciphertext, tag, iv } = await encrypt(encEntry, plaintext, cek, inputIv, additionalAuthenticatedData);
@@ -17,7 +17,7 @@ function secs(str) {
17
17
  const matched = REGEX.exec(str);
18
18
  (!matched || matched[4] && matched[1]) && invalidDuration();
19
19
  const value = parseFloat(matched[2]), durationSeconds = Math.round(value * multipliers[matched[3][0].toLowerCase()]);
20
- return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4] === "ago" ? -durationSeconds : durationSeconds;
20
+ return Number.isFinite(durationSeconds) || invalidDuration(), matched[1] === "-" || matched[4]?.toLowerCase() === "ago" ? -durationSeconds : durationSeconds;
21
21
  }
22
22
  function validateInput(label, input) {
23
23
  if (!Number.isFinite(input))
@@ -8,6 +8,8 @@ const tag = (key) => key[Symbol.toStringTag], jwkMatchesOp = (entry, key, usage)
8
8
  if (key.use !== expected)
9
9
  throw new TypeError(`Invalid key for this operation, its "use" must be "${expected}" when present`);
10
10
  }
11
+ if (key.kty === "AKP" && key.alg === void 0)
12
+ throw new TypeError('missing "alg" (Algorithm) Parameter value');
11
13
  if (key.alg !== void 0 && key.alg !== alg)
12
14
  throw new TypeError(`Invalid key for this operation, its "alg" must be "${alg}" when present`);
13
15
  if (Array.isArray(key.key_ops)) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.17",
3
+ "version": "6.2.18",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",
@@ -7,6 +7,8 @@ export declare const isGzipData: (body: unknown) => boolean;
7
7
  export declare const isGzipRequest: (compression?: unknown, urlCompression?: unknown) => boolean;
8
8
  export declare const isNativeAsyncGzipReadError: (error: unknown) => boolean;
9
9
  export declare const isNativeAsyncGzipError: (error: unknown) => boolean;
10
+ /** @internal */
11
+ export declare const __resetNativeGzipTrustForTests: () => void;
10
12
  export type GzipCompressOptions = {
11
13
  /**
12
14
  * By default this helper swallows compression errors and returns null.
@@ -1 +1 @@
1
- {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../src/gzip.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAOzC;AAWD,eAAO,MAAM,UAAU,SAAU,OAAO,KAAG,OAU1C,CAAA;AAED,eAAO,MAAM,aAAa,iBAAkB,OAAO,mBAAmB,OAAO,KAAG,OAE/E,CAAA;AAED,eAAO,MAAM,0BAA0B,UAAW,OAAO,KAAG,OAQ3D,CAAA;AAED,eAAO,MAAM,sBAAsB,UAAW,OAAO,KAAG,OAQvD,CAAA;AAwDD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAgCrH"}
1
+ {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../src/gzip.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAOzC;AAWD,eAAO,MAAM,UAAU,SAAU,OAAO,KAAG,OAU1C,CAAA;AAED,eAAO,MAAM,aAAa,iBAAkB,OAAO,mBAAmB,OAAO,KAAG,OAE/E,CAAA;AAED,eAAO,MAAM,0BAA0B,UAAW,OAAO,KAAG,OAQ3D,CAAA;AAED,eAAO,MAAM,sBAAsB,UAAW,OAAO,KAAG,OAQvD,CAAA;AA0CD,gBAAgB;AAChB,eAAO,MAAM,8BAA8B,QAAO,IAGjD,CAAA;AA2BD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAgCrH"}
@@ -28,6 +28,7 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  __webpack_require__.d(__webpack_exports__, {
31
+ __resetNativeGzipTrustForTests: ()=>__resetNativeGzipTrustForTests,
31
32
  gzipCompress: ()=>gzipCompress,
32
33
  isGzipData: ()=>isGzipData,
33
34
  isGzipRequest: ()=>isGzipRequest,
@@ -81,14 +82,27 @@ const crc32 = (bytes)=>{
81
82
  const throwNativeGzipValidationError = (reason)=>{
82
83
  throw (0, index_js_namespaceObject.createNamedError)(NATIVE_GZIP_VALIDATION_ERROR, `Native gzip produced invalid output: ${reason}`);
83
84
  };
85
+ const CRC_VALIDATED_COMPRESSIONS_BEFORE_TRUST = 3;
86
+ let crcValidatedCompressions = 0;
87
+ let crcMismatchSeen = false;
88
+ const __resetNativeGzipTrustForTests = ()=>{
89
+ crcValidatedCompressions = 0;
90
+ crcMismatchSeen = false;
91
+ };
84
92
  const validateNativeGzip = async (compressed, inputBytes)=>{
85
93
  if (compressed.size < 18) throwNativeGzipValidationError('too-short');
86
94
  const header = new Uint8Array(await compressed.slice(0, 10).arrayBuffer());
87
95
  if (!hasGzipMagic(header) || header[2] !== GZIP_DEFLATE_METHOD) throwNativeGzipValidationError('invalid-header');
88
96
  const trailer = new DataView(await compressed.slice(compressed.size - 8).arrayBuffer());
89
- if (trailer.getUint32(0, true) !== crc32(inputBytes)) throwNativeGzipValidationError('invalid-crc');
90
97
  const inputSize = inputBytes.length >>> 0;
91
98
  if (trailer.getUint32(4, true) !== inputSize) throwNativeGzipValidationError('invalid-size');
99
+ if (crcMismatchSeen || crcValidatedCompressions < CRC_VALIDATED_COMPRESSIONS_BEFORE_TRUST) {
100
+ if (trailer.getUint32(0, true) !== crc32(inputBytes)) {
101
+ crcMismatchSeen = true;
102
+ throwNativeGzipValidationError('invalid-crc');
103
+ }
104
+ crcValidatedCompressions++;
105
+ }
92
106
  };
93
107
  async function gzipCompress(input, isDebug = true, options) {
94
108
  try {
@@ -114,6 +128,7 @@ async function gzipCompress(input, isDebug = true, options) {
114
128
  return null;
115
129
  }
116
130
  }
131
+ exports.__resetNativeGzipTrustForTests = __webpack_exports__.__resetNativeGzipTrustForTests;
117
132
  exports.gzipCompress = __webpack_exports__.gzipCompress;
118
133
  exports.isGzipData = __webpack_exports__.isGzipData;
119
134
  exports.isGzipRequest = __webpack_exports__.isGzipRequest;
@@ -121,6 +136,7 @@ exports.isGzipSupported = __webpack_exports__.isGzipSupported;
121
136
  exports.isNativeAsyncGzipError = __webpack_exports__.isNativeAsyncGzipError;
122
137
  exports.isNativeAsyncGzipReadError = __webpack_exports__.isNativeAsyncGzipReadError;
123
138
  for(var __rspack_i in __webpack_exports__)if (-1 === [
139
+ "__resetNativeGzipTrustForTests",
124
140
  "gzipCompress",
125
141
  "isGzipData",
126
142
  "isGzipRequest",
@@ -44,14 +44,27 @@ const crc32 = (bytes)=>{
44
44
  const throwNativeGzipValidationError = (reason)=>{
45
45
  throw createNamedError(NATIVE_GZIP_VALIDATION_ERROR, `Native gzip produced invalid output: ${reason}`);
46
46
  };
47
+ const CRC_VALIDATED_COMPRESSIONS_BEFORE_TRUST = 3;
48
+ let crcValidatedCompressions = 0;
49
+ let crcMismatchSeen = false;
50
+ const __resetNativeGzipTrustForTests = ()=>{
51
+ crcValidatedCompressions = 0;
52
+ crcMismatchSeen = false;
53
+ };
47
54
  const validateNativeGzip = async (compressed, inputBytes)=>{
48
55
  if (compressed.size < 18) throwNativeGzipValidationError('too-short');
49
56
  const header = new Uint8Array(await compressed.slice(0, 10).arrayBuffer());
50
57
  if (!hasGzipMagic(header) || header[2] !== GZIP_DEFLATE_METHOD) throwNativeGzipValidationError('invalid-header');
51
58
  const trailer = new DataView(await compressed.slice(compressed.size - 8).arrayBuffer());
52
- if (trailer.getUint32(0, true) !== crc32(inputBytes)) throwNativeGzipValidationError('invalid-crc');
53
59
  const inputSize = inputBytes.length >>> 0;
54
60
  if (trailer.getUint32(4, true) !== inputSize) throwNativeGzipValidationError('invalid-size');
61
+ if (crcMismatchSeen || crcValidatedCompressions < CRC_VALIDATED_COMPRESSIONS_BEFORE_TRUST) {
62
+ if (trailer.getUint32(0, true) !== crc32(inputBytes)) {
63
+ crcMismatchSeen = true;
64
+ throwNativeGzipValidationError('invalid-crc');
65
+ }
66
+ crcValidatedCompressions++;
67
+ }
55
68
  };
56
69
  async function gzipCompress(input, isDebug = true, options) {
57
70
  try {
@@ -77,4 +90,4 @@ async function gzipCompress(input, isDebug = true, options) {
77
90
  return null;
78
91
  }
79
92
  }
80
- export { gzipCompress, isGzipData, isGzipRequest, isGzipSupported, isNativeAsyncGzipError, isNativeAsyncGzipReadError };
93
+ export { __resetNativeGzipTrustForTests, gzipCompress, isGzipData, isGzipRequest, isGzipSupported, isNativeAsyncGzipError, isNativeAsyncGzipReadError };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.69.1",
3
+ "version": "1.69.2",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -72,7 +72,7 @@
72
72
  }
73
73
  },
74
74
  "dependencies": {
75
- "@posthog/types": "^1.425.1"
75
+ "@posthog/types": "^1.427.0"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@rslib/core": "0.23.2",