@eudiplo/sdk-core 4.3.0 → 4.5.0
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/README.md +45 -170
- package/dist/api/client/client.gen.d.mts +1 -1
- package/dist/api/client/client.gen.d.ts +1 -1
- package/dist/api/client/client.gen.js +12 -44
- package/dist/api/client/client.gen.mjs +12 -44
- package/dist/api/client/index.d.mts +4 -4
- package/dist/api/client/index.d.ts +4 -4
- package/dist/api/client/index.js +18 -54
- package/dist/api/client/index.mjs +18 -54
- package/dist/api/client/types.gen.d.mts +1 -1
- package/dist/api/client/types.gen.d.ts +1 -1
- package/dist/api/client.gen.d.mts +2 -2
- package/dist/api/client.gen.d.ts +2 -2
- package/dist/api/client.gen.js +13 -47
- package/dist/api/client.gen.mjs +13 -47
- package/dist/api/index.d.mts +88 -75
- package/dist/api/index.d.ts +88 -75
- package/dist/api/index.js +123 -136
- package/dist/api/index.mjs +119 -135
- package/dist/index.d.mts +56 -295
- package/dist/index.d.ts +56 -295
- package/dist/index.js +405 -309
- package/dist/index.mjs +395 -299
- package/dist/{types.gen-DKrNRB-E.d.mts → types.gen-Cc6DtXw9.d.mts} +23 -23
- package/dist/{types.gen-DKrNRB-E.d.ts → types.gen-Cc6DtXw9.d.ts} +23 -23
- package/dist/{types.gen-DWk5kPkH.d.mts → types.gen-z3We9JHj.d.mts} +940 -778
- package/dist/{types.gen-DWk5kPkH.d.ts → types.gen-z3We9JHj.d.ts} +940 -778
- package/package.json +8 -6
package/dist/index.mjs
CHANGED
|
@@ -25,10 +25,7 @@ var formDataBodySerializer = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
var jsonBodySerializer = {
|
|
28
|
-
bodySerializer: (body) => JSON.stringify(
|
|
29
|
-
body,
|
|
30
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
31
|
-
)
|
|
28
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
32
29
|
};
|
|
33
30
|
|
|
34
31
|
// src/api/core/serverSentEvents.gen.ts
|
|
@@ -72,10 +69,7 @@ function createSseClient({
|
|
|
72
69
|
}
|
|
73
70
|
const _fetch = options.fetch ?? globalThis.fetch;
|
|
74
71
|
const response = await _fetch(request);
|
|
75
|
-
if (!response.ok)
|
|
76
|
-
throw new Error(
|
|
77
|
-
`SSE failed: ${response.status} ${response.statusText}`
|
|
78
|
-
);
|
|
72
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
79
73
|
if (!response.body) throw new Error("No body in SSE response");
|
|
80
74
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
81
75
|
let buffer = "";
|
|
@@ -106,10 +100,7 @@ function createSseClient({
|
|
|
106
100
|
} else if (line.startsWith("id:")) {
|
|
107
101
|
lastEventId = line.replace(/^id:\s*/, "");
|
|
108
102
|
} else if (line.startsWith("retry:")) {
|
|
109
|
-
const parsed = Number.parseInt(
|
|
110
|
-
line.replace(/^retry:\s*/, ""),
|
|
111
|
-
10
|
|
112
|
-
);
|
|
103
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
113
104
|
if (!Number.isNaN(parsed)) {
|
|
114
105
|
retryDelay = parsed;
|
|
115
106
|
}
|
|
@@ -155,10 +146,7 @@ function createSseClient({
|
|
|
155
146
|
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
156
147
|
break;
|
|
157
148
|
}
|
|
158
|
-
const backoff = Math.min(
|
|
159
|
-
retryDelay * 2 ** (attempt - 1),
|
|
160
|
-
sseMaxRetryDelay ?? 3e4
|
|
161
|
-
);
|
|
149
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
162
150
|
await sleep(backoff);
|
|
163
151
|
}
|
|
164
152
|
}
|
|
@@ -266,11 +254,7 @@ var serializeObjectParam = ({
|
|
|
266
254
|
if (style !== "deepObject" && !explode) {
|
|
267
255
|
let values = [];
|
|
268
256
|
Object.entries(value).forEach(([key, v]) => {
|
|
269
|
-
values = [
|
|
270
|
-
...values,
|
|
271
|
-
key,
|
|
272
|
-
allowReserved ? v : encodeURIComponent(v)
|
|
273
|
-
];
|
|
257
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
274
258
|
});
|
|
275
259
|
const joinedValues2 = values.join(",");
|
|
276
260
|
switch (style) {
|
|
@@ -321,10 +305,7 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
321
305
|
continue;
|
|
322
306
|
}
|
|
323
307
|
if (Array.isArray(value)) {
|
|
324
|
-
url = url.replace(
|
|
325
|
-
match,
|
|
326
|
-
serializeArrayParam({ explode, name, style, value })
|
|
327
|
-
);
|
|
308
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
328
309
|
continue;
|
|
329
310
|
}
|
|
330
311
|
if (typeof value === "object") {
|
|
@@ -472,9 +453,7 @@ var getParseAs = (contentType) => {
|
|
|
472
453
|
if (cleanContent === "multipart/form-data") {
|
|
473
454
|
return "formData";
|
|
474
455
|
}
|
|
475
|
-
if (["application/", "audio/", "image/", "video/"].some(
|
|
476
|
-
(type) => cleanContent.startsWith(type)
|
|
477
|
-
)) {
|
|
456
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
478
457
|
return "blob";
|
|
479
458
|
}
|
|
480
459
|
if (cleanContent.startsWith("text/")) {
|
|
@@ -491,11 +470,8 @@ var checkForExistence = (options, name) => {
|
|
|
491
470
|
}
|
|
492
471
|
return false;
|
|
493
472
|
};
|
|
494
|
-
|
|
495
|
-
security
|
|
496
|
-
...options
|
|
497
|
-
}) => {
|
|
498
|
-
for (const auth of security) {
|
|
473
|
+
async function setAuthParams(options) {
|
|
474
|
+
for (const auth of options.security ?? []) {
|
|
499
475
|
if (checkForExistence(options, auth.name)) {
|
|
500
476
|
continue;
|
|
501
477
|
}
|
|
@@ -520,7 +496,7 @@ var setAuthParams = async ({
|
|
|
520
496
|
break;
|
|
521
497
|
}
|
|
522
498
|
}
|
|
523
|
-
}
|
|
499
|
+
}
|
|
524
500
|
var buildUrl = (options) => getUrl({
|
|
525
501
|
baseUrl: options.baseUrl,
|
|
526
502
|
path: options.path,
|
|
@@ -646,10 +622,7 @@ var createClient = (config = {}) => {
|
|
|
646
622
|
serializedBody: void 0
|
|
647
623
|
};
|
|
648
624
|
if (opts.security) {
|
|
649
|
-
await setAuthParams(
|
|
650
|
-
...opts,
|
|
651
|
-
security: opts.security
|
|
652
|
-
});
|
|
625
|
+
await setAuthParams(opts);
|
|
653
626
|
}
|
|
654
627
|
if (opts.requestValidator) {
|
|
655
628
|
await opts.requestValidator(opts);
|
|
@@ -762,12 +735,7 @@ var createClient = (config = {}) => {
|
|
|
762
735
|
let finalError = error;
|
|
763
736
|
for (const fn of interceptors.error.fns) {
|
|
764
737
|
if (fn) {
|
|
765
|
-
finalError = await fn(
|
|
766
|
-
finalError,
|
|
767
|
-
response,
|
|
768
|
-
request2,
|
|
769
|
-
options
|
|
770
|
-
);
|
|
738
|
+
finalError = await fn(finalError, response, request2, options);
|
|
771
739
|
}
|
|
772
740
|
}
|
|
773
741
|
finalError = finalError || {};
|
|
@@ -832,9 +800,7 @@ var createClient = (config = {}) => {
|
|
|
832
800
|
};
|
|
833
801
|
|
|
834
802
|
// src/api/client.gen.ts
|
|
835
|
-
var client = createClient(
|
|
836
|
-
createConfig({ throwOnError: true })
|
|
837
|
-
);
|
|
803
|
+
var client = createClient(createConfig({ throwOnError: true }));
|
|
838
804
|
|
|
839
805
|
// src/api/sdk.gen.ts
|
|
840
806
|
var appControllerGetVersion = (options) => (options?.client ?? client).get({
|
|
@@ -847,6 +813,14 @@ var appControllerGetFrontendConfig = (options) => (options?.client ?? client).ge
|
|
|
847
813
|
url: "/api/frontend-config",
|
|
848
814
|
...options
|
|
849
815
|
});
|
|
816
|
+
var authControllerGetOAuth2Token = (options) => (options.client ?? client).post({
|
|
817
|
+
url: "/api/oauth2/token",
|
|
818
|
+
...options,
|
|
819
|
+
headers: {
|
|
820
|
+
"Content-Type": "application/json",
|
|
821
|
+
...options.headers
|
|
822
|
+
}
|
|
823
|
+
});
|
|
850
824
|
var tenantControllerGetTenants = (options) => (options?.client ?? client).get({
|
|
851
825
|
security: [{ scheme: "bearer", type: "http" }],
|
|
852
826
|
url: "/api/tenant",
|
|
@@ -880,6 +854,11 @@ var tenantControllerUpdateTenant = (options) => (options.client ?? client).patch
|
|
|
880
854
|
...options.headers
|
|
881
855
|
}
|
|
882
856
|
});
|
|
857
|
+
var auditLogControllerGetAuditLogs = (options) => (options?.client ?? client).get({
|
|
858
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
859
|
+
url: "/api/admin/audit-logs",
|
|
860
|
+
...options
|
|
861
|
+
});
|
|
883
862
|
var clientControllerGetClients = (options) => (options?.client ?? client).get({
|
|
884
863
|
security: [{ scheme: "bearer", type: "http" }],
|
|
885
864
|
url: "/api/client",
|
|
@@ -1104,18 +1083,81 @@ var credentialConfigControllerUpdateCredentialConfiguration = (options) => (opti
|
|
|
1104
1083
|
...options.headers
|
|
1105
1084
|
}
|
|
1106
1085
|
});
|
|
1107
|
-
var
|
|
1086
|
+
var schemaMetadataControllerSignSchemaMetaConfig = (options) => (options.client ?? client).post({
|
|
1087
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1088
|
+
url: "/api/schema-metadata/sign",
|
|
1089
|
+
...options,
|
|
1090
|
+
headers: {
|
|
1091
|
+
"Content-Type": "application/json",
|
|
1092
|
+
...options.headers
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
var schemaMetadataControllerSignVersionSchemaMetaConfig = (options) => (options.client ?? client).post({
|
|
1096
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1097
|
+
url: "/api/schema-metadata/sign-version",
|
|
1098
|
+
...options,
|
|
1099
|
+
headers: {
|
|
1100
|
+
"Content-Type": "application/json",
|
|
1101
|
+
...options.headers
|
|
1102
|
+
}
|
|
1103
|
+
});
|
|
1104
|
+
var schemaMetadataControllerGetVocabularies = (options) => (options?.client ?? client).get({
|
|
1105
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1106
|
+
url: "/api/schema-metadata/vocabularies",
|
|
1107
|
+
...options
|
|
1108
|
+
});
|
|
1109
|
+
var schemaMetadataControllerFindAll = (options) => (options?.client ?? client).get({
|
|
1110
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1111
|
+
url: "/api/schema-metadata",
|
|
1112
|
+
...options
|
|
1113
|
+
});
|
|
1114
|
+
var schemaMetadataControllerFindOne = (options) => (options.client ?? client).get({
|
|
1108
1115
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1109
|
-
url: "/api/
|
|
1116
|
+
url: "/api/schema-metadata/{id}",
|
|
1117
|
+
...options
|
|
1118
|
+
});
|
|
1119
|
+
var schemaMetadataControllerRemove = (options) => (options.client ?? client).delete({
|
|
1120
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1121
|
+
url: "/api/schema-metadata/{id}/versions/{version}",
|
|
1122
|
+
...options
|
|
1123
|
+
});
|
|
1124
|
+
var schemaMetadataControllerUpdate = (options) => (options.client ?? client).patch({
|
|
1125
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1126
|
+
url: "/api/schema-metadata/{id}/versions/{version}",
|
|
1110
1127
|
...options,
|
|
1111
1128
|
headers: {
|
|
1112
1129
|
"Content-Type": "application/json",
|
|
1113
1130
|
...options.headers
|
|
1114
1131
|
}
|
|
1115
1132
|
});
|
|
1116
|
-
var
|
|
1133
|
+
var schemaMetadataControllerGetLatest = (options) => (options.client ?? client).get({
|
|
1134
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1135
|
+
url: "/api/schema-metadata/{id}/latest",
|
|
1136
|
+
...options
|
|
1137
|
+
});
|
|
1138
|
+
var schemaMetadataControllerGetVersions = (options) => (options.client ?? client).get({
|
|
1117
1139
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1118
|
-
url: "/api/
|
|
1140
|
+
url: "/api/schema-metadata/{id}/versions",
|
|
1141
|
+
...options
|
|
1142
|
+
});
|
|
1143
|
+
var schemaMetadataControllerGetJwt = (options) => (options.client ?? client).get({
|
|
1144
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1145
|
+
url: "/api/schema-metadata/{id}/versions/{version}/jwt",
|
|
1146
|
+
...options
|
|
1147
|
+
});
|
|
1148
|
+
var schemaMetadataControllerExport = (options) => (options.client ?? client).get({
|
|
1149
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1150
|
+
url: "/api/schema-metadata/{id}/versions/{version}/export",
|
|
1151
|
+
...options
|
|
1152
|
+
});
|
|
1153
|
+
var schemaMetadataControllerGetSchema = (options) => (options.client ?? client).get({
|
|
1154
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1155
|
+
url: "/api/schema-metadata/{id}/versions/{version}/schemas/{format}",
|
|
1156
|
+
...options
|
|
1157
|
+
});
|
|
1158
|
+
var schemaMetadataControllerDeprecateVersion = (options) => (options.client ?? client).patch({
|
|
1159
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1160
|
+
url: "/api/schema-metadata/{id}/versions/{version}/deprecation",
|
|
1119
1161
|
...options,
|
|
1120
1162
|
headers: {
|
|
1121
1163
|
"Content-Type": "application/json",
|
|
@@ -1236,6 +1278,26 @@ var trustListControllerGetTrustListVersion = (options) => (options.client ?? cli
|
|
|
1236
1278
|
url: "/api/trust-list/{id}/versions/{versionId}",
|
|
1237
1279
|
...options
|
|
1238
1280
|
});
|
|
1281
|
+
var cacheControllerGetStats = (options) => (options?.client ?? client).get({
|
|
1282
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1283
|
+
url: "/api/cache/stats",
|
|
1284
|
+
...options
|
|
1285
|
+
});
|
|
1286
|
+
var cacheControllerClearAllCaches = (options) => (options?.client ?? client).delete({
|
|
1287
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1288
|
+
url: "/api/cache",
|
|
1289
|
+
...options
|
|
1290
|
+
});
|
|
1291
|
+
var cacheControllerClearTrustListCache = (options) => (options?.client ?? client).delete({
|
|
1292
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1293
|
+
url: "/api/cache/trust-list",
|
|
1294
|
+
...options
|
|
1295
|
+
});
|
|
1296
|
+
var cacheControllerClearStatusListCache = (options) => (options?.client ?? client).delete({
|
|
1297
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1298
|
+
url: "/api/cache/status-list",
|
|
1299
|
+
...options
|
|
1300
|
+
});
|
|
1239
1301
|
var presentationManagementControllerConfiguration = (options) => (options?.client ?? client).get({
|
|
1240
1302
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1241
1303
|
url: "/api/verifier/config",
|
|
@@ -1297,26 +1359,6 @@ var presentationManagementControllerReissueRegistrationCertificate = (options) =
|
|
|
1297
1359
|
url: "/api/verifier/config/{id}/registration-cert/reissue",
|
|
1298
1360
|
...options
|
|
1299
1361
|
});
|
|
1300
|
-
var cacheControllerGetStats = (options) => (options?.client ?? client).get({
|
|
1301
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1302
|
-
url: "/api/cache/stats",
|
|
1303
|
-
...options
|
|
1304
|
-
});
|
|
1305
|
-
var cacheControllerClearAllCaches = (options) => (options?.client ?? client).delete({
|
|
1306
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1307
|
-
url: "/api/cache",
|
|
1308
|
-
...options
|
|
1309
|
-
});
|
|
1310
|
-
var cacheControllerClearTrustListCache = (options) => (options?.client ?? client).delete({
|
|
1311
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1312
|
-
url: "/api/cache/trust-list",
|
|
1313
|
-
...options
|
|
1314
|
-
});
|
|
1315
|
-
var cacheControllerClearStatusListCache = (options) => (options?.client ?? client).delete({
|
|
1316
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1317
|
-
url: "/api/cache/status-list",
|
|
1318
|
-
...options
|
|
1319
|
-
});
|
|
1320
1362
|
var registrarControllerDeleteConfig = (options) => (options?.client ?? client).delete({
|
|
1321
1363
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1322
1364
|
url: "/api/registrar/config",
|
|
@@ -1354,69 +1396,6 @@ var registrarControllerCreateAccessCertificate = (options) => (options.client ??
|
|
|
1354
1396
|
...options.headers
|
|
1355
1397
|
}
|
|
1356
1398
|
});
|
|
1357
|
-
var schemaMetadataControllerGetVocabularies = (options) => (options?.client ?? client).get({
|
|
1358
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1359
|
-
url: "/api/schema-metadata/vocabularies",
|
|
1360
|
-
...options
|
|
1361
|
-
});
|
|
1362
|
-
var schemaMetadataControllerFindAll = (options) => (options?.client ?? client).get({
|
|
1363
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1364
|
-
url: "/api/schema-metadata",
|
|
1365
|
-
...options
|
|
1366
|
-
});
|
|
1367
|
-
var schemaMetadataControllerFindOne = (options) => (options.client ?? client).get({
|
|
1368
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1369
|
-
url: "/api/schema-metadata/{id}",
|
|
1370
|
-
...options
|
|
1371
|
-
});
|
|
1372
|
-
var schemaMetadataControllerRemove = (options) => (options.client ?? client).delete({
|
|
1373
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1374
|
-
url: "/api/schema-metadata/{id}/versions/{version}",
|
|
1375
|
-
...options
|
|
1376
|
-
});
|
|
1377
|
-
var schemaMetadataControllerUpdate = (options) => (options.client ?? client).patch({
|
|
1378
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1379
|
-
url: "/api/schema-metadata/{id}/versions/{version}",
|
|
1380
|
-
...options,
|
|
1381
|
-
headers: {
|
|
1382
|
-
"Content-Type": "application/json",
|
|
1383
|
-
...options.headers
|
|
1384
|
-
}
|
|
1385
|
-
});
|
|
1386
|
-
var schemaMetadataControllerGetLatest = (options) => (options.client ?? client).get({
|
|
1387
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1388
|
-
url: "/api/schema-metadata/{id}/latest",
|
|
1389
|
-
...options
|
|
1390
|
-
});
|
|
1391
|
-
var schemaMetadataControllerGetVersions = (options) => (options.client ?? client).get({
|
|
1392
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1393
|
-
url: "/api/schema-metadata/{id}/versions",
|
|
1394
|
-
...options
|
|
1395
|
-
});
|
|
1396
|
-
var schemaMetadataControllerGetJwt = (options) => (options.client ?? client).get({
|
|
1397
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1398
|
-
url: "/api/schema-metadata/{id}/versions/{version}/jwt",
|
|
1399
|
-
...options
|
|
1400
|
-
});
|
|
1401
|
-
var schemaMetadataControllerExport = (options) => (options.client ?? client).get({
|
|
1402
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1403
|
-
url: "/api/schema-metadata/{id}/versions/{version}/export",
|
|
1404
|
-
...options
|
|
1405
|
-
});
|
|
1406
|
-
var schemaMetadataControllerGetSchema = (options) => (options.client ?? client).get({
|
|
1407
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1408
|
-
url: "/api/schema-metadata/{id}/versions/{version}/schemas/{format}",
|
|
1409
|
-
...options
|
|
1410
|
-
});
|
|
1411
|
-
var schemaMetadataControllerDeprecateVersion = (options) => (options.client ?? client).patch({
|
|
1412
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1413
|
-
url: "/api/schema-metadata/{id}/versions/{version}/deprecation",
|
|
1414
|
-
...options,
|
|
1415
|
-
headers: {
|
|
1416
|
-
"Content-Type": "application/json",
|
|
1417
|
-
...options.headers
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
1399
|
var credentialOfferControllerGetOffer = (options) => (options.client ?? client).post({
|
|
1421
1400
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1422
1401
|
url: "/api/issuer/offer",
|
|
@@ -1449,6 +1428,11 @@ var keyChainControllerGetProviders = (options) => (options?.client ?? client).ge
|
|
|
1449
1428
|
url: "/api/key-chain/providers",
|
|
1450
1429
|
...options
|
|
1451
1430
|
});
|
|
1431
|
+
var keyChainControllerGetProvidersHealth = (options) => (options?.client ?? client).get({
|
|
1432
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1433
|
+
url: "/api/key-chain/providers/health",
|
|
1434
|
+
...options
|
|
1435
|
+
});
|
|
1452
1436
|
var keyChainControllerGetAll = (options) => (options?.client ?? client).get({
|
|
1453
1437
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1454
1438
|
url: "/api/key-chain",
|
|
@@ -1535,6 +1519,26 @@ function decodeJwtPayload(jwt) {
|
|
|
1535
1519
|
const jsonPayload = atob(base64);
|
|
1536
1520
|
return JSON.parse(jsonPayload);
|
|
1537
1521
|
}
|
|
1522
|
+
function extractResponseUriFromRequestObject(requestObject) {
|
|
1523
|
+
const requestPayload = decodeJwtPayload(requestObject);
|
|
1524
|
+
if (!requestPayload.response_uri) {
|
|
1525
|
+
throw new Error("No response_uri found in request object");
|
|
1526
|
+
}
|
|
1527
|
+
return requestPayload.response_uri;
|
|
1528
|
+
}
|
|
1529
|
+
function mapDcApiPresentationResult(result) {
|
|
1530
|
+
let resolvedCredentials;
|
|
1531
|
+
if (Array.isArray(result)) {
|
|
1532
|
+
resolvedCredentials = result;
|
|
1533
|
+
} else if (Array.isArray(result?.credentials)) {
|
|
1534
|
+
resolvedCredentials = result.credentials;
|
|
1535
|
+
}
|
|
1536
|
+
return {
|
|
1537
|
+
credentials: resolvedCredentials,
|
|
1538
|
+
response: result,
|
|
1539
|
+
redirectUri: result?.redirect_uri
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1538
1542
|
var EudiploClient = class {
|
|
1539
1543
|
config;
|
|
1540
1544
|
accessToken;
|
|
@@ -1567,7 +1571,7 @@ var EudiploClient = class {
|
|
|
1567
1571
|
}
|
|
1568
1572
|
async _doAuthenticate() {
|
|
1569
1573
|
const fetchFn = this.config.fetch ?? globalThis.fetch;
|
|
1570
|
-
const res = await fetchFn(`${this.config.baseUrl}/oauth2/token`, {
|
|
1574
|
+
const res = await fetchFn(`${this.config.baseUrl}/api/oauth2/token`, {
|
|
1571
1575
|
method: "POST",
|
|
1572
1576
|
headers: { "Content-Type": "application/json" },
|
|
1573
1577
|
body: JSON.stringify({
|
|
@@ -1626,15 +1630,14 @@ var EudiploClient = class {
|
|
|
1626
1630
|
tx_code: options.txCode
|
|
1627
1631
|
};
|
|
1628
1632
|
if (options.claims) {
|
|
1629
|
-
|
|
1630
|
-
additionalProperties: void 0
|
|
1631
|
-
};
|
|
1633
|
+
const credentialClaims = {};
|
|
1632
1634
|
for (const [configId, claims] of Object.entries(options.claims)) {
|
|
1633
|
-
|
|
1635
|
+
credentialClaims[configId] = {
|
|
1634
1636
|
type: "inline",
|
|
1635
1637
|
claims
|
|
1636
1638
|
};
|
|
1637
1639
|
}
|
|
1640
|
+
body.credentialClaims = credentialClaims;
|
|
1638
1641
|
}
|
|
1639
1642
|
const response = await credentialOfferControllerGetOffer({
|
|
1640
1643
|
body
|
|
@@ -1675,10 +1678,12 @@ var EudiploClient = class {
|
|
|
1675
1678
|
*/
|
|
1676
1679
|
async createPresentationRequest(options) {
|
|
1677
1680
|
await this.ensureAuthenticated();
|
|
1681
|
+
const inferredOrigin = options.origin ?? (typeof globalThis.location === "object" ? globalThis.location.origin : void 0);
|
|
1678
1682
|
const body = {
|
|
1679
1683
|
response_type: options.responseType ?? "uri",
|
|
1680
1684
|
requestId: options.configId,
|
|
1681
|
-
redirectUri: options.redirectUri
|
|
1685
|
+
redirectUri: options.redirectUri,
|
|
1686
|
+
expected_origin: options.responseType === "dc-api" ? inferredOrigin : void 0
|
|
1682
1687
|
};
|
|
1683
1688
|
const response = await verifierOfferControllerGetOffer({
|
|
1684
1689
|
body
|
|
@@ -1896,10 +1901,12 @@ var EudiploClient = class {
|
|
|
1896
1901
|
*/
|
|
1897
1902
|
async createDcApiPresentationRequest(options) {
|
|
1898
1903
|
await this.ensureAuthenticated();
|
|
1904
|
+
const inferredOrigin = options.origin ?? (typeof globalThis.location === "object" ? globalThis.location.origin : void 0);
|
|
1899
1905
|
const body = {
|
|
1900
1906
|
response_type: "dc-api",
|
|
1901
1907
|
requestId: options.configId,
|
|
1902
|
-
redirectUri: options.redirectUri
|
|
1908
|
+
redirectUri: options.redirectUri,
|
|
1909
|
+
expected_origin: inferredOrigin
|
|
1903
1910
|
};
|
|
1904
1911
|
const response = await verifierOfferControllerGetOffer({
|
|
1905
1912
|
body
|
|
@@ -1907,7 +1914,34 @@ var EudiploClient = class {
|
|
|
1907
1914
|
if (!response.data) {
|
|
1908
1915
|
throw new Error("Failed to create DC API presentation request");
|
|
1909
1916
|
}
|
|
1910
|
-
|
|
1917
|
+
const session = await this.getSession(response.data.session);
|
|
1918
|
+
if (session.requestObject) {
|
|
1919
|
+
return session;
|
|
1920
|
+
}
|
|
1921
|
+
const nonceOrId = session.walletNonce ?? session.id;
|
|
1922
|
+
const requestObjectUrl = `${this.config.baseUrl}/api/presentations/${encodeURIComponent(nonceOrId)}/oid4vp/request`;
|
|
1923
|
+
const fetchImpl = this.config.fetch ?? fetch;
|
|
1924
|
+
const requestObjectResponse = await fetchImpl(requestObjectUrl, {
|
|
1925
|
+
method: "GET",
|
|
1926
|
+
headers: {
|
|
1927
|
+
Accept: "application/oauth-authz-req+jwt",
|
|
1928
|
+
...inferredOrigin ? { Origin: inferredOrigin } : {}
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
if (!requestObjectResponse.ok) {
|
|
1932
|
+
const errorText = await requestObjectResponse.text();
|
|
1933
|
+
throw new Error(
|
|
1934
|
+
`Failed to fetch DC API request object: ${requestObjectResponse.status} ${errorText}`
|
|
1935
|
+
);
|
|
1936
|
+
}
|
|
1937
|
+
const requestObject = (await requestObjectResponse.text()).trim();
|
|
1938
|
+
if (!requestObject) {
|
|
1939
|
+
throw new Error("DC API request endpoint returned an empty requestObject");
|
|
1940
|
+
}
|
|
1941
|
+
return {
|
|
1942
|
+
...session,
|
|
1943
|
+
requestObject
|
|
1944
|
+
};
|
|
1911
1945
|
}
|
|
1912
1946
|
/**
|
|
1913
1947
|
* Submit a presentation using the Digital Credentials API.
|
|
@@ -1939,54 +1973,13 @@ var EudiploClient = class {
|
|
|
1939
1973
|
'Session does not contain a requestObject. Make sure to create the session with response_type: "dc-api"'
|
|
1940
1974
|
);
|
|
1941
1975
|
}
|
|
1942
|
-
const
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
data: { request: session.requestObject }
|
|
1949
|
-
}
|
|
1950
|
-
]
|
|
1951
|
-
}
|
|
1952
|
-
});
|
|
1953
|
-
if (!dcResponse) {
|
|
1954
|
-
throw new Error("No response from Digital Credentials API");
|
|
1955
|
-
}
|
|
1956
|
-
if (dcResponse.data?.error) {
|
|
1957
|
-
throw new Error(
|
|
1958
|
-
`Wallet error: ${dcResponse.data.error}${dcResponse.data.error_description ? ` - ${dcResponse.data.error_description}` : ""}`
|
|
1959
|
-
);
|
|
1960
|
-
}
|
|
1961
|
-
const requestPayload = decodeJwtPayload(
|
|
1962
|
-
session.requestObject
|
|
1963
|
-
);
|
|
1964
|
-
if (!requestPayload.response_uri) {
|
|
1965
|
-
throw new Error("No response_uri found in request object");
|
|
1966
|
-
}
|
|
1967
|
-
const fetchImpl = this.config.fetch ?? fetch;
|
|
1968
|
-
const submitResponse = await fetchImpl(requestPayload.response_uri, {
|
|
1969
|
-
method: "POST",
|
|
1970
|
-
headers: {
|
|
1971
|
-
"Content-Type": "application/json"
|
|
1972
|
-
},
|
|
1973
|
-
body: JSON.stringify({
|
|
1974
|
-
...dcResponse.data,
|
|
1975
|
-
sendResponse: options.sendResponse ?? true
|
|
1976
|
-
})
|
|
1976
|
+
const walletResponse = await invokeDcApi(session.requestObject);
|
|
1977
|
+
return submitDcApiResponse({
|
|
1978
|
+
responseUri: extractResponseUriFromRequestObject(session.requestObject),
|
|
1979
|
+
walletResponse,
|
|
1980
|
+
sendResponse: options.sendResponse,
|
|
1981
|
+
fetch: this.config.fetch
|
|
1977
1982
|
});
|
|
1978
|
-
if (!submitResponse.ok) {
|
|
1979
|
-
const errorText = await submitResponse.text();
|
|
1980
|
-
throw new Error(
|
|
1981
|
-
`Failed to submit presentation: ${submitResponse.status} ${errorText}`
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
const result = await submitResponse.json();
|
|
1985
|
-
return {
|
|
1986
|
-
credentials: result.credentials ?? result,
|
|
1987
|
-
response: result,
|
|
1988
|
-
redirectUri: result.redirect_uri
|
|
1989
|
-
};
|
|
1990
1983
|
}
|
|
1991
1984
|
/**
|
|
1992
1985
|
* Convenience method to create a presentation request and immediately
|
|
@@ -2005,111 +1998,7 @@ var EudiploClient = class {
|
|
|
2005
1998
|
return this.submitDcApiPresentation(session, dcOptions);
|
|
2006
1999
|
}
|
|
2007
2000
|
};
|
|
2008
|
-
async function
|
|
2009
|
-
const client2 = new EudiploClient({
|
|
2010
|
-
baseUrl: options.baseUrl,
|
|
2011
|
-
clientId: options.clientId,
|
|
2012
|
-
clientSecret: options.clientSecret
|
|
2013
|
-
});
|
|
2014
|
-
const { uri, sessionId } = await client2.createPresentationRequest({
|
|
2015
|
-
configId: options.configId,
|
|
2016
|
-
redirectUri: options.redirectUri
|
|
2017
|
-
});
|
|
2018
|
-
return {
|
|
2019
|
-
uri,
|
|
2020
|
-
sessionId,
|
|
2021
|
-
waitForCompletion: (pollingOptions) => client2.waitForSession(sessionId, { ...options.polling, ...pollingOptions }),
|
|
2022
|
-
getStatus: () => client2.getSession(sessionId)
|
|
2023
|
-
};
|
|
2024
|
-
}
|
|
2025
|
-
async function issue(options) {
|
|
2026
|
-
const client2 = new EudiploClient({
|
|
2027
|
-
baseUrl: options.baseUrl,
|
|
2028
|
-
clientId: options.clientId,
|
|
2029
|
-
clientSecret: options.clientSecret
|
|
2030
|
-
});
|
|
2031
|
-
const { uri, sessionId } = await client2.createIssuanceOffer({
|
|
2032
|
-
credentialConfigurationIds: options.credentialConfigurationIds,
|
|
2033
|
-
claims: options.claims,
|
|
2034
|
-
txCode: options.txCode
|
|
2035
|
-
});
|
|
2036
|
-
return {
|
|
2037
|
-
uri,
|
|
2038
|
-
sessionId,
|
|
2039
|
-
waitForCompletion: (pollingOptions) => client2.waitForSession(sessionId, { ...options.polling, ...pollingOptions }),
|
|
2040
|
-
getStatus: () => client2.getSession(sessionId)
|
|
2041
|
-
};
|
|
2042
|
-
}
|
|
2043
|
-
async function verifyAndWait(options) {
|
|
2044
|
-
const { uri, waitForCompletion } = await verify(options);
|
|
2045
|
-
options.onUri(uri);
|
|
2046
|
-
return waitForCompletion(options.polling);
|
|
2047
|
-
}
|
|
2048
|
-
async function issueAndWait(options) {
|
|
2049
|
-
const { uri, waitForCompletion } = await issue(options);
|
|
2050
|
-
options.onUri(uri);
|
|
2051
|
-
return waitForCompletion(options.polling);
|
|
2052
|
-
}
|
|
2053
|
-
async function verifyWithDcApi(options) {
|
|
2054
|
-
const eudiploClient = new EudiploClient({
|
|
2055
|
-
baseUrl: options.baseUrl,
|
|
2056
|
-
clientId: options.clientId,
|
|
2057
|
-
clientSecret: options.clientSecret
|
|
2058
|
-
});
|
|
2059
|
-
return eudiploClient.verifyWithDcApi(
|
|
2060
|
-
{
|
|
2061
|
-
configId: options.configId,
|
|
2062
|
-
redirectUri: options.redirectUri
|
|
2063
|
-
},
|
|
2064
|
-
{
|
|
2065
|
-
sendResponse: options.sendResponse
|
|
2066
|
-
}
|
|
2067
|
-
);
|
|
2068
|
-
}
|
|
2069
|
-
async function createDcApiRequest(options) {
|
|
2070
|
-
const eudiploClient = new EudiploClient({
|
|
2071
|
-
baseUrl: options.baseUrl,
|
|
2072
|
-
clientId: options.clientId,
|
|
2073
|
-
clientSecret: options.clientSecret
|
|
2074
|
-
});
|
|
2075
|
-
const session = await eudiploClient.createDcApiPresentationRequest({
|
|
2076
|
-
configId: options.configId,
|
|
2077
|
-
redirectUri: options.redirectUri
|
|
2078
|
-
});
|
|
2079
|
-
return {
|
|
2080
|
-
session,
|
|
2081
|
-
submit: (dcOptions) => eudiploClient.submitDcApiPresentation(session, {
|
|
2082
|
-
sendResponse: options.sendResponse,
|
|
2083
|
-
...dcOptions
|
|
2084
|
-
})
|
|
2085
|
-
};
|
|
2086
|
-
}
|
|
2087
|
-
async function createDcApiRequestForBrowser(options) {
|
|
2088
|
-
const eudiploClient = new EudiploClient({
|
|
2089
|
-
baseUrl: options.baseUrl,
|
|
2090
|
-
clientId: options.clientId,
|
|
2091
|
-
clientSecret: options.clientSecret
|
|
2092
|
-
});
|
|
2093
|
-
const session = await eudiploClient.createDcApiPresentationRequest({
|
|
2094
|
-
configId: options.configId,
|
|
2095
|
-
redirectUri: options.redirectUri
|
|
2096
|
-
});
|
|
2097
|
-
if (!session.requestObject) {
|
|
2098
|
-
throw new Error("Session does not contain a requestObject");
|
|
2099
|
-
}
|
|
2100
|
-
const requestPayload = decodeJwtPayload(
|
|
2101
|
-
session.requestObject
|
|
2102
|
-
);
|
|
2103
|
-
if (!requestPayload.response_uri) {
|
|
2104
|
-
throw new Error("No response_uri found in request object");
|
|
2105
|
-
}
|
|
2106
|
-
return {
|
|
2107
|
-
requestObject: session.requestObject,
|
|
2108
|
-
sessionId: session.id,
|
|
2109
|
-
responseUri: requestPayload.response_uri
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
async function callDcApi(requestObject) {
|
|
2001
|
+
async function invokeDcApi(requestObject) {
|
|
2113
2002
|
if (!isDcApiAvailable()) {
|
|
2114
2003
|
throw new Error(
|
|
2115
2004
|
"Digital Credentials API is not available in this browser. Please use a supported browser or fall back to QR code flow."
|
|
@@ -2136,7 +2025,7 @@ async function callDcApi(requestObject) {
|
|
|
2136
2025
|
}
|
|
2137
2026
|
return dcResponse.data;
|
|
2138
2027
|
}
|
|
2139
|
-
async function
|
|
2028
|
+
async function submitDcApiResponse(options) {
|
|
2140
2029
|
const fetchImpl = options.fetch ?? fetch;
|
|
2141
2030
|
const submitResponse = await fetchImpl(options.responseUri, {
|
|
2142
2031
|
method: "POST",
|
|
@@ -2155,13 +2044,220 @@ async function submitDcApiWalletResponse(options) {
|
|
|
2155
2044
|
);
|
|
2156
2045
|
}
|
|
2157
2046
|
const result = await submitResponse.json();
|
|
2047
|
+
return mapDcApiPresentationResult(result);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
// src/config/derive.ts
|
|
2051
|
+
var JSON_SCHEMA_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
2052
|
+
function segmentToKey(segment) {
|
|
2053
|
+
if (segment === null) {
|
|
2054
|
+
return "*";
|
|
2055
|
+
}
|
|
2056
|
+
return String(segment);
|
|
2057
|
+
}
|
|
2058
|
+
function getOrCreateChild(target, key, nextIsArray) {
|
|
2059
|
+
const current = target[key];
|
|
2060
|
+
if (current !== void 0) {
|
|
2061
|
+
if (Array.isArray(current)) {
|
|
2062
|
+
return current;
|
|
2063
|
+
}
|
|
2064
|
+
if (typeof current === "object" && current !== null) {
|
|
2065
|
+
return current;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
const created = nextIsArray ? [] : {};
|
|
2069
|
+
target[key] = created;
|
|
2070
|
+
return created;
|
|
2071
|
+
}
|
|
2072
|
+
function setValueAtPath(target, path, value) {
|
|
2073
|
+
if (path.length === 0) {
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
let cursor = target;
|
|
2077
|
+
for (let index = 0; index < path.length; index += 1) {
|
|
2078
|
+
const segment = path[index];
|
|
2079
|
+
const isLast = index === path.length - 1;
|
|
2080
|
+
const next = path[index + 1];
|
|
2081
|
+
if (Array.isArray(cursor)) {
|
|
2082
|
+
const arrayIndex = typeof segment === "number" ? segment : Number(segmentToKey(segment));
|
|
2083
|
+
if (!Number.isFinite(arrayIndex) || arrayIndex < 0) {
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
if (isLast) {
|
|
2087
|
+
cursor[arrayIndex] = value;
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
const current = cursor[arrayIndex];
|
|
2091
|
+
if (typeof current !== "object" || current === null) {
|
|
2092
|
+
cursor[arrayIndex] = typeof next === "number" ? [] : {};
|
|
2093
|
+
}
|
|
2094
|
+
cursor = cursor[arrayIndex];
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2097
|
+
const key = segmentToKey(segment);
|
|
2098
|
+
if (isLast) {
|
|
2099
|
+
cursor[key] = value;
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
cursor = getOrCreateChild(cursor, key, typeof next === "number");
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
function getDisplayTitle(display) {
|
|
2106
|
+
if (!display || display.length === 0) {
|
|
2107
|
+
return void 0;
|
|
2108
|
+
}
|
|
2109
|
+
const en = display.find((entry) => entry.locale.toLowerCase().startsWith("en"));
|
|
2110
|
+
return en?.name ?? display[0]?.name;
|
|
2111
|
+
}
|
|
2112
|
+
function mergeLeafSchema(existing, next) {
|
|
2113
|
+
const merged = { ...next };
|
|
2114
|
+
if (existing.properties && Object.keys(existing.properties).length > 0) {
|
|
2115
|
+
merged.properties = existing.properties;
|
|
2116
|
+
}
|
|
2117
|
+
if (Array.isArray(existing.required) && existing.required.length > 0) {
|
|
2118
|
+
merged.required = existing.required;
|
|
2119
|
+
}
|
|
2120
|
+
return merged;
|
|
2121
|
+
}
|
|
2122
|
+
function ensureSchemaNode(root, path) {
|
|
2123
|
+
let cursor = root;
|
|
2124
|
+
for (const segment of path) {
|
|
2125
|
+
const key = segmentToKey(segment);
|
|
2126
|
+
cursor.properties ??= {};
|
|
2127
|
+
if (!cursor.properties[key]) {
|
|
2128
|
+
cursor.properties[key] = {
|
|
2129
|
+
type: "object",
|
|
2130
|
+
properties: {}
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
cursor = cursor.properties[key];
|
|
2134
|
+
}
|
|
2135
|
+
return cursor;
|
|
2136
|
+
}
|
|
2137
|
+
function ensureFrameNode(root, path) {
|
|
2138
|
+
let cursor = root;
|
|
2139
|
+
for (const segment of path) {
|
|
2140
|
+
const key = segmentToKey(segment);
|
|
2141
|
+
const current = cursor[key];
|
|
2142
|
+
if (!current || typeof current !== "object" || Array.isArray(current)) {
|
|
2143
|
+
cursor[key] = {};
|
|
2144
|
+
}
|
|
2145
|
+
cursor = cursor[key];
|
|
2146
|
+
}
|
|
2147
|
+
return cursor;
|
|
2148
|
+
}
|
|
2149
|
+
function buildClaims(fields) {
|
|
2150
|
+
const claims = {};
|
|
2151
|
+
for (const field of fields) {
|
|
2152
|
+
if (!Object.prototype.hasOwnProperty.call(field, "defaultValue")) {
|
|
2153
|
+
continue;
|
|
2154
|
+
}
|
|
2155
|
+
setValueAtPath(claims, field.path, field.defaultValue);
|
|
2156
|
+
}
|
|
2157
|
+
return claims;
|
|
2158
|
+
}
|
|
2159
|
+
function buildDisclosureFrame(fields) {
|
|
2160
|
+
const frame = {};
|
|
2161
|
+
let hasDisclosure = false;
|
|
2162
|
+
for (const field of fields) {
|
|
2163
|
+
if (!field.disclosable || field.path.length === 0) {
|
|
2164
|
+
continue;
|
|
2165
|
+
}
|
|
2166
|
+
const parentPath = field.path.slice(0, -1);
|
|
2167
|
+
const leaf = segmentToKey(field.path.at(-1) ?? "");
|
|
2168
|
+
const node = ensureFrameNode(frame, parentPath);
|
|
2169
|
+
const existing = Array.isArray(node._sd) ? node._sd : [];
|
|
2170
|
+
if (!existing.includes(leaf)) {
|
|
2171
|
+
existing.push(leaf);
|
|
2172
|
+
node._sd = existing;
|
|
2173
|
+
}
|
|
2174
|
+
hasDisclosure = true;
|
|
2175
|
+
}
|
|
2176
|
+
return hasDisclosure ? frame : void 0;
|
|
2177
|
+
}
|
|
2178
|
+
function buildClaimsMetadata(fields) {
|
|
2179
|
+
return fields.filter((field) => field.path.length > 0).map((field) => {
|
|
2180
|
+
const metadata = {
|
|
2181
|
+
path: field.path
|
|
2182
|
+
};
|
|
2183
|
+
if (typeof field.mandatory === "boolean") {
|
|
2184
|
+
metadata.mandatory = field.mandatory;
|
|
2185
|
+
}
|
|
2186
|
+
if (field.display && field.display.length > 0) {
|
|
2187
|
+
metadata.display = field.display;
|
|
2188
|
+
}
|
|
2189
|
+
return metadata;
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
function buildLeafSchema(field) {
|
|
2193
|
+
const schema = {
|
|
2194
|
+
...field.constraints,
|
|
2195
|
+
type: field.type === "date" ? "string" : field.type
|
|
2196
|
+
};
|
|
2197
|
+
if (field.type === "date" && !schema.format) {
|
|
2198
|
+
schema.format = "date";
|
|
2199
|
+
}
|
|
2200
|
+
const title = getDisplayTitle(field.display);
|
|
2201
|
+
if (title) {
|
|
2202
|
+
schema.title = title;
|
|
2203
|
+
}
|
|
2204
|
+
return schema;
|
|
2205
|
+
}
|
|
2206
|
+
function addRequired(parent, key) {
|
|
2207
|
+
if (!Array.isArray(parent.required)) {
|
|
2208
|
+
parent.required = [];
|
|
2209
|
+
}
|
|
2210
|
+
if (!parent.required.includes(key)) {
|
|
2211
|
+
parent.required.push(key);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
function buildJsonSchema(fields) {
|
|
2215
|
+
const root = {
|
|
2216
|
+
$schema: JSON_SCHEMA_DRAFT_2020_12,
|
|
2217
|
+
type: "object",
|
|
2218
|
+
properties: {}
|
|
2219
|
+
};
|
|
2220
|
+
for (const field of fields) {
|
|
2221
|
+
if (field.path.length === 0) {
|
|
2222
|
+
continue;
|
|
2223
|
+
}
|
|
2224
|
+
const parent = ensureSchemaNode(root, field.path.slice(0, -1));
|
|
2225
|
+
const leafKey = segmentToKey(field.path.at(-1) ?? "");
|
|
2226
|
+
parent.properties ??= {};
|
|
2227
|
+
const leafSchema = buildLeafSchema(field);
|
|
2228
|
+
const existing = parent.properties[leafKey];
|
|
2229
|
+
parent.properties[leafKey] = existing && typeof existing === "object" && !Array.isArray(existing) ? mergeLeafSchema(existing, leafSchema) : leafSchema;
|
|
2230
|
+
if (field.mandatory) {
|
|
2231
|
+
addRequired(parent, leafKey);
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return root;
|
|
2235
|
+
}
|
|
2236
|
+
function buildClaimsByNamespace(fields) {
|
|
2237
|
+
const byNamespace = {};
|
|
2238
|
+
for (const field of fields) {
|
|
2239
|
+
if (!field.namespace || !Object.prototype.hasOwnProperty.call(field, "defaultValue")) {
|
|
2240
|
+
continue;
|
|
2241
|
+
}
|
|
2242
|
+
if (!byNamespace[field.namespace]) {
|
|
2243
|
+
byNamespace[field.namespace] = {};
|
|
2244
|
+
}
|
|
2245
|
+
const namespaceTarget = byNamespace[field.namespace];
|
|
2246
|
+
const normalizedPath = field.path.length > 0 && segmentToKey(field.path[0] ?? "") === field.namespace ? field.path.slice(1) : field.path;
|
|
2247
|
+
setValueAtPath(namespaceTarget, normalizedPath, field.defaultValue);
|
|
2248
|
+
}
|
|
2249
|
+
return byNamespace;
|
|
2250
|
+
}
|
|
2251
|
+
function deriveRuntimeArtifacts(fields) {
|
|
2158
2252
|
return {
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2253
|
+
claims: buildClaims(fields),
|
|
2254
|
+
disclosureFrame: buildDisclosureFrame(fields),
|
|
2255
|
+
claimsMetadata: buildClaimsMetadata(fields),
|
|
2256
|
+
schema: buildJsonSchema(fields),
|
|
2257
|
+
claimsByNamespace: buildClaimsByNamespace(fields)
|
|
2162
2258
|
};
|
|
2163
2259
|
}
|
|
2164
2260
|
|
|
2165
|
-
export { EudiploClient, appControllerGetFrontendConfig, appControllerGetVersion, attributeProviderControllerCreate, attributeProviderControllerDelete, attributeProviderControllerGetAll, attributeProviderControllerGetById, attributeProviderControllerUpdate, cacheControllerClearAllCaches, cacheControllerClearStatusListCache, cacheControllerClearTrustListCache, cacheControllerGetStats,
|
|
2261
|
+
export { EudiploClient, appControllerGetFrontendConfig, appControllerGetVersion, attributeProviderControllerCreate, attributeProviderControllerDelete, attributeProviderControllerGetAll, attributeProviderControllerGetById, attributeProviderControllerUpdate, auditLogControllerGetAuditLogs, authControllerGetOAuth2Token, buildClaims, buildClaimsByNamespace, buildClaimsMetadata, buildDisclosureFrame, buildJsonSchema, cacheControllerClearAllCaches, cacheControllerClearStatusListCache, cacheControllerClearTrustListCache, cacheControllerGetStats, client, clientControllerCreateClient, clientControllerDeleteClient, clientControllerGetClient, clientControllerGetClientSecret, clientControllerGetClients, clientControllerRotateClientSecret, clientControllerUpdateClient, credentialConfigControllerDeleteIssuanceConfiguration, credentialConfigControllerGetConfigById, credentialConfigControllerGetConfigs, credentialConfigControllerStoreCredentialConfiguration, credentialConfigControllerUpdateCredentialConfiguration, credentialOfferControllerGetOffer, deferredControllerCompleteDeferred, deferredControllerFailDeferred, deriveRuntimeArtifacts, isDcApiAvailable, issuanceConfigControllerGetIssuanceConfigurations, issuanceConfigControllerStoreIssuanceConfiguration, keyChainControllerCreate, keyChainControllerDelete, keyChainControllerExport, keyChainControllerGetAll, keyChainControllerGetById, keyChainControllerGetProviders, keyChainControllerGetProvidersHealth, keyChainControllerImport, keyChainControllerRotate, keyChainControllerUpdate, presentationManagementControllerConfiguration, presentationManagementControllerDeleteConfiguration, presentationManagementControllerGetConfiguration, presentationManagementControllerListSchemaMetadataCatalog, presentationManagementControllerReissueRegistrationCertificate, presentationManagementControllerResolveIssuerMetadata, presentationManagementControllerResolveSchemaMetadata, presentationManagementControllerStorePresentationConfig, presentationManagementControllerUpdateConfiguration, registrarControllerCreateAccessCertificate, registrarControllerCreateConfig, registrarControllerDeleteConfig, registrarControllerGetConfig, registrarControllerUpdateConfig, schemaMetadataControllerDeprecateVersion, schemaMetadataControllerExport, schemaMetadataControllerFindAll, schemaMetadataControllerFindOne, schemaMetadataControllerGetJwt, schemaMetadataControllerGetLatest, schemaMetadataControllerGetSchema, schemaMetadataControllerGetVersions, schemaMetadataControllerGetVocabularies, schemaMetadataControllerRemove, schemaMetadataControllerSignSchemaMetaConfig, schemaMetadataControllerSignVersionSchemaMetaConfig, schemaMetadataControllerUpdate, sessionConfigControllerGetConfig, sessionConfigControllerResetConfig, sessionConfigControllerUpdateConfig, sessionControllerDeleteSession, sessionControllerGetAllSessions, sessionControllerGetSession, sessionControllerGetSessionLogs, sessionControllerRevokeAll, sessionEventsControllerSubscribeToSessionEvents, statusListConfigControllerGetConfig, statusListConfigControllerResetConfig, statusListConfigControllerUpdateConfig, statusListManagementControllerCreateList, statusListManagementControllerDeleteList, statusListManagementControllerGetList, statusListManagementControllerGetLists, statusListManagementControllerUpdateList, storageControllerUpload, tenantControllerDeleteTenant, tenantControllerGetTenant, tenantControllerGetTenants, tenantControllerInitTenant, tenantControllerUpdateTenant, trustListControllerCreateTrustList, trustListControllerDeleteTrustList, trustListControllerExportTrustList, trustListControllerGetAllTrustLists, trustListControllerGetTrustList, trustListControllerGetTrustListVersion, trustListControllerGetTrustListVersions, trustListControllerUpdateTrustList, userControllerCreateUser, userControllerDeleteUser, userControllerGetUser, userControllerGetUsers, userControllerUpdateUser, verifierOfferControllerGetOffer, webhookEndpointControllerCreate, webhookEndpointControllerDelete, webhookEndpointControllerGetAll, webhookEndpointControllerGetById, webhookEndpointControllerUpdate };
|
|
2166
2262
|
//# sourceMappingURL=index.mjs.map
|
|
2167
2263
|
//# sourceMappingURL=index.mjs.map
|