@truvity/sdk 0.28.9 → 0.30.7

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.
Files changed (142) hide show
  1. package/api/resources/apiKeys/client/Client.js +9 -9
  2. package/api/resources/apiKeys/client/Client.js.map +1 -1
  3. package/api/resources/credentials/client/Client.js +12 -12
  4. package/api/resources/credentials/client/Client.js.map +1 -1
  5. package/api/resources/desk/client/Client.js +2 -2
  6. package/api/resources/desk/client/Client.js.map +1 -1
  7. package/api/resources/didcommMessages/client/Client.js +9 -9
  8. package/api/resources/didcommMessages/client/Client.js.map +1 -1
  9. package/api/resources/dids/client/Client.js +1 -1
  10. package/api/resources/dids/client/Client.js.map +1 -1
  11. package/api/resources/drafts/client/Client.js +12 -12
  12. package/api/resources/drafts/client/Client.js.map +1 -1
  13. package/api/resources/files/client/Client.js +12 -12
  14. package/api/resources/files/client/Client.js.map +1 -1
  15. package/api/resources/gdpr/client/Client.js +1 -1
  16. package/api/resources/gdpr/client/Client.js.map +1 -1
  17. package/api/resources/keys/client/Client.js +13 -13
  18. package/api/resources/keys/client/Client.js.map +1 -1
  19. package/api/resources/presentations/client/Client.js +14 -14
  20. package/api/resources/presentations/client/Client.js.map +1 -1
  21. package/api/types/Credential.d.ts +1 -1
  22. package/api/types/Credential.d.ts.map +1 -1
  23. package/api/types/Credential.js.map +1 -1
  24. package/api/types/File_.d.ts +1 -1
  25. package/api/types/File_.d.ts.map +1 -1
  26. package/api/types/File_.js.map +1 -1
  27. package/api/types/Presentation.d.ts +1 -1
  28. package/api/types/Presentation.d.ts.map +1 -1
  29. package/api/types/Presentation.js.map +1 -1
  30. package/documents/credential/claims.d.ts +29 -0
  31. package/documents/credential/claims.d.ts.map +1 -0
  32. package/documents/credential/claims.js +228 -0
  33. package/documents/credential/claims.js.map +1 -0
  34. package/documents/credential/claims.spec.d.ts +2 -0
  35. package/documents/credential/claims.spec.d.ts.map +1 -0
  36. package/documents/credential/{document.spec.js → claims.spec.js} +77 -129
  37. package/documents/credential/claims.spec.js.map +1 -0
  38. package/documents/credential/document/vcdm.d.ts +50 -0
  39. package/documents/credential/document/vcdm.d.ts.map +1 -0
  40. package/documents/credential/document/vcdm.js +76 -0
  41. package/documents/credential/document/vcdm.js.map +1 -0
  42. package/documents/credential/document.d.ts +6 -24
  43. package/documents/credential/document.d.ts.map +1 -1
  44. package/documents/credential/document.js +15 -137
  45. package/documents/credential/document.js.map +1 -1
  46. package/documents/credential/draft.d.ts +7 -5
  47. package/documents/credential/draft.d.ts.map +1 -1
  48. package/documents/credential/draft.js +15 -14
  49. package/documents/credential/draft.js.map +1 -1
  50. package/documents/credential/flavor/vcdm1_1.d.ts +76 -0
  51. package/documents/credential/flavor/vcdm1_1.d.ts.map +1 -0
  52. package/documents/credential/flavor/vcdm1_1.js +148 -0
  53. package/documents/credential/flavor/vcdm1_1.js.map +1 -0
  54. package/documents/credential/flavor/vcdm2_0.d.ts +83 -0
  55. package/documents/credential/flavor/vcdm2_0.d.ts.map +1 -0
  56. package/documents/credential/flavor/vcdm2_0.js +76 -0
  57. package/documents/credential/flavor/vcdm2_0.js.map +1 -0
  58. package/documents/credential/flavor.d.ts +8 -32
  59. package/documents/credential/flavor.d.ts.map +1 -1
  60. package/documents/credential/flavor.js +22 -99
  61. package/documents/credential/flavor.js.map +1 -1
  62. package/documents/credential/flavor.spec.js +31 -102
  63. package/documents/credential/flavor.spec.js.map +1 -1
  64. package/documents/credential/testdata/udt.d.ts +53 -0
  65. package/documents/credential/testdata/udt.d.ts.map +1 -0
  66. package/documents/credential/testdata/udt.js +243 -0
  67. package/documents/credential/testdata/udt.js.map +1 -0
  68. package/documents/credential/types.d.ts +39 -0
  69. package/documents/credential/types.d.ts.map +1 -0
  70. package/documents/credential/types.js +3 -0
  71. package/documents/credential/types.js.map +1 -0
  72. package/documents/credential/unknown.d.ts +5 -5
  73. package/documents/credential/unknown.d.ts.map +1 -1
  74. package/documents/credential/unknown.js +3 -4
  75. package/documents/credential/unknown.js.map +1 -1
  76. package/documents/credential/unknown.spec.js +12 -9
  77. package/documents/credential/unknown.spec.js.map +1 -1
  78. package/documents/credential/{baseVerifiableCredential.d.ts → verifiable.d.ts} +8 -5
  79. package/documents/credential/verifiable.d.ts.map +1 -0
  80. package/documents/credential/{baseVerifiableCredential.js → verifiable.js} +11 -7
  81. package/documents/credential/verifiable.js.map +1 -0
  82. package/documents/credential/with-claims.d.ts +15 -0
  83. package/documents/credential/with-claims.d.ts.map +1 -0
  84. package/documents/credential/{issued.js → with-claims.js} +12 -12
  85. package/documents/credential/with-claims.js.map +1 -0
  86. package/documents/credential.d.ts +13 -15
  87. package/documents/credential.d.ts.map +1 -1
  88. package/documents/credential.js +21 -102
  89. package/documents/credential.js.map +1 -1
  90. package/documents/index.d.ts +1 -0
  91. package/documents/index.d.ts.map +1 -1
  92. package/documents/index.js +1 -0
  93. package/documents/index.js.map +1 -1
  94. package/documents/models.d.ts +13 -13
  95. package/documents/models.d.ts.map +1 -1
  96. package/documents/models.js +4 -4
  97. package/documents/models.js.map +1 -1
  98. package/documents/presentation/issued.d.ts +1 -1
  99. package/documents/presentation/issued.d.ts.map +1 -1
  100. package/documents/presentation/issued.js +2 -2
  101. package/documents/presentation/issued.js.map +1 -1
  102. package/documents/presentation.d.ts +5 -5
  103. package/documents/presentation.d.ts.map +1 -1
  104. package/documents/presentation.js +4 -4
  105. package/documents/presentation.js.map +1 -1
  106. package/documents/types.d.ts +12 -32
  107. package/documents/types.d.ts.map +1 -1
  108. package/documents/types.js +25 -1
  109. package/documents/types.js.map +1 -1
  110. package/documents/utils/converters.d.ts +1 -1
  111. package/documents/utils/converters.d.ts.map +1 -1
  112. package/documents/utils/converters.js +1 -1
  113. package/documents/utils/converters.js.map +1 -1
  114. package/documents/utils/idempotency.d.ts +2 -0
  115. package/documents/utils/idempotency.d.ts.map +1 -0
  116. package/documents/utils/idempotency.js +9 -0
  117. package/documents/utils/idempotency.js.map +1 -0
  118. package/documents/utils/stream.d.ts +1 -0
  119. package/documents/utils/stream.d.ts.map +1 -1
  120. package/documents/utils/stream.js +3 -2
  121. package/documents/utils/stream.js.map +1 -1
  122. package/package.json +1 -1
  123. package/documents/credential/baseVerifiableCredential.d.ts.map +0 -1
  124. package/documents/credential/baseVerifiableCredential.js.map +0 -1
  125. package/documents/credential/document.spec.d.ts +0 -7
  126. package/documents/credential/document.spec.d.ts.map +0 -1
  127. package/documents/credential/document.spec.js.map +0 -1
  128. package/documents/credential/issued.d.ts +0 -13
  129. package/documents/credential/issued.d.ts.map +0 -1
  130. package/documents/credential/issued.js.map +0 -1
  131. package/documents/credential.spec.d.ts +0 -8
  132. package/documents/credential.spec.d.ts.map +0 -1
  133. package/documents/credential.spec.js +0 -246
  134. package/documents/credential.spec.js.map +0 -1
  135. package/documents/guards.d.ts +0 -6
  136. package/documents/guards.d.ts.map +0 -1
  137. package/documents/guards.js +0 -32
  138. package/documents/guards.js.map +0 -1
  139. package/documents/helpers.d.ts +0 -2
  140. package/documents/helpers.d.ts.map +0 -1
  141. package/documents/helpers.js +0 -9
  142. package/documents/helpers.js.map +0 -1
@@ -1,246 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.TestVcDecorator = void 0;
22
- const credential_1 = require("./credential");
23
- const decorators_1 = require("./decorators");
24
- const models_1 = require("./models");
25
- const NAMESPACE = 'https://docs.truvity.com/vocab';
26
- let Foo = class Foo {
27
- };
28
- __decorate([
29
- decorators_1.VcNotEmptyClaim,
30
- __metadata("design:type", String)
31
- ], Foo.prototype, "foo", void 0);
32
- Foo = __decorate([
33
- (0, decorators_1.VcContext)({ name: 'Foo', namespace: NAMESPACE })
34
- ], Foo);
35
- let Bar = class Bar {
36
- };
37
- __decorate([
38
- decorators_1.VcNotEmptyClaim,
39
- __metadata("design:type", String)
40
- ], Bar.prototype, "bar", void 0);
41
- Bar = __decorate([
42
- (0, decorators_1.VcContext)({ name: 'Bar', namespace: NAMESPACE })
43
- ], Bar);
44
- let Baz = class Baz {
45
- };
46
- __decorate([
47
- decorators_1.VcNotEmptyClaim,
48
- decorators_1.VcLinkedCredentialClaim,
49
- __metadata("design:type", models_1.LinkedCredential)
50
- ], Baz.prototype, "field1_1", void 0);
51
- __decorate([
52
- decorators_1.VcLinkedCredentialClaim,
53
- decorators_1.VcNotEmptyClaim,
54
- __metadata("design:type", models_1.LinkedCredential)
55
- ], Baz.prototype, "field1_2", void 0);
56
- __decorate([
57
- decorators_1.VcClaim,
58
- decorators_1.VcLinkedCredentialClaim,
59
- __metadata("design:type", models_1.LinkedCredential)
60
- ], Baz.prototype, "field1_3", void 0);
61
- __decorate([
62
- decorators_1.VcLinkedCredentialClaim,
63
- decorators_1.VcClaim,
64
- __metadata("design:type", models_1.LinkedCredential)
65
- ], Baz.prototype, "field1_4", void 0);
66
- __decorate([
67
- decorators_1.VcLinkedFileClaim,
68
- decorators_1.VcNotEmptyClaim,
69
- __metadata("design:type", models_1.LinkedFile)
70
- ], Baz.prototype, "field2_1", void 0);
71
- __decorate([
72
- decorators_1.VcNotEmptyClaim,
73
- decorators_1.VcLinkedFileClaim,
74
- __metadata("design:type", models_1.LinkedFile)
75
- ], Baz.prototype, "field2_2", void 0);
76
- __decorate([
77
- (0, decorators_1.VcStringEnumClaim)([
78
- { value: 'option1', title: 'Option 1' },
79
- { value: 'option2', title: 'Option 2' },
80
- ]),
81
- decorators_1.VcNotEmptyClaim,
82
- __metadata("design:type", String)
83
- ], Baz.prototype, "field3_1", void 0);
84
- __decorate([
85
- decorators_1.VcNotEmptyClaim,
86
- (0, decorators_1.VcStringEnumClaim)([
87
- { value: 'option1', title: 'Option 1' },
88
- { value: 'option2', title: 'Option 2' },
89
- ]),
90
- __metadata("design:type", String)
91
- ], Baz.prototype, "field3_2", void 0);
92
- __decorate([
93
- (0, decorators_1.VcArrayClaim)(Number),
94
- decorators_1.VcNotEmptyClaim,
95
- __metadata("design:type", Array)
96
- ], Baz.prototype, "field4_1", void 0);
97
- __decorate([
98
- decorators_1.VcNotEmptyClaim,
99
- (0, decorators_1.VcArrayClaim)(Number),
100
- __metadata("design:type", Array)
101
- ], Baz.prototype, "field4_2", void 0);
102
- __decorate([
103
- decorators_1.VcNotEmptyClaim,
104
- (0, decorators_1.VcClaimTitle)('Field title'),
105
- __metadata("design:type", Number)
106
- ], Baz.prototype, "field5_1", void 0);
107
- __decorate([
108
- (0, decorators_1.VcClaimTitle)('Field title'),
109
- decorators_1.VcNotEmptyClaim,
110
- __metadata("design:type", Number)
111
- ], Baz.prototype, "field5_2", void 0);
112
- __decorate([
113
- decorators_1.VcClaim,
114
- decorators_1.VcNotEmptyClaim,
115
- __metadata("design:type", Number)
116
- ], Baz.prototype, "field6_1", void 0);
117
- __decorate([
118
- decorators_1.VcNotEmptyClaim,
119
- decorators_1.VcClaim,
120
- __metadata("design:type", Number)
121
- ], Baz.prototype, "field6_2", void 0);
122
- __decorate([
123
- (0, decorators_1.VcArrayClaim)(models_1.Rfc3339DateTime),
124
- decorators_1.VcNotEmptyClaim,
125
- __metadata("design:type", Array)
126
- ], Baz.prototype, "field7_1", void 0);
127
- __decorate([
128
- decorators_1.VcNotEmptyClaim,
129
- (0, decorators_1.VcArrayClaim)(models_1.Rfc3339DateTime),
130
- __metadata("design:type", Array)
131
- ], Baz.prototype, "field7_2", void 0);
132
- __decorate([
133
- (0, decorators_1.VcArrayClaim)(models_1.Rfc3339Date),
134
- decorators_1.VcNotEmptyClaim,
135
- __metadata("design:type", Array)
136
- ], Baz.prototype, "field8_1", void 0);
137
- __decorate([
138
- decorators_1.VcNotEmptyClaim,
139
- (0, decorators_1.VcArrayClaim)(models_1.Rfc3339Date),
140
- __metadata("design:type", Array)
141
- ], Baz.prototype, "field8_2", void 0);
142
- __decorate([
143
- decorators_1.VcNotEmptyClaim,
144
- __metadata("design:type", Bar)
145
- ], Baz.prototype, "field9", void 0);
146
- __decorate([
147
- (0, decorators_1.VcArrayClaim)(Bar),
148
- (0, decorators_1.VcClaimTitle)('Field 10'),
149
- __metadata("design:type", Array)
150
- ], Baz.prototype, "field10", void 0);
151
- __decorate([
152
- (0, decorators_1.VcArrayClaim)(String),
153
- __metadata("design:type", Array)
154
- ], Baz.prototype, "field11_1", void 0);
155
- __decorate([
156
- (0, decorators_1.VcArrayClaim)(String),
157
- decorators_1.VcClaim,
158
- __metadata("design:type", Array)
159
- ], Baz.prototype, "field11_2", void 0);
160
- __decorate([
161
- decorators_1.VcClaim,
162
- (0, decorators_1.VcArrayClaim)(String),
163
- __metadata("design:type", Array)
164
- ], Baz.prototype, "field11_3", void 0);
165
- Baz = __decorate([
166
- (0, decorators_1.VcContext)({ name: 'Baz', namespace: NAMESPACE, vcType: ['BazCredential'] })
167
- ], Baz);
168
- const createDummyApiClient = () => ({});
169
- class TestVcDecorator extends credential_1.VcDecorator {
170
- constructor(model) {
171
- super(createDummyApiClient(), model);
172
- this.model = model;
173
- }
174
- getDraftSchema() {
175
- return super.getDraftSchema();
176
- }
177
- }
178
- exports.TestVcDecorator = TestVcDecorator;
179
- describe('Credential', () => {
180
- it('should map registered claims to api', () => __awaiter(void 0, void 0, void 0, function* () {
181
- const vcDecorator = new TestVcDecorator(Baz);
182
- const mappedClaims = vcDecorator.getDraftSchema();
183
- expect(mappedClaims).toEqual({
184
- fields: [
185
- { name: 'field1_1', kind: 'LINK', notEmpty: true },
186
- { name: 'field1_2', kind: 'LINK', notEmpty: true },
187
- { name: 'field1_3', kind: 'LINK' },
188
- { name: 'field1_4', kind: 'LINK' },
189
- { name: 'field2_1', notEmpty: true, kind: 'FILE' },
190
- { name: 'field2_2', notEmpty: true, kind: 'FILE' },
191
- {
192
- name: 'field3_1',
193
- notEmpty: true,
194
- kind: 'STRING',
195
- enum: [
196
- { value: 'option1', title: 'Option 1' },
197
- { value: 'option2', title: 'Option 2' },
198
- ],
199
- },
200
- {
201
- name: 'field3_2',
202
- notEmpty: true,
203
- kind: 'STRING',
204
- enum: [
205
- { value: 'option1', title: 'Option 1' },
206
- { value: 'option2', title: 'Option 2' },
207
- ],
208
- },
209
- { name: 'field4_1', kind: 'NUMBER', notEmpty: true, isArray: true },
210
- { name: 'field4_2', kind: 'NUMBER', notEmpty: true, isArray: true },
211
- { name: 'field5_1', kind: 'NUMBER', notEmpty: true, title: 'Field title' },
212
- { name: 'field5_2', kind: 'NUMBER', notEmpty: true, title: 'Field title' },
213
- { name: 'field6_1', kind: 'NUMBER', notEmpty: true },
214
- { name: 'field6_2', kind: 'NUMBER', notEmpty: true },
215
- { name: 'field7_1', kind: 'DATETIME', notEmpty: true, isArray: true },
216
- { name: 'field7_2', kind: 'DATETIME', notEmpty: true, isArray: true },
217
- { name: 'field8_1', kind: 'DATE', notEmpty: true, isArray: true },
218
- { name: 'field8_2', kind: 'DATE', notEmpty: true, isArray: true },
219
- {
220
- name: 'field9',
221
- notEmpty: true,
222
- kind: 'STRUCT',
223
- fields: [{ name: 'bar', notEmpty: true, kind: 'STRING' }],
224
- vocabNamespace: 'https://docs.truvity.com/vocab',
225
- vocabName: 'Bar',
226
- },
227
- {
228
- name: 'field10',
229
- title: 'Field 10',
230
- isArray: true,
231
- kind: 'STRUCT',
232
- fields: [{ name: 'bar', notEmpty: true, kind: 'STRING' }],
233
- vocabNamespace: 'https://docs.truvity.com/vocab',
234
- vocabName: 'Bar',
235
- },
236
- { name: 'field11_1', kind: 'STRING', isArray: true },
237
- { name: 'field11_2', kind: 'STRING', isArray: true },
238
- { name: 'field11_3', kind: 'STRING', isArray: true },
239
- ],
240
- vocabNamespace: 'https://docs.truvity.com/vocab',
241
- vocabName: 'Baz',
242
- vcType: ['BazCredential'],
243
- });
244
- }));
245
- });
246
- //# sourceMappingURL=credential.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential.spec.js","sourceRoot":"","sources":["../../src/documents/credential.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2C;AAC3C,6CASsB;AACtB,qCAAsF;AAGtF,MAAM,SAAS,GAAG,gCAAgC,CAAC;AAGnD,IAAM,GAAG,GAAT,MAAM,GAAG;CAGR,CAAA;AADG;IADC,4BAAe;;gCACH;AAFX,GAAG;IADR,IAAA,sBAAS,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;GAC3C,GAAG,CAGR;AAGD,IAAM,GAAG,GAAT,MAAM,GAAG;CAGR,CAAA;AADG;IADC,4BAAe;;gCACH;AAFX,GAAG;IADR,IAAA,sBAAS,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;GAC3C,GAAG,CAGR;AAGD,IAAM,GAAG,GAAT,MAAM,GAAG;CAgGR,CAAA;AA7FG;IAFC,4BAAe;IACf,oCAAuB;8BACb,yBAAgB;qCAAM;A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I,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;gBACpD,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;aACvD;YACD,cAAc,EAAE,gCAAgC;YAChD,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,CAAC,eAAe,CAAC;SAC5B,CAAC,CAAC;IACP,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { VcDecorator } from './credential';\nimport {\n VcContext,\n VcStringEnumClaim,\n VcLinkedCredentialClaim,\n VcLinkedFileClaim,\n VcNotEmptyClaim,\n VcArrayClaim,\n VcClaimTitle,\n VcClaim,\n} from './decorators';\nimport { Rfc3339Date, LinkedCredential, LinkedFile, Rfc3339DateTime } from './models';\nimport { ApiClient, Claims, Ctor } from './types';\n\nconst NAMESPACE = 'https://docs.truvity.com/vocab';\n\n@VcContext({ name: 'Foo', namespace: NAMESPACE })\nclass Foo {\n @VcNotEmptyClaim\n foo!: string;\n}\n\n@VcContext({ name: 'Bar', namespace: NAMESPACE })\nclass Bar {\n @VcNotEmptyClaim\n bar!: string;\n}\n\n@VcContext({ name: 'Baz', namespace: NAMESPACE, vcType: ['BazCredential'] })\nclass Baz {\n @VcNotEmptyClaim\n @VcLinkedCredentialClaim\n field1_1!: LinkedCredential<Foo>;\n\n @VcLinkedCredentialClaim\n @VcNotEmptyClaim\n field1_2!: LinkedCredential<Foo>;\n\n @VcClaim\n @VcLinkedCredentialClaim\n field1_3?: LinkedCredential<Foo>;\n\n @VcLinkedCredentialClaim\n @VcClaim\n field1_4?: LinkedCredential<Foo>;\n\n @VcLinkedFileClaim\n @VcNotEmptyClaim\n field2_1!: LinkedFile;\n\n @VcNotEmptyClaim\n @VcLinkedFileClaim\n field2_2!: LinkedFile;\n\n @VcStringEnumClaim([\n { value: 'option1', title: 'Option 1' },\n { value: 'option2', title: 'Option 2' },\n ])\n @VcNotEmptyClaim\n field3_1!: 'option1' | 'option2';\n\n @VcNotEmptyClaim\n @VcStringEnumClaim([\n { value: 'option1', title: 'Option 1' },\n { value: 'option2', title: 'Option 2' },\n ])\n field3_2!: 'option1' | 'option2';\n\n @VcArrayClaim(Number)\n @VcNotEmptyClaim\n field4_1!: number[];\n\n @VcNotEmptyClaim\n @VcArrayClaim(Number)\n field4_2!: number[];\n\n @VcNotEmptyClaim\n @VcClaimTitle('Field title')\n field5_1!: number;\n\n @VcClaimTitle('Field title')\n @VcNotEmptyClaim\n field5_2!: number;\n\n @VcClaim\n @VcNotEmptyClaim\n field6_1!: number;\n\n @VcNotEmptyClaim\n @VcClaim\n field6_2!: number;\n\n @VcArrayClaim(Rfc3339DateTime)\n @VcNotEmptyClaim\n field7_1!: Rfc3339DateTime[];\n\n @VcNotEmptyClaim\n @VcArrayClaim(Rfc3339DateTime)\n field7_2!: Rfc3339DateTime[];\n\n @VcArrayClaim(Rfc3339Date)\n @VcNotEmptyClaim\n field8_1!: Rfc3339Date[];\n\n @VcNotEmptyClaim\n @VcArrayClaim(Rfc3339Date)\n field8_2!: Rfc3339Date[];\n\n @VcNotEmptyClaim\n field9!: Bar;\n\n @VcArrayClaim(Bar)\n @VcClaimTitle('Field 10')\n field10?: Bar[];\n\n @VcArrayClaim(String)\n field11_1?: string[];\n\n @VcArrayClaim(String)\n @VcClaim\n field11_2?: string[];\n\n @VcClaim\n @VcArrayClaim(String)\n field11_3?: string[];\n}\n\nconst createDummyApiClient = () => ({}) as ApiClient;\n\nexport class TestVcDecorator<T extends Claims> extends VcDecorator<T> {\n constructor(private model: Ctor<T>) {\n super(createDummyApiClient(), model);\n }\n\n public getDraftSchema() {\n return super.getDraftSchema();\n }\n}\n\ndescribe('Credential', () => {\n it('should map registered claims to api', async () => {\n const vcDecorator = new TestVcDecorator(Baz);\n const mappedClaims = vcDecorator.getDraftSchema();\n\n expect(mappedClaims).toEqual({\n fields: [\n { name: 'field1_1', kind: 'LINK', notEmpty: true },\n { name: 'field1_2', kind: 'LINK', notEmpty: true },\n { name: 'field1_3', kind: 'LINK' },\n { name: 'field1_4', kind: 'LINK' },\n\n { name: 'field2_1', notEmpty: true, kind: 'FILE' },\n { name: 'field2_2', notEmpty: true, kind: 'FILE' },\n\n {\n name: 'field3_1',\n notEmpty: true,\n kind: 'STRING',\n enum: [\n { value: 'option1', title: 'Option 1' },\n { value: 'option2', title: 'Option 2' },\n ],\n },\n {\n name: 'field3_2',\n notEmpty: true,\n kind: 'STRING',\n enum: [\n { value: 'option1', title: 'Option 1' },\n { value: 'option2', title: 'Option 2' },\n ],\n },\n\n { name: 'field4_1', kind: 'NUMBER', notEmpty: true, isArray: true },\n { name: 'field4_2', kind: 'NUMBER', notEmpty: true, isArray: true },\n\n { name: 'field5_1', kind: 'NUMBER', notEmpty: true, title: 'Field title' },\n { name: 'field5_2', kind: 'NUMBER', notEmpty: true, title: 'Field title' },\n\n { name: 'field6_1', kind: 'NUMBER', notEmpty: true },\n { name: 'field6_2', kind: 'NUMBER', notEmpty: true },\n\n { name: 'field7_1', kind: 'DATETIME', notEmpty: true, isArray: true },\n { name: 'field7_2', kind: 'DATETIME', notEmpty: true, isArray: true },\n\n { name: 'field8_1', kind: 'DATE', notEmpty: true, isArray: true },\n { name: 'field8_2', kind: 'DATE', notEmpty: true, isArray: true },\n\n {\n name: 'field9',\n notEmpty: true,\n kind: 'STRUCT',\n fields: [{ name: 'bar', notEmpty: true, kind: 'STRING' }],\n vocabNamespace: 'https://docs.truvity.com/vocab',\n vocabName: 'Bar',\n },\n\n {\n name: 'field10',\n title: 'Field 10',\n isArray: true,\n kind: 'STRUCT',\n fields: [{ name: 'bar', notEmpty: true, kind: 'STRING' }],\n vocabNamespace: 'https://docs.truvity.com/vocab',\n vocabName: 'Bar',\n },\n\n { name: 'field11_1', kind: 'STRING', isArray: true },\n { name: 'field11_2', kind: 'STRING', isArray: true },\n { name: 'field11_3', kind: 'STRING', isArray: true },\n ],\n vocabNamespace: 'https://docs.truvity.com/vocab',\n vocabName: 'Baz',\n vcType: ['BazCredential'],\n });\n });\n});\n"]}
@@ -1,6 +0,0 @@
1
- import { ResourceCredential, ResourceDraft } from '../api';
2
- import type { LinkedEntityDescriptor, ValueWithId } from './types';
3
- export declare const isLinkedEntityDescriptor: (value: any) => value is LinkedEntityDescriptor;
4
- export declare const isValueWithId: (value: any) => value is ValueWithId;
5
- export declare const isCredentialResource: (value: ResourceDraft | ResourceCredential) => value is ResourceCredential;
6
- //# sourceMappingURL=guards.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/documents/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,wBAAwB,UAAW,GAAG,oCAIlD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,GAAG,yBAWvC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAAW,aAAa,GAAG,kBAAkB,gCAE7E,CAAC"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCredentialResource = exports.isValueWithId = exports.isLinkedEntityDescriptor = void 0;
4
- const isLinkedEntityDescriptor = (value) => {
5
- if (!(0, exports.isValueWithId)(value))
6
- return false;
7
- if (Reflect.get(value, 'type') !== 'LinkedCredential' && Reflect.get(value, 'type') !== 'LinkedFile')
8
- return false;
9
- return true;
10
- };
11
- exports.isLinkedEntityDescriptor = isLinkedEntityDescriptor;
12
- const isValueWithId = (value) => {
13
- if (value === null)
14
- return false;
15
- if (typeof value !== 'object')
16
- return false;
17
- if (!Reflect.has(value, 'id'))
18
- return false;
19
- if (typeof Reflect.get(value, 'id') !== 'string')
20
- return false;
21
- if (Reflect.has(value, 'digestMultibase')) {
22
- if (typeof Reflect.get(value, 'digestMultibase') !== 'string')
23
- return false;
24
- }
25
- return true;
26
- };
27
- exports.isValueWithId = isValueWithId;
28
- const isCredentialResource = (value) => {
29
- return 'type' in value.data;
30
- };
31
- exports.isCredentialResource = isCredentialResource;
32
- //# sourceMappingURL=guards.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/documents/guards.ts"],"names":[],"mappings":";;;AAGO,MAAM,wBAAwB,GAAG,CAAC,KAAU,EAAmC,EAAE;IACpF,IAAI,CAAC,IAAA,qBAAa,EAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,kBAAkB,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC;IACnH,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAJW,QAAA,wBAAwB,4BAInC;AAEK,MAAM,aAAa,GAAG,CAAC,KAAU,EAAwB,EAAE;IAC9D,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE/D,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE;QACvC,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;KAC/E;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAXW,QAAA,aAAa,iBAWxB;AAEK,MAAM,oBAAoB,GAAG,CAAC,KAAyC,EAA+B,EAAE;IAC3G,OAAO,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { ResourceCredential, ResourceDraft } from '../api';\nimport type { LinkedEntityDescriptor, ValueWithId } from './types';\n\nexport const isLinkedEntityDescriptor = (value: any): value is LinkedEntityDescriptor => {\n if (!isValueWithId(value)) return false;\n if (Reflect.get(value, 'type') !== 'LinkedCredential' && Reflect.get(value, 'type') !== 'LinkedFile') return false;\n return true;\n};\n\nexport const isValueWithId = (value: any): value is ValueWithId => {\n if (value === null) return false;\n if (typeof value !== 'object') return false;\n if (!Reflect.has(value, 'id')) return false;\n if (typeof Reflect.get(value, 'id') !== 'string') return false;\n\n if (Reflect.has(value, 'digestMultibase')) {\n if (typeof Reflect.get(value, 'digestMultibase') !== 'string') return false;\n }\n\n return true;\n};\n\nexport const isCredentialResource = (value: ResourceDraft | ResourceCredential): value is ResourceCredential => {\n return 'type' in value.data;\n};\n"]}
@@ -1,2 +0,0 @@
1
- export declare const generateIdempotencyKey: (prefix?: string | undefined) => string;
2
- //# sourceMappingURL=helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/documents/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,yCAElC,CAAC"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateIdempotencyKey = void 0;
4
- const uuid_1 = require("uuid");
5
- const generateIdempotencyKey = (prefix) => {
6
- return [prefix, (0, uuid_1.v4)()].filter(Boolean).join('-');
7
- };
8
- exports.generateIdempotencyKey = generateIdempotencyKey;
9
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/documents/helpers.ts"],"names":[],"mappings":";;;AAAA,+BAAkC;AAE3B,MAAM,sBAAsB,GAAG,CAAC,MAAe,EAAE,EAAE;IACtD,OAAO,CAAC,MAAM,EAAE,IAAA,SAAI,GAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC","sourcesContent":["import { v4 as uuid } from 'uuid';\n\nexport const generateIdempotencyKey = (prefix?: string) => {\n return [prefix, uuid()].filter(Boolean).join('-');\n};\n"]}