@zuplo/runtime 7.1.8 → 7.1.10

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-RAZK5G27.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};
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
@@ -285,7 +285,7 @@ export declare class AIGatewayConfigurationExecutorV2InboundPolicy extends Inbou
285
285
  */
286
286
  export declare interface AIGatewayConfigurationExecutorV2InboundPolicyOptions {
287
287
  /**
288
- * The time to cache app configurations loaded by app_id. Higher values decrease latency. Cached results remain valid until the cache expires even if the configuration changes in the portal. When ai-gateway-auth-v2-inbound already loaded the configuration for the request, this cache is not used.
288
+ * The time in seconds to cache app configurations loaded by app_id. Defaults to 10 seconds when omitted. Higher values decrease latency; lower values pick up portal changes sooner. Cached results remain valid until the cache expires even if the configuration changes in the portal. This cache is only used when neither ai-gateway-auth-v2-inbound nor ai-gateway-configuration-loader-v2-inbound already loaded the configuration for the request.
289
289
  */
290
290
  cacheTtlSeconds?: number;
291
291
  }
@@ -327,7 +327,7 @@ export declare class AIGatewayConfigurationLoaderV2InboundPolicy extends Inbound
327
327
  */
328
328
  export declare interface AIGatewayConfigurationLoaderV2InboundPolicyOptions {
329
329
  /**
330
- * The time to cache app configurations loaded by app_id. Higher values decrease latency. Cached results remain valid until the cache expires even if the configuration changes in the portal. When ai-gateway-auth-v2-inbound already loaded the configuration for the request, this cache is not used.
330
+ * The time in seconds to cache app configurations loaded by app_id. Defaults to 10 seconds when omitted. Higher values decrease latency; lower values pick up portal changes sooner. Cached results remain valid until the cache expires even if the configuration changes in the portal. When ai-gateway-auth-v2-inbound already loaded the configuration for the request, this cache is not used.
331
331
  */
332
332
  cacheTtlSeconds?: number;
333
333
  }
@@ -960,10 +960,14 @@ export declare interface AIGatewaySemanticCacheOutboundPolicyOptions {}
960
960
  * response-sending hook to write the upstream response back into the cache —
961
961
  * matching the firewall's single-policy shape (no separate outbound policy).
962
962
  *
963
- * Caching parameters (semanticTolerance, expirationSecondsTtl, namespace) come
964
- * from the policy options, and presence in the route's chain is what enables
965
- * it. An id from the authenticated app configuration always provides the cache
966
- * namespace so application-supplied options cannot cross tenant partitions.
963
+ * Caching parameters (semanticTolerance, expirationSecondsTtl, namespace,
964
+ * recentMessageCount) come from the policy options, and presence in the
965
+ * route's chain is what enables it. An id from the authenticated app
966
+ * configuration always provides the cache namespace so application-supplied
967
+ * options cannot cross tenant partitions. The cache key covers the system
968
+ * prompt plus the last `recentMessageCount` messages (default 1) — applied
969
+ * when storing and when matching — so multi-turn conversations can hit
970
+ * entries cached from earlier, shorter ones.
967
971
  *
968
972
  * Cache outcomes are reported on the response via the RFC 9211 `Cache-Status`
969
973
  * header under the cache name `zp-aigw-sem-cache` (hit:
@@ -997,6 +1001,7 @@ export declare interface AIGatewaySemanticCacheV2InboundPolicyOptions {
997
1001
  semanticTolerance?: SemanticTolerance;
998
1002
  expirationSecondsTtl?: CacheTTLSeconds;
999
1003
  namespace?: CacheNamespace;
1004
+ recentMessageCount?: RecentMessageCount;
1000
1005
  maxConversationLength?: MaxConversationLength;
1001
1006
  endpoints?: ApplicableEndpoints;
1002
1007
  onUnknownShape?: OnUnknownShape;
@@ -1837,7 +1842,7 @@ declare interface APITokenCredentialConfig {
1837
1842
  }
1838
1843
 
1839
1844
  /**
1840
- * The endpoint shapes to cache. Defaults to ['openai-chat', 'anthropic-messages']; OpenAI Responses remains unsupported.
1845
+ * The endpoint shapes to cache. Defaults to all shapes: ['openai-chat', 'anthropic-messages', 'openai-responses'].
1841
1846
  * @public
1842
1847
  */
1843
1848
  declare type ApplicableEndpoints = (
@@ -4917,6 +4922,7 @@ declare const EventType: {
4917
4922
  readonly MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED: "mcp_auth_upstream_reconsent_required";
4918
4923
  readonly GRAPHQL_OPERATION: "graphql_operation";
4919
4924
  readonly CACHE_OPERATION: "cache_operation";
4925
+ readonly HANDLER_EXECUTION: "handler_execution";
4920
4926
  };
4921
4927
 
4922
4928
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -8046,7 +8052,7 @@ declare type LokiTransportVersion = 1 | 2;
8046
8052
  /* Excluded from this release type: LookupResult */
8047
8053
 
8048
8054
  /**
8049
- * Skip caching requests whose message count exceeds this value. Longer conversations rarely repeat and dilute cache quality. Defaults to 3.
8055
+ * 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
8056
  * @public
8051
8057
  */
8052
8058
  declare type MaxConversationLength = number;
@@ -12339,6 +12345,12 @@ export declare function ReadmeMetricsInboundPolicy(
12339
12345
  policyName: string
12340
12346
  ): Promise<ZuploRequest<RequestGeneric>>;
12341
12347
 
12348
+ /**
12349
+ * 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).
12350
+ * @public
12351
+ */
12352
+ declare type RecentMessageCount = number;
12353
+
12342
12354
  /**
12343
12355
  * Record the GraphQL response-cache outcome for the in-flight operation so
12344
12356
  * 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];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.1.8",
4
+ "version": "7.1.10",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1,26 +0,0 @@
1
-
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Zuplo, Inc. All rights reserved.
4
- *
5
- * This software and associated documentation files (the "Software") is intended to be used
6
- * only by Zuplo customers solely to develop and test applications that will be deployed
7
- * to Zuplo hosted services. You and others in your organization may use these files on your
8
- * Development Devices solely for the above stated purpose.
9
- *
10
- * Outside of uses stated above, no license is granted for any other purpose including
11
- * without limitation the rights to use, copy, modify, merge, publish, distribute,
12
- * sublicense, host, and/or sell copies of the Software.
13
- *
14
- * The software may include third party components with separate legal notices or governed by
15
- * other agreements, as described in licenses either embedded in or accompanying the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18
- * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
- * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
20
- * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
- * DEALINGS IN THE SOFTWARE.
23
- *--------------------------------------------------------------------------------------------*/
24
-
25
- import{Z as o}from"./chunk-4POCC75H.js";import{a}from"./chunk-TYV53J3B.js";var t={AI_GATEWAY_COST_SUM:"ai_gateway_cost_sum",AI_GATEWAY_REQUEST_COUNT:"ai_gateway_request_count",AI_GATEWAY_TOKEN_SUM:"ai_gateway_token_sum",AI_GATEWAY_LATENCY_HISTOGRAM:"ai_gateway_latency_histogram",AI_GATEWAY_WARNING_COUNT:"ai_gateway_warning_count",AI_GATEWAY_BLOCKED_COUNT:"ai_gateway_blocked_count",AI_GATEWAY_FALLBACK_COUNT:"ai_gateway_fallback_count",MCP_REQUEST_RECEIVED:"mcp_request_received",MCP_REQUEST_COMPLETED:"mcp_request_completed",MCP_REQUEST_REJECTED:"mcp_request_rejected",MCP_INITIALIZE_NEGOTIATED:"mcp_initialize_negotiated",MCP_CLIENT_UNSUPPORTED_BEHAVIOR:"mcp_client_unsupported_behavior",MCP_CAPABILITY_LISTED:"mcp_capability_listed",MCP_CAPABILITY_INVOKED:"mcp_capability_invoked",MCP_CAPABILITY_COMPLETED:"mcp_capability_completed",MCP_CAPABILITY_FAILED:"mcp_capability_failed",MCP_CAPABILITY_CONNECT_REQUIRED:"mcp_capability_connect_required",MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED:"mcp_auth_downstream_token_validated",MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED:"mcp_auth_downstream_token_rejected",MCP_OAUTH_CLIENT_REGISTERED:"mcp_oauth_client_registered",MCP_OAUTH_AUTHORIZE_STARTED:"mcp_oauth_authorize_started",MCP_OAUTH_AUTHORIZE_AWAITING_SETUP:"mcp_oauth_authorize_awaiting_setup",MCP_OAUTH_TOKEN_ISSUED:"mcp_oauth_token_issued",MCP_OAUTH_TOKEN_REFRESH_ROTATED:"mcp_oauth_token_refresh_rotated",MCP_OAUTH_TOKEN_REVOKED:"mcp_oauth_token_revoked",MCP_AUTH_UPSTREAM_CONNECT_REQUIRED:"mcp_auth_upstream_connect_required",MCP_AUTH_UPSTREAM_CONNECT_STARTED:"mcp_auth_upstream_connect_started",MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED:"mcp_auth_upstream_callback_received",MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED:"mcp_auth_upstream_token_exchange_succeeded",MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED:"mcp_auth_upstream_token_exchange_failed",MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED:"mcp_auth_upstream_credential_resolved",MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING:"mcp_auth_upstream_credential_missing",MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED:"mcp_auth_upstream_reconsent_required",GRAPHQL_OPERATION:"graphql_operation",CACHE_OPERATION:"cache_operation"};var i=class{static{a(this,"BaseAnalyticsEvent")}eventId;requestId;timestamp;accountName;projectName;deploymentName;unit;value;constructor(e){this.eventId=e.eventId,this.requestId=e.requestId,this.timestamp=e.timestamp??new Date,this.accountName=e.accountName,this.projectName=e.projectName,this.deploymentName=e.deploymentName,this.unit=e.unit,this.value=e.value}};var s=class extends i{static{a(this,"AiGatewayBlockedCountEvent")}eventType=t.AI_GATEWAY_BLOCKED_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var p=class extends i{static{a(this,"AiGatewayCostSumEvent")}eventType=t.AI_GATEWAY_COST_SUM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var l=class extends i{static{a(this,"AiGatewayFallbackCountEvent")}eventType=t.AI_GATEWAY_FALLBACK_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var _=class extends i{static{a(this,"AiGatewayLatencyHistogramEvent")}eventType=t.AI_GATEWAY_LATENCY_HISTOGRAM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var T=class extends i{static{a(this,"AiGatewayRequestCountEvent")}eventType=t.AI_GATEWAY_REQUEST_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var u=class extends i{static{a(this,"AiGatewayTokenSumEvent")}eventType=t.AI_GATEWAY_TOKEN_SUM;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.model||!this.metadata.model.trim())&&(this.metadata.model="unknown"),(!this.metadata.provider||!this.metadata.provider.trim())&&(this.metadata.provider="unknown"),(!this.metadata.label||!this.metadata.label.trim())&&(this.metadata.label="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var m=class extends i{static{a(this,"AiGatewayWarningCountEvent")}eventType=t.AI_GATEWAY_WARNING_COUNT;metadata;constructor(e){super(e),this.metadata=e.metadata,(!this.metadata.type||!this.metadata.type.trim())&&(this.metadata.type="unknown"),(!this.metadata.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var A=class extends i{static{a(this,"CacheOperationEvent")}eventType=t.CACHE_OPERATION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var c=class extends i{static{a(this,"GraphqlOperationEvent")}eventType=t.GRAPHQL_OPERATION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var d=class extends i{static{a(this,"McpEvent")}eventType;metadata;constructor(e){super(e),this.eventType=e.eventType,this.metadata=e.metadata}};var r=a(n=>e=>new d({...e,eventType:n}),"buildMcpEvent"),g={[t.AI_GATEWAY_COST_SUM]:n=>new p(n),[t.AI_GATEWAY_REQUEST_COUNT]:n=>new T(n),[t.AI_GATEWAY_TOKEN_SUM]:n=>new u(n),[t.AI_GATEWAY_LATENCY_HISTOGRAM]:n=>new _(n),[t.AI_GATEWAY_WARNING_COUNT]:n=>new m(n),[t.AI_GATEWAY_BLOCKED_COUNT]:n=>new s(n),[t.AI_GATEWAY_FALLBACK_COUNT]:n=>new l(n),[t.MCP_REQUEST_RECEIVED]:r(t.MCP_REQUEST_RECEIVED),[t.MCP_REQUEST_COMPLETED]:r(t.MCP_REQUEST_COMPLETED),[t.MCP_REQUEST_REJECTED]:r(t.MCP_REQUEST_REJECTED),[t.MCP_INITIALIZE_NEGOTIATED]:r(t.MCP_INITIALIZE_NEGOTIATED),[t.MCP_CLIENT_UNSUPPORTED_BEHAVIOR]:r(t.MCP_CLIENT_UNSUPPORTED_BEHAVIOR),[t.MCP_CAPABILITY_LISTED]:r(t.MCP_CAPABILITY_LISTED),[t.MCP_CAPABILITY_INVOKED]:r(t.MCP_CAPABILITY_INVOKED),[t.MCP_CAPABILITY_COMPLETED]:r(t.MCP_CAPABILITY_COMPLETED),[t.MCP_CAPABILITY_FAILED]:r(t.MCP_CAPABILITY_FAILED),[t.MCP_CAPABILITY_CONNECT_REQUIRED]:r(t.MCP_CAPABILITY_CONNECT_REQUIRED),[t.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED]:r(t.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED),[t.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED]:r(t.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED),[t.MCP_OAUTH_CLIENT_REGISTERED]:r(t.MCP_OAUTH_CLIENT_REGISTERED),[t.MCP_OAUTH_AUTHORIZE_STARTED]:r(t.MCP_OAUTH_AUTHORIZE_STARTED),[t.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP]:r(t.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP),[t.MCP_OAUTH_TOKEN_ISSUED]:r(t.MCP_OAUTH_TOKEN_ISSUED),[t.MCP_OAUTH_TOKEN_REFRESH_ROTATED]:r(t.MCP_OAUTH_TOKEN_REFRESH_ROTATED),[t.MCP_OAUTH_TOKEN_REVOKED]:r(t.MCP_OAUTH_TOKEN_REVOKED),[t.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED]:r(t.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED),[t.MCP_AUTH_UPSTREAM_CONNECT_STARTED]:r(t.MCP_AUTH_UPSTREAM_CONNECT_STARTED),[t.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED]:r(t.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED),[t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED]:r(t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED),[t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED]:r(t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED),[t.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED]:r(t.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED),[t.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING]:r(t.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING),[t.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED]:r(t.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED),[t.GRAPHQL_OPERATION]:n=>new c(n),[t.CACHE_OPERATION]:n=>new A(n)};function I(n,e){let E=g[n];return E(e)}a(I,"createAnalyticsEvent");var O=class{static{a(this,"ZuploGatewayAnalyticsContext")}#t;#e;constructor(e){this.#t=[],this.#e=e}addAnalyticsEvent(e,E,y,C,M){let v=this.createAnalyticsEvent(e,E,y,C,M);this.#t.push(v)}flushAnalyticsEvents(){let e=[...this.#t];return this.#t.length=0,e}getAnalyticsEvents(){return[...this.#t]}createAnalyticsEvent(e,E,y,C,M){return I(E,{eventId:M??crypto.randomUUID(),requestId:this.#e,accountName:o.instance.accountName??"unknown",projectName:o.instance.projectName??"unknown",deploymentName:o.instance.deploymentName??"unknown",metadata:y,unit:C,value:e})}};export{t as a,O as b};
26
- //# sourceMappingURL=chunk-RAZK5G27.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@zuplo/runtime/metrics/v2/interfaces.ts","@zuplo/runtime/metrics/v2/events/base-analytics-event.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-blocked-count.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-cost-sum.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-fallback-count.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-latency-histogram.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-request-count.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-token-sum.ts","@zuplo/runtime/metrics/v2/events/ai-gateway-warning-count.ts","@zuplo/runtime/metrics/v2/events/cache-operation.ts","@zuplo/runtime/metrics/v2/events/graphql-operation-event.ts","@zuplo/runtime/metrics/v2/events/mcp-event.ts","@zuplo/runtime/metrics/v2/create-events.ts","@zuplo/runtime/metrics/v2/analytics-context.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;2EAuDO,IAAMA,EAAY,CACvB,oBAAqB,sBACrB,yBAA0B,2BAC1B,qBAAsB,uBACtB,6BAA8B,+BAC9B,yBAA0B,2BAC1B,yBAA0B,2BAC1B,0BAA2B,4BAM3B,qBAAsB,uBACtB,sBAAuB,wBACvB,qBAAsB,uBACtB,0BAA2B,4BAC3B,gCAAiC,kCACjC,sBAAuB,wBACvB,uBAAwB,yBACxB,yBAA0B,2BAC1B,sBAAuB,wBACvB,gCAAiC,kCACjC,oCAAqC,sCACrC,mCAAoC,qCACpC,4BAA6B,8BAC7B,4BAA6B,8BAC7B,mCAAoC,qCACpC,uBAAwB,yBACxB,gCAAiC,kCACjC,wBAAyB,0BACzB,mCAAoC,qCACpC,kCAAmC,oCACnC,oCAAqC,sCACrC,2CACE,6CACF,wCACE,0CACF,sCACE,wCACF,qCAAsC,uCACtC,qCAAsC,uCAKtC,kBAAmB,oBAKnB,gBAAiB,iBACnB,EChGO,IAAeC,EAAf,KAEP,CAbA,MAaA,CAAAC,EAAA,2BAEE,QACA,UAIA,UAGA,YACA,YACA,eASA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GhEC,GACAC,GAET,YAAYC,EAAmB,CAC7B,KAAKF,GAAU,CAAC,EAChB,KAAKC,GAAaC,CACpB,CAGA,kBACEC,EACAC,EACAC,EACAC,EACAC,EACM,CACN,IAAMC,EAAQ,KAAK,qBACjBL,EACAC,EACAC,EACAC,EACAC,CACF,EACA,KAAKP,GAAQ,KAAKQ,CAAK,CACzB,CAEA,sBAA8C,CAC5C,IAAMC,EAAS,CAAC,GAAG,KAAKT,EAAO,EAC/B,YAAKA,GAAQ,OAAS,EACfS,CACT,CAEA,oBAA4C,CAC1C,MAAO,CAAC,GAAG,KAAKT,EAAO,CACzB,CAEQ,qBACNG,EACAC,EACAC,EACAC,EACAC,EAC0B,CAC1B,OAAOG,EAAqBN,EAAW,CACrC,QAASG,GAAW,OAAO,WAAW,EACtC,UAAW,KAAKN,GAChB,YAAaU,EAAY,SAAS,aAAe,UACjD,YAAaA,EAAY,SAAS,aAAe,UACjD,eAAgBA,EAAY,SAAS,gBAAkB,UACvD,SAAAN,EACA,KAAAC,EACA,MAAAH,CACF,CAAC,CACH,CACF","names":["EventType","BaseAnalyticsEvent","__name","options","AiGatewayBlockedCountEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayCostSumEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayFallbackCountEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayLatencyHistogramEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayRequestCountEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayTokenSumEvent","BaseAnalyticsEvent","__name","EventType","options","AiGatewayWarningCountEvent","BaseAnalyticsEvent","__name","EventType","options","CacheOperationEvent","BaseAnalyticsEvent","__name","EventType","options","GraphqlOperationEvent","BaseAnalyticsEvent","__name","EventType","options","McpEvent","BaseAnalyticsEvent","__name","options","buildMcpEvent","__name","eventType","options","McpEvent","eventBuilders","EventType","AiGatewayCostSumEvent","AiGatewayRequestCountEvent","AiGatewayTokenSumEvent","AiGatewayLatencyHistogramEvent","AiGatewayWarningCountEvent","AiGatewayBlockedCountEvent","AiGatewayFallbackCountEvent","GraphqlOperationEvent","CacheOperationEvent","createAnalyticsEvent","builder","ZuploGatewayAnalyticsContext","__name","#events","#requestId","requestId","value","eventType","metadata","unit","eventId","event","events","createAnalyticsEvent","Environment"]}