@burdenoff/cli-sdk 2026.825.2 → 2026.1021.1
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-IZXPWPKX.js +32 -0
- package/dist/chunk-NLEVVDXR.js +1 -0
- package/dist/core/index.cjs +7 -7
- 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 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{module-DxCuik6L.d.cts → module-DOIiVaXQ.d.cts} +4 -1
- package/dist/{module-DxCuik6L.d.ts → module-DOIiVaXQ.d.ts} +4 -1
- 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.cjs +6 -6
- 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 +2 -2
- 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.cjs +4 -4
- 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.cjs +34 -34
- package/dist/modules/auth/index.d.cts +1 -1
- package/dist/modules/auth/index.d.ts +1 -1
- package/dist/modules/auth/index.js +30 -30
- package/dist/modules/billing/index.cjs +3 -3
- 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.cjs +4 -4
- 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.cjs +3 -3
- 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.cjs +7 -7
- 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.cjs +11 -11
- 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 +5 -5
- 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 +8 -8
- 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 +4 -4
- 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 +4 -4
- 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 +4 -4
- 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.cjs +5 -5
- 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 +2 -2
- 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.cjs +21 -21
- 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 +9 -9
- 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.cjs +401 -0
- package/dist/modules/fluidgrids/index.d.cts +7 -0
- package/dist/modules/fluidgrids/index.d.ts +7 -0
- package/dist/modules/fluidgrids/index.js +401 -0
- package/dist/modules/ggnomad/index.cjs +5 -5
- 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 +4 -4
- 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.cjs +4 -4
- 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 +1 -1
- package/dist/modules/headshotmarketing/index.d.cts +1 -1
- package/dist/modules/headshotmarketing/index.d.ts +1 -1
- package/dist/modules/headshotmarketing/index.js +1 -1
- package/dist/modules/health/index.d.cts +1 -1
- package/dist/modules/health/index.d.ts +1 -1
- package/dist/modules/hookmovies/index.cjs +7 -7
- 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.cjs +7 -7
- 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 +5 -5
- 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 +4 -4
- 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.cjs +2 -2
- 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.cjs +4 -4
- 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.cjs +6 -6
- 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 +1 -1
- package/dist/modules/movethewheels/index.d.cts +1 -1
- package/dist/modules/movethewheels/index.d.ts +1 -1
- package/dist/modules/movethewheels/index.js +1 -1
- package/dist/modules/mybodyshield/index.cjs +6 -6
- 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 +5 -5
- 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.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.cjs +204 -225
- package/dist/modules/planmagnet/index.d.cts +1 -1
- package/dist/modules/planmagnet/index.d.ts +1 -1
- package/dist/modules/planmagnet/index.js +173 -194
- package/dist/modules/products/index.cjs +4 -4
- 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.cjs +2 -2
- 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.cjs +2 -2
- 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.cjs +4 -4
- 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 +5 -5
- 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 +7 -7
- 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 +7 -7
- 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 -1
- package/dist/modules/store/index.cjs +7 -7
- 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.cjs +2 -2
- 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.cjs +2 -2
- 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 +4 -4
- 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.cjs +3 -3
- 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.cjs +3 -3
- 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.cjs +7 -7
- 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.cjs +2 -2
- 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.cjs +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.cjs +15 -15
- package/dist/modules/workspaces/index.d.cts +1 -1
- package/dist/modules/workspaces/index.d.ts +1 -1
- package/dist/modules/workspaces/index.js +11 -11
- package/package.json +1 -1
- package/dist/chunk-TCBALVP4.js +0 -32
- package/dist/chunk-WXDQ3S5J.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,b as b$1,h as h$1,p as p$1,g,i,o as o$1}from'../../chunk-
|
|
1
|
+
import {a,b as b$1,h as h$1,p as p$1,g,i,o as o$1}from'../../chunk-NLEVVDXR.js';import {o}from'../../chunk-IZXPWPKX.js';var C=`
|
|
2
2
|
query AssetHandlerGetAsset($id: ID!) {
|
|
3
3
|
asset(id: $id) {
|
|
4
4
|
id assetNumber name description category status condition
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var p=class extends Error{exitCode;hint;constructor(r,n){super(r),this.name="CliUserError",this.exitCode=n?.exitCode??1,this.hint=n?.hint;}},I=class extends p{constructor(r,n){super(r,{exitCode:2,hint:n?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},f=class extends Error{cause;constructor(r,n){super(r),this.name="CliInternalError",this.cause=n;}};var C=null;function S(i){C=i;}function w(){if(!C)throw new f("vibecontrols module helpers used before setHelpersContext was called");return C}function xt(){let i=w();if(!i.auth.isAuthenticated())throw new I(
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var p=class extends Error{exitCode;hint;constructor(r,n){super(r),this.name="CliUserError",this.exitCode=n?.exitCode??1,this.hint=n?.hint;}},I=class extends p{constructor(r,n){super(r,{exitCode:2,hint:n?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},f=class extends Error{cause;constructor(r,n){super(r),this.name="CliInternalError",this.cause=n;}};var C=null;function S(i){C=i;}function w(){if(!C)throw new f("vibecontrols module helpers used before setHelpersContext was called");return C}function xt(){let i=w();if(!i.auth.isAuthenticated())throw new I("Authentication required.",{hint:`Run \`${i.productName} auth login\` to authenticate.`})}async function u(i,r){return xt(),w().gql.workspace.request(i,r)}async function k(i,r){return w().gql.workspaceAuthOnly.request(i,r)}function s(i){let r=i instanceof Error?i.message:String(i);throw new p(r)}function a(i,r,n){w().output.formatAndOutput(i,r,n);}function d(i){w().output.printSuccess(i);}function l(i,r){return w().output.truncate(i,r)}var T=`
|
|
2
2
|
query AthListTeams(
|
|
3
3
|
$pagination: PaginationInput
|
|
4
4
|
$sport: AthSport
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
tags createdAt workspaceId
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
`,
|
|
31
|
+
`,v=`
|
|
32
32
|
mutation AthUpdateTeam($id: ID!, $input: AthUpdateTeamInput!) {
|
|
33
33
|
athUpdateTeam(id: $id, input: $input) {
|
|
34
34
|
id name description sport status season ageGroup homeVenue headCoachId
|
|
35
35
|
tags updatedAt
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,R=`
|
|
39
39
|
mutation AthArchiveTeam($id: ID!) {
|
|
40
40
|
athArchiveTeam(id: $id)
|
|
41
41
|
}
|
|
@@ -273,4 +273,4 @@
|
|
|
273
273
|
query AthHealth {
|
|
274
274
|
athHealth
|
|
275
275
|
}
|
|
276
|
-
`;function ot(i,r){try{return JSON.parse(r)}catch{throw new p(`--${i} must be valid JSON`)}}function c(i){let r=Number.parseInt(i,10);if(Number.isNaN(r))throw new p(`Expected an integer but got "${i}"`);return r}function g(i){let r=Number.parseFloat(i);if(Number.isNaN(r))throw new p(`Expected a number but got "${i}"`);return r}function y(i){return i.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function it(i){let r=i.command("teams").description("AtheleteBridge teams");r.command("list").description("List teams").option("--sport <s>","Filter by sport").option("--status <s>","Filter by team status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(T,{pagination:{limit:n.limit,offset:n.offset},sport:n.sport?n.sport.toUpperCase():void 0,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListTeams.items,{headers:["ID","Name","Sport","Status","Season"],rows:t.athListTeams.items.map(e=>[l(e.id,12),e.name,e.sport,e.status,e.season??"-"])});}catch(t){s(t);}}),r.command("get").description("Get a team by id").argument("<id>","Team ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(x,{id:n});if(!e.athTeam)throw new p(`Team ${n} not found`);a(t,e.athTeam);}catch(e){s(e);}}),r.command("create").description("Create a team").requiredOption("--name <name>","Team name").option("--description <s>","Description").option("--sport <s>","Sport","OTHER").option("--status <s>","Team status","FORMING").option("--season <s>","Season").option("--age-group <s>","Age group").option("--home-venue <s>","Home venue").option("--head-coach-id <id>","Head coach user ID").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async n=>{try{let t={name:n.name,sport:(n.sport??"OTHER").toUpperCase(),status:(n.status??"FORMING").toUpperCase()};n.description&&(t.description=n.description),n.season&&(t.season=n.season),n.ageGroup&&(t.ageGroup=n.ageGroup),n.homeVenue&&(t.homeVenue=n.homeVenue),n.headCoachId&&(t.headCoachId=n.headCoachId),n.tags&&(t.tags=y(n.tags));let e=await u(E,{input:t});d(`Team created: ${e.athCreateTeam.name}`),a(n,e.athCreateTeam);}catch(t){s(t);}}),r.command("update").description("Update a team").argument("<id>","Team ID").option("--name <name>","Team name").option("--description <s>","Description").option("--sport <s>","Sport").option("--status <s>","Team status").option("--season <s>","Season").option("--age-group <s>","Age group").option("--home-venue <s>","Home venue").option("--head-coach-id <id>","Head coach user ID").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};if(t.name&&(e.name=t.name),t.description!==void 0&&(e.description=t.description),t.sport&&(e.sport=t.sport.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.season&&(e.season=t.season),t.ageGroup&&(e.ageGroup=t.ageGroup),t.homeVenue&&(e.homeVenue=t.homeVenue),t.headCoachId&&(e.headCoachId=t.headCoachId),t.tags&&(e.tags=y(t.tags)),!Object.keys(e).length)throw new p("No updates specified");let o=await u(R,{id:n,input:e});d("Team updated"),a(t,o.athUpdateTeam);}catch(e){s(e);}}),r.command("archive").description("Archive a team").argument("<id>","Team ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(v,{id:n});d(e.athArchiveTeam?`Team ${n} archived`:`Team ${n} not archived`),a(t,{archived:e.athArchiveTeam});}catch(e){s(e);}});}function st(i){let r=i.command("members").description("AtheleteBridge team members");r.command("list").description("List members of a team").requiredOption("--team <id>","Team ID").option("--status <s>","Filter by member status").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(O,{teamId:n.team,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListMembers,{headers:["ID","Name","Role","Status","Jersey","Position"],rows:t.athListMembers.map(e=>[l(e.id,12),e.displayName,e.role,e.status,e.jerseyNumber!==void 0&&e.jerseyNumber!==null?String(e.jerseyNumber):"-",e.position??"-"])});}catch(t){s(t);}}),r.command("add").description("Add a member to a team").requiredOption("--team <id>","Team ID").requiredOption("--user <id>","User ID").requiredOption("--display-name <name>","Display name").option("--role <r>","Member role","PLAYER").option("--status <s>","Member status","ACTIVE").option("--jersey-number <n>","Jersey number",c).option("--position <s>","Position").option("--dominant-side <s>","Dominant side").option("--height <n>","Height",g).option("--weight <n>","Weight",g).option("--joined-at <iso>","Joined at (ISO timestamp)").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async n=>{try{let t={teamId:n.team,userId:n.user,displayName:n.displayName,role:(n.role??"PLAYER").toUpperCase(),status:(n.status??"ACTIVE").toUpperCase()};n.jerseyNumber!==void 0&&(t.jerseyNumber=n.jerseyNumber),n.position&&(t.position=n.position),n.dominantSide&&(t.dominantSide=n.dominantSide),n.height!==void 0&&(t.height=n.height),n.weight!==void 0&&(t.weight=n.weight),n.joinedAt&&(t.joinedAt=n.joinedAt),n.notes&&(t.notes=n.notes);let e=await u(D,{input:t});d(`Member added: ${e.athAddMember.displayName}`),a(n,e.athAddMember);}catch(t){s(t);}}),r.command("update").description("Update a team member").argument("<id>","Member ID").option("--display-name <name>","Display name").option("--role <r>","Member role").option("--status <s>","Member status").option("--jersey-number <n>","Jersey number",c).option("--position <s>","Position").option("--dominant-side <s>","Dominant side").option("--height <n>","Height",g).option("--weight <n>","Weight",g).option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};if(t.displayName&&(e.displayName=t.displayName),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.jerseyNumber!==void 0&&(e.jerseyNumber=t.jerseyNumber),t.position&&(e.position=t.position),t.dominantSide&&(e.dominantSide=t.dominantSide),t.height!==void 0&&(e.height=t.height),t.weight!==void 0&&(e.weight=t.weight),t.notes!==void 0&&(e.notes=t.notes),!Object.keys(e).length)throw new p("No updates specified");let o=await u($,{id:n,input:e});d("Member updated"),a(t,o.athUpdateMember);}catch(e){s(e);}}),r.command("remove").description("Remove a team member").argument("<id>","Member ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(L,{id:n});d(e.athRemoveMember?`Member ${n} removed`:`Member ${n} not removed`),a(t,{removed:e.athRemoveMember});}catch(e){s(e);}});}function at(i){let r=i.command("programs").description("AtheleteBridge training programs");r.command("list").description("List training programs").option("--level <l>","Filter by program level").option("--sport <s>","Filter by sport").option("--status <s>","Filter by program status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await u(P,{pagination:{limit:t.limit,offset:t.offset},level:t.level?t.level.toUpperCase():void 0,sport:t.sport?t.sport.toUpperCase():void 0,status:t.status?t.status.toUpperCase():void 0});a(t,e.athListPrograms.items,{headers:["ID","Name","Sport","Level","Status","Weeks"],rows:e.athListPrograms.items.map(o=>[l(o.id,12),o.name,o.sport,o.level,o.status,o.weeks!==void 0&&o.weeks!==null?String(o.weeks):"-"])});}catch(e){s(e);}}),r.command("get").description("Get a training program by id").argument("<id>","Program ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(M,{id:t});if(!o.athProgram)throw new p(`Program ${t} not found`);a(e,o.athProgram);}catch(o){s(o);}}),r.command("create").description("Create a training program").requiredOption("--name <name>","Program name").option("--summary <s>","Summary").option("--sport <s>","Sport","OTHER").option("--level <l>","Level","BEGINNER").option("--weeks <n>","Number of weeks",c).option("--template","Mark as a template").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,sport:(t.sport??"OTHER").toUpperCase(),level:(t.level??"BEGINNER").toUpperCase(),isTemplate:!!t.template};t.summary&&(e.summary=t.summary),t.weeks!==void 0&&(e.weeks=t.weeks),t.tags&&(e.tags=y(t.tags));let o=await u(N,{input:e});d(`Program created: ${o.athCreateProgram.name}`),a(t,o.athCreateProgram);}catch(e){s(e);}}),r.command("update").description("Update a training program").argument("<id>","Program ID").option("--name <name>","Program name").option("--summary <s>","Summary").option("--sport <s>","Sport").option("--level <l>","Level").option("--weeks <n>","Number of weeks",c).option("--template <bool>","Template flag (true|false)").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.summary!==void 0&&(o.summary=e.summary),e.sport&&(o.sport=e.sport.toUpperCase()),e.level&&(o.level=e.level.toUpperCase()),e.weeks!==void 0&&(o.weeks=e.weeks),e.template!==void 0&&(o.isTemplate=e.template==="true"),e.tags&&(o.tags=y(e.tags)),!Object.keys(o).length)throw new p("No updates specified");let gt=await u(_,{id:t,input:o});d("Program updated"),a(e,gt.athUpdateProgram);}catch(o){s(o);}}),r.command("transition").description("Advance a program through its publish lifecycle (DRAFT -> PUBLISHED -> ARCHIVED)").argument("<id>","Program ID").requiredOption("--status <s>","Target status: DRAFT|PUBLISHED|ARCHIVED").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(F,{id:t,status:e.status.toUpperCase()});d(`Program transitioned to ${o.athTransitionProgram.status}`),a(e,o.athTransitionProgram);}catch(o){s(o);}}),r.command("archive").description("Archive a training program").argument("<id>","Program ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(U,{id:t});d(o.athArchiveProgram?`Program ${t} archived`:`Program ${t} not archived`),a(e,{archived:o.athArchiveProgram});}catch(o){s(o);}});let n=r.command("drills").description("AtheleteBridge program drills");n.command("add").description("Add a drill to a program").requiredOption("--program <id>","Program ID").requiredOption("--name <name>","Drill name").option("--description <s>","Description").option("--week-number <n>","Week number",c,1).option("--order-index <n>","Order index",c,0).option("--sets <n>","Sets",c).option("--reps <n>","Reps",c).option("--duration-sec <n>","Duration (seconds)",c).option("--rest-sec <n>","Rest (seconds)",c).option("--video-file-id <id>","Video file ID (wspace-files-svc)").option("-f, --format <format>","Output format").action(async t=>{try{let e={programId:t.program,name:t.name,weekNumber:t.weekNumber??1,orderIndex:t.orderIndex??0};t.description&&(e.description=t.description),t.sets!==void 0&&(e.sets=t.sets),t.reps!==void 0&&(e.reps=t.reps),t.durationSec!==void 0&&(e.durationSec=t.durationSec),t.restSec!==void 0&&(e.restSec=t.restSec),t.videoFileId&&(e.videoFileId=t.videoFileId);let o=await u(q,{input:e});d(`Drill added: ${o.athAddDrill.name}`),a(t,o.athAddDrill);}catch(e){s(e);}}),n.command("remove").description("Remove a drill").argument("<id>","Drill ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(G,{id:t});d(o.athRemoveDrill?`Drill ${t} removed`:`Drill ${t} not removed`),a(e,{removed:o.athRemoveDrill});}catch(o){s(o);}});}function ut(i){let r=i.command("sessions").description("AtheleteBridge coaching sessions");r.command("list").description("List sessions").option("--athlete <id>","Filter by athlete ID").option("--coach <id>","Filter by coach ID").option("--status <s>","Filter by session status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(W,{pagination:{limit:n.limit,offset:n.offset},athleteId:n.athlete,coachId:n.coach,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListSessions.items,{headers:["ID","Title","Type","Status","Scheduled"],rows:t.athListSessions.items.map(e=>[l(e.id,12),e.title,e.type,e.status,e.scheduledAt])});}catch(t){s(t);}}),r.command("get").description("Get a session by id").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(j,{id:n});if(!e.athSession)throw new p(`Session ${n} not found`);a(t,e.athSession);}catch(e){s(e);}}),r.command("book").description("Book a coaching session").requiredOption("--athlete <id>","Athlete ID").requiredOption("--coach <id>","Coach ID").requiredOption("--title <s>","Session title").requiredOption("--scheduled-at <iso>","Scheduled at (ISO timestamp)").option("--type <t>","Session type","IN_PERSON").option("--duration-min <n>","Duration (minutes)",c).option("--location <s>","Location").option("--meeting-url <url>","Meeting URL").option("--program <id>","Program ID").option("-f, --format <format>","Output format").action(async n=>{try{let t={athleteId:n.athlete,coachId:n.coach,title:n.title,scheduledAt:n.scheduledAt,type:(n.type??"IN_PERSON").toUpperCase()};n.durationMin!==void 0&&(t.durationMin=n.durationMin),n.location&&(t.location=n.location),n.meetingUrl&&(t.meetingUrl=n.meetingUrl),n.program&&(t.programId=n.program);let e=await u(H,{input:t});d(`Session booked: ${e.athBookSession.title}`),a(n,e.athBookSession);}catch(t){s(t);}}),r.command("confirm").description("Confirm a requested session").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(B,{id:n});d(`Session confirmed: ${e.athConfirmSession.status}`),a(t,e.athConfirmSession);}catch(e){s(e);}}),r.command("cancel").description("Cancel a session").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(V,{id:n});d(`Session cancelled: ${e.athCancelSession.status}`),a(t,e.athCancelSession);}catch(e){s(e);}}),r.command("complete").description("Complete a session (optionally with rating and feedback)").argument("<id>","Session ID").option("--rating <n>","Rating",c).option("--feedback <s>","Feedback").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};t.rating!==void 0&&(e.rating=t.rating),t.feedback&&(e.feedback=t.feedback);let o=await u(z,{id:n,input:Object.keys(e).length?e:void 0});d(`Session completed: ${o.athCompleteSession.status}`),a(t,o.athCompleteSession);}catch(e){s(e);}});}function ct(i){let r=i.command("workouts").description("AtheleteBridge workout logs");r.command("list").description("List workout logs").option("--athlete <id>","Filter by athlete ID").option("--program <id>","Filter by program ID").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(J,{pagination:{limit:n.limit,offset:n.offset},athleteId:n.athlete,programId:n.program});a(n,t.athListWorkoutLogs.items,{headers:["ID","Title","Status","Performed","Load","RPE"],rows:t.athListWorkoutLogs.items.map(e=>[l(e.id,12),e.title,e.status,e.performedAt,e.totalLoad!==void 0&&e.totalLoad!==null?String(e.totalLoad):"-",e.rpe!==void 0&&e.rpe!==null?String(e.rpe):"-"])});}catch(t){s(t);}}),r.command("log").description("Log a workout").requiredOption("--title <s>","Workout title").requiredOption("--performed-at <iso>","Performed at (ISO timestamp)").option("--athlete <id>","Athlete ID").option("--program <id>","Program ID").option("--status <s>","Workout status","COMPLETED").option("--duration-min <n>","Duration (minutes)",c).option("--total-load <n>","Total load",g).option("--rpe <n>","Rate of perceived exertion",c).option("--notes <s>","Notes").option("--metrics <json>","Metrics JSON object").option("-f, --format <format>","Output format").action(async n=>{try{let t={title:n.title,performedAt:n.performedAt,status:(n.status??"COMPLETED").toUpperCase()};n.athlete&&(t.athleteId=n.athlete),n.program&&(t.programId=n.program),n.durationMin!==void 0&&(t.durationMin=n.durationMin),n.totalLoad!==void 0&&(t.totalLoad=n.totalLoad),n.rpe!==void 0&&(t.rpe=n.rpe),n.notes&&(t.notes=n.notes),n.metrics&&(t.metrics=ot("metrics",n.metrics));let e=await u(K,{input:t});d(`Workout logged: ${e.athLogWorkout.title}`),a(n,e.athLogWorkout);}catch(t){s(t);}});}function dt(i){let r=i.command("metrics").description("AtheleteBridge performance metrics");r.command("list").description("List performance metrics for an athlete").requiredOption("--athlete <id>","Athlete ID").option("--type <t>","Filter by metric type").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(Y,{athleteId:n.athlete,type:n.type?n.type.toUpperCase():void 0});a(n,t.athPerformanceMetrics,{headers:["ID","Label","Type","Value","Unit","Recorded"],rows:t.athPerformanceMetrics.map(e=>[l(e.id,12),e.label,e.type,String(e.value),e.unit??"-",e.recordedAt])});}catch(t){s(t);}}),r.command("record").description("Record a performance metric").requiredOption("--label <s>","Metric label").requiredOption("--value <n>","Metric value",g).requiredOption("--recorded-at <iso>","Recorded at (ISO timestamp)").option("--athlete <id>","Athlete ID").option("--type <t>","Metric type","CUSTOM").option("--unit <s>","Unit").option("--source <s>","Source").option("-f, --format <format>","Output format").action(async n=>{try{let t={label:n.label,value:n.value,recordedAt:n.recordedAt,type:(n.type??"CUSTOM").toUpperCase()};n.athlete&&(t.athleteId=n.athlete),n.unit&&(t.unit=n.unit),n.source&&(t.source=n.source);let e=await u(X,{input:t});d(`Metric recorded: ${e.athRecordMetric.label}`),a(n,e.athRecordMetric);}catch(t){s(t);}});}function pt(i){let r=i.command("fixtures").description("AtheleteBridge fixtures");r.command("list").description("List fixtures").option("--team <id>","Filter by team ID").option("--status <s>","Filter by fixture status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(Q,{pagination:{limit:n.limit,offset:n.offset},status:n.status?n.status.toUpperCase():void 0,teamId:n.team});a(n,t.athListFixtures.items,{headers:["ID","Type","Status","Competition","Scheduled","Score"],rows:t.athListFixtures.items.map(e=>[l(e.id,12),e.type,e.status,e.competition??"-",e.scheduledAt,e.homeScore!==void 0&&e.homeScore!==null&&e.awayScore!==void 0&&e.awayScore!==null?`${e.homeScore}-${e.awayScore}`:"-"])});}catch(t){s(t);}}),r.command("get").description("Get a fixture by id").argument("<id>","Fixture ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(Z,{id:n});if(!e.athFixture)throw new p(`Fixture ${n} not found`);a(t,e.athFixture);}catch(e){s(e);}}),r.command("schedule").description("Schedule a fixture").requiredOption("--home-team <id>","Home team ID").requiredOption("--scheduled-at <iso>","Scheduled at (ISO timestamp)").option("--away-team <id>","Away team ID").option("--type <t>","Fixture type","FRIENDLY").option("--competition <s>","Competition").option("--round <s>","Round").option("--kickoff-at <iso>","Kickoff at (ISO timestamp)").option("--venue <s>","Venue").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async n=>{try{let t={homeTeamId:n.homeTeam,scheduledAt:n.scheduledAt,type:(n.type??"FRIENDLY").toUpperCase()};n.awayTeam&&(t.awayTeamId=n.awayTeam),n.competition&&(t.competition=n.competition),n.round&&(t.round=n.round),n.kickoffAt&&(t.kickoffAt=n.kickoffAt),n.venue&&(t.venue=n.venue),n.notes&&(t.notes=n.notes);let e=await u(tt,{input:t});d(`Fixture scheduled: ${e.athScheduleFixture.id}`),a(n,e.athScheduleFixture);}catch(t){s(t);}}),r.command("record-result").description("Record a final result for a fixture and recompute standings").argument("<id>","Fixture ID").requiredOption("--home-score <n>","Home score",c).requiredOption("--away-score <n>","Away score",c).option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(et,{id:n,input:{homeScore:t.homeScore,awayScore:t.awayScore}});d(`Result recorded: ${e.athRecordFixtureResult.homeScore??0}-${e.athRecordFixtureResult.awayScore??0}`),a(t,e.athRecordFixtureResult);}catch(e){s(e);}});}function mt(i){i.command("standings").description("AtheleteBridge standings").command("list").description("List standings for a competition").requiredOption("--competition <s>","Competition name").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(nt,{competition:n.competition});a(n,t.athStandings,{headers:["Rank","Team","P","W","D","L","Pts"],rows:t.athStandings.map(e=>[e.rank!==void 0&&e.rank!==null?String(e.rank):"-",l(e.teamId,12),String(e.played),String(e.won),String(e.drawn),String(e.lost),String(e.points)])});}catch(t){s(t);}});}function lt(i){i.command("health").description("AtheleteBridge service health check (public)").option("-f, --format <format>","Output format").action(async r=>{try{let n=await k(rt);d(n.athHealth),a(r,{health:n.athHealth});}catch(n){s(n);}});}var Et={id:"atheletebridge",version:"1.0.0",displayName:"AtheleteBridge",dependsOn:["auth","workspaces"],register(i,r){S(r);let n=i.command("atheletebridge").description("AtheleteBridge sports team & athlete management");it(n),st(n),at(n),ut(n),ct(n),dt(n),pt(n),mt(n),lt(n);}},ln=Et;module.exports=ln;
|
|
276
|
+
`;function ot(i,r){try{return JSON.parse(r)}catch{throw new p(`--${i} must be valid JSON`)}}function c(i){let r=Number.parseInt(i,10);if(Number.isNaN(r))throw new p(`Expected an integer but got "${i}"`);return r}function g(i){let r=Number.parseFloat(i);if(Number.isNaN(r))throw new p(`Expected a number but got "${i}"`);return r}function y(i){return i.split(",").map(r=>r.trim()).filter(r=>r.length>0)}function it(i){let r=i.command("teams").description("AtheleteBridge teams");r.command("list").description("List teams").option("--sport <s>","Filter by sport").option("--status <s>","Filter by team status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(T,{pagination:{limit:n.limit,offset:n.offset},sport:n.sport?n.sport.toUpperCase():void 0,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListTeams.items,{headers:["ID","Name","Sport","Status","Season"],rows:t.athListTeams.items.map(e=>[l(e.id,12),e.name,e.sport,e.status,e.season??"-"])});}catch(t){s(t);}}),r.command("get").description("Get a team by id").argument("<id>","Team ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(x,{id:n});if(!e.athTeam)throw new p(`Team ${n} not found`);a(t,e.athTeam);}catch(e){s(e);}}),r.command("create").description("Create a team").requiredOption("--name <name>","Team name").option("--description <s>","Description").option("--sport <s>","Sport","OTHER").option("--status <s>","Team status","FORMING").option("--season <s>","Season").option("--age-group <s>","Age group").option("--home-venue <s>","Home venue").option("--head-coach-id <id>","Head coach user ID").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async n=>{try{let t={name:n.name,sport:(n.sport??"OTHER").toUpperCase(),status:(n.status??"FORMING").toUpperCase()};n.description&&(t.description=n.description),n.season&&(t.season=n.season),n.ageGroup&&(t.ageGroup=n.ageGroup),n.homeVenue&&(t.homeVenue=n.homeVenue),n.headCoachId&&(t.headCoachId=n.headCoachId),n.tags&&(t.tags=y(n.tags));let e=await u(E,{input:t});d(`Team created: ${e.athCreateTeam.name}`),a(n,e.athCreateTeam);}catch(t){s(t);}}),r.command("update").description("Update a team").argument("<id>","Team ID").option("--name <name>","Team name").option("--description <s>","Description").option("--sport <s>","Sport").option("--status <s>","Team status").option("--season <s>","Season").option("--age-group <s>","Age group").option("--home-venue <s>","Home venue").option("--head-coach-id <id>","Head coach user ID").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};if(t.name&&(e.name=t.name),t.description!==void 0&&(e.description=t.description),t.sport&&(e.sport=t.sport.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.season&&(e.season=t.season),t.ageGroup&&(e.ageGroup=t.ageGroup),t.homeVenue&&(e.homeVenue=t.homeVenue),t.headCoachId&&(e.headCoachId=t.headCoachId),t.tags&&(e.tags=y(t.tags)),!Object.keys(e).length)throw new p("No updates specified");let o=await u(v,{id:n,input:e});d("Team updated"),a(t,o.athUpdateTeam);}catch(e){s(e);}}),r.command("archive").description("Archive a team").argument("<id>","Team ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(R,{id:n});d(e.athArchiveTeam?`Team ${n} archived`:`Team ${n} not archived`),a(t,{archived:e.athArchiveTeam});}catch(e){s(e);}});}function st(i){let r=i.command("members").description("AtheleteBridge team members");r.command("list").description("List members of a team").requiredOption("--team <id>","Team ID").option("--status <s>","Filter by member status").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(O,{teamId:n.team,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListMembers,{headers:["ID","Name","Role","Status","Jersey","Position"],rows:t.athListMembers.map(e=>[l(e.id,12),e.displayName,e.role,e.status,e.jerseyNumber!==void 0&&e.jerseyNumber!==null?String(e.jerseyNumber):"-",e.position??"-"])});}catch(t){s(t);}}),r.command("add").description("Add a member to a team").requiredOption("--team <id>","Team ID").requiredOption("--user <id>","User ID").requiredOption("--display-name <name>","Display name").option("--role <r>","Member role","PLAYER").option("--status <s>","Member status","ACTIVE").option("--jersey-number <n>","Jersey number",c).option("--position <s>","Position").option("--dominant-side <s>","Dominant side").option("--height <n>","Height",g).option("--weight <n>","Weight",g).option("--joined-at <iso>","Joined at (ISO timestamp)").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async n=>{try{let t={teamId:n.team,userId:n.user,displayName:n.displayName,role:(n.role??"PLAYER").toUpperCase(),status:(n.status??"ACTIVE").toUpperCase()};n.jerseyNumber!==void 0&&(t.jerseyNumber=n.jerseyNumber),n.position&&(t.position=n.position),n.dominantSide&&(t.dominantSide=n.dominantSide),n.height!==void 0&&(t.height=n.height),n.weight!==void 0&&(t.weight=n.weight),n.joinedAt&&(t.joinedAt=n.joinedAt),n.notes&&(t.notes=n.notes);let e=await u(D,{input:t});d(`Member added: ${e.athAddMember.displayName}`),a(n,e.athAddMember);}catch(t){s(t);}}),r.command("update").description("Update a team member").argument("<id>","Member ID").option("--display-name <name>","Display name").option("--role <r>","Member role").option("--status <s>","Member status").option("--jersey-number <n>","Jersey number",c).option("--position <s>","Position").option("--dominant-side <s>","Dominant side").option("--height <n>","Height",g).option("--weight <n>","Weight",g).option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};if(t.displayName&&(e.displayName=t.displayName),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.jerseyNumber!==void 0&&(e.jerseyNumber=t.jerseyNumber),t.position&&(e.position=t.position),t.dominantSide&&(e.dominantSide=t.dominantSide),t.height!==void 0&&(e.height=t.height),t.weight!==void 0&&(e.weight=t.weight),t.notes!==void 0&&(e.notes=t.notes),!Object.keys(e).length)throw new p("No updates specified");let o=await u($,{id:n,input:e});d("Member updated"),a(t,o.athUpdateMember);}catch(e){s(e);}}),r.command("remove").description("Remove a team member").argument("<id>","Member ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(L,{id:n});d(e.athRemoveMember?`Member ${n} removed`:`Member ${n} not removed`),a(t,{removed:e.athRemoveMember});}catch(e){s(e);}});}function at(i){let r=i.command("programs").description("AtheleteBridge training programs");r.command("list").description("List training programs").option("--level <l>","Filter by program level").option("--sport <s>","Filter by sport").option("--status <s>","Filter by program status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let e=await u(P,{pagination:{limit:t.limit,offset:t.offset},level:t.level?t.level.toUpperCase():void 0,sport:t.sport?t.sport.toUpperCase():void 0,status:t.status?t.status.toUpperCase():void 0});a(t,e.athListPrograms.items,{headers:["ID","Name","Sport","Level","Status","Weeks"],rows:e.athListPrograms.items.map(o=>[l(o.id,12),o.name,o.sport,o.level,o.status,o.weeks!==void 0&&o.weeks!==null?String(o.weeks):"-"])});}catch(e){s(e);}}),r.command("get").description("Get a training program by id").argument("<id>","Program ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(M,{id:t});if(!o.athProgram)throw new p(`Program ${t} not found`);a(e,o.athProgram);}catch(o){s(o);}}),r.command("create").description("Create a training program").requiredOption("--name <name>","Program name").option("--summary <s>","Summary").option("--sport <s>","Sport","OTHER").option("--level <l>","Level","BEGINNER").option("--weeks <n>","Number of weeks",c).option("--template","Mark as a template").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async t=>{try{let e={name:t.name,sport:(t.sport??"OTHER").toUpperCase(),level:(t.level??"BEGINNER").toUpperCase(),isTemplate:!!t.template};t.summary&&(e.summary=t.summary),t.weeks!==void 0&&(e.weeks=t.weeks),t.tags&&(e.tags=y(t.tags));let o=await u(N,{input:e});d(`Program created: ${o.athCreateProgram.name}`),a(t,o.athCreateProgram);}catch(e){s(e);}}),r.command("update").description("Update a training program").argument("<id>","Program ID").option("--name <name>","Program name").option("--summary <s>","Summary").option("--sport <s>","Sport").option("--level <l>","Level").option("--weeks <n>","Number of weeks",c).option("--template <bool>","Template flag (true|false)").option("--tags <csv>","Comma-separated tags").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.summary!==void 0&&(o.summary=e.summary),e.sport&&(o.sport=e.sport.toUpperCase()),e.level&&(o.level=e.level.toUpperCase()),e.weeks!==void 0&&(o.weeks=e.weeks),e.template!==void 0&&(o.isTemplate=e.template==="true"),e.tags&&(o.tags=y(e.tags)),!Object.keys(o).length)throw new p("No updates specified");let gt=await u(_,{id:t,input:o});d("Program updated"),a(e,gt.athUpdateProgram);}catch(o){s(o);}}),r.command("transition").description("Advance a program through its publish lifecycle (DRAFT -> PUBLISHED -> ARCHIVED)").argument("<id>","Program ID").requiredOption("--status <s>","Target status: DRAFT|PUBLISHED|ARCHIVED").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(F,{id:t,status:e.status.toUpperCase()});d(`Program transitioned to ${o.athTransitionProgram.status}`),a(e,o.athTransitionProgram);}catch(o){s(o);}}),r.command("archive").description("Archive a training program").argument("<id>","Program ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(U,{id:t});d(o.athArchiveProgram?`Program ${t} archived`:`Program ${t} not archived`),a(e,{archived:o.athArchiveProgram});}catch(o){s(o);}});let n=r.command("drills").description("AtheleteBridge program drills");n.command("add").description("Add a drill to a program").requiredOption("--program <id>","Program ID").requiredOption("--name <name>","Drill name").option("--description <s>","Description").option("--week-number <n>","Week number",c,1).option("--order-index <n>","Order index",c,0).option("--sets <n>","Sets",c).option("--reps <n>","Reps",c).option("--duration-sec <n>","Duration (seconds)",c).option("--rest-sec <n>","Rest (seconds)",c).option("--video-file-id <id>","Video file ID (wspace-files-svc)").option("-f, --format <format>","Output format").action(async t=>{try{let e={programId:t.program,name:t.name,weekNumber:t.weekNumber??1,orderIndex:t.orderIndex??0};t.description&&(e.description=t.description),t.sets!==void 0&&(e.sets=t.sets),t.reps!==void 0&&(e.reps=t.reps),t.durationSec!==void 0&&(e.durationSec=t.durationSec),t.restSec!==void 0&&(e.restSec=t.restSec),t.videoFileId&&(e.videoFileId=t.videoFileId);let o=await u(q,{input:e});d(`Drill added: ${o.athAddDrill.name}`),a(t,o.athAddDrill);}catch(e){s(e);}}),n.command("remove").description("Remove a drill").argument("<id>","Drill ID").option("-f, --format <format>","Output format").action(async(t,e)=>{try{let o=await u(G,{id:t});d(o.athRemoveDrill?`Drill ${t} removed`:`Drill ${t} not removed`),a(e,{removed:o.athRemoveDrill});}catch(o){s(o);}});}function ut(i){let r=i.command("sessions").description("AtheleteBridge coaching sessions");r.command("list").description("List sessions").option("--athlete <id>","Filter by athlete ID").option("--coach <id>","Filter by coach ID").option("--status <s>","Filter by session status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(W,{pagination:{limit:n.limit,offset:n.offset},athleteId:n.athlete,coachId:n.coach,status:n.status?n.status.toUpperCase():void 0});a(n,t.athListSessions.items,{headers:["ID","Title","Type","Status","Scheduled"],rows:t.athListSessions.items.map(e=>[l(e.id,12),e.title,e.type,e.status,e.scheduledAt])});}catch(t){s(t);}}),r.command("get").description("Get a session by id").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(j,{id:n});if(!e.athSession)throw new p(`Session ${n} not found`);a(t,e.athSession);}catch(e){s(e);}}),r.command("book").description("Book a coaching session").requiredOption("--athlete <id>","Athlete ID").requiredOption("--coach <id>","Coach ID").requiredOption("--title <s>","Session title").requiredOption("--scheduled-at <iso>","Scheduled at (ISO timestamp)").option("--type <t>","Session type","IN_PERSON").option("--duration-min <n>","Duration (minutes)",c).option("--location <s>","Location").option("--meeting-url <url>","Meeting URL").option("--program <id>","Program ID").option("-f, --format <format>","Output format").action(async n=>{try{let t={athleteId:n.athlete,coachId:n.coach,title:n.title,scheduledAt:n.scheduledAt,type:(n.type??"IN_PERSON").toUpperCase()};n.durationMin!==void 0&&(t.durationMin=n.durationMin),n.location&&(t.location=n.location),n.meetingUrl&&(t.meetingUrl=n.meetingUrl),n.program&&(t.programId=n.program);let e=await u(H,{input:t});d(`Session booked: ${e.athBookSession.title}`),a(n,e.athBookSession);}catch(t){s(t);}}),r.command("confirm").description("Confirm a requested session").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(B,{id:n});d(`Session confirmed: ${e.athConfirmSession.status}`),a(t,e.athConfirmSession);}catch(e){s(e);}}),r.command("cancel").description("Cancel a session").argument("<id>","Session ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(V,{id:n});d(`Session cancelled: ${e.athCancelSession.status}`),a(t,e.athCancelSession);}catch(e){s(e);}}),r.command("complete").description("Complete a session (optionally with rating and feedback)").argument("<id>","Session ID").option("--rating <n>","Rating",c).option("--feedback <s>","Feedback").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e={};t.rating!==void 0&&(e.rating=t.rating),t.feedback&&(e.feedback=t.feedback);let o=await u(z,{id:n,input:Object.keys(e).length?e:void 0});d(`Session completed: ${o.athCompleteSession.status}`),a(t,o.athCompleteSession);}catch(e){s(e);}});}function ct(i){let r=i.command("workouts").description("AtheleteBridge workout logs");r.command("list").description("List workout logs").option("--athlete <id>","Filter by athlete ID").option("--program <id>","Filter by program ID").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(J,{pagination:{limit:n.limit,offset:n.offset},athleteId:n.athlete,programId:n.program});a(n,t.athListWorkoutLogs.items,{headers:["ID","Title","Status","Performed","Load","RPE"],rows:t.athListWorkoutLogs.items.map(e=>[l(e.id,12),e.title,e.status,e.performedAt,e.totalLoad!==void 0&&e.totalLoad!==null?String(e.totalLoad):"-",e.rpe!==void 0&&e.rpe!==null?String(e.rpe):"-"])});}catch(t){s(t);}}),r.command("log").description("Log a workout").requiredOption("--title <s>","Workout title").requiredOption("--performed-at <iso>","Performed at (ISO timestamp)").option("--athlete <id>","Athlete ID").option("--program <id>","Program ID").option("--status <s>","Workout status","COMPLETED").option("--duration-min <n>","Duration (minutes)",c).option("--total-load <n>","Total load",g).option("--rpe <n>","Rate of perceived exertion",c).option("--notes <s>","Notes").option("--metrics <json>","Metrics JSON object").option("-f, --format <format>","Output format").action(async n=>{try{let t={title:n.title,performedAt:n.performedAt,status:(n.status??"COMPLETED").toUpperCase()};n.athlete&&(t.athleteId=n.athlete),n.program&&(t.programId=n.program),n.durationMin!==void 0&&(t.durationMin=n.durationMin),n.totalLoad!==void 0&&(t.totalLoad=n.totalLoad),n.rpe!==void 0&&(t.rpe=n.rpe),n.notes&&(t.notes=n.notes),n.metrics&&(t.metrics=ot("metrics",n.metrics));let e=await u(K,{input:t});d(`Workout logged: ${e.athLogWorkout.title}`),a(n,e.athLogWorkout);}catch(t){s(t);}});}function dt(i){let r=i.command("metrics").description("AtheleteBridge performance metrics");r.command("list").description("List performance metrics for an athlete").requiredOption("--athlete <id>","Athlete ID").option("--type <t>","Filter by metric type").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(Y,{athleteId:n.athlete,type:n.type?n.type.toUpperCase():void 0});a(n,t.athPerformanceMetrics,{headers:["ID","Label","Type","Value","Unit","Recorded"],rows:t.athPerformanceMetrics.map(e=>[l(e.id,12),e.label,e.type,String(e.value),e.unit??"-",e.recordedAt])});}catch(t){s(t);}}),r.command("record").description("Record a performance metric").requiredOption("--label <s>","Metric label").requiredOption("--value <n>","Metric value",g).requiredOption("--recorded-at <iso>","Recorded at (ISO timestamp)").option("--athlete <id>","Athlete ID").option("--type <t>","Metric type","CUSTOM").option("--unit <s>","Unit").option("--source <s>","Source").option("-f, --format <format>","Output format").action(async n=>{try{let t={label:n.label,value:n.value,recordedAt:n.recordedAt,type:(n.type??"CUSTOM").toUpperCase()};n.athlete&&(t.athleteId=n.athlete),n.unit&&(t.unit=n.unit),n.source&&(t.source=n.source);let e=await u(X,{input:t});d(`Metric recorded: ${e.athRecordMetric.label}`),a(n,e.athRecordMetric);}catch(t){s(t);}});}function pt(i){let r=i.command("fixtures").description("AtheleteBridge fixtures");r.command("list").description("List fixtures").option("--team <id>","Filter by team ID").option("--status <s>","Filter by fixture status").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(Q,{pagination:{limit:n.limit,offset:n.offset},status:n.status?n.status.toUpperCase():void 0,teamId:n.team});a(n,t.athListFixtures.items,{headers:["ID","Type","Status","Competition","Scheduled","Score"],rows:t.athListFixtures.items.map(e=>[l(e.id,12),e.type,e.status,e.competition??"-",e.scheduledAt,e.homeScore!==void 0&&e.homeScore!==null&&e.awayScore!==void 0&&e.awayScore!==null?`${e.homeScore}-${e.awayScore}`:"-"])});}catch(t){s(t);}}),r.command("get").description("Get a fixture by id").argument("<id>","Fixture ID").option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(Z,{id:n});if(!e.athFixture)throw new p(`Fixture ${n} not found`);a(t,e.athFixture);}catch(e){s(e);}}),r.command("schedule").description("Schedule a fixture").requiredOption("--home-team <id>","Home team ID").requiredOption("--scheduled-at <iso>","Scheduled at (ISO timestamp)").option("--away-team <id>","Away team ID").option("--type <t>","Fixture type","FRIENDLY").option("--competition <s>","Competition").option("--round <s>","Round").option("--kickoff-at <iso>","Kickoff at (ISO timestamp)").option("--venue <s>","Venue").option("--notes <s>","Notes").option("-f, --format <format>","Output format").action(async n=>{try{let t={homeTeamId:n.homeTeam,scheduledAt:n.scheduledAt,type:(n.type??"FRIENDLY").toUpperCase()};n.awayTeam&&(t.awayTeamId=n.awayTeam),n.competition&&(t.competition=n.competition),n.round&&(t.round=n.round),n.kickoffAt&&(t.kickoffAt=n.kickoffAt),n.venue&&(t.venue=n.venue),n.notes&&(t.notes=n.notes);let e=await u(tt,{input:t});d(`Fixture scheduled: ${e.athScheduleFixture.id}`),a(n,e.athScheduleFixture);}catch(t){s(t);}}),r.command("record-result").description("Record a final result for a fixture and recompute standings").argument("<id>","Fixture ID").requiredOption("--home-score <n>","Home score",c).requiredOption("--away-score <n>","Away score",c).option("-f, --format <format>","Output format").action(async(n,t)=>{try{let e=await u(et,{id:n,input:{homeScore:t.homeScore,awayScore:t.awayScore}});d(`Result recorded: ${e.athRecordFixtureResult.homeScore??0}-${e.athRecordFixtureResult.awayScore??0}`),a(t,e.athRecordFixtureResult);}catch(e){s(e);}});}function mt(i){i.command("standings").description("AtheleteBridge standings").command("list").description("List standings for a competition").requiredOption("--competition <s>","Competition name").option("-f, --format <format>","Output format").action(async n=>{try{let t=await u(nt,{competition:n.competition});a(n,t.athStandings,{headers:["Rank","Team","P","W","D","L","Pts"],rows:t.athStandings.map(e=>[e.rank!==void 0&&e.rank!==null?String(e.rank):"-",l(e.teamId,12),String(e.played),String(e.won),String(e.drawn),String(e.lost),String(e.points)])});}catch(t){s(t);}});}function lt(i){i.command("health").description("AtheleteBridge service health check (public)").option("-f, --format <format>","Output format").action(async r=>{try{let n=await k(rt);d(n.athHealth),a(r,{health:n.athHealth});}catch(n){s(n);}});}var Et={id:"atheletebridge",version:"1.0.0",displayName:"AtheleteBridge",dependsOn:["auth","workspaces"],register(i,r){S(r);let n=i.command("atheletebridge").description("AtheleteBridge sports team & athlete management");it(n),st(n),at(n),ut(n),ct(n),dt(n),pt(n),mt(n),lt(n);}},ln=Et;module.exports=ln;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,b as b$1,h,p,g,i,d}from'../../chunk-
|
|
1
|
+
import {a,b as b$1,h,p,g,i,d}from'../../chunk-NLEVVDXR.js';import {o}from'../../chunk-IZXPWPKX.js';var y=`
|
|
2
2
|
query AthListTeams(
|
|
3
3
|
$pagination: PaginationInput
|
|
4
4
|
$sport: AthSport
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
'use strict';require('graphql-request');var
|
|
1
|
+
'use strict';require('graphql-request');var z=require('cross-fetch');require('commander');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var z__default=/*#__PURE__*/_interopDefault(z);async function it(n){let s=`${n.oidcIssuer}/oidc/device/code`,i=new URLSearchParams({client_id:n.clientId,scope:"openid profile email offline_access"}),r=await z__default.default(s,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString()});if(!r.ok){let p=await r.text().catch(()=>"Unknown error");throw new Error(`Device code request failed (${r.status}): ${p}`)}let a=await r.json();return {deviceCode:a.device_code,userCode:a.user_code,verificationUri:a.verification_uri,verificationUriComplete:a.verification_uri_complete??null,expiresIn:a.expires_in,interval:a.interval??5}}async function rt(n,s,i){let r=`${i.oidcIssuer}/oauth/device/token`,a=s;for(;;){await new Promise(m=>setTimeout(m,a*1e3));let p=await z__default.default(r,{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:n,client_id:i.clientId}).toString()}),c=await p.json();if(p.ok&&c.access_token)return {accessToken:c.access_token,refreshToken:c.refresh_token??"",expiresIn:c.expires_in??3600};let u=c.error;switch(u){case "authorization_pending":continue;case "slow_down":a+=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: ${c.error_description??u??"Unknown error"}`)}}}async function G(n,s,i,r){let p=await z__default.default(n,{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
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
`,variables:{input:{clientId:s,clientSecret:i,scopes:r}}})});if(!p.ok){let u=await p.text().catch(()=>"Unknown error");throw new Error(`App authentication failed (${p.status}): ${u}`)}let c=await p.json();if(c.errors?.length)throw new Error(`App authentication failed: ${c.errors[0]?.message??"unknown error"}`);if(!c.data?.authenticateApp?.accessToken)throw new Error("App authentication failed: no access token returned");return c.data.authenticateApp}async function v(n,s,i,r){let p=await
|
|
7
|
+
`,variables:{input:{clientId:s,clientSecret:i,scopes:r}}})});if(!p.ok){let u=await p.text().catch(()=>"Unknown error");throw new Error(`App authentication failed (${p.status}): ${u}`)}let c=await p.json();if(c.errors?.length)throw new Error(`App authentication failed: ${c.errors[0]?.message??"unknown error"}`);if(!c.data?.authenticateApp?.accessToken)throw new Error("App authentication failed: no access token returned");return c.data.authenticateApp}async function v(n,s,i,r){let p=await z__default.default(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({query:`
|
|
8
8
|
mutation IssueWorkspaceToken($input: IssueWorkspaceTokenInput!) {
|
|
9
9
|
issueWorkspaceToken(input: $input) {
|
|
10
10
|
success token expiresAt scopes
|
|
11
11
|
error { code message }
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
`,variables:{input:{workspaceId:i,organizationId:r}}})});if(!p.ok){let m=await p.text().catch(()=>"Unknown error");throw new Error(`Workspace token request failed (${p.status}): ${m}`)}let c=await p.json();if(c.errors?.length)throw new Error(`Workspace token failed: ${c.errors[0]?.message??"unknown error"}`);let u=c.data?.issueWorkspaceToken;if(!u?.success||!u.token){let m=u?.error?.message??"Unknown error";throw new Error(`Workspace token failed: ${m}`)}return {token:u.token,expiresAt:u.expiresAt??"",scopes:u.scopes??[]}}async function
|
|
14
|
+
`,variables:{input:{workspaceId:i,organizationId:r}}})});if(!p.ok){let m=await p.text().catch(()=>"Unknown error");throw new Error(`Workspace token request failed (${p.status}): ${m}`)}let c=await p.json();if(c.errors?.length)throw new Error(`Workspace token failed: ${c.errors[0]?.message??"unknown error"}`);let u=c.data?.issueWorkspaceToken;if(!u?.success||!u.token){let m=u?.error?.message??"Unknown error";throw new Error(`Workspace token failed: ${m}`)}return {token:u.token,expiresAt:u.expiresAt??"",scopes:u.scopes??[]}}async function j(n,s){let r=await z__default.default(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({query:`
|
|
15
15
|
query MyWorkspaces($limit: Int) {
|
|
16
16
|
myWorkspaces(limit: $limit) {
|
|
17
17
|
items { id name slug tenantId organizationId }
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,variables:{limit:50}})});if(!r.ok){let p=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${r.status}): ${p}`)}let a=await r.json();if(a.errors?.length)throw new Error(`Failed to fetch workspaces: ${a.errors[0]?.message??"unknown error"}`);return a.data?.myWorkspaces?.items??[]}function
|
|
20
|
+
`,variables:{limit:50}})});if(!r.ok){let p=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to fetch workspaces (${r.status}): ${p}`)}let a=await r.json();if(a.errors?.length)throw new Error(`Failed to fetch workspaces: ${a.errors[0]?.message??"unknown error"}`);return a.data?.myWorkspaces?.items??[]}function Ae(n){try{let s=new URL(n);return s.protocol==="http:"||s.protocol==="https:"}catch{return false}}async function st(n){try{if(!Ae(n))return !1;let{execFile:s}=await import('child_process'),i=process.platform,r,a;return i==="darwin"?(r="open",a=[n]):i==="win32"?(r="cmd",a=["/c","start","",n]):(r="xdg-open",a=[n]),new Promise(p=>{s(r,a,c=>{p(!c);});})}catch{return false}}var T=class extends Error{exitCode;hint;constructor(s,i){super(s),this.name="CliUserError",this.exitCode=i?.exitCode??1,this.hint=i?.hint;}};var k=class extends Error{cause;constructor(s,i){super(s),this.name="CliInternalError",this.cause=i;}};var Et=null;function _t(n){Et=n;}function S(){if(!Et)throw new k("vibecontrols module helpers used before setHelpersContext was called");return Et}async function l(n,s){return S().gql.global.request(n,s)}async function Tt(n,s){return S().gql.global.request(n,s)}function b(){S().gql.reset();}function d(n){let s=n instanceof Error?n.message:String(n);throw new T(s)}function g(n,s,i){S().output.formatAndOutput(n,s,i);}function I(n){S().output.printSuccess(n);}function x(n){S().output.printInfo(n);}function R(n){S().output.printWarning(n);}function X(n){S().output.printJson(n);}function J(n){return S().output.formatStatus(n)}function h(n){return S().output.formatDate(n)}function q(n,s){return S().output.truncate(n,s)}function F(){return S()}function M(){return S().auth.read()}function N(n){S().auth.write(n);}function kt(){S().auth.clear();}function B(){return S().config.read()}function bt(){return S().config.resolveOIDC()}function ht(n){return n?n.expiresAt?Date.now()>=n.expiresAt:false:S().auth.isTokenExpired()}var Pt="mutation { signOut }",Lt=`
|
|
21
21
|
mutation RefreshToken($token: String!) {
|
|
22
22
|
refreshToken(token: $token) { accessToken refreshToken expiresIn }
|
|
23
23
|
}
|
|
24
|
-
`;function
|
|
25
|
-
Available workspaces:`),t.forEach((
|
|
26
|
-
Select workspace [1-${t.length}]:
|
|
24
|
+
`;function Yt(n){let s=n.command("auth").description("Authentication commands");s.command("login").description(`Authenticate with ${F().productName}`).option("--client-credentials","Authenticate as an app with client ID and secret").option("--workspace-id <id>","Workspace ID (for app auth)").action(async i=>{try{i.clientCredentials?await Ne(i.workspaceId):await Oe();}catch(r){d(r);}}),s.command("logout").description("Revoke tokens and clear stored auth").action(async()=>{try{if(M()?.accessToken)try{await Tt(Pt);}catch{R("Server-side logout failed, clearing local tokens");}kt(),b(),I("Logged out successfully");}catch(i){d(i);}}),s.command("status").description("Show current auth state").option("-f, --format <format>","Output format (json, table)").action(i=>{let r=M(),a=B(),p=!!r?.accessToken,c=r?.accessToken?ht(r):false,u=r?.expiresAt?h(new Date(r.expiresAt).toISOString()):"-",m=r?.authMethod==="client_credentials"?"Client Credentials":"OAuth2 Device Code",t=r?.workspaceTokenExpiresAt?h(new Date(r.workspaceTokenExpiresAt).toISOString()):"-";g(i,{authenticated:p,method:m,expired:c,expiresAt:u,workspaceId:r?.workspaceId??"-",organizationId:r?.organizationId??"-",workspaceTokenExpiresAt:t,workspaceEndpoint:a.workspaceEndpoint,globalEndpoint:a.globalEndpoint},{headers:["Key","Value"],rows:[["Authenticated",String(p)],["Method",m],["Expired",String(c)],["Expires At",u],["Workspace ID",r?.workspaceId??"-"],["Organization ID",r?.organizationId??"-"],["Workspace Token Expires",t],["Workspace Endpoint",a.workspaceEndpoint],["Global Endpoint",a.globalEndpoint]]});}),s.command("token").description("Print access token to stdout").option("--workspace","Print workspace token instead").action(i=>{let r=M();if(i.workspace){if(!r?.workspaceToken)throw new T(`No workspace token. Set a workspace: ${F().productName} workspace set <id>`);process.stdout.write(r.workspaceToken);return}if(!r?.accessToken)throw new T(`Not authenticated. Run: ${F().productName} auth login`);process.stdout.write(r.accessToken);}),s.command("refresh").description("Force token refresh").action(async()=>{try{let i=M();if(!i?.refreshToken&&i?.authMethod!=="client_credentials")throw new T(`No refresh token available. Run: ${F().productName} auth login`);if(i?.authMethod==="client_credentials"&&i.clientId&&i.clientSecret){let p=B(),c=await G(p.globalEndpoint,i.clientId,i.clientSecret);N({...i,accessToken:c.accessToken,expiresAt:Date.now()+c.expiresIn*1e3}),b(),I("App token refreshed successfully"),i.workspaceId&&i.organizationId&&await Wt();return}let a=(await Tt(Lt,{token:i.refreshToken})).refreshToken;N({...i,accessToken:a.accessToken,refreshToken:a.refreshToken,expiresAt:Date.now()+a.expiresIn*1e3}),b(),I("Token refreshed successfully"),i.workspaceId&&i.organizationId&&await Wt();}catch(i){d(i);}});}async function Wt(){let n=M();if(!n?.accessToken||!n.workspaceId||!n.organizationId)return;let s=B();try{let i=await v(s.workspaceEndpoint,n.accessToken,n.workspaceId,n.organizationId);N({...n,workspaceToken:i.token,workspaceTokenExpiresAt:new Date(i.expiresAt).getTime()}),b(),I("Workspace token refreshed");}catch{R("Workspace token refresh failed \u2014 workspace operations may require re-login");}}async function Oe(){let n=B(),{oidcIssuer:s,clientId:i}=bt(),r={...n,oidcIssuer:s,clientId:i};x("Starting device code authentication...");let a=await it(r);console.log(""),console.log(` Open: ${a.verificationUri}`),console.log(` Code: ${a.userCode}`),console.log(""),await st(a.verificationUriComplete??a.verificationUri)?x("Browser opened"):R("Could not open browser \u2014 open the URL manually"),x("Waiting for authorization...");let c=await rt(a.deviceCode,a.interval,r),u=c.accessToken,m=Date.now()+c.expiresIn*1e3;x("Fetching workspaces...");try{let t=await j(n.globalEndpoint,u);if(t.length===0){N({accessToken:u,refreshToken:c.refreshToken,expiresAt:m,authMethod:"device_code"}),b(),I("Authentication successful (no workspaces found)");return}let e=t[0];if(t.length>1){console.log(`
|
|
25
|
+
Available workspaces:`),t.forEach((ot,St)=>console.log(` ${St+1}. ${ot.name} (${ot.slug})`));let A=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),E=await new Promise(ot=>{A.question(`
|
|
26
|
+
Select workspace [1-${t.length}]: `,St=>{A.close(),ot(St.trim());});}),O=parseInt(E,10)-1;O>=0&&O<t.length&&(e=t[O]);}x(`Using workspace: ${e.name} (${e.id})`);let o=await v(n.workspaceEndpoint,u,e.id,e.organizationId);N({accessToken:u,refreshToken:c.refreshToken,expiresAt:m,workspaceToken:o.token,workspaceTokenExpiresAt:new Date(o.expiresAt).getTime(),workspaceId:e.id,organizationId:e.organizationId,authMethod:"device_code"}),b(),I("Authentication successful");}catch(t){N({accessToken:u,refreshToken:c.refreshToken,expiresAt:m,authMethod:"device_code"}),b(),I("Authentication successful"),R(`Workspace token not obtained: ${t instanceof Error?t.message:String(t)}`),x(`Set workspace manually: ${F().productName} workspace set <id>`);}}async function Ne(n){let s=B(),r=(await import('readline')).createInterface({input:process.stdin,output:process.stdout}),a=await new Promise(A=>{r.question("Client ID: ",E=>A(E.trim()));}),p=await new Promise(A=>{r.question("Client Secret: ",E=>{r.close(),A(E.trim());});});if(!a||!p)throw new T("Client ID and secret cannot be empty");x("Authenticating app...");let c=await G(s.globalEndpoint,a,p),u=c.accessToken,m=Date.now()+c.expiresIn*1e3,t,e,o=n,$;if(o)try{let E=(await j(s.globalEndpoint,u)).find(O=>O.id===o);if(E){$=E.organizationId;let O=await v(s.workspaceEndpoint,u,o,$);t=O.token,e=new Date(O.expiresAt).getTime(),x(`Workspace token issued for: ${E.name}`);}else R(`Workspace ${o} not found \u2014 skipping workspace token`),o=void 0;}catch(A){R(`Workspace token failed: ${A instanceof Error?A.message:String(A)}`);}N({accessToken:u,refreshToken:"",expiresAt:m,workspaceToken:t,workspaceTokenExpiresAt:e,workspaceId:o,organizationId:$,authMethod:"client_credentials",clientId:a,clientSecret:p}),b(),I("App authentication successful");}var zt=`
|
|
27
27
|
query currentUser {
|
|
28
28
|
currentUser {
|
|
29
29
|
id email firstName lastName username phoneNumber name
|
|
30
30
|
emailVerified mfaEnabled isAdmin role status createdAt lastLoginAt
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,jt=`
|
|
34
34
|
mutation updateCurrentUserProfile($input: UpdateUserInput!) {
|
|
35
35
|
updateCurrentUserProfile(input: $input) {
|
|
36
36
|
id name firstName lastName username phoneNumber timezone language
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`,
|
|
39
|
+
`,yt=`
|
|
40
40
|
query authAuditLogs($pagination: PaginationInput) {
|
|
41
41
|
authAuditLogs(pagination: $pagination) {
|
|
42
42
|
id action resource resourceType resourceId description
|
|
43
43
|
ipAddress userAgent metadata createdAt
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
`,
|
|
46
|
+
`,Xt=`
|
|
47
47
|
query activeSessions($pagination: PaginationInput) {
|
|
48
48
|
activeSessions(pagination: $pagination) {
|
|
49
49
|
id status ipAddress userAgent location lastActivityAt expiresAt createdAt isCurrent
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
`,
|
|
52
|
+
`,Jt=`
|
|
53
53
|
query currentUserMFAMethods($pagination: PaginationInput) {
|
|
54
54
|
currentUserMFAMethods(pagination: $pagination) {
|
|
55
55
|
id method status createdAt updatedAt
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
`,
|
|
58
|
+
`,Qt=`
|
|
59
59
|
mutation setupMFA($method: MFAMethod!) {
|
|
60
60
|
setupMFA(method: $method) {
|
|
61
61
|
method backupCodes qrCode secret
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`;var
|
|
64
|
+
`;var Zt=`
|
|
65
65
|
mutation enableMFA($code: String!) {
|
|
66
66
|
enableMFA(code: $code)
|
|
67
67
|
}
|
|
68
|
-
`,
|
|
68
|
+
`,te=`
|
|
69
69
|
mutation disableMFA {
|
|
70
70
|
disableMFA
|
|
71
71
|
}
|
|
72
|
-
`,
|
|
72
|
+
`,ee=`
|
|
73
73
|
query myApiKeys($pagination: PaginationInput) {
|
|
74
74
|
myApiKeys(pagination: $pagination) {
|
|
75
75
|
id name prefix appId appName scopes expiresAt lastUsedAt createdAt
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
78
|
+
`,ne=`
|
|
79
79
|
query appApiKeys($appId: ID!, $pagination: PaginationInput) {
|
|
80
80
|
appApiKeys(appId: $appId, pagination: $pagination) {
|
|
81
81
|
id name prefix appId appName scopes expiresAt lastUsedAt createdAt
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
`,
|
|
84
|
+
`,oe=`
|
|
85
85
|
mutation generateAPIKey($input: GenerateAPIKeyInput!) {
|
|
86
86
|
generateAPIKey(input: $input) {
|
|
87
87
|
keyId apiKey apiSecret
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`;var
|
|
90
|
+
`;var ie=`
|
|
91
91
|
mutation revokeAPIKey($keyId: String!) {
|
|
92
92
|
revokeAPIKey(keyId: $keyId)
|
|
93
93
|
}
|
|
94
|
-
`,
|
|
94
|
+
`,re=`
|
|
95
95
|
mutation rotateAPIKey($keyId: String!) {
|
|
96
96
|
rotateAPIKey(keyId: $keyId) {
|
|
97
97
|
apiSecret
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
`,
|
|
100
|
+
`,se=`
|
|
101
101
|
query currentUserDelegations($pagination: PaginationInput) {
|
|
102
102
|
currentUserDelegations(pagination: $pagination) {
|
|
103
103
|
id appId userId grantedBy grantedAt expiresAt scopes workspaceIds
|
|
@@ -105,79 +105,79 @@ Select workspace [1-${t.length}]: `,$t=>{A.close(),nt($t.trim());});}),O=parseIn
|
|
|
105
105
|
app { id name }
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
`,
|
|
108
|
+
`,ae=`
|
|
109
109
|
mutation grantDelegation($input: GrantDelegationInput!) {
|
|
110
110
|
grantDelegation(input: $input) {
|
|
111
111
|
id appId userId grantedBy grantedAt expiresAt scopes workspaceIds status
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
`,
|
|
114
|
+
`,ce=`
|
|
115
115
|
mutation revokeDelegation($id: ID!, $reason: String) {
|
|
116
116
|
revokeDelegation(id: $id, reason: $reason)
|
|
117
117
|
}
|
|
118
|
-
`,
|
|
118
|
+
`,pe=`
|
|
119
119
|
query currentUserApps($pagination: PaginationInput) {
|
|
120
120
|
currentUserApps(pagination: $pagination) {
|
|
121
121
|
id clientId name description type actorType status ownerUserId
|
|
122
122
|
redirectUris scopes createdAt updatedAt
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
`,
|
|
125
|
+
`,de=`
|
|
126
126
|
query app($id: ID!) {
|
|
127
127
|
app(id: $id) {
|
|
128
128
|
id clientId name description type actorType status ownerUserId redirectUris scopes
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
`,
|
|
131
|
+
`,ue=`
|
|
132
132
|
mutation createApp($input: CreateAppInput!) {
|
|
133
133
|
createApp(input: $input) {
|
|
134
134
|
app { id clientId name type status }
|
|
135
135
|
clientSecret
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
`,
|
|
138
|
+
`,le=`
|
|
139
139
|
mutation updateApp($id: ID!, $input: UpdateAppInput!) {
|
|
140
140
|
updateApp(id: $id, input: $input) {
|
|
141
141
|
id name description redirectUris scopes status
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
`,
|
|
144
|
+
`,Ie=`
|
|
145
145
|
mutation deactivateApp($id: ID!) {
|
|
146
146
|
deactivateApp(id: $id)
|
|
147
147
|
}
|
|
148
|
-
`,
|
|
148
|
+
`,ge=`
|
|
149
149
|
query getSSOConfig($tenantId: String!) {
|
|
150
150
|
getSSOConfig(tenantId: $tenantId) {
|
|
151
151
|
id identifier tenantId entityId ssoUrl sloUrl certificate enabled metadata
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
`,
|
|
154
|
+
`,me=`
|
|
155
155
|
mutation saveSSOConfig($tenantId: String!, $input: SSOConfigInput!) {
|
|
156
156
|
saveSSOConfig(tenantId: $tenantId, input: $input) {
|
|
157
157
|
id identifier entityId ssoUrl sloUrl certificate enabled
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
`,$e=`
|
|
161
161
|
mutation deleteSSOConfig($tenantId: String!) {
|
|
162
162
|
deleteSSOConfig(tenantId: $tenantId)
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
`,Se=`
|
|
165
165
|
query users($filter: UserFilterInput, $pagination: PaginationInput) {
|
|
166
166
|
users(filter: $filter, pagination: $pagination) {
|
|
167
167
|
users { id email firstName lastName username role status createdAt }
|
|
168
168
|
totalCount hasMore
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
`,
|
|
171
|
+
`,Ee=`
|
|
172
172
|
query user($id: ID!) {
|
|
173
173
|
user(id: $id) {
|
|
174
174
|
id email firstName lastName username role status emailVerified lastLoginAt
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
`,
|
|
177
|
+
`,Te=`
|
|
178
178
|
mutation updateUser($id: ID!, $input: AdminUpdateUserInput!) {
|
|
179
179
|
updateUser(id: $id, input: $input) {
|
|
180
180
|
id email firstName lastName username role status
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
`;function Te(n){let s=n.command("profile").description("Current user profile");s.command("show").description("Show current user").option("-f, --format <format>").action(async t=>{try{let e=await l(Yt);g(t,e.currentUser);}catch(e){d(e);}}),s.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async t=>{try{let e={};if(t.firstName&&(e.firstName=t.firstName),t.lastName&&(e.lastName=t.lastName),t.name&&(e.name=t.name),t.username&&(e.username=t.username),t.phone&&(e.phoneNumber=t.phone),t.timezone&&(e.timezone=t.timezone),t.language&&(e.language=t.language),!Object.keys(e).length)throw new E("No updates specified");let o=await l(zt,{input:e});I("Profile updated"),g(t,o.updateCurrentUserProfile);}catch(e){d(e);}});let i=n.command("security").description("Account security overview");i.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Dt,{pagination:{limit:t.limit,offset:0}});g(t,e.authAuditLogs,{headers:["When","Action","Resource","IP"],rows:e.authAuditLogs.map(o=>[h(o.createdAt),o.action,o.resource??"-",o.ipAddress??"-"])});}catch(e){d(e);}}),i.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(jt,{pagination:{limit:t.limit,offset:0}});g(t,e.activeSessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:e.activeSessions.map(o=>[q(o.id,12),X(o.status),o.ipAddress??"-",h(o.lastActivityAt),String(!!o.isCurrent)])});}catch(e){d(e);}});let r=n.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Xt,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserMFAMethods,{headers:["Method","Status","Created"],rows:e.currentUserMFAMethods.map(o=>[o.method,X(o.status),h(o.createdAt)])});}catch(e){d(e);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async t=>{try{let e=await l(Jt,{method:t.method.toUpperCase()});t.format?g(t,e.setupMFA):(I("MFA enrollment started"),j(e.setupMFA),x("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(e){d(e);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async t=>{try{await l(Qt,{code:t.code}),I("MFA enabled");}catch(e){d(e);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await l(Zt),I("MFA disabled");}catch(t){d(t);}});let a=n.command("api-keys").description("API key management");a.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=t.app?ee:te,o=t.app?{appId:t.app,pagination:{limit:t.limit,offset:0}}:{pagination:{limit:t.limit,offset:0}},$=await l(e,o),A=$.myApiKeys??$.appApiKeys??[];g(t,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(S=>[q(S.id,12),S.name??"-",S.prefix??"-",S.appName??"-",Array.isArray(S.scopes)?S.scopes.join(","):"-",h(S.lastUsedAt)])});}catch(e){d(e);}}),a.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,appId:t.app,scope:t.scope?t.scope.split(","):void 0,expiresAt:t.expires},o=await l(ne,{input:e});I("API key generated. Store the secret \u2014 it is only shown once."),j(o.generateAPIKey);}catch(e){d(e);}}),a.command("revoke").description("Revoke an API key").argument("<keyId>").action(async t=>{try{await l(oe,{keyId:t}),I("API key revoked");}catch(e){d(e);}}),a.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async t=>{try{let e=await l(ie,{keyId:t});I("API key rotated"),j(e.rotateAPIKey);}catch(e){d(e);}}),n.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Dt,{pagination:{limit:t.limit,offset:0}});g(t,e.authAuditLogs);}catch(e){d(e);}});let p=n.command("delegations").description("Delegation management");p.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(re,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserDelegations);}catch(e){d(e);}}),p.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async t=>{try{let e={appId:t.app,userId:t.user,scopes:t.scope?t.scope.split(","):void 0,workspaceIds:t.workspace?t.workspace.split(","):void 0,expiresAt:t.expires},o=await l(se,{input:e});I("Delegation granted"),g(t,o.grantDelegation);}catch(e){d(e);}}),p.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(t,e)=>{try{await l(ae,{id:t,reason:e.reason}),I("Delegation revoked");}catch(o){d(o);}});let c=n.command("apps").description("OAuth/system app management");c.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(ce,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserApps,{headers:["ID","ClientID","Name","Type","Status"],rows:e.currentUserApps.map(o=>[q(o.id,12),q(o.clientId,24),o.name??"-",o.type??"-",X(o.status)])});}catch(e){d(e);}}),c.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(pe,{id:t});if(!o.app)throw new E(`App ${t} not found`);g(e,o.app);}catch(o){d(o);}}),c.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,type:(t.type??"OAUTH").toUpperCase(),actorType:(t.actorType??"APP").toUpperCase(),redirectUris:t.redirect?t.redirect.split(","):void 0,scopes:t.scopes?t.scopes.split(","):void 0},o=await l(de,{input:e});I("App created. Client secret only shown once."),j(o.createApp);}catch(e){d(e);}}),c.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.description!==void 0&&(o.description=e.description),e.redirect&&(o.redirectUris=e.redirect.split(",")),e.scopes&&(o.scopes=e.scopes.split(",")),e.status&&(o.status=e.status.toUpperCase()),!Object.keys(o).length)throw new E("No updates specified");let $=await l(ue,{id:t,input:o});I("App updated"),g(e,$.updateApp);}catch(o){d(o);}}),c.command("deactivate").description("Deactivate an app").argument("<id>").action(async t=>{try{await l(le,{id:t}),I("App deactivated");}catch(e){d(e);}});let u=n.command("sso").description("SSO (SAML/OIDC) configuration");u.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async t=>{try{let e=await l(Ie,{tenantId:t.tenant});g(t,e.getSSOConfig);}catch(e){d(e);}}),u.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,ssoUrl:t.ssoUrl,sloUrl:t.sloUrl,certificate:t.certificate,enabled:!!t.enabled},o=await l(ge,{tenantId:t.tenant,input:e});I("SSO config saved"),g(t,o.saveSSOConfig);}catch(e){d(e);}}),u.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async t=>{try{await l(me,{tenantId:t.tenant}),I("SSO config deleted");}catch(e){d(e);}});let m=n.command("users").description("User admin (requires admin permissions)");m.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.email&&(e.email=t.email),t.username&&(e.username=t.username),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.search&&(e.search=t.search);let o=await l($e,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});g(t,o.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:o.users.users.map($=>[q($.id,12),$.email,$.username??"-",$.role??"-",X($.status),h($.createdAt)])});}catch(e){d(e);}}),m.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(Se,{id:t});if(!o.user)throw new E(`User ${t} not found`);g(e,o.user);}catch(o){d(o);}}),m.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.firstName&&(o.firstName=e.firstName),e.lastName&&(o.lastName=e.lastName),e.username&&(o.username=e.username),e.phone&&(o.phoneNumber=e.phone),e.role&&(o.role=e.role.toUpperCase()),e.status&&(o.status=e.status.toUpperCase()),e.emailVerified!==void 0&&(o.emailVerified=e.emailVerified==="true"),!Object.keys(o).length)throw new E("No updates specified");let $=await l(Ee,{id:t,input:o});I("User updated"),g(e,$.updateUser);}catch(o){d(o);}});}var we={id:"auth",version:"1.0.0",displayName:"Authentication",register(n,s){Ct(s),Wt(n);let i=n.commands.find(r=>r.name()==="auth");if(!i)throw new k("auth command group missing after registerAuthCommands");Te(i);}},Fs=we;module.exports=Fs;
|
|
183
|
+
`;function fe(n){let s=n.command("profile").description("Current user profile");s.command("show").description("Show current user").option("-f, --format <format>").action(async t=>{try{let e=await l(zt);g(t,e.currentUser);}catch(e){d(e);}}),s.command("update").description("Update current user profile").option("--first-name <s>").option("--last-name <s>").option("--name <s>").option("--username <s>").option("--phone <s>").option("--timezone <s>").option("--language <s>").option("-f, --format <format>").action(async t=>{try{let e={};if(t.firstName&&(e.firstName=t.firstName),t.lastName&&(e.lastName=t.lastName),t.name&&(e.name=t.name),t.username&&(e.username=t.username),t.phone&&(e.phoneNumber=t.phone),t.timezone&&(e.timezone=t.timezone),t.language&&(e.language=t.language),!Object.keys(e).length)throw new T("No updates specified");let o=await l(jt,{input:e});I("Profile updated"),g(t,o.updateCurrentUserProfile);}catch(e){d(e);}});let i=n.command("security").description("Account security overview");i.command("audit-log").description("Recent auth audit events for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(yt,{pagination:{limit:t.limit,offset:0}});g(t,e.authAuditLogs,{headers:["When","Action","Resource","IP"],rows:e.authAuditLogs.map(o=>[h(o.createdAt),o.action,o.resource??"-",o.ipAddress??"-"])});}catch(e){d(e);}}),i.command("sessions").description("Active sessions for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Xt,{pagination:{limit:t.limit,offset:0}});g(t,e.activeSessions,{headers:["ID","Status","IP","LastActivity","Current"],rows:e.activeSessions.map(o=>[q(o.id,12),J(o.status),o.ipAddress??"-",h(o.lastActivityAt),String(!!o.isCurrent)])});}catch(e){d(e);}});let r=n.command("mfa").description("Multi-factor authentication");r.command("list").description("List MFA methods enrolled for the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(Jt,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserMFAMethods,{headers:["Method","Status","Created"],rows:e.currentUserMFAMethods.map(o=>[o.method,J(o.status),h(o.createdAt)])});}catch(e){d(e);}}),r.command("enroll").description("Begin MFA enrollment (TOTP/SMS/EMAIL)").requiredOption("--method <m>","TOTP|SMS|EMAIL").option("-f, --format <format>").action(async t=>{try{let e=await l(Qt,{method:t.method.toUpperCase()});t.format?g(t,e.setupMFA):(I("MFA enrollment started"),X(e.setupMFA),x("Save your backup codes; verify with `auth mfa verify --code <CODE>`."));}catch(e){d(e);}}),r.command("verify").description("Verify MFA enrollment code").requiredOption("--code <code>").action(async t=>{try{await l(Zt,{code:t.code}),I("MFA enabled");}catch(e){d(e);}}),r.command("disable").description("Disable MFA for the current user").action(async()=>{try{await l(te),I("MFA disabled");}catch(t){d(t);}});let a=n.command("api-keys").description("API key management");a.command("list").description("List your API keys").option("--app <id>","Restrict to keys for an app id").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=t.app?ne:ee,o=t.app?{appId:t.app,pagination:{limit:t.limit,offset:0}}:{pagination:{limit:t.limit,offset:0}},$=await l(e,o),A=$.myApiKeys??$.appApiKeys??[];g(t,A,{headers:["ID","Name","Prefix","App","Scopes","LastUsed"],rows:A.map(E=>[q(E.id,12),E.name??"-",E.prefix??"-",E.appName??"-",Array.isArray(E.scopes)?E.scopes.join(","):"-",h(E.lastUsedAt)])});}catch(e){d(e);}}),a.command("create").description("Generate a new API key").requiredOption("--name <name>").requiredOption("--app <appId>","Owning app id").option("--scope <scope>","Comma-separated scopes").option("--expires <iso>","ISO expiry").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,appId:t.app,scope:t.scope?t.scope.split(","):void 0,expiresAt:t.expires},o=await l(oe,{input:e});I("API key generated. Store the secret \u2014 it is only shown once."),X(o.generateAPIKey);}catch(e){d(e);}}),a.command("revoke").description("Revoke an API key").argument("<keyId>").action(async t=>{try{await l(ie,{keyId:t}),I("API key revoked");}catch(e){d(e);}}),a.command("rotate").description("Rotate an API key (returns new secret)").argument("<keyId>").action(async t=>{try{let e=await l(re,{keyId:t});I("API key rotated"),X(e.rotateAPIKey);}catch(e){d(e);}}),n.command("audit-log").description("Auth audit log").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(yt,{pagination:{limit:t.limit,offset:0}});g(t,e.authAuditLogs);}catch(e){d(e);}});let p=n.command("delegations").description("Delegation management");p.command("list").description("Delegations granted to the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(se,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserDelegations);}catch(e){d(e);}}),p.command("grant").description("Grant a delegation to an app").requiredOption("--app <appId>").requiredOption("--user <userId>","User to delegate as").option("--scope <s>","Comma-separated scopes").option("--workspace <ids>","Comma-separated workspace ids").option("--expires <iso>").option("-f, --format <format>").action(async t=>{try{let e={appId:t.app,userId:t.user,scopes:t.scope?t.scope.split(","):void 0,workspaceIds:t.workspace?t.workspace.split(","):void 0,expiresAt:t.expires},o=await l(ae,{input:e});I("Delegation granted"),g(t,o.grantDelegation);}catch(e){d(e);}}),p.command("revoke").description("Revoke a delegation").argument("<id>").option("--reason <text>").action(async(t,e)=>{try{await l(ce,{id:t,reason:e.reason}),I("Delegation revoked");}catch(o){d(o);}});let c=n.command("apps").description("OAuth/system app management");c.command("list").description("Apps owned by the current user").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e=await l(pe,{pagination:{limit:t.limit,offset:0}});g(t,e.currentUserApps,{headers:["ID","ClientID","Name","Type","Status"],rows:e.currentUserApps.map(o=>[q(o.id,12),q(o.clientId,24),o.name??"-",o.type??"-",J(o.status)])});}catch(e){d(e);}}),c.command("get").description("Get an app by id").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(de,{id:t});if(!o.app)throw new T(`App ${t} not found`);g(e,o.app);}catch(o){d(o);}}),c.command("create").description("Create an OAuth app").requiredOption("--name <s>").option("--description <s>").option("--type <t>","OAUTH|SYSTEM","OAUTH").option("--actor-type <t>","USER|APP|SERVICE","APP").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("-f, --format <format>").action(async t=>{try{let e={name:t.name,description:t.description,type:(t.type??"OAUTH").toUpperCase(),actorType:(t.actorType??"APP").toUpperCase(),redirectUris:t.redirect?t.redirect.split(","):void 0,scopes:t.scopes?t.scopes.split(","):void 0},o=await l(ue,{input:e});I("App created. Client secret only shown once."),X(o.createApp);}catch(e){d(e);}}),c.command("update").description("Update an app").argument("<id>").option("--name <s>").option("--description <s>").option("--redirect <urls>","Comma-separated redirect URIs").option("--scopes <s>","Comma-separated scopes").option("--status <s>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.name&&(o.name=e.name),e.description!==void 0&&(o.description=e.description),e.redirect&&(o.redirectUris=e.redirect.split(",")),e.scopes&&(o.scopes=e.scopes.split(",")),e.status&&(o.status=e.status.toUpperCase()),!Object.keys(o).length)throw new T("No updates specified");let $=await l(le,{id:t,input:o});I("App updated"),g(e,$.updateApp);}catch(o){d(o);}}),c.command("deactivate").description("Deactivate an app").argument("<id>").action(async t=>{try{await l(Ie,{id:t}),I("App deactivated");}catch(e){d(e);}});let u=n.command("sso").description("SSO (SAML/OIDC) configuration");u.command("get").description("Get SSO config for a tenant").requiredOption("--tenant <id>").option("-f, --format <format>").action(async t=>{try{let e=await l(ge,{tenantId:t.tenant});g(t,e.getSSOConfig);}catch(e){d(e);}}),u.command("save").description("Save (upsert) SSO config for a tenant").requiredOption("--tenant <id>").requiredOption("--entity <s>","EntityID / Issuer").requiredOption("--sso-url <url>").option("--slo-url <url>").option("--certificate <pem>","X.509 certificate PEM").option("--enabled","Enable after save",false).option("-f, --format <format>").action(async t=>{try{let e={entityId:t.entity,ssoUrl:t.ssoUrl,sloUrl:t.sloUrl,certificate:t.certificate,enabled:!!t.enabled},o=await l(me,{tenantId:t.tenant,input:e});I("SSO config saved"),g(t,o.saveSSOConfig);}catch(e){d(e);}}),u.command("delete").description("Delete SSO config for a tenant").requiredOption("--tenant <id>").action(async t=>{try{await l($e,{tenantId:t.tenant}),I("SSO config deleted");}catch(e){d(e);}});let m=n.command("users").description("User admin (requires admin permissions)");m.command("list").description("List users (admin)").option("--email <s>").option("--username <s>").option("--role <s>").option("--status <s>").option("--search <s>").option("--limit <n>","Page size",t=>parseInt(t,10),50).option("-f, --format <format>").action(async t=>{try{let e={};t.email&&(e.email=t.email),t.username&&(e.username=t.username),t.role&&(e.role=t.role.toUpperCase()),t.status&&(e.status=t.status.toUpperCase()),t.search&&(e.search=t.search);let o=await l(Se,{filter:Object.keys(e).length?e:void 0,pagination:{limit:t.limit,offset:0}});g(t,o.users.users,{headers:["ID","Email","Username","Role","Status","Created"],rows:o.users.users.map($=>[q($.id,12),$.email,$.username??"-",$.role??"-",J($.status),h($.createdAt)])});}catch(e){d(e);}}),m.command("get").description("Get user by id (admin)").argument("<id>").option("-f, --format <format>").action(async(t,e)=>{try{let o=await l(Ee,{id:t});if(!o.user)throw new T(`User ${t} not found`);g(e,o.user);}catch(o){d(o);}}),m.command("update").description("Update a user (admin)").argument("<id>").option("--first-name <s>").option("--last-name <s>").option("--username <s>").option("--phone <s>").option("--role <s>").option("--status <s>").option("--email-verified <bool>").option("-f, --format <format>").action(async(t,e)=>{try{let o={};if(e.firstName&&(o.firstName=e.firstName),e.lastName&&(o.lastName=e.lastName),e.username&&(o.username=e.username),e.phone&&(o.phoneNumber=e.phone),e.role&&(o.role=e.role.toUpperCase()),e.status&&(o.status=e.status.toUpperCase()),e.emailVerified!==void 0&&(o.emailVerified=e.emailVerified==="true"),!Object.keys(o).length)throw new T("No updates specified");let $=await l(Te,{id:t,input:o});I("User updated"),g(e,$.updateUser);}catch(o){d(o);}});}var ve={id:"auth",version:"1.0.0",displayName:"Authentication",register(n,s){_t(s),Yt(n);let i=n.commands.find(r=>r.name()==="auth");if(!i)throw new k("auth command group missing after registerAuthCommands");fe(i);}},Bs=ve;module.exports=Bs;
|