@selvajs/compute 1.5.2-beta.0 → 1.5.2-beta.2

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.
Files changed (60) hide show
  1. package/README.md +12 -8
  2. package/dist/chunk-5465MDT4.cjs +2 -0
  3. package/dist/chunk-5465MDT4.cjs.map +1 -0
  4. package/dist/chunk-6VF4VVLW.cjs +2 -0
  5. package/dist/chunk-6VF4VVLW.cjs.map +1 -0
  6. package/dist/chunk-DADFXYBV.js +2 -0
  7. package/dist/chunk-DADFXYBV.js.map +1 -0
  8. package/dist/chunk-MZGKJZVP.cjs +2 -0
  9. package/dist/chunk-MZGKJZVP.cjs.map +1 -0
  10. package/dist/chunk-RHULSS7S.js +3 -0
  11. package/dist/chunk-RHULSS7S.js.map +1 -0
  12. package/dist/chunk-RILJ3IA7.js +2 -0
  13. package/dist/chunk-RILJ3IA7.js.map +1 -0
  14. package/dist/chunk-VWOEUM7C.cjs +3 -0
  15. package/dist/chunk-VWOEUM7C.cjs.map +1 -0
  16. package/dist/chunk-XLHA5YPH.js +2 -0
  17. package/dist/chunk-XLHA5YPH.js.map +1 -0
  18. package/dist/core.cjs +1 -1
  19. package/dist/core.d.cts +3 -21
  20. package/dist/core.d.ts +3 -21
  21. package/dist/core.js +1 -1
  22. package/dist/errors-CiA83qw2.d.cts +510 -0
  23. package/dist/errors-CiA83qw2.d.ts +510 -0
  24. package/dist/grasshopper.cjs +1 -1
  25. package/dist/grasshopper.d.cts +75 -142
  26. package/dist/grasshopper.d.ts +75 -142
  27. package/dist/grasshopper.js +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.cts +3 -5
  30. package/dist/index.d.ts +3 -5
  31. package/dist/index.js +1 -1
  32. package/dist/visualization-7TK4UEZL.js +2 -0
  33. package/dist/visualization-7TK4UEZL.js.map +1 -0
  34. package/dist/visualization-JYNKROSH.cjs +2 -0
  35. package/dist/visualization-JYNKROSH.cjs.map +1 -0
  36. package/dist/visualization.cjs +1 -1
  37. package/dist/visualization.cjs.map +1 -1
  38. package/dist/visualization.d.cts +1 -76
  39. package/dist/visualization.d.ts +1 -76
  40. package/dist/visualization.js +1 -1
  41. package/dist/visualization.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/base-dtik4Dlu.d.cts +0 -138
  44. package/dist/base-dtik4Dlu.d.ts +0 -138
  45. package/dist/chunk-2NFN5ERT.cjs +0 -2
  46. package/dist/chunk-2NFN5ERT.cjs.map +0 -1
  47. package/dist/chunk-BKGFHI2J.js +0 -2
  48. package/dist/chunk-BKGFHI2J.js.map +0 -1
  49. package/dist/chunk-CZCPL35F.js +0 -3
  50. package/dist/chunk-CZCPL35F.js.map +0 -1
  51. package/dist/chunk-JSS6OQML.cjs +0 -2
  52. package/dist/chunk-JSS6OQML.cjs.map +0 -1
  53. package/dist/chunk-XULONXVP.cjs +0 -3
  54. package/dist/chunk-XULONXVP.cjs.map +0 -1
  55. package/dist/chunk-XZUTU46G.js +0 -2
  56. package/dist/chunk-XZUTU46G.js.map +0 -1
  57. package/dist/schemas-Ct7lU-IH.d.cts +0 -247
  58. package/dist/schemas-Ct7lU-IH.d.ts +0 -247
  59. package/dist/types-B24K2LG4.d.cts +0 -85
  60. package/dist/types-B24K2LG4.d.ts +0 -85
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var T=Object.defineProperty;var $=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var V=(t,e)=>{for(var r in e)T(t,r,{get:e[r],enumerable:!0})};var g=(t,e,r)=>$(t,typeof e!="symbol"?e+"":e,r);var u={NETWORK_ERROR:"NETWORK_ERROR",AUTH_ERROR:"AUTH_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",COMPUTATION_ERROR:"COMPUTATION_ERROR",TIMEOUT_ERROR:"TIMEOUT_ERROR",CORS_ERROR:"CORS_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR",INVALID_STATE:"INVALID_STATE",INVALID_INPUT:"INVALID_INPUT",INVALID_CONFIG:"INVALID_CONFIG",BROWSER_ONLY:"BROWSER_ONLY",ENVIRONMENT_ERROR:"ENVIRONMENT_ERROR",ENCODING_ERROR:"ENCODING_ERROR",SUPERSEDED:"SUPERSEDED",ABORTED:"ABORTED"},d= exports.d =class t extends Error{constructor(r,n="UNKNOWN_ERROR",o){super(r);g(this,"code");g(this,"statusCode");g(this,"context");g(this,"originalError");this.name="RhinoComputeError",this.code=n,this.statusCode=_optionalChain([o, 'optionalAccess', _2 => _2.statusCode]),this.context=_optionalChain([o, 'optionalAccess', _3 => _3.context]),this.originalError=_optionalChain([o, 'optionalAccess', _4 => _4.originalError]),_optionalChain([o, 'optionalAccess', _5 => _5.originalError])&&(this.cause=o.originalError)}static missingValues(r,n,o){return new t(`Input "${r}" has no values defined${n?` (expected ${n})`:""}`,u.INVALID_INPUT,{context:{inputName:r,expectedType:n,...o}})}static unknownParamType(r,n,o){return new t(`Unknown paramType: ${r}`,u.VALIDATION_ERROR,{context:{receivedParamType:r,paramName:n,...o}})}};var E=class{debug(){}info(){}warn(){}error(){}},w=class{debug(e,...r){console.debug(e,...r)}info(e,...r){console.info(e,...r)}warn(e,...r){console.warn(e,...r)}error(e,...r){console.error(e,...r)}},N=new E;function p(){return N}function C(t){N=t===null?new E:t}function _(){C(new w)}var y={attempts:0,baseDelayMs:500,maxDelayMs:3e4,retryOn429:!0},A=new Set([502,503,504]);function M(t){return t?{attempts:_nullishCoalesce(t.attempts, () => (y.attempts)),baseDelayMs:_nullishCoalesce(t.baseDelayMs, () => (y.baseDelayMs)),maxDelayMs:_nullishCoalesce(t.maxDelayMs, () => (y.maxDelayMs)),retryOn429:_nullishCoalesce(t.retryOn429, () => (y.retryOn429))}:y}function k(t){if(!t)return null;let e=Number(t);if(Number.isFinite(e)&&e>=0)return e*1e3;let r=Date.parse(t);if(Number.isFinite(r)){let n=r-Date.now();return n>0?n:0}return null}function b(t,e){let r=e.baseDelayMs*Math.pow(2,t),n=Math.random()*e.baseDelayMs;return Math.min(r+n,e.maxDelayMs)}function D(t,e){return new Promise((r,n)=>{if(_optionalChain([e, 'optionalAccess', _6 => _6.aborted])){n(new DOMException("Aborted","AbortError"));return}let o=setTimeout(()=>{_optionalChain([e, 'optionalAccess', _7 => _7.removeEventListener, 'call', _8 => _8("abort",l)]),r()},t),l=()=>{clearTimeout(o),n(new DOMException("Aborted","AbortError"))};_optionalChain([e, 'optionalAccess', _9 => _9.addEventListener, 'call', _10 => _10("abort",l,{once:!0})])})}function x(t,e,r,n,o,l){let{status:c,statusText:s}=t,a={url:e,requestId:r,method:"POST",requestSize:n,serverUrl:o},i=l?` \u2014 ${l.slice(0,200)}`:"",m={401:{message:`HTTP ${c}: ${s}${i}`,code:u.AUTH_ERROR},403:{message:`HTTP ${c}: ${s}${i}`,code:u.AUTH_ERROR},404:{message:`Endpoint not found: ${e}`,code:u.NETWORK_ERROR},413:{message:`Request too large: ${(n/1024).toFixed(2)}KB`,code:u.VALIDATION_ERROR},429:{message:"Rate limit exceeded",code:u.NETWORK_ERROR},500:{message:`Server error: ${l||s}`,code:u.COMPUTATION_ERROR},502:{message:`Service unavailable: ${s}`,code:u.NETWORK_ERROR},503:{message:`Service unavailable: ${s}`,code:u.NETWORK_ERROR},504:{message:`Service unavailable: ${s}`,code:u.NETWORK_ERROR}}[c]||{message:`HTTP ${c}: ${s}`,code:u.UNKNOWN_ERROR};throw new d(m.message,m.code,{statusCode:c,context:a})}function L(t,e){let r=e.replace(/\/+$/,""),n=t.replace(/^\/+/,"");return`${r}/${n}`}function U(t){try{let e=new URL(t).host;return/^(localhost|127\.0\.0\.1|::1)(:\d+)?$/i.test(e)}catch (e2){return/(localhost|127\.0\.0\.1)/i.test(t)}}function q(t,e){let r={"X-Request-ID":t,"Content-Type":"application/json",...e.authToken&&{Authorization:e.authToken},...e.apiKey&&{RhinoComputeKey:e.apiKey}};return!e.apiKey&&!U(e.serverUrl)&&p().warn(`\u26A0\uFE0F [Rhino Compute] Request [${t}] targets remote server (${e.serverUrl}) but no API key is configured. Requests may fail or be rate-limited.`),r}function K(){return`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function R(t,e){e&&p().debug(t)}function P(t,e){let r=[],n=()=>{};if(t&&r.push(t),e&&e>0)if(typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function")r.push(AbortSignal.timeout(e));else{let s=new AbortController,a=setTimeout(()=>s.abort(),e);n=()=>clearTimeout(a),r.push(s.signal)}if(r.length===0)return{signal:void 0,cleanup:n};if(r.length===1)return{signal:r[0],cleanup:n};if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return{signal:AbortSignal.any(r),cleanup:n};let o=new AbortController,l=()=>o.abort();for(let s of r){if(s.aborted){o.abort();break}s.addEventListener("abort",l,{once:!0})}let c=n;return n=()=>{c();for(let s of r)s.removeEventListener("abort",l)},{signal:o.signal,cleanup:n}}async function F(t,e,r,n,o,l,c){let s=Math.round(performance.now()-l);if(!t.ok){let a=await t.text();if(c&&(R(`\u274C Request [${r}] failed with HTTP ${t.status} in ${s}ms`,!0),R(` URL: ${e}`,!0),R(` Status: ${t.status} ${t.statusText}`,!0),a&&R(` Response body: ${a.substring(0,500)}${a.length>500?"...":""}`,!0)),t.status===500)try{let i=JSON.parse(a);if(_optionalChain([i, 'optionalAccess', _11 => _11.values])&&(i.errors||i.warnings))return c&&(R(`\u26A0\uFE0F Request [${r}] completed with Grasshopper errors in ${s}ms`,!0),_optionalChain([i, 'access', _12 => _12.errors, 'optionalAccess', _13 => _13.length])>0&&R(` Errors: ${JSON.stringify(i.errors,null,2)}`,!0),_optionalChain([i, 'access', _14 => _14.warnings, 'optionalAccess', _15 => _15.length])>0&&R(` Warnings: ${JSON.stringify(i.warnings,null,2)}`,!0)),i;_optionalChain([i, 'optionalAccess', _16 => _16.Message])?a=`${i.ExceptionType?i.ExceptionType+": ":""}${i.Message}
2
+ ${i.StackTrace||""}`:_optionalChain([i, 'optionalAccess', _17 => _17.error])&&(a=typeof i.error=="string"?i.error:JSON.stringify(i.error,null,2))}catch(i){c&&R(` Failed to parse error body as JSON: ${i}`,!0)}x(t,e,r,n,o,a)}R(`\u2705 Request [${r}] completed in ${s}ms`,c);try{return await t.json()}catch(a){throw new d("Failed to parse JSON response",u.NETWORK_ERROR,{statusCode:t.status,context:{url:e,requestId:r},originalError:a instanceof Error?a:new Error(String(a))})}}async function H(t,e,r,n){let{signal:o,cleanup:l}=P(t.config.signal,t.config.timeoutMs),c=performance.now();try{let s=await fetch(t.fullUrl,{method:"POST",body:t.body,headers:t.headers,signal:o});if((A.has(s.status)||e.retryOn429&&s.status===429)&&r<n-1){let m=_nullishCoalesce(k(s.headers.get("Retry-After")), () => (b(r,e)));return await s.text().catch(()=>{}),{ok:!1,retry:!0,delayMs:m,cause:new d(`HTTP ${s.status} ${s.statusText} (will retry)`,u.NETWORK_ERROR,{statusCode:s.status,context:{requestId:t.requestId}})}}return{ok:!0,value:await F(s,t.fullUrl,t.requestId,t.requestSize,t.config.serverUrl,c,t.config.debug)}}catch(s){if(s instanceof Error&&(s.name==="AbortError"||s.name==="TimeoutError")){if(_optionalChain([t, 'access', _18 => _18.config, 'access', _19 => _19.signal, 'optionalAccess', _20 => _20.aborted])===!0)return{ok:!1,retry:!1,cause:new d("Request aborted by caller",u.UNKNOWN_ERROR,{context:{endpoint:t.endpoint,requestId:t.requestId,requestSize:t.requestSize},originalError:s})};let i=new d(`Request timed out after ${t.config.timeoutMs}ms`,u.TIMEOUT_ERROR,{context:{serverUrl:t.config.serverUrl,timeoutMs:t.config.timeoutMs,url:t.fullUrl,requestId:t.requestId,endpoint:t.endpoint,requestSize:t.requestSize}});return r<n-1?{ok:!1,retry:!0,delayMs:b(r,e),cause:i}:{ok:!1,retry:!1,cause:i}}if(s instanceof TypeError){let a=new d(`Network error: ${s.message}`,u.NETWORK_ERROR,{context:{serverUrl:t.config.serverUrl,url:t.fullUrl,requestId:t.requestId,endpoint:t.endpoint,requestSize:t.requestSize},originalError:s});return r<n-1?{ok:!1,retry:!0,delayMs:b(r,e),cause:a}:{ok:!1,retry:!1,cause:a}}if(s instanceof d){let a=s.statusCode;return a!==void 0&&(A.has(a)||e.retryOn429&&a===429)&&r<n-1?{ok:!1,retry:!0,delayMs:b(r,e),cause:s}:{ok:!1,retry:!1,cause:s}}return{ok:!1,retry:!1,cause:new d(s instanceof Error?s.message:String(s),u.UNKNOWN_ERROR,{context:{endpoint:t.endpoint,requestId:t.requestId},originalError:s instanceof Error?s:new Error(String(s))})}}finally{l()}}async function W(t,e,r){let n=K(),o=JSON.stringify(e),l=o.length,c=L(t,r.serverUrl),s=q(n,r),a=M(r.retry),i=a.attempts+1;if(r.debug){let h=(l/1024).toFixed(2),f=l>1e5?"\u26A0\uFE0F":"\u{1F680}";R(`${f} Starting compute request [${n}]: ${t} (${h}KB)`,!0)}let O={endpoint:t,body:o,requestSize:l,fullUrl:c,requestId:n,headers:s,config:r},m=null;for(let h=0;h<i;h++){let f=await H(O,a,h,i);if(f.ok)return f.value;if(!f.retry)throw f.cause;m=f.cause,r.debug&&R(`\u{1F501} Request [${n}] retrying after ${f.delayMs}ms (attempt ${h+2}/${i}): ${f.cause.message}`,!0);try{await D(f.delayMs,r.signal)}catch (e3){throw new d("Request aborted by caller",u.UNKNOWN_ERROR,{context:{endpoint:t,requestId:n,requestSize:l},originalError:m})}}throw _nullishCoalesce(m, () => (new d("Unknown error after retries",u.UNKNOWN_ERROR,{context:{endpoint:t,requestId:n,requestSize:l}})))}var v=class{constructor(e,r){g(this,"serverUrl");g(this,"apiKey");g(this,"disposed",!1);g(this,"activeMonitors",new Set);g(this,"activeTimeouts",new Set);if(!_optionalChain([e, 'optionalAccess', _21 => _21.trim, 'call', _22 => _22()]))throw new d("serverUrl is required",u.INVALID_CONFIG,{context:{serverUrl:e}});if(!e.match(/^https?:\/\//))throw new d(`Invalid serverUrl: "${e}". Must start with "http://" or "https://". For example: "http://localhost:5000" or "https://example.com"`,u.INVALID_CONFIG,{context:{serverUrl:e}});try{new URL(e)}catch(n){throw new d(`Invalid serverUrl: "${e}". Must be a valid URL. Received error: ${n instanceof Error?n.message:String(n)}`,u.INVALID_CONFIG,{context:{serverUrl:e},originalError:n instanceof Error?n:void 0})}this.apiKey=r,this.serverUrl=e.replace(/\/+$/,"")}buildHeaders(){let e={"Content-Type":"application/json"};return this.apiKey&&(e.RhinoComputeKey=this.apiKey),e}async isServerOnline(){this.ensureNotDisposed();let e=`${this.serverUrl}/healthcheck`,r={headers:this.buildHeaders(),method:"GET"};try{return(await fetch(e,r)).ok}catch(n){return p().debug("[ComputeServerStats] Fetch error:",n),!1}}async getActiveChildren(){this.ensureNotDisposed();try{let e=await fetch(`${this.serverUrl}/activechildren`,{headers:this.buildHeaders()});if(!e.ok)return p().warn("[ComputeServerStats] Failed to fetch active children:",e.status),null;let r=await e.text(),n=parseInt(r.trim(),10);return isNaN(n)?(p().warn("[ComputeServerStats] Invalid active children response:",r),null):n}catch(e){return p().warn("[ComputeServerStats] Error fetching active children:",e),null}}async getVersion(){this.ensureNotDisposed();try{let e=await fetch(`${this.serverUrl}/version`,{headers:this.buildHeaders()});if(!e.ok)return p().warn("[ComputeServerStats] Failed to fetch version:",e.status),null;let r=await e.text();try{let n=JSON.parse(r);return{rhino:_nullishCoalesce(n.rhino, () => ("")),compute:_nullishCoalesce(n.compute, () => ("")),git_sha:_nullishCoalesce(n.git_sha, () => (null))}}catch (e4){return{rhino:r,compute:"",git_sha:null}}}catch(e){return p().warn("[ComputeServerStats] Error fetching version:",e),null}}async getServerStats(){if(this.ensureNotDisposed(),!await this.isServerOnline())return{isOnline:!1};let[r,n]=await Promise.all([this.getVersion(),this.getActiveChildren()]);return{isOnline:!0,...r&&{version:r},...n!==null&&{activeChildren:n}}}monitor(e,r=5e3){this.ensureNotDisposed();let n=!0,o=null;p().info(`\u{1F504} Starting server stats monitoring every ${r}ms`);let l=async()=>{if(o!==null&&(this.activeTimeouts.delete(o),o=null),!(!n||this.disposed)){try{let s=await this.getServerStats();if(!n||this.disposed)return;try{e(s)}catch(a){p().error("[ComputeServerStats] Monitor callback threw:",a)}}catch(s){p().error("[ComputeServerStats] Failed to fetch stats during monitor:",s)}n&&!this.disposed&&(o=setTimeout(()=>{l()},r),this.activeTimeouts.add(o))}},c=()=>{n=!1,o!==null&&(clearTimeout(o),this.activeTimeouts.delete(o),o=null),this.activeMonitors.delete(c)};return this.activeMonitors.add(c),l(),c}async dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.activeMonitors)e();this.activeMonitors.clear();for(let e of this.activeTimeouts)clearTimeout(e);this.activeTimeouts.clear()}}ensureNotDisposed(){if(this.disposed)throw new d("ComputeServerStats has been disposed and cannot be used",u.INVALID_STATE,{context:{disposed:this.disposed}})}};function I(t,e={}){let{preserveSpaces:r=!1}=e,n=r?/[-_]+(.)?/g:/[\s-_]+(.)?/g,o=t.trim();return o.charAt(0).toLowerCase()+o.slice(1).replace(n,(l,c)=>c?c.toUpperCase():"")}function S(t,e={}){return!t||typeof t!="object"?t:Array.isArray(t)?e.deep?t.map(r=>S(r,e)):t:Object.keys(t).reduce((r,n)=>{let o=I(n,{preserveSpaces:e.preserveSpaces}),l=t[n];return r[o]=e.deep?S(l,e):l,r},{})}exports.a = V; exports.b = g; exports.c = u; exports.d = d; exports.e = p; exports.f = C; exports.g = _; exports.h = W; exports.i = v; exports.j = I; exports.k = S;
3
+ //# sourceMappingURL=chunk-VWOEUM7C.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/chunk-VWOEUM7C.cjs","../src/core/errors.ts","../src/core/compute-fetch/compute-fetch.ts"],"names":["ErrorCodes","RhinoComputeError","_RhinoComputeError","message","code","options","__publicField","inputName","expectedType","context"],"mappings":"AAAA,qrBAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CCI1N,IAAMA,CAAAA,CAAa,CACzB,aAAA,CAAe,eAAA,CACf,UAAA,CAAY,YAAA,CACZ,gBAAA,CAAkB,kBAAA,CAClB,iBAAA,CAAmB,mBAAA,CACnB,aAAA,CAAe,eAAA,CACf,UAAA,CAAY,YAAA,CACZ,aAAA,CAAe,eAAA,CACf,aAAA,CAAe,eAAA,CACf,aAAA,CAAe,eAAA,CACf,cAAA,CAAgB,gBAAA,CAChB,YAAA,CAAc,cAAA,CACd,iBAAA,CAAmB,mBAAA,CACnB,cAAA,CAAgB,gBAAA,CAEhB,UAAA,CAAY,YAAA,CAEZ,OAAA,CAAS,SACV,CAAA,CASaC,CAAAA,aAAN,MAAMC,EAAAA,QAA0B,KAAM,CAM5C,WAAA,CACCC,CAAAA,CACAC,CAAAA,CAAe,eAAA,CACfC,CAAAA,CACC,CACD,KAAA,CAAMF,CAAO,CAAA,CAVdG,CAAAA,CAAA,IAAA,CAAgB,MAAA,CAAA,CAChBA,CAAAA,CAAA,IAAA,CAAgB,YAAA,CAAA,CAChBA,CAAAA,CAAA,IAAA,CAAgB,SAAA,CAAA,CAChBA,CAAAA,CAAA,IAAA,CAAgB,eAAA,CAAA,CAQf,IAAA,CAAK,IAAA,CAAO,mBAAA,CACZ,IAAA,CAAK,IAAA,CAAOF,CAAAA,CACZ,IAAA,CAAK,UAAA,iBAAaC,CAAAA,6BAAS,YAAA,CAC3B,IAAA,CAAK,OAAA,iBAAUA,CAAAA,6BAAS,SAAA,CACxB,IAAA,CAAK,aAAA,iBAAgBA,CAAAA,6BAAS,eAAA,iBAC1BA,CAAAA,6BAAS,eAAA,EAAA,CACX,IAAA,CAA6B,KAAA,CAAQA,CAAAA,CAAQ,aAAA,CAEhD,CASA,OAAO,aAAA,CACNE,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACC,CACD,OAAO,IAAIP,CAAAA,CACV,CAAA,OAAA,EAAUK,CAAS,CAAA,uBAAA,EAA0BC,CAAAA,CAAe,CAAA,WAAA,EAAcA,CAAY,CAAA,CAAA,CAAA,CAAM,EAAE,CAAA,CAAA;ACsVlB","file":"/home/runner/work/selva-compute/selva-compute/dist/chunk-VWOEUM7C.cjs","sourcesContent":[null,"/**\n * Error types and codes for `@selvajs/compute`.\n */\n\nexport const ErrorCodes = {\n\tNETWORK_ERROR: 'NETWORK_ERROR',\n\tAUTH_ERROR: 'AUTH_ERROR',\n\tVALIDATION_ERROR: 'VALIDATION_ERROR',\n\tCOMPUTATION_ERROR: 'COMPUTATION_ERROR',\n\tTIMEOUT_ERROR: 'TIMEOUT_ERROR',\n\tCORS_ERROR: 'CORS_ERROR',\n\tUNKNOWN_ERROR: 'UNKNOWN_ERROR',\n\tINVALID_STATE: 'INVALID_STATE',\n\tINVALID_INPUT: 'INVALID_INPUT',\n\tINVALID_CONFIG: 'INVALID_CONFIG',\n\tBROWSER_ONLY: 'BROWSER_ONLY',\n\tENVIRONMENT_ERROR: 'ENVIRONMENT_ERROR',\n\tENCODING_ERROR: 'ENCODING_ERROR',\n\t/** Scheduler latest-wins: this call was replaced by a newer one. */\n\tSUPERSEDED: 'SUPERSEDED',\n\t/** Scheduler / caller-supplied AbortSignal: this call was aborted. */\n\tABORTED: 'ABORTED'\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/**\n * Simplified error for Rhino Compute operations\n *\n * @public Use this for error handling with error codes and context.\n */\nexport class RhinoComputeError extends Error {\n\tpublic readonly code: string;\n\tpublic readonly statusCode?: number;\n\tpublic readonly context?: Record<string, unknown>;\n\tpublic readonly originalError?: Error;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tcode: string = 'UNKNOWN_ERROR',\n\t\toptions?: { statusCode?: number; context?: Record<string, unknown>; originalError?: Error }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'RhinoComputeError';\n\t\tthis.code = code;\n\t\tthis.statusCode = options?.statusCode;\n\t\tthis.context = options?.context;\n\t\tthis.originalError = options?.originalError;\n\t\tif (options?.originalError) {\n\t\t\t(this as { cause?: unknown }).cause = options.originalError;\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// Static Validation Error Helpers\n\t// ============================================================================\n\n\t/**\n\t * Create an error for missing/empty values\n\t */\n\tstatic missingValues(\n\t\tinputName: string,\n\t\texpectedType?: string,\n\t\tcontext?: Record<string, unknown>\n\t) {\n\t\treturn new RhinoComputeError(\n\t\t\t`Input \"${inputName}\" has no values defined${expectedType ? ` (expected ${expectedType})` : ''}`,\n\t\t\tErrorCodes.INVALID_INPUT,\n\t\t\t{ context: { inputName, expectedType, ...context } }\n\t\t);\n\t}\n\n\t/**\n\t * Create an error for unknown parameter type\n\t */\n\tstatic unknownParamType(\n\t\tparamType: string,\n\t\tparamName?: string,\n\t\tcontext?: Record<string, unknown>\n\t) {\n\t\treturn new RhinoComputeError(`Unknown paramType: ${paramType}`, ErrorCodes.VALIDATION_ERROR, {\n\t\t\tcontext: { receivedParamType: paramType, paramName, ...context }\n\t\t});\n\t}\n}\n","import { RhinoComputeError, ErrorCodes } from '../errors';\nimport { getLogger } from '../utils/logger';\n\nimport type { ComputeConfig, RetryPolicy } from '../types';\nimport type {\n\tGrasshopperComputeConfig,\n\tGrasshopperComputeResponse,\n\tIoResponseSchema\n} from '@/features/grasshopper/types';\n\n/**\n * Valid endpoints for Rhino Compute (improved response type handling).\n */\nexport type Endpoint = 'grasshopper' | 'io' | string;\n\nexport type EndpointResponseMap = {\n\tgrasshopper: GrasshopperComputeResponse;\n\tio: IoResponseSchema;\n};\n\nexport type ComputeResponseFor<E extends string> = E extends keyof EndpointResponseMap\n\t? EndpointResponseMap[E]\n\t: unknown;\n\n// ============================================================================\n// Retry Policy\n// ============================================================================\n\nconst DEFAULT_RETRY: Required<RetryPolicy> = {\n\tattempts: 0,\n\tbaseDelayMs: 500,\n\tmaxDelayMs: 30_000,\n\tretryOn429: true\n};\n\nconst RETRYABLE_STATUS = new Set([502, 503, 504]);\n\nfunction resolveRetryPolicy(policy: RetryPolicy | undefined): Required<RetryPolicy> {\n\tif (!policy) return DEFAULT_RETRY;\n\treturn {\n\t\tattempts: policy.attempts ?? DEFAULT_RETRY.attempts,\n\t\tbaseDelayMs: policy.baseDelayMs ?? DEFAULT_RETRY.baseDelayMs,\n\t\tmaxDelayMs: policy.maxDelayMs ?? DEFAULT_RETRY.maxDelayMs,\n\t\tretryOn429: policy.retryOn429 ?? DEFAULT_RETRY.retryOn429\n\t};\n}\n\n/**\n * Parse a Retry-After header value (seconds-int or HTTP-date) into ms.\n * Returns null if the header is missing or unparseable.\n */\nfunction parseRetryAfter(headerValue: string | null): number | null {\n\tif (!headerValue) return null;\n\tconst seconds = Number(headerValue);\n\tif (Number.isFinite(seconds) && seconds >= 0) return seconds * 1000;\n\tconst dateMs = Date.parse(headerValue);\n\tif (Number.isFinite(dateMs)) {\n\t\tconst delta = dateMs - Date.now();\n\t\treturn delta > 0 ? delta : 0;\n\t}\n\treturn null;\n}\n\nfunction backoffDelay(attempt: number, policy: Required<RetryPolicy>): number {\n\tconst exponential = policy.baseDelayMs * Math.pow(2, attempt);\n\tconst jitter = Math.random() * policy.baseDelayMs;\n\treturn Math.min(exponential + jitter, policy.maxDelayMs);\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tif (signal?.aborted) {\n\t\t\treject(new DOMException('Aborted', 'AbortError'));\n\t\t\treturn;\n\t\t}\n\t\tconst id = setTimeout(() => {\n\t\t\tsignal?.removeEventListener('abort', onAbort);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(id);\n\t\t\treject(new DOMException('Aborted', 'AbortError'));\n\t\t};\n\t\tsignal?.addEventListener('abort', onAbort, { once: true });\n\t});\n}\n\n// ============================================================================\n// Error Handling\n// ============================================================================\n\nfunction throwHttpError(\n\tresponse: Response,\n\tfullUrl: string,\n\trequestId: string,\n\trequestSize: number,\n\tserverUrl: string,\n\terrorBody: string\n): never {\n\tconst { status, statusText } = response;\n\tconst context = { url: fullUrl, requestId, method: 'POST', requestSize, serverUrl };\n\n\tconst bodyHint = errorBody ? ` — ${errorBody.slice(0, 200)}` : '';\n\tconst errorMap: Record<number, { message: string; code: string }> = {\n\t\t401: {\n\t\t\tmessage: `HTTP ${status}: ${statusText}${bodyHint}`,\n\t\t\tcode: ErrorCodes.AUTH_ERROR\n\t\t},\n\t\t403: {\n\t\t\tmessage: `HTTP ${status}: ${statusText}${bodyHint}`,\n\t\t\tcode: ErrorCodes.AUTH_ERROR\n\t\t},\n\t\t404: { message: `Endpoint not found: ${fullUrl}`, code: ErrorCodes.NETWORK_ERROR },\n\t\t413: {\n\t\t\tmessage: `Request too large: ${(requestSize / 1024).toFixed(2)}KB`,\n\t\t\tcode: ErrorCodes.VALIDATION_ERROR\n\t\t},\n\t\t429: { message: 'Rate limit exceeded', code: ErrorCodes.NETWORK_ERROR },\n\t\t500: {\n\t\t\tmessage: `Server error: ${errorBody || statusText}`,\n\t\t\tcode: ErrorCodes.COMPUTATION_ERROR\n\t\t},\n\t\t502: { message: `Service unavailable: ${statusText}`, code: ErrorCodes.NETWORK_ERROR },\n\t\t503: { message: `Service unavailable: ${statusText}`, code: ErrorCodes.NETWORK_ERROR },\n\t\t504: { message: `Service unavailable: ${statusText}`, code: ErrorCodes.NETWORK_ERROR }\n\t};\n\n\tconst error = errorMap[status] || {\n\t\tmessage: `HTTP ${status}: ${statusText}`,\n\t\tcode: ErrorCodes.UNKNOWN_ERROR\n\t};\n\n\tthrow new RhinoComputeError(error.message, error.code, { statusCode: status, context });\n}\n\n// ============================================================================\n// Request Helpers\n// ============================================================================\n\nfunction buildUrl(endpoint: string, serverUrl: string): string {\n\tconst base = serverUrl.replace(/\\/+$/, '');\n\tconst path = endpoint.replace(/^\\/+/, '');\n\treturn `${base}/${path}`;\n}\n\nfunction isLocalhost(serverUrl: string): boolean {\n\ttry {\n\t\tconst host = new URL(serverUrl).host;\n\t\treturn /^(localhost|127\\.0\\.0\\.1|::1)(:\\d+)?$/i.test(host);\n\t} catch {\n\t\treturn /(localhost|127\\.0\\.0\\.1)/i.test(serverUrl);\n\t}\n}\n\nfunction buildHeaders(requestId: string, config: ComputeConfig): HeadersInit {\n\tconst headers: HeadersInit = {\n\t\t'X-Request-ID': requestId,\n\t\t'Content-Type': 'application/json',\n\t\t...(config.authToken && { Authorization: config.authToken }),\n\t\t...(config.apiKey && { RhinoComputeKey: config.apiKey })\n\t};\n\n\tif (!config.apiKey && !isLocalhost(config.serverUrl)) {\n\t\tgetLogger().warn(\n\t\t\t`⚠️ [Rhino Compute] Request [${requestId}] targets remote server (${config.serverUrl}) but no API key is configured. Requests may fail or be rate-limited.`\n\t\t);\n\t}\n\n\treturn headers;\n}\n\nfunction generateRequestId(): string {\n\treturn `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;\n}\n\nfunction log(message: string, debug?: boolean): void {\n\tif (debug) getLogger().debug(message);\n}\n\n/**\n * Compose a caller-supplied AbortSignal with an optional timeout. Returns a\n * combined signal, or `undefined` if neither was given.\n *\n * Uses `AbortSignal.timeout` (not setTimeout) so the timer is not throttled\n * when the tab is hidden. Falls back to a manual timer for older runtimes.\n *\n * @internal exported for tests\n */\nexport function composeSignal(\n\tcallerSignal: AbortSignal | undefined,\n\ttimeoutMs: number | undefined\n): { signal: AbortSignal | undefined; cleanup: () => void } {\n\tconst signals: AbortSignal[] = [];\n\tlet cleanup = () => {};\n\n\tif (callerSignal) signals.push(callerSignal);\n\n\tif (timeoutMs && timeoutMs > 0) {\n\t\tif (typeof AbortSignal !== 'undefined' && typeof AbortSignal.timeout === 'function') {\n\t\t\tsignals.push(AbortSignal.timeout(timeoutMs));\n\t\t} else {\n\t\t\t// Fallback for runtimes without AbortSignal.timeout\n\t\t\tconst ctrl = new AbortController();\n\t\t\tconst id = setTimeout(() => ctrl.abort(), timeoutMs);\n\t\t\tcleanup = () => clearTimeout(id);\n\t\t\tsignals.push(ctrl.signal);\n\t\t}\n\t}\n\n\tif (signals.length === 0) return { signal: undefined, cleanup };\n\tif (signals.length === 1) return { signal: signals[0], cleanup };\n\n\tif (typeof AbortSignal !== 'undefined' && typeof (AbortSignal as any).any === 'function') {\n\t\treturn { signal: (AbortSignal as any).any(signals) as AbortSignal, cleanup };\n\t}\n\n\t// Manual composition fallback\n\tconst ctrl = new AbortController();\n\tconst onAbort = () => ctrl.abort();\n\tfor (const s of signals) {\n\t\tif (s.aborted) {\n\t\t\tctrl.abort();\n\t\t\tbreak;\n\t\t}\n\t\ts.addEventListener('abort', onAbort, { once: true });\n\t}\n\tconst prevCleanup = cleanup;\n\tcleanup = () => {\n\t\tprevCleanup();\n\t\tfor (const s of signals) s.removeEventListener('abort', onAbort);\n\t};\n\treturn { signal: ctrl.signal, cleanup };\n}\n\n// ============================================================================\n// Response Processing\n// ============================================================================\n\nasync function handleResponse(\n\tresponse: Response,\n\tfullUrl: string,\n\trequestId: string,\n\trequestSize: number,\n\tserverUrl: string,\n\tstartTime: number,\n\tdebug?: boolean\n): Promise<any> {\n\tconst responseTime = Math.round(performance.now() - startTime);\n\n\tif (!response.ok) {\n\t\t// Read body once and reuse\n\t\tlet errorBody = await response.text();\n\n\t\t// Enhanced logging for errors\n\t\tif (debug) {\n\t\t\tlog(\n\t\t\t\t`❌ Request [${requestId}] failed with HTTP ${response.status} in ${responseTime}ms`,\n\t\t\t\ttrue\n\t\t\t);\n\t\t\tlog(` URL: ${fullUrl}`, true);\n\t\t\tlog(` Status: ${response.status} ${response.statusText}`, true);\n\t\t\tif (errorBody) {\n\t\t\t\tlog(\n\t\t\t\t\t` Response body: ${errorBody.substring(0, 500)}${errorBody.length > 500 ? '...' : ''}`,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Check if it's a valid compute response with errors/warnings\n\t\tif (response.status === 500) {\n\t\t\ttry {\n\t\t\t\tconst parsed = JSON.parse(errorBody);\n\t\t\t\t// If it has values, it's a partial success with errors\n\t\t\t\tif (parsed?.values && (parsed.errors || parsed.warnings)) {\n\t\t\t\t\tif (debug) {\n\t\t\t\t\t\tlog(\n\t\t\t\t\t\t\t`⚠️ Request [${requestId}] completed with Grasshopper errors in ${responseTime}ms`,\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (parsed.errors?.length > 0) {\n\t\t\t\t\t\t\tlog(` Errors: ${JSON.stringify(parsed.errors, null, 2)}`, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (parsed.warnings?.length > 0) {\n\t\t\t\t\t\t\tlog(` Warnings: ${JSON.stringify(parsed.warnings, null, 2)}`, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn parsed;\n\t\t\t\t}\n\n\t\t\t\t// If it's a raw exception from the server (like ArgumentException), include it in the error message\n\t\t\t\tif (parsed?.Message) {\n\t\t\t\t\terrorBody = `${parsed.ExceptionType ? parsed.ExceptionType + ': ' : ''}${parsed.Message}\\n${parsed.StackTrace || ''}`;\n\t\t\t\t} else if (parsed?.error) {\n\t\t\t\t\terrorBody =\n\t\t\t\t\t\ttypeof parsed.error === 'string' ? parsed.error : JSON.stringify(parsed.error, null, 2);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tif (debug) {\n\t\t\t\t\tlog(` Failed to parse error body as JSON: ${e}`, true);\n\t\t\t\t}\n\t\t\t\t// Not valid JSON, proceed with HTTP error\n\t\t\t}\n\t\t}\n\n\t\tthrowHttpError(response, fullUrl, requestId, requestSize, serverUrl, errorBody);\n\t}\n\n\tlog(`✅ Request [${requestId}] completed in ${responseTime}ms`, debug);\n\n\ttry {\n\t\treturn await response.json();\n\t} catch (error) {\n\t\tthrow new RhinoComputeError('Failed to parse JSON response', ErrorCodes.NETWORK_ERROR, {\n\t\t\tstatusCode: response.status,\n\t\t\tcontext: {\n\t\t\t\turl: fullUrl,\n\t\t\t\trequestId\n\t\t\t},\n\t\t\toriginalError: error instanceof Error ? error : new Error(String(error))\n\t\t});\n\t}\n}\n\n// ============================================================================\n// Single attempt\n// ============================================================================\n\ninterface AttemptContext {\n\tendpoint: string;\n\tbody: string;\n\trequestSize: number;\n\tfullUrl: string;\n\trequestId: string;\n\theaders: HeadersInit;\n\tconfig: ComputeConfig | GrasshopperComputeConfig;\n}\n\ninterface AttemptResult {\n\tok: true;\n\tvalue: any;\n}\n\ninterface AttemptRetry {\n\tok: false;\n\tretry: true;\n\tdelayMs: number;\n\tcause: RhinoComputeError;\n}\n\ninterface AttemptFatal {\n\tok: false;\n\tretry: false;\n\tcause: RhinoComputeError;\n}\n\nasync function attemptFetch(\n\tctx: AttemptContext,\n\tretryPolicy: Required<RetryPolicy>,\n\tattempt: number,\n\ttotalAttempts: number\n): Promise<AttemptResult | AttemptRetry | AttemptFatal> {\n\tconst { signal, cleanup } = composeSignal(ctx.config.signal, ctx.config.timeoutMs);\n\tconst startTime = performance.now();\n\n\ttry {\n\t\tconst response = await fetch(ctx.fullUrl, {\n\t\t\tmethod: 'POST',\n\t\t\tbody: ctx.body,\n\t\t\theaders: ctx.headers,\n\t\t\tsignal\n\t\t});\n\n\t\t// 429 with Retry-After or retryable 5xx → maybe retry\n\t\tconst isRetryableStatus =\n\t\t\tRETRYABLE_STATUS.has(response.status) || (retryPolicy.retryOn429 && response.status === 429);\n\n\t\tif (isRetryableStatus && attempt < totalAttempts - 1) {\n\t\t\tconst retryAfterMs = parseRetryAfter(response.headers.get('Retry-After'));\n\t\t\tconst delayMs = retryAfterMs ?? backoffDelay(attempt, retryPolicy);\n\t\t\t// Drain the body so the connection can be reused on the next attempt.\n\t\t\t// On the *final* attempt we deliberately fall through — handleResponse\n\t\t\t// reads the body itself to surface the error context.\n\t\t\tawait response.text().catch(() => {});\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tretry: true,\n\t\t\t\tdelayMs,\n\t\t\t\tcause: new RhinoComputeError(\n\t\t\t\t\t`HTTP ${response.status} ${response.statusText} (will retry)`,\n\t\t\t\t\tErrorCodes.NETWORK_ERROR,\n\t\t\t\t\t{ statusCode: response.status, context: { requestId: ctx.requestId } }\n\t\t\t\t)\n\t\t\t};\n\t\t}\n\n\t\tconst value = await handleResponse(\n\t\t\tresponse,\n\t\t\tctx.fullUrl,\n\t\t\tctx.requestId,\n\t\t\tctx.requestSize,\n\t\t\tctx.config.serverUrl,\n\t\t\tstartTime,\n\t\t\tctx.config.debug\n\t\t);\n\t\treturn { ok: true, value };\n\t} catch (error) {\n\t\t// Caller-aborted vs timeout-aborted distinction\n\t\tif (error instanceof Error && (error.name === 'AbortError' || error.name === 'TimeoutError')) {\n\t\t\tconst callerAborted = ctx.config.signal?.aborted === true;\n\n\t\t\tif (callerAborted) {\n\t\t\t\t// Caller cancellation is never retried — propagate immediately\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tretry: false,\n\t\t\t\t\tcause: new RhinoComputeError('Request aborted by caller', ErrorCodes.UNKNOWN_ERROR, {\n\t\t\t\t\t\tcontext: {\n\t\t\t\t\t\t\tendpoint: ctx.endpoint,\n\t\t\t\t\t\t\trequestId: ctx.requestId,\n\t\t\t\t\t\t\trequestSize: ctx.requestSize\n\t\t\t\t\t\t},\n\t\t\t\t\t\toriginalError: error\n\t\t\t\t\t})\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Timeout — retryable up to attempts limit\n\t\t\tconst fatal = new RhinoComputeError(\n\t\t\t\t`Request timed out after ${ctx.config.timeoutMs}ms`,\n\t\t\t\tErrorCodes.TIMEOUT_ERROR,\n\t\t\t\t{\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\tserverUrl: ctx.config.serverUrl,\n\t\t\t\t\t\ttimeoutMs: ctx.config.timeoutMs,\n\t\t\t\t\t\turl: ctx.fullUrl,\n\t\t\t\t\t\trequestId: ctx.requestId,\n\t\t\t\t\t\tendpoint: ctx.endpoint,\n\t\t\t\t\t\trequestSize: ctx.requestSize\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t\tif (attempt < totalAttempts - 1) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tretry: true,\n\t\t\t\t\tdelayMs: backoffDelay(attempt, retryPolicy),\n\t\t\t\t\tcause: fatal\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: false, retry: false, cause: fatal };\n\t\t}\n\n\t\t// Network error (TypeError) — retryable\n\t\tif (error instanceof TypeError) {\n\t\t\tconst fatal = new RhinoComputeError(\n\t\t\t\t`Network error: ${error.message}`,\n\t\t\t\tErrorCodes.NETWORK_ERROR,\n\t\t\t\t{\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\tserverUrl: ctx.config.serverUrl,\n\t\t\t\t\t\turl: ctx.fullUrl,\n\t\t\t\t\t\trequestId: ctx.requestId,\n\t\t\t\t\t\tendpoint: ctx.endpoint,\n\t\t\t\t\t\trequestSize: ctx.requestSize\n\t\t\t\t\t},\n\t\t\t\t\toriginalError: error\n\t\t\t\t}\n\t\t\t);\n\t\t\tif (attempt < totalAttempts - 1) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tretry: true,\n\t\t\t\t\tdelayMs: backoffDelay(attempt, retryPolicy),\n\t\t\t\t\tcause: fatal\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: false, retry: false, cause: fatal };\n\t\t}\n\n\t\t// RhinoComputeError thrown from handleResponse — already has full context.\n\t\t// Retryable only if it carries a retryable status code.\n\t\tif (error instanceof RhinoComputeError) {\n\t\t\tconst status = error.statusCode;\n\t\t\tconst retryable =\n\t\t\t\tstatus !== undefined &&\n\t\t\t\t(RETRYABLE_STATUS.has(status) || (retryPolicy.retryOn429 && status === 429));\n\t\t\tif (retryable && attempt < totalAttempts - 1) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tretry: true,\n\t\t\t\t\tdelayMs: backoffDelay(attempt, retryPolicy),\n\t\t\t\t\tcause: error\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn { ok: false, retry: false, cause: error };\n\t\t}\n\n\t\t// Unknown — wrap and don't retry\n\t\treturn {\n\t\t\tok: false,\n\t\t\tretry: false,\n\t\t\tcause: new RhinoComputeError(\n\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t\tErrorCodes.UNKNOWN_ERROR,\n\t\t\t\t{\n\t\t\t\t\tcontext: { endpoint: ctx.endpoint, requestId: ctx.requestId },\n\t\t\t\t\toriginalError: error instanceof Error ? error : new Error(String(error))\n\t\t\t\t}\n\t\t\t)\n\t\t};\n\t} finally {\n\t\tcleanup();\n\t}\n}\n\n// ============================================================================\n// Main Function\n// ============================================================================\n\n/**\n * Generic Rhino Compute fetch function.\n * Sends a POST request to any Compute endpoint with pre-prepared arguments.\n *\n * Use this for advanced, low-level control over compute requests. For most use cases, prefer higher-level APIs.\n *\n * @typeParam E - The endpoint name (e.g., 'grasshopper', 'io'). Determines the response type for better type safety.\n * @param endpoint - The Compute API endpoint (e.g., 'grasshopper', 'io', 'mesh').\n * @param args - Pre-prepared arguments for the request body.\n * @param config - Compute configuration (server URL, API key, timeout, debug, retry, signal).\n * @returns The parsed JSON response from the server, typed according to the endpoint.\n *\n * @example\n * // Basic usage for the Grasshopper endpoint:\n * const response = await fetchRhinoCompute(\n * 'grasshopper',\n * { ... },\n * {\n * serverUrl: 'https://my-server.com',\n * debug: true,\n * timeoutMs: 30_000,\n * retry: { attempts: 2 },\n * signal: controller.signal,\n * }\n * );\n */\nexport async function fetchRhinoCompute<E extends Endpoint>(\n\tendpoint: E,\n\targs: Record<string, any>,\n\tconfig: ComputeConfig | GrasshopperComputeConfig\n): Promise<ComputeResponseFor<E>> {\n\tconst requestId = generateRequestId();\n\tconst body = JSON.stringify(args);\n\tconst requestSize = body.length;\n\tconst fullUrl = buildUrl(endpoint, config.serverUrl);\n\tconst headers = buildHeaders(requestId, config);\n\tconst retryPolicy = resolveRetryPolicy(config.retry);\n\tconst totalAttempts = retryPolicy.attempts + 1;\n\n\tif (config.debug) {\n\t\tconst sizeKb = (requestSize / 1024).toFixed(2);\n\t\tconst emoji = requestSize > 100000 ? '⚠️' : '🚀';\n\t\tlog(`${emoji} Starting compute request [${requestId}]: ${endpoint} (${sizeKb}KB)`, true);\n\t}\n\n\tconst ctx: AttemptContext = {\n\t\tendpoint,\n\t\tbody,\n\t\trequestSize,\n\t\tfullUrl,\n\t\trequestId,\n\t\theaders,\n\t\tconfig\n\t};\n\n\tlet lastError: RhinoComputeError | null = null;\n\n\tfor (let attempt = 0; attempt < totalAttempts; attempt++) {\n\t\tconst result = await attemptFetch(ctx, retryPolicy, attempt, totalAttempts);\n\n\t\tif (result.ok) return result.value as ComputeResponseFor<E>;\n\n\t\tif (!result.retry) throw result.cause;\n\n\t\tlastError = result.cause;\n\t\tif (config.debug) {\n\t\t\tlog(\n\t\t\t\t`🔁 Request [${requestId}] retrying after ${result.delayMs}ms (attempt ${attempt + 2}/${totalAttempts}): ${result.cause.message}`,\n\t\t\t\ttrue\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\tawait sleep(result.delayMs, config.signal);\n\t\t} catch {\n\t\t\t// Caller cancelled during backoff\n\t\t\tthrow new RhinoComputeError('Request aborted by caller', ErrorCodes.UNKNOWN_ERROR, {\n\t\t\t\tcontext: { endpoint, requestId, requestSize },\n\t\t\t\toriginalError: lastError\n\t\t\t});\n\t\t}\n\t}\n\n\t// Exhausted retries — throw the last seen error\n\tthrow (\n\t\tlastError ??\n\t\tnew RhinoComputeError('Unknown error after retries', ErrorCodes.UNKNOWN_ERROR, {\n\t\t\tcontext: { endpoint, requestId, requestSize }\n\t\t})\n\t);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{c as n,d as a}from"./chunk-RHULSS7S.js";function f(e){return Buffer.from(e,"utf-8").toString("base64")}function s(e){return!e||e.length<2||e.length%4!==0?!1:/^[A-Za-z0-9+/]+={0,2}$/.test(e)}function l(e){if(typeof globalThis.Buffer=="function"){let t=globalThis.Buffer.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(typeof globalThis.atob=="function"){let t=globalThis.atob(e),o=new Uint8Array(t.length);for(let r=0;r<t.length;r++)o[r]=t.charCodeAt(r)&255;return o}throw new a("Base64 decoding not supported in this environment.",n.INVALID_STATE,{context:{environmentInfo:"atob or Buffer not available"}})}function c(e){if(typeof globalThis.Buffer=="function")return globalThis.Buffer.from(e).toString("base64");if(typeof globalThis.btoa=="function"){let o="";for(let r=0;r<e.length;r+=32768)o+=String.fromCharCode.apply(null,Array.from(e.subarray(r,r+32768)));return globalThis.btoa(o)}throw new a("Base64 encoding not supported in this environment.",n.INVALID_STATE,{context:{environmentInfo:"btoa or Buffer not available"}})}export{f as a,s as b,l as c,c as d};
2
+ //# sourceMappingURL=chunk-XLHA5YPH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/utils/encoding.ts"],"sourcesContent":["import { RhinoComputeError, ErrorCodes } from '../errors';\nimport { getLogger } from './logger';\n\n/**\n * Encodes a string to base64 (Node 20+ safe)\n *\n * @internal Internal encoding helper — kept internal to `@selvajs/compute`.\n *\n * @param str - String to encode\n * @returns Base64 encoded string\n */\nexport function encodeStringToBase64(str: string): string {\n\treturn Buffer.from(str, 'utf-8').toString('base64');\n}\n\n/**\n * Decodes a base64 string to a UTF-8 string (Node 20+ safe)\n *\n * @internal Internal encoding helper — kept internal to `@selvajs/compute`.\n *\n * @param base64Str - Base64 encoded string\n * @returns Decoded UTF-8 string\n */\nexport function decodeBase64ToString(base64Str: string): string {\n\treturn Buffer.from(base64Str, 'base64').toString('utf-8');\n}\n\n/**\n * Checks if a string is valid base64\n *\n * @internal Internal encoding helper — kept internal to `@selvajs/compute`.\n *\n * @param str - String to check\n * @returns True if the string is valid base64\n */\nexport function isBase64(str: string): boolean {\n\tif (!str || str.length < 2) return false;\n\t// Length must be a multiple of 4, only alphabet chars + at most 2 trailing '='\n\tif (str.length % 4 !== 0) return false;\n\treturn /^[A-Za-z0-9+/]+={0,2}$/.test(str);\n}\n\n/**\n * Decodes a base64 string to binary data (Uint8Array)\n *\n * @internal Internal encoding helper — kept internal to `@selvajs/compute`.\n *\n * @param base64File - Base64 encoded string\n * @returns Decoded binary data as Uint8Array\n * @throws {RhinoComputeError} If base64 decoding is not supported in this environment.\n */\nexport function decodeBase64ToBinary(base64File: string): Uint8Array {\n\t// Prefer Buffer in Node — it's faster and avoids the latin-1 string detour\n\t// that atob + charCodeAt requires.\n\tif (typeof (globalThis as any).Buffer === 'function') {\n\t\tconst buf = (globalThis as any).Buffer.from(base64File, 'base64');\n\t\treturn new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n\t}\n\tif (typeof globalThis.atob === 'function') {\n\t\tconst binary = globalThis.atob(base64File);\n\t\tconst bytes = new Uint8Array(binary.length);\n\t\tfor (let i = 0; i < binary.length; i++) {\n\t\t\tbytes[i] = binary.charCodeAt(i) & 0xff;\n\t\t}\n\t\treturn bytes;\n\t}\n\n\tthrow new RhinoComputeError(\n\t\t'Base64 decoding not supported in this environment.',\n\t\tErrorCodes.INVALID_STATE,\n\t\t{ context: { environmentInfo: 'atob or Buffer not available' } }\n\t);\n}\n\n/**\n * Encodes binary data (Uint8Array) to base64 string.\n *\n * @internal Internal encoding helper — kept internal to `@selvajs/compute`.\n *\n * Uses Node's `Buffer` when available (faster, single allocation) and falls\n * back to `btoa` over a latin-1 string in browsers/workers.\n */\nexport function base64ByteArray(bytes: Uint8Array): string {\n\tif (typeof (globalThis as any).Buffer === 'function') {\n\t\treturn (globalThis as any).Buffer.from(bytes).toString('base64');\n\t}\n\tif (typeof globalThis.btoa === 'function') {\n\t\t// Build a latin-1 string in chunks to avoid blowing the call stack on\n\t\t// large inputs (a single fromCharCode(...verylargearray) can exceed it).\n\t\tconst CHUNK = 0x8000;\n\t\tlet s = '';\n\t\tfor (let i = 0; i < bytes.length; i += CHUNK) {\n\t\t\ts += String.fromCharCode.apply(null, Array.from(bytes.subarray(i, i + CHUNK)));\n\t\t}\n\t\treturn globalThis.btoa(s);\n\t}\n\tthrow new RhinoComputeError(\n\t\t'Base64 encoding not supported in this environment.',\n\t\tErrorCodes.INVALID_STATE,\n\t\t{ context: { environmentInfo: 'btoa or Buffer not available' } }\n\t);\n}\n\n/**\n * Convert base64 string to rhino object\n *\n * @internal Internal helper for decoding Rhino objects — not public API.\n *\n * Source: https://github.com/mcneel/compute.rhino3d.appserver/blob/92c95a3b1d076a4d4a5360214ffd27c46425ff03/src/examples/convert/scriptjs\n * @param rhino is the rhino module form rhino3dm. Since not properly typed its not used here.\n * @param item\n * @returns\n */\nexport function base64ToRhinoObject(\n\trhino: any,\n\titem: {\n\t\ttype: string;\n\t\tdata: string;\n\t}\n) {\n\t//Make a type definition for this?\n\tlet decodata: null | object = null;\n\ttry {\n\t\tdecodata = JSON.parse(item.data);\n\t} catch (error) {\n\t\tdecodata = item;\n\t\tgetLogger().warn('Failed to parse JSON, returning original data:', error, item);\n\t}\n\tif (item.type === 'System.String') {\n\t\ttry {\n\t\t\treturn rhino.DracoCompression.decompressBase64String(decodata);\n\t\t} catch (error) {\n\t\t\tgetLogger().error('Failed to decompress Draco base64 string:', error);\n\t\t}\n\t} else if (\n\t\ttypeof decodata === 'object' &&\n\t\tObject.prototype.hasOwnProperty.call(decodata, 'opennurbs')\n\t) {\n\t\treturn rhino.CommonObject.decode(decodata);\n\t} else if (typeof decodata === 'object') {\n\t\ttry {\n\t\t\treturn rhino.CommonObject.decode(decodata);\n\t\t} catch (error) {\n\t\t\tgetLogger().error('Failed to decode Rhino object:', error);\n\t\t}\n\t}\n}\n"],"mappings":"+CAWO,SAASA,EAAqBC,EAAqB,CACzD,OAAO,OAAO,KAAKA,EAAK,OAAO,EAAE,SAAS,QAAQ,CACnD,CAsBO,SAASC,EAASC,EAAsB,CAG9C,MAFI,CAACA,GAAOA,EAAI,OAAS,GAErBA,EAAI,OAAS,IAAM,EAAU,GAC1B,yBAAyB,KAAKA,CAAG,CACzC,CAWO,SAASC,EAAqBC,EAAgC,CAGpE,GAAI,OAAQ,WAAmB,QAAW,WAAY,CACrD,IAAMC,EAAO,WAAmB,OAAO,KAAKD,EAAY,QAAQ,EAChE,OAAO,IAAI,WAAWC,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAU,CACjE,CACA,GAAI,OAAO,WAAW,MAAS,WAAY,CAC1C,IAAMC,EAAS,WAAW,KAAKF,CAAU,EACnCG,EAAQ,IAAI,WAAWD,EAAO,MAAM,EAC1C,QAASE,EAAI,EAAGA,EAAIF,EAAO,OAAQE,IAClCD,EAAMC,CAAC,EAAIF,EAAO,WAAWE,CAAC,EAAI,IAEnC,OAAOD,CACR,CAEA,MAAM,IAAIE,EACT,qDACAC,EAAW,cACX,CAAE,QAAS,CAAE,gBAAiB,8BAA+B,CAAE,CAChE,CACD,CAUO,SAASC,EAAgBJ,EAA2B,CAC1D,GAAI,OAAQ,WAAmB,QAAW,WACzC,OAAQ,WAAmB,OAAO,KAAKA,CAAK,EAAE,SAAS,QAAQ,EAEhE,GAAI,OAAO,WAAW,MAAS,WAAY,CAI1C,IAAIK,EAAI,GACR,QAASJ,EAAI,EAAGA,EAAID,EAAM,OAAQC,GAAK,MACtCI,GAAK,OAAO,aAAa,MAAM,KAAM,MAAM,KAAKL,EAAM,SAASC,EAAGA,EAAI,KAAK,CAAC,CAAC,EAE9E,OAAO,WAAW,KAAKI,CAAC,CACzB,CACA,MAAM,IAAIH,EACT,qDACAC,EAAW,cACX,CAAE,QAAS,CAAE,gBAAiB,8BAA+B,CAAE,CAChE,CACD","names":["encodeStringToBase64","str","isBase64","str","decodeBase64ToBinary","base64File","buf","binary","bytes","i","RhinoComputeError","ErrorCodes","base64ByteArray","s"]}
package/dist/core.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXULONXVPcjs = require('./chunk-XULONXVP.cjs');exports.ComputeServerStats = _chunkXULONXVPcjs.i; exports.ErrorCodes = _chunkXULONXVPcjs.c; exports.RhinoComputeError = _chunkXULONXVPcjs.d; exports.camelcaseKeys = _chunkXULONXVPcjs.k; exports.enableDebugLogging = _chunkXULONXVPcjs.g; exports.fetchRhinoCompute = _chunkXULONXVPcjs.h; exports.getLogger = _chunkXULONXVPcjs.e; exports.setLogger = _chunkXULONXVPcjs.f; exports.toCamelCase = _chunkXULONXVPcjs.j;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVWOEUM7Ccjs = require('./chunk-VWOEUM7C.cjs');exports.ComputeServerStats = _chunkVWOEUM7Ccjs.i; exports.ErrorCodes = _chunkVWOEUM7Ccjs.c; exports.RhinoComputeError = _chunkVWOEUM7Ccjs.d; exports.camelcaseKeys = _chunkVWOEUM7Ccjs.k; exports.enableDebugLogging = _chunkVWOEUM7Ccjs.g; exports.fetchRhinoCompute = _chunkVWOEUM7Ccjs.h; exports.getLogger = _chunkVWOEUM7Ccjs.e; exports.setLogger = _chunkVWOEUM7Ccjs.f; exports.toCamelCase = _chunkVWOEUM7Ccjs.j;
2
2
  //# sourceMappingURL=core.cjs.map
package/dist/core.d.cts CHANGED
@@ -1,6 +1,5 @@
1
- import { C as ComputeConfig, G as GrasshopperComputeConfig, d as GrasshopperComputeResponse, h as IoResponseSchema } from './schemas-Ct7lU-IH.cjs';
2
- export { R as RetryPolicy, g as RhinoModelUnit } from './schemas-Ct7lU-IH.cjs';
3
- export { C as ComputeServerStats, R as RhinoComputeError } from './base-dtik4Dlu.cjs';
1
+ import { C as ComputeConfig, g as GrasshopperComputeConfig, h as GrasshopperComputeResponse, q as IoResponseSchema } from './errors-CiA83qw2.cjs';
2
+ export { a as ComputeServerStats, E as ErrorCode, f as ErrorCodes, R as RetryPolicy, o as RhinoComputeError, p as RhinoModelUnit } from './errors-CiA83qw2.cjs';
4
3
 
5
4
  /**
6
5
  * Valid endpoints for Rhino Compute (improved response type handling).
@@ -39,23 +38,6 @@ type ComputeResponseFor<E extends string> = E extends keyof EndpointResponseMap
39
38
  */
40
39
  declare function fetchRhinoCompute<E extends Endpoint>(endpoint: E, args: Record<string, any>, config: ComputeConfig | GrasshopperComputeConfig): Promise<ComputeResponseFor<E>>;
41
40
 
42
- declare const ErrorCodes: {
43
- readonly NETWORK_ERROR: "NETWORK_ERROR";
44
- readonly AUTH_ERROR: "AUTH_ERROR";
45
- readonly VALIDATION_ERROR: "VALIDATION_ERROR";
46
- readonly COMPUTATION_ERROR: "COMPUTATION_ERROR";
47
- readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
48
- readonly CORS_ERROR: "CORS_ERROR";
49
- readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
50
- readonly INVALID_STATE: "INVALID_STATE";
51
- readonly INVALID_INPUT: "INVALID_INPUT";
52
- readonly INVALID_CONFIG: "INVALID_CONFIG";
53
- readonly BROWSER_ONLY: "BROWSER_ONLY";
54
- readonly ENVIRONMENT_ERROR: "ENVIRONMENT_ERROR";
55
- readonly ENCODING_ERROR: "ENCODING_ERROR";
56
- };
57
- type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
58
-
59
41
  /**
60
42
  * Logger interface for structured logging
61
43
  *
@@ -137,4 +119,4 @@ declare function camelcaseKeys(obj: unknown, options?: {
137
119
  preserveSpaces?: boolean;
138
120
  }): unknown;
139
121
 
140
- export { ComputeConfig, type ErrorCode, ErrorCodes, type Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase };
122
+ export { ComputeConfig, type Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase };
package/dist/core.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { C as ComputeConfig, G as GrasshopperComputeConfig, d as GrasshopperComputeResponse, h as IoResponseSchema } from './schemas-Ct7lU-IH.js';
2
- export { R as RetryPolicy, g as RhinoModelUnit } from './schemas-Ct7lU-IH.js';
3
- export { C as ComputeServerStats, R as RhinoComputeError } from './base-dtik4Dlu.js';
1
+ import { C as ComputeConfig, g as GrasshopperComputeConfig, h as GrasshopperComputeResponse, q as IoResponseSchema } from './errors-CiA83qw2.js';
2
+ export { a as ComputeServerStats, E as ErrorCode, f as ErrorCodes, R as RetryPolicy, o as RhinoComputeError, p as RhinoModelUnit } from './errors-CiA83qw2.js';
4
3
 
5
4
  /**
6
5
  * Valid endpoints for Rhino Compute (improved response type handling).
@@ -39,23 +38,6 @@ type ComputeResponseFor<E extends string> = E extends keyof EndpointResponseMap
39
38
  */
40
39
  declare function fetchRhinoCompute<E extends Endpoint>(endpoint: E, args: Record<string, any>, config: ComputeConfig | GrasshopperComputeConfig): Promise<ComputeResponseFor<E>>;
41
40
 
42
- declare const ErrorCodes: {
43
- readonly NETWORK_ERROR: "NETWORK_ERROR";
44
- readonly AUTH_ERROR: "AUTH_ERROR";
45
- readonly VALIDATION_ERROR: "VALIDATION_ERROR";
46
- readonly COMPUTATION_ERROR: "COMPUTATION_ERROR";
47
- readonly TIMEOUT_ERROR: "TIMEOUT_ERROR";
48
- readonly CORS_ERROR: "CORS_ERROR";
49
- readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
50
- readonly INVALID_STATE: "INVALID_STATE";
51
- readonly INVALID_INPUT: "INVALID_INPUT";
52
- readonly INVALID_CONFIG: "INVALID_CONFIG";
53
- readonly BROWSER_ONLY: "BROWSER_ONLY";
54
- readonly ENVIRONMENT_ERROR: "ENVIRONMENT_ERROR";
55
- readonly ENCODING_ERROR: "ENCODING_ERROR";
56
- };
57
- type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
58
-
59
41
  /**
60
42
  * Logger interface for structured logging
61
43
  *
@@ -137,4 +119,4 @@ declare function camelcaseKeys(obj: unknown, options?: {
137
119
  preserveSpaces?: boolean;
138
120
  }): unknown;
139
121
 
140
- export { ComputeConfig, type ErrorCode, ErrorCodes, type Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase };
122
+ export { ComputeConfig, type Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase };
package/dist/core.js CHANGED
@@ -1,2 +1,2 @@
1
- import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i}from"./chunk-CZCPL35F.js";export{g as ComputeServerStats,a as ErrorCodes,b as RhinoComputeError,i as camelcaseKeys,e as enableDebugLogging,f as fetchRhinoCompute,c as getLogger,d as setLogger,h as toCamelCase};
1
+ import{c as a,d as b,e as c,f as d,g as e,h as f,i as g,j as h,k as i}from"./chunk-RHULSS7S.js";export{g as ComputeServerStats,a as ErrorCodes,b as RhinoComputeError,i as camelcaseKeys,e as enableDebugLogging,f as fetchRhinoCompute,c as getLogger,d as setLogger,h as toCamelCase};
2
2
  //# sourceMappingURL=core.js.map