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