@zuplo/runtime 6.59.17 → 6.59.18

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,4 +22,4 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{b as p}from"../chunk-I2ALG3UB.js";import{Z as n,a as t}from"../chunk-B77APQ6Y.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},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 p(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 l=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,l,r)}};export{s as MockZuploContext,g as createMockContext};
25
+ import{b as p}from"../chunk-SIQXBBWG.js";import{Z as n,a as t}from"../chunk-B77APQ6Y.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},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 p(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 l=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,l,r)}};export{s as MockZuploContext,g as createMockContext};
@@ -2424,6 +2424,10 @@ export declare interface ErrorHandler {
2424
2424
 
2425
2425
  declare const EventType: {
2426
2426
  readonly MCP_TOOL_USAGE: "mcp_tool_usage";
2427
+ readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
2428
+ readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
2429
+ readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
2430
+ readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
2427
2431
  };
2428
2432
 
2429
2433
  declare type EventType = (typeof EventType)[keyof typeof EventType];
@@ -67,6 +67,10 @@ export declare function createMockContext(options?: {
67
67
 
68
68
  declare const EventType: {
69
69
  readonly MCP_TOOL_USAGE: "mcp_tool_usage";
70
+ readonly AI_GATEWAY_COST_SUM: "ai_gateway_cost_sum";
71
+ readonly AI_GATEWAY_REQUEST_COUNT: "ai_gateway_request_count";
72
+ readonly AI_GATEWAY_TOKEN_SUM: "ai_gateway_token_sum";
73
+ readonly AI_GATEWAY_LATENCY_HISTOGRAM: "ai_gateway_latency_histogram";
70
74
  };
71
75
 
72
76
  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": "6.59.17",
4
+ "version": "6.59.18",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -1,25 +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{a as e,k as o}from"./chunk-B77APQ6Y.js";var s={MCP_TOOL_USAGE:"mcp_tool_usage"};var r=class{static{e(this,"BaseAnalyticsEvent")}eventId;requestId;timestamp;accountName;projectName;deploymentName;unit;value;constructor(t){this.eventId=t.eventId,this.requestId=t.requestId,this.timestamp=t.timestamp??new Date,this.accountName=t.accountName,this.projectName=t.projectName,this.deploymentName=t.deploymentName,this.unit=t.unit,this.value=t.value}};var p=class extends r{static{e(this,"McpToolUsageEvent")}eventType=s.MCP_TOOL_USAGE;metadata;constructor(t){t.metadata.toolName.trim()||(t.metadata.toolName="unknown"),t.metadata.toolPath.trim()||(t.metadata.toolPath="unknown"),t.metadata.toolMethod.trim()||(t.metadata.toolMethod="unknown"),t.metadata.toolOperationId.trim()||(t.metadata.toolOperationId="unknown"),super(t),this.metadata=t.metadata}};var l={[s.MCP_TOOL_USAGE]:p};function c(a,t){let n=l[a];return new n(t)}e(c,"createAnalyticsEvent");var v=class{static{e(this,"ZuploGatewayAnalyticsContext")}#t;#e;constructor(t){this.#t=[],this.#e=t}addAnalyticsEvent(t,n,i,m){let d=this.createAnalyticsEvent(t,n,i,m);this.#t.push(d)}getAnalyticsEvents(){return this.#t}createAnalyticsEvent(t,n,i,m){return c(n,{eventId:crypto.randomUUID(),requestId:this.#e,accountName:o.instance.build.ACCOUNT_NAME??"unknown",projectName:o.instance.build.PROJECT_NAME??"unknown",deploymentName:o.instance.deploymentName??"unknown",metadata:i,unit:m,value:t})}};export{s as a,v as b};