@zuplo/cli 6.72.15 → 6.72.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/index.js +17 -0
  2. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/package.json +1 -1
  3. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-uri/test/security.test.js +62 -0
  4. package/node_modules/@fastify/reply-from/CLAUDE.md +66 -0
  5. package/node_modules/@fastify/reply-from/index.js +8 -4
  6. package/node_modules/@fastify/reply-from/package.json +1 -1
  7. package/node_modules/@fastify/reply-from/test/fix-GHSA-v574-6498-x57v.test.js +219 -0
  8. package/node_modules/@fastify/reply-from/test/http1-aborted-request.test.js +61 -0
  9. package/node_modules/@zuplo/core/package.json +1 -1
  10. package/node_modules/@zuplo/graphql/package.json +1 -1
  11. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  12. package/node_modules/@zuplo/otel/package.json +1 -1
  13. package/node_modules/@zuplo/runtime/out/esm/chunk-2WLR6ZDZ.js +26 -0
  14. package/node_modules/@zuplo/runtime/out/esm/chunk-2WLR6ZDZ.js.map +1 -0
  15. package/node_modules/@zuplo/runtime/out/esm/chunk-EJIF2ZML.js +26 -0
  16. package/node_modules/@zuplo/runtime/out/esm/chunk-EJIF2ZML.js.map +1 -0
  17. package/node_modules/@zuplo/runtime/out/esm/chunk-FPZAMUNA.js +26 -0
  18. package/node_modules/@zuplo/runtime/out/esm/chunk-FPZAMUNA.js.map +1 -0
  19. package/node_modules/@zuplo/runtime/out/esm/{chunk-J6K7HSIK.js → chunk-QWO5UTVQ.js} +2 -2
  20. package/node_modules/@zuplo/runtime/out/esm/{chunk-J6K7HSIK.js.map → chunk-QWO5UTVQ.js.map} +1 -1
  21. package/node_modules/@zuplo/runtime/out/esm/chunk-S2CH4265.js +385 -0
  22. package/node_modules/@zuplo/runtime/out/esm/chunk-S2CH4265.js.map +1 -0
  23. package/node_modules/@zuplo/runtime/out/esm/chunk-SNZSLL63.js +26 -0
  24. package/node_modules/@zuplo/runtime/out/esm/chunk-SNZSLL63.js.map +1 -0
  25. package/node_modules/@zuplo/runtime/out/esm/chunk-US6ITPGV.js +26 -0
  26. package/node_modules/@zuplo/runtime/out/esm/{chunk-32F3RZS4.js.map → chunk-US6ITPGV.js.map} +1 -1
  27. package/node_modules/@zuplo/runtime/out/esm/{chunk-DSZS6PZJ.js → chunk-VCMIY3WJ.js} +6 -6
  28. package/node_modules/@zuplo/runtime/out/esm/chunk-VCMIY3WJ.js.map +1 -0
  29. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  30. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  31. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  32. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js +26 -0
  33. package/node_modules/@zuplo/runtime/out/esm/mcp/messages/index.js.map +1 -0
  34. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +13 -13
  35. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  36. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  37. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js.map +1 -1
  38. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  39. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js.map +1 -1
  40. package/node_modules/@zuplo/runtime/out/types/index.d.ts +1 -0
  41. package/node_modules/@zuplo/runtime/out/types/mcp/messages/index.d.ts +2439 -0
  42. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +1 -0
  43. package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +1 -0
  44. package/node_modules/@zuplo/runtime/out/types/sdks/aws/index.d.ts +1 -0
  45. package/node_modules/@zuplo/runtime/package.json +5 -1
  46. package/package.json +6 -6
  47. package/node_modules/@zuplo/runtime/out/esm/chunk-32F3RZS4.js +0 -26
  48. package/node_modules/@zuplo/runtime/out/esm/chunk-4QJJMELB.js +0 -26
  49. package/node_modules/@zuplo/runtime/out/esm/chunk-4QJJMELB.js.map +0 -1
  50. package/node_modules/@zuplo/runtime/out/esm/chunk-DSZS6PZJ.js.map +0 -1
  51. package/node_modules/@zuplo/runtime/out/esm/chunk-SQVIQSIN.js +0 -385
  52. package/node_modules/@zuplo/runtime/out/esm/chunk-SQVIQSIN.js.map +0 -1
  53. /package/node_modules/@zuplo/runtime/out/esm/{chunk-SQVIQSIN.js.LEGAL.txt → chunk-S2CH4265.js.LEGAL.txt} +0 -0
  54. /package/node_modules/@zuplo/runtime/out/esm/{chunk-DSZS6PZJ.js.LEGAL.txt → chunk-VCMIY3WJ.js.LEGAL.txt} +0 -0
@@ -0,0 +1,2439 @@
1
+ /**
2
+ * Base logger interface with methods for each log level.
3
+ * @beta
4
+ */
5
+ declare interface BaseLogger {
6
+ debug(...messages: unknown[]): void;
7
+ info(...messages: unknown[]): void;
8
+ log(...messages: unknown[]): void;
9
+ warn(...messages: unknown[]): void;
10
+ error(...messages: unknown[]): void;
11
+ }
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ declare interface BuildRouteConfiguration {
17
+ path: string;
18
+ methods: HttpMethod[];
19
+ /**
20
+ * @deprecated This property is not used and will be removed in future versions
21
+ */
22
+ label?: string;
23
+ /**
24
+ * @deprecated This property is not used and will be removed in future versions
25
+ */
26
+ key?: string;
27
+ handler: HandlerDefinition;
28
+ corsPolicy?: CorsPolicy;
29
+ /**
30
+ * @deprecated This property is deprecated. Use route.raw() instead.
31
+ */
32
+ custom?: any;
33
+ mcp?: {
34
+ enabled?: boolean;
35
+ };
36
+ policies?: {
37
+ inbound?: string[];
38
+ outbound?: string[];
39
+ };
40
+ /**
41
+ * @deprecated This property is not used and will be removed in future versions
42
+ */
43
+ excludeFromOpenApi?: boolean;
44
+ pathPattern?: string;
45
+ /**
46
+ * Build-time metadata for this route.
47
+ */
48
+ metadata?: {
49
+ /**
50
+ * The source file this route was generated from.
51
+ */
52
+ filepath: string;
53
+ };
54
+ /* Excluded from this release type: raw */
55
+ }
56
+
57
+ /**
58
+ * The 2-letter continent codes Cloudflare uses
59
+ * @public
60
+ */
61
+ declare type ContinentCode = "AF" | "AN" | "AS" | "EU" | "NA" | "OC" | "SA";
62
+
63
+ /**
64
+ * @public
65
+ */
66
+ declare type CorsPolicy = string | "anything-goes" | "none";
67
+
68
+ /**
69
+ * Answer an MCP envelope with a JSON-RPC error, protocol-correctly.
70
+ *
71
+ * The two-argument form rejects the whole envelope: every request id gets
72
+ * `error`. The three-argument form targets one request: the named message
73
+ * gets `error` and every other request gets `-32001 Not processed`. In both
74
+ * forms invalid members are answered with their own parse error,
75
+ * notifications get no reply entry, and the wire shape (single object vs
76
+ * batch array) mirrors the incoming envelope.
77
+ *
78
+ * @beta
79
+ */
80
+ export declare function createErrorResponse(
81
+ envelope: McpEnvelope,
82
+ error: McpErrorDetail
83
+ ): Response;
84
+
85
+ export declare function createErrorResponse(
86
+ envelope: McpEnvelope,
87
+ message: McpAnyRequestMessage,
88
+ error: McpErrorDetail
89
+ ): Response;
90
+
91
+ /**
92
+ * Answer an MCP envelope's only request with a JSON-RPC result, without
93
+ * calling the upstream. Throws when the envelope contains more than one
94
+ * request — answering one request of a batch requires the partial-forwarding
95
+ * engine (`processMessages`), not a whole-exchange response.
96
+ *
97
+ * @beta
98
+ */
99
+ export declare function createResultResponse(
100
+ envelope: McpEnvelope,
101
+ message: McpAnyRequestMessage,
102
+ result: McpResult
103
+ ): Response;
104
+
105
+ declare const EventType: {
106
+ readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
107
+ readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
108
+ readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
109
+ readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
110
+ readonly AI_GATEWAY_WARNING_COUNT: "ai_gateway_warning_count";
111
+ readonly AI_GATEWAY_BLOCKED_COUNT: "ai_gateway_blocked_count";
112
+ readonly AI_GATEWAY_FALLBACK_COUNT: "ai_gateway_fallback_count";
113
+ readonly MCP_REQUEST_RECEIVED: "mcp_request_received";
114
+ readonly MCP_REQUEST_COMPLETED: "mcp_request_completed";
115
+ readonly MCP_REQUEST_REJECTED: "mcp_request_rejected";
116
+ readonly MCP_INITIALIZE_NEGOTIATED: "mcp_initialize_negotiated";
117
+ readonly MCP_CLIENT_UNSUPPORTED_BEHAVIOR: "mcp_client_unsupported_behavior";
118
+ readonly MCP_CAPABILITY_LISTED: "mcp_capability_listed";
119
+ readonly MCP_CAPABILITY_INVOKED: "mcp_capability_invoked";
120
+ readonly MCP_CAPABILITY_COMPLETED: "mcp_capability_completed";
121
+ readonly MCP_CAPABILITY_FAILED: "mcp_capability_failed";
122
+ readonly MCP_CAPABILITY_CONNECT_REQUIRED: "mcp_capability_connect_required";
123
+ readonly MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED: "mcp_auth_downstream_token_validated";
124
+ readonly MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED: "mcp_auth_downstream_token_rejected";
125
+ readonly MCP_OAUTH_CLIENT_REGISTERED: "mcp_oauth_client_registered";
126
+ readonly MCP_OAUTH_AUTHORIZE_STARTED: "mcp_oauth_authorize_started";
127
+ readonly MCP_OAUTH_AUTHORIZE_AWAITING_SETUP: "mcp_oauth_authorize_awaiting_setup";
128
+ readonly MCP_OAUTH_TOKEN_ISSUED: "mcp_oauth_token_issued";
129
+ readonly MCP_OAUTH_TOKEN_REFRESH_ROTATED: "mcp_oauth_token_refresh_rotated";
130
+ readonly MCP_OAUTH_TOKEN_REVOKED: "mcp_oauth_token_revoked";
131
+ readonly MCP_AUTH_UPSTREAM_CONNECT_REQUIRED: "mcp_auth_upstream_connect_required";
132
+ readonly MCP_AUTH_UPSTREAM_CONNECT_STARTED: "mcp_auth_upstream_connect_started";
133
+ readonly MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED: "mcp_auth_upstream_callback_received";
134
+ readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED: "mcp_auth_upstream_token_exchange_succeeded";
135
+ readonly MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED: "mcp_auth_upstream_token_exchange_failed";
136
+ readonly MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_auth_upstream_credential_resolved";
137
+ readonly MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_auth_upstream_credential_missing";
138
+ readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
139
+ readonly GRAPHQL_OPERATION: "graphql_operation";
140
+ readonly CACHE_OPERATION: "cache_operation";
141
+ };
142
+
143
+ declare type EventType = (typeof EventType)[keyof typeof EventType];
144
+
145
+ /**
146
+ * Parse a request body as MCP (JSON-RPC) messages.
147
+ *
148
+ * Returns `null` when the body is not MCP-shaped — wrong content type, not
149
+ * valid JSON, no `jsonrpc: "2.0"` marker, or larger than the parse limit —
150
+ * so policies can let non-MCP traffic pass through untouched.
151
+ *
152
+ * The parse is cached per request instance: any number of policies can call
153
+ * this on the same request and the body is read and classified once.
154
+ *
155
+ * @beta
156
+ */
157
+ export declare function getRequest(
158
+ request: Request
159
+ ): Promise<McpEnvelope | null>;
160
+
161
+ /**
162
+ * @public
163
+ */
164
+ declare interface HandlerDefinition {
165
+ module: any;
166
+ export: string;
167
+ options?: unknown;
168
+ }
169
+
170
+ declare type HandlerResult = McpMessageVerdict | Promise<McpMessageVerdict>;
171
+
172
+ /**
173
+ * @public
174
+ */
175
+ declare type HttpMethod =
176
+ | "GET"
177
+ | "HEAD"
178
+ | "POST"
179
+ | "PUT"
180
+ | "DELETE"
181
+ | "CONNECT"
182
+ | "OPTIONS"
183
+ | "TRACE"
184
+ | "PATCH";
185
+
186
+ /**
187
+ * @beta
188
+ */
189
+ declare enum HttpStatusCode {
190
+ /**
191
+ * The server has received the request headers and the client should proceed to send the request body
192
+ * (in the case of a request for which a body needs to be sent; for example, a POST request).
193
+ * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
194
+ * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
195
+ * 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.
196
+ */
197
+ CONTINUE = 100,
198
+ /**
199
+ * The requester has asked the server to switch protocols and the server has agreed to do so.
200
+ */
201
+ SWITCHING_PROTOCOLS = 101,
202
+ /**
203
+ * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
204
+ * This code indicates that the server has received and is processing the request, but no response is available yet.
205
+ * This prevents the client from timing out and assuming the request was lost.
206
+ * @deprecated This status code is deprecated and shouldn't be sent any more. Clients may still accept it, but simply ignore them.
207
+ */
208
+ PROCESSING = 102,
209
+ /**
210
+ * This response may be sent by a server while it is still preparing a
211
+ * response, with hints about the resources that the server is expecting
212
+ * the final response will link. This allows a browser to start preloading
213
+ * resources even before the server has prepared and sent that final response.
214
+ */
215
+ EARLY_HINTS = 103,
216
+ /**
217
+ * Standard response for successful HTTP requests.
218
+ * The actual response will depend on the request method used.
219
+ * In a GET request, the response will contain an entity corresponding to the requested resource.
220
+ * In a POST request, the response will contain an entity describing or containing the result of the action.
221
+ */
222
+ OK = 200,
223
+ /**
224
+ * The request has been fulfilled, resulting in the creation of a new resource.
225
+ */
226
+ CREATED = 201,
227
+ /**
228
+ * The request has been accepted for processing, but the processing has not been completed.
229
+ * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
230
+ */
231
+ ACCEPTED = 202,
232
+ /**
233
+ * SINCE HTTP/1.1
234
+ * The server is a transforming proxy that received a 200 OK from its origin,
235
+ * but is returning a modified version of the origin's response.
236
+ */
237
+ NON_AUTHORITATIVE_INFORMATION = 203,
238
+ /**
239
+ * The server successfully processed the request and is not returning any content.
240
+ */
241
+ NO_CONTENT = 204,
242
+ /**
243
+ * The server successfully processed the request, but is not returning any content.
244
+ * Unlike a 204 response, this response requires that the requester reset the document view.
245
+ */
246
+ RESET_CONTENT = 205,
247
+ /**
248
+ * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
249
+ * The range header is used by HTTP clients to enable resuming of interrupted downloads,
250
+ * or split a download into multiple simultaneous streams.
251
+ */
252
+ PARTIAL_CONTENT = 206,
253
+ /**
254
+ * The message body that follows is an XML message and can contain a number of separate response codes,
255
+ * depending on how many sub-requests were made.
256
+ */
257
+ MULTI_STATUS = 207,
258
+ /**
259
+ * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
260
+ * and are not being included again.
261
+ */
262
+ ALREADY_REPORTED = 208,
263
+ /**
264
+ * The server has fulfilled a request for the resource,
265
+ * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
266
+ */
267
+ IM_USED = 226,
268
+ /**
269
+ * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
270
+ * For example, this code could be used to present multiple video format options,
271
+ * to list files with different filename extensions, or to suggest word-sense disambiguation.
272
+ */
273
+ MULTIPLE_CHOICES = 300,
274
+ /**
275
+ * This and all future requests should be directed to the given URI.
276
+ */
277
+ MOVED_PERMANENTLY = 301,
278
+ /**
279
+ * This is an example of industry practice contradicting the standard.
280
+ * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
281
+ * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
282
+ * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
283
+ * to distinguish between the two behaviours. However, some Web applications and frameworks
284
+ * use the 302 status code as if it were the 303.
285
+ */
286
+ FOUND = 302,
287
+ /**
288
+ * SINCE HTTP/1.1
289
+ * The response to the request can be found under another URI using a GET method.
290
+ * When received in response to a POST (or PUT/DELETE), the client should presume that
291
+ * the server has received the data and should issue a redirect with a separate GET message.
292
+ */
293
+ SEE_OTHER = 303,
294
+ /**
295
+ * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
296
+ * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
297
+ */
298
+ NOT_MODIFIED = 304,
299
+ /**
300
+ * SINCE HTTP/1.1
301
+ * The requested resource is available only through a proxy, the address for which is provided in the response.
302
+ * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
303
+ */
304
+ USE_PROXY = 305,
305
+ /**
306
+ * No longer used. Originally meant "Subsequent requests should use the specified proxy."
307
+ * @deprecated No longer used
308
+ */
309
+ SWITCH_PROXY = 306,
310
+ /**
311
+ * SINCE HTTP/1.1
312
+ * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
313
+ * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
314
+ * For example, a POST request should be repeated using another POST request.
315
+ */
316
+ TEMPORARY_REDIRECT = 307,
317
+ /**
318
+ * The request and all future requests should be repeated using another URI.
319
+ * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
320
+ * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
321
+ */
322
+ PERMANENT_REDIRECT = 308,
323
+ /**
324
+ * The server cannot or will not process the request due to an apparent client error
325
+ * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
326
+ */
327
+ BAD_REQUEST = 400,
328
+ /**
329
+ * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
330
+ * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
331
+ * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
332
+ * "unauthenticated",i.e. the user does not have the necessary credentials.
333
+ */
334
+ UNAUTHORIZED = 401,
335
+ /**
336
+ * Reserved for future use. The original intention was that this code might be used as part of some form of digital
337
+ * cash or micro payment scheme, but that has not happened, and this code is not usually used.
338
+ * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
339
+ */
340
+ PAYMENT_REQUIRED = 402,
341
+ /**
342
+ * The request was valid, but the server is refusing action.
343
+ * The user might not have the necessary permissions for a resource.
344
+ */
345
+ FORBIDDEN = 403,
346
+ /**
347
+ * The requested resource could not be found but may be available in the future.
348
+ * Subsequent requests by the client are permissible.
349
+ */
350
+ NOT_FOUND = 404,
351
+ /**
352
+ * A request method is not supported for the requested resource;
353
+ * 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.
354
+ */
355
+ METHOD_NOT_ALLOWED = 405,
356
+ /**
357
+ * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
358
+ */
359
+ NOT_ACCEPTABLE = 406,
360
+ /**
361
+ * The client must first authenticate itself with the proxy.
362
+ */
363
+ PROXY_AUTHENTICATION_REQUIRED = 407,
364
+ /**
365
+ * The server timed out waiting for the request.
366
+ * According to HTTP specifications:
367
+ * "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."
368
+ */
369
+ REQUEST_TIMEOUT = 408,
370
+ /**
371
+ * Indicates that the request could not be processed because of conflict in the request,
372
+ * such as an edit conflict between multiple simultaneous updates.
373
+ */
374
+ CONFLICT = 409,
375
+ /**
376
+ * Indicates that the resource requested is no longer available and will not be available again.
377
+ * This should be used when a resource has been intentionally removed and the resource should be purged.
378
+ * Upon receiving a 410 status code, the client should not request the resource in the future.
379
+ * Clients such as search engines should remove the resource from their indices.
380
+ * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
381
+ */
382
+ GONE = 410,
383
+ /**
384
+ * The request did not specify the length of its content, which is required by the requested resource.
385
+ */
386
+ LENGTH_REQUIRED = 411,
387
+ /**
388
+ * The server does not meet one of the preconditions that the requester put on the request.
389
+ */
390
+ PRECONDITION_FAILED = 412,
391
+ /**
392
+ * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
393
+ */
394
+ CONTENT_TOO_LARGE = 413,
395
+ /* Excluded from this release type: PAYLOAD_TOO_LARGE */
396
+ /**
397
+ * 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,
398
+ * in which case it should be converted to a POST request.
399
+ * Called "Request-URI Too Long" previously.
400
+ */
401
+ URI_TOO_LONG = 414,
402
+ /**
403
+ * The request entity has a media type which the server or resource does not support.
404
+ * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
405
+ */
406
+ UNSUPPORTED_MEDIA_TYPE = 415,
407
+ /**
408
+ * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
409
+ * For example, if the client asked for a part of the file that lies beyond the end of the file.
410
+ * Called "Requested Range Not Satisfiable" previously.
411
+ */
412
+ RANGE_NOT_SATISFIABLE = 416,
413
+ /**
414
+ * The server cannot meet the requirements of the Expect request-header field.
415
+ */
416
+ EXPECTATION_FAILED = 417,
417
+ /**
418
+ * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
419
+ * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
420
+ * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
421
+ */
422
+ I_AM_A_TEAPOT = 418,
423
+ /**
424
+ * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
425
+ */
426
+ MISDIRECTED_REQUEST = 421,
427
+ /* Excluded from this release type: UNPROCESSABLE_ENTITY */
428
+ /**
429
+ * The request was well-formed but was unable to be followed due to semantic errors.
430
+ */
431
+ UNPROCESSABLE_CONTENT = 422,
432
+ /**
433
+ * The resource that is being accessed is locked.
434
+ */
435
+ LOCKED = 423,
436
+ /**
437
+ * The request failed due to failure of a previous request (e.g., a PROPPATCH).
438
+ */
439
+ FAILED_DEPENDENCY = 424,
440
+ /**
441
+ * The server is unwilling to risk processing a request that might be
442
+ * replayed, which creates the potential for a replay attack.
443
+ */
444
+ TOO_EARLY = 425,
445
+ /**
446
+ * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
447
+ */
448
+ UPGRADE_REQUIRED = 426,
449
+ /**
450
+ * The origin server requires the request to be conditional.
451
+ * Intended to prevent "the 'lost update' problem, where a client
452
+ * GETs a resource's state, modifies it, and PUTs it back to the server,
453
+ * when meanwhile a third party has modified the state on the server, leading to a conflict."
454
+ */
455
+ PRECONDITION_REQUIRED = 428,
456
+ /**
457
+ * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
458
+ */
459
+ TOO_MANY_REQUESTS = 429,
460
+ /**
461
+ * The server is unwilling to process the request because either an individual header field,
462
+ * or all the header fields collectively, are too large.
463
+ */
464
+ REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
465
+ /**
466
+ * A server operator has received a legal demand to deny access to a resource or to a set of resources
467
+ * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
468
+ */
469
+ UNAVAILABLE_FOR_LEGAL_REASONS = 451,
470
+ /**
471
+ * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
472
+ */
473
+ INTERNAL_SERVER_ERROR = 500,
474
+ /**
475
+ * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
476
+ * Usually this implies future availability (e.g., a new feature of a web-service API).
477
+ */
478
+ NOT_IMPLEMENTED = 501,
479
+ /**
480
+ * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
481
+ */
482
+ BAD_GATEWAY = 502,
483
+ /**
484
+ * The server is currently unavailable (because it is overloaded or down for maintenance).
485
+ * Generally, this is a temporary state.
486
+ */
487
+ SERVICE_UNAVAILABLE = 503,
488
+ /**
489
+ * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
490
+ */
491
+ GATEWAY_TIMEOUT = 504,
492
+ /**
493
+ * The server does not support the HTTP protocol version used in the request
494
+ */
495
+ HTTP_VERSION_NOT_SUPPORTED = 505,
496
+ /**
497
+ * Transparent content negotiation for the request results in a circular reference.
498
+ */
499
+ VARIANT_ALSO_NEGOTIATES = 506,
500
+ /**
501
+ * The server is unable to store the representation needed to complete the request.
502
+ */
503
+ INSUFFICIENT_STORAGE = 507,
504
+ /**
505
+ * The server detected an infinite loop while processing the request.
506
+ */
507
+ LOOP_DETECTED = 508,
508
+ /**
509
+ * Further extensions to the request are required for the server to fulfill it.
510
+ */
511
+ NOT_EXTENDED = 510,
512
+ /**
513
+ * The client needs to authenticate to gain network access.
514
+ * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
515
+ * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
516
+ */
517
+ NETWORK_AUTHENTICATION_REQUIRED = 511,
518
+ }
519
+
520
+ declare type HttpStatusCodeRangeDefinition =
521
+ | "1XX"
522
+ | "2XX"
523
+ | "3XX"
524
+ | "4XX"
525
+ | "5XX";
526
+
527
+ /**
528
+ * A function-based inbound policy that can modify the incoming HTTP request.
529
+ * This is the simplest way to create custom policies without extending a class.
530
+ *
531
+ * @param request - The incoming Request
532
+ * @param context - The current context of the Request
533
+ * @param options - The configuration options for the policy
534
+ * @param policyName - The name set on the policy in the configuration
535
+ * @returns A Response to short-circuit or a Request to continue
536
+ *
537
+ * @public
538
+ * @example
539
+ * ```typescript
540
+ * import { InboundPolicyHandler } from "@zuplo/runtime";
541
+ *
542
+ * interface RateLimitOptions {
543
+ * requests: number;
544
+ * windowMs: number;
545
+ * }
546
+ *
547
+ * export const rateLimitPolicy: InboundPolicyHandler<RateLimitOptions> = async (
548
+ * request,
549
+ * context,
550
+ * options,
551
+ * policyName
552
+ * ) => {
553
+ * const key = request.headers.get("x-api-key") || "anonymous";
554
+ * const count = await incrementCounter(key, options.windowMs);
555
+ *
556
+ * if (count > options.requests) {
557
+ * return new Response("Too Many Requests", { status: 429 });
558
+ * }
559
+ *
560
+ * // Add rate limit headers
561
+ * request.headers.set("X-RateLimit-Limit", options.requests.toString());
562
+ * request.headers.set("X-RateLimit-Remaining", (options.requests - count).toString());
563
+ *
564
+ * return request;
565
+ * };
566
+ * ```
567
+ */
568
+ declare interface InboundPolicyHandler<TOptions = any> {
569
+ (
570
+ request: ZuploRequest,
571
+ context: ZuploContext,
572
+ options: TOptions,
573
+ policyName: string
574
+ ): Promise<ZuploRequest | Response>;
575
+ }
576
+
577
+ /**
578
+ * @public
579
+ */
580
+ declare interface IncomingRequestProperties {
581
+ /**
582
+ * ASN of the incoming request, for example, 395747.
583
+ */
584
+ readonly asn: number | undefined;
585
+ /**
586
+ * The organization which owns the ASN of the incoming request,
587
+ * for example, Google Cloud.
588
+ */
589
+ readonly asOrganization: string | undefined;
590
+ /**
591
+ * City of the incoming request, for example, "Austin".
592
+ */
593
+ readonly city: string | undefined;
594
+ /**
595
+ * Continent of the incoming request, for example, "NA".
596
+ */
597
+ readonly continent: ContinentCode | undefined;
598
+ /**
599
+ * The two-letter country code in the request.
600
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2|ISO 3166-1 alpha-2}
601
+ */
602
+ readonly country: Iso3166Alpha2Code | undefined;
603
+ /**
604
+ * Latitude of the incoming request, for example, "30.27130".
605
+ */
606
+ readonly latitude: string | undefined;
607
+ /**
608
+ * Longitude of the incoming request, for example, "-97.74260".
609
+ */
610
+ readonly longitude: string | undefined;
611
+ /**
612
+ * The three-letter IATA airport code of the data center that the request hit,
613
+ * for example, "DFW".
614
+ * @see {@link https://en.wikipedia.org/wiki/IATA_airport_code|IATA airport code}
615
+ */
616
+ readonly colo: string | undefined;
617
+ /**
618
+ * Postal code of the incoming request, for example, "78701".
619
+ */
620
+ readonly postalCode: string | undefined;
621
+ /**
622
+ * Metro code (DMA) of the incoming request, for example, "635".
623
+ */
624
+ readonly metroCode: string | undefined;
625
+ /**
626
+ * If known, the ISO 3166-2 name for the first level region associated with
627
+ * the IP address of the incoming request, for example, "Texas".
628
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
629
+ */
630
+ readonly region: string | undefined;
631
+ /**
632
+ * If known, the ISO 3166-2 code for the first-level region associated with
633
+ * the IP address of the incoming request, for example, "TX".
634
+ * @see {@link https://en.wikipedia.org/wiki/ISO_3166-2|ISO 3166-2}
635
+ */
636
+ readonly regionCode: string | undefined;
637
+ /**
638
+ * Timezone of the incoming request, for example, "America/Chicago".
639
+ */
640
+ readonly timezone: string | undefined;
641
+ /**
642
+ * If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
643
+ */
644
+ readonly httpProtocol: string | undefined;
645
+ /* Excluded from this release type: clientCert */
646
+ /* Excluded from this release type: clientMtlsVerificationStatus */
647
+ /* Excluded from this release type: clientMtlsVerificationReason */
648
+ /* Excluded from this release type: clientCertFingerprintSha256 */
649
+ /* Excluded from this release type: clientCertNotBefore */
650
+ /* Excluded from this release type: clientCertNotAfter */
651
+ /* Excluded from this release type: clientCertIssuerDn */
652
+ /* Excluded from this release type: clientCertSubjectDn */
653
+ }
654
+
655
+ /**
656
+ * ISO 3166-1 Alpha-2 codes
657
+ * @public
658
+ */
659
+ declare type Iso3166Alpha2Code =
660
+ | "AD"
661
+ | "AE"
662
+ | "AF"
663
+ | "AG"
664
+ | "AI"
665
+ | "AL"
666
+ | "AM"
667
+ | "AO"
668
+ | "AQ"
669
+ | "AR"
670
+ | "AS"
671
+ | "AT"
672
+ | "AU"
673
+ | "AW"
674
+ | "AX"
675
+ | "AZ"
676
+ | "BA"
677
+ | "BB"
678
+ | "BD"
679
+ | "BE"
680
+ | "BF"
681
+ | "BG"
682
+ | "BH"
683
+ | "BI"
684
+ | "BJ"
685
+ | "BL"
686
+ | "BM"
687
+ | "BN"
688
+ | "BO"
689
+ | "BQ"
690
+ | "BR"
691
+ | "BS"
692
+ | "BT"
693
+ | "BV"
694
+ | "BW"
695
+ | "BY"
696
+ | "BZ"
697
+ | "CA"
698
+ | "CC"
699
+ | "CD"
700
+ | "CF"
701
+ | "CG"
702
+ | "CH"
703
+ | "CI"
704
+ | "CK"
705
+ | "CL"
706
+ | "CM"
707
+ | "CN"
708
+ | "CO"
709
+ | "CR"
710
+ | "CU"
711
+ | "CV"
712
+ | "CW"
713
+ | "CX"
714
+ | "CY"
715
+ | "CZ"
716
+ | "DE"
717
+ | "DJ"
718
+ | "DK"
719
+ | "DM"
720
+ | "DO"
721
+ | "DZ"
722
+ | "EC"
723
+ | "EE"
724
+ | "EG"
725
+ | "EH"
726
+ | "ER"
727
+ | "ES"
728
+ | "ET"
729
+ | "FI"
730
+ | "FJ"
731
+ | "FK"
732
+ | "FM"
733
+ | "FO"
734
+ | "FR"
735
+ | "GA"
736
+ | "GB"
737
+ | "GD"
738
+ | "GE"
739
+ | "GF"
740
+ | "GG"
741
+ | "GH"
742
+ | "GI"
743
+ | "GL"
744
+ | "GM"
745
+ | "GN"
746
+ | "GP"
747
+ | "GQ"
748
+ | "GR"
749
+ | "GS"
750
+ | "GT"
751
+ | "GU"
752
+ | "GW"
753
+ | "GY"
754
+ | "HK"
755
+ | "HM"
756
+ | "HN"
757
+ | "HR"
758
+ | "HT"
759
+ | "HU"
760
+ | "ID"
761
+ | "IE"
762
+ | "IL"
763
+ | "IM"
764
+ | "IN"
765
+ | "IO"
766
+ | "IQ"
767
+ | "IR"
768
+ | "IS"
769
+ | "IT"
770
+ | "JE"
771
+ | "JM"
772
+ | "JO"
773
+ | "JP"
774
+ | "KE"
775
+ | "KG"
776
+ | "KH"
777
+ | "KI"
778
+ | "KM"
779
+ | "KN"
780
+ | "KP"
781
+ | "KR"
782
+ | "KW"
783
+ | "KY"
784
+ | "KZ"
785
+ | "LA"
786
+ | "LB"
787
+ | "LC"
788
+ | "LI"
789
+ | "LK"
790
+ | "LR"
791
+ | "LS"
792
+ | "LT"
793
+ | "LU"
794
+ | "LV"
795
+ | "LY"
796
+ | "MA"
797
+ | "MC"
798
+ | "MD"
799
+ | "ME"
800
+ | "MF"
801
+ | "MG"
802
+ | "MH"
803
+ | "MK"
804
+ | "ML"
805
+ | "MM"
806
+ | "MN"
807
+ | "MO"
808
+ | "MP"
809
+ | "MQ"
810
+ | "MR"
811
+ | "MS"
812
+ | "MT"
813
+ | "MU"
814
+ | "MV"
815
+ | "MW"
816
+ | "MX"
817
+ | "MY"
818
+ | "MZ"
819
+ | "NA"
820
+ | "NC"
821
+ | "NE"
822
+ | "NF"
823
+ | "NG"
824
+ | "NI"
825
+ | "NL"
826
+ | "NO"
827
+ | "NP"
828
+ | "NR"
829
+ | "NU"
830
+ | "NZ"
831
+ | "OM"
832
+ | "PA"
833
+ | "PE"
834
+ | "PF"
835
+ | "PG"
836
+ | "PH"
837
+ | "PK"
838
+ | "PL"
839
+ | "PM"
840
+ | "PN"
841
+ | "PR"
842
+ | "PS"
843
+ | "PT"
844
+ | "PW"
845
+ | "PY"
846
+ | "QA"
847
+ | "RE"
848
+ | "RO"
849
+ | "RS"
850
+ | "RU"
851
+ | "RW"
852
+ | "SA"
853
+ | "SB"
854
+ | "SC"
855
+ | "SD"
856
+ | "SE"
857
+ | "SG"
858
+ | "SH"
859
+ | "SI"
860
+ | "SJ"
861
+ | "SK"
862
+ | "SL"
863
+ | "SM"
864
+ | "SN"
865
+ | "SO"
866
+ | "SR"
867
+ | "SS"
868
+ | "ST"
869
+ | "SV"
870
+ | "SX"
871
+ | "SY"
872
+ | "SZ"
873
+ | "TC"
874
+ | "TD"
875
+ | "TF"
876
+ | "TG"
877
+ | "TH"
878
+ | "TJ"
879
+ | "TK"
880
+ | "TL"
881
+ | "TM"
882
+ | "TN"
883
+ | "TO"
884
+ | "TR"
885
+ | "TT"
886
+ | "TV"
887
+ | "TW"
888
+ | "TZ"
889
+ | "UA"
890
+ | "UG"
891
+ | "UM"
892
+ | "US"
893
+ | "UY"
894
+ | "UZ"
895
+ | "VA"
896
+ | "VC"
897
+ | "VE"
898
+ | "VG"
899
+ | "VI"
900
+ | "VN"
901
+ | "VU"
902
+ | "WF"
903
+ | "WS"
904
+ | "YE"
905
+ | "YT"
906
+ | "ZA"
907
+ | "ZM"
908
+ | "ZW";
909
+
910
+ declare type JsonArray = JsonValue[] | readonly JsonValue[];
911
+
912
+ /**
913
+ Matches a JSON object.
914
+ This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
915
+ */
916
+ declare type JsonObject = {
917
+ [Key in string]: JsonValue;
918
+ } & {
919
+ [Key in string]?: JsonValue | undefined;
920
+ };
921
+
922
+ declare type JsonPrimitive = string | number | boolean | null;
923
+
924
+ /**
925
+ Matches any valid JSON value.
926
+ @see `Jsonify` if you need to transform a type to one that is assignable to `JsonValue`.
927
+ */
928
+ declare type JsonValue = JsonPrimitive | JsonObject | JsonArray;
929
+
930
+ /**
931
+ * Logger to be used in the runtime via context.log.
932
+ * You can set per-request properties that will be included in all log entries for this request.
933
+ * @beta
934
+ */
935
+ declare interface Logger extends BaseLogger {
936
+ /**
937
+ * Set properties that will be included in all subsequent log entries for this request.
938
+ * Properties are merged with existing properties and any static fields configured in the logging plugin.
939
+ * Per-request properties take precedence over static fields with the same name.
940
+ *
941
+ * @param properties - Key-value pairs to include in log entries. Values must be string, number, or boolean.
942
+ *
943
+ * @example
944
+ * ```ts
945
+ * export default async function (request: ZuploRequest, context: ZuploContext) {
946
+ * // Set properties that will be included in all logs for this request
947
+ * context.log.setLogProperties({ http_status_code: 400, user_id: "123" });
948
+ *
949
+ * context.log.error("Request failed"); // Will include http_status_code and user_id
950
+ *
951
+ * return new Response("Error", { status: 400 });
952
+ * }
953
+ * ```
954
+ */
955
+ setLogProperties?(
956
+ properties: Record<string, string | number | boolean>
957
+ ): void;
958
+ }
959
+
960
+ /**
961
+ * Any request-type message (known or unknown method).
962
+ *
963
+ * @beta
964
+ */
965
+ export declare type McpAnyRequestMessage =
966
+ | McpKnownRequestMessage
967
+ | McpUnknownRequestMessage;
968
+
969
+ /**
970
+ * Params for `notifications/cancelled`.
971
+ *
972
+ * @beta
973
+ */
974
+ export declare interface McpCancelledParams extends McpParams {
975
+ readonly requestId?: string | number;
976
+ readonly reason?: string;
977
+ }
978
+
979
+ /**
980
+ * A client→server JSON-RPC error — the client answering a server-initiated
981
+ * request with an error. Always forwarded untouched by `processMessages`.
982
+ *
983
+ * @beta
984
+ */
985
+ export declare interface McpClientErrorMessage {
986
+ readonly type: "error";
987
+ readonly method?: never;
988
+ readonly id: McpRequestId | null;
989
+ readonly error: McpErrorDetail;
990
+ readonly params?: never;
991
+ readonly raw: unknown;
992
+ }
993
+
994
+ /**
995
+ * A client→server JSON-RPC result — the client answering a server-initiated
996
+ * request (for example a sampling or elicitation round-trip). These are
997
+ * always forwarded untouched by `processMessages`.
998
+ *
999
+ * @beta
1000
+ */
1001
+ export declare interface McpClientResultMessage {
1002
+ readonly type: "result";
1003
+ readonly method?: never;
1004
+ readonly id: McpRequestId;
1005
+ readonly result: McpResult;
1006
+ readonly params?: never;
1007
+ readonly raw: unknown;
1008
+ }
1009
+
1010
+ /**
1011
+ * Params for `completion/complete`.
1012
+ *
1013
+ * @beta
1014
+ */
1015
+ export declare interface McpCompleteParams extends McpParams {
1016
+ readonly ref?: {
1017
+ readonly type?: string;
1018
+ readonly name?: string;
1019
+ readonly uri?: string;
1020
+ readonly [key: string]: unknown;
1021
+ };
1022
+ readonly argument?: {
1023
+ readonly name?: string;
1024
+ readonly value?: string;
1025
+ readonly [key: string]: unknown;
1026
+ };
1027
+ }
1028
+
1029
+ /**
1030
+ * A parsed view of an MCP HTTP request body.
1031
+ *
1032
+ * @beta
1033
+ */
1034
+ export declare interface McpEnvelope {
1035
+ /** Only JSON bodies are parsed today. */
1036
+ readonly transport: "json";
1037
+ /**
1038
+ * Whether the wire body was a single message or a JSON-RPC batch array.
1039
+ * The runtime preserves this shape when it rewrites the upstream request —
1040
+ * a batch stays a batch, even with one surviving message.
1041
+ */
1042
+ readonly shape: "single" | "batch";
1043
+ /** The messages in wire order. A single body has exactly one entry. */
1044
+ readonly messages: readonly McpMessage[];
1045
+ /**
1046
+ * The MCP protocol version the client declared on the HTTP request
1047
+ * (`MCP-Protocol-Version` header), when present. The runtime never infers
1048
+ * a version from message shapes.
1049
+ */
1050
+ readonly protocolVersion?: string;
1051
+ }
1052
+
1053
+ /**
1054
+ * A JSON-RPC error object.
1055
+ *
1056
+ * @beta
1057
+ */
1058
+ export declare interface McpErrorDetail {
1059
+ readonly code: number;
1060
+ readonly message: string;
1061
+ readonly data?: unknown;
1062
+ }
1063
+
1064
+ /**
1065
+ * A message that reaches `processMessages` handlers. Invalid members never
1066
+ * do — the runtime answers them automatically — and client-supplied JSON-RPC
1067
+ * results/errors are always forwarded untouched.
1068
+ *
1069
+ * @beta
1070
+ */
1071
+ export declare type McpHandlerMessage =
1072
+ | McpKnownRequestMessage
1073
+ | McpUnknownRequestMessage
1074
+ | McpKnownNotificationMessage
1075
+ | McpUnknownNotificationMessage;
1076
+
1077
+ /**
1078
+ * Params for `initialize`. All fields are optional because the gateway
1079
+ * observes traffic rather than validating it against the full MCP schema.
1080
+ *
1081
+ * @beta
1082
+ */
1083
+ export declare interface McpInitializeParams extends McpParams {
1084
+ readonly protocolVersion?: string;
1085
+ readonly capabilities?: Record<string, unknown>;
1086
+ readonly clientInfo?: {
1087
+ readonly name?: string;
1088
+ readonly title?: string;
1089
+ readonly version?: string;
1090
+ readonly [key: string]: unknown;
1091
+ };
1092
+ }
1093
+
1094
+ /**
1095
+ * A body member that is not a usable JSON-RPC message: not an object, missing
1096
+ * `jsonrpc: "2.0"`, a request with a `null` (uncorrelatable) id, or a known
1097
+ * method whose required params are malformed. `error` is the JSON-RPC error
1098
+ * the runtime answers it with — `processMessages` does this automatically and
1099
+ * never dispatches invalid members to handlers.
1100
+ *
1101
+ * @beta
1102
+ */
1103
+ export declare interface McpInvalidMessage {
1104
+ readonly type: "invalid";
1105
+ readonly method?: string;
1106
+ readonly id: McpRequestId | null;
1107
+ readonly error: McpErrorDetail;
1108
+ readonly params?: never;
1109
+ readonly raw: unknown;
1110
+ }
1111
+
1112
+ /**
1113
+ * The union of all known notification messages.
1114
+ *
1115
+ * @beta
1116
+ */
1117
+ export declare type McpKnownNotificationMessage = {
1118
+ [M in McpNotificationMethod]: McpNotificationMessage<M>;
1119
+ }[McpNotificationMethod];
1120
+
1121
+ /**
1122
+ * The union of all known request messages, each with a literal `method`, so
1123
+ * `if`/`switch` on `message.method` narrows `params` to the right shape.
1124
+ *
1125
+ * @beta
1126
+ */
1127
+ export declare type McpKnownRequestMessage = {
1128
+ [M in McpRequestMethod]: McpRequestMessage<M>;
1129
+ }[McpRequestMethod];
1130
+
1131
+ /**
1132
+ * Any message that can appear in a parsed MCP envelope. Narrow on `type`
1133
+ * first; within `"request"`/`"notification"`, narrowing on `method` gives
1134
+ * fully typed params for known methods.
1135
+ *
1136
+ * @beta
1137
+ */
1138
+ export declare type McpMessage =
1139
+ | McpKnownRequestMessage
1140
+ | McpUnknownRequestMessage
1141
+ | McpKnownNotificationMessage
1142
+ | McpUnknownNotificationMessage
1143
+ | McpClientResultMessage
1144
+ | McpClientErrorMessage
1145
+ | McpInvalidMessage;
1146
+
1147
+ /**
1148
+ * The arguments passed to every `processMessages` handler: the parsed
1149
+ * message plus the ordinary Zuplo policy pipeline objects.
1150
+ *
1151
+ * @beta
1152
+ */
1153
+ export declare interface McpMessageHandlerArgs<
1154
+ TMessage extends McpHandlerMessage = McpHandlerMessage,
1155
+ TOptions = unknown,
1156
+ > {
1157
+ readonly message: TMessage;
1158
+ readonly request: ZuploRequest;
1159
+ readonly context: ZuploContext;
1160
+ /** The full parsed envelope, for handlers that need batch siblings. */
1161
+ readonly envelope: McpEnvelope;
1162
+ readonly options: TOptions;
1163
+ readonly policyName: string;
1164
+ }
1165
+
1166
+ /**
1167
+ * What a `processMessages` handler may return for a message:
1168
+ *
1169
+ * - `void` — the message continues unchanged.
1170
+ * - `{ params }` — the message is forwarded with replaced params.
1171
+ * - `{ error }` — the message is answered locally with a JSON-RPC error
1172
+ * (a blocked notification is dropped silently instead — notifications
1173
+ * have no replies).
1174
+ * - `{ result }` — the message is answered locally with a result.
1175
+ *
1176
+ * Raw HTTP `Response` values are deliberately not verdicts: mixing
1177
+ * HTTP-level and message-level outcomes inside a batch is ambiguous. To
1178
+ * gate a whole exchange, use `getRequest` + `createErrorResponse` directly.
1179
+ *
1180
+ * @beta
1181
+ */
1182
+ export declare type McpMessageVerdict =
1183
+ | void
1184
+ | undefined
1185
+ | {
1186
+ readonly params: Record<string, unknown>;
1187
+ }
1188
+ | {
1189
+ readonly error: McpErrorDetail;
1190
+ }
1191
+ | {
1192
+ readonly result: McpResult;
1193
+ };
1194
+
1195
+ /**
1196
+ * A typed MCP notification (a client→server message with no reply).
1197
+ *
1198
+ * @beta
1199
+ */
1200
+ export declare interface McpNotificationMessage<
1201
+ TMethod extends McpNotificationMethod = McpNotificationMethod,
1202
+ > {
1203
+ readonly type: "notification";
1204
+ readonly method: TMethod;
1205
+ readonly id?: never;
1206
+ readonly params: McpNotificationParamsMap[TMethod];
1207
+ readonly raw: unknown;
1208
+ }
1209
+
1210
+ /**
1211
+ * A known client→server notification method.
1212
+ *
1213
+ * @beta
1214
+ */
1215
+ export declare type McpNotificationMethod = keyof McpNotificationParamsMap;
1216
+
1217
+ /**
1218
+ * The client→server notification methods this module types explicitly.
1219
+ *
1220
+ * @beta
1221
+ */
1222
+ export declare interface McpNotificationParamsMap {
1223
+ readonly "notifications/initialized": McpParams;
1224
+ readonly "notifications/cancelled": McpCancelledParams;
1225
+ readonly "notifications/progress": McpProgressParams;
1226
+ readonly "notifications/roots/list_changed": McpParams;
1227
+ }
1228
+
1229
+ /**
1230
+ * Params for paginated list requests (`tools/list`, `prompts/list`, ...).
1231
+ *
1232
+ * @beta
1233
+ */
1234
+ export declare interface McpPaginatedParams extends McpParams {
1235
+ readonly cursor?: string;
1236
+ }
1237
+
1238
+ /**
1239
+ * Base shape for MCP request and notification params. Fields the MCP schema
1240
+ * defines are typed explicitly on each method's params interface; everything
1241
+ * else stays reachable through the index signature (and `message.raw`).
1242
+ *
1243
+ * @beta
1244
+ */
1245
+ export declare interface McpParams {
1246
+ readonly _meta?: Record<string, unknown>;
1247
+ readonly [key: string]: unknown;
1248
+ }
1249
+
1250
+ /**
1251
+ * Configuration for {@link processMessages}. `requests` handles the
1252
+ * client→server phase; response-phase handlers are a later addition.
1253
+ *
1254
+ * @beta
1255
+ */
1256
+ export declare interface McpProcessMessagesConfig<TOptions = unknown> {
1257
+ readonly requests?: McpRequestHandlers<TOptions>;
1258
+ }
1259
+
1260
+ /**
1261
+ * Params for `notifications/progress`.
1262
+ *
1263
+ * @beta
1264
+ */
1265
+ export declare interface McpProgressParams extends McpParams {
1266
+ readonly progressToken?: string | number;
1267
+ readonly progress?: number;
1268
+ readonly total?: number;
1269
+ readonly message?: string;
1270
+ }
1271
+
1272
+ /**
1273
+ * Params for `prompts/get`. `name` is guaranteed by the parser.
1274
+ *
1275
+ * @beta
1276
+ */
1277
+ export declare interface McpPromptGetParams extends McpParams {
1278
+ readonly name: string;
1279
+ readonly arguments?: Record<string, unknown>;
1280
+ }
1281
+
1282
+ /**
1283
+ * The per-method handler map for `processMessages`. Keys are MCP method
1284
+ * names; `"*"` matches any message without a more specific handler. Each
1285
+ * message runs at most one handler.
1286
+ *
1287
+ * @beta
1288
+ */
1289
+ export declare type McpRequestHandlers<TOptions = unknown> = {
1290
+ readonly [M in McpRequestMethod]?: (
1291
+ args: McpMessageHandlerArgs<
1292
+ Extract<
1293
+ McpKnownRequestMessage,
1294
+ {
1295
+ method: M;
1296
+ }
1297
+ >,
1298
+ TOptions
1299
+ >
1300
+ ) => HandlerResult;
1301
+ } & {
1302
+ readonly [M in McpNotificationMethod]?: (
1303
+ args: McpMessageHandlerArgs<
1304
+ Extract<
1305
+ McpKnownNotificationMessage,
1306
+ {
1307
+ method: M;
1308
+ }
1309
+ >,
1310
+ TOptions
1311
+ >
1312
+ ) => HandlerResult;
1313
+ } & {
1314
+ readonly "*"?: (
1315
+ args: McpMessageHandlerArgs<McpHandlerMessage, TOptions>
1316
+ ) => HandlerResult;
1317
+ };
1318
+
1319
+ /**
1320
+ * Zuplo-owned wire model for MCP (Model Context Protocol) JSON-RPC messages.
1321
+ *
1322
+ * These types are structurally compatible with the official MCP schema, but
1323
+ * Zuplo owns the public surface so policy-author code does not track a third
1324
+ * party's release cadence. Every message keeps the untyped wire value on
1325
+ * `raw` as the escape hatch.
1326
+ */
1327
+ /**
1328
+ * A correlatable JSON-RPC request id. JSON-RPC also permits `null`, but a
1329
+ * null id cannot be correlated to a reply, so the parser classifies null-id
1330
+ * requests as {@link McpInvalidMessage} members instead.
1331
+ *
1332
+ * @beta
1333
+ */
1334
+ export declare type McpRequestId = string | number;
1335
+
1336
+ /**
1337
+ * A typed MCP request (a client→server message that expects a reply). For
1338
+ * known methods the parser normalizes absent params to `{}`, so `params` is
1339
+ * always an object.
1340
+ *
1341
+ * @beta
1342
+ */
1343
+ export declare interface McpRequestMessage<
1344
+ TMethod extends McpRequestMethod = McpRequestMethod,
1345
+ > {
1346
+ readonly type: "request";
1347
+ readonly method: TMethod;
1348
+ readonly id: McpRequestId;
1349
+ readonly params: McpRequestParamsMap[TMethod];
1350
+ /** The untyped wire value of this message. */
1351
+ readonly raw: unknown;
1352
+ }
1353
+
1354
+ /**
1355
+ * A known client→server request method.
1356
+ *
1357
+ * @beta
1358
+ */
1359
+ export declare type McpRequestMethod = keyof McpRequestParamsMap;
1360
+
1361
+ /**
1362
+ * The client→server request methods this module types explicitly, mapped to
1363
+ * their params shapes. Unknown or future methods still surface as requests
1364
+ * (with `method: string`); they are never dropped.
1365
+ *
1366
+ * @beta
1367
+ */
1368
+ export declare interface McpRequestParamsMap {
1369
+ readonly initialize: McpInitializeParams;
1370
+ readonly ping: McpParams;
1371
+ readonly "tools/list": McpPaginatedParams;
1372
+ readonly "tools/call": McpToolCallParams;
1373
+ readonly "prompts/list": McpPaginatedParams;
1374
+ readonly "prompts/get": McpPromptGetParams;
1375
+ readonly "resources/list": McpPaginatedParams;
1376
+ readonly "resources/templates/list": McpPaginatedParams;
1377
+ readonly "resources/read": McpResourceParams;
1378
+ readonly "resources/subscribe": McpResourceParams;
1379
+ readonly "resources/unsubscribe": McpResourceParams;
1380
+ readonly "completion/complete": McpCompleteParams;
1381
+ readonly "logging/setLevel": McpSetLevelParams;
1382
+ }
1383
+
1384
+ /**
1385
+ * Params for resource requests that address a resource by URI. `uri` is
1386
+ * guaranteed by the parser.
1387
+ *
1388
+ * @beta
1389
+ */
1390
+ export declare interface McpResourceParams extends McpParams {
1391
+ readonly uri: string;
1392
+ }
1393
+
1394
+ /**
1395
+ * A JSON-RPC result object. MCP results are always JSON objects.
1396
+ *
1397
+ * @beta
1398
+ */
1399
+ export declare type McpResult = Record<string, unknown>;
1400
+
1401
+ /**
1402
+ * Params for `logging/setLevel`. `level` is guaranteed by the parser.
1403
+ *
1404
+ * @beta
1405
+ */
1406
+ export declare interface McpSetLevelParams extends McpParams {
1407
+ readonly level: string;
1408
+ }
1409
+
1410
+ /**
1411
+ * Params for `tools/call`. `name` is guaranteed: a `tools/call` request
1412
+ * without a string `name` is classified as an invalid member instead of a
1413
+ * typed request.
1414
+ *
1415
+ * @beta
1416
+ */
1417
+ export declare interface McpToolCallParams extends McpParams {
1418
+ readonly name: string;
1419
+ readonly arguments?: Record<string, unknown>;
1420
+ }
1421
+
1422
+ /**
1423
+ * A notification whose method this module does not type. Read the wire value
1424
+ * through `raw`.
1425
+ *
1426
+ * @beta
1427
+ */
1428
+ export declare interface McpUnknownNotificationMessage {
1429
+ readonly type: "notification";
1430
+ readonly method: string;
1431
+ readonly id?: never;
1432
+ readonly params: never;
1433
+ readonly raw: unknown;
1434
+ }
1435
+
1436
+ /**
1437
+ * A request whose method this module does not type. The parser guarantees an
1438
+ * unknown request never carries a method listed in {@link McpRequestParamsMap}
1439
+ * (a known method with malformed params becomes an invalid member instead) —
1440
+ * that guarantee is what makes narrowing on `message.method` sound. `params`
1441
+ * is deliberately not part of the typed surface; read the wire value through
1442
+ * `raw`.
1443
+ *
1444
+ * @beta
1445
+ */
1446
+ export declare interface McpUnknownRequestMessage {
1447
+ readonly type: "request";
1448
+ readonly method: string;
1449
+ readonly id: McpRequestId;
1450
+ readonly params: never;
1451
+ readonly raw: unknown;
1452
+ }
1453
+
1454
+ declare type Modify<T, R> = Omit<T, keyof R> & R;
1455
+
1456
+ /**
1457
+ * @public
1458
+ */
1459
+ declare interface OnResponseSendingFinalHook {
1460
+ (
1461
+ response: Response,
1462
+ request: ZuploRequest,
1463
+ context: ZuploContext
1464
+ ): Promise<void> | void;
1465
+ }
1466
+
1467
+ /**
1468
+ * @public
1469
+ */
1470
+ declare interface OnResponseSendingHook {
1471
+ (
1472
+ response: Response,
1473
+ request: ZuploRequest,
1474
+ context: ZuploContext
1475
+ ): Promise<Response> | Response;
1476
+ }
1477
+
1478
+ declare namespace OpenAPIV3 {
1479
+ interface Document<T extends {} = {}> {
1480
+ openapi: string;
1481
+ info: InfoObject;
1482
+ servers?: ServerObject[];
1483
+ paths: PathsObject<T>;
1484
+ components?: ComponentsObject;
1485
+ security?: SecurityRequirementObject[];
1486
+ tags?: TagObject[];
1487
+ externalDocs?: ExternalDocumentationObject;
1488
+ "x-express-openapi-additional-middleware"?: (
1489
+ | ((request: any, response: any, next: any) => Promise<void>)
1490
+ | ((request: any, response: any, next: any) => void)
1491
+ )[];
1492
+ "x-express-openapi-validation-strict"?: boolean;
1493
+ }
1494
+ interface InfoObject {
1495
+ title: string;
1496
+ description?: string;
1497
+ termsOfService?: string;
1498
+ contact?: ContactObject;
1499
+ license?: LicenseObject;
1500
+ version: string;
1501
+ }
1502
+ interface ContactObject {
1503
+ name?: string;
1504
+ url?: string;
1505
+ email?: string;
1506
+ }
1507
+ interface LicenseObject {
1508
+ name: string;
1509
+ url?: string;
1510
+ }
1511
+ interface ServerObject {
1512
+ url: string;
1513
+ description?: string;
1514
+ variables?: {
1515
+ [variable: string]: ServerVariableObject;
1516
+ };
1517
+ }
1518
+ interface ServerVariableObject {
1519
+ enum?: string[];
1520
+ default: string;
1521
+ description?: string;
1522
+ }
1523
+ interface PathsObject<T extends {} = {}, P extends {} = {}> {
1524
+ [pattern: string]: (PathItemObject<T> & P) | undefined;
1525
+ }
1526
+ enum HttpMethods {
1527
+ GET = "get",
1528
+ PUT = "put",
1529
+ POST = "post",
1530
+ DELETE = "delete",
1531
+ OPTIONS = "options",
1532
+ HEAD = "head",
1533
+ PATCH = "patch",
1534
+ TRACE = "trace",
1535
+ }
1536
+ type PathItemObject<T extends {} = {}> = {
1537
+ $ref?: string;
1538
+ summary?: string;
1539
+ description?: string;
1540
+ servers?: ServerObject[];
1541
+ parameters?: (ReferenceObject | ParameterObject)[];
1542
+ } & {
1543
+ [method in HttpMethods]?: OperationObject<T>;
1544
+ };
1545
+ type OperationObject<T extends {} = {}> = {
1546
+ tags?: string[];
1547
+ summary?: string;
1548
+ description?: string;
1549
+ externalDocs?: ExternalDocumentationObject;
1550
+ operationId?: string;
1551
+ parameters?: (ReferenceObject | ParameterObject)[];
1552
+ requestBody?: ReferenceObject | RequestBodyObject;
1553
+ responses: ResponsesObject;
1554
+ callbacks?: {
1555
+ [callback: string]: ReferenceObject | CallbackObject;
1556
+ };
1557
+ deprecated?: boolean;
1558
+ security?: SecurityRequirementObject[];
1559
+ servers?: ServerObject[];
1560
+ } & T;
1561
+ interface ExternalDocumentationObject {
1562
+ description?: string;
1563
+ url: string;
1564
+ }
1565
+ interface ParameterObject extends ParameterBaseObject {
1566
+ name: string;
1567
+ in: string;
1568
+ }
1569
+ interface HeaderObject extends ParameterBaseObject {}
1570
+ interface ParameterBaseObject {
1571
+ description?: string;
1572
+ required?: boolean;
1573
+ deprecated?: boolean;
1574
+ allowEmptyValue?: boolean;
1575
+ style?: string;
1576
+ explode?: boolean;
1577
+ allowReserved?: boolean;
1578
+ schema?: ReferenceObject | SchemaObject;
1579
+ example?: any;
1580
+ examples?: {
1581
+ [media: string]: ReferenceObject | ExampleObject;
1582
+ };
1583
+ content?: {
1584
+ [media: string]: MediaTypeObject;
1585
+ };
1586
+ }
1587
+ type NonArraySchemaObjectType =
1588
+ | "boolean"
1589
+ | "object"
1590
+ | "number"
1591
+ | "string"
1592
+ | "integer";
1593
+ type ArraySchemaObjectType = "array";
1594
+ type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
1595
+ interface ArraySchemaObject extends BaseSchemaObject {
1596
+ type: ArraySchemaObjectType;
1597
+ items: ReferenceObject | SchemaObject;
1598
+ }
1599
+ interface NonArraySchemaObject extends BaseSchemaObject {
1600
+ type?: NonArraySchemaObjectType;
1601
+ }
1602
+ interface BaseSchemaObject {
1603
+ title?: string;
1604
+ description?: string;
1605
+ format?: string;
1606
+ default?: any;
1607
+ multipleOf?: number;
1608
+ maximum?: number;
1609
+ exclusiveMaximum?: boolean;
1610
+ minimum?: number;
1611
+ exclusiveMinimum?: boolean;
1612
+ maxLength?: number;
1613
+ minLength?: number;
1614
+ pattern?: string;
1615
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
1616
+ maxItems?: number;
1617
+ minItems?: number;
1618
+ uniqueItems?: boolean;
1619
+ maxProperties?: number;
1620
+ minProperties?: number;
1621
+ required?: string[];
1622
+ enum?: any[];
1623
+ properties?: {
1624
+ [name: string]: ReferenceObject | SchemaObject;
1625
+ };
1626
+ allOf?: (ReferenceObject | SchemaObject)[];
1627
+ oneOf?: (ReferenceObject | SchemaObject)[];
1628
+ anyOf?: (ReferenceObject | SchemaObject)[];
1629
+ not?: ReferenceObject | SchemaObject;
1630
+ nullable?: boolean;
1631
+ discriminator?: DiscriminatorObject;
1632
+ readOnly?: boolean;
1633
+ writeOnly?: boolean;
1634
+ xml?: XMLObject;
1635
+ externalDocs?: ExternalDocumentationObject;
1636
+ example?: any;
1637
+ deprecated?: boolean;
1638
+ }
1639
+ interface DiscriminatorObject {
1640
+ propertyName: string;
1641
+ mapping?: {
1642
+ [value: string]: string;
1643
+ };
1644
+ }
1645
+ interface XMLObject {
1646
+ name?: string;
1647
+ namespace?: string;
1648
+ prefix?: string;
1649
+ attribute?: boolean;
1650
+ wrapped?: boolean;
1651
+ }
1652
+ interface ReferenceObject {
1653
+ $ref: string;
1654
+ }
1655
+ interface ExampleObject {
1656
+ summary?: string;
1657
+ description?: string;
1658
+ value?: any;
1659
+ externalValue?: string;
1660
+ }
1661
+ interface MediaTypeObject {
1662
+ schema?: ReferenceObject | SchemaObject;
1663
+ example?: any;
1664
+ examples?: {
1665
+ [media: string]: ReferenceObject | ExampleObject;
1666
+ };
1667
+ encoding?: {
1668
+ [media: string]: EncodingObject;
1669
+ };
1670
+ }
1671
+ interface EncodingObject {
1672
+ contentType?: string;
1673
+ headers?: {
1674
+ [header: string]: ReferenceObject | HeaderObject;
1675
+ };
1676
+ style?: string;
1677
+ explode?: boolean;
1678
+ allowReserved?: boolean;
1679
+ }
1680
+ interface RequestBodyObject {
1681
+ description?: string;
1682
+ content: {
1683
+ [media: string]: MediaTypeObject;
1684
+ };
1685
+ required?: boolean;
1686
+ }
1687
+ interface ResponsesObject {
1688
+ [code: string]: ReferenceObject | ResponseObject;
1689
+ }
1690
+ interface ResponseObject {
1691
+ description: string;
1692
+ headers?: {
1693
+ [header: string]: ReferenceObject | HeaderObject;
1694
+ };
1695
+ content?: {
1696
+ [media: string]: MediaTypeObject;
1697
+ };
1698
+ links?: {
1699
+ [link: string]: ReferenceObject | LinkObject;
1700
+ };
1701
+ }
1702
+ interface LinkObject {
1703
+ operationRef?: string;
1704
+ operationId?: string;
1705
+ parameters?: {
1706
+ [parameter: string]: any;
1707
+ };
1708
+ requestBody?: any;
1709
+ description?: string;
1710
+ server?: ServerObject;
1711
+ }
1712
+ interface CallbackObject {
1713
+ [url: string]: PathItemObject;
1714
+ }
1715
+ interface SecurityRequirementObject {
1716
+ [name: string]: string[];
1717
+ }
1718
+ interface ComponentsObject {
1719
+ schemas?: {
1720
+ [key: string]: ReferenceObject | SchemaObject;
1721
+ };
1722
+ responses?: {
1723
+ [key: string]: ReferenceObject | ResponseObject;
1724
+ };
1725
+ parameters?: {
1726
+ [key: string]: ReferenceObject | ParameterObject;
1727
+ };
1728
+ examples?: {
1729
+ [key: string]: ReferenceObject | ExampleObject;
1730
+ };
1731
+ requestBodies?: {
1732
+ [key: string]: ReferenceObject | RequestBodyObject;
1733
+ };
1734
+ headers?: {
1735
+ [key: string]: ReferenceObject | HeaderObject;
1736
+ };
1737
+ securitySchemes?: {
1738
+ [key: string]: ReferenceObject | SecuritySchemeObject;
1739
+ };
1740
+ links?: {
1741
+ [key: string]: ReferenceObject | LinkObject;
1742
+ };
1743
+ callbacks?: {
1744
+ [key: string]: ReferenceObject | CallbackObject;
1745
+ };
1746
+ }
1747
+ type SecuritySchemeObject =
1748
+ | HttpSecurityScheme
1749
+ | ApiKeySecurityScheme
1750
+ | OAuth2SecurityScheme
1751
+ | OpenIdSecurityScheme;
1752
+ interface HttpSecurityScheme {
1753
+ type: "http";
1754
+ description?: string;
1755
+ scheme: string;
1756
+ bearerFormat?: string;
1757
+ }
1758
+ interface ApiKeySecurityScheme {
1759
+ type: "apiKey";
1760
+ description?: string;
1761
+ name: string;
1762
+ in: string;
1763
+ }
1764
+ interface OAuth2SecurityScheme {
1765
+ type: "oauth2";
1766
+ description?: string;
1767
+ flows: {
1768
+ implicit?: {
1769
+ authorizationUrl: string;
1770
+ refreshUrl?: string;
1771
+ scopes: {
1772
+ [scope: string]: string;
1773
+ };
1774
+ };
1775
+ password?: {
1776
+ tokenUrl: string;
1777
+ refreshUrl?: string;
1778
+ scopes: {
1779
+ [scope: string]: string;
1780
+ };
1781
+ };
1782
+ clientCredentials?: {
1783
+ tokenUrl: string;
1784
+ refreshUrl?: string;
1785
+ scopes: {
1786
+ [scope: string]: string;
1787
+ };
1788
+ };
1789
+ authorizationCode?: {
1790
+ authorizationUrl: string;
1791
+ tokenUrl: string;
1792
+ refreshUrl?: string;
1793
+ scopes: {
1794
+ [scope: string]: string;
1795
+ };
1796
+ };
1797
+ };
1798
+ }
1799
+ interface OpenIdSecurityScheme {
1800
+ type: "openIdConnect";
1801
+ description?: string;
1802
+ openIdConnectUrl: string;
1803
+ }
1804
+ interface TagObject {
1805
+ name: string;
1806
+ description?: string;
1807
+ externalDocs?: ExternalDocumentationObject;
1808
+ }
1809
+ }
1810
+
1811
+ declare namespace OpenAPIV3_1 {
1812
+ type Modify<T, R> = Omit<T, keyof R> & R;
1813
+ type PathsWebhooksComponents<T extends {} = {}> = {
1814
+ paths: PathsObject<T>;
1815
+ webhooks: Record<string, PathItemObject | ReferenceObject>;
1816
+ components: ComponentsObject;
1817
+ };
1818
+ type Document<T extends {} = {}> = Modify<
1819
+ Omit<OpenAPIV3.Document<T>, "paths" | "components">,
1820
+ {
1821
+ info: InfoObject;
1822
+ jsonSchemaDialect?: string;
1823
+ servers?: ServerObject[];
1824
+ } & (
1825
+ | (Pick<PathsWebhooksComponents<T>, "paths"> &
1826
+ Omit<Partial<PathsWebhooksComponents<T>>, "paths">)
1827
+ | (Pick<PathsWebhooksComponents<T>, "webhooks"> &
1828
+ Omit<Partial<PathsWebhooksComponents<T>>, "webhooks">)
1829
+ | (Pick<PathsWebhooksComponents<T>, "components"> &
1830
+ Omit<Partial<PathsWebhooksComponents<T>>, "components">)
1831
+ )
1832
+ >;
1833
+ type InfoObject = Modify<
1834
+ OpenAPIV3.InfoObject,
1835
+ {
1836
+ summary?: string;
1837
+ license?: LicenseObject;
1838
+ }
1839
+ >;
1840
+ type ContactObject = OpenAPIV3.ContactObject;
1841
+ type LicenseObject = Modify<
1842
+ OpenAPIV3.LicenseObject,
1843
+ {
1844
+ identifier?: string;
1845
+ }
1846
+ >;
1847
+ type ServerObject = Modify<
1848
+ OpenAPIV3.ServerObject,
1849
+ {
1850
+ url: string;
1851
+ description?: string;
1852
+ variables?: Record<string, ServerVariableObject>;
1853
+ }
1854
+ >;
1855
+ type ServerVariableObject = Modify<
1856
+ OpenAPIV3.ServerVariableObject,
1857
+ {
1858
+ enum?: [string, ...string[]];
1859
+ }
1860
+ >;
1861
+ type PathsObject<T extends {} = {}, P extends {} = {}> = Record<
1862
+ string,
1863
+ (PathItemObject<T> & P) | undefined
1864
+ >;
1865
+ type HttpMethods = OpenAPIV3.HttpMethods;
1866
+ type PathItemObject<T extends {} = {}> = Modify<
1867
+ OpenAPIV3.PathItemObject<T>,
1868
+ {
1869
+ servers?: ServerObject[];
1870
+ parameters?: (ReferenceObject | ParameterObject)[];
1871
+ }
1872
+ > & {
1873
+ [method in HttpMethods]?: OperationObject<T>;
1874
+ };
1875
+ type OperationObject<T extends {} = {}> = Modify<
1876
+ OpenAPIV3.OperationObject<T>,
1877
+ {
1878
+ parameters?: (ReferenceObject | ParameterObject)[];
1879
+ requestBody?: ReferenceObject | RequestBodyObject;
1880
+ responses?: ResponsesObject;
1881
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
1882
+ servers?: ServerObject[];
1883
+ }
1884
+ > &
1885
+ T;
1886
+ type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
1887
+ type ParameterObject = OpenAPIV3.ParameterObject;
1888
+ type HeaderObject = OpenAPIV3.HeaderObject;
1889
+ type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
1890
+ type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | "null";
1891
+ type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
1892
+ /**
1893
+ * There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
1894
+ * 'items' will be always visible as optional
1895
+ * Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
1896
+ */
1897
+ type SchemaObject =
1898
+ | ArraySchemaObject
1899
+ | NonArraySchemaObject
1900
+ | MixedSchemaObject;
1901
+ interface ArraySchemaObject extends BaseSchemaObject {
1902
+ type: ArraySchemaObjectType;
1903
+ items: ReferenceObject | SchemaObject;
1904
+ }
1905
+ interface NonArraySchemaObject extends BaseSchemaObject {
1906
+ type?: NonArraySchemaObjectType;
1907
+ }
1908
+ interface MixedSchemaObject extends BaseSchemaObject {
1909
+ type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
1910
+ items?: ReferenceObject | SchemaObject;
1911
+ }
1912
+ type BaseSchemaObject = Modify<
1913
+ Omit<OpenAPIV3.BaseSchemaObject, "nullable">,
1914
+ {
1915
+ examples?: OpenAPIV3.BaseSchemaObject["example"][];
1916
+ exclusiveMinimum?: boolean | number;
1917
+ exclusiveMaximum?: boolean | number;
1918
+ contentMediaType?: string;
1919
+ $schema?: string;
1920
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
1921
+ properties?: {
1922
+ [name: string]: ReferenceObject | SchemaObject;
1923
+ };
1924
+ allOf?: (ReferenceObject | SchemaObject)[];
1925
+ oneOf?: (ReferenceObject | SchemaObject)[];
1926
+ anyOf?: (ReferenceObject | SchemaObject)[];
1927
+ not?: ReferenceObject | SchemaObject;
1928
+ discriminator?: DiscriminatorObject;
1929
+ externalDocs?: ExternalDocumentationObject;
1930
+ xml?: XMLObject;
1931
+ const?: any;
1932
+ }
1933
+ >;
1934
+ type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
1935
+ type XMLObject = OpenAPIV3.XMLObject;
1936
+ type ReferenceObject = Modify<
1937
+ OpenAPIV3.ReferenceObject,
1938
+ {
1939
+ summary?: string;
1940
+ description?: string;
1941
+ }
1942
+ >;
1943
+ type ExampleObject = OpenAPIV3.ExampleObject;
1944
+ type MediaTypeObject = Modify<
1945
+ OpenAPIV3.MediaTypeObject,
1946
+ {
1947
+ schema?: SchemaObject | ReferenceObject;
1948
+ examples?: Record<string, ReferenceObject | ExampleObject>;
1949
+ }
1950
+ >;
1951
+ type EncodingObject = OpenAPIV3.EncodingObject;
1952
+ type RequestBodyObject = Modify<
1953
+ OpenAPIV3.RequestBodyObject,
1954
+ {
1955
+ content: {
1956
+ [media: string]: MediaTypeObject;
1957
+ };
1958
+ }
1959
+ >;
1960
+ type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
1961
+ type ResponseObject = Modify<
1962
+ OpenAPIV3.ResponseObject,
1963
+ {
1964
+ headers?: {
1965
+ [header: string]: ReferenceObject | HeaderObject;
1966
+ };
1967
+ content?: {
1968
+ [media: string]: MediaTypeObject;
1969
+ };
1970
+ links?: {
1971
+ [link: string]: ReferenceObject | LinkObject;
1972
+ };
1973
+ }
1974
+ >;
1975
+ type LinkObject = Modify<
1976
+ OpenAPIV3.LinkObject,
1977
+ {
1978
+ server?: ServerObject;
1979
+ }
1980
+ >;
1981
+ type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
1982
+ type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
1983
+ type ComponentsObject = Modify<
1984
+ OpenAPIV3.ComponentsObject,
1985
+ {
1986
+ schemas?: Record<string, SchemaObject>;
1987
+ responses?: Record<string, ReferenceObject | ResponseObject>;
1988
+ parameters?: Record<string, ReferenceObject | ParameterObject>;
1989
+ examples?: Record<string, ReferenceObject | ExampleObject>;
1990
+ requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
1991
+ headers?: Record<string, ReferenceObject | HeaderObject>;
1992
+ securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
1993
+ links?: Record<string, ReferenceObject | LinkObject>;
1994
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
1995
+ pathItems?: Record<string, ReferenceObject | PathItemObject>;
1996
+ }
1997
+ >;
1998
+ type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
1999
+ type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
2000
+ type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
2001
+ type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
2002
+ type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
2003
+ type TagObject = OpenAPIV3.TagObject;
2004
+ {
2005
+ }
2006
+ }
2007
+
2008
+ /**
2009
+ * Base object for parameter definitions
2010
+ * @public
2011
+ */
2012
+ declare type ParameterBaseObject = Modify<
2013
+ Omit<
2014
+ OpenAPIV3_1.ParameterBaseObject,
2015
+ | "content"
2016
+ | "allowEmptyValue"
2017
+ | "style"
2018
+ | "allowReserved"
2019
+ | "explode"
2020
+ | "example"
2021
+ | "examples"
2022
+ >,
2023
+ {
2024
+ schema: OpenAPIV3_1.SchemaObject;
2025
+ }
2026
+ >;
2027
+
2028
+ /**
2029
+ * Definition of a parameter
2030
+ * @public
2031
+ */
2032
+ declare interface ParameterDefinition extends ParameterBaseObject {
2033
+ name: string;
2034
+ in: string;
2035
+ }
2036
+
2037
+ /**
2038
+ * Build an inbound policy handler that runs per-message MCP logic while the
2039
+ * runtime owns the batch mechanics.
2040
+ *
2041
+ * The runtime parses the envelope once, runs at most one handler per message
2042
+ * (exact method key first, then `"*"`), forwards surviving messages —
2043
+ * preserving the wire shape, so a batch stays a batch — correlates upstream
2044
+ * replies by JSON-RPC id, inserts locally generated errors and results, and
2045
+ * rebuilds the response in the original request order.
2046
+ *
2047
+ * Contracts:
2048
+ *
2049
+ * - Invalid members (no `jsonrpc: "2.0"`, null/malformed ids, known methods
2050
+ * with malformed required params) are answered automatically and never
2051
+ * reach handlers.
2052
+ * - A batch containing duplicate request ids is rejected before forwarding —
2053
+ * stitching duplicates would be guesswork.
2054
+ * - A thrown handler fails only its own message (`-32603`); siblings
2055
+ * continue. The thrown error is logged, never sent to the client.
2056
+ * - Blocked notifications are dropped silently (notifications have no
2057
+ * replies).
2058
+ * - Client-supplied JSON-RPC results/errors are forwarded untouched.
2059
+ * - If every message resolves locally the upstream is never called.
2060
+ * - Non-MCP bodies pass through untouched.
2061
+ *
2062
+ * @beta
2063
+ */
2064
+ export declare function processMessages<TOptions = unknown>(
2065
+ config: McpProcessMessagesConfig<TOptions>
2066
+ ): InboundPolicyHandler<TOptions>;
2067
+
2068
+ /**
2069
+ * Generic type parameters for a request.
2070
+ * Extends RequestInitGeneric and adds query parameter typing.
2071
+ * @public
2072
+ */
2073
+ declare interface RequestGeneric extends RequestInitGeneric {
2074
+ Query?: RequestQueryDefault;
2075
+ }
2076
+
2077
+ /**
2078
+ * Generic type parameters for request initialization.
2079
+ * Used to strongly type the user data and path parameters.
2080
+ * @public
2081
+ */
2082
+ declare interface RequestInitGeneric {
2083
+ UserData?: UserDataDefault;
2084
+ Params?: RequestParamsDefault;
2085
+ }
2086
+
2087
+ declare type RequestParamsDefault = Record<string, string>;
2088
+
2089
+ declare type RequestQueryDefault = Record<string, string>;
2090
+
2091
+ /**
2092
+ * Represents an authenticated user on the request.
2093
+ * Set by authentication policies like API key, JWT, or OAuth.
2094
+ *
2095
+ * @public
2096
+ * @example
2097
+ * ```typescript
2098
+ * // Access user info in a handler
2099
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
2100
+ * if (!request.user) {
2101
+ * return new Response("Unauthorized", { status: 401 });
2102
+ * }
2103
+ *
2104
+ * const userId = request.user.sub;
2105
+ * const customData = request.user.data as { role: string; tenantId: string };
2106
+ *
2107
+ * context.log.info(`Request from user ${userId} with role ${customData.role}`);
2108
+ * }
2109
+ * ```
2110
+ */
2111
+ declare interface RequestUser<TUserData> {
2112
+ sub: string;
2113
+ data: TUserData;
2114
+ }
2115
+
2116
+ declare type ResolveRequestParams<
2117
+ TParams extends RequestParamsDefault | undefined,
2118
+ > = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
2119
+
2120
+ declare type ResolveRequestQuery<
2121
+ TQuery extends RequestQueryDefault | undefined,
2122
+ > = TQuery extends RequestQueryDefault ? TQuery : RequestQueryDefault;
2123
+
2124
+ declare type ResolveUserData<TUserData extends UserDataDefault | undefined> =
2125
+ TUserData extends UserDataDefault ? TUserData : UserDataDefault;
2126
+
2127
+ /**
2128
+ * Definition of responses for a route
2129
+ * @public
2130
+ */
2131
+ declare type ResponsesDefinition = Record<
2132
+ HttpStatusCode | HttpStatusCodeRangeDefinition,
2133
+ Modify<
2134
+ Omit<OpenAPIV3_1.ResponseObject, "links">,
2135
+ {
2136
+ headers?: {
2137
+ [header: string]: ParameterBaseObject;
2138
+ };
2139
+ }
2140
+ >
2141
+ >;
2142
+
2143
+ /**
2144
+ * @public
2145
+ */
2146
+ declare interface RouteConfiguration extends Omit<
2147
+ BuildRouteConfiguration,
2148
+ "raw"
2149
+ > {
2150
+ /**
2151
+ * @deprecated Please switch to "raw().operationId"
2152
+ */
2153
+ operationId?: string;
2154
+ /**
2155
+ * @deprecated Please switch to "raw().summary"
2156
+ */
2157
+ summary?: string;
2158
+ /**
2159
+ * @deprecated Please switch to "raw().tags"
2160
+ */
2161
+ tags?: string[];
2162
+ /**
2163
+ * @deprecated Please switch to "raw().parameters"
2164
+ */
2165
+ parameters?: ParameterDefinition[];
2166
+ /**
2167
+ * @deprecated Please switch to "raw().responses"
2168
+ */
2169
+ responses?: ResponsesDefinition;
2170
+ /**
2171
+ * Gets the raw route configuration object
2172
+ */
2173
+ raw<T = any>(): T;
2174
+ }
2175
+
2176
+ declare type UserDataDefault = any;
2177
+
2178
+ /**
2179
+ * @public
2180
+ */
2181
+ declare interface WaitUntilFunc {
2182
+ (promise: Promise<any>): void;
2183
+ }
2184
+
2185
+ declare interface ZuploAnalyticsContext {
2186
+ addAnalyticsEvent(
2187
+ value: number,
2188
+ eventType: EventType,
2189
+ metadata: JsonObject,
2190
+ unit?: string,
2191
+ eventId?: string
2192
+ ): void;
2193
+ flushAnalyticsEvents(): ZuploAnalyticsEvent[];
2194
+ getAnalyticsEvents(): ZuploAnalyticsEvent[];
2195
+ }
2196
+
2197
+ declare interface ZuploAnalyticsEvent<T extends JsonObject = JsonObject> {
2198
+ eventId: string;
2199
+ requestId: string;
2200
+ timestamp: Date;
2201
+ accountName: string;
2202
+ projectName: string;
2203
+ deploymentName: string;
2204
+ eventType: EventType;
2205
+ metadata: T;
2206
+ unit?: string;
2207
+ value: number;
2208
+ }
2209
+
2210
+ /**
2211
+ * The ZuploContext provides information about the current request and helper methods.
2212
+ * @public
2213
+ */
2214
+ declare interface ZuploContext extends EventTarget {
2215
+ /**
2216
+ * The unique identifier of this context
2217
+ */
2218
+ readonly contextId: Readonly<string>;
2219
+ /**
2220
+ * The unique identifier of the incoming request
2221
+ */
2222
+ readonly requestId: Readonly<string>;
2223
+ /**
2224
+ * Request based logger
2225
+ */
2226
+ readonly log: Readonly<Logger>;
2227
+ /**
2228
+ * The route that is being processed
2229
+ */
2230
+ readonly route: Readonly<RouteConfiguration>;
2231
+ /**
2232
+ * Custom data stored on the ZuploContext
2233
+ */
2234
+ readonly custom: Record<string, any>;
2235
+ readonly incomingRequestProperties: IncomingRequestProperties;
2236
+ /**
2237
+ * The parent context that spawned this context
2238
+ * @beta
2239
+ */
2240
+ readonly parentContext: ZuploContext | undefined;
2241
+ /* Excluded from this release type: analyticsContext */
2242
+ readonly invokeInboundPolicy: (
2243
+ policyName: string,
2244
+ request: ZuploRequest
2245
+ ) => Promise<Response | ZuploRequest>;
2246
+ readonly invokeOutboundPolicy: (
2247
+ policyName: string,
2248
+ response: Response,
2249
+ request: ZuploRequest
2250
+ ) => Promise<Response>;
2251
+ /**
2252
+ * Invokes a route based on a Request without going back out to HTTP.
2253
+ * Can take a relative route path to invoke on the Gateway
2254
+ * Example: "/my/route" will invoke http://localhost/my/route on the Gateway
2255
+ * without having to rebuild the Request's protocol and host.
2256
+ * @beta
2257
+ */
2258
+ readonly invokeRoute: <TOptions extends RequestGeneric = RequestGeneric>(
2259
+ input: string | URL | Request,
2260
+ init?: ZuploRequestInit<TOptions>
2261
+ ) => Promise<Response>;
2262
+ readonly waitUntil: WaitUntilFunc;
2263
+ /**
2264
+ * Fires just before the response is sent. Response can be modified.
2265
+ */
2266
+ readonly addResponseSendingHook: (hook: OnResponseSendingHook) => void;
2267
+ /**
2268
+ * Fires immediately after the response is sent. Response cannot be modified.
2269
+ */
2270
+ readonly addResponseSendingFinalHook: (
2271
+ hook: OnResponseSendingFinalHook
2272
+ ) => void;
2273
+ /**
2274
+ * 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.
2275
+ *
2276
+ * 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.
2277
+ *
2278
+ * 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.
2279
+ *
2280
+ * 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.
2281
+ *
2282
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
2283
+ *
2284
+ * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
2285
+ *
2286
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
2287
+ * @deprecated This will be removed in the future. Use hooks instead. See {@link https://zuplo.com/docs/programmable-api/runtime-extensions}
2288
+ */
2289
+ addEventListener<Type extends keyof Record<string, Event>>(
2290
+ type: Type,
2291
+ handler: EventListenerOrEventListenerObject,
2292
+ options?: AddEventListenerOptions | boolean
2293
+ ): void;
2294
+ /**
2295
+ * @deprecated This will be removed in the future. See {@link https://zuplo.com/docs/programmable-api/runtime-extensions}
2296
+ */
2297
+ removeEventListener<Type extends keyof Record<string, Event>>(
2298
+ type: Type,
2299
+ handler: EventListenerOrEventListenerObject,
2300
+ options?: AddEventListenerOptions | boolean
2301
+ ): void;
2302
+ }
2303
+
2304
+ /**
2305
+ * Enhanced Request class that extends the standard Web Request API with
2306
+ * convenient properties for accessing path parameters, query strings, and user data.
2307
+ * This is the request type passed to all handlers and policies in Zuplo.
2308
+ *
2309
+ * @public
2310
+ * @example
2311
+ * ```typescript
2312
+ * import { ZuploRequest, ZuploContext } from "@zuplo/runtime";
2313
+ *
2314
+ * export function myHandler(request: ZuploRequest, context: ZuploContext) {
2315
+ * // Access query parameters
2316
+ * const page = request.query.page || "1";
2317
+ * const limit = request.query.limit || "10";
2318
+ *
2319
+ * // Access path parameters (e.g., from /users/:userId)
2320
+ * const userId = request.params.userId;
2321
+ *
2322
+ * // Access authenticated user
2323
+ * const user = request.user;
2324
+ *
2325
+ * // Standard Request properties still available
2326
+ * const contentType = request.headers.get("content-type");
2327
+ * const method = request.method;
2328
+ *
2329
+ * return Response.json({
2330
+ * userId,
2331
+ * page,
2332
+ * limit,
2333
+ * authenticated: !!user
2334
+ * });
2335
+ * }
2336
+ * ```
2337
+ *
2338
+ * @example
2339
+ * ```typescript
2340
+ * // Strongly typed request parameters
2341
+ * interface MyParams {
2342
+ * userId: string;
2343
+ * orderId: string;
2344
+ * }
2345
+ *
2346
+ * interface MyQuery {
2347
+ * include?: string;
2348
+ * format?: "json" | "xml";
2349
+ * }
2350
+ *
2351
+ * interface MyUserData {
2352
+ * role: "admin" | "user";
2353
+ * tenantId: string;
2354
+ * }
2355
+ *
2356
+ * type MyRequest = ZuploRequest<{
2357
+ * Params: MyParams;
2358
+ * Query: MyQuery;
2359
+ * UserData: MyUserData;
2360
+ * }>;
2361
+ *
2362
+ * export function typedHandler(request: MyRequest, context: ZuploContext) {
2363
+ * // All properties are now strongly typed
2364
+ * const userId = request.params.userId; // string
2365
+ * const format = request.query.format; // "json" | "xml" | undefined
2366
+ * const role = request.user?.data.role; // "admin" | "user" | undefined
2367
+ * }
2368
+ * ```
2369
+ */
2370
+ declare class ZuploRequest<
2371
+ TOptions extends RequestGeneric = RequestGeneric,
2372
+ > extends Request {
2373
+ #private;
2374
+ constructor(
2375
+ input: string | URL | Request,
2376
+ init?: ZuploRequestInit<TOptions>,
2377
+ originalRequest?: Request
2378
+ );
2379
+ /* Excluded from this release type: originalRequest */
2380
+ /**
2381
+ * A dictionary of query-string values
2382
+ *
2383
+ * @example
2384
+ * The url `https://example.com?foo=bar` would return
2385
+ * the following query object:
2386
+ *
2387
+ * ```
2388
+ * const foo = request.query.foo;
2389
+ * ```
2390
+ *
2391
+ * @readonly
2392
+ */
2393
+ get query(): Readonly<ResolveRequestQuery<TOptions["Query"]>>;
2394
+ /**
2395
+ * If you use tokens in your route’s URL, they are
2396
+ * automatically parsed into properties on the params
2397
+ * property of your request.
2398
+ *
2399
+ * @example
2400
+ * The route `/products/:productId/vendors/:vendorId`
2401
+ * would include two params:
2402
+ *
2403
+ * ```
2404
+ * const productId = request.params.productId;
2405
+ * const vendorId = request.params.vendorId;
2406
+ * ```
2407
+ * @readonly
2408
+ */
2409
+ get params(): Readonly<ResolveRequestParams<TOptions["Params"]>>;
2410
+ /**
2411
+ * An optional object identifying a ‘user’.
2412
+ *
2413
+ * @remarks
2414
+ * If undefined this typically means the request is
2415
+ * anonymous. If present, the user object will have
2416
+ * a sub property that is a unique identifier for
2417
+ * that user. There is also an optional data property
2418
+ * that is of any type that typically contains other
2419
+ * information about the user. When using JWT tokens
2420
+ * you’ll usually find all the claims here.
2421
+ *
2422
+ * @readonly
2423
+ */
2424
+ user?: RequestUser<ResolveUserData<TOptions["UserData"]>>;
2425
+ }
2426
+
2427
+ /**
2428
+ * Options for creating a new ZuploRequest.
2429
+ * Extends the standard RequestInit with Zuplo-specific properties.
2430
+ * @public
2431
+ */
2432
+ declare interface ZuploRequestInit<
2433
+ TOptions extends RequestInitGeneric = RequestInitGeneric,
2434
+ > extends RequestInit {
2435
+ params?: ResolveRequestParams<TOptions["Params"]>;
2436
+ user?: ResolveUserData<TOptions["UserData"]>;
2437
+ }
2438
+
2439
+ export {};