@hesed/conni 0.3.1 → 0.4.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 +23 -17
- package/dist/commands/conni/content/create.d.ts +1 -0
- package/dist/commands/conni/content/create.js +11 -2
- package/dist/conni/conni-api.d.ts +9 -0
- package/dist/conni/conni-api.js +119 -27
- package/dist/conni/conni-client.d.ts +7 -0
- package/dist/conni/conni-client.js +10 -0
- package/oclif.manifest.json +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ $ npm install -g @hesed/conni
|
|
|
26
26
|
$ conni COMMAND
|
|
27
27
|
running command...
|
|
28
28
|
$ conni (--version)
|
|
29
|
-
@hesed/conni/0.
|
|
29
|
+
@hesed/conni/0.4.0 darwin-arm64 node-v22.14.0
|
|
30
30
|
$ conni --help [COMMAND]
|
|
31
31
|
USAGE
|
|
32
32
|
$ conni COMMAND
|
|
@@ -76,7 +76,7 @@ EXAMPLES
|
|
|
76
76
|
$ conni conni auth add
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
_See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
79
|
+
_See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/add.ts)_
|
|
80
80
|
|
|
81
81
|
## `conni conni auth test`
|
|
82
82
|
|
|
@@ -96,7 +96,7 @@ EXAMPLES
|
|
|
96
96
|
$ conni conni auth test
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
_See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
99
|
+
_See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/test.ts)_
|
|
100
100
|
|
|
101
101
|
## `conni conni auth update`
|
|
102
102
|
|
|
@@ -121,7 +121,7 @@ EXAMPLES
|
|
|
121
121
|
$ conni conni auth update
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
_See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
124
|
+
_See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/auth/update.ts)_
|
|
125
125
|
|
|
126
126
|
## `conni conni content attachment PAGEID FILE`
|
|
127
127
|
|
|
@@ -145,7 +145,7 @@ EXAMPLES
|
|
|
145
145
|
$ conni conni content attachment 123456 ./document.pdf
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
_See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
148
|
+
_See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/attachment.ts)_
|
|
149
149
|
|
|
150
150
|
## `conni conni content attachment-download ATTACHMENTID [OUTPUTPATH]`
|
|
151
151
|
|
|
@@ -171,7 +171,7 @@ EXAMPLES
|
|
|
171
171
|
$ conni conni content attachment-download att12345 ./document.pdf
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
_See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
174
|
+
_See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/attachment-download.ts)_
|
|
175
175
|
|
|
176
176
|
## `conni conni content comment PAGEID BODY`
|
|
177
177
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
$ conni conni content comment 123456 "$(cat content.md)"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
207
|
+
_See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment.ts)_
|
|
208
208
|
|
|
209
209
|
## `conni conni content comment-delete ID`
|
|
210
210
|
|
|
@@ -227,7 +227,7 @@ EXAMPLES
|
|
|
227
227
|
$ conni conni content comment-delete 1544224770
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
_See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
230
|
+
_See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment-delete.ts)_
|
|
231
231
|
|
|
232
232
|
## `conni conni content comment-update ID BODY`
|
|
233
233
|
|
|
@@ -260,7 +260,7 @@ EXAMPLES
|
|
|
260
260
|
$ conni conni content comment-update 1544224770 "$(cat content.md)"
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
_See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
263
|
+
_See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/comment-update.ts)_
|
|
264
264
|
|
|
265
265
|
## `conni conni content create`
|
|
266
266
|
|
|
@@ -268,9 +268,10 @@ Create a new Confluence page
|
|
|
268
268
|
|
|
269
269
|
```
|
|
270
270
|
USAGE
|
|
271
|
-
$ conni conni content create --fields <value>... [--toon]
|
|
271
|
+
$ conni conni content create --fields <value>... [--attach <value>...] [--toon]
|
|
272
272
|
|
|
273
273
|
FLAGS
|
|
274
|
+
--attach=<value>... Path to a file to upload and embed inline (can be used multiple times)
|
|
274
275
|
--fields=<value>... (required) Content fields in key=value format
|
|
275
276
|
--toon Format output as toon
|
|
276
277
|
|
|
@@ -291,13 +292,18 @@ EXAMPLES
|
|
|
291
292
|
|
|
292
293
|
$ conni conni content create --fields spaceKey="DEV" title="Child page" body="Content" parentId="123456"
|
|
293
294
|
|
|
295
|
+
$ conni conni content create --fields spaceKey="DEV" title="Page with image" body="See the diagram:
|
|
296
|
+
" --attach ./diagram.png
|
|
297
|
+
|
|
298
|
+
$ conni conni content create --fields spaceKey="DEV" title="Page with files" body="Content" --attach ./image.png --attach ./report.pdf
|
|
299
|
+
|
|
294
300
|
FLAG DESCRIPTIONS
|
|
295
301
|
--fields=<value>... Content fields in key=value format
|
|
296
302
|
|
|
297
303
|
Minimum fields required: spaceKey, title & body
|
|
298
304
|
```
|
|
299
305
|
|
|
300
|
-
_See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
306
|
+
_See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/create.ts)_
|
|
301
307
|
|
|
302
308
|
## `conni conni content delete PAGEID`
|
|
303
309
|
|
|
@@ -320,7 +326,7 @@ EXAMPLES
|
|
|
320
326
|
$ conni conni content delete 1543634992
|
|
321
327
|
```
|
|
322
328
|
|
|
323
|
-
_See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
329
|
+
_See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/delete.ts)_
|
|
324
330
|
|
|
325
331
|
## `conni conni content get PAGEID`
|
|
326
332
|
|
|
@@ -343,7 +349,7 @@ EXAMPLES
|
|
|
343
349
|
$ conni conni content get 1544060948
|
|
344
350
|
```
|
|
345
351
|
|
|
346
|
-
_See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
352
|
+
_See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/get.ts)_
|
|
347
353
|
|
|
348
354
|
## `conni conni content search CQL`
|
|
349
355
|
|
|
@@ -370,7 +376,7 @@ EXAMPLES
|
|
|
370
376
|
$ conni conni content search 'created > startOfMonth()' --limit=5 --expand=body,version
|
|
371
377
|
```
|
|
372
378
|
|
|
373
|
-
_See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
379
|
+
_See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/search.ts)_
|
|
374
380
|
|
|
375
381
|
## `conni conni content update PAGEID`
|
|
376
382
|
|
|
@@ -404,7 +410,7 @@ EXAMPLES
|
|
|
404
410
|
$ conni conni content update 1076199489 --fields body="$(cat content.md)"
|
|
405
411
|
```
|
|
406
412
|
|
|
407
|
-
_See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
413
|
+
_See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/content/update.ts)_
|
|
408
414
|
|
|
409
415
|
## `conni conni space get SPACEKEY`
|
|
410
416
|
|
|
@@ -427,7 +433,7 @@ EXAMPLES
|
|
|
427
433
|
$ conni conni space get DEV
|
|
428
434
|
```
|
|
429
435
|
|
|
430
|
-
_See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
436
|
+
_See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/space/get.ts)_
|
|
431
437
|
|
|
432
438
|
## `conni conni space list`
|
|
433
439
|
|
|
@@ -447,5 +453,5 @@ EXAMPLES
|
|
|
447
453
|
$ conni conni space list
|
|
448
454
|
```
|
|
449
455
|
|
|
450
|
-
_See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.
|
|
456
|
+
_See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.4.0/src/commands/conni/space/list.ts)_
|
|
451
457
|
<!-- commandsstop -->
|
|
@@ -4,6 +4,7 @@ export default class ContentCreate extends Command {
|
|
|
4
4
|
static description: string;
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
|
+
attach: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
fields: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Flags } from '@oclif/core';
|
|
2
2
|
import { readConfig } from '../../../config.js';
|
|
3
|
-
import { clearClients, createPage } from '../../../conni/conni-client.js';
|
|
3
|
+
import { clearClients, createPage, createPageWithMedia } from '../../../conni/conni-client.js';
|
|
4
4
|
import { formatAsToon } from '../../../format.js';
|
|
5
5
|
export default class ContentCreate extends Command {
|
|
6
6
|
static args = {};
|
|
@@ -9,8 +9,15 @@ export default class ContentCreate extends Command {
|
|
|
9
9
|
'<%= config.bin %> <%= command.id %> --fields spaceKey="DEV" title="New title" body="New description" status="draft"',
|
|
10
10
|
'<%= config.bin %> <%= command.id %> --fields spaceKey="DEV" title="New title" body=\'\n# Header\n## Sub-header\n- Item 1\n- Item 2\n```bash\nls -a\n```\'',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --fields spaceKey="DEV" title="Child page" body="Content" parentId="123456"',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> --fields spaceKey="DEV" title="Page with image" body="See the diagram:\n" --attach ./diagram.png',
|
|
13
|
+
'<%= config.bin %> <%= command.id %> --fields spaceKey="DEV" title="Page with files" body="Content" --attach ./image.png --attach ./report.pdf',
|
|
12
14
|
];
|
|
13
15
|
static flags = {
|
|
16
|
+
attach: Flags.string({
|
|
17
|
+
description: 'Path to a file to upload and embed inline (can be used multiple times)',
|
|
18
|
+
multiple: true,
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
14
21
|
fields: Flags.string({
|
|
15
22
|
description: 'Minimum fields required: spaceKey, title & body',
|
|
16
23
|
multiple: true,
|
|
@@ -39,7 +46,9 @@ export default class ContentCreate extends Command {
|
|
|
39
46
|
this.error(`Required field "${required}" is missing`);
|
|
40
47
|
}
|
|
41
48
|
}
|
|
42
|
-
const result =
|
|
49
|
+
const result = flags.attach
|
|
50
|
+
? await createPageWithMedia(config.auth, fields, flags.attach)
|
|
51
|
+
: await createPage(config.auth, fields);
|
|
43
52
|
clearClients();
|
|
44
53
|
if (flags.toon) {
|
|
45
54
|
this.log(formatAsToon(result));
|
|
@@ -36,6 +36,12 @@ export declare class ConniApi {
|
|
|
36
36
|
* Create a new page
|
|
37
37
|
*/
|
|
38
38
|
createPage(fields: Record<string, unknown>): Promise<ApiResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Create a new page with inline media attachments.
|
|
41
|
+
* Creates the page first to obtain a page ID, then uploads attachments and
|
|
42
|
+
* patches the ADF body to embed them by file ID before updating the page.
|
|
43
|
+
*/
|
|
44
|
+
createPageWithMedia(fields: Record<string, unknown>, filePaths: string[]): Promise<ApiResult>;
|
|
39
45
|
/**
|
|
40
46
|
* Delete a comment from a page
|
|
41
47
|
*/
|
|
@@ -80,4 +86,7 @@ export declare class ConniApi {
|
|
|
80
86
|
* Update an existing page
|
|
81
87
|
*/
|
|
82
88
|
updateContent(pageId: string, fields: Record<string, unknown>): Promise<ApiResult>;
|
|
89
|
+
private buildPageBody;
|
|
90
|
+
private collectExternalMedia;
|
|
91
|
+
private patchMediaNodes;
|
|
83
92
|
}
|
package/dist/conni/conni-api.js
CHANGED
|
@@ -106,38 +106,70 @@ export class ConniApi {
|
|
|
106
106
|
async createPage(fields) {
|
|
107
107
|
try {
|
|
108
108
|
const client = this.getClient();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
const { contentPayload } = this.buildPageBody(fields);
|
|
110
|
+
const response = await client.content.createContent(contentPayload);
|
|
111
|
+
return { data: response, success: true };
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
const errorMessage = typeof error === 'object' ? String(error.message) : String(error);
|
|
115
|
+
return { error: errorMessage, success: false };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Create a new page with inline media attachments.
|
|
120
|
+
* Creates the page first to obtain a page ID, then uploads attachments and
|
|
121
|
+
* patches the ADF body to embed them by file ID before updating the page.
|
|
122
|
+
*/
|
|
123
|
+
async createPageWithMedia(fields, filePaths) {
|
|
124
|
+
try {
|
|
125
|
+
const client = this.getClient();
|
|
126
|
+
const { bodyContent, contentPayload } = this.buildPageBody(fields);
|
|
127
|
+
const { title } = contentPayload;
|
|
128
|
+
const externalMediaByBasename = new Map();
|
|
129
|
+
this.collectExternalMedia(bodyContent.content, externalMediaByBasename);
|
|
130
|
+
const inlinePaths = [];
|
|
131
|
+
const trailingPaths = [];
|
|
132
|
+
for (const f of filePaths) {
|
|
133
|
+
if (externalMediaByBasename.has(path.basename(f))) {
|
|
134
|
+
inlinePaths.push(f);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
trailingPaths.push(f);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Create the page first to get a page ID for attachment uploads.
|
|
141
|
+
const page = await client.content.createContent(contentPayload);
|
|
142
|
+
const pageId = page.id;
|
|
143
|
+
if (!pageId) {
|
|
144
|
+
return { error: 'Failed to get page ID from creation response', success: false };
|
|
145
|
+
}
|
|
146
|
+
const uploadResults = await Promise.all(filePaths.map((filePath) => this.addAttachment(pageId, filePath)));
|
|
147
|
+
const firstFailure = uploadResults.find((r) => !r.success);
|
|
148
|
+
if (firstFailure)
|
|
149
|
+
return firstFailure;
|
|
150
|
+
const fileInfoByPath = new Map();
|
|
151
|
+
for (const [i, filePath] of filePaths.entries()) {
|
|
152
|
+
const uploadData = uploadResults[i].data;
|
|
153
|
+
const att = uploadData?.results?.[0];
|
|
154
|
+
const fileId = att?.extensions?.fileId;
|
|
155
|
+
const collectionName = att?.extensions?.collectionName ?? '';
|
|
156
|
+
if (fileId) {
|
|
157
|
+
fileInfoByPath.set(filePath, { collection: collectionName, id: fileId });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
this.patchMediaNodes(bodyContent.content, inlinePaths, trailingPaths, fileInfoByPath, externalMediaByBasename);
|
|
161
|
+
const updatedPage = await client.content.updateContent({
|
|
162
|
+
body: { storage: { representation: 'atlas_doc_format', value: JSON.stringify(bodyContent) } },
|
|
163
|
+
id: pageId,
|
|
126
164
|
title,
|
|
127
165
|
type: 'page',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
data: response,
|
|
132
|
-
success: true,
|
|
133
|
-
};
|
|
166
|
+
version: { number: 2 },
|
|
167
|
+
});
|
|
168
|
+
return { data: updatedPage, success: true };
|
|
134
169
|
}
|
|
135
170
|
catch (error) {
|
|
136
171
|
const errorMessage = typeof error === 'object' ? String(error.message) : String(error);
|
|
137
|
-
return {
|
|
138
|
-
error: errorMessage,
|
|
139
|
-
success: false,
|
|
140
|
-
};
|
|
172
|
+
return { error: errorMessage, success: false };
|
|
141
173
|
}
|
|
142
174
|
}
|
|
143
175
|
/**
|
|
@@ -444,4 +476,64 @@ export class ConniApi {
|
|
|
444
476
|
};
|
|
445
477
|
}
|
|
446
478
|
}
|
|
479
|
+
buildPageBody(fields) {
|
|
480
|
+
// eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
481
|
+
const bodyContent = markdownToAdf(fields.body.replace(/\\n/g, '\n'));
|
|
482
|
+
const spaceKey = fields.spaceKey;
|
|
483
|
+
const title = fields.title;
|
|
484
|
+
const parentId = fields.parentId;
|
|
485
|
+
const status = fields.status;
|
|
486
|
+
return {
|
|
487
|
+
bodyContent,
|
|
488
|
+
contentPayload: {
|
|
489
|
+
ancestors: parentId ? [{ id: parentId }] : undefined,
|
|
490
|
+
body: { storage: { representation: 'atlas_doc_format', value: JSON.stringify(bodyContent) } },
|
|
491
|
+
space: { key: spaceKey },
|
|
492
|
+
status,
|
|
493
|
+
title,
|
|
494
|
+
type: 'page',
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
collectExternalMedia(nodes, map) {
|
|
499
|
+
for (const node of nodes) {
|
|
500
|
+
const content = node.content;
|
|
501
|
+
const media = node.type === 'mediaSingle' ? content?.[0] : undefined;
|
|
502
|
+
const attrs = media?.type === 'media' ? media.attrs : undefined;
|
|
503
|
+
if (attrs?.type === 'external' && typeof attrs.url === 'string') {
|
|
504
|
+
const base = path.basename(attrs.url);
|
|
505
|
+
if (!map.has(base))
|
|
506
|
+
map.set(base, []);
|
|
507
|
+
map.get(base).push(attrs);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
if (content)
|
|
511
|
+
this.collectExternalMedia(content, map);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
/* eslint-disable max-params */
|
|
515
|
+
patchMediaNodes(bodyNodes, inlinePaths, trailingPaths, fileInfoByPath, externalMediaByBasename) {
|
|
516
|
+
for (const filePath of inlinePaths) {
|
|
517
|
+
const info = fileInfoByPath.get(filePath);
|
|
518
|
+
if (!info)
|
|
519
|
+
continue;
|
|
520
|
+
for (const attrs of externalMediaByBasename.get(path.basename(filePath)) ?? []) {
|
|
521
|
+
delete attrs.url;
|
|
522
|
+
delete attrs.alt;
|
|
523
|
+
attrs.collection = info.collection;
|
|
524
|
+
attrs.id = info.id;
|
|
525
|
+
attrs.type = 'file';
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
for (const filePath of trailingPaths) {
|
|
529
|
+
const info = fileInfoByPath.get(filePath);
|
|
530
|
+
if (!info)
|
|
531
|
+
continue;
|
|
532
|
+
bodyNodes.push({
|
|
533
|
+
attrs: { layout: 'center' },
|
|
534
|
+
content: [{ attrs: { collection: info.collection, id: info.id, type: 'file' }, type: 'media' }],
|
|
535
|
+
type: 'mediaSingle',
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
}
|
|
447
539
|
}
|
|
@@ -30,6 +30,13 @@ export declare function getContent(config: Config, pageId: string): Promise<ApiR
|
|
|
30
30
|
* @param fields - Page fields (spaceKey, title, body, parentId)
|
|
31
31
|
*/
|
|
32
32
|
export declare function createPage(config: Config, fields: Record<string, unknown>): Promise<ApiResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new page with inline media attachments
|
|
35
|
+
* @param config - Confluence configuration
|
|
36
|
+
* @param fields - Page fields (spaceKey, title, body, parentId)
|
|
37
|
+
* @param filePaths - Local file paths to upload and embed inline
|
|
38
|
+
*/
|
|
39
|
+
export declare function createPageWithMedia(config: Config, fields: Record<string, unknown>, filePaths: string[]): Promise<ApiResult>;
|
|
33
40
|
/**
|
|
34
41
|
* Update an existing page
|
|
35
42
|
* @param config - Confluence configuration
|
|
@@ -61,6 +61,16 @@ export async function createPage(config, fields) {
|
|
|
61
61
|
const conni = await initConni(config);
|
|
62
62
|
return conni.createPage(fields);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a new page with inline media attachments
|
|
66
|
+
* @param config - Confluence configuration
|
|
67
|
+
* @param fields - Page fields (spaceKey, title, body, parentId)
|
|
68
|
+
* @param filePaths - Local file paths to upload and embed inline
|
|
69
|
+
*/
|
|
70
|
+
export async function createPageWithMedia(config, fields, filePaths) {
|
|
71
|
+
const conni = await initConni(config);
|
|
72
|
+
return conni.createPageWithMedia(fields, filePaths);
|
|
73
|
+
}
|
|
64
74
|
/**
|
|
65
75
|
* Update an existing page
|
|
66
76
|
* @param config - Confluence configuration
|
package/oclif.manifest.json
CHANGED
|
@@ -378,9 +378,19 @@
|
|
|
378
378
|
"examples": [
|
|
379
379
|
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"New title\" body=\"New description\" status=\"draft\"",
|
|
380
380
|
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"New title\" body='\n# Header\n## Sub-header\n- Item 1\n- Item 2\n```bash\nls -a\n```'",
|
|
381
|
-
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"Child page\" body=\"Content\" parentId=\"123456\""
|
|
381
|
+
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"Child page\" body=\"Content\" parentId=\"123456\"",
|
|
382
|
+
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"Page with image\" body=\"See the diagram:\n\" --attach ./diagram.png",
|
|
383
|
+
"<%= config.bin %> <%= command.id %> --fields spaceKey=\"DEV\" title=\"Page with files\" body=\"Content\" --attach ./image.png --attach ./report.pdf"
|
|
382
384
|
],
|
|
383
385
|
"flags": {
|
|
386
|
+
"attach": {
|
|
387
|
+
"description": "Path to a file to upload and embed inline (can be used multiple times)",
|
|
388
|
+
"name": "attach",
|
|
389
|
+
"required": false,
|
|
390
|
+
"hasDynamicHelp": false,
|
|
391
|
+
"multiple": true,
|
|
392
|
+
"type": "option"
|
|
393
|
+
},
|
|
384
394
|
"fields": {
|
|
385
395
|
"description": "Minimum fields required: spaceKey, title & body",
|
|
386
396
|
"name": "fields",
|
|
@@ -664,5 +674,5 @@
|
|
|
664
674
|
]
|
|
665
675
|
}
|
|
666
676
|
},
|
|
667
|
-
"version": "0.
|
|
677
|
+
"version": "0.4.0"
|
|
668
678
|
}
|