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