@hesed/conni 0.7.2 → 0.9.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.
Files changed (34) hide show
  1. package/README.md +63 -37
  2. package/dist/commands/conni/auth/add.d.ts +2 -15
  3. package/dist/commands/conni/auth/add.js +7 -60
  4. package/dist/commands/conni/auth/delete.d.ts +2 -0
  5. package/dist/commands/conni/auth/delete.js +2 -0
  6. package/dist/commands/conni/auth/list.d.ts +2 -20
  7. package/dist/commands/conni/auth/list.js +2 -36
  8. package/dist/commands/conni/auth/profile.d.ts +2 -11
  9. package/dist/commands/conni/auth/profile.js +2 -23
  10. package/dist/commands/conni/auth/test.d.ts +2 -12
  11. package/dist/commands/conni/auth/test.js +7 -37
  12. package/dist/commands/conni/auth/update.d.ts +2 -15
  13. package/dist/commands/conni/auth/update.js +7 -83
  14. package/dist/commands/conni/content/attachment-download.js +6 -6
  15. package/dist/commands/conni/content/attachment.js +6 -6
  16. package/dist/commands/conni/content/comment-delete.js +6 -6
  17. package/dist/commands/conni/content/comment-update.js +6 -6
  18. package/dist/commands/conni/content/comment.js +6 -6
  19. package/dist/commands/conni/content/create.js +6 -8
  20. package/dist/commands/conni/content/delete.js +6 -6
  21. package/dist/commands/conni/content/get.js +6 -6
  22. package/dist/commands/conni/content/search.js +6 -6
  23. package/dist/commands/conni/content/update.js +6 -6
  24. package/dist/commands/conni/space/get.js +6 -6
  25. package/dist/commands/conni/space/list.js +6 -6
  26. package/dist/conni/conni-api.d.ts +2 -14
  27. package/dist/conni/conni-client.d.ts +17 -95
  28. package/dist/conni/conni-client.js +17 -115
  29. package/oclif.manifest.json +82 -39
  30. package/package.json +2 -2
  31. package/dist/config.d.ts +0 -14
  32. package/dist/config.js +0 -83
  33. package/dist/format.d.ts +0 -4
  34. package/dist/format.js +0 -10
@@ -3,10 +3,10 @@
3
3
  "conni:auth:add": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "Add Atlassian authentication",
6
+ "description": "Add Confluence authentication",
7
7
  "examples": [
8
8
  "<%= config.bin %> <%= command.id %>",
9
- "<%= config.bin %> <%= command.id %> --profile work"
9
+ "<%= config.bin %> <%= command.id %> -p prod"
10
10
  ],
11
11
  "flags": {
12
12
  "json": {
@@ -16,37 +16,37 @@
16
16
  "allowNo": false,
17
17
  "type": "boolean"
18
18
  },
19
- "email": {
20
- "char": "e",
21
- "description": "Account email",
22
- "name": "email",
23
- "required": false,
24
- "hasDynamicHelp": false,
25
- "multiple": false,
26
- "type": "option"
27
- },
28
19
  "profile": {
29
20
  "char": "p",
30
21
  "description": "Profile name",
31
22
  "name": "profile",
32
- "required": false,
23
+ "required": true,
33
24
  "hasDynamicHelp": false,
34
25
  "multiple": false,
35
26
  "type": "option"
36
27
  },
37
- "token": {
28
+ "apiToken": {
38
29
  "char": "t",
39
30
  "description": "API Token",
40
- "name": "token",
31
+ "name": "apiToken",
32
+ "required": true,
33
+ "hasDynamicHelp": false,
34
+ "multiple": false,
35
+ "type": "option"
36
+ },
37
+ "email": {
38
+ "char": "e",
39
+ "description": "Account email",
40
+ "name": "email",
41
41
  "required": true,
42
42
  "hasDynamicHelp": false,
43
43
  "multiple": false,
44
44
  "type": "option"
45
45
  },
46
- "url": {
46
+ "host": {
47
47
  "char": "u",
48
- "description": "Atlassian URL (start with https://)",
49
- "name": "url",
48
+ "description": "Confluence instance URL",
49
+ "name": "host",
50
50
  "required": true,
51
51
  "hasDynamicHelp": false,
52
52
  "multiple": false,
@@ -70,6 +70,49 @@
70
70
  "add.js"
71
71
  ]
72
72
  },
73
+ "conni:auth:delete": {
74
+ "aliases": [],
75
+ "args": {},
76
+ "description": "Delete an authentication profile",
77
+ "examples": [
78
+ "<%= config.bin %> <%= command.id %>",
79
+ "<%= config.bin %> <%= command.id %> -p prod"
80
+ ],
81
+ "flags": {
82
+ "json": {
83
+ "description": "Format output as json.",
84
+ "helpGroup": "GLOBAL",
85
+ "name": "json",
86
+ "allowNo": false,
87
+ "type": "boolean"
88
+ },
89
+ "profile": {
90
+ "char": "p",
91
+ "description": "Profile to delete",
92
+ "name": "profile",
93
+ "required": false,
94
+ "hasDynamicHelp": false,
95
+ "multiple": false,
96
+ "type": "option"
97
+ }
98
+ },
99
+ "hasDynamicHelp": false,
100
+ "hiddenAliases": [],
101
+ "id": "conni:auth:delete",
102
+ "pluginAlias": "@hesed/conni",
103
+ "pluginName": "@hesed/conni",
104
+ "pluginType": "core",
105
+ "strict": true,
106
+ "enableJsonFlag": true,
107
+ "isESM": true,
108
+ "relativePath": [
109
+ "dist",
110
+ "commands",
111
+ "conni",
112
+ "auth",
113
+ "delete.js"
114
+ ]
115
+ },
73
116
  "conni:auth:list": {
74
117
  "aliases": [],
75
118
  "args": {},
@@ -109,7 +152,7 @@
109
152
  "description": "Set or show the default authentication profile",
110
153
  "examples": [
111
154
  "<%= config.bin %> <%= command.id %>",
112
- "<%= config.bin %> <%= command.id %> --default work"
155
+ "<%= config.bin %> <%= command.id %> --default test"
113
156
  ],
114
157
  "flags": {
115
158
  "json": {
@@ -120,7 +163,7 @@
120
163
  "type": "boolean"
121
164
  },
122
165
  "default": {
123
- "description": "Profile name to set as default",
166
+ "description": "Profile to set as default",
124
167
  "name": "default",
125
168
  "required": false,
126
169
  "hasDynamicHelp": false,
@@ -151,7 +194,7 @@
151
194
  "description": "Test authentication and connection",
152
195
  "examples": [
153
196
  "<%= config.bin %> <%= command.id %>",
154
- "<%= config.bin %> <%= command.id %> --profile work"
197
+ "<%= config.bin %> <%= command.id %> -p prod"
155
198
  ],
156
199
  "flags": {
157
200
  "json": {
@@ -191,10 +234,10 @@
191
234
  "conni:auth:update": {
192
235
  "aliases": [],
193
236
  "args": {},
194
- "description": "Update existing authentication profile",
237
+ "description": "Update Confluence authentication",
195
238
  "examples": [
196
239
  "<%= config.bin %> <%= command.id %>",
197
- "<%= config.bin %> <%= command.id %> --profile work"
240
+ "<%= config.bin %> <%= command.id %> -p test"
198
241
  ],
199
242
  "flags": {
200
243
  "json": {
@@ -204,37 +247,37 @@
204
247
  "allowNo": false,
205
248
  "type": "boolean"
206
249
  },
207
- "email": {
208
- "char": "e",
209
- "description": "Account email",
210
- "name": "email",
211
- "required": false,
212
- "hasDynamicHelp": false,
213
- "multiple": false,
214
- "type": "option"
215
- },
216
250
  "profile": {
217
251
  "char": "p",
218
- "description": "Profile name to update (default: \"default\")",
252
+ "description": "Profile name",
219
253
  "name": "profile",
220
- "required": false,
254
+ "required": true,
221
255
  "hasDynamicHelp": false,
222
256
  "multiple": false,
223
257
  "type": "option"
224
258
  },
225
- "token": {
259
+ "apiToken": {
226
260
  "char": "t",
227
261
  "description": "API Token",
228
- "name": "token",
262
+ "name": "apiToken",
263
+ "required": true,
264
+ "hasDynamicHelp": false,
265
+ "multiple": false,
266
+ "type": "option"
267
+ },
268
+ "email": {
269
+ "char": "e",
270
+ "description": "Account email",
271
+ "name": "email",
229
272
  "required": true,
230
273
  "hasDynamicHelp": false,
231
274
  "multiple": false,
232
275
  "type": "option"
233
276
  },
234
- "url": {
277
+ "host": {
235
278
  "char": "u",
236
- "description": "Atlassian instance URL (start with https://)",
237
- "name": "url",
279
+ "description": "Confluence instance URL",
280
+ "name": "host",
238
281
  "required": true,
239
282
  "hasDynamicHelp": false,
240
283
  "multiple": false,
@@ -910,5 +953,5 @@
910
953
  ]
911
954
  }
912
955
  },
913
- "version": "0.7.2"
956
+ "version": "0.9.0"
914
957
  }
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.7.2",
4
+ "version": "0.9.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.9.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.outputJSON(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
@@ -1,4 +0,0 @@
1
- /**
2
- * Format data as TOON (Token-Oriented Object Notation)
3
- */
4
- export declare function formatAsToon(data: unknown): string;
package/dist/format.js DELETED
@@ -1,10 +0,0 @@
1
- import { encode } from '@toon-format/toon';
2
- /**
3
- * Format data as TOON (Token-Oriented Object Notation)
4
- */
5
- export function formatAsToon(data) {
6
- if (!data) {
7
- return '';
8
- }
9
- return encode(data);
10
- }