yaml-flow 8.4.21 → 8.4.22
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 +7 -7
- 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 +9 -9
- package/cli/bundled/board-live-cards-cli.mjs +19 -19
- package/cli/{execution-interface-_BN4kSuA.d.ts → execution-interface-BCIhu1gO.d.ts} +1 -7
- package/cli/{types-CaQhDvWD.d.ts → types-juH2nFpz.d.ts} +1 -8
- 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-DuatIrVb.d.cts → artifacts-store-lib-CVgtQrNZ.d.cts} +1 -1
- package/lib/{artifacts-store-lib-CODxnrXD.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 +10 -10
- 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 +10 -10
- package/lib/{board-live-cards-public-DTuWGcCs.d.cts → board-live-cards-public-B4RcYPC_.d.cts} +1 -8
- package/lib/{board-live-cards-public-KyDR96Rf.d.ts → board-live-cards-public-ydXuA4zh.d.ts} +1 -8
- 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-DxyFlJVt.d.cts → chat-storage-lib-B1wU27y3.d.cts} +1 -1
- package/lib/{chat-storage-lib-DFUsokwy.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-D4Ny0Men.d.cts → storage-interface-B2WD9D5n.d.cts} +1 -7
- package/lib/{storage-interface-D4Ny0Men.d.ts → storage-interface-B2WD9D5n.d.ts} +1 -7
- 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-Bep-vtP0.d.ts → types-1L1D33mr.d.ts} +4 -4
- package/lib/{types-DbvoDam4.d.cts → types-D501gMQt.d.cts} +4 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-
|
|
2
|
-
import { E as ExecutionRef } from '../execution-interface-
|
|
1
|
+
import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-juH2nFpz.js';
|
|
2
|
+
import { E as ExecutionRef } from '../execution-interface-BCIhu1gO.js';
|
|
3
3
|
import '../board-live-cards-lib-COi4bSpk.js';
|
|
4
4
|
|
|
5
5
|
declare function createLocalStorageChatStorage(namespace: string): ChatStorage;
|
|
@@ -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
|
|
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
|
|
3
|
-
${new Date().toISOString()}`);}catch{}function
|
|
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
|
|
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,12 +1,12 @@
|
|
|
1
1
|
import{createRequire}from"module";const require=createRequire(import.meta.url);
|
|
2
|
-
var Et=Object.create;var Ce=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,It=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 Ft=(e,t,r,
|
|
3
|
-
GFS4: `),console.error(e)});k[D]||(ze=global[D]||[],Je(k,ze),k.close=(function(e){function t(r,o){return e.call(k,r,function(n){n||Ye(),typeof o=="function"&&o.apply(this,arguments)})}return Object.defineProperty(t,se,{value:e}),t})(k.close),k.closeSync=(function(e){function t(r){e.apply(k,arguments),Ye()}return Object.defineProperty(t,se,{value:e}),t})(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){G(k[D]),$("assert").equal(k[D].length,0)}));var ze;global[D]||Je(global,k[D]);Te.exports=_e(Ut(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(Te.exports=_e(k),k.__patched=!0);function _e(e){Ct(e),e.gracefulify=_e,e.createReadStream=Ae,e.createWriteStream=Pe;var t=e.readFile;e.readFile=r;function r(y,v,m){return typeof v=="function"&&(m=v,v=null),N(y,v,m);function N(R,I,O,b){return t(R,I,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?K([N,[R,I,O],g,b||Date.now(),Date.now()]):typeof O=="function"&&O.apply(this,arguments)})}}var o=e.writeFile;e.writeFile=n;function n(y,v,m,N){return typeof m=="function"&&(N=m,m=null),R(y,v,m,N);function R(I,O,b,g,L){return o(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?K([R,[I,O,b,g],x,L||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var i=e.appendFile;i&&(e.appendFile=a);function a(y,v,m,N){return typeof m=="function"&&(N=m,m=null),R(y,v,m,N);function R(I,O,b,g,L){return i(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?K([R,[I,O,b,g],x,L||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}var c=e.copyFile;c&&(e.copyFile=d);function d(y,v,m,N){return typeof m=="function"&&(N=m,m=0),R(y,v,m,N);function R(I,O,b,g,L){return c(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?K([R,[I,O,b,g],x,L||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,v,m){typeof v=="function"&&(m=v,v=null);var N=u.test(process.version)?function(O,b,g,L){return h(O,R(O,b,g,L))}:function(O,b,g,L){return h(O,b,R(O,b,g,L))};return N(y,v,m);function R(I,O,b,g){return function(L,x){L&&(L.code==="EMFILE"||L.code==="ENFILE")?K([N,[I,O,b],L,g||Date.now(),Date.now()]):(x&&x.sort&&x.sort(),typeof b=="function"&&b.call(this,L,x))}}}if(process.version.substr(0,4)==="v0.8"){var l=jt(e);E=l.ReadStream,M=l.WriteStream}var f=e.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=A);var p=e.WriteStream;p&&(M.prototype=Object.create(p.prototype),M.prototype.open=ee),Object.defineProperty(e,"ReadStream",{get:function(){return E},set:function(y){E=y},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return M},set:function(y){M=y},enumerable:!0,configurable:!0});var _=E;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(y){_=y},enumerable:!0,configurable:!0});var S=M;Object.defineProperty(e,"FileWriteStream",{get:function(){return S},set:function(y){S=y},enumerable:!0,configurable:!0});function E(y,v){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function A(){var y=this;Se(y.path,y.flags,y.mode,function(v,m){v?(y.autoClose&&y.destroy(),y.emit("error",v)):(y.fd=m,y.emit("open",m),y.read())})}function M(y,v){return this instanceof M?(p.apply(this,arguments),this):M.apply(Object.create(M.prototype),arguments)}function ee(){var y=this;Se(y.path,y.flags,y.mode,function(v,m){v?(y.destroy(),y.emit("error",v)):(y.fd=m,y.emit("open",m))})}function Ae(y,v){return new e.ReadStream(y,v)}function Pe(y,v){return new e.WriteStream(y,v)}var Tt=e.open;e.open=Se;function Se(y,v,m,N){return typeof m=="function"&&(N=m,m=null),R(y,v,m,N);function R(I,O,b,g,L){return Tt(I,O,b,function(x,yr){x&&(x.code==="EMFILE"||x.code==="ENFILE")?K([R,[I,O,b,g],x,L||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}return e}function K(e){G("ENQUEUE",e[0].name,e[1]),k[D].push(e),xe()}var fe;function Ye(){for(var e=Date.now(),t=0;t<k[D].length;++t)k[D][t].length>2&&(k[D][t][3]=e,k[D][t][4]=e);xe()}function xe(){if(clearTimeout(fe),fe=void 0,k[D].length!==0){var e=k[D].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[D].push(e)}fe===void 0&&(fe=setTimeout(xe,0))}}});var Qe=P((wr,Ke)=>{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))}Ke.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 He=P(W=>{var qt=Qe();W.operation=function(e){var t=W.timeouts(e);return new qt(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 Xe=P((gr,Ve)=>{Ve.exports=He()});var Ze=P((_r,le)=>{le.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&le.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&le.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var it=P((xr,V)=>{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)?(et=$("assert"),Q=Ze(),tt=/^win/i.test(T.platform),te=$("events"),typeof te!="function"&&(te=te.EventEmitter),T.__signal_exit_emitter__?F=T.__signal_exit_emitter__:(F=T.__signal_exit_emitter__=new te,F.count=0,F.emitted={}),F.infinite||(F.setMaxListeners(1/0),F.infinite=!0),V.exports=function(e,t){if(!z(global.process))return function(){};et.equal(typeof e,"function","a callback must be provided for exit handler"),H===!1&&Oe();var r="exit";t&&t.alwaysLast&&(r="afterexit");var o=function(){F.removeListener(r,e),F.listeners("exit").length===0&&F.listeners("afterexit").length===0&&ye()};return F.on(r,e),o},ye=function(){!H||!z(global.process)||(H=!1,Q.forEach(function(t){try{T.removeListener(t,pe[t])}catch{}}),T.emit=de,T.reallyExit=ke,F.count-=1)},V.exports.unload=ye,Y=function(t,r,o){F.emitted[t]||(F.emitted[t]=!0,F.emit(t,r,o))},pe={},Q.forEach(function(e){pe[e]=function(){if(z(global.process)){var r=T.listeners(e);r.length===F.count&&(ye(),Y("exit",null,e),Y("afterexit",null,e),tt&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),V.exports.signals=function(){return Q},H=!1,Oe=function(){H||!z(global.process)||(H=!0,F.count+=1,Q=Q.filter(function(t){try{return T.on(t,pe[t]),!0}catch{return!1}}),T.emit=nt,T.reallyExit=rt)},V.exports.load=Oe,ke=T.reallyExit,rt=function(t){z(global.process)&&(T.exitCode=t||0,Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),ke.call(T,T.exitCode))},de=T.emit,nt=function(t,r){if(t==="exit"&&z(global.process)){r!==void 0&&(T.exitCode=r);var o=de.apply(this,arguments);return Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),o}else return de.apply(this,arguments)}):V.exports=function(){return function(){}};var et,Q,tt,te,F,ye,Y,pe,H,Oe,ke,rt,de,nt});var ut=P((Tr,be)=>{"use strict";var ot=Symbol();function Bt(e,t,r){let o=t[ot];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,ot,{value:d}),r(null,c.mtime,d)})})}function Gt(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}be.exports.probe=Bt;be.exports.getMtime=Gt});var lt=P((Er,ne)=>{"use strict";var Wt=$("path"),Ne=Ee(),zt=Xe(),Yt=it(),at=ut(),U={};function re(e,t){return t.lockfilePath||`${e}.lock`}function Re(e,t,r){if(!t.realpath)return r(null,Wt.resolve(e));t.fs.realpath(e,r)}function Fe(e,t,r){let o=re(e,t);t.fs.mkdir(o,n=>{if(!n)return at.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"?Fe(e,{...t,stale:0},r):r(i);if(!ct(a,t))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));ft(e,t,c=>{if(c)return r(c);Fe(e,{...t,stale:0},r)})})})}function ct(e,t){return e.mtime.getTime()<Date.now()-t.stale}function ft(e,t,r){t.fs.rmdir(re(e,t),o=>{if(o&&o.code!=="ENOENT")return r(o);r()})}function he(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?Ie(e,r,Object.assign(o,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,he(e,t));if(!(r.mtime.getTime()===n.mtime.getTime()))return Ie(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let c=at.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?Ie(e,r,Object.assign(d,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,he(e,t));r.mtime=c,r.lastUpdate=Date.now(),r.updateDelay=null,he(e,t)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Ie(e,t,r){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),U[e]===t&&delete U[e],t.options.onCompromised(r)}function Jt(e,t,r){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Ne,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),Re(e,t,(o,n)=>{if(o)return r(o);let i=zt.operation(t.retries);i.attempt(()=>{Fe(n,t,(a,c,d)=>{if(i.retry(a))return;if(a)return r(i.mainError());let h=U[n]={lockfilePath:re(n,t),mtime:c,mtimePrecision:d,options:t,lastUpdate:Date.now()};he(n,t),r(null,u=>{if(h.released)return u&&u(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));st(n,{...t,realpath:!1},u)})})})})}function st(e,t,r){t={fs:Ne,realpath:!0,...t},Re(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],ft(n,t,r)})}function Kt(e,t,r){t={stale:1e4,realpath:!0,fs:Ne,...t},t.stale=Math.max(t.stale||0,2e3),Re(e,t,(o,n)=>{if(o)return r(o);t.fs.stat(re(n,t),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!ct(a,t)))})}function Qt(){return U}Yt(()=>{for(let e in U){let t=U[e].options;try{t.fs.rmdirSync(re(e,t))}catch{}}});ne.exports.lock=Jt;ne.exports.unlock=st;ne.exports.check=Kt;ne.exports.getLocks=Qt});var pt=P((Or,yt)=>{"use strict";var Ht=Ee();function Vt(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 Xt(e){return(...t)=>new Promise((r,o)=>{t.push((n,i)=>{n?o(n):r(i)}),e(...t)})}function Zt(e){return(...t)=>{let r,o;if(t.push((n,i)=>{r=n,o=i}),e(...t),r)throw r;return o}}function er(e){if(e={...e},e.fs=Vt(e.fs||Ht),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}yt.exports={toPromise:Xt,toSync:Zt,toSyncOptions:er}});var ht=P((kr,B)=>{"use strict";var X=lt(),{toPromise:me,toSync:ve,toSyncOptions:Le}=pt();async function dt(e,t){let r=await me(X.lock)(e,t);return me(r)}function tr(e,t){let r=ve(X.lock)(e,Le(t));return ve(r)}function rr(e,t){return me(X.unlock)(e,t)}function nr(e,t){return ve(X.unlock)(e,Le(t))}function ir(e,t){return me(X.check)(e,t)}function or(e,t){return ve(X.check)(e,Le(t))}B.exports=dt;B.exports.lock=dt;B.exports.unlock=rr;B.exports.lockSync=tr;B.exports.unlockSync=nr;B.exports.check=ir;B.exports.checkSync=or});var Ir=Nt(ht(),1);import*as w from"fs";import*as j from"path";import{randomUUID as mt}from"crypto";import*as xt from"os";var De="b64:";function ur(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 Z(e){if(!e.startsWith(De))throw new Error(`Invalid ref format (expected ${De}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(ur(e.slice(De.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 ar(e){let t=Z(e);if(t.kind!=="artifacts-store-entry")throw new Error(`Invalid artifact entry ref kind: ${t.kind}`);let r;try{r=JSON.parse(t.value)}catch{throw new Error(`Invalid artifact entry ref payload: ${e}`)}if(!r||typeof r!="object")throw new Error(`Invalid artifact entry ref payload: ${e}`);let o=r;if(typeof o.storeRef!="string"||typeof o.key!="string")throw new Error(`Invalid artifact entry ref payload: ${e}`);return{storeRef:o.storeRef,key:o.key}}function vt(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 ie(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}.${mt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,i,"utf-8"),vt(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}.${mt()}.tmp`;w.mkdirSync(j.dirname(a),{recursive:!0}),w.writeFileSync(c,Buffer.from(i)),vt(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}},keyRef(n){return{kind:"fs-path",value:t(n)}}}}function wt(){return new Date().toISOString()}function St(e){return new TextEncoder().encode(e).byteLength}function cr(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function oe(e){function t(r){let o=e.stat?cr(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:St(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??wt(),i.size=i.size??St(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??wt(),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 ue(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 gt(...e){return j.resolve(...e)}j.join(xt.tmpdir(),".board-live-cards-git-bash-cache.json");function Me(e,t,r){let o=e.indexOf(t),n=o!==-1?e[o+1]:void 0;if(!n)throw new Error(`Missing ${t}
|
|
4
|
-
Usage: ${r}`);return n}function
|
|
5
|
-
`);async function
|
|
6
|
-
`);return}if(t==="get"){let{storeRef:
|
|
7
|
-
`);return}if(t==="head"){let{storeRef:
|
|
8
|
-
`);return}if(t==="list"){let
|
|
9
|
-
`);return}if(t==="del"||t==="delete"||t==="rm"){let{storeRef:
|
|
2
|
+
var Et=Object.create;var Ce=Object.defineProperty;var Ot=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,It=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 Ft=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of kt(t))!It.call(e,n)&&n!==r&&Ce(e,n,{get:()=>t[n],enumerable:!(u=Ot(t,n))||u.enumerable});return e};var Lt=(e,t,r)=>(r=e!=null?Et(bt(e)):{},Ft(t||!e||!e.__esModule?Ce(r,"default",{value:e,enumerable:!0}):r,e));var je=P((pr,Ue)=>{var q=$("constants"),Nt=process.cwd,ae=null,Dt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return ae||(ae=Nt.call(process)),ae};try{process.cwd()}catch{}typeof process.chdir=="function"&&(ge=process.chdir,process.chdir=function(e){ae=null,ge.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,ge));var ge;Ue.exports=Rt;function Rt(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(){}),Dt==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:(function(o){function s(l,f,p){var _=Date.now(),w=0;o(l,f,function E(M){if(M&&(M.code==="EACCES"||M.code==="EPERM"||M.code==="EBUSY")&&Date.now()-_<6e4){setTimeout(function(){e.stat(f,function(A,Z){A&&A.code==="ENOENT"?o(l,f,E):p(M)})},w),w<100&&(w+=10);return}p&&p(M)})}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,_,w,E){var M;if(E&&typeof E=="function"){var A=0;M=function(Z,Me,Pe){if(Z&&Z.code==="EAGAIN"&&A<10)return A++,o.call(e,l,f,p,_,w,M);E.apply(this,arguments)}}return o.call(e,l,f,p,_,w,M)}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 w=0;;)try{return o.call(e,s,l,f,p,_)}catch(E){if(E.code==="EAGAIN"&&w<10){w++;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(w){o.close(_,function(E){f&&f(w||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(_,w){if(_){p&&p(_);return}o.futimes(w,l,f,function(E){o.close(w,function(M){p&&p(E||M)})})})},o.lutimesSync=function(s,l,f){var p=o.openSync(s,q.O_SYMLINK),_,w=!0;try{_=o.futimesSync(p,l,f),w=!1}finally{if(w)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(_,w){w&&(w.uid<0&&(w.uid+=4294967296),w.gid<0&&(w.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 Ge=P((dr,qe)=>{var $e=$("stream").Stream;qe.exports=At;function At(e){return{ReadStream:t,WriteStream:r};function t(u,n){if(!(this instanceof t))return new t(u,n);$e.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);$e.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 We=P((hr,Be)=>{"use strict";Be.exports=Pt;var Mt=Object.getPrototypeOf||function(e){return e.__proto__};function Pt(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:Mt(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var Ee=P((mr,Te)=>{var k=$("fs"),Ct=je(),Ut=Ge(),jt=We(),ce=$("util"),R,se;typeof Symbol=="function"&&typeof Symbol.for=="function"?(R=Symbol.for("graceful-fs.queue"),se=Symbol.for("graceful-fs.previous")):(R="___graceful-fs.queue",se="___graceful-fs.previous");function $t(){}function Je(e,t){Object.defineProperty(e,R,{get:function(){return t}})}var B=$t;ce.debuglog?B=ce.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(B=function(){var e=ce.format.apply(ce,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
3
|
+
GFS4: `),console.error(e)});k[R]||(ze=global[R]||[],Je(k,ze),k.close=(function(e){function t(r,u){return e.call(k,r,function(n){n||Ye(),typeof u=="function"&&u.apply(this,arguments)})}return Object.defineProperty(t,se,{value:e}),t})(k.close),k.closeSync=(function(e){function t(r){e.apply(k,arguments),Ye()}return Object.defineProperty(t,se,{value:e}),t})(k.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){B(k[R]),$("assert").equal(k[R].length,0)}));var ze;global[R]||Je(global,k[R]);Te.exports=_e(jt(k));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!k.__patched&&(Te.exports=_e(k),k.__patched=!0);function _e(e){Ct(e),e.gracefulify=_e,e.createReadStream=Me,e.createWriteStream=Pe;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,I,O,b){return t(N,I,function(g){g&&(g.code==="EMFILE"||g.code==="ENFILE")?J([L,[N,I,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(I,O,b,g,D){return u(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[I,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(I,O,b,g,D){return i(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[I,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(I,O,b,g,D){return c(I,O,b,function(x){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[I,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(I,O,b,g){return function(D,x){D&&(D.code==="EMFILE"||D.code==="ENFILE")?J([L,[I,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=Ut(e);E=l.ReadStream,A=l.WriteStream}var f=e.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=M);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 w=A;Object.defineProperty(e,"FileWriteStream",{get:function(){return w},set:function(y){w=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 M(){var y=this;we(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;we(y.path,y.flags,y.mode,function(S,m){S?(y.destroy(),y.emit("error",S)):(y.fd=m,y.emit("open",m))})}function Me(y,S){return new e.ReadStream(y,S)}function Pe(y,S){return new e.WriteStream(y,S)}var Tt=e.open;e.open=we;function we(y,S,m,L){return typeof m=="function"&&(L=m,m=null),N(y,S,m,L);function N(I,O,b,g,D){return Tt(I,O,b,function(x,lr){x&&(x.code==="EMFILE"||x.code==="ENFILE")?J([N,[I,O,b,g],x,D||Date.now(),Date.now()]):typeof g=="function"&&g.apply(this,arguments)})}}return e}function J(e){B("ENQUEUE",e[0].name,e[1]),k[R].push(e),xe()}var fe;function Ye(){for(var e=Date.now(),t=0;t<k[R].length;++t)k[R][t].length>2&&(k[R][t][3]=e,k[R][t][4]=e);xe()}function xe(){if(clearTimeout(fe),fe=void 0,k[R].length!==0){var e=k[R].shift(),t=e[0],r=e[1],u=e[2],n=e[3],i=e[4];if(n===void 0)B("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-n>=6e4){B("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?(B("RETRY",t.name,r),t.apply(null,r.concat([n]))):k[R].push(e)}fe===void 0&&(fe=setTimeout(xe,0))}}});var Qe=P((Sr,Ke)=>{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))}Ke.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 He=P(W=>{var qt=Qe();W.operation=function(e){var t=W.timeouts(e);return new qt(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 Xe=P((wr,Ve)=>{Ve.exports=He()});var Ze=P((gr,le)=>{le.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&le.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&le.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var it=P((_r,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)?(et=$("assert"),K=Ze(),tt=/^win/i.test(T.platform),ee=$("events"),typeof ee!="function"&&(ee=ee.EventEmitter),T.__signal_exit_emitter__?F=T.__signal_exit_emitter__:(F=T.__signal_exit_emitter__=new ee,F.count=0,F.emitted={}),F.infinite||(F.setMaxListeners(1/0),F.infinite=!0),H.exports=function(e,t){if(!z(global.process))return function(){};et.equal(typeof e,"function","a callback must be provided for exit handler"),Q===!1&&Oe();var r="exit";t&&t.alwaysLast&&(r="afterexit");var u=function(){F.removeListener(r,e),F.listeners("exit").length===0&&F.listeners("afterexit").length===0&&ye()};return F.on(r,e),u},ye=function(){!Q||!z(global.process)||(Q=!1,K.forEach(function(t){try{T.removeListener(t,pe[t])}catch{}}),T.emit=de,T.reallyExit=ke,F.count-=1)},H.exports.unload=ye,Y=function(t,r,u){F.emitted[t]||(F.emitted[t]=!0,F.emit(t,r,u))},pe={},K.forEach(function(e){pe[e]=function(){if(z(global.process)){var r=T.listeners(e);r.length===F.count&&(ye(),Y("exit",null,e),Y("afterexit",null,e),tt&&e==="SIGHUP"&&(e="SIGINT"),T.kill(T.pid,e))}}}),H.exports.signals=function(){return K},Q=!1,Oe=function(){Q||!z(global.process)||(Q=!0,F.count+=1,K=K.filter(function(t){try{return T.on(t,pe[t]),!0}catch{return!1}}),T.emit=nt,T.reallyExit=rt)},H.exports.load=Oe,ke=T.reallyExit,rt=function(t){z(global.process)&&(T.exitCode=t||0,Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),ke.call(T,T.exitCode))},de=T.emit,nt=function(t,r){if(t==="exit"&&z(global.process)){r!==void 0&&(T.exitCode=r);var u=de.apply(this,arguments);return Y("exit",T.exitCode,null),Y("afterexit",T.exitCode,null),u}else return de.apply(this,arguments)}):H.exports=function(){return function(){}};var et,K,tt,ee,F,ye,Y,pe,Q,Oe,ke,rt,de,nt});var ot=P((xr,be)=>{"use strict";var ut=Symbol();function Gt(e,t,r){let u=t[ut];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,ut,{value:d}),r(null,c.mtime,d)})})}function Bt(e){let t=Date.now();return e==="s"&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}be.exports.probe=Gt;be.exports.getMtime=Bt});var lt=P((Tr,re)=>{"use strict";var Wt=$("path"),Le=Ee(),zt=Xe(),Yt=it(),at=ot(),j={};function te(e,t){return t.lockfilePath||`${e}.lock`}function Ne(e,t,r){if(!t.realpath)return r(null,Wt.resolve(e));t.fs.realpath(e,r)}function Fe(e,t,r){let u=te(e,t);t.fs.mkdir(u,n=>{if(!n)return at.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"?Fe(e,{...t,stale:0},r):r(i);if(!ct(a,t))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:e}));ft(e,t,c=>{if(c)return r(c);Fe(e,{...t,stale:0},r)})})})}function ct(e,t){return e.mtime.getTime()<Date.now()-t.stale}function ft(e,t,r){t.fs.rmdir(te(e,t),u=>{if(u&&u.code!=="ENOENT")return r(u);r()})}function he(e,t){let r=j[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?Ie(e,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,he(e,t));if(!(r.mtime.getTime()===n.mtime.getTime()))return Ie(e,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let c=at.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?Ie(e,r,Object.assign(d,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,he(e,t));r.mtime=c,r.lastUpdate=Date.now(),r.updateDelay=null,he(e,t)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Ie(e,t,r){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),j[e]===t&&delete j[e],t.options.onCompromised(r)}function Jt(e,t,r){t={stale:1e4,update:null,realpath:!0,retries:0,fs:Le,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),Ne(e,t,(u,n)=>{if(u)return r(u);let i=zt.operation(t.retries);i.attempt(()=>{Fe(n,t,(a,c,d)=>{if(i.retry(a))return;if(a)return r(i.mainError());let h=j[n]={lockfilePath:te(n,t),mtime:c,mtimePrecision:d,options:t,lastUpdate:Date.now()};he(n,t),r(null,o=>{if(h.released)return o&&o(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));st(n,{...t,realpath:!1},o)})})})})}function st(e,t,r){t={fs:Le,realpath:!0,...t},Ne(e,t,(u,n)=>{if(u)return r(u);let i=j[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 j[n],ft(n,t,r)})}function Kt(e,t,r){t={stale:1e4,realpath:!0,fs:Le,...t},t.stale=Math.max(t.stale||0,2e3),Ne(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,!ct(a,t)))})}function Qt(){return j}Yt(()=>{for(let e in j){let t=j[e].options;try{t.fs.rmdirSync(te(e,t))}catch{}}});re.exports.lock=Jt;re.exports.unlock=st;re.exports.check=Kt;re.exports.getLocks=Qt});var pt=P((Er,yt)=>{"use strict";var Ht=Ee();function Vt(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 Xt(e){return(...t)=>new Promise((r,u)=>{t.push((n,i)=>{n?u(n):r(i)}),e(...t)})}function Zt(e){return(...t)=>{let r,u;if(t.push((n,i)=>{r=n,u=i}),e(...t),r)throw r;return u}}function er(e){if(e={...e},e.fs=Vt(e.fs||Ht),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}yt.exports={toPromise:Xt,toSync:Zt,toSyncOptions:er}});var ht=P((Or,G)=>{"use strict";var V=lt(),{toPromise:me,toSync:Se,toSyncOptions:De}=pt();async function dt(e,t){let r=await me(V.lock)(e,t);return me(r)}function tr(e,t){let r=Se(V.lock)(e,De(t));return Se(r)}function rr(e,t){return me(V.unlock)(e,t)}function nr(e,t){return Se(V.unlock)(e,De(t))}function ir(e,t){return me(V.check)(e,t)}function ur(e,t){return Se(V.check)(e,De(t))}G.exports=dt;G.exports.lock=dt;G.exports.unlock=rr;G.exports.lockSync=tr;G.exports.unlockSync=nr;G.exports.check=ir;G.exports.checkSync=ur});var br=Lt(ht(),1);import*as v from"fs";import*as U from"path";import{randomUUID as mt}from"crypto";import*as xt from"os";var Re="b64:";function or(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 ne(e){if(!e.startsWith(Re))throw new Error(`Invalid ref format (expected ${Re}<base64url(json)>): ${e}`);let t;try{t=JSON.parse(or(e.slice(Re.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 St(e,t){if(process.platform!=="win32"){v.renameSync(e,t);return}let r=[10,20,40,80,160];for(let u=0;u<=r.length;u++)try{v.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 ie(e){function t(n){return U.join(e,...n.split("/"))}function r(n){return U.relative(e,n).replace(/\\/g,"/")}function u(n,i){if(v.existsSync(n))for(let a of v.readdirSync(n,{withFileTypes:!0})){let c=U.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(!v.existsSync(i))return null;try{return v.readFileSync(i,"utf-8")}catch{return null}},write(n,i){let a=t(n),c=`${a}.${process.pid}.${mt()}.tmp`;v.mkdirSync(U.dirname(a),{recursive:!0}),v.writeFileSync(c,i,"utf-8"),St(c,a)},exists(n){return v.existsSync(t(n))},remove(n){let i=t(n);try{v.existsSync(i)&&v.unlinkSync(i)}catch{}},readBytes(n){let i=t(n);if(!v.existsSync(i))return null;try{return new Uint8Array(v.readFileSync(i))}catch{return null}},writeBytes(n,i){let a=t(n),c=`${a}.${process.pid}.${mt()}.tmp`;v.mkdirSync(U.dirname(a),{recursive:!0}),v.writeFileSync(c,Buffer.from(i)),St(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(!v.existsSync(i))return null;try{let a=v.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 vt(){return new Date().toISOString()}function wt(e){return new TextEncoder().encode(e).byteLength}function ar(e){return e?{key:e.key,size:e.size,updatedAt:e.updatedAt,contentType:e.contentType}:null}function ue(e){function t(r){let u=e.stat?ar(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:wt(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??vt(),i.size=i.size??wt(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??vt(),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 oe(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 gt(...e){return U.resolve(...e)}U.join(xt.tmpdir(),".board-live-cards-git-bash-cache.json");function Ae(e,t,r){let u=e.indexOf(t),n=u!==-1?e[u+1]:void 0;if(!n)throw new Error(`Missing ${t}
|
|
4
|
+
Usage: ${r}`);return n}function X(e,t){let r=e.indexOf(t);return r!==-1?e[r+1]:void 0}function ve(e,t){return{storeRef:Ae(e,"--store-ref",t),key:Ae(e,"--key",t)}}async function cr(){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 _t=["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 fr(e){let t=e[0],r=e.slice(1);if(!t||t==="help"||t==="--help"||t==="-h"){console.error(_t);return}if(t==="put"){let{storeRef:u,key:n}=ve(r,"artifacts-store put --store-ref <ref> --key <key>"),i=ne(u).value,a=oe(ue(ie(i))),c=X(r,"--content-type"),d=X(r,"--file"),h=X(r,"--text"),o;if(d)o={bytes:[...new Uint8Array(v.readFileSync(d))]};else if(typeof h=="string")o={text:h};else if(!process.stdin.isTTY)o={bytes:[...await cr()]};else throw new Error("put requires --file, --text, or stdin bytes");let s=a.put({params:{key:n,...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{storeRef:u,key:n}=ve(r,"artifacts-store get --store-ref <ref> --key <key>"),i=ne(u).value,a=oe(ue(ie(i))),c=(X(r,"--as")||"bytes").toLowerCase(),d=X(r,"--out"),h=a.get({params:{key:n,as:c}});if(h.status!=="success")throw new Error(h.error||"get failed");if(c==="text"){let s=h.data.text??"";d?v.writeFileSync(d,s,"utf-8"):process.stdout.write(s);return}let o=new Uint8Array(h.data.bytes??[]);d?v.writeFileSync(d,Buffer.from(o)):process.stdout.write(JSON.stringify({...h.data,bytes:void 0,byteLength:o.byteLength},null,2)+`
|
|
7
|
+
`);return}if(t==="head"){let{storeRef:u,key:n}=ve(r,"artifacts-store head --store-ref <ref> --key <key>"),i=ne(u).value,a=oe(ue(ie(i))).head({params:{key:n}});if(a.status!=="success")throw new Error(a.error||"head failed");process.stdout.write(JSON.stringify(a.data,null,2)+`
|
|
8
|
+
`);return}if(t==="list"){let u=Ae(r,"--store-ref","artifacts-store list --store-ref <ref> [--prefix <prefix>]"),n=ne(u).value,i=oe(ue(ie(n))),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
|
+
`);return}if(t==="del"||t==="delete"||t==="rm"){let{storeRef:u,key:n}=ve(r,"artifacts-store del --store-ref <ref> --key <key>"),i=ne(u).value,a=oe(ue(ie(i))).del({params:{key:n}});if(a.status!=="success")throw new Error(a.error||"del failed");process.stdout.write(JSON.stringify(a.data,null,2)+`
|
|
10
10
|
`);return}throw new Error(`Unknown command "${t}"
|
|
11
11
|
|
|
12
|
-
${_t}`)}var
|
|
12
|
+
${_t}`)}var sr=process.argv[1]&>(process.argv[1])===gt(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));sr&&fr(process.argv.slice(2)).catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(t),process.exit(1)});export{fr as cli};
|