@camunda8/cli 1.0.0
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/LICENSE +201 -0
- package/README.md +387 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +39 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/deployments.d.ts +10 -0
- package/dist/commands/deployments.d.ts.map +1 -0
- package/dist/commands/deployments.js +221 -0
- package/dist/commands/deployments.js.map +1 -0
- package/dist/commands/help.d.ts +20 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +116 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/incidents.d.ts +18 -0
- package/dist/commands/incidents.d.ts.map +1 -0
- package/dist/commands/incidents.js +62 -0
- package/dist/commands/incidents.js.map +1 -0
- package/dist/commands/jobs.d.ts +36 -0
- package/dist/commands/jobs.d.ts.map +1 -0
- package/dist/commands/jobs.js +129 -0
- package/dist/commands/jobs.js.map +1 -0
- package/dist/commands/messages.d.ts +22 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +48 -0
- package/dist/commands/messages.js.map +1 -0
- package/dist/commands/plugins.d.ts +17 -0
- package/dist/commands/plugins.d.ts.map +1 -0
- package/dist/commands/plugins.js +113 -0
- package/dist/commands/plugins.js.map +1 -0
- package/dist/commands/process-instances.d.ts +34 -0
- package/dist/commands/process-instances.d.ts.map +1 -0
- package/dist/commands/process-instances.js +116 -0
- package/dist/commands/process-instances.js.map +1 -0
- package/dist/commands/profiles.d.ts +23 -0
- package/dist/commands/profiles.d.ts.map +1 -0
- package/dist/commands/profiles.js +76 -0
- package/dist/commands/profiles.js.map +1 -0
- package/dist/commands/run.d.ts +11 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +61 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/session.d.ts +20 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +54 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/topology.d.ts +10 -0
- package/dist/commands/topology.d.ts.map +1 -0
- package/dist/commands/topology.js +21 -0
- package/dist/commands/topology.js.map +1 -0
- package/dist/commands/user-tasks.d.ts +20 -0
- package/dist/commands/user-tasks.d.ts.map +1 -0
- package/dist/commands/user-tasks.js +78 -0
- package/dist/commands/user-tasks.js.map +1 -0
- package/dist/commands/watch.d.ts +10 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +76 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/config.d.ts +129 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +356 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +405 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +22 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +132 -0
- package/dist/logger.js.map +1 -0
- package/dist/plugin-loader.d.ts +32 -0
- package/dist/plugin-loader.d.ts.map +1 -0
- package/dist/plugin-loader.js +104 -0
- package/dist/plugin-loader.js.map +1 -0
- package/dist/runtime.d.ts +20 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +35 -0
- package/dist/runtime.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,wBAAwB;IACxB,MAAM,OAAO,GAAG,UAAU,CAAC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IAAI,CAAC,oBAAoB,KAAK,CAAC,YAAY,IAAI,QAAQ,EAAE,CAAC,CAAC;IAClE,MAAM,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAClD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../src/commands/topology.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Topology commands
|
|
3
|
+
*/
|
|
4
|
+
import { getLogger } from "../logger.js";
|
|
5
|
+
import { createClient } from "../client.js";
|
|
6
|
+
/**
|
|
7
|
+
* Get cluster topology
|
|
8
|
+
*/
|
|
9
|
+
export async function getTopology(options) {
|
|
10
|
+
const logger = getLogger();
|
|
11
|
+
const client = createClient(options.profile);
|
|
12
|
+
try {
|
|
13
|
+
const result = await client.getTopology();
|
|
14
|
+
logger.json(result);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
logger.error('Failed to get topology', error);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=topology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topology.js","sourceRoot":"","sources":["../../src/commands/topology.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAEjC;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAc,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User task commands
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* List user tasks
|
|
6
|
+
*/
|
|
7
|
+
export declare function listUserTasks(options: {
|
|
8
|
+
profile?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
assignee?: string;
|
|
11
|
+
all?: boolean;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Complete user task
|
|
15
|
+
*/
|
|
16
|
+
export declare function completeUserTask(key: string, options: {
|
|
17
|
+
profile?: string;
|
|
18
|
+
variables?: string;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=user-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-tasks.d.ts","sourceRoot":"","sources":["../../src/commands/user-tasks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CA0ChB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User task commands
|
|
3
|
+
*/
|
|
4
|
+
import { getLogger } from "../logger.js";
|
|
5
|
+
import { createClient } from "../client.js";
|
|
6
|
+
import { resolveTenantId } from "../config.js";
|
|
7
|
+
/**
|
|
8
|
+
* List user tasks
|
|
9
|
+
*/
|
|
10
|
+
export async function listUserTasks(options) {
|
|
11
|
+
const logger = getLogger();
|
|
12
|
+
const client = createClient(options.profile);
|
|
13
|
+
const tenantId = resolveTenantId(options.profile);
|
|
14
|
+
try {
|
|
15
|
+
const filter = {
|
|
16
|
+
filter: {
|
|
17
|
+
tenantId,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
if (options.state) {
|
|
21
|
+
filter.filter.state = options.state;
|
|
22
|
+
}
|
|
23
|
+
else if (!options.all) {
|
|
24
|
+
// By default, exclude COMPLETED tasks unless --all is specified
|
|
25
|
+
filter.filter.state = 'CREATED';
|
|
26
|
+
}
|
|
27
|
+
if (options.assignee) {
|
|
28
|
+
filter.filter.assignee = options.assignee;
|
|
29
|
+
}
|
|
30
|
+
const result = await client.searchUserTasks(filter, { consistency: { waitUpToMs: 0 } });
|
|
31
|
+
if (result.items && result.items.length > 0) {
|
|
32
|
+
const tableData = result.items.map((task) => ({
|
|
33
|
+
Key: task.userTaskKey || task.key,
|
|
34
|
+
Name: task.name || task.elementId,
|
|
35
|
+
State: task.state,
|
|
36
|
+
Assignee: task.assignee || '(unassigned)',
|
|
37
|
+
'Process Instance': task.processInstanceKey,
|
|
38
|
+
'Tenant ID': task.tenantId,
|
|
39
|
+
}));
|
|
40
|
+
logger.table(tableData);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
logger.info('No user tasks found');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
logger.error('Failed to list user tasks', error);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Complete user task
|
|
53
|
+
*/
|
|
54
|
+
export async function completeUserTask(key, options) {
|
|
55
|
+
const logger = getLogger();
|
|
56
|
+
const client = createClient(options.profile);
|
|
57
|
+
try {
|
|
58
|
+
const request = {
|
|
59
|
+
userTaskKey: key,
|
|
60
|
+
};
|
|
61
|
+
if (options.variables) {
|
|
62
|
+
try {
|
|
63
|
+
request.variables = JSON.parse(options.variables);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
logger.error('Invalid JSON for variables', error);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
await client.completeUserTask(request);
|
|
71
|
+
logger.success(`User task ${key} completed`);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
logger.error(`Failed to complete user task ${key}`, error);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=user-tasks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-tasks.js","sourceRoot":"","sources":["../../src/commands/user-tasks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAKnC;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7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
|
+
/**
|
|
5
|
+
* Watch for file changes and auto-deploy
|
|
6
|
+
*/
|
|
7
|
+
export declare function watchFiles(paths: string[], options: {
|
|
8
|
+
profile?: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH;;GAEG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2EhB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watch command - monitor files for changes and auto-deploy
|
|
3
|
+
*/
|
|
4
|
+
import { watch } from 'node:fs';
|
|
5
|
+
import { resolve, extname, basename } from 'node:path';
|
|
6
|
+
import { existsSync, statSync } from 'node:fs';
|
|
7
|
+
import { getLogger } from "../logger.js";
|
|
8
|
+
import { deploy } from "./deployments.js";
|
|
9
|
+
const WATCHED_EXTENSIONS = ['.bpmn', '.dmn', '.form'];
|
|
10
|
+
/**
|
|
11
|
+
* Watch for file changes and auto-deploy
|
|
12
|
+
*/
|
|
13
|
+
export async function watchFiles(paths, options) {
|
|
14
|
+
const logger = getLogger();
|
|
15
|
+
if (!paths || paths.length === 0) {
|
|
16
|
+
paths = ['.'];
|
|
17
|
+
}
|
|
18
|
+
// Resolve all paths
|
|
19
|
+
const resolvedPaths = paths.map(p => resolve(p));
|
|
20
|
+
// Validate paths exist
|
|
21
|
+
for (const path of resolvedPaths) {
|
|
22
|
+
if (!existsSync(path)) {
|
|
23
|
+
logger.error(`Path does not exist: ${path}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
logger.info(`👁️ Watching for changes in: ${resolvedPaths.join(', ')}`);
|
|
28
|
+
logger.info(`📋 Monitoring extensions: ${WATCHED_EXTENSIONS.join(', ')}`);
|
|
29
|
+
logger.info('Press Ctrl+C to stop watching\n');
|
|
30
|
+
// Keep track of recently deployed files to avoid duplicate deploys
|
|
31
|
+
const recentlyDeployed = new Map();
|
|
32
|
+
const DEPLOY_COOLDOWN = 1000; // 1 second cooldown
|
|
33
|
+
// Watch each path
|
|
34
|
+
for (const path of resolvedPaths) {
|
|
35
|
+
const stats = statSync(path);
|
|
36
|
+
const isDirectory = stats.isDirectory();
|
|
37
|
+
const watcher = watch(path, { recursive: isDirectory }, async (eventType, filename) => {
|
|
38
|
+
if (!filename)
|
|
39
|
+
return;
|
|
40
|
+
const ext = extname(filename);
|
|
41
|
+
if (!WATCHED_EXTENSIONS.includes(ext)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const fullPath = isDirectory ? resolve(path, filename) : path;
|
|
45
|
+
// Check cooldown to prevent duplicate deploys
|
|
46
|
+
const lastDeploy = recentlyDeployed.get(fullPath);
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
if (lastDeploy && (now - lastDeploy) < DEPLOY_COOLDOWN) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// Check if file still exists (might have been deleted)
|
|
52
|
+
if (!existsSync(fullPath)) {
|
|
53
|
+
logger.info(`⚠️ File deleted, skipping: ${basename(filename)}`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
logger.info(`\n🔄 Change detected: ${basename(filename)}`);
|
|
57
|
+
recentlyDeployed.set(fullPath, now);
|
|
58
|
+
try {
|
|
59
|
+
await deploy([fullPath], { profile: options.profile });
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
logger.error(`Failed to deploy ${basename(filename)}`, error);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// Handle watcher errors
|
|
66
|
+
watcher.on('error', (error) => {
|
|
67
|
+
logger.error('Watcher error', error);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Keep process alive
|
|
71
|
+
process.on('SIGINT', () => {
|
|
72
|
+
logger.info('\n\n🍹 - bottoms up.');
|
|
73
|
+
process.exit(0);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAe,EAAE,OAEjD;IACC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAE3B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC;IAED,oBAAoB;IACpB,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjD,uBAAuB;IACvB,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,wBAAwB,IAAI,EAAE,CAAC,CAAC;YAC7C,OAAO,CAA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AAC;gBACvD,OAAO;YACT,CAAC;YAED,uDAAuD;YACvD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,CAAC,+BAA+B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACjE,OAAO;YACT,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,yBAAyB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC3D,gBAAgB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAEpC,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YACzD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,KAAK,CAAC,oBAAoB,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAc,CAAC,CAAC;YACzE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB;IACrB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration and session state management for c8ctl
|
|
3
|
+
* Handles profiles, session state, and credential resolution
|
|
4
|
+
*/
|
|
5
|
+
import type { OutputMode } from './logger.ts';
|
|
6
|
+
export interface Profile {
|
|
7
|
+
name: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
clientId?: string;
|
|
10
|
+
clientSecret?: string;
|
|
11
|
+
audience?: string;
|
|
12
|
+
oAuthUrl?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
password?: string;
|
|
15
|
+
defaultTenantId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SessionState {
|
|
18
|
+
activeProfile?: string;
|
|
19
|
+
activeTenant?: string;
|
|
20
|
+
outputMode: OutputMode;
|
|
21
|
+
}
|
|
22
|
+
export interface ClusterConfig {
|
|
23
|
+
baseUrl: string;
|
|
24
|
+
clientId?: string;
|
|
25
|
+
clientSecret?: string;
|
|
26
|
+
audience?: string;
|
|
27
|
+
oAuthUrl?: string;
|
|
28
|
+
username?: string;
|
|
29
|
+
password?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Camunda Modeler profile structure
|
|
33
|
+
*/
|
|
34
|
+
export interface ModelerProfile {
|
|
35
|
+
name?: string;
|
|
36
|
+
clusterId?: string;
|
|
37
|
+
clusterUrl?: string;
|
|
38
|
+
audience?: string;
|
|
39
|
+
clientId?: string;
|
|
40
|
+
clientSecret?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get platform-specific user data directory
|
|
44
|
+
*/
|
|
45
|
+
export declare function getUserDataDir(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Get platform-specific Camunda Modeler data directory
|
|
48
|
+
*/
|
|
49
|
+
export declare function getModelerDataDir(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Load all profiles
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadProfiles(): Profile[];
|
|
54
|
+
/**
|
|
55
|
+
* Save profiles to disk
|
|
56
|
+
*/
|
|
57
|
+
export declare function saveProfiles(profiles: Profile[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get a profile by name
|
|
60
|
+
* Supports both c8ctl profiles and modeler profiles (with 'modeler:' prefix)
|
|
61
|
+
*/
|
|
62
|
+
export declare function getProfile(name: string): Profile | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Add or update a profile
|
|
65
|
+
*/
|
|
66
|
+
export declare function addProfile(profile: Profile): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a profile
|
|
69
|
+
*/
|
|
70
|
+
export declare function removeProfile(name: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Load session state
|
|
73
|
+
*/
|
|
74
|
+
export declare function loadSessionState(): SessionState;
|
|
75
|
+
/**
|
|
76
|
+
* Save session state to disk
|
|
77
|
+
*/
|
|
78
|
+
export declare function saveSessionState(state: SessionState): void;
|
|
79
|
+
/**
|
|
80
|
+
* Set active profile in session
|
|
81
|
+
*/
|
|
82
|
+
export declare function setActiveProfile(name: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* Set active tenant in session
|
|
85
|
+
*/
|
|
86
|
+
export declare function setActiveTenant(tenantId: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Set output mode in session
|
|
89
|
+
*/
|
|
90
|
+
export declare function setOutputMode(mode: OutputMode): void;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve cluster configuration from session, flags, env vars, or defaults
|
|
93
|
+
* Priority: profileFlag → session profile → env vars → localhost fallback
|
|
94
|
+
*/
|
|
95
|
+
export declare function resolveClusterConfig(profileFlag?: string): ClusterConfig;
|
|
96
|
+
/**
|
|
97
|
+
* Resolve tenant ID from session, profile, env vars, or default
|
|
98
|
+
* Priority: session tenant → profile default tenant → env var → '<default>'
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveTenantId(profileFlag?: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* Load Camunda Modeler profiles from profiles.json
|
|
103
|
+
* Always reads fresh from disk (no caching)
|
|
104
|
+
*
|
|
105
|
+
* TODO: Consider introducing caching mechanism for better performance.
|
|
106
|
+
* Current implementation reads from disk on every call. For commands that
|
|
107
|
+
* list profiles or look up multiple profiles, this could be optimized by
|
|
108
|
+
* implementing per-execution memoization or a time-based cache.
|
|
109
|
+
*/
|
|
110
|
+
export declare function loadModelerProfiles(): ModelerProfile[];
|
|
111
|
+
/**
|
|
112
|
+
* Get a modeler profile by name or cluster ID
|
|
113
|
+
* Accepts 'modeler:name' or 'modeler:id' format, or just 'name'/'id'
|
|
114
|
+
*/
|
|
115
|
+
export declare function getModelerProfile(identifier: string): ModelerProfile | undefined;
|
|
116
|
+
/**
|
|
117
|
+
* Construct REST API URL from modeler profile
|
|
118
|
+
* For cloud: uses clusterUrl as-is (Camunda cloud URLs don't need /v2)
|
|
119
|
+
* For self-managed: localhost URLs get /v2 appended
|
|
120
|
+
* Does not derive values - uses what's provided
|
|
121
|
+
*
|
|
122
|
+
* Note: Self-managed clusters should include /v2 in their clusterUrl if needed
|
|
123
|
+
*/
|
|
124
|
+
export declare function constructApiUrl(profile: ModelerProfile): string;
|
|
125
|
+
/**
|
|
126
|
+
* Convert a modeler profile to a c8ctl Profile
|
|
127
|
+
*/
|
|
128
|
+
export declare function convertModelerProfile(modelerProfile: ModelerProfile): Profile;
|
|
129
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,aAA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