@sphereon/ssi-sdk.data-store 0.34.1-fix.114 → 0.34.1-fix.141
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 +1606 -1399
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -166
- package/dist/index.d.ts +160 -166
- package/dist/index.js +1562 -1355
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/contact.entities.test.ts +2 -2
- package/src/__tests__/contact.store.test.ts +1 -1
- package/src/__tests__/digitalCredential.entities.test.ts +2 -1
- package/src/__tests__/digitalCredential.store.test.ts +5 -5
- package/src/__tests__/pd-manager.entities.test.ts +14 -37
- package/src/__tests__/pd-manager.store.test.ts +133 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +9 -9
- package/src/entities/contact/IdentityEntity.ts +2 -1
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +2 -1
- package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +1 -1
- package/src/migrations/generic/12-CreateBitstringStatusList.ts +32 -2
- package/src/migrations/generic/13-UpdatePresentationDefinitionItemNullable.ts +67 -0
- package/src/migrations/generic/index.ts +13 -5
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +13 -2
- package/src/migrations/postgres/1756975509000-UpdatePresentationDefinitionItemNullable.ts +15 -0
- package/src/migrations/sqlite/1756975340000-UpdatePresentationDefinitionItemNullable.ts +77 -0
- package/src/presentationDefinition/PDStore.ts +6 -1
- package/src/types/contact/contact.ts +1 -1
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +2 -1
- package/src/types/digitalCredential/enums.ts +0 -7
- package/src/types/digitalCredential/types.ts +2 -1
- package/src/types/presentationDefinition/presentationDefinition.ts +3 -3
- package/src/utils/presentationDefinition/MappingUtils.ts +39 -10
package/dist/index.cjs
CHANGED
|
@@ -54,7 +54,6 @@ __export(index_exports, {
|
|
|
54
54
|
CredentialCorrelationType: () => CredentialCorrelationType,
|
|
55
55
|
CredentialDocumentFormat: () => CredentialDocumentFormat,
|
|
56
56
|
CredentialLocaleBrandingEntity: () => CredentialLocaleBrandingEntity,
|
|
57
|
-
CredentialRole: () => CredentialRole,
|
|
58
57
|
CredentialStateType: () => CredentialStateType,
|
|
59
58
|
DataStoreContactEntities: () => DataStoreContactEntities,
|
|
60
59
|
DataStoreContactMigrations: () => DataStoreContactMigrations,
|
|
@@ -262,13 +261,6 @@ var CredentialCorrelationType = /* @__PURE__ */ (function(CredentialCorrelationT
|
|
|
262
261
|
CredentialCorrelationType2["URL"] = "URL";
|
|
263
262
|
return CredentialCorrelationType2;
|
|
264
263
|
})({});
|
|
265
|
-
var CredentialRole = /* @__PURE__ */ (function(CredentialRole2) {
|
|
266
|
-
CredentialRole2["ISSUER"] = "ISSUER";
|
|
267
|
-
CredentialRole2["VERIFIER"] = "VERIFIER";
|
|
268
|
-
CredentialRole2["HOLDER"] = "HOLDER";
|
|
269
|
-
CredentialRole2["FEDERATION_TRUST_ANCHOR"] = "FEDERATION_TRUST_ANCHOR";
|
|
270
|
-
return CredentialRole2;
|
|
271
|
-
})({});
|
|
272
264
|
var CredentialStateType = /* @__PURE__ */ (function(CredentialStateType2) {
|
|
273
265
|
CredentialStateType2["REVOKED"] = "REVOKED";
|
|
274
266
|
CredentialStateType2["VERIFIED"] = "VERIFIED";
|
|
@@ -3935,6 +3927,7 @@ AuditEventEntity = _ts_decorate32([
|
|
|
3935
3927
|
|
|
3936
3928
|
// src/entities/digitalCredential/DigitalCredentialEntity.ts
|
|
3937
3929
|
var import_ssi_sdk17 = require("@sphereon/ssi-sdk.agent-config");
|
|
3930
|
+
var import_ssi_types3 = require("@sphereon/ssi-types");
|
|
3938
3931
|
var import_typeorm32 = require("typeorm");
|
|
3939
3932
|
function _ts_decorate33(decorators, target, key, desc) {
|
|
3940
3933
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4018,10 +4011,10 @@ _ts_decorate33([
|
|
|
4018
4011
|
_ts_decorate33([
|
|
4019
4012
|
(0, import_typeorm32.Column)("simple-enum", {
|
|
4020
4013
|
name: "credential_role",
|
|
4021
|
-
enum: CredentialRole,
|
|
4014
|
+
enum: import_ssi_types3.CredentialRole,
|
|
4022
4015
|
nullable: false
|
|
4023
4016
|
}),
|
|
4024
|
-
_ts_metadata32("design:type", typeof CredentialRole === "undefined" ? Object : CredentialRole)
|
|
4017
|
+
_ts_metadata32("design:type", typeof import_ssi_types3.CredentialRole === "undefined" ? Object : import_ssi_types3.CredentialRole)
|
|
4025
4018
|
], DigitalCredentialEntity.prototype, "credentialRole", void 0);
|
|
4026
4019
|
_ts_decorate33([
|
|
4027
4020
|
(0, import_typeorm32.Column)("text", {
|
|
@@ -4292,7 +4285,7 @@ _ts_decorate34([
|
|
|
4292
4285
|
(0, import_typeorm33.Column)({
|
|
4293
4286
|
name: "definition_payload",
|
|
4294
4287
|
type: "text",
|
|
4295
|
-
nullable:
|
|
4288
|
+
nullable: true,
|
|
4296
4289
|
unique: false
|
|
4297
4290
|
}),
|
|
4298
4291
|
(0, import_class_validator21.IsNotEmpty)({
|
|
@@ -5512,6 +5505,7 @@ var AbstractDigitalCredentialStore = class {
|
|
|
5512
5505
|
};
|
|
5513
5506
|
|
|
5514
5507
|
// src/digitalCredential/DigitalCredentialStore.ts
|
|
5508
|
+
var import_ssi_types4 = require("@sphereon/ssi-types");
|
|
5515
5509
|
var import_debug2 = __toESM(require("debug"), 1);
|
|
5516
5510
|
|
|
5517
5511
|
// src/utils/SortingUtils.ts
|
|
@@ -5581,7 +5575,7 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5581
5575
|
if (!args) {
|
|
5582
5576
|
return false;
|
|
5583
5577
|
}
|
|
5584
|
-
|
|
5578
|
+
const query = {};
|
|
5585
5579
|
if ("id" in args) {
|
|
5586
5580
|
query.id = args.id;
|
|
5587
5581
|
} else if ("hash" in args) {
|
|
@@ -5667,7 +5661,7 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5667
5661
|
}, "updateCredentialState");
|
|
5668
5662
|
assertValidDigitalCredential(credentialEntity) {
|
|
5669
5663
|
const { kmsKeyRef, identifierMethod, credentialRole, isIssuerSigned } = credentialEntity;
|
|
5670
|
-
const isRoleInvalid = credentialRole === CredentialRole.ISSUER || credentialRole === CredentialRole.HOLDER && !isIssuerSigned;
|
|
5664
|
+
const isRoleInvalid = credentialRole === import_ssi_types4.CredentialRole.ISSUER || credentialRole === import_ssi_types4.CredentialRole.HOLDER && !isIssuerSigned;
|
|
5671
5665
|
if (isRoleInvalid && (!kmsKeyRef || !identifierMethod)) {
|
|
5672
5666
|
const missingFields = [];
|
|
5673
5667
|
if (!kmsKeyRef) missingFields.push("kmsKeyRef");
|
|
@@ -6181,41 +6175,41 @@ var IssuanceBrandingStore = class extends AbstractIssuanceBrandingStore {
|
|
|
6181
6175
|
};
|
|
6182
6176
|
|
|
6183
6177
|
// src/statusList/StatusListStore.ts
|
|
6184
|
-
var
|
|
6178
|
+
var import_ssi_types6 = require("@sphereon/ssi-types");
|
|
6185
6179
|
var import_debug4 = __toESM(require("debug"), 1);
|
|
6186
6180
|
var import_typeorm37 = require("typeorm");
|
|
6187
6181
|
|
|
6188
6182
|
// src/utils/statusList/MappingUtils.ts
|
|
6189
|
-
var
|
|
6183
|
+
var import_ssi_types5 = require("@sphereon/ssi-types");
|
|
6190
6184
|
var statusListEntityFrom = /* @__PURE__ */ __name((args) => {
|
|
6191
6185
|
switch (args.type) {
|
|
6192
|
-
case
|
|
6186
|
+
case import_ssi_types5.StatusListType.StatusList2021: {
|
|
6193
6187
|
const entity = new StatusList2021Entity();
|
|
6194
6188
|
const sl2021 = args;
|
|
6195
6189
|
entity.indexingDirection = sl2021.indexingDirection;
|
|
6196
6190
|
entity.statusPurpose = sl2021.statusPurpose;
|
|
6197
6191
|
setBaseFields(entity, args);
|
|
6198
6192
|
Object.defineProperty(entity, "type", {
|
|
6199
|
-
value:
|
|
6193
|
+
value: import_ssi_types5.StatusListType.StatusList2021,
|
|
6200
6194
|
enumerable: true,
|
|
6201
6195
|
configurable: true
|
|
6202
6196
|
});
|
|
6203
6197
|
return entity;
|
|
6204
6198
|
}
|
|
6205
|
-
case
|
|
6199
|
+
case import_ssi_types5.StatusListType.OAuthStatusList: {
|
|
6206
6200
|
const entity = new OAuthStatusListEntity();
|
|
6207
6201
|
const oauthSl = args;
|
|
6208
6202
|
entity.bitsPerStatus = oauthSl.bitsPerStatus;
|
|
6209
6203
|
entity.expiresAt = oauthSl.expiresAt;
|
|
6210
6204
|
setBaseFields(entity, args);
|
|
6211
6205
|
Object.defineProperty(entity, "type", {
|
|
6212
|
-
value:
|
|
6206
|
+
value: import_ssi_types5.StatusListType.OAuthStatusList,
|
|
6213
6207
|
enumerable: true,
|
|
6214
6208
|
configurable: true
|
|
6215
6209
|
});
|
|
6216
6210
|
return entity;
|
|
6217
6211
|
}
|
|
6218
|
-
case
|
|
6212
|
+
case import_ssi_types5.StatusListType.BitstringStatusList: {
|
|
6219
6213
|
const entity = new BitstringStatusListEntity();
|
|
6220
6214
|
const bitstringsl = args;
|
|
6221
6215
|
if (!bitstringsl.bitsPerStatus) {
|
|
@@ -6228,7 +6222,7 @@ var statusListEntityFrom = /* @__PURE__ */ __name((args) => {
|
|
|
6228
6222
|
entity.ttl = bitstringsl.ttl;
|
|
6229
6223
|
setBaseFields(entity, args);
|
|
6230
6224
|
Object.defineProperty(entity, "type", {
|
|
6231
|
-
value:
|
|
6225
|
+
value: import_ssi_types5.StatusListType.BitstringStatusList,
|
|
6232
6226
|
enumerable: true,
|
|
6233
6227
|
configurable: true
|
|
6234
6228
|
});
|
|
@@ -6242,7 +6236,7 @@ var statusListFrom = /* @__PURE__ */ __name((entity) => {
|
|
|
6242
6236
|
if (entity instanceof StatusList2021Entity) {
|
|
6243
6237
|
const result = {
|
|
6244
6238
|
...getBaseFields(entity),
|
|
6245
|
-
type:
|
|
6239
|
+
type: import_ssi_types5.StatusListType.StatusList2021,
|
|
6246
6240
|
indexingDirection: entity.indexingDirection,
|
|
6247
6241
|
statusPurpose: entity.statusPurpose
|
|
6248
6242
|
};
|
|
@@ -6251,7 +6245,7 @@ var statusListFrom = /* @__PURE__ */ __name((entity) => {
|
|
|
6251
6245
|
if (entity instanceof OAuthStatusListEntity) {
|
|
6252
6246
|
const result = {
|
|
6253
6247
|
...getBaseFields(entity),
|
|
6254
|
-
type:
|
|
6248
|
+
type: import_ssi_types5.StatusListType.OAuthStatusList,
|
|
6255
6249
|
bitsPerStatus: entity.bitsPerStatus,
|
|
6256
6250
|
expiresAt: entity.expiresAt
|
|
6257
6251
|
};
|
|
@@ -6260,7 +6254,7 @@ var statusListFrom = /* @__PURE__ */ __name((entity) => {
|
|
|
6260
6254
|
if (entity instanceof BitstringStatusListEntity) {
|
|
6261
6255
|
const result = {
|
|
6262
6256
|
...getBaseFields(entity),
|
|
6263
|
-
type:
|
|
6257
|
+
type: import_ssi_types5.StatusListType.BitstringStatusList,
|
|
6264
6258
|
statusPurpose: entity.statusPurpose,
|
|
6265
6259
|
bitsPerStatus: entity.bitsPerStatus,
|
|
6266
6260
|
validFrom: entity.validFrom,
|
|
@@ -6581,11 +6575,11 @@ var StatusListStore = class {
|
|
|
6581
6575
|
async getStatusListRepo(type) {
|
|
6582
6576
|
const dataSource = await this.getDS();
|
|
6583
6577
|
switch (type) {
|
|
6584
|
-
case
|
|
6578
|
+
case import_ssi_types6.StatusListType.StatusList2021:
|
|
6585
6579
|
return dataSource.getRepository(StatusList2021Entity);
|
|
6586
|
-
case
|
|
6580
|
+
case import_ssi_types6.StatusListType.OAuthStatusList:
|
|
6587
6581
|
return dataSource.getRepository(OAuthStatusListEntity);
|
|
6588
|
-
case
|
|
6582
|
+
case import_ssi_types6.StatusListType.BitstringStatusList:
|
|
6589
6583
|
return dataSource.getRepository(BitstringStatusListEntity);
|
|
6590
6584
|
default:
|
|
6591
6585
|
return dataSource.getRepository(StatusListEntity);
|
|
@@ -6594,7 +6588,7 @@ var StatusListStore = class {
|
|
|
6594
6588
|
async getStatusListEntryRepo(type) {
|
|
6595
6589
|
const dataSource = await this.getDS();
|
|
6596
6590
|
switch (type) {
|
|
6597
|
-
case
|
|
6591
|
+
case import_ssi_types6.StatusListType.BitstringStatusList:
|
|
6598
6592
|
return dataSource.getRepository(BitstringStatusListEntryEntity);
|
|
6599
6593
|
default:
|
|
6600
6594
|
return dataSource.getRepository(StatusListEntryEntity);
|
|
@@ -6610,15 +6604,15 @@ var AbstractEventLoggerStore = class {
|
|
|
6610
6604
|
};
|
|
6611
6605
|
|
|
6612
6606
|
// src/eventLogger/EventLoggerStore.ts
|
|
6613
|
-
var
|
|
6607
|
+
var import_ssi_types8 = require("@sphereon/ssi-types");
|
|
6614
6608
|
var import_debug5 = __toESM(require("debug"), 1);
|
|
6615
6609
|
|
|
6616
6610
|
// src/utils/eventLogger/MappingUtils.ts
|
|
6617
|
-
var
|
|
6611
|
+
var import_ssi_types7 = require("@sphereon/ssi-types");
|
|
6618
6612
|
var auditEventFrom = /* @__PURE__ */ __name((event) => {
|
|
6619
6613
|
const result = {
|
|
6620
6614
|
id: event.id,
|
|
6621
|
-
type:
|
|
6615
|
+
type: import_ssi_types7.LoggingEventType.AUDIT,
|
|
6622
6616
|
description: event.description,
|
|
6623
6617
|
timestamp: event.timestamp,
|
|
6624
6618
|
level: event.level,
|
|
@@ -6645,7 +6639,7 @@ var auditEventFrom = /* @__PURE__ */ __name((event) => {
|
|
|
6645
6639
|
}, "auditEventFrom");
|
|
6646
6640
|
var auditEventEntityFrom = /* @__PURE__ */ __name((args) => {
|
|
6647
6641
|
const auditEventEntity = new AuditEventEntity();
|
|
6648
|
-
auditEventEntity.type =
|
|
6642
|
+
auditEventEntity.type = import_ssi_types7.LoggingEventType.AUDIT;
|
|
6649
6643
|
auditEventEntity.timestamp = args.timestamp;
|
|
6650
6644
|
auditEventEntity.level = args.level;
|
|
6651
6645
|
auditEventEntity.correlationId = args.correlationId;
|
|
@@ -6669,7 +6663,7 @@ var auditEventEntityFrom = /* @__PURE__ */ __name((args) => {
|
|
|
6669
6663
|
var activityEventFrom = /* @__PURE__ */ __name((event) => {
|
|
6670
6664
|
const result = {
|
|
6671
6665
|
id: event.id,
|
|
6672
|
-
type:
|
|
6666
|
+
type: import_ssi_types7.LoggingEventType.ACTIVITY,
|
|
6673
6667
|
credentialType: event.credentialType,
|
|
6674
6668
|
originalCredential: event.originalCredential,
|
|
6675
6669
|
credentialHash: event.credentialHash,
|
|
@@ -6701,7 +6695,7 @@ var activityEventFrom = /* @__PURE__ */ __name((event) => {
|
|
|
6701
6695
|
}, "activityEventFrom");
|
|
6702
6696
|
var activityEventEntityFrom = /* @__PURE__ */ __name((args) => {
|
|
6703
6697
|
const activityEventEntity = new AuditEventEntity();
|
|
6704
|
-
activityEventEntity.type =
|
|
6698
|
+
activityEventEntity.type = import_ssi_types7.LoggingEventType.ACTIVITY;
|
|
6705
6699
|
activityEventEntity.timestamp = args.timestamp;
|
|
6706
6700
|
activityEventEntity.level = args.level;
|
|
6707
6701
|
activityEventEntity.correlationId = args.correlationId;
|
|
@@ -6743,11 +6737,11 @@ var EventLoggerStore = class extends AbstractEventLoggerStore {
|
|
|
6743
6737
|
const { filter = [] } = args ?? {};
|
|
6744
6738
|
const auditEventsFilter = filter.map((item) => ({
|
|
6745
6739
|
...item,
|
|
6746
|
-
type:
|
|
6740
|
+
type: import_ssi_types8.LoggingEventType.AUDIT
|
|
6747
6741
|
}));
|
|
6748
6742
|
if (auditEventsFilter.length === 0) {
|
|
6749
6743
|
auditEventsFilter.push({
|
|
6750
|
-
type:
|
|
6744
|
+
type: import_ssi_types8.LoggingEventType.AUDIT
|
|
6751
6745
|
});
|
|
6752
6746
|
}
|
|
6753
6747
|
const connection = await this.dbConnection;
|
|
@@ -6769,11 +6763,11 @@ var EventLoggerStore = class extends AbstractEventLoggerStore {
|
|
|
6769
6763
|
const { filter = [] } = args ?? {};
|
|
6770
6764
|
const activityEventsFilter = filter.map((item) => ({
|
|
6771
6765
|
...item,
|
|
6772
|
-
type:
|
|
6766
|
+
type: import_ssi_types8.LoggingEventType.ACTIVITY
|
|
6773
6767
|
}));
|
|
6774
6768
|
if (activityEventsFilter.length === 0) {
|
|
6775
6769
|
activityEventsFilter.push({
|
|
6776
|
-
type:
|
|
6770
|
+
type: import_ssi_types8.LoggingEventType.ACTIVITY
|
|
6777
6771
|
});
|
|
6778
6772
|
}
|
|
6779
6773
|
const connection = await this.dbConnection;
|
|
@@ -6943,6 +6937,7 @@ var import_typeorm39 = require("typeorm");
|
|
|
6943
6937
|
var import_debug7 = __toESM(require("debug"), 1);
|
|
6944
6938
|
|
|
6945
6939
|
// src/utils/presentationDefinition/MappingUtils.ts
|
|
6940
|
+
var import_dcql = require("dcql");
|
|
6946
6941
|
var blakepkg = __toESM(require("blakejs"), 1);
|
|
6947
6942
|
var presentationDefinitionItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
6948
6943
|
const result = {
|
|
@@ -6953,10 +6948,20 @@ var presentationDefinitionItemFrom = /* @__PURE__ */ __name((entity) => {
|
|
|
6953
6948
|
name: entity.name,
|
|
6954
6949
|
purpose: entity.purpose,
|
|
6955
6950
|
definitionPayload: JSON.parse(entity.definitionPayload),
|
|
6956
|
-
|
|
6951
|
+
...entity.dcqlPayload && {
|
|
6952
|
+
dcqlPayload: {
|
|
6953
|
+
queryId: entity.definitionId,
|
|
6954
|
+
name: entity.name,
|
|
6955
|
+
defaultPurpose: entity.purpose,
|
|
6956
|
+
dcqlQuery: import_dcql.DcqlQuery.parse(JSON.parse(entity.dcqlPayload))
|
|
6957
|
+
}
|
|
6958
|
+
},
|
|
6957
6959
|
createdAt: entity.createdAt,
|
|
6958
6960
|
lastUpdatedAt: entity.lastUpdatedAt
|
|
6959
6961
|
};
|
|
6962
|
+
if (result.dcqlPayload?.dcqlQuery) {
|
|
6963
|
+
import_dcql.DcqlQuery.validate(result.dcqlPayload?.dcqlQuery);
|
|
6964
|
+
}
|
|
6960
6965
|
return replaceNullWithUndefined(result);
|
|
6961
6966
|
}, "presentationDefinitionItemFrom");
|
|
6962
6967
|
var presentationDefinitionEntityItemFrom = /* @__PURE__ */ __name((item) => {
|
|
@@ -6966,8 +6971,14 @@ var presentationDefinitionEntityItemFrom = /* @__PURE__ */ __name((item) => {
|
|
|
6966
6971
|
entity.version = item.version;
|
|
6967
6972
|
entity.name = item.name;
|
|
6968
6973
|
entity.purpose = item.purpose;
|
|
6969
|
-
|
|
6970
|
-
|
|
6974
|
+
if (item.definitionPayload) {
|
|
6975
|
+
entity.definitionPayload = JSON.stringify(item.definitionPayload);
|
|
6976
|
+
}
|
|
6977
|
+
if (item.dcqlPayload) {
|
|
6978
|
+
const dcqlQuery = import_dcql.DcqlQuery.parse(item.dcqlPayload.dcqlQuery);
|
|
6979
|
+
import_dcql.DcqlQuery.validate(dcqlQuery);
|
|
6980
|
+
entity.dcqlPayload = JSON.stringify(item.dcqlPayload.dcqlQuery);
|
|
6981
|
+
}
|
|
6971
6982
|
return entity;
|
|
6972
6983
|
}, "presentationDefinitionEntityItemFrom");
|
|
6973
6984
|
function hashPayload(payload) {
|
|
@@ -6975,13 +6986,24 @@ function hashPayload(payload) {
|
|
|
6975
6986
|
}
|
|
6976
6987
|
__name(hashPayload, "hashPayload");
|
|
6977
6988
|
function isPresentationDefinitionEqual(base, compare) {
|
|
6978
|
-
if (base.definitionId !== compare.definitionId || base.tenantId
|
|
6989
|
+
if (base.definitionId !== compare.definitionId || base.tenantId !== compare.tenantId || base.version !== compare.version || base.name !== compare.name || base.purpose !== compare.purpose) {
|
|
6990
|
+
return false;
|
|
6991
|
+
}
|
|
6992
|
+
if (base.dcqlPayload && compare.dcqlPayload) {
|
|
6993
|
+
if (hashPayload(base.dcqlPayload) !== hashPayload(compare.dcqlPayload)) {
|
|
6994
|
+
return false;
|
|
6995
|
+
}
|
|
6996
|
+
} else if (base.dcqlPayload || compare.dcqlPayload) {
|
|
6979
6997
|
return false;
|
|
6980
6998
|
}
|
|
6981
6999
|
if (base.definitionPayload && compare.definitionPayload) {
|
|
6982
|
-
|
|
7000
|
+
if (hashPayload(base.definitionPayload) !== hashPayload(compare.definitionPayload)) {
|
|
7001
|
+
return false;
|
|
7002
|
+
}
|
|
7003
|
+
} else if (base.definitionPayload || compare.definitionPayload) {
|
|
7004
|
+
return false;
|
|
6983
7005
|
}
|
|
6984
|
-
return
|
|
7006
|
+
return true;
|
|
6985
7007
|
}
|
|
6986
7008
|
__name(isPresentationDefinitionEqual, "isPresentationDefinitionEqual");
|
|
6987
7009
|
|
|
@@ -7070,7 +7092,12 @@ var PDStore = class extends AbstractPDStore {
|
|
|
7070
7092
|
updatedEntity.version = item.version;
|
|
7071
7093
|
updatedEntity.name = item.name;
|
|
7072
7094
|
updatedEntity.purpose = item.purpose;
|
|
7073
|
-
|
|
7095
|
+
if (item.definitionPayload) {
|
|
7096
|
+
updatedEntity.definitionPayload = JSON.stringify(item.definitionPayload);
|
|
7097
|
+
}
|
|
7098
|
+
if (item.dcqlPayload) {
|
|
7099
|
+
updatedEntity.dcqlPayload = JSON.stringify(item.dcqlPayload.dcqlQuery);
|
|
7100
|
+
}
|
|
7074
7101
|
debug7("Updating presentation definition entity", updatedEntity);
|
|
7075
7102
|
const updateResult = await pdRepository.save(updatedEntity, {
|
|
7076
7103
|
transaction: true
|
|
@@ -7306,9 +7333,120 @@ var CreateContacts1659463079429 = class {
|
|
|
7306
7333
|
}
|
|
7307
7334
|
};
|
|
7308
7335
|
|
|
7309
|
-
// src/migrations/generic/
|
|
7336
|
+
// src/migrations/generic/10-CreatePresentationDefinitions.ts
|
|
7310
7337
|
var import_debug9 = __toESM(require("debug"), 1);
|
|
7311
7338
|
|
|
7339
|
+
// src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts
|
|
7340
|
+
var CreatePresentationDefinitions1716475165345 = class {
|
|
7341
|
+
static {
|
|
7342
|
+
__name(this, "CreatePresentationDefinitions1716475165345");
|
|
7343
|
+
}
|
|
7344
|
+
name = "CreatePresentationDefinitions1716475165345";
|
|
7345
|
+
async up(queryRunner) {
|
|
7346
|
+
await queryRunner.query(`
|
|
7347
|
+
CREATE TABLE "PresentationDefinitionItem" (
|
|
7348
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
7349
|
+
"tenant_id" TEXT,
|
|
7350
|
+
"definition_id" TEXT NOT NULL,
|
|
7351
|
+
"name" TEXT,
|
|
7352
|
+
"version" TEXT NOT NULL,
|
|
7353
|
+
"purpose" TEXT,
|
|
7354
|
+
"definition_payload" TEXT NOT NULL,
|
|
7355
|
+
"dcql_payload" TEXT,
|
|
7356
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7357
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7358
|
+
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
7359
|
+
`);
|
|
7360
|
+
}
|
|
7361
|
+
async down(queryRunner) {
|
|
7362
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
7363
|
+
}
|
|
7364
|
+
};
|
|
7365
|
+
|
|
7366
|
+
// src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts
|
|
7367
|
+
var CreatePresentationDefinitions1716475165344 = class {
|
|
7368
|
+
static {
|
|
7369
|
+
__name(this, "CreatePresentationDefinitions1716475165344");
|
|
7370
|
+
}
|
|
7371
|
+
name = "CreatePresentationDefinitions1716475165344";
|
|
7372
|
+
async up(queryRunner) {
|
|
7373
|
+
await queryRunner.query(`CREATE TABLE "PresentationDefinitionItem" (
|
|
7374
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7375
|
+
"tenant_id" varchar,
|
|
7376
|
+
"definition_id" varchar NOT NULL,
|
|
7377
|
+
"name" varchar,
|
|
7378
|
+
"version" varchar NOT NULL,
|
|
7379
|
+
"purpose" varchar,
|
|
7380
|
+
"definition_payload" varchar NOT NULL,
|
|
7381
|
+
"dcql_payload" varchar,
|
|
7382
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
7383
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7384
|
+
}
|
|
7385
|
+
async down(queryRunner) {
|
|
7386
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
7387
|
+
}
|
|
7388
|
+
};
|
|
7389
|
+
|
|
7390
|
+
// src/migrations/generic/10-CreatePresentationDefinitions.ts
|
|
7391
|
+
var debug9 = (0, import_debug9.default)("sphereon:ssi-sdk:migrations");
|
|
7392
|
+
var CreatePresentationDefinitions1716533767523 = class {
|
|
7393
|
+
static {
|
|
7394
|
+
__name(this, "CreatePresentationDefinitions1716533767523");
|
|
7395
|
+
}
|
|
7396
|
+
name = "CreatePresentationDefinitionItems1716533767523";
|
|
7397
|
+
async up(queryRunner) {
|
|
7398
|
+
debug9("migration: creating machine state tables");
|
|
7399
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7400
|
+
switch (dbType) {
|
|
7401
|
+
case "postgres": {
|
|
7402
|
+
debug9("using postgres migration file");
|
|
7403
|
+
const mig = new CreatePresentationDefinitions1716475165345();
|
|
7404
|
+
await mig.up(queryRunner);
|
|
7405
|
+
debug9("Migration statements executed");
|
|
7406
|
+
return;
|
|
7407
|
+
}
|
|
7408
|
+
case "sqlite":
|
|
7409
|
+
case "expo":
|
|
7410
|
+
case "react-native": {
|
|
7411
|
+
debug9("using sqlite/react-native migration file");
|
|
7412
|
+
const mig = new CreatePresentationDefinitions1716475165344();
|
|
7413
|
+
await mig.up(queryRunner);
|
|
7414
|
+
debug9("Migration statements executed");
|
|
7415
|
+
return;
|
|
7416
|
+
}
|
|
7417
|
+
default:
|
|
7418
|
+
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`);
|
|
7419
|
+
}
|
|
7420
|
+
}
|
|
7421
|
+
async down(queryRunner) {
|
|
7422
|
+
debug9("migration: reverting machine state tables");
|
|
7423
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7424
|
+
switch (dbType) {
|
|
7425
|
+
case "postgres": {
|
|
7426
|
+
debug9("using postgres migration file");
|
|
7427
|
+
const mig = new CreatePresentationDefinitions1716475165345();
|
|
7428
|
+
await mig.down(queryRunner);
|
|
7429
|
+
debug9("Migration statements executed");
|
|
7430
|
+
return;
|
|
7431
|
+
}
|
|
7432
|
+
case "sqlite":
|
|
7433
|
+
case "expo":
|
|
7434
|
+
case "react-native": {
|
|
7435
|
+
debug9("using sqlite/react-native migration file");
|
|
7436
|
+
const mig = new CreatePresentationDefinitions1716475165344();
|
|
7437
|
+
await mig.down(queryRunner);
|
|
7438
|
+
debug9("Migration statements executed");
|
|
7439
|
+
return;
|
|
7440
|
+
}
|
|
7441
|
+
default:
|
|
7442
|
+
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`);
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
};
|
|
7446
|
+
|
|
7447
|
+
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
7448
|
+
var import_debug10 = __toESM(require("debug"), 1);
|
|
7449
|
+
|
|
7312
7450
|
// src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts
|
|
7313
7451
|
var import_ssi_sdk21 = require("@sphereon/ssi-sdk.core");
|
|
7314
7452
|
var CreateIssuanceBranding1685628974232 = class {
|
|
@@ -7445,31 +7583,105 @@ var CreateIssuanceBranding1685628973231 = class {
|
|
|
7445
7583
|
}
|
|
7446
7584
|
};
|
|
7447
7585
|
|
|
7448
|
-
// src/migrations/
|
|
7449
|
-
var
|
|
7450
|
-
var CreateIssuanceBranding1659463079429 = class {
|
|
7586
|
+
// src/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.ts
|
|
7587
|
+
var FixCredentialClaimsReferencesUuidPG1741895822987 = class {
|
|
7451
7588
|
static {
|
|
7452
|
-
__name(this, "
|
|
7589
|
+
__name(this, "FixCredentialClaimsReferencesUuidPG1741895822987");
|
|
7453
7590
|
}
|
|
7454
|
-
name = "
|
|
7591
|
+
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
7592
|
+
async up(queryRunner) {
|
|
7593
|
+
await queryRunner.query(`
|
|
7594
|
+
ALTER TABLE "CredentialClaims"
|
|
7595
|
+
ALTER COLUMN "credentialLocaleBrandingId" TYPE uuid USING "credentialLocaleBrandingId"::uuid;
|
|
7596
|
+
`);
|
|
7597
|
+
}
|
|
7598
|
+
async down(queryRunner) {
|
|
7599
|
+
await queryRunner.query(`
|
|
7600
|
+
ALTER TABLE "CredentialClaims"
|
|
7601
|
+
ALTER COLUMN "credentialLocaleBrandingId" TYPE character varying USING "credentialLocaleBrandingId"::text;
|
|
7602
|
+
`);
|
|
7603
|
+
}
|
|
7604
|
+
};
|
|
7605
|
+
|
|
7606
|
+
// src/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.ts
|
|
7607
|
+
var FixCredentialClaimsReferencesUuidSqlite1741895822987 = class {
|
|
7608
|
+
static {
|
|
7609
|
+
__name(this, "FixCredentialClaimsReferencesUuidSqlite1741895822987");
|
|
7610
|
+
}
|
|
7611
|
+
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
7612
|
+
async up(queryRunner) {
|
|
7613
|
+
await queryRunner.query(`
|
|
7614
|
+
CREATE TABLE "CredentialClaims_new"
|
|
7615
|
+
(
|
|
7616
|
+
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
7617
|
+
"key" character varying(255) NOT NULL,
|
|
7618
|
+
"name" character varying(255) NOT NULL,
|
|
7619
|
+
"credentialLocaleBrandingId" uuid,
|
|
7620
|
+
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
7621
|
+
)
|
|
7622
|
+
`);
|
|
7623
|
+
await queryRunner.query(`
|
|
7624
|
+
INSERT INTO "CredentialClaims_new" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
7625
|
+
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
7626
|
+
FROM "CredentialClaims"
|
|
7627
|
+
`);
|
|
7628
|
+
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
7629
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims_new" RENAME TO "CredentialClaims"`);
|
|
7630
|
+
await queryRunner.query(`
|
|
7631
|
+
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
7632
|
+
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
7633
|
+
`);
|
|
7634
|
+
}
|
|
7635
|
+
async down(queryRunner) {
|
|
7636
|
+
await queryRunner.query(`
|
|
7637
|
+
CREATE TABLE "CredentialClaims_old"
|
|
7638
|
+
(
|
|
7639
|
+
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
7640
|
+
"key" character varying(255) NOT NULL,
|
|
7641
|
+
"name" character varying(255) NOT NULL,
|
|
7642
|
+
"credentialLocaleBrandingId" character varying,
|
|
7643
|
+
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
7644
|
+
)
|
|
7645
|
+
`);
|
|
7646
|
+
await queryRunner.query(`
|
|
7647
|
+
INSERT INTO "CredentialClaims_old" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
7648
|
+
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
7649
|
+
FROM "CredentialClaims"
|
|
7650
|
+
`);
|
|
7651
|
+
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
7652
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims_old" RENAME TO "CredentialClaims"`);
|
|
7653
|
+
await queryRunner.query(`
|
|
7654
|
+
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
7655
|
+
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
7656
|
+
`);
|
|
7657
|
+
}
|
|
7658
|
+
};
|
|
7659
|
+
|
|
7660
|
+
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
7661
|
+
var debug10 = (0, import_debug10.default)("sphereon:ssi-sdk:migrations");
|
|
7662
|
+
var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
7663
|
+
static {
|
|
7664
|
+
__name(this, "FixCredentialClaimsReferencesUuid1741895822987");
|
|
7665
|
+
}
|
|
7666
|
+
name = "FixCredentialClaimsReferenceUuid1741895822987";
|
|
7455
7667
|
async up(queryRunner) {
|
|
7456
|
-
|
|
7668
|
+
debug10("migration: creating issuance branding uuid problem");
|
|
7457
7669
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7458
7670
|
switch (dbType) {
|
|
7459
7671
|
case "postgres": {
|
|
7460
|
-
|
|
7461
|
-
const mig = new
|
|
7672
|
+
debug10("using postgres migration file");
|
|
7673
|
+
const mig = new FixCredentialClaimsReferencesUuidPG1741895822987();
|
|
7462
7674
|
await mig.up(queryRunner);
|
|
7463
|
-
|
|
7675
|
+
debug10("Migration statements executed");
|
|
7464
7676
|
return;
|
|
7465
7677
|
}
|
|
7466
7678
|
case "sqlite":
|
|
7467
7679
|
case "expo":
|
|
7468
7680
|
case "react-native": {
|
|
7469
|
-
|
|
7470
|
-
const mig = new
|
|
7681
|
+
debug10("using sqlite/react-native migration file");
|
|
7682
|
+
const mig = new FixCredentialClaimsReferencesUuidSqlite1741895822987();
|
|
7471
7683
|
await mig.up(queryRunner);
|
|
7472
|
-
|
|
7684
|
+
debug10("Migration statements executed");
|
|
7473
7685
|
return;
|
|
7474
7686
|
}
|
|
7475
7687
|
default:
|
|
@@ -7477,23 +7689,23 @@ var CreateIssuanceBranding1659463079429 = class {
|
|
|
7477
7689
|
}
|
|
7478
7690
|
}
|
|
7479
7691
|
async down(queryRunner) {
|
|
7480
|
-
|
|
7692
|
+
debug10("migration: reverting issuance branding uuid migration");
|
|
7481
7693
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7482
7694
|
switch (dbType) {
|
|
7483
7695
|
case "postgres": {
|
|
7484
|
-
|
|
7696
|
+
debug10("using postgres migration file");
|
|
7485
7697
|
const mig = new CreateIssuanceBranding1685628974232();
|
|
7486
7698
|
await mig.down(queryRunner);
|
|
7487
|
-
|
|
7699
|
+
debug10("Migration statements executed");
|
|
7488
7700
|
return;
|
|
7489
7701
|
}
|
|
7490
7702
|
case "sqlite":
|
|
7491
7703
|
case "expo":
|
|
7492
7704
|
case "react-native": {
|
|
7493
|
-
|
|
7705
|
+
debug10("using sqlite/react-native migration file");
|
|
7494
7706
|
const mig = new CreateIssuanceBranding1685628973231();
|
|
7495
7707
|
await mig.down(queryRunner);
|
|
7496
|
-
|
|
7708
|
+
debug10("Migration statements executed");
|
|
7497
7709
|
return;
|
|
7498
7710
|
}
|
|
7499
7711
|
default:
|
|
@@ -7502,658 +7714,364 @@ var CreateIssuanceBranding1659463079429 = class {
|
|
|
7502
7714
|
}
|
|
7503
7715
|
};
|
|
7504
7716
|
|
|
7505
|
-
// src/migrations/generic/
|
|
7506
|
-
var
|
|
7717
|
+
// src/migrations/generic/12-CreateBitstringStatusList.ts
|
|
7718
|
+
var import_debug11 = __toESM(require("debug"), 1);
|
|
7507
7719
|
|
|
7508
|
-
// src/migrations/
|
|
7509
|
-
var
|
|
7720
|
+
// src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts
|
|
7721
|
+
var AddBitstringStatusListEnumPG1741895823000 = class {
|
|
7510
7722
|
static {
|
|
7511
|
-
__name(this, "
|
|
7723
|
+
__name(this, "AddBitstringStatusListEnumPG1741895823000");
|
|
7512
7724
|
}
|
|
7513
|
-
name = "
|
|
7725
|
+
name = "AddBitstringStatusListEnum1741895823000";
|
|
7514
7726
|
async up(queryRunner) {
|
|
7515
|
-
await queryRunner.
|
|
7516
|
-
await queryRunner.query(`
|
|
7517
|
-
await queryRunner.
|
|
7518
|
-
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7519
|
-
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
7520
|
-
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
7521
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7522
|
-
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7523
|
-
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`);
|
|
7524
|
-
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
7525
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7526
|
-
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7527
|
-
await queryRunner.query(`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identity_id" varchar, CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identity_id"), CONSTRAINT "UQ_CorrelationIdentifier_correlation_id" UNIQUE ("correlation_id"))`);
|
|
7528
|
-
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
7529
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7530
|
-
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7531
|
-
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
7532
|
-
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
7533
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7534
|
-
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7535
|
-
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identity_id" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identity_id"))`);
|
|
7536
|
-
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
7537
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7538
|
-
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7539
|
-
await queryRunner.query(`CREATE TABLE "PartyType" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('naturalPerson','organization') ) NOT NULL, "origin" varchar CHECK( "origin" IN ('INTERNAL', 'EXTERNAL') ) NOT NULL, "name" varchar(255) NOT NULL, "description" varchar(255), "tenant_id" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"))`);
|
|
7540
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
7541
|
-
await queryRunner.query(`CREATE TABLE "BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"))`);
|
|
7542
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7543
|
-
await queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7544
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7545
|
-
await queryRunner.query(`CREATE TABLE "Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL)`);
|
|
7546
|
-
await queryRunner.query(`CREATE TABLE "BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"))`);
|
|
7547
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7548
|
-
await queryRunner.query(`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identity_id" varchar, CONSTRAINT "REL_CorrelationIdentifier_identity_id" UNIQUE ("identity_id"), CONSTRAINT "UQ_CorrelationIdentifier_correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "FK_CorrelationIdentifier_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7549
|
-
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identity_id" FROM "CorrelationIdentifier"`);
|
|
7550
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7551
|
-
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7552
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7553
|
-
await queryRunner.query(`CREATE TABLE "temporary_BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7554
|
-
await queryRunner.query(`INSERT INTO "temporary_BaseContact"("id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id") SELECT "id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id" FROM "BaseContact"`);
|
|
7555
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7556
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7557
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7558
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7559
|
-
await queryRunner.query(`CREATE TABLE "temporary_PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7560
|
-
await queryRunner.query(`INSERT INTO "temporary_PartyRelationship"("id", "left_id", "right_id", "created_at", "last_updated_at") SELECT "id", "left_id", "right_id", "created_at", "last_updated_at" FROM "PartyRelationship"`);
|
|
7561
|
-
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7562
|
-
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7563
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7564
|
-
await queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar(255) NOT NULL, "electronic_address" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7565
|
-
await queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar(255) NOT NULL, "street_name" varchar(255) NOT NULL, "street_number" varchar(255) NOT NULL, "postal_code" varchar(255) NOT NULL, "city_name" varchar(255) NOT NULL, "province_name" varchar(255) NOT NULL, "country_code" varchar(2) NOT NULL, "building_name" varchar(255), "partyId" varchar, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PhysicalAddressEntity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7566
|
-
await queryRunner.query(`CREATE TABLE "temporary_Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL, CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`);
|
|
7567
|
-
await queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
7568
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7569
|
-
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7570
|
-
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"), CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7571
|
-
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "partyId" FROM "Identity"`);
|
|
7572
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7573
|
-
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7574
|
-
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identity_id" varchar, CONSTRAINT "REL_Connection_identity_id" UNIQUE ("identity_id"), CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7575
|
-
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identity_id" FROM "Connection"`);
|
|
7576
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7577
|
-
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7578
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7579
|
-
await queryRunner.query(`CREATE TABLE "temporary_BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7580
|
-
await queryRunner.query(`INSERT INTO "temporary_BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
7581
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7582
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7583
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7584
|
-
await queryRunner.query(`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId" FROM "BaseConfigEntity"`);
|
|
7585
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
7586
|
-
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', datetime('now'), datetime('now'))`);
|
|
7587
|
-
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', datetime('now'), datetime('now'))`);
|
|
7588
|
-
await queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
|
|
7589
|
-
await queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
|
|
7590
|
-
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7591
|
-
}
|
|
7592
|
-
async down(queryRunner) {
|
|
7593
|
-
await queryRunner.query(`CREATE TABLE "Contact" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar(255), "alias" varchar(255))`);
|
|
7594
|
-
await queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
7595
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7596
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7597
|
-
await queryRunner.query(`CREATE TABLE "BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connectionId" varchar)`);
|
|
7598
|
-
await queryRunner.query(`INSERT INTO "BaseConfigEntity"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
7599
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7600
|
-
await queryRunner.query(`CREATE TABLE "temporary_Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL, CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`);
|
|
7601
|
-
await queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
7602
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7603
|
-
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7604
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7605
|
-
await queryRunner.query(`CREATE TABLE "temporary_PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7606
|
-
await queryRunner.query(`INSERT INTO "temporary_PartyRelationship"("id", "left_id", "right_id", "created_at", "last_updated_at") SELECT "id", "left_id", "right_id", "created_at", "last_updated_at" FROM "PartyRelationship"`);
|
|
7607
|
-
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7608
|
-
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7609
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7610
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7611
|
-
await queryRunner.query(`CREATE TABLE "temporary_BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7612
|
-
await queryRunner.query(`INSERT INTO "temporary_BaseContact"("id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id") SELECT "id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id" FROM "BaseContact"`);
|
|
7613
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7614
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7615
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7616
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7617
|
-
await queryRunner.query(`CREATE TABLE "temporary_BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
7618
|
-
await queryRunner.query(`INSERT INTO "temporary_BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
7619
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7620
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7621
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7622
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
7623
|
-
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
7624
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7625
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7626
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7627
|
-
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
7628
|
-
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
7629
|
-
}
|
|
7630
|
-
};
|
|
7631
|
-
|
|
7632
|
-
// src/migrations/postgres/1690925872592-CreateContacts.ts
|
|
7633
|
-
var import_ssi_sdk22 = require("@sphereon/ssi-sdk.core");
|
|
7634
|
-
var CreateContacts1690925872592 = class {
|
|
7635
|
-
static {
|
|
7636
|
-
__name(this, "CreateContacts1690925872592");
|
|
7637
|
-
}
|
|
7638
|
-
name = "CreateContacts1690925872592";
|
|
7639
|
-
async up(queryRunner) {
|
|
7640
|
-
await (0, import_ssi_sdk22.enablePostgresUuidExtension)(queryRunner);
|
|
7641
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`);
|
|
7642
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
7643
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`);
|
|
7644
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`);
|
|
7645
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
7646
|
-
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
7647
|
-
await queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
|
|
7648
|
-
await queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
7649
|
-
await queryRunner.query(`CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "origin" "public"."PartyOrigin_type_enum" NOT NULL, "name" character varying(255) NOT NULL, "description" character varying(255), "tenant_id" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"), CONSTRAINT "PK_PartyType_id" PRIMARY KEY ("id"))`);
|
|
7650
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
7651
|
-
await queryRunner.query(`CREATE TABLE "BaseContact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "legal_name" character varying(255), "display_name" character varying(255), "first_name" character varying(255), "middle_name" character varying(255), "last_name" character varying(255), "type" character varying NOT NULL, "party_id" uuid, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "PK_BaseContact_id" PRIMARY KEY ("id"))`);
|
|
7652
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7653
|
-
await queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "left_id" uuid NOT NULL, "right_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PartyRelationship_id" PRIMARY KEY ("id"))`);
|
|
7654
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7655
|
-
await queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`);
|
|
7656
|
-
await queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`);
|
|
7657
|
-
await queryRunner.query(`CREATE TABLE "Party" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`);
|
|
7658
|
-
await queryRunner.query(`CREATE TABLE "BaseConfig" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "identifier" character varying(255), "redirect_url" character varying(255), "session_id" character varying(255), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" character varying NOT NULL, "connection_id" uuid, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "PK_BaseConfig_id" PRIMARY KEY ("id"))`);
|
|
7659
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7660
|
-
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
|
|
7661
|
-
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" SET NOT NULL`);
|
|
7662
|
-
await queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
7663
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
|
|
7664
|
-
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
|
|
7665
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7666
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7667
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7668
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7669
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7670
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7671
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7672
|
-
await queryRunner.query(`ALTER TABLE "Party" ADD CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
7673
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7674
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7675
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7676
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
|
|
7677
|
-
await queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
|
|
7678
|
-
await queryRunner.query(`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId" FROM "BaseConfigEntity"`);
|
|
7679
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
7680
|
-
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
|
|
7681
|
-
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
|
|
7682
|
-
await queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
|
|
7683
|
-
await queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
|
|
7684
|
-
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7685
|
-
}
|
|
7686
|
-
async down(queryRunner) {
|
|
7687
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP CONSTRAINT "FK_BaseConfig_connection_id"`);
|
|
7688
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identity_id"`);
|
|
7689
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_partyId"`);
|
|
7690
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP CONSTRAINT "FK_Party_party_type_id"`);
|
|
7691
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP CONSTRAINT "FK_PhysicalAddress_partyId"`);
|
|
7692
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP CONSTRAINT "FK_ElectronicAddress_partyId"`);
|
|
7693
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_right_id"`);
|
|
7694
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_left_id"`);
|
|
7695
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP CONSTRAINT "FK_BaseContact_party_id"`);
|
|
7696
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
7697
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identity_id"`);
|
|
7698
|
-
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" DROP NOT NULL`);
|
|
7699
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "origin"`);
|
|
7700
|
-
await queryRunner.query(`DROP TYPE "public"."IdentityOrigin_type_enum"`);
|
|
7701
|
-
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "partyId" TO "contactId"`);
|
|
7702
|
-
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
7703
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
7704
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7705
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7706
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7707
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7708
|
-
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7709
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7710
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7711
|
-
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
7712
|
-
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
7713
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
7714
|
-
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
7715
|
-
await queryRunner.query(`DROP TYPE "public"."PartyOrigin_type_enum"`);
|
|
7716
|
-
await queryRunner.query(`DROP TYPE "public"."PartyType_type_enum"`);
|
|
7717
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7718
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7719
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7720
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7721
|
-
await queryRunner.query(`CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "name" character varying(255), "alias" character varying(255), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`);
|
|
7722
|
-
await queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
7723
|
-
}
|
|
7724
|
-
};
|
|
7725
|
-
|
|
7726
|
-
// src/migrations/generic/3-CreateContacts.ts
|
|
7727
|
-
var debug10 = (0, import_debug10.default)("sphereon:ssi-sdk:migrations");
|
|
7728
|
-
var CreateContacts1690925872318 = class {
|
|
7729
|
-
static {
|
|
7730
|
-
__name(this, "CreateContacts1690925872318");
|
|
7731
|
-
}
|
|
7732
|
-
name = "CreateContacts1690925872318";
|
|
7733
|
-
async up(queryRunner) {
|
|
7734
|
-
debug10("migration: creating contacts tables");
|
|
7735
|
-
const dbType = queryRunner.connection.driver.options.type;
|
|
7736
|
-
switch (dbType) {
|
|
7737
|
-
case "postgres": {
|
|
7738
|
-
debug10("using postgres migration file");
|
|
7739
|
-
const mig = new CreateContacts1690925872592();
|
|
7740
|
-
await mig.up(queryRunner);
|
|
7741
|
-
debug10("Migration statements executed");
|
|
7742
|
-
return;
|
|
7743
|
-
}
|
|
7744
|
-
case "sqlite":
|
|
7745
|
-
case "expo":
|
|
7746
|
-
case "react-native": {
|
|
7747
|
-
debug10("using sqlite/react-native migration file");
|
|
7748
|
-
const mig = new CreateContacts1690925872693();
|
|
7749
|
-
await mig.up(queryRunner);
|
|
7750
|
-
debug10("Migration statements executed");
|
|
7751
|
-
return;
|
|
7752
|
-
}
|
|
7753
|
-
default:
|
|
7754
|
-
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`);
|
|
7755
|
-
}
|
|
7756
|
-
}
|
|
7757
|
-
async down(queryRunner) {
|
|
7758
|
-
debug10("migration: reverting contacts tables");
|
|
7759
|
-
const dbType = queryRunner.connection.driver.options.type;
|
|
7760
|
-
switch (dbType) {
|
|
7761
|
-
case "postgres": {
|
|
7762
|
-
debug10("using postgres migration file");
|
|
7763
|
-
const mig = new CreateContacts1690925872592();
|
|
7764
|
-
await mig.down(queryRunner);
|
|
7765
|
-
debug10("Migration statements executed");
|
|
7766
|
-
return;
|
|
7767
|
-
}
|
|
7768
|
-
case "sqlite":
|
|
7769
|
-
case "expo":
|
|
7770
|
-
case "react-native": {
|
|
7771
|
-
debug10("using sqlite/react-native migration file");
|
|
7772
|
-
const mig = new CreateContacts1690925872693();
|
|
7773
|
-
await mig.down(queryRunner);
|
|
7774
|
-
debug10("Migration statements executed");
|
|
7775
|
-
return;
|
|
7776
|
-
}
|
|
7777
|
-
default:
|
|
7778
|
-
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`);
|
|
7779
|
-
}
|
|
7780
|
-
}
|
|
7781
|
-
};
|
|
7782
|
-
|
|
7783
|
-
// src/migrations/generic/4-CreateStatusList.ts
|
|
7784
|
-
var import_debug11 = __toESM(require("debug"), 1);
|
|
7785
|
-
|
|
7786
|
-
// src/migrations/postgres/1693866470001-CreateStatusList.ts
|
|
7787
|
-
var CreateStatusList1693866470001 = class {
|
|
7788
|
-
static {
|
|
7789
|
-
__name(this, "CreateStatusList1693866470001");
|
|
7790
|
-
}
|
|
7791
|
-
name = "CreateStatusList1693866470001";
|
|
7792
|
-
async up(queryRunner) {
|
|
7793
|
-
await queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
|
|
7794
|
-
await queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
|
|
7795
|
-
await queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
|
|
7796
|
-
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
7797
|
-
(
|
|
7798
|
-
"statusListId" character varying NOT NULL,
|
|
7799
|
-
"statusListIndex" integer NOT NULL,
|
|
7800
|
-
"credentialId" character varying,
|
|
7801
|
-
"credentialHash" character varying(128),
|
|
7802
|
-
"correlationId" character varying(255),
|
|
7803
|
-
"value" character varying(50),
|
|
7804
|
-
CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7805
|
-
)`);
|
|
7806
|
-
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
7807
|
-
(
|
|
7808
|
-
"id" character varying NOT NULL,
|
|
7809
|
-
"correlationId" character varying NOT NULL,
|
|
7810
|
-
"length" integer NOT NULL,
|
|
7811
|
-
"issuer" text NOT NULL,
|
|
7812
|
-
"type" "StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021',
|
|
7813
|
-
"driverType" "StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm',
|
|
7814
|
-
"credentialIdMode" "StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE',
|
|
7815
|
-
"proofFormat" character varying NOT NULL DEFAULT 'lds',
|
|
7816
|
-
"indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft',
|
|
7817
|
-
"statusPurpose" character varying NOT NULL DEFAULT 'revocation',
|
|
7818
|
-
"statusListCredential" text,
|
|
7819
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"),
|
|
7820
|
-
CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id")
|
|
7821
|
-
)`);
|
|
7822
|
-
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
7823
|
-
ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
7824
|
-
}
|
|
7825
|
-
async down(queryRunner) {
|
|
7826
|
-
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
7827
|
-
DROP CONSTRAINT "FK_statusListEntry_statusListId"`);
|
|
7828
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7829
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7830
|
-
await queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
|
|
7831
|
-
await queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
|
|
7832
|
-
await queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
|
|
7833
|
-
}
|
|
7834
|
-
};
|
|
7835
|
-
|
|
7836
|
-
// src/migrations/sqlite/1693866470000-CreateStatusList.ts
|
|
7837
|
-
var CreateStatusList1693866470002 = class {
|
|
7838
|
-
static {
|
|
7839
|
-
__name(this, "CreateStatusList1693866470002");
|
|
7840
|
-
}
|
|
7841
|
-
name = "CreateStatusList1693866470002";
|
|
7842
|
-
async up(queryRunner) {
|
|
7843
|
-
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
7844
|
-
(
|
|
7845
|
-
"statusListId" varchar NOT NULL,
|
|
7846
|
-
"statusListIndex" integer NOT NULL,
|
|
7847
|
-
"credentialId" varchar,
|
|
7848
|
-
"credentialHash" varchar(128),
|
|
7849
|
-
"correlationId" varchar(255),
|
|
7850
|
-
"value" varchar(50),
|
|
7851
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7852
|
-
)`);
|
|
7853
|
-
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
7854
|
-
(
|
|
7855
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
7856
|
-
"correlationId" varchar NOT NULL,
|
|
7857
|
-
"length" integer NOT NULL,
|
|
7858
|
-
"issuer" text NOT NULL,
|
|
7859
|
-
"type" varchar CHECK ( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7860
|
-
"driverType" varchar CHECK ( "driverType" IN ('agent_typeorm', 'agent_kv_store', 'github',
|
|
7861
|
-
'agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7862
|
-
"credentialIdMode" varchar CHECK ( "credentialIdMode" IN ('ISSUANCE', 'PERSISTENCE', 'NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7863
|
-
"proofFormat" varchar CHECK ( "proofFormat" IN ('lds', 'jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7864
|
-
"indexingDirection" varchar CHECK ( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
7865
|
-
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
7866
|
-
"statusListCredential" text,
|
|
7867
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7868
|
-
)`);
|
|
7869
|
-
await queryRunner.query(`CREATE TABLE "temporary_StatusListEntry"
|
|
7870
|
-
(
|
|
7871
|
-
"statusListId" varchar NOT NULL,
|
|
7872
|
-
"statusListIndex" integer NOT NULL,
|
|
7873
|
-
"credentialId" varchar,
|
|
7874
|
-
"credentialHash" varchar(128),
|
|
7875
|
-
"correlationId" varchar(255),
|
|
7876
|
-
"value" varchar(50),
|
|
7877
|
-
CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
7878
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7879
|
-
)`);
|
|
7880
|
-
await queryRunner.query(`INSERT INTO "temporary_StatusListEntry"("statusListId", "statusListIndex", "credentialId",
|
|
7881
|
-
"credentialHash", "correlationId", "value")
|
|
7882
|
-
SELECT "statusListId", "statusListIndex", "credentialId", "credentialHash", "correlationId", "value"
|
|
7883
|
-
FROM "StatusListEntry"`);
|
|
7884
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7885
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
7727
|
+
await queryRunner.startTransaction();
|
|
7728
|
+
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'BitstringStatusList'`);
|
|
7729
|
+
await queryRunner.commitTransaction();
|
|
7886
7730
|
}
|
|
7731
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7887
7732
|
async down(queryRunner) {
|
|
7888
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7889
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7890
7733
|
}
|
|
7891
7734
|
};
|
|
7892
|
-
|
|
7893
|
-
// src/migrations/postgres/1737110469001-UpdateStatusList.ts
|
|
7894
|
-
var UpdateStatusList1737110469001 = class {
|
|
7735
|
+
var CreateBitstringStatusListPG1741895823000 = class {
|
|
7895
7736
|
static {
|
|
7896
|
-
__name(this, "
|
|
7897
|
-
}
|
|
7898
|
-
name = "
|
|
7899
|
-
async up(queryRunner) {
|
|
7900
|
-
await queryRunner.query(`ALTER
|
|
7901
|
-
await queryRunner.query(`ALTER TABLE "StatusList"
|
|
7902
|
-
await queryRunner.query(`ALTER TABLE "StatusList"
|
|
7903
|
-
await queryRunner.query(`ALTER TABLE "StatusList"
|
|
7904
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ADD "
|
|
7737
|
+
__name(this, "CreateBitstringStatusListPG1741895823000");
|
|
7738
|
+
}
|
|
7739
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
7740
|
+
async up(queryRunner) {
|
|
7741
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "ttl" integer`);
|
|
7742
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validFrom" TIMESTAMP`);
|
|
7743
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`);
|
|
7744
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT IF EXISTS "CHK_StatusList_type"`);
|
|
7745
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`);
|
|
7746
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`);
|
|
7747
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`);
|
|
7748
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`);
|
|
7749
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`);
|
|
7750
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`);
|
|
7905
7751
|
}
|
|
7906
7752
|
async down(queryRunner) {
|
|
7907
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7753
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP CONSTRAINT "CHK_StatusListEntry_type"`);
|
|
7754
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusReference"`);
|
|
7755
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusMessage"`);
|
|
7756
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "bitsPerStatus"`);
|
|
7757
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusPurpose"`);
|
|
7758
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "type"`);
|
|
7759
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT "CHK_StatusList_type"`);
|
|
7760
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList'))`);
|
|
7761
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`);
|
|
7762
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validFrom"`);
|
|
7763
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "ttl"`);
|
|
7908
7764
|
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`);
|
|
7909
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" SET NOT NULL`);
|
|
7910
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" SET NOT NULL`);
|
|
7911
7765
|
}
|
|
7912
7766
|
};
|
|
7913
7767
|
|
|
7914
|
-
// src/migrations/sqlite/
|
|
7915
|
-
var
|
|
7768
|
+
// src/migrations/sqlite/1741895823001-CreateBitstringStatusList.ts
|
|
7769
|
+
var CreateBitstringStatusListSqlite1741895823001 = class {
|
|
7916
7770
|
static {
|
|
7917
|
-
__name(this, "
|
|
7771
|
+
__name(this, "CreateBitstringStatusListSqlite1741895823001");
|
|
7918
7772
|
}
|
|
7919
|
-
name = "
|
|
7773
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
7920
7774
|
async up(queryRunner) {
|
|
7921
|
-
await queryRunner.query(`
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7775
|
+
await queryRunner.query(`
|
|
7776
|
+
CREATE TABLE "temporary_StatusList" (
|
|
7777
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7778
|
+
"correlationId" varchar NOT NULL,
|
|
7779
|
+
"length" integer NOT NULL,
|
|
7780
|
+
"issuer" text NOT NULL,
|
|
7781
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7782
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7783
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7784
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7785
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
7786
|
+
"statusPurpose" varchar,
|
|
7787
|
+
"statusListCredential" text,
|
|
7788
|
+
"expiresAt" datetime,
|
|
7789
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
7790
|
+
"ttl" integer,
|
|
7791
|
+
"validFrom" datetime,
|
|
7792
|
+
"validUntil" datetime,
|
|
7793
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7794
|
+
)
|
|
7795
|
+
`);
|
|
7796
|
+
await queryRunner.query(`
|
|
7797
|
+
INSERT INTO "temporary_StatusList"(
|
|
7798
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7799
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7800
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7801
|
+
)
|
|
7802
|
+
SELECT
|
|
7803
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7804
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7805
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7806
|
+
FROM "StatusList"
|
|
7807
|
+
`);
|
|
7947
7808
|
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7948
7809
|
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
7810
|
+
await queryRunner.query(`
|
|
7811
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
7812
|
+
"statusListId" varchar NOT NULL,
|
|
7813
|
+
"statusListIndex" integer NOT NULL,
|
|
7814
|
+
"credentialId" text,
|
|
7815
|
+
"credentialHash" varchar(128),
|
|
7816
|
+
"correlationId" varchar(255),
|
|
7817
|
+
"value" varchar(50),
|
|
7818
|
+
"type" varchar CHECK( "type" IN ('StatusListEntryEntity', 'bitstring') ) NOT NULL DEFAULT ('StatusListEntryEntity'),
|
|
7819
|
+
"statusPurpose" varchar,
|
|
7820
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
7821
|
+
"statusMessage" text,
|
|
7822
|
+
"statusReference" text,
|
|
7823
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7824
|
+
)
|
|
7825
|
+
`);
|
|
7826
|
+
await queryRunner.query(`
|
|
7827
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
7828
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7829
|
+
"correlationId", "value", "type"
|
|
7830
|
+
)
|
|
7831
|
+
SELECT
|
|
7832
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7833
|
+
"correlationId", "value", 'StatusListEntryEntity'
|
|
7834
|
+
FROM "StatusListEntry"
|
|
7835
|
+
`);
|
|
7836
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7837
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
7949
7838
|
}
|
|
7950
7839
|
async down(queryRunner) {
|
|
7951
7840
|
await queryRunner.query(`
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7841
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
7842
|
+
"statusListId" varchar NOT NULL,
|
|
7843
|
+
"statusListIndex" integer NOT NULL,
|
|
7844
|
+
"credentialId" text,
|
|
7845
|
+
"credentialHash" varchar(128),
|
|
7846
|
+
"correlationId" varchar(255),
|
|
7847
|
+
"value" varchar(50),
|
|
7848
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7849
|
+
)
|
|
7850
|
+
`);
|
|
7955
7851
|
await queryRunner.query(`
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7852
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
7853
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7854
|
+
"correlationId", "value"
|
|
7855
|
+
)
|
|
7856
|
+
SELECT
|
|
7857
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7858
|
+
"correlationId", "value"
|
|
7859
|
+
FROM "StatusListEntry"
|
|
7860
|
+
WHERE "type" = 'StatusListEntryEntity'
|
|
7861
|
+
`);
|
|
7862
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7863
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
7864
|
+
await queryRunner.query(`
|
|
7865
|
+
CREATE TABLE "temporary_StatusList" (
|
|
7866
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7867
|
+
"correlationId" varchar NOT NULL,
|
|
7868
|
+
"length" integer NOT NULL,
|
|
7869
|
+
"issuer" text NOT NULL,
|
|
7870
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7871
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7872
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7873
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7874
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
7875
|
+
"statusPurpose" varchar,
|
|
7876
|
+
"statusListCredential" text,
|
|
7877
|
+
"bitsPerStatus" integer,
|
|
7878
|
+
"expiresAt" datetime,
|
|
7879
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7880
|
+
)
|
|
7881
|
+
`);
|
|
7882
|
+
await queryRunner.query(`
|
|
7883
|
+
INSERT INTO "temporary_StatusList"(
|
|
7884
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7885
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7886
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7887
|
+
)
|
|
7888
|
+
SELECT
|
|
7889
|
+
"id", "correlationId", "length", "issuer",
|
|
7890
|
+
CASE WHEN "type" = 'BitstringStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
7891
|
+
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
7892
|
+
"statusPurpose", "statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7893
|
+
FROM "StatusList"
|
|
7894
|
+
`);
|
|
7984
7895
|
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7985
7896
|
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
7986
7897
|
}
|
|
7987
7898
|
};
|
|
7988
7899
|
|
|
7989
|
-
// src/migrations/generic/
|
|
7900
|
+
// src/migrations/generic/12-CreateBitstringStatusList.ts
|
|
7990
7901
|
var debug11 = (0, import_debug11.default)("sphereon:ssi-sdk:migrations");
|
|
7991
|
-
var
|
|
7902
|
+
var AddBitstringStatusListEnum1741895823000 = class {
|
|
7992
7903
|
static {
|
|
7993
|
-
__name(this, "
|
|
7904
|
+
__name(this, "AddBitstringStatusListEnum1741895823000");
|
|
7994
7905
|
}
|
|
7995
|
-
name = "
|
|
7906
|
+
name = "AddBitstringStatusListEnum1741895823000";
|
|
7996
7907
|
async up(queryRunner) {
|
|
7997
|
-
debug11("migration: creating
|
|
7908
|
+
debug11("migration: creating bitstring status list tables");
|
|
7998
7909
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
7910
|
+
switch (dbType) {
|
|
7911
|
+
case "postgres": {
|
|
7912
|
+
const mig = new AddBitstringStatusListEnumPG1741895823000();
|
|
7913
|
+
await mig.up(queryRunner);
|
|
7914
|
+
return;
|
|
7915
|
+
}
|
|
7916
|
+
case "sqlite":
|
|
7917
|
+
case "expo":
|
|
7918
|
+
case "react-native": {
|
|
7919
|
+
return;
|
|
7920
|
+
}
|
|
7921
|
+
default:
|
|
7922
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7925
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7926
|
+
async down(queryRunner) {
|
|
7927
|
+
}
|
|
7928
|
+
};
|
|
7929
|
+
var CreateBitstringStatusList1741895823000 = class {
|
|
7930
|
+
static {
|
|
7931
|
+
__name(this, "CreateBitstringStatusList1741895823000");
|
|
7932
|
+
}
|
|
7933
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
7934
|
+
async up(queryRunner) {
|
|
7935
|
+
debug11("migration: creating bitstring status list tables");
|
|
7936
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7937
|
+
switch (dbType) {
|
|
7938
|
+
case "postgres": {
|
|
7939
|
+
const mig = new CreateBitstringStatusListPG1741895823000();
|
|
7940
|
+
await mig.up(queryRunner);
|
|
7941
|
+
return;
|
|
7942
|
+
}
|
|
7943
|
+
case "sqlite":
|
|
7944
|
+
case "expo":
|
|
7945
|
+
case "react-native": {
|
|
7946
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001();
|
|
7947
|
+
await mig.up(queryRunner);
|
|
7948
|
+
return;
|
|
7949
|
+
}
|
|
7950
|
+
default:
|
|
7951
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
8017
7952
|
}
|
|
8018
7953
|
}
|
|
8019
7954
|
async down(queryRunner) {
|
|
8020
|
-
debug11("migration:
|
|
7955
|
+
debug11("migration: dropping bitstring status list tables");
|
|
8021
7956
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
return down;
|
|
8038
|
-
} else {
|
|
8039
|
-
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`);
|
|
7957
|
+
switch (dbType) {
|
|
7958
|
+
case "postgres": {
|
|
7959
|
+
const mig = new CreateBitstringStatusListPG1741895823000();
|
|
7960
|
+
await mig.down(queryRunner);
|
|
7961
|
+
return;
|
|
7962
|
+
}
|
|
7963
|
+
case "sqlite":
|
|
7964
|
+
case "expo":
|
|
7965
|
+
case "react-native": {
|
|
7966
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001();
|
|
7967
|
+
await mig.down(queryRunner);
|
|
7968
|
+
return;
|
|
7969
|
+
}
|
|
7970
|
+
default:
|
|
7971
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
8040
7972
|
}
|
|
8041
7973
|
}
|
|
8042
7974
|
};
|
|
8043
7975
|
|
|
8044
|
-
// src/migrations/generic/
|
|
7976
|
+
// src/migrations/generic/13-UpdatePresentationDefinitionItemNullable.ts
|
|
8045
7977
|
var import_debug12 = __toESM(require("debug"), 1);
|
|
8046
7978
|
|
|
8047
|
-
// src/migrations/
|
|
8048
|
-
var
|
|
7979
|
+
// src/migrations/postgres/1756975509000-UpdatePresentationDefinitionItemNullable.ts
|
|
7980
|
+
var UpdatePresentationDefinitionItemNullablePG1741895824000 = class {
|
|
8049
7981
|
static {
|
|
8050
|
-
__name(this, "
|
|
7982
|
+
__name(this, "UpdatePresentationDefinitionItemNullablePG1741895824000");
|
|
8051
7983
|
}
|
|
8052
|
-
name = "
|
|
7984
|
+
name = "UpdatePresentationDefinitionItemNullable1741895824000";
|
|
8053
7985
|
async up(queryRunner) {
|
|
8054
|
-
await queryRunner.query(`
|
|
8055
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
8056
|
-
"eventType" varchar CHECK( "eventType" IN ('audit','activity','general') ) NOT NULL,
|
|
8057
|
-
"timestamp" datetime NOT NULL,
|
|
8058
|
-
"level" varchar CHECK( "level" IN ('0','1','2','3','4') ) NOT NULL,
|
|
8059
|
-
"correlationId" varchar NOT NULL,
|
|
8060
|
-
"system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','oid4vp','siopv2','PE','credentials','web3','profile','contact') ) NOT NULL,
|
|
8061
|
-
"subSystemType" varchar CHECK( "subSystemType" IN ('key','did_provider','did_resolver','oid4vp_op','oid4vci_client','siopv2_op','contact_manager','vc_issuer','vc_verifier','vc_persistence','transport','profile','api') ) NOT NULL,
|
|
8062
|
-
"actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL,
|
|
8063
|
-
"actionSubType" varchar NOT NULL,
|
|
8064
|
-
"initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL,
|
|
8065
|
-
"systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','url','email','hostname','phone','user') ),
|
|
8066
|
-
"systemCorrelationId" varchar,
|
|
8067
|
-
"systemAlias" varchar,
|
|
8068
|
-
"partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','url','email','hostname','phone') ),
|
|
8069
|
-
"partyCorrelationId" varchar,
|
|
8070
|
-
"partyAlias" varchar,
|
|
8071
|
-
"credentialType" varchar CHECK( "credentialType" IN ('JSON_LD','JWT','SD_JWT','MSO_MDOC') ),
|
|
8072
|
-
"credentialHash" varchar,
|
|
8073
|
-
"parentCredentialHash" varchar,
|
|
8074
|
-
"originalCredential" varchar,
|
|
8075
|
-
"sharePurpose" varchar,
|
|
8076
|
-
"description" varchar NOT NULL,
|
|
8077
|
-
"data" varchar,
|
|
8078
|
-
"diagnosticData" varchar,
|
|
8079
|
-
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8080
|
-
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7986
|
+
await queryRunner.query(`ALTER TABLE "PresentationDefinitionItem" ALTER COLUMN "definition_payload" DROP NOT NULL`);
|
|
8081
7987
|
}
|
|
8082
7988
|
async down(queryRunner) {
|
|
8083
|
-
await queryRunner.query(`
|
|
7989
|
+
await queryRunner.query(`ALTER TABLE "PresentationDefinitionItem" ALTER COLUMN "definition_payload" SET NOT NULL`);
|
|
8084
7990
|
}
|
|
8085
7991
|
};
|
|
8086
7992
|
|
|
8087
|
-
// src/migrations/
|
|
8088
|
-
var
|
|
7993
|
+
// src/migrations/sqlite/1756975340000-UpdatePresentationDefinitionItemNullable.ts
|
|
7994
|
+
var UpdatePresentationDefinitionItemNullableSqlite1756975340000 = class {
|
|
8089
7995
|
static {
|
|
8090
|
-
__name(this, "
|
|
7996
|
+
__name(this, "UpdatePresentationDefinitionItemNullableSqlite1756975340000");
|
|
8091
7997
|
}
|
|
8092
|
-
name = "
|
|
7998
|
+
name = "UpdatePresentationDefinitionItemNullable1756975340000";
|
|
8093
7999
|
async up(queryRunner) {
|
|
8094
|
-
await queryRunner.query(`
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
"originalCredential" TEXT,
|
|
8123
|
-
"sharePurpose" TEXT,
|
|
8124
|
-
"description" TEXT NOT NULL,
|
|
8125
|
-
"data" TEXT,
|
|
8126
|
-
"diagnosticData" TEXT,
|
|
8127
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8128
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8129
|
-
CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`);
|
|
8000
|
+
await queryRunner.query(`
|
|
8001
|
+
CREATE TABLE "temporary_PresentationDefinitionItem" (
|
|
8002
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8003
|
+
"definition_id" varchar(255) NOT NULL,
|
|
8004
|
+
"version" varchar(255) NOT NULL,
|
|
8005
|
+
"tenant_id" varchar(255),
|
|
8006
|
+
"purpose" varchar(255),
|
|
8007
|
+
"name" varchar(255),
|
|
8008
|
+
"definition_payload" text,
|
|
8009
|
+
"dcql_payload" text,
|
|
8010
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8011
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8012
|
+
CONSTRAINT "UQ_PresentationDefinitionItem_definition_id_version" UNIQUE ("definition_id", "version")
|
|
8013
|
+
)
|
|
8014
|
+
`);
|
|
8015
|
+
await queryRunner.query(`
|
|
8016
|
+
INSERT INTO "temporary_PresentationDefinitionItem"(
|
|
8017
|
+
"id", "definition_id", "version", "tenant_id", "purpose", "name",
|
|
8018
|
+
"definition_payload", "dcql_payload", "created_at", "last_updated_at"
|
|
8019
|
+
)
|
|
8020
|
+
SELECT
|
|
8021
|
+
"id", "definition_id", "version", "tenant_id", "purpose", "name",
|
|
8022
|
+
"definition_payload", "dcql_payload", "created_at", "last_updated_at"
|
|
8023
|
+
FROM "PresentationDefinitionItem"
|
|
8024
|
+
`);
|
|
8025
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
8026
|
+
await queryRunner.query(`ALTER TABLE "temporary_PresentationDefinitionItem" RENAME TO "PresentationDefinitionItem"`);
|
|
8027
|
+
await queryRunner.query(`CREATE INDEX "IDX_PresentationDefinitionItem_version" ON "PresentationDefinitionItem" ("version")`);
|
|
8130
8028
|
}
|
|
8131
8029
|
async down(queryRunner) {
|
|
8132
|
-
await queryRunner.query(`
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8030
|
+
await queryRunner.query(`
|
|
8031
|
+
CREATE TABLE "temporary_PresentationDefinitionItem" (
|
|
8032
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8033
|
+
"definition_id" varchar(255) NOT NULL,
|
|
8034
|
+
"version" varchar(255) NOT NULL,
|
|
8035
|
+
"tenant_id" varchar(255),
|
|
8036
|
+
"purpose" varchar(255),
|
|
8037
|
+
"name" varchar(255),
|
|
8038
|
+
"definition_payload" text NOT NULL,
|
|
8039
|
+
"dcql_payload" text,
|
|
8040
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8041
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8042
|
+
CONSTRAINT "UQ_PresentationDefinitionItem_definition_id_version" UNIQUE ("definition_id", "version")
|
|
8043
|
+
)
|
|
8044
|
+
`);
|
|
8045
|
+
await queryRunner.query(`
|
|
8046
|
+
INSERT INTO "temporary_PresentationDefinitionItem"(
|
|
8047
|
+
"id", "definition_id", "version", "tenant_id", "purpose", "name",
|
|
8048
|
+
"definition_payload", "dcql_payload", "created_at", "last_updated_at"
|
|
8049
|
+
)
|
|
8050
|
+
SELECT
|
|
8051
|
+
"id", "definition_id", "version", "tenant_id", "purpose", "name",
|
|
8052
|
+
"definition_payload", "dcql_payload", "created_at", "last_updated_at"
|
|
8053
|
+
FROM "PresentationDefinitionItem"
|
|
8054
|
+
`);
|
|
8055
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
8056
|
+
await queryRunner.query(`ALTER TABLE "temporary_PresentationDefinitionItem" RENAME TO "PresentationDefinitionItem"`);
|
|
8057
|
+
await queryRunner.query(`CREATE INDEX "IDX_PresentationDefinitionItem_version" ON "PresentationDefinitionItem" ("version")`);
|
|
8140
8058
|
}
|
|
8141
8059
|
};
|
|
8142
8060
|
|
|
8143
|
-
// src/migrations/generic/
|
|
8061
|
+
// src/migrations/generic/13-UpdatePresentationDefinitionItemNullable.ts
|
|
8144
8062
|
var debug12 = (0, import_debug12.default)("sphereon:ssi-sdk:migrations");
|
|
8145
|
-
var
|
|
8063
|
+
var UpdatePresentationDefinitionItemNullable1741895824000 = class {
|
|
8146
8064
|
static {
|
|
8147
|
-
__name(this, "
|
|
8065
|
+
__name(this, "UpdatePresentationDefinitionItemNullable1741895824000");
|
|
8148
8066
|
}
|
|
8149
|
-
name = "
|
|
8067
|
+
name = "UpdatePresentationDefinitionItemNullable1741895824000";
|
|
8150
8068
|
async up(queryRunner) {
|
|
8151
|
-
debug12("migration:
|
|
8069
|
+
debug12("migration: updating presentation definition item nullable fields");
|
|
8152
8070
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8153
8071
|
switch (dbType) {
|
|
8154
8072
|
case "postgres": {
|
|
8155
8073
|
debug12("using postgres migration file");
|
|
8156
|
-
const mig = new
|
|
8074
|
+
const mig = new UpdatePresentationDefinitionItemNullablePG1741895824000();
|
|
8157
8075
|
await mig.up(queryRunner);
|
|
8158
8076
|
debug12("Migration statements executed");
|
|
8159
8077
|
return;
|
|
@@ -8162,7 +8080,7 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8162
8080
|
case "expo":
|
|
8163
8081
|
case "react-native": {
|
|
8164
8082
|
debug12("using sqlite/react-native migration file");
|
|
8165
|
-
const mig = new
|
|
8083
|
+
const mig = new UpdatePresentationDefinitionItemNullableSqlite1756975340000();
|
|
8166
8084
|
await mig.up(queryRunner);
|
|
8167
8085
|
debug12("Migration statements executed");
|
|
8168
8086
|
return;
|
|
@@ -8172,12 +8090,12 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8172
8090
|
}
|
|
8173
8091
|
}
|
|
8174
8092
|
async down(queryRunner) {
|
|
8175
|
-
debug12("migration: reverting
|
|
8093
|
+
debug12("migration: reverting presentation definition item nullable fields");
|
|
8176
8094
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8177
8095
|
switch (dbType) {
|
|
8178
8096
|
case "postgres": {
|
|
8179
8097
|
debug12("using postgres migration file");
|
|
8180
|
-
const mig = new
|
|
8098
|
+
const mig = new UpdatePresentationDefinitionItemNullablePG1741895824000();
|
|
8181
8099
|
await mig.down(queryRunner);
|
|
8182
8100
|
debug12("Migration statements executed");
|
|
8183
8101
|
return;
|
|
@@ -8186,7 +8104,7 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8186
8104
|
case "expo":
|
|
8187
8105
|
case "react-native": {
|
|
8188
8106
|
debug12("using sqlite/react-native migration file");
|
|
8189
|
-
const mig = new
|
|
8107
|
+
const mig = new UpdatePresentationDefinitionItemNullableSqlite1756975340000();
|
|
8190
8108
|
await mig.down(queryRunner);
|
|
8191
8109
|
debug12("Migration statements executed");
|
|
8192
8110
|
return;
|
|
@@ -8197,247 +8115,299 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8197
8115
|
}
|
|
8198
8116
|
};
|
|
8199
8117
|
|
|
8200
|
-
// src/migrations/generic/
|
|
8118
|
+
// src/migrations/generic/2-CreateIssuanceBranding.ts
|
|
8201
8119
|
var import_debug13 = __toESM(require("debug"), 1);
|
|
8202
|
-
|
|
8203
|
-
// src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
|
|
8204
|
-
var CreateDigitalCredential1708525189001 = class {
|
|
8205
|
-
static {
|
|
8206
|
-
__name(this, "CreateDigitalCredential1708525189001");
|
|
8207
|
-
}
|
|
8208
|
-
name = "CreateDigitalCredential1708525189001";
|
|
8209
|
-
async up(queryRunner) {
|
|
8210
|
-
await queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`);
|
|
8211
|
-
await queryRunner.query(`CREATE TYPE "digital_regulation_type" AS ENUM('PID', 'QEAA', 'EAA', 'NON_REGULATED')`);
|
|
8212
|
-
await queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`);
|
|
8213
|
-
await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR')`);
|
|
8214
|
-
await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID', 'KID', 'URL', 'X509_SAN')`);
|
|
8215
|
-
await queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`);
|
|
8216
|
-
await queryRunner.query(`
|
|
8217
|
-
CREATE TABLE "DigitalCredential" (
|
|
8218
|
-
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
8219
|
-
"parent_id" text,
|
|
8220
|
-
"document_type" "digital_document_type" NOT NULL,
|
|
8221
|
-
"regulation_type" "digital_regulation_type" NOT NULL DEFAULT 'NON_REGULATED'::"digital_regulation_type",
|
|
8222
|
-
"document_format" "digital_credential_document_format" NOT NULL,
|
|
8223
|
-
"credential_role" "digital_credential_credential_role" NOT NULL,
|
|
8224
|
-
"raw_document" text NOT NULL,
|
|
8225
|
-
"uniform_document" text NOT NULL,
|
|
8226
|
-
"credential_id" text,
|
|
8227
|
-
"hash" text NOT NULL,
|
|
8228
|
-
"kms_key_ref" text,
|
|
8229
|
-
"identifier_method" text,
|
|
8230
|
-
"issuer_correlation_type" "digital_credential_correlation_type" NOT NULL,
|
|
8231
|
-
"subject_correlation_type" "digital_credential_correlation_type",
|
|
8232
|
-
"issuer_correlation_id" text NOT NULL,
|
|
8233
|
-
"subject_correlation_id" text,
|
|
8234
|
-
"verified_state" "digital_credential_state_type",
|
|
8235
|
-
"issuer_signed" boolean,
|
|
8236
|
-
"rp_correlation_id" text,
|
|
8237
|
-
"rp_correlation_type" "digital_credential_correlation_type",
|
|
8238
|
-
"tenant_id" text,
|
|
8239
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8240
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8241
|
-
"presented_at" DATE,
|
|
8242
|
-
"valid_from" DATE,
|
|
8243
|
-
"valid_until" DATE,
|
|
8244
|
-
"verified_at" DATE,
|
|
8245
|
-
"revoked_at" DATE,
|
|
8246
|
-
PRIMARY KEY ("id"),
|
|
8247
|
-
UNIQUE ("hash", "credential_role")
|
|
8248
|
-
)
|
|
8249
|
-
`);
|
|
8250
|
-
}
|
|
8251
|
-
async down(queryRunner) {
|
|
8252
|
-
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8253
|
-
await queryRunner.query(`DROP TYPE "digital_credential_state_type"`);
|
|
8254
|
-
await queryRunner.query(`DROP TYPE "digital_credential_correlation_type"`);
|
|
8255
|
-
await queryRunner.query(`DROP TYPE "digital_credential_document_format"`);
|
|
8256
|
-
await queryRunner.query(`DROP TYPE "digital_credential_credential_role"`);
|
|
8257
|
-
await queryRunner.query(`DROP TYPE "digital_regulation_type"`);
|
|
8258
|
-
await queryRunner.query(`DROP TYPE "digital_document_type"`);
|
|
8259
|
-
}
|
|
8260
|
-
};
|
|
8261
|
-
|
|
8262
|
-
// src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts
|
|
8263
|
-
var CreateDigitalCredential1708525189002 = class {
|
|
8264
|
-
static {
|
|
8265
|
-
__name(this, "CreateDigitalCredential1708525189002");
|
|
8266
|
-
}
|
|
8267
|
-
name = "CreateDigitalCredential1708525189002";
|
|
8268
|
-
async up(queryRunner) {
|
|
8269
|
-
await queryRunner.query(`
|
|
8270
|
-
CREATE TABLE "DigitalCredential" (
|
|
8271
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
8272
|
-
"parent_id" text,
|
|
8273
|
-
"document_type" varchar CHECK( "document_type" IN ('VC', 'VP', 'C', 'P') ) NOT NULL,
|
|
8274
|
-
"regulation_type" varchar CHECK( "regulation_type" IN ('PID', 'QEAA', 'EAA', 'NON_REGULATED') ) NOT NULL DEFAULT 'NON_REGULATED',
|
|
8275
|
-
"document_format" varchar CHECK( "document_format" IN ('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC') ) NOT NULL,
|
|
8276
|
-
"credential_role" varchar CHECK( "credential_role" IN ('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR') ) NOT NULL,
|
|
8277
|
-
"raw_document" text NOT NULL,
|
|
8278
|
-
"uniform_document" text NOT NULL,
|
|
8279
|
-
"credential_id" text,
|
|
8280
|
-
"hash" text NOT NULL,
|
|
8281
|
-
"kms_key_ref" text,
|
|
8282
|
-
"identifier_method" text,
|
|
8283
|
-
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ) NOT NULL,
|
|
8284
|
-
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8285
|
-
"issuer_correlation_id" text NOT NULL,
|
|
8286
|
-
"subject_correlation_id" text,
|
|
8287
|
-
"issuer_signed" boolean,
|
|
8288
|
-
"rp_correlation_id" text,
|
|
8289
|
-
"rp_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8290
|
-
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
8291
|
-
"tenant_id" text,
|
|
8292
|
-
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8293
|
-
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8294
|
-
"presented_at" datetime,
|
|
8295
|
-
"valid_from" datetime,
|
|
8296
|
-
"valid_until" datetime,
|
|
8297
|
-
"verified_at" datetime,
|
|
8298
|
-
"revoked_at" datetime,
|
|
8299
|
-
UNIQUE ("hash", "credential_role")
|
|
8300
|
-
)
|
|
8301
|
-
`);
|
|
8302
|
-
}
|
|
8303
|
-
async down(queryRunner) {
|
|
8304
|
-
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8305
|
-
}
|
|
8306
|
-
};
|
|
8307
|
-
|
|
8308
|
-
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8309
8120
|
var debug13 = (0, import_debug13.default)("sphereon:ssi-sdk:migrations");
|
|
8310
|
-
var
|
|
8121
|
+
var CreateIssuanceBranding1659463079429 = class {
|
|
8311
8122
|
static {
|
|
8312
|
-
__name(this, "
|
|
8123
|
+
__name(this, "CreateIssuanceBranding1659463079429");
|
|
8313
8124
|
}
|
|
8314
|
-
name = "
|
|
8125
|
+
name = "CreateIssuanceBranding1659463079429";
|
|
8315
8126
|
async up(queryRunner) {
|
|
8316
|
-
debug13("migration: creating
|
|
8127
|
+
debug13("migration: creating issuance branding tables");
|
|
8317
8128
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8318
8129
|
switch (dbType) {
|
|
8319
8130
|
case "postgres": {
|
|
8320
|
-
debug13("using postgres migration file
|
|
8321
|
-
const mig = new
|
|
8131
|
+
debug13("using postgres migration file");
|
|
8132
|
+
const mig = new CreateIssuanceBranding1685628974232();
|
|
8322
8133
|
await mig.up(queryRunner);
|
|
8323
|
-
debug13("
|
|
8134
|
+
debug13("Migration statements executed");
|
|
8324
8135
|
return;
|
|
8325
8136
|
}
|
|
8326
8137
|
case "sqlite":
|
|
8327
8138
|
case "expo":
|
|
8328
8139
|
case "react-native": {
|
|
8329
|
-
debug13("using sqlite/react-native migration file
|
|
8330
|
-
const mig = new
|
|
8140
|
+
debug13("using sqlite/react-native migration file");
|
|
8141
|
+
const mig = new CreateIssuanceBranding1685628973231();
|
|
8331
8142
|
await mig.up(queryRunner);
|
|
8332
|
-
debug13("
|
|
8143
|
+
debug13("Migration statements executed");
|
|
8333
8144
|
return;
|
|
8334
8145
|
}
|
|
8335
8146
|
default:
|
|
8336
|
-
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo
|
|
8147
|
+
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`);
|
|
8337
8148
|
}
|
|
8338
8149
|
}
|
|
8339
8150
|
async down(queryRunner) {
|
|
8340
|
-
debug13("migration: reverting
|
|
8151
|
+
debug13("migration: reverting issuance branding tables");
|
|
8341
8152
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8342
8153
|
switch (dbType) {
|
|
8343
8154
|
case "postgres": {
|
|
8344
|
-
debug13("using postgres migration file
|
|
8345
|
-
const mig = new
|
|
8155
|
+
debug13("using postgres migration file");
|
|
8156
|
+
const mig = new CreateIssuanceBranding1685628974232();
|
|
8346
8157
|
await mig.down(queryRunner);
|
|
8347
|
-
debug13("
|
|
8158
|
+
debug13("Migration statements executed");
|
|
8348
8159
|
return;
|
|
8349
8160
|
}
|
|
8350
8161
|
case "sqlite":
|
|
8351
8162
|
case "expo":
|
|
8352
8163
|
case "react-native": {
|
|
8353
|
-
debug13("using sqlite/react-native migration file
|
|
8354
|
-
const mig = new
|
|
8164
|
+
debug13("using sqlite/react-native migration file");
|
|
8165
|
+
const mig = new CreateIssuanceBranding1685628973231();
|
|
8355
8166
|
await mig.down(queryRunner);
|
|
8356
|
-
debug13("
|
|
8167
|
+
debug13("Migration statements executed");
|
|
8357
8168
|
return;
|
|
8358
8169
|
}
|
|
8359
8170
|
default:
|
|
8360
|
-
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo
|
|
8171
|
+
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`);
|
|
8361
8172
|
}
|
|
8362
8173
|
}
|
|
8363
8174
|
};
|
|
8364
8175
|
|
|
8365
|
-
// src/migrations/generic/
|
|
8176
|
+
// src/migrations/generic/3-CreateContacts.ts
|
|
8366
8177
|
var import_debug14 = __toESM(require("debug"), 1);
|
|
8367
8178
|
|
|
8368
|
-
// src/migrations/
|
|
8369
|
-
var
|
|
8179
|
+
// src/migrations/sqlite/1690925872693-CreateContacts.ts
|
|
8180
|
+
var CreateContacts1690925872693 = class {
|
|
8370
8181
|
static {
|
|
8371
|
-
__name(this, "
|
|
8182
|
+
__name(this, "CreateContacts1690925872693");
|
|
8372
8183
|
}
|
|
8373
|
-
name = "
|
|
8184
|
+
name = "CreateContacts1690925872693";
|
|
8374
8185
|
async up(queryRunner) {
|
|
8375
|
-
await queryRunner.query(`
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8186
|
+
await queryRunner.query(`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identityId" varchar, CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identityId"), CONSTRAINT "UQ_CorrelationIdentifier_correlation_id" UNIQUE ("correlation_id"))`);
|
|
8187
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
8188
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
8189
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
8190
|
+
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "contactId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
8191
|
+
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "contactId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
8192
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
8193
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
8194
|
+
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identityId" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identityId"))`);
|
|
8195
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
8196
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
8197
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
8198
|
+
await queryRunner.query(`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identity_id" varchar, CONSTRAINT "REL_CorrelationIdentifier_identityId" UNIQUE ("identity_id"), CONSTRAINT "UQ_CorrelationIdentifier_correlation_id" UNIQUE ("correlation_id"))`);
|
|
8199
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
8200
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
8201
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
8202
|
+
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"))`);
|
|
8203
|
+
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "contactId" FROM "Identity"`);
|
|
8204
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
8205
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
8206
|
+
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identity_id" varchar, CONSTRAINT "REL_Connection_identityId" UNIQUE ("identity_id"))`);
|
|
8207
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
8208
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
8209
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
8210
|
+
await queryRunner.query(`CREATE TABLE "PartyType" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('naturalPerson','organization') ) NOT NULL, "origin" varchar CHECK( "origin" IN ('INTERNAL', 'EXTERNAL') ) NOT NULL, "name" varchar(255) NOT NULL, "description" varchar(255), "tenant_id" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"))`);
|
|
8211
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
8212
|
+
await queryRunner.query(`CREATE TABLE "BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"))`);
|
|
8213
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
8214
|
+
await queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
8215
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
8216
|
+
await queryRunner.query(`CREATE TABLE "Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL)`);
|
|
8217
|
+
await queryRunner.query(`CREATE TABLE "BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"))`);
|
|
8218
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
8219
|
+
await queryRunner.query(`CREATE TABLE "temporary_CorrelationIdentifier" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('did','url') ) NOT NULL, "correlation_id" text NOT NULL, "identity_id" varchar, CONSTRAINT "REL_CorrelationIdentifier_identity_id" UNIQUE ("identity_id"), CONSTRAINT "UQ_CorrelationIdentifier_correlation_id" UNIQUE ("correlation_id"), CONSTRAINT "FK_CorrelationIdentifier_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8220
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identity_id" FROM "CorrelationIdentifier"`);
|
|
8221
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
8222
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
8223
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
8224
|
+
await queryRunner.query(`CREATE TABLE "temporary_BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8225
|
+
await queryRunner.query(`INSERT INTO "temporary_BaseContact"("id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id") SELECT "id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id" FROM "BaseContact"`);
|
|
8226
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
8227
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
8228
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
8229
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
8230
|
+
await queryRunner.query(`CREATE TABLE "temporary_PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8231
|
+
await queryRunner.query(`INSERT INTO "temporary_PartyRelationship"("id", "left_id", "right_id", "created_at", "last_updated_at") SELECT "id", "left_id", "right_id", "created_at", "last_updated_at" FROM "PartyRelationship"`);
|
|
8232
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
8233
|
+
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
8234
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
8235
|
+
await queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar(255) NOT NULL, "electronic_address" varchar(255) NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8236
|
+
await queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar(255) NOT NULL, "street_name" varchar(255) NOT NULL, "street_number" varchar(255) NOT NULL, "postal_code" varchar(255) NOT NULL, "city_name" varchar(255) NOT NULL, "province_name" varchar(255) NOT NULL, "country_code" varchar(2) NOT NULL, "building_name" varchar(255), "partyId" varchar, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PhysicalAddressEntity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8237
|
+
await queryRunner.query(`CREATE TABLE "temporary_Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL, CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`);
|
|
8238
|
+
await queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
8239
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
8240
|
+
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
8241
|
+
await queryRunner.query(`CREATE TABLE "temporary_Identity" ("id" varchar PRIMARY KEY NOT NULL, "alias" varchar(255) NOT NULL, "roles" text NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "partyId" varchar, CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"), CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8242
|
+
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId") SELECT "id", "alias", "roles", "created_at", "last_updated_at", "partyId" FROM "Identity"`);
|
|
8243
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
8244
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
8245
|
+
await queryRunner.query(`CREATE TABLE "temporary_Connection" ("id" varchar PRIMARY KEY NOT NULL, "type" varchar CHECK( "type" IN ('OIDC','SIOPv2','SIOPv2+OpenID4VP') ) NOT NULL, "identity_id" varchar, CONSTRAINT "REL_Connection_identity_id" UNIQUE ("identity_id"), CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8246
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identity_id" FROM "Connection"`);
|
|
8247
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
8248
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
8249
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
8250
|
+
await queryRunner.query(`CREATE TABLE "temporary_BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8251
|
+
await queryRunner.query(`INSERT INTO "temporary_BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
8252
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
8253
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
8254
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
8255
|
+
await queryRunner.query(`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId" FROM "BaseConfigEntity"`);
|
|
8256
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
8257
|
+
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', datetime('now'), datetime('now'))`);
|
|
8258
|
+
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', datetime('now'), datetime('now'))`);
|
|
8259
|
+
await queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
|
|
8260
|
+
await queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
|
|
8261
|
+
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
8392
8262
|
}
|
|
8393
8263
|
async down(queryRunner) {
|
|
8394
|
-
await queryRunner.query(`
|
|
8264
|
+
await queryRunner.query(`CREATE TABLE "Contact" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "name" varchar(255), "alias" varchar(255))`);
|
|
8265
|
+
await queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
8266
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
8267
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
8268
|
+
await queryRunner.query(`CREATE TABLE "BaseConfigEntity" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connectionId" varchar)`);
|
|
8269
|
+
await queryRunner.query(`INSERT INTO "BaseConfigEntity"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
8270
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
8271
|
+
await queryRunner.query(`CREATE TABLE "temporary_Party" ("id" varchar PRIMARY KEY NOT NULL, "uri" varchar(255), "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "party_type_id" varchar NOT NULL, CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`);
|
|
8272
|
+
await queryRunner.query(`INSERT INTO "temporary_Party"("id", "uri", "created_at", "last_updated_at", "party_type_id") SELECT "id", "uri", "created_at", "last_updated_at", "party_type_id" FROM "Party"`);
|
|
8273
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
8274
|
+
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
8275
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
8276
|
+
await queryRunner.query(`CREATE TABLE "temporary_PartyRelationship" ("id" varchar PRIMARY KEY NOT NULL, "left_id" varchar NOT NULL, "right_id" varchar NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8277
|
+
await queryRunner.query(`INSERT INTO "temporary_PartyRelationship"("id", "left_id", "right_id", "created_at", "last_updated_at") SELECT "id", "left_id", "right_id", "created_at", "last_updated_at" FROM "PartyRelationship"`);
|
|
8278
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
8279
|
+
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
8280
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
8281
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
8282
|
+
await queryRunner.query(`CREATE TABLE "temporary_BaseContact" ("id" varchar PRIMARY KEY NOT NULL, "created_at" datetime NOT NULL DEFAULT (datetime('now')), "last_updated_at" datetime NOT NULL DEFAULT (datetime('now')), "legal_name" varchar(255), "display_name" varchar(255), "first_name" varchar(255), "middle_name" varchar(255), "last_name" varchar(255), "type" varchar NOT NULL, "party_id" varchar, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8283
|
+
await queryRunner.query(`INSERT INTO "temporary_BaseContact"("id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id") SELECT "id", "created_at", "last_updated_at", "legal_name", "display_name", "first_name", "middle_name", "last_name", "type", "party_id" FROM "BaseContact"`);
|
|
8284
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
8285
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
8286
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
8287
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
8288
|
+
await queryRunner.query(`CREATE TABLE "temporary_BaseConfig" ("id" varchar PRIMARY KEY NOT NULL, "identifier" varchar(255), "redirect_url" varchar(255), "session_id" varchar(255), "client_id" varchar(255), "client_secret" varchar(255), "scopes" text, "issuer" varchar(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" varchar NOT NULL, "connection_id" varchar, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)`);
|
|
8289
|
+
await queryRunner.query(`INSERT INTO "temporary_BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id" FROM "BaseConfig"`);
|
|
8290
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
8291
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
8292
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
8293
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
8294
|
+
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
8295
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
8296
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
8297
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
8298
|
+
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
8299
|
+
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
8395
8300
|
}
|
|
8396
8301
|
};
|
|
8397
8302
|
|
|
8398
|
-
// src/migrations/
|
|
8399
|
-
var
|
|
8303
|
+
// src/migrations/postgres/1690925872592-CreateContacts.ts
|
|
8304
|
+
var import_ssi_sdk22 = require("@sphereon/ssi-sdk.core");
|
|
8305
|
+
var CreateContacts1690925872592 = class {
|
|
8400
8306
|
static {
|
|
8401
|
-
__name(this, "
|
|
8307
|
+
__name(this, "CreateContacts1690925872592");
|
|
8402
8308
|
}
|
|
8403
|
-
name = "
|
|
8309
|
+
name = "CreateContacts1690925872592";
|
|
8404
8310
|
async up(queryRunner) {
|
|
8405
|
-
await
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
|
|
8311
|
+
await (0, import_ssi_sdk22.enablePostgresUuidExtension)(queryRunner);
|
|
8312
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`);
|
|
8313
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
8314
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`);
|
|
8315
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`);
|
|
8316
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
8317
|
+
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
8318
|
+
await queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
|
|
8319
|
+
await queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
8320
|
+
await queryRunner.query(`CREATE TABLE "PartyType" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" "public"."PartyType_type_enum" NOT NULL, "origin" "public"."PartyOrigin_type_enum" NOT NULL, "name" character varying(255) NOT NULL, "description" character varying(255), "tenant_id" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_PartyType_name" UNIQUE ("name"), CONSTRAINT "PK_PartyType_id" PRIMARY KEY ("id"))`);
|
|
8321
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
8322
|
+
await queryRunner.query(`CREATE TABLE "BaseContact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "legal_name" character varying(255), "display_name" character varying(255), "first_name" character varying(255), "middle_name" character varying(255), "last_name" character varying(255), "type" character varying NOT NULL, "party_id" uuid, CONSTRAINT "UQ_BaseContact_legal_name" UNIQUE ("legal_name"), CONSTRAINT "REL_BaseContact_party_id" UNIQUE ("party_id"), CONSTRAINT "PK_BaseContact_id" PRIMARY KEY ("id"))`);
|
|
8323
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
8324
|
+
await queryRunner.query(`CREATE TABLE "PartyRelationship" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "left_id" uuid NOT NULL, "right_id" uuid NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PartyRelationship_id" PRIMARY KEY ("id"))`);
|
|
8325
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
8326
|
+
await queryRunner.query(`CREATE TABLE "ElectronicAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "electronic_address" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "partyId" uuid, CONSTRAINT "PK_ElectronicAddress_id" PRIMARY KEY ("id"))`);
|
|
8327
|
+
await queryRunner.query(`CREATE TABLE "PhysicalAddress" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "type" character varying(255) NOT NULL, "street_name" character varying(255) NOT NULL, "street_number" character varying(255) NOT NULL, "postal_code" character varying(255) NOT NULL, "city_name" character varying(255) NOT NULL, "province_name" character varying(255) NOT NULL, "country_code" character varying(2) NOT NULL, "building_name" character varying(255), "partyId" uuid, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_PhysicalAddress_id" PRIMARY KEY ("id"))`);
|
|
8328
|
+
await queryRunner.query(`CREATE TABLE "Party" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "party_type_id" uuid NOT NULL, CONSTRAINT "PK_Party_id" PRIMARY KEY ("id"))`);
|
|
8329
|
+
await queryRunner.query(`CREATE TABLE "BaseConfig" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "identifier" character varying(255), "redirect_url" character varying(255), "session_id" character varying(255), "client_id" character varying(255), "client_secret" character varying(255), "scopes" text, "issuer" character varying(255), "dangerously_allow_insecure_http_requests" boolean, "client_auth_method" text, "type" character varying NOT NULL, "connection_id" uuid, CONSTRAINT "REL_BaseConfig_connection_id" UNIQUE ("connection_id"), CONSTRAINT "PK_BaseConfig_id" PRIMARY KEY ("id"))`);
|
|
8330
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
8331
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
|
|
8332
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" SET NOT NULL`);
|
|
8333
|
+
await queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
8334
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
|
|
8335
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
|
|
8336
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8337
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8338
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD CONSTRAINT "FK_BaseContact_party_id" FOREIGN KEY ("party_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8339
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_left_id" FOREIGN KEY ("left_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8340
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD CONSTRAINT "FK_PartyRelationship_right_id" FOREIGN KEY ("right_id") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8341
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8342
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8343
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD CONSTRAINT "FK_Party_party_type_id" FOREIGN KEY ("party_type_id") REFERENCES "PartyType"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
8344
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8345
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identity_id" FOREIGN KEY ("identity_id") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8346
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD CONSTRAINT "FK_BaseConfig_connection_id" FOREIGN KEY ("connection_id") REFERENCES "Connection"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8347
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
|
|
8348
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
|
|
8349
|
+
await queryRunner.query(`INSERT INTO "BaseConfig"("id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connection_id") SELECT "id", "identifier", "redirect_url", "session_id", "client_id", "client_secret", "scopes", "issuer", "dangerously_allow_insecure_http_requests", "client_auth_method", "type", "connectionId" FROM "BaseConfigEntity"`);
|
|
8350
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
8351
|
+
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('3875c12e-fdaa-4ef6-a340-c936e054b627', 'organization', 'INTERNAL', 'Sphereon_default_organization_type', 'sphereon_default_organization', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
|
|
8352
|
+
await queryRunner.query(`INSERT INTO "PartyType"(id, type, origin, name, description, tenant_id, created_at, last_updated_at) VALUES ('7d248798-41ca-4fc1-a130-9934b43d532e', 'naturalPerson', 'INTERNAL', 'Sphereon_default_natural_person_type', 'sphereon_default_natural_person', '95e09cfc-c974-4174-86aa-7bf1d5251fb4', now(), now())`);
|
|
8353
|
+
await queryRunner.query(`INSERT INTO "Party"(id, uri, created_at, last_updated_at, party_type_id) SELECT id, uri, created_at, last_updated_at, '3875c12e-fdaa-4ef6-a340-c936e054b627' FROM "Contact"`);
|
|
8354
|
+
await queryRunner.query(`INSERT INTO "BaseContact"(id, legal_name, display_name, party_id, created_at, last_updated_at, type) SELECT id, name, alias, id, created_at, last_updated_at, 'Organization' FROM "Contact"`);
|
|
8355
|
+
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
8421
8356
|
}
|
|
8422
8357
|
async down(queryRunner) {
|
|
8423
|
-
await queryRunner.query(`
|
|
8358
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP CONSTRAINT "FK_BaseConfig_connection_id"`);
|
|
8359
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identity_id"`);
|
|
8360
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_partyId"`);
|
|
8361
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP CONSTRAINT "FK_Party_party_type_id"`);
|
|
8362
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP CONSTRAINT "FK_PhysicalAddress_partyId"`);
|
|
8363
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP CONSTRAINT "FK_ElectronicAddress_partyId"`);
|
|
8364
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_right_id"`);
|
|
8365
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_left_id"`);
|
|
8366
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP CONSTRAINT "FK_BaseContact_party_id"`);
|
|
8367
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
8368
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identity_id"`);
|
|
8369
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" DROP NOT NULL`);
|
|
8370
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "origin"`);
|
|
8371
|
+
await queryRunner.query(`DROP TYPE "public"."IdentityOrigin_type_enum"`);
|
|
8372
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "partyId" TO "contactId"`);
|
|
8373
|
+
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
8374
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
8375
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
8376
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
8377
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
8378
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
8379
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
8380
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
8381
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
8382
|
+
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
8383
|
+
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
8384
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
8385
|
+
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
8386
|
+
await queryRunner.query(`DROP TYPE "public"."PartyOrigin_type_enum"`);
|
|
8387
|
+
await queryRunner.query(`DROP TYPE "public"."PartyType_type_enum"`);
|
|
8388
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8389
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8390
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8391
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8392
|
+
await queryRunner.query(`CREATE TABLE "Contact" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "name" character varying(255), "alias" character varying(255), CONSTRAINT "PK_Contact_id" PRIMARY KEY ("id"))`);
|
|
8393
|
+
await queryRunner.query(`INSERT INTO "Contact"(id, uri, created_at, last_updated_at, name, alias) SELECT id, uri, created_at, last_updated_at, (SELECT legal_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id"), (SELECT display_name FROM "BaseContact" WHERE "BaseContact"."party_id" = "Party"."id") FROM "Party" WHERE party_type_id = '3875c12e-fdaa-4ef6-a340-c936e054b627'`);
|
|
8424
8394
|
}
|
|
8425
8395
|
};
|
|
8426
8396
|
|
|
8427
|
-
// src/migrations/generic/
|
|
8397
|
+
// src/migrations/generic/3-CreateContacts.ts
|
|
8428
8398
|
var debug14 = (0, import_debug14.default)("sphereon:ssi-sdk:migrations");
|
|
8429
|
-
var
|
|
8399
|
+
var CreateContacts1690925872318 = class {
|
|
8430
8400
|
static {
|
|
8431
|
-
__name(this, "
|
|
8401
|
+
__name(this, "CreateContacts1690925872318");
|
|
8432
8402
|
}
|
|
8433
|
-
name = "
|
|
8403
|
+
name = "CreateContacts1690925872318";
|
|
8434
8404
|
async up(queryRunner) {
|
|
8435
|
-
debug14("migration: creating
|
|
8405
|
+
debug14("migration: creating contacts tables");
|
|
8436
8406
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8437
8407
|
switch (dbType) {
|
|
8438
8408
|
case "postgres": {
|
|
8439
8409
|
debug14("using postgres migration file");
|
|
8440
|
-
const mig = new
|
|
8410
|
+
const mig = new CreateContacts1690925872592();
|
|
8441
8411
|
await mig.up(queryRunner);
|
|
8442
8412
|
debug14("Migration statements executed");
|
|
8443
8413
|
return;
|
|
@@ -8446,7 +8416,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8446
8416
|
case "expo":
|
|
8447
8417
|
case "react-native": {
|
|
8448
8418
|
debug14("using sqlite/react-native migration file");
|
|
8449
|
-
const mig = new
|
|
8419
|
+
const mig = new CreateContacts1690925872693();
|
|
8450
8420
|
await mig.up(queryRunner);
|
|
8451
8421
|
debug14("Migration statements executed");
|
|
8452
8422
|
return;
|
|
@@ -8456,12 +8426,12 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8456
8426
|
}
|
|
8457
8427
|
}
|
|
8458
8428
|
async down(queryRunner) {
|
|
8459
|
-
debug14("migration: reverting
|
|
8429
|
+
debug14("migration: reverting contacts tables");
|
|
8460
8430
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8461
8431
|
switch (dbType) {
|
|
8462
8432
|
case "postgres": {
|
|
8463
8433
|
debug14("using postgres migration file");
|
|
8464
|
-
const mig = new
|
|
8434
|
+
const mig = new CreateContacts1690925872592();
|
|
8465
8435
|
await mig.down(queryRunner);
|
|
8466
8436
|
debug14("Migration statements executed");
|
|
8467
8437
|
return;
|
|
@@ -8470,7 +8440,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8470
8440
|
case "expo":
|
|
8471
8441
|
case "react-native": {
|
|
8472
8442
|
debug14("using sqlite/react-native migration file");
|
|
8473
|
-
const mig = new
|
|
8443
|
+
const mig = new CreateContacts1690925872693();
|
|
8474
8444
|
await mig.down(queryRunner);
|
|
8475
8445
|
debug14("Migration statements executed");
|
|
8476
8446
|
return;
|
|
@@ -8481,303 +8451,380 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8481
8451
|
}
|
|
8482
8452
|
};
|
|
8483
8453
|
|
|
8484
|
-
// src/migrations/generic/
|
|
8454
|
+
// src/migrations/generic/4-CreateStatusList.ts
|
|
8485
8455
|
var import_debug15 = __toESM(require("debug"), 1);
|
|
8486
8456
|
|
|
8487
|
-
// src/migrations/postgres/
|
|
8488
|
-
var
|
|
8457
|
+
// src/migrations/postgres/1693866470001-CreateStatusList.ts
|
|
8458
|
+
var CreateStatusList1693866470001 = class {
|
|
8489
8459
|
static {
|
|
8490
|
-
__name(this, "
|
|
8460
|
+
__name(this, "CreateStatusList1693866470001");
|
|
8491
8461
|
}
|
|
8492
|
-
name = "
|
|
8462
|
+
name = "CreateStatusList1693866470001";
|
|
8493
8463
|
async up(queryRunner) {
|
|
8494
|
-
await queryRunner.query(`
|
|
8495
|
-
await queryRunner.query(`
|
|
8496
|
-
await queryRunner.query(`
|
|
8497
|
-
await queryRunner.query(`
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
await queryRunner.query(`
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8464
|
+
await queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
|
|
8465
|
+
await queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
|
|
8466
|
+
await queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
|
|
8467
|
+
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
8468
|
+
(
|
|
8469
|
+
"statusListId" character varying NOT NULL,
|
|
8470
|
+
"statusListIndex" integer NOT NULL,
|
|
8471
|
+
"credentialId" character varying,
|
|
8472
|
+
"credentialHash" character varying(128),
|
|
8473
|
+
"correlationId" character varying(255),
|
|
8474
|
+
"value" character varying(50),
|
|
8475
|
+
CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8476
|
+
)`);
|
|
8477
|
+
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
8478
|
+
(
|
|
8479
|
+
"id" character varying NOT NULL,
|
|
8480
|
+
"correlationId" character varying NOT NULL,
|
|
8481
|
+
"length" integer NOT NULL,
|
|
8482
|
+
"issuer" text NOT NULL,
|
|
8483
|
+
"type" "StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021',
|
|
8484
|
+
"driverType" "StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm',
|
|
8485
|
+
"credentialIdMode" "StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE',
|
|
8486
|
+
"proofFormat" character varying NOT NULL DEFAULT 'lds',
|
|
8487
|
+
"indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft',
|
|
8488
|
+
"statusPurpose" character varying NOT NULL DEFAULT 'revocation',
|
|
8489
|
+
"statusListCredential" text,
|
|
8490
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"),
|
|
8491
|
+
CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id")
|
|
8492
|
+
)`);
|
|
8493
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
8494
|
+
ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
8512
8495
|
}
|
|
8513
8496
|
async down(queryRunner) {
|
|
8514
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8515
|
-
|
|
8516
|
-
await queryRunner.query(`
|
|
8517
|
-
await queryRunner.query(`
|
|
8518
|
-
await queryRunner.query(`
|
|
8519
|
-
await queryRunner.query(`
|
|
8520
|
-
await queryRunner.query(`
|
|
8521
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
8522
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
8523
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
8524
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
8525
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
8526
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
8527
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
8528
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
8529
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
8530
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
8531
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
8497
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
8498
|
+
DROP CONSTRAINT "FK_statusListEntry_statusListId"`);
|
|
8499
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8500
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8501
|
+
await queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
|
|
8502
|
+
await queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
|
|
8503
|
+
await queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
|
|
8532
8504
|
}
|
|
8533
8505
|
};
|
|
8534
8506
|
|
|
8535
|
-
// src/migrations/sqlite/
|
|
8536
|
-
var
|
|
8507
|
+
// src/migrations/sqlite/1693866470000-CreateStatusList.ts
|
|
8508
|
+
var CreateStatusList1693866470002 = class {
|
|
8537
8509
|
static {
|
|
8538
|
-
__name(this, "
|
|
8510
|
+
__name(this, "CreateStatusList1693866470002");
|
|
8539
8511
|
}
|
|
8540
|
-
name = "
|
|
8512
|
+
name = "CreateStatusList1693866470002";
|
|
8541
8513
|
async up(queryRunner) {
|
|
8542
|
-
await queryRunner.query(`
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
await queryRunner.query(`
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8514
|
+
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
8515
|
+
(
|
|
8516
|
+
"statusListId" varchar NOT NULL,
|
|
8517
|
+
"statusListIndex" integer NOT NULL,
|
|
8518
|
+
"credentialId" varchar,
|
|
8519
|
+
"credentialHash" varchar(128),
|
|
8520
|
+
"correlationId" varchar(255),
|
|
8521
|
+
"value" varchar(50),
|
|
8522
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8523
|
+
)`);
|
|
8524
|
+
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
8525
|
+
(
|
|
8526
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8527
|
+
"correlationId" varchar NOT NULL,
|
|
8528
|
+
"length" integer NOT NULL,
|
|
8529
|
+
"issuer" text NOT NULL,
|
|
8530
|
+
"type" varchar CHECK ( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8531
|
+
"driverType" varchar CHECK ( "driverType" IN ('agent_typeorm', 'agent_kv_store', 'github',
|
|
8532
|
+
'agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8533
|
+
"credentialIdMode" varchar CHECK ( "credentialIdMode" IN ('ISSUANCE', 'PERSISTENCE', 'NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8534
|
+
"proofFormat" varchar CHECK ( "proofFormat" IN ('lds', 'jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8535
|
+
"indexingDirection" varchar CHECK ( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
8536
|
+
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
8537
|
+
"statusListCredential" text,
|
|
8538
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8539
|
+
)`);
|
|
8540
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusListEntry"
|
|
8541
|
+
(
|
|
8542
|
+
"statusListId" varchar NOT NULL,
|
|
8543
|
+
"statusListIndex" integer NOT NULL,
|
|
8544
|
+
"credentialId" varchar,
|
|
8545
|
+
"credentialHash" varchar(128),
|
|
8546
|
+
"correlationId" varchar(255),
|
|
8547
|
+
"value" varchar(50),
|
|
8548
|
+
CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
8549
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8550
|
+
)`);
|
|
8551
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusListEntry"("statusListId", "statusListIndex", "credentialId",
|
|
8552
|
+
"credentialHash", "correlationId", "value")
|
|
8553
|
+
SELECT "statusListId", "statusListIndex", "credentialId", "credentialHash", "correlationId", "value"
|
|
8554
|
+
FROM "StatusListEntry"`);
|
|
8555
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8556
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
8575
8557
|
}
|
|
8576
8558
|
async down(queryRunner) {
|
|
8577
|
-
await queryRunner.query(`
|
|
8578
|
-
await queryRunner.query(`
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
await queryRunner.query(`ALTER
|
|
8590
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8591
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8592
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8593
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8594
|
-
|
|
8559
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8560
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8561
|
+
}
|
|
8562
|
+
};
|
|
8563
|
+
|
|
8564
|
+
// src/migrations/postgres/1737110469001-UpdateStatusList.ts
|
|
8565
|
+
var UpdateStatusList1737110469001 = class {
|
|
8566
|
+
static {
|
|
8567
|
+
__name(this, "UpdateStatusList1737110469001");
|
|
8568
|
+
}
|
|
8569
|
+
name = "UpdateStatusList1737110469001";
|
|
8570
|
+
async up(queryRunner) {
|
|
8571
|
+
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'OAuthStatusList'`);
|
|
8572
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" DROP NOT NULL`);
|
|
8573
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" DROP NOT NULL`);
|
|
8574
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer DEFAULT 1`);
|
|
8575
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "expiresAt" timestamp with time zone`);
|
|
8576
|
+
}
|
|
8577
|
+
async down(queryRunner) {
|
|
8578
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "expiresAt"`);
|
|
8579
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`);
|
|
8580
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" SET NOT NULL`);
|
|
8581
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" SET NOT NULL`);
|
|
8582
|
+
}
|
|
8583
|
+
};
|
|
8584
|
+
|
|
8585
|
+
// src/migrations/sqlite/1737110469000-UpdateStatusList.ts
|
|
8586
|
+
var UpdateStatusList1737110469000 = class {
|
|
8587
|
+
static {
|
|
8588
|
+
__name(this, "UpdateStatusList1737110469000");
|
|
8589
|
+
}
|
|
8590
|
+
name = "UpdateStatusList1737110469000";
|
|
8591
|
+
async up(queryRunner) {
|
|
8592
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusList" (
|
|
8593
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8594
|
+
"correlationId" varchar NOT NULL,
|
|
8595
|
+
"length" integer NOT NULL,
|
|
8596
|
+
"issuer" text NOT NULL,
|
|
8597
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8598
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8599
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8600
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8601
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
8602
|
+
"statusPurpose" varchar,
|
|
8603
|
+
"statusListCredential" text,
|
|
8604
|
+
"bitsPerStatus" integer,
|
|
8605
|
+
"expiresAt" datetime,
|
|
8606
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8607
|
+
)`);
|
|
8608
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
8609
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8610
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8611
|
+
"statusListCredential"
|
|
8612
|
+
)
|
|
8613
|
+
SELECT
|
|
8614
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8615
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8616
|
+
"statusListCredential"
|
|
8617
|
+
FROM "StatusList"`);
|
|
8618
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8619
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
8620
|
+
}
|
|
8621
|
+
async down(queryRunner) {
|
|
8622
|
+
await queryRunner.query(`
|
|
8623
|
+
ALTER TABLE "StatusListEntry"
|
|
8624
|
+
RENAME COLUMN "entryCorrelationId" TO "correlationId"
|
|
8625
|
+
`);
|
|
8626
|
+
await queryRunner.query(`
|
|
8627
|
+
ALTER TABLE "StatusListEntry"
|
|
8628
|
+
DROP COLUMN "statusListCorrelationId"
|
|
8629
|
+
`);
|
|
8630
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusList" (
|
|
8631
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8632
|
+
"correlationId" varchar NOT NULL,
|
|
8633
|
+
"length" integer NOT NULL,
|
|
8634
|
+
"issuer" text NOT NULL,
|
|
8635
|
+
"type" varchar CHECK( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8636
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8637
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8638
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8639
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
8640
|
+
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
8641
|
+
"statusListCredential" text,
|
|
8642
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8643
|
+
)`);
|
|
8644
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
8645
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8646
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8647
|
+
"statusListCredential"
|
|
8648
|
+
)
|
|
8649
|
+
SELECT
|
|
8650
|
+
"id", "correlationId", "length", "issuer",
|
|
8651
|
+
CASE WHEN "type" = 'OAuthStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
8652
|
+
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
8653
|
+
COALESCE("statusPurpose", 'revocation'), "statusListCredential"
|
|
8654
|
+
FROM "StatusList"`);
|
|
8655
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8656
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
8595
8657
|
}
|
|
8596
8658
|
};
|
|
8597
8659
|
|
|
8598
|
-
// src/migrations/generic/
|
|
8660
|
+
// src/migrations/generic/4-CreateStatusList.ts
|
|
8599
8661
|
var debug15 = (0, import_debug15.default)("sphereon:ssi-sdk:migrations");
|
|
8600
|
-
var
|
|
8662
|
+
var CreateStatusList1693866470000 = class {
|
|
8601
8663
|
static {
|
|
8602
|
-
__name(this, "
|
|
8664
|
+
__name(this, "CreateStatusList1693866470000");
|
|
8603
8665
|
}
|
|
8604
|
-
name = "
|
|
8666
|
+
name = "CreateStatusList1693866470000";
|
|
8605
8667
|
async up(queryRunner) {
|
|
8606
|
-
debug15("migration:
|
|
8668
|
+
debug15("migration: creating issuance branding tables");
|
|
8607
8669
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
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`);
|
|
8670
|
+
if (dbType === "postgres") {
|
|
8671
|
+
debug15("using postgres migration files");
|
|
8672
|
+
const createMig = new CreateStatusList1693866470001();
|
|
8673
|
+
await createMig.up(queryRunner);
|
|
8674
|
+
const updateMig = new UpdateStatusList1737110469001();
|
|
8675
|
+
const up = await updateMig.up(queryRunner);
|
|
8676
|
+
debug15("Migration statements executed");
|
|
8677
|
+
return up;
|
|
8678
|
+
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
8679
|
+
debug15("using sqlite/react-native migration files");
|
|
8680
|
+
const createMig = new CreateStatusList1693866470002();
|
|
8681
|
+
await createMig.up(queryRunner);
|
|
8682
|
+
const updateMig = new UpdateStatusList1737110469000();
|
|
8683
|
+
const up = await updateMig.up(queryRunner);
|
|
8684
|
+
debug15("Migration statements executed");
|
|
8685
|
+
return up;
|
|
8686
|
+
} else {
|
|
8687
|
+
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`);
|
|
8627
8688
|
}
|
|
8628
8689
|
}
|
|
8629
8690
|
async down(queryRunner) {
|
|
8630
|
-
debug15("migration: reverting
|
|
8691
|
+
debug15("migration: reverting issuance branding tables");
|
|
8631
8692
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
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`);
|
|
8693
|
+
if (dbType === "postgres") {
|
|
8694
|
+
debug15("using postgres migration files");
|
|
8695
|
+
const updateMig = new UpdateStatusList1737110469001();
|
|
8696
|
+
await updateMig.down(queryRunner);
|
|
8697
|
+
const createMig = new CreateStatusList1693866470001();
|
|
8698
|
+
const down = await createMig.down(queryRunner);
|
|
8699
|
+
debug15("Migration statements executed");
|
|
8700
|
+
return down;
|
|
8701
|
+
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
8702
|
+
debug15("using sqlite/react-native migration files");
|
|
8703
|
+
const updateMig = new UpdateStatusList1737110469000();
|
|
8704
|
+
await updateMig.down(queryRunner);
|
|
8705
|
+
const createMig = new CreateStatusList1693866470002();
|
|
8706
|
+
const down = await createMig.down(queryRunner);
|
|
8707
|
+
debug15("Migration statements executed");
|
|
8708
|
+
return down;
|
|
8709
|
+
} else {
|
|
8710
|
+
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`);
|
|
8651
8711
|
}
|
|
8652
8712
|
}
|
|
8653
8713
|
};
|
|
8654
8714
|
|
|
8655
|
-
// src/migrations/generic/
|
|
8715
|
+
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
8656
8716
|
var import_debug16 = __toESM(require("debug"), 1);
|
|
8657
8717
|
|
|
8658
|
-
// src/migrations/
|
|
8659
|
-
var
|
|
8718
|
+
// src/migrations/sqlite/1701634819487-CreateAuditEvents.ts
|
|
8719
|
+
var CreateAuditEvents1701634819487 = class {
|
|
8660
8720
|
static {
|
|
8661
|
-
__name(this, "
|
|
8721
|
+
__name(this, "CreateAuditEvents1701634819487");
|
|
8662
8722
|
}
|
|
8663
|
-
name = "
|
|
8723
|
+
name = "CreateAuditEvents1701634819487";
|
|
8664
8724
|
async up(queryRunner) {
|
|
8665
|
-
await queryRunner.query(`
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
8693
|
-
)`);
|
|
8725
|
+
await queryRunner.query(`CREATE TABLE "AuditEvents" (
|
|
8726
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8727
|
+
"eventType" varchar CHECK( "eventType" IN ('audit','activity','general') ) NOT NULL,
|
|
8728
|
+
"timestamp" datetime NOT NULL,
|
|
8729
|
+
"level" varchar CHECK( "level" IN ('0','1','2','3','4') ) NOT NULL,
|
|
8730
|
+
"correlationId" varchar NOT NULL,
|
|
8731
|
+
"system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','oid4vp','siopv2','PE','credentials','web3','profile','contact') ) NOT NULL,
|
|
8732
|
+
"subSystemType" varchar CHECK( "subSystemType" IN ('key','did_provider','did_resolver','oid4vp_op','oid4vci_client','siopv2_op','contact_manager','vc_issuer','vc_verifier','vc_persistence','transport','profile','api') ) NOT NULL,
|
|
8733
|
+
"actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL,
|
|
8734
|
+
"actionSubType" varchar NOT NULL,
|
|
8735
|
+
"initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL,
|
|
8736
|
+
"systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','url','email','hostname','phone','user') ),
|
|
8737
|
+
"systemCorrelationId" varchar,
|
|
8738
|
+
"systemAlias" varchar,
|
|
8739
|
+
"partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','url','email','hostname','phone') ),
|
|
8740
|
+
"partyCorrelationId" varchar,
|
|
8741
|
+
"partyAlias" varchar,
|
|
8742
|
+
"credentialType" varchar CHECK( "credentialType" IN ('JSON_LD','JWT','SD_JWT','MSO_MDOC') ),
|
|
8743
|
+
"credentialHash" varchar,
|
|
8744
|
+
"parentCredentialHash" varchar,
|
|
8745
|
+
"originalCredential" varchar,
|
|
8746
|
+
"sharePurpose" varchar,
|
|
8747
|
+
"description" varchar NOT NULL,
|
|
8748
|
+
"data" varchar,
|
|
8749
|
+
"diagnosticData" varchar,
|
|
8750
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8751
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
8694
8752
|
}
|
|
8695
8753
|
async down(queryRunner) {
|
|
8696
|
-
await queryRunner.query(`DROP TABLE "
|
|
8697
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
8698
|
-
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
8699
|
-
(
|
|
8700
|
-
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
8701
|
-
"label" character varying(255) NOT NULL,
|
|
8702
|
-
"value" character varying(255) NOT NULL,
|
|
8703
|
-
"identityId" uuid,
|
|
8704
|
-
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
8705
|
-
)`);
|
|
8706
|
-
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
8707
|
-
SELECT "id", "label", "stringValue", "identityId"
|
|
8708
|
-
FROM "temporary_IdentityMetadata"`);
|
|
8709
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8754
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`);
|
|
8710
8755
|
}
|
|
8711
8756
|
};
|
|
8712
8757
|
|
|
8713
|
-
// src/migrations/
|
|
8714
|
-
var
|
|
8758
|
+
// src/migrations/postgres/1701634812183-CreateAuditEvents.ts
|
|
8759
|
+
var CreateAuditEvents1701634812183 = class {
|
|
8715
8760
|
static {
|
|
8716
|
-
__name(this, "
|
|
8761
|
+
__name(this, "CreateAuditEvents1701634812183");
|
|
8717
8762
|
}
|
|
8718
|
-
name = "
|
|
8763
|
+
name = "CreateAuditEvents1701634812183";
|
|
8719
8764
|
async up(queryRunner) {
|
|
8720
|
-
await queryRunner.query(`
|
|
8721
|
-
await queryRunner.query(`CREATE
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8765
|
+
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3', '4')`);
|
|
8766
|
+
await queryRunner.query(`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'oid4vp', 'siopv2', 'PE', 'credentials', 'web3', 'profile', 'contact')`);
|
|
8767
|
+
await queryRunner.query(`CREATE TYPE "public"."Subsystem_type_enum" AS ENUM('key', 'did_provider', 'did_resolver', 'oid4vp_op', 'oid4vci_client', 'siopv2_op', 'contact_manager', 'vc_issuer', 'vc_verifier', 'vc_persistence', 'transport', 'profile', 'api')`);
|
|
8768
|
+
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`);
|
|
8769
|
+
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`);
|
|
8770
|
+
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone', 'user')`);
|
|
8771
|
+
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone')`);
|
|
8772
|
+
await queryRunner.query(`CREATE TYPE "public"."Event_type_enum" AS ENUM('audit', 'activity', 'general')`);
|
|
8773
|
+
await queryRunner.query(`CREATE TYPE "public"."Event_credential_type_enum" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`);
|
|
8774
|
+
await queryRunner.query(`CREATE TABLE "AuditEvents" (
|
|
8775
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
8776
|
+
"eventType" "public"."Event_type_enum" NOT NULL,
|
|
8777
|
+
"timestamp" TIMESTAMP NOT NULL,
|
|
8778
|
+
"level" "public"."Level_enum" NOT NULL,
|
|
8779
|
+
"correlationId" TEXT NOT NULL,
|
|
8780
|
+
"system" "public"."System_enum" NOT NULL,
|
|
8781
|
+
"subSystemType" "public"."Subsystem_type_enum" NOT NULL,
|
|
8782
|
+
"actionType" "public"."Action_type_enum" NOT NULL,
|
|
8783
|
+
"actionSubType" TEXT NOT NULL,
|
|
8784
|
+
"initiatorType" "public"."Initiator_type_enum" NOT NULL,
|
|
8785
|
+
"systemCorrelationIdType" "public"."System_correlation_id_type_enum",
|
|
8786
|
+
"systemCorrelationId" TEXT,
|
|
8787
|
+
"systemAlias" TEXT,
|
|
8788
|
+
"partyCorrelationType" "public"."Party_correlation_type_enum",
|
|
8789
|
+
"partyCorrelationId" TEXT,
|
|
8790
|
+
"partyAlias" TEXT,
|
|
8791
|
+
"credentialType" "public"."Event_credential_type_enum",
|
|
8792
|
+
"credentialHash" TEXT,
|
|
8793
|
+
"originalCredential" TEXT,
|
|
8794
|
+
"sharePurpose" TEXT,
|
|
8795
|
+
"description" TEXT NOT NULL,
|
|
8796
|
+
"data" TEXT,
|
|
8797
|
+
"diagnosticData" TEXT,
|
|
8798
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8799
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8800
|
+
CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`);
|
|
8748
8801
|
}
|
|
8749
8802
|
async down(queryRunner) {
|
|
8750
|
-
await queryRunner.query(`DROP TABLE "
|
|
8751
|
-
await queryRunner.query(`
|
|
8752
|
-
await queryRunner.query(`
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
8759
|
-
)`);
|
|
8760
|
-
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
8761
|
-
SELECT "id", "label", "stringValue", "identityId"
|
|
8762
|
-
FROM "temporary_IdentityMetadata"`);
|
|
8763
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8803
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`);
|
|
8804
|
+
await queryRunner.query(`DROP TYPE "public"."Party_correlation_type_enum"`);
|
|
8805
|
+
await queryRunner.query(`DROP TYPE "public"."System_correlation_id_type_enum"`);
|
|
8806
|
+
await queryRunner.query(`DROP TYPE "public"."Initiator_type_enum"`);
|
|
8807
|
+
await queryRunner.query(`DROP TYPE "public"."Action_type_enum"`);
|
|
8808
|
+
await queryRunner.query(`DROP TYPE "public"."Subsystem_type_enum"`);
|
|
8809
|
+
await queryRunner.query(`DROP TYPE "public"."System_enum"`);
|
|
8810
|
+
await queryRunner.query(`DROP TYPE "public"."Level_enum"`);
|
|
8764
8811
|
}
|
|
8765
8812
|
};
|
|
8766
8813
|
|
|
8767
|
-
// src/migrations/generic/
|
|
8814
|
+
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
8768
8815
|
var debug16 = (0, import_debug16.default)("sphereon:ssi-sdk:migrations");
|
|
8769
|
-
var
|
|
8816
|
+
var CreateAuditEvents1701635835330 = class {
|
|
8770
8817
|
static {
|
|
8771
|
-
__name(this, "
|
|
8818
|
+
__name(this, "CreateAuditEvents1701635835330");
|
|
8772
8819
|
}
|
|
8773
|
-
name = "
|
|
8820
|
+
name = "CreateAuditEvents1701635835330";
|
|
8774
8821
|
async up(queryRunner) {
|
|
8775
|
-
debug16("migration:
|
|
8822
|
+
debug16("migration: creating audit events tables");
|
|
8776
8823
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8777
8824
|
switch (dbType) {
|
|
8778
8825
|
case "postgres": {
|
|
8779
8826
|
debug16("using postgres migration file");
|
|
8780
|
-
const mig = new
|
|
8827
|
+
const mig = new CreateAuditEvents1701634812183();
|
|
8781
8828
|
await mig.up(queryRunner);
|
|
8782
8829
|
debug16("Migration statements executed");
|
|
8783
8830
|
return;
|
|
@@ -8786,7 +8833,7 @@ var CreateContacts1715761125000 = class {
|
|
|
8786
8833
|
case "expo":
|
|
8787
8834
|
case "react-native": {
|
|
8788
8835
|
debug16("using sqlite/react-native migration file");
|
|
8789
|
-
const mig = new
|
|
8836
|
+
const mig = new CreateAuditEvents1701634819487();
|
|
8790
8837
|
await mig.up(queryRunner);
|
|
8791
8838
|
debug16("Migration statements executed");
|
|
8792
8839
|
return;
|
|
@@ -8796,12 +8843,12 @@ var CreateContacts1715761125000 = class {
|
|
|
8796
8843
|
}
|
|
8797
8844
|
}
|
|
8798
8845
|
async down(queryRunner) {
|
|
8799
|
-
debug16("migration: reverting
|
|
8846
|
+
debug16("migration: reverting audit events tables");
|
|
8800
8847
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8801
8848
|
switch (dbType) {
|
|
8802
8849
|
case "postgres": {
|
|
8803
8850
|
debug16("using postgres migration file");
|
|
8804
|
-
const mig = new
|
|
8851
|
+
const mig = new CreateAuditEvents1701634812183();
|
|
8805
8852
|
await mig.down(queryRunner);
|
|
8806
8853
|
debug16("Migration statements executed");
|
|
8807
8854
|
return;
|
|
@@ -8810,7 +8857,7 @@ var CreateContacts1715761125000 = class {
|
|
|
8810
8857
|
case "expo":
|
|
8811
8858
|
case "react-native": {
|
|
8812
8859
|
debug16("using sqlite/react-native migration file");
|
|
8813
|
-
const mig = new
|
|
8860
|
+
const mig = new CreateAuditEvents1701634819487();
|
|
8814
8861
|
await mig.down(queryRunner);
|
|
8815
8862
|
debug16("Migration statements executed");
|
|
8816
8863
|
return;
|
|
@@ -8821,85 +8868,258 @@ var CreateContacts1715761125000 = class {
|
|
|
8821
8868
|
}
|
|
8822
8869
|
};
|
|
8823
8870
|
|
|
8824
|
-
// src/migrations/generic/
|
|
8871
|
+
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8825
8872
|
var import_debug17 = __toESM(require("debug"), 1);
|
|
8826
8873
|
|
|
8827
|
-
// src/migrations/postgres/
|
|
8828
|
-
var
|
|
8874
|
+
// src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
|
|
8875
|
+
var CreateDigitalCredential1708525189001 = class {
|
|
8829
8876
|
static {
|
|
8830
|
-
__name(this, "
|
|
8877
|
+
__name(this, "CreateDigitalCredential1708525189001");
|
|
8831
8878
|
}
|
|
8832
|
-
name = "
|
|
8879
|
+
name = "CreateDigitalCredential1708525189001";
|
|
8833
8880
|
async up(queryRunner) {
|
|
8881
|
+
await queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`);
|
|
8882
|
+
await queryRunner.query(`CREATE TYPE "digital_regulation_type" AS ENUM('PID', 'QEAA', 'EAA', 'NON_REGULATED')`);
|
|
8883
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`);
|
|
8884
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR')`);
|
|
8885
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID', 'KID', 'URL', 'X509_SAN')`);
|
|
8886
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`);
|
|
8834
8887
|
await queryRunner.query(`
|
|
8835
|
-
CREATE TABLE "
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8888
|
+
CREATE TABLE "DigitalCredential" (
|
|
8889
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
8890
|
+
"parent_id" text,
|
|
8891
|
+
"document_type" "digital_document_type" NOT NULL,
|
|
8892
|
+
"regulation_type" "digital_regulation_type" NOT NULL DEFAULT 'NON_REGULATED'::"digital_regulation_type",
|
|
8893
|
+
"document_format" "digital_credential_document_format" NOT NULL,
|
|
8894
|
+
"credential_role" "digital_credential_credential_role" NOT NULL,
|
|
8895
|
+
"raw_document" text NOT NULL,
|
|
8896
|
+
"uniform_document" text NOT NULL,
|
|
8897
|
+
"credential_id" text,
|
|
8898
|
+
"hash" text NOT NULL,
|
|
8899
|
+
"kms_key_ref" text,
|
|
8900
|
+
"identifier_method" text,
|
|
8901
|
+
"issuer_correlation_type" "digital_credential_correlation_type" NOT NULL,
|
|
8902
|
+
"subject_correlation_type" "digital_credential_correlation_type",
|
|
8903
|
+
"issuer_correlation_id" text NOT NULL,
|
|
8904
|
+
"subject_correlation_id" text,
|
|
8905
|
+
"verified_state" "digital_credential_state_type",
|
|
8906
|
+
"issuer_signed" boolean,
|
|
8907
|
+
"rp_correlation_id" text,
|
|
8908
|
+
"rp_correlation_type" "digital_credential_correlation_type",
|
|
8909
|
+
"tenant_id" text,
|
|
8910
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8911
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8912
|
+
"presented_at" DATE,
|
|
8913
|
+
"valid_from" DATE,
|
|
8914
|
+
"valid_until" DATE,
|
|
8915
|
+
"verified_at" DATE,
|
|
8916
|
+
"revoked_at" DATE,
|
|
8917
|
+
PRIMARY KEY ("id"),
|
|
8918
|
+
UNIQUE ("hash", "credential_role")
|
|
8919
|
+
)
|
|
8920
|
+
`);
|
|
8848
8921
|
}
|
|
8849
8922
|
async down(queryRunner) {
|
|
8850
|
-
await queryRunner.query(`DROP TABLE "
|
|
8923
|
+
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8924
|
+
await queryRunner.query(`DROP TYPE "digital_credential_state_type"`);
|
|
8925
|
+
await queryRunner.query(`DROP TYPE "digital_credential_correlation_type"`);
|
|
8926
|
+
await queryRunner.query(`DROP TYPE "digital_credential_document_format"`);
|
|
8927
|
+
await queryRunner.query(`DROP TYPE "digital_credential_credential_role"`);
|
|
8928
|
+
await queryRunner.query(`DROP TYPE "digital_regulation_type"`);
|
|
8929
|
+
await queryRunner.query(`DROP TYPE "digital_document_type"`);
|
|
8851
8930
|
}
|
|
8852
8931
|
};
|
|
8853
8932
|
|
|
8854
|
-
// src/migrations/sqlite/
|
|
8855
|
-
var
|
|
8933
|
+
// src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts
|
|
8934
|
+
var CreateDigitalCredential1708525189002 = class {
|
|
8856
8935
|
static {
|
|
8857
|
-
__name(this, "
|
|
8936
|
+
__name(this, "CreateDigitalCredential1708525189002");
|
|
8858
8937
|
}
|
|
8859
|
-
name = "
|
|
8938
|
+
name = "CreateDigitalCredential1708525189002";
|
|
8860
8939
|
async up(queryRunner) {
|
|
8861
|
-
await queryRunner.query(`
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8940
|
+
await queryRunner.query(`
|
|
8941
|
+
CREATE TABLE "DigitalCredential" (
|
|
8942
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8943
|
+
"parent_id" text,
|
|
8944
|
+
"document_type" varchar CHECK( "document_type" IN ('VC', 'VP', 'C', 'P') ) NOT NULL,
|
|
8945
|
+
"regulation_type" varchar CHECK( "regulation_type" IN ('PID', 'QEAA', 'EAA', 'NON_REGULATED') ) NOT NULL DEFAULT 'NON_REGULATED',
|
|
8946
|
+
"document_format" varchar CHECK( "document_format" IN ('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC') ) NOT NULL,
|
|
8947
|
+
"credential_role" varchar CHECK( "credential_role" IN ('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR') ) NOT NULL,
|
|
8948
|
+
"raw_document" text NOT NULL,
|
|
8949
|
+
"uniform_document" text NOT NULL,
|
|
8950
|
+
"credential_id" text,
|
|
8951
|
+
"hash" text NOT NULL,
|
|
8952
|
+
"kms_key_ref" text,
|
|
8953
|
+
"identifier_method" text,
|
|
8954
|
+
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ) NOT NULL,
|
|
8955
|
+
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8956
|
+
"issuer_correlation_id" text NOT NULL,
|
|
8957
|
+
"subject_correlation_id" text,
|
|
8958
|
+
"issuer_signed" boolean,
|
|
8959
|
+
"rp_correlation_id" text,
|
|
8960
|
+
"rp_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8961
|
+
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
8962
|
+
"tenant_id" text,
|
|
8963
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8964
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8965
|
+
"presented_at" datetime,
|
|
8966
|
+
"valid_from" datetime,
|
|
8967
|
+
"valid_until" datetime,
|
|
8968
|
+
"verified_at" datetime,
|
|
8969
|
+
"revoked_at" datetime,
|
|
8970
|
+
UNIQUE ("hash", "credential_role")
|
|
8971
|
+
)
|
|
8972
|
+
`);
|
|
8973
|
+
}
|
|
8974
|
+
async down(queryRunner) {
|
|
8975
|
+
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8976
|
+
}
|
|
8977
|
+
};
|
|
8978
|
+
|
|
8979
|
+
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8980
|
+
var debug17 = (0, import_debug17.default)("sphereon:ssi-sdk:migrations");
|
|
8981
|
+
var CreateDigitalCredential1708525189000 = class {
|
|
8982
|
+
static {
|
|
8983
|
+
__name(this, "CreateDigitalCredential1708525189000");
|
|
8984
|
+
}
|
|
8985
|
+
name = "CreateDigitalCredential1708525189000";
|
|
8986
|
+
async up(queryRunner) {
|
|
8987
|
+
debug17("migration: creating DigitalCredential tables");
|
|
8988
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
8989
|
+
switch (dbType) {
|
|
8990
|
+
case "postgres": {
|
|
8991
|
+
debug17("using postgres migration file for DigitalCredential");
|
|
8992
|
+
const mig = new CreateDigitalCredential1708525189001();
|
|
8993
|
+
await mig.up(queryRunner);
|
|
8994
|
+
debug17("Postgres Migration statements for DigitalCredential executed");
|
|
8995
|
+
return;
|
|
8996
|
+
}
|
|
8997
|
+
case "sqlite":
|
|
8998
|
+
case "expo":
|
|
8999
|
+
case "react-native": {
|
|
9000
|
+
debug17("using sqlite/react-native migration file for DigitalCredential");
|
|
9001
|
+
const mig = new CreateDigitalCredential1708525189002();
|
|
9002
|
+
await mig.up(queryRunner);
|
|
9003
|
+
debug17("SQLite Migration statements for DigitalCredential executed");
|
|
9004
|
+
return;
|
|
9005
|
+
}
|
|
9006
|
+
default:
|
|
9007
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for UniformCredential. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
9008
|
+
}
|
|
9009
|
+
}
|
|
9010
|
+
async down(queryRunner) {
|
|
9011
|
+
debug17("migration: reverting DigitalCredential tables");
|
|
9012
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
9013
|
+
switch (dbType) {
|
|
9014
|
+
case "postgres": {
|
|
9015
|
+
debug17("using postgres migration file for DigitalCredential");
|
|
9016
|
+
const mig = new CreateDigitalCredential1708525189001();
|
|
9017
|
+
await mig.down(queryRunner);
|
|
9018
|
+
debug17("Postgres Migration statements for DigitalCredential reverted");
|
|
9019
|
+
return;
|
|
9020
|
+
}
|
|
9021
|
+
case "sqlite":
|
|
9022
|
+
case "expo":
|
|
9023
|
+
case "react-native": {
|
|
9024
|
+
debug17("using sqlite/react-native migration file for DigitalCredential");
|
|
9025
|
+
const mig = new CreateDigitalCredential1708525189002();
|
|
9026
|
+
await mig.down(queryRunner);
|
|
9027
|
+
debug17("SQLite Migration statements for DigitalCredential reverted");
|
|
9028
|
+
return;
|
|
9029
|
+
}
|
|
9030
|
+
default:
|
|
9031
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for DigitalCredential. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
9032
|
+
}
|
|
9033
|
+
}
|
|
9034
|
+
};
|
|
9035
|
+
|
|
9036
|
+
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
9037
|
+
var import_debug18 = __toESM(require("debug"), 1);
|
|
9038
|
+
|
|
9039
|
+
// src/migrations/postgres/1708797018115-CreateMachineStateStore.ts
|
|
9040
|
+
var CreateMachineStateStore1708797018115 = class {
|
|
9041
|
+
static {
|
|
9042
|
+
__name(this, "CreateMachineStateStore1708797018115");
|
|
9043
|
+
}
|
|
9044
|
+
name = "CreateMachineStateStore1708797018115";
|
|
9045
|
+
async up(queryRunner) {
|
|
9046
|
+
await queryRunner.query(`
|
|
9047
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
9048
|
+
"instance_id" text NOT NULL,
|
|
9049
|
+
"session_id" text,
|
|
9050
|
+
"latest_state_name" text,
|
|
9051
|
+
"machine_name" text NOT NULL,
|
|
9052
|
+
"latest_event_type" text NOT NULL,
|
|
9053
|
+
"state" text NOT NULL,
|
|
9054
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
9055
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
9056
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
9057
|
+
"expires_at" TIMESTAMP,
|
|
9058
|
+
"completed_at" TIMESTAMP,
|
|
9059
|
+
"tenant_id" text,
|
|
9060
|
+
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
9061
|
+
)
|
|
9062
|
+
`);
|
|
9063
|
+
}
|
|
9064
|
+
async down(queryRunner) {
|
|
9065
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`);
|
|
9066
|
+
}
|
|
9067
|
+
};
|
|
9068
|
+
|
|
9069
|
+
// src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts
|
|
9070
|
+
var CreateMachineStateStore1708796002272 = class {
|
|
9071
|
+
static {
|
|
9072
|
+
__name(this, "CreateMachineStateStore1708796002272");
|
|
9073
|
+
}
|
|
9074
|
+
name = "CreateMachineStateStore1708796002272";
|
|
9075
|
+
async up(queryRunner) {
|
|
9076
|
+
await queryRunner.query(`
|
|
9077
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
9078
|
+
"instance_id" varchar PRIMARY KEY NOT NULL,
|
|
9079
|
+
"session_id" varchar,
|
|
9080
|
+
"machine_name" varchar NOT NULL,
|
|
9081
|
+
"latest_state_name" varchar,
|
|
9082
|
+
"latest_event_type" varchar NOT NULL,
|
|
9083
|
+
"state" text NOT NULL,
|
|
9084
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
9085
|
+
"updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
9086
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
9087
|
+
"expires_at" datetime,
|
|
9088
|
+
"completed_at" datetime,
|
|
9089
|
+
"tenant_id" varchar
|
|
9090
|
+
)
|
|
9091
|
+
`);
|
|
8872
9092
|
}
|
|
8873
9093
|
async down(queryRunner) {
|
|
8874
|
-
await queryRunner.query(`DROP TABLE "
|
|
9094
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`);
|
|
8875
9095
|
}
|
|
8876
9096
|
};
|
|
8877
9097
|
|
|
8878
|
-
// src/migrations/generic/
|
|
8879
|
-
var
|
|
8880
|
-
var
|
|
9098
|
+
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
9099
|
+
var debug18 = (0, import_debug18.default)("sphereon:ssi-sdk:migrations");
|
|
9100
|
+
var CreateMachineStateStore1708098041262 = class {
|
|
8881
9101
|
static {
|
|
8882
|
-
__name(this, "
|
|
9102
|
+
__name(this, "CreateMachineStateStore1708098041262");
|
|
8883
9103
|
}
|
|
8884
|
-
name = "
|
|
9104
|
+
name = "CreateMachineStateStore1708098041262";
|
|
8885
9105
|
async up(queryRunner) {
|
|
8886
|
-
|
|
9106
|
+
debug18("migration: creating machine state tables");
|
|
8887
9107
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8888
9108
|
switch (dbType) {
|
|
8889
9109
|
case "postgres": {
|
|
8890
|
-
|
|
8891
|
-
const mig = new
|
|
9110
|
+
debug18("using postgres migration file");
|
|
9111
|
+
const mig = new CreateMachineStateStore1708797018115();
|
|
8892
9112
|
await mig.up(queryRunner);
|
|
8893
|
-
|
|
9113
|
+
debug18("Migration statements executed");
|
|
8894
9114
|
return;
|
|
8895
9115
|
}
|
|
8896
9116
|
case "sqlite":
|
|
8897
9117
|
case "expo":
|
|
8898
9118
|
case "react-native": {
|
|
8899
|
-
|
|
8900
|
-
const mig = new
|
|
9119
|
+
debug18("using sqlite/react-native migration file");
|
|
9120
|
+
const mig = new CreateMachineStateStore1708796002272();
|
|
8901
9121
|
await mig.up(queryRunner);
|
|
8902
|
-
|
|
9122
|
+
debug18("Migration statements executed");
|
|
8903
9123
|
return;
|
|
8904
9124
|
}
|
|
8905
9125
|
default:
|
|
@@ -8907,23 +9127,23 @@ var CreatePresentationDefinitions1716533767523 = class {
|
|
|
8907
9127
|
}
|
|
8908
9128
|
}
|
|
8909
9129
|
async down(queryRunner) {
|
|
8910
|
-
|
|
9130
|
+
debug18("migration: reverting machine state tables");
|
|
8911
9131
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8912
9132
|
switch (dbType) {
|
|
8913
9133
|
case "postgres": {
|
|
8914
|
-
|
|
8915
|
-
const mig = new
|
|
9134
|
+
debug18("using postgres migration file");
|
|
9135
|
+
const mig = new CreateMachineStateStore1708797018115();
|
|
8916
9136
|
await mig.down(queryRunner);
|
|
8917
|
-
|
|
9137
|
+
debug18("Migration statements executed");
|
|
8918
9138
|
return;
|
|
8919
9139
|
}
|
|
8920
9140
|
case "sqlite":
|
|
8921
9141
|
case "expo":
|
|
8922
9142
|
case "react-native": {
|
|
8923
|
-
|
|
8924
|
-
const mig = new
|
|
9143
|
+
debug18("using sqlite/react-native migration file");
|
|
9144
|
+
const mig = new CreateMachineStateStore1708796002272();
|
|
8925
9145
|
await mig.down(queryRunner);
|
|
8926
|
-
|
|
9146
|
+
debug18("Migration statements executed");
|
|
8927
9147
|
return;
|
|
8928
9148
|
}
|
|
8929
9149
|
default:
|
|
@@ -8932,108 +9152,145 @@ var CreatePresentationDefinitions1716533767523 = class {
|
|
|
8932
9152
|
}
|
|
8933
9153
|
};
|
|
8934
9154
|
|
|
8935
|
-
// src/migrations/generic/
|
|
8936
|
-
var
|
|
9155
|
+
// src/migrations/generic/8-CreateContacts.ts
|
|
9156
|
+
var import_debug19 = __toESM(require("debug"), 1);
|
|
8937
9157
|
|
|
8938
|
-
// src/migrations/postgres/
|
|
8939
|
-
var
|
|
9158
|
+
// src/migrations/postgres/1710438363001-CreateContacts.ts
|
|
9159
|
+
var CreateContacts1710438363001 = class {
|
|
8940
9160
|
static {
|
|
8941
|
-
__name(this, "
|
|
9161
|
+
__name(this, "CreateContacts1710438363001");
|
|
8942
9162
|
}
|
|
8943
|
-
name = "
|
|
9163
|
+
name = "CreateContacts1710438363001";
|
|
8944
9164
|
async up(queryRunner) {
|
|
8945
|
-
await queryRunner.query(`
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
`);
|
|
9165
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" uuid`);
|
|
9166
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" uuid`);
|
|
9167
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "owner_id" uuid`);
|
|
9168
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "tenant_id" uuid`);
|
|
9169
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`);
|
|
9170
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`);
|
|
9171
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`);
|
|
9172
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`);
|
|
9173
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`);
|
|
9174
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`);
|
|
9175
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`);
|
|
9176
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`);
|
|
9177
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`);
|
|
9178
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`);
|
|
9179
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`);
|
|
9180
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`);
|
|
9181
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`);
|
|
9182
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`);
|
|
8949
9183
|
}
|
|
8950
9184
|
async down(queryRunner) {
|
|
8951
|
-
await queryRunner.query(`
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
`);
|
|
9185
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
9186
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
9187
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
9188
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
9189
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
9190
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
9191
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
9192
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
9193
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
9194
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
9195
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
9196
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
9197
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
9198
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
9199
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
9200
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
9201
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
9202
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
8955
9203
|
}
|
|
8956
9204
|
};
|
|
8957
9205
|
|
|
8958
|
-
// src/migrations/sqlite/
|
|
8959
|
-
var
|
|
9206
|
+
// src/migrations/sqlite/1710438363002-CreateContacts.ts
|
|
9207
|
+
var CreateContacts1710438363002 = class {
|
|
8960
9208
|
static {
|
|
8961
|
-
__name(this, "
|
|
9209
|
+
__name(this, "CreateContacts1710438363002");
|
|
8962
9210
|
}
|
|
8963
|
-
name = "
|
|
9211
|
+
name = "CreateContacts1710438363002";
|
|
8964
9212
|
async up(queryRunner) {
|
|
8965
|
-
await queryRunner.query(`
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
await queryRunner.query(`
|
|
8981
|
-
|
|
8982
|
-
await queryRunner.query(`
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
9213
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" text`);
|
|
9214
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" text`);
|
|
9215
|
+
await queryRunner.query(`CREATE TABLE "temporary_Identity" (
|
|
9216
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9217
|
+
"alias" varchar(255) NOT NULL,
|
|
9218
|
+
"roles" text NOT NULL,
|
|
9219
|
+
"origin" text NOT NULL,
|
|
9220
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
9221
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
9222
|
+
"partyId" varchar,
|
|
9223
|
+
"owner_id" text,
|
|
9224
|
+
"tenant_id" text,
|
|
9225
|
+
CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"),
|
|
9226
|
+
CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
|
9227
|
+
)`);
|
|
9228
|
+
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId", "owner_id", "tenant_id", "origin")
|
|
9229
|
+
SELECT "id", "alias", "roles", 'EXTERNAL' as "origin", "created_at", "last_updated_at", "partyId", NULL as "owner_id", NULL as "tenant_id" FROM "Identity"`);
|
|
9230
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
9231
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
9232
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" text`);
|
|
9233
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" text`);
|
|
9234
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" text`);
|
|
9235
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" text`);
|
|
9236
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" text`);
|
|
9237
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" text`);
|
|
9238
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" text`);
|
|
9239
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" text`);
|
|
9240
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" text`);
|
|
9241
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" text`);
|
|
9242
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" text`);
|
|
9243
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" text`);
|
|
9244
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" text`);
|
|
9245
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" text`);
|
|
8986
9246
|
}
|
|
8987
9247
|
async down(queryRunner) {
|
|
8988
|
-
await queryRunner.query(`
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
await queryRunner.query(`
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
await queryRunner.query(`
|
|
9004
|
-
await queryRunner.query(`ALTER TABLE "
|
|
9005
|
-
await queryRunner.query(`
|
|
9006
|
-
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
9007
|
-
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
9008
|
-
`);
|
|
9248
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
9249
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
9250
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
9251
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
9252
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
9253
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
9254
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
9255
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
9256
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
9257
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
9258
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
9259
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
9260
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
9261
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
9262
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
9263
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
9264
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
9265
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
9009
9266
|
}
|
|
9010
9267
|
};
|
|
9011
9268
|
|
|
9012
|
-
// src/migrations/generic/
|
|
9013
|
-
var
|
|
9014
|
-
var
|
|
9269
|
+
// src/migrations/generic/8-CreateContacts.ts
|
|
9270
|
+
var debug19 = (0, import_debug19.default)("sphereon:ssi-sdk:migrations");
|
|
9271
|
+
var CreateContacts1708525189000 = class {
|
|
9015
9272
|
static {
|
|
9016
|
-
__name(this, "
|
|
9273
|
+
__name(this, "CreateContacts1708525189000");
|
|
9017
9274
|
}
|
|
9018
|
-
name = "
|
|
9275
|
+
name = "CreateContacts1708525189000";
|
|
9019
9276
|
async up(queryRunner) {
|
|
9020
|
-
|
|
9277
|
+
debug19("migration: updating contact tables");
|
|
9021
9278
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9022
9279
|
switch (dbType) {
|
|
9023
9280
|
case "postgres": {
|
|
9024
|
-
|
|
9025
|
-
const mig = new
|
|
9281
|
+
debug19("using postgres migration file");
|
|
9282
|
+
const mig = new CreateContacts1710438363001();
|
|
9026
9283
|
await mig.up(queryRunner);
|
|
9027
|
-
|
|
9284
|
+
debug19("Migration statements executed");
|
|
9028
9285
|
return;
|
|
9029
9286
|
}
|
|
9030
9287
|
case "sqlite":
|
|
9031
9288
|
case "expo":
|
|
9032
9289
|
case "react-native": {
|
|
9033
|
-
|
|
9034
|
-
const mig = new
|
|
9290
|
+
debug19("using sqlite/react-native migration file");
|
|
9291
|
+
const mig = new CreateContacts1710438363002();
|
|
9035
9292
|
await mig.up(queryRunner);
|
|
9036
|
-
|
|
9293
|
+
debug19("Migration statements executed");
|
|
9037
9294
|
return;
|
|
9038
9295
|
}
|
|
9039
9296
|
default:
|
|
@@ -9041,23 +9298,23 @@ var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
|
9041
9298
|
}
|
|
9042
9299
|
}
|
|
9043
9300
|
async down(queryRunner) {
|
|
9044
|
-
|
|
9301
|
+
debug19("migration: reverting machine state tables");
|
|
9045
9302
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9046
9303
|
switch (dbType) {
|
|
9047
9304
|
case "postgres": {
|
|
9048
|
-
|
|
9049
|
-
const mig = new
|
|
9305
|
+
debug19("using postgres migration file");
|
|
9306
|
+
const mig = new CreateContacts1710438363001();
|
|
9050
9307
|
await mig.down(queryRunner);
|
|
9051
|
-
|
|
9308
|
+
debug19("Migration statements executed");
|
|
9052
9309
|
return;
|
|
9053
9310
|
}
|
|
9054
9311
|
case "sqlite":
|
|
9055
9312
|
case "expo":
|
|
9056
9313
|
case "react-native": {
|
|
9057
|
-
|
|
9058
|
-
const mig = new
|
|
9314
|
+
debug19("using sqlite/react-native migration file");
|
|
9315
|
+
const mig = new CreateContacts1710438363002();
|
|
9059
9316
|
await mig.down(queryRunner);
|
|
9060
|
-
|
|
9317
|
+
debug19("Migration statements executed");
|
|
9061
9318
|
return;
|
|
9062
9319
|
}
|
|
9063
9320
|
default:
|
|
@@ -9066,223 +9323,171 @@ var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
|
9066
9323
|
}
|
|
9067
9324
|
};
|
|
9068
9325
|
|
|
9069
|
-
// src/migrations/generic/
|
|
9070
|
-
var
|
|
9071
|
-
|
|
9072
|
-
// src/migrations/postgres/
|
|
9073
|
-
var
|
|
9074
|
-
static {
|
|
9075
|
-
__name(this, "
|
|
9076
|
-
}
|
|
9077
|
-
name = "
|
|
9078
|
-
async up(queryRunner) {
|
|
9079
|
-
await queryRunner.
|
|
9080
|
-
await queryRunner.query(`
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9326
|
+
// src/migrations/generic/9-CreateContacts.ts
|
|
9327
|
+
var import_debug20 = __toESM(require("debug"), 1);
|
|
9328
|
+
|
|
9329
|
+
// src/migrations/postgres/1715761125001-CreateContacts.ts
|
|
9330
|
+
var CreateContacts1715761125001 = class {
|
|
9331
|
+
static {
|
|
9332
|
+
__name(this, "CreateContacts1715761125001");
|
|
9333
|
+
}
|
|
9334
|
+
name = "CreateContacts1715761125001";
|
|
9335
|
+
async up(queryRunner) {
|
|
9336
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
9337
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
9338
|
+
(
|
|
9339
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
9340
|
+
"label" character varying(255) NOT NULL,
|
|
9341
|
+
"valueType" character varying NOT NULL,
|
|
9342
|
+
"stringValue" text,
|
|
9343
|
+
"numberValue" double precision,
|
|
9344
|
+
"dateValue" TIMESTAMP,
|
|
9345
|
+
"boolValue" boolean,
|
|
9346
|
+
"identityId" uuid,
|
|
9347
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
9348
|
+
)`);
|
|
9349
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
9350
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
9351
|
+
FROM "temporary_IdentityMetadata"`);
|
|
9352
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
9353
|
+
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
9354
|
+
(
|
|
9355
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
9356
|
+
"label" character varying(255) NOT NULL,
|
|
9357
|
+
"valueType" character varying NOT NULL,
|
|
9358
|
+
"stringValue" text,
|
|
9359
|
+
"numberValue" double precision,
|
|
9360
|
+
"dateValue" TIMESTAMP,
|
|
9361
|
+
"boolValue" boolean,
|
|
9362
|
+
"contactId" uuid,
|
|
9363
|
+
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
9364
|
+
)`);
|
|
9092
9365
|
}
|
|
9093
9366
|
async down(queryRunner) {
|
|
9094
|
-
await queryRunner.query(`
|
|
9095
|
-
await queryRunner.query(`ALTER TABLE "
|
|
9096
|
-
await queryRunner.query(`
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
await queryRunner.query(`
|
|
9105
|
-
|
|
9367
|
+
await queryRunner.query(`DROP TABLE "ContactMetadata"`);
|
|
9368
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
9369
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
9370
|
+
(
|
|
9371
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
9372
|
+
"label" character varying(255) NOT NULL,
|
|
9373
|
+
"value" character varying(255) NOT NULL,
|
|
9374
|
+
"identityId" uuid,
|
|
9375
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
9376
|
+
)`);
|
|
9377
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
9378
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
9379
|
+
FROM "temporary_IdentityMetadata"`);
|
|
9380
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
9106
9381
|
}
|
|
9107
9382
|
};
|
|
9108
9383
|
|
|
9109
|
-
// src/migrations/sqlite/
|
|
9110
|
-
var
|
|
9384
|
+
// src/migrations/sqlite/1715761125002-CreateContacts.ts
|
|
9385
|
+
var CreateContacts1715761125002 = class {
|
|
9111
9386
|
static {
|
|
9112
|
-
__name(this, "
|
|
9387
|
+
__name(this, "CreateContacts1715761125002");
|
|
9113
9388
|
}
|
|
9114
|
-
name = "
|
|
9389
|
+
name = "CreateContacts1715761125002";
|
|
9115
9390
|
async up(queryRunner) {
|
|
9116
|
-
await queryRunner.query(`
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
9145
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
9146
|
-
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
9147
|
-
FROM "StatusList"
|
|
9148
|
-
`);
|
|
9149
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
9150
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
9151
|
-
await queryRunner.query(`
|
|
9152
|
-
CREATE TABLE "temporary_StatusListEntry" (
|
|
9153
|
-
"statusListId" varchar NOT NULL,
|
|
9154
|
-
"statusListIndex" integer NOT NULL,
|
|
9155
|
-
"credentialId" text,
|
|
9156
|
-
"credentialHash" varchar(128),
|
|
9157
|
-
"correlationId" varchar(255),
|
|
9158
|
-
"value" varchar(50),
|
|
9159
|
-
"type" varchar CHECK( "type" IN ('StatusListEntryEntity', 'bitstring') ) NOT NULL DEFAULT ('StatusListEntryEntity'),
|
|
9160
|
-
"statusPurpose" varchar,
|
|
9161
|
-
"bitsPerStatus" integer DEFAULT (1),
|
|
9162
|
-
"statusMessage" text,
|
|
9163
|
-
"statusReference" text,
|
|
9164
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
9165
|
-
)
|
|
9166
|
-
`);
|
|
9167
|
-
await queryRunner.query(`
|
|
9168
|
-
INSERT INTO "temporary_StatusListEntry"(
|
|
9169
|
-
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9170
|
-
"correlationId", "value", "type"
|
|
9171
|
-
)
|
|
9172
|
-
SELECT
|
|
9173
|
-
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9174
|
-
"correlationId", "value", 'StatusListEntryEntity'
|
|
9175
|
-
FROM "StatusListEntry"
|
|
9176
|
-
`);
|
|
9177
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
9178
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
9391
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
9392
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
9393
|
+
(
|
|
9394
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9395
|
+
"label" varchar(255) NOT NULL,
|
|
9396
|
+
"valueType" varchar NOT NULL,
|
|
9397
|
+
"stringValue" varchar(255),
|
|
9398
|
+
"numberValue" double,
|
|
9399
|
+
"dateValue" datetime,
|
|
9400
|
+
"boolValue" boolean,
|
|
9401
|
+
"identityId" varchar,
|
|
9402
|
+
FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE)`);
|
|
9403
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
9404
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
9405
|
+
FROM "temporary_IdentityMetadata"
|
|
9406
|
+
`);
|
|
9407
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
9408
|
+
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
9409
|
+
(
|
|
9410
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9411
|
+
"label" varchar(255) NOT NULL,
|
|
9412
|
+
"valueType" varchar NOT NULL,
|
|
9413
|
+
"stringValue" text,
|
|
9414
|
+
"numberValue" double,
|
|
9415
|
+
"dateValue" datetime,
|
|
9416
|
+
"boolValue" boolean,
|
|
9417
|
+
"contactId" varchar,
|
|
9418
|
+
FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE)`);
|
|
9179
9419
|
}
|
|
9180
9420
|
async down(queryRunner) {
|
|
9181
|
-
await queryRunner.query(`
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
`)
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
"correlationId", "value"
|
|
9196
|
-
)
|
|
9197
|
-
SELECT
|
|
9198
|
-
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9199
|
-
"correlationId", "value"
|
|
9200
|
-
FROM "StatusListEntry"
|
|
9201
|
-
WHERE "type" = 'StatusListEntryEntity'
|
|
9202
|
-
`);
|
|
9203
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
9204
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
9205
|
-
await queryRunner.query(`
|
|
9206
|
-
CREATE TABLE "temporary_StatusList" (
|
|
9207
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
9208
|
-
"correlationId" varchar NOT NULL,
|
|
9209
|
-
"length" integer NOT NULL,
|
|
9210
|
-
"issuer" text NOT NULL,
|
|
9211
|
-
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
9212
|
-
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
9213
|
-
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
9214
|
-
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
9215
|
-
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
9216
|
-
"statusPurpose" varchar,
|
|
9217
|
-
"statusListCredential" text,
|
|
9218
|
-
"bitsPerStatus" integer,
|
|
9219
|
-
"expiresAt" datetime,
|
|
9220
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
9221
|
-
)
|
|
9222
|
-
`);
|
|
9223
|
-
await queryRunner.query(`
|
|
9224
|
-
INSERT INTO "temporary_StatusList"(
|
|
9225
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
9226
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
9227
|
-
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
9228
|
-
)
|
|
9229
|
-
SELECT
|
|
9230
|
-
"id", "correlationId", "length", "issuer",
|
|
9231
|
-
CASE WHEN "type" = 'BitstringStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
9232
|
-
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
9233
|
-
"statusPurpose", "statusListCredential", "bitsPerStatus", "expiresAt"
|
|
9234
|
-
FROM "StatusList"
|
|
9235
|
-
`);
|
|
9236
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
9237
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
9421
|
+
await queryRunner.query(`DROP TABLE "ContactMetadata"`);
|
|
9422
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
9423
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
9424
|
+
(
|
|
9425
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9426
|
+
"label" varchar(255) NOT NULL,
|
|
9427
|
+
"value" varchar(255) NOT NULL,
|
|
9428
|
+
"identityId" varchar,
|
|
9429
|
+
FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
9430
|
+
)`);
|
|
9431
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
9432
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
9433
|
+
FROM "temporary_IdentityMetadata"`);
|
|
9434
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
9238
9435
|
}
|
|
9239
9436
|
};
|
|
9240
9437
|
|
|
9241
|
-
// src/migrations/generic/
|
|
9242
|
-
var
|
|
9243
|
-
var
|
|
9438
|
+
// src/migrations/generic/9-CreateContacts.ts
|
|
9439
|
+
var debug20 = (0, import_debug20.default)("sphereon:ssi-sdk:migrations");
|
|
9440
|
+
var CreateContacts1715761125000 = class {
|
|
9244
9441
|
static {
|
|
9245
|
-
__name(this, "
|
|
9442
|
+
__name(this, "CreateContacts1715761125000");
|
|
9246
9443
|
}
|
|
9247
|
-
name = "
|
|
9444
|
+
name = "CreateContacts1715761125000";
|
|
9248
9445
|
async up(queryRunner) {
|
|
9249
|
-
|
|
9446
|
+
debug20("migration: updating contact tables");
|
|
9250
9447
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9251
9448
|
switch (dbType) {
|
|
9252
9449
|
case "postgres": {
|
|
9253
|
-
|
|
9450
|
+
debug20("using postgres migration file");
|
|
9451
|
+
const mig = new CreateContacts1715761125001();
|
|
9254
9452
|
await mig.up(queryRunner);
|
|
9453
|
+
debug20("Migration statements executed");
|
|
9255
9454
|
return;
|
|
9256
9455
|
}
|
|
9257
9456
|
case "sqlite":
|
|
9258
9457
|
case "expo":
|
|
9259
9458
|
case "react-native": {
|
|
9260
|
-
|
|
9459
|
+
debug20("using sqlite/react-native migration file");
|
|
9460
|
+
const mig = new CreateContacts1715761125002();
|
|
9261
9461
|
await mig.up(queryRunner);
|
|
9462
|
+
debug20("Migration statements executed");
|
|
9262
9463
|
return;
|
|
9263
9464
|
}
|
|
9264
9465
|
default:
|
|
9265
|
-
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
9466
|
+
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`);
|
|
9266
9467
|
}
|
|
9267
9468
|
}
|
|
9268
9469
|
async down(queryRunner) {
|
|
9269
|
-
|
|
9470
|
+
debug20("migration: reverting machine state tables");
|
|
9270
9471
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9271
9472
|
switch (dbType) {
|
|
9272
9473
|
case "postgres": {
|
|
9273
|
-
|
|
9474
|
+
debug20("using postgres migration file");
|
|
9475
|
+
const mig = new CreateContacts1715761125001();
|
|
9274
9476
|
await mig.down(queryRunner);
|
|
9477
|
+
debug20("Migration statements executed");
|
|
9275
9478
|
return;
|
|
9276
9479
|
}
|
|
9277
9480
|
case "sqlite":
|
|
9278
9481
|
case "expo":
|
|
9279
9482
|
case "react-native": {
|
|
9280
|
-
|
|
9483
|
+
debug20("using sqlite/react-native migration file");
|
|
9484
|
+
const mig = new CreateContacts1715761125002();
|
|
9281
9485
|
await mig.down(queryRunner);
|
|
9486
|
+
debug20("Migration statements executed");
|
|
9282
9487
|
return;
|
|
9283
9488
|
}
|
|
9284
9489
|
default:
|
|
9285
|
-
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
9490
|
+
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`);
|
|
9286
9491
|
}
|
|
9287
9492
|
}
|
|
9288
9493
|
};
|
|
@@ -9300,6 +9505,7 @@ var DataStoreIssuanceBrandingMigrations = [
|
|
|
9300
9505
|
];
|
|
9301
9506
|
var DataStoreStatusListMigrations = [
|
|
9302
9507
|
CreateStatusList1693866470000,
|
|
9508
|
+
AddBitstringStatusListEnum1741895823000,
|
|
9303
9509
|
CreateBitstringStatusList1741895823000
|
|
9304
9510
|
];
|
|
9305
9511
|
var DataStoreEventLoggerMigrations = [
|
|
@@ -9312,7 +9518,8 @@ var DataStoreMachineStateMigrations = [
|
|
|
9312
9518
|
CreateMachineStateStore1708098041262
|
|
9313
9519
|
];
|
|
9314
9520
|
var DataStorePresentationDefinitionMigrations = [
|
|
9315
|
-
CreatePresentationDefinitions1716533767523
|
|
9521
|
+
CreatePresentationDefinitions1716533767523,
|
|
9522
|
+
UpdatePresentationDefinitionItemNullable1741895824000
|
|
9316
9523
|
];
|
|
9317
9524
|
var DataStoreMigrations = [
|
|
9318
9525
|
...DataStoreContactMigrations,
|
|
@@ -9325,7 +9532,7 @@ var DataStoreMigrations = [
|
|
|
9325
9532
|
];
|
|
9326
9533
|
|
|
9327
9534
|
// src/utils/digitalCredential/MappingUtils.ts
|
|
9328
|
-
var
|
|
9535
|
+
var import_ssi_types9 = require("@sphereon/ssi-types");
|
|
9329
9536
|
var import_utils = require("@veramo/utils");
|
|
9330
9537
|
var import_ssi_sdk23 = require("@sphereon/ssi-sdk.core");
|
|
9331
9538
|
function determineDocumentType(raw) {
|
|
@@ -9333,11 +9540,11 @@ function determineDocumentType(raw) {
|
|
|
9333
9540
|
if (!rawDocument) {
|
|
9334
9541
|
throw new Error(`Couldn't parse the credential: ${raw}`);
|
|
9335
9542
|
}
|
|
9336
|
-
const hasProof =
|
|
9337
|
-
const isCredential = isHex(raw) ||
|
|
9338
|
-
const isPresentation =
|
|
9543
|
+
const hasProof = import_ssi_types9.CredentialMapper.hasProof(rawDocument);
|
|
9544
|
+
const isCredential = isHex(raw) || import_ssi_types9.ObjectUtils.isBase64(raw) || import_ssi_types9.CredentialMapper.isCredential(rawDocument);
|
|
9545
|
+
const isPresentation = import_ssi_types9.CredentialMapper.isPresentation(rawDocument);
|
|
9339
9546
|
if (isCredential) {
|
|
9340
|
-
return hasProof || isHex(raw) ||
|
|
9547
|
+
return hasProof || isHex(raw) || import_ssi_types9.ObjectUtils.isBase64(raw) ? DocumentType.VC : DocumentType.C;
|
|
9341
9548
|
} else if (isPresentation) {
|
|
9342
9549
|
return hasProof ? DocumentType.VP : DocumentType.P;
|
|
9343
9550
|
}
|
|
@@ -9349,9 +9556,9 @@ function isHex(input) {
|
|
|
9349
9556
|
}
|
|
9350
9557
|
__name(isHex, "isHex");
|
|
9351
9558
|
function parseRawDocument(raw) {
|
|
9352
|
-
if (isHex(raw) ||
|
|
9559
|
+
if (isHex(raw) || import_ssi_types9.ObjectUtils.isBase64(raw)) {
|
|
9353
9560
|
return raw;
|
|
9354
|
-
} else if (
|
|
9561
|
+
} else if (import_ssi_types9.CredentialMapper.isJwtEncoded(raw) || import_ssi_types9.CredentialMapper.isSdJwtEncoded(raw)) {
|
|
9355
9562
|
return raw;
|
|
9356
9563
|
}
|
|
9357
9564
|
try {
|
|
@@ -9363,9 +9570,9 @@ function parseRawDocument(raw) {
|
|
|
9363
9570
|
__name(parseRawDocument, "parseRawDocument");
|
|
9364
9571
|
function ensureRawDocument(input) {
|
|
9365
9572
|
if (typeof input === "string") {
|
|
9366
|
-
if (isHex(input) ||
|
|
9573
|
+
if (isHex(input) || import_ssi_types9.ObjectUtils.isBase64(input)) {
|
|
9367
9574
|
return input;
|
|
9368
|
-
} else if (
|
|
9575
|
+
} else if (import_ssi_types9.CredentialMapper.isJwtEncoded(input) || import_ssi_types9.CredentialMapper.isSdJwtEncoded(input)) {
|
|
9369
9576
|
return input;
|
|
9370
9577
|
}
|
|
9371
9578
|
throw Error("Unknown input to be mapped as rawDocument");
|
|
@@ -9379,13 +9586,13 @@ function ensureRawDocument(input) {
|
|
|
9379
9586
|
__name(ensureRawDocument, "ensureRawDocument");
|
|
9380
9587
|
function determineCredentialDocumentFormat(documentFormat) {
|
|
9381
9588
|
switch (documentFormat) {
|
|
9382
|
-
case
|
|
9589
|
+
case import_ssi_types9.DocumentFormat.JSONLD:
|
|
9383
9590
|
return CredentialDocumentFormat.JSON_LD;
|
|
9384
|
-
case
|
|
9591
|
+
case import_ssi_types9.DocumentFormat.JWT:
|
|
9385
9592
|
return CredentialDocumentFormat.JWT;
|
|
9386
|
-
case
|
|
9593
|
+
case import_ssi_types9.DocumentFormat.SD_JWT_VC:
|
|
9387
9594
|
return CredentialDocumentFormat.SD_JWT;
|
|
9388
|
-
case
|
|
9595
|
+
case import_ssi_types9.DocumentFormat.MSO_MDOC:
|
|
9389
9596
|
return CredentialDocumentFormat.MSO_MDOC;
|
|
9390
9597
|
default:
|
|
9391
9598
|
throw new Error(`Not supported document format: ${documentFormat}`);
|
|
@@ -9424,14 +9631,14 @@ var safeStringify = /* @__PURE__ */ __name((object) => {
|
|
|
9424
9631
|
}, "safeStringify");
|
|
9425
9632
|
var nonPersistedDigitalCredentialEntityFromAddArgs = /* @__PURE__ */ __name((addCredentialArgs) => {
|
|
9426
9633
|
const documentType = determineDocumentType(addCredentialArgs.rawDocument);
|
|
9427
|
-
const documentFormat =
|
|
9634
|
+
const documentFormat = import_ssi_types9.CredentialMapper.detectDocumentType(addCredentialArgs.rawDocument);
|
|
9428
9635
|
const hasher = addCredentialArgs?.opts?.hasher ?? import_ssi_sdk23.defaultHasher;
|
|
9429
|
-
if (documentFormat ===
|
|
9636
|
+
if (documentFormat === import_ssi_types9.DocumentFormat.SD_JWT_VC && !addCredentialArgs.opts?.hasher) {
|
|
9430
9637
|
throw new Error("No hasher function is provided for SD_JWT credential.");
|
|
9431
9638
|
}
|
|
9432
|
-
const uniformDocument = documentType === DocumentType.VC || documentType === DocumentType.C ?
|
|
9639
|
+
const uniformDocument = documentType === DocumentType.VC || documentType === DocumentType.C ? import_ssi_types9.CredentialMapper.toUniformCredential(addCredentialArgs.rawDocument, {
|
|
9433
9640
|
hasher
|
|
9434
|
-
}) :
|
|
9641
|
+
}) : import_ssi_types9.CredentialMapper.toUniformPresentation(addCredentialArgs.rawDocument, {
|
|
9435
9642
|
hasher
|
|
9436
9643
|
});
|
|
9437
9644
|
const validFrom = getValidFrom(uniformDocument);
|