@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.
Files changed (136) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +77 -77
  3. package/dist/contact/ContactStore.d.ts.map +1 -1
  4. package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -1
  5. package/dist/eventLogger/EventLoggerStore.d.ts.map +1 -1
  6. package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
  7. package/dist/migrations/internal-migrations-ormconfig.d.ts.map +1 -1
  8. package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +33 -33
  9. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +16 -16
  10. package/dist/migrations/postgres/1715761125001-CreateContacts.js +33 -33
  11. package/dist/migrations/postgres/1716475165345-CreatePresentationDefinitions.js +12 -12
  12. package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +32 -32
  13. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +15 -15
  14. package/dist/migrations/sqlite/1710438363002-CreateContacts.js +13 -13
  15. package/dist/migrations/sqlite/1715761125002-CreateContacts.js +32 -32
  16. package/dist/migrations/sqlite/1716475165344-CreatePresentationDefinitions.js +9 -9
  17. package/dist/presentationDefinition/PDStore.d.ts.map +1 -1
  18. package/dist/utils/SortingUtils.d.ts.map +1 -1
  19. package/dist/utils/contact/MappingUtils.d.ts.map +1 -1
  20. package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -1
  21. package/dist/utils/digitalCredential/MappingUtils.js +4 -4
  22. package/dist/utils/digitalCredential/MappingUtils.js.map +1 -1
  23. package/dist/utils/presentationDefinition/MappingUtils.js +2 -2
  24. package/dist/utils/presentationDefinition/MappingUtils.js.map +1 -1
  25. package/package.json +8 -8
  26. package/src/__tests__/contact.entities.test.ts +2642 -2642
  27. package/src/__tests__/contact.store.test.ts +2649 -2649
  28. package/src/__tests__/digitalCredential.entities.test.ts +274 -274
  29. package/src/__tests__/digitalCredential.store.test.ts +330 -330
  30. package/src/__tests__/eventLogger.entities.test.ts +76 -76
  31. package/src/__tests__/eventLogger.store.test.ts +130 -130
  32. package/src/__tests__/issuanceBranding.entities.test.ts +846 -846
  33. package/src/__tests__/issuanceBranding.store.test.ts +1886 -1886
  34. package/src/__tests__/machineState.entities.test.ts +53 -53
  35. package/src/__tests__/machineState.store.test.ts +176 -176
  36. package/src/__tests__/pd-manager.entities.test.ts +73 -73
  37. package/src/__tests__/pd-manager.store.test.ts +193 -193
  38. package/src/contact/AbstractContactStore.ts +71 -71
  39. package/src/contact/ContactStore.ts +768 -768
  40. package/src/digitalCredential/AbstractDigitalCredentialStore.ts +21 -21
  41. package/src/digitalCredential/DigitalCredentialStore.ts +189 -189
  42. package/src/entities/contact/BaseContactEntity.ts +51 -51
  43. package/src/entities/contact/ConnectionEntity.ts +35 -35
  44. package/src/entities/contact/ContactMetadataItemEntity.ts +51 -51
  45. package/src/entities/contact/CorrelationIdentifierEntity.ts +43 -43
  46. package/src/entities/contact/DidAuthConfigEntity.ts +20 -20
  47. package/src/entities/contact/ElectronicAddressEntity.ts +70 -70
  48. package/src/entities/contact/IdentityEntity.ts +107 -107
  49. package/src/entities/contact/IdentityMetadataItemEntity.ts +48 -48
  50. package/src/entities/contact/NaturalPersonEntity.ts +44 -44
  51. package/src/entities/contact/OpenIdConfigEntity.ts +32 -32
  52. package/src/entities/contact/OrganizationEntity.ts +35 -35
  53. package/src/entities/contact/PartyEntity.ts +117 -117
  54. package/src/entities/contact/PartyRelationshipEntity.ts +68 -68
  55. package/src/entities/contact/PartyTypeEntity.ts +63 -63
  56. package/src/entities/contact/PhysicalAddressEntity.ts +95 -95
  57. package/src/entities/digitalCredential/DigitalCredentialEntity.ts +98 -98
  58. package/src/entities/eventLogger/AuditEventEntity.ts +92 -92
  59. package/src/entities/issuanceBranding/BackgroundAttributesEntity.ts +42 -42
  60. package/src/entities/issuanceBranding/BaseLocaleBrandingEntity.ts +87 -87
  61. package/src/entities/issuanceBranding/CredentialBrandingEntity.ts +79 -79
  62. package/src/entities/issuanceBranding/CredentialLocaleBrandingEntity.ts +33 -33
  63. package/src/entities/issuanceBranding/ImageAttributesEntity.ts +57 -57
  64. package/src/entities/issuanceBranding/ImageDimensionsEntity.ts +22 -22
  65. package/src/entities/issuanceBranding/IssuerBrandingEntity.ts +73 -73
  66. package/src/entities/issuanceBranding/IssuerLocaleBrandingEntity.ts +33 -33
  67. package/src/entities/issuanceBranding/TextAttributesEntity.ts +31 -31
  68. package/src/entities/machineState/MachineStateInfoEntity.ts +59 -59
  69. package/src/entities/presentationDefinition/PresentationDefinitionItemEntity.ts +44 -44
  70. package/src/entities/statusList2021/StatusList2021Entity.ts +96 -96
  71. package/src/entities/statusList2021/StatusList2021EntryEntity.ts +29 -29
  72. package/src/eventLogger/AbstractEventLoggerStore.ts +7 -7
  73. package/src/eventLogger/EventLoggerStore.ts +62 -62
  74. package/src/index.ts +160 -160
  75. package/src/issuanceBranding/IssuanceBrandingStore.ts +559 -559
  76. package/src/machineState/IAbstractMachineStateStore.ts +65 -65
  77. package/src/machineState/MachineStateStore.ts +149 -149
  78. package/src/migrations/generic/1-CreateContacts.ts +66 -66
  79. package/src/migrations/generic/10-CreatePresentationDefinitions.ts +66 -66
  80. package/src/migrations/generic/2-CreateIssuanceBranding.ts +64 -64
  81. package/src/migrations/generic/3-CreateContacts.ts +66 -66
  82. package/src/migrations/generic/4-CreateStatusList.ts +54 -54
  83. package/src/migrations/generic/5-CreateAuditEvents.ts +66 -66
  84. package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -66
  85. package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -66
  86. package/src/migrations/generic/8-CreateContacts.ts +66 -66
  87. package/src/migrations/generic/9-CreateContacts.ts +66 -66
  88. package/src/migrations/generic/index.ts +43 -43
  89. package/src/migrations/index.ts +10 -10
  90. package/src/migrations/postgres/1659463079428-CreateContacts.ts +63 -63
  91. package/src/migrations/postgres/1685628974232-CreateIssuanceBranding.ts +85 -85
  92. package/src/migrations/postgres/1690925872592-CreateContacts.ts +158 -158
  93. package/src/migrations/postgres/1693866470001-CreateStatusList.ts +24 -24
  94. package/src/migrations/postgres/1701634812183-CreateAuditEvents.ts +33 -33
  95. package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +61 -61
  96. package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -29
  97. package/src/migrations/postgres/1710438363001-CreateContacts.ts +63 -63
  98. package/src/migrations/postgres/1715761125001-CreateContacts.ts +60 -60
  99. package/src/migrations/postgres/1716475165345-CreatePresentationDefinitions.ts +25 -25
  100. package/src/migrations/sqlite/1659463069549-CreateContacts.ts +110 -110
  101. package/src/migrations/sqlite/1685628973231-CreateIssuanceBranding.ts +119 -119
  102. package/src/migrations/sqlite/1690925872693-CreateContacts.ts +228 -228
  103. package/src/migrations/sqlite/1693866470000-CreateStatusList.ts +24 -24
  104. package/src/migrations/sqlite/1701634819487-CreateAuditEvents.ts +15 -15
  105. package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +46 -46
  106. package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -28
  107. package/src/migrations/sqlite/1710438363002-CreateContacts.ts +83 -83
  108. package/src/migrations/sqlite/1715761125002-CreateContacts.ts +59 -59
  109. package/src/migrations/sqlite/1716475165344-CreatePresentationDefinitions.ts +24 -24
  110. package/src/presentationDefinition/AbstractPDStore.ts +20 -20
  111. package/src/presentationDefinition/PDStore.ts +185 -185
  112. package/src/statusList/IStatusListStore.ts +44 -44
  113. package/src/statusList/StatusListStore.ts +236 -236
  114. package/src/types/contact/IAbstractContactStore.ts +161 -161
  115. package/src/types/contact/contact.ts +295 -295
  116. package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +42 -42
  117. package/src/types/digitalCredential/digitalCredential.ts +102 -102
  118. package/src/types/eventLogger/IAbstractEventLoggerStore.ts +12 -12
  119. package/src/types/eventLogger/eventLogger.ts +3 -3
  120. package/src/types/index.ts +14 -14
  121. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -68
  122. package/src/types/presentationDefinition/IAbstractPDStore.ts +25 -25
  123. package/src/types/presentationDefinition/presentationDefinition.ts +17 -17
  124. package/src/utils/SortingUtils.ts +16 -16
  125. package/src/utils/contact/MappingUtils.ts +506 -506
  126. package/src/utils/digitalCredential/MappingUtils.ts +160 -160
  127. package/src/utils/hasher.ts +19 -19
  128. package/src/utils/presentationDefinition/MappingUtils.ts +52 -52
  129. package/dist/entities/contact/IMetadataEntity.d.ts +0 -8
  130. package/dist/entities/contact/IMetadataEntity.d.ts.map +0 -1
  131. package/dist/entities/contact/IMetadataEntity.js +0 -2
  132. package/dist/entities/contact/IMetadataEntity.js.map +0 -1
  133. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts +0 -7
  134. package/dist/migrations/generic/8-CreatePresentationDefinitions.d.ts.map +0 -1
  135. package/dist/migrations/generic/8-CreatePresentationDefinitions.js +0 -78
  136. package/dist/migrations/generic/8-CreatePresentationDefinitions.js.map +0 -1
@@ -1,102 +1,102 @@
1
- export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
2
-
3
- export type DigitalCredential = {
4
- id: string
5
- parentId?: string
6
- documentType: DocumentType
7
- documentFormat: CredentialDocumentFormat
8
- credentialRole: CredentialRole
9
- regulationType: RegulationType
10
- rawDocument: string
11
- uniformDocument: string
12
- credentialId?: string
13
- hash: string
14
- kmsKeyRef?: string
15
- identifierMethod?: string
16
- issuerCorrelationType: CredentialCorrelationType
17
- subjectCorrelationType?: CredentialCorrelationType
18
- rpCorrelationType?: CredentialCorrelationType
19
- isIssuerSigned?: boolean
20
- issuerCorrelationId: string
21
- subjectCorrelationId?: string
22
- rpCorrelationId?: string
23
- verifiedState?: CredentialStateType
24
- tenantId?: string
25
- createdAt: Date
26
- presentedAt?: Date
27
- lastUpdatedAt: Date
28
- validUntil?: Date
29
- validFrom?: Date
30
- verifiedAt?: Date
31
- revokedAt?: Date
32
- }
33
-
34
- export enum DocumentType {
35
- VC = 'VC',
36
- VP = 'VP',
37
- P = 'P',
38
- C = 'C',
39
- }
40
-
41
- export enum RegulationType {
42
- PID = 'PID',
43
- QEAA = 'QEAA',
44
- EAA = 'EAA',
45
- NON_REGULATED = 'NON_REGULATED',
46
- }
47
-
48
- export enum CredentialDocumentFormat {
49
- JSON_LD = 'JSON_LD',
50
- JWT = 'JWT',
51
- SD_JWT = 'SD_JWT',
52
- MSO_MDOC = 'MSO_MDOC',
53
- }
54
-
55
- export namespace CredentialDocumentFormat {
56
- export function fromSpecValue(credentialFormat: string) {
57
- const format = credentialFormat.toLowerCase()
58
- if (format.includes('sd')) {
59
- return CredentialDocumentFormat.SD_JWT
60
- } else if (format.includes('ldp')) {
61
- return CredentialDocumentFormat.JSON_LD
62
- } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
63
- return CredentialDocumentFormat.MSO_MDOC
64
- } else if (format.includes('jwt_')) {
65
- return CredentialDocumentFormat.JWT
66
- } else {
67
- throw Error(`Could not map format ${format} to known format`)
68
- }
69
- }
70
-
71
- export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
72
- switch (documentFormat) {
73
- case CredentialDocumentFormat.SD_JWT:
74
- return 'vc+sd-jwt'
75
- case CredentialDocumentFormat.MSO_MDOC:
76
- return 'mso_mdoc'
77
- case CredentialDocumentFormat.JSON_LD:
78
- return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
79
- case CredentialDocumentFormat.JWT:
80
- return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'
81
- }
82
- }
83
- }
84
-
85
- export enum CredentialCorrelationType {
86
- DID = 'DID',
87
- X509_SAN = 'X509_SAN',
88
- KID = 'KID',
89
- URL = 'URL',
90
- }
91
-
92
- export enum CredentialRole {
93
- ISSUER = 'ISSUER',
94
- VERIFIER = 'VERIFIER',
95
- HOLDER = 'HOLDER',
96
- }
97
-
98
- export enum CredentialStateType {
99
- REVOKED = 'REVOKED',
100
- VERIFIED = 'VERIFIED',
101
- EXPIRED = 'EXPIRED',
102
- }
1
+ export type NonPersistedDigitalCredential = Omit<DigitalCredential, 'id' | 'regulationType'> & { regulationType?: RegulationType }
2
+
3
+ export type DigitalCredential = {
4
+ id: string
5
+ parentId?: string
6
+ documentType: DocumentType
7
+ documentFormat: CredentialDocumentFormat
8
+ credentialRole: CredentialRole
9
+ regulationType: RegulationType
10
+ rawDocument: string
11
+ uniformDocument: string
12
+ credentialId?: string
13
+ hash: string
14
+ kmsKeyRef?: string
15
+ identifierMethod?: string
16
+ issuerCorrelationType: CredentialCorrelationType
17
+ subjectCorrelationType?: CredentialCorrelationType
18
+ rpCorrelationType?: CredentialCorrelationType
19
+ isIssuerSigned?: boolean
20
+ issuerCorrelationId: string
21
+ subjectCorrelationId?: string
22
+ rpCorrelationId?: string
23
+ verifiedState?: CredentialStateType
24
+ tenantId?: string
25
+ createdAt: Date
26
+ presentedAt?: Date
27
+ lastUpdatedAt: Date
28
+ validUntil?: Date
29
+ validFrom?: Date
30
+ verifiedAt?: Date
31
+ revokedAt?: Date
32
+ }
33
+
34
+ export enum DocumentType {
35
+ VC = 'VC',
36
+ VP = 'VP',
37
+ P = 'P',
38
+ C = 'C',
39
+ }
40
+
41
+ export enum RegulationType {
42
+ PID = 'PID',
43
+ QEAA = 'QEAA',
44
+ EAA = 'EAA',
45
+ NON_REGULATED = 'NON_REGULATED',
46
+ }
47
+
48
+ export enum CredentialDocumentFormat {
49
+ JSON_LD = 'JSON_LD',
50
+ JWT = 'JWT',
51
+ SD_JWT = 'SD_JWT',
52
+ MSO_MDOC = 'MSO_MDOC',
53
+ }
54
+
55
+ export namespace CredentialDocumentFormat {
56
+ export function fromSpecValue(credentialFormat: string) {
57
+ const format = credentialFormat.toLowerCase()
58
+ if (format.includes('sd')) {
59
+ return CredentialDocumentFormat.SD_JWT
60
+ } else if (format.includes('ldp')) {
61
+ return CredentialDocumentFormat.JSON_LD
62
+ } else if (format.includes('mso') || credentialFormat.includes('mdoc')) {
63
+ return CredentialDocumentFormat.MSO_MDOC
64
+ } else if (format.includes('jwt_')) {
65
+ return CredentialDocumentFormat.JWT
66
+ } else {
67
+ throw Error(`Could not map format ${format} to known format`)
68
+ }
69
+ }
70
+
71
+ export function toSpecValue(documentFormat: CredentialDocumentFormat, documentType: DocumentType) {
72
+ switch (documentFormat) {
73
+ case CredentialDocumentFormat.SD_JWT:
74
+ return 'vc+sd-jwt'
75
+ case CredentialDocumentFormat.MSO_MDOC:
76
+ return 'mso_mdoc'
77
+ case CredentialDocumentFormat.JSON_LD:
78
+ return documentType === DocumentType.C || documentType === DocumentType.VC ? 'ldp_vc' : 'ldp_vp'
79
+ case CredentialDocumentFormat.JWT:
80
+ return documentType === DocumentType.C || documentType === DocumentType.VC ? 'jwt_vc_json' : 'jwt_vp_json'
81
+ }
82
+ }
83
+ }
84
+
85
+ export enum CredentialCorrelationType {
86
+ DID = 'DID',
87
+ X509_SAN = 'X509_SAN',
88
+ KID = 'KID',
89
+ URL = 'URL',
90
+ }
91
+
92
+ export enum CredentialRole {
93
+ ISSUER = 'ISSUER',
94
+ VERIFIER = 'VERIFIER',
95
+ HOLDER = 'HOLDER',
96
+ }
97
+
98
+ export enum CredentialStateType {
99
+ REVOKED = 'REVOKED',
100
+ VERIFIED = 'VERIFIED',
101
+ EXPIRED = 'EXPIRED',
102
+ }
@@ -1,12 +1,12 @@
1
- import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
- import { NonPersistedAuditLoggingEvent } from './eventLogger'
3
-
4
- export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
5
-
6
- export type StoreAuditEventArgs = {
7
- event: NonPersistedAuditLoggingEvent
8
- }
9
-
10
- export type GetAuditEventsArgs = {
11
- filter?: FindAuditLoggingEventArgs
12
- }
1
+ import { PartialAuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+ import { NonPersistedAuditLoggingEvent } from './eventLogger'
3
+
4
+ export type FindAuditLoggingEventArgs = Array<PartialAuditLoggingEvent>
5
+
6
+ export type StoreAuditEventArgs = {
7
+ event: NonPersistedAuditLoggingEvent
8
+ }
9
+
10
+ export type GetAuditEventsArgs = {
11
+ filter?: FindAuditLoggingEventArgs
12
+ }
@@ -1,3 +1,3 @@
1
- import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
-
3
- export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id'>
1
+ import { AuditLoggingEvent } from '@sphereon/ssi-sdk.core'
2
+
3
+ export type NonPersistedAuditLoggingEvent = Omit<AuditLoggingEvent, 'id'>
@@ -1,14 +1,14 @@
1
- export * from './issuanceBranding/issuanceBranding'
2
- export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
3
- export * from './contact/contact'
4
- export * from './presentationDefinition/presentationDefinition'
5
- export * from './presentationDefinition/IAbstractPDStore'
6
- export * from './contact/IAbstractContactStore'
7
- export * from './validation/validation'
8
- export * from './statusList/statusList'
9
- export * from './statusList/IAbstractStatusListStore'
10
- export * from './eventLogger/IAbstractEventLoggerStore'
11
- export * from './eventLogger/eventLogger'
12
- export * from './machineState/IAbstractMachineStateStore'
13
- export * from './digitalCredential/digitalCredential'
14
- export * from './digitalCredential/IAbstractDigitalCredentialStore'
1
+ export * from './issuanceBranding/issuanceBranding'
2
+ export * from './issuanceBranding/IAbstractIssuanceBrandingStore'
3
+ export * from './contact/contact'
4
+ export * from './presentationDefinition/presentationDefinition'
5
+ export * from './presentationDefinition/IAbstractPDStore'
6
+ export * from './contact/IAbstractContactStore'
7
+ export * from './validation/validation'
8
+ export * from './statusList/statusList'
9
+ export * from './statusList/IAbstractStatusListStore'
10
+ export * from './eventLogger/IAbstractEventLoggerStore'
11
+ export * from './eventLogger/eventLogger'
12
+ export * from './machineState/IAbstractMachineStateStore'
13
+ export * from './digitalCredential/digitalCredential'
14
+ export * from './digitalCredential/IAbstractDigitalCredentialStore'
@@ -1,68 +1,68 @@
1
- export type StoreMachineStatePersistArgs = Omit<StoreMachineStateInfo, 'createdAt' | 'updatedAt'>
2
-
3
- export type StoreMachineStatesFindActiveArgs = Partial<Pick<StoreMachineStateInfo, 'machineName' | 'tenantId' | 'instanceId'>>
4
-
5
- export type FindMachineStatesFilterArgs = Array<Partial<Omit<StoreMachineStateInfo, 'state'>>>
6
-
7
- export type StoreFindMachineStatesArgs = {
8
- filter: FindMachineStatesFilterArgs
9
- }
10
-
11
- export type StoreMachineStateGetArgs = Pick<StoreMachineStateInfo, 'instanceId' | 'tenantId'>
12
-
13
- export type StoreMachineStateDeleteArgs = StoreMachineStateGetArgs
14
- export type StoreMachineStateDeleteExpiredArgs = { machineName?: string; tenantId?: string; deleteDoneStates?: boolean }
15
-
16
- export interface StoreMachineStateInfo {
17
- /**
18
- * Unique instance ID of the machine
19
- */
20
- instanceId: string
21
-
22
- /**
23
- * Session Id of the machine. Not necessarily unique
24
- */
25
- sessionId?: string
26
-
27
- /**
28
- * Machine name
29
- */
30
- machineName: string
31
-
32
- /**
33
- * The latest state name. Can be empty for a newly initialize machine
34
- */
35
- latestStateName?: string
36
-
37
- /**
38
- * event types like SET_TOC, SET_FIRSTNAME, .... Will be xstate.init on a newly initialized machine
39
- */
40
- latestEventType: string
41
-
42
- /**
43
- * Serialized Machine state
44
- */
45
- state: string
46
-
47
- /**
48
- * Represents the creation date
49
- */
50
- createdAt: Date
51
-
52
- /**
53
- * Represents the expiration date
54
- */
55
- expiresAt?: Date
56
-
57
- /**
58
- * Represents the update date
59
- */
60
- updatedAt: Date
61
-
62
- /**
63
- * Represents a counter for tracking updates.
64
- */
65
- updatedCount: number
66
- completedAt?: Date
67
- tenantId?: string
68
- }
1
+ export type StoreMachineStatePersistArgs = Omit<StoreMachineStateInfo, 'createdAt' | 'updatedAt'>
2
+
3
+ export type StoreMachineStatesFindActiveArgs = Partial<Pick<StoreMachineStateInfo, 'machineName' | 'tenantId' | 'instanceId'>>
4
+
5
+ export type FindMachineStatesFilterArgs = Array<Partial<Omit<StoreMachineStateInfo, 'state'>>>
6
+
7
+ export type StoreFindMachineStatesArgs = {
8
+ filter: FindMachineStatesFilterArgs
9
+ }
10
+
11
+ export type StoreMachineStateGetArgs = Pick<StoreMachineStateInfo, 'instanceId' | 'tenantId'>
12
+
13
+ export type StoreMachineStateDeleteArgs = StoreMachineStateGetArgs
14
+ export type StoreMachineStateDeleteExpiredArgs = { machineName?: string; tenantId?: string; deleteDoneStates?: boolean }
15
+
16
+ export interface StoreMachineStateInfo {
17
+ /**
18
+ * Unique instance ID of the machine
19
+ */
20
+ instanceId: string
21
+
22
+ /**
23
+ * Session Id of the machine. Not necessarily unique
24
+ */
25
+ sessionId?: string
26
+
27
+ /**
28
+ * Machine name
29
+ */
30
+ machineName: string
31
+
32
+ /**
33
+ * The latest state name. Can be empty for a newly initialize machine
34
+ */
35
+ latestStateName?: string
36
+
37
+ /**
38
+ * event types like SET_TOC, SET_FIRSTNAME, .... Will be xstate.init on a newly initialized machine
39
+ */
40
+ latestEventType: string
41
+
42
+ /**
43
+ * Serialized Machine state
44
+ */
45
+ state: string
46
+
47
+ /**
48
+ * Represents the creation date
49
+ */
50
+ createdAt: Date
51
+
52
+ /**
53
+ * Represents the expiration date
54
+ */
55
+ expiresAt?: Date
56
+
57
+ /**
58
+ * Represents the update date
59
+ */
60
+ updatedAt: Date
61
+
62
+ /**
63
+ * Represents a counter for tracking updates.
64
+ */
65
+ updatedCount: number
66
+ completedAt?: Date
67
+ tenantId?: string
68
+ }
@@ -1,25 +1,25 @@
1
- import { NonPersistedPresentationDefinitionItem, PresentationDefinitionItem, PresentationDefinitionItemFilter } from './presentationDefinition'
2
-
3
- export type FindDefinitionArgs = Array<PresentationDefinitionItemFilter>
4
-
5
- export type GetDefinitionArgs = {
6
- itemId: string
7
- }
8
-
9
- export type HasDefinitionArgs = GetDefinitionArgs
10
-
11
- export type GetDefinitionsArgs = {
12
- filter?: FindDefinitionArgs
13
- }
14
-
15
- export type HasDefinitionsArgs = GetDefinitionsArgs
16
-
17
- export type AddDefinitionArgs = NonPersistedPresentationDefinitionItem
18
-
19
- export type UpdateDefinitionArgs = PresentationDefinitionItem
20
-
21
- export type DeleteDefinitionArgs = {
22
- itemId: string
23
- }
24
-
25
- export type DeleteDefinitionsArgs = GetDefinitionsArgs
1
+ import { NonPersistedPresentationDefinitionItem, PresentationDefinitionItem, PresentationDefinitionItemFilter } from './presentationDefinition'
2
+
3
+ export type FindDefinitionArgs = Array<PresentationDefinitionItemFilter>
4
+
5
+ export type GetDefinitionArgs = {
6
+ itemId: string
7
+ }
8
+
9
+ export type HasDefinitionArgs = GetDefinitionArgs
10
+
11
+ export type GetDefinitionsArgs = {
12
+ filter?: FindDefinitionArgs
13
+ }
14
+
15
+ export type HasDefinitionsArgs = GetDefinitionsArgs
16
+
17
+ export type AddDefinitionArgs = NonPersistedPresentationDefinitionItem
18
+
19
+ export type UpdateDefinitionArgs = PresentationDefinitionItem
20
+
21
+ export type DeleteDefinitionArgs = {
22
+ itemId: string
23
+ }
24
+
25
+ export type DeleteDefinitionsArgs = GetDefinitionsArgs
@@ -1,17 +1,17 @@
1
- import { IPresentationDefinition } from '@sphereon/pex'
2
-
3
- export type PresentationDefinitionItem = {
4
- id: string
5
- definitionId: string
6
- tenantId?: string
7
- version: string
8
- name?: string
9
- purpose?: string
10
- definitionPayload: IPresentationDefinition
11
- createdAt: Date
12
- lastUpdatedAt: Date
13
- }
14
-
15
- export type NonPersistedPresentationDefinitionItem = Omit<PresentationDefinitionItem, 'id' | 'createdAt' | 'lastUpdatedAt'>
16
- export type PartialPresentationDefinitionItem = Partial<PresentationDefinitionItem>
17
- export type PresentationDefinitionItemFilter = Partial<Omit<PresentationDefinitionItem, 'definitionPayload'>> // TODO add logic to linearize & hash definitionPayload into a separate column so we can filter on it?
1
+ import { IPresentationDefinition } from '@sphereon/pex'
2
+
3
+ export type PresentationDefinitionItem = {
4
+ id: string
5
+ definitionId: string
6
+ tenantId?: string
7
+ version: string
8
+ name?: string
9
+ purpose?: string
10
+ definitionPayload: IPresentationDefinition
11
+ createdAt: Date
12
+ lastUpdatedAt: Date
13
+ }
14
+
15
+ export type NonPersistedPresentationDefinitionItem = Omit<PresentationDefinitionItem, 'id' | 'createdAt' | 'lastUpdatedAt'>
16
+ export type PartialPresentationDefinitionItem = Partial<PresentationDefinitionItem>
17
+ export type PresentationDefinitionItemFilter = Partial<Omit<PresentationDefinitionItem, 'definitionPayload'>> // TODO add logic to linearize & hash definitionPayload into a separate column so we can filter on it?
@@ -1,16 +1,16 @@
1
- import { BaseEntity, FindOptionsOrder } from 'typeorm'
2
-
3
- export const parseAndValidateOrderOptions = <T extends BaseEntity>(order: string): FindOptionsOrder<T> => {
4
- const orderPairs = order.split(',').map((pair) => pair.trim().split('.'))
5
- const orderOptions: FindOptionsOrder<T> = {}
6
-
7
- orderPairs.forEach(([field, direction]) => {
8
- const dir = direction.toUpperCase()
9
- if (dir !== 'ASC' && dir !== 'DESC') {
10
- throw new Error(`Invalid order direction: '${direction}'. Must be 'asc' or 'desc'.`)
11
- }
12
- ;(orderOptions as any)[field] = dir
13
- })
14
-
15
- return orderOptions
16
- }
1
+ import { BaseEntity, FindOptionsOrder } from 'typeorm'
2
+
3
+ export const parseAndValidateOrderOptions = <T extends BaseEntity>(order: string): FindOptionsOrder<T> => {
4
+ const orderPairs = order.split(',').map((pair) => pair.trim().split('.'))
5
+ const orderOptions: FindOptionsOrder<T> = {}
6
+
7
+ orderPairs.forEach(([field, direction]) => {
8
+ const dir = direction.toUpperCase()
9
+ if (dir !== 'ASC' && dir !== 'DESC') {
10
+ throw new Error(`Invalid order direction: '${direction}'. Must be 'asc' or 'desc'.`)
11
+ }
12
+ ;(orderOptions as any)[field] = dir
13
+ })
14
+
15
+ return orderOptions
16
+ }