@lunora/platform-node 1.0.0-alpha.32 → 1.0.0-alpha.34

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{createNodeGlobalStore as r,createNodeSqlExec as t}from"./packem_shared/createNodeGlobalStore-Cwi33XOk.mjs";import{createNodeShardKvStore as d}from"./packem_shared/createNodeShardKvStore-DVi1OsvH.mjs";import{createNodePlatform as f}from"./packem_shared/createNodePlatform-1fAQ_biu.mjs";import{createNodeQueueHost as x}from"./packem_shared/createNodeQueueHost--mBLGSxF.mjs";import{createNodeR2Bucket as p}from"./packem_shared/createNodeR2Bucket-CmHYlIni.mjs";import{createNodeSchedulerHost as l}from"./packem_shared/createNodeSchedulerHost-vZgv1CEo.mjs";import{createNodeShardHost as h}from"./packem_shared/createNodeShardHost-C0j8nvSU.mjs";import{createNodeShardRegistry as k}from"./packem_shared/createNodeShardRegistry-DKdc0pV8.mjs";import{createNodeShardState as w}from"./packem_shared/createNodeShardState-CpUzvWwd.mjs";import{createNodeSocketHost as W}from"./packem_shared/createNodeSocketHost-DK3X5PlQ.mjs";import{createNodeWorkflowHost as g}from"./packem_shared/createNodeWorkflowHost-CTVBYiuj.mjs";import{createNodeWorkflowStore as q}from"./packem_shared/createNodeWorkflowStore-CL7RYP6H.mjs";export{r as createNodeGlobalStore,f as createNodePlatform,x as createNodeQueueHost,p as createNodeR2Bucket,l as createNodeSchedulerHost,h as createNodeShardHost,d as createNodeShardKvStore,k as createNodeShardRegistry,w as createNodeShardState,W as createNodeSocketHost,t as createNodeSqlExec,g as createNodeWorkflowHost,q as createNodeWorkflowStore};
1
+ import{createNodeGlobalStore as r,createNodeSqlExec as t}from"./packem_shared/createNodeGlobalStore-Cwi33XOk.mjs";import{createNodeShardKvStore as d}from"./packem_shared/createNodeShardKvStore-DVi1OsvH.mjs";import{createNodePlatform as f}from"./packem_shared/createNodePlatform-1fAQ_biu.mjs";import{createNodeQueueHost as x}from"./packem_shared/createNodeQueueHost--mBLGSxF.mjs";import{createNodeR2Bucket as p}from"./packem_shared/createNodeR2Bucket-BP8iXgC4.mjs";import{createNodeSchedulerHost as l}from"./packem_shared/createNodeSchedulerHost-vZgv1CEo.mjs";import{createNodeShardHost as h}from"./packem_shared/createNodeShardHost-C0j8nvSU.mjs";import{createNodeShardRegistry as k}from"./packem_shared/createNodeShardRegistry-DKdc0pV8.mjs";import{createNodeShardState as w}from"./packem_shared/createNodeShardState-CpUzvWwd.mjs";import{createNodeSocketHost as W}from"./packem_shared/createNodeSocketHost-DK3X5PlQ.mjs";import{createNodeWorkflowHost as g}from"./packem_shared/createNodeWorkflowHost-CTVBYiuj.mjs";import{createNodeWorkflowStore as q}from"./packem_shared/createNodeWorkflowStore-CL7RYP6H.mjs";export{r as createNodeGlobalStore,f as createNodePlatform,x as createNodeQueueHost,p as createNodeR2Bucket,l as createNodeSchedulerHost,h as createNodeShardHost,d as createNodeShardKvStore,k as createNodeShardRegistry,w as createNodeShardState,W as createNodeSocketHost,t as createNodeSqlExec,g as createNodeWorkflowHost,q as createNodeWorkflowStore};
@@ -0,0 +1 @@
1
+ import{randomUUID as $,createHash as P}from"node:crypto";import{mkdir as N,open as D,rename as F,unlink as k,readdir as H}from"node:fs/promises";import{join as w,dirname as S}from"node:path";import{LunoraError as f}from"@lunora/errors";import{t as M}from"./to-array-buffer-DVyXU4Ep.mjs";new TextEncoder;const G=Array.from({length:32},(e,t)=>t),K=new RegExp(`[${G.map(e=>String.fromCodePoint(e)).join("")}]`,"u"),z=e=>K.test(e),I=".lunora-tmp",C="LNR1",m=8,_=1024,b=255,W=/[%A-Z:]/g,j=e=>{const t=e.replaceAll(W,n=>`%${n.codePointAt(0)?.toString(16).padStart(2,"0").toUpperCase()??""}`),r=t.at(-1);return r==="."||r===" "?`${t.slice(0,-1)}%${r.codePointAt(0)?.toString(16).padStart(2,"0").toUpperCase()??""}`:t},X=e=>{try{return decodeURIComponent(e)}catch{return}},y=e=>e.split("/").map(t=>j(t)).join("/"),J=e=>{const t=[];for(const r of e.split("/")){const n=X(r);if(n===void 0)return;t.push(n)}return t.join("/")},g=e=>{if(typeof e!="string"||e.length===0)throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 key must be a non-empty string");if(e.length>_)throw new f("VALIDATION_ERROR",`@lunora/platform-node: R2 key exceeds ${String(_)}-byte limit`);if(e.includes("\0"))throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a NUL byte");if(z(e))throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a control character (including CR/LF)");if(e.includes("\\"))throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a backslash (a path separator on Windows)");if(e.startsWith("/"))throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 key must not start with `/`");for(const t of e.split("/")){if(Buffer.byteLength(j(t),"utf8")>b)throw new f("VALIDATION_ERROR",`@lunora/platform-node: R2 key segment "${t}" exceeds ${String(b)} bytes once escaped for the filesystem`);if(t===""||t==="."||t==="..")throw new f("VALIDATION_ERROR",`@lunora/platform-node: R2 key has an empty, \`.\` or \`..\` path segment ("${e}")`);if(t===I)throw new f("VALIDATION_ERROR",`@lunora/platform-node: R2 key is reserved (no segment may be "${I}")`)}},v=e=>e instanceof Error&&"code"in e&&e.code==="ENOENT",x=(e,t)=>{const r=t instanceof Error&&"code"in t?t.code:void 0;return r==="EEXIST"||r==="EISDIR"||r==="ENOTDIR"?new f("VALIDATION_ERROR",`@lunora/platform-node: R2 key "${e}" collides with an existing object at one of its path prefixes — this host stores one file per key, so a key and a prefix of it cannot both hold objects`):t},Y=e=>{const t=Buffer.from(JSON.stringify(e),"utf8"),r=Buffer.alloc(m);return r.writeUInt32BE(t.byteLength,0),r.write(C,4,"ascii"),Buffer.concat([t,r])},Z=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.sha256Hex=="string"&&typeof t.size=="number"&&typeof t.uploaded=="string"},q=async e=>{const t=await e.stat();if(!t.isFile()||t.size<m)return;const r=Buffer.alloc(m);if(await e.read(r,0,m,t.size-m),r.toString("ascii",4,m)!==C)return;const n=r.readUInt32BE(0),o=t.size-m-n;if(n===0||o<0)return;const i=Buffer.alloc(n),{bytesRead:s}=await e.read(i,0,n,o);if(s!==n)return;let a;try{a=JSON.parse(i.toString("utf8"))}catch{return}return Z(a)?{bodySize:o,meta:a}:void 0},U=async e=>{let t;try{t=await D(e,"r")}catch(r){if(v(r))return;throw r}try{const r=await q(t);if(r===void 0){await t.close();return}return{...r,handle:t}}catch(r){throw await t.close(),r}},L=new FinalizationRegistry(e=>{e.close().catch(()=>{})}),B=async e=>{const t=await U(e);if(t!==void 0)return await t.handle.close(),{bodySize:t.bodySize,meta:t.meta}},A=(e,t)=>{const{sha256Hex:r}=t,n=Buffer.from(r,"hex");return{checksums:{sha256:M(n)},customMetadata:t.customMetadata,etag:r,httpEtag:`"${r}"`,httpMetadata:t.httpMetadata,key:e,sha256:r,sha256Base64:n.toString("base64"),size:t.size,uploaded:new Date(t.uploaded)}},E=(e,t,r)=>e===void 0||!Number.isFinite(e)?t:Math.min(Math.max(0,Math.floor(e)),r),Q=(e,t)=>{if(t===void 0)return{end:e,start:0};if("suffix"in t)return{end:e,start:e-E(t.suffix,e,e)};const r=E(t.offset,0,e);return{end:t.length===void 0||!Number.isFinite(t.length)?e:Math.min(r+E(t.length,0,e),e),start:r}},tt=(e,t,r,n)=>{const o=e.createReadStream({autoClose:!1,end:r-1,start:t})[Symbol.asyncIterator]();return new ReadableStream({cancel:async()=>{await o.return?.(),await n()},pull:async i=>{let s;try{s=await o.next()}catch(a){throw await n(),a}s.done===!0?(i.close(),await n()):i.enqueue(s.value)}})},et=async(e,t,r)=>{const n=r-t;if(n<=0)return Buffer.alloc(0);const o=Buffer.alloc(n),{bytesRead:i}=await e.read(o,0,n,t);return o.subarray(0,i)},V=async function*(e){if(e!==null){if(typeof e=="string"){yield new TextEncoder().encode(e);return}if(e instanceof ArrayBuffer){yield new Uint8Array(e);return}if(ArrayBuffer.isView(e)){yield new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return}if(e instanceof Blob){yield*V(e.stream());return}if(e instanceof ReadableStream){for await(const t of e)if(t instanceof Uint8Array)yield t;else if(t instanceof ArrayBuffer)yield new Uint8Array(t);else throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 put stream must yield byte chunks");return}throw new f("VALIDATION_ERROR","@lunora/platform-node: unsupported R2 put body")}},rt=async e=>{const t=[],r=async(n,o)=>{let i;try{i=await H(n,{withFileTypes:!0})}catch(a){if(v(a))return;throw a}const s=[];for(const a of i){if(a.name===I)continue;const l=o===""?a.name:`${o}/${a.name}`;if(a.isDirectory())s.push(r(w(n,a.name),l));else{const d=J(l);d!==void 0&&t.push(d)}}await Promise.all(s)};return await r(e,""),t.sort((n,o)=>n<o?-1:+(n>o)),t},nt=(e,t)=>{let r=0,n=e.length;for(;r<n;){const o=r+Math.floor((n-r)/2),i=e[o];i===void 0||i<=t?r=o+1:n=o}return r},O=async e=>{try{await k(e)}catch(t){if(!v(t))throw t}},lt=e=>{const{directory:t}=e;return{delete:async r=>{g(r),await O(w(t,y(r)))},get:async(r,n)=>{g(r);const o=await U(w(t,y(r)));if(o===void 0)return null;const{bodySize:i,handle:s,meta:a}=o,{end:l,start:d}=Q(i,n?.range),c={};let h=!1;const p=async()=>{h||(h=!0,L.unregister(c),await s.close())},u=()=>{if(h)throw new f("BAD_REQUEST",`@lunora/platform-node: R2 object "${r}" body has already been consumed`)},R=async()=>{u();try{return await et(s,d,l)}finally{await p()}},T={...A(r,a),arrayBuffer:async()=>M(await R()),get body(){return u(),l<=d?(p().catch(()=>{}),new Blob([]).stream()):tt(s,d,l,p)},text:async()=>(await R()).toString("utf8")};return L.register(T,{close:p},c),T},head:async r=>{g(r);const n=await B(w(t,y(r)));return n===void 0?null:A(r,n.meta)},list:async(r={})=>{const n=Math.max(1,E(r.limit,1e3,1e3));if(r.prefix?.includes("\0"))throw new f("VALIDATION_ERROR","@lunora/platform-node: R2 list prefix contains a NUL byte");const o=await rt(t),i=r.prefix??"",s=o.filter(u=>u.startsWith(i)&&(r.delimiter===void 0||!u.slice(i.length).includes(r.delimiter)));let a=r.cursor;r.startAfter!==void 0&&(a===void 0||r.startAfter>a)&&(a=r.startAfter);const l=a===void 0?0:nt(s,a),d=s.slice(l,l+n),c=l+n<s.length,p=(await Promise.all(d.map(async u=>{const R=await B(w(t,y(u)));return R===void 0?void 0:A(u,R.meta)}))).filter(u=>u!==void 0);return{cursor:c?d.at(-1):void 0,objects:p,truncated:c}},put:async(r,n,o)=>{g(r);const i=w(t,y(r)),s=w(t,I,$());try{await N(S(i),{recursive:!0})}catch(c){throw x(r,c)}await N(S(s),{recursive:!0});const a=P("sha256");let l=0,d;try{const c=await D(s,"w");try{for await(const h of V(n))a.update(h),l+=h.byteLength,await c.write(h);d={customMetadata:o?.customMetadata,httpMetadata:o?.httpMetadata,sha256Hex:a.digest("hex"),size:l,uploaded:new Date().toISOString()},await c.write(Y(d))}finally{await c.close()}}catch(c){throw await O(s),c}try{await F(s,i)}catch(c){throw await O(s),x(r,c)}return A(r,d)}}};export{lt as createNodeR2Bucket};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/platform-node",
3
- "version": "1.0.0-alpha.32",
3
+ "version": "1.0.0-alpha.34",
4
4
  "description": "Node implementation of the Lunora platform contracts: ShardHost, SocketHost, ShardDirectory, ShardKvStore, SchedulerHost over better-sqlite3 and an in-process socket registry (dev/test target)",
5
5
  "keywords": [
6
6
  "better-sqlite3",
@@ -46,11 +46,11 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/d1": "1.0.0-alpha.93",
49
+ "@lunora/d1": "1.0.0-alpha.95",
50
50
  "@lunora/errors": "1.0.0-alpha.24",
51
- "@lunora/platform": "1.0.0-alpha.18",
52
- "@lunora/queue": "1.0.0-alpha.35",
53
- "@lunora/sql-store": "1.0.0-alpha.95",
51
+ "@lunora/platform": "1.0.0-alpha.19",
52
+ "@lunora/queue": "1.0.0-alpha.36",
53
+ "@lunora/sql-store": "1.0.0-alpha.97",
54
54
  "@lunora/workflow": "1.0.0-alpha.35",
55
55
  "@visulima/workflow": "3.0.0",
56
56
  "better-sqlite3": "^13.0.3",
@@ -1 +0,0 @@
1
- import{randomUUID as $,createHash as P}from"node:crypto";import{mkdir as N,open as D,rename as F,unlink as k,readdir as H}from"node:fs/promises";import{join as w,dirname as S}from"node:path";import{LunoraError as c}from"@lunora/errors";import{t as M}from"./to-array-buffer-DVyXU4Ep.mjs";new TextEncoder;const G=Array.from({length:32},(e,t)=>t),K=new RegExp(`[${G.map(e=>String.fromCodePoint(e)).join("")}]`,"u"),z=e=>K.test(e),E=".lunora-tmp",C="LNR1",m=8,_=1024,b=255,W=/[%A-Z:]/g,j=e=>{const t=e.replaceAll(W,r=>`%${r.codePointAt(0)?.toString(16).padStart(2,"0").toUpperCase()??""}`),n=t.at(-1);return n==="."||n===" "?`${t.slice(0,-1)}%${n.codePointAt(0)?.toString(16).padStart(2,"0").toUpperCase()??""}`:t},X=e=>{try{return decodeURIComponent(e)}catch{return}},R=e=>e.split("/").map(t=>j(t)).join("/"),J=e=>{const t=[];for(const n of e.split("/")){const r=X(n);if(r===void 0)return;t.push(r)}return t.join("/")},y=e=>{if(typeof e!="string"||e.length===0)throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 key must be a non-empty string");if(e.length>_)throw new c("VALIDATION_ERROR",`@lunora/platform-node: R2 key exceeds ${String(_)}-byte limit`);if(e.includes("\0"))throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a NUL byte");if(z(e))throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a control character (including CR/LF)");if(e.includes("\\"))throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 key contains a backslash (a path separator on Windows)");if(e.startsWith("/"))throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 key must not start with `/`");for(const t of e.split("/")){if(Buffer.byteLength(j(t),"utf8")>b)throw new c("VALIDATION_ERROR",`@lunora/platform-node: R2 key segment "${t}" exceeds ${String(b)} bytes once escaped for the filesystem`);if(t===""||t==="."||t==="..")throw new c("VALIDATION_ERROR",`@lunora/platform-node: R2 key has an empty, \`.\` or \`..\` path segment ("${e}")`);if(t===E)throw new c("VALIDATION_ERROR",`@lunora/platform-node: R2 key is reserved (no segment may be "${E}")`)}},O=e=>e instanceof Error&&"code"in e&&e.code==="ENOENT",x=(e,t)=>{const n=t instanceof Error&&"code"in t?t.code:void 0;return n==="EEXIST"||n==="EISDIR"||n==="ENOTDIR"?new c("VALIDATION_ERROR",`@lunora/platform-node: R2 key "${e}" collides with an existing object at one of its path prefixes — this host stores one file per key, so a key and a prefix of it cannot both hold objects`):t},Y=e=>{const t=Buffer.from(JSON.stringify(e),"utf8"),n=Buffer.alloc(m);return n.writeUInt32BE(t.byteLength,0),n.write(C,4,"ascii"),Buffer.concat([t,n])},Z=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.sha256Hex=="string"&&typeof t.size=="number"&&typeof t.uploaded=="string"},q=async e=>{const t=await e.stat();if(!t.isFile()||t.size<m)return;const n=Buffer.alloc(m);if(await e.read(n,0,m,t.size-m),n.toString("ascii",4,m)!==C)return;const r=n.readUInt32BE(0),o=t.size-m-r;if(r===0||o<0)return;const i=Buffer.alloc(r),{bytesRead:s}=await e.read(i,0,r,o);if(s!==r)return;let a;try{a=JSON.parse(i.toString("utf8"))}catch{return}return Z(a)?{bodySize:o,meta:a}:void 0},U=async e=>{let t;try{t=await D(e,"r")}catch(n){if(O(n))return;throw n}try{const n=await q(t);if(n===void 0){await t.close();return}return{...n,handle:t}}catch(n){throw await t.close(),n}},L=new FinalizationRegistry(e=>{e.close().catch(()=>{})}),B=async e=>{const t=await U(e);if(t!==void 0)return await t.handle.close(),{bodySize:t.bodySize,meta:t.meta}},g=(e,t)=>{const{sha256Hex:n}=t,r=Buffer.from(n,"hex");return{checksums:{sha256:M(r)},customMetadata:t.customMetadata,etag:n,httpEtag:`"${n}"`,httpMetadata:t.httpMetadata,key:e,sha256:n,sha256Base64:r.toString("base64"),size:t.size,uploaded:new Date(t.uploaded)}},A=(e,t,n)=>e===void 0||!Number.isFinite(e)?t:Math.min(Math.max(0,Math.floor(e)),n),Q=(e,t)=>{if(t===void 0)return{end:e,start:0};if("suffix"in t)return{end:e,start:e-A(t.suffix,e,e)};const n=A(t.offset,0,e);return{end:t.length===void 0||!Number.isFinite(t.length)?e:Math.min(n+A(t.length,0,e),e),start:n}},tt=(e,t,n,r)=>{const o=e.createReadStream({autoClose:!1,end:n-1,start:t})[Symbol.asyncIterator]();return new ReadableStream({cancel:async()=>{await o.return?.(),await r()},pull:async i=>{let s;try{s=await o.next()}catch(a){throw await r(),a}s.done===!0?(i.close(),await r()):i.enqueue(s.value)}})},et=async(e,t,n)=>{const r=n-t;if(r<=0)return Buffer.alloc(0);const o=Buffer.alloc(r),{bytesRead:i}=await e.read(o,0,r,t);return o.subarray(0,i)},V=async function*(e){if(e!==null){if(typeof e=="string"){yield new TextEncoder().encode(e);return}if(e instanceof ArrayBuffer){yield new Uint8Array(e);return}if(ArrayBuffer.isView(e)){yield new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return}if(e instanceof Blob){yield*V(e.stream());return}if(e instanceof ReadableStream){for await(const t of e)if(t instanceof Uint8Array)yield t;else if(t instanceof ArrayBuffer)yield new Uint8Array(t);else throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 put stream must yield byte chunks");return}throw new c("VALIDATION_ERROR","@lunora/platform-node: unsupported R2 put body")}},nt=async e=>{const t=[],n=async(r,o)=>{let i;try{i=await H(r,{withFileTypes:!0})}catch(a){if(O(a))return;throw a}const s=[];for(const a of i){if(a.name===E)continue;const d=o===""?a.name:`${o}/${a.name}`;if(a.isDirectory())s.push(n(w(r,a.name),d));else{const l=J(d);l!==void 0&&t.push(l)}}await Promise.all(s)};return await n(e,""),t.sort((r,o)=>r<o?-1:+(r>o)),t},rt=(e,t)=>{let n=0,r=e.length;for(;n<r;){const o=n+Math.floor((r-n)/2),i=e[o];i===void 0||i<=t?n=o+1:r=o}return n},I=async e=>{try{await k(e)}catch(t){if(!O(t))throw t}},ft=e=>{const{directory:t}=e;return{delete:async n=>{y(n),await I(w(t,R(n)))},get:async(n,r)=>{y(n);const o=await U(w(t,R(n)));if(o===void 0)return null;const{bodySize:i,handle:s,meta:a}=o,{end:d,start:l}=Q(i,r?.range),f={};let h=!1;const u=async()=>{h||(h=!0,L.unregister(f),await s.close())},p=()=>{if(h)throw new c("BAD_REQUEST",`@lunora/platform-node: R2 object "${n}" body has already been consumed`)},T=async()=>{p();try{return await et(s,l,d)}finally{await u()}},v={...g(n,a),arrayBuffer:async()=>M(await T()),get body(){return p(),d<=l?(u().catch(()=>{}),new Blob([]).stream()):tt(s,l,d,u)},text:async()=>(await T()).toString("utf8")};return L.register(v,{close:u},f),v},head:async n=>{y(n);const r=await B(w(t,R(n)));return r===void 0?null:g(n,r.meta)},list:async(n={})=>{const r=Math.max(1,A(n.limit,1e3,1e3));if(n.prefix?.includes("\0"))throw new c("VALIDATION_ERROR","@lunora/platform-node: R2 list prefix contains a NUL byte");const o=await nt(t),i=n.prefix??"",s=o.filter(u=>u.startsWith(i)&&(n.delimiter===void 0||!u.slice(i.length).includes(n.delimiter))),a=n.cursor===void 0?0:rt(s,n.cursor),d=s.slice(a,a+r),l=a+r<s.length,h=(await Promise.all(d.map(async u=>{const p=await B(w(t,R(u)));return p===void 0?void 0:g(u,p.meta)}))).filter(u=>u!==void 0);return{cursor:l?d.at(-1):void 0,objects:h,truncated:l}},put:async(n,r,o)=>{y(n);const i=w(t,R(n)),s=w(t,E,$());try{await N(S(i),{recursive:!0})}catch(f){throw x(n,f)}await N(S(s),{recursive:!0});const a=P("sha256");let d=0,l;try{const f=await D(s,"w");try{for await(const h of V(r))a.update(h),d+=h.byteLength,await f.write(h);l={customMetadata:o?.customMetadata,httpMetadata:o?.httpMetadata,sha256Hex:a.digest("hex"),size:d,uploaded:new Date().toISOString()},await f.write(Y(l))}finally{await f.close()}}catch(f){throw await I(s),f}try{await F(s,i)}catch(f){throw await I(s),x(n,f)}return g(n,l)}}};export{ft as createNodeR2Bucket};