@sphereon/ssi-sdk.pd-manager 0.32.1-next.54 → 0.33.1-feature.jose.vcdm.55

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/dist/index.js CHANGED
@@ -1,27 +1,1356 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __commonJS = (cb, mod) => function __require() {
5
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
6
+ };
7
+
8
+ // plugin.schema.json
9
+ var require_plugin_schema = __commonJS({
10
+ "plugin.schema.json"(exports, module) {
11
+ module.exports = {
12
+ IPDManager: {
13
+ components: {
14
+ schemas: {
15
+ DeleteDefinitionItemArgs: {
16
+ type: "object",
17
+ properties: {
18
+ itemId: {
19
+ type: "string"
20
+ }
21
+ },
22
+ required: [
23
+ "itemId"
24
+ ],
25
+ additionalProperties: false
26
+ },
27
+ DeleteDefinitionItemsArgs: {
28
+ $ref: "#/components/schemas/GetDefinitionItemsArgs"
29
+ },
30
+ GetDefinitionItemsArgs: {
31
+ type: "object",
32
+ properties: {
33
+ filter: {
34
+ $ref: "#/components/schemas/FindDefinitionArgs"
35
+ },
36
+ opts: {
37
+ $ref: "#/components/schemas/FetchOptions"
38
+ }
39
+ },
40
+ additionalProperties: false
41
+ },
42
+ FindDefinitionArgs: {
43
+ type: "array",
44
+ items: {
45
+ $ref: "#/components/schemas/PresentationDefinitionItemFilter"
46
+ }
47
+ },
48
+ PresentationDefinitionItemFilter: {
49
+ $ref: '#/components/schemas/Partial<Omit<PresentationDefinitionItem,("definitionPayload"|"dcqlPayload")>>'
50
+ },
51
+ 'Partial<Omit<PresentationDefinitionItem,("definitionPayload"|"dcqlPayload")>>': {
52
+ type: "object",
53
+ properties: {
54
+ id: {
55
+ type: "string"
56
+ },
57
+ definitionId: {
58
+ type: "string"
59
+ },
60
+ tenantId: {
61
+ type: "string"
62
+ },
63
+ version: {
64
+ type: "string"
65
+ },
66
+ name: {
67
+ type: "string"
68
+ },
69
+ purpose: {
70
+ type: "string"
71
+ },
72
+ createdAt: {
73
+ type: "string",
74
+ format: "date-time"
75
+ },
76
+ lastUpdatedAt: {
77
+ type: "string",
78
+ format: "date-time"
79
+ }
80
+ },
81
+ additionalProperties: false
82
+ },
83
+ FetchOptions: {
84
+ type: "object",
85
+ properties: {
86
+ showVersionHistory: {
87
+ type: "boolean"
88
+ }
89
+ },
90
+ additionalProperties: false
91
+ },
92
+ GetDefinitionItemArgs: {
93
+ type: "object",
94
+ properties: {
95
+ itemId: {
96
+ type: "string"
97
+ }
98
+ },
99
+ required: [
100
+ "itemId"
101
+ ],
102
+ additionalProperties: false
103
+ },
104
+ PresentationDefinitionItem: {
105
+ type: "object",
106
+ properties: {
107
+ id: {
108
+ type: "string"
109
+ },
110
+ definitionId: {
111
+ type: "string"
112
+ },
113
+ tenantId: {
114
+ type: "string"
115
+ },
116
+ version: {
117
+ type: "string"
118
+ },
119
+ name: {
120
+ type: "string"
121
+ },
122
+ purpose: {
123
+ type: "string"
124
+ },
125
+ definitionPayload: {
126
+ $ref: "#/components/schemas/IPresentationDefinition"
127
+ },
128
+ dcqlPayload: {
129
+ $ref: "#/components/schemas/DcqlQueryREST"
130
+ },
131
+ createdAt: {
132
+ type: "string",
133
+ format: "date-time"
134
+ },
135
+ lastUpdatedAt: {
136
+ type: "string",
137
+ format: "date-time"
138
+ }
139
+ },
140
+ required: [
141
+ "id",
142
+ "definitionId",
143
+ "version",
144
+ "definitionPayload",
145
+ "createdAt",
146
+ "lastUpdatedAt"
147
+ ],
148
+ additionalProperties: false
149
+ },
150
+ IPresentationDefinition: {
151
+ anyOf: [
152
+ {
153
+ $ref: "#/components/schemas/PresentationDefinitionV1"
154
+ },
155
+ {
156
+ $ref: "#/components/schemas/PresentationDefinitionV2"
157
+ }
158
+ ]
159
+ },
160
+ PresentationDefinitionV1: {
161
+ type: "object",
162
+ properties: {
163
+ id: {
164
+ type: "string"
165
+ },
166
+ name: {
167
+ type: "string"
168
+ },
169
+ purpose: {
170
+ type: "string"
171
+ },
172
+ format: {
173
+ $ref: "#/components/schemas/Format"
174
+ },
175
+ submission_requirements: {
176
+ type: "array",
177
+ items: {
178
+ $ref: "#/components/schemas/SubmissionRequirement"
179
+ }
180
+ },
181
+ input_descriptors: {
182
+ type: "array",
183
+ items: {
184
+ $ref: "#/components/schemas/InputDescriptorV1"
185
+ }
186
+ }
187
+ },
188
+ required: [
189
+ "id",
190
+ "input_descriptors"
191
+ ],
192
+ additionalProperties: false
193
+ },
194
+ Format: {
195
+ type: "object",
196
+ properties: {
197
+ jwt: {
198
+ $ref: "#/components/schemas/JwtObject"
199
+ },
200
+ jwt_vc: {
201
+ $ref: "#/components/schemas/JwtObject"
202
+ },
203
+ jwt_vc_json: {
204
+ $ref: "#/components/schemas/JwtObject"
205
+ },
206
+ jwt_vp: {
207
+ $ref: "#/components/schemas/JwtObject"
208
+ },
209
+ jwt_vp_json: {
210
+ $ref: "#/components/schemas/JwtObject"
211
+ },
212
+ ldp: {
213
+ $ref: "#/components/schemas/LdpObject"
214
+ },
215
+ ldp_vc: {
216
+ $ref: "#/components/schemas/LdpObject"
217
+ },
218
+ ldp_vp: {
219
+ $ref: "#/components/schemas/LdpObject"
220
+ },
221
+ di: {
222
+ $ref: "#/components/schemas/DiObject"
223
+ },
224
+ di_vc: {
225
+ $ref: "#/components/schemas/DiObject"
226
+ },
227
+ di_vp: {
228
+ $ref: "#/components/schemas/DiObject"
229
+ },
230
+ "vc+sd-jwt": {
231
+ $ref: "#/components/schemas/SdJwtObject"
232
+ },
233
+ mso_mdoc: {
234
+ $ref: "#/components/schemas/MsoMdocObject"
235
+ }
236
+ },
237
+ additionalProperties: false
238
+ },
239
+ JwtObject: {
240
+ type: "object",
241
+ properties: {
242
+ alg: {
243
+ type: "array",
244
+ items: {
245
+ type: "string"
246
+ }
247
+ }
248
+ },
249
+ required: [
250
+ "alg"
251
+ ],
252
+ additionalProperties: false
253
+ },
254
+ LdpObject: {
255
+ type: "object",
256
+ properties: {
257
+ proof_type: {
258
+ type: "array",
259
+ items: {
260
+ type: "string"
261
+ }
262
+ }
263
+ },
264
+ required: [
265
+ "proof_type"
266
+ ],
267
+ additionalProperties: false
268
+ },
269
+ DiObject: {
270
+ type: "object",
271
+ properties: {
272
+ proof_type: {
273
+ type: "array",
274
+ items: {
275
+ type: "string"
276
+ }
277
+ },
278
+ cryptosuite: {
279
+ type: "array",
280
+ items: {
281
+ type: "string"
282
+ }
283
+ }
284
+ },
285
+ required: [
286
+ "proof_type",
287
+ "cryptosuite"
288
+ ],
289
+ additionalProperties: false
290
+ },
291
+ SdJwtObject: {
292
+ type: "object",
293
+ properties: {
294
+ "sd-jwt_alg_values": {
295
+ type: "array",
296
+ items: {
297
+ type: "string"
298
+ }
299
+ },
300
+ "kb-jwt_alg_values": {
301
+ type: "array",
302
+ items: {
303
+ type: "string"
304
+ }
305
+ }
306
+ },
307
+ additionalProperties: false
308
+ },
309
+ MsoMdocObject: {
310
+ type: "object",
311
+ properties: {
312
+ alg: {
313
+ type: "array",
314
+ items: {
315
+ type: "string"
316
+ }
317
+ }
318
+ },
319
+ required: [
320
+ "alg"
321
+ ],
322
+ additionalProperties: false
323
+ },
324
+ SubmissionRequirement: {
325
+ type: "object",
326
+ properties: {
327
+ name: {
328
+ type: "string"
329
+ },
330
+ purpose: {
331
+ type: "string"
332
+ },
333
+ rule: {
334
+ $ref: "#/components/schemas/Rules"
335
+ },
336
+ count: {
337
+ type: "number"
338
+ },
339
+ min: {
340
+ type: "number"
341
+ },
342
+ max: {
343
+ type: "number"
344
+ },
345
+ from: {
346
+ type: "string"
347
+ },
348
+ from_nested: {
349
+ type: "array",
350
+ items: {
351
+ $ref: "#/components/schemas/SubmissionRequirement"
352
+ }
353
+ }
354
+ },
355
+ required: [
356
+ "rule"
357
+ ],
358
+ additionalProperties: false
359
+ },
360
+ Rules: {
361
+ type: "string",
362
+ enum: [
363
+ "all",
364
+ "pick"
365
+ ]
366
+ },
367
+ InputDescriptorV1: {
368
+ type: "object",
369
+ properties: {
370
+ id: {
371
+ type: "string"
372
+ },
373
+ name: {
374
+ type: "string"
375
+ },
376
+ purpose: {
377
+ type: "string"
378
+ },
379
+ group: {
380
+ type: "array",
381
+ items: {
382
+ type: "string"
383
+ }
384
+ },
385
+ schema: {
386
+ type: "array",
387
+ items: {
388
+ $ref: "#/components/schemas/Schema"
389
+ }
390
+ },
391
+ issuance: {
392
+ type: "array",
393
+ items: {
394
+ $ref: "#/components/schemas/Issuance"
395
+ }
396
+ },
397
+ constraints: {
398
+ $ref: "#/components/schemas/ConstraintsV1"
399
+ }
400
+ },
401
+ required: [
402
+ "id",
403
+ "schema"
404
+ ],
405
+ additionalProperties: false
406
+ },
407
+ Schema: {
408
+ type: "object",
409
+ properties: {
410
+ uri: {
411
+ type: "string"
412
+ },
413
+ required: {
414
+ type: "boolean"
415
+ }
416
+ },
417
+ required: [
418
+ "uri"
419
+ ],
420
+ additionalProperties: false
421
+ },
422
+ Issuance: {
423
+ type: "object",
424
+ properties: {
425
+ manifest: {
426
+ type: "string"
427
+ }
428
+ },
429
+ additionalProperties: {}
430
+ },
431
+ ConstraintsV1: {
432
+ type: "object",
433
+ properties: {
434
+ limit_disclosure: {
435
+ $ref: "#/components/schemas/Optionality"
436
+ },
437
+ statuses: {
438
+ $ref: "#/components/schemas/Statuses"
439
+ },
440
+ fields: {
441
+ type: "array",
442
+ items: {
443
+ $ref: "#/components/schemas/FieldV1"
444
+ }
445
+ },
446
+ subject_is_issuer: {
447
+ $ref: "#/components/schemas/Optionality"
448
+ },
449
+ is_holder: {
450
+ type: "array",
451
+ items: {
452
+ $ref: "#/components/schemas/HolderSubject"
453
+ }
454
+ },
455
+ same_subject: {
456
+ type: "array",
457
+ items: {
458
+ $ref: "#/components/schemas/HolderSubject"
459
+ }
460
+ }
461
+ },
462
+ additionalProperties: false
463
+ },
464
+ Optionality: {
465
+ type: "string",
466
+ enum: [
467
+ "required",
468
+ "preferred"
469
+ ]
470
+ },
471
+ Statuses: {
472
+ type: "object",
473
+ properties: {
474
+ active: {
475
+ $ref: "#/components/schemas/PdStatus"
476
+ },
477
+ suspended: {
478
+ $ref: "#/components/schemas/PdStatus"
479
+ },
480
+ revoked: {
481
+ $ref: "#/components/schemas/PdStatus"
482
+ }
483
+ },
484
+ additionalProperties: false
485
+ },
486
+ PdStatus: {
487
+ type: "object",
488
+ properties: {
489
+ directive: {
490
+ $ref: "#/components/schemas/Directives"
491
+ }
492
+ },
493
+ additionalProperties: false
494
+ },
495
+ Directives: {
496
+ type: "string",
497
+ enum: [
498
+ "required",
499
+ "allowed",
500
+ "disallowed"
501
+ ]
502
+ },
503
+ FieldV1: {
504
+ type: "object",
505
+ properties: {
506
+ id: {
507
+ type: "string"
508
+ },
509
+ path: {
510
+ type: "array",
511
+ items: {
512
+ type: "string"
513
+ }
514
+ },
515
+ purpose: {
516
+ type: "string"
517
+ },
518
+ filter: {
519
+ $ref: "#/components/schemas/FilterV1"
520
+ },
521
+ predicate: {
522
+ $ref: "#/components/schemas/Optionality"
523
+ }
524
+ },
525
+ required: [
526
+ "path"
527
+ ],
528
+ additionalProperties: false
529
+ },
530
+ FilterV1: {
531
+ type: "object",
532
+ properties: {
533
+ const: {
534
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
535
+ },
536
+ enum: {
537
+ type: "array",
538
+ items: {
539
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
540
+ }
541
+ },
542
+ exclusiveMinimum: {
543
+ $ref: "#/components/schemas/OneOfNumberString"
544
+ },
545
+ exclusiveMaximum: {
546
+ $ref: "#/components/schemas/OneOfNumberString"
547
+ },
548
+ format: {
549
+ type: "string"
550
+ },
551
+ minLength: {
552
+ type: "number"
553
+ },
554
+ maxLength: {
555
+ type: "number"
556
+ },
557
+ minimum: {
558
+ $ref: "#/components/schemas/OneOfNumberString"
559
+ },
560
+ maximum: {
561
+ $ref: "#/components/schemas/OneOfNumberString"
562
+ },
563
+ not: {
564
+ type: "object"
565
+ },
566
+ pattern: {
567
+ type: "string"
568
+ },
569
+ type: {
570
+ type: "string"
571
+ }
572
+ },
573
+ additionalProperties: false
574
+ },
575
+ OneOfNumberStringBoolean: {
576
+ type: [
577
+ "boolean",
578
+ "number",
579
+ "string"
580
+ ]
581
+ },
582
+ OneOfNumberString: {
583
+ type: [
584
+ "number",
585
+ "string"
586
+ ]
587
+ },
588
+ HolderSubject: {
589
+ type: "object",
590
+ properties: {
591
+ field_id: {
592
+ type: "array",
593
+ items: {
594
+ type: "string"
595
+ }
596
+ },
597
+ directive: {
598
+ $ref: "#/components/schemas/Optionality"
599
+ }
600
+ },
601
+ required: [
602
+ "field_id",
603
+ "directive"
604
+ ],
605
+ additionalProperties: false
606
+ },
607
+ PresentationDefinitionV2: {
608
+ type: "object",
609
+ properties: {
610
+ id: {
611
+ type: "string"
612
+ },
613
+ name: {
614
+ type: "string"
615
+ },
616
+ purpose: {
617
+ type: "string"
618
+ },
619
+ format: {
620
+ $ref: "#/components/schemas/Format"
621
+ },
622
+ submission_requirements: {
623
+ type: "array",
624
+ items: {
625
+ $ref: "#/components/schemas/SubmissionRequirement"
626
+ }
627
+ },
628
+ input_descriptors: {
629
+ type: "array",
630
+ items: {
631
+ $ref: "#/components/schemas/InputDescriptorV2"
632
+ }
633
+ },
634
+ frame: {
635
+ type: "object"
636
+ }
637
+ },
638
+ required: [
639
+ "id",
640
+ "input_descriptors"
641
+ ],
642
+ additionalProperties: false
643
+ },
644
+ InputDescriptorV2: {
645
+ type: "object",
646
+ properties: {
647
+ id: {
648
+ type: "string"
649
+ },
650
+ name: {
651
+ type: "string"
652
+ },
653
+ purpose: {
654
+ type: "string"
655
+ },
656
+ format: {
657
+ $ref: "#/components/schemas/Format"
658
+ },
659
+ group: {
660
+ type: "array",
661
+ items: {
662
+ type: "string"
663
+ }
664
+ },
665
+ issuance: {
666
+ type: "array",
667
+ items: {
668
+ $ref: "#/components/schemas/Issuance"
669
+ }
670
+ },
671
+ constraints: {
672
+ $ref: "#/components/schemas/ConstraintsV2"
673
+ }
674
+ },
675
+ required: [
676
+ "id",
677
+ "constraints"
678
+ ],
679
+ additionalProperties: false
680
+ },
681
+ ConstraintsV2: {
682
+ type: "object",
683
+ properties: {
684
+ limit_disclosure: {
685
+ $ref: "#/components/schemas/Optionality"
686
+ },
687
+ statuses: {
688
+ $ref: "#/components/schemas/Statuses"
689
+ },
690
+ fields: {
691
+ type: "array",
692
+ items: {
693
+ $ref: "#/components/schemas/FieldV2"
694
+ }
695
+ },
696
+ subject_is_issuer: {
697
+ $ref: "#/components/schemas/Optionality"
698
+ },
699
+ is_holder: {
700
+ type: "array",
701
+ items: {
702
+ $ref: "#/components/schemas/HolderSubject"
703
+ }
704
+ },
705
+ same_subject: {
706
+ type: "array",
707
+ items: {
708
+ $ref: "#/components/schemas/HolderSubject"
709
+ }
710
+ }
711
+ },
712
+ additionalProperties: false
713
+ },
714
+ FieldV2: {
715
+ type: "object",
716
+ properties: {
717
+ id: {
718
+ type: "string"
719
+ },
720
+ path: {
721
+ type: "array",
722
+ items: {
723
+ type: "string"
724
+ }
725
+ },
726
+ purpose: {
727
+ type: "string"
728
+ },
729
+ filter: {
730
+ $ref: "#/components/schemas/FilterV2"
731
+ },
732
+ predicate: {
733
+ $ref: "#/components/schemas/Optionality"
734
+ },
735
+ intent_to_retain: {
736
+ type: "boolean"
737
+ },
738
+ name: {
739
+ type: "string"
740
+ },
741
+ optional: {
742
+ type: "boolean"
743
+ }
744
+ },
745
+ required: [
746
+ "path"
747
+ ],
748
+ additionalProperties: false
749
+ },
750
+ FilterV2: {
751
+ type: "object",
752
+ properties: {
753
+ const: {
754
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
755
+ },
756
+ enum: {
757
+ type: "array",
758
+ items: {
759
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
760
+ }
761
+ },
762
+ exclusiveMinimum: {
763
+ $ref: "#/components/schemas/OneOfNumberString"
764
+ },
765
+ exclusiveMaximum: {
766
+ $ref: "#/components/schemas/OneOfNumberString"
767
+ },
768
+ format: {
769
+ type: "string"
770
+ },
771
+ formatMaximum: {
772
+ type: "string"
773
+ },
774
+ formatMinimum: {
775
+ type: "string"
776
+ },
777
+ formatExclusiveMaximum: {
778
+ type: "string"
779
+ },
780
+ formatExclusiveMinimum: {
781
+ type: "string"
782
+ },
783
+ minLength: {
784
+ type: "number"
785
+ },
786
+ maxLength: {
787
+ type: "number"
788
+ },
789
+ minimum: {
790
+ $ref: "#/components/schemas/OneOfNumberString"
791
+ },
792
+ maximum: {
793
+ $ref: "#/components/schemas/OneOfNumberString"
794
+ },
795
+ not: {
796
+ type: "object"
797
+ },
798
+ pattern: {
799
+ type: "string"
800
+ },
801
+ type: {
802
+ type: "string"
803
+ },
804
+ contains: {
805
+ $ref: "#/components/schemas/FilterV2"
806
+ },
807
+ items: {
808
+ $ref: "#/components/schemas/FilterV2Items"
809
+ }
810
+ },
811
+ additionalProperties: false
812
+ },
813
+ FilterV2Items: {
814
+ type: "object",
815
+ properties: {
816
+ const: {
817
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
818
+ },
819
+ enum: {
820
+ type: "array",
821
+ items: {
822
+ $ref: "#/components/schemas/OneOfNumberStringBoolean"
823
+ }
824
+ },
825
+ exclusiveMinimum: {
826
+ $ref: "#/components/schemas/OneOfNumberString"
827
+ },
828
+ exclusiveMaximum: {
829
+ $ref: "#/components/schemas/OneOfNumberString"
830
+ },
831
+ format: {
832
+ type: "string"
833
+ },
834
+ formatMaximum: {
835
+ type: "string"
836
+ },
837
+ formatMinimum: {
838
+ type: "string"
839
+ },
840
+ formatExclusiveMaximum: {
841
+ type: "string"
842
+ },
843
+ formatExclusiveMinimum: {
844
+ type: "string"
845
+ },
846
+ minLength: {
847
+ type: "number"
848
+ },
849
+ maxLength: {
850
+ type: "number"
851
+ },
852
+ minimum: {
853
+ $ref: "#/components/schemas/OneOfNumberString"
854
+ },
855
+ maximum: {
856
+ $ref: "#/components/schemas/OneOfNumberString"
857
+ },
858
+ not: {
859
+ type: "object"
860
+ },
861
+ pattern: {
862
+ type: "string"
863
+ },
864
+ type: {
865
+ type: "string"
866
+ },
867
+ contains: {
868
+ $ref: "#/components/schemas/FilterV2"
869
+ },
870
+ items: {
871
+ $ref: "#/components/schemas/FilterV2Items"
872
+ }
873
+ },
874
+ additionalProperties: false
875
+ },
876
+ DcqlQueryREST: {
877
+ type: "object",
878
+ properties: {
879
+ credentials: {
880
+ type: "array",
881
+ items: {
882
+ $ref: "#/components/schemas/DcqlCredentialQuery"
883
+ }
884
+ }
885
+ },
886
+ required: [
887
+ "credentials"
888
+ ],
889
+ additionalProperties: false
890
+ },
891
+ DcqlCredentialQuery: {
892
+ type: "object",
893
+ properties: {
894
+ id: {
895
+ type: "string"
896
+ },
897
+ format: {
898
+ type: "string"
899
+ },
900
+ alg: {
901
+ type: "array",
902
+ items: {
903
+ type: "string"
904
+ }
905
+ },
906
+ claims: {
907
+ type: "array",
908
+ items: {
909
+ $ref: "#/components/schemas/DcqlClaim"
910
+ }
911
+ },
912
+ meta: {
913
+ $ref: "#/components/schemas/Record<string,any>"
914
+ }
915
+ },
916
+ required: [
917
+ "id",
918
+ "format",
919
+ "claims"
920
+ ],
921
+ additionalProperties: false
922
+ },
923
+ DcqlClaim: {
924
+ type: "object",
925
+ properties: {
926
+ namespace: {
927
+ type: "string"
928
+ },
929
+ claim_name: {
930
+ type: "string"
931
+ },
932
+ filter: {
933
+ $ref: "#/components/schemas/DcqlFilter"
934
+ }
935
+ },
936
+ required: [
937
+ "namespace",
938
+ "claim_name"
939
+ ],
940
+ additionalProperties: false
941
+ },
942
+ DcqlFilter: {
943
+ type: "object",
944
+ properties: {
945
+ type: {
946
+ type: "string",
947
+ enum: [
948
+ "string",
949
+ "number",
950
+ "boolean"
951
+ ]
952
+ },
953
+ pattern: {
954
+ type: "string"
955
+ },
956
+ minimum: {
957
+ type: "number"
958
+ },
959
+ maximum: {
960
+ type: "number"
961
+ }
962
+ },
963
+ required: [
964
+ "type"
965
+ ],
966
+ additionalProperties: false
967
+ },
968
+ "Record<string,any>": {
969
+ type: "object"
970
+ },
971
+ HasDefinitionItemArgs: {
972
+ $ref: "#/components/schemas/GetDefinitionItemArgs"
973
+ },
974
+ HasDefinitionItemsArgs: {
975
+ $ref: "#/components/schemas/GetDefinitionItemsArgs"
976
+ },
977
+ PersistDefinitionArgs: {
978
+ type: "object",
979
+ properties: {
980
+ definitionItem: {
981
+ $ref: "#/components/schemas/PersistPresentationDefinitionItem"
982
+ },
983
+ opts: {
984
+ $ref: "#/components/schemas/PersistOptions"
985
+ }
986
+ },
987
+ required: [
988
+ "definitionItem"
989
+ ],
990
+ additionalProperties: false
991
+ },
992
+ PersistPresentationDefinitionItem: {
993
+ type: "object",
994
+ additionalProperties: false,
995
+ properties: {
996
+ id: {
997
+ type: "string"
998
+ },
999
+ definitionId: {
1000
+ type: "string"
1001
+ },
1002
+ version: {
1003
+ type: "string"
1004
+ },
1005
+ tenantId: {
1006
+ type: "string"
1007
+ },
1008
+ name: {
1009
+ type: "string"
1010
+ },
1011
+ purpose: {
1012
+ type: "string"
1013
+ },
1014
+ definitionPayload: {
1015
+ $ref: "#/components/schemas/IPresentationDefinition"
1016
+ },
1017
+ dcqlPayload: {
1018
+ $ref: "#/components/schemas/DcqlQueryREST"
1019
+ }
1020
+ },
1021
+ required: [
1022
+ "definitionPayload"
1023
+ ]
1024
+ },
1025
+ PersistOptions: {
1026
+ type: "object",
1027
+ properties: {
1028
+ versionControlMode: {
1029
+ $ref: "#/components/schemas/VersionControlMode"
1030
+ },
1031
+ versionIncrementReleaseType: {
1032
+ $ref: "#/components/schemas/ReleaseType"
1033
+ }
1034
+ },
1035
+ additionalProperties: false
1036
+ },
1037
+ VersionControlMode: {
1038
+ type: "string",
1039
+ enum: [
1040
+ "AutoIncrement",
1041
+ "Manual",
1042
+ "Overwrite",
1043
+ "OverwriteLatest"
1044
+ ]
1045
+ },
1046
+ ReleaseType: {
1047
+ type: "string",
1048
+ enum: [
1049
+ "major",
1050
+ "premajor",
1051
+ "minor",
1052
+ "preminor",
1053
+ "patch",
1054
+ "prepatch",
1055
+ "prerelease",
1056
+ "release"
1057
+ ]
1058
+ }
1059
+ },
1060
+ methods: {
1061
+ pdmDeleteDefinition: {
1062
+ description: "Delete a single presentation definition records by primary key",
1063
+ arguments: {
1064
+ $ref: "#/components/schemas/DeleteDefinitionItemArgs"
1065
+ },
1066
+ returnType: {
1067
+ type: "boolean"
1068
+ }
1069
+ },
1070
+ pdmDeleteDefinitions: {
1071
+ description: "Delete multiple presentation definitions records using filters",
1072
+ arguments: {
1073
+ $ref: "#/components/schemas/DeleteDefinitionItemsArgs"
1074
+ },
1075
+ returnType: {
1076
+ type: "number"
1077
+ }
1078
+ },
1079
+ pdmGetDefinition: {
1080
+ description: "Get a single presentation definition records by primary key",
1081
+ arguments: {
1082
+ $ref: "#/components/schemas/GetDefinitionItemArgs"
1083
+ },
1084
+ returnType: {
1085
+ $ref: "#/components/schemas/PresentationDefinitionItem"
1086
+ }
1087
+ },
1088
+ pdmGetDefinitions: {
1089
+ description: "Find one or more presentation definition records using filters",
1090
+ arguments: {
1091
+ $ref: "#/components/schemas/GetDefinitionItemsArgs"
1092
+ },
1093
+ returnType: {
1094
+ type: "array",
1095
+ items: {
1096
+ $ref: "#/components/schemas/PresentationDefinitionItem"
1097
+ }
1098
+ }
1099
+ },
1100
+ pdmHasDefinition: {
1101
+ description: "Checks whether a presentation definition record exists by primary key",
1102
+ arguments: {
1103
+ $ref: "#/components/schemas/HasDefinitionItemArgs"
1104
+ },
1105
+ returnType: {
1106
+ type: "boolean"
1107
+ }
1108
+ },
1109
+ pdmHasDefinitions: {
1110
+ description: "Checks whether one or more presentation definition records exist using filters",
1111
+ arguments: {
1112
+ $ref: "#/components/schemas/HasDefinitionItemsArgs"
1113
+ },
1114
+ returnType: {
1115
+ type: "boolean"
1116
+ }
1117
+ },
1118
+ pdmPersistDefinition: {
1119
+ description: "Check in a presentation definition. It has version control logic which will add or update presentation definition records and has settings for automatic version numbering.",
1120
+ arguments: {
1121
+ $ref: "#/components/schemas/PersistDefinitionArgs"
1122
+ },
1123
+ returnType: {
1124
+ $ref: "#/components/schemas/PresentationDefinitionItem"
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ }
1130
+ };
1131
+ }
1132
+ });
1133
+
1134
+ // src/agent/PDManager.ts
1135
+ import { isPresentationDefinitionEqual } from "@sphereon/ssi-sdk.data-store";
1136
+ import semver from "semver/preload";
1137
+ var pdManagerMethods = [
1138
+ "pdmHasDefinition",
1139
+ "pdmHasGetDefinitions",
1140
+ "pdmGetDefinition",
1141
+ "pdmGetDefinitions",
1142
+ "pdmPersistDefinition",
1143
+ "pdmDeleteDefinition",
1144
+ "pdmDeleteDefinitions"
1145
+ ];
1146
+ var PDManager = class {
1147
+ static {
1148
+ __name(this, "PDManager");
1149
+ }
1150
+ schema = schema.IPDManager;
1151
+ methods = {
1152
+ pdmPersistDefinition: this.pdmPersistDefinition.bind(this),
1153
+ pdmHasDefinition: this.pdmHasDefinition.bind(this),
1154
+ pdmHasDefinitions: this.pdmHasDefinitions.bind(this),
1155
+ pdmGetDefinition: this.pdmGetDefinition.bind(this),
1156
+ pdmGetDefinitions: this.pdmGetDefinitions.bind(this),
1157
+ pdmDeleteDefinition: this.pdmDeleteDefinition.bind(this),
1158
+ pdmDeleteDefinitions: this.pdmDeleteDefinitions.bind(this)
1159
+ };
1160
+ store;
1161
+ constructor(options) {
1162
+ this.store = options.store;
1163
+ }
1164
+ /** {@inheritDoc IPDManager.pdmHasDefinition} */
1165
+ async pdmHasDefinition(args) {
1166
+ const { itemId } = args;
1167
+ return this.store.hasDefinition({
1168
+ itemId
1169
+ });
1170
+ }
1171
+ /** {@inheritDoc IPDManager.pdmHasDefinitions} */
1172
+ async pdmHasDefinitions(args) {
1173
+ const { filter } = args;
1174
+ return this.store.hasDefinitions({
1175
+ filter
1176
+ });
1177
+ }
1178
+ /** {@inheritDoc IPDManager.pdmGetDefinition} */
1179
+ async pdmGetDefinition(args) {
1180
+ const { itemId } = args;
1181
+ return this.store.getDefinition({
1182
+ itemId
1183
+ });
1184
+ }
1185
+ /** {@inheritDoc IPDManager.pdmGetDefinitions} */
1186
+ async pdmGetDefinitions(args) {
1187
+ const { filter, opts } = args;
1188
+ const allDefinitions = await this.store.getDefinitions({
1189
+ filter
1190
+ });
1191
+ let definitions = [];
1192
+ if (opts == void 0 || opts.showVersionHistory !== true) {
1193
+ const groupedByDefinitionId = allDefinitions.reduce((acc, entity) => {
1194
+ if (!acc[entity.definitionId]) {
1195
+ acc[entity.definitionId] = [];
1196
+ }
1197
+ acc[entity.definitionId].push(entity);
1198
+ return acc;
1199
+ }, {});
1200
+ definitions = Object.values(groupedByDefinitionId).map((entities) => entities.reduce((highestVersionItem, baseItem) => {
1201
+ const baseVersion = this.normalizeToSemverVersionFormat(baseItem.version);
1202
+ const highestVersion = this.normalizeToSemverVersionFormat(highestVersionItem.version);
1203
+ return semver.gt(baseVersion, highestVersion) ? baseItem : highestVersionItem;
1204
+ }));
1205
+ } else {
1206
+ definitions = allDefinitions;
1207
+ }
1208
+ return definitions;
1209
+ }
1210
+ /** {@inheritDoc IPDManager.pdmDeleteDefinition} */
1211
+ async pdmDeleteDefinition(args) {
1212
+ return this.store.deleteDefinition(args).then((value) => true);
1213
+ }
1214
+ /** {@inheritDoc IPDManager.pdmDeleteDefinitions} */
1215
+ async pdmDeleteDefinitions(args) {
1216
+ return this.store.deleteDefinitions(args);
1217
+ }
1218
+ /** {@inheritDoc IPDManager.pdmPersistDefinition} */
1219
+ async pdmPersistDefinition(args) {
1220
+ const { definitionItem, opts } = args;
1221
+ const { versionControlMode, versionIncrementReleaseType } = opts ?? {
1222
+ versionControlMode: "AutoIncrement"
1223
+ };
1224
+ const { version, tenantId } = definitionItem;
1225
+ const definitionId = definitionItem.definitionId ?? definitionItem.definitionPayload.id;
1226
+ let { id } = definitionItem;
1227
+ if (id !== void 0 && versionControlMode !== "Overwrite") {
1228
+ id = void 0;
1229
+ }
1230
+ const nonPersistedDefinitionItem = {
1231
+ ...definitionItem,
1232
+ definitionId,
1233
+ version: version ?? "1"
1234
+ };
1235
+ const existing = await this.store.getDefinitions({
1236
+ filter: [
1237
+ {
1238
+ id,
1239
+ definitionId,
1240
+ tenantId,
1241
+ version
1242
+ }
1243
+ ]
1244
+ });
1245
+ const existingItem = existing[0];
1246
+ const allDefinitions = await this.store.getDefinitions({
1247
+ filter: [
1248
+ {
1249
+ definitionId,
1250
+ tenantId
1251
+ }
1252
+ ]
1253
+ });
1254
+ allDefinitions.sort((a, b) => semver.compare(this.normalizeToSemverVersionFormat(a.version), this.normalizeToSemverVersionFormat(b.version)));
1255
+ const trulyLatestVersionItem = allDefinitions[allDefinitions.length - 1];
1256
+ let latestVersionItem = trulyLatestVersionItem;
1257
+ if (existingItem && version) {
1258
+ latestVersionItem = trulyLatestVersionItem ?? existingItem;
1259
+ }
1260
+ const isPayloadModified = !existingItem || !isPresentationDefinitionEqual(existingItem, definitionItem);
1261
+ if (!isPayloadModified) return existingItem;
1262
+ switch (versionControlMode) {
1263
+ case "Overwrite":
1264
+ return this.handleOverwriteMode(existingItem, nonPersistedDefinitionItem, version);
1265
+ case "OverwriteLatest":
1266
+ return this.handleOverwriteLatestMode(latestVersionItem, nonPersistedDefinitionItem);
1267
+ case "Manual":
1268
+ return this.handleManualMode(existingItem, nonPersistedDefinitionItem, tenantId, version);
1269
+ case "AutoIncrement":
1270
+ return this.handleAutoIncrementMode(latestVersionItem, nonPersistedDefinitionItem, versionIncrementReleaseType ?? "major");
1271
+ default:
1272
+ throw new Error(`Unknown version control mode: ${versionControlMode}`);
1273
+ }
1274
+ }
1275
+ async handleOverwriteMode(existingItem, definitionItem, version) {
1276
+ if (existingItem) {
1277
+ existingItem.definitionId = definitionItem.definitionId;
1278
+ existingItem.version = version ?? existingItem.version ?? "1";
1279
+ existingItem.tenantId = definitionItem.tenantId;
1280
+ existingItem.name = definitionItem.definitionPayload.name ?? definitionItem.name;
1281
+ existingItem.purpose = definitionItem.definitionPayload.purpose ?? definitionItem.purpose;
1282
+ existingItem.definitionPayload = definitionItem.definitionPayload;
1283
+ return await this.store.updateDefinition(existingItem);
1284
+ } else {
1285
+ return await this.store.addDefinition(definitionItem);
1286
+ }
1287
+ }
1288
+ async handleOverwriteLatestMode(latestVersionItem, definitionItem) {
1289
+ if (latestVersionItem) {
1290
+ latestVersionItem.definitionId = definitionItem.definitionId;
1291
+ latestVersionItem.tenantId = definitionItem.tenantId;
1292
+ latestVersionItem.name = definitionItem.name;
1293
+ latestVersionItem.purpose = definitionItem.purpose;
1294
+ latestVersionItem.definitionPayload = definitionItem.definitionPayload;
1295
+ return await this.store.updateDefinition(latestVersionItem);
1296
+ } else {
1297
+ return await this.store.addDefinition(definitionItem);
1298
+ }
1299
+ }
1300
+ async handleManualMode(existingItem, definitionItem, tenantId, version) {
1301
+ if (existingItem && !isPresentationDefinitionEqual(existingItem, definitionItem)) {
1302
+ throw Error(`Cannot update definition ${definitionItem.definitionId} for tenant ${tenantId} version ${version} because definition exists and manual version control is enabled.`);
1303
+ } else {
1304
+ return await this.store.addDefinition(definitionItem);
1305
+ }
1306
+ }
1307
+ async handleAutoIncrementMode(latestVersionItem, definitionItem, releaseType) {
1308
+ const defaultVersion = "1";
1309
+ let currentVersion = latestVersionItem?.version ?? definitionItem.version ?? defaultVersion;
1310
+ let resultVersion;
1311
+ if (!latestVersionItem) {
1312
+ resultVersion = currentVersion;
1313
+ } else {
1314
+ let [baseVersion, preReleaseSuffix] = currentVersion.split(/-(.+)/);
1315
+ let normalizedBaseVersion = semver.coerce(baseVersion)?.version ?? `${defaultVersion}.0.0`;
1316
+ let preReleaseIdentifier = preReleaseSuffix ? preReleaseSuffix.match(/^[a-zA-Z]+/)?.[0] : void 0;
1317
+ let fullVersionToIncrement = preReleaseIdentifier ? `${normalizedBaseVersion}-${preReleaseSuffix}` : normalizedBaseVersion;
1318
+ let incrementedVersion = semver.inc(fullVersionToIncrement, releaseType, preReleaseIdentifier);
1319
+ if (!incrementedVersion) {
1320
+ throw new Error(`Could not increment ${releaseType} version on ${currentVersion} ${preReleaseSuffix}`);
1321
+ }
1322
+ let [incrementedBaseVersion, incrementedSuffix] = incrementedVersion.split(/-(.+)/);
1323
+ let originalParts = baseVersion.split(".");
1324
+ let newParts = incrementedBaseVersion.split(".");
1325
+ while (newParts.length > originalParts.length) {
1326
+ newParts.pop();
1327
+ }
1328
+ resultVersion = newParts.join(".");
1329
+ if (incrementedSuffix) {
1330
+ resultVersion += `-${incrementedSuffix}`;
1331
+ }
1332
+ }
1333
+ definitionItem.version = resultVersion;
1334
+ return await this.store.addDefinition(definitionItem);
1335
+ }
1336
+ normalizeToSemverVersionFormat(version) {
1337
+ const defaultVersion = "1.0.0";
1338
+ let [baseVersion, preReleaseSuffix] = version.split(/-(.+)/);
1339
+ let normalizedBaseVersion = semver.coerce(baseVersion)?.version ?? defaultVersion;
1340
+ if (preReleaseSuffix) {
1341
+ normalizedBaseVersion += `-${preReleaseSuffix}`;
1342
+ }
1343
+ return normalizedBaseVersion;
1344
+ }
1345
+ };
1346
+
1347
+ // src/index.ts
1348
+ import { ReleaseType } from "semver";
1349
+ var schema = require_plugin_schema();
1350
+ export {
1351
+ PDManager,
1352
+ ReleaseType,
1353
+ pdManagerMethods,
1354
+ schema
15
1355
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.pdManagerMethods = exports.PDManager = exports.schema = void 0;
18
- /**
19
- * @public
20
- */
21
- const schema = require('../plugin.schema.json');
22
- exports.schema = schema;
23
- var PDManager_1 = require("./agent/PDManager");
24
- Object.defineProperty(exports, "PDManager", { enumerable: true, get: function () { return PDManager_1.PDManager; } });
25
- Object.defineProperty(exports, "pdManagerMethods", { enumerable: true, get: function () { return PDManager_1.pdManagerMethods; } });
26
- __exportStar(require("./types/IPDManager"), exports);
27
1356
  //# sourceMappingURL=index.js.map