@zuplo/runtime 7.3.1 → 7.3.2

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.
@@ -244,8 +244,9 @@ export declare type AIGatewayCapability =
244
244
 
245
245
  /**
246
246
  * Loads the app configuration for the request (when auth or the configuration
247
- * loader has not already) and runs the inbound policy chain from that
248
- * configuration.
247
+ * loader has not already), runs the inbound policy chain from that
248
+ * configuration, and enforces limits inherited from parent teams or the
249
+ * gateway root.
249
250
  *
250
251
  * Place this policy on AI Gateway routes after optional authentication and
251
252
  * optional `ai-gateway-configuration-loader-v2-inbound`. When either of those
@@ -274,6 +275,11 @@ export declare class AIGatewayConfigurationExecutorV2InboundPolicy extends Inbou
274
275
  request: ZuploRequest,
275
276
  context: ZuploContext
276
277
  ): Promise<ZuploRequest | Response>;
278
+ private enforceHierarchyLimits;
279
+ private emitHierarchyWarning;
280
+ private getConsumerSub;
281
+ private requestCapability;
282
+ private createQuotaExceededResponse;
277
283
  }
278
284
 
279
285
  /**
@@ -597,10 +603,7 @@ export declare interface AIGatewayMeteringInboundPolicyOptions {
597
603
  }
598
604
 
599
605
  /**
600
- * Meters AI Gateway usage and enforces app and ancestor usage limits.
601
- *
602
- * Limits configured on parent teams or the bucket root are enforced through a
603
- * server-side hierarchical check.
606
+ * Meters AI Gateway usage and enforces limits configured by the application.
604
607
  *
605
608
  * The authentication policy must run before this policy so the app
606
609
  * configuration id is available for meter storage and analytics.
@@ -668,7 +671,6 @@ export declare class AIGatewayMeteringV2InboundPolicy extends InboundPolicy<AIGa
668
671
  ): Promise<ZuploRequest | Response>;
669
672
  private resolveConfiguration;
670
673
  private fetchCurrentMeters;
671
- private checkHierarchicalViolation;
672
674
  private checkWarnings;
673
675
  private hasWarning;
674
676
  private findViolation;
@@ -2846,6 +2848,20 @@ export declare class BackgroundDispatcher<TPayload> {
2846
2848
  options: BatchDispatcherOptions
2847
2849
  );
2848
2850
  enqueue: (payload: TPayload) => void;
2851
+ /**
2852
+ * Dispatches whatever is queued right now and waits for it — plus any
2853
+ * dispatch already in flight — to settle, without waiting out the batching
2854
+ * delay. Use this to drain deterministically at a shutdown or flush point.
2855
+ */
2856
+ flush: () => Promise<void>;
2857
+ /**
2858
+ * Total payloads dropped because the queue was full (`maxQueueSize`).
2859
+ *
2860
+ * Dropping is silent data loss, so a caller that must report delivery
2861
+ * honestly can compare this before and after an {@link enqueue} to learn
2862
+ * whether that particular payload was accepted.
2863
+ */
2864
+ get totalDropped(): number;
2849
2865
  }
2850
2866
 
2851
2867
  /**
@@ -1719,6 +1719,10 @@ export declare interface RouteData {
1719
1719
 
1720
1720
  /* Excluded from this release type: sanitizedIdentifierName */
1721
1721
 
1722
+ export declare function setGlobalZuploEventContext(
1723
+ event: ZuploEventContext
1724
+ ): void;
1725
+
1722
1726
  /* Excluded from this release type: StandardEnv */
1723
1727
 
1724
1728
  declare interface UrlConfig {
@@ -1854,6 +1858,8 @@ declare interface ZuploContext extends EventTarget {
1854
1858
  ): void;
1855
1859
  }
1856
1860
 
1861
+ /* Excluded from this release type: ZuploEventContext */
1862
+
1857
1863
  /**
1858
1864
  * Enhanced Request class that extends the standard Web Request API with
1859
1865
  * convenient properties for accessing path parameters, query strings, and user data.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.3.1",
4
+ "version": "7.3.2",
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{a as s}from"./chunk-A3QGJZO7.js";import{a}from"./chunk-UKQQD2JN.js";import{Z as i}from"./chunk-4POCC75H.js";import{a as r}from"./chunk-TYV53J3B.js";var u=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function c(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!u.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):e.startsWith("ZUDOKU_")?!e.startsWith("ZUDOKU_PUBLIC_"):!1}r(c,"isRestrictedEnvVariableName");function L(e){return!!e.startsWith("ZUPLO_")}r(L,"isZuploReadableEnvVariableName");var f=new Proxy({},{get(e,t){let n=String(t);switch(n){case"ZUPLO_ENVIRONMENT_TYPE":return i.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return i.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return i.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return i.instance.accountName;case"ZUPLO_PROJECT_NAME":return i.instance.projectName;case"ZUPLO_BUILD_ID":return i.instance.build.BUILD_ID;case"ZUPLO_COMPATIBILITY_DATE":return i.instance.build.COMPATIBILITY_DATE}if(!(c(n)&&!L(n)))return i.instance.runtime[n]}});var _=new a(Symbol("ai-gateway-app-configuration")),p={set(e,t){let n=t!==null&&typeof t=="object"&&!Object.isFrozen(t)?s(t):t;_.set(e,{configuration:n})},has(e){return _.get(e)!==void 0},get(e){return _.get(e)?.configuration},getId(e){let t=p.get(e);if(t===null||typeof t!="object")return;let n=Reflect.get(t,"id");return typeof n=="string"&&n!==""?n:void 0}};function A(e,t,n){return`_${o(`${e}_${t}_${n}`)}`}r(A,"getRawOperationDataIdentifierName");function P(e,t,n,g){return`_${o(e.toLowerCase())}_${t.toLowerCase()}_${n.toLowerCase()}_${g.toLowerCase()}`}r(P,"getIdForParameterSchema");function R(e,t,n){return`_${o(e.toLowerCase())}_${t.toLowerCase()}_rb_${o(n.toLowerCase())}`}r(R,"getIdForRequestBodySchema");function Z(e,t){return`_${o(e)}_${o(t)}`}r(Z,"getIdForRefSchema");function o(e){let t=e.replace(/\[/g,"_LBRACKET_").replace(/\]/g,"_RBRACKET_").replace(/\{/g,"_LCURLY_").replace(/\}/g,"_RCURLY_").replace(/\//g,"_SLASH_").replace(/-/g,"_DASH_").replace(/\./g,"_DOT_").replace(/\+/g,"_PLUS_").replace(/:/g,"_COLON_").replace(/@/g,"_AT_").replace(/\$/g,"_DOLLAR_").replace(/[^a-zA-Z0-9_]/g,"_");return/^[a-zA-Z_]/.test(t)||(t=`_${t}`),t}r(o,"sanitizedIdentifierName");export{c as a,L as b,f as c,p as d,A as e,P as f,R as g,Z as h,o as i};
26
- //# sourceMappingURL=chunk-B3D32RUX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@zuplo/runtime/environment.ts","@zuplo/runtime/ai-gateway/app-configuration-context.ts","@zuplo/runtime/utils/open-api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,MAAO,OAAO,EACtB,QAAQ,MAAO,QAAQ,EACvB,QAAQ,KAAM,SAAS,EACvB,QAAQ,KAAM,MAAM,EACpB,QAAQ,MAAO,UAAU,EAEzB,QAAQ,iBAAkB,GAAG,EAGhC,MAAK,aAAa,KAAKK,CAAW,IAChCA,EAAc,IAAIA,CAAW,IAGxBA,CACT,CAzBgBR,EAAAD,EAAA","names":["ALLOWED_WRITABLE_ZUPLO_VARIABLES","isRestrictedEnvVariableName","name","__name","isZuploReadableEnvVariableName","environment","target","prop","envName","Environment","appConfiguration","ContextData","AIGatewayConfiguration","context","configuration","storedConfiguration","deepFreeze","id","getRawOperationDataIdentifierName","oasFileName","path","operation","sanitizedIdentifierName","__name","getIdForParameterSchema","type","name","getIdForRequestBodySchema","contentType","getIdForRefSchema","ref","encodedName"]}