@hesed/conni 0.1.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 +449 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/conni/auth/add.d.ts +14 -0
- package/dist/commands/conni/auth/add.js +55 -0
- package/dist/commands/conni/auth/test.d.ts +10 -0
- package/dist/commands/conni/auth/test.js +32 -0
- package/dist/commands/conni/auth/update.d.ts +14 -0
- package/dist/commands/conni/auth/update.js +77 -0
- package/dist/commands/conni/content/attachment-download.d.ts +13 -0
- package/dist/commands/conni/content/attachment-download.js +44 -0
- package/dist/commands/conni/content/attachment.d.ts +13 -0
- package/dist/commands/conni/content/attachment.js +40 -0
- package/dist/commands/conni/content/comment-delete.d.ts +12 -0
- package/dist/commands/conni/content/comment-delete.js +29 -0
- package/dist/commands/conni/content/comment-update.d.ts +13 -0
- package/dist/commands/conni/content/comment-update.js +35 -0
- package/dist/commands/conni/content/comment.d.ts +13 -0
- package/dist/commands/conni/content/comment.js +35 -0
- package/dist/commands/conni/content/create.d.ts +11 -0
- package/dist/commands/conni/content/create.js +50 -0
- package/dist/commands/conni/content/delete.d.ts +12 -0
- package/dist/commands/conni/content/delete.js +29 -0
- package/dist/commands/conni/content/get.d.ts +12 -0
- package/dist/commands/conni/content/get.js +29 -0
- package/dist/commands/conni/content/search.d.ts +14 -0
- package/dist/commands/conni/content/search.js +34 -0
- package/dist/commands/conni/content/update.d.ts +12 -0
- package/dist/commands/conni/content/update.js +35 -0
- package/dist/commands/conni/space/get.d.ts +12 -0
- package/dist/commands/conni/space/get.js +29 -0
- package/dist/commands/conni/space/list.d.ts +9 -0
- package/dist/commands/conni/space/list.js +26 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +18 -0
- package/dist/conni/conni-api.d.ts +88 -0
- package/dist/conni/conni-api.js +447 -0
- package/dist/conni/conni-client.d.ts +88 -0
- package/dist/conni/conni-client.js +148 -0
- package/dist/format.d.ts +4 -0
- package/dist/format.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/oclif.manifest.json +667 -0
- package/package.json +107 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ConniApi } from './conni-api.js';
|
|
2
|
+
let conniApi;
|
|
3
|
+
/**
|
|
4
|
+
* Initialize Confluence API
|
|
5
|
+
*/
|
|
6
|
+
async function initConni(config) {
|
|
7
|
+
if (conniApi)
|
|
8
|
+
return conniApi;
|
|
9
|
+
try {
|
|
10
|
+
conniApi = new ConniApi(config);
|
|
11
|
+
return conniApi;
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
15
|
+
throw new Error(`Failed to initialize Confluence client: ${errorMessage}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* List all spaces
|
|
20
|
+
* @param config - Confluence configuration
|
|
21
|
+
*/
|
|
22
|
+
export async function listSpaces(config) {
|
|
23
|
+
const conni = await initConni(config);
|
|
24
|
+
return conni.listSpaces();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get space details
|
|
28
|
+
* @param config - Confluence configuration
|
|
29
|
+
* @param spaceKey - Space key
|
|
30
|
+
*/
|
|
31
|
+
export async function getSpace(config, spaceKey) {
|
|
32
|
+
const conni = await initConni(config);
|
|
33
|
+
return conni.getSpace(spaceKey);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Search pages using CQL
|
|
37
|
+
* @param config - Confluence configuration
|
|
38
|
+
* @param cql - CQL query string
|
|
39
|
+
* @param limit - Maximum number of contents per page
|
|
40
|
+
* @param expand - Properties of the content to expand
|
|
41
|
+
*/
|
|
42
|
+
export async function searchContents(config, cql, limit, expand) {
|
|
43
|
+
const conni = await initConni(config);
|
|
44
|
+
return conni.searchContents(cql, limit, expand);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get page details
|
|
48
|
+
* @param config - Confluence configuration
|
|
49
|
+
* @param pageId - Page ID
|
|
50
|
+
*/
|
|
51
|
+
export async function getContent(config, pageId) {
|
|
52
|
+
const conni = await initConni(config);
|
|
53
|
+
return conni.getContent(pageId);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new page
|
|
57
|
+
* @param config - Confluence configuration
|
|
58
|
+
* @param fields - Page fields (spaceKey, title, body, parentId)
|
|
59
|
+
*/
|
|
60
|
+
export async function createPage(config, fields) {
|
|
61
|
+
const conni = await initConni(config);
|
|
62
|
+
return conni.createPage(fields);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Update an existing page
|
|
66
|
+
* @param config - Confluence configuration
|
|
67
|
+
* @param pageId - Page ID
|
|
68
|
+
* @param fields - Page fields to update (title, body)
|
|
69
|
+
*/
|
|
70
|
+
export async function updateContent(config, pageId, fields) {
|
|
71
|
+
const conni = await initConni(config);
|
|
72
|
+
return conni.updateContent(pageId, fields);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Add an attachment to a page
|
|
76
|
+
* @param config - Confluence configuration
|
|
77
|
+
* @param pageId - Page ID
|
|
78
|
+
* @param filePath - Path to the file to upload
|
|
79
|
+
*/
|
|
80
|
+
export async function addAttachment(config, pageId, filePath) {
|
|
81
|
+
const conni = await initConni(config);
|
|
82
|
+
return conni.addAttachment(pageId, filePath);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Add a comment to a page
|
|
86
|
+
* @param config - Confluence configuration
|
|
87
|
+
* @param pageId - Page ID
|
|
88
|
+
* @param body - Comment body
|
|
89
|
+
*/
|
|
90
|
+
export async function addComment(config, pageId, body) {
|
|
91
|
+
const conni = await initConni(config);
|
|
92
|
+
return conni.addComment(pageId, body);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Delete a comment from a page
|
|
96
|
+
* @param config - Confluence configuration
|
|
97
|
+
* @param id - Comment ID
|
|
98
|
+
*/
|
|
99
|
+
export async function deleteComment(config, id) {
|
|
100
|
+
const conni = await initConni(config);
|
|
101
|
+
return conni.deleteComment(id);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Update a comment on a page
|
|
105
|
+
* @param config - Confluence configuration
|
|
106
|
+
* @param id - Comment ID
|
|
107
|
+
* @param body - Comment body
|
|
108
|
+
*/
|
|
109
|
+
export async function updateComment(config, id, body) {
|
|
110
|
+
const conni = await initConni(config);
|
|
111
|
+
return conni.updateComment(id, body);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Delete a page
|
|
115
|
+
* @param config - Confluence configuration
|
|
116
|
+
* @param pageId - Page ID
|
|
117
|
+
*/
|
|
118
|
+
export async function deleteContent(config, pageId) {
|
|
119
|
+
const conni = await initConni(config);
|
|
120
|
+
return conni.deleteContent(pageId);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Test Confluence API connection
|
|
124
|
+
* @param config - Confluence configuration
|
|
125
|
+
*/
|
|
126
|
+
export async function testConnection(config) {
|
|
127
|
+
const conni = await initConni(config);
|
|
128
|
+
return conni.testConnection();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Clear clients (for cleanup)
|
|
132
|
+
*/
|
|
133
|
+
export function clearClients() {
|
|
134
|
+
if (conniApi) {
|
|
135
|
+
conniApi.clearClients();
|
|
136
|
+
conniApi = null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Download attachment from a page
|
|
141
|
+
* @param config - Confluence configuration
|
|
142
|
+
* @param attachmentId - Attachment ID
|
|
143
|
+
* @param outputPath - Output file path (optional)
|
|
144
|
+
*/
|
|
145
|
+
export async function downloadAttachment(config, attachmentId, outputPath) {
|
|
146
|
+
const conni = await initConni(config);
|
|
147
|
+
return conni.downloadAttachment(attachmentId, outputPath);
|
|
148
|
+
}
|
package/dist/format.d.ts
ADDED
package/dist/format.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|