@sphereon/ssi-sdk.pd-manager 0.33.1-feature.vcdm2.tsup.32 → 0.33.1-next.2

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