@zuplo/runtime 6.52.4 → 6.52.6

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.
@@ -2,6 +2,10 @@ import { KeyLike } from 'jose';
2
2
  import { RequestGeneric as RequestGeneric_2 } from '../../request.js';
3
3
  import type { ValidateFunction as ValidateFunction_2 } from 'ajv';
4
4
 
5
+ /**
6
+ * Entry format for Akamai API Security logger
7
+ * @public
8
+ */
5
9
  export declare interface AkamaiApiSecurityLoggerEntry {
6
10
  ip: {
7
11
  v: string;
@@ -46,12 +50,20 @@ export declare interface AkamaiApiSecurityLoggerEntry {
46
50
  };
47
51
  }
48
52
 
53
+ /**
54
+ * Plugin for integrating with Akamai API Security service for request logging and protection
55
+ * @public
56
+ */
49
57
  export declare class AkamaiApiSecurityPlugin extends SystemRuntimePlugin {
50
58
  #private;
51
59
  constructor(options: AkamaiApiSecurityPluginOptions);
52
60
  initialize(runtime: RuntimeExtensions): Promise<void>;
53
61
  }
54
62
 
63
+ /**
64
+ * Configuration options for the Akamai API Security plugin
65
+ * @public
66
+ */
55
67
  export declare interface AkamaiApiSecurityPluginOptions {
56
68
  /**
57
69
  * The hostname of the Akamai API Security service
@@ -99,6 +111,7 @@ export declare function AmberfloMeteringInboundPolicy(request: ZuploRequest, con
99
111
 
100
112
  /**
101
113
  * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
114
+ * @public
102
115
  */
103
116
  export declare interface AmberfloMeteringInboundPolicyOptions {
104
117
  /**
@@ -145,6 +158,10 @@ declare interface AmberfloMeteringIngestPayload {
145
158
  dimensions: Record<string, string>;
146
159
  }
147
160
 
161
+ /**
162
+ * Helper class for Amberflo metering policy
163
+ * @public
164
+ */
148
165
  export declare class AmberfloMeteringPolicy {
149
166
  static setRequestProperties(context: ZuploContext, properties: AmberfloMeteringProperties): void;
150
167
  }
@@ -173,6 +190,7 @@ export declare const ApiAuthKeyInboundPolicy: typeof ApiKeyInboundPolicy;
173
190
  /**
174
191
  * @deprecated
175
192
  * The options for this policy.
193
+ * @public
176
194
  */
177
195
  export declare interface ApiAuthKeyInboundPolicyOptions {
178
196
  /**
@@ -182,20 +200,76 @@ export declare interface ApiAuthKeyInboundPolicyOptions {
182
200
  }
183
201
 
184
202
  /**
185
- * Authenticates requests based on API Keys using Zuplo API Management.
203
+ * Authenticates requests based on API Keys using Zuplo's built-in API key management.
204
+ * This policy validates API keys against Zuplo's key storage, caches results for performance,
205
+ * and automatically adds user information to authenticated requests.
186
206
  *
187
207
  * @title API Key Authentication
188
208
  * @public
189
- * @param request - The ZuploRequest
209
+ *
210
+ * @param request - The incoming ZuploRequest
190
211
  * @param context - The ZuploContext
191
- * @param unparsedOptions - The policy options set in policies.json
192
- * @param policyName - The name of the policy as set in policies.json
193
- * @returns A Request or a Response
212
+ * @param unparsedOptions - The policy configuration options
213
+ * @param policyName - The name of the policy instance
214
+ * @returns The authenticated request with user info, or a 401 response if unauthorized
215
+ *
216
+ * @example
217
+ * ```json
218
+ * // policies.json - Basic API key authentication
219
+ * {
220
+ * "name": "api-key-auth",
221
+ * "policyType": "api-key-inbound",
222
+ * "handler": {
223
+ * "export": "ApiKeyInboundPolicy",
224
+ * "module": "$import(@zuplo/runtime)",
225
+ * "options": {
226
+ * "bucketName": "$env(API_KEY_BUCKET)",
227
+ * "cacheTtlSeconds": 300
228
+ * }
229
+ * }
230
+ * }
231
+ * ```
232
+ *
233
+ * @example
234
+ * ```json
235
+ * // Custom header and auth scheme
236
+ * {
237
+ * "handler": {
238
+ * "export": "ApiKeyInboundPolicy",
239
+ * "module": "$import(@zuplo/runtime)",
240
+ * "options": {
241
+ * "bucketName": "$env(API_KEY_BUCKET)",
242
+ * "authHeader": "x-api-key",
243
+ * "authScheme": "",
244
+ * "allowUnauthenticatedRequests": false
245
+ * }
246
+ * }
247
+ * }
248
+ * ```
249
+ *
250
+ * @example
251
+ * ```typescript
252
+ * // Access authenticated user data in handler
253
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
254
+ * // User is automatically added by API key policy
255
+ * const user = request.user;
256
+ * context.log.info(`Request from API key: ${user.sub}`);
257
+ *
258
+ * // Access custom metadata stored with the key
259
+ * const metadata = user.data as { plan: string; limit: number };
260
+ *
261
+ * return Response.json({
262
+ * message: `Hello ${user.sub}`,
263
+ * plan: metadata.plan
264
+ * });
265
+ * }
266
+ * ```
194
267
  */
195
268
  export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric_2>>;
196
269
 
197
270
  /**
198
271
  * The options for this policy.
272
+ * @public
199
273
  */
200
274
  export declare interface ApiKeyInboundPolicyOptions {
201
275
  /**
@@ -236,6 +310,7 @@ export declare function apiServices<TResponse, TRequest = unknown>(path: string,
236
310
 
237
311
  /**
238
312
  * Authentication options for api token authentication.
313
+ * @public
239
314
  */
240
315
  declare interface APITokenCredentialConfig {
241
316
  /**
@@ -258,6 +333,7 @@ declare interface APITokenCredentialConfig {
258
333
 
259
334
  /**
260
335
  * A list of attributes that will be included in the authorization request.
336
+ * @public
261
337
  */
262
338
  declare type Attribute = {
263
339
  /**
@@ -272,6 +348,7 @@ declare type Attribute = {
272
348
 
273
349
  /**
274
350
  * A list of attributes that will be included in the authorization request.
351
+ * @public
275
352
  */
276
353
  declare type Attribute1 = {
277
354
  /**
@@ -286,6 +363,7 @@ declare type Attribute1 = {
286
363
 
287
364
  /**
288
365
  * A list of attributes that will be included in the authorization request.
366
+ * @public
289
367
  */
290
368
  declare type Attribute2 = {
291
369
  /**
@@ -306,17 +384,29 @@ declare interface Attribute_2 {
306
384
  IncludeInResult?: boolean;
307
385
  }
308
386
 
387
+ /**
388
+ * Configuration for DataStax audit log provider
389
+ * @public
390
+ */
309
391
  export declare interface AuditLogDataStaxInit {
310
392
  url: string;
311
393
  xCassandraToken: string;
312
394
  }
313
395
 
396
+ /**
397
+ * DataStax audit log output provider
398
+ * @public
399
+ */
314
400
  export declare class AuditLogDataStaxProvider implements AuditLogOutputProvider {
315
401
  #private;
316
402
  constructor(options: AuditLogDataStaxInit);
317
403
  writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
318
404
  }
319
405
 
406
+ /**
407
+ * Represents an audit log entry
408
+ * @public
409
+ */
320
410
  declare interface AuditLogEntry {
321
411
  timestamp: Date;
322
412
  durationMs: number;
@@ -337,6 +427,10 @@ declare interface AuditLogEntry {
337
427
  };
338
428
  }
339
429
 
430
+ /**
431
+ * Configuration options for audit logging
432
+ * @public
433
+ */
340
434
  export declare interface AuditLogInit {
341
435
  requestFilter?: AuditLogRequestFilter;
342
436
  include?: {
@@ -351,16 +445,28 @@ export declare interface AuditLogInit {
351
445
  };
352
446
  }
353
447
 
448
+ /**
449
+ * Interface for audit log output providers
450
+ * @public
451
+ */
354
452
  declare interface AuditLogOutputProvider {
355
453
  writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
356
454
  }
357
455
 
456
+ /**
457
+ * Audit log plugin for tracking API requests and responses
458
+ * @public
459
+ */
358
460
  export declare class AuditLogPlugin extends SystemRuntimePlugin {
359
461
  #private;
360
462
  constructor(outputProvider: AuditLogOutputProvider, init?: AuditLogInit);
361
463
  initialize(runtimeInit: RuntimeExtensions): Promise<void>;
362
464
  }
363
465
 
466
+ /**
467
+ * Filter function to determine if a request should be audited
468
+ * @public
469
+ */
364
470
  declare interface AuditLogRequestFilter {
365
471
  (request: ZuploRequest, context: ZuploContext): Promise<boolean>;
366
472
  }
@@ -380,6 +486,7 @@ export declare const Auth0JwtInboundPolicy: InboundPolicyHandler<Auth0JwtInbound
380
486
 
381
487
  /**
382
488
  * The options for this policy.
489
+ * @public
383
490
  */
384
491
  export declare interface Auth0JwtInboundPolicyOptions {
385
492
  /**
@@ -436,6 +543,7 @@ export declare class AuthZenInboundPolicy extends InboundPolicy<AuthZenInboundPo
436
543
 
437
544
  /**
438
545
  * The options for this policy.
546
+ * @public
439
547
  */
440
548
  export declare interface AuthZenInboundPolicyOptions {
441
549
  /**
@@ -505,6 +613,10 @@ export declare interface AuthZenTypeIdPair {
505
613
  id: string;
506
614
  }
507
615
 
616
+ /**
617
+ * AWS Lambda Event format version 1.0
618
+ * @public
619
+ */
508
620
  declare interface AwsLambdaEventV1 {
509
621
  [key: string]: string | null | undefined | number | boolean | object;
510
622
  version: "1.0";
@@ -563,6 +675,10 @@ declare interface AwsLambdaEventV1 {
563
675
  stageVariables: null | Record<string, string>;
564
676
  }
565
677
 
678
+ /**
679
+ * AWS Lambda Event format version 2.0
680
+ * @public
681
+ */
566
682
  declare interface AwsLambdaEventV2 {
567
683
  [key: string]: string | null | undefined | number | boolean | object;
568
684
  version: "2.0";
@@ -613,14 +729,61 @@ declare interface AwsLambdaEventV2 {
613
729
  }
614
730
 
615
731
  /**
616
- * Proxy requests to a different url
617
- * @param request - The ZuploRequest
732
+ * Handler that proxies requests to AWS Lambda functions.
733
+ * Supports both Lambda proxy integration formats (v1.0 and v2.0).
734
+ *
735
+ * @param request - The incoming ZuploRequest
618
736
  * @param context - The ZuploContext
619
- * @returns
620
- * @beta
737
+ * @returns A Response from the Lambda function
738
+ *
739
+ * @public
740
+ * @example
741
+ * ```json
742
+ * // routes.oas.json
743
+ * {
744
+ * "paths": {
745
+ * "/api/lambda-function": {
746
+ * "x-zuplo-route": {
747
+ * "handler": {
748
+ * "export": "awsLambdaHandler",
749
+ * "module": "$import(@zuplo/runtime)",
750
+ * "options": {
751
+ * "accessKeyId": "$env(AWS_ACCESS_KEY_ID)",
752
+ * "secretAccessKey": "$env(AWS_SECRET_ACCESS_KEY)",
753
+ * "region": "us-east-1",
754
+ * "functionName": "my-lambda-function",
755
+ * "useLambdaProxyIntegration": true,
756
+ * "payloadFormatVersion": "2.0",
757
+ * "binaryMediaTypes": ["image/*", "application/pdf"]
758
+ * }
759
+ * }
760
+ * }
761
+ * }
762
+ * }
763
+ * }
764
+ * ```
621
765
  */
622
766
  export declare function awsLambdaHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
623
767
 
768
+ /**
769
+ * Extensions for customizing AWS Lambda handler behavior.
770
+ * @public
771
+ * @example
772
+ * ```typescript
773
+ * import { AwsLambdaHandlerExtensions } from "@zuplo/runtime";
774
+ *
775
+ * // In zuplo.runtime.ts
776
+ * export function runtimeInit(runtime: RuntimeExtensions) {
777
+ * AwsLambdaHandlerExtensions.addSendingAwsLambdaEventHook(
778
+ * async (request, context, event) => {
779
+ * // Add custom headers or modify the event
780
+ * event.headers["X-Custom-Header"] = "value";
781
+ * return event;
782
+ * }
783
+ * );
784
+ * }
785
+ * ```
786
+ */
624
787
  export declare const AwsLambdaHandlerExtensions: {
625
788
  addSendingAwsLambdaEventHook: (hook: OnSendingAwsLambdaEventHook) => void;
626
789
  };
@@ -637,6 +800,10 @@ declare interface AWSLoggingOptions {
637
800
  fields?: CustomLogFields;
638
801
  }
639
802
 
803
+ /**
804
+ * AWS CloudWatch logging plugin
805
+ * @public
806
+ */
640
807
  export declare class AWSLoggingPlugin extends LogPlugin {
641
808
  private options;
642
809
  constructor(options: AWSLoggingOptions);
@@ -681,6 +848,7 @@ export declare class AxiomaticsAuthZInboundPolicy extends InboundPolicy<Axiomati
681
848
 
682
849
  /**
683
850
  * The options for this policy.
851
+ * @public
684
852
  */
685
853
  export declare interface AxiomaticsAuthZInboundPolicyOptions {
686
854
  /**
@@ -720,16 +888,28 @@ export declare interface AxiomaticsAuthZInboundPolicyOptions {
720
888
  actionAttributes?: Attribute2;
721
889
  }
722
890
 
891
+ /**
892
+ * Function to generate blob names
893
+ * @public
894
+ */
723
895
  export declare interface AzureBlobGenerateName<T> {
724
896
  (entries: T[]): string;
725
897
  }
726
898
 
899
+ /**
900
+ * Azure Blob Storage request logger plugin
901
+ * @public
902
+ */
727
903
  export declare class AzureBlobPlugin<T extends BasicDictionary> extends SystemRuntimePlugin {
728
904
  #private;
729
905
  constructor(options: AzureBlobPluginOptions<T>);
730
906
  initialize(runtime: RuntimeExtensions): Promise<void>;
731
907
  }
732
908
 
909
+ /**
910
+ * Options for Azure Blob request logger plugin
911
+ * @public
912
+ */
733
913
  export declare interface AzureBlobPluginOptions<T> {
734
914
  sasUrl: string;
735
915
  batchPeriodSeconds: number;
@@ -737,6 +917,10 @@ export declare interface AzureBlobPluginOptions<T> {
737
917
  generateBlobName?: AzureBlobGenerateName<T>;
738
918
  }
739
919
 
920
+ /**
921
+ * Azure Event Hubs request logger plugin
922
+ * @public
923
+ */
740
924
  export declare class AzureEventHubsRequestLoggerPlugin<T extends BasicDictionary> extends SystemRuntimePlugin {
741
925
  #private;
742
926
  constructor(options: AzureEventHubsRequestLoggerPluginOptions<T>);
@@ -747,6 +931,10 @@ export declare class AzureEventHubsRequestLoggerPlugin<T extends BasicDictionary
747
931
  initialize(runtime: RuntimeExtensions): Promise<void>;
748
932
  }
749
933
 
934
+ /**
935
+ * Options for Azure Event Hubs request logger plugin
936
+ * @public
937
+ */
750
938
  export declare interface AzureEventHubsRequestLoggerPluginOptions<T> {
751
939
  /** Full connection string from Azure Portal (with Endpoint=..., etc.) */
752
940
  connectionString: string;
@@ -760,12 +948,66 @@ export declare interface AzureEventHubsRequestLoggerPluginOptions<T> {
760
948
  batchPeriodSeconds: number;
761
949
  }
762
950
 
951
+ /**
952
+ * Utility for batching and dispatching events in the background.
953
+ * Useful for aggregating logs, metrics, or other data before sending to external services.
954
+ * The dispatcher automatically batches items and sends them after a configurable delay.
955
+ *
956
+ * @public
957
+ * @example
958
+ * ```typescript
959
+ * import { BackgroundDispatcher, ZuploContext } from "@zuplo/runtime";
960
+ *
961
+ * // Define your payload type
962
+ * interface LogEntry {
963
+ * timestamp: string;
964
+ * level: string;
965
+ * message: string;
966
+ * metadata?: Record<string, any>;
967
+ * }
968
+ *
969
+ * // Create a dispatcher function
970
+ * const sendLogs = async (logs: LogEntry[]) => {
971
+ * await fetch("https://logging.example.com/bulk", {
972
+ * method: "POST",
973
+ * headers: { "Content-Type": "application/json" },
974
+ * body: JSON.stringify({ logs })
975
+ * });
976
+ * };
977
+ *
978
+ * // Initialize the dispatcher
979
+ * const logDispatcher = new BackgroundDispatcher(sendLogs, {
980
+ * msDelay: 1000, // Batch logs every 1 second
981
+ * name: "log-dispatcher"
982
+ * });
983
+ *
984
+ * // Use in your handler
985
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
986
+ * // Queue logs for batched sending
987
+ * logDispatcher.enqueue({
988
+ * timestamp: new Date().toISOString(),
989
+ * level: "info",
990
+ * message: "Request processed",
991
+ * metadata: {
992
+ * userId: request.user?.sub,
993
+ * path: request.url
994
+ * }
995
+ * });
996
+ *
997
+ * return new Response("OK");
998
+ * }
999
+ * ```
1000
+ */
763
1001
  export declare class BackgroundDispatcher<TPayload> {
764
1002
  #private;
765
1003
  constructor(dispatcher: DispatchFunction<TPayload>, options: BatchDispatcherOptions);
766
1004
  enqueue: (payload: TPayload) => void;
767
1005
  }
768
1006
 
1007
+ /**
1008
+ * A utility for loading and caching data in the background with automatic refresh
1009
+ * @public
1010
+ */
769
1011
  export declare class BackgroundLoader<T = unknown> {
770
1012
  #private;
771
1013
  constructor(loader: BackgroundLoaderFunction<T>, options: BackgroundLoaderOptions);
@@ -776,10 +1018,18 @@ export declare class BackgroundLoader<T = unknown> {
776
1018
  get(key: string): Promise<T>;
777
1019
  }
778
1020
 
1021
+ /**
1022
+ * Function to load data in the background
1023
+ * @public
1024
+ */
779
1025
  export declare interface BackgroundLoaderFunction<T> {
780
1026
  (key: string): Promise<T>;
781
1027
  }
782
1028
 
1029
+ /**
1030
+ * Options for background loader
1031
+ * @public
1032
+ */
783
1033
  declare interface BackgroundLoaderOptions {
784
1034
  ttlSeconds: number;
785
1035
  loaderTimeoutSeconds?: number;
@@ -811,6 +1061,7 @@ declare class BaseOpenFGAAuthZInboundPolicy extends InboundPolicy<OpenFGAAuthZIn
811
1061
 
812
1062
  /**
813
1063
  * An account object.
1064
+ * @public
814
1065
  */
815
1066
  declare interface BasicAuthAccount {
816
1067
  /**
@@ -844,6 +1095,7 @@ export declare const BasicAuthInboundPolicy: InboundPolicyHandler<BasicAuthInbou
844
1095
 
845
1096
  /**
846
1097
  * The options for this policy.
1098
+ * @public
847
1099
  */
848
1100
  export declare interface BasicAuthInboundPolicyOptions {
849
1101
  /**
@@ -856,11 +1108,19 @@ export declare interface BasicAuthInboundPolicyOptions {
856
1108
  allowUnauthenticatedRequests?: boolean;
857
1109
  }
858
1110
 
1111
+ /**
1112
+ * Basic dictionary type for log entries
1113
+ * @public
1114
+ */
859
1115
  declare interface BasicDictionary extends Record<string, string | number | boolean | null | undefined> {
860
1116
  }
861
1117
 
862
1118
  /* Excluded from this release type: BatchDispatch */
863
1119
 
1120
+ /**
1121
+ * Options for configuring a BackgroundDispatcher.
1122
+ * @public
1123
+ */
864
1124
  declare interface BatchDispatcherOptions {
865
1125
  msDelay: number;
866
1126
  name?: string;
@@ -885,6 +1145,7 @@ export declare class BrownoutInboundPolicy extends InboundPolicy<BrownoutInbound
885
1145
 
886
1146
  /**
887
1147
  * The options for this policy.
1148
+ * @public
888
1149
  */
889
1150
  export declare interface BrownoutInboundPolicyOptions {
890
1151
  /**
@@ -917,6 +1178,9 @@ export declare interface BrownoutInboundPolicyOptions {
917
1178
 
918
1179
  /* Excluded from this release type: BuildEnvironment */
919
1180
 
1181
+ /**
1182
+ * @public
1183
+ */
920
1184
  declare interface BuildRouteConfiguration {
921
1185
  path: string;
922
1186
  methods: HttpMethod[];
@@ -980,6 +1244,7 @@ export declare function CachingInboundPolicy(request: ZuploRequest, context: Zup
980
1244
 
981
1245
  /**
982
1246
  * The options for this policy.
1247
+ * @public
983
1248
  */
984
1249
  export declare interface CachingInboundPolicyOptions {
985
1250
  /**
@@ -1030,6 +1295,7 @@ export declare const ChangeMethodInboundPolicy: InboundPolicyHandler<ChangeMetho
1030
1295
 
1031
1296
  /**
1032
1297
  * The options for this policy.
1298
+ * @public
1033
1299
  */
1034
1300
  export declare interface ChangeMethodInboundPolicyOptions {
1035
1301
  /**
@@ -1053,6 +1319,7 @@ export declare const ClearHeadersInboundPolicy: InboundPolicyHandler<ClearHeader
1053
1319
 
1054
1320
  /**
1055
1321
  * The options for this policy.
1322
+ * @public
1056
1323
  */
1057
1324
  export declare interface ClearHeadersInboundPolicyOptions {
1058
1325
  /**
@@ -1076,6 +1343,7 @@ export declare const ClearHeadersOutboundPolicy: OutboundPolicyHandler<ClearHead
1076
1343
 
1077
1344
  /**
1078
1345
  * The options for this policy.
1346
+ * @public
1079
1347
  */
1080
1348
  export declare interface ClearHeadersOutboundPolicyOptions {
1081
1349
  /**
@@ -1099,6 +1367,7 @@ export declare const ClerkJwtInboundPolicy: InboundPolicyHandler<ClerkJwtInbound
1099
1367
 
1100
1368
  /**
1101
1369
  * The options for this policy.
1370
+ * @public
1102
1371
  */
1103
1372
  export declare interface ClerkJwtInboundPolicyOptions {
1104
1373
  /**
@@ -1113,6 +1382,7 @@ export declare interface ClerkJwtInboundPolicyOptions {
1113
1382
 
1114
1383
  /**
1115
1384
  * Authentication options for OIDC authentication.
1385
+ * @public
1116
1386
  */
1117
1387
  declare interface ClientCredentialsConfig {
1118
1388
  /**
@@ -1152,6 +1422,7 @@ export declare const CognitoJwtInboundPolicy: InboundPolicyHandler<CognitoJwtInb
1152
1422
 
1153
1423
  /**
1154
1424
  * The options for this policy.
1425
+ * @public
1155
1426
  */
1156
1427
  export declare interface CognitoJwtInboundPolicyOptions {
1157
1428
  /**
@@ -1227,6 +1498,10 @@ export declare interface ComplexCustomRateLimitDetails extends CustomRateLimitDe
1227
1498
  limits?: Record<string, number>;
1228
1499
  }
1229
1500
 
1501
+ /**
1502
+ * Function type for complex rate limiting
1503
+ * @public
1504
+ */
1230
1505
  export declare type ComplexRateLimitFunction = RateLimitFunction<ComplexCustomRateLimitDetails>;
1231
1506
 
1232
1507
  /**
@@ -1256,6 +1531,7 @@ export declare class ComplexRateLimitInboundPolicy extends InboundPolicy<Complex
1256
1531
 
1257
1532
  /**
1258
1533
  * The options for this policy.
1534
+ * @public
1259
1535
  */
1260
1536
  export declare interface ComplexRateLimitInboundPolicyOptions {
1261
1537
  rateLimitBy: RateLimitByType;
@@ -1305,6 +1581,7 @@ export declare const CompositeInboundPolicy: InboundPolicyHandler<CompositeInbou
1305
1581
 
1306
1582
  /**
1307
1583
  * The options for this policy.
1584
+ * @public
1308
1585
  */
1309
1586
  export declare interface CompositeInboundPolicyOptions {
1310
1587
  /**
@@ -1328,6 +1605,7 @@ export declare const CompositeOutboundPolicy: OutboundPolicyHandler<CompositeOut
1328
1605
 
1329
1606
  /**
1330
1607
  * The options for this policy.
1608
+ * @public
1331
1609
  */
1332
1610
  export declare interface CompositeOutboundPolicyOptions {
1333
1611
  /**
@@ -1337,10 +1615,31 @@ export declare interface CompositeOutboundPolicyOptions {
1337
1615
  }
1338
1616
 
1339
1617
  /**
1340
- * Errors caused by invalid user configuration -i.e. invalid parameters on policies,
1341
- * handlers that are not functions, etc. This is not for zuplo system configuration errors,
1342
- * use SystemError for that.
1618
+ * Errors caused by invalid user configuration such as invalid parameters on policies,
1619
+ * handlers that are not functions, or missing required configuration values.
1620
+ *
1343
1621
  * @public
1622
+ * @example
1623
+ * ```typescript
1624
+ * import { ConfigurationError } from "@zuplo/runtime";
1625
+ *
1626
+ * // In a policy
1627
+ * export const myPolicy: InboundPolicy = async (request, context, options) => {
1628
+ * if (!options.apiKey) {
1629
+ * throw new ConfigurationError(
1630
+ * "API key is required in policy configuration"
1631
+ * );
1632
+ * }
1633
+ *
1634
+ * if (typeof options.timeout !== "number" || options.timeout < 0) {
1635
+ * throw new ConfigurationError(
1636
+ * "Timeout must be a positive number"
1637
+ * );
1638
+ * }
1639
+ *
1640
+ * // Policy logic...
1641
+ * };
1642
+ * ```
1344
1643
  */
1345
1644
  export declare class ConfigurationError extends RuntimeError {
1346
1645
  constructor(message: string, options?: ErrorOptions);
@@ -1356,11 +1655,15 @@ export declare class ConfigurationError extends RuntimeError {
1356
1655
  *
1357
1656
  * @example
1358
1657
  * Using static methods
1359
- * ```
1658
+ * ```typescript
1659
+ * import { ContextData, ZuploContext } from "@zuplo/runtime";
1660
+ *
1661
+ * // In a policy or handler
1360
1662
  * ContextData.set(context, "my-data", { prop1: "hello world" });
1361
1663
  *
1664
+ * // Later in the pipeline
1362
1665
  * const data = ContextData.get(context, "my-data");
1363
- * ContextData.set(context, data);
1666
+ * console.log(data?.prop1); // "hello world"
1364
1667
  * ```
1365
1668
  *
1366
1669
  * @example
@@ -1369,36 +1672,98 @@ export declare class ConfigurationError extends RuntimeError {
1369
1672
  * The shared module allows other modules to access the same storage without
1370
1673
  * passing the string name or type around.
1371
1674
  *
1372
- * ```
1373
- * export const myData =
1374
- * new ContextData<{ prop1: string }>("my-data");
1675
+ * ```typescript
1676
+ * // shared-data.ts
1677
+ * import { ContextData } from "@zuplo/runtime";
1678
+ *
1679
+ * interface UserData {
1680
+ * userId: string;
1681
+ * roles: string[];
1682
+ * }
1683
+ *
1684
+ * export const userData = new ContextData<UserData>("user-data");
1375
1685
  * ```
1376
1686
  *
1377
1687
  * Then use the class in another module.
1378
1688
  *
1379
- * ```
1380
- * import { myData } from "./my-module.js";
1689
+ * ```typescript
1690
+ * // policy.ts
1691
+ * import { userData } from "./shared-data.js";
1692
+ * import { InboundPolicy, ZuploContext, ZuploRequest } from "@zuplo/runtime";
1693
+ *
1694
+ * export const authenticateUser: InboundPolicy = async (
1695
+ * request: ZuploRequest,
1696
+ * context: ZuploContext
1697
+ * ) => {
1698
+ * // Store user data after authentication
1699
+ * userData.set(context, {
1700
+ * userId: "user-123",
1701
+ * roles: ["admin", "user"]
1702
+ * });
1381
1703
  *
1704
+ * return request;
1705
+ * };
1382
1706
  *
1383
- * const data = myData.get(context)
1384
- * myData.set(context, data);
1707
+ * // handler.ts
1708
+ * import { userData } from "./shared-data.js";
1385
1709
  *
1710
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
1711
+ * const user = userData.get(context);
1712
+ * if (user?.roles.includes("admin")) {
1713
+ * // Handle admin access
1714
+ * }
1715
+ * }
1386
1716
  * ```
1387
1717
  */
1388
1718
  export declare class ContextData<T = any> {
1389
1719
  #private;
1720
+ /**
1721
+ * Creates a new ContextData instance for type-safe context storage.
1722
+ * @param name - A unique string or symbol identifier for this data
1723
+ */
1390
1724
  constructor(name: string | symbol);
1725
+ /**
1726
+ * Stores data in the context under this instance's name.
1727
+ * @param context - The ZuploContext to store data in
1728
+ * @param data - The data to store
1729
+ */
1391
1730
  set(context: ZuploContext, data: T): void;
1731
+ /**
1732
+ * Retrieves data from the context stored under this instance's name.
1733
+ * @param context - The ZuploContext to retrieve data from
1734
+ * @returns The stored data or undefined if not found
1735
+ */
1392
1736
  get(context: ZuploContext): T | undefined;
1737
+ /**
1738
+ * Stores data in the context under the specified name.
1739
+ * @param context - The ZuploContext to store data in
1740
+ * @param name - The unique identifier for this data
1741
+ * @param data - The data to store
1742
+ */
1393
1743
  static set<T = any>(context: ZuploContext, name: string | symbol, data: T): void;
1744
+ /**
1745
+ * Retrieves data from the context stored under the specified name.
1746
+ * @param context - The ZuploContext to retrieve data from
1747
+ * @param name - The unique identifier for the data
1748
+ * @returns The stored data or undefined if not found
1749
+ */
1394
1750
  static get<T = any>(context: ZuploContext, name: string | symbol): T | undefined;
1395
1751
  }
1396
1752
 
1397
- /** The 2-letter continent codes Cloudflare uses */
1753
+ /**
1754
+ * The 2-letter continent codes Cloudflare uses
1755
+ * @public
1756
+ */
1398
1757
  declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
1399
1758
 
1759
+ /**
1760
+ * @public
1761
+ */
1400
1762
  export declare type CorsPolicy = string | "anything-goes" | "none";
1401
1763
 
1764
+ /**
1765
+ * @public
1766
+ */
1402
1767
  export declare interface CorsPolicyConfiguration {
1403
1768
  name: string;
1404
1769
  allowCredentials?: boolean;
@@ -1487,6 +1852,7 @@ declare interface CronDefinition {
1487
1852
 
1488
1853
  /**
1489
1854
  * @deprecated Use standard `crypto` API instead.
1855
+ * @public
1490
1856
  */
1491
1857
  export declare class CryptoBeta extends BaseCryptoBeta {
1492
1858
  digest(algorithm: string, data: string): Promise<string>;
@@ -1507,6 +1873,7 @@ export declare const CurityPhantomTokenInboundPolicy: InboundPolicyHandler<Curit
1507
1873
 
1508
1874
  /**
1509
1875
  * The options for this policy.
1876
+ * @public
1510
1877
  */
1511
1878
  export declare interface CurityPhantomTokenInboundPolicyOptions {
1512
1879
  /**
@@ -1530,6 +1897,7 @@ export declare interface CurityPhantomTokenInboundPolicyOptions {
1530
1897
  declare type CustomLogFields = Record<string, number | string | boolean>;
1531
1898
 
1532
1899
  /**
1900
+ * Custom rate limit details that can override policy options.
1533
1901
  * @public
1534
1902
  */
1535
1903
  export declare interface CustomRateLimitDetails extends CustomRateLimitDetailsBase {
@@ -1541,6 +1909,10 @@ declare interface CustomRateLimitDetailsBase {
1541
1909
  timeWindowMinutes?: number;
1542
1910
  }
1543
1911
 
1912
+ /**
1913
+ * Function type for custom rate limiting
1914
+ * @public
1915
+ */
1544
1916
  export declare type CustomRateLimitFunction = RateLimitFunction<CustomRateLimitDetails>;
1545
1917
 
1546
1918
  declare interface DataDogLoggingOptions {
@@ -1560,6 +1932,10 @@ declare interface DataDogLoggingOptions {
1560
1932
  tags?: Record<string, unknown>;
1561
1933
  }
1562
1934
 
1935
+ /**
1936
+ * DataDog logging plugin
1937
+ * @public
1938
+ */
1563
1939
  export declare class DataDogLoggingPlugin extends LogPlugin {
1564
1940
  private options;
1565
1941
  constructor(options: DataDogLoggingOptions);
@@ -1578,6 +1954,10 @@ declare interface DataDogMetricsOptions {
1578
1954
  include?: IncludeMetrics;
1579
1955
  }
1580
1956
 
1957
+ /**
1958
+ * DataDog metrics plugin
1959
+ * @public
1960
+ */
1581
1961
  export declare class DataDogMetricsPlugin extends MetricsPlugin {
1582
1962
  private options;
1583
1963
  constructor(options: DataDogMetricsOptions);
@@ -1585,6 +1965,10 @@ export declare class DataDogMetricsPlugin extends MetricsPlugin {
1585
1965
  static setContext(context: ZuploContext, data: DataDogMetricsContext): void;
1586
1966
  }
1587
1967
 
1968
+ /**
1969
+ * Default function to generate Hydrolix log entries
1970
+ * @public
1971
+ */
1588
1972
  export declare const defaultGenerateHydrolixEntry: GenerateRequestLoggerEntry<HydrolixDefaultEntry>;
1589
1973
 
1590
1974
  /* Excluded from this release type: DevPortalRuntimeConfig */
@@ -1594,6 +1978,10 @@ export declare const defaultGenerateHydrolixEntry: GenerateRequestLoggerEntry<Hy
1594
1978
  */
1595
1979
  export declare type DispatchFunction<TPayload> = (batch: TPayload[]) => Promise<void>;
1596
1980
 
1981
+ /**
1982
+ * Function to dispatch request logger entries
1983
+ * @public
1984
+ */
1597
1985
  export declare interface DispatchRequestLoggerEntries<T> {
1598
1986
  (entries: T[]): Promise<void>;
1599
1987
  }
@@ -1607,6 +1995,10 @@ declare interface DynaTraceLoggingOptions {
1607
1995
  fields?: CustomLogFields;
1608
1996
  }
1609
1997
 
1998
+ /**
1999
+ * Dynatrace logging plugin
2000
+ * @public
2001
+ */
1610
2002
  export declare class DynaTraceLoggingPlugin extends LogPlugin {
1611
2003
  private options;
1612
2004
  constructor(options: DynaTraceLoggingOptions);
@@ -1625,6 +2017,10 @@ declare interface DynatraceMetricsOptions {
1625
2017
  include?: IncludeMetrics;
1626
2018
  }
1627
2019
 
2020
+ /**
2021
+ * Dynatrace metrics plugin
2022
+ * @public
2023
+ */
1628
2024
  export declare class DynatraceMetricsPlugin extends MetricsPlugin {
1629
2025
  private options;
1630
2026
  constructor(options: DynatraceMetricsOptions);
@@ -1668,6 +2064,7 @@ export declare const FirebaseJwtInboundPolicy: InboundPolicyHandler<FirebaseJwtI
1668
2064
 
1669
2065
  /**
1670
2066
  * The options for this policy.
2067
+ * @public
1671
2068
  */
1672
2069
  export declare interface FirebaseJwtInboundPolicyOptions {
1673
2070
  /**
@@ -1695,6 +2092,7 @@ export declare const FormDataToJsonInboundPolicy: InboundPolicyHandler<FormDataT
1695
2092
 
1696
2093
  /**
1697
2094
  * The options for this policy.
2095
+ * @public
1698
2096
  */
1699
2097
  export declare interface FormDataToJsonInboundPolicyOptions {
1700
2098
  /**
@@ -1709,6 +2107,10 @@ export declare interface FormDataToJsonInboundPolicyOptions {
1709
2107
 
1710
2108
  /* Excluded from this release type: Gateway */
1711
2109
 
2110
+ /**
2111
+ * Function to generate request logger entries
2112
+ * @public
2113
+ */
1712
2114
  export declare interface GenerateRequestLoggerEntry<T> {
1713
2115
  (response: Response, request: ZuploRequest, context: ZuploContext, metadata: RequestLoggerMetaData): Promise<T>;
1714
2116
  }
@@ -1728,6 +2130,7 @@ export declare const GeoFilterInboundPolicy: InboundPolicyHandler<GeoFilterInbou
1728
2130
 
1729
2131
  /**
1730
2132
  * The options for this policy.
2133
+ * @public
1731
2134
  */
1732
2135
  export declare interface GeoFilterInboundPolicyOptions {
1733
2136
  block?: GeoSpec;
@@ -1753,11 +2156,11 @@ declare interface GeoSpec {
1753
2156
  asns?: string;
1754
2157
  }
1755
2158
 
1756
- export declare function getIdForParameterSchema(path: string, operation: string, type: string, name: string): string;
2159
+ /* Excluded from this release type: getIdForParameterSchema */
1757
2160
 
1758
- export declare function getIdForRefSchema(oasFileName: string, ref: string): string;
2161
+ /* Excluded from this release type: getIdForRefSchema */
1759
2162
 
1760
- export declare function getIdForRequestBodySchema(path: string, operation: string, contentType: string): string;
2163
+ /* Excluded from this release type: getIdForRequestBodySchema */
1761
2164
 
1762
2165
  /**
1763
2166
  * The function to get the anchor date for the quota.
@@ -1777,7 +2180,7 @@ declare interface GetQuotaResult {
1777
2180
  meters: Record<string, number>;
1778
2181
  }
1779
2182
 
1780
- export declare function getRawOperationDataIdentifierName(oasFileName: string, path: string, operation: string): string;
2183
+ /* Excluded from this release type: getRawOperationDataIdentifierName */
1781
2184
 
1782
2185
  declare interface GoogleCloudLoggingOptions {
1783
2186
  serviceAccountJson: string;
@@ -1788,14 +2191,59 @@ declare interface GoogleCloudLoggingOptions {
1788
2191
  fields?: CustomLogFields;
1789
2192
  }
1790
2193
 
2194
+ /**
2195
+ * Google Cloud logging plugin
2196
+ * @public
2197
+ */
1791
2198
  export declare class GoogleCloudLoggingPlugin extends LogPlugin {
1792
2199
  private options;
1793
2200
  constructor(options: GoogleCloudLoggingOptions);
1794
2201
  /* Excluded from this release type: getTransport */
1795
2202
  }
1796
2203
 
1797
- /* Excluded from this release type: Handler */
2204
+ /**
2205
+ * The main request handler for the Zuplo runtime. This class initializes the gateway
2206
+ * and handles all incoming HTTP requests through the configured pipeline.
2207
+ *
2208
+ * @public
2209
+ * @example
2210
+ * ```typescript
2211
+ * import { Handler } from "@zuplo/runtime";
2212
+ *
2213
+ * // This is typically used internally by Zuplo runtime,
2214
+ * // but can be useful for testing or custom deployments
2215
+ * const handler = new Handler(
2216
+ * routeLoader,
2217
+ * buildEnvironment,
2218
+ * runtimeSettings,
2219
+ * serviceProvider,
2220
+ * schemaValidations,
2221
+ * runtimeInit
2222
+ * );
2223
+ *
2224
+ * // Handle a request
2225
+ * const response = await handler.requestHandler(
2226
+ * request,
2227
+ * runtimeEnvironment,
2228
+ * event
2229
+ * );
2230
+ * ```
2231
+ */
2232
+ export declare class Handler {
2233
+ routeLoader: () => Promise<RouteData>;
2234
+ buildEnvironment: BuildEnvironment;
2235
+ runtimeSettings: RuntimeSettings;
2236
+ private serviceProvider;
2237
+ private schemaValidations;
2238
+ private runtimeInit;
2239
+ constructor(routeLoader: () => Promise<RouteData>, buildEnvironment: BuildEnvironment, runtimeSettings: RuntimeSettings, serviceProvider: ServiceProvider, schemaValidations: any, runtimeInit: RuntimeExtensionsFunction | undefined);
2240
+ requestHandler: (request: Request, runtimeEnvironment: RuntimeEnvironment, event: ZuploEventContext) => Promise<Response>;
2241
+ handleError(err: Error, detail: string, request: Request): Response;
2242
+ }
1798
2243
 
2244
+ /**
2245
+ * @public
2246
+ */
1799
2247
  export declare interface HandlerDefinition {
1800
2248
  module: any;
1801
2249
  export: string;
@@ -1808,6 +2256,7 @@ declare interface HandleRequestOptions {
1808
2256
 
1809
2257
  /**
1810
2258
  * Request header authentication.
2259
+ * @public
1811
2260
  */
1812
2261
  declare interface HeaderCredentialsConfig {
1813
2262
  /**
@@ -1820,12 +2269,85 @@ declare interface HeaderCredentialsConfig {
1820
2269
  headerName: string;
1821
2270
  }
1822
2271
 
2272
+ /**
2273
+ * @public
2274
+ */
1823
2275
  export declare type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
1824
2276
 
1825
2277
  declare type HttpMethod_2 = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
1826
2278
 
1827
2279
  /**
1828
- * @beta
2280
+ * Utility class for generating standardized HTTP problem responses following RFC 7807.
2281
+ * Provides static methods for all standard HTTP status codes with automatic request tracking,
2282
+ * trace information, and consistent error formatting.
2283
+ *
2284
+ * @public
2285
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7807|RFC 7807 - Problem Details for HTTP APIs}
2286
+ *
2287
+ * @example
2288
+ * ```typescript
2289
+ * import { HttpProblems, ZuploContext, ZuploRequest } from "@zuplo/runtime";
2290
+ *
2291
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
2292
+ * // Simple 404 response
2293
+ * if (!resource) {
2294
+ * return HttpProblems.notFound(request, context);
2295
+ * }
2296
+ *
2297
+ * // 400 with custom detail
2298
+ * if (!request.headers.get("x-api-key")) {
2299
+ * return HttpProblems.badRequest(request, context, {
2300
+ * detail: "Missing required header: x-api-key"
2301
+ * });
2302
+ * }
2303
+ *
2304
+ * // 401 with additional headers
2305
+ * if (!authenticated) {
2306
+ * return HttpProblems.unauthorized(request, context, {
2307
+ * detail: "Invalid credentials"
2308
+ * }, {
2309
+ * "WWW-Authenticate": "Bearer realm=\"api\""
2310
+ * });
2311
+ * }
2312
+ *
2313
+ * // 429 with retry information
2314
+ * if (rateLimited) {
2315
+ * return HttpProblems.tooManyRequests(request, context, {
2316
+ * detail: "Rate limit exceeded",
2317
+ * extensions: {
2318
+ * limit: 100,
2319
+ * remaining: 0,
2320
+ * reset: new Date(Date.now() + 60000).toISOString()
2321
+ * }
2322
+ * }, {
2323
+ * "Retry-After": "60"
2324
+ * });
2325
+ * }
2326
+ * }
2327
+ * ```
2328
+ *
2329
+ * @example
2330
+ * ```typescript
2331
+ * // Custom problem formatter
2332
+ * import { HttpProblems, ProblemResponseDetails } from "@zuplo/runtime";
2333
+ *
2334
+ * // Format a custom problem
2335
+ * const problem: ProblemResponseDetails = {
2336
+ * problem: {
2337
+ * type: "https://example.com/probs/out-of-credit",
2338
+ * title: "Out of credit",
2339
+ * status: 402,
2340
+ * detail: "Your current balance is 30, but that costs 50.",
2341
+ * instance: "/account/12345/msgs/abc",
2342
+ * extensions: {
2343
+ * balance: 30,
2344
+ * accounts: ["/account/12345", "/account/67890"]
2345
+ * }
2346
+ * }
2347
+ * };
2348
+ *
2349
+ * return HttpProblems.format(problem.problem, request, context);
2350
+ * ```
1829
2351
  */
1830
2352
  export declare class HttpProblems extends HttpProblemsBase {
1831
2353
  #private;
@@ -2885,6 +3407,10 @@ declare type HttpStatusCodeRangeDefinition = "1XX" | "2XX" | "3XX" | "4XX" | "5X
2885
3407
 
2886
3408
  /* Excluded from this release type: httpStatuses */
2887
3409
 
3410
+ /**
3411
+ * Default entry structure for Hydrolix logs
3412
+ * @public
3413
+ */
2888
3414
  export declare interface HydrolixDefaultEntry extends BasicDictionary {
2889
3415
  deploymentName: string;
2890
3416
  timestamp: string;
@@ -2914,12 +3440,20 @@ export declare interface HydrolixDefaultEntry extends BasicDictionary {
2914
3440
  zuploUserAgent?: string;
2915
3441
  }
2916
3442
 
3443
+ /**
3444
+ * Hydrolix request logger plugin
3445
+ * @public
3446
+ */
2917
3447
  export declare class HydrolixRequestLoggerPlugin<T extends BasicDictionary> extends SystemRuntimePlugin {
2918
3448
  #private;
2919
3449
  constructor(options: HydrolixRequestLoggerPluginOptions<T>);
2920
3450
  initialize(runtime: RuntimeExtensions): Promise<void>;
2921
3451
  }
2922
3452
 
3453
+ /**
3454
+ * Options for Hydrolix request logger plugin
3455
+ * @public
3456
+ */
2923
3457
  export declare interface HydrolixRequestLoggerPluginOptions<T> {
2924
3458
  hostname: string;
2925
3459
  username: string;
@@ -2932,35 +3466,100 @@ export declare interface HydrolixRequestLoggerPluginOptions<T> {
2932
3466
  }
2933
3467
 
2934
3468
  /**
2935
- * @beta
2936
3469
  * A policy that can modify the incoming HTTP request before it is sent to
2937
3470
  * the handler. If a response is returned, the request is short-circuited and
2938
3471
  * the response is returned to the client. If a Request is returned, policies
2939
3472
  * or a handler that follow are executed.
2940
- */
2941
- export declare abstract class InboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
2942
- /**
2943
- * The handler that is called each time this policy is invoked
2944
- *
2945
- * @param request - The incoming Request
2946
- * @param context - The current context of the Request
2947
- * @returns A Response or Request object
3473
+ *
3474
+ * @public
3475
+ * @example
3476
+ * ```typescript
3477
+ * import { InboundPolicy, ZuploContext, ZuploRequest } from "@zuplo/runtime";
3478
+ *
3479
+ * interface MyPolicyOptions {
3480
+ * headerName: string;
3481
+ * headerValue: string;
3482
+ * }
3483
+ *
3484
+ * export class AddHeaderPolicy extends InboundPolicy<MyPolicyOptions> {
3485
+ * async handler(request: ZuploRequest, context: ZuploContext) {
3486
+ * // Add a custom header
3487
+ * request.headers.set(this.options.headerName, this.options.headerValue);
3488
+ *
3489
+ * // Log the action
3490
+ * context.log.info(`Added header ${this.options.headerName}`);
3491
+ *
3492
+ * // Continue to next policy/handler
3493
+ * return request;
3494
+ * }
3495
+ * }
3496
+ *
3497
+ * // Usage in policies.json:
3498
+ * // {
3499
+ * // "name": "add-custom-header",
3500
+ * // "policyType": "custom-add-header-policy",
3501
+ * // "handler": {
3502
+ * // "export": "AddHeaderPolicy",
3503
+ * // "module": "$import(./policies/add-header)",
3504
+ * // "options": {
3505
+ * // "headerName": "X-Custom-Header",
3506
+ * // "headerValue": "My Value"
3507
+ * // }
3508
+ * // }
3509
+ * // }
3510
+ * ```
3511
+ */
3512
+ export declare abstract class InboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
3513
+ /**
3514
+ * The handler that is called each time this policy is invoked
3515
+ *
3516
+ * @param request - The incoming Request
3517
+ * @param context - The current context of the Request
3518
+ * @returns A Response or Request object
2948
3519
  */
2949
3520
  abstract handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
2950
3521
  }
2951
3522
 
2952
3523
  /**
2953
- * @public
2954
- * A policy that can modify the incoming HTTP request before it is sent to
2955
- * the handler. If a response is returned, the request is short-circuited and
2956
- * the response is returned to the client. If a Request is returned, policies
2957
- * or a handler that follow are executed.
3524
+ * A function-based inbound policy that can modify the incoming HTTP request.
3525
+ * This is the simplest way to create custom policies without extending a class.
2958
3526
  *
2959
3527
  * @param request - The incoming Request
2960
3528
  * @param context - The current context of the Request
2961
3529
  * @param options - The configuration options for the policy
2962
3530
  * @param policyName - The name set on the policy in the configuration
2963
- * @returns A Response or Request object
3531
+ * @returns A Response to short-circuit or a Request to continue
3532
+ *
3533
+ * @public
3534
+ * @example
3535
+ * ```typescript
3536
+ * import { InboundPolicyHandler } from "@zuplo/runtime";
3537
+ *
3538
+ * interface RateLimitOptions {
3539
+ * requests: number;
3540
+ * windowMs: number;
3541
+ * }
3542
+ *
3543
+ * export const rateLimitPolicy: InboundPolicyHandler<RateLimitOptions> = async (
3544
+ * request,
3545
+ * context,
3546
+ * options,
3547
+ * policyName
3548
+ * ) => {
3549
+ * const key = request.headers.get("x-api-key") || "anonymous";
3550
+ * const count = await incrementCounter(key, options.windowMs);
3551
+ *
3552
+ * if (count > options.requests) {
3553
+ * return new Response("Too Many Requests", { status: 429 });
3554
+ * }
3555
+ *
3556
+ * // Add rate limit headers
3557
+ * request.headers.set("X-RateLimit-Limit", options.requests.toString());
3558
+ * request.headers.set("X-RateLimit-Remaining", (options.requests - count).toString());
3559
+ *
3560
+ * return request;
3561
+ * };
3562
+ * ```
2964
3563
  */
2965
3564
  export declare interface InboundPolicyHandler<TOptions = any> {
2966
3565
  (request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<ZuploRequest | Response>;
@@ -2973,6 +3572,9 @@ declare interface IncludeMetrics {
2973
3572
  path?: boolean;
2974
3573
  }
2975
3574
 
3575
+ /**
3576
+ * @public
3577
+ */
2976
3578
  declare interface IncomingRequestProperties {
2977
3579
  /**
2978
3580
  * ASN of the incoming request, for example, 395747.
@@ -3040,7 +3642,10 @@ declare interface IncomingRequestProperties {
3040
3642
  readonly httpProtocol: string | undefined;
3041
3643
  }
3042
3644
 
3043
- /** ISO 3166-1 Alpha-2 codes */
3645
+ /**
3646
+ * ISO 3166-1 Alpha-2 codes
3647
+ * @public
3648
+ */
3044
3649
  declare type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
3045
3650
 
3046
3651
  /**
@@ -3058,6 +3663,7 @@ export declare const JWTScopeValidationInboundPolicy: InboundPolicyHandler<JWTSc
3058
3663
 
3059
3664
  /**
3060
3665
  * The options for this policy.
3666
+ * @public
3061
3667
  */
3062
3668
  export declare interface JWTScopeValidationInboundPolicyOptions {
3063
3669
  /**
@@ -3146,6 +3752,7 @@ declare type LogSourceType = "runtime" | "request";
3146
3752
 
3147
3753
  /**
3148
3754
  * A logging plugin that sends logs to a Loki server.
3755
+ * @public
3149
3756
  */
3150
3757
  export declare class LokiLoggingPlugin extends LogPlugin {
3151
3758
  private options;
@@ -3202,10 +3809,57 @@ declare type LokiTransportVersion = 1 | 2;
3202
3809
  */
3203
3810
  export declare function mcpServerHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
3204
3811
 
3812
+ /**
3813
+ * A two-tier cache that combines in-memory caching with zone-level caching.
3814
+ * Data is first checked in memory cache for fastest access, then falls back to
3815
+ * zone cache if not found. Writes update both cache tiers.
3816
+ *
3817
+ * @public
3818
+ * @example
3819
+ * ```typescript
3820
+ * import { MemoryZoneReadThroughCache, ZuploContext } from "@zuplo/runtime";
3821
+ *
3822
+ * export async function myHandler(request: ZuploRequest, context: ZuploContext) {
3823
+ * const cache = new MemoryZoneReadThroughCache<UserData>("user-cache", context);
3824
+ *
3825
+ * // Try to get cached data
3826
+ * const cachedUser = await cache.get("user-123");
3827
+ * if (cachedUser) {
3828
+ * return Response.json(cachedUser);
3829
+ * }
3830
+ *
3831
+ * // Fetch fresh data
3832
+ * const user = await fetchUserFromDatabase("user-123");
3833
+ *
3834
+ * // Cache for 5 minutes (300 seconds)
3835
+ * cache.put("user-123", user, 300);
3836
+ *
3837
+ * return Response.json(user);
3838
+ * }
3839
+ * ```
3840
+ */
3205
3841
  export declare class MemoryZoneReadThroughCache<T = unknown> {
3206
3842
  #private;
3843
+ /**
3844
+ * Creates a new MemoryZoneReadThroughCache instance.
3845
+ * @param name - A unique name for this cache instance
3846
+ * @param context - The ZuploContext from the current request
3847
+ */
3207
3848
  constructor(name: string, context: ZuploContext);
3849
+ /**
3850
+ * Retrieves a value from the cache by key. First checks memory cache,
3851
+ * then falls back to zone cache if not found in memory.
3852
+ * @param key - The cache key to retrieve
3853
+ * @returns The cached value or undefined if not found or expired
3854
+ */
3208
3855
  get(key: string): Promise<T | undefined>;
3856
+ /**
3857
+ * Stores a value in both memory and zone cache with the specified TTL.
3858
+ * The write to zone cache is performed asynchronously in the background.
3859
+ * @param key - The cache key
3860
+ * @param data - The value to cache
3861
+ * @param ttlSeconds - Time to live in seconds
3862
+ */
3209
3863
  put(key: string, data: T, ttlSeconds: number): void;
3210
3864
  /* Excluded from this release type: delete */
3211
3865
  }
@@ -3302,6 +3956,7 @@ declare interface MetricsType {
3302
3956
 
3303
3957
  /**
3304
3958
  * The options for this policy.
3959
+ * @public
3305
3960
  */
3306
3961
  export declare interface MockApiInboundOptions {
3307
3962
  /**
@@ -3361,6 +4016,7 @@ export declare function MoesifInboundPolicy(request: ZuploRequest, context: Zupl
3361
4016
 
3362
4017
  /**
3363
4018
  * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
4019
+ * @public
3364
4020
  */
3365
4021
  export declare interface MoesifInboundPolicyOptions {
3366
4022
  /**
@@ -3397,6 +4053,7 @@ export declare class MonetizationInboundPolicy extends InboundPolicy<Monetizatio
3397
4053
 
3398
4054
  /**
3399
4055
  * The options for this policy.
4056
+ * @public
3400
4057
  */
3401
4058
  export declare interface MonetizationInboundPolicyOptions {
3402
4059
  /**
@@ -3468,6 +4125,10 @@ declare interface NewRelicLoggingOptions {
3468
4125
  service?: string;
3469
4126
  }
3470
4127
 
4128
+ /**
4129
+ * New Relic logging plugin
4130
+ * @public
4131
+ */
3471
4132
  export declare class NewRelicLoggingPlugin extends LogPlugin {
3472
4133
  private options;
3473
4134
  constructor(options: NewRelicLoggingOptions);
@@ -3486,6 +4147,10 @@ declare interface NewRelicMetricsOptions {
3486
4147
  include?: IncludeMetrics;
3487
4148
  }
3488
4149
 
4150
+ /**
4151
+ * New Relic metrics plugin
4152
+ * @public
4153
+ */
3489
4154
  export declare class NewRelicMetricsPlugin extends MetricsPlugin {
3490
4155
  private options;
3491
4156
  constructor(options: NewRelicMetricsOptions);
@@ -3514,6 +4179,7 @@ export declare class OktaFGAAuthZInboundPolicy extends BaseOpenFGAAuthZInboundPo
3514
4179
 
3515
4180
  /**
3516
4181
  * The options for this policy.
4182
+ * @public
3517
4183
  */
3518
4184
  export declare interface OktaFGAAuthZInboundPolicyOptions {
3519
4185
  /**
@@ -3560,6 +4226,7 @@ export declare const OktaJwtInboundPolicy: InboundPolicyHandler<OktaJwtInboundPo
3560
4226
 
3561
4227
  /**
3562
4228
  * The options for this policy.
4229
+ * @public
3563
4230
  */
3564
4231
  export declare interface OktaJwtInboundPolicyOptions {
3565
4232
  /**
@@ -3597,15 +4264,61 @@ declare interface OnResponseSendingHook {
3597
4264
  (response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
3598
4265
  }
3599
4266
 
4267
+ /**
4268
+ * Hook function called before sending an AWS Lambda event.
4269
+ * Allows modification of the event before it's sent to Lambda.
4270
+ * @public
4271
+ */
3600
4272
  declare interface OnSendingAwsLambdaEventHook {
3601
4273
  (request: ZuploRequest, context: ZuploContext, event: AwsLambdaEventV1 | AwsLambdaEventV2): Promise<AwsLambdaEventV1 | AwsLambdaEventV2>;
3602
4274
  }
3603
4275
 
3604
4276
  /**
3605
- * @beta
3606
- * @param request - The ZuploRequest
4277
+ * Handler that serves OpenAPI specification files.
4278
+ * Use this to expose your API documentation in a standard format that can be
4279
+ * consumed by tools like Swagger UI, Postman, or API documentation generators.
4280
+ *
4281
+ * @param request - The incoming ZuploRequest
3607
4282
  * @param context - The ZuploContext
3608
- * @returns ZuploResponse
4283
+ * @returns A Response containing the OpenAPI specification
4284
+ *
4285
+ * @public
4286
+ * @example
4287
+ * ```json
4288
+ * // routes.oas.json - Serve OpenAPI spec at /openapi
4289
+ * {
4290
+ * "paths": {
4291
+ * "/openapi": {
4292
+ * "get": {
4293
+ * "summary": "Get OpenAPI specification",
4294
+ * "x-zuplo-route": {
4295
+ * "handler": {
4296
+ * "export": "openApiSpecHandler",
4297
+ * "module": "$import(@zuplo/runtime)",
4298
+ * "options": {
4299
+ * "openApiFilePath": "./config/api-spec.oas.json"
4300
+ * }
4301
+ * }
4302
+ * }
4303
+ * }
4304
+ * }
4305
+ * }
4306
+ * }
4307
+ * ```
4308
+ *
4309
+ * @example
4310
+ * ```json
4311
+ * // Serve different specs based on environment
4312
+ * {
4313
+ * "handler": {
4314
+ * "export": "openApiSpecHandler",
4315
+ * "module": "$import(@zuplo/runtime)",
4316
+ * "options": {
4317
+ * "openApiFilePath": "./config/${env.API_VERSION}.oas.json"
4318
+ * }
4319
+ * }
4320
+ * }
4321
+ * ```
3609
4322
  */
3610
4323
  export declare function openApiSpecHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
3611
4324
 
@@ -4088,6 +4801,7 @@ export declare class OpenFGAAuthZInboundPolicy extends BaseOpenFGAAuthZInboundPo
4088
4801
 
4089
4802
  /**
4090
4803
  * The options for this policy.
4804
+ * @public
4091
4805
  */
4092
4806
  export declare interface OpenFGAAuthZInboundPolicyOptions {
4093
4807
  /**
@@ -4149,6 +4863,7 @@ declare interface OpenIdJwtInboundPolicyInternalOptions extends Omit<OpenIdJwtIn
4149
4863
 
4150
4864
  /**
4151
4865
  * The options for this policy.
4866
+ * @public
4152
4867
  */
4153
4868
  export declare interface OpenIdJwtInboundPolicyOptions {
4154
4869
  /**
@@ -4188,9 +4903,36 @@ export declare interface OpenIdJwtInboundPolicyOptions {
4188
4903
  }
4189
4904
 
4190
4905
  /**
4191
- * @beta
4192
4906
  * A policy that can modify the outgoing HTTP response before it is returned
4193
- * to the client.
4907
+ * to the client. Outbound policies run after the handler has generated a response.
4908
+ *
4909
+ * @public
4910
+ * @example
4911
+ * ```typescript
4912
+ * import { OutboundPolicy, ZuploContext, ZuploRequest } from "@zuplo/runtime";
4913
+ *
4914
+ * interface ResponseHeadersOptions {
4915
+ * headers: Record<string, string>;
4916
+ * }
4917
+ *
4918
+ * export class AddResponseHeadersPolicy extends OutboundPolicy<ResponseHeadersOptions> {
4919
+ * async handler(
4920
+ * response: Response,
4921
+ * request: ZuploRequest,
4922
+ * context: ZuploContext
4923
+ * ) {
4924
+ * // Clone the response to make headers mutable
4925
+ * const newResponse = new Response(response.body, response);
4926
+ *
4927
+ * // Add configured headers
4928
+ * for (const [name, value] of Object.entries(this.options.headers)) {
4929
+ * newResponse.headers.set(name, value);
4930
+ * }
4931
+ *
4932
+ * return newResponse;
4933
+ * }
4934
+ * }
4935
+ * ```
4194
4936
  */
4195
4937
  export declare abstract class OutboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
4196
4938
  /**
@@ -4204,30 +4946,70 @@ export declare abstract class OutboundPolicy<TOptions = any> extends PolicyBase<
4204
4946
  }
4205
4947
 
4206
4948
  /**
4207
- * @public
4208
- * A policy that can modify the outgoing HTTP response before it is returned
4209
- * to the client.
4949
+ * A function-based outbound policy that can modify the outgoing HTTP response.
4950
+ * This is the simplest way to create custom outbound policies without extending a class.
4210
4951
  *
4211
- * @param response - The outgoing Response
4212
- * @param request - The incoming Request
4952
+ * @param response - The outgoing Response from the handler
4953
+ * @param request - The original incoming Request
4213
4954
  * @param context - The current context of the Request
4214
4955
  * @param options - The configuration options for the policy
4215
4956
  * @param policyName - The name set on the policy in the configuration
4216
- * @returns A Response object
4957
+ * @returns A modified Response object
4958
+ *
4959
+ * @public
4960
+ * @example
4961
+ * ```typescript
4962
+ * import { OutboundPolicyHandler } from "@zuplo/runtime";
4963
+ *
4964
+ * interface CacheControlOptions {
4965
+ * maxAge: number;
4966
+ * sMaxAge?: number;
4967
+ * public?: boolean;
4968
+ * }
4969
+ *
4970
+ * export const cacheControlPolicy: OutboundPolicyHandler<CacheControlOptions> = async (
4971
+ * response,
4972
+ * request,
4973
+ * context,
4974
+ * options
4975
+ * ) => {
4976
+ * // Only cache successful responses
4977
+ * if (response.status !== 200) {
4978
+ * return response;
4979
+ * }
4980
+ *
4981
+ * // Build cache control header
4982
+ * const directives = [`max-age=${options.maxAge}`];
4983
+ * if (options.sMaxAge !== undefined) {
4984
+ * directives.push(`s-maxage=${options.sMaxAge}`);
4985
+ * }
4986
+ * if (options.public) {
4987
+ * directives.push("public");
4988
+ * }
4989
+ *
4990
+ * // Clone and modify response
4991
+ * const newResponse = new Response(response.body, response);
4992
+ * newResponse.headers.set("Cache-Control", directives.join(", "));
4993
+ *
4994
+ * return newResponse;
4995
+ * };
4996
+ * ```
4217
4997
  */
4218
4998
  export declare interface OutboundPolicyHandler<TOptions = any> {
4219
4999
  (response: Response, request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<Response>;
4220
5000
  }
4221
5001
 
4222
5002
  /**
4223
- * @beta
5003
+ * Base object for parameter definitions
5004
+ * @public
4224
5005
  */
4225
5006
  export declare type ParameterBaseObject = Modify<Omit<OpenAPIV3_1.ParameterBaseObject, "content" | "allowEmptyValue" | "style" | "allowReserved" | "explode" | "example" | "examples">, {
4226
5007
  schema: OpenAPIV3_1.SchemaObject;
4227
5008
  }>;
4228
5009
 
4229
5010
  /**
4230
- * @beta
5011
+ * Definition of a parameter
5012
+ * @public
4231
5013
  */
4232
5014
  export declare interface ParameterDefinition extends ParameterBaseObject {
4233
5015
  name: string;
@@ -4249,13 +5031,18 @@ declare interface ParsedCorsPolicyConfiguration {
4249
5031
  exposeHeaders?: string;
4250
5032
  }
4251
5033
 
5034
+ /**
5035
+ * @public
5036
+ */
4252
5037
  declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
4253
5038
  corsPolicies: ParsedCorsPolicyConfiguration[];
4254
5039
  }
4255
5040
 
4256
5041
  /**
5042
+ * The base class for inbound and outbound policies.
5043
+ * Provides common functionality for all policy types.
5044
+ *
4257
5045
  * @public
4258
- * The base class for inbound and outbound policies
4259
5046
  */
4260
5047
  declare abstract class PolicyBase<TOptions = any> {
4261
5048
  options: TOptions;
@@ -4264,6 +5051,9 @@ declare abstract class PolicyBase<TOptions = any> {
4264
5051
  /* Excluded from this release type: __constructor */
4265
5052
  }
4266
5053
 
5054
+ /**
5055
+ * @public
5056
+ */
4267
5057
  export declare interface PolicyConfiguration {
4268
5058
  name: string;
4269
5059
  policyType: string;
@@ -4283,7 +5073,7 @@ declare type Primitive = null | undefined | string | number | boolean | symbol |
4283
5073
  /**
4284
5074
  * Problem Details for HTTP APIs
4285
5075
  * @see {@link https://www.rfc-editor.org/rfc/rfc7807 |RFC7807}
4286
- * @beta
5076
+ * @public
4287
5077
  */
4288
5078
  declare interface ProblemDetails {
4289
5079
  /**
@@ -4357,7 +5147,7 @@ declare interface ProblemDetails {
4357
5147
  }
4358
5148
 
4359
5149
  /**
4360
- * @beta
5150
+ * @public
4361
5151
  */
4362
5152
  export declare interface ProblemResponseDetails {
4363
5153
  problem: ProblemDetails;
@@ -4373,14 +5163,14 @@ export declare interface ProblemResponseDetails {
4373
5163
  }
4374
5164
 
4375
5165
  /**
4376
- * @beta
5166
+ * @public
4377
5167
  */
4378
5168
  export declare interface ProblemResponseFormat {
4379
5169
  (problemDetails: ProblemResponseDetails, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
4380
5170
  }
4381
5171
 
4382
5172
  /**
4383
- * @beta
5173
+ * @public
4384
5174
  */
4385
5175
  export declare class ProblemResponseFormatter {
4386
5176
  static format(problemDetails: ProblemResponseDetails, request: ZuploRequest, context: ZuploContext): Promise<Response>;
@@ -4404,6 +5194,7 @@ export declare const PromptInjectionDetectionOutboundPolicy: OutboundPolicyHandl
4404
5194
 
4405
5195
  /**
4406
5196
  * The options for Prompt Injection Detection Outbound policy.
5197
+ * @public
4407
5198
  */
4408
5199
  export declare interface PromptInjectionDetectionOutboundPolicyOptions {
4409
5200
  /**
@@ -4435,6 +5226,7 @@ export declare const PropelAuthJwtInboundPolicy: InboundPolicyHandler<PropelAuth
4435
5226
 
4436
5227
  /**
4437
5228
  * The options for this policy.
5229
+ * @public
4438
5230
  */
4439
5231
  export declare interface PropelAuthJwtInboundPolicyOptions {
4440
5232
  /**
@@ -4466,6 +5258,7 @@ export declare const QueryParamToHeaderInboundPolicy: InboundPolicyHandler<Query
4466
5258
 
4467
5259
  /**
4468
5260
  * The options for the query parameter to header inbound policy.
5261
+ * @public
4469
5262
  */
4470
5263
  export declare interface QueryParamToHeaderInboundPolicyOptions {
4471
5264
  /**
@@ -4514,6 +5307,7 @@ export declare class QuotaInboundPolicy extends InboundPolicy<QuotaInboundPolicy
4514
5307
 
4515
5308
  /**
4516
5309
  * The options for this policy.
5310
+ * @public
4517
5311
  */
4518
5312
  export declare interface QuotaInboundPolicyOptions {
4519
5313
  /**
@@ -4559,11 +5353,13 @@ export declare interface QuotaInboundPolicyOptions {
4559
5353
 
4560
5354
  /**
4561
5355
  * The identifying element of the request that enforces distinct rate limits. For example, you can limit by `user`, `ip`, `function` or `all` - function allows you to specify a simple function to create a string identifier to create a rate-limit group.
5356
+ * @public
4562
5357
  */
4563
5358
  declare type RateLimitByType = "user" | "ip" | "function" | "all";
4564
5359
 
4565
5360
  /**
4566
5361
  * The identifying element of the request that enforces distinct rate limits. For example, you can limit by `user`, `ip`, `function` or `all` - function allows you to specify a simple function to create a string identifier to create a rate-limit group.
5362
+ * @public
4567
5363
  */
4568
5364
  declare type RateLimitByType_2 = "user" | "ip" | "function" | "all";
4569
5365
 
@@ -4571,25 +5367,101 @@ declare type RateLimitFunction<T extends CustomRateLimitDetailsBase> = (request:
4571
5367
 
4572
5368
  /**
4573
5369
  * Adds the retry-after header.
5370
+ * @public
4574
5371
  */
4575
5372
  declare type RateLimitHeaderMode = "none" | "retry-after";
4576
5373
 
4577
5374
  /**
4578
5375
  * Adds the retry-after header.
5376
+ * @public
4579
5377
  */
4580
5378
  declare type RateLimitHeaderMode_2 = "none" | "retry-after";
4581
5379
 
4582
5380
  /**
4583
- * The rate-limiting policy is used to limit the number of requests that
4584
- * can be made against your API based on a key.
5381
+ * Rate limiting policy to control the number of requests to your API.
5382
+ * Supports multiple identification strategies (by user, IP, header, etc.) and
5383
+ * can operate in strict or async mode for different performance characteristics.
4585
5384
  *
4586
5385
  * @title Rate Limiting
4587
5386
  * @public
4588
- * @param request - The ZuploRequest
5387
+ *
5388
+ * @param request - The incoming ZuploRequest
4589
5389
  * @param context - The ZuploContext
4590
- * @param options - The policy options set in policies.json
4591
- * @param policyName - The name of the policy as set in policies.json
4592
- * @returns A Request or a Response
5390
+ * @param options - The rate limiting configuration
5391
+ * @param policyName - The name of the policy instance
5392
+ * @returns The request if allowed, or a 429 Too Many Requests response
5393
+ *
5394
+ * @example
5395
+ * ```json
5396
+ * // policies.json - Rate limit by authenticated user
5397
+ * {
5398
+ * "name": "rate-limit-by-user",
5399
+ * "policyType": "rate-limit-inbound",
5400
+ * "handler": {
5401
+ * "export": "RateLimitInboundPolicy",
5402
+ * "module": "$import(@zuplo/runtime)",
5403
+ * "options": {
5404
+ * "rateLimitBy": "user",
5405
+ * "requestsAllowed": 100,
5406
+ * "timeWindowMinutes": 1
5407
+ * }
5408
+ * }
5409
+ * }
5410
+ * ```
5411
+ *
5412
+ * @example
5413
+ * ```json
5414
+ * // Rate limit by custom header
5415
+ * {
5416
+ * "handler": {
5417
+ * "export": "RateLimitInboundPolicy",
5418
+ * "module": "$import(@zuplo/runtime)",
5419
+ * "options": {
5420
+ * "rateLimitBy": "header",
5421
+ * "headerName": "x-customer-id",
5422
+ * "requestsAllowed": 1000,
5423
+ * "timeWindowMinutes": 60,
5424
+ * "mode": "strict"
5425
+ * }
5426
+ * }
5427
+ * }
5428
+ * ```
5429
+ *
5430
+ * @example
5431
+ * ```typescript
5432
+ * // Custom rate limit function
5433
+ * import { CustomRateLimitFunction } from "@zuplo/runtime";
5434
+ *
5435
+ * export const customRateLimit: CustomRateLimitFunction = async (
5436
+ * request,
5437
+ * context
5438
+ * ) => {
5439
+ * // Different limits for different plan tiers
5440
+ * const user = request.user;
5441
+ * const plan = (user?.data as any)?.plan || "free";
5442
+ *
5443
+ * switch (plan) {
5444
+ * case "enterprise":
5445
+ * return {
5446
+ * key: user.sub,
5447
+ * requestsAllowed: 10000,
5448
+ * timeWindowMinutes: 60
5449
+ * };
5450
+ * case "pro":
5451
+ * return {
5452
+ * key: user.sub,
5453
+ * requestsAllowed: 1000,
5454
+ * timeWindowMinutes: 60
5455
+ * };
5456
+ * default:
5457
+ * return {
5458
+ * key: user?.sub || request.headers.get("cf-connecting-ip") || "anonymous",
5459
+ * requestsAllowed: 100,
5460
+ * timeWindowMinutes: 60
5461
+ * };
5462
+ * }
5463
+ * };
5464
+ * ```
4593
5465
  */
4594
5466
  declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
4595
5467
  export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy }
@@ -4597,6 +5469,7 @@ export { RateLimitInboundPolicy }
4597
5469
 
4598
5470
  /**
4599
5471
  * The options for this policy.
5472
+ * @public
4600
5473
  */
4601
5474
  declare interface RateLimitInboundPolicyOptions {
4602
5475
  rateLimitBy: RateLimitByType_2;
@@ -4633,16 +5506,19 @@ export { RateLimitInboundPolicyOptions }
4633
5506
 
4634
5507
  /**
4635
5508
  * The mode of the policy. If set to `async`, the policy will check if the request is over the rate limit without blocking. This can result in some requests allowed over the rate limit.
5509
+ * @public
4636
5510
  */
4637
5511
  declare type RateLimitMode = "strict" | "async";
4638
5512
 
4639
5513
  /**
4640
5514
  * The mode of the policy. If set to `async`, the policy will check if the request is over the rate limit without blocking. This can result in some requests allowed over the rate limit.
5515
+ * @public
4641
5516
  */
4642
5517
  declare type RateLimitMode_2 = "strict" | "async";
4643
5518
 
4644
5519
  /**
4645
5520
  * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
5521
+ * @public
4646
5522
  */
4647
5523
  declare interface ReadmeMeteringInboundPolicyOptions {
4648
5524
  /**
@@ -4686,10 +5562,48 @@ declare interface ReadmeMeteringInboundPolicyOptions {
4686
5562
  export declare function ReadmeMetricsInboundPolicy(request: ZuploRequest, context: ZuploContext, options: ReadmeMeteringInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric_2>>;
4687
5563
 
4688
5564
  /**
4689
- * @beta
4690
- * @param request - The ZuploRequest
5565
+ * Handler that returns HTTP redirects.
5566
+ * Useful for URL shortening, legacy URL handling, or routing to external services.
5567
+ *
5568
+ * @param request - The incoming ZuploRequest
4691
5569
  * @param context - The ZuploContext
4692
- * @returns ZuploResponse
5570
+ * @returns A redirect Response with the specified status code
5571
+ *
5572
+ * @public
5573
+ * @example
5574
+ * ```json
5575
+ * // routes.oas.json
5576
+ * {
5577
+ * "paths": {
5578
+ * "/old-api": {
5579
+ * "x-zuplo-route": {
5580
+ * "handler": {
5581
+ * "export": "redirectHandler",
5582
+ * "module": "$import(@zuplo/runtime)",
5583
+ * "options": {
5584
+ * "location": "https://api.example.com/v2",
5585
+ * "status": 301
5586
+ * }
5587
+ * }
5588
+ * }
5589
+ * }
5590
+ * }
5591
+ * }
5592
+ * ```
5593
+ *
5594
+ * @example
5595
+ * ```json
5596
+ * // Temporary redirect (302 is default)
5597
+ * {
5598
+ * "handler": {
5599
+ * "export": "redirectHandler",
5600
+ * "module": "$import(@zuplo/runtime)",
5601
+ * "options": {
5602
+ * "location": "https://maintenance.example.com"
5603
+ * }
5604
+ * }
5605
+ * }
5606
+ * ```
4693
5607
  */
4694
5608
  export declare function redirectHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4695
5609
 
@@ -4728,6 +5642,7 @@ export declare const RemoveHeadersInboundPolicy: InboundPolicyHandler<RemoveHead
4728
5642
 
4729
5643
  /**
4730
5644
  * The options for this policy.
5645
+ * @public
4731
5646
  */
4732
5647
  export declare interface RemoveHeadersInboundPolicyOptions {
4733
5648
  /**
@@ -4751,6 +5666,7 @@ export declare const RemoveHeadersOutboundPolicy: OutboundPolicyHandler<RemoveHe
4751
5666
 
4752
5667
  /**
4753
5668
  * The options for this policy.
5669
+ * @public
4754
5670
  */
4755
5671
  export declare interface RemoveHeadersOutboundPolicyOptions {
4756
5672
  /**
@@ -4774,6 +5690,7 @@ export declare const RemoveQueryParamsInboundPolicy: InboundPolicyHandler<Remove
4774
5690
 
4775
5691
  /**
4776
5692
  * The options for this policy.
5693
+ * @public
4777
5694
  */
4778
5695
  export declare interface RemoveQueryParamsInboundPolicyOptions {
4779
5696
  /**
@@ -4797,6 +5714,7 @@ export declare const ReplaceStringOutboundPolicy: OutboundPolicyHandler<ReplaceS
4797
5714
 
4798
5715
  /**
4799
5716
  * The options for this policy.
5717
+ * @public
4800
5718
  */
4801
5719
  export declare interface ReplaceStringOutboundPolicyOptions {
4802
5720
  /**
@@ -4814,7 +5732,8 @@ export declare interface ReplaceStringOutboundPolicyOptions {
4814
5732
  }
4815
5733
 
4816
5734
  /**
4817
- * The types of the properties in a request
5735
+ * Generic type parameters for a request.
5736
+ * Extends RequestInitGeneric and adds query parameter typing.
4818
5737
  * @public
4819
5738
  */
4820
5739
  export declare interface RequestGeneric extends RequestInitGeneric {
@@ -4826,7 +5745,8 @@ export declare interface RequestGeneric extends RequestInitGeneric {
4826
5745
  /* Excluded from this release type: RequestHandlerProxy */
4827
5746
 
4828
5747
  /**
4829
- * The types of the properties in a request init object
5748
+ * Generic type parameters for request initialization.
5749
+ * Used to strongly type the user data and path parameters.
4830
5750
  * @public
4831
5751
  */
4832
5752
  export declare interface RequestInitGeneric {
@@ -4834,6 +5754,10 @@ export declare interface RequestInitGeneric {
4834
5754
  Params?: RequestParamsDefault;
4835
5755
  }
4836
5756
 
5757
+ /**
5758
+ * Metadata for request logger entries
5759
+ * @public
5760
+ */
4837
5761
  export declare interface RequestLoggerMetaData {
4838
5762
  requestStartTime: Date;
4839
5763
  durationMs: number;
@@ -4842,6 +5766,10 @@ export declare interface RequestLoggerMetaData {
4842
5766
  systemUserAgent: string;
4843
5767
  }
4844
5768
 
5769
+ /**
5770
+ * Options for request logger
5771
+ * @public
5772
+ */
4845
5773
  export declare interface RequestLoggerOptions<T> {
4846
5774
  name: string;
4847
5775
  dispatchFunction: DispatchRequestLoggerEntries<T>;
@@ -4849,6 +5777,10 @@ export declare interface RequestLoggerOptions<T> {
4849
5777
  batchPeriodSeconds?: number;
4850
5778
  }
4851
5779
 
5780
+ /**
5781
+ * Request logger plugin
5782
+ * @public
5783
+ */
4852
5784
  export declare class RequestLoggerPlugin<T extends BasicDictionary> extends SystemRuntimePlugin {
4853
5785
  #private;
4854
5786
  constructor(options: RequestLoggerOptions<T>);
@@ -4878,6 +5810,7 @@ export declare const RequestSizeLimitInboundPolicy: InboundPolicyHandler<Request
4878
5810
 
4879
5811
  /**
4880
5812
  * The options for this policy.
5813
+ * @public
4881
5814
  */
4882
5815
  export declare interface RequestSizeLimitInboundPolicyOptions {
4883
5816
  /**
@@ -4891,8 +5824,24 @@ export declare interface RequestSizeLimitInboundPolicyOptions {
4891
5824
  }
4892
5825
 
4893
5826
  /**
4894
- * The authorized identity on the incoming request
5827
+ * Represents an authenticated user on the request.
5828
+ * Set by authentication policies like API key, JWT, or OAuth.
5829
+ *
4895
5830
  * @public
5831
+ * @example
5832
+ * ```typescript
5833
+ * // Access user info in a handler
5834
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
5835
+ * if (!request.user) {
5836
+ * return new Response("Unauthorized", { status: 401 });
5837
+ * }
5838
+ *
5839
+ * const userId = request.user.sub;
5840
+ * const customData = request.user.data as { role: string; tenantId: string };
5841
+ *
5842
+ * context.log.info(`Request from user ${userId} with role ${customData.role}`);
5843
+ * }
5844
+ * ```
4896
5845
  */
4897
5846
  export declare interface RequestUser<TUserData> {
4898
5847
  sub: string;
@@ -4900,20 +5849,101 @@ export declare interface RequestUser<TUserData> {
4900
5849
  }
4901
5850
 
4902
5851
  /**
4903
- * Validate inbound requests based on Open API specification.
5852
+ * Validates incoming requests against your OpenAPI specification.
5853
+ * Checks query parameters, path parameters, headers, and request body
5854
+ * to ensure they match the defined schema before processing.
4904
5855
  *
4905
5856
  * @title Request Validation
4906
5857
  * @public
4907
- * @param request - The ZuploRequest
5858
+ *
5859
+ * @param request - The incoming ZuploRequest
4908
5860
  * @param context - The ZuploContext
4909
- * @param options - The policy options set in policies.json
4910
- * @param policyName - The name of the policy as set in policies.json
4911
- * @returns A Request or a Response
5861
+ * @param options - Validation configuration options
5862
+ * @param policyName - The name of the policy instance
5863
+ * @returns The validated request or a 400 Bad Request response with validation errors
5864
+ *
5865
+ * @example
5866
+ * ```json
5867
+ * // policies.json - Validate all request components
5868
+ * {
5869
+ * "name": "validate-request",
5870
+ * "policyType": "request-validation-inbound",
5871
+ * "handler": {
5872
+ * "export": "RequestValidationInboundPolicy",
5873
+ * "module": "$import(@zuplo/runtime)",
5874
+ * "options": {
5875
+ * "validateBody": true,
5876
+ * "validateQueryParameters": true,
5877
+ * "validatePathParameters": true,
5878
+ * "validateHeaders": true
5879
+ * }
5880
+ * }
5881
+ * }
5882
+ * ```
5883
+ *
5884
+ * @example
5885
+ * ```json
5886
+ * // Validate only body with custom error handling
5887
+ * {
5888
+ * "handler": {
5889
+ * "export": "RequestValidationInboundPolicy",
5890
+ * "module": "$import(@zuplo/runtime)",
5891
+ * "options": {
5892
+ * "validateBody": {
5893
+ * "enabled": true,
5894
+ * "logging": true,
5895
+ * "requestSizeLimit": 1048576
5896
+ * },
5897
+ * "validateQueryParameters": false,
5898
+ * "validatePathParameters": false,
5899
+ * "validateHeaders": false
5900
+ * }
5901
+ * }
5902
+ * }
5903
+ * ```
5904
+ *
5905
+ * @example
5906
+ * ```yaml
5907
+ * # OpenAPI schema definition
5908
+ * paths:
5909
+ * /users/{userId}:
5910
+ * post:
5911
+ * parameters:
5912
+ * - name: userId
5913
+ * in: path
5914
+ * required: true
5915
+ * schema:
5916
+ * type: string
5917
+ * format: uuid
5918
+ * - name: include
5919
+ * in: query
5920
+ * schema:
5921
+ * type: array
5922
+ * items:
5923
+ * type: string
5924
+ * enum: [profile, settings, history]
5925
+ * requestBody:
5926
+ * required: true
5927
+ * content:
5928
+ * application/json:
5929
+ * schema:
5930
+ * type: object
5931
+ * required: [name, email]
5932
+ * properties:
5933
+ * name:
5934
+ * type: string
5935
+ * minLength: 1
5936
+ * maxLength: 100
5937
+ * email:
5938
+ * type: string
5939
+ * format: email
5940
+ * ```
4912
5941
  */
4913
5942
  export declare const RequestValidationInboundPolicy: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
4914
5943
 
4915
5944
  /**
4916
5945
  * The options for this policy.
5946
+ * @public
4917
5947
  */
4918
5948
  export declare interface RequestValidationInboundPolicyOptions {
4919
5949
  /**
@@ -4945,6 +5975,7 @@ export declare const RequireOriginInboundPolicy: InboundPolicyHandler<RequireOri
4945
5975
 
4946
5976
  /**
4947
5977
  * The options for this policy.
5978
+ * @public
4948
5979
  */
4949
5980
  export declare interface RequireOriginInboundPolicyOptions {
4950
5981
  /**
@@ -4964,7 +5995,8 @@ declare type ResolveRequestQuery<TQuery extends RequestQueryDefault | undefined>
4964
5995
  declare type ResolveUserData<TUserData extends UserDataDefault | undefined> = TUserData extends UserDataDefault ? TUserData : UserDataDefault;
4965
5996
 
4966
5997
  /**
4967
- * @beta
5998
+ * Definition of responses for a route
5999
+ * @public
4968
6000
  */
4969
6001
  export declare type ResponsesDefinition = Record<HttpStatusCode | HttpStatusCodeRangeDefinition, Modify<Omit<OpenAPIV3_1.ResponseObject, "links">, {
4970
6002
  headers?: {
@@ -4972,18 +6004,29 @@ export declare type ResponsesDefinition = Record<HttpStatusCode | HttpStatusCode
4972
6004
  };
4973
6005
  }>>;
4974
6006
 
6007
+ /**
6008
+ * Event fired before a response is sent
6009
+ * @public
6010
+ */
4975
6011
  export declare class ResponseSendingEvent extends Event {
4976
6012
  constructor(request: ZuploRequest, response: Response);
4977
6013
  readonly request: ZuploRequest;
4978
6014
  mutableResponse: Response | Promise<Response>;
4979
6015
  }
4980
6016
 
6017
+ /**
6018
+ * Event fired after a response has been sent
6019
+ * @public
6020
+ */
4981
6021
  export declare class ResponseSentEvent extends Event {
4982
6022
  constructor(request: ZuploRequest, response: Response);
4983
6023
  readonly request: ZuploRequest;
4984
6024
  readonly response: Response;
4985
6025
  }
4986
6026
 
6027
+ /**
6028
+ * @public
6029
+ */
4987
6030
  export declare interface RouteConfiguration extends Omit<BuildRouteConfiguration, "raw"> {
4988
6031
  /**
4989
6032
  * @deprecated Please switch to "raw().operationId"
@@ -5011,6 +6054,9 @@ export declare interface RouteConfiguration extends Omit<BuildRouteConfiguration
5011
6054
  raw<T = any>(): T;
5012
6055
  }
5013
6056
 
6057
+ /**
6058
+ * @public
6059
+ */
5014
6060
  export declare interface RouteData {
5015
6061
  /**
5016
6062
  * @deprecated This property is not used and will be removed in future versions
@@ -5033,10 +6079,35 @@ export declare interface RouteHandler<T = unknown> {
5033
6079
  /* Excluded from this release type: RuntimeEnvironment */
5034
6080
 
5035
6081
  /**
5036
- * Used to indicate errors that are caused by user input
5037
- * These errors are shown to the user and logged in user logs
5038
- * These errors are NOT fatal and will not cause monitoring alerts
6082
+ * Used to indicate errors that are caused by user input or runtime conditions.
6083
+ * These errors are shown to the user and logged in user logs.
6084
+ * They are NOT fatal and will not cause monitoring alerts.
6085
+ *
5039
6086
  * @public
6087
+ * @example
6088
+ * ```typescript
6089
+ * import { RuntimeError } from "@zuplo/runtime";
6090
+ *
6091
+ * // Simple error
6092
+ * throw new RuntimeError("Invalid API key format");
6093
+ *
6094
+ * // Error with cause
6095
+ * try {
6096
+ * await someOperation();
6097
+ * } catch (err) {
6098
+ * throw new RuntimeError("Failed to process request", { cause: err });
6099
+ * }
6100
+ *
6101
+ * // Error with extension members for additional context
6102
+ * throw new RuntimeError({
6103
+ * message: "Rate limit exceeded",
6104
+ * extensionMembers: {
6105
+ * limit: 100,
6106
+ * window: "1m",
6107
+ * retryAfter: 60
6108
+ * }
6109
+ * });
6110
+ * ```
5040
6111
  */
5041
6112
  export declare class RuntimeError extends Error {
5042
6113
  extensionMembers: Record<string, unknown> | undefined;
@@ -5074,6 +6145,10 @@ export declare interface RuntimeExtensions {
5074
6145
  addPreRoutingHook(hook: PreRoutingHook): void;
5075
6146
  }
5076
6147
 
6148
+ /**
6149
+ * Function to configure runtime extensions
6150
+ * @public
6151
+ */
5077
6152
  export declare interface RuntimeExtensionsFunction {
5078
6153
  (runtime: RuntimeExtensions): Promise<void>;
5079
6154
  }
@@ -5088,10 +6163,11 @@ declare abstract class RuntimePlugin {
5088
6163
 
5089
6164
  declare type RuntimeType = "deno" | "cloudflare";
5090
6165
 
5091
- export declare function sanitizedIdentifierName(name: string): string;
6166
+ /* Excluded from this release type: sanitizedIdentifierName */
5092
6167
 
5093
6168
  /**
5094
6169
  * @deprecated Use RequestValidationInboundPolicy instead
6170
+ * @public
5095
6171
  */
5096
6172
  export declare const SchemaBasedRequestValidation: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
5097
6173
 
@@ -5111,6 +6187,7 @@ export declare const SecretMaskingOutboundPolicy: OutboundPolicyHandler<SecretMa
5111
6187
 
5112
6188
  /**
5113
6189
  * The options for the secret masking policy.
6190
+ * @public
5114
6191
  */
5115
6192
  export declare interface SecretMaskingOutboundPolicyOptions {
5116
6193
  /**
@@ -5154,6 +6231,7 @@ export declare function SemanticCacheInboundPolicy(request: ZuploRequest, contex
5154
6231
 
5155
6232
  /**
5156
6233
  * The options for this policy.
6234
+ * @public
5157
6235
  */
5158
6236
  export declare type SemanticCacheInboundPolicyOptions = {
5159
6237
  [k: string]: unknown;
@@ -5233,6 +6311,7 @@ export declare const SetBodyInboundPolicy: InboundPolicyHandler<SetBodyInboundPo
5233
6311
 
5234
6312
  /**
5235
6313
  * The options for this policy.
6314
+ * @public
5236
6315
  */
5237
6316
  export declare interface SetBodyInboundPolicyOptions {
5238
6317
  /**
@@ -5256,6 +6335,7 @@ export declare const SetHeadersInboundPolicy: InboundPolicyHandler<SetHeadersInb
5256
6335
 
5257
6336
  /**
5258
6337
  * The options for this policy.
6338
+ * @public
5259
6339
  */
5260
6340
  export declare interface SetHeadersInboundPolicyOptions {
5261
6341
  /**
@@ -5292,6 +6372,7 @@ export declare const SetHeadersOutboundPolicy: OutboundPolicyHandler<SetHeadersO
5292
6372
 
5293
6373
  /**
5294
6374
  * The options for this policy.
6375
+ * @public
5295
6376
  */
5296
6377
  export declare interface SetHeadersOutboundPolicyOptions {
5297
6378
  /**
@@ -5313,6 +6394,12 @@ export declare interface SetHeadersOutboundPolicyOptions {
5313
6394
  }[];
5314
6395
  }
5315
6396
 
6397
+ /**
6398
+ * Sets custom context data that will be included with Moesif analytics events
6399
+ * @public
6400
+ * @param context - The ZuploContext for the current request
6401
+ * @param moesifContext - Custom data to include with Moesif events (userId, companyId, metadata, etc.)
6402
+ */
5316
6403
  export declare function setMoesifContext(context: ZuploContext, moesifContext: MoesifContext): void;
5317
6404
 
5318
6405
  /**
@@ -5330,6 +6417,7 @@ export declare const SetQueryParamsInboundPolicy: InboundPolicyHandler<SetQueryP
5330
6417
 
5331
6418
  /**
5332
6419
  * The options for this policy.
6420
+ * @public
5333
6421
  */
5334
6422
  export declare interface SetQueryParamsInboundPolicyOptions {
5335
6423
  /**
@@ -5366,6 +6454,7 @@ export declare const SetStatusOutboundPolicy: OutboundPolicyHandler<SetStatusOut
5366
6454
 
5367
6455
  /**
5368
6456
  * The options for this policy.
6457
+ * @public
5369
6458
  */
5370
6459
  export declare interface SetStatusOutboundPolicyOptions {
5371
6460
  /**
@@ -5402,6 +6491,7 @@ export declare const SleepInboundPolicy: InboundPolicyHandler<SleepInboundPolicy
5402
6491
 
5403
6492
  /**
5404
6493
  * The options for this policy.
6494
+ * @public
5405
6495
  */
5406
6496
  export declare interface SleepInboundPolicyOptions {
5407
6497
  /**
@@ -5446,6 +6536,10 @@ declare interface SplunkLoggingOptions {
5446
6536
  channel?: string;
5447
6537
  }
5448
6538
 
6539
+ /**
6540
+ * Splunk logging plugin
6541
+ * @public
6542
+ */
5449
6543
  export declare class SplunkLoggingPlugin extends LogPlugin {
5450
6544
  private options;
5451
6545
  constructor(options: SplunkLoggingOptions);
@@ -5455,10 +6549,44 @@ export declare class SplunkLoggingPlugin extends LogPlugin {
5455
6549
  /* Excluded from this release type: StandardEnv */
5456
6550
 
5457
6551
  /**
5458
- * The StreamingZoneCache is a wrapper around the zone cache that allows
5459
- * storing a ReadableStream by wrapping it in a Response. The key
5460
- * is stored as the request URL for retrieval later.
5461
- * @beta This is a beta feature and may change in the future.
6552
+ * A specialized zone cache for storing and retrieving ReadableStreams.
6553
+ * Unlike regular ZoneCache which serializes to JSON, this cache stores raw stream data,
6554
+ * making it ideal for caching response bodies, file uploads, or other streaming content.
6555
+ *
6556
+ * @public
6557
+ * @example
6558
+ * ```typescript
6559
+ * import { StreamingZoneCache, ZuploContext } from "@zuplo/runtime";
6560
+ *
6561
+ * export async function cacheStreamingResponse(
6562
+ * request: ZuploRequest,
6563
+ * context: ZuploContext
6564
+ * ) {
6565
+ * const cache = new StreamingZoneCache("stream-cache", context);
6566
+ * const cacheKey = `api-response-${request.url}`;
6567
+ *
6568
+ * // Check cache first
6569
+ * const cachedStream = await cache.get(cacheKey);
6570
+ * if (cachedStream) {
6571
+ * return new Response(cachedStream, {
6572
+ * headers: { "X-Cache": "HIT" }
6573
+ * });
6574
+ * }
6575
+ *
6576
+ * // Fetch fresh data
6577
+ * const response = await fetch("https://api.example.com/large-file");
6578
+ *
6579
+ * // Clone the response so we can cache and return it
6580
+ * const [cacheStream, returnStream] = response.body!.tee();
6581
+ *
6582
+ * // Cache for 5 minutes
6583
+ * await cache.put(cacheKey, cacheStream, 300);
6584
+ *
6585
+ * return new Response(returnStream, {
6586
+ * headers: { "X-Cache": "MISS" }
6587
+ * });
6588
+ * }
6589
+ * ```
5462
6590
  */
5463
6591
  export declare class StreamingZoneCache {
5464
6592
  #private;
@@ -5567,6 +6695,7 @@ export declare class StripeWebhookVerificationInboundPolicy extends InboundPolic
5567
6695
 
5568
6696
  /**
5569
6697
  * The options for this policy.
6698
+ * @public
5570
6699
  */
5571
6700
  export declare interface StripeWebhookVerificationInboundPolicyOptions {
5572
6701
  /**
@@ -5599,6 +6728,10 @@ declare interface SumoLogicLoggingOptions {
5599
6728
  fields?: CustomLogFields;
5600
6729
  }
5601
6730
 
6731
+ /**
6732
+ * Sumo Logic logging plugin
6733
+ * @public
6734
+ */
5602
6735
  export declare class SumoLogicLoggingPlugin extends LogPlugin {
5603
6736
  private options;
5604
6737
  constructor(options: SumoLogicLoggingOptions);
@@ -5621,6 +6754,7 @@ export declare const SupabaseJwtInboundPolicy: InboundPolicyHandler<SupabaseJwtI
5621
6754
 
5622
6755
  /**
5623
6756
  * The options for this policy.
6757
+ * @public
5624
6758
  */
5625
6759
  export declare interface SupabaseJwtInboundPolicyOptions {
5626
6760
  /**
@@ -5698,6 +6832,7 @@ declare interface TupleKey {
5698
6832
 
5699
6833
  /**
5700
6834
  * No authentication.
6835
+ * @public
5701
6836
  */
5702
6837
  declare interface UnauthenticatedCredentialConfig {
5703
6838
  /**
@@ -5722,6 +6857,7 @@ export declare const UpstreamAzureAdServiceAuthInboundPolicy: InboundPolicyHandl
5722
6857
 
5723
6858
  /**
5724
6859
  * The options for this policy.
6860
+ * @public
5725
6861
  */
5726
6862
  export declare interface UpstreamAzureAdServiceAuthInboundPolicyOptions {
5727
6863
  /**
@@ -5762,6 +6898,7 @@ export declare const UpstreamFirebaseAdminAuthInboundPolicy: InboundPolicyHandle
5762
6898
 
5763
6899
  /**
5764
6900
  * The options for this policy.
6901
+ * @public
5765
6902
  */
5766
6903
  export declare interface UpstreamFirebaseAdminAuthInboundPolicyOptions {
5767
6904
  /**
@@ -5794,6 +6931,7 @@ export declare const UpstreamFirebaseUserAuthInboundPolicy: InboundPolicyHandler
5794
6931
 
5795
6932
  /**
5796
6933
  * The options for this policy.
6934
+ * @public
5797
6935
  */
5798
6936
  export declare interface UpstreamFirebaseUserAuthInboundPolicyOptions {
5799
6937
  /**
@@ -5857,6 +6995,7 @@ export declare class UpstreamGcpFederatedAuthInboundPolicy extends InboundPolicy
5857
6995
 
5858
6996
  /**
5859
6997
  * The options for this policy.
6998
+ * @public
5860
6999
  */
5861
7000
  export declare interface UpstreamGcpFederatedAuthInboundPolicyOptions {
5862
7001
  /**
@@ -5903,6 +7042,7 @@ export declare const UpstreamGcpJwtInboundPolicy: InboundPolicyHandler<UpstreamG
5903
7042
 
5904
7043
  /**
5905
7044
  * The options for this policy.
7045
+ * @public
5906
7046
  */
5907
7047
  export declare interface UpstreamGcpJwtInboundPolicyOptions {
5908
7048
  /**
@@ -5932,6 +7072,7 @@ export declare const UpstreamGcpServiceAuthInboundPolicy: InboundPolicyHandler<U
5932
7072
 
5933
7073
  /**
5934
7074
  * The options for this policy.
7075
+ * @public
5935
7076
  */
5936
7077
  export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
5937
7078
  /**
@@ -5966,19 +7107,99 @@ export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
5966
7107
  }
5967
7108
 
5968
7109
  /**
5969
- * @beta
5970
- * @param request - The ZuploRequest
7110
+ * Handler that forwards requests to a different base URL while preserving the path.
7111
+ * Ideal for proxying requests to backend services or creating API gateways.
7112
+ *
7113
+ * @param request - The incoming ZuploRequest
5971
7114
  * @param context - The ZuploContext
5972
- * @returns ZuploResponse
7115
+ * @returns A Response from the forwarded URL
7116
+ *
7117
+ * @public
7118
+ * @example
7119
+ * ```json
7120
+ * // routes.oas.json - Forward all /api/* requests to backend
7121
+ * {
7122
+ * "paths": {
7123
+ * "/api/{path}*": {
7124
+ * "x-zuplo-route": {
7125
+ * "handler": {
7126
+ * "export": "urlForwardHandler",
7127
+ * "module": "$import(@zuplo/runtime)",
7128
+ * "options": {
7129
+ * "baseUrl": "https://backend.example.com",
7130
+ * "forwardSearch": true
7131
+ * }
7132
+ * }
7133
+ * }
7134
+ * }
7135
+ * }
7136
+ * }
7137
+ * ```
7138
+ *
7139
+ * @example
7140
+ * ```json
7141
+ * // Forward with dynamic base URL based on environment
7142
+ * {
7143
+ * "handler": {
7144
+ * "export": "urlForwardHandler",
7145
+ * "module": "$import(@zuplo/runtime)",
7146
+ * "options": {
7147
+ * "baseUrl": "$env(BACKEND_URL)",
7148
+ * "forwardSearch": false,
7149
+ * "followRedirects": true
7150
+ * }
7151
+ * }
7152
+ * }
7153
+ * ```
5973
7154
  */
5974
7155
  export declare function urlForwardHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
5975
7156
 
5976
7157
  /**
5977
- * Proxy requests to a different url
5978
- * @param request - The ZuploRequest
7158
+ * Handler that rewrites the request URL based on a pattern.
7159
+ * Useful for routing requests to different backends based on path parameters,
7160
+ * query strings, or other request properties.
7161
+ *
7162
+ * @param request - The incoming ZuploRequest
5979
7163
  * @param context - The ZuploContext
5980
- * @returns
5981
- * @beta
7164
+ * @returns A Response from the rewritten URL
7165
+ *
7166
+ * @public
7167
+ * @example
7168
+ * ```json
7169
+ * // routes.oas.json - Route to different API versions
7170
+ * {
7171
+ * "paths": {
7172
+ * "/api/{version}/users/{id}": {
7173
+ * "x-zuplo-route": {
7174
+ * "handler": {
7175
+ * "export": "urlRewriteHandler",
7176
+ * "module": "$import(@zuplo/runtime)",
7177
+ * "options": {
7178
+ * "rewritePattern": "https://api-${params.version}.example.com/users/${params.id}",
7179
+ * "forwardSearch": true
7180
+ * }
7181
+ * }
7182
+ * }
7183
+ * }
7184
+ * }
7185
+ * }
7186
+ * ```
7187
+ *
7188
+ * @example
7189
+ * ```json
7190
+ * // Route to backend service with custom headers
7191
+ * {
7192
+ * "handler": {
7193
+ * "export": "urlRewriteHandler",
7194
+ * "module": "$import(@zuplo/runtime)",
7195
+ * "options": {
7196
+ * "rewritePattern": "https://backend.internal/api${url.pathname}",
7197
+ * "forwardSearch": false,
7198
+ * "followRedirects": true
7199
+ * }
7200
+ * }
7201
+ * }
7202
+ * ```
5982
7203
  */
5983
7204
  export declare function urlRewriteHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
5984
7205
 
@@ -6010,6 +7231,7 @@ declare interface ValidateJsonSchemaInboundInternalOptions extends Omit<Validate
6010
7231
 
6011
7232
  /**
6012
7233
  * The options for this policy.
7234
+ * @public
6013
7235
  */
6014
7236
  export declare interface ValidateJsonSchemaInboundOptions {
6015
7237
  /**
@@ -6020,21 +7242,25 @@ export declare interface ValidateJsonSchemaInboundOptions {
6020
7242
 
6021
7243
  /**
6022
7244
  * The action to perform when validation fails.
7245
+ * @public
6023
7246
  */
6024
7247
  declare type ValidationOptions = "none" | "log-only" | "reject-and-log" | "reject-only";
6025
7248
 
6026
7249
  /**
6027
7250
  * The action to perform when validation fails.
7251
+ * @public
6028
7252
  */
6029
7253
  declare type ValidationOptions1 = "none" | "log-only" | "reject-and-log" | "reject-only";
6030
7254
 
6031
7255
  /**
6032
7256
  * The action to perform when validation fails.
7257
+ * @public
6033
7258
  */
6034
7259
  declare type ValidationOptions2 = "none" | "log-only" | "reject-and-log" | "reject-only";
6035
7260
 
6036
7261
  /**
6037
7262
  * The action to perform when validation fails.
7263
+ * @public
6038
7264
  */
6039
7265
  declare type ValidationOptions3 = "none" | "log-only" | "reject-and-log" | "reject-only";
6040
7266
 
@@ -6067,6 +7293,10 @@ declare interface VMWareLogInsightLoggingOptions {
6067
7293
  onMessageSending?: (event: LogInsightLogEntry) => LogInsightLogEntry;
6068
7294
  }
6069
7295
 
7296
+ /**
7297
+ * VMware Log Insight logging plugin
7298
+ * @public
7299
+ */
6070
7300
  export declare class VMWareLogInsightLoggingPlugin extends LogPlugin {
6071
7301
  private options;
6072
7302
  constructor(options: VMWareLogInsightLoggingOptions);
@@ -6095,6 +7325,7 @@ export declare const WebBotAuthInboundPolicy: InboundPolicyHandler<WebBotAuthInb
6095
7325
 
6096
7326
  /**
6097
7327
  * Options for the Web Bot Auth Inbound Policy.
7328
+ * @public
6098
7329
  */
6099
7330
  export declare interface WebBotAuthInboundPolicyOptions {
6100
7331
  /**
@@ -6116,11 +7347,53 @@ export declare interface WebBotAuthInboundPolicyOptions {
6116
7347
  }
6117
7348
 
6118
7349
  /**
6119
- * Handle websocket requests to a different url
6120
- * @param request - The ZuploRequest
7350
+ * Handler that proxies WebSocket connections to a different URL.
7351
+ * Enables WebSocket support in your API gateway for real-time communication.
7352
+ *
7353
+ * @param request - The incoming ZuploRequest with WebSocket upgrade headers
6121
7354
  * @param context - The ZuploContext
6122
- * @returns
7355
+ * @returns A WebSocket upgrade Response (101 Switching Protocols)
7356
+ *
6123
7357
  * @beta
7358
+ * @example
7359
+ * ```json
7360
+ * // routes.oas.json - WebSocket endpoint
7361
+ * {
7362
+ * "paths": {
7363
+ * "/ws/chat": {
7364
+ * "x-zuplo-route": {
7365
+ * "handler": {
7366
+ * "export": "webSocketHandler",
7367
+ * "module": "$import(@zuplo/runtime)",
7368
+ * "options": {
7369
+ * "rewritePattern": "wss://chat-backend.example.com/ws"
7370
+ * }
7371
+ * }
7372
+ * }
7373
+ * }
7374
+ * }
7375
+ * }
7376
+ * ```
7377
+ *
7378
+ * @example
7379
+ * ```json
7380
+ * // Dynamic WebSocket routing based on path parameters
7381
+ * {
7382
+ * "paths": {
7383
+ * "/ws/{room}": {
7384
+ * "x-zuplo-route": {
7385
+ * "handler": {
7386
+ * "export": "webSocketHandler",
7387
+ * "module": "$import(@zuplo/runtime)",
7388
+ * "options": {
7389
+ * "rewritePattern": "wss://chat.example.com/rooms/${params.room}"
7390
+ * }
7391
+ * }
7392
+ * }
7393
+ * }
7394
+ * }
7395
+ * }
7396
+ * ```
6124
7397
  */
6125
7398
  export declare function webSocketHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
6126
7399
 
@@ -6176,6 +7449,7 @@ export declare class XmlToJsonOutboundPolicy extends OutboundPolicy<XmlToJsonPol
6176
7449
 
6177
7450
  /**
6178
7451
  * The options for this policy.
7452
+ * @public
6179
7453
  */
6180
7454
  export declare interface XmlToJsonPolicyOptions {
6181
7455
  /**
@@ -6217,23 +7491,70 @@ export declare interface XmlToJsonPolicyOptions {
6217
7491
  }
6218
7492
 
6219
7493
  /**
6220
- * This is a simple wrapper around the data-center HTTP cache
6221
- * to enable simple objects to be stored by a string key. This is
6222
- * useful to us and customers and provides a very high-performance
6223
- * read-through cache that stores data in the same data-center. It is
6224
- * not replicated.
7494
+ * A high-performance cache that stores data in the same data center (zone).
7495
+ * Uses the underlying HTTP cache API to store JSON-serializable objects by string keys.
7496
+ * Data is not replicated across zones, making it ideal for zone-local caching scenarios.
7497
+ *
7498
+ * @public
7499
+ * @example
7500
+ * ```typescript
7501
+ * import { ZoneCache, ZuploContext } from "@zuplo/runtime";
7502
+ *
7503
+ * export async function myHandler(request: ZuploRequest, context: ZuploContext) {
7504
+ * const cache = new ZoneCache<ProductData>("product-cache", context);
7505
+ *
7506
+ * // Store product data for 10 minutes
7507
+ * await cache.put("product-123", {
7508
+ * id: "123",
7509
+ * name: "Widget",
7510
+ * price: 99.99
7511
+ * }, 600);
7512
+ *
7513
+ * // Retrieve cached data
7514
+ * const product = await cache.get("product-123");
7515
+ * if (product) {
7516
+ * return Response.json(product);
7517
+ * }
7518
+ *
7519
+ * return new Response("Product not found", { status: 404 });
7520
+ * }
7521
+ * ```
6225
7522
  */
6226
7523
  export declare class ZoneCache<T = any> {
6227
7524
  #private;
7525
+ /**
7526
+ * Creates a new ZoneCache instance.
7527
+ * @param name - A unique name for this cache instance
7528
+ * @param context - The ZuploContext from the current request
7529
+ */
6228
7530
  constructor(name: string, context: ZuploContext);
6229
7531
  /* Excluded from this release type: __constructor */
7532
+ /**
7533
+ * Retrieves a value from the zone cache by key.
7534
+ * @param key - The cache key to retrieve
7535
+ * @returns The cached value or undefined if not found, expired, or on error
7536
+ */
6230
7537
  get(key: string): Promise<T | undefined>;
7538
+ /**
7539
+ * Stores a value in the zone cache with the specified TTL.
7540
+ * @param key - The cache key
7541
+ * @param data - The value to cache (must be JSON-serializable)
7542
+ * @param ttlSeconds - Time to live in seconds
7543
+ */
6231
7544
  put(key: string, data: T, ttlSeconds: number): Promise<void>;
7545
+ /**
7546
+ * Removes a key from the zone cache.
7547
+ * @param key - The cache key to delete
7548
+ */
6232
7549
  delete(key: string): Promise<void>;
6233
7550
  deleteFallback(key: string): Promise<void>;
6234
7551
  logDebug(...messages: unknown[]): void;
6235
7552
  }
6236
7553
 
7554
+ /**
7555
+ * The ZuploContext provides information about the current request and helper methods.
7556
+ * @public
7557
+ */
6237
7558
  export declare interface ZuploContext extends EventTarget {
6238
7559
  /**
6239
7560
  * The unique identifier of this context
@@ -6306,10 +7627,70 @@ export declare interface ZuploContext extends EventTarget {
6306
7627
  /* Excluded from this release type: ZuploEventContext */
6307
7628
 
6308
7629
  /**
6309
- * ZuploRequest includes various parsed objects from the
6310
- * incoming Request. This object inherits from the web
6311
- * standard {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request}.
7630
+ * Enhanced Request class that extends the standard Web Request API with
7631
+ * convenient properties for accessing path parameters, query strings, and user data.
7632
+ * This is the request type passed to all handlers and policies in Zuplo.
7633
+ *
6312
7634
  * @public
7635
+ * @example
7636
+ * ```typescript
7637
+ * import { ZuploRequest, ZuploContext } from "@zuplo/runtime";
7638
+ *
7639
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
7640
+ * // Access query parameters
7641
+ * const page = request.query.page || "1";
7642
+ * const limit = request.query.limit || "10";
7643
+ *
7644
+ * // Access path parameters (e.g., from /users/:userId)
7645
+ * const userId = request.params.userId;
7646
+ *
7647
+ * // Access authenticated user
7648
+ * const user = request.user;
7649
+ *
7650
+ * // Standard Request properties still available
7651
+ * const contentType = request.headers.get("content-type");
7652
+ * const method = request.method;
7653
+ *
7654
+ * return Response.json({
7655
+ * userId,
7656
+ * page,
7657
+ * limit,
7658
+ * authenticated: !!user
7659
+ * });
7660
+ * }
7661
+ * ```
7662
+ *
7663
+ * @example
7664
+ * ```typescript
7665
+ * // Strongly typed request parameters
7666
+ * interface MyParams {
7667
+ * userId: string;
7668
+ * orderId: string;
7669
+ * }
7670
+ *
7671
+ * interface MyQuery {
7672
+ * include?: string;
7673
+ * format?: "json" | "xml";
7674
+ * }
7675
+ *
7676
+ * interface MyUserData {
7677
+ * role: "admin" | "user";
7678
+ * tenantId: string;
7679
+ * }
7680
+ *
7681
+ * type MyRequest = ZuploRequest<{
7682
+ * Params: MyParams;
7683
+ * Query: MyQuery;
7684
+ * UserData: MyUserData;
7685
+ * }>;
7686
+ *
7687
+ * export function typedHandler(request: MyRequest, context: ZuploContext) {
7688
+ * // All properties are now strongly typed
7689
+ * const userId = request.params.userId; // string
7690
+ * const format = request.query.format; // "json" | "xml" | undefined
7691
+ * const role = request.user?.data.role; // "admin" | "user" | undefined
7692
+ * }
7693
+ * ```
6313
7694
  */
6314
7695
  export declare class ZuploRequest<TOptions extends RequestGeneric = RequestGeneric> extends Request {
6315
7696
  #private;
@@ -6362,7 +7743,8 @@ export declare class ZuploRequest<TOptions extends RequestGeneric = RequestGener
6362
7743
  }
6363
7744
 
6364
7745
  /**
6365
- * The initialization values of a request
7746
+ * Options for creating a new ZuploRequest.
7747
+ * Extends the standard RequestInit with Zuplo-specific properties.
6366
7748
  * @public
6367
7749
  */
6368
7750
  export declare interface ZuploRequestInit<TOptions extends RequestInitGeneric = RequestInitGeneric> extends RequestInit {