@zuplo/runtime 6.74.10 → 6.74.12

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.
@@ -3162,6 +3162,168 @@ declare interface Category {
3162
3162
  Attribute: Attribute_2[];
3163
3163
  }
3164
3164
 
3165
+ /**
3166
+ * How to combine the configured client policy with a `Cache-Control` the upstream already sent. `strictest` (default) emits the more conservative of the two — the lower `max-age` and the union of restrictive directives. `replace` overwrites whatever upstream sent. `preserve` leaves the upstream header untouched and only adds the CDN headers.
3167
+ * @public
3168
+ */
3169
+ declare type CdnCacheControlClientMode = "strictest" | "replace" | "preserve";
3170
+
3171
+ /**
3172
+ * The `Cache-Control` sent to the browser or app. Separate from `edge` so the CDN can absorb load without clients holding stale data.
3173
+ * @public
3174
+ */
3175
+ declare interface CdnCacheControlClientOptions {
3176
+ /**
3177
+ * Seconds the client may reuse this response. Omit to send no `max-age`.
3178
+ */
3179
+ maxAge?: number;
3180
+ visibility?: CdnCacheControlClientVisibility;
3181
+ /**
3182
+ * Adds `no-cache`, so the client must revalidate before reusing the response. Distinct from `visibility: no-store`, which forbids storing it at all.
3183
+ */
3184
+ noCache?: boolean;
3185
+ /**
3186
+ * Adds `must-revalidate`, so the client may not serve the response once stale.
3187
+ */
3188
+ mustRevalidate?: boolean;
3189
+ mode?: CdnCacheControlClientMode;
3190
+ }
3191
+
3192
+ /**
3193
+ * `public` allows any cache to store the response, `private` restricts it to the client's own cache, `no-store` forbids client caching entirely. With `strategy: targeted` a `private`/`no-store` client policy still permits edge caching, because the CDN reads its own header.
3194
+ * @public
3195
+ */
3196
+ declare type CdnCacheControlClientVisibility =
3197
+ | "public"
3198
+ | "private"
3199
+ | "no-store";
3200
+
3201
+ /**
3202
+ * A cache policy for one response: what the static options normalise into, and
3203
+ * what a `cacheConfig` function returns.
3204
+ *
3205
+ * A function's return value **replaces** this wholesale rather than being merged
3206
+ * field by field. Returning nothing falls back to the static options, which is
3207
+ * how a route enforces defaults and overrides them in only the few cases that
3208
+ * need it.
3209
+ */
3210
+ export declare interface CdnCacheControlConfig {
3211
+ /** Set to false to emit no edge headers or tags for this response. */
3212
+ cache?: boolean;
3213
+ edge?: EdgeCacheDirectives;
3214
+ client?: ClientCacheDirectives;
3215
+ tags?: string[];
3216
+ }
3217
+
3218
+ /**
3219
+ * A `cacheConfig` function: returns the CDN cache policy for one response.
3220
+ *
3221
+ * Return `undefined` or `null` to fall back to the static options, which is how
3222
+ * a route enforces defaults and overrides them only where it needs to.
3223
+ *
3224
+ * @public
3225
+ */
3226
+ export declare type CdnCacheControlConfigFn = (
3227
+ response: Response,
3228
+ request: ZuploRequest,
3229
+ context: ZuploContext
3230
+ ) =>
3231
+ | CdnCacheControlConfig
3232
+ | undefined
3233
+ | null
3234
+ | Promise<CdnCacheControlConfig | undefined | null>;
3235
+
3236
+ /**
3237
+ * A function that overrides the cache configuration per response, for rules that cannot be expressed statically (per-entity purge tags, a TTL that depends on a response header, or skipping an empty result set). Returning nothing (`undefined` or `null`) falls back to the `edge`, `client` and `tags` options, so those stay the enforced default and the function only handles exceptions. A returned config **replaces** those options wholesale rather than being merged directive by directive, so include every directive the response needs. Return `{ cache: false }` to skip caching a response entirely — note that also sends `Cache-Control: no-store` to the client unless `client.mode` is `preserve`. The function receives the live response: it must not consume the body, and should call `response.clone()` if it needs to read it.
3238
+ * @public
3239
+ */
3240
+ declare interface CdnCacheControlConfigFunction {
3241
+ /**
3242
+ * Specifies the export that holds your cache config function, e.g. `default`, `cdnCacheConfig`.
3243
+ */
3244
+ export: string;
3245
+ /**
3246
+ * Specifies the module that holds your cache config function, in the format `$import(./modules/my-module)`.
3247
+ */
3248
+ module: string;
3249
+ }
3250
+
3251
+ /**
3252
+ * How long the CDN may serve this response. These directives are sent only to the CDN, never to the browser (unless `strategy` is `s-maxage`).
3253
+ * @public
3254
+ */
3255
+ declare interface CdnCacheControlEdgeOptions {
3256
+ /**
3257
+ * Seconds the CDN may serve this response without revalidating.
3258
+ */
3259
+ maxAge: number;
3260
+ /**
3261
+ * Seconds the CDN may keep serving a stale response while it revalidates in the background. Not expressible in Akamai's `Edge-Control` — configure it in Property Manager, or use `strategy: s-maxage`.
3262
+ */
3263
+ staleWhileRevalidate?: number;
3264
+ /**
3265
+ * Seconds the CDN may serve a stale response when the gateway returns an error. Not expressible in Akamai's `Edge-Control` — configure it in Property Manager, or use `strategy: s-maxage`.
3266
+ */
3267
+ staleIfError?: number;
3268
+ }
3269
+
3270
+ /**
3271
+ * Sets the response headers that tell a CDN how long it may cache a response and
3272
+ * which purge tags it belongs to, separately from what the browser is told.
3273
+ *
3274
+ * @title CDN Cache Control
3275
+ * @product api-gateway
3276
+ * @public
3277
+ * @param response - The Response
3278
+ * @param request - The ZuploRequest
3279
+ * @param context - The ZuploContext
3280
+ * @param options - The policy options set in policies.json
3281
+ * @param policyName - The name of the policy as set in policies.json
3282
+ * @returns A Response
3283
+ */
3284
+ export declare const CdnCacheControlOutboundPolicy: OutboundPolicyHandler<CdnCacheControlOutboundPolicyOptions>;
3285
+
3286
+ /**
3287
+ * The options for this policy.
3288
+ * @public
3289
+ */
3290
+ export declare interface CdnCacheControlOutboundPolicyOptions {
3291
+ cdn: CdnCacheControlVendor;
3292
+ strategy?: CdnCacheControlStrategy;
3293
+ edge?: CdnCacheControlEdgeOptions;
3294
+ client?: CdnCacheControlClientOptions;
3295
+ /**
3296
+ * Purge tags, rendered in the target CDN's format: comma-joined `Edge-Cache-Tag` (Akamai), space-joined `Surrogate-Key` (Fastly), comma-joined `Cache-Tag` (Cloudflare). CloudFront has no tag purge and rejects this option. Tags are validated against the CDN's length and character limits, because an over-long tag header is silently truncated rather than rejected.
3297
+ */
3298
+ tags?: string[];
3299
+ /**
3300
+ * Request headers that vary this response, unioned with any `Vary` the upstream already sent and emitted as `Vary`. The union is deliberate: replacing an upstream `Vary: Authorization` would stop a shared cache keying on it and let it serve one user's response to another. Off by default: Akamai skips caching any response carrying `Vary` until Cache ID Modification is configured, so enabling this can silently disable edge caching entirely.
3301
+ */
3302
+ vary?: string[];
3303
+ /**
3304
+ * When true (default), an upstream `Cache-Control` of `no-store`/`no-cache`/`private`, or a `Set-Cookie` on the response, suppresses all edge headers and purge tags. This keeps the application's ability to mark a response uncacheable. Set to false to override it — on Akamai this emits `Edge-Control: !no-store`.
3305
+ */
3306
+ respectUpstream?: boolean;
3307
+ cacheConfig?: CdnCacheControlConfigFunction;
3308
+ }
3309
+
3310
+ /**
3311
+ * How the edge TTL is carried. `targeted` uses the CDN's own header (`Edge-Control`, `Surrogate-Control`, `CDN-Cache-Control`) and is the only way to cache at the edge without also caching in the browser. `s-maxage` folds the edge TTL into `Cache-Control` instead, for a property that honors origin `Cache-Control` but not the targeted header. Defaults to `targeted`, except on a CDN that reads no targeted header — CloudFront defaults to `s-maxage`, which is the only thing it supports.
3312
+ * @public
3313
+ */
3314
+ declare type CdnCacheControlStrategy = "targeted" | "s-maxage";
3315
+
3316
+ /**
3317
+ * The CDN in front of this gateway. Required, with no default — each CDN reads a different header for shared-cache TTL and purge tags, and a wrong guess fails silently. Use `generic` for an RFC 9213 CDN that is not listed.
3318
+ * @public
3319
+ */
3320
+ declare type CdnCacheControlVendor =
3321
+ | "akamai"
3322
+ | "fastly"
3323
+ | "cloudflare"
3324
+ | "cloudfront"
3325
+ | "generic";
3326
+
3165
3327
  /**
3166
3328
  * Changes the HTTP method of the incoming request.
3167
3329
  *
@@ -3388,6 +3550,14 @@ export declare interface ClerkJwtInboundPolicyOptions {
3388
3550
  oAuthResourceMetadataEnabled?: boolean;
3389
3551
  }
3390
3552
 
3553
+ /** The client (browser/app) half of the policy. */
3554
+ export declare interface ClientCacheDirectives {
3555
+ maxAge?: number;
3556
+ visibility?: CdnCacheControlClientVisibility;
3557
+ mustRevalidate?: boolean;
3558
+ noCache?: boolean;
3559
+ }
3560
+
3391
3561
  /**
3392
3562
  * Authentication options for OIDC authentication.
3393
3563
  * @public
@@ -4603,6 +4773,13 @@ export declare class DynatraceMetricsPlugin extends MetricsPlugin {
4603
4773
  static setContext(context: ZuploContext, data: DynatraceMetricsContext): void;
4604
4774
  }
4605
4775
 
4776
+ /** The edge (shared cache) half of the policy. */
4777
+ export declare interface EdgeCacheDirectives {
4778
+ maxAge: number;
4779
+ staleWhileRevalidate?: number;
4780
+ staleIfError?: number;
4781
+ }
4782
+
4606
4783
  declare interface EmbeddingsFallbacks {
4607
4784
  fallback?: FallbackModel;
4608
4785
  quotaFallback?: QuotaFallbackModel;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "6.74.10",
4
+ "version": "6.74.12",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {