@zuplo/cli 7.1.9 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@hono/node-server/dist/index.cjs +151 -9
- package/node_modules/@hono/node-server/dist/index.mjs +151 -9
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +4 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
- package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +4 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +24 -3
- package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core-stateless.js +30 -9
- package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +28 -10
- package/node_modules/@posthog/core/dist/posthog-core.d.ts +3 -3
- package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/posthog-core.js +1 -0
- package/node_modules/@posthog/core/dist/posthog-core.mjs +1 -0
- package/node_modules/@posthog/core/dist/types.d.ts +2 -1
- package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/types.js +1 -0
- package/node_modules/@posthog/core/dist/types.mjs +1 -0
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/posthog-core-stateless.ts +42 -10
- package/node_modules/@posthog/core/src/posthog-core.ts +4 -3
- package/node_modules/@posthog/core/src/types.ts +2 -1
- package/node_modules/@posthog/types/dist/capture.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts +1 -1
- package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog-config.d.ts +54 -5
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/posthog.d.ts +3 -3
- package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
- package/node_modules/@posthog/types/dist/segment.d.ts +11 -2
- package/node_modules/@posthog/types/dist/segment.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/capture.ts +1 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +64 -6
- package/node_modules/@posthog/types/src/posthog.ts +3 -3
- package/node_modules/@posthog/types/src/segment.ts +11 -2
- package/node_modules/@zuplo/core/customer.cli.minified.js +1 -1
- package/node_modules/@zuplo/core/index.minified.js +1 -1
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-4VE55TG3.js +26 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-4VE55TG3.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-FP5XLKCX.js +409 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-FP5XLKCX.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +299 -20
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +1 -0
- package/node_modules/@zuplo/runtime/out/types/mcp/messages/index.d.ts +1 -0
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +1 -0
- package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +1 -0
- package/node_modules/@zuplo/runtime/out/types/sdks/aws/index.d.ts +1 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/ansi-regex/index.js +3 -2
- package/node_modules/ansi-regex/package.json +1 -1
- package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/default-browser/package.json +1 -1
- package/node_modules/default-browser/windows.js +3 -1
- package/node_modules/hono/dist/cjs/client/client.js +3 -3
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +15 -12
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -1
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
- package/node_modules/hono/dist/cjs/utils/url.js +2 -2
- package/node_modules/hono/dist/client/client.js +3 -3
- package/node_modules/hono/dist/jsx/intrinsic-element/components.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +15 -12
- package/node_modules/hono/dist/middleware/etag/digest.js +47 -1
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
- package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
- package/node_modules/hono/dist/utils/url.js +2 -2
- package/node_modules/hono/package.json +1 -1
- package/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-MXYNCB5D.js +0 -382
- package/node_modules/@zuplo/runtime/out/esm/chunk-MXYNCB5D.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-RAZK5G27.js +0 -26
- package/node_modules/@zuplo/runtime/out/esm/chunk-RAZK5G27.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-MXYNCB5D.js.LEGAL.txt → chunk-FP5XLKCX.js.LEGAL.txt} +0 -0
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{b as l}from"../chunk-
|
|
25
|
+
import{b as l}from"../chunk-4VE55TG3.js";import{_ as n}from"../chunk-4POCC75H.js";import{a as o}from"../chunk-TYV53J3B.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function t(r){e.push(Promise.resolve(r))}return o(t,"waitUntil"),{context:new s({event:{waitUntil:t},route:u.route}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},s=class extends EventTarget{static{o(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=a,parentContext:i}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.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=i,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,i){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")}addEventListener(e,t,i){let d=o(r=>{try{typeof t=="function"?t(r):t.handleEvent(r)}catch(p){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),p}},"wrapped");super.addEventListener(e,d,i)}};export{s as MockZuploContext,g as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -332,6 +332,75 @@ export declare interface AIGatewayConfigurationLoaderV2InboundPolicyOptions {
|
|
|
332
332
|
cacheTtlSeconds?: number;
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
/**
|
|
336
|
+
* AI Gateway DLP Inbound Policy
|
|
337
|
+
* @title AI Gateway DLP
|
|
338
|
+
* @product ai-gateway
|
|
339
|
+
* @hidden
|
|
340
|
+
* @requiresAI
|
|
341
|
+
*
|
|
342
|
+
* Scans the content of AI requests and responses — system prompts, message
|
|
343
|
+
* text, and tool-call arguments — for sensitive data (credit cards, national
|
|
344
|
+
* identifiers, API keys and other credentials) using the in-gateway DLP
|
|
345
|
+
* engine, and applies per-rule actions: mask, block, or log. Detection runs
|
|
346
|
+
* entirely inside the gateway; nothing is sent to a third-party scanning
|
|
347
|
+
* service. Streaming responses are scanned as they stream, chunk by chunk
|
|
348
|
+
* with a sliding boundary window, rather than being buffered to the end.
|
|
349
|
+
*
|
|
350
|
+
* Options are validated at request time and invalid options fail closed with
|
|
351
|
+
* a ConfigurationError. Content that cannot be inspected is denied by
|
|
352
|
+
* default (`onUnknownShape: "deny"`), and internal scan failures fail closed
|
|
353
|
+
* by default (`onError: "block"`).
|
|
354
|
+
*
|
|
355
|
+
* @param request - The ZuploRequest
|
|
356
|
+
* @param context - The ZuploContext
|
|
357
|
+
* @param options - The policy options set in policies.json
|
|
358
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
359
|
+
* @returns A Request or a Response
|
|
360
|
+
*/
|
|
361
|
+
export declare function AIGatewayDlpInboundPolicy(
|
|
362
|
+
request: ZuploRequest,
|
|
363
|
+
context: ZuploContext,
|
|
364
|
+
unparsedOptions: unknown,
|
|
365
|
+
policyName: string
|
|
366
|
+
): Promise<ZuploRequest | Response>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* The options for the AI Gateway DLP policy. Scans the content of AI requests and responses — system prompts, messages, and tool-call arguments — for sensitive data such as credit cards, national identifiers, and API keys, applying a per-rule action (mask, block, or log). Detection runs entirely inside the gateway and streaming responses are scanned as they stream.
|
|
370
|
+
* @public
|
|
371
|
+
*/
|
|
372
|
+
export declare interface AIGatewayDlpInboundPolicyOptions {
|
|
373
|
+
rules: DlpRules;
|
|
374
|
+
/**
|
|
375
|
+
* Your own detection rules alongside the built-ins: the same rule object plus a `name`, a regex `pattern`, and optional `context` words.
|
|
376
|
+
*/
|
|
377
|
+
customRules?: DlpCustomRule[];
|
|
378
|
+
/**
|
|
379
|
+
* Exact strings that are never flagged by any rule — documentation samples like Stripe's public test card `4242 4242 4242 4242`, or your own support email address. Matching is case-sensitive against the exact detected text, including when a value arrives split across streaming chunks.
|
|
380
|
+
*/
|
|
381
|
+
allowValues?: string[];
|
|
382
|
+
/**
|
|
383
|
+
* The replacement text for masked matches. The `{type}` token inserts the detected type id in UPPER_SNAKE form (for example `[CONTACT_EMAIL]`), which keeps masked conversations legible to the model. Individual rules can override this.
|
|
384
|
+
*/
|
|
385
|
+
mask?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Default evidence level for rules that do not set their own. See the per-rule `detection` description for the level semantics. There are no numeric confidence thresholds to tune — levels are the whole dial.
|
|
388
|
+
*/
|
|
389
|
+
detection?: "corroborated" | "standard" | "aggressive";
|
|
390
|
+
/**
|
|
391
|
+
* Also scan tool/function-call argument payloads — in requests, buffered responses, and streamed tool-call deltas. Tool arguments are user and model content; disabling this exempts them from every rule.
|
|
392
|
+
*/
|
|
393
|
+
scanToolArguments?: boolean;
|
|
394
|
+
streaming?: DlpStreamingSettings;
|
|
395
|
+
endpoints?: ApplicableEndpoints;
|
|
396
|
+
onUnknownShape?: OnUnknownShape;
|
|
397
|
+
onError?: OnEngineError;
|
|
398
|
+
/**
|
|
399
|
+
* The detection engine. Only `builtin` (in-gateway regex + checksum detection with context-word scoring; no data egress) is available today. Declaring the discriminator now keeps future engines an additive, non-breaking change.
|
|
400
|
+
*/
|
|
401
|
+
engine?: "builtin";
|
|
402
|
+
}
|
|
403
|
+
|
|
335
404
|
/**
|
|
336
405
|
* Adds failure and quota fallbacks to an existing AI Gateway model selection.
|
|
337
406
|
*
|
|
@@ -960,10 +1029,14 @@ export declare interface AIGatewaySemanticCacheOutboundPolicyOptions {}
|
|
|
960
1029
|
* response-sending hook to write the upstream response back into the cache —
|
|
961
1030
|
* matching the firewall's single-policy shape (no separate outbound policy).
|
|
962
1031
|
*
|
|
963
|
-
* Caching parameters (semanticTolerance, expirationSecondsTtl, namespace
|
|
964
|
-
* from the policy options, and presence in the
|
|
965
|
-
* it. An id from the authenticated app
|
|
966
|
-
* namespace so application-supplied
|
|
1032
|
+
* Caching parameters (semanticTolerance, expirationSecondsTtl, namespace,
|
|
1033
|
+
* recentMessageCount) come from the policy options, and presence in the
|
|
1034
|
+
* route's chain is what enables it. An id from the authenticated app
|
|
1035
|
+
* configuration always provides the cache namespace so application-supplied
|
|
1036
|
+
* options cannot cross tenant partitions. The cache key covers the system
|
|
1037
|
+
* prompt plus the last `recentMessageCount` messages (default 1) — applied
|
|
1038
|
+
* when storing and when matching — so multi-turn conversations can hit
|
|
1039
|
+
* entries cached from earlier, shorter ones.
|
|
967
1040
|
*
|
|
968
1041
|
* Cache outcomes are reported on the response via the RFC 9211 `Cache-Status`
|
|
969
1042
|
* header under the cache name `zp-aigw-sem-cache` (hit:
|
|
@@ -997,9 +1070,10 @@ export declare interface AIGatewaySemanticCacheV2InboundPolicyOptions {
|
|
|
997
1070
|
semanticTolerance?: SemanticTolerance;
|
|
998
1071
|
expirationSecondsTtl?: CacheTTLSeconds;
|
|
999
1072
|
namespace?: CacheNamespace;
|
|
1073
|
+
recentMessageCount?: RecentMessageCount;
|
|
1000
1074
|
maxConversationLength?: MaxConversationLength;
|
|
1001
|
-
endpoints?:
|
|
1002
|
-
onUnknownShape?:
|
|
1075
|
+
endpoints?: ApplicableEndpoints_2;
|
|
1076
|
+
onUnknownShape?: OnUnknownShape_2;
|
|
1003
1077
|
}
|
|
1004
1078
|
|
|
1005
1079
|
/**
|
|
@@ -1227,8 +1301,8 @@ export declare interface AkamaiAIFirewallV2PolicyOptions {
|
|
|
1227
1301
|
"api-key": APIKey_2;
|
|
1228
1302
|
applicationId?: ApplicationID_2;
|
|
1229
1303
|
streamingAccumulation?: StreamingAccumulationSettings_2;
|
|
1230
|
-
endpoints?:
|
|
1231
|
-
onUnknownShape?:
|
|
1304
|
+
endpoints?: ApplicableEndpoints_3;
|
|
1305
|
+
onUnknownShape?: OnUnknownShape_3;
|
|
1232
1306
|
onError?: OnFirewallError_2;
|
|
1233
1307
|
}
|
|
1234
1308
|
|
|
@@ -1837,7 +1911,7 @@ declare interface APITokenCredentialConfig {
|
|
|
1837
1911
|
}
|
|
1838
1912
|
|
|
1839
1913
|
/**
|
|
1840
|
-
* The endpoint shapes to
|
|
1914
|
+
* The endpoint shapes this policy applies to. Omit to apply to all (openai-chat, openai-responses, anthropic-messages).
|
|
1841
1915
|
* @public
|
|
1842
1916
|
*/
|
|
1843
1917
|
declare type ApplicableEndpoints = (
|
|
@@ -1847,7 +1921,7 @@ declare type ApplicableEndpoints = (
|
|
|
1847
1921
|
)[];
|
|
1848
1922
|
|
|
1849
1923
|
/**
|
|
1850
|
-
* The endpoint shapes
|
|
1924
|
+
* The endpoint shapes to cache. Defaults to all shapes: ['openai-chat', 'anthropic-messages', 'openai-responses'].
|
|
1851
1925
|
* @public
|
|
1852
1926
|
*/
|
|
1853
1927
|
declare type ApplicableEndpoints_2 = (
|
|
@@ -1876,6 +1950,16 @@ declare type ApplicableEndpoints_4 = (
|
|
|
1876
1950
|
| "anthropic-messages"
|
|
1877
1951
|
)[];
|
|
1878
1952
|
|
|
1953
|
+
/**
|
|
1954
|
+
* The endpoint shapes this policy applies to. Omit to apply to all (openai-chat, openai-responses, anthropic-messages).
|
|
1955
|
+
* @public
|
|
1956
|
+
*/
|
|
1957
|
+
declare type ApplicableEndpoints_5 = (
|
|
1958
|
+
| "openai-chat"
|
|
1959
|
+
| "openai-responses"
|
|
1960
|
+
| "anthropic-messages"
|
|
1961
|
+
)[];
|
|
1962
|
+
|
|
1879
1963
|
/**
|
|
1880
1964
|
* The application ID to identify this usage of the AI Firewall (optional).
|
|
1881
1965
|
* @public
|
|
@@ -3770,8 +3854,8 @@ export declare interface CometOpikTracingV2PolicyOptions {
|
|
|
3770
3854
|
* The base URL for the Comet Opik API (optional, defaults to https://www.comet.com/opik/api).
|
|
3771
3855
|
*/
|
|
3772
3856
|
baseUrl?: string;
|
|
3773
|
-
endpoints?:
|
|
3774
|
-
onUnknownShape?:
|
|
3857
|
+
endpoints?: ApplicableEndpoints_4;
|
|
3858
|
+
onUnknownShape?: OnUnknownShape_4;
|
|
3775
3859
|
}
|
|
3776
3860
|
|
|
3777
3861
|
/**
|
|
@@ -4550,7 +4634,11 @@ export declare interface DataLossPreventionInboundPolicyOptions {
|
|
|
4550
4634
|
*/
|
|
4551
4635
|
customPatterns?: DlpCustomPattern[];
|
|
4552
4636
|
/**
|
|
4553
|
-
*
|
|
4637
|
+
* Values that are never reported as findings, compared against the exact matched text (case-sensitive, separators included). Use this to exempt well-known non-sensitive values that share a sensitive shape — for example the Stripe test card number `4242 4242 4242 4242` in a payments sandbox, or a public support email address. List every written form you want to allow (a spaced and an unspaced card number are different matches).
|
|
4638
|
+
*/
|
|
4639
|
+
allowValues?: string[];
|
|
4640
|
+
/**
|
|
4641
|
+
* Minimum confidence (0-1) a match must reach to count as a finding. Every match starts at its recognizer's base confidence and gains a fixed boost of 0.45 when one of the recognizer's context words appears near it. Ambiguous shapes (for example `finance-us-bank-account` or `finance-cvv`) have a low base confidence and only cross the default threshold of 0.5 with that boost; lower the threshold to surface them without context. Raising the threshold is not a precision filter: any recognizer whose base confidence falls below it stops matching entirely except near its context words, and most checksum-validated recognizers run at 0.85, so values above 0.85 disable most of the catalog. To narrow detection, scope the `entities` list instead.
|
|
4554
4642
|
*/
|
|
4555
4643
|
minConfidence?: number;
|
|
4556
4644
|
/**
|
|
@@ -4693,7 +4781,11 @@ export declare interface DataLossPreventionOutboundPolicyOptions {
|
|
|
4693
4781
|
*/
|
|
4694
4782
|
customPatterns?: DlpCustomPattern_2[];
|
|
4695
4783
|
/**
|
|
4696
|
-
*
|
|
4784
|
+
* Values that are never reported as findings, compared against the exact matched text (case-sensitive, separators included). Use this to exempt well-known non-sensitive values that share a sensitive shape — for example the Stripe test card number `4242 4242 4242 4242` in a payments sandbox, or a public support email address. List every written form you want to allow (a spaced and an unspaced card number are different matches).
|
|
4785
|
+
*/
|
|
4786
|
+
allowValues?: string[];
|
|
4787
|
+
/**
|
|
4788
|
+
* Minimum confidence (0-1) a match must reach to count as a finding. Every match starts at its recognizer's base confidence and gains a fixed boost of 0.45 when one of the recognizer's context words appears near it. Ambiguous shapes (for example `finance-us-bank-account` or `finance-cvv`) have a low base confidence and only cross the default threshold of 0.5 with that boost; lower the threshold to surface them without context. Raising the threshold is not a precision filter: any recognizer whose base confidence falls below it stops matching entirely except near its context words, and most checksum-validated recognizers run at 0.85, so values above 0.85 disable most of the catalog. To narrow detection, scope the `entities` list instead.
|
|
4697
4789
|
*/
|
|
4698
4790
|
minConfidence?: number;
|
|
4699
4791
|
/**
|
|
@@ -4765,6 +4857,174 @@ declare interface DlpCustomPattern_2 {
|
|
|
4765
4857
|
context?: string[];
|
|
4766
4858
|
}
|
|
4767
4859
|
|
|
4860
|
+
declare interface DlpCustomRule {
|
|
4861
|
+
/**
|
|
4862
|
+
* Identifier reported in findings and block details for this rule.
|
|
4863
|
+
*/
|
|
4864
|
+
name: string;
|
|
4865
|
+
/**
|
|
4866
|
+
* A JavaScript regular expression source string. Remember to escape backslashes for JSON (for example `\\d` for a digit). An invalid pattern fails the configuration at request time — a broken guardrail never degrades into a silent pass-through.
|
|
4867
|
+
*/
|
|
4868
|
+
pattern: string;
|
|
4869
|
+
/**
|
|
4870
|
+
* Context words for this rule. With `detection: "corroborated"` the rule only fires when one of these words appears near the match.
|
|
4871
|
+
*/
|
|
4872
|
+
context?: string[];
|
|
4873
|
+
/**
|
|
4874
|
+
* What happens when this type is found. `mask` replaces the matched text with a placeholder and the conversation continues; `block` rejects the request or terminates the response with an error naming only the detected types (never the values); `log` records a finding and lets the traffic pass unchanged — use it to trial a rule before enforcing it; `off` excludes this type from a group enabled by a broader key.
|
|
4875
|
+
*/
|
|
4876
|
+
action: "mask" | "block" | "log" | "off";
|
|
4877
|
+
/**
|
|
4878
|
+
* Where the rule applies. `inbound` scans what callers send the model (system prompt, message text, and tool-call arguments); `outbound` scans what the model sends back (buffered responses whole, streaming responses chunk by chunk). Defaults to `both`.
|
|
4879
|
+
*/
|
|
4880
|
+
direction?: "both" | "inbound" | "outbound";
|
|
4881
|
+
/**
|
|
4882
|
+
* How much evidence a match needs before this rule acts. `corroborated` additionally requires one of the type's context words near the match (types that define no context words behave as `standard`); `standard` uses the catalog as tuned — distinctive shapes act on their own while ambiguous shapes need nearby context; `aggressive` counts every pattern match and is false-positive-prone — pair it with the `log` action for audits. Overrides the policy-level `detection` for this rule.
|
|
4883
|
+
*/
|
|
4884
|
+
detection?: "corroborated" | "standard" | "aggressive";
|
|
4885
|
+
/**
|
|
4886
|
+
* Replacement text for this rule when `action` is `mask`, overriding the policy-level `mask`. The `{type}` token inserts the detected type id in UPPER_SNAKE form (for example `[CONTACT_EMAIL]`).
|
|
4887
|
+
*/
|
|
4888
|
+
mask?: string;
|
|
4889
|
+
partialMask?: DlpPartialMask;
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4892
|
+
declare interface DlpPartialMask {
|
|
4893
|
+
/**
|
|
4894
|
+
* Keep the last N characters of the matched value unmasked and replace the rest with `*`, preserving length (for example `**** **** **** 4242`). Values no longer than N characters are fully masked.
|
|
4895
|
+
*/
|
|
4896
|
+
keepLast: number;
|
|
4897
|
+
}
|
|
4898
|
+
|
|
4899
|
+
declare interface DlpRule {
|
|
4900
|
+
/**
|
|
4901
|
+
* What happens when this type is found. `mask` replaces the matched text with a placeholder and the conversation continues; `block` rejects the request or terminates the response with an error naming only the detected types (never the values); `log` records a finding and lets the traffic pass unchanged — use it to trial a rule before enforcing it; `off` excludes this type from a group enabled by a broader key.
|
|
4902
|
+
*/
|
|
4903
|
+
action: "mask" | "block" | "log" | "off";
|
|
4904
|
+
/**
|
|
4905
|
+
* Where the rule applies. `inbound` scans what callers send the model (system prompt, message text, and tool-call arguments); `outbound` scans what the model sends back (buffered responses whole, streaming responses chunk by chunk). Defaults to `both`.
|
|
4906
|
+
*/
|
|
4907
|
+
direction?: "both" | "inbound" | "outbound";
|
|
4908
|
+
/**
|
|
4909
|
+
* How much evidence a match needs before this rule acts. `corroborated` additionally requires one of the type's context words near the match (types that define no context words behave as `standard`); `standard` uses the catalog as tuned — distinctive shapes act on their own while ambiguous shapes need nearby context; `aggressive` counts every pattern match and is false-positive-prone — pair it with the `log` action for audits. Overrides the policy-level `detection` for this rule.
|
|
4910
|
+
*/
|
|
4911
|
+
detection?: "corroborated" | "standard" | "aggressive";
|
|
4912
|
+
/**
|
|
4913
|
+
* Replacement text for this rule when `action` is `mask`, overriding the policy-level `mask`. The `{type}` token inserts the detected type id in UPPER_SNAKE form (for example `[CONTACT_EMAIL]`).
|
|
4914
|
+
*/
|
|
4915
|
+
mask?: string;
|
|
4916
|
+
partialMask?: DlpPartialMask;
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
/**
|
|
4920
|
+
* What to find and what to do about it. Each key is a built-in data type id (like `id-us-ssn`) or a group selector (like `pii` or `secret`, plus any dash-aligned id prefix such as `secret-aws`); each value is a rule object whose required `action` says what happens when that type is found. Types you do not mention are not scanned. The most specific key wins — an exact id beats a prefix beats a group — and the winning entry decides everything for its type, direction included. When one stretch of text matches multiple rules, the severest action wins (block > mask > log). At least one rule must scan something.
|
|
4921
|
+
* @public
|
|
4922
|
+
*/
|
|
4923
|
+
declare interface DlpRules {
|
|
4924
|
+
contact?: DlpRule;
|
|
4925
|
+
finance?: DlpRule;
|
|
4926
|
+
"finance-us"?: DlpRule;
|
|
4927
|
+
id?: DlpRule;
|
|
4928
|
+
"id-au"?: DlpRule;
|
|
4929
|
+
"id-br"?: DlpRule;
|
|
4930
|
+
"id-ca"?: DlpRule;
|
|
4931
|
+
"id-es"?: DlpRule;
|
|
4932
|
+
"id-fr"?: DlpRule;
|
|
4933
|
+
"id-in"?: DlpRule;
|
|
4934
|
+
"id-it"?: DlpRule;
|
|
4935
|
+
"id-nl"?: DlpRule;
|
|
4936
|
+
"id-pl"?: DlpRule;
|
|
4937
|
+
"id-sg"?: DlpRule;
|
|
4938
|
+
"id-uk"?: DlpRule;
|
|
4939
|
+
"id-us"?: DlpRule;
|
|
4940
|
+
network?: DlpRule;
|
|
4941
|
+
pii?: DlpRule;
|
|
4942
|
+
"region-eu"?: DlpRule;
|
|
4943
|
+
secret?: DlpRule;
|
|
4944
|
+
"secret-aws"?: DlpRule;
|
|
4945
|
+
"contact-email"?: DlpRule;
|
|
4946
|
+
"contact-phone"?: DlpRule;
|
|
4947
|
+
"finance-credit-card"?: DlpRule;
|
|
4948
|
+
"finance-crypto-wallet"?: DlpRule;
|
|
4949
|
+
"finance-cvv"?: DlpRule;
|
|
4950
|
+
"finance-iban"?: DlpRule;
|
|
4951
|
+
"finance-swift-bic"?: DlpRule;
|
|
4952
|
+
"finance-us-aba-routing"?: DlpRule;
|
|
4953
|
+
"finance-us-bank-account"?: DlpRule;
|
|
4954
|
+
"id-au-abn"?: DlpRule;
|
|
4955
|
+
"id-au-acn"?: DlpRule;
|
|
4956
|
+
"id-au-medicare"?: DlpRule;
|
|
4957
|
+
"id-au-tfn"?: DlpRule;
|
|
4958
|
+
"id-br-cpf"?: DlpRule;
|
|
4959
|
+
"id-ca-sin"?: DlpRule;
|
|
4960
|
+
"id-es-nif"?: DlpRule;
|
|
4961
|
+
"id-fr-nir"?: DlpRule;
|
|
4962
|
+
"id-in-aadhaar"?: DlpRule;
|
|
4963
|
+
"id-in-pan"?: DlpRule;
|
|
4964
|
+
"id-it-fiscal-code"?: DlpRule;
|
|
4965
|
+
"id-nl-bsn"?: DlpRule;
|
|
4966
|
+
"id-pl-pesel"?: DlpRule;
|
|
4967
|
+
"id-sg-nric"?: DlpRule;
|
|
4968
|
+
"id-uk-nhs"?: DlpRule;
|
|
4969
|
+
"id-uk-nino"?: DlpRule;
|
|
4970
|
+
"id-us-itin"?: DlpRule;
|
|
4971
|
+
"id-us-passport"?: DlpRule;
|
|
4972
|
+
"id-us-ssn"?: DlpRule;
|
|
4973
|
+
"network-ipv4"?: DlpRule;
|
|
4974
|
+
"network-ipv6"?: DlpRule;
|
|
4975
|
+
"network-mac"?: DlpRule;
|
|
4976
|
+
"secret-anthropic"?: DlpRule;
|
|
4977
|
+
"secret-aws-access-key"?: DlpRule;
|
|
4978
|
+
"secret-aws-bedrock"?: DlpRule;
|
|
4979
|
+
"secret-azure-client"?: DlpRule;
|
|
4980
|
+
"secret-databricks"?: DlpRule;
|
|
4981
|
+
"secret-digitalocean"?: DlpRule;
|
|
4982
|
+
"secret-discord-webhook"?: DlpRule;
|
|
4983
|
+
"secret-github"?: DlpRule;
|
|
4984
|
+
"secret-gitlab"?: DlpRule;
|
|
4985
|
+
"secret-google-api-key"?: DlpRule;
|
|
4986
|
+
"secret-heroku"?: DlpRule;
|
|
4987
|
+
"secret-hugging-face"?: DlpRule;
|
|
4988
|
+
"secret-jwt"?: DlpRule;
|
|
4989
|
+
"secret-mailchimp"?: DlpRule;
|
|
4990
|
+
"secret-mailgun"?: DlpRule;
|
|
4991
|
+
"secret-npm"?: DlpRule;
|
|
4992
|
+
"secret-openai"?: DlpRule;
|
|
4993
|
+
"secret-perplexity"?: DlpRule;
|
|
4994
|
+
"secret-postman"?: DlpRule;
|
|
4995
|
+
"secret-private-key"?: DlpRule;
|
|
4996
|
+
"secret-pypi"?: DlpRule;
|
|
4997
|
+
"secret-sendgrid"?: DlpRule;
|
|
4998
|
+
"secret-sentry"?: DlpRule;
|
|
4999
|
+
"secret-shopify"?: DlpRule;
|
|
5000
|
+
"secret-slack"?: DlpRule;
|
|
5001
|
+
"secret-square"?: DlpRule;
|
|
5002
|
+
"secret-stripe"?: DlpRule;
|
|
5003
|
+
"secret-telegram-bot"?: DlpRule;
|
|
5004
|
+
"secret-terraform"?: DlpRule;
|
|
5005
|
+
"secret-twilio"?: DlpRule;
|
|
5006
|
+
"secret-zuplo"?: DlpRule;
|
|
5007
|
+
}
|
|
5008
|
+
|
|
5009
|
+
/**
|
|
5010
|
+
* Tuning for streaming (SSE) response scanning. Each chunk is held until the boundary scan that includes its successor passes, then released — so values split across chunks are always fully maskable, at the cost of one chunk of latency.
|
|
5011
|
+
* @public
|
|
5012
|
+
*/
|
|
5013
|
+
declare interface DlpStreamingSettings {
|
|
5014
|
+
/**
|
|
5015
|
+
* Scan streaming responses. When false, streaming responses pass through unscanned even when rules cover the outbound direction.
|
|
5016
|
+
*/
|
|
5017
|
+
enabled?: boolean;
|
|
5018
|
+
/**
|
|
5019
|
+
* Scan across chunk boundaries using a carried tail of already-scanned text. When false, each chunk is scanned alone and released immediately — lower cost, but values split across two chunks are missed.
|
|
5020
|
+
*/
|
|
5021
|
+
boundaryScan?: boolean;
|
|
5022
|
+
/**
|
|
5023
|
+
* How many trailing characters are carried from one chunk into the next boundary scan. Bounds memory and re-scan cost; must be larger than the longest value you need to catch.
|
|
5024
|
+
*/
|
|
5025
|
+
maxCarryChars?: number;
|
|
5026
|
+
}
|
|
5027
|
+
|
|
4768
5028
|
declare interface DynaTraceLoggingOptions {
|
|
4769
5029
|
url: string;
|
|
4770
5030
|
apiToken: string;
|
|
@@ -4917,6 +5177,7 @@ declare const EventType: {
|
|
|
4917
5177
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
4918
5178
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
4919
5179
|
readonly CACHE_OPERATION: "cache_operation";
|
|
5180
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
4920
5181
|
};
|
|
4921
5182
|
|
|
4922
5183
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -5190,8 +5451,8 @@ export declare interface GalileoTracingV2PolicyOptions {
|
|
|
5190
5451
|
* The base URL for the Galileo API (optional, defaults to https://api.galileo.ai).
|
|
5191
5452
|
*/
|
|
5192
5453
|
baseUrl?: string;
|
|
5193
|
-
endpoints?:
|
|
5194
|
-
onUnknownShape?:
|
|
5454
|
+
endpoints?: ApplicableEndpoints_5;
|
|
5455
|
+
onUnknownShape?: OnUnknownShape_5;
|
|
5195
5456
|
}
|
|
5196
5457
|
|
|
5197
5458
|
/**
|
|
@@ -8046,7 +8307,7 @@ declare type LokiTransportVersion = 1 | 2;
|
|
|
8046
8307
|
/* Excluded from this release type: LookupResult */
|
|
8047
8308
|
|
|
8048
8309
|
/**
|
|
8049
|
-
* Skip caching
|
|
8310
|
+
* Skip caching entirely when the conversation has more than this many messages. Unset by default (no limit). Set a bound to guard against topic drift: the cache key covers only the last recentMessageCount messages, so the deeper a conversation goes, the more likely a match on recent messages alone ignores earlier context that should change the answer.
|
|
8050
8311
|
* @public
|
|
8051
8312
|
*/
|
|
8052
8313
|
declare type MaxConversationLength = number;
|
|
@@ -10572,6 +10833,12 @@ export declare interface OktaJwtInboundPolicyOptions {
|
|
|
10572
10833
|
oAuthResourceMetadataEnabled?: boolean;
|
|
10573
10834
|
}
|
|
10574
10835
|
|
|
10836
|
+
/**
|
|
10837
|
+
* What to do if the scanner itself throws. The engine is a local in-gateway scanner, so this is effectively unreachable outside of a runtime defect — but a guardrail must declare its failure posture. `block` (the default) fails closed with a 500 in the route's native error format; `allow` fails open and serves the content uninspected.
|
|
10838
|
+
* @public
|
|
10839
|
+
*/
|
|
10840
|
+
declare type OnEngineError = "block" | "allow";
|
|
10841
|
+
|
|
10575
10842
|
/**
|
|
10576
10843
|
* What to do when the Akamai detect call itself fails (invalid API key, rate limit, outage). 'block' (the default) fails closed and returns a 502 so unverified content is never served; 'allow' fails open and lets the request through without inspection. An onError value in the AI Gateway app configuration takes precedence over this option.
|
|
10577
10844
|
* @public
|
|
@@ -10630,19 +10897,19 @@ declare interface OnSendingAwsLambdaEventHook {
|
|
|
10630
10897
|
}
|
|
10631
10898
|
|
|
10632
10899
|
/**
|
|
10633
|
-
*
|
|
10900
|
+
* What to do when the request shape cannot be inspected. As a guardrail this policy defaults to `deny` (fail closed) so uninspectable content is never served.
|
|
10634
10901
|
* @public
|
|
10635
10902
|
*/
|
|
10636
10903
|
declare type OnUnknownShape = "deny" | "skip";
|
|
10637
10904
|
|
|
10638
10905
|
/**
|
|
10639
|
-
*
|
|
10906
|
+
* Unused by the cache (a cache miss is never unsafe, so it always fails open). Present for interface consistency.
|
|
10640
10907
|
* @public
|
|
10641
10908
|
*/
|
|
10642
10909
|
declare type OnUnknownShape_2 = "deny" | "skip";
|
|
10643
10910
|
|
|
10644
10911
|
/**
|
|
10645
|
-
* What to do
|
|
10912
|
+
* What to do when the request shape cannot be inspected. As a guardrail, this policy defaults to 'deny' (fail closed) so uninspectable content is never served.
|
|
10646
10913
|
* @public
|
|
10647
10914
|
*/
|
|
10648
10915
|
declare type OnUnknownShape_3 = "deny" | "skip";
|
|
@@ -10653,6 +10920,12 @@ declare type OnUnknownShape_3 = "deny" | "skip";
|
|
|
10653
10920
|
*/
|
|
10654
10921
|
declare type OnUnknownShape_4 = "deny" | "skip";
|
|
10655
10922
|
|
|
10923
|
+
/**
|
|
10924
|
+
* What to do on a shape the policy cannot read. As an observer this defaults to 'skip' (fail open — pass through untraced).
|
|
10925
|
+
* @public
|
|
10926
|
+
*/
|
|
10927
|
+
declare type OnUnknownShape_5 = "deny" | "skip";
|
|
10928
|
+
|
|
10656
10929
|
/**
|
|
10657
10930
|
* Handler that serves OpenAPI specification files.
|
|
10658
10931
|
* Use this to expose your API documentation in a standard format that can be
|
|
@@ -12339,6 +12612,12 @@ export declare function ReadmeMetricsInboundPolicy(
|
|
|
12339
12612
|
policyName: string
|
|
12340
12613
|
): Promise<ZuploRequest<RequestGeneric>>;
|
|
12341
12614
|
|
|
12615
|
+
/**
|
|
12616
|
+
* How many of the conversation's most recent messages (input items on the Responses endpoint) form the cache key, both when storing a response and when matching later requests. Earlier messages are ignored, so a multi-turn conversation can hit an entry cached from a shorter one; system messages are always included. Requests whose keyed window contains no user message (for example a conversation ending in an assistant prefill) are not cached. Defaults to 1 (match on the newest message only).
|
|
12617
|
+
* @public
|
|
12618
|
+
*/
|
|
12619
|
+
declare type RecentMessageCount = number;
|
|
12620
|
+
|
|
12342
12621
|
/**
|
|
12343
12622
|
* Record the GraphQL response-cache outcome for the in-flight operation so
|
|
12344
12623
|
* the analytics middleware can emit it as the `cacheState` dimension on the
|
|
@@ -208,6 +208,7 @@ declare const EventType: {
|
|
|
208
208
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
209
209
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
210
210
|
readonly CACHE_OPERATION: "cache_operation";
|
|
211
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
211
212
|
};
|
|
212
213
|
|
|
213
214
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -138,6 +138,7 @@ declare const EventType: {
|
|
|
138
138
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
139
139
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
140
140
|
readonly CACHE_OPERATION: "cache_operation";
|
|
141
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -198,6 +198,7 @@ declare const EventType: {
|
|
|
198
198
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
199
199
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
200
200
|
readonly CACHE_OPERATION: "cache_operation";
|
|
201
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
201
202
|
};
|
|
202
203
|
|
|
203
204
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -113,6 +113,7 @@ declare const EventType: {
|
|
|
113
113
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
114
114
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
115
115
|
readonly CACHE_OPERATION: "cache_operation";
|
|
116
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
116
117
|
};
|
|
117
118
|
|
|
118
119
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -357,6 +357,7 @@ declare const EventType: {
|
|
|
357
357
|
readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
|
|
358
358
|
readonly GRAPHQL_OPERATION: "graphql_operation";
|
|
359
359
|
readonly CACHE_OPERATION: "cache_operation";
|
|
360
|
+
readonly HANDLER_EXECUTION: "handler_execution";
|
|
360
361
|
};
|
|
361
362
|
|
|
362
363
|
declare type EventType = (typeof EventType)[keyof typeof EventType];
|
|
@@ -2,8 +2,9 @@ export default function ansiRegex({onlyFirst = false} = {}) {
|
|
|
2
2
|
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
3
3
|
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
|
4
4
|
|
|
5
|
-
// OSC sequences only: ESC ] ... ST
|
|
6
|
-
|
|
5
|
+
// OSC sequences only: ESC ] ... ST
|
|
6
|
+
// The payload stops at the first terminator character rather than scanning ahead for one, so an unterminated `ESC ]` cannot rescan the rest of the input. Terminals likewise abort a control string on an unexpected ESC.
|
|
7
|
+
const osc = `(?:\\u001B\\][^\\u0007\\u001B\\u009C]*${ST})`;
|
|
7
8
|
|
|
8
9
|
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
|
9
10
|
const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
|
|
@@ -36,6 +36,8 @@ The parser is lenient and does not error. You should validate `type` and `parame
|
|
|
36
36
|
#### Options
|
|
37
37
|
|
|
38
38
|
- `parameters` (default: `true`): Set to `false` to skip parameters.
|
|
39
|
+
- `comma` (default: `false`): Set to `true` to stop on a comma. This can be used to parse the media range in an `Accept` header.
|
|
40
|
+
- `start` (default: `0`): Set index to start parsing from.
|
|
39
41
|
|
|
40
42
|
### contentType.format(obj)
|
|
41
43
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export interface ContentType {
|
|
10
10
|
type: string;
|
|
11
|
+
index: number;
|
|
11
12
|
parameters: Record<string, string>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
@@ -18,7 +19,26 @@ export declare function format(obj: Partial<ContentType>): string;
|
|
|
18
19
|
* Options for parsing a `Content-Type` header.
|
|
19
20
|
*/
|
|
20
21
|
export interface ParseOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Exit early on the first semicolon, returning only the type.
|
|
24
|
+
* This is useful for parsing the MIME from `Content-Type` headers.
|
|
25
|
+
*
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
21
28
|
parameters?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Exits early on a comma, returning the first value and parameters.
|
|
31
|
+
* This is useful for parsing `Accept` headers.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
comma?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The index to start parsing from.
|
|
38
|
+
*
|
|
39
|
+
* @default 0
|
|
40
|
+
*/
|
|
41
|
+
start?: number;
|
|
22
42
|
}
|
|
23
43
|
/**
|
|
24
44
|
* Parse a `Content-Type` header.
|