@zuplo/runtime 5.2097.0 → 5.2098.0

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/internal.min.cjs CHANGED
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- "use strict";var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var r=(e,t)=>u(e,"name",{value:t,configurable:!0});var h=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of E(t))!P.call(e,s)&&s!==n&&u(e,s,{get:()=>t[s],enumerable:!(i=L(t,s))||i.enumerable});return e};var I=e=>R(u({},"__esModule",{value:!0}),e);var T={};h(T,{getIdForParameterSchema:()=>p,getIdForRefSchema:()=>O,getIdForRequestBodySchema:()=>f,getRawOperationDataIdentifierName:()=>m,isRestrictedEnvVariableName:()=>l,isZuploReadableEnvVariableName:()=>g,sanitizedIdentifierName:()=>a});module.exports=I(T);var _="2024-03-14",d=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0}});function c(){return new o({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),IS_PRODUCTION:!1,BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:_,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,COMPATIBILITY_FLAGS:d[_]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}r(c,"getMockEnvironment");var o=class e{static{r(this,"Environment")}config;static#e;static#t=!1;static initialize(t){this.#e||(this.#e=new e(t),this.#t=!0)}static get instance(){return this.#t||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#e=c()),this.#e}constructor({build:t,runtime:n}){let i;try{if(n.__ZUPLO_CONFIG){let s=atob(n.__ZUPLO_CONFIG);i=JSON.parse(s)}}catch{console.warn("Failed to parse runtime configuration")}this.config=i??{},this.build=t,this.runtime=n,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useSha256ServiceRouting(){return this.config.use_sha256_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuplo.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuplo.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuplo.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuplo.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.ENVIRONMENT_TYPE?this.build.ENVIRONMENT_TYPE==="LOCAL_DEVELOPMENT":!1}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var U=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function l(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!U.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):!1}r(l,"isRestrictedEnvVariableName");function g(e){return!!e.startsWith("ZUPLO_")}r(g,"isZuploReadableEnvVariableName");var x=new Proxy({},{get(e,t){let n=String(t);switch(n){case"ZUPLO_ENVIRONMENT_TYPE":return o.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return o.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return o.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return o.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return o.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return o.instance.build.BUILD_ID}if(!(l(n)&&!g(n)))return o.instance.runtime[n]}});function m(e,t,n){return`_${a(e+"_"+t+"_"+n)}`}r(m,"getRawOperationDataIdentifierName");function p(e,t,n,i){return`_${a(e.toLowerCase())}_`+t.toLowerCase()+"_"+n.toLowerCase()+`_${i.toLowerCase()}`}r(p,"getIdForParameterSchema");function f(e,t,n){return`_${a(e.toLowerCase())}_`+t.toLowerCase()+`_rb_${a(n.toLowerCase())}`}r(f,"getIdForRequestBodySchema");function O(e,t){return`_${a(e)}__${a(t)}`}r(O,"getIdForRefSchema");function a(e){let t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i>="0".charCodeAt(0)&&i<="9".charCodeAt(0)||i>="A".charCodeAt(0)&&i<="Z".charCodeAt(0)||i>="a".charCodeAt(0)&&i<="z".charCodeAt(0)?t.push(e.charAt(n)):t.push("_")}return t.join("")}r(a,"sanitizedIdentifierName");
25
+ "use strict";var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var r=(e,t)=>u(e,"name",{value:t,configurable:!0});var h=(e,t)=>{for(var n in t)u(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of E(t))!P.call(e,s)&&s!==n&&u(e,s,{get:()=>t[s],enumerable:!(i=L(t,s))||i.enumerable});return e};var I=e=>R(u({},"__esModule",{value:!0}),e);var T={};h(T,{getIdForParameterSchema:()=>p,getIdForRefSchema:()=>f,getIdForRequestBodySchema:()=>O,getRawOperationDataIdentifierName:()=>m,isRestrictedEnvVariableName:()=>l,isZuploReadableEnvVariableName:()=>g,sanitizedIdentifierName:()=>a});module.exports=I(T);var _="2024-03-14",d=Object.freeze({none:{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1},"2023-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!1,doNotRunHooksOnSystemRoutes:!1,removeAllVendorHeadersExceptListed:!1},"2024-01-15":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0},"2024-03-14":{runOutboundPoliciesOnHandlerOnAllStatuses:!0,doNotRunHooksOnSystemRoutes:!0,removeAllVendorHeadersExceptListed:!0}});function c(){return new o({build:{ACCOUNT_NAME:"mock-account-name",PROJECT_NAME:"mock-project-name",API_VERSION:"0.0.0",BUILD_ID:crypto.randomUUID(),TIMESTAMP:new Date().toISOString(),IS_PRODUCTION:!1,BUILD_ENV:"test",ZUPLO_VERSION:"0.0.0",COMPATIBILITY_DATE:_,ENVIRONMENT_TYPE:"mock-environment-type",GIT_SHA:void 0,COMPATIBILITY_FLAGS:d[_]},runtime:{RUNTIME_ENV:"test",RUNTIME_STAGE:"test",__ZUPLO_DEPLOYMENT_NAME:"mock-deployment-name",__ZUPLO_LOG_LEVEL:"debug",__ZUPLO_LOG_FORMAT:"pretty",__ZUPLO_MANAGEMENT_API_URL:"",__ZUPLO_RUNTIME_TYPE:"cloudflare",__ZUPLO_AUTH_API_JWT:""}})}r(c,"getMockEnvironment");var o=class e{static{r(this,"Environment")}config;static#e;static#t=!1;static initialize(t){this.#e||(this.#e=new e(t),this.#t=!0)}static get instance(){return this.#t||(console.debug("Environment has not been initialized. This is okay when running tests, a mock environment will be used."),this.#e=c()),this.#e}constructor({build:t,runtime:n}){let i;try{if(n.__ZUPLO_CONFIG){let s=atob(n.__ZUPLO_CONFIG);i=JSON.parse(s)}}catch{console.warn("Failed to parse runtime configuration")}this.config=i??{},this.build=t,this.runtime=n,this.instanceId=crypto.randomUUID()}build;runtime;instanceId;get deploymentName(){return this.runtime.__ZUPLO_DEPLOYMENT_NAME??this.config.deployment_name??void 0}get useSha256ServiceRouting(){return this.config.use_sha256_service_routing??void 0}get useProxyForFetchFromZups(){return this.config.use_proxy_for_fetch_from_zups??void 0}get devPortalBaseUrl(){return this.runtime.__ZUPLO_DEV_PORTAL_URL??this.config.dev_portal_url??"https://dev-portal-v4-1.zuplo.com"}get buildAssetsUrl(){return this.runtime.__ZUPLO_BUILD_ASSETS_URL??this.config.build_assets_url??"https://build-assets.zuplo.com"}get remoteLogToken(){return this.runtime.__ZUPLO_REMOTE_LOG_TOKEN??this.config.remote_log_token??void 0}get managementApiURL(){return this.runtime.__ZUPLO_MANAGEMENT_API_URL??this.config.management_api_url??"https://api.zuplo.com"}get cdnURL(){return this.runtime.__ZUPLO_CDN_URL??this.config.cdn_url??"https://cdn.zuplo.com"}get remoteLogURL(){return this.runtime.__ZUPLO_REMOTE_LOG_URL??this.config.log_event_api??"https://ellie.zuplo.com"}get loggingId(){return this.runtime.__ZUPLO_LOGGING_ID??this.config.logging_id??void 0}get redisURL(){return this.runtime.__ZUPLO_REDIS_URL??this.config.redis_proxy_url??"https://redis-proxy.zuplo.com"}get apiKeyServiceUrl(){return this.runtime.__ZUPLO_API_KEY_SERVICE_URL??this.config.api_key_service_url??"https://apikey.zuplo.com"}get meteringServiceUrl(){return this.config.metering_service_url??"https://meters.zuplo.com"}get authApiJWT(){return this.runtime.__ZUPLO_AUTH_API_JWT??void 0}get userLogLevel(){return this.runtime.ZUPLO_LOG_LEVEL??this.runtime.__ZUPLO_LOG_LEVEL??this.config.user_log_level??"debug"}get systemLogLevel(){return this.runtime.__ZUPLO_LOG_LEVEL??this.config.system_log_level??"debug"}get logFormat(){return this.runtime.__ZUPLO_LOG_FORMAT??this.config.log_format??"cloudflare"}get isCloudflare(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="cloudflare":this.config.runtime_type?this.config.runtime_type==="cloudflare":typeof WebSocketPair=="function"}get isDeno(){return this.runtime.__ZUPLO_RUNTIME_TYPE?this.runtime.__ZUPLO_RUNTIME_TYPE==="deno":this.config.runtime_type?this.config.runtime_type==="deno":typeof WebSocketPair!="function"}get isLocalDevelopment(){return this.build.ENVIRONMENT_TYPE?this.build.ENVIRONMENT_TYPE==="LOCAL_DEVELOPMENT":!1}get systemUserAgent(){return`Zuplo/${this.build.ZUPLO_VERSION}`}get loggingEnvironmentType(){return this.isCloudflare?"edge":this.isLocalDevelopment?"local":this.isDeno?"working-copy":"unknown"}get loggingEnvironmentStage(){return this.build.ENVIRONMENT_TYPE==="PRODUCTION"?"production":this.build.ENVIRONMENT_TYPE==="PREVIEW"?"preview":this.isLocalDevelopment?"local":this.isWorkingCopy?"working-copy":"unknown"}get isWorkingCopy(){return this.build.ENVIRONMENT_TYPE==="WORKING_COPY"}};var U=["ZUPLO_USER_LOGGER_DATA_DOG_API_KEY","ZUPLO_USER_LOGGER_DATA_DOG_URL","ZUPLO_LOG_LEVEL","ZUPLO_HANDLER_WRITE_LOG_LEVEL"];function l(e){return e.startsWith("__ZUPLO")||e.startsWith("ZUPLO_")?!U.includes(e)&&!e.startsWith("ZUPLO_PUBLIC_"):!1}r(l,"isRestrictedEnvVariableName");function g(e){return!!e.startsWith("ZUPLO_")}r(g,"isZuploReadableEnvVariableName");var x=new Proxy({},{get(e,t){let n=String(t);switch(n){case"ZUPLO_ENVIRONMENT_TYPE":return o.instance.loggingEnvironmentType;case"ZUPLO_ENVIRONMENT_STAGE":return o.instance.loggingEnvironmentStage;case"ZUPLO_ENVIRONMENT_NAME":return o.instance.runtime.__ZUPLO_DEPLOYMENT_NAME;case"ZUPLO_ACCOUNT_NAME":return o.instance.build.ACCOUNT_NAME;case"ZUPLO_PROJECT_NAME":return o.instance.build.PROJECT_NAME;case"ZUPLO_BUILD_ID":return o.instance.build.BUILD_ID}if(!(l(n)&&!g(n)))return o.instance.runtime[n]}});function m(e,t,n){return`_${a(e+"_"+t+"_"+n)}`}r(m,"getRawOperationDataIdentifierName");function p(e,t,n,i){return`_${a(e.toLowerCase())}_`+t.toLowerCase()+"_"+n.toLowerCase()+`_${i.toLowerCase()}`}r(p,"getIdForParameterSchema");function O(e,t,n){return`_${a(e.toLowerCase())}_`+t.toLowerCase()+`_rb_${a(n.toLowerCase())}`}r(O,"getIdForRequestBodySchema");function f(e,t){return`_${a(e)}__${a(t)}`}r(f,"getIdForRefSchema");function a(e){let t=[];for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i>="0".charCodeAt(0)&&i<="9".charCodeAt(0)||i>="A".charCodeAt(0)&&i<="Z".charCodeAt(0)||i>="a".charCodeAt(0)&&i<="z".charCodeAt(0)?t.push(e.charAt(n)):t.push("_")}return t.join("")}r(a,"sanitizedIdentifierName");
26
26
  /*! For license information please see internal.min.cjs.LEGAL.txt */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
- "version": "5.2097.0",
3
+ "version": "5.2098.0",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "exports": {
package/types-beta.d.ts CHANGED
@@ -138,7 +138,7 @@ export declare interface ApiAuthKeyInboundPolicyOptions {
138
138
  * @param policyName - The name of the policy as set in policies.json
139
139
  * @returns A Request or a Response
140
140
  */
141
- export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric>>;
141
+ export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
142
142
 
143
143
  /**
144
144
  * The options for this policy.
@@ -625,7 +625,7 @@ declare interface CacheOptions {
625
625
  * @param policyName - The name of the policy as set in policies.json
626
626
  * @returns A Request or a Response
627
627
  */
628
- export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric>>;
628
+ export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
629
629
 
630
630
  /**
631
631
  * The options for this policy.
@@ -4431,7 +4431,7 @@ export declare interface StripeMonetizationPluginOptions {
4431
4431
  * @returns A Request or a Response
4432
4432
  */
4433
4433
  export declare class StripeWebhookVerificationInboundPolicy extends InboundPolicy<StripeWebhookVerificationInboundPolicyOptions> {
4434
- handler(request: ZuploRequest, context: ZuploContext): Promise<Response | ZuploRequest<RequestGeneric>>;
4434
+ handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
4435
4435
  }
4436
4436
 
4437
4437
  /**
package/types-public.d.ts CHANGED
@@ -138,7 +138,7 @@ export declare interface ApiAuthKeyInboundPolicyOptions {
138
138
  * @param policyName - The name of the policy as set in policies.json
139
139
  * @returns A Request or a Response
140
140
  */
141
- export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric>>;
141
+ export declare function ApiKeyInboundPolicy(request: ZuploRequest, context: ZuploContext, unparsedOptions: ApiKeyInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
142
142
 
143
143
  /**
144
144
  * The options for this policy.
@@ -604,7 +604,7 @@ declare interface CacheOptions {
604
604
  * @param policyName - The name of the policy as set in policies.json
605
605
  * @returns A Request or a Response
606
606
  */
607
- export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<Response | ZuploRequest<RequestGeneric>>;
607
+ export declare function CachingInboundPolicy(request: ZuploRequest, context: ZuploContext, options: CachingInboundPolicyOptions, policyName: string): Promise<ZuploRequest<RequestGeneric> | Response>;
608
608
 
609
609
  /**
610
610
  * The options for this policy.
@@ -2991,7 +2991,7 @@ export declare interface SleepInboundPolicyOptions {
2991
2991
  * @returns A Request or a Response
2992
2992
  */
2993
2993
  export declare class StripeWebhookVerificationInboundPolicy extends InboundPolicy<StripeWebhookVerificationInboundPolicyOptions> {
2994
- handler(request: ZuploRequest, context: ZuploContext): Promise<Response | ZuploRequest<RequestGeneric>>;
2994
+ handler(request: ZuploRequest, context: ZuploContext): Promise<ZuploRequest<RequestGeneric> | Response>;
2995
2995
  }
2996
2996
 
2997
2997
  /**