@zuplo/runtime 6.59.52 → 6.59.53
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-WY54JGUU.js → chunk-OQNJD3CU.js} +2 -2
- package/out/esm/{chunk-WY54JGUU.js.map → chunk-OQNJD3CU.js.map} +1 -1
- package/out/esm/index.js +66 -54
- package/out/esm/index.js.map +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/types/index.d.ts +31 -3
- package/out/types/mocks/index.d.ts +1 -0
- package/package.json +1 -1
package/out/esm/mocks/index.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{b as p}from"../chunk-
|
|
25
|
+
import{b as p}from"../chunk-OQNJD3CU.js";import{Z as n,a as t}from"../chunk-FZGIFEAX.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};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
package/out/types/index.d.ts
CHANGED
|
@@ -158,6 +158,7 @@ export declare class AIGatewayMeteringInboundPolicy extends InboundPolicy<AIGate
|
|
|
158
158
|
context: ZuploContext
|
|
159
159
|
): Promise<Response | ZuploRequest<RequestGeneric_2>>;
|
|
160
160
|
private fetchCurrentMeters;
|
|
161
|
+
private checkHierarchicalQuotaLimits;
|
|
161
162
|
/**
|
|
162
163
|
* Increment meters via API. Can be used by providers for streaming responses.
|
|
163
164
|
*
|
|
@@ -173,10 +174,8 @@ export declare class AIGatewayMeteringInboundPolicy extends InboundPolicy<AIGate
|
|
|
173
174
|
): Promise<void>;
|
|
174
175
|
private static incrementMetersInternal;
|
|
175
176
|
private checkWarnings;
|
|
176
|
-
private checkQuotas;
|
|
177
177
|
private checkQuotaWarning;
|
|
178
|
-
private
|
|
179
|
-
private createQuotaExceededResponse;
|
|
178
|
+
private createHierarchicalQuotaExceededResponse;
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
/**
|
|
@@ -220,6 +219,34 @@ export declare function AIGatewaySemanticCacheInboundPolicy(
|
|
|
220
219
|
*/
|
|
221
220
|
export declare interface AIGatewaySemanticCacheInboundPolicyOptions {}
|
|
222
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Outbound policy to handle response caching for AI Gateway.
|
|
224
|
+
* This policy intercepts responses and handles caching for both
|
|
225
|
+
* streaming and non-streaming responses.
|
|
226
|
+
*
|
|
227
|
+
* @title AI Gateway Semantic Cache Outbound
|
|
228
|
+
* @hidden
|
|
229
|
+
* @param response - The response from the upstream service
|
|
230
|
+
* @param request - The original request
|
|
231
|
+
* @param context - The ZuploContext
|
|
232
|
+
* @param options - The policy options
|
|
233
|
+
* @param policyName - The name of the policy
|
|
234
|
+
* @returns The response (potentially modified for caching)
|
|
235
|
+
*/
|
|
236
|
+
export declare function AIGatewaySemanticCacheOutboundPolicy(
|
|
237
|
+
response: Response,
|
|
238
|
+
request: ZuploRequest,
|
|
239
|
+
context: ZuploContext,
|
|
240
|
+
options: AIGatewaySemanticCacheOutboundPolicyOptions,
|
|
241
|
+
policyName: string
|
|
242
|
+
): Promise<Response>;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Options for the AI Gateway Semantic Cache Outbound policy.
|
|
246
|
+
* @public
|
|
247
|
+
*/
|
|
248
|
+
export declare interface AIGatewaySemanticCacheOutboundPolicyOptions {}
|
|
249
|
+
|
|
223
250
|
/**
|
|
224
251
|
* The options for this policy.
|
|
225
252
|
* @public
|
|
@@ -9270,6 +9297,7 @@ declare interface ZuploAnalyticsContext {
|
|
|
9270
9297
|
metadata: JsonObject,
|
|
9271
9298
|
unit?: string
|
|
9272
9299
|
): void;
|
|
9300
|
+
flushAnalyticsEvents(): ZuploAnalyticsEvent[];
|
|
9273
9301
|
getAnalyticsEvents(): ZuploAnalyticsEvent[];
|
|
9274
9302
|
}
|
|
9275
9303
|
|