@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.data-store",
|
|
3
|
-
"version": "0.34.1-feature.SSISDK.
|
|
3
|
+
"version": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -28,11 +28,11 @@
|
|
|
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.34.1-feature.SSISDK.
|
|
32
|
-
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.
|
|
33
|
-
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.
|
|
34
|
-
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.
|
|
35
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.
|
|
31
|
+
"@sphereon/ssi-sdk-ext.did-utils": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
32
|
+
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
33
|
+
"@sphereon/ssi-sdk.agent-config": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
34
|
+
"@sphereon/ssi-sdk.core": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
35
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.46.40+f6339611",
|
|
36
36
|
"@veramo/core": "4.2.0",
|
|
37
37
|
"@veramo/utils": "4.2.0",
|
|
38
38
|
"blakejs": "^1.2.1",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"PostgreSQL",
|
|
66
66
|
"Contact Store"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f633961166543652ec09e4e194ed2bacbcb92602"
|
|
69
69
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Debug from 'debug'
|
|
3
|
-
import { DataSource, type FindOptionsOrder, type FindOptionsWhere, Repository } from 'typeorm'
|
|
4
|
-
|
|
5
|
-
import { digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs } from '../../src'
|
|
6
|
-
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
1
|
+
import { AbstractDigitalCredentialStore } from './AbstractDigitalCredentialStore'
|
|
7
2
|
import {
|
|
8
3
|
AddCredentialArgs,
|
|
4
|
+
CredentialRole,
|
|
9
5
|
CredentialStateType,
|
|
10
6
|
DigitalCredential,
|
|
11
7
|
GetCredentialArgs,
|
|
@@ -15,9 +11,13 @@ import {
|
|
|
15
11
|
RemoveCredentialArgs,
|
|
16
12
|
UpdateCredentialStateArgs,
|
|
17
13
|
} from '../types'
|
|
18
|
-
import {
|
|
14
|
+
import { OrPromise } from '@sphereon/ssi-types'
|
|
15
|
+
import { DataSource, type FindOptionsOrder, type FindOptionsWhere, Repository } from 'typeorm'
|
|
16
|
+
import Debug from 'debug'
|
|
17
|
+
import { DigitalCredentialEntity } from '../entities/digitalCredential/DigitalCredentialEntity'
|
|
19
18
|
|
|
20
|
-
import {
|
|
19
|
+
import { digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs } from '../../src'
|
|
20
|
+
import { parseAndValidateOrderOptions } from '../utils/SortingUtils'
|
|
21
21
|
|
|
22
22
|
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:credential-store')
|
|
23
23
|
|
|
@@ -78,7 +78,7 @@ export class DigitalCredentialStore extends AbstractDigitalCredentialStore {
|
|
|
78
78
|
return false
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
let query: FindOptionsWhere<DigitalCredentialEntity> = {}
|
|
82
82
|
|
|
83
83
|
if ('id' in args) {
|
|
84
84
|
query.id = args.id
|
|
@@ -17,8 +17,7 @@ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
|
17
17
|
import { CorrelationIdentifierEntity } from './CorrelationIdentifierEntity'
|
|
18
18
|
import { ConnectionEntity } from './ConnectionEntity'
|
|
19
19
|
import { IdentityMetadataItemEntity } from './IdentityMetadataItemEntity'
|
|
20
|
-
import { IdentityOrigin, ValidationConstraint } from '../../types'
|
|
21
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
20
|
+
import { CredentialRole, IdentityOrigin, ValidationConstraint } from '../../types'
|
|
22
21
|
import { PartyEntity } from './PartyEntity'
|
|
23
22
|
import { getConstraint } from '../../utils/ValidatorUtils'
|
|
24
23
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { typeormDate, typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
2
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
3
2
|
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
|
4
|
-
|
|
5
3
|
import {
|
|
6
4
|
CredentialCorrelationType,
|
|
7
5
|
CredentialDocumentFormat,
|
|
6
|
+
CredentialRole,
|
|
8
7
|
CredentialStateType,
|
|
9
8
|
type DigitalCredential,
|
|
10
9
|
DocumentType,
|
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
import Debug from 'debug'
|
|
2
1
|
import { DatabaseType, MigrationInterface, QueryRunner } from 'typeorm'
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
CreateBitstringStatusListPG1741895823000,
|
|
6
|
-
} from '../postgres/1741895823000-CreateBitstringStatusList'
|
|
2
|
+
import Debug from 'debug'
|
|
3
|
+
import { CreateBitstringStatusListPG1741895823000 } from '../postgres/1741895823000-CreateBitstringStatusList'
|
|
7
4
|
import { CreateBitstringStatusListSqlite1741895823001 } from '../sqlite/1741895823001-CreateBitstringStatusList'
|
|
8
5
|
|
|
9
6
|
const debug: Debug.Debugger = Debug('sphereon:ssi-sdk:migrations')
|
|
10
7
|
|
|
11
|
-
export class AddBitstringStatusListEnum1741895823000 implements MigrationInterface {
|
|
12
|
-
name = 'AddBitstringStatusListEnum1741895823000'
|
|
13
|
-
|
|
14
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
15
|
-
debug('migration: creating bitstring status list tables')
|
|
16
|
-
const dbType: DatabaseType = queryRunner.connection.driver.options.type
|
|
17
|
-
switch (dbType) {
|
|
18
|
-
case 'postgres': {
|
|
19
|
-
const mig = new AddBitstringStatusListEnumPG1741895823000()
|
|
20
|
-
await mig.up(queryRunner)
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
case 'sqlite':
|
|
24
|
-
case 'expo':
|
|
25
|
-
case 'react-native': {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
default:
|
|
29
|
-
return Promise.reject(`Migrations only supported for sqlite and postgres. Was ${dbType}`)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34
|
-
public async down(queryRunner: QueryRunner): Promise<void> {}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
8
|
export class CreateBitstringStatusList1741895823000 implements MigrationInterface {
|
|
38
9
|
name = 'CreateBitstringStatusList1741895823000'
|
|
39
10
|
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { CreateContacts1659463079429 } from './1-CreateContacts'
|
|
2
|
-
import { CreatePresentationDefinitions1716533767523 } from './10-CreatePresentationDefinitions'
|
|
3
|
-
import { FixCredentialClaimsReferencesUuid1741895822987 } from './11-FixCredentialClaimsReferenceUuid'
|
|
4
|
-
import { AddBitstringStatusListEnum1741895823000, CreateBitstringStatusList1741895823000 } from './12-CreateBitstringStatusList'
|
|
5
2
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding'
|
|
6
3
|
import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
7
4
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
@@ -10,6 +7,9 @@ import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredentia
|
|
|
10
7
|
import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
|
|
11
8
|
import { CreateContacts1708525189000 } from './8-CreateContacts'
|
|
12
9
|
import { CreateContacts1715761125000 } from './9-CreateContacts'
|
|
10
|
+
import { CreatePresentationDefinitions1716533767523 } from './10-CreatePresentationDefinitions'
|
|
11
|
+
import { FixCredentialClaimsReferencesUuid1741895822987 } from './11-FixCredentialClaimsReferenceUuid'
|
|
12
|
+
import { CreateBitstringStatusList1741895823000 } from './12-CreateBitstringStatusList'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
@@ -27,11 +27,7 @@ export const DataStoreContactMigrations = [
|
|
|
27
27
|
CreateContacts1715761125000,
|
|
28
28
|
]
|
|
29
29
|
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429, FixCredentialClaimsReferencesUuid1741895822987]
|
|
30
|
-
export const DataStoreStatusListMigrations = [
|
|
31
|
-
CreateStatusList1693866470000,
|
|
32
|
-
AddBitstringStatusListEnum1741895823000,
|
|
33
|
-
CreateBitstringStatusList1741895823000,
|
|
34
|
-
]
|
|
30
|
+
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000, CreateBitstringStatusList1741895823000]
|
|
35
31
|
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
36
32
|
export const DataStoreDigitalCredentialMigrations = [CreateDigitalCredential1708525189000]
|
|
37
33
|
export const DataStoreMachineStateMigrations = [CreateMachineStateStore1708098041262]
|
|
@@ -10,7 +10,7 @@ export class UpdateStatusList1737110469001 implements MigrationInterface {
|
|
|
10
10
|
// Make columns nullable and add new columns
|
|
11
11
|
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "indexingDirection" DROP NOT NULL`)
|
|
12
12
|
await queryRunner.query(`ALTER TABLE "StatusList" ALTER COLUMN "statusPurpose" DROP NOT NULL`)
|
|
13
|
-
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD "bitsPerStatus" integer`)
|
|
14
14
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD "expiresAt" timestamp with time zone`)
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
2
|
|
|
3
|
-
export class AddBitstringStatusListEnumPG1741895823000 implements MigrationInterface {
|
|
4
|
-
name = 'AddBitstringStatusListEnum1741895823000'
|
|
5
|
-
|
|
6
|
-
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
-
await queryRunner.startTransaction()
|
|
8
|
-
await queryRunner.query(`ALTER TYPE "StatusList_type_enum" ADD VALUE 'BitstringStatusList'`)
|
|
9
|
-
await queryRunner.commitTransaction()
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
-
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
14
|
-
// Note: Cannot remove enum value in Postgres without recreating the type
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
3
|
export class CreateBitstringStatusListPG1741895823000 implements MigrationInterface {
|
|
19
4
|
name = 'CreateBitstringStatusList1741895823000'
|
|
20
5
|
|
|
21
6
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
22
7
|
// Add BitstringStatusList columns to StatusList table
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`)
|
|
23
9
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "ttl" integer`)
|
|
24
10
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validFrom" TIMESTAMP`)
|
|
25
11
|
await queryRunner.query(`ALTER TABLE "StatusList" ADD COLUMN "validUntil" TIMESTAMP`)
|
|
@@ -35,6 +21,7 @@ export class CreateBitstringStatusListPG1741895823000 implements MigrationInterf
|
|
|
35
21
|
|
|
36
22
|
// Add BitstringStatusListEntry specific columns to StatusListEntry table
|
|
37
23
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusPurpose" character varying`)
|
|
24
|
+
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "bitsPerStatus" integer DEFAULT 1`)
|
|
38
25
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusMessage" text`)
|
|
39
26
|
await queryRunner.query(`ALTER TABLE "StatusListEntry" ADD COLUMN "statusReference" text`)
|
|
40
27
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ManagedIdentifierOptsOrResult } from '@sphereon/ssi-sdk-ext.identifier-resolution'
|
|
2
2
|
import { IIdentifier } from '@veramo/core'
|
|
3
3
|
import { IIssuerLocaleBranding } from '../issuanceBranding/issuanceBranding'
|
|
4
|
-
import { CredentialRole } from '
|
|
4
|
+
import { CredentialRole } from '../digitalCredential'
|
|
5
5
|
|
|
6
6
|
export type MetadataTypes = string | number | Date | boolean | undefined
|
|
7
7
|
|
|
@@ -2,8 +2,7 @@ import { HasherSync } from '@sphereon/ssi-types'
|
|
|
2
2
|
import { FindOptionsOrder } from 'typeorm'
|
|
3
3
|
import { DigitalCredentialEntity } from '../../entities/digitalCredential/DigitalCredentialEntity'
|
|
4
4
|
import { DigitalCredential } from './types'
|
|
5
|
-
import { CredentialCorrelationType, CredentialStateType, RegulationType } from './enums'
|
|
6
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
5
|
+
import { CredentialCorrelationType, CredentialRole, CredentialStateType, RegulationType } from './enums'
|
|
7
6
|
|
|
8
7
|
export type GetCredentialArgs = { id: string } | { hash: string }
|
|
9
8
|
|
|
@@ -38,7 +38,7 @@ export namespace CredentialDocumentFormat {
|
|
|
38
38
|
export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
|
|
39
39
|
switch (documentFormat) {
|
|
40
40
|
case CredentialDocumentFormat.SD_JWT:
|
|
41
|
-
return '
|
|
41
|
+
return 'vc+sd-jwt'
|
|
42
42
|
case CredentialDocumentFormat.MSO_MDOC:
|
|
43
43
|
return 'mso_mdoc'
|
|
44
44
|
case CredentialDocumentFormat.JSON_LD:
|
|
@@ -56,6 +56,13 @@ export enum CredentialCorrelationType {
|
|
|
56
56
|
URL = 'URL',
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
export enum CredentialRole {
|
|
60
|
+
ISSUER = 'ISSUER',
|
|
61
|
+
VERIFIER = 'VERIFIER',
|
|
62
|
+
HOLDER = 'HOLDER',
|
|
63
|
+
FEDERATION_TRUST_ANCHOR = 'FEDERATION_TRUST_ANCHOR',
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
export enum CredentialStateType {
|
|
60
67
|
REVOKED = 'REVOKED',
|
|
61
68
|
VERIFIED = 'VERIFIED',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialStateType, DocumentType, RegulationType } from './enums'
|
|
2
|
-
import { CredentialRole } from '@sphereon/ssi-types'
|
|
1
|
+
import { CredentialCorrelationType, CredentialDocumentFormat, CredentialRole, CredentialStateType, DocumentType, RegulationType } from './enums'
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* DigitalCredential
|