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