@zuplo/runtime 6.65.1 → 6.65.3
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/index.js +32 -32
- package/out/esm/index.js.map +1 -1
- package/out/esm/mocks/index.js +1 -1
- package/out/esm/mocks/index.js.map +1 -1
- package/out/types/index.d.ts +23 -6
- package/out/types/mocks/index.d.ts +23 -6
- 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
|
|
25
|
+
import{b as l}from"../chunk-HNEQMV5Z.js";import{Z as n,a as t}from"../chunk-FU34FDGK.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,setLogProperties:t(()=>{},"setLogProperties")},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 l(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 p=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,p,r)}};export{s as MockZuploContext,g as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@zuplo/runtime/mocks/context.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;yFA4BO,SAASA,EACdC,EAA6D,CAC3D,QAAS,IAAI,QAAQ,yBAAyB,CAChD,EACA,CACA,IAAMC,EAAwC,CAAC,EAG/C,SAASC,EAAUC,EAA6B,CAC9CF,EAAkB,KAAK,QAAQ,QAAQE,CAAO,CAAC,CACjD,CAFS,OAAAC,EAAAF,EAAA,aAaF,CAAE,QATO,IAAIG,EAAiB,CACnC,MAAO,CAAE,UAAAH,CAAU,EACnB,MAAOF,EAAQ,KACjB,CAAC,EAMiB,eAJKI,EAAA,SAAY,CACjC,MAAM,QAAQ,IAAIH,CAAiB,CACrC,EAFuB,iBAIU,CACnC,CAtBgBG,EAAAL,EAAA,qBAwBhB,IAAMO,EAA2C,CAC/C,KAAM,IACN,QAAS,CAAC,KAAK,EACf,QAAS,CACP,OAAQ,CAAC,EACT,OAAQ,SACV,EACA,IAAKF,EAAA,KAAU,CAAC,GAAX,MACP,EAMaC,EAAN,cAA+B,WAAoC,CAlE1E,MAkE0E,CAAAD,EAAA,yBAC/DG,GACA,UACA,UACA,IACA,MAEA,OACA,0BACA,cACA,iBAET,YAAY,CACV,MAAAC,EACA,MAAAC,EAAQH,EACR,cAAAI,CACF,EAIG,CACD,MAAM,EACN,KAAK,UAAY,OAAO,WAAW,EACnC,KAAK,UAAY,OAAO,WAAW,EAEnC,KAAK,IAAM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S,CAAC,EACf,KAAK,MAAQK,EACb,KAAK,0BAA4B,CAC/B,IAAK,KACL,eAAgB,eAChB,KAAM,UACN,OAAQ,aACR,WAAY,KACZ,KAAM,MACN,UAAW,KACX,QAAS,KACT,WAAY,QACZ,UAAW,MACX,SAAU,OACV,UAAW,OACX,SAAU,OACV,aAAc,MAChB,EACA,KAAK,cAAgBC,EACrB,KAAKH,GAASC,EACd,KAAK,iBAAmB,IAAII,EAA6B,KAAK,SAAS,CACzE,CAGA,UAAUT,EAAuB,CAC/B,KAAKI,GAAO,UAAUJ,CAAO,CAC/B,CAEA,oBACEU,EACAC,EACkC,CAClC,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAEA,qBACED,EACAE,EACAD,EACmB,CACnB,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAEA,YACEE,EACAC,EACmB,CACnB,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAKA,uBAAuBC,EAAmC,CACxD,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAKA,4BAA4BA,EAAwC,CAClE,MAAM,IAAI,MAAM,iBAAiB,CACnC,CAES,iBACPC,EACAC,EACApB,EACM,CACN,IAAMqB,EAA8CjB,EAACkB,GAAM,CACzD,GAAI,CACF,OAAOF,GAAY,WAAaA,EAAQE,CAAC,EAAIF,EAAQ,YAAYE,CAAC,CACpE,OAASC,EAAK,CACZ,WAAK,IAAI,MACP,wBAAwBJ,CAAI,mCAC9B,EACMI,CACR,CACF,EAToD,WAUpD,MAAM,iBAAiBJ,EAAME,EAASrB,CAAO,CAC/C,CACF","names":["createMockContext","options","waitUntilPromises","waitUntil","promise","__name","MockZuploContext","DEFAULT_ROUTE_CONFIG","#event","event","route","parentContext","internals_default","ZuploGatewayAnalyticsContext","policyName","request","response","input","init","hook","type","handler","wrapped","e","err"]}
|
package/out/types/index.d.ts
CHANGED
|
@@ -5100,12 +5100,27 @@ declare type LogFormat = "pretty" | "json" | "gcp" | "cloudflare";
|
|
|
5100
5100
|
/**
|
|
5101
5101
|
* @beta
|
|
5102
5102
|
*/
|
|
5103
|
-
export declare interface Logger {
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5103
|
+
export declare interface Logger extends SystemLogger {
|
|
5104
|
+
/**
|
|
5105
|
+
* Set properties that will be included in all subsequent log entries for this request.
|
|
5106
|
+
* Properties are merged with existing properties and any static fields configured in the logging plugin.
|
|
5107
|
+
* Per-request properties take precedence over static fields with the same name.
|
|
5108
|
+
*
|
|
5109
|
+
* @param properties - Key-value pairs to include in log entries. Values must be string, number, or boolean.
|
|
5110
|
+
*
|
|
5111
|
+
* @example
|
|
5112
|
+
* ```ts
|
|
5113
|
+
* export default async function (request: ZuploRequest, context: ZuploContext) {
|
|
5114
|
+
* // Set properties that will be included in all logs for this request
|
|
5115
|
+
* context.log.setLogProperties({ http_status_code: 400, user_id: "123" });
|
|
5116
|
+
*
|
|
5117
|
+
* context.log.error("Request failed"); // Will include http_status_code and user_id
|
|
5118
|
+
*
|
|
5119
|
+
* return new Response("Error", { status: 400 });
|
|
5120
|
+
* }
|
|
5121
|
+
* ```
|
|
5122
|
+
*/
|
|
5123
|
+
setLogProperties(properties: Record<string, string | number | boolean>): void;
|
|
5109
5124
|
}
|
|
5110
5125
|
|
|
5111
5126
|
/* Excluded from this release type: LoggingContext */
|
|
@@ -8740,6 +8755,8 @@ export declare interface SupabaseJwtInboundPolicyOptions {
|
|
|
8740
8755
|
|
|
8741
8756
|
/* Excluded from this release type: SYSTEM_LOGGER */
|
|
8742
8757
|
|
|
8758
|
+
/* Excluded from this release type: SystemLogger */
|
|
8759
|
+
|
|
8743
8760
|
/* Excluded from this release type: SystemRouteName */
|
|
8744
8761
|
|
|
8745
8762
|
/**
|
|
@@ -789,12 +789,27 @@ declare type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
|
789
789
|
/**
|
|
790
790
|
* @beta
|
|
791
791
|
*/
|
|
792
|
-
declare interface Logger {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
792
|
+
declare interface Logger extends SystemLogger {
|
|
793
|
+
/**
|
|
794
|
+
* Set properties that will be included in all subsequent log entries for this request.
|
|
795
|
+
* Properties are merged with existing properties and any static fields configured in the logging plugin.
|
|
796
|
+
* Per-request properties take precedence over static fields with the same name.
|
|
797
|
+
*
|
|
798
|
+
* @param properties - Key-value pairs to include in log entries. Values must be string, number, or boolean.
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```ts
|
|
802
|
+
* export default async function (request: ZuploRequest, context: ZuploContext) {
|
|
803
|
+
* // Set properties that will be included in all logs for this request
|
|
804
|
+
* context.log.setLogProperties({ http_status_code: 400, user_id: "123" });
|
|
805
|
+
*
|
|
806
|
+
* context.log.error("Request failed"); // Will include http_status_code and user_id
|
|
807
|
+
*
|
|
808
|
+
* return new Response("Error", { status: 400 });
|
|
809
|
+
* }
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
setLogProperties(properties: Record<string, string | number | boolean>): void;
|
|
798
813
|
}
|
|
799
814
|
|
|
800
815
|
/**
|
|
@@ -1541,6 +1556,8 @@ declare interface RouteConfiguration
|
|
|
1541
1556
|
raw<T = any>(): T;
|
|
1542
1557
|
}
|
|
1543
1558
|
|
|
1559
|
+
/* Excluded from this release type: SystemLogger */
|
|
1560
|
+
|
|
1544
1561
|
declare type UserDataDefault = any;
|
|
1545
1562
|
|
|
1546
1563
|
/**
|