@sphereon/ssi-sdk.data-store 0.30.1-unstable.4 → 0.30.1
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/LICENSE +201 -201
- package/README.md +77 -77
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
- package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +33 -33
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
- package/dist/migrations/postgres/1715761125001-CreateContacts.js +33 -33
- package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +12 -12
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +32 -32
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
- package/dist/migrations/sqlite/1710438363002-CreateContacts.js +13 -13
- package/dist/migrations/sqlite/1715761125002-CreateContacts.js +32 -32
- package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +9 -9
- package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
- package/dist/utils/SortingUtils.d.ts.map +1 -1
- package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
- package/dist/utils/digitalCredential/MappingUtils.js +4 -4
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
- package/dist/utils/presentationDefinition/MappingUtils.js +2 -2
- package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/contact.entities.test.ts +2642 -2642
- package/src/__tests__/contact.store.test.ts +2649 -2649
- package/src/__tests__/digitalCredential.entities.test.ts +274 -274
- package/src/__tests__/digitalCredential.store.test.ts +330 -330
- package/src/__tests__/eventLogger.entities.test.ts +76 -76
- package/src/__tests__/eventLogger.store.test.ts +130 -130
- package/src/__tests__/issuanceBranding.entities.test.ts +846 -846
- package/src/__tests__/issuanceBranding.store.test.ts +1886 -1886
- package/src/__tests__/machineState.entities.test.ts +53 -53
- package/src/__tests__/machineState.store.test.ts +176 -176
- package/src/__tests__/pd-manager.entities.test.ts +73 -73
- package/src/__tests__/pd-manager.store.test.ts +193 -193
- package/src/contact/AbstractContactStore.ts +71 -71
- package/src/contact/ContactStore.ts +768 -768
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -21
- package/src/digitalCredential/DigitalCredentialStore.ts +189 -189
- package/src/entities/contact/BaseContactEntity.ts +51 -51
- package/src/entities/contact/ConnectionEntity.ts +35 -35
- package/src/entities/contact/ContactMetadataItemEntity.ts +51 -51
- package/src/entities/contact/CorrelationIdentifierEntity.ts +43 -43
- package/src/entities/contact/DidAuthConfigEntity.ts +20 -20
- package/src/entities/contact/ElectronicAddressEntity.ts +70 -70
- package/src/entities/contact/IdentityEntity.ts +107 -107
- package/src/entities/contact/IdentityMetadataItemEntity.ts +48 -48
- package/src/entities/contact/NaturalPersonEntity.ts +44 -44
- package/src/entities/contact/OpenIdConfigEntity.ts +32 -32
- package/src/entities/contact/OrganizationEntity.ts +35 -35
- package/src/entities/contact/PartyEntity.ts +117 -117
- package/src/entities/contact/PartyRelationshipEntity.ts +68 -68
- package/src/entities/contact/PartyTypeEntity.ts +63 -63
- package/src/entities/contact/PhysicalAddressEntity.ts +95 -95
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +98 -98
- package/src/entities/eventLogger/AuditEventEntity.ts +92 -92
- package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +42 -42
- package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +87 -87
- package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +79 -79
- package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +33 -33
- package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
- package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +22 -22
- package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +73 -73
- package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +33 -33
- package/src/entities/issuanceBranding/TextAttributesEntity.ts +31 -31
- package/src/entities/machineState/MachineStateInfoEntity.ts +59 -59
- package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +44 -44
- package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
- package/src/entities/statusList2021/StatusList2021EntryEntity.ts +29 -29
- package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
- package/src/eventLogger/EventLoggerStore.ts +62 -62
- package/src/index.ts +160 -160
- package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
- package/src/machineState/IAbstractMachineStateStore.ts +65 -65
- package/src/machineState/MachineStateStore.ts +149 -149
- package/src/migrations/generic/1-CreateContacts.ts +66 -66
- package/src/migrations/generic/10-CreatePresentationDefinitions.ts +66 -66
- package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
- package/src/migrations/generic/3-CreateContacts.ts +66 -66
- package/src/migrations/generic/4-CreateStatusList.ts +54 -54
- package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
- package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
- package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
- package/src/migrations/generic/8-CreateContacts.ts +66 -66
- package/src/migrations/generic/9-CreateContacts.ts +66 -66
- package/src/migrations/generic/index.ts +43 -43
- package/src/migrations/index.ts +10 -10
- package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
- package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
- package/src/migrations/postgres/1690925872592-CreateContacts.ts +158 -158
- package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
- package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +61 -61
- package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
- package/src/migrations/postgres/1710438363001-CreateContacts.ts +63 -63
- package/src/migrations/postgres/1715761125001-CreateContacts.ts +60 -60
- package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +25 -25
- package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
- package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
- package/src/migrations/sqlite/1690925872693-CreateContacts.ts +228 -228
- package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
- package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +46 -46
- package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
- package/src/migrations/sqlite/1710438363002-CreateContacts.ts +83 -83
- package/src/migrations/sqlite/1715761125002-CreateContacts.ts +59 -59
- package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +24 -24
- package/src/presentationDefinition/AbstractPDStore.ts +20 -20
- package/src/presentationDefinition/PDStore.ts +185 -185
- package/src/statusList/IStatusListStore.ts +44 -44
- package/src/statusList/StatusListStore.ts +236 -236
- package/src/types/contact/IAbstractContactStore.ts +161 -161
- package/src/types/contact/contact.ts +295 -295
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +42 -42
- package/src/types/digitalCredential/digitalCredential.ts +102 -102
- package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
- package/src/types/eventLogger/eventLogger.ts +3 -3
- package/src/types/index.ts +14 -14
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
- package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -25
- package/src/types/presentationDefinition/presentationDefinition.ts +17 -17
- package/src/utils/SortingUtils.ts +16 -16
- package/src/utils/contact/MappingUtils.ts +506 -506
- package/src/utils/digitalCredential/MappingUtils.ts +160 -160
- package/src/utils/hasher.ts +19 -19
- package/src/utils/presentationDefinition/MappingUtils.ts +52 -52
- package/dist/entities/contact/IMetadataEntity.d.ts +0 -8
- package/dist/entities/contact/IMetadataEntity.d.ts.map +0 -1
- package/dist/entities/contact/IMetadataEntity.js +0 -2
- package/dist/entities/contact/IMetadataEntity.js.map +0 -1
- package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
- package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
- package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
- package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { ChildEntity, Column, JoinColumn, ManyToOne, Index } from 'typeorm'
|
|
2
|
-
import { IBasicCredentialLocaleBranding } from '../../types'
|
|
3
|
-
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
|
-
import { CredentialBrandingEntity } from './CredentialBrandingEntity'
|
|
5
|
-
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
6
|
-
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
-
import { textAttributesEntityFrom } from './TextAttributesEntity'
|
|
8
|
-
import { isEmptyString } from '../validators'
|
|
9
|
-
|
|
10
|
-
@ChildEntity('CredentialLocaleBranding')
|
|
11
|
-
@Index('IDX_CredentialLocaleBrandingEntity_credentialBranding_locale', ['credentialBranding', 'locale'], { unique: true })
|
|
12
|
-
export class CredentialLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
13
|
-
@ManyToOne(() => CredentialBrandingEntity, (credentialBranding: CredentialBrandingEntity) => credentialBranding.localeBranding, {
|
|
14
|
-
onDelete: 'CASCADE',
|
|
15
|
-
})
|
|
16
|
-
@JoinColumn({ name: 'credentialBrandingId' })
|
|
17
|
-
credentialBranding!: CredentialBrandingEntity
|
|
18
|
-
|
|
19
|
-
@Column('text', { name: 'credentialBrandingId', nullable: false })
|
|
20
|
-
credentialBrandingId!: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const credentialLocaleBrandingEntityFrom = (args: IBasicCredentialLocaleBranding): CredentialLocaleBrandingEntity => {
|
|
24
|
-
const credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity()
|
|
25
|
-
credentialLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
26
|
-
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
-
credentialLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
-
credentialLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
-
credentialLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
-
credentialLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
31
|
-
|
|
32
|
-
return credentialLocaleBrandingEntity
|
|
33
|
-
}
|
|
1
|
+
import { ChildEntity, Column, JoinColumn, ManyToOne, Index } from 'typeorm'
|
|
2
|
+
import { IBasicCredentialLocaleBranding } from '../../types'
|
|
3
|
+
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
|
+
import { CredentialBrandingEntity } from './CredentialBrandingEntity'
|
|
5
|
+
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
6
|
+
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
+
import { textAttributesEntityFrom } from './TextAttributesEntity'
|
|
8
|
+
import { isEmptyString } from '../validators'
|
|
9
|
+
|
|
10
|
+
@ChildEntity('CredentialLocaleBranding')
|
|
11
|
+
@Index('IDX_CredentialLocaleBrandingEntity_credentialBranding_locale', ['credentialBranding', 'locale'], { unique: true })
|
|
12
|
+
export class CredentialLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
13
|
+
@ManyToOne(() => CredentialBrandingEntity, (credentialBranding: CredentialBrandingEntity) => credentialBranding.localeBranding, {
|
|
14
|
+
onDelete: 'CASCADE',
|
|
15
|
+
})
|
|
16
|
+
@JoinColumn({ name: 'credentialBrandingId' })
|
|
17
|
+
credentialBranding!: CredentialBrandingEntity
|
|
18
|
+
|
|
19
|
+
@Column('text', { name: 'credentialBrandingId', nullable: false })
|
|
20
|
+
credentialBrandingId!: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const credentialLocaleBrandingEntityFrom = (args: IBasicCredentialLocaleBranding): CredentialLocaleBrandingEntity => {
|
|
24
|
+
const credentialLocaleBrandingEntity: CredentialLocaleBrandingEntity = new CredentialLocaleBrandingEntity()
|
|
25
|
+
credentialLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
26
|
+
credentialLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
+
credentialLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
+
credentialLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
+
credentialLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
+
credentialLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
31
|
+
|
|
32
|
+
return credentialLocaleBrandingEntity
|
|
33
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { IBasicImageAttributes } from '../../types'
|
|
3
|
-
import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './ImageDimensionsEntity'
|
|
4
|
-
import { validate, Validate, ValidationError } from 'class-validator'
|
|
5
|
-
import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
|
|
6
|
-
|
|
7
|
-
@Entity('ImageAttributes')
|
|
8
|
-
export class ImageAttributesEntity extends BaseEntity {
|
|
9
|
-
@PrimaryGeneratedColumn('uuid')
|
|
10
|
-
id!: string
|
|
11
|
-
|
|
12
|
-
@Column('text', { name: 'uri', nullable: true, unique: false })
|
|
13
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image uri are not allowed' })
|
|
14
|
-
uri?: string
|
|
15
|
-
|
|
16
|
-
@Column('text', { name: 'dataUri', nullable: true, unique: false })
|
|
17
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image data uri are not allowed' })
|
|
18
|
-
dataUri?: string
|
|
19
|
-
|
|
20
|
-
@Column('varchar', { name: 'mediaType', length: 255, nullable: true, unique: false })
|
|
21
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image types are not allowed' })
|
|
22
|
-
mediaType?: string
|
|
23
|
-
|
|
24
|
-
@Column('varchar', { name: 'alt', length: 255, nullable: true, unique: false })
|
|
25
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image alts are not allowed' })
|
|
26
|
-
alt?: string
|
|
27
|
-
|
|
28
|
-
@OneToOne(() => ImageDimensionsEntity, {
|
|
29
|
-
cascade: true,
|
|
30
|
-
onDelete: 'CASCADE',
|
|
31
|
-
eager: true,
|
|
32
|
-
nullable: true,
|
|
33
|
-
})
|
|
34
|
-
@JoinColumn({ name: 'dimensionsId' })
|
|
35
|
-
dimensions?: ImageDimensionsEntity
|
|
36
|
-
|
|
37
|
-
@BeforeInsert()
|
|
38
|
-
@BeforeUpdate()
|
|
39
|
-
async validate(): Promise<undefined> {
|
|
40
|
-
const validation: Array<ValidationError> = await validate(this)
|
|
41
|
-
if (validation.length > 0) {
|
|
42
|
-
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
43
|
-
}
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const imageAttributesEntityFrom = (args: IBasicImageAttributes): ImageAttributesEntity => {
|
|
49
|
-
const imageAttributesEntity: ImageAttributesEntity = new ImageAttributesEntity()
|
|
50
|
-
imageAttributesEntity.uri = isEmptyString(args.uri) ? undefined : args.uri
|
|
51
|
-
imageAttributesEntity.dataUri = isEmptyString(args.dataUri) ? undefined : args.dataUri
|
|
52
|
-
imageAttributesEntity.mediaType = isEmptyString(args.mediaType) ? undefined : args.mediaType
|
|
53
|
-
imageAttributesEntity.alt = isEmptyString(args.alt) ? undefined : args.alt
|
|
54
|
-
imageAttributesEntity.dimensions = args.dimensions ? imageDimensionsEntityFrom(args.dimensions) : undefined
|
|
55
|
-
|
|
56
|
-
return imageAttributesEntity
|
|
57
|
-
}
|
|
1
|
+
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
+
import { IBasicImageAttributes } from '../../types'
|
|
3
|
+
import { ImageDimensionsEntity, imageDimensionsEntityFrom } from './ImageDimensionsEntity'
|
|
4
|
+
import { validate, Validate, ValidationError } from 'class-validator'
|
|
5
|
+
import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
|
|
6
|
+
|
|
7
|
+
@Entity('ImageAttributes')
|
|
8
|
+
export class ImageAttributesEntity extends BaseEntity {
|
|
9
|
+
@PrimaryGeneratedColumn('uuid')
|
|
10
|
+
id!: string
|
|
11
|
+
|
|
12
|
+
@Column('text', { name: 'uri', nullable: true, unique: false })
|
|
13
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image uri are not allowed' })
|
|
14
|
+
uri?: string
|
|
15
|
+
|
|
16
|
+
@Column('text', { name: 'dataUri', nullable: true, unique: false })
|
|
17
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image data uri are not allowed' })
|
|
18
|
+
dataUri?: string
|
|
19
|
+
|
|
20
|
+
@Column('varchar', { name: 'mediaType', length: 255, nullable: true, unique: false })
|
|
21
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image types are not allowed' })
|
|
22
|
+
mediaType?: string
|
|
23
|
+
|
|
24
|
+
@Column('varchar', { name: 'alt', length: 255, nullable: true, unique: false })
|
|
25
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank image alts are not allowed' })
|
|
26
|
+
alt?: string
|
|
27
|
+
|
|
28
|
+
@OneToOne(() => ImageDimensionsEntity, {
|
|
29
|
+
cascade: true,
|
|
30
|
+
onDelete: 'CASCADE',
|
|
31
|
+
eager: true,
|
|
32
|
+
nullable: true,
|
|
33
|
+
})
|
|
34
|
+
@JoinColumn({ name: 'dimensionsId' })
|
|
35
|
+
dimensions?: ImageDimensionsEntity
|
|
36
|
+
|
|
37
|
+
@BeforeInsert()
|
|
38
|
+
@BeforeUpdate()
|
|
39
|
+
async validate(): Promise<undefined> {
|
|
40
|
+
const validation: Array<ValidationError> = await validate(this)
|
|
41
|
+
if (validation.length > 0) {
|
|
42
|
+
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
43
|
+
}
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const imageAttributesEntityFrom = (args: IBasicImageAttributes): ImageAttributesEntity => {
|
|
49
|
+
const imageAttributesEntity: ImageAttributesEntity = new ImageAttributesEntity()
|
|
50
|
+
imageAttributesEntity.uri = isEmptyString(args.uri) ? undefined : args.uri
|
|
51
|
+
imageAttributesEntity.dataUri = isEmptyString(args.dataUri) ? undefined : args.dataUri
|
|
52
|
+
imageAttributesEntity.mediaType = isEmptyString(args.mediaType) ? undefined : args.mediaType
|
|
53
|
+
imageAttributesEntity.alt = isEmptyString(args.alt) ? undefined : args.alt
|
|
54
|
+
imageAttributesEntity.dimensions = args.dimensions ? imageDimensionsEntityFrom(args.dimensions) : undefined
|
|
55
|
+
|
|
56
|
+
return imageAttributesEntity
|
|
57
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { IBasicImageDimensions } from '../../types'
|
|
3
|
-
|
|
4
|
-
@Entity('ImageDimensions')
|
|
5
|
-
export class ImageDimensionsEntity extends BaseEntity {
|
|
6
|
-
@PrimaryGeneratedColumn('uuid')
|
|
7
|
-
id!: string
|
|
8
|
-
|
|
9
|
-
@Column('integer', { name: 'width', nullable: false, unique: false })
|
|
10
|
-
width!: number
|
|
11
|
-
|
|
12
|
-
@Column('integer', { name: 'height', nullable: false, unique: false })
|
|
13
|
-
height!: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const imageDimensionsEntityFrom = (args: IBasicImageDimensions): ImageDimensionsEntity => {
|
|
17
|
-
const imageDimensionsEntity: ImageDimensionsEntity = new ImageDimensionsEntity()
|
|
18
|
-
imageDimensionsEntity.width = args.width
|
|
19
|
-
imageDimensionsEntity.height = args.height
|
|
20
|
-
|
|
21
|
-
return imageDimensionsEntity
|
|
22
|
-
}
|
|
1
|
+
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
+
import { IBasicImageDimensions } from '../../types'
|
|
3
|
+
|
|
4
|
+
@Entity('ImageDimensions')
|
|
5
|
+
export class ImageDimensionsEntity extends BaseEntity {
|
|
6
|
+
@PrimaryGeneratedColumn('uuid')
|
|
7
|
+
id!: string
|
|
8
|
+
|
|
9
|
+
@Column('integer', { name: 'width', nullable: false, unique: false })
|
|
10
|
+
width!: number
|
|
11
|
+
|
|
12
|
+
@Column('integer', { name: 'height', nullable: false, unique: false })
|
|
13
|
+
height!: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const imageDimensionsEntityFrom = (args: IBasicImageDimensions): ImageDimensionsEntity => {
|
|
17
|
+
const imageDimensionsEntity: ImageDimensionsEntity = new ImageDimensionsEntity()
|
|
18
|
+
imageDimensionsEntity.width = args.width
|
|
19
|
+
imageDimensionsEntity.height = args.height
|
|
20
|
+
|
|
21
|
+
return imageDimensionsEntity
|
|
22
|
+
}
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseEntity,
|
|
3
|
-
BeforeInsert,
|
|
4
|
-
BeforeUpdate,
|
|
5
|
-
Column,
|
|
6
|
-
CreateDateColumn,
|
|
7
|
-
Entity,
|
|
8
|
-
Index,
|
|
9
|
-
OneToMany,
|
|
10
|
-
PrimaryGeneratedColumn,
|
|
11
|
-
UpdateDateColumn,
|
|
12
|
-
} from 'typeorm'
|
|
13
|
-
import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
|
|
14
|
-
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
15
|
-
import { IssuerLocaleBrandingEntity, issuerLocaleBrandingEntityFrom } from './IssuerLocaleBrandingEntity'
|
|
16
|
-
import { IBasicIssuerBranding, IBasicIssuerLocaleBranding } from '../../types'
|
|
17
|
-
|
|
18
|
-
@Entity('IssuerBranding')
|
|
19
|
-
@Index('IDX_IssuerBrandingEntity_issuerCorrelationId', ['issuerCorrelationId'])
|
|
20
|
-
export class IssuerBrandingEntity extends BaseEntity {
|
|
21
|
-
@PrimaryGeneratedColumn('uuid')
|
|
22
|
-
id!: string
|
|
23
|
-
|
|
24
|
-
@Column('varchar', { name: 'issuerCorrelationId', length: 255, nullable: false, unique: true })
|
|
25
|
-
@IsNotEmpty({ message: 'Blank issuerCorrelationIds are not allowed' })
|
|
26
|
-
issuerCorrelationId!: string
|
|
27
|
-
|
|
28
|
-
@OneToMany(
|
|
29
|
-
() => IssuerLocaleBrandingEntity,
|
|
30
|
-
(issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity) => issuerLocaleBrandingEntity.issuerBranding,
|
|
31
|
-
{
|
|
32
|
-
cascade: true,
|
|
33
|
-
onDelete: 'CASCADE',
|
|
34
|
-
eager: true,
|
|
35
|
-
nullable: false,
|
|
36
|
-
},
|
|
37
|
-
)
|
|
38
|
-
@ArrayMinSize(1, { message: 'localeBranding cannot be empty' })
|
|
39
|
-
localeBranding!: Array<IssuerLocaleBrandingEntity>
|
|
40
|
-
|
|
41
|
-
@CreateDateColumn({ name: 'created_at', nullable: false, type: typeOrmDateTime() })
|
|
42
|
-
createdAt!: Date
|
|
43
|
-
|
|
44
|
-
@UpdateDateColumn({ name: 'last_updated_at', nullable: false, type: typeOrmDateTime() })
|
|
45
|
-
lastUpdatedAt!: Date
|
|
46
|
-
|
|
47
|
-
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
48
|
-
@BeforeInsert()
|
|
49
|
-
@BeforeUpdate()
|
|
50
|
-
updateUpdatedDate(): void {
|
|
51
|
-
this.lastUpdatedAt = new Date()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@BeforeInsert()
|
|
55
|
-
@BeforeUpdate()
|
|
56
|
-
async validate(): Promise<undefined> {
|
|
57
|
-
const validation: Array<ValidationError> = await validate(this)
|
|
58
|
-
if (validation.length > 0) {
|
|
59
|
-
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
60
|
-
}
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const issuerBrandingEntityFrom = (args: IBasicIssuerBranding): IssuerBrandingEntity => {
|
|
66
|
-
const issuerBrandingEntity: IssuerBrandingEntity = new IssuerBrandingEntity()
|
|
67
|
-
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
68
|
-
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicIssuerLocaleBranding) =>
|
|
69
|
-
issuerLocaleBrandingEntityFrom(localeBranding),
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return issuerBrandingEntity
|
|
73
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
BaseEntity,
|
|
3
|
+
BeforeInsert,
|
|
4
|
+
BeforeUpdate,
|
|
5
|
+
Column,
|
|
6
|
+
CreateDateColumn,
|
|
7
|
+
Entity,
|
|
8
|
+
Index,
|
|
9
|
+
OneToMany,
|
|
10
|
+
PrimaryGeneratedColumn,
|
|
11
|
+
UpdateDateColumn,
|
|
12
|
+
} from 'typeorm'
|
|
13
|
+
import { ArrayMinSize, IsNotEmpty, validate, ValidationError } from 'class-validator'
|
|
14
|
+
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
15
|
+
import { IssuerLocaleBrandingEntity, issuerLocaleBrandingEntityFrom } from './IssuerLocaleBrandingEntity'
|
|
16
|
+
import { IBasicIssuerBranding, IBasicIssuerLocaleBranding } from '../../types'
|
|
17
|
+
|
|
18
|
+
@Entity('IssuerBranding')
|
|
19
|
+
@Index('IDX_IssuerBrandingEntity_issuerCorrelationId', ['issuerCorrelationId'])
|
|
20
|
+
export class IssuerBrandingEntity extends BaseEntity {
|
|
21
|
+
@PrimaryGeneratedColumn('uuid')
|
|
22
|
+
id!: string
|
|
23
|
+
|
|
24
|
+
@Column('varchar', { name: 'issuerCorrelationId', length: 255, nullable: false, unique: true })
|
|
25
|
+
@IsNotEmpty({ message: 'Blank issuerCorrelationIds are not allowed' })
|
|
26
|
+
issuerCorrelationId!: string
|
|
27
|
+
|
|
28
|
+
@OneToMany(
|
|
29
|
+
() => IssuerLocaleBrandingEntity,
|
|
30
|
+
(issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity) => issuerLocaleBrandingEntity.issuerBranding,
|
|
31
|
+
{
|
|
32
|
+
cascade: true,
|
|
33
|
+
onDelete: 'CASCADE',
|
|
34
|
+
eager: true,
|
|
35
|
+
nullable: false,
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
@ArrayMinSize(1, { message: 'localeBranding cannot be empty' })
|
|
39
|
+
localeBranding!: Array<IssuerLocaleBrandingEntity>
|
|
40
|
+
|
|
41
|
+
@CreateDateColumn({ name: 'created_at', nullable: false, type: typeOrmDateTime() })
|
|
42
|
+
createdAt!: Date
|
|
43
|
+
|
|
44
|
+
@UpdateDateColumn({ name: 'last_updated_at', nullable: false, type: typeOrmDateTime() })
|
|
45
|
+
lastUpdatedAt!: Date
|
|
46
|
+
|
|
47
|
+
// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
|
|
48
|
+
@BeforeInsert()
|
|
49
|
+
@BeforeUpdate()
|
|
50
|
+
updateUpdatedDate(): void {
|
|
51
|
+
this.lastUpdatedAt = new Date()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@BeforeInsert()
|
|
55
|
+
@BeforeUpdate()
|
|
56
|
+
async validate(): Promise<undefined> {
|
|
57
|
+
const validation: Array<ValidationError> = await validate(this)
|
|
58
|
+
if (validation.length > 0) {
|
|
59
|
+
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
60
|
+
}
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const issuerBrandingEntityFrom = (args: IBasicIssuerBranding): IssuerBrandingEntity => {
|
|
66
|
+
const issuerBrandingEntity: IssuerBrandingEntity = new IssuerBrandingEntity()
|
|
67
|
+
issuerBrandingEntity.issuerCorrelationId = args.issuerCorrelationId
|
|
68
|
+
issuerBrandingEntity.localeBranding = args.localeBranding.map((localeBranding: IBasicIssuerLocaleBranding) =>
|
|
69
|
+
issuerLocaleBrandingEntityFrom(localeBranding),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return issuerBrandingEntity
|
|
73
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { ChildEntity, Column, Index, JoinColumn, ManyToOne } from 'typeorm'
|
|
2
|
-
import { IBasicIssuerLocaleBranding } from '../../types'
|
|
3
|
-
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
|
-
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
5
|
-
import { IssuerBrandingEntity } from './IssuerBrandingEntity'
|
|
6
|
-
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
-
import { textAttributesEntityFrom } from './TextAttributesEntity'
|
|
8
|
-
import { isEmptyString } from '../validators'
|
|
9
|
-
|
|
10
|
-
@ChildEntity('IssuerLocaleBranding')
|
|
11
|
-
@Index('IDX_IssuerLocaleBrandingEntity_issuerBranding_locale', ['issuerBranding', 'locale'], { unique: true })
|
|
12
|
-
export class IssuerLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
13
|
-
@ManyToOne(() => IssuerBrandingEntity, (issuerBranding: IssuerBrandingEntity) => issuerBranding.localeBranding, {
|
|
14
|
-
onDelete: 'CASCADE',
|
|
15
|
-
})
|
|
16
|
-
@JoinColumn({ name: 'issuerBrandingId' })
|
|
17
|
-
issuerBranding!: IssuerBrandingEntity
|
|
18
|
-
|
|
19
|
-
@Column('text', { name: 'issuerBrandingId', nullable: false })
|
|
20
|
-
issuerBrandingId!: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const issuerLocaleBrandingEntityFrom = (args: IBasicIssuerLocaleBranding): IssuerLocaleBrandingEntity => {
|
|
24
|
-
const issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity()
|
|
25
|
-
issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
26
|
-
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
-
issuerLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
-
issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
-
issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
-
issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
31
|
-
|
|
32
|
-
return issuerLocaleBrandingEntity
|
|
33
|
-
}
|
|
1
|
+
import { ChildEntity, Column, Index, JoinColumn, ManyToOne } from 'typeorm'
|
|
2
|
+
import { IBasicIssuerLocaleBranding } from '../../types'
|
|
3
|
+
import { backgroundAttributesEntityFrom } from './BackgroundAttributesEntity'
|
|
4
|
+
import { imageAttributesEntityFrom } from './ImageAttributesEntity'
|
|
5
|
+
import { IssuerBrandingEntity } from './IssuerBrandingEntity'
|
|
6
|
+
import { BaseLocaleBrandingEntity } from './BaseLocaleBrandingEntity'
|
|
7
|
+
import { textAttributesEntityFrom } from './TextAttributesEntity'
|
|
8
|
+
import { isEmptyString } from '../validators'
|
|
9
|
+
|
|
10
|
+
@ChildEntity('IssuerLocaleBranding')
|
|
11
|
+
@Index('IDX_IssuerLocaleBrandingEntity_issuerBranding_locale', ['issuerBranding', 'locale'], { unique: true })
|
|
12
|
+
export class IssuerLocaleBrandingEntity extends BaseLocaleBrandingEntity {
|
|
13
|
+
@ManyToOne(() => IssuerBrandingEntity, (issuerBranding: IssuerBrandingEntity) => issuerBranding.localeBranding, {
|
|
14
|
+
onDelete: 'CASCADE',
|
|
15
|
+
})
|
|
16
|
+
@JoinColumn({ name: 'issuerBrandingId' })
|
|
17
|
+
issuerBranding!: IssuerBrandingEntity
|
|
18
|
+
|
|
19
|
+
@Column('text', { name: 'issuerBrandingId', nullable: false })
|
|
20
|
+
issuerBrandingId!: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const issuerLocaleBrandingEntityFrom = (args: IBasicIssuerLocaleBranding): IssuerLocaleBrandingEntity => {
|
|
24
|
+
const issuerLocaleBrandingEntity: IssuerLocaleBrandingEntity = new IssuerLocaleBrandingEntity()
|
|
25
|
+
issuerLocaleBrandingEntity.alias = isEmptyString(args.alias) ? undefined : args.alias
|
|
26
|
+
issuerLocaleBrandingEntity.locale = args.locale ? args.locale : ''
|
|
27
|
+
issuerLocaleBrandingEntity.logo = args.logo ? imageAttributesEntityFrom(args.logo) : undefined
|
|
28
|
+
issuerLocaleBrandingEntity.description = isEmptyString(args.description) ? undefined : args.description
|
|
29
|
+
issuerLocaleBrandingEntity.background = args.background ? backgroundAttributesEntityFrom(args.background) : undefined
|
|
30
|
+
issuerLocaleBrandingEntity.text = args.text ? textAttributesEntityFrom(args.text) : undefined
|
|
31
|
+
|
|
32
|
+
return issuerLocaleBrandingEntity
|
|
33
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { IBasicTextAttributes } from '../../types'
|
|
3
|
-
import { validate, Validate, ValidationError } from 'class-validator'
|
|
4
|
-
import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
|
|
5
|
-
|
|
6
|
-
@Entity('TextAttributes')
|
|
7
|
-
export class TextAttributesEntity extends BaseEntity {
|
|
8
|
-
@PrimaryGeneratedColumn('uuid')
|
|
9
|
-
id!: string
|
|
10
|
-
|
|
11
|
-
@Column('varchar', { name: 'color', length: 255, nullable: true, unique: false })
|
|
12
|
-
@Validate(IsNonEmptyStringConstraint, { message: 'Blank text colors are not allowed' })
|
|
13
|
-
color?: string
|
|
14
|
-
|
|
15
|
-
@BeforeInsert()
|
|
16
|
-
@BeforeUpdate()
|
|
17
|
-
async validate(): Promise<undefined> {
|
|
18
|
-
const validation: Array<ValidationError> = await validate(this)
|
|
19
|
-
if (validation.length > 0) {
|
|
20
|
-
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
21
|
-
}
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const textAttributesEntityFrom = (args: IBasicTextAttributes): TextAttributesEntity => {
|
|
27
|
-
const textAttributesEntity: TextAttributesEntity = new TextAttributesEntity()
|
|
28
|
-
textAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
29
|
-
|
|
30
|
-
return textAttributesEntity
|
|
31
|
-
}
|
|
1
|
+
import { BaseEntity, BeforeInsert, BeforeUpdate, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
+
import { IBasicTextAttributes } from '../../types'
|
|
3
|
+
import { validate, Validate, ValidationError } from 'class-validator'
|
|
4
|
+
import { isEmptyString, IsNonEmptyStringConstraint } from '../validators'
|
|
5
|
+
|
|
6
|
+
@Entity('TextAttributes')
|
|
7
|
+
export class TextAttributesEntity extends BaseEntity {
|
|
8
|
+
@PrimaryGeneratedColumn('uuid')
|
|
9
|
+
id!: string
|
|
10
|
+
|
|
11
|
+
@Column('varchar', { name: 'color', length: 255, nullable: true, unique: false })
|
|
12
|
+
@Validate(IsNonEmptyStringConstraint, { message: 'Blank text colors are not allowed' })
|
|
13
|
+
color?: string
|
|
14
|
+
|
|
15
|
+
@BeforeInsert()
|
|
16
|
+
@BeforeUpdate()
|
|
17
|
+
async validate(): Promise<undefined> {
|
|
18
|
+
const validation: Array<ValidationError> = await validate(this)
|
|
19
|
+
if (validation.length > 0) {
|
|
20
|
+
return Promise.reject(Error(Object.values(validation[0].constraints!)[0]))
|
|
21
|
+
}
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const textAttributesEntityFrom = (args: IBasicTextAttributes): TextAttributesEntity => {
|
|
27
|
+
const textAttributesEntity: TextAttributesEntity = new TextAttributesEntity()
|
|
28
|
+
textAttributesEntity.color = isEmptyString(args.color) ? undefined : args.color
|
|
29
|
+
|
|
30
|
+
return textAttributesEntity
|
|
31
|
+
}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'
|
|
2
|
-
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @class MachineStateInfoEntity
|
|
6
|
-
* Represents a machine state. It allows to continue a machine at a later point in time at the point it was left of
|
|
7
|
-
*
|
|
8
|
-
* @param {string} instanceId - The instance ID of the machine state.
|
|
9
|
-
* @param {string} [sessionId] - The session ID of the machine state. (optional)
|
|
10
|
-
* @param {string} machineName - The name of the machine.
|
|
11
|
-
* @param {string} [latestStateName] - The name of the latest state. (optional)
|
|
12
|
-
* @param {string} latestEventType - The type of the latest event.
|
|
13
|
-
* @param {string} state - The current state of the machine.
|
|
14
|
-
* @param {Date} createdAt - The date and time when the machine state was created.
|
|
15
|
-
* @param {Date} updatedAt - The date and time when the machine state was last updated.
|
|
16
|
-
* @param {number} updatedCount - The number of times the machine state has been updated.
|
|
17
|
-
* @param {Date} [expiresAt] - The date and time when the machine state expires. (optional)
|
|
18
|
-
* @param {Date} [completedAt] - The date and time when the machine state was completed. (optional)
|
|
19
|
-
* @param {string} [tenantId] - The ID of the tenant associated with the machine state. (optional)
|
|
20
|
-
*/
|
|
21
|
-
@Entity('MachineStateInfoEntity')
|
|
22
|
-
export class MachineStateInfoEntity extends BaseEntity {
|
|
23
|
-
@PrimaryColumn({ name: 'instance_id', type: 'varchar', nullable: false })
|
|
24
|
-
instanceId!: string
|
|
25
|
-
|
|
26
|
-
@Column({ name: 'session_id', type: 'varchar', nullable: true })
|
|
27
|
-
sessionId?: string
|
|
28
|
-
|
|
29
|
-
// Xstate moved to name instead of instanceId for V5. Also makes more sense
|
|
30
|
-
@Column({ name: 'machine_name', type: 'varchar', nullable: false })
|
|
31
|
-
machineName!: string
|
|
32
|
-
|
|
33
|
-
@Column({ name: 'latest_state_name', type: 'varchar', nullable: true })
|
|
34
|
-
latestStateName?: string
|
|
35
|
-
|
|
36
|
-
@Column({ name: 'latest_event_type', type: 'varchar', nullable: false })
|
|
37
|
-
latestEventType!: string
|
|
38
|
-
|
|
39
|
-
@Column({ name: 'state', type: 'text', nullable: false })
|
|
40
|
-
state!: string
|
|
41
|
-
|
|
42
|
-
@CreateDateColumn({ name: 'created_at', nullable: false, type: typeOrmDateTime() })
|
|
43
|
-
createdAt!: Date
|
|
44
|
-
|
|
45
|
-
@UpdateDateColumn({ name: 'updated_at', nullable: false, type: typeOrmDateTime() })
|
|
46
|
-
updatedAt!: Date
|
|
47
|
-
|
|
48
|
-
@Column({ name: 'updated_count', type: 'integer', nullable: false })
|
|
49
|
-
updatedCount!: number
|
|
50
|
-
|
|
51
|
-
@Column({ name: 'expires_at', nullable: true, type: typeOrmDateTime() })
|
|
52
|
-
expiresAt?: Date
|
|
53
|
-
|
|
54
|
-
@Column({ name: 'completed_at', nullable: true, type: typeOrmDateTime() })
|
|
55
|
-
completedAt?: Date
|
|
56
|
-
|
|
57
|
-
@Column({ name: 'tenant_id', type: 'varchar', nullable: true })
|
|
58
|
-
tenantId?: string
|
|
59
|
-
}
|
|
1
|
+
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm'
|
|
2
|
+
import { typeOrmDateTime } from '@sphereon/ssi-sdk.agent-config'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @class MachineStateInfoEntity
|
|
6
|
+
* Represents a machine state. It allows to continue a machine at a later point in time at the point it was left of
|
|
7
|
+
*
|
|
8
|
+
* @param {string} instanceId - The instance ID of the machine state.
|
|
9
|
+
* @param {string} [sessionId] - The session ID of the machine state. (optional)
|
|
10
|
+
* @param {string} machineName - The name of the machine.
|
|
11
|
+
* @param {string} [latestStateName] - The name of the latest state. (optional)
|
|
12
|
+
* @param {string} latestEventType - The type of the latest event.
|
|
13
|
+
* @param {string} state - The current state of the machine.
|
|
14
|
+
* @param {Date} createdAt - The date and time when the machine state was created.
|
|
15
|
+
* @param {Date} updatedAt - The date and time when the machine state was last updated.
|
|
16
|
+
* @param {number} updatedCount - The number of times the machine state has been updated.
|
|
17
|
+
* @param {Date} [expiresAt] - The date and time when the machine state expires. (optional)
|
|
18
|
+
* @param {Date} [completedAt] - The date and time when the machine state was completed. (optional)
|
|
19
|
+
* @param {string} [tenantId] - The ID of the tenant associated with the machine state. (optional)
|
|
20
|
+
*/
|
|
21
|
+
@Entity('MachineStateInfoEntity')
|
|
22
|
+
export class MachineStateInfoEntity extends BaseEntity {
|
|
23
|
+
@PrimaryColumn({ name: 'instance_id', type: 'varchar', nullable: false })
|
|
24
|
+
instanceId!: string
|
|
25
|
+
|
|
26
|
+
@Column({ name: 'session_id', type: 'varchar', nullable: true })
|
|
27
|
+
sessionId?: string
|
|
28
|
+
|
|
29
|
+
// Xstate moved to name instead of instanceId for V5. Also makes more sense
|
|
30
|
+
@Column({ name: 'machine_name', type: 'varchar', nullable: false })
|
|
31
|
+
machineName!: string
|
|
32
|
+
|
|
33
|
+
@Column({ name: 'latest_state_name', type: 'varchar', nullable: true })
|
|
34
|
+
latestStateName?: string
|
|
35
|
+
|
|
36
|
+
@Column({ name: 'latest_event_type', type: 'varchar', nullable: false })
|
|
37
|
+
latestEventType!: string
|
|
38
|
+
|
|
39
|
+
@Column({ name: 'state', type: 'text', nullable: false })
|
|
40
|
+
state!: string
|
|
41
|
+
|
|
42
|
+
@CreateDateColumn({ name: 'created_at', nullable: false, type: typeOrmDateTime() })
|
|
43
|
+
createdAt!: Date
|
|
44
|
+
|
|
45
|
+
@UpdateDateColumn({ name: 'updated_at', nullable: false, type: typeOrmDateTime() })
|
|
46
|
+
updatedAt!: Date
|
|
47
|
+
|
|
48
|
+
@Column({ name: 'updated_count', type: 'integer', nullable: false })
|
|
49
|
+
updatedCount!: number
|
|
50
|
+
|
|
51
|
+
@Column({ name: 'expires_at', nullable: true, type: typeOrmDateTime() })
|
|
52
|
+
expiresAt?: Date
|
|
53
|
+
|
|
54
|
+
@Column({ name: 'completed_at', nullable: true, type: typeOrmDateTime() })
|
|
55
|
+
completedAt?: Date
|
|
56
|
+
|
|
57
|
+
@Column({ name: 'tenant_id', type: 'varchar', nullable: true })
|
|
58
|
+
tenantId?: string
|
|
59
|
+
}
|