@zuplo/runtime 7.8.12 → 7.8.13
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/out/esm/{chunk-7FZV6CLW.js → chunk-5F6HRIER.js} +99 -99
- package/out/esm/chunk-5F6HRIER.js.map +1 -0
- package/out/esm/index.js +1 -1
- package/out/esm/mcp-gateway/index.js +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +18 -0
- package/package.json +1 -1
- package/out/esm/chunk-7FZV6CLW.js.map +0 -1
- /package/out/esm/{chunk-7FZV6CLW.js.LEGAL.txt → chunk-5F6HRIER.js.LEGAL.txt} +0 -0
package/out/esm/mocks/index.js
CHANGED
|
@@ -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-5F6HRIER.js";import"../chunk-54HRCPVQ.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-6O4OZCO6.js";import{aa as i}from"../chunk-MWIJG5KC.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
|
package/out/types/index.d.ts
CHANGED
|
@@ -15732,6 +15732,24 @@ declare interface Usage {
|
|
|
15732
15732
|
accepted_prediction_tokens?: number;
|
|
15733
15733
|
rejected_prediction_tokens?: number;
|
|
15734
15734
|
};
|
|
15735
|
+
/**
|
|
15736
|
+
* A cost in USD the upstream reported for this request, exactly as it
|
|
15737
|
+
* reported it.
|
|
15738
|
+
*
|
|
15739
|
+
* Not an OpenAI field. It is present because aggregators that price requests
|
|
15740
|
+
* themselves — OpenRouter is the case it exists for — report it here, and
|
|
15741
|
+
* metering reads it as the authoritative cost. First-party providers never
|
|
15742
|
+
* set it.
|
|
15743
|
+
*
|
|
15744
|
+
* Declared on this type so a TRANSLATED response can carry it: the Anthropic
|
|
15745
|
+
* path rebuilds `usage` from token counts, which silently dropped a reported
|
|
15746
|
+
* cost and billed the request from the rate card instead.
|
|
15747
|
+
*
|
|
15748
|
+
* `unknown` because it is untrusted upstream input that translation carries
|
|
15749
|
+
* without validating. Metering validates it with `readProviderReportedCost`,
|
|
15750
|
+
* which logs a malformed value as rejected and bills from the rate card.
|
|
15751
|
+
*/
|
|
15752
|
+
cost?: unknown;
|
|
15735
15753
|
}
|
|
15736
15754
|
|
|
15737
15755
|
declare type UserDataDefault = any;
|