@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.
Files changed (49) hide show
  1. package/README.md +449 -0
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +5 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +5 -0
  6. package/dist/commands/conni/auth/add.d.ts +14 -0
  7. package/dist/commands/conni/auth/add.js +55 -0
  8. package/dist/commands/conni/auth/test.d.ts +10 -0
  9. package/dist/commands/conni/auth/test.js +32 -0
  10. package/dist/commands/conni/auth/update.d.ts +14 -0
  11. package/dist/commands/conni/auth/update.js +77 -0
  12. package/dist/commands/conni/content/attachment-download.d.ts +13 -0
  13. package/dist/commands/conni/content/attachment-download.js +44 -0
  14. package/dist/commands/conni/content/attachment.d.ts +13 -0
  15. package/dist/commands/conni/content/attachment.js +40 -0
  16. package/dist/commands/conni/content/comment-delete.d.ts +12 -0
  17. package/dist/commands/conni/content/comment-delete.js +29 -0
  18. package/dist/commands/conni/content/comment-update.d.ts +13 -0
  19. package/dist/commands/conni/content/comment-update.js +35 -0
  20. package/dist/commands/conni/content/comment.d.ts +13 -0
  21. package/dist/commands/conni/content/comment.js +35 -0
  22. package/dist/commands/conni/content/create.d.ts +11 -0
  23. package/dist/commands/conni/content/create.js +50 -0
  24. package/dist/commands/conni/content/delete.d.ts +12 -0
  25. package/dist/commands/conni/content/delete.js +29 -0
  26. package/dist/commands/conni/content/get.d.ts +12 -0
  27. package/dist/commands/conni/content/get.js +29 -0
  28. package/dist/commands/conni/content/search.d.ts +14 -0
  29. package/dist/commands/conni/content/search.js +34 -0
  30. package/dist/commands/conni/content/update.d.ts +12 -0
  31. package/dist/commands/conni/content/update.js +35 -0
  32. package/dist/commands/conni/space/get.d.ts +12 -0
  33. package/dist/commands/conni/space/get.js +29 -0
  34. package/dist/commands/conni/space/list.d.ts +9 -0
  35. package/dist/commands/conni/space/list.js +26 -0
  36. package/dist/config.d.ts +10 -0
  37. package/dist/config.js +18 -0
  38. package/dist/conni/conni-api.d.ts +88 -0
  39. package/dist/conni/conni-api.js +447 -0
  40. package/dist/conni/conni-client.d.ts +88 -0
  41. package/dist/conni/conni-client.js +148 -0
  42. package/dist/format.d.ts +4 -0
  43. package/dist/format.js +10 -0
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +1 -0
  46. package/dist/utils.d.ts +1 -0
  47. package/dist/utils.js +1 -0
  48. package/oclif.manifest.json +667 -0
  49. 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
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Format data as TOON (Token-Oriented Object Notation)
3
+ */
4
+ export declare function formatAsToon(data: unknown): string;
package/dist/format.js ADDED
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
@@ -0,0 +1 @@
1
+ export {};
package/dist/utils.js ADDED
@@ -0,0 +1 @@
1
+ export {};