
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Zuplo, Inc. All rights reserved.
 *
 *  This software and associated documentation files (the "Software") is intended to be used
 *  only by Zuplo customers solely to develop and test applications that will be deployed
 *  to Zuplo hosted services. You and others in your organization may use these files on your
 *  Development Devices solely for the above stated purpose.
 *
 *  Outside of uses stated above, no license is granted for any other purpose including
 *  without limitation the rights to use, copy, modify, merge, publish, distribute,
 *  sublicense, host, and/or sell copies of the Software.
 *
 *  The software may include third party components with separate legal notices or governed by
 *  other agreements, as described in licenses either embedded in or accompanying the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 *  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 *  PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
 *  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
 *  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 *  DEALINGS IN THE SOFTWARE.
 *--------------------------------------------------------------------------------------------*/
    
import{a as r,ca as o}from"./chunk-DSZS6PZJ.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"};var i=class{static{r(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{r(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 _=class extends i{static{r(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.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var p=class extends i{static{r(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 T=class extends i{static{r(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.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var l=class extends i{static{r(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.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var u=class extends i{static{r(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.configId||!this.metadata.configId.trim())&&(this.metadata.configId="unknown")}};var A=class extends i{static{r(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 m=class extends i{static{r(this,"GraphqlOperationEvent")}eventType=t.GRAPHQL_OPERATION;metadata;constructor(e){super(e),this.metadata=e.metadata}};var c=class extends i{static{r(this,"McpEvent")}eventType;metadata;constructor(e){super(e),this.eventType=e.eventType,this.metadata=e.metadata}};var a=r(n=>e=>new c({...e,eventType:n}),"buildMcpEvent"),O={[t.AI_GATEWAY_COST_SUM]:n=>new _(n),[t.AI_GATEWAY_REQUEST_COUNT]:n=>new l(n),[t.AI_GATEWAY_TOKEN_SUM]:n=>new u(n),[t.AI_GATEWAY_LATENCY_HISTOGRAM]:n=>new T(n),[t.AI_GATEWAY_WARNING_COUNT]:n=>new A(n),[t.AI_GATEWAY_BLOCKED_COUNT]:n=>new s(n),[t.AI_GATEWAY_FALLBACK_COUNT]:n=>new p(n),[t.MCP_REQUEST_RECEIVED]:a(t.MCP_REQUEST_RECEIVED),[t.MCP_REQUEST_COMPLETED]:a(t.MCP_REQUEST_COMPLETED),[t.MCP_REQUEST_REJECTED]:a(t.MCP_REQUEST_REJECTED),[t.MCP_INITIALIZE_NEGOTIATED]:a(t.MCP_INITIALIZE_NEGOTIATED),[t.MCP_CLIENT_UNSUPPORTED_BEHAVIOR]:a(t.MCP_CLIENT_UNSUPPORTED_BEHAVIOR),[t.MCP_CAPABILITY_LISTED]:a(t.MCP_CAPABILITY_LISTED),[t.MCP_CAPABILITY_INVOKED]:a(t.MCP_CAPABILITY_INVOKED),[t.MCP_CAPABILITY_COMPLETED]:a(t.MCP_CAPABILITY_COMPLETED),[t.MCP_CAPABILITY_FAILED]:a(t.MCP_CAPABILITY_FAILED),[t.MCP_CAPABILITY_CONNECT_REQUIRED]:a(t.MCP_CAPABILITY_CONNECT_REQUIRED),[t.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED]:a(t.MCP_AUTH_DOWNSTREAM_TOKEN_VALIDATED),[t.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED]:a(t.MCP_AUTH_DOWNSTREAM_TOKEN_REJECTED),[t.MCP_OAUTH_CLIENT_REGISTERED]:a(t.MCP_OAUTH_CLIENT_REGISTERED),[t.MCP_OAUTH_AUTHORIZE_STARTED]:a(t.MCP_OAUTH_AUTHORIZE_STARTED),[t.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP]:a(t.MCP_OAUTH_AUTHORIZE_AWAITING_SETUP),[t.MCP_OAUTH_TOKEN_ISSUED]:a(t.MCP_OAUTH_TOKEN_ISSUED),[t.MCP_OAUTH_TOKEN_REFRESH_ROTATED]:a(t.MCP_OAUTH_TOKEN_REFRESH_ROTATED),[t.MCP_OAUTH_TOKEN_REVOKED]:a(t.MCP_OAUTH_TOKEN_REVOKED),[t.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED]:a(t.MCP_AUTH_UPSTREAM_CONNECT_REQUIRED),[t.MCP_AUTH_UPSTREAM_CONNECT_STARTED]:a(t.MCP_AUTH_UPSTREAM_CONNECT_STARTED),[t.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED]:a(t.MCP_AUTH_UPSTREAM_CALLBACK_RECEIVED),[t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED]:a(t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_SUCCEEDED),[t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED]:a(t.MCP_AUTH_UPSTREAM_TOKEN_EXCHANGE_FAILED),[t.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED]:a(t.MCP_AUTH_UPSTREAM_CREDENTIAL_RESOLVED),[t.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING]:a(t.MCP_AUTH_UPSTREAM_CREDENTIAL_MISSING),[t.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED]:a(t.MCP_AUTH_UPSTREAM_RECONSENT_REQUIRED),[t.GRAPHQL_OPERATION]:n=>new m(n)};function M(n,e){let E=O[n];return E(e)}r(M,"createAnalyticsEvent");var I=class{static{r(this,"ZuploGatewayAnalyticsContext")}#t;#e;constructor(e){this.#t=[],this.#e=e}addAnalyticsEvent(e,E,d,y,C){let v=this.createAnalyticsEvent(e,E,d,y,C);this.#t.push(v)}flushAnalyticsEvents(){let e=[...this.#t];return this.#t.length=0,e}getAnalyticsEvents(){return[...this.#t]}createAnalyticsEvent(e,E,d,y,C){return M(E,{eventId:C??crypto.randomUUID(),requestId:this.#e,accountName:o.instance.accountName??"unknown",projectName:o.instance.projectName??"unknown",deploymentName:o.instance.deploymentName??"unknown",metadata:d,unit:y,value:e})}};export{t as a,I as b};
//# sourceMappingURL=chunk-4QJJMELB.js.map
