@zuplo/runtime 5.1575.0 → 5.1576.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.
Files changed (3) hide show
  1. package/index.d.ts +1187 -232
  2. package/index.minified.js +14 -14
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2,17 +2,65 @@ import { KeyLike } from 'jose';
2
2
  import type { OpenAPIV3_1 } from 'openapi-types';
3
3
  import type { ValidateFunction as ValidateFunction_2 } from 'ajv';
4
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 ([amberflo.io](https://www.amberflo.io/)) 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
+ */
5
24
  export declare function AmberfloMeteringInboundPolicy(request: ZuploRequest, context: ZuploContext, options: AmberfloMeteringInboundPolicyOptions, policyName: string): Promise<ZuploRequest<any, Record<string, string>, Record<string, string>>>;
6
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
+ */
7
29
  export declare interface AmberfloMeteringInboundPolicyOptions {
8
- url: string;
9
- customerIdPropertyPath?: string;
10
- customerId?: string;
30
+ /**
31
+ * The API key to use when sending metering calls to Amberflo
32
+ */
11
33
  apiKey: string;
34
+ /**
35
+ * The name of the meter to use when sending metering calls to Amberflo (overridable in code)
36
+ */
12
37
  meterApiName?: string;
38
+ /**
39
+ * The value to use when sending metering calls to Amberflo (overridable in code)
40
+ */
13
41
  meterValue?: number;
14
- dimensions?: Record<string, string>;
15
- statusCodes: number[] | string;
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 - defaults to `result.ok` (200-299) if not set.
58
+ */
59
+ statusCodes?: string | number[];
60
+ /**
61
+ * Optional, the URL to send metering events to (defaults to https://app.amberflo.io/ingest). This is useful for testing purposes.
62
+ */
63
+ url?: string;
16
64
  }
17
65
 
18
66
  declare interface AmberfloMeteringIngestPayload {
@@ -34,23 +82,96 @@ declare interface AmberfloMeteringProperties extends Omit<AmberfloMeteringIngest
34
82
  /* Excluded from this release type: API_KEY */
35
83
 
36
84
  /**
37
- * @deprecated Use ApiKeyInboundPolicy instead
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 is deprecated. Use the new
91
+ * [API Key Authentication policy instead](https://zuplo.com/docs/policies/api-key-inbound)**
92
+ *
93
+ * This policy uses the managed API key storage provided by Zuplo.
94
+ * `allowUnauthenticatedRequests` defaults to false and rejects any request without
95
+ * a valid API key (returning a `401 - Unauthorized` response). You can override
96
+ * (set `"allowUnauthenticatedRequests" : true`) this to support multiple
97
+ * authentication methods or support both authenticated and anonymous requests.
98
+ *
99
+ * @deprecated Deprecated - Please use the new 'API Key Authentication' policy
100
+ * instead. This policy will continue to work but will be removed in a future
101
+ * version of Zuplo.
102
+ *
103
+ * @title API Key Authentication
104
+ * @public
105
+ * @param request - The ZuploRequest
106
+ * @param context - The ZuploContext
107
+ * @param unparsedOptions - The policy options set in policies.json
108
+ * @param policyName - The name of the policy as set in policies.json
109
+ * @returns A Request or a Response
38
110
  */
39
111
  export declare const ApiAuthKeyInboundPolicy: typeof ApiKeyInboundPolicy;
40
112
 
41
113
  /**
42
- * @deprecated Use ApiKeyInboundPolicyOptions instead
114
+ * The options for this policy
43
115
  */
44
- export declare type ApiAuthKeyInboundPolicyOptions = ApiKeyInboundPolicyOptions;
116
+ export declare interface ApiAuthKeyInboundPolicyOptions {
117
+ /**
118
+ * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401
119
+ */
120
+ allowUnauthenticatedRequests?: boolean;
121
+ }
45
122
 
123
+ /**
124
+ * 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)
125
+ *
126
+ * @remarks
127
+ * Authenticate requests with Zuplo's fully managed API Key service. This policy is
128
+ * the easiest way to secure your API and can be combined with other policies like
129
+ * Rate limiting, quotas, and more to build a fully featured API to support your
130
+ * partners, developers, or customers.
131
+ *
132
+ * For more information on Zuplo's API Key Management service and options enabling
133
+ * self-serve API Key management see the following resources:
134
+ *
135
+ * - [API Key Authentication Overview](/docs/articles/api-key-management)
136
+ * - [API Key Management API](/docs/articles/api-key-api)
137
+ *
138
+ * @title API Key Authentication
139
+ * @public
140
+ * @param request - The ZuploRequest
141
+ * @param context - The ZuploContext
142
+ * @param unparsedOptions - The policy options set in policies.json
143
+ * @param policyName - The name of the policy as set in policies.json
144
+ * @returns A Request or a Response
145
+ */
46
146
  export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<ZuploRequest<any, Record<string, string>, Record<string, string>> | Response>;
47
147
 
148
+ /**
149
+ * The options for this policy
150
+ */
48
151
  export declare interface ApiKeyInboundPolicyOptions {
152
+ /**
153
+ * The name of the header with the key. Defaults to `Authorization`
154
+ */
49
155
  authHeader?: string;
156
+ /**
157
+ * The scheme used on the header. Defaults to `Bearer`
158
+ */
50
159
  authScheme?: string;
160
+ /**
161
+ * Optional - The name of the API Key service bucket. Defaults to the autogenerated bucket name for your project. You can contact `support@zuplo.com` to create a new bucket.
162
+ */
51
163
  bucketName?: string;
164
+ /**
165
+ * 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.
166
+ */
52
167
  allowUnauthenticatedRequests?: boolean;
168
+ /**
169
+ * 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..
170
+ */
53
171
  cacheTtlSeconds?: number;
172
+ /**
173
+ * Zuplo will automatically document your API key header within your OpenAPI specification & Developer Portal. Set this to `true` to disable this behavior.
174
+ */
54
175
  disableAutomaticallyAddingKeyHeaderToOpenApi?: boolean;
55
176
  }
56
177
 
@@ -122,32 +243,39 @@ declare interface AuditLogRequestFilter {
122
243
  }
123
244
 
124
245
  /**
125
- * @beta
126
- * Validate a JWT issued by Auth0
246
+ * Authenticate users using Auth0 issued JWT tokens.
247
+ *
248
+ * @remarks
249
+ * Authenticate requests with JWT tokens issued by Auth0. This is a customized
250
+ * version of the [OpenId JWT Policy](./open-id-jwt-auth-inbound.md) specifically
251
+ * for Auth0.
252
+ *
253
+ * @title Auth0 JWT Auth
254
+ * @public
127
255
  * @param request - The ZuploRequest
128
256
  * @param context - The ZuploContext
129
- * @param options - The configuration options
130
- * @returns
257
+ * @param options - The policy options set in policies.json
258
+ * @param policyName - The name of the policy as set in policies.json
259
+ * @returns A Request or a Response
131
260
  */
132
261
  export declare const Auth0JwtInboundPolicy: InboundPolicyHandler<Auth0JwtInboundPolicyOptions>;
133
262
 
134
263
  /**
135
- * @beta
264
+ * The options for this policy
136
265
  */
137
266
  export declare interface Auth0JwtInboundPolicyOptions {
138
267
  /**
139
- * Your Auth0 domain, i.e. my-app.us.auth0.com
268
+ * 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.
140
269
  */
141
- auth0Domain: string;
270
+ allowUnauthenticatedRequests?: boolean;
142
271
  /**
143
- * The audience of your API, i.e. https://api.example.com/
272
+ * Your Auth0 domain. For example, my-company.auth0.com
144
273
  */
145
- audience?: string;
274
+ auth0Domain: string;
146
275
  /**
147
- * If false, a 403 will be returned if a valid
148
- * Authorization header is not present
276
+ * The Auth0 audience of your API, for example https://api.example.com/
149
277
  */
150
- allowUnauthenticatedRequests: boolean;
278
+ audience?: string;
151
279
  }
152
280
 
153
281
  declare interface AwsLambdaEventV1 {
@@ -303,28 +431,61 @@ declare abstract class BaseKeyValueStore {
303
431
  }
304
432
 
305
433
  /**
306
- * @beta
434
+ * An account object
307
435
  */
308
436
  declare interface BasicAuthAccount {
437
+ /**
438
+ * The username for the account (this will be the `sub` property on `request.user`.
439
+ */
309
440
  username: string;
441
+ /**
442
+ * The password for the account - note we recommend storing this in environment variables
443
+ */
310
444
  password: string;
311
- data: unknown;
445
+ /**
446
+ * The data payload you want associated with this account (this will be the `data` property on `request.user`)
447
+ */
448
+ data?: {
449
+ [k: string]: unknown;
450
+ };
312
451
  }
313
452
 
314
453
  /**
315
- * @beta
454
+ * Authenticate requests using basic auth (i.e. username and password)
455
+ *
456
+ * @remarks
457
+ * The Basic Authentication policy allows you to authenticate incoming requests
458
+ * using the Basic authentication standard. You can configure multiple accounts
459
+ * with different passwords and a different bucket of user 'data'.
460
+ *
461
+ * The API will expect a Basic Auth header (you can generate samples
462
+ * [here](https://www.debugbear.com/basic-auth-header-generator)). Requests with
463
+ * invalid credentials (or no header) will not be authenticated. Authenticated
464
+ * requests will populate the `user` property of the `ZuploRequest` parameter on
465
+ * your RequestHandler.
466
+ *
467
+ * @title Basic Auth
468
+ * @public
316
469
  * @param request - The ZuploRequest
317
- * @param options - The configuration options
318
- * @returns
470
+ * @param context - The ZuploContext
471
+ * @param options - The policy options set in policies.json
472
+ * @param policyName - The name of the policy as set in policies.json
473
+ * @returns A Request or a Response
319
474
  */
320
475
  export declare const BasicAuthInboundPolicy: InboundPolicyHandler<BasicAuthInboundPolicyOptions>;
321
476
 
322
477
  /**
323
- * @beta
478
+ * The options for this policy
324
479
  */
325
480
  export declare interface BasicAuthInboundPolicyOptions {
481
+ /**
482
+ * An array of account objects (username, password and data properties)
483
+ */
326
484
  accounts: BasicAuthAccount[];
327
- allowUnauthenticatedRequests: boolean;
485
+ /**
486
+ * If 'true' allows the request to continue even if authenticated. When 'false' (the default) any unauthenticated request is automatically rejected with a 401
487
+ */
488
+ allowUnauthenticatedRequests?: boolean;
328
489
  }
329
490
 
330
491
  /* Excluded from this release type: BuildEnvironment */
@@ -369,106 +530,187 @@ declare interface CacheOptions {
369
530
  logger?: Logger;
370
531
  }
371
532
 
533
+ /**
534
+ * Respond to matched incoming requests with cached content
535
+ *
536
+ * @title Caching
537
+ * @public
538
+ * @param request - The ZuploRequest
539
+ * @param context - The ZuploContext
540
+ * @param options - The policy options set in policies.json
541
+ * @param policyName - The name of the policy as set in policies.json
542
+ * @returns A Request or a Response
543
+ */
372
544
  export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<ZuploRequest<any, Record<string, string>, Record<string, string>> | Response>;
373
545
 
546
+ /**
547
+ * The options for this policy
548
+ */
374
549
  export declare interface CachingInboundPolicyOptions {
550
+ /**
551
+ * Optional, 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.
552
+ */
375
553
  cacheId?: string;
554
+ /**
555
+ * By default, the Authorization header is always considered in the caching policy. You can disable by setting this to true
556
+ */
557
+ dangerouslyIgnoreAuthorizationHeader?: boolean;
558
+ /**
559
+ * The headers to be considered when caching
560
+ */
376
561
  headers?: string[];
562
+ /**
563
+ * HTTP Methods to be cached - defaults to GET if none specified. Valid methods are: GET, POST, PUT, PATCH, DELETE, HEAD
564
+ */
377
565
  cacheHttpMethods?: string[];
378
- dangerouslyIgnoreAuthorizationHeader?: boolean;
566
+ /**
567
+ * The timeout of the cache in seconds
568
+ */
379
569
  expirationSecondsTtl?: number;
570
+ /**
571
+ * Response status codes to be cached - defaults to 200, 206, 301, 302, 303, 404, 410 if none specified
572
+ */
380
573
  statusCodes?: number[];
381
574
  }
382
575
 
383
576
  /**
384
- * @beta
577
+ * Changes the HTTP method of the incoming request.
578
+ *
579
+ * @title Change Method
580
+ * @public
581
+ * @param request - The ZuploRequest
582
+ * @param context - The ZuploContext
583
+ * @param options - The policy options set in policies.json
584
+ * @param policyName - The name of the policy as set in policies.json
585
+ * @returns A Request or a Response
385
586
  */
386
587
  export declare const ChangeMethodInboundPolicy: InboundPolicyHandler<ChangeMethodInboundPolicyOptions>;
387
588
 
388
589
  /**
389
- * @beta
590
+ * The options for this policy
390
591
  */
391
592
  export declare interface ChangeMethodInboundPolicyOptions {
392
- method: HttpMethod;
593
+ /**
594
+ * The HTTP Method to be used, e.g. POST, GET, PUT, PATCH, etc
595
+ */
596
+ method: string;
393
597
  }
394
598
 
395
599
  /**
396
- * @beta
600
+ * Removes all headers from the incoming request except for those in the exclude list.
601
+ *
602
+ * @title Clear Request Headers
603
+ * @public
604
+ * @param request - The ZuploRequest
605
+ * @param context - The ZuploContext
606
+ * @param options - The policy options set in policies.json
607
+ * @param policyName - The name of the policy as set in policies.json
608
+ * @returns A Request or a Response
397
609
  */
398
610
  export declare const ClearHeadersInboundPolicy: InboundPolicyHandler<ClearHeadersInboundPolicyOptions>;
399
611
 
400
612
  /**
401
- * @beta
613
+ * The options for this policy
402
614
  */
403
615
  export declare interface ClearHeadersInboundPolicyOptions {
616
+ /**
617
+ * The headers that should not be removed
618
+ */
404
619
  exclude?: string[];
405
620
  }
406
621
 
407
622
  /**
408
- * @beta
623
+ * Removes all headers from the response except for those in the exclude list.
624
+ *
625
+ * @title Clear Response Headers
626
+ * @public
627
+ * @param request - The ZuploRequest
628
+ * @param context - The ZuploContext
629
+ * @param options - The policy options set in policies.json
630
+ * @param policyName - The name of the policy as set in policies.json
631
+ * @returns A Request or a Response
409
632
  */
410
633
  export declare const ClearHeadersOutboundPolicy: OutboundPolicyHandler<ClearHeadersOutboundPolicyOptions>;
411
634
 
412
635
  /**
413
- * @beta
636
+ * The options for this policy
414
637
  */
415
638
  export declare interface ClearHeadersOutboundPolicyOptions {
639
+ /**
640
+ * The headers that should not be removed
641
+ */
416
642
  exclude?: string[];
417
643
  }
418
644
 
419
645
  /**
420
- * @beta
421
- * Validate a JWT issued by Clerk
646
+ * Authenticate users using Clerk issued JWT tokens.
647
+ *
648
+ * @remarks
649
+ * Authenticate requests with JWT tokens issued by Clerk. This is a customized
650
+ * version of the [OpenId JWT Policy](./open-id-jwt-auth-inbound.md) specifically
651
+ * for Clerk.
652
+ *
653
+ * @title Clerk JWT Auth
654
+ * @public
422
655
  * @param request - The ZuploRequest
423
656
  * @param context - The ZuploContext
424
- * @param options - The configuration options
425
- * @returns
657
+ * @param options - The policy options set in policies.json
658
+ * @param policyName - The name of the policy as set in policies.json
659
+ * @returns A Request or a Response
426
660
  */
427
661
  export declare const ClerkJwtInboundPolicy: InboundPolicyHandler<ClerkJwtInboundPolicyOptions>;
428
662
 
429
663
  /**
430
- * @beta
664
+ * The options for this policy
431
665
  */
432
666
  export declare interface ClerkJwtInboundPolicyOptions {
433
667
  /**
434
- * Your Clerk frontend api url, i.e. https://sensible-skunk-49.clerk.accounts.dev
435
- * Can be found here: https://dashboard.clerk.com/last-active?path=api-keys
668
+ * 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.
436
669
  */
437
- frontendApiUrl: string;
670
+ allowUnauthenticatedRequests?: boolean;
438
671
  /**
439
- * If false, a 403 will be returned if a valid
440
- * Authorization header is not present
672
+ * 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
441
673
  */
442
- allowUnauthenticatedRequests: boolean;
674
+ frontendApiUrl: string;
443
675
  }
444
676
 
445
677
  /**
446
- * @beta
447
- * Validates a JWT issued by AWS Cognito
678
+ * Authenticate requests with JWT tokens issued by AWS Cognito.
679
+ *
680
+ * @remarks
681
+ * Authenticate requests with JWT tokens issued by AWS Cognito. This is a
682
+ * customized version of the [OpenId JWT Policy](./open-id-jwt-auth-inbound.md)
683
+ * specifically for AWS Cognito.
684
+ *
685
+ * See [this document](/docs/articles/oauth-authentication) for more information
686
+ * about OAuth authorization in Zuplo.
687
+ *
688
+ * @title AWS Cognito JWT Auth
689
+ * @public
448
690
  * @param request - The ZuploRequest
449
691
  * @param context - The ZuploContext
450
- * @param options - The configuration options
451
- * @returns
692
+ * @param options - The policy options set in policies.json
693
+ * @param policyName - The name of the policy as set in policies.json
694
+ * @returns A Request or a Response
452
695
  */
453
696
  export declare const CognitoJwtInboundPolicy: InboundPolicyHandler<CognitoJwtInboundPolicyOptions>;
454
697
 
455
698
  /**
456
- * @beta
699
+ * The options for this policy
457
700
  */
458
701
  export declare interface CognitoJwtInboundPolicyOptions {
459
702
  /**
460
- * The AWS region, i.e. us-east-2
703
+ * 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.
461
704
  */
462
- region: string;
705
+ allowUnauthenticatedRequests?: boolean;
463
706
  /**
464
- * The Pool Id of your pool, i.e. us-east-2_joetMcQgH
707
+ * The AWS region where your Cognito instance is deployed
465
708
  */
466
- userPoolId: string;
709
+ region: string;
467
710
  /**
468
- * If false, a 403 will be returned if a valid
469
- * Authorization header is not present
711
+ * The user pool identifier
470
712
  */
471
- allowUnauthenticatedRequests: boolean;
713
+ userPoolId: string;
472
714
  }
473
715
 
474
716
  /**
@@ -477,17 +719,36 @@ export declare interface CognitoJwtInboundPolicyOptions {
477
719
  export declare type CompatibilityDate = "2023-03-14";
478
720
 
479
721
  /**
480
- * @beta
722
+ * Creates a composite, or group policy - composed of other policies. For reuse across routes.
723
+ *
724
+ * @remarks
725
+ * The Composite policy allows you to create groups of other policies, for easy
726
+ * reuse across multiple routes. Other policies are referenced by their `name`.
727
+ *
728
+ * :::warning
729
+ *
730
+ * Be careful not to create circular references which can cause your gateway to
731
+ * fail.
732
+ *
733
+ * :::
734
+ *
735
+ * @title Composite Inbound (Group Policies)
736
+ * @public
481
737
  * @param request - The ZuploRequest
482
- * @param options - The configuration options
483
- * @returns
738
+ * @param context - The ZuploContext
739
+ * @param options - The policy options set in policies.json
740
+ * @param policyName - The name of the policy as set in policies.json
741
+ * @returns A Request or a Response
484
742
  */
485
743
  export declare const CompositeInboundPolicy: InboundPolicyHandler<CompositeInboundPolicyOptions>;
486
744
 
487
745
  /**
488
- * @beta
746
+ * The options for this policy
489
747
  */
490
748
  export declare interface CompositeInboundPolicyOptions {
749
+ /**
750
+ * The list of policy references (beware circular references)
751
+ */
491
752
  policies?: string[];
492
753
  }
493
754
 
@@ -653,62 +914,107 @@ export declare interface ErrorHandler {
653
914
  /* Excluded from this release type: ErrorObject */
654
915
 
655
916
  /**
656
- * @beta
657
- * Validate a JWT issued by Firebase
917
+ * Authenticate users using Firebase issued JWT tokens.
918
+ *
919
+ * @remarks
920
+ * Authenticate requests with JWT tokens issued by Firebase. The payload of the JWT
921
+ * token, if successfully authenticated, with be on the `request.user.data` object
922
+ * accessible to the runtime.
923
+ *
924
+ * See [this document](/docs/articles/oauth-authentication) for more information
925
+ * about OAuth authorization in Zuplo.
926
+ *
927
+ * @title Firebase JWT Auth
928
+ * @public
658
929
  * @param request - The ZuploRequest
659
930
  * @param context - The ZuploContext
660
- * @param options - The configuration options
661
- * @returns
931
+ * @param options - The policy options set in policies.json
932
+ * @param policyName - The name of the policy as set in policies.json
933
+ * @returns A Request or a Response
662
934
  */
663
935
  export declare const FirebaseJwtInboundPolicy: InboundPolicyHandler<FirebaseJwtInboundPolicyOptions>;
664
936
 
937
+ /**
938
+ * The options for this policy
939
+ */
665
940
  export declare interface FirebaseJwtInboundPolicyOptions {
666
941
  /**
667
- * The Firebase project ID
942
+ * 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.
668
943
  */
669
- projectId: string;
944
+ allowUnauthenticatedRequests?: boolean;
670
945
  /**
671
- * If false, a 401 will be returned JWT is invalid, default to false
672
- **/
673
- allowUnauthenticatedRequests: boolean;
946
+ * Your Firebase Project ID
947
+ */
948
+ projectId: string;
674
949
  }
675
950
 
676
951
  /**
677
- * @beta
952
+ * Converts form data in the incoming request to JSON.
953
+ *
954
+ * @title Form Data to JSON
955
+ * @public
956
+ * @param request - The ZuploRequest
957
+ * @param context - The ZuploContext
958
+ * @param options - The policy options set in policies.json
959
+ * @param policyName - The name of the policy as set in policies.json
960
+ * @returns A Request or a Response
678
961
  */
679
962
  export declare const FormDataToJsonInboundPolicy: InboundPolicyHandler<FormDataToJsonInboundPolicyOptions>;
680
963
 
681
964
  /**
682
- * @beta
965
+ * The options for this policy
683
966
  */
684
967
  export declare interface FormDataToJsonInboundPolicyOptions {
968
+ /**
969
+ * Should the policy return an error if the request is not of the type form data
970
+ */
685
971
  badRequestIfNotFormData?: boolean;
972
+ /**
973
+ * The name of the honeypot field. Used to provide basic spam filtering.
974
+ */
686
975
  optionalHoneypotName?: string;
687
976
  }
688
977
 
689
978
  /* Excluded from this release type: Gateway */
690
979
 
691
980
  /**
692
- * @beta
981
+ * Block requests based on geo-location parameters: country, region code, and ASN
982
+ *
983
+ * @title Geo-location filtering
984
+ * @public
693
985
  * @param request - The ZuploRequest
694
- * @param options - The configuration options
695
- * @returns
986
+ * @param context - The ZuploContext
987
+ * @param options - The policy options set in policies.json
988
+ * @param policyName - The name of the policy as set in policies.json
989
+ * @returns A Request or a Response
696
990
  */
697
991
  export declare const GeoFilterInboundPolicy: InboundPolicyHandler<GeoFilterInboundPolicyOptions>;
698
992
 
699
993
  /**
700
- * @beta
994
+ * The options for this policy
701
995
  */
702
996
  export declare interface GeoFilterInboundPolicyOptions {
703
- allow?: GeoSpec;
704
997
  block?: GeoSpec;
998
+ allow?: GeoSpec;
999
+ /**
1000
+ * Optional, defaults to true. Specifies whether unknown geo-location parameters should be ignored (allowed through).
1001
+ */
705
1002
  ignoreUnknown?: boolean;
706
1003
  }
707
1004
 
708
1005
  declare interface GeoSpec {
709
- countries?: string | string[];
710
- regionCodes?: string | string[];
711
- asns?: string | string[];
1006
+ /**
1007
+ * comma separated string of country codes to allow (e.g. "US, CA")
1008
+ */
1009
+ countries?: string;
1010
+ /**
1011
+ * comma separated string of region codes to allow (e.g. "TX, WA")
1012
+ */
1013
+ regionCodes?: string;
1014
+ /**
1015
+ * comma separated string of ASNs to allow (e.g. "395747, 28304")
1016
+ */
1017
+ asns?: string;
712
1018
  }
713
1019
 
714
1020
  export declare function getIdForParameterSchema(path: string, operation: string, type: string, name: string): string;
@@ -1891,9 +2197,26 @@ declare type Iso3166Alpha2Code = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM"
1891
2197
 
1892
2198
  export declare function isZuploReadableEnvVariableName(name: string): boolean;
1893
2199
 
2200
+ /**
2201
+ * Validates that the JWT token includes specific scopes
2202
+ *
2203
+ * @title JWT Scope Validation
2204
+ * @public
2205
+ * @param request - The ZuploRequest
2206
+ * @param context - The ZuploContext
2207
+ * @param options - The policy options set in policies.json
2208
+ * @param policyName - The name of the policy as set in policies.json
2209
+ * @returns A Request or a Response
2210
+ */
1894
2211
  export declare const JWTScopeValidationInboundPolicy: InboundPolicyHandler<JWTScopeValidationInboundPolicyOptions>;
1895
2212
 
2213
+ /**
2214
+ * The options for this policy
2215
+ */
1896
2216
  export declare interface JWTScopeValidationInboundPolicyOptions {
2217
+ /**
2218
+ * An array of of JWT scopes
2219
+ */
1897
2220
  scopes: string[];
1898
2221
  }
1899
2222
 
@@ -2028,13 +2351,39 @@ declare interface MetricsType {
2028
2351
  responseContentLength?: boolean;
2029
2352
  }
2030
2353
 
2354
+ /**
2355
+ * The options for this policy
2356
+ */
2031
2357
  export declare interface MockApiInboundOptions {
2358
+ /**
2359
+ * Optional. 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.
2360
+ */
2032
2361
  random?: boolean;
2362
+ /**
2363
+ * Optional. 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`.
2364
+ */
2033
2365
  responsePrefixFilter?: string;
2366
+ /**
2367
+ * Optional. Specify the content-type of the response to select from. If not specified, the first matching response is used (or random).
2368
+ */
2034
2369
  contentType?: string;
2370
+ /**
2371
+ * Optional. Specify the name of the example to select. If not specified, the first matching response is used (or random).
2372
+ */
2035
2373
  exampleName?: string;
2036
2374
  }
2037
2375
 
2376
+ /**
2377
+ * Returns example responses from the OpenAPI document associated with this route.
2378
+ *
2379
+ * @title Mock API Response
2380
+ * @public
2381
+ * @param request - The ZuploRequest
2382
+ * @param context - The ZuploContext
2383
+ * @param options - The policy options set in policies.json
2384
+ * @param policyName - The name of the policy as set in policies.json
2385
+ * @returns A Request or a Response
2386
+ */
2038
2387
  export declare const MockApiInboundPolicy: InboundPolicyHandler<MockApiInboundOptions>;
2039
2388
 
2040
2389
  declare type Modify<T, R> = Omit<T, keyof R> & R;
@@ -2047,11 +2396,42 @@ declare interface MoesifContext {
2047
2396
  metadata?: unknown;
2048
2397
  }
2049
2398
 
2399
+ /**
2400
+ * Moesif is an API analytics and billing service. This policy allows you to send metering calls for each API to their events batch endpoint.
2401
+ *
2402
+ * @remarks
2403
+ * Moesif [moesif.com](https://moesif.com) is an API analytics and monetization
2404
+ * platform. This policy allows you to measure (and meter) API calls flowing
2405
+ * through your Zuplo gateway.
2406
+ *
2407
+ * Add the policy to each route you want to meter. Note you can specify the Meter
2408
+ * API Name and Meter Value (meter increment) at the policy level.
2409
+ *
2410
+ * @title Moesif Analytics & Billing
2411
+ * @public
2412
+ * @param request - The ZuploRequest
2413
+ * @param context - The ZuploContext
2414
+ * @param options - The policy options set in policies.json
2415
+ * @param policyName - The name of the policy as set in policies.json
2416
+ * @returns A Request or a Response
2417
+ */
2050
2418
  export declare function MoesifInboundPolicy(request: ZuploRequest, context: ZuploContext, passedOptions: MoesifInboundPolicyOptions, policyName: string): Promise<ZuploRequest<any, Record<string, string>, Record<string, string>>>;
2051
2419
 
2420
+ /**
2421
+ * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
2422
+ */
2052
2423
  export declare interface MoesifInboundPolicyOptions {
2424
+ /**
2425
+ * Your Moesif application ID (required)
2426
+ */
2053
2427
  applicationId: string;
2428
+ /**
2429
+ * Set to false to disable sending the request body to Moesif (optional)
2430
+ */
2054
2431
  logRequestBody?: boolean;
2432
+ /**
2433
+ * Set to false to disable sending the response body to Moesif (optional)
2434
+ */
2055
2435
  logResponseBody?: boolean;
2056
2436
  }
2057
2437
 
@@ -2060,32 +2440,42 @@ declare interface NotFoundOptions {
2060
2440
  }
2061
2441
 
2062
2442
  /**
2063
- * @beta
2064
- * Validate a JWT issued by Okta
2443
+ * Authenticate users using Okta issued JWT tokens.
2444
+ *
2445
+ * @remarks
2446
+ * Authenticate requests with JWT tokens issued by Okta. This is a customized
2447
+ * version of the [OpenId JWT Policy](./open-id-jwt-auth-inbound.md) specifically
2448
+ * for Okta.
2449
+ *
2450
+ * See [this document](/docs/articles/oauth-authentication) for more information
2451
+ * about OAuth authorization in Zuplo.
2452
+ *
2453
+ * @title Okta JWT Auth
2454
+ * @public
2065
2455
  * @param request - The ZuploRequest
2066
2456
  * @param context - The ZuploContext
2067
- * @param options - The configuration options
2068
- * @returns
2457
+ * @param options - The policy options set in policies.json
2458
+ * @param policyName - The name of the policy as set in policies.json
2459
+ * @returns A Request or a Response
2069
2460
  */
2070
2461
  export declare const OktaJwtInboundPolicy: InboundPolicyHandler<OktaJwtInboundPolicyOptions>;
2071
2462
 
2072
2463
  /**
2073
- * @beta
2464
+ * The options for this policy
2074
2465
  */
2075
2466
  export declare interface OktaJwtInboundPolicyOptions {
2076
2467
  /**
2077
- * Your Okta authorization server's issuer URL, i.e. https://dev-12345.okta.com/oauth2/abc
2468
+ * 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.
2078
2469
  */
2079
- issuerUrl: string;
2470
+ allowUnauthenticatedRequests?: boolean;
2080
2471
  /**
2081
- * The audience of your API, i.e. api://my-api
2472
+ * Your Okta authorization server's issuer URL. For example, https://dev-12345.okta.com/oauth2/abc
2082
2473
  */
2083
- audience?: string;
2474
+ issuerUrl: string;
2084
2475
  /**
2085
- * If false, a 403 will be returned if a valid
2086
- * Authorization header is not present
2476
+ * The Okta audience of your API, for example api://my-api
2087
2477
  */
2088
- allowUnauthenticatedRequests: boolean;
2478
+ audience?: string;
2089
2479
  }
2090
2480
 
2091
2481
  /**
@@ -2122,48 +2512,71 @@ declare interface OnSendingAwsLambdaEventHook {
2122
2512
  export declare function openApiSpecHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
2123
2513
 
2124
2514
  /**
2125
- * @beta
2126
- * Validates a JWT issued by a Open Id service
2515
+ * The Open ID JWT Authentication policy allows you to authenticate incoming requests using an Open ID compliant bearer token.
2516
+ *
2517
+ * @remarks
2518
+ * The Open ID JWT Authentication policy allows you to authenticate incoming
2519
+ * requests using an Open ID-compliant bearer token. It works with common
2520
+ * authentication services like Auth0 (sample here) but should also work with any
2521
+ * valid Open ID JWT token.
2522
+ *
2523
+ * When configured, you can have Zuplo check incoming requests for a JWT token and
2524
+ * automatically populate the `ZuploRequest` 's `user` property with a user object.
2525
+ * This `user` object will have a `sub` property - taking the `sub` id from the JWT
2526
+ * token. It will also have a `data` property populated by other data returned in
2527
+ * the JWT token (including any claims).
2528
+ *
2529
+ * See [this document](/docs/articles/oauth-authentication) for more information
2530
+ * about OAuth authorization in Zuplo.
2531
+ *
2532
+ * @title JWT Auth
2533
+ * @public
2127
2534
  * @param request - The ZuploRequest
2128
2535
  * @param context - The ZuploContext
2129
- * @param options - The configuration options
2130
- * @returns
2536
+ * @param options - The policy options set in policies.json
2537
+ * @param policyName - The name of the policy as set in policies.json
2538
+ * @returns A Request or a Response
2131
2539
  */
2132
- export declare const OpenIdJwtInboundPolicy: InboundPolicyHandler<OpenIdJwtInboundPolicyOptions>;
2540
+ export declare const OpenIdJwtInboundPolicy: InboundPolicyHandler<OpenIdJwtInboundPolicyInternalOptions>;
2541
+
2542
+ declare interface OpenIdJwtInboundPolicyInternalOptions extends Omit<OpenIdJwtInboundPolicyOptions, "secret"> {
2543
+ secret?: string | KeyLike;
2544
+ }
2133
2545
 
2134
2546
  /**
2135
- * @beta
2547
+ * The options for this policy
2136
2548
  */
2137
2549
  export declare interface OpenIdJwtInboundPolicyOptions {
2138
2550
  /**
2139
- * The issuer of the token
2551
+ * The expected issuer claim in the JWT token.
2140
2552
  */
2141
2553
  issuer?: string;
2142
2554
  /**
2143
- * The API Audience
2555
+ * The expected audience claim in the JWT token (optional).
2144
2556
  */
2145
2557
  audience?: string;
2146
2558
  /**
2147
- * The URL to the Json Web Token Key Set
2559
+ * 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).
2148
2560
  */
2149
2561
  jwkUrl?: string;
2150
2562
  /**
2151
- * The secret used to sign the JWT token
2563
+ * The key used to verify the signature of the JWT token (either this or `jwkUrl` must be set)
2152
2564
  */
2153
- secret?: string | KeyLike;
2565
+ secret?: string;
2154
2566
  /**
2155
- * If false, a 401 will be returned if a valid
2156
- * Authorization header is not present
2567
+ * indicates whether the request should continue if authentication fails. Defaults is `false` which means unauthenticated users will automatically receive a 401 response.
2157
2568
  */
2158
2569
  allowUnauthenticatedRequests?: boolean;
2159
2570
  /**
2160
- * The name of the property on the JWT to be used as the sub
2571
+ * The name of the property in the JWT token that contains the user's unique identifier. Defaults to `sub`.
2161
2572
  */
2162
2573
  subPropertyName?: string;
2163
2574
  /**
2164
- * Additional headers to send with the JWK request
2575
+ * Additional headers to send with the JWK request.
2165
2576
  */
2166
- headers?: Record<string, string>;
2577
+ headers?: {
2578
+ [k: string]: string;
2579
+ };
2167
2580
  }
2168
2581
 
2169
2582
  export declare const originalFetch: typeof fetch;
@@ -2322,76 +2735,111 @@ export declare class ProblemResponseFormatter {
2322
2735
  }
2323
2736
 
2324
2737
  /**
2325
- * @beta
2326
- * Validate a JWT issued by PropelAuth
2738
+ * Authenticate users using PropelAuth issued JWT tokens.
2739
+ *
2740
+ * @remarks
2741
+ * Authenticate requests with JWT tokens issued by
2742
+ * [PropelAuth](https://propelauth.com). This is a customized version of the
2743
+ * [OpenId JWT Policy](./open-id-jwt-auth-inbound.md) specifically for PropelAuth.
2744
+ *
2745
+ * @title PropelAuth JWT Auth
2746
+ * @public
2327
2747
  * @param request - The ZuploRequest
2328
2748
  * @param context - The ZuploContext
2329
- * @param options - The configuration options
2330
- * @returns
2749
+ * @param options - The policy options set in policies.json
2750
+ * @param policyName - The name of the policy as set in policies.json
2751
+ * @returns A Request or a Response
2331
2752
  */
2332
2753
  export declare const PropelAuthJwtInboundPolicy: InboundPolicyHandler<PropelAuthJwtInboundPolicyOptions>;
2333
2754
 
2334
2755
  /**
2335
- * @beta
2756
+ * The options for this policy
2336
2757
  */
2337
2758
  export declare interface PropelAuthJwtInboundPolicyOptions {
2338
2759
  /**
2339
- * Your PropelAuth 'authUrl', i.e. https://6586563.propelauthtest.com
2760
+ * 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.
2340
2761
  */
2341
- authUrl: string;
2762
+ allowUnauthenticatedRequests?: boolean;
2342
2763
  /**
2343
- * Your public (verifier) key that is used to verify access tokens
2764
+ * Your PropelAuth authUrl. For example, https://6587563.propelauthtest.com
2344
2765
  */
2345
- verifierKey: string;
2766
+ authUrl: string;
2346
2767
  /**
2347
- * If false, a 403 will be returned if a valid
2348
- * Authorization header is not present
2768
+ * 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.
2349
2769
  */
2350
- allowUnauthenticatedRequests: boolean;
2770
+ verifierKey: string;
2351
2771
  }
2352
2772
 
2353
2773
  /* Excluded from this release type: purgeGatewayCache */
2354
2774
 
2355
2775
  /**
2356
- * @beta
2776
+ * 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
2357
2777
  */
2358
- declare type RateLimitByType = "function" | "user" | "ip" | "all";
2778
+ declare type RateLimitByType = "user" | "ip" | "function" | "all";
2359
2779
 
2360
2780
  /**
2361
- * @beta
2781
+ * Adds the retry-after header, defaults to true
2362
2782
  */
2363
2783
  declare type RateLimitHeaderMode = "none" | "retry-after";
2364
2784
 
2365
2785
  /**
2366
- * @beta
2786
+ * The rate-limiting policy is used to limit the number of requests that can be made against your API based on a key.
2787
+ *
2788
+ * @remarks
2789
+ * Rate-limiting allows you to set a maximum rate of requests for your API gateway.
2790
+ * This is useful to enforce rate limits agreed with your clients and protect your
2791
+ * downstream services.
2792
+ *
2793
+ * The Zuplo Rate-Limit allows you to limit based on different attributes of the
2794
+ * incoming request. For example, you might set a rate limit of 10 requests per
2795
+ * second per user, or 20 requests per second for a given IP address.
2796
+ *
2797
+ * The Zuplo rate-limiter also allows you to set a custom bucket name by which to
2798
+ * effect a rate-limit using a function.
2799
+ *
2800
+ * When a client reaches a rate limit - they will receive a `429` response code.
2801
+ *
2802
+ * @title Rate Limiting
2803
+ * @public
2367
2804
  * @param request - The ZuploRequest
2368
- * @param options - The configuration options
2369
- * @returns
2805
+ * @param context - The ZuploContext
2806
+ * @param options - The policy options set in policies.json
2807
+ * @param policyName - The name of the policy as set in policies.json
2808
+ * @returns A Request or a Response
2370
2809
  */
2371
2810
  declare const RateLimitInboundPolicy: InboundPolicyHandler<RateLimitInboundPolicyOptions>;
2372
2811
  export { RateLimitInboundPolicy as BasicRateLimitInboundPolicy }
2373
2812
  export { RateLimitInboundPolicy }
2374
2813
 
2375
2814
  /**
2376
- * @beta
2815
+ * The options for this policy
2377
2816
  */
2378
2817
  declare interface RateLimitInboundPolicyOptions {
2818
+ rateLimitBy: RateLimitByType;
2819
+ /**
2820
+ * The max number of requests allowed in the given time window
2821
+ */
2379
2822
  requestsAllowed: number;
2823
+ /**
2824
+ * The time window in which the requests are rate-limited. The count restarts after each window expires
2825
+ */
2380
2826
  timeWindowMinutes: number;
2381
- identifier: {
2382
- module: any;
2383
- export: string;
2384
- };
2385
- export: string;
2386
- rateLimitBy: RateLimitByType;
2387
- region?: string;
2388
2827
  /**
2389
- * Adds the retry-after header, defaults to true
2828
+ * The function that returns dynamic configuration data. Used only with `rateLimitBy=function`
2390
2829
  */
2830
+ identifier?: {
2831
+ /**
2832
+ * used only with rateLimitBy=function. Specifies the export to load your custom bucket function, e.g. `default`, `rateLimitIdentifier`.
2833
+ */
2834
+ export: string;
2835
+ /**
2836
+ * Specifies the module to load your custom bucket function, in the format `$import(./modules/my-module)`
2837
+ */
2838
+ module: string;
2839
+ };
2391
2840
  headerMode?: RateLimitHeaderMode;
2392
2841
  /**
2393
- * If true, the policy will throw an error in the event
2394
- * there is a problem connecting to the rate limit service
2842
+ * If true, the policy will throw an error in the event there is a problem connecting to the rate limit service
2395
2843
  */
2396
2844
  throwOnFailure?: boolean;
2397
2845
  mode?: RateLimitMode;
@@ -2399,17 +2847,59 @@ declare interface RateLimitInboundPolicyOptions {
2399
2847
  export { RateLimitInboundPolicyOptions as BasicRateLimitInboundPolicyOptions }
2400
2848
  export { RateLimitInboundPolicyOptions }
2401
2849
 
2850
+ /**
2851
+ * 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.
2852
+ */
2402
2853
  declare type RateLimitMode = "strict" | "async";
2403
2854
 
2855
+ /**
2856
+ * The options for this policy. Many of them can be overridden at the code level in a request using the `AmberfloMeteringPolicy.setRequestProperties` method.
2857
+ */
2404
2858
  declare interface ReadmeMeteringInboundPolicyOptions {
2859
+ /**
2860
+ * The API key to use when sending metrics calls to Readme
2861
+ */
2405
2862
  apiKey: string;
2406
- development?: boolean;
2407
- userEmailPropertyPath?: string;
2863
+ /**
2864
+ * Optional - defaults to '.sub'. 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.
2865
+ */
2408
2866
  userLabelPropertyPath?: string;
2867
+ /**
2868
+ * Optional - defaults to empty. 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.
2869
+ */
2870
+ userEmailPropertyPath?: string;
2871
+ /**
2872
+ * Optional. Whether the data should be ingested as 'development' mode or not. Defaults to true for working-copy and false for all other environments.
2873
+ */
2874
+ development?: boolean;
2875
+ /**
2876
+ * Optional - defaults to false. 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.
2877
+ */
2409
2878
  useFullRequestPath?: boolean;
2879
+ /**
2880
+ * Optional, the URL to send metering events to (defaults to https://metrics.readme.io/request). This is useful for testing purposes.
2881
+ */
2410
2882
  url?: string;
2411
2883
  }
2412
2884
 
2885
+ /**
2886
+ * Readme is a developer documentation and API metrics company. This policy pushes logs to their API calls dashboard.
2887
+ *
2888
+ * @remarks
2889
+ * Readme ([readme.com](https://readme.com)) is a developer Documentation and
2890
+ * metrics service. This policy pushes the request/response data to their ingestion
2891
+ * endpoint so you can see your Zuplo API traffic in their API calls dashboard.
2892
+ *
2893
+ * ![Readme API Calls Dashboard](https://cdn.zuplo.com/assets/071b2ead-7769-413b-a66a-133ae6fd755d.png)
2894
+ *
2895
+ * @title Readme Metrics
2896
+ * @public
2897
+ * @param request - The ZuploRequest
2898
+ * @param context - The ZuploContext
2899
+ * @param options - The policy options set in policies.json
2900
+ * @param policyName - The name of the policy as set in policies.json
2901
+ * @returns A Request or a Response
2902
+ */
2413
2903
  export declare function ReadmeMetricsInboundPolicy(request: ZuploRequest, context: ZuploContext, options: ReadmeMeteringInboundPolicyOptions, policyName: string): Promise<ZuploRequest<any, Record<string, string>, Record<string, string>>>;
2414
2904
 
2415
2905
  /**
@@ -2421,62 +2911,129 @@ export declare function ReadmeMetricsInboundPolicy(request: ZuploRequest, contex
2421
2911
  export declare function redirectHandler(request: ZuploRequest, context: ZuploContext): Promise<Response>;
2422
2912
 
2423
2913
  /**
2424
- * @beta
2914
+ * Remove headers from the incoming request.
2915
+ *
2916
+ * @title Remove Request Headers
2917
+ * @public
2918
+ * @param request - The ZuploRequest
2919
+ * @param context - The ZuploContext
2920
+ * @param options - The policy options set in policies.json
2921
+ * @param policyName - The name of the policy as set in policies.json
2922
+ * @returns A Request or a Response
2425
2923
  */
2426
2924
  export declare const RemoveHeadersInboundPolicy: InboundPolicyHandler<RemoveHeadersInboundPolicyOptions>;
2427
2925
 
2428
2926
  /**
2429
- * @beta
2927
+ * The options for this policy
2430
2928
  */
2431
2929
  export declare interface RemoveHeadersInboundPolicyOptions {
2432
- headers?: string[];
2930
+ /**
2931
+ * A list of headers to be removed from the incoming request
2932
+ */
2933
+ headers: string[];
2433
2934
  }
2434
2935
 
2435
2936
  /**
2436
- * @beta
2937
+ * Remove configured headers from the outgoing response.
2938
+ *
2939
+ * @title Remove Response Headers
2940
+ * @public
2941
+ * @param request - The ZuploRequest
2942
+ * @param context - The ZuploContext
2943
+ * @param options - The policy options set in policies.json
2944
+ * @param policyName - The name of the policy as set in policies.json
2945
+ * @returns A Request or a Response
2437
2946
  */
2438
2947
  export declare const RemoveHeadersOutboundPolicy: OutboundPolicyHandler<RemoveHeadersOutboundPolicyOptions>;
2439
2948
 
2440
2949
  /**
2441
- * @beta
2950
+ * The options for this policy
2442
2951
  */
2443
2952
  export declare interface RemoveHeadersOutboundPolicyOptions {
2953
+ /**
2954
+ * A list of headers to be removed from the incoming request
2955
+ */
2444
2956
  headers: string[];
2445
2957
  }
2446
2958
 
2447
2959
  /**
2448
- * @beta
2960
+ * Remove query parameters from the incoming request
2961
+ *
2962
+ * @title Remove Query Parameters
2963
+ * @public
2964
+ * @param request - The ZuploRequest
2965
+ * @param context - The ZuploContext
2966
+ * @param options - The policy options set in policies.json
2967
+ * @param policyName - The name of the policy as set in policies.json
2968
+ * @returns A Request or a Response
2449
2969
  */
2450
2970
  export declare const RemoveQueryParamsInboundPolicy: InboundPolicyHandler<RemoveQueryParamsInboundPolicyOptions>;
2451
2971
 
2452
2972
  /**
2453
- * @beta
2973
+ * The options for this policy
2454
2974
  */
2455
2975
  export declare interface RemoveQueryParamsInboundPolicyOptions {
2976
+ /**
2977
+ * Array of query parameters to be removed
2978
+ */
2456
2979
  params: string[];
2457
2980
  }
2458
2981
 
2459
2982
  /**
2460
- * @beta
2983
+ * Replace a string in the incoming request body
2984
+ *
2985
+ * @title Replace String in Response Body
2986
+ * @public
2987
+ * @param request - The ZuploRequest
2988
+ * @param context - The ZuploContext
2989
+ * @param options - The policy options set in policies.json
2990
+ * @param policyName - The name of the policy as set in policies.json
2991
+ * @returns A Request or a Response
2461
2992
  */
2462
2993
  export declare const ReplaceStringOutboundPolicy: OutboundPolicyHandler<ReplaceStringOutboundPolicyOptions>;
2463
2994
 
2995
+ /**
2996
+ * The options for this policy
2997
+ */
2464
2998
  export declare interface ReplaceStringOutboundPolicyOptions {
2999
+ /**
3000
+ * The type of string replacement to perform
3001
+ */
2465
3002
  mode: "regexp" | "string";
3003
+ /**
3004
+ * The pattern to match
3005
+ */
2466
3006
  match: string;
3007
+ /**
3008
+ * The value to each match is replaced with
3009
+ */
2467
3010
  replaceWith: string;
2468
3011
  }
2469
3012
 
2470
3013
  /**
2471
- * @beta
3014
+ * Enforces a maximum size in bytes of the incoming request.
3015
+ *
3016
+ * @title Request Size Limit
3017
+ * @public
3018
+ * @param request - The ZuploRequest
3019
+ * @param context - The ZuploContext
3020
+ * @param options - The policy options set in policies.json
3021
+ * @param policyName - The name of the policy as set in policies.json
3022
+ * @returns A Request or a Response
2472
3023
  */
2473
3024
  export declare const RequestSizeLimitInboundPolicy: InboundPolicyHandler<RequestSizeLimitInboundPolicyOptions>;
2474
3025
 
2475
3026
  /**
2476
- * @beta
3027
+ * The options for this policy
2477
3028
  */
2478
3029
  export declare interface RequestSizeLimitInboundPolicyOptions {
3030
+ /**
3031
+ * The maximum size of the request in bytes
3032
+ */
2479
3033
  maxSizeInBytes: number;
3034
+ /**
3035
+ * 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.
3036
+ */
2480
3037
  trustContentLengthHeader?: boolean;
2481
3038
  }
2482
3039
 
@@ -2488,27 +3045,112 @@ export declare interface RequestUser<TUserData = any> {
2488
3045
  data: TUserData;
2489
3046
  }
2490
3047
 
2491
- export declare const RequestValidationInboundPolicy: InboundPolicyHandler;
3048
+ /**
3049
+ * Validate inbound requests based on Open API specification
3050
+ *
3051
+ * @remarks
3052
+ * The Request Validation policy is used to validate incoming requests based on
3053
+ * schemas in OpenAPI specifications.
3054
+ *
3055
+ * When configured, any requests that do not conform to your OpenAPI schema will be
3056
+ * rejected with a `400: Bad Request` response containing a detailed error message
3057
+ * (in JSON) explaining why the request was not accepted.
3058
+ *
3059
+ * Here's an example of how to specify a schema for validation in a request body in
3060
+ * OpenAPI.
3061
+ *
3062
+ * ```json
3063
+ * "requestBody": {
3064
+ * "description": "user to add to the system",
3065
+ * "content": {
3066
+ * "application/json": {
3067
+ * "schema": {
3068
+ * "type": "object",
3069
+ * "properties": {
3070
+ * "name": {
3071
+ * "type": "string"
3072
+ * },
3073
+ * "age": {
3074
+ * "type": "integer"
3075
+ * }
3076
+ * },
3077
+ * "required": [
3078
+ * "name",
3079
+ * "age"
3080
+ * ]
3081
+ * }
3082
+ * }
3083
+ * }
3084
+ * }
3085
+ * ```
3086
+ *
3087
+ * @title Request Validation
3088
+ * @public
3089
+ * @param request - The ZuploRequest
3090
+ * @param context - The ZuploContext
3091
+ * @param options - The policy options set in policies.json
3092
+ * @param policyName - The name of the policy as set in policies.json
3093
+ * @returns A Request or a Response
3094
+ */
3095
+ export declare const RequestValidationInboundPolicy: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
2492
3096
 
3097
+ /**
3098
+ * The options for this policy
3099
+ */
2493
3100
  export declare interface RequestValidationInboundPolicyOptions {
2494
- logLevel?: LogLevel;
3101
+ /**
3102
+ * Optional. Specify one of the log levels: 'error | warn | info | debug'. Default: info
3103
+ */
3104
+ logLevel?: string;
2495
3105
  validateBody?: ValidationOptions;
2496
- validateQueryParameters?: ValidationOptions;
2497
- validatePathParameters?: ValidationOptions;
2498
- validateHeaders?: ValidationOptions;
3106
+ validateQueryParameters?: ValidationOptions1;
3107
+ validatePathParameters?: ValidationOptions2;
3108
+ validateHeaders?: ValidationOptions3;
3109
+ /**
3110
+ * Optional. Specify whether to include the request in the logs. Default: false
3111
+ */
2499
3112
  includeRequestInLogs?: boolean;
2500
3113
  }
2501
3114
 
2502
3115
  /**
2503
- * @beta
3116
+ * Sets an allow-list for an origin header
3117
+ *
3118
+ * @remarks
3119
+ * The Require Origin policy is used to enforce that the client is sending an
3120
+ * `origin` header that matches your allow-list specified in the policy options.
3121
+ *
3122
+ * This is useful if you want to stop any browser traffic from different domains.
3123
+ *
3124
+ * However, it is important to note that it does not guarantee that traffic is only
3125
+ * coming from a browser. Somebody could simulate a browser request from a backend
3126
+ * server and set any origin they like.
3127
+ *
3128
+ * If the incoming origin is missing, or not allowed - a 400 Forbidden Problem
3129
+ * Response will be sent to the client. You can customize the `detail` property in
3130
+ * the policy options.
3131
+ *
3132
+ * @title Require Origin
3133
+ * @public
3134
+ * @param request - The ZuploRequest
3135
+ * @param context - The ZuploContext
3136
+ * @param options - The policy options set in policies.json
3137
+ * @param policyName - The name of the policy as set in policies.json
3138
+ * @returns A Request or a Response
2504
3139
  */
2505
- declare type RequiredClaims = Record<string, string[]>;
2506
-
2507
3140
  export declare const RequireOriginInboundPolicy: InboundPolicyHandler<RequireOriginInboundPolicyOptions>;
2508
3141
 
3142
+ /**
3143
+ * The options for this policy
3144
+ */
2509
3145
  export declare interface RequireOriginInboundPolicyOptions {
2510
- origins?: string[] | string;
2511
- failureDetail: string;
3146
+ /**
3147
+ * A comma separated string containing valid origins
3148
+ */
3149
+ origins: string;
3150
+ /**
3151
+ * The `detail` of the HTTP Problem response, if the origin is missing or disallowed
3152
+ */
3153
+ failureDetail?: string;
2512
3154
  }
2513
3155
 
2514
3156
  /**
@@ -2645,7 +3287,7 @@ export declare function sanitizedIdentifierName(name: string): string;
2645
3287
  /**
2646
3288
  * @deprecated Use RequestValidationInboundPolicy instead
2647
3289
  */
2648
- export declare const SchemaBasedRequestValidation: InboundPolicyHandler<any>;
3290
+ export declare const SchemaBasedRequestValidation: InboundPolicyHandler<RequestValidationInboundPolicyOptions>;
2649
3291
 
2650
3292
  /* Excluded from this release type: serialize */
2651
3293
 
@@ -2659,40 +3301,149 @@ export declare interface ServiceProvider {
2659
3301
 
2660
3302
  /* Excluded from this release type: ServiceProviderImpl */
2661
3303
 
3304
+ /**
3305
+ * 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.
3306
+ *
3307
+ * @remarks
3308
+ * The Set Body policy allows you to set or override the incoming request body.
3309
+ * [GET or HEAD requests do not support bodies on Zuplo](/docs/articles/zp-body-removed),
3310
+ * so be sure to use the [Change Method](/docs/policies/change-method-inbound)
3311
+ * policy to update the method to a `POST` or whatever is appropriate. You might
3312
+ * also need to use the [Set Header](/docs/policies/set-headers-inbound) policy to
3313
+ * set a `content-type`.
3314
+ *
3315
+ * @title Set Body
3316
+ * @public
3317
+ * @param request - The ZuploRequest
3318
+ * @param context - The ZuploContext
3319
+ * @param options - The policy options set in policies.json
3320
+ * @param policyName - The name of the policy as set in policies.json
3321
+ * @returns A Request or a Response
3322
+ */
2662
3323
  export declare const SetBodyInboundPolicy: InboundPolicyHandler<SetBodyInboundPolicyOptions>;
2663
3324
 
3325
+ /**
3326
+ * The options for this policy
3327
+ */
2664
3328
  export declare interface SetBodyInboundPolicyOptions {
3329
+ /**
3330
+ * The value to set for the body
3331
+ */
2665
3332
  body: string;
2666
3333
  }
2667
3334
 
2668
3335
  /**
2669
- * @beta
3336
+ * Adds or sets headers on the incoming request.
3337
+ *
3338
+ * @remarks
3339
+ * The set header policy adds a header to the request in the inbound pipeline. This
3340
+ * can be used to set a security header required by the downstream service. For
3341
+ * example, if your backend service uses basic authentication you might use this
3342
+ * policy to attach the Basic auth header to the request:
3343
+ *
3344
+ * ```json
3345
+ * {
3346
+ * "export": "SetHeadersInboundPolicy",
3347
+ * "module": "$import(@zuplo/runtime)",
3348
+ * "options": {
3349
+ * "headers": [
3350
+ * {
3351
+ * "name": "Authorization",
3352
+ * "value": "Basic DIGEST_HERE",
3353
+ * "overwrite": true
3354
+ * }
3355
+ * ]
3356
+ * }
3357
+ * }
3358
+ * ```
3359
+ *
3360
+ * When doing this, you most likely want to set the secret as an environment
3361
+ * variable, which can be accessed in the policy as follows
3362
+ *
3363
+ * ```json
3364
+ * {
3365
+ * "export": "SetHeadersInboundPolicy",
3366
+ * "module": "$import(@zuplo/runtime)",
3367
+ * "options": {
3368
+ * "headers": [
3369
+ * {
3370
+ * "name": "Authorization",
3371
+ * "value": "$env(BASIC_AUTHORIZATION_HEADER_VALUE)",
3372
+ * "overwrite": true
3373
+ * }
3374
+ * ]
3375
+ * }
3376
+ * }
3377
+ * ```
3378
+ *
3379
+ * And you would set the environment variable `BASIC_AUTHORIZATION_HEADER_VALUE` to
3380
+ * `Basic DIGEST_HERE`.
3381
+ *
3382
+ * @title Add or Set Request Headers
3383
+ * @public
3384
+ * @param request - The ZuploRequest
3385
+ * @param context - The ZuploContext
3386
+ * @param options - The policy options set in policies.json
3387
+ * @param policyName - The name of the policy as set in policies.json
3388
+ * @returns A Request or a Response
2670
3389
  */
2671
3390
  export declare const SetHeadersInboundPolicy: InboundPolicyHandler<SetHeadersInboundPolicyOptions>;
2672
3391
 
2673
3392
  /**
2674
- * @beta
3393
+ * The options for this policy
2675
3394
  */
2676
3395
  export declare interface SetHeadersInboundPolicyOptions {
3396
+ /**
3397
+ * An array of name and value objects (with an optional `overwrite` boolean)
3398
+ */
2677
3399
  headers: {
3400
+ /**
3401
+ * The name of the header
3402
+ */
2678
3403
  name: string;
3404
+ /**
3405
+ * The value of the header
3406
+ */
2679
3407
  value: string;
3408
+ /**
3409
+ * Overwrite the value if the header is already present in the request
3410
+ */
2680
3411
  overwrite?: boolean;
2681
3412
  }[];
2682
3413
  }
2683
3414
 
2684
3415
  /**
2685
- * @beta
3416
+ * Adds or sets headers on the on the outgoing.
3417
+ *
3418
+ * @title Set Status Code
3419
+ * @public
3420
+ * @param request - The ZuploRequest
3421
+ * @param context - The ZuploContext
3422
+ * @param options - The policy options set in policies.json
3423
+ * @param policyName - The name of the policy as set in policies.json
3424
+ * @returns A Request or a Response
2686
3425
  */
2687
3426
  export declare const SetHeadersOutboundPolicy: OutboundPolicyHandler<SetHeadersOutboundPolicyOptions>;
2688
3427
 
2689
3428
  /**
2690
- * @beta
3429
+ * The options for this policy
2691
3430
  */
2692
3431
  export declare interface SetHeadersOutboundPolicyOptions {
3432
+ /**
3433
+ * An array of name and value objects (with an optional `overwrite` boolean)
3434
+ */
2693
3435
  headers: {
3436
+ /**
3437
+ * The name of the header
3438
+ */
2694
3439
  name: string;
3440
+ /**
3441
+ * The value of the header
3442
+ */
2695
3443
  value: string;
3444
+ /**
3445
+ * Overwrite the value if the header is already present in the request
3446
+ */
2696
3447
  overwrite?: boolean;
2697
3448
  }[];
2698
3449
  }
@@ -2700,43 +3451,88 @@ export declare interface SetHeadersOutboundPolicyOptions {
2700
3451
  export declare function setMoesifContext(context: ZuploContext, moesifContext: MoesifContext): void;
2701
3452
 
2702
3453
  /**
2703
- * @beta
3454
+ * Adds or sets query parameters on the incoming request.
3455
+ *
3456
+ * @title Add or Set Query Parameters
3457
+ * @public
3458
+ * @param request - The ZuploRequest
3459
+ * @param context - The ZuploContext
3460
+ * @param options - The policy options set in policies.json
3461
+ * @param policyName - The name of the policy as set in policies.json
3462
+ * @returns A Request or a Response
2704
3463
  */
2705
3464
  export declare const SetQueryParamsInboundPolicy: InboundPolicyHandler<SetQueryParamsInboundPolicyOptions>;
2706
3465
 
2707
3466
  /**
2708
- * @beta
3467
+ * The options for this policy
2709
3468
  */
2710
3469
  export declare interface SetQueryParamsInboundPolicyOptions {
3470
+ /**
3471
+ * An array of name and value objects (with an optional `overwrite` boolean)
3472
+ */
2711
3473
  params: {
3474
+ /**
3475
+ * The name of the param
3476
+ */
2712
3477
  name: string;
3478
+ /**
3479
+ * The value of the param
3480
+ */
2713
3481
  value: string;
3482
+ /**
3483
+ * Overwrite the value if the param is already present in the request
3484
+ */
2714
3485
  overwrite?: boolean;
2715
3486
  }[];
2716
3487
  }
2717
3488
 
2718
3489
  /**
2719
- * @beta
3490
+ * Sets the status code on the on the outgoing response.
3491
+ *
3492
+ * @title Set Status Code
3493
+ * @public
3494
+ * @param request - The ZuploRequest
3495
+ * @param context - The ZuploContext
3496
+ * @param options - The policy options set in policies.json
3497
+ * @param policyName - The name of the policy as set in policies.json
3498
+ * @returns A Request or a Response
2720
3499
  */
2721
3500
  export declare const SetStatusOutboundPolicy: OutboundPolicyHandler<SetStatusOutboundPolicyOptions>;
2722
3501
 
2723
3502
  /**
2724
- * @beta
3503
+ * The options for this policy
2725
3504
  */
2726
3505
  export declare interface SetStatusOutboundPolicyOptions {
3506
+ /**
3507
+ * The status code to be used in the response
3508
+ */
2727
3509
  status?: number;
3510
+ /**
3511
+ * The statusText to be used in the response (optional)
3512
+ */
2728
3513
  statusText?: string;
2729
3514
  }
2730
3515
 
2731
3516
  /**
2732
- * @beta
3517
+ * Add a delay to the incoming request. Useful for testing.
3518
+ *
3519
+ * @title Sleep / Delay
3520
+ * @public
3521
+ * @param request - The ZuploRequest
3522
+ * @param context - The ZuploContext
3523
+ * @param options - The policy options set in policies.json
3524
+ * @param policyName - The name of the policy as set in policies.json
3525
+ * @returns A Request or a Response
2733
3526
  */
2734
3527
  export declare const SleepInboundPolicy: InboundPolicyHandler<SleepInboundPolicyOptions>;
2735
3528
 
2736
3529
  /**
2737
- * @beta
3530
+ * The options for this policy
2738
3531
  */
2739
3532
  export declare interface SleepInboundPolicyOptions {
3533
+ /**
3534
+ * The number of milliseconds to delay the request
3535
+ */
2740
3536
  sleepInMs: number;
2741
3537
  }
2742
3538
 
@@ -2755,26 +3551,50 @@ export declare class SumoLogicLoggingPlugin extends LogPlugin {
2755
3551
  }
2756
3552
 
2757
3553
  /**
2758
- * @beta
2759
- * Validates a JWT issued by a Open Id service
3554
+ * The Supabase JWT Authentication policy supports user JWT tokens created by Supabase.
3555
+ *
3556
+ * @remarks
3557
+ * The Supabase JWT Authentication policy allows you to authenticate incoming
3558
+ * requests using a token created by [supabase.com](https://supabase.com).
3559
+ *
3560
+ * When configured, you can have Zuplo check incoming requests for a JWT token and
3561
+ * automatically populate the `ZuploRequest`'s `user` property with a user object.
3562
+ *
3563
+ * This `user` object will have a `sub` property - taking the `sub` id from the JWT
3564
+ * token. It will also have a `data` property populated by other data returned in
3565
+ * the JWT token - including all your claims, `user_metadata` and `app_metadata`.
3566
+ *
3567
+ * You can also require specific claims to have specific values to allow
3568
+ * authentication to complete, providing a layer of authorization.
3569
+ *
3570
+ * @title Supabase JWT Auth
3571
+ * @public
2760
3572
  * @param request - The ZuploRequest
2761
3573
  * @param context - The ZuploContext
2762
- * @param options - The configuration options
2763
- * @returns
3574
+ * @param options - The policy options set in policies.json
3575
+ * @param policyName - The name of the policy as set in policies.json
3576
+ * @returns A Request or a Response
2764
3577
  */
2765
3578
  export declare const SupabaseJwtInboundPolicy: InboundPolicyHandler<SupabaseJwtInboundPolicyOptions>;
2766
3579
 
2767
3580
  /**
2768
- * @beta
3581
+ * The options for this policy
2769
3582
  */
2770
3583
  export declare interface SupabaseJwtInboundPolicyOptions {
3584
+ /**
3585
+ * The key used to verify the signature of the JWT token
3586
+ */
2771
3587
  secret: string;
2772
3588
  /**
2773
- * If false, a 401 will be returned if a valid
2774
- * Authorization header is not present
3589
+ * Indicates whether the request should continue if authentication fails. Default is `false` which means unauthenticated users will automatically receive a 401 response.
2775
3590
  */
2776
3591
  allowUnauthenticatedRequests?: boolean;
2777
- requiredClaims?: RequiredClaims;
3592
+ /**
3593
+ * Any claims that must be present for authentication to succeed - multiple valid values can be specified for each claim.
3594
+ */
3595
+ requiredClaims?: {
3596
+ [k: string]: string[];
3597
+ };
2778
3598
  }
2779
3599
 
2780
3600
  /* Excluded from this release type: SYSTEM_LOGGER */
@@ -2784,80 +3604,130 @@ export declare interface SupabaseJwtInboundPolicyOptions {
2784
3604
  /* Excluded from this release type: SystemRouteName */
2785
3605
 
2786
3606
  /**
2787
- * Uses Azure Active Directory to add an Authorization header to the request
2788
- * in order to authenticate requests using Azure identity.
2789
- *
3607
+ * Uses Azure Active Directory to add an Authorization header to the request in order to authenticate requests using Azure identity.
2790
3608
  * @see {@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}
2791
- * @beta
3609
+ *
3610
+ * @remarks
3611
+ * This policy adds a `Authorization` header to the upstream request that allows
3612
+ * using Azure AD to authenticate requests to your origin server. This is a useful
3613
+ * means of securing your origin server so that only your Zuplo gateway can make
3614
+ * requests against it.
3615
+ *
3616
+ * Using this policy allows you to delegate authentication and authorization to
3617
+ * your gateway without writing any code on your origin service. For instructions
3618
+ * on how to configure Azure AD authentication see
3619
+ * [Azure's documentation](https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad).
3620
+ *
3621
+ * @title Upstream Azure AD Service Auth
3622
+ * @public
3623
+ * @param request - The ZuploRequest
3624
+ * @param context - The ZuploContext
3625
+ * @param options - The policy options set in policies.json
3626
+ * @param policyName - The name of the policy as set in policies.json
3627
+ * @returns A Request or a Response
2792
3628
  */
2793
3629
  export declare const UpstreamAzureAdServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamAzureAdServiceAuthInboundPolicyOptions>;
2794
3630
 
2795
3631
  /**
2796
- * @beta
3632
+ * The options for this policy
2797
3633
  */
2798
3634
  export declare interface UpstreamAzureAdServiceAuthInboundPolicyOptions {
2799
3635
  /**
2800
- * Azure Active Directory Tenant ID
3636
+ * Azure Active Directory Tenant ID.
2801
3637
  */
2802
3638
  activeDirectoryTenantId: string;
2803
3639
  /**
2804
- * The Application (client) ID of the Azure AD App Registration
3640
+ * The Application (client) ID of the Azure AD App Registration.
2805
3641
  */
2806
3642
  activeDirectoryClientId: string;
2807
3643
  /**
2808
- * The client secret of the Azure AD App Registration
3644
+ * The client secret of the Azure AD App Registration.
2809
3645
  */
2810
3646
  activeDirectoryClientSecret: string;
2811
3647
  /**
2812
- * The number of times to retry fetching the token in the event of a failure.
2813
- * Defaults to 3.
3648
+ * The number of times to retry fetching the token in the event of a failure. Defaults to 3.
2814
3649
  */
2815
3650
  tokenRetries?: number;
2816
3651
  /**
2817
- * The number of seconds less than the token expiration to cache the token
2818
- * Defaults to 300 seconds.
3652
+ * The number of seconds less than the token expiration to cache the token. Defaults to 300 seconds.
2819
3653
  */
2820
3654
  expirationOffsetSeconds?: number;
2821
3655
  }
2822
3656
 
2823
3657
  /**
2824
- * @beta
3658
+ * Creates a Firebase Admin token and attaches it to the outgoing request. Useful when calling Firebase services as an administrator.
3659
+ *
3660
+ * @remarks
3661
+ * This policy adds a Firebase Admin token to the outgoing `Authentication` header
3662
+ * allowing requests to Firebase using Service Account admin permissions. This can
3663
+ * be useful for calling Firebase services such as Firestore through a Zuplo
3664
+ * endpoint that is secured with other means of Authentication such as API keys.
3665
+ * Additionally, this policy can be useful for service content to all API users
3666
+ * (for example serving a specific Firestore document containing configuration
3667
+ * data)
3668
+ *
3669
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
3670
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
3671
+ *
3672
+ * @title Upstream Firebase Admin Auth
3673
+ * @public
3674
+ * @param request - The ZuploRequest
3675
+ * @param context - The ZuploContext
3676
+ * @param options - The policy options set in policies.json
3677
+ * @param policyName - The name of the policy as set in policies.json
3678
+ * @returns A Request or a Response
2825
3679
  */
2826
3680
  export declare const UpstreamFirebaseAdminAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseAdminAuthInboundPolicyOptions>;
2827
3681
 
2828
3682
  /**
2829
- * @beta
3683
+ * The options for this policy
2830
3684
  */
2831
3685
  export declare interface UpstreamFirebaseAdminAuthInboundPolicyOptions {
2832
3686
  /**
2833
- * The JSON key of your GCP Service Account
2834
- * @see {@link https://developers.google.com/workspace/guides/create-credentials|Create access credentials}
3687
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
2835
3688
  */
2836
3689
  serviceAccountJson: string;
2837
3690
  /**
2838
- * The number of times to retry fetching the token in the event of a failure.
2839
- * Defaults to 3.
3691
+ * The number of times to retry fetching the token in the event of a failure. Defaults to 3.
2840
3692
  */
2841
3693
  tokenRetries?: number;
2842
3694
  /**
2843
- * The number of seconds less than the token expiration to cache the token
2844
- * Defaults to 300 seconds.
3695
+ * The number of seconds less than the token expiration to cache the token. Defaults to 300 seconds.
2845
3696
  */
2846
3697
  expirationOffsetSeconds?: number;
2847
3698
  }
2848
3699
 
2849
3700
  /**
2850
- * @beta
3701
+ * Creates a Firebase custom user token and attaches it to the outgoing request. Useful when calling Firebase services as user.
3702
+ *
3703
+ * @remarks
3704
+ * This policy adds a Firebase Admin token to the outgoing `Authentication` header
3705
+ * allowing requests to Firebase using Service Account admin permissions. This can
3706
+ * be useful for calling Firebase services such as Firestore through a Zuplo
3707
+ * endpoint that is secured with other means of Authentication such as API keys.
3708
+ * Additionally, this policy can be useful for service content to all API users
3709
+ * (for example serving a specific Firestore document containing configuration
3710
+ * data)
3711
+ *
3712
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
3713
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
3714
+ *
3715
+ * @title Upstream Firebase User Auth
3716
+ * @public
3717
+ * @param request - The ZuploRequest
3718
+ * @param context - The ZuploContext
3719
+ * @param options - The policy options set in policies.json
3720
+ * @param policyName - The name of the policy as set in policies.json
3721
+ * @returns A Request or a Response
2851
3722
  */
2852
3723
  export declare const UpstreamFirebaseUserAuthInboundPolicy: InboundPolicyHandler<UpstreamFirebaseUserAuthInboundPolicyOptions>;
2853
3724
 
2854
3725
  /**
2855
- * @beta
3726
+ * The options for this policy
2856
3727
  */
2857
3728
  export declare interface UpstreamFirebaseUserAuthInboundPolicyOptions {
2858
3729
  /**
2859
- * The JSON key of your GCP Service Account
2860
- * @see {@link https://developers.google.com/workspace/guides/create-credentials|Create access credentials}
3730
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
2861
3731
  */
2862
3732
  serviceAccountJson: string;
2863
3733
  /**
@@ -2871,67 +3741,109 @@ export declare interface UpstreamFirebaseUserAuthInboundPolicyOptions {
2871
3741
  /**
2872
3742
  * Optional additional claims to include in the custom token's payload.
2873
3743
  */
2874
- developerClaims?: Record<string, boolean | string | number | null>;
3744
+ developerClaims?: Record<string, string | number | boolean | null>;
2875
3745
  /**
2876
3746
  * The Firebase Web API Key (found in project settings)
2877
3747
  * @see {@link https://firebase.google.com/docs/projects/api-keys|Firebase API Keys}
2878
3748
  */
2879
3749
  webApiKey: string;
2880
3750
  /**
2881
- * The number of times to retry fetching the token in the event of a failure.
2882
- * Defaults to 3.
3751
+ * The number of times to retry fetching the token in the event of a failure. Defaults to 3.
2883
3752
  */
2884
3753
  tokenRetries?: number;
2885
3754
  /**
2886
- * The number of seconds less than the token expiration to cache the token
2887
- * Defaults to 300 seconds.
3755
+ * The number of seconds less than the token expiration to cache the token. Defaults to 300 seconds.
2888
3756
  */
2889
3757
  expirationOffsetSeconds?: number;
2890
3758
  }
2891
3759
 
2892
3760
  /**
2893
- * @beta
3761
+ * 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
3762
+ *
3763
+ * @remarks
3764
+ * **CAUTION: This policy only works with
3765
+ * [certain Google APIs](https://developers.google.com/identity/protocols/oauth2/service-account#jwt-auth).
3766
+ * In most cases, the
3767
+ * [Upstream GCP Service Auth](/docs/policies/upstream-gcp-service-auth-inbound)
3768
+ * should be used.**
3769
+ *
3770
+ * This policy adds a JWT token to the headers, ready for us in an outgoing request
3771
+ * when calling a GCP service (e.g. Cloud Endpoints / ESPv2). We recommend reading
3772
+ * the `serviceAccountJson` from environment variables (so it is not checked in to
3773
+ * source control) using the `$env(ENV_VAR)` syntax.
3774
+ *
3775
+ * @title Upstream GCP Self-Signed JWT
3776
+ * @public
3777
+ * @param request - The ZuploRequest
3778
+ * @param context - The ZuploContext
3779
+ * @param options - The policy options set in policies.json
3780
+ * @param policyName - The name of the policy as set in policies.json
3781
+ * @returns A Request or a Response
2894
3782
  */
2895
3783
  export declare const UpstreamGcpJwtInboundPolicy: InboundPolicyHandler<UpstreamGcpJwtInboundPolicyOptions>;
2896
3784
 
2897
3785
  /**
2898
- * @beta
3786
+ * The options for this policy
2899
3787
  */
2900
3788
  export declare interface UpstreamGcpJwtInboundPolicyOptions {
3789
+ /**
3790
+ * The audience for the minted JWT. Refer to https://cloud.google.com/endpoints/docs/grpc-service-config/reference/rpc/google.api#google.api.AuthRequirement.
3791
+ */
2901
3792
  audience: string;
3793
+ /**
3794
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
3795
+ */
2902
3796
  serviceAccountJson: string;
2903
3797
  }
2904
3798
 
2905
3799
  /**
2906
- * Uses a GCP IAM Service Account to add an Authorization header to the request
2907
- * in order to authenticate requests to Google Services using ID Tokens
2908
- *
3800
+ * Creates an ID Token from Google's OAuth service and attaches it to the outgoing request. Useful when calling GCP services that are secured with GCP IAM.
2909
3801
  * @see {@link https://cloud.google.com/functions/docs/securing/authenticating|Authenticating for invocation}
2910
- * @beta
3802
+ *
3803
+ * @remarks
3804
+ * This policy allows you to delegate authentication and authorization to your
3805
+ * gateway without writing any code on your origin service by adding a GCP Issued
3806
+ * ID Token to outgoing header allowing the service to be secured with GCP IAM.
3807
+ * This is a useful means of securing your origin server so that only your Zuplo
3808
+ * gateway can make requests against it.
3809
+ *
3810
+ * This policy works with
3811
+ * [GCP Identity Aware Proxy](https://zuplo.com/docs/articles/gke-with-upstream-auth-policy)
3812
+ * or services like [Cloud Run](https://cloud.google.com/iap/docs/managing-access)
3813
+ * that natively support IAM authorization.
3814
+ *
3815
+ * We recommend reading the `serviceAccountJson` from environment variables (so it
3816
+ * is not checked in to source control) using the `$env(ENV_VAR)` syntax.
3817
+ *
3818
+ * @title Upstream GCP Service Auth
3819
+ * @public
3820
+ * @param request - The ZuploRequest
3821
+ * @param context - The ZuploContext
3822
+ * @param options - The policy options set in policies.json
3823
+ * @param policyName - The name of the policy as set in policies.json
3824
+ * @returns A Request or a Response
2911
3825
  */
2912
3826
  export declare const UpstreamGcpServiceAuthInboundPolicy: InboundPolicyHandler<UpstreamGcpServiceAuthInboundPolicyOptions>;
2913
3827
 
2914
3828
  /**
2915
- * @beta
3829
+ * The options for this policy
2916
3830
  */
2917
3831
  export declare interface UpstreamGcpServiceAuthInboundPolicyOptions {
2918
3832
  /**
2919
- * The audience for the service to be called (i.e. the URI of the API)
3833
+ * 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'
2920
3834
  */
2921
3835
  audience: string;
2922
3836
  /**
2923
- * The JSON key of your GCP Service Account
3837
+ * The Google Service Account key in JSON format. Note you can load this from environment variables using the $env(ENV_VAR) syntax.
2924
3838
  * @see {@link https://developers.google.com/workspace/guides/create-credentials|Create access credentials}
2925
3839
  */
2926
3840
  serviceAccountJson: string;
2927
3841
  /**
2928
- * The number of times to retry fetching the token in the event of a failure.
2929
- * Defaults to 3.
3842
+ * The number of times to retry fetching the token in the event of a failure. Defaults to 3.
2930
3843
  */
2931
3844
  tokenRetries?: number;
2932
3845
  /**
2933
- * The number of seconds less than the token expiration to cache the token
2934
- * Defaults to 300 seconds.
3846
+ * The number of seconds less than the token expiration to cache the token. Defaults to 300 seconds.
2935
3847
  */
2936
3848
  expirationOffsetSeconds?: number;
2937
3849
  /**
@@ -2962,27 +3874,70 @@ export declare const VALID_COMPATIBILITY_DATES: readonly CompatibilityDate[];
2962
3874
  /* Excluded from this release type: ValidateFunction */
2963
3875
 
2964
3876
  /**
2965
- * @beta
2966
- * @param request - The incoming request
2967
- * @param options - The validation options
2968
- * @returns
3877
+ * Validates the body of an incoming request based on a JSON schema.
3878
+ *
3879
+ * @remarks
3880
+ * **This policy is deprecated. Use the new
3881
+ * [Request Validation Policy](https://zuplo.com/docs/policies/request-validation-inbound).
3882
+ * The new policy validates JSON bodies like this policy, but also supports
3883
+ * validation of parameters, query strings, etc.**
3884
+ *
3885
+ * The Validate JSON Schema policy is used to validate the body of incoming
3886
+ * requests. It works using JSON Schemas defined in the `Schemas` folder of your
3887
+ * project.
3888
+ *
3889
+ * When configured, any requests that do not have a body conforming to your JSON
3890
+ * schema will be rejected with a `400: Bad Request` response containing a detailed
3891
+ * error message (in JSON) explaining why the body was not accepted.
3892
+ *
3893
+ * @title JSON Body Validation
3894
+ * @public
3895
+ * @deprecated Use the Request Validation policy (RequestValidationInboundPolicy) instead.
3896
+ * @param request - The ZuploRequest
3897
+ * @param context - The ZuploContext
3898
+ * @param options - The policy options set in policies.json
3899
+ * @param policyName - The name of the policy as set in policies.json
3900
+ * @returns A Request or a Response
2969
3901
  */
2970
- export declare const ValidateJsonSchemaInbound: InboundPolicyHandler<ValidateJsonSchemaInboundOptions>;
3902
+ export declare const ValidateJsonSchemaInbound: InboundPolicyHandler<ValidateJsonSchemaInboundInternalOptions>;
2971
3903
 
2972
3904
  /**
2973
3905
  * @beta
2974
3906
  */
2975
- export declare interface ValidateJsonSchemaInboundOptions {
3907
+ declare interface ValidateJsonSchemaInboundInternalOptions extends Omit<ValidateJsonSchemaInboundOptions, "validator"> {
2976
3908
  /* Excluded from this release type: validator */
2977
3909
  }
2978
3910
 
2979
- declare enum ValidationOptions {
2980
- none = "none",
2981
- logOnly = "log-only",
2982
- rejectAndLog = "reject-and-log",
2983
- rejectOnly = "reject-only"
3911
+ /**
3912
+ * The options for this policy
3913
+ */
3914
+ export declare interface ValidateJsonSchemaInboundOptions {
3915
+ /**
3916
+ * The JSON schema to validate against.
3917
+ */
3918
+ validator: string;
2984
3919
  }
2985
3920
 
3921
+ /**
3922
+ * Optional. Specify one of the options: 'none, log-only, reject-and-log, reject-only'. Default: none
3923
+ */
3924
+ declare type ValidationOptions = "none" | "log-only" | "reject-and-log" | "reject-only";
3925
+
3926
+ /**
3927
+ * Optional. Specify one of the options: 'none, log-only, reject-and-log, reject-only'. Default: none
3928
+ */
3929
+ declare type ValidationOptions1 = "none" | "log-only" | "reject-and-log" | "reject-only";
3930
+
3931
+ /**
3932
+ * Optional. Specify one of the options: 'none, log-only, reject-and-log, reject-only'. Default: none
3933
+ */
3934
+ declare type ValidationOptions2 = "none" | "log-only" | "reject-and-log" | "reject-only";
3935
+
3936
+ /**
3937
+ * Optional. Specify one of the options: 'none, log-only, reject-and-log, reject-only'. Default: none
3938
+ */
3939
+ declare type ValidationOptions3 = "none" | "log-only" | "reject-and-log" | "reject-only";
3940
+
2986
3941
  export declare interface VersionData {
2987
3942
  name: string;
2988
3943
  pathPrefix: string;