@zuplo/runtime 5.1942.0 → 5.1945.0

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.
@@ -0,0 +1,3384 @@
1
+ import { KeyLike } from "jose";
2
+ import type { OpenAPIV3_1 } from "openapi-types";
3
+ import type { ValidateFunction as ValidateFunction_2 } from "ajv";
4
+
5
+ /**
6
+ * Amberflo is a usage metering and billing service. This policy allows you to send metering calls for each API to their meter ingest endpoint.
7
+ *
8
+ * @remarks
9
+ * Amberflo {@link https://www.amberflo.io|amberflo.com} is a usage metering and
10
+ * billing service. This policy allows you to meter API calls going through Zuplo
11
+ * and send them to your Amberflo account using your Amberflo API key.
12
+ *
13
+ * Add the policy to each route you want to meter. Note you can specify the Meter
14
+ * API Name and Meter Value (meter increment) at the policy level.
15
+ *
16
+ * @title Amberflo Metering / Billing
17
+ * @public
18
+ * @param request - The ZuploRequest
19
+ * @param context - The ZuploContext
20
+ * @param options - The policy options set in policies.json
21
+ * @param policyName - The name of the policy as set in policies.json
22
+ * @returns A Request or a Response
23
+ */
24
+ export declare function AmberfloMeteringInboundPolicy(
25
+ request: ZuploRequest,
26
+ context: ZuploContext,
27
+ options: AmberfloMeteringInboundPolicyOptions,
28
+ policyName: string
29
+ ): Promise<ZuploRequest<RequestGeneric>>;
30
+
31
+ /**
32
+ * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
33
+ */
34
+ export declare interface AmberfloMeteringInboundPolicyOptions {
35
+ /**
36
+ * The API key to use when sending metering calls to Amberflo.
37
+ */
38
+ apiKey: string;
39
+ /**
40
+ * The name of the meter to use when sending metering calls to Amberflo (overridable in code).
41
+ */
42
+ meterApiName?: string;
43
+ /**
44
+ * The value to use when sending metering calls to Amberflo (overridable in code).
45
+ */
46
+ meterValue?: number;
47
+ /**
48
+ * The path to the property on `request.user` contains the customer ID. For example `.data.accountNumber` would read the `request.user.data.accountNumber` property.
49
+ */
50
+ customerIdPropertyPath?: string;
51
+ /**
52
+ * The default customerId for all metering calls - overridable in code and by `customerIdPropertyPath`.
53
+ */
54
+ customerId?: string;
55
+ /**
56
+ * A dictionary of dimensions to be sent to Amberflo (extensible in code).
57
+ */
58
+ dimensions?: {
59
+ [k: string]: string;
60
+ };
61
+ /**
62
+ * A list of successful status codes and ranges "200-299, 304" that should trigger a metering call to Amberflo.
63
+ */
64
+ statusCodes?: string | number[];
65
+ /**
66
+ * The URL to send metering events. This is useful for testing purposes.
67
+ */
68
+ url?: string;
69
+ }
70
+
71
+ declare interface AmberfloMeteringIngestPayload {
72
+ customerId: string;
73
+ meterApiName: string;
74
+ meterValue: number;
75
+ meterTimeInMillis: number;
76
+ dimensions: Record<string, string>;
77
+ }
78
+
79
+ export declare class AmberfloMeteringPolicy {
80
+ static setRequestProperties(
81
+ context: ZuploContext,
82
+ properties: AmberfloMeteringProperties
83
+ ): void;
84
+ }
85
+
86
+ declare interface AmberfloMeteringProperties
87
+ extends Omit<AmberfloMeteringIngestPayload, "meterTimeInMillis"> {
88
+ customerId: string;
89
+ }
90
+
91
+ /* Excluded from this release type: API_KEY */
92
+
93
+ /**
94
+ * Authenticates requests based on API Keys using Zuplo API Management. You
95
+ * can learn more about the Zuplo API Key Service
96
+ * [here](https://zuplo.com/docs/articles/api-key-api#buckets)
97
+ *
98
+ * @remarks
99
+ * This policy uses the managed API key storage provided by Zuplo.
100
+ * `allowUnauthenticatedRequests` defaults to false and rejects any request without
101
+ * a valid API key (returning a `401 - Unauthorized` response). You can override
102
+ * (set `"allowUnauthenticatedRequests" : true`) this to support multiple
103
+ * authentication methods or support both authenticated and anonymous requests.
104
+ *
105
+ * @deprecated Please use the new {@link https://zuplo.com/docs/policies/api-key-inbound|API Key Authentication} policy
106
+ * instead. This policy will continue to work but will be removed in a future
107
+ * version of Zuplo.
108
+ * @hidden
109
+ * @title API Key Authentication
110
+ * @public
111
+ * @param request - The ZuploRequest
112
+ * @param context - The ZuploContext
113
+ * @param unparsedOptions - The policy options set in policies.json
114
+ * @param policyName - The name of the policy as set in policies.json
115
+ * @returns A Request or a Response
116
+ */
117
+ export declare const ApiAuthKeyInboundPolicy: typeof ApiKeyInboundPolicy;
118
+
119
+ /**
120
+ * @deprecated
121
+ * The options for this policy.
122
+ */
123
+ export declare interface ApiAuthKeyInboundPolicyOptions {
124
+ /**
125
+ * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401.
126
+ */
127
+ allowUnauthenticatedRequests?: boolean;
128
+ }
129
+
130
+ /**
131
+ * Authenticates requests based on API Keys using Zuplo API Management. You can learn more about the Zuplo API Key Service [here](https://zuplo.com/docs/articles/api-key-api#buckets)
132
+ *
133
+ * @remarks
134
+ * Authenticate requests with Zuplo's fully managed API Key service. This policy is
135
+ * the easiest way to secure your API and can be combined with other policies like
136
+ * Rate limiting, quotas, and more to build a fully featured API to support your
137
+ * partners, developers, or customers.
138
+ *
139
+ * For more information on Zuplo's API Key Management service and options enabling
140
+ * self-serve API Key management see the following resources:
141
+ *
142
+ * - {@link https://zuplo.com/docs/articles/api-key-management|API Key Authentication Overview}
143
+ * - {@link https://zuplo.com/docs/articles/api-key-api|API Key Management API}
144
+ *
145
+ * @title API Key Authentication
146
+ * @public
147
+ * @param request - The ZuploRequest
148
+ * @param context - The ZuploContext
149
+ * @param unparsedOptions - The policy options set in policies.json
150
+ * @param policyName - The name of the policy as set in policies.json
151
+ * @returns A Request or a Response
152
+ */
153
+ export declare function ApiKeyInboundPolicy(
154
+ request: ZuploRequest,
155
+ context: ZuploContext,
156
+ unparsedOptions: ApiKeyInboundPolicyOptions,
157
+ policyName: string
158
+ ): Promise<ZuploRequest<RequestGeneric> | Response>;
159
+
160
+ /**
161
+ * The options for this policy.
162
+ */
163
+ export declare interface ApiKeyInboundPolicyOptions {
164
+ /**
165
+ * The name of the header with the key.
166
+ */
167
+ authHeader?: string;
168
+ /**
169
+ * The scheme used on the header.
170
+ */
171
+ authScheme?: string;
172
+ /**
173
+ * The name of the API Key service bucket. Defaults to the autogenerated bucket name for your project.
174
+ */
175
+ bucketName?: string;
176
+ /**
177
+ * If requests should proceed even if the policy does not successfully authenticate the request. Defaults to false and rejects any request without a valid API key (returning a `401 - Unauthorized` response). Set to `true` to support multiple authentication methods or support both authenticated and anonymous requests.
178
+ */
179
+ allowUnauthenticatedRequests?: boolean;
180
+ /**
181
+ * The time to cache authentication results for a particular key. Higher values will decrease latency. Cached results will be valid until the cache expires even in the event the key is deleted, etc.
182
+ */
183
+ cacheTtlSeconds?: number;
184
+ /**
185
+ * Zuplo will automatically document your API key header within your OpenAPI specification & Developer Portal. Set this to `true` to disable this behavior.
186
+ */
187
+ disableAutomaticallyAddingKeyHeaderToOpenApi?: boolean;
188
+ }
189
+
190
+ /* Excluded from this release type: ApiKeyValidationResult */
191
+
192
+ export declare interface AuditLogDataStaxInit {
193
+ url: string;
194
+ xCassandraToken: string;
195
+ }
196
+
197
+ export declare class AuditLogDataStaxProvider
198
+ implements AuditLogOutputProvider
199
+ {
200
+ #private;
201
+ constructor(options: AuditLogDataStaxInit);
202
+ writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
203
+ }
204
+
205
+ declare interface AuditLogEntry {
206
+ timestamp: Date;
207
+ durationMs: number;
208
+ routePath: string;
209
+ requestId: string;
210
+ userSub?: string;
211
+ request: {
212
+ url: string;
213
+ method: HttpMethod;
214
+ headers?: Record<string, string>;
215
+ body?: string;
216
+ };
217
+ response: {
218
+ status: number;
219
+ statusText: string;
220
+ headers?: Record<string, string>;
221
+ body?: string;
222
+ };
223
+ }
224
+
225
+ export declare interface AuditLogInit {
226
+ requestFilter?: AuditLogRequestFilter;
227
+ include?: {
228
+ request?: {
229
+ headers?: boolean;
230
+ body?: boolean;
231
+ };
232
+ response?: {
233
+ headers?: boolean;
234
+ body?: boolean;
235
+ };
236
+ };
237
+ }
238
+
239
+ declare interface AuditLogOutputProvider {
240
+ writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
241
+ }
242
+
243
+ export declare class AuditLogPlugin extends SystemRuntimePlugin {
244
+ #private;
245
+ constructor(outputProvider: AuditLogOutputProvider, init?: AuditLogInit);
246
+ initialize(runtimeInit: RuntimeExtensions): Promise<void>;
247
+ }
248
+
249
+ declare interface AuditLogRequestFilter {
250
+ (request: ZuploRequest, context: ZuploContext): Promise<boolean>;
251
+ }
252
+
253
+ /**
254
+ * Authenticate users using Auth0 issued JWT tokens.
255
+ *
256
+ * @remarks
257
+ * Authenticate requests with JWT tokens issued by Auth0. This is a customized
258
+ * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
259
+ * for Auth0.
260
+ *
261
+ * @title Auth0 JWT Auth
262
+ * @public
263
+ * @param request - The ZuploRequest
264
+ * @param context - The ZuploContext
265
+ * @param options - The policy options set in policies.json
266
+ * @param policyName - The name of the policy as set in policies.json
267
+ * @returns A Request or a Response
268
+ */
269
+ export declare const Auth0JwtInboundPolicy: InboundPolicyHandler<Auth0JwtInboundPolicyOptions>;
270
+
271
+ /**
272
+ * The options for this policy.
273
+ */
274
+ export declare interface Auth0JwtInboundPolicyOptions {
275
+ /**
276
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
277
+ */
278
+ allowUnauthenticatedRequests?: boolean;
279
+ /**
280
+ * Your Auth0 domain. For example, `my-company.auth0.com`.
281
+ */
282
+ auth0Domain: string;
283
+ /**
284
+ * The Auth0 audience of your API, for example `https://api.example.com/`.
285
+ */
286
+ audience?: string;
287
+ }
288
+
289
+ declare interface AwsLambdaEventV1 {
290
+ [key: string]: string | null | undefined | number | boolean | object;
291
+ version: "1.0";
292
+ resource: string;
293
+ path: string;
294
+ httpMethod: string;
295
+ headers: Record<string, string>;
296
+ multiValueHeaders: Record<string, string[]>;
297
+ queryStringParameters: Record<string, string>;
298
+ multiValueQueryStringParameters: Record<string, string[]>;
299
+ requestContext: {
300
+ accountId: string | null;
301
+ apiId: string | null;
302
+ authorizer: {
303
+ claims: Record<string, string>;
304
+ scopes: string[];
305
+ };
306
+ domainName: string;
307
+ domainPrefix: string | null;
308
+ extendedRequestId: string;
309
+ httpMethod: string;
310
+ identity: {
311
+ accessKey: null | string;
312
+ accountId: null | string;
313
+ caller: null | string;
314
+ cognitoAuthenticationProvider: null | string;
315
+ cognitoAuthenticationType: null | string;
316
+ cognitoIdentityId: null | string;
317
+ cognitoIdentityPoolId: null | string;
318
+ principalOrgId: null | string;
319
+ sourceIp: string | null;
320
+ user: null | string;
321
+ userAgent: string | null;
322
+ userArn: null | string;
323
+ clientCert: {
324
+ clientCertPem: null | string;
325
+ subjectDN: null | string;
326
+ issuerDN: null | string;
327
+ serialNumber: null | string;
328
+ validity: {
329
+ notBefore: null | string;
330
+ notAfter: null | string;
331
+ };
332
+ };
333
+ };
334
+ path: string;
335
+ protocol: string;
336
+ requestId: string;
337
+ requestTime: string;
338
+ requestTimeEpoch: number;
339
+ resourceId: string | null;
340
+ resourcePath: string;
341
+ stage: null | string;
342
+ };
343
+ pathParameters: Record<string, string>;
344
+ stageVariables: null | Record<string, string>;
345
+ }
346
+
347
+ declare interface AwsLambdaEventV2 {
348
+ [key: string]: string | null | undefined | number | boolean | object;
349
+ version: "2.0";
350
+ routeKey: string | null;
351
+ rawPath: string;
352
+ rawQueryString: string;
353
+ cookies: string[];
354
+ headers: Record<string, string>;
355
+ queryStringParameters: Record<string, string>;
356
+ requestContext: {
357
+ accountId: string | null;
358
+ apiId: string | null;
359
+ authentication: {
360
+ clientCert: {
361
+ clientCertPem: string | null;
362
+ subjectDN: string | null;
363
+ issuerDN: string | null;
364
+ serialNumber: string | null;
365
+ validity: {
366
+ notBefore: string | null;
367
+ notAfter: string | null;
368
+ };
369
+ };
370
+ };
371
+ authorizer: {
372
+ jwt: {
373
+ claims: Record<string, string>;
374
+ scopes: string[];
375
+ };
376
+ };
377
+ domainName: string | null;
378
+ domainPrefix: string | null;
379
+ http: {
380
+ method: string;
381
+ path: string;
382
+ protocol: string;
383
+ sourceIp: string | null;
384
+ userAgent: string | null;
385
+ };
386
+ requestId: string;
387
+ routeKey: string | null;
388
+ stage: null;
389
+ time: string;
390
+ timeEpoch: number;
391
+ };
392
+ pathParameters: Record<string, string>;
393
+ stageVariables: string | null;
394
+ }
395
+
396
+ /* Excluded from this release type: awsLambdaHandler */
397
+
398
+ export declare const AwsLambdaHandlerExtensions: {
399
+ addSendingAwsLambdaEventHook: (hook: OnSendingAwsLambdaEventHook) => void;
400
+ };
401
+
402
+ declare interface AWSLoggingOptions {
403
+ region: string;
404
+ accessKeyId: string;
405
+ secretAccessKey: string;
406
+ logGroupName: string;
407
+ logStreamName: string;
408
+ }
409
+
410
+ export declare class AWSLoggingPlugin extends LogPlugin {
411
+ private options;
412
+ constructor(options: AWSLoggingOptions);
413
+ getTransport(): LogTransport;
414
+ }
415
+
416
+ export declare class BackgroundDispatcher<TPayload> {
417
+ #private;
418
+ constructor(
419
+ dispatcher: DispatchFunction<TPayload>,
420
+ options: BatchDispatcherOptions
421
+ );
422
+ enqueue: (payload: TPayload) => void;
423
+ }
424
+
425
+ export declare class BackgroundLoader<T = unknown> {
426
+ #private;
427
+ constructor(loader: BackgroundLoaderFunction<T>, ttlSeconds: number);
428
+ get(key: string): Promise<T>;
429
+ }
430
+
431
+ declare interface BackgroundLoaderFunction<T> {
432
+ (key: string): Promise<T>;
433
+ }
434
+
435
+ /* Excluded from this release type: BaseCryptoBeta */
436
+
437
+ /* Excluded from this release type: BaseKeyValueStore */
438
+
439
+ /**
440
+ * An account object.
441
+ */
442
+ declare interface BasicAuthAccount {
443
+ /**
444
+ * The username for the account (this will be the `sub` property on `request.user`.
445
+ */
446
+ username: string;
447
+ /**
448
+ * The password for the account - note we recommend storing this in environment variables.
449
+ */
450
+ password: string;
451
+ /**
452
+ * The data payload you want associated with this account (this will be the `data` property on `request.user`).
453
+ */
454
+ data?: {
455
+ [k: string]: unknown;
456
+ };
457
+ }
458
+
459
+ /**
460
+ * Authenticate requests using basic auth (i.e. username and password)
461
+ *
462
+ * @remarks
463
+ * The Basic Authentication policy allows you to authenticate incoming requests
464
+ * using the Basic authentication standard. You can configure multiple accounts
465
+ * with different passwords and a different bucket of user 'data'.
466
+ *
467
+ * The API will expect a Basic Auth header (you can generate samples
468
+ * {@link https://www.debugbear.com/basic-auth-header-generator|here}). Requests with
469
+ * invalid credentials (or no header) will not be authenticated. Authenticated
470
+ * requests will populate the `user` property of the `ZuploRequest` parameter on
471
+ * your RequestHandler.
472
+ *
473
+ * @title Basic Auth
474
+ * @public
475
+ * @param request - The ZuploRequest
476
+ * @param context - The ZuploContext
477
+ * @param options - The policy options set in policies.json
478
+ * @param policyName - The name of the policy as set in policies.json
479
+ * @returns A Request or a Response
480
+ */
481
+ export declare const BasicAuthInboundPolicy: InboundPolicyHandler<BasicAuthInboundPolicyOptions>;
482
+
483
+ /**
484
+ * The options for this policy.
485
+ */
486
+ export declare interface BasicAuthInboundPolicyOptions {
487
+ /**
488
+ * An array of account objects (username, password and data properties).
489
+ */
490
+ accounts: BasicAuthAccount[];
491
+ /**
492
+ * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401.
493
+ */
494
+ allowUnauthenticatedRequests?: boolean;
495
+ }
496
+
497
+ /* Excluded from this release type: BatchDispatch */
498
+
499
+ declare interface BatchDispatcherOptions {
500
+ msDelay: number;
501
+ name?: string;
502
+ }
503
+
504
+ /* Excluded from this release type: BuildEnvironment */
505
+
506
+ declare interface BuildRouteConfiguration {
507
+ path: string;
508
+ methods: HttpMethod[];
509
+ /**
510
+ /* @deprecated This property is not used and will be removed in future versions
511
+ */
512
+ label?: string;
513
+ /**
514
+ /* @deprecated This property is not used and will be removed in future versions
515
+ */
516
+ key?: string;
517
+ handler: HandlerDefinition;
518
+ corsPolicy?: CorsPolicy;
519
+ /**
520
+ /* @deprecated This property is deprecated. Use route.raw() instead.
521
+ */
522
+ custom?: any;
523
+ /**
524
+ /* @deprecated This property is not used and will be removed in future versions
525
+ */
526
+ version: string;
527
+ policies?: {
528
+ inbound?: string[];
529
+ outbound?: string[];
530
+ };
531
+ /**
532
+ /* @deprecated This property is deprecated. Use route.raw() instead.
533
+ */
534
+ excludeFromOpenApi?: boolean;
535
+ pathPattern?: string;
536
+ /* Excluded from this release type: raw */
537
+ }
538
+
539
+ /**
540
+ * Internal
541
+ */
542
+ declare interface CacheOptions {
543
+ logger?: Logger;
544
+ }
545
+
546
+ /**
547
+ * Respond to matched incoming requests with cached content
548
+ *
549
+ * @title Caching
550
+ * @public
551
+ * @param request - The ZuploRequest
552
+ * @param context - The ZuploContext
553
+ * @param options - The policy options set in policies.json
554
+ * @param policyName - The name of the policy as set in policies.json
555
+ * @returns A Request or a Response
556
+ */
557
+ export declare function CachingInboundPolicy(
558
+ request: ZuploRequest,
559
+ context: ZuploContext,
560
+ options: CachingInboundPolicyOptions,
561
+ policyName: string
562
+ ): Promise<ZuploRequest<RequestGeneric> | Response>;
563
+
564
+ /**
565
+ * The options for this policy.
566
+ */
567
+ export declare interface CachingInboundPolicyOptions {
568
+ /**
569
+ * Specifies an id or 'key' for this policy to store cache. This is useful for cache-busting. For example, set this property to an env var and if you change that env var value, you invalidate the cache.
570
+ */
571
+ cacheId?: string;
572
+ /**
573
+ * By default, the Authorization header is always considered in the caching policy. You can disable by setting this to `true`.
574
+ */
575
+ dangerouslyIgnoreAuthorizationHeader?: boolean;
576
+ /**
577
+ * The headers to be considered when caching.
578
+ */
579
+ headers?: string[];
580
+ /**
581
+ * HTTP Methods to be cached. Valid methods are: GET, POST, PUT, PATCH, DELETE, HEAD.
582
+ */
583
+ cacheHttpMethods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD")[];
584
+ /**
585
+ * The timeout of the cache in seconds.
586
+ */
587
+ expirationSecondsTtl?: number;
588
+ /**
589
+ * Response status codes to be cached.
590
+ */
591
+ statusCodes?: number[];
592
+ }
593
+
594
+ /**
595
+ * Changes the HTTP method of the incoming request.
596
+ *
597
+ * @title Change Method
598
+ * @public
599
+ * @param request - The ZuploRequest
600
+ * @param context - The ZuploContext
601
+ * @param options - The policy options set in policies.json
602
+ * @param policyName - The name of the policy as set in policies.json
603
+ * @returns A Request or a Response
604
+ */
605
+ export declare const ChangeMethodInboundPolicy: InboundPolicyHandler<ChangeMethodInboundPolicyOptions>;
606
+
607
+ /**
608
+ * The options for this policy.
609
+ */
610
+ export declare interface ChangeMethodInboundPolicyOptions {
611
+ /**
612
+ * The HTTP Method to be used, e.g. POST, GET, PUT, PATCH, etc.
613
+ */
614
+ method: string;
615
+ }
616
+
617
+ /**
618
+ * Removes all headers from the incoming request except for those in the exclude list.
619
+ *
620
+ * @title Clear Request Headers
621
+ * @public
622
+ * @param request - The ZuploRequest
623
+ * @param context - The ZuploContext
624
+ * @param options - The policy options set in policies.json
625
+ * @param policyName - The name of the policy as set in policies.json
626
+ * @returns A Request or a Response
627
+ */
628
+ export declare const ClearHeadersInboundPolicy: InboundPolicyHandler<ClearHeadersInboundPolicyOptions>;
629
+
630
+ /**
631
+ * The options for this policy.
632
+ */
633
+ export declare interface ClearHeadersInboundPolicyOptions {
634
+ /**
635
+ * The headers that should not be removed.
636
+ */
637
+ exclude?: string[];
638
+ }
639
+
640
+ /**
641
+ * Removes all headers from the response except for those in the exclude list.
642
+ *
643
+ * @title Clear Response Headers
644
+ * @public
645
+ * @param request - The ZuploRequest
646
+ * @param context - The ZuploContext
647
+ * @param options - The policy options set in policies.json
648
+ * @param policyName - The name of the policy as set in policies.json
649
+ * @returns A Request or a Response
650
+ */
651
+ export declare const ClearHeadersOutboundPolicy: OutboundPolicyHandler<ClearHeadersOutboundPolicyOptions>;
652
+
653
+ /**
654
+ * The options for this policy.
655
+ */
656
+ export declare interface ClearHeadersOutboundPolicyOptions {
657
+ /**
658
+ * The headers that should not be removed.
659
+ */
660
+ exclude?: string[];
661
+ }
662
+
663
+ /**
664
+ * Authenticate users using Clerk issued JWT tokens.
665
+ *
666
+ * @remarks
667
+ * Authenticate requests with JWT tokens issued by Clerk. This is a customized
668
+ * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
669
+ * for Clerk.
670
+ *
671
+ * @title Clerk JWT Auth
672
+ * @public
673
+ * @param request - The ZuploRequest
674
+ * @param context - The ZuploContext
675
+ * @param options - The policy options set in policies.json
676
+ * @param policyName - The name of the policy as set in policies.json
677
+ * @returns A Request or a Response
678
+ */
679
+ export declare const ClerkJwtInboundPolicy: InboundPolicyHandler<ClerkJwtInboundPolicyOptions>;
680
+
681
+ /**
682
+ * The options for this policy.
683
+ */
684
+ export declare interface ClerkJwtInboundPolicyOptions {
685
+ /**
686
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
687
+ */
688
+ allowUnauthenticatedRequests?: boolean;
689
+ /**
690
+ * Your Clerk frontend api url, i.e. `https://sensible-skunk-49.clerk.accounts.dev`. Can be found in the Clerk portal: https://dashboard.clerk.com/last-active?path=api-keys.
691
+ */
692
+ frontendApiUrl: string;
693
+ }
694
+
695
+ /**
696
+ * Authenticate requests with JWT tokens issued by AWS Cognito.
697
+ *
698
+ * @remarks
699
+ * Authenticate requests with JWT tokens issued by AWS Cognito. This is a
700
+ * customized version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy}
701
+ * specifically for AWS Cognito.
702
+ *
703
+ * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
704
+ * about OAuth authorization in Zuplo.
705
+ *
706
+ * @title AWS Cognito JWT Auth
707
+ * @public
708
+ * @param request - The ZuploRequest
709
+ * @param context - The ZuploContext
710
+ * @param options - The policy options set in policies.json
711
+ * @param policyName - The name of the policy as set in policies.json
712
+ * @returns A Request or a Response
713
+ */
714
+ export declare const CognitoJwtInboundPolicy: InboundPolicyHandler<CognitoJwtInboundPolicyOptions>;
715
+
716
+ /**
717
+ * The options for this policy.
718
+ */
719
+ export declare interface CognitoJwtInboundPolicyOptions {
720
+ /**
721
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
722
+ */
723
+ allowUnauthenticatedRequests?: boolean;
724
+ /**
725
+ * The AWS region where your Cognito instance is deployed.
726
+ */
727
+ region: string;
728
+ /**
729
+ * The user pool identifier.
730
+ */
731
+ userPoolId: string;
732
+ }
733
+
734
+ /**
735
+ * The compatibility date on which to run the gateway
736
+ */
737
+ declare type CompatibilityDate = "2023-03-14" | "2024-01-15";
738
+
739
+ declare interface CompatibilityFlags {
740
+ /**
741
+ * Whether or not outbound policies should run if the response from the
742
+ * handlers is not `response.ok`
743
+ *
744
+ * @compatibilityDate 2024-01-15
745
+ */
746
+ runOutboundPoliciesOnHandlerOnAllStatuses: boolean;
747
+ /**
748
+ * Whether or not hooks run on system routes
749
+ *
750
+ * @compatibilityDate 2024-01-15
751
+ */
752
+ doNotRunHooksOnSystemRoutes: boolean;
753
+ /**
754
+ * Remove all vendor (cf-, zp-) headers except for the specific
755
+ * list of allowed headers
756
+ *
757
+ * @compatibilityDate 2024-01-15
758
+ */
759
+ removeAllVendorHeadersExceptListed: boolean;
760
+ }
761
+
762
+ /**
763
+ * Creates a composite, or group policy - composed of other policies. For reuse across routes.
764
+ *
765
+ * @remarks
766
+ * The Composite policy allows you to create groups of other policies, for easy
767
+ * reuse across multiple routes. Other policies are referenced by their `name`.
768
+ *
769
+ * Be careful not to create circular references which can cause your gateway to
770
+ * fail.
771
+ *
772
+ * @title Composite Inbound (Group Policies)
773
+ * @public
774
+ * @param request - The ZuploRequest
775
+ * @param context - The ZuploContext
776
+ * @param options - The policy options set in policies.json
777
+ * @param policyName - The name of the policy as set in policies.json
778
+ * @returns A Request or a Response
779
+ */
780
+ export declare const CompositeInboundPolicy: InboundPolicyHandler<CompositeInboundPolicyOptions>;
781
+
782
+ /**
783
+ * The options for this policy.
784
+ */
785
+ export declare interface CompositeInboundPolicyOptions {
786
+ /**
787
+ * The list of policy references (beware circular references).
788
+ */
789
+ policies?: string[];
790
+ }
791
+
792
+ /**
793
+ * Errors caused by invalid user configuration -i.e. invalid parameters on policies,
794
+ * handlers that are not functions, etc. This is not for zuplo system configuration errors,
795
+ * use SystemError for that.
796
+ * @public
797
+ */
798
+ export declare class ConfigurationError extends RuntimeError {
799
+ constructor(message: string, options?: ErrorOptions);
800
+ }
801
+
802
+ /* Excluded from this release type: ContentTypes */
803
+
804
+ /**
805
+ * Utility for storing data across the lifecycle of a request. This class is
806
+ * useful for storing and retrieving data that is shared between policies.
807
+ *
808
+ * @public
809
+ *
810
+ * @example
811
+ * Using static methods
812
+ * ```
813
+ * ContextData.set(context, "my-data", { prop1: "hello world" });
814
+ *
815
+ * const data = ContextData.get(context, "my-data");
816
+ * ContextData.set(context, data);
817
+ * ```
818
+ *
819
+ * @example
820
+ * Reusable class shared across modules
821
+ *
822
+ * The shared module allows other modules to access the same storage without
823
+ * passing the string name or type around.
824
+ *
825
+ * ```
826
+ * export const myData =
827
+ * new ContextData<{ prop1: string }>("my-data");
828
+ * ```
829
+ *
830
+ * Then use the class in another module.
831
+ *
832
+ * ```
833
+ * import { myData } from "./my-module";
834
+ *
835
+ *
836
+ * const data = myData.get(context)
837
+ * myData.set(context, data);
838
+ *
839
+ * ```
840
+ */
841
+ export declare class ContextData<T = any> {
842
+ #private;
843
+ constructor(name: string);
844
+ set(context: ZuploContext, data: T): void;
845
+ get(context: ZuploContext): T | undefined;
846
+ static set<T = any>(context: ZuploContext, name: string, data: T): void;
847
+ static get<T = any>(context: ZuploContext, name: string): T | undefined;
848
+ }
849
+
850
+ /** The 2-letter continent codes Cloudflare uses */
851
+ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
852
+
853
+ export declare type CorsPolicy = string | "anything-goes" | "none";
854
+
855
+ export declare interface CorsPolicyConfiguration {
856
+ name: string;
857
+ allowCredentials?: boolean;
858
+ maxAge?: number;
859
+ allowedOrigins: string[] | string;
860
+ allowedMethods?: HttpMethod[] | string;
861
+ allowedHeaders?: string[] | string;
862
+ exposeHeaders?: string[] | string;
863
+ }
864
+
865
+ /* Excluded from this release type: CryptoBeta */
866
+
867
+ /**
868
+ * Authenticate users using the Curity Phantom Token Pattern.
869
+ *
870
+ * @remarks
871
+ * Authenticate requests with Phantom Tokens issued by Curity. The payload of the
872
+ * Phantom JWT token, if successfully authenticated, with be on the
873
+ * `request.user.data` object accessible to the runtime.
874
+ *
875
+ * @title Curity Phantom Token Auth
876
+ * @public
877
+ * @param request - The ZuploRequest
878
+ * @param context - The ZuploContext
879
+ * @param options - The policy options set in policies.json
880
+ * @param policyName - The name of the policy as set in policies.json
881
+ * @returns A Request or a Response
882
+ */
883
+ export declare const CurityPhantomTokenInboundPolicy: InboundPolicyHandler<CurityPhantomTokenInboundPolicyOptions>;
884
+
885
+ /**
886
+ * The options for this policy.
887
+ */
888
+ export declare interface CurityPhantomTokenInboundPolicyOptions {
889
+ /**
890
+ * The client ID of the Curity application.
891
+ */
892
+ clientId: string;
893
+ /**
894
+ * The client secret of the Curity application.
895
+ */
896
+ clientSecret: string;
897
+ /**
898
+ * The introspection URL of the Curity application.
899
+ */
900
+ introspectionUrl: string;
901
+ /**
902
+ * The duration in seconds to cache the introspected response.
903
+ */
904
+ cacheDurationSeconds?: number;
905
+ }
906
+
907
+ /* Excluded from this release type: CustomRateLimitDetails */
908
+
909
+ declare interface DataDogLoggingOptions {
910
+ url?: string;
911
+ apiKey: string;
912
+ }
913
+
914
+ export declare class DataDogLoggingPlugin extends LogPlugin {
915
+ private options;
916
+ constructor(options: DataDogLoggingOptions);
917
+ /* Excluded from this release type: getTransport */
918
+ }
919
+
920
+ declare interface DataDogMetricsContext {
921
+ tags: string[];
922
+ }
923
+
924
+ declare interface DataDogMetricsOptions {
925
+ url?: string;
926
+ apiKey: string;
927
+ tags?: string[];
928
+ metrics?: MetricsType;
929
+ include?: IncludeMetrics;
930
+ }
931
+
932
+ export declare class DataDogMetricsPlugin extends MetricsPlugin {
933
+ private options;
934
+ constructor(options: DataDogMetricsOptions);
935
+ getTransport(): MetricsTransport;
936
+ static setContext(context: ZuploContext, data: DataDogMetricsContext): void;
937
+ }
938
+
939
+ export declare interface DevPortalRuntimeConfig {
940
+ enabled: boolean;
941
+ sitePathname: string;
942
+ }
943
+
944
+ /* Excluded from this release type: DispatchFunction */
945
+
946
+ declare interface DynaTraceLoggingOptions {
947
+ url: string;
948
+ apiToken: string;
949
+ }
950
+
951
+ export declare class DynaTraceLoggingPlugin extends LogPlugin {
952
+ private options;
953
+ constructor(options: DynaTraceLoggingOptions);
954
+ /* Excluded from this release type: getTransport */
955
+ }
956
+
957
+ declare interface DynatraceMetricsContext {
958
+ dimensions: string[];
959
+ }
960
+
961
+ declare interface DynatraceMetricsOptions {
962
+ url: string;
963
+ apiToken: string;
964
+ dimensions?: string[];
965
+ metrics?: MetricsType;
966
+ include?: IncludeMetrics;
967
+ }
968
+
969
+ export declare class DynatraceMetricsPlugin extends MetricsPlugin {
970
+ private options;
971
+ constructor(options: DynatraceMetricsOptions);
972
+ getTransport(): MetricsTransport;
973
+ static setContext(context: ZuploContext, data: DynatraceMetricsContext): void;
974
+ }
975
+
976
+ /* Excluded from this release type: environment */
977
+
978
+ /* Excluded from this release type: ErrorHandler */
979
+
980
+ /* Excluded from this release type: ErrorObject */
981
+
982
+ /**
983
+ * Authenticate users using Firebase issued JWT tokens.
984
+ *
985
+ * @remarks
986
+ * Authenticate requests with JWT tokens issued by Firebase. The payload of the JWT
987
+ * token, if successfully authenticated, with be on the `request.user.data` object
988
+ * accessible to the runtime.
989
+ *
990
+ * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
991
+ * about OAuth authorization in Zuplo.
992
+ *
993
+ * @title Firebase JWT Auth
994
+ * @public
995
+ * @param request - The ZuploRequest
996
+ * @param context - The ZuploContext
997
+ * @param options - The policy options set in policies.json
998
+ * @param policyName - The name of the policy as set in policies.json
999
+ * @returns A Request or a Response
1000
+ */
1001
+ export declare const FirebaseJwtInboundPolicy: InboundPolicyHandler<FirebaseJwtInboundPolicyOptions>;
1002
+
1003
+ /**
1004
+ * The options for this policy.
1005
+ */
1006
+ export declare interface FirebaseJwtInboundPolicyOptions {
1007
+ /**
1008
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
1009
+ */
1010
+ allowUnauthenticatedRequests?: boolean;
1011
+ /**
1012
+ * Your Firebase Project ID.
1013
+ */
1014
+ projectId: string;
1015
+ }
1016
+
1017
+ /**
1018
+ * Converts form data in the incoming request to JSON.
1019
+ *
1020
+ * @title Form Data to JSON
1021
+ * @public
1022
+ * @param request - The ZuploRequest
1023
+ * @param context - The ZuploContext
1024
+ * @param options - The policy options set in policies.json
1025
+ * @param policyName - The name of the policy as set in policies.json
1026
+ * @returns A Request or a Response
1027
+ */
1028
+ export declare const FormDataToJsonInboundPolicy: InboundPolicyHandler<FormDataToJsonInboundPolicyOptions>;
1029
+
1030
+ /**
1031
+ * The options for this policy.
1032
+ */
1033
+ export declare interface FormDataToJsonInboundPolicyOptions {
1034
+ /**
1035
+ * Should the policy return an error if the request is not of the type form data.
1036
+ */
1037
+ badRequestIfNotFormData?: boolean;
1038
+ /**
1039
+ * The name of the honeypot field. Used to provide basic spam filtering.
1040
+ */
1041
+ optionalHoneypotName?: string;
1042
+ }
1043
+
1044
+ /* Excluded from this release type: Gateway */
1045
+
1046
+ /**
1047
+ * Block requests based on geo-location parameters: country, region code, and ASN
1048
+ *
1049
+ * @title Geo-location filtering
1050
+ * @public
1051
+ * @param request - The ZuploRequest
1052
+ * @param context - The ZuploContext
1053
+ * @param options - The policy options set in policies.json
1054
+ * @param policyName - The name of the policy as set in policies.json
1055
+ * @returns A Request or a Response
1056
+ */
1057
+ export declare const GeoFilterInboundPolicy: InboundPolicyHandler<GeoFilterInboundPolicyOptions>;
1058
+
1059
+ /**
1060
+ * The options for this policy.
1061
+ */
1062
+ export declare interface GeoFilterInboundPolicyOptions {
1063
+ block?: GeoSpec;
1064
+ allow?: GeoSpec;
1065
+ /**
1066
+ * Specifies whether unknown geo-location parameters should be ignored (allowed through).
1067
+ */
1068
+ ignoreUnknown?: boolean;
1069
+ }
1070
+
1071
+ declare interface GeoSpec {
1072
+ /**
1073
+ * comma separated string of country codes to allow (e.g. "US, CA").
1074
+ */
1075
+ countries?: string;
1076
+ /**
1077
+ * comma separated string of region codes to allow (e.g. "TX, WA").
1078
+ */
1079
+ regionCodes?: string;
1080
+ /**
1081
+ * comma separated string of ASNs to allow (e.g. "395747, 28304").
1082
+ */
1083
+ asns?: string;
1084
+ }
1085
+
1086
+ export declare function getIdForParameterSchema(
1087
+ path: string,
1088
+ operation: string,
1089
+ type: string,
1090
+ name: string
1091
+ ): string;
1092
+
1093
+ export declare function getIdForRefSchema(
1094
+ oasFileName: string,
1095
+ ref: string
1096
+ ): string;
1097
+
1098
+ export declare function getIdForRequestBodySchema(
1099
+ path: string,
1100
+ operation: string,
1101
+ contentType: string
1102
+ ): string;
1103
+
1104
+ export declare function getRawOperationDataIdentifierName(
1105
+ oasFileName: string,
1106
+ path: string,
1107
+ operation: string
1108
+ ): string;
1109
+
1110
+ declare interface GoogleCloudLoggingOptions {
1111
+ serviceAccountJson: string;
1112
+ logName: string;
1113
+ }
1114
+
1115
+ export declare class GoogleCloudLoggingPlugin extends LogPlugin {
1116
+ private options;
1117
+ constructor(options: GoogleCloudLoggingOptions);
1118
+ /* Excluded from this release type: getTransport */
1119
+ }
1120
+
1121
+ /* Excluded from this release type: Handler */
1122
+
1123
+ export declare interface HandlerDefinition {
1124
+ module: any;
1125
+ export: string;
1126
+ options?: unknown;
1127
+ }
1128
+
1129
+ export declare type HttpMethod =
1130
+ | "GET"
1131
+ | "HEAD"
1132
+ | "POST"
1133
+ | "PUT"
1134
+ | "DELETE"
1135
+ | "CONNECT"
1136
+ | "OPTIONS"
1137
+ | "TRACE"
1138
+ | "PATCH";
1139
+
1140
+ /* Excluded from this release type: HttpProblems */
1141
+
1142
+ declare class HttpProblemsBase {
1143
+ /**
1144
+ * Creates a Response in the standard format from a problem detail
1145
+ * @param details - The details of the problem
1146
+ * @param request - The ZuploRequest object
1147
+ * @param context - The ZuploContext object
1148
+ * @returns A HTTP Response promise
1149
+ */
1150
+ static format: (
1151
+ details: ProblemDetails | ProblemResponseDetails,
1152
+ request: ZuploRequest,
1153
+ context: ZuploContext
1154
+ ) => Promise<Response>;
1155
+ /**
1156
+ * Creates a problem from the status code
1157
+ */
1158
+ static getProblemFromStatus(
1159
+ status: HttpStatusCode,
1160
+ problem?: Partial<Omit<ProblemDetails, "status" | "title">>
1161
+ ): ProblemDetails;
1162
+ }
1163
+
1164
+ /* Excluded from this release type: HttpStatusCode */
1165
+
1166
+ declare type HttpStatusCodeRangeDefinition =
1167
+ | "1XX"
1168
+ | "2XX"
1169
+ | "3XX"
1170
+ | "4XX"
1171
+ | "5XX";
1172
+
1173
+ /* Excluded from this release type: httpStatuses */
1174
+
1175
+ /* Excluded from this release type: InboundPolicy */
1176
+
1177
+ /**
1178
+ * @public
1179
+ * A policy that can modify the incoming HTTP request before it is sent to
1180
+ * the handler. If a response is returned, the request is short-circuited and
1181
+ * the response is returned to the client. If a Request is returned, policies
1182
+ * or a handler that follow are executed.
1183
+ *
1184
+ * @param request - The incoming Request
1185
+ * @param context - The current context of the Request
1186
+ * @param options - The configuration options for the policy
1187
+ * @param policyName - The name set on the policy in the configuration
1188
+ * @returns A Response or Request object
1189
+ */
1190
+ export declare interface InboundPolicyHandler<TOptions = any> {
1191
+ (
1192
+ request: ZuploRequest,
1193
+ context: ZuploContext,
1194
+ options: TOptions,
1195
+ policyName: string
1196
+ ): Promise<ZuploRequest | Response>;
1197
+ }
1198
+
1199
+ declare interface IncludeMetrics {
1200
+ country?: boolean;
1201
+ httpMethod?: boolean;
1202
+ statusCode?: boolean;
1203
+ path?: boolean;
1204
+ }
1205
+
1206
+ declare interface IncomingRequestProperties {
1207
+ /**
1208
+ * ASN of the incoming request, for example, 395747.
1209
+ */
1210
+ readonly asn: number | undefined;
1211
+ /**
1212
+ * The organization which owns the ASN of the incoming request,
1213
+ * for example, Google Cloud.
1214
+ */
1215
+ readonly asOrganization: string | undefined;
1216
+ /**
1217
+ * City of the incoming request, for example, "Austin".
1218
+ */
1219
+ readonly city: string | undefined;
1220
+ /**
1221
+ * Continent of the incoming request, for example, "NA".
1222
+ */
1223
+ readonly continent: ContinentCode | undefined;
1224
+ /**
1225
+ * The two-letter country code in the request.
1226
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2|ISO 3166-1 alpha-2}
1227
+ */
1228
+ readonly country: Iso3166Alpha2Code | undefined;
1229
+ /**
1230
+ * Latitude of the incoming request, for example, "30.27130".
1231
+ */
1232
+ readonly latitude: string | undefined;
1233
+ /**
1234
+ * Longitude of the incoming request, for example, "-97.74260".
1235
+ */
1236
+ readonly longitude: string | undefined;
1237
+ /**
1238
+ * The three-letter IATA airport code of the data center that the request hit,
1239
+ * for example, "DFW".
1240
+ * @see {@link https://en.wikipedia.org/wiki/IATA_airport_code|IATA airport code}
1241
+ */
1242
+ readonly colo: string | undefined;
1243
+ /**
1244
+ * Postal code of the incoming request, for example, "78701".
1245
+ */
1246
+ readonly postalCode: string | undefined;
1247
+ /**
1248
+ * Metro code (DMA) of the incoming request, for example, "635".
1249
+ */
1250
+ readonly metroCode: string | undefined;
1251
+ /**
1252
+ * If known, the ISO 3166-2 name for the first level region associated with
1253
+ * the IP address of the incoming request, for example, "Texas".
1254
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
1255
+ */
1256
+ readonly region: string | undefined;
1257
+ /**
1258
+ * If known, the ISO 3166-2 code for the first-level region associated with
1259
+ * the IP address of the incoming request, for example, "TX".
1260
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
1261
+ */
1262
+ readonly regionCode: string | undefined;
1263
+ /**
1264
+ * Timezone of the incoming request, for example, "America/Chicago".
1265
+ */
1266
+ readonly timezone: string | undefined;
1267
+ }
1268
+
1269
+ /* Excluded from this release type: IRequestProcessor */
1270
+
1271
+ /** ISO 3166-1 Alpha-2 codes */
1272
+ declare type Iso3166Alpha2Code =
1273
+ | "AD"
1274
+ | "AE"
1275
+ | "AF"
1276
+ | "AG"
1277
+ | "AI"
1278
+ | "AL"
1279
+ | "AM"
1280
+ | "AO"
1281
+ | "AQ"
1282
+ | "AR"
1283
+ | "AS"
1284
+ | "AT"
1285
+ | "AU"
1286
+ | "AW"
1287
+ | "AX"
1288
+ | "AZ"
1289
+ | "BA"
1290
+ | "BB"
1291
+ | "BD"
1292
+ | "BE"
1293
+ | "BF"
1294
+ | "BG"
1295
+ | "BH"
1296
+ | "BI"
1297
+ | "BJ"
1298
+ | "BL"
1299
+ | "BM"
1300
+ | "BN"
1301
+ | "BO"
1302
+ | "BQ"
1303
+ | "BR"
1304
+ | "BS"
1305
+ | "BT"
1306
+ | "BV"
1307
+ | "BW"
1308
+ | "BY"
1309
+ | "BZ"
1310
+ | "CA"
1311
+ | "CC"
1312
+ | "CD"
1313
+ | "CF"
1314
+ | "CG"
1315
+ | "CH"
1316
+ | "CI"
1317
+ | "CK"
1318
+ | "CL"
1319
+ | "CM"
1320
+ | "CN"
1321
+ | "CO"
1322
+ | "CR"
1323
+ | "CU"
1324
+ | "CV"
1325
+ | "CW"
1326
+ | "CX"
1327
+ | "CY"
1328
+ | "CZ"
1329
+ | "DE"
1330
+ | "DJ"
1331
+ | "DK"
1332
+ | "DM"
1333
+ | "DO"
1334
+ | "DZ"
1335
+ | "EC"
1336
+ | "EE"
1337
+ | "EG"
1338
+ | "EH"
1339
+ | "ER"
1340
+ | "ES"
1341
+ | "ET"
1342
+ | "FI"
1343
+ | "FJ"
1344
+ | "FK"
1345
+ | "FM"
1346
+ | "FO"
1347
+ | "FR"
1348
+ | "GA"
1349
+ | "GB"
1350
+ | "GD"
1351
+ | "GE"
1352
+ | "GF"
1353
+ | "GG"
1354
+ | "GH"
1355
+ | "GI"
1356
+ | "GL"
1357
+ | "GM"
1358
+ | "GN"
1359
+ | "GP"
1360
+ | "GQ"
1361
+ | "GR"
1362
+ | "GS"
1363
+ | "GT"
1364
+ | "GU"
1365
+ | "GW"
1366
+ | "GY"
1367
+ | "HK"
1368
+ | "HM"
1369
+ | "HN"
1370
+ | "HR"
1371
+ | "HT"
1372
+ | "HU"
1373
+ | "ID"
1374
+ | "IE"
1375
+ | "IL"
1376
+ | "IM"
1377
+ | "IN"
1378
+ | "IO"
1379
+ | "IQ"
1380
+ | "IR"
1381
+ | "IS"
1382
+ | "IT"
1383
+ | "JE"
1384
+ | "JM"
1385
+ | "JO"
1386
+ | "JP"
1387
+ | "KE"
1388
+ | "KG"
1389
+ | "KH"
1390
+ | "KI"
1391
+ | "KM"
1392
+ | "KN"
1393
+ | "KP"
1394
+ | "KR"
1395
+ | "KW"
1396
+ | "KY"
1397
+ | "KZ"
1398
+ | "LA"
1399
+ | "LB"
1400
+ | "LC"
1401
+ | "LI"
1402
+ | "LK"
1403
+ | "LR"
1404
+ | "LS"
1405
+ | "LT"
1406
+ | "LU"
1407
+ | "LV"
1408
+ | "LY"
1409
+ | "MA"
1410
+ | "MC"
1411
+ | "MD"
1412
+ | "ME"
1413
+ | "MF"
1414
+ | "MG"
1415
+ | "MH"
1416
+ | "MK"
1417
+ | "ML"
1418
+ | "MM"
1419
+ | "MN"
1420
+ | "MO"
1421
+ | "MP"
1422
+ | "MQ"
1423
+ | "MR"
1424
+ | "MS"
1425
+ | "MT"
1426
+ | "MU"
1427
+ | "MV"
1428
+ | "MW"
1429
+ | "MX"
1430
+ | "MY"
1431
+ | "MZ"
1432
+ | "NA"
1433
+ | "NC"
1434
+ | "NE"
1435
+ | "NF"
1436
+ | "NG"
1437
+ | "NI"
1438
+ | "NL"
1439
+ | "NO"
1440
+ | "NP"
1441
+ | "NR"
1442
+ | "NU"
1443
+ | "NZ"
1444
+ | "OM"
1445
+ | "PA"
1446
+ | "PE"
1447
+ | "PF"
1448
+ | "PG"
1449
+ | "PH"
1450
+ | "PK"
1451
+ | "PL"
1452
+ | "PM"
1453
+ | "PN"
1454
+ | "PR"
1455
+ | "PS"
1456
+ | "PT"
1457
+ | "PW"
1458
+ | "PY"
1459
+ | "QA"
1460
+ | "RE"
1461
+ | "RO"
1462
+ | "RS"
1463
+ | "RU"
1464
+ | "RW"
1465
+ | "SA"
1466
+ | "SB"
1467
+ | "SC"
1468
+ | "SD"
1469
+ | "SE"
1470
+ | "SG"
1471
+ | "SH"
1472
+ | "SI"
1473
+ | "SJ"
1474
+ | "SK"
1475
+ | "SL"
1476
+ | "SM"
1477
+ | "SN"
1478
+ | "SO"
1479
+ | "SR"
1480
+ | "SS"
1481
+ | "ST"
1482
+ | "SV"
1483
+ | "SX"
1484
+ | "SY"
1485
+ | "SZ"
1486
+ | "TC"
1487
+ | "TD"
1488
+ | "TF"
1489
+ | "TG"
1490
+ | "TH"
1491
+ | "TJ"
1492
+ | "TK"
1493
+ | "TL"
1494
+ | "TM"
1495
+ | "TN"
1496
+ | "TO"
1497
+ | "TR"
1498
+ | "TT"
1499
+ | "TV"
1500
+ | "TW"
1501
+ | "TZ"
1502
+ | "UA"
1503
+ | "UG"
1504
+ | "UM"
1505
+ | "US"
1506
+ | "UY"
1507
+ | "UZ"
1508
+ | "VA"
1509
+ | "VC"
1510
+ | "VE"
1511
+ | "VG"
1512
+ | "VI"
1513
+ | "VN"
1514
+ | "VU"
1515
+ | "WF"
1516
+ | "WS"
1517
+ | "YE"
1518
+ | "YT"
1519
+ | "ZA"
1520
+ | "ZM"
1521
+ | "ZW";
1522
+
1523
+ /* Excluded from this release type: isRestrictedEnvVariableName */
1524
+
1525
+ export declare function isZuploReadableEnvVariableName(name: string): boolean;
1526
+
1527
+ /**
1528
+ * Validates that the JWT token includes specific scopes
1529
+ *
1530
+ * @title JWT Scope Validation
1531
+ * @public
1532
+ * @param request - The ZuploRequest
1533
+ * @param context - The ZuploContext
1534
+ * @param options - The policy options set in policies.json
1535
+ * @param policyName - The name of the policy as set in policies.json
1536
+ * @returns A Request or a Response
1537
+ */
1538
+ export declare const JWTScopeValidationInboundPolicy: InboundPolicyHandler<JWTScopeValidationInboundPolicyOptions>;
1539
+
1540
+ /**
1541
+ * The options for this policy.
1542
+ */
1543
+ export declare interface JWTScopeValidationInboundPolicyOptions {
1544
+ /**
1545
+ * An array of of JWT scopes.
1546
+ */
1547
+ scopes: string[];
1548
+ }
1549
+
1550
+ /* Excluded from this release type: KevValueStoreGetOptions */
1551
+
1552
+ /* Excluded from this release type: KeyValueStore */
1553
+
1554
+ /* Excluded from this release type: KeyValueStorePutOptions */
1555
+
1556
+ /* Excluded from this release type: LogEntry */
1557
+
1558
+ declare interface LogField {
1559
+ name: string;
1560
+ content: Primitive;
1561
+ }
1562
+
1563
+ /* Excluded from this release type: LogFormat */
1564
+
1565
+ /* Excluded from this release type: Logger */
1566
+
1567
+ /* Excluded from this release type: LoggingContext */
1568
+
1569
+ declare interface LogInsightLogEntry {
1570
+ text: string;
1571
+ timestamp: number;
1572
+ fields: LogField[];
1573
+ }
1574
+
1575
+ /* Excluded from this release type: LogLevel */
1576
+
1577
+ /* Excluded from this release type: LogOwnerType */
1578
+
1579
+ declare abstract class LogPlugin extends RuntimePlugin {
1580
+ /* Excluded from this release type: getTransport */
1581
+ }
1582
+
1583
+ declare type LogSourceType = "runtime" | "request";
1584
+
1585
+ /* Excluded from this release type: LogTransport */
1586
+
1587
+ export declare class LokiLoggingPlugin extends LogPlugin {
1588
+ private options;
1589
+ constructor(options: LokiLoggingPluginOptions);
1590
+ /* Excluded from this release type: getTransport */
1591
+ }
1592
+
1593
+ declare interface LokiLoggingPluginOptions {
1594
+ url: string;
1595
+ username: string;
1596
+ password: string;
1597
+ }
1598
+
1599
+ /* Excluded from this release type: LookupResult */
1600
+
1601
+ export declare class MemoryZoneReadThroughCache<T = unknown> {
1602
+ #private;
1603
+ constructor(name: string, context: ZuploContext);
1604
+ get(key: string): Promise<T | undefined>;
1605
+ put(key: string, data: T, ttlSeconds: number): void;
1606
+ }
1607
+
1608
+ /* Excluded from this release type: MeteringPlugin */
1609
+
1610
+ /* Excluded from this release type: MeteringRegions */
1611
+
1612
+ /* Excluded from this release type: MeteringSubscription */
1613
+
1614
+ /* Excluded from this release type: MeteringSubscriptionStatus */
1615
+
1616
+ /* Excluded from this release type: MetricsData */
1617
+
1618
+ declare abstract class MetricsPlugin extends RuntimePlugin {
1619
+ /* Excluded from this release type: getTransport */
1620
+ }
1621
+
1622
+ declare interface MetricsTransport {
1623
+ pushMetrics(entry: MetricsData, context: ZuploContext): void;
1624
+ }
1625
+
1626
+ declare interface MetricsType {
1627
+ latency?: boolean;
1628
+ requestContentLength?: boolean;
1629
+ responseContentLength?: boolean;
1630
+ }
1631
+
1632
+ /**
1633
+ * The options for this policy.
1634
+ */
1635
+ export declare interface MockApiInboundOptions {
1636
+ /**
1637
+ * Indicates whether the response should be selected randomly, from the available examples (that match any filter criteria). If `false` the first matching example is used.
1638
+ */
1639
+ random?: boolean;
1640
+ /**
1641
+ * Specifies a prefix to match the responses to select from. Typically this is a status code like "200" or "2XX". If you want the policy to select randomly from all 2XX codes, set this property to "2" and random to `true`.
1642
+ */
1643
+ responsePrefixFilter?: string;
1644
+ /**
1645
+ * Specify the content-type of the response to select from. If not specified, the first matching response is used (or random).
1646
+ */
1647
+ contentType?: string;
1648
+ /**
1649
+ * Specify the name of the example to select. If not specified, the first matching response is used (or random).
1650
+ */
1651
+ exampleName?: string;
1652
+ }
1653
+
1654
+ /**
1655
+ * Returns example responses from the OpenAPI document associated with this route.
1656
+ *
1657
+ * @title Mock API Response
1658
+ * @public
1659
+ * @param request - The ZuploRequest
1660
+ * @param context - The ZuploContext
1661
+ * @param options - The policy options set in policies.json
1662
+ * @param policyName - The name of the policy as set in policies.json
1663
+ * @returns A Request or a Response
1664
+ */
1665
+ export declare const MockApiInboundPolicy: InboundPolicyHandler<MockApiInboundOptions>;
1666
+
1667
+ declare type Modify<T, R> = Omit<T, keyof R> & R;
1668
+
1669
+ declare interface MoesifContext {
1670
+ apiVersion?: string;
1671
+ userId?: string;
1672
+ companyId?: string;
1673
+ sessionToken?: string;
1674
+ metadata?: unknown;
1675
+ }
1676
+
1677
+ /**
1678
+ * Moesif is an API analytics and billing service. This policy allows you to send metering calls for each API to their events batch endpoint.
1679
+ *
1680
+ * @remarks
1681
+ * Moesif {@link https://moesif.com|moesif.com} is an API analytics and monetization
1682
+ * platform. This policy allows you to measure (and meter) API calls flowing
1683
+ * through your Zuplo gateway.
1684
+ *
1685
+ * Add the policy to each route you want to meter. Note you can specify the Meter
1686
+ * API Name and Meter Value (meter increment) at the policy level.
1687
+ *
1688
+ * @title Moesif Analytics & Billing
1689
+ * @public
1690
+ * @param request - The ZuploRequest
1691
+ * @param context - The ZuploContext
1692
+ * @param options - The policy options set in policies.json
1693
+ * @param policyName - The name of the policy as set in policies.json
1694
+ * @returns A Request or a Response
1695
+ */
1696
+ export declare function MoesifInboundPolicy(
1697
+ request: ZuploRequest,
1698
+ context: ZuploContext,
1699
+ passedOptions: MoesifInboundPolicyOptions,
1700
+ policyName: string
1701
+ ): Promise<ZuploRequest<RequestGeneric>>;
1702
+
1703
+ /**
1704
+ * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
1705
+ */
1706
+ export declare interface MoesifInboundPolicyOptions {
1707
+ /**
1708
+ * Your Moesif application ID.
1709
+ */
1710
+ applicationId: string;
1711
+ /**
1712
+ * Set to false to disable sending the request body to Moesif.
1713
+ */
1714
+ logRequestBody?: boolean;
1715
+ /**
1716
+ * Set to false to disable sending the response body to Moesif.
1717
+ */
1718
+ logResponseBody?: boolean;
1719
+ }
1720
+
1721
+ /* Excluded from this release type: MonetizationInboundPolicy */
1722
+
1723
+ /**
1724
+ * The options for this policy.
1725
+ */
1726
+ export declare interface MonetizationInboundPolicyOptions {
1727
+ /**
1728
+ * Indicates if requests without subscription should be allowed or not.
1729
+ */
1730
+ allowRequestsWithoutSubscription?: boolean;
1731
+ /**
1732
+ * Indicates which subscription statuses should be allowed.
1733
+ */
1734
+ allowedSubscriptionStatuses?: (
1735
+ | "active"
1736
+ | "inactive"
1737
+ | "incomplete"
1738
+ | "incomplete-expired"
1739
+ | "trialing"
1740
+ | "past-due"
1741
+ | "canceled"
1742
+ | "unpaid"
1743
+ )[];
1744
+ /**
1745
+ * Indicates the bucket to be used, overrides the default one.
1746
+ */
1747
+ bucketId?: string;
1748
+ /**
1749
+ * Indicates if requests over quota should be allowed or not.
1750
+ */
1751
+ allowRequestsOverQuota?: boolean;
1752
+ /**
1753
+ * The meters to be used by the policy against the subscription quota.
1754
+ */
1755
+ meters: {
1756
+ /**
1757
+ * This interface was referenced by `undefined`'s JSON-Schema definition
1758
+ * via the `patternProperty` "^.*$".
1759
+ */
1760
+ [k: string]: number;
1761
+ };
1762
+ /**
1763
+ * A list of successful status codes and ranges "200-299, 304" that should trigger a metering call.
1764
+ */
1765
+ meterOnStatusCodes?: string | number[];
1766
+ }
1767
+
1768
+ declare type MonetizationPolicyMeters = {
1769
+ [Key in string]: number;
1770
+ };
1771
+
1772
+ /* Excluded from this release type: MonetizationSubscription */
1773
+
1774
+ declare interface NotFoundOptions {
1775
+ routesMatchedByPathOnly: RouteConfiguration[];
1776
+ }
1777
+
1778
+ /**
1779
+ * Authenticate users using Okta issued JWT tokens.
1780
+ *
1781
+ * @remarks
1782
+ * Authenticate requests with JWT tokens issued by Okta. This is a customized
1783
+ * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
1784
+ * for Okta.
1785
+ *
1786
+ * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
1787
+ * about OAuth authorization in Zuplo.
1788
+ *
1789
+ * @title Okta JWT Auth
1790
+ * @public
1791
+ * @param request - The ZuploRequest
1792
+ * @param context - The ZuploContext
1793
+ * @param options - The policy options set in policies.json
1794
+ * @param policyName - The name of the policy as set in policies.json
1795
+ * @returns A Request or a Response
1796
+ */
1797
+ export declare const OktaJwtInboundPolicy: InboundPolicyHandler<OktaJwtInboundPolicyOptions>;
1798
+
1799
+ /**
1800
+ * The options for this policy.
1801
+ */
1802
+ export declare interface OktaJwtInboundPolicyOptions {
1803
+ /**
1804
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
1805
+ */
1806
+ allowUnauthenticatedRequests?: boolean;
1807
+ /**
1808
+ * Your Okta authorization server's issuer URL. For example, `https://dev-12345.okta.com/oauth2/abc`.
1809
+ */
1810
+ issuerUrl: string;
1811
+ /**
1812
+ * The Okta audience of your API, for example `api://my-api`.
1813
+ */
1814
+ audience?: string;
1815
+ }
1816
+
1817
+ /**
1818
+ * @public
1819
+ */
1820
+ declare interface OnRequestHook {
1821
+ (
1822
+ request: ZuploRequest,
1823
+ context: ZuploContext
1824
+ ): Promise<ZuploRequest | Response> | (ZuploRequest | Response);
1825
+ }
1826
+
1827
+ /**
1828
+ * @public
1829
+ */
1830
+ declare interface OnResponseSendingFinalHook {
1831
+ (
1832
+ response: Response,
1833
+ request: ZuploRequest,
1834
+ context: ZuploContext
1835
+ ): Promise<void> | void;
1836
+ }
1837
+
1838
+ /**
1839
+ * @public
1840
+ */
1841
+ declare interface OnResponseSendingHook {
1842
+ (
1843
+ response: Response,
1844
+ request: ZuploRequest,
1845
+ context: ZuploContext
1846
+ ): Promise<Response> | Response;
1847
+ }
1848
+
1849
+ declare interface OnSendingAwsLambdaEventHook {
1850
+ (
1851
+ request: ZuploRequest,
1852
+ context: ZuploContext,
1853
+ event: AwsLambdaEventV1 | AwsLambdaEventV2
1854
+ ): Promise<AwsLambdaEventV1 | AwsLambdaEventV2>;
1855
+ }
1856
+
1857
+ /* Excluded from this release type: openApiSpecHandler */
1858
+
1859
+ /**
1860
+ * The Open ID JWT Authentication policy allows you to authenticate incoming requests using an Open ID compliant bearer token.
1861
+ *
1862
+ * @remarks
1863
+ * The Open ID JWT Authentication policy allows you to authenticate incoming
1864
+ * requests using an Open ID-compliant bearer token. It works with common
1865
+ * authentication services like Auth0 (sample here) but should also work with any
1866
+ * valid Open ID JWT token.
1867
+ *
1868
+ * When configured, you can have Zuplo check incoming requests for a JWT token and
1869
+ * automatically populate the `ZuploRequest` 's `user` property with a user object.
1870
+ * This `user` object will have a `sub` property - taking the `sub` id from the JWT
1871
+ * token. It will also have a `data` property populated by other data returned in
1872
+ * the JWT token (including any claims).
1873
+ *
1874
+ * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
1875
+ * about OAuth authorization in Zuplo.
1876
+ *
1877
+ * @title JWT Auth
1878
+ * @public
1879
+ * @param request - The ZuploRequest
1880
+ * @param context - The ZuploContext
1881
+ * @param options - The policy options set in policies.json
1882
+ * @param policyName - The name of the policy as set in policies.json
1883
+ * @returns A Request or a Response
1884
+ */
1885
+ export declare const OpenIdJwtInboundPolicy: InboundPolicyHandler<OpenIdJwtInboundPolicyInternalOptions>;
1886
+
1887
+ declare interface OpenIdJwtInboundPolicyInternalOptions
1888
+ extends Omit<OpenIdJwtInboundPolicyOptions, "secret"> {
1889
+ secret?: string | KeyLike;
1890
+ }
1891
+
1892
+ /**
1893
+ * The options for this policy.
1894
+ */
1895
+ export declare interface OpenIdJwtInboundPolicyOptions {
1896
+ /**
1897
+ * The expected issuer claim in the JWT token.
1898
+ */
1899
+ issuer?: string;
1900
+ /**
1901
+ * The expected audience claim in the JWT token.
1902
+ */
1903
+ audience?: string;
1904
+ /**
1905
+ * the url of the JSON Web Key Set (JWKS) - this is used to validate the JWT token signature (either this or `secret` must be set).
1906
+ */
1907
+ jwkUrl?: string;
1908
+ /**
1909
+ * The key used to verify the signature of the JWT token (either this or `jwkUrl` must be set).
1910
+ */
1911
+ secret?: string;
1912
+ /**
1913
+ * indicates whether the request should continue if authentication fails. Defaults is `false` which means unauthenticated users will automatically receive a 401 response.
1914
+ */
1915
+ allowUnauthenticatedRequests?: boolean;
1916
+ /**
1917
+ * The name of the property in the JWT token that contains the user's unique identifier.
1918
+ */
1919
+ subPropertyName?: string;
1920
+ /**
1921
+ * Additional headers to send with the JWK request.
1922
+ */
1923
+ headers?: {
1924
+ [k: string]: string;
1925
+ };
1926
+ }
1927
+
1928
+ export declare const originalFetch: typeof fetch;
1929
+
1930
+ /* Excluded from this release type: OutboundPolicy */
1931
+
1932
+ /**
1933
+ * @public
1934
+ * A policy that can modify the outgoing HTTP response before it is returned
1935
+ * to the client.
1936
+ *
1937
+ * @param response - The outgoing Response
1938
+ * @param request - The incoming Request
1939
+ * @param context - The current context of the Request
1940
+ * @param options - The configuration options for the policy
1941
+ * @param policyName - The name set on the policy in the configuration
1942
+ * @returns A Response object
1943
+ */
1944
+ export declare interface OutboundPolicyHandler<TOptions = any> {
1945
+ (
1946
+ response: Response,
1947
+ request: ZuploRequest,
1948
+ context: ZuploContext,
1949
+ options: TOptions,
1950
+ policyName: string
1951
+ ): Promise<Response>;
1952
+ }
1953
+
1954
+ /* Excluded from this release type: ParameterBaseObject */
1955
+
1956
+ /* Excluded from this release type: ParameterDefinition */
1957
+
1958
+ /**
1959
+ * This is the parsed values of the Cors configuration. All
1960
+ * values in the parsed configuration are in the format that the headers
1961
+ * use them (i.e. everything is converted to a string)
1962
+ */
1963
+ declare interface ParsedCorsPolicyConfiguration {
1964
+ name: string;
1965
+ allowCredentials: string | undefined;
1966
+ maxAge: string | undefined;
1967
+ allowedOrigins: string[];
1968
+ allowedMethods?: string;
1969
+ allowedHeaders?: string;
1970
+ exposeHeaders?: string;
1971
+ }
1972
+
1973
+ declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
1974
+ corsPolicies: ParsedCorsPolicyConfiguration[];
1975
+ }
1976
+
1977
+ /* Excluded from this release type: PolicyBase */
1978
+
1979
+ export declare interface PolicyConfiguration {
1980
+ name: string;
1981
+ policyType: string;
1982
+ handler: HandlerDefinition;
1983
+ options?: unknown;
1984
+ }
1985
+
1986
+ declare type Primitive =
1987
+ | null
1988
+ | undefined
1989
+ | string
1990
+ | number
1991
+ | boolean
1992
+ | symbol
1993
+ | bigint;
1994
+
1995
+ /* Excluded from this release type: ProblemDetails */
1996
+
1997
+ /* Excluded from this release type: ProblemResponseDetails */
1998
+
1999
+ /* Excluded from this release type: ProblemResponseFormat */
2000
+
2001
+ /* Excluded from this release type: ProblemResponseFormatter */
2002
+
2003
+ /**
2004
+ * Authenticate users using PropelAuth issued JWT tokens.
2005
+ *
2006
+ * @remarks
2007
+ * Authenticate requests with JWT tokens issued by {@link https://propelauth.com|PropelAuth}.
2008
+ * This is a customized version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy}
2009
+ * specifically for PropelAuth.
2010
+ *
2011
+ * @title PropelAuth JWT Auth
2012
+ * @public
2013
+ * @param request - The ZuploRequest
2014
+ * @param context - The ZuploContext
2015
+ * @param options - The policy options set in policies.json
2016
+ * @param policyName - The name of the policy as set in policies.json
2017
+ * @returns A Request or a Response
2018
+ */
2019
+ export declare const PropelAuthJwtInboundPolicy: InboundPolicyHandler<PropelAuthJwtInboundPolicyOptions>;
2020
+
2021
+ /**
2022
+ * The options for this policy.
2023
+ */
2024
+ export declare interface PropelAuthJwtInboundPolicyOptions {
2025
+ /**
2026
+ * Allow unauthenticated requests to proceed. This is use useful if you want to use multiple authentication policies or if you want to allow both authenticated and non-authenticated traffic.
2027
+ */
2028
+ allowUnauthenticatedRequests?: boolean;
2029
+ /**
2030
+ * Your PropelAuth authUrl. For example, `https://6587563.propelauthtest.com`.
2031
+ */
2032
+ authUrl: string;
2033
+ /**
2034
+ * Your public (verifier) key that is used to verify access tokens. This key has a value that begins with '-----BEGIN PUBLIC KEY-----'. Make sure to remove all line breaks from the key before saving the variable.
2035
+ */
2036
+ verifierKey: string;
2037
+ }
2038
+
2039
+ /* Excluded from this release type: purgeGatewayCache */
2040
+
2041
+ /**
2042
+ * 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.
2043
+ */
2044
+ declare type RateLimitByType = "user" | "ip" | "function" | "all";
2045
+
2046
+ /**
2047
+ * Adds the retry-after header.
2048
+ */
2049
+ declare type RateLimitHeaderMode = "none" | "retry-after";
2050
+
2051
+ /**
2052
+ * The rate-limiting policy is used to limit the number of requests that can be made against your API based on a key.
2053
+ *
2054
+ * @remarks
2055
+ * Rate-limiting allows you to set a maximum rate of requests for your API gateway.
2056
+ * This is useful to enforce rate limits agreed with your clients and protect your
2057
+ * downstream services.
2058
+ *
2059
+ * The Zuplo Rate-Limit allows you to limit based on different attributes of the
2060
+ * incoming request. For example, you might set a rate limit of 10 requests per
2061
+ * second per user, or 20 requests per second for a given IP address.
2062
+ *
2063
+ * The Zuplo rate-limiter also allows you to set a custom bucket name by which to
2064
+ * effect a rate-limit using a function.
2065
+ *
2066
+ * When a client reaches a rate limit - they will receive a `429` response code.
2067
+ *
2068
+ * @title Rate Limiting
2069
+ * @public
2070
+ * @param request - The ZuploRequest
2071
+ * @param context - The ZuploContext
2072
+ * @param options - The policy options set in policies.json
2073
+ * @param policyName - The name of the policy as set in policies.json
2074
+ * @returns A Request or a Response
2075
+ */
2076
+ declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
2077
+ export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy };
2078
+ export { RateLimitInboundPolicy };
2079
+
2080
+ /**
2081
+ * The options for this policy.
2082
+ */
2083
+ declare interface RateLimitInboundPolicyOptions {
2084
+ rateLimitBy: RateLimitByType;
2085
+ /**
2086
+ * The max number of requests allowed in the given time window.
2087
+ */
2088
+ requestsAllowed: number;
2089
+ /**
2090
+ * The time window in which the requests are rate-limited. The count restarts after each window expires.
2091
+ */
2092
+ timeWindowMinutes: number;
2093
+ /**
2094
+ * The function that returns dynamic configuration data. Used only with `rateLimitBy=function`.
2095
+ */
2096
+ identifier?: {
2097
+ /**
2098
+ * used only with rateLimitBy=function. Specifies the export to load your custom bucket function, e.g. `default`, `rateLimitIdentifier`.
2099
+ */
2100
+ export: string;
2101
+ /**
2102
+ * Specifies the module to load your custom bucket function, in the format `$import(./modules/my-module)`.
2103
+ */
2104
+ module: string;
2105
+ };
2106
+ headerMode?: RateLimitHeaderMode;
2107
+ /**
2108
+ * If true, the policy will throw an error in the event there is a problem connecting to the rate limit service.
2109
+ */
2110
+ throwOnFailure?: boolean;
2111
+ mode?: RateLimitMode;
2112
+ }
2113
+ export { RateLimitInboundPolicyOptions as BasicRateLimitInboundPolicyOptions };
2114
+ export { RateLimitInboundPolicyOptions };
2115
+
2116
+ /**
2117
+ * 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.
2118
+ */
2119
+ declare type RateLimitMode = "strict" | "async";
2120
+
2121
+ /**
2122
+ * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
2123
+ */
2124
+ declare interface ReadmeMeteringInboundPolicyOptions {
2125
+ /**
2126
+ * The API key to use when sending metrics calls to Readme.
2127
+ */
2128
+ apiKey: string;
2129
+ /**
2130
+ * This is the path to the property on `request.user` that contains the label you want to use. For example `.data.accountNumber` would read the `request.user.data.accountNumber` property.
2131
+ */
2132
+ userLabelPropertyPath?: string;
2133
+ /**
2134
+ * This is the path to the property on `request.user` that contains the e-mail of the user. For example `.data.email` would read the `request.user.data.email` property.
2135
+ */
2136
+ userEmailPropertyPath?: string;
2137
+ /**
2138
+ * Whether the data should be ingested as 'development' mode or not. Defaults to true for working-copy and false for all other environments.
2139
+ */
2140
+ development?: boolean;
2141
+ /**
2142
+ * When true, Zuplo sends the full request path (which might contain sensitive information). By default, we only send the route path which should not contain sensitive information.
2143
+ */
2144
+ useFullRequestPath?: boolean;
2145
+ /**
2146
+ * The URL to send metering events. This is useful for testing purposes.
2147
+ */
2148
+ url?: string;
2149
+ }
2150
+
2151
+ /**
2152
+ * Readme is a developer documentation and API metrics company. This policy pushes logs to their API calls dashboard.
2153
+ *
2154
+ * @remarks
2155
+ * {@link https://readme.com|Readme} is a developer Documentation and
2156
+ * metrics service. This policy pushes the request/response data to their ingestion
2157
+ * endpoint so you can see your Zuplo API traffic in their API calls dashboard.
2158
+ *
2159
+ * @title Readme Metrics
2160
+ * @public
2161
+ * @param request - The ZuploRequest
2162
+ * @param context - The ZuploContext
2163
+ * @param options - The policy options set in policies.json
2164
+ * @param policyName - The name of the policy as set in policies.json
2165
+ * @returns A Request or a Response
2166
+ */
2167
+ export declare function ReadmeMetricsInboundPolicy(
2168
+ request: ZuploRequest,
2169
+ context: ZuploContext,
2170
+ options: ReadmeMeteringInboundPolicyOptions,
2171
+ policyName: string
2172
+ ): Promise<ZuploRequest<RequestGeneric>>;
2173
+
2174
+ /* Excluded from this release type: redirectHandler */
2175
+
2176
+ /**
2177
+ * Remove headers from the incoming request.
2178
+ *
2179
+ * @title Remove Request Headers
2180
+ * @public
2181
+ * @param request - The ZuploRequest
2182
+ * @param context - The ZuploContext
2183
+ * @param options - The policy options set in policies.json
2184
+ * @param policyName - The name of the policy as set in policies.json
2185
+ * @returns A Request or a Response
2186
+ */
2187
+ export declare const RemoveHeadersInboundPolicy: InboundPolicyHandler<RemoveHeadersInboundPolicyOptions>;
2188
+
2189
+ /**
2190
+ * The options for this policy.
2191
+ */
2192
+ export declare interface RemoveHeadersInboundPolicyOptions {
2193
+ /**
2194
+ * An array of headers to remove from the incoming request.
2195
+ */
2196
+ headers: string[];
2197
+ }
2198
+
2199
+ /**
2200
+ * Remove configured headers from the outgoing response.
2201
+ *
2202
+ * @title Remove Response Headers
2203
+ * @public
2204
+ * @param request - The ZuploRequest
2205
+ * @param context - The ZuploContext
2206
+ * @param options - The policy options set in policies.json
2207
+ * @param policyName - The name of the policy as set in policies.json
2208
+ * @returns A Request or a Response
2209
+ */
2210
+ export declare const RemoveHeadersOutboundPolicy: OutboundPolicyHandler<RemoveHeadersOutboundPolicyOptions>;
2211
+
2212
+ /**
2213
+ * The options for this policy.
2214
+ */
2215
+ export declare interface RemoveHeadersOutboundPolicyOptions {
2216
+ /**
2217
+ * An array of headers to be removed from the outgoing response.
2218
+ */
2219
+ headers: string[];
2220
+ }
2221
+
2222
+ /**
2223
+ * Remove query parameters from the incoming request
2224
+ *
2225
+ * @title Remove Query Parameters
2226
+ * @public
2227
+ * @param request - The ZuploRequest
2228
+ * @param context - The ZuploContext
2229
+ * @param options - The policy options set in policies.json
2230
+ * @param policyName - The name of the policy as set in policies.json
2231
+ * @returns A Request or a Response
2232
+ */
2233
+ export declare const RemoveQueryParamsInboundPolicy: InboundPolicyHandler<RemoveQueryParamsInboundPolicyOptions>;
2234
+
2235
+ /**
2236
+ * The options for this policy.
2237
+ */
2238
+ export declare interface RemoveQueryParamsInboundPolicyOptions {
2239
+ /**
2240
+ * An array of query parameters to be removed from the incoming request.
2241
+ */
2242
+ params: string[];
2243
+ }
2244
+
2245
+ /**
2246
+ * Replace a string in the incoming request body
2247
+ *
2248
+ * @title Replace String in Response Body
2249
+ * @public
2250
+ * @param request - The ZuploRequest
2251
+ * @param context - The ZuploContext
2252
+ * @param options - The policy options set in policies.json
2253
+ * @param policyName - The name of the policy as set in policies.json
2254
+ * @returns A Request or a Response
2255
+ */
2256
+ export declare const ReplaceStringOutboundPolicy: OutboundPolicyHandler<ReplaceStringOutboundPolicyOptions>;
2257
+
2258
+ /**
2259
+ * The options for this policy.
2260
+ */
2261
+ export declare interface ReplaceStringOutboundPolicyOptions {
2262
+ /**
2263
+ * The type of string replacement to perform.
2264
+ */
2265
+ mode: "regexp" | "string";
2266
+ /**
2267
+ * The pattern to match.
2268
+ */
2269
+ match: string;
2270
+ /**
2271
+ * The value to each match is replaced with.
2272
+ */
2273
+ replaceWith: string;
2274
+ }
2275
+
2276
+ /**
2277
+ * The types of the properties in a request
2278
+ * @public
2279
+ */
2280
+ declare interface RequestGeneric extends RequestInitGeneric {
2281
+ Query?: RequestQueryDefault;
2282
+ }
2283
+
2284
+ /**
2285
+ * The types of the properties in a request init object
2286
+ * @public
2287
+ */
2288
+ declare interface RequestInitGeneric {
2289
+ UserData?: UserDataDefault;
2290
+ Params?: RequestParamsDefault;
2291
+ }
2292
+
2293
+ declare type RequestParamsDefault = Record<string, string>;
2294
+
2295
+ declare type RequestQueryDefault = Record<string, string>;
2296
+
2297
+ /**
2298
+ * Enforces a maximum size in bytes of the incoming request.
2299
+ *
2300
+ * @title Request Size Limit
2301
+ * @public
2302
+ * @param request - The ZuploRequest
2303
+ * @param context - The ZuploContext
2304
+ * @param options - The policy options set in policies.json
2305
+ * @param policyName - The name of the policy as set in policies.json
2306
+ * @returns A Request or a Response
2307
+ */
2308
+ export declare const RequestSizeLimitInboundPolicy: InboundPolicyHandler<RequestSizeLimitInboundPolicyOptions>;
2309
+
2310
+ /**
2311
+ * The options for this policy.
2312
+ */
2313
+ export declare interface RequestSizeLimitInboundPolicyOptions {
2314
+ /**
2315
+ * The maximum size of the request in bytes.
2316
+ */
2317
+ maxSizeInBytes: number;
2318
+ /**
2319
+ * If true, the policy will reject any request with a `content-length` header in excess of `maxSizeInBytes` bytes value, but will not verify the actual size of the request. This is more efficient and offers slightly better memory usage but should only be used if you trust/control the clients calling the gateway to send an accurate content-length. If false, the gateway will actually verify the request size and reject any request with a size in excess of the stated maximum.
2320
+ */
2321
+ trustContentLengthHeader?: boolean;
2322
+ }
2323
+
2324
+ /**
2325
+ * The authorized identity on the incoming request
2326
+ * @public
2327
+ */
2328
+ export declare interface RequestUser<TUserData> {
2329
+ sub: string;
2330
+ data: TUserData;
2331
+ }
2332
+
2333
+ /**
2334
+ * Validate inbound requests based on Open API specification
2335
+ *
2336
+ * @remarks
2337
+ * The Request Validation policy is used to validate incoming requests based on
2338
+ * schemas in OpenAPI specifications.
2339
+ *
2340
+ * When configured, any requests that do not conform to your OpenAPI schema will be
2341
+ * rejected with a `400: Bad Request` response containing a detailed error message
2342
+ * (in JSON) explaining why the request was not accepted.
2343
+ *
2344
+ * @title Request Validation
2345
+ * @public
2346
+ * @param request - The ZuploRequest
2347
+ * @param context - The ZuploContext
2348
+ * @param options - The policy options set in policies.json
2349
+ * @param policyName - The name of the policy as set in policies.json
2350
+ * @returns A Request or a Response
2351
+ */
2352
+ export declare const RequestValidationInboundPolicy: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
2353
+
2354
+ /**
2355
+ * The options for this policy.
2356
+ */
2357
+ export declare interface RequestValidationInboundPolicyOptions {
2358
+ /**
2359
+ * The log level to use when logging validation errors.
2360
+ */
2361
+ logLevel?: "error" | "warn" | "info" | "debug";
2362
+ validateBody?: ValidationOptions;
2363
+ validateQueryParameters?: ValidationOptions1;
2364
+ validatePathParameters?: ValidationOptions2;
2365
+ validateHeaders?: ValidationOptions3;
2366
+ /**
2367
+ * Whether to include the request in the logs.
2368
+ */
2369
+ includeRequestInLogs?: boolean;
2370
+ }
2371
+
2372
+ /**
2373
+ * Sets an allow-list for an origin header
2374
+ *
2375
+ * @remarks
2376
+ * The Require Origin policy is used to enforce that the client is sending an
2377
+ * `origin` header that matches your allow-list specified in the policy options.
2378
+ *
2379
+ * This is useful if you want to stop any browser traffic from different domains.
2380
+ *
2381
+ * However, it is important to note that it does not guarantee that traffic is only
2382
+ * coming from a browser. Somebody could simulate a browser request from a backend
2383
+ * server and set any origin they like.
2384
+ *
2385
+ * If the incoming origin is missing, or not allowed - a 400 Forbidden Problem
2386
+ * Response will be sent to the client. You can customize the `detail` property in
2387
+ * the policy options.
2388
+ *
2389
+ * @title Require Origin
2390
+ * @public
2391
+ * @param request - The ZuploRequest
2392
+ * @param context - The ZuploContext
2393
+ * @param options - The policy options set in policies.json
2394
+ * @param policyName - The name of the policy as set in policies.json
2395
+ * @returns A Request or a Response
2396
+ */
2397
+ export declare const RequireOriginInboundPolicy: InboundPolicyHandler<RequireOriginInboundPolicyOptions>;
2398
+
2399
+ /**
2400
+ * The options for this policy.
2401
+ */
2402
+ export declare interface RequireOriginInboundPolicyOptions {
2403
+ /**
2404
+ * A comma separated string containing valid origins.
2405
+ */
2406
+ origins: string;
2407
+ /**
2408
+ * The `detail` of the HTTP Problem response, if the origin is missing or disallowed.
2409
+ */
2410
+ failureDetail?: string;
2411
+ }
2412
+
2413
+ declare type ResolveRequestParams<
2414
+ TParams extends RequestParamsDefault | undefined,
2415
+ > = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
2416
+
2417
+ declare type ResolveRequestQuery<
2418
+ TQuery extends RequestQueryDefault | undefined,
2419
+ > = TQuery extends RequestQueryDefault ? TQuery : RequestQueryDefault;
2420
+
2421
+ declare type ResolveUserData<TUserData extends UserDataDefault | undefined> =
2422
+ TUserData extends UserDataDefault ? TUserData : UserDataDefault;
2423
+
2424
+ /* Excluded from this release type: ResponsesDefinition */
2425
+
2426
+ /* Excluded from this release type: ResponseSendingEvent */
2427
+
2428
+ /* Excluded from this release type: ResponseSentEvent */
2429
+
2430
+ export declare interface RouteConfiguration
2431
+ extends Omit<BuildRouteConfiguration, "raw"> {
2432
+ /**
2433
+ * @deprecated Please switch to "raw().operationId"
2434
+ */
2435
+ operationId?: string;
2436
+ /**
2437
+ * @deprecated Please switch to "raw().summary"
2438
+ */
2439
+ summary?: string;
2440
+ /**
2441
+ * @deprecated Please switch to "raw().tags"
2442
+ */
2443
+ tags?: string[];
2444
+ /**
2445
+ * @deprecated Please switch to "raw().parameters"
2446
+ */
2447
+ parameters?: ParameterDefinition[];
2448
+ /**
2449
+ * @deprecated Please switch to "raw().responses"
2450
+ */
2451
+ responses?: ResponsesDefinition;
2452
+ raw<T>(): T;
2453
+ }
2454
+
2455
+ export declare interface RouteData {
2456
+ /**
2457
+ /* @deprecated This property is not used and will be removed in future versions
2458
+ */
2459
+ info?: OpenAPIV3_1.InfoObject;
2460
+ /**
2461
+ /* @deprecated This property is not used and will be removed in future versions
2462
+ */
2463
+ versions: VersionData[];
2464
+ /**
2465
+ * @minItems 0
2466
+ */
2467
+ routes: RouteConfiguration[];
2468
+ policies?: PolicyConfiguration[];
2469
+ corsPolicies?: CorsPolicyConfiguration[];
2470
+ requestErrorHandler?: HandlerDefinition;
2471
+ }
2472
+
2473
+ /* Excluded from this release type: RouteHandler */
2474
+
2475
+ /* Excluded from this release type: Router */
2476
+
2477
+ /* Excluded from this release type: RouterEntry */
2478
+
2479
+ /* Excluded from this release type: RuntimeEnvironment */
2480
+
2481
+ /**
2482
+ * Used to indicate errors that are caused by user input
2483
+ * These errors are shown to the user and logged in user logs
2484
+ * These errors are NOT fatal and will not cause monitoring alerts
2485
+ * @public
2486
+ */
2487
+ export declare class RuntimeError extends Error {
2488
+ extensionMembers: Record<string, unknown> | undefined;
2489
+ constructor(message: string, options?: ErrorOptions);
2490
+ constructor(
2491
+ info: {
2492
+ message: string;
2493
+ extensionMembers?: Record<string, unknown>;
2494
+ },
2495
+ options?: ErrorOptions
2496
+ );
2497
+ }
2498
+
2499
+ /* Excluded from this release type: RuntimeExtensions */
2500
+
2501
+ export declare interface RuntimeExtensionsFunction {
2502
+ (runtime: RuntimeExtensions): Promise<void>;
2503
+ }
2504
+
2505
+ declare abstract class RuntimePlugin {}
2506
+
2507
+ /* Excluded from this release type: RuntimeSettings */
2508
+
2509
+ declare type RuntimeType = "deno" | "cloudflare";
2510
+
2511
+ export declare function sanitizedIdentifierName(name: string): string;
2512
+
2513
+ /**
2514
+ * @deprecated Use RequestValidationInboundPolicy instead
2515
+ */
2516
+ export declare const SchemaBasedRequestValidation: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
2517
+
2518
+ /* Excluded from this release type: serialize */
2519
+
2520
+ /* Excluded from this release type: ServiceProvider */
2521
+
2522
+ /* Excluded from this release type: ServiceProviderImpl */
2523
+
2524
+ /**
2525
+ * Sets the body of the request in the inbound pipeline - make sure to convert a GET/HEAD request to another method when using this policy.
2526
+ *
2527
+ * @remarks
2528
+ * The Set Body policy allows you to set or override the incoming request body.
2529
+ * {@link https://zuplo.com/docs/articles/zp-body-removed|GET or HEAD requests do not support bodies on Zuplo},
2530
+ * so be sure to use the {@link https://zuplo.com/docs/policies/change-method-inbound|Change Method}
2531
+ * policy to update the method to a `POST` or whatever is appropriate. You might
2532
+ * also need to use the {@link https://zuplo.com/docs/policies/set-headers-inbound|Set Header} policy to
2533
+ * set a `content-type`.
2534
+ *
2535
+ * @title Set Body
2536
+ * @public
2537
+ * @param request - The ZuploRequest
2538
+ * @param context - The ZuploContext
2539
+ * @param options - The policy options set in policies.json
2540
+ * @param policyName - The name of the policy as set in policies.json
2541
+ * @returns A Request or a Response
2542
+ */
2543
+ export declare const SetBodyInboundPolicy: InboundPolicyHandler<SetBodyInboundPolicyOptions>;
2544
+
2545
+ /**
2546
+ * The options for this policy.
2547
+ */
2548
+ export declare interface SetBodyInboundPolicyOptions {
2549
+ /**
2550
+ * The value to set for the body.
2551
+ */
2552
+ body: string;
2553
+ }
2554
+
2555
+ /**
2556
+ * Adds or sets headers on the incoming request.
2557
+ *
2558
+ * @remarks
2559
+ * The set header policy adds a header to the request in the inbound pipeline. This
2560
+ * can be used to set a security header required by the downstream service.
2561
+ *
2562
+ * @title Add or Set Request Headers
2563
+ * @public
2564
+ * @param request - The ZuploRequest
2565
+ * @param context - The ZuploContext
2566
+ * @param options - The policy options set in policies.json
2567
+ * @param policyName - The name of the policy as set in policies.json
2568
+ * @returns A Request or a Response
2569
+ */
2570
+ export declare const SetHeadersInboundPolicy: InboundPolicyHandler<SetHeadersInboundPolicyOptions>;
2571
+
2572
+ /**
2573
+ * The options for this policy.
2574
+ */
2575
+ export declare interface SetHeadersInboundPolicyOptions {
2576
+ /**
2577
+ * An array of headers to set in the request. By default, headers will be overwritten if they already exists in the request, specify the overwrite property to change this behavior.
2578
+ */
2579
+ headers: {
2580
+ /**
2581
+ * The name of the header.
2582
+ */
2583
+ name: string;
2584
+ /**
2585
+ * The value of the header.
2586
+ */
2587
+ value: string;
2588
+ /**
2589
+ * Overwrite the value if the header is already present in the request.
2590
+ */
2591
+ overwrite?: boolean;
2592
+ }[];
2593
+ }
2594
+
2595
+ /**
2596
+ * Adds or sets headers on the on the outgoing response.
2597
+ *
2598
+ * @title Set Headers
2599
+ * @public
2600
+ * @param request - The ZuploRequest
2601
+ * @param context - The ZuploContext
2602
+ * @param options - The policy options set in policies.json
2603
+ * @param policyName - The name of the policy as set in policies.json
2604
+ * @returns A Request or a Response
2605
+ */
2606
+ export declare const SetHeadersOutboundPolicy: OutboundPolicyHandler<SetHeadersOutboundPolicyOptions>;
2607
+
2608
+ /**
2609
+ * The options for this policy.
2610
+ */
2611
+ export declare interface SetHeadersOutboundPolicyOptions {
2612
+ /**
2613
+ * An array of headers to set on the response. By default, headers will be overwritten if they already exists in the response, specify the overwrite property to change this behavior.
2614
+ */
2615
+ headers: {
2616
+ /**
2617
+ * The name of the header.
2618
+ */
2619
+ name: string;
2620
+ /**
2621
+ * The value of the header.
2622
+ */
2623
+ value: string;
2624
+ /**
2625
+ * Overwrite the value if the header is already present in the response.
2626
+ */
2627
+ overwrite?: boolean;
2628
+ }[];
2629
+ }
2630
+
2631
+ export declare function setMoesifContext(
2632
+ context: ZuploContext,
2633
+ moesifContext: MoesifContext
2634
+ ): void;
2635
+
2636
+ /**
2637
+ * Adds or sets query parameters on the incoming request.
2638
+ *
2639
+ * @title Add or Set Query Parameters
2640
+ * @public
2641
+ * @param request - The ZuploRequest
2642
+ * @param context - The ZuploContext
2643
+ * @param options - The policy options set in policies.json
2644
+ * @param policyName - The name of the policy as set in policies.json
2645
+ * @returns A Request or a Response
2646
+ */
2647
+ export declare const SetQueryParamsInboundPolicy: InboundPolicyHandler<SetQueryParamsInboundPolicyOptions>;
2648
+
2649
+ /**
2650
+ * The options for this policy.
2651
+ */
2652
+ export declare interface SetQueryParamsInboundPolicyOptions {
2653
+ /**
2654
+ * An array of query params to set in the request. By default, query parameters will be overwritten if they already exist in the request, specify the overwrite property to change this behavior.
2655
+ */
2656
+ params: {
2657
+ /**
2658
+ * The name of the param.
2659
+ */
2660
+ name: string;
2661
+ /**
2662
+ * The value of the param.
2663
+ */
2664
+ value: string;
2665
+ /**
2666
+ * Overwrite the value if the param is already present in the request.
2667
+ */
2668
+ overwrite?: boolean;
2669
+ }[];
2670
+ }
2671
+
2672
+ /**
2673
+ * Sets the status code on the on the outgoing response.
2674
+ *
2675
+ * @title Set Status Code
2676
+ * @public
2677
+ * @param request - The ZuploRequest
2678
+ * @param context - The ZuploContext
2679
+ * @param options - The policy options set in policies.json
2680
+ * @param policyName - The name of the policy as set in policies.json
2681
+ * @returns A Request or a Response
2682
+ */
2683
+ export declare const SetStatusOutboundPolicy: OutboundPolicyHandler<SetStatusOutboundPolicyOptions>;
2684
+
2685
+ /**
2686
+ * The options for this policy.
2687
+ */
2688
+ export declare interface SetStatusOutboundPolicyOptions {
2689
+ /**
2690
+ * The status code to be used in the response.
2691
+ */
2692
+ status?: number;
2693
+ /**
2694
+ * The statusText to be used in the response.
2695
+ */
2696
+ statusText?: string;
2697
+ }
2698
+
2699
+ /**
2700
+ * Add a delay to the incoming request. Useful for testing.
2701
+ *
2702
+ * @title Sleep / Delay
2703
+ * @public
2704
+ * @param request - The ZuploRequest
2705
+ * @param context - The ZuploContext
2706
+ * @param options - The policy options set in policies.json
2707
+ * @param policyName - The name of the policy as set in policies.json
2708
+ * @returns A Request or a Response
2709
+ */
2710
+ export declare const SleepInboundPolicy: InboundPolicyHandler<SleepInboundPolicyOptions>;
2711
+
2712
+ /**
2713
+ * The options for this policy.
2714
+ */
2715
+ export declare interface SleepInboundPolicyOptions {
2716
+ /**
2717
+ * The number of milliseconds to delay the request.
2718
+ */
2719
+ sleepInMs: number;
2720
+ }
2721
+
2722
+ /* Excluded from this release type: StandardEnv */
2723
+
2724
+ /* Excluded from this release type: StripeMonetizationPlugin */
2725
+
2726
+ /* Excluded from this release type: StripeMonetizationPluginOptions */
2727
+
2728
+ /**
2729
+ * The Stripe Webhook policy validates the authenticity of an incoming Stripe webhook.
2730
+ *
2731
+ * @remarks
2732
+ * The Stripe Webhook policy secures your incoming webhooks by validating that
2733
+ * the request was sent by Stripe.
2734
+ *
2735
+ * @title Stripe Webhook Auth
2736
+ * @public
2737
+ * @param request - The ZuploRequest
2738
+ * @param context - The ZuploContext
2739
+ * @param options - The policy options set in policies.json
2740
+ * @param policyName - The name of the policy as set in policies.json
2741
+ * @returns A Request or a Response
2742
+ */
2743
+ export declare class StripeWebhookVerificationInboundPolicy extends InboundPolicy<StripeWebhookVerificationInboundPolicyOptions> {
2744
+ handler(
2745
+ request: ZuploRequest,
2746
+ context: ZuploContext
2747
+ ): Promise<ZuploRequest<RequestGeneric> | Response>;
2748
+ }
2749
+
2750
+ /**
2751
+ * The options for this policy.
2752
+ */
2753
+ export declare interface StripeWebhookVerificationInboundPolicyOptions {
2754
+ /**
2755
+ * The signing secret for the webhook.
2756
+ */
2757
+ signingSecret: string;
2758
+ /**
2759
+ * The allowed clock skew in seconds between the time the webhook signature was crated and the current time.
2760
+ */
2761
+ tolerance?: number;
2762
+ }
2763
+
2764
+ /* Excluded from this release type: SubscriptionMeters */
2765
+
2766
+ declare interface SumoLogicLoggingOptions {
2767
+ url: string;
2768
+ name?: string;
2769
+ category?: string;
2770
+ }
2771
+
2772
+ export declare class SumoLogicLoggingPlugin extends LogPlugin {
2773
+ private options;
2774
+ constructor(options: SumoLogicLoggingOptions);
2775
+ /* Excluded from this release type: getTransport */
2776
+ }
2777
+
2778
+ /**
2779
+ * The Supabase JWT Authentication policy supports user JWT tokens created by Supabase.
2780
+ *
2781
+ * @remarks
2782
+ * The Supabase JWT Authentication policy allows you to authenticate incoming
2783
+ * requests using a token created by {@link https://supabase.com|supabase.com}.
2784
+ *
2785
+ * When configured, you can have Zuplo check incoming requests for a JWT token and
2786
+ * automatically populate the `ZuploRequest`'s `user` property with a user object.
2787
+ *
2788
+ * This `user` object will have a `sub` property - taking the `sub` id from the JWT
2789
+ * token. It will also have a `data` property populated by other data returned in
2790
+ * the JWT token - including all your claims, `user_metadata` and `app_metadata`.
2791
+ *
2792
+ * You can also require specific claims to have specific values to allow
2793
+ * authentication to complete, providing a layer of authorization.
2794
+ *
2795
+ * @title Supabase JWT Auth
2796
+ * @public
2797
+ * @param request - The ZuploRequest
2798
+ * @param context - The ZuploContext
2799
+ * @param options - The policy options set in policies.json
2800
+ * @param policyName - The name of the policy as set in policies.json
2801
+ * @returns A Request or a Response
2802
+ */
2803
+ export declare const SupabaseJwtInboundPolicy: InboundPolicyHandler<SupabaseJwtInboundPolicyOptions>;
2804
+
2805
+ /**
2806
+ * The options for this policy.
2807
+ */
2808
+ export declare interface SupabaseJwtInboundPolicyOptions {
2809
+ /**
2810
+ * The key used to verify the signature of the JWT token.
2811
+ */
2812
+ secret: string;
2813
+ /**
2814
+ * Indicates whether the request should continue if authentication fails. Default is `false` which means unauthenticated users will automatically receive a 401 response.
2815
+ */
2816
+ allowUnauthenticatedRequests?: boolean;
2817
+ /**
2818
+ * Any claims that must be present for authentication to succeed - multiple valid values can be specified for each claim.
2819
+ */
2820
+ requiredClaims?: {
2821
+ [k: string]: string[];
2822
+ };
2823
+ }
2824
+
2825
+ /* Excluded from this release type: SYSTEM_LOGGER */
2826
+
2827
+ /* Excluded from this release type: SystemLogMap */
2828
+
2829
+ /* Excluded from this release type: SystemRouteName */
2830
+
2831
+ /* Excluded from this release type: SystemRuntimePlugin */
2832
+
2833
+ /**
2834
+ * Uses Azure Active Directory to add an Authorization header to the request in order to authenticate requests using Azure identity.
2835
+ *
2836
+ * @remarks
2837
+ * This policy adds a `Authorization` header to the upstream request that allows
2838
+ * using Azure AD to authenticate requests to your origin server. This is a useful
2839
+ * means of securing your origin server so that only your Zuplo gateway can make
2840
+ * requests against it.
2841
+ *
2842
+ * Using this policy allows you to delegate authentication and authorization to
2843
+ * your gateway without writing any code on your origin service. For instructions
2844
+ * on how to configure Azure AD authentication see
2845
+ * {@link https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad | Configure your App Service or Azure Functions app to use Azure AD login}.
2846
+ *
2847
+ * @title Upstream Azure AD Service Auth
2848
+ * @public
2849
+ * @param request - The ZuploRequest
2850
+ * @param context - The ZuploContext
2851
+ * @param options - The policy options set in policies.json
2852
+ * @param policyName - The name of the policy as set in policies.json
2853
+ * @returns A Request or a Response
2854
+ */
2855
+ export declare const UpstreamAzureAdServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamAzureAdServiceAuthInboundPolicyOptions>;
2856
+
2857
+ /**
2858
+ * The options for this policy.
2859
+ */
2860
+ export declare interface UpstreamAzureAdServiceAuthInboundPolicyOptions {
2861
+ /**
2862
+ * Azure Active Directory Tenant ID.
2863
+ */
2864
+ activeDirectoryTenantId: string;
2865
+ /**
2866
+ * The Application (client) ID of the Azure AD App Registration.
2867
+ */
2868
+ activeDirectoryClientId: string;
2869
+ /**
2870
+ * The client secret of the Azure AD App Registration.
2871
+ */
2872
+ activeDirectoryClientSecret: string;
2873
+ /**
2874
+ * The number of times to retry fetching the token in the event of a failure..
2875
+ */
2876
+ tokenRetries?: number;
2877
+ /**
2878
+ * The number of seconds less than the token expiration to cache the token.
2879
+ */
2880
+ expirationOffsetSeconds?: number;
2881
+ }
2882
+
2883
+ /**
2884
+ * Creates a Firebase Admin token and attaches it to the outgoing request. Useful when calling Firebase services as an administrator.
2885
+ *
2886
+ * @remarks
2887
+ * This policy adds a Firebase Admin token to the outgoing `Authentication` header
2888
+ * allowing requests to Firebase using Service Account admin permissions. This can
2889
+ * be useful for calling Firebase services such as Firestore through a Zuplo
2890
+ * endpoint that is secured with other means of Authentication such as API keys.
2891
+ * Additionally, this policy can be useful for service content to all API users
2892
+ * (for example serving a specific Firestore document containing configuration
2893
+ * data)
2894
+ *
2895
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
2896
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
2897
+ *
2898
+ * @title Upstream Firebase Admin Auth
2899
+ * @public
2900
+ * @param request - The ZuploRequest
2901
+ * @param context - The ZuploContext
2902
+ * @param options - The policy options set in policies.json
2903
+ * @param policyName - The name of the policy as set in policies.json
2904
+ * @returns A Request or a Response
2905
+ */
2906
+ export declare const UpstreamFirebaseAdminAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseAdminAuthInboundPolicyOptions>;
2907
+
2908
+ /**
2909
+ * The options for this policy.
2910
+ */
2911
+ export declare interface UpstreamFirebaseAdminAuthInboundPolicyOptions {
2912
+ /**
2913
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
2914
+ */
2915
+ serviceAccountJson: string;
2916
+ /**
2917
+ * The number of times to retry fetching the token in the event of a failure.
2918
+ */
2919
+ tokenRetries?: number;
2920
+ /**
2921
+ * The number of seconds less than the token expiration to cache the token.
2922
+ */
2923
+ expirationOffsetSeconds?: number;
2924
+ }
2925
+
2926
+ /**
2927
+ * Creates a Firebase custom user token and attaches it to the outgoing request. Useful when calling Firebase services as user.
2928
+ *
2929
+ * @remarks
2930
+ * This policy adds a Firebase Admin token to the outgoing `Authentication` header
2931
+ * allowing requests to Firebase using Service Account admin permissions. This can
2932
+ * be useful for calling Firebase services such as Firestore through a Zuplo
2933
+ * endpoint that is secured with other means of Authentication such as API keys.
2934
+ * Additionally, this policy can be useful for service content to all API users
2935
+ * (for example serving a specific Firestore document containing configuration
2936
+ * data)
2937
+ *
2938
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
2939
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
2940
+ *
2941
+ * @title Upstream Firebase User Auth
2942
+ * @public
2943
+ * @param request - The ZuploRequest
2944
+ * @param context - The ZuploContext
2945
+ * @param options - The policy options set in policies.json
2946
+ * @param policyName - The name of the policy as set in policies.json
2947
+ * @returns A Request or a Response
2948
+ */
2949
+ export declare const UpstreamFirebaseUserAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseUserAuthInboundPolicyOptions>;
2950
+
2951
+ /**
2952
+ * The options for this policy.
2953
+ */
2954
+ export declare interface UpstreamFirebaseUserAuthInboundPolicyOptions {
2955
+ /**
2956
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
2957
+ */
2958
+ serviceAccountJson: string;
2959
+ /**
2960
+ * The userId to use as the custom token's subject.
2961
+ */
2962
+ userId?: string;
2963
+ /**
2964
+ * The property on the incoming request.user object to retrieve the value of the userId.
2965
+ */
2966
+ userIdPropertyPath?: string;
2967
+ /**
2968
+ * Additional claims to include in the custom token's payload.
2969
+ */
2970
+ developerClaims?: Record<string, string | number | boolean | null>;
2971
+ /**
2972
+ * The Firebase Web API Key (found in project settings)
2973
+ * @see {@link https://firebase.google.com/docs/projects/api-keys|Firebase API Keys}.
2974
+ */
2975
+ webApiKey: string;
2976
+ /**
2977
+ * The number of times to retry fetching the token in the event of a failure.
2978
+ */
2979
+ tokenRetries?: number;
2980
+ /**
2981
+ * The number of seconds less than the token expiration to cache the token.
2982
+ */
2983
+ expirationOffsetSeconds?: number;
2984
+ }
2985
+
2986
+ /**
2987
+ * Creates a self-signed JWT token (generated using a Google Service Account JSON) and attaches it to the outgoing request. Useful when calling GCP services like Cloud Endpoints / ESPv2
2988
+ *
2989
+ * @remarks
2990
+ * This policy adds a JWT token to the headers, ready for us in an outgoing request
2991
+ * when calling a GCP service (e.g. Cloud Endpoints / ESPv2). We recommend reading
2992
+ * the `serviceAccountJson` from environment variables (so it is not checked in to
2993
+ * source control) using the `$env(ENV_VAR)` syntax.
2994
+ *
2995
+ * CAUTION: This policy only works with {@link https://developers.google.com/identity/protocols/oauth2/service-account#jwt-auth | certain Google APIs}.
2996
+ * In most cases, the {@link https://zuplo.com/docs/policies/upstream-gcp-service-auth-inbound | Upstream GCP Service Auth}
2997
+ * should be used.
2998
+ *
2999
+ * @title Upstream GCP Self-Signed JWT
3000
+ * @public
3001
+ * @param request - The ZuploRequest
3002
+ * @param context - The ZuploContext
3003
+ * @param options - The policy options set in policies.json
3004
+ * @param policyName - The name of the policy as set in policies.json
3005
+ * @returns A Request or a Response
3006
+ */
3007
+ export declare const UpstreamGcpJwtInboundPolicy: InboundPolicyHandler<UpstreamGcpJwtInboundPolicyOptions>;
3008
+
3009
+ /**
3010
+ * The options for this policy.
3011
+ */
3012
+ export declare interface UpstreamGcpJwtInboundPolicyOptions {
3013
+ /**
3014
+ * The audience for the minted JWT. See the document {@link https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#google.api.AuthRequirement|AuthRequirement} for details.
3015
+ */
3016
+ audience: string;
3017
+ /**
3018
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
3019
+ */
3020
+ serviceAccountJson: string;
3021
+ }
3022
+
3023
+ /**
3024
+ * Creates an ID Token from Google's OAuth service and attaches it to the outgoing request. Useful when calling GCP services or Google APIs that are secured with GCP IAM.
3025
+ *
3026
+ * @remarks
3027
+ * This policy allows you to delegate authentication and authorization to your
3028
+ * gateway without writing any code on your origin service by adding a GCP Issued
3029
+ * ID Token to outgoing header allowing the service to be secured with GCP IAM.
3030
+ * This is a useful means of securing your origin server so that only your Zuplo
3031
+ * gateway can make requests against it.
3032
+ *
3033
+ *
3034
+ * This policy works with
3035
+ * {@link https://zuplo.com/docs/articles/gke-with-upstream-auth-policy|GCP Identity Aware Proxy}
3036
+ * or services like {@link https://cloud.google.com/iap/docs/managing-access|Cloud Run}
3037
+ * that natively support IAM authorization.
3038
+ *
3039
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
3040
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
3041
+ *
3042
+ * For information on how Google's service based auth works see {@link https://cloud.google.com/functions/docs/securing/authenticating|Authenticating for invocation}
3043
+ *
3044
+ * @title Upstream GCP Service Auth
3045
+ * @public
3046
+ * @param request - The ZuploRequest
3047
+ * @param context - The ZuploContext
3048
+ * @param options - The policy options set in policies.json
3049
+ * @param policyName - The name of the policy as set in policies.json
3050
+ * @returns A Request or a Response
3051
+ */
3052
+ export declare const UpstreamGcpServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamGcpServiceAuthInboundPolicyOptions>;
3053
+
3054
+ /**
3055
+ * The options for this policy.
3056
+ */
3057
+ export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
3058
+ /**
3059
+ * The audience for the service to be called. This is typically the URL of your service endpoint like 'https://my-service-a2ev-uc.a.run.app'. If calling a Google API, leave this empty.
3060
+ */
3061
+ audience?: string;
3062
+ /**
3063
+ * The scopes to grant the access token. See {@link https://developers.google.com/identity/protocols/oauth2/scopes|documentation} for details. This is only set with calling a Google API. If calling a service like Cloud Run, etc. leave this empty.
3064
+ */
3065
+ scopes?: string[];
3066
+ /**
3067
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the `$env(ENV_VAR)` syntax.
3068
+ * @see {@link https://developers.google.com/workspace/guides/create-credentials|Create access credentials}.
3069
+ */
3070
+ serviceAccountJson: string;
3071
+ /**
3072
+ * The number of times to retry fetching the token in the event of a failure.
3073
+ */
3074
+ tokenRetries?: number;
3075
+ /**
3076
+ * The number of seconds less than the token expiration to cache the token.
3077
+ */
3078
+ expirationOffsetSeconds?: number;
3079
+ /**
3080
+ * This is an advanced option that should only be used if you do not want to persist information in ZoneCache.
3081
+ */
3082
+ useMemoryCacheOnly?: boolean;
3083
+ }
3084
+
3085
+ /* Excluded from this release type: urlForwardHandler */
3086
+
3087
+ /* Excluded from this release type: urlRewriteHandler */
3088
+
3089
+ declare type UserDataDefault = any;
3090
+
3091
+ /* Excluded from this release type: ValidateFunction */
3092
+
3093
+ /**
3094
+ * Validates the body of an incoming request based on a JSON schema.
3095
+ *
3096
+ * @remarks
3097
+ * The Validate JSON Schema policy is used to validate the body of incoming
3098
+ * requests. It works using JSON Schemas defined in the `Schemas` folder of your
3099
+ * project.
3100
+ *
3101
+ * When configured, any requests that do not have a body conforming to your JSON
3102
+ * schema will be rejected with a `400: Bad Request` response containing a detailed
3103
+ * error message (in JSON) explaining why the body was not accepted.
3104
+ *
3105
+ * @title JSON Body Validation
3106
+ * @public
3107
+ * @deprecated Use the new {@link https://zuplo.com/docs/policies/request-validation-inbound|Request Validation Policy}.
3108
+ * The new policy validates JSON bodies like this policy, but also supports validation of parameters, query strings, etc.
3109
+ * @param request - The ZuploRequest
3110
+ * @param context - The ZuploContext
3111
+ * @param options - The policy options set in policies.json
3112
+ * @param policyName - The name of the policy as set in policies.json
3113
+ * @returns A Request or a Response
3114
+ */
3115
+ export declare const ValidateJsonSchemaInbound: InboundPolicyHandler<ValidateJsonSchemaInboundInternalOptions>;
3116
+
3117
+ /* Excluded from this release type: ValidateJsonSchemaInboundInternalOptions */
3118
+
3119
+ /**
3120
+ * The options for this policy.
3121
+ */
3122
+ export declare interface ValidateJsonSchemaInboundOptions {
3123
+ /**
3124
+ * The JSON schema to validate against.
3125
+ */
3126
+ validator: string;
3127
+ }
3128
+
3129
+ /**
3130
+ * The action to perform when validation fails.
3131
+ */
3132
+ declare type ValidationOptions =
3133
+ | "none"
3134
+ | "log-only"
3135
+ | "reject-and-log"
3136
+ | "reject-only";
3137
+
3138
+ /**
3139
+ * The action to perform when validation fails.
3140
+ */
3141
+ declare type ValidationOptions1 =
3142
+ | "none"
3143
+ | "log-only"
3144
+ | "reject-and-log"
3145
+ | "reject-only";
3146
+
3147
+ /**
3148
+ * The action to perform when validation fails.
3149
+ */
3150
+ declare type ValidationOptions2 =
3151
+ | "none"
3152
+ | "log-only"
3153
+ | "reject-and-log"
3154
+ | "reject-only";
3155
+
3156
+ /**
3157
+ * The action to perform when validation fails.
3158
+ */
3159
+ declare type ValidationOptions3 =
3160
+ | "none"
3161
+ | "log-only"
3162
+ | "reject-and-log"
3163
+ | "reject-only";
3164
+
3165
+ export declare interface VersionData {
3166
+ name: string;
3167
+ pathPrefix: string;
3168
+ info?: OpenAPIV3_1.InfoObject;
3169
+ /**
3170
+ * The project relative path to the OpenAPI spec.
3171
+ */
3172
+ openApiFile?: string;
3173
+ tags?: Omit<OpenAPIV3_1.TagObject, "externalDocs">[];
3174
+ /**
3175
+ * If false, OpenAPI documentation will not be generated for this version. If openApiFile is set this setting is ignored.
3176
+ */
3177
+ excludeFromOpenApi?: boolean;
3178
+ /**
3179
+ * If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.
3180
+ */
3181
+ enforceOpenApi?: boolean;
3182
+ }
3183
+
3184
+ declare interface VMWareLogInsightLoggingOptions {
3185
+ url: string;
3186
+ /**
3187
+ * An array of string tuples to replace within the text field of a log entry.
3188
+ * @example
3189
+ * ```
3190
+ * [
3191
+ * ["'", ""],
3192
+ * ['"', ""],
3193
+ * ["\\n", ""],
3194
+ * ["\\", ""],
3195
+ * ["*", ""],
3196
+ * ["&", ""],
3197
+ * [":", "="],
3198
+ * ]
3199
+ * ```
3200
+ */
3201
+ textReplacements?: [string, string][];
3202
+ /**
3203
+ * The unique agent identifier of the logger.
3204
+ */
3205
+ agentId?: string;
3206
+ fields?: Record<string, string | number | boolean>;
3207
+ onMessageSending?: (event: LogInsightLogEntry) => LogInsightLogEntry;
3208
+ }
3209
+
3210
+ export declare class VMWareLogInsightLoggingPlugin extends LogPlugin {
3211
+ private options;
3212
+ constructor(options: VMWareLogInsightLoggingOptions);
3213
+ /* Excluded from this release type: getTransport */
3214
+ }
3215
+
3216
+ declare interface WaitUntilFunc {
3217
+ (promise: Promise<any>): void;
3218
+ }
3219
+
3220
+ /* Excluded from this release type: webSocketHandler */
3221
+
3222
+ /* Excluded from this release type: webSocketPipelineHandler */
3223
+
3224
+ /**
3225
+ * Parses XML and converts it to JSON. This policy is useful for converting
3226
+ * legacy XML or SOAP APIs into modern REST APIs. It can be useful to add a
3227
+ * custom outbound policy that runs after this policy to further transform the
3228
+ * raw converted content into something more user friendly.
3229
+ *
3230
+ * @title XML to JSON Outbound
3231
+ * @public
3232
+ * @param request - The ZuploRequest
3233
+ * @param context - The ZuploContext
3234
+ * @param options - The policy options set in policies.json
3235
+ * @param policyName - The name of the policy as set in policies.json
3236
+ * @returns A Request or a Response
3237
+ */
3238
+ export declare class XmlToJsonOutboundPolicy extends OutboundPolicy<XmlToJsonPolicyOptions> {
3239
+ private parser;
3240
+ private parseOnStatusCodes;
3241
+ constructor(options: XmlToJsonPolicyOptions, policyName: string);
3242
+ handler(
3243
+ response: Response,
3244
+ request: ZuploRequest,
3245
+ context: ZuploContext
3246
+ ): Promise<Response>;
3247
+ }
3248
+
3249
+ /**
3250
+ * The options for this policy.
3251
+ */
3252
+ export declare interface XmlToJsonPolicyOptions {
3253
+ /**
3254
+ * Remove namespace string from tag and attribute names.
3255
+ */
3256
+ removeNSPrefix?: boolean;
3257
+ /**
3258
+ * Ignore processing instruction tags. i.e. `<?elementnames <fred>, <bert>, <harry> ?>`.
3259
+ */
3260
+ ignoreProcessingInstructions?: boolean;
3261
+ /**
3262
+ * Ignore declarations. i.e. `<?xml version="1.0"?>`.
3263
+ */
3264
+ ignoreDeclarations?: boolean;
3265
+ /**
3266
+ * Ignore tag attributes.
3267
+ */
3268
+ ignoreAttributes?: boolean;
3269
+ /**
3270
+ * At particular point, if you don't want to parse a tag and it's nested tags then you can set their path in stopNodes. You can also set tags which should not be processed irrespective of their path using * as the wildcard.
3271
+ */
3272
+ stopNodes?: string[];
3273
+ /**
3274
+ * The prefix of attribute names in the resulting JS object.
3275
+ */
3276
+ attributeNamePrefix?: string;
3277
+ /**
3278
+ * Text value of a tag is parsed to #text property by default.
3279
+ */
3280
+ textNodeName?: string;
3281
+ /**
3282
+ * Remove surrounding whitespace from tag or attribute value.
3283
+ */
3284
+ trimValues?: boolean;
3285
+ /**
3286
+ * A list of status codes and ranges "200-299, 304" that should the XML parser should run on. If not set, the parser will run on all status codes.
3287
+ */
3288
+ parseOnStatusCodes?: string | number[];
3289
+ }
3290
+
3291
+ /**
3292
+ * This is a simple wrapper around the data-center HTTP cache
3293
+ * to enable simple objects to be stored by a string key. This is
3294
+ * useful to us and customers and provides a very high-performance
3295
+ * read-through cache that stores data in the same data-center. It is
3296
+ * not replicated.
3297
+ */
3298
+ export declare class ZoneCache<T = any> {
3299
+ #private;
3300
+ constructor(name: string, context: ZuploContext);
3301
+ /* Excluded from this release type: __constructor */
3302
+ get(key: string): Promise<T | undefined>;
3303
+ put(key: string, data: T, ttlSeconds: number): Promise<void>;
3304
+ delete(key: string): Promise<void>;
3305
+ deleteFallback(key: string): Promise<void>;
3306
+ logDebug(...messages: unknown[]): void;
3307
+ }
3308
+
3309
+ /* Excluded from this release type: ZuploContext */
3310
+
3311
+ declare interface ZuploEventContext {
3312
+ waitUntil: WaitUntilFunc;
3313
+ }
3314
+
3315
+ /**
3316
+ * ZuploRequest includes various parsed objects from the
3317
+ * incoming Request. This object inherits from the web
3318
+ * standard {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request}.
3319
+ * @public
3320
+ */
3321
+ export declare class ZuploRequest<
3322
+ TOptions extends RequestGeneric = RequestGeneric,
3323
+ > extends Request {
3324
+ #private;
3325
+ constructor(input: string | Request, init?: ZuploRequestInit<TOptions>);
3326
+ /**
3327
+ * A dictionary of query-string values
3328
+ *
3329
+ * @example
3330
+ * The url `https://example.com?foo=bar` would return
3331
+ * the following query object:
3332
+ *
3333
+ * ```
3334
+ * const foo = request.query.foo;
3335
+ * ```
3336
+ *
3337
+ * @readonly
3338
+ */
3339
+ get query(): Readonly<ResolveRequestQuery<TOptions["Query"]>>;
3340
+ /**
3341
+ * If you use tokens in your route’s URL, they are
3342
+ * automatically parsed into properties on the params
3343
+ * property of your request.
3344
+ *
3345
+ * @example
3346
+ * The route `/products/:productId/vendors/:vendorId`
3347
+ * would include two params:
3348
+ *
3349
+ * ```
3350
+ * const productId = request.params.productId;
3351
+ * const vendorId = request.params.vendorId;
3352
+ * ```
3353
+ * @readonly
3354
+ */
3355
+ get params(): Readonly<ResolveRequestParams<TOptions["Params"]>>;
3356
+ /**
3357
+ * An optional object identifying a ‘user’.
3358
+ *
3359
+ * @remarks
3360
+ * If undefined this typically means the request is
3361
+ * anonymous. If present, the user object will have
3362
+ * a sub property that is a unique identifier for
3363
+ * that user. There is also an optional data property
3364
+ * that is of any type that typically contains other
3365
+ * information about the user. When using JWT tokens
3366
+ * you’ll usually find all the claims here.
3367
+ *
3368
+ * @readonly
3369
+ */
3370
+ user?: RequestUser<ResolveUserData<TOptions["UserData"]>>;
3371
+ }
3372
+
3373
+ /**
3374
+ * The initialization values of a request
3375
+ * @public
3376
+ */
3377
+ declare interface ZuploRequestInit<
3378
+ TOptions extends RequestInitGeneric = RequestInitGeneric,
3379
+ > extends RequestInit {
3380
+ params?: ResolveRequestParams<TOptions["Params"]>;
3381
+ user?: ResolveUserData<TOptions["UserData"]>;
3382
+ }
3383
+
3384
+ export {};