@hesed/conni 0.7.1 → 0.8.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/README.md +48 -22
- package/dist/commands/conni/auth/add.d.ts +2 -15
- package/dist/commands/conni/auth/add.js +7 -60
- package/dist/commands/conni/auth/delete.d.ts +2 -0
- package/dist/commands/conni/auth/delete.js +2 -0
- package/dist/commands/conni/auth/list.d.ts +2 -20
- package/dist/commands/conni/auth/list.js +2 -36
- package/dist/commands/conni/auth/profile.d.ts +2 -11
- package/dist/commands/conni/auth/profile.js +2 -23
- package/dist/commands/conni/auth/test.d.ts +2 -12
- package/dist/commands/conni/auth/test.js +7 -37
- package/dist/commands/conni/auth/update.d.ts +2 -15
- package/dist/commands/conni/auth/update.js +7 -83
- package/dist/commands/conni/content/attachment-download.js +5 -5
- package/dist/commands/conni/content/attachment.js +5 -5
- package/dist/commands/conni/content/comment-delete.js +5 -5
- package/dist/commands/conni/content/comment-update.js +5 -5
- package/dist/commands/conni/content/comment.js +5 -5
- package/dist/commands/conni/content/create.js +5 -7
- package/dist/commands/conni/content/delete.js +5 -5
- package/dist/commands/conni/content/get.js +5 -5
- package/dist/commands/conni/content/search.js +5 -5
- package/dist/commands/conni/content/update.js +5 -5
- package/dist/commands/conni/space/get.js +5 -5
- package/dist/commands/conni/space/list.js +5 -5
- package/dist/conni/conni-api.d.ts +2 -14
- package/dist/conni/conni-client.d.ts +17 -95
- package/dist/conni/conni-client.js +17 -115
- package/oclif.manifest.json +139 -94
- package/package.json +2 -2
- package/dist/config.d.ts +0 -14
- package/dist/config.js +0 -83
- package/dist/format.d.ts +0 -4
- package/dist/format.js +0 -10
package/oclif.manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"conni:auth:add": {
|
|
4
4
|
"aliases": [],
|
|
5
5
|
"args": {},
|
|
6
|
-
"description": "Add
|
|
6
|
+
"description": "Add Confluence authentication",
|
|
7
7
|
"examples": [
|
|
8
8
|
"<%= config.bin %> <%= command.id %>",
|
|
9
9
|
"<%= config.bin %> <%= command.id %> --profile work"
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"url": {
|
|
47
47
|
"char": "u",
|
|
48
|
-
"description": "
|
|
48
|
+
"description": "Confluence instance URL (start with https://)",
|
|
49
|
+
"hidden": false,
|
|
49
50
|
"name": "url",
|
|
50
51
|
"required": true,
|
|
51
52
|
"hasDynamicHelp": false,
|
|
@@ -70,6 +71,49 @@
|
|
|
70
71
|
"add.js"
|
|
71
72
|
]
|
|
72
73
|
},
|
|
74
|
+
"conni:auth:delete": {
|
|
75
|
+
"aliases": [],
|
|
76
|
+
"args": {},
|
|
77
|
+
"description": "Delete an authentication profile",
|
|
78
|
+
"examples": [
|
|
79
|
+
"<%= config.bin %> <%= command.id %>",
|
|
80
|
+
"<%= config.bin %> <%= command.id %> --profile work"
|
|
81
|
+
],
|
|
82
|
+
"flags": {
|
|
83
|
+
"json": {
|
|
84
|
+
"description": "Format output as json.",
|
|
85
|
+
"helpGroup": "GLOBAL",
|
|
86
|
+
"name": "json",
|
|
87
|
+
"allowNo": false,
|
|
88
|
+
"type": "boolean"
|
|
89
|
+
},
|
|
90
|
+
"profile": {
|
|
91
|
+
"char": "p",
|
|
92
|
+
"description": "Profile name to delete",
|
|
93
|
+
"name": "profile",
|
|
94
|
+
"required": false,
|
|
95
|
+
"hasDynamicHelp": false,
|
|
96
|
+
"multiple": false,
|
|
97
|
+
"type": "option"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"hasDynamicHelp": false,
|
|
101
|
+
"hiddenAliases": [],
|
|
102
|
+
"id": "conni:auth:delete",
|
|
103
|
+
"pluginAlias": "@hesed/conni",
|
|
104
|
+
"pluginName": "@hesed/conni",
|
|
105
|
+
"pluginType": "core",
|
|
106
|
+
"strict": true,
|
|
107
|
+
"enableJsonFlag": true,
|
|
108
|
+
"isESM": true,
|
|
109
|
+
"relativePath": [
|
|
110
|
+
"dist",
|
|
111
|
+
"commands",
|
|
112
|
+
"conni",
|
|
113
|
+
"auth",
|
|
114
|
+
"delete.js"
|
|
115
|
+
]
|
|
116
|
+
},
|
|
73
117
|
"conni:auth:list": {
|
|
74
118
|
"aliases": [],
|
|
75
119
|
"args": {},
|
|
@@ -233,7 +277,8 @@
|
|
|
233
277
|
},
|
|
234
278
|
"url": {
|
|
235
279
|
"char": "u",
|
|
236
|
-
"description": "
|
|
280
|
+
"description": "Confluence instance URL (start with https://)",
|
|
281
|
+
"hidden": false,
|
|
237
282
|
"name": "url",
|
|
238
283
|
"required": true,
|
|
239
284
|
"hasDynamicHelp": false,
|
|
@@ -258,6 +303,96 @@
|
|
|
258
303
|
"update.js"
|
|
259
304
|
]
|
|
260
305
|
},
|
|
306
|
+
"conni:space:get": {
|
|
307
|
+
"aliases": [],
|
|
308
|
+
"args": {
|
|
309
|
+
"spaceKey": {
|
|
310
|
+
"description": "Space key",
|
|
311
|
+
"name": "spaceKey",
|
|
312
|
+
"required": true
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"description": "Get details of a Confluence space",
|
|
316
|
+
"examples": [
|
|
317
|
+
"<%= config.bin %> <%= command.id %> DEV"
|
|
318
|
+
],
|
|
319
|
+
"flags": {
|
|
320
|
+
"profile": {
|
|
321
|
+
"char": "p",
|
|
322
|
+
"description": "Authentication profile name",
|
|
323
|
+
"name": "profile",
|
|
324
|
+
"required": false,
|
|
325
|
+
"hasDynamicHelp": false,
|
|
326
|
+
"multiple": false,
|
|
327
|
+
"type": "option"
|
|
328
|
+
},
|
|
329
|
+
"toon": {
|
|
330
|
+
"description": "Format output as toon",
|
|
331
|
+
"name": "toon",
|
|
332
|
+
"required": false,
|
|
333
|
+
"allowNo": false,
|
|
334
|
+
"type": "boolean"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"hasDynamicHelp": false,
|
|
338
|
+
"hiddenAliases": [],
|
|
339
|
+
"id": "conni:space:get",
|
|
340
|
+
"pluginAlias": "@hesed/conni",
|
|
341
|
+
"pluginName": "@hesed/conni",
|
|
342
|
+
"pluginType": "core",
|
|
343
|
+
"strict": true,
|
|
344
|
+
"enableJsonFlag": false,
|
|
345
|
+
"isESM": true,
|
|
346
|
+
"relativePath": [
|
|
347
|
+
"dist",
|
|
348
|
+
"commands",
|
|
349
|
+
"conni",
|
|
350
|
+
"space",
|
|
351
|
+
"get.js"
|
|
352
|
+
]
|
|
353
|
+
},
|
|
354
|
+
"conni:space:list": {
|
|
355
|
+
"aliases": [],
|
|
356
|
+
"args": {},
|
|
357
|
+
"description": "List all Confluence spaces",
|
|
358
|
+
"examples": [
|
|
359
|
+
"<%= config.bin %> <%= command.id %>"
|
|
360
|
+
],
|
|
361
|
+
"flags": {
|
|
362
|
+
"profile": {
|
|
363
|
+
"char": "p",
|
|
364
|
+
"description": "Authentication profile name",
|
|
365
|
+
"name": "profile",
|
|
366
|
+
"required": false,
|
|
367
|
+
"hasDynamicHelp": false,
|
|
368
|
+
"multiple": false,
|
|
369
|
+
"type": "option"
|
|
370
|
+
},
|
|
371
|
+
"toon": {
|
|
372
|
+
"description": "Format output as toon",
|
|
373
|
+
"name": "toon",
|
|
374
|
+
"required": false,
|
|
375
|
+
"allowNo": false,
|
|
376
|
+
"type": "boolean"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"hasDynamicHelp": false,
|
|
380
|
+
"hiddenAliases": [],
|
|
381
|
+
"id": "conni:space:list",
|
|
382
|
+
"pluginAlias": "@hesed/conni",
|
|
383
|
+
"pluginName": "@hesed/conni",
|
|
384
|
+
"pluginType": "core",
|
|
385
|
+
"strict": true,
|
|
386
|
+
"enableJsonFlag": false,
|
|
387
|
+
"isESM": true,
|
|
388
|
+
"relativePath": [
|
|
389
|
+
"dist",
|
|
390
|
+
"commands",
|
|
391
|
+
"conni",
|
|
392
|
+
"space",
|
|
393
|
+
"list.js"
|
|
394
|
+
]
|
|
395
|
+
},
|
|
261
396
|
"conni:content:attachment-download": {
|
|
262
397
|
"aliases": [],
|
|
263
398
|
"args": {
|
|
@@ -818,97 +953,7 @@
|
|
|
818
953
|
"content",
|
|
819
954
|
"update.js"
|
|
820
955
|
]
|
|
821
|
-
},
|
|
822
|
-
"conni:space:get": {
|
|
823
|
-
"aliases": [],
|
|
824
|
-
"args": {
|
|
825
|
-
"spaceKey": {
|
|
826
|
-
"description": "Space key",
|
|
827
|
-
"name": "spaceKey",
|
|
828
|
-
"required": true
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
"description": "Get details of a Confluence space",
|
|
832
|
-
"examples": [
|
|
833
|
-
"<%= config.bin %> <%= command.id %> DEV"
|
|
834
|
-
],
|
|
835
|
-
"flags": {
|
|
836
|
-
"profile": {
|
|
837
|
-
"char": "p",
|
|
838
|
-
"description": "Authentication profile name",
|
|
839
|
-
"name": "profile",
|
|
840
|
-
"required": false,
|
|
841
|
-
"hasDynamicHelp": false,
|
|
842
|
-
"multiple": false,
|
|
843
|
-
"type": "option"
|
|
844
|
-
},
|
|
845
|
-
"toon": {
|
|
846
|
-
"description": "Format output as toon",
|
|
847
|
-
"name": "toon",
|
|
848
|
-
"required": false,
|
|
849
|
-
"allowNo": false,
|
|
850
|
-
"type": "boolean"
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
"hasDynamicHelp": false,
|
|
854
|
-
"hiddenAliases": [],
|
|
855
|
-
"id": "conni:space:get",
|
|
856
|
-
"pluginAlias": "@hesed/conni",
|
|
857
|
-
"pluginName": "@hesed/conni",
|
|
858
|
-
"pluginType": "core",
|
|
859
|
-
"strict": true,
|
|
860
|
-
"enableJsonFlag": false,
|
|
861
|
-
"isESM": true,
|
|
862
|
-
"relativePath": [
|
|
863
|
-
"dist",
|
|
864
|
-
"commands",
|
|
865
|
-
"conni",
|
|
866
|
-
"space",
|
|
867
|
-
"get.js"
|
|
868
|
-
]
|
|
869
|
-
},
|
|
870
|
-
"conni:space:list": {
|
|
871
|
-
"aliases": [],
|
|
872
|
-
"args": {},
|
|
873
|
-
"description": "List all Confluence spaces",
|
|
874
|
-
"examples": [
|
|
875
|
-
"<%= config.bin %> <%= command.id %>"
|
|
876
|
-
],
|
|
877
|
-
"flags": {
|
|
878
|
-
"profile": {
|
|
879
|
-
"char": "p",
|
|
880
|
-
"description": "Authentication profile name",
|
|
881
|
-
"name": "profile",
|
|
882
|
-
"required": false,
|
|
883
|
-
"hasDynamicHelp": false,
|
|
884
|
-
"multiple": false,
|
|
885
|
-
"type": "option"
|
|
886
|
-
},
|
|
887
|
-
"toon": {
|
|
888
|
-
"description": "Format output as toon",
|
|
889
|
-
"name": "toon",
|
|
890
|
-
"required": false,
|
|
891
|
-
"allowNo": false,
|
|
892
|
-
"type": "boolean"
|
|
893
|
-
}
|
|
894
|
-
},
|
|
895
|
-
"hasDynamicHelp": false,
|
|
896
|
-
"hiddenAliases": [],
|
|
897
|
-
"id": "conni:space:list",
|
|
898
|
-
"pluginAlias": "@hesed/conni",
|
|
899
|
-
"pluginName": "@hesed/conni",
|
|
900
|
-
"pluginType": "core",
|
|
901
|
-
"strict": true,
|
|
902
|
-
"enableJsonFlag": false,
|
|
903
|
-
"isESM": true,
|
|
904
|
-
"relativePath": [
|
|
905
|
-
"dist",
|
|
906
|
-
"commands",
|
|
907
|
-
"conni",
|
|
908
|
-
"space",
|
|
909
|
-
"list.js"
|
|
910
|
-
]
|
|
911
956
|
}
|
|
912
957
|
},
|
|
913
|
-
"version": "0.
|
|
958
|
+
"version": "0.8.0"
|
|
914
959
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hesed/conni",
|
|
3
3
|
"description": "CLI for Confluence API interaction",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": "Hesed",
|
|
6
6
|
"bin": {
|
|
7
7
|
"conni": "./bin/run.js"
|
|
8
8
|
},
|
|
9
9
|
"bugs": "https://github.com/hesedcasa/conni/issues",
|
|
10
10
|
"dependencies": {
|
|
11
|
+
"@hesed/plugin-lib": "^0.4.0",
|
|
11
12
|
"@inquirer/prompts": "^8.2.0",
|
|
12
13
|
"@oclif/core": "^4",
|
|
13
|
-
"@toon-format/toon": "^2.1.0",
|
|
14
14
|
"confluence.js": "^2.1.0",
|
|
15
15
|
"fs-extra": "^11.3.3",
|
|
16
16
|
"marklassian": "^1.1.0"
|
package/dist/config.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface AuthConfig {
|
|
2
|
-
apiToken: string;
|
|
3
|
-
email?: string;
|
|
4
|
-
host: string;
|
|
5
|
-
}
|
|
6
|
-
interface Config {
|
|
7
|
-
auth: AuthConfig;
|
|
8
|
-
}
|
|
9
|
-
export type Profiles = Record<string, AuthConfig>;
|
|
10
|
-
export declare function getDefaultProfile(configDir: string): Promise<string>;
|
|
11
|
-
export declare function setDefaultProfile(configDir: string, profile: string, log: (message: string) => void): Promise<void>;
|
|
12
|
-
export declare function readConfig(configDir: string, log: (message: string) => void, profile?: string): Promise<Config | undefined>;
|
|
13
|
-
export declare function readProfiles(configDir: string, log: (message: string) => void): Promise<Profiles | undefined>;
|
|
14
|
-
export {};
|
package/dist/config.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { default as fs } from 'fs-extra';
|
|
2
|
-
import { default as path } from 'node:path';
|
|
3
|
-
const CONFIG_FILE = 'conni-config.json';
|
|
4
|
-
function configPath(configDir) {
|
|
5
|
-
return path.join(configDir, CONFIG_FILE);
|
|
6
|
-
}
|
|
7
|
-
export async function getDefaultProfile(configDir) {
|
|
8
|
-
const cp = configPath(configDir);
|
|
9
|
-
try {
|
|
10
|
-
const raw = await fs.readJSON(cp);
|
|
11
|
-
return raw.defaultProfile || 'default';
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return 'default';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
export async function setDefaultProfile(configDir, profile, log) {
|
|
18
|
-
const profiles = await readProfiles(configDir, log);
|
|
19
|
-
if (!profiles || !(profile in profiles)) {
|
|
20
|
-
log(`Profile '${profile}' not found`);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const cp = configPath(configDir);
|
|
24
|
-
const raw = await fs.readJSON(cp);
|
|
25
|
-
raw.defaultProfile = profile;
|
|
26
|
-
await fs.writeJSON(cp, raw, { spaces: 2 });
|
|
27
|
-
log(`Default profile set to '${profile}'`);
|
|
28
|
-
}
|
|
29
|
-
export async function readConfig(configDir, log, profile) {
|
|
30
|
-
const cp = configPath(configDir);
|
|
31
|
-
try {
|
|
32
|
-
const raw = await fs.readJSON(cp);
|
|
33
|
-
if (raw.profiles) {
|
|
34
|
-
const resolvedProfile = profile ?? (await getDefaultProfile(configDir));
|
|
35
|
-
const auth = raw.profiles[resolvedProfile];
|
|
36
|
-
if (!auth) {
|
|
37
|
-
log(`Profile '${resolvedProfile}' not found`);
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
return { auth };
|
|
41
|
-
}
|
|
42
|
-
// backward compat: old { auth: {...} } format
|
|
43
|
-
if (profile && profile !== 'default') {
|
|
44
|
-
log(`Profile '${profile}' not found`);
|
|
45
|
-
return undefined;
|
|
46
|
-
}
|
|
47
|
-
return raw;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
51
|
-
if (msg.toLowerCase().includes('no such file or directory')) {
|
|
52
|
-
log('Missing authentication config');
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
log(msg);
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export async function readProfiles(configDir, log) {
|
|
61
|
-
const cp = configPath(configDir);
|
|
62
|
-
try {
|
|
63
|
-
const raw = await fs.readJSON(cp);
|
|
64
|
-
if (raw.profiles) {
|
|
65
|
-
return raw.profiles;
|
|
66
|
-
}
|
|
67
|
-
// backward compat: treat old { auth: {...} } as the default profile
|
|
68
|
-
if (raw.auth) {
|
|
69
|
-
return { default: raw.auth };
|
|
70
|
-
}
|
|
71
|
-
return {};
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
const msg = error instanceof Error ? error.message : String(error);
|
|
75
|
-
if (msg.toLowerCase().includes('no such file or directory')) {
|
|
76
|
-
log('No authentication profiles found');
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
log(msg);
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
}
|
package/dist/format.d.ts
DELETED