@inixiative/infra 0.1.0 → 0.1.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 (75) hide show
  1. package/dist/chunk-3V67V3N2.cjs +3 -0
  2. package/dist/chunk-3V67V3N2.cjs.map +1 -0
  3. package/dist/chunk-55HNIEAS.js +2 -0
  4. package/dist/chunk-55HNIEAS.js.map +1 -0
  5. package/dist/chunk-5UNXCQEH.js +3 -0
  6. package/dist/chunk-5UNXCQEH.js.map +1 -0
  7. package/dist/chunk-CNAFA6FE.cjs +2 -0
  8. package/dist/chunk-CNAFA6FE.cjs.map +1 -0
  9. package/dist/chunk-HONV2KPY.js +3 -0
  10. package/dist/chunk-HONV2KPY.js.map +1 -0
  11. package/dist/chunk-I3A224H4.js +3 -0
  12. package/dist/chunk-I3A224H4.js.map +1 -0
  13. package/dist/chunk-MO2YI2GE.cjs +2 -0
  14. package/dist/chunk-MO2YI2GE.cjs.map +1 -0
  15. package/dist/chunk-MP4O62RE.cjs +3 -0
  16. package/dist/chunk-MP4O62RE.cjs.map +1 -0
  17. package/dist/chunk-MXJ4EW3I.js +3 -0
  18. package/dist/chunk-MXJ4EW3I.js.map +1 -0
  19. package/dist/chunk-NGWNYW3U.js +3 -0
  20. package/dist/chunk-NGWNYW3U.js.map +1 -0
  21. package/dist/chunk-OHRGTWGZ.cjs +3 -0
  22. package/dist/chunk-OHRGTWGZ.cjs.map +1 -0
  23. package/dist/chunk-QREJ73ZG.cjs +2 -0
  24. package/dist/chunk-QREJ73ZG.cjs.map +1 -0
  25. package/dist/chunk-S47XOR4G.js +2 -0
  26. package/dist/chunk-S47XOR4G.js.map +1 -0
  27. package/dist/chunk-SLMYHBFB.cjs +3 -0
  28. package/dist/chunk-SLMYHBFB.cjs.map +1 -0
  29. package/dist/chunk-U5EA4FJI.cjs +2 -0
  30. package/dist/chunk-U5EA4FJI.cjs.map +1 -0
  31. package/dist/chunk-UZUGSMDK.js +2 -0
  32. package/dist/chunk-UZUGSMDK.js.map +1 -0
  33. package/dist/chunk-W5SAM2DK.js +2 -0
  34. package/dist/chunk-W5SAM2DK.js.map +1 -0
  35. package/dist/chunk-XGIX6QNV.cjs +3 -0
  36. package/dist/chunk-XGIX6QNV.cjs.map +1 -0
  37. package/dist/{contracts-BxHKiOwj.d.cts → contracts-isQ6Kn09.d.cts} +4 -0
  38. package/dist/{contracts-BxHKiOwj.d.ts → contracts-isQ6Kn09.d.ts} +4 -0
  39. package/dist/firecracker/index.cjs +1 -2
  40. package/dist/firecracker/index.cjs.map +1 -1
  41. package/dist/firecracker/index.d.cts +1 -1
  42. package/dist/firecracker/index.d.ts +1 -1
  43. package/dist/firecracker/index.js +1 -2
  44. package/dist/firecracker/index.js.map +1 -1
  45. package/dist/fly/index.cjs +1 -2
  46. package/dist/fly/index.cjs.map +1 -1
  47. package/dist/fly/index.d.cts +1 -1
  48. package/dist/fly/index.d.ts +1 -1
  49. package/dist/fly/index.js +1 -2
  50. package/dist/fly/index.js.map +1 -1
  51. package/dist/index.cjs +1 -2
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +2 -2
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.js +1 -2
  56. package/dist/index.js.map +1 -1
  57. package/dist/lifecycle/index.cjs +1 -1
  58. package/dist/lifecycle/index.cjs.map +1 -1
  59. package/dist/lifecycle/index.d.cts +1 -1
  60. package/dist/lifecycle/index.d.ts +1 -1
  61. package/dist/lifecycle/index.js +1 -1
  62. package/dist/lifecycle/index.js.map +1 -1
  63. package/dist/railway/index.cjs +1 -2
  64. package/dist/railway/index.cjs.map +1 -1
  65. package/dist/railway/index.d.cts +1 -1
  66. package/dist/railway/index.d.ts +1 -1
  67. package/dist/railway/index.js +1 -2
  68. package/dist/railway/index.js.map +1 -1
  69. package/dist/render/index.cjs +1 -2
  70. package/dist/render/index.cjs.map +1 -1
  71. package/dist/render/index.d.cts +1 -1
  72. package/dist/render/index.d.ts +1 -1
  73. package/dist/render/index.js +1 -2
  74. package/dist/render/index.js.map +1 -1
  75. package/package.json +8 -5
@@ -1,3 +1,2 @@
1
- 'use strict';var http=require('http');var Q=new Set(["unreachable","rate_limited","provider_unavailable"]),t=class extends Error{code;status;provider;retryable;constructor(r,n,o){let a=o?.provider?`[${o.provider}] `:"";super(n?`${a}${n}`:`${a}Infrastructure request failed (${r})`,{cause:o?.cause}),this.name="InfraError",this.code=r,this.status=o?.status,this.provider=o?.provider,this.retryable=o?.retryable??Q.has(r);}},S=(e,r)=>{let n=e===401||e===403?"authentication_failed":e===404?"not_found":e===409?"conflict":e===429?"rate_limited":e===400||e===422?"invalid_request":"provider_unavailable",o=r?.message?`HTTP ${e}: ${r.message}`:`HTTP ${e} (${n})`;return new t(n,o,{status:e,provider:r?.provider})},Z=(e,r)=>e instanceof t&&(e.code===r),p=(e,r,n)=>{if(!e?.trim())throw new t("invalid_request",`Missing required ${r}`,{provider:n});return e},x=e=>{if(!Z(e,"not_found"))throw e},W=(e,r)=>{if(e&&e.length>0)throw new t("invalid_request","Egress allowlist is not enforced by this driver",{provider:r})};var E="ghcr.io/inixiative/archive",U=4700,P="archive",C=e=>{if(!e.archiveToken)throw new t("authentication_failed","Archive server token is required");return e.archiveToken};var b=[{id:"starter",maxMemoryMb:512,monthlyUsd:7},{id:"standard",maxMemoryMb:2048,monthlyUsd:25},{id:"pro",maxMemoryMb:4096,monthlyUsd:85},{id:"pro_plus",maxMemoryMb:8192,monthlyUsd:175},{id:"pro_max",maxMemoryMb:16384,monthlyUsd:225},{id:"pro_ultra",maxMemoryMb:32768,monthlyUsd:450}],_=e=>{for(let r of b)if(e<=r.maxMemoryMb)return r;return b[b.length-1]},m=new Set(["build_failed","update_failed","pre_deploy_failed","canceled"]),D=new Set([...m,"deactivated"]);var ee=3e4,$=500,N=e=>e.replace(/\/+$/,""),g=e=>{try{let r=new URL(e);return `${r.protocol}//${r.host}${r.pathname}`}catch{return e.split("?")[0]?.split("#")[0]??e}},re=(e,r)=>{let n=e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,"Bearer [REDACTED]");return r&&r.length>0&&(n=n.split(r).join("[REDACTED]")),n},H=(e,r)=>{let n=re(e.trim(),r);if(n)return n.length>$?`${n.slice(0,$)}...`:n},M=(e,r)=>{if(e===void 0)return ee;if(!Number.isFinite(e)||e<=0)throw new t("invalid_request",`timeoutMs must be a finite positive number (got ${e})`,{provider:r});return e},O=(e,r,n)=>{if(!(r===204||!e.trim()))try{return JSON.parse(e)}catch(o){throw new t("provider_unavailable","Provider returned malformed JSON",{status:r,provider:n,cause:o})}},ne=async(e,r,n)=>{let o=M(n.timeoutMs,n.provider),a;try{a=new URL(e);}catch(i){throw new t("invalid_request",`Invalid request URL: ${g(e)}`,{provider:n.provider,cause:i})}let u=`${a.pathname}${a.search}`,s=await new Promise((i,y)=>{let c=false,f,K=l=>{c||(c=true,f!==void 0&&clearTimeout(f),i(l));},w=l=>{c||(c=true,f!==void 0&&clearTimeout(f),y(l));},v=http.request({socketPath:r,method:n.method,path:u,headers:{...n.headers,...n.serializedBody!==void 0?{"Content-Length":String(Buffer.byteLength(n.serializedBody))}:{}},timeout:o},l=>{let T=[];l.on("data",R=>{T.push(typeof R=="string"?Buffer.from(R):R);}),l.on("end",()=>{K({status:l.statusCode??0,body:Buffer.concat(T).toString("utf8")});}),l.on("close",()=>{l.complete||w(new t("unreachable",`Unix socket response closed prematurely for ${g(e)}`,{provider:n.provider}));}),l.on("error",R=>{w(new t("unreachable",`Unix socket response failed for ${g(e)}`,{provider:n.provider,cause:R}));});});f=setTimeout(()=>{let l=new Error(`Unix socket request exceeded deadline of ${o}ms`);v.destroy(l),w(new t("unreachable",`Unix socket request timed out for ${g(e)}`,{provider:n.provider,cause:l}));},o),v.on("timeout",()=>{v.destroy(new Error(`Unix socket request timed out after ${o}ms`));}),v.on("error",l=>{w(new t("unreachable",`Unix socket request failed for ${g(e)}`,{provider:n.provider,cause:l}));}),n.serializedBody!==void 0&&v.write(n.serializedBody),v.end();});if(s.status>=300&&s.status<400)throw new t("unreachable",`Unexpected redirect (${s.status}) from ${g(e)}`,{status:s.status,provider:n.provider});if(s.status<200||s.status>=300)throw S(s.status,{provider:n.provider,message:H(s.body,n.token)});return O(s.body,s.status,n.provider)},q=async(e,r={})=>{let n=M(r.timeoutMs,r.provider),o=r.method??"GET",a=r.body!==void 0?JSON.stringify(r.body):void 0,u={Accept:"application/json",...r.token?{Authorization:`Bearer ${r.token}`}:{},...a!==void 0?{"Content-Type":"application/json"}:{},...r.headers};if(r.unixSocketPath&&typeof Bun>"u")return ne(e,r.unixSocketPath,{method:o,headers:u,serializedBody:a,timeoutMs:n,token:r.token,provider:r.provider});let s={method:o,redirect:"error",signal:AbortSignal.timeout(n),headers:u,...a!==void 0?{body:a}:{},...r.unixSocketPath?{unix:r.unixSocketPath}:{}},i;try{i=await fetch(e,s);}catch(c){throw new t("unreachable",`Request to ${g(e)} failed`,{provider:r.provider,cause:c})}if(!i.ok){let c=await i.text().catch(()=>"");throw S(i.status,{provider:r.provider,message:H(c,r.token)})}if(i.status===204)return;let y=await i.text().catch(c=>{throw new t("unreachable","Failed to read response body",{status:i.status,provider:r.provider,cause:c})});return O(y,i.status,r.provider)};var L="https://api.render.com/v1",d=async(e,r,n={},o=L)=>q(`${N(o)}${r}`,{method:n.method??"GET",token:e,body:n.body,provider:"render"}),h=async(e,r,n)=>{await d(e,r,{method:"DELETE"},n).catch(x);};var I="oregon",G="basic_256mb",z="starter",B=100,Y=(e,r)=>new URLSearchParams({name:e,ownerId:r,limit:"20"}).toString(),A=e=>`${e.name}-db`,F=async e=>(await d(e.token,`/postgres?${Y(A(e),e.workspaceId)}`,{},e.apiUrl)).find(r=>r.postgres.name===A(e))?.postgres,V=async e=>(await d(e.token,`/services?${Y(e.name,e.workspaceId)}`,{},e.apiUrl)).find(r=>r.service.name===e.name)?.service,j=async(e,r)=>{let n=[],o=new Set,a;do{let u=new URLSearchParams({limit:String(B),...a?{cursor:a}:{}}),s=await d(e,`/owners?${u}`,{},r);if(!Array.isArray(s))throw new t("provider_unavailable","Render owners response was not an array",{provider:"render"});n.push(...s.map(({owner:y})=>({id:y.id,name:y.name||y.email||y.id})));let i=s.length===B?s.at(-1)?.cursor:void 0;if(i!==void 0){if(o.has(i))throw new t("provider_unavailable","Render owners pagination cursor repeated",{provider:"render"});o.add(i);}a=i;}while(a);return n},oe={provider:"render",fetchWorkspaces:j,provisionDatabase:async e=>{let r=(e.ids.databaseId?{id:e.ids.databaseId}:void 0)??await F(e)??await d(e.token,"/postgres",{method:"POST",body:{name:A(e),ownerId:e.workspaceId,plan:G,version:"17",region:I,databaseName:P,databaseUser:P}},e.apiUrl);return {...e.ids,databaseId:r.id}},fetchDatabaseReadiness:async e=>{let r=encodeURIComponent(p(e.ids.databaseId,"Render databaseId","render")),{status:n}=await d(e.token,`/postgres/${r}`,{},e.apiUrl);if(n==="unavailable"||n==="suspended")throw new t("deploy_failed",`Render Postgres status ${n}`,{provider:"render"});return n==="available"},provisionService:async e=>{let r=(e.ids.serviceId?await d(e.token,`/services/${encodeURIComponent(e.ids.serviceId)}`,{},e.apiUrl):void 0)??await V(e),n;if(r)n=r;else {let o=encodeURIComponent(p(e.ids.databaseId,"Render databaseId","render"));n=(await d(e.token,"/services",{method:"POST",body:{type:"web_service",name:e.name,ownerId:e.workspaceId,image:{ownerId:e.workspaceId,imagePath:`${E}:${e.imageVersion}`},envVars:[{key:"ARCHIVE_SERVER_TOKEN",value:C(e)},{key:"PORT",value:String(U)},{key:"DATABASE_URL",value:(await d(e.token,`/postgres/${o}/connection-info`,{},e.apiUrl)).internalConnectionString}],serviceDetails:{runtime:"image",plan:z,region:I,healthCheckPath:"/health"}}},e.apiUrl)).service;}return {ids:{...e.ids,serviceId:n.id},url:p(n.serviceDetails?.url,"Render service url","render")}},fetchServiceReadiness:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),[n]=await d(e.token,`/services/${r}/deploys?limit=1`,{},e.apiUrl);if(!n)return false;if(m.has(n.deploy.status))throw new t("deploy_failed",`Render deploy ${n.deploy.status}`,{provider:"render"});return n.deploy.status==="live"},fetchServiceFailureStatus:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),[n]=await d(e.token,`/services/${r}/deploys?limit=1`,{},e.apiUrl);return !!(n&&m.has(n.deploy.status))},deployImage:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),n=`${E}:${e.imageVersion}`;await d(e.token,`/services/${r}`,{method:"PATCH",body:{image:{ownerId:e.workspaceId,imagePath:n}}},e.apiUrl);let o=await d(e.token,`/services/${r}/deploys`,{method:"POST",body:{imageUrl:n}},e.apiUrl);return {...e.ids,deploymentId:p(o?.id,"Render deploymentId","render")}},restoreImage:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render"));await d(e.token,`/services/${r}`,{method:"PATCH",body:{image:{ownerId:e.workspaceId,imagePath:`${E}:${e.imageVersion}`}}},e.apiUrl);},fetchImageDeployStatus:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),n=encodeURIComponent(p(e.ids.deploymentId,"Render deploymentId","render")),{status:o}=await d(e.token,`/services/${r}/deploys/${n}`,{},e.apiUrl);return o==="live"?"live":D.has(o)?"failed":"deploying"},destroyService:async e=>{let r=e.ids.serviceId??(await V(e))?.id;r&&await h(e.token,`/services/${encodeURIComponent(r)}`,e.apiUrl);let n=e.ids.databaseId??(await F(e))?.id;n&&await h(e.token,`/postgres/${encodeURIComponent(n)}`,e.apiUrl);}};var k=e=>{if(!e.token)throw new t("authentication_failed","Render API token is required",{provider:"render"});return e.token},te=(e,r)=>e.suspended==="suspended"?"suspended":r?r==="live"?"running":m.has(r)?"failed":r==="deactivated"?"stopped":"starting":"provisioning",J={provider:"render",provisionWorkload:async(e,r)=>{let n=k(e);if(W(r.egressAllowlist,"render"),!e.workspaceId)throw new t("invalid_request","Render workload provisioning requires workspaceId",{provider:"render"});let o=Object.entries({...r.env??{},...r.port?{PORT:String(r.port.internalPort)}:{}}).map(([y,c])=>({key:y,value:c})),a=r.port?.publicHttps?"web_service":"background_worker",u=r.region??I,s=_(r.memoryMb).id,i=await d(n,"/services",{method:"POST",body:{type:a,name:r.name,ownerId:e.workspaceId,image:{ownerId:e.workspaceId,imagePath:r.image},envVars:o,serviceDetails:{runtime:"image",plan:s,region:u,...a==="web_service"&&r.healthcheckPath?{healthCheckPath:r.healthcheckPath}:{},...r.volume?{disk:{name:r.volume.name,mountPath:r.volume.mountPath,sizeGB:r.volume.sizeGb??10}}:{}}}},e.apiUrl);return {provider:"render",workloadId:i.service.id,name:i.service.name,region:i.service.serviceDetails?.region??u,url:i.service.serviceDetails?.url,memoryMb:r.memoryMb,vcpus:r.vcpus,metadata:i.deployId?{deployId:i.deployId}:void 0}},suspendWorkload:async(e,r)=>{let n=k(e);return await d(n,`/services/${encodeURIComponent(r.workloadId)}/suspend`,{method:"POST"},e.apiUrl),r},wakeWorkload:async(e,r)=>{let n=k(e);return await d(n,`/services/${encodeURIComponent(r.workloadId)}/resume`,{method:"POST"},e.apiUrl),r},fetchWorkloadStatus:async(e,r)=>{let n=k(e),o=encodeURIComponent(r.workloadId),a=await d(n,`/services/${o}`,{},e.apiUrl),s=(await d(n,`/services/${o}/deploys?limit=1`,{},e.apiUrl))[0]?.deploy.status;return {provider:"render",workloadId:a.id,state:te(a,s),providerState:a.suspended==="suspended"?"suspended":s??"provisioning",region:a.serviceDetails?.region??r.region,url:a.serviceDetails?.url??r.url,memoryMb:r.memoryMb,vcpus:r.vcpus,updatedAt:new Date().toISOString()}},fetchWorkloadUsage:async(e,r)=>{await J.fetchWorkloadStatus(e,r);let n=new Date().toISOString();return {provider:"render",workloadId:r.workloadId,memoryMb:r.memoryMb??0,vcpus:r.vcpus??0,activeSeconds:0,suspendedSeconds:0,rootfsGb:0,metered:false,windowStartIso:n,windowEndIso:n}},destroyWorkload:async(e,r)=>{let n=k(e);await h(n,`/services/${encodeURIComponent(r.workloadId)}`,e.apiUrl);}};
2
- exports.RENDER_API_URL=L;exports.RENDER_DATABASE_PLAN=G;exports.RENDER_ENDED_DEPLOY_STATUSES=D;exports.RENDER_FAILED_DEPLOY_STATUSES=m;exports.RENDER_PLAN_TIERS=b;exports.RENDER_REGION=I;exports.RENDER_SERVICE_PLAN=z;exports.deleteRenderResource=h;exports.fetchRenderOwners=j;exports.renderArchiveDriver=oe;exports.renderPlanForMemoryMb=_;exports.renderWorkloadDriver=J;exports.sendRenderRequest=d;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunk3V67V3N2_cjs=require('../chunk-3V67V3N2.cjs'),chunkCNAFA6FE_cjs=require('../chunk-CNAFA6FE.cjs');require('../chunk-U5EA4FJI.cjs'),require('../chunk-OHRGTWGZ.cjs'),require('../chunk-QREJ73ZG.cjs');Object.defineProperty(exports,"RENDER_API_URL",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.a}});Object.defineProperty(exports,"RENDER_DATABASE_PLAN",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.e}});Object.defineProperty(exports,"RENDER_REGION",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.d}});Object.defineProperty(exports,"RENDER_SERVICE_PLAN",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.f}});Object.defineProperty(exports,"deleteRenderResource",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.c}});Object.defineProperty(exports,"fetchRenderOwners",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.g}});Object.defineProperty(exports,"renderArchiveDriver",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.h}});Object.defineProperty(exports,"renderWorkloadDriver",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.i}});Object.defineProperty(exports,"sendRenderRequest",{enumerable:true,get:function(){return chunk3V67V3N2_cjs.b}});Object.defineProperty(exports,"RENDER_ENDED_DEPLOY_STATUSES",{enumerable:true,get:function(){return chunkCNAFA6FE_cjs.d}});Object.defineProperty(exports,"RENDER_FAILED_DEPLOY_STATUSES",{enumerable:true,get:function(){return chunkCNAFA6FE_cjs.c}});Object.defineProperty(exports,"RENDER_PLAN_TIERS",{enumerable:true,get:function(){return chunkCNAFA6FE_cjs.a}});Object.defineProperty(exports,"renderPlanForMemoryMb",{enumerable:true,get:function(){return chunkCNAFA6FE_cjs.b}});//# sourceMappingURL=index.cjs.map
3
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/infraError.ts","../../src/core/contracts.ts","../../src/render/renderPlans.ts","../../src/core/infraFetch.ts","../../src/render/renderRequest.ts","../../src/render/renderArchiveDriver.ts","../../src/render/renderWorkloadDriver.ts"],"names":["RETRYABLE_INFRA_ERROR_CODES","InfraError","code","message","details","prefix","infraErrorForStatus","status","isInfraError","error","requireNonEmpty","value","label","provider","ignoreNotFound","assertNoEgressAllowlist","egressAllowlist","ARCHIVE_IMAGE","ARCHIVE_PORT","ARCHIVE_DATABASE","archiveTokenOrThrow","deployment","RENDER_PLAN_TIERS","renderPlanForMemoryMb","memoryMb","tier","RENDER_FAILED_DEPLOY_STATUSES","RENDER_ENDED_DEPLOY_STATUSES","INFRA_REQUEST_TIMEOUT_MS","MAX_ERROR_BODY_CHARS","stripTrailingSlash","url","sanitizeUrlForError","rawUrl","parsed","redactSensitiveText","text","token","sanitized","formatErrorExcerpt","trimmed","validateTimeoutMs","timeoutMs","parseJsonOrEmpty","rawBody","cause","sendUnixSocketHttpRequest","socketPath","options","parsedUrl","requestPath","response","resolve","reject","settled","deadlineTimer","settleResolve","result","settleReject","req","nodeHttpRequest","res","chunks","chunk","timeoutCause","sendInfraRequest","method","serializedBody","headers","init","rawError","RENDER_API_URL","sendRenderRequest","path","apiUrl","deleteRenderResource","RENDER_REGION","RENDER_DATABASE_PLAN","RENDER_SERVICE_PLAN","OWNER_PAGE_SIZE","renderNameQuery","name","ownerId","archiveDatabaseName","fetchRenderDatabaseByName","item","fetchRenderServiceByName","fetchRenderOwners","workspaces","seenCursors","cursor","query","page","owner","nextCursor","renderArchiveDriver","database","databaseId","existing","service","serviceId","latest","imagePath","deploy","deploymentId","requireRenderToken","credentials","mapRenderRuntimeState","latestDeployStatus","renderWorkloadDriver","spec","envVars","key","serviceType","region","plan","created","handle","encodedId","nowIso"],"mappings":"sCAiBA,IAAMA,CAAAA,CAA2D,IAAI,GAAA,CAAI,CACvE,cACA,cAAA,CACA,sBACF,CAAC,CAAA,CAEYC,EAAN,cAAyB,KAAM,CAC3B,IAAA,CACA,OACA,QAAA,CACA,SAAA,CAET,WAAA,CAAYC,CAAAA,CAAsBC,CAAAA,CAAkBC,CAAAA,CAA6B,CAC/E,IAAMC,EAASD,CAAAA,EAAS,QAAA,CAAW,CAAA,CAAA,EAAIA,CAAAA,CAAQ,QAAQ,CAAA,EAAA,CAAA,CAAO,EAAA,CAC9D,KAAA,CAAMD,CAAAA,CAAU,GAAGE,CAAM,CAAA,EAAGF,CAAO,CAAA,CAAA,CAAK,CAAA,EAAGE,CAAM,CAAA,+BAAA,EAAkCH,CAAI,IAAK,CAC1F,KAAA,CAAOE,CAAAA,EAAS,KAClB,CAAC,CAAA,CACD,IAAA,CAAK,IAAA,CAAO,YAAA,CACZ,KAAK,IAAA,CAAOF,CAAAA,CACZ,IAAA,CAAK,MAAA,CAASE,CAAAA,EAAS,MAAA,CACvB,IAAA,CAAK,QAAA,CAAWA,GAAS,QAAA,CACzB,IAAA,CAAK,SAAA,CAAYA,CAAAA,EAAS,WAAaJ,CAAAA,CAA4B,GAAA,CAAIE,CAAI,EAC7E,CACF,CAAA,CAEaI,CAAAA,CAAsB,CACjCC,CAAAA,CACAH,CAAAA,GACe,CACf,IAAMF,CAAAA,CACJK,IAAW,GAAA,EAAOA,CAAAA,GAAW,GAAA,CACzB,uBAAA,CACAA,IAAW,GAAA,CACT,WAAA,CACAA,CAAAA,GAAW,GAAA,CACT,WACAA,CAAAA,GAAW,GAAA,CACT,cAAA,CACAA,CAAAA,GAAW,GAAA,EAAOA,CAA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AAI,IAAA,EAAK,CAAE,WAAA,EACxB,CACF,CAAA,CACA,mBAAoB,MAClBX,CAAAA,CACAW,CAAAA,GAC2B,CAC3B,MAAMR,CAAAA,CAAqB,mBAAA,CAAoBH,CAAAA,CAAaW,CAAM,EAClE,IAAME,CAAAA,CAAS,IAAI,IAAA,EAAK,CAAE,WAAA,EAAY,CACtC,OAAO,CACL,QAAA,CAAU,QAAA,CACV,UAAA,CAAYF,CAAAA,CAAO,WACnB,QAAA,CAAUA,CAAAA,CAAO,QAAA,EAAY,CAAA,CAC7B,MAAOA,CAAAA,CAAO,KAAA,EAAS,CAAA,CACvB,aAAA,CAAe,CAAA,CACf,gBAAA,CAAkB,CAAA,CAClB,QAAA,CAAU,EACV,OAAA,CAAS,KAAA,CACT,cAAA,CAAgBE,CAAAA,CAChB,aAAcA,CAChB,CACF,CAAA,CACA,eAAA,CAAiB,MACfb,CAAAA,CACAW,CAAAA,GACkB,CAClB,IAAMhF,EAAQoE,CAAAA,CAAmBC,CAAW,CAAA,CAC5C,MAAM/B,EACJtC,CAAAA,CACA,CAAA,UAAA,EAAa,kBAAA,CAAmBgF,CAAAA,CAAO,UAAU,CAAC,CAAA,CAAA,CAClDX,CAAAA,CAAY,MACd,EACF,CACF","file":"index.cjs","sourcesContent":["export type InfraErrorCode =\n | 'authentication_failed'\n | 'rate_limited'\n | 'not_found'\n | 'conflict'\n | 'provider_unavailable'\n | 'unreachable'\n | 'invalid_request'\n | 'deploy_failed';\n\nexport type InfraErrorDetails = {\n readonly status?: number;\n readonly provider?: string;\n readonly cause?: unknown;\n readonly retryable?: boolean;\n};\n\nconst RETRYABLE_INFRA_ERROR_CODES: ReadonlySet<InfraErrorCode> = new Set([\n 'unreachable',\n 'rate_limited',\n 'provider_unavailable',\n]);\n\nexport class InfraError extends Error {\n readonly code: InfraErrorCode;\n readonly status?: number;\n readonly provider?: string;\n readonly retryable: boolean;\n\n constructor(code: InfraErrorCode, message?: string, details?: InfraErrorDetails) {\n const prefix = details?.provider ? `[${details.provider}] ` : '';\n super(message ? `${prefix}${message}` : `${prefix}Infrastructure request failed (${code})`, {\n cause: details?.cause,\n });\n this.name = 'InfraError';\n this.code = code;\n this.status = details?.status;\n this.provider = details?.provider;\n this.retryable = details?.retryable ?? RETRYABLE_INFRA_ERROR_CODES.has(code);\n }\n}\n\nexport const infraErrorForStatus = (\n status: number,\n details?: { readonly provider?: string; readonly message?: string },\n): InfraError => {\n const code: InfraErrorCode =\n status === 401 || status === 403\n ? 'authentication_failed'\n : status === 404\n ? 'not_found'\n : status === 409\n ? 'conflict'\n : status === 429\n ? 'rate_limited'\n : status === 400 || status === 422\n ? 'invalid_request'\n : 'provider_unavailable';\n const message = details?.message\n ? `HTTP ${status}: ${details.message}`\n : `HTTP ${status} (${code})`;\n return new InfraError(code, message, { status, provider: details?.provider });\n};\n\nexport const isInfraError = (error: unknown, code?: InfraErrorCode): error is InfraError =>\n error instanceof InfraError && (code === undefined || error.code === code);\n\nexport const requireNonEmpty = (\n value: string | undefined,\n label: string,\n provider?: string,\n): string => {\n if (!value?.trim()) {\n throw new InfraError('invalid_request', `Missing required ${label}`, { provider });\n }\n return value;\n};\n\nexport const ignoreNotFound = (error: unknown): void => {\n if (!isInfraError(error, 'not_found')) throw error;\n};\n\nexport const assertNoEgressAllowlist = (\n egressAllowlist: readonly string[] | undefined,\n provider: string,\n): void => {\n if (egressAllowlist && egressAllowlist.length > 0) {\n throw new InfraError('invalid_request', 'Egress allowlist is not enforced by this driver', {\n provider,\n });\n }\n};\n","import { InfraError } from './infraError.ts';\nimport type { ArchiveHostingProvider, ImplementedInfraProvider } from './providers.ts';\n\nexport const ARCHIVE_IMAGE = 'ghcr.io/inixiative/archive';\nexport const ARCHIVE_PORT = 4700;\nexport const ARCHIVE_DATABASE = 'archive';\n\nexport type WorkloadCpuKind = 'shared' | 'performance';\n\nexport type WorkloadVolumeSpec = {\n readonly name: string;\n readonly mountPath: string;\n readonly sizeGb?: number;\n readonly volumeId?: string;\n readonly hostPath?: string;\n};\n\nexport type WorkloadPortSpec = {\n readonly internalPort: number;\n readonly protocol?: 'tcp' | 'udp';\n readonly publicHttps?: boolean;\n};\n\nexport type WorkloadNetworkInterfaceSpec = {\n readonly ifaceId: string;\n readonly hostDevName: string;\n readonly guestMac?: string;\n};\n\nexport type WorkloadCredentials = {\n readonly token?: string;\n readonly apiUrl?: string;\n readonly unixSocketPath?: string;\n readonly workspaceId?: string;\n readonly appName?: string;\n readonly projectId?: string;\n readonly environmentId?: string;\n};\n\nexport type WorkloadSpec = {\n readonly name: string;\n readonly image: string;\n readonly env?: Readonly<Record<string, string>>;\n readonly memoryMb: number;\n readonly cpuKind?: WorkloadCpuKind;\n readonly vcpus: number;\n readonly region?: string;\n readonly volume?: WorkloadVolumeSpec;\n readonly egressAllowlist?: readonly string[];\n readonly labels?: Readonly<Record<string, string>>;\n readonly port?: WorkloadPortSpec;\n readonly healthcheckPath?: string;\n readonly autoDestroy?: boolean;\n readonly kernelImagePath?: string;\n readonly bootArgs?: string;\n readonly snapshotPath?: string;\n readonly memFilePath?: string;\n readonly trackDirtyPages?: boolean;\n readonly networkInterface?: WorkloadNetworkInterfaceSpec;\n};\n\nexport type WorkloadHandle = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly name?: string;\n readonly region?: string;\n readonly url?: string;\n readonly memoryMb?: number;\n readonly vcpus?: number;\n readonly projectId?: string;\n readonly environmentId?: string;\n readonly appName?: string;\n readonly snapshotPath?: string;\n readonly memFilePath?: string;\n readonly metadata?: Readonly<Record<string, string>>;\n};\n\nexport type WorkloadRuntimeState =\n | 'provisioning'\n | 'starting'\n | 'running'\n | 'suspending'\n | 'suspended'\n | 'stopping'\n | 'stopped'\n | 'destroying'\n | 'destroyed'\n | 'failed'\n | 'unknown';\n\nexport type WorkloadStatus = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly state: WorkloadRuntimeState;\n readonly providerState: string;\n readonly region?: string;\n readonly url?: string;\n readonly memoryMb?: number;\n readonly vcpus?: number;\n readonly updatedAt?: string;\n};\n\nexport type WorkloadUsage = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly memoryMb: number;\n readonly vcpus: number;\n readonly activeSeconds: number;\n readonly suspendedSeconds: number;\n readonly rootfsGb: number;\n readonly metered: boolean;\n readonly windowStartIso: string;\n readonly windowEndIso: string;\n};\n\nexport type WorkloadDriver = {\n readonly provider: ImplementedInfraProvider;\n readonly provisionWorkload: (\n credentials: WorkloadCredentials,\n spec: WorkloadSpec,\n ) => Promise<WorkloadHandle>;\n readonly suspendWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadHandle>;\n readonly wakeWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadHandle>;\n readonly fetchWorkloadStatus: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadStatus>;\n readonly fetchWorkloadUsage: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadUsage>;\n readonly destroyWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<void>;\n};\n\nexport type ArchiveDeploymentIds = {\n readonly projectId?: string;\n readonly environmentId?: string;\n readonly databaseServiceId?: string;\n readonly serviceId?: string;\n readonly databaseId?: string;\n readonly deploymentId?: string;\n};\n\nexport type ArchiveDeployment = {\n readonly apiUrl?: string;\n readonly token: string;\n readonly workspaceId: string;\n readonly name: string;\n readonly imageVersion: string;\n readonly archiveToken?: string;\n readonly ids: ArchiveDeploymentIds;\n};\n\nexport type HostingWorkspace = {\n readonly id: string;\n readonly name: string;\n};\n\nexport type ImageDeployStatus = 'deploying' | 'live' | 'failed';\n\nexport const archiveTokenOrThrow = (deployment: ArchiveDeployment): string => {\n if (!deployment.archiveToken) {\n throw new InfraError('authentication_failed', 'Archive server token is required');\n }\n return deployment.archiveToken;\n};\n\nexport type ArchiveHostingDriver = {\n readonly provider: ArchiveHostingProvider;\n readonly fetchWorkspaces: (token: string, apiUrl?: string) => Promise<HostingWorkspace[]>;\n readonly provisionDatabase: (deployment: ArchiveDeployment) => Promise<ArchiveDeploymentIds>;\n readonly fetchDatabaseReadiness: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly provisionService: (\n deployment: ArchiveDeployment,\n ) => Promise<{ readonly ids: ArchiveDeploymentIds; readonly url: string }>;\n readonly fetchServiceReadiness: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly fetchServiceFailureStatus: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly deployImage: (deployment: ArchiveDeployment) => Promise<ArchiveDeploymentIds>;\n readonly restoreImage: (deployment: ArchiveDeployment) => Promise<void>;\n readonly fetchImageDeployStatus: (deployment: ArchiveDeployment) => Promise<ImageDeployStatus>;\n readonly destroyService: (deployment: ArchiveDeployment) => Promise<void>;\n};\n","export type RenderPlanId = 'starter' | 'standard' | 'pro' | 'pro_plus' | 'pro_max' | 'pro_ultra';\n\nexport type RenderPlanTier = {\n readonly id: RenderPlanId;\n readonly maxMemoryMb: number;\n readonly monthlyUsd: number;\n};\n\nexport const RENDER_PLAN_TIERS: readonly RenderPlanTier[] = [\n { id: 'starter', maxMemoryMb: 512, monthlyUsd: 7 },\n { id: 'standard', maxMemoryMb: 2048, monthlyUsd: 25 },\n { id: 'pro', maxMemoryMb: 4096, monthlyUsd: 85 },\n { id: 'pro_plus', maxMemoryMb: 8192, monthlyUsd: 175 },\n { id: 'pro_max', maxMemoryMb: 16_384, monthlyUsd: 225 },\n { id: 'pro_ultra', maxMemoryMb: 32_768, monthlyUsd: 450 },\n];\n\nexport const renderPlanForMemoryMb = (memoryMb: number): RenderPlanTier => {\n for (const tier of RENDER_PLAN_TIERS) {\n if (memoryMb <= tier.maxMemoryMb) return tier;\n }\n return RENDER_PLAN_TIERS[RENDER_PLAN_TIERS.length - 1];\n};\n\nexport const RENDER_FAILED_DEPLOY_STATUSES: ReadonlySet<string> = new Set([\n 'build_failed',\n 'update_failed',\n 'pre_deploy_failed',\n 'canceled',\n]);\n\nexport const RENDER_ENDED_DEPLOY_STATUSES: ReadonlySet<string> = new Set([\n ...RENDER_FAILED_DEPLOY_STATUSES,\n 'deactivated',\n]);\n","import { request as nodeHttpRequest } from 'node:http';\nimport { InfraError, infraErrorForStatus } from './infraError.ts';\n\nexport const INFRA_REQUEST_TIMEOUT_MS = 30_000;\n\nconst MAX_ERROR_BODY_CHARS = 500;\n\nexport type InfraFetchOptions = {\n readonly method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n readonly token?: string;\n readonly body?: unknown;\n readonly headers?: Readonly<Record<string, string>>;\n readonly timeoutMs?: number;\n readonly unixSocketPath?: string;\n readonly provider?: string;\n};\n\ntype UnixRequestInit = RequestInit & { unix?: string };\n\nexport const stripTrailingSlash = (url: string): string => url.replace(/\\/+$/, '');\n\nconst sanitizeUrlForError = (rawUrl: string): string => {\n try {\n const parsed = new URL(rawUrl);\n return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;\n } catch {\n return rawUrl.split('?')[0]?.split('#')[0] ?? rawUrl;\n }\n};\n\nconst redactSensitiveText = (text: string, token?: string): string => {\n let sanitized = text.replace(/Bearer\\s+[A-Za-z0-9._~+/-]+=*/gi, 'Bearer [REDACTED]');\n if (token && token.length > 0) {\n sanitized = sanitized.split(token).join('[REDACTED]');\n }\n return sanitized;\n};\n\nconst formatErrorExcerpt = (text: string, token?: string): string | undefined => {\n const trimmed = redactSensitiveText(text.trim(), token);\n if (!trimmed) return undefined;\n return trimmed.length > MAX_ERROR_BODY_CHARS\n ? `${trimmed.slice(0, MAX_ERROR_BODY_CHARS)}...`\n : trimmed;\n};\n\nconst validateTimeoutMs = (timeoutMs: number | undefined, provider?: string): number => {\n if (timeoutMs === undefined) return INFRA_REQUEST_TIMEOUT_MS;\n if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {\n throw new InfraError(\n 'invalid_request',\n `timeoutMs must be a finite positive number (got ${timeoutMs})`,\n { provider },\n );\n }\n return timeoutMs;\n};\n\nconst parseJsonOrEmpty = <T>(rawBody: string, status: number, provider?: string): T => {\n if (status === 204 || !rawBody.trim()) return undefined as T;\n try {\n return JSON.parse(rawBody) as T;\n } catch (cause) {\n throw new InfraError('provider_unavailable', 'Provider returned malformed JSON', {\n status,\n provider,\n cause,\n });\n }\n};\n\nexport const sendUnixSocketHttpRequest = async <T = unknown>(\n url: string,\n socketPath: string,\n options: {\n readonly method: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly serializedBody?: string;\n readonly timeoutMs: number;\n readonly token?: string;\n readonly provider?: string;\n },\n): Promise<T> => {\n const timeoutMs = validateTimeoutMs(options.timeoutMs, options.provider);\n\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(url);\n } catch (cause) {\n throw new InfraError('invalid_request', `Invalid request URL: ${sanitizeUrlForError(url)}`, {\n provider: options.provider,\n cause,\n });\n }\n\n const requestPath = `${parsedUrl.pathname}${parsedUrl.search}`;\n const response = await new Promise<{ readonly status: number; readonly body: string }>(\n (resolve, reject) => {\n let settled = false;\n let deadlineTimer: ReturnType<typeof setTimeout> | undefined;\n\n const settleResolve = (result: { readonly status: number; readonly body: string }) => {\n if (settled) return;\n settled = true;\n if (deadlineTimer !== undefined) clearTimeout(deadlineTimer);\n resolve(result);\n };\n\n const settleReject = (error: InfraError) => {\n if (settled) return;\n settled = true;\n if (deadlineTimer !== undefined) clearTimeout(deadlineTimer);\n reject(error);\n };\n\n const req = nodeHttpRequest(\n {\n socketPath,\n method: options.method,\n path: requestPath,\n headers: {\n ...options.headers,\n ...(options.serializedBody !== undefined\n ? { 'Content-Length': String(Buffer.byteLength(options.serializedBody)) }\n : {}),\n },\n timeout: timeoutMs,\n },\n (res) => {\n const chunks: Buffer[] = [];\n res.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n res.on('end', () => {\n settleResolve({\n status: res.statusCode ?? 0,\n body: Buffer.concat(chunks).toString('utf8'),\n });\n });\n res.on('close', () => {\n if (!res.complete) {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket response closed prematurely for ${sanitizeUrlForError(url)}`,\n { provider: options.provider },\n ),\n );\n }\n });\n res.on('error', (cause) => {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket response failed for ${sanitizeUrlForError(url)}`,\n { provider: options.provider, cause },\n ),\n );\n });\n },\n );\n\n deadlineTimer = setTimeout(() => {\n const timeoutCause = new Error(`Unix socket request exceeded deadline of ${timeoutMs}ms`);\n req.destroy(timeoutCause);\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket request timed out for ${sanitizeUrlForError(url)}`,\n { provider: options.provider, cause: timeoutCause },\n ),\n );\n }, timeoutMs);\n\n req.on('timeout', () => {\n req.destroy(new Error(`Unix socket request timed out after ${timeoutMs}ms`));\n });\n req.on('error', (cause) => {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket request failed for ${sanitizeUrlForError(url)}`,\n {\n provider: options.provider,\n cause,\n },\n ),\n );\n });\n\n if (options.serializedBody !== undefined) {\n req.write(options.serializedBody);\n }\n req.end();\n },\n );\n\n if (response.status >= 300 && response.status < 400) {\n throw new InfraError(\n 'unreachable',\n `Unexpected redirect (${response.status}) from ${sanitizeUrlForError(url)}`,\n { status: response.status, provider: options.provider },\n );\n }\n\n if (response.status < 200 || response.status >= 300) {\n throw infraErrorForStatus(response.status, {\n provider: options.provider,\n message: formatErrorExcerpt(response.body, options.token),\n });\n }\n\n return parseJsonOrEmpty<T>(response.body, response.status, options.provider);\n};\n\nexport const sendInfraRequest = async <T = unknown>(\n url: string,\n options: InfraFetchOptions = {},\n): Promise<T> => {\n const timeoutMs = validateTimeoutMs(options.timeoutMs, options.provider);\n const method = options.method ?? 'GET';\n const serializedBody = options.body !== undefined ? JSON.stringify(options.body) : undefined;\n\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...(options.token ? { Authorization: `Bearer ${options.token}` } : {}),\n ...(serializedBody !== undefined ? { 'Content-Type': 'application/json' } : {}),\n ...options.headers,\n };\n\n if (options.unixSocketPath && typeof Bun === 'undefined') {\n return sendUnixSocketHttpRequest<T>(url, options.unixSocketPath, {\n method,\n headers,\n serializedBody,\n timeoutMs,\n token: options.token,\n provider: options.provider,\n });\n }\n\n const init: UnixRequestInit = {\n method,\n redirect: 'error',\n signal: AbortSignal.timeout(timeoutMs),\n headers,\n ...(serializedBody !== undefined ? { body: serializedBody } : {}),\n ...(options.unixSocketPath ? { unix: options.unixSocketPath } : {}),\n };\n\n let response: Response;\n try {\n response = await fetch(url, init);\n } catch (cause) {\n throw new InfraError('unreachable', `Request to ${sanitizeUrlForError(url)} failed`, {\n provider: options.provider,\n cause,\n });\n }\n\n if (!response.ok) {\n const rawError = await response.text().catch(() => '');\n throw infraErrorForStatus(response.status, {\n provider: options.provider,\n message: formatErrorExcerpt(rawError, options.token),\n });\n }\n\n if (response.status === 204) return undefined as T;\n\n const rawBody = await response.text().catch((cause) => {\n throw new InfraError('unreachable', 'Failed to read response body', {\n status: response.status,\n provider: options.provider,\n cause,\n });\n });\n\n return parseJsonOrEmpty<T>(rawBody, response.status, options.provider);\n};\n","import { ignoreNotFound } from '../core/infraError.ts';\nimport { sendInfraRequest, stripTrailingSlash } from '../core/infraFetch.ts';\n\nexport const RENDER_API_URL = 'https://api.render.com/v1';\n\nexport type RenderRequestInit = {\n readonly method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';\n readonly body?: unknown;\n};\n\nexport const sendRenderRequest = async <T>(\n token: string,\n path: string,\n init: RenderRequestInit = {},\n apiUrl = RENDER_API_URL,\n): Promise<T> =>\n sendInfraRequest<T>(`${stripTrailingSlash(apiUrl)}${path}`, {\n method: init.method ?? 'GET',\n token,\n body: init.body,\n provider: 'render',\n });\n\nexport const deleteRenderResource = async (\n token: string,\n path: string,\n apiUrl?: string,\n): Promise<void> => {\n await sendRenderRequest(token, path, { method: 'DELETE' }, apiUrl).catch(ignoreNotFound);\n};\n","import {\n ARCHIVE_DATABASE,\n ARCHIVE_IMAGE,\n ARCHIVE_PORT,\n type ArchiveDeployment,\n type ArchiveHostingDriver,\n archiveTokenOrThrow,\n type HostingWorkspace,\n type ImageDeployStatus,\n} from '../core/contracts.ts';\nimport { InfraError, requireNonEmpty } from '../core/infraError.ts';\nimport { RENDER_ENDED_DEPLOY_STATUSES, RENDER_FAILED_DEPLOY_STATUSES } from './renderPlans.ts';\nimport { deleteRenderResource, sendRenderRequest } from './renderRequest.ts';\n\nexport const RENDER_REGION = 'oregon';\nexport const RENDER_DATABASE_PLAN = 'basic_256mb';\nexport const RENDER_SERVICE_PLAN = 'starter';\n\nconst OWNER_PAGE_SIZE = 100;\n\ntype RenderOwner = { id: string; name?: string | null; email?: string | null };\ntype RenderPostgres = { id: string; name: string; status: string };\ntype RenderService = {\n id: string;\n name: string;\n suspended?: string;\n serviceDetails?: { url?: string };\n};\n\nconst renderNameQuery = (name: string, ownerId: string): string =>\n new URLSearchParams({ name, ownerId, limit: '20' }).toString();\n\nconst archiveDatabaseName = (deployment: ArchiveDeployment): string => `${deployment.name}-db`;\n\nconst fetchRenderDatabaseByName = async (deployment: ArchiveDeployment) =>\n (\n await sendRenderRequest<{ postgres: RenderPostgres }[]>(\n deployment.token,\n `/postgres?${renderNameQuery(archiveDatabaseName(deployment), deployment.workspaceId)}`,\n {},\n deployment.apiUrl,\n )\n ).find((item) => item.postgres.name === archiveDatabaseName(deployment))?.postgres;\n\nconst fetchRenderServiceByName = async (deployment: ArchiveDeployment) =>\n (\n await sendRenderRequest<{ service: RenderService }[]>(\n deployment.token,\n `/services?${renderNameQuery(deployment.name, deployment.workspaceId)}`,\n {},\n deployment.apiUrl,\n )\n ).find((item) => item.service.name === deployment.name)?.service;\n\nexport const fetchRenderOwners = async (\n token: string,\n apiUrl?: string,\n): Promise<HostingWorkspace[]> => {\n const workspaces: HostingWorkspace[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n do {\n const query = new URLSearchParams({\n limit: String(OWNER_PAGE_SIZE),\n ...(cursor ? { cursor } : {}),\n });\n const page = await sendRenderRequest<{ owner: RenderOwner; cursor: string }[]>(\n token,\n `/owners?${query}`,\n {},\n apiUrl,\n );\n if (!Array.isArray(page)) {\n throw new InfraError('provider_unavailable', 'Render owners response was not an array', {\n provider: 'render',\n });\n }\n workspaces.push(\n ...page.map(({ owner }) => ({ id: owner.id, name: owner.name || owner.email || owner.id })),\n );\n const nextCursor = page.length === OWNER_PAGE_SIZE ? page.at(-1)?.cursor : undefined;\n if (nextCursor !== undefined) {\n if (seenCursors.has(nextCursor)) {\n throw new InfraError('provider_unavailable', 'Render owners pagination cursor repeated', {\n provider: 'render',\n });\n }\n seenCursors.add(nextCursor);\n }\n cursor = nextCursor;\n } while (cursor);\n return workspaces;\n};\n\nexport const renderArchiveDriver: ArchiveHostingDriver = {\n provider: 'render',\n fetchWorkspaces: fetchRenderOwners,\n provisionDatabase: async (deployment) => {\n const database =\n (deployment.ids.databaseId ? { id: deployment.ids.databaseId } : undefined) ??\n (await fetchRenderDatabaseByName(deployment)) ??\n (await sendRenderRequest<RenderPostgres>(\n deployment.token,\n '/postgres',\n {\n method: 'POST',\n body: {\n name: archiveDatabaseName(deployment),\n ownerId: deployment.workspaceId,\n plan: RENDER_DATABASE_PLAN,\n version: '17',\n region: RENDER_REGION,\n databaseName: ARCHIVE_DATABASE,\n databaseUser: ARCHIVE_DATABASE,\n },\n },\n deployment.apiUrl,\n ));\n return { ...deployment.ids, databaseId: database.id };\n },\n fetchDatabaseReadiness: async (deployment) => {\n const databaseId = encodeURIComponent(\n requireNonEmpty(deployment.ids.databaseId, 'Render databaseId', 'render'),\n );\n const { status } = await sendRenderRequest<RenderPostgres>(\n deployment.token,\n `/postgres/${databaseId}`,\n {},\n deployment.apiUrl,\n );\n if (status === 'unavailable' || status === 'suspended') {\n throw new InfraError('deploy_failed', `Render Postgres status ${status}`, {\n provider: 'render',\n });\n }\n return status === 'available';\n },\n provisionService: async (deployment) => {\n const existing =\n (deployment.ids.serviceId\n ? await sendRenderRequest<RenderService>(\n deployment.token,\n `/services/${encodeURIComponent(deployment.ids.serviceId)}`,\n {},\n deployment.apiUrl,\n )\n : undefined) ?? (await fetchRenderServiceByName(deployment));\n let service: RenderService;\n if (existing) {\n service = existing;\n } else {\n const databaseId = encodeURIComponent(\n requireNonEmpty(deployment.ids.databaseId, 'Render databaseId', 'render'),\n );\n service = (\n await sendRenderRequest<{ service: RenderService }>(\n deployment.token,\n '/services',\n {\n method: 'POST',\n body: {\n type: 'web_service',\n name: deployment.name,\n ownerId: deployment.workspaceId,\n image: {\n ownerId: deployment.workspaceId,\n imagePath: `${ARCHIVE_IMAGE}:${deployment.imageVersion}`,\n },\n envVars: [\n { key: 'ARCHIVE_SERVER_TOKEN', value: archiveTokenOrThrow(deployment) },\n { key: 'PORT', value: String(ARCHIVE_PORT) },\n {\n key: 'DATABASE_URL',\n value: (\n await sendRenderRequest<{ internalConnectionString: string }>(\n deployment.token,\n `/postgres/${databaseId}/connection-info`,\n {},\n deployment.apiUrl,\n )\n ).internalConnectionString,\n },\n ],\n serviceDetails: {\n runtime: 'image',\n plan: RENDER_SERVICE_PLAN,\n region: RENDER_REGION,\n healthCheckPath: '/health',\n },\n },\n },\n deployment.apiUrl,\n )\n ).service;\n }\n return {\n ids: { ...deployment.ids, serviceId: service.id },\n url: requireNonEmpty(service.serviceDetails?.url, 'Render service url', 'render'),\n };\n },\n fetchServiceReadiness: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const [latest] = await sendRenderRequest<{ deploy: { status: string } }[]>(\n deployment.token,\n `/services/${serviceId}/deploys?limit=1`,\n {},\n deployment.apiUrl,\n );\n if (!latest) return false;\n if (RENDER_FAILED_DEPLOY_STATUSES.has(latest.deploy.status)) {\n throw new InfraError('deploy_failed', `Render deploy ${latest.deploy.status}`, {\n provider: 'render',\n });\n }\n return latest.deploy.status === 'live';\n },\n fetchServiceFailureStatus: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const [latest] = await sendRenderRequest<{ deploy: { status: string } }[]>(\n deployment.token,\n `/services/${serviceId}/deploys?limit=1`,\n {},\n deployment.apiUrl,\n );\n return Boolean(latest && RENDER_FAILED_DEPLOY_STATUSES.has(latest.deploy.status));\n },\n deployImage: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const imagePath = `${ARCHIVE_IMAGE}:${deployment.imageVersion}`;\n await sendRenderRequest(\n deployment.token,\n `/services/${serviceId}`,\n {\n method: 'PATCH',\n body: { image: { ownerId: deployment.workspaceId, imagePath } },\n },\n deployment.apiUrl,\n );\n const deploy = await sendRenderRequest<{ id: string }>(\n deployment.token,\n `/services/${serviceId}/deploys`,\n {\n method: 'POST',\n body: { imageUrl: imagePath },\n },\n deployment.apiUrl,\n );\n return {\n ...deployment.ids,\n deploymentId: requireNonEmpty(deploy?.id, 'Render deploymentId', 'render'),\n };\n },\n restoreImage: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n await sendRenderRequest(\n deployment.token,\n `/services/${serviceId}`,\n {\n method: 'PATCH',\n body: {\n image: {\n ownerId: deployment.workspaceId,\n imagePath: `${ARCHIVE_IMAGE}:${deployment.imageVersion}`,\n },\n },\n },\n deployment.apiUrl,\n );\n },\n fetchImageDeployStatus: async (deployment): Promise<ImageDeployStatus> => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const deploymentId = encodeURIComponent(\n requireNonEmpty(deployment.ids.deploymentId, 'Render deploymentId', 'render'),\n );\n const { status } = await sendRenderRequest<{ status: string }>(\n deployment.token,\n `/services/${serviceId}/deploys/${deploymentId}`,\n {},\n deployment.apiUrl,\n );\n if (status === 'live') return 'live';\n return RENDER_ENDED_DEPLOY_STATUSES.has(status) ? 'failed' : 'deploying';\n },\n destroyService: async (deployment) => {\n const serviceId = deployment.ids.serviceId ?? (await fetchRenderServiceByName(deployment))?.id;\n if (serviceId) {\n await deleteRenderResource(\n deployment.token,\n `/services/${encodeURIComponent(serviceId)}`,\n deployment.apiUrl,\n );\n }\n const databaseId =\n deployment.ids.databaseId ?? (await fetchRenderDatabaseByName(deployment))?.id;\n if (databaseId) {\n await deleteRenderResource(\n deployment.token,\n `/postgres/${encodeURIComponent(databaseId)}`,\n deployment.apiUrl,\n );\n }\n },\n};\n","import type {\n WorkloadCredentials,\n WorkloadDriver,\n WorkloadHandle,\n WorkloadRuntimeState,\n WorkloadSpec,\n WorkloadStatus,\n WorkloadUsage,\n} from '../core/contracts.ts';\nimport { assertNoEgressAllowlist, InfraError } from '../core/infraError.ts';\nimport { RENDER_REGION } from './renderArchiveDriver.ts';\nimport { RENDER_FAILED_DEPLOY_STATUSES, renderPlanForMemoryMb } from './renderPlans.ts';\nimport { deleteRenderResource, sendRenderRequest } from './renderRequest.ts';\n\ntype RenderWorkloadService = {\n id: string;\n name: string;\n suspended?: 'suspended' | 'not_suspended';\n serviceDetails?: {\n url?: string;\n region?: string;\n plan?: string;\n };\n};\n\nconst requireRenderToken = (credentials: WorkloadCredentials): string => {\n if (!credentials.token) {\n throw new InfraError('authentication_failed', 'Render API token is required', {\n provider: 'render',\n });\n }\n return credentials.token;\n};\n\nconst mapRenderRuntimeState = (\n service: RenderWorkloadService,\n latestDeployStatus?: string,\n): WorkloadRuntimeState => {\n if (service.suspended === 'suspended') return 'suspended';\n if (!latestDeployStatus) return 'provisioning';\n if (latestDeployStatus === 'live') return 'running';\n if (RENDER_FAILED_DEPLOY_STATUSES.has(latestDeployStatus)) return 'failed';\n if (latestDeployStatus === 'deactivated') return 'stopped';\n return 'starting';\n};\n\nexport const renderWorkloadDriver: WorkloadDriver = {\n provider: 'render',\n provisionWorkload: async (\n credentials: WorkloadCredentials,\n spec: WorkloadSpec,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n assertNoEgressAllowlist(spec.egressAllowlist, 'render');\n if (!credentials.workspaceId) {\n throw new InfraError('invalid_request', 'Render workload provisioning requires workspaceId', {\n provider: 'render',\n });\n }\n\n const envVars = Object.entries({\n ...(spec.env ?? {}),\n ...(spec.port ? { PORT: String(spec.port.internalPort) } : {}),\n }).map(([key, value]) => ({ key, value }));\n\n const serviceType = spec.port?.publicHttps ? 'web_service' : 'background_worker';\n const region = spec.region ?? RENDER_REGION;\n const plan = renderPlanForMemoryMb(spec.memoryMb).id;\n const created = await sendRenderRequest<{ service: RenderWorkloadService; deployId?: string }>(\n token,\n '/services',\n {\n method: 'POST',\n body: {\n type: serviceType,\n name: spec.name,\n ownerId: credentials.workspaceId,\n image: {\n ownerId: credentials.workspaceId,\n imagePath: spec.image,\n },\n envVars,\n serviceDetails: {\n runtime: 'image',\n plan,\n region,\n ...(serviceType === 'web_service' && spec.healthcheckPath\n ? { healthCheckPath: spec.healthcheckPath }\n : {}),\n ...(spec.volume\n ? {\n disk: {\n name: spec.volume.name,\n mountPath: spec.volume.mountPath,\n sizeGB: spec.volume.sizeGb ?? 10,\n },\n }\n : {}),\n },\n },\n },\n credentials.apiUrl,\n );\n\n return {\n provider: 'render',\n workloadId: created.service.id,\n name: created.service.name,\n region: created.service.serviceDetails?.region ?? region,\n url: created.service.serviceDetails?.url,\n memoryMb: spec.memoryMb,\n vcpus: spec.vcpus,\n metadata: created.deployId ? { deployId: created.deployId } : undefined,\n };\n },\n suspendWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n await sendRenderRequest(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}/suspend`,\n { method: 'POST' },\n credentials.apiUrl,\n );\n return handle;\n },\n wakeWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n await sendRenderRequest(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}/resume`,\n { method: 'POST' },\n credentials.apiUrl,\n );\n return handle;\n },\n fetchWorkloadStatus: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadStatus> => {\n const token = requireRenderToken(credentials);\n const encodedId = encodeURIComponent(handle.workloadId);\n const service = await sendRenderRequest<RenderWorkloadService>(\n token,\n `/services/${encodedId}`,\n {},\n credentials.apiUrl,\n );\n const deploys = await sendRenderRequest<{ deploy: { status: string } }[]>(\n token,\n `/services/${encodedId}/deploys?limit=1`,\n {},\n credentials.apiUrl,\n );\n const latestDeployStatus = deploys[0]?.deploy.status;\n return {\n provider: 'render',\n workloadId: service.id,\n state: mapRenderRuntimeState(service, latestDeployStatus),\n providerState:\n service.suspended === 'suspended' ? 'suspended' : (latestDeployStatus ?? 'provisioning'),\n region: service.serviceDetails?.region ?? handle.region,\n url: service.serviceDetails?.url ?? handle.url,\n memoryMb: handle.memoryMb,\n vcpus: handle.vcpus,\n updatedAt: new Date().toISOString(),\n };\n },\n fetchWorkloadUsage: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadUsage> => {\n await renderWorkloadDriver.fetchWorkloadStatus(credentials, handle);\n const nowIso = new Date().toISOString();\n return {\n provider: 'render',\n workloadId: handle.workloadId,\n memoryMb: handle.memoryMb ?? 0,\n vcpus: handle.vcpus ?? 0,\n activeSeconds: 0,\n suspendedSeconds: 0,\n rootfsGb: 0,\n metered: false,\n windowStartIso: nowIso,\n windowEndIso: nowIso,\n };\n },\n destroyWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<void> => {\n const token = requireRenderToken(credentials);\n await deleteRenderResource(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}`,\n credentials.apiUrl,\n );\n },\n};\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -1,4 +1,4 @@
1
- import { H as HostingWorkspace, a as ArchiveHostingDriver, W as WorkloadDriver } from '../contracts-BxHKiOwj.cjs';
1
+ import { H as HostingWorkspace, a as ArchiveHostingDriver, W as WorkloadDriver } from '../contracts-isQ6Kn09.cjs';
2
2
 
3
3
  declare const RENDER_REGION = "oregon";
4
4
  declare const RENDER_DATABASE_PLAN = "basic_256mb";
@@ -1,4 +1,4 @@
1
- import { H as HostingWorkspace, a as ArchiveHostingDriver, W as WorkloadDriver } from '../contracts-BxHKiOwj.js';
1
+ import { H as HostingWorkspace, a as ArchiveHostingDriver, W as WorkloadDriver } from '../contracts-isQ6Kn09.js';
2
2
 
3
3
  declare const RENDER_REGION = "oregon";
4
4
  declare const RENDER_DATABASE_PLAN = "basic_256mb";
@@ -1,3 +1,2 @@
1
- import {request}from'http';var Q=new Set(["unreachable","rate_limited","provider_unavailable"]),t=class extends Error{code;status;provider;retryable;constructor(r,n,o){let a=o?.provider?`[${o.provider}] `:"";super(n?`${a}${n}`:`${a}Infrastructure request failed (${r})`,{cause:o?.cause}),this.name="InfraError",this.code=r,this.status=o?.status,this.provider=o?.provider,this.retryable=o?.retryable??Q.has(r);}},S=(e,r)=>{let n=e===401||e===403?"authentication_failed":e===404?"not_found":e===409?"conflict":e===429?"rate_limited":e===400||e===422?"invalid_request":"provider_unavailable",o=r?.message?`HTTP ${e}: ${r.message}`:`HTTP ${e} (${n})`;return new t(n,o,{status:e,provider:r?.provider})},Z=(e,r)=>e instanceof t&&(e.code===r),p=(e,r,n)=>{if(!e?.trim())throw new t("invalid_request",`Missing required ${r}`,{provider:n});return e},x=e=>{if(!Z(e,"not_found"))throw e},W=(e,r)=>{if(e&&e.length>0)throw new t("invalid_request","Egress allowlist is not enforced by this driver",{provider:r})};var E="ghcr.io/inixiative/archive",U=4700,P="archive",C=e=>{if(!e.archiveToken)throw new t("authentication_failed","Archive server token is required");return e.archiveToken};var b=[{id:"starter",maxMemoryMb:512,monthlyUsd:7},{id:"standard",maxMemoryMb:2048,monthlyUsd:25},{id:"pro",maxMemoryMb:4096,monthlyUsd:85},{id:"pro_plus",maxMemoryMb:8192,monthlyUsd:175},{id:"pro_max",maxMemoryMb:16384,monthlyUsd:225},{id:"pro_ultra",maxMemoryMb:32768,monthlyUsd:450}],_=e=>{for(let r of b)if(e<=r.maxMemoryMb)return r;return b[b.length-1]},m=new Set(["build_failed","update_failed","pre_deploy_failed","canceled"]),D=new Set([...m,"deactivated"]);var ee=3e4,$=500,N=e=>e.replace(/\/+$/,""),g=e=>{try{let r=new URL(e);return `${r.protocol}//${r.host}${r.pathname}`}catch{return e.split("?")[0]?.split("#")[0]??e}},re=(e,r)=>{let n=e.replace(/Bearer\s+[A-Za-z0-9._~+/-]+=*/gi,"Bearer [REDACTED]");return r&&r.length>0&&(n=n.split(r).join("[REDACTED]")),n},H=(e,r)=>{let n=re(e.trim(),r);if(n)return n.length>$?`${n.slice(0,$)}...`:n},M=(e,r)=>{if(e===void 0)return ee;if(!Number.isFinite(e)||e<=0)throw new t("invalid_request",`timeoutMs must be a finite positive number (got ${e})`,{provider:r});return e},O=(e,r,n)=>{if(!(r===204||!e.trim()))try{return JSON.parse(e)}catch(o){throw new t("provider_unavailable","Provider returned malformed JSON",{status:r,provider:n,cause:o})}},ne=async(e,r,n)=>{let o=M(n.timeoutMs,n.provider),a;try{a=new URL(e);}catch(i){throw new t("invalid_request",`Invalid request URL: ${g(e)}`,{provider:n.provider,cause:i})}let u=`${a.pathname}${a.search}`,s=await new Promise((i,y)=>{let c=false,f,K=l=>{c||(c=true,f!==void 0&&clearTimeout(f),i(l));},w=l=>{c||(c=true,f!==void 0&&clearTimeout(f),y(l));},v=request({socketPath:r,method:n.method,path:u,headers:{...n.headers,...n.serializedBody!==void 0?{"Content-Length":String(Buffer.byteLength(n.serializedBody))}:{}},timeout:o},l=>{let T=[];l.on("data",R=>{T.push(typeof R=="string"?Buffer.from(R):R);}),l.on("end",()=>{K({status:l.statusCode??0,body:Buffer.concat(T).toString("utf8")});}),l.on("close",()=>{l.complete||w(new t("unreachable",`Unix socket response closed prematurely for ${g(e)}`,{provider:n.provider}));}),l.on("error",R=>{w(new t("unreachable",`Unix socket response failed for ${g(e)}`,{provider:n.provider,cause:R}));});});f=setTimeout(()=>{let l=new Error(`Unix socket request exceeded deadline of ${o}ms`);v.destroy(l),w(new t("unreachable",`Unix socket request timed out for ${g(e)}`,{provider:n.provider,cause:l}));},o),v.on("timeout",()=>{v.destroy(new Error(`Unix socket request timed out after ${o}ms`));}),v.on("error",l=>{w(new t("unreachable",`Unix socket request failed for ${g(e)}`,{provider:n.provider,cause:l}));}),n.serializedBody!==void 0&&v.write(n.serializedBody),v.end();});if(s.status>=300&&s.status<400)throw new t("unreachable",`Unexpected redirect (${s.status}) from ${g(e)}`,{status:s.status,provider:n.provider});if(s.status<200||s.status>=300)throw S(s.status,{provider:n.provider,message:H(s.body,n.token)});return O(s.body,s.status,n.provider)},q=async(e,r={})=>{let n=M(r.timeoutMs,r.provider),o=r.method??"GET",a=r.body!==void 0?JSON.stringify(r.body):void 0,u={Accept:"application/json",...r.token?{Authorization:`Bearer ${r.token}`}:{},...a!==void 0?{"Content-Type":"application/json"}:{},...r.headers};if(r.unixSocketPath&&typeof Bun>"u")return ne(e,r.unixSocketPath,{method:o,headers:u,serializedBody:a,timeoutMs:n,token:r.token,provider:r.provider});let s={method:o,redirect:"error",signal:AbortSignal.timeout(n),headers:u,...a!==void 0?{body:a}:{},...r.unixSocketPath?{unix:r.unixSocketPath}:{}},i;try{i=await fetch(e,s);}catch(c){throw new t("unreachable",`Request to ${g(e)} failed`,{provider:r.provider,cause:c})}if(!i.ok){let c=await i.text().catch(()=>"");throw S(i.status,{provider:r.provider,message:H(c,r.token)})}if(i.status===204)return;let y=await i.text().catch(c=>{throw new t("unreachable","Failed to read response body",{status:i.status,provider:r.provider,cause:c})});return O(y,i.status,r.provider)};var L="https://api.render.com/v1",d=async(e,r,n={},o=L)=>q(`${N(o)}${r}`,{method:n.method??"GET",token:e,body:n.body,provider:"render"}),h=async(e,r,n)=>{await d(e,r,{method:"DELETE"},n).catch(x);};var I="oregon",G="basic_256mb",z="starter",B=100,Y=(e,r)=>new URLSearchParams({name:e,ownerId:r,limit:"20"}).toString(),A=e=>`${e.name}-db`,F=async e=>(await d(e.token,`/postgres?${Y(A(e),e.workspaceId)}`,{},e.apiUrl)).find(r=>r.postgres.name===A(e))?.postgres,V=async e=>(await d(e.token,`/services?${Y(e.name,e.workspaceId)}`,{},e.apiUrl)).find(r=>r.service.name===e.name)?.service,j=async(e,r)=>{let n=[],o=new Set,a;do{let u=new URLSearchParams({limit:String(B),...a?{cursor:a}:{}}),s=await d(e,`/owners?${u}`,{},r);if(!Array.isArray(s))throw new t("provider_unavailable","Render owners response was not an array",{provider:"render"});n.push(...s.map(({owner:y})=>({id:y.id,name:y.name||y.email||y.id})));let i=s.length===B?s.at(-1)?.cursor:void 0;if(i!==void 0){if(o.has(i))throw new t("provider_unavailable","Render owners pagination cursor repeated",{provider:"render"});o.add(i);}a=i;}while(a);return n},oe={provider:"render",fetchWorkspaces:j,provisionDatabase:async e=>{let r=(e.ids.databaseId?{id:e.ids.databaseId}:void 0)??await F(e)??await d(e.token,"/postgres",{method:"POST",body:{name:A(e),ownerId:e.workspaceId,plan:G,version:"17",region:I,databaseName:P,databaseUser:P}},e.apiUrl);return {...e.ids,databaseId:r.id}},fetchDatabaseReadiness:async e=>{let r=encodeURIComponent(p(e.ids.databaseId,"Render databaseId","render")),{status:n}=await d(e.token,`/postgres/${r}`,{},e.apiUrl);if(n==="unavailable"||n==="suspended")throw new t("deploy_failed",`Render Postgres status ${n}`,{provider:"render"});return n==="available"},provisionService:async e=>{let r=(e.ids.serviceId?await d(e.token,`/services/${encodeURIComponent(e.ids.serviceId)}`,{},e.apiUrl):void 0)??await V(e),n;if(r)n=r;else {let o=encodeURIComponent(p(e.ids.databaseId,"Render databaseId","render"));n=(await d(e.token,"/services",{method:"POST",body:{type:"web_service",name:e.name,ownerId:e.workspaceId,image:{ownerId:e.workspaceId,imagePath:`${E}:${e.imageVersion}`},envVars:[{key:"ARCHIVE_SERVER_TOKEN",value:C(e)},{key:"PORT",value:String(U)},{key:"DATABASE_URL",value:(await d(e.token,`/postgres/${o}/connection-info`,{},e.apiUrl)).internalConnectionString}],serviceDetails:{runtime:"image",plan:z,region:I,healthCheckPath:"/health"}}},e.apiUrl)).service;}return {ids:{...e.ids,serviceId:n.id},url:p(n.serviceDetails?.url,"Render service url","render")}},fetchServiceReadiness:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),[n]=await d(e.token,`/services/${r}/deploys?limit=1`,{},e.apiUrl);if(!n)return false;if(m.has(n.deploy.status))throw new t("deploy_failed",`Render deploy ${n.deploy.status}`,{provider:"render"});return n.deploy.status==="live"},fetchServiceFailureStatus:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),[n]=await d(e.token,`/services/${r}/deploys?limit=1`,{},e.apiUrl);return !!(n&&m.has(n.deploy.status))},deployImage:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),n=`${E}:${e.imageVersion}`;await d(e.token,`/services/${r}`,{method:"PATCH",body:{image:{ownerId:e.workspaceId,imagePath:n}}},e.apiUrl);let o=await d(e.token,`/services/${r}/deploys`,{method:"POST",body:{imageUrl:n}},e.apiUrl);return {...e.ids,deploymentId:p(o?.id,"Render deploymentId","render")}},restoreImage:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render"));await d(e.token,`/services/${r}`,{method:"PATCH",body:{image:{ownerId:e.workspaceId,imagePath:`${E}:${e.imageVersion}`}}},e.apiUrl);},fetchImageDeployStatus:async e=>{let r=encodeURIComponent(p(e.ids.serviceId,"Render serviceId","render")),n=encodeURIComponent(p(e.ids.deploymentId,"Render deploymentId","render")),{status:o}=await d(e.token,`/services/${r}/deploys/${n}`,{},e.apiUrl);return o==="live"?"live":D.has(o)?"failed":"deploying"},destroyService:async e=>{let r=e.ids.serviceId??(await V(e))?.id;r&&await h(e.token,`/services/${encodeURIComponent(r)}`,e.apiUrl);let n=e.ids.databaseId??(await F(e))?.id;n&&await h(e.token,`/postgres/${encodeURIComponent(n)}`,e.apiUrl);}};var k=e=>{if(!e.token)throw new t("authentication_failed","Render API token is required",{provider:"render"});return e.token},te=(e,r)=>e.suspended==="suspended"?"suspended":r?r==="live"?"running":m.has(r)?"failed":r==="deactivated"?"stopped":"starting":"provisioning",J={provider:"render",provisionWorkload:async(e,r)=>{let n=k(e);if(W(r.egressAllowlist,"render"),!e.workspaceId)throw new t("invalid_request","Render workload provisioning requires workspaceId",{provider:"render"});let o=Object.entries({...r.env??{},...r.port?{PORT:String(r.port.internalPort)}:{}}).map(([y,c])=>({key:y,value:c})),a=r.port?.publicHttps?"web_service":"background_worker",u=r.region??I,s=_(r.memoryMb).id,i=await d(n,"/services",{method:"POST",body:{type:a,name:r.name,ownerId:e.workspaceId,image:{ownerId:e.workspaceId,imagePath:r.image},envVars:o,serviceDetails:{runtime:"image",plan:s,region:u,...a==="web_service"&&r.healthcheckPath?{healthCheckPath:r.healthcheckPath}:{},...r.volume?{disk:{name:r.volume.name,mountPath:r.volume.mountPath,sizeGB:r.volume.sizeGb??10}}:{}}}},e.apiUrl);return {provider:"render",workloadId:i.service.id,name:i.service.name,region:i.service.serviceDetails?.region??u,url:i.service.serviceDetails?.url,memoryMb:r.memoryMb,vcpus:r.vcpus,metadata:i.deployId?{deployId:i.deployId}:void 0}},suspendWorkload:async(e,r)=>{let n=k(e);return await d(n,`/services/${encodeURIComponent(r.workloadId)}/suspend`,{method:"POST"},e.apiUrl),r},wakeWorkload:async(e,r)=>{let n=k(e);return await d(n,`/services/${encodeURIComponent(r.workloadId)}/resume`,{method:"POST"},e.apiUrl),r},fetchWorkloadStatus:async(e,r)=>{let n=k(e),o=encodeURIComponent(r.workloadId),a=await d(n,`/services/${o}`,{},e.apiUrl),s=(await d(n,`/services/${o}/deploys?limit=1`,{},e.apiUrl))[0]?.deploy.status;return {provider:"render",workloadId:a.id,state:te(a,s),providerState:a.suspended==="suspended"?"suspended":s??"provisioning",region:a.serviceDetails?.region??r.region,url:a.serviceDetails?.url??r.url,memoryMb:r.memoryMb,vcpus:r.vcpus,updatedAt:new Date().toISOString()}},fetchWorkloadUsage:async(e,r)=>{await J.fetchWorkloadStatus(e,r);let n=new Date().toISOString();return {provider:"render",workloadId:r.workloadId,memoryMb:r.memoryMb??0,vcpus:r.vcpus??0,activeSeconds:0,suspendedSeconds:0,rootfsGb:0,metered:false,windowStartIso:n,windowEndIso:n}},destroyWorkload:async(e,r)=>{let n=k(e);await h(n,`/services/${encodeURIComponent(r.workloadId)}`,e.apiUrl);}};
2
- export{L as RENDER_API_URL,G as RENDER_DATABASE_PLAN,D as RENDER_ENDED_DEPLOY_STATUSES,m as RENDER_FAILED_DEPLOY_STATUSES,b as RENDER_PLAN_TIERS,I as RENDER_REGION,z as RENDER_SERVICE_PLAN,h as deleteRenderResource,j as fetchRenderOwners,oe as renderArchiveDriver,_ as renderPlanForMemoryMb,J as renderWorkloadDriver,d as sendRenderRequest};//# sourceMappingURL=index.js.map
1
+ export{a as RENDER_API_URL,e as RENDER_DATABASE_PLAN,d as RENDER_REGION,f as RENDER_SERVICE_PLAN,c as deleteRenderResource,g as fetchRenderOwners,h as renderArchiveDriver,i as renderWorkloadDriver,b as sendRenderRequest}from'../chunk-MXJ4EW3I.js';export{d as RENDER_ENDED_DEPLOY_STATUSES,c as RENDER_FAILED_DEPLOY_STATUSES,a as RENDER_PLAN_TIERS,b as renderPlanForMemoryMb}from'../chunk-55HNIEAS.js';import'../chunk-UZUGSMDK.js';import'../chunk-NGWNYW3U.js';import'../chunk-S47XOR4G.js';//# sourceMappingURL=index.js.map
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/infraError.ts","../../src/core/contracts.ts","../../src/render/renderPlans.ts","../../src/core/infraFetch.ts","../../src/render/renderRequest.ts","../../src/render/renderArchiveDriver.ts","../../src/render/renderWorkloadDriver.ts"],"names":["RETRYABLE_INFRA_ERROR_CODES","InfraError","code","message","details","prefix","infraErrorForStatus","status","isInfraError","error","requireNonEmpty","value","label","provider","ignoreNotFound","assertNoEgressAllowlist","egressAllowlist","ARCHIVE_IMAGE","ARCHIVE_PORT","ARCHIVE_DATABASE","archiveTokenOrThrow","deployment","RENDER_PLAN_TIERS","renderPlanForMemoryMb","memoryMb","tier","RENDER_FAILED_DEPLOY_STATUSES","RENDER_ENDED_DEPLOY_STATUSES","INFRA_REQUEST_TIMEOUT_MS","MAX_ERROR_BODY_CHARS","stripTrailingSlash","url","sanitizeUrlForError","rawUrl","parsed","redactSensitiveText","text","token","sanitized","formatErrorExcerpt","trimmed","validateTimeoutMs","timeoutMs","parseJsonOrEmpty","rawBody","cause","sendUnixSocketHttpRequest","socketPath","options","parsedUrl","requestPath","response","resolve","reject","settled","deadlineTimer","settleResolve","result","settleReject","req","nodeHttpRequest","res","chunks","chunk","timeoutCause","sendInfraRequest","method","serializedBody","headers","init","rawError","RENDER_API_URL","sendRenderRequest","path","apiUrl","deleteRenderResource","RENDER_REGION","RENDER_DATABASE_PLAN","RENDER_SERVICE_PLAN","OWNER_PAGE_SIZE","renderNameQuery","name","ownerId","archiveDatabaseName","fetchRenderDatabaseByName","item","fetchRenderServiceByName","fetchRenderOwners","workspaces","seenCursors","cursor","query","page","owner","nextCursor","renderArchiveDriver","database","databaseId","existing","service","serviceId","latest","imagePath","deploy","deploymentId","requireRenderToken","credentials","mapRenderRuntimeState","latestDeployStatus","renderWorkloadDriver","spec","envVars","key","serviceType","region","plan","created","handle","encodedId","nowIso"],"mappings":"2BAiBA,IAAMA,CAAAA,CAA2D,IAAI,GAAA,CAAI,CACvE,cACA,cAAA,CACA,sBACF,CAAC,CAAA,CAEYC,EAAN,cAAyB,KAAM,CAC3B,IAAA,CACA,OACA,QAAA,CACA,SAAA,CA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AC7B,MAAOA,CAAAA,CAAO,KAAA,EAAS,CAAA,CACvB,aAAA,CAAe,CAAA,CACf,gBAAA,CAAkB,CAAA,CAClB,QAAA,CAAU,EACV,OAAA,CAAS,KAAA,CACT,cAAA,CAAgBE,CAAAA,CAChB,aAAcA,CAChB,CACF,CAAA,CACA,eAAA,CAAiB,MACfb,CAAAA,CACAW,CAAAA,GACkB,CAClB,IAAMhF,EAAQoE,CAAAA,CAAmBC,CAAW,CAAA,CAC5C,MAAM/B,EACJtC,CAAAA,CACA,CAAA,UAAA,EAAa,kBAAA,CAAmBgF,CAAAA,CAAO,UAAU,CAAC,CAAA,CAAA,CAClDX,CAAAA,CAAY,MACd,EACF,CACF","file":"index.js","sourcesContent":["export type InfraErrorCode =\n | 'authentication_failed'\n | 'rate_limited'\n | 'not_found'\n | 'conflict'\n | 'provider_unavailable'\n | 'unreachable'\n | 'invalid_request'\n | 'deploy_failed';\n\nexport type InfraErrorDetails = {\n readonly status?: number;\n readonly provider?: string;\n readonly cause?: unknown;\n readonly retryable?: boolean;\n};\n\nconst RETRYABLE_INFRA_ERROR_CODES: ReadonlySet<InfraErrorCode> = new Set([\n 'unreachable',\n 'rate_limited',\n 'provider_unavailable',\n]);\n\nexport class InfraError extends Error {\n readonly code: InfraErrorCode;\n readonly status?: number;\n readonly provider?: string;\n readonly retryable: boolean;\n\n constructor(code: InfraErrorCode, message?: string, details?: InfraErrorDetails) {\n const prefix = details?.provider ? `[${details.provider}] ` : '';\n super(message ? `${prefix}${message}` : `${prefix}Infrastructure request failed (${code})`, {\n cause: details?.cause,\n });\n this.name = 'InfraError';\n this.code = code;\n this.status = details?.status;\n this.provider = details?.provider;\n this.retryable = details?.retryable ?? RETRYABLE_INFRA_ERROR_CODES.has(code);\n }\n}\n\nexport const infraErrorForStatus = (\n status: number,\n details?: { readonly provider?: string; readonly message?: string },\n): InfraError => {\n const code: InfraErrorCode =\n status === 401 || status === 403\n ? 'authentication_failed'\n : status === 404\n ? 'not_found'\n : status === 409\n ? 'conflict'\n : status === 429\n ? 'rate_limited'\n : status === 400 || status === 422\n ? 'invalid_request'\n : 'provider_unavailable';\n const message = details?.message\n ? `HTTP ${status}: ${details.message}`\n : `HTTP ${status} (${code})`;\n return new InfraError(code, message, { status, provider: details?.provider });\n};\n\nexport const isInfraError = (error: unknown, code?: InfraErrorCode): error is InfraError =>\n error instanceof InfraError && (code === undefined || error.code === code);\n\nexport const requireNonEmpty = (\n value: string | undefined,\n label: string,\n provider?: string,\n): string => {\n if (!value?.trim()) {\n throw new InfraError('invalid_request', `Missing required ${label}`, { provider });\n }\n return value;\n};\n\nexport const ignoreNotFound = (error: unknown): void => {\n if (!isInfraError(error, 'not_found')) throw error;\n};\n\nexport const assertNoEgressAllowlist = (\n egressAllowlist: readonly string[] | undefined,\n provider: string,\n): void => {\n if (egressAllowlist && egressAllowlist.length > 0) {\n throw new InfraError('invalid_request', 'Egress allowlist is not enforced by this driver', {\n provider,\n });\n }\n};\n","import { InfraError } from './infraError.ts';\nimport type { ArchiveHostingProvider, ImplementedInfraProvider } from './providers.ts';\n\nexport const ARCHIVE_IMAGE = 'ghcr.io/inixiative/archive';\nexport const ARCHIVE_PORT = 4700;\nexport const ARCHIVE_DATABASE = 'archive';\n\nexport type WorkloadCpuKind = 'shared' | 'performance';\n\nexport type WorkloadVolumeSpec = {\n readonly name: string;\n readonly mountPath: string;\n readonly sizeGb?: number;\n readonly volumeId?: string;\n readonly hostPath?: string;\n};\n\nexport type WorkloadPortSpec = {\n readonly internalPort: number;\n readonly protocol?: 'tcp' | 'udp';\n readonly publicHttps?: boolean;\n};\n\nexport type WorkloadNetworkInterfaceSpec = {\n readonly ifaceId: string;\n readonly hostDevName: string;\n readonly guestMac?: string;\n};\n\nexport type WorkloadCredentials = {\n readonly token?: string;\n readonly apiUrl?: string;\n readonly unixSocketPath?: string;\n readonly workspaceId?: string;\n readonly appName?: string;\n readonly projectId?: string;\n readonly environmentId?: string;\n};\n\nexport type WorkloadSpec = {\n readonly name: string;\n readonly image: string;\n readonly env?: Readonly<Record<string, string>>;\n readonly memoryMb: number;\n readonly cpuKind?: WorkloadCpuKind;\n readonly vcpus: number;\n readonly region?: string;\n readonly volume?: WorkloadVolumeSpec;\n readonly egressAllowlist?: readonly string[];\n readonly labels?: Readonly<Record<string, string>>;\n readonly port?: WorkloadPortSpec;\n readonly healthcheckPath?: string;\n readonly autoDestroy?: boolean;\n readonly kernelImagePath?: string;\n readonly bootArgs?: string;\n readonly snapshotPath?: string;\n readonly memFilePath?: string;\n readonly trackDirtyPages?: boolean;\n readonly networkInterface?: WorkloadNetworkInterfaceSpec;\n};\n\nexport type WorkloadHandle = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly name?: string;\n readonly region?: string;\n readonly url?: string;\n readonly memoryMb?: number;\n readonly vcpus?: number;\n readonly projectId?: string;\n readonly environmentId?: string;\n readonly appName?: string;\n readonly snapshotPath?: string;\n readonly memFilePath?: string;\n readonly metadata?: Readonly<Record<string, string>>;\n};\n\nexport type WorkloadRuntimeState =\n | 'provisioning'\n | 'starting'\n | 'running'\n | 'suspending'\n | 'suspended'\n | 'stopping'\n | 'stopped'\n | 'destroying'\n | 'destroyed'\n | 'failed'\n | 'unknown';\n\nexport type WorkloadStatus = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly state: WorkloadRuntimeState;\n readonly providerState: string;\n readonly region?: string;\n readonly url?: string;\n readonly memoryMb?: number;\n readonly vcpus?: number;\n readonly updatedAt?: string;\n};\n\nexport type WorkloadUsage = {\n readonly provider: ImplementedInfraProvider;\n readonly workloadId: string;\n readonly memoryMb: number;\n readonly vcpus: number;\n readonly activeSeconds: number;\n readonly suspendedSeconds: number;\n readonly rootfsGb: number;\n readonly metered: boolean;\n readonly windowStartIso: string;\n readonly windowEndIso: string;\n};\n\nexport type WorkloadDriver = {\n readonly provider: ImplementedInfraProvider;\n readonly provisionWorkload: (\n credentials: WorkloadCredentials,\n spec: WorkloadSpec,\n ) => Promise<WorkloadHandle>;\n readonly suspendWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadHandle>;\n readonly wakeWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadHandle>;\n readonly fetchWorkloadStatus: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadStatus>;\n readonly fetchWorkloadUsage: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<WorkloadUsage>;\n readonly destroyWorkload: (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ) => Promise<void>;\n};\n\nexport type ArchiveDeploymentIds = {\n readonly projectId?: string;\n readonly environmentId?: string;\n readonly databaseServiceId?: string;\n readonly serviceId?: string;\n readonly databaseId?: string;\n readonly deploymentId?: string;\n};\n\nexport type ArchiveDeployment = {\n readonly apiUrl?: string;\n readonly token: string;\n readonly workspaceId: string;\n readonly name: string;\n readonly imageVersion: string;\n readonly archiveToken?: string;\n readonly ids: ArchiveDeploymentIds;\n};\n\nexport type HostingWorkspace = {\n readonly id: string;\n readonly name: string;\n};\n\nexport type ImageDeployStatus = 'deploying' | 'live' | 'failed';\n\nexport const archiveTokenOrThrow = (deployment: ArchiveDeployment): string => {\n if (!deployment.archiveToken) {\n throw new InfraError('authentication_failed', 'Archive server token is required');\n }\n return deployment.archiveToken;\n};\n\nexport type ArchiveHostingDriver = {\n readonly provider: ArchiveHostingProvider;\n readonly fetchWorkspaces: (token: string, apiUrl?: string) => Promise<HostingWorkspace[]>;\n readonly provisionDatabase: (deployment: ArchiveDeployment) => Promise<ArchiveDeploymentIds>;\n readonly fetchDatabaseReadiness: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly provisionService: (\n deployment: ArchiveDeployment,\n ) => Promise<{ readonly ids: ArchiveDeploymentIds; readonly url: string }>;\n readonly fetchServiceReadiness: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly fetchServiceFailureStatus: (deployment: ArchiveDeployment) => Promise<boolean>;\n readonly deployImage: (deployment: ArchiveDeployment) => Promise<ArchiveDeploymentIds>;\n readonly restoreImage: (deployment: ArchiveDeployment) => Promise<void>;\n readonly fetchImageDeployStatus: (deployment: ArchiveDeployment) => Promise<ImageDeployStatus>;\n readonly destroyService: (deployment: ArchiveDeployment) => Promise<void>;\n};\n","export type RenderPlanId = 'starter' | 'standard' | 'pro' | 'pro_plus' | 'pro_max' | 'pro_ultra';\n\nexport type RenderPlanTier = {\n readonly id: RenderPlanId;\n readonly maxMemoryMb: number;\n readonly monthlyUsd: number;\n};\n\nexport const RENDER_PLAN_TIERS: readonly RenderPlanTier[] = [\n { id: 'starter', maxMemoryMb: 512, monthlyUsd: 7 },\n { id: 'standard', maxMemoryMb: 2048, monthlyUsd: 25 },\n { id: 'pro', maxMemoryMb: 4096, monthlyUsd: 85 },\n { id: 'pro_plus', maxMemoryMb: 8192, monthlyUsd: 175 },\n { id: 'pro_max', maxMemoryMb: 16_384, monthlyUsd: 225 },\n { id: 'pro_ultra', maxMemoryMb: 32_768, monthlyUsd: 450 },\n];\n\nexport const renderPlanForMemoryMb = (memoryMb: number): RenderPlanTier => {\n for (const tier of RENDER_PLAN_TIERS) {\n if (memoryMb <= tier.maxMemoryMb) return tier;\n }\n return RENDER_PLAN_TIERS[RENDER_PLAN_TIERS.length - 1];\n};\n\nexport const RENDER_FAILED_DEPLOY_STATUSES: ReadonlySet<string> = new Set([\n 'build_failed',\n 'update_failed',\n 'pre_deploy_failed',\n 'canceled',\n]);\n\nexport const RENDER_ENDED_DEPLOY_STATUSES: ReadonlySet<string> = new Set([\n ...RENDER_FAILED_DEPLOY_STATUSES,\n 'deactivated',\n]);\n","import { request as nodeHttpRequest } from 'node:http';\nimport { InfraError, infraErrorForStatus } from './infraError.ts';\n\nexport const INFRA_REQUEST_TIMEOUT_MS = 30_000;\n\nconst MAX_ERROR_BODY_CHARS = 500;\n\nexport type InfraFetchOptions = {\n readonly method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n readonly token?: string;\n readonly body?: unknown;\n readonly headers?: Readonly<Record<string, string>>;\n readonly timeoutMs?: number;\n readonly unixSocketPath?: string;\n readonly provider?: string;\n};\n\ntype UnixRequestInit = RequestInit & { unix?: string };\n\nexport const stripTrailingSlash = (url: string): string => url.replace(/\\/+$/, '');\n\nconst sanitizeUrlForError = (rawUrl: string): string => {\n try {\n const parsed = new URL(rawUrl);\n return `${parsed.protocol}//${parsed.host}${parsed.pathname}`;\n } catch {\n return rawUrl.split('?')[0]?.split('#')[0] ?? rawUrl;\n }\n};\n\nconst redactSensitiveText = (text: string, token?: string): string => {\n let sanitized = text.replace(/Bearer\\s+[A-Za-z0-9._~+/-]+=*/gi, 'Bearer [REDACTED]');\n if (token && token.length > 0) {\n sanitized = sanitized.split(token).join('[REDACTED]');\n }\n return sanitized;\n};\n\nconst formatErrorExcerpt = (text: string, token?: string): string | undefined => {\n const trimmed = redactSensitiveText(text.trim(), token);\n if (!trimmed) return undefined;\n return trimmed.length > MAX_ERROR_BODY_CHARS\n ? `${trimmed.slice(0, MAX_ERROR_BODY_CHARS)}...`\n : trimmed;\n};\n\nconst validateTimeoutMs = (timeoutMs: number | undefined, provider?: string): number => {\n if (timeoutMs === undefined) return INFRA_REQUEST_TIMEOUT_MS;\n if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {\n throw new InfraError(\n 'invalid_request',\n `timeoutMs must be a finite positive number (got ${timeoutMs})`,\n { provider },\n );\n }\n return timeoutMs;\n};\n\nconst parseJsonOrEmpty = <T>(rawBody: string, status: number, provider?: string): T => {\n if (status === 204 || !rawBody.trim()) return undefined as T;\n try {\n return JSON.parse(rawBody) as T;\n } catch (cause) {\n throw new InfraError('provider_unavailable', 'Provider returned malformed JSON', {\n status,\n provider,\n cause,\n });\n }\n};\n\nexport const sendUnixSocketHttpRequest = async <T = unknown>(\n url: string,\n socketPath: string,\n options: {\n readonly method: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly serializedBody?: string;\n readonly timeoutMs: number;\n readonly token?: string;\n readonly provider?: string;\n },\n): Promise<T> => {\n const timeoutMs = validateTimeoutMs(options.timeoutMs, options.provider);\n\n let parsedUrl: URL;\n try {\n parsedUrl = new URL(url);\n } catch (cause) {\n throw new InfraError('invalid_request', `Invalid request URL: ${sanitizeUrlForError(url)}`, {\n provider: options.provider,\n cause,\n });\n }\n\n const requestPath = `${parsedUrl.pathname}${parsedUrl.search}`;\n const response = await new Promise<{ readonly status: number; readonly body: string }>(\n (resolve, reject) => {\n let settled = false;\n let deadlineTimer: ReturnType<typeof setTimeout> | undefined;\n\n const settleResolve = (result: { readonly status: number; readonly body: string }) => {\n if (settled) return;\n settled = true;\n if (deadlineTimer !== undefined) clearTimeout(deadlineTimer);\n resolve(result);\n };\n\n const settleReject = (error: InfraError) => {\n if (settled) return;\n settled = true;\n if (deadlineTimer !== undefined) clearTimeout(deadlineTimer);\n reject(error);\n };\n\n const req = nodeHttpRequest(\n {\n socketPath,\n method: options.method,\n path: requestPath,\n headers: {\n ...options.headers,\n ...(options.serializedBody !== undefined\n ? { 'Content-Length': String(Buffer.byteLength(options.serializedBody)) }\n : {}),\n },\n timeout: timeoutMs,\n },\n (res) => {\n const chunks: Buffer[] = [];\n res.on('data', (chunk: Buffer | string) => {\n chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : chunk);\n });\n res.on('end', () => {\n settleResolve({\n status: res.statusCode ?? 0,\n body: Buffer.concat(chunks).toString('utf8'),\n });\n });\n res.on('close', () => {\n if (!res.complete) {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket response closed prematurely for ${sanitizeUrlForError(url)}`,\n { provider: options.provider },\n ),\n );\n }\n });\n res.on('error', (cause) => {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket response failed for ${sanitizeUrlForError(url)}`,\n { provider: options.provider, cause },\n ),\n );\n });\n },\n );\n\n deadlineTimer = setTimeout(() => {\n const timeoutCause = new Error(`Unix socket request exceeded deadline of ${timeoutMs}ms`);\n req.destroy(timeoutCause);\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket request timed out for ${sanitizeUrlForError(url)}`,\n { provider: options.provider, cause: timeoutCause },\n ),\n );\n }, timeoutMs);\n\n req.on('timeout', () => {\n req.destroy(new Error(`Unix socket request timed out after ${timeoutMs}ms`));\n });\n req.on('error', (cause) => {\n settleReject(\n new InfraError(\n 'unreachable',\n `Unix socket request failed for ${sanitizeUrlForError(url)}`,\n {\n provider: options.provider,\n cause,\n },\n ),\n );\n });\n\n if (options.serializedBody !== undefined) {\n req.write(options.serializedBody);\n }\n req.end();\n },\n );\n\n if (response.status >= 300 && response.status < 400) {\n throw new InfraError(\n 'unreachable',\n `Unexpected redirect (${response.status}) from ${sanitizeUrlForError(url)}`,\n { status: response.status, provider: options.provider },\n );\n }\n\n if (response.status < 200 || response.status >= 300) {\n throw infraErrorForStatus(response.status, {\n provider: options.provider,\n message: formatErrorExcerpt(response.body, options.token),\n });\n }\n\n return parseJsonOrEmpty<T>(response.body, response.status, options.provider);\n};\n\nexport const sendInfraRequest = async <T = unknown>(\n url: string,\n options: InfraFetchOptions = {},\n): Promise<T> => {\n const timeoutMs = validateTimeoutMs(options.timeoutMs, options.provider);\n const method = options.method ?? 'GET';\n const serializedBody = options.body !== undefined ? JSON.stringify(options.body) : undefined;\n\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...(options.token ? { Authorization: `Bearer ${options.token}` } : {}),\n ...(serializedBody !== undefined ? { 'Content-Type': 'application/json' } : {}),\n ...options.headers,\n };\n\n if (options.unixSocketPath && typeof Bun === 'undefined') {\n return sendUnixSocketHttpRequest<T>(url, options.unixSocketPath, {\n method,\n headers,\n serializedBody,\n timeoutMs,\n token: options.token,\n provider: options.provider,\n });\n }\n\n const init: UnixRequestInit = {\n method,\n redirect: 'error',\n signal: AbortSignal.timeout(timeoutMs),\n headers,\n ...(serializedBody !== undefined ? { body: serializedBody } : {}),\n ...(options.unixSocketPath ? { unix: options.unixSocketPath } : {}),\n };\n\n let response: Response;\n try {\n response = await fetch(url, init);\n } catch (cause) {\n throw new InfraError('unreachable', `Request to ${sanitizeUrlForError(url)} failed`, {\n provider: options.provider,\n cause,\n });\n }\n\n if (!response.ok) {\n const rawError = await response.text().catch(() => '');\n throw infraErrorForStatus(response.status, {\n provider: options.provider,\n message: formatErrorExcerpt(rawError, options.token),\n });\n }\n\n if (response.status === 204) return undefined as T;\n\n const rawBody = await response.text().catch((cause) => {\n throw new InfraError('unreachable', 'Failed to read response body', {\n status: response.status,\n provider: options.provider,\n cause,\n });\n });\n\n return parseJsonOrEmpty<T>(rawBody, response.status, options.provider);\n};\n","import { ignoreNotFound } from '../core/infraError.ts';\nimport { sendInfraRequest, stripTrailingSlash } from '../core/infraFetch.ts';\n\nexport const RENDER_API_URL = 'https://api.render.com/v1';\n\nexport type RenderRequestInit = {\n readonly method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';\n readonly body?: unknown;\n};\n\nexport const sendRenderRequest = async <T>(\n token: string,\n path: string,\n init: RenderRequestInit = {},\n apiUrl = RENDER_API_URL,\n): Promise<T> =>\n sendInfraRequest<T>(`${stripTrailingSlash(apiUrl)}${path}`, {\n method: init.method ?? 'GET',\n token,\n body: init.body,\n provider: 'render',\n });\n\nexport const deleteRenderResource = async (\n token: string,\n path: string,\n apiUrl?: string,\n): Promise<void> => {\n await sendRenderRequest(token, path, { method: 'DELETE' }, apiUrl).catch(ignoreNotFound);\n};\n","import {\n ARCHIVE_DATABASE,\n ARCHIVE_IMAGE,\n ARCHIVE_PORT,\n type ArchiveDeployment,\n type ArchiveHostingDriver,\n archiveTokenOrThrow,\n type HostingWorkspace,\n type ImageDeployStatus,\n} from '../core/contracts.ts';\nimport { InfraError, requireNonEmpty } from '../core/infraError.ts';\nimport { RENDER_ENDED_DEPLOY_STATUSES, RENDER_FAILED_DEPLOY_STATUSES } from './renderPlans.ts';\nimport { deleteRenderResource, sendRenderRequest } from './renderRequest.ts';\n\nexport const RENDER_REGION = 'oregon';\nexport const RENDER_DATABASE_PLAN = 'basic_256mb';\nexport const RENDER_SERVICE_PLAN = 'starter';\n\nconst OWNER_PAGE_SIZE = 100;\n\ntype RenderOwner = { id: string; name?: string | null; email?: string | null };\ntype RenderPostgres = { id: string; name: string; status: string };\ntype RenderService = {\n id: string;\n name: string;\n suspended?: string;\n serviceDetails?: { url?: string };\n};\n\nconst renderNameQuery = (name: string, ownerId: string): string =>\n new URLSearchParams({ name, ownerId, limit: '20' }).toString();\n\nconst archiveDatabaseName = (deployment: ArchiveDeployment): string => `${deployment.name}-db`;\n\nconst fetchRenderDatabaseByName = async (deployment: ArchiveDeployment) =>\n (\n await sendRenderRequest<{ postgres: RenderPostgres }[]>(\n deployment.token,\n `/postgres?${renderNameQuery(archiveDatabaseName(deployment), deployment.workspaceId)}`,\n {},\n deployment.apiUrl,\n )\n ).find((item) => item.postgres.name === archiveDatabaseName(deployment))?.postgres;\n\nconst fetchRenderServiceByName = async (deployment: ArchiveDeployment) =>\n (\n await sendRenderRequest<{ service: RenderService }[]>(\n deployment.token,\n `/services?${renderNameQuery(deployment.name, deployment.workspaceId)}`,\n {},\n deployment.apiUrl,\n )\n ).find((item) => item.service.name === deployment.name)?.service;\n\nexport const fetchRenderOwners = async (\n token: string,\n apiUrl?: string,\n): Promise<HostingWorkspace[]> => {\n const workspaces: HostingWorkspace[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n do {\n const query = new URLSearchParams({\n limit: String(OWNER_PAGE_SIZE),\n ...(cursor ? { cursor } : {}),\n });\n const page = await sendRenderRequest<{ owner: RenderOwner; cursor: string }[]>(\n token,\n `/owners?${query}`,\n {},\n apiUrl,\n );\n if (!Array.isArray(page)) {\n throw new InfraError('provider_unavailable', 'Render owners response was not an array', {\n provider: 'render',\n });\n }\n workspaces.push(\n ...page.map(({ owner }) => ({ id: owner.id, name: owner.name || owner.email || owner.id })),\n );\n const nextCursor = page.length === OWNER_PAGE_SIZE ? page.at(-1)?.cursor : undefined;\n if (nextCursor !== undefined) {\n if (seenCursors.has(nextCursor)) {\n throw new InfraError('provider_unavailable', 'Render owners pagination cursor repeated', {\n provider: 'render',\n });\n }\n seenCursors.add(nextCursor);\n }\n cursor = nextCursor;\n } while (cursor);\n return workspaces;\n};\n\nexport const renderArchiveDriver: ArchiveHostingDriver = {\n provider: 'render',\n fetchWorkspaces: fetchRenderOwners,\n provisionDatabase: async (deployment) => {\n const database =\n (deployment.ids.databaseId ? { id: deployment.ids.databaseId } : undefined) ??\n (await fetchRenderDatabaseByName(deployment)) ??\n (await sendRenderRequest<RenderPostgres>(\n deployment.token,\n '/postgres',\n {\n method: 'POST',\n body: {\n name: archiveDatabaseName(deployment),\n ownerId: deployment.workspaceId,\n plan: RENDER_DATABASE_PLAN,\n version: '17',\n region: RENDER_REGION,\n databaseName: ARCHIVE_DATABASE,\n databaseUser: ARCHIVE_DATABASE,\n },\n },\n deployment.apiUrl,\n ));\n return { ...deployment.ids, databaseId: database.id };\n },\n fetchDatabaseReadiness: async (deployment) => {\n const databaseId = encodeURIComponent(\n requireNonEmpty(deployment.ids.databaseId, 'Render databaseId', 'render'),\n );\n const { status } = await sendRenderRequest<RenderPostgres>(\n deployment.token,\n `/postgres/${databaseId}`,\n {},\n deployment.apiUrl,\n );\n if (status === 'unavailable' || status === 'suspended') {\n throw new InfraError('deploy_failed', `Render Postgres status ${status}`, {\n provider: 'render',\n });\n }\n return status === 'available';\n },\n provisionService: async (deployment) => {\n const existing =\n (deployment.ids.serviceId\n ? await sendRenderRequest<RenderService>(\n deployment.token,\n `/services/${encodeURIComponent(deployment.ids.serviceId)}`,\n {},\n deployment.apiUrl,\n )\n : undefined) ?? (await fetchRenderServiceByName(deployment));\n let service: RenderService;\n if (existing) {\n service = existing;\n } else {\n const databaseId = encodeURIComponent(\n requireNonEmpty(deployment.ids.databaseId, 'Render databaseId', 'render'),\n );\n service = (\n await sendRenderRequest<{ service: RenderService }>(\n deployment.token,\n '/services',\n {\n method: 'POST',\n body: {\n type: 'web_service',\n name: deployment.name,\n ownerId: deployment.workspaceId,\n image: {\n ownerId: deployment.workspaceId,\n imagePath: `${ARCHIVE_IMAGE}:${deployment.imageVersion}`,\n },\n envVars: [\n { key: 'ARCHIVE_SERVER_TOKEN', value: archiveTokenOrThrow(deployment) },\n { key: 'PORT', value: String(ARCHIVE_PORT) },\n {\n key: 'DATABASE_URL',\n value: (\n await sendRenderRequest<{ internalConnectionString: string }>(\n deployment.token,\n `/postgres/${databaseId}/connection-info`,\n {},\n deployment.apiUrl,\n )\n ).internalConnectionString,\n },\n ],\n serviceDetails: {\n runtime: 'image',\n plan: RENDER_SERVICE_PLAN,\n region: RENDER_REGION,\n healthCheckPath: '/health',\n },\n },\n },\n deployment.apiUrl,\n )\n ).service;\n }\n return {\n ids: { ...deployment.ids, serviceId: service.id },\n url: requireNonEmpty(service.serviceDetails?.url, 'Render service url', 'render'),\n };\n },\n fetchServiceReadiness: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const [latest] = await sendRenderRequest<{ deploy: { status: string } }[]>(\n deployment.token,\n `/services/${serviceId}/deploys?limit=1`,\n {},\n deployment.apiUrl,\n );\n if (!latest) return false;\n if (RENDER_FAILED_DEPLOY_STATUSES.has(latest.deploy.status)) {\n throw new InfraError('deploy_failed', `Render deploy ${latest.deploy.status}`, {\n provider: 'render',\n });\n }\n return latest.deploy.status === 'live';\n },\n fetchServiceFailureStatus: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const [latest] = await sendRenderRequest<{ deploy: { status: string } }[]>(\n deployment.token,\n `/services/${serviceId}/deploys?limit=1`,\n {},\n deployment.apiUrl,\n );\n return Boolean(latest && RENDER_FAILED_DEPLOY_STATUSES.has(latest.deploy.status));\n },\n deployImage: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const imagePath = `${ARCHIVE_IMAGE}:${deployment.imageVersion}`;\n await sendRenderRequest(\n deployment.token,\n `/services/${serviceId}`,\n {\n method: 'PATCH',\n body: { image: { ownerId: deployment.workspaceId, imagePath } },\n },\n deployment.apiUrl,\n );\n const deploy = await sendRenderRequest<{ id: string }>(\n deployment.token,\n `/services/${serviceId}/deploys`,\n {\n method: 'POST',\n body: { imageUrl: imagePath },\n },\n deployment.apiUrl,\n );\n return {\n ...deployment.ids,\n deploymentId: requireNonEmpty(deploy?.id, 'Render deploymentId', 'render'),\n };\n },\n restoreImage: async (deployment) => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n await sendRenderRequest(\n deployment.token,\n `/services/${serviceId}`,\n {\n method: 'PATCH',\n body: {\n image: {\n ownerId: deployment.workspaceId,\n imagePath: `${ARCHIVE_IMAGE}:${deployment.imageVersion}`,\n },\n },\n },\n deployment.apiUrl,\n );\n },\n fetchImageDeployStatus: async (deployment): Promise<ImageDeployStatus> => {\n const serviceId = encodeURIComponent(\n requireNonEmpty(deployment.ids.serviceId, 'Render serviceId', 'render'),\n );\n const deploymentId = encodeURIComponent(\n requireNonEmpty(deployment.ids.deploymentId, 'Render deploymentId', 'render'),\n );\n const { status } = await sendRenderRequest<{ status: string }>(\n deployment.token,\n `/services/${serviceId}/deploys/${deploymentId}`,\n {},\n deployment.apiUrl,\n );\n if (status === 'live') return 'live';\n return RENDER_ENDED_DEPLOY_STATUSES.has(status) ? 'failed' : 'deploying';\n },\n destroyService: async (deployment) => {\n const serviceId = deployment.ids.serviceId ?? (await fetchRenderServiceByName(deployment))?.id;\n if (serviceId) {\n await deleteRenderResource(\n deployment.token,\n `/services/${encodeURIComponent(serviceId)}`,\n deployment.apiUrl,\n );\n }\n const databaseId =\n deployment.ids.databaseId ?? (await fetchRenderDatabaseByName(deployment))?.id;\n if (databaseId) {\n await deleteRenderResource(\n deployment.token,\n `/postgres/${encodeURIComponent(databaseId)}`,\n deployment.apiUrl,\n );\n }\n },\n};\n","import type {\n WorkloadCredentials,\n WorkloadDriver,\n WorkloadHandle,\n WorkloadRuntimeState,\n WorkloadSpec,\n WorkloadStatus,\n WorkloadUsage,\n} from '../core/contracts.ts';\nimport { assertNoEgressAllowlist, InfraError } from '../core/infraError.ts';\nimport { RENDER_REGION } from './renderArchiveDriver.ts';\nimport { RENDER_FAILED_DEPLOY_STATUSES, renderPlanForMemoryMb } from './renderPlans.ts';\nimport { deleteRenderResource, sendRenderRequest } from './renderRequest.ts';\n\ntype RenderWorkloadService = {\n id: string;\n name: string;\n suspended?: 'suspended' | 'not_suspended';\n serviceDetails?: {\n url?: string;\n region?: string;\n plan?: string;\n };\n};\n\nconst requireRenderToken = (credentials: WorkloadCredentials): string => {\n if (!credentials.token) {\n throw new InfraError('authentication_failed', 'Render API token is required', {\n provider: 'render',\n });\n }\n return credentials.token;\n};\n\nconst mapRenderRuntimeState = (\n service: RenderWorkloadService,\n latestDeployStatus?: string,\n): WorkloadRuntimeState => {\n if (service.suspended === 'suspended') return 'suspended';\n if (!latestDeployStatus) return 'provisioning';\n if (latestDeployStatus === 'live') return 'running';\n if (RENDER_FAILED_DEPLOY_STATUSES.has(latestDeployStatus)) return 'failed';\n if (latestDeployStatus === 'deactivated') return 'stopped';\n return 'starting';\n};\n\nexport const renderWorkloadDriver: WorkloadDriver = {\n provider: 'render',\n provisionWorkload: async (\n credentials: WorkloadCredentials,\n spec: WorkloadSpec,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n assertNoEgressAllowlist(spec.egressAllowlist, 'render');\n if (!credentials.workspaceId) {\n throw new InfraError('invalid_request', 'Render workload provisioning requires workspaceId', {\n provider: 'render',\n });\n }\n\n const envVars = Object.entries({\n ...(spec.env ?? {}),\n ...(spec.port ? { PORT: String(spec.port.internalPort) } : {}),\n }).map(([key, value]) => ({ key, value }));\n\n const serviceType = spec.port?.publicHttps ? 'web_service' : 'background_worker';\n const region = spec.region ?? RENDER_REGION;\n const plan = renderPlanForMemoryMb(spec.memoryMb).id;\n const created = await sendRenderRequest<{ service: RenderWorkloadService; deployId?: string }>(\n token,\n '/services',\n {\n method: 'POST',\n body: {\n type: serviceType,\n name: spec.name,\n ownerId: credentials.workspaceId,\n image: {\n ownerId: credentials.workspaceId,\n imagePath: spec.image,\n },\n envVars,\n serviceDetails: {\n runtime: 'image',\n plan,\n region,\n ...(serviceType === 'web_service' && spec.healthcheckPath\n ? { healthCheckPath: spec.healthcheckPath }\n : {}),\n ...(spec.volume\n ? {\n disk: {\n name: spec.volume.name,\n mountPath: spec.volume.mountPath,\n sizeGB: spec.volume.sizeGb ?? 10,\n },\n }\n : {}),\n },\n },\n },\n credentials.apiUrl,\n );\n\n return {\n provider: 'render',\n workloadId: created.service.id,\n name: created.service.name,\n region: created.service.serviceDetails?.region ?? region,\n url: created.service.serviceDetails?.url,\n memoryMb: spec.memoryMb,\n vcpus: spec.vcpus,\n metadata: created.deployId ? { deployId: created.deployId } : undefined,\n };\n },\n suspendWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n await sendRenderRequest(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}/suspend`,\n { method: 'POST' },\n credentials.apiUrl,\n );\n return handle;\n },\n wakeWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadHandle> => {\n const token = requireRenderToken(credentials);\n await sendRenderRequest(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}/resume`,\n { method: 'POST' },\n credentials.apiUrl,\n );\n return handle;\n },\n fetchWorkloadStatus: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadStatus> => {\n const token = requireRenderToken(credentials);\n const encodedId = encodeURIComponent(handle.workloadId);\n const service = await sendRenderRequest<RenderWorkloadService>(\n token,\n `/services/${encodedId}`,\n {},\n credentials.apiUrl,\n );\n const deploys = await sendRenderRequest<{ deploy: { status: string } }[]>(\n token,\n `/services/${encodedId}/deploys?limit=1`,\n {},\n credentials.apiUrl,\n );\n const latestDeployStatus = deploys[0]?.deploy.status;\n return {\n provider: 'render',\n workloadId: service.id,\n state: mapRenderRuntimeState(service, latestDeployStatus),\n providerState:\n service.suspended === 'suspended' ? 'suspended' : (latestDeployStatus ?? 'provisioning'),\n region: service.serviceDetails?.region ?? handle.region,\n url: service.serviceDetails?.url ?? handle.url,\n memoryMb: handle.memoryMb,\n vcpus: handle.vcpus,\n updatedAt: new Date().toISOString(),\n };\n },\n fetchWorkloadUsage: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<WorkloadUsage> => {\n await renderWorkloadDriver.fetchWorkloadStatus(credentials, handle);\n const nowIso = new Date().toISOString();\n return {\n provider: 'render',\n workloadId: handle.workloadId,\n memoryMb: handle.memoryMb ?? 0,\n vcpus: handle.vcpus ?? 0,\n activeSeconds: 0,\n suspendedSeconds: 0,\n rootfsGb: 0,\n metered: false,\n windowStartIso: nowIso,\n windowEndIso: nowIso,\n };\n },\n destroyWorkload: async (\n credentials: WorkloadCredentials,\n handle: WorkloadHandle,\n ): Promise<void> => {\n const token = requireRenderToken(credentials);\n await deleteRenderResource(\n token,\n `/services/${encodeURIComponent(handle.workloadId)}`,\n credentials.apiUrl,\n );\n },\n};\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/infra",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Stateless infrastructure and hosting drivers (Railway, Render, Fly.io Machines, Firecracker) plus workload lifecycle, wind-down, staggered wake, and hosting cost projection.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -17,8 +17,10 @@
17
17
  "typecheck": "tsc --noEmit",
18
18
  "lint": "biome check .",
19
19
  "format": "biome format --write .",
20
- "check": "bun run typecheck && bun run lint && bun run test",
21
- "prepublishOnly": "bun run check && bun run build"
20
+ "check:all": "bun run typecheck && bun run lint && bun run build && bun run test",
21
+ "check": "inixiative-config bounded -- bun run check:all",
22
+ "prepublishOnly": "bun run check",
23
+ "prepare": "if git rev-parse --git-dir >/dev/null 2>&1; then root=\"$(dirname \"$(git rev-parse --path-format=absolute --git-common-dir)\")\"; if [ -x \"$root/node_modules/.bin/lefthook\" ]; then (cd \"$root\" && ./node_modules/.bin/lefthook install); fi; fi"
22
24
  },
23
25
  "keywords": [
24
26
  "infrastructure",
@@ -74,11 +76,12 @@
74
76
  },
75
77
  "devDependencies": {
76
78
  "@biomejs/biome": "2.5.2",
77
- "@inixiative/config": "^0.5.237",
79
+ "@inixiative/config": "^0.5.256",
78
80
  "@types/bun": "1.4.4",
79
81
  "@types/node": "^25.3.5",
80
82
  "tsup": "8.5.1",
81
- "typescript": "6.0.3"
83
+ "typescript": "6.0.3",
84
+ "lefthook": "2.1.9"
82
85
  },
83
86
  "packageManager": "bun@1.4.4"
84
87
  }