@nickchristensen/ppls 1.0.4 → 1.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 +47 -47
- package/dist/base-command.d.ts +0 -3
- package/dist/base-command.js +0 -26
- package/dist/commands/documents/list.d.ts +1 -0
- package/dist/commands/documents/list.js +7 -0
- package/dist/list-command.d.ts +6 -6
- package/dist/list-command.js +33 -12
- package/oclif.manifest.json +96 -76
- package/package.json +3 -4
- package/dist/paginated-command.d.ts +0 -49
- package/dist/paginated-command.js +0 -102
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ EXAMPLES
|
|
|
108
108
|
$ ppls config get hostname
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
_See code: [src/commands/config/get.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
111
|
+
_See code: [src/commands/config/get.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/config/get.ts)_
|
|
112
112
|
|
|
113
113
|
## `ppls config init`
|
|
114
114
|
|
|
@@ -131,7 +131,7 @@ EXAMPLES
|
|
|
131
131
|
$ ppls config init
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
_See code: [src/commands/config/init.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
134
|
+
_See code: [src/commands/config/init.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/config/init.ts)_
|
|
135
135
|
|
|
136
136
|
## `ppls config list`
|
|
137
137
|
|
|
@@ -155,7 +155,7 @@ EXAMPLES
|
|
|
155
155
|
$ ppls config list
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
_See code: [src/commands/config/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
158
|
+
_See code: [src/commands/config/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/config/list.ts)_
|
|
159
159
|
|
|
160
160
|
## `ppls config remove KEY`
|
|
161
161
|
|
|
@@ -178,7 +178,7 @@ EXAMPLES
|
|
|
178
178
|
$ ppls config remove token
|
|
179
179
|
```
|
|
180
180
|
|
|
181
|
-
_See code: [src/commands/config/remove.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
181
|
+
_See code: [src/commands/config/remove.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/config/remove.ts)_
|
|
182
182
|
|
|
183
183
|
## `ppls config set KEY VALUE`
|
|
184
184
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
$ ppls config set headers '{"X-Api-Key":"token"}'
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/config/set.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
207
|
+
_See code: [src/commands/config/set.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/config/set.ts)_
|
|
208
208
|
|
|
209
209
|
## `ppls correspondents add NAME`
|
|
210
210
|
|
|
@@ -236,7 +236,7 @@ EXAMPLES
|
|
|
236
236
|
$ ppls correspondents add "Acme Corp"
|
|
237
237
|
```
|
|
238
238
|
|
|
239
|
-
_See code: [src/commands/correspondents/add.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
239
|
+
_See code: [src/commands/correspondents/add.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/correspondents/add.ts)_
|
|
240
240
|
|
|
241
241
|
## `ppls correspondents delete ID`
|
|
242
242
|
|
|
@@ -271,7 +271,7 @@ EXAMPLES
|
|
|
271
271
|
$ ppls correspondents delete 123
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
-
_See code: [src/commands/correspondents/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
274
|
+
_See code: [src/commands/correspondents/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/correspondents/delete.ts)_
|
|
275
275
|
|
|
276
276
|
## `ppls correspondents list`
|
|
277
277
|
|
|
@@ -280,14 +280,14 @@ List correspondents
|
|
|
280
280
|
```
|
|
281
281
|
USAGE
|
|
282
282
|
$ ppls correspondents list [--date-format <value>] [--header <value>...] [--hostname <value>] [--plain | --json |
|
|
283
|
-
--table] [--token <value>] [--
|
|
284
|
-
|
|
283
|
+
--table] [--token <value>] [--id-in <value> | --name-contains <value>] [--page <value> --page-size <value>] [--sort
|
|
284
|
+
<value>]
|
|
285
285
|
|
|
286
286
|
FLAGS
|
|
287
287
|
--id-in=<value> Filter by id list (comma-separated)
|
|
288
288
|
--name-contains=<value> Filter by name substring
|
|
289
289
|
--page=<value> Page number to fetch
|
|
290
|
-
--page-size=<value> Number of results per page
|
|
290
|
+
--page-size=<value> [default: disable pagination, all results] Number of results per page
|
|
291
291
|
--sort=<value> Sort results by the provided field
|
|
292
292
|
|
|
293
293
|
GLOBAL FLAGS
|
|
@@ -308,7 +308,7 @@ EXAMPLES
|
|
|
308
308
|
$ ppls correspondents list
|
|
309
309
|
```
|
|
310
310
|
|
|
311
|
-
_See code: [src/commands/correspondents/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
311
|
+
_See code: [src/commands/correspondents/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/correspondents/list.ts)_
|
|
312
312
|
|
|
313
313
|
## `ppls correspondents show ID`
|
|
314
314
|
|
|
@@ -340,7 +340,7 @@ EXAMPLES
|
|
|
340
340
|
$ ppls correspondents show 123
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
_See code: [src/commands/correspondents/show.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
343
|
+
_See code: [src/commands/correspondents/show.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/correspondents/show.ts)_
|
|
344
344
|
|
|
345
345
|
## `ppls correspondents update ID`
|
|
346
346
|
|
|
@@ -375,7 +375,7 @@ EXAMPLES
|
|
|
375
375
|
$ ppls correspondents update 123 --name "Acme Corp"
|
|
376
376
|
```
|
|
377
377
|
|
|
378
|
-
_See code: [src/commands/correspondents/update.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
378
|
+
_See code: [src/commands/correspondents/update.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/correspondents/update.ts)_
|
|
379
379
|
|
|
380
380
|
## `ppls custom-fields add NAME`
|
|
381
381
|
|
|
@@ -413,7 +413,7 @@ EXAMPLES
|
|
|
413
413
|
$ ppls custom-fields add "Due Date" --data-type date
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/custom-fields/add.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
416
|
+
_See code: [src/commands/custom-fields/add.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/custom-fields/add.ts)_
|
|
417
417
|
|
|
418
418
|
## `ppls custom-fields delete ID`
|
|
419
419
|
|
|
@@ -448,7 +448,7 @@ EXAMPLES
|
|
|
448
448
|
$ ppls custom-fields delete 123
|
|
449
449
|
```
|
|
450
450
|
|
|
451
|
-
_See code: [src/commands/custom-fields/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
451
|
+
_See code: [src/commands/custom-fields/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/custom-fields/delete.ts)_
|
|
452
452
|
|
|
453
453
|
## `ppls custom-fields list`
|
|
454
454
|
|
|
@@ -457,14 +457,14 @@ List custom fields
|
|
|
457
457
|
```
|
|
458
458
|
USAGE
|
|
459
459
|
$ ppls custom-fields list [--date-format <value>] [--header <value>...] [--hostname <value>] [--plain | --json |
|
|
460
|
-
--table] [--token <value>] [--
|
|
461
|
-
|
|
460
|
+
--table] [--token <value>] [--id-in <value> | --name-contains <value>] [--page <value> --page-size <value>] [--sort
|
|
461
|
+
<value>]
|
|
462
462
|
|
|
463
463
|
FLAGS
|
|
464
464
|
--id-in=<value> Filter by id list (comma-separated)
|
|
465
465
|
--name-contains=<value> Filter by name substring
|
|
466
466
|
--page=<value> Page number to fetch
|
|
467
|
-
--page-size=<value> Number of results per page
|
|
467
|
+
--page-size=<value> [default: disable pagination, all results] Number of results per page
|
|
468
468
|
--sort=<value> Sort results by the provided field
|
|
469
469
|
|
|
470
470
|
GLOBAL FLAGS
|
|
@@ -485,7 +485,7 @@ EXAMPLES
|
|
|
485
485
|
$ ppls custom-fields list
|
|
486
486
|
```
|
|
487
487
|
|
|
488
|
-
_See code: [src/commands/custom-fields/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
488
|
+
_See code: [src/commands/custom-fields/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/custom-fields/list.ts)_
|
|
489
489
|
|
|
490
490
|
## `ppls custom-fields show ID`
|
|
491
491
|
|
|
@@ -517,7 +517,7 @@ EXAMPLES
|
|
|
517
517
|
$ ppls custom-fields show 123
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
_See code: [src/commands/custom-fields/show.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
520
|
+
_See code: [src/commands/custom-fields/show.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/custom-fields/show.ts)_
|
|
521
521
|
|
|
522
522
|
## `ppls custom-fields update ID`
|
|
523
523
|
|
|
@@ -556,7 +556,7 @@ EXAMPLES
|
|
|
556
556
|
$ ppls custom-fields update 123 --name "Due Date"
|
|
557
557
|
```
|
|
558
558
|
|
|
559
|
-
_See code: [src/commands/custom-fields/update.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
559
|
+
_See code: [src/commands/custom-fields/update.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/custom-fields/update.ts)_
|
|
560
560
|
|
|
561
561
|
## `ppls document-types add NAME`
|
|
562
562
|
|
|
@@ -588,7 +588,7 @@ EXAMPLES
|
|
|
588
588
|
$ ppls document-types add "Invoice"
|
|
589
589
|
```
|
|
590
590
|
|
|
591
|
-
_See code: [src/commands/document-types/add.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
591
|
+
_See code: [src/commands/document-types/add.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/document-types/add.ts)_
|
|
592
592
|
|
|
593
593
|
## `ppls document-types delete ID`
|
|
594
594
|
|
|
@@ -623,7 +623,7 @@ EXAMPLES
|
|
|
623
623
|
$ ppls document-types delete 123
|
|
624
624
|
```
|
|
625
625
|
|
|
626
|
-
_See code: [src/commands/document-types/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
626
|
+
_See code: [src/commands/document-types/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/document-types/delete.ts)_
|
|
627
627
|
|
|
628
628
|
## `ppls document-types list`
|
|
629
629
|
|
|
@@ -632,14 +632,14 @@ List document types
|
|
|
632
632
|
```
|
|
633
633
|
USAGE
|
|
634
634
|
$ ppls document-types list [--date-format <value>] [--header <value>...] [--hostname <value>] [--plain | --json |
|
|
635
|
-
--table] [--token <value>] [--
|
|
636
|
-
|
|
635
|
+
--table] [--token <value>] [--id-in <value> | --name-contains <value>] [--page <value> --page-size <value>] [--sort
|
|
636
|
+
<value>]
|
|
637
637
|
|
|
638
638
|
FLAGS
|
|
639
639
|
--id-in=<value> Filter by id list (comma-separated)
|
|
640
640
|
--name-contains=<value> Filter by name substring
|
|
641
641
|
--page=<value> Page number to fetch
|
|
642
|
-
--page-size=<value> Number of results per page
|
|
642
|
+
--page-size=<value> [default: disable pagination, all results] Number of results per page
|
|
643
643
|
--sort=<value> Sort results by the provided field
|
|
644
644
|
|
|
645
645
|
GLOBAL FLAGS
|
|
@@ -660,7 +660,7 @@ EXAMPLES
|
|
|
660
660
|
$ ppls document-types list
|
|
661
661
|
```
|
|
662
662
|
|
|
663
|
-
_See code: [src/commands/document-types/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
663
|
+
_See code: [src/commands/document-types/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/document-types/list.ts)_
|
|
664
664
|
|
|
665
665
|
## `ppls document-types show ID`
|
|
666
666
|
|
|
@@ -692,7 +692,7 @@ EXAMPLES
|
|
|
692
692
|
$ ppls document-types show 123
|
|
693
693
|
```
|
|
694
694
|
|
|
695
|
-
_See code: [src/commands/document-types/show.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
695
|
+
_See code: [src/commands/document-types/show.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/document-types/show.ts)_
|
|
696
696
|
|
|
697
697
|
## `ppls document-types update ID`
|
|
698
698
|
|
|
@@ -727,7 +727,7 @@ EXAMPLES
|
|
|
727
727
|
$ ppls document-types update 123 --name "Invoice"
|
|
728
728
|
```
|
|
729
729
|
|
|
730
|
-
_See code: [src/commands/document-types/update.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
730
|
+
_See code: [src/commands/document-types/update.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/document-types/update.ts)_
|
|
731
731
|
|
|
732
732
|
## `ppls documents add [PATH]`
|
|
733
733
|
|
|
@@ -769,7 +769,7 @@ EXAMPLES
|
|
|
769
769
|
$ ppls documents add ./receipt.pdf --title "Receipt"
|
|
770
770
|
```
|
|
771
771
|
|
|
772
|
-
_See code: [src/commands/documents/add.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
772
|
+
_See code: [src/commands/documents/add.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/add.ts)_
|
|
773
773
|
|
|
774
774
|
## `ppls documents delete ID`
|
|
775
775
|
|
|
@@ -804,7 +804,7 @@ EXAMPLES
|
|
|
804
804
|
$ ppls documents delete 123
|
|
805
805
|
```
|
|
806
806
|
|
|
807
|
-
_See code: [src/commands/documents/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
807
|
+
_See code: [src/commands/documents/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/delete.ts)_
|
|
808
808
|
|
|
809
809
|
## `ppls documents download ID`
|
|
810
810
|
|
|
@@ -843,7 +843,7 @@ EXAMPLES
|
|
|
843
843
|
$ ppls documents download 123,124 --output-dir ./downloads
|
|
844
844
|
```
|
|
845
845
|
|
|
846
|
-
_See code: [src/commands/documents/download.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
846
|
+
_See code: [src/commands/documents/download.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/download.ts)_
|
|
847
847
|
|
|
848
848
|
## `ppls documents list`
|
|
849
849
|
|
|
@@ -852,14 +852,14 @@ List documents
|
|
|
852
852
|
```
|
|
853
853
|
USAGE
|
|
854
854
|
$ ppls documents list [--date-format <value>] [--header <value>...] [--hostname <value>] [--plain | --json |
|
|
855
|
-
--table] [--token <value>] [--
|
|
856
|
-
|
|
855
|
+
--table] [--token <value>] [--id-in <value> | --name-contains <value>] [--page <value> --page-size <value>] [--sort
|
|
856
|
+
<value>]
|
|
857
857
|
|
|
858
858
|
FLAGS
|
|
859
859
|
--id-in=<value> Filter by id list (comma-separated)
|
|
860
860
|
--name-contains=<value> Filter by name substring
|
|
861
861
|
--page=<value> Page number to fetch
|
|
862
|
-
--page-size=<value> Number of results per page
|
|
862
|
+
--page-size=<value> [default: disable pagination, all results] Number of results per page
|
|
863
863
|
--sort=<value> Sort results by the provided field
|
|
864
864
|
|
|
865
865
|
GLOBAL FLAGS
|
|
@@ -880,7 +880,7 @@ EXAMPLES
|
|
|
880
880
|
$ ppls documents list
|
|
881
881
|
```
|
|
882
882
|
|
|
883
|
-
_See code: [src/commands/documents/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
883
|
+
_See code: [src/commands/documents/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/list.ts)_
|
|
884
884
|
|
|
885
885
|
## `ppls documents show ID`
|
|
886
886
|
|
|
@@ -912,7 +912,7 @@ EXAMPLES
|
|
|
912
912
|
$ ppls documents show 123
|
|
913
913
|
```
|
|
914
914
|
|
|
915
|
-
_See code: [src/commands/documents/show.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
915
|
+
_See code: [src/commands/documents/show.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/show.ts)_
|
|
916
916
|
|
|
917
917
|
## `ppls documents update ID`
|
|
918
918
|
|
|
@@ -955,7 +955,7 @@ EXAMPLES
|
|
|
955
955
|
$ ppls documents update 123 --title "Receipt"
|
|
956
956
|
```
|
|
957
957
|
|
|
958
|
-
_See code: [src/commands/documents/update.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
958
|
+
_See code: [src/commands/documents/update.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/documents/update.ts)_
|
|
959
959
|
|
|
960
960
|
## `ppls help [COMMAND]`
|
|
961
961
|
|
|
@@ -1007,7 +1007,7 @@ EXAMPLES
|
|
|
1007
1007
|
$ ppls profile
|
|
1008
1008
|
```
|
|
1009
1009
|
|
|
1010
|
-
_See code: [src/commands/profile.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1010
|
+
_See code: [src/commands/profile.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/profile.ts)_
|
|
1011
1011
|
|
|
1012
1012
|
## `ppls tags add NAME`
|
|
1013
1013
|
|
|
@@ -1044,7 +1044,7 @@ EXAMPLES
|
|
|
1044
1044
|
$ ppls tags add Inbox
|
|
1045
1045
|
```
|
|
1046
1046
|
|
|
1047
|
-
_See code: [src/commands/tags/add.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1047
|
+
_See code: [src/commands/tags/add.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/tags/add.ts)_
|
|
1048
1048
|
|
|
1049
1049
|
## `ppls tags delete ID`
|
|
1050
1050
|
|
|
@@ -1079,7 +1079,7 @@ EXAMPLES
|
|
|
1079
1079
|
$ ppls tags delete 123
|
|
1080
1080
|
```
|
|
1081
1081
|
|
|
1082
|
-
_See code: [src/commands/tags/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1082
|
+
_See code: [src/commands/tags/delete.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/tags/delete.ts)_
|
|
1083
1083
|
|
|
1084
1084
|
## `ppls tags list`
|
|
1085
1085
|
|
|
@@ -1088,14 +1088,14 @@ List tags
|
|
|
1088
1088
|
```
|
|
1089
1089
|
USAGE
|
|
1090
1090
|
$ ppls tags list [--date-format <value>] [--header <value>...] [--hostname <value>] [--plain | --json |
|
|
1091
|
-
--table] [--token <value>] [--
|
|
1092
|
-
|
|
1091
|
+
--table] [--token <value>] [--id-in <value> | --name-contains <value>] [--page <value> --page-size <value>] [--sort
|
|
1092
|
+
<value>]
|
|
1093
1093
|
|
|
1094
1094
|
FLAGS
|
|
1095
1095
|
--id-in=<value> Filter by id list (comma-separated)
|
|
1096
1096
|
--name-contains=<value> Filter by name substring
|
|
1097
1097
|
--page=<value> Page number to fetch
|
|
1098
|
-
--page-size=<value> Number of results per page
|
|
1098
|
+
--page-size=<value> [default: disable pagination, all results] Number of results per page
|
|
1099
1099
|
--sort=<value> Sort results by the provided field
|
|
1100
1100
|
|
|
1101
1101
|
GLOBAL FLAGS
|
|
@@ -1116,7 +1116,7 @@ EXAMPLES
|
|
|
1116
1116
|
$ ppls tags list
|
|
1117
1117
|
```
|
|
1118
1118
|
|
|
1119
|
-
_See code: [src/commands/tags/list.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1119
|
+
_See code: [src/commands/tags/list.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/tags/list.ts)_
|
|
1120
1120
|
|
|
1121
1121
|
## `ppls tags show ID`
|
|
1122
1122
|
|
|
@@ -1148,7 +1148,7 @@ EXAMPLES
|
|
|
1148
1148
|
$ ppls tags show 123
|
|
1149
1149
|
```
|
|
1150
1150
|
|
|
1151
|
-
_See code: [src/commands/tags/show.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1151
|
+
_See code: [src/commands/tags/show.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/tags/show.ts)_
|
|
1152
1152
|
|
|
1153
1153
|
## `ppls tags update ID`
|
|
1154
1154
|
|
|
@@ -1186,5 +1186,5 @@ EXAMPLES
|
|
|
1186
1186
|
$ ppls tags update 123 --name Inbox
|
|
1187
1187
|
```
|
|
1188
1188
|
|
|
1189
|
-
_See code: [src/commands/tags/update.ts](https://github.com/nickchristensen/ppls/blob/v1.0
|
|
1189
|
+
_See code: [src/commands/tags/update.ts](https://github.com/nickchristensen/ppls/blob/v1.1.0/src/commands/tags/update.ts)_
|
|
1190
1190
|
<!-- commandsstop -->
|
package/dist/base-command.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export declare abstract class BaseCommand extends Command {
|
|
|
40
40
|
protected fetchJson<T>(url: URL, tokenValue: string, headers?: Record<string, string>): Promise<T>;
|
|
41
41
|
protected formatErrorMessage(response: Response): Promise<string>;
|
|
42
42
|
protected loadUserConfig(): Promise<UserConfig>;
|
|
43
|
-
protected logRequestHeaders(label: string, headers: Record<string, string>): void;
|
|
44
43
|
protected logTable(headers: TableColumn[], rows: TableRow[], options?: TableOptions): void;
|
|
45
44
|
protected parseHeaderEntries(entries: string[], source: string): Record<string, string>;
|
|
46
45
|
protected parseHeadersConfig(input: unknown, source: string): Record<string, string>;
|
|
@@ -48,7 +47,6 @@ export declare abstract class BaseCommand extends Command {
|
|
|
48
47
|
protected patchApiJson<T>(flags: ApiFlags, path: string, body: unknown): Promise<T>;
|
|
49
48
|
protected postApiFormData<T>(flags: ApiFlags, path: string, body: FormData): Promise<T>;
|
|
50
49
|
protected postApiJson<T>(flags: ApiFlags, path: string, body: unknown): Promise<T>;
|
|
51
|
-
protected redactHeaderValue(key: string, value: string): string;
|
|
52
50
|
protected requestJson<T>(options: {
|
|
53
51
|
body?: unknown;
|
|
54
52
|
headers: Record<string, string>;
|
|
@@ -59,7 +57,6 @@ export declare abstract class BaseCommand extends Command {
|
|
|
59
57
|
protected resolveDateFormat(flags: Record<string, unknown>, metadata: CommandMetadata | undefined, userConfig: UserConfig): string;
|
|
60
58
|
protected resolveGlobalFlags(flags: Record<string, unknown>, metadata?: CommandMetadata): Promise<ResolvedGlobalFlags>;
|
|
61
59
|
protected resolveHeaders(flags: Record<string, unknown>, userConfig: UserConfig): Record<string, string>;
|
|
62
|
-
protected shouldLogHeaders(): boolean;
|
|
63
60
|
protected shouldShowSpinner(): boolean;
|
|
64
61
|
protected startSpinner(text: string): null | ReturnType<typeof yoctoSpinner>;
|
|
65
62
|
}
|
package/dist/base-command.js
CHANGED
|
@@ -64,7 +64,6 @@ export class BaseCommand extends Command {
|
|
|
64
64
|
Authorization: `Token ${flags.token}`,
|
|
65
65
|
...flags.headers,
|
|
66
66
|
};
|
|
67
|
-
this.logRequestHeaders(`DELETE ${url.toString()}`, requestHeaders);
|
|
68
67
|
const response = await fetch(url, {
|
|
69
68
|
headers: requestHeaders,
|
|
70
69
|
method: 'DELETE',
|
|
@@ -89,7 +88,6 @@ export class BaseCommand extends Command {
|
|
|
89
88
|
Authorization: `Token ${flags.token}`,
|
|
90
89
|
...flags.headers,
|
|
91
90
|
};
|
|
92
|
-
this.logRequestHeaders(`GET ${url.toString()}`, requestHeaders);
|
|
93
91
|
const response = await fetch(url, {
|
|
94
92
|
headers: requestHeaders,
|
|
95
93
|
});
|
|
@@ -146,13 +144,6 @@ export class BaseCommand extends Command {
|
|
|
146
144
|
})();
|
|
147
145
|
return this.userConfigPromise;
|
|
148
146
|
}
|
|
149
|
-
logRequestHeaders(label, headers) {
|
|
150
|
-
if (!this.shouldLogHeaders()) {
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
const maskedHeaders = Object.fromEntries(Object.entries(headers).map(([key, value]) => [key, this.redactHeaderValue(key, value)]));
|
|
154
|
-
this.logToStderr(`${label} headers: ${JSON.stringify(maskedHeaders)}`);
|
|
155
|
-
}
|
|
156
147
|
logTable(headers, rows, options) {
|
|
157
148
|
this.log(renderTable(headers, rows, options));
|
|
158
149
|
}
|
|
@@ -230,7 +221,6 @@ export class BaseCommand extends Command {
|
|
|
230
221
|
Authorization: `Token ${flags.token}`,
|
|
231
222
|
...flags.headers,
|
|
232
223
|
};
|
|
233
|
-
this.logRequestHeaders(`POST ${url.toString()}`, requestHeaders);
|
|
234
224
|
const response = await fetch(url, {
|
|
235
225
|
body,
|
|
236
226
|
headers: requestHeaders,
|
|
@@ -255,17 +245,6 @@ export class BaseCommand extends Command {
|
|
|
255
245
|
url,
|
|
256
246
|
});
|
|
257
247
|
}
|
|
258
|
-
redactHeaderValue(key, value) {
|
|
259
|
-
const normalized = key.toLowerCase();
|
|
260
|
-
if (normalized === 'authorization') {
|
|
261
|
-
const [scheme] = value.split(' ');
|
|
262
|
-
return scheme ? `${scheme} [REDACTED]` : '[REDACTED]';
|
|
263
|
-
}
|
|
264
|
-
if (normalized.includes('token') || normalized.includes('secret') || normalized.includes('api-key')) {
|
|
265
|
-
return '[REDACTED]';
|
|
266
|
-
}
|
|
267
|
-
return value;
|
|
268
|
-
}
|
|
269
248
|
async requestJson(options) {
|
|
270
249
|
const { body, headers, method, token, url } = options;
|
|
271
250
|
const requestHeaders = {
|
|
@@ -274,7 +253,6 @@ export class BaseCommand extends Command {
|
|
|
274
253
|
...(body === undefined ? {} : { 'Content-Type': 'application/json' }),
|
|
275
254
|
...headers,
|
|
276
255
|
};
|
|
277
|
-
this.logRequestHeaders(`${method} ${url.toString()}`, requestHeaders);
|
|
278
256
|
const response = await fetch(url, {
|
|
279
257
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
280
258
|
headers: requestHeaders,
|
|
@@ -319,10 +297,6 @@ export class BaseCommand extends Command {
|
|
|
319
297
|
...flagHeaders,
|
|
320
298
|
};
|
|
321
299
|
}
|
|
322
|
-
shouldLogHeaders() {
|
|
323
|
-
const value = process.env.PPLS_DEBUG_HEADERS?.toLowerCase();
|
|
324
|
-
return value === '1' || value === 'true' || value === 'yes';
|
|
325
|
-
}
|
|
326
300
|
shouldShowSpinner() {
|
|
327
301
|
return Boolean(process.stderr.isTTY);
|
|
328
302
|
}
|
|
@@ -5,5 +5,6 @@ export default class DocumentsList extends ListCommand<Document> {
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
protected listPath: string;
|
|
7
7
|
protected tableAttrs: string[];
|
|
8
|
+
protected listParams(flags: Parameters<ListCommand['listParams']>[0]): Record<string, number | string | undefined>;
|
|
8
9
|
protected plainTemplate(document: Document): string | undefined;
|
|
9
10
|
}
|
|
@@ -4,6 +4,13 @@ export default class DocumentsList extends ListCommand {
|
|
|
4
4
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
5
5
|
listPath = '/api/documents/';
|
|
6
6
|
tableAttrs = ['id', 'title', 'created', 'added', 'correspondent', 'document_type', 'tags'];
|
|
7
|
+
listParams(flags) {
|
|
8
|
+
const params = super.listParams(flags);
|
|
9
|
+
delete params.name__icontains;
|
|
10
|
+
// eslint-disable-next-line camelcase -- API uses double-underscore field names.
|
|
11
|
+
params.title__icontains = flags['name-contains'];
|
|
12
|
+
return params;
|
|
13
|
+
}
|
|
7
14
|
plainTemplate(document) {
|
|
8
15
|
const title = document.title?.trim();
|
|
9
16
|
if (!title) {
|
package/dist/list-command.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ApiFlags } from './base-command.js';
|
|
2
|
+
import { BaseCommand } from './base-command.js';
|
|
2
3
|
import { type TableColumn, type TableRow } from './helpers/table.js';
|
|
3
|
-
import { PaginatedCommand } from './paginated-command.js';
|
|
4
4
|
type ListCommandFlags = ApiFlags & {
|
|
5
5
|
'id-in'?: string;
|
|
6
6
|
'name-contains'?: string;
|
|
7
7
|
page?: number;
|
|
8
|
-
'page-size'
|
|
8
|
+
'page-size': number;
|
|
9
9
|
sort?: string;
|
|
10
10
|
};
|
|
11
11
|
type ListOutputFlags = ListCommandFlags & {
|
|
@@ -14,13 +14,13 @@ type ListOutputFlags = ListCommandFlags & {
|
|
|
14
14
|
table?: boolean;
|
|
15
15
|
};
|
|
16
16
|
type TableColumnInput = string | TableColumn;
|
|
17
|
-
export declare abstract class ListCommand<TRaw extends TableRow = TableRow, TOutput extends TableRow = TRaw> extends
|
|
17
|
+
export declare abstract class ListCommand<TRaw extends TableRow = TableRow, TOutput extends TableRow = TRaw> extends BaseCommand {
|
|
18
18
|
static baseFlags: {
|
|
19
19
|
'id-in': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
20
|
'name-contains': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
-
sort: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
21
|
page: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
-
'page-size': import("@oclif/core/interfaces").OptionFlag<number
|
|
22
|
+
'page-size': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
|
+
sort: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
24
|
'date-format': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
25
|
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
26
|
hostname: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -42,8 +42,8 @@ export declare abstract class ListCommand<TRaw extends TableRow = TableRow, TOut
|
|
|
42
42
|
results: TOutput[];
|
|
43
43
|
}): void;
|
|
44
44
|
run(): Promise<TOutput[]>;
|
|
45
|
-
protected shouldAutoPaginate(flags: ListCommandFlags): boolean;
|
|
46
45
|
protected transformResult(result: TRaw): TOutput;
|
|
47
46
|
protected transformResults(results: TRaw[]): TOutput[];
|
|
47
|
+
private buildListUrl;
|
|
48
48
|
}
|
|
49
49
|
export {};
|
package/dist/list-command.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
+
import { BaseCommand } from './base-command.js';
|
|
2
3
|
import { createValueFormatter } from './helpers/table.js';
|
|
3
|
-
|
|
4
|
-
export class ListCommand extends PaginatedCommand {
|
|
4
|
+
export class ListCommand extends BaseCommand {
|
|
5
5
|
static baseFlags = {
|
|
6
|
-
...
|
|
6
|
+
...BaseCommand.baseFlags,
|
|
7
7
|
'id-in': Flags.string({
|
|
8
8
|
description: 'Filter by id list (comma-separated)',
|
|
9
9
|
exclusive: ['name-contains'],
|
|
@@ -12,11 +12,22 @@ export class ListCommand extends PaginatedCommand {
|
|
|
12
12
|
description: 'Filter by name substring',
|
|
13
13
|
exclusive: ['id-in'],
|
|
14
14
|
}),
|
|
15
|
+
page: Flags.integer({
|
|
16
|
+
dependsOn: ['page-size'],
|
|
17
|
+
description: 'Page number to fetch',
|
|
18
|
+
min: 1,
|
|
19
|
+
}),
|
|
20
|
+
'page-size': Flags.integer({
|
|
21
|
+
default: async ({ flags }) => (flags.page === undefined ? Number.MAX_SAFE_INTEGER : undefined),
|
|
22
|
+
defaultHelp: async () => 'disable pagination, all results',
|
|
23
|
+
description: 'Number of results per page',
|
|
24
|
+
min: 1,
|
|
25
|
+
}),
|
|
15
26
|
sort: Flags.string({ description: 'Sort results by the provided field' }),
|
|
16
27
|
};
|
|
17
28
|
async fetchListResults(options) {
|
|
18
29
|
const { flags, params = {}, path } = options;
|
|
19
|
-
const url = this.
|
|
30
|
+
const url = this.buildListUrl({
|
|
20
31
|
flags,
|
|
21
32
|
params: {
|
|
22
33
|
ordering: flags.sort,
|
|
@@ -24,11 +35,14 @@ export class ListCommand extends PaginatedCommand {
|
|
|
24
35
|
},
|
|
25
36
|
path,
|
|
26
37
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
flags,
|
|
30
|
-
|
|
31
|
-
}
|
|
38
|
+
const spinner = this.startSpinner(`Fetching ${url.pathname}`);
|
|
39
|
+
try {
|
|
40
|
+
const payload = await this.fetchJson(url, flags.token, flags.headers);
|
|
41
|
+
return payload.results ?? [];
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
spinner?.stop();
|
|
45
|
+
}
|
|
32
46
|
}
|
|
33
47
|
listParams(flags) {
|
|
34
48
|
return {
|
|
@@ -86,13 +100,20 @@ export class ListCommand extends PaginatedCommand {
|
|
|
86
100
|
});
|
|
87
101
|
return results;
|
|
88
102
|
}
|
|
89
|
-
shouldAutoPaginate(flags) {
|
|
90
|
-
return flags.page === undefined && flags['page-size'] === undefined;
|
|
91
|
-
}
|
|
92
103
|
transformResult(result) {
|
|
93
104
|
return result;
|
|
94
105
|
}
|
|
95
106
|
transformResults(results) {
|
|
96
107
|
return results.map((result) => this.transformResult(result));
|
|
97
108
|
}
|
|
109
|
+
buildListUrl(options) {
|
|
110
|
+
const { flags, params = {}, path } = options;
|
|
111
|
+
const { page } = flags;
|
|
112
|
+
const pageSize = flags['page-size'];
|
|
113
|
+
return this.buildApiUrl(flags.hostname, path, {
|
|
114
|
+
...params,
|
|
115
|
+
page,
|
|
116
|
+
'page_size': pageSize,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
98
119
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -575,20 +575,6 @@
|
|
|
575
575
|
"multiple": false,
|
|
576
576
|
"type": "option"
|
|
577
577
|
},
|
|
578
|
-
"page": {
|
|
579
|
-
"description": "Page number to fetch",
|
|
580
|
-
"name": "page",
|
|
581
|
-
"hasDynamicHelp": false,
|
|
582
|
-
"multiple": false,
|
|
583
|
-
"type": "option"
|
|
584
|
-
},
|
|
585
|
-
"page-size": {
|
|
586
|
-
"description": "Number of results per page",
|
|
587
|
-
"name": "page-size",
|
|
588
|
-
"hasDynamicHelp": false,
|
|
589
|
-
"multiple": false,
|
|
590
|
-
"type": "option"
|
|
591
|
-
},
|
|
592
578
|
"id-in": {
|
|
593
579
|
"description": "Filter by id list (comma-separated)",
|
|
594
580
|
"exclusive": [
|
|
@@ -609,6 +595,24 @@
|
|
|
609
595
|
"multiple": false,
|
|
610
596
|
"type": "option"
|
|
611
597
|
},
|
|
598
|
+
"page": {
|
|
599
|
+
"dependsOn": [
|
|
600
|
+
"page-size"
|
|
601
|
+
],
|
|
602
|
+
"description": "Page number to fetch",
|
|
603
|
+
"name": "page",
|
|
604
|
+
"hasDynamicHelp": false,
|
|
605
|
+
"multiple": false,
|
|
606
|
+
"type": "option"
|
|
607
|
+
},
|
|
608
|
+
"page-size": {
|
|
609
|
+
"description": "Number of results per page",
|
|
610
|
+
"name": "page-size",
|
|
611
|
+
"default": "disable pagination, all results",
|
|
612
|
+
"hasDynamicHelp": true,
|
|
613
|
+
"multiple": false,
|
|
614
|
+
"type": "option"
|
|
615
|
+
},
|
|
612
616
|
"sort": {
|
|
613
617
|
"description": "Sort results by the provided field",
|
|
614
618
|
"name": "sort",
|
|
@@ -617,7 +621,7 @@
|
|
|
617
621
|
"type": "option"
|
|
618
622
|
}
|
|
619
623
|
},
|
|
620
|
-
"hasDynamicHelp":
|
|
624
|
+
"hasDynamicHelp": true,
|
|
621
625
|
"hiddenAliases": [],
|
|
622
626
|
"id": "correspondents:list",
|
|
623
627
|
"pluginAlias": "@nickchristensen/ppls",
|
|
@@ -1152,20 +1156,6 @@
|
|
|
1152
1156
|
"multiple": false,
|
|
1153
1157
|
"type": "option"
|
|
1154
1158
|
},
|
|
1155
|
-
"page": {
|
|
1156
|
-
"description": "Page number to fetch",
|
|
1157
|
-
"name": "page",
|
|
1158
|
-
"hasDynamicHelp": false,
|
|
1159
|
-
"multiple": false,
|
|
1160
|
-
"type": "option"
|
|
1161
|
-
},
|
|
1162
|
-
"page-size": {
|
|
1163
|
-
"description": "Number of results per page",
|
|
1164
|
-
"name": "page-size",
|
|
1165
|
-
"hasDynamicHelp": false,
|
|
1166
|
-
"multiple": false,
|
|
1167
|
-
"type": "option"
|
|
1168
|
-
},
|
|
1169
1159
|
"id-in": {
|
|
1170
1160
|
"description": "Filter by id list (comma-separated)",
|
|
1171
1161
|
"exclusive": [
|
|
@@ -1186,6 +1176,24 @@
|
|
|
1186
1176
|
"multiple": false,
|
|
1187
1177
|
"type": "option"
|
|
1188
1178
|
},
|
|
1179
|
+
"page": {
|
|
1180
|
+
"dependsOn": [
|
|
1181
|
+
"page-size"
|
|
1182
|
+
],
|
|
1183
|
+
"description": "Page number to fetch",
|
|
1184
|
+
"name": "page",
|
|
1185
|
+
"hasDynamicHelp": false,
|
|
1186
|
+
"multiple": false,
|
|
1187
|
+
"type": "option"
|
|
1188
|
+
},
|
|
1189
|
+
"page-size": {
|
|
1190
|
+
"description": "Number of results per page",
|
|
1191
|
+
"name": "page-size",
|
|
1192
|
+
"default": "disable pagination, all results",
|
|
1193
|
+
"hasDynamicHelp": true,
|
|
1194
|
+
"multiple": false,
|
|
1195
|
+
"type": "option"
|
|
1196
|
+
},
|
|
1189
1197
|
"sort": {
|
|
1190
1198
|
"description": "Sort results by the provided field",
|
|
1191
1199
|
"name": "sort",
|
|
@@ -1194,7 +1202,7 @@
|
|
|
1194
1202
|
"type": "option"
|
|
1195
1203
|
}
|
|
1196
1204
|
},
|
|
1197
|
-
"hasDynamicHelp":
|
|
1205
|
+
"hasDynamicHelp": true,
|
|
1198
1206
|
"hiddenAliases": [],
|
|
1199
1207
|
"id": "custom-fields:list",
|
|
1200
1208
|
"pluginAlias": "@nickchristensen/ppls",
|
|
@@ -1728,20 +1736,6 @@
|
|
|
1728
1736
|
"multiple": false,
|
|
1729
1737
|
"type": "option"
|
|
1730
1738
|
},
|
|
1731
|
-
"page": {
|
|
1732
|
-
"description": "Page number to fetch",
|
|
1733
|
-
"name": "page",
|
|
1734
|
-
"hasDynamicHelp": false,
|
|
1735
|
-
"multiple": false,
|
|
1736
|
-
"type": "option"
|
|
1737
|
-
},
|
|
1738
|
-
"page-size": {
|
|
1739
|
-
"description": "Number of results per page",
|
|
1740
|
-
"name": "page-size",
|
|
1741
|
-
"hasDynamicHelp": false,
|
|
1742
|
-
"multiple": false,
|
|
1743
|
-
"type": "option"
|
|
1744
|
-
},
|
|
1745
1739
|
"id-in": {
|
|
1746
1740
|
"description": "Filter by id list (comma-separated)",
|
|
1747
1741
|
"exclusive": [
|
|
@@ -1762,6 +1756,24 @@
|
|
|
1762
1756
|
"multiple": false,
|
|
1763
1757
|
"type": "option"
|
|
1764
1758
|
},
|
|
1759
|
+
"page": {
|
|
1760
|
+
"dependsOn": [
|
|
1761
|
+
"page-size"
|
|
1762
|
+
],
|
|
1763
|
+
"description": "Page number to fetch",
|
|
1764
|
+
"name": "page",
|
|
1765
|
+
"hasDynamicHelp": false,
|
|
1766
|
+
"multiple": false,
|
|
1767
|
+
"type": "option"
|
|
1768
|
+
},
|
|
1769
|
+
"page-size": {
|
|
1770
|
+
"description": "Number of results per page",
|
|
1771
|
+
"name": "page-size",
|
|
1772
|
+
"default": "disable pagination, all results",
|
|
1773
|
+
"hasDynamicHelp": true,
|
|
1774
|
+
"multiple": false,
|
|
1775
|
+
"type": "option"
|
|
1776
|
+
},
|
|
1765
1777
|
"sort": {
|
|
1766
1778
|
"description": "Sort results by the provided field",
|
|
1767
1779
|
"name": "sort",
|
|
@@ -1770,7 +1782,7 @@
|
|
|
1770
1782
|
"type": "option"
|
|
1771
1783
|
}
|
|
1772
1784
|
},
|
|
1773
|
-
"hasDynamicHelp":
|
|
1785
|
+
"hasDynamicHelp": true,
|
|
1774
1786
|
"hiddenAliases": [],
|
|
1775
1787
|
"id": "document-types:list",
|
|
1776
1788
|
"pluginAlias": "@nickchristensen/ppls",
|
|
@@ -2432,20 +2444,6 @@
|
|
|
2432
2444
|
"multiple": false,
|
|
2433
2445
|
"type": "option"
|
|
2434
2446
|
},
|
|
2435
|
-
"page": {
|
|
2436
|
-
"description": "Page number to fetch",
|
|
2437
|
-
"name": "page",
|
|
2438
|
-
"hasDynamicHelp": false,
|
|
2439
|
-
"multiple": false,
|
|
2440
|
-
"type": "option"
|
|
2441
|
-
},
|
|
2442
|
-
"page-size": {
|
|
2443
|
-
"description": "Number of results per page",
|
|
2444
|
-
"name": "page-size",
|
|
2445
|
-
"hasDynamicHelp": false,
|
|
2446
|
-
"multiple": false,
|
|
2447
|
-
"type": "option"
|
|
2448
|
-
},
|
|
2449
2447
|
"id-in": {
|
|
2450
2448
|
"description": "Filter by id list (comma-separated)",
|
|
2451
2449
|
"exclusive": [
|
|
@@ -2466,6 +2464,24 @@
|
|
|
2466
2464
|
"multiple": false,
|
|
2467
2465
|
"type": "option"
|
|
2468
2466
|
},
|
|
2467
|
+
"page": {
|
|
2468
|
+
"dependsOn": [
|
|
2469
|
+
"page-size"
|
|
2470
|
+
],
|
|
2471
|
+
"description": "Page number to fetch",
|
|
2472
|
+
"name": "page",
|
|
2473
|
+
"hasDynamicHelp": false,
|
|
2474
|
+
"multiple": false,
|
|
2475
|
+
"type": "option"
|
|
2476
|
+
},
|
|
2477
|
+
"page-size": {
|
|
2478
|
+
"description": "Number of results per page",
|
|
2479
|
+
"name": "page-size",
|
|
2480
|
+
"default": "disable pagination, all results",
|
|
2481
|
+
"hasDynamicHelp": true,
|
|
2482
|
+
"multiple": false,
|
|
2483
|
+
"type": "option"
|
|
2484
|
+
},
|
|
2469
2485
|
"sort": {
|
|
2470
2486
|
"description": "Sort results by the provided field",
|
|
2471
2487
|
"name": "sort",
|
|
@@ -2474,7 +2490,7 @@
|
|
|
2474
2490
|
"type": "option"
|
|
2475
2491
|
}
|
|
2476
2492
|
},
|
|
2477
|
-
"hasDynamicHelp":
|
|
2493
|
+
"hasDynamicHelp": true,
|
|
2478
2494
|
"hiddenAliases": [],
|
|
2479
2495
|
"id": "documents:list",
|
|
2480
2496
|
"pluginAlias": "@nickchristensen/ppls",
|
|
@@ -3031,20 +3047,6 @@
|
|
|
3031
3047
|
"multiple": false,
|
|
3032
3048
|
"type": "option"
|
|
3033
3049
|
},
|
|
3034
|
-
"page": {
|
|
3035
|
-
"description": "Page number to fetch",
|
|
3036
|
-
"name": "page",
|
|
3037
|
-
"hasDynamicHelp": false,
|
|
3038
|
-
"multiple": false,
|
|
3039
|
-
"type": "option"
|
|
3040
|
-
},
|
|
3041
|
-
"page-size": {
|
|
3042
|
-
"description": "Number of results per page",
|
|
3043
|
-
"name": "page-size",
|
|
3044
|
-
"hasDynamicHelp": false,
|
|
3045
|
-
"multiple": false,
|
|
3046
|
-
"type": "option"
|
|
3047
|
-
},
|
|
3048
3050
|
"id-in": {
|
|
3049
3051
|
"description": "Filter by id list (comma-separated)",
|
|
3050
3052
|
"exclusive": [
|
|
@@ -3065,6 +3067,24 @@
|
|
|
3065
3067
|
"multiple": false,
|
|
3066
3068
|
"type": "option"
|
|
3067
3069
|
},
|
|
3070
|
+
"page": {
|
|
3071
|
+
"dependsOn": [
|
|
3072
|
+
"page-size"
|
|
3073
|
+
],
|
|
3074
|
+
"description": "Page number to fetch",
|
|
3075
|
+
"name": "page",
|
|
3076
|
+
"hasDynamicHelp": false,
|
|
3077
|
+
"multiple": false,
|
|
3078
|
+
"type": "option"
|
|
3079
|
+
},
|
|
3080
|
+
"page-size": {
|
|
3081
|
+
"description": "Number of results per page",
|
|
3082
|
+
"name": "page-size",
|
|
3083
|
+
"default": "disable pagination, all results",
|
|
3084
|
+
"hasDynamicHelp": true,
|
|
3085
|
+
"multiple": false,
|
|
3086
|
+
"type": "option"
|
|
3087
|
+
},
|
|
3068
3088
|
"sort": {
|
|
3069
3089
|
"description": "Sort results by the provided field",
|
|
3070
3090
|
"name": "sort",
|
|
@@ -3073,7 +3093,7 @@
|
|
|
3073
3093
|
"type": "option"
|
|
3074
3094
|
}
|
|
3075
3095
|
},
|
|
3076
|
-
"hasDynamicHelp":
|
|
3096
|
+
"hasDynamicHelp": true,
|
|
3077
3097
|
"hiddenAliases": [],
|
|
3078
3098
|
"id": "tags:list",
|
|
3079
3099
|
"pluginAlias": "@nickchristensen/ppls",
|
|
@@ -3309,5 +3329,5 @@
|
|
|
3309
3329
|
]
|
|
3310
3330
|
}
|
|
3311
3331
|
},
|
|
3312
|
-
"version": "1.0
|
|
3332
|
+
"version": "1.1.0"
|
|
3313
3333
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nickchristensen/ppls",
|
|
3
3
|
"description": "A node-based paperless-ngx cli",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Nick Christensen",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ppls": "bin/run.js"
|
|
@@ -80,11 +80,10 @@
|
|
|
80
80
|
"lint": "eslint",
|
|
81
81
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
82
82
|
"posttest": "npm run lint",
|
|
83
|
-
"prepack": "
|
|
83
|
+
"prepack": "npm run build",
|
|
84
84
|
"postbuild": "oclif manifest && oclif readme --no-aliases",
|
|
85
85
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
86
|
-
"version": "oclif readme --no-aliases && git add README.md"
|
|
87
|
-
"publish": "npm publish --access public"
|
|
86
|
+
"version": "oclif readme --no-aliases && git add README.md"
|
|
88
87
|
},
|
|
89
88
|
"types": "dist/index.d.ts"
|
|
90
89
|
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { ApiFlags } from './base-command.js';
|
|
2
|
-
import { BaseCommand } from './base-command.js';
|
|
3
|
-
type PaginatedFlags = ApiFlags & {
|
|
4
|
-
page?: number;
|
|
5
|
-
'page-size'?: number;
|
|
6
|
-
};
|
|
7
|
-
export declare abstract class PaginatedCommand extends BaseCommand {
|
|
8
|
-
static baseFlags: {
|
|
9
|
-
page: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
'page-size': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
'date-format': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
header: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
hostname: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
plain: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
-
table: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
};
|
|
18
|
-
protected buildPaginatedUrl(options: {
|
|
19
|
-
hostname: string;
|
|
20
|
-
page?: number;
|
|
21
|
-
pageSize?: number;
|
|
22
|
-
params?: Record<string, number | string | undefined>;
|
|
23
|
-
path: string;
|
|
24
|
-
}): URL;
|
|
25
|
-
protected buildPaginatedUrlFromFlags(options: {
|
|
26
|
-
flags: PaginatedFlags;
|
|
27
|
-
params?: Record<string, number | string | undefined>;
|
|
28
|
-
path: string;
|
|
29
|
-
}): URL;
|
|
30
|
-
protected fetchPaginatedResults<T>(options: {
|
|
31
|
-
autoPaginate: boolean;
|
|
32
|
-
headers: Record<string, string>;
|
|
33
|
-
spinnerText?: string;
|
|
34
|
-
token: string;
|
|
35
|
-
url: URL;
|
|
36
|
-
}): Promise<T[]>;
|
|
37
|
-
protected fetchPaginatedResultsFromFlags<T>(options: {
|
|
38
|
-
autoPaginate: boolean;
|
|
39
|
-
flags: {
|
|
40
|
-
headers: Record<string, string>;
|
|
41
|
-
token: string;
|
|
42
|
-
};
|
|
43
|
-
spinnerText?: string;
|
|
44
|
-
url: URL;
|
|
45
|
-
}): Promise<T[]>;
|
|
46
|
-
protected paginate<T>(url: URL, tokenValue: string, headers: Record<string, string>, autoPaginate: boolean): AsyncGenerator<T>;
|
|
47
|
-
protected normalizeNextUrl(nextUrl: URL, currentUrl: URL): URL;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import { BaseCommand } from './base-command.js';
|
|
3
|
-
export class PaginatedCommand extends BaseCommand {
|
|
4
|
-
static baseFlags = {
|
|
5
|
-
...BaseCommand.baseFlags,
|
|
6
|
-
page: Flags.integer({ description: 'Page number to fetch' }),
|
|
7
|
-
'page-size': Flags.integer({ description: 'Number of results per page' }),
|
|
8
|
-
};
|
|
9
|
-
buildPaginatedUrl(options) {
|
|
10
|
-
const { hostname, page, pageSize, params = {}, path } = options;
|
|
11
|
-
if (page !== undefined && page < 1) {
|
|
12
|
-
this.error('Invalid page value. Page must be 1 or greater.');
|
|
13
|
-
}
|
|
14
|
-
if (pageSize !== undefined && pageSize < 1) {
|
|
15
|
-
this.error('Invalid page size. Page size must be 1 or greater.');
|
|
16
|
-
}
|
|
17
|
-
return this.buildApiUrl(hostname, path, {
|
|
18
|
-
...params,
|
|
19
|
-
page,
|
|
20
|
-
'page_size': pageSize,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
buildPaginatedUrlFromFlags(options) {
|
|
24
|
-
const { flags, params, path } = options;
|
|
25
|
-
return this.buildPaginatedUrl({
|
|
26
|
-
hostname: flags.hostname,
|
|
27
|
-
page: flags.page,
|
|
28
|
-
pageSize: flags['page-size'],
|
|
29
|
-
params,
|
|
30
|
-
path,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
async fetchPaginatedResults(options) {
|
|
34
|
-
const { autoPaginate, headers, spinnerText, token, url } = options;
|
|
35
|
-
const spinner = this.startSpinner(spinnerText ?? `Fetching ${url.pathname}`);
|
|
36
|
-
const results = [];
|
|
37
|
-
try {
|
|
38
|
-
let nextUrl = url;
|
|
39
|
-
while (nextUrl) {
|
|
40
|
-
const currentUrl = nextUrl;
|
|
41
|
-
// eslint-disable-next-line no-await-in-loop -- pagination is sequential and depends on the next page URL.
|
|
42
|
-
const payload = await this.fetchJson(currentUrl, token, headers);
|
|
43
|
-
results.push(...(payload.results ?? []));
|
|
44
|
-
if (!autoPaginate || !payload.next) {
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
try {
|
|
48
|
-
const parsedNext = new URL(payload.next, currentUrl);
|
|
49
|
-
nextUrl = this.normalizeNextUrl(parsedNext, currentUrl);
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
this.error('API returned an invalid next URL for pagination.');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
spinner?.stop();
|
|
58
|
-
}
|
|
59
|
-
return results;
|
|
60
|
-
}
|
|
61
|
-
async fetchPaginatedResultsFromFlags(options) {
|
|
62
|
-
const { autoPaginate, flags, spinnerText, url } = options;
|
|
63
|
-
return this.fetchPaginatedResults({
|
|
64
|
-
autoPaginate,
|
|
65
|
-
headers: flags.headers,
|
|
66
|
-
spinnerText,
|
|
67
|
-
token: flags.token,
|
|
68
|
-
url,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
async *paginate(url, tokenValue, headers, autoPaginate) {
|
|
72
|
-
let nextUrl = url;
|
|
73
|
-
while (nextUrl) {
|
|
74
|
-
const currentUrl = nextUrl;
|
|
75
|
-
// eslint-disable-next-line no-await-in-loop -- pagination is sequential and depends on the next page URL.
|
|
76
|
-
const payload = await this.fetchJson(currentUrl, tokenValue, headers);
|
|
77
|
-
const results = payload.results ?? [];
|
|
78
|
-
for (const result of results) {
|
|
79
|
-
yield result;
|
|
80
|
-
}
|
|
81
|
-
if (!autoPaginate || !payload.next) {
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
const parsedNext = new URL(payload.next, currentUrl);
|
|
86
|
-
nextUrl = this.normalizeNextUrl(parsedNext, currentUrl);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
this.error('API returned an invalid next URL for pagination.');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
normalizeNextUrl(nextUrl, currentUrl) {
|
|
94
|
-
if (currentUrl.protocol === 'https:' && nextUrl.protocol === 'http:' && nextUrl.hostname === currentUrl.hostname) {
|
|
95
|
-
nextUrl.protocol = currentUrl.protocol;
|
|
96
|
-
if (currentUrl.port) {
|
|
97
|
-
nextUrl.port = currentUrl.port;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return nextUrl;
|
|
101
|
-
}
|
|
102
|
-
}
|