@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.78.280 → 0.34.1-feature.SSISDK.82.and.SSISDK.70.345
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +304 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +305 -111
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/digitalCredential.store.test.ts +116 -1
- package/src/digitalCredential/DigitalCredentialStore.ts +51 -13
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +6 -0
- package/src/migrations/generic/14-AddLinkedVpFields.ts +66 -0
- package/src/migrations/generic/index.ts +2 -1
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +1 -0
- package/src/migrations/postgres/1763387280001-AddLinkedVpFields.ts +29 -0
- package/src/migrations/sqlite/1763387280002-AddLinkedVpFields.ts +32 -0
- package/src/utils/digitalCredential/MappingUtils.ts +69 -2
package/dist/index.js
CHANGED
|
@@ -1922,6 +1922,8 @@ var DigitalCredentialEntity = class extends BaseEntity11 {
|
|
|
1922
1922
|
rpCorrelationId;
|
|
1923
1923
|
verifiedState;
|
|
1924
1924
|
tenantId;
|
|
1925
|
+
linkedVpId;
|
|
1926
|
+
linkedVpFrom;
|
|
1925
1927
|
createdAt;
|
|
1926
1928
|
presentedAt;
|
|
1927
1929
|
lastUpdatedAt;
|
|
@@ -2084,6 +2086,21 @@ _ts_decorate18([
|
|
|
2084
2086
|
}),
|
|
2085
2087
|
_ts_metadata17("design:type", String)
|
|
2086
2088
|
], DigitalCredentialEntity.prototype, "tenantId", void 0);
|
|
2089
|
+
_ts_decorate18([
|
|
2090
|
+
Column15("text", {
|
|
2091
|
+
name: "linked_vp_id",
|
|
2092
|
+
nullable: true
|
|
2093
|
+
}),
|
|
2094
|
+
_ts_metadata17("design:type", String)
|
|
2095
|
+
], DigitalCredentialEntity.prototype, "linkedVpId", void 0);
|
|
2096
|
+
_ts_decorate18([
|
|
2097
|
+
CreateDateColumn8({
|
|
2098
|
+
name: "linked_vp_from",
|
|
2099
|
+
nullable: true,
|
|
2100
|
+
type: typeOrmDateTime10()
|
|
2101
|
+
}),
|
|
2102
|
+
_ts_metadata17("design:type", typeof Date === "undefined" ? Object : Date)
|
|
2103
|
+
], DigitalCredentialEntity.prototype, "linkedVpFrom", void 0);
|
|
2087
2104
|
_ts_decorate18([
|
|
2088
2105
|
CreateDateColumn8({
|
|
2089
2106
|
name: "created_at",
|
|
@@ -5281,6 +5298,34 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5281
5298
|
total
|
|
5282
5299
|
};
|
|
5283
5300
|
}, "getCredentials");
|
|
5301
|
+
updateCredential = /* @__PURE__ */ __name(async (args) => {
|
|
5302
|
+
const dcRepo = await this.getRepository();
|
|
5303
|
+
const whereClause = {};
|
|
5304
|
+
if ("id" in args) {
|
|
5305
|
+
whereClause.id = args.id;
|
|
5306
|
+
} else if ("hash" in args) {
|
|
5307
|
+
whereClause.hash = args.hash;
|
|
5308
|
+
} else {
|
|
5309
|
+
return Promise.reject(Error("No id or hash param is provided."));
|
|
5310
|
+
}
|
|
5311
|
+
const credential = await dcRepo.findOne({
|
|
5312
|
+
where: whereClause
|
|
5313
|
+
});
|
|
5314
|
+
if (!credential) {
|
|
5315
|
+
return Promise.reject(Error(`No credential found for args: ${JSON.stringify(whereClause)}`));
|
|
5316
|
+
}
|
|
5317
|
+
const updates = Object.fromEntries(Object.entries(args).filter(([key]) => key !== "id" && key !== "hash"));
|
|
5318
|
+
const entityToSave = persistedDigitalCredentialEntityFromUpdateArgs(credential, updates);
|
|
5319
|
+
const validationError = this.assertValidDigitalCredential(entityToSave);
|
|
5320
|
+
if (validationError) {
|
|
5321
|
+
return Promise.reject(validationError);
|
|
5322
|
+
}
|
|
5323
|
+
debug2("Updating credential", entityToSave);
|
|
5324
|
+
const updatedResult = await dcRepo.save(entityToSave, {
|
|
5325
|
+
transaction: true
|
|
5326
|
+
});
|
|
5327
|
+
return digitalCredentialFrom(updatedResult);
|
|
5328
|
+
}, "updateCredential");
|
|
5284
5329
|
removeCredential = /* @__PURE__ */ __name(async (args) => {
|
|
5285
5330
|
if (!args) {
|
|
5286
5331
|
return false;
|
|
@@ -5351,20 +5396,9 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5351
5396
|
if (!credential) {
|
|
5352
5397
|
return Promise.reject(Error(`No credential found for args: ${JSON.stringify(whereClause)}`));
|
|
5353
5398
|
}
|
|
5354
|
-
const
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
verifiedAt: args.verifiedAt
|
|
5358
|
-
},
|
|
5359
|
-
...args.verifiedState === CredentialStateType2.REVOKED && {
|
|
5360
|
-
revokedAt: args.revokedAt
|
|
5361
|
-
},
|
|
5362
|
-
identifierMethod: credential.identifierMethod,
|
|
5363
|
-
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
5364
|
-
verifiedState: args.verifiedState
|
|
5365
|
-
};
|
|
5366
|
-
debug2("Updating credential", credential);
|
|
5367
|
-
const updatedResult = await credentialRepository.save(updatedCredential, {
|
|
5399
|
+
const entityToSave = persistedDigitalCredentialEntityFromStateArgs(credential, args);
|
|
5400
|
+
debug2("Updating credential state", entityToSave);
|
|
5401
|
+
const updatedResult = await credentialRepository.save(entityToSave, {
|
|
5368
5402
|
transaction: true
|
|
5369
5403
|
});
|
|
5370
5404
|
return digitalCredentialFrom(updatedResult);
|
|
@@ -7411,6 +7445,7 @@ var CreateBitstringStatusListPG1741895823000 = class {
|
|
|
7411
7445
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`);
|
|
7412
7446
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`);
|
|
7413
7447
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`);
|
|
7448
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`);
|
|
7414
7449
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`);
|
|
7415
7450
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`);
|
|
7416
7451
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`);
|
|
@@ -7748,32 +7783,148 @@ var CreateDcqlQueryItem1726617600000 = class {
|
|
|
7748
7783
|
}
|
|
7749
7784
|
};
|
|
7750
7785
|
|
|
7751
|
-
// src/migrations/generic/
|
|
7786
|
+
// src/migrations/generic/14-AddLinkedVpFields.ts
|
|
7752
7787
|
import Debug13 from "debug";
|
|
7788
|
+
|
|
7789
|
+
// src/migrations/postgres/1763387280001-AddLinkedVpFields.ts
|
|
7790
|
+
var AddLinkedVpFields1763387280001 = class {
|
|
7791
|
+
static {
|
|
7792
|
+
__name(this, "AddLinkedVpFields1763387280001");
|
|
7793
|
+
}
|
|
7794
|
+
name = "AddLinkedVpFields1763387280001";
|
|
7795
|
+
async up(queryRunner) {
|
|
7796
|
+
await queryRunner.query(`
|
|
7797
|
+
ALTER TABLE "DigitalCredential"
|
|
7798
|
+
ADD COLUMN "linked_vp_id" text
|
|
7799
|
+
`);
|
|
7800
|
+
await queryRunner.query(`
|
|
7801
|
+
ALTER TABLE "DigitalCredential"
|
|
7802
|
+
ADD COLUMN "linked_vp_from" TIMESTAMP
|
|
7803
|
+
`);
|
|
7804
|
+
}
|
|
7805
|
+
async down(queryRunner) {
|
|
7806
|
+
await queryRunner.query(`
|
|
7807
|
+
ALTER TABLE "DigitalCredential"
|
|
7808
|
+
DROP COLUMN "linked_vp_from"
|
|
7809
|
+
`);
|
|
7810
|
+
await queryRunner.query(`
|
|
7811
|
+
ALTER TABLE "DigitalCredential"
|
|
7812
|
+
DROP COLUMN "linked_vp_id"
|
|
7813
|
+
`);
|
|
7814
|
+
}
|
|
7815
|
+
};
|
|
7816
|
+
|
|
7817
|
+
// src/migrations/sqlite/1763387280002-AddLinkedVpFields.ts
|
|
7818
|
+
var AddLinkedVpFields1763387280002 = class {
|
|
7819
|
+
static {
|
|
7820
|
+
__name(this, "AddLinkedVpFields1763387280002");
|
|
7821
|
+
}
|
|
7822
|
+
name = "AddLinkedVpFields1763387280002";
|
|
7823
|
+
async up(queryRunner) {
|
|
7824
|
+
await queryRunner.query(`
|
|
7825
|
+
ALTER TABLE "DigitalCredential"
|
|
7826
|
+
ADD COLUMN "linked_vp_id" text
|
|
7827
|
+
`);
|
|
7828
|
+
await queryRunner.query(`
|
|
7829
|
+
ALTER TABLE "DigitalCredential"
|
|
7830
|
+
ADD COLUMN "linked_vp_from" datetime
|
|
7831
|
+
`);
|
|
7832
|
+
}
|
|
7833
|
+
async down(queryRunner) {
|
|
7834
|
+
await queryRunner.query(`
|
|
7835
|
+
ALTER TABLE "DigitalCredential"
|
|
7836
|
+
DROP COLUMN "linked_vp_from"
|
|
7837
|
+
`);
|
|
7838
|
+
await queryRunner.query(`
|
|
7839
|
+
ALTER TABLE "DigitalCredential"
|
|
7840
|
+
DROP COLUMN "linked_vp_id"
|
|
7841
|
+
`);
|
|
7842
|
+
}
|
|
7843
|
+
};
|
|
7844
|
+
|
|
7845
|
+
// src/migrations/generic/14-AddLinkedVpFields.ts
|
|
7753
7846
|
var debug13 = Debug13("sphereon:ssi-sdk:migrations");
|
|
7847
|
+
var AddLinkedVpFields1763387280000 = class {
|
|
7848
|
+
static {
|
|
7849
|
+
__name(this, "AddLinkedVpFields1763387280000");
|
|
7850
|
+
}
|
|
7851
|
+
name = "AddLinkedVpFields1763387280000";
|
|
7852
|
+
async up(queryRunner) {
|
|
7853
|
+
debug13("migration: adding linked VP fields to DigitalCredential table");
|
|
7854
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7855
|
+
switch (dbType) {
|
|
7856
|
+
case "postgres": {
|
|
7857
|
+
debug13("using postgres migration file for AddLinkedVpFields");
|
|
7858
|
+
const mig = new AddLinkedVpFields1763387280001();
|
|
7859
|
+
await mig.up(queryRunner);
|
|
7860
|
+
debug13("Postgres migration statements for AddLinkedVpFields executed");
|
|
7861
|
+
return;
|
|
7862
|
+
}
|
|
7863
|
+
case "sqlite":
|
|
7864
|
+
case "expo":
|
|
7865
|
+
case "react-native": {
|
|
7866
|
+
debug13("using sqlite/react-native migration file for AddLinkedVpFields");
|
|
7867
|
+
const mig = new AddLinkedVpFields1763387280002();
|
|
7868
|
+
await mig.up(queryRunner);
|
|
7869
|
+
debug13("SQLite migration statements for AddLinkedVpFields executed");
|
|
7870
|
+
return;
|
|
7871
|
+
}
|
|
7872
|
+
default:
|
|
7873
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for AddLinkedVpFields. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
7874
|
+
}
|
|
7875
|
+
}
|
|
7876
|
+
async down(queryRunner) {
|
|
7877
|
+
debug13("migration: reverting linked VP fields from DigitalCredential table");
|
|
7878
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7879
|
+
switch (dbType) {
|
|
7880
|
+
case "postgres": {
|
|
7881
|
+
debug13("using postgres migration file for AddLinkedVpFields");
|
|
7882
|
+
const mig = new AddLinkedVpFields1763387280001();
|
|
7883
|
+
await mig.down(queryRunner);
|
|
7884
|
+
debug13("Postgres migration statements for AddLinkedVpFields reverted");
|
|
7885
|
+
return;
|
|
7886
|
+
}
|
|
7887
|
+
case "sqlite":
|
|
7888
|
+
case "expo":
|
|
7889
|
+
case "react-native": {
|
|
7890
|
+
debug13("using sqlite/react-native migration file for AddLinkedVpFields");
|
|
7891
|
+
const mig = new AddLinkedVpFields1763387280002();
|
|
7892
|
+
await mig.down(queryRunner);
|
|
7893
|
+
debug13("SQLite migration statements for AddLinkedVpFields reverted");
|
|
7894
|
+
return;
|
|
7895
|
+
}
|
|
7896
|
+
default:
|
|
7897
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for AddLinkedVpFields. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
7898
|
+
}
|
|
7899
|
+
}
|
|
7900
|
+
};
|
|
7901
|
+
|
|
7902
|
+
// src/migrations/generic/2-CreateIssuanceBranding.ts
|
|
7903
|
+
import Debug14 from "debug";
|
|
7904
|
+
var debug14 = Debug14("sphereon:ssi-sdk:migrations");
|
|
7754
7905
|
var CreateIssuanceBranding1659463079429 = class {
|
|
7755
7906
|
static {
|
|
7756
7907
|
__name(this, "CreateIssuanceBranding1659463079429");
|
|
7757
7908
|
}
|
|
7758
7909
|
name = "CreateIssuanceBranding1659463079429";
|
|
7759
7910
|
async up(queryRunner) {
|
|
7760
|
-
|
|
7911
|
+
debug14("migration: creating issuance branding tables");
|
|
7761
7912
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7762
7913
|
switch (dbType) {
|
|
7763
7914
|
case "postgres": {
|
|
7764
|
-
|
|
7915
|
+
debug14("using postgres migration file");
|
|
7765
7916
|
const mig = new CreateIssuanceBranding1685628974232();
|
|
7766
7917
|
await mig.up(queryRunner);
|
|
7767
|
-
|
|
7918
|
+
debug14("Migration statements executed");
|
|
7768
7919
|
return;
|
|
7769
7920
|
}
|
|
7770
7921
|
case "sqlite":
|
|
7771
7922
|
case "expo":
|
|
7772
7923
|
case "react-native": {
|
|
7773
|
-
|
|
7924
|
+
debug14("using sqlite/react-native migration file");
|
|
7774
7925
|
const mig = new CreateIssuanceBranding1685628973231();
|
|
7775
7926
|
await mig.up(queryRunner);
|
|
7776
|
-
|
|
7927
|
+
debug14("Migration statements executed");
|
|
7777
7928
|
return;
|
|
7778
7929
|
}
|
|
7779
7930
|
default:
|
|
@@ -7781,23 +7932,23 @@ var CreateIssuanceBranding1659463079429 = class {
|
|
|
7781
7932
|
}
|
|
7782
7933
|
}
|
|
7783
7934
|
async down(queryRunner) {
|
|
7784
|
-
|
|
7935
|
+
debug14("migration: reverting issuance branding tables");
|
|
7785
7936
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7786
7937
|
switch (dbType) {
|
|
7787
7938
|
case "postgres": {
|
|
7788
|
-
|
|
7939
|
+
debug14("using postgres migration file");
|
|
7789
7940
|
const mig = new CreateIssuanceBranding1685628974232();
|
|
7790
7941
|
await mig.down(queryRunner);
|
|
7791
|
-
|
|
7942
|
+
debug14("Migration statements executed");
|
|
7792
7943
|
return;
|
|
7793
7944
|
}
|
|
7794
7945
|
case "sqlite":
|
|
7795
7946
|
case "expo":
|
|
7796
7947
|
case "react-native": {
|
|
7797
|
-
|
|
7948
|
+
debug14("using sqlite/react-native migration file");
|
|
7798
7949
|
const mig = new CreateIssuanceBranding1685628973231();
|
|
7799
7950
|
await mig.down(queryRunner);
|
|
7800
|
-
|
|
7951
|
+
debug14("Migration statements executed");
|
|
7801
7952
|
return;
|
|
7802
7953
|
}
|
|
7803
7954
|
default:
|
|
@@ -7807,7 +7958,7 @@ var CreateIssuanceBranding1659463079429 = class {
|
|
|
7807
7958
|
};
|
|
7808
7959
|
|
|
7809
7960
|
// src/migrations/generic/3-CreateContacts.ts
|
|
7810
|
-
import
|
|
7961
|
+
import Debug15 from "debug";
|
|
7811
7962
|
|
|
7812
7963
|
// src/migrations/postgres/1690925872592-CreateContacts.ts
|
|
7813
7964
|
import { enablePostgresUuidExtension as enablePostgresUuidExtension3 } from "@sphereon/ssi-sdk.core";
|
|
@@ -8028,30 +8179,30 @@ var CreateContacts1690925872693 = class {
|
|
|
8028
8179
|
};
|
|
8029
8180
|
|
|
8030
8181
|
// src/migrations/generic/3-CreateContacts.ts
|
|
8031
|
-
var
|
|
8182
|
+
var debug15 = Debug15("sphereon:ssi-sdk:migrations");
|
|
8032
8183
|
var CreateContacts1690925872318 = class {
|
|
8033
8184
|
static {
|
|
8034
8185
|
__name(this, "CreateContacts1690925872318");
|
|
8035
8186
|
}
|
|
8036
8187
|
name = "CreateContacts1690925872318";
|
|
8037
8188
|
async up(queryRunner) {
|
|
8038
|
-
|
|
8189
|
+
debug15("migration: creating contacts tables");
|
|
8039
8190
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8040
8191
|
switch (dbType) {
|
|
8041
8192
|
case "postgres": {
|
|
8042
|
-
|
|
8193
|
+
debug15("using postgres migration file");
|
|
8043
8194
|
const mig = new CreateContacts1690925872592();
|
|
8044
8195
|
await mig.up(queryRunner);
|
|
8045
|
-
|
|
8196
|
+
debug15("Migration statements executed");
|
|
8046
8197
|
return;
|
|
8047
8198
|
}
|
|
8048
8199
|
case "sqlite":
|
|
8049
8200
|
case "expo":
|
|
8050
8201
|
case "react-native": {
|
|
8051
|
-
|
|
8202
|
+
debug15("using sqlite/react-native migration file");
|
|
8052
8203
|
const mig = new CreateContacts1690925872693();
|
|
8053
8204
|
await mig.up(queryRunner);
|
|
8054
|
-
|
|
8205
|
+
debug15("Migration statements executed");
|
|
8055
8206
|
return;
|
|
8056
8207
|
}
|
|
8057
8208
|
default:
|
|
@@ -8059,23 +8210,23 @@ var CreateContacts1690925872318 = class {
|
|
|
8059
8210
|
}
|
|
8060
8211
|
}
|
|
8061
8212
|
async down(queryRunner) {
|
|
8062
|
-
|
|
8213
|
+
debug15("migration: reverting contacts tables");
|
|
8063
8214
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8064
8215
|
switch (dbType) {
|
|
8065
8216
|
case "postgres": {
|
|
8066
|
-
|
|
8217
|
+
debug15("using postgres migration file");
|
|
8067
8218
|
const mig = new CreateContacts1690925872592();
|
|
8068
8219
|
await mig.down(queryRunner);
|
|
8069
|
-
|
|
8220
|
+
debug15("Migration statements executed");
|
|
8070
8221
|
return;
|
|
8071
8222
|
}
|
|
8072
8223
|
case "sqlite":
|
|
8073
8224
|
case "expo":
|
|
8074
8225
|
case "react-native": {
|
|
8075
|
-
|
|
8226
|
+
debug15("using sqlite/react-native migration file");
|
|
8076
8227
|
const mig = new CreateContacts1690925872693();
|
|
8077
8228
|
await mig.down(queryRunner);
|
|
8078
|
-
|
|
8229
|
+
debug15("Migration statements executed");
|
|
8079
8230
|
return;
|
|
8080
8231
|
}
|
|
8081
8232
|
default:
|
|
@@ -8085,7 +8236,7 @@ var CreateContacts1690925872318 = class {
|
|
|
8085
8236
|
};
|
|
8086
8237
|
|
|
8087
8238
|
// src/migrations/generic/4-CreateStatusList.ts
|
|
8088
|
-
import
|
|
8239
|
+
import Debug16 from "debug";
|
|
8089
8240
|
|
|
8090
8241
|
// src/migrations/postgres/1693866470001-CreateStatusList.ts
|
|
8091
8242
|
var CreateStatusList1693866470001 = class {
|
|
@@ -8291,53 +8442,53 @@ var UpdateStatusList1737110469000 = class {
|
|
|
8291
8442
|
};
|
|
8292
8443
|
|
|
8293
8444
|
// src/migrations/generic/4-CreateStatusList.ts
|
|
8294
|
-
var
|
|
8445
|
+
var debug16 = Debug16("sphereon:ssi-sdk:migrations");
|
|
8295
8446
|
var CreateStatusList1693866470000 = class {
|
|
8296
8447
|
static {
|
|
8297
8448
|
__name(this, "CreateStatusList1693866470000");
|
|
8298
8449
|
}
|
|
8299
8450
|
name = "CreateStatusList1693866470000";
|
|
8300
8451
|
async up(queryRunner) {
|
|
8301
|
-
|
|
8452
|
+
debug16("migration: creating issuance branding tables");
|
|
8302
8453
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8303
8454
|
if (dbType === "postgres") {
|
|
8304
|
-
|
|
8455
|
+
debug16("using postgres migration files");
|
|
8305
8456
|
const createMig = new CreateStatusList1693866470001();
|
|
8306
8457
|
await createMig.up(queryRunner);
|
|
8307
8458
|
const updateMig = new UpdateStatusList1737110469001();
|
|
8308
8459
|
const up = await updateMig.up(queryRunner);
|
|
8309
|
-
|
|
8460
|
+
debug16("Migration statements executed");
|
|
8310
8461
|
return up;
|
|
8311
8462
|
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
8312
|
-
|
|
8463
|
+
debug16("using sqlite/react-native migration files");
|
|
8313
8464
|
const createMig = new CreateStatusList1693866470002();
|
|
8314
8465
|
await createMig.up(queryRunner);
|
|
8315
8466
|
const updateMig = new UpdateStatusList1737110469000();
|
|
8316
8467
|
const up = await updateMig.up(queryRunner);
|
|
8317
|
-
|
|
8468
|
+
debug16("Migration statements executed");
|
|
8318
8469
|
return up;
|
|
8319
8470
|
} else {
|
|
8320
8471
|
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
8321
8472
|
}
|
|
8322
8473
|
}
|
|
8323
8474
|
async down(queryRunner) {
|
|
8324
|
-
|
|
8475
|
+
debug16("migration: reverting issuance branding tables");
|
|
8325
8476
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8326
8477
|
if (dbType === "postgres") {
|
|
8327
|
-
|
|
8478
|
+
debug16("using postgres migration files");
|
|
8328
8479
|
const updateMig = new UpdateStatusList1737110469001();
|
|
8329
8480
|
await updateMig.down(queryRunner);
|
|
8330
8481
|
const createMig = new CreateStatusList1693866470001();
|
|
8331
8482
|
const down = await createMig.down(queryRunner);
|
|
8332
|
-
|
|
8483
|
+
debug16("Migration statements executed");
|
|
8333
8484
|
return down;
|
|
8334
8485
|
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
8335
|
-
|
|
8486
|
+
debug16("using sqlite/react-native migration files");
|
|
8336
8487
|
const updateMig = new UpdateStatusList1737110469000();
|
|
8337
8488
|
await updateMig.down(queryRunner);
|
|
8338
8489
|
const createMig = new CreateStatusList1693866470002();
|
|
8339
8490
|
const down = await createMig.down(queryRunner);
|
|
8340
|
-
|
|
8491
|
+
debug16("Migration statements executed");
|
|
8341
8492
|
return down;
|
|
8342
8493
|
} else {
|
|
8343
8494
|
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
@@ -8346,7 +8497,7 @@ var CreateStatusList1693866470000 = class {
|
|
|
8346
8497
|
};
|
|
8347
8498
|
|
|
8348
8499
|
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
8349
|
-
import
|
|
8500
|
+
import Debug17 from "debug";
|
|
8350
8501
|
|
|
8351
8502
|
// src/migrations/postgres/1701634812183-CreateAuditEvents.ts
|
|
8352
8503
|
var CreateAuditEvents1701634812183 = class {
|
|
@@ -8445,30 +8596,30 @@ var CreateAuditEvents1701634819487 = class {
|
|
|
8445
8596
|
};
|
|
8446
8597
|
|
|
8447
8598
|
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
8448
|
-
var
|
|
8599
|
+
var debug17 = Debug17("sphereon:ssi-sdk:migrations");
|
|
8449
8600
|
var CreateAuditEvents1701635835330 = class {
|
|
8450
8601
|
static {
|
|
8451
8602
|
__name(this, "CreateAuditEvents1701635835330");
|
|
8452
8603
|
}
|
|
8453
8604
|
name = "CreateAuditEvents1701635835330";
|
|
8454
8605
|
async up(queryRunner) {
|
|
8455
|
-
|
|
8606
|
+
debug17("migration: creating audit events tables");
|
|
8456
8607
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8457
8608
|
switch (dbType) {
|
|
8458
8609
|
case "postgres": {
|
|
8459
|
-
|
|
8610
|
+
debug17("using postgres migration file");
|
|
8460
8611
|
const mig = new CreateAuditEvents1701634812183();
|
|
8461
8612
|
await mig.up(queryRunner);
|
|
8462
|
-
|
|
8613
|
+
debug17("Migration statements executed");
|
|
8463
8614
|
return;
|
|
8464
8615
|
}
|
|
8465
8616
|
case "sqlite":
|
|
8466
8617
|
case "expo":
|
|
8467
8618
|
case "react-native": {
|
|
8468
|
-
|
|
8619
|
+
debug17("using sqlite/react-native migration file");
|
|
8469
8620
|
const mig = new CreateAuditEvents1701634819487();
|
|
8470
8621
|
await mig.up(queryRunner);
|
|
8471
|
-
|
|
8622
|
+
debug17("Migration statements executed");
|
|
8472
8623
|
return;
|
|
8473
8624
|
}
|
|
8474
8625
|
default:
|
|
@@ -8476,23 +8627,23 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8476
8627
|
}
|
|
8477
8628
|
}
|
|
8478
8629
|
async down(queryRunner) {
|
|
8479
|
-
|
|
8630
|
+
debug17("migration: reverting audit events tables");
|
|
8480
8631
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8481
8632
|
switch (dbType) {
|
|
8482
8633
|
case "postgres": {
|
|
8483
|
-
|
|
8634
|
+
debug17("using postgres migration file");
|
|
8484
8635
|
const mig = new CreateAuditEvents1701634812183();
|
|
8485
8636
|
await mig.down(queryRunner);
|
|
8486
|
-
|
|
8637
|
+
debug17("Migration statements executed");
|
|
8487
8638
|
return;
|
|
8488
8639
|
}
|
|
8489
8640
|
case "sqlite":
|
|
8490
8641
|
case "expo":
|
|
8491
8642
|
case "react-native": {
|
|
8492
|
-
|
|
8643
|
+
debug17("using sqlite/react-native migration file");
|
|
8493
8644
|
const mig = new CreateAuditEvents1701634819487();
|
|
8494
8645
|
await mig.down(queryRunner);
|
|
8495
|
-
|
|
8646
|
+
debug17("Migration statements executed");
|
|
8496
8647
|
return;
|
|
8497
8648
|
}
|
|
8498
8649
|
default:
|
|
@@ -8502,7 +8653,7 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8502
8653
|
};
|
|
8503
8654
|
|
|
8504
8655
|
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8505
|
-
import
|
|
8656
|
+
import Debug18 from "debug";
|
|
8506
8657
|
|
|
8507
8658
|
// src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
|
|
8508
8659
|
var CreateDigitalCredential1708525189001 = class {
|
|
@@ -8610,30 +8761,30 @@ var CreateDigitalCredential1708525189002 = class {
|
|
|
8610
8761
|
};
|
|
8611
8762
|
|
|
8612
8763
|
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8613
|
-
var
|
|
8764
|
+
var debug18 = Debug18("sphereon:ssi-sdk:migrations");
|
|
8614
8765
|
var CreateDigitalCredential1708525189000 = class {
|
|
8615
8766
|
static {
|
|
8616
8767
|
__name(this, "CreateDigitalCredential1708525189000");
|
|
8617
8768
|
}
|
|
8618
8769
|
name = "CreateDigitalCredential1708525189000";
|
|
8619
8770
|
async up(queryRunner) {
|
|
8620
|
-
|
|
8771
|
+
debug18("migration: creating DigitalCredential tables");
|
|
8621
8772
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8622
8773
|
switch (dbType) {
|
|
8623
8774
|
case "postgres": {
|
|
8624
|
-
|
|
8775
|
+
debug18("using postgres migration file for DigitalCredential");
|
|
8625
8776
|
const mig = new CreateDigitalCredential1708525189001();
|
|
8626
8777
|
await mig.up(queryRunner);
|
|
8627
|
-
|
|
8778
|
+
debug18("Postgres Migration statements for DigitalCredential executed");
|
|
8628
8779
|
return;
|
|
8629
8780
|
}
|
|
8630
8781
|
case "sqlite":
|
|
8631
8782
|
case "expo":
|
|
8632
8783
|
case "react-native": {
|
|
8633
|
-
|
|
8784
|
+
debug18("using sqlite/react-native migration file for DigitalCredential");
|
|
8634
8785
|
const mig = new CreateDigitalCredential1708525189002();
|
|
8635
8786
|
await mig.up(queryRunner);
|
|
8636
|
-
|
|
8787
|
+
debug18("SQLite Migration statements for DigitalCredential executed");
|
|
8637
8788
|
return;
|
|
8638
8789
|
}
|
|
8639
8790
|
default:
|
|
@@ -8641,23 +8792,23 @@ var CreateDigitalCredential1708525189000 = class {
|
|
|
8641
8792
|
}
|
|
8642
8793
|
}
|
|
8643
8794
|
async down(queryRunner) {
|
|
8644
|
-
|
|
8795
|
+
debug18("migration: reverting DigitalCredential tables");
|
|
8645
8796
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8646
8797
|
switch (dbType) {
|
|
8647
8798
|
case "postgres": {
|
|
8648
|
-
|
|
8799
|
+
debug18("using postgres migration file for DigitalCredential");
|
|
8649
8800
|
const mig = new CreateDigitalCredential1708525189001();
|
|
8650
8801
|
await mig.down(queryRunner);
|
|
8651
|
-
|
|
8802
|
+
debug18("Postgres Migration statements for DigitalCredential reverted");
|
|
8652
8803
|
return;
|
|
8653
8804
|
}
|
|
8654
8805
|
case "sqlite":
|
|
8655
8806
|
case "expo":
|
|
8656
8807
|
case "react-native": {
|
|
8657
|
-
|
|
8808
|
+
debug18("using sqlite/react-native migration file for DigitalCredential");
|
|
8658
8809
|
const mig = new CreateDigitalCredential1708525189002();
|
|
8659
8810
|
await mig.down(queryRunner);
|
|
8660
|
-
|
|
8811
|
+
debug18("SQLite Migration statements for DigitalCredential reverted");
|
|
8661
8812
|
return;
|
|
8662
8813
|
}
|
|
8663
8814
|
default:
|
|
@@ -8667,7 +8818,7 @@ var CreateDigitalCredential1708525189000 = class {
|
|
|
8667
8818
|
};
|
|
8668
8819
|
|
|
8669
8820
|
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
8670
|
-
import
|
|
8821
|
+
import Debug19 from "debug";
|
|
8671
8822
|
|
|
8672
8823
|
// src/migrations/postgres/1708797018115-CreateMachineStateStore.ts
|
|
8673
8824
|
var CreateMachineStateStore1708797018115 = class {
|
|
@@ -8729,30 +8880,30 @@ var CreateMachineStateStore1708796002272 = class {
|
|
|
8729
8880
|
};
|
|
8730
8881
|
|
|
8731
8882
|
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
8732
|
-
var
|
|
8883
|
+
var debug19 = Debug19("sphereon:ssi-sdk:migrations");
|
|
8733
8884
|
var CreateMachineStateStore1708098041262 = class {
|
|
8734
8885
|
static {
|
|
8735
8886
|
__name(this, "CreateMachineStateStore1708098041262");
|
|
8736
8887
|
}
|
|
8737
8888
|
name = "CreateMachineStateStore1708098041262";
|
|
8738
8889
|
async up(queryRunner) {
|
|
8739
|
-
|
|
8890
|
+
debug19("migration: creating machine state tables");
|
|
8740
8891
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8741
8892
|
switch (dbType) {
|
|
8742
8893
|
case "postgres": {
|
|
8743
|
-
|
|
8894
|
+
debug19("using postgres migration file");
|
|
8744
8895
|
const mig = new CreateMachineStateStore1708797018115();
|
|
8745
8896
|
await mig.up(queryRunner);
|
|
8746
|
-
|
|
8897
|
+
debug19("Migration statements executed");
|
|
8747
8898
|
return;
|
|
8748
8899
|
}
|
|
8749
8900
|
case "sqlite":
|
|
8750
8901
|
case "expo":
|
|
8751
8902
|
case "react-native": {
|
|
8752
|
-
|
|
8903
|
+
debug19("using sqlite/react-native migration file");
|
|
8753
8904
|
const mig = new CreateMachineStateStore1708796002272();
|
|
8754
8905
|
await mig.up(queryRunner);
|
|
8755
|
-
|
|
8906
|
+
debug19("Migration statements executed");
|
|
8756
8907
|
return;
|
|
8757
8908
|
}
|
|
8758
8909
|
default:
|
|
@@ -8760,23 +8911,23 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8760
8911
|
}
|
|
8761
8912
|
}
|
|
8762
8913
|
async down(queryRunner) {
|
|
8763
|
-
|
|
8914
|
+
debug19("migration: reverting machine state tables");
|
|
8764
8915
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8765
8916
|
switch (dbType) {
|
|
8766
8917
|
case "postgres": {
|
|
8767
|
-
|
|
8918
|
+
debug19("using postgres migration file");
|
|
8768
8919
|
const mig = new CreateMachineStateStore1708797018115();
|
|
8769
8920
|
await mig.down(queryRunner);
|
|
8770
|
-
|
|
8921
|
+
debug19("Migration statements executed");
|
|
8771
8922
|
return;
|
|
8772
8923
|
}
|
|
8773
8924
|
case "sqlite":
|
|
8774
8925
|
case "expo":
|
|
8775
8926
|
case "react-native": {
|
|
8776
|
-
|
|
8927
|
+
debug19("using sqlite/react-native migration file");
|
|
8777
8928
|
const mig = new CreateMachineStateStore1708796002272();
|
|
8778
8929
|
await mig.down(queryRunner);
|
|
8779
|
-
|
|
8930
|
+
debug19("Migration statements executed");
|
|
8780
8931
|
return;
|
|
8781
8932
|
}
|
|
8782
8933
|
default:
|
|
@@ -8786,7 +8937,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8786
8937
|
};
|
|
8787
8938
|
|
|
8788
8939
|
// src/migrations/generic/8-CreateContacts.ts
|
|
8789
|
-
import
|
|
8940
|
+
import Debug20 from "debug";
|
|
8790
8941
|
|
|
8791
8942
|
// src/migrations/postgres/1710438363001-CreateContacts.ts
|
|
8792
8943
|
var CreateContacts1710438363001 = class {
|
|
@@ -8900,30 +9051,30 @@ var CreateContacts1710438363002 = class {
|
|
|
8900
9051
|
};
|
|
8901
9052
|
|
|
8902
9053
|
// src/migrations/generic/8-CreateContacts.ts
|
|
8903
|
-
var
|
|
9054
|
+
var debug20 = Debug20("sphereon:ssi-sdk:migrations");
|
|
8904
9055
|
var CreateContacts1708525189000 = class {
|
|
8905
9056
|
static {
|
|
8906
9057
|
__name(this, "CreateContacts1708525189000");
|
|
8907
9058
|
}
|
|
8908
9059
|
name = "CreateContacts1708525189000";
|
|
8909
9060
|
async up(queryRunner) {
|
|
8910
|
-
|
|
9061
|
+
debug20("migration: updating contact tables");
|
|
8911
9062
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8912
9063
|
switch (dbType) {
|
|
8913
9064
|
case "postgres": {
|
|
8914
|
-
|
|
9065
|
+
debug20("using postgres migration file");
|
|
8915
9066
|
const mig = new CreateContacts1710438363001();
|
|
8916
9067
|
await mig.up(queryRunner);
|
|
8917
|
-
|
|
9068
|
+
debug20("Migration statements executed");
|
|
8918
9069
|
return;
|
|
8919
9070
|
}
|
|
8920
9071
|
case "sqlite":
|
|
8921
9072
|
case "expo":
|
|
8922
9073
|
case "react-native": {
|
|
8923
|
-
|
|
9074
|
+
debug20("using sqlite/react-native migration file");
|
|
8924
9075
|
const mig = new CreateContacts1710438363002();
|
|
8925
9076
|
await mig.up(queryRunner);
|
|
8926
|
-
|
|
9077
|
+
debug20("Migration statements executed");
|
|
8927
9078
|
return;
|
|
8928
9079
|
}
|
|
8929
9080
|
default:
|
|
@@ -8931,23 +9082,23 @@ var CreateContacts1708525189000 = class {
|
|
|
8931
9082
|
}
|
|
8932
9083
|
}
|
|
8933
9084
|
async down(queryRunner) {
|
|
8934
|
-
|
|
9085
|
+
debug20("migration: reverting machine state tables");
|
|
8935
9086
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8936
9087
|
switch (dbType) {
|
|
8937
9088
|
case "postgres": {
|
|
8938
|
-
|
|
9089
|
+
debug20("using postgres migration file");
|
|
8939
9090
|
const mig = new CreateContacts1710438363001();
|
|
8940
9091
|
await mig.down(queryRunner);
|
|
8941
|
-
|
|
9092
|
+
debug20("Migration statements executed");
|
|
8942
9093
|
return;
|
|
8943
9094
|
}
|
|
8944
9095
|
case "sqlite":
|
|
8945
9096
|
case "expo":
|
|
8946
9097
|
case "react-native": {
|
|
8947
|
-
|
|
9098
|
+
debug20("using sqlite/react-native migration file");
|
|
8948
9099
|
const mig = new CreateContacts1710438363002();
|
|
8949
9100
|
await mig.down(queryRunner);
|
|
8950
|
-
|
|
9101
|
+
debug20("Migration statements executed");
|
|
8951
9102
|
return;
|
|
8952
9103
|
}
|
|
8953
9104
|
default:
|
|
@@ -8957,7 +9108,7 @@ var CreateContacts1708525189000 = class {
|
|
|
8957
9108
|
};
|
|
8958
9109
|
|
|
8959
9110
|
// src/migrations/generic/9-CreateContacts.ts
|
|
8960
|
-
import
|
|
9111
|
+
import Debug21 from "debug";
|
|
8961
9112
|
|
|
8962
9113
|
// src/migrations/postgres/1715761125001-CreateContacts.ts
|
|
8963
9114
|
var CreateContacts1715761125001 = class {
|
|
@@ -9069,30 +9220,30 @@ var CreateContacts1715761125002 = class {
|
|
|
9069
9220
|
};
|
|
9070
9221
|
|
|
9071
9222
|
// src/migrations/generic/9-CreateContacts.ts
|
|
9072
|
-
var
|
|
9223
|
+
var debug21 = Debug21("sphereon:ssi-sdk:migrations");
|
|
9073
9224
|
var CreateContacts1715761125000 = class {
|
|
9074
9225
|
static {
|
|
9075
9226
|
__name(this, "CreateContacts1715761125000");
|
|
9076
9227
|
}
|
|
9077
9228
|
name = "CreateContacts1715761125000";
|
|
9078
9229
|
async up(queryRunner) {
|
|
9079
|
-
|
|
9230
|
+
debug21("migration: updating contact tables");
|
|
9080
9231
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9081
9232
|
switch (dbType) {
|
|
9082
9233
|
case "postgres": {
|
|
9083
|
-
|
|
9234
|
+
debug21("using postgres migration file");
|
|
9084
9235
|
const mig = new CreateContacts1715761125001();
|
|
9085
9236
|
await mig.up(queryRunner);
|
|
9086
|
-
|
|
9237
|
+
debug21("Migration statements executed");
|
|
9087
9238
|
return;
|
|
9088
9239
|
}
|
|
9089
9240
|
case "sqlite":
|
|
9090
9241
|
case "expo":
|
|
9091
9242
|
case "react-native": {
|
|
9092
|
-
|
|
9243
|
+
debug21("using sqlite/react-native migration file");
|
|
9093
9244
|
const mig = new CreateContacts1715761125002();
|
|
9094
9245
|
await mig.up(queryRunner);
|
|
9095
|
-
|
|
9246
|
+
debug21("Migration statements executed");
|
|
9096
9247
|
return;
|
|
9097
9248
|
}
|
|
9098
9249
|
default:
|
|
@@ -9100,23 +9251,23 @@ var CreateContacts1715761125000 = class {
|
|
|
9100
9251
|
}
|
|
9101
9252
|
}
|
|
9102
9253
|
async down(queryRunner) {
|
|
9103
|
-
|
|
9254
|
+
debug21("migration: reverting machine state tables");
|
|
9104
9255
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9105
9256
|
switch (dbType) {
|
|
9106
9257
|
case "postgres": {
|
|
9107
|
-
|
|
9258
|
+
debug21("using postgres migration file");
|
|
9108
9259
|
const mig = new CreateContacts1715761125001();
|
|
9109
9260
|
await mig.down(queryRunner);
|
|
9110
|
-
|
|
9261
|
+
debug21("Migration statements executed");
|
|
9111
9262
|
return;
|
|
9112
9263
|
}
|
|
9113
9264
|
case "sqlite":
|
|
9114
9265
|
case "expo":
|
|
9115
9266
|
case "react-native": {
|
|
9116
|
-
|
|
9267
|
+
debug21("using sqlite/react-native migration file");
|
|
9117
9268
|
const mig = new CreateContacts1715761125002();
|
|
9118
9269
|
await mig.down(queryRunner);
|
|
9119
|
-
|
|
9270
|
+
debug21("Migration statements executed");
|
|
9120
9271
|
return;
|
|
9121
9272
|
}
|
|
9122
9273
|
default:
|
|
@@ -9145,7 +9296,8 @@ var DataStoreEventLoggerMigrations = [
|
|
|
9145
9296
|
CreateAuditEvents1701635835330
|
|
9146
9297
|
];
|
|
9147
9298
|
var DataStoreDigitalCredentialMigrations = [
|
|
9148
|
-
CreateDigitalCredential1708525189000
|
|
9299
|
+
CreateDigitalCredential1708525189000,
|
|
9300
|
+
AddLinkedVpFields1763387280000
|
|
9149
9301
|
];
|
|
9150
9302
|
var DataStoreMachineStateMigrations = [
|
|
9151
9303
|
CreateMachineStateStore1708098041262
|
|
@@ -9166,7 +9318,7 @@ var DataStoreMigrations = [
|
|
|
9166
9318
|
|
|
9167
9319
|
// src/utils/digitalCredential/MappingUtils.ts
|
|
9168
9320
|
import { defaultHasher } from "@sphereon/ssi-sdk.core";
|
|
9169
|
-
import { CredentialDocumentFormat as CredentialDocumentFormat2, DocumentType as DocumentType2, RegulationType as RegulationType2 } from "@sphereon/ssi-sdk.data-store-types";
|
|
9321
|
+
import { CredentialDocumentFormat as CredentialDocumentFormat2, CredentialStateType as CredentialStateType3, DocumentType as DocumentType2, RegulationType as RegulationType2 } from "@sphereon/ssi-sdk.data-store-types";
|
|
9170
9322
|
import { CredentialMapper, DocumentFormat, ObjectUtils } from "@sphereon/ssi-types";
|
|
9171
9323
|
import { computeEntryHash } from "@veramo/utils";
|
|
9172
9324
|
function determineDocumentType(raw) {
|
|
@@ -9217,6 +9369,18 @@ function determineCredentialDocumentFormat(documentFormat) {
|
|
|
9217
9369
|
}
|
|
9218
9370
|
}
|
|
9219
9371
|
__name(determineCredentialDocumentFormat, "determineCredentialDocumentFormat");
|
|
9372
|
+
function normalizeNullableFields(obj, nullableKeys) {
|
|
9373
|
+
const normalized = {
|
|
9374
|
+
...obj
|
|
9375
|
+
};
|
|
9376
|
+
for (const key of nullableKeys) {
|
|
9377
|
+
if (normalized[key] === void 0) {
|
|
9378
|
+
normalized[key] = null;
|
|
9379
|
+
}
|
|
9380
|
+
}
|
|
9381
|
+
return normalized;
|
|
9382
|
+
}
|
|
9383
|
+
__name(normalizeNullableFields, "normalizeNullableFields");
|
|
9220
9384
|
function getValidUntil(uniformDocument) {
|
|
9221
9385
|
if ("expirationDate" in uniformDocument && uniformDocument.expirationDate) {
|
|
9222
9386
|
return new Date(uniformDocument.expirationDate);
|
|
@@ -9279,6 +9443,33 @@ var nonPersistedDigitalCredentialEntityFromAddArgs = /* @__PURE__ */ __name((add
|
|
|
9279
9443
|
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
9280
9444
|
};
|
|
9281
9445
|
}, "nonPersistedDigitalCredentialEntityFromAddArgs");
|
|
9446
|
+
var persistedDigitalCredentialEntityFromUpdateArgs = /* @__PURE__ */ __name((existingCredential, updates) => {
|
|
9447
|
+
const entity = new DigitalCredentialEntity();
|
|
9448
|
+
Object.assign(entity, existingCredential);
|
|
9449
|
+
const normalizedUpdates = normalizeNullableFields(updates, [
|
|
9450
|
+
"linkedVpId",
|
|
9451
|
+
"linkedVpFrom"
|
|
9452
|
+
]);
|
|
9453
|
+
Object.assign(entity, normalizedUpdates);
|
|
9454
|
+
entity.id = existingCredential.id;
|
|
9455
|
+
entity.hash = existingCredential.hash;
|
|
9456
|
+
entity.createdAt = existingCredential.createdAt;
|
|
9457
|
+
entity.lastUpdatedAt = /* @__PURE__ */ new Date();
|
|
9458
|
+
return entity;
|
|
9459
|
+
}, "persistedDigitalCredentialEntityFromUpdateArgs");
|
|
9460
|
+
var persistedDigitalCredentialEntityFromStateArgs = /* @__PURE__ */ __name((existingCredential, args) => {
|
|
9461
|
+
const entity = new DigitalCredentialEntity();
|
|
9462
|
+
Object.assign(entity, existingCredential);
|
|
9463
|
+
entity.verifiedState = args.verifiedState;
|
|
9464
|
+
entity.lastUpdatedAt = /* @__PURE__ */ new Date();
|
|
9465
|
+
if (args.verifiedState === CredentialStateType3.REVOKED && args.revokedAt) {
|
|
9466
|
+
entity.revokedAt = args.revokedAt;
|
|
9467
|
+
}
|
|
9468
|
+
if (args.verifiedState !== CredentialStateType3.REVOKED && args.verifiedAt) {
|
|
9469
|
+
entity.verifiedAt = args.verifiedAt;
|
|
9470
|
+
}
|
|
9471
|
+
return entity;
|
|
9472
|
+
}, "persistedDigitalCredentialEntityFromStateArgs");
|
|
9282
9473
|
var digitalCredentialFrom = /* @__PURE__ */ __name((credentialEntity) => {
|
|
9283
9474
|
const result = {
|
|
9284
9475
|
...credentialEntity
|
|
@@ -9455,6 +9646,7 @@ export {
|
|
|
9455
9646
|
naturalPersonEntityFrom,
|
|
9456
9647
|
naturalPersonFrom,
|
|
9457
9648
|
nonPersistedDigitalCredentialEntityFromAddArgs,
|
|
9649
|
+
normalizeNullableFields,
|
|
9458
9650
|
openIdConfigEntityFrom,
|
|
9459
9651
|
openIdConfigFrom,
|
|
9460
9652
|
organizationEntityFrom,
|
|
@@ -9466,6 +9658,8 @@ export {
|
|
|
9466
9658
|
partyRelationshipFrom,
|
|
9467
9659
|
partyTypeEntityFrom,
|
|
9468
9660
|
partyTypeFrom,
|
|
9661
|
+
persistedDigitalCredentialEntityFromStateArgs,
|
|
9662
|
+
persistedDigitalCredentialEntityFromUpdateArgs,
|
|
9469
9663
|
physicalAddressEntityFrom,
|
|
9470
9664
|
physicalAddressFrom,
|
|
9471
9665
|
textAttributesEntityFrom
|