@zuplo/cli 7.13.10 → 7.13.13

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 (64) hide show
  1. package/node_modules/@posthog/core/dist/cookie.d.ts +4 -0
  2. package/node_modules/@posthog/core/dist/cookie.d.ts.map +1 -1
  3. package/node_modules/@posthog/core/dist/cookie.js +8 -2
  4. package/node_modules/@posthog/core/dist/cookie.mjs +8 -2
  5. package/node_modules/@posthog/core/dist/utils/bot-detection.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/utils/bot-detection.js +1 -0
  7. package/node_modules/@posthog/core/dist/utils/bot-detection.mjs +1 -0
  8. package/node_modules/@posthog/core/package.json +2 -2
  9. package/node_modules/@posthog/core/src/cookie.ts +13 -2
  10. package/node_modules/@posthog/core/src/utils/bot-detection.spec.ts +7 -0
  11. package/node_modules/@posthog/core/src/utils/bot-detection.ts +1 -0
  12. package/node_modules/@zuplo/core/customer.cli.minified.js +332 -332
  13. package/node_modules/@zuplo/core/index.minified.js +320 -320
  14. package/node_modules/@zuplo/core/package.json +1 -1
  15. package/node_modules/@zuplo/graphql/package.json +1 -1
  16. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  17. package/node_modules/@zuplo/otel/package.json +1 -1
  18. package/node_modules/@zuplo/runtime/out/esm/{chunk-SXGSDVGB.js → chunk-3DWWKPBI.js} +85 -85
  19. package/node_modules/@zuplo/runtime/out/esm/chunk-3DWWKPBI.js.map +1 -0
  20. package/node_modules/@zuplo/runtime/out/esm/{chunk-PXS4NOKU.js → chunk-KA4STQE7.js} +17 -17
  21. package/node_modules/@zuplo/runtime/out/esm/chunk-KA4STQE7.js.map +1 -0
  22. package/node_modules/@zuplo/runtime/out/esm/chunk-VP5Q3DEN.js +26 -0
  23. package/node_modules/@zuplo/runtime/out/esm/chunk-VP5Q3DEN.js.map +1 -0
  24. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  25. package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
  26. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  27. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  28. package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
  29. package/node_modules/@zuplo/runtime/out/types/index.d.ts +60 -0
  30. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +119 -0
  31. package/node_modules/@zuplo/runtime/package.json +1 -1
  32. package/node_modules/express-rate-limit/dist/index.cjs +1 -1
  33. package/node_modules/express-rate-limit/dist/index.mjs +1 -1
  34. package/node_modules/express-rate-limit/package.json +1 -1
  35. package/node_modules/ip-address/README.md +39 -39
  36. package/node_modules/ip-address/dist/ipv6.js +1 -1
  37. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  38. package/node_modules/ip-address/package.json +1 -1
  39. package/node_modules/thread-stream/.github/workflows/ci.yml +1 -1
  40. package/node_modules/thread-stream/SECURITY.md +77 -0
  41. package/node_modules/thread-stream/index.d.ts +2 -1
  42. package/node_modules/thread-stream/index.js +65 -7
  43. package/node_modules/thread-stream/lib/wait.js +23 -5
  44. package/node_modules/thread-stream/package.json +10 -5
  45. package/node_modules/thread-stream/test/create-and-exit.js +1 -1
  46. package/node_modules/thread-stream/test/end.test.js +35 -0
  47. package/node_modules/thread-stream/test/error-flush.test.js +96 -0
  48. package/node_modules/thread-stream/test/error-immediate.js +17 -0
  49. package/node_modules/thread-stream/test/flush-ref-keeps-alive.js +23 -0
  50. package/node_modules/thread-stream/test/flush-unref-exit.js +23 -0
  51. package/node_modules/thread-stream/test/ready-race-worker.js +22 -0
  52. package/node_modules/thread-stream/test/ready.test.js +46 -0
  53. package/node_modules/thread-stream/test/thread-management.test.js +68 -0
  54. package/node_modules/thread-stream/test/to-file-sync.js +23 -0
  55. package/node_modules/thread-stream/test/types/index.test-d.ts +26 -0
  56. package/node_modules/thread-stream/test/wait.test.js +131 -0
  57. package/package.json +11 -11
  58. package/node_modules/@zuplo/runtime/out/esm/chunk-PXS4NOKU.js.map +0 -1
  59. package/node_modules/@zuplo/runtime/out/esm/chunk-SXGSDVGB.js.map +0 -1
  60. package/node_modules/@zuplo/runtime/out/esm/chunk-ZCJ5QBVD.js +0 -26
  61. package/node_modules/@zuplo/runtime/out/esm/chunk-ZCJ5QBVD.js.map +0 -1
  62. package/node_modules/thread-stream/.claude/settings.local.json +0 -15
  63. /package/node_modules/@zuplo/runtime/out/esm/{chunk-SXGSDVGB.js.LEGAL.txt → chunk-3DWWKPBI.js.LEGAL.txt} +0 -0
  64. /package/node_modules/@zuplo/runtime/out/esm/{chunk-PXS4NOKU.js.LEGAL.txt → chunk-KA4STQE7.js.LEGAL.txt} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{G as p,L as c,O as u}from"../chunk-SXGSDVGB.js";import"../chunk-ZCJ5QBVD.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import{aa as i}from"../chunk-PXS4NOKU.js";import"../chunk-UKQQD2JN.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{G as p,L as c,O as u}from"../chunk-3DWWKPBI.js";import"../chunk-VP5Q3DEN.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import{aa as i}from"../chunk-KA4STQE7.js";import"../chunk-UKQQD2JN.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{Ia as a,Ja as l,Ka as c,La as o,Oa as p,Pa as y,Qa as m}from"../../chunk-PXS4NOKU.js";import"../../chunk-UKQQD2JN.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
25
+ import{Ia as a,Ja as l,Ka as c,La as o,Oa as p,Pa as y,Qa as m}from"../../chunk-KA4STQE7.js";import"../../chunk-UKQQD2JN.js";import{a as i}from"../../chunk-TYV53J3B.js";async function g(r,e){let t=typeof e.credentials=="function"?await e.credentials():e.credentials,n=r.method,d=n!=="GET"&&n!=="HEAD"&&r.body!=null?await r.arrayBuffer():null,s=await new o({method:n,url:r.url,headers:r.headers,body:d,accessKeyId:t.accessKeyId,secretAccessKey:t.secretAccessKey,sessionToken:t.sessionToken,service:e.service,region:e.region,signQuery:e.signQuery}).sign();return new Request(s.url.toString(),{method:s.method,headers:s.headers,body:s.body})}i(g,"signRequest");export{c as AwsClient,o as AwsV4Signer,p as fromTemporaryCredentials,y as fromWebToken,m as fromZuploIdentity,l as getAwsCredentialProvider,a as setAwsCredentialProvider,g as signRequest};
26
26
  //# sourceMappingURL=index.js.map
@@ -4277,6 +4277,40 @@ declare interface CompatibilityFlags {
4277
4277
  * @compatibilityDate 2025-02-06
4278
4278
  */
4279
4279
  useForwardRedirectsPropOnUrlForwardHandler: boolean;
4280
+ /**
4281
+ * Whether the build matches an OpenAPI route's path literally, escaping
4282
+ * the URLPattern special characters in it.
4283
+ *
4284
+ * Before this flag: The path is passed to URLPattern as written, after
4285
+ * `{param}` becomes `:param`, so `/foo/{id}/(.*)` mixes URLPattern syntax
4286
+ * into an OpenAPI path. A path that is not a valid URLPattern fails the
4287
+ * build.
4288
+ *
4289
+ * After this flag: `* + ? ( ) [ ] . | ^ $ \ :` in the path are escaped, so
4290
+ * each matches only itself, and `{param}` is the only placeholder.
4291
+ *
4292
+ * The build reads this flag; the runtime does not.
4293
+ *
4294
+ * @compatibilityDate 2025-02-06
4295
+ */
4296
+ escapeOpenApiPathCharacters: boolean;
4297
+ /**
4298
+ * Whether an OpenAPI path parameter ends at its closing `}`, so a path
4299
+ * such as `/x/{id}abc` binds `id` as written.
4300
+ *
4301
+ * Before this flag: The build writes `{id}` as `:id`. URLPattern reads a
4302
+ * name for as long as the next characters are letters, digits, `_` or `$`,
4303
+ * so `/x/{id}abc` becomes `/x/:idabc`: it matches `/x/<anything>` and sets
4304
+ * `idabc`, never `id`. The build warns about each such path.
4305
+ *
4306
+ * After this flag: When a letter, digit, `_` or `$` follows the `}`, the
4307
+ * build writes `{:id}abc`, so `/x/fooabc` matches with `id` set to `foo`
4308
+ * and `/x/foo` does not match. `mcpServerHandler` writes the parameter's
4309
+ * value in its place. Other paths build exactly as before.
4310
+ *
4311
+ * The build and the MCP server handler read this flag.
4312
+ */
4313
+ delimitOpenApiPathParameters: boolean;
4280
4314
  /**
4281
4315
  * Whether response sending hooks should chain properly, where each hook
4282
4316
  * receives the response from the previous hook instead of the original response.
@@ -4407,6 +4441,32 @@ declare interface CompatibilityFlags {
4407
4441
  * `policies/optional-string-options.spec.ts` lists them with the reason.
4408
4442
  */
4409
4443
  treatBlankOptionalStringOptionsAsUnset: boolean;
4444
+ /**
4445
+ * Whether the MCP server handler answers `resources/read` with a JSON-RPC
4446
+ * error when the resource's route answers an error status.
4447
+ *
4448
+ * Before this flag: The route's response body is returned as the
4449
+ * resource's contents whatever its status, so a route's 403 problem+json
4450
+ * reaches the client as a successful read.
4451
+ *
4452
+ * After this flag: A status outside 200 to 299, a redirect included,
4453
+ * answers `resources/read` with JSON-RPC error -32603 naming the resource,
4454
+ * its URI and the status, with `data: { uri, status }`. The route's body is
4455
+ * not read or sent.
4456
+ */
4457
+ failMcpResourceReadsOnErrorStatus: boolean;
4458
+ /**
4459
+ * Whether the build fails for an MCP resource URI that is not an absolute
4460
+ * RFC 3986 URI.
4461
+ *
4462
+ * Before this flag: `x-zuplo-route.mcp.uri` (or the deprecated
4463
+ * `x-zuplo-mcp-resource.uri`) is advertised and served as written, for
4464
+ * example `audit doc with spaces`. The build warns.
4465
+ *
4466
+ * After this flag: The build fails, naming the operation, its file and the
4467
+ * URI. The default URI (`mcp://resources/<name>`) is always valid.
4468
+ */
4469
+ rejectInvalidMcpResourceUris: boolean;
4410
4470
  }
4411
4471
 
4412
4472
  declare interface CompletionsFallbacks {
@@ -148,6 +148,40 @@ declare interface CompatibilityFlags {
148
148
  * @compatibilityDate 2025-02-06
149
149
  */
150
150
  useForwardRedirectsPropOnUrlForwardHandler: boolean;
151
+ /**
152
+ * Whether the build matches an OpenAPI route's path literally, escaping
153
+ * the URLPattern special characters in it.
154
+ *
155
+ * Before this flag: The path is passed to URLPattern as written, after
156
+ * `{param}` becomes `:param`, so `/foo/{id}/(.*)` mixes URLPattern syntax
157
+ * into an OpenAPI path. A path that is not a valid URLPattern fails the
158
+ * build.
159
+ *
160
+ * After this flag: `* + ? ( ) [ ] . | ^ $ \ :` in the path are escaped, so
161
+ * each matches only itself, and `{param}` is the only placeholder.
162
+ *
163
+ * The build reads this flag; the runtime does not.
164
+ *
165
+ * @compatibilityDate 2025-02-06
166
+ */
167
+ escapeOpenApiPathCharacters: boolean;
168
+ /**
169
+ * Whether an OpenAPI path parameter ends at its closing `}`, so a path
170
+ * such as `/x/{id}abc` binds `id` as written.
171
+ *
172
+ * Before this flag: The build writes `{id}` as `:id`. URLPattern reads a
173
+ * name for as long as the next characters are letters, digits, `_` or `$`,
174
+ * so `/x/{id}abc` becomes `/x/:idabc`: it matches `/x/<anything>` and sets
175
+ * `idabc`, never `id`. The build warns about each such path.
176
+ *
177
+ * After this flag: When a letter, digit, `_` or `$` follows the `}`, the
178
+ * build writes `{:id}abc`, so `/x/fooabc` matches with `id` set to `foo`
179
+ * and `/x/foo` does not match. `mcpServerHandler` writes the parameter's
180
+ * value in its place. Other paths build exactly as before.
181
+ *
182
+ * The build and the MCP server handler read this flag.
183
+ */
184
+ delimitOpenApiPathParameters: boolean;
151
185
  /**
152
186
  * Whether response sending hooks should chain properly, where each hook
153
187
  * receives the response from the previous hook instead of the original response.
@@ -278,6 +312,32 @@ declare interface CompatibilityFlags {
278
312
  * `policies/optional-string-options.spec.ts` lists them with the reason.
279
313
  */
280
314
  treatBlankOptionalStringOptionsAsUnset: boolean;
315
+ /**
316
+ * Whether the MCP server handler answers `resources/read` with a JSON-RPC
317
+ * error when the resource's route answers an error status.
318
+ *
319
+ * Before this flag: The route's response body is returned as the
320
+ * resource's contents whatever its status, so a route's 403 problem+json
321
+ * reaches the client as a successful read.
322
+ *
323
+ * After this flag: A status outside 200 to 299, a redirect included,
324
+ * answers `resources/read` with JSON-RPC error -32603 naming the resource,
325
+ * its URI and the status, with `data: { uri, status }`. The route's body is
326
+ * not read or sent.
327
+ */
328
+ failMcpResourceReadsOnErrorStatus: boolean;
329
+ /**
330
+ * Whether the build fails for an MCP resource URI that is not an absolute
331
+ * RFC 3986 URI.
332
+ *
333
+ * Before this flag: `x-zuplo-route.mcp.uri` (or the deprecated
334
+ * `x-zuplo-mcp-resource.uri`) is advertised and served as written, for
335
+ * example `audit doc with spaces`. The build warns.
336
+ *
337
+ * After this flag: The build fails, naming the operation, its file and the
338
+ * URI. The default URI (`mcp://resources/<name>`) is always valid.
339
+ */
340
+ rejectInvalidMcpResourceUris: boolean;
281
341
  }
282
342
 
283
343
  /**
@@ -1231,6 +1291,18 @@ declare type Iso3166Alpha2Code =
1231
1291
 
1232
1292
  /* Excluded from this release type: isRestrictedEnvVariableName */
1233
1293
 
1294
+ /**
1295
+ * Whether `uri` is an absolute RFC 3986 URI (section 3: `scheme ":"
1296
+ * hier-part [ "?" query ] [ "#" fragment ]`), as MCP requires a resource URI
1297
+ * to be (compat-reject-invalid-mcp-resource-uris MCPRESURI-1). The structure
1298
+ * is checked, not just the characters: a bracketed host must be an IP
1299
+ * literal, a port must be digits, and a fragment holds no second `#`. Any
1300
+ * scheme is allowed, so custom schemes such as `docs:` pass.
1301
+ *
1302
+ * @param uri - the resource URI as the handler advertises it (trimmed)
1303
+ */
1304
+ export declare function isValidMcpResourceUri(uri: string): boolean;
1305
+
1234
1306
  /* Excluded from this release type: isZuploReadableEnvVariableName */
1235
1307
 
1236
1308
  declare type JsonArray = JsonValue[] | readonly JsonValue[];
@@ -1311,6 +1383,36 @@ declare interface Logger extends BaseLogger {
1311
1383
  ): void;
1312
1384
  }
1313
1385
 
1386
+ /** The name and URI `resources/list` advertises for a resource. */
1387
+ export declare interface McpResourceIdentity {
1388
+ /**
1389
+ * The resource's name. Empty only on the `"resources"` path for an
1390
+ * operation with neither a name nor an operationId, which the handler
1391
+ * refuses at startup.
1392
+ */
1393
+ name: string;
1394
+ /** The advertised URI: the configured one, trimmed, or the default. */
1395
+ uri: string;
1396
+ /** Whether the URI is configured (non-empty after trimming), not the default. */
1397
+ configured: boolean;
1398
+ }
1399
+
1400
+ /** The part of a resource extension that names a resource and its URI. */
1401
+ export declare interface McpResourceIdentityConfig {
1402
+ name?: string;
1403
+ uri?: string;
1404
+ }
1405
+
1406
+ /**
1407
+ * How `mcpServerHandler` registers a resource, which decides the extension
1408
+ * its name and URI come from:
1409
+ * - `"operations"`: `options.operations`, from `x-zuplo-route.mcp` with
1410
+ * `type: "resource"`.
1411
+ * - `"resources"`: the deprecated `options.resources`, from
1412
+ * `x-zuplo-mcp-resource`.
1413
+ */
1414
+ export declare type McpResourceRegistration = "operations" | "resources";
1415
+
1314
1416
  declare type Modify<T, R> = Omit<T, keyof R> & R;
1315
1417
 
1316
1418
  /**
@@ -2025,6 +2127,23 @@ declare interface RequestUser<TUserData> {
2025
2127
  data: TUserData;
2026
2128
  }
2027
2129
 
2130
+ /**
2131
+ * The name and URI `mcpServerHandler` advertises for an operation it registers
2132
+ * as a resource. The handler and the build's resource URI check
2133
+ * (compat-reject-invalid-mcp-resource-uris MCPRESURI-1) both decide it here.
2134
+ * An empty URI gets the default, `mcp://resources/<encoded name>`.
2135
+ *
2136
+ * @param operationId - the operation's operationId
2137
+ * @param config - `x-zuplo-route.mcp` for `"operations"`,
2138
+ * `x-zuplo-mcp-resource` for `"resources"`
2139
+ * @param registration - the handler option that registers the resource
2140
+ */
2141
+ export declare function resolveMcpResourceIdentity(
2142
+ operationId: string,
2143
+ config: McpResourceIdentityConfig | undefined,
2144
+ registration: McpResourceRegistration
2145
+ ): McpResourceIdentity;
2146
+
2028
2147
  declare type ResolveRequestParams<
2029
2148
  TParams extends RequestParamsDefault | undefined,
2030
2149
  > = TParams extends RequestParamsDefault ? TParams : RequestParamsDefault;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.13.10",
4
+ "version": "7.13.13",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1061,7 +1061,7 @@ var rateLimit = (passedOptions) => {
1061
1061
  const retryAfter = await retrieveRetryAfter;
1062
1062
  setRetryAfterHeader(response, info, config.windowMs, retryAfter);
1063
1063
  }
1064
- config.handler(request, response, next, options);
1064
+ await config.handler(request, response, next, options);
1065
1065
  return;
1066
1066
  }
1067
1067
  next();
@@ -1018,7 +1018,7 @@ var rateLimit = (passedOptions) => {
1018
1018
  const retryAfter = await retrieveRetryAfter;
1019
1019
  setRetryAfterHeader(response, info, config.windowMs, retryAfter);
1020
1020
  }
1021
- config.handler(request, response, next, options);
1021
+ await config.handler(request, response, next, options);
1022
1022
  return;
1023
1023
  }
1024
1024
  next();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-rate-limit",
3
- "version": "8.7.2",
3
+ "version": "8.7.3",
4
4
  "description": "Basic IP rate-limiting middleware for Express. Use to limit repeated requests to public APIs and/or endpoints such as password reset.",
5
5
  "author": {
6
6
  "name": "Nathan Friedly",
@@ -186,9 +186,9 @@ A few terms used throughout the API can be confusing if you haven't worked deepl
186
186
  - `static fromWildcard(input: string): Address6` — Construct an `Address6` from a wildcard pattern with trailing `*` groups. The number of trailing wildcards determines the prefix length: each `*` represents 16 bits. `::` is expanded to zero groups (not wildcards) before evaluating trailing wildcards. Only trailing whole-group wildcards are supported. Partial-group wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g. `*::1`) throw `AddressError`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L331)
187
187
  - `static fromAddress4(address: string): Address6` — Create an IPv6-mapped address given an IPv4 address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L392)
188
188
  - `static fromArpa(arpaFormAddress: string): Address6` — Return an address from ip6.arpa form. A full 32-nibble name gives a /128 address; a shorter name, as used for a delegated reverse zone, gives the network it covers, with a subnet mask of four bits per nibble, so `fromArpa(x.reverseForm())` round-trips reverseForm for any prefix. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L412)
189
- - `static fromAddress4Nat64(address: string, prefix?: string): Address6` — Embed an IPv4 address into a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. The prefix length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter than /64 the IPv4 octets are split around the reserved bits 64–71. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1119)
190
- - `static fromByteArray(bytes: number[]): Address6` — Convert a byte array to an Address6 object. Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an `Int8Array` or a Java `byte[]` holds them), folding signed values to their unsigned equivalent. Throws `AddressError` unless given exactly 16 integers from -128 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1234)
191
- - `static fromUnsignedByteArray(bytes: number[]): Address6` — Convert an unsigned byte array to an Address6 object. Throws `AddressError` unless given exactly 16 integers from 0 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1251)
189
+ - `static fromAddress4Nat64(address: string, prefix?: string): Address6` — Embed an IPv4 address into a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. The prefix length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter than /64 the IPv4 octets are split around the reserved bits 64–71. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1122)
190
+ - `static fromByteArray(bytes: number[]): Address6` — Convert a byte array to an Address6 object. Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an `Int8Array` or a Java `byte[]` holds them), folding signed values to their unsigned equivalent. Throws `AddressError` unless given exactly 16 integers from -128 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1237)
191
+ - `static fromUnsignedByteArray(bytes: number[]): Address6` — Convert an unsigned byte array to an Address6 object. Throws `AddressError` unless given exactly 16 integers from 0 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1254)
192
192
 
193
193
  **Instance methods**
194
194
 
@@ -215,39 +215,39 @@ A few terms used throughout the API can be confusing if you haven't worked deepl
215
215
  - `binaryZeroPad(): string` — Return a zero-padded base-2 string representation of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L783)
216
216
  - `parse4in6(address: string): string` — Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the trailing IPv4 address into `this.address4` / `this.parsedAddress4` and returning the address with the v4 portion converted to two v6 groups. Used internally by `parse()`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L797)
217
217
  - `parse(address: string): string[]` — Parses an IPv6 address string into its 8 hexadecimal groups (expanding any `::` elision and any trailing v4-in-v6 portion) and stores the result on `this.parsedAddress`. Called automatically by the constructor; you typically don't need to call it directly. Throws `AddressError` if the input is malformed. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L854)
218
- - `canonicalForm(): string` — Returns the canonical (fully expanded) form of the address: all 8 groups, each padded to 4 hex digits, with no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L934)
219
- - `decimal(): string` — Return the decimal form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L942)
220
- - `bigInt(): bigint` — Return the address as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L950)
221
- - `to4(): Address4` — Return the last two groups of this address as an IPv4 address string. If this address carries a CIDR prefix that covers the trailing 32 bits (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to `/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L965)
222
- - `to4in6(): string` — Return the v4-in-v6 form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L989)
223
- - `inspectTeredo(): TeredoProperties` — Decodes the Teredo tunneling fields embedded in this address. Returns the Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, UDP port, and Microsoft-format flag breakdown (reserved, universal/local, group/individual, nonce). Only meaningful for addresses in `2001::/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1010)
224
- - `inspect6to4(): SixToFourProperties` — Decodes the 6to4 tunneling fields embedded in this address. Returns the 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for addresses in `2002::/16`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1073)
225
- - `to6to4(): Address6 | null` — Return a v6 6to4 address from a v6 v4inv6 address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1093)
226
- - `toAddress4Nat64(prefix?: string): Address4 | null` — Extract the embedded IPv4 address from a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. Returns `null` if this address is not contained within the given prefix. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1162)
227
- - `toByteArray(): number[]` — Return a byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1197)
228
- - `toUnsignedByteArray(): number[]` — Return an unsigned byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1216)
229
- - `isCanonical(): boolean` — Returns true if the address is in the canonical form, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1298)
230
- - `isLinkLocal(): boolean` — Returns true if the address is a link-local unicast address in `fe80::/10` ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4)) or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1309)
231
- - `isMulticast(): boolean` — Returns true if the address is a multicast address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1322)
232
- - `is4(): boolean` — Returns true if the address was written in v4-in-v6 dotted-quad notation (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag and does not reflect whether the address bits lie in the IPv4-mapped (`::ffff:0:0/96`) subnet — for that, see isMapped4. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1339)
233
- - `isMapped4(): boolean` — Returns true if the address is an IPv4-mapped IPv6 address in `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), false otherwise. Unlike is4, this checks the underlying address bits rather than the textual notation, so `::ffff:127.0.0.1` and `::ffff:7f00:1` both return true. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1351)
234
- - `embeddedIPv4(): Address4 | null` — If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that embedded address as an Address4; otherwise return null. The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and delegate to the embedded Address4 when present, so a literal such as `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). This matters wherever the checks back a trust-boundary decision (e.g. an SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as non-internal. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1372)
235
- - `isTeredo(): boolean` — Returns true if the address is a Teredo address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1384)
236
- - `is6to4(): boolean` — Returns true if the address is a 6to4 address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1392)
237
- - `isLoopback(): boolean` — Returns true if the address is a loopback address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1400)
238
- - `isULA(): boolean` — Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1413)
239
- - `isPrivate(): boolean` — Returns true if the address is private, i.e. a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an address in the NAT64 local-use range `64:ff9b:1::/48` ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to Address4.isPrivate; use it instead of isULA when you need to catch mapped RFC 1918 addresses as well as native ULAs. The local-use NAT64 range is reported private as a whole rather than by its embedded IPv4 address: an operator may carve a prefix of any RFC 6052 length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4 addresses under different deployments and no single decoding is correct. Use toAddress4Nat64 with the deployment's prefix to decode one. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1435)
240
- - `isCGNAT(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false otherwise. There is no native IPv6 CGNAT range, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1452)
241
- - `isBroadcast(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. There is no IPv6 broadcast, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:255.255.255.255`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1469)
242
- - `isUnspecified(): boolean` — Returns true if the address is the unspecified address `::`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1482)
243
- - `isDocumentation(): boolean` — Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1495)
244
- - `isBenchmarking(): boolean` — Returns true if the address is in the benchmarking range `2001:2::/48` ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in `198.18.0.0/15`, false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1506)
245
- - `isGlobal(): boolean` — Returns true if the address is globally reachable: inside the global unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns for global unicast; everything else is reserved, ULA, link-local, or multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/) marks as not globally reachable. An IPv4-mapped or NAT64 well-known address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4 (`2002::/16`) are not global either: the registry lists them as N/A and a packet to one needs a relay. This covers everything the individual classifiers name and the blocks they do not: the discard-only prefix `100::/64`, the IETF protocol assignments in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible `::/96` ranges, and unallocated space such as `4000::/3`. It is the single predicate to use where a request must not reach an internal or special-purpose destination; see SECURITY.md. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1535)
246
- - `href(optionalPort?: string | number): string` — Returns the address as an HTTP URL with the host bracketed, e.g. `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, e.g. `http://[2001:db8::1]:8080/`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1554)
247
- - `link(options?: { className?: string; prefix?: string; v4?: boolean }): string` — Returns an HTML `<a>` element whose `href` encodes the address in a URL hash fragment (default prefix `/#address=`). Useful for linking between pages of an address-inspector UI. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1572)
248
- - `group(): string` — Groups an address. Returns an HTML fragment: each group is wrapped in a `<span>` carrying the group classes an address-inspector UI hovers on. The address content is HTML-escaped; anything you concatenate around it is your responsibility. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1617)
249
- - `regularExpressionString(substringSearch?: boolean): string` — Generate a regular expression string that can be used to find or validate all variations of this address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1669)
250
- - `regularExpression(substringSearch?: boolean): RegExp` — Generate a regular expression that can be used to find or validate all variations of this address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1723)
218
+ - `canonicalForm(): string` — Returns the canonical (fully expanded) form of the address: all 8 groups, each padded to 4 hex digits, with no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L937)
219
+ - `decimal(): string` — Return the decimal form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L945)
220
+ - `bigInt(): bigint` — Return the address as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L953)
221
+ - `to4(): Address4` — Return the last two groups of this address as an IPv4 address string. If this address carries a CIDR prefix that covers the trailing 32 bits (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to `/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L968)
222
+ - `to4in6(): string` — Return the v4-in-v6 form of the address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L992)
223
+ - `inspectTeredo(): TeredoProperties` — Decodes the Teredo tunneling fields embedded in this address. Returns the Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, UDP port, and Microsoft-format flag breakdown (reserved, universal/local, group/individual, nonce). Only meaningful for addresses in `2001::/32`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1013)
224
+ - `inspect6to4(): SixToFourProperties` — Decodes the 6to4 tunneling fields embedded in this address. Returns the 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for addresses in `2002::/16`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1076)
225
+ - `to6to4(): Address6 | null` — Return a v6 6to4 address from a v6 v4inv6 address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1096)
226
+ - `toAddress4Nat64(prefix?: string): Address4 | null` — Extract the embedded IPv4 address from a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. Returns `null` if this address is not contained within the given prefix. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1165)
227
+ - `toByteArray(): number[]` — Return a byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1200)
228
+ - `toUnsignedByteArray(): number[]` — Return an unsigned byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1219)
229
+ - `isCanonical(): boolean` — Returns true if the address is in the canonical form, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1301)
230
+ - `isLinkLocal(): boolean` — Returns true if the address is a link-local unicast address in `fe80::/10` ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4)) or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1312)
231
+ - `isMulticast(): boolean` — Returns true if the address is a multicast address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1325)
232
+ - `is4(): boolean` — Returns true if the address was written in v4-in-v6 dotted-quad notation (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag and does not reflect whether the address bits lie in the IPv4-mapped (`::ffff:0:0/96`) subnet — for that, see isMapped4. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1342)
233
+ - `isMapped4(): boolean` — Returns true if the address is an IPv4-mapped IPv6 address in `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), false otherwise. Unlike is4, this checks the underlying address bits rather than the textual notation, so `::ffff:127.0.0.1` and `::ffff:7f00:1` both return true. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1354)
234
+ - `embeddedIPv4(): Address4 | null` — If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that embedded address as an Address4; otherwise return null. The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and delegate to the embedded Address4 when present, so a literal such as `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). This matters wherever the checks back a trust-boundary decision (e.g. an SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as non-internal. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1375)
235
+ - `isTeredo(): boolean` — Returns true if the address is a Teredo address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1387)
236
+ - `is6to4(): boolean` — Returns true if the address is a 6to4 address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1395)
237
+ - `isLoopback(): boolean` — Returns true if the address is a loopback address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1403)
238
+ - `isULA(): boolean` — Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1416)
239
+ - `isPrivate(): boolean` — Returns true if the address is private, i.e. a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an address in the NAT64 local-use range `64:ff9b:1::/48` ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to Address4.isPrivate; use it instead of isULA when you need to catch mapped RFC 1918 addresses as well as native ULAs. The local-use NAT64 range is reported private as a whole rather than by its embedded IPv4 address: an operator may carve a prefix of any RFC 6052 length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4 addresses under different deployments and no single decoding is correct. Use toAddress4Nat64 with the deployment's prefix to decode one. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1438)
240
+ - `isCGNAT(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false otherwise. There is no native IPv6 CGNAT range, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1455)
241
+ - `isBroadcast(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. There is no IPv6 broadcast, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:255.255.255.255`). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1472)
242
+ - `isUnspecified(): boolean` — Returns true if the address is the unspecified address `::`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1485)
243
+ - `isDocumentation(): boolean` — Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1498)
244
+ - `isBenchmarking(): boolean` — Returns true if the address is in the benchmarking range `2001:2::/48` ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in `198.18.0.0/15`, false otherwise. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1509)
245
+ - `isGlobal(): boolean` — Returns true if the address is globally reachable: inside the global unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns for global unicast; everything else is reserved, ULA, link-local, or multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/) marks as not globally reachable. An IPv4-mapped or NAT64 well-known address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4 (`2002::/16`) are not global either: the registry lists them as N/A and a packet to one needs a relay. This covers everything the individual classifiers name and the blocks they do not: the discard-only prefix `100::/64`, the IETF protocol assignments in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible `::/96` ranges, and unallocated space such as `4000::/3`. It is the single predicate to use where a request must not reach an internal or special-purpose destination; see SECURITY.md. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1538)
246
+ - `href(optionalPort?: string | number): string` — Returns the address as an HTTP URL with the host bracketed, e.g. `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, e.g. `http://[2001:db8::1]:8080/`. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1557)
247
+ - `link(options?: { className?: string; prefix?: string; v4?: boolean }): string` — Returns an HTML `<a>` element whose `href` encodes the address in a URL hash fragment (default prefix `/#address=`). Useful for linking between pages of an address-inspector UI. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1575)
248
+ - `group(): string` — Groups an address. Returns an HTML fragment: each group is wrapped in a `<span>` carrying the group classes an address-inspector UI hovers on. The address content is HTML-escaped; anything you concatenate around it is your responsibility. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1620)
249
+ - `regularExpressionString(substringSearch?: boolean): string` — Generate a regular expression string that can be used to find or validate all variations of this address [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1672)
250
+ - `regularExpression(substringSearch?: boolean): RegExp` — Generate a regular expression that can be used to find or validate all variations of this address. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1726)
251
251
 
252
252
  **Properties**
253
253
 
@@ -265,9 +265,9 @@ A few terms used throughout the API can be confusing if you haven't worked deepl
265
265
  - `subnetMask: number` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L108)
266
266
  - `v4: boolean` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L109)
267
267
  - `zone: string` — [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L110)
268
- - `isInSubnet: (address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address. An `Address4` is never in the subnet of an `Address6`; convert with `Address6.fromAddress4()` or `to4()` to compare across families. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1274)
269
- - `isHostInSubnet: (address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. Prefer this over `isInSubnet` when classifying a single address, so the answer doesn't change with the CIDR suffix the caller happened to write — notably when the address came from untrusted input and the result backs a trust-boundary decision. An `Address4` is never in the subnet of an `Address6`; convert with `Address6.fromAddress4()` or `to4()` to compare across families. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1286)
270
- - `isCorrect: () => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1292)
268
+ - `isInSubnet: (address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address. An `Address4` is never in the subnet of an `Address6`; convert with `Address6.fromAddress4()` or `to4()` to compare across families. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1277)
269
+ - `isHostInSubnet: (address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. Prefer this over `isInSubnet` when classifying a single address, so the answer doesn't change with the CIDR suffix the caller happened to write — notably when the address came from untrusted input and the result backs a trust-boundary decision. An `Address4` is never in the subnet of an `Address6`; convert with `Address6.fromAddress4()` or `to4()` to compare across families. [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1289)
270
+ - `isCorrect: () => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/main/src/ipv6.ts#L1295)
271
271
 
272
272
  </details>
273
273
 
@@ -733,7 +733,7 @@ class Address6 {
733
733
  address = this.parse4in6(address);
734
734
  const badCharacters = address.match(constants6.RE_BAD_CHARACTERS);
735
735
  if (badCharacters) {
736
- throw new address_error_1.AddressError(`Bad character${badCharacters.length > 1 ? 's' : ''} detected in address: ${badCharacters.join('')}`, address.replace(constants6.RE_BAD_CHARACTERS, '<span class="parse-error">$1</span>'));
736
+ throw new address_error_1.AddressError(`Bad character${badCharacters.length > 1 ? 's' : ''} detected in address: ${badCharacters.join('')}`, address.replace(constants6.RE_BAD_CHARACTERS, (character) => `<span class="parse-error">${helpers.escapeHtml(character)}</span>`));
737
737
  }
738
738
  const badAddress = address.match(constants6.RE_BAD_ADDRESS);
739
739
  if (badAddress) {