@sphereon/ssi-sdk.data-store 0.34.1-next.3 → 0.34.1-next.323

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.
Files changed (116) hide show
  1. package/dist/index.cjs +3377 -2924
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +357 -1203
  4. package/dist/index.d.ts +357 -1203
  5. package/dist/index.js +3300 -2847
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -9
  8. package/src/__tests__/contact.entities.test.ts +4 -10
  9. package/src/__tests__/contact.store.test.ts +11 -6
  10. package/src/__tests__/digitalCredential.entities.test.ts +13 -6
  11. package/src/__tests__/digitalCredential.store.test.ts +6 -6
  12. package/src/__tests__/eventLogger.entities.test.ts +3 -3
  13. package/src/__tests__/eventLogger.store.test.ts +9 -4
  14. package/src/__tests__/issuanceBranding.entities.test.ts +2 -2
  15. package/src/__tests__/issuanceBranding.store.test.ts +3 -3
  16. package/src/__tests__/machineState.entities.test.ts +1 -1
  17. package/src/__tests__/machineState.store.test.ts +1 -1
  18. package/src/__tests__/pd-manager.entities.test.ts +27 -98
  19. package/src/__tests__/pd-manager.store.test.ts +151 -101
  20. package/src/__tests__/statusList.entities.test.ts +61 -4
  21. package/src/__tests__/statusList.store.test.ts +67 -4
  22. package/src/contact/ContactStore.ts +35 -35
  23. package/src/digitalCredential/DigitalCredentialStore.ts +6 -7
  24. package/src/entities/contact/BaseConfigEntity.ts +2 -2
  25. package/src/entities/contact/BaseContactEntity.ts +4 -5
  26. package/src/entities/contact/ConnectionEntity.ts +4 -4
  27. package/src/entities/contact/ContactMetadataItemEntity.ts +3 -4
  28. package/src/entities/contact/CorrelationIdentifierEntity.ts +3 -4
  29. package/src/entities/contact/DidAuthConfigEntity.ts +1 -2
  30. package/src/entities/contact/ElectronicAddressEntity.ts +15 -5
  31. package/src/entities/contact/IdentityEntity.ts +12 -11
  32. package/src/entities/contact/IdentityMetadataItemEntity.ts +3 -3
  33. package/src/entities/contact/NaturalPersonEntity.ts +5 -5
  34. package/src/entities/contact/OrganizationEntity.ts +1 -1
  35. package/src/entities/contact/PartyEntity.ts +7 -7
  36. package/src/entities/contact/PartyRelationshipEntity.ts +8 -8
  37. package/src/entities/contact/PartyTypeEntity.ts +4 -4
  38. package/src/entities/contact/PhysicalAddressEntity.ts +3 -3
  39. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +4 -3
  40. package/src/entities/eventLogger/AuditEventEntity.ts +2 -2
  41. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +2 -2
  42. package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +6 -7
  43. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +2 -2
  44. package/src/entities/issuanceBranding/CredentialClaimsEntity.ts +2 -2
  45. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +2 -2
  46. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +2 -2
  47. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +2 -2
  48. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +3 -3
  49. package/src/entities/issuanceBranding/TextAttributesEntity.ts +1 -1
  50. package/src/entities/machineState/MachineStateInfoEntity.ts +1 -1
  51. package/src/entities/presentationDefinition/{PresentationDefinitionItemEntity.ts → DcqlQueryItemEntity.ts} +10 -14
  52. package/src/entities/statusList/BitstringStatusListEntryEntity.ts +60 -0
  53. package/src/entities/statusList/StatusList2021EntryEntity.ts +4 -3
  54. package/src/entities/statusList/StatusListEntities.ts +55 -7
  55. package/src/eventLogger/EventLoggerStore.ts +2 -2
  56. package/src/index.ts +31 -26
  57. package/src/issuanceBranding/IssuanceBrandingStore.ts +25 -25
  58. package/src/machineState/MachineStateStore.ts +7 -7
  59. package/src/migrations/generic/1-CreateContacts.ts +1 -1
  60. package/src/migrations/generic/10-CreatePresentationDefinitions.ts +1 -1
  61. package/src/migrations/generic/11-FixCredentialClaimsReferenceUuid.ts +2 -2
  62. package/src/migrations/generic/12-CreateBitstringStatusList.ts +82 -0
  63. package/src/migrations/generic/13-CreateDcqlQueryItem.ts +67 -0
  64. package/src/migrations/generic/2-CreateIssuanceBranding.ts +1 -1
  65. package/src/migrations/generic/3-CreateContacts.ts +2 -2
  66. package/src/migrations/generic/4-CreateStatusList.ts +1 -1
  67. package/src/migrations/generic/5-CreateAuditEvents.ts +2 -2
  68. package/src/migrations/generic/6-CreateDigitalCredential.ts +1 -1
  69. package/src/migrations/generic/7-CreateMachineStateStore.ts +1 -1
  70. package/src/migrations/generic/8-CreateContacts.ts +1 -1
  71. package/src/migrations/generic/9-CreateContacts.ts +1 -1
  72. package/src/migrations/generic/index.ts +10 -4
  73. package/src/migrations/postgres/1659463079428-CreateContacts.ts +1 -1
  74. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +1 -1
  75. package/src/migrations/postgres/1690925872592-CreateContacts.ts +1 -1
  76. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +1 -1
  77. package/src/migrations/postgres/1726588800000-CreateDcqlQueryItem.ts +25 -0
  78. package/src/migrations/postgres/1737110469001-UpdateStatusList.ts +1 -1
  79. package/src/migrations/postgres/1741895823000-CreateBitstringStatusList.ts +67 -0
  80. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +1 -1
  81. package/src/migrations/sqlite/1726617600000-CreateDcqlQueryItem.ts +24 -0
  82. package/src/migrations/sqlite/1741895823001-CreateBitstringStatusList.ts +145 -0
  83. package/src/presentationDefinition/PDStore.ts +45 -45
  84. package/src/statusList/IStatusListStore.ts +14 -11
  85. package/src/statusList/StatusListStore.ts +74 -36
  86. package/src/types/index.ts +0 -12
  87. package/src/types/statusList/IAbstractStatusListStore.ts +55 -5
  88. package/src/types/statusList/statusList.ts +50 -2
  89. package/src/utils/ValidatorUtils.ts +1 -1
  90. package/src/utils/contact/MappingUtils.ts +10 -10
  91. package/src/utils/digitalCredential/MappingUtils.ts +3 -21
  92. package/src/utils/eventLogger/MappingUtils.ts +2 -2
  93. package/src/utils/issuanceBranding/MappingUtils.ts +13 -13
  94. package/src/utils/presentationDefinition/MappingUtils.ts +31 -22
  95. package/src/utils/statusList/MappingUtils.ts +71 -30
  96. package/src/contact/AbstractContactStore.ts +0 -71
  97. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +0 -21
  98. package/src/eventLogger/AbstractEventLoggerStore.ts +0 -9
  99. package/src/issuanceBranding/AbstractIssuanceBrandingStore.ts +0 -41
  100. package/src/machineState/IAbstractMachineStateStore.ts +0 -65
  101. package/src/presentationDefinition/AbstractPDStore.ts +0 -20
  102. package/src/types/contact/IAbstractContactStore.ts +0 -161
  103. package/src/types/contact/contact.ts +0 -295
  104. package/src/types/contact/index.ts +0 -2
  105. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +0 -43
  106. package/src/types/digitalCredential/enums.ts +0 -70
  107. package/src/types/digitalCredential/index.ts +0 -3
  108. package/src/types/digitalCredential/types.ts +0 -39
  109. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +0 -22
  110. package/src/types/eventLogger/eventLogger.ts +0 -4
  111. package/src/types/issuanceBranding/IAbstractIssuanceBrandingStore.ts +0 -85
  112. package/src/types/issuanceBranding/issuanceBranding.ts +0 -138
  113. package/src/types/machineState/IAbstractMachineStateStore.ts +0 -68
  114. package/src/types/presentationDefinition/IAbstractPDStore.ts +0 -25
  115. package/src/types/presentationDefinition/presentationDefinition.ts +0 -19
  116. package/src/types/validation/validation.ts +0 -3
@@ -1,10 +1,9 @@
1
- import typeorm from 'typeorm'
2
- const { Entity, Column, PrimaryGeneratedColumn, BaseEntity, ManyToOne, BeforeInsert, BeforeUpdate } = typeorm
3
- import { IMetadataEntity, ValidationConstraint } from '../../types'
4
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
5
- import { BaseContactEntity } from './BaseContactEntity'
2
+ import { IMetadataEntity, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
6
3
  import { IsNotEmpty, validate, ValidationError } from 'class-validator'
4
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
7
5
  import { getConstraint } from '../../utils/ValidatorUtils'
6
+ import { BaseContactEntity } from './BaseContactEntity'
8
7
 
9
8
  @Entity('ContactMetadata')
10
9
  export class ContactMetadataItemEntity extends BaseEntity implements IMetadataEntity {
@@ -1,9 +1,8 @@
1
- import typeorm from 'typeorm'
2
- const { Entity, Column, PrimaryGeneratedColumn, BaseEntity, OneToOne, JoinColumn, BeforeInsert, BeforeUpdate } = typeorm
3
- import { CorrelationIdentifierType, ValidationConstraint } from '../../types'
4
- import { IdentityEntity } from './IdentityEntity'
1
+ import { CorrelationIdentifierType, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
5
2
  import { IsNotEmpty, validate, ValidationError } from 'class-validator'
3
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
6
4
  import { getConstraint } from '../../utils/ValidatorUtils'
5
+ import { IdentityEntity } from './IdentityEntity'
7
6
 
8
7
  @Entity('CorrelationIdentifier')
9
8
  export class CorrelationIdentifierEntity extends BaseEntity {
@@ -1,5 +1,4 @@
1
- import typeorm from 'typeorm'
2
- const { ChildEntity, Column } = typeorm
1
+ import { ChildEntity, Column } from 'typeorm'
3
2
  import { BaseConfigEntity } from './BaseConfigEntity'
4
3
 
5
4
  @ChildEntity('DidAuthConfig')
@@ -1,10 +1,20 @@
1
- import { IsNotEmpty, validate, ValidationError } from 'class-validator'
2
- import typeorm from 'typeorm'
3
- const { Entity, Column, PrimaryGeneratedColumn, BaseEntity, ManyToOne, BeforeInsert, BeforeUpdate, CreateDateColumn, UpdateDateColumn } = typeorm
4
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
5
- import type { ElectronicAddressType, ValidationConstraint } from '../../types/index'
6
- import { PartyEntity } from './PartyEntity'
2
+ import type { ElectronicAddressType, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
3
+ import { IsNotEmpty, validate, ValidationError } from 'class-validator'
4
+
5
+ import {
6
+ BaseEntity,
7
+ BeforeInsert,
8
+ BeforeUpdate,
9
+ Column,
10
+ CreateDateColumn,
11
+ Entity,
12
+ ManyToOne,
13
+ PrimaryGeneratedColumn,
14
+ UpdateDateColumn,
15
+ } from 'typeorm'
7
16
  import { getConstraint } from '../../utils/ValidatorUtils'
17
+ import { PartyEntity } from './PartyEntity'
8
18
 
9
19
  @Entity('ElectronicAddress')
10
20
  export class ElectronicAddressEntity extends BaseEntity {
@@ -1,25 +1,26 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { IdentityOrigin, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
3
+ import { CredentialRole } from '@sphereon/ssi-types'
4
+ import { IsNotEmpty, validate, ValidationError } from 'class-validator'
1
5
  import {
2
6
  BaseEntity,
7
+ BeforeInsert,
8
+ BeforeUpdate,
9
+ Column,
3
10
  CreateDateColumn,
4
11
  Entity,
5
- PrimaryGeneratedColumn,
6
- UpdateDateColumn,
7
- OneToOne,
8
12
  JoinColumn,
9
13
  ManyToOne,
10
- Column,
11
14
  OneToMany,
12
- BeforeInsert,
13
- BeforeUpdate,
15
+ OneToOne,
16
+ PrimaryGeneratedColumn,
17
+ UpdateDateColumn,
14
18
  } from 'typeorm'
15
- import { IsNotEmpty, validate, ValidationError } from 'class-validator'
16
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
17
- import { CorrelationIdentifierEntity } from './CorrelationIdentifierEntity'
19
+ import { getConstraint } from '../../utils/ValidatorUtils'
18
20
  import { ConnectionEntity } from './ConnectionEntity'
21
+ import { CorrelationIdentifierEntity } from './CorrelationIdentifierEntity'
19
22
  import { IdentityMetadataItemEntity } from './IdentityMetadataItemEntity'
20
- import { CredentialRole, IdentityOrigin, ValidationConstraint } from '../../types'
21
23
  import { PartyEntity } from './PartyEntity'
22
- import { getConstraint } from '../../utils/ValidatorUtils'
23
24
 
24
25
  @Entity('Identity')
25
26
  export class IdentityEntity extends BaseEntity {
@@ -1,9 +1,9 @@
1
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
- import { Entity, Column, PrimaryGeneratedColumn, BaseEntity, ManyToOne, BeforeInsert, BeforeUpdate } from 'typeorm'
3
- import { IMetadataEntity, ValidationConstraint } from '../../types'
4
- import { IdentityEntity } from './IdentityEntity'
2
+ import { IMetadataEntity, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
5
3
  import { IsNotEmpty, validate, ValidationError } from 'class-validator'
4
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
6
5
  import { getConstraint } from '../../utils/ValidatorUtils'
6
+ import { IdentityEntity } from './IdentityEntity'
7
7
 
8
8
  @Entity('IdentityMetadata')
9
9
  export class IdentityMetadataItemEntity extends BaseEntity implements IMetadataEntity {
@@ -1,9 +1,9 @@
1
- import { Column, ChildEntity, BeforeInsert, BeforeUpdate } from 'typeorm'
2
- import { BaseContactEntity } from './BaseContactEntity'
3
- import { ValidationConstraint } from '../../types'
4
- import { validate, IsNotEmpty, ValidationError, Validate } from 'class-validator'
5
- import { IsNonEmptyStringConstraint } from '../validators'
1
+ import { ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
2
+ import { IsNotEmpty, validate, Validate, ValidationError } from 'class-validator'
3
+ import { BeforeInsert, BeforeUpdate, ChildEntity, Column } from 'typeorm'
6
4
  import { getConstraint } from '../../utils/ValidatorUtils'
5
+ import { IsNonEmptyStringConstraint } from '../validators'
6
+ import { BaseContactEntity } from './BaseContactEntity'
7
7
 
8
8
  @ChildEntity('NaturalPerson')
9
9
  export class NaturalPersonEntity extends BaseContactEntity {
@@ -1,6 +1,6 @@
1
+ import { ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
1
2
  import { IsNotEmpty, validate, ValidationError } from 'class-validator'
2
3
  import { BeforeInsert, BeforeUpdate, ChildEntity, Column } from 'typeorm'
3
- import { ValidationConstraint } from '../../types'
4
4
  import { getConstraint } from '../../utils/ValidatorUtils'
5
5
  import { BaseContactEntity } from './BaseContactEntity'
6
6
 
@@ -1,3 +1,6 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
3
+ import { validate, ValidationError } from 'class-validator'
1
4
  import {
2
5
  BaseEntity,
3
6
  BeforeInsert,
@@ -12,15 +15,12 @@ import {
12
15
  PrimaryGeneratedColumn,
13
16
  UpdateDateColumn,
14
17
  } from 'typeorm'
15
- import { ValidationConstraint } from '../../types'
16
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
17
- import { IdentityEntity } from './IdentityEntity'
18
- import { validate, ValidationError } from 'class-validator'
19
- import { PartyTypeEntity } from './PartyTypeEntity'
20
- import { BaseContactEntity } from './BaseContactEntity'
21
- import { PartyRelationshipEntity } from './PartyRelationshipEntity'
22
18
  import { getConstraint } from '../../utils/ValidatorUtils'
19
+ import { BaseContactEntity } from './BaseContactEntity'
23
20
  import { ElectronicAddressEntity } from './ElectronicAddressEntity'
21
+ import { IdentityEntity } from './IdentityEntity'
22
+ import { PartyRelationshipEntity } from './PartyRelationshipEntity'
23
+ import { PartyTypeEntity } from './PartyTypeEntity'
24
24
  import { PhysicalAddressEntity } from './PhysicalAddressEntity'
25
25
 
26
26
  @Entity('Party')
@@ -1,16 +1,16 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
1
2
  import {
2
- Entity,
3
- PrimaryGeneratedColumn,
4
- CreateDateColumn,
5
- UpdateDateColumn,
6
- ManyToOne,
7
- Column,
8
- Index,
9
3
  BeforeInsert,
10
4
  BeforeUpdate,
5
+ Column,
6
+ CreateDateColumn,
7
+ Entity,
8
+ Index,
11
9
  JoinColumn,
10
+ ManyToOne,
11
+ PrimaryGeneratedColumn,
12
+ UpdateDateColumn,
12
13
  } from 'typeorm'
13
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
14
14
  import { PartyEntity } from './PartyEntity'
15
15
 
16
16
  @Entity('PartyRelationship')
@@ -1,10 +1,10 @@
1
- import { BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
3
- import { PartyEntity } from './PartyEntity'
4
- import { PartyOrigin, PartyTypeType, ValidationConstraint } from '../../types'
2
+ import { PartyOrigin, PartyTypeType, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
5
3
  import { IsNotEmpty, Validate, validate, ValidationError } from 'class-validator'
6
- import { IsNonEmptyStringConstraint } from '../validators'
4
+ import { BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
7
5
  import { getConstraint } from '../../utils/ValidatorUtils'
6
+ import { IsNonEmptyStringConstraint } from '../validators'
7
+ import { PartyEntity } from './PartyEntity'
8
8
 
9
9
  @Entity('PartyType')
10
10
  @Index('IDX_PartyType_type_tenant_id', ['type', 'tenantId'], { unique: true })
@@ -1,3 +1,5 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import type { PhysicalAddressType, ValidationConstraint } from '@sphereon/ssi-sdk.data-store-types'
1
3
  import { IsNotEmpty, Validate, validate, ValidationError } from 'class-validator'
2
4
  import {
3
5
  BaseEntity,
@@ -10,11 +12,9 @@ import {
10
12
  PrimaryGeneratedColumn,
11
13
  UpdateDateColumn,
12
14
  } from 'typeorm'
13
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
14
15
  import { getConstraint } from '../../utils/ValidatorUtils'
15
- import type { PhysicalAddressType, ValidationConstraint } from '../../types/index'
16
- import { PartyEntity } from './PartyEntity'
17
16
  import { IsNonEmptyStringConstraint } from '../validators'
17
+ import { PartyEntity } from './PartyEntity'
18
18
 
19
19
  @Entity('PhysicalAddress')
20
20
  export class PhysicalAddressEntity extends BaseEntity {
@@ -1,14 +1,15 @@
1
1
  import { typeormDate, typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
- import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
+
3
3
  import {
4
4
  CredentialCorrelationType,
5
5
  CredentialDocumentFormat,
6
- CredentialRole,
7
6
  CredentialStateType,
8
7
  type DigitalCredential,
9
8
  DocumentType,
10
9
  RegulationType,
11
- } from '../../types'
10
+ } from '@sphereon/ssi-sdk.data-store-types'
11
+ import { CredentialRole } from '@sphereon/ssi-types'
12
+ import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
12
13
 
13
14
  @Entity('DigitalCredential')
14
15
  export class DigitalCredentialEntity extends BaseEntity implements DigitalCredential {
@@ -1,3 +1,5 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
1
3
  import {
2
4
  type ActionSubType,
3
5
  ActionType,
@@ -8,8 +10,6 @@ import {
8
10
  System,
9
11
  SystemCorrelationIdType,
10
12
  } from '@sphereon/ssi-types'
11
- import { CredentialType, PartyCorrelationType } from '@sphereon/ssi-sdk.core'
12
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
13
13
  import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
14
14
 
15
15
  //TODO this entity, also contains some optional fields that are related to another event type (Activity) later we might want to refactor and reorganize this.
@@ -1,7 +1,7 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { ImageAttributesEntity } from './ImageAttributesEntity'
3
1
  import { validate, Validate, ValidationError } from 'class-validator'
2
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
4
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
+ import { ImageAttributesEntity } from './ImageAttributesEntity'
5
5
 
6
6
  @Entity('BackgroundAttributes')
7
7
  export class BackgroundAttributesEntity extends BaseEntity {
@@ -1,5 +1,6 @@
1
- import typeorm from 'typeorm'
2
- const {
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { validate, Validate, ValidationError } from 'class-validator'
3
+ import {
3
4
  BaseEntity,
4
5
  BeforeInsert,
5
6
  BeforeUpdate,
@@ -11,13 +12,11 @@ const {
11
12
  PrimaryGeneratedColumn,
12
13
  TableInheritance,
13
14
  UpdateDateColumn,
14
- } = typeorm
15
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
16
- import { ImageAttributesEntity } from './ImageAttributesEntity'
15
+ } from 'typeorm'
16
+ import { IsNonEmptyStringConstraint } from '../validators'
17
17
  import { BackgroundAttributesEntity } from './BackgroundAttributesEntity'
18
+ import { ImageAttributesEntity } from './ImageAttributesEntity'
18
19
  import { TextAttributesEntity } from './TextAttributesEntity'
19
- import { validate, Validate, ValidationError } from 'class-validator'
20
- import { IsNonEmptyStringConstraint } from '../validators'
21
20
 
22
21
  @Entity('BaseLocaleBranding')
23
22
  @TableInheritance({ column: { type: 'varchar', name: 'type' } })
@@ -1,3 +1,5 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
1
3
  import {
2
4
  BaseEntity,
3
5
  BeforeInsert,
@@ -10,8 +12,6 @@ import {
10
12
  PrimaryGeneratedColumn,
11
13
  UpdateDateColumn,
12
14
  } from 'typeorm'
13
- import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
14
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
15
15
  import { CredentialLocaleBrandingEntity } from './CredentialLocaleBrandingEntity'
16
16
 
17
17
  @Entity('CredentialBranding')
@@ -1,7 +1,7 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { CredentialLocaleBrandingEntity } from './CredentialLocaleBrandingEntity'
3
1
  import { validate, Validate, ValidationError } from 'class-validator'
2
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
4
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
+ import { CredentialLocaleBrandingEntity } from './CredentialLocaleBrandingEntity'
5
5
 
6
6
  @Entity('CredentialClaims')
7
7
  @Index('IDX_CredentialClaimsEntity_credentialLocaleBranding_locale', ['credentialLocaleBranding', 'key'], { unique: true })
@@ -1,6 +1,6 @@
1
- import { ChildEntity, Column, JoinColumn, ManyToOne, Index, OneToMany } from 'typeorm'
2
- import { CredentialBrandingEntity } from './CredentialBrandingEntity'
1
+ import { ChildEntity, Column, Index, JoinColumn, ManyToOne, OneToMany } from 'typeorm'
3
2
  import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
3
+ import { CredentialBrandingEntity } from './CredentialBrandingEntity'
4
4
  import { CredentialClaimsEntity } from './CredentialClaimsEntity'
5
5
 
6
6
  @ChildEntity('CredentialLocaleBranding')
@@ -1,7 +1,7 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { ImageDimensionsEntity } from './ImageDimensionsEntity'
3
1
  import { validate, Validate, ValidationError } from 'class-validator'
2
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
4
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
+ import { ImageDimensionsEntity } from './ImageDimensionsEntity'
5
5
 
6
6
  @Entity('ImageAttributes')
7
7
  export class ImageAttributesEntity extends BaseEntity {
@@ -1,3 +1,5 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
1
3
  import {
2
4
  BaseEntity,
3
5
  BeforeInsert,
@@ -10,8 +12,6 @@ import {
10
12
  PrimaryGeneratedColumn,
11
13
  UpdateDateColumn,
12
14
  } from 'typeorm'
13
- import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
14
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
15
15
  import { IssuerLocaleBrandingEntity } from './IssuerLocaleBrandingEntity'
16
16
 
17
17
  @Entity('IssuerBranding')
@@ -1,8 +1,8 @@
1
+ import { Validate } from 'class-validator'
1
2
  import { ChildEntity, Column, Index, JoinColumn, ManyToOne } from 'typeorm'
2
- import { IssuerBrandingEntity } from './IssuerBrandingEntity'
3
- import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
4
3
  import { IsNonEmptyStringConstraint } from '../validators'
5
- import { Validate } from 'class-validator'
4
+ import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
5
+ import { IssuerBrandingEntity } from './IssuerBrandingEntity'
6
6
 
7
7
  @ChildEntity('IssuerLocaleBranding')
8
8
  @Index('IDX_IssuerLocaleBrandingEntity_issuerBranding_locale', ['issuerBranding', 'locale'], { unique: true })
@@ -1,5 +1,5 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
2
1
  import { validate, Validate, ValidationError } from 'class-validator'
2
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
3
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
4
 
5
5
  @Entity('TextAttributes')
@@ -1,5 +1,5 @@
1
- import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'
2
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'
3
3
 
4
4
  /**
5
5
  * @class MachineStateInfoEntity
@@ -1,16 +1,16 @@
1
- import { BaseEntity, BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
2
- import { IsNotEmpty } from 'class-validator'
3
1
  import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
2
+ import { IsNotEmpty } from 'class-validator'
3
+ import { BaseEntity, BeforeInsert, BeforeUpdate, Column, CreateDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
4
4
 
5
- @Entity('PresentationDefinitionItem')
5
+ @Entity('DcqlQueryItem')
6
6
  @Index(['version'], { unique: false })
7
- export class PresentationDefinitionItemEntity extends BaseEntity {
7
+ export class DcqlQueryItemEntity extends BaseEntity {
8
8
  @PrimaryGeneratedColumn('uuid')
9
9
  id!: string
10
10
 
11
- @Column({ name: 'definition_id', length: 255, type: 'varchar', nullable: false, unique: false })
12
- @IsNotEmpty({ message: 'A blank definition id field is not allowed' })
13
- definitionId!: string
11
+ @Column({ name: 'query_id', length: 255, type: 'varchar', nullable: false, unique: false })
12
+ @IsNotEmpty({ message: 'A blank query id field is not allowed' })
13
+ queryId!: string
14
14
 
15
15
  @Column({ name: 'version', length: 255, type: 'varchar', nullable: false, unique: false })
16
16
  @IsNotEmpty({ message: 'A blank version field is not allowed' })
@@ -25,13 +25,9 @@ export class PresentationDefinitionItemEntity extends BaseEntity {
25
25
  @Column({ name: 'name', length: 255, type: 'varchar', nullable: true, unique: false })
26
26
  name?: string
27
27
 
28
- @Column({ name: 'definition_payload', type: 'text', nullable: false, unique: false }) // TODO should this become nullable now we have dcqlPayload?
29
- @IsNotEmpty({ message: 'A blank PD definition payload field is not allowed' })
30
- definitionPayload!: string
31
-
32
- @Column({ name: 'dcql_payload', type: 'text', nullable: true, unique: false })
33
- @IsNotEmpty({ message: 'A blank dcql definition payload field is not allowed' })
34
- dcqlPayload!: string
28
+ @Column({ name: 'query', type: 'text', nullable: false, unique: false })
29
+ @IsNotEmpty({ message: 'A blank dcql query payload field is not allowed' })
30
+ query!: string
35
31
 
36
32
  @CreateDateColumn({ name: 'created_at', nullable: false, type: typeOrmDateTime() })
37
33
  createdAt!: Date
@@ -0,0 +1,60 @@
1
+ import { BitstringStatusMessage } from '../../types'
2
+ import { ChildEntity, Column } from 'typeorm'
3
+ import { StatusListEntryEntity } from './StatusList2021EntryEntity'
4
+
5
+ @ChildEntity('bitstring')
6
+ export class BitstringStatusListEntryEntity extends StatusListEntryEntity {
7
+ @Column({ type: 'varchar', name: 'statusPurpose', nullable: false })
8
+ statusPurpose!: string
9
+
10
+ @Column({ type: 'integer', name: 'bitsPerStatus', nullable: true, default: 1 })
11
+ bitsPerStatus?: number
12
+
13
+ @Column({
14
+ type: 'text',
15
+ name: 'statusMessage',
16
+ nullable: true,
17
+ transformer: {
18
+ from(value: string): Array<BitstringStatusMessage> | undefined {
19
+ if (!value) {
20
+ return undefined
21
+ }
22
+ return JSON.parse(value)
23
+ },
24
+ to(value: Array<BitstringStatusMessage> | undefined): string | undefined {
25
+ if (!value) {
26
+ return undefined
27
+ }
28
+ return JSON.stringify(value)
29
+ },
30
+ },
31
+ })
32
+ statusMessage?: Array<BitstringStatusMessage>
33
+
34
+ @Column({
35
+ type: 'text',
36
+ name: 'statusReference',
37
+ nullable: true,
38
+ transformer: {
39
+ from(value: string): string | string[] | undefined {
40
+ if (!value) {
41
+ return undefined
42
+ }
43
+ if (value.startsWith('[')) {
44
+ return JSON.parse(value)
45
+ }
46
+ return value
47
+ },
48
+ to(value: string | string[] | undefined): string | undefined {
49
+ if (!value) {
50
+ return undefined
51
+ }
52
+ if (Array.isArray(value)) {
53
+ return JSON.stringify(value)
54
+ }
55
+ return value
56
+ },
57
+ },
58
+ })
59
+ statusReference?: string | string[]
60
+ }
@@ -1,11 +1,12 @@
1
1
  import { Validate } from 'class-validator'
2
- import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'
2
+ import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, PrimaryColumn, TableInheritance } from 'typeorm'
3
3
  import { IsNonEmptyStringConstraint } from '../validators'
4
- import { StatusListEntity } from './StatusListEntities'
4
+ import { StatusList2021Entity, StatusListEntity } from './StatusListEntities'
5
5
 
6
6
  @Entity('StatusListEntry')
7
7
  // @Unique('uq_credential_statuslist', ['statusList', 'credentialId']) // disabled because one prop can be null
8
8
  // @Unique('uq_credentialHash_statuslistId', ['statusList', 'credentialHash']) // disabled because one prop can be null
9
+ @TableInheritance({ column: { type: 'varchar', name: 'type' } })
9
10
  export class StatusListEntryEntity extends BaseEntity {
10
11
  @PrimaryColumn({ name: 'statusListId', type: 'varchar', nullable: false, unique: false })
11
12
  @Validate(IsNonEmptyStringConstraint, { message: 'Status list id is required' })
@@ -15,7 +16,7 @@ export class StatusListEntryEntity extends BaseEntity {
15
16
  @Validate(IsNonEmptyStringConstraint, { message: 'Status list index is required' })
16
17
  statusListIndex!: number
17
18
 
18
- @ManyToOne(() => StatusListEntity, (statusList) => statusList.statusListEntries)
19
+ @ManyToOne(() => StatusList2021Entity, (statusList) => statusList.statusListEntries)
19
20
  @JoinColumn({ name: 'statusListId' })
20
21
  statusList!: StatusListEntity
21
22
 
@@ -1,4 +1,6 @@
1
+ import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
1
2
  import {
3
+ type CredentialProofFormat,
2
4
  type IIssuer,
3
5
  type StatusListCredential,
4
6
  StatusListCredentialIdMode,
@@ -6,12 +8,12 @@ import {
6
8
  type StatusListIndexingDirection,
7
9
  StatusListType,
8
10
  type StatusPurpose2021,
9
- type CredentialProofFormat,
10
11
  } from '@sphereon/ssi-types'
11
- import typeorm from 'typeorm'
12
- const { BaseEntity, ChildEntity, Column, Entity, OneToMany, PrimaryColumn, TableInheritance, Unique } = typeorm
12
+
13
+ import { BaseEntity, ChildEntity, Column, Entity, OneToMany, PrimaryColumn, TableInheritance, Unique } from 'typeorm'
14
+ import { BitstringStatusListEntryEntity } from './BitstringStatusListEntryEntity'
15
+
13
16
  import { StatusListEntryEntity } from './StatusList2021EntryEntity'
14
- import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
15
17
 
16
18
  @Entity('StatusList')
17
19
  @Unique('UQ_correlationId', ['correlationId'])
@@ -26,6 +28,13 @@ export abstract class StatusListEntity extends BaseEntity {
26
28
  @Column({ name: 'length', type: 'integer', nullable: false, unique: false })
27
29
  length!: number
28
30
 
31
+ @Column('simple-enum', {
32
+ name: 'type',
33
+ enum: StatusListType,
34
+ nullable: false,
35
+ })
36
+ type!: StatusListType
37
+
29
38
  @Column({
30
39
  name: 'issuer',
31
40
  type: 'text',
@@ -88,9 +97,6 @@ export abstract class StatusListEntity extends BaseEntity {
88
97
  },
89
98
  })
90
99
  statusListCredential?: StatusListCredential
91
-
92
- @OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
93
- statusListEntries!: StatusListEntryEntity[]
94
100
  }
95
101
 
96
102
  @ChildEntity(StatusListType.StatusList2021)
@@ -106,6 +112,9 @@ export class StatusList2021Entity extends StatusListEntity {
106
112
 
107
113
  @Column({ type: 'varchar', name: 'statusPurpose', nullable: false, default: 'revocation' })
108
114
  statusPurpose!: StatusPurpose2021
115
+
116
+ @OneToMany((type) => StatusListEntryEntity, (entry) => entry.statusList)
117
+ statusListEntries!: StatusListEntryEntity[]
109
118
  }
110
119
 
111
120
  @ChildEntity(StatusListType.OAuthStatusList)
@@ -115,3 +124,42 @@ export class OAuthStatusListEntity extends StatusListEntity {
115
124
  @Column({ name: 'expiresAt', nullable: true, type: typeOrmDateTime() })
116
125
  expiresAt?: Date
117
126
  }
127
+
128
+ @ChildEntity(StatusListType.BitstringStatusList)
129
+ export class BitstringStatusListEntity extends StatusListEntity {
130
+ @Column({
131
+ type: 'varchar',
132
+ name: 'statusPurpose',
133
+ nullable: false,
134
+ transformer: {
135
+ from(value: string): string | string[] {
136
+ if (value?.includes(',')) {
137
+ return value.split(',').map((v) => v.trim() as string)
138
+ }
139
+ return value as string
140
+ },
141
+ to(value: string | string[]): string {
142
+ if (Array.isArray(value)) {
143
+ return value.join(',')
144
+ }
145
+ return value
146
+ },
147
+ },
148
+ })
149
+ statusPurpose!: string | string[]
150
+
151
+ @Column({ type: 'integer', name: 'bitsPerStatus', nullable: false })
152
+ bitsPerStatus?: number
153
+
154
+ @Column({ name: 'validFrom', nullable: true, type: typeOrmDateTime() })
155
+ validFrom?: Date
156
+
157
+ @Column({ name: 'validUntil', nullable: true, type: typeOrmDateTime() })
158
+ validUntil?: Date
159
+
160
+ @Column({ type: 'integer', name: 'ttl', nullable: true })
161
+ ttl?: number
162
+
163
+ @OneToMany((type) => BitstringStatusListEntryEntity, (entry) => entry.statusList)
164
+ statusListEntries!: BitstringStatusListEntryEntity[]
165
+ }
@@ -1,11 +1,11 @@
1
1
  import type { ActivityLoggingEvent, AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+ import type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '@sphereon/ssi-sdk.data-store-types'
3
+ import { AbstractEventLoggerStore } from '@sphereon/ssi-sdk.data-store-types'
2
4
  import { LoggingEventType, type OrPromise } from '@sphereon/ssi-types'
3
5
  import Debug, { Debugger } from 'debug'
4
6
  import { DataSource } from 'typeorm'
5
- import { AbstractEventLoggerStore } from './AbstractEventLoggerStore'
6
7
  import { AuditEventEntity } from '../entities/eventLogger/AuditEventEntity'
7
8
  import { activityEventEntityFrom, activityEventFrom, auditEventEntityFrom, auditEventFrom } from '../utils/eventLogger/MappingUtils'
8
- import type { GetActivityEventsArgs, GetAuditEventsArgs, StoreActivityEventArgs, StoreAuditEventArgs } from '../types'
9
9
 
10
10
  const debug: Debugger = Debug('sphereon:ssi-sdk:event-store')
11
11