@sphereon/ssi-sdk.pd-manager 0.33.0 → 0.33.1-feature.jose.vcdm.56

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