@enfyra/kernel 1.1.31 → 1.1.33

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.
@@ -1,4 +1,4 @@
1
- "use strict";var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var B=D((Fe,K)=>{"use strict";var{fork:ce}=require("child_process"),le=require("path");function ue({workerDir:e,activeTaskContexts:t}){let s=new Map,r=new Map,a=new Map,o=null,c=0;function g(f){return Math.max(1,Math.trunc(Number(f)||3e4))}function u(f){for(let n of r.values())clearTimeout(n.timer),n.reject(f);r.clear()}function y(f){let n=typeof f=="string"?JSON.parse(f):f;if(n?.error)throw new Error(n.error);return n?.value}async function P(f){let n=t.get(f.taskId);if(!n)throw new Error(`Package callback context not found: ${f.taskId}`);let i=JSON.stringify(f.callbackId),d=JSON.stringify(f.argsJson||"[]"),_=await n.evalClosure(`return __invokeRuntimeCallback(${i}, ${d});`,[],{arguments:{copy:!0},result:{promise:!0,copy:!0}});return y(_)}function h(){if(o&&o.connected)return o;let f=le.join(e,"package-runtime.child.js"),n=ce(f,[],{stdio:["ignore","ignore","ignore","ipc"]});return o=n,n.on("message",i=>{if(!i||!i.id)return;if(i.type==="pkgStreamChunk"){let _=a.get(i.id);if(!_)return;_.onChunk(Buffer.from(i.chunk||"","base64")).then(()=>{try{n.send({type:"pkgStreamAck",ackId:i.ackId})}catch{}}).catch(v=>{try{n.send({type:"pkgStreamError",ackId:i.ackId,error:{message:v.message,stack:v.stack}})}catch{}});return}if(i.type==="pkgCallbackCall"){P(i).then(_=>{try{n.send({type:"pkgCallbackResult",id:i.id,value:_})}catch{}}).catch(_=>{try{n.send({type:"pkgCallbackError",id:i.id,error:{message:_.message,stack:_.stack}})}catch{}});return}let d=r.get(i.id);if(d)if(clearTimeout(d.timer),r.delete(i.id),a.delete(i.id),i.ok)d.resolve(i.value);else{let _=new Error(i.error?.message||"Package runtime call failed");_.stack=i.error?.stack||_.stack,d.reject(_)}}),n.on("exit",(i,d)=>{o===n&&(o=null),u(new Error(`Package runtime exited${d?` with signal ${d}`:` with code ${i}`}`))}),n.on("error",i=>{o===n&&(o=null),u(i)}),n}function l(f){return new Promise((n,i)=>{let d=h(),_=`pkg_${++c}`,v=g(f.timeoutMs),S=setTimeout(()=>{r.delete(_),a.delete(_);try{d.kill()}catch{}i(new Error(`Package runtime call timed out after ${v}ms`))},v);r.set(_,{resolve:n,reject:i,timer:S});try{d.send({...f,id:_},x=>{x&&(clearTimeout(S),r.delete(_),i(x))})}catch(x){clearTimeout(S),r.delete(_),i(x)}})}function m(f,n,i,d=[],_=3e4){return new Promise((v,S)=>{let x=h(),b=`pkg_${++c}`,F=g(_),H=setTimeout(()=>{r.delete(b),a.delete(b);try{x.kill()}catch{}S(new Error(`Package runtime stream timed out after ${F}ms`))},F);r.set(b,{resolve:v,reject:S,timer:H}),a.set(b,{onChunk:i});try{x.send({op:"streamHandle",taskId:f,handleId:n,path:d,id:b},U=>{U&&(clearTimeout(H),r.delete(b),a.delete(b),S(U))})}catch(U){clearTimeout(H),r.delete(b),a.delete(b),S(U)}})}function w(f){try{if(!o||!o.connected)return;o.send({...f,id:`pkg_${++c}`,fire:!0})}catch{}}async function k(f,n){let i=s.get(f);if(!i)throw new Error("Package context is not available");if(n.handleId)return l({op:n.kind==="get"?"handleGet":"handleCall",taskId:f,handleId:n.handleId,path:n.path||[],argsJson:n.argsJson||"[]",timeoutMs:n.timeoutMs});let d=i.get(n.packageName);if(!d)throw new Error(`Package "${n.packageName}" is not available`);return l({op:n.kind==="construct"?"construct":"call",taskId:f,packageName:n.packageName,package:{name:d.name,fileUrl:d.fileUrl},path:n.path||[],argsJson:n.argsJson||"[]",timeoutMs:n.timeoutMs})}function N(f,n){s.set(f,n)}function T(f){s.delete(f),w({op:"releaseTask",taskId:f})}function p(){if(o){try{o.kill()}catch{}o=null}}return{cleanupTaskPackages:T,executePackageRuntimeCall:k,setTaskPackages:N,streamPackageHandle:m,shutdownPackageRuntime:p}}K.exports={createPackageRuntimeBridge:ue}});var V=D((Ue,q)=>{"use strict";var fe=`
1
+ "use strict";var D=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var B=D((Fe,K)=>{"use strict";var{fork:ce}=require("child_process"),le=require("path");function ue({workerDir:e,activeTaskContexts:t}){let s=new Map,r=new Map,a=new Map,o=null,c=0;function g(f){return Math.max(1,Math.trunc(Number(f)||3e4))}function u(f){for(let n of r.values())clearTimeout(n.timer),n.reject(f);r.clear()}function y(f){let n=typeof f=="string"?JSON.parse(f):f;if(n?.error)throw new Error(n.error);return n?.value}async function P(f){let n=t.get(f.taskId);if(!n)throw new Error(`Package callback context not found: ${f.taskId}`);let i=JSON.stringify(f.callbackId),d=JSON.stringify(f.argsJson||"[]"),_=await n.evalClosure(`return __invokeRuntimeCallback(${i}, ${d});`,[],{arguments:{copy:!0},result:{promise:!0,copy:!0}});return y(_)}function h(){if(o&&o.connected)return o;let f=le.join(e,"package-runtime.child.js"),n=ce(f,[],{stdio:["ignore","ignore","ignore","ipc"],env:{PATH:process.env.PATH||"",HOME:process.env.HOME||"",NODE_ENV:process.env.NODE_ENV||"production",TMPDIR:process.env.TMPDIR||"",LANG:process.env.LANG||""}});return o=n,n.on("message",i=>{if(!i||!i.id)return;if(i.type==="pkgStreamChunk"){let _=a.get(i.id);if(!_)return;_.onChunk(Buffer.from(i.chunk||"","base64")).then(()=>{try{n.send({type:"pkgStreamAck",ackId:i.ackId})}catch{}}).catch(v=>{try{n.send({type:"pkgStreamError",ackId:i.ackId,error:{message:v.message,stack:v.stack}})}catch{}});return}if(i.type==="pkgCallbackCall"){P(i).then(_=>{try{n.send({type:"pkgCallbackResult",id:i.id,value:_})}catch{}}).catch(_=>{try{n.send({type:"pkgCallbackError",id:i.id,error:{message:_.message,stack:_.stack}})}catch{}});return}let d=r.get(i.id);if(d)if(clearTimeout(d.timer),r.delete(i.id),a.delete(i.id),i.ok)d.resolve(i.value);else{let _=new Error(i.error?.message||"Package runtime call failed");_.stack=i.error?.stack||_.stack,d.reject(_)}}),n.on("exit",(i,d)=>{o===n&&(o=null),u(new Error(`Package runtime exited${d?` with signal ${d}`:` with code ${i}`}`))}),n.on("error",i=>{o===n&&(o=null),u(i)}),n}function l(f){return new Promise((n,i)=>{let d=h(),_=`pkg_${++c}`,v=g(f.timeoutMs),S=setTimeout(()=>{r.delete(_),a.delete(_);try{d.kill()}catch{}i(new Error(`Package runtime call timed out after ${v}ms`))},v);r.set(_,{resolve:n,reject:i,timer:S});try{d.send({...f,id:_},x=>{x&&(clearTimeout(S),r.delete(_),i(x))})}catch(x){clearTimeout(S),r.delete(_),i(x)}})}function m(f,n,i,d=[],_=3e4){return new Promise((v,S)=>{let x=h(),b=`pkg_${++c}`,F=g(_),U=setTimeout(()=>{r.delete(b),a.delete(b);try{x.kill()}catch{}S(new Error(`Package runtime stream timed out after ${F}ms`))},F);r.set(b,{resolve:v,reject:S,timer:U}),a.set(b,{onChunk:i});try{x.send({op:"streamHandle",taskId:f,handleId:n,path:d,id:b},H=>{H&&(clearTimeout(U),r.delete(b),a.delete(b),S(H))})}catch(H){clearTimeout(U),r.delete(b),a.delete(b),S(H)}})}function w(f){try{if(!o||!o.connected)return;o.send({...f,id:`pkg_${++c}`,fire:!0})}catch{}}async function k(f,n){let i=s.get(f);if(!i)throw new Error("Package context is not available");if(n.handleId)return l({op:n.kind==="get"?"handleGet":"handleCall",taskId:f,handleId:n.handleId,path:n.path||[],argsJson:n.argsJson||"[]",timeoutMs:n.timeoutMs});let d=i.get(n.packageName);if(!d)throw new Error(`Package "${n.packageName}" is not available`);return l({op:n.kind==="construct"?"construct":"call",taskId:f,packageName:n.packageName,package:{name:d.name,fileUrl:d.fileUrl},path:n.path||[],argsJson:n.argsJson||"[]",timeoutMs:n.timeoutMs})}function N(f,n){s.set(f,n)}function T(f){s.delete(f),w({op:"releaseTask",taskId:f})}function p(){if(o){try{o.kill()}catch{}o=null}}return{cleanupTaskPackages:T,executePackageRuntimeCall:k,setTaskPackages:N,streamPackageHandle:m,shutdownPackageRuntime:p}}K.exports={createPackageRuntimeBridge:ue}});var V=D((He,q)=>{"use strict";var fe=`
2
2
  "use strict";
3
3
  let $ctx = {};
4
4
  let $pkgs = {};
package/dist/index.d.ts CHANGED
@@ -319,6 +319,7 @@ export const getEffectiveMemoryBytes: any;
319
319
  export const getExecutableScript: any;
320
320
  export const getForeignKeyColumnName: any;
321
321
  export const getIoAbortSignal: any;
322
+ export const runWithIoAbortSignal: any;
322
323
  export const getJunctionColumnNames: any;
323
324
  export const getJunctionTableName: any;
324
325
  export const getShortFkConstraintName: any;