@zuplo/runtime 6.69.11 → 6.70.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.
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{b as l}from"../chunk-NEN7UYI6.js";import{X as n,a as t}from"../chunk-FFHHHNST.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function o(i){e.push(Promise.resolve(i))}return t(o,"waitUntil"),{context:new s({event:{waitUntil:o},route:u.route}),invokeResponse:t(async()=>{await Promise.all(e)},"invokeResponse")}}t(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:t(()=>({}),"raw")},s=class extends EventTarget{static{t(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:o=a,parentContext:r}){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:t(()=>{},"setLogProperties")},this.custom={},this.route=o,this.incomingRequestProperties={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},this.parentContext=r,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,o){throw new Error("Not implemented")}invokeOutboundPolicy(e,o,r){throw new Error("Not implemented")}invokeRoute(e,o){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,o,r){let p=t(i=>{try{typeof o=="function"?o(i):o.handleEvent(i)}catch(d){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),d}},"wrapped");super.addEventListener(e,p,r)}};export{s as MockZuploContext,g as createMockContext};
25
+ import{b as l}from"../chunk-5ZAQEULH.js";import{X as n,a as t}from"../chunk-FFHHHNST.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function o(i){e.push(Promise.resolve(i))}return t(o,"waitUntil"),{context:new s({event:{waitUntil:o},route:u.route}),invokeResponse:t(async()=>{await Promise.all(e)},"invokeResponse")}}t(g,"createMockContext");var a={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:t(()=>({}),"raw")},s=class extends EventTarget{static{t(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:o=a,parentContext:r}){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:t(()=>{},"setLogProperties")},this.custom={},this.route=o,this.incomingRequestProperties={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},this.parentContext=r,this.#e=e,this.analyticsContext=new l(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,o){throw new Error("Not implemented")}invokeOutboundPolicy(e,o,r){throw new Error("Not implemented")}invokeRoute(e,o){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,o,r){let p=t(i=>{try{typeof o=="function"?o(i):o.handleEvent(i)}catch(d){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),d}},"wrapped");super.addEventListener(e,p,r)}};export{s as MockZuploContext,g as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -474,6 +474,103 @@ export declare interface AkamaiApiSecurityPluginOptions {
474
474
  shouldLog?: ShouldLogFunction;
475
475
  }
476
476
 
477
+ /**
478
+ * Inspects each incoming request with Akamai's Firewall for AI detect API
479
+ * and blocks the request if Akamai returns a `deny` rule. Useful in front of
480
+ * AI-powered APIs to filter prompt injection, jailbreaks, and other unsafe
481
+ * inputs before they reach the model.
482
+ *
483
+ * The body, headers, URL, and query string sent to Akamai are configurable;
484
+ * by default only the request body is captured. Bodies are read from a clone
485
+ * so the upstream handler still sees the original.
486
+ *
487
+ * @title Akamai Firewall for AI - Inbound
488
+ * @public
489
+ * @param request - The ZuploRequest
490
+ * @param context - The ZuploContext
491
+ * @param options - The policy options set in policies.json
492
+ * @param policyName - The name of the policy as set in policies.json
493
+ * @returns A Request or a Response
494
+ */
495
+ export declare const AkamaiFirewallForAiInboundPolicy: InboundPolicyHandler<AkamaiFirewallForAiInboundPolicyOptions>;
496
+
497
+ /**
498
+ * The options for the Akamai Firewall for AI inbound policy. Sends the incoming request to Akamai's Firewall for AI detect endpoint and blocks the request if any rule returns a 'deny' action.
499
+ * @public
500
+ */
501
+ export declare interface AkamaiFirewallForAiInboundPolicyOptions {
502
+ /**
503
+ * Your Akamai Firewall for AI Configuration ID. This is the ID of the configuration in the Akamai Control Center that defines which detection rules to apply.
504
+ */
505
+ configurationId: string;
506
+ /**
507
+ * Your Akamai Firewall for AI API key, sent as the `Fai-Api-Key` header on each detect call.
508
+ */
509
+ "api-key": string;
510
+ capture?: CaptureSettings;
511
+ /**
512
+ * Behavior when Akamai returns a rule with `action: "alert"` (Akamai's Monitor mode). `log` writes a warning and lets the request through, `block` treats the alert like a deny, `none` is silent.
513
+ */
514
+ onWarn?: "log" | "block" | "none";
515
+ /**
516
+ * If true (the default), the policy throws when the Akamai detect call itself fails (network error, 5xx, malformed response). Set to false to fail open and allow the request through when Akamai is unreachable.
517
+ */
518
+ throwOnError?: boolean;
519
+ /**
520
+ * Override the Akamai Firewall for AI detect endpoint URL. The literal `{configurationId}` is replaced with the configured ID. Defaults to `https://aisec.akamai.com/fai/v1/fai-configurations/{configurationId}/detect`. Useful for regional Akamai endpoints or for pointing tests at a mock server.
521
+ */
522
+ detectUrl?: string;
523
+ }
524
+
525
+ /**
526
+ * Inspects each upstream response with Akamai's Firewall for AI detect API
527
+ * and replaces the response with a `403 Forbidden` if Akamai returns a `deny`
528
+ * rule. Useful behind AI-powered APIs to filter unsafe completions, sensitive
529
+ * data exposure, and toxic content before they reach the client.
530
+ *
531
+ * The body, headers, URL, and query string sent to Akamai are configurable;
532
+ * by default only the response body is captured. Bodies are read from a clone
533
+ * so the client still receives the original.
534
+ *
535
+ * @title Akamai Firewall for AI - Outbound
536
+ * @public
537
+ * @param response - The outgoing Response from the handler
538
+ * @param request - The original incoming Request
539
+ * @param context - The current context of the Request
540
+ * @param options - The configuration options for the policy
541
+ * @param policyName - The name of the policy as set in policies.json
542
+ * @returns A Response
543
+ */
544
+ export declare const AkamaiFirewallForAiOutboundPolicy: OutboundPolicyHandler<AkamaiFirewallForAiOutboundPolicyOptions>;
545
+
546
+ /**
547
+ * The options for the Akamai Firewall for AI outbound policy. Sends the upstream response to Akamai's Firewall for AI detect endpoint and blocks the response if any rule returns a 'deny' action.
548
+ * @public
549
+ */
550
+ export declare interface AkamaiFirewallForAiOutboundPolicyOptions {
551
+ /**
552
+ * Your Akamai Firewall for AI Configuration ID. This is the ID of the configuration in the Akamai Control Center that defines which detection rules to apply.
553
+ */
554
+ configurationId: string;
555
+ /**
556
+ * Your Akamai Firewall for AI API key, sent as the `Fai-Api-Key` header on each detect call.
557
+ */
558
+ "api-key": string;
559
+ capture?: CaptureSettings_2;
560
+ /**
561
+ * Behavior when Akamai returns a rule with `action: "alert"` (Akamai's Monitor mode). `log` writes a warning and lets the response through, `block` treats the alert like a deny, `none` is silent.
562
+ */
563
+ onWarn?: "log" | "block" | "none";
564
+ /**
565
+ * If true (the default), the policy throws when the Akamai detect call itself fails (network error, 5xx, malformed response). Set to false to fail open and allow the response through when Akamai is unreachable.
566
+ */
567
+ throwOnError?: boolean;
568
+ /**
569
+ * Override the Akamai Firewall for AI detect endpoint URL. The literal `{configurationId}` is replaced with the configured ID. Defaults to `https://aisec.akamai.com/fai/v1/fai-configurations/{configurationId}/detect`. Useful for regional Akamai endpoints or for pointing tests at a mock server.
570
+ */
571
+ detectUrl?: string;
572
+ }
573
+
477
574
  /**
478
575
  * Amberflo is a usage metering and billing service. This policy allows
479
576
  * you to send metering calls for each API to their meter ingest endpoint.
@@ -1868,6 +1965,68 @@ export declare interface CachingInboundPolicyOptions {
1868
1965
  statusCodes?: number[];
1869
1966
  }
1870
1967
 
1968
+ /**
1969
+ * Controls which parts of the incoming request are sent to Akamai for inspection. Akamai's detect endpoint receives the captured fields concatenated into a single labeled text payload as `llmInput`.
1970
+ * @public
1971
+ */
1972
+ declare interface CaptureSettings {
1973
+ /**
1974
+ * Include the request body. Only text-based content types (JSON, XML, form-encoded, text/*) are sent; binary bodies are skipped. The body is read from a clone of the request so the upstream still receives it unchanged.
1975
+ */
1976
+ body?: boolean;
1977
+ /**
1978
+ * Include the request headers. By default `Authorization`, `Proxy-Authorization`, `Cookie`, and `Set-Cookie` are stripped — see the `dangerouslyInclude*` flags to override.
1979
+ */
1980
+ headers?: boolean;
1981
+ /**
1982
+ * Include the request URL (origin and path, query string excluded). Enable `queryString` separately if you also want the query string.
1983
+ */
1984
+ url?: boolean;
1985
+ /**
1986
+ * Include the request query string. Query strings sometimes contain credentials or session tokens — leave this off unless you want Akamai to see them.
1987
+ */
1988
+ queryString?: boolean;
1989
+ /**
1990
+ * If `headers` is true, also include the `Authorization` and `Proxy-Authorization` headers. Off by default because these typically contain bearer tokens.
1991
+ */
1992
+ dangerouslyIncludeAuthorizationHeader?: boolean;
1993
+ /**
1994
+ * If `headers` is true, also include the `Cookie` header. Off by default because cookies often carry session credentials.
1995
+ */
1996
+ dangerouslyIncludeCookieHeader?: boolean;
1997
+ }
1998
+
1999
+ /**
2000
+ * Controls which parts of the upstream response (and the originating request URL) are sent to Akamai for inspection. Akamai's detect endpoint receives the captured fields concatenated into a single labeled text payload as `llmOutput`.
2001
+ * @public
2002
+ */
2003
+ declare interface CaptureSettings_2 {
2004
+ /**
2005
+ * Include the response body. Only text-based content types (JSON, XML, form-encoded, text/*) are sent; binary bodies are skipped. The body is read from a clone of the response so the client still receives it unchanged.
2006
+ */
2007
+ body?: boolean;
2008
+ /**
2009
+ * Include the response headers. By default `Set-Cookie` is stripped — see `dangerouslyIncludeCookieHeader` to override.
2010
+ */
2011
+ headers?: boolean;
2012
+ /**
2013
+ * Include the originating request URL (origin and path, query string excluded). Useful as context for the response.
2014
+ */
2015
+ url?: boolean;
2016
+ /**
2017
+ * Include the originating request's query string. Query strings sometimes contain credentials or session tokens — leave this off unless you want Akamai to see them.
2018
+ */
2019
+ queryString?: boolean;
2020
+ /**
2021
+ * If `headers` is true, also include any `Authorization` or `Proxy-Authorization` headers on the response. Rarely set on responses but stripped by default for safety.
2022
+ */
2023
+ dangerouslyIncludeAuthorizationHeader?: boolean;
2024
+ /**
2025
+ * If `headers` is true, also include the `Set-Cookie` header on the response. Off by default because Set-Cookie typically carries session credentials.
2026
+ */
2027
+ dangerouslyIncludeCookieHeader?: boolean;
2028
+ }
2029
+
1871
2030
  declare interface Category {
1872
2031
  Id?: string;
1873
2032
  CategoryId?: string;
@@ -2810,6 +2969,44 @@ declare const EventType: {
2810
2969
  readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
2811
2970
  readonly AI_GATEWAY_WARNING_COUNT: "ai_gateway_warning_count";
2812
2971
  readonly AI_GATEWAY_BLOCKED_COUNT: "ai_gateway_blocked_count";
2972
+ readonly MCP_GATEWAY_REQUEST_RECEIVED: "mcp_gateway_request_received";
2973
+ readonly MCP_GATEWAY_REQUEST_COMPLETED: "mcp_gateway_request_completed";
2974
+ readonly MCP_GATEWAY_REQUEST_REJECTED: "mcp_gateway_request_rejected";
2975
+ readonly MCP_GATEWAY_INITIALIZE_NEGOTIATED: "mcp_gateway_initialize_negotiated";
2976
+ readonly MCP_GATEWAY_CLIENT_UNSUPPORTED_BEHAVIOR: "mcp_gateway_client_unsupported_behavior";
2977
+ readonly MCP_GATEWAY_CATALOG_LISTED: "mcp_gateway_catalog_listed";
2978
+ readonly MCP_GATEWAY_CATALOG_IMPORTED: "mcp_gateway_catalog_imported";
2979
+ readonly MCP_GATEWAY_CATALOG_DRIFT_DETECTED: "mcp_gateway_catalog_drift_detected";
2980
+ readonly MCP_GATEWAY_CAPABILITY_LISTED: "mcp_gateway_capability_listed";
2981
+ readonly MCP_GATEWAY_CAPABILITY_INVOKED: "mcp_gateway_capability_invoked";
2982
+ readonly MCP_GATEWAY_CAPABILITY_COMPLETED: "mcp_gateway_capability_completed";
2983
+ readonly MCP_GATEWAY_CAPABILITY_FAILED: "mcp_gateway_capability_failed";
2984
+ readonly MCP_GATEWAY_CAPABILITY_CONNECT_REQUIRED: "mcp_gateway_capability_connect_required";
2985
+ readonly MCP_GATEWAY_AUTH_DOWNSTREAM_TOKEN_VALIDATED: "mcp_gateway_auth_downstream_token_validated";
2986
+ readonly MCP_GATEWAY_AUTH_DOWNSTREAM_TOKEN_REJECTED: "mcp_gateway_auth_downstream_token_rejected";
2987
+ readonly MCP_GATEWAY_OAUTH_CLIENT_REGISTERED: "mcp_gateway_oauth_client_registered";
2988
+ readonly MCP_GATEWAY_OAUTH_AUTHORIZE_STARTED: "mcp_gateway_oauth_authorize_started";
2989
+ readonly MCP_GATEWAY_OAUTH_AUTHORIZE_AWAITING_SETUP: "mcp_gateway_oauth_authorize_awaiting_setup";
2990
+ readonly MCP_GATEWAY_OAUTH_TOKEN_ISSUED: "mcp_gateway_oauth_token_issued";
2991
+ readonly MCP_GATEWAY_OAUTH_TOKEN_REFRESH_ROTATED: "mcp_gateway_oauth_token_refresh_rotated";
2992
+ readonly MCP_GATEWAY_OAUTH_TOKEN_REVOKED: "mcp_gateway_oauth_token_revoked";
2993
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_CONNECT_REQUIRED: "mcp_gateway_auth_upstream_connect_required";
2994
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_CONNECT_STARTED: "mcp_gateway_auth_upstream_connect_started";
2995
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_CALLBACK_RECEIVED: "mcp_gateway_auth_upstream_callback_received";
2996
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED: "mcp_gateway_auth_upstream_token_exchange_succeeded";
2997
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED: "mcp_gateway_auth_upstream_token_exchange_failed";
2998
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_RESOLVED: "mcp_gateway_auth_upstream_credential_resolved";
2999
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_CREDENTIAL_MISSING: "mcp_gateway_auth_upstream_credential_missing";
3000
+ readonly MCP_GATEWAY_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_gateway_auth_upstream_reconsent_required";
3001
+ readonly MCP_GATEWAY_POLICY_DECISION: "mcp_gateway_policy_decision";
3002
+ readonly MCP_GATEWAY_GUARDRAIL_DECISION: "mcp_gateway_guardrail_decision";
3003
+ readonly MCP_GATEWAY_RATE_LIMIT_DECISION: "mcp_gateway_rate_limit_decision";
3004
+ readonly MCP_GATEWAY_UPSTREAM_REQUEST_SENT: "mcp_gateway_upstream_request_sent";
3005
+ readonly MCP_GATEWAY_UPSTREAM_REQUEST_COMPLETED: "mcp_gateway_upstream_request_completed";
3006
+ readonly MCP_GATEWAY_UPSTREAM_REQUEST_FAILED: "mcp_gateway_upstream_request_failed";
3007
+ readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_CREATED: "mcp_gateway_audit_virtual_server_created";
3008
+ readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_UPDATED: "mcp_gateway_audit_virtual_server_updated";
3009
+ readonly MCP_GATEWAY_AUDIT_VIRTUAL_SERVER_DELETED: "mcp_gateway_audit_virtual_server_deleted";
2813
3010
  };
2814
3011
 
2815
3012
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -7335,6 +7532,28 @@ export declare interface ParameterDefinition extends ParameterBaseObject {
7335
7532
  in: string;
7336
7533
  }
7337
7534
 
7535
+ /**
7536
+ * This is the parsed values of the Cors configuration. All
7537
+ * values in the parsed configuration are in the format that the headers
7538
+ * use them (i.e. everything is converted to a string)
7539
+ */
7540
+ declare interface ParsedCorsPolicyConfiguration {
7541
+ name: string;
7542
+ allowCredentials: string | undefined;
7543
+ maxAge: string | undefined;
7544
+ allowedOrigins: string[];
7545
+ allowedMethods?: string;
7546
+ allowedHeaders?: string;
7547
+ exposeHeaders?: string;
7548
+ }
7549
+
7550
+ /**
7551
+ * @public
7552
+ */
7553
+ declare interface ParsedRouteData extends Omit<RouteData, "corsPolicies"> {
7554
+ corsPolicies: ParsedCorsPolicyConfiguration[];
7555
+ }
7556
+
7338
7557
  /**
7339
7558
  * The base class for inbound and outbound policies.
7340
7559
  * Provides common functionality for all policy types.