@zuplo/cli 7.9.9 → 7.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@posthog/core/dist/featureFlagUtils.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/featureFlagUtils.js +2 -1
- package/node_modules/@posthog/core/dist/featureFlagUtils.mjs +2 -1
- package/node_modules/@posthog/core/dist/index.d.ts +1 -0
- package/node_modules/@posthog/core/dist/index.d.ts.map +1 -1
- package/node_modules/@posthog/core/dist/index.js +66 -10
- package/node_modules/@posthog/core/dist/index.mjs +1 -0
- package/node_modules/@posthog/core/dist/privacy.d.ts +35 -0
- package/node_modules/@posthog/core/dist/privacy.d.ts.map +1 -0
- package/node_modules/@posthog/core/dist/privacy.js +366 -0
- package/node_modules/@posthog/core/dist/privacy.mjs +319 -0
- package/node_modules/@posthog/core/package.json +2 -2
- package/node_modules/@posthog/core/src/featureFlagUtils.ts +2 -0
- package/node_modules/@posthog/core/src/index.ts +1 -0
- package/node_modules/@posthog/core/src/privacy.ts +696 -0
- 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 +39 -8
- package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
- package/node_modules/@posthog/types/package.json +1 -1
- package/node_modules/@posthog/types/src/index.ts +1 -0
- package/node_modules/@posthog/types/src/posthog-config.ts +41 -8
- package/node_modules/@zuplo/core/customer.cli.minified.js +223 -223
- package/node_modules/@zuplo/core/index.minified.js +228 -228
- 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-2XSPVUOE.js +411 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-2XSPVUOE.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-PBDT4FDO.js +37 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-MWIJG5KC.js.map → chunk-PBDT4FDO.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-54HRCPVQ.js → chunk-VTO3F6DK.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-6O4OZCO6.js → chunk-YJ2BHVUH.js} +2 -2
- 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/internal/index.js +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/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +164 -54
- package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +44 -0
- package/node_modules/@zuplo/runtime/package.json +1 -1
- package/node_modules/express-rate-limit/dist/index.cjs +9 -7
- package/node_modules/express-rate-limit/dist/index.mjs +9 -7
- package/node_modules/express-rate-limit/package.json +9 -9
- package/node_modules/fast-copy/README.md +8 -7
- package/node_modules/fast-copy/dist/cjs/index.cjs +1 -1
- package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
- package/node_modules/fast-copy/dist/es/index.mjs +1 -1
- package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
- package/node_modules/fast-copy/dist/umd/index.js +1 -1
- package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
- package/node_modules/fast-copy/package.json +1 -1
- package/package.json +11 -11
- package/node_modules/@zuplo/runtime/out/esm/chunk-MWIJG5KC.js +0 -37
- package/node_modules/@zuplo/runtime/out/esm/chunk-WFAFGL5Y.js +0 -411
- package/node_modules/@zuplo/runtime/out/esm/chunk-WFAFGL5Y.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-WFAFGL5Y.js.LEGAL.txt → chunk-2XSPVUOE.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-MWIJG5KC.js.LEGAL.txt → chunk-PBDT4FDO.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-54HRCPVQ.js.map → chunk-VTO3F6DK.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-6O4OZCO6.js.map → chunk-YJ2BHVUH.js.map} +0 -0
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{E as p,J as c,M as u}from"../chunk-
|
|
25
|
+
import{E as p,J as c,M as u}from"../chunk-2XSPVUOE.js";import"../chunk-VTO3F6DK.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-YJ2BHVUH.js";import{aa as i}from"../chunk-PBDT4FDO.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{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-
|
|
25
|
+
import{H as a,I as l,J as c,K as o,N as p,O as y,P as m}from"../../chunk-YJ2BHVUH.js";import"../../chunk-PBDT4FDO.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
|
|
@@ -526,59 +526,19 @@ export declare function aiGatewayHandlerV2(
|
|
|
526
526
|
): Promise<Response>;
|
|
527
527
|
|
|
528
528
|
/**
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
* network with `403 Forbidden`.
|
|
532
|
-
*
|
|
533
|
-
* Use it in place of AI Gateway Authentication on an application that is only
|
|
534
|
-
* ever called by other routes and policies on the same gateway, such as the
|
|
535
|
-
* classifier application behind the Smart Router or Prompt Injection
|
|
536
|
-
* Protection policies. Those calls never leave the gateway, so an API key on
|
|
537
|
-
* them protects nothing. This policy asserts the one thing that matters: the
|
|
538
|
-
* request originated inside the deployment.
|
|
539
|
-
*
|
|
540
|
-
* The check reads `context.parentContext`, which the runtime sets only on the
|
|
541
|
-
* child context that `context.invokeRoute` creates. A client cannot supply it
|
|
542
|
-
* through a header, the URL, or the body. The policy has no options, makes no
|
|
543
|
-
* network calls, reads no body, and leaves `request.user` unset.
|
|
544
|
-
*
|
|
545
|
-
* @title Ensure Gateway Internal Invocation Only
|
|
546
|
-
* @product ai-gateway
|
|
547
|
-
* @requiresAI
|
|
529
|
+
* @deprecated Use InternalOnlyInboundPolicy instead. This name is from before
|
|
530
|
+
* the policy moved out of the AI Gateway.
|
|
548
531
|
* @public
|
|
549
|
-
*
|
|
550
|
-
* @param request - The incoming ZuploRequest
|
|
551
|
-
* @param context - The ZuploContext
|
|
552
|
-
* @param _options - The policy options set in policies.json (this policy has none)
|
|
553
|
-
* @param policyName - The name of the policy as set in policies.json
|
|
554
|
-
* @returns The request when the gateway made it with `context.invokeRoute`, otherwise a 403 response
|
|
555
|
-
*
|
|
556
|
-
* @example
|
|
557
|
-
* ```json
|
|
558
|
-
* // policies.json - Declare the policy so an application chain can select it
|
|
559
|
-
* {
|
|
560
|
-
* "name": "ai-gateway-internal-only-inbound",
|
|
561
|
-
* "policyType": "ai-gateway-internal-only",
|
|
562
|
-
* "handler": {
|
|
563
|
-
* "export": "AIGatewayInternalOnlyInboundPolicy",
|
|
564
|
-
* "module": "$import(@zuplo/runtime)",
|
|
565
|
-
* "options": {}
|
|
566
|
-
* }
|
|
567
|
-
* }
|
|
568
|
-
* ```
|
|
569
532
|
*/
|
|
570
|
-
export declare
|
|
571
|
-
request: ZuploRequest,
|
|
572
|
-
context: ZuploContext,
|
|
573
|
-
_options: AIGatewayInternalOnlyInboundPolicyOptions,
|
|
574
|
-
policyName: string
|
|
575
|
-
): Promise<ZuploRequest | Response>;
|
|
533
|
+
export declare const AIGatewayInternalOnlyInboundPolicy: typeof InternalOnlyInboundPolicy;
|
|
576
534
|
|
|
577
535
|
/**
|
|
578
|
-
*
|
|
536
|
+
* @deprecated Use InternalOnlyInboundPolicyOptions instead. This name is from
|
|
537
|
+
* before the policy moved out of the AI Gateway.
|
|
579
538
|
* @public
|
|
580
539
|
*/
|
|
581
|
-
export declare
|
|
540
|
+
export declare type AIGatewayInternalOnlyInboundPolicyOptions =
|
|
541
|
+
InternalOnlyInboundPolicyOptions;
|
|
582
542
|
|
|
583
543
|
/* Excluded from this release type: AIGatewayMeterIncrements */
|
|
584
544
|
|
|
@@ -1813,7 +1773,7 @@ export declare interface ApiAuthKeyInboundPolicyOptions {
|
|
|
1813
1773
|
declare type APIKey = string;
|
|
1814
1774
|
|
|
1815
1775
|
/**
|
|
1816
|
-
* Credential used to run the classifier. Without `appId` this is the API key for the OpenAI-compatible service at `baseUrl`, and it is required. With `appId` it is optional: omit it when the classifier app runs the
|
|
1776
|
+
* Credential used to run the classifier. Without `appId` this is the API key for the OpenAI-compatible service at `baseUrl`, and it is required. With `appId` it is optional: omit it when the classifier app runs the Internal Only policy, which authorizes the in-process invocation itself, and set it only when that app authenticates callers with API keys, in which case it is sent as `Authorization: Bearer`.
|
|
1817
1777
|
* @public
|
|
1818
1778
|
*/
|
|
1819
1779
|
declare type APIKey_2 = string;
|
|
@@ -3750,7 +3710,8 @@ declare interface ChatCompletionResponse {
|
|
|
3750
3710
|
}
|
|
3751
3711
|
|
|
3752
3712
|
/**
|
|
3753
|
-
*
|
|
3713
|
+
* @deprecated
|
|
3714
|
+
* Deprecated: use classifier.adapter with flat apiKey, model, and baseUrl fields. Classify by calling an OpenAI-compatible Chat Completions API directly, outside the gateway. The model must support structured outputs (`response_format` with a JSON schema).
|
|
3754
3715
|
* @public
|
|
3755
3716
|
*/
|
|
3756
3717
|
declare interface ChatCompletionsAPI {
|
|
@@ -3796,15 +3757,31 @@ declare type Claim = string;
|
|
|
3796
3757
|
declare type ClaimCheck = EqualsRule | InRule | StartsWithRule;
|
|
3797
3758
|
|
|
3798
3759
|
/**
|
|
3799
|
-
* Where the
|
|
3760
|
+
* Where the prompt is classified. For a direct API, set adapter, apiKey, model, and optional baseUrl. Alternatively set app. Legacy chatCompletions and jev sections remain supported; do not mix forms.
|
|
3800
3761
|
* @public
|
|
3801
3762
|
*/
|
|
3802
3763
|
declare interface Classifier {
|
|
3803
3764
|
app?: ClassifierApp;
|
|
3804
3765
|
chatCompletions?: ChatCompletionsAPI;
|
|
3805
3766
|
jev?: JevTypeSafe;
|
|
3767
|
+
adapter?: ClassifierAdapter;
|
|
3768
|
+
apiKey?: ClassifierAPIKey;
|
|
3769
|
+
model?: ClassifierModel1;
|
|
3770
|
+
baseUrl?: ClassifierBaseURL;
|
|
3806
3771
|
}
|
|
3807
3772
|
|
|
3773
|
+
/**
|
|
3774
|
+
* API contract for direct classification. chatCompletions requires a model supporting JSON-schema structured outputs. systemOne uses the existing Jev typed-question implementation; it does not accept classifierPrompt.
|
|
3775
|
+
* @public
|
|
3776
|
+
*/
|
|
3777
|
+
declare type ClassifierAdapter = "chatCompletions" | "systemOne";
|
|
3778
|
+
|
|
3779
|
+
/**
|
|
3780
|
+
* API key for the direct classifier, sent as Authorization: Bearer.
|
|
3781
|
+
* @public
|
|
3782
|
+
*/
|
|
3783
|
+
declare type ClassifierAPIKey = string;
|
|
3784
|
+
|
|
3808
3785
|
/**
|
|
3809
3786
|
* Classify with another AI Gateway app in this project. The call runs in-process and never leaves the gateway, so the classifier uses that app's providers, routing, and quotas.
|
|
3810
3787
|
* @public
|
|
@@ -3816,7 +3793,7 @@ declare interface ClassifierApp {
|
|
|
3816
3793
|
}
|
|
3817
3794
|
|
|
3818
3795
|
/**
|
|
3819
|
-
* API key sent as `Authorization: Bearer` when invoking the classifier app. Omit it when the classifier app runs the
|
|
3796
|
+
* API key sent as `Authorization: Bearer` when invoking the classifier app. Omit it when the classifier app runs the Internal Only policy: the classifier call never leaves the gateway, so that policy accepts it and rejects everything arriving over the network, and no credential is sent. Set it only when the classifier app authenticates callers with API keys.
|
|
3820
3797
|
* @public
|
|
3821
3798
|
*/
|
|
3822
3799
|
declare type ClassifierAppAPIKey = string;
|
|
@@ -3828,7 +3805,7 @@ declare type ClassifierAppAPIKey = string;
|
|
|
3828
3805
|
declare type ClassifierAppAPIKeyDeprecated = string;
|
|
3829
3806
|
|
|
3830
3807
|
/**
|
|
3831
|
-
* Run the classifier on another AI Gateway app instead of calling an external API directly. The gateway invokes that app in-process — no outbound HTTP hop — so the classifier inherits its provider credentials, model routing, fallbacks and quotas, and provider keys stay on one app. Give that app the
|
|
3808
|
+
* Run the classifier on another AI Gateway app instead of calling an external API directly. The gateway invokes that app in-process — no outbound HTTP hop — so the classifier inherits its provider credentials, model routing, fallbacks and quotas, and provider keys stay on one app. Give that app the Internal Only policy and `apiKey` is not needed at all. When set, `model` must name a routed model as `provider/model` and `baseUrl` must not be set. The target app must not itself run this policy: it would be asked to classify its own classification request, which is rejected as a configuration error rather than silently skipped. Omit to call `baseUrl` directly.
|
|
3832
3809
|
* @public
|
|
3833
3810
|
*/
|
|
3834
3811
|
declare type ClassifierAppID = string;
|
|
@@ -3845,12 +3822,24 @@ declare type ClassifierAppID_2 = string;
|
|
|
3845
3822
|
*/
|
|
3846
3823
|
declare type ClassifierAppIDDeprecated = string;
|
|
3847
3824
|
|
|
3825
|
+
/**
|
|
3826
|
+
* HTTP(S) API root. chatCompletions defaults to https://api.openai.com/v1 and appends /chat/completions. systemOne defaults to https://api.typesafe.ai and appends /v1/systemone.
|
|
3827
|
+
* @public
|
|
3828
|
+
*/
|
|
3829
|
+
declare type ClassifierBaseURL = string;
|
|
3830
|
+
|
|
3848
3831
|
/**
|
|
3849
3832
|
* Tool-calling capable model used to classify prompts. Prefer a small, fast model; the classification runs before every inspected request reaches the upstream model. With `appId` set this must name a model the classifier app routes, written as `provider/model` (for example `openai/gpt-4o-mini`), and has no default.
|
|
3850
3833
|
* @public
|
|
3851
3834
|
*/
|
|
3852
3835
|
declare type ClassifierModel = string;
|
|
3853
3836
|
|
|
3837
|
+
/**
|
|
3838
|
+
* Model id sent to the direct API. Required for chatCompletions; defaults to jev-latest for systemOne.
|
|
3839
|
+
* @public
|
|
3840
|
+
*/
|
|
3841
|
+
declare type ClassifierModel1 = string;
|
|
3842
|
+
|
|
3854
3843
|
/**
|
|
3855
3844
|
* The model (`providerName/model`) the classifier app uses to evaluate the user's request. E.g. `openai/gpt-4o-mini`.
|
|
3856
3845
|
* @public
|
|
@@ -3870,7 +3859,7 @@ declare type ClassifierModelDeprecated = string;
|
|
|
3870
3859
|
declare type ClassifierPrompt = string | [string, ...string[]];
|
|
3871
3860
|
|
|
3872
3861
|
/**
|
|
3873
|
-
* Prompt
|
|
3862
|
+
* Prompt for classifier.app or the chatCompletions adapter (including its legacy section). Omit to use the built-in prompt. The systemOne adapter and legacy jev section take no prompt; combining them with classifierPrompt is a configuration error.
|
|
3874
3863
|
* @public
|
|
3875
3864
|
*/
|
|
3876
3865
|
declare type ClassifierPrompt_2 = string | [string, ...string[]];
|
|
@@ -4135,6 +4124,50 @@ declare interface CompatibilityFlags {
|
|
|
4135
4124
|
* @compatibilityDate 2026-03-01
|
|
4136
4125
|
*/
|
|
4137
4126
|
return501ForUnsupportedHttpMethods: boolean;
|
|
4127
|
+
/**
|
|
4128
|
+
* Whether the MCP server handler leaves the non-standard
|
|
4129
|
+
* `capabilities.tools.supported` and `capabilities.tools.available` fields
|
|
4130
|
+
* out of its `initialize` response.
|
|
4131
|
+
*
|
|
4132
|
+
* Before this flag: `initialize` returns `supported: true` and lists every
|
|
4133
|
+
* registered tool name in `available`, to every caller.
|
|
4134
|
+
*
|
|
4135
|
+
* After this flag: `initialize` returns `capabilities.tools: {}`. Clients
|
|
4136
|
+
* discover tools with `tools/list`, as the MCP spec defines.
|
|
4137
|
+
*/
|
|
4138
|
+
removeMcpToolsCapabilityExtension: boolean;
|
|
4139
|
+
/**
|
|
4140
|
+
* Whether OpenAPI schema combinators (`allOf`, `oneOf`, `anyOf`, `not`) are
|
|
4141
|
+
* applied with JSON Schema semantics when an operation's schemas are turned
|
|
4142
|
+
* into runtime validators. Today that is the MCP server handler: a tool's
|
|
4143
|
+
* advertised `inputSchema`/`outputSchema` and its argument validation.
|
|
4144
|
+
* `request-validation-inbound` already uses Ajv and is unaffected.
|
|
4145
|
+
*
|
|
4146
|
+
* Before this flag:
|
|
4147
|
+
* - A top-level combinator is used on its own, and every keyword beside it
|
|
4148
|
+
* (`type`, `properties`, `required`, `additionalProperties`, `nullable`,
|
|
4149
|
+
* `description`, ...) is ignored. A body of
|
|
4150
|
+
* `{ type: object, properties, required, oneOf: [...] }` can be advertised
|
|
4151
|
+
* as `{ anyOf: [{}, {}] }` and accept any value.
|
|
4152
|
+
* - `oneOf` behaves like `anyOf`: a value matching several branches is
|
|
4153
|
+
* accepted, and `oneOf` is advertised as `anyOf`.
|
|
4154
|
+
*
|
|
4155
|
+
* After this flag:
|
|
4156
|
+
* - The schema's own keywords and every combinator beside them all apply,
|
|
4157
|
+
* intersected.
|
|
4158
|
+
* - `oneOf` accepts a value only when exactly one branch matches, and is
|
|
4159
|
+
* advertised as `oneOf`.
|
|
4160
|
+
* - Within a combinator schema and its branches: `required`,
|
|
4161
|
+
* `additionalProperties`, `minProperties` or `maxProperties` without a
|
|
4162
|
+
* `type` mark an object schema, an object schema rejects non-objects, a
|
|
4163
|
+
* `required` name that `properties` omits is enforced, a numeric or
|
|
4164
|
+
* boolean `enum` is enforced, and `unevaluatedProperties: false` is
|
|
4165
|
+
* enforced. A schema with no combinator is unchanged.
|
|
4166
|
+
*
|
|
4167
|
+
* The advertised schema changes for every affected tool, and calls the
|
|
4168
|
+
* gateway's request validation would reject are rejected with -32602.
|
|
4169
|
+
*/
|
|
4170
|
+
enforceOpenApiCombinatorSemantics: boolean;
|
|
4138
4171
|
}
|
|
4139
4172
|
|
|
4140
4173
|
declare interface CompletionsFallbacks {
|
|
@@ -7819,6 +7852,82 @@ declare type Intents = [
|
|
|
7819
7852
|
}[],
|
|
7820
7853
|
];
|
|
7821
7854
|
|
|
7855
|
+
/**
|
|
7856
|
+
* Accepts only requests that this gateway made itself with
|
|
7857
|
+
* `context.invokeRoute`, and rejects every request that arrived over the
|
|
7858
|
+
* network.
|
|
7859
|
+
*
|
|
7860
|
+
* Use it on a route that only other routes, handlers, and policies on the same
|
|
7861
|
+
* gateway call: a REST endpoint that an MCP server exposes as a tool, or the
|
|
7862
|
+
* classifier application behind the Smart Router or Prompt Injection
|
|
7863
|
+
* Protection policies. Those calls never leave the gateway, so an API key on
|
|
7864
|
+
* them protects nothing. This policy asserts the one thing that matters: the
|
|
7865
|
+
* request originated inside the deployment.
|
|
7866
|
+
*
|
|
7867
|
+
* The check reads `context.parentContext`, which the runtime sets only on the
|
|
7868
|
+
* child context that `context.invokeRoute` creates. A client cannot supply it
|
|
7869
|
+
* through a header, the URL, or the body. The policy makes no network calls,
|
|
7870
|
+
* reads no body, and leaves `request.user` unset.
|
|
7871
|
+
*
|
|
7872
|
+
* A rejected request gets a `403 Forbidden` problem response with no `detail`
|
|
7873
|
+
* by default, so the caller learns nothing about how the gateway works; the
|
|
7874
|
+
* reason goes to the request log. Set `status` to answer with another client
|
|
7875
|
+
* error, such as `404` to hide the route or `401`, `statusText` to change the
|
|
7876
|
+
* status text, and `detail` to add a message.
|
|
7877
|
+
*
|
|
7878
|
+
* @title Internal Only
|
|
7879
|
+
* @product api-gateway
|
|
7880
|
+
* @product ai-gateway
|
|
7881
|
+
* @public
|
|
7882
|
+
*
|
|
7883
|
+
* @param request - The incoming ZuploRequest
|
|
7884
|
+
* @param context - The ZuploContext
|
|
7885
|
+
* @param options - The policy options set in policies.json
|
|
7886
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
7887
|
+
* @returns The request when the gateway made it with `context.invokeRoute`, otherwise the rejection response
|
|
7888
|
+
*
|
|
7889
|
+
* @example
|
|
7890
|
+
* ```json
|
|
7891
|
+
* // policies.json - Hide a REST route that an MCP server calls as a tool
|
|
7892
|
+
* {
|
|
7893
|
+
* "name": "internal-only-inbound",
|
|
7894
|
+
* "policyType": "internal-only-inbound",
|
|
7895
|
+
* "handler": {
|
|
7896
|
+
* "export": "InternalOnlyInboundPolicy",
|
|
7897
|
+
* "module": "$import(@zuplo/runtime)",
|
|
7898
|
+
* "options": {
|
|
7899
|
+
* "status": 404
|
|
7900
|
+
* }
|
|
7901
|
+
* }
|
|
7902
|
+
* }
|
|
7903
|
+
* ```
|
|
7904
|
+
*/
|
|
7905
|
+
export declare function InternalOnlyInboundPolicy(
|
|
7906
|
+
request: ZuploRequest,
|
|
7907
|
+
context: ZuploContext,
|
|
7908
|
+
options: InternalOnlyInboundPolicyOptions,
|
|
7909
|
+
policyName: string
|
|
7910
|
+
): Promise<ZuploRequest | Response>;
|
|
7911
|
+
|
|
7912
|
+
/**
|
|
7913
|
+
* The options for this policy.
|
|
7914
|
+
* @public
|
|
7915
|
+
*/
|
|
7916
|
+
export declare interface InternalOnlyInboundPolicyOptions {
|
|
7917
|
+
/**
|
|
7918
|
+
* The HTTP status code returned to a request that did not come from inside the gateway. Any client error status from 400 to 499 is allowed. Use `404` to answer as if the route did not exist, or `401` to answer as an authentication policy does.
|
|
7919
|
+
*/
|
|
7920
|
+
status?: number;
|
|
7921
|
+
/**
|
|
7922
|
+
* The status text returned with `status`, such as `Not Found`. When it is omitted, the response uses the standard text for the status. Clients don't always receive it: HTTP/2 and HTTP/3 have no status text, and Managed Dedicated and self-hosted gateways always send the standard text.
|
|
7923
|
+
*/
|
|
7924
|
+
statusText?: string;
|
|
7925
|
+
/**
|
|
7926
|
+
* The `detail` of the problem response returned to a rejected request. Every caller outside the gateway receives it, so don't describe how the route is called. When it is omitted, the response has no `detail`, and a `404` matches the response for a route that does not exist.
|
|
7927
|
+
*/
|
|
7928
|
+
detail?: string;
|
|
7929
|
+
}
|
|
7930
|
+
|
|
7822
7931
|
/**
|
|
7823
7932
|
* Restricts which client IP addresses can call a route using an allow list, a
|
|
7824
7933
|
* deny list, or both. Entries are individual IP addresses or CIDR ranges, in
|
|
@@ -8147,7 +8256,8 @@ declare type JevBaseURL = string;
|
|
|
8147
8256
|
declare type JevModel = string;
|
|
8148
8257
|
|
|
8149
8258
|
/**
|
|
8150
|
-
*
|
|
8259
|
+
* @deprecated
|
|
8260
|
+
* Deprecated: use classifier.adapter with flat apiKey, model, and baseUrl fields. Classify with Jev, TypeSafe's classification model, by calling a System One API directly: TypeSafe's by default, or another host such as OpenRouter through `baseUrl`. Jev answers typed questions instead of generating text, so it takes no `classifierPrompt`.
|
|
8151
8261
|
* @public
|
|
8152
8262
|
*/
|
|
8153
8263
|
declare interface JevTypeSafe {
|
|
@@ -142,6 +142,50 @@ declare interface CompatibilityFlags {
|
|
|
142
142
|
* @compatibilityDate 2026-03-01
|
|
143
143
|
*/
|
|
144
144
|
return501ForUnsupportedHttpMethods: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the MCP server handler leaves the non-standard
|
|
147
|
+
* `capabilities.tools.supported` and `capabilities.tools.available` fields
|
|
148
|
+
* out of its `initialize` response.
|
|
149
|
+
*
|
|
150
|
+
* Before this flag: `initialize` returns `supported: true` and lists every
|
|
151
|
+
* registered tool name in `available`, to every caller.
|
|
152
|
+
*
|
|
153
|
+
* After this flag: `initialize` returns `capabilities.tools: {}`. Clients
|
|
154
|
+
* discover tools with `tools/list`, as the MCP spec defines.
|
|
155
|
+
*/
|
|
156
|
+
removeMcpToolsCapabilityExtension: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Whether OpenAPI schema combinators (`allOf`, `oneOf`, `anyOf`, `not`) are
|
|
159
|
+
* applied with JSON Schema semantics when an operation's schemas are turned
|
|
160
|
+
* into runtime validators. Today that is the MCP server handler: a tool's
|
|
161
|
+
* advertised `inputSchema`/`outputSchema` and its argument validation.
|
|
162
|
+
* `request-validation-inbound` already uses Ajv and is unaffected.
|
|
163
|
+
*
|
|
164
|
+
* Before this flag:
|
|
165
|
+
* - A top-level combinator is used on its own, and every keyword beside it
|
|
166
|
+
* (`type`, `properties`, `required`, `additionalProperties`, `nullable`,
|
|
167
|
+
* `description`, ...) is ignored. A body of
|
|
168
|
+
* `{ type: object, properties, required, oneOf: [...] }` can be advertised
|
|
169
|
+
* as `{ anyOf: [{}, {}] }` and accept any value.
|
|
170
|
+
* - `oneOf` behaves like `anyOf`: a value matching several branches is
|
|
171
|
+
* accepted, and `oneOf` is advertised as `anyOf`.
|
|
172
|
+
*
|
|
173
|
+
* After this flag:
|
|
174
|
+
* - The schema's own keywords and every combinator beside them all apply,
|
|
175
|
+
* intersected.
|
|
176
|
+
* - `oneOf` accepts a value only when exactly one branch matches, and is
|
|
177
|
+
* advertised as `oneOf`.
|
|
178
|
+
* - Within a combinator schema and its branches: `required`,
|
|
179
|
+
* `additionalProperties`, `minProperties` or `maxProperties` without a
|
|
180
|
+
* `type` mark an object schema, an object schema rejects non-objects, a
|
|
181
|
+
* `required` name that `properties` omits is enforced, a numeric or
|
|
182
|
+
* boolean `enum` is enforced, and `unevaluatedProperties: false` is
|
|
183
|
+
* enforced. A schema with no combinator is unchanged.
|
|
184
|
+
*
|
|
185
|
+
* The advertised schema changes for every affected tool, and calls the
|
|
186
|
+
* gateway's request validation would reject are rejected with -32602.
|
|
187
|
+
*/
|
|
188
|
+
enforceOpenApiCombinatorSemantics: boolean;
|
|
145
189
|
}
|
|
146
190
|
|
|
147
191
|
/**
|
|
@@ -955,13 +955,15 @@ var rateLimit = (passedOptions) => {
|
|
|
955
955
|
resetTime,
|
|
956
956
|
key
|
|
957
957
|
};
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
958
|
+
if (debug.enabled) {
|
|
959
|
+
for (const [key2, val] of Object.entries(info))
|
|
960
|
+
debug(
|
|
961
|
+
"set request.%s.%s to be %o",
|
|
962
|
+
config.requestPropertyName,
|
|
963
|
+
key2,
|
|
964
|
+
val
|
|
965
|
+
);
|
|
966
|
+
}
|
|
965
967
|
Object.defineProperty(info, "current", {
|
|
966
968
|
configurable: false,
|
|
967
969
|
enumerable: false,
|
|
@@ -912,13 +912,15 @@ var rateLimit = (passedOptions) => {
|
|
|
912
912
|
resetTime,
|
|
913
913
|
key
|
|
914
914
|
};
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
915
|
+
if (debug.enabled) {
|
|
916
|
+
for (const [key2, val] of Object.entries(info))
|
|
917
|
+
debug(
|
|
918
|
+
"set request.%s.%s to be %o",
|
|
919
|
+
config.requestPropertyName,
|
|
920
|
+
key2,
|
|
921
|
+
val
|
|
922
|
+
);
|
|
923
|
+
}
|
|
922
924
|
Object.defineProperty(info, "current", {
|
|
923
925
|
configurable: false,
|
|
924
926
|
enumerable: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-rate-limit",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
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",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"clean": "del-cli dist/ coverage/ *.log *.tmp *.bak *.tgz",
|
|
59
|
-
"build:cjs": "esbuild --packages=external --platform=node --bundle --target=
|
|
60
|
-
"build:esm": "esbuild --packages=external --platform=node --bundle --target=
|
|
59
|
+
"build:cjs": "esbuild --packages=external --platform=node --bundle --target=es2020 --format=cjs --outfile=dist/index.cjs --footer:js=\"module.exports = Object.assign(rateLimit, module.exports);\" source/index.ts",
|
|
60
|
+
"build:esm": "esbuild --packages=external --platform=node --bundle --target=es2020 --format=esm --outfile=dist/index.mjs source/index.ts",
|
|
61
61
|
"build:types": "dts-bundle-generator --out-file=dist/index.d.ts source/index.ts && cp dist/index.d.ts dist/index.d.cts && cp dist/index.d.ts dist/index.d.mts",
|
|
62
62
|
"compile": "run-s clean build:*",
|
|
63
63
|
"docs": "cd docs && mintlify dev",
|
|
@@ -86,20 +86,20 @@
|
|
|
86
86
|
"@biomejs/biome": "2.4.6",
|
|
87
87
|
"@express-rate-limit/prettier": "1.1.1",
|
|
88
88
|
"@express-rate-limit/tsconfig": "1.0.5",
|
|
89
|
-
"@jest/globals": "30.
|
|
89
|
+
"@jest/globals": "30.5.1",
|
|
90
90
|
"@types/debug": "4.1.13",
|
|
91
91
|
"@types/express": "5.0.6",
|
|
92
92
|
"@types/jest": "30.0.0",
|
|
93
|
-
"@types/node": "26.
|
|
93
|
+
"@types/node": "26.4.1",
|
|
94
94
|
"@types/supertest": "7.2.1",
|
|
95
95
|
"del-cli": "7.0.0",
|
|
96
96
|
"dts-bundle-generator": "8.1.2",
|
|
97
97
|
"esbuild": "0.28.2",
|
|
98
98
|
"express": "5.2.1",
|
|
99
99
|
"husky": "9.1.7",
|
|
100
|
-
"jest": "30.
|
|
101
|
-
"lint-staged": "17.
|
|
102
|
-
"mintlify": "4.2.
|
|
100
|
+
"jest": "30.5.1",
|
|
101
|
+
"lint-staged": "17.4.1",
|
|
102
|
+
"mintlify": "4.2.874",
|
|
103
103
|
"npm-run-all": "4.1.5",
|
|
104
104
|
"prettier": "3.9.6",
|
|
105
105
|
"ratelimit-header-parser": "0.1.0",
|
|
@@ -111,6 +111,6 @@
|
|
|
111
111
|
"prettier": "@express-rate-limit/prettier",
|
|
112
112
|
"lint-staged": {
|
|
113
113
|
"*.{js,ts,json}": "biome check --write",
|
|
114
|
-
"*.
|
|
114
|
+
"*.md": "prettier --write"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -78,12 +78,12 @@ Deeply copy the object passed, but with additional strictness when replicating t
|
|
|
78
78
|
import { copyStrict } from 'fast-copy';
|
|
79
79
|
|
|
80
80
|
const object = { foo: 'bar' };
|
|
81
|
-
|
|
81
|
+
Object.defineProperty(object, 'bar', {
|
|
82
82
|
enumerable: false,
|
|
83
83
|
value: 'baz',
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
const copied =
|
|
86
|
+
const copied = copyStrict(object);
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
**NOTE**: This method is significantly slower than [`copy`](#copy), so it is recommended to only use this when you have
|
|
@@ -230,7 +230,7 @@ function deeplyCloneArray<Value extends any[]>(
|
|
|
230
230
|
|
|
231
231
|
state.cache.set(value, clone);
|
|
232
232
|
|
|
233
|
-
value.forEach((item) => state.copier(item, state));
|
|
233
|
+
value.forEach((item) => clone.push(state.copier(item, state)));
|
|
234
234
|
|
|
235
235
|
return clone;
|
|
236
236
|
}
|
|
@@ -241,8 +241,9 @@ in [`cache`](#cache) eagerly when deeply copying, so that nested circular refere
|
|
|
241
241
|
|
|
242
242
|
###### `Constructor` / `prototype`
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
`Constructor` and `prototype` describe the object currently being copied, including standard objects and arrays. They
|
|
245
|
+
are reassigned for each recursive call to `state.copier`, so read them before copying nested values. These properties
|
|
246
|
+
are useful for custom subclasses of globals, or maintaining custom prototypes of objects.
|
|
246
247
|
|
|
247
248
|
```js
|
|
248
249
|
function deeplyCloneSubclassArray<Value extends CustomArray>(
|
|
@@ -253,7 +254,7 @@ function deeplyCloneSubclassArray<Value extends CustomArray>(
|
|
|
253
254
|
|
|
254
255
|
state.cache.set(value, clone);
|
|
255
256
|
|
|
256
|
-
value.forEach((item) => clone.push(item));
|
|
257
|
+
value.forEach((item) => clone.push(state.copier(item, state)));
|
|
257
258
|
|
|
258
259
|
return clone;
|
|
259
260
|
}
|
|
@@ -266,7 +267,7 @@ function deeplyCloneCustomObject<Value extends CustomObject>(
|
|
|
266
267
|
|
|
267
268
|
state.cache.set(value, clone);
|
|
268
269
|
|
|
269
|
-
Object.entries(value).forEach(([k, v]) => (clone[k] = v));
|
|
270
|
+
Object.entries(value).forEach(([k, v]) => (clone[k] = state.copier(v, state)));
|
|
270
271
|
|
|
271
272
|
return clone;
|
|
272
273
|
}
|
|
@@ -136,7 +136,7 @@ function copyBlob(blob, _state) {
|
|
|
136
136
|
* Create a new DataView with the contents of the original.
|
|
137
137
|
*/
|
|
138
138
|
function copyDataView(dataView, state) {
|
|
139
|
-
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
139
|
+
return new state.Constructor(copyArrayBuffer(dataView.buffer), dataView.byteOffset, dataView.byteLength);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Create a new Date based on the time of the original.
|