zuplo 7.2.4 → 7.3.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.
|
@@ -26,7 +26,7 @@ your row before writing anything.
|
|
|
26
26
|
| A different TTL per route, or per response | The [`cacheConfig` function](./dynamic-cache-rules.mdx) |
|
|
27
27
|
| Purge tags for targeted CDN invalidation | The CDN policy's `tags` option |
|
|
28
28
|
| Cache GraphQL query results by query and variables | [`graphql-cache-inbound`](../policies/graphql-cache-inbound.mdx) |
|
|
29
|
-
| Cache LLM completions by prompt similarity | [`
|
|
29
|
+
| Cache LLM completions by prompt similarity | [`semantic-cache-inbound`](../policies/semantic-cache-inbound.mdx) |
|
|
30
30
|
| Store an arbitrary JSON value with a TTL from your own code | [`ZoneCache`](../programmable-api/zone-cache.mdx) |
|
|
31
31
|
|
|
32
32
|
## When custom code is the right answer
|
|
@@ -298,9 +298,9 @@ the traffic they are built for:
|
|
|
298
298
|
- [GraphQL Cache](../policies/graphql-cache-inbound.mdx) normalizes a GraphQL
|
|
299
299
|
document and its variables before hashing, so two semantically identical
|
|
300
300
|
queries share an entry even when their bodies differ.
|
|
301
|
-
- [Semantic Cache](../policies/
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
- [Semantic Cache](../policies/semantic-cache-inbound.mdx) matches requests by
|
|
302
|
+
meaning rather than exact text, which is what makes caching viable in front of
|
|
303
|
+
an LLM.
|
|
304
304
|
|
|
305
305
|
To cache a fragment of a response rather than all of it, or to drive the cache
|
|
306
306
|
from your own code, see
|
|
@@ -83,16 +83,16 @@ three above it in Zuplo.
|
|
|
83
83
|
Find the row that matches the endpoint in front of you. The rows are ordered
|
|
84
84
|
roughly by how much a hit saves.
|
|
85
85
|
|
|
86
|
-
| Situation | Layer | Mechanism
|
|
87
|
-
| ---------------------------------------------------------------------------------------------- | ---------------------- |
|
|
88
|
-
| A public catalog endpoint that returns the same body to everyone | CDN edge | `cdn-cache-control-outbound` with an `edge` and a `client` TTL
|
|
89
|
-
| An authenticated endpoint whose body is identical for every caller | CDN edge | `cdn-cache-control-outbound` with `client.visibility: "private"` so only the CDN stores it
|
|
90
|
-
| A mostly shared response with a small caller-specific slice | Programmable | Cache the shared fragment with the Cache API or `ZoneCache`, fetch only the dynamic part
|
|
91
|
-
| A response whose cacheability depends on what it contains (empty results, error bodies, flags) | CDN edge, per response | A `cacheConfig` function that returns TTLs and purge tags for the response in hand
|
|
92
|
-
| Caching rules no built-in policy expresses (a JWT-claim key, a size limit, an upstream TTL) | Programmable | A custom inbound and outbound policy pair built on the Cache API
|
|
93
|
-
| Identical responses served to many callers, with no CDN in front of the gateway | Gateway | `caching-inbound` with an `expirationSecondsTtl`
|
|
94
|
-
| A GraphQL query repeated across callers, where the cache key is the query and its variables | Gateway | `graphql-cache-inbound`
|
|
95
|
-
| An LLM prompt worded differently each time but asking the same question | Gateway | `
|
|
86
|
+
| Situation | Layer | Mechanism | Where to read |
|
|
87
|
+
| ---------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------- |
|
|
88
|
+
| A public catalog endpoint that returns the same body to everyone | CDN edge | `cdn-cache-control-outbound` with an `edge` and a `client` TTL | [Cache at the CDN](./cdn-caching.mdx) |
|
|
89
|
+
| An authenticated endpoint whose body is identical for every caller | CDN edge | `cdn-cache-control-outbound` with `client.visibility: "private"` so only the CDN stores it | [Cache at the CDN](./cdn-caching.mdx) |
|
|
90
|
+
| A mostly shared response with a small caller-specific slice | Programmable | Cache the shared fragment with the Cache API or `ZoneCache`, fetch only the dynamic part | [Cache part of a response](./partial-response-caching.mdx) |
|
|
91
|
+
| A response whose cacheability depends on what it contains (empty results, error bodies, flags) | CDN edge, per response | A `cacheConfig` function that returns TTLs and purge tags for the response in hand | [Per-response cache rules](./dynamic-cache-rules.mdx) |
|
|
92
|
+
| Caching rules no built-in policy expresses (a JWT-claim key, a size limit, an upstream TTL) | Programmable | A custom inbound and outbound policy pair built on the Cache API | [Build a custom caching policy](./custom-caching-policy.mdx) |
|
|
93
|
+
| Identical responses served to many callers, with no CDN in front of the gateway | Gateway | `caching-inbound` with an `expirationSecondsTtl` | [Cache at the gateway](./gateway-caching.mdx) |
|
|
94
|
+
| A GraphQL query repeated across callers, where the cache key is the query and its variables | Gateway | `graphql-cache-inbound` | [GraphQL Cache policy](../policies/graphql-cache-inbound.mdx) |
|
|
95
|
+
| An LLM prompt worded differently each time but asking the same question | Gateway | `semantic-cache-inbound`, which matches on prompt similarity rather than an exact key | [Semantic Cache policy](../policies/semantic-cache-inbound.mdx) |
|
|
96
96
|
|
|
97
97
|
The intuitive answer is wrong in these cases:
|
|
98
98
|
|
package/docs/policies/_index.md
CHANGED
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
| require-origin-inbound | Require Origin | Sets an allow-list for an origin header | api-gateway |
|
|
93
93
|
| require-user-claims-inbound | Require User Claims | Authorizes requests by validating claims on the authenticated user (`request.user`) against a configurable rule of `and`/`or` combinators and per-claim `eq`, `in`, and `startsWith` checks. Run it after any authentication policy that populates `request.user` — a JWT auth policy, API key auth, mTLS, and so on — to allow only specific callers (service accounts, OAuth clients, tenants, groups) without writing custom code. Every check fails closed: a missing or non-primitive claim never matches, comparisons are strict and type-sensitive, and requests without an authenticated user receive a 401 response. Denied requests receive a 403 response that does not echo claim values or expected values; the failing checks are written to the request log instead. Validation of the options runs lazily inside the policy constructor, which the runtime caches per policy name. Misconfigured options therefore fail on first use with a customer-facing `ConfigurationError` instead of failing at module load. | api-gateway |
|
|
94
94
|
| secret-masking-outbound | Secret Masking (deprecated) | Masks common secrets like Zuplo API keys, GitHub tokens, or SSH private key in the response body. | api-gateway |
|
|
95
|
-
| semantic-cache-inbound | Semantic Cache
|
|
95
|
+
| semantic-cache-inbound | Semantic Cache | Respond to matched incoming requests with semantically cached content The Semantic Cache Inbound policy caches responses based on semantic similarity of cache keys rather than exact matches. This allows for more flexible caching where similar requests can return cached responses even if the cache key is not exactly the same. The policy uses Large Language Model (LLM) embeddings to determine semantic similarity between cache keys based on a configurable similarity tolerance. Options: - semanticTolerance: The semantic similarity threshold for semantic cache matches (0-1, default: 0.2). Values closer to 0 require higher similarity. Can be overridden by custom functions. - expirationSecondsTtl: The timeout of the cache in seconds (default: 3600, 1 hour). Can be overridden by custom functions. - namespace: Optional namespace to isolate cache entries (default: "default"). Useful for multi-tenant scenarios or different cache contexts. - cacheBy: Determines how cache keys are generated: 'function' for custom logic or 'propertyPath' to extract from JSON body. | ai-gateway |
|
|
96
96
|
| set-body-inbound | Set Body | Sets the body of the request in the inbound pipeline - make sure to convert a GET/HEAD request to another method when using this policy. | api-gateway |
|
|
97
97
|
| set-headers-outbound | Set Headers | Adds or sets headers on the on the outgoing response. | api-gateway |
|
|
98
98
|
| set-status-outbound | Set Status Code | Sets the status code on the on the outgoing response. | api-gateway |
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"$id": "https://cdn.zuplo.com/policies/runtime/schemas/semantic-cache-inbound.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"title": "Semantic Cache",
|
|
6
|
-
"isDeprecated":
|
|
6
|
+
"isDeprecated": false,
|
|
7
7
|
"isPaidAddOn": false,
|
|
8
8
|
"isEnterprise": true,
|
|
9
9
|
"isInternal": false,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"policyType": "semantic-cache",
|
|
14
14
|
"products": ["ai-gateway"],
|
|
15
15
|
"description": "Respond to matched incoming requests with semantically cached content\n\nThe Semantic Cache Inbound policy caches responses based on semantic similarity of cache keys rather than exact matches. This allows for more flexible caching where similar requests can return cached responses even if the cache key is not exactly the same.\n\nThe policy uses Large Language Model (LLM) embeddings to determine semantic similarity between cache keys based on a configurable similarity tolerance.\n\nOptions: - semanticTolerance: The semantic similarity threshold for semantic cache matches (0-1, default: 0.2). Values closer to 0 require higher similarity. Can be overridden by custom functions. - expirationSecondsTtl: The timeout of the cache in seconds (default: 3600, 1 hour). Can be overridden by custom functions. - namespace: Optional namespace to isolate cache entries (default: \"default\"). Useful for multi-tenant scenarios or different cache contexts. - cacheBy: Determines how cache keys are generated: 'function' for custom logic or 'propertyPath' to extract from JSON body.",
|
|
16
|
-
"deprecatedMessage": "
|
|
16
|
+
"deprecatedMessage": "",
|
|
17
17
|
"required": ["handler"],
|
|
18
18
|
"properties": {
|
|
19
19
|
"handler": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The programmable API Gateway",
|
|
6
6
|
"author": "Zuplo, Inc.",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"zuplo": "zuplo.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@zuplo/cli": "7.
|
|
23
|
-
"@zuplo/core": "7.
|
|
24
|
-
"@zuplo/runtime": "7.
|
|
25
|
-
"@zuplo/test": "7.
|
|
22
|
+
"@zuplo/cli": "7.3.1",
|
|
23
|
+
"@zuplo/core": "7.3.1",
|
|
24
|
+
"@zuplo/runtime": "7.3.1",
|
|
25
|
+
"@zuplo/test": "7.3.1"
|
|
26
26
|
}
|
|
27
27
|
}
|