@zuplo/cli 6.71.20 → 6.71.22
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/node_modules/@posthog/core/dist/error-tracking/exception-steps.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/error-tracking/exception-steps.js +6 -24
- package/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs +7 -25
- package/node_modules/@posthog/core/dist/featureFlagUtils.d.ts +2 -1
- package/node_modules/@posthog/core/dist/featureFlagUtils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/featureFlagUtils.js +13 -0
- package/node_modules/@posthog/core/dist/featureFlagUtils.mjs +11 -1
- package/node_modules/@posthog/core/dist/index.d.ts +1 -1
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +15 -6
- package/node_modules/@posthog/core/dist/index.mjs +2 -2
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +2 -0
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +34 -8
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +35 -9
- package/node_modules/@posthog/core/dist/posthog-core.d.ts +5 -0
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +3 -0
- package/node_modules/@posthog/core/dist/posthog-core.mjs +4 -1
- package/node_modules/@posthog/core/dist/types.d.ts +7 -0
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/string-utils.d.ts +1 -0
- package/node_modules/@posthog/core/dist/utils/string-utils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/utils/string-utils.js +21 -0
- package/node_modules/@posthog/core/dist/utils/string-utils.mjs +19 -1
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/error-tracking/exception-steps.ts +5 -42
- package/node_modules/@posthog/core/src/featureFlagUtils.ts +14 -0
- package/node_modules/@posthog/core/src/index.ts +7 -1
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +57 -11
- package/node_modules/@posthog/core/src/posthog-core.ts +9 -0
- package/node_modules/@posthog/core/src/types.ts +7 -0
- package/node_modules/@posthog/core/src/utils/string-utils.spec.ts +38 -1
- package/node_modules/@posthog/core/src/utils/string-utils.ts +42 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +16 -0
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/posthog-config.ts +17 -0
- package/node_modules/@zuplo/core/customer.cli.minified.js +2 -2
- package/node_modules/@zuplo/core/index.minified.js +2 -2
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/out/esm/index.js +34 -34
- package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/graphql/out/types/index.d.ts +109 -0
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-S4J2WCVZ.js → chunk-36XLJ4X6.js} +143 -111
- package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-DQ4ANJLR.js → chunk-4MNJC7E2.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/chunk-4MNJC7E2.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js → chunk-54PA7VDV.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-2Y72LML3.js.map → chunk-54PA7VDV.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js → chunk-DSZS6PZJ.js} +10 -10
- package/node_modules/@zuplo/runtime/out/esm/chunk-DSZS6PZJ.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +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/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +1007 -4
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js +24 -14
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +24 -14
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/package.json +2 -2
- package/node_modules/fast-uri/index.js +1 -1
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/security.test.js +28 -0
- package/node_modules/range-parser/README.md +13 -12
- package/node_modules/range-parser/index.js +27 -8
- package/node_modules/range-parser/package.json +12 -8
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-DQ4ANJLR.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-L3MZGNQA.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-S4J2WCVZ.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-S4J2WCVZ.js.LEGAL.txt → chunk-36XLJ4X6.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-L3MZGNQA.js.LEGAL.txt → chunk-DSZS6PZJ.js.LEGAL.txt} +0 -0
|
@@ -1,6 +1,115 @@
|
|
|
1
1
|
import { InboundPolicyHandler } from "@zuplo/runtime";
|
|
2
2
|
import { OutboundPolicyHandler } from "@zuplo/runtime";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Caches GraphQL query responses at the edge so identical queries are served
|
|
6
|
+
* without a round-trip to the origin.
|
|
7
|
+
*
|
|
8
|
+
* Unlike CDN caching that keys on the raw request body, this policy parses the
|
|
9
|
+
* GraphQL document and normalizes it before hashing: insignificant whitespace,
|
|
10
|
+
* field formatting, and fragment layout are collapsed, and variable object
|
|
11
|
+
* keys are sorted. Two requests that are semantically identical therefore share
|
|
12
|
+
* a cache entry even when their bodies differ byte-for-byte. There is no query
|
|
13
|
+
* size or nesting-depth limit.
|
|
14
|
+
*
|
|
15
|
+
* Only `query` operations are cached. Mutations, subscriptions, malformed
|
|
16
|
+
* documents, and non-JSON bodies are forwarded to the origin untouched. Cache
|
|
17
|
+
* hits and misses are reported on the `x-cache` response header, with a short
|
|
18
|
+
* key fingerprint on `x-cache-key`.
|
|
19
|
+
*
|
|
20
|
+
* To avoid serving one user's data to another, requests carrying an
|
|
21
|
+
* `authorization` or `cookie` header are not cached by default. Use
|
|
22
|
+
* `cacheKeyHeaders` to opt into caching them: each listed header's value is
|
|
23
|
+
* included in the cache key, so distinct credentials get distinct cache entries.
|
|
24
|
+
*
|
|
25
|
+
* @title GraphQL Cache
|
|
26
|
+
* @product api-gateway
|
|
27
|
+
* @public
|
|
28
|
+
*
|
|
29
|
+
* @param request - The incoming ZuploRequest containing the GraphQL query
|
|
30
|
+
* @param context - The ZuploContext
|
|
31
|
+
* @param options - Configuration for the cache name, TTL, and header varying
|
|
32
|
+
* @param policyName - The name of the policy instance
|
|
33
|
+
* @returns A cached Response on a hit, otherwise the request forwarded to the origin
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```json
|
|
37
|
+
* // policies.json - Cache GraphQL query responses for 60 seconds
|
|
38
|
+
* {
|
|
39
|
+
* "name": "graphql-cache",
|
|
40
|
+
* "policyType": "graphql-cache-inbound",
|
|
41
|
+
* "handler": {
|
|
42
|
+
* "export": "GraphQLCacheInboundPolicy",
|
|
43
|
+
* "module": "$import(@zuplo/graphql)",
|
|
44
|
+
* "options": {
|
|
45
|
+
* "cacheName": "graphql-responses",
|
|
46
|
+
* "ttlSeconds": 60
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```json
|
|
54
|
+
* // Cache per-user by varying the key on the Authorization header
|
|
55
|
+
* {
|
|
56
|
+
* "name": "graphql-cache",
|
|
57
|
+
* "policyType": "graphql-cache-inbound",
|
|
58
|
+
* "handler": {
|
|
59
|
+
* "export": "GraphQLCacheInboundPolicy",
|
|
60
|
+
* "module": "$import(@zuplo/graphql)",
|
|
61
|
+
* "options": {
|
|
62
|
+
* "ttlSeconds": 30,
|
|
63
|
+
* "cacheKeyHeaders": ["authorization"]
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```json
|
|
71
|
+
* // Apply the cache to a GraphQL route
|
|
72
|
+
* {
|
|
73
|
+
* "paths": {
|
|
74
|
+
* "/graphql": {
|
|
75
|
+
* "post": {
|
|
76
|
+
* "x-zuplo-route": {
|
|
77
|
+
* "policies": {
|
|
78
|
+
* "inbound": ["graphql-cache"]
|
|
79
|
+
* },
|
|
80
|
+
* "handler": {
|
|
81
|
+
* "export": "urlForwardHandler",
|
|
82
|
+
* "module": "$import(@zuplo/runtime)",
|
|
83
|
+
* "options": { "baseUrl": "https://api.example.com" }
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare const GraphQLCacheInboundPolicy: InboundPolicyHandler<GraphQLCacheInboundPolicyOptions>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The options for this policy.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
export declare interface GraphQLCacheInboundPolicyOptions {
|
|
99
|
+
/**
|
|
100
|
+
* The name of the cache used to store responses. Routes that share a name share a cache; use distinct names to isolate caches per route or per upstream.
|
|
101
|
+
*/
|
|
102
|
+
cacheName?: string;
|
|
103
|
+
/**
|
|
104
|
+
* How long, in seconds, a cached response is served before it is considered stale and the next request is forwarded to the origin to refresh the entry.
|
|
105
|
+
*/
|
|
106
|
+
ttlSeconds?: number;
|
|
107
|
+
/**
|
|
108
|
+
* Request header names whose values are included in the cache key (matched case-insensitively), and the control for how credentialed requests are cached. Omit this option (the default) and requests carrying an `authorization` or `cookie` header are not cached, to avoid serving one user's response to another. List those headers to cache such requests keyed per value, so each distinct value gets its own entry (a credential header you don't list still blocks caching, so a partial list fails safe). Set it to an empty array `[]` to cache a single response shared across all callers — only do this when the response does not depend on who is calling, as it disables the per-user safety check.
|
|
109
|
+
*/
|
|
110
|
+
cacheKeyHeaders?: string[];
|
|
111
|
+
}
|
|
112
|
+
|
|
4
113
|
/**
|
|
5
114
|
* Policy that limits the complexity and depth of GraphQL queries to prevent abuse.
|
|
6
115
|
* Protects your GraphQL API from expensive queries that could cause performance issues
|