@lunora/runtime 1.0.0-alpha.51 → 1.0.0-alpha.52
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/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toAirbyteMessages as t,toFivetranResponse as a}from"./packem_shared/toAirbyteMessages-DBTuFjb5.mjs";import{composeWorker as i,createLunoraHandler as n,createWorker as p,defineRpcEnvelope as m,resolveLunoraOptions as c,withFrameworkWorker as R}from"./packem_shared/composeWorker-BieBiNab.mjs";import{createCrossShardRelationCapabilities as f}from"./packem_shared/createCrossShardRelationCapabilities-Cr8V1uO_.mjs";import{DEFAULT_REGISTRY_CACHE_TTL_MS as d,SHARD_REGISTRY_DO_NAME as l,createDynamicShardRegistry as x}from"./packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-BclNO0yc.mjs";import{LunoraError as C,toErrorResponse as L}from"./packem_shared/LunoraError-ByasbDmd.mjs";import{createKvCursorStore as u,createMemoryCursorStore as y,defineExportSink as T,r2Sink as A,runExportTap as h,sanitizeChange as k,webhookExportSink as O}from"./packem_shared/createKvCursorStore-C24tEuYk.mjs";import{HEALTH_PATH as v,HEALTH_READY_PATH as I,buildHealthRoutes as b,d1Probe as F,durableObjectProbe as P,presenceProbe as D}from"./packem_shared/HEALTH_PATH-BpCNEAIa.mjs";import{LOG_ARCHIVE_PATH as G,resolveLogArchiveFromEnv as U}from"./packem_shared/LOG_ARCHIVE_PATH-DGsEec3K.mjs";import{memoizeIdentity as w,memoizeIdentityPerRequest as z}from"./packem_shared/memoizeIdentity-CZGtDc4H.mjs";import{e as W,a as Y}from"./packem_shared/observability-DYnm-d4g.mjs";import{analyticsEngineSink as K,combineSinks as Q,consoleSink as X,otlpSink as j,pipelineLogSink as J,sentrySink as B,webhookSink as Z}from"./packem_shared/analyticsEngineSink-CUWYuLHs.mjs";import{D as ee,a as re,c as oe}from"./packem_shared/pipeline-log-reader-DU_CCGDA.mjs";import{createQueryCoordinator as ae,createStaticShardRegistry as se,mergeStrategyForAggregate as ie}from"./packem_shared/createQueryCoordinator-DQ7dkxS6.mjs";import{applyJurisdiction as pe,resolveShard as me}from"./packem_shared/applyJurisdiction-8bzZjAPR.mjs";import{R as Re,d as Se,o as fe}from"./packem_shared/rest-cache-5unAzdFN.mjs";import{g as de,S as le,U as xe,p as _e,f as Ce}from"./packem_shared/rest-routes-BJLWmBgK.mjs";import{decorateResponse as ge,enforceOrigin as ue,handleCorsPreflight as ye,resolveSecurity as Te}from"./packem_shared/decorateResponse-DBIWsRSZ.mjs";import{createShardClient as he}from"./packem_shared/createShardClient-
|
|
1
|
+
import{toAirbyteMessages as t,toFivetranResponse as a}from"./packem_shared/toAirbyteMessages-DBTuFjb5.mjs";import{composeWorker as i,createLunoraHandler as n,createWorker as p,defineRpcEnvelope as m,resolveLunoraOptions as c,withFrameworkWorker as R}from"./packem_shared/composeWorker-BieBiNab.mjs";import{createCrossShardRelationCapabilities as f}from"./packem_shared/createCrossShardRelationCapabilities-Cr8V1uO_.mjs";import{DEFAULT_REGISTRY_CACHE_TTL_MS as d,SHARD_REGISTRY_DO_NAME as l,createDynamicShardRegistry as x}from"./packem_shared/DEFAULT_REGISTRY_CACHE_TTL_MS-BclNO0yc.mjs";import{LunoraError as C,toErrorResponse as L}from"./packem_shared/LunoraError-ByasbDmd.mjs";import{createKvCursorStore as u,createMemoryCursorStore as y,defineExportSink as T,r2Sink as A,runExportTap as h,sanitizeChange as k,webhookExportSink as O}from"./packem_shared/createKvCursorStore-C24tEuYk.mjs";import{HEALTH_PATH as v,HEALTH_READY_PATH as I,buildHealthRoutes as b,d1Probe as F,durableObjectProbe as P,presenceProbe as D}from"./packem_shared/HEALTH_PATH-BpCNEAIa.mjs";import{LOG_ARCHIVE_PATH as G,resolveLogArchiveFromEnv as U}from"./packem_shared/LOG_ARCHIVE_PATH-DGsEec3K.mjs";import{memoizeIdentity as w,memoizeIdentityPerRequest as z}from"./packem_shared/memoizeIdentity-CZGtDc4H.mjs";import{e as W,a as Y}from"./packem_shared/observability-DYnm-d4g.mjs";import{analyticsEngineSink as K,combineSinks as Q,consoleSink as X,otlpSink as j,pipelineLogSink as J,sentrySink as B,webhookSink as Z}from"./packem_shared/analyticsEngineSink-CUWYuLHs.mjs";import{D as ee,a as re,c as oe}from"./packem_shared/pipeline-log-reader-DU_CCGDA.mjs";import{createQueryCoordinator as ae,createStaticShardRegistry as se,mergeStrategyForAggregate as ie}from"./packem_shared/createQueryCoordinator-DQ7dkxS6.mjs";import{applyJurisdiction as pe,resolveShard as me}from"./packem_shared/applyJurisdiction-8bzZjAPR.mjs";import{R as Re,d as Se,o as fe}from"./packem_shared/rest-cache-5unAzdFN.mjs";import{g as de,S as le,U as xe,p as _e,f as Ce}from"./packem_shared/rest-routes-BJLWmBgK.mjs";import{decorateResponse as ge,enforceOrigin as ue,handleCorsPreflight as ye,resolveSecurity as Te}from"./packem_shared/decorateResponse-DBIWsRSZ.mjs";import{createShardClient as he}from"./packem_shared/createShardClient-jKygl5Pu.mjs";import{LOG_ARCHIVE_NOT_CONFIGURED as Oe}from"./packem_shared/LOG_ARCHIVE_NOT_CONFIGURED-CDpi4yFD.mjs";import{NOOP_EXECUTION_CONTEXT as ve}from"./packem_shared/NOOP_EXECUTION_CONTEXT-YmXqH-jH.mjs";import{composeIdentityResolvers as be,routeIdentityResolvers as Fe}from"./packem_shared/composeIdentityResolvers-DwE0Jbww.mjs";const e="0.0.0";export{ee as DEFAULT_LOG_COLUMNS,re as DEFAULT_LOG_LIMIT,d as DEFAULT_REGISTRY_CACHE_TTL_MS,v as HEALTH_PATH,I as HEALTH_READY_PATH,Oe as LOG_ARCHIVE_NOT_CONFIGURED,G as LOG_ARCHIVE_PATH,C as LunoraError,ve as NOOP_EXECUTION_CONTEXT,l as SHARD_REGISTRY_DO_NAME,e as VERSION,K as analyticsEngineSink,pe as applyJurisdiction,Re as applyRestCache,de as argsFromQuery,b as buildHealthRoutes,le as buildRestRoutes,Q as combineSinks,be as composeIdentityResolvers,i as composeWorker,X as consoleSink,f as createCrossShardRelationCapabilities,x as createDynamicShardRegistry,u as createKvCursorStore,n as createLunoraHandler,y as createMemoryCursorStore,oe as createPipelineLogReader,ae as createQueryCoordinator,xe as createRestRateLimit,he as createShardClient,se as createStaticShardRegistry,p as createWorker,F as d1Probe,ge as decorateResponse,T as defineExportSink,m as defineRpcEnvelope,P as durableObjectProbe,W as emitLogEvent,Y as emitRpcEvent,ue as enforceOrigin,ye as handleCorsPreflight,w as memoizeIdentity,z as memoizeIdentityPerRequest,ie as mergeStrategyForAggregate,j as otlpSink,J as pipelineLogSink,D as presenceProbe,A as r2Sink,_e as readShardKey,Se as requestCarriesCredentials,U as resolveLogArchiveFromEnv,c as resolveLunoraOptions,Te as resolveSecurity,me as resolveShard,fe as restCacheHeaders,Ce as restSurfaceFromRegistry,Fe as routeIdentityResolvers,h as runExportTap,k as sanitizeChange,B as sentrySink,t as toAirbyteMessages,L as toErrorResponse,a as toFivetranResponse,O as webhookExportSink,Z as webhookSink,R as withFrameworkWorker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as h}from"@lunora/errors";import{a as w,o as E,f as j,u as O}from"./identity-header-CDgIrYAz.mjs";import{applyJurisdiction as N,resolveShard as R}from"./applyJurisdiction-8bzZjAPR.mjs";const s="$lunora.wire$",g=64,A=1024,v="__proto__",$={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},S={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},x=r=>{if(r===null||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype},f=(r,t=0)=>{if(t>g)throw new RangeError(`wire-codec: value nesting exceeds the ${g}-level limit`);if(r===void 0)return[s,"undefined"];if(r===null)return null;const l=typeof r;if(l==="bigint")return[s,"bigint",r.toString()];if(l==="number"){const e=r;return Number.isNaN(e)?[s,"nan"]:e===1/0?[s,"inf"]:e===-1/0?[s,"-inf"]:e}if(l!=="object")return r;if(r instanceof Date)return[s,"date",f(r.getTime(),t+1)];if(r instanceof Error){const e=r,n={};for(const i of Object.keys(e))e[i]!==void 0&&(n[i]=f(e[i],t+1));const o=[s,"error",e.name,e.message,n];return e.cause!==void 0&&o.push(f(e.cause,t+1)),o}if(r instanceof URL)return[s,"url",r.href];if(r instanceof Map)return[s,"map",[...r.entries()].map(([e,n])=>[f(e,t+1),f(n,t+1)])];if(r instanceof Set)return[s,"set",[...r].map(e=>f(e,t+1))];if(r instanceof ArrayBuffer)return[s,"bytes",w(new Uint8Array(r)),"ArrayBuffer"];if(ArrayBuffer.isView(r)){const e=r,n=e.constructor.name,o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return n==="Uint8Array"?[s,"bytes",w(o)]:[s,"bytes",w(o),n]}if(Array.isArray(r)){const e=r.map(n=>f(n,t+1));return e.length>0&&e[0]===s?[s,"arr",e]:e}if(!x(r)){const e=r.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${e} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const d=r,a={};for(const e of Object.keys(d)){const n=d[e];n!==void 0&&(a[e]=f(n,t+1))}return a},u=(r,t=0)=>{if(t>g)throw new RangeError(`wire-codec: value nesting exceeds the ${g}-level limit`);if(r===null||typeof r!="object")return r;if(Array.isArray(r)){if(r[0]===s)switch(r[1]){case"-inf":return-1/0;case"arr":return r[2].map(a=>u(a,t+1));case"bigint":{const a=r[2];if(typeof a!="string"||a.length>A||!/^-?\d+$/.test(a))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${A} digits)`);return BigInt(a)}case"date":return new Date(u(r[2],t+1));case"map":return new Map(r[2].map(([a,e])=>[u(a,t+1),u(e,t+1)]));case"set":return new Set(r[2].map(a=>u(a,t+1)));case"url":return new URL(r[2]);case"error":{const a=r[2],e=r[3],n=(Object.hasOwn(S,a)?S[a]:void 0)??Error,o=new n(e);o.name!==a&&Object.defineProperty(o,"name",{configurable:!0,value:a,writable:!0});const i=u(r[4],t+1);for(const c of Object.keys(i))c===v?Object.defineProperty(o,c,{configurable:!0,enumerable:!0,value:i[c],writable:!0}):o[c]=i[c];return r.length>5&&Object.defineProperty(o,"cause",{configurable:!0,value:u(r[5],t+1),writable:!0}),o}case"bytes":{const a=E(r[2]),e=r[3]??"Uint8Array";if(e==="ArrayBuffer")return a.buffer.byteLength===a.byteLength?a.buffer:a.slice().buffer;const n=Object.hasOwn($,e)?$[e]:void 0;return n?new n(a.slice().buffer):a}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return r.map(a=>u(a,t+1))}return r.map(a=>u(a,t+1))}const l=r,d={};for(const a of Object.keys(l)){const e=u(l[a],t+1);a===v?Object.defineProperty(d,a,{configurable:!0,enumerable:!0,value:e,writable:!0}):d[a]=e}return d},I=r=>{if(typeof r=="string")return r;const t=r?.__lunoraRef;if(typeof t!="string"||t.length===0)throw new h("INTERNAL","createShardClient: expected a generated function reference (api.*/internal.*) or a 'namespace:fn' string");return t},U=r=>{const t=new h(r.code,r.message);return r.data!==void 0&&(t.data=u(r.data)),t},L=(r,t={})=>{const l=N(r,t.jurisdiction),d=t.system??!0,a=e=>L(r,{...t,...e});return{as:e=>a({as:e}),asSystem:()=>a({as:void 0}),call:async(e,n,o)=>{const i=I(e),c=o?.shardKey??t.shardKey;if(c===void 0||c.length===0)throw new h("INTERNAL",`createShardClient: no shard key for "${i}" — pass one to createShardClient({ shardKey }), .forShard(key), or the call's options`);const p={"content-type":"application/json"};d&&(p["x-lunora-system"]="1"),t.as&&(p["x-lunora-userid"]=j(t.as.userId),t.as.claims&&(p["x-lunora-identity"]=O(t.as.claims))),o?.mutationId!==void 0&&o.mutationId.length>0&&(p["x-lunora-mutation-id"]=o.mutationId);const y=await R(l,c).fetch(new Request("https://shard.internal/rpc",{body:JSON.stringify({args:f(n??{}),functionPath:i}),headers:p,method:"POST"}));let b;try{b=await y.json()}catch{const m=y.statusText?` ${y.statusText}`:"";throw new h("INTERNAL",`createShardClient: shard response for "${i}" was not JSON (status ${String(y.status)}${m})`)}if("error"in b)throw U(b.error);if(!y.ok){const m=y.statusText?` ${y.statusText}`:"";throw new h("INTERNAL",`createShardClient: shard call "${i}" failed (status ${String(y.status)}${m})`)}return u(b.result)},forShard:e=>a({shardKey:e})}};export{L as createShardClient};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/runtime",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.52",
|
|
4
4
|
"description": "Lunora Worker runtime: the RPC router, shard resolver, and query coordinator",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/bindings": "1.0.0-alpha.
|
|
50
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
51
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
49
|
+
"@lunora/bindings": "1.0.0-alpha.19",
|
|
50
|
+
"@lunora/errors": "1.0.0-alpha.13",
|
|
51
|
+
"@lunora/platform": "1.0.0-alpha.5"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": "^22.15.0 || >=24.11.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as p}from"@lunora/errors";import{a as m,o as E,f as O,u as j}from"./identity-header-CDgIrYAz.mjs";import{applyJurisdiction as N,resolveShard as R}from"./applyJurisdiction-8bzZjAPR.mjs";const s="$lunora.wire$",w=64,A=1024,v="__proto__",$={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},S={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},f=(e,n=0)=>{if(n>w)throw new RangeError(`wire-codec: value nesting exceeds the ${w}-level limit`);if(e===void 0)return[s,"undefined"];if(e===null)return null;const l=typeof e;if(l==="bigint")return[s,"bigint",e.toString()];if(l==="number"){const t=e;return Number.isNaN(t)?[s,"nan"]:t===1/0?[s,"inf"]:t===-1/0?[s,"-inf"]:t}if(l!=="object")return e;if(e instanceof Date)return[s,"date",f(e.getTime(),n+1)];if(e instanceof Error){const t=e,a={};for(const u of Object.keys(t))t[u]!==void 0&&(a[u]=f(t[u],n+1));const i=[s,"error",t.name,t.message,a];return t.cause!==void 0&&i.push(f(t.cause,n+1)),i}if(e instanceof URL)return[s,"url",e.href];if(e instanceof Map)return[s,"map",[...e.entries()].map(([t,a])=>[f(t,n+1),f(a,n+1)])];if(e instanceof Set)return[s,"set",[...e].map(t=>f(t,n+1))];if(e instanceof ArrayBuffer)return[s,"bytes",m(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,a=t.constructor.name,i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return a==="Uint8Array"?[s,"bytes",m(i)]:[s,"bytes",m(i),a]}if(Array.isArray(e)){const t=e.map(a=>f(a,n+1));return t.length>0&&t[0]===s?[s,"arr",t]:t}const d=Object.getPrototypeOf(e);if(d!==null&&d!==Object.prototype){const t=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${t} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const r=e,o={};for(const t of Object.keys(r)){const a=r[t];a!==void 0&&(o[t]=f(a,n+1))}return o},c=(e,n=0)=>{if(n>w)throw new RangeError(`wire-codec: value nesting exceeds the ${w}-level limit`);if(e===null||typeof e!="object")return e;if(Array.isArray(e)){if(e[0]===s)switch(e[1]){case"-inf":return-1/0;case"arr":return e[2].map(r=>c(r,n+1));case"bigint":{const r=e[2];if(typeof r!="string"||r.length>A||!/^-?\d+$/.test(r))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${A} digits)`);return BigInt(r)}case"date":return new Date(c(e[2],n+1));case"map":return new Map(e[2].map(([r,o])=>[c(r,n+1),c(o,n+1)]));case"set":return new Set(e[2].map(r=>c(r,n+1)));case"url":return new URL(e[2]);case"error":{const r=e[2],o=e[3],t=(Object.hasOwn(S,r)?S[r]:void 0)??Error,a=new t(o);a.name!==r&&Object.defineProperty(a,"name",{configurable:!0,value:r,writable:!0});const i=c(e[4],n+1);for(const u of Object.keys(i))u===v?Object.defineProperty(a,u,{configurable:!0,enumerable:!0,value:i[u],writable:!0}):a[u]=i[u];return e.length>5&&Object.defineProperty(a,"cause",{configurable:!0,value:c(e[5],n+1),writable:!0}),a}case"bytes":{const r=E(e[2]),o=e[3]??"Uint8Array";if(o==="ArrayBuffer")return r.buffer.byteLength===r.byteLength?r.buffer:r.slice().buffer;const t=Object.hasOwn($,o)?$[o]:void 0;return t?new t(r.slice().buffer):r}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return e.map(r=>c(r,n+1))}return e.map(r=>c(r,n+1))}const l=e,d={};for(const r of Object.keys(l)){const o=c(l[r],n+1);r===v?Object.defineProperty(d,r,{configurable:!0,enumerable:!0,value:o,writable:!0}):d[r]=o}return d},x=e=>{if(typeof e=="string")return e;const n=e?.__lunoraRef;if(typeof n!="string"||n.length===0)throw new p("INTERNAL","createShardClient: expected a generated function reference (api.*/internal.*) or a 'namespace:fn' string");return n},I=e=>{const n=new p(e.code,e.message);return e.data!==void 0&&(n.data=c(e.data)),n},U=(e,n={})=>{const l=N(e,n.jurisdiction),d=n.system??!0,r=o=>U(e,{...n,...o});return{as:o=>r({as:o}),asSystem:()=>r({as:void 0}),call:async(o,t,a)=>{const i=x(o),u=a?.shardKey??n.shardKey;if(u===void 0||u.length===0)throw new p("INTERNAL",`createShardClient: no shard key for "${i}" — pass one to createShardClient({ shardKey }), .forShard(key), or the call's options`);const h={"content-type":"application/json"};d&&(h["x-lunora-system"]="1"),n.as&&(h["x-lunora-userid"]=O(n.as.userId),n.as.claims&&(h["x-lunora-identity"]=j(n.as.claims))),a?.mutationId!==void 0&&a.mutationId.length>0&&(h["x-lunora-mutation-id"]=a.mutationId);const y=await R(l,u).fetch(new Request("https://shard.internal/rpc",{body:JSON.stringify({args:f(t??{}),functionPath:i}),headers:h,method:"POST"}));let b;try{b=await y.json()}catch{const g=y.statusText?` ${y.statusText}`:"";throw new p("INTERNAL",`createShardClient: shard response for "${i}" was not JSON (status ${String(y.status)}${g})`)}if("error"in b)throw I(b.error);if(!y.ok){const g=y.statusText?` ${y.statusText}`:"";throw new p("INTERNAL",`createShardClient: shard call "${i}" failed (status ${String(y.status)}${g})`)}return c(b.result)},forShard:o=>r({shardKey:o})}};export{U as createShardClient};
|