@zuplo/runtime 5.1917.0 → 5.1922.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.
package/index.d.ts DELETED
@@ -1,4513 +0,0 @@
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(request: ZuploRequest, context: ZuploContext, options: AmberfloMeteringInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric>>;
25
-
26
- /**
27
- * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
28
- */
29
- export declare interface AmberfloMeteringInboundPolicyOptions {
30
- /**
31
- * The API key to use when sending metering calls to Amberflo.
32
- */
33
- apiKey: string;
34
- /**
35
- * The name of the meter to use when sending metering calls to Amberflo (overridable in code).
36
- */
37
- meterApiName?: string;
38
- /**
39
- * The value to use when sending metering calls to Amberflo (overridable in code).
40
- */
41
- meterValue?: number;
42
- /**
43
- * The path to the property on `request.user` contains the customer ID. For example `.data.accountNumber` would read the `request.user.data.accountNumber` property.
44
- */
45
- customerIdPropertyPath?: string;
46
- /**
47
- * The default customerId for all metering calls - overridable in code and by `customerIdPropertyPath`.
48
- */
49
- customerId?: string;
50
- /**
51
- * A dictionary of dimensions to be sent to Amberflo (extensible in code).
52
- */
53
- dimensions?: {
54
- [k: string]: string;
55
- };
56
- /**
57
- * A list of successful status codes and ranges "200-299, 304" that should trigger a metering call to Amberflo.
58
- */
59
- statusCodes?: string | number[];
60
- /**
61
- * The URL to send metering events. This is useful for testing purposes.
62
- */
63
- url?: string;
64
- }
65
-
66
- declare interface AmberfloMeteringIngestPayload {
67
- customerId: string;
68
- meterApiName: string;
69
- meterValue: number;
70
- meterTimeInMillis: number;
71
- dimensions: Record<string, string>;
72
- }
73
-
74
- export declare class AmberfloMeteringPolicy {
75
- static setRequestProperties(context: ZuploContext, properties: AmberfloMeteringProperties): void;
76
- }
77
-
78
- declare interface AmberfloMeteringProperties extends Omit<AmberfloMeteringIngestPayload, "meterTimeInMillis"> {
79
- customerId: string;
80
- }
81
-
82
- /* Excluded from this release type: API_KEY */
83
-
84
- /**
85
- * Authenticates requests based on API Keys using Zuplo API Management. You
86
- * can learn more about the Zuplo API Key Service
87
- * [here](https://zuplo.com/docs/articles/api-key-api#buckets)
88
- *
89
- * @remarks
90
- * This policy uses the managed API key storage provided by Zuplo.
91
- * `allowUnauthenticatedRequests` defaults to false and rejects any request without
92
- * a valid API key (returning a `401 - Unauthorized` response). You can override
93
- * (set `"allowUnauthenticatedRequests" : true`) this to support multiple
94
- * authentication methods or support both authenticated and anonymous requests.
95
- *
96
- * @deprecated Please use the new {@link https://zuplo.com/docs/policies/api-key-inbound|API Key Authentication} policy
97
- * instead. This policy will continue to work but will be removed in a future
98
- * version of Zuplo.
99
- *
100
- * @title API Key Authentication
101
- * @public
102
- * @param request - The ZuploRequest
103
- * @param context - The ZuploContext
104
- * @param unparsedOptions - The policy options set in policies.json
105
- * @param policyName - The name of the policy as set in policies.json
106
- * @returns A Request or a Response
107
- */
108
- export declare const ApiAuthKeyInboundPolicy: typeof ApiKeyInboundPolicy;
109
-
110
- /**
111
- * @deprecated
112
- * The options for this policy.
113
- */
114
- export declare interface ApiAuthKeyInboundPolicyOptions {
115
- /**
116
- * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401.
117
- */
118
- allowUnauthenticatedRequests?: boolean;
119
- }
120
-
121
- /**
122
- * 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)
123
- *
124
- * @remarks
125
- * Authenticate requests with Zuplo's fully managed API Key service. This policy is
126
- * the easiest way to secure your API and can be combined with other policies like
127
- * Rate limiting, quotas, and more to build a fully featured API to support your
128
- * partners, developers, or customers.
129
- *
130
- * For more information on Zuplo's API Key Management service and options enabling
131
- * self-serve API Key management see the following resources:
132
- *
133
- * - {@link https://zuplo.com/docs/articles/api-key-management|API Key Authentication Overview}
134
- * - {@link https://zuplo.com/docs/articles/api-key-api|API Key Management API}
135
- *
136
- * @title API Key Authentication
137
- * @public
138
- * @param request - The ZuploRequest
139
- * @param context - The ZuploContext
140
- * @param unparsedOptions - The policy options set in policies.json
141
- * @param policyName - The name of the policy as set in policies.json
142
- * @returns A Request or a Response
143
- */
144
- export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
145
-
146
- /**
147
- * The options for this policy.
148
- */
149
- export declare interface ApiKeyInboundPolicyOptions {
150
- /**
151
- * The name of the header with the key.
152
- */
153
- authHeader?: string;
154
- /**
155
- * The scheme used on the header.
156
- */
157
- authScheme?: string;
158
- /**
159
- * The name of the API Key service bucket. Defaults to the autogenerated bucket name for your project.
160
- */
161
- bucketName?: string;
162
- /**
163
- * 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.
164
- */
165
- allowUnauthenticatedRequests?: boolean;
166
- /**
167
- * 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.
168
- */
169
- cacheTtlSeconds?: number;
170
- /**
171
- * Zuplo will automatically document your API key header within your OpenAPI specification & Developer Portal. Set this to `true` to disable this behavior.
172
- */
173
- disableAutomaticallyAddingKeyHeaderToOpenApi?: boolean;
174
- }
175
-
176
- /**
177
- * @beta
178
- */
179
- export declare interface ApiKeyValidationResult {
180
- isValid: boolean;
181
- metadata?: object;
182
- }
183
-
184
- export declare interface AuditLogDataStaxInit {
185
- url: string;
186
- xCassandraToken: string;
187
- }
188
-
189
- export declare class AuditLogDataStaxProvider implements AuditLogOutputProvider {
190
- #private;
191
- constructor(options: AuditLogDataStaxInit);
192
- writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
193
- }
194
-
195
- declare interface AuditLogEntry {
196
- timestamp: Date;
197
- durationMs: number;
198
- routePath: string;
199
- requestId: string;
200
- userSub?: string;
201
- request: {
202
- url: string;
203
- method: HttpMethod;
204
- headers?: Record<string, string>;
205
- body?: string;
206
- };
207
- response: {
208
- status: number;
209
- statusText: string;
210
- headers?: Record<string, string>;
211
- body?: string;
212
- };
213
- }
214
-
215
- export declare interface AuditLogInit {
216
- requestFilter?: AuditLogRequestFilter;
217
- include?: {
218
- request?: {
219
- headers?: boolean;
220
- body?: boolean;
221
- };
222
- response?: {
223
- headers?: boolean;
224
- body?: boolean;
225
- };
226
- };
227
- }
228
-
229
- declare interface AuditLogOutputProvider {
230
- writeLogBatch: (entries: AuditLogEntry[]) => Promise<void>;
231
- }
232
-
233
- export declare class AuditLogPlugin extends SystemRuntimePlugin {
234
- #private;
235
- constructor(outputProvider: AuditLogOutputProvider, init?: AuditLogInit);
236
- initialize(runtimeInit: RuntimeExtensions): Promise<void>;
237
- }
238
-
239
- declare interface AuditLogRequestFilter {
240
- (request: ZuploRequest, context: ZuploContext): Promise<boolean>;
241
- }
242
-
243
- /**
244
- * Authenticate users using Auth0 issued JWT tokens.
245
- *
246
- * @remarks
247
- * Authenticate requests with JWT tokens issued by Auth0. This is a customized
248
- * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
249
- * for Auth0.
250
- *
251
- * @title Auth0 JWT Auth
252
- * @public
253
- * @param request - The ZuploRequest
254
- * @param context - The ZuploContext
255
- * @param options - The policy options set in policies.json
256
- * @param policyName - The name of the policy as set in policies.json
257
- * @returns A Request or a Response
258
- */
259
- export declare const Auth0JwtInboundPolicy: InboundPolicyHandler<Auth0JwtInboundPolicyOptions>;
260
-
261
- /**
262
- * The options for this policy.
263
- */
264
- export declare interface Auth0JwtInboundPolicyOptions {
265
- /**
266
- * 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.
267
- */
268
- allowUnauthenticatedRequests?: boolean;
269
- /**
270
- * Your Auth0 domain. For example, `my-company.auth0.com`.
271
- */
272
- auth0Domain: string;
273
- /**
274
- * The Auth0 audience of your API, for example `https://api.example.com/`.
275
- */
276
- audience?: string;
277
- }
278
-
279
- declare interface AwsLambdaEventV1 {
280
- [key: string]: string | null | undefined | number | boolean | object;
281
- version: "1.0";
282
- resource: string;
283
- path: string;
284
- httpMethod: string;
285
- headers: Record<string, string>;
286
- multiValueHeaders: Record<string, string[]>;
287
- queryStringParameters: Record<string, string>;
288
- multiValueQueryStringParameters: Record<string, string[]>;
289
- requestContext: {
290
- accountId: string | null;
291
- apiId: string | null;
292
- authorizer: {
293
- claims: Record<string, string>;
294
- scopes: string[];
295
- };
296
- domainName: string;
297
- domainPrefix: string | null;
298
- extendedRequestId: string;
299
- httpMethod: string;
300
- identity: {
301
- accessKey: null | string;
302
- accountId: null | string;
303
- caller: null | string;
304
- cognitoAuthenticationProvider: null | string;
305
- cognitoAuthenticationType: null | string;
306
- cognitoIdentityId: null | string;
307
- cognitoIdentityPoolId: null | string;
308
- principalOrgId: null | string;
309
- sourceIp: string | null;
310
- user: null | string;
311
- userAgent: string | null;
312
- userArn: null | string;
313
- clientCert: {
314
- clientCertPem: null | string;
315
- subjectDN: null | string;
316
- issuerDN: null | string;
317
- serialNumber: null | string;
318
- validity: {
319
- notBefore: null | string;
320
- notAfter: null | string;
321
- };
322
- };
323
- };
324
- path: string;
325
- protocol: string;
326
- requestId: string;
327
- requestTime: string;
328
- requestTimeEpoch: number;
329
- resourceId: string | null;
330
- resourcePath: string;
331
- stage: null | string;
332
- };
333
- pathParameters: Record<string, string>;
334
- stageVariables: null | Record<string, string>;
335
- }
336
-
337
- declare interface AwsLambdaEventV2 {
338
- [key: string]: string | null | undefined | number | boolean | object;
339
- version: "2.0";
340
- routeKey: string | null;
341
- rawPath: string;
342
- rawQueryString: string;
343
- cookies: string[];
344
- headers: Record<string, string>;
345
- queryStringParameters: Record<string, string>;
346
- requestContext: {
347
- accountId: string | null;
348
- apiId: string | null;
349
- authentication: {
350
- clientCert: {
351
- clientCertPem: string | null;
352
- subjectDN: string | null;
353
- issuerDN: string | null;
354
- serialNumber: string | null;
355
- validity: {
356
- notBefore: string | null;
357
- notAfter: string | null;
358
- };
359
- };
360
- };
361
- authorizer: {
362
- jwt: {
363
- claims: Record<string, string>;
364
- scopes: string[];
365
- };
366
- };
367
- domainName: string | null;
368
- domainPrefix: string | null;
369
- http: {
370
- method: string;
371
- path: string;
372
- protocol: string;
373
- sourceIp: string | null;
374
- userAgent: string | null;
375
- };
376
- requestId: string;
377
- routeKey: string | null;
378
- stage: null;
379
- time: string;
380
- timeEpoch: number;
381
- };
382
- pathParameters: Record<string, string>;
383
- stageVariables: string | null;
384
- }
385
-
386
- /**
387
- * Proxy requests to a different url
388
- * @param request - The ZuploRequest
389
- * @param context - The ZuploContext
390
- * @returns
391
- * @beta
392
- */
393
- export declare function awsLambdaHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
394
-
395
- export declare const AwsLambdaHandlerExtensions: {
396
- addSendingAwsLambdaEventHook: (hook: OnSendingAwsLambdaEventHook) => void;
397
- };
398
-
399
- declare interface AWSLoggingOptions {
400
- region: string;
401
- accessKeyId: string;
402
- secretAccessKey: string;
403
- logGroupName: string;
404
- logStreamName: string;
405
- }
406
-
407
- export declare class AWSLoggingPlugin extends LogPlugin {
408
- private options;
409
- constructor(options: AWSLoggingOptions);
410
- getTransport(): LogTransport;
411
- }
412
-
413
- export declare class BackgroundDispatcher<TPayload> {
414
- #private;
415
- constructor(dispatcher: DispatchFunction<TPayload>, options: BatchDispatcherOptions);
416
- enqueue: (payload: TPayload) => void;
417
- }
418
-
419
- export declare class BackgroundLoader<T = unknown> {
420
- #private;
421
- constructor(loader: BackgroundLoaderFunction<T>, ttlSeconds: number);
422
- get(key: string): Promise<T>;
423
- }
424
-
425
- declare interface BackgroundLoaderFunction<T> {
426
- (key: string): Promise<T>;
427
- }
428
-
429
- /**
430
- * @beta
431
- */
432
- declare abstract class BaseCryptoBeta {
433
- abstract digest(algorithm: string, data: string): Promise<string>;
434
- }
435
-
436
- /**
437
- * @beta
438
- */
439
- declare abstract class BaseKeyValueStore {
440
- protected context: ZuploContext;
441
- constructor(context: ZuploContext);
442
- abstract put(key: string, value: string, options?: KeyValueStorePutOptions): Promise<void>;
443
- abstract get(key: string, options?: KevValueStoreGetOptions): Promise<string | null>;
444
- abstract delete(key: string): Promise<void>;
445
- }
446
-
447
- /**
448
- * An account object.
449
- */
450
- declare interface BasicAuthAccount {
451
- /**
452
- * The username for the account (this will be the `sub` property on `request.user`.
453
- */
454
- username: string;
455
- /**
456
- * The password for the account - note we recommend storing this in environment variables.
457
- */
458
- password: string;
459
- /**
460
- * The data payload you want associated with this account (this will be the `data` property on `request.user`).
461
- */
462
- data?: {
463
- [k: string]: unknown;
464
- };
465
- }
466
-
467
- /**
468
- * Authenticate requests using basic auth (i.e. username and password)
469
- *
470
- * @remarks
471
- * The Basic Authentication policy allows you to authenticate incoming requests
472
- * using the Basic authentication standard. You can configure multiple accounts
473
- * with different passwords and a different bucket of user 'data'.
474
- *
475
- * The API will expect a Basic Auth header (you can generate samples
476
- * {@link https://www.debugbear.com/basic-auth-header-generator|here}). Requests with
477
- * invalid credentials (or no header) will not be authenticated. Authenticated
478
- * requests will populate the `user` property of the `ZuploRequest` parameter on
479
- * your RequestHandler.
480
- *
481
- * @title Basic Auth
482
- * @public
483
- * @param request - The ZuploRequest
484
- * @param context - The ZuploContext
485
- * @param options - The policy options set in policies.json
486
- * @param policyName - The name of the policy as set in policies.json
487
- * @returns A Request or a Response
488
- */
489
- export declare const BasicAuthInboundPolicy: InboundPolicyHandler<BasicAuthInboundPolicyOptions>;
490
-
491
- /**
492
- * The options for this policy.
493
- */
494
- export declare interface BasicAuthInboundPolicyOptions {
495
- /**
496
- * An array of account objects (username, password and data properties).
497
- */
498
- accounts: BasicAuthAccount[];
499
- /**
500
- * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401.
501
- */
502
- allowUnauthenticatedRequests?: boolean;
503
- }
504
-
505
- /* Excluded from this release type: BatchDispatch */
506
-
507
- declare interface BatchDispatcherOptions {
508
- msDelay: number;
509
- name?: string;
510
- }
511
-
512
- /* Excluded from this release type: BuildEnvironment */
513
-
514
- declare interface BuildRouteConfiguration {
515
- path: string;
516
- methods: HttpMethod[];
517
- /**
518
- /* @deprecated This property is not used and will be removed in future versions
519
- */
520
- label?: string;
521
- /**
522
- /* @deprecated This property is not used and will be removed in future versions
523
- */
524
- key?: string;
525
- handler: HandlerDefinition;
526
- corsPolicy?: CorsPolicy;
527
- /**
528
- /* @deprecated This property is deprecated. Use route.raw() instead.
529
- */
530
- custom?: any;
531
- /**
532
- /* @deprecated This property is not used and will be removed in future versions
533
- */
534
- version: string;
535
- policies?: {
536
- inbound?: string[];
537
- outbound?: string[];
538
- };
539
- /**
540
- /* @deprecated This property is deprecated. Use route.raw() instead.
541
- */
542
- excludeFromOpenApi?: boolean;
543
- pathPattern?: string;
544
- /* Excluded from this release type: raw */
545
- }
546
-
547
- /**
548
- * Internal
549
- */
550
- declare interface CacheOptions {
551
- logger?: Logger;
552
- }
553
-
554
- /**
555
- * Respond to matched incoming requests with cached content
556
- *
557
- * @title Caching
558
- * @public
559
- * @param request - The ZuploRequest
560
- * @param context - The ZuploContext
561
- * @param options - The policy options set in policies.json
562
- * @param policyName - The name of the policy as set in policies.json
563
- * @returns A Request or a Response
564
- */
565
- export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
566
-
567
- /**
568
- * The options for this policy.
569
- */
570
- export declare interface CachingInboundPolicyOptions {
571
- /**
572
- * 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.
573
- */
574
- cacheId?: string;
575
- /**
576
- * By default, the Authorization header is always considered in the caching policy. You can disable by setting this to `true`.
577
- */
578
- dangerouslyIgnoreAuthorizationHeader?: boolean;
579
- /**
580
- * The headers to be considered when caching.
581
- */
582
- headers?: string[];
583
- /**
584
- * HTTP Methods to be cached. Valid methods are: GET, POST, PUT, PATCH, DELETE, HEAD.
585
- */
586
- cacheHttpMethods?: ("GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD")[];
587
- /**
588
- * The timeout of the cache in seconds.
589
- */
590
- expirationSecondsTtl?: number;
591
- /**
592
- * Response status codes to be cached.
593
- */
594
- statusCodes?: number[];
595
- }
596
-
597
- /**
598
- * Changes the HTTP method of the incoming request.
599
- *
600
- * @title Change Method
601
- * @public
602
- * @param request - The ZuploRequest
603
- * @param context - The ZuploContext
604
- * @param options - The policy options set in policies.json
605
- * @param policyName - The name of the policy as set in policies.json
606
- * @returns A Request or a Response
607
- */
608
- export declare const ChangeMethodInboundPolicy: InboundPolicyHandler<ChangeMethodInboundPolicyOptions>;
609
-
610
- /**
611
- * The options for this policy.
612
- */
613
- export declare interface ChangeMethodInboundPolicyOptions {
614
- /**
615
- * The HTTP Method to be used, e.g. POST, GET, PUT, PATCH, etc.
616
- */
617
- method: string;
618
- }
619
-
620
- /**
621
- * Removes all headers from the incoming request except for those in the exclude list.
622
- *
623
- * @title Clear Request Headers
624
- * @public
625
- * @param request - The ZuploRequest
626
- * @param context - The ZuploContext
627
- * @param options - The policy options set in policies.json
628
- * @param policyName - The name of the policy as set in policies.json
629
- * @returns A Request or a Response
630
- */
631
- export declare const ClearHeadersInboundPolicy: InboundPolicyHandler<ClearHeadersInboundPolicyOptions>;
632
-
633
- /**
634
- * The options for this policy.
635
- */
636
- export declare interface ClearHeadersInboundPolicyOptions {
637
- /**
638
- * The headers that should not be removed.
639
- */
640
- exclude?: string[];
641
- }
642
-
643
- /**
644
- * Removes all headers from the response except for those in the exclude list.
645
- *
646
- * @title Clear Response Headers
647
- * @public
648
- * @param request - The ZuploRequest
649
- * @param context - The ZuploContext
650
- * @param options - The policy options set in policies.json
651
- * @param policyName - The name of the policy as set in policies.json
652
- * @returns A Request or a Response
653
- */
654
- export declare const ClearHeadersOutboundPolicy: OutboundPolicyHandler<ClearHeadersOutboundPolicyOptions>;
655
-
656
- /**
657
- * The options for this policy.
658
- */
659
- export declare interface ClearHeadersOutboundPolicyOptions {
660
- /**
661
- * The headers that should not be removed.
662
- */
663
- exclude?: string[];
664
- }
665
-
666
- /**
667
- * Authenticate users using Clerk issued JWT tokens.
668
- *
669
- * @remarks
670
- * Authenticate requests with JWT tokens issued by Clerk. This is a customized
671
- * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
672
- * for Clerk.
673
- *
674
- * @title Clerk JWT Auth
675
- * @public
676
- * @param request - The ZuploRequest
677
- * @param context - The ZuploContext
678
- * @param options - The policy options set in policies.json
679
- * @param policyName - The name of the policy as set in policies.json
680
- * @returns A Request or a Response
681
- */
682
- export declare const ClerkJwtInboundPolicy: InboundPolicyHandler<ClerkJwtInboundPolicyOptions>;
683
-
684
- /**
685
- * The options for this policy.
686
- */
687
- export declare interface ClerkJwtInboundPolicyOptions {
688
- /**
689
- * 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.
690
- */
691
- allowUnauthenticatedRequests?: boolean;
692
- /**
693
- * 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.
694
- */
695
- frontendApiUrl: string;
696
- }
697
-
698
- /**
699
- * Authenticate requests with JWT tokens issued by AWS Cognito.
700
- *
701
- * @remarks
702
- * Authenticate requests with JWT tokens issued by AWS Cognito. This is a
703
- * customized version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy}
704
- * specifically for AWS Cognito.
705
- *
706
- * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
707
- * about OAuth authorization in Zuplo.
708
- *
709
- * @title AWS Cognito JWT Auth
710
- * @public
711
- * @param request - The ZuploRequest
712
- * @param context - The ZuploContext
713
- * @param options - The policy options set in policies.json
714
- * @param policyName - The name of the policy as set in policies.json
715
- * @returns A Request or a Response
716
- */
717
- export declare const CognitoJwtInboundPolicy: InboundPolicyHandler<CognitoJwtInboundPolicyOptions>;
718
-
719
- /**
720
- * The options for this policy.
721
- */
722
- export declare interface CognitoJwtInboundPolicyOptions {
723
- /**
724
- * 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.
725
- */
726
- allowUnauthenticatedRequests?: boolean;
727
- /**
728
- * The AWS region where your Cognito instance is deployed.
729
- */
730
- region: string;
731
- /**
732
- * The user pool identifier.
733
- */
734
- userPoolId: string;
735
- }
736
-
737
- /**
738
- * The compatibility date on which to run the gateway
739
- */
740
- declare type CompatibilityDate = "2023-03-14" | "2024-01-15";
741
-
742
- declare interface CompatibilityFlags {
743
- /**
744
- * Whether or not outbound policies should run if the response from the
745
- * handlers is not `response.ok`
746
- *
747
- * @compatibilityDate 2024-01-15
748
- */
749
- runOutboundPoliciesOnHandlerOnAllStatuses: boolean;
750
- /**
751
- * Whether or not hooks run on system routes
752
- *
753
- * @compatibilityDate 2024-01-15
754
- */
755
- doNotRunHooksOnSystemRoutes: boolean;
756
- /**
757
- * Remove all vendor (cf-, zp-) headers except for the specific
758
- * list of allowed headers
759
- *
760
- * @compatibilityDate 2024-01-15
761
- */
762
- removeAllVendorHeadersExceptListed: boolean;
763
- }
764
-
765
- /**
766
- * Creates a composite, or group policy - composed of other policies. For reuse across routes.
767
- *
768
- * @remarks
769
- * The Composite policy allows you to create groups of other policies, for easy
770
- * reuse across multiple routes. Other policies are referenced by their `name`.
771
- *
772
- * Be careful not to create circular references which can cause your gateway to
773
- * fail.
774
- *
775
- * @title Composite Inbound (Group Policies)
776
- * @public
777
- * @param request - The ZuploRequest
778
- * @param context - The ZuploContext
779
- * @param options - The policy options set in policies.json
780
- * @param policyName - The name of the policy as set in policies.json
781
- * @returns A Request or a Response
782
- */
783
- export declare const CompositeInboundPolicy: InboundPolicyHandler<CompositeInboundPolicyOptions>;
784
-
785
- /**
786
- * The options for this policy.
787
- */
788
- export declare interface CompositeInboundPolicyOptions {
789
- /**
790
- * The list of policy references (beware circular references).
791
- */
792
- policies?: string[];
793
- }
794
-
795
- /**
796
- * Errors caused by invalid user configuration -i.e. invalid parameters on policies,
797
- * handlers that are not functions, etc. This is not for zuplo system configuration errors,
798
- * use SystemError for that.
799
- * @public
800
- */
801
- export declare class ConfigurationError extends RuntimeError {
802
- constructor(message: string, options?: ErrorOptions);
803
- }
804
-
805
- /* Excluded from this release type: ContentTypes */
806
-
807
- /**
808
- * Utility for storing data across the lifecycle of a request. This class is
809
- * useful for storing and retrieving data that is shared between policies.
810
- *
811
- * @public
812
- *
813
- * @example
814
- * Using static methods
815
- * ```
816
- * ContextData.set(context, "my-data", { prop1: "hello world" });
817
- *
818
- * const data = ContextData.get(context, "my-data");
819
- * ContextData.set(context, data);
820
- * ```
821
- *
822
- * @example
823
- * Reusable class shared across modules
824
- *
825
- * The shared module allows other modules to access the same storage without
826
- * passing the string name or type around.
827
- *
828
- * ```
829
- * export const myData =
830
- * new ContextData<{ prop1: string }>("my-data");
831
- * ```
832
- *
833
- * Then use the class in another module.
834
- *
835
- * ```
836
- * import { myData } from "./my-module";
837
- *
838
- *
839
- * const data = myData.get(context)
840
- * myData.set(context, data);
841
- *
842
- * ```
843
- */
844
- export declare class ContextData<T = any> {
845
- #private;
846
- constructor(name: string);
847
- set(context: ZuploContext, data: T): void;
848
- get(context: ZuploContext): T | undefined;
849
- static set<T = any>(context: ZuploContext, name: string, data: T): void;
850
- static get<T = any>(context: ZuploContext, name: string): T | undefined;
851
- }
852
-
853
- /** The 2-letter continent codes Cloudflare uses */
854
- declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
855
-
856
- export declare type CorsPolicy = string | "anything-goes" | "none";
857
-
858
- export declare interface CorsPolicyConfiguration {
859
- name: string;
860
- allowCredentials?: boolean;
861
- maxAge?: number;
862
- allowedOrigins: string[] | string;
863
- allowedMethods?: HttpMethod[] | string;
864
- allowedHeaders?: string[] | string;
865
- exposeHeaders?: string[] | string;
866
- }
867
-
868
- /**
869
- * @beta
870
- */
871
- export declare class CryptoBeta extends BaseCryptoBeta {
872
- digest(algorithm: string, data: string): Promise<string>;
873
- }
874
-
875
- /**
876
- * Authenticate users using the Curity Phantom Token Pattern.
877
- *
878
- * @remarks
879
- * Authenticate requests with Phantom Tokens issued by Curity. The payload of the
880
- * Phantom JWT token, if successfully authenticated, with be on the
881
- * `request.user.data` object accessible to the runtime.
882
- *
883
- * @title Curity Phantom Token Auth
884
- * @public
885
- * @param request - The ZuploRequest
886
- * @param context - The ZuploContext
887
- * @param options - The policy options set in policies.json
888
- * @param policyName - The name of the policy as set in policies.json
889
- * @returns A Request or a Response
890
- */
891
- export declare const CurityPhantomTokenInboundPolicy: InboundPolicyHandler<CurityPhantomTokenInboundPolicyOptions>;
892
-
893
- /**
894
- * The options for this policy.
895
- */
896
- export declare interface CurityPhantomTokenInboundPolicyOptions {
897
- /**
898
- * The client ID of the Curity application.
899
- */
900
- clientId: string;
901
- /**
902
- * The client secret of the Curity application.
903
- */
904
- clientSecret: string;
905
- /**
906
- * The introspection URL of the Curity application.
907
- */
908
- introspectionUrl: string;
909
- /**
910
- * The duration in seconds to cache the introspected response.
911
- */
912
- cacheDurationSeconds?: number;
913
- }
914
-
915
- /**
916
- * @beta
917
- */
918
- export declare interface CustomRateLimitDetails {
919
- key: string;
920
- requestsAllowed?: number;
921
- timeWindowMinutes?: number;
922
- }
923
-
924
- declare interface DataDogLoggingOptions {
925
- url?: string;
926
- apiKey: string;
927
- }
928
-
929
- export declare class DataDogLoggingPlugin extends LogPlugin {
930
- private options;
931
- constructor(options: DataDogLoggingOptions);
932
- /* Excluded from this release type: getTransport */
933
- }
934
-
935
- declare interface DataDogMetricsContext {
936
- tags: string[];
937
- }
938
-
939
- declare interface DataDogMetricsOptions {
940
- url?: string;
941
- apiKey: string;
942
- tags?: string[];
943
- metrics?: MetricsType;
944
- include?: IncludeMetrics;
945
- }
946
-
947
- export declare class DataDogMetricsPlugin extends MetricsPlugin {
948
- private options;
949
- constructor(options: DataDogMetricsOptions);
950
- getTransport(): MetricsTransport;
951
- static setContext(context: ZuploContext, data: DataDogMetricsContext): void;
952
- }
953
-
954
- export declare interface DevPortalRuntimeConfig {
955
- enabled: boolean;
956
- sitePathname: string;
957
- }
958
-
959
- /* Excluded from this release type: DispatchFunction */
960
-
961
- declare interface DynaTraceLoggingOptions {
962
- url: string;
963
- apiToken: string;
964
- }
965
-
966
- export declare class DynaTraceLoggingPlugin extends LogPlugin {
967
- private options;
968
- constructor(options: DynaTraceLoggingOptions);
969
- /* Excluded from this release type: getTransport */
970
- }
971
-
972
- declare interface DynatraceMetricsContext {
973
- dimensions: string[];
974
- }
975
-
976
- declare interface DynatraceMetricsOptions {
977
- url: string;
978
- apiToken: string;
979
- dimensions?: string[];
980
- metrics?: MetricsType;
981
- include?: IncludeMetrics;
982
- }
983
-
984
- export declare class DynatraceMetricsPlugin extends MetricsPlugin {
985
- private options;
986
- constructor(options: DynatraceMetricsOptions);
987
- getTransport(): MetricsTransport;
988
- static setContext(context: ZuploContext, data: DynatraceMetricsContext): void;
989
- }
990
-
991
- /**
992
- * @beta
993
- * Object exposing environment variables
994
- */
995
- export declare const environment: Record<string, string | undefined>;
996
-
997
- /**
998
- * @beta
999
- */
1000
- export declare interface ErrorHandler {
1001
- (request: ZuploRequest, context: ZuploContext, err: Error): Response | Promise<Response>;
1002
- }
1003
-
1004
- /* Excluded from this release type: ErrorObject */
1005
-
1006
- /**
1007
- * Authenticate users using Firebase issued JWT tokens.
1008
- *
1009
- * @remarks
1010
- * Authenticate requests with JWT tokens issued by Firebase. The payload of the JWT
1011
- * token, if successfully authenticated, with be on the `request.user.data` object
1012
- * accessible to the runtime.
1013
- *
1014
- * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
1015
- * about OAuth authorization in Zuplo.
1016
- *
1017
- * @title Firebase JWT Auth
1018
- * @public
1019
- * @param request - The ZuploRequest
1020
- * @param context - The ZuploContext
1021
- * @param options - The policy options set in policies.json
1022
- * @param policyName - The name of the policy as set in policies.json
1023
- * @returns A Request or a Response
1024
- */
1025
- export declare const FirebaseJwtInboundPolicy: InboundPolicyHandler<FirebaseJwtInboundPolicyOptions>;
1026
-
1027
- /**
1028
- * The options for this policy.
1029
- */
1030
- export declare interface FirebaseJwtInboundPolicyOptions {
1031
- /**
1032
- * 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.
1033
- */
1034
- allowUnauthenticatedRequests?: boolean;
1035
- /**
1036
- * Your Firebase Project ID.
1037
- */
1038
- projectId: string;
1039
- }
1040
-
1041
- /**
1042
- * Converts form data in the incoming request to JSON.
1043
- *
1044
- * @title Form Data to JSON
1045
- * @public
1046
- * @param request - The ZuploRequest
1047
- * @param context - The ZuploContext
1048
- * @param options - The policy options set in policies.json
1049
- * @param policyName - The name of the policy as set in policies.json
1050
- * @returns A Request or a Response
1051
- */
1052
- export declare const FormDataToJsonInboundPolicy: InboundPolicyHandler<FormDataToJsonInboundPolicyOptions>;
1053
-
1054
- /**
1055
- * The options for this policy.
1056
- */
1057
- export declare interface FormDataToJsonInboundPolicyOptions {
1058
- /**
1059
- * Should the policy return an error if the request is not of the type form data.
1060
- */
1061
- badRequestIfNotFormData?: boolean;
1062
- /**
1063
- * The name of the honeypot field. Used to provide basic spam filtering.
1064
- */
1065
- optionalHoneypotName?: string;
1066
- }
1067
-
1068
- /* Excluded from this release type: Gateway */
1069
-
1070
- /**
1071
- * Block requests based on geo-location parameters: country, region code, and ASN
1072
- *
1073
- * @title Geo-location filtering
1074
- * @public
1075
- * @param request - The ZuploRequest
1076
- * @param context - The ZuploContext
1077
- * @param options - The policy options set in policies.json
1078
- * @param policyName - The name of the policy as set in policies.json
1079
- * @returns A Request or a Response
1080
- */
1081
- export declare const GeoFilterInboundPolicy: InboundPolicyHandler<GeoFilterInboundPolicyOptions>;
1082
-
1083
- /**
1084
- * The options for this policy.
1085
- */
1086
- export declare interface GeoFilterInboundPolicyOptions {
1087
- block?: GeoSpec;
1088
- allow?: GeoSpec;
1089
- /**
1090
- * Specifies whether unknown geo-location parameters should be ignored (allowed through).
1091
- */
1092
- ignoreUnknown?: boolean;
1093
- }
1094
-
1095
- declare interface GeoSpec {
1096
- /**
1097
- * comma separated string of country codes to allow (e.g. "US, CA").
1098
- */
1099
- countries?: string;
1100
- /**
1101
- * comma separated string of region codes to allow (e.g. "TX, WA").
1102
- */
1103
- regionCodes?: string;
1104
- /**
1105
- * comma separated string of ASNs to allow (e.g. "395747, 28304").
1106
- */
1107
- asns?: string;
1108
- }
1109
-
1110
- export declare function getIdForParameterSchema(path: string, operation: string, type: string, name: string): string;
1111
-
1112
- export declare function getIdForRefSchema(oasFileName: string, ref: string): string;
1113
-
1114
- export declare function getIdForRequestBodySchema(path: string, operation: string, contentType: string): string;
1115
-
1116
- export declare function getRawOperationDataIdentifierName(oasFileName: string, path: string, operation: string): string;
1117
-
1118
- declare interface GoogleCloudLoggingOptions {
1119
- serviceAccountJson: string;
1120
- logName: string;
1121
- }
1122
-
1123
- export declare class GoogleCloudLoggingPlugin extends LogPlugin {
1124
- private options;
1125
- constructor(options: GoogleCloudLoggingOptions);
1126
- /* Excluded from this release type: getTransport */
1127
- }
1128
-
1129
- /* Excluded from this release type: Handler */
1130
-
1131
- export declare interface HandlerDefinition {
1132
- module: any;
1133
- export: string;
1134
- options?: unknown;
1135
- }
1136
-
1137
- export declare type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
1138
-
1139
- /**
1140
- * @beta
1141
- */
1142
- export declare class HttpProblems extends HttpProblemsBase {
1143
- #private;
1144
- /**
1145
- * The server has received the request headers and the client should proceed to send the request body
1146
- * (in the case of a request for which a body needs to be sent; for example, a POST request).
1147
- * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
1148
- * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
1149
- * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.
1150
- *
1151
- * @param request - The ZuploRequest object
1152
- * @param context - The ZuploContext object
1153
- * @param overrides - Overrides to the problem
1154
- * @param additionalHeaders - Additional headers to send in the outgoing response
1155
- * @returns A HTTP response promise
1156
- */
1157
- static continue: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1158
- /**
1159
- * The requester has asked the server to switch protocols and the server has agreed to do so.
1160
- *
1161
- * @param request - The ZuploRequest object
1162
- * @param context - The ZuploContext object
1163
- * @param overrides - Overrides to the problem
1164
- * @param additionalHeaders - Additional headers to send in the outgoing response
1165
- * @returns A HTTP response promise
1166
- */
1167
- static switchingProtocols: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1168
- /**
1169
- * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request. This code indicates that the server has received and is processing the request, but no response is available yet. This prevents the client from timing out and assuming the request was lost.
1170
- * @deprecated — This status code is deprecated and shouldn't be sent any more. Clients may still accept it, but simply ignore them.
1171
- * @param request - The ZuploRequest object
1172
- * @param context - The ZuploContext object
1173
- * @param overrides - Overrides to the problem
1174
- * @param additionalHeaders - Additional headers to send in the outgoing response
1175
- * @returns A HTTP response promise
1176
- */
1177
- static processing: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1178
- /**
1179
- * This response may be sent by a server while it is still preparing a
1180
- * response, with hints about the resources that the server is expecting
1181
- * the final response will link. This allows a browser to start preloading
1182
- * resources even before the server has prepared and sent that final response.
1183
- *
1184
- * @param request - The ZuploRequest object
1185
- * @param context - The ZuploContext object
1186
- * @param overrides - Overrides to the problem
1187
- * @param additionalHeaders - Additional headers to send in the outgoing response
1188
- * @returns A HTTP response promise
1189
- */
1190
- static earlyHints: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1191
- /**
1192
- * Standard response for successful HTTP requests.
1193
- * The actual response will depend on the request method used.
1194
- * In a GET request, the response will contain an entity corresponding to the requested resource.
1195
- * In a POST request, the response will contain an entity describing or containing the result of the action.
1196
- *
1197
- * @param request - The ZuploRequest object
1198
- * @param context - The ZuploContext object
1199
- * @param overrides - Overrides to the problem
1200
- * @param additionalHeaders - Additional headers to send in the outgoing response
1201
- * @returns A HTTP response promise
1202
- */
1203
- static ok: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1204
- /**
1205
- * The request has been fulfilled, resulting in the creation of a new resource.
1206
- *
1207
- * @param request - The ZuploRequest object
1208
- * @param context - The ZuploContext object
1209
- * @param overrides - Overrides to the problem
1210
- * @param additionalHeaders - Additional headers to send in the outgoing response
1211
- * @returns A HTTP response promise
1212
- */
1213
- static created: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1214
- /**
1215
- * The request has been accepted for processing, but the processing has not been completed.
1216
- * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
1217
- *
1218
- * @param request - The ZuploRequest object
1219
- * @param context - The ZuploContext object
1220
- * @param overrides - Overrides to the problem
1221
- * @param additionalHeaders - Additional headers to send in the outgoing response
1222
- * @returns A HTTP response promise
1223
- */
1224
- static accepted: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1225
- /**
1226
- * SINCE HTTP/1.1
1227
- * The server is a transforming proxy that received a 200 OK from its origin,
1228
- * but is returning a modified version of the origin's response.
1229
- *
1230
- * @param request - The ZuploRequest object
1231
- * @param context - The ZuploContext object
1232
- * @param overrides - Overrides to the problem
1233
- * @param additionalHeaders - Additional headers to send in the outgoing response
1234
- * @returns A HTTP response promise
1235
- */
1236
- static nonAuthoritativeInformation: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1237
- /**
1238
- * The server successfully processed the request and is not returning any content.
1239
- *
1240
- * @param request - The ZuploRequest object
1241
- * @param context - The ZuploContext object
1242
- * @param overrides - Overrides to the problem
1243
- * @param additionalHeaders - Additional headers to send in the outgoing response
1244
- * @returns A HTTP response promise
1245
- */
1246
- static noContent: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1247
- /**
1248
- * The server successfully processed the request, but is not returning any content.
1249
- * Unlike a 204 response, this response requires that the requester reset the document view.
1250
- *
1251
- * @param request - The ZuploRequest object
1252
- * @param context - The ZuploContext object
1253
- * @param overrides - Overrides to the problem
1254
- * @param additionalHeaders - Additional headers to send in the outgoing response
1255
- * @returns A HTTP response promise
1256
- */
1257
- static resetContent: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1258
- /**
1259
- * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
1260
- * The range header is used by HTTP clients to enable resuming of interrupted downloads,
1261
- * or split a download into multiple simultaneous streams.
1262
- *
1263
- * @param request - The ZuploRequest object
1264
- * @param context - The ZuploContext object
1265
- * @param overrides - Overrides to the problem
1266
- * @param additionalHeaders - Additional headers to send in the outgoing response
1267
- * @returns A HTTP response promise
1268
- */
1269
- static partialContent: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1270
- /**
1271
- * The message body that follows is an XML message and can contain a number of separate response codes,
1272
- * depending on how many sub-requests were made.
1273
- *
1274
- * @param request - The ZuploRequest object
1275
- * @param context - The ZuploContext object
1276
- * @param overrides - Overrides to the problem
1277
- * @param additionalHeaders - Additional headers to send in the outgoing response
1278
- * @returns A HTTP response promise
1279
- */
1280
- static multiStatus: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1281
- /**
1282
- * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
1283
- * and are not being included again.
1284
- *
1285
- * @param request - The ZuploRequest object
1286
- * @param context - The ZuploContext object
1287
- * @param overrides - Overrides to the problem
1288
- * @param additionalHeaders - Additional headers to send in the outgoing response
1289
- * @returns A HTTP response promise
1290
- */
1291
- static alreadyReported: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1292
- /**
1293
- * The server has fulfilled a request for the resource,
1294
- * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
1295
- *
1296
- * @param request - The ZuploRequest object
1297
- * @param context - The ZuploContext object
1298
- * @param overrides - Overrides to the problem
1299
- * @param additionalHeaders - Additional headers to send in the outgoing response
1300
- * @returns A HTTP response promise
1301
- */
1302
- static imUsed: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1303
- /**
1304
- * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
1305
- * For example, this code could be used to present multiple video format options,
1306
- * to list files with different filename extensions, or to suggest word-sense disambiguation.
1307
- *
1308
- * @param request - The ZuploRequest object
1309
- * @param context - The ZuploContext object
1310
- * @param overrides - Overrides to the problem
1311
- * @param additionalHeaders - Additional headers to send in the outgoing response
1312
- * @returns A HTTP response promise
1313
- */
1314
- static multipleChoices: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1315
- /**
1316
- * This and all future requests should be directed to the given URI.
1317
- *
1318
- * @param request - The ZuploRequest object
1319
- * @param context - The ZuploContext object
1320
- * @param overrides - Overrides to the problem
1321
- * @param additionalHeaders - Additional headers to send in the outgoing response
1322
- * @returns A HTTP response promise
1323
- */
1324
- static movedPermanently: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1325
- /**
1326
- * This is an example of industry practice contradicting the standard.
1327
- * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
1328
- * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
1329
- * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
1330
- * to distinguish between the two behaviours. However, some Web applications and frameworks
1331
- * use the 302 status code as if it were the 303.
1332
- *
1333
- * @param request - The ZuploRequest object
1334
- * @param context - The ZuploContext object
1335
- * @param overrides - Overrides to the problem
1336
- * @param additionalHeaders - Additional headers to send in the outgoing response
1337
- * @returns A HTTP response promise
1338
- */
1339
- static found: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1340
- /**
1341
- * SINCE HTTP/1.1
1342
- * The response to the request can be found under another URI using a GET method.
1343
- * When received in response to a POST (or PUT/DELETE), the client should presume that
1344
- * the server has received the data and should issue a redirect with a separate GET message.
1345
- *
1346
- * @param request - The ZuploRequest object
1347
- * @param context - The ZuploContext object
1348
- * @param overrides - Overrides to the problem
1349
- * @param additionalHeaders - Additional headers to send in the outgoing response
1350
- * @returns A HTTP response promise
1351
- */
1352
- static seeOther: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1353
- /**
1354
- * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
1355
- * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
1356
- *
1357
- * @param request - The ZuploRequest object
1358
- * @param context - The ZuploContext object
1359
- * @param overrides - Overrides to the problem
1360
- * @param additionalHeaders - Additional headers to send in the outgoing response
1361
- * @returns A HTTP response promise
1362
- */
1363
- static notModified: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1364
- /**
1365
- * SINCE HTTP/1.1
1366
- * The requested resource is available only through a proxy, the address for which is provided in the response.
1367
- * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
1368
- *
1369
- * @param request - The ZuploRequest object
1370
- * @param context - The ZuploContext object
1371
- * @param overrides - Overrides to the problem
1372
- * @param additionalHeaders - Additional headers to send in the outgoing response
1373
- * @returns A HTTP response promise
1374
- */
1375
- static useProxy: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1376
- /**
1377
- * No longer used. Originally meant "Subsequent requests should use the specified proxy."
1378
- *
1379
- * @param request - The ZuploRequest object
1380
- * @param context - The ZuploContext object
1381
- * @param overrides - Overrides to the problem
1382
- * @param additionalHeaders - Additional headers to send in the outgoing response
1383
- * @returns A HTTP response promise
1384
- * @deprecated No longer used
1385
- */
1386
- static switchProxy: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1387
- /**
1388
- * SINCE HTTP/1.1
1389
- * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
1390
- * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
1391
- * For example, a POST request should be repeated using another POST request.
1392
- *
1393
- * @param request - The ZuploRequest object
1394
- * @param context - The ZuploContext object
1395
- * @param overrides - Overrides to the problem
1396
- * @param additionalHeaders - Additional headers to send in the outgoing response
1397
- * @returns A HTTP response promise
1398
- */
1399
- static temporaryRedirect: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1400
- /**
1401
- * The request and all future requests should be repeated using another URI.
1402
- * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
1403
- * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
1404
- *
1405
- * @param request - The ZuploRequest object
1406
- * @param context - The ZuploContext object
1407
- * @param overrides - Overrides to the problem
1408
- * @param additionalHeaders - Additional headers to send in the outgoing response
1409
- * @returns A HTTP response promise
1410
- */
1411
- static permanentRedirect: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1412
- /**
1413
- * The server cannot or will not process the request due to an apparent client error
1414
- * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
1415
- *
1416
- * @param request - The ZuploRequest object
1417
- * @param context - The ZuploContext object
1418
- * @param overrides - Overrides to the problem
1419
- * @param additionalHeaders - Additional headers to send in the outgoing response
1420
- * @returns A HTTP response promise
1421
- */
1422
- static badRequest: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1423
- /**
1424
- * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
1425
- * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
1426
- * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
1427
- * "unauthenticated",i.e. the user does not have the necessary credentials.
1428
- *
1429
- * @param request - The ZuploRequest object
1430
- * @param context - The ZuploContext object
1431
- * @param overrides - Overrides to the problem
1432
- * @param additionalHeaders - Additional headers to send in the outgoing response
1433
- * @returns A HTTP response promise
1434
- */
1435
- static unauthorized: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1436
- /**
1437
- * Reserved for future use. The original intention was that this code might be used as part of some form of digital
1438
- * cash or micro payment scheme, but that has not happened, and this code is not usually used.
1439
- * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
1440
- *
1441
- * @param request - The ZuploRequest object
1442
- * @param context - The ZuploContext object
1443
- * @param overrides - Overrides to the problem
1444
- * @param additionalHeaders - Additional headers to send in the outgoing response
1445
- * @returns A HTTP response promise
1446
- */
1447
- static paymentRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1448
- /**
1449
- * The request was valid, but the server is refusing action.
1450
- * The user might not have the necessary permissions for a resource.
1451
- *
1452
- * @param request - The ZuploRequest object
1453
- * @param context - The ZuploContext object
1454
- * @param overrides - Overrides to the problem
1455
- * @param additionalHeaders - Additional headers to send in the outgoing response
1456
- * @returns A HTTP response promise
1457
- */
1458
- static forbidden: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1459
- /**
1460
- * The requested resource could not be found but may be available in the future.
1461
- * Subsequent requests by the client are permissible.
1462
- *
1463
- * @param request - The ZuploRequest object
1464
- * @param context - The ZuploContext object
1465
- * @param overrides - Overrides to the problem
1466
- * @param additionalHeaders - Additional headers to send in the outgoing response
1467
- * @returns A HTTP response promise
1468
- */
1469
- static notFound: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1470
- /**
1471
- * A request method is not supported for the requested resource;
1472
- * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
1473
- *
1474
- * @param request - The ZuploRequest object
1475
- * @param context - The ZuploContext object
1476
- * @param overrides - Overrides to the problem
1477
- * @param additionalHeaders - Additional headers to send in the outgoing response
1478
- * @returns A HTTP response promise
1479
- */
1480
- static methodNotAllowed: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1481
- /**
1482
- * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
1483
- *
1484
- * @param request - The ZuploRequest object
1485
- * @param context - The ZuploContext object
1486
- * @param overrides - Overrides to the problem
1487
- * @param additionalHeaders - Additional headers to send in the outgoing response
1488
- * @returns A HTTP response promise
1489
- */
1490
- static notAcceptable: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1491
- /**
1492
- * The client must first authenticate itself with the proxy.
1493
- *
1494
- * @param request - The ZuploRequest object
1495
- * @param context - The ZuploContext object
1496
- * @param overrides - Overrides to the problem
1497
- * @param additionalHeaders - Additional headers to send in the outgoing response
1498
- * @returns A HTTP response promise
1499
- */
1500
- static proxyAuthenticationRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1501
- /**
1502
- * The server timed out waiting for the request.
1503
- * According to HTTP specifications:
1504
- * "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
1505
- *
1506
- * @param request - The ZuploRequest object
1507
- * @param context - The ZuploContext object
1508
- * @param overrides - Overrides to the problem
1509
- * @param additionalHeaders - Additional headers to send in the outgoing response
1510
- * @returns A HTTP response promise
1511
- */
1512
- static requestTimeout: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1513
- /**
1514
- * Indicates that the request could not be processed because of conflict in the request,
1515
- * such as an edit conflict between multiple simultaneous updates.
1516
- *
1517
- * @param request - The ZuploRequest object
1518
- * @param context - The ZuploContext object
1519
- * @param overrides - Overrides to the problem
1520
- * @param additionalHeaders - Additional headers to send in the outgoing response
1521
- * @returns A HTTP response promise
1522
- */
1523
- static conflict: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1524
- /**
1525
- * Indicates that the resource requested is no longer available and will not be available again.
1526
- * This should be used when a resource has been intentionally removed and the resource should be purged.
1527
- * Upon receiving a 410 status code, the client should not request the resource in the future.
1528
- * Clients such as search engines should remove the resource from their indices.
1529
- * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
1530
- *
1531
- * @param request - The ZuploRequest object
1532
- * @param context - The ZuploContext object
1533
- * @param overrides - Overrides to the problem
1534
- * @param additionalHeaders - Additional headers to send in the outgoing response
1535
- * @returns A HTTP response promise
1536
- */
1537
- static gone: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1538
- /**
1539
- * The request did not specify the length of its content, which is required by the requested resource.
1540
- *
1541
- * @param request - The ZuploRequest object
1542
- * @param context - The ZuploContext object
1543
- * @param overrides - Overrides to the problem
1544
- * @param additionalHeaders - Additional headers to send in the outgoing response
1545
- * @returns A HTTP response promise
1546
- */
1547
- static lengthRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1548
- /**
1549
- * The server does not meet one of the preconditions that the requester put on the request.
1550
- *
1551
- * @param request - The ZuploRequest object
1552
- * @param context - The ZuploContext object
1553
- * @param overrides - Overrides to the problem
1554
- * @param additionalHeaders - Additional headers to send in the outgoing response
1555
- * @returns A HTTP response promise
1556
- */
1557
- static preconditionFailed: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1558
- /**
1559
- * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
1560
- *
1561
- * @param request - The ZuploRequest object
1562
- * @param context - The ZuploContext object
1563
- * @param overrides - Overrides to the problem
1564
- * @param additionalHeaders - Additional headers to send in the outgoing response
1565
- * @returns A HTTP response promise
1566
- */
1567
- static contentTooLarge: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1568
- /**
1569
- * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
1570
- * in which case it should be converted to a POST request.
1571
- * Called "Request-URI Too Long" previously.
1572
- *
1573
- * @param request - The ZuploRequest object
1574
- * @param context - The ZuploContext object
1575
- * @param overrides - Overrides to the problem
1576
- * @param additionalHeaders - Additional headers to send in the outgoing response
1577
- * @returns A HTTP response promise
1578
- */
1579
- static uriTooLong: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1580
- /**
1581
- * The request entity has a media type which the server or resource does not support.
1582
- * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
1583
- *
1584
- * @param request - The ZuploRequest object
1585
- * @param context - The ZuploContext object
1586
- * @param overrides - Overrides to the problem
1587
- * @param additionalHeaders - Additional headers to send in the outgoing response
1588
- * @returns A HTTP response promise
1589
- */
1590
- static unsupportedMediaType: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1591
- /**
1592
- * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
1593
- * For example, if the client asked for a part of the file that lies beyond the end of the file.
1594
- * Called "Requested Range Not Satisfiable" previously.
1595
- *
1596
- * @param request - The ZuploRequest object
1597
- * @param context - The ZuploContext object
1598
- * @param overrides - Overrides to the problem
1599
- * @param additionalHeaders - Additional headers to send in the outgoing response
1600
- * @returns A HTTP response promise
1601
- */
1602
- static rangeNotSatisfiable: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1603
- /**
1604
- * The server cannot meet the requirements of the Expect request-header field.
1605
- *
1606
- * @param request - The ZuploRequest object
1607
- * @param context - The ZuploContext object
1608
- * @param overrides - Overrides to the problem
1609
- * @param additionalHeaders - Additional headers to send in the outgoing response
1610
- * @returns A HTTP response promise
1611
- */
1612
- static expectationFailed: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1613
- /**
1614
- * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
1615
- * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
1616
- * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
1617
- *
1618
- * @param request - The ZuploRequest object
1619
- * @param context - The ZuploContext object
1620
- * @param overrides - Overrides to the problem
1621
- * @param additionalHeaders - Additional headers to send in the outgoing response
1622
- * @returns A HTTP response promise
1623
- */
1624
- static imATeapot: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1625
- /**
1626
- * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
1627
- *
1628
- * @param request - The ZuploRequest object
1629
- * @param context - The ZuploContext object
1630
- * @param overrides - Overrides to the problem
1631
- * @param additionalHeaders - Additional headers to send in the outgoing response
1632
- * @returns A HTTP response promise
1633
- */
1634
- static misdirectedRequest: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1635
- /**
1636
- * The request was well-formed but was unable to be followed due to semantic errors.
1637
- *
1638
- * @param request - The ZuploRequest object
1639
- * @param context - The ZuploContext object
1640
- * @param overrides - Overrides to the problem
1641
- * @param additionalHeaders - Additional headers to send in the outgoing response
1642
- * @returns A HTTP response promise
1643
- */
1644
- static unprocessableContent: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1645
- /**
1646
- * The resource that is being accessed is locked.
1647
- *
1648
- * @param request - The ZuploRequest object
1649
- * @param context - The ZuploContext object
1650
- * @param overrides - Overrides to the problem
1651
- * @param additionalHeaders - Additional headers to send in the outgoing response
1652
- * @returns A HTTP response promise
1653
- */
1654
- static locked: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1655
- /**
1656
- * The request failed due to failure of a previous request (e.g., a PROPPATCH).
1657
- *
1658
- * @param request - The ZuploRequest object
1659
- * @param context - The ZuploContext object
1660
- * @param overrides - Overrides to the problem
1661
- * @param additionalHeaders - Additional headers to send in the outgoing response
1662
- * @returns A HTTP response promise
1663
- */
1664
- static failedDependency: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1665
- /**
1666
- * The server is unwilling to risk processing a request that might be
1667
- * replayed, which creates the potential for a replay attack.
1668
- *
1669
- * @param request - The ZuploRequest object
1670
- * @param context - The ZuploContext object
1671
- * @param overrides - Overrides to the problem
1672
- * @param additionalHeaders - Additional headers to send in the outgoing response
1673
- * @returns A HTTP response promise
1674
- */
1675
- static tooEarly: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1676
- /**
1677
- * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
1678
- *
1679
- * @param request - The ZuploRequest object
1680
- * @param context - The ZuploContext object
1681
- * @param overrides - Overrides to the problem
1682
- * @param additionalHeaders - Additional headers to send in the outgoing response
1683
- * @returns A HTTP response promise
1684
- */
1685
- static upgradeRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1686
- /**
1687
- * The origin server requires the request to be conditional.
1688
- * Intended to prevent "the 'lost update' problem, where a client
1689
- * GETs a resource's state, modifies it, and PUTs it back to the server,
1690
- * when meanwhile a third party has modified the state on the server, leading to a conflict."
1691
- *
1692
- * @param request - The ZuploRequest object
1693
- * @param context - The ZuploContext object
1694
- * @param overrides - Overrides to the problem
1695
- * @param additionalHeaders - Additional headers to send in the outgoing response
1696
- * @returns A HTTP response promise
1697
- */
1698
- static preconditionRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1699
- /**
1700
- * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
1701
- *
1702
- * @param request - The ZuploRequest object
1703
- * @param context - The ZuploContext object
1704
- * @param overrides - Overrides to the problem
1705
- * @param additionalHeaders - Additional headers to send in the outgoing response
1706
- * @returns A HTTP response promise
1707
- */
1708
- static tooManyRequests: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1709
- /**
1710
- * The server is unwilling to process the request because either an individual header field,
1711
- * or all the header fields collectively, are too large.
1712
- *
1713
- * @param request - The ZuploRequest object
1714
- * @param context - The ZuploContext object
1715
- * @param overrides - Overrides to the problem
1716
- * @param additionalHeaders - Additional headers to send in the outgoing response
1717
- * @returns A HTTP response promise
1718
- */
1719
- static requestHeaderFieldsTooLarge: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1720
- /**
1721
- * A server operator has received a legal demand to deny access to a resource or to a set of resources
1722
- * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
1723
- *
1724
- * @param request - The ZuploRequest object
1725
- * @param context - The ZuploContext object
1726
- * @param overrides - Overrides to the problem
1727
- * @param additionalHeaders - Additional headers to send in the outgoing response
1728
- * @returns A HTTP response promise
1729
- */
1730
- static unavailableForLegalReasons: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1731
- /**
1732
- * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
1733
- *
1734
- * @param request - The ZuploRequest object
1735
- * @param context - The ZuploContext object
1736
- * @param overrides - Overrides to the problem
1737
- * @param additionalHeaders - Additional headers to send in the outgoing response
1738
- * @returns A HTTP response promise
1739
- */
1740
- static internalServerError: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1741
- /**
1742
- * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
1743
- * Usually this implies future availability (e.g., a new feature of a web-service API).
1744
- *
1745
- * @param request - The ZuploRequest object
1746
- * @param context - The ZuploContext object
1747
- * @param overrides - Overrides to the problem
1748
- * @param additionalHeaders - Additional headers to send in the outgoing response
1749
- * @returns A HTTP response promise
1750
- */
1751
- static notImplemented: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1752
- /**
1753
- * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
1754
- *
1755
- * @param request - The ZuploRequest object
1756
- * @param context - The ZuploContext object
1757
- * @param overrides - Overrides to the problem
1758
- * @param additionalHeaders - Additional headers to send in the outgoing response
1759
- * @returns A HTTP response promise
1760
- */
1761
- static badGateway: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1762
- /**
1763
- * The server is currently unavailable (because it is overloaded or down for maintenance).
1764
- * Generally, this is a temporary state.
1765
- *
1766
- * @param request - The ZuploRequest object
1767
- * @param context - The ZuploContext object
1768
- * @param overrides - Overrides to the problem
1769
- * @param additionalHeaders - Additional headers to send in the outgoing response
1770
- * @returns A HTTP response promise
1771
- */
1772
- static serviceUnavailable: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1773
- /**
1774
- * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
1775
- *
1776
- * @param request - The ZuploRequest object
1777
- * @param context - The ZuploContext object
1778
- * @param overrides - Overrides to the problem
1779
- * @param additionalHeaders - Additional headers to send in the outgoing response
1780
- * @returns A HTTP response promise
1781
- */
1782
- static gatewayTimeout: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1783
- /**
1784
- * The server does not support the HTTP protocol version used in the request
1785
- *
1786
- * @param request - The ZuploRequest object
1787
- * @param context - The ZuploContext object
1788
- * @param overrides - Overrides to the problem
1789
- * @param additionalHeaders - Additional headers to send in the outgoing response
1790
- * @returns A HTTP response promise
1791
- */
1792
- static httpVersionNotSupported: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1793
- /**
1794
- * Transparent content negotiation for the request results in a circular reference.
1795
- *
1796
- * @param request - The ZuploRequest object
1797
- * @param context - The ZuploContext object
1798
- * @param overrides - Overrides to the problem
1799
- * @param additionalHeaders - Additional headers to send in the outgoing response
1800
- * @returns A HTTP response promise
1801
- */
1802
- static variantAlsoNegotiates: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1803
- /**
1804
- * The server is unable to store the representation needed to complete the request.
1805
- *
1806
- * @param request - The ZuploRequest object
1807
- * @param context - The ZuploContext object
1808
- * @param overrides - Overrides to the problem
1809
- * @param additionalHeaders - Additional headers to send in the outgoing response
1810
- * @returns A HTTP response promise
1811
- */
1812
- static insufficientStorage: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1813
- /**
1814
- * The server detected an infinite loop while processing the request.
1815
- *
1816
- * @param request - The ZuploRequest object
1817
- * @param context - The ZuploContext object
1818
- * @param overrides - Overrides to the problem
1819
- * @param additionalHeaders - Additional headers to send in the outgoing response
1820
- * @returns A HTTP response promise
1821
- */
1822
- static loopDetected: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1823
- /**
1824
- * Further extensions to the request are required for the server to fulfill it.
1825
- *
1826
- * @param request - The ZuploRequest object
1827
- * @param context - The ZuploContext object
1828
- * @param overrides - Overrides to the problem
1829
- * @param additionalHeaders - Additional headers to send in the outgoing response
1830
- * @returns A HTTP response promise
1831
- */
1832
- static notExtended: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1833
- /**
1834
- * The client needs to authenticate to gain network access.
1835
- * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
1836
- * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
1837
- *
1838
- * @param request - The ZuploRequest object
1839
- * @param context - The ZuploContext object
1840
- * @param overrides - Overrides to the problem
1841
- * @param additionalHeaders - Additional headers to send in the outgoing response
1842
- * @returns A HTTP response promise
1843
- */
1844
- static networkAuthenticationRequired: (request: ZuploRequest, context: ZuploContext, overrides?: Partial<ProblemDetails>, additionalHeaders?: HeadersInit) => Promise<Response>;
1845
- }
1846
-
1847
- declare class HttpProblemsBase {
1848
- /**
1849
- * Creates a Response in the standard format from a problem detail
1850
- * @param details - The details of the problem
1851
- * @param request - The ZuploRequest object
1852
- * @param context - The ZuploContext object
1853
- * @returns A HTTP Response promise
1854
- */
1855
- static format: (details: ProblemDetails | ProblemResponseDetails, request: ZuploRequest, context: ZuploContext) => Promise<Response>;
1856
- /**
1857
- * Creates a problem from the status code
1858
- */
1859
- static getProblemFromStatus(status: HttpStatusCode, problem?: Partial<Omit<ProblemDetails, "status" | "title">>): ProblemDetails;
1860
- }
1861
-
1862
- /**
1863
- * @beta
1864
- */
1865
- export declare enum HttpStatusCode {
1866
- /**
1867
- * The server has received the request headers and the client should proceed to send the request body
1868
- * (in the case of a request for which a body needs to be sent; for example, a POST request).
1869
- * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
1870
- * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
1871
- * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.
1872
- */
1873
- CONTINUE = 100,
1874
- /**
1875
- * The requester has asked the server to switch protocols and the server has agreed to do so.
1876
- */
1877
- SWITCHING_PROTOCOLS = 101,
1878
- /**
1879
- * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
1880
- * This code indicates that the server has received and is processing the request, but no response is available yet.
1881
- * This prevents the client from timing out and assuming the request was lost.
1882
- * @deprecated This status code is deprecated and shouldn't be sent any more. Clients may still accept it, but simply ignore them.
1883
- */
1884
- PROCESSING = 102,
1885
- /**
1886
- * This response may be sent by a server while it is still preparing a
1887
- * response, with hints about the resources that the server is expecting
1888
- * the final response will link. This allows a browser to start preloading
1889
- * resources even before the server has prepared and sent that final response.
1890
- */
1891
- EARLY_HINTS = 103,
1892
- /**
1893
- * Standard response for successful HTTP requests.
1894
- * The actual response will depend on the request method used.
1895
- * In a GET request, the response will contain an entity corresponding to the requested resource.
1896
- * In a POST request, the response will contain an entity describing or containing the result of the action.
1897
- */
1898
- OK = 200,
1899
- /**
1900
- * The request has been fulfilled, resulting in the creation of a new resource.
1901
- */
1902
- CREATED = 201,
1903
- /**
1904
- * The request has been accepted for processing, but the processing has not been completed.
1905
- * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
1906
- */
1907
- ACCEPTED = 202,
1908
- /**
1909
- * SINCE HTTP/1.1
1910
- * The server is a transforming proxy that received a 200 OK from its origin,
1911
- * but is returning a modified version of the origin's response.
1912
- */
1913
- NON_AUTHORITATIVE_INFORMATION = 203,
1914
- /**
1915
- * The server successfully processed the request and is not returning any content.
1916
- */
1917
- NO_CONTENT = 204,
1918
- /**
1919
- * The server successfully processed the request, but is not returning any content.
1920
- * Unlike a 204 response, this response requires that the requester reset the document view.
1921
- */
1922
- RESET_CONTENT = 205,
1923
- /**
1924
- * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
1925
- * The range header is used by HTTP clients to enable resuming of interrupted downloads,
1926
- * or split a download into multiple simultaneous streams.
1927
- */
1928
- PARTIAL_CONTENT = 206,
1929
- /**
1930
- * The message body that follows is an XML message and can contain a number of separate response codes,
1931
- * depending on how many sub-requests were made.
1932
- */
1933
- MULTI_STATUS = 207,
1934
- /**
1935
- * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
1936
- * and are not being included again.
1937
- */
1938
- ALREADY_REPORTED = 208,
1939
- /**
1940
- * The server has fulfilled a request for the resource,
1941
- * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
1942
- */
1943
- IM_USED = 226,
1944
- /**
1945
- * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
1946
- * For example, this code could be used to present multiple video format options,
1947
- * to list files with different filename extensions, or to suggest word-sense disambiguation.
1948
- */
1949
- MULTIPLE_CHOICES = 300,
1950
- /**
1951
- * This and all future requests should be directed to the given URI.
1952
- */
1953
- MOVED_PERMANENTLY = 301,
1954
- /**
1955
- * This is an example of industry practice contradicting the standard.
1956
- * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
1957
- * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
1958
- * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
1959
- * to distinguish between the two behaviours. However, some Web applications and frameworks
1960
- * use the 302 status code as if it were the 303.
1961
- */
1962
- FOUND = 302,
1963
- /**
1964
- * SINCE HTTP/1.1
1965
- * The response to the request can be found under another URI using a GET method.
1966
- * When received in response to a POST (or PUT/DELETE), the client should presume that
1967
- * the server has received the data and should issue a redirect with a separate GET message.
1968
- */
1969
- SEE_OTHER = 303,
1970
- /**
1971
- * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
1972
- * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
1973
- */
1974
- NOT_MODIFIED = 304,
1975
- /**
1976
- * SINCE HTTP/1.1
1977
- * The requested resource is available only through a proxy, the address for which is provided in the response.
1978
- * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
1979
- */
1980
- USE_PROXY = 305,
1981
- /**
1982
- * No longer used. Originally meant "Subsequent requests should use the specified proxy."
1983
- * @deprecated No longer used
1984
- */
1985
- SWITCH_PROXY = 306,
1986
- /**
1987
- * SINCE HTTP/1.1
1988
- * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
1989
- * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
1990
- * For example, a POST request should be repeated using another POST request.
1991
- */
1992
- TEMPORARY_REDIRECT = 307,
1993
- /**
1994
- * The request and all future requests should be repeated using another URI.
1995
- * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
1996
- * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
1997
- */
1998
- PERMANENT_REDIRECT = 308,
1999
- /**
2000
- * The server cannot or will not process the request due to an apparent client error
2001
- * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
2002
- */
2003
- BAD_REQUEST = 400,
2004
- /**
2005
- * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
2006
- * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
2007
- * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
2008
- * "unauthenticated",i.e. the user does not have the necessary credentials.
2009
- */
2010
- UNAUTHORIZED = 401,
2011
- /**
2012
- * Reserved for future use. The original intention was that this code might be used as part of some form of digital
2013
- * cash or micro payment scheme, but that has not happened, and this code is not usually used.
2014
- * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
2015
- */
2016
- PAYMENT_REQUIRED = 402,
2017
- /**
2018
- * The request was valid, but the server is refusing action.
2019
- * The user might not have the necessary permissions for a resource.
2020
- */
2021
- FORBIDDEN = 403,
2022
- /**
2023
- * The requested resource could not be found but may be available in the future.
2024
- * Subsequent requests by the client are permissible.
2025
- */
2026
- NOT_FOUND = 404,
2027
- /**
2028
- * A request method is not supported for the requested resource;
2029
- * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
2030
- */
2031
- METHOD_NOT_ALLOWED = 405,
2032
- /**
2033
- * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
2034
- */
2035
- NOT_ACCEPTABLE = 406,
2036
- /**
2037
- * The client must first authenticate itself with the proxy.
2038
- */
2039
- PROXY_AUTHENTICATION_REQUIRED = 407,
2040
- /**
2041
- * The server timed out waiting for the request.
2042
- * According to HTTP specifications:
2043
- * "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
2044
- */
2045
- REQUEST_TIMEOUT = 408,
2046
- /**
2047
- * Indicates that the request could not be processed because of conflict in the request,
2048
- * such as an edit conflict between multiple simultaneous updates.
2049
- */
2050
- CONFLICT = 409,
2051
- /**
2052
- * Indicates that the resource requested is no longer available and will not be available again.
2053
- * This should be used when a resource has been intentionally removed and the resource should be purged.
2054
- * Upon receiving a 410 status code, the client should not request the resource in the future.
2055
- * Clients such as search engines should remove the resource from their indices.
2056
- * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
2057
- */
2058
- GONE = 410,
2059
- /**
2060
- * The request did not specify the length of its content, which is required by the requested resource.
2061
- */
2062
- LENGTH_REQUIRED = 411,
2063
- /**
2064
- * The server does not meet one of the preconditions that the requester put on the request.
2065
- */
2066
- PRECONDITION_FAILED = 412,
2067
- /**
2068
- * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
2069
- */
2070
- CONTENT_TOO_LARGE = 413,
2071
- /* Excluded from this release type: PAYLOAD_TOO_LARGE */
2072
- /**
2073
- * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
2074
- * in which case it should be converted to a POST request.
2075
- * Called "Request-URI Too Long" previously.
2076
- */
2077
- URI_TOO_LONG = 414,
2078
- /**
2079
- * The request entity has a media type which the server or resource does not support.
2080
- * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
2081
- */
2082
- UNSUPPORTED_MEDIA_TYPE = 415,
2083
- /**
2084
- * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
2085
- * For example, if the client asked for a part of the file that lies beyond the end of the file.
2086
- * Called "Requested Range Not Satisfiable" previously.
2087
- */
2088
- RANGE_NOT_SATISFIABLE = 416,
2089
- /**
2090
- * The server cannot meet the requirements of the Expect request-header field.
2091
- */
2092
- EXPECTATION_FAILED = 417,
2093
- /**
2094
- * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
2095
- * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
2096
- * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
2097
- */
2098
- I_AM_A_TEAPOT = 418,
2099
- /**
2100
- * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
2101
- */
2102
- MISDIRECTED_REQUEST = 421,
2103
- /* Excluded from this release type: UNPROCESSABLE_ENTITY */
2104
- /**
2105
- * The request was well-formed but was unable to be followed due to semantic errors.
2106
- */
2107
- UNPROCESSABLE_CONTENT = 422,
2108
- /**
2109
- * The resource that is being accessed is locked.
2110
- */
2111
- LOCKED = 423,
2112
- /**
2113
- * The request failed due to failure of a previous request (e.g., a PROPPATCH).
2114
- */
2115
- FAILED_DEPENDENCY = 424,
2116
- /**
2117
- * The server is unwilling to risk processing a request that might be
2118
- * replayed, which creates the potential for a replay attack.
2119
- */
2120
- TOO_EARLY = 425,
2121
- /**
2122
- * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
2123
- */
2124
- UPGRADE_REQUIRED = 426,
2125
- /**
2126
- * The origin server requires the request to be conditional.
2127
- * Intended to prevent "the 'lost update' problem, where a client
2128
- * GETs a resource's state, modifies it, and PUTs it back to the server,
2129
- * when meanwhile a third party has modified the state on the server, leading to a conflict."
2130
- */
2131
- PRECONDITION_REQUIRED = 428,
2132
- /**
2133
- * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
2134
- */
2135
- TOO_MANY_REQUESTS = 429,
2136
- /**
2137
- * The server is unwilling to process the request because either an individual header field,
2138
- * or all the header fields collectively, are too large.
2139
- */
2140
- REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
2141
- /**
2142
- * A server operator has received a legal demand to deny access to a resource or to a set of resources
2143
- * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
2144
- */
2145
- UNAVAILABLE_FOR_LEGAL_REASONS = 451,
2146
- /**
2147
- * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
2148
- */
2149
- INTERNAL_SERVER_ERROR = 500,
2150
- /**
2151
- * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
2152
- * Usually this implies future availability (e.g., a new feature of a web-service API).
2153
- */
2154
- NOT_IMPLEMENTED = 501,
2155
- /**
2156
- * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
2157
- */
2158
- BAD_GATEWAY = 502,
2159
- /**
2160
- * The server is currently unavailable (because it is overloaded or down for maintenance).
2161
- * Generally, this is a temporary state.
2162
- */
2163
- SERVICE_UNAVAILABLE = 503,
2164
- /**
2165
- * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
2166
- */
2167
- GATEWAY_TIMEOUT = 504,
2168
- /**
2169
- * The server does not support the HTTP protocol version used in the request
2170
- */
2171
- HTTP_VERSION_NOT_SUPPORTED = 505,
2172
- /**
2173
- * Transparent content negotiation for the request results in a circular reference.
2174
- */
2175
- VARIANT_ALSO_NEGOTIATES = 506,
2176
- /**
2177
- * The server is unable to store the representation needed to complete the request.
2178
- */
2179
- INSUFFICIENT_STORAGE = 507,
2180
- /**
2181
- * The server detected an infinite loop while processing the request.
2182
- */
2183
- LOOP_DETECTED = 508,
2184
- /**
2185
- * Further extensions to the request are required for the server to fulfill it.
2186
- */
2187
- NOT_EXTENDED = 510,
2188
- /**
2189
- * The client needs to authenticate to gain network access.
2190
- * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
2191
- * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
2192
- */
2193
- NETWORK_AUTHENTICATION_REQUIRED = 511
2194
- }
2195
-
2196
- declare type HttpStatusCodeRangeDefinition = "1XX" | "2XX" | "3XX" | "4XX" | "5XX";
2197
-
2198
- /* Excluded from this release type: httpStatuses */
2199
-
2200
- /**
2201
- * @beta
2202
- * A policy that can modify the incoming HTTP request before it is sent to
2203
- * the handler. If a response is returned, the request is short-circuited and
2204
- * the response is returned to the client. If a Request is returned, policies
2205
- * or a handler that follow are executed.
2206
- */
2207
- export declare abstract class InboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
2208
- /**
2209
- * The handler that is called each time this policy is invoked
2210
- *
2211
- * @param request - The incoming Request
2212
- * @param context - The current context of the Request
2213
- * @returns A Response or Request object
2214
- */
2215
- abstract handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
2216
- }
2217
-
2218
- /**
2219
- * @public
2220
- * A policy that can modify the incoming HTTP request before it is sent to
2221
- * the handler. If a response is returned, the request is short-circuited and
2222
- * the response is returned to the client. If a Request is returned, policies
2223
- * or a handler that follow are executed.
2224
- *
2225
- * @param request - The incoming Request
2226
- * @param context - The current context of the Request
2227
- * @param options - The configuration options for the policy
2228
- * @param policyName - The name set on the policy in the configuration
2229
- * @returns A Response or Request object
2230
- */
2231
- export declare interface InboundPolicyHandler<TOptions = any> {
2232
- (request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<ZuploRequest | Response>;
2233
- }
2234
-
2235
- declare interface IncludeMetrics {
2236
- country?: boolean;
2237
- httpMethod?: boolean;
2238
- statusCode?: boolean;
2239
- path?: boolean;
2240
- }
2241
-
2242
- declare interface IncomingRequestProperties {
2243
- /**
2244
- * ASN of the incoming request, for example, 395747.
2245
- */
2246
- readonly asn: number | undefined;
2247
- /**
2248
- * The organization which owns the ASN of the incoming request,
2249
- * for example, Google Cloud.
2250
- */
2251
- readonly asOrganization: string | undefined;
2252
- /**
2253
- * City of the incoming request, for example, "Austin".
2254
- */
2255
- readonly city: string | undefined;
2256
- /**
2257
- * Continent of the incoming request, for example, "NA".
2258
- */
2259
- readonly continent: ContinentCode | undefined;
2260
- /**
2261
- * The two-letter country code in the request.
2262
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2|ISO 3166-1 alpha-2}
2263
- */
2264
- readonly country: Iso3166Alpha2Code | undefined;
2265
- /**
2266
- * Latitude of the incoming request, for example, "30.27130".
2267
- */
2268
- readonly latitude: string | undefined;
2269
- /**
2270
- * Longitude of the incoming request, for example, "-97.74260".
2271
- */
2272
- readonly longitude: string | undefined;
2273
- /**
2274
- * The three-letter IATA airport code of the data center that the request hit,
2275
- * for example, "DFW".
2276
- * @see {@link https://en.wikipedia.org/wiki/IATA_airport_code|IATA airport code}
2277
- */
2278
- readonly colo: string | undefined;
2279
- /**
2280
- * Postal code of the incoming request, for example, "78701".
2281
- */
2282
- readonly postalCode: string | undefined;
2283
- /**
2284
- * Metro code (DMA) of the incoming request, for example, "635".
2285
- */
2286
- readonly metroCode: string | undefined;
2287
- /**
2288
- * If known, the ISO 3166-2 name for the first level region associated with
2289
- * the IP address of the incoming request, for example, "Texas".
2290
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
2291
- */
2292
- readonly region: string | undefined;
2293
- /**
2294
- * If known, the ISO 3166-2 code for the first-level region associated with
2295
- * the IP address of the incoming request, for example, "TX".
2296
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
2297
- */
2298
- readonly regionCode: string | undefined;
2299
- /**
2300
- * Timezone of the incoming request, for example, "America/Chicago".
2301
- */
2302
- readonly timezone: string | undefined;
2303
- }
2304
-
2305
- /* Excluded from this release type: IRequestProcessor */
2306
-
2307
- /** ISO 3166-1 Alpha-2 codes */
2308
- declare type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
2309
-
2310
- /* Excluded from this release type: isRestrictedEnvVariableName */
2311
-
2312
- export declare function isZuploReadableEnvVariableName(name: string): boolean;
2313
-
2314
- /**
2315
- * Validates that the JWT token includes specific scopes
2316
- *
2317
- * @title JWT Scope Validation
2318
- * @public
2319
- * @param request - The ZuploRequest
2320
- * @param context - The ZuploContext
2321
- * @param options - The policy options set in policies.json
2322
- * @param policyName - The name of the policy as set in policies.json
2323
- * @returns A Request or a Response
2324
- */
2325
- export declare const JWTScopeValidationInboundPolicy: InboundPolicyHandler<JWTScopeValidationInboundPolicyOptions>;
2326
-
2327
- /**
2328
- * The options for this policy.
2329
- */
2330
- export declare interface JWTScopeValidationInboundPolicyOptions {
2331
- /**
2332
- * An array of of JWT scopes.
2333
- */
2334
- scopes: string[];
2335
- }
2336
-
2337
- /**
2338
- * @beta
2339
- */
2340
- declare interface KevValueStoreGetOptions {
2341
- cacheSecondsTtl?: number;
2342
- }
2343
-
2344
- /**
2345
- * @beta
2346
- */
2347
- export declare class KeyValueStore extends BaseKeyValueStore {
2348
- #private;
2349
- constructor(context: ZuploContext);
2350
- put(key: string, value: string, options?: KeyValueStorePutOptions): Promise<void>;
2351
- get(key: string, options?: KevValueStoreGetOptions): Promise<string | null>;
2352
- delete(key: string): Promise<void>;
2353
- }
2354
-
2355
- /**
2356
- * @beta
2357
- */
2358
- declare interface KeyValueStorePutOptions {
2359
- expirationSecondsTtl?: number;
2360
- }
2361
-
2362
- /**
2363
- * @beta
2364
- */
2365
- declare interface LogEntry {
2366
- logOwner: LogOwnerType;
2367
- logSource: LogSourceType;
2368
- level: LogLevel;
2369
- timestamp: Date;
2370
- loggingId: string;
2371
- buildId: string;
2372
- rayId: string | null;
2373
- messages: unknown[];
2374
- requestId: string;
2375
- /**
2376
- * A counter that increments each time a log is sent
2377
- * This is to get around the issue where logs in workers often have the
2378
- * same timestamp. We can use this number to sort order.
2379
- */
2380
- vectorClock: number;
2381
- }
2382
-
2383
- declare interface LogField {
2384
- name: string;
2385
- content: Primitive;
2386
- }
2387
-
2388
- /**
2389
- * @beta
2390
- */
2391
- declare type LogFormat = "pretty" | "json" | "gcp" | "cloudflare";
2392
-
2393
- /**
2394
- * @beta
2395
- */
2396
- export declare interface Logger {
2397
- debug(...messages: unknown[]): void;
2398
- info(...messages: unknown[]): void;
2399
- log(...messages: unknown[]): void;
2400
- warn(...messages: unknown[]): void;
2401
- error(...messages: unknown[]): void;
2402
- }
2403
-
2404
- /* Excluded from this release type: LoggingContext */
2405
-
2406
- declare interface LogInsightLogEntry {
2407
- text: string;
2408
- timestamp: number;
2409
- fields: LogField[];
2410
- }
2411
-
2412
- /**
2413
- * @beta
2414
- */
2415
- export declare type LogLevel = "debug" | "info" | "warn" | "error";
2416
-
2417
- /**
2418
- * @beta
2419
- */
2420
- declare type LogOwnerType = "system" | "user";
2421
-
2422
- declare abstract class LogPlugin extends RuntimePlugin {
2423
- /* Excluded from this release type: getTransport */
2424
- }
2425
-
2426
- declare type LogSourceType = "runtime" | "request";
2427
-
2428
- /* Excluded from this release type: LogTransport */
2429
-
2430
- export declare class LokiLoggingPlugin extends LogPlugin {
2431
- private options;
2432
- constructor(options: LokiLoggingPluginOptions);
2433
- /* Excluded from this release type: getTransport */
2434
- }
2435
-
2436
- declare interface LokiLoggingPluginOptions {
2437
- url: string;
2438
- username: string;
2439
- password: string;
2440
- }
2441
-
2442
- /* Excluded from this release type: LookupResult */
2443
-
2444
- export declare class MemoryZoneReadThroughCache<T = unknown> {
2445
- #private;
2446
- constructor(name: string, context: ZuploContext);
2447
- get(key: string): Promise<T | undefined>;
2448
- put(key: string, data: T, ttlSeconds: number): void;
2449
- }
2450
-
2451
- /* Excluded from this release type: MeteringPlugin */
2452
-
2453
- /**
2454
- * @beta
2455
- */
2456
- declare type MeteringRegions = "us-central1" | "europe-west4";
2457
-
2458
- /**
2459
- * @beta
2460
- */
2461
- declare interface MeteringSubscription {
2462
- status: MeteringSubscriptionStatus;
2463
- type: "credits" | "periodic";
2464
- region: MeteringRegions;
2465
- renewalStrategy: "hourly" | "monthly" | "yearly";
2466
- customerKey: string;
2467
- /**
2468
- * Array of Stripe product ids, they start with "prod_"
2469
- */
2470
- planExternalIds: string[];
2471
- /**
2472
- * Stripe subscription id, starts with "sub_"
2473
- */
2474
- subscriptionExternalId?: string;
2475
- /**
2476
- * Stripe customer id, starts with "cus_"
2477
- */
2478
- customerExternalId?: string;
2479
- metadata?: Record<string, any>;
2480
- }
2481
-
2482
- /**
2483
- * @beta
2484
- */
2485
- declare type MeteringSubscriptionStatus = "active" | "inactive" | "incomplete" | "incomplete-expired" | "trialing" | "past-due" | "canceled" | "unpaid";
2486
-
2487
- /* Excluded from this release type: MetricsData */
2488
-
2489
- declare abstract class MetricsPlugin extends RuntimePlugin {
2490
- /* Excluded from this release type: getTransport */
2491
- }
2492
-
2493
- declare interface MetricsTransport {
2494
- pushMetrics(entry: MetricsData, context: ZuploContext): void;
2495
- }
2496
-
2497
- declare interface MetricsType {
2498
- latency?: boolean;
2499
- requestContentLength?: boolean;
2500
- responseContentLength?: boolean;
2501
- }
2502
-
2503
- /**
2504
- * The options for this policy.
2505
- */
2506
- export declare interface MockApiInboundOptions {
2507
- /**
2508
- * 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.
2509
- */
2510
- random?: boolean;
2511
- /**
2512
- * 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`.
2513
- */
2514
- responsePrefixFilter?: string;
2515
- /**
2516
- * Specify the content-type of the response to select from. If not specified, the first matching response is used (or random).
2517
- */
2518
- contentType?: string;
2519
- /**
2520
- * Specify the name of the example to select. If not specified, the first matching response is used (or random).
2521
- */
2522
- exampleName?: string;
2523
- }
2524
-
2525
- /**
2526
- * Returns example responses from the OpenAPI document associated with this route.
2527
- *
2528
- * @title Mock API Response
2529
- * @public
2530
- * @param request - The ZuploRequest
2531
- * @param context - The ZuploContext
2532
- * @param options - The policy options set in policies.json
2533
- * @param policyName - The name of the policy as set in policies.json
2534
- * @returns A Request or a Response
2535
- */
2536
- export declare const MockApiInboundPolicy: InboundPolicyHandler<MockApiInboundOptions>;
2537
-
2538
- declare type Modify<T, R> = Omit<T, keyof R> & R;
2539
-
2540
- declare interface MoesifContext {
2541
- apiVersion?: string;
2542
- userId?: string;
2543
- companyId?: string;
2544
- sessionToken?: string;
2545
- metadata?: unknown;
2546
- }
2547
-
2548
- /**
2549
- * Moesif is an API analytics and billing service. This policy allows you to send metering calls for each API to their events batch endpoint.
2550
- *
2551
- * @remarks
2552
- * Moesif {@link https://moesif.com|moesif.com} is an API analytics and monetization
2553
- * platform. This policy allows you to measure (and meter) API calls flowing
2554
- * through your Zuplo gateway.
2555
- *
2556
- * Add the policy to each route you want to meter. Note you can specify the Meter
2557
- * API Name and Meter Value (meter increment) at the policy level.
2558
- *
2559
- * @title Moesif Analytics & Billing
2560
- * @public
2561
- * @param request - The ZuploRequest
2562
- * @param context - The ZuploContext
2563
- * @param options - The policy options set in policies.json
2564
- * @param policyName - The name of the policy as set in policies.json
2565
- * @returns A Request or a Response
2566
- */
2567
- export declare function MoesifInboundPolicy(request: ZuploRequest, context: ZuploContext, passedOptions: MoesifInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric>>;
2568
-
2569
- /**
2570
- * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
2571
- */
2572
- export declare interface MoesifInboundPolicyOptions {
2573
- /**
2574
- * Your Moesif application ID.
2575
- */
2576
- applicationId: string;
2577
- /**
2578
- * Set to false to disable sending the request body to Moesif.
2579
- */
2580
- logRequestBody?: boolean;
2581
- /**
2582
- * Set to false to disable sending the response body to Moesif.
2583
- */
2584
- logResponseBody?: boolean;
2585
- }
2586
-
2587
- /**
2588
- * The Monetization policy enables you to track & monetize by your API's usage
2589
- *
2590
- * @remarks
2591
- * The Monetization policy allows you to track and monetize the usage of our API resources,
2592
- * declaratively and programatically.
2593
- *
2594
- * @title Monetization
2595
- * @beta
2596
- * @param request - The ZuploRequest
2597
- * @param context - The ZuploContext
2598
- * @param options - The policy options set in policies.json
2599
- * @param policyName - The name of the policy as set in policies.json
2600
- * @returns A Request or a Response
2601
- */
2602
- export declare class MonetizationInboundPolicy extends InboundPolicy<MonetizationInboundPolicyOptions> {
2603
- static getSubscription(context: ZuploContext): MonetizationSubscription | undefined;
2604
- static setMeters(context: ZuploContext, meters: MonetizationPolicyMeters): void;
2605
- handler(request: ZuploRequest<RequestGeneric>, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
2606
- }
2607
-
2608
- /**
2609
- * The options for this policy.
2610
- */
2611
- export declare interface MonetizationInboundPolicyOptions {
2612
- /**
2613
- * Indicates if requests without subscription should be allowed or not.
2614
- */
2615
- allowRequestsWithoutSubscription?: boolean;
2616
- /**
2617
- * Indicates which subscription statuses should be allowed.
2618
- */
2619
- allowedSubscriptionStatuses?: ("active" | "inactive" | "incomplete" | "incomplete-expired" | "trialing" | "past-due" | "canceled" | "unpaid")[];
2620
- /**
2621
- * Indicates the bucket to be used, overrides the default one.
2622
- */
2623
- bucketId?: string;
2624
- /**
2625
- * Indicates if requests over quota should be allowed or not.
2626
- */
2627
- allowRequestsOverQuota?: boolean;
2628
- /**
2629
- * The meters to be used by the policy against the subscription quota.
2630
- */
2631
- meters: {
2632
- /**
2633
- * This interface was referenced by `undefined`'s JSON-Schema definition
2634
- * via the `patternProperty` "^.*$".
2635
- */
2636
- [k: string]: number;
2637
- };
2638
- /**
2639
- * A list of successful status codes and ranges "200-299, 304" that should trigger a metering call.
2640
- */
2641
- meterOnStatusCodes?: string | number[];
2642
- }
2643
-
2644
- declare type MonetizationPolicyMeters = {
2645
- [Key in string]: number;
2646
- };
2647
-
2648
- /**
2649
- * @beta
2650
- */
2651
- export declare interface MonetizationSubscription extends MeteringSubscription {
2652
- /**
2653
- * Metering subscription id, starts with "sbsc_"
2654
- */
2655
- id: string;
2656
- createdOn: string;
2657
- updatedOn: string;
2658
- quotaResetAnchor?: Date;
2659
- meters: SubscriptionMeters;
2660
- }
2661
-
2662
- declare interface NotFoundOptions {
2663
- routesMatchedByPathOnly: RouteConfiguration[];
2664
- }
2665
-
2666
- /**
2667
- * Authenticate users using Okta issued JWT tokens.
2668
- *
2669
- * @remarks
2670
- * Authenticate requests with JWT tokens issued by Okta. This is a customized
2671
- * version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy} specifically
2672
- * for Okta.
2673
- *
2674
- * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
2675
- * about OAuth authorization in Zuplo.
2676
- *
2677
- * @title Okta JWT Auth
2678
- * @public
2679
- * @param request - The ZuploRequest
2680
- * @param context - The ZuploContext
2681
- * @param options - The policy options set in policies.json
2682
- * @param policyName - The name of the policy as set in policies.json
2683
- * @returns A Request or a Response
2684
- */
2685
- export declare const OktaJwtInboundPolicy: InboundPolicyHandler<OktaJwtInboundPolicyOptions>;
2686
-
2687
- /**
2688
- * The options for this policy.
2689
- */
2690
- export declare interface OktaJwtInboundPolicyOptions {
2691
- /**
2692
- * 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.
2693
- */
2694
- allowUnauthenticatedRequests?: boolean;
2695
- /**
2696
- * Your Okta authorization server's issuer URL. For example, `https://dev-12345.okta.com/oauth2/abc`.
2697
- */
2698
- issuerUrl: string;
2699
- /**
2700
- * The Okta audience of your API, for example `api://my-api`.
2701
- */
2702
- audience?: string;
2703
- }
2704
-
2705
- /**
2706
- * @public
2707
- */
2708
- declare interface OnRequestHook {
2709
- (request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response> | (ZuploRequest | Response);
2710
- }
2711
-
2712
- /**
2713
- * @public
2714
- */
2715
- declare interface OnResponseSendingFinalHook {
2716
- (response: Response, request: ZuploRequest, context: ZuploContext): Promise<void> | void;
2717
- }
2718
-
2719
- /**
2720
- * @public
2721
- */
2722
- declare interface OnResponseSendingHook {
2723
- (response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
2724
- }
2725
-
2726
- declare interface OnSendingAwsLambdaEventHook {
2727
- (request: ZuploRequest, context: ZuploContext, event: AwsLambdaEventV1 | AwsLambdaEventV2): Promise<AwsLambdaEventV1 | AwsLambdaEventV2>;
2728
- }
2729
-
2730
- /**
2731
- * @beta
2732
- * @param request - The ZuploRequest
2733
- * @param context - The ZuploContext
2734
- * @returns ZuploResponse
2735
- */
2736
- export declare function openApiSpecHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
2737
-
2738
- /**
2739
- * The Open ID JWT Authentication policy allows you to authenticate incoming requests using an Open ID compliant bearer token.
2740
- *
2741
- * @remarks
2742
- * The Open ID JWT Authentication policy allows you to authenticate incoming
2743
- * requests using an Open ID-compliant bearer token. It works with common
2744
- * authentication services like Auth0 (sample here) but should also work with any
2745
- * valid Open ID JWT token.
2746
- *
2747
- * When configured, you can have Zuplo check incoming requests for a JWT token and
2748
- * automatically populate the `ZuploRequest` 's `user` property with a user object.
2749
- * This `user` object will have a `sub` property - taking the `sub` id from the JWT
2750
- * token. It will also have a `data` property populated by other data returned in
2751
- * the JWT token (including any claims).
2752
- *
2753
- * See {@link https://zuplo.com/docs/articles/oauth-authentication|this document} for more information
2754
- * about OAuth authorization in Zuplo.
2755
- *
2756
- * @title JWT Auth
2757
- * @public
2758
- * @param request - The ZuploRequest
2759
- * @param context - The ZuploContext
2760
- * @param options - The policy options set in policies.json
2761
- * @param policyName - The name of the policy as set in policies.json
2762
- * @returns A Request or a Response
2763
- */
2764
- export declare const OpenIdJwtInboundPolicy: InboundPolicyHandler<OpenIdJwtInboundPolicyInternalOptions>;
2765
-
2766
- declare interface OpenIdJwtInboundPolicyInternalOptions extends Omit<OpenIdJwtInboundPolicyOptions, "secret"> {
2767
- secret?: string | KeyLike;
2768
- }
2769
-
2770
- /**
2771
- * The options for this policy.
2772
- */
2773
- export declare interface OpenIdJwtInboundPolicyOptions {
2774
- /**
2775
- * The expected issuer claim in the JWT token.
2776
- */
2777
- issuer?: string;
2778
- /**
2779
- * The expected audience claim in the JWT token.
2780
- */
2781
- audience?: string;
2782
- /**
2783
- * 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).
2784
- */
2785
- jwkUrl?: string;
2786
- /**
2787
- * The key used to verify the signature of the JWT token (either this or `jwkUrl` must be set).
2788
- */
2789
- secret?: string;
2790
- /**
2791
- * indicates whether the request should continue if authentication fails. Defaults is `false` which means unauthenticated users will automatically receive a 401 response.
2792
- */
2793
- allowUnauthenticatedRequests?: boolean;
2794
- /**
2795
- * The name of the property in the JWT token that contains the user's unique identifier.
2796
- */
2797
- subPropertyName?: string;
2798
- /**
2799
- * Additional headers to send with the JWK request.
2800
- */
2801
- headers?: {
2802
- [k: string]: string;
2803
- };
2804
- }
2805
-
2806
- export declare const originalFetch: typeof fetch;
2807
-
2808
- /**
2809
- * @beta
2810
- * A policy that can modify the outgoing HTTP response before it is returned
2811
- * to the client.
2812
- */
2813
- export declare abstract class OutboundPolicy<TOptions = any> extends PolicyBase<TOptions> {
2814
- /**
2815
- * The handler that is called each time this policy is invoked
2816
- *
2817
- * @param response - The outgoing Response
2818
- * @param request - The incoming Request
2819
- * @param context - The current context of the Request
2820
- */
2821
- abstract handler(response: Response, request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest | Response>;
2822
- }
2823
-
2824
- /**
2825
- * @public
2826
- * A policy that can modify the outgoing HTTP response before it is returned
2827
- * to the client.
2828
- *
2829
- * @param response - The outgoing Response
2830
- * @param request - The incoming Request
2831
- * @param context - The current context of the Request
2832
- * @param options - The configuration options for the policy
2833
- * @param policyName - The name set on the policy in the configuration
2834
- * @returns A Response object
2835
- */
2836
- export declare interface OutboundPolicyHandler<TOptions = any> {
2837
- (response: Response, request: ZuploRequest, context: ZuploContext, options: TOptions, policyName: string): Promise<Response>;
2838
- }
2839
-
2840
- /**
2841
- * @beta
2842
- */
2843
- export declare type ParameterBaseObject = Modify<Omit<OpenAPIV3_1.ParameterBaseObject, "content" | "allowEmptyValue" | "style" | "allowReserved" | "explode" | "example" | "examples">, {
2844
- schema: OpenAPIV3_1.SchemaObject;
2845
- }>;
2846
-
2847
- /**
2848
- * @beta
2849
- */
2850
- export declare interface ParameterDefinition extends ParameterBaseObject {
2851
- name: string;
2852
- in: string;
2853
- }
2854
-
2855
- /**
2856
- * This is the parsed values of the Cors configuration. All
2857
- * values in the parsed configuration are in the format that the headers
2858
- * use them (i.e. everything is converted to a string)
2859
- */
2860
- declare interface ParsedCorsPolicyConfiguration {
2861
- name: string;
2862
- allowCredentials: string | undefined;
2863
- maxAge: string | undefined;
2864
- allowedOrigins: string[];
2865
- allowedMethods?: string;
2866
- allowedHeaders?: string;
2867
- exposeHeaders?: string;
2868
- }
2869
-
2870
- declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
2871
- corsPolicies: ParsedCorsPolicyConfiguration[];
2872
- }
2873
-
2874
- /* Excluded from this release type: PolicyBase */
2875
-
2876
- export declare interface PolicyConfiguration {
2877
- name: string;
2878
- policyType: string;
2879
- handler: HandlerDefinition;
2880
- options?: unknown;
2881
- }
2882
-
2883
- declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
2884
-
2885
- /**
2886
- * Problem Details for HTTP APIs
2887
- * @see {@link https://www.rfc-editor.org/rfc/rfc7807 |RFC7807}
2888
- * @beta
2889
- */
2890
- declare interface ProblemDetails {
2891
- /**
2892
- * A URI reference [RFC3986] that identifies the problem type.
2893
- *
2894
- * @remarks
2895
- *
2896
- * This specification encourages that, when dereferenced, it provide
2897
- * human-readable documentation for the problem type
2898
- * (e.g., using HTML [W3C.REC-html5-20141028]). When this member is not
2899
- * present, its value is assumed to be "about:blank".
2900
- *
2901
- * @see {@link https://www.rfc-editor.org/rfc/rfc3986|RFC3986}
2902
- *
2903
- * @example
2904
- * https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429
2905
- */
2906
- type: string;
2907
- /**
2908
- * A short, human-readable summary of the problem type.
2909
- *
2910
- * @remarks
2911
- *
2912
- * It SHOULD NOT change from occurrence to occurrence of the problem, except
2913
- * for purposes of localization (e.g., using proactive content negotiation;
2914
- *
2915
- * @see {@link https://www.rfc-editor.org/rfc/rfc7231#section-3.4|RFC7231, Section 3.4}.
2916
- *
2917
- * @example
2918
- * Too many requests
2919
- */
2920
- title: string;
2921
- /**
2922
- * The HTTP status code () generated by the origin server for this occurrence
2923
- * of the problem.
2924
- *
2925
- * @see {@link https://www.rfc-editor.org/rfc/rfc7231#section-6|RFC7231, Section 6}
2926
- *
2927
- * @example
2928
- * 429
2929
- */
2930
- status: HttpStatusCode;
2931
- /**
2932
- * A human-readable explanation specific to this occurrence of the problem.
2933
- *
2934
- * @example
2935
- * Rate limit exceeded, try again later
2936
- */
2937
- detail?: string;
2938
- /**
2939
- * A URI reference that identifies the specific occurrence of the problem.
2940
- * It may or may not yield further information if dereferenced.
2941
- *
2942
- * @example
2943
- * josh-twist::test::main::prod::4edc99c/pizza/size/large/type/pepperoni
2944
- */
2945
- instance?: string;
2946
- /**
2947
- * Identifiers useful to zuplo and the customer to locate more information in
2948
- * logs. To reduce the number of properties these strings are concated
2949
- *
2950
- * @example
2951
- * requestId:6384105d-1d34-4a7f-8ad7-5c428e97ab49/ray:lcielfnuuclvh/buildId:293908c3-e359-4037-874f-d9c71d4a7263
2952
- */
2953
- trace?: Record<string, string>;
2954
- /**
2955
- * Problem type definitions MAY extend the problem details object with
2956
- * additional members.
2957
- */
2958
- [extensionMembers: string]: any;
2959
- }
2960
-
2961
- /**
2962
- * @beta
2963
- */
2964
- export declare interface ProblemResponseDetails {
2965
- problem: ProblemDetails;
2966
- /**
2967
- * statusText used in the response to accompany the
2968
- */
2969
- statusText?: string;
2970
- /**
2971
- * Additional headers to be sent with the standard response. Used for things
2972
- * like rate-limit retry-after headers (to meet other standards)
2973
- */
2974
- additionalHeaders?: HeadersInit;
2975
- }
2976
-
2977
- /**
2978
- * @beta
2979
- */
2980
- export declare interface ProblemResponseFormat {
2981
- (problemDetails: ProblemResponseDetails, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
2982
- }
2983
-
2984
- /**
2985
- * @beta
2986
- */
2987
- export declare class ProblemResponseFormatter {
2988
- static format(problemDetails: ProblemResponseDetails, request: ZuploRequest, context: ZuploContext): Promise<Response>;
2989
- }
2990
-
2991
- /**
2992
- * Authenticate users using PropelAuth issued JWT tokens.
2993
- *
2994
- * @remarks
2995
- * Authenticate requests with JWT tokens issued by {@link https://propelauth.com|PropelAuth}.
2996
- * This is a customized version of the {@link https://zuplo.com/docs/policies/open-id-jwt-auth-inbound|OpenId JWT Policy}
2997
- * specifically for PropelAuth.
2998
- *
2999
- * @title PropelAuth JWT Auth
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 PropelAuthJwtInboundPolicy: InboundPolicyHandler<PropelAuthJwtInboundPolicyOptions>;
3008
-
3009
- /**
3010
- * The options for this policy.
3011
- */
3012
- export declare interface PropelAuthJwtInboundPolicyOptions {
3013
- /**
3014
- * 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.
3015
- */
3016
- allowUnauthenticatedRequests?: boolean;
3017
- /**
3018
- * Your PropelAuth authUrl. For example, `https://6587563.propelauthtest.com`.
3019
- */
3020
- authUrl: string;
3021
- /**
3022
- * 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.
3023
- */
3024
- verifierKey: string;
3025
- }
3026
-
3027
- /* Excluded from this release type: purgeGatewayCache */
3028
-
3029
- /**
3030
- * 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.
3031
- */
3032
- declare type RateLimitByType = "user" | "ip" | "function" | "all";
3033
-
3034
- /**
3035
- * Adds the retry-after header.
3036
- */
3037
- declare type RateLimitHeaderMode = "none" | "retry-after";
3038
-
3039
- /**
3040
- * The rate-limiting policy is used to limit the number of requests that can be made against your API based on a key.
3041
- *
3042
- * @remarks
3043
- * Rate-limiting allows you to set a maximum rate of requests for your API gateway.
3044
- * This is useful to enforce rate limits agreed with your clients and protect your
3045
- * downstream services.
3046
- *
3047
- * The Zuplo Rate-Limit allows you to limit based on different attributes of the
3048
- * incoming request. For example, you might set a rate limit of 10 requests per
3049
- * second per user, or 20 requests per second for a given IP address.
3050
- *
3051
- * The Zuplo rate-limiter also allows you to set a custom bucket name by which to
3052
- * effect a rate-limit using a function.
3053
- *
3054
- * When a client reaches a rate limit - they will receive a `429` response code.
3055
- *
3056
- * @title Rate Limiting
3057
- * @public
3058
- * @param request - The ZuploRequest
3059
- * @param context - The ZuploContext
3060
- * @param options - The policy options set in policies.json
3061
- * @param policyName - The name of the policy as set in policies.json
3062
- * @returns A Request or a Response
3063
- */
3064
- declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
3065
- export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy }
3066
- export { RateLimitInboundPolicy }
3067
-
3068
- /**
3069
- * The options for this policy.
3070
- */
3071
- declare interface RateLimitInboundPolicyOptions {
3072
- rateLimitBy: RateLimitByType;
3073
- /**
3074
- * The max number of requests allowed in the given time window.
3075
- */
3076
- requestsAllowed: number;
3077
- /**
3078
- * The time window in which the requests are rate-limited. The count restarts after each window expires.
3079
- */
3080
- timeWindowMinutes: number;
3081
- /**
3082
- * The function that returns dynamic configuration data. Used only with `rateLimitBy=function`.
3083
- */
3084
- identifier?: {
3085
- /**
3086
- * used only with rateLimitBy=function. Specifies the export to load your custom bucket function, e.g. `default`, `rateLimitIdentifier`.
3087
- */
3088
- export: string;
3089
- /**
3090
- * Specifies the module to load your custom bucket function, in the format `$import(./modules/my-module)`.
3091
- */
3092
- module: string;
3093
- };
3094
- headerMode?: RateLimitHeaderMode;
3095
- /**
3096
- * If true, the policy will throw an error in the event there is a problem connecting to the rate limit service.
3097
- */
3098
- throwOnFailure?: boolean;
3099
- mode?: RateLimitMode;
3100
- }
3101
- export { RateLimitInboundPolicyOptions as BasicRateLimitInboundPolicyOptions }
3102
- export { RateLimitInboundPolicyOptions }
3103
-
3104
- /**
3105
- * 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.
3106
- */
3107
- declare type RateLimitMode = "strict" | "async";
3108
-
3109
- /**
3110
- * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
3111
- */
3112
- declare interface ReadmeMeteringInboundPolicyOptions {
3113
- /**
3114
- * The API key to use when sending metrics calls to Readme.
3115
- */
3116
- apiKey: string;
3117
- /**
3118
- * 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.
3119
- */
3120
- userLabelPropertyPath?: string;
3121
- /**
3122
- * 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.
3123
- */
3124
- userEmailPropertyPath?: string;
3125
- /**
3126
- * Whether the data should be ingested as 'development' mode or not. Defaults to true for working-copy and false for all other environments.
3127
- */
3128
- development?: boolean;
3129
- /**
3130
- * 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.
3131
- */
3132
- useFullRequestPath?: boolean;
3133
- /**
3134
- * The URL to send metering events. This is useful for testing purposes.
3135
- */
3136
- url?: string;
3137
- }
3138
-
3139
- /**
3140
- * Readme is a developer documentation and API metrics company. This policy pushes logs to their API calls dashboard.
3141
- *
3142
- * @remarks
3143
- * {@link https://readme.com|Readme} is a developer Documentation and
3144
- * metrics service. This policy pushes the request/response data to their ingestion
3145
- * endpoint so you can see your Zuplo API traffic in their API calls dashboard.
3146
- *
3147
- * @title Readme Metrics
3148
- * @public
3149
- * @param request - The ZuploRequest
3150
- * @param context - The ZuploContext
3151
- * @param options - The policy options set in policies.json
3152
- * @param policyName - The name of the policy as set in policies.json
3153
- * @returns A Request or a Response
3154
- */
3155
- export declare function ReadmeMetricsInboundPolicy(request: ZuploRequest, context: ZuploContext, options: ReadmeMeteringInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric>>;
3156
-
3157
- /**
3158
- * @beta
3159
- * @param request - The ZuploRequest
3160
- * @param context - The ZuploContext
3161
- * @returns ZuploResponse
3162
- */
3163
- export declare function redirectHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
3164
-
3165
- /**
3166
- * Remove headers from the incoming request.
3167
- *
3168
- * @title Remove Request Headers
3169
- * @public
3170
- * @param request - The ZuploRequest
3171
- * @param context - The ZuploContext
3172
- * @param options - The policy options set in policies.json
3173
- * @param policyName - The name of the policy as set in policies.json
3174
- * @returns A Request or a Response
3175
- */
3176
- export declare const RemoveHeadersInboundPolicy: InboundPolicyHandler<RemoveHeadersInboundPolicyOptions>;
3177
-
3178
- /**
3179
- * The options for this policy.
3180
- */
3181
- export declare interface RemoveHeadersInboundPolicyOptions {
3182
- /**
3183
- * An array of headers to remove from the incoming request.
3184
- */
3185
- headers: string[];
3186
- }
3187
-
3188
- /**
3189
- * Remove configured headers from the outgoing response.
3190
- *
3191
- * @title Remove Response Headers
3192
- * @public
3193
- * @param request - The ZuploRequest
3194
- * @param context - The ZuploContext
3195
- * @param options - The policy options set in policies.json
3196
- * @param policyName - The name of the policy as set in policies.json
3197
- * @returns A Request or a Response
3198
- */
3199
- export declare const RemoveHeadersOutboundPolicy: OutboundPolicyHandler<RemoveHeadersOutboundPolicyOptions>;
3200
-
3201
- /**
3202
- * The options for this policy.
3203
- */
3204
- export declare interface RemoveHeadersOutboundPolicyOptions {
3205
- /**
3206
- * An array of headers to be removed from the outgoing response.
3207
- */
3208
- headers: string[];
3209
- }
3210
-
3211
- /**
3212
- * Remove query parameters from the incoming request
3213
- *
3214
- * @title Remove Query Parameters
3215
- * @public
3216
- * @param request - The ZuploRequest
3217
- * @param context - The ZuploContext
3218
- * @param options - The policy options set in policies.json
3219
- * @param policyName - The name of the policy as set in policies.json
3220
- * @returns A Request or a Response
3221
- */
3222
- export declare const RemoveQueryParamsInboundPolicy: InboundPolicyHandler<RemoveQueryParamsInboundPolicyOptions>;
3223
-
3224
- /**
3225
- * The options for this policy.
3226
- */
3227
- export declare interface RemoveQueryParamsInboundPolicyOptions {
3228
- /**
3229
- * An array of query parameters to be removed from the incoming request.
3230
- */
3231
- params: string[];
3232
- }
3233
-
3234
- /**
3235
- * Replace a string in the incoming request body
3236
- *
3237
- * @title Replace String in Response Body
3238
- * @public
3239
- * @param request - The ZuploRequest
3240
- * @param context - The ZuploContext
3241
- * @param options - The policy options set in policies.json
3242
- * @param policyName - The name of the policy as set in policies.json
3243
- * @returns A Request or a Response
3244
- */
3245
- export declare const ReplaceStringOutboundPolicy: OutboundPolicyHandler<ReplaceStringOutboundPolicyOptions>;
3246
-
3247
- /**
3248
- * The options for this policy.
3249
- */
3250
- export declare interface ReplaceStringOutboundPolicyOptions {
3251
- /**
3252
- * The type of string replacement to perform.
3253
- */
3254
- mode: "regexp" | "string";
3255
- /**
3256
- * The pattern to match.
3257
- */
3258
- match: string;
3259
- /**
3260
- * The value to each match is replaced with.
3261
- */
3262
- replaceWith: string;
3263
- }
3264
-
3265
- /**
3266
- * The types of the properties in a request
3267
- * @public
3268
- */
3269
- declare interface RequestGeneric extends RequestInitGeneric {
3270
- Query?: RequestQueryDefault;
3271
- }
3272
-
3273
- /**
3274
- * The types of the properties in a request init object
3275
- * @public
3276
- */
3277
- declare interface RequestInitGeneric {
3278
- UserData?: UserDataDefault;
3279
- Params?: RequestParamsDefault;
3280
- }
3281
-
3282
- declare type RequestParamsDefault = Record<string, string>;
3283
-
3284
- declare type RequestQueryDefault = Record<string, string>;
3285
-
3286
- /**
3287
- * Enforces a maximum size in bytes of the incoming request.
3288
- *
3289
- * @title Request Size Limit
3290
- * @public
3291
- * @param request - The ZuploRequest
3292
- * @param context - The ZuploContext
3293
- * @param options - The policy options set in policies.json
3294
- * @param policyName - The name of the policy as set in policies.json
3295
- * @returns A Request or a Response
3296
- */
3297
- export declare const RequestSizeLimitInboundPolicy: InboundPolicyHandler<RequestSizeLimitInboundPolicyOptions>;
3298
-
3299
- /**
3300
- * The options for this policy.
3301
- */
3302
- export declare interface RequestSizeLimitInboundPolicyOptions {
3303
- /**
3304
- * The maximum size of the request in bytes.
3305
- */
3306
- maxSizeInBytes: number;
3307
- /**
3308
- * 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.
3309
- */
3310
- trustContentLengthHeader?: boolean;
3311
- }
3312
-
3313
- /**
3314
- * The authorized identity on the incoming request
3315
- * @public
3316
- */
3317
- export declare interface RequestUser<TUserData> {
3318
- sub: string;
3319
- data: TUserData;
3320
- }
3321
-
3322
- /**
3323
- * Validate inbound requests based on Open API specification
3324
- *
3325
- * @remarks
3326
- * The Request Validation policy is used to validate incoming requests based on
3327
- * schemas in OpenAPI specifications.
3328
- *
3329
- * When configured, any requests that do not conform to your OpenAPI schema will be
3330
- * rejected with a `400: Bad Request` response containing a detailed error message
3331
- * (in JSON) explaining why the request was not accepted.
3332
- *
3333
- * @title Request Validation
3334
- * @public
3335
- * @param request - The ZuploRequest
3336
- * @param context - The ZuploContext
3337
- * @param options - The policy options set in policies.json
3338
- * @param policyName - The name of the policy as set in policies.json
3339
- * @returns A Request or a Response
3340
- */
3341
- export declare const RequestValidationInboundPolicy: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
3342
-
3343
- /**
3344
- * The options for this policy.
3345
- */
3346
- export declare interface RequestValidationInboundPolicyOptions {
3347
- /**
3348
- * The log level to use when logging validation errors.
3349
- */
3350
- logLevel?: "error" | "warn" | "info" | "debug";
3351
- validateBody?: ValidationOptions;
3352
- validateQueryParameters?: ValidationOptions1;
3353
- validatePathParameters?: ValidationOptions2;
3354
- validateHeaders?: ValidationOptions3;
3355
- /**
3356
- * Whether to include the request in the logs.
3357
- */
3358
- includeRequestInLogs?: boolean;
3359
- }
3360
-
3361
- /**
3362
- * Sets an allow-list for an origin header
3363
- *
3364
- * @remarks
3365
- * The Require Origin policy is used to enforce that the client is sending an
3366
- * `origin` header that matches your allow-list specified in the policy options.
3367
- *
3368
- * This is useful if you want to stop any browser traffic from different domains.
3369
- *
3370
- * However, it is important to note that it does not guarantee that traffic is only
3371
- * coming from a browser. Somebody could simulate a browser request from a backend
3372
- * server and set any origin they like.
3373
- *
3374
- * If the incoming origin is missing, or not allowed - a 400 Forbidden Problem
3375
- * Response will be sent to the client. You can customize the `detail` property in
3376
- * the policy options.
3377
- *
3378
- * @title Require Origin
3379
- * @public
3380
- * @param request - The ZuploRequest
3381
- * @param context - The ZuploContext
3382
- * @param options - The policy options set in policies.json
3383
- * @param policyName - The name of the policy as set in policies.json
3384
- * @returns A Request or a Response
3385
- */
3386
- export declare const RequireOriginInboundPolicy: InboundPolicyHandler<RequireOriginInboundPolicyOptions>;
3387
-
3388
- /**
3389
- * The options for this policy.
3390
- */
3391
- export declare interface RequireOriginInboundPolicyOptions {
3392
- /**
3393
- * A comma separated string containing valid origins.
3394
- */
3395
- origins: string;
3396
- /**
3397
- * The `detail` of the HTTP Problem response, if the origin is missing or disallowed.
3398
- */
3399
- failureDetail?: string;
3400
- }
3401
-
3402
- declare type ResolveRequestParams<TParams extends RequestParamsDefault | undefined> = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
3403
-
3404
- declare type ResolveRequestQuery<TQuery extends RequestQueryDefault | undefined> = TQuery extends RequestQueryDefault ? TQuery : RequestQueryDefault;
3405
-
3406
- declare type ResolveUserData<TUserData extends UserDataDefault | undefined> = TUserData extends UserDataDefault ? TUserData : UserDataDefault;
3407
-
3408
- /**
3409
- * @beta
3410
- */
3411
- export declare type ResponsesDefinition = Record<HttpStatusCode | HttpStatusCodeRangeDefinition, Modify<Omit<OpenAPIV3_1.ResponseObject, "links">, {
3412
- headers?: {
3413
- [header: string]: ParameterBaseObject;
3414
- };
3415
- }>>;
3416
-
3417
- /**
3418
- * @beta
3419
- */
3420
- export declare class ResponseSendingEvent extends Event {
3421
- constructor(request: ZuploRequest, response: Response);
3422
- readonly request: ZuploRequest;
3423
- mutableResponse: Response | Promise<Response>;
3424
- }
3425
-
3426
- /**
3427
- * @beta
3428
- */
3429
- export declare class ResponseSentEvent extends Event {
3430
- constructor(request: ZuploRequest, response: Response);
3431
- readonly request: ZuploRequest;
3432
- readonly response: Response;
3433
- }
3434
-
3435
- export declare interface RouteConfiguration extends Omit<BuildRouteConfiguration, "raw"> {
3436
- /**
3437
- * @deprecated Please switch to "raw().operationId"
3438
- */
3439
- operationId?: string;
3440
- /**
3441
- * @deprecated Please switch to "raw().summary"
3442
- */
3443
- summary?: string;
3444
- /**
3445
- * @deprecated Please switch to "raw().tags"
3446
- */
3447
- tags?: string[];
3448
- /**
3449
- * @deprecated Please switch to "raw().parameters"
3450
- */
3451
- parameters?: ParameterDefinition[];
3452
- /**
3453
- * @deprecated Please switch to "raw().responses"
3454
- */
3455
- responses?: ResponsesDefinition;
3456
- raw<T>(): T;
3457
- }
3458
-
3459
- export declare interface RouteData {
3460
- /**
3461
- /* @deprecated This property is not used and will be removed in future versions
3462
- */
3463
- info?: OpenAPIV3_1.InfoObject;
3464
- /**
3465
- /* @deprecated This property is not used and will be removed in future versions
3466
- */
3467
- versions: VersionData[];
3468
- /**
3469
- * @minItems 0
3470
- */
3471
- routes: RouteConfiguration[];
3472
- policies?: PolicyConfiguration[];
3473
- corsPolicies?: CorsPolicyConfiguration[];
3474
- requestErrorHandler?: HandlerDefinition;
3475
- }
3476
-
3477
- /**
3478
- * @beta
3479
- */
3480
- export declare interface RouteHandler<T = unknown> {
3481
- (request: ZuploRequest, context: ZuploContext): Promise<T>;
3482
- }
3483
-
3484
- /* Excluded from this release type: Router */
3485
-
3486
- /* Excluded from this release type: RouterEntry */
3487
-
3488
- /* Excluded from this release type: RuntimeEnvironment */
3489
-
3490
- /**
3491
- * Used to indicate errors that are caused by user input
3492
- * These errors are shown to the user and logged in user logs
3493
- * These errors are NOT fatal and will not cause monitoring alerts
3494
- * @public
3495
- */
3496
- export declare class RuntimeError extends Error {
3497
- extensionMembers: Record<string, unknown> | undefined;
3498
- constructor(message: string, options?: ErrorOptions);
3499
- constructor(info: {
3500
- message: string;
3501
- extensionMembers?: Record<string, unknown>;
3502
- }, options?: ErrorOptions);
3503
- }
3504
-
3505
- /**
3506
- * Zuplo global runtime customization
3507
- * @beta
3508
- */
3509
- export declare interface RuntimeExtensions {
3510
- /**
3511
- * Custom response formatter
3512
- */
3513
- problemResponseFormat?: ProblemResponseFormat;
3514
- /**
3515
- * Register runtime plugins
3516
- */
3517
- addPlugin: (plugin: RuntimePlugin) => void;
3518
- /**
3519
- * Set a custom not found handler
3520
- */
3521
- notFoundHandler?: (request: ZuploRequest, context: ZuploContext, notFoundOptions: NotFoundOptions) => Promise<Response>;
3522
- addRequestHook(hook: OnRequestHook): void;
3523
- addResponseSendingHook(hook: OnResponseSendingHook): void;
3524
- addResponseSendingFinalHook(hook: OnResponseSendingFinalHook): void;
3525
- }
3526
-
3527
- export declare interface RuntimeExtensionsFunction {
3528
- (runtime: RuntimeExtensions): Promise<void>;
3529
- }
3530
-
3531
- declare abstract class RuntimePlugin {
3532
- }
3533
-
3534
- /* Excluded from this release type: RuntimeSettings */
3535
-
3536
- declare type RuntimeType = "deno" | "cloudflare";
3537
-
3538
- export declare function sanitizedIdentifierName(name: string): string;
3539
-
3540
- /**
3541
- * @deprecated Use RequestValidationInboundPolicy instead
3542
- */
3543
- export declare const SchemaBasedRequestValidation: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
3544
-
3545
- /* Excluded from this release type: serialize */
3546
-
3547
- /**
3548
- * @beta
3549
- */
3550
- export declare interface ServiceProvider {
3551
- addService<T>(name: string, service: T): void;
3552
- getService<T>(name: string): T;
3553
- }
3554
-
3555
- /* Excluded from this release type: ServiceProviderImpl */
3556
-
3557
- /**
3558
- * 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.
3559
- *
3560
- * @remarks
3561
- * The Set Body policy allows you to set or override the incoming request body.
3562
- * {@link https://zuplo.com/docs/articles/zp-body-removed|GET or HEAD requests do not support bodies on Zuplo},
3563
- * so be sure to use the {@link https://zuplo.com/docs/policies/change-method-inbound|Change Method}
3564
- * policy to update the method to a `POST` or whatever is appropriate. You might
3565
- * also need to use the {@link https://zuplo.com/docs/policies/set-headers-inbound|Set Header} policy to
3566
- * set a `content-type`.
3567
- *
3568
- * @title Set Body
3569
- * @public
3570
- * @param request - The ZuploRequest
3571
- * @param context - The ZuploContext
3572
- * @param options - The policy options set in policies.json
3573
- * @param policyName - The name of the policy as set in policies.json
3574
- * @returns A Request or a Response
3575
- */
3576
- export declare const SetBodyInboundPolicy: InboundPolicyHandler<SetBodyInboundPolicyOptions>;
3577
-
3578
- /**
3579
- * The options for this policy.
3580
- */
3581
- export declare interface SetBodyInboundPolicyOptions {
3582
- /**
3583
- * The value to set for the body.
3584
- */
3585
- body: string;
3586
- }
3587
-
3588
- /**
3589
- * Adds or sets headers on the incoming request.
3590
- *
3591
- * @remarks
3592
- * The set header policy adds a header to the request in the inbound pipeline. This
3593
- * can be used to set a security header required by the downstream service.
3594
- *
3595
- * @title Add or Set Request Headers
3596
- * @public
3597
- * @param request - The ZuploRequest
3598
- * @param context - The ZuploContext
3599
- * @param options - The policy options set in policies.json
3600
- * @param policyName - The name of the policy as set in policies.json
3601
- * @returns A Request or a Response
3602
- */
3603
- export declare const SetHeadersInboundPolicy: InboundPolicyHandler<SetHeadersInboundPolicyOptions>;
3604
-
3605
- /**
3606
- * The options for this policy.
3607
- */
3608
- export declare interface SetHeadersInboundPolicyOptions {
3609
- /**
3610
- * 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.
3611
- */
3612
- headers: {
3613
- /**
3614
- * The name of the header.
3615
- */
3616
- name: string;
3617
- /**
3618
- * The value of the header.
3619
- */
3620
- value: string;
3621
- /**
3622
- * Overwrite the value if the header is already present in the request.
3623
- */
3624
- overwrite?: boolean;
3625
- }[];
3626
- }
3627
-
3628
- /**
3629
- * Adds or sets headers on the on the outgoing response.
3630
- *
3631
- * @title Set Headers
3632
- * @public
3633
- * @param request - The ZuploRequest
3634
- * @param context - The ZuploContext
3635
- * @param options - The policy options set in policies.json
3636
- * @param policyName - The name of the policy as set in policies.json
3637
- * @returns A Request or a Response
3638
- */
3639
- export declare const SetHeadersOutboundPolicy: OutboundPolicyHandler<SetHeadersOutboundPolicyOptions>;
3640
-
3641
- /**
3642
- * The options for this policy.
3643
- */
3644
- export declare interface SetHeadersOutboundPolicyOptions {
3645
- /**
3646
- * 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.
3647
- */
3648
- headers: {
3649
- /**
3650
- * The name of the header.
3651
- */
3652
- name: string;
3653
- /**
3654
- * The value of the header.
3655
- */
3656
- value: string;
3657
- /**
3658
- * Overwrite the value if the header is already present in the response.
3659
- */
3660
- overwrite?: boolean;
3661
- }[];
3662
- }
3663
-
3664
- export declare function setMoesifContext(context: ZuploContext, moesifContext: MoesifContext): void;
3665
-
3666
- /**
3667
- * Adds or sets query parameters on the incoming request.
3668
- *
3669
- * @title Add or Set Query Parameters
3670
- * @public
3671
- * @param request - The ZuploRequest
3672
- * @param context - The ZuploContext
3673
- * @param options - The policy options set in policies.json
3674
- * @param policyName - The name of the policy as set in policies.json
3675
- * @returns A Request or a Response
3676
- */
3677
- export declare const SetQueryParamsInboundPolicy: InboundPolicyHandler<SetQueryParamsInboundPolicyOptions>;
3678
-
3679
- /**
3680
- * The options for this policy.
3681
- */
3682
- export declare interface SetQueryParamsInboundPolicyOptions {
3683
- /**
3684
- * 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.
3685
- */
3686
- params: {
3687
- /**
3688
- * The name of the param.
3689
- */
3690
- name: string;
3691
- /**
3692
- * The value of the param.
3693
- */
3694
- value: string;
3695
- /**
3696
- * Overwrite the value if the param is already present in the request.
3697
- */
3698
- overwrite?: boolean;
3699
- }[];
3700
- }
3701
-
3702
- /**
3703
- * Sets the status code on the on the outgoing response.
3704
- *
3705
- * @title Set Status Code
3706
- * @public
3707
- * @param request - The ZuploRequest
3708
- * @param context - The ZuploContext
3709
- * @param options - The policy options set in policies.json
3710
- * @param policyName - The name of the policy as set in policies.json
3711
- * @returns A Request or a Response
3712
- */
3713
- export declare const SetStatusOutboundPolicy: OutboundPolicyHandler<SetStatusOutboundPolicyOptions>;
3714
-
3715
- /**
3716
- * The options for this policy.
3717
- */
3718
- export declare interface SetStatusOutboundPolicyOptions {
3719
- /**
3720
- * The status code to be used in the response.
3721
- */
3722
- status?: number;
3723
- /**
3724
- * The statusText to be used in the response.
3725
- */
3726
- statusText?: string;
3727
- }
3728
-
3729
- /**
3730
- * Add a delay to the incoming request. Useful for testing.
3731
- *
3732
- * @title Sleep / Delay
3733
- * @public
3734
- * @param request - The ZuploRequest
3735
- * @param context - The ZuploContext
3736
- * @param options - The policy options set in policies.json
3737
- * @param policyName - The name of the policy as set in policies.json
3738
- * @returns A Request or a Response
3739
- */
3740
- export declare const SleepInboundPolicy: InboundPolicyHandler<SleepInboundPolicyOptions>;
3741
-
3742
- /**
3743
- * The options for this policy.
3744
- */
3745
- export declare interface SleepInboundPolicyOptions {
3746
- /**
3747
- * The number of milliseconds to delay the request.
3748
- */
3749
- sleepInMs: number;
3750
- }
3751
-
3752
- /* Excluded from this release type: StandardEnv */
3753
-
3754
- /**
3755
- * Adds stripe monetization routes and configuration
3756
- * @beta
3757
- */
3758
- export declare class StripeMonetizationPlugin extends MeteringPlugin {
3759
- private options;
3760
- constructor(options: StripeMonetizationPluginOptions);
3761
- registerRoutes(router: Router, gateway: Gateway): void;
3762
- }
3763
-
3764
- /**
3765
- * @beta
3766
- */
3767
- export declare interface StripeMonetizationPluginOptions {
3768
- /**
3769
- * Stripe Webhook settings
3770
- */
3771
- webhooks: StripeWebhookVerificationInboundPolicyOptions & {
3772
- /**
3773
- * The URL path where the webhook is registered.
3774
- * Defaults to `/_zuplo/stripe-webhook`
3775
- */
3776
- routePath?: string;
3777
- };
3778
- /**
3779
- * The ID of the Zuplo metering bucket.
3780
- */
3781
- meteringBucketId?: string;
3782
- /**
3783
- * The primary region where data is stored. Among other things, the choice of location impacts latency.
3784
- * Defaults to `us-central1`
3785
- */
3786
- primaryDataRegion?: string;
3787
- apiKeyBucketName?: string;
3788
- /**
3789
- * The Stripe account's secret key
3790
- */
3791
- stripeSecretKey: string;
3792
- /* Excluded from this release type: __testMode */
3793
- }
3794
-
3795
- /**
3796
- * The Stripe Webhook policy validates the authenticity of an incoming Stripe webhook.
3797
- *
3798
- * @remarks
3799
- * The Stripe Webhook policy secures your incoming webhooks by validating that
3800
- * the request was sent by Stripe.
3801
- *
3802
- * @title Stripe Webhook Auth
3803
- * @public
3804
- * @param request - The ZuploRequest
3805
- * @param context - The ZuploContext
3806
- * @param options - The policy options set in policies.json
3807
- * @param policyName - The name of the policy as set in policies.json
3808
- * @returns A Request or a Response
3809
- */
3810
- export declare class StripeWebhookVerificationInboundPolicy extends InboundPolicy<StripeWebhookVerificationInboundPolicyOptions> {
3811
- handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
3812
- }
3813
-
3814
- /**
3815
- * The options for this policy.
3816
- */
3817
- export declare interface StripeWebhookVerificationInboundPolicyOptions {
3818
- /**
3819
- * The signing secret for the webhook.
3820
- */
3821
- signingSecret: string;
3822
- /**
3823
- * The allowed clock skew in seconds between the time the webhook signature was crated and the current time.
3824
- */
3825
- tolerance?: number;
3826
- }
3827
-
3828
- /**
3829
- * @beta
3830
- */
3831
- declare type SubscriptionMeters = {
3832
- [Key in string]: {
3833
- available: number;
3834
- max: number;
3835
- };
3836
- };
3837
-
3838
- declare interface SumoLogicLoggingOptions {
3839
- url: string;
3840
- name?: string;
3841
- category?: string;
3842
- }
3843
-
3844
- export declare class SumoLogicLoggingPlugin extends LogPlugin {
3845
- private options;
3846
- constructor(options: SumoLogicLoggingOptions);
3847
- /* Excluded from this release type: getTransport */
3848
- }
3849
-
3850
- /**
3851
- * The Supabase JWT Authentication policy supports user JWT tokens created by Supabase.
3852
- *
3853
- * @remarks
3854
- * The Supabase JWT Authentication policy allows you to authenticate incoming
3855
- * requests using a token created by {@link https://supabase.com|supabase.com}.
3856
- *
3857
- * When configured, you can have Zuplo check incoming requests for a JWT token and
3858
- * automatically populate the `ZuploRequest`'s `user` property with a user object.
3859
- *
3860
- * This `user` object will have a `sub` property - taking the `sub` id from the JWT
3861
- * token. It will also have a `data` property populated by other data returned in
3862
- * the JWT token - including all your claims, `user_metadata` and `app_metadata`.
3863
- *
3864
- * You can also require specific claims to have specific values to allow
3865
- * authentication to complete, providing a layer of authorization.
3866
- *
3867
- * @title Supabase JWT Auth
3868
- * @public
3869
- * @param request - The ZuploRequest
3870
- * @param context - The ZuploContext
3871
- * @param options - The policy options set in policies.json
3872
- * @param policyName - The name of the policy as set in policies.json
3873
- * @returns A Request or a Response
3874
- */
3875
- export declare const SupabaseJwtInboundPolicy: InboundPolicyHandler<SupabaseJwtInboundPolicyOptions>;
3876
-
3877
- /**
3878
- * The options for this policy.
3879
- */
3880
- export declare interface SupabaseJwtInboundPolicyOptions {
3881
- /**
3882
- * The key used to verify the signature of the JWT token.
3883
- */
3884
- secret: string;
3885
- /**
3886
- * Indicates whether the request should continue if authentication fails. Default is `false` which means unauthenticated users will automatically receive a 401 response.
3887
- */
3888
- allowUnauthenticatedRequests?: boolean;
3889
- /**
3890
- * Any claims that must be present for authentication to succeed - multiple valid values can be specified for each claim.
3891
- */
3892
- requiredClaims?: {
3893
- [k: string]: string[];
3894
- };
3895
- }
3896
-
3897
- /* Excluded from this release type: SYSTEM_LOGGER */
3898
-
3899
- /* Excluded from this release type: SystemLogMap */
3900
-
3901
- /* Excluded from this release type: SystemRouteName */
3902
-
3903
- /* Excluded from this release type: SystemRuntimePlugin */
3904
-
3905
- /**
3906
- * Uses Azure Active Directory to add an Authorization header to the request in order to authenticate requests using Azure identity.
3907
- *
3908
- * @remarks
3909
- * This policy adds a `Authorization` header to the upstream request that allows
3910
- * using Azure AD to authenticate requests to your origin server. This is a useful
3911
- * means of securing your origin server so that only your Zuplo gateway can make
3912
- * requests against it.
3913
- *
3914
- * Using this policy allows you to delegate authentication and authorization to
3915
- * your gateway without writing any code on your origin service. For instructions
3916
- * on how to configure Azure AD authentication see
3917
- * {@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}.
3918
- *
3919
- * @title Upstream Azure AD Service Auth
3920
- * @public
3921
- * @param request - The ZuploRequest
3922
- * @param context - The ZuploContext
3923
- * @param options - The policy options set in policies.json
3924
- * @param policyName - The name of the policy as set in policies.json
3925
- * @returns A Request or a Response
3926
- */
3927
- export declare const UpstreamAzureAdServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamAzureAdServiceAuthInboundPolicyOptions>;
3928
-
3929
- /**
3930
- * The options for this policy.
3931
- */
3932
- export declare interface UpstreamAzureAdServiceAuthInboundPolicyOptions {
3933
- /**
3934
- * Azure Active Directory Tenant ID.
3935
- */
3936
- activeDirectoryTenantId: string;
3937
- /**
3938
- * The Application (client) ID of the Azure AD App Registration.
3939
- */
3940
- activeDirectoryClientId: string;
3941
- /**
3942
- * The client secret of the Azure AD App Registration.
3943
- */
3944
- activeDirectoryClientSecret: string;
3945
- /**
3946
- * The number of times to retry fetching the token in the event of a failure..
3947
- */
3948
- tokenRetries?: number;
3949
- /**
3950
- * The number of seconds less than the token expiration to cache the token.
3951
- */
3952
- expirationOffsetSeconds?: number;
3953
- }
3954
-
3955
- /**
3956
- * Creates a Firebase Admin token and attaches it to the outgoing request. Useful when calling Firebase services as an administrator.
3957
- *
3958
- * @remarks
3959
- * This policy adds a Firebase Admin token to the outgoing `Authentication` header
3960
- * allowing requests to Firebase using Service Account admin permissions. This can
3961
- * be useful for calling Firebase services such as Firestore through a Zuplo
3962
- * endpoint that is secured with other means of Authentication such as API keys.
3963
- * Additionally, this policy can be useful for service content to all API users
3964
- * (for example serving a specific Firestore document containing configuration
3965
- * data)
3966
- *
3967
- * We recommend reading the `serviceAccountJson` from environment variables (so it
3968
- * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
3969
- *
3970
- * @title Upstream Firebase Admin Auth
3971
- * @public
3972
- * @param request - The ZuploRequest
3973
- * @param context - The ZuploContext
3974
- * @param options - The policy options set in policies.json
3975
- * @param policyName - The name of the policy as set in policies.json
3976
- * @returns A Request or a Response
3977
- */
3978
- export declare const UpstreamFirebaseAdminAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseAdminAuthInboundPolicyOptions>;
3979
-
3980
- /**
3981
- * The options for this policy.
3982
- */
3983
- export declare interface UpstreamFirebaseAdminAuthInboundPolicyOptions {
3984
- /**
3985
- * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
3986
- */
3987
- serviceAccountJson: string;
3988
- /**
3989
- * The number of times to retry fetching the token in the event of a failure.
3990
- */
3991
- tokenRetries?: number;
3992
- /**
3993
- * The number of seconds less than the token expiration to cache the token.
3994
- */
3995
- expirationOffsetSeconds?: number;
3996
- }
3997
-
3998
- /**
3999
- * Creates a Firebase custom user token and attaches it to the outgoing request. Useful when calling Firebase services as user.
4000
- *
4001
- * @remarks
4002
- * This policy adds a Firebase Admin token to the outgoing `Authentication` header
4003
- * allowing requests to Firebase using Service Account admin permissions. This can
4004
- * be useful for calling Firebase services such as Firestore through a Zuplo
4005
- * endpoint that is secured with other means of Authentication such as API keys.
4006
- * Additionally, this policy can be useful for service content to all API users
4007
- * (for example serving a specific Firestore document containing configuration
4008
- * data)
4009
- *
4010
- * We recommend reading the `serviceAccountJson` from environment variables (so it
4011
- * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
4012
- *
4013
- * @title Upstream Firebase User Auth
4014
- * @public
4015
- * @param request - The ZuploRequest
4016
- * @param context - The ZuploContext
4017
- * @param options - The policy options set in policies.json
4018
- * @param policyName - The name of the policy as set in policies.json
4019
- * @returns A Request or a Response
4020
- */
4021
- export declare const UpstreamFirebaseUserAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseUserAuthInboundPolicyOptions>;
4022
-
4023
- /**
4024
- * The options for this policy.
4025
- */
4026
- export declare interface UpstreamFirebaseUserAuthInboundPolicyOptions {
4027
- /**
4028
- * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
4029
- */
4030
- serviceAccountJson: string;
4031
- /**
4032
- * The userId to use as the custom token's subject.
4033
- */
4034
- userId?: string;
4035
- /**
4036
- * The property on the incoming request.user object to retrieve the value of the userId.
4037
- */
4038
- userIdPropertyPath?: string;
4039
- /**
4040
- * Additional claims to include in the custom token's payload.
4041
- */
4042
- developerClaims?: Record<string, string | number | boolean | null>;
4043
- /**
4044
- * The Firebase Web API Key (found in project settings)
4045
- * @see {@link https://firebase.google.com/docs/projects/api-keys|Firebase API Keys}.
4046
- */
4047
- webApiKey: string;
4048
- /**
4049
- * The number of times to retry fetching the token in the event of a failure.
4050
- */
4051
- tokenRetries?: number;
4052
- /**
4053
- * The number of seconds less than the token expiration to cache the token.
4054
- */
4055
- expirationOffsetSeconds?: number;
4056
- }
4057
-
4058
- /**
4059
- * 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
4060
- *
4061
- * @remarks
4062
- * This policy adds a JWT token to the headers, ready for us in an outgoing request
4063
- * when calling a GCP service (e.g. Cloud Endpoints / ESPv2). We recommend reading
4064
- * the `serviceAccountJson` from environment variables (so it is not checked in to
4065
- * source control) using the `$env(ENV_VAR)` syntax.
4066
- *
4067
- * CAUTION: This policy only works with {@link https://developers.google.com/identity/protocols/oauth2/service-account#jwt-auth | certain Google APIs}.
4068
- * In most cases, the {@link https://zuplo.com/docs/policies/upstream-gcp-service-auth-inbound | Upstream GCP Service Auth}
4069
- * should be used.
4070
- *
4071
- * @title Upstream GCP Self-Signed JWT
4072
- * @public
4073
- * @param request - The ZuploRequest
4074
- * @param context - The ZuploContext
4075
- * @param options - The policy options set in policies.json
4076
- * @param policyName - The name of the policy as set in policies.json
4077
- * @returns A Request or a Response
4078
- */
4079
- export declare const UpstreamGcpJwtInboundPolicy: InboundPolicyHandler<UpstreamGcpJwtInboundPolicyOptions>;
4080
-
4081
- /**
4082
- * The options for this policy.
4083
- */
4084
- export declare interface UpstreamGcpJwtInboundPolicyOptions {
4085
- /**
4086
- * 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.
4087
- */
4088
- audience: string;
4089
- /**
4090
- * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
4091
- */
4092
- serviceAccountJson: string;
4093
- }
4094
-
4095
- /**
4096
- * 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.
4097
- *
4098
- * @remarks
4099
- * This policy allows you to delegate authentication and authorization to your
4100
- * gateway without writing any code on your origin service by adding a GCP Issued
4101
- * ID Token to outgoing header allowing the service to be secured with GCP IAM.
4102
- * This is a useful means of securing your origin server so that only your Zuplo
4103
- * gateway can make requests against it.
4104
- *
4105
- *
4106
- * This policy works with
4107
- * {@link https://zuplo.com/docs/articles/gke-with-upstream-auth-policy|GCP Identity Aware Proxy}
4108
- * or services like {@link https://cloud.google.com/iap/docs/managing-access|Cloud Run}
4109
- * that natively support IAM authorization.
4110
- *
4111
- * We recommend reading the `serviceAccountJson` from environment variables (so it
4112
- * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
4113
- *
4114
- * For information on how Google's service based auth works see {@link https://cloud.google.com/functions/docs/securing/authenticating|Authenticating for invocation}
4115
- *
4116
- * @title Upstream GCP Service Auth
4117
- * @public
4118
- * @param request - The ZuploRequest
4119
- * @param context - The ZuploContext
4120
- * @param options - The policy options set in policies.json
4121
- * @param policyName - The name of the policy as set in policies.json
4122
- * @returns A Request or a Response
4123
- */
4124
- export declare const UpstreamGcpServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamGcpServiceAuthInboundPolicyOptions>;
4125
-
4126
- /**
4127
- * The options for this policy.
4128
- */
4129
- export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
4130
- /**
4131
- * 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.
4132
- */
4133
- audience?: string;
4134
- /**
4135
- * 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.
4136
- */
4137
- scopes?: string[];
4138
- /**
4139
- * The Google Service Account key in JSON format. Note you can load this from environment variables using the `$env(ENV_VAR)` syntax.
4140
- * @see {@link https://developers.google.com/workspace/guides/create-credentials|Create access credentials}.
4141
- */
4142
- serviceAccountJson: string;
4143
- /**
4144
- * The number of times to retry fetching the token in the event of a failure.
4145
- */
4146
- tokenRetries?: number;
4147
- /**
4148
- * The number of seconds less than the token expiration to cache the token.
4149
- */
4150
- expirationOffsetSeconds?: number;
4151
- /**
4152
- * This is an advanced option that should only be used if you do not want to persist information in ZoneCache.
4153
- */
4154
- useMemoryCacheOnly?: boolean;
4155
- }
4156
-
4157
- /**
4158
- * @beta
4159
- * @param request - The ZuploRequest
4160
- * @param context - The ZuploContext
4161
- * @returns ZuploResponse
4162
- */
4163
- export declare function urlForwardHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4164
-
4165
- /**
4166
- * Proxy requests to a different url
4167
- * @param request - The ZuploRequest
4168
- * @param context - The ZuploContext
4169
- * @returns
4170
- * @beta
4171
- */
4172
- export declare function urlRewriteHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4173
-
4174
- declare type UserDataDefault = any;
4175
-
4176
- /* Excluded from this release type: ValidateFunction */
4177
-
4178
- /**
4179
- * Validates the body of an incoming request based on a JSON schema.
4180
- *
4181
- * @remarks
4182
- * The Validate JSON Schema policy is used to validate the body of incoming
4183
- * requests. It works using JSON Schemas defined in the `Schemas` folder of your
4184
- * project.
4185
- *
4186
- * When configured, any requests that do not have a body conforming to your JSON
4187
- * schema will be rejected with a `400: Bad Request` response containing a detailed
4188
- * error message (in JSON) explaining why the body was not accepted.
4189
- *
4190
- * @title JSON Body Validation
4191
- * @public
4192
- * @deprecated Use the new {@link https://zuplo.com/docs/policies/request-validation-inbound|Request Validation Policy}.
4193
- * The new policy validates JSON bodies like this policy, but also supports validation of parameters, query strings, etc.
4194
- * @param request - The ZuploRequest
4195
- * @param context - The ZuploContext
4196
- * @param options - The policy options set in policies.json
4197
- * @param policyName - The name of the policy as set in policies.json
4198
- * @returns A Request or a Response
4199
- */
4200
- export declare const ValidateJsonSchemaInbound: InboundPolicyHandler<ValidateJsonSchemaInboundInternalOptions>;
4201
-
4202
- /**
4203
- * @beta
4204
- */
4205
- declare interface ValidateJsonSchemaInboundInternalOptions extends Omit<ValidateJsonSchemaInboundOptions, "validator"> {
4206
- /* Excluded from this release type: validator */
4207
- }
4208
-
4209
- /**
4210
- * The options for this policy.
4211
- */
4212
- export declare interface ValidateJsonSchemaInboundOptions {
4213
- /**
4214
- * The JSON schema to validate against.
4215
- */
4216
- validator: string;
4217
- }
4218
-
4219
- /**
4220
- * The action to perform when validation fails.
4221
- */
4222
- declare type ValidationOptions = "none" | "log-only" | "reject-and-log" | "reject-only";
4223
-
4224
- /**
4225
- * The action to perform when validation fails.
4226
- */
4227
- declare type ValidationOptions1 = "none" | "log-only" | "reject-and-log" | "reject-only";
4228
-
4229
- /**
4230
- * The action to perform when validation fails.
4231
- */
4232
- declare type ValidationOptions2 = "none" | "log-only" | "reject-and-log" | "reject-only";
4233
-
4234
- /**
4235
- * The action to perform when validation fails.
4236
- */
4237
- declare type ValidationOptions3 = "none" | "log-only" | "reject-and-log" | "reject-only";
4238
-
4239
- export declare interface VersionData {
4240
- name: string;
4241
- pathPrefix: string;
4242
- info?: OpenAPIV3_1.InfoObject;
4243
- /**
4244
- * The project relative path to the OpenAPI spec.
4245
- */
4246
- openApiFile?: string;
4247
- tags?: Omit<OpenAPIV3_1.TagObject, "externalDocs">[];
4248
- /**
4249
- * If false, OpenAPI documentation will not be generated for this version. If openApiFile is set this setting is ignored.
4250
- */
4251
- excludeFromOpenApi?: boolean;
4252
- /**
4253
- * If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.
4254
- */
4255
- enforceOpenApi?: boolean;
4256
- }
4257
-
4258
- declare interface VMWareLogInsightLoggingOptions {
4259
- url: string;
4260
- /**
4261
- * An array of string tuples to replace within the text field of a log entry.
4262
- * @example
4263
- * ```
4264
- * [
4265
- * ["'", ""],
4266
- * ['"', ""],
4267
- * ["\\n", ""],
4268
- * ["\\", ""],
4269
- * ["*", ""],
4270
- * ["&", ""],
4271
- * [":", "="],
4272
- * ]
4273
- * ```
4274
- */
4275
- textReplacements?: [string, string][];
4276
- /**
4277
- * The unique agent identifier of the logger.
4278
- */
4279
- agentId?: string;
4280
- fields?: Record<string, string | number | boolean>;
4281
- onMessageSending?: (event: LogInsightLogEntry) => LogInsightLogEntry;
4282
- }
4283
-
4284
- export declare class VMWareLogInsightLoggingPlugin extends LogPlugin {
4285
- private options;
4286
- constructor(options: VMWareLogInsightLoggingOptions);
4287
- /* Excluded from this release type: getTransport */
4288
- }
4289
-
4290
- declare interface WaitUntilFunc {
4291
- (promise: Promise<any>): void;
4292
- }
4293
-
4294
- /**
4295
- * Handle websocket requests to a different url
4296
- * @param request - The ZuploRequest
4297
- * @param context - The ZuploContext
4298
- * @returns
4299
- * @beta
4300
- */
4301
- export declare function webSocketHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4302
-
4303
- /**
4304
- * Handle websocket requests to a different url
4305
- * @param request - The ZuploRequest
4306
- * @param context - The ZuploContext
4307
- * @returns
4308
- * @beta
4309
- */
4310
- export declare function webSocketPipelineHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
4311
-
4312
- /**
4313
- * Parses XML and converts it to JSON. This policy is useful for converting
4314
- * legacy XML or SOAP APIs into modern REST APIs. It can be useful to add a
4315
- * custom outbound policy that runs after this policy to further transform the
4316
- * raw converted content into something more user friendly.
4317
- *
4318
- * @title XML to JSON Outbound
4319
- * @public
4320
- * @param request - The ZuploRequest
4321
- * @param context - The ZuploContext
4322
- * @param options - The policy options set in policies.json
4323
- * @param policyName - The name of the policy as set in policies.json
4324
- * @returns A Request or a Response
4325
- */
4326
- export declare class XmlToJsonOutboundPolicy extends OutboundPolicy<XmlToJsonPolicyOptions> {
4327
- private parser;
4328
- private parseOnStatusCodes;
4329
- constructor(options: XmlToJsonPolicyOptions, policyName: string);
4330
- handler(response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response>;
4331
- }
4332
-
4333
- /**
4334
- * The options for this policy.
4335
- */
4336
- export declare interface XmlToJsonPolicyOptions {
4337
- /**
4338
- * Remove namespace string from tag and attribute names.
4339
- */
4340
- removeNSPrefix?: boolean;
4341
- /**
4342
- * Ignore processing instruction tags. i.e. `<?elementnames <fred>, <bert>, <harry> ?>`.
4343
- */
4344
- ignoreProcessingInstructions?: boolean;
4345
- /**
4346
- * Ignore declarations. i.e. `<?xml version="1.0"?>`.
4347
- */
4348
- ignoreDeclarations?: boolean;
4349
- /**
4350
- * Ignore tag attributes.
4351
- */
4352
- ignoreAttributes?: boolean;
4353
- /**
4354
- * 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.
4355
- */
4356
- stopNodes?: string[];
4357
- /**
4358
- * The prefix of attribute names in the resulting JS object.
4359
- */
4360
- attributeNamePrefix?: string;
4361
- /**
4362
- * Text value of a tag is parsed to #text property by default.
4363
- */
4364
- textNodeName?: string;
4365
- /**
4366
- * Remove surrounding whitespace from tag or attribute value.
4367
- */
4368
- trimValues?: boolean;
4369
- /**
4370
- * 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.
4371
- */
4372
- parseOnStatusCodes?: string | number[];
4373
- }
4374
-
4375
- /**
4376
- * This is a simple wrapper around the data-center HTTP cache
4377
- * to enable simple objects to be stored by a string key. This is
4378
- * useful to us and customers and provides a very high-performance
4379
- * read-through cache that stores data in the same data-center. It is
4380
- * not replicated.
4381
- */
4382
- export declare class ZoneCache<T = any> {
4383
- #private;
4384
- constructor(name: string, context: ZuploContext);
4385
- /* Excluded from this release type: __constructor */
4386
- get(key: string): Promise<T | undefined>;
4387
- put(key: string, data: T, ttlSeconds: number): Promise<void>;
4388
- delete(key: string): Promise<void>;
4389
- deleteFallback(key: string): Promise<void>;
4390
- logDebug(...messages: unknown[]): void;
4391
- }
4392
-
4393
- /**
4394
- * @beta
4395
- */
4396
- export declare interface ZuploContext extends EventTarget {
4397
- /**
4398
- * The unique identifier of the incoming request
4399
- */
4400
- readonly requestId: Readonly<string>;
4401
- /**
4402
- * Request based logger
4403
- */
4404
- readonly log: Readonly<Logger>;
4405
- readonly route: Readonly<RouteConfiguration>;
4406
- /**
4407
- * Custom data stored on the ZuploContext
4408
- */
4409
- readonly custom: Record<string, any>;
4410
- readonly incomingRequestProperties: IncomingRequestProperties;
4411
- readonly invokeInboundPolicy: (policyName: string, request: ZuploRequest) => Promise<Response | ZuploRequest>;
4412
- readonly waitUntil: WaitUntilFunc;
4413
- /**
4414
- * Fires just before the response is sent. Response can be modified.
4415
- */
4416
- readonly addResponseSendingHook: (hook: OnResponseSendingHook) => void;
4417
- /**
4418
- * Fires immediately after the response is sent. Response cannot be modified.
4419
- */
4420
- readonly addResponseSendingFinalHook: (hook: OnResponseSendingFinalHook) => void;
4421
- /**
4422
- * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
4423
- *
4424
- * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
4425
- *
4426
- * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
4427
- *
4428
- * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
4429
- *
4430
- * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
4431
- *
4432
- * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
4433
- *
4434
- * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
4435
- * @deprecated This will be removed in the future. Use hooks instead. See {@link https://zuplo.com/docs/articles/runtime-extensions}
4436
- */
4437
- addEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
4438
- /**
4439
- * @deprecated This will be removed in the future. See {@link https://zuplo.com/docs/articles/runtime-extensions}
4440
- */
4441
- removeEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
4442
- }
4443
-
4444
- declare interface ZuploEventContext {
4445
- waitUntil: WaitUntilFunc;
4446
- }
4447
-
4448
- /**
4449
- * ZuploRequest includes various parsed objects from the
4450
- * incoming Request. This object inherits from the web
4451
- * standard {@link https://developer.mozilla.org/en-US/docs/Web/API/Request | Request}.
4452
- * @public
4453
- */
4454
- export declare class ZuploRequest<TOptions extends RequestGeneric = RequestGeneric> extends Request {
4455
- #private;
4456
- constructor(input: string | Request, init?: ZuploRequestInit<TOptions>);
4457
- /**
4458
- * A dictionary of query-string values
4459
- *
4460
- * @example
4461
- * The url `https://example.com?foo=bar` would return
4462
- * the following query object:
4463
- *
4464
- * ```
4465
- * const foo = request.query.foo;
4466
- * ```
4467
- *
4468
- * @readonly
4469
- */
4470
- get query(): Readonly<ResolveRequestQuery<TOptions["Query"]>>;
4471
- /**
4472
- * If you use tokens in your route’s URL, they are
4473
- * automatically parsed into properties on the params
4474
- * property of your request.
4475
- *
4476
- * @example
4477
- * The route `/products/:productId/vendors/:vendorId`
4478
- * would include two params:
4479
- *
4480
- * ```
4481
- * const productId = request.params.productId;
4482
- * const vendorId = request.params.vendorId;
4483
- * ```
4484
- * @readonly
4485
- */
4486
- get params(): Readonly<ResolveRequestParams<TOptions["Params"]>>;
4487
- /**
4488
- * An optional object identifying a ‘user’.
4489
- *
4490
- * @remarks
4491
- * If undefined this typically means the request is
4492
- * anonymous. If present, the user object will have
4493
- * a sub property that is a unique identifier for
4494
- * that user. There is also an optional data property
4495
- * that is of any type that typically contains other
4496
- * information about the user. When using JWT tokens
4497
- * you’ll usually find all the claims here.
4498
- *
4499
- * @readonly
4500
- */
4501
- user?: RequestUser<ResolveUserData<TOptions["UserData"]>>;
4502
- }
4503
-
4504
- /**
4505
- * The initialization values of a request
4506
- * @public
4507
- */
4508
- declare interface ZuploRequestInit<TOptions extends RequestInitGeneric = RequestInitGeneric> extends RequestInit {
4509
- params?: ResolveRequestParams<TOptions["Params"]>;
4510
- user?: ResolveUserData<TOptions["UserData"]>;
4511
- }
4512
-
4513
- export { }