yaml-flow 8.4.15 → 8.4.16
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/browser/asset-integrity.json +3 -3
- package/browser/board-livecards-localstorage.js +5 -5
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +2 -2
- package/cli/browser-api/board-live-cards-browser-adapter.js +3 -3
- package/cli/browser-api/card-store-browser-api.js +1 -1
- package/cli/bundled/artifacts-store-cli.mjs +4 -4
- package/cli/bundled/batch-runner-cli.mjs +1 -1
- package/cli/bundled/board-live-cards-cli.mjs +20 -20
- package/cli/{execution-interface-DCFBy4L8.d.ts → execution-interface-BCIhu1gO.d.ts} +7 -0
- package/cli/{types-BbQ75HLf.d.ts → types-YNCagczT.d.ts} +9 -1
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-WdoKNAF0.d.cts → artifacts-store-lib-CVgtQrNZ.d.cts} +1 -1
- package/lib/{artifacts-store-lib-CXgRA5J7.d.ts → artifacts-store-lib-D-k-E8Vy.d.ts} +1 -1
- package/lib/artifacts-store-public.d.cts +3 -3
- package/lib/artifacts-store-public.d.ts +3 -3
- package/lib/board-live-cards-node.cjs +13 -13
- package/lib/board-live-cards-node.d.cts +10 -10
- package/lib/board-live-cards-node.d.ts +10 -10
- package/lib/board-live-cards-node.js +13 -13
- package/lib/{board-live-cards-public-wbWRD1nO.d.cts → board-live-cards-public-CQ82CDdS.d.cts} +9 -1
- package/lib/{board-live-cards-public-C81ZEkF-.d.ts → board-live-cards-public-CtlVp0L3.d.ts} +9 -1
- package/lib/board-live-cards-public.cjs +2 -2
- package/lib/board-live-cards-public.d.cts +2 -2
- package/lib/board-live-cards-public.d.ts +2 -2
- package/lib/board-live-cards-public.js +2 -2
- package/lib/board-live-cards-server-runtime.cjs +3 -3
- package/lib/board-live-cards-server-runtime.d.cts +5 -5
- package/lib/board-live-cards-server-runtime.d.ts +5 -5
- package/lib/board-live-cards-server-runtime.js +3 -3
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/{chat-storage-lib-OX0Q_Ttf.d.cts → chat-storage-lib-B1wU27y3.d.cts} +1 -1
- package/lib/{chat-storage-lib-DGaKrjVe.d.ts → chat-storage-lib-DsF4kPon.d.ts} +1 -1
- package/lib/chat-store-public.d.cts +3 -3
- package/lib/chat-store-public.d.ts +3 -3
- package/lib/execution-refs.cjs +2 -2
- package/lib/execution-refs.js +2 -2
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/server-runtime/index.cjs +3 -3
- package/lib/server-runtime/index.d.cts +6 -6
- package/lib/server-runtime/index.d.ts +6 -6
- package/lib/server-runtime/index.js +3 -3
- package/lib/step-machine-public/index.cjs +3 -3
- package/lib/step-machine-public/index.d.cts +1 -1
- package/lib/step-machine-public/index.d.ts +1 -1
- package/lib/step-machine-public/index.js +3 -3
- package/lib/{storage-interface-B-7pDHwD.d.cts → storage-interface-B2WD9D5n.d.cts} +7 -0
- package/lib/{storage-interface-B-7pDHwD.d.ts → storage-interface-B2WD9D5n.d.ts} +7 -0
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/lib/{types-U3Iu6jDR.d.cts → types-D1R0JHIs.d.cts} +4 -4
- package/lib/{types-DsKGXgeT.d.ts → types-vTfV-Zkn.d.ts} +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var A="b64:";function D(t){let e=new TextEncoder().encode(t),g=globalThis.Buffer,a;if(g)a=g.from(e).toString("base64");else if(typeof btoa=="function"){let s="";for(let l of e)s+=String.fromCharCode(l);a=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function W(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),g=globalThis.Buffer;if(g)return g.from(e,"base64").toString("utf8");if(typeof atob=="function"){let a=atob(e),s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function v(t){return `${A}${D(JSON.stringify(t))}`}function k(t){if(!t.startsWith(A))throw new Error(`Invalid ref format (expected ${A}<base64url(json)>): ${t}`);let e;try{e=JSON.parse(W(t.slice(A.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${t}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${t}`);let g=e;if(typeof g.kind!="string"||typeof g.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:g.kind,value:g.value}}function E(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function L(t){let e=t.payload??{};return {id:t.id,role:typeof e.role=="string"?e.role:"system",text:typeof e.text=="string"?e.text:"",files:Array.isArray(e.files)?e.files:[],updated_at:typeof e.updated_at=="string"?e.updated_at:""}}function M(t,e){let g=s=>`chats/${E(s)}/processing`,a=s=>`chats/${E(s)}/config`;return {append(s,l,r,o=[]){return t(s).append({role:l,text:r,files:o,updated_at:new Date().toISOString()}).id},readAll(s){return t(s).readAll().map(L)},readAfter(s,l){let r=t(s).readAfter(l);return {records:r.entries.map(L),cursor:r.newCursor}},clear(s){t(s).clear?.();},setProcessing(s,l){l?e.write(g(s),true):e.delete(g(s));},isProcessing(s){return e.read(g(s))===true},getConfig(s){return e.read(a(s))??{}},setConfig(s,l){let r=e.read(a(s))??{};e.write(a(s),{...r,...l});}}}function $(t){if(t==null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map($).join(",")}]`;let e=t;return `{${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${$(e[a])}`).join(",")}}`}function I(t,e){let g=e>>>0;for(let a=0;a<t.length;a++)g^=t.charCodeAt(a),g=Math.imul(g,16777619)>>>0;return g}function O(t){let e=$(t),g=I(e,2166136261),a=I(e,3735928559),s=I(e,19088743),l=I(e,4277009102);return [g,a,s,l].map(r=>r.toString(16).padStart(8,"0")).join("")}function R(t){function e(l){return `${t}:blob:${l}`}let g=new TextEncoder;function a(l){if(typeof btoa=="function"){let r="";for(let o=0;o<l.length;o++)r+=String.fromCharCode(l[o]);return btoa(r)}return ""}function s(l){if(typeof atob=="function"){let r=atob(l),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}return new Uint8Array}return {read(l){return globalThis.localStorage.getItem(e(l))},write(l,r){globalThis.localStorage.setItem(e(l),r);},exists(l){return globalThis.localStorage.getItem(e(l))!==null},remove(l){globalThis.localStorage.removeItem(e(l));},readBytes(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;try{let o=JSON.parse(r);if(o&&o.__kind==="bytes-b64"&&typeof o.data=="string")return s(o.data)}catch{}return g.encode(r)},writeBytes(l,r){let o=JSON.stringify({__kind:"bytes-b64",data:a(r)});globalThis.localStorage.setItem(e(l),o);},listKeys(l){let r=e(l??""),o=[];for(let i=0;i<globalThis.localStorage.length;i++){let u=globalThis.localStorage.key(i);u&&u.startsWith(r)&&o.push(u.slice(e("").length));}return o.sort()},stat(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;let o=g.encode(r).byteLength;try{let i=JSON.parse(r);i&&i.__kind==="bytes-b64"&&typeof i.data=="string"&&(o=s(i.data).byteLength);}catch{}return {key:l,size:o}}}}var
|
|
2
|
-
${new Date().toISOString()}`);}catch{}function r(){let n=globalThis.localStorage.getItem(g);if(n===null)return {};try{let c=JSON.parse(n);return c&&typeof c=="object"&&!Array.isArray(c)?c:{}}catch{return {}}}function o(n){try{globalThis.localStorage.setItem(g,JSON.stringify(n));}catch{}}if(l){let n=r();typeof n["retention.lastSweepAt"]!="number"&&(n["retention.lastSweepAt"]=Date.now(),o(n));}function i(){if(globalThis.localStorage.getItem(e)===null)return;let n=r(),c=typeof n["retention.maxAgeMs"]=="number"?n["retention.maxAgeMs"]:z,f=typeof n["retention.sweepIntervalMs"]=="number"?n["retention.sweepIntervalMs"]:X;if(c<=0||f<=0)return;let h=typeof n["retention.lastSweepAt"]=="number"?n["retention.lastSweepAt"]:0,y=Date.now();if(y-h<f)return;n["retention.lastSweepAt"]=y,o(n);let p=y,S=`${t}${T}`,b=[];for(let m=0;m<globalThis.localStorage.length;m++){let w=globalThis.localStorage.key(m);w&&w.startsWith(S)&&!w.endsWith(":__ts")&&b.push(w);}for(let m of b){if(Date.now()-p>q)break;let w=globalThis.localStorage.getItem(`${m}:__ts`),C=w===null?0:Number(w);if(Number.isFinite(C)&&C>0&&y-C>c){try{globalThis.localStorage.removeItem(m);}catch{}try{globalThis.localStorage.removeItem(`${m}:__ts`);}catch{}}}}function u(n,c){let f=N(n,"scratch"),h=N(c,".json"),y=h.startsWith(".")?h:`.${h}`,p=Math.random().toString(36).slice(2,10);return `${f}-${Date.now()}-${p}${y}`}function d(n,c){globalThis.localStorage.setItem(a(n),c),globalThis.localStorage.setItem(s(n),String(Date.now()));}return {read(n){return globalThis.localStorage.getItem(a(n))},write(n,c){d(n,c);try{i();}catch{}},exists(n){return globalThis.localStorage.getItem(a(n))!==null},remove(n){try{globalThis.localStorage.removeItem(a(n));}catch{}try{globalThis.localStorage.removeItem(s(n));}catch{}},readBytes(n){let c=globalThis.localStorage.getItem(a(n));return c===null?null:new TextEncoder().encode(c)},writeBytes(n,c){let f="";for(let h=0;h<c.length;h++)f+=String.fromCharCode(c[h]);d(n,f);try{i();}catch{}},stat(n){let c=globalThis.localStorage.getItem(a(n));if(c===null)return null;let f=globalThis.localStorage.getItem(s(n)),h=f===null?null:Number(f);return {key:n,size:new TextEncoder().encode(c).byteLength,updatedAt:h!==null&&Number.isFinite(h)?new Date(h).toISOString():void 0}},listKeys(n){let c=`${t}${T}`,f=[];for(let h=0;h<globalThis.localStorage.length;h++){let y=globalThis.localStorage.key(h);if(y&&y.startsWith(c)&&!y.endsWith(":__ts")){let p=y.slice(c.length);(!n||p.startsWith(n))&&f.push(p);}}return f.sort()},getUniqueKey(n,c){return u(n,c)},create(n,c,f){let h=u(c,f);d(h,n);try{i();}catch{}return h},keyRef(n){return {kind:"local-storage-scratch",value:n,extra:{prefix:t}}},config:{get(n){return r()[n]??null},set(n,c){let f=r();c==null?delete f[n]:f[n]=c,o(f);}}}}var G=":archive-marker",Z=":archive-config",_=":archive:stream:",
|
|
3
|
-
${new Date().toISOString()}`);}catch{}function s(){let o=globalThis.localStorage.getItem(g);if(o===null)return {};try{let i=JSON.parse(o);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return {}}}function l(o){try{globalThis.localStorage.setItem(g,JSON.stringify(o));}catch{}}function r(){if(globalThis.localStorage.getItem(e)===null)return;let o=s(),i=typeof o["retention.maxAgeMs"]=="number"?o["retention.maxAgeMs"]:0,u=typeof o["retention.sweepIntervalMs"]=="number"?o["retention.sweepIntervalMs"]:0;if(i<=0||u<=0)return;let d=typeof o["retention.lastSweepAt"]=="number"?o["retention.lastSweepAt"]:0,n=Date.now();if(n-d<u)return;o["retention.lastSweepAt"]=n,l(o);let c=`${t}${_}`;for(let f=0;f<globalThis.localStorage.length;f++){let h=globalThis.localStorage.key(f);if(!h||!h.startsWith(c))continue;let y=globalThis.localStorage.getItem(h);if(y)try{let p=JSON.parse(y),S=p.filter(b=>typeof b.__ts!="number"||n-b.__ts<=i);S.length!==p.length&&globalThis.localStorage.setItem(h,JSON.stringify(S));}catch{}}}return {stream(o){let i=
|
|
1
|
+
var A="b64:";function D(t){let e=new TextEncoder().encode(t),g=globalThis.Buffer,a;if(g)a=g.from(e).toString("base64");else if(typeof btoa=="function"){let s="";for(let l of e)s+=String.fromCharCode(l);a=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function W(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),g=globalThis.Buffer;if(g)return g.from(e,"base64").toString("utf8");if(typeof atob=="function"){let a=atob(e),s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function v(t){return `${A}${D(JSON.stringify(t))}`}function k(t){if(!t.startsWith(A))throw new Error(`Invalid ref format (expected ${A}<base64url(json)>): ${t}`);let e;try{e=JSON.parse(W(t.slice(A.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${t}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${t}`);let g=e;if(typeof g.kind!="string"||typeof g.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:g.kind,value:g.value}}function E(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function L(t){let e=t.payload??{};return {id:t.id,role:typeof e.role=="string"?e.role:"system",text:typeof e.text=="string"?e.text:"",files:Array.isArray(e.files)?e.files:[],updated_at:typeof e.updated_at=="string"?e.updated_at:""}}function M(t,e){let g=s=>`chats/${E(s)}/processing`,a=s=>`chats/${E(s)}/config`;return {append(s,l,r,o=[]){return t(s).append({role:l,text:r,files:o,updated_at:new Date().toISOString()}).id},readAll(s){return t(s).readAll().map(L)},readAfter(s,l){let r=t(s).readAfter(l);return {records:r.entries.map(L),cursor:r.newCursor}},clear(s){t(s).clear?.();},setProcessing(s,l){l?e.write(g(s),true):e.delete(g(s));},isProcessing(s){return e.read(g(s))===true},getConfig(s){return e.read(a(s))??{}},setConfig(s,l){let r=e.read(a(s))??{};e.write(a(s),{...r,...l});}}}function $(t){if(t==null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map($).join(",")}]`;let e=t;return `{${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${$(e[a])}`).join(",")}}`}function I(t,e){let g=e>>>0;for(let a=0;a<t.length;a++)g^=t.charCodeAt(a),g=Math.imul(g,16777619)>>>0;return g}function O(t){let e=$(t),g=I(e,2166136261),a=I(e,3735928559),s=I(e,19088743),l=I(e,4277009102);return [g,a,s,l].map(r=>r.toString(16).padStart(8,"0")).join("")}function R(t){function e(l){return `${t}:blob:${l}`}let g=new TextEncoder;function a(l){if(typeof btoa=="function"){let r="";for(let o=0;o<l.length;o++)r+=String.fromCharCode(l[o]);return btoa(r)}return ""}function s(l){if(typeof atob=="function"){let r=atob(l),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}return new Uint8Array}return {read(l){return globalThis.localStorage.getItem(e(l))},write(l,r){globalThis.localStorage.setItem(e(l),r);},exists(l){return globalThis.localStorage.getItem(e(l))!==null},remove(l){globalThis.localStorage.removeItem(e(l));},readBytes(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;try{let o=JSON.parse(r);if(o&&o.__kind==="bytes-b64"&&typeof o.data=="string")return s(o.data)}catch{}return g.encode(r)},writeBytes(l,r){let o=JSON.stringify({__kind:"bytes-b64",data:a(r)});globalThis.localStorage.setItem(e(l),o);},listKeys(l){let r=e(l??""),o=[];for(let i=0;i<globalThis.localStorage.length;i++){let u=globalThis.localStorage.key(i);u&&u.startsWith(r)&&o.push(u.slice(e("").length));}return o.sort()},stat(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;let o=g.encode(r).byteLength;try{let i=JSON.parse(r);i&&i.__kind==="bytes-b64"&&typeof i.data=="string"&&(o=s(i.data).byteLength);}catch{}return {key:l,size:o}}}}var V=":scratch-marker",H=":scratch-config",T=":scratch:",z=1440*60*1e3,X=720*60*1e3,q=200;function N(t,e){if(!t)return e;let g=t.replace(/[^A-Za-z0-9._-]/g,"_");return g.length>0?g:e}function B(t){let e=`${t}${V}`,g=`${t}${H}`,a=n=>`${t}${T}${n}`,s=n=>`${t}${T}${n}:__ts`,l=globalThis.localStorage.getItem(e)===null;if(l)try{globalThis.localStorage.setItem(e,`scratch-store
|
|
2
|
+
${new Date().toISOString()}`);}catch{}function r(){let n=globalThis.localStorage.getItem(g);if(n===null)return {};try{let c=JSON.parse(n);return c&&typeof c=="object"&&!Array.isArray(c)?c:{}}catch{return {}}}function o(n){try{globalThis.localStorage.setItem(g,JSON.stringify(n));}catch{}}if(l){let n=r();typeof n["retention.lastSweepAt"]!="number"&&(n["retention.lastSweepAt"]=Date.now(),o(n));}function i(){if(globalThis.localStorage.getItem(e)===null)return;let n=r(),c=typeof n["retention.maxAgeMs"]=="number"?n["retention.maxAgeMs"]:z,f=typeof n["retention.sweepIntervalMs"]=="number"?n["retention.sweepIntervalMs"]:X;if(c<=0||f<=0)return;let h=typeof n["retention.lastSweepAt"]=="number"?n["retention.lastSweepAt"]:0,y=Date.now();if(y-h<f)return;n["retention.lastSweepAt"]=y,o(n);let p=y,S=`${t}${T}`,b=[];for(let m=0;m<globalThis.localStorage.length;m++){let w=globalThis.localStorage.key(m);w&&w.startsWith(S)&&!w.endsWith(":__ts")&&b.push(w);}for(let m of b){if(Date.now()-p>q)break;let w=globalThis.localStorage.getItem(`${m}:__ts`),C=w===null?0:Number(w);if(Number.isFinite(C)&&C>0&&y-C>c){try{globalThis.localStorage.removeItem(m);}catch{}try{globalThis.localStorage.removeItem(`${m}:__ts`);}catch{}}}}function u(n,c){let f=N(n,"scratch"),h=N(c,".json"),y=h.startsWith(".")?h:`.${h}`,p=Math.random().toString(36).slice(2,10);return `${f}-${Date.now()}-${p}${y}`}function d(n,c){globalThis.localStorage.setItem(a(n),c),globalThis.localStorage.setItem(s(n),String(Date.now()));}return {read(n){return globalThis.localStorage.getItem(a(n))},write(n,c){d(n,c);try{i();}catch{}},exists(n){return globalThis.localStorage.getItem(a(n))!==null},remove(n){try{globalThis.localStorage.removeItem(a(n));}catch{}try{globalThis.localStorage.removeItem(s(n));}catch{}},readBytes(n){let c=globalThis.localStorage.getItem(a(n));return c===null?null:new TextEncoder().encode(c)},writeBytes(n,c){let f="";for(let h=0;h<c.length;h++)f+=String.fromCharCode(c[h]);d(n,f);try{i();}catch{}},stat(n){let c=globalThis.localStorage.getItem(a(n));if(c===null)return null;let f=globalThis.localStorage.getItem(s(n)),h=f===null?null:Number(f);return {key:n,size:new TextEncoder().encode(c).byteLength,updatedAt:h!==null&&Number.isFinite(h)?new Date(h).toISOString():void 0}},listKeys(n){let c=`${t}${T}`,f=[];for(let h=0;h<globalThis.localStorage.length;h++){let y=globalThis.localStorage.key(h);if(y&&y.startsWith(c)&&!y.endsWith(":__ts")){let p=y.slice(c.length);(!n||p.startsWith(n))&&f.push(p);}}return f.sort()},getUniqueKey(n,c){return u(n,c)},create(n,c,f){let h=u(c,f);d(h,n);try{i();}catch{}return h},keyRef(n){return {kind:"local-storage-scratch",value:n,extra:{prefix:t}}},config:{get(n){return r()[n]??null},set(n,c){let f=r();c==null?delete f[n]:f[n]=c,o(f);}}}}var G=":archive-marker",Z=":archive-config",_=":archive:stream:",K=":archive:blob:";function U(t){let e=t.replace(/[^A-Za-z0-9._-]/g,"_");if(!e)throw new Error("Archive segment name cannot be empty after sanitization");return e}function J(t){let e=`${t}${G}`,g=`${t}${Z}`,a=o=>`${t}${_}${o}`;if(globalThis.localStorage.getItem(e)===null)try{globalThis.localStorage.setItem(e,`archive-store
|
|
3
|
+
${new Date().toISOString()}`);}catch{}function s(){let o=globalThis.localStorage.getItem(g);if(o===null)return {};try{let i=JSON.parse(o);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return {}}}function l(o){try{globalThis.localStorage.setItem(g,JSON.stringify(o));}catch{}}function r(){if(globalThis.localStorage.getItem(e)===null)return;let o=s(),i=typeof o["retention.maxAgeMs"]=="number"?o["retention.maxAgeMs"]:0,u=typeof o["retention.sweepIntervalMs"]=="number"?o["retention.sweepIntervalMs"]:0;if(i<=0||u<=0)return;let d=typeof o["retention.lastSweepAt"]=="number"?o["retention.lastSweepAt"]:0,n=Date.now();if(n-d<u)return;o["retention.lastSweepAt"]=n,l(o);let c=`${t}${_}`;for(let f=0;f<globalThis.localStorage.length;f++){let h=globalThis.localStorage.key(f);if(!h||!h.startsWith(c))continue;let y=globalThis.localStorage.getItem(h);if(y)try{let p=JSON.parse(y),S=p.filter(b=>typeof b.__ts!="number"||n-b.__ts<=i);S.length!==p.length&&globalThis.localStorage.setItem(h,JSON.stringify(S));}catch{}}}return {stream(o){let i=U(o),u=a(i);function d(){let c=globalThis.localStorage.getItem(u);if(!c)return [];try{return JSON.parse(c)}catch{return []}}function n(c){try{globalThis.localStorage.setItem(u,JSON.stringify(c));}catch{}}return {append(c){let f={id:globalThis.crypto.randomUUID(),payload:c,__ts:Date.now()},h=d();h.push(f),n(h);try{r();}catch{}return {id:f.id,payload:f.payload}},readAll(){return d().map(c=>({id:c.id,payload:c.payload}))},readAfter(c){let f=d();if(!c){let S=f.map(b=>({id:b.id,payload:b.payload}));return {entries:S,newCursor:S.length>0?S[S.length-1].id:null}}let h=f.findIndex(S=>S.id===c),p=(h===-1?f:f.slice(h+1)).map(S=>({id:S.id,payload:S.payload}));return {entries:p,newCursor:p.length>0?p[p.length-1].id:c}},clear(){try{globalThis.localStorage.removeItem(u);}catch{}}}},blob(o){let i=U(o),u=R(`${t}${K}${i}`);return {read:d=>u.read(d),write:(d,n)=>{u.write(d,n);try{r();}catch{}},exists:d=>u.exists(d),remove:d=>u.remove(d),readBytes:u.readBytes?d=>u.readBytes(d):void 0,writeBytes:u.writeBytes?(d,n)=>{u.writeBytes(d,n);try{r();}catch{}}:void 0,listKeys:d=>u.listKeys(d),stat:u.stat?d=>u.stat(d):void 0}},listStreams(o){let i=`${t}${_}`,u=[];for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length);(!o||c.startsWith(o))&&u.push(c);}return u.sort()},listBlobs(o){let i=`${t}${K}`,u=new Set;for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length),f=c.indexOf(":"),h=f===-1?c:c.slice(0,f);(!o||h.startsWith(o))&&u.add(h);}return Array.from(u).sort()},config:{get(o){return s()[o]??null},set(o,i){let u=s();i==null?delete u[o]:u[o]=i,l(u);}}}}function x(t){function e(g){return `${t}:kv:${g}`}return {read(g){let a=globalThis.localStorage.getItem(e(g));if(a===null)return null;try{return JSON.parse(a)}catch{return null}},write(g,a){globalThis.localStorage.setItem(e(g),JSON.stringify(a));},delete(g){globalThis.localStorage.removeItem(e(g));},listKeys(g){let a=e(g??""),s=[];for(let l=0;l<globalThis.localStorage.length;l++){let r=globalThis.localStorage.key(l);r!==null&&r.startsWith(a)&&s.push(r.slice(e("").length));}return s}}}function j(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {readAllEntries(){return e()},appendEntry(a){let s=e();s.push(a),g(s);},generateId(){return globalThis.crypto.randomUUID()}}}function Y(){let t=false;return {tryAcquire(){return t?null:(t=true,()=>{t=false;})}}}function Q(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function tt(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {append(a){let s={id:globalThis.crypto.randomUUID(),payload:a},l=e();return l.push(s),g(l),s},readAll(){return e()},readAfter(a){let s=e();if(!a)return {entries:s,newCursor:s.length>0?s[s.length-1].id:null};let l=s.findIndex(o=>o.id===a),r=l===-1?s:s.slice(l+1);return {entries:r,newCursor:r.length>0?r[r.length-1].id:a}},clear(){globalThis.localStorage.removeItem(t);}}}function it(t){return M(e=>tt(`${t}:chat:journal:${Q(e)}`),x(`${t}:chat`))}var P=new Map;function F(t){let e=P.get(t);if(!e){let g=new Set;e={publish(a){for(let s of g)s(a);},subscribe(a){return g.add(a),()=>{g.delete(a);}}},P.set(t,e);}return e}function lt(){return {async subscribe(t,e){return t.kind!=="in-memory-bus"?(console.warn(`[in-memory-transport] unsupported kind: ${t.kind}`),()=>{}):F(t.value).subscribe(a=>{let s=a;if(s&&s.kind==="notification-batch"&&Array.isArray(s.notifications)){for(let l of s.notifications)e(l);return}e(a);})}}}function ct(t,e){let g=e?.callbackBaseUrl?{meta:"board-live-cards",howToRun:"http:post",whatToRun:e.callbackBaseUrl}:{meta:"board-live-cards",howToRun:"in-browser",whatToRun:v({kind:"in-browser",value:t})},a=new Map,s=new Map,l=Y();return {kvStorage:r=>x(`${t}:${r}`),blobStorage:r=>R(r?`${t}:${r}`:t),scratchStorage:()=>B(`${t}:scratch`),scratchStorageForRef:r=>B(k(r).value),archiveFactory:()=>J(`${t}:archive`),archiveFactoryForRef:r=>J(k(r).value),journalAdapter:()=>j(`${t}:journal`),lock:l,selfRef:g,async dispatchExecution(r,o){if(r.howToRun==="http:post")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return d.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${d.status}: ${d.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="http:get")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=new URLSearchParams(Object.entries(o).filter(([,f])=>f!=null).map(([f,h])=>[f,String(h)])),n=`${u}?${d.toString()}`,c=await fetch(n);return c.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${c.status}: ${c.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="in-browser"){let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=a.get(u);return d?d(r,o):{dispatched:false,error:`No in-browser handler registered for: ${u}`}}return {dispatched:false,error:`Browser adapter: unsupported dispatch kind (got: ${r.howToRun})`}},resolveBlob(r){if(r.kind==="in-memory"){let u=s.get(r.value);if(u==null)throw new Error(`resolveBlob: in-memory blob not found: ${v(r)}`);return u}let i=R(t).read(r.value);if(i===null)throw new Error(`resolveBlob: blob not found: ${v(r)}`);return i},hashFn:O,genId:()=>globalThis.crypto.randomUUID().replace(/-/g,""),kvStorageForRef:r=>x(k(r).value),publishBoardChangeNotifications(r){if(!e?.notifyChannel||r.length===0)return;F(e.notifyChannel).publish({kind:"notification-batch",notifications:r});},onWarn:e?.onWarn,registerHandler(r,o){a.set(r,o);},writeMemoryBlob(r,o){return s.set(r,o),v({kind:"in-memory",value:r})}}}export{ct as createBrowserBoardPlatformAdapter,lt as createInMemoryNotificationTransport,it as createLocalStorageChatStorage,F as getInMemoryNotificationBus};//# sourceMappingURL=board-live-cards-browser-adapter.js.map
|
|
4
4
|
//# sourceMappingURL=board-live-cards-browser-adapter.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createRequire}from'module';import'ajv-formats';var R=createRequire(import.meta.url);R("./jsonata-sync.cjs");var x=createRequire(import.meta.url);x("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],g=c[l],m=g&&typeof g=="object"&&!Array.isArray(g)?{...g}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e(),i=s[t];i&&(n.removeCard(i.key),delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function p(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(p).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${p(o[r])}`).join(",")}}`}function f(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function _(n){let o=p(n),e=f(o,2166136261),r=f(o,3735928559),t=f(o,19088743),s=f(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function
|
|
1
|
+
import {createRequire}from'module';import'ajv-formats';var R=createRequire(import.meta.url);R("./jsonata-sync.cjs");var x=createRequire(import.meta.url);x("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],g=c[l],m=g&&typeof g=="object"&&!Array.isArray(g)?{...g}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e(),i=s[t];i&&(n.removeCard(i.key),delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function p(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(p).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${p(o[r])}`).join(",")}}`}function f(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function _(n){let o=p(n),e=f(o,2166136261),r=f(o,3735928559),t=f(o,19088743),s=f(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function A(n){function o(e){return `${n}:kv:${e}`}return {read(e){let r=globalThis.localStorage.getItem(o(e));if(r===null)return null;try{return JSON.parse(r)}catch{return null}},write(e,r){globalThis.localStorage.setItem(o(e),JSON.stringify(r));},delete(e){globalThis.localStorage.removeItem(o(e));},listKeys(e){let r=o(e??""),t=[];for(let s=0;s<globalThis.localStorage.length;s++){let i=globalThis.localStorage.key(s);i!==null&&i.startsWith(r)&&t.push(i.slice(o("").length));}return t}}}function h(n,o){let e={...n};for(let[r,t]of Object.entries(o))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])?e[r]=h(e[r],t):e[r]=t;return e}function S(n,o,e){if(o.length===0)return n;let[r,...t]=o;if(t.length===0)return {...n,[r]:e};let s=n[r]!==null&&typeof n[r]=="object"&&!Array.isArray(n[r])?n[r]:{};return {...n,[r]:S(s,t,e)}}function T(n){let o=A(n);return {read:e=>o.read(e),get(e,r){let t=o.read(e);if(t===null)return null;let s=t;for(let i of r.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[i]??null;}return s??null},write:(e,r)=>o.write(e,r),delete:e=>o.delete(e),listKeys:e=>o.listKeys(e),shallowMerge(e,r){let t=o.read(e)??{};o.write(e,{...t,...r});},deepMerge(e,r){let t=o.read(e)??{};o.write(e,h(t,r));},patch(e,r,t){let s=o.read(e)??{},i=r.split(".").filter(Boolean);o.write(e,S(s,i,t));}}}function k(n){let o=T(n);return {readIndex(){return o.read("_index")},writeIndex(e){o.write("_index",e);},readCard(e){return o.read(e)},writeCard(e,r){return o.write(e,r),_(r)},removeCard(e){o.delete(e);},cardExists(e){return o.read(e)!==null},defaultCardKey(e){return e}}}function ke(n){let o=k(n),e=y(o);return {getCard(r){return e.readCard(r)},getAllCards(){return e.readAllCards()},upsertCard(r){let t=o.defaultCardKey(r.id);e.writeCard(r.id,r,t);},removeCard(r){e.removeCard(r);}}}export{ke as createBrowserCardStoreApi};//# sourceMappingURL=card-store-browser-api.js.map
|
|
2
2
|
//# sourceMappingURL=card-store-browser-api.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import{createRequire}from"module";const require=createRequire(import.meta.url);
|
|
2
|
-
var vt=Object.create;var De=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var $=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Et=(e,t,r,
|
|
3
|
-
GFS4: `),console.error(e)});k[M]||($e=global[M]||[],Be(k,$e),k.close=(function(e){function t(r,o){return e.call(k,r,function(n){n||qe(),typeof o=="function"&&o.apply(this,arguments)})}return Object.defineProperty(t,ae,{value:e}),t})(k.close),k.closeSync=(function(e){function t(r){e.apply(k,arguments),qe()}return Object.defineProperty(t,ae,{value:e}),t})(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){G(k[M]),$("assert").equal(k[M].length,0)}));var $e;global[M]||Be(global,k[M]);ve.exports=Se(At(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(ve.exports=Se(k),k.__patched=!0);function Se(e){Dt(e),e.gracefulify=Se,e.createReadStream=Le,e.createWriteStream=Ne;var t=e.readFile;e.readFile=r;function r(y,S,m){return typeof S=="function"&&(m=S,S=null),L(y,S,m);function L(N,F,O,b){return t(N,F,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?J([L,[N,F,O],g,b||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var o=e.writeFile;e.writeFile=n;function n(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return o(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=a);function a(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return i(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var c=e.copyFile;c&&(e.copyFile=d);function d(y,S,m,L){return typeof m=="function"&&(L=m,m=0),N(y,S,m,L);function N(F,O,b,g,D){return c(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var h=e.readdir;e.readdir=s;var u=/^v[0-5]\./;function s(y,S,m){typeof S=="function"&&(m=S,S=null);var L=u.test(process.version)?function(O,b,g,D){return h(O,N(O,b,g,D))}:function(O,b,g,D){return h(O,b,N(O,b,g,D))};return L(y,S,m);function N(F,O,b,g){return function(D,x){D&&(D.code==="EMFILE"||D.code==="ENFILE")?J([L,[F,O,b],D,g||Date.now(),Date.now()]):(x&&x.sort&&x.sort(),typeof b=="function"&&b.call(this,D,x))}}}if(process.version.substr(0,4)==="v0.8"){var l=Mt(e);E=l.ReadStream,A=l.WriteStream}var f=e.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=R);var p=e.WriteStream;p&&(A.prototype=Object.create(p.prototype),A.prototype.open=Z),Object.defineProperty(e,"ReadStream",{get:function(){return E},set:function(y){E=y},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return A},set:function(y){A=y},enumerable:!0,configurable:!0});var _=E;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(y){_=y},enumerable:!0,configurable:!0});var v=A;Object.defineProperty(e,"FileWriteStream",{get:function(){return v},set:function(y){v=y},enumerable:!0,configurable:!0});function E(y,S){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function R(){var y=this;he(y.path,y.flags,y.mode,function(S,m){S?(y.autoClose&&y.destroy(),y.emit("error",S)):(y.fd=m,y.emit("open",m),y.read())})}function A(y,S){return this instanceof A?(p.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function Z(){var y=this;he(y.path,y.flags,y.mode,function(S,m){S?(y.destroy(),y.emit("error",S)):(y.fd=m,y.emit("open",m))})}function Le(y,S){return new e.ReadStream(y,S)}function Ne(y,S){return new e.WriteStream(y,S)}var wt=e.open;e.open=he;function he(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return wt(F,O,b,function(x,sr){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}return e}function J(e){G("ENQUEUE",e[0].name,e[1]),k[M].push(e),we()}var ue;function qe(){for(var e=Date.now(),t=0;t<k[M].length;++t)k[M][t].length>2&&(k[M][t][3]=e,k[M][t][4]=e);we()}function we(){if(clearTimeout(ue),ue=void 0,k[M].length!==0){var e=k[M].shift(),t=e[0],r=e[1],o=e[2],n=e[3],i=e[4];if(n===void 0)G("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-n>=6e4){G("TIMEOUT",t.name,r);var a=r.pop();typeof a=="function"&&a.call(null,o)}else{var c=Date.now()-i,d=Math.max(i-n,1),h=Math.min(d*1.2,100);c>=h?(G("RETRY",t.name,r),t.apply(null,r.concat([n]))):k[M].push(e)}ue===void 0&&(ue=setTimeout(we,0))}}});var We=P((mr,Ge)=>{function C(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Ge.exports=C;C.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};C.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};C.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var o=this,n=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},r);return this._options.unref&&n.unref(),!0};C.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};C.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};C.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};C.prototype.start=C.prototype.try;C.prototype.errors=function(){return this._errors};C.prototype.attempts=function(){return this._attempts};C.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,r=0,o=0;o<this._errors.length;o++){var n=this._errors[o],i=n.message,a=(e[i]||0)+1;e[i]=a,a>=r&&(t=n,r=a)}return t}});var ze=P(W=>{var Pt=We();W.operation=function(e){var t=W.timeouts(e);return new Pt(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};W.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<t.retries;n++)o.push(this.createTimeout(n,t));return e&&e.forever&&!o.length&&o.push(this.createTimeout(n,t)),o.sort(function(i,a){return i-a}),o};W.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,o=Math.round(r*t.minTimeout*Math.pow(t.factor,e));return o=Math.min(o,t.maxTimeout),o};W.wrap=function(e,t,r){if(t instanceof Array&&(r=t,t=null),!r){r=[];for(var o in e)typeof e[o]=="function"&&r.push(o)}for(var n=0;n<r.length;n++){var i=r[n],a=e[i];e[i]=function(d){var h=W.operation(t),u=Array.prototype.slice.call(arguments,1),s=u.pop();u.push(function(l){h.retry(l)||(l&&(arguments[0]=h.mainError()),s.apply(this,arguments))}),h.attempt(function(){d.apply(e,u)})}.bind(e,a),e[i].options=t}}});var Je=P((wr,Ye)=>{Ye.exports=ze()});var Ke=P((vr,ce)=>{ce.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&ce.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ce.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ze=P((gr,H)=>{var T=global.process,z=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};z(T)?(Qe=$("assert"),K=Ke(),He=/^win/i.test(T.platform),ee=$("events"),typeof ee!="function"&&(ee=ee.EventEmitter),T.__signal_exit_emitter__?I=T.__signal_exit_emitter__:(I=T.__signal_exit_emitter__=new ee,I.count=0,I.emitted={}),I.infinite||(I.setMaxListeners(1/0),I.infinite=!0),H.exports=function(e,t){if(!z(global.process))return function(){};Qe.equal(typeof e,"function","a callback must be provided for exit handler"),Q===!1&&_e();var r="exit";t&&t.alwaysLast&&(r="afterexit");var o=function(){I.removeListener(r,e),I.listeners("exit").length===0&&I.listeners("afterexit").length===0&&fe()};return I.on(r,e),o},fe=function(){!Q||!z(global.process)||(Q=!1,K.forEach(function(t){try{T.removeListener(t,se[t])}catch{}}),T.emit=le,T.reallyExit=xe,I.count-=1)},H.exports.unload=fe,Y=function(t,r,o){I.emitted[t]||(I.emitted[t]=!0,I.emit(t,r,o))},se={},K.forEach(function(e){se[e]=function(){if(z(global.process)){var r=T.listeners(e);r.length===I.count&&(fe(),Y("exit",null,e),Y("afterexit",null,e),He&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),H.exports.signals=function(){return K},Q=!1,_e=function(){Q||!z(global.process)||(Q=!0,I.count+=1,K=K.filter(function(t){try{return T.on(t,se[t]),!0}catch{return!1}}),T.emit=Xe,T.reallyExit=Ve)},H.exports.load=_e,xe=T.reallyExit,Ve=function(t){z(global.process)&&(T.exitCode=t||0,Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),xe.call(T,T.exitCode))},le=T.emit,Xe=function(t,r){if(t==="exit"&&z(global.process)){r!==void 0&&(T.exitCode=r);var o=le.apply(this,arguments);return Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),o}else return le.apply(this,arguments)}):H.exports=function(){return function(){}};var Qe,K,He,ee,I,fe,Y,se,Q,_e,xe,Ve,le,Xe});var tt=P((_r,Te)=>{"use strict";var et=Symbol();function Ct(e,t,r){let o=t[et];if(o)return t.stat(e,(i,a)=>{if(i)return r(i);r(null,a.mtime,o)});let n=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,n,n,i=>{if(i)return r(i);t.stat(e,(a,c)=>{if(a)return r(a);let d=c.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,et,{value:d}),r(null,c.mtime,d)})})}function jt(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Te.exports.probe=Ct;Te.exports.getMtime=jt});var ut=P((xr,re)=>{"use strict";var Ut=$("path"),ke=ge(),$t=Je(),qt=Ze(),rt=tt(),U={};function te(e,t){return t.lockfilePath||`${e}.lock`}function be(e,t,r){if(!t.realpath)return r(null,Ut.resolve(e));t.fs.realpath(e,r)}function Oe(e,t,r){let o=te(e,t);t.fs.mkdir(o,n=>{if(!n)return rt.probe(o,t.fs,(i,a,c)=>{if(i)return t.fs.rmdir(o,()=>{}),r(i);r(null,a,c)});if(n.code!=="EEXIST")return r(n);if(t.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(o,(i,a)=>{if(i)return i.code==="ENOENT"?Oe(e,{...t,stale:0},r):r(i);if(!nt(a,t))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));it(e,t,c=>{if(c)return r(c);Oe(e,{...t,stale:0},r)})})})}function nt(e,t){return e.mtime.getTime()<Date.now()-t.stale}function it(e,t,r){t.fs.rmdir(te(e,t),o=>{if(o&&o.code!=="ENOENT")return r(o);r()})}function ye(e,t){let r=U[e];r.updateTimeout||(r.updateDelay=r.updateDelay||t.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,t.fs.stat(r.lockfilePath,(o,n)=>{let i=r.lastUpdate+t.stale<Date.now();if(o)return o.code==="ENOENT"||i?Ee(e,r,Object.assign(o,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,ye(e,t));if(!(r.mtime.getTime()===n.mtime.getTime()))return Ee(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let c=rt.getMtime(r.mtimePrecision);t.fs.utimes(r.lockfilePath,c,c,d=>{let h=r.lastUpdate+t.stale<Date.now();if(!r.released){if(d)return d.code==="ENOENT"||h?Ee(e,r,Object.assign(d,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,ye(e,t));r.mtime=c,r.lastUpdate=Date.now(),r.updateDelay=null,ye(e,t)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Ee(e,t,r){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),U[e]===t&&delete U[e],t.options.onCompromised(r)}function Bt(e,t,r){t={stale:1e4,update:null,realpath:!0,retries:0,fs:ke,onCompromised:o=>{throw o},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),be(e,t,(o,n)=>{if(o)return r(o);let i=$t.operation(t.retries);i.attempt(()=>{Oe(n,t,(a,c,d)=>{if(i.retry(a))return;if(a)return r(i.mainError());let h=U[n]={lockfilePath:te(n,t),mtime:c,mtimePrecision:d,options:t,lastUpdate:Date.now()};ye(n,t),r(null,u=>{if(h.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));ot(n,{...t,realpath:!1},u)})})})})}function ot(e,t,r){t={fs:ke,realpath:!0,...t},be(e,t,(o,n)=>{if(o)return r(o);let i=U[n];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete U[n],it(n,t,r)})}function Gt(e,t,r){t={stale:1e4,realpath:!0,fs:ke,...t},t.stale=Math.max(t.stale||0,2e3),be(e,t,(o,n)=>{if(o)return r(o);t.fs.stat(te(n,t),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!nt(a,t)))})}function Wt(){return U}qt(()=>{for(let e in U){let t=U[e].options;try{t.fs.rmdirSync(te(e,t))}catch{}}});re.exports.lock=Bt;re.exports.unlock=ot;re.exports.check=Gt;re.exports.getLocks=Wt});var ct=P((Tr,at)=>{"use strict";var zt=ge();function Yt(e){let t=["mkdir","realpath","stat","rmdir","utimes"],r={...e};return t.forEach(o=>{r[o]=(...n)=>{let i=n.pop(),a;try{a=e[`${o}Sync`](...n)}catch(c){return i(c)}i(null,a)}}),r}function Jt(e){return(...t)=>new Promise((r,o)=>{t.push((n,i)=>{n?o(n):r(i)}),e(...t)})}function Kt(e){return(...t)=>{let r,o;if(t.push((n,i)=>{r=n,o=i}),e(...t),r)throw r;return o}}function Qt(e){if(e={...e},e.fs=Yt(e.fs||zt),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}at.exports={toPromise:Jt,toSync:Kt,toSyncOptions:Qt}});var st=P((Er,B)=>{"use strict";var V=ut(),{toPromise:pe,toSync:de,toSyncOptions:Fe}=ct();async function ft(e,t){let r=await pe(V.lock)(e,t);return pe(r)}function Ht(e,t){let r=de(V.lock)(e,Fe(t));return de(r)}function Vt(e,t){return pe(V.unlock)(e,t)}function Xt(e,t){return de(V.unlock)(e,Fe(t))}function Zt(e,t){return pe(V.check)(e,t)}function er(e,t){return de(V.check)(e,Fe(t))}B.exports=ft;B.exports.lock=ft;B.exports.unlock=Vt;B.exports.lockSync=Ht;B.exports.unlockSync=Xt;B.exports.check=Zt;B.exports.checkSync=er});var kr=Ot(st(),1);import*as w from"fs";import*as j from"path";import{randomUUID as lt}from"crypto";import*as St from"os";var Ie="b64:";function tr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(t,"base64").toString("utf8");if(typeof atob=="function"){let o=atob(t),n=new Uint8Array(o.length);for(let i=0;i<o.length;i+=1)n[i]=o.charCodeAt(i);return new TextDecoder().decode(n)}throw new Error("No base64 decoder available in this runtime")}function rr(e){if(!e.startsWith(Ie))throw new Error(`Invalid ref format (expected ${Ie}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(tr(e.slice(Ie.length)))}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!t||typeof t!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=t;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return{kind:r.kind,value:r.value}}function yt(e,t){if(process.platform!=="win32"){w.renameSync(e,t);return}let r=[10,20,40,80,160];for(let o=0;o<=r.length;o++)try{w.renameSync(e,t);return}catch(n){let i=n.code;if((i==="EPERM"||i==="EBUSY")&&o<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[o]);continue}throw n}}function nr(e){function t(n){return j.join(e,...n.split("/"))}function r(n){return j.relative(e,n).replace(/\\/g,"/")}function o(n,i){if(w.existsSync(n))for(let a of w.readdirSync(n,{withFileTypes:!0})){let c=j.join(n,a.name);if(a.isDirectory()){o(c,i);continue}a.isFile()&&i.push(r(c))}}return{read(n){let i=t(n);if(!w.existsSync(i))return null;try{return w.readFileSync(i,"utf-8")}catch{return null}},write(n,i){let a=t(n),c=`${a}.${process.pid}.${lt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,i,"utf-8"),yt(c,a)},exists(n){return w.existsSync(t(n))},remove(n){let i=t(n);try{w.existsSync(i)&&w.unlinkSync(i)}catch{}},readBytes(n){let i=t(n);if(!w.existsSync(i))return null;try{return new Uint8Array(w.readFileSync(i))}catch{return null}},writeBytes(n,i){let a=t(n),c=`${a}.${process.pid}.${lt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,Buffer.from(i)),yt(c,a)},listKeys(n){let i=[];o(e,i);let a=i.sort();return n?a.filter(c=>c.startsWith(n)):a},stat(n){let i=t(n);if(!w.existsSync(i))return null;try{let a=w.statSync(i);return{key:n,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}}}}function pt(){return new Date().toISOString()}function dt(e){return new TextEncoder().encode(e).byteLength}function ir(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function or(e){function t(r){let o=e.stat?ir(e.stat(r)):null;if(o)return o;if(!e.exists(r))return null;let n=e.read(r);return n===null?{key:r}:{key:r,size:dt(n)}}return{exists(r){return e.exists(r)},putText(r,o,n="text/plain; charset=utf-8"){e.write(r,o);let i=t(r)??{key:r};return i.contentType=n,i.updatedAt=i.updatedAt??pt(),i.size=i.size??dt(o),i},putBytes(r,o,n="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,o);else{let a=JSON.stringify({__kind:"bytes-array",data:[...o]});e.write(r,a)}let i=t(r)??{key:r};return i.contentType=n,i.updatedAt=i.updatedAt??pt(),i.size=i.size??o.byteLength,i},getText(r){let o=e.read(r);if(o===null){if(!e.readBytes)return null;let n=e.readBytes(r);return n===null?null:Buffer.from(n).toString("utf-8")}try{let n=JSON.parse(o);if(n&&n.__kind==="bytes-array"&&Array.isArray(n.data))return new TextDecoder("utf-8").decode(new Uint8Array(n.data))}catch{}return o},getBytes(r){if(e.readBytes){let n=e.readBytes(r);if(n!==null)return n}let o=e.read(r);if(o===null)return null;try{let n=JSON.parse(o);if(n&&n.__kind==="bytes-array"&&Array.isArray(n.data))return new Uint8Array(n.data)}catch{}return new TextEncoder().encode(o)},head:t,list(r=""){return e.listKeys(r).map(o=>t(o)??{key:o}).sort((o,n)=>o.key.localeCompare(n.key))},remove(r){e.remove(r)}}}function ur(e){function t(n){return{status:"success",data:n}}function r(n){return{status:"fail",error:n}}function o(n){return{status:"error",error:n instanceof Error?n.message:String(n)}}return{list(n){try{let i=n.params?.prefix??"";return t({artifacts:e.list(i)})}catch(i){return o(i)}},head(n){try{let i=n.params?.key;return i?t({artifact:e.head(i)}):r("head requires params.key")}catch(i){return o(i)}},put(n){try{let i=n.params?.key,a=n.params?.contentType;if(!i)return r("put requires params.key");let c=n.body;if(typeof c=="string")return t({artifact:e.putText(i,c,a)});if(c&&typeof c=="object"&&typeof c.text=="string")return t({artifact:e.putText(i,c.text,a)});if(c&&typeof c=="object"&&Array.isArray(c.bytes)){let d=c.bytes,h=new Uint8Array(d.map(u=>Math.max(0,Math.min(255,Number(u)||0))));return t({artifact:e.putBytes(i,h,a)})}return r("put requires body as string, {text}, or {bytes:number[]}")}catch(i){return o(i)}},get(n){try{let i=n.params?.key,a=n.params?.as??"base64";if(!i)return r("get requires params.key");let c=e.head(i);if(!c)return r(`artifact "${i}" not found`);if(a==="text"){let h=e.getText(i);return h===null?r(`artifact "${i}" not found`):t({key:i,contentType:c.contentType,size:c.size,text:h})}let d=e.getBytes(i);return d===null?r(`artifact "${i}" not found`):t({key:i,contentType:c.contentType,size:c.size,bytes:[...d]})}catch(i){return o(i)}},del(n){try{let i=n.params?.key;return i?(e.remove(i),t({ok:!0})):r("del requires params.key")}catch(i){return o(i)}}}}function ht(...e){return j.resolve(...e)}j.join(St.tmpdir(),".board-live-cards-git-bash-cache.json");function ne(e,t,r){let o=e.indexOf(t),n=o!==-1?e[o+1]:void 0;if(!n)throw new Error(`Missing ${t}
|
|
2
|
+
var vt=Object.create;var De=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var $=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Et=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of _t(t))!Tt.call(e,n)&&n!==r&&De(e,n,{get:()=>t[n],enumerable:!(u=gt(t,n))||u.enumerable});return e};var Ot=(e,t,r)=>(r=e!=null?vt(xt(e)):{},Et(t||!e||!e.__esModule?De(r,"default",{value:e,enumerable:!0}):r,e));var Ae=P((yr,Me)=>{var q=$("constants"),kt=process.cwd,ie=null,bt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ie||(ie=kt.call(process)),ie};try{process.cwd()}catch{}typeof process.chdir=="function"&&(me=process.chdir,process.chdir=function(e){ie=null,me.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,me));var me;Me.exports=Ft;function Ft(e){q.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=i(e.chown),e.fchown=i(e.fchown),e.lchown=i(e.lchown),e.chmod=u(e.chmod),e.fchmod=u(e.fchmod),e.lchmod=u(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=c(e.stat),e.fstat=c(e.fstat),e.lstat=c(e.lstat),e.statSync=d(e.statSync),e.fstatSync=d(e.fstatSync),e.lstatSync=d(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(o,s,l){l&&process.nextTick(l)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(o,s,l,f){f&&process.nextTick(f)},e.lchownSync=function(){}),bt==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(o){function s(l,f,p){var _=Date.now(),v=0;o(l,f,function E(R){if(R&&(R.code==="EACCES"||R.code==="EPERM"||R.code==="EBUSY")&&Date.now()-_<6e4){setTimeout(function(){e.stat(f,function(A,Z){A&&A.code==="ENOENT"?o(l,f,E):p(R)})},v),v<100&&(v+=10);return}p&&p(R)})}return Object.setPrototypeOf&&Object.setPrototypeOf(s,o),s})(e.rename)),e.read=typeof e.read!="function"?e.read:(function(o){function s(l,f,p,_,v,E){var R;if(E&&typeof E=="function"){var A=0;R=function(Z,Le,Ne){if(Z&&Z.code==="EAGAIN"&&A<10)return A++,o.call(e,l,f,p,_,v,R);E.apply(this,arguments)}}return o.call(e,l,f,p,_,v,R)}return Object.setPrototypeOf&&Object.setPrototypeOf(s,o),s})(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:(function(o){return function(s,l,f,p,_){for(var v=0;;)try{return o.call(e,s,l,f,p,_)}catch(E){if(E.code==="EAGAIN"&&v<10){v++;continue}throw E}}})(e.readSync);function t(o){o.lchmod=function(s,l,f){o.open(s,q.O_WRONLY|q.O_SYMLINK,l,function(p,_){if(p){f&&f(p);return}o.fchmod(_,l,function(v){o.close(_,function(E){f&&f(v||E)})})})},o.lchmodSync=function(s,l){var f=o.openSync(s,q.O_WRONLY|q.O_SYMLINK,l),p=!0,_;try{_=o.fchmodSync(f,l),p=!1}finally{if(p)try{o.closeSync(f)}catch{}else o.closeSync(f)}return _}}function r(o){q.hasOwnProperty("O_SYMLINK")&&o.futimes?(o.lutimes=function(s,l,f,p){o.open(s,q.O_SYMLINK,function(_,v){if(_){p&&p(_);return}o.futimes(v,l,f,function(E){o.close(v,function(R){p&&p(E||R)})})})},o.lutimesSync=function(s,l,f){var p=o.openSync(s,q.O_SYMLINK),_,v=!0;try{_=o.futimesSync(p,l,f),v=!1}finally{if(v)try{o.closeSync(p)}catch{}else o.closeSync(p)}return _}):o.futimes&&(o.lutimes=function(s,l,f,p){p&&process.nextTick(p)},o.lutimesSync=function(){})}function u(o){return o&&function(s,l,f){return o.call(e,s,l,function(p){h(p)&&(p=null),f&&f.apply(this,arguments)})}}function n(o){return o&&function(s,l){try{return o.call(e,s,l)}catch(f){if(!h(f))throw f}}}function i(o){return o&&function(s,l,f,p){return o.call(e,s,l,f,function(_){h(_)&&(_=null),p&&p.apply(this,arguments)})}}function a(o){return o&&function(s,l,f){try{return o.call(e,s,l,f)}catch(p){if(!h(p))throw p}}}function c(o){return o&&function(s,l,f){typeof l=="function"&&(f=l,l=null);function p(_,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),f&&f.apply(this,arguments)}return l?o.call(e,s,l,p):o.call(e,s,p)}}function d(o){return o&&function(s,l){var f=l?o.call(e,s,l):o.call(e,s);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function h(o){if(!o||o.code==="ENOSYS")return!0;var s=!process.getuid||process.getuid()!==0;return!!(s&&(o.code==="EINVAL"||o.code==="EPERM"))}}});var Ce=P((pr,Pe)=>{var Re=$("stream").Stream;Pe.exports=It;function It(e){return{ReadStream:t,WriteStream:r};function t(u,n){if(!(this instanceof t))return new t(u,n);Re.call(this);var i=this;this.path=u,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,n=n||{};for(var a=Object.keys(n),c=0,d=a.length;c<d;c++){var h=a[c];this[h]=n[h]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}e.open(this.path,this.flags,this.mode,function(o,s){if(o){i.emit("error",o),i.readable=!1;return}i.fd=s,i.emit("open",s),i._read()})}function r(u,n){if(!(this instanceof r))return new r(u,n);Re.call(this),this.path=u,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,n=n||{};for(var i=Object.keys(n),a=0,c=i.length;a<c;a++){var d=i[a];this[d]=n[d]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Ue=P((dr,je)=>{"use strict";je.exports=Nt;var Lt=Object.getPrototypeOf||function(e){return e.__proto__};function Nt(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Lt(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var ge=P((hr,ve)=>{var k=$("fs"),Dt=Ae(),Mt=Ce(),At=Ue(),ue=$("util"),M,ae;typeof Symbol=="function"&&typeof Symbol.for=="function"?(M=Symbol.for("graceful-fs.queue"),ae=Symbol.for("graceful-fs.previous")):(M="___graceful-fs.queue",ae="___graceful-fs.previous");function Rt(){}function Be(e,t){Object.defineProperty(e,M,{get:function(){return t}})}var G=Rt;ue.debuglog?G=ue.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(G=function(){var e=ue.format.apply(ue,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
3
|
+
GFS4: `),console.error(e)});k[M]||($e=global[M]||[],Be(k,$e),k.close=(function(e){function t(r,u){return e.call(k,r,function(n){n||qe(),typeof u=="function"&&u.apply(this,arguments)})}return Object.defineProperty(t,ae,{value:e}),t})(k.close),k.closeSync=(function(e){function t(r){e.apply(k,arguments),qe()}return Object.defineProperty(t,ae,{value:e}),t})(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){G(k[M]),$("assert").equal(k[M].length,0)}));var $e;global[M]||Be(global,k[M]);ve.exports=Se(At(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(ve.exports=Se(k),k.__patched=!0);function Se(e){Dt(e),e.gracefulify=Se,e.createReadStream=Le,e.createWriteStream=Ne;var t=e.readFile;e.readFile=r;function r(y,S,m){return typeof S=="function"&&(m=S,S=null),L(y,S,m);function L(N,F,O,b){return t(N,F,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?J([L,[N,F,O],g,b||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var u=e.writeFile;e.writeFile=n;function n(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return u(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=a);function a(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return i(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var c=e.copyFile;c&&(e.copyFile=d);function d(y,S,m,L){return typeof m=="function"&&(L=m,m=0),N(y,S,m,L);function N(F,O,b,g,D){return c(F,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var h=e.readdir;e.readdir=s;var o=/^v[0-5]\./;function s(y,S,m){typeof S=="function"&&(m=S,S=null);var L=o.test(process.version)?function(O,b,g,D){return h(O,N(O,b,g,D))}:function(O,b,g,D){return h(O,b,N(O,b,g,D))};return L(y,S,m);function N(F,O,b,g){return function(D,x){D&&(D.code==="EMFILE"||D.code==="ENFILE")?J([L,[F,O,b],D,g||Date.now(),Date.now()]):(x&&x.sort&&x.sort(),typeof b=="function"&&b.call(this,D,x))}}}if(process.version.substr(0,4)==="v0.8"){var l=Mt(e);E=l.ReadStream,A=l.WriteStream}var f=e.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=R);var p=e.WriteStream;p&&(A.prototype=Object.create(p.prototype),A.prototype.open=Z),Object.defineProperty(e,"ReadStream",{get:function(){return E},set:function(y){E=y},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return A},set:function(y){A=y},enumerable:!0,configurable:!0});var _=E;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(y){_=y},enumerable:!0,configurable:!0});var v=A;Object.defineProperty(e,"FileWriteStream",{get:function(){return v},set:function(y){v=y},enumerable:!0,configurable:!0});function E(y,S){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function R(){var y=this;he(y.path,y.flags,y.mode,function(S,m){S?(y.autoClose&&y.destroy(),y.emit("error",S)):(y.fd=m,y.emit("open",m),y.read())})}function A(y,S){return this instanceof A?(p.apply(this,arguments),this):A.apply(Object.create(A.prototype),arguments)}function Z(){var y=this;he(y.path,y.flags,y.mode,function(S,m){S?(y.destroy(),y.emit("error",S)):(y.fd=m,y.emit("open",m))})}function Le(y,S){return new e.ReadStream(y,S)}function Ne(y,S){return new e.WriteStream(y,S)}var wt=e.open;e.open=he;function he(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(F,O,b,g,D){return wt(F,O,b,function(x,sr){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[F,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}return e}function J(e){G("ENQUEUE",e[0].name,e[1]),k[M].push(e),we()}var oe;function qe(){for(var e=Date.now(),t=0;t<k[M].length;++t)k[M][t].length>2&&(k[M][t][3]=e,k[M][t][4]=e);we()}function we(){if(clearTimeout(oe),oe=void 0,k[M].length!==0){var e=k[M].shift(),t=e[0],r=e[1],u=e[2],n=e[3],i=e[4];if(n===void 0)G("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-n>=6e4){G("TIMEOUT",t.name,r);var a=r.pop();typeof a=="function"&&a.call(null,u)}else{var c=Date.now()-i,d=Math.max(i-n,1),h=Math.min(d*1.2,100);c>=h?(G("RETRY",t.name,r),t.apply(null,r.concat([n]))):k[M].push(e)}oe===void 0&&(oe=setTimeout(we,0))}}});var We=P((mr,Ge)=>{function C(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Ge.exports=C;C.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};C.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};C.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var u=this,n=setTimeout(function(){u._attempts++,u._operationTimeoutCb&&(u._timeout=setTimeout(function(){u._operationTimeoutCb(u._attempts)},u._operationTimeout),u._options.unref&&u._timeout.unref()),u._fn(u._attempts)},r);return this._options.unref&&n.unref(),!0};C.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};C.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};C.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};C.prototype.start=C.prototype.try;C.prototype.errors=function(){return this._errors};C.prototype.attempts=function(){return this._attempts};C.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,r=0,u=0;u<this._errors.length;u++){var n=this._errors[u],i=n.message,a=(e[i]||0)+1;e[i]=a,a>=r&&(t=n,r=a)}return t}});var ze=P(W=>{var Pt=We();W.operation=function(e){var t=W.timeouts(e);return new Pt(t,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};W.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var u=[],n=0;n<t.retries;n++)u.push(this.createTimeout(n,t));return e&&e.forever&&!u.length&&u.push(this.createTimeout(n,t)),u.sort(function(i,a){return i-a}),u};W.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,u=Math.round(r*t.minTimeout*Math.pow(t.factor,e));return u=Math.min(u,t.maxTimeout),u};W.wrap=function(e,t,r){if(t instanceof Array&&(r=t,t=null),!r){r=[];for(var u in e)typeof e[u]=="function"&&r.push(u)}for(var n=0;n<r.length;n++){var i=r[n],a=e[i];e[i]=function(d){var h=W.operation(t),o=Array.prototype.slice.call(arguments,1),s=o.pop();o.push(function(l){h.retry(l)||(l&&(arguments[0]=h.mainError()),s.apply(this,arguments))}),h.attempt(function(){d.apply(e,o)})}.bind(e,a),e[i].options=t}}});var Je=P((wr,Ye)=>{Ye.exports=ze()});var Ke=P((vr,ce)=>{ce.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&ce.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&ce.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ze=P((gr,H)=>{var T=global.process,z=function(e){return e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function"};z(T)?(Qe=$("assert"),K=Ke(),He=/^win/i.test(T.platform),ee=$("events"),typeof ee!="function"&&(ee=ee.EventEmitter),T.__signal_exit_emitter__?I=T.__signal_exit_emitter__:(I=T.__signal_exit_emitter__=new ee,I.count=0,I.emitted={}),I.infinite||(I.setMaxListeners(1/0),I.infinite=!0),H.exports=function(e,t){if(!z(global.process))return function(){};Qe.equal(typeof e,"function","a callback must be provided for exit handler"),Q===!1&&_e();var r="exit";t&&t.alwaysLast&&(r="afterexit");var u=function(){I.removeListener(r,e),I.listeners("exit").length===0&&I.listeners("afterexit").length===0&&fe()};return I.on(r,e),u},fe=function(){!Q||!z(global.process)||(Q=!1,K.forEach(function(t){try{T.removeListener(t,se[t])}catch{}}),T.emit=le,T.reallyExit=xe,I.count-=1)},H.exports.unload=fe,Y=function(t,r,u){I.emitted[t]||(I.emitted[t]=!0,I.emit(t,r,u))},se={},K.forEach(function(e){se[e]=function(){if(z(global.process)){var r=T.listeners(e);r.length===I.count&&(fe(),Y("exit",null,e),Y("afterexit",null,e),He&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),H.exports.signals=function(){return K},Q=!1,_e=function(){Q||!z(global.process)||(Q=!0,I.count+=1,K=K.filter(function(t){try{return T.on(t,se[t]),!0}catch{return!1}}),T.emit=Xe,T.reallyExit=Ve)},H.exports.load=_e,xe=T.reallyExit,Ve=function(t){z(global.process)&&(T.exitCode=t||0,Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),xe.call(T,T.exitCode))},le=T.emit,Xe=function(t,r){if(t==="exit"&&z(global.process)){r!==void 0&&(T.exitCode=r);var u=le.apply(this,arguments);return Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),u}else return le.apply(this,arguments)}):H.exports=function(){return function(){}};var Qe,K,He,ee,I,fe,Y,se,Q,_e,xe,Ve,le,Xe});var tt=P((_r,Te)=>{"use strict";var et=Symbol();function Ct(e,t,r){let u=t[et];if(u)return t.stat(e,(i,a)=>{if(i)return r(i);r(null,a.mtime,u)});let n=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,n,n,i=>{if(i)return r(i);t.stat(e,(a,c)=>{if(a)return r(a);let d=c.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(t,et,{value:d}),r(null,c.mtime,d)})})}function jt(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}Te.exports.probe=Ct;Te.exports.getMtime=jt});var ot=P((xr,re)=>{"use strict";var Ut=$("path"),ke=ge(),$t=Je(),qt=Ze(),rt=tt(),U={};function te(e,t){return t.lockfilePath||`${e}.lock`}function be(e,t,r){if(!t.realpath)return r(null,Ut.resolve(e));t.fs.realpath(e,r)}function Oe(e,t,r){let u=te(e,t);t.fs.mkdir(u,n=>{if(!n)return rt.probe(u,t.fs,(i,a,c)=>{if(i)return t.fs.rmdir(u,()=>{}),r(i);r(null,a,c)});if(n.code!=="EEXIST")return r(n);if(t.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));t.fs.stat(u,(i,a)=>{if(i)return i.code==="ENOENT"?Oe(e,{...t,stale:0},r):r(i);if(!nt(a,t))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));it(e,t,c=>{if(c)return r(c);Oe(e,{...t,stale:0},r)})})})}function nt(e,t){return e.mtime.getTime()<Date.now()-t.stale}function it(e,t,r){t.fs.rmdir(te(e,t),u=>{if(u&&u.code!=="ENOENT")return r(u);r()})}function ye(e,t){let r=U[e];r.updateTimeout||(r.updateDelay=r.updateDelay||t.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,t.fs.stat(r.lockfilePath,(u,n)=>{let i=r.lastUpdate+t.stale<Date.now();if(u)return u.code==="ENOENT"||i?Ee(e,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,ye(e,t));if(!(r.mtime.getTime()===n.mtime.getTime()))return Ee(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let c=rt.getMtime(r.mtimePrecision);t.fs.utimes(r.lockfilePath,c,c,d=>{let h=r.lastUpdate+t.stale<Date.now();if(!r.released){if(d)return d.code==="ENOENT"||h?Ee(e,r,Object.assign(d,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,ye(e,t));r.mtime=c,r.lastUpdate=Date.now(),r.updateDelay=null,ye(e,t)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Ee(e,t,r){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),U[e]===t&&delete U[e],t.options.onCompromised(r)}function Bt(e,t,r){t={stale:1e4,update:null,realpath:!0,retries:0,fs:ke,onCompromised:u=>{throw u},...t},t.retries=t.retries||0,t.retries=typeof t.retries=="number"?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),be(e,t,(u,n)=>{if(u)return r(u);let i=$t.operation(t.retries);i.attempt(()=>{Oe(n,t,(a,c,d)=>{if(i.retry(a))return;if(a)return r(i.mainError());let h=U[n]={lockfilePath:te(n,t),mtime:c,mtimePrecision:d,options:t,lastUpdate:Date.now()};ye(n,t),r(null,o=>{if(h.released)return o&&o(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));ut(n,{...t,realpath:!1},o)})})})})}function ut(e,t,r){t={fs:ke,realpath:!0,...t},be(e,t,(u,n)=>{if(u)return r(u);let i=U[n];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete U[n],it(n,t,r)})}function Gt(e,t,r){t={stale:1e4,realpath:!0,fs:ke,...t},t.stale=Math.max(t.stale||0,2e3),be(e,t,(u,n)=>{if(u)return r(u);t.fs.stat(te(n,t),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!nt(a,t)))})}function Wt(){return U}qt(()=>{for(let e in U){let t=U[e].options;try{t.fs.rmdirSync(te(e,t))}catch{}}});re.exports.lock=Bt;re.exports.unlock=ut;re.exports.check=Gt;re.exports.getLocks=Wt});var ct=P((Tr,at)=>{"use strict";var zt=ge();function Yt(e){let t=["mkdir","realpath","stat","rmdir","utimes"],r={...e};return t.forEach(u=>{r[u]=(...n)=>{let i=n.pop(),a;try{a=e[`${u}Sync`](...n)}catch(c){return i(c)}i(null,a)}}),r}function Jt(e){return(...t)=>new Promise((r,u)=>{t.push((n,i)=>{n?u(n):r(i)}),e(...t)})}function Kt(e){return(...t)=>{let r,u;if(t.push((n,i)=>{r=n,u=i}),e(...t),r)throw r;return u}}function Qt(e){if(e={...e},e.fs=Yt(e.fs||zt),typeof e.retries=="number"&&e.retries>0||e.retries&&typeof e.retries.retries=="number"&&e.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return e}at.exports={toPromise:Jt,toSync:Kt,toSyncOptions:Qt}});var st=P((Er,B)=>{"use strict";var V=ot(),{toPromise:pe,toSync:de,toSyncOptions:Fe}=ct();async function ft(e,t){let r=await pe(V.lock)(e,t);return pe(r)}function Ht(e,t){let r=de(V.lock)(e,Fe(t));return de(r)}function Vt(e,t){return pe(V.unlock)(e,t)}function Xt(e,t){return de(V.unlock)(e,Fe(t))}function Zt(e,t){return pe(V.check)(e,t)}function er(e,t){return de(V.check)(e,Fe(t))}B.exports=ft;B.exports.lock=ft;B.exports.unlock=Vt;B.exports.lockSync=Ht;B.exports.unlockSync=Xt;B.exports.check=Zt;B.exports.checkSync=er});var kr=Ot(st(),1);import*as w from"fs";import*as j from"path";import{randomUUID as lt}from"crypto";import*as St from"os";var Ie="b64:";function tr(e){let t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(t,"base64").toString("utf8");if(typeof atob=="function"){let u=atob(t),n=new Uint8Array(u.length);for(let i=0;i<u.length;i+=1)n[i]=u.charCodeAt(i);return new TextDecoder().decode(n)}throw new Error("No base64 decoder available in this runtime")}function rr(e){if(!e.startsWith(Ie))throw new Error(`Invalid ref format (expected ${Ie}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(tr(e.slice(Ie.length)))}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!t||typeof t!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=t;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return{kind:r.kind,value:r.value}}function yt(e,t){if(process.platform!=="win32"){w.renameSync(e,t);return}let r=[10,20,40,80,160];for(let u=0;u<=r.length;u++)try{w.renameSync(e,t);return}catch(n){let i=n.code;if((i==="EPERM"||i==="EBUSY")&&u<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[u]);continue}throw n}}function nr(e){function t(n){return j.join(e,...n.split("/"))}function r(n){return j.relative(e,n).replace(/\\/g,"/")}function u(n,i){if(w.existsSync(n))for(let a of w.readdirSync(n,{withFileTypes:!0})){let c=j.join(n,a.name);if(a.isDirectory()){u(c,i);continue}a.isFile()&&i.push(r(c))}}return{read(n){let i=t(n);if(!w.existsSync(i))return null;try{return w.readFileSync(i,"utf-8")}catch{return null}},write(n,i){let a=t(n),c=`${a}.${process.pid}.${lt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,i,"utf-8"),yt(c,a)},exists(n){return w.existsSync(t(n))},remove(n){let i=t(n);try{w.existsSync(i)&&w.unlinkSync(i)}catch{}},readBytes(n){let i=t(n);if(!w.existsSync(i))return null;try{return new Uint8Array(w.readFileSync(i))}catch{return null}},writeBytes(n,i){let a=t(n),c=`${a}.${process.pid}.${lt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,Buffer.from(i)),yt(c,a)},listKeys(n){let i=[];u(e,i);let a=i.sort();return n?a.filter(c=>c.startsWith(n)):a},stat(n){let i=t(n);if(!w.existsSync(i))return null;try{let a=w.statSync(i);return{key:n,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}},keyRef(n){return{kind:"fs-path",value:t(n)}}}}function pt(){return new Date().toISOString()}function dt(e){return new TextEncoder().encode(e).byteLength}function ir(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function ur(e){function t(r){let u=e.stat?ir(e.stat(r)):null;if(u)return u;if(!e.exists(r))return null;let n=e.read(r);return n===null?{key:r}:{key:r,size:dt(n)}}return{exists(r){return e.exists(r)},putText(r,u,n="text/plain; charset=utf-8"){e.write(r,u);let i=t(r)??{key:r};return i.contentType=n,i.updatedAt=i.updatedAt??pt(),i.size=i.size??dt(u),i},putBytes(r,u,n="application/octet-stream"){if(e.writeBytes)e.writeBytes(r,u);else{let a=JSON.stringify({__kind:"bytes-array",data:[...u]});e.write(r,a)}let i=t(r)??{key:r};return i.contentType=n,i.updatedAt=i.updatedAt??pt(),i.size=i.size??u.byteLength,i},getText(r){let u=e.read(r);if(u===null){if(!e.readBytes)return null;let n=e.readBytes(r);return n===null?null:Buffer.from(n).toString("utf-8")}try{let n=JSON.parse(u);if(n&&n.__kind==="bytes-array"&&Array.isArray(n.data))return new TextDecoder("utf-8").decode(new Uint8Array(n.data))}catch{}return u},getBytes(r){if(e.readBytes){let n=e.readBytes(r);if(n!==null)return n}let u=e.read(r);if(u===null)return null;try{let n=JSON.parse(u);if(n&&n.__kind==="bytes-array"&&Array.isArray(n.data))return new Uint8Array(n.data)}catch{}return new TextEncoder().encode(u)},head:t,list(r=""){return e.listKeys(r).map(u=>t(u)??{key:u}).sort((u,n)=>u.key.localeCompare(n.key))},remove(r){e.remove(r)}}}function or(e){function t(n){return{status:"success",data:n}}function r(n){return{status:"fail",error:n}}function u(n){return{status:"error",error:n instanceof Error?n.message:String(n)}}return{list(n){try{let i=n.params?.prefix??"";return t({artifacts:e.list(i)})}catch(i){return u(i)}},head(n){try{let i=n.params?.key;return i?t({artifact:e.head(i)}):r("head requires params.key")}catch(i){return u(i)}},put(n){try{let i=n.params?.key,a=n.params?.contentType;if(!i)return r("put requires params.key");let c=n.body;if(typeof c=="string")return t({artifact:e.putText(i,c,a)});if(c&&typeof c=="object"&&typeof c.text=="string")return t({artifact:e.putText(i,c.text,a)});if(c&&typeof c=="object"&&Array.isArray(c.bytes)){let d=c.bytes,h=new Uint8Array(d.map(o=>Math.max(0,Math.min(255,Number(o)||0))));return t({artifact:e.putBytes(i,h,a)})}return r("put requires body as string, {text}, or {bytes:number[]}")}catch(i){return u(i)}},get(n){try{let i=n.params?.key,a=n.params?.as??"base64";if(!i)return r("get requires params.key");let c=e.head(i);if(!c)return r(`artifact "${i}" not found`);if(a==="text"){let h=e.getText(i);return h===null?r(`artifact "${i}" not found`):t({key:i,contentType:c.contentType,size:c.size,text:h})}let d=e.getBytes(i);return d===null?r(`artifact "${i}" not found`):t({key:i,contentType:c.contentType,size:c.size,bytes:[...d]})}catch(i){return u(i)}},del(n){try{let i=n.params?.key;return i?(e.remove(i),t({ok:!0})):r("del requires params.key")}catch(i){return u(i)}}}}function ht(...e){return j.resolve(...e)}j.join(St.tmpdir(),".board-live-cards-git-bash-cache.json");function ne(e,t,r){let u=e.indexOf(t),n=u!==-1?e[u+1]:void 0;if(!n)throw new Error(`Missing ${t}
|
|
4
4
|
Usage: ${r}`);return n}function X(e,t){let r=e.indexOf(t);return r!==-1?e[r+1]:void 0}async function ar(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(t));return new Uint8Array(Buffer.concat(e))}var mt=["artifacts-store \u2014 generic artifact CRUD on a blob-backed store",""," artifacts-store put --store-ref <ref> --key <key> [--file <path> | --text <text>] [--content-type <mime>]"," artifacts-store get --store-ref <ref> --key <key> [--out <path>] [--as text|bytes]"," artifacts-store head --store-ref <ref> --key <key>"," artifacts-store list --store-ref <ref> [--prefix <prefix>]"," artifacts-store del --store-ref <ref> --key <key>"].join(`
|
|
5
|
-
`);async function cr(e){let t=e[0],r=e.slice(1);if(!t||t==="help"||t==="--help"||t==="-h"){console.error(mt);return}let
|
|
6
|
-
`);return}if(t==="get"){let a=ne(r,"--key","artifacts-store get --store-ref <ref> --key <key>"),c=(X(r,"--as")||"bytes").toLowerCase(),d=X(r,"--out"),h=i.get({params:{key:a,as:c}});if(h.status!=="success")throw new Error(h.error||"get failed");if(c==="text"){let s=h.data.text??"";d?w.writeFileSync(d,s,"utf-8"):process.stdout.write(s);return}let
|
|
5
|
+
`);async function cr(e){let t=e[0],r=e.slice(1);if(!t||t==="help"||t==="--help"||t==="-h"){console.error(mt);return}let u=ne(r,"--store-ref",`artifacts-store ${t} --store-ref <b64-ref>`),n=rr(u).value,i=or(ur(nr(n)));if(t==="put"){let a=ne(r,"--key","artifacts-store put --store-ref <ref> --key <key>"),c=X(r,"--content-type"),d=X(r,"--file"),h=X(r,"--text"),o;if(d)o={bytes:[...new Uint8Array(w.readFileSync(d))]};else if(typeof h=="string")o={text:h};else if(!process.stdin.isTTY)o={bytes:[...await ar()]};else throw new Error("put requires --file, --text, or stdin bytes");let s=i.put({params:{key:a,...c?{contentType:c}:{}},body:o});if(s.status!=="success")throw new Error(s.error||"put failed");process.stdout.write(JSON.stringify(s.data,null,2)+`
|
|
6
|
+
`);return}if(t==="get"){let a=ne(r,"--key","artifacts-store get --store-ref <ref> --key <key>"),c=(X(r,"--as")||"bytes").toLowerCase(),d=X(r,"--out"),h=i.get({params:{key:a,as:c}});if(h.status!=="success")throw new Error(h.error||"get failed");if(c==="text"){let s=h.data.text??"";d?w.writeFileSync(d,s,"utf-8"):process.stdout.write(s);return}let o=new Uint8Array(h.data.bytes??[]);d?w.writeFileSync(d,Buffer.from(o)):process.stdout.write(JSON.stringify({...h.data,bytes:void 0,byteLength:o.byteLength},null,2)+`
|
|
7
7
|
`);return}if(t==="head"){let a=ne(r,"--key","artifacts-store head --store-ref <ref> --key <key>"),c=i.head({params:{key:a}});if(c.status!=="success")throw new Error(c.error||"head failed");process.stdout.write(JSON.stringify(c.data,null,2)+`
|
|
8
8
|
`);return}if(t==="list"){let a=X(r,"--prefix")||"",c=i.list({params:a?{prefix:a}:{}});if(c.status!=="success")throw new Error(c.error||"list failed");process.stdout.write(JSON.stringify(c.data,null,2)+`
|
|
9
9
|
`);return}if(t==="del"||t==="delete"||t==="rm"){let a=ne(r,"--key","artifacts-store del --store-ref <ref> --key <key>"),c=i.del({params:{key:a}});if(c.status!=="success")throw new Error(c.error||"del failed");process.stdout.write(JSON.stringify(c.data,null,2)+`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire}from"module";const require=createRequire(import.meta.url);
|
|
3
|
-
import*as u from"fs";import*as i from"path";import{fileURLToPath as S}from"url";import*as w from"os";function m(...r){return i.resolve(...r)}i.join(w.tmpdir(),".board-live-cards-git-bash-cache.json");var f=i.dirname(S(import.meta.url)),v=i.join(f,"..","..","lib","index.js"),x=i.join(f,"..","..","lib","step-machine-public","index.js"),E=i.join(f,"..","..","lib","batch","index.js"),A=i.join(f,"execution-adapter.js"),{loadStepFlow:O,createStepMachine:J,MemoryStore:M}=await import(p(v).href),{buildStepHandlersForFlow:N}=await import(p(x).href),{batch:R}=await import(p(E).href),{invokeRefSync:$}=await import(p(A).href);function p(r){let t=i.resolve(r).replace(/\\/g,"/");return new URL(`file:///${t.startsWith("/")?t.slice(1):t}`)}async function F(r){let t=T(r);(t.help||r.length===0)&&(k(),process.exit(r.length===0?1:0));let{flowArg:
|
|
3
|
+
import*as u from"fs";import*as i from"path";import{fileURLToPath as S}from"url";import*as w from"os";function m(...r){return i.resolve(...r)}i.join(w.tmpdir(),".board-live-cards-git-bash-cache.json");var f=i.dirname(S(import.meta.url)),v=i.join(f,"..","..","lib","index.js"),x=i.join(f,"..","..","lib","step-machine-public","index.js"),E=i.join(f,"..","..","lib","batch","index.js"),A=i.join(f,"execution-adapter.js"),{loadStepFlow:O,createStepMachine:J,MemoryStore:M}=await import(p(v).href),{buildStepHandlersForFlow:N}=await import(p(x).href),{batch:R}=await import(p(E).href),{invokeRefSync:$}=await import(p(A).href);function p(r){let t=i.resolve(r).replace(/\\/g,"/");return new URL(`file:///${t.startsWith("/")?t.slice(1):t}`)}async function F(r){let t=T(r);(t.help||r.length===0)&&(k(),process.exit(r.length===0?1:0));let{flowArg:s,itemsArg:n,concurrency:e}=t;if(!s)throw new Error("[batch-runner-cli] Flow path is required.");if(!n)throw new Error("[batch-runner-cli] --items <json-file-or-inline> is required.");let c=d(s),a=i.dirname(c),y=U(n),h=await O(c),l=await R(y,{concurrency:e,processor:async(o,L)=>{let b=N(h,{invoke:(g,j)=>$(W(g),j,{cliDir:a,cwd:a})});return J(h,b,{store:new M}).run(o)},onProgress:o=>{process.stderr.write(`\r[batch] ${o.completed+o.failed}/${o.total} (${o.percent}%) \u2014 ${o.active} active`)}});process.stderr.write("\r"+" ".repeat(80)+"\r"),console.log(JSON.stringify({completed:l.completed,failed:l.failed,total:l.total,durationMs:l.durationMs,items:l.items.map(o=>({index:o.index,status:o.status,durationMs:o.durationMs,...o.status==="completed"?{intent:o.result?.intent,data:o.result?.data}:{error:o.error?.message}}))},null,2)),l.failed>0&&process.exit(1)}function T(r){let t={},s=[],n=!1;for(let e=0;e<r.length;e++){let c=r[e];if(c==="-h"||c==="--help"){n=!0;continue}if(c==="--items"){let a=r[e+1];if(!a||a.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --items.");t["--items"]=a,e++;continue}if(c==="--concurrency"){let a=r[e+1];if(!a||a.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --concurrency.");t["--concurrency"]=a,e++;continue}if(c.startsWith("--"))throw new Error(`[batch-runner-cli] Unknown flag: ${c}`);s.push(c)}return{help:n,flowArg:s[0],itemsArg:t["--items"],concurrency:t["--concurrency"]?parseInt(t["--concurrency"],10):5}}function d(r){return i.isAbsolute(r)?r:i.resolve(process.cwd(),r)}function U(r){let t=d(r),s;u.existsSync(t)?s=u.readFileSync(t,"utf-8"):s=r;let n;try{n=JSON.parse(s)}catch(e){let c=e instanceof Error?e.message:String(e);throw new Error(`[batch-runner-cli] Failed to parse items JSON: ${c}`)}if(!Array.isArray(n))throw new Error("[batch-runner-cli] Items must be a JSON array of objects.");for(let e=0;e<n.length;e++)if(!n[e]||typeof n[e]!="object"||Array.isArray(n[e]))throw new Error(`[batch-runner-cli] Item at index ${e} is not a JSON object.`);return n}function W(r){if(!r||typeof r!="object"||typeof r.whatToRun!="string"||!r.whatToRun.startsWith("b64:"))return r;try{let t=r.whatToRun.slice(4),s=t+"=".repeat((4-t.length%4)%4),n=Buffer.from(s.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),e=JSON.parse(n);return!e||typeof e!="object"||typeof e.value!="string"?r:{...r,whatToRun:e}}catch{return r}}function k(){console.error("Usage: batch-runner-cli <step-flow.yaml> --items <items.json> [--concurrency <n>]"),console.error(""),console.error("Run a step-machine flow for each item in a JSON array, with concurrency control."),console.error(""),console.error("Options:"),console.error(" --items <path|json> JSON file or inline JSON array of input objects"),console.error(" --concurrency <n> Max concurrent flows (default: 5)"),console.error(" -h, --help Show this help"),console.error(""),console.error("Example:"),console.error(" batch-runner-cli flow.yaml --items items.json --concurrency 3"),console.error(` batch-runner-cli flow.yaml --items '[{"a":1,"b":2},{"a":3,"b":4}]'`)}var I=process.argv[1]&&m(process.argv[1])===m(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));I&&F(process.argv.slice(2)).catch(r=>{let t=r instanceof Error?r.stack??r.message:String(r);console.error(t),process.exit(1)});export{F as cli};
|