@burdenoff/cli-sdk 2026.1102.1 → 2026.1102.2
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-O6UCQ5IT.js +1 -0
- package/dist/{chunk-AYNNSLCL.js → chunk-ZGT7IIOP.js} +409 -418
- package/dist/modules/adaptercloud/index.cjs +4 -4
- package/dist/modules/adaptercloud/index.js +2 -2
- package/dist/modules/artistrybase/index.js +2 -2
- package/dist/modules/assethandler/index.cjs +2 -2
- package/dist/modules/assethandler/index.js +2 -2
- package/dist/modules/atheletebridge/index.cjs +8 -8
- package/dist/modules/atheletebridge/index.js +2 -2
- package/dist/modules/auth/index.cjs +37 -37
- package/dist/modules/auth/index.js +33 -29
- package/dist/modules/billing/index.cjs +1 -1
- package/dist/modules/billing/index.js +2 -2
- package/dist/modules/brainyrich/index.cjs +44 -28
- package/dist/modules/brainyrich/index.js +47 -31
- package/dist/modules/buildmyiq/index.js +2 -2
- package/dist/modules/channels/index.cjs +3 -3
- package/dist/modules/channels/index.js +2 -2
- package/dist/modules/collabkin/index.cjs +4 -4
- package/dist/modules/collabkin/index.js +2 -2
- package/dist/modules/comradecircle/index.cjs +6 -6
- package/dist/modules/comradecircle/index.js +2 -2
- package/dist/modules/conversations/index.cjs +7 -7
- package/dist/modules/conversations/index.js +2 -2
- package/dist/modules/coolandlovely/index.cjs +2 -2
- package/dist/modules/coolandlovely/index.js +2 -2
- package/dist/modules/cosmicintersection/index.cjs +6 -6
- package/dist/modules/cosmicintersection/index.js +2 -2
- package/dist/modules/crewfoundry/index.js +2 -2
- package/dist/modules/devportal/index.cjs +2 -2
- package/dist/modules/devportal/index.js +2 -2
- package/dist/modules/ecoimpacthub/index.cjs +5 -5
- package/dist/modules/ecoimpacthub/index.js +2 -2
- package/dist/modules/eventfullymanaged/index.cjs +12 -12
- package/dist/modules/eventfullymanaged/index.js +2 -2
- package/dist/modules/export/index.cjs +4 -4
- package/dist/modules/export/index.js +2 -2
- package/dist/modules/files/index.cjs +3 -3
- package/dist/modules/files/index.js +4 -4
- package/dist/modules/fluidgrids/index.cjs +16 -16
- package/dist/modules/fluidgrids/index.js +3 -3
- package/dist/modules/ggnomad/index.cjs +4 -4
- package/dist/modules/ggnomad/index.js +2 -2
- package/dist/modules/govcitizenhub/index.cjs +4 -4
- package/dist/modules/govcitizenhub/index.js +2 -2
- package/dist/modules/groups/index.cjs +4 -4
- package/dist/modules/groups/index.js +2 -2
- package/dist/modules/headshotmarketing/index.js +2 -2
- package/dist/modules/hookmovies/index.cjs +6 -6
- package/dist/modules/hookmovies/index.js +2 -2
- package/dist/modules/housingvista/index.cjs +3 -3
- package/dist/modules/housingvista/index.js +2 -2
- package/dist/modules/integrations/index.cjs +5 -5
- package/dist/modules/integrations/index.js +2 -2
- package/dist/modules/intelwatchtower/index.cjs +5 -5
- package/dist/modules/intelwatchtower/index.js +2 -2
- package/dist/modules/kadaikodi/index.cjs +2 -2
- package/dist/modules/kadaikodi/index.js +2 -2
- package/dist/modules/labsofscience/index.cjs +3 -3
- package/dist/modules/labsofscience/index.js +2 -2
- package/dist/modules/manufacturedops/index.cjs +2 -2
- package/dist/modules/manufacturedops/index.js +2 -2
- package/dist/modules/movethewheels/index.js +2 -2
- package/dist/modules/notifications/index.cjs +2 -2
- package/dist/modules/notifications/index.js +2 -2
- package/dist/modules/organizations/index.js +2 -2
- package/dist/modules/planmagnet/index.js +2 -2
- package/dist/modules/products/index.cjs +4 -4
- package/dist/modules/products/index.js +2 -2
- package/dist/modules/proserviceworld/index.cjs +2 -2
- package/dist/modules/proserviceworld/index.js +2 -2
- package/dist/modules/rbac/index.js +2 -2
- package/dist/modules/sandbox/index.cjs +17 -17
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +2 -2
- package/dist/modules/scheduler/index.js +2 -2
- package/dist/modules/security/index.cjs +3 -3
- package/dist/modules/security/index.js +2 -2
- package/dist/modules/semanticfed/index.cjs +3 -3
- package/dist/modules/semanticfed/index.js +2 -2
- package/dist/modules/store/index.cjs +3 -3
- package/dist/modules/store/index.js +2 -2
- package/dist/modules/subscriberbot/index.cjs +1 -1
- package/dist/modules/subscriberbot/index.js +2 -2
- package/dist/modules/support/index.cjs +2 -2
- package/dist/modules/support/index.js +2 -2
- package/dist/modules/tags/index.js +2 -2
- package/dist/modules/technospam/index.cjs +2 -2
- package/dist/modules/technospam/index.js +2 -2
- package/dist/modules/theculturepost/index.js +2 -2
- package/dist/modules/theglobalfuel/index.cjs +2 -2
- package/dist/modules/theglobalfuel/index.js +2 -2
- package/dist/modules/timecampus/index.js +2 -2
- package/dist/modules/tours/index.cjs +2 -2
- package/dist/modules/tours/index.js +2 -2
- package/dist/modules/vibecontrols/index.cjs +563 -567
- package/dist/modules/vibecontrols/index.js +5 -4
- package/dist/modules/workspaces/index.cjs +4 -4
- package/dist/modules/workspaces/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-W4JZR7RJ.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var fs=require('fs'),readline=require('readline'),stream=require('stream');var u=class extends Error{exitCode;hint;constructor(n,e){super(n),this.name="CliUserError",this.exitCode=e?.exitCode??1,this.hint=e?.hint;}},v=class extends u{constructor(n,e){super(n,{exitCode:2,hint:e?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},T=class extends Error{cause;constructor(n,e){super(n),this.name="CliInternalError",this.cause=e;}};var N=null;function X(i){N=i;}function S(){if(!N)throw new T("vibecontrols module helpers used before setHelpersContext was called");return N}function
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch'),require('commander');var fs=require('fs'),readline=require('readline'),stream=require('stream');var u=class extends Error{exitCode;hint;constructor(n,e){super(n),this.name="CliUserError",this.exitCode=e?.exitCode??1,this.hint=e?.hint;}},v=class extends u{constructor(n,e){super(n,{exitCode:2,hint:e?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},T=class extends Error{cause;constructor(n,e){super(n),this.name="CliInternalError",this.cause=e;}};var N=null;function X(i){N=i;}function S(){if(!N)throw new T("vibecontrols module helpers used before setHelpersContext was called");return N}function bt(){let i=S();if(!i.auth.isAuthenticated())throw new v("Authentication required.",{hint:`Run \`${i.productName} auth login\` to authenticate.`})}async function a(i,n){return bt(),S().gql.workspace.request(i,n)}function c(i,n,e){S().output.formatAndOutput(i,n,e);}function l(i){S().output.printSuccess(i);}function k(i){return S().output.formatDate(i)}function w(i,n){return S().output.truncate(i,n)}function F(i,n){return S().output.confirm(i,n)}var E=`
|
|
2
2
|
id workflowKey name description version status category tags icon isActive
|
|
3
3
|
totalVersions projectId createdAt updatedAt
|
|
4
4
|
`,Z=`
|
|
5
5
|
query FluidgridsListWorkflows($input: ListWorkflowDefinitionsInput!) {
|
|
6
6
|
workflowDefinitions(input: $input) {
|
|
7
|
-
items { ${
|
|
7
|
+
items { ${E} }
|
|
8
8
|
total
|
|
9
9
|
hasMore
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
`,D=`
|
|
13
13
|
query FluidgridsGetWorkflow($id: ID, $workflowKey: String, $version: String) {
|
|
14
14
|
workflowDefinition(id: $id, workflowKey: $workflowKey, version: $version) {
|
|
15
|
-
${
|
|
15
|
+
${E}
|
|
16
16
|
alias
|
|
17
17
|
definitionJson
|
|
18
18
|
context
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
}
|
|
21
21
|
`,ee=`
|
|
22
22
|
query FluidgridsWorkflowVersions($workflowKey: String!) {
|
|
23
|
-
workflowVersions(workflowKey: $workflowKey) { ${
|
|
23
|
+
workflowVersions(workflowKey: $workflowKey) { ${E} }
|
|
24
24
|
}
|
|
25
25
|
`,te=`
|
|
26
26
|
mutation FluidgridsCreateWorkflow($input: CreateWorkflowDefinitionInput!) {
|
|
27
|
-
createWorkflowDefinition(input: $input) { ${
|
|
27
|
+
createWorkflowDefinition(input: $input) { ${E} }
|
|
28
28
|
}
|
|
29
29
|
`,oe=`
|
|
30
30
|
mutation FluidgridsUpdateWorkflow($id: ID!, $input: UpdateWorkflowDefinitionInput!) {
|
|
31
|
-
updateWorkflowDefinition(id: $id, input: $input) { ${
|
|
31
|
+
updateWorkflowDefinition(id: $id, input: $input) { ${E} }
|
|
32
32
|
}
|
|
33
33
|
`,ne=`
|
|
34
34
|
mutation FluidgridsDeleteWorkflow($workflowKey: String!, $version: String) {
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
}
|
|
47
47
|
`,ie=`
|
|
48
48
|
mutation FluidgridsPublishWorkflow($id: ID!) {
|
|
49
|
-
publishWorkflow(id: $id) { ${
|
|
49
|
+
publishWorkflow(id: $id) { ${E} }
|
|
50
50
|
}
|
|
51
51
|
`,se=`
|
|
52
52
|
mutation FluidgridsActivateWorkflow($id: ID!) {
|
|
53
|
-
activateWorkflowDefinition(id: $id) { ${
|
|
53
|
+
activateWorkflowDefinition(id: $id) { ${E} }
|
|
54
54
|
}
|
|
55
55
|
`,ae=`
|
|
56
56
|
mutation FluidgridsDeactivateWorkflow($id: ID!) {
|
|
57
|
-
deactivateWorkflowDefinition(id: $id) { ${
|
|
57
|
+
deactivateWorkflowDefinition(id: $id) { ${E} }
|
|
58
58
|
}
|
|
59
59
|
`,ue=`
|
|
60
60
|
mutation FluidgridsDuplicateWorkflow(
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
duplicateWorkflow(workflowKey: $workflowKey, version: $version, input: $input) {
|
|
66
66
|
success
|
|
67
67
|
message
|
|
68
|
-
workflow { ${
|
|
68
|
+
workflow { ${E} }
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
`,de=`
|
|
72
72
|
mutation FluidgridsArchiveWorkflow($id: ID!) {
|
|
73
|
-
archiveWorkflow(id: $id) { ${
|
|
73
|
+
archiveWorkflow(id: $id) { ${E} }
|
|
74
74
|
}
|
|
75
75
|
`,ce=`
|
|
76
76
|
mutation FluidgridsImportWorkflowTemplate($input: ImportWorkflowTemplateInput!) {
|
|
77
77
|
importWorkflowTemplate(input: $input) {
|
|
78
78
|
success
|
|
79
79
|
message
|
|
80
|
-
workflow { ${
|
|
80
|
+
workflow { ${E} }
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
`,le=`
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
pagination { total limit offset hasMore }
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
`,
|
|
178
|
+
`,be=`
|
|
179
179
|
query FluidgridsGetNode($nodeType: String!, $nodeVersion: String!) {
|
|
180
180
|
nodeEndpointConfig(nodeType: $nodeType, nodeVersion: $nodeVersion) {
|
|
181
181
|
${ke}
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
id name description status providerId credentialSource externalAccountId
|
|
188
188
|
externalAccountName externalAccountEmail grantedScopes lastUsedAt lastHealthCheck
|
|
189
189
|
errorMessage createdAt updatedAt
|
|
190
|
-
`,
|
|
190
|
+
`,Ee=`
|
|
191
191
|
query FluidgridsListCredentials(
|
|
192
192
|
$filter: ConnectionFilterInput
|
|
193
193
|
$pagination: IntegrationsPaginationInput
|
|
@@ -397,5 +397,5 @@
|
|
|
397
397
|
query FluidgridsSystemConfig {
|
|
398
398
|
systemConfig { version revision environment deploymentType hostname hostIp }
|
|
399
399
|
}
|
|
400
|
-
`;function p(i,n){if(!/^\d+$/.test(i))throw new u(`Invalid value '${i}' for ${n}: expected a non-negative integer.`);let e=Number(i);if(!Number.isSafeInteger(e))throw new u(`Invalid value '${i}' for ${n}: expected a non-negative integer.`);return e}function y(i,n,e){if(i===void 0)return;let t=e.find(o=>o===i);if(t===void 0)throw new u(`Invalid value '${i}' for ${n}. Allowed: ${e.join(", ")}`);return t}function x(i,n){let e;try{e=JSON.parse(i);}catch{throw new u(`${n} must be valid JSON.`)}if(!Ct(e))throw new u(`${n} must be a JSON object.`);return e}function h(i){let n;try{n=fs.readFileSync(i,"utf8");}catch(e){let t=e instanceof Error?e.message:String(e);throw new u(`Cannot read ${i}: ${t}`)}return x(n,i)}function R(i,n){if(i!==void 0){if(!i.trim())throw new u(`${n} cannot be empty.`);return i}}function E(i,n,e){if(i==null)throw new u(`${n} ${e} not found (NOT_FOUND)`);return i}function Ct(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function Be(i,n=[]){return [...n,i]}async function I(i,n){if(!await F(i,n))throw new u("Aborted: nothing was changed.")}var K=["DRAFT","ACTIVE","ARCHIVED","DEPRECATED"],q=["PENDING","RUNNING","WAITING","COMPLETED","FAILED","CANCELLED","TERMINATED"],He=["COMPLETED","FAILED","CANCELLED","TERMINATED"],G=["DEBUG","INFO","WARN","ERROR"],J=["BUILTIN","CUSTOM","STORE"],M=["AVAILABLE","DEPRECATED","DISABLED"],V=["ACTIVE","PAUSED","DISABLED","ARCHIVED"],B=["ACTIVE","INACTIVE","PENDING_AUTH","ERROR","EXPIRED","REVOKED"],H=["workflow","run","node","event"];function Ye(i){return {headers:["ID","Key","Name","Version","Status","Active","Updated"],rows:i.map(n=>[w(n.id,12),n.workflowKey,w(n.name,32),n.version,n.status,n.isActive?"yes":"no",k(n.updatedAt)])}}function ze(i){let n=i.command("workflows").description("FluidGrids workflow definitions");n.command("list").description("List workflow definitions").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${K.join("|")})`).option("--category <category>","Filter by category").option("--tag <tag>","Filter by tag (repeatable)",Be).option("--latest-only","Only the latest version of each workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let o={limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")},r=y(t.status,"--status",K);r&&(o.status=r),t.category&&(o.category=t.category),t.tag?.length&&(o.tags=t.tag),t.latestOnly&&(o.latestOnly=true);let s=await a(Z,{input:o});c(t,s.workflowDefinitions.items,Ye(s.workflowDefinitions.items));}),n.command("get").description("Get a workflow definition by ID, or by key with --key").argument("[id]","Workflow definition ID").option("--key <workflowKey>","Look up by workflow key instead of ID").option("--wf-version <version>","Version to fetch with --key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{if(!t&&!o.key)throw new u("Pass a workflow ID or --key <workflowKey>.");if(t&&o.key)throw new u("Pass either a workflow ID or --key, not both.");let r=await a(D,t?{id:t}:{workflowKey:o.key,version:o.wfVersion});c(o,E(r.workflowDefinition,"Workflow",t??o.key??""));}),n.command("versions").description("List every stored version of a workflow key").argument("<workflowKey>","Workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r=await a(ee,{workflowKey:t});c(o,r.workflowVersions,Ye(r.workflowVersions));}),n.command("create").description("Create a workflow definition from a CreateWorkflowDefinitionInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r=h(t),s=await a(te,{input:r});l(`Workflow created: ${s.createWorkflowDefinition.workflowKey}`),c(o,s.createWorkflowDefinition);}),n.command("update").description("Update a workflow definition from an UpdateWorkflowDefinitionInput JSON file").argument("<id>","Workflow definition ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o,r)=>{let s=h(o),d=await a(oe,{id:t,input:s});l("Workflow updated"),c(r,d.updateWorkflowDefinition);}),n.command("delete").description("Delete a workflow (every version, or one with --wf-version)").argument("<workflowKey>","Workflow key").option("--wf-version <version>","Delete only this version").option("--force","Skip the confirmation prompt").action(async(t,o)=>{let r=o.wfVersion?`${t}@${o.wfVersion}`:`${t} (all versions)`;if(await I(`Delete workflow ${r}?`,o.force),!(await a(ne,{workflowKey:t,version:o.wfVersion})).deleteWorkflowDefinition)throw new u(`Workflow ${r} was not deleted.`);l(`Workflow ${r} deleted`);}),n.command("trigger").description("Trigger a workflow run").argument("<workflowKey>","Workflow key").requiredOption("--wf-version <version>","Workflow version").requiredOption("--trigger-node <id>","Trigger node ID").option("-i, --input <json>","Trigger data as a JSON object").option("--stop-at-node <id>","Stop the run after this node").option("--test","Run in TEST mode instead of PRODUCTION").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r={workflowKey:t,version:R(o.wfVersion,"--wf-version"),triggerNodeId:R(o.triggerNode,"--trigger-node")};o.input!==void 0&&(r.triggerData=x(o.input,"--input")),o.stopAtNode&&(r.stopAtNodeId=o.stopAtNode),o.test&&(r.mode="TEST");let s=await a(re,{input:r});c(o,s.triggerWorkflow);}),n.command("duplicate").description("Duplicate a workflow version under a new key").argument("<workflowKey>","Source workflow key").argument("<version>","Source version").requiredOption("--new-key <key>","Workflow key for the copy").option("--new-version <version>","Version for the copy").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o,r)=>{let s={newWorkflowKey:R(r.newKey,"--new-key")};r.newVersion&&(s.newVersion=r.newVersion);let d=await a(ue,{workflowKey:t,version:o,input:s});if(!d.duplicateWorkflow.success)throw new u(d.duplicateWorkflow.message??"Duplicate failed.");c(r,d.duplicateWorkflow.workflow??d.duplicateWorkflow);});let e=[["publish","Publish a workflow definition version",ie,"publishWorkflow"],["activate","Make a workflow definition version the active one",se,"activateWorkflowDefinition"],["deactivate","Deactivate a workflow definition version",ae,"deactivateWorkflowDefinition"],["archive","Archive a workflow definition version",de,"archiveWorkflow"]];for(let[t,o,r,s]of e)n.command(t).description(o).argument("<id>","Workflow definition ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(d,m)=>{let g=(await a(r,{id:d}))[s];if(!g)throw new u(`Workflow ${d}: ${t} returned no result.`);l(`Workflow ${g.workflowKey}@${g.version}: ${g.status}`),c(m,g);});n.command("import").description("Import a workflow from a store template (ImportWorkflowTemplateInput JSON)").argument("<file>","Path to the template input JSON").option("--name <name>","Override the workflow name").option("--description <text>","Override the description").option("--icon <icon>","Override the icon").option("--category <category>","Override the category").option("--project-id <id>","Scope to a project").option("--source-template-id <id>","Source template ID (lineage)").option("--context <json>","Context metadata as a JSON object").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r={...h(t)},s=R(o.name,"--name"),d=R(o.projectId,"--project-id"),m=R(o.sourceTemplateId,"--source-template-id");s!==void 0&&(r.name=s),o.description!==void 0&&(r.description=o.description),o.icon!==void 0&&(r.icon=o.icon),o.category!==void 0&&(r.category=o.category),d!==void 0&&(r.projectId=d),m!==void 0&&(r.sourceTemplateId=m),o.context!==void 0&&(r.context=x(o.context,"--context"));let C=await a(ce,{input:r});if(!C.importWorkflowTemplate.success)throw new u(C.importWorkflowTemplate.message??"Import failed.");l("Workflow imported"),c(o,C.importWorkflowTemplate.workflow??C.importWorkflowTemplate);});}var It=100;function Qe(i){return {headers:["ID","Workflow","Version","Status","Progress","Started","Completed"],rows:i.map(n=>[w(n.id,12),n.workflowKey,n.version,n.status,`${Math.round(n.progress)}%`,k(n.startedAt),k(n.completedAt)])}}async function L(i){let n=await a(pe,{id:i});return E(n.workflowRun,"Run",i)}function Tt(i){return He.some(n=>n===i.toUpperCase())}async function St(i,n,e,t,o){if(t===0)return [];let r=[],s=new Set,d=0,m=0;for(;r.length<t;){let g=(await a(_,{input:{workflowKey:n,status:e,limit:It,offset:d}})).workflowRuns;if(g.items.length===0){if(g.hasMore)throw new u("Run listing returned an empty page before the end.");break}for(let $ of g.items)if(!($.workflowId!==i||s.has($.id))){if(s.add($.id),m<o){m++;continue}if(r.push($),r.length===t)break}if(d+=g.items.length,!g.hasMore)break}return r}function Ot(i,n,e){let t=e.filter(d=>d.nodeId===n);if(t.length===0)throw new u(`Node ${n} not found in run ${i} (NOT_FOUND)`);let o=t.filter(d=>["FAILED","TIMEOUT"].includes(d.status.toUpperCase()));if(o.length===0)throw new u(`Node ${n} is not failed in run ${i} (INVALID_STATE)`);let[r,...s]=o;if(!r||s.length>0)throw new u(`Node ${n} is ambiguous in run ${i}; retry a specific node state.`);return r}function Rt(i){return new Promise(n=>setTimeout(n,i))}function Xe(i){let n=i.command("runs").description("FluidGrids workflow runs");n.command("list").description("List workflow runs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${q.join("|")})`).option("--workflow-key <key>","Filter by workflow key").option("--workflow-id <id>","Filter by exact workflow definition ID (scans all pages)").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=p(e.limit,"--limit"),o=p(e.offset,"--offset"),r=y(e.status,"--status",q);if(e.workflowId&&e.workflowKey)throw new u("Use either --workflow-id or --workflow-key, not both.");if(e.workflowId){let m=await a(D,{id:e.workflowId}),C=E(m.workflowDefinition,"Workflow",e.workflowId),g=await St(e.workflowId,C.workflowKey,r,t,o);c(e,g,Qe(g));return}let s={limit:t,offset:o};r&&(s.status=r),e.workflowKey&&(s.workflowKey=e.workflowKey);let d=await a(_,{input:s});c(e,d.workflowRuns.items,Qe(d.workflowRuns.items));}),n.command("get").description("Get a run (with node states)").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{c(t,await L(e));}),n.command("cancel").description("Cancel a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(me,{id:e});l(`Run ${e}: ${o.cancelWorkflowRun.status}`),c(t,o.cancelWorkflowRun);}),n.command("pause").description("Pause a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(ge,{id:e});l(`Run ${e}: ${o.pauseWorkflowRun.status}`),c(t,o.pauseWorkflowRun);}),n.command("resume").description("Resume a paused or waiting run").argument("<id>","Run ID").option("--payload <json>","JSON object delivered to the waiting node").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=t.payload===void 0?void 0:x(t.payload,"--payload"),r=await a(we,{id:e,payload:o});if(!r.resumeWorkflowRun.success)throw new u(r.resumeWorkflowRun.message);c(t,r.resumeWorkflowRun);}),n.command("wait").description("Poll a run until it reaches a terminal status").argument("<id>","Run ID").option("--timeout <ms>","Give up after this many milliseconds","300000").option("--poll-interval <ms>","Delay between polls in milliseconds","1000").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=p(t.timeout,"--timeout"),r=p(t.pollInterval,"--poll-interval"),s=Date.now(),d=await L(e);for(;!Tt(d.status);){if(Date.now()-s>o)throw new u(`Timed out waiting for run ${e} (last status ${d.status}).`);await Rt(r),d=await L(e);}c(t,d);}),n.command("logs").description("Get run logs (one cursor page)").argument("<id>","Run ID").option("--level <level>",`Minimum level (${G.join("|")})`).option("--node-id <id>","Only this graph node").option("--search <text>","Only lines containing this text").option("--include-child-runs","Include sub-workflow runs").option("--limit <n>","Page size, 1 to 1000").option("--after <cursor>","Continue after a nextCursor from an earlier page").option("--page-info","Print the whole page (lines + cursor) instead of only lines").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=y(t.level,"--level",G),r=t.limit===void 0?void 0:p(t.limit,"--limit");if(r!==void 0&&(r<1||r>1e3))throw new u(`Invalid value '${t.limit}' for --limit: expected 1 to 1000.`);if(t.after!==void 0&&!t.after.trim())throw new u("--after cursor cannot be empty.");let d=(await a(fe,{runId:e,nodeId:t.nodeId,minLevel:o,limit:r,after:t.after,search:t.search,includeChildRuns:t.includeChildRuns})).workflowRunLogs;if(t.pageInfo){c(t,d);return}c(t,d.lines,{headers:["Time","Level","Node","Message"],rows:d.lines.map(m=>[k(m.timestamp),m.level,m.nodeId??"-",w(m.message,100)])});}),n.command("retry-node").description("Retry one failed node of a run (run ID + graph node ID)").argument("<runId>","Run ID").argument("<nodeId>","Graph node ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=await L(e),s=Ot(e,t,r.nodeStates??[]),d=await a(ye,{id:s.id,nodeId:t});l(`Node ${t} retry: ${d.retryNode.status}`),c(o,d.retryNode);});}function Ze(i){let n=i.command("nodes").description("FluidGrids node catalogue");n.command("list").description("List node endpoint configurations").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-t, --node-type <type>","Filter by node type").option("--publish-type <type>",`Filter by publish type (${J.join("|")})`).option("--status <status>",`Filter by status (${M.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let o=(await a(he,{nodeType:e.nodeType,publishType:y(e.publishType,"--publish-type",J),status:y(e.status,"--status",M),pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).nodeEndpointConfigs.configs;c(e,o,{headers:["Type","Version","Name","Category","Publish","Status","Latest"],rows:o.map(r=>[r.nodeType,r.nodeVersion,r.name,r.category??"-",r.publishType,r.status,r.isLatest?"yes":"no"])});}),n.command("get").description("Get a node endpoint configuration by type and version").argument("<nodeType>","Node type").argument("<nodeVersion>","Node version").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=await a(Ee,{nodeType:e,nodeVersion:t});c(o,E(r.nodeEndpointConfig,"Node",`${e}@${t}`));});}var At=/^[A-Za-z_][A-Za-z0-9_]*$/;async function $t(i,n=process.stdin,e=process.stderr){if(!n.isTTY)throw new u("A terminal is required to prompt for a secret.");let t=new stream.Writable({write(r,s,d){d();}}),o=readline.createInterface({input:n,output:t,terminal:true});e.write(`${i}: `);try{return await new Promise(r=>{o.question("",r);})}finally{o.close(),e.write(`
|
|
401
|
-
`);}}async function et(i,n,e,t=process.env,o=$t){if(i!==void 0){if(!At.test(i))throw new u(`Invalid environment variable name for ${e}.`);let s=t[i];if(!s?.trim())throw new u(`The environment variable selected by ${e} is empty or unset.`);return s}if(!process.stdin.isTTY)throw new u(`An interactive terminal or ${e} is required to supply ${n}.`);let r=await o(n);if(!r.trim())throw new u(`${n} cannot be empty.`);return r}async function tt(i,n,e){try{let o=(await a(i,{input:e}))[n];if(o===void 0)throw new Error("empty response");return o}catch{throw new u("Connection authentication failed; verify the connection and secret.")}}function ot(i){let n=i.command("credentials").description("FluidGrids credentials (integration connections)");n.command("list").description("List credentials").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-p, --provider-id <id>","Filter by provider ID").option("-s, --status <status>",`Filter by status (${B.join("|")})`).option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t={};e.providerId&&(t.providerId=e.providerId);let o=y(e.status,"--status",B);o&&(t.status=o),e.search&&(t.search=e.search);let s=(await a(be,{filter:Object.keys(t).length>0?t:void 0,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).getConnections.items;c(e,s,{headers:["ID","Name","Provider","Status","Last used"],rows:s.map(d=>[w(d.id,12),d.name,d.provider?.key??d.providerId,d.status,k(d.lastUsedAt)])});}),n.command("get").description("Get a credential").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Ce,{id:e});c(t,E(o.getConnection,"Credential",e));}),n.command("types").description("List the credential types (integration providers) you can create").option("-l, --limit <n>","Page size","50").option("-o, --offset <n>","Offset","0").option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ie,{filter:e.search?{search:e.search}:void 0,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}}),o=t.getProviders.items;c(e,t.getProviders,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:o.map(r=>[w(r.id,12),r.key,r.name,r.category,r.authType,r.isEnabled?"yes":"no"])});}),n.command("create").description("Create a credential shell from a CreateConnectionInput JSON file (no secrets; attach one with auth-api-key / auth-basic)").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(Te,{input:o});l(`Credential created: ${r.createConnection.id}`),c(t,r.createConnection);}),n.command("update").description("Update a credential (name, description, config) from a JSON file").argument("<id>","Credential (connection) ID").argument("<file>","Path to the UpdateConnectionInput JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(ve,{id:e,input:r});l("Credential updated"),c(o,s.updateConnection);}),n.command("delete").description("Delete a credential (the vault secret is kept unless --delete-vault-secret)").argument("<id>","Credential (connection) ID").option("--delete-vault-secret","Also delete the backing vault secret").option("--force","Skip the confirmation prompt").action(async(e,t)=>{if(await I(`Delete credential ${e}?`,t.force),!(await a(xe,{id:e,deleteVaultSecret:t.deleteVaultSecret?true:void 0})).deleteConnection)throw new u(`Credential ${e} was not deleted.`);l(`Credential ${e} deleted`);}),n.command("test").description("Test a credential against its provider").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Ae,{connectionId:e});c(t,o.testConnection);}),n.command("auth-api-key").description("Attach a provider API key to a credential (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").option("--api-key-env <name>","Read the API key from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await et(t.apiKeyEnv,"API key","--api-key-env"),r=await tt(Oe,"authenticateWithApiKey",{connectionId:e,apiKey:o});l(`Credential ${e}: ${r.status}`),c(t,r);}),n.command("auth-basic").description("Attach provider basic-auth credentials (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").argument("<username>","Provider username").option("--password-env <name>","Read the password from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{if(!t.trim())throw new u("Provider username cannot be empty.");let r=await et(o.passwordEnv,"Password","--password-env"),s=await tt(Re,"authenticateWithBasicAuth",{connectionId:e,username:t,password:r});l(`Credential ${e}: ${s.status}`),c(o,s);});}function nt(i){let n=i.command("webhooks").description("FluidGrids inbound webhooks (event registrations)");n.command("list").description("List webhooks").option("--workflow-key <key>","Filter by workflow key").option("-s, --status <status>",`Filter by status (${V.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a($e,{status:y(e.status,"--status",V),workflowKey:e.workflowKey});c(e,t.eventRegistrations,{headers:["ID","Name","Workflow","Trigger node","Status","Triggers","Last"],rows:t.eventRegistrations.map(o=>[w(o.id,12),o.name??"-",o.workflowKey,o.triggerNodeId,o.isActive?o.status:`${o.status} (inactive)`,String(o.totalTriggers),k(o.lastTriggeredAt)])});}),n.command("get").description("Get a webhook").argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(De,{id:e});c(t,E(o.eventRegistration,"Webhook",e));}),n.command("create").description("Create a webhook from a CreateEventRegistrationInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(We,{input:o});l(`Webhook created: ${r.createEventRegistration.id}`),c(t,r.createEventRegistration);}),n.command("update").description("Update a webhook from an UpdateEventRegistrationInput JSON file").argument("<id>","Event registration ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(Le,{id:e,input:r});l("Webhook updated"),c(o,s.updateEventRegistration);}),n.command("delete").description("Delete a webhook").argument("<id>","Event registration ID").option("--force","Skip the confirmation prompt").action(async(e,t)=>{if(await I(`Delete webhook ${e}?`,t.force),!(await a(Ne,{id:e})).deleteEventRegistration)throw new u(`Webhook ${e} was not deleted.`);l(`Webhook ${e} deleted`);});for(let[e,t]of [["activate",true],["deactivate",false]])n.command(e).description(`${t?"Activate":"Deactivate"} a webhook`).argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,r)=>{let s=await a(Fe,{id:o,isActive:t});l(`Webhook ${o} ${t?"activated":"deactivated"}`),c(r,s.toggleEventRegistration);});}function Y(i){if(!i.success)throw new u(i.message||"Scheduled job update failed.");return i}function rt(i){let n=i.command("scheduled-jobs").description("FluidGrids scheduled workflow runs (cron)");n.command("list").description("List scheduled jobs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("--workflow-key <key>","Filter by workflow key").option("--enabled","Only enabled jobs").option("--disabled","Only disabled jobs").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{if(e.enabled&&e.disabled)throw new u("Use either --enabled or --disabled, not both.");let o=(await a(_e,{enabled:e.enabled?true:e.disabled?false:void 0,workflowKey:e.workflowKey,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).workflowScheduledJobs.jobs;c(e,o,{headers:["ID","Name","Workflow","Version","Schedule","Enabled","Next run"],rows:o.map(r=>[w(r.id,12),r.name,r.workflowKey,r.version,r.schedule,r.enabled?"yes":"no",k(r.nextRun)])});}),n.command("get").description("Get a scheduled job").argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Pe,{jobId:e});c(t,E(o.workflowScheduledJob,"Scheduled job",e));}),n.command("create").description("Create a scheduled job from a ScheduledJobInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(je,{input:o}),s=Y(r.createWorkflowScheduledJob);l(s.message||"Scheduled job created"),c(t,s.job??s);}),n.command("update").description("Update a scheduled job from a WorkflowUpdateScheduledJobInput JSON file").argument("<jobId>","Scheduled job ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(U,{jobId:e,input:r}),d=Y(s.updateWorkflowScheduledJob);l(d.message||"Scheduled job updated"),c(o,d.job??d);}),n.command("delete").description("Delete a scheduled job").argument("<jobId>","Scheduled job ID").option("--force","Skip the confirmation prompt").action(async(e,t)=>{await I(`Delete scheduled job ${e}?`,t.force);let o=await a(Ue,{jobId:e});if(!o.deleteWorkflowScheduledJob.success)throw new u(o.deleteWorkflowScheduledJob.message||"Delete failed.");l(`Scheduled job ${e} deleted`);});for(let[e,t]of [["pause",false],["resume",true]])n.command(e).description(`${t?"Resume":"Pause"} a scheduled job`).argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,r)=>{let s=await a(U,{jobId:o,input:{enabled:t}}),d=Y(s.updateWorkflowScheduledJob);l(`Scheduled job ${o} ${t?"resumed":"paused"}`),c(r,d.job??d);});}function it(i,n){if(Number.isNaN(Date.parse(i)))throw new u(`Invalid value '${i}' for ${n}: expected an ISO 8601 date.`);return i}function st(i){let n=i.command("dashboard").description("FluidGrids dashboard metrics");n.command("summary").description("Workflow, run and node counters (incl. 24h / 7d / 30d windows)").option("-p, --project <id>","Scope to a project").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ke,{projectId:e.project});c(e,t.dashboardSummary);}),n.command("usage").description("Workflow and node execution metrics for a date range").requiredOption("--start <date>","Range start (ISO 8601)").requiredOption("--end <date>","Range end (ISO 8601)").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=it(e.start,"--start"),o=it(e.end,"--end");if(Date.parse(t)>Date.parse(o))throw new u("--start must not be after --end.");let r=await a(qe,{input:{startDate:t,endDate:o}});c(e,r.usageMetrics);});}function at(i){i.command("search").description("Search FluidGrids workflows, runs, nodes").command("query").description("Search across FluidGrids entities").argument("<query>","Search text").option("-t, --type <type>",`Restrict to one entity type (${H.join("|")})`).option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{if(!e.trim())throw new u("Search text cannot be empty.");let o=y(t.type,"--type",H),r=p(t.limit,"--limit"),s=p(t.offset,"--offset"),d=o?(await a(Me,{entityType:o,query:e,limit:r,offset:s})).searchByEntityType:(await a(Je,{input:{query:e,limit:r,offset:s}})).search;c(t,d);});}function ut(i){i.command("admin").description("FluidGrids administration").command("system-info").description("Deployment information (version, revision, environment) of the workflow service").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ve);c(e,t.systemConfig);});}var Dt={id:"fluidgrids",version:"1.0.0",displayName:"FluidGrids",dependsOn:["auth","workspaces"],register(i,n){X(n),ze(i),Xe(i),Ze(i),ot(i),nt(i),rt(i),st(i),at(i),ut(i);}},$n=Dt;module.exports=$n;
|
|
400
|
+
`;function p(i,n){if(!/^\d+$/.test(i))throw new u(`Invalid value '${i}' for ${n}: expected a non-negative integer.`);let e=Number(i);if(!Number.isSafeInteger(e))throw new u(`Invalid value '${i}' for ${n}: expected a non-negative integer.`);return e}function y(i,n,e){if(i===void 0)return;let t=e.find(o=>o===i);if(t===void 0)throw new u(`Invalid value '${i}' for ${n}. Allowed: ${e.join(", ")}`);return t}function x(i,n){let e;try{e=JSON.parse(i);}catch{throw new u(`${n} must be valid JSON.`)}if(!Ct(e))throw new u(`${n} must be a JSON object.`);return e}function h(i){let n;try{n=fs.readFileSync(i,"utf8");}catch(e){let t=e instanceof Error?e.message:String(e);throw new u(`Cannot read ${i}: ${t}`)}return x(n,i)}function R(i,n){if(i!==void 0){if(!i.trim())throw new u(`${n} cannot be empty.`);return i}}function b(i,n,e){if(i==null)throw new u(`${n} ${e} not found (NOT_FOUND)`);return i}function Ct(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function Be(i,n=[]){return [...n,i]}async function I(i,n){if(!await F(i,n))throw new u("Aborted: nothing was changed.")}var K=["DRAFT","ACTIVE","ARCHIVED","DEPRECATED"],q=["PENDING","RUNNING","WAITING","COMPLETED","FAILED","CANCELLED","TERMINATED"],He=["COMPLETED","FAILED","CANCELLED","TERMINATED"],G=["DEBUG","INFO","WARN","ERROR"],J=["BUILTIN","CUSTOM","STORE"],M=["AVAILABLE","DEPRECATED","DISABLED"],V=["ACTIVE","PAUSED","DISABLED","ARCHIVED"],B=["ACTIVE","INACTIVE","PENDING_AUTH","ERROR","EXPIRED","REVOKED"],H=["workflow","run","node","event"];function Ye(i){return {headers:["ID","Key","Name","Version","Status","Active","Updated"],rows:i.map(n=>[w(n.id,12),n.workflowKey,w(n.name,32),n.version,n.status,n.isActive?"yes":"no",k(n.updatedAt)])}}function ze(i){let n=i.command("workflows").description("FluidGrids workflow definitions");n.command("list").description("List workflow definitions").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${K.join("|")})`).option("--category <category>","Filter by category").option("--tag <tag>","Filter by tag (repeatable)",Be).option("--latest-only","Only the latest version of each workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let o={limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")},r=y(t.status,"--status",K);r&&(o.status=r),t.category&&(o.category=t.category),t.tag?.length&&(o.tags=t.tag),t.latestOnly&&(o.latestOnly=true);let s=await a(Z,{input:o});c(t,s.workflowDefinitions.items,Ye(s.workflowDefinitions.items));}),n.command("get").description("Get a workflow definition by ID, or by key with --key").argument("[id]","Workflow definition ID").option("--key <workflowKey>","Look up by workflow key instead of ID").option("--wf-version <version>","Version to fetch with --key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{if(!t&&!o.key)throw new u("Pass a workflow ID or --key <workflowKey>.");if(t&&o.key)throw new u("Pass either a workflow ID or --key, not both.");let r=await a(D,t?{id:t}:{workflowKey:o.key,version:o.wfVersion});c(o,b(r.workflowDefinition,"Workflow",t??o.key??""));}),n.command("versions").description("List every stored version of a workflow key").argument("<workflowKey>","Workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r=await a(ee,{workflowKey:t});c(o,r.workflowVersions,Ye(r.workflowVersions));}),n.command("create").description("Create a workflow definition from a CreateWorkflowDefinitionInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r=h(t),s=await a(te,{input:r});l(`Workflow created: ${s.createWorkflowDefinition.workflowKey}`),c(o,s.createWorkflowDefinition);}),n.command("update").description("Update a workflow definition from an UpdateWorkflowDefinitionInput JSON file").argument("<id>","Workflow definition ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o,r)=>{let s=h(o),d=await a(oe,{id:t,input:s});l("Workflow updated"),c(r,d.updateWorkflowDefinition);}),n.command("delete").description("Delete a workflow (every version, or one with --wf-version)").argument("<workflowKey>","Workflow key").option("--wf-version <version>","Delete only this version").option("--force","Skip the confirmation prompt").action(async(t,o)=>{let r=o.wfVersion?`${t}@${o.wfVersion}`:`${t} (all versions)`;if(await I(`Delete workflow ${r}?`,o.force),!(await a(ne,{workflowKey:t,version:o.wfVersion})).deleteWorkflowDefinition)throw new u(`Workflow ${r} was not deleted.`);l(`Workflow ${r} deleted`);}),n.command("trigger").description("Trigger a workflow run").argument("<workflowKey>","Workflow key").requiredOption("--wf-version <version>","Workflow version").requiredOption("--trigger-node <id>","Trigger node ID").option("-i, --input <json>","Trigger data as a JSON object").option("--stop-at-node <id>","Stop the run after this node").option("--test","Run in TEST mode instead of PRODUCTION").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r={workflowKey:t,version:R(o.wfVersion,"--wf-version"),triggerNodeId:R(o.triggerNode,"--trigger-node")};o.input!==void 0&&(r.triggerData=x(o.input,"--input")),o.stopAtNode&&(r.stopAtNodeId=o.stopAtNode),o.test&&(r.mode="TEST");let s=await a(re,{input:r});c(o,s.triggerWorkflow);}),n.command("duplicate").description("Duplicate a workflow version under a new key").argument("<workflowKey>","Source workflow key").argument("<version>","Source version").requiredOption("--new-key <key>","Workflow key for the copy").option("--new-version <version>","Version for the copy").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o,r)=>{let s={newWorkflowKey:R(r.newKey,"--new-key")};r.newVersion&&(s.newVersion=r.newVersion);let d=await a(ue,{workflowKey:t,version:o,input:s});if(!d.duplicateWorkflow.success)throw new u(d.duplicateWorkflow.message??"Duplicate failed.");c(r,d.duplicateWorkflow.workflow??d.duplicateWorkflow);});let e=[["publish","Publish a workflow definition version",ie,"publishWorkflow"],["activate","Make a workflow definition version the active one",se,"activateWorkflowDefinition"],["deactivate","Deactivate a workflow definition version",ae,"deactivateWorkflowDefinition"],["archive","Archive a workflow definition version",de,"archiveWorkflow"]];for(let[t,o,r,s]of e)n.command(t).description(o).argument("<id>","Workflow definition ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(d,m)=>{let g=(await a(r,{id:d}))[s];if(!g)throw new u(`Workflow ${d}: ${t} returned no result.`);l(`Workflow ${g.workflowKey}@${g.version}: ${g.status}`),c(m,g);});n.command("import").description("Import a workflow from a store template (ImportWorkflowTemplateInput JSON)").argument("<file>","Path to the template input JSON").option("--name <name>","Override the workflow name").option("--description <text>","Override the description").option("--icon <icon>","Override the icon").option("--category <category>","Override the category").option("--project-id <id>","Scope to a project").option("--source-template-id <id>","Source template ID (lineage)").option("--context <json>","Context metadata as a JSON object").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,o)=>{let r={...h(t)},s=R(o.name,"--name"),d=R(o.projectId,"--project-id"),m=R(o.sourceTemplateId,"--source-template-id");s!==void 0&&(r.name=s),o.description!==void 0&&(r.description=o.description),o.icon!==void 0&&(r.icon=o.icon),o.category!==void 0&&(r.category=o.category),d!==void 0&&(r.projectId=d),m!==void 0&&(r.sourceTemplateId=m),o.context!==void 0&&(r.context=x(o.context,"--context"));let C=await a(ce,{input:r});if(!C.importWorkflowTemplate.success)throw new u(C.importWorkflowTemplate.message??"Import failed.");l("Workflow imported"),c(o,C.importWorkflowTemplate.workflow??C.importWorkflowTemplate);});}var It=100;function Qe(i){return {headers:["ID","Workflow","Version","Status","Progress","Started","Completed"],rows:i.map(n=>[w(n.id,12),n.workflowKey,n.version,n.status,`${Math.round(n.progress)}%`,k(n.startedAt),k(n.completedAt)])}}async function L(i){let n=await a(pe,{id:i});return b(n.workflowRun,"Run",i)}function Tt(i){return He.some(n=>n===i.toUpperCase())}async function St(i,n,e,t,o){if(t===0)return [];let r=[],s=new Set,d=0,m=0;for(;r.length<t;){let g=(await a(_,{input:{workflowKey:n,status:e,limit:It,offset:d}})).workflowRuns;if(g.items.length===0){if(g.hasMore)throw new u("Run listing returned an empty page before the end.");break}for(let $ of g.items)if(!($.workflowId!==i||s.has($.id))){if(s.add($.id),m<o){m++;continue}if(r.push($),r.length===t)break}if(d+=g.items.length,!g.hasMore)break}return r}function Ot(i,n,e){let t=e.filter(d=>d.nodeId===n);if(t.length===0)throw new u(`Node ${n} not found in run ${i} (NOT_FOUND)`);let o=t.filter(d=>["FAILED","TIMEOUT"].includes(d.status.toUpperCase()));if(o.length===0)throw new u(`Node ${n} is not failed in run ${i} (INVALID_STATE)`);let[r,...s]=o;if(!r||s.length>0)throw new u(`Node ${n} is ambiguous in run ${i}; retry a specific node state.`);return r}function Rt(i){return new Promise(n=>setTimeout(n,i))}function Xe(i){let n=i.command("runs").description("FluidGrids workflow runs");n.command("list").description("List workflow runs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${q.join("|")})`).option("--workflow-key <key>","Filter by workflow key").option("--workflow-id <id>","Filter by exact workflow definition ID (scans all pages)").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=p(e.limit,"--limit"),o=p(e.offset,"--offset"),r=y(e.status,"--status",q);if(e.workflowId&&e.workflowKey)throw new u("Use either --workflow-id or --workflow-key, not both.");if(e.workflowId){let m=await a(D,{id:e.workflowId}),C=b(m.workflowDefinition,"Workflow",e.workflowId),g=await St(e.workflowId,C.workflowKey,r,t,o);c(e,g,Qe(g));return}let s={limit:t,offset:o};r&&(s.status=r),e.workflowKey&&(s.workflowKey=e.workflowKey);let d=await a(_,{input:s});c(e,d.workflowRuns.items,Qe(d.workflowRuns.items));}),n.command("get").description("Get a run (with node states)").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{c(t,await L(e));}),n.command("cancel").description("Cancel a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(me,{id:e});l(`Run ${e}: ${o.cancelWorkflowRun.status}`),c(t,o.cancelWorkflowRun);}),n.command("pause").description("Pause a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(ge,{id:e});l(`Run ${e}: ${o.pauseWorkflowRun.status}`),c(t,o.pauseWorkflowRun);}),n.command("resume").description("Resume a paused or waiting run").argument("<id>","Run ID").option("--payload <json>","JSON object delivered to the waiting node").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=t.payload===void 0?void 0:x(t.payload,"--payload"),r=await a(we,{id:e,payload:o});if(!r.resumeWorkflowRun.success)throw new u(r.resumeWorkflowRun.message);c(t,r.resumeWorkflowRun);}),n.command("wait").description("Poll a run until it reaches a terminal status").argument("<id>","Run ID").option("--timeout <ms>","Give up after this many milliseconds","300000").option("--poll-interval <ms>","Delay between polls in milliseconds","1000").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=p(t.timeout,"--timeout"),r=p(t.pollInterval,"--poll-interval"),s=Date.now(),d=await L(e);for(;!Tt(d.status);){if(Date.now()-s>o)throw new u(`Timed out waiting for run ${e} (last status ${d.status}).`);await Rt(r),d=await L(e);}c(t,d);}),n.command("logs").description("Get run logs (one cursor page)").argument("<id>","Run ID").option("--level <level>",`Minimum level (${G.join("|")})`).option("--node-id <id>","Only this graph node").option("--search <text>","Only lines containing this text").option("--include-child-runs","Include sub-workflow runs").option("--limit <n>","Page size, 1 to 1000").option("--after <cursor>","Continue after a nextCursor from an earlier page").option("--page-info","Print the whole page (lines + cursor) instead of only lines").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=y(t.level,"--level",G),r=t.limit===void 0?void 0:p(t.limit,"--limit");if(r!==void 0&&(r<1||r>1e3))throw new u(`Invalid value '${t.limit}' for --limit: expected 1 to 1000.`);if(t.after!==void 0&&!t.after.trim())throw new u("--after cursor cannot be empty.");let d=(await a(fe,{runId:e,nodeId:t.nodeId,minLevel:o,limit:r,after:t.after,search:t.search,includeChildRuns:t.includeChildRuns})).workflowRunLogs;if(t.pageInfo){c(t,d);return}c(t,d.lines,{headers:["Time","Level","Node","Message"],rows:d.lines.map(m=>[k(m.timestamp),m.level,m.nodeId??"-",w(m.message,100)])});}),n.command("retry-node").description("Retry one failed node of a run (run ID + graph node ID)").argument("<runId>","Run ID").argument("<nodeId>","Graph node ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=await L(e),s=Ot(e,t,r.nodeStates??[]),d=await a(ye,{id:s.id,nodeId:t});l(`Node ${t} retry: ${d.retryNode.status}`),c(o,d.retryNode);});}function Ze(i){let n=i.command("nodes").description("FluidGrids node catalogue");n.command("list").description("List node endpoint configurations").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-t, --node-type <type>","Filter by node type").option("--publish-type <type>",`Filter by publish type (${J.join("|")})`).option("--status <status>",`Filter by status (${M.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let o=(await a(he,{nodeType:e.nodeType,publishType:y(e.publishType,"--publish-type",J),status:y(e.status,"--status",M),pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).nodeEndpointConfigs.configs;c(e,o,{headers:["Type","Version","Name","Category","Publish","Status","Latest"],rows:o.map(r=>[r.nodeType,r.nodeVersion,r.name,r.category??"-",r.publishType,r.status,r.isLatest?"yes":"no"])});}),n.command("get").description("Get a node endpoint configuration by type and version").argument("<nodeType>","Node type").argument("<nodeVersion>","Node version").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=await a(be,{nodeType:e,nodeVersion:t});c(o,b(r.nodeEndpointConfig,"Node",`${e}@${t}`));});}var At=/^[A-Za-z_][A-Za-z0-9_]*$/;async function $t(i,n=process.stdin,e=process.stderr){if(!n.isTTY)throw new u("A terminal is required to prompt for a secret.");let t=new stream.Writable({write(r,s,d){d();}}),o=readline.createInterface({input:n,output:t,terminal:true});e.write(`${i}: `);try{return await new Promise(r=>{o.question("",r);})}finally{o.close(),e.write(`
|
|
401
|
+
`);}}async function et(i,n,e,t=process.env,o=$t){if(i!==void 0){if(!At.test(i))throw new u(`Invalid environment variable name for ${e}.`);let s=t[i];if(!s?.trim())throw new u(`The environment variable selected by ${e} is empty or unset.`);return s}if(!process.stdin.isTTY)throw new u(`An interactive terminal or ${e} is required to supply ${n}.`);let r=await o(n);if(!r.trim())throw new u(`${n} cannot be empty.`);return r}async function tt(i,n,e){try{let o=(await a(i,{input:e}))[n];if(o===void 0)throw new Error("empty response");return o}catch{throw new u("Connection authentication failed; verify the connection and secret.")}}function ot(i){let n=i.command("credentials").description("FluidGrids credentials (integration connections)");n.command("list").description("List credentials").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-p, --provider-id <id>","Filter by provider ID").option("-s, --status <status>",`Filter by status (${B.join("|")})`).option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t={};e.providerId&&(t.providerId=e.providerId);let o=y(e.status,"--status",B);o&&(t.status=o),e.search&&(t.search=e.search);let s=(await a(Ee,{filter:Object.keys(t).length>0?t:void 0,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).getConnections.items;c(e,s,{headers:["ID","Name","Provider","Status","Last used"],rows:s.map(d=>[w(d.id,12),d.name,d.provider?.key??d.providerId,d.status,k(d.lastUsedAt)])});}),n.command("get").description("Get a credential").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Ce,{id:e});c(t,b(o.getConnection,"Credential",e));}),n.command("types").description("List the credential types (integration providers) you can create").option("-l, --limit <n>","Page size","50").option("-o, --offset <n>","Offset","0").option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ie,{filter:e.search?{search:e.search}:void 0,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}}),o=t.getProviders.items;c(e,t.getProviders,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:o.map(r=>[w(r.id,12),r.key,r.name,r.category,r.authType,r.isEnabled?"yes":"no"])});}),n.command("create").description("Create a credential shell from a CreateConnectionInput JSON file (no secrets; attach one with auth-api-key / auth-basic)").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(Te,{input:o});l(`Credential created: ${r.createConnection.id}`),c(t,r.createConnection);}),n.command("update").description("Update a credential (name, description, config) from a JSON file").argument("<id>","Credential (connection) ID").argument("<file>","Path to the UpdateConnectionInput JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(ve,{id:e,input:r});l("Credential updated"),c(o,s.updateConnection);}),n.command("delete").description("Delete a credential (the vault secret is kept unless --delete-vault-secret)").argument("<id>","Credential (connection) ID").option("--delete-vault-secret","Also delete the backing vault secret").option("--force","Skip the confirmation prompt").action(async(e,t)=>{if(await I(`Delete credential ${e}?`,t.force),!(await a(xe,{id:e,deleteVaultSecret:t.deleteVaultSecret?true:void 0})).deleteConnection)throw new u(`Credential ${e} was not deleted.`);l(`Credential ${e} deleted`);}),n.command("test").description("Test a credential against its provider").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Ae,{connectionId:e});c(t,o.testConnection);}),n.command("auth-api-key").description("Attach a provider API key to a credential (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").option("--api-key-env <name>","Read the API key from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await et(t.apiKeyEnv,"API key","--api-key-env"),r=await tt(Oe,"authenticateWithApiKey",{connectionId:e,apiKey:o});l(`Credential ${e}: ${r.status}`),c(t,r);}),n.command("auth-basic").description("Attach provider basic-auth credentials (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").argument("<username>","Provider username").option("--password-env <name>","Read the password from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{if(!t.trim())throw new u("Provider username cannot be empty.");let r=await et(o.passwordEnv,"Password","--password-env"),s=await tt(Re,"authenticateWithBasicAuth",{connectionId:e,username:t,password:r});l(`Credential ${e}: ${s.status}`),c(o,s);});}function nt(i){let n=i.command("webhooks").description("FluidGrids inbound webhooks (event registrations)");n.command("list").description("List webhooks").option("--workflow-key <key>","Filter by workflow key").option("-s, --status <status>",`Filter by status (${V.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a($e,{status:y(e.status,"--status",V),workflowKey:e.workflowKey});c(e,t.eventRegistrations,{headers:["ID","Name","Workflow","Trigger node","Status","Triggers","Last"],rows:t.eventRegistrations.map(o=>[w(o.id,12),o.name??"-",o.workflowKey,o.triggerNodeId,o.isActive?o.status:`${o.status} (inactive)`,String(o.totalTriggers),k(o.lastTriggeredAt)])});}),n.command("get").description("Get a webhook").argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(De,{id:e});c(t,b(o.eventRegistration,"Webhook",e));}),n.command("create").description("Create a webhook from a CreateEventRegistrationInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(We,{input:o});l(`Webhook created: ${r.createEventRegistration.id}`),c(t,r.createEventRegistration);}),n.command("update").description("Update a webhook from an UpdateEventRegistrationInput JSON file").argument("<id>","Event registration ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(Le,{id:e,input:r});l("Webhook updated"),c(o,s.updateEventRegistration);}),n.command("delete").description("Delete a webhook").argument("<id>","Event registration ID").option("--force","Skip the confirmation prompt").action(async(e,t)=>{if(await I(`Delete webhook ${e}?`,t.force),!(await a(Ne,{id:e})).deleteEventRegistration)throw new u(`Webhook ${e} was not deleted.`);l(`Webhook ${e} deleted`);});for(let[e,t]of [["activate",true],["deactivate",false]])n.command(e).description(`${t?"Activate":"Deactivate"} a webhook`).argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,r)=>{let s=await a(Fe,{id:o,isActive:t});l(`Webhook ${o} ${t?"activated":"deactivated"}`),c(r,s.toggleEventRegistration);});}function Y(i){if(!i.success)throw new u(i.message||"Scheduled job update failed.");return i}function rt(i){let n=i.command("scheduled-jobs").description("FluidGrids scheduled workflow runs (cron)");n.command("list").description("List scheduled jobs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("--workflow-key <key>","Filter by workflow key").option("--enabled","Only enabled jobs").option("--disabled","Only disabled jobs").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{if(e.enabled&&e.disabled)throw new u("Use either --enabled or --disabled, not both.");let o=(await a(_e,{enabled:e.enabled?true:e.disabled?false:void 0,workflowKey:e.workflowKey,pagination:{limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")}})).workflowScheduledJobs.jobs;c(e,o,{headers:["ID","Name","Workflow","Version","Schedule","Enabled","Next run"],rows:o.map(r=>[w(r.id,12),r.name,r.workflowKey,r.version,r.schedule,r.enabled?"yes":"no",k(r.nextRun)])});}),n.command("get").description("Get a scheduled job").argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=await a(Pe,{jobId:e});c(t,b(o.workflowScheduledJob,"Scheduled job",e));}),n.command("create").description("Create a scheduled job from a ScheduledJobInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{let o=h(e),r=await a(je,{input:o}),s=Y(r.createWorkflowScheduledJob);l(s.message||"Scheduled job created"),c(t,s.job??s);}),n.command("update").description("Update a scheduled job from a WorkflowUpdateScheduledJobInput JSON file").argument("<jobId>","Scheduled job ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t,o)=>{let r=h(t),s=await a(U,{jobId:e,input:r}),d=Y(s.updateWorkflowScheduledJob);l(d.message||"Scheduled job updated"),c(o,d.job??d);}),n.command("delete").description("Delete a scheduled job").argument("<jobId>","Scheduled job ID").option("--force","Skip the confirmation prompt").action(async(e,t)=>{await I(`Delete scheduled job ${e}?`,t.force);let o=await a(Ue,{jobId:e});if(!o.deleteWorkflowScheduledJob.success)throw new u(o.deleteWorkflowScheduledJob.message||"Delete failed.");l(`Scheduled job ${e} deleted`);});for(let[e,t]of [["pause",false],["resume",true]])n.command(e).description(`${t?"Resume":"Pause"} a scheduled job`).argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,r)=>{let s=await a(U,{jobId:o,input:{enabled:t}}),d=Y(s.updateWorkflowScheduledJob);l(`Scheduled job ${o} ${t?"resumed":"paused"}`),c(r,d.job??d);});}function it(i,n){if(Number.isNaN(Date.parse(i)))throw new u(`Invalid value '${i}' for ${n}: expected an ISO 8601 date.`);return i}function st(i){let n=i.command("dashboard").description("FluidGrids dashboard metrics");n.command("summary").description("Workflow, run and node counters (incl. 24h / 7d / 30d windows)").option("-p, --project <id>","Scope to a project").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ke,{projectId:e.project});c(e,t.dashboardSummary);}),n.command("usage").description("Workflow and node execution metrics for a date range").requiredOption("--start <date>","Range start (ISO 8601)").requiredOption("--end <date>","Range end (ISO 8601)").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=it(e.start,"--start"),o=it(e.end,"--end");if(Date.parse(t)>Date.parse(o))throw new u("--start must not be after --end.");let r=await a(qe,{input:{startDate:t,endDate:o}});c(e,r.usageMetrics);});}function at(i){i.command("search").description("Search FluidGrids workflows, runs, nodes").command("query").description("Search across FluidGrids entities").argument("<query>","Search text").option("-t, --type <type>",`Restrict to one entity type (${H.join("|")})`).option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,t)=>{if(!e.trim())throw new u("Search text cannot be empty.");let o=y(t.type,"--type",H),r=p(t.limit,"--limit"),s=p(t.offset,"--offset"),d=o?(await a(Me,{entityType:o,query:e,limit:r,offset:s})).searchByEntityType:(await a(Je,{input:{query:e,limit:r,offset:s}})).search;c(t,d);});}function ut(i){i.command("admin").description("FluidGrids administration").command("system-info").description("Deployment information (version, revision, environment) of the workflow service").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let t=await a(Ve);c(e,t.systemConfig);});}var Dt={id:"fluidgrids",version:"1.0.0",displayName:"FluidGrids",dependsOn:["auth","workspaces"],register(i,n){X(n),ze(i),Xe(i),Ze(i),ot(i),nt(i),rt(i),st(i),at(i),ut(i);}},$n=Dt;module.exports=$n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,b,
|
|
1
|
+
import {a,b,i,k as k$1,q as q$1,r,s}from'../../chunk-O6UCQ5IT.js';import {o}from'../../chunk-YIY5IDXQ.js';import {readFileSync}from'fs';import {createInterface}from'readline';import {Writable}from'stream';var E=`
|
|
2
2
|
id workflowKey name description version status category tags icon isActive
|
|
3
3
|
totalVersions projectId createdAt updatedAt
|
|
4
4
|
`,q=`
|
|
@@ -397,5 +397,5 @@ import {a,b,h as h$1,i,o as o$1,p as p$1,q as q$1}from'../../chunk-W4JZR7RJ.js';
|
|
|
397
397
|
query FluidgridsSystemConfig {
|
|
398
398
|
systemConfig { version revision environment deploymentType hostname hostIp }
|
|
399
399
|
}
|
|
400
|
-
`;function p(r,i){if(!/^\d+$/.test(r))throw new o(`Invalid value '${r}' for ${i}: expected a non-negative integer.`);let t=Number(r);if(!Number.isSafeInteger(t))throw new o(`Invalid value '${r}' for ${i}: expected a non-negative integer.`);return t}function w(r,i,t){if(r===void 0)return;let e=t.find(o=>o===r);if(e===void 0)throw new o(`Invalid value '${r}' for ${i}. Allowed: ${t.join(", ")}`);return e}function C(r,i){let t;try{t=JSON.parse(r);}catch{throw new o(`${i} must be valid JSON.`)}if(!re(t))throw new o(`${i} must be a JSON object.`);return t}function k(r){let i;try{i=readFileSync(r,"utf8");}catch(t){let e=t instanceof Error?t.message:String(t);throw new o(`Cannot read ${r}: ${e}`)}return C(i,r)}function T(r,i){if(r!==void 0){if(!r.trim())throw new o(`${i} cannot be empty.`);return r}}function h(r,i,t){if(r==null)throw new o(`${i} ${t} not found (NOT_FOUND)`);return r}function re(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Jt(r,i=[]){return [...i,r]}async function I(r,i){if(!await q$1(r,i))throw new o("Aborted: nothing was changed.")}var U=["DRAFT","ACTIVE","ARCHIVED","DEPRECATED"],j=["PENDING","RUNNING","WAITING","COMPLETED","FAILED","CANCELLED","TERMINATED"],Mt=["COMPLETED","FAILED","CANCELLED","TERMINATED"],K=["DEBUG","INFO","WARN","ERROR"],P=["BUILTIN","CUSTOM","STORE"],J=["AVAILABLE","DEPRECATED","DISABLED"],M=["ACTIVE","PAUSED","DISABLED","ARCHIVED"],G=["ACTIVE","INACTIVE","PENDING_AUTH","ERROR","EXPIRED","REVOKED"],V=["workflow","run","node","event"];function Gt(r){return {headers:["ID","Key","Name","Version","Status","Active","Updated"],rows:r.map(i=>[p$1(i.id,12),i.workflowKey,p$1(i.name,32),i.version,i.status,i.isActive?"yes":"no",o$1(i.updatedAt)])}}function Vt(r){let i$1=r.command("workflows").description("FluidGrids workflow definitions");i$1.command("list").description("List workflow definitions").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${U.join("|")})`).option("--category <category>","Filter by category").option("--tag <tag>","Filter by tag (repeatable)",Jt).option("--latest-only","Only the latest version of each workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let o={limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")},n=w(e.status,"--status",U);n&&(o.status=n),e.category&&(o.category=e.category),e.tag?.length&&(o.tags=e.tag),e.latestOnly&&(o.latestOnly=true);let s=await b(q,{input:o});h$1(e,s.workflowDefinitions.items,Gt(s.workflowDefinitions.items));}),i$1.command("get").description("Get a workflow definition by ID, or by key with --key").argument("[id]","Workflow definition ID").option("--key <workflowKey>","Look up by workflow key instead of ID").option("--wf-version <version>","Version to fetch with --key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1)=>{if(!e&&!o$1.key)throw new o("Pass a workflow ID or --key <workflowKey>.");if(e&&o$1.key)throw new o("Pass either a workflow ID or --key, not both.");let n=await b(v,e?{id:e}:{workflowKey:o$1.key,version:o$1.wfVersion});h$1(o$1,h(n.workflowDefinition,"Workflow",e??o$1.key??""));}),i$1.command("versions").description("List every stored version of a workflow key").argument("<workflowKey>","Workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n=await b(Y,{workflowKey:e});h$1(o,n.workflowVersions,Gt(n.workflowVersions));}),i$1.command("create").description("Create a workflow definition from a CreateWorkflowDefinitionInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n=k(e),s=await b(z,{input:n});i(`Workflow created: ${s.createWorkflowDefinition.workflowKey}`),h$1(o,s.createWorkflowDefinition);}),i$1.command("update").description("Update a workflow definition from an UpdateWorkflowDefinitionInput JSON file").argument("<id>","Workflow definition ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o,n)=>{let s=k(o),d=await b(Z,{id:e,input:s});i("Workflow updated"),h$1(n,d.updateWorkflowDefinition);}),i$1.command("delete").description("Delete a workflow (every version, or one with --wf-version)").argument("<workflowKey>","Workflow key").option("--wf-version <version>","Delete only this version").option("--force","Skip the confirmation prompt").action(async(e,o$1)=>{let n=o$1.wfVersion?`${e}@${o$1.wfVersion}`:`${e} (all versions)`;if(await I(`Delete workflow ${n}?`,o$1.force),!(await b(Q,{workflowKey:e,version:o$1.wfVersion})).deleteWorkflowDefinition)throw new o(`Workflow ${n} was not deleted.`);i(`Workflow ${n} deleted`);}),i$1.command("trigger").description("Trigger a workflow run").argument("<workflowKey>","Workflow key").requiredOption("--wf-version <version>","Workflow version").requiredOption("--trigger-node <id>","Trigger node ID").option("-i, --input <json>","Trigger data as a JSON object").option("--stop-at-node <id>","Stop the run after this node").option("--test","Run in TEST mode instead of PRODUCTION").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n={workflowKey:e,version:T(o.wfVersion,"--wf-version"),triggerNodeId:T(o.triggerNode,"--trigger-node")};o.input!==void 0&&(n.triggerData=C(o.input,"--input")),o.stopAtNode&&(n.stopAtNodeId=o.stopAtNode),o.test&&(n.mode="TEST");let s=await b(X,{input:n});h$1(o,s.triggerWorkflow);}),i$1.command("duplicate").description("Duplicate a workflow version under a new key").argument("<workflowKey>","Source workflow key").argument("<version>","Source version").requiredOption("--new-key <key>","Workflow key for the copy").option("--new-version <version>","Version for the copy").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1,n)=>{let s={newWorkflowKey:T(n.newKey,"--new-key")};n.newVersion&&(s.newVersion=n.newVersion);let d=await b(nt,{workflowKey:e,version:o$1,input:s});if(!d.duplicateWorkflow.success)throw new o(d.duplicateWorkflow.message??"Duplicate failed.");h$1(n,d.duplicateWorkflow.workflow??d.duplicateWorkflow);});let t=[["publish","Publish a workflow definition version",tt,"publishWorkflow"],["activate","Make a workflow definition version the active one",et,"activateWorkflowDefinition"],["deactivate","Deactivate a workflow definition version",ot,"deactivateWorkflowDefinition"],["archive","Archive a workflow definition version",it,"archiveWorkflow"]];for(let[e,o$1,n,s]of t)i$1.command(e).description(o$1).argument("<id>","Workflow definition ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(d,f)=>{let m=(await b(n,{id:d}))[s];if(!m)throw new o(`Workflow ${d}: ${e} returned no result.`);i(`Workflow ${m.workflowKey}@${m.version}: ${m.status}`),h$1(f,m);});i$1.command("import").description("Import a workflow from a store template (ImportWorkflowTemplateInput JSON)").argument("<file>","Path to the template input JSON").option("--name <name>","Override the workflow name").option("--description <text>","Override the description").option("--icon <icon>","Override the icon").option("--category <category>","Override the category").option("--project-id <id>","Scope to a project").option("--source-template-id <id>","Source template ID (lineage)").option("--context <json>","Context metadata as a JSON object").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1)=>{let n={...k(e)},s=T(o$1.name,"--name"),d=T(o$1.projectId,"--project-id"),f=T(o$1.sourceTemplateId,"--source-template-id");s!==void 0&&(n.name=s),o$1.description!==void 0&&(n.description=o$1.description),o$1.icon!==void 0&&(n.icon=o$1.icon),o$1.category!==void 0&&(n.category=o$1.category),d!==void 0&&(n.projectId=d),f!==void 0&&(n.sourceTemplateId=f),o$1.context!==void 0&&(n.context=C(o$1.context,"--context"));let S=await b(rt,{input:n});if(!S.importWorkflowTemplate.success)throw new o(S.importWorkflowTemplate.message??"Import failed.");i("Workflow imported"),h$1(o$1,S.importWorkflowTemplate.workflow??S.importWorkflowTemplate);});}var se=100;function Bt(r){return {headers:["ID","Workflow","Version","Status","Progress","Started","Completed"],rows:r.map(i=>[p$1(i.id,12),i.workflowKey,i.version,i.status,`${Math.round(i.progress)}%`,o$1(i.startedAt),o$1(i.completedAt)])}}async function A(r){let i=await b(at,{id:r});return h(i.workflowRun,"Run",r)}function ae(r){return Mt.some(i=>i===r.toUpperCase())}async function de(r,i,t,e,o$1){if(e===0)return [];let n=[],s=new Set,d=0,f=0;for(;n.length<e;){let m=(await b(F,{input:{workflowKey:i,status:t,limit:se,offset:d}})).workflowRuns;if(m.items.length===0){if(m.hasMore)throw new o("Run listing returned an empty page before the end.");break}for(let D of m.items)if(!(D.workflowId!==r||s.has(D.id))){if(s.add(D.id),f<o$1){f++;continue}if(n.push(D),n.length===e)break}if(d+=m.items.length,!m.hasMore)break}return n}function le(r,i,t){let e=t.filter(d=>d.nodeId===i);if(e.length===0)throw new o(`Node ${i} not found in run ${r} (NOT_FOUND)`);let o$1=e.filter(d=>["FAILED","TIMEOUT"].includes(d.status.toUpperCase()));if(o$1.length===0)throw new o(`Node ${i} is not failed in run ${r} (INVALID_STATE)`);let[n,...s]=o$1;if(!n||s.length>0)throw new o(`Node ${i} is ambiguous in run ${r}; retry a specific node state.`);return n}function ue(r){return new Promise(i=>setTimeout(i,r))}function Ht(r){let i$1=r.command("runs").description("FluidGrids workflow runs");i$1.command("list").description("List workflow runs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${j.join("|")})`).option("--workflow-key <key>","Filter by workflow key").option("--workflow-id <id>","Filter by exact workflow definition ID (scans all pages)").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=p(t.limit,"--limit"),o$1=p(t.offset,"--offset"),n=w(t.status,"--status",j);if(t.workflowId&&t.workflowKey)throw new o("Use either --workflow-id or --workflow-key, not both.");if(t.workflowId){let f=await b(v,{id:t.workflowId}),S=h(f.workflowDefinition,"Workflow",t.workflowId),m=await de(t.workflowId,S.workflowKey,n,e,o$1);h$1(t,m,Bt(m));return}let s={limit:e,offset:o$1};n&&(s.status=n),t.workflowKey&&(s.workflowKey=t.workflowKey);let d=await b(F,{input:s});h$1(t,d.workflowRuns.items,Bt(d.workflowRuns.items));}),i$1.command("get").description("Get a run (with node states)").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{h$1(e,await A(t));}),i$1.command("cancel").description("Cancel a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(lt,{id:t});i(`Run ${t}: ${o.cancelWorkflowRun.status}`),h$1(e,o.cancelWorkflowRun);}),i$1.command("pause").description("Pause a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(ut,{id:t});i(`Run ${t}: ${o.pauseWorkflowRun.status}`),h$1(e,o.pauseWorkflowRun);}),i$1.command("resume").description("Resume a paused or waiting run").argument("<id>","Run ID").option("--payload <json>","JSON object delivered to the waiting node").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$1=e.payload===void 0?void 0:C(e.payload,"--payload"),n=await b(ct,{id:t,payload:o$1});if(!n.resumeWorkflowRun.success)throw new o(n.resumeWorkflowRun.message);h$1(e,n.resumeWorkflowRun);}),i$1.command("wait").description("Poll a run until it reaches a terminal status").argument("<id>","Run ID").option("--timeout <ms>","Give up after this many milliseconds","300000").option("--poll-interval <ms>","Delay between polls in milliseconds","1000").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$1=p(e.timeout,"--timeout"),n=p(e.pollInterval,"--poll-interval"),s=Date.now(),d=await A(t);for(;!ae(d.status);){if(Date.now()-s>o$1)throw new o(`Timed out waiting for run ${t} (last status ${d.status}).`);await ue(n),d=await A(t);}h$1(e,d);}),i$1.command("logs").description("Get run logs (one cursor page)").argument("<id>","Run ID").option("--level <level>",`Minimum level (${K.join("|")})`).option("--node-id <id>","Only this graph node").option("--search <text>","Only lines containing this text").option("--include-child-runs","Include sub-workflow runs").option("--limit <n>","Page size, 1 to 1000").option("--after <cursor>","Continue after a nextCursor from an earlier page").option("--page-info","Print the whole page (lines + cursor) instead of only lines").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$2=w(e.level,"--level",K),n=e.limit===void 0?void 0:p(e.limit,"--limit");if(n!==void 0&&(n<1||n>1e3))throw new o(`Invalid value '${e.limit}' for --limit: expected 1 to 1000.`);if(e.after!==void 0&&!e.after.trim())throw new o("--after cursor cannot be empty.");let d=(await b(dt,{runId:t,nodeId:e.nodeId,minLevel:o$2,limit:n,after:e.after,search:e.search,includeChildRuns:e.includeChildRuns})).workflowRunLogs;if(e.pageInfo){h$1(e,d);return}h$1(e,d.lines,{headers:["Time","Level","Node","Message"],rows:d.lines.map(f=>[o$1(f.timestamp),f.level,f.nodeId??"-",p$1(f.message,100)])});}),i$1.command("retry-node").description("Retry one failed node of a run (run ID + graph node ID)").argument("<runId>","Run ID").argument("<nodeId>","Graph node ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=await A(t),s=le(t,e,n.nodeStates??[]),d=await b(pt,{id:s.id,nodeId:e});i(`Node ${e} retry: ${d.retryNode.status}`),h$1(o,d.retryNode);});}function qt(r){let i=r.command("nodes").description("FluidGrids node catalogue");i.command("list").description("List node endpoint configurations").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-t, --node-type <type>","Filter by node type").option("--publish-type <type>",`Filter by publish type (${P.join("|")})`).option("--status <status>",`Filter by status (${J.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let o=(await b(mt,{nodeType:t.nodeType,publishType:w(t.publishType,"--publish-type",P),status:w(t.status,"--status",J),pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).nodeEndpointConfigs.configs;h$1(t,o,{headers:["Type","Version","Name","Category","Publish","Status","Latest"],rows:o.map(n=>[n.nodeType,n.nodeVersion,n.name,n.category??"-",n.publishType,n.status,n.isLatest?"yes":"no"])});}),i.command("get").description("Get a node endpoint configuration by type and version").argument("<nodeType>","Node type").argument("<nodeVersion>","Node version").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=await b(gt,{nodeType:t,nodeVersion:e});h$1(o,h(n.nodeEndpointConfig,"Node",`${t}@${e}`));});}var fe=/^[A-Za-z_][A-Za-z0-9_]*$/;async function me(r,i=process.stdin,t=process.stderr){if(!i.isTTY)throw new o("A terminal is required to prompt for a secret.");let e=new Writable({write(n,s,d){d();}}),o$1=createInterface({input:i,output:e,terminal:true});t.write(`${r}: `);try{return await new Promise(n=>{o$1.question("",n);})}finally{o$1.close(),t.write(`
|
|
401
|
-
`);}}async function Yt(r,i,t,e=process.env,o$1=me){if(r!==void 0){if(!fe.test(r))throw new o(`Invalid environment variable name for ${t}.`);let s=e[r];if(!s?.trim())throw new o(`The environment variable selected by ${t} is empty or unset.`);return s}if(!process.stdin.isTTY)throw new o(`An interactive terminal or ${t} is required to supply ${i}.`);let n=await o$1(i);if(!n.trim())throw new o(`${i} cannot be empty.`);return n}async function zt(r,i,t){try{let o=(await b(r,{input:t}))[i];if(o===void 0)throw new Error("empty response");return o}catch{throw new o("Connection authentication failed; verify the connection and secret.")}}function Zt(r){let i$1=r.command("credentials").description("FluidGrids credentials (integration connections)");i$1.command("list").description("List credentials").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-p, --provider-id <id>","Filter by provider ID").option("-s, --status <status>",`Filter by status (${G.join("|")})`).option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e={};t.providerId&&(e.providerId=t.providerId);let o=w(t.status,"--status",G);o&&(e.status=o),t.search&&(e.search=t.search);let s=(await b(wt,{filter:Object.keys(e).length>0?e:void 0,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).getConnections.items;h$1(t,s,{headers:["ID","Name","Provider","Status","Last used"],rows:s.map(d=>[p$1(d.id,12),d.name,d.provider?.key??d.providerId,d.status,o$1(d.lastUsedAt)])});}),i$1.command("get").description("Get a credential").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(yt,{id:t});h$1(e,h(o.getConnection,"Credential",t));}),i$1.command("types").description("List the credential types (integration providers) you can create").option("-l, --limit <n>","Page size","50").option("-o, --offset <n>","Offset","0").option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(kt,{filter:t.search?{search:t.search}:void 0,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}}),o=e.getProviders.items;h$1(t,e.getProviders,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:o.map(n=>[p$1(n.id,12),n.key,n.name,n.category,n.authType,n.isEnabled?"yes":"no"])});}),i$1.command("create").description("Create a credential shell from a CreateConnectionInput JSON file (no secrets; attach one with auth-api-key / auth-basic)").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b(ht,{input:o});i(`Credential created: ${n.createConnection.id}`),h$1(e,n.createConnection);}),i$1.command("update").description("Update a credential (name, description, config) from a JSON file").argument("<id>","Credential (connection) ID").argument("<file>","Path to the UpdateConnectionInput JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(St,{id:t,input:n});i("Credential updated"),h$1(o,s.updateConnection);}),i$1.command("delete").description("Delete a credential (the vault secret is kept unless --delete-vault-secret)").argument("<id>","Credential (connection) ID").option("--delete-vault-secret","Also delete the backing vault secret").option("--force","Skip the confirmation prompt").action(async(t,e)=>{if(await I(`Delete credential ${t}?`,e.force),!(await b(It,{id:t,deleteVaultSecret:e.deleteVaultSecret?true:void 0})).deleteConnection)throw new o(`Credential ${t} was not deleted.`);i(`Credential ${t} deleted`);}),i$1.command("test").description("Test a credential against its provider").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Ot,{connectionId:t});h$1(e,o.testConnection);}),i$1.command("auth-api-key").description("Attach a provider API key to a credential (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").option("--api-key-env <name>","Read the API key from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await Yt(e.apiKeyEnv,"API key","--api-key-env"),n=await zt(Rt,"authenticateWithApiKey",{connectionId:t,apiKey:o});i(`Credential ${t}: ${n.status}`),h$1(e,n);}),i$1.command("auth-basic").description("Attach provider basic-auth credentials (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").argument("<username>","Provider username").option("--password-env <name>","Read the password from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o$1)=>{if(!e.trim())throw new o("Provider username cannot be empty.");let n=await Yt(o$1.passwordEnv,"Password","--password-env"),s=await zt(bt,"authenticateWithBasicAuth",{connectionId:t,username:e,password:n});i(`Credential ${t}: ${s.status}`),h$1(o$1,s);});}function Qt(r){let i$1=r.command("webhooks").description("FluidGrids inbound webhooks (event registrations)");i$1.command("list").description("List webhooks").option("--workflow-key <key>","Filter by workflow key").option("-s, --status <status>",`Filter by status (${M.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(Tt,{status:w(t.status,"--status",M),workflowKey:t.workflowKey});h$1(t,e.eventRegistrations,{headers:["ID","Name","Workflow","Trigger node","Status","Triggers","Last"],rows:e.eventRegistrations.map(o=>[p$1(o.id,12),o.name??"-",o.workflowKey,o.triggerNodeId,o.isActive?o.status:`${o.status} (inactive)`,String(o.totalTriggers),o$1(o.lastTriggeredAt)])});}),i$1.command("get").description("Get a webhook").argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Ct,{id:t});h$1(e,h(o.eventRegistration,"Webhook",t));}),i$1.command("create").description("Create a webhook from a CreateEventRegistrationInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b($t,{input:o});i(`Webhook created: ${n.createEventRegistration.id}`),h$1(e,n.createEventRegistration);}),i$1.command("update").description("Update a webhook from an UpdateEventRegistrationInput JSON file").argument("<id>","Event registration ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(Dt,{id:t,input:n});i("Webhook updated"),h$1(o,s.updateEventRegistration);}),i$1.command("delete").description("Delete a webhook").argument("<id>","Event registration ID").option("--force","Skip the confirmation prompt").action(async(t,e)=>{if(await I(`Delete webhook ${t}?`,e.force),!(await b(vt,{id:t})).deleteEventRegistration)throw new o(`Webhook ${t} was not deleted.`);i(`Webhook ${t} deleted`);});for(let[t,e]of [["activate",true],["deactivate",false]])i$1.command(t).description(`${e?"Activate":"Deactivate"} a webhook`).argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,n)=>{let s=await b(Wt,{id:o,isActive:e});i(`Webhook ${o} ${e?"activated":"deactivated"}`),h$1(n,s.toggleEventRegistration);});}function B(r){if(!r.success)throw new o(r.message||"Scheduled job update failed.");return r}function Xt(r){let i$1=r.command("scheduled-jobs").description("FluidGrids scheduled workflow runs (cron)");i$1.command("list").description("List scheduled jobs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("--workflow-key <key>","Filter by workflow key").option("--enabled","Only enabled jobs").option("--disabled","Only disabled jobs").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{if(t.enabled&&t.disabled)throw new o("Use either --enabled or --disabled, not both.");let o$2=(await b(At,{enabled:t.enabled?true:t.disabled?false:void 0,workflowKey:t.workflowKey,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).workflowScheduledJobs.jobs;h$1(t,o$2,{headers:["ID","Name","Workflow","Version","Schedule","Enabled","Next run"],rows:o$2.map(n=>[p$1(n.id,12),n.name,n.workflowKey,n.version,n.schedule,n.enabled?"yes":"no",o$1(n.nextRun)])});}),i$1.command("get").description("Get a scheduled job").argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Nt,{jobId:t});h$1(e,h(o.workflowScheduledJob,"Scheduled job",t));}),i$1.command("create").description("Create a scheduled job from a ScheduledJobInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b(Ft,{input:o}),s=B(n.createWorkflowScheduledJob);i(s.message||"Scheduled job created"),h$1(e,s.job??s);}),i$1.command("update").description("Update a scheduled job from a WorkflowUpdateScheduledJobInput JSON file").argument("<jobId>","Scheduled job ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(x,{jobId:t,input:n}),d=B(s.updateWorkflowScheduledJob);i(d.message||"Scheduled job updated"),h$1(o,d.job??d);}),i$1.command("delete").description("Delete a scheduled job").argument("<jobId>","Scheduled job ID").option("--force","Skip the confirmation prompt").action(async(t,e)=>{await I(`Delete scheduled job ${t}?`,e.force);let o$1=await b(Lt,{jobId:t});if(!o$1.deleteWorkflowScheduledJob.success)throw new o(o$1.deleteWorkflowScheduledJob.message||"Delete failed.");i(`Scheduled job ${t} deleted`);});for(let[t,e]of [["pause",false],["resume",true]])i$1.command(t).description(`${e?"Resume":"Pause"} a scheduled job`).argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,n)=>{let s=await b(x,{jobId:o,input:{enabled:e}}),d=B(s.updateWorkflowScheduledJob);i(`Scheduled job ${o} ${e?"resumed":"paused"}`),h$1(n,d.job??d);});}function te(r,i){if(Number.isNaN(Date.parse(r)))throw new o(`Invalid value '${r}' for ${i}: expected an ISO 8601 date.`);return r}function ee(r){let i=r.command("dashboard").description("FluidGrids dashboard metrics");i.command("summary").description("Workflow, run and node counters (incl. 24h / 7d / 30d windows)").option("-p, --project <id>","Scope to a project").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(_t,{projectId:t.project});h$1(t,e.dashboardSummary);}),i.command("usage").description("Workflow and node execution metrics for a date range").requiredOption("--start <date>","Range start (ISO 8601)").requiredOption("--end <date>","Range end (ISO 8601)").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=te(t.start,"--start"),o$1=te(t.end,"--end");if(Date.parse(e)>Date.parse(o$1))throw new o("--start must not be after --end.");let n=await b(xt,{input:{startDate:e,endDate:o$1}});h$1(t,n.usageMetrics);});}function oe(r){r.command("search").description("Search FluidGrids workflows, runs, nodes").command("query").description("Search across FluidGrids entities").argument("<query>","Search text").option("-t, --type <type>",`Restrict to one entity type (${V.join("|")})`).option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{if(!t.trim())throw new o("Search text cannot be empty.");let o$1=w(e.type,"--type",V),n=p(e.limit,"--limit"),s=p(e.offset,"--offset"),d=o$1?(await b(Kt,{entityType:o$1,query:t,limit:n,offset:s})).searchByEntityType:(await b(jt,{input:{query:t,limit:n,offset:s}})).search;h$1(e,d);});}function ne(r){r.command("admin").description("FluidGrids administration").command("system-info").description("Deployment information (version, revision, environment) of the workflow service").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(Pt);h$1(t,e.systemConfig);});}var ge={id:"fluidgrids",version:"1.0.0",displayName:"FluidGrids",dependsOn:["auth","workspaces"],register(r,i){a(i),Vt(r),Ht(r),qt(r),Zt(r),Qt(r),Xt(r),ee(r),oe(r),ne(r);}},uo=ge;export{uo as default};
|
|
400
|
+
`;function p(r,i){if(!/^\d+$/.test(r))throw new o(`Invalid value '${r}' for ${i}: expected a non-negative integer.`);let t=Number(r);if(!Number.isSafeInteger(t))throw new o(`Invalid value '${r}' for ${i}: expected a non-negative integer.`);return t}function w(r,i,t){if(r===void 0)return;let e=t.find(o=>o===r);if(e===void 0)throw new o(`Invalid value '${r}' for ${i}. Allowed: ${t.join(", ")}`);return e}function C(r,i){let t;try{t=JSON.parse(r);}catch{throw new o(`${i} must be valid JSON.`)}if(!re(t))throw new o(`${i} must be a JSON object.`);return t}function k(r){let i;try{i=readFileSync(r,"utf8");}catch(t){let e=t instanceof Error?t.message:String(t);throw new o(`Cannot read ${r}: ${e}`)}return C(i,r)}function T(r,i){if(r!==void 0){if(!r.trim())throw new o(`${i} cannot be empty.`);return r}}function h(r,i,t){if(r==null)throw new o(`${i} ${t} not found (NOT_FOUND)`);return r}function re(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}function Jt(r,i=[]){return [...i,r]}async function I(r,i){if(!await s(r,i))throw new o("Aborted: nothing was changed.")}var U=["DRAFT","ACTIVE","ARCHIVED","DEPRECATED"],j=["PENDING","RUNNING","WAITING","COMPLETED","FAILED","CANCELLED","TERMINATED"],Mt=["COMPLETED","FAILED","CANCELLED","TERMINATED"],K=["DEBUG","INFO","WARN","ERROR"],P=["BUILTIN","CUSTOM","STORE"],J=["AVAILABLE","DEPRECATED","DISABLED"],M=["ACTIVE","PAUSED","DISABLED","ARCHIVED"],G=["ACTIVE","INACTIVE","PENDING_AUTH","ERROR","EXPIRED","REVOKED"],V=["workflow","run","node","event"];function Gt(r$1){return {headers:["ID","Key","Name","Version","Status","Active","Updated"],rows:r$1.map(i=>[r(i.id,12),i.workflowKey,r(i.name,32),i.version,i.status,i.isActive?"yes":"no",q$1(i.updatedAt)])}}function Vt(r){let i$1=r.command("workflows").description("FluidGrids workflow definitions");i$1.command("list").description("List workflow definitions").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${U.join("|")})`).option("--category <category>","Filter by category").option("--tag <tag>","Filter by tag (repeatable)",Jt).option("--latest-only","Only the latest version of each workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async e=>{let o={limit:p(e.limit,"--limit"),offset:p(e.offset,"--offset")},n=w(e.status,"--status",U);n&&(o.status=n),e.category&&(o.category=e.category),e.tag?.length&&(o.tags=e.tag),e.latestOnly&&(o.latestOnly=true);let s=await b(q,{input:o});i(e,s.workflowDefinitions.items,Gt(s.workflowDefinitions.items));}),i$1.command("get").description("Get a workflow definition by ID, or by key with --key").argument("[id]","Workflow definition ID").option("--key <workflowKey>","Look up by workflow key instead of ID").option("--wf-version <version>","Version to fetch with --key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1)=>{if(!e&&!o$1.key)throw new o("Pass a workflow ID or --key <workflowKey>.");if(e&&o$1.key)throw new o("Pass either a workflow ID or --key, not both.");let n=await b(v,e?{id:e}:{workflowKey:o$1.key,version:o$1.wfVersion});i(o$1,h(n.workflowDefinition,"Workflow",e??o$1.key??""));}),i$1.command("versions").description("List every stored version of a workflow key").argument("<workflowKey>","Workflow key").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n=await b(Y,{workflowKey:e});i(o,n.workflowVersions,Gt(n.workflowVersions));}),i$1.command("create").description("Create a workflow definition from a CreateWorkflowDefinitionInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n=k(e),s=await b(z,{input:n});k$1(`Workflow created: ${s.createWorkflowDefinition.workflowKey}`),i(o,s.createWorkflowDefinition);}),i$1.command("update").description("Update a workflow definition from an UpdateWorkflowDefinitionInput JSON file").argument("<id>","Workflow definition ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o,n)=>{let s=k(o),d=await b(Z,{id:e,input:s});k$1("Workflow updated"),i(n,d.updateWorkflowDefinition);}),i$1.command("delete").description("Delete a workflow (every version, or one with --wf-version)").argument("<workflowKey>","Workflow key").option("--wf-version <version>","Delete only this version").option("--force","Skip the confirmation prompt").action(async(e,o$1)=>{let n=o$1.wfVersion?`${e}@${o$1.wfVersion}`:`${e} (all versions)`;if(await I(`Delete workflow ${n}?`,o$1.force),!(await b(Q,{workflowKey:e,version:o$1.wfVersion})).deleteWorkflowDefinition)throw new o(`Workflow ${n} was not deleted.`);k$1(`Workflow ${n} deleted`);}),i$1.command("trigger").description("Trigger a workflow run").argument("<workflowKey>","Workflow key").requiredOption("--wf-version <version>","Workflow version").requiredOption("--trigger-node <id>","Trigger node ID").option("-i, --input <json>","Trigger data as a JSON object").option("--stop-at-node <id>","Stop the run after this node").option("--test","Run in TEST mode instead of PRODUCTION").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o)=>{let n={workflowKey:e,version:T(o.wfVersion,"--wf-version"),triggerNodeId:T(o.triggerNode,"--trigger-node")};o.input!==void 0&&(n.triggerData=C(o.input,"--input")),o.stopAtNode&&(n.stopAtNodeId=o.stopAtNode),o.test&&(n.mode="TEST");let s=await b(X,{input:n});i(o,s.triggerWorkflow);}),i$1.command("duplicate").description("Duplicate a workflow version under a new key").argument("<workflowKey>","Source workflow key").argument("<version>","Source version").requiredOption("--new-key <key>","Workflow key for the copy").option("--new-version <version>","Version for the copy").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1,n)=>{let s={newWorkflowKey:T(n.newKey,"--new-key")};n.newVersion&&(s.newVersion=n.newVersion);let d=await b(nt,{workflowKey:e,version:o$1,input:s});if(!d.duplicateWorkflow.success)throw new o(d.duplicateWorkflow.message??"Duplicate failed.");i(n,d.duplicateWorkflow.workflow??d.duplicateWorkflow);});let t=[["publish","Publish a workflow definition version",tt,"publishWorkflow"],["activate","Make a workflow definition version the active one",et,"activateWorkflowDefinition"],["deactivate","Deactivate a workflow definition version",ot,"deactivateWorkflowDefinition"],["archive","Archive a workflow definition version",it,"archiveWorkflow"]];for(let[e,o$1,n,s]of t)i$1.command(e).description(o$1).argument("<id>","Workflow definition ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(d,f)=>{let m=(await b(n,{id:d}))[s];if(!m)throw new o(`Workflow ${d}: ${e} returned no result.`);k$1(`Workflow ${m.workflowKey}@${m.version}: ${m.status}`),i(f,m);});i$1.command("import").description("Import a workflow from a store template (ImportWorkflowTemplateInput JSON)").argument("<file>","Path to the template input JSON").option("--name <name>","Override the workflow name").option("--description <text>","Override the description").option("--icon <icon>","Override the icon").option("--category <category>","Override the category").option("--project-id <id>","Scope to a project").option("--source-template-id <id>","Source template ID (lineage)").option("--context <json>","Context metadata as a JSON object").option("-f, --format <format>","Output format (json, table, yaml)").action(async(e,o$1)=>{let n={...k(e)},s=T(o$1.name,"--name"),d=T(o$1.projectId,"--project-id"),f=T(o$1.sourceTemplateId,"--source-template-id");s!==void 0&&(n.name=s),o$1.description!==void 0&&(n.description=o$1.description),o$1.icon!==void 0&&(n.icon=o$1.icon),o$1.category!==void 0&&(n.category=o$1.category),d!==void 0&&(n.projectId=d),f!==void 0&&(n.sourceTemplateId=f),o$1.context!==void 0&&(n.context=C(o$1.context,"--context"));let S=await b(rt,{input:n});if(!S.importWorkflowTemplate.success)throw new o(S.importWorkflowTemplate.message??"Import failed.");k$1("Workflow imported"),i(o$1,S.importWorkflowTemplate.workflow??S.importWorkflowTemplate);});}var se=100;function Bt(r$1){return {headers:["ID","Workflow","Version","Status","Progress","Started","Completed"],rows:r$1.map(i=>[r(i.id,12),i.workflowKey,i.version,i.status,`${Math.round(i.progress)}%`,q$1(i.startedAt),q$1(i.completedAt)])}}async function A(r){let i=await b(at,{id:r});return h(i.workflowRun,"Run",r)}function ae(r){return Mt.some(i=>i===r.toUpperCase())}async function de(r,i,t,e,o$1){if(e===0)return [];let n=[],s=new Set,d=0,f=0;for(;n.length<e;){let m=(await b(F,{input:{workflowKey:i,status:t,limit:se,offset:d}})).workflowRuns;if(m.items.length===0){if(m.hasMore)throw new o("Run listing returned an empty page before the end.");break}for(let D of m.items)if(!(D.workflowId!==r||s.has(D.id))){if(s.add(D.id),f<o$1){f++;continue}if(n.push(D),n.length===e)break}if(d+=m.items.length,!m.hasMore)break}return n}function le(r,i,t){let e=t.filter(d=>d.nodeId===i);if(e.length===0)throw new o(`Node ${i} not found in run ${r} (NOT_FOUND)`);let o$1=e.filter(d=>["FAILED","TIMEOUT"].includes(d.status.toUpperCase()));if(o$1.length===0)throw new o(`Node ${i} is not failed in run ${r} (INVALID_STATE)`);let[n,...s]=o$1;if(!n||s.length>0)throw new o(`Node ${i} is ambiguous in run ${r}; retry a specific node state.`);return n}function ue(r){return new Promise(i=>setTimeout(i,r))}function Ht(r$1){let i$1=r$1.command("runs").description("FluidGrids workflow runs");i$1.command("list").description("List workflow runs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-s, --status <status>",`Filter by status (${j.join("|")})`).option("--workflow-key <key>","Filter by workflow key").option("--workflow-id <id>","Filter by exact workflow definition ID (scans all pages)").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=p(t.limit,"--limit"),o$1=p(t.offset,"--offset"),n=w(t.status,"--status",j);if(t.workflowId&&t.workflowKey)throw new o("Use either --workflow-id or --workflow-key, not both.");if(t.workflowId){let f=await b(v,{id:t.workflowId}),S=h(f.workflowDefinition,"Workflow",t.workflowId),m=await de(t.workflowId,S.workflowKey,n,e,o$1);i(t,m,Bt(m));return}let s={limit:e,offset:o$1};n&&(s.status=n),t.workflowKey&&(s.workflowKey=t.workflowKey);let d=await b(F,{input:s});i(t,d.workflowRuns.items,Bt(d.workflowRuns.items));}),i$1.command("get").description("Get a run (with node states)").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{i(e,await A(t));}),i$1.command("cancel").description("Cancel a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(lt,{id:t});k$1(`Run ${t}: ${o.cancelWorkflowRun.status}`),i(e,o.cancelWorkflowRun);}),i$1.command("pause").description("Pause a run").argument("<id>","Run ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(ut,{id:t});k$1(`Run ${t}: ${o.pauseWorkflowRun.status}`),i(e,o.pauseWorkflowRun);}),i$1.command("resume").description("Resume a paused or waiting run").argument("<id>","Run ID").option("--payload <json>","JSON object delivered to the waiting node").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$1=e.payload===void 0?void 0:C(e.payload,"--payload"),n=await b(ct,{id:t,payload:o$1});if(!n.resumeWorkflowRun.success)throw new o(n.resumeWorkflowRun.message);i(e,n.resumeWorkflowRun);}),i$1.command("wait").description("Poll a run until it reaches a terminal status").argument("<id>","Run ID").option("--timeout <ms>","Give up after this many milliseconds","300000").option("--poll-interval <ms>","Delay between polls in milliseconds","1000").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$1=p(e.timeout,"--timeout"),n=p(e.pollInterval,"--poll-interval"),s=Date.now(),d=await A(t);for(;!ae(d.status);){if(Date.now()-s>o$1)throw new o(`Timed out waiting for run ${t} (last status ${d.status}).`);await ue(n),d=await A(t);}i(e,d);}),i$1.command("logs").description("Get run logs (one cursor page)").argument("<id>","Run ID").option("--level <level>",`Minimum level (${K.join("|")})`).option("--node-id <id>","Only this graph node").option("--search <text>","Only lines containing this text").option("--include-child-runs","Include sub-workflow runs").option("--limit <n>","Page size, 1 to 1000").option("--after <cursor>","Continue after a nextCursor from an earlier page").option("--page-info","Print the whole page (lines + cursor) instead of only lines").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o$1=w(e.level,"--level",K),n=e.limit===void 0?void 0:p(e.limit,"--limit");if(n!==void 0&&(n<1||n>1e3))throw new o(`Invalid value '${e.limit}' for --limit: expected 1 to 1000.`);if(e.after!==void 0&&!e.after.trim())throw new o("--after cursor cannot be empty.");let d=(await b(dt,{runId:t,nodeId:e.nodeId,minLevel:o$1,limit:n,after:e.after,search:e.search,includeChildRuns:e.includeChildRuns})).workflowRunLogs;if(e.pageInfo){i(e,d);return}i(e,d.lines,{headers:["Time","Level","Node","Message"],rows:d.lines.map(f=>[q$1(f.timestamp),f.level,f.nodeId??"-",r(f.message,100)])});}),i$1.command("retry-node").description("Retry one failed node of a run (run ID + graph node ID)").argument("<runId>","Run ID").argument("<nodeId>","Graph node ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=await A(t),s=le(t,e,n.nodeStates??[]),d=await b(pt,{id:s.id,nodeId:e});k$1(`Node ${e} retry: ${d.retryNode.status}`),i(o,d.retryNode);});}function qt(r){let i$1=r.command("nodes").description("FluidGrids node catalogue");i$1.command("list").description("List node endpoint configurations").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-t, --node-type <type>","Filter by node type").option("--publish-type <type>",`Filter by publish type (${P.join("|")})`).option("--status <status>",`Filter by status (${J.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let o=(await b(mt,{nodeType:t.nodeType,publishType:w(t.publishType,"--publish-type",P),status:w(t.status,"--status",J),pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).nodeEndpointConfigs.configs;i(t,o,{headers:["Type","Version","Name","Category","Publish","Status","Latest"],rows:o.map(n=>[n.nodeType,n.nodeVersion,n.name,n.category??"-",n.publishType,n.status,n.isLatest?"yes":"no"])});}),i$1.command("get").description("Get a node endpoint configuration by type and version").argument("<nodeType>","Node type").argument("<nodeVersion>","Node version").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=await b(gt,{nodeType:t,nodeVersion:e});i(o,h(n.nodeEndpointConfig,"Node",`${t}@${e}`));});}var fe=/^[A-Za-z_][A-Za-z0-9_]*$/;async function me(r,i=process.stdin,t=process.stderr){if(!i.isTTY)throw new o("A terminal is required to prompt for a secret.");let e=new Writable({write(n,s,d){d();}}),o$1=createInterface({input:i,output:e,terminal:true});t.write(`${r}: `);try{return await new Promise(n=>{o$1.question("",n);})}finally{o$1.close(),t.write(`
|
|
401
|
+
`);}}async function Yt(r,i,t,e=process.env,o$1=me){if(r!==void 0){if(!fe.test(r))throw new o(`Invalid environment variable name for ${t}.`);let s=e[r];if(!s?.trim())throw new o(`The environment variable selected by ${t} is empty or unset.`);return s}if(!process.stdin.isTTY)throw new o(`An interactive terminal or ${t} is required to supply ${i}.`);let n=await o$1(i);if(!n.trim())throw new o(`${i} cannot be empty.`);return n}async function zt(r,i,t){try{let o=(await b(r,{input:t}))[i];if(o===void 0)throw new Error("empty response");return o}catch{throw new o("Connection authentication failed; verify the connection and secret.")}}function Zt(r$1){let i$1=r$1.command("credentials").description("FluidGrids credentials (integration connections)");i$1.command("list").description("List credentials").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-p, --provider-id <id>","Filter by provider ID").option("-s, --status <status>",`Filter by status (${G.join("|")})`).option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e={};t.providerId&&(e.providerId=t.providerId);let o=w(t.status,"--status",G);o&&(e.status=o),t.search&&(e.search=t.search);let s=(await b(wt,{filter:Object.keys(e).length>0?e:void 0,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).getConnections.items;i(t,s,{headers:["ID","Name","Provider","Status","Last used"],rows:s.map(d=>[r(d.id,12),d.name,d.provider?.key??d.providerId,d.status,q$1(d.lastUsedAt)])});}),i$1.command("get").description("Get a credential").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(yt,{id:t});i(e,h(o.getConnection,"Credential",t));}),i$1.command("types").description("List the credential types (integration providers) you can create").option("-l, --limit <n>","Page size","50").option("-o, --offset <n>","Offset","0").option("--search <text>","Filter by name").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(kt,{filter:t.search?{search:t.search}:void 0,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}}),o=e.getProviders.items;i(t,e.getProviders,{headers:["ID","Key","Name","Category","Auth","Enabled"],rows:o.map(n=>[r(n.id,12),n.key,n.name,n.category,n.authType,n.isEnabled?"yes":"no"])});}),i$1.command("create").description("Create a credential shell from a CreateConnectionInput JSON file (no secrets; attach one with auth-api-key / auth-basic)").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b(ht,{input:o});k$1(`Credential created: ${n.createConnection.id}`),i(e,n.createConnection);}),i$1.command("update").description("Update a credential (name, description, config) from a JSON file").argument("<id>","Credential (connection) ID").argument("<file>","Path to the UpdateConnectionInput JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(St,{id:t,input:n});k$1("Credential updated"),i(o,s.updateConnection);}),i$1.command("delete").description("Delete a credential (the vault secret is kept unless --delete-vault-secret)").argument("<id>","Credential (connection) ID").option("--delete-vault-secret","Also delete the backing vault secret").option("--force","Skip the confirmation prompt").action(async(t,e)=>{if(await I(`Delete credential ${t}?`,e.force),!(await b(It,{id:t,deleteVaultSecret:e.deleteVaultSecret?true:void 0})).deleteConnection)throw new o(`Credential ${t} was not deleted.`);k$1(`Credential ${t} deleted`);}),i$1.command("test").description("Test a credential against its provider").argument("<id>","Credential (connection) ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Ot,{connectionId:t});i(e,o.testConnection);}),i$1.command("auth-api-key").description("Attach a provider API key to a credential (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").option("--api-key-env <name>","Read the API key from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await Yt(e.apiKeyEnv,"API key","--api-key-env"),n=await zt(Rt,"authenticateWithApiKey",{connectionId:t,apiKey:o});k$1(`Credential ${t}: ${n.status}`),i(e,n);}),i$1.command("auth-basic").description("Attach provider basic-auth credentials (hidden prompt or named env var)").argument("<id>","Credential (connection) ID").argument("<username>","Provider username").option("--password-env <name>","Read the password from this environment variable").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o$1)=>{if(!e.trim())throw new o("Provider username cannot be empty.");let n=await Yt(o$1.passwordEnv,"Password","--password-env"),s=await zt(bt,"authenticateWithBasicAuth",{connectionId:t,username:e,password:n});k$1(`Credential ${t}: ${s.status}`),i(o$1,s);});}function Qt(r$1){let i$1=r$1.command("webhooks").description("FluidGrids inbound webhooks (event registrations)");i$1.command("list").description("List webhooks").option("--workflow-key <key>","Filter by workflow key").option("-s, --status <status>",`Filter by status (${M.join("|")})`).option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(Tt,{status:w(t.status,"--status",M),workflowKey:t.workflowKey});i(t,e.eventRegistrations,{headers:["ID","Name","Workflow","Trigger node","Status","Triggers","Last"],rows:e.eventRegistrations.map(o=>[r(o.id,12),o.name??"-",o.workflowKey,o.triggerNodeId,o.isActive?o.status:`${o.status} (inactive)`,String(o.totalTriggers),q$1(o.lastTriggeredAt)])});}),i$1.command("get").description("Get a webhook").argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Ct,{id:t});i(e,h(o.eventRegistration,"Webhook",t));}),i$1.command("create").description("Create a webhook from a CreateEventRegistrationInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b($t,{input:o});k$1(`Webhook created: ${n.createEventRegistration.id}`),i(e,n.createEventRegistration);}),i$1.command("update").description("Update a webhook from an UpdateEventRegistrationInput JSON file").argument("<id>","Event registration ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(Dt,{id:t,input:n});k$1("Webhook updated"),i(o,s.updateEventRegistration);}),i$1.command("delete").description("Delete a webhook").argument("<id>","Event registration ID").option("--force","Skip the confirmation prompt").action(async(t,e)=>{if(await I(`Delete webhook ${t}?`,e.force),!(await b(vt,{id:t})).deleteEventRegistration)throw new o(`Webhook ${t} was not deleted.`);k$1(`Webhook ${t} deleted`);});for(let[t,e]of [["activate",true],["deactivate",false]])i$1.command(t).description(`${e?"Activate":"Deactivate"} a webhook`).argument("<id>","Event registration ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,n)=>{let s=await b(Wt,{id:o,isActive:e});k$1(`Webhook ${o} ${e?"activated":"deactivated"}`),i(n,s.toggleEventRegistration);});}function B(r){if(!r.success)throw new o(r.message||"Scheduled job update failed.");return r}function Xt(r$1){let i$1=r$1.command("scheduled-jobs").description("FluidGrids scheduled workflow runs (cron)");i$1.command("list").description("List scheduled jobs").option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("--workflow-key <key>","Filter by workflow key").option("--enabled","Only enabled jobs").option("--disabled","Only disabled jobs").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{if(t.enabled&&t.disabled)throw new o("Use either --enabled or --disabled, not both.");let o$1=(await b(At,{enabled:t.enabled?true:t.disabled?false:void 0,workflowKey:t.workflowKey,pagination:{limit:p(t.limit,"--limit"),offset:p(t.offset,"--offset")}})).workflowScheduledJobs.jobs;i(t,o$1,{headers:["ID","Name","Workflow","Version","Schedule","Enabled","Next run"],rows:o$1.map(n=>[r(n.id,12),n.name,n.workflowKey,n.version,n.schedule,n.enabled?"yes":"no",q$1(n.nextRun)])});}),i$1.command("get").description("Get a scheduled job").argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=await b(Nt,{jobId:t});i(e,h(o.workflowScheduledJob,"Scheduled job",t));}),i$1.command("create").description("Create a scheduled job from a ScheduledJobInput JSON file").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{let o=k(t),n=await b(Ft,{input:o}),s=B(n.createWorkflowScheduledJob);k$1(s.message||"Scheduled job created"),i(e,s.job??s);}),i$1.command("update").description("Update a scheduled job from a WorkflowUpdateScheduledJobInput JSON file").argument("<jobId>","Scheduled job ID").argument("<file>","Path to the input JSON").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e,o)=>{let n=k(e),s=await b(x,{jobId:t,input:n}),d=B(s.updateWorkflowScheduledJob);k$1(d.message||"Scheduled job updated"),i(o,d.job??d);}),i$1.command("delete").description("Delete a scheduled job").argument("<jobId>","Scheduled job ID").option("--force","Skip the confirmation prompt").action(async(t,e)=>{await I(`Delete scheduled job ${t}?`,e.force);let o$1=await b(Lt,{jobId:t});if(!o$1.deleteWorkflowScheduledJob.success)throw new o(o$1.deleteWorkflowScheduledJob.message||"Delete failed.");k$1(`Scheduled job ${t} deleted`);});for(let[t,e]of [["pause",false],["resume",true]])i$1.command(t).description(`${e?"Resume":"Pause"} a scheduled job`).argument("<jobId>","Scheduled job ID").option("-f, --format <format>","Output format (json, table, yaml)").action(async(o,n)=>{let s=await b(x,{jobId:o,input:{enabled:e}}),d=B(s.updateWorkflowScheduledJob);k$1(`Scheduled job ${o} ${e?"resumed":"paused"}`),i(n,d.job??d);});}function te(r,i){if(Number.isNaN(Date.parse(r)))throw new o(`Invalid value '${r}' for ${i}: expected an ISO 8601 date.`);return r}function ee(r){let i$1=r.command("dashboard").description("FluidGrids dashboard metrics");i$1.command("summary").description("Workflow, run and node counters (incl. 24h / 7d / 30d windows)").option("-p, --project <id>","Scope to a project").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(_t,{projectId:t.project});i(t,e.dashboardSummary);}),i$1.command("usage").description("Workflow and node execution metrics for a date range").requiredOption("--start <date>","Range start (ISO 8601)").requiredOption("--end <date>","Range end (ISO 8601)").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=te(t.start,"--start"),o$1=te(t.end,"--end");if(Date.parse(e)>Date.parse(o$1))throw new o("--start must not be after --end.");let n=await b(xt,{input:{startDate:e,endDate:o$1}});i(t,n.usageMetrics);});}function oe(r){r.command("search").description("Search FluidGrids workflows, runs, nodes").command("query").description("Search across FluidGrids entities").argument("<query>","Search text").option("-t, --type <type>",`Restrict to one entity type (${V.join("|")})`).option("-l, --limit <n>","Page size","20").option("-o, --offset <n>","Offset","0").option("-f, --format <format>","Output format (json, table, yaml)").action(async(t,e)=>{if(!t.trim())throw new o("Search text cannot be empty.");let o$1=w(e.type,"--type",V),n=p(e.limit,"--limit"),s=p(e.offset,"--offset"),d=o$1?(await b(Kt,{entityType:o$1,query:t,limit:n,offset:s})).searchByEntityType:(await b(jt,{input:{query:t,limit:n,offset:s}})).search;i(e,d);});}function ne(r){r.command("admin").description("FluidGrids administration").command("system-info").description("Deployment information (version, revision, environment) of the workflow service").option("-f, --format <format>","Output format (json, table, yaml)").action(async t=>{let e=await b(Pt);i(t,e.systemConfig);});}var ge={id:"fluidgrids",version:"1.0.0",displayName:"FluidGrids",dependsOn:["auth","workspaces"],register(r,i){a(i),Vt(r),Ht(r),qt(r),Zt(r),Qt(r),Xt(r),ee(r),oe(r),ne(r);}},uo=ge;export{uo as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';require('graphql-request'),require('cross-fetch');var commander=require('commander');var p=class extends Error{exitCode;hint;constructor(r,t){super(r),this.name="CliUserError",this.exitCode=t?.exitCode??1,this.hint=t?.hint;}},
|
|
1
|
+
'use strict';require('graphql-request'),require('cross-fetch');var commander=require('commander');var p=class extends Error{exitCode;hint;constructor(r,t){super(r),this.name="CliUserError",this.exitCode=t?.exitCode??1,this.hint=t?.hint;}},f=class extends p{constructor(r,t){super(r,{exitCode:2,hint:t?.hint??"Run `<product> auth login` to authenticate."}),this.name="CliAuthError";}},l=class extends Error{cause;constructor(r,t){super(r),this.name="CliInternalError",this.cause=t;}};var k=null;function x(o){k=o;}function y(){if(!k)throw new l("vibecontrols module helpers used before setHelpersContext was called");return k}function dt(){let o=y();if(!o.auth.isAuthenticated())throw new f("Authentication required.",{hint:`Run \`${o.productName} auth login\` to authenticate.`})}async function i(o,r){return dt(),y().gql.workspace.request(o,r)}function s(o){let r=o instanceof Error?o.message:String(o);throw new p(r)}function a(o,r,t){y().output.formatAndOutput(o,r,t);}function m(o){y().output.printSuccess(o);}function h(o){return y().output.formatDate(o)}function d(o,r){return y().output.truncate(o,r)}var I=`
|
|
2
2
|
query GgnomadGetProvider($id: ID!) {
|
|
3
3
|
ggnomadProvider(id: $id) {
|
|
4
4
|
id name type description status website contactEmail contactPhone
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
query GgnomadListFavorites($pagination: PaginationInput) {
|
|
121
121
|
ggnomadFavorites(pagination: $pagination)
|
|
122
122
|
}
|
|
123
|
-
`,
|
|
123
|
+
`,B=`
|
|
124
124
|
mutation GgnomadToggleFavorite($input: ToggleGgnomadFavoriteInput!) {
|
|
125
125
|
toggleGgnomadFavorite(input: $input)
|
|
126
126
|
}
|
|
127
|
-
`,
|
|
127
|
+
`,V=`
|
|
128
128
|
query GgnomadAnalytics {
|
|
129
129
|
ggnomadAnalytics {
|
|
130
130
|
totalUsers totalBookings totalRevenue conversionRate
|
|
@@ -137,4 +137,4 @@
|
|
|
137
137
|
users listings bookings monthlyRevenue
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
`;function M(o,r){try{return JSON.parse(r)}catch{throw new p(`--${o} must be valid JSON`)}}function c(o){let r=Number.parseInt(o,10);if(Number.isNaN(r))throw new p(`Expected an integer but got "${o}"`);return r}function w(o){let r=Number.parseFloat(o);if(Number.isNaN(r))throw new p(`Expected a number but got "${o}"`);return r}function j(o){let r=o.command("providers").description("GGNomad providers");r.command("list").description("List providers").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(b,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadProviders,{headers:["ID","Name","Type","Status","Rating","Listings"],rows:n.ggnomadProviders.map(e=>[d(e.id,12),e.name,e.type,e.status,`${e.rating??0} (${e.reviewCount??0})`,String(e.listingCount??0)])});}catch(n){s(n);}}),r.command("get").description("Get a provider by id").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(x,{id:t});if(!e.ggnomadProvider)throw new p(`Provider ${t} not found`);a(n,e.ggnomadProvider);}catch(e){s(e);}}),r.command("create").description("Create a provider").requiredOption("--name <name>","Provider name").addOption(new commander.Option("--type <t>","Provider type").choices(["HOTEL_OPERATOR","TOUR_OPERATOR","ACTIVITY_PROVIDER","TRANSPORT_PROVIDER","EVENT_ORGANIZER"]).makeOptionMandatory()).option("--description <s>","Description").option("--website <url>","Website URL").option("--contact-email <email>","Contact email").option("--contact-phone <phone>","Contact phone").option("-f, --format <format>","Output format").action(async t=>{try{let n={name:t.name,type:t.type};t.description&&(n.description=t.description),t.website&&(n.website=t.website),t.contactEmail&&(n.contactEmail=t.contactEmail),t.contactPhone&&(n.contactPhone=t.contactPhone);let e=await i(E,{input:n});m(`Provider created: ${e.createGgnomadProvider.name}`),a(t,e.createGgnomadProvider);}catch(n){s(n);}});}function z(o){let r=o.command("properties").description("GGNomad stay properties");r.command("list").description("List properties").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(A,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadProperties,{headers:["ID","Name","Type","Status","Price/Night","Guests","Rating"],rows:n.ggnomadProperties.map(e=>[d(e.id,12),e.name,e.type,e.status,`${e.pricePerNight??0} ${e.currency??""}`.trim(),String(e.maxGuests??0),`${e.rating??0} (${e.reviewCount??0})`])});}catch(n){s(n);}}),r.command("get").description("Get a property by id").argument("<id>","Property ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(O,{id:t});if(!e.ggnomadProperty)throw new p(`Property ${t} not found`);a(n,e.ggnomadProperty);}catch(e){s(e);}}),r.command("create").description("Create a property").requiredOption("--name <name>","Property name").requiredOption("--type <t>","Property type").requiredOption("--address <json>","Address JSON").requiredOption("--max-guests <n>","Maximum guests",c).requiredOption("--price-per-night <n>","Price per night",w).requiredOption("--amenities <csv>","Comma-separated amenities").requiredOption("--images <csv>","Comma-separated image URLs").option("--provider <id>","Provider ID").option("--description <s>","Description").option("--bedrooms <n>","Bedrooms",c).option("--bathrooms <n>","Bathrooms",c).option("--check-in-time <s>","Check-in time").option("--check-out-time <s>","Check-out time").option("--currency <c>","Currency code").option("-f, --format <format>","Output format").action(async t=>{try{let n={name:t.name,type:t.type,address:M("address",t.address),maxGuests:t.maxGuests,pricePerNight:t.pricePerNight,amenities:t.amenities.split(",").map(C=>C.trim()),images:t.images.split(",").map(C=>C.trim())};t.provider&&(n.providerId=t.provider),t.description&&(n.description=t.description),t.bedrooms!==void 0&&(n.bedrooms=t.bedrooms),t.bathrooms!==void 0&&(n.bathrooms=t.bathrooms),t.checkInTime&&(n.checkInTime=t.checkInTime),t.checkOutTime&&(n.checkOutTime=t.checkOutTime),t.currency&&(n.currency=t.currency);let e=await i(P,{input:n});m(`Property created: ${e.createGgnomadProperty.name}`),a(t,e.createGgnomadProperty);}catch(n){s(n);}});}function Y(o){let r=o.command("activities").description("GGNomad activities");r.command("list").description("List activities").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(S,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadActivities,{headers:["ID","Name","Category","Difficulty","Duration","Price","Status"],rows:n.ggnomadActivities.map(e=>[d(e.id,12),e.name,e.category,e.difficulty??"-",e.duration??"-",`${e.price??0} ${e.currency??""}`.trim(),e.status])});}catch(n){s(n);}}),r.command("get").description("Get an activity by id").argument("<id>","Activity ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(R,{id:t});if(!e.ggnomadActivity)throw new p(`Activity ${t} not found`);a(n,e.ggnomadActivity);}catch(e){s(e);}});}function H(o){let r=o.command("events").description("GGNomad events");r.command("list").description("List events").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i($,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadEvents,{headers:["ID","Name","Category","Price","Starts","Status"],rows:n.ggnomadEvents.map(e=>[d(e.id,12),e.name,e.category,`${e.price??0} ${e.currency??""}`.trim(),h(e.startsAt),e.status])});}catch(n){s(n);}}),r.command("get").description("Get an event by id").argument("<id>","Event ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(G,{id:t});if(!e.ggnomadEvent)throw new p(`Event ${t} not found`);a(n,e.ggnomadEvent);}catch(e){s(e);}});}function K(o){let r=o.command("tours").description("GGNomad tours");r.command("list").description("List tours").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(D,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadTours,{headers:["ID","Name","Type","Difficulty","Duration","Price","Status"],rows:n.ggnomadTours.map(e=>[d(e.id,12),e.name,e.type,e.difficulty??"-",e.duration??"-",`${e.price??0} ${e.currency??""}`.trim(),e.status])});}catch(n){s(n);}}),r.command("get").description("Get a tour by id").argument("<id>","Tour ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(N,{id:t});if(!e.ggnomadTour)throw new p(`Tour ${t} not found`);a(n,e.ggnomadTour);}catch(e){s(e);}});}function J(o){o.command("trips").description("GGNomad transport trips").command("list").description("List trips").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(L,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadTrips,{headers:["ID","Name","Mode","Price","Departs","Eco","Status"],rows:n.ggnomadTrips.map(e=>[d(e.id,12),e.name,e.transportMode,`${e.price??0} ${e.currency??""}`.trim(),h(e.departureAt),e.ecoFriendly?"yes":"no",e.status])});}catch(n){s(n);}});}function Q(o){let r=o.command("bookings").description("GGNomad bookings");r.command("list").description("List bookings").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(q,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadBookings,{headers:["ID","Ref","Type","Item","Guest","Total","Status","Payment"],rows:n.ggnomadBookings.map(e=>[d(e.id,12),e.referenceCode,e.bookingType,d(e.itemName,20),d(e.guestName,16),`${e.totalPrice} ${e.currency??""}`.trim(),e.status,e.paymentStatus])});}catch(n){s(n);}}),r.command("create").description("Create a booking").requiredOption("--type <t>","Booking type: ACTIVITY|EVENT|PROPERTY|TOUR|TRIP").requiredOption("--item-id <id>","Item ID being booked").requiredOption("--item-name <name>","Item name").requiredOption("--guest-name <name>","Guest name").requiredOption("--guests <n>","Number of guests",c).requiredOption("--total-price <n>","Total price",w).option("--guest-email <email>","Guest email").option("--guest-phone <phone>","Guest phone").option("--currency <c>","Currency code").option("--check-in <iso>","Check-in (ISO date)").option("--check-out <iso>","Check-out (ISO date)").option("--event-date <iso>","Event date (ISO date)").option("--payment-method <m>","Payment method").option("--special-requests <s>","Special requests").option("-f, --format <format>","Output format").action(async t=>{try{let n={bookingType:t.type.toUpperCase(),itemId:t.itemId,itemName:t.itemName,guestName:t.guestName,guests:t.guests,totalPrice:t.totalPrice};t.guestEmail&&(n.guestEmail=t.guestEmail),t.guestPhone&&(n.guestPhone=t.guestPhone),t.currency&&(n.currency=t.currency),t.checkIn&&(n.checkIn=t.checkIn),t.checkOut&&(n.checkOut=t.checkOut),t.eventDate&&(n.eventDate=t.eventDate),t.paymentMethod&&(n.paymentMethod=t.paymentMethod),t.specialRequests&&(n.specialRequests=t.specialRequests);let e=await i(_,{input:n});m(`Booking created: ${e.createGgnomadBooking.referenceCode}`),a(t,e.createGgnomadBooking);}catch(n){s(n);}}),r.command("cancel").description("Cancel a booking").argument("<id>","Booking ID").option("--reason <s>","Cancellation reason").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(F,{id:t,reason:n.reason});m(`Booking cancelled: ${e.cancelGgnomadBooking.referenceCode}`),a(n,e.cancelGgnomadBooking);}catch(e){s(e);}});}function X(o){let r=o.command("favorites").description("GGNomad favorites");r.command("list").description("List favorites").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(W,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadFavorites);}catch(n){s(n);}}),r.command("toggle").description("Toggle a favorite on a target").requiredOption("--target-id <id>","Target ID").requiredOption("--target-type <t>","Target type: ACTIVITY|EVENT|PROPERTY|TOUR|TRIP").option("-f, --format <format>","Output format").action(async t=>{try{let n={targetId:t.targetId,targetType:t.targetType.toUpperCase()},e=await i(V,{input:n});m(e.toggleGgnomadFavorite?"Added to favorites":"Removed from favorites"),a(t,{favorited:e.toggleGgnomadFavorite});}catch(n){s(n);}});}function Z(o){let r=o.command("analytics").description("GGNomad analytics & overview");r.command("summary").description("Platform analytics (users, bookings, revenue, conversion, trends)").option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(B);a(t,n.ggnomadAnalytics);}catch(n){s(n);}}),r.command("overview").description("Overview stats (users, listings, bookings, monthly revenue)").option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(U);a(t,n.ggnomadOverviewStats);}catch(n){s(n);}});}var gt={id:"ggnomad",version:"1.0.0",displayName:"GGNomad",dependsOn:["auth","workspaces"],register(o,r){I(r);let t=o.command("ggnomad").description("GGNomad travel & experiences marketplace");j(t),z(t),Y(t),H(t),K(t),J(t),Q(t),X(t),Z(t);}},cn=gt;module.exports=cn;
|
|
140
|
+
`;function M(o,r){try{return JSON.parse(r)}catch{throw new p(`--${o} must be valid JSON`)}}function c(o){let r=Number.parseInt(o,10);if(Number.isNaN(r))throw new p(`Expected an integer but got "${o}"`);return r}function w(o){let r=Number.parseFloat(o);if(Number.isNaN(r))throw new p(`Expected a number but got "${o}"`);return r}function j(o){let r=o.command("providers").description("GGNomad providers");r.command("list").description("List providers").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(b,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadProviders,{headers:["ID","Name","Type","Status","Rating","Listings"],rows:n.ggnomadProviders.map(e=>[d(e.id,12),e.name,e.type,e.status,`${e.rating??0} (${e.reviewCount??0})`,String(e.listingCount??0)])});}catch(n){s(n);}}),r.command("get").description("Get a provider by id").argument("<id>","Provider ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(I,{id:t});if(!e.ggnomadProvider)throw new p(`Provider ${t} not found`);a(n,e.ggnomadProvider);}catch(e){s(e);}}),r.command("create").description("Create a provider").requiredOption("--name <name>","Provider name").addOption(new commander.Option("--type <t>","Provider type").choices(["HOTEL_OPERATOR","TOUR_OPERATOR","ACTIVITY_PROVIDER","TRANSPORT_PROVIDER","EVENT_ORGANIZER"]).makeOptionMandatory()).option("--description <s>","Description").option("--website <url>","Website URL").option("--contact-email <email>","Contact email").option("--contact-phone <phone>","Contact phone").option("-f, --format <format>","Output format").action(async t=>{try{let n={name:t.name,type:t.type};t.description&&(n.description=t.description),t.website&&(n.website=t.website),t.contactEmail&&(n.contactEmail=t.contactEmail),t.contactPhone&&(n.contactPhone=t.contactPhone);let e=await i(E,{input:n});m(`Provider created: ${e.createGgnomadProvider.name}`),a(t,e.createGgnomadProvider);}catch(n){s(n);}});}function z(o){let r=o.command("properties").description("GGNomad stay properties");r.command("list").description("List properties").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(A,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadProperties,{headers:["ID","Name","Type","Status","Price/Night","Guests","Rating"],rows:n.ggnomadProperties.map(e=>[d(e.id,12),e.name,e.type,e.status,`${e.pricePerNight??0} ${e.currency??""}`.trim(),String(e.maxGuests??0),`${e.rating??0} (${e.reviewCount??0})`])});}catch(n){s(n);}}),r.command("get").description("Get a property by id").argument("<id>","Property ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(O,{id:t});if(!e.ggnomadProperty)throw new p(`Property ${t} not found`);a(n,e.ggnomadProperty);}catch(e){s(e);}}),r.command("create").description("Create a property").requiredOption("--name <name>","Property name").requiredOption("--type <t>","Property type").requiredOption("--address <json>","Address JSON").requiredOption("--max-guests <n>","Maximum guests",c).requiredOption("--price-per-night <n>","Price per night",w).requiredOption("--amenities <csv>","Comma-separated amenities").requiredOption("--images <csv>","Comma-separated image URLs").option("--provider <id>","Provider ID").option("--description <s>","Description").option("--bedrooms <n>","Bedrooms",c).option("--bathrooms <n>","Bathrooms",c).option("--check-in-time <s>","Check-in time").option("--check-out-time <s>","Check-out time").option("--currency <c>","Currency code").option("-f, --format <format>","Output format").action(async t=>{try{let n={name:t.name,type:t.type,address:M("address",t.address),maxGuests:t.maxGuests,pricePerNight:t.pricePerNight,amenities:t.amenities.split(",").map(C=>C.trim()),images:t.images.split(",").map(C=>C.trim())};t.provider&&(n.providerId=t.provider),t.description&&(n.description=t.description),t.bedrooms!==void 0&&(n.bedrooms=t.bedrooms),t.bathrooms!==void 0&&(n.bathrooms=t.bathrooms),t.checkInTime&&(n.checkInTime=t.checkInTime),t.checkOutTime&&(n.checkOutTime=t.checkOutTime),t.currency&&(n.currency=t.currency);let e=await i(P,{input:n});m(`Property created: ${e.createGgnomadProperty.name}`),a(t,e.createGgnomadProperty);}catch(n){s(n);}});}function Y(o){let r=o.command("activities").description("GGNomad activities");r.command("list").description("List activities").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(S,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadActivities,{headers:["ID","Name","Category","Difficulty","Duration","Price","Status"],rows:n.ggnomadActivities.map(e=>[d(e.id,12),e.name,e.category,e.difficulty??"-",e.duration??"-",`${e.price??0} ${e.currency??""}`.trim(),e.status])});}catch(n){s(n);}}),r.command("get").description("Get an activity by id").argument("<id>","Activity ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(R,{id:t});if(!e.ggnomadActivity)throw new p(`Activity ${t} not found`);a(n,e.ggnomadActivity);}catch(e){s(e);}});}function H(o){let r=o.command("events").description("GGNomad events");r.command("list").description("List events").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i($,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadEvents,{headers:["ID","Name","Category","Price","Starts","Status"],rows:n.ggnomadEvents.map(e=>[d(e.id,12),e.name,e.category,`${e.price??0} ${e.currency??""}`.trim(),h(e.startsAt),e.status])});}catch(n){s(n);}}),r.command("get").description("Get an event by id").argument("<id>","Event ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(G,{id:t});if(!e.ggnomadEvent)throw new p(`Event ${t} not found`);a(n,e.ggnomadEvent);}catch(e){s(e);}});}function K(o){let r=o.command("tours").description("GGNomad tours");r.command("list").description("List tours").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(D,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadTours,{headers:["ID","Name","Type","Difficulty","Duration","Price","Status"],rows:n.ggnomadTours.map(e=>[d(e.id,12),e.name,e.type,e.difficulty??"-",e.duration??"-",`${e.price??0} ${e.currency??""}`.trim(),e.status])});}catch(n){s(n);}}),r.command("get").description("Get a tour by id").argument("<id>","Tour ID").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(N,{id:t});if(!e.ggnomadTour)throw new p(`Tour ${t} not found`);a(n,e.ggnomadTour);}catch(e){s(e);}});}function J(o){o.command("trips").description("GGNomad transport trips").command("list").description("List trips").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(L,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadTrips,{headers:["ID","Name","Mode","Price","Departs","Eco","Status"],rows:n.ggnomadTrips.map(e=>[d(e.id,12),e.name,e.transportMode,`${e.price??0} ${e.currency??""}`.trim(),h(e.departureAt),e.ecoFriendly?"yes":"no",e.status])});}catch(n){s(n);}});}function Q(o){let r=o.command("bookings").description("GGNomad bookings");r.command("list").description("List bookings").option("--limit <n>","Page size",c,20).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(q,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadBookings,{headers:["ID","Ref","Type","Item","Guest","Total","Status","Payment"],rows:n.ggnomadBookings.map(e=>[d(e.id,12),e.referenceCode,e.bookingType,d(e.itemName,20),d(e.guestName,16),`${e.totalPrice} ${e.currency??""}`.trim(),e.status,e.paymentStatus])});}catch(n){s(n);}}),r.command("create").description("Create a booking").requiredOption("--type <t>","Booking type: ACTIVITY|EVENT|PROPERTY|TOUR|TRIP").requiredOption("--item-id <id>","Item ID being booked").requiredOption("--item-name <name>","Item name").requiredOption("--guest-name <name>","Guest name").requiredOption("--guests <n>","Number of guests",c).requiredOption("--total-price <n>","Total price",w).option("--guest-email <email>","Guest email").option("--guest-phone <phone>","Guest phone").option("--currency <c>","Currency code").option("--check-in <iso>","Check-in (ISO date)").option("--check-out <iso>","Check-out (ISO date)").option("--event-date <iso>","Event date (ISO date)").option("--payment-method <m>","Payment method").option("--special-requests <s>","Special requests").option("-f, --format <format>","Output format").action(async t=>{try{let n={bookingType:t.type.toUpperCase(),itemId:t.itemId,itemName:t.itemName,guestName:t.guestName,guests:t.guests,totalPrice:t.totalPrice};t.guestEmail&&(n.guestEmail=t.guestEmail),t.guestPhone&&(n.guestPhone=t.guestPhone),t.currency&&(n.currency=t.currency),t.checkIn&&(n.checkIn=t.checkIn),t.checkOut&&(n.checkOut=t.checkOut),t.eventDate&&(n.eventDate=t.eventDate),t.paymentMethod&&(n.paymentMethod=t.paymentMethod),t.specialRequests&&(n.specialRequests=t.specialRequests);let e=await i(_,{input:n});m(`Booking created: ${e.createGgnomadBooking.referenceCode}`),a(t,e.createGgnomadBooking);}catch(n){s(n);}}),r.command("cancel").description("Cancel a booking").argument("<id>","Booking ID").option("--reason <s>","Cancellation reason").option("-f, --format <format>","Output format").action(async(t,n)=>{try{let e=await i(F,{id:t,reason:n.reason});m(`Booking cancelled: ${e.cancelGgnomadBooking.referenceCode}`),a(n,e.cancelGgnomadBooking);}catch(e){s(e);}});}function X(o){let r=o.command("favorites").description("GGNomad favorites");r.command("list").description("List favorites").option("--limit <n>","Page size",c,50).option("--offset <n>","Offset",c,0).option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(W,{pagination:{limit:t.limit,offset:t.offset}});a(t,n.ggnomadFavorites);}catch(n){s(n);}}),r.command("toggle").description("Toggle a favorite on a target").requiredOption("--target-id <id>","Target ID").requiredOption("--target-type <t>","Target type: ACTIVITY|EVENT|PROPERTY|TOUR|TRIP").option("-f, --format <format>","Output format").action(async t=>{try{let n={targetId:t.targetId,targetType:t.targetType.toUpperCase()},e=await i(B,{input:n});m(e.toggleGgnomadFavorite?"Added to favorites":"Removed from favorites"),a(t,{favorited:e.toggleGgnomadFavorite});}catch(n){s(n);}});}function Z(o){let r=o.command("analytics").description("GGNomad analytics & overview");r.command("summary").description("Platform analytics (users, bookings, revenue, conversion, trends)").option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(V);a(t,n.ggnomadAnalytics);}catch(n){s(n);}}),r.command("overview").description("Overview stats (users, listings, bookings, monthly revenue)").option("-f, --format <format>","Output format").action(async t=>{try{let n=await i(U);a(t,n.ggnomadOverviewStats);}catch(n){s(n);}});}var gt={id:"ggnomad",version:"1.0.0",displayName:"GGNomad",dependsOn:["auth","workspaces"],register(o,r){x(r);let t=o.command("ggnomad").description("GGNomad travel & experiences marketplace");j(t),z(t),Y(t),H(t),K(t),J(t),Q(t),X(t),Z(t);}},cn=gt;module.exports=cn;
|