@sphereon/ssi-sdk.data-store 0.34.1-feature.SSISDK.45.93 → 0.34.1-feature.SSISDK.46.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1427 -1459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -158
- package/dist/index.d.ts +164 -158
- package/dist/index.js +1383 -1415
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/digitalCredential/DigitalCredentialStore.ts +9 -9
- package/src/entities/contact/IdentityEntity.ts +1 -2
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +1 -2
- package/src/migrations/generic/12-CreateBitstringStatusList.ts +2 -31
- package/src/migrations/generic/index.ts +4 -8
- package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +1 -1
- package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +2 -15
- package/src/types/contact/contact.ts +1 -1
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +1 -2
- package/src/types/digitalCredential/enums.ts +8 -1
- package/src/types/digitalCredential/types.ts +1 -2
package/dist/index.js
CHANGED
|
@@ -8,55 +8,55 @@ import typeorm6 from "typeorm";
|
|
|
8
8
|
import typeorm5 from "typeorm";
|
|
9
9
|
|
|
10
10
|
// src/types/contact/contact.ts
|
|
11
|
-
var ConnectionType = /* @__PURE__ */ function(ConnectionType2) {
|
|
11
|
+
var ConnectionType = /* @__PURE__ */ (function(ConnectionType2) {
|
|
12
12
|
ConnectionType2["OPENID_CONNECT"] = "OIDC";
|
|
13
13
|
ConnectionType2["SIOPv2"] = "SIOPv2";
|
|
14
14
|
ConnectionType2["SIOPv2_OpenID4VP"] = "SIOPv2+OpenID4VP";
|
|
15
15
|
return ConnectionType2;
|
|
16
|
-
}({});
|
|
17
|
-
var CorrelationIdentifierType = /* @__PURE__ */ function(CorrelationIdentifierType2) {
|
|
16
|
+
})({});
|
|
17
|
+
var CorrelationIdentifierType = /* @__PURE__ */ (function(CorrelationIdentifierType2) {
|
|
18
18
|
CorrelationIdentifierType2["DID"] = "did";
|
|
19
19
|
CorrelationIdentifierType2["URL"] = "url";
|
|
20
20
|
return CorrelationIdentifierType2;
|
|
21
|
-
}({});
|
|
22
|
-
var PartyTypeType = /* @__PURE__ */ function(PartyTypeType2) {
|
|
21
|
+
})({});
|
|
22
|
+
var PartyTypeType = /* @__PURE__ */ (function(PartyTypeType2) {
|
|
23
23
|
PartyTypeType2["NATURAL_PERSON"] = "naturalPerson";
|
|
24
24
|
PartyTypeType2["ORGANIZATION"] = "organization";
|
|
25
25
|
return PartyTypeType2;
|
|
26
|
-
}({});
|
|
27
|
-
var PartyOrigin = /* @__PURE__ */ function(PartyOrigin2) {
|
|
26
|
+
})({});
|
|
27
|
+
var PartyOrigin = /* @__PURE__ */ (function(PartyOrigin2) {
|
|
28
28
|
PartyOrigin2["INTERNAL"] = "INTERNAL";
|
|
29
29
|
PartyOrigin2["EXTERNAL"] = "EXTERNAL";
|
|
30
30
|
return PartyOrigin2;
|
|
31
|
-
}({});
|
|
32
|
-
var IdentityOrigin = /* @__PURE__ */ function(IdentityOrigin2) {
|
|
31
|
+
})({});
|
|
32
|
+
var IdentityOrigin = /* @__PURE__ */ (function(IdentityOrigin2) {
|
|
33
33
|
IdentityOrigin2["INTERNAL"] = "INTERNAL";
|
|
34
34
|
IdentityOrigin2["EXTERNAL"] = "EXTERNAL";
|
|
35
35
|
return IdentityOrigin2;
|
|
36
|
-
}({});
|
|
36
|
+
})({});
|
|
37
37
|
|
|
38
38
|
// src/types/digitalCredential/enums.ts
|
|
39
|
-
var DocumentType = /* @__PURE__ */ function(DocumentType2) {
|
|
39
|
+
var DocumentType = /* @__PURE__ */ (function(DocumentType2) {
|
|
40
40
|
DocumentType2["VC"] = "VC";
|
|
41
41
|
DocumentType2["VP"] = "VP";
|
|
42
42
|
DocumentType2["P"] = "P";
|
|
43
43
|
DocumentType2["C"] = "C";
|
|
44
44
|
return DocumentType2;
|
|
45
|
-
}({});
|
|
46
|
-
var RegulationType = /* @__PURE__ */ function(RegulationType2) {
|
|
45
|
+
})({});
|
|
46
|
+
var RegulationType = /* @__PURE__ */ (function(RegulationType2) {
|
|
47
47
|
RegulationType2["PID"] = "PID";
|
|
48
48
|
RegulationType2["QEAA"] = "QEAA";
|
|
49
49
|
RegulationType2["EAA"] = "EAA";
|
|
50
50
|
RegulationType2["NON_REGULATED"] = "NON_REGULATED";
|
|
51
51
|
return RegulationType2;
|
|
52
|
-
}({});
|
|
53
|
-
var CredentialDocumentFormat = /* @__PURE__ */ function(CredentialDocumentFormat2) {
|
|
52
|
+
})({});
|
|
53
|
+
var CredentialDocumentFormat = /* @__PURE__ */ (function(CredentialDocumentFormat2) {
|
|
54
54
|
CredentialDocumentFormat2["JSON_LD"] = "JSON_LD";
|
|
55
55
|
CredentialDocumentFormat2["JWT"] = "JWT";
|
|
56
56
|
CredentialDocumentFormat2["SD_JWT"] = "SD_JWT";
|
|
57
57
|
CredentialDocumentFormat2["MSO_MDOC"] = "MSO_MDOC";
|
|
58
58
|
return CredentialDocumentFormat2;
|
|
59
|
-
}({});
|
|
59
|
+
})({});
|
|
60
60
|
(function(CredentialDocumentFormat2) {
|
|
61
61
|
function fromSpecValue(credentialFormat) {
|
|
62
62
|
const format = credentialFormat.toLowerCase();
|
|
@@ -77,7 +77,7 @@ var CredentialDocumentFormat = /* @__PURE__ */ function(CredentialDocumentFormat
|
|
|
77
77
|
function toSpecValue(documentFormat, documentType) {
|
|
78
78
|
switch (documentFormat) {
|
|
79
79
|
case "SD_JWT":
|
|
80
|
-
return "
|
|
80
|
+
return "vc+sd-jwt";
|
|
81
81
|
case "MSO_MDOC":
|
|
82
82
|
return "mso_mdoc";
|
|
83
83
|
case "JSON_LD":
|
|
@@ -89,19 +89,26 @@ var CredentialDocumentFormat = /* @__PURE__ */ function(CredentialDocumentFormat
|
|
|
89
89
|
__name(toSpecValue, "toSpecValue");
|
|
90
90
|
CredentialDocumentFormat2.toSpecValue = toSpecValue;
|
|
91
91
|
})(CredentialDocumentFormat || (CredentialDocumentFormat = {}));
|
|
92
|
-
var CredentialCorrelationType = /* @__PURE__ */ function(CredentialCorrelationType2) {
|
|
92
|
+
var CredentialCorrelationType = /* @__PURE__ */ (function(CredentialCorrelationType2) {
|
|
93
93
|
CredentialCorrelationType2["DID"] = "DID";
|
|
94
94
|
CredentialCorrelationType2["X509_SAN"] = "X509_SAN";
|
|
95
95
|
CredentialCorrelationType2["KID"] = "KID";
|
|
96
96
|
CredentialCorrelationType2["URL"] = "URL";
|
|
97
97
|
return CredentialCorrelationType2;
|
|
98
|
-
}({});
|
|
99
|
-
var
|
|
98
|
+
})({});
|
|
99
|
+
var CredentialRole = /* @__PURE__ */ (function(CredentialRole2) {
|
|
100
|
+
CredentialRole2["ISSUER"] = "ISSUER";
|
|
101
|
+
CredentialRole2["VERIFIER"] = "VERIFIER";
|
|
102
|
+
CredentialRole2["HOLDER"] = "HOLDER";
|
|
103
|
+
CredentialRole2["FEDERATION_TRUST_ANCHOR"] = "FEDERATION_TRUST_ANCHOR";
|
|
104
|
+
return CredentialRole2;
|
|
105
|
+
})({});
|
|
106
|
+
var CredentialStateType = /* @__PURE__ */ (function(CredentialStateType2) {
|
|
100
107
|
CredentialStateType2["REVOKED"] = "REVOKED";
|
|
101
108
|
CredentialStateType2["VERIFIED"] = "VERIFIED";
|
|
102
109
|
CredentialStateType2["EXPIRED"] = "EXPIRED";
|
|
103
110
|
return CredentialStateType2;
|
|
104
|
-
}({});
|
|
111
|
+
})({});
|
|
105
112
|
|
|
106
113
|
// src/entities/contact/IdentityEntity.ts
|
|
107
114
|
import { BaseEntity as BaseEntity8, CreateDateColumn as CreateDateColumn7, Entity as Entity10, PrimaryGeneratedColumn as PrimaryGeneratedColumn10, UpdateDateColumn as UpdateDateColumn7, OneToOne as OneToOne4, JoinColumn as JoinColumn5, ManyToOne as ManyToOne7, Column as Column9, OneToMany as OneToMany4, BeforeInsert as BeforeInsert10, BeforeUpdate as BeforeUpdate10 } from "typeorm";
|
|
@@ -3762,7 +3769,6 @@ AuditEventEntity = _ts_decorate32([
|
|
|
3762
3769
|
|
|
3763
3770
|
// src/entities/digitalCredential/DigitalCredentialEntity.ts
|
|
3764
3771
|
import { typeormDate, typeOrmDateTime as typeOrmDateTime16 } from "@sphereon/ssi-sdk.agent-config";
|
|
3765
|
-
import { CredentialRole } from "@sphereon/ssi-types";
|
|
3766
3772
|
import { BaseEntity as BaseEntity23, Column as Column30, CreateDateColumn as CreateDateColumn13, Entity as Entity25, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, UpdateDateColumn as UpdateDateColumn13 } from "typeorm";
|
|
3767
3773
|
function _ts_decorate33(decorators, target, key, desc) {
|
|
3768
3774
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -5340,7 +5346,6 @@ var AbstractDigitalCredentialStore = class {
|
|
|
5340
5346
|
};
|
|
5341
5347
|
|
|
5342
5348
|
// src/digitalCredential/DigitalCredentialStore.ts
|
|
5343
|
-
import { CredentialRole as CredentialRole2 } from "@sphereon/ssi-types";
|
|
5344
5349
|
import Debug2 from "debug";
|
|
5345
5350
|
|
|
5346
5351
|
// src/utils/SortingUtils.ts
|
|
@@ -5410,7 +5415,7 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5410
5415
|
if (!args) {
|
|
5411
5416
|
return false;
|
|
5412
5417
|
}
|
|
5413
|
-
|
|
5418
|
+
let query = {};
|
|
5414
5419
|
if ("id" in args) {
|
|
5415
5420
|
query.id = args.id;
|
|
5416
5421
|
} else if ("hash" in args) {
|
|
@@ -5496,7 +5501,7 @@ var DigitalCredentialStore = class extends AbstractDigitalCredentialStore {
|
|
|
5496
5501
|
}, "updateCredentialState");
|
|
5497
5502
|
assertValidDigitalCredential(credentialEntity) {
|
|
5498
5503
|
const { kmsKeyRef, identifierMethod, credentialRole, isIssuerSigned } = credentialEntity;
|
|
5499
|
-
const isRoleInvalid = credentialRole ===
|
|
5504
|
+
const isRoleInvalid = credentialRole === CredentialRole.ISSUER || credentialRole === CredentialRole.HOLDER && !isIssuerSigned;
|
|
5500
5505
|
if (isRoleInvalid && (!kmsKeyRef || !identifierMethod)) {
|
|
5501
5506
|
const missingFields = [];
|
|
5502
5507
|
if (!kmsKeyRef) missingFields.push("kmsKeyRef");
|
|
@@ -7135,120 +7140,9 @@ var CreateContacts1659463079429 = class {
|
|
|
7135
7140
|
}
|
|
7136
7141
|
};
|
|
7137
7142
|
|
|
7138
|
-
// src/migrations/generic/
|
|
7143
|
+
// src/migrations/generic/2-CreateIssuanceBranding.ts
|
|
7139
7144
|
import Debug9 from "debug";
|
|
7140
7145
|
|
|
7141
|
-
// src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts
|
|
7142
|
-
var CreatePresentationDefinitions1716475165345 = class {
|
|
7143
|
-
static {
|
|
7144
|
-
__name(this, "CreatePresentationDefinitions1716475165345");
|
|
7145
|
-
}
|
|
7146
|
-
name = "CreatePresentationDefinitions1716475165345";
|
|
7147
|
-
async up(queryRunner) {
|
|
7148
|
-
await queryRunner.query(`
|
|
7149
|
-
CREATE TABLE "PresentationDefinitionItem" (
|
|
7150
|
-
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
7151
|
-
"tenant_id" TEXT,
|
|
7152
|
-
"definition_id" TEXT NOT NULL,
|
|
7153
|
-
"name" TEXT,
|
|
7154
|
-
"version" TEXT NOT NULL,
|
|
7155
|
-
"purpose" TEXT,
|
|
7156
|
-
"definition_payload" TEXT NOT NULL,
|
|
7157
|
-
"dcql_payload" TEXT,
|
|
7158
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7159
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7160
|
-
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
7161
|
-
`);
|
|
7162
|
-
}
|
|
7163
|
-
async down(queryRunner) {
|
|
7164
|
-
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
7165
|
-
}
|
|
7166
|
-
};
|
|
7167
|
-
|
|
7168
|
-
// src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts
|
|
7169
|
-
var CreatePresentationDefinitions1716475165344 = class {
|
|
7170
|
-
static {
|
|
7171
|
-
__name(this, "CreatePresentationDefinitions1716475165344");
|
|
7172
|
-
}
|
|
7173
|
-
name = "CreatePresentationDefinitions1716475165344";
|
|
7174
|
-
async up(queryRunner) {
|
|
7175
|
-
await queryRunner.query(`CREATE TABLE "PresentationDefinitionItem" (
|
|
7176
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
7177
|
-
"tenant_id" varchar,
|
|
7178
|
-
"definition_id" varchar NOT NULL,
|
|
7179
|
-
"name" varchar,
|
|
7180
|
-
"version" varchar NOT NULL,
|
|
7181
|
-
"purpose" varchar,
|
|
7182
|
-
"definition_payload" varchar NOT NULL,
|
|
7183
|
-
"dcql_payload" varchar,
|
|
7184
|
-
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
7185
|
-
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7186
|
-
}
|
|
7187
|
-
async down(queryRunner) {
|
|
7188
|
-
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
7189
|
-
}
|
|
7190
|
-
};
|
|
7191
|
-
|
|
7192
|
-
// src/migrations/generic/10-CreatePresentationDefinitions.ts
|
|
7193
|
-
var debug9 = Debug9("sphereon:ssi-sdk:migrations");
|
|
7194
|
-
var CreatePresentationDefinitions1716533767523 = class {
|
|
7195
|
-
static {
|
|
7196
|
-
__name(this, "CreatePresentationDefinitions1716533767523");
|
|
7197
|
-
}
|
|
7198
|
-
name = "CreatePresentationDefinitionItems1716533767523";
|
|
7199
|
-
async up(queryRunner) {
|
|
7200
|
-
debug9("migration: creating machine state tables");
|
|
7201
|
-
const dbType = queryRunner.connection.driver.options.type;
|
|
7202
|
-
switch (dbType) {
|
|
7203
|
-
case "postgres": {
|
|
7204
|
-
debug9("using postgres migration file");
|
|
7205
|
-
const mig = new CreatePresentationDefinitions1716475165345();
|
|
7206
|
-
await mig.up(queryRunner);
|
|
7207
|
-
debug9("Migration statements executed");
|
|
7208
|
-
return;
|
|
7209
|
-
}
|
|
7210
|
-
case "sqlite":
|
|
7211
|
-
case "expo":
|
|
7212
|
-
case "react-native": {
|
|
7213
|
-
debug9("using sqlite/react-native migration file");
|
|
7214
|
-
const mig = new CreatePresentationDefinitions1716475165344();
|
|
7215
|
-
await mig.up(queryRunner);
|
|
7216
|
-
debug9("Migration statements executed");
|
|
7217
|
-
return;
|
|
7218
|
-
}
|
|
7219
|
-
default:
|
|
7220
|
-
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`);
|
|
7221
|
-
}
|
|
7222
|
-
}
|
|
7223
|
-
async down(queryRunner) {
|
|
7224
|
-
debug9("migration: reverting machine state tables");
|
|
7225
|
-
const dbType = queryRunner.connection.driver.options.type;
|
|
7226
|
-
switch (dbType) {
|
|
7227
|
-
case "postgres": {
|
|
7228
|
-
debug9("using postgres migration file");
|
|
7229
|
-
const mig = new CreatePresentationDefinitions1716475165345();
|
|
7230
|
-
await mig.down(queryRunner);
|
|
7231
|
-
debug9("Migration statements executed");
|
|
7232
|
-
return;
|
|
7233
|
-
}
|
|
7234
|
-
case "sqlite":
|
|
7235
|
-
case "expo":
|
|
7236
|
-
case "react-native": {
|
|
7237
|
-
debug9("using sqlite/react-native migration file");
|
|
7238
|
-
const mig = new CreatePresentationDefinitions1716475165344();
|
|
7239
|
-
await mig.down(queryRunner);
|
|
7240
|
-
debug9("Migration statements executed");
|
|
7241
|
-
return;
|
|
7242
|
-
}
|
|
7243
|
-
default:
|
|
7244
|
-
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`);
|
|
7245
|
-
}
|
|
7246
|
-
}
|
|
7247
|
-
};
|
|
7248
|
-
|
|
7249
|
-
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
7250
|
-
import Debug10 from "debug";
|
|
7251
|
-
|
|
7252
7146
|
// src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts
|
|
7253
7147
|
import { enablePostgresUuidExtension as enablePostgresUuidExtension2 } from "@sphereon/ssi-sdk.core";
|
|
7254
7148
|
var CreateIssuanceBranding1685628974232 = class {
|
|
@@ -7385,105 +7279,31 @@ var CreateIssuanceBranding1685628973231 = class {
|
|
|
7385
7279
|
}
|
|
7386
7280
|
};
|
|
7387
7281
|
|
|
7388
|
-
// src/migrations/
|
|
7389
|
-
var
|
|
7390
|
-
|
|
7391
|
-
__name(this, "FixCredentialClaimsReferencesUuidPG1741895822987");
|
|
7392
|
-
}
|
|
7393
|
-
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
7394
|
-
async up(queryRunner) {
|
|
7395
|
-
await queryRunner.query(`
|
|
7396
|
-
ALTER TABLE "CredentialClaims"
|
|
7397
|
-
ALTER COLUMN "credentialLocaleBrandingId" TYPE uuid USING "credentialLocaleBrandingId"::uuid;
|
|
7398
|
-
`);
|
|
7399
|
-
}
|
|
7400
|
-
async down(queryRunner) {
|
|
7401
|
-
await queryRunner.query(`
|
|
7402
|
-
ALTER TABLE "CredentialClaims"
|
|
7403
|
-
ALTER COLUMN "credentialLocaleBrandingId" TYPE character varying USING "credentialLocaleBrandingId"::text;
|
|
7404
|
-
`);
|
|
7405
|
-
}
|
|
7406
|
-
};
|
|
7407
|
-
|
|
7408
|
-
// src/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.ts
|
|
7409
|
-
var FixCredentialClaimsReferencesUuidSqlite1741895822987 = class {
|
|
7410
|
-
static {
|
|
7411
|
-
__name(this, "FixCredentialClaimsReferencesUuidSqlite1741895822987");
|
|
7412
|
-
}
|
|
7413
|
-
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
7414
|
-
async up(queryRunner) {
|
|
7415
|
-
await queryRunner.query(`
|
|
7416
|
-
CREATE TABLE "CredentialClaims_new"
|
|
7417
|
-
(
|
|
7418
|
-
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
7419
|
-
"key" character varying(255) NOT NULL,
|
|
7420
|
-
"name" character varying(255) NOT NULL,
|
|
7421
|
-
"credentialLocaleBrandingId" uuid,
|
|
7422
|
-
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
7423
|
-
)
|
|
7424
|
-
`);
|
|
7425
|
-
await queryRunner.query(`
|
|
7426
|
-
INSERT INTO "CredentialClaims_new" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
7427
|
-
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
7428
|
-
FROM "CredentialClaims"
|
|
7429
|
-
`);
|
|
7430
|
-
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
7431
|
-
await queryRunner.query(`ALTER TABLE "CredentialClaims_new" RENAME TO "CredentialClaims"`);
|
|
7432
|
-
await queryRunner.query(`
|
|
7433
|
-
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
7434
|
-
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
7435
|
-
`);
|
|
7436
|
-
}
|
|
7437
|
-
async down(queryRunner) {
|
|
7438
|
-
await queryRunner.query(`
|
|
7439
|
-
CREATE TABLE "CredentialClaims_old"
|
|
7440
|
-
(
|
|
7441
|
-
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
7442
|
-
"key" character varying(255) NOT NULL,
|
|
7443
|
-
"name" character varying(255) NOT NULL,
|
|
7444
|
-
"credentialLocaleBrandingId" character varying,
|
|
7445
|
-
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
7446
|
-
)
|
|
7447
|
-
`);
|
|
7448
|
-
await queryRunner.query(`
|
|
7449
|
-
INSERT INTO "CredentialClaims_old" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
7450
|
-
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
7451
|
-
FROM "CredentialClaims"
|
|
7452
|
-
`);
|
|
7453
|
-
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
7454
|
-
await queryRunner.query(`ALTER TABLE "CredentialClaims_old" RENAME TO "CredentialClaims"`);
|
|
7455
|
-
await queryRunner.query(`
|
|
7456
|
-
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
7457
|
-
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
7458
|
-
`);
|
|
7459
|
-
}
|
|
7460
|
-
};
|
|
7461
|
-
|
|
7462
|
-
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
7463
|
-
var debug10 = Debug10("sphereon:ssi-sdk:migrations");
|
|
7464
|
-
var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
7282
|
+
// src/migrations/generic/2-CreateIssuanceBranding.ts
|
|
7283
|
+
var debug9 = Debug9("sphereon:ssi-sdk:migrations");
|
|
7284
|
+
var CreateIssuanceBranding1659463079429 = class {
|
|
7465
7285
|
static {
|
|
7466
|
-
__name(this, "
|
|
7286
|
+
__name(this, "CreateIssuanceBranding1659463079429");
|
|
7467
7287
|
}
|
|
7468
|
-
name = "
|
|
7288
|
+
name = "CreateIssuanceBranding1659463079429";
|
|
7469
7289
|
async up(queryRunner) {
|
|
7470
|
-
|
|
7290
|
+
debug9("migration: creating issuance branding tables");
|
|
7471
7291
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7472
7292
|
switch (dbType) {
|
|
7473
7293
|
case "postgres": {
|
|
7474
|
-
|
|
7475
|
-
const mig = new
|
|
7294
|
+
debug9("using postgres migration file");
|
|
7295
|
+
const mig = new CreateIssuanceBranding1685628974232();
|
|
7476
7296
|
await mig.up(queryRunner);
|
|
7477
|
-
|
|
7297
|
+
debug9("Migration statements executed");
|
|
7478
7298
|
return;
|
|
7479
7299
|
}
|
|
7480
7300
|
case "sqlite":
|
|
7481
7301
|
case "expo":
|
|
7482
7302
|
case "react-native": {
|
|
7483
|
-
|
|
7484
|
-
const mig = new
|
|
7303
|
+
debug9("using sqlite/react-native migration file");
|
|
7304
|
+
const mig = new CreateIssuanceBranding1685628973231();
|
|
7485
7305
|
await mig.up(queryRunner);
|
|
7486
|
-
|
|
7306
|
+
debug9("Migration statements executed");
|
|
7487
7307
|
return;
|
|
7488
7308
|
}
|
|
7489
7309
|
default:
|
|
@@ -7491,23 +7311,23 @@ var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
|
7491
7311
|
}
|
|
7492
7312
|
}
|
|
7493
7313
|
async down(queryRunner) {
|
|
7494
|
-
|
|
7314
|
+
debug9("migration: reverting issuance branding tables");
|
|
7495
7315
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7496
7316
|
switch (dbType) {
|
|
7497
7317
|
case "postgres": {
|
|
7498
|
-
|
|
7318
|
+
debug9("using postgres migration file");
|
|
7499
7319
|
const mig = new CreateIssuanceBranding1685628974232();
|
|
7500
7320
|
await mig.down(queryRunner);
|
|
7501
|
-
|
|
7321
|
+
debug9("Migration statements executed");
|
|
7502
7322
|
return;
|
|
7503
7323
|
}
|
|
7504
7324
|
case "sqlite":
|
|
7505
7325
|
case "expo":
|
|
7506
7326
|
case "react-native": {
|
|
7507
|
-
|
|
7327
|
+
debug9("using sqlite/react-native migration file");
|
|
7508
7328
|
const mig = new CreateIssuanceBranding1685628973231();
|
|
7509
7329
|
await mig.down(queryRunner);
|
|
7510
|
-
|
|
7330
|
+
debug9("Migration statements executed");
|
|
7511
7331
|
return;
|
|
7512
7332
|
}
|
|
7513
7333
|
default:
|
|
@@ -7516,975 +7336,1113 @@ var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
|
7516
7336
|
}
|
|
7517
7337
|
};
|
|
7518
7338
|
|
|
7519
|
-
// src/migrations/generic/
|
|
7520
|
-
import
|
|
7339
|
+
// src/migrations/generic/3-CreateContacts.ts
|
|
7340
|
+
import Debug10 from "debug";
|
|
7521
7341
|
|
|
7522
|
-
// src/migrations/
|
|
7523
|
-
var
|
|
7524
|
-
static {
|
|
7525
|
-
__name(this, "AddBitstringStatusListEnumPG1741895823000");
|
|
7526
|
-
}
|
|
7527
|
-
name = "AddBitstringStatusListEnum1741895823000";
|
|
7528
|
-
async up(queryRunner) {
|
|
7529
|
-
await queryRunner.startTransaction();
|
|
7530
|
-
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'BitstringStatusList'`);
|
|
7531
|
-
await queryRunner.commitTransaction();
|
|
7532
|
-
}
|
|
7533
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7534
|
-
async down(queryRunner) {
|
|
7535
|
-
}
|
|
7536
|
-
};
|
|
7537
|
-
var CreateBitstringStatusListPG1741895823000 = class {
|
|
7342
|
+
// src/migrations/sqlite/1690925872693-CreateContacts.ts
|
|
7343
|
+
var CreateContacts1690925872693 = class {
|
|
7538
7344
|
static {
|
|
7539
|
-
__name(this, "
|
|
7345
|
+
__name(this, "CreateContacts1690925872693");
|
|
7540
7346
|
}
|
|
7541
|
-
name = "
|
|
7347
|
+
name = "CreateContacts1690925872693";
|
|
7542
7348
|
async up(queryRunner) {
|
|
7543
|
-
await queryRunner.query(`
|
|
7544
|
-
await queryRunner.query(`
|
|
7545
|
-
await queryRunner.query(`
|
|
7546
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7547
|
-
await queryRunner.query(`
|
|
7548
|
-
await queryRunner.query(`
|
|
7549
|
-
await queryRunner.query(`
|
|
7550
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7551
|
-
await queryRunner.query(`
|
|
7552
|
-
await queryRunner.query(`
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
await queryRunner.query(`
|
|
7556
|
-
await queryRunner.query(`
|
|
7557
|
-
await queryRunner.query(`
|
|
7558
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7559
|
-
await queryRunner.query(`
|
|
7560
|
-
await queryRunner.query(`
|
|
7561
|
-
await queryRunner.query(`
|
|
7562
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7563
|
-
await queryRunner.query(`
|
|
7564
|
-
await queryRunner.query(`
|
|
7565
|
-
await queryRunner.query(`
|
|
7566
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7349
|
+
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"))`);
|
|
7350
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identityId") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
7351
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7352
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7353
|
+
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"))`);
|
|
7354
|
+
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"`);
|
|
7355
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7356
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7357
|
+
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"))`);
|
|
7358
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identityId") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
7359
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7360
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7361
|
+
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"))`);
|
|
7362
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identityId" FROM "CorrelationIdentifier"`);
|
|
7363
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7364
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7365
|
+
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"))`);
|
|
7366
|
+
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"`);
|
|
7367
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7368
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7369
|
+
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"))`);
|
|
7370
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identityId" FROM "Connection"`);
|
|
7371
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7372
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7373
|
+
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"))`);
|
|
7374
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
7375
|
+
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"))`);
|
|
7376
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7377
|
+
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')))`);
|
|
7378
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7379
|
+
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)`);
|
|
7380
|
+
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"))`);
|
|
7381
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7382
|
+
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)`);
|
|
7383
|
+
await queryRunner.query(`INSERT INTO "temporary_CorrelationIdentifier"("id", "type", "correlation_id", "identity_id") SELECT "id", "type", "correlation_id", "identity_id" FROM "CorrelationIdentifier"`);
|
|
7384
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7385
|
+
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7386
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7387
|
+
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)`);
|
|
7388
|
+
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"`);
|
|
7389
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7390
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7391
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7392
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7393
|
+
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)`);
|
|
7394
|
+
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"`);
|
|
7395
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7396
|
+
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7397
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7398
|
+
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)`);
|
|
7399
|
+
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)`);
|
|
7400
|
+
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)`);
|
|
7401
|
+
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"`);
|
|
7402
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7403
|
+
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7404
|
+
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)`);
|
|
7405
|
+
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"`);
|
|
7406
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7407
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7408
|
+
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)`);
|
|
7409
|
+
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identity_id" FROM "Connection"`);
|
|
7410
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7411
|
+
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7412
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7413
|
+
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)`);
|
|
7414
|
+
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"`);
|
|
7415
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7416
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7417
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7418
|
+
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"`);
|
|
7419
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
7420
|
+
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'))`);
|
|
7421
|
+
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'))`);
|
|
7422
|
+
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"`);
|
|
7423
|
+
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"`);
|
|
7424
|
+
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7425
|
+
}
|
|
7426
|
+
async down(queryRunner) {
|
|
7427
|
+
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))`);
|
|
7428
|
+
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'`);
|
|
7429
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7430
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7431
|
+
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)`);
|
|
7432
|
+
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"`);
|
|
7433
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7434
|
+
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)`);
|
|
7435
|
+
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"`);
|
|
7436
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7437
|
+
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7438
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7439
|
+
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)`);
|
|
7440
|
+
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"`);
|
|
7441
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7442
|
+
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7443
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7444
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7445
|
+
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)`);
|
|
7446
|
+
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"`);
|
|
7447
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7448
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7449
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7450
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7451
|
+
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)`);
|
|
7452
|
+
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"`);
|
|
7453
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7454
|
+
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7455
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7456
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
7457
|
+
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
7458
|
+
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7459
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7460
|
+
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7461
|
+
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
7462
|
+
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
7567
7463
|
}
|
|
7568
7464
|
};
|
|
7569
7465
|
|
|
7570
|
-
// src/migrations/
|
|
7571
|
-
|
|
7466
|
+
// src/migrations/postgres/1690925872592-CreateContacts.ts
|
|
7467
|
+
import { enablePostgresUuidExtension as enablePostgresUuidExtension3 } from "@sphereon/ssi-sdk.core";
|
|
7468
|
+
var CreateContacts1690925872592 = class {
|
|
7572
7469
|
static {
|
|
7573
|
-
__name(this, "
|
|
7470
|
+
__name(this, "CreateContacts1690925872592");
|
|
7574
7471
|
}
|
|
7575
|
-
name = "
|
|
7472
|
+
name = "CreateContacts1690925872592";
|
|
7576
7473
|
async up(queryRunner) {
|
|
7577
|
-
await queryRunner
|
|
7578
|
-
|
|
7579
|
-
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
`);
|
|
7598
|
-
await queryRunner.query(`
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
`);
|
|
7610
|
-
await queryRunner.query(`
|
|
7611
|
-
await queryRunner.query(`ALTER TABLE "
|
|
7612
|
-
await queryRunner.query(`
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
"bitsPerStatus" integer DEFAULT (1),
|
|
7623
|
-
"statusMessage" text,
|
|
7624
|
-
"statusReference" text,
|
|
7625
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7626
|
-
)
|
|
7627
|
-
`);
|
|
7628
|
-
await queryRunner.query(`
|
|
7629
|
-
INSERT INTO "temporary_StatusListEntry"(
|
|
7630
|
-
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7631
|
-
"correlationId", "value", "type"
|
|
7632
|
-
)
|
|
7633
|
-
SELECT
|
|
7634
|
-
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
7635
|
-
"correlationId", "value", 'StatusListEntryEntity'
|
|
7636
|
-
FROM "StatusListEntry"
|
|
7637
|
-
`);
|
|
7638
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7639
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
7474
|
+
await enablePostgresUuidExtension3(queryRunner);
|
|
7475
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identityId"`);
|
|
7476
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
7477
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_contactId"`);
|
|
7478
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identityId"`);
|
|
7479
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
7480
|
+
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identityId" TO "identity_id"`);
|
|
7481
|
+
await queryRunner.query(`CREATE TYPE "public"."PartyType_type_enum" AS ENUM('naturalPerson', 'organization')`);
|
|
7482
|
+
await queryRunner.query(`CREATE TYPE "public"."PartyOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
7483
|
+
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"))`);
|
|
7484
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyType_type_tenant_id" ON "PartyType" ("type", "tenant_id")`);
|
|
7485
|
+
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"))`);
|
|
7486
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7487
|
+
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"))`);
|
|
7488
|
+
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7489
|
+
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"))`);
|
|
7490
|
+
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"))`);
|
|
7491
|
+
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"))`);
|
|
7492
|
+
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"))`);
|
|
7493
|
+
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7494
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "contactId" TO "partyId"`);
|
|
7495
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" SET NOT NULL`);
|
|
7496
|
+
await queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
7497
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
|
|
7498
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
|
|
7499
|
+
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`);
|
|
7500
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7501
|
+
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`);
|
|
7502
|
+
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`);
|
|
7503
|
+
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`);
|
|
7504
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7505
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7506
|
+
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`);
|
|
7507
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7508
|
+
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`);
|
|
7509
|
+
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`);
|
|
7510
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
|
|
7511
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
|
|
7512
|
+
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"`);
|
|
7513
|
+
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
7514
|
+
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())`);
|
|
7515
|
+
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())`);
|
|
7516
|
+
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"`);
|
|
7517
|
+
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"`);
|
|
7518
|
+
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7640
7519
|
}
|
|
7641
7520
|
async down(queryRunner) {
|
|
7642
|
-
await queryRunner.query(`
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
`);
|
|
7653
|
-
await queryRunner.query(`
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
`);
|
|
7664
|
-
await queryRunner.query(`DROP
|
|
7665
|
-
await queryRunner.query(`
|
|
7666
|
-
await queryRunner.query(`
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
"statusListCredential" text,
|
|
7679
|
-
"bitsPerStatus" integer,
|
|
7680
|
-
"expiresAt" datetime,
|
|
7681
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7682
|
-
)
|
|
7683
|
-
`);
|
|
7684
|
-
await queryRunner.query(`
|
|
7685
|
-
INSERT INTO "temporary_StatusList"(
|
|
7686
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7687
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7688
|
-
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7689
|
-
)
|
|
7690
|
-
SELECT
|
|
7691
|
-
"id", "correlationId", "length", "issuer",
|
|
7692
|
-
CASE WHEN "type" = 'BitstringStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
7693
|
-
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
7694
|
-
"statusPurpose", "statusListCredential", "bitsPerStatus", "expiresAt"
|
|
7695
|
-
FROM "StatusList"
|
|
7696
|
-
`);
|
|
7697
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7698
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
7521
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP CONSTRAINT "FK_BaseConfig_connection_id"`);
|
|
7522
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP CONSTRAINT "FK_Connection_identity_id"`);
|
|
7523
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP CONSTRAINT "FK_Identity_partyId"`);
|
|
7524
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP CONSTRAINT "FK_Party_party_type_id"`);
|
|
7525
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP CONSTRAINT "FK_PhysicalAddress_partyId"`);
|
|
7526
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP CONSTRAINT "FK_ElectronicAddress_partyId"`);
|
|
7527
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_right_id"`);
|
|
7528
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP CONSTRAINT "FK_PartyRelationship_left_id"`);
|
|
7529
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP CONSTRAINT "FK_BaseContact_party_id"`);
|
|
7530
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" DROP CONSTRAINT "FK_IdentityMetadata_identityId"`);
|
|
7531
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP CONSTRAINT "FK_CorrelationIdentifier_identity_id"`);
|
|
7532
|
+
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "roles" DROP NOT NULL`);
|
|
7533
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "origin"`);
|
|
7534
|
+
await queryRunner.query(`DROP TYPE "public"."IdentityOrigin_type_enum"`);
|
|
7535
|
+
await queryRunner.query(`ALTER TABLE "Identity" RENAME COLUMN "partyId" TO "contactId"`);
|
|
7536
|
+
await queryRunner.query(`ALTER TABLE "Connection" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
7537
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME COLUMN "identity_id" TO "identityId"`);
|
|
7538
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7539
|
+
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7540
|
+
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7541
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7542
|
+
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7543
|
+
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7544
|
+
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7545
|
+
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
7546
|
+
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
7547
|
+
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
7548
|
+
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
7549
|
+
await queryRunner.query(`DROP TYPE "public"."PartyOrigin_type_enum"`);
|
|
7550
|
+
await queryRunner.query(`DROP TYPE "public"."PartyType_type_enum"`);
|
|
7551
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7552
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_contactId" FOREIGN KEY ("contactId") REFERENCES "Contact"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7553
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7554
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD CONSTRAINT "FK_CorrelationIdentifier_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7555
|
+
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"))`);
|
|
7556
|
+
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'`);
|
|
7699
7557
|
}
|
|
7700
7558
|
};
|
|
7701
7559
|
|
|
7702
|
-
// src/migrations/generic/
|
|
7703
|
-
var
|
|
7704
|
-
var
|
|
7560
|
+
// src/migrations/generic/3-CreateContacts.ts
|
|
7561
|
+
var debug10 = Debug10("sphereon:ssi-sdk:migrations");
|
|
7562
|
+
var CreateContacts1690925872318 = class {
|
|
7705
7563
|
static {
|
|
7706
|
-
__name(this, "
|
|
7564
|
+
__name(this, "CreateContacts1690925872318");
|
|
7707
7565
|
}
|
|
7708
|
-
name = "
|
|
7566
|
+
name = "CreateContacts1690925872318";
|
|
7709
7567
|
async up(queryRunner) {
|
|
7710
|
-
|
|
7568
|
+
debug10("migration: creating contacts tables");
|
|
7711
7569
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7712
7570
|
switch (dbType) {
|
|
7713
7571
|
case "postgres": {
|
|
7714
|
-
|
|
7572
|
+
debug10("using postgres migration file");
|
|
7573
|
+
const mig = new CreateContacts1690925872592();
|
|
7715
7574
|
await mig.up(queryRunner);
|
|
7575
|
+
debug10("Migration statements executed");
|
|
7716
7576
|
return;
|
|
7717
7577
|
}
|
|
7718
7578
|
case "sqlite":
|
|
7719
7579
|
case "expo":
|
|
7720
7580
|
case "react-native": {
|
|
7581
|
+
debug10("using sqlite/react-native migration file");
|
|
7582
|
+
const mig = new CreateContacts1690925872693();
|
|
7583
|
+
await mig.up(queryRunner);
|
|
7584
|
+
debug10("Migration statements executed");
|
|
7721
7585
|
return;
|
|
7722
7586
|
}
|
|
7723
7587
|
default:
|
|
7724
|
-
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
7588
|
+
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`);
|
|
7725
7589
|
}
|
|
7726
7590
|
}
|
|
7727
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7728
7591
|
async down(queryRunner) {
|
|
7729
|
-
|
|
7730
|
-
};
|
|
7731
|
-
var CreateBitstringStatusList1741895823000 = class {
|
|
7732
|
-
static {
|
|
7733
|
-
__name(this, "CreateBitstringStatusList1741895823000");
|
|
7734
|
-
}
|
|
7735
|
-
name = "CreateBitstringStatusList1741895823000";
|
|
7736
|
-
async up(queryRunner) {
|
|
7737
|
-
debug11("migration: creating bitstring status list tables");
|
|
7592
|
+
debug10("migration: reverting contacts tables");
|
|
7738
7593
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7739
7594
|
switch (dbType) {
|
|
7740
7595
|
case "postgres": {
|
|
7741
|
-
|
|
7742
|
-
|
|
7596
|
+
debug10("using postgres migration file");
|
|
7597
|
+
const mig = new CreateContacts1690925872592();
|
|
7598
|
+
await mig.down(queryRunner);
|
|
7599
|
+
debug10("Migration statements executed");
|
|
7743
7600
|
return;
|
|
7744
7601
|
}
|
|
7745
7602
|
case "sqlite":
|
|
7746
7603
|
case "expo":
|
|
7747
7604
|
case "react-native": {
|
|
7748
|
-
|
|
7749
|
-
|
|
7605
|
+
debug10("using sqlite/react-native migration file");
|
|
7606
|
+
const mig = new CreateContacts1690925872693();
|
|
7607
|
+
await mig.down(queryRunner);
|
|
7608
|
+
debug10("Migration statements executed");
|
|
7750
7609
|
return;
|
|
7751
7610
|
}
|
|
7752
7611
|
default:
|
|
7753
|
-
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
7612
|
+
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`);
|
|
7613
|
+
}
|
|
7614
|
+
}
|
|
7615
|
+
};
|
|
7616
|
+
|
|
7617
|
+
// src/migrations/generic/4-CreateStatusList.ts
|
|
7618
|
+
import Debug11 from "debug";
|
|
7619
|
+
|
|
7620
|
+
// src/migrations/postgres/1693866470001-CreateStatusList.ts
|
|
7621
|
+
var CreateStatusList1693866470001 = class {
|
|
7622
|
+
static {
|
|
7623
|
+
__name(this, "CreateStatusList1693866470001");
|
|
7624
|
+
}
|
|
7625
|
+
name = "CreateStatusList1693866470001";
|
|
7626
|
+
async up(queryRunner) {
|
|
7627
|
+
await queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
|
|
7628
|
+
await queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
|
|
7629
|
+
await queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
|
|
7630
|
+
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
7631
|
+
(
|
|
7632
|
+
"statusListId" character varying NOT NULL,
|
|
7633
|
+
"statusListIndex" integer NOT NULL,
|
|
7634
|
+
"credentialId" character varying,
|
|
7635
|
+
"credentialHash" character varying(128),
|
|
7636
|
+
"correlationId" character varying(255),
|
|
7637
|
+
"value" character varying(50),
|
|
7638
|
+
CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7639
|
+
)`);
|
|
7640
|
+
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
7641
|
+
(
|
|
7642
|
+
"id" character varying NOT NULL,
|
|
7643
|
+
"correlationId" character varying NOT NULL,
|
|
7644
|
+
"length" integer NOT NULL,
|
|
7645
|
+
"issuer" text NOT NULL,
|
|
7646
|
+
"type" "StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021',
|
|
7647
|
+
"driverType" "StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm',
|
|
7648
|
+
"credentialIdMode" "StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE',
|
|
7649
|
+
"proofFormat" character varying NOT NULL DEFAULT 'lds',
|
|
7650
|
+
"indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft',
|
|
7651
|
+
"statusPurpose" character varying NOT NULL DEFAULT 'revocation',
|
|
7652
|
+
"statusListCredential" text,
|
|
7653
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"),
|
|
7654
|
+
CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id")
|
|
7655
|
+
)`);
|
|
7656
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
7657
|
+
ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
7658
|
+
}
|
|
7659
|
+
async down(queryRunner) {
|
|
7660
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
7661
|
+
DROP CONSTRAINT "FK_statusListEntry_statusListId"`);
|
|
7662
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7663
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7664
|
+
await queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
|
|
7665
|
+
await queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
|
|
7666
|
+
await queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
|
|
7667
|
+
}
|
|
7668
|
+
};
|
|
7669
|
+
|
|
7670
|
+
// src/migrations/sqlite/1693866470000-CreateStatusList.ts
|
|
7671
|
+
var CreateStatusList1693866470002 = class {
|
|
7672
|
+
static {
|
|
7673
|
+
__name(this, "CreateStatusList1693866470002");
|
|
7674
|
+
}
|
|
7675
|
+
name = "CreateStatusList1693866470002";
|
|
7676
|
+
async up(queryRunner) {
|
|
7677
|
+
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
7678
|
+
(
|
|
7679
|
+
"statusListId" varchar NOT NULL,
|
|
7680
|
+
"statusListIndex" integer NOT NULL,
|
|
7681
|
+
"credentialId" varchar,
|
|
7682
|
+
"credentialHash" varchar(128),
|
|
7683
|
+
"correlationId" varchar(255),
|
|
7684
|
+
"value" varchar(50),
|
|
7685
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7686
|
+
)`);
|
|
7687
|
+
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
7688
|
+
(
|
|
7689
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7690
|
+
"correlationId" varchar NOT NULL,
|
|
7691
|
+
"length" integer NOT NULL,
|
|
7692
|
+
"issuer" text NOT NULL,
|
|
7693
|
+
"type" varchar CHECK ( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7694
|
+
"driverType" varchar CHECK ( "driverType" IN ('agent_typeorm', 'agent_kv_store', 'github',
|
|
7695
|
+
'agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7696
|
+
"credentialIdMode" varchar CHECK ( "credentialIdMode" IN ('ISSUANCE', 'PERSISTENCE', 'NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7697
|
+
"proofFormat" varchar CHECK ( "proofFormat" IN ('lds', 'jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7698
|
+
"indexingDirection" varchar CHECK ( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
7699
|
+
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
7700
|
+
"statusListCredential" text,
|
|
7701
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7702
|
+
)`);
|
|
7703
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusListEntry"
|
|
7704
|
+
(
|
|
7705
|
+
"statusListId" varchar NOT NULL,
|
|
7706
|
+
"statusListIndex" integer NOT NULL,
|
|
7707
|
+
"credentialId" varchar,
|
|
7708
|
+
"credentialHash" varchar(128),
|
|
7709
|
+
"correlationId" varchar(255),
|
|
7710
|
+
"value" varchar(50),
|
|
7711
|
+
CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
7712
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
7713
|
+
)`);
|
|
7714
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusListEntry"("statusListId", "statusListIndex", "credentialId",
|
|
7715
|
+
"credentialHash", "correlationId", "value")
|
|
7716
|
+
SELECT "statusListId", "statusListIndex", "credentialId", "credentialHash", "correlationId", "value"
|
|
7717
|
+
FROM "StatusListEntry"`);
|
|
7718
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7719
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
7720
|
+
}
|
|
7721
|
+
async down(queryRunner) {
|
|
7722
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
7723
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7724
|
+
}
|
|
7725
|
+
};
|
|
7726
|
+
|
|
7727
|
+
// src/migrations/postgres/1737110469001-UpdateStatusList.ts
|
|
7728
|
+
var UpdateStatusList1737110469001 = class {
|
|
7729
|
+
static {
|
|
7730
|
+
__name(this, "UpdateStatusList1737110469001");
|
|
7731
|
+
}
|
|
7732
|
+
name = "UpdateStatusList1737110469001";
|
|
7733
|
+
async up(queryRunner) {
|
|
7734
|
+
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'OAuthStatusList'`);
|
|
7735
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" DROP NOT NULL`);
|
|
7736
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" DROP NOT NULL`);
|
|
7737
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer`);
|
|
7738
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "expiresAt" timestamp with time zone`);
|
|
7739
|
+
}
|
|
7740
|
+
async down(queryRunner) {
|
|
7741
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "expiresAt"`);
|
|
7742
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`);
|
|
7743
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" SET NOT NULL`);
|
|
7744
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" SET NOT NULL`);
|
|
7745
|
+
}
|
|
7746
|
+
};
|
|
7747
|
+
|
|
7748
|
+
// src/migrations/sqlite/1737110469000-UpdateStatusList.ts
|
|
7749
|
+
var UpdateStatusList1737110469000 = class {
|
|
7750
|
+
static {
|
|
7751
|
+
__name(this, "UpdateStatusList1737110469000");
|
|
7752
|
+
}
|
|
7753
|
+
name = "UpdateStatusList1737110469000";
|
|
7754
|
+
async up(queryRunner) {
|
|
7755
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusList" (
|
|
7756
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7757
|
+
"correlationId" varchar NOT NULL,
|
|
7758
|
+
"length" integer NOT NULL,
|
|
7759
|
+
"issuer" text NOT NULL,
|
|
7760
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7761
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7762
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7763
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7764
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
7765
|
+
"statusPurpose" varchar,
|
|
7766
|
+
"statusListCredential" text,
|
|
7767
|
+
"bitsPerStatus" integer,
|
|
7768
|
+
"expiresAt" datetime,
|
|
7769
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7770
|
+
)`);
|
|
7771
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
7772
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7773
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7774
|
+
"statusListCredential"
|
|
7775
|
+
)
|
|
7776
|
+
SELECT
|
|
7777
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7778
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7779
|
+
"statusListCredential"
|
|
7780
|
+
FROM "StatusList"`);
|
|
7781
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7782
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
7783
|
+
}
|
|
7784
|
+
async down(queryRunner) {
|
|
7785
|
+
await queryRunner.query(`
|
|
7786
|
+
ALTER TABLE "StatusListEntry"
|
|
7787
|
+
RENAME COLUMN "entryCorrelationId" TO "correlationId"
|
|
7788
|
+
`);
|
|
7789
|
+
await queryRunner.query(`
|
|
7790
|
+
ALTER TABLE "StatusListEntry"
|
|
7791
|
+
DROP COLUMN "statusListCorrelationId"
|
|
7792
|
+
`);
|
|
7793
|
+
await queryRunner.query(`CREATE TABLE "temporary_StatusList" (
|
|
7794
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7795
|
+
"correlationId" varchar NOT NULL,
|
|
7796
|
+
"length" integer NOT NULL,
|
|
7797
|
+
"issuer" text NOT NULL,
|
|
7798
|
+
"type" varchar CHECK( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
7799
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
7800
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
7801
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
7802
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
7803
|
+
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
7804
|
+
"statusListCredential" text,
|
|
7805
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
7806
|
+
)`);
|
|
7807
|
+
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
7808
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
7809
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
7810
|
+
"statusListCredential"
|
|
7811
|
+
)
|
|
7812
|
+
SELECT
|
|
7813
|
+
"id", "correlationId", "length", "issuer",
|
|
7814
|
+
CASE WHEN "type" = 'OAuthStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
7815
|
+
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
7816
|
+
COALESCE("statusPurpose", 'revocation'), "statusListCredential"
|
|
7817
|
+
FROM "StatusList"`);
|
|
7818
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
7819
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
7820
|
+
}
|
|
7821
|
+
};
|
|
7822
|
+
|
|
7823
|
+
// src/migrations/generic/4-CreateStatusList.ts
|
|
7824
|
+
var debug11 = Debug11("sphereon:ssi-sdk:migrations");
|
|
7825
|
+
var CreateStatusList1693866470000 = class {
|
|
7826
|
+
static {
|
|
7827
|
+
__name(this, "CreateStatusList1693866470000");
|
|
7828
|
+
}
|
|
7829
|
+
name = "CreateStatusList1693866470000";
|
|
7830
|
+
async up(queryRunner) {
|
|
7831
|
+
debug11("migration: creating issuance branding tables");
|
|
7832
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7833
|
+
if (dbType === "postgres") {
|
|
7834
|
+
debug11("using postgres migration files");
|
|
7835
|
+
const createMig = new CreateStatusList1693866470001();
|
|
7836
|
+
await createMig.up(queryRunner);
|
|
7837
|
+
const updateMig = new UpdateStatusList1737110469001();
|
|
7838
|
+
const up = await updateMig.up(queryRunner);
|
|
7839
|
+
debug11("Migration statements executed");
|
|
7840
|
+
return up;
|
|
7841
|
+
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
7842
|
+
debug11("using sqlite/react-native migration files");
|
|
7843
|
+
const createMig = new CreateStatusList1693866470002();
|
|
7844
|
+
await createMig.up(queryRunner);
|
|
7845
|
+
const updateMig = new UpdateStatusList1737110469000();
|
|
7846
|
+
const up = await updateMig.up(queryRunner);
|
|
7847
|
+
debug11("Migration statements executed");
|
|
7848
|
+
return up;
|
|
7849
|
+
} else {
|
|
7850
|
+
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`);
|
|
7754
7851
|
}
|
|
7755
7852
|
}
|
|
7756
7853
|
async down(queryRunner) {
|
|
7757
|
-
debug11("migration:
|
|
7854
|
+
debug11("migration: reverting issuance branding tables");
|
|
7758
7855
|
const dbType = queryRunner.connection.driver.options.type;
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7856
|
+
if (dbType === "postgres") {
|
|
7857
|
+
debug11("using postgres migration files");
|
|
7858
|
+
const updateMig = new UpdateStatusList1737110469001();
|
|
7859
|
+
await updateMig.down(queryRunner);
|
|
7860
|
+
const createMig = new CreateStatusList1693866470001();
|
|
7861
|
+
const down = await createMig.down(queryRunner);
|
|
7862
|
+
debug11("Migration statements executed");
|
|
7863
|
+
return down;
|
|
7864
|
+
} else if (dbType === "sqlite" || dbType === "react-native" || dbType === "expo") {
|
|
7865
|
+
debug11("using sqlite/react-native migration files");
|
|
7866
|
+
const updateMig = new UpdateStatusList1737110469000();
|
|
7867
|
+
await updateMig.down(queryRunner);
|
|
7868
|
+
const createMig = new CreateStatusList1693866470002();
|
|
7869
|
+
const down = await createMig.down(queryRunner);
|
|
7870
|
+
debug11("Migration statements executed");
|
|
7871
|
+
return down;
|
|
7872
|
+
} else {
|
|
7873
|
+
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`);
|
|
7774
7874
|
}
|
|
7775
7875
|
}
|
|
7776
7876
|
};
|
|
7777
7877
|
|
|
7778
|
-
// src/migrations/generic/
|
|
7878
|
+
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
7779
7879
|
import Debug12 from "debug";
|
|
7780
|
-
|
|
7781
|
-
|
|
7880
|
+
|
|
7881
|
+
// src/migrations/sqlite/1701634819487-CreateAuditEvents.ts
|
|
7882
|
+
var CreateAuditEvents1701634819487 = class {
|
|
7782
7883
|
static {
|
|
7783
|
-
__name(this, "
|
|
7884
|
+
__name(this, "CreateAuditEvents1701634819487");
|
|
7784
7885
|
}
|
|
7785
|
-
name = "
|
|
7886
|
+
name = "CreateAuditEvents1701634819487";
|
|
7786
7887
|
async up(queryRunner) {
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7888
|
+
await queryRunner.query(`CREATE TABLE "AuditEvents" (
|
|
7889
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
7890
|
+
"eventType" varchar CHECK( "eventType" IN ('audit','activity','general') ) NOT NULL,
|
|
7891
|
+
"timestamp" datetime NOT NULL,
|
|
7892
|
+
"level" varchar CHECK( "level" IN ('0','1','2','3','4') ) NOT NULL,
|
|
7893
|
+
"correlationId" varchar NOT NULL,
|
|
7894
|
+
"system" varchar CHECK( "system" IN ('general','kms','identity','oid4vci','oid4vp','siopv2','PE','credentials','web3','profile','contact') ) NOT NULL,
|
|
7895
|
+
"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,
|
|
7896
|
+
"actionType" varchar CHECK( "actionType" IN ('create','read','update','delete','execute') ) NOT NULL,
|
|
7897
|
+
"actionSubType" varchar NOT NULL,
|
|
7898
|
+
"initiatorType" varchar CHECK( "initiatorType" IN ('user','system','external') ) NOT NULL,
|
|
7899
|
+
"systemCorrelationIdType" varchar CHECK( "systemCorrelationIdType" IN ('did','url','email','hostname','phone','user') ),
|
|
7900
|
+
"systemCorrelationId" varchar,
|
|
7901
|
+
"systemAlias" varchar,
|
|
7902
|
+
"partyCorrelationType" varchar CHECK( "partyCorrelationType" IN ('did','url','email','hostname','phone') ),
|
|
7903
|
+
"partyCorrelationId" varchar,
|
|
7904
|
+
"partyAlias" varchar,
|
|
7905
|
+
"credentialType" varchar CHECK( "credentialType" IN ('JSON_LD','JWT','SD_JWT','MSO_MDOC') ),
|
|
7906
|
+
"credentialHash" varchar,
|
|
7907
|
+
"parentCredentialHash" varchar,
|
|
7908
|
+
"originalCredential" varchar,
|
|
7909
|
+
"sharePurpose" varchar,
|
|
7910
|
+
"description" varchar NOT NULL,
|
|
7911
|
+
"data" varchar,
|
|
7912
|
+
"diagnosticData" varchar,
|
|
7913
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
7914
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
7809
7915
|
}
|
|
7810
7916
|
async down(queryRunner) {
|
|
7811
|
-
|
|
7812
|
-
const dbType = queryRunner.connection.driver.options.type;
|
|
7813
|
-
switch (dbType) {
|
|
7814
|
-
case "postgres": {
|
|
7815
|
-
debug12("using postgres migration file");
|
|
7816
|
-
const mig = new CreateIssuanceBranding1685628974232();
|
|
7817
|
-
await mig.down(queryRunner);
|
|
7818
|
-
debug12("Migration statements executed");
|
|
7819
|
-
return;
|
|
7820
|
-
}
|
|
7821
|
-
case "sqlite":
|
|
7822
|
-
case "expo":
|
|
7823
|
-
case "react-native": {
|
|
7824
|
-
debug12("using sqlite/react-native migration file");
|
|
7825
|
-
const mig = new CreateIssuanceBranding1685628973231();
|
|
7826
|
-
await mig.down(queryRunner);
|
|
7827
|
-
debug12("Migration statements executed");
|
|
7828
|
-
return;
|
|
7829
|
-
}
|
|
7830
|
-
default:
|
|
7831
|
-
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`);
|
|
7832
|
-
}
|
|
7917
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`);
|
|
7833
7918
|
}
|
|
7834
7919
|
};
|
|
7835
7920
|
|
|
7836
|
-
// src/migrations/
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
// src/migrations/sqlite/1690925872693-CreateContacts.ts
|
|
7840
|
-
var CreateContacts1690925872693 = class {
|
|
7921
|
+
// src/migrations/postgres/1701634812183-CreateAuditEvents.ts
|
|
7922
|
+
var CreateAuditEvents1701634812183 = class {
|
|
7841
7923
|
static {
|
|
7842
|
-
__name(this, "
|
|
7924
|
+
__name(this, "CreateAuditEvents1701634812183");
|
|
7843
7925
|
}
|
|
7844
|
-
name = "
|
|
7926
|
+
name = "CreateAuditEvents1701634812183";
|
|
7845
7927
|
async up(queryRunner) {
|
|
7846
|
-
await queryRunner.query(`CREATE
|
|
7847
|
-
await queryRunner.query(`
|
|
7848
|
-
await queryRunner.query(`
|
|
7849
|
-
await queryRunner.query(`
|
|
7850
|
-
await queryRunner.query(`CREATE
|
|
7851
|
-
await queryRunner.query(`
|
|
7852
|
-
await queryRunner.query(`
|
|
7853
|
-
await queryRunner.query(`
|
|
7854
|
-
await queryRunner.query(`CREATE
|
|
7855
|
-
await queryRunner.query(`
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
await queryRunner.query(`ALTER TABLE "temporary_CorrelationIdentifier" RENAME TO "CorrelationIdentifier"`);
|
|
7883
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7884
|
-
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)`);
|
|
7885
|
-
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"`);
|
|
7886
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7887
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7888
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7889
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7890
|
-
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)`);
|
|
7891
|
-
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"`);
|
|
7892
|
-
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7893
|
-
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7894
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7895
|
-
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)`);
|
|
7896
|
-
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)`);
|
|
7897
|
-
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)`);
|
|
7898
|
-
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"`);
|
|
7899
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7900
|
-
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7901
|
-
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)`);
|
|
7902
|
-
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"`);
|
|
7903
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7904
|
-
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
7905
|
-
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)`);
|
|
7906
|
-
await queryRunner.query(`INSERT INTO "temporary_Connection"("id", "type", "identity_id") SELECT "id", "type", "identity_id" FROM "Connection"`);
|
|
7907
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7908
|
-
await queryRunner.query(`ALTER TABLE "temporary_Connection" RENAME TO "Connection"`);
|
|
7909
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7910
|
-
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)`);
|
|
7911
|
-
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"`);
|
|
7912
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7913
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7914
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7915
|
-
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"`);
|
|
7916
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
7917
|
-
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'))`);
|
|
7918
|
-
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'))`);
|
|
7919
|
-
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"`);
|
|
7920
|
-
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"`);
|
|
7921
|
-
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7928
|
+
await queryRunner.query(`CREATE TYPE "public"."Level_enum" AS ENUM('0', '1', '2', '3', '4')`);
|
|
7929
|
+
await queryRunner.query(`CREATE TYPE "public"."System_enum" AS ENUM('general', 'kms', 'identity', 'oid4vci', 'oid4vp', 'siopv2', 'PE', 'credentials', 'web3', 'profile', 'contact')`);
|
|
7930
|
+
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')`);
|
|
7931
|
+
await queryRunner.query(`CREATE TYPE "public"."Action_type_enum" AS ENUM('create', 'read', 'update', 'delete', 'execute')`);
|
|
7932
|
+
await queryRunner.query(`CREATE TYPE "public"."Initiator_type_enum" AS ENUM('user', 'system', 'external')`);
|
|
7933
|
+
await queryRunner.query(`CREATE TYPE "public"."System_correlation_id_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone', 'user')`);
|
|
7934
|
+
await queryRunner.query(`CREATE TYPE "public"."Party_correlation_type_enum" AS ENUM('did', 'url', 'email', 'hostname', 'phone')`);
|
|
7935
|
+
await queryRunner.query(`CREATE TYPE "public"."Event_type_enum" AS ENUM('audit', 'activity', 'general')`);
|
|
7936
|
+
await queryRunner.query(`CREATE TYPE "public"."Event_credential_type_enum" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`);
|
|
7937
|
+
await queryRunner.query(`CREATE TABLE "AuditEvents" (
|
|
7938
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
7939
|
+
"eventType" "public"."Event_type_enum" NOT NULL,
|
|
7940
|
+
"timestamp" TIMESTAMP NOT NULL,
|
|
7941
|
+
"level" "public"."Level_enum" NOT NULL,
|
|
7942
|
+
"correlationId" TEXT NOT NULL,
|
|
7943
|
+
"system" "public"."System_enum" NOT NULL,
|
|
7944
|
+
"subSystemType" "public"."Subsystem_type_enum" NOT NULL,
|
|
7945
|
+
"actionType" "public"."Action_type_enum" NOT NULL,
|
|
7946
|
+
"actionSubType" TEXT NOT NULL,
|
|
7947
|
+
"initiatorType" "public"."Initiator_type_enum" NOT NULL,
|
|
7948
|
+
"systemCorrelationIdType" "public"."System_correlation_id_type_enum",
|
|
7949
|
+
"systemCorrelationId" TEXT,
|
|
7950
|
+
"systemAlias" TEXT,
|
|
7951
|
+
"partyCorrelationType" "public"."Party_correlation_type_enum",
|
|
7952
|
+
"partyCorrelationId" TEXT,
|
|
7953
|
+
"partyAlias" TEXT,
|
|
7954
|
+
"credentialType" "public"."Event_credential_type_enum",
|
|
7955
|
+
"credentialHash" TEXT,
|
|
7956
|
+
"originalCredential" TEXT,
|
|
7957
|
+
"sharePurpose" TEXT,
|
|
7958
|
+
"description" TEXT NOT NULL,
|
|
7959
|
+
"data" TEXT,
|
|
7960
|
+
"diagnosticData" TEXT,
|
|
7961
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7962
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
7963
|
+
CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`);
|
|
7922
7964
|
}
|
|
7923
7965
|
async down(queryRunner) {
|
|
7924
|
-
await queryRunner.query(`
|
|
7925
|
-
await queryRunner.query(`
|
|
7926
|
-
await queryRunner.query(`DROP
|
|
7927
|
-
await queryRunner.query(`DROP
|
|
7928
|
-
await queryRunner.query(`
|
|
7929
|
-
await queryRunner.query(`
|
|
7930
|
-
await queryRunner.query(`DROP
|
|
7931
|
-
await queryRunner.query(`
|
|
7932
|
-
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"`);
|
|
7933
|
-
await queryRunner.query(`DROP TABLE "Party"`);
|
|
7934
|
-
await queryRunner.query(`ALTER TABLE "temporary_Party" RENAME TO "Party"`);
|
|
7935
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyRelationship_left_right"`);
|
|
7936
|
-
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)`);
|
|
7937
|
-
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"`);
|
|
7938
|
-
await queryRunner.query(`DROP TABLE "PartyRelationship"`);
|
|
7939
|
-
await queryRunner.query(`ALTER TABLE "temporary_PartyRelationship" RENAME TO "PartyRelationship"`);
|
|
7940
|
-
await queryRunner.query(`CREATE UNIQUE INDEX "IDX_PartyRelationship_left_right" ON "PartyRelationship" ("left_id", "right_id")`);
|
|
7941
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseContact_type"`);
|
|
7942
|
-
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)`);
|
|
7943
|
-
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"`);
|
|
7944
|
-
await queryRunner.query(`DROP TABLE "BaseContact"`);
|
|
7945
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseContact" RENAME TO "BaseContact"`);
|
|
7946
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseContact_type" ON "BaseContact" ("type")`);
|
|
7947
|
-
await queryRunner.query(`DROP INDEX "IDX_BaseConfig_type"`);
|
|
7948
|
-
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)`);
|
|
7949
|
-
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"`);
|
|
7950
|
-
await queryRunner.query(`DROP TABLE "BaseConfig"`);
|
|
7951
|
-
await queryRunner.query(`ALTER TABLE "temporary_BaseConfig" RENAME TO "BaseConfig"`);
|
|
7952
|
-
await queryRunner.query(`CREATE INDEX "IDX_BaseConfig_type" ON "BaseConfig" ("type")`);
|
|
7953
|
-
await queryRunner.query(`DROP INDEX "IDX_PartyType_type_tenant_id"`);
|
|
7954
|
-
await queryRunner.query(`DROP TABLE "PartyType"`);
|
|
7955
|
-
await queryRunner.query(`DROP TABLE "Connection"`);
|
|
7956
|
-
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
7957
|
-
await queryRunner.query(`DROP TABLE "CorrelationIdentifier"`);
|
|
7958
|
-
await queryRunner.query(`DROP TABLE "ElectronicAddress"`);
|
|
7959
|
-
await queryRunner.query(`DROP TABLE "PhysicalAddress"`);
|
|
7966
|
+
await queryRunner.query(`DROP TABLE "AuditEvents"`);
|
|
7967
|
+
await queryRunner.query(`DROP TYPE "public"."Party_correlation_type_enum"`);
|
|
7968
|
+
await queryRunner.query(`DROP TYPE "public"."System_correlation_id_type_enum"`);
|
|
7969
|
+
await queryRunner.query(`DROP TYPE "public"."Initiator_type_enum"`);
|
|
7970
|
+
await queryRunner.query(`DROP TYPE "public"."Action_type_enum"`);
|
|
7971
|
+
await queryRunner.query(`DROP TYPE "public"."Subsystem_type_enum"`);
|
|
7972
|
+
await queryRunner.query(`DROP TYPE "public"."System_enum"`);
|
|
7973
|
+
await queryRunner.query(`DROP TYPE "public"."Level_enum"`);
|
|
7960
7974
|
}
|
|
7961
7975
|
};
|
|
7962
7976
|
|
|
7963
|
-
// src/migrations/
|
|
7964
|
-
|
|
7965
|
-
var
|
|
7977
|
+
// src/migrations/generic/5-CreateAuditEvents.ts
|
|
7978
|
+
var debug12 = Debug12("sphereon:ssi-sdk:migrations");
|
|
7979
|
+
var CreateAuditEvents1701635835330 = class {
|
|
7966
7980
|
static {
|
|
7967
|
-
__name(this, "
|
|
7981
|
+
__name(this, "CreateAuditEvents1701635835330");
|
|
7968
7982
|
}
|
|
7969
|
-
name = "
|
|
7983
|
+
name = "CreateAuditEvents1701635835330";
|
|
7970
7984
|
async up(queryRunner) {
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
await queryRunner.query(`CREATE TYPE "public"."IdentityOrigin_type_enum" AS ENUM('INTERNAL', 'EXTERNAL')`);
|
|
7994
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "origin" "public"."IdentityOrigin_type_enum" DEFAULT 'EXTERNAL' NOT NULL`);
|
|
7995
|
-
await queryRunner.query(`ALTER TABLE "Identity" ALTER COLUMN "origin" DROP DEFAULT`);
|
|
7996
|
-
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`);
|
|
7997
|
-
await queryRunner.query(`ALTER TABLE "IdentityMetadata" ADD CONSTRAINT "FK_IdentityMetadata_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
7998
|
-
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`);
|
|
7999
|
-
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`);
|
|
8000
|
-
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`);
|
|
8001
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD CONSTRAINT "FK_ElectronicAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8002
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD CONSTRAINT "FK_PhysicalAddress_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8003
|
-
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`);
|
|
8004
|
-
await queryRunner.query(`ALTER TABLE "Identity" ADD CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
|
8005
|
-
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`);
|
|
8006
|
-
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`);
|
|
8007
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" RENAME CONSTRAINT "UQ_Correlation_id" TO "UQ_CorrelationIdentifier_correlation_id"`);
|
|
8008
|
-
await queryRunner.query(`ALTER TABLE "Identity" RENAME CONSTRAINT "UQ_Identity_Alias" TO "UQ_Identity_alias"`);
|
|
8009
|
-
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"`);
|
|
8010
|
-
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`);
|
|
8011
|
-
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())`);
|
|
8012
|
-
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())`);
|
|
8013
|
-
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"`);
|
|
8014
|
-
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"`);
|
|
8015
|
-
await queryRunner.query(`DROP TABLE "Contact"`);
|
|
7985
|
+
debug12("migration: creating audit events tables");
|
|
7986
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
7987
|
+
switch (dbType) {
|
|
7988
|
+
case "postgres": {
|
|
7989
|
+
debug12("using postgres migration file");
|
|
7990
|
+
const mig = new CreateAuditEvents1701634812183();
|
|
7991
|
+
await mig.up(queryRunner);
|
|
7992
|
+
debug12("Migration statements executed");
|
|
7993
|
+
return;
|
|
7994
|
+
}
|
|
7995
|
+
case "sqlite":
|
|
7996
|
+
case "expo":
|
|
7997
|
+
case "react-native": {
|
|
7998
|
+
debug12("using sqlite/react-native migration file");
|
|
7999
|
+
const mig = new CreateAuditEvents1701634819487();
|
|
8000
|
+
await mig.up(queryRunner);
|
|
8001
|
+
debug12("Migration statements executed");
|
|
8002
|
+
return;
|
|
8003
|
+
}
|
|
8004
|
+
default:
|
|
8005
|
+
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`);
|
|
8006
|
+
}
|
|
8016
8007
|
}
|
|
8017
8008
|
async down(queryRunner) {
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
await queryRunner.query(`
|
|
8009
|
+
debug12("migration: reverting audit events tables");
|
|
8010
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
8011
|
+
switch (dbType) {
|
|
8012
|
+
case "postgres": {
|
|
8013
|
+
debug12("using postgres migration file");
|
|
8014
|
+
const mig = new CreateAuditEvents1701634812183();
|
|
8015
|
+
await mig.down(queryRunner);
|
|
8016
|
+
debug12("Migration statements executed");
|
|
8017
|
+
return;
|
|
8018
|
+
}
|
|
8019
|
+
case "sqlite":
|
|
8020
|
+
case "expo":
|
|
8021
|
+
case "react-native": {
|
|
8022
|
+
debug12("using sqlite/react-native migration file");
|
|
8023
|
+
const mig = new CreateAuditEvents1701634819487();
|
|
8024
|
+
await mig.down(queryRunner);
|
|
8025
|
+
debug12("Migration statements executed");
|
|
8026
|
+
return;
|
|
8027
|
+
}
|
|
8028
|
+
default:
|
|
8029
|
+
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`);
|
|
8030
|
+
}
|
|
8031
|
+
}
|
|
8032
|
+
};
|
|
8033
|
+
|
|
8034
|
+
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8035
|
+
import Debug13 from "debug";
|
|
8036
|
+
|
|
8037
|
+
// src/migrations/postgres/1708525189001-CreateDigitalCredential.ts
|
|
8038
|
+
var CreateDigitalCredential1708525189001 = class {
|
|
8039
|
+
static {
|
|
8040
|
+
__name(this, "CreateDigitalCredential1708525189001");
|
|
8041
|
+
}
|
|
8042
|
+
name = "CreateDigitalCredential1708525189001";
|
|
8043
|
+
async up(queryRunner) {
|
|
8044
|
+
await queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`);
|
|
8045
|
+
await queryRunner.query(`CREATE TYPE "digital_regulation_type" AS ENUM('PID', 'QEAA', 'EAA', 'NON_REGULATED')`);
|
|
8046
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC')`);
|
|
8047
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_credential_role" AS ENUM('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR')`);
|
|
8048
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID', 'KID', 'URL', 'X509_SAN')`);
|
|
8049
|
+
await queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`);
|
|
8050
|
+
await queryRunner.query(`
|
|
8051
|
+
CREATE TABLE "DigitalCredential" (
|
|
8052
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
8053
|
+
"parent_id" text,
|
|
8054
|
+
"document_type" "digital_document_type" NOT NULL,
|
|
8055
|
+
"regulation_type" "digital_regulation_type" NOT NULL DEFAULT 'NON_REGULATED'::"digital_regulation_type",
|
|
8056
|
+
"document_format" "digital_credential_document_format" NOT NULL,
|
|
8057
|
+
"credential_role" "digital_credential_credential_role" NOT NULL,
|
|
8058
|
+
"raw_document" text NOT NULL,
|
|
8059
|
+
"uniform_document" text NOT NULL,
|
|
8060
|
+
"credential_id" text,
|
|
8061
|
+
"hash" text NOT NULL,
|
|
8062
|
+
"kms_key_ref" text,
|
|
8063
|
+
"identifier_method" text,
|
|
8064
|
+
"issuer_correlation_type" "digital_credential_correlation_type" NOT NULL,
|
|
8065
|
+
"subject_correlation_type" "digital_credential_correlation_type",
|
|
8066
|
+
"issuer_correlation_id" text NOT NULL,
|
|
8067
|
+
"subject_correlation_id" text,
|
|
8068
|
+
"verified_state" "digital_credential_state_type",
|
|
8069
|
+
"issuer_signed" boolean,
|
|
8070
|
+
"rp_correlation_id" text,
|
|
8071
|
+
"rp_correlation_type" "digital_credential_correlation_type",
|
|
8072
|
+
"tenant_id" text,
|
|
8073
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8074
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8075
|
+
"presented_at" DATE,
|
|
8076
|
+
"valid_from" DATE,
|
|
8077
|
+
"valid_until" DATE,
|
|
8078
|
+
"verified_at" DATE,
|
|
8079
|
+
"revoked_at" DATE,
|
|
8080
|
+
PRIMARY KEY ("id"),
|
|
8081
|
+
UNIQUE ("hash", "credential_role")
|
|
8082
|
+
)
|
|
8083
|
+
`);
|
|
8084
|
+
}
|
|
8085
|
+
async down(queryRunner) {
|
|
8086
|
+
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8087
|
+
await queryRunner.query(`DROP TYPE "digital_credential_state_type"`);
|
|
8088
|
+
await queryRunner.query(`DROP TYPE "digital_credential_correlation_type"`);
|
|
8089
|
+
await queryRunner.query(`DROP TYPE "digital_credential_document_format"`);
|
|
8090
|
+
await queryRunner.query(`DROP TYPE "digital_credential_credential_role"`);
|
|
8091
|
+
await queryRunner.query(`DROP TYPE "digital_regulation_type"`);
|
|
8092
|
+
await queryRunner.query(`DROP TYPE "digital_document_type"`);
|
|
8093
|
+
}
|
|
8094
|
+
};
|
|
8095
|
+
|
|
8096
|
+
// src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts
|
|
8097
|
+
var CreateDigitalCredential1708525189002 = class {
|
|
8098
|
+
static {
|
|
8099
|
+
__name(this, "CreateDigitalCredential1708525189002");
|
|
8100
|
+
}
|
|
8101
|
+
name = "CreateDigitalCredential1708525189002";
|
|
8102
|
+
async up(queryRunner) {
|
|
8103
|
+
await queryRunner.query(`
|
|
8104
|
+
CREATE TABLE "DigitalCredential" (
|
|
8105
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8106
|
+
"parent_id" text,
|
|
8107
|
+
"document_type" varchar CHECK( "document_type" IN ('VC', 'VP', 'C', 'P') ) NOT NULL,
|
|
8108
|
+
"regulation_type" varchar CHECK( "regulation_type" IN ('PID', 'QEAA', 'EAA', 'NON_REGULATED') ) NOT NULL DEFAULT 'NON_REGULATED',
|
|
8109
|
+
"document_format" varchar CHECK( "document_format" IN ('JSON_LD', 'JWT', 'SD_JWT', 'MSO_MDOC') ) NOT NULL,
|
|
8110
|
+
"credential_role" varchar CHECK( "credential_role" IN ('ISSUER', 'VERIFIER', 'HOLDER', 'FEDERATION_TRUST_ANCHOR') ) NOT NULL,
|
|
8111
|
+
"raw_document" text NOT NULL,
|
|
8112
|
+
"uniform_document" text NOT NULL,
|
|
8113
|
+
"credential_id" text,
|
|
8114
|
+
"hash" text NOT NULL,
|
|
8115
|
+
"kms_key_ref" text,
|
|
8116
|
+
"identifier_method" text,
|
|
8117
|
+
"issuer_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ) NOT NULL,
|
|
8118
|
+
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8119
|
+
"issuer_correlation_id" text NOT NULL,
|
|
8120
|
+
"subject_correlation_id" text,
|
|
8121
|
+
"issuer_signed" boolean,
|
|
8122
|
+
"rp_correlation_id" text,
|
|
8123
|
+
"rp_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8124
|
+
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
8125
|
+
"tenant_id" text,
|
|
8126
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8127
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8128
|
+
"presented_at" datetime,
|
|
8129
|
+
"valid_from" datetime,
|
|
8130
|
+
"valid_until" datetime,
|
|
8131
|
+
"verified_at" datetime,
|
|
8132
|
+
"revoked_at" datetime,
|
|
8133
|
+
UNIQUE ("hash", "credential_role")
|
|
8134
|
+
)
|
|
8135
|
+
`);
|
|
8136
|
+
}
|
|
8137
|
+
async down(queryRunner) {
|
|
8138
|
+
await queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
8054
8139
|
}
|
|
8055
8140
|
};
|
|
8056
8141
|
|
|
8057
|
-
// src/migrations/generic/
|
|
8142
|
+
// src/migrations/generic/6-CreateDigitalCredential.ts
|
|
8058
8143
|
var debug13 = Debug13("sphereon:ssi-sdk:migrations");
|
|
8059
|
-
var
|
|
8144
|
+
var CreateDigitalCredential1708525189000 = class {
|
|
8060
8145
|
static {
|
|
8061
|
-
__name(this, "
|
|
8146
|
+
__name(this, "CreateDigitalCredential1708525189000");
|
|
8062
8147
|
}
|
|
8063
|
-
name = "
|
|
8148
|
+
name = "CreateDigitalCredential1708525189000";
|
|
8064
8149
|
async up(queryRunner) {
|
|
8065
|
-
debug13("migration: creating
|
|
8150
|
+
debug13("migration: creating DigitalCredential tables");
|
|
8066
8151
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8067
8152
|
switch (dbType) {
|
|
8068
8153
|
case "postgres": {
|
|
8069
|
-
debug13("using postgres migration file");
|
|
8070
|
-
const mig = new
|
|
8154
|
+
debug13("using postgres migration file for DigitalCredential");
|
|
8155
|
+
const mig = new CreateDigitalCredential1708525189001();
|
|
8071
8156
|
await mig.up(queryRunner);
|
|
8072
|
-
debug13("Migration statements executed");
|
|
8157
|
+
debug13("Postgres Migration statements for DigitalCredential executed");
|
|
8073
8158
|
return;
|
|
8074
8159
|
}
|
|
8075
8160
|
case "sqlite":
|
|
8076
8161
|
case "expo":
|
|
8077
8162
|
case "react-native": {
|
|
8078
|
-
debug13("using sqlite/react-native migration file");
|
|
8079
|
-
const mig = new
|
|
8163
|
+
debug13("using sqlite/react-native migration file for DigitalCredential");
|
|
8164
|
+
const mig = new CreateDigitalCredential1708525189002();
|
|
8080
8165
|
await mig.up(queryRunner);
|
|
8081
|
-
debug13("Migration statements executed");
|
|
8166
|
+
debug13("SQLite Migration statements for DigitalCredential executed");
|
|
8082
8167
|
return;
|
|
8083
8168
|
}
|
|
8084
8169
|
default:
|
|
8085
|
-
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`);
|
|
8170
|
+
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`);
|
|
8086
8171
|
}
|
|
8087
8172
|
}
|
|
8088
8173
|
async down(queryRunner) {
|
|
8089
|
-
debug13("migration: reverting
|
|
8174
|
+
debug13("migration: reverting DigitalCredential tables");
|
|
8090
8175
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8091
8176
|
switch (dbType) {
|
|
8092
8177
|
case "postgres": {
|
|
8093
|
-
debug13("using postgres migration file");
|
|
8094
|
-
const mig = new
|
|
8178
|
+
debug13("using postgres migration file for DigitalCredential");
|
|
8179
|
+
const mig = new CreateDigitalCredential1708525189001();
|
|
8095
8180
|
await mig.down(queryRunner);
|
|
8096
|
-
debug13("Migration statements
|
|
8181
|
+
debug13("Postgres Migration statements for DigitalCredential reverted");
|
|
8097
8182
|
return;
|
|
8098
8183
|
}
|
|
8099
8184
|
case "sqlite":
|
|
8100
8185
|
case "expo":
|
|
8101
8186
|
case "react-native": {
|
|
8102
|
-
debug13("using sqlite/react-native migration file");
|
|
8103
|
-
const mig = new
|
|
8187
|
+
debug13("using sqlite/react-native migration file for DigitalCredential");
|
|
8188
|
+
const mig = new CreateDigitalCredential1708525189002();
|
|
8104
8189
|
await mig.down(queryRunner);
|
|
8105
|
-
debug13("Migration statements
|
|
8190
|
+
debug13("SQLite Migration statements for DigitalCredential reverted");
|
|
8106
8191
|
return;
|
|
8107
8192
|
}
|
|
8108
8193
|
default:
|
|
8109
|
-
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`);
|
|
8194
|
+
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`);
|
|
8110
8195
|
}
|
|
8111
8196
|
}
|
|
8112
8197
|
};
|
|
8113
8198
|
|
|
8114
|
-
// src/migrations/generic/
|
|
8199
|
+
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
8115
8200
|
import Debug14 from "debug";
|
|
8116
8201
|
|
|
8117
|
-
// src/migrations/postgres/
|
|
8118
|
-
var
|
|
8119
|
-
static {
|
|
8120
|
-
__name(this, "CreateStatusList1693866470001");
|
|
8121
|
-
}
|
|
8122
|
-
name = "CreateStatusList1693866470001";
|
|
8123
|
-
async up(queryRunner) {
|
|
8124
|
-
await queryRunner.query(`CREATE TYPE "StatusList_type_enum" AS ENUM('StatusList2021')`);
|
|
8125
|
-
await queryRunner.query(`CREATE TYPE "StatusList_drivertype_enum" AS ENUM('agent_typeorm', 'agent_kv_store', 'github', 'agent_filesystem')`);
|
|
8126
|
-
await queryRunner.query(`CREATE TYPE "StatusList_credentialidmode_enum" AS ENUM('ISSUANCE', 'PERSISTENCE', 'NEVER')`);
|
|
8127
|
-
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
8128
|
-
(
|
|
8129
|
-
"statusListId" character varying NOT NULL,
|
|
8130
|
-
"statusListIndex" integer NOT NULL,
|
|
8131
|
-
"credentialId" character varying,
|
|
8132
|
-
"credentialHash" character varying(128),
|
|
8133
|
-
"correlationId" character varying(255),
|
|
8134
|
-
"value" character varying(50),
|
|
8135
|
-
CONSTRAINT "PK_68704d2d13857360c6b44a3d1d0" PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8136
|
-
)`);
|
|
8137
|
-
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
8138
|
-
(
|
|
8139
|
-
"id" character varying NOT NULL,
|
|
8140
|
-
"correlationId" character varying NOT NULL,
|
|
8141
|
-
"length" integer NOT NULL,
|
|
8142
|
-
"issuer" text NOT NULL,
|
|
8143
|
-
"type" "StatusList_type_enum" NOT NULL DEFAULT 'StatusList2021',
|
|
8144
|
-
"driverType" "StatusList_drivertype_enum" NOT NULL DEFAULT 'agent_typeorm',
|
|
8145
|
-
"credentialIdMode" "StatusList_credentialidmode_enum" NOT NULL DEFAULT 'ISSUANCE',
|
|
8146
|
-
"proofFormat" character varying NOT NULL DEFAULT 'lds',
|
|
8147
|
-
"indexingDirection" character varying NOT NULL DEFAULT 'rightToLeft',
|
|
8148
|
-
"statusPurpose" character varying NOT NULL DEFAULT 'revocation',
|
|
8149
|
-
"statusListCredential" text,
|
|
8150
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId"),
|
|
8151
|
-
CONSTRAINT "PK_StatusList_Id" PRIMARY KEY ("id")
|
|
8152
|
-
)`);
|
|
8153
|
-
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
8154
|
-
ADD CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
8155
|
-
}
|
|
8156
|
-
async down(queryRunner) {
|
|
8157
|
-
await queryRunner.query(`ALTER TABLE "StatusListEntry"
|
|
8158
|
-
DROP CONSTRAINT "FK_statusListEntry_statusListId"`);
|
|
8159
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8160
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8161
|
-
await queryRunner.query(`DROP TYPE "StatusList_credentialidmode_enum"`);
|
|
8162
|
-
await queryRunner.query(`DROP TYPE "StatusList_drivertype_enum"`);
|
|
8163
|
-
await queryRunner.query(`DROP TYPE "StatusList_type_enum"`);
|
|
8164
|
-
}
|
|
8165
|
-
};
|
|
8166
|
-
|
|
8167
|
-
// src/migrations/sqlite/1693866470000-CreateStatusList.ts
|
|
8168
|
-
var CreateStatusList1693866470002 = class {
|
|
8169
|
-
static {
|
|
8170
|
-
__name(this, "CreateStatusList1693866470002");
|
|
8171
|
-
}
|
|
8172
|
-
name = "CreateStatusList1693866470002";
|
|
8173
|
-
async up(queryRunner) {
|
|
8174
|
-
await queryRunner.query(`CREATE TABLE "StatusListEntry"
|
|
8175
|
-
(
|
|
8176
|
-
"statusListId" varchar NOT NULL,
|
|
8177
|
-
"statusListIndex" integer NOT NULL,
|
|
8178
|
-
"credentialId" varchar,
|
|
8179
|
-
"credentialHash" varchar(128),
|
|
8180
|
-
"correlationId" varchar(255),
|
|
8181
|
-
"value" varchar(50),
|
|
8182
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8183
|
-
)`);
|
|
8184
|
-
await queryRunner.query(`CREATE TABLE "StatusList"
|
|
8185
|
-
(
|
|
8186
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
8187
|
-
"correlationId" varchar NOT NULL,
|
|
8188
|
-
"length" integer NOT NULL,
|
|
8189
|
-
"issuer" text NOT NULL,
|
|
8190
|
-
"type" varchar CHECK ( "type" IN ('StatusList2021') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8191
|
-
"driverType" varchar CHECK ( "driverType" IN ('agent_typeorm', 'agent_kv_store', 'github',
|
|
8192
|
-
'agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8193
|
-
"credentialIdMode" varchar CHECK ( "credentialIdMode" IN ('ISSUANCE', 'PERSISTENCE', 'NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8194
|
-
"proofFormat" varchar CHECK ( "proofFormat" IN ('lds', 'jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8195
|
-
"indexingDirection" varchar CHECK ( "indexingDirection" IN ('rightToLeft') ) NOT NULL DEFAULT ('rightToLeft'),
|
|
8196
|
-
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
8197
|
-
"statusListCredential" text,
|
|
8198
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8199
|
-
)`);
|
|
8200
|
-
await queryRunner.query(`CREATE TABLE "temporary_StatusListEntry"
|
|
8201
|
-
(
|
|
8202
|
-
"statusListId" varchar NOT NULL,
|
|
8203
|
-
"statusListIndex" integer NOT NULL,
|
|
8204
|
-
"credentialId" varchar,
|
|
8205
|
-
"credentialHash" varchar(128),
|
|
8206
|
-
"correlationId" varchar(255),
|
|
8207
|
-
"value" varchar(50),
|
|
8208
|
-
CONSTRAINT "FK_statusListEntry_statusListId" FOREIGN KEY ("statusListId") REFERENCES "StatusList" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
8209
|
-
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8210
|
-
)`);
|
|
8211
|
-
await queryRunner.query(`INSERT INTO "temporary_StatusListEntry"("statusListId", "statusListIndex", "credentialId",
|
|
8212
|
-
"credentialHash", "correlationId", "value")
|
|
8213
|
-
SELECT "statusListId", "statusListIndex", "credentialId", "credentialHash", "correlationId", "value"
|
|
8214
|
-
FROM "StatusListEntry"`);
|
|
8215
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8216
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
8217
|
-
}
|
|
8218
|
-
async down(queryRunner) {
|
|
8219
|
-
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
8220
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8221
|
-
}
|
|
8222
|
-
};
|
|
8223
|
-
|
|
8224
|
-
// src/migrations/postgres/1737110469001-UpdateStatusList.ts
|
|
8225
|
-
var UpdateStatusList1737110469001 = class {
|
|
8202
|
+
// src/migrations/postgres/1708797018115-CreateMachineStateStore.ts
|
|
8203
|
+
var CreateMachineStateStore1708797018115 = class {
|
|
8226
8204
|
static {
|
|
8227
|
-
__name(this, "
|
|
8205
|
+
__name(this, "CreateMachineStateStore1708797018115");
|
|
8228
8206
|
}
|
|
8229
|
-
name = "
|
|
8207
|
+
name = "CreateMachineStateStore1708797018115";
|
|
8230
8208
|
async up(queryRunner) {
|
|
8231
|
-
await queryRunner.query(`
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8209
|
+
await queryRunner.query(`
|
|
8210
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
8211
|
+
"instance_id" text NOT NULL,
|
|
8212
|
+
"session_id" text,
|
|
8213
|
+
"latest_state_name" text,
|
|
8214
|
+
"machine_name" text NOT NULL,
|
|
8215
|
+
"latest_event_type" text NOT NULL,
|
|
8216
|
+
"state" text NOT NULL,
|
|
8217
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8218
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8219
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
8220
|
+
"expires_at" TIMESTAMP,
|
|
8221
|
+
"completed_at" TIMESTAMP,
|
|
8222
|
+
"tenant_id" text,
|
|
8223
|
+
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
8224
|
+
)
|
|
8225
|
+
`);
|
|
8236
8226
|
}
|
|
8237
8227
|
async down(queryRunner) {
|
|
8238
|
-
await queryRunner.query(`
|
|
8239
|
-
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`);
|
|
8240
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" SET NOT NULL`);
|
|
8241
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" SET NOT NULL`);
|
|
8228
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`);
|
|
8242
8229
|
}
|
|
8243
8230
|
};
|
|
8244
8231
|
|
|
8245
|
-
// src/migrations/sqlite/
|
|
8246
|
-
var
|
|
8232
|
+
// src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts
|
|
8233
|
+
var CreateMachineStateStore1708796002272 = class {
|
|
8247
8234
|
static {
|
|
8248
|
-
__name(this, "
|
|
8235
|
+
__name(this, "CreateMachineStateStore1708796002272");
|
|
8249
8236
|
}
|
|
8250
|
-
name = "
|
|
8237
|
+
name = "CreateMachineStateStore1708796002272";
|
|
8251
8238
|
async up(queryRunner) {
|
|
8252
|
-
await queryRunner.query(`CREATE TABLE "temporary_StatusList" (
|
|
8253
|
-
"id" varchar PRIMARY KEY NOT NULL,
|
|
8254
|
-
"correlationId" varchar NOT NULL,
|
|
8255
|
-
"length" integer NOT NULL,
|
|
8256
|
-
"issuer" text NOT NULL,
|
|
8257
|
-
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8258
|
-
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8259
|
-
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8260
|
-
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8261
|
-
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
8262
|
-
"statusPurpose" varchar,
|
|
8263
|
-
"statusListCredential" text,
|
|
8264
|
-
"bitsPerStatus" integer,
|
|
8265
|
-
"expiresAt" datetime,
|
|
8266
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8267
|
-
)`);
|
|
8268
|
-
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
8269
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8270
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8271
|
-
"statusListCredential"
|
|
8272
|
-
)
|
|
8273
|
-
SELECT
|
|
8274
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8275
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8276
|
-
"statusListCredential"
|
|
8277
|
-
FROM "StatusList"`);
|
|
8278
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8279
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
8280
|
-
}
|
|
8281
|
-
async down(queryRunner) {
|
|
8282
|
-
await queryRunner.query(`
|
|
8283
|
-
ALTER TABLE "StatusListEntry"
|
|
8284
|
-
RENAME COLUMN "entryCorrelationId" TO "correlationId"
|
|
8285
|
-
`);
|
|
8286
8239
|
await queryRunner.query(`
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
"
|
|
8292
|
-
"
|
|
8293
|
-
"
|
|
8294
|
-
"
|
|
8295
|
-
"
|
|
8296
|
-
"
|
|
8297
|
-
"
|
|
8298
|
-
"
|
|
8299
|
-
"
|
|
8300
|
-
"statusPurpose" varchar NOT NULL DEFAULT ('revocation'),
|
|
8301
|
-
"statusListCredential" text,
|
|
8302
|
-
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8303
|
-
)`);
|
|
8304
|
-
await queryRunner.query(`INSERT INTO "temporary_StatusList"(
|
|
8305
|
-
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8306
|
-
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8307
|
-
"statusListCredential"
|
|
8240
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
8241
|
+
"instance_id" varchar PRIMARY KEY NOT NULL,
|
|
8242
|
+
"session_id" varchar,
|
|
8243
|
+
"machine_name" varchar NOT NULL,
|
|
8244
|
+
"latest_state_name" varchar,
|
|
8245
|
+
"latest_event_type" varchar NOT NULL,
|
|
8246
|
+
"state" text NOT NULL,
|
|
8247
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8248
|
+
"updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8249
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
8250
|
+
"expires_at" datetime,
|
|
8251
|
+
"completed_at" datetime,
|
|
8252
|
+
"tenant_id" varchar
|
|
8308
8253
|
)
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
COALESCE("statusPurpose", 'revocation'), "statusListCredential"
|
|
8314
|
-
FROM "StatusList"`);
|
|
8315
|
-
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8316
|
-
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
8254
|
+
`);
|
|
8255
|
+
}
|
|
8256
|
+
async down(queryRunner) {
|
|
8257
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`);
|
|
8317
8258
|
}
|
|
8318
8259
|
};
|
|
8319
8260
|
|
|
8320
|
-
// src/migrations/generic/
|
|
8261
|
+
// src/migrations/generic/7-CreateMachineStateStore.ts
|
|
8321
8262
|
var debug14 = Debug14("sphereon:ssi-sdk:migrations");
|
|
8322
|
-
var
|
|
8263
|
+
var CreateMachineStateStore1708098041262 = class {
|
|
8323
8264
|
static {
|
|
8324
|
-
__name(this, "
|
|
8265
|
+
__name(this, "CreateMachineStateStore1708098041262");
|
|
8325
8266
|
}
|
|
8326
|
-
name = "
|
|
8267
|
+
name = "CreateMachineStateStore1708098041262";
|
|
8327
8268
|
async up(queryRunner) {
|
|
8328
|
-
debug14("migration: creating
|
|
8269
|
+
debug14("migration: creating machine state tables");
|
|
8329
8270
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8271
|
+
switch (dbType) {
|
|
8272
|
+
case "postgres": {
|
|
8273
|
+
debug14("using postgres migration file");
|
|
8274
|
+
const mig = new CreateMachineStateStore1708797018115();
|
|
8275
|
+
await mig.up(queryRunner);
|
|
8276
|
+
debug14("Migration statements executed");
|
|
8277
|
+
return;
|
|
8278
|
+
}
|
|
8279
|
+
case "sqlite":
|
|
8280
|
+
case "expo":
|
|
8281
|
+
case "react-native": {
|
|
8282
|
+
debug14("using sqlite/react-native migration file");
|
|
8283
|
+
const mig = new CreateMachineStateStore1708796002272();
|
|
8284
|
+
await mig.up(queryRunner);
|
|
8285
|
+
debug14("Migration statements executed");
|
|
8286
|
+
return;
|
|
8287
|
+
}
|
|
8288
|
+
default:
|
|
8289
|
+
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`);
|
|
8348
8290
|
}
|
|
8349
8291
|
}
|
|
8350
8292
|
async down(queryRunner) {
|
|
8351
|
-
debug14("migration: reverting
|
|
8293
|
+
debug14("migration: reverting machine state tables");
|
|
8352
8294
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8295
|
+
switch (dbType) {
|
|
8296
|
+
case "postgres": {
|
|
8297
|
+
debug14("using postgres migration file");
|
|
8298
|
+
const mig = new CreateMachineStateStore1708797018115();
|
|
8299
|
+
await mig.down(queryRunner);
|
|
8300
|
+
debug14("Migration statements executed");
|
|
8301
|
+
return;
|
|
8302
|
+
}
|
|
8303
|
+
case "sqlite":
|
|
8304
|
+
case "expo":
|
|
8305
|
+
case "react-native": {
|
|
8306
|
+
debug14("using sqlite/react-native migration file");
|
|
8307
|
+
const mig = new CreateMachineStateStore1708796002272();
|
|
8308
|
+
await mig.down(queryRunner);
|
|
8309
|
+
debug14("Migration statements executed");
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
default:
|
|
8313
|
+
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`);
|
|
8371
8314
|
}
|
|
8372
8315
|
}
|
|
8373
8316
|
};
|
|
8374
8317
|
|
|
8375
|
-
// src/migrations/generic/
|
|
8318
|
+
// src/migrations/generic/8-CreateContacts.ts
|
|
8376
8319
|
import Debug15 from "debug";
|
|
8377
8320
|
|
|
8378
|
-
// src/migrations/
|
|
8379
|
-
var
|
|
8321
|
+
// src/migrations/postgres/1710438363001-CreateContacts.ts
|
|
8322
|
+
var CreateContacts1710438363001 = class {
|
|
8380
8323
|
static {
|
|
8381
|
-
__name(this, "
|
|
8324
|
+
__name(this, "CreateContacts1710438363001");
|
|
8382
8325
|
}
|
|
8383
|
-
name = "
|
|
8326
|
+
name = "CreateContacts1710438363001";
|
|
8384
8327
|
async up(queryRunner) {
|
|
8385
|
-
await queryRunner.query(`
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
"credentialHash" varchar,
|
|
8404
|
-
"parentCredentialHash" varchar,
|
|
8405
|
-
"originalCredential" varchar,
|
|
8406
|
-
"sharePurpose" varchar,
|
|
8407
|
-
"description" varchar NOT NULL,
|
|
8408
|
-
"data" varchar,
|
|
8409
|
-
"diagnosticData" varchar,
|
|
8410
|
-
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8411
|
-
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
8328
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" uuid`);
|
|
8329
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" uuid`);
|
|
8330
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "owner_id" uuid`);
|
|
8331
|
+
await queryRunner.query(`ALTER TABLE "Identity" ADD COLUMN "tenant_id" uuid`);
|
|
8332
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`);
|
|
8333
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`);
|
|
8334
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`);
|
|
8335
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`);
|
|
8336
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`);
|
|
8337
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`);
|
|
8338
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`);
|
|
8339
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`);
|
|
8340
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`);
|
|
8341
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`);
|
|
8342
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`);
|
|
8343
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`);
|
|
8344
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`);
|
|
8345
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`);
|
|
8412
8346
|
}
|
|
8413
8347
|
async down(queryRunner) {
|
|
8414
|
-
await queryRunner.query(`
|
|
8348
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
8349
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
8350
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
8351
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
8352
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
8353
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
8354
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
8355
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
8356
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
8357
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
8358
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
8359
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
8360
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
8361
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
8362
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
8363
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
8364
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
8365
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
8415
8366
|
}
|
|
8416
8367
|
};
|
|
8417
8368
|
|
|
8418
|
-
// src/migrations/
|
|
8419
|
-
var
|
|
8369
|
+
// src/migrations/sqlite/1710438363002-CreateContacts.ts
|
|
8370
|
+
var CreateContacts1710438363002 = class {
|
|
8420
8371
|
static {
|
|
8421
|
-
__name(this, "
|
|
8372
|
+
__name(this, "CreateContacts1710438363002");
|
|
8422
8373
|
}
|
|
8423
|
-
name = "
|
|
8374
|
+
name = "CreateContacts1710438363002";
|
|
8424
8375
|
async up(queryRunner) {
|
|
8425
|
-
await queryRunner.query(`
|
|
8426
|
-
await queryRunner.query(`
|
|
8427
|
-
await queryRunner.query(`CREATE
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8459
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8460
|
-
CONSTRAINT "PK_AuditEvents_id" PRIMARY KEY ("id"))`);
|
|
8376
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "owner_id" text`);
|
|
8377
|
+
await queryRunner.query(`ALTER TABLE "Party" ADD COLUMN "tenant_id" text`);
|
|
8378
|
+
await queryRunner.query(`CREATE TABLE "temporary_Identity" (
|
|
8379
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8380
|
+
"alias" varchar(255) NOT NULL,
|
|
8381
|
+
"roles" text NOT NULL,
|
|
8382
|
+
"origin" text NOT NULL,
|
|
8383
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8384
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8385
|
+
"partyId" varchar,
|
|
8386
|
+
"owner_id" text,
|
|
8387
|
+
"tenant_id" text,
|
|
8388
|
+
CONSTRAINT "UQ_Identity_alias" UNIQUE ("alias"),
|
|
8389
|
+
CONSTRAINT "FK_Identity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
|
8390
|
+
)`);
|
|
8391
|
+
await queryRunner.query(`INSERT INTO "temporary_Identity"("id", "alias", "roles", "created_at", "last_updated_at", "partyId", "owner_id", "tenant_id", "origin")
|
|
8392
|
+
SELECT "id", "alias", "roles", 'EXTERNAL' as "origin", "created_at", "last_updated_at", "partyId", NULL as "owner_id", NULL as "tenant_id" FROM "Identity"`);
|
|
8393
|
+
await queryRunner.query(`DROP TABLE "Identity"`);
|
|
8394
|
+
await queryRunner.query(`ALTER TABLE "temporary_Identity" RENAME TO "Identity"`);
|
|
8395
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" text`);
|
|
8396
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" text`);
|
|
8397
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" text`);
|
|
8398
|
+
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" text`);
|
|
8399
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" text`);
|
|
8400
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" text`);
|
|
8401
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" text`);
|
|
8402
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" text`);
|
|
8403
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" text`);
|
|
8404
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" text`);
|
|
8405
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" text`);
|
|
8406
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" text`);
|
|
8407
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" text`);
|
|
8408
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" text`);
|
|
8461
8409
|
}
|
|
8462
8410
|
async down(queryRunner) {
|
|
8463
|
-
await queryRunner.query(`
|
|
8464
|
-
await queryRunner.query(`
|
|
8465
|
-
await queryRunner.query(`
|
|
8466
|
-
await queryRunner.query(`
|
|
8467
|
-
await queryRunner.query(`
|
|
8468
|
-
await queryRunner.query(`
|
|
8469
|
-
await queryRunner.query(`
|
|
8470
|
-
await queryRunner.query(`
|
|
8411
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "tenant_id"`);
|
|
8412
|
+
await queryRunner.query(`ALTER TABLE "PhysicalAddress" DROP COLUMN "owner_id"`);
|
|
8413
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "tenant_id"`);
|
|
8414
|
+
await queryRunner.query(`ALTER TABLE "ElectronicAddress" DROP COLUMN "owner_id"`);
|
|
8415
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
8416
|
+
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
8417
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
8418
|
+
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
8419
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
8420
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
8421
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
8422
|
+
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
8423
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
8424
|
+
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
8425
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
8426
|
+
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
8427
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
8428
|
+
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
8471
8429
|
}
|
|
8472
8430
|
};
|
|
8473
8431
|
|
|
8474
|
-
// src/migrations/generic/
|
|
8432
|
+
// src/migrations/generic/8-CreateContacts.ts
|
|
8475
8433
|
var debug15 = Debug15("sphereon:ssi-sdk:migrations");
|
|
8476
|
-
var
|
|
8434
|
+
var CreateContacts1708525189000 = class {
|
|
8477
8435
|
static {
|
|
8478
|
-
__name(this, "
|
|
8436
|
+
__name(this, "CreateContacts1708525189000");
|
|
8479
8437
|
}
|
|
8480
|
-
name = "
|
|
8438
|
+
name = "CreateContacts1708525189000";
|
|
8481
8439
|
async up(queryRunner) {
|
|
8482
|
-
debug15("migration:
|
|
8440
|
+
debug15("migration: updating contact tables");
|
|
8483
8441
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8484
8442
|
switch (dbType) {
|
|
8485
8443
|
case "postgres": {
|
|
8486
8444
|
debug15("using postgres migration file");
|
|
8487
|
-
const mig = new
|
|
8445
|
+
const mig = new CreateContacts1710438363001();
|
|
8488
8446
|
await mig.up(queryRunner);
|
|
8489
8447
|
debug15("Migration statements executed");
|
|
8490
8448
|
return;
|
|
@@ -8493,7 +8451,7 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8493
8451
|
case "expo":
|
|
8494
8452
|
case "react-native": {
|
|
8495
8453
|
debug15("using sqlite/react-native migration file");
|
|
8496
|
-
const mig = new
|
|
8454
|
+
const mig = new CreateContacts1710438363002();
|
|
8497
8455
|
await mig.up(queryRunner);
|
|
8498
8456
|
debug15("Migration statements executed");
|
|
8499
8457
|
return;
|
|
@@ -8503,12 +8461,12 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8503
8461
|
}
|
|
8504
8462
|
}
|
|
8505
8463
|
async down(queryRunner) {
|
|
8506
|
-
debug15("migration: reverting
|
|
8464
|
+
debug15("migration: reverting machine state tables");
|
|
8507
8465
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8508
8466
|
switch (dbType) {
|
|
8509
8467
|
case "postgres": {
|
|
8510
8468
|
debug15("using postgres migration file");
|
|
8511
|
-
const mig = new
|
|
8469
|
+
const mig = new CreateContacts1710438363001();
|
|
8512
8470
|
await mig.down(queryRunner);
|
|
8513
8471
|
debug15("Migration statements executed");
|
|
8514
8472
|
return;
|
|
@@ -8517,7 +8475,7 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8517
8475
|
case "expo":
|
|
8518
8476
|
case "react-native": {
|
|
8519
8477
|
debug15("using sqlite/react-native migration file");
|
|
8520
|
-
const mig = new
|
|
8478
|
+
const mig = new CreateContacts1710438363002();
|
|
8521
8479
|
await mig.down(queryRunner);
|
|
8522
8480
|
debug15("Migration statements executed");
|
|
8523
8481
|
return;
|
|
@@ -8528,247 +8486,243 @@ var CreateAuditEvents1701635835330 = class {
|
|
|
8528
8486
|
}
|
|
8529
8487
|
};
|
|
8530
8488
|
|
|
8531
|
-
// src/migrations/generic/
|
|
8489
|
+
// src/migrations/generic/9-CreateContacts.ts
|
|
8532
8490
|
import Debug16 from "debug";
|
|
8533
8491
|
|
|
8534
|
-
// src/migrations/postgres/
|
|
8535
|
-
var
|
|
8492
|
+
// src/migrations/postgres/1715761125001-CreateContacts.ts
|
|
8493
|
+
var CreateContacts1715761125001 = class {
|
|
8536
8494
|
static {
|
|
8537
|
-
__name(this, "
|
|
8495
|
+
__name(this, "CreateContacts1715761125001");
|
|
8538
8496
|
}
|
|
8539
|
-
name = "
|
|
8497
|
+
name = "CreateContacts1715761125001";
|
|
8540
8498
|
async up(queryRunner) {
|
|
8541
|
-
await queryRunner.query(`
|
|
8542
|
-
await queryRunner.query(`CREATE
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8571
|
-
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8572
|
-
"presented_at" DATE,
|
|
8573
|
-
"valid_from" DATE,
|
|
8574
|
-
"valid_until" DATE,
|
|
8575
|
-
"verified_at" DATE,
|
|
8576
|
-
"revoked_at" DATE,
|
|
8577
|
-
PRIMARY KEY ("id"),
|
|
8578
|
-
UNIQUE ("hash", "credential_role")
|
|
8579
|
-
)
|
|
8580
|
-
`);
|
|
8499
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
8500
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
8501
|
+
(
|
|
8502
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
8503
|
+
"label" character varying(255) NOT NULL,
|
|
8504
|
+
"valueType" character varying NOT NULL,
|
|
8505
|
+
"stringValue" text,
|
|
8506
|
+
"numberValue" double precision,
|
|
8507
|
+
"dateValue" TIMESTAMP,
|
|
8508
|
+
"boolValue" boolean,
|
|
8509
|
+
"identityId" uuid,
|
|
8510
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
8511
|
+
)`);
|
|
8512
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
8513
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
8514
|
+
FROM "temporary_IdentityMetadata"`);
|
|
8515
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8516
|
+
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
8517
|
+
(
|
|
8518
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
8519
|
+
"label" character varying(255) NOT NULL,
|
|
8520
|
+
"valueType" character varying NOT NULL,
|
|
8521
|
+
"stringValue" text,
|
|
8522
|
+
"numberValue" double precision,
|
|
8523
|
+
"dateValue" TIMESTAMP,
|
|
8524
|
+
"boolValue" boolean,
|
|
8525
|
+
"contactId" uuid,
|
|
8526
|
+
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
8527
|
+
)`);
|
|
8581
8528
|
}
|
|
8582
8529
|
async down(queryRunner) {
|
|
8583
|
-
await queryRunner.query(`DROP TABLE "
|
|
8584
|
-
await queryRunner.query(`
|
|
8585
|
-
await queryRunner.query(`
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8530
|
+
await queryRunner.query(`DROP TABLE "ContactMetadata"`);
|
|
8531
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
8532
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
8533
|
+
(
|
|
8534
|
+
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
8535
|
+
"label" character varying(255) NOT NULL,
|
|
8536
|
+
"value" character varying(255) NOT NULL,
|
|
8537
|
+
"identityId" uuid,
|
|
8538
|
+
CONSTRAINT "FK_Identity_IdentityMetadata" FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
8539
|
+
)`);
|
|
8540
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
8541
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
8542
|
+
FROM "temporary_IdentityMetadata"`);
|
|
8543
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8590
8544
|
}
|
|
8591
8545
|
};
|
|
8592
8546
|
|
|
8593
|
-
// src/migrations/sqlite/
|
|
8594
|
-
var
|
|
8547
|
+
// src/migrations/sqlite/1715761125002-CreateContacts.ts
|
|
8548
|
+
var CreateContacts1715761125002 = class {
|
|
8595
8549
|
static {
|
|
8596
|
-
__name(this, "
|
|
8550
|
+
__name(this, "CreateContacts1715761125002");
|
|
8597
8551
|
}
|
|
8598
|
-
name = "
|
|
8552
|
+
name = "CreateContacts1715761125002";
|
|
8599
8553
|
async up(queryRunner) {
|
|
8600
|
-
await queryRunner.query(`
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
"subject_correlation_type" varchar CHECK( "subject_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8616
|
-
"issuer_correlation_id" text NOT NULL,
|
|
8617
|
-
"subject_correlation_id" text,
|
|
8618
|
-
"issuer_signed" boolean,
|
|
8619
|
-
"rp_correlation_id" text,
|
|
8620
|
-
"rp_correlation_type" varchar CHECK( "issuer_correlation_type" IN ('DID', 'KID', 'URL', 'X509_SAN') ),
|
|
8621
|
-
"verified_state" varchar CHECK( "verified_state" IN ('REVOKED', 'VERIFIED', 'EXPIRED') ),
|
|
8622
|
-
"tenant_id" text,
|
|
8623
|
-
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8624
|
-
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8625
|
-
"presented_at" datetime,
|
|
8626
|
-
"valid_from" datetime,
|
|
8627
|
-
"valid_until" datetime,
|
|
8628
|
-
"verified_at" datetime,
|
|
8629
|
-
"revoked_at" datetime,
|
|
8630
|
-
UNIQUE ("hash", "credential_role")
|
|
8631
|
-
)
|
|
8554
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
8555
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
8556
|
+
(
|
|
8557
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8558
|
+
"label" varchar(255) NOT NULL,
|
|
8559
|
+
"valueType" varchar NOT NULL,
|
|
8560
|
+
"stringValue" varchar(255),
|
|
8561
|
+
"numberValue" double,
|
|
8562
|
+
"dateValue" datetime,
|
|
8563
|
+
"boolValue" boolean,
|
|
8564
|
+
"identityId" varchar,
|
|
8565
|
+
FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE)`);
|
|
8566
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
8567
|
+
SELECT "id", "label", 'string', "value", "identityId"
|
|
8568
|
+
FROM "temporary_IdentityMetadata"
|
|
8632
8569
|
`);
|
|
8570
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8571
|
+
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
8572
|
+
(
|
|
8573
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8574
|
+
"label" varchar(255) NOT NULL,
|
|
8575
|
+
"valueType" varchar NOT NULL,
|
|
8576
|
+
"stringValue" text,
|
|
8577
|
+
"numberValue" double,
|
|
8578
|
+
"dateValue" datetime,
|
|
8579
|
+
"boolValue" boolean,
|
|
8580
|
+
"contactId" varchar,
|
|
8581
|
+
FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE)`);
|
|
8633
8582
|
}
|
|
8634
8583
|
async down(queryRunner) {
|
|
8635
|
-
await queryRunner.query(`DROP TABLE "
|
|
8584
|
+
await queryRunner.query(`DROP TABLE "ContactMetadata"`);
|
|
8585
|
+
await queryRunner.query(`ALTER TABLE "IdentityMetadata" RENAME TO "temporary_IdentityMetadata"`);
|
|
8586
|
+
await queryRunner.query(`CREATE TABLE "IdentityMetadata"
|
|
8587
|
+
(
|
|
8588
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8589
|
+
"label" varchar(255) NOT NULL,
|
|
8590
|
+
"value" varchar(255) NOT NULL,
|
|
8591
|
+
"identityId" varchar,
|
|
8592
|
+
FOREIGN KEY ("identityId") REFERENCES "Identity" ("id") ON DELETE CASCADE
|
|
8593
|
+
)`);
|
|
8594
|
+
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "value", "identityId")
|
|
8595
|
+
SELECT "id", "label", "stringValue", "identityId"
|
|
8596
|
+
FROM "temporary_IdentityMetadata"`);
|
|
8597
|
+
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8636
8598
|
}
|
|
8637
8599
|
};
|
|
8638
8600
|
|
|
8639
|
-
// src/migrations/generic/
|
|
8601
|
+
// src/migrations/generic/9-CreateContacts.ts
|
|
8640
8602
|
var debug16 = Debug16("sphereon:ssi-sdk:migrations");
|
|
8641
|
-
var
|
|
8603
|
+
var CreateContacts1715761125000 = class {
|
|
8642
8604
|
static {
|
|
8643
|
-
__name(this, "
|
|
8605
|
+
__name(this, "CreateContacts1715761125000");
|
|
8644
8606
|
}
|
|
8645
|
-
name = "
|
|
8607
|
+
name = "CreateContacts1715761125000";
|
|
8646
8608
|
async up(queryRunner) {
|
|
8647
|
-
debug16("migration:
|
|
8609
|
+
debug16("migration: updating contact tables");
|
|
8648
8610
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8649
8611
|
switch (dbType) {
|
|
8650
8612
|
case "postgres": {
|
|
8651
|
-
debug16("using postgres migration file
|
|
8652
|
-
const mig = new
|
|
8613
|
+
debug16("using postgres migration file");
|
|
8614
|
+
const mig = new CreateContacts1715761125001();
|
|
8653
8615
|
await mig.up(queryRunner);
|
|
8654
|
-
debug16("
|
|
8616
|
+
debug16("Migration statements executed");
|
|
8655
8617
|
return;
|
|
8656
8618
|
}
|
|
8657
8619
|
case "sqlite":
|
|
8658
8620
|
case "expo":
|
|
8659
8621
|
case "react-native": {
|
|
8660
|
-
debug16("using sqlite/react-native migration file
|
|
8661
|
-
const mig = new
|
|
8622
|
+
debug16("using sqlite/react-native migration file");
|
|
8623
|
+
const mig = new CreateContacts1715761125002();
|
|
8662
8624
|
await mig.up(queryRunner);
|
|
8663
|
-
debug16("
|
|
8625
|
+
debug16("Migration statements executed");
|
|
8664
8626
|
return;
|
|
8665
8627
|
}
|
|
8666
8628
|
default:
|
|
8667
|
-
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo
|
|
8629
|
+
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`);
|
|
8668
8630
|
}
|
|
8669
8631
|
}
|
|
8670
8632
|
async down(queryRunner) {
|
|
8671
|
-
debug16("migration: reverting
|
|
8633
|
+
debug16("migration: reverting machine state tables");
|
|
8672
8634
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8673
8635
|
switch (dbType) {
|
|
8674
8636
|
case "postgres": {
|
|
8675
|
-
debug16("using postgres migration file
|
|
8676
|
-
const mig = new
|
|
8637
|
+
debug16("using postgres migration file");
|
|
8638
|
+
const mig = new CreateContacts1715761125001();
|
|
8677
8639
|
await mig.down(queryRunner);
|
|
8678
|
-
debug16("
|
|
8640
|
+
debug16("Migration statements executed");
|
|
8679
8641
|
return;
|
|
8680
8642
|
}
|
|
8681
8643
|
case "sqlite":
|
|
8682
8644
|
case "expo":
|
|
8683
8645
|
case "react-native": {
|
|
8684
|
-
debug16("using sqlite/react-native migration file
|
|
8685
|
-
const mig = new
|
|
8646
|
+
debug16("using sqlite/react-native migration file");
|
|
8647
|
+
const mig = new CreateContacts1715761125002();
|
|
8686
8648
|
await mig.down(queryRunner);
|
|
8687
|
-
debug16("
|
|
8649
|
+
debug16("Migration statements executed");
|
|
8688
8650
|
return;
|
|
8689
8651
|
}
|
|
8690
8652
|
default:
|
|
8691
|
-
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo
|
|
8653
|
+
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`);
|
|
8692
8654
|
}
|
|
8693
8655
|
}
|
|
8694
8656
|
};
|
|
8695
8657
|
|
|
8696
|
-
// src/migrations/generic/
|
|
8658
|
+
// src/migrations/generic/10-CreatePresentationDefinitions.ts
|
|
8697
8659
|
import Debug17 from "debug";
|
|
8698
8660
|
|
|
8699
|
-
// src/migrations/postgres/
|
|
8700
|
-
var
|
|
8701
|
-
static {
|
|
8702
|
-
__name(this, "
|
|
8703
|
-
}
|
|
8704
|
-
name = "
|
|
8705
|
-
async up(queryRunner) {
|
|
8706
|
-
await queryRunner.query(`
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
8721
|
-
)
|
|
8722
|
-
`);
|
|
8661
|
+
// src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts
|
|
8662
|
+
var CreatePresentationDefinitions1716475165345 = class {
|
|
8663
|
+
static {
|
|
8664
|
+
__name(this, "CreatePresentationDefinitions1716475165345");
|
|
8665
|
+
}
|
|
8666
|
+
name = "CreatePresentationDefinitions1716475165345";
|
|
8667
|
+
async up(queryRunner) {
|
|
8668
|
+
await queryRunner.query(`
|
|
8669
|
+
CREATE TABLE "PresentationDefinitionItem" (
|
|
8670
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
8671
|
+
"tenant_id" TEXT,
|
|
8672
|
+
"definition_id" TEXT NOT NULL,
|
|
8673
|
+
"name" TEXT,
|
|
8674
|
+
"version" TEXT NOT NULL,
|
|
8675
|
+
"purpose" TEXT,
|
|
8676
|
+
"definition_payload" TEXT NOT NULL,
|
|
8677
|
+
"dcql_payload" TEXT,
|
|
8678
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8679
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
8680
|
+
CONSTRAINT "PK_PresentationDefinitionItem_id" PRIMARY KEY ("id"))
|
|
8681
|
+
`);
|
|
8723
8682
|
}
|
|
8724
8683
|
async down(queryRunner) {
|
|
8725
|
-
await queryRunner.query(`DROP TABLE "
|
|
8684
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
8726
8685
|
}
|
|
8727
8686
|
};
|
|
8728
8687
|
|
|
8729
|
-
// src/migrations/sqlite/
|
|
8730
|
-
var
|
|
8688
|
+
// src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts
|
|
8689
|
+
var CreatePresentationDefinitions1716475165344 = class {
|
|
8731
8690
|
static {
|
|
8732
|
-
__name(this, "
|
|
8691
|
+
__name(this, "CreatePresentationDefinitions1716475165344");
|
|
8733
8692
|
}
|
|
8734
|
-
name = "
|
|
8693
|
+
name = "CreatePresentationDefinitions1716475165344";
|
|
8735
8694
|
async up(queryRunner) {
|
|
8736
|
-
await queryRunner.query(`
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
"expires_at" datetime,
|
|
8748
|
-
"completed_at" datetime,
|
|
8749
|
-
"tenant_id" varchar
|
|
8750
|
-
)
|
|
8751
|
-
`);
|
|
8695
|
+
await queryRunner.query(`CREATE TABLE "PresentationDefinitionItem" (
|
|
8696
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8697
|
+
"tenant_id" varchar,
|
|
8698
|
+
"definition_id" varchar NOT NULL,
|
|
8699
|
+
"name" varchar,
|
|
8700
|
+
"version" varchar NOT NULL,
|
|
8701
|
+
"purpose" varchar,
|
|
8702
|
+
"definition_payload" varchar NOT NULL,
|
|
8703
|
+
"dcql_payload" varchar,
|
|
8704
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
8705
|
+
"last_updated_at" datetime NOT NULL DEFAULT (datetime('now')))`);
|
|
8752
8706
|
}
|
|
8753
8707
|
async down(queryRunner) {
|
|
8754
|
-
await queryRunner.query(`DROP TABLE "
|
|
8708
|
+
await queryRunner.query(`DROP TABLE "PresentationDefinitionItem"`);
|
|
8755
8709
|
}
|
|
8756
8710
|
};
|
|
8757
8711
|
|
|
8758
|
-
// src/migrations/generic/
|
|
8712
|
+
// src/migrations/generic/10-CreatePresentationDefinitions.ts
|
|
8759
8713
|
var debug17 = Debug17("sphereon:ssi-sdk:migrations");
|
|
8760
|
-
var
|
|
8714
|
+
var CreatePresentationDefinitions1716533767523 = class {
|
|
8761
8715
|
static {
|
|
8762
|
-
__name(this, "
|
|
8716
|
+
__name(this, "CreatePresentationDefinitions1716533767523");
|
|
8763
8717
|
}
|
|
8764
|
-
name = "
|
|
8718
|
+
name = "CreatePresentationDefinitionItems1716533767523";
|
|
8765
8719
|
async up(queryRunner) {
|
|
8766
8720
|
debug17("migration: creating machine state tables");
|
|
8767
8721
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8768
8722
|
switch (dbType) {
|
|
8769
8723
|
case "postgres": {
|
|
8770
8724
|
debug17("using postgres migration file");
|
|
8771
|
-
const mig = new
|
|
8725
|
+
const mig = new CreatePresentationDefinitions1716475165345();
|
|
8772
8726
|
await mig.up(queryRunner);
|
|
8773
8727
|
debug17("Migration statements executed");
|
|
8774
8728
|
return;
|
|
@@ -8777,7 +8731,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8777
8731
|
case "expo":
|
|
8778
8732
|
case "react-native": {
|
|
8779
8733
|
debug17("using sqlite/react-native migration file");
|
|
8780
|
-
const mig = new
|
|
8734
|
+
const mig = new CreatePresentationDefinitions1716475165344();
|
|
8781
8735
|
await mig.up(queryRunner);
|
|
8782
8736
|
debug17("Migration statements executed");
|
|
8783
8737
|
return;
|
|
@@ -8792,7 +8746,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8792
8746
|
switch (dbType) {
|
|
8793
8747
|
case "postgres": {
|
|
8794
8748
|
debug17("using postgres migration file");
|
|
8795
|
-
const mig = new
|
|
8749
|
+
const mig = new CreatePresentationDefinitions1716475165345();
|
|
8796
8750
|
await mig.down(queryRunner);
|
|
8797
8751
|
debug17("Migration statements executed");
|
|
8798
8752
|
return;
|
|
@@ -8801,7 +8755,7 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8801
8755
|
case "expo":
|
|
8802
8756
|
case "react-native": {
|
|
8803
8757
|
debug17("using sqlite/react-native migration file");
|
|
8804
|
-
const mig = new
|
|
8758
|
+
const mig = new CreatePresentationDefinitions1716475165344();
|
|
8805
8759
|
await mig.down(queryRunner);
|
|
8806
8760
|
debug17("Migration statements executed");
|
|
8807
8761
|
return;
|
|
@@ -8812,134 +8766,97 @@ var CreateMachineStateStore1708098041262 = class {
|
|
|
8812
8766
|
}
|
|
8813
8767
|
};
|
|
8814
8768
|
|
|
8815
|
-
// src/migrations/generic/
|
|
8769
|
+
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
8816
8770
|
import Debug18 from "debug";
|
|
8817
8771
|
|
|
8818
|
-
// src/migrations/postgres/
|
|
8819
|
-
var
|
|
8772
|
+
// src/migrations/postgres/1741895822987-FixCredentialClaimsReferencesUuid.ts
|
|
8773
|
+
var FixCredentialClaimsReferencesUuidPG1741895822987 = class {
|
|
8820
8774
|
static {
|
|
8821
|
-
__name(this, "
|
|
8775
|
+
__name(this, "FixCredentialClaimsReferencesUuidPG1741895822987");
|
|
8822
8776
|
}
|
|
8823
|
-
name = "
|
|
8777
|
+
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
8824
8778
|
async up(queryRunner) {
|
|
8825
|
-
await queryRunner.query(`
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "owner_id" uuid`);
|
|
8830
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" ADD COLUMN "tenant_id" uuid`);
|
|
8831
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" uuid`);
|
|
8832
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" uuid`);
|
|
8833
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" uuid`);
|
|
8834
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" uuid`);
|
|
8835
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" uuid`);
|
|
8836
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" uuid`);
|
|
8837
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" uuid`);
|
|
8838
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" uuid`);
|
|
8839
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" uuid`);
|
|
8840
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" uuid`);
|
|
8841
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" uuid`);
|
|
8842
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" uuid`);
|
|
8779
|
+
await queryRunner.query(`
|
|
8780
|
+
ALTER TABLE "CredentialClaims"
|
|
8781
|
+
ALTER COLUMN "credentialLocaleBrandingId" TYPE uuid USING "credentialLocaleBrandingId"::uuid;
|
|
8782
|
+
`);
|
|
8843
8783
|
}
|
|
8844
8784
|
async down(queryRunner) {
|
|
8845
|
-
await queryRunner.query(`
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "tenant_id"`);
|
|
8850
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" DROP COLUMN "owner_id"`);
|
|
8851
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "tenant_id"`);
|
|
8852
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" DROP COLUMN "owner_id"`);
|
|
8853
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "tenant_id"`);
|
|
8854
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" DROP COLUMN "owner_id"`);
|
|
8855
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "tenant_id"`);
|
|
8856
|
-
await queryRunner.query(`ALTER TABLE "Connection" DROP COLUMN "owner_id"`);
|
|
8857
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "tenant_id"`);
|
|
8858
|
-
await queryRunner.query(`ALTER TABLE "CorrelationIdentifier" DROP COLUMN "owner_id"`);
|
|
8859
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "tenant_id"`);
|
|
8860
|
-
await queryRunner.query(`ALTER TABLE "Identity" DROP COLUMN "owner_id"`);
|
|
8861
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "tenant_id"`);
|
|
8862
|
-
await queryRunner.query(`ALTER TABLE "Party" DROP COLUMN "owner_id"`);
|
|
8785
|
+
await queryRunner.query(`
|
|
8786
|
+
ALTER TABLE "CredentialClaims"
|
|
8787
|
+
ALTER COLUMN "credentialLocaleBrandingId" TYPE character varying USING "credentialLocaleBrandingId"::text;
|
|
8788
|
+
`);
|
|
8863
8789
|
}
|
|
8864
8790
|
};
|
|
8865
8791
|
|
|
8866
|
-
// src/migrations/sqlite/
|
|
8867
|
-
var
|
|
8792
|
+
// src/migrations/sqlite/1741895822987-FixCredentialClaimsReferencesUuid.ts
|
|
8793
|
+
var FixCredentialClaimsReferencesUuidSqlite1741895822987 = class {
|
|
8868
8794
|
static {
|
|
8869
|
-
__name(this, "
|
|
8795
|
+
__name(this, "FixCredentialClaimsReferencesUuidSqlite1741895822987");
|
|
8870
8796
|
}
|
|
8871
|
-
name = "
|
|
8797
|
+
name = "FixCredentialClaimsReferencesUuid1741895822987";
|
|
8872
8798
|
async up(queryRunner) {
|
|
8873
|
-
await queryRunner.query(`
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
await queryRunner.query(`
|
|
8889
|
-
|
|
8890
|
-
await queryRunner.query(`
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "owner_id" text`);
|
|
8895
|
-
await queryRunner.query(`ALTER TABLE "Connection" ADD COLUMN "tenant_id" text`);
|
|
8896
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "owner_id" text`);
|
|
8897
|
-
await queryRunner.query(`ALTER TABLE "BaseConfig" ADD COLUMN "tenant_id" text`);
|
|
8898
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "owner_id" text`);
|
|
8899
|
-
await queryRunner.query(`ALTER TABLE "BaseContact" ADD COLUMN "tenant_id" text`);
|
|
8900
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "owner_id" text`);
|
|
8901
|
-
await queryRunner.query(`ALTER TABLE "PartyRelationship" ADD COLUMN "tenant_id" text`);
|
|
8902
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "owner_id" text`);
|
|
8903
|
-
await queryRunner.query(`ALTER TABLE "ElectronicAddress" ADD COLUMN "tenant_id" text`);
|
|
8904
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "owner_id" text`);
|
|
8905
|
-
await queryRunner.query(`ALTER TABLE "PhysicalAddress" ADD COLUMN "tenant_id" text`);
|
|
8799
|
+
await queryRunner.query(`
|
|
8800
|
+
CREATE TABLE "CredentialClaims_new"
|
|
8801
|
+
(
|
|
8802
|
+
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
8803
|
+
"key" character varying(255) NOT NULL,
|
|
8804
|
+
"name" character varying(255) NOT NULL,
|
|
8805
|
+
"credentialLocaleBrandingId" uuid,
|
|
8806
|
+
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
8807
|
+
)
|
|
8808
|
+
`);
|
|
8809
|
+
await queryRunner.query(`
|
|
8810
|
+
INSERT INTO "CredentialClaims_new" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
8811
|
+
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
8812
|
+
FROM "CredentialClaims"
|
|
8813
|
+
`);
|
|
8814
|
+
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
8815
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims_new" RENAME TO "CredentialClaims"`);
|
|
8816
|
+
await queryRunner.query(`
|
|
8817
|
+
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
8818
|
+
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
8819
|
+
`);
|
|
8906
8820
|
}
|
|
8907
8821
|
async down(queryRunner) {
|
|
8908
|
-
await queryRunner.query(`
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
await queryRunner.query(`
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
await queryRunner.query(`
|
|
8924
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8925
|
-
await queryRunner.query(`
|
|
8822
|
+
await queryRunner.query(`
|
|
8823
|
+
CREATE TABLE "CredentialClaims_old"
|
|
8824
|
+
(
|
|
8825
|
+
"id" uuid NOT NULL DEFAULT (lower(hex(randomblob(16)))),
|
|
8826
|
+
"key" character varying(255) NOT NULL,
|
|
8827
|
+
"name" character varying(255) NOT NULL,
|
|
8828
|
+
"credentialLocaleBrandingId" character varying,
|
|
8829
|
+
CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id")
|
|
8830
|
+
)
|
|
8831
|
+
`);
|
|
8832
|
+
await queryRunner.query(`
|
|
8833
|
+
INSERT INTO "CredentialClaims_old" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
8834
|
+
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
8835
|
+
FROM "CredentialClaims"
|
|
8836
|
+
`);
|
|
8837
|
+
await queryRunner.query(`DROP TABLE "CredentialClaims"`);
|
|
8838
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims_old" RENAME TO "CredentialClaims"`);
|
|
8839
|
+
await queryRunner.query(`
|
|
8840
|
+
CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"
|
|
8841
|
+
ON "CredentialClaims" ("credentialLocaleBrandingId", "key")
|
|
8842
|
+
`);
|
|
8926
8843
|
}
|
|
8927
8844
|
};
|
|
8928
8845
|
|
|
8929
|
-
// src/migrations/generic/
|
|
8846
|
+
// src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts
|
|
8930
8847
|
var debug18 = Debug18("sphereon:ssi-sdk:migrations");
|
|
8931
|
-
var
|
|
8848
|
+
var FixCredentialClaimsReferencesUuid1741895822987 = class {
|
|
8932
8849
|
static {
|
|
8933
|
-
__name(this, "
|
|
8850
|
+
__name(this, "FixCredentialClaimsReferencesUuid1741895822987");
|
|
8934
8851
|
}
|
|
8935
|
-
name = "
|
|
8852
|
+
name = "FixCredentialClaimsReferenceUuid1741895822987";
|
|
8936
8853
|
async up(queryRunner) {
|
|
8937
|
-
debug18("migration:
|
|
8854
|
+
debug18("migration: creating issuance branding uuid problem");
|
|
8938
8855
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8939
8856
|
switch (dbType) {
|
|
8940
8857
|
case "postgres": {
|
|
8941
8858
|
debug18("using postgres migration file");
|
|
8942
|
-
const mig = new
|
|
8859
|
+
const mig = new FixCredentialClaimsReferencesUuidPG1741895822987();
|
|
8943
8860
|
await mig.up(queryRunner);
|
|
8944
8861
|
debug18("Migration statements executed");
|
|
8945
8862
|
return;
|
|
@@ -8948,7 +8865,7 @@ var CreateContacts1708525189000 = class {
|
|
|
8948
8865
|
case "expo":
|
|
8949
8866
|
case "react-native": {
|
|
8950
8867
|
debug18("using sqlite/react-native migration file");
|
|
8951
|
-
const mig = new
|
|
8868
|
+
const mig = new FixCredentialClaimsReferencesUuidSqlite1741895822987();
|
|
8952
8869
|
await mig.up(queryRunner);
|
|
8953
8870
|
debug18("Migration statements executed");
|
|
8954
8871
|
return;
|
|
@@ -8958,12 +8875,12 @@ var CreateContacts1708525189000 = class {
|
|
|
8958
8875
|
}
|
|
8959
8876
|
}
|
|
8960
8877
|
async down(queryRunner) {
|
|
8961
|
-
debug18("migration: reverting
|
|
8878
|
+
debug18("migration: reverting issuance branding uuid migration");
|
|
8962
8879
|
const dbType = queryRunner.connection.driver.options.type;
|
|
8963
8880
|
switch (dbType) {
|
|
8964
8881
|
case "postgres": {
|
|
8965
8882
|
debug18("using postgres migration file");
|
|
8966
|
-
const mig = new
|
|
8883
|
+
const mig = new CreateIssuanceBranding1685628974232();
|
|
8967
8884
|
await mig.down(queryRunner);
|
|
8968
8885
|
debug18("Migration statements executed");
|
|
8969
8886
|
return;
|
|
@@ -8972,7 +8889,7 @@ var CreateContacts1708525189000 = class {
|
|
|
8972
8889
|
case "expo":
|
|
8973
8890
|
case "react-native": {
|
|
8974
8891
|
debug18("using sqlite/react-native migration file");
|
|
8975
|
-
const mig = new
|
|
8892
|
+
const mig = new CreateIssuanceBranding1685628973231();
|
|
8976
8893
|
await mig.down(queryRunner);
|
|
8977
8894
|
debug18("Migration statements executed");
|
|
8978
8895
|
return;
|
|
@@ -8983,171 +8900,222 @@ var CreateContacts1708525189000 = class {
|
|
|
8983
8900
|
}
|
|
8984
8901
|
};
|
|
8985
8902
|
|
|
8986
|
-
// src/migrations/generic/
|
|
8903
|
+
// src/migrations/generic/12-CreateBitstringStatusList.ts
|
|
8987
8904
|
import Debug19 from "debug";
|
|
8988
8905
|
|
|
8989
|
-
// src/migrations/postgres/
|
|
8990
|
-
var
|
|
8906
|
+
// src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts
|
|
8907
|
+
var CreateBitstringStatusListPG1741895823000 = class {
|
|
8991
8908
|
static {
|
|
8992
|
-
__name(this, "
|
|
8909
|
+
__name(this, "CreateBitstringStatusListPG1741895823000");
|
|
8993
8910
|
}
|
|
8994
|
-
name = "
|
|
8911
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
8995
8912
|
async up(queryRunner) {
|
|
8996
|
-
await queryRunner.query(`ALTER TABLE "
|
|
8997
|
-
await queryRunner.query(`
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
)`);
|
|
9009
|
-
await queryRunner.query(`INSERT INTO "IdentityMetadata" ("id", "label", "valueType", "stringValue", "identityId")
|
|
9010
|
-
SELECT "id", "label", 'string', "value", "identityId"
|
|
9011
|
-
FROM "temporary_IdentityMetadata"`);
|
|
9012
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
9013
|
-
await queryRunner.query(`CREATE TABLE "ContactMetadata"
|
|
9014
|
-
(
|
|
9015
|
-
"id" uuid PRIMARY KEY NOT NULL DEFAULT uuid_generate_v4(),
|
|
9016
|
-
"label" character varying(255) NOT NULL,
|
|
9017
|
-
"valueType" character varying NOT NULL,
|
|
9018
|
-
"stringValue" text,
|
|
9019
|
-
"numberValue" double precision,
|
|
9020
|
-
"dateValue" TIMESTAMP,
|
|
9021
|
-
"boolValue" boolean,
|
|
9022
|
-
"contactId" uuid,
|
|
9023
|
-
CONSTRAINT "FK_BaseContact_ContactMetadata" FOREIGN KEY ("contactId") REFERENCES "BaseContact" ("id") ON DELETE CASCADE
|
|
9024
|
-
)`);
|
|
8913
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`);
|
|
8914
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "ttl" integer`);
|
|
8915
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validFrom" TIMESTAMP`);
|
|
8916
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`);
|
|
8917
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT IF EXISTS "CHK_StatusList_type"`);
|
|
8918
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList'))`);
|
|
8919
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "type" character varying NOT NULL DEFAULT 'StatusListEntryEntity'`);
|
|
8920
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`);
|
|
8921
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`);
|
|
8922
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`);
|
|
8923
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`);
|
|
8924
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD CONSTRAINT "CHK_StatusListEntry_type" CHECK ("type" IN ('StatusListEntryEntity', 'bitstring'))`);
|
|
9025
8925
|
}
|
|
9026
8926
|
async down(queryRunner) {
|
|
9027
|
-
await queryRunner.query(`
|
|
9028
|
-
await queryRunner.query(`ALTER TABLE "
|
|
9029
|
-
await queryRunner.query(`
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
await queryRunner.query(`
|
|
9038
|
-
|
|
9039
|
-
FROM "temporary_IdentityMetadata"`);
|
|
9040
|
-
await queryRunner.query(`DROP TABLE "temporary_IdentityMetadata"`);
|
|
8927
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP CONSTRAINT "CHK_StatusListEntry_type"`);
|
|
8928
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusReference"`);
|
|
8929
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusMessage"`);
|
|
8930
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "bitsPerStatus"`);
|
|
8931
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "statusPurpose"`);
|
|
8932
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" DROP COLUMN "type"`);
|
|
8933
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP CONSTRAINT "CHK_StatusList_type"`);
|
|
8934
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD CONSTRAINT "CHK_StatusList_type" CHECK ("type" IN ('StatusList2021', 'OAuthStatusList'))`);
|
|
8935
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validUntil"`);
|
|
8936
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "validFrom"`);
|
|
8937
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "ttl"`);
|
|
8938
|
+
await queryRunner.query(`ALTER TABLE "StatusList" DROP COLUMN "bitsPerStatus"`);
|
|
9041
8939
|
}
|
|
9042
8940
|
};
|
|
9043
8941
|
|
|
9044
|
-
// src/migrations/sqlite/
|
|
9045
|
-
var
|
|
8942
|
+
// src/migrations/sqlite/1741895823001-CreateBitstringStatusList.ts
|
|
8943
|
+
var CreateBitstringStatusListSqlite1741895823001 = class {
|
|
9046
8944
|
static {
|
|
9047
|
-
__name(this, "
|
|
8945
|
+
__name(this, "CreateBitstringStatusListSqlite1741895823001");
|
|
9048
8946
|
}
|
|
9049
|
-
name = "
|
|
8947
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
9050
8948
|
async up(queryRunner) {
|
|
9051
|
-
await queryRunner.query(`
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
8949
|
+
await queryRunner.query(`
|
|
8950
|
+
CREATE TABLE "temporary_StatusList" (
|
|
8951
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
8952
|
+
"correlationId" varchar NOT NULL,
|
|
8953
|
+
"length" integer NOT NULL,
|
|
8954
|
+
"issuer" text NOT NULL,
|
|
8955
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList', 'BitstringStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
8956
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
8957
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
8958
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
8959
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
8960
|
+
"statusPurpose" varchar,
|
|
8961
|
+
"statusListCredential" text,
|
|
8962
|
+
"expiresAt" datetime,
|
|
8963
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
8964
|
+
"ttl" integer,
|
|
8965
|
+
"validFrom" datetime,
|
|
8966
|
+
"validUntil" datetime,
|
|
8967
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
8968
|
+
)
|
|
8969
|
+
`);
|
|
8970
|
+
await queryRunner.query(`
|
|
8971
|
+
INSERT INTO "temporary_StatusList"(
|
|
8972
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8973
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8974
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
8975
|
+
)
|
|
8976
|
+
SELECT
|
|
8977
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
8978
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
8979
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
8980
|
+
FROM "StatusList"
|
|
8981
|
+
`);
|
|
8982
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
8983
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
8984
|
+
await queryRunner.query(`
|
|
8985
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
8986
|
+
"statusListId" varchar NOT NULL,
|
|
8987
|
+
"statusListIndex" integer NOT NULL,
|
|
8988
|
+
"credentialId" text,
|
|
8989
|
+
"credentialHash" varchar(128),
|
|
8990
|
+
"correlationId" varchar(255),
|
|
8991
|
+
"value" varchar(50),
|
|
8992
|
+
"type" varchar CHECK( "type" IN ('StatusListEntryEntity', 'bitstring') ) NOT NULL DEFAULT ('StatusListEntryEntity'),
|
|
8993
|
+
"statusPurpose" varchar,
|
|
8994
|
+
"bitsPerStatus" integer DEFAULT (1),
|
|
8995
|
+
"statusMessage" text,
|
|
8996
|
+
"statusReference" text,
|
|
8997
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
8998
|
+
)
|
|
8999
|
+
`);
|
|
9000
|
+
await queryRunner.query(`
|
|
9001
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
9002
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9003
|
+
"correlationId", "value", "type"
|
|
9004
|
+
)
|
|
9005
|
+
SELECT
|
|
9006
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9007
|
+
"correlationId", "value", 'StatusListEntryEntity'
|
|
9008
|
+
FROM "StatusListEntry"
|
|
9009
|
+
`);
|
|
9010
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
9011
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
9079
9012
|
}
|
|
9080
9013
|
async down(queryRunner) {
|
|
9081
|
-
await queryRunner.query(`
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9014
|
+
await queryRunner.query(`
|
|
9015
|
+
CREATE TABLE "temporary_StatusListEntry" (
|
|
9016
|
+
"statusListId" varchar NOT NULL,
|
|
9017
|
+
"statusListIndex" integer NOT NULL,
|
|
9018
|
+
"credentialId" text,
|
|
9019
|
+
"credentialHash" varchar(128),
|
|
9020
|
+
"correlationId" varchar(255),
|
|
9021
|
+
"value" varchar(50),
|
|
9022
|
+
PRIMARY KEY ("statusListId", "statusListIndex")
|
|
9023
|
+
)
|
|
9024
|
+
`);
|
|
9025
|
+
await queryRunner.query(`
|
|
9026
|
+
INSERT INTO "temporary_StatusListEntry"(
|
|
9027
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9028
|
+
"correlationId", "value"
|
|
9029
|
+
)
|
|
9030
|
+
SELECT
|
|
9031
|
+
"statusListId", "statusListIndex", "credentialId", "credentialHash",
|
|
9032
|
+
"correlationId", "value"
|
|
9033
|
+
FROM "StatusListEntry"
|
|
9034
|
+
WHERE "type" = 'StatusListEntryEntity'
|
|
9035
|
+
`);
|
|
9036
|
+
await queryRunner.query(`DROP TABLE "StatusListEntry"`);
|
|
9037
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusListEntry" RENAME TO "StatusListEntry"`);
|
|
9038
|
+
await queryRunner.query(`
|
|
9039
|
+
CREATE TABLE "temporary_StatusList" (
|
|
9040
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
9041
|
+
"correlationId" varchar NOT NULL,
|
|
9042
|
+
"length" integer NOT NULL,
|
|
9043
|
+
"issuer" text NOT NULL,
|
|
9044
|
+
"type" varchar CHECK( "type" IN ('StatusList2021', 'OAuthStatusList') ) NOT NULL DEFAULT ('StatusList2021'),
|
|
9045
|
+
"driverType" varchar CHECK( "driverType" IN ('agent_typeorm','agent_kv_store','github','agent_filesystem') ) NOT NULL DEFAULT ('agent_typeorm'),
|
|
9046
|
+
"credentialIdMode" varchar CHECK( "credentialIdMode" IN ('ISSUANCE','PERSISTENCE','NEVER') ) NOT NULL DEFAULT ('ISSUANCE'),
|
|
9047
|
+
"proofFormat" varchar CHECK( "proofFormat" IN ('lds','jwt', 'vc+jwt') ) NOT NULL DEFAULT ('lds'),
|
|
9048
|
+
"indexingDirection" varchar CHECK( "indexingDirection" IN ('rightToLeft') ),
|
|
9049
|
+
"statusPurpose" varchar,
|
|
9050
|
+
"statusListCredential" text,
|
|
9051
|
+
"bitsPerStatus" integer,
|
|
9052
|
+
"expiresAt" datetime,
|
|
9053
|
+
CONSTRAINT "UQ_correlationId" UNIQUE ("correlationId")
|
|
9054
|
+
)
|
|
9055
|
+
`);
|
|
9056
|
+
await queryRunner.query(`
|
|
9057
|
+
INSERT INTO "temporary_StatusList"(
|
|
9058
|
+
"id", "correlationId", "length", "issuer", "type", "driverType",
|
|
9059
|
+
"credentialIdMode", "proofFormat", "indexingDirection", "statusPurpose",
|
|
9060
|
+
"statusListCredential", "bitsPerStatus", "expiresAt"
|
|
9061
|
+
)
|
|
9062
|
+
SELECT
|
|
9063
|
+
"id", "correlationId", "length", "issuer",
|
|
9064
|
+
CASE WHEN "type" = 'BitstringStatusList' THEN 'StatusList2021' ELSE "type" END,
|
|
9065
|
+
"driverType", "credentialIdMode", "proofFormat", "indexingDirection",
|
|
9066
|
+
"statusPurpose", "statusListCredential", "bitsPerStatus", "expiresAt"
|
|
9067
|
+
FROM "StatusList"
|
|
9068
|
+
`);
|
|
9069
|
+
await queryRunner.query(`DROP TABLE "StatusList"`);
|
|
9070
|
+
await queryRunner.query(`ALTER TABLE "temporary_StatusList" RENAME TO "StatusList"`);
|
|
9095
9071
|
}
|
|
9096
9072
|
};
|
|
9097
9073
|
|
|
9098
|
-
// src/migrations/generic/
|
|
9074
|
+
// src/migrations/generic/12-CreateBitstringStatusList.ts
|
|
9099
9075
|
var debug19 = Debug19("sphereon:ssi-sdk:migrations");
|
|
9100
|
-
var
|
|
9076
|
+
var CreateBitstringStatusList1741895823000 = class {
|
|
9101
9077
|
static {
|
|
9102
|
-
__name(this, "
|
|
9078
|
+
__name(this, "CreateBitstringStatusList1741895823000");
|
|
9103
9079
|
}
|
|
9104
|
-
name = "
|
|
9080
|
+
name = "CreateBitstringStatusList1741895823000";
|
|
9105
9081
|
async up(queryRunner) {
|
|
9106
|
-
debug19("migration:
|
|
9082
|
+
debug19("migration: creating bitstring status list tables");
|
|
9107
9083
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9108
9084
|
switch (dbType) {
|
|
9109
9085
|
case "postgres": {
|
|
9110
|
-
|
|
9111
|
-
const mig = new CreateContacts1715761125001();
|
|
9086
|
+
const mig = new CreateBitstringStatusListPG1741895823000();
|
|
9112
9087
|
await mig.up(queryRunner);
|
|
9113
|
-
debug19("Migration statements executed");
|
|
9114
9088
|
return;
|
|
9115
9089
|
}
|
|
9116
9090
|
case "sqlite":
|
|
9117
9091
|
case "expo":
|
|
9118
9092
|
case "react-native": {
|
|
9119
|
-
|
|
9120
|
-
const mig = new CreateContacts1715761125002();
|
|
9093
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001();
|
|
9121
9094
|
await mig.up(queryRunner);
|
|
9122
|
-
debug19("Migration statements executed");
|
|
9123
9095
|
return;
|
|
9124
9096
|
}
|
|
9125
9097
|
default:
|
|
9126
|
-
return Promise.reject(`Migrations
|
|
9098
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
9127
9099
|
}
|
|
9128
9100
|
}
|
|
9129
9101
|
async down(queryRunner) {
|
|
9130
|
-
debug19("migration:
|
|
9102
|
+
debug19("migration: dropping bitstring status list tables");
|
|
9131
9103
|
const dbType = queryRunner.connection.driver.options.type;
|
|
9132
9104
|
switch (dbType) {
|
|
9133
9105
|
case "postgres": {
|
|
9134
|
-
|
|
9135
|
-
const mig = new CreateContacts1715761125001();
|
|
9106
|
+
const mig = new CreateBitstringStatusListPG1741895823000();
|
|
9136
9107
|
await mig.down(queryRunner);
|
|
9137
|
-
debug19("Migration statements executed");
|
|
9138
9108
|
return;
|
|
9139
9109
|
}
|
|
9140
9110
|
case "sqlite":
|
|
9141
9111
|
case "expo":
|
|
9142
9112
|
case "react-native": {
|
|
9143
|
-
|
|
9144
|
-
const mig = new CreateContacts1715761125002();
|
|
9113
|
+
const mig = new CreateBitstringStatusListSqlite1741895823001();
|
|
9145
9114
|
await mig.down(queryRunner);
|
|
9146
|
-
debug19("Migration statements executed");
|
|
9147
9115
|
return;
|
|
9148
9116
|
}
|
|
9149
9117
|
default:
|
|
9150
|
-
return Promise.reject(`Migrations
|
|
9118
|
+
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`);
|
|
9151
9119
|
}
|
|
9152
9120
|
}
|
|
9153
9121
|
};
|
|
@@ -9165,7 +9133,6 @@ var DataStoreIssuanceBrandingMigrations = [
|
|
|
9165
9133
|
];
|
|
9166
9134
|
var DataStoreStatusListMigrations = [
|
|
9167
9135
|
CreateStatusList1693866470000,
|
|
9168
|
-
AddBitstringStatusListEnum1741895823000,
|
|
9169
9136
|
CreateBitstringStatusList1741895823000
|
|
9170
9137
|
];
|
|
9171
9138
|
var DataStoreEventLoggerMigrations = [
|
|
@@ -9417,6 +9384,7 @@ export {
|
|
|
9417
9384
|
CredentialCorrelationType,
|
|
9418
9385
|
CredentialDocumentFormat,
|
|
9419
9386
|
CredentialLocaleBrandingEntity,
|
|
9387
|
+
CredentialRole,
|
|
9420
9388
|
CredentialStateType,
|
|
9421
9389
|
DataStoreContactEntities,
|
|
9422
9390
|
DataStoreContactMigrations,
|