@lunora/sql-store 1.0.0-alpha.10 → 1.0.0-alpha.100
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/LICENSE.md +6 -0
- package/README.md +2 -1
- package/dist/dialect.d.mts +136 -38
- package/dist/dialect.d.ts +136 -38
- package/dist/dialect.mjs +0 -1
- package/dist/index.d.mts +264 -121
- package/dist/index.d.ts +264 -121
- package/dist/index.mjs +1 -2
- package/dist/packem_shared/SEARCH_STATE_TABLE-CbcRI0sw.mjs +1 -0
- package/dist/packem_shared/backfillSqlSearchIndexes-5isxM8_8.mjs +1 -0
- package/dist/packem_shared/createSqlCtxDb-BTZfO_3V.mjs +7 -0
- package/dist/packem_shared/ctx-db-search-CHdIaNJe.mjs +1 -0
- package/dist/packem_shared/decodeBigint-2wH193bf.mjs +1 -0
- package/dist/packem_shared/decodeGlobalRow-_JxajZP5.mjs +1 -0
- package/dist/packem_shared/value-codec-BvCc9FjU.mjs +1 -0
- package/package.json +3 -2
- package/dist/packem_shared/createSqlCtxDb-BlGq23Wp.mjs +0 -1784
- package/dist/packem_shared/decodeBigint-Dedu92k4.mjs +0 -69
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as B}from"@lunora/errors";const U=r=>{if(r.kind!=="optional")return r.kind;const t=r._meta?.inner;return t?U(t):r.kind},p=r=>{let t="";for(let n=0;n<r.length;n+=32768)t+=String.fromCharCode(...r.subarray(n,n+32768));return btoa(t)},I=r=>{const t=atob(r),s=new Uint8Array(t.length);for(let n=0;n<t.length;n+=1)s[n]=t.codePointAt(n)??0;return s},i="$lunora.wire$",g=64,O=1024,d="__proto__",j={BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int8Array,Int16Array,Int32Array,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array},h={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError},k=r=>{if(r===null||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype},E=(r,t=0)=>{if(t>g)return!0;if(r===null)return!1;const s=typeof r;if(s==="string"||s==="boolean")return!1;if(s==="number")return!Number.isFinite(r);if(s!=="object")return!0;if(Array.isArray(r))return r.length>0&&r[0]===i?!0:r.some(n=>n===void 0||E(n,t+1));if(!k(r)||Object.hasOwn(r,d))return!0;for(const n of Object.keys(r)){const c=r[n];if(c!==void 0&&E(c,t+1))return!0}return!1},a=(r,t=0)=>{if(t>g)throw new RangeError(`wire-codec: value nesting exceeds the ${g}-level limit`);if(r===void 0)return[i,"undefined"];if(r===null)return null;const s=typeof r;if(s==="bigint")return[i,"bigint",r.toString()];if(s==="number"){const e=r;return Number.isNaN(e)?[i,"nan"]:e===1/0?[i,"inf"]:e===-1/0?[i,"-inf"]:e}if(s!=="object")return r;if(r instanceof Date)return[i,"date",a(r.getTime(),t+1)];if(r instanceof Error){const e=r,o={};for(const u of Object.keys(e))e[u]!==void 0&&(o[u]=a(e[u],t+1));const f=[i,"error",e.name,e.message,o];return e.cause!==void 0&&f.push(a(e.cause,t+1)),f}if(r instanceof URL)return[i,"url",r.href];if(r instanceof Map)return[i,"map",[...r.entries()].map(([e,o])=>[a(e,t+1),a(o,t+1)])];if(r instanceof Set)return[i,"set",[...r].map(e=>a(e,t+1))];if(r instanceof ArrayBuffer)return[i,"bytes",p(new Uint8Array(r)),"ArrayBuffer"];if(ArrayBuffer.isView(r)){const e=r,o=e.constructor.name,f=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return o==="Uint8Array"?[i,"bytes",p(f)]:[i,"bytes",p(f),o]}if(Array.isArray(r)){const e=r.map(o=>a(o,t+1));return e.length>0&&e[0]===i?[i,"arr",e]:e}if(!k(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 n=r,c={};for(const e of Object.keys(n)){const o=n[e];if(o===void 0)continue;const f=a(o,t+1);e===d?Object.defineProperty(c,e,{configurable:!0,enumerable:!0,value:f,writable:!0}):c[e]=f}return c},y=(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]===i)switch(r[1]){case"-inf":return-1/0;case"arr":return r[2].map(e=>y(e,t+1));case"bigint":{const e=r[2];if(typeof e!="string"||e.length>O||!/^-?\d+$/.test(e))throw new RangeError(`wire-codec: invalid or over-long bigint (max ${O} digits)`);return BigInt(e)}case"date":return new Date(y(r[2],t+1));case"map":return new Map(r[2].map(([e,o])=>[y(e,t+1),y(o,t+1)]));case"set":return new Set(r[2].map(e=>y(e,t+1)));case"url":return new URL(r[2]);case"error":{const e=r[2],o=r[3],f=(Object.hasOwn(h,e)?h[e]:void 0)??Error,u=new f(o);u.name!==e&&Object.defineProperty(u,"name",{configurable:!0,value:e,writable:!0});const A=y(r[4],t+1);for(const b of Object.keys(A))b===d?Object.defineProperty(u,b,{configurable:!0,enumerable:!0,value:A[b],writable:!0}):u[b]=A[b];return r.length>5&&Object.defineProperty(u,"cause",{configurable:!0,value:y(r[5],t+1),writable:!0}),u}case"bytes":{const e=I(r[2]),o=r[3]??"Uint8Array";if(o==="ArrayBuffer")return e.buffer.byteLength===e.byteLength?e.buffer:e.slice().buffer;const f=Object.hasOwn(j,o)?j[o]:void 0;return f?new f(e.slice().buffer):e}case"inf":return 1/0;case"nan":return Number.NaN;case"undefined":return;default:return r.map(e=>y(e,t+1))}return r.map(c=>y(c,t+1))}const s=r,n={};for(const c of Object.keys(s)){const e=y(s[c],t+1);c===d?Object.defineProperty(n,c,{configurable:!0,enumerable:!0,value:e,writable:!0}):n[c]=e}return n},m=i,l=(r,t)=>r.startsWith(m)?y(t(r.slice(m.length))):t(r),_=r=>{if(typeof r=="boolean")return r?1:0;if(r===null||typeof r=="string"||typeof r=="number")return r;if(typeof r=="bigint")return r.toString();if(r instanceof Uint8Array)return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);try{return E(r)?m+JSON.stringify(a(r)):JSON.stringify(r)}catch(t){throw new B("BAD_REQUEST",`this value cannot be stored: ${t instanceof Error?t.message:String(t)}`)}},R=r=>{try{return JSON.parse(r)}catch{return r}},S=r=>{if(typeof r!="string")return r;try{return BigInt(r)}catch{return r}},w=r=>U(r),P=(r,t)=>{if(r===null)return r;switch(t){case"any":case"from":case"union":return typeof r=="string"&&(r.startsWith("{")||r.startsWith("[")||r.startsWith(m))?l(r,R):r;case"array":case"object":case"record":return typeof r=="string"?l(r,R):r;case"bigint":return S(r);case"boolean":return r===0||r===1?r===1:r;case"bytes":return r instanceof ArrayBuffer?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength).slice().buffer:r;default:return r}};export{P as a,S as b,y as d,w as e,_ as s,R as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/sql-store",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.100",
|
|
4
4
|
"description": "Internal dialect-parameterized SQL store core for Lunora .global() backends (D1, PlanetScale)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/
|
|
53
|
+
"@lunora/errors": "1.0.0-alpha.26",
|
|
54
|
+
"@lunora/shard-engine": "1.0.0-alpha.47",
|
|
54
55
|
"drizzle-orm": "^0.45.2"
|
|
55
56
|
},
|
|
56
57
|
"engines": {
|