@sphereon/ssi-sdk.pd-manager 0.33.1-next.3 → 0.33.1-next.68

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