@sphereon/ssi-sdk.data-store 0.18.2-unstable.98 → 0.19.1-next.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contact/AbstractContactStore.d.ts.map +1 -1
- package/dist/contact/AbstractContactStore.js.map +1 -1
- package/dist/contact/ContactStore.d.ts.map +1 -1
- package/dist/contact/ContactStore.js +12 -6
- package/dist/contact/ContactStore.js.map +1 -1
- package/dist/entities/machineState/MachineStateInfoEntity.d.ts +33 -0
- package/dist/entities/machineState/MachineStateInfoEntity.d.ts.map +1 -0
- package/dist/entities/machineState/MachineStateInfoEntity.js +85 -0
- package/dist/entities/machineState/MachineStateInfoEntity.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.d.ts.map +1 -1
- package/dist/issuanceBranding/IssuanceBrandingStore.js.map +1 -1
- package/dist/machineState/IAbstractMachineStateStore.d.ts +52 -0
- package/dist/machineState/IAbstractMachineStateStore.d.ts.map +1 -0
- package/dist/machineState/IAbstractMachineStateStore.js +13 -0
- package/dist/machineState/IAbstractMachineStateStore.js.map +1 -0
- package/dist/machineState/MachineStateStore.d.ts +21 -0
- package/dist/machineState/MachineStateStore.d.ts.map +1 -0
- package/dist/machineState/MachineStateStore.js +139 -0
- package/dist/machineState/MachineStateStore.js.map +1 -0
- package/dist/migrations/generic/7-CreateMachineStateStore.d.ts +7 -0
- package/dist/migrations/generic/7-CreateMachineStateStore.d.ts.map +1 -0
- package/dist/migrations/generic/7-CreateMachineStateStore.js +78 -0
- package/dist/migrations/generic/7-CreateMachineStateStore.js.map +1 -0
- package/dist/migrations/generic/index.d.ts +2 -0
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +4 -1
- package/dist/migrations/generic/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.d.ts +7 -0
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.d.ts.map +1 -0
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +45 -0
- package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js.map +1 -0
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.d.ts +7 -0
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.d.ts.map +1 -0
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +44 -0
- package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js.map +1 -0
- package/dist/types/contact/contact.d.ts.map +1 -1
- package/dist/types/contact/contact.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/machineState/IAbstractMachineStateStore.d.ts +58 -0
- package/dist/types/machineState/IAbstractMachineStateStore.d.ts.map +1 -0
- package/dist/types/machineState/IAbstractMachineStateStore.js +3 -0
- package/dist/types/machineState/IAbstractMachineStateStore.js.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/contact.entities.test.ts +32 -15
- package/src/__tests__/contact.store.test.ts +71 -28
- package/src/__tests__/machineState.entities.test.ts +51 -0
- package/src/__tests__/machineState.store.test.ts +174 -0
- package/src/contact/AbstractContactStore.ts +3 -2
- package/src/contact/ContactStore.ts +15 -9
- package/src/entities/contact/PhysicalAddressEntity.ts +1 -1
- package/src/entities/machineState/MachineStateInfoEntity.ts +58 -0
- package/src/index.ts +9 -0
- package/src/issuanceBranding/IssuanceBrandingStore.ts +6 -8
- package/src/machineState/IAbstractMachineStateStore.ts +65 -0
- package/src/machineState/MachineStateStore.ts +149 -0
- package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -0
- package/src/migrations/generic/index.ts +3 -0
- package/src/migrations/index.ts +1 -0
- package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -0
- package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -0
- package/src/types/contact/contact.ts +13 -2
- package/src/types/index.ts +1 -0
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
|
@@ -4,6 +4,7 @@ import { CreateContacts1690925872318 } from './3-CreateContacts'
|
|
|
4
4
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList'
|
|
5
5
|
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
|
|
6
6
|
import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredential'
|
|
7
|
+
import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
@@ -19,6 +20,7 @@ export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding165946
|
|
|
19
20
|
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
|
|
20
21
|
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
|
|
21
22
|
export const DataStoreDigitalCredentialMigrations = [CreateDigitalCredential1708525189000]
|
|
23
|
+
export const DataStoreMachineStateMigrations = [CreateMachineStateStore1708098041262]
|
|
22
24
|
|
|
23
25
|
// All migrations together
|
|
24
26
|
export const DataStoreMigrations = [
|
|
@@ -27,4 +29,5 @@ export const DataStoreMigrations = [
|
|
|
27
29
|
...DataStoreStatusListMigrations,
|
|
28
30
|
...DataStoreEventLoggerMigrations,
|
|
29
31
|
...DataStoreDigitalCredentialMigrations,
|
|
32
|
+
...DataStoreMachineStateMigrations,
|
|
30
33
|
]
|
package/src/migrations/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateMachineStateStore1708797018115 implements MigrationInterface {
|
|
4
|
+
name = 'CreateMachineStateStore1708797018115'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
9
|
+
"instance_id" text NOT NULL,
|
|
10
|
+
"session_id" text,
|
|
11
|
+
"latest_state_name" text,
|
|
12
|
+
"machine_name" text NOT NULL,
|
|
13
|
+
"latest_event_type" text NOT NULL,
|
|
14
|
+
"state" text NOT NULL,
|
|
15
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
16
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
17
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
18
|
+
"expires_at" TIMESTAMP,
|
|
19
|
+
"completed_at" TIMESTAMP,
|
|
20
|
+
"tenant_id" text,
|
|
21
|
+
CONSTRAINT "PK_MachineStateInfoEntity_id" PRIMARY KEY ("instance_id")
|
|
22
|
+
)
|
|
23
|
+
`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
27
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm'
|
|
2
|
+
|
|
3
|
+
export class CreateMachineStateStore1708796002272 implements MigrationInterface {
|
|
4
|
+
name = 'CreateMachineStateStore1708796002272'
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(`
|
|
8
|
+
CREATE TABLE "MachineStateInfoEntity" (
|
|
9
|
+
"instance_id" varchar PRIMARY KEY NOT NULL,
|
|
10
|
+
"session_id" varchar,
|
|
11
|
+
"machine_name" varchar NOT NULL,
|
|
12
|
+
"latest_state_name" varchar,
|
|
13
|
+
"latest_event_type" varchar NOT NULL,
|
|
14
|
+
"state" text NOT NULL,
|
|
15
|
+
"created_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
16
|
+
"updated_at" datetime NOT NULL DEFAULT (datetime('now')),
|
|
17
|
+
"updated_count" integer NOT NULL DEFAULT 0,
|
|
18
|
+
"expires_at" datetime,
|
|
19
|
+
"completed_at" datetime,
|
|
20
|
+
"tenant_id" varchar
|
|
21
|
+
)
|
|
22
|
+
`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
26
|
+
await queryRunner.query(`DROP TABLE "MachineStateInfoEntity"`)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -15,7 +15,16 @@ export type Party = {
|
|
|
15
15
|
}
|
|
16
16
|
export type NonPersistedParty = Omit<
|
|
17
17
|
Party,
|
|
18
|
-
|
|
18
|
+
| 'id'
|
|
19
|
+
| 'identities'
|
|
20
|
+
| 'electronicAddresses'
|
|
21
|
+
| 'physicalAddresses'
|
|
22
|
+
| 'contact'
|
|
23
|
+
| 'roles'
|
|
24
|
+
| 'partyType'
|
|
25
|
+
| 'relationships'
|
|
26
|
+
| 'createdAt'
|
|
27
|
+
| 'lastUpdatedAt'
|
|
19
28
|
> & {
|
|
20
29
|
identities?: Array<NonPersistedIdentity>
|
|
21
30
|
electronicAddresses?: Array<NonPersistedElectronicAddress>
|
|
@@ -24,7 +33,9 @@ export type NonPersistedParty = Omit<
|
|
|
24
33
|
partyType: NonPersistedPartyType
|
|
25
34
|
relationships?: Array<NonPersistedPartyRelationship>
|
|
26
35
|
}
|
|
27
|
-
export type PartialParty = Partial<
|
|
36
|
+
export type PartialParty = Partial<
|
|
37
|
+
Omit<Party, 'identities' | 'electronicAddresses' | 'physicalAddresses' | 'contact' | 'partyType' | 'relationships'>
|
|
38
|
+
> & {
|
|
28
39
|
identities?: PartialIdentity
|
|
29
40
|
electronicAddresses?: PartialElectronicAddress
|
|
30
41
|
physicalAddresses?: PartialPhysicalAddress
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +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
|
+
}
|