@allscale/cli 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- "use strict";var Ze=Object.create;var x=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var tn=(e,n)=>{for(var t in n)x(e,t,{get:n[t],enumerable:!0})},fe=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Qe(n))!nn.call(e,a)&&a!==t&&x(e,a,{get:()=>n[a],enumerable:!(i=Xe(n,a))||i.enumerable});return e};var A=(e,n,t)=>(t=e!=null?Ze(en(e)):{},fe(n||!e||!e.__esModule?x(t,"default",{value:e,enumerable:!0}):t,e)),an=e=>fe(x({},"__esModule",{value:!0}),e);var rt={};tn(rt,{default:()=>M});module.exports=an(rt);var f=require("@oclif/core");var ye="public",Ae="https://app.allscale.io";var ge=["https://app.allscale.io"];var J="Override the API base URL (public builds accept only https://app.allscale.io)";var j="Only https://app.allscale.io is allowed, and URL userinfo is forbidden.";function _e(e){try{let n=new URL(e);return n.username.length>0||n.password.length>0?null:n.protocol==="https:"?n:null}catch{return null}}function he(e){return _e(e)!==null}function q(e){let n=_e(e);return n!==null&&ge.includes(n.origin)}function C(){return"".trim()||void 0}function _(){return"public"}function Le(e){try{let{hostname:n}=new URL(e);return n==="127.0.0.1"||n==="localhost"||n==="[::1]"}catch{return!1}}function Te(){{let e="[]".trim();if(e.length===0)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}return Y()}function Y(){let e=process.env.ALLSCALE_BUILD_PAIRS?.trim()??"";if(e.length>0)try{let i=JSON.parse(e);if(!Array.isArray(i))return[];let a=[];for(let o of i){if(typeof o!="object"||o===null)continue;let{base:r,key:s,keyId:u}=o;if(typeof r!="string"||r.trim().length===0||typeof s!="string"||s.trim().length===0)continue;let p=typeof u=="string"?u.trim():"";a.push({base:r.trim(),key:s,keyId:p.length>0?p:"cli-1"})}return a}catch{return[]}let n=process.env.ALLSCALE_SIGNING_KEY??"",t=process.env.ALLSCALE_BUILD_API_BASE?.trim()??"";if(n.trim().length>0&&t.length>0){let i=process.env.ALLSCALE_SIGNING_KEY_ID?.trim();return[{base:t,key:n,keyId:i&&i.length>0?i:"cli-1"}]}return[]}var on={"input.invalid":2,"storage.unavailable":2,"transport.network":3,"transport.timeout":3,"transport.response_too_large":2,"auth.no_token":4,"auth.unknown_profile":2,"auth.token_invalid":5,"auth.token_expired":5,"auth.device_pairing_timeout":3,"auth.credential_changed":3,"auth.permission_denied":6,"auth.signature_rejected":11,"claim.not_claimable":12,"claim.expired":12,"claim.payout_ambiguous":9,"claim_link.funding_ambiguous":9,"claim_link.intent_conflict":2,"claim_link.browser_cancelled":12,"user.cancelled":12,"signing.key_unavailable":2,not_found:7,rate_limited:8,"backend.internal":9,"wallet.requires_browser_auth":6,"wallet.bridge_timeout":3,"wallet.bridge_op_expired":3,"wallet.bridge_invalid_response":9,"wallet.transaction_reverted":12,"wallet.transaction_status_unknown":9,"raw.disabled":10,internal:1};var rn=new RegExp(["\\u001b\\[[0-9;:<=>?]*[ -/]*[@-~]","\\u009b[0-9;:<=>?]*[ -/]*[@-~]","\\u001b\\][^\\u0007\\u001b\\u009c]*(?:\\u0007|\\u001b\\\\|\\u009c)","\\u009d[^\\u0007\\u001b\\u009c]*(?:\\u0007|\\u001b\\\\|\\u009c)","\\u001b[ -/]+[0-~]","\\u001b[0-Z\\x5c-~]","\\u001b\\[[0-9;:<=>?]*[ -/]*","\\u009b[0-9;:<=>?]*[ -/]*","[\\u0007\\u001b\\u0090\\u0098\\u009b\\u009c\\u009d\\u009e\\u009f]"].join("|"),"g");function z(e){return(typeof e=="string"?e:String(e??"")).replace(rn,"")}var sn=64;function K(e,n=new Map,t=0){if(typeof e=="string")return z(e);if(e===null||typeof e!="object")return e;let i=n.get(e);if(i!==void 0)return i;if(t>=sn)return e;if(Array.isArray(e)){let r=[];n.set(e,r);for(let s of e)r.push(K(s,n,t+1));return r}let a=Object.getPrototypeOf(e);if(a!==Object.prototype&&a!==null)return e;let o={};n.set(e,o);for(let[r,s]of Object.entries(e))Object.defineProperty(o,r,{value:K(s,n,t+1),writable:!0,enumerable:!0,configurable:!0});return o}var d=class extends Error{code;details;constructor(n,t,i){super(z(t)),this.code=n,this.details=i&&K(i),this.name="AllscaleError"}get exitCode(){return on[this.code]}toJSON(){return{error:{code:this.code,message:this.message,...this.details?{details:this.details}:{}}}}};function ke(e){if(e instanceof d)return e;if(e instanceof Error){if(un(e)){let n=cn(e),t={};return e.name&&e.name!=="Error"&&(t.name=e.name),Object.keys(n).length>0&&(t.oclif=n),new d("input.invalid",e.message,Object.keys(t).length>0?t:void 0)}return new d("internal",e.message,{name:e.name})}return new d("internal","Unknown error",{value:String(e)})}var ln=new Set(["CLIError","CLIParseError","RequiredArgsError","RequiredFlagError","UnexpectedArgsError","FlagInvalidOptionError","ArgInvalidOptionError","InvalidArgsSpecError"]),dn=[/^Missing \d+ required arg/i,/^Missing required flag/i,/^Unexpected argument/i,/^Nonexistent flag/i,/^Unexpected arguments?/i,/^Failed parsing/i,/^Parsing --[A-Za-z0-9][A-Za-z0-9-]*(?:\s|$)/i,/^Expected (?:--|-).*/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* can only be specified once\.?$/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* expects a value$/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* expects one of these values: /i,/to be one of: /];function un(e){if(pn(e))return!0;let n=e.name??"";return ln.has(n)?n==="CLIError"?W(e,"parse")||Se(e.message):!0:Se(e.message)}function pn(e){if(!W(e,"oclif"))return!1;let n=e.oclif;return typeof n=="object"&&n!==null&&n.exit===2&&W(e,"parse")}function Se(e){return e?z(e).split(`
1
+ "use strict";var Ze=Object.create;var P=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var en=Object.getPrototypeOf,nn=Object.prototype.hasOwnProperty;var tn=(e,n)=>{for(var t in n)P(e,t,{get:n[t],enumerable:!0})},fe=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Qe(n))!nn.call(e,a)&&a!==t&&P(e,a,{get:()=>n[a],enumerable:!(i=Xe(n,a))||i.enumerable});return e};var A=(e,n,t)=>(t=e!=null?Ze(en(e)):{},fe(n||!e||!e.__esModule?P(t,"default",{value:e,enumerable:!0}):t,e)),an=e=>fe(P({},"__esModule",{value:!0}),e);var rt={};tn(rt,{default:()=>M});module.exports=an(rt);var f=require("@oclif/core");var ye="public",Ae="https://app.allscale.io";var ge=["https://app.allscale.io"];var J="Override the API base URL (public builds accept only https://app.allscale.io)";var q="Only https://app.allscale.io is allowed, and URL userinfo is forbidden.";function _e(e){try{let n=new URL(e);return n.username.length>0||n.password.length>0?null:n.protocol==="https:"?n:null}catch{return null}}function Le(e){return _e(e)!==null}function j(e){let n=_e(e);return n!==null&&ge.includes(n.origin)}function C(){return"".trim()||void 0}function _(){return"public"}function he(e){try{let{hostname:n}=new URL(e);return n==="127.0.0.1"||n==="localhost"||n==="[::1]"}catch{return!1}}function Te(){{let e="[]".trim();if(e.length===0)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}return Y()}function Y(){let e=process.env.ALLSCALE_BUILD_PAIRS?.trim()??"";if(e.length>0)try{let i=JSON.parse(e);if(!Array.isArray(i))return[];let a=[];for(let o of i){if(typeof o!="object"||o===null)continue;let{base:r,key:s,keyId:u}=o;if(typeof r!="string"||r.trim().length===0||typeof s!="string"||s.trim().length===0)continue;let p=typeof u=="string"?u.trim():"";a.push({base:r.trim(),key:s,keyId:p.length>0?p:"cli-1"})}return a}catch{return[]}let n=process.env.ALLSCALE_SIGNING_KEY??"",t=process.env.ALLSCALE_BUILD_API_BASE?.trim()??"";if(n.trim().length>0&&t.length>0){let i=process.env.ALLSCALE_SIGNING_KEY_ID?.trim();return[{base:t,key:n,keyId:i&&i.length>0?i:"cli-1"}]}return[]}var on={"input.invalid":2,"storage.unavailable":2,"transport.network":3,"transport.timeout":3,"transport.response_too_large":2,"auth.no_token":4,"auth.unknown_profile":2,"auth.token_invalid":5,"auth.token_expired":5,"auth.device_pairing_timeout":3,"auth.credential_changed":3,"auth.permission_denied":6,"auth.signature_rejected":11,"claim.not_claimable":12,"claim.expired":12,"claim.payout_ambiguous":9,"claim_link.funding_ambiguous":9,"claim_link.intent_conflict":2,"claim_link.browser_cancelled":12,"user.cancelled":12,"signing.key_unavailable":2,not_found:7,rate_limited:8,"backend.internal":9,"wallet.requires_browser_auth":6,"wallet.bridge_timeout":3,"wallet.bridge_op_expired":3,"wallet.bridge_invalid_response":9,"wallet.transaction_reverted":12,"wallet.transaction_status_unknown":9,"raw.disabled":10,internal:1};var rn=new RegExp(["\\u001b\\[[0-9;:<=>?]*[ -/]*[@-~]","\\u009b[0-9;:<=>?]*[ -/]*[@-~]","\\u001b\\][^\\u0007\\u001b\\u009c]*(?:\\u0007|\\u001b\\\\|\\u009c)","\\u009d[^\\u0007\\u001b\\u009c]*(?:\\u0007|\\u001b\\\\|\\u009c)","\\u001b[ -/]+[0-~]","\\u001b[0-Z\\x5c-~]","\\u001b\\[[0-9;:<=>?]*[ -/]*","\\u009b[0-9;:<=>?]*[ -/]*","[\\u0007\\u001b\\u0090\\u0098\\u009b\\u009c\\u009d\\u009e\\u009f]"].join("|"),"g");function z(e){return(typeof e=="string"?e:String(e??"")).replace(rn,"")}var sn=64;function K(e,n=new Map,t=0){if(typeof e=="string")return z(e);if(e===null||typeof e!="object")return e;let i=n.get(e);if(i!==void 0)return i;if(t>=sn)return e;if(Array.isArray(e)){let r=[];n.set(e,r);for(let s of e)r.push(K(s,n,t+1));return r}let a=Object.getPrototypeOf(e);if(a!==Object.prototype&&a!==null)return e;let o={};n.set(e,o);for(let[r,s]of Object.entries(e))Object.defineProperty(o,r,{value:K(s,n,t+1),writable:!0,enumerable:!0,configurable:!0});return o}var d=class extends Error{code;details;constructor(n,t,i){super(z(t)),this.code=n,this.details=i&&K(i),this.name="AllscaleError"}get exitCode(){return on[this.code]}toJSON(){return{error:{code:this.code,message:this.message,...this.details?{details:this.details}:{}}}}};function ke(e){if(e instanceof d)return e;if(e instanceof Error){if(un(e)){let n=cn(e),t={};return e.name&&e.name!=="Error"&&(t.name=e.name),Object.keys(n).length>0&&(t.oclif=n),new d("input.invalid",e.message,Object.keys(t).length>0?t:void 0)}return new d("internal",e.message,{name:e.name})}return new d("internal","Unknown error",{value:String(e)})}var ln=new Set(["CLIError","CLIParseError","RequiredArgsError","RequiredFlagError","UnexpectedArgsError","FlagInvalidOptionError","ArgInvalidOptionError","InvalidArgsSpecError"]),dn=[/^Missing \d+ required arg/i,/^Missing required flag/i,/^Unexpected argument/i,/^Nonexistent flag/i,/^Unexpected arguments?/i,/^Failed parsing/i,/^Parsing --[A-Za-z0-9][A-Za-z0-9-]*(?:\s|$)/i,/^Expected (?:--|-).*/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* can only be specified once\.?$/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* expects a value$/i,/^Flag --[A-Za-z0-9][A-Za-z0-9-]* expects one of these values: /i,/to be one of: /];function un(e){if(pn(e))return!0;let n=e.name??"";return ln.has(n)?n==="CLIError"?W(e,"parse")||Se(e.message):!0:Se(e.message)}function pn(e){if(!W(e,"oclif"))return!1;let n=e.oclif;return typeof n=="object"&&n!==null&&n.exit===2&&W(e,"parse")}function Se(e){return e?z(e).split(`
2
2
  `).some(n=>dn.some(t=>t.test(n.trim()))):!1}function W(e,n){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,n)}function cn(e){let n=e,t={};for(let i of["code","exitCode","suggestions","ref"])n[i]!==void 0&&(t[i]=n[i]);return t}function Ne(e){process.stdout.write(`${JSON.stringify({data:e},null,2)}
3
- `)}var l=A(require("fs")),$=A(require("path")),Be=A(require("crypto"));var mn="...<truncated>",fn=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+/g,yn=/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,ee=String.raw`(?:(?:Bearer|Basic)\s+)?(?:"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'|[^\s,;)}\]]+)`,H=String.raw`(?:proxy[_-]?)?authorization`,An=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${H}"|'${H}'|${H})\s*[:=]\s*)((?:Bearer|Basic)\s+)?(?!<redacted(?:-jwt)?>)${ee}`,"gi"),gn=/\b(https?:\/\/)[^\s/?#]+@/gi,_n=String.raw`(?:[A-Za-z0-9]+[_-])*`,hn=String.raw`(?:[A-Za-z0-9]{1,32}[_-]){0,8}`,Ce=e=>String.raw`(?:password|passwd|passphrase|otp(?:[_-]?code)?|signature|hmac|sig|session[_-]?id|mnemonic|seed|cookie|bearer|${e}(?:token|secret)|(?:api|access|private|signing)[_-]?key|credential|claim[_-]?url)`,be=Ce(_n),Ln=Ce(hn),Tn=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${be}"|'${be}'|${Ln})\s*[:=]\s*)(?!<redacted(?:-jwt)?>)${ee}`,"gi"),Z=String.raw`(?:[A-Za-z0-9]+(?:Token|Secret)|[Oo][Tt][Pp]Code|[Ss]essionId|(?:api|API|access|Access|private|Private|signing|Signing)Key|[Cc]laimUrl)`,Sn=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${Z}"|'${Z}'|${Z})\s*[:=]\s*)(?!<redacted(?:-jwt)?>)${ee}`,"g");function Ee(e){return e.replace(gn,"$1<redacted>@").replace(fn,"<redacted-jwt>").replace(An,"$1$2$3<redacted>").replace(Tn,"$1$2<redacted>").replace(Sn,"$1$2<redacted>").replace(yn,"Bearer <redacted>")}var kn=/(token|secret|password|passwd|passphrase|cookie|authorization|bearer|credential|mnemonic|seed|api[_-]?key|apikey|private[_-]?key|privkey|otp|signature|hmac|(?:^|[_-])sig(?:[_-]|$)|session[_-]?id|^input$)/i;function Oe(e){let n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2");return kn.test(n)}function Re(e){let n="";for(let t of e){let i=t.codePointAt(0),a=i<=8||i>=11&&i<=12||i>=14&&i<=31||i>=127&&i<=159;n+=a?`\\u${i.toString(16).padStart(4,"0")}`:t}return n}function Ie(e,n,t=mn){if(n<=0)return"";if(Buffer.byteLength(e,"utf8")<=n)return e;let i=Buffer.byteLength(t,"utf8");if(i>=n){let s="",u=0;for(let p of t){let y=Buffer.byteLength(p,"utf8");if(u+y>n)break;s+=p,u+=y}return s}let a=n-i,o="",r=0;for(let s of e){let u=Buffer.byteLength(s,"utf8");if(r+u>a)break;o+=s,r+=u}return`${o}${t}`}function c(e,n=16384){return Ie(Re(Ee(e)),n)}var X=100,Nn=8,bn=8*1024;function D(){return{remaining:bn}}function Q(e,n){let t=Math.min(16384,n.remaining),i=Ie(e,t);return n.remaining-=Buffer.byteLength(i,"utf8"),i}function h(e,n,t=0,i={}){if(t>Nn)return Q("<truncated>",n);if(typeof e=="string"){let a=Ee(e);return Q(i.escapeControls?Re(a):a,n)}if(Array.isArray(e)){let a=e.slice(0,X),o=a.map(r=>h(r,n,t+1,i));return e.length>a.length&&o.push(Q(`<${e.length-a.length} more items truncated>`,n)),o}if(e!==null&&typeof e=="object"){let a=Object.create(null),o=Object.entries(e);for(let[r,s]of o.slice(0,X))a[r]=h(s,n,t+1,i);return o.length>X&&(a.output_truncated=!0),a}return e}var ne=require("process");var te=!1;function ie(e){te=e}function Ue(){return te}var we="1";function T(e,n){if(te){let t={...e};delete t.version;let i=D(),a={event:t.event,...t},o=h(a,i,0,{escapeControls:!0}),r=JSON.stringify({version:we,...o});Buffer.byteLength(r,"utf8")+1>65536&&(r=JSON.stringify({version:we,event:o.event,output_truncated:!0})),ne.stderr.write(`${r}
3
+ `)}var l=A(require("fs")),$=A(require("path")),Be=A(require("crypto"));var mn="...<truncated>",fn=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]+/g,yn=/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,ee=String.raw`(?:(?:Bearer|Basic)\s+)?(?:"(?:\\.|[^"\\\r\n])*"|'(?:\\.|[^'\\\r\n])*'|[^\s,;)}\]]+)`,H=String.raw`(?:proxy[_-]?)?authorization`,An=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${H}"|'${H}'|${H})\s*[:=]\s*)((?:Bearer|Basic)\s+)?(?!<redacted(?:-jwt)?>)${ee}`,"gi"),gn=/\b(https?:\/\/)[^\s/?#]+@/gi,_n=String.raw`(?:[A-Za-z0-9]+[_-])*`,Ln=String.raw`(?:[A-Za-z0-9]{1,32}[_-]){0,8}`,Ce=e=>String.raw`(?:password|passwd|passphrase|otp(?:[_-]?code)?|signature|hmac|sig|session[_-]?id|mnemonic|seed|cookie|bearer|${e}(?:token|secret)|(?:api|access|private|signing)[_-]?key|credential|claim[_-]?url)`,be=Ce(_n),hn=Ce(Ln),Tn=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${be}"|'${be}'|${hn})\s*[:=]\s*)(?!<redacted(?:-jwt)?>)${ee}`,"gi"),Z=String.raw`(?:[A-Za-z0-9]+(?:Token|Secret)|[Oo][Tt][Pp]Code|[Ss]essionId|(?:api|API|access|Access|private|Private|signing|Signing)Key|[Cc]laimUrl)`,Sn=new RegExp(String.raw`(^|[^A-Za-z0-9])((?:"${Z}"|'${Z}'|${Z})\s*[:=]\s*)(?!<redacted(?:-jwt)?>)${ee}`,"g");function Ee(e){return e.replace(gn,"$1<redacted>@").replace(fn,"<redacted-jwt>").replace(An,"$1$2$3<redacted>").replace(Tn,"$1$2<redacted>").replace(Sn,"$1$2<redacted>").replace(yn,"Bearer <redacted>")}var kn=/(token|secret|password|passwd|passphrase|cookie|authorization|bearer|credential|mnemonic|seed|api[_-]?key|apikey|private[_-]?key|privkey|otp|signature|hmac|(?:^|[_-])sig(?:[_-]|$)|session[_-]?id|^input$)/i;function Oe(e){let n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2");return kn.test(n)}function Re(e){let n="";for(let t of e){let i=t.codePointAt(0),a=i<=8||i>=11&&i<=12||i>=14&&i<=31||i>=127&&i<=159;n+=a?`\\u${i.toString(16).padStart(4,"0")}`:t}return n}function Ie(e,n,t=mn){if(n<=0)return"";if(Buffer.byteLength(e,"utf8")<=n)return e;let i=Buffer.byteLength(t,"utf8");if(i>=n){let s="",u=0;for(let p of t){let y=Buffer.byteLength(p,"utf8");if(u+y>n)break;s+=p,u+=y}return s}let a=n-i,o="",r=0;for(let s of e){let u=Buffer.byteLength(s,"utf8");if(r+u>a)break;o+=s,r+=u}return`${o}${t}`}function c(e,n=16384){return Ie(Re(Ee(e)),n)}var X=100,Nn=8,bn=8*1024;function D(){return{remaining:bn}}function Q(e,n){let t=Math.min(16384,n.remaining),i=Ie(e,t);return n.remaining-=Buffer.byteLength(i,"utf8"),i}function L(e,n,t=0,i={}){if(t>Nn)return Q("<truncated>",n);if(typeof e=="string"){let a=Ee(e);return Q(i.escapeControls?Re(a):a,n)}if(Array.isArray(e)){let a=e.slice(0,X),o=a.map(r=>L(r,n,t+1,i));return e.length>a.length&&o.push(Q(`<${e.length-a.length} more items truncated>`,n)),o}if(e!==null&&typeof e=="object"){let a=Object.create(null),o=Object.entries(e);for(let[r,s]of o.slice(0,X))a[r]=L(s,n,t+1,i);return o.length>X&&(a.output_truncated=!0),a}return e}var ne=require("process");var te=!1;function ie(e){te=e}function Ue(){return te}var we="1";function T(e,n){if(te){let t={...e};delete t.version;let i=D(),a={event:t.event,...t},o=L(a,i,0,{escapeControls:!0}),r=JSON.stringify({version:we,...o});Buffer.byteLength(r,"utf8")+1>65536&&(r=JSON.stringify({version:we,event:o.event,output_truncated:!0})),ne.stderr.write(`${r}
4
4
  `)}else ne.stderr.write(n)}var ve="2",S=null,m=null,k=!1,E=!1;function Cn(){let e=process.env.ALLSCALE_OUTPUT_FILE_PATH;if(e)return e;let n=process.env.ALLSCALE_OUTPUT_FILE_DIRECTORY;if(n){let t=new Date().toISOString().replace(/[:.]/g,"-"),i=Be.randomBytes(4).toString("hex");return $.join(n,`allscale-output-${t}-${i}.ndjson`)}return null}var ae=64*1024*1024,En=null;function oe(e={}){if(e.quiet&&(E=!0),k)return;let n=Cn();if(!n)return;S=null;let t=null;try{if((En??process.platform)==="win32")throw new Error("owner-only sidecar ACLs cannot be enforced on Windows; sidecar output is disabled");let i=$.dirname(n);if(l.mkdirSync(i,{recursive:!0,mode:448}),!process.env.ALLSCALE_OUTPUT_FILE_PATH&&process.env.ALLSCALE_OUTPUT_FILE_DIRECTORY){let u=l.statSync(i),p=u.mode&511;if(!u.isDirectory()||(p&63)!==0)throw new Error(`output directory must be owner-only (no group/other permissions); current mode is ${p.toString(8).padStart(3,"0")}`)}let a=l.constants.O_NOFOLLOW??0;t=l.openSync(n,l.constants.O_APPEND|l.constants.O_CREAT|l.constants.O_WRONLY|(l.constants.O_NONBLOCK??0)|a,384);let o=l.fstatSync(t),r=l.lstatSync(n);if(!o.isFile()||r.isSymbolicLink()||r.dev!==o.dev||r.ino!==o.ino)throw new Error("target changed while it was being opened or is not a regular file");if(typeof process.geteuid=="function"&&o.uid!==process.geteuid())throw new Error("existing sidecar file is not owned by the current effective user");let s=o.mode&511;if((s&63)!==0)throw new Error(`existing sidecar file must already be owner-only; current mode is ${s.toString(8).padStart(3,"0")}. Rotate or remove it before retrying`);l.fchmodSync(t,384)}catch(i){if(t!==null)try{l.closeSync(t)}catch{}E||T({event:"sidecar_disabled",reason:"open_failed",detail:c(`sidecar path '${n}' could not be opened safely (${i.message})`)},`${c(`[allscale] sidecar path '${n}' could not be opened safely (${i.message}); refusing to write. Sidecar disabled for this run.`)}
5
- `);return}S=n,m=t,k=!0}var On=[/password/i,/secret/i,/token/i,/api[_-]?key/i,/signing[_-]?key/i,/private[_-]?key/i,/credential/i,/otp/i,/signature/i,/(?:^|[_-])sig(?:[_-]|$)/i,/hmac/i,/session[_-]?id/i,/nonce/i,/bearer/i,/authorization/i,/^code$/i,/^auth$/i,/^state$/i];function Rn(e){let n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2");return On.some(t=>t.test(n))}function In(e){try{let n=new URL(e),t=n.username.length>0||n.password.length>0;t&&(n.username="",n.password="");let i=n.pathname;n.pathname=wn(n.pathname);let a=t;n.pathname!==i&&(a=!0);for(let[o]of n.searchParams)Rn(o)&&(n.searchParams.set(o,"<redacted>"),a=!0);return a?n.toString():e}catch{return e}}function wn(e){return e.replace(/(\/(?:api\/)?(?:v1\/)?public\/claim-links\/)([^/:]+)(:claim)?(?=\/?$)/,"$1<redacted>$3").replace(/(\/(?:api\/)?public\/claim-links\/)([^/]+)(\/claim)(?=\/?$)/,"$1<redacted>$3")}function Un(e){return(e.type==="request"||e.type==="bridge_browser_open")&&typeof e.url=="string"?{...e,url:In(e.url)}:e}function vn(e){let n=new Date().toISOString(),t=e,{type:i,...a}=t,o=h(a,D()),r=JSON.stringify({version:ve,timestamp:n,type:i,...o});return Buffer.byteLength(r,"utf8")+1>65536&&(r=JSON.stringify({version:ve,timestamp:n,type:i,output_truncated:!0})),r}function N(e){if(!k||!S||m===null)return;let n=Un(e),t=vn(n);try{if(l.fstatSync(m).size+Buffer.byteLength(t,"utf8")+1>ae){k=!1;try{l.closeSync(m)}catch{}m=null,E||T({event:"sidecar_disabled",reason:"size_limit",...S===null?{}:{path:c(S)},max_bytes:ae},`${c(`[allscale] sidecar exceeded ${ae} bytes; disabling it for the rest of this run. Rotate or remove ${S}, or point ALLSCALE_OUTPUT_FILE_DIRECTORY at a directory so each run gets its own file.`)}
5
+ `);return}S=n,m=t,k=!0}var On=[/password/i,/secret/i,/token/i,/api[_-]?key/i,/signing[_-]?key/i,/private[_-]?key/i,/credential/i,/otp/i,/signature/i,/(?:^|[_-])sig(?:[_-]|$)/i,/hmac/i,/session[_-]?id/i,/nonce/i,/bearer/i,/authorization/i,/^code$/i,/^auth$/i,/^state$/i];function Rn(e){let n=e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2");return On.some(t=>t.test(n))}function In(e){try{let n=new URL(e),t=n.username.length>0||n.password.length>0;t&&(n.username="",n.password="");let i=n.pathname;n.pathname=wn(n.pathname);let a=t;n.pathname!==i&&(a=!0);for(let[o]of n.searchParams)Rn(o)&&(n.searchParams.set(o,"<redacted>"),a=!0);return a?n.toString():e}catch{return e}}function wn(e){return e.replace(/(\/(?:api\/)?(?:v1\/)?public\/claim-links\/)([^/:]+)(:claim)?(?=\/?$)/,"$1<redacted>$3").replace(/(\/(?:api\/)?public\/claim-links\/)([^/]+)(\/claim)(?=\/?$)/,"$1<redacted>$3")}function Un(e){return(e.type==="request"||e.type==="bridge_browser_open")&&typeof e.url=="string"?{...e,url:In(e.url)}:e}function vn(e){let n=new Date().toISOString(),t=e,{type:i,...a}=t,o=L(a,D()),r=JSON.stringify({version:ve,timestamp:n,type:i,...o});return Buffer.byteLength(r,"utf8")+1>65536&&(r=JSON.stringify({version:ve,timestamp:n,type:i,output_truncated:!0})),r}function N(e){if(!k||!S||m===null)return;let n=Un(e),t=vn(n);try{if(l.fstatSync(m).size+Buffer.byteLength(t,"utf8")+1>ae){k=!1;try{l.closeSync(m)}catch{}m=null,E||T({event:"sidecar_disabled",reason:"size_limit",...S===null?{}:{path:c(S)},max_bytes:ae},`${c(`[allscale] sidecar exceeded ${ae} bytes; disabling it for the rest of this run. Rotate or remove ${S}, or point ALLSCALE_OUTPUT_FILE_DIRECTORY at a directory so each run gets its own file.`)}
6
6
  `);return}l.appendFileSync(m,`${t}
7
7
  `)}catch(i){if(k=!1,m!==null){try{l.closeSync(m)}catch{}m=null}try{E||T({event:"sidecar_disabled",reason:"write_failed",detail:c(i.message)},`${c(`[allscale] sidecar write failed (${i.message}); disabling sidecar for the rest of this run.`)}
8
- `)}catch{}}}function Pe(){return!!(process.env.ALLSCALE_OUTPUT_FILE_PATH||process.env.ALLSCALE_OUTPUT_FILE_DIRECTORY)}function O(){if(E=!1,k=!1,m!==null){try{l.closeSync(m)}catch{}m=null}}function xe(e=!1){let n=process.stdin.isTTY===!0&&process.stdout.isTTY===!0;return e||Pe()||!n}var R=new Set(["--password","-p","--token","-t","--otp","--otp-id","--api-base","--payout-api-base","--browser-base","--input","-i","--claim-token","--claim-url","--api-key","--api-secret"]),Bn=new Set(Array.from(R).filter(e=>e.startsWith("-")&&!e.startsWith("--")&&e.length===2)),Pn=Array.from(R).filter(e=>e.startsWith("--")).sort((e,n)=>n.length-e.length),xn=new Set(["--otp-stdin","--password-stdin"]);function re(e){let n=[];for(let t=0;t<e.length;t+=1){let i=e[t];if(i.startsWith("-")){let o=i.indexOf("=");if(o!==-1){let r=i.slice(0,o);if(R.has(r)){n.push(`${r}=<redacted>`);continue}}}if(R.has(i)){n.push(i),t+1<e.length&&(R.has(e[t+1])||(n.push("<redacted>"),t+=1));continue}if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2&&i[1]!=="="){let o=i.slice(0,2);if(Bn.has(o)){n.push(`${o}<redacted>`);continue}}let a=xn.has(i)?void 0:Pn.find(o=>i.length>o.length&&i.startsWith(o));if(a){n.push(`${a}<redacted>`);continue}n.push(i)}return n}function De(e){N({type:"error",code:e.code,message:c(e.message)}),N({type:"command-end",ok:!1,exitCode:e.exitCode}),O()}var I=C()??Ae,w={TOKEN:"ALLSCALE_TOKEN",PROFILE:"ALLSCALE_PROFILE",API_BASE:"ALLSCALE_API_BASE",PAYOUT_API_BASE:"ALLSCALE_PAYOUT_API_BASE",PRETTY:"ALLSCALE_PRETTY",LOG_LEVEL:"ALLSCALE_LOG_LEVEL",INSECURE_STORAGE:"ALLSCALE_INSECURE_STORAGE",NO_KEYCHAIN:"ALLSCALE_NO_KEYCHAIN",ALLOW_RAW:"ALLSCALE_ALLOW_RAW",OUTPUT_FILE_PATH:"ALLSCALE_OUTPUT_FILE_PATH",OUTPUT_FILE_DIRECTORY:"ALLSCALE_OUTPUT_FILE_DIRECTORY",STORE_API_KEY:"ALLSCALE_STORE_API_KEY",STORE_API_SECRET:"ALLSCALE_STORE_API_SECRET"};function se(e){return he(e)?new URL(e).origin:null}function U(e){try{let n=new URL(e);return`${n.protocol}//${n.host}`}catch{return"<unparseable URL>"}}function $e(){let e=process.env[w.TOKEN]?.trim();return e&&e.length>0?e:void 0}function le(){let e=process.env[w.PROFILE]?.trim();return e&&e.length>0?e:void 0}function v(){let e=process.env[w.API_BASE]?.trim();return e&&e.length>0?e:void 0}function Fe(){let e=process.env[w.INSECURE_STORAGE]?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}function Ve(){let e=process.env[w.ALLOW_RAW]?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}function Me(e){let{resolvedApiBase:n,fromExplicitOverride:t,profileApiBase:i,profileApiBaseSource:a}=e;if(C()===void 0&&I!==""&&"".length!==0&&!t&&a!=="explicit"&&i===""&&n==="")return`Notice: this profile is pinned to ${""} (staging) in ~/.allscale/config.toml.
8
+ `)}catch{}}}function xe(){return!!(process.env.ALLSCALE_OUTPUT_FILE_PATH||process.env.ALLSCALE_OUTPUT_FILE_DIRECTORY)}function O(){if(E=!1,k=!1,m!==null){try{l.closeSync(m)}catch{}m=null}}function Pe(e=!1){let n=process.stdin.isTTY===!0&&process.stdout.isTTY===!0;return e||xe()||!n}var R=new Set(["--password","-p","--token","-t","--otp","--otp-id","--api-base","--payout-api-base","--browser-base","--input","-i","--claim-token","--claim-url","--api-key","--api-secret"]),Bn=new Set(Array.from(R).filter(e=>e.startsWith("-")&&!e.startsWith("--")&&e.length===2)),xn=Array.from(R).filter(e=>e.startsWith("--")).sort((e,n)=>n.length-e.length),Pn=new Set(["--otp-stdin","--password-stdin"]);function re(e){let n=[];for(let t=0;t<e.length;t+=1){let i=e[t];if(i.startsWith("-")){let o=i.indexOf("=");if(o!==-1){let r=i.slice(0,o);if(R.has(r)){n.push(`${r}=<redacted>`);continue}}}if(R.has(i)){n.push(i),t+1<e.length&&(R.has(e[t+1])||(n.push("<redacted>"),t+=1));continue}if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2&&i[1]!=="="){let o=i.slice(0,2);if(Bn.has(o)){n.push(`${o}<redacted>`);continue}}let a=Pn.has(i)?void 0:xn.find(o=>i.length>o.length&&i.startsWith(o));if(a){n.push(`${a}<redacted>`);continue}n.push(i)}return n}function De(e){N({type:"error",code:e.code,message:c(e.message)}),N({type:"command-end",ok:!1,exitCode:e.exitCode}),O()}var I=C()??Ae,w={TOKEN:"ALLSCALE_TOKEN",PROFILE:"ALLSCALE_PROFILE",API_BASE:"ALLSCALE_API_BASE",PAYOUT_API_BASE:"ALLSCALE_PAYOUT_API_BASE",PRETTY:"ALLSCALE_PRETTY",LOG_LEVEL:"ALLSCALE_LOG_LEVEL",INSECURE_STORAGE:"ALLSCALE_INSECURE_STORAGE",NO_KEYCHAIN:"ALLSCALE_NO_KEYCHAIN",ALLOW_RAW:"ALLSCALE_ALLOW_RAW",OUTPUT_FILE_PATH:"ALLSCALE_OUTPUT_FILE_PATH",OUTPUT_FILE_DIRECTORY:"ALLSCALE_OUTPUT_FILE_DIRECTORY",STORE_API_KEY:"ALLSCALE_STORE_API_KEY",STORE_API_SECRET:"ALLSCALE_STORE_API_SECRET"};function se(e){return Le(e)?new URL(e).origin:null}function U(e){try{let n=new URL(e);return`${n.protocol}//${n.host}`}catch{return"<unparseable URL>"}}function $e(){let e=process.env[w.TOKEN]?.trim();return e&&e.length>0?e:void 0}function le(){let e=process.env[w.PROFILE]?.trim();return e&&e.length>0?e:void 0}function v(){let e=process.env[w.API_BASE]?.trim();return e&&e.length>0?e:void 0}function Fe(){let e=process.env[w.INSECURE_STORAGE]?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}function Ve(){let e=process.env[w.ALLOW_RAW]?.trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}function Me(e){let{resolvedApiBase:n,fromExplicitOverride:t,profileApiBase:i,profileApiBaseSource:a}=e;if(C()===void 0&&I!==""&&"".length!==0&&!t&&a!=="explicit"&&i===""&&n==="")return`Notice: this profile is pinned to ${""} (staging) in ~/.allscale/config.toml.
9
9
  The CLI default is now ${I} (production), but a saved profile wins over the default,
10
10
  so this session still uses staging. That pin was written before the default changed, so it may just be
11
11
  the old default rather than a deliberate choice.
12
12
  To keep staging, re-run \`allscale device-login\` with --api-base ${""} (recorded as deliberate, silences this).
13
13
  To move to production, run: allscale device-login --api-base ${I}
14
- `}var g=A(require("fs")),Ge=A(require("os")),de=A(require("path")),ue=A(require("@iarna/toml"));var Fn=".allscale",Vn="config.toml";function Mn(){return de.join(Ge.homedir(),Fn)}function Gn(){return de.join(Mn(),Vn)}function Je(){let e=Gn();if(!g.existsSync(e))return{};let n=g.readFileSync(e,"utf-8");try{return ue.parse(n)}catch(t){throw new d("internal",`Failed to parse ${e}: ${t.message}`)}}function je(e,n){return e.profile?.[n]}function qe(e,n,t){let i=n??t??e.default??"default";if(i.includes(":"))throw new d("input.invalid",`Invalid profile name '${i}': ':' is reserved as the keychain namespace separator \u2014 pick a name without ':'.`);return i}function pe(e){if(!q(e))throw new d("input.invalid",`Refusing to send credentials to API base ${U(e)}. `+j)}function Ye(e){let n=jn(e);if(n)throw new d("input.invalid",n.message)}function Jn(){let e=C();if(e===void 0)return;let n=Te();return n.length>0?{endpoints:n.map(t=>t.base),fromPairs:!0}:{endpoints:[e],fromPairs:!1}}function jn(e){let n=Jn();if(n===void 0||Le(e))return;let{endpoints:t,fromPairs:i}=n,a=se(e),o=t.map(s=>se(s)).filter(s=>s!==null);if(a!==null&&o.includes(a))return;let r=t.map(s=>U(s)).join(", ");return{message:i?`Refusing to send to ${U(e)} \u2014 this build only signs for: ${r}. Re-login against one of this build's environments, or use a build that includes the one you need.`:`Refusing to send to ${U(e)} \u2014 this build only signs for ${r}. Re-login against this build's environment, or use a build for that one.`}}var qn=require("@noble/hashes/sha3");var Ke=["USDT","USDC"];var Kt=new Set([`0x${"0".repeat(40)}`,`0x${"0".repeat(36)}dead`]);var Yn="unknown_otp_id",Kn="invalid_code",Wn="expired_code";function zn(e){return`'${e.replace(/'/g,"'\\''")}'`}function We(e){return`Run \`allscale otp-send --email ${zn(e)}\` first \u2014 that command does report a missing account \u2014 then retry with the otp_id it returns and a fresh code.`}var Hn=new Map([[Yn,(e,n)=>`${e}: this environment never issued the --otp-id you passed for '${n}', so the verification code was never the problem. The backend decides this by comparing the otp_id against that address alone, so it says nothing about whether the account exists. ${We(n)}`],[Kn,e=>`${e}: the --otp-id is one this environment issued and a live code stands behind it \u2014 the verification code you passed is what does not match. Check for a typo \u2014 the backend invalidates the code after a few wrong answers, so if you are unsure, request a fresh code instead of guessing.`],[Wn,(e,n,t)=>t?`${e}: this run's send request was accepted moments ago, but this attempt could not claim a live code for the --otp-id. Delivery is asynchronous and the code is stored only after the email goes out, so it may still be in flight \u2014 or the send may have failed outright, in which case no code is coming. The code you submitted may also have expired, been used, run out of attempts, or been replaced by a newer send. Check the inbox, including spam, and retry with whatever code arrived. If nothing arrives, confirm the address and wait at least three minutes before requesting one fresh code \u2014 sends are rate-limited per address, and retrying in a tight loop spends that budget even when the send is rejected.`:`${e}: this attempt could not claim a live code for the --otp-id. The code you submitted may have expired, been used, run out of attempts, been replaced by a later send, or never have been requested for this address; the backend does not distinguish those. If a newer code was delivered after the one you entered, use that one. ${We(n)}`]]);var ze=[...Hn.keys()];var P=require("@oclif/core"),B=class e extends f.Command{static enableJsonFlag=!0;static legacyStagingNoticeShown=!1;static emitsOwnOutput=!1;static requiresEscapeHatch=!1;static requiresInput=!1;static isLocalOnly=!1;static baseFlags={profile:f.Flags.string({description:"Named profile from ~/.allscale/config.toml",helpGroup:"GLOBAL"}),token:f.Flags.string({description:"Override the access token for this invocation (precedence: --token > ALLSCALE_TOKEN > --profile)",helpGroup:"GLOBAL",hidden:_()==="public"}),"api-base":f.Flags.string({description:J,helpGroup:"GLOBAL",hidden:_()==="public"}),"insecure-storage":f.Flags.boolean({description:"Force POSIX plaintext token storage at ~/.allscale/credentials.json (mode 0600) instead of the OS keychain \u2014 for headless / CI / agent use. Unavailable on Windows because Node cannot verify owner-only ACL/link safety. Also via ALLSCALE_INSECURE_STORAGE=1.",default:!1,helpGroup:"GLOBAL"})};async run(){try{ie(this.jsonEnabled()),oe(),N({type:"session-start",command:this.id??"",argv:re(this.argv)});let n=this.constructor;if(_()==="public"){if(this.argv.some(o=>o==="--token"||o.startsWith("--token=")))throw new d("input.invalid","--token is not supported in this build. Set the ALLSCALE_TOKEN environment variable instead (it does not leak into shell history or process listings).");if(this.argv.some(o=>o==="--api-base"||o.startsWith("--api-base=")))throw new d("input.invalid","--api-base is not supported in this build; it always talks to its bound AllScale environment.");if(!n.isLocalOnly&&v()!==void 0)throw new d("input.invalid","ALLSCALE_API_BASE is not supported in this build; unset it \u2014 this build always talks to its bound AllScale environment.")}let t=xe(this.jsonEnabled()),i=this.argv.length===0&&!t&&ot(n)?this.config.findCommand(this.id??""):void 0;if(i){O();let o=await(0,f.loadHelpClass)(this.config),r=this.config.pjson.oclif?.helpOptions??this.config.pjson.helpOptions;await new o(this.config,r).showCommandHelp(i,this.config.topics);return}if(n.requiresEscapeHatch&&!Ve())throw this.argv.length>0&&await this.parse(),new d("raw.disabled","This command is an opt-in escape hatch and is disabled by default. Set ALLSCALE_ALLOW_RAW=1 to enable raw GraphQL/REST passthroughs and schema introspection. Access remains governed by the key's granted scopes, which the backend checks on each request.");let a=await this.runCommand();return N({type:"command-end",ok:!0}),O(),n.emitsOwnOutput?void 0:(this.jsonEnabled()||Ne(a),{data:a})}catch(n){let t=ke(n);De({code:t.code,message:t.message,exitCode:t.exitCode}),this.emitError(t),process.exitCode=t.exitCode;return}finally{ie(!1)}}resolveSessionApiBaseChain(n){let t=Je(),i=n.profile??void 0,a=n["api-base"]??void 0,o=i!==void 0||le()!==void 0,r=qe(t,i,le()),s=je(t,r),u=_()==="public"&&v()!==void 0,p=a??(u?void 0:v()),y=p??s?.api_base??I,G=Me({resolvedApiBase:y,fromExplicitOverride:p!==void 0,profileApiBase:s?.api_base,profileApiBaseSource:s?.api_base_source});return G&&!e.legacyStagingNoticeShown&&(e.legacyStagingNoticeShown=!0,T({event:"legacy_staging_profile",api_base:y,profile:r},G)),{apiBase:y,explicitApiBase:p,envApiBaseIgnored:u,profileApiBase:s?.api_base,profile:r,profileExplicit:o}}resolveSessionApiBaseForPayoutDerivation(n){let{apiBase:t}=this.resolveSessionApiBaseChain(n);return this.constructor.isLocalOnly||pe(t),t}resolveContext(n){if(_()==="public"){if(n.token!==void 0)throw new d("input.invalid","--token is not supported in this build. Set the ALLSCALE_TOKEN environment variable instead (it does not leak into shell history or process listings).");if(n["api-base"]!==void 0)throw new d("input.invalid","--api-base is not supported in this build; it always talks to its bound AllScale environment.");if(!this.constructor.isLocalOnly&&v()!==void 0)throw new d("input.invalid","ALLSCALE_API_BASE is not supported in this build; unset it \u2014 this build always talks to its bound AllScale environment.")}let t=n.token??void 0,i=!!n["insecure-storage"],{apiBase:a,explicitApiBase:o,envApiBaseIgnored:r,profile:s,profileApiBase:u,profileExplicit:p}=this.resolveSessionApiBaseChain(n);return this.constructor.isLocalOnly||(pe(a),Ye(a)),{apiBase:a,profile:s,token:t??$e(),insecureStorage:i||Fe(),apiBaseSource:o!==void 0?"explicit":u!==void 0?"profile":"default",profileExplicit:p,envApiBaseIgnored:r}}emitError(n){process.stderr.write(`${at(n)}
15
- `)}};var Zn=/_(removed|cleared|count|total)$/i;function Xn(e,n){return typeof n=="number"&&Zn.test(e)}var Qn=new Set(Ke);function et(e,n){return e==="token_symbol"&&typeof n=="string"&&Qn.has(n)}var nt=new Set(ze);function tt(e,n){return e==="otp_reason"&&typeof n=="string"&&nt.has(n)}var F=100;function V(e,n=0){if(n>8)return"<truncated>";if(Array.isArray(e)){let t=e.slice(0,F),i=t.map(a=>V(a,n+1));return e.length>t.length&&i.push(`<${e.length-t.length} more items truncated>`),i}if(e!==null&&typeof e=="object"){let t=Object.create(null),i=Object.entries(e);for(let[a,o]of i.slice(0,F))t[a]=Oe(a)&&!Xn(a,o)&&!et(a,o)&&!tt(a,o)?"<redacted>":V(o,n+1);if(i.length>F){let a="<truncated>";for(;a in t;)a=`<${a}>`;t[a]=`${i.length-F} more keys`}return t}if(typeof e=="string"){let t=it(e);return t!==void 0?c(JSON.stringify(V(t,n+1))):c(e)}return e}function it(e){let n=e.trim();if(!n.startsWith("{")&&!n.startsWith("["))return;let t;try{t=JSON.parse(n)}catch{return}return t!==null&&typeof t=="object"?t:void 0}function at(e){let n=Ue()?void 0:2,t=V(e.toJSON()),i=JSON.stringify(t,null,n);return Buffer.byteLength(i,"utf8")+1<=65536?i:JSON.stringify({error:{code:e.code,message:c(e.message),details:{output_truncated:!0,max_output_bytes:65536}}},null,n)}function ot(e){if(e.requiresInput===!0)return!0;let n=a=>typeof a=="object"&&a!==null&&a.required===!0,t=e.flags??{},i=e.args??{};return Object.values(t).some(a=>n(a))||Object.values(i).some(a=>n(a))}var He=[{name:"create_claim_link",kind:"mutation",description:"Create a single App claim link. Returns the pending link, funding address, exact deposit total, and bearer claim URL. The link becomes available after the sender's deposit is confirmed. No claim-back.",args:[{name:"input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateClaimLinkInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"CreateClaimLinkResult",ofType:null}},deprecated:null},{name:"create_contact",kind:"mutation",description:"create a new contact",args:[{name:"create_input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateContactInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"create_payment",kind:"mutation",description:"create a new payment",args:[{name:"payment",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreatePaymentInput",ofType:null}},defaultValue:null},{name:"wallet_ids",description:null,type:{kind:"LIST",name:null,ofType:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}}},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"create_store",kind:"mutation",description:"create store",args:[{name:"input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateStoreInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"StoreCreateResult",ofType:null}},deprecated:null},{name:"update_payment",kind:"mutation",description:"update an existing payment status by its ID",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"payment",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"UpdatePaymentInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"activities",kind:"query",description:"Get current user's activity list with multi-dimensional filters (type, status, contact, wallet, time range, amount range)",args:[{name:"filter_input",description:null,type:{kind:"INPUT_OBJECT",name:"ActivityFilterInput",ofType:null},defaultValue:"null"},{name:"skip",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"Int",ofType:null}},defaultValue:"0"},{name:"limit",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"Int",ofType:null}},defaultValue:"20"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ActivityItemPaginatedResponse",ofType:null}},deprecated:null},{name:"auto_payout_session_status",kind:"query",description:"Return the current merchant auto-payout status, expiry, total/used/remaining USD cap, per-transaction limit, and authorized chain/token pairs. Merchants without an active setup receive provisioned=false with null money/expiry fields and no pairs.",args:[],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"AutoPayoutSessionStatus",ofType:null}},deprecated:null},{name:"business",kind:"query",description:"get one business by it's id",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Business",ofType:null}},deprecated:null},{name:"business_contact_by_email",kind:"query",description:"Look up the contact card of the business whose login email is given. Used to fill the invoice header's From: block with the same name/email/phone the web editor shows.",args:[{name:"email",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"BusinessContact",ofType:null}},deprecated:null},{name:"business_transaction_records",kind:"query",description:"get transaction records for business",args:[{name:"direction",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"transaction_type",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"status",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"TransactionPaginatedResponse",ofType:null}},deprecated:null},{name:"business_wallets",kind:"query",description:"List the CALLER'S OWN non-custodial wallets (id, chain, address, coin balances). Takes no business id \u2014 the owner is derived from the authenticated identity, so there is no caller-supplied id to mismatch and no way to read another merchant's wallets. Returns [] when the account has no wallet yet.",args:[],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"LIST",name:null,ofType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"WalletEmbedded",ofType:null}}}},deprecated:null},{name:"claim_link",kind:"query",description:"Get one of the caller's own claim links by id (sender surface). A non-owned or unknown id returns CLAIM_LINK_NOT_AVAILABLE \u2014 no existence leak.",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ClaimLink",ofType:null}},deprecated:null},{name:"contact",kind:"query",description:"get one contact by it's id",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"contact_by_email",kind:"query",description:"get one contact by it's email",args:[{name:"email",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"contacts",kind:"query",description:"get multi contacts by owner business id",args:[{name:"owner_business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ContactPaginatedResponse",ofType:null}},deprecated:null},{name:"my_claim_links",kind:"query",description:"List the caller's claim links, newest first. Optional status and link_source filters narrow the results; query_input controls pagination, ordering, and the created_at time range.",args:[{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"},{name:"status",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"link_source",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ClaimLinkPaginatedResponse",ofType:null}},deprecated:null},{name:"my_transactions",kind:"query",description:"get one user's successful transactions by query",args:[{name:"query_input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"TransactionPaginatedResponse",ofType:null}},deprecated:null},{name:"payment",kind:"query",description:"get one payment by its ID",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"payments",kind:"query",description:"All payments by business ID as sender or recipient",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"recipient_payments",kind:"query",description:"Get multiple payments by business ID as recipient",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"sender_payments",kind:"query",description:"Get multiple payments by business ID as sender",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"transaction",kind:"query",description:"get one transaction by id_str",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Transaction",ofType:null}},deprecated:null}];var ce={source:"public-cli-contract",synced_at:"2026-08-03T03:01:54.000Z"};var M=class e extends B{static requiresEscapeHatch=!0;static isLocalOnly=!0;static description="List every operation exposed by the schema (queries and mutations). Disabled by default (exit 10); set ALLSCALE_ALLOW_RAW=1 to enable.";static examples=["$ allscale operations","$ allscale operations --kind mutation","$ allscale operations --grep invoice"];static flags={kind:P.Flags.string({char:"k",description:"Filter by operation kind",options:["query","mutation"]}),grep:P.Flags.string({char:"g",description:"Filter by substring match against name + description (case-insensitive)"}),...B.baseFlags};async runCommand(){let{flags:n}=await this.parse(e),t=n.kind,i=n.grep?.toLowerCase(),a=He.filter(r=>!(t&&r.kind!==t||i&&!`${r.name} ${r.description??""}`.toLowerCase().includes(i))),o={query:0,mutation:0};for(let r of a)o[r.kind]=(o[r.kind]??0)+1;return{total:a.length,by_kind:o,schema_source:ce.source,schema_synced_at:ce.synced_at,operations:a.map(r=>({name:r.name,kind:r.kind,description:r.description,arg_names:r.args.map(s=>s.name),return_type:me(r.returnType)}))}}};function me(e){return e.kind==="NON_NULL"&&e.ofType?`${me(e.ofType)}!`:e.kind==="LIST"&&e.ofType?`[${me(e.ofType)}]`:e.name??"Unknown"}
14
+ `}var g=A(require("fs")),Ge=A(require("os")),de=A(require("path")),ue=A(require("@iarna/toml"));var Fn=".allscale",Vn="config.toml";function Mn(){return de.join(Ge.homedir(),Fn)}function Gn(){return de.join(Mn(),Vn)}function Je(){let e=Gn();if(!g.existsSync(e))return{};let n=g.readFileSync(e,"utf-8");try{return ue.parse(n)}catch(t){throw new d("internal",`Failed to parse ${e}: ${t.message}`)}}function qe(e,n){return e.profile?.[n]}function je(e,n,t){let i=n??t??e.default??"default";if(i.includes(":"))throw new d("input.invalid",`Invalid profile name '${i}': ':' is reserved as the keychain namespace separator \u2014 pick a name without ':'.`);return i}function pe(e){if(!j(e))throw new d("input.invalid",`Refusing to send credentials to API base ${U(e)}. `+q)}function Ye(e){let n=qn(e);if(n)throw new d("input.invalid",n.message)}function Jn(){let e=C();if(e===void 0)return;let n=Te();return n.length>0?{endpoints:n.map(t=>t.base),fromPairs:!0}:{endpoints:[e],fromPairs:!1}}function qn(e){let n=Jn();if(n===void 0||he(e))return;let{endpoints:t,fromPairs:i}=n,a=se(e),o=t.map(s=>se(s)).filter(s=>s!==null);if(a!==null&&o.includes(a))return;let r=t.map(s=>U(s)).join(", ");return{message:i?`Refusing to send to ${U(e)} \u2014 this build only signs for: ${r}. Re-login against one of this build's environments, or use a build that includes the one you need.`:`Refusing to send to ${U(e)} \u2014 this build only signs for ${r}. Re-login against this build's environment, or use a build for that one.`}}var jn=require("@noble/hashes/sha3");var Ke=["USDT","USDC"];var Kt=new Set([`0x${"0".repeat(40)}`,`0x${"0".repeat(36)}dead`]);var Yn="unknown_otp_id",Kn="invalid_code",Wn="expired_code";function zn(e){return`'${e.replace(/'/g,"'\\''")}'`}function We(e){return`Run \`allscale otp-send --email ${zn(e)}\` first \u2014 that command does report a missing account \u2014 then retry with the otp_id it returns and a fresh code.`}var Hn=new Map([[Yn,(e,n)=>`${e}: this environment never issued the --otp-id you passed for '${n}', so the verification code was never the problem. The backend decides this by comparing the otp_id against that address alone, so it says nothing about whether the account exists. ${We(n)}`],[Kn,e=>`${e}: the --otp-id is one this environment issued and a live code stands behind it \u2014 the verification code you passed is what does not match. Check for a typo \u2014 the backend invalidates the code after a few wrong answers, so if you are unsure, request a fresh code instead of guessing.`],[Wn,(e,n,t)=>t?`${e}: this run's send request was accepted moments ago, but this attempt could not claim a live code for the --otp-id. Delivery is asynchronous and the code is stored only after the email goes out, so it may still be in flight \u2014 or the send may have failed outright, in which case no code is coming. The code you submitted may also have expired, been used, run out of attempts, or been replaced by a newer send. Check the inbox, including spam, and retry with whatever code arrived. If nothing arrives, confirm the address and wait at least three minutes before requesting one fresh code \u2014 sends are rate-limited per address, and retrying in a tight loop spends that budget even when the send is rejected.`:`${e}: this attempt could not claim a live code for the --otp-id. The code you submitted may have expired, been used, run out of attempts, been replaced by a later send, or never have been requested for this address; the backend does not distinguish those. If a newer code was delivered after the one you entered, use that one. ${We(n)}`]]);var ze=[...Hn.keys()];var x=require("@oclif/core"),B=class e extends f.Command{static enableJsonFlag=!0;static legacyStagingNoticeShown=!1;static emitsOwnOutput=!1;static requiresEscapeHatch=!1;static requiresInput=!1;static isLocalOnly=!1;static baseFlags={profile:f.Flags.string({description:"Named profile from ~/.allscale/config.toml",helpGroup:"GLOBAL"}),token:f.Flags.string({description:"Override the access token for this invocation (precedence: --token > ALLSCALE_TOKEN > --profile)",helpGroup:"GLOBAL",hidden:_()==="public"}),"api-base":f.Flags.string({description:J,helpGroup:"GLOBAL",hidden:_()==="public"}),"insecure-storage":f.Flags.boolean({description:"Force POSIX plaintext token storage at ~/.allscale/credentials.json (mode 0600) instead of the OS keychain \u2014 for headless / CI / agent use. Unavailable on Windows because Node cannot verify owner-only ACL/link safety. Also via ALLSCALE_INSECURE_STORAGE=1.",default:!1,helpGroup:"GLOBAL"})};async run(){try{ie(this.jsonEnabled()),oe(),N({type:"session-start",command:this.id??"",argv:re(this.argv)});let n=this.constructor;if(_()==="public"){if(this.argv.some(o=>o==="--token"||o.startsWith("--token=")))throw new d("input.invalid","--token is not supported in this build. Set the ALLSCALE_TOKEN environment variable instead (it does not leak into shell history or process listings).");if(this.argv.some(o=>o==="--api-base"||o.startsWith("--api-base=")))throw new d("input.invalid","--api-base is not supported in this build; it always talks to its bound AllScale environment.");if(!n.isLocalOnly&&v()!==void 0)throw new d("input.invalid","ALLSCALE_API_BASE is not supported in this build; unset it \u2014 this build always talks to its bound AllScale environment.")}let t=Pe(this.jsonEnabled()),i=this.argv.length===0&&!t&&ot(n)?this.config.findCommand(this.id??""):void 0;if(i){O();let o=await(0,f.loadHelpClass)(this.config),r=this.config.pjson.oclif?.helpOptions??this.config.pjson.helpOptions;await new o(this.config,r).showCommandHelp(i,this.config.topics);return}if(n.requiresEscapeHatch&&!Ve())throw this.argv.length>0&&await this.parse(),new d("raw.disabled","This command is an opt-in escape hatch and is disabled by default. Set ALLSCALE_ALLOW_RAW=1 to enable raw GraphQL/REST passthroughs and schema introspection. Access remains governed by the key's granted scopes, which the backend checks on each request.");let a=await this.runCommand();return N({type:"command-end",ok:!0}),O(),n.emitsOwnOutput?void 0:(this.jsonEnabled()||Ne(a),{data:a})}catch(n){let t=ke(n);De({code:t.code,message:t.message,exitCode:t.exitCode}),this.emitError(t),process.exitCode=t.exitCode;return}finally{ie(!1)}}resolveSessionApiBaseChain(n){let t=Je(),i=n.profile??void 0,a=n["api-base"]??void 0,o=i!==void 0||le()!==void 0,r=je(t,i,le()),s=qe(t,r),u=_()==="public"&&v()!==void 0,p=a??(u?void 0:v()),y=p??s?.api_base??I,G=Me({resolvedApiBase:y,fromExplicitOverride:p!==void 0,profileApiBase:s?.api_base,profileApiBaseSource:s?.api_base_source});return G&&!e.legacyStagingNoticeShown&&(e.legacyStagingNoticeShown=!0,T({event:"legacy_staging_profile",api_base:y,profile:r},G)),{apiBase:y,explicitApiBase:p,envApiBaseIgnored:u,profileApiBase:s?.api_base,profile:r,profileExplicit:o}}resolveSessionApiBaseForPayoutDerivation(n){let{apiBase:t}=this.resolveSessionApiBaseChain(n);return this.constructor.isLocalOnly||pe(t),t}resolveContext(n){if(_()==="public"){if(n.token!==void 0)throw new d("input.invalid","--token is not supported in this build. Set the ALLSCALE_TOKEN environment variable instead (it does not leak into shell history or process listings).");if(n["api-base"]!==void 0)throw new d("input.invalid","--api-base is not supported in this build; it always talks to its bound AllScale environment.");if(!this.constructor.isLocalOnly&&v()!==void 0)throw new d("input.invalid","ALLSCALE_API_BASE is not supported in this build; unset it \u2014 this build always talks to its bound AllScale environment.")}let t=n.token??void 0,i=!!n["insecure-storage"],{apiBase:a,explicitApiBase:o,envApiBaseIgnored:r,profile:s,profileApiBase:u,profileExplicit:p}=this.resolveSessionApiBaseChain(n);return this.constructor.isLocalOnly||(pe(a),Ye(a)),{apiBase:a,profile:s,token:t??$e(),insecureStorage:i||Fe(),apiBaseSource:o!==void 0?"explicit":u!==void 0?"profile":"default",profileExplicit:p,envApiBaseIgnored:r}}emitError(n){process.stderr.write(`${at(n)}
15
+ `)}};var Zn=/_(removed|cleared|count|total)$/i;function Xn(e,n){return typeof n=="number"&&Zn.test(e)}var Qn=new Set(Ke);function et(e,n){return e==="token_symbol"&&typeof n=="string"&&Qn.has(n)}var nt=new Set(ze);function tt(e,n){return e==="otp_reason"&&typeof n=="string"&&nt.has(n)}var F=100;function V(e,n=0){if(n>8)return"<truncated>";if(Array.isArray(e)){let t=e.slice(0,F),i=t.map(a=>V(a,n+1));return e.length>t.length&&i.push(`<${e.length-t.length} more items truncated>`),i}if(e!==null&&typeof e=="object"){let t=Object.create(null),i=Object.entries(e);for(let[a,o]of i.slice(0,F))t[a]=Oe(a)&&!Xn(a,o)&&!et(a,o)&&!tt(a,o)?"<redacted>":V(o,n+1);if(i.length>F){let a="<truncated>";for(;a in t;)a=`<${a}>`;t[a]=`${i.length-F} more keys`}return t}if(typeof e=="string"){let t=it(e);return t!==void 0?c(JSON.stringify(V(t,n+1))):c(e)}return e}function it(e){let n=e.trim();if(!n.startsWith("{")&&!n.startsWith("["))return;let t;try{t=JSON.parse(n)}catch{return}return t!==null&&typeof t=="object"?t:void 0}function at(e){let n=Ue()?void 0:2,t=V(e.toJSON()),i=JSON.stringify(t,null,n);return Buffer.byteLength(i,"utf8")+1<=65536?i:JSON.stringify({error:{code:e.code,message:c(e.message),details:{output_truncated:!0,max_output_bytes:65536}}},null,n)}function ot(e){if(e.requiresInput===!0)return!0;let n=a=>typeof a=="object"&&a!==null&&a.required===!0,t=e.flags??{},i=e.args??{};return Object.values(t).some(a=>n(a))||Object.values(i).some(a=>n(a))}var He=[{name:"create_claim_link",kind:"mutation",description:"Create a single App claim link. Returns the pending link, funding address, exact deposit total, and bearer claim URL. The link becomes available after the sender's deposit is confirmed. No claim-back.",args:[{name:"input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateClaimLinkInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"CreateClaimLinkResult",ofType:null}},deprecated:null},{name:"create_contact",kind:"mutation",description:"create a new contact",args:[{name:"create_input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateContactInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"create_payment",kind:"mutation",description:"create a new payment",args:[{name:"payment",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreatePaymentInput",ofType:null}},defaultValue:null},{name:"wallet_ids",description:null,type:{kind:"LIST",name:null,ofType:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}}},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"create_store",kind:"mutation",description:"create store",args:[{name:"input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"CreateStoreInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"StoreCreateResult",ofType:null}},deprecated:null},{name:"update_payment",kind:"mutation",description:"update an existing payment status by its ID",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"payment",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"UpdatePaymentInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"activities",kind:"query",description:"Get current user's activity list with multi-dimensional filters (type, status, contact, wallet, time range, amount range)",args:[{name:"filter_input",description:null,type:{kind:"INPUT_OBJECT",name:"ActivityFilterInput",ofType:null},defaultValue:"null"},{name:"skip",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"Int",ofType:null}},defaultValue:"0"},{name:"limit",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"Int",ofType:null}},defaultValue:"20"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ActivityItemPaginatedResponse",ofType:null}},deprecated:null},{name:"auto_payout_session_status",kind:"query",description:"Return the current merchant auto-payout status, expiry, total/used/remaining USD cap, per-transaction limit, and authorized chain/token pairs. Merchants without an active setup receive provisioned=false with null money/expiry fields and no pairs.",args:[],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"AutoPayoutSessionStatus",ofType:null}},deprecated:null},{name:"business",kind:"query",description:"get one business by it's id",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Business",ofType:null}},deprecated:null},{name:"business_contact_by_email",kind:"query",description:"Look up the contact card of the business whose login email is given. Used to fill the invoice header's From: block with the same name/email/phone the web editor shows.",args:[{name:"email",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"BusinessContact",ofType:null}},deprecated:null},{name:"business_transaction_records",kind:"query",description:"get transaction records for business",args:[{name:"direction",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"transaction_type",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"status",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"TransactionPaginatedResponse",ofType:null}},deprecated:null},{name:"business_wallets",kind:"query",description:"List the CALLER'S OWN non-custodial wallets (id, chain, address, coin balances). Takes no business id \u2014 the owner is derived from the authenticated identity, so there is no caller-supplied id to mismatch and no way to read another merchant's wallets. Returns [] when the account has no wallet yet.",args:[],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"LIST",name:null,ofType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"WalletEmbedded",ofType:null}}}},deprecated:null},{name:"claim_link",kind:"query",description:"Get one of the caller's own claim links by id (sender surface). A non-owned or unknown id returns CLAIM_LINK_NOT_AVAILABLE \u2014 no existence leak.",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ClaimLink",ofType:null}},deprecated:null},{name:"claim_link_funding_by_idempotency_key",kind:"query",description:"Recover the caller's original Claim Link funding contract by its stable idempotency key. Returns null when no recoverable funding contract is available. The response includes bearer claim authority and requires the claim_link:all agent-key scope.",args:[{name:"idempotency_key",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"OBJECT",name:"ClaimLinkFundingReconciliation",ofType:null},deprecated:null},{name:"contact",kind:"query",description:"get one contact by it's id",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"contact_by_email",kind:"query",description:"get one contact by it's email",args:[{name:"email",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Contact",ofType:null}},deprecated:null},{name:"contacts",kind:"query",description:"get multi contacts by owner business id",args:[{name:"owner_business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ContactPaginatedResponse",ofType:null}},deprecated:null},{name:"my_claim_links",kind:"query",description:"List the caller's claim links, newest first. Optional status and link_source filters narrow the results; query_input controls pagination, ordering, and the created_at time range.",args:[{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"},{name:"status",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"},{name:"link_source",description:null,type:{kind:"SCALAR",name:"Int",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"ClaimLinkPaginatedResponse",ofType:null}},deprecated:null},{name:"my_transactions",kind:"query",description:"get one user's successful transactions by query",args:[{name:"query_input",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"TransactionPaginatedResponse",ofType:null}},deprecated:null},{name:"payment",kind:"query",description:"get one payment by its ID",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Payment",ofType:null}},deprecated:null},{name:"payments",kind:"query",description:"All payments by business ID as sender or recipient",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"recipient_payments",kind:"query",description:"Get multiple payments by business ID as recipient",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"sender_payments",kind:"query",description:"Get multiple payments by business ID as sender",args:[{name:"business_id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null},{name:"query_input",description:null,type:{kind:"INPUT_OBJECT",name:"QueryInput",ofType:null},defaultValue:"null"}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"PaymentPaginatedResponse",ofType:null}},deprecated:null},{name:"transaction",kind:"query",description:"get one transaction by id_str",args:[{name:"id_str",description:null,type:{kind:"NON_NULL",name:null,ofType:{kind:"SCALAR",name:"String",ofType:null}},defaultValue:null}],returnType:{kind:"NON_NULL",name:null,ofType:{kind:"OBJECT",name:"Transaction",ofType:null}},deprecated:null}];var ce={source:"public-cli-contract",synced_at:"2026-08-03T03:01:54.000Z"};var M=class e extends B{static requiresEscapeHatch=!0;static isLocalOnly=!0;static description="List every operation exposed by the schema (queries and mutations). Disabled by default (exit 10); set ALLSCALE_ALLOW_RAW=1 to enable.";static examples=["$ allscale operations","$ allscale operations --kind mutation","$ allscale operations --grep invoice"];static flags={kind:x.Flags.string({char:"k",description:"Filter by operation kind",options:["query","mutation"]}),grep:x.Flags.string({char:"g",description:"Filter by substring match against name + description (case-insensitive)"}),...B.baseFlags};async runCommand(){let{flags:n}=await this.parse(e),t=n.kind,i=n.grep?.toLowerCase(),a=He.filter(r=>!(t&&r.kind!==t||i&&!`${r.name} ${r.description??""}`.toLowerCase().includes(i))),o={query:0,mutation:0};for(let r of a)o[r.kind]=(o[r.kind]??0)+1;return{total:a.length,by_kind:o,schema_source:ce.source,schema_synced_at:ce.synced_at,operations:a.map(r=>({name:r.name,kind:r.kind,description:r.description,arg_names:r.args.map(s=>s.name),return_type:me(r.returnType)}))}}};function me(e){return e.kind==="NON_NULL"&&e.ofType?`${me(e.ofType)}!`:e.kind==="LIST"&&e.ofType?`[${me(e.ofType)}]`:e.name??"Unknown"}
16
16
  //# sourceMappingURL=operations.js.map