@junobuild/admin 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs.js +0 -1
package/dist/browser/index.js
CHANGED
|
@@ -18,7 +18,7 @@ ic-request`);var X=class{getPrincipal(){return d.anonymous()}async transformRequ
|
|
|
18
18
|
`)}case E.Done:throw new Error(`Call was marked as done but we never saw the reply:
|
|
19
19
|
Request ID: ${b(r)}
|
|
20
20
|
`)}throw new Error("unreachable")}var te=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),i=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:i,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var L=class extends V{constructor(e,r,n,i){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${n})`,...Object.getOwnPropertyNames(i).map(o=>` "${o}": ${JSON.stringify(i[o])}`)].join(`
|
|
21
|
-
`)),this.canisterId=e,this.methodName=r,this.type=n,this.props=i}},mt=class extends L{constructor(e,r,n){var i;super(e,r,"query",{Status:n.status,Code:(i=Q[n.reject_code])!==null&&i!==void 0?i:`Unknown Code "${n.reject_code}"`,Message:n.reject_message}),this.result=n}},yt=class extends L{constructor(e,r,n,i){super(e,r,"update",{"Request ID":b(n),"HTTP status code":i.status.toString(),"HTTP status text":i.statusText}),this.requestId=n,this.response=i}},_t;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(_t||(_t={}));var F=Symbol.for("ic-agent-metadata"),R=class{constructor(e){this[F]=Object.freeze(e)}static agentOf(e){return e[F].config.agent}static interfaceOf(e){return e[F].service}static canisterIdOf(e){return d.from(e[F].config.canisterId)}static async install(e,r){let n=e.mode===void 0?_t.Install:e.mode,i=e.arg?[...new Uint8Array(e.arg)]:[],o=[...new Uint8Array(e.module)],a=typeof r.canisterId=="string"?d.fromText(r.canisterId):r.canisterId;await re(r).install_code({mode:{[n]:null},arg:i,wasm_module:o,canister_id:a})}static async createCanister(e){let{canister_id:r}=await re(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,n){let i=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:i})),this.createActor(e,Object.assign(Object.assign({},n),{canisterId:i}))}static createActorClass(e){let r=e({IDL:_});class n extends R{constructor(o){let a=typeof o.canisterId=="string"?d.fromText(o.canisterId):o.canisterId;super({config:Object.assign(Object.assign(Object.assign({},ie),o),{canisterId:a}),service:r});for(let[c,u]of r._fields)this[c]=yr(this,c,u,o.blsVerify)}}return n}static createActor(e,r){return new(this.createActorClass(e))(r)}};function ee(t,e){let r=_.decode(t,ne.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var ie={pollingStrategyFactory:D.defaultStrategy};function yr(t,e,r,n){let i;r.annotations.includes("query")?i=async(a,...c)=>{var u,l;a=Object.assign(Object.assign({},a),(l=(u=t[F].config).queryTransform)===null||l===void 0?void 0:l.call(u,e,c,Object.assign(Object.assign({},t[F].config),a)));let p=a.agent||t[F].config.agent||dt(),f=d.from(a.canisterId||t[F].config.canisterId),h=_.encode(r.argTypes,c),y=await p.query(f,{methodName:e,arg:h});switch(y.status){case"rejected":throw new mt(f,e,y);case"replied":return ee(r.retTypes,y.reply.arg)}}:i=async(a,...c)=>{var u,l;a=Object.assign(Object.assign({},a),(l=(u=t[F].config).callTransform)===null||l===void 0?void 0:l.call(u,e,c,Object.assign(Object.assign({},t[F].config),a)));let p=a.agent||t[F].config.agent||dt(),{canisterId:f,effectiveCanisterId:h,pollingStrategyFactory:y}=Object.assign(Object.assign(Object.assign({},ie),t[F].config),a),x=d.from(f),j=h!==void 0?d.from(h):x,rt=_.encode(r.argTypes,c),{requestId:k,response:$}=await p.call(x,{methodName:e,arg:rt,effectiveCanisterId:j});if(!$.ok)throw new yt(x,e,k,$);let nt=y(),H=await ht(p,j,k,nt,n);if(H!==void 0)return ee(r.retTypes,H);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let o=(...a)=>i({},...a);return o.withOptions=a=>(...c)=>i(a,...c),o}function re(t){function e(r,n,i){let o=n[0],a=d.fromHex("");return o&&typeof o=="object"&&o.canister_id&&(a=d.from(o.canister_id)),{effectiveCanisterId:a}}return R.createActor(te,Object.assign(Object.assign(Object.assign({},t),{canisterId:d.fromHex("")}),{callTransform:e,queryTransform:e}))}var wt=async({canisterId:t,idlFactory:e,identity:r,fetch:n,env:i="prod",config:o})=>{let a=i==="dev"?"http://127.0.0.1:8000/":"https://
|
|
21
|
+
`)),this.canisterId=e,this.methodName=r,this.type=n,this.props=i}},mt=class extends L{constructor(e,r,n){var i;super(e,r,"query",{Status:n.status,Code:(i=Q[n.reject_code])!==null&&i!==void 0?i:`Unknown Code "${n.reject_code}"`,Message:n.reject_message}),this.result=n}},yt=class extends L{constructor(e,r,n,i){super(e,r,"update",{"Request ID":b(n),"HTTP status code":i.status.toString(),"HTTP status text":i.statusText}),this.requestId=n,this.response=i}},_t;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(_t||(_t={}));var F=Symbol.for("ic-agent-metadata"),R=class{constructor(e){this[F]=Object.freeze(e)}static agentOf(e){return e[F].config.agent}static interfaceOf(e){return e[F].service}static canisterIdOf(e){return d.from(e[F].config.canisterId)}static async install(e,r){let n=e.mode===void 0?_t.Install:e.mode,i=e.arg?[...new Uint8Array(e.arg)]:[],o=[...new Uint8Array(e.module)],a=typeof r.canisterId=="string"?d.fromText(r.canisterId):r.canisterId;await re(r).install_code({mode:{[n]:null},arg:i,wasm_module:o,canister_id:a})}static async createCanister(e){let{canister_id:r}=await re(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,n){let i=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:i})),this.createActor(e,Object.assign(Object.assign({},n),{canisterId:i}))}static createActorClass(e){let r=e({IDL:_});class n extends R{constructor(o){let a=typeof o.canisterId=="string"?d.fromText(o.canisterId):o.canisterId;super({config:Object.assign(Object.assign(Object.assign({},ie),o),{canisterId:a}),service:r});for(let[c,u]of r._fields)this[c]=yr(this,c,u,o.blsVerify)}}return n}static createActor(e,r){return new(this.createActorClass(e))(r)}};function ee(t,e){let r=_.decode(t,ne.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var ie={pollingStrategyFactory:D.defaultStrategy};function yr(t,e,r,n){let i;r.annotations.includes("query")?i=async(a,...c)=>{var u,l;a=Object.assign(Object.assign({},a),(l=(u=t[F].config).queryTransform)===null||l===void 0?void 0:l.call(u,e,c,Object.assign(Object.assign({},t[F].config),a)));let p=a.agent||t[F].config.agent||dt(),f=d.from(a.canisterId||t[F].config.canisterId),h=_.encode(r.argTypes,c),y=await p.query(f,{methodName:e,arg:h});switch(y.status){case"rejected":throw new mt(f,e,y);case"replied":return ee(r.retTypes,y.reply.arg)}}:i=async(a,...c)=>{var u,l;a=Object.assign(Object.assign({},a),(l=(u=t[F].config).callTransform)===null||l===void 0?void 0:l.call(u,e,c,Object.assign(Object.assign({},t[F].config),a)));let p=a.agent||t[F].config.agent||dt(),{canisterId:f,effectiveCanisterId:h,pollingStrategyFactory:y}=Object.assign(Object.assign(Object.assign({},ie),t[F].config),a),x=d.from(f),j=h!==void 0?d.from(h):x,rt=_.encode(r.argTypes,c),{requestId:k,response:$}=await p.call(x,{methodName:e,arg:rt,effectiveCanisterId:j});if(!$.ok)throw new yt(x,e,k,$);let nt=y(),H=await ht(p,j,k,nt,n);if(H!==void 0)return ee(r.retTypes,H);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let o=(...a)=>i({},...a);return o.withOptions=a=>(...c)=>i(a,...c),o}function re(t){function e(r,n,i){let o=n[0],a=d.fromHex("");return o&&typeof o=="object"&&o.canister_id&&(a=d.from(o.canister_id)),{effectiveCanisterId:a}}return R.createActor(te,Object.assign(Object.assign(Object.assign({},t),{canisterId:d.fromHex("")}),{callTransform:e,queryTransform:e}))}var wt=async({canisterId:t,idlFactory:e,identity:r,fetch:n,env:i="prod",config:o})=>{let a=i==="dev"?"http://127.0.0.1:8000/":"https://icp0.io",c=new O({identity:r,...a&&{host:a},...n&&{fetch:n}});return i==="dev"&&await c.fetchRootKey(),R.createActor(e,{agent:c,canisterId:t,...o!==void 0?o:{}})};var tt=async({satelliteId:t,...e})=>ae({canisterId:t,...e,idlFactory:vt}),xt=async({missionControlId:t,...e})=>ae({canisterId:t,...e,idlFactory:Rt});var ae=async({canisterId:t,idlFactory:e,...r})=>{if(!t)throw new Error("No canister ID provided.");return wt({canisterId:t,idlFactory:e,...r})},se=d.fromText("aaaaa-aa"),oe=(t,e,r)=>{let n=e[0],i=se;return n&&typeof n=="object"&&n.canister_id&&(i=d.from(n.canister_id)),{effectiveCanisterId:i}},ce=t=>wt({canisterId:se.toText(),config:{callTransform:oe,queryTransform:oe},idlFactory:Ct,...t});var et=async({actor:t,code:e})=>{let{install_code:r}=await ce(t);return r({...e,mode:{upgrade:null}})};var ue=async({missionControl:t})=>(await xt(t)).version(),le=async({missionControl:t})=>(await xt(t)).get_user();var Dn=async t=>ue(t),Ln=async({missionControl:t,wasm_module:e})=>{let r=await le({missionControl:t}),{missionControlId:n,...i}=t;if(!n)throw new Error("No mission control principal defined.");let o=_.encode([_.Record({user:_.Principal})],[{user:r}]);await et({actor:i,code:{canister_id:d.fromText(n),arg:[...new Uint8Array(o)],wasm_module:e}})};var pe=async({config:t,satellite:e})=>(await tt(e)).set_config(t),fe=async({satellite:t})=>(await tt(t)).version(),de=async({satellite:t})=>(await tt(t)).list_controllers();var si=async({config:{storage:{headers:t}},satellite:e})=>{let r=t.map(({source:n,headers:i})=>[n,i]);return pe({satellite:e,config:{storage:{headers:r}}})},ci=async t=>fe(t),ui=async({satellite:t,wasm_module:e})=>{let r=await de({satellite:t}),{satelliteId:n,...i}=t;if(!n)throw new Error("No satellite principal defined.");let o=_.encode([_.Record({controllers:_.Vec(_.Principal)})],[{controllers:r}]);await et({actor:i,code:{canister_id:d.fromText(n),arg:[...new Uint8Array(o)],wasm_module:e}})};export{Dn as missionControlVersion,ci as satelliteVersion,si as setConfig,Ln as upgradeMissionControl,ui as upgradeSatellite};
|
|
22
22
|
/*! Bundled license information:
|
|
23
23
|
|
|
24
24
|
buffer/index.js:
|