@zuplo/runtime 6.52.7 → 6.52.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,44 +2,44 @@
2
2
  * @public
3
3
  */
4
4
  declare interface BuildRouteConfiguration {
5
- path: string;
6
- methods: HttpMethod[];
7
- /**
8
- * @deprecated This property is not used and will be removed in future versions
9
- */
10
- label?: string;
11
- /**
12
- * @deprecated This property is not used and will be removed in future versions
13
- */
14
- key?: string;
15
- handler: HandlerDefinition;
16
- corsPolicy?: CorsPolicy;
17
- /**
18
- * @deprecated This property is deprecated. Use route.raw() instead.
19
- */
20
- custom?: any;
21
- mcp?: {
22
- enabled?: boolean;
23
- };
24
- policies?: {
25
- inbound?: string[];
26
- outbound?: string[];
27
- };
28
- /**
29
- * @deprecated This property is not used and will be removed in future versions
30
- */
31
- excludeFromOpenApi?: boolean;
32
- pathPattern?: string;
33
- /**
34
- * Build-time metadata for this route.
35
- */
36
- metadata?: {
37
- /**
38
- * The source file this route was generated from.
39
- */
40
- filepath: string;
41
- };
42
- /* Excluded from this release type: raw */
5
+ path: string;
6
+ methods: HttpMethod[];
7
+ /**
8
+ * @deprecated This property is not used and will be removed in future versions
9
+ */
10
+ label?: string;
11
+ /**
12
+ * @deprecated This property is not used and will be removed in future versions
13
+ */
14
+ key?: string;
15
+ handler: HandlerDefinition;
16
+ corsPolicy?: CorsPolicy;
17
+ /**
18
+ * @deprecated This property is deprecated. Use route.raw() instead.
19
+ */
20
+ custom?: any;
21
+ mcp?: {
22
+ enabled?: boolean;
23
+ };
24
+ policies?: {
25
+ inbound?: string[];
26
+ outbound?: string[];
27
+ };
28
+ /**
29
+ * @deprecated This property is not used and will be removed in future versions
30
+ */
31
+ excludeFromOpenApi?: boolean;
32
+ pathPattern?: string;
33
+ /**
34
+ * Build-time metadata for this route.
35
+ */
36
+ metadata?: {
37
+ /**
38
+ * The source file this route was generated from.
39
+ */
40
+ filepath: string;
41
+ };
42
+ /* Excluded from this release type: raw */
43
43
  }
44
44
 
45
45
  /**
@@ -58,481 +58,765 @@ declare type CorsPolicy = string | "anything-goes" | "none";
58
58
  * @public
59
59
  */
60
60
  export declare function createMockContext(options?: {
61
- request?: Request;
62
- route?: RouteConfiguration;
61
+ request?: Request;
62
+ route?: RouteConfiguration;
63
63
  }): {
64
- context: MockZuploContext;
65
- invokeResponse: () => Promise<void>;
64
+ context: MockZuploContext;
65
+ invokeResponse: () => Promise<void>;
66
66
  };
67
67
 
68
68
  /**
69
69
  * @public
70
70
  */
71
71
  declare interface HandlerDefinition {
72
- module: any;
73
- export: string;
74
- options?: unknown;
72
+ module: any;
73
+ export: string;
74
+ options?: unknown;
75
75
  }
76
76
 
77
77
  /**
78
78
  * @public
79
79
  */
80
- declare type HttpMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
80
+ declare type HttpMethod =
81
+ | "GET"
82
+ | "HEAD"
83
+ | "POST"
84
+ | "PUT"
85
+ | "DELETE"
86
+ | "CONNECT"
87
+ | "OPTIONS"
88
+ | "TRACE"
89
+ | "PATCH";
81
90
 
82
91
  /**
83
92
  * @beta
84
93
  */
85
94
  declare enum HttpStatusCode {
86
- /**
87
- * The server has received the request headers and the client should proceed to send the request body
88
- * (in the case of a request for which a body needs to be sent; for example, a POST request).
89
- * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
90
- * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
91
- * 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.
92
- */
93
- CONTINUE = 100,
94
- /**
95
- * The requester has asked the server to switch protocols and the server has agreed to do so.
96
- */
97
- SWITCHING_PROTOCOLS = 101,
98
- /**
99
- * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
100
- * This code indicates that the server has received and is processing the request, but no response is available yet.
101
- * This prevents the client from timing out and assuming the request was lost.
102
- * @deprecated This status code is deprecated and shouldn't be sent any more. Clients may still accept it, but simply ignore them.
103
- */
104
- PROCESSING = 102,
105
- /**
106
- * This response may be sent by a server while it is still preparing a
107
- * response, with hints about the resources that the server is expecting
108
- * the final response will link. This allows a browser to start preloading
109
- * resources even before the server has prepared and sent that final response.
110
- */
111
- EARLY_HINTS = 103,
112
- /**
113
- * Standard response for successful HTTP requests.
114
- * The actual response will depend on the request method used.
115
- * In a GET request, the response will contain an entity corresponding to the requested resource.
116
- * In a POST request, the response will contain an entity describing or containing the result of the action.
117
- */
118
- OK = 200,
119
- /**
120
- * The request has been fulfilled, resulting in the creation of a new resource.
121
- */
122
- CREATED = 201,
123
- /**
124
- * The request has been accepted for processing, but the processing has not been completed.
125
- * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
126
- */
127
- ACCEPTED = 202,
128
- /**
129
- * SINCE HTTP/1.1
130
- * The server is a transforming proxy that received a 200 OK from its origin,
131
- * but is returning a modified version of the origin's response.
132
- */
133
- NON_AUTHORITATIVE_INFORMATION = 203,
134
- /**
135
- * The server successfully processed the request and is not returning any content.
136
- */
137
- NO_CONTENT = 204,
138
- /**
139
- * The server successfully processed the request, but is not returning any content.
140
- * Unlike a 204 response, this response requires that the requester reset the document view.
141
- */
142
- RESET_CONTENT = 205,
143
- /**
144
- * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
145
- * The range header is used by HTTP clients to enable resuming of interrupted downloads,
146
- * or split a download into multiple simultaneous streams.
147
- */
148
- PARTIAL_CONTENT = 206,
149
- /**
150
- * The message body that follows is an XML message and can contain a number of separate response codes,
151
- * depending on how many sub-requests were made.
152
- */
153
- MULTI_STATUS = 207,
154
- /**
155
- * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
156
- * and are not being included again.
157
- */
158
- ALREADY_REPORTED = 208,
159
- /**
160
- * The server has fulfilled a request for the resource,
161
- * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
162
- */
163
- IM_USED = 226,
164
- /**
165
- * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
166
- * For example, this code could be used to present multiple video format options,
167
- * to list files with different filename extensions, or to suggest word-sense disambiguation.
168
- */
169
- MULTIPLE_CHOICES = 300,
170
- /**
171
- * This and all future requests should be directed to the given URI.
172
- */
173
- MOVED_PERMANENTLY = 301,
174
- /**
175
- * This is an example of industry practice contradicting the standard.
176
- * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
177
- * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
178
- * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
179
- * to distinguish between the two behaviours. However, some Web applications and frameworks
180
- * use the 302 status code as if it were the 303.
181
- */
182
- FOUND = 302,
183
- /**
184
- * SINCE HTTP/1.1
185
- * The response to the request can be found under another URI using a GET method.
186
- * When received in response to a POST (or PUT/DELETE), the client should presume that
187
- * the server has received the data and should issue a redirect with a separate GET message.
188
- */
189
- SEE_OTHER = 303,
190
- /**
191
- * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
192
- * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
193
- */
194
- NOT_MODIFIED = 304,
195
- /**
196
- * SINCE HTTP/1.1
197
- * The requested resource is available only through a proxy, the address for which is provided in the response.
198
- * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
199
- */
200
- USE_PROXY = 305,
201
- /**
202
- * No longer used. Originally meant "Subsequent requests should use the specified proxy."
203
- * @deprecated No longer used
204
- */
205
- SWITCH_PROXY = 306,
206
- /**
207
- * SINCE HTTP/1.1
208
- * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
209
- * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
210
- * For example, a POST request should be repeated using another POST request.
211
- */
212
- TEMPORARY_REDIRECT = 307,
213
- /**
214
- * The request and all future requests should be repeated using another URI.
215
- * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
216
- * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
217
- */
218
- PERMANENT_REDIRECT = 308,
219
- /**
220
- * The server cannot or will not process the request due to an apparent client error
221
- * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
222
- */
223
- BAD_REQUEST = 400,
224
- /**
225
- * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
226
- * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
227
- * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
228
- * "unauthenticated",i.e. the user does not have the necessary credentials.
229
- */
230
- UNAUTHORIZED = 401,
231
- /**
232
- * Reserved for future use. The original intention was that this code might be used as part of some form of digital
233
- * cash or micro payment scheme, but that has not happened, and this code is not usually used.
234
- * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
235
- */
236
- PAYMENT_REQUIRED = 402,
237
- /**
238
- * The request was valid, but the server is refusing action.
239
- * The user might not have the necessary permissions for a resource.
240
- */
241
- FORBIDDEN = 403,
242
- /**
243
- * The requested resource could not be found but may be available in the future.
244
- * Subsequent requests by the client are permissible.
245
- */
246
- NOT_FOUND = 404,
247
- /**
248
- * A request method is not supported for the requested resource;
249
- * 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.
250
- */
251
- METHOD_NOT_ALLOWED = 405,
252
- /**
253
- * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
254
- */
255
- NOT_ACCEPTABLE = 406,
256
- /**
257
- * The client must first authenticate itself with the proxy.
258
- */
259
- PROXY_AUTHENTICATION_REQUIRED = 407,
260
- /**
261
- * The server timed out waiting for the request.
262
- * According to HTTP specifications:
263
- * "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."
264
- */
265
- REQUEST_TIMEOUT = 408,
266
- /**
267
- * Indicates that the request could not be processed because of conflict in the request,
268
- * such as an edit conflict between multiple simultaneous updates.
269
- */
270
- CONFLICT = 409,
271
- /**
272
- * Indicates that the resource requested is no longer available and will not be available again.
273
- * This should be used when a resource has been intentionally removed and the resource should be purged.
274
- * Upon receiving a 410 status code, the client should not request the resource in the future.
275
- * Clients such as search engines should remove the resource from their indices.
276
- * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
277
- */
278
- GONE = 410,
279
- /**
280
- * The request did not specify the length of its content, which is required by the requested resource.
281
- */
282
- LENGTH_REQUIRED = 411,
283
- /**
284
- * The server does not meet one of the preconditions that the requester put on the request.
285
- */
286
- PRECONDITION_FAILED = 412,
287
- /**
288
- * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
289
- */
290
- CONTENT_TOO_LARGE = 413,
291
- /* Excluded from this release type: PAYLOAD_TOO_LARGE */
292
- /**
293
- * 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,
294
- * in which case it should be converted to a POST request.
295
- * Called "Request-URI Too Long" previously.
296
- */
297
- URI_TOO_LONG = 414,
298
- /**
299
- * The request entity has a media type which the server or resource does not support.
300
- * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
301
- */
302
- UNSUPPORTED_MEDIA_TYPE = 415,
303
- /**
304
- * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
305
- * For example, if the client asked for a part of the file that lies beyond the end of the file.
306
- * Called "Requested Range Not Satisfiable" previously.
307
- */
308
- RANGE_NOT_SATISFIABLE = 416,
309
- /**
310
- * The server cannot meet the requirements of the Expect request-header field.
311
- */
312
- EXPECTATION_FAILED = 417,
313
- /**
314
- * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
315
- * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
316
- * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
317
- */
318
- I_AM_A_TEAPOT = 418,
319
- /**
320
- * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
321
- */
322
- MISDIRECTED_REQUEST = 421,
323
- /* Excluded from this release type: UNPROCESSABLE_ENTITY */
324
- /**
325
- * The request was well-formed but was unable to be followed due to semantic errors.
326
- */
327
- UNPROCESSABLE_CONTENT = 422,
328
- /**
329
- * The resource that is being accessed is locked.
330
- */
331
- LOCKED = 423,
332
- /**
333
- * The request failed due to failure of a previous request (e.g., a PROPPATCH).
334
- */
335
- FAILED_DEPENDENCY = 424,
336
- /**
337
- * The server is unwilling to risk processing a request that might be
338
- * replayed, which creates the potential for a replay attack.
339
- */
340
- TOO_EARLY = 425,
341
- /**
342
- * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
343
- */
344
- UPGRADE_REQUIRED = 426,
345
- /**
346
- * The origin server requires the request to be conditional.
347
- * Intended to prevent "the 'lost update' problem, where a client
348
- * GETs a resource's state, modifies it, and PUTs it back to the server,
349
- * when meanwhile a third party has modified the state on the server, leading to a conflict."
350
- */
351
- PRECONDITION_REQUIRED = 428,
352
- /**
353
- * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
354
- */
355
- TOO_MANY_REQUESTS = 429,
356
- /**
357
- * The server is unwilling to process the request because either an individual header field,
358
- * or all the header fields collectively, are too large.
359
- */
360
- REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
361
- /**
362
- * A server operator has received a legal demand to deny access to a resource or to a set of resources
363
- * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
364
- */
365
- UNAVAILABLE_FOR_LEGAL_REASONS = 451,
366
- /**
367
- * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
368
- */
369
- INTERNAL_SERVER_ERROR = 500,
370
- /**
371
- * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
372
- * Usually this implies future availability (e.g., a new feature of a web-service API).
373
- */
374
- NOT_IMPLEMENTED = 501,
375
- /**
376
- * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
377
- */
378
- BAD_GATEWAY = 502,
379
- /**
380
- * The server is currently unavailable (because it is overloaded or down for maintenance).
381
- * Generally, this is a temporary state.
382
- */
383
- SERVICE_UNAVAILABLE = 503,
384
- /**
385
- * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
386
- */
387
- GATEWAY_TIMEOUT = 504,
388
- /**
389
- * The server does not support the HTTP protocol version used in the request
390
- */
391
- HTTP_VERSION_NOT_SUPPORTED = 505,
392
- /**
393
- * Transparent content negotiation for the request results in a circular reference.
394
- */
395
- VARIANT_ALSO_NEGOTIATES = 506,
396
- /**
397
- * The server is unable to store the representation needed to complete the request.
398
- */
399
- INSUFFICIENT_STORAGE = 507,
400
- /**
401
- * The server detected an infinite loop while processing the request.
402
- */
403
- LOOP_DETECTED = 508,
404
- /**
405
- * Further extensions to the request are required for the server to fulfill it.
406
- */
407
- NOT_EXTENDED = 510,
408
- /**
409
- * The client needs to authenticate to gain network access.
410
- * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
411
- * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
412
- */
413
- NETWORK_AUTHENTICATION_REQUIRED = 511
95
+ /**
96
+ * The server has received the request headers and the client should proceed to send the request body
97
+ * (in the case of a request for which a body needs to be sent; for example, a POST request).
98
+ * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
99
+ * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
100
+ * 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.
101
+ */
102
+ CONTINUE = 100,
103
+ /**
104
+ * The requester has asked the server to switch protocols and the server has agreed to do so.
105
+ */
106
+ SWITCHING_PROTOCOLS = 101,
107
+ /**
108
+ * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
109
+ * This code indicates that the server has received and is processing the request, but no response is available yet.
110
+ * This prevents the client from timing out and assuming the request was lost.
111
+ * @deprecated This status code is deprecated and shouldn't be sent any more. Clients may still accept it, but simply ignore them.
112
+ */
113
+ PROCESSING = 102,
114
+ /**
115
+ * This response may be sent by a server while it is still preparing a
116
+ * response, with hints about the resources that the server is expecting
117
+ * the final response will link. This allows a browser to start preloading
118
+ * resources even before the server has prepared and sent that final response.
119
+ */
120
+ EARLY_HINTS = 103,
121
+ /**
122
+ * Standard response for successful HTTP requests.
123
+ * The actual response will depend on the request method used.
124
+ * In a GET request, the response will contain an entity corresponding to the requested resource.
125
+ * In a POST request, the response will contain an entity describing or containing the result of the action.
126
+ */
127
+ OK = 200,
128
+ /**
129
+ * The request has been fulfilled, resulting in the creation of a new resource.
130
+ */
131
+ CREATED = 201,
132
+ /**
133
+ * The request has been accepted for processing, but the processing has not been completed.
134
+ * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
135
+ */
136
+ ACCEPTED = 202,
137
+ /**
138
+ * SINCE HTTP/1.1
139
+ * The server is a transforming proxy that received a 200 OK from its origin,
140
+ * but is returning a modified version of the origin's response.
141
+ */
142
+ NON_AUTHORITATIVE_INFORMATION = 203,
143
+ /**
144
+ * The server successfully processed the request and is not returning any content.
145
+ */
146
+ NO_CONTENT = 204,
147
+ /**
148
+ * The server successfully processed the request, but is not returning any content.
149
+ * Unlike a 204 response, this response requires that the requester reset the document view.
150
+ */
151
+ RESET_CONTENT = 205,
152
+ /**
153
+ * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
154
+ * The range header is used by HTTP clients to enable resuming of interrupted downloads,
155
+ * or split a download into multiple simultaneous streams.
156
+ */
157
+ PARTIAL_CONTENT = 206,
158
+ /**
159
+ * The message body that follows is an XML message and can contain a number of separate response codes,
160
+ * depending on how many sub-requests were made.
161
+ */
162
+ MULTI_STATUS = 207,
163
+ /**
164
+ * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
165
+ * and are not being included again.
166
+ */
167
+ ALREADY_REPORTED = 208,
168
+ /**
169
+ * The server has fulfilled a request for the resource,
170
+ * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
171
+ */
172
+ IM_USED = 226,
173
+ /**
174
+ * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
175
+ * For example, this code could be used to present multiple video format options,
176
+ * to list files with different filename extensions, or to suggest word-sense disambiguation.
177
+ */
178
+ MULTIPLE_CHOICES = 300,
179
+ /**
180
+ * This and all future requests should be directed to the given URI.
181
+ */
182
+ MOVED_PERMANENTLY = 301,
183
+ /**
184
+ * This is an example of industry practice contradicting the standard.
185
+ * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
186
+ * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
187
+ * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
188
+ * to distinguish between the two behaviours. However, some Web applications and frameworks
189
+ * use the 302 status code as if it were the 303.
190
+ */
191
+ FOUND = 302,
192
+ /**
193
+ * SINCE HTTP/1.1
194
+ * The response to the request can be found under another URI using a GET method.
195
+ * When received in response to a POST (or PUT/DELETE), the client should presume that
196
+ * the server has received the data and should issue a redirect with a separate GET message.
197
+ */
198
+ SEE_OTHER = 303,
199
+ /**
200
+ * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
201
+ * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
202
+ */
203
+ NOT_MODIFIED = 304,
204
+ /**
205
+ * SINCE HTTP/1.1
206
+ * The requested resource is available only through a proxy, the address for which is provided in the response.
207
+ * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
208
+ */
209
+ USE_PROXY = 305,
210
+ /**
211
+ * No longer used. Originally meant "Subsequent requests should use the specified proxy."
212
+ * @deprecated No longer used
213
+ */
214
+ SWITCH_PROXY = 306,
215
+ /**
216
+ * SINCE HTTP/1.1
217
+ * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
218
+ * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
219
+ * For example, a POST request should be repeated using another POST request.
220
+ */
221
+ TEMPORARY_REDIRECT = 307,
222
+ /**
223
+ * The request and all future requests should be repeated using another URI.
224
+ * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
225
+ * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
226
+ */
227
+ PERMANENT_REDIRECT = 308,
228
+ /**
229
+ * The server cannot or will not process the request due to an apparent client error
230
+ * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
231
+ */
232
+ BAD_REQUEST = 400,
233
+ /**
234
+ * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
235
+ * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
236
+ * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
237
+ * "unauthenticated",i.e. the user does not have the necessary credentials.
238
+ */
239
+ UNAUTHORIZED = 401,
240
+ /**
241
+ * Reserved for future use. The original intention was that this code might be used as part of some form of digital
242
+ * cash or micro payment scheme, but that has not happened, and this code is not usually used.
243
+ * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
244
+ */
245
+ PAYMENT_REQUIRED = 402,
246
+ /**
247
+ * The request was valid, but the server is refusing action.
248
+ * The user might not have the necessary permissions for a resource.
249
+ */
250
+ FORBIDDEN = 403,
251
+ /**
252
+ * The requested resource could not be found but may be available in the future.
253
+ * Subsequent requests by the client are permissible.
254
+ */
255
+ NOT_FOUND = 404,
256
+ /**
257
+ * A request method is not supported for the requested resource;
258
+ * 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.
259
+ */
260
+ METHOD_NOT_ALLOWED = 405,
261
+ /**
262
+ * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
263
+ */
264
+ NOT_ACCEPTABLE = 406,
265
+ /**
266
+ * The client must first authenticate itself with the proxy.
267
+ */
268
+ PROXY_AUTHENTICATION_REQUIRED = 407,
269
+ /**
270
+ * The server timed out waiting for the request.
271
+ * According to HTTP specifications:
272
+ * "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."
273
+ */
274
+ REQUEST_TIMEOUT = 408,
275
+ /**
276
+ * Indicates that the request could not be processed because of conflict in the request,
277
+ * such as an edit conflict between multiple simultaneous updates.
278
+ */
279
+ CONFLICT = 409,
280
+ /**
281
+ * Indicates that the resource requested is no longer available and will not be available again.
282
+ * This should be used when a resource has been intentionally removed and the resource should be purged.
283
+ * Upon receiving a 410 status code, the client should not request the resource in the future.
284
+ * Clients such as search engines should remove the resource from their indices.
285
+ * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
286
+ */
287
+ GONE = 410,
288
+ /**
289
+ * The request did not specify the length of its content, which is required by the requested resource.
290
+ */
291
+ LENGTH_REQUIRED = 411,
292
+ /**
293
+ * The server does not meet one of the preconditions that the requester put on the request.
294
+ */
295
+ PRECONDITION_FAILED = 412,
296
+ /**
297
+ * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
298
+ */
299
+ CONTENT_TOO_LARGE = 413,
300
+ /* Excluded from this release type: PAYLOAD_TOO_LARGE */
301
+ /**
302
+ * 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,
303
+ * in which case it should be converted to a POST request.
304
+ * Called "Request-URI Too Long" previously.
305
+ */
306
+ URI_TOO_LONG = 414,
307
+ /**
308
+ * The request entity has a media type which the server or resource does not support.
309
+ * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
310
+ */
311
+ UNSUPPORTED_MEDIA_TYPE = 415,
312
+ /**
313
+ * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
314
+ * For example, if the client asked for a part of the file that lies beyond the end of the file.
315
+ * Called "Requested Range Not Satisfiable" previously.
316
+ */
317
+ RANGE_NOT_SATISFIABLE = 416,
318
+ /**
319
+ * The server cannot meet the requirements of the Expect request-header field.
320
+ */
321
+ EXPECTATION_FAILED = 417,
322
+ /**
323
+ * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
324
+ * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
325
+ * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
326
+ */
327
+ I_AM_A_TEAPOT = 418,
328
+ /**
329
+ * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
330
+ */
331
+ MISDIRECTED_REQUEST = 421,
332
+ /* Excluded from this release type: UNPROCESSABLE_ENTITY */
333
+ /**
334
+ * The request was well-formed but was unable to be followed due to semantic errors.
335
+ */
336
+ UNPROCESSABLE_CONTENT = 422,
337
+ /**
338
+ * The resource that is being accessed is locked.
339
+ */
340
+ LOCKED = 423,
341
+ /**
342
+ * The request failed due to failure of a previous request (e.g., a PROPPATCH).
343
+ */
344
+ FAILED_DEPENDENCY = 424,
345
+ /**
346
+ * The server is unwilling to risk processing a request that might be
347
+ * replayed, which creates the potential for a replay attack.
348
+ */
349
+ TOO_EARLY = 425,
350
+ /**
351
+ * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
352
+ */
353
+ UPGRADE_REQUIRED = 426,
354
+ /**
355
+ * The origin server requires the request to be conditional.
356
+ * Intended to prevent "the 'lost update' problem, where a client
357
+ * GETs a resource's state, modifies it, and PUTs it back to the server,
358
+ * when meanwhile a third party has modified the state on the server, leading to a conflict."
359
+ */
360
+ PRECONDITION_REQUIRED = 428,
361
+ /**
362
+ * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
363
+ */
364
+ TOO_MANY_REQUESTS = 429,
365
+ /**
366
+ * The server is unwilling to process the request because either an individual header field,
367
+ * or all the header fields collectively, are too large.
368
+ */
369
+ REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
370
+ /**
371
+ * A server operator has received a legal demand to deny access to a resource or to a set of resources
372
+ * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
373
+ */
374
+ UNAVAILABLE_FOR_LEGAL_REASONS = 451,
375
+ /**
376
+ * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
377
+ */
378
+ INTERNAL_SERVER_ERROR = 500,
379
+ /**
380
+ * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
381
+ * Usually this implies future availability (e.g., a new feature of a web-service API).
382
+ */
383
+ NOT_IMPLEMENTED = 501,
384
+ /**
385
+ * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
386
+ */
387
+ BAD_GATEWAY = 502,
388
+ /**
389
+ * The server is currently unavailable (because it is overloaded or down for maintenance).
390
+ * Generally, this is a temporary state.
391
+ */
392
+ SERVICE_UNAVAILABLE = 503,
393
+ /**
394
+ * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
395
+ */
396
+ GATEWAY_TIMEOUT = 504,
397
+ /**
398
+ * The server does not support the HTTP protocol version used in the request
399
+ */
400
+ HTTP_VERSION_NOT_SUPPORTED = 505,
401
+ /**
402
+ * Transparent content negotiation for the request results in a circular reference.
403
+ */
404
+ VARIANT_ALSO_NEGOTIATES = 506,
405
+ /**
406
+ * The server is unable to store the representation needed to complete the request.
407
+ */
408
+ INSUFFICIENT_STORAGE = 507,
409
+ /**
410
+ * The server detected an infinite loop while processing the request.
411
+ */
412
+ LOOP_DETECTED = 508,
413
+ /**
414
+ * Further extensions to the request are required for the server to fulfill it.
415
+ */
416
+ NOT_EXTENDED = 510,
417
+ /**
418
+ * The client needs to authenticate to gain network access.
419
+ * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
420
+ * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
421
+ */
422
+ NETWORK_AUTHENTICATION_REQUIRED = 511,
414
423
  }
415
424
 
416
- declare type HttpStatusCodeRangeDefinition = "1XX" | "2XX" | "3XX" | "4XX" | "5XX";
425
+ declare type HttpStatusCodeRangeDefinition =
426
+ | "1XX"
427
+ | "2XX"
428
+ | "3XX"
429
+ | "4XX"
430
+ | "5XX";
417
431
 
418
432
  /**
419
433
  * @public
420
434
  */
421
435
  declare interface IncomingRequestProperties {
422
- /**
423
- * ASN of the incoming request, for example, 395747.
424
- */
425
- readonly asn: number | undefined;
426
- /**
427
- * The organization which owns the ASN of the incoming request,
428
- * for example, Google Cloud.
429
- */
430
- readonly asOrganization: string | undefined;
431
- /**
432
- * City of the incoming request, for example, "Austin".
433
- */
434
- readonly city: string | undefined;
435
- /**
436
- * Continent of the incoming request, for example, "NA".
437
- */
438
- readonly continent: ContinentCode | undefined;
439
- /**
440
- * The two-letter country code in the request.
441
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2|ISO 3166-1 alpha-2}
442
- */
443
- readonly country: Iso3166Alpha2Code | undefined;
444
- /**
445
- * Latitude of the incoming request, for example, "30.27130".
446
- */
447
- readonly latitude: string | undefined;
448
- /**
449
- * Longitude of the incoming request, for example, "-97.74260".
450
- */
451
- readonly longitude: string | undefined;
452
- /**
453
- * The three-letter IATA airport code of the data center that the request hit,
454
- * for example, "DFW".
455
- * @see {@link https://en.wikipedia.org/wiki/IATA_airport_code|IATA airport code}
456
- */
457
- readonly colo: string | undefined;
458
- /**
459
- * Postal code of the incoming request, for example, "78701".
460
- */
461
- readonly postalCode: string | undefined;
462
- /**
463
- * Metro code (DMA) of the incoming request, for example, "635".
464
- */
465
- readonly metroCode: string | undefined;
466
- /**
467
- * If known, the ISO 3166-2 name for the first level region associated with
468
- * the IP address of the incoming request, for example, "Texas".
469
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
470
- */
471
- readonly region: string | undefined;
472
- /**
473
- * If known, the ISO 3166-2 code for the first-level region associated with
474
- * the IP address of the incoming request, for example, "TX".
475
- * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
476
- */
477
- readonly regionCode: string | undefined;
478
- /**
479
- * Timezone of the incoming request, for example, "America/Chicago".
480
- */
481
- readonly timezone: string | undefined;
482
- /**
483
- * If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
484
- */
485
- readonly httpProtocol: string | undefined;
436
+ /**
437
+ * ASN of the incoming request, for example, 395747.
438
+ */
439
+ readonly asn: number | undefined;
440
+ /**
441
+ * The organization which owns the ASN of the incoming request,
442
+ * for example, Google Cloud.
443
+ */
444
+ readonly asOrganization: string | undefined;
445
+ /**
446
+ * City of the incoming request, for example, "Austin".
447
+ */
448
+ readonly city: string | undefined;
449
+ /**
450
+ * Continent of the incoming request, for example, "NA".
451
+ */
452
+ readonly continent: ContinentCode | undefined;
453
+ /**
454
+ * The two-letter country code in the request.
455
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2|ISO 3166-1 alpha-2}
456
+ */
457
+ readonly country: Iso3166Alpha2Code | undefined;
458
+ /**
459
+ * Latitude of the incoming request, for example, "30.27130".
460
+ */
461
+ readonly latitude: string | undefined;
462
+ /**
463
+ * Longitude of the incoming request, for example, "-97.74260".
464
+ */
465
+ readonly longitude: string | undefined;
466
+ /**
467
+ * The three-letter IATA airport code of the data center that the request hit,
468
+ * for example, "DFW".
469
+ * @see {@link https://en.wikipedia.org/wiki/IATA_airport_code|IATA airport code}
470
+ */
471
+ readonly colo: string | undefined;
472
+ /**
473
+ * Postal code of the incoming request, for example, "78701".
474
+ */
475
+ readonly postalCode: string | undefined;
476
+ /**
477
+ * Metro code (DMA) of the incoming request, for example, "635".
478
+ */
479
+ readonly metroCode: string | undefined;
480
+ /**
481
+ * If known, the ISO 3166-2 name for the first level region associated with
482
+ * the IP address of the incoming request, for example, "Texas".
483
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
484
+ */
485
+ readonly region: string | undefined;
486
+ /**
487
+ * If known, the ISO 3166-2 code for the first-level region associated with
488
+ * the IP address of the incoming request, for example, "TX".
489
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
490
+ */
491
+ readonly regionCode: string | undefined;
492
+ /**
493
+ * Timezone of the incoming request, for example, "America/Chicago".
494
+ */
495
+ readonly timezone: string | undefined;
496
+ /**
497
+ * If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
498
+ */
499
+ readonly httpProtocol: string | undefined;
486
500
  }
487
501
 
488
502
  /**
489
503
  * ISO 3166-1 Alpha-2 codes
490
504
  * @public
491
505
  */
492
- 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";
506
+ declare type Iso3166Alpha2Code =
507
+ | "AD"
508
+ | "AE"
509
+ | "AF"
510
+ | "AG"
511
+ | "AI"
512
+ | "AL"
513
+ | "AM"
514
+ | "AO"
515
+ | "AQ"
516
+ | "AR"
517
+ | "AS"
518
+ | "AT"
519
+ | "AU"
520
+ | "AW"
521
+ | "AX"
522
+ | "AZ"
523
+ | "BA"
524
+ | "BB"
525
+ | "BD"
526
+ | "BE"
527
+ | "BF"
528
+ | "BG"
529
+ | "BH"
530
+ | "BI"
531
+ | "BJ"
532
+ | "BL"
533
+ | "BM"
534
+ | "BN"
535
+ | "BO"
536
+ | "BQ"
537
+ | "BR"
538
+ | "BS"
539
+ | "BT"
540
+ | "BV"
541
+ | "BW"
542
+ | "BY"
543
+ | "BZ"
544
+ | "CA"
545
+ | "CC"
546
+ | "CD"
547
+ | "CF"
548
+ | "CG"
549
+ | "CH"
550
+ | "CI"
551
+ | "CK"
552
+ | "CL"
553
+ | "CM"
554
+ | "CN"
555
+ | "CO"
556
+ | "CR"
557
+ | "CU"
558
+ | "CV"
559
+ | "CW"
560
+ | "CX"
561
+ | "CY"
562
+ | "CZ"
563
+ | "DE"
564
+ | "DJ"
565
+ | "DK"
566
+ | "DM"
567
+ | "DO"
568
+ | "DZ"
569
+ | "EC"
570
+ | "EE"
571
+ | "EG"
572
+ | "EH"
573
+ | "ER"
574
+ | "ES"
575
+ | "ET"
576
+ | "FI"
577
+ | "FJ"
578
+ | "FK"
579
+ | "FM"
580
+ | "FO"
581
+ | "FR"
582
+ | "GA"
583
+ | "GB"
584
+ | "GD"
585
+ | "GE"
586
+ | "GF"
587
+ | "GG"
588
+ | "GH"
589
+ | "GI"
590
+ | "GL"
591
+ | "GM"
592
+ | "GN"
593
+ | "GP"
594
+ | "GQ"
595
+ | "GR"
596
+ | "GS"
597
+ | "GT"
598
+ | "GU"
599
+ | "GW"
600
+ | "GY"
601
+ | "HK"
602
+ | "HM"
603
+ | "HN"
604
+ | "HR"
605
+ | "HT"
606
+ | "HU"
607
+ | "ID"
608
+ | "IE"
609
+ | "IL"
610
+ | "IM"
611
+ | "IN"
612
+ | "IO"
613
+ | "IQ"
614
+ | "IR"
615
+ | "IS"
616
+ | "IT"
617
+ | "JE"
618
+ | "JM"
619
+ | "JO"
620
+ | "JP"
621
+ | "KE"
622
+ | "KG"
623
+ | "KH"
624
+ | "KI"
625
+ | "KM"
626
+ | "KN"
627
+ | "KP"
628
+ | "KR"
629
+ | "KW"
630
+ | "KY"
631
+ | "KZ"
632
+ | "LA"
633
+ | "LB"
634
+ | "LC"
635
+ | "LI"
636
+ | "LK"
637
+ | "LR"
638
+ | "LS"
639
+ | "LT"
640
+ | "LU"
641
+ | "LV"
642
+ | "LY"
643
+ | "MA"
644
+ | "MC"
645
+ | "MD"
646
+ | "ME"
647
+ | "MF"
648
+ | "MG"
649
+ | "MH"
650
+ | "MK"
651
+ | "ML"
652
+ | "MM"
653
+ | "MN"
654
+ | "MO"
655
+ | "MP"
656
+ | "MQ"
657
+ | "MR"
658
+ | "MS"
659
+ | "MT"
660
+ | "MU"
661
+ | "MV"
662
+ | "MW"
663
+ | "MX"
664
+ | "MY"
665
+ | "MZ"
666
+ | "NA"
667
+ | "NC"
668
+ | "NE"
669
+ | "NF"
670
+ | "NG"
671
+ | "NI"
672
+ | "NL"
673
+ | "NO"
674
+ | "NP"
675
+ | "NR"
676
+ | "NU"
677
+ | "NZ"
678
+ | "OM"
679
+ | "PA"
680
+ | "PE"
681
+ | "PF"
682
+ | "PG"
683
+ | "PH"
684
+ | "PK"
685
+ | "PL"
686
+ | "PM"
687
+ | "PN"
688
+ | "PR"
689
+ | "PS"
690
+ | "PT"
691
+ | "PW"
692
+ | "PY"
693
+ | "QA"
694
+ | "RE"
695
+ | "RO"
696
+ | "RS"
697
+ | "RU"
698
+ | "RW"
699
+ | "SA"
700
+ | "SB"
701
+ | "SC"
702
+ | "SD"
703
+ | "SE"
704
+ | "SG"
705
+ | "SH"
706
+ | "SI"
707
+ | "SJ"
708
+ | "SK"
709
+ | "SL"
710
+ | "SM"
711
+ | "SN"
712
+ | "SO"
713
+ | "SR"
714
+ | "SS"
715
+ | "ST"
716
+ | "SV"
717
+ | "SX"
718
+ | "SY"
719
+ | "SZ"
720
+ | "TC"
721
+ | "TD"
722
+ | "TF"
723
+ | "TG"
724
+ | "TH"
725
+ | "TJ"
726
+ | "TK"
727
+ | "TL"
728
+ | "TM"
729
+ | "TN"
730
+ | "TO"
731
+ | "TR"
732
+ | "TT"
733
+ | "TV"
734
+ | "TW"
735
+ | "TZ"
736
+ | "UA"
737
+ | "UG"
738
+ | "UM"
739
+ | "US"
740
+ | "UY"
741
+ | "UZ"
742
+ | "VA"
743
+ | "VC"
744
+ | "VE"
745
+ | "VG"
746
+ | "VI"
747
+ | "VN"
748
+ | "VU"
749
+ | "WF"
750
+ | "WS"
751
+ | "YE"
752
+ | "YT"
753
+ | "ZA"
754
+ | "ZM"
755
+ | "ZW";
493
756
 
494
757
  /**
495
758
  * @beta
496
759
  */
497
760
  declare interface Logger {
498
- debug(...messages: unknown[]): void;
499
- info(...messages: unknown[]): void;
500
- log(...messages: unknown[]): void;
501
- warn(...messages: unknown[]): void;
502
- error(...messages: unknown[]): void;
761
+ debug(...messages: unknown[]): void;
762
+ info(...messages: unknown[]): void;
763
+ log(...messages: unknown[]): void;
764
+ warn(...messages: unknown[]): void;
765
+ error(...messages: unknown[]): void;
503
766
  }
504
767
 
505
768
  /**
506
769
  * Mock implementation of ZuploContext for testing
507
770
  * @public
508
771
  */
509
- export declare class MockZuploContext extends EventTarget implements ZuploContext {
510
- #private;
511
- readonly contextId: string;
512
- readonly requestId: string;
513
- readonly log: Logger;
514
- readonly route: RouteConfiguration;
515
- readonly custom: Record<string, any>;
516
- readonly incomingRequestProperties: IncomingRequestProperties;
517
- readonly parentContext: ZuploContext | undefined;
518
- constructor({ event, route, parentContext, }: {
519
- event: ZuploEventContext;
520
- route?: RouteConfiguration;
521
- parentContext?: ZuploContext | undefined;
522
- });
523
- waitUntil(promise: Promise<any>): void;
524
- invokeInboundPolicy(policyName: string, request: ZuploRequest): Promise<ZuploRequest | Response>;
525
- invokeOutboundPolicy(policyName: string, response: Response, request: ZuploRequest): Promise<Response>;
526
- invokeRoute<TOptions extends RequestGeneric = RequestGeneric>(input: string | URL | Request, init?: ZuploRequestInit<TOptions>): Promise<Response>;
527
- /**
528
- * Fires just before the response is sent. Response can be modified.
529
- */
530
- addResponseSendingHook(hook: OnResponseSendingHook): void;
531
- /**
532
- * Fires immediately after the response is sent. Response cannot be modified.
533
- */
534
- addResponseSendingFinalHook(hook: OnResponseSendingFinalHook): void;
535
- addEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
772
+ export declare class MockZuploContext
773
+ extends EventTarget
774
+ implements ZuploContext
775
+ {
776
+ #private;
777
+ readonly contextId: string;
778
+ readonly requestId: string;
779
+ readonly log: Logger;
780
+ readonly route: RouteConfiguration;
781
+ readonly custom: Record<string, any>;
782
+ readonly incomingRequestProperties: IncomingRequestProperties;
783
+ readonly parentContext: ZuploContext | undefined;
784
+ constructor({
785
+ event,
786
+ route,
787
+ parentContext,
788
+ }: {
789
+ event: ZuploEventContext;
790
+ route?: RouteConfiguration;
791
+ parentContext?: ZuploContext | undefined;
792
+ });
793
+ waitUntil(promise: Promise<any>): void;
794
+ invokeInboundPolicy(
795
+ policyName: string,
796
+ request: ZuploRequest
797
+ ): Promise<ZuploRequest | Response>;
798
+ invokeOutboundPolicy(
799
+ policyName: string,
800
+ response: Response,
801
+ request: ZuploRequest
802
+ ): Promise<Response>;
803
+ invokeRoute<TOptions extends RequestGeneric = RequestGeneric>(
804
+ input: string | URL | Request,
805
+ init?: ZuploRequestInit<TOptions>
806
+ ): Promise<Response>;
807
+ /**
808
+ * Fires just before the response is sent. Response can be modified.
809
+ */
810
+ addResponseSendingHook(hook: OnResponseSendingHook): void;
811
+ /**
812
+ * Fires immediately after the response is sent. Response cannot be modified.
813
+ */
814
+ addResponseSendingFinalHook(hook: OnResponseSendingFinalHook): void;
815
+ addEventListener<Type extends keyof Record<string, Event>>(
816
+ type: Type,
817
+ handler: EventListenerOrEventListenerObject,
818
+ options?: AddEventListenerOptions | boolean
819
+ ): void;
536
820
  }
537
821
 
538
822
  declare type Modify<T, R> = Omit<T, keyof R> & R;
@@ -541,493 +825,581 @@ declare type Modify<T, R> = Omit<T, keyof R> & R;
541
825
  * @public
542
826
  */
543
827
  declare interface OnResponseSendingFinalHook {
544
- (response: Response, request: ZuploRequest, context: ZuploContext): Promise<void> | void;
828
+ (
829
+ response: Response,
830
+ request: ZuploRequest,
831
+ context: ZuploContext
832
+ ): Promise<void> | void;
545
833
  }
546
834
 
547
835
  /**
548
836
  * @public
549
837
  */
550
838
  declare interface OnResponseSendingHook {
551
- (response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
839
+ (
840
+ response: Response,
841
+ request: ZuploRequest,
842
+ context: ZuploContext
843
+ ): Promise<Response> | Response;
552
844
  }
553
845
 
554
846
  declare namespace OpenAPIV3 {
555
- interface Document<T extends {} = {}> {
556
- openapi: string;
557
- info: InfoObject;
558
- servers?: ServerObject[];
559
- paths: PathsObject<T>;
560
- components?: ComponentsObject;
561
- security?: SecurityRequirementObject[];
562
- tags?: TagObject[];
563
- externalDocs?: ExternalDocumentationObject;
564
- 'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
565
- 'x-express-openapi-validation-strict'?: boolean;
566
- }
567
- interface InfoObject {
568
- title: string;
569
- description?: string;
570
- termsOfService?: string;
571
- contact?: ContactObject;
572
- license?: LicenseObject;
573
- version: string;
574
- }
575
- interface ContactObject {
576
- name?: string;
577
- url?: string;
578
- email?: string;
579
- }
580
- interface LicenseObject {
581
- name: string;
582
- url?: string;
583
- }
584
- interface ServerObject {
585
- url: string;
586
- description?: string;
587
- variables?: {
588
- [variable: string]: ServerVariableObject;
589
- };
590
- }
591
- interface ServerVariableObject {
592
- enum?: string[];
593
- default: string;
594
- description?: string;
595
- }
596
- interface PathsObject<T extends {} = {}, P extends {} = {}> {
597
- [pattern: string]: (PathItemObject<T> & P) | undefined;
598
- }
599
- enum HttpMethods {
600
- GET = "get",
601
- PUT = "put",
602
- POST = "post",
603
- DELETE = "delete",
604
- OPTIONS = "options",
605
- HEAD = "head",
606
- PATCH = "patch",
607
- TRACE = "trace"
608
- }
609
- type PathItemObject<T extends {} = {}> = {
610
- $ref?: string;
611
- summary?: string;
612
- description?: string;
613
- servers?: ServerObject[];
614
- parameters?: (ReferenceObject | ParameterObject)[];
615
- } & {
616
- [method in HttpMethods]?: OperationObject<T>;
847
+ interface Document<T extends {} = {}> {
848
+ openapi: string;
849
+ info: InfoObject;
850
+ servers?: ServerObject[];
851
+ paths: PathsObject<T>;
852
+ components?: ComponentsObject;
853
+ security?: SecurityRequirementObject[];
854
+ tags?: TagObject[];
855
+ externalDocs?: ExternalDocumentationObject;
856
+ "x-express-openapi-additional-middleware"?: (
857
+ | ((request: any, response: any, next: any) => Promise<void>)
858
+ | ((request: any, response: any, next: any) => void)
859
+ )[];
860
+ "x-express-openapi-validation-strict"?: boolean;
861
+ }
862
+ interface InfoObject {
863
+ title: string;
864
+ description?: string;
865
+ termsOfService?: string;
866
+ contact?: ContactObject;
867
+ license?: LicenseObject;
868
+ version: string;
869
+ }
870
+ interface ContactObject {
871
+ name?: string;
872
+ url?: string;
873
+ email?: string;
874
+ }
875
+ interface LicenseObject {
876
+ name: string;
877
+ url?: string;
878
+ }
879
+ interface ServerObject {
880
+ url: string;
881
+ description?: string;
882
+ variables?: {
883
+ [variable: string]: ServerVariableObject;
617
884
  };
618
- type OperationObject<T extends {} = {}> = {
619
- tags?: string[];
620
- summary?: string;
621
- description?: string;
622
- externalDocs?: ExternalDocumentationObject;
623
- operationId?: string;
624
- parameters?: (ReferenceObject | ParameterObject)[];
625
- requestBody?: ReferenceObject | RequestBodyObject;
626
- responses: ResponsesObject;
627
- callbacks?: {
628
- [callback: string]: ReferenceObject | CallbackObject;
629
- };
630
- deprecated?: boolean;
631
- security?: SecurityRequirementObject[];
632
- servers?: ServerObject[];
633
- } & T;
634
- interface ExternalDocumentationObject {
635
- description?: string;
636
- url: string;
637
- }
638
- interface ParameterObject extends ParameterBaseObject {
639
- name: string;
640
- in: string;
641
- }
642
- interface HeaderObject extends ParameterBaseObject {
643
- }
644
- interface ParameterBaseObject {
645
- description?: string;
646
- required?: boolean;
647
- deprecated?: boolean;
648
- allowEmptyValue?: boolean;
649
- style?: string;
650
- explode?: boolean;
651
- allowReserved?: boolean;
652
- schema?: ReferenceObject | SchemaObject;
653
- example?: any;
654
- examples?: {
655
- [media: string]: ReferenceObject | ExampleObject;
656
- };
657
- content?: {
658
- [media: string]: MediaTypeObject;
659
- };
660
- }
661
- type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
662
- type ArraySchemaObjectType = 'array';
663
- type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
664
- interface ArraySchemaObject extends BaseSchemaObject {
665
- type: ArraySchemaObjectType;
666
- items: ReferenceObject | SchemaObject;
667
- }
668
- interface NonArraySchemaObject extends BaseSchemaObject {
669
- type?: NonArraySchemaObjectType;
670
- }
671
- interface BaseSchemaObject {
672
- title?: string;
673
- description?: string;
674
- format?: string;
675
- default?: any;
676
- multipleOf?: number;
677
- maximum?: number;
678
- exclusiveMaximum?: boolean;
679
- minimum?: number;
680
- exclusiveMinimum?: boolean;
681
- maxLength?: number;
682
- minLength?: number;
683
- pattern?: string;
684
- additionalProperties?: boolean | ReferenceObject | SchemaObject;
685
- maxItems?: number;
686
- minItems?: number;
687
- uniqueItems?: boolean;
688
- maxProperties?: number;
689
- minProperties?: number;
690
- required?: string[];
691
- enum?: any[];
692
- properties?: {
693
- [name: string]: ReferenceObject | SchemaObject;
694
- };
695
- allOf?: (ReferenceObject | SchemaObject)[];
696
- oneOf?: (ReferenceObject | SchemaObject)[];
697
- anyOf?: (ReferenceObject | SchemaObject)[];
698
- not?: ReferenceObject | SchemaObject;
699
- nullable?: boolean;
700
- discriminator?: DiscriminatorObject;
701
- readOnly?: boolean;
702
- writeOnly?: boolean;
703
- xml?: XMLObject;
704
- externalDocs?: ExternalDocumentationObject;
705
- example?: any;
706
- deprecated?: boolean;
707
- }
708
- interface DiscriminatorObject {
709
- propertyName: string;
710
- mapping?: {
711
- [value: string]: string;
712
- };
713
- }
714
- interface XMLObject {
715
- name?: string;
716
- namespace?: string;
717
- prefix?: string;
718
- attribute?: boolean;
719
- wrapped?: boolean;
720
- }
721
- interface ReferenceObject {
722
- $ref: string;
723
- }
724
- interface ExampleObject {
725
- summary?: string;
726
- description?: string;
727
- value?: any;
728
- externalValue?: string;
729
- }
730
- interface MediaTypeObject {
731
- schema?: ReferenceObject | SchemaObject;
732
- example?: any;
733
- examples?: {
734
- [media: string]: ReferenceObject | ExampleObject;
735
- };
736
- encoding?: {
737
- [media: string]: EncodingObject;
738
- };
739
- }
740
- interface EncodingObject {
741
- contentType?: string;
742
- headers?: {
743
- [header: string]: ReferenceObject | HeaderObject;
744
- };
745
- style?: string;
746
- explode?: boolean;
747
- allowReserved?: boolean;
748
- }
749
- interface RequestBodyObject {
750
- description?: string;
751
- content: {
752
- [media: string]: MediaTypeObject;
885
+ }
886
+ interface ServerVariableObject {
887
+ enum?: string[];
888
+ default: string;
889
+ description?: string;
890
+ }
891
+ interface PathsObject<T extends {} = {}, P extends {} = {}> {
892
+ [pattern: string]: (PathItemObject<T> & P) | undefined;
893
+ }
894
+ enum HttpMethods {
895
+ GET = "get",
896
+ PUT = "put",
897
+ POST = "post",
898
+ DELETE = "delete",
899
+ OPTIONS = "options",
900
+ HEAD = "head",
901
+ PATCH = "patch",
902
+ TRACE = "trace",
903
+ }
904
+ type PathItemObject<T extends {} = {}> = {
905
+ $ref?: string;
906
+ summary?: string;
907
+ description?: string;
908
+ servers?: ServerObject[];
909
+ parameters?: (ReferenceObject | ParameterObject)[];
910
+ } & {
911
+ [method in HttpMethods]?: OperationObject<T>;
912
+ };
913
+ type OperationObject<T extends {} = {}> = {
914
+ tags?: string[];
915
+ summary?: string;
916
+ description?: string;
917
+ externalDocs?: ExternalDocumentationObject;
918
+ operationId?: string;
919
+ parameters?: (ReferenceObject | ParameterObject)[];
920
+ requestBody?: ReferenceObject | RequestBodyObject;
921
+ responses: ResponsesObject;
922
+ callbacks?: {
923
+ [callback: string]: ReferenceObject | CallbackObject;
924
+ };
925
+ deprecated?: boolean;
926
+ security?: SecurityRequirementObject[];
927
+ servers?: ServerObject[];
928
+ } & T;
929
+ interface ExternalDocumentationObject {
930
+ description?: string;
931
+ url: string;
932
+ }
933
+ interface ParameterObject extends ParameterBaseObject {
934
+ name: string;
935
+ in: string;
936
+ }
937
+ interface HeaderObject extends ParameterBaseObject {}
938
+ interface ParameterBaseObject {
939
+ description?: string;
940
+ required?: boolean;
941
+ deprecated?: boolean;
942
+ allowEmptyValue?: boolean;
943
+ style?: string;
944
+ explode?: boolean;
945
+ allowReserved?: boolean;
946
+ schema?: ReferenceObject | SchemaObject;
947
+ example?: any;
948
+ examples?: {
949
+ [media: string]: ReferenceObject | ExampleObject;
950
+ };
951
+ content?: {
952
+ [media: string]: MediaTypeObject;
953
+ };
954
+ }
955
+ type NonArraySchemaObjectType =
956
+ | "boolean"
957
+ | "object"
958
+ | "number"
959
+ | "string"
960
+ | "integer";
961
+ type ArraySchemaObjectType = "array";
962
+ type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
963
+ interface ArraySchemaObject extends BaseSchemaObject {
964
+ type: ArraySchemaObjectType;
965
+ items: ReferenceObject | SchemaObject;
966
+ }
967
+ interface NonArraySchemaObject extends BaseSchemaObject {
968
+ type?: NonArraySchemaObjectType;
969
+ }
970
+ interface BaseSchemaObject {
971
+ title?: string;
972
+ description?: string;
973
+ format?: string;
974
+ default?: any;
975
+ multipleOf?: number;
976
+ maximum?: number;
977
+ exclusiveMaximum?: boolean;
978
+ minimum?: number;
979
+ exclusiveMinimum?: boolean;
980
+ maxLength?: number;
981
+ minLength?: number;
982
+ pattern?: string;
983
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
984
+ maxItems?: number;
985
+ minItems?: number;
986
+ uniqueItems?: boolean;
987
+ maxProperties?: number;
988
+ minProperties?: number;
989
+ required?: string[];
990
+ enum?: any[];
991
+ properties?: {
992
+ [name: string]: ReferenceObject | SchemaObject;
993
+ };
994
+ allOf?: (ReferenceObject | SchemaObject)[];
995
+ oneOf?: (ReferenceObject | SchemaObject)[];
996
+ anyOf?: (ReferenceObject | SchemaObject)[];
997
+ not?: ReferenceObject | SchemaObject;
998
+ nullable?: boolean;
999
+ discriminator?: DiscriminatorObject;
1000
+ readOnly?: boolean;
1001
+ writeOnly?: boolean;
1002
+ xml?: XMLObject;
1003
+ externalDocs?: ExternalDocumentationObject;
1004
+ example?: any;
1005
+ deprecated?: boolean;
1006
+ }
1007
+ interface DiscriminatorObject {
1008
+ propertyName: string;
1009
+ mapping?: {
1010
+ [value: string]: string;
1011
+ };
1012
+ }
1013
+ interface XMLObject {
1014
+ name?: string;
1015
+ namespace?: string;
1016
+ prefix?: string;
1017
+ attribute?: boolean;
1018
+ wrapped?: boolean;
1019
+ }
1020
+ interface ReferenceObject {
1021
+ $ref: string;
1022
+ }
1023
+ interface ExampleObject {
1024
+ summary?: string;
1025
+ description?: string;
1026
+ value?: any;
1027
+ externalValue?: string;
1028
+ }
1029
+ interface MediaTypeObject {
1030
+ schema?: ReferenceObject | SchemaObject;
1031
+ example?: any;
1032
+ examples?: {
1033
+ [media: string]: ReferenceObject | ExampleObject;
1034
+ };
1035
+ encoding?: {
1036
+ [media: string]: EncodingObject;
1037
+ };
1038
+ }
1039
+ interface EncodingObject {
1040
+ contentType?: string;
1041
+ headers?: {
1042
+ [header: string]: ReferenceObject | HeaderObject;
1043
+ };
1044
+ style?: string;
1045
+ explode?: boolean;
1046
+ allowReserved?: boolean;
1047
+ }
1048
+ interface RequestBodyObject {
1049
+ description?: string;
1050
+ content: {
1051
+ [media: string]: MediaTypeObject;
1052
+ };
1053
+ required?: boolean;
1054
+ }
1055
+ interface ResponsesObject {
1056
+ [code: string]: ReferenceObject | ResponseObject;
1057
+ }
1058
+ interface ResponseObject {
1059
+ description: string;
1060
+ headers?: {
1061
+ [header: string]: ReferenceObject | HeaderObject;
1062
+ };
1063
+ content?: {
1064
+ [media: string]: MediaTypeObject;
1065
+ };
1066
+ links?: {
1067
+ [link: string]: ReferenceObject | LinkObject;
1068
+ };
1069
+ }
1070
+ interface LinkObject {
1071
+ operationRef?: string;
1072
+ operationId?: string;
1073
+ parameters?: {
1074
+ [parameter: string]: any;
1075
+ };
1076
+ requestBody?: any;
1077
+ description?: string;
1078
+ server?: ServerObject;
1079
+ }
1080
+ interface CallbackObject {
1081
+ [url: string]: PathItemObject;
1082
+ }
1083
+ interface SecurityRequirementObject {
1084
+ [name: string]: string[];
1085
+ }
1086
+ interface ComponentsObject {
1087
+ schemas?: {
1088
+ [key: string]: ReferenceObject | SchemaObject;
1089
+ };
1090
+ responses?: {
1091
+ [key: string]: ReferenceObject | ResponseObject;
1092
+ };
1093
+ parameters?: {
1094
+ [key: string]: ReferenceObject | ParameterObject;
1095
+ };
1096
+ examples?: {
1097
+ [key: string]: ReferenceObject | ExampleObject;
1098
+ };
1099
+ requestBodies?: {
1100
+ [key: string]: ReferenceObject | RequestBodyObject;
1101
+ };
1102
+ headers?: {
1103
+ [key: string]: ReferenceObject | HeaderObject;
1104
+ };
1105
+ securitySchemes?: {
1106
+ [key: string]: ReferenceObject | SecuritySchemeObject;
1107
+ };
1108
+ links?: {
1109
+ [key: string]: ReferenceObject | LinkObject;
1110
+ };
1111
+ callbacks?: {
1112
+ [key: string]: ReferenceObject | CallbackObject;
1113
+ };
1114
+ }
1115
+ type SecuritySchemeObject =
1116
+ | HttpSecurityScheme
1117
+ | ApiKeySecurityScheme
1118
+ | OAuth2SecurityScheme
1119
+ | OpenIdSecurityScheme;
1120
+ interface HttpSecurityScheme {
1121
+ type: "http";
1122
+ description?: string;
1123
+ scheme: string;
1124
+ bearerFormat?: string;
1125
+ }
1126
+ interface ApiKeySecurityScheme {
1127
+ type: "apiKey";
1128
+ description?: string;
1129
+ name: string;
1130
+ in: string;
1131
+ }
1132
+ interface OAuth2SecurityScheme {
1133
+ type: "oauth2";
1134
+ description?: string;
1135
+ flows: {
1136
+ implicit?: {
1137
+ authorizationUrl: string;
1138
+ refreshUrl?: string;
1139
+ scopes: {
1140
+ [scope: string]: string;
753
1141
  };
754
- required?: boolean;
755
- }
756
- interface ResponsesObject {
757
- [code: string]: ReferenceObject | ResponseObject;
758
- }
759
- interface ResponseObject {
760
- description: string;
761
- headers?: {
762
- [header: string]: ReferenceObject | HeaderObject;
1142
+ };
1143
+ password?: {
1144
+ tokenUrl: string;
1145
+ refreshUrl?: string;
1146
+ scopes: {
1147
+ [scope: string]: string;
763
1148
  };
764
- content?: {
765
- [media: string]: MediaTypeObject;
1149
+ };
1150
+ clientCredentials?: {
1151
+ tokenUrl: string;
1152
+ refreshUrl?: string;
1153
+ scopes: {
1154
+ [scope: string]: string;
766
1155
  };
767
- links?: {
768
- [link: string]: ReferenceObject | LinkObject;
1156
+ };
1157
+ authorizationCode?: {
1158
+ authorizationUrl: string;
1159
+ tokenUrl: string;
1160
+ refreshUrl?: string;
1161
+ scopes: {
1162
+ [scope: string]: string;
769
1163
  };
1164
+ };
1165
+ };
1166
+ }
1167
+ interface OpenIdSecurityScheme {
1168
+ type: "openIdConnect";
1169
+ description?: string;
1170
+ openIdConnectUrl: string;
1171
+ }
1172
+ interface TagObject {
1173
+ name: string;
1174
+ description?: string;
1175
+ externalDocs?: ExternalDocumentationObject;
1176
+ }
1177
+ }
1178
+
1179
+ declare namespace OpenAPIV3_1 {
1180
+ type Modify<T, R> = Omit<T, keyof R> & R;
1181
+ type PathsWebhooksComponents<T extends {} = {}> = {
1182
+ paths: PathsObject<T>;
1183
+ webhooks: Record<string, PathItemObject | ReferenceObject>;
1184
+ components: ComponentsObject;
1185
+ };
1186
+ type Document<T extends {} = {}> = Modify<
1187
+ Omit<OpenAPIV3.Document<T>, "paths" | "components">,
1188
+ {
1189
+ info: InfoObject;
1190
+ jsonSchemaDialect?: string;
1191
+ servers?: ServerObject[];
1192
+ } & (
1193
+ | (Pick<PathsWebhooksComponents<T>, "paths"> &
1194
+ Omit<Partial<PathsWebhooksComponents<T>>, "paths">)
1195
+ | (Pick<PathsWebhooksComponents<T>, "webhooks"> &
1196
+ Omit<Partial<PathsWebhooksComponents<T>>, "webhooks">)
1197
+ | (Pick<PathsWebhooksComponents<T>, "components"> &
1198
+ Omit<Partial<PathsWebhooksComponents<T>>, "components">)
1199
+ )
1200
+ >;
1201
+ type InfoObject = Modify<
1202
+ OpenAPIV3.InfoObject,
1203
+ {
1204
+ summary?: string;
1205
+ license?: LicenseObject;
770
1206
  }
771
- interface LinkObject {
772
- operationRef?: string;
773
- operationId?: string;
774
- parameters?: {
775
- [parameter: string]: any;
776
- };
777
- requestBody?: any;
778
- description?: string;
779
- server?: ServerObject;
1207
+ >;
1208
+ type ContactObject = OpenAPIV3.ContactObject;
1209
+ type LicenseObject = Modify<
1210
+ OpenAPIV3.LicenseObject,
1211
+ {
1212
+ identifier?: string;
780
1213
  }
781
- interface CallbackObject {
782
- [url: string]: PathItemObject;
1214
+ >;
1215
+ type ServerObject = Modify<
1216
+ OpenAPIV3.ServerObject,
1217
+ {
1218
+ url: string;
1219
+ description?: string;
1220
+ variables?: Record<string, ServerVariableObject>;
783
1221
  }
784
- interface SecurityRequirementObject {
785
- [name: string]: string[];
1222
+ >;
1223
+ type ServerVariableObject = Modify<
1224
+ OpenAPIV3.ServerVariableObject,
1225
+ {
1226
+ enum?: [string, ...string[]];
786
1227
  }
787
- interface ComponentsObject {
788
- schemas?: {
789
- [key: string]: ReferenceObject | SchemaObject;
790
- };
791
- responses?: {
792
- [key: string]: ReferenceObject | ResponseObject;
793
- };
794
- parameters?: {
795
- [key: string]: ReferenceObject | ParameterObject;
796
- };
797
- examples?: {
798
- [key: string]: ReferenceObject | ExampleObject;
799
- };
800
- requestBodies?: {
801
- [key: string]: ReferenceObject | RequestBodyObject;
802
- };
803
- headers?: {
804
- [key: string]: ReferenceObject | HeaderObject;
805
- };
806
- securitySchemes?: {
807
- [key: string]: ReferenceObject | SecuritySchemeObject;
808
- };
809
- links?: {
810
- [key: string]: ReferenceObject | LinkObject;
811
- };
812
- callbacks?: {
813
- [key: string]: ReferenceObject | CallbackObject;
814
- };
1228
+ >;
1229
+ type PathsObject<T extends {} = {}, P extends {} = {}> = Record<
1230
+ string,
1231
+ (PathItemObject<T> & P) | undefined
1232
+ >;
1233
+ type HttpMethods = OpenAPIV3.HttpMethods;
1234
+ type PathItemObject<T extends {} = {}> = Modify<
1235
+ OpenAPIV3.PathItemObject<T>,
1236
+ {
1237
+ servers?: ServerObject[];
1238
+ parameters?: (ReferenceObject | ParameterObject)[];
815
1239
  }
816
- type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
817
- interface HttpSecurityScheme {
818
- type: 'http';
819
- description?: string;
820
- scheme: string;
821
- bearerFormat?: string;
1240
+ > & {
1241
+ [method in HttpMethods]?: OperationObject<T>;
1242
+ };
1243
+ type OperationObject<T extends {} = {}> = Modify<
1244
+ OpenAPIV3.OperationObject<T>,
1245
+ {
1246
+ parameters?: (ReferenceObject | ParameterObject)[];
1247
+ requestBody?: ReferenceObject | RequestBodyObject;
1248
+ responses?: ResponsesObject;
1249
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
1250
+ servers?: ServerObject[];
822
1251
  }
823
- interface ApiKeySecurityScheme {
824
- type: 'apiKey';
825
- description?: string;
826
- name: string;
827
- in: string;
1252
+ > &
1253
+ T;
1254
+ type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
1255
+ type ParameterObject = OpenAPIV3.ParameterObject;
1256
+ type HeaderObject = OpenAPIV3.HeaderObject;
1257
+ type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
1258
+ type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | "null";
1259
+ type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
1260
+ /**
1261
+ * There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
1262
+ * 'items' will be always visible as optional
1263
+ * Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
1264
+ */
1265
+ type SchemaObject =
1266
+ | ArraySchemaObject
1267
+ | NonArraySchemaObject
1268
+ | MixedSchemaObject;
1269
+ interface ArraySchemaObject extends BaseSchemaObject {
1270
+ type: ArraySchemaObjectType;
1271
+ items: ReferenceObject | SchemaObject;
1272
+ }
1273
+ interface NonArraySchemaObject extends BaseSchemaObject {
1274
+ type?: NonArraySchemaObjectType;
1275
+ }
1276
+ interface MixedSchemaObject extends BaseSchemaObject {
1277
+ type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
1278
+ items?: ReferenceObject | SchemaObject;
1279
+ }
1280
+ type BaseSchemaObject = Modify<
1281
+ Omit<OpenAPIV3.BaseSchemaObject, "nullable">,
1282
+ {
1283
+ examples?: OpenAPIV3.BaseSchemaObject["example"][];
1284
+ exclusiveMinimum?: boolean | number;
1285
+ exclusiveMaximum?: boolean | number;
1286
+ contentMediaType?: string;
1287
+ $schema?: string;
1288
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
1289
+ properties?: {
1290
+ [name: string]: ReferenceObject | SchemaObject;
1291
+ };
1292
+ allOf?: (ReferenceObject | SchemaObject)[];
1293
+ oneOf?: (ReferenceObject | SchemaObject)[];
1294
+ anyOf?: (ReferenceObject | SchemaObject)[];
1295
+ not?: ReferenceObject | SchemaObject;
1296
+ discriminator?: DiscriminatorObject;
1297
+ externalDocs?: ExternalDocumentationObject;
1298
+ xml?: XMLObject;
1299
+ const?: any;
828
1300
  }
829
- interface OAuth2SecurityScheme {
830
- type: 'oauth2';
831
- description?: string;
832
- flows: {
833
- implicit?: {
834
- authorizationUrl: string;
835
- refreshUrl?: string;
836
- scopes: {
837
- [scope: string]: string;
838
- };
839
- };
840
- password?: {
841
- tokenUrl: string;
842
- refreshUrl?: string;
843
- scopes: {
844
- [scope: string]: string;
845
- };
846
- };
847
- clientCredentials?: {
848
- tokenUrl: string;
849
- refreshUrl?: string;
850
- scopes: {
851
- [scope: string]: string;
852
- };
853
- };
854
- authorizationCode?: {
855
- authorizationUrl: string;
856
- tokenUrl: string;
857
- refreshUrl?: string;
858
- scopes: {
859
- [scope: string]: string;
860
- };
861
- };
862
- };
1301
+ >;
1302
+ type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
1303
+ type XMLObject = OpenAPIV3.XMLObject;
1304
+ type ReferenceObject = Modify<
1305
+ OpenAPIV3.ReferenceObject,
1306
+ {
1307
+ summary?: string;
1308
+ description?: string;
863
1309
  }
864
- interface OpenIdSecurityScheme {
865
- type: 'openIdConnect';
866
- description?: string;
867
- openIdConnectUrl: string;
1310
+ >;
1311
+ type ExampleObject = OpenAPIV3.ExampleObject;
1312
+ type MediaTypeObject = Modify<
1313
+ OpenAPIV3.MediaTypeObject,
1314
+ {
1315
+ schema?: SchemaObject | ReferenceObject;
1316
+ examples?: Record<string, ReferenceObject | ExampleObject>;
868
1317
  }
869
- interface TagObject {
870
- name: string;
871
- description?: string;
872
- externalDocs?: ExternalDocumentationObject;
1318
+ >;
1319
+ type EncodingObject = OpenAPIV3.EncodingObject;
1320
+ type RequestBodyObject = Modify<
1321
+ OpenAPIV3.RequestBodyObject,
1322
+ {
1323
+ content: {
1324
+ [media: string]: MediaTypeObject;
1325
+ };
873
1326
  }
874
- }
875
-
876
- declare namespace OpenAPIV3_1 {
877
- type Modify<T, R> = Omit<T, keyof R> & R;
878
- type PathsWebhooksComponents<T extends {} = {}> = {
879
- paths: PathsObject<T>;
880
- webhooks: Record<string, PathItemObject | ReferenceObject>;
881
- components: ComponentsObject;
882
- };
883
- type Document<T extends {} = {}> = Modify<Omit<OpenAPIV3.Document<T>, 'paths' | 'components'>, {
884
- info: InfoObject;
885
- jsonSchemaDialect?: string;
886
- servers?: ServerObject[];
887
- } & ((Pick<PathsWebhooksComponents<T>, 'paths'> & Omit<Partial<PathsWebhooksComponents<T>>, 'paths'>) | (Pick<PathsWebhooksComponents<T>, 'webhooks'> & Omit<Partial<PathsWebhooksComponents<T>>, 'webhooks'>) | (Pick<PathsWebhooksComponents<T>, 'components'> & Omit<Partial<PathsWebhooksComponents<T>>, 'components'>))>;
888
- type InfoObject = Modify<OpenAPIV3.InfoObject, {
889
- summary?: string;
890
- license?: LicenseObject;
891
- }>;
892
- type ContactObject = OpenAPIV3.ContactObject;
893
- type LicenseObject = Modify<OpenAPIV3.LicenseObject, {
894
- identifier?: string;
895
- }>;
896
- type ServerObject = Modify<OpenAPIV3.ServerObject, {
897
- url: string;
898
- description?: string;
899
- variables?: Record<string, ServerVariableObject>;
900
- }>;
901
- type ServerVariableObject = Modify<OpenAPIV3.ServerVariableObject, {
902
- enum?: [string, ...string[]];
903
- }>;
904
- type PathsObject<T extends {} = {}, P extends {} = {}> = Record<string, (PathItemObject<T> & P) | undefined>;
905
- type HttpMethods = OpenAPIV3.HttpMethods;
906
- type PathItemObject<T extends {} = {}> = Modify<OpenAPIV3.PathItemObject<T>, {
907
- servers?: ServerObject[];
908
- parameters?: (ReferenceObject | ParameterObject)[];
909
- }> & {
910
- [method in HttpMethods]?: OperationObject<T>;
911
- };
912
- type OperationObject<T extends {} = {}> = Modify<OpenAPIV3.OperationObject<T>, {
913
- parameters?: (ReferenceObject | ParameterObject)[];
914
- requestBody?: ReferenceObject | RequestBodyObject;
915
- responses?: ResponsesObject;
916
- callbacks?: Record<string, ReferenceObject | CallbackObject>;
917
- servers?: ServerObject[];
918
- }> & T;
919
- type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
920
- type ParameterObject = OpenAPIV3.ParameterObject;
921
- type HeaderObject = OpenAPIV3.HeaderObject;
922
- type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
923
- type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | 'null';
924
- type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
925
- /**
926
- * There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
927
- * 'items' will be always visible as optional
928
- * Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
929
- */
930
- type SchemaObject = ArraySchemaObject | NonArraySchemaObject | MixedSchemaObject;
931
- interface ArraySchemaObject extends BaseSchemaObject {
932
- type: ArraySchemaObjectType;
933
- items: ReferenceObject | SchemaObject;
1327
+ >;
1328
+ type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
1329
+ type ResponseObject = Modify<
1330
+ OpenAPIV3.ResponseObject,
1331
+ {
1332
+ headers?: {
1333
+ [header: string]: ReferenceObject | HeaderObject;
1334
+ };
1335
+ content?: {
1336
+ [media: string]: MediaTypeObject;
1337
+ };
1338
+ links?: {
1339
+ [link: string]: ReferenceObject | LinkObject;
1340
+ };
934
1341
  }
935
- interface NonArraySchemaObject extends BaseSchemaObject {
936
- type?: NonArraySchemaObjectType;
1342
+ >;
1343
+ type LinkObject = Modify<
1344
+ OpenAPIV3.LinkObject,
1345
+ {
1346
+ server?: ServerObject;
937
1347
  }
938
- interface MixedSchemaObject extends BaseSchemaObject {
939
- type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
940
- items?: ReferenceObject | SchemaObject;
1348
+ >;
1349
+ type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
1350
+ type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
1351
+ type ComponentsObject = Modify<
1352
+ OpenAPIV3.ComponentsObject,
1353
+ {
1354
+ schemas?: Record<string, SchemaObject>;
1355
+ responses?: Record<string, ReferenceObject | ResponseObject>;
1356
+ parameters?: Record<string, ReferenceObject | ParameterObject>;
1357
+ examples?: Record<string, ReferenceObject | ExampleObject>;
1358
+ requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
1359
+ headers?: Record<string, ReferenceObject | HeaderObject>;
1360
+ securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
1361
+ links?: Record<string, ReferenceObject | LinkObject>;
1362
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
1363
+ pathItems?: Record<string, ReferenceObject | PathItemObject>;
941
1364
  }
942
- type BaseSchemaObject = Modify<Omit<OpenAPIV3.BaseSchemaObject, 'nullable'>, {
943
- examples?: OpenAPIV3.BaseSchemaObject['example'][];
944
- exclusiveMinimum?: boolean | number;
945
- exclusiveMaximum?: boolean | number;
946
- contentMediaType?: string;
947
- $schema?: string;
948
- additionalProperties?: boolean | ReferenceObject | SchemaObject;
949
- properties?: {
950
- [name: string]: ReferenceObject | SchemaObject;
951
- };
952
- allOf?: (ReferenceObject | SchemaObject)[];
953
- oneOf?: (ReferenceObject | SchemaObject)[];
954
- anyOf?: (ReferenceObject | SchemaObject)[];
955
- not?: ReferenceObject | SchemaObject;
956
- discriminator?: DiscriminatorObject;
957
- externalDocs?: ExternalDocumentationObject;
958
- xml?: XMLObject;
959
- const?: any;
960
- }>;
961
- type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
962
- type XMLObject = OpenAPIV3.XMLObject;
963
- type ReferenceObject = Modify<OpenAPIV3.ReferenceObject, {
964
- summary?: string;
965
- description?: string;
966
- }>;
967
- type ExampleObject = OpenAPIV3.ExampleObject;
968
- type MediaTypeObject = Modify<OpenAPIV3.MediaTypeObject, {
969
- schema?: SchemaObject | ReferenceObject;
970
- examples?: Record<string, ReferenceObject | ExampleObject>;
971
- }>;
972
- type EncodingObject = OpenAPIV3.EncodingObject;
973
- type RequestBodyObject = Modify<OpenAPIV3.RequestBodyObject, {
974
- content: {
975
- [media: string]: MediaTypeObject;
976
- };
977
- }>;
978
- type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
979
- type ResponseObject = Modify<OpenAPIV3.ResponseObject, {
980
- headers?: {
981
- [header: string]: ReferenceObject | HeaderObject;
982
- };
983
- content?: {
984
- [media: string]: MediaTypeObject;
985
- };
986
- links?: {
987
- [link: string]: ReferenceObject | LinkObject;
988
- };
989
- }>;
990
- type LinkObject = Modify<OpenAPIV3.LinkObject, {
991
- server?: ServerObject;
992
- }>;
993
- type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
994
- type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
995
- type ComponentsObject = Modify<OpenAPIV3.ComponentsObject, {
996
- schemas?: Record<string, SchemaObject>;
997
- responses?: Record<string, ReferenceObject | ResponseObject>;
998
- parameters?: Record<string, ReferenceObject | ParameterObject>;
999
- examples?: Record<string, ReferenceObject | ExampleObject>;
1000
- requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
1001
- headers?: Record<string, ReferenceObject | HeaderObject>;
1002
- securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
1003
- links?: Record<string, ReferenceObject | LinkObject>;
1004
- callbacks?: Record<string, ReferenceObject | CallbackObject>;
1005
- pathItems?: Record<string, ReferenceObject | PathItemObject>;
1006
- }>;
1007
- type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
1008
- type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
1009
- type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
1010
- type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
1011
- type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
1012
- type TagObject = OpenAPIV3.TagObject;
1013
- {};
1365
+ >;
1366
+ type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
1367
+ type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
1368
+ type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
1369
+ type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
1370
+ type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
1371
+ type TagObject = OpenAPIV3.TagObject;
1372
+ {
1373
+ }
1014
1374
  }
1015
1375
 
1016
1376
  /**
1017
1377
  * Base object for parameter definitions
1018
1378
  * @public
1019
1379
  */
1020
- declare type ParameterBaseObject = Modify<Omit<OpenAPIV3_1.ParameterBaseObject, "content" | "allowEmptyValue" | "style" | "allowReserved" | "explode" | "example" | "examples">, {
1380
+ declare type ParameterBaseObject = Modify<
1381
+ Omit<
1382
+ OpenAPIV3_1.ParameterBaseObject,
1383
+ | "content"
1384
+ | "allowEmptyValue"
1385
+ | "style"
1386
+ | "allowReserved"
1387
+ | "explode"
1388
+ | "example"
1389
+ | "examples"
1390
+ >,
1391
+ {
1021
1392
  schema: OpenAPIV3_1.SchemaObject;
1022
- }>;
1393
+ }
1394
+ >;
1023
1395
 
1024
1396
  /**
1025
1397
  * Definition of a parameter
1026
1398
  * @public
1027
1399
  */
1028
1400
  declare interface ParameterDefinition extends ParameterBaseObject {
1029
- name: string;
1030
- in: string;
1401
+ name: string;
1402
+ in: string;
1031
1403
  }
1032
1404
 
1033
1405
  /**
@@ -1036,7 +1408,7 @@ declare interface ParameterDefinition extends ParameterBaseObject {
1036
1408
  * @public
1037
1409
  */
1038
1410
  declare interface RequestGeneric extends RequestInitGeneric {
1039
- Query?: RequestQueryDefault;
1411
+ Query?: RequestQueryDefault;
1040
1412
  }
1041
1413
 
1042
1414
  /**
@@ -1045,8 +1417,8 @@ declare interface RequestGeneric extends RequestInitGeneric {
1045
1417
  * @public
1046
1418
  */
1047
1419
  declare interface RequestInitGeneric {
1048
- UserData?: UserDataDefault;
1049
- Params?: RequestParamsDefault;
1420
+ UserData?: UserDataDefault;
1421
+ Params?: RequestParamsDefault;
1050
1422
  }
1051
1423
 
1052
1424
  declare type RequestParamsDefault = Record<string, string>;
@@ -1074,54 +1446,66 @@ declare type RequestQueryDefault = Record<string, string>;
1074
1446
  * ```
1075
1447
  */
1076
1448
  declare interface RequestUser<TUserData> {
1077
- sub: string;
1078
- data: TUserData;
1449
+ sub: string;
1450
+ data: TUserData;
1079
1451
  }
1080
1452
 
1081
- declare type ResolveRequestParams<TParams extends RequestParamsDefault | undefined> = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
1453
+ declare type ResolveRequestParams<
1454
+ TParams extends RequestParamsDefault | undefined,
1455
+ > = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
1082
1456
 
1083
- declare type ResolveRequestQuery<TQuery extends RequestQueryDefault | undefined> = TQuery extends RequestQueryDefault ? TQuery : RequestQueryDefault;
1457
+ declare type ResolveRequestQuery<
1458
+ TQuery extends RequestQueryDefault | undefined,
1459
+ > = TQuery extends RequestQueryDefault ? TQuery : RequestQueryDefault;
1084
1460
 
1085
- declare type ResolveUserData<TUserData extends UserDataDefault | undefined> = TUserData extends UserDataDefault ? TUserData : UserDataDefault;
1461
+ declare type ResolveUserData<TUserData extends UserDataDefault | undefined> =
1462
+ TUserData extends UserDataDefault ? TUserData : UserDataDefault;
1086
1463
 
1087
1464
  /**
1088
1465
  * Definition of responses for a route
1089
1466
  * @public
1090
1467
  */
1091
- declare type ResponsesDefinition = Record<HttpStatusCode | HttpStatusCodeRangeDefinition, Modify<Omit<OpenAPIV3_1.ResponseObject, "links">, {
1092
- headers?: {
1468
+ declare type ResponsesDefinition = Record<
1469
+ HttpStatusCode | HttpStatusCodeRangeDefinition,
1470
+ Modify<
1471
+ Omit<OpenAPIV3_1.ResponseObject, "links">,
1472
+ {
1473
+ headers?: {
1093
1474
  [header: string]: ParameterBaseObject;
1094
- };
1095
- }>>;
1475
+ };
1476
+ }
1477
+ >
1478
+ >;
1096
1479
 
1097
1480
  /**
1098
1481
  * @public
1099
1482
  */
1100
- declare interface RouteConfiguration extends Omit<BuildRouteConfiguration, "raw"> {
1101
- /**
1102
- * @deprecated Please switch to "raw().operationId"
1103
- */
1104
- operationId?: string;
1105
- /**
1106
- * @deprecated Please switch to "raw().summary"
1107
- */
1108
- summary?: string;
1109
- /**
1110
- * @deprecated Please switch to "raw().tags"
1111
- */
1112
- tags?: string[];
1113
- /**
1114
- * @deprecated Please switch to "raw().parameters"
1115
- */
1116
- parameters?: ParameterDefinition[];
1117
- /**
1118
- * @deprecated Please switch to "raw().responses"
1119
- */
1120
- responses?: ResponsesDefinition;
1121
- /**
1122
- * Gets the raw route configuration object
1123
- */
1124
- raw<T = any>(): T;
1483
+ declare interface RouteConfiguration
1484
+ extends Omit<BuildRouteConfiguration, "raw"> {
1485
+ /**
1486
+ * @deprecated Please switch to "raw().operationId"
1487
+ */
1488
+ operationId?: string;
1489
+ /**
1490
+ * @deprecated Please switch to "raw().summary"
1491
+ */
1492
+ summary?: string;
1493
+ /**
1494
+ * @deprecated Please switch to "raw().tags"
1495
+ */
1496
+ tags?: string[];
1497
+ /**
1498
+ * @deprecated Please switch to "raw().parameters"
1499
+ */
1500
+ parameters?: ParameterDefinition[];
1501
+ /**
1502
+ * @deprecated Please switch to "raw().responses"
1503
+ */
1504
+ responses?: ResponsesDefinition;
1505
+ /**
1506
+ * Gets the raw route configuration object
1507
+ */
1508
+ raw<T = any>(): T;
1125
1509
  }
1126
1510
 
1127
1511
  declare type UserDataDefault = any;
@@ -1130,7 +1514,7 @@ declare type UserDataDefault = any;
1130
1514
  * @public
1131
1515
  */
1132
1516
  declare interface WaitUntilFunc {
1133
- (promise: Promise<any>): void;
1517
+ (promise: Promise<any>): void;
1134
1518
  }
1135
1519
 
1136
1520
  /**
@@ -1138,72 +1522,92 @@ declare interface WaitUntilFunc {
1138
1522
  * @public
1139
1523
  */
1140
1524
  declare interface ZuploContext extends EventTarget {
1141
- /**
1142
- * The unique identifier of this context
1143
- */
1144
- readonly contextId: Readonly<string>;
1145
- /**
1146
- * The unique identifier of the incoming request
1147
- */
1148
- readonly requestId: Readonly<string>;
1149
- /**
1150
- * Request based logger
1151
- */
1152
- readonly log: Readonly<Logger>;
1153
- /**
1154
- * The route that is being processed
1155
- */
1156
- readonly route: Readonly<RouteConfiguration>;
1157
- /**
1158
- * Custom data stored on the ZuploContext
1159
- */
1160
- readonly custom: Record<string, any>;
1161
- readonly incomingRequestProperties: IncomingRequestProperties;
1162
- /**
1163
- * The parent context that spawned this context
1164
- * @beta
1165
- */
1166
- readonly parentContext: ZuploContext | undefined;
1167
- readonly invokeInboundPolicy: (policyName: string, request: ZuploRequest) => Promise<Response | ZuploRequest>;
1168
- readonly invokeOutboundPolicy: (policyName: string, response: Response, request: ZuploRequest) => Promise<Response>;
1169
- /**
1170
- * Invokes a route based on a Request without going back out to HTTP.
1171
- * Can take a relative route path to invoke on the Gateway
1172
- * Example: "/my/route" will invoke http://localhost/my/route on the Gateway
1173
- * without having to rebuild the Request's protocol and host.
1174
- * @beta
1175
- */
1176
- readonly invokeRoute: <TOptions extends RequestGeneric = RequestGeneric>(input: string | URL | Request, init?: ZuploRequestInit<TOptions>) => Promise<Response>;
1177
- readonly waitUntil: WaitUntilFunc;
1178
- /**
1179
- * Fires just before the response is sent. Response can be modified.
1180
- */
1181
- readonly addResponseSendingHook: (hook: OnResponseSendingHook) => void;
1182
- /**
1183
- * Fires immediately after the response is sent. Response cannot be modified.
1184
- */
1185
- readonly addResponseSendingFinalHook: (hook: OnResponseSendingFinalHook) => void;
1186
- /**
1187
- * 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.
1188
- *
1189
- * 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.
1190
- *
1191
- * 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.
1192
- *
1193
- * 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.
1194
- *
1195
- * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
1196
- *
1197
- * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
1198
- *
1199
- * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
1200
- * @deprecated This will be removed in the future. Use hooks instead. See {@link https://zuplo.com/docs/articles/runtime-extensions}
1201
- */
1202
- addEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
1203
- /**
1204
- * @deprecated This will be removed in the future. See {@link https://zuplo.com/docs/articles/runtime-extensions}
1205
- */
1206
- removeEventListener<Type extends keyof Record<string, Event>>(type: Type, handler: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
1525
+ /**
1526
+ * The unique identifier of this context
1527
+ */
1528
+ readonly contextId: Readonly<string>;
1529
+ /**
1530
+ * The unique identifier of the incoming request
1531
+ */
1532
+ readonly requestId: Readonly<string>;
1533
+ /**
1534
+ * Request based logger
1535
+ */
1536
+ readonly log: Readonly<Logger>;
1537
+ /**
1538
+ * The route that is being processed
1539
+ */
1540
+ readonly route: Readonly<RouteConfiguration>;
1541
+ /**
1542
+ * Custom data stored on the ZuploContext
1543
+ */
1544
+ readonly custom: Record<string, any>;
1545
+ readonly incomingRequestProperties: IncomingRequestProperties;
1546
+ /**
1547
+ * The parent context that spawned this context
1548
+ * @beta
1549
+ */
1550
+ readonly parentContext: ZuploContext | undefined;
1551
+ readonly invokeInboundPolicy: (
1552
+ policyName: string,
1553
+ request: ZuploRequest
1554
+ ) => Promise<Response | ZuploRequest>;
1555
+ readonly invokeOutboundPolicy: (
1556
+ policyName: string,
1557
+ response: Response,
1558
+ request: ZuploRequest
1559
+ ) => Promise<Response>;
1560
+ /**
1561
+ * Invokes a route based on a Request without going back out to HTTP.
1562
+ * Can take a relative route path to invoke on the Gateway
1563
+ * Example: "/my/route" will invoke http://localhost/my/route on the Gateway
1564
+ * without having to rebuild the Request's protocol and host.
1565
+ * @beta
1566
+ */
1567
+ readonly invokeRoute: <TOptions extends RequestGeneric = RequestGeneric>(
1568
+ input: string | URL | Request,
1569
+ init?: ZuploRequestInit<TOptions>
1570
+ ) => Promise<Response>;
1571
+ readonly waitUntil: WaitUntilFunc;
1572
+ /**
1573
+ * Fires just before the response is sent. Response can be modified.
1574
+ */
1575
+ readonly addResponseSendingHook: (hook: OnResponseSendingHook) => void;
1576
+ /**
1577
+ * Fires immediately after the response is sent. Response cannot be modified.
1578
+ */
1579
+ readonly addResponseSendingFinalHook: (
1580
+ hook: OnResponseSendingFinalHook
1581
+ ) => void;
1582
+ /**
1583
+ * 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.
1584
+ *
1585
+ * 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.
1586
+ *
1587
+ * 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.
1588
+ *
1589
+ * 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.
1590
+ *
1591
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
1592
+ *
1593
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
1594
+ *
1595
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
1596
+ * @deprecated This will be removed in the future. Use hooks instead. See {@link https://zuplo.com/docs/articles/runtime-extensions}
1597
+ */
1598
+ addEventListener<Type extends keyof Record<string, Event>>(
1599
+ type: Type,
1600
+ handler: EventListenerOrEventListenerObject,
1601
+ options?: AddEventListenerOptions | boolean
1602
+ ): void;
1603
+ /**
1604
+ * @deprecated This will be removed in the future. See {@link https://zuplo.com/docs/articles/runtime-extensions}
1605
+ */
1606
+ removeEventListener<Type extends keyof Record<string, Event>>(
1607
+ type: Type,
1608
+ handler: EventListenerOrEventListenerObject,
1609
+ options?: AddEventListenerOptions | boolean
1610
+ ): void;
1207
1611
  }
1208
1612
 
1209
1613
  /* Excluded from this release type: ZuploEventContext */
@@ -1274,54 +1678,56 @@ declare interface ZuploContext extends EventTarget {
1274
1678
  * }
1275
1679
  * ```
1276
1680
  */
1277
- declare class ZuploRequest<TOptions extends RequestGeneric = RequestGeneric> extends Request {
1278
- #private;
1279
- constructor(input: string | URL | Request, init?: ZuploRequestInit<TOptions>);
1280
- /**
1281
- * A dictionary of query-string values
1282
- *
1283
- * @example
1284
- * The url `https://example.com?foo=bar` would return
1285
- * the following query object:
1286
- *
1287
- * ```
1288
- * const foo = request.query.foo;
1289
- * ```
1290
- *
1291
- * @readonly
1292
- */
1293
- get query(): Readonly<ResolveRequestQuery<TOptions["Query"]>>;
1294
- /**
1295
- * If you use tokens in your route’s URL, they are
1296
- * automatically parsed into properties on the params
1297
- * property of your request.
1298
- *
1299
- * @example
1300
- * The route `/products/:productId/vendors/:vendorId`
1301
- * would include two params:
1302
- *
1303
- * ```
1304
- * const productId = request.params.productId;
1305
- * const vendorId = request.params.vendorId;
1306
- * ```
1307
- * @readonly
1308
- */
1309
- get params(): Readonly<ResolveRequestParams<TOptions["Params"]>>;
1310
- /**
1311
- * An optional object identifying a ‘user’.
1312
- *
1313
- * @remarks
1314
- * If undefined this typically means the request is
1315
- * anonymous. If present, the user object will have
1316
- * a sub property that is a unique identifier for
1317
- * that user. There is also an optional data property
1318
- * that is of any type that typically contains other
1319
- * information about the user. When using JWT tokens
1320
- * you’ll usually find all the claims here.
1321
- *
1322
- * @readonly
1323
- */
1324
- user?: RequestUser<ResolveUserData<TOptions["UserData"]>>;
1681
+ declare class ZuploRequest<
1682
+ TOptions extends RequestGeneric = RequestGeneric,
1683
+ > extends Request {
1684
+ #private;
1685
+ constructor(input: string | URL | Request, init?: ZuploRequestInit<TOptions>);
1686
+ /**
1687
+ * A dictionary of query-string values
1688
+ *
1689
+ * @example
1690
+ * The url `https://example.com?foo=bar` would return
1691
+ * the following query object:
1692
+ *
1693
+ * ```
1694
+ * const foo = request.query.foo;
1695
+ * ```
1696
+ *
1697
+ * @readonly
1698
+ */
1699
+ get query(): Readonly<ResolveRequestQuery<TOptions["Query"]>>;
1700
+ /**
1701
+ * If you use tokens in your route’s URL, they are
1702
+ * automatically parsed into properties on the params
1703
+ * property of your request.
1704
+ *
1705
+ * @example
1706
+ * The route `/products/:productId/vendors/:vendorId`
1707
+ * would include two params:
1708
+ *
1709
+ * ```
1710
+ * const productId = request.params.productId;
1711
+ * const vendorId = request.params.vendorId;
1712
+ * ```
1713
+ * @readonly
1714
+ */
1715
+ get params(): Readonly<ResolveRequestParams<TOptions["Params"]>>;
1716
+ /**
1717
+ * An optional object identifying a ‘user’.
1718
+ *
1719
+ * @remarks
1720
+ * If undefined this typically means the request is
1721
+ * anonymous. If present, the user object will have
1722
+ * a sub property that is a unique identifier for
1723
+ * that user. There is also an optional data property
1724
+ * that is of any type that typically contains other
1725
+ * information about the user. When using JWT tokens
1726
+ * you’ll usually find all the claims here.
1727
+ *
1728
+ * @readonly
1729
+ */
1730
+ user?: RequestUser<ResolveUserData<TOptions["UserData"]>>;
1325
1731
  }
1326
1732
 
1327
1733
  /**
@@ -1329,9 +1735,11 @@ declare class ZuploRequest<TOptions extends RequestGeneric = RequestGeneric> ext
1329
1735
  * Extends the standard RequestInit with Zuplo-specific properties.
1330
1736
  * @public
1331
1737
  */
1332
- declare interface ZuploRequestInit<TOptions extends RequestInitGeneric = RequestInitGeneric> extends RequestInit {
1333
- params?: ResolveRequestParams<TOptions["Params"]>;
1334
- user?: ResolveUserData<TOptions["UserData"]>;
1738
+ declare interface ZuploRequestInit<
1739
+ TOptions extends RequestInitGeneric = RequestInitGeneric,
1740
+ > extends RequestInit {
1741
+ params?: ResolveRequestParams<TOptions["Params"]>;
1742
+ user?: ResolveUserData<TOptions["UserData"]>;
1335
1743
  }
1336
1744
 
1337
- export { }
1745
+ export {};