@hesed/conni 0.7.2 → 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.
Files changed (34) hide show
  1. package/README.md +48 -22
  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 +5 -5
  15. package/dist/commands/conni/content/attachment.js +5 -5
  16. package/dist/commands/conni/content/comment-delete.js +5 -5
  17. package/dist/commands/conni/content/comment-update.js +5 -5
  18. package/dist/commands/conni/content/comment.js +5 -5
  19. package/dist/commands/conni/content/create.js +5 -7
  20. package/dist/commands/conni/content/delete.js +5 -5
  21. package/dist/commands/conni/content/get.js +5 -5
  22. package/dist/commands/conni/content/search.js +5 -5
  23. package/dist/commands/conni/content/update.js +5 -5
  24. package/dist/commands/conni/space/get.js +5 -5
  25. package/dist/commands/conni/space/list.js +5 -5
  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 +49 -4
  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,7 +3,7 @@
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
9
  "<%= config.bin %> <%= command.id %> --profile work"
@@ -45,7 +45,8 @@
45
45
  },
46
46
  "url": {
47
47
  "char": "u",
48
- "description": "Atlassian URL (start with https://)",
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": "Atlassian instance URL (start with https://)",
280
+ "description": "Confluence instance URL (start with https://)",
281
+ "hidden": false,
237
282
  "name": "url",
238
283
  "required": true,
239
284
  "hasDynamicHelp": false,
@@ -910,5 +955,5 @@
910
955
  ]
911
956
  }
912
957
  },
913
- "version": "0.7.2"
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.7.2",
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.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
- }