@hesed/conni 0.6.0 → 0.6.1
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
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.6.
|
|
29
|
+
@hesed/conni/0.6.1 linux-x64 node-v24.14.1
|
|
30
30
|
$ conni --help [COMMAND]
|
|
31
31
|
USAGE
|
|
32
32
|
$ conni COMMAND
|
|
@@ -81,7 +81,7 @@ EXAMPLES
|
|
|
81
81
|
$ conni conni auth add --profile work
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
_See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
84
|
+
_See code: [src/commands/conni/auth/add.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/auth/add.ts)_
|
|
85
85
|
|
|
86
86
|
## `conni conni auth list`
|
|
87
87
|
|
|
@@ -101,7 +101,7 @@ EXAMPLES
|
|
|
101
101
|
$ conni conni auth list
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
_See code: [src/commands/conni/auth/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
104
|
+
_See code: [src/commands/conni/auth/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/auth/list.ts)_
|
|
105
105
|
|
|
106
106
|
## `conni conni auth profile`
|
|
107
107
|
|
|
@@ -126,7 +126,7 @@ EXAMPLES
|
|
|
126
126
|
$ conni conni auth profile --default work
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
_See code: [src/commands/conni/auth/profile.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
129
|
+
_See code: [src/commands/conni/auth/profile.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/auth/profile.ts)_
|
|
130
130
|
|
|
131
131
|
## `conni conni auth test`
|
|
132
132
|
|
|
@@ -151,7 +151,7 @@ EXAMPLES
|
|
|
151
151
|
$ conni conni auth test --profile work
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
_See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
154
|
+
_See code: [src/commands/conni/auth/test.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/auth/test.ts)_
|
|
155
155
|
|
|
156
156
|
## `conni conni auth update`
|
|
157
157
|
|
|
@@ -179,7 +179,7 @@ EXAMPLES
|
|
|
179
179
|
$ conni conni auth update --profile work
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
_See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
182
|
+
_See code: [src/commands/conni/auth/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/auth/update.ts)_
|
|
183
183
|
|
|
184
184
|
## `conni conni content attachment PAGEID FILE`
|
|
185
185
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
$ conni conni content attachment 123456 ./document.pdf
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
207
|
+
_See code: [src/commands/conni/content/attachment.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/attachment.ts)_
|
|
208
208
|
|
|
209
209
|
## `conni conni content attachment-download ATTACHMENTID [OUTPUTPATH]`
|
|
210
210
|
|
|
@@ -231,7 +231,7 @@ EXAMPLES
|
|
|
231
231
|
$ conni conni content attachment-download att12345 ./document.pdf
|
|
232
232
|
```
|
|
233
233
|
|
|
234
|
-
_See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
234
|
+
_See code: [src/commands/conni/content/attachment-download.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/attachment-download.ts)_
|
|
235
235
|
|
|
236
236
|
## `conni conni content comment PAGEID BODY`
|
|
237
237
|
|
|
@@ -265,7 +265,7 @@ EXAMPLES
|
|
|
265
265
|
$ conni conni content comment 123456 "$(cat content.md)"
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
_See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
268
|
+
_See code: [src/commands/conni/content/comment.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/comment.ts)_
|
|
269
269
|
|
|
270
270
|
## `conni conni content comment-delete ID`
|
|
271
271
|
|
|
@@ -289,7 +289,7 @@ EXAMPLES
|
|
|
289
289
|
$ conni conni content comment-delete 1544224770
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
_See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
292
|
+
_See code: [src/commands/conni/content/comment-delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/comment-delete.ts)_
|
|
293
293
|
|
|
294
294
|
## `conni conni content comment-update ID BODY`
|
|
295
295
|
|
|
@@ -323,7 +323,7 @@ EXAMPLES
|
|
|
323
323
|
$ conni conni content comment-update 1544224770 "$(cat content.md)"
|
|
324
324
|
```
|
|
325
325
|
|
|
326
|
-
_See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
326
|
+
_See code: [src/commands/conni/content/comment-update.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/comment-update.ts)_
|
|
327
327
|
|
|
328
328
|
## `conni conni content create`
|
|
329
329
|
|
|
@@ -370,7 +370,7 @@ FLAG DESCRIPTIONS
|
|
|
370
370
|
Content fields in key=value format. Use @file to read value from a file (e.g. body=@content.xml)
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
_See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
373
|
+
_See code: [src/commands/conni/content/create.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/create.ts)_
|
|
374
374
|
|
|
375
375
|
## `conni conni content delete PAGEID`
|
|
376
376
|
|
|
@@ -394,7 +394,7 @@ EXAMPLES
|
|
|
394
394
|
$ conni conni content delete 1543634992
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
_See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
397
|
+
_See code: [src/commands/conni/content/delete.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/delete.ts)_
|
|
398
398
|
|
|
399
399
|
## `conni conni content get PAGEID`
|
|
400
400
|
|
|
@@ -418,7 +418,7 @@ EXAMPLES
|
|
|
418
418
|
$ conni conni content get 1544060948
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
_See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
421
|
+
_See code: [src/commands/conni/content/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/get.ts)_
|
|
422
422
|
|
|
423
423
|
## `conni conni content search CQL`
|
|
424
424
|
|
|
@@ -446,7 +446,7 @@ EXAMPLES
|
|
|
446
446
|
$ conni conni content search 'created > startOfMonth()' --limit=5 --expand=body,version
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
449
|
+
_See code: [src/commands/conni/content/search.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/search.ts)_
|
|
450
450
|
|
|
451
451
|
## `conni conni content update PAGEID`
|
|
452
452
|
|
|
@@ -454,14 +454,17 @@ Update an existing Confluence content
|
|
|
454
454
|
|
|
455
455
|
```
|
|
456
456
|
USAGE
|
|
457
|
-
$ conni conni content update PAGEID --fields <value>... [-p <value>]
|
|
457
|
+
$ conni conni content update PAGEID --fields <value>... [--full-width] [-p <value>] [--toon]
|
|
458
458
|
|
|
459
459
|
ARGUMENTS
|
|
460
460
|
PAGEID Page ID
|
|
461
461
|
|
|
462
462
|
FLAGS
|
|
463
463
|
-p, --profile=<value> Authentication profile name
|
|
464
|
-
--fields=<value>... (required) Content fields to update in key=value format
|
|
464
|
+
--fields=<value>... (required) Content fields to update in key=value format. Use @file to read value from a file
|
|
465
|
+
(e.g. body=@content.xml)
|
|
466
|
+
--full-width Set page appearance to full-width
|
|
467
|
+
--toon Format output as toon
|
|
465
468
|
|
|
466
469
|
DESCRIPTION
|
|
467
470
|
Update an existing Confluence content
|
|
@@ -479,9 +482,11 @@ EXAMPLES
|
|
|
479
482
|
```'
|
|
480
483
|
|
|
481
484
|
$ conni conni content update 1076199489 --fields body="$(cat content.md)"
|
|
485
|
+
|
|
486
|
+
$ conni conni content update 1076199489 --fields body=@storage.xml representation=storage --full-width
|
|
482
487
|
```
|
|
483
488
|
|
|
484
|
-
_See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
489
|
+
_See code: [src/commands/conni/content/update.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/content/update.ts)_
|
|
485
490
|
|
|
486
491
|
## `conni conni space get SPACEKEY`
|
|
487
492
|
|
|
@@ -505,7 +510,7 @@ EXAMPLES
|
|
|
505
510
|
$ conni conni space get DEV
|
|
506
511
|
```
|
|
507
512
|
|
|
508
|
-
_See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
513
|
+
_See code: [src/commands/conni/space/get.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/space/get.ts)_
|
|
509
514
|
|
|
510
515
|
## `conni conni space list`
|
|
511
516
|
|
|
@@ -526,5 +531,5 @@ EXAMPLES
|
|
|
526
531
|
$ conni conni space list
|
|
527
532
|
```
|
|
528
533
|
|
|
529
|
-
_See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.
|
|
534
|
+
_See code: [src/commands/conni/space/list.ts](https://github.com/hesedcasa/conni/blob/v0.6.1/src/commands/conni/space/list.ts)_
|
|
530
535
|
<!-- commandsstop -->
|
|
@@ -7,7 +7,9 @@ export default class ContentUpdate extends Command {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
fields: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'full-width': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
toon: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
13
|
};
|
|
12
14
|
run(): Promise<void>;
|
|
13
15
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
+
import fs from 'fs-extra';
|
|
2
3
|
import { readConfig } from '../../../config.js';
|
|
3
4
|
import { clearClients, updateContent } from '../../../conni/conni-client.js';
|
|
5
|
+
import { formatAsToon } from '../../../format.js';
|
|
4
6
|
export default class ContentUpdate extends Command {
|
|
5
7
|
static args = {
|
|
6
8
|
pageId: Args.string({ description: 'Page ID', required: true }),
|
|
@@ -10,10 +12,20 @@ export default class ContentUpdate extends Command {
|
|
|
10
12
|
"<%= config.bin %> <%= command.id %> 1076199489 --fields title='New summary' body='New description'",
|
|
11
13
|
"<%= config.bin %> <%= command.id %> 1076199489 --fields body='\n# Header\n## Sub-header\n- Item 1\n- Item 2\n```bash\nls -a\n```'",
|
|
12
14
|
'<%= config.bin %> <%= command.id %> 1076199489 --fields body="$(cat content.md)"',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> 1076199489 --fields body=@storage.xml representation=storage --full-width',
|
|
13
16
|
];
|
|
14
17
|
static flags = {
|
|
15
|
-
fields: Flags.string({
|
|
18
|
+
fields: Flags.string({
|
|
19
|
+
description: 'Content fields to update in key=value format. Use @file to read value from a file (e.g. body=@content.xml)',
|
|
20
|
+
multiple: true,
|
|
21
|
+
required: true,
|
|
22
|
+
}),
|
|
23
|
+
'full-width': Flags.boolean({
|
|
24
|
+
description: 'Set page appearance to full-width',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
16
27
|
profile: Flags.string({ char: 'p', description: 'Authentication profile name', required: false }),
|
|
28
|
+
toon: Flags.boolean({ description: 'Format output as toon', required: false }),
|
|
17
29
|
};
|
|
18
30
|
async run() {
|
|
19
31
|
const { args, flags } = await this.parse(ContentUpdate);
|
|
@@ -25,12 +37,24 @@ export default class ContentUpdate extends Command {
|
|
|
25
37
|
if (flags.fields) {
|
|
26
38
|
for (const field of flags.fields) {
|
|
27
39
|
const [key, ...valueParts] = field.split('=');
|
|
28
|
-
|
|
40
|
+
let value = valueParts.join('=');
|
|
41
|
+
if (value.startsWith('@')) {
|
|
42
|
+
const filePath = value.slice(1);
|
|
43
|
+
value = fs.readFileSync(filePath, 'utf8');
|
|
44
|
+
}
|
|
29
45
|
fields[key] = value;
|
|
30
46
|
}
|
|
31
47
|
}
|
|
48
|
+
if (flags['full-width']) {
|
|
49
|
+
fields.fullWidth = 'true';
|
|
50
|
+
}
|
|
32
51
|
const result = await updateContent(config.auth, args.pageId, fields);
|
|
33
52
|
clearClients();
|
|
34
|
-
|
|
53
|
+
if (flags.toon) {
|
|
54
|
+
this.log(formatAsToon(result));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.logJson(result);
|
|
58
|
+
}
|
|
35
59
|
}
|
|
36
60
|
}
|
package/dist/conni/conni-api.js
CHANGED
|
@@ -465,6 +465,8 @@ export class ConniApi {
|
|
|
465
465
|
const currentVersion = (page.version?.number ?? 0) + 1;
|
|
466
466
|
const title = fields.title ?? page.title ?? '';
|
|
467
467
|
const body = fields.body;
|
|
468
|
+
const representation = fields.representation ?? 'atlas_doc_format';
|
|
469
|
+
const isStorage = representation === 'storage';
|
|
468
470
|
const response = await client.content.updateContent({
|
|
469
471
|
id: pageId,
|
|
470
472
|
type: 'page',
|
|
@@ -473,9 +475,11 @@ export class ConniApi {
|
|
|
473
475
|
: {
|
|
474
476
|
body: {
|
|
475
477
|
storage: {
|
|
476
|
-
representation
|
|
477
|
-
|
|
478
|
-
|
|
478
|
+
representation,
|
|
479
|
+
value: isStorage
|
|
480
|
+
? body
|
|
481
|
+
: // eslint-disable-next-line unicorn/prefer-string-replace-all
|
|
482
|
+
JSON.stringify(markdownToAdf(body.replace(/\\n/g, '\n'))),
|
|
479
483
|
},
|
|
480
484
|
},
|
|
481
485
|
}),
|
|
@@ -484,6 +488,9 @@ export class ConniApi {
|
|
|
484
488
|
number: currentVersion,
|
|
485
489
|
},
|
|
486
490
|
});
|
|
491
|
+
if (fields.fullWidth) {
|
|
492
|
+
await this.setPageAppearance(pageId, 'full-width');
|
|
493
|
+
}
|
|
487
494
|
return {
|
|
488
495
|
data: response,
|
|
489
496
|
success: true,
|
package/oclif.manifest.json
CHANGED
|
@@ -856,17 +856,25 @@
|
|
|
856
856
|
"examples": [
|
|
857
857
|
"<%= config.bin %> <%= command.id %> 1076199489 --fields title='New summary' body='New description'",
|
|
858
858
|
"<%= config.bin %> <%= command.id %> 1076199489 --fields body='\n# Header\n## Sub-header\n- Item 1\n- Item 2\n```bash\nls -a\n```'",
|
|
859
|
-
"<%= config.bin %> <%= command.id %> 1076199489 --fields body=\"$(cat content.md)\""
|
|
859
|
+
"<%= config.bin %> <%= command.id %> 1076199489 --fields body=\"$(cat content.md)\"",
|
|
860
|
+
"<%= config.bin %> <%= command.id %> 1076199489 --fields body=@storage.xml representation=storage --full-width"
|
|
860
861
|
],
|
|
861
862
|
"flags": {
|
|
862
863
|
"fields": {
|
|
863
|
-
"description": "Content fields to update in key=value format",
|
|
864
|
+
"description": "Content fields to update in key=value format. Use @file to read value from a file (e.g. body=@content.xml)",
|
|
864
865
|
"name": "fields",
|
|
865
866
|
"required": true,
|
|
866
867
|
"hasDynamicHelp": false,
|
|
867
868
|
"multiple": true,
|
|
868
869
|
"type": "option"
|
|
869
870
|
},
|
|
871
|
+
"full-width": {
|
|
872
|
+
"description": "Set page appearance to full-width",
|
|
873
|
+
"name": "full-width",
|
|
874
|
+
"required": false,
|
|
875
|
+
"allowNo": false,
|
|
876
|
+
"type": "boolean"
|
|
877
|
+
},
|
|
870
878
|
"profile": {
|
|
871
879
|
"char": "p",
|
|
872
880
|
"description": "Authentication profile name",
|
|
@@ -875,6 +883,13 @@
|
|
|
875
883
|
"hasDynamicHelp": false,
|
|
876
884
|
"multiple": false,
|
|
877
885
|
"type": "option"
|
|
886
|
+
},
|
|
887
|
+
"toon": {
|
|
888
|
+
"description": "Format output as toon",
|
|
889
|
+
"name": "toon",
|
|
890
|
+
"required": false,
|
|
891
|
+
"allowNo": false,
|
|
892
|
+
"type": "boolean"
|
|
878
893
|
}
|
|
879
894
|
},
|
|
880
895
|
"hasDynamicHelp": false,
|
|
@@ -895,5 +910,5 @@
|
|
|
895
910
|
]
|
|
896
911
|
}
|
|
897
912
|
},
|
|
898
|
-
"version": "0.6.
|
|
913
|
+
"version": "0.6.1"
|
|
899
914
|
}
|