phala 1.0.22 → 1.0.23

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.
@@ -4320,7 +4320,7 @@ declare const cvmAttestationResponseSchema: z.ZodObject<{
4320
4320
  * Get user information
4321
4321
  * @returns User information
4322
4322
  */
4323
- declare function getUserInfo(): Promise<GetUserInfoResponse>;
4323
+ declare function getUserInfo(apiKey?: string): Promise<GetUserInfoResponse>;
4324
4324
 
4325
4325
  /**
4326
4326
  * Get all CVMs for the current user
package/dist/api/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{A as l,B as n,C as q,D as s,E as u,F as v,G as w,H as y,I as z,J as A,K as B,L as C,M as D,N as E,O as F,P as G,Q as H,R as I,S as J,T as K,U as L,V as M,W as N,X as O,Y as P,Z as Q,j as o,k as r,l as e,m as f,n as m,o as p,p as t,q as x,r as a,s as b,t as c,u as d,v as g,w as h,x as i,y as j,z as k}from"../chunk-YV2WYCLU.js";export{k as capacitySchema,z as checkCvmExists,r as composeFileSchema,e as configurationSchema,D as createCvm,v as cvmAttestationResponseSchema,s as cvmComposeConfigSchema,t as cvmInstanceSchema,I as deleteCvm,o as dockerConfigSchema,h as encryptedEnvItemSchema,L as getCvmAttestation,A as getCvmByAppId,b as getCvmByAppIdResponseSchema,M as getCvmComposeConfig,C as getCvmNetwork,q as getCvmNetworkResponseSchema,y as getCvms,d as getCvmsByUserIdResponseSchema,B as getPubkeyFromCvm,a as getPubkeyFromCvmResponseSchema,Q as getTeepodImages,P as getTeepods,w as getUserInfo,c as getUserInfoResponseSchema,f as hostedSchema,i as imageSchema,l as kmsListItemSchema,m as managedUserSchema,p as nodeSchema,x as postCvmResponseSchema,N as replicateCvm,u as replicateCvmResponseSchema,O as resizeCvm,G as restartCvm,K as selectCvm,E as startCvm,F as stopCvm,n as teepodResponseSchema,j as teepodSchema,J as updateCvm,H as upgradeCvm,g as upgradeCvmResponseSchema};
1
+ import{A as l,B as n,C as q,D as s,E as u,F as v,G as w,H as y,I as z,J as A,K as B,L as C,M as D,N as E,O as F,P as G,Q as H,R as I,S as J,T as K,U as L,V as M,W as N,X as O,Y as P,Z as Q,j as o,k as r,l as e,m as f,n as m,o as p,p as t,q as x,r as a,s as b,t as c,u as d,v as g,w as h,x as i,y as j,z as k}from"../chunk-UAGP6RFW.js";export{k as capacitySchema,z as checkCvmExists,r as composeFileSchema,e as configurationSchema,D as createCvm,v as cvmAttestationResponseSchema,s as cvmComposeConfigSchema,t as cvmInstanceSchema,I as deleteCvm,o as dockerConfigSchema,h as encryptedEnvItemSchema,L as getCvmAttestation,A as getCvmByAppId,b as getCvmByAppIdResponseSchema,M as getCvmComposeConfig,C as getCvmNetwork,q as getCvmNetworkResponseSchema,y as getCvms,d as getCvmsByUserIdResponseSchema,B as getPubkeyFromCvm,a as getPubkeyFromCvmResponseSchema,Q as getTeepodImages,P as getTeepods,w as getUserInfo,c as getUserInfoResponseSchema,f as hostedSchema,i as imageSchema,l as kmsListItemSchema,m as managedUserSchema,p as nodeSchema,x as postCvmResponseSchema,N as replicateCvm,u as replicateCvmResponseSchema,O as resizeCvm,G as restartCvm,K as selectCvm,E as startCvm,F as stopCvm,n as teepodResponseSchema,j as teepodSchema,J as updateCvm,H as upgradeCvm,g as upgradeCvmResponseSchema};
2
2
  //# sourceMappingURL=index.js.map
@@ -54,5 +54,5 @@ services:
54
54
  {{#each envVars}} - {{{this}}}
55
55
  {{/each}}
56
56
  restart: always
57
- `;function ie(r){try{return JSON.stringify(r)}catch(t){return t instanceof Error&&t.message.includes("cyclic")?"[Cyclic Object]":String(r)}}async function mt(){try{x.debug(`Fetching user info from ${y.USER_INFO}`);let t=await Ae().get(y.USER_INFO);x.debug(`Received response: ${ie(t)}`);try{return Q.parse(t)}catch(n){throw x.error(`Failed to parse user info response: ${n}`),x.debug(`Response structure: ${ie(t)}`),n}}catch(r){throw x.error(`Failed to get user info: ${r instanceof Error?r.message:String(r)}`),new Error(`Failed to get user info: ${r instanceof Error?r.message:String(r)}`)}}import{createClient as S}from"@phala/cloud";import Ie from"inquirer";import{z as ae}from"zod";async function le(){try{let t=await S().get(y.CVMS(0));return ae.array(F).parse(t)}catch(r){throw new Error(`Failed to get CVMs: ${r instanceof Error?r.message:String(r)}`)}}async function Ct(r){let n=(await le()).find(o=>o.hosted?.app_id===r||`app_${o.hosted?.app_id}`===r);if(!n)x.error(`CVM with App ID app_${r} not detected`),process.exit(1);else return x.success(`CVM with App ID app_${r} detected`),n.hosted?.app_id||""}async function kt(r){try{let n=await S().get(y.CVM_BY_APP_ID(r));return X.parse(n)}catch(t){throw new Error(`Failed to get CVM by App ID: ${t instanceof Error?t.message:String(t)}`)}}async function St(r){try{let n=await S().post(y.CVM_PUBKEY,r);return J.parse(n)}catch(t){throw new Error(`Failed to get pubkey from CVM: ${t instanceof Error?t.message:String(t)}`)}}async function xt(r){try{let n=await S().get(y.CVM_NETWORK(r));return re.parse(n)}catch(t){throw new Error(`Failed to get network information for CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Tt(r){try{let n=await S().post(y.CVM_FROM_CONFIGURATION,r);return W.parse(n)}catch(t){throw t instanceof ae.ZodError?(x.error("Schema validation error:",JSON.stringify(t.errors,null,2)),x.error("API response:",JSON.stringify(t.format(),null,2)),new Error(`Response validation failed: ${JSON.stringify(t.errors)}`)):new Error(`Failed to create CVM: ${t instanceof Error?t.message:String(t)}`)}}async function wt(r){try{let n=await S().post(y.CVM_START(r));return W.parse(n)}catch(t){throw new Error(`Failed to start CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Rt(r){try{let n=await S().post(y.CVM_STOP(r));return W.parse(n)}catch(t){throw new Error(`Failed to stop CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Et(r){try{let n=await S().post(y.CVM_RESTART(r));return W.parse(n)}catch(t){throw new Error(`Failed to restart CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Pt(r,t){try{let o=await S().put(y.CVM_UPGRADE(r),t);return ee.parse(o)}catch(n){throw new Error(`Failed to upgrade CVM: ${n instanceof Error?n.message:String(n)}`)}}async function $t(r){try{return await S().delete(y.CVM_BY_APP_ID(r)),!0}catch(t){throw new Error(`Failed to delete CVM: ${t instanceof Error?t.message:String(t)}`)}}async function At(r){try{return await S().put(y.CVM_BY_APP_ID(r.app_id),r)}catch(t){throw new Error(`Failed to update CVM: ${t instanceof Error?t.message:String(t)}`)}}async function It(){let r=x.startSpinner("Fetching available CVMs"),t=await le();if(r.stop(!0),!t||t.length===0){x.info("No CVMs found for your account");return}let n=t.map(m=>{let a=m.hosted?.app_id||m.hosted?.id,i=m.name||m.hosted?.name,_=m.status||m.hosted?.status;return{name:`${i||"Unnamed"} (${a}) - Status: ${_||"Unknown"}`,value:a}}),{selectedCvm:o}=await Ie.prompt([{type:"list",name:"selectedCvm",message:"Select a CVM:",choices:n}]);return o}async function Mt(r){try{let n=await S().get(y.CVM_ATTESTATION(r));try{return se.parse(n)}catch(o){return x.debug(`Validation error: ${o instanceof Error?o.message:String(o)}`),{is_online:!!n?.is_online,is_public:!!n?.is_public,error:typeof n?.error=="string"?n.error:null,app_certificates:Array.isArray(n?.app_certificates)?n.app_certificates:null,tcb_info:n?.tcb_info||null,compose_file:typeof n?.compose_file=="string"?n.compose_file:null}}}catch(t){throw new Error(`Failed to get attestation information: ${t instanceof Error?t.message:String(t)}`)}}async function Vt(r){try{let n=await S().get(y.CVM_COMPOSE(r));return ne.parse(n)}catch(t){throw new Error(`Failed to get CVM compose config: ${t instanceof Error?t.message:String(t)}`)}}async function Ot(r,t){try{let o=await S().post(y.REPLICATE_CVM(r),t);return oe.parse(o)}catch(n){throw new Error(`Failed to replicate CVM: ${n instanceof Error?n.message:String(n)}`)}}async function Lt(r,t,n,o,m){try{let a=S(),i={};if(t!==void 0&&(i.vcpu=t),n!==void 0&&(i.memory=n),o!==void 0&&(i.disk_size=o),m!==void 0&&(i.allow_restart=m),Object.keys(i).length===0)throw new Error("At least one resource parameter must be provided");return await a.patch(y.CVM_RESIZE(r),i),!0}catch(a){throw new Error(`Failed to resize CVM: ${a instanceof Error?a.message:String(a)}`)}}import{createClient as ce}from"@phala/cloud";import{z as Me}from"zod";async function Ve(){try{let t=await(await ce()).get(y.TEEPODS);return te.parse(t)}catch(r){throw new Error(`Failed to get TEEPods: ${r instanceof Error?r.message:String(r)}`)}}async function Zt(r){try{let t=ce(),o=(await Ve()).nodes.find(a=>a.teepod_id===Number(r));if(o&&o.images&&o.images.length>0)return o.images;let m=await(await t).get(y.TEEPOD_IMAGES(r));return Me.array(B).parse(m)}catch(t){throw new Error(`Failed to get TEEPod images: ${t instanceof Error?t.message:String(t)}`)}}export{x as a,Xe as b,Qe as c,et as d,tt as e,rt as f,nt as g,ot as h,Be as i,ke as j,Se as k,xe as l,Te as m,we as n,Re as o,F as p,W as q,J as r,X as s,Q as t,Ye as u,ee as v,qe as w,B as x,Ee as y,Pe as z,$e as A,te as B,re as C,ne as D,oe as E,se as F,mt as G,le as H,Ct as I,kt as J,St as K,xt as L,Tt as M,wt as N,Rt as O,Et as P,Pt as Q,$t as R,At as S,It as T,Mt as U,Vt as V,Ot as W,Lt as X,Ve as Y,Zt as Z};
58
- //# sourceMappingURL=chunk-YV2WYCLU.js.map
57
+ `;function ie(r){try{return JSON.stringify(r)}catch(t){return t instanceof Error&&t.message.includes("cyclic")?"[Cyclic Object]":String(r)}}async function mt(r){try{x.debug(`Fetching user info from ${y.USER_INFO}`);let n=await Ae({apiKey:r}).get(y.USER_INFO);x.debug(`Received response: ${ie(n)}`);try{return Q.parse(n)}catch(o){throw x.error(`Failed to parse user info response: ${o}`),x.debug(`Response structure: ${ie(n)}`),o}}catch(t){throw x.error(`Failed to get user info: ${t instanceof Error?t.message:String(t)}`),new Error(`Failed to get user info: ${t instanceof Error?t.message:String(t)}`)}}import{createClient as S}from"@phala/cloud";import Ie from"inquirer";import{z as ae}from"zod";async function le(){try{let t=await S().get(y.CVMS(0));return ae.array(F).parse(t)}catch(r){throw new Error(`Failed to get CVMs: ${r instanceof Error?r.message:String(r)}`)}}async function Ct(r){let n=(await le()).find(o=>o.hosted?.app_id===r||`app_${o.hosted?.app_id}`===r);if(!n)x.error(`CVM with App ID app_${r} not detected`),process.exit(1);else return x.success(`CVM with App ID app_${r} detected`),n.hosted?.app_id||""}async function kt(r){try{let n=await S().get(y.CVM_BY_APP_ID(r));return X.parse(n)}catch(t){throw new Error(`Failed to get CVM by App ID: ${t instanceof Error?t.message:String(t)}`)}}async function St(r){try{let n=await S().post(y.CVM_PUBKEY,r);return J.parse(n)}catch(t){throw new Error(`Failed to get pubkey from CVM: ${t instanceof Error?t.message:String(t)}`)}}async function xt(r){try{let n=await S().get(y.CVM_NETWORK(r));return re.parse(n)}catch(t){throw new Error(`Failed to get network information for CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Tt(r){try{let n=await S().post(y.CVM_FROM_CONFIGURATION,r);return W.parse(n)}catch(t){throw t instanceof ae.ZodError?(x.error("Schema validation error:",JSON.stringify(t.errors,null,2)),x.error("API response:",JSON.stringify(t.format(),null,2)),new Error(`Response validation failed: ${JSON.stringify(t.errors)}`)):new Error(`Failed to create CVM: ${t instanceof Error?t.message:String(t)}`)}}async function wt(r){try{let n=await S().post(y.CVM_START(r));return W.parse(n)}catch(t){throw new Error(`Failed to start CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Rt(r){try{let n=await S().post(y.CVM_STOP(r));return W.parse(n)}catch(t){throw new Error(`Failed to stop CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Et(r){try{let n=await S().post(y.CVM_RESTART(r));return W.parse(n)}catch(t){throw new Error(`Failed to restart CVM: ${t instanceof Error?t.message:String(t)}`)}}async function Pt(r,t){try{let o=await S().put(y.CVM_UPGRADE(r),t);return ee.parse(o)}catch(n){throw new Error(`Failed to upgrade CVM: ${n instanceof Error?n.message:String(n)}`)}}async function $t(r){try{return await S().delete(y.CVM_BY_APP_ID(r)),!0}catch(t){throw new Error(`Failed to delete CVM: ${t instanceof Error?t.message:String(t)}`)}}async function At(r){try{return await S().put(y.CVM_BY_APP_ID(r.app_id),r)}catch(t){throw new Error(`Failed to update CVM: ${t instanceof Error?t.message:String(t)}`)}}async function It(){let r=x.startSpinner("Fetching available CVMs"),t=await le();if(r.stop(!0),!t||t.length===0){x.info("No CVMs found for your account");return}let n=t.map(m=>{let a=m.hosted?.app_id||m.hosted?.id,i=m.name||m.hosted?.name,_=m.status||m.hosted?.status;return{name:`${i||"Unnamed"} (${a}) - Status: ${_||"Unknown"}`,value:a}}),{selectedCvm:o}=await Ie.prompt([{type:"list",name:"selectedCvm",message:"Select a CVM:",choices:n}]);return o}async function Mt(r){try{let n=await S().get(y.CVM_ATTESTATION(r));try{return se.parse(n)}catch(o){return x.debug(`Validation error: ${o instanceof Error?o.message:String(o)}`),{is_online:!!n?.is_online,is_public:!!n?.is_public,error:typeof n?.error=="string"?n.error:null,app_certificates:Array.isArray(n?.app_certificates)?n.app_certificates:null,tcb_info:n?.tcb_info||null,compose_file:typeof n?.compose_file=="string"?n.compose_file:null}}}catch(t){throw new Error(`Failed to get attestation information: ${t instanceof Error?t.message:String(t)}`)}}async function Vt(r){try{let n=await S().get(y.CVM_COMPOSE(r));return ne.parse(n)}catch(t){throw new Error(`Failed to get CVM compose config: ${t instanceof Error?t.message:String(t)}`)}}async function Ot(r,t){try{let o=await S().post(y.REPLICATE_CVM(r),t);return oe.parse(o)}catch(n){throw new Error(`Failed to replicate CVM: ${n instanceof Error?n.message:String(n)}`)}}async function Lt(r,t,n,o,m){try{let a=S(),i={};if(t!==void 0&&(i.vcpu=t),n!==void 0&&(i.memory=n),o!==void 0&&(i.disk_size=o),m!==void 0&&(i.allow_restart=m),Object.keys(i).length===0)throw new Error("At least one resource parameter must be provided");return await a.patch(y.CVM_RESIZE(r),i),!0}catch(a){throw new Error(`Failed to resize CVM: ${a instanceof Error?a.message:String(a)}`)}}import{createClient as ce}from"@phala/cloud";import{z as Me}from"zod";async function Ve(){try{let t=await(await ce()).get(y.TEEPODS);return te.parse(t)}catch(r){throw new Error(`Failed to get TEEPods: ${r instanceof Error?r.message:String(r)}`)}}async function Zt(r){try{let t=ce(),o=(await Ve()).nodes.find(a=>a.teepod_id===Number(r));if(o&&o.images&&o.images.length>0)return o.images;let m=await(await t).get(y.TEEPOD_IMAGES(r));return Me.array(B).parse(m)}catch(t){throw new Error(`Failed to get TEEPod images: ${t instanceof Error?t.message:String(t)}`)}}export{x as a,Xe as b,Qe as c,et as d,tt as e,rt as f,nt as g,ot as h,Be as i,ke as j,Se as k,xe as l,Te as m,we as n,Re as o,F as p,W as q,J as r,X as s,Q as t,Ye as u,ee as v,qe as w,B as x,Ee as y,Pe as z,$e as A,te as B,re as C,ne as D,oe as E,se as F,mt as G,le as H,Ct as I,kt as J,St as K,xt as L,Tt as M,wt as N,Rt as O,Et as P,Pt as Q,$t as R,At as S,It as T,Mt as U,Vt as V,Ot as W,Lt as X,Ve as Y,Zt as Z};
58
+ //# sourceMappingURL=chunk-UAGP6RFW.js.map