@burdenoff/cli-sdk 2026.1107.3 → 2026.1107.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.
- package/dist/{chunk-AQ5I53SK.js → chunk-2OISIPE6.js} +6 -4
- package/dist/chunk-N5KCAJXG.js +307 -0
- package/dist/{chunk-AQE5ZDEN.js → chunk-VL67DTWH.js} +1 -1
- package/dist/core/index.cjs +7 -5
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{module-DOIiVaXQ.d.cts → module-BwJmqefL.d.cts} +1 -0
- package/dist/{module-DOIiVaXQ.d.ts → module-BwJmqefL.d.ts} +1 -0
- package/dist/modules/adaptercloud/index.cjs +2 -2
- package/dist/modules/adaptercloud/index.d.cts +1 -1
- package/dist/modules/adaptercloud/index.d.ts +1 -1
- package/dist/modules/adaptercloud/index.js +1 -1
- package/dist/modules/artistrybase/index.d.cts +1 -1
- package/dist/modules/artistrybase/index.d.ts +1 -1
- package/dist/modules/artistrybase/index.js +1 -1
- package/dist/modules/assethandler/index.cjs +3 -3
- package/dist/modules/assethandler/index.d.cts +1 -1
- package/dist/modules/assethandler/index.d.ts +1 -1
- package/dist/modules/assethandler/index.js +1 -1
- package/dist/modules/atheletebridge/index.d.cts +1 -1
- package/dist/modules/atheletebridge/index.d.ts +1 -1
- package/dist/modules/atheletebridge/index.js +1 -1
- package/dist/modules/auth/index.d.cts +1 -1
- package/dist/modules/auth/index.d.ts +1 -1
- package/dist/modules/auth/index.js +1 -1
- package/dist/modules/billing/index.d.cts +1 -1
- package/dist/modules/billing/index.d.ts +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/brainyrich/index.d.cts +1 -1
- package/dist/modules/brainyrich/index.d.ts +1 -1
- package/dist/modules/brainyrich/index.js +1 -1
- package/dist/modules/buildmyiq/index.d.cts +1 -1
- package/dist/modules/buildmyiq/index.d.ts +1 -1
- package/dist/modules/buildmyiq/index.js +1 -1
- package/dist/modules/channels/index.d.cts +1 -1
- package/dist/modules/channels/index.d.ts +1 -1
- package/dist/modules/channels/index.js +1 -1
- package/dist/modules/collabkin/index.d.cts +1 -1
- package/dist/modules/collabkin/index.d.ts +1 -1
- package/dist/modules/collabkin/index.js +1 -1
- package/dist/modules/comradecircle/index.cjs +3 -3
- package/dist/modules/comradecircle/index.d.cts +1 -1
- package/dist/modules/comradecircle/index.d.ts +1 -1
- package/dist/modules/comradecircle/index.js +1 -1
- package/dist/modules/conversations/index.cjs +3 -3
- package/dist/modules/conversations/index.d.cts +1 -1
- package/dist/modules/conversations/index.d.ts +1 -1
- package/dist/modules/conversations/index.js +1 -1
- package/dist/modules/coolandlovely/index.cjs +3 -3
- package/dist/modules/coolandlovely/index.d.cts +1 -1
- package/dist/modules/coolandlovely/index.d.ts +1 -1
- package/dist/modules/coolandlovely/index.js +1 -1
- package/dist/modules/cosmicintersection/index.cjs +2 -2
- package/dist/modules/cosmicintersection/index.d.cts +1 -1
- package/dist/modules/cosmicintersection/index.d.ts +1 -1
- package/dist/modules/cosmicintersection/index.js +1 -1
- package/dist/modules/crewfoundry/index.cjs +10 -10
- package/dist/modules/crewfoundry/index.d.cts +1 -1
- package/dist/modules/crewfoundry/index.d.ts +1 -1
- package/dist/modules/crewfoundry/index.js +1 -1
- package/dist/modules/devportal/index.d.cts +1 -1
- package/dist/modules/devportal/index.d.ts +1 -1
- package/dist/modules/devportal/index.js +1 -1
- package/dist/modules/ecoimpacthub/index.cjs +3 -3
- package/dist/modules/ecoimpacthub/index.d.cts +1 -1
- package/dist/modules/ecoimpacthub/index.d.ts +1 -1
- package/dist/modules/ecoimpacthub/index.js +1 -1
- package/dist/modules/eventfullymanaged/index.d.cts +1 -1
- package/dist/modules/eventfullymanaged/index.d.ts +1 -1
- package/dist/modules/eventfullymanaged/index.js +1 -1
- package/dist/modules/export/index.cjs +3 -3
- package/dist/modules/export/index.d.cts +1 -1
- package/dist/modules/export/index.d.ts +1 -1
- package/dist/modules/export/index.js +1 -1
- package/dist/modules/files/index.cjs +2 -2
- package/dist/modules/files/index.d.cts +1 -1
- package/dist/modules/files/index.d.ts +1 -1
- package/dist/modules/files/index.js +1 -1
- package/dist/modules/fluidgrids/index.d.cts +1 -1
- package/dist/modules/fluidgrids/index.d.ts +1 -1
- package/dist/modules/fluidgrids/index.js +1 -1
- package/dist/modules/ggnomad/index.cjs +1 -1
- package/dist/modules/ggnomad/index.d.cts +1 -1
- package/dist/modules/ggnomad/index.d.ts +1 -1
- package/dist/modules/ggnomad/index.js +1 -1
- package/dist/modules/govcitizenhub/index.cjs +3 -3
- package/dist/modules/govcitizenhub/index.d.cts +1 -1
- package/dist/modules/govcitizenhub/index.d.ts +1 -1
- package/dist/modules/govcitizenhub/index.js +1 -1
- package/dist/modules/groups/index.d.cts +1 -1
- package/dist/modules/groups/index.d.ts +1 -1
- package/dist/modules/groups/index.js +1 -1
- package/dist/modules/headshotmarketing/index.cjs +232 -144
- package/dist/modules/headshotmarketing/index.d.cts +1 -1
- package/dist/modules/headshotmarketing/index.d.ts +1 -1
- package/dist/modules/headshotmarketing/index.js +229 -141
- package/dist/modules/health/index.d.cts +1 -1
- package/dist/modules/health/index.d.ts +1 -1
- package/dist/modules/hookmovies/index.d.cts +1 -1
- package/dist/modules/hookmovies/index.d.ts +1 -1
- package/dist/modules/hookmovies/index.js +1 -1
- package/dist/modules/housingvista/index.d.cts +1 -1
- package/dist/modules/housingvista/index.d.ts +1 -1
- package/dist/modules/housingvista/index.js +1 -1
- package/dist/modules/integrations/index.cjs +2 -2
- package/dist/modules/integrations/index.d.cts +1 -1
- package/dist/modules/integrations/index.d.ts +1 -1
- package/dist/modules/integrations/index.js +1 -1
- package/dist/modules/intelwatchtower/index.cjs +5 -5
- package/dist/modules/intelwatchtower/index.d.cts +1 -1
- package/dist/modules/intelwatchtower/index.d.ts +1 -1
- package/dist/modules/intelwatchtower/index.js +1 -1
- package/dist/modules/kadaikodi/index.d.cts +1 -1
- package/dist/modules/kadaikodi/index.d.ts +1 -1
- package/dist/modules/kadaikodi/index.js +1 -1
- package/dist/modules/labsofscience/index.d.cts +1 -1
- package/dist/modules/labsofscience/index.d.ts +1 -1
- package/dist/modules/labsofscience/index.js +1 -1
- package/dist/modules/manufacturedops/index.d.cts +1 -1
- package/dist/modules/manufacturedops/index.d.ts +1 -1
- package/dist/modules/manufacturedops/index.js +1 -1
- package/dist/modules/movethewheels/index.cjs +122 -66
- package/dist/modules/movethewheels/index.d.cts +1 -1
- package/dist/modules/movethewheels/index.d.ts +1 -1
- package/dist/modules/movethewheels/index.js +123 -67
- package/dist/modules/mybodyshield/index.d.cts +1 -1
- package/dist/modules/mybodyshield/index.d.ts +1 -1
- package/dist/modules/mybodyshield/index.js +1 -1
- package/dist/modules/notifications/index.cjs +1 -1
- package/dist/modules/notifications/index.d.cts +1 -1
- package/dist/modules/notifications/index.d.ts +1 -1
- package/dist/modules/notifications/index.js +1 -1
- package/dist/modules/organizations/index.cjs +3 -3
- package/dist/modules/organizations/index.d.cts +1 -1
- package/dist/modules/organizations/index.d.ts +1 -1
- package/dist/modules/organizations/index.js +1 -1
- package/dist/modules/planmagnet/index.d.cts +1 -1
- package/dist/modules/planmagnet/index.d.ts +1 -1
- package/dist/modules/planmagnet/index.js +1 -1
- package/dist/modules/products/index.d.cts +1 -1
- package/dist/modules/products/index.d.ts +1 -1
- package/dist/modules/products/index.js +1 -1
- package/dist/modules/proserviceworld/index.d.cts +1 -1
- package/dist/modules/proserviceworld/index.d.ts +1 -1
- package/dist/modules/proserviceworld/index.js +1 -1
- package/dist/modules/rbac/index.d.cts +1 -1
- package/dist/modules/rbac/index.d.ts +1 -1
- package/dist/modules/rbac/index.js +1 -1
- package/dist/modules/sandbox/index.d.cts +1 -1
- package/dist/modules/sandbox/index.d.ts +1 -1
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +2 -2
- package/dist/modules/scheduler/index.d.cts +1 -1
- package/dist/modules/scheduler/index.d.ts +1 -1
- package/dist/modules/scheduler/index.js +1 -1
- package/dist/modules/security/index.cjs +1 -1
- package/dist/modules/security/index.d.cts +1 -1
- package/dist/modules/security/index.d.ts +1 -1
- package/dist/modules/security/index.js +1 -1
- package/dist/modules/semanticfed/index.cjs +61 -41
- package/dist/modules/semanticfed/index.d.cts +1 -1
- package/dist/modules/semanticfed/index.d.ts +1 -1
- package/dist/modules/semanticfed/index.js +1 -287
- package/dist/modules/semanticfed-sql/index.cjs +21 -0
- package/dist/modules/semanticfed-sql/index.d.cts +7 -0
- package/dist/modules/semanticfed-sql/index.d.ts +7 -0
- package/dist/modules/semanticfed-sql/index.js +1 -0
- package/dist/modules/store/index.cjs +2 -2
- package/dist/modules/store/index.d.cts +1 -1
- package/dist/modules/store/index.d.ts +1 -1
- package/dist/modules/store/index.js +1 -1
- package/dist/modules/subscriberbot/index.d.cts +1 -1
- package/dist/modules/subscriberbot/index.d.ts +1 -1
- package/dist/modules/subscriberbot/index.js +1 -1
- package/dist/modules/support/index.d.cts +1 -1
- package/dist/modules/support/index.d.ts +1 -1
- package/dist/modules/support/index.js +1 -1
- package/dist/modules/tags/index.cjs +2 -2
- package/dist/modules/tags/index.d.cts +1 -1
- package/dist/modules/tags/index.d.ts +1 -1
- package/dist/modules/tags/index.js +1 -1
- package/dist/modules/technospam/index.cjs +2 -2
- package/dist/modules/technospam/index.d.cts +1 -1
- package/dist/modules/technospam/index.d.ts +1 -1
- package/dist/modules/technospam/index.js +1 -1
- package/dist/modules/theculturepost/index.d.cts +1 -1
- package/dist/modules/theculturepost/index.d.ts +1 -1
- package/dist/modules/theculturepost/index.js +1 -1
- package/dist/modules/theglobalfuel/index.d.cts +1 -1
- package/dist/modules/theglobalfuel/index.d.ts +1 -1
- package/dist/modules/theglobalfuel/index.js +1 -1
- package/dist/modules/timecampus/index.d.cts +1 -1
- package/dist/modules/timecampus/index.d.ts +1 -1
- package/dist/modules/timecampus/index.js +1 -1
- package/dist/modules/tours/index.d.cts +1 -1
- package/dist/modules/tours/index.d.ts +1 -1
- package/dist/modules/tours/index.js +1 -1
- package/dist/modules/vibecontrols/index.d.cts +1 -1
- package/dist/modules/vibecontrols/index.d.ts +1 -1
- package/dist/modules/vibecontrols/index.js +1 -1
- package/dist/modules/workspaces/index.d.cts +1 -1
- package/dist/modules/workspaces/index.d.ts +1 -1
- package/dist/modules/workspaces/index.js +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import {existsSync,readFileSync,writeFileSync,chmodSync,unlinkSync,mkdirSync}fro
|
|
|
17
17
|
items { id name slug tenantId organizationId }
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function de(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function ge(e){try{if(!de(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var fe=3e4,z=3,me=1e3;function
|
|
20
|
+
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function de(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function ge(e){try{if(!de(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var fe=3e4,z=3,me=1e3;function we(e){return new Promise(n=>setTimeout(n,e))}function he(e){if(e instanceof TypeError)return true;if(e&&typeof e=="object"&&"response"in e){let n=e.response;if(n&&typeof n.status=="number"&&n.status>=500)return true}return false}function V(e){if(e&&typeof e=="object"&&"response"in e){let n=e,r=n.response?.errors?.[0],t=r?.extensions?.originalError?.message;if(t)return t;if(r?.message)return r.message;let i=n.response?.status;return typeof i=="number"&&Number.isInteger(i)?`GraphQL request failed (HTTP ${i})`:"GraphQL request failed"}return e instanceof Error?e.message:String(e)}function T(e){let n={};return e?.accessToken&&(n.Authorization=`Bearer ${e.accessToken}`),e?.organizationId&&(n["x-org-id"]=e.organizationId),n}function H(e,n){let r=T(e);return n&&(r.Origin=n),e?.workspaceToken&&(r["X-Workspace-Authorization"]=`Bearer ${e.workspaceToken}`),e?.organizationId&&(r["x-org-id"]=e.organizationId),r}async function R(e,n,r){let t;for(let i=0;i<z;i++)try{let s=new AbortController,o=setTimeout(()=>s.abort(),fe);try{return await e.request({document:n,variables:r,signal:s.signal})}finally{clearTimeout(o);}}catch(s){if(t=s,s&&typeof s=="object"&&"response"in s){let o=s.response;if(o&&typeof o.status=="number"&&o.status>=400&&o.status<500)break}if(he(s)&&i<z-1){let o=me*Math.pow(2,i);await we(o);continue}break}throw new Error(V(t))}function L(e,n){let r=null,t=null;function i(){let a=e.read(),g=n.read();return r=new GraphQLClient(a.workspaceEndpoint),r.setHeaders(H(g,e.resolveProductOrigin())),t=new GraphQLClient(a.globalEndpoint),t.setHeaders(T(g)),{workspace:r,global:t}}async function s(){let a=n.read();if(!a)return;if(a.authMethod==="client_credentials"&&a.clientId&&a.clientSecret){let d=e.read();try{let f=await $(d.globalEndpoint,a.clientId,a.clientSecret);n.write({...a,accessToken:f.accessToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}return}if(!a.refreshToken)return;let g=e.read(),c=new GraphQLClient(g.globalEndpoint);c.setHeaders({Authorization:`Bearer ${a.accessToken}`});let p=`
|
|
21
21
|
mutation RefreshToken($token: String!) {
|
|
22
22
|
refreshToken(token: $token) {
|
|
23
23
|
accessToken
|
|
@@ -25,8 +25,10 @@ import {existsSync,readFileSync,writeFileSync,chmodSync,unlinkSync,mkdirSync}fro
|
|
|
25
25
|
expiresIn
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await P(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(H(n.read(),e.resolveProductOrigin())),
|
|
29
|
-
`)}function Y(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(q(e,0));}function
|
|
28
|
+
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await P(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(H(n.read(),e.resolveProductOrigin())),R(c,a,g)}},global:{async request(a,g){let{global:c}=t?{global:t}:i();return c.setHeaders(T(n.read())),R(c,a,g)}},workspaceAuthOnly:{async request(a,g){let c=e.read(),p=n.read(),d=new GraphQLClient(c.workspaceEndpoint),f=T(p),G=e.resolveProductOrigin();return G&&(f.Origin=G),d.setHeaders(f),R(d,a,g)}},reset(){r=null,t=null;}}}function _(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function B(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return _()?"table":"json"}function D(e){console.log(JSON.stringify(e,null,2));}function J(e,n){if(e.length===0)return;let r=e.map((s,o)=>{let u=s.length;for(let l of n){let m=l[o]??"";m.length>u&&(u=m.length);}return Math.min(u,50)}),t=r.map(s=>"-".repeat(s+2)).join("+"),i=s=>s.map((o,u)=>` ${(o??"").padEnd(r[u]??0)} `).join("|");console.log(i(e)),console.log(t);for(let s of n)console.log(i(s));}function q(e,n){let r=" ".repeat(n),t=[];for(let[i,s]of Object.entries(e))if(s==null)t.push(`${r}${i}: null`);else if(Array.isArray(s)){t.push(`${r}${i}:`);for(let o of s)typeof o=="object"&&o!==null?(t.push(`${r} -`),t.push(q(o,n+2))):t.push(`${r} - ${String(o)}`);}else typeof s=="object"?(t.push(`${r}${i}:`),t.push(q(s,n+1))):t.push(`${r}${i}: ${String(s)}`);return t.join(`
|
|
29
|
+
`)}function Y(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(q(e,0));}function ke(e){process.stdout.write(e.endsWith(`
|
|
30
|
+
`)?e:`${e}
|
|
31
|
+
`);}function ye(e){console.log(`\u2713 ${e}`);}function Q(e){console.error(`\u2717 ${e}`);}function Ce(e){console.warn(`! ${e}`);}function xe(e){console.log(`\u2139 ${e}`);}function be(e){if(!e)return "-";try{return new Date(e).toLocaleString()}catch{return e}}function ve(e){if(!e)return "-";switch(e.toUpperCase()){case "ACTIVE":case "RUNNING":case "HEALTHY":return `\u2713 ${e}`;case "INACTIVE":case "STOPPED":case "PENDING":return `\u25CB ${e}`;case "ERROR":return `\u2717 ${e}`;case "ARCHIVED":return `\u2192 ${e}`;case "STARTING":return `\u25B6 ${e}`;case "TERMINATED":return `\u25A0 ${e}`;default:return e}}function Te(e,n){return e?e.length<=n?e:e.substring(0,n-3)+"...":"-"}function Ie(e,n,r){switch(B(e)){case "json":D(n);break;case "yaml":Y(n);break;case "table":r?J(r.headers,r.rows):D(n);break}}async function Ee(e,n){return n?true:_()?new Promise(r=>{process.stdout.write(`${e} [y/N] `),process.stdin.setEncoding("utf8"),process.stdin.once("data",t=>{let i=t.trim().toLowerCase();r(i==="y"||i==="yes");}),process.stdin.resume();}):(Q(`${e} Use --force to skip confirmation.`),false)}var N={isInteractive:_,getFormat:B,formatAndOutput:Ie,printJson:D,printTable:J,printYaml:Y,printRaw:ke,printSuccess:ye,printError:Q,printWarning:Ce,printInfo:xe,formatDate:be,formatStatus:ve,truncate:Te,confirm:Ee};function j(e={}){let{verbose:n=false,quiet:r=false}=e;return {debug(t,...i){n&&console.error(`[debug] ${t}`,...i);},info(t,...i){r||console.error(`[info] ${t}`,...i);},warn(t,...i){console.error(`[warn] ${t}`,...i);},error(t,...i){console.error(`[error] ${t}`,...i);}}}function Ae(e){return e.includes("localhost")||e.includes("127.0.0.1")?"local":e.includes("alpha")||e.includes("staging")?"staging":"prod"}function Oe(e){return !!e&&typeof e.debug=="function"&&typeof e.info=="function"}function Se(e){let n=S(e.defaults),r=O(n.dir()),t=L(n,r),i=e.output??N,s=Oe(e.logger)?e.logger:j(e.logger),o=e.env??Ae(n.read().workspaceEndpoint);return {productName:e.productName,productVersion:e.productVersion,defaults:e.defaults,config:n,auth:r,gql:t,output:i,logger:s,env:o}}var C=class extends Error{exitCode;hint;constructor(n,r){super(n),this.name="CliUserError",this.exitCode=r?.exitCode??1,this.hint=r?.hint;}},b=class extends C{constructor(n,r){super(n,{exitCode:2,hint:r?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},k=class extends Error{cause;constructor(n,r){super(n),this.name="CliInternalError",this.cause=r;}};var I=class extends k{constructor(n,r){super(`Module '${n}' declares dependency on '${r}', but '${r}' is not in the module list.`),this.name="MissingDependencyError";}},E=class extends k{constructor(n){super(`Circular dependency detected among modules: ${n.join(" -> ")}`),this.name="CircularDependencyError";}};function F(e){let n=new Map;for(let o of e){if(n.has(o.id))throw new k(`Duplicate module id: '${o.id}'`);n.set(o.id,o);}for(let o of e)for(let u of o.dependsOn??[])if(!n.has(u))throw new I(o.id,u);let r=[],t=new Set,i=new Set;function s(o,u){if(!i.has(o.id)){if(t.has(o.id))throw new E([...u,o.id]);t.add(o.id);for(let l of o.dependsOn??[]){let m=n.get(l);m&&s(m,[...u,o.id]);}t.delete(o.id),i.add(o.id),r.push(o);}}for(let o of e)s(o,[]);return r}function Pe(e,n,r){let t=new Command;t.name(r.name).description(r.description??"").version(r.version,"-v, --version").option("-f, --format <format>","Output format (json, table, yaml)").option("--verbose","Enable verbose logging").option("--no-color","Disable colored output"),t.hook("preAction",(o,u)=>{let l=t.opts().format;if(typeof l!="string")return;u.options.some(y=>y.attributeName()==="format")&&u.getOptionValue("format")===void 0&&u.setOptionValue("format",l);});let i=F(n);for(let o of i)o.register(t,e);r.helpExamples?.length&&t.addHelpText("after",`
|
|
30
32
|
Examples:
|
|
31
33
|
`+r.helpExamples.map(o=>" "+o).join(`
|
|
32
|
-
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){
|
|
34
|
+
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){Re(e,u);}}return {program:t,run:s}}function Re(e,n){if(n instanceof b&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof C&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof k&&(e.output.printError(`Internal error: ${n.message}`),n.cause&&e.logger.debug("caused by:",n.cause),process.exit(70)),n&&typeof n=="object"&&"code"in n&&"exitCode"in n){let t=n.exitCode;process.exit(typeof t=="number"?t:0);}let r=n instanceof Error?n.message:String(n);e.output.printError(r),process.exit(1);}export{O as a,ce as b,S as c,ue as d,le as e,$ as f,P as g,pe as h,ge as i,V as j,L as k,N as l,j as m,Se as n,C as o,b as p,k as q,I as r,E as s,F as t,Pe as u};
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import {b as b$1,h as h$1,j as j$1}from'./chunk-VL67DTWH.js';import {o}from'./chunk-2OISIPE6.js';var h=`
|
|
2
|
+
query SemConnector($id: ID!) {
|
|
3
|
+
semConnector(id: $id) {
|
|
4
|
+
id name kind description isActive capabilities
|
|
5
|
+
dataSources { id name status }
|
|
6
|
+
createdAt updatedAt workspaceId
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,x=`
|
|
10
|
+
query SemListConnectors($kind: SemConnectorKind, $pagination: PaginationInput) {
|
|
11
|
+
semListConnectors(kind: $kind, pagination: $pagination) {
|
|
12
|
+
items {
|
|
13
|
+
id name kind description isActive capabilities createdAt updatedAt workspaceId
|
|
14
|
+
}
|
|
15
|
+
pageInfo { cursor hasMore }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`,R=`
|
|
19
|
+
mutation SemCreateConnector($input: SemCreateConnectorInput!) {
|
|
20
|
+
semCreateConnector(input: $input) {
|
|
21
|
+
id name kind description isActive capabilities createdAt updatedAt workspaceId
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`,k=`
|
|
25
|
+
mutation SemUpdateConnector($id: ID!, $input: SemUpdateConnectorInput!) {
|
|
26
|
+
semUpdateConnector(id: $id, input: $input) {
|
|
27
|
+
id name kind description isActive capabilities updatedAt workspaceId
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`,D=`
|
|
31
|
+
mutation SemArchiveConnector($id: ID!) {
|
|
32
|
+
semArchiveConnector(id: $id)
|
|
33
|
+
}
|
|
34
|
+
`,b=`
|
|
35
|
+
query SemDataSource($id: ID!) {
|
|
36
|
+
semDataSource(id: $id) {
|
|
37
|
+
id connectorId name description endpoint pushdownEnabled secretRef
|
|
38
|
+
status tags lastIntrospectedAt
|
|
39
|
+
connector { id name kind }
|
|
40
|
+
createdAt updatedAt workspaceId
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
`,q=`
|
|
44
|
+
query SemListDataSources(
|
|
45
|
+
$connectorId: ID
|
|
46
|
+
$status: SemDataSourceStatus
|
|
47
|
+
$pagination: PaginationInput
|
|
48
|
+
) {
|
|
49
|
+
semListDataSources(connectorId: $connectorId, status: $status, pagination: $pagination) {
|
|
50
|
+
items {
|
|
51
|
+
id connectorId name description pushdownEnabled secretRef status tags
|
|
52
|
+
lastIntrospectedAt createdAt updatedAt workspaceId
|
|
53
|
+
}
|
|
54
|
+
pageInfo { cursor hasMore }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,L=`
|
|
58
|
+
mutation SemCreateDataSource($input: SemCreateDataSourceInput!) {
|
|
59
|
+
semCreateDataSource(input: $input) {
|
|
60
|
+
id connectorId name description endpoint pushdownEnabled secretRef
|
|
61
|
+
status tags createdAt updatedAt workspaceId
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`,O=`
|
|
65
|
+
mutation SemUpdateDataSource($id: ID!, $input: SemUpdateDataSourceInput!) {
|
|
66
|
+
semUpdateDataSource(id: $id, input: $input) {
|
|
67
|
+
id connectorId name description endpoint pushdownEnabled secretRef
|
|
68
|
+
status tags updatedAt workspaceId
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`,N=`
|
|
72
|
+
mutation SemArchiveDataSource($id: ID!) {
|
|
73
|
+
semArchiveDataSource(id: $id)
|
|
74
|
+
}
|
|
75
|
+
`,U=`
|
|
76
|
+
mutation SemTransitionDataSource($id: ID!, $status: SemDataSourceStatus!) {
|
|
77
|
+
semTransitionDataSource(id: $id, status: $status) {
|
|
78
|
+
id name status updatedAt workspaceId
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`,Q=`
|
|
82
|
+
query SemListConnections($dataSourceId: ID!) {
|
|
83
|
+
semListConnections(dataSourceId: $dataSourceId) {
|
|
84
|
+
id dataSourceId health latencyMs message probedAt createdAt updatedAt workspaceId
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`,P=`
|
|
88
|
+
mutation SemRecordConnection($input: SemRecordConnectionInput!) {
|
|
89
|
+
semRecordConnection(input: $input) {
|
|
90
|
+
id dataSourceId health latencyMs message probedAt createdAt updatedAt workspaceId
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
`,v=`
|
|
94
|
+
query SemModel($id: ID!) {
|
|
95
|
+
semModel(id: $id) {
|
|
96
|
+
id name description status version tags publishedAt
|
|
97
|
+
entities { id name kind }
|
|
98
|
+
relationships { id name kind }
|
|
99
|
+
createdAt updatedAt workspaceId
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`,F=`
|
|
103
|
+
query SemListModels($status: SemModelStatus, $pagination: PaginationInput) {
|
|
104
|
+
semListModels(status: $status, pagination: $pagination) {
|
|
105
|
+
items {
|
|
106
|
+
id name description status version tags publishedAt createdAt updatedAt workspaceId
|
|
107
|
+
}
|
|
108
|
+
pageInfo { cursor hasMore }
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
`,j=`
|
|
112
|
+
mutation SemCreateModel($input: SemCreateModelInput!) {
|
|
113
|
+
semCreateModel(input: $input) {
|
|
114
|
+
id name description status version tags createdAt updatedAt workspaceId
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`,H=`
|
|
118
|
+
mutation SemUpdateModel($id: ID!, $input: SemUpdateModelInput!) {
|
|
119
|
+
semUpdateModel(id: $id, input: $input) {
|
|
120
|
+
id name description status version tags updatedAt workspaceId
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`,Y=`
|
|
124
|
+
mutation SemArchiveModel($id: ID!) {
|
|
125
|
+
semArchiveModel(id: $id)
|
|
126
|
+
}
|
|
127
|
+
`,K=`
|
|
128
|
+
mutation SemPublishModel($id: ID!) {
|
|
129
|
+
semPublishModel(id: $id) {
|
|
130
|
+
id name status version publishedAt updatedAt workspaceId
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
`,V=`
|
|
134
|
+
query SemEntity($id: ID!) {
|
|
135
|
+
semEntity(id: $id) {
|
|
136
|
+
id modelId dataSourceId name kind physicalName primaryKey sqlDefinition description
|
|
137
|
+
dimensions { id name dataType isPrimary }
|
|
138
|
+
metrics { id name aggregation }
|
|
139
|
+
createdAt updatedAt workspaceId
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
`,W=`
|
|
143
|
+
query SemListEntities($modelId: ID!) {
|
|
144
|
+
semListEntities(modelId: $modelId) {
|
|
145
|
+
id modelId dataSourceId name kind physicalName primaryKey sqlDefinition
|
|
146
|
+
description createdAt updatedAt workspaceId
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`,J=`
|
|
150
|
+
mutation SemCreateEntity($input: SemCreateEntityInput!) {
|
|
151
|
+
semCreateEntity(input: $input) {
|
|
152
|
+
id modelId dataSourceId name kind physicalName primaryKey sqlDefinition
|
|
153
|
+
description createdAt updatedAt workspaceId
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`,B=`
|
|
157
|
+
mutation SemUpdateEntity($id: ID!, $input: SemUpdateEntityInput!) {
|
|
158
|
+
semUpdateEntity(id: $id, input: $input) {
|
|
159
|
+
id modelId dataSourceId name kind physicalName primaryKey sqlDefinition
|
|
160
|
+
description updatedAt workspaceId
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`,G=`
|
|
164
|
+
mutation SemDeleteEntity($id: ID!) {
|
|
165
|
+
semDeleteEntity(id: $id)
|
|
166
|
+
}
|
|
167
|
+
`,X=`
|
|
168
|
+
mutation SemCreateDimension($input: SemCreateDimensionInput!) {
|
|
169
|
+
semCreateDimension(input: $input) {
|
|
170
|
+
id entityId name dataType expression isPrimary description
|
|
171
|
+
createdAt updatedAt workspaceId
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
`,z=`
|
|
175
|
+
mutation SemCreateMetric($input: SemCreateMetricInput!) {
|
|
176
|
+
semCreateMetric(input: $input) {
|
|
177
|
+
id entityId name aggregation expression format description
|
|
178
|
+
createdAt updatedAt workspaceId
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
`,Z=`
|
|
182
|
+
query SemListRelationships($modelId: ID!) {
|
|
183
|
+
semListRelationships(modelId: $modelId) {
|
|
184
|
+
id modelId name kind fromEntityId fromField toEntityId toField description
|
|
185
|
+
createdAt updatedAt workspaceId
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`,tt=`
|
|
189
|
+
mutation SemCreateRelationship($input: SemCreateRelationshipInput!) {
|
|
190
|
+
semCreateRelationship(input: $input) {
|
|
191
|
+
id modelId name kind fromEntityId fromField toEntityId toField description
|
|
192
|
+
createdAt updatedAt workspaceId
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`,et=`
|
|
196
|
+
query SemQuery($id: ID!) {
|
|
197
|
+
semQuery(id: $id) {
|
|
198
|
+
id modelId name description queryText parameters cacheable cacheTtlSeconds
|
|
199
|
+
status tags
|
|
200
|
+
runs { id status startedAt finishedAt rowCount }
|
|
201
|
+
createdAt updatedAt workspaceId
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
`,nt=`
|
|
205
|
+
query SemListQueries(
|
|
206
|
+
$modelId: ID
|
|
207
|
+
$status: SemQueryStatus
|
|
208
|
+
$pagination: PaginationInput
|
|
209
|
+
) {
|
|
210
|
+
semListQueries(modelId: $modelId, status: $status, pagination: $pagination) {
|
|
211
|
+
items {
|
|
212
|
+
id modelId name description queryText cacheable cacheTtlSeconds status tags
|
|
213
|
+
createdAt updatedAt workspaceId
|
|
214
|
+
}
|
|
215
|
+
pageInfo { cursor hasMore }
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
`,it=`
|
|
219
|
+
mutation SemCreateQuery($input: SemCreateQueryInput!) {
|
|
220
|
+
semCreateQuery(input: $input) {
|
|
221
|
+
id modelId name description queryText parameters cacheable cacheTtlSeconds
|
|
222
|
+
status tags createdAt updatedAt workspaceId
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
`,ot=`
|
|
226
|
+
mutation SemUpdateQuery($id: ID!, $input: SemUpdateQueryInput!) {
|
|
227
|
+
semUpdateQuery(id: $id, input: $input) {
|
|
228
|
+
id modelId name description queryText parameters cacheable cacheTtlSeconds
|
|
229
|
+
status tags updatedAt workspaceId
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`,at=`
|
|
233
|
+
mutation SemArchiveQuery($id: ID!) {
|
|
234
|
+
semArchiveQuery(id: $id)
|
|
235
|
+
}
|
|
236
|
+
`,rt=`
|
|
237
|
+
mutation SemPublishQuery($id: ID!) {
|
|
238
|
+
semPublishQuery(id: $id) {
|
|
239
|
+
id name status updatedAt workspaceId
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
`,st=`
|
|
243
|
+
mutation SemRunQuery($id: ID!) {
|
|
244
|
+
semRunQuery(id: $id) {
|
|
245
|
+
id queryId status startedAt finishedAt durationMs rowCount sourcesTouched
|
|
246
|
+
fromCache errorMessage createdAt updatedAt workspaceId
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`,dt=`
|
|
250
|
+
query SemListQueryRuns(
|
|
251
|
+
$queryId: ID!
|
|
252
|
+
$status: SemQueryRunStatus
|
|
253
|
+
$pagination: PaginationInput
|
|
254
|
+
) {
|
|
255
|
+
semListQueryRuns(queryId: $queryId, status: $status, pagination: $pagination) {
|
|
256
|
+
items {
|
|
257
|
+
id queryId status startedAt finishedAt durationMs rowCount sourcesTouched
|
|
258
|
+
fromCache errorMessage runById createdAt updatedAt workspaceId
|
|
259
|
+
}
|
|
260
|
+
pageInfo { cursor hasMore }
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
`,mt=`
|
|
264
|
+
query SemListAccessPolicies($entityId: ID, $modelId: ID) {
|
|
265
|
+
semListAccessPolicies(entityId: $entityId, modelId: $modelId) {
|
|
266
|
+
id name description principal effect scope entityId modelId rule isActive
|
|
267
|
+
createdAt updatedAt workspaceId
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
`,ut=`
|
|
271
|
+
mutation SemCreateAccessPolicy($input: SemCreateAccessPolicyInput!) {
|
|
272
|
+
semCreateAccessPolicy(input: $input) {
|
|
273
|
+
id name description principal effect scope entityId modelId rule isActive
|
|
274
|
+
createdAt updatedAt workspaceId
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
`,ct=`
|
|
278
|
+
mutation SemSetAccessPolicyActive($id: ID!, $isActive: Boolean!) {
|
|
279
|
+
semSetAccessPolicyActive(id: $id, isActive: $isActive) {
|
|
280
|
+
id name isActive updatedAt workspaceId
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
`,pt=`
|
|
284
|
+
query SemHealth {
|
|
285
|
+
semHealth
|
|
286
|
+
}
|
|
287
|
+
`,A=`
|
|
288
|
+
mutation SemExecuteSql($input: SemExecuteSqlInput!) {
|
|
289
|
+
semExecuteSql(input: $input) {
|
|
290
|
+
modelId
|
|
291
|
+
columns { name entity field aggregation dataType masked mask }
|
|
292
|
+
rows rowCount truncated durationMs sourcesTouched planSummary
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
`,g=`
|
|
296
|
+
query SemSqlCatalog($modelId: ID) {
|
|
297
|
+
semSqlCatalog(modelId: $modelId) {
|
|
298
|
+
modelId modelName
|
|
299
|
+
tables {
|
|
300
|
+
name kind primaryKey description
|
|
301
|
+
columns { name kind dataType isPrimary aggregation description }
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
`;function Ct(e,t){try{return JSON.parse(t)}catch{throw new o(`--${e} must be valid JSON`)}}function l(e){let t=Number.parseInt(e,10);if(Number.isNaN(t))throw new o(`Expected an integer but got "${e}"`);return t}function yt(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function $t(e){let t={};return e.limit!==void 0&&(t.limit=e.limit),e.offset!==void 0&&(t.offset=e.offset),e.cursor&&(t.cursor=e.cursor),Object.keys(t).length?t:void 0}var f=["table","json","csv","yaml"];function C(e){if(e===void 0)return;let t=e.toLowerCase();if(f.includes(t))return t;throw new o(`--format must be one of ${f.join(", ")} (got "${e}")`)}function w(e){return e==null?"NULL":typeof e=="object"?JSON.stringify(e):String(e)}function y(e){if(e==null)return "";let t=typeof e=="object"?JSON.stringify(e):String(e);return /[",\r\n]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function _(e){let t=e.columns.map(o=>o.name),n=[t.map(y).join(",")];for(let o of e.rows)n.push(t.map(i=>y(o[i])).join(","));return `${n.join(`\r
|
|
306
|
+
`)}\r
|
|
307
|
+
`}function T(e,t){if(!e||e.trim()==="")throw new o('A SQL statement is required, e.g. semanticfed sql "SELECT * FROM customers LIMIT 10"');let n={sql:e};if(t.model&&(n.modelId=t.model),t.maxRows!==void 0){if(t.maxRows<1)throw new o("--max-rows must be a positive integer");n.maxRows=t.maxRows;}if(t.timeout!==void 0){if(t.timeout<1)throw new o("--timeout must be a positive integer");n.timeoutMs=t.timeout;}return n}function M(e,t){let n=j$1(),o$1=e??n.getFormat({});if(o$1==="csv"){if(!n.printRaw)throw new o("This output adapter cannot print CSV; use --format json or table");n.printRaw(_(t));}else if(o$1==="table"){let i=t.columns.map(r=>r.name);n.printTable(i,t.rows.map(r=>i.map(m=>w(r[m]))));let s=t.columns.filter(r=>r.masked).map(r=>r.name);n.printInfo(`${t.rowCount} row${t.rowCount===1?"":"s"} in ${Math.round(t.durationMs)} ms`+(s.length?` (masked: ${s.join(", ")})`:""));}else n.formatAndOutput({format:o$1},t);t.truncated&&n.printWarning("Result truncated: more rows matched than were returned (raise --max-rows, max 10000, or add LIMIT/WHERE).");}function ht(e){e.command("sql").description("Run a read-only SQL SELECT against a semantic model (sql catalog: list tables)").argument("[statement]","One SELECT statement; tables are entities, columns their fields").option("--model <id>","Semantic model ID (optional when the workspace has one model)").option("--max-rows <n>","Maximum rows returned (server default 1000, max 10000)",l).option("--timeout <ms>","Execution time limit in ms (default 30000, 1000-60000)",l).option("-f, --format <format>","Output format: table|json|csv|yaml").action(async(n,o)=>{try{let i=C(o.format),s=T(n,o),r=await b$1(A,{input:s});M(i,r.semExecuteSql);}catch(i){h$1(i);}}).command("catalog").description("List the tables and columns a semantic model exposes to SQL").option("--model <id>","Semantic model ID (optional when the workspace has one model)").option("-f, --format <format>","Output format: table|json|yaml").action(async(n,o$1)=>{try{let i=o$1.optsWithGlobals(),s=C(i.format);if(s==="csv")throw new o("sql catalog supports --format table, json or yaml");let m=(await b$1(g,{modelId:i.model||void 0})).semSqlCatalog;j$1().formatAndOutput({format:s},m,{headers:["Table","Column","Kind","Type","Primary","Aggregation"],rows:m.tables.flatMap(S=>S.columns.map(d=>[S.name,d.name,d.kind,d.dataType,d.isPrimary?"yes":"",d.aggregation??""]))});}catch(i){h$1(i);}});}export{Z as A,tt as B,et as C,nt as D,it as E,ot as F,at as G,rt as H,st as I,dt as J,mt as K,ut as L,ct as M,pt as N,Ct as O,l as P,yt as Q,$t as R,ht as S,h as a,x as b,R as c,k as d,D as e,b as f,q as g,L as h,O as i,N as j,U as k,Q as l,P as m,v as n,F as o,j as p,H as q,Y as r,K as s,V as t,W as u,J as v,B as w,G as x,X as y,z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1,o as o$1,p as p$1,q as q$1}from'./chunk-
|
|
1
|
+
import {b as b$1,o as o$1,p as p$1,q as q$1}from'./chunk-2OISIPE6.js';var o=null;function b(t){o=t;}function e(){if(!o)throw new q$1("vibecontrols module helpers used before setHelpersContext was called");return o}function p(){let t=e();if(!t.auth.isAuthenticated())throw new p$1("Authentication required.",{hint:`Run \`${t.productName} auth login\` to authenticate.`})}async function w(t,n){return p(),e().gql.workspace.request(t,n)}async function T(t,n){return e().gql.global.request(t,n)}async function q(t,n){return e().gql.workspaceAuthOnly.request(t,n)}async function A(t,n){return e().gql.global.request(t,n)}function k(){e().gql.reset();}function v(t){return /^(error|fail|failed|failure|timeout|cancel)/i.test(t.status)||t.exitCode!==null&&t.exitCode!==void 0&&t.exitCode!==0?true:t.webhookStatusCode!==null&&t.webhookStatusCode!==void 0&&t.webhookStatusCode>=400}function S(t){let n=t instanceof Error?t.message:String(t);throw new o$1(n)}function E(t,n,a){e().output.formatAndOutput(t,n,a);}function I(){return e().output}function O(t){e().output.printSuccess(t);}function D(t){e().output.printError(t);}function y(t){e().output.printInfo(t);}function N(t){e().output.printWarning(t);}function R(t){e().output.printJson(t);}function F(t){return e().output.formatStatus(t)}function W(t){return e().output.formatDate(t)}function L(t,n){return e().output.truncate(t,n)}function V(t,n){return e().output.confirm(t,n)}function P(t,n){e().output.printTable(t,n);}function _(){return e()}function K(){return e().auth.read()}function G(t){e().auth.write(t);}function B(){e().auth.clear();}function Y(){return e().config.read()}function j(t){return e().config.get(t)}function H(t,n){e().config.set(t,n);}function J(){return e().config.path()}var U=b$1;function $(){return e().config.resolveOIDC()}function z(t){return t?t.expiresAt?Date.now()>=t.expiresAt:false:e().auth.isTokenExpired()}export{H as A,J as B,U as C,$ as D,z as E,b as a,w as b,T as c,q as d,A as e,k as f,v as g,S as h,E as i,I as j,O as k,D as l,y as m,N as n,R as o,F as p,W as q,L as r,V as s,P as t,_ as u,K as v,G as w,B as x,Y as y,j as z};
|
package/dist/core/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var fs=require('fs'),path=require('path'),os=require('os'),graphqlRequest=require('graphql-request'),C=require('cross-fetch'),commander=require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var C__default=/*#__PURE__*/_interopDefault(C);var G=300*1e3;function A(e){let n=path.join(e,"auth.json");function r(){fs.existsSync(e)||fs.mkdirSync(e,{recursive:true,mode:448});}function t(){try{if(!fs.existsSync(n))return null;let a=fs.readFileSync(n,"utf8");return JSON.parse(a)}catch{return null}}function i(a){r(),fs.writeFileSync(n,JSON.stringify(a,null,2),{encoding:"utf8",mode:384});try{fs.chmodSync(n,384);}catch{}}function s(){try{fs.existsSync(n)&&fs.unlinkSync(n);}catch{}}function o(){let a=t();return a?.expiresAt?Date.now()>=a.expiresAt:false}function u(){let a=t();return a?.expiresAt?Date.now()+G>=a.expiresAt:false}function l(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()>=a.workspaceTokenExpiresAt:false}function m(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()+G>=a.workspaceTokenExpiresAt:false}function
|
|
1
|
+
'use strict';var fs=require('fs'),path=require('path'),os=require('os'),graphqlRequest=require('graphql-request'),C=require('cross-fetch'),commander=require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var C__default=/*#__PURE__*/_interopDefault(C);var G=300*1e3;function A(e){let n=path.join(e,"auth.json");function r(){fs.existsSync(e)||fs.mkdirSync(e,{recursive:true,mode:448});}function t(){try{if(!fs.existsSync(n))return null;let a=fs.readFileSync(n,"utf8");return JSON.parse(a)}catch{return null}}function i(a){r(),fs.writeFileSync(n,JSON.stringify(a,null,2),{encoding:"utf8",mode:384});try{fs.chmodSync(n,384);}catch{}}function s(){try{fs.existsSync(n)&&fs.unlinkSync(n);}catch{}}function o(){let a=t();return a?.expiresAt?Date.now()>=a.expiresAt:false}function u(){let a=t();return a?.expiresAt?Date.now()+G>=a.expiresAt:false}function l(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()>=a.workspaceTokenExpiresAt:false}function m(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()+G>=a.workspaceTokenExpiresAt:false}function k(){return t()?.accessToken?!o():false}return {read:t,write:i,clear:s,isTokenExpired:o,isTokenExpiringSoon:u,isWorkspaceTokenExpired:l,isWorkspaceTokenExpiringSoon:m,isAuthenticated:k}}var ae=["workspaceEndpoint","globalEndpoint","oidcIssuer","clientId","defaultFormat","verbose","authServiceEndpoint","productOrigin"];function O(e){let n=path.join(os.homedir(),".config",e.configDirName),r=path.join(n,"config.json"),t={workspaceEndpoint:e.workspaceEndpointDefault,globalEndpoint:e.globalEndpointDefault};function i(){fs.existsSync(n)||fs.mkdirSync(n,{recursive:true,mode:448});}function s(c){if(e.envPrefix){let d=process.env[`${e.envPrefix}_${c}`];if(d)return d}let p=process.env[c];return p&&p.length>0?p:void 0}function o(c){if(!e.envPrefix)return;let p=process.env[`${e.envPrefix}_${c}`];return p&&p.length>0?p:void 0}function u(){let c={};try{fs.existsSync(r)&&(c=JSON.parse(fs.readFileSync(r,"utf8")));}catch{}return {...t,...c,workspaceEndpoint:s("WORKSPACE_ENDPOINT")??c.workspaceEndpoint??t.workspaceEndpoint,globalEndpoint:s("GLOBAL_ENDPOINT")??c.globalEndpoint??t.globalEndpoint,oidcIssuer:s("OIDC_ISSUER")??c.oidcIssuer,clientId:s("CLIENT_ID")??c.clientId,productOrigin:o("ORIGIN")??c.productOrigin}}function l(c){i(),fs.writeFileSync(r,JSON.stringify(c,null,2),{encoding:"utf8"});try{fs.chmodSync(r,384);}catch{}}function m(c){return u()[c]}function k(c,p){let d=u();d[c]=p,l(d);}function a(){let c=u(),p=c.clientId||e.oidcClientId,d=c.oidcIssuer;if(!d){let f=c.globalEndpoint;f.includes("localhost")||f.includes("127.0.0.1")?d=f.replace(/\/graphql$/,"").replace(/\/global\/graphql$/,"/global"):d=e.oidcIssuerProd??"https://graphql.burdenoff.com/global";}return {oidcIssuer:d,clientId:p}}function g(){let c=u();if(c.productOrigin)return c.productOrigin;if(e.productOrigins)try{let p=new URL(c.workspaceEndpoint).hostname.toLowerCase();return e.productOrigins[p]}catch{return}}return {read:u,write:l,get:m,set:k,path:()=>r,dir:()=>n,resolveOIDC:a,resolveProductOrigin:g}}async function ce(e){let n=`${e.oidcIssuer}/oidc/device/code`,r=new URLSearchParams({client_id:e.clientId,scope:"openid profile email offline_access"}),t=await C__default.default(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Device code request failed (${t.status}): ${s}`)}let i=await t.json();return {deviceCode:i.device_code,userCode:i.user_code,verificationUri:i.verification_uri,verificationUriComplete:i.verification_uri_complete??null,expiresIn:i.expires_in,interval:i.interval??5}}async function ue(e,n,r){let t=`${r.oidcIssuer}/oauth/device/token`,i=n;for(;;){await new Promise(l=>setTimeout(l,i*1e3));let s=await C__default.default(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e,client_id:r.clientId}).toString()}),o=await s.json();if(s.ok&&o.access_token)return {accessToken:o.access_token,refreshToken:o.refresh_token??"",expiresIn:o.expires_in??3600};let u=o.error;switch(u){case "authorization_pending":continue;case "slow_down":i+=5;continue;case "expired_token":throw new Error("Device code has expired. Please try again.");case "access_denied":throw new Error("Authorization was denied by the user.");default:throw new Error(`Device code polling failed: ${o.error_description??u??"Unknown error"}`)}}}async function S(e,n,r,t){let s=await C__default.default(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
|
|
2
2
|
mutation AuthenticateApp($input: AuthenticateAppInput!) {
|
|
3
3
|
authenticateApp(input: $input) {
|
|
4
4
|
accessToken tokenType expiresIn scopes
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
items { id name slug tenantId organizationId }
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function pe(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function de(e){try{if(!pe(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var ge=3e4,U=3,fe=1e3;function me(e){return new Promise(n=>setTimeout(n,e))}function
|
|
20
|
+
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function pe(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function de(e){try{if(!pe(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var ge=3e4,U=3,fe=1e3;function me(e){return new Promise(n=>setTimeout(n,e))}function we(e){if(e instanceof TypeError)return true;if(e&&typeof e=="object"&&"response"in e){let n=e.response;if(n&&typeof n.status=="number"&&n.status>=500)return true}return false}function H(e){if(e&&typeof e=="object"&&"response"in e){let n=e,r=n.response?.errors?.[0],t=r?.extensions?.originalError?.message;if(t)return t;if(r?.message)return r.message;let i=n.response?.status;return typeof i=="number"&&Number.isInteger(i)?`GraphQL request failed (HTTP ${i})`:"GraphQL request failed"}return e instanceof Error?e.message:String(e)}function v(e){let n={};return e?.accessToken&&(n.Authorization=`Bearer ${e.accessToken}`),e?.organizationId&&(n["x-org-id"]=e.organizationId),n}function z(e,n){let r=v(e);return n&&(r.Origin=n),e?.workspaceToken&&(r["X-Workspace-Authorization"]=`Bearer ${e.workspaceToken}`),e?.organizationId&&(r["x-org-id"]=e.organizationId),r}async function P(e,n,r){let t;for(let i=0;i<U;i++)try{let s=new AbortController,o=setTimeout(()=>s.abort(),ge);try{return await e.request({document:n,variables:r,signal:s.signal})}finally{clearTimeout(o);}}catch(s){if(t=s,s&&typeof s=="object"&&"response"in s){let o=s.response;if(o&&typeof o.status=="number"&&o.status>=400&&o.status<500)break}if(we(s)&&i<U-1){let o=fe*Math.pow(2,i);await me(o);continue}break}throw new Error(H(t))}function R(e,n){let r=null,t=null;function i(){let a=e.read(),g=n.read();return r=new graphqlRequest.GraphQLClient(a.workspaceEndpoint),r.setHeaders(z(g,e.resolveProductOrigin())),t=new graphqlRequest.GraphQLClient(a.globalEndpoint),t.setHeaders(v(g)),{workspace:r,global:t}}async function s(){let a=n.read();if(!a)return;if(a.authMethod==="client_credentials"&&a.clientId&&a.clientSecret){let d=e.read();try{let f=await S(d.globalEndpoint,a.clientId,a.clientSecret);n.write({...a,accessToken:f.accessToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}return}if(!a.refreshToken)return;let g=e.read(),c=new graphqlRequest.GraphQLClient(g.globalEndpoint);c.setHeaders({Authorization:`Bearer ${a.accessToken}`});let p=`
|
|
21
21
|
mutation RefreshToken($token: String!) {
|
|
22
22
|
refreshToken(token: $token) {
|
|
23
23
|
accessToken
|
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
expiresIn
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await $(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(z(n.read(),e.resolveProductOrigin())),P(c,a,g)}},global:{async request(a,g){let{global:c}=t?{global:t}:i();return c.setHeaders(v(n.read())),P(c,a,g)}},workspaceAuthOnly:{async request(a,g){let c=e.read(),p=n.read(),d=new graphqlRequest.GraphQLClient(c.workspaceEndpoint),f=v(p),F=e.resolveProductOrigin();return F&&(f.Origin=F),d.setHeaders(f),P(d,a,g)}},reset(){r=null,t=null;}}}function q(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function V(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return q()?"table":"json"}function
|
|
29
|
-
`)}function J(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(D(e,0));}function he(e){
|
|
28
|
+
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await $(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(z(n.read(),e.resolveProductOrigin())),P(c,a,g)}},global:{async request(a,g){let{global:c}=t?{global:t}:i();return c.setHeaders(v(n.read())),P(c,a,g)}},workspaceAuthOnly:{async request(a,g){let c=e.read(),p=n.read(),d=new graphqlRequest.GraphQLClient(c.workspaceEndpoint),f=v(p),F=e.resolveProductOrigin();return F&&(f.Origin=F),d.setHeaders(f),P(d,a,g)}},reset(){r=null,t=null;}}}function q(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function V(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return q()?"table":"json"}function L(e){console.log(JSON.stringify(e,null,2));}function B(e,n){if(e.length===0)return;let r=e.map((s,o)=>{let u=s.length;for(let l of n){let m=l[o]??"";m.length>u&&(u=m.length);}return Math.min(u,50)}),t=r.map(s=>"-".repeat(s+2)).join("+"),i=s=>s.map((o,u)=>` ${(o??"").padEnd(r[u]??0)} `).join("|");console.log(i(e)),console.log(t);for(let s of n)console.log(i(s));}function D(e,n){let r=" ".repeat(n),t=[];for(let[i,s]of Object.entries(e))if(s==null)t.push(`${r}${i}: null`);else if(Array.isArray(s)){t.push(`${r}${i}:`);for(let o of s)typeof o=="object"&&o!==null?(t.push(`${r} -`),t.push(D(o,n+2))):t.push(`${r} - ${String(o)}`);}else typeof s=="object"?(t.push(`${r}${i}:`),t.push(D(s,n+1))):t.push(`${r}${i}: ${String(s)}`);return t.join(`
|
|
29
|
+
`)}function J(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(D(e,0));}function he(e){process.stdout.write(e.endsWith(`
|
|
30
|
+
`)?e:`${e}
|
|
31
|
+
`);}function ke(e){console.log(`\u2713 ${e}`);}function Y(e){console.error(`\u2717 ${e}`);}function ye(e){console.warn(`! ${e}`);}function Ce(e){console.log(`\u2139 ${e}`);}function xe(e){if(!e)return "-";try{return new Date(e).toLocaleString()}catch{return e}}function be(e){if(!e)return "-";switch(e.toUpperCase()){case "ACTIVE":case "RUNNING":case "HEALTHY":return `\u2713 ${e}`;case "INACTIVE":case "STOPPED":case "PENDING":return `\u25CB ${e}`;case "ERROR":return `\u2717 ${e}`;case "ARCHIVED":return `\u2192 ${e}`;case "STARTING":return `\u25B6 ${e}`;case "TERMINATED":return `\u25A0 ${e}`;default:return e}}function ve(e,n){return e?e.length<=n?e:e.substring(0,n-3)+"...":"-"}function Te(e,n,r){switch(V(e)){case "json":L(n);break;case "yaml":J(n);break;case "table":r?B(r.headers,r.rows):L(n);break}}async function Ie(e,n){return n?true:q()?new Promise(r=>{process.stdout.write(`${e} [y/N] `),process.stdin.setEncoding("utf8"),process.stdin.once("data",t=>{let i=t.trim().toLowerCase();r(i==="y"||i==="yes");}),process.stdin.resume();}):(Y(`${e} Use --force to skip confirmation.`),false)}var _={isInteractive:q,getFormat:V,formatAndOutput:Te,printJson:L,printTable:B,printYaml:J,printRaw:he,printSuccess:ke,printError:Y,printWarning:ye,printInfo:Ce,formatDate:xe,formatStatus:be,truncate:ve,confirm:Ie};function N(e={}){let{verbose:n=false,quiet:r=false}=e;return {debug(t,...i){n&&console.error(`[debug] ${t}`,...i);},info(t,...i){r||console.error(`[info] ${t}`,...i);},warn(t,...i){console.error(`[warn] ${t}`,...i);},error(t,...i){console.error(`[error] ${t}`,...i);}}}function Ee(e){return e.includes("localhost")||e.includes("127.0.0.1")?"local":e.includes("alpha")||e.includes("staging")?"staging":"prod"}function Ae(e){return !!e&&typeof e.debug=="function"&&typeof e.info=="function"}function Oe(e){let n=O(e.defaults),r=A(n.dir()),t=R(n,r),i=e.output??_,s=Ae(e.logger)?e.logger:N(e.logger),o=e.env??Ee(n.read().workspaceEndpoint);return {productName:e.productName,productVersion:e.productVersion,defaults:e.defaults,config:n,auth:r,gql:t,output:i,logger:s,env:o}}var y=class extends Error{exitCode;hint;constructor(n,r){super(n),this.name="CliUserError",this.exitCode=r?.exitCode??1,this.hint=r?.hint;}},x=class extends y{constructor(n,r){super(n,{exitCode:2,hint:r?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},h=class extends Error{cause;constructor(n,r){super(n),this.name="CliInternalError",this.cause=r;}};var T=class extends h{constructor(n,r){super(`Module '${n}' declares dependency on '${r}', but '${r}' is not in the module list.`),this.name="MissingDependencyError";}},I=class extends h{constructor(n){super(`Circular dependency detected among modules: ${n.join(" -> ")}`),this.name="CircularDependencyError";}};function j(e){let n=new Map;for(let o of e){if(n.has(o.id))throw new h(`Duplicate module id: '${o.id}'`);n.set(o.id,o);}for(let o of e)for(let u of o.dependsOn??[])if(!n.has(u))throw new T(o.id,u);let r=[],t=new Set,i=new Set;function s(o,u){if(!i.has(o.id)){if(t.has(o.id))throw new I([...u,o.id]);t.add(o.id);for(let l of o.dependsOn??[]){let m=n.get(l);m&&s(m,[...u,o.id]);}t.delete(o.id),i.add(o.id),r.push(o);}}for(let o of e)s(o,[]);return r}function $e(e,n,r){let t=new commander.Command;t.name(r.name).description(r.description??"").version(r.version,"-v, --version").option("-f, --format <format>","Output format (json, table, yaml)").option("--verbose","Enable verbose logging").option("--no-color","Disable colored output"),t.hook("preAction",(o,u)=>{let l=t.opts().format;if(typeof l!="string")return;u.options.some(k=>k.attributeName()==="format")&&u.getOptionValue("format")===void 0&&u.setOptionValue("format",l);});let i=j(n);for(let o of i)o.register(t,e);r.helpExamples?.length&&t.addHelpText("after",`
|
|
30
32
|
Examples:
|
|
31
33
|
`+r.helpExamples.map(o=>" "+o).join(`
|
|
32
|
-
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){
|
|
34
|
+
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){Pe(e,u);}}return {program:t,run:s}}function Pe(e,n){if(n instanceof x&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof y&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof h&&(e.output.printError(`Internal error: ${n.message}`),n.cause&&e.logger.debug("caused by:",n.cause),process.exit(70)),n&&typeof n=="object"&&"code"in n&&"exitCode"in n){let t=n.exitCode;process.exit(typeof t=="number"?t:0);}let r=n instanceof Error?n.message:String(n);e.output.printError(r),process.exit(1);}exports.CircularDependencyError=I;exports.CliAuthError=x;exports.CliInternalError=h;exports.CliUserError=y;exports.KNOWN_CONFIG_KEYS=ae;exports.MissingDependencyError=T;exports.buildContext=Oe;exports.clientCredentialsFlow=S;exports.createAuthStore=A;exports.createConfigStore=O;exports.createGqlClients=R;exports.createLogger=N;exports.createProgram=$e;exports.defaultOutputAdapter=_;exports.extractGqlErrorMessage=H;exports.fetchWorkspaces=le;exports.issueWorkspaceToken=$;exports.openBrowser=de;exports.pollForToken=ue;exports.sortModules=j;exports.startDeviceCodeFlow=ce;
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CLIContext, C as CliModule } from '../module-
|
|
2
|
-
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from '../module-
|
|
1
|
+
import { a as CLIContext, C as CliModule } from '../module-BwJmqefL.cjs';
|
|
2
|
+
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from '../module-BwJmqefL.cjs';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import 'graphql-request';
|
|
5
5
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CLIContext, C as CliModule } from '../module-
|
|
2
|
-
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from '../module-
|
|
1
|
+
import { a as CLIContext, C as CliModule } from '../module-BwJmqefL.js';
|
|
2
|
+
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from '../module-BwJmqefL.js';
|
|
3
3
|
import { Command } from 'commander';
|
|
4
4
|
import 'graphql-request';
|
|
5
5
|
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{s as CircularDependencyError,p as CliAuthError,q as CliInternalError,o as CliUserError,b as KNOWN_CONFIG_KEYS,r as MissingDependencyError,n as buildContext,f as clientCredentialsFlow,a as createAuthStore,c as createConfigStore,k as createGqlClients,m as createLogger,u as createProgram,l as defaultOutputAdapter,j as extractGqlErrorMessage,h as fetchWorkspaces,g as issueWorkspaceToken,i as openBrowser,e as pollForToken,t as sortModules,d as startDeviceCodeFlow}from'../chunk-
|
|
1
|
+
export{s as CircularDependencyError,p as CliAuthError,q as CliInternalError,o as CliUserError,b as KNOWN_CONFIG_KEYS,r as MissingDependencyError,n as buildContext,f as clientCredentialsFlow,a as createAuthStore,c as createConfigStore,k as createGqlClients,m as createLogger,u as createProgram,l as defaultOutputAdapter,j as extractGqlErrorMessage,h as fetchWorkspaces,g as issueWorkspaceToken,i as openBrowser,e as pollForToken,t as sortModules,d as startDeviceCodeFlow}from'../chunk-2OISIPE6.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var fs=require('fs'),path=require('path'),os=require('os'),graphqlRequest=require('graphql-request'),C=require('cross-fetch'),commander=require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var C__default=/*#__PURE__*/_interopDefault(C);var G=300*1e3;function A(e){let n=path.join(e,"auth.json");function r(){fs.existsSync(e)||fs.mkdirSync(e,{recursive:true,mode:448});}function t(){try{if(!fs.existsSync(n))return null;let a=fs.readFileSync(n,"utf8");return JSON.parse(a)}catch{return null}}function i(a){r(),fs.writeFileSync(n,JSON.stringify(a,null,2),{encoding:"utf8",mode:384});try{fs.chmodSync(n,384);}catch{}}function s(){try{fs.existsSync(n)&&fs.unlinkSync(n);}catch{}}function o(){let a=t();return a?.expiresAt?Date.now()>=a.expiresAt:false}function u(){let a=t();return a?.expiresAt?Date.now()+G>=a.expiresAt:false}function l(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()>=a.workspaceTokenExpiresAt:false}function m(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()+G>=a.workspaceTokenExpiresAt:false}function
|
|
1
|
+
'use strict';var fs=require('fs'),path=require('path'),os=require('os'),graphqlRequest=require('graphql-request'),C=require('cross-fetch'),commander=require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var C__default=/*#__PURE__*/_interopDefault(C);var G=300*1e3;function A(e){let n=path.join(e,"auth.json");function r(){fs.existsSync(e)||fs.mkdirSync(e,{recursive:true,mode:448});}function t(){try{if(!fs.existsSync(n))return null;let a=fs.readFileSync(n,"utf8");return JSON.parse(a)}catch{return null}}function i(a){r(),fs.writeFileSync(n,JSON.stringify(a,null,2),{encoding:"utf8",mode:384});try{fs.chmodSync(n,384);}catch{}}function s(){try{fs.existsSync(n)&&fs.unlinkSync(n);}catch{}}function o(){let a=t();return a?.expiresAt?Date.now()>=a.expiresAt:false}function u(){let a=t();return a?.expiresAt?Date.now()+G>=a.expiresAt:false}function l(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()>=a.workspaceTokenExpiresAt:false}function m(){let a=t();return a?.workspaceTokenExpiresAt?Date.now()+G>=a.workspaceTokenExpiresAt:false}function k(){return t()?.accessToken?!o():false}return {read:t,write:i,clear:s,isTokenExpired:o,isTokenExpiringSoon:u,isWorkspaceTokenExpired:l,isWorkspaceTokenExpiringSoon:m,isAuthenticated:k}}var ae=["workspaceEndpoint","globalEndpoint","oidcIssuer","clientId","defaultFormat","verbose","authServiceEndpoint","productOrigin"];function O(e){let n=path.join(os.homedir(),".config",e.configDirName),r=path.join(n,"config.json"),t={workspaceEndpoint:e.workspaceEndpointDefault,globalEndpoint:e.globalEndpointDefault};function i(){fs.existsSync(n)||fs.mkdirSync(n,{recursive:true,mode:448});}function s(c){if(e.envPrefix){let d=process.env[`${e.envPrefix}_${c}`];if(d)return d}let p=process.env[c];return p&&p.length>0?p:void 0}function o(c){if(!e.envPrefix)return;let p=process.env[`${e.envPrefix}_${c}`];return p&&p.length>0?p:void 0}function u(){let c={};try{fs.existsSync(r)&&(c=JSON.parse(fs.readFileSync(r,"utf8")));}catch{}return {...t,...c,workspaceEndpoint:s("WORKSPACE_ENDPOINT")??c.workspaceEndpoint??t.workspaceEndpoint,globalEndpoint:s("GLOBAL_ENDPOINT")??c.globalEndpoint??t.globalEndpoint,oidcIssuer:s("OIDC_ISSUER")??c.oidcIssuer,clientId:s("CLIENT_ID")??c.clientId,productOrigin:o("ORIGIN")??c.productOrigin}}function l(c){i(),fs.writeFileSync(r,JSON.stringify(c,null,2),{encoding:"utf8"});try{fs.chmodSync(r,384);}catch{}}function m(c){return u()[c]}function k(c,p){let d=u();d[c]=p,l(d);}function a(){let c=u(),p=c.clientId||e.oidcClientId,d=c.oidcIssuer;if(!d){let f=c.globalEndpoint;f.includes("localhost")||f.includes("127.0.0.1")?d=f.replace(/\/graphql$/,"").replace(/\/global\/graphql$/,"/global"):d=e.oidcIssuerProd??"https://graphql.burdenoff.com/global";}return {oidcIssuer:d,clientId:p}}function g(){let c=u();if(c.productOrigin)return c.productOrigin;if(e.productOrigins)try{let p=new URL(c.workspaceEndpoint).hostname.toLowerCase();return e.productOrigins[p]}catch{return}}return {read:u,write:l,get:m,set:k,path:()=>r,dir:()=>n,resolveOIDC:a,resolveProductOrigin:g}}async function ce(e){let n=`${e.oidcIssuer}/oidc/device/code`,r=new URLSearchParams({client_id:e.clientId,scope:"openid profile email offline_access"}),t=await C__default.default(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Device code request failed (${t.status}): ${s}`)}let i=await t.json();return {deviceCode:i.device_code,userCode:i.user_code,verificationUri:i.verification_uri,verificationUriComplete:i.verification_uri_complete??null,expiresIn:i.expires_in,interval:i.interval??5}}async function ue(e,n,r){let t=`${r.oidcIssuer}/oauth/device/token`,i=n;for(;;){await new Promise(l=>setTimeout(l,i*1e3));let s=await C__default.default(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e,client_id:r.clientId}).toString()}),o=await s.json();if(s.ok&&o.access_token)return {accessToken:o.access_token,refreshToken:o.refresh_token??"",expiresIn:o.expires_in??3600};let u=o.error;switch(u){case "authorization_pending":continue;case "slow_down":i+=5;continue;case "expired_token":throw new Error("Device code has expired. Please try again.");case "access_denied":throw new Error("Authorization was denied by the user.");default:throw new Error(`Device code polling failed: ${o.error_description??u??"Unknown error"}`)}}}async function S(e,n,r,t){let s=await C__default.default(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:`
|
|
2
2
|
mutation AuthenticateApp($input: AuthenticateAppInput!) {
|
|
3
3
|
authenticateApp(input: $input) {
|
|
4
4
|
accessToken tokenType expiresIn scopes
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
items { id name slug tenantId organizationId }
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function pe(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function de(e){try{if(!pe(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var ge=3e4,U=3,fe=1e3;function me(e){return new Promise(n=>setTimeout(n,e))}function
|
|
20
|
+
`,variables:{limit:50}})});if(!t.ok){let s=await t.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${t.status}): ${s}`)}let i=await t.json();if(i.errors?.length)throw new Error(`Failed to fetch workspaces: ${i.errors[0]?.message??"unknown error"}`);return i.data?.myWorkspaces?.items??[]}function pe(e){try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return false}}async function de(e){try{if(!pe(e))return !1;let{execFile:n}=await import('child_process'),r=process.platform,t,i;return r==="darwin"?(t="open",i=[e]):r==="win32"?(t="cmd",i=["/c","start","",e]):(t="xdg-open",i=[e]),new Promise(s=>{n(t,i,o=>{s(!o);});})}catch{return false}}var ge=3e4,U=3,fe=1e3;function me(e){return new Promise(n=>setTimeout(n,e))}function we(e){if(e instanceof TypeError)return true;if(e&&typeof e=="object"&&"response"in e){let n=e.response;if(n&&typeof n.status=="number"&&n.status>=500)return true}return false}function H(e){if(e&&typeof e=="object"&&"response"in e){let n=e,r=n.response?.errors?.[0],t=r?.extensions?.originalError?.message;if(t)return t;if(r?.message)return r.message;let i=n.response?.status;return typeof i=="number"&&Number.isInteger(i)?`GraphQL request failed (HTTP ${i})`:"GraphQL request failed"}return e instanceof Error?e.message:String(e)}function v(e){let n={};return e?.accessToken&&(n.Authorization=`Bearer ${e.accessToken}`),e?.organizationId&&(n["x-org-id"]=e.organizationId),n}function z(e,n){let r=v(e);return n&&(r.Origin=n),e?.workspaceToken&&(r["X-Workspace-Authorization"]=`Bearer ${e.workspaceToken}`),e?.organizationId&&(r["x-org-id"]=e.organizationId),r}async function P(e,n,r){let t;for(let i=0;i<U;i++)try{let s=new AbortController,o=setTimeout(()=>s.abort(),ge);try{return await e.request({document:n,variables:r,signal:s.signal})}finally{clearTimeout(o);}}catch(s){if(t=s,s&&typeof s=="object"&&"response"in s){let o=s.response;if(o&&typeof o.status=="number"&&o.status>=400&&o.status<500)break}if(we(s)&&i<U-1){let o=fe*Math.pow(2,i);await me(o);continue}break}throw new Error(H(t))}function R(e,n){let r=null,t=null;function i(){let a=e.read(),g=n.read();return r=new graphqlRequest.GraphQLClient(a.workspaceEndpoint),r.setHeaders(z(g,e.resolveProductOrigin())),t=new graphqlRequest.GraphQLClient(a.globalEndpoint),t.setHeaders(v(g)),{workspace:r,global:t}}async function s(){let a=n.read();if(!a)return;if(a.authMethod==="client_credentials"&&a.clientId&&a.clientSecret){let d=e.read();try{let f=await S(d.globalEndpoint,a.clientId,a.clientSecret);n.write({...a,accessToken:f.accessToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}return}if(!a.refreshToken)return;let g=e.read(),c=new graphqlRequest.GraphQLClient(g.globalEndpoint);c.setHeaders({Authorization:`Bearer ${a.accessToken}`});let p=`
|
|
21
21
|
mutation RefreshToken($token: String!) {
|
|
22
22
|
refreshToken(token: $token) {
|
|
23
23
|
accessToken
|
|
@@ -25,8 +25,10 @@
|
|
|
25
25
|
expiresIn
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await $(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(z(n.read(),e.resolveProductOrigin())),P(c,a,g)}},global:{async request(a,g){let{global:c}=t?{global:t}:i();return c.setHeaders(v(n.read())),P(c,a,g)}},workspaceAuthOnly:{async request(a,g){let c=e.read(),p=n.read(),d=new graphqlRequest.GraphQLClient(c.workspaceEndpoint),f=v(p),F=e.resolveProductOrigin();return F&&(f.Origin=F),d.setHeaders(f),P(d,a,g)}},reset(){r=null,t=null;}}}function q(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function V(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return q()?"table":"json"}function
|
|
29
|
-
`)}function J(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(D(e,0));}function he(e){
|
|
28
|
+
`;try{let f=(await c.request(p,{token:a.refreshToken})).refreshToken;n.write({...a,accessToken:f.accessToken,refreshToken:f.refreshToken,expiresAt:Date.now()+f.expiresIn*1e3}),r=null,t=null;}catch{}}async function o(){let a=n.read();if(!a?.accessToken||!a.workspaceId||!a.organizationId)return;let g=e.read();try{let c=await $(g.workspaceEndpoint,a.accessToken,a.workspaceId,a.organizationId);n.write({...a,workspaceToken:c.token,workspaceTokenExpiresAt:new Date(c.expiresAt).getTime()}),r=null;}catch{}}async function u(){n.isTokenExpiringSoon()&&await s(),n.read()?.workspaceToken&&n.isWorkspaceTokenExpiringSoon()&&await o();}return {workspace:{async request(a,g){await u();let{workspace:c}=r?{workspace:r}:i();return c.setHeaders(z(n.read(),e.resolveProductOrigin())),P(c,a,g)}},global:{async request(a,g){let{global:c}=t?{global:t}:i();return c.setHeaders(v(n.read())),P(c,a,g)}},workspaceAuthOnly:{async request(a,g){let c=e.read(),p=n.read(),d=new graphqlRequest.GraphQLClient(c.workspaceEndpoint),f=v(p),F=e.resolveProductOrigin();return F&&(f.Origin=F),d.setHeaders(f),P(d,a,g)}},reset(){r=null,t=null;}}}function q(){return !!(process.stdout.isTTY&&process.stdin.isTTY)}function V(e){if(e.format){let n=e.format.toLowerCase();if(n==="json"||n==="table"||n==="yaml")return n}return q()?"table":"json"}function L(e){console.log(JSON.stringify(e,null,2));}function B(e,n){if(e.length===0)return;let r=e.map((s,o)=>{let u=s.length;for(let l of n){let m=l[o]??"";m.length>u&&(u=m.length);}return Math.min(u,50)}),t=r.map(s=>"-".repeat(s+2)).join("+"),i=s=>s.map((o,u)=>` ${(o??"").padEnd(r[u]??0)} `).join("|");console.log(i(e)),console.log(t);for(let s of n)console.log(i(s));}function D(e,n){let r=" ".repeat(n),t=[];for(let[i,s]of Object.entries(e))if(s==null)t.push(`${r}${i}: null`);else if(Array.isArray(s)){t.push(`${r}${i}:`);for(let o of s)typeof o=="object"&&o!==null?(t.push(`${r} -`),t.push(D(o,n+2))):t.push(`${r} - ${String(o)}`);}else typeof s=="object"?(t.push(`${r}${i}:`),t.push(D(s,n+1))):t.push(`${r}${i}: ${String(s)}`);return t.join(`
|
|
29
|
+
`)}function J(e){if(typeof e!="object"||e===null){console.log(String(e));return}console.log(D(e,0));}function he(e){process.stdout.write(e.endsWith(`
|
|
30
|
+
`)?e:`${e}
|
|
31
|
+
`);}function ke(e){console.log(`\u2713 ${e}`);}function Y(e){console.error(`\u2717 ${e}`);}function ye(e){console.warn(`! ${e}`);}function Ce(e){console.log(`\u2139 ${e}`);}function xe(e){if(!e)return "-";try{return new Date(e).toLocaleString()}catch{return e}}function be(e){if(!e)return "-";switch(e.toUpperCase()){case "ACTIVE":case "RUNNING":case "HEALTHY":return `\u2713 ${e}`;case "INACTIVE":case "STOPPED":case "PENDING":return `\u25CB ${e}`;case "ERROR":return `\u2717 ${e}`;case "ARCHIVED":return `\u2192 ${e}`;case "STARTING":return `\u25B6 ${e}`;case "TERMINATED":return `\u25A0 ${e}`;default:return e}}function ve(e,n){return e?e.length<=n?e:e.substring(0,n-3)+"...":"-"}function Te(e,n,r){switch(V(e)){case "json":L(n);break;case "yaml":J(n);break;case "table":r?B(r.headers,r.rows):L(n);break}}async function Ie(e,n){return n?true:q()?new Promise(r=>{process.stdout.write(`${e} [y/N] `),process.stdin.setEncoding("utf8"),process.stdin.once("data",t=>{let i=t.trim().toLowerCase();r(i==="y"||i==="yes");}),process.stdin.resume();}):(Y(`${e} Use --force to skip confirmation.`),false)}var _={isInteractive:q,getFormat:V,formatAndOutput:Te,printJson:L,printTable:B,printYaml:J,printRaw:he,printSuccess:ke,printError:Y,printWarning:ye,printInfo:Ce,formatDate:xe,formatStatus:be,truncate:ve,confirm:Ie};function N(e={}){let{verbose:n=false,quiet:r=false}=e;return {debug(t,...i){n&&console.error(`[debug] ${t}`,...i);},info(t,...i){r||console.error(`[info] ${t}`,...i);},warn(t,...i){console.error(`[warn] ${t}`,...i);},error(t,...i){console.error(`[error] ${t}`,...i);}}}function Ee(e){return e.includes("localhost")||e.includes("127.0.0.1")?"local":e.includes("alpha")||e.includes("staging")?"staging":"prod"}function Ae(e){return !!e&&typeof e.debug=="function"&&typeof e.info=="function"}function Oe(e){let n=O(e.defaults),r=A(n.dir()),t=R(n,r),i=e.output??_,s=Ae(e.logger)?e.logger:N(e.logger),o=e.env??Ee(n.read().workspaceEndpoint);return {productName:e.productName,productVersion:e.productVersion,defaults:e.defaults,config:n,auth:r,gql:t,output:i,logger:s,env:o}}var y=class extends Error{exitCode;hint;constructor(n,r){super(n),this.name="CliUserError",this.exitCode=r?.exitCode??1,this.hint=r?.hint;}},x=class extends y{constructor(n,r){super(n,{exitCode:2,hint:r?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},h=class extends Error{cause;constructor(n,r){super(n),this.name="CliInternalError",this.cause=r;}};var T=class extends h{constructor(n,r){super(`Module '${n}' declares dependency on '${r}', but '${r}' is not in the module list.`),this.name="MissingDependencyError";}},I=class extends h{constructor(n){super(`Circular dependency detected among modules: ${n.join(" -> ")}`),this.name="CircularDependencyError";}};function j(e){let n=new Map;for(let o of e){if(n.has(o.id))throw new h(`Duplicate module id: '${o.id}'`);n.set(o.id,o);}for(let o of e)for(let u of o.dependsOn??[])if(!n.has(u))throw new T(o.id,u);let r=[],t=new Set,i=new Set;function s(o,u){if(!i.has(o.id)){if(t.has(o.id))throw new I([...u,o.id]);t.add(o.id);for(let l of o.dependsOn??[]){let m=n.get(l);m&&s(m,[...u,o.id]);}t.delete(o.id),i.add(o.id),r.push(o);}}for(let o of e)s(o,[]);return r}function $e(e,n,r){let t=new commander.Command;t.name(r.name).description(r.description??"").version(r.version,"-v, --version").option("-f, --format <format>","Output format (json, table, yaml)").option("--verbose","Enable verbose logging").option("--no-color","Disable colored output"),t.hook("preAction",(o,u)=>{let l=t.opts().format;if(typeof l!="string")return;u.options.some(k=>k.attributeName()==="format")&&u.getOptionValue("format")===void 0&&u.setOptionValue("format",l);});let i=j(n);for(let o of i)o.register(t,e);r.helpExamples?.length&&t.addHelpText("after",`
|
|
30
32
|
Examples:
|
|
31
33
|
`+r.helpExamples.map(o=>" "+o).join(`
|
|
32
|
-
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){
|
|
34
|
+
`)),t.on("command:*",()=>{e.output.printError(`Invalid command: ${t.args.join(" ")}`),e.output.printInfo(`Run \`${r.name} --help\` for available commands.`),process.exit(1);});async function s(o=process.argv){try{await t.parseAsync(o),o.length<=2&&t.outputHelp();}catch(u){Pe(e,u);}}return {program:t,run:s}}function Pe(e,n){if(n instanceof x&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof y&&(e.output.printError(n.message),n.hint&&e.output.printInfo(n.hint),process.exit(n.exitCode)),n instanceof h&&(e.output.printError(`Internal error: ${n.message}`),n.cause&&e.logger.debug("caused by:",n.cause),process.exit(70)),n&&typeof n=="object"&&"code"in n&&"exitCode"in n){let t=n.exitCode;process.exit(typeof t=="number"?t:0);}let r=n instanceof Error?n.message:String(n);e.output.printError(r),process.exit(1);}exports.CircularDependencyError=I;exports.CliAuthError=x;exports.CliInternalError=h;exports.CliUserError=y;exports.KNOWN_CONFIG_KEYS=ae;exports.MissingDependencyError=T;exports.buildContext=Oe;exports.clientCredentialsFlow=S;exports.createAuthStore=A;exports.createConfigStore=O;exports.createGqlClients=R;exports.createLogger=N;exports.createProgram=$e;exports.defaultOutputAdapter=_;exports.extractGqlErrorMessage=H;exports.fetchWorkspaces=le;exports.issueWorkspaceToken=$;exports.openBrowser=de;exports.pollForToken=ue;exports.sortModules=j;exports.startDeviceCodeFlow=ce;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, a as CLIContext, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, C as CliModule, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from './module-
|
|
1
|
+
export { A as AuthStore, B as BuildContextOptions, b as CLIConfig, a as CLIContext, c as CircularDependencyError, d as CliAuthError, e as CliInternalError, C as CliModule, f as CliUserError, g as ConfigStore, E as Environment, G as GqlClient, h as GqlClients, K as KNOWN_CONFIG_KEYS, L as Logger, i as LoggerOptions, M as MissingDependencyError, O as OutputAdapter, j as OutputFormat, P as ProductDefaults, S as StoredAuth, T as TableConfig, k as buildContext, l as createAuthStore, m as createConfigStore, n as createGqlClients, o as createLogger, p as defaultOutputAdapter, q as extractGqlErrorMessage, s as sortModules } from './module-BwJmqefL.cjs';
|
|
2
2
|
export { ClientCredentialsResult, CreateProgramOptions, DeviceCodeResponse, DeviceCodeTokenResult, OIDCConfig, ProgramFactoryResult, clientCredentialsFlow, createProgram, fetchWorkspaces, issueWorkspaceToken, openBrowser, pollForToken, startDeviceCodeFlow } from './core/index.cjs';
|
|
3
3
|
import 'commander';
|
|
4
4
|
import 'graphql-request';
|