@sphereon/ssi-sdk.data-store 0.36.1-next.153 → 0.36.1-next.155
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 +215 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +215 -96
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +3 -0
- package/src/migrations/generic/17-AddCredentialClaimOrder.ts +64 -0
- package/src/migrations/generic/index.ts +2 -0
- package/src/migrations/postgres/1768000000000-AddCredentialClaimOrder.ts +13 -0
- package/src/migrations/sqlite/1768000000000-AddCredentialClaimOrder.ts +34 -0
- package/src/utils/issuanceBranding/MappingUtils.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.36.1-next.
|
|
3
|
+
"version": "0.36.1-next.155+32138ae6",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
|
|
30
30
|
"@sphereon/pex": "5.0.0-unstable.28",
|
|
31
|
-
"@sphereon/ssi-sdk-ext.did-utils": "0.36.1-next.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-next.
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.36.1-next.
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.36.1-next.
|
|
35
|
-
"@sphereon/ssi-sdk.data-store-types": "0.36.1-next.
|
|
36
|
-
"@sphereon/ssi-types": "0.36.1-next.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.36.1-next.155+32138ae6",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-next.155+32138ae6",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.36.1-next.155+32138ae6",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.36.1-next.155+32138ae6",
|
|
35
|
+
"@sphereon/ssi-sdk.data-store-types": "0.36.1-next.155+32138ae6",
|
|
36
|
+
"@sphereon/ssi-types": "0.36.1-next.155+32138ae6",
|
|
37
37
|
"@veramo/core": "4.2.0",
|
|
38
38
|
"@veramo/data-store": "4.2.0",
|
|
39
39
|
"@veramo/utils": "4.2.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"PostgreSQL",
|
|
68
68
|
"Contact Store"
|
|
69
69
|
],
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "32138ae6119b77cc823033097aa0912dd905cf07"
|
|
71
71
|
}
|
|
@@ -17,6 +17,9 @@ export class CredentialClaimsEntity extends BaseEntity {
|
|
|
17
17
|
@Validate(IsNonEmptyStringConstraint, { message: 'Blank claim names are not allowed' })
|
|
18
18
|
name!: string
|
|
19
19
|
|
|
20
|
+
@Column('integer', { name: 'order', nullable: true })
|
|
21
|
+
order?: number
|
|
22
|
+
|
|
20
23
|
@ManyToOne(() => CredentialLocaleBrandingEntity, (credentialLocaleBranding: CredentialLocaleBrandingEntity) => credentialLocaleBranding.claims, {
|
|
21
24
|
cascade: ['insert', 'update'],
|
|
22
25
|
onDelete: 'CASCADE',
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Debug from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
import { AddCredentialClaimOrderPostgres1768000000000 } from '../postgres/1768000000000-AddCredentialClaimOrder'
|
|
4
|
+
import { AddCredentialClaimOrderSqlite1768000000000 } from '../sqlite/1768000000000-AddCredentialClaimOrder'
|
|
5
|
+
|
|
6
|
+
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class AddCredentialClaimOrder1768000000000 implements MigrationInterface {
|
|
9
|
+
name = 'AddCredentialClaimOrder1768000000000'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: adding credential claim order column')
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
switch (dbType) {
|
|
15
|
+
case 'postgres': {
|
|
16
|
+
debug('using postgres migration file')
|
|
17
|
+
const mig: AddCredentialClaimOrderPostgres1768000000000 = new AddCredentialClaimOrderPostgres1768000000000()
|
|
18
|
+
await mig.up(queryRunner)
|
|
19
|
+
debug('Migration statements executed')
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
case 'sqlite':
|
|
23
|
+
case 'expo':
|
|
24
|
+
case 'react-native': {
|
|
25
|
+
debug('using sqlite/react-native migration file')
|
|
26
|
+
const mig: AddCredentialClaimOrderSqlite1768000000000 = new AddCredentialClaimOrderSqlite1768000000000()
|
|
27
|
+
await mig.up(queryRunner)
|
|
28
|
+
debug('Migration statements executed')
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return Promise.reject(
|
|
33
|
+
`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`,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
39
|
+
debug('migration: removing credential claim order column')
|
|
40
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
41
|
+
switch (dbType) {
|
|
42
|
+
case 'postgres': {
|
|
43
|
+
debug('using postgres migration file')
|
|
44
|
+
const mig: AddCredentialClaimOrderPostgres1768000000000 = new AddCredentialClaimOrderPostgres1768000000000()
|
|
45
|
+
await mig.down(queryRunner)
|
|
46
|
+
debug('Migration statements executed')
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
case 'sqlite':
|
|
50
|
+
case 'expo':
|
|
51
|
+
case 'react-native': {
|
|
52
|
+
debug('using sqlite/react-native migration file')
|
|
53
|
+
const mig: AddCredentialClaimOrderSqlite1768000000000 = new AddCredentialClaimOrderSqlite1768000000000()
|
|
54
|
+
await mig.down(queryRunner)
|
|
55
|
+
debug('Migration statements executed')
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
default:
|
|
59
|
+
return Promise.reject(
|
|
60
|
+
`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`,
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -8,6 +8,7 @@ import { AddLinkedVpFields1763387280000 } from './14-AddLinkedVpFields'
|
|
|
8
8
|
import { AddBrandingState1766000000000 } from './15-AddBrandingState'
|
|
9
9
|
import { AddServiceMetadata1764000000000 } from './15-AddServiceMetadata'
|
|
10
10
|
import { MakeOpenIdClientSecretNullable1767000000000 } from './16-MakeOpenIdClientSecretNullable'
|
|
11
|
+
import { AddCredentialClaimOrder1768000000000 } from './17-AddCredentialClaimOrder'
|
|
11
12
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
12
13
|
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
13
14
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
@@ -37,6 +38,7 @@ export const DataStoreIssuanceBrandingMigrations = [
|
|
|
37
38
|
CreateIssuanceBranding1659463079429,
|
|
38
39
|
FixCredentialClaimsReferencesUuid1741895822987,
|
|
39
40
|
AddBrandingState1766000000000,
|
|
41
|
+
AddCredentialClaimOrder1768000000000,
|
|
40
42
|
]
|
|
41
43
|
export const DataStoreStatusListMigrations = [
|
|
42
44
|
CreateStatusList1693866470000,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class AddCredentialClaimOrderPostgres1768000000000 implements MigrationInterface {
|
|
4
|
+
name = 'AddCredentialClaimOrder1768000000000'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims" ADD "order" integer`)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims" DROP COLUMN "order"`)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class AddCredentialClaimOrderSqlite1768000000000 implements MigrationInterface {
|
|
4
|
+
name = 'AddCredentialClaimOrder1768000000000'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims" ADD COLUMN "order" integer`)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
11
|
+
// SQLite doesn't support DROP COLUMN directly; recreate table without order
|
|
12
|
+
await queryRunner.query(`PRAGMA foreign_keys = OFF`)
|
|
13
|
+
await queryRunner.query(`
|
|
14
|
+
CREATE TABLE "CredentialClaims_old" (
|
|
15
|
+
"id" varchar PRIMARY KEY NOT NULL,
|
|
16
|
+
"key" varchar(255) NOT NULL,
|
|
17
|
+
"name" varchar(255) NOT NULL,
|
|
18
|
+
"credentialLocaleBrandingId" varchar,
|
|
19
|
+
CONSTRAINT "FK_CredentialClaims_credentialLocaleBrandingId" FOREIGN KEY ("credentialLocaleBrandingId") REFERENCES "BaseLocaleBranding" ("id") ON DELETE CASCADE ON UPDATE NO ACTION
|
|
20
|
+
)
|
|
21
|
+
`)
|
|
22
|
+
await queryRunner.query(`
|
|
23
|
+
INSERT INTO "CredentialClaims_old" ("id", "key", "name", "credentialLocaleBrandingId")
|
|
24
|
+
SELECT "id", "key", "name", "credentialLocaleBrandingId"
|
|
25
|
+
FROM "CredentialClaims"
|
|
26
|
+
`)
|
|
27
|
+
await queryRunner.query(`DROP TABLE "CredentialClaims"`)
|
|
28
|
+
await queryRunner.query(`ALTER TABLE "CredentialClaims_old" RENAME TO "CredentialClaims"`)
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`,
|
|
31
|
+
)
|
|
32
|
+
await queryRunner.query(`PRAGMA foreign_keys = ON`)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -65,6 +65,7 @@ export const credentialLocaleBrandingFromEntity = (localeBranding: CredentialLoc
|
|
|
65
65
|
id: claim.id,
|
|
66
66
|
key: claim.key,
|
|
67
67
|
name: claim.name,
|
|
68
|
+
...(claim.order != null && { order: claim.order }),
|
|
68
69
|
}))
|
|
69
70
|
: undefined,
|
|
70
71
|
} as ICredentialLocaleBranding
|
|
@@ -160,6 +161,7 @@ export const credentialClaimsEntityFrom = (args: IBasicCredentialClaim): Credent
|
|
|
160
161
|
const credentialClaimsEntity: CredentialClaimsEntity = new CredentialClaimsEntity()
|
|
161
162
|
credentialClaimsEntity.key = args.key
|
|
162
163
|
credentialClaimsEntity.name = args.name
|
|
164
|
+
credentialClaimsEntity.order = args.order
|
|
163
165
|
|
|
164
166
|
return credentialClaimsEntity
|
|
165
167
|
}
|