@lunora/bindings 1.0.0-alpha.30 → 1.0.0-alpha.31

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.
@@ -0,0 +1 @@
1
+ import{LunoraError as b}from"@lunora/errors";import{c as v,U as h}from"./concurrent-vRmSvRpF.mjs";const a=(r,s)=>{const d=r[s];if(!Object.hasOwn(r,s)||d===void 0)throw new b("INTERNAL",`@lunora/bindings/vectors: no index registered for "${s}". Known indexes: ${Object.keys(r).join(", ")||"(none)"}`);return d},g=async r=>{const s=await r.embed(r.input);return{id:r.id,metadata:r.metadata,namespace:r.namespace,values:s}},m=100,u=50,c=1e3,y=1e3,K=r=>{if(Object.keys(r.indexes).length===0)throw new TypeError("@lunora/bindings/vectors: at least one index binding is required");return{deleteByIds:async(t,e)=>{const n=a(r.indexes,t);if(e.length>c)throw new RangeError(`@lunora/bindings/vectors: deleteByIds accepts at most ${String(c)} ids (got ${String(e.length)})`);return n.deleteByIds(e)},describe:async t=>{const e=a(r.indexes,t);if(!e.describe)throw new b("INTERNAL",`@lunora/bindings/vectors: binding for "${t}" does not implement describe()`);return e.describe()},getByIds:async(t,e)=>{const n=a(r.indexes,t);if(e.length>c)throw new RangeError(`@lunora/bindings/vectors: getByIds accepts at most ${String(c)} ids (got ${String(e.length)})`);return n.getByIds(e)},query:async(t,e)=>{const n=a(r.indexes,t),o=e.returnValues===!0||e.returnMetadata==="all",l=o?u:m;if(e.topK!==void 0&&(!Number.isInteger(e.topK)||e.topK<1||e.topK>l)){const w=o?` (lowered to ${String(u)} because returnValues/returnMetadata:"all" is set)`:"";throw new RangeError(`@lunora/bindings/vectors: topK must be an integer in [1, ${String(l)}]${w} (got ${String(e.topK)})`)}let i;if(e.vector&&e.vector.length>0)i=e.vector;else{if(!e.embed||e.input===void 0)throw new TypeError("@lunora/bindings/vectors: query requires either `vector` or both `input` and `embed`");i=await e.embed(e.input)}return n.query(i,{filter:e.filter,namespace:e.namespace,returnMetadata:e.returnMetadata,returnValues:e.returnValues,topK:e.topK})},upsert:async(t,e)=>{const n=a(r.indexes,t),o=await g(e);return n.upsert([o])},upsertMany:async(t,e)=>{const n=a(r.indexes,t);if(e.length>y)throw new RangeError(`@lunora/bindings/vectors: upsertMany batch exceeds ${String(y)} (got ${String(e.length)}) — split across calls`);const o=await v(e,h,g);return n.upsert(o)}}};export{K as default};
@@ -1 +1 @@
1
- import{createContextVectors as t,createVectorSyncHook as o}from"../packem_shared/createContextVectors-Bk6ZVCqQ.mjs";import{createVectorAdminIntrospector as a}from"../packem_shared/createVectorAdminIntrospector-DrsigTJs.mjs";import{default as m}from"../packem_shared/createVectors-DtLG5-xX.mjs";export{t as createContextVectors,a as createVectorAdminIntrospector,o as createVectorSyncHook,m as createVectors};
1
+ import{createContextVectors as t,createVectorSyncHook as o}from"../packem_shared/createContextVectors-Bk6ZVCqQ.mjs";import{createVectorAdminIntrospector as a}from"../packem_shared/createVectorAdminIntrospector-DrsigTJs.mjs";import{default as m}from"../packem_shared/createVectors-DirhBYpw.mjs";export{t as createContextVectors,a as createVectorAdminIntrospector,o as createVectorSyncHook,m as createVectors};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/bindings",
3
- "version": "1.0.0-alpha.30",
3
+ "version": "1.0.0-alpha.31",
4
4
  "description": "Lightweight Cloudflare binding helpers for Lunora — ctx.kv, ctx.images, ctx.analytics, ctx.pipelines, ctx.vectors, ctx.r2sql — one install, per-binding subpaths",
5
5
  "keywords": [
6
6
  "analytics",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "@lunora/errors": "1.0.0-alpha.22",
68
- "@lunora/platform": "1.0.0-alpha.12"
68
+ "@lunora/platform": "1.0.0-alpha.13"
69
69
  },
70
70
  "engines": {
71
71
  "node": "^22.15.0 || >=24.11.0"
@@ -1 +0,0 @@
1
- import{LunoraError as y}from"@lunora/errors";import{c as w,U as v}from"./concurrent-vRmSvRpF.mjs";const a=(r,s)=>{const d=r[s];if(!Object.hasOwn(r,s)||d===void 0)throw new y("INTERNAL",`@lunora/bindings/vectors: no index registered for "${s}". Known indexes: ${Object.keys(r).join(", ")||"(none)"}`);return d},g=async r=>{const s=await r.embed(r.input);return{id:r.id,metadata:r.metadata,namespace:r.namespace,values:s}},h=100,m=20,c=1e3,u=1e3,_=r=>{if(Object.keys(r.indexes).length===0)throw new TypeError("@lunora/bindings/vectors: at least one index binding is required");return{deleteByIds:async(t,e)=>{const n=a(r.indexes,t);if(e.length>c)throw new RangeError(`@lunora/bindings/vectors: deleteByIds accepts at most ${String(c)} ids (got ${String(e.length)})`);return n.deleteByIds(e)},describe:async t=>{const e=a(r.indexes,t);if(!e.describe)throw new y("INTERNAL",`@lunora/bindings/vectors: binding for "${t}" does not implement describe()`);return e.describe()},getByIds:async(t,e)=>{const n=a(r.indexes,t);if(e.length>c)throw new RangeError(`@lunora/bindings/vectors: getByIds accepts at most ${String(c)} ids (got ${String(e.length)})`);return n.getByIds(e)},query:async(t,e)=>{const n=a(r.indexes,t),o=e.returnValues===!0||e.returnMetadata==="all",l=o?m:h;if(e.topK!==void 0&&(!Number.isInteger(e.topK)||e.topK<1||e.topK>l)){const b=o?' (lowered to 20 because returnValues/returnMetadata:"all" is set)':"";throw new RangeError(`@lunora/bindings/vectors: topK must be an integer in [1, ${String(l)}]${b} (got ${String(e.topK)})`)}let i;if(e.vector&&e.vector.length>0)i=e.vector;else{if(!e.embed||e.input===void 0)throw new TypeError("@lunora/bindings/vectors: query requires either `vector` or both `input` and `embed`");i=await e.embed(e.input)}return n.query(i,{filter:e.filter,namespace:e.namespace,returnMetadata:e.returnMetadata,returnValues:e.returnValues,topK:e.topK})},upsert:async(t,e)=>{const n=a(r.indexes,t),o=await g(e);return n.upsert([o])},upsertMany:async(t,e)=>{const n=a(r.indexes,t);if(e.length>u)throw new RangeError(`@lunora/bindings/vectors: upsertMany batch exceeds ${String(u)} (got ${String(e.length)}) — split across calls`);const o=await w(e,v,g);return n.upsert(o)}}};export{_ as default};