docpouch-client 1.0.5 → 1.1.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 +9 -17
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov.info +202 -202
- package/dist/index.d.ts +12 -9
- package/dist/index.js +28 -27
- package/package.json +1 -1
- package/test-post-logout.js +24 -0
package/README.md
CHANGED
|
@@ -166,28 +166,18 @@ const newDocument = await client.createDocument({
|
|
|
166
166
|
public: false
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
-
//
|
|
170
|
-
await client.
|
|
171
|
-
|
|
172
|
-
owner: 'user-id',
|
|
173
|
-
title: 'Updated Mission Statement',
|
|
169
|
+
// Create an anonymous document
|
|
170
|
+
const anonymousDocument = await client.createDocument({
|
|
171
|
+
title: 'Anonymous Feedback',
|
|
174
172
|
type: 17,
|
|
175
173
|
subType: 11,
|
|
176
|
-
content: '{"msg": "
|
|
174
|
+
content: '{"msg": "This is anonymous feedback"}',
|
|
177
175
|
shareWithGroup: false,
|
|
178
176
|
shareWithDepartment: false,
|
|
179
|
-
public: false
|
|
177
|
+
public: false,
|
|
178
|
+
anonymous: true // Document will be owned by admin user
|
|
180
179
|
});
|
|
181
|
-
|
|
182
|
-
// Delete a document
|
|
183
|
-
await client.removeDocument('document-id');
|
|
184
|
-
|
|
185
|
-
// List all documents
|
|
186
|
-
const allDocuments = await client.listDocuments();
|
|
187
|
-
|
|
188
|
-
// Fetch documents by query
|
|
189
|
-
const documents = await client.fetchDocuments({type: 17, subType: 11});
|
|
190
|
-
```
|
|
180
|
+
```
|
|
191
181
|
|
|
192
182
|
### Data Structure Management
|
|
193
183
|
|
|
@@ -502,6 +492,7 @@ Authentication failures (HTTP 401/403) automatically clear the stored JWT token.
|
|
|
502
492
|
shareWithGroup: boolean;
|
|
503
493
|
shareWithDepartment: boolean;
|
|
504
494
|
public: boolean;
|
|
495
|
+
anonymous?: boolean; // If true, document will be owned by admin user
|
|
505
496
|
}
|
|
506
497
|
```
|
|
507
498
|
|
|
@@ -518,6 +509,7 @@ Authentication failures (HTTP 401/403) automatically clear the stored JWT token.
|
|
|
518
509
|
shareWithGroup: boolean;
|
|
519
510
|
shareWithDepartment: boolean;
|
|
520
511
|
public: boolean;
|
|
512
|
+
anonymous?: boolean; // If true, document will be owned by admin user (owner field will be overridden)
|
|
521
513
|
}
|
|
522
514
|
```
|
|
523
515
|
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2026-05-
|
|
119
|
+
at 2026-05-31T17:49:07.278Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="prettify.js"></script>
|
|
122
122
|
<script>
|
package/coverage/lcov.info
CHANGED
|
@@ -35,34 +35,34 @@ FN:654,(anonymous_31)
|
|
|
35
35
|
FN:679,(anonymous_32)
|
|
36
36
|
FN:686,(anonymous_33)
|
|
37
37
|
FN:693,(anonymous_34)
|
|
38
|
-
FN:
|
|
39
|
-
FN:
|
|
40
|
-
FN:
|
|
41
|
-
FN:
|
|
42
|
-
FN:
|
|
43
|
-
FN:
|
|
44
|
-
FN:
|
|
45
|
-
FN:
|
|
46
|
-
FN:
|
|
47
|
-
FN:
|
|
48
|
-
FN:
|
|
49
|
-
FN:
|
|
50
|
-
FN:
|
|
51
|
-
FN:
|
|
52
|
-
FN:
|
|
53
|
-
FN:
|
|
54
|
-
FN:
|
|
55
|
-
FN:
|
|
56
|
-
FN:
|
|
57
|
-
FN:
|
|
58
|
-
FN:
|
|
59
|
-
FN:
|
|
60
|
-
FN:
|
|
61
|
-
FN:
|
|
62
|
-
FN:
|
|
63
|
-
FN:
|
|
64
|
-
FN:
|
|
65
|
-
FN:
|
|
38
|
+
FN:703,(anonymous_35)
|
|
39
|
+
FN:731,(anonymous_36)
|
|
40
|
+
FN:742,(anonymous_37)
|
|
41
|
+
FN:754,(anonymous_38)
|
|
42
|
+
FN:765,(anonymous_39)
|
|
43
|
+
FN:774,(anonymous_40)
|
|
44
|
+
FN:776,(anonymous_41)
|
|
45
|
+
FN:781,(anonymous_42)
|
|
46
|
+
FN:786,(anonymous_43)
|
|
47
|
+
FN:791,(anonymous_44)
|
|
48
|
+
FN:802,(anonymous_45)
|
|
49
|
+
FN:836,(anonymous_46)
|
|
50
|
+
FN:850,(anonymous_47)
|
|
51
|
+
FN:880,(anonymous_48)
|
|
52
|
+
FN:886,(anonymous_49)
|
|
53
|
+
FN:919,(anonymous_50)
|
|
54
|
+
FN:924,(anonymous_51)
|
|
55
|
+
FN:933,(anonymous_52)
|
|
56
|
+
FN:944,(anonymous_53)
|
|
57
|
+
FN:956,(anonymous_54)
|
|
58
|
+
FN:962,(anonymous_55)
|
|
59
|
+
FN:993,(anonymous_56)
|
|
60
|
+
FN:997,(anonymous_57)
|
|
61
|
+
FN:1000,(anonymous_58)
|
|
62
|
+
FN:1010,(anonymous_59)
|
|
63
|
+
FN:1013,(anonymous_60)
|
|
64
|
+
FN:1021,(anonymous_61)
|
|
65
|
+
FN:1028,(anonymous_62)
|
|
66
66
|
FNF:63
|
|
67
67
|
FNH:48
|
|
68
68
|
FNDA:64,(anonymous_0)
|
|
@@ -100,7 +100,7 @@ FNDA:1,(anonymous_31)
|
|
|
100
100
|
FNDA:1,(anonymous_32)
|
|
101
101
|
FNDA:0,(anonymous_33)
|
|
102
102
|
FNDA:1,(anonymous_34)
|
|
103
|
-
FNDA:
|
|
103
|
+
FNDA:0,(anonymous_35)
|
|
104
104
|
FNDA:5,(anonymous_36)
|
|
105
105
|
FNDA:3,(anonymous_37)
|
|
106
106
|
FNDA:1,(anonymous_38)
|
|
@@ -127,7 +127,7 @@ FNDA:3,(anonymous_58)
|
|
|
127
127
|
FNDA:3,(anonymous_59)
|
|
128
128
|
FNDA:96,(anonymous_60)
|
|
129
129
|
FNDA:0,(anonymous_61)
|
|
130
|
-
FNDA:
|
|
130
|
+
FNDA:2,(anonymous_62)
|
|
131
131
|
DA:33,64
|
|
132
132
|
DA:40,64
|
|
133
133
|
DA:41,64
|
|
@@ -345,127 +345,127 @@ DA:672,1
|
|
|
345
345
|
DA:680,1
|
|
346
346
|
DA:687,0
|
|
347
347
|
DA:694,1
|
|
348
|
-
DA:
|
|
349
|
-
DA:
|
|
350
|
-
DA:
|
|
351
|
-
DA:
|
|
352
|
-
DA:
|
|
353
|
-
DA:
|
|
354
|
-
DA:
|
|
355
|
-
DA:
|
|
356
|
-
DA:
|
|
357
|
-
DA:
|
|
358
|
-
DA:
|
|
359
|
-
DA:
|
|
360
|
-
DA:
|
|
361
|
-
DA:771,5
|
|
362
|
-
DA:772,5
|
|
363
|
-
DA:775,64
|
|
364
|
-
DA:776,0
|
|
348
|
+
DA:705,0
|
|
349
|
+
DA:706,0
|
|
350
|
+
DA:707,0
|
|
351
|
+
DA:711,0
|
|
352
|
+
DA:712,0
|
|
353
|
+
DA:715,0
|
|
354
|
+
DA:716,0
|
|
355
|
+
DA:719,0
|
|
356
|
+
DA:732,5
|
|
357
|
+
DA:743,3
|
|
358
|
+
DA:755,1
|
|
359
|
+
DA:766,2
|
|
360
|
+
DA:776,64
|
|
365
361
|
DA:777,0
|
|
362
|
+
DA:778,0
|
|
363
|
+
DA:781,64
|
|
364
|
+
DA:782,5
|
|
365
|
+
DA:783,5
|
|
366
|
+
DA:786,64
|
|
366
367
|
DA:787,5
|
|
367
368
|
DA:788,5
|
|
368
|
-
DA:
|
|
369
|
-
DA:
|
|
370
|
-
DA:
|
|
371
|
-
DA:798,5
|
|
372
|
-
DA:799,0
|
|
373
|
-
DA:800,0
|
|
369
|
+
DA:791,64
|
|
370
|
+
DA:792,0
|
|
371
|
+
DA:793,0
|
|
374
372
|
DA:803,5
|
|
375
|
-
DA:804,
|
|
376
|
-
DA:
|
|
377
|
-
DA:
|
|
378
|
-
DA:
|
|
379
|
-
DA:811,5
|
|
373
|
+
DA:804,5
|
|
374
|
+
DA:809,5
|
|
375
|
+
DA:810,0
|
|
376
|
+
DA:811,0
|
|
380
377
|
DA:814,5
|
|
381
|
-
DA:
|
|
382
|
-
DA:
|
|
383
|
-
DA:
|
|
384
|
-
DA:
|
|
385
|
-
DA:
|
|
386
|
-
DA:824,
|
|
387
|
-
DA:
|
|
378
|
+
DA:815,0
|
|
379
|
+
DA:816,0
|
|
380
|
+
DA:819,5
|
|
381
|
+
DA:820,0
|
|
382
|
+
DA:821,0
|
|
383
|
+
DA:824,5
|
|
384
|
+
DA:826,5
|
|
385
|
+
DA:827,5
|
|
388
386
|
DA:830,5
|
|
389
|
-
DA:
|
|
390
|
-
DA:
|
|
391
|
-
DA:
|
|
392
|
-
DA:
|
|
393
|
-
DA:
|
|
394
|
-
DA:840,
|
|
395
|
-
DA:841,
|
|
396
|
-
DA:
|
|
397
|
-
DA:
|
|
398
|
-
DA:
|
|
399
|
-
DA:
|
|
400
|
-
DA:
|
|
401
|
-
DA:
|
|
402
|
-
DA:
|
|
403
|
-
DA:
|
|
404
|
-
DA:
|
|
405
|
-
DA:
|
|
406
|
-
DA:
|
|
407
|
-
DA:
|
|
408
|
-
DA:
|
|
387
|
+
DA:833,5
|
|
388
|
+
DA:836,5
|
|
389
|
+
DA:837,2
|
|
390
|
+
DA:838,1
|
|
391
|
+
DA:839,1
|
|
392
|
+
DA:840,1
|
|
393
|
+
DA:841,1
|
|
394
|
+
DA:846,5
|
|
395
|
+
DA:847,5
|
|
396
|
+
DA:850,5
|
|
397
|
+
DA:851,0
|
|
398
|
+
DA:852,0
|
|
399
|
+
DA:853,0
|
|
400
|
+
DA:856,0
|
|
401
|
+
DA:857,0
|
|
402
|
+
DA:858,0
|
|
403
|
+
DA:859,0
|
|
404
|
+
DA:864,0
|
|
405
|
+
DA:865,0
|
|
406
|
+
DA:881,94
|
|
409
407
|
DA:885,94
|
|
410
|
-
DA:886,
|
|
411
|
-
DA:
|
|
412
|
-
DA:
|
|
413
|
-
DA:
|
|
414
|
-
DA:
|
|
415
|
-
DA:
|
|
416
|
-
DA:
|
|
417
|
-
DA:
|
|
418
|
-
DA:
|
|
419
|
-
DA:
|
|
420
|
-
DA:
|
|
421
|
-
DA:
|
|
422
|
-
DA:
|
|
423
|
-
DA:
|
|
424
|
-
DA:
|
|
425
|
-
DA:914,
|
|
426
|
-
DA:
|
|
427
|
-
DA:
|
|
428
|
-
DA:
|
|
429
|
-
DA:
|
|
430
|
-
DA:
|
|
431
|
-
DA:
|
|
432
|
-
DA:924,2
|
|
433
|
-
DA:925,2
|
|
408
|
+
DA:886,0
|
|
409
|
+
DA:889,94
|
|
410
|
+
DA:890,54
|
|
411
|
+
DA:891,94
|
|
412
|
+
DA:892,0
|
|
413
|
+
DA:894,94
|
|
414
|
+
DA:900,94
|
|
415
|
+
DA:901,94
|
|
416
|
+
DA:902,94
|
|
417
|
+
DA:903,94
|
|
418
|
+
DA:905,93
|
|
419
|
+
DA:906,14
|
|
420
|
+
DA:907,7
|
|
421
|
+
DA:909,14
|
|
422
|
+
DA:912,79
|
|
423
|
+
DA:914,78
|
|
424
|
+
DA:920,1
|
|
425
|
+
DA:921,1
|
|
426
|
+
DA:925,1
|
|
427
|
+
DA:926,1
|
|
428
|
+
DA:927,1
|
|
429
|
+
DA:928,1
|
|
434
430
|
DA:929,1
|
|
435
|
-
DA:930,
|
|
436
|
-
DA:
|
|
431
|
+
DA:930,1
|
|
432
|
+
DA:934,2
|
|
433
|
+
DA:935,2
|
|
434
|
+
DA:936,2
|
|
435
|
+
DA:937,2
|
|
436
|
+
DA:938,2
|
|
437
|
+
DA:939,2
|
|
438
|
+
DA:940,2
|
|
437
439
|
DA:941,2
|
|
438
|
-
DA:
|
|
439
|
-
DA:
|
|
440
|
-
DA:
|
|
441
|
-
DA:
|
|
442
|
-
DA:
|
|
443
|
-
DA:961,0
|
|
444
|
-
DA:962,0
|
|
440
|
+
DA:945,1
|
|
441
|
+
DA:946,0
|
|
442
|
+
DA:952,0
|
|
443
|
+
DA:957,2
|
|
444
|
+
DA:958,0
|
|
445
445
|
DA:963,0
|
|
446
|
+
DA:964,0
|
|
446
447
|
DA:965,0
|
|
447
|
-
DA:
|
|
448
|
-
DA:
|
|
449
|
-
DA:978,
|
|
450
|
-
DA:979,
|
|
451
|
-
DA:
|
|
452
|
-
DA:
|
|
453
|
-
DA:
|
|
454
|
-
DA:
|
|
455
|
-
DA:987,3
|
|
456
|
-
DA:988,3
|
|
448
|
+
DA:971,0
|
|
449
|
+
DA:977,0
|
|
450
|
+
DA:978,0
|
|
451
|
+
DA:979,0
|
|
452
|
+
DA:981,0
|
|
453
|
+
DA:982,0
|
|
454
|
+
DA:990,0
|
|
455
|
+
DA:994,3
|
|
457
456
|
DA:995,3
|
|
458
457
|
DA:996,3
|
|
459
|
-
DA:997,
|
|
460
|
-
DA:
|
|
461
|
-
DA:
|
|
462
|
-
DA:
|
|
463
|
-
DA:
|
|
464
|
-
DA:
|
|
465
|
-
DA:
|
|
466
|
-
DA:
|
|
458
|
+
DA:997,192
|
|
459
|
+
DA:1001,3
|
|
460
|
+
DA:1002,3
|
|
461
|
+
DA:1003,3
|
|
462
|
+
DA:1004,3
|
|
463
|
+
DA:1011,3
|
|
464
|
+
DA:1012,3
|
|
465
|
+
DA:1013,96
|
|
467
466
|
DA:1022,0
|
|
468
|
-
DA:
|
|
467
|
+
DA:1029,2
|
|
468
|
+
DA:1030,0
|
|
469
469
|
LF:338
|
|
470
470
|
LH:191
|
|
471
471
|
BRDA:71,0,0,63
|
|
@@ -632,73 +632,73 @@ BRDA:668,76,0,1
|
|
|
632
632
|
BRDA:668,76,1,0
|
|
633
633
|
BRDA:671,77,0,1
|
|
634
634
|
BRDA:671,77,1,0
|
|
635
|
-
BRDA:
|
|
636
|
-
BRDA:
|
|
637
|
-
BRDA:
|
|
638
|
-
BRDA:
|
|
639
|
-
BRDA:
|
|
640
|
-
BRDA:
|
|
641
|
-
BRDA:
|
|
642
|
-
BRDA:
|
|
643
|
-
BRDA:
|
|
644
|
-
BRDA:
|
|
645
|
-
BRDA:
|
|
646
|
-
BRDA:
|
|
647
|
-
BRDA:
|
|
648
|
-
BRDA:
|
|
649
|
-
BRDA:
|
|
650
|
-
BRDA:
|
|
651
|
-
BRDA:840,86,0,
|
|
635
|
+
BRDA:706,78,0,0
|
|
636
|
+
BRDA:706,78,1,0
|
|
637
|
+
BRDA:715,79,0,0
|
|
638
|
+
BRDA:715,79,1,0
|
|
639
|
+
BRDA:715,80,0,0
|
|
640
|
+
BRDA:715,80,1,0
|
|
641
|
+
BRDA:803,81,0,0
|
|
642
|
+
BRDA:803,81,1,5
|
|
643
|
+
BRDA:809,82,0,0
|
|
644
|
+
BRDA:809,82,1,5
|
|
645
|
+
BRDA:814,83,0,0
|
|
646
|
+
BRDA:814,83,1,5
|
|
647
|
+
BRDA:819,84,0,0
|
|
648
|
+
BRDA:819,84,1,5
|
|
649
|
+
BRDA:837,85,0,1
|
|
650
|
+
BRDA:837,85,1,1
|
|
651
|
+
BRDA:840,86,0,1
|
|
652
652
|
BRDA:840,86,1,0
|
|
653
|
-
BRDA:
|
|
654
|
-
BRDA:
|
|
655
|
-
BRDA:
|
|
656
|
-
BRDA:
|
|
657
|
-
BRDA:
|
|
658
|
-
BRDA:
|
|
659
|
-
BRDA:
|
|
660
|
-
BRDA:
|
|
661
|
-
BRDA:
|
|
662
|
-
BRDA:
|
|
663
|
-
BRDA:
|
|
664
|
-
BRDA:
|
|
665
|
-
BRDA:
|
|
666
|
-
BRDA:
|
|
667
|
-
BRDA:
|
|
668
|
-
BRDA:
|
|
669
|
-
BRDA:
|
|
670
|
-
BRDA:
|
|
671
|
-
BRDA:
|
|
672
|
-
BRDA:
|
|
673
|
-
BRDA:
|
|
674
|
-
BRDA:
|
|
675
|
-
BRDA:
|
|
676
|
-
BRDA:
|
|
677
|
-
BRDA:
|
|
678
|
-
BRDA:
|
|
679
|
-
BRDA:
|
|
653
|
+
BRDA:851,87,0,0
|
|
654
|
+
BRDA:851,87,1,0
|
|
655
|
+
BRDA:856,88,0,0
|
|
656
|
+
BRDA:856,88,1,0
|
|
657
|
+
BRDA:880,89,0,45
|
|
658
|
+
BRDA:885,90,0,94
|
|
659
|
+
BRDA:885,90,1,84
|
|
660
|
+
BRDA:885,91,0,0
|
|
661
|
+
BRDA:885,91,1,84
|
|
662
|
+
BRDA:889,92,0,54
|
|
663
|
+
BRDA:889,92,1,40
|
|
664
|
+
BRDA:889,93,0,94
|
|
665
|
+
BRDA:889,93,1,56
|
|
666
|
+
BRDA:891,94,0,0
|
|
667
|
+
BRDA:891,94,1,94
|
|
668
|
+
BRDA:897,95,0,66
|
|
669
|
+
BRDA:897,95,1,28
|
|
670
|
+
BRDA:900,96,0,94
|
|
671
|
+
BRDA:900,96,1,0
|
|
672
|
+
BRDA:901,97,0,0
|
|
673
|
+
BRDA:901,97,1,94
|
|
674
|
+
BRDA:905,98,0,14
|
|
675
|
+
BRDA:905,98,1,79
|
|
676
|
+
BRDA:906,99,0,7
|
|
677
|
+
BRDA:906,99,1,7
|
|
678
|
+
BRDA:906,100,0,14
|
|
679
|
+
BRDA:906,100,1,7
|
|
680
680
|
BRDA:912,101,0,1
|
|
681
|
-
BRDA:912,101,1,
|
|
682
|
-
BRDA:
|
|
683
|
-
BRDA:
|
|
684
|
-
BRDA:
|
|
685
|
-
BRDA:
|
|
686
|
-
BRDA:
|
|
687
|
-
BRDA:
|
|
688
|
-
BRDA:
|
|
689
|
-
BRDA:
|
|
690
|
-
BRDA:
|
|
691
|
-
BRDA:
|
|
692
|
-
BRDA:
|
|
693
|
-
BRDA:
|
|
694
|
-
BRDA:
|
|
695
|
-
BRDA:
|
|
696
|
-
BRDA:
|
|
697
|
-
BRDA:
|
|
698
|
-
BRDA:
|
|
699
|
-
BRDA:
|
|
700
|
-
BRDA:
|
|
701
|
-
BRDA:
|
|
681
|
+
BRDA:912,101,1,78
|
|
682
|
+
BRDA:927,102,0,1
|
|
683
|
+
BRDA:927,102,1,0
|
|
684
|
+
BRDA:928,103,0,1
|
|
685
|
+
BRDA:928,103,1,0
|
|
686
|
+
BRDA:940,104,0,0
|
|
687
|
+
BRDA:940,104,1,2
|
|
688
|
+
BRDA:945,105,0,0
|
|
689
|
+
BRDA:945,105,1,1
|
|
690
|
+
BRDA:945,106,0,1
|
|
691
|
+
BRDA:945,106,1,1
|
|
692
|
+
BRDA:957,107,0,0
|
|
693
|
+
BRDA:957,107,1,2
|
|
694
|
+
BRDA:957,108,0,2
|
|
695
|
+
BRDA:957,108,1,2
|
|
696
|
+
BRDA:963,109,0,0
|
|
697
|
+
BRDA:963,109,1,0
|
|
698
|
+
BRDA:977,110,0,0
|
|
699
|
+
BRDA:977,110,1,0
|
|
700
|
+
BRDA:1029,111,0,0
|
|
701
|
+
BRDA:1029,111,1,2
|
|
702
702
|
BRF:231
|
|
703
703
|
BRH:113
|
|
704
704
|
end_of_record
|
package/dist/index.d.ts
CHANGED
|
@@ -264,9 +264,12 @@ export default class docPouchClient {
|
|
|
264
264
|
*/
|
|
265
265
|
onJwtLogout(callback: () => void): void;
|
|
266
266
|
/**
|
|
267
|
-
*
|
|
267
|
+
* Check if user was just logged out (after redirect from /end_session)
|
|
268
|
+
* Checks URL for logout indicator or checks localStorage
|
|
269
|
+
*
|
|
270
|
+
* @returns {boolean} True if user was just logged out
|
|
268
271
|
*/
|
|
269
|
-
|
|
272
|
+
wasJustLoggedOut(): boolean;
|
|
270
273
|
/**
|
|
271
274
|
* Registers a new OIDC client with the server (dynamic client registration).
|
|
272
275
|
*
|
|
@@ -333,19 +336,16 @@ export default class docPouchClient {
|
|
|
333
336
|
private generateCodeVerifier;
|
|
334
337
|
private generateCodeChallenge;
|
|
335
338
|
private generateState;
|
|
336
|
-
/**
|
|
337
|
-
* Check if user was just logged out (after redirect from /end_session)
|
|
338
|
-
* Checks URL for logout indicator or checks localStorage
|
|
339
|
-
*
|
|
340
|
-
* @returns {boolean} True if user was just logged out
|
|
341
|
-
*/
|
|
342
|
-
wasJustLoggedOut(): boolean;
|
|
343
339
|
/**
|
|
344
340
|
* Get post_logout_redirect_uri after OIDC logout
|
|
345
341
|
*
|
|
346
342
|
* @returns {string | null} The post logout redirect URI or null if not set
|
|
347
343
|
*/
|
|
348
344
|
getPostLogoutRedirectUri(): string | null;
|
|
345
|
+
/**
|
|
346
|
+
* Emit an event
|
|
347
|
+
*/
|
|
348
|
+
private emit;
|
|
349
349
|
}
|
|
350
350
|
export interface I_UserEntry extends I_UserCreation {
|
|
351
351
|
_id: string;
|
|
@@ -414,6 +414,7 @@ export interface I_OidcUserInfo {
|
|
|
414
414
|
export interface I_OidcClientRegistration {
|
|
415
415
|
client_name: string;
|
|
416
416
|
redirect_uris: string[];
|
|
417
|
+
post_logout_redirect_uris?: string[];
|
|
417
418
|
grant_types?: string[];
|
|
418
419
|
response_types?: string[];
|
|
419
420
|
scope?: string;
|
|
@@ -433,6 +434,7 @@ export interface I_OidcClientResponse {
|
|
|
433
434
|
registration_client_uri?: string;
|
|
434
435
|
client_name?: string;
|
|
435
436
|
redirect_uris?: string[];
|
|
437
|
+
post_logout_redirect_uris?: string[];
|
|
436
438
|
grant_types?: string[];
|
|
437
439
|
response_types?: string[];
|
|
438
440
|
scope?: string;
|
|
@@ -456,6 +458,7 @@ export interface I_DocumentCreation {
|
|
|
456
458
|
shareWithGroup: boolean;
|
|
457
459
|
shareWithDepartment: boolean;
|
|
458
460
|
public: boolean;
|
|
461
|
+
anonymous?: boolean;
|
|
459
462
|
}
|
|
460
463
|
export interface I_DocumentCreationOwned extends I_DocumentCreation {
|
|
461
464
|
owner: string;
|
package/dist/index.js
CHANGED
|
@@ -491,7 +491,8 @@ export default class docPouchClient {
|
|
|
491
491
|
const wasOidc = this.authMethod === 'oidc';
|
|
492
492
|
// For OIDC, redirect to /end_session endpoint
|
|
493
493
|
if (wasOidc && this.oidcConfig && typeof window !== 'undefined') {
|
|
494
|
-
|
|
494
|
+
// Use postLogoutRedirectUri if available, otherwise fallback to redirectUri
|
|
495
|
+
const redirectUri = options?.redirectUri || this.oidcConfig.postLogoutRedirectUri || this.oidcConfig.redirectUri || window.location.origin;
|
|
495
496
|
let url = `${this.oidcConfig.issuer}/end_session?post_logout_redirect_uri=${encodeURIComponent(redirectUri)}`;
|
|
496
497
|
// Add id_token_hint if available
|
|
497
498
|
const idToken = options?.idTokenHint || this.oidcIdToken;
|
|
@@ -543,7 +544,7 @@ export default class docPouchClient {
|
|
|
543
544
|
if (!this.oidcConfig?.issuer) {
|
|
544
545
|
throw new Error('OIDC issuer not configured');
|
|
545
546
|
}
|
|
546
|
-
const { redirectUri = this.oidcConfig.redirectUri || window.location.origin, idTokenHint } = options || {};
|
|
547
|
+
const { redirectUri = this.oidcConfig.postLogoutRedirectUri || this.oidcConfig.redirectUri || window.location.origin, idTokenHint } = options || {};
|
|
547
548
|
let url = `${this.oidcConfig.issuer}/end_session?post_logout_redirect_uri=${encodeURIComponent(redirectUri)}`;
|
|
548
549
|
if (idTokenHint) {
|
|
549
550
|
url += `&id_token_hint=${idTokenHint}`;
|
|
@@ -606,12 +607,25 @@ export default class docPouchClient {
|
|
|
606
607
|
this.events['jwt-logout'] = callback;
|
|
607
608
|
}
|
|
608
609
|
/**
|
|
609
|
-
*
|
|
610
|
+
* Check if user was just logged out (after redirect from /end_session)
|
|
611
|
+
* Checks URL for logout indicator or checks localStorage
|
|
612
|
+
*
|
|
613
|
+
* @returns {boolean} True if user was just logged out
|
|
610
614
|
*/
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
615
|
+
wasJustLoggedOut() {
|
|
616
|
+
// Check URL query parameter
|
|
617
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
618
|
+
if (urlParams.get('logout') === 'true') {
|
|
619
|
+
return true;
|
|
614
620
|
}
|
|
621
|
+
// Check localStorage flag
|
|
622
|
+
const lastAuthMethod = localStorage.getItem('lastAuthMethod');
|
|
623
|
+
const currentAuthMethod = localStorage.getItem('authMethod');
|
|
624
|
+
// If last was OIDC/JWT but current is none, was logged out
|
|
625
|
+
if (lastAuthMethod && currentAuthMethod === null) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
return false;
|
|
615
629
|
}
|
|
616
630
|
// OIDC Dynamic Client Registration Methods
|
|
617
631
|
/**
|
|
@@ -868,27 +882,6 @@ export default class docPouchClient {
|
|
|
868
882
|
crypto.getRandomValues(array);
|
|
869
883
|
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
|
870
884
|
}
|
|
871
|
-
/**
|
|
872
|
-
* Check if user was just logged out (after redirect from /end_session)
|
|
873
|
-
* Checks URL for logout indicator or checks localStorage
|
|
874
|
-
*
|
|
875
|
-
* @returns {boolean} True if user was just logged out
|
|
876
|
-
*/
|
|
877
|
-
wasJustLoggedOut() {
|
|
878
|
-
// Check URL query parameter
|
|
879
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
880
|
-
if (urlParams.get('logout') === 'true') {
|
|
881
|
-
return true;
|
|
882
|
-
}
|
|
883
|
-
// Check localStorage flag
|
|
884
|
-
const lastAuthMethod = localStorage.getItem('lastAuthMethod');
|
|
885
|
-
const currentAuthMethod = localStorage.getItem('authMethod');
|
|
886
|
-
// If last was OIDC/JWT but current is none, was logged out
|
|
887
|
-
if (lastAuthMethod && currentAuthMethod === null) {
|
|
888
|
-
return true;
|
|
889
|
-
}
|
|
890
|
-
return false;
|
|
891
|
-
}
|
|
892
885
|
/**
|
|
893
886
|
* Get post_logout_redirect_uri after OIDC logout
|
|
894
887
|
*
|
|
@@ -897,4 +890,12 @@ export default class docPouchClient {
|
|
|
897
890
|
getPostLogoutRedirectUri() {
|
|
898
891
|
return localStorage.getItem('postLogoutRedirectUri');
|
|
899
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Emit an event
|
|
895
|
+
*/
|
|
896
|
+
emit(event) {
|
|
897
|
+
if (this.events[event]) {
|
|
898
|
+
this.events[event]();
|
|
899
|
+
}
|
|
900
|
+
}
|
|
900
901
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Test script to verify post_logout_redirect_uris functionality
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
|
|
4
|
+
// Read the built client to verify the changes
|
|
5
|
+
const clientCode = fs.readFileSync('dist/index.js', 'utf8');
|
|
6
|
+
|
|
7
|
+
console.log('Checking for post_logout_redirect_uris support...');
|
|
8
|
+
|
|
9
|
+
// Check if the interfaces include post_logout_redirect_uris
|
|
10
|
+
const hasRegistrationInterface = clientCode.includes('post_logout_redirect_uris?: string[]');
|
|
11
|
+
const hasResponseInterface = clientCode.includes('post_logout_redirect_uris?: string[]');
|
|
12
|
+
|
|
13
|
+
// Check if logout methods use postLogoutRedirectUri
|
|
14
|
+
const usesPostLogoutUri = clientCode.includes('this.oidcConfig.postLogoutRedirectUri');
|
|
15
|
+
|
|
16
|
+
console.log('I_OidcClientRegistration has post_logout_redirect_uris:', hasRegistrationInterface);
|
|
17
|
+
console.log('I_OidcClientResponse has post_logout_redirect_uris:', hasResponseInterface);
|
|
18
|
+
console.log('Logout methods use postLogoutRedirectUri:', usesPostLogoutUri);
|
|
19
|
+
|
|
20
|
+
if (hasRegistrationInterface && hasResponseInterface && usesPostLogoutUri) {
|
|
21
|
+
console.log('✅ All post_logout_redirect_uris functionality is properly implemented!');
|
|
22
|
+
} else {
|
|
23
|
+
console.log('❌ Some post_logout_redirect_uris functionality is missing');
|
|
24
|
+
}
|