@sphereon/ssi-sdk.data-store 0.36.1-next.149 → 0.36.1-next.150
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 +199 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +199 -97
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/entities/contact/OpenIdConfigEntity.ts +2 -2
- package/src/migrations/generic/16-MakeOpenIdClientSecretNullable.ts +62 -0
- package/src/migrations/generic/index.ts +2 -0
- package/src/migrations/postgres/1767000000001-MakeOpenIdClientSecretNullable.ts +32 -0
- package/src/migrations/sqlite/1767000000002-MakeOpenIdClientSecretNullable.ts +22 -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.150+f7fd1f3f",
|
|
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.150+f7fd1f3f",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.36.1-next.150+f7fd1f3f",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.36.1-next.150+f7fd1f3f",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.36.1-next.150+f7fd1f3f",
|
|
35
|
+
"@sphereon/ssi-sdk.data-store-types": "0.36.1-next.150+f7fd1f3f",
|
|
36
|
+
"@sphereon/ssi-types": "0.36.1-next.150+f7fd1f3f",
|
|
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": "f7fd1f3f7e42d569b2695b54aa2587fa4926310d"
|
|
71
71
|
}
|
|
@@ -6,8 +6,8 @@ export class OpenIdConfigEntity extends BaseConfigEntity {
|
|
|
6
6
|
@Column('varchar', { name: 'client_id', length: 255, nullable: false })
|
|
7
7
|
clientId!: string
|
|
8
8
|
|
|
9
|
-
@Column('varchar', { name: 'client_secret', length: 255, nullable:
|
|
10
|
-
clientSecret
|
|
9
|
+
@Column('varchar', { name: 'client_secret', length: 255, nullable: true })
|
|
10
|
+
clientSecret?: string
|
|
11
11
|
|
|
12
12
|
@Column('simple-array', { name: 'scopes', nullable: false })
|
|
13
13
|
scopes!: Array<string>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Debug, { Debugger } from 'debug'
|
|
2
|
+
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
import { MakeOpenIdClientSecretNullable1767000000001 } from '../postgres/1767000000001-MakeOpenIdClientSecretNullable'
|
|
4
|
+
import { MakeOpenIdClientSecretNullable1767000000002 } from '../sqlite/1767000000002-MakeOpenIdClientSecretNullable'
|
|
5
|
+
|
|
6
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
7
|
+
|
|
8
|
+
export class MakeOpenIdClientSecretNullable1767000000000 implements MigrationInterface {
|
|
9
|
+
name: string = 'MakeOpenIdClientSecretNullable1767000000000'
|
|
10
|
+
|
|
11
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
12
|
+
debug('migration: making client_secret nullable in BaseConfig table')
|
|
13
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
14
|
+
|
|
15
|
+
switch (dbType) {
|
|
16
|
+
case 'postgres': {
|
|
17
|
+
debug('using postgres migration file for MakeOpenIdClientSecretNullable')
|
|
18
|
+
const mig = new MakeOpenIdClientSecretNullable1767000000001()
|
|
19
|
+
await mig.up(queryRunner)
|
|
20
|
+
debug('Postgres migration statements for MakeOpenIdClientSecretNullable executed')
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
case 'sqlite':
|
|
24
|
+
case 'expo':
|
|
25
|
+
case 'react-native': {
|
|
26
|
+
debug('using sqlite/react-native migration file for MakeOpenIdClientSecretNullable')
|
|
27
|
+
const mig = new MakeOpenIdClientSecretNullable1767000000002()
|
|
28
|
+
await mig.up(queryRunner)
|
|
29
|
+
debug('SQLite migration statements for MakeOpenIdClientSecretNullable executed')
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
return Promise.reject(
|
|
34
|
+
`Migrations are currently only supported for sqlite, react-native, expo, and postgres for MakeOpenIdClientSecretNullable. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
40
|
+
debug('migration: reverting client_secret nullable in BaseConfig table')
|
|
41
|
+
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
42
|
+
|
|
43
|
+
switch (dbType) {
|
|
44
|
+
case 'postgres': {
|
|
45
|
+
const mig = new MakeOpenIdClientSecretNullable1767000000001()
|
|
46
|
+
await mig.down(queryRunner)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
case 'sqlite':
|
|
50
|
+
case 'expo':
|
|
51
|
+
case 'react-native': {
|
|
52
|
+
const mig = new MakeOpenIdClientSecretNullable1767000000002()
|
|
53
|
+
await mig.down(queryRunner)
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
default:
|
|
57
|
+
return Promise.reject(
|
|
58
|
+
`Migrations are currently only supported for sqlite, react-native, expo, and postgres for MakeOpenIdClientSecretNullable. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`,
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -7,6 +7,7 @@ import { CreateDcqlQueryItem1726617600000 } from './13-CreateDcqlQueryItem'
|
|
|
7
7
|
import { AddLinkedVpFields1763387280000 } from './14-AddLinkedVpFields'
|
|
8
8
|
import { AddBrandingState1766000000000 } from './15-AddBrandingState'
|
|
9
9
|
import { AddServiceMetadata1764000000000 } from './15-AddServiceMetadata'
|
|
10
|
+
import { MakeOpenIdClientSecretNullable1767000000000 } from './16-MakeOpenIdClientSecretNullable'
|
|
10
11
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
11
12
|
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
12
13
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
@@ -30,6 +31,7 @@ export const DataStoreContactMigrations = [
|
|
|
30
31
|
CreateContacts1690925872318,
|
|
31
32
|
CreateContacts1708525189000,
|
|
32
33
|
CreateContacts1715761125000,
|
|
34
|
+
MakeOpenIdClientSecretNullable1767000000000,
|
|
33
35
|
]
|
|
34
36
|
export const DataStoreIssuanceBrandingMigrations = [
|
|
35
37
|
CreateIssuanceBranding1659463079429,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Debug, { Debugger } from 'debug'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
5
|
+
|
|
6
|
+
export class MakeOpenIdClientSecretNullable1767000000001 implements MigrationInterface {
|
|
7
|
+
name = 'MakeOpenIdClientSecretNullable1767000000001'
|
|
8
|
+
|
|
9
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
10
|
+
const table = await queryRunner.getTable('BaseConfig')
|
|
11
|
+
if (!table) {
|
|
12
|
+
debug('MakeOpenIdClientSecretNullable: Skipping migration - BaseConfig table does not exist')
|
|
13
|
+
return
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const column = table.columns.find((col) => col.name === 'client_secret')
|
|
17
|
+
if (column && !column.isNullable) {
|
|
18
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ALTER COLUMN "client_secret" DROP NOT NULL`)
|
|
19
|
+
debug('MakeOpenIdClientSecretNullable: Made client_secret nullable')
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
+
const table = await queryRunner.getTable('BaseConfig')
|
|
25
|
+
if (!table) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await queryRunner.query(`UPDATE "BaseConfig" SET "client_secret" = '' WHERE "client_secret" IS NULL`)
|
|
30
|
+
await queryRunner.query(`ALTER TABLE "BaseConfig" ALTER COLUMN "client_secret" SET NOT NULL`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Debug, { Debugger } from 'debug'
|
|
2
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
const debug: Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
5
|
+
|
|
6
|
+
export class MakeOpenIdClientSecretNullable1767000000002 implements MigrationInterface {
|
|
7
|
+
name = 'MakeOpenIdClientSecretNullable1767000000002'
|
|
8
|
+
|
|
9
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
10
|
+
// SQLite columns added via ALTER TABLE are already nullable by default,
|
|
11
|
+
// and SQLite does not enforce NOT NULL changes via ALTER COLUMN.
|
|
12
|
+
// Since client_secret was originally created as NOT NULL, we need to recreate.
|
|
13
|
+
// However, SQLite in practice allows NULL values in NOT NULL columns when
|
|
14
|
+
// inserted via raw queries, and TypeORM's synchronize handles this.
|
|
15
|
+
// For safety, we simply ensure existing rows have an empty string if null.
|
|
16
|
+
debug('MakeOpenIdClientSecretNullable: SQLite does not support ALTER COLUMN, no action needed for nullable change')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
20
|
+
// No action needed
|
|
21
|
+
}
|
|
22
|
+
}
|