@sphereon/ssi-sdk.data-store 0.19.1-next.24 → 0.19.1-next.75

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 (58) hide show
  1. package/dist/entities/machineState/MachineStateInfoEntity.d.ts +33 -0
  2. package/dist/entities/machineState/MachineStateInfoEntity.d.ts.map +1 -0
  3. package/dist/entities/machineState/MachineStateInfoEntity.js +85 -0
  4. package/dist/entities/machineState/MachineStateInfoEntity.js.map +1 -0
  5. package/dist/index.d.ts +7 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +11 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/machineState/IAbstractMachineStateStore.d.ts +52 -0
  10. package/dist/machineState/IAbstractMachineStateStore.d.ts.map +1 -0
  11. package/dist/machineState/IAbstractMachineStateStore.js +13 -0
  12. package/dist/machineState/IAbstractMachineStateStore.js.map +1 -0
  13. package/dist/machineState/MachineStateStore.d.ts +21 -0
  14. package/dist/machineState/MachineStateStore.d.ts.map +1 -0
  15. package/dist/machineState/MachineStateStore.js +137 -0
  16. package/dist/machineState/MachineStateStore.js.map +1 -0
  17. package/dist/migrations/generic/7-CreateMachineStateStore.d.ts +7 -0
  18. package/dist/migrations/generic/7-CreateMachineStateStore.d.ts.map +1 -0
  19. package/dist/migrations/generic/7-CreateMachineStateStore.js +78 -0
  20. package/dist/migrations/generic/7-CreateMachineStateStore.js.map +1 -0
  21. package/dist/migrations/generic/index.d.ts +2 -0
  22. package/dist/migrations/generic/index.d.ts.map +1 -1
  23. package/dist/migrations/generic/index.js +4 -1
  24. package/dist/migrations/generic/index.js.map +1 -1
  25. package/dist/migrations/index.d.ts +1 -1
  26. package/dist/migrations/index.d.ts.map +1 -1
  27. package/dist/migrations/index.js +2 -1
  28. package/dist/migrations/index.js.map +1 -1
  29. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.d.ts +7 -0
  30. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.d.ts.map +1 -0
  31. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js +45 -0
  32. package/dist/migrations/postgres/1708797018115-CreateMachineStateStore.js.map +1 -0
  33. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.d.ts +7 -0
  34. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.d.ts.map +1 -0
  35. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js +44 -0
  36. package/dist/migrations/sqlite/1708796002272-CreateMachineStateStore.js.map +1 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/index.js +1 -0
  40. package/dist/types/index.js.map +1 -1
  41. package/dist/types/machineState/IAbstractMachineStateStore.d.ts +58 -0
  42. package/dist/types/machineState/IAbstractMachineStateStore.d.ts.map +1 -0
  43. package/dist/types/machineState/IAbstractMachineStateStore.js +3 -0
  44. package/dist/types/machineState/IAbstractMachineStateStore.js.map +1 -0
  45. package/package.json +4 -4
  46. package/src/__tests__/machineState.entities.test.ts +51 -0
  47. package/src/__tests__/machineState.store.test.ts +174 -0
  48. package/src/entities/machineState/MachineStateInfoEntity.ts +58 -0
  49. package/src/index.ts +9 -0
  50. package/src/machineState/IAbstractMachineStateStore.ts +65 -0
  51. package/src/machineState/MachineStateStore.ts +151 -0
  52. package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -0
  53. package/src/migrations/generic/index.ts +3 -0
  54. package/src/migrations/index.ts +1 -0
  55. package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -0
  56. package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -0
  57. package/src/types/index.ts +1 -0
  58. package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
@@ -0,0 +1,33 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ /**
3
+ * @class MachineStateInfoEntity
4
+ * Represents a machine state. It allows to continue a machine at a later point in time at the point it was left of
5
+ *
6
+ * @param {string} instanceId - The instance ID of the machine state.
7
+ * @param {string} [sessionId] - The session ID of the machine state. (optional)
8
+ * @param {string} machineName - The name of the machine.
9
+ * @param {string} [latestStateName] - The name of the latest state. (optional)
10
+ * @param {string} latestEventType - The type of the latest event.
11
+ * @param {string} state - The current state of the machine.
12
+ * @param {Date} createdAt - The date and time when the machine state was created.
13
+ * @param {Date} updatedAt - The date and time when the machine state was last updated.
14
+ * @param {number} updatedCount - The number of times the machine state has been updated.
15
+ * @param {Date} [expiresAt] - The date and time when the machine state expires. (optional)
16
+ * @param {Date} [completedAt] - The date and time when the machine state was completed. (optional)
17
+ * @param {string} [tenantId] - The ID of the tenant associated with the machine state. (optional)
18
+ */
19
+ export declare class MachineStateInfoEntity extends BaseEntity {
20
+ instanceId: string;
21
+ sessionId?: string;
22
+ machineName: string;
23
+ latestStateName?: string;
24
+ latestEventType: string;
25
+ state: string;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ updatedCount: number;
29
+ expiresAt?: Date;
30
+ completedAt?: Date;
31
+ tenantId?: string;
32
+ }
33
+ //# sourceMappingURL=MachineStateInfoEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MachineStateInfoEntity.d.ts","sourceRoot":"","sources":["../../../src/entities/machineState/MachineStateInfoEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqE,MAAM,SAAS,CAAA;AAEvG;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,sBAAuB,SAAQ,UAAU;IAEpD,UAAU,EAAG,MAAM,CAAA;IAGnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAIlB,WAAW,EAAG,MAAM,CAAA;IAGpB,eAAe,CAAC,EAAE,MAAM,CAAA;IAGxB,eAAe,EAAG,MAAM,CAAA;IAGxB,KAAK,EAAG,MAAM,CAAA;IAGd,SAAS,EAAG,IAAI,CAAA;IAGhB,SAAS,EAAG,IAAI,CAAA;IAGhB,YAAY,EAAG,MAAM,CAAA;IAGrB,SAAS,CAAC,EAAE,IAAI,CAAA;IAGhB,WAAW,CAAC,EAAE,IAAI,CAAA;IAGlB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MachineStateInfoEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ /**
15
+ * @class MachineStateInfoEntity
16
+ * Represents a machine state. It allows to continue a machine at a later point in time at the point it was left of
17
+ *
18
+ * @param {string} instanceId - The instance ID of the machine state.
19
+ * @param {string} [sessionId] - The session ID of the machine state. (optional)
20
+ * @param {string} machineName - The name of the machine.
21
+ * @param {string} [latestStateName] - The name of the latest state. (optional)
22
+ * @param {string} latestEventType - The type of the latest event.
23
+ * @param {string} state - The current state of the machine.
24
+ * @param {Date} createdAt - The date and time when the machine state was created.
25
+ * @param {Date} updatedAt - The date and time when the machine state was last updated.
26
+ * @param {number} updatedCount - The number of times the machine state has been updated.
27
+ * @param {Date} [expiresAt] - The date and time when the machine state expires. (optional)
28
+ * @param {Date} [completedAt] - The date and time when the machine state was completed. (optional)
29
+ * @param {string} [tenantId] - The ID of the tenant associated with the machine state. (optional)
30
+ */
31
+ let MachineStateInfoEntity = class MachineStateInfoEntity extends typeorm_1.BaseEntity {
32
+ };
33
+ __decorate([
34
+ (0, typeorm_1.PrimaryColumn)({ name: 'instance_id', type: 'varchar', nullable: false }),
35
+ __metadata("design:type", String)
36
+ ], MachineStateInfoEntity.prototype, "instanceId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ name: 'session_id', type: 'varchar', nullable: true }),
39
+ __metadata("design:type", String)
40
+ ], MachineStateInfoEntity.prototype, "sessionId", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ name: 'machine_name', type: 'varchar', nullable: false }),
43
+ __metadata("design:type", String)
44
+ ], MachineStateInfoEntity.prototype, "machineName", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ name: 'latest_state_name', type: 'varchar', nullable: true }),
47
+ __metadata("design:type", String)
48
+ ], MachineStateInfoEntity.prototype, "latestStateName", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ name: 'latest_event_type', type: 'varchar', nullable: false }),
51
+ __metadata("design:type", String)
52
+ ], MachineStateInfoEntity.prototype, "latestEventType", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.Column)({ name: 'state', type: 'text', nullable: false }),
55
+ __metadata("design:type", String)
56
+ ], MachineStateInfoEntity.prototype, "state", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at', type: 'datetime', nullable: false }),
59
+ __metadata("design:type", Date)
60
+ ], MachineStateInfoEntity.prototype, "createdAt", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.UpdateDateColumn)({ name: 'updated_at', type: 'datetime', nullable: false }),
63
+ __metadata("design:type", Date)
64
+ ], MachineStateInfoEntity.prototype, "updatedAt", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({ name: 'updated_count', type: 'integer', nullable: false }),
67
+ __metadata("design:type", Number)
68
+ ], MachineStateInfoEntity.prototype, "updatedCount", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ name: 'expires_at', type: 'datetime', nullable: true }),
71
+ __metadata("design:type", Date)
72
+ ], MachineStateInfoEntity.prototype, "expiresAt", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ name: 'completed_at', type: 'datetime', nullable: true }),
75
+ __metadata("design:type", Date)
76
+ ], MachineStateInfoEntity.prototype, "completedAt", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({ name: 'tenant_id', type: 'varchar', nullable: true }),
79
+ __metadata("design:type", String)
80
+ ], MachineStateInfoEntity.prototype, "tenantId", void 0);
81
+ MachineStateInfoEntity = __decorate([
82
+ (0, typeorm_1.Entity)('MachineStateInfoEntity')
83
+ ], MachineStateInfoEntity);
84
+ exports.MachineStateInfoEntity = MachineStateInfoEntity;
85
+ //# sourceMappingURL=MachineStateInfoEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MachineStateInfoEntity.js","sourceRoot":"","sources":["../../../src/entities/machineState/MachineStateInfoEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuG;AAEvG;;;;;;;;;;;;;;;;GAgBG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,oBAAU;CAqCrD,CAAA;AApCC;IAAC,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0DACtD;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yDAC9C;AAGlB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;2DAC/C;AAEpB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+DAC/C;AAExB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;+DAChD;AAExB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;qDAC3C;AAEd;IAAC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BAChE,IAAI;yDAAA;AAEhB;IAAC,IAAA,0BAAgB,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;8BAChE,IAAI;yDAAA;AAEhB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;4DAC/C;AAErB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACrD,IAAI;yDAAA;AAEhB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACrD,IAAI;2DAAA;AAElB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wDAC9C;AApCN,sBAAsB;IADlC,IAAA,gBAAM,EAAC,wBAAwB,CAAC;GACpB,sBAAsB,CAqClC;AArCY,wDAAsB"}
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ import { IssuerBrandingEntity, issuerBrandingEntityFrom } from './entities/issua
18
18
  import { TextAttributesEntity, textAttributesEntityFrom } from './entities/issuanceBranding/TextAttributesEntity';
19
19
  import { StatusListEntity } from './entities/statusList2021/StatusList2021Entity';
20
20
  import { StatusListEntryEntity } from './entities/statusList2021/StatusList2021EntryEntity';
21
+ import { MachineStateInfoEntity } from './entities/machineState/MachineStateInfoEntity';
21
22
  import { IStatusListEntity, IStatusListEntryEntity } from './types';
22
23
  import { PartyRelationshipEntity } from './entities/contact/PartyRelationshipEntity';
23
24
  import { PartyTypeEntity } from './entities/contact/PartyTypeEntity';
@@ -33,7 +34,9 @@ import { DigitalCredentialEntity } from './entities/digitalCredential/DigitalCre
33
34
  import { digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs } from './utils/digitalCredential/MappingUtils';
34
35
  export { AbstractEventLoggerStore } from './eventLogger/AbstractEventLoggerStore';
35
36
  export { EventLoggerStore } from './eventLogger/EventLoggerStore';
36
- export { DataStoreMigrations, DataStoreEventLoggerMigrations, DataStoreContactMigrations, DataStoreIssuanceBrandingMigrations, DataStoreStatusListMigrations, } from './migrations';
37
+ export { IAbstractMachineStateStore } from './machineState/IAbstractMachineStateStore';
38
+ export { MachineStateStore } from './machineState/MachineStateStore';
39
+ export { DataStoreMigrations, DataStoreEventLoggerMigrations, DataStoreContactMigrations, DataStoreIssuanceBrandingMigrations, DataStoreStatusListMigrations, DataStoreMachineStateMigrations, } from './migrations';
37
40
  export * from './types';
38
41
  export * from './utils/contact/MappingUtils';
39
42
  export declare const DataStoreContactEntities: (typeof CorrelationIdentifierEntity | typeof IdentityMetadataItemEntity | typeof PartyTypeEntity | typeof PartyEntity | typeof BaseContactEntity | typeof PartyRelationshipEntity | typeof ConnectionEntity | typeof BaseConfigEntity)[];
@@ -41,6 +44,7 @@ export declare const DataStoreIssuanceBrandingEntities: (typeof ImageDimensionsE
41
44
  export declare const DataStoreStatusListEntities: (typeof StatusListEntryEntity | typeof StatusListEntity)[];
42
45
  export declare const DataStoreEventLoggerEntities: (typeof AuditEventEntity)[];
43
46
  export declare const DataStoreDigitalCredentialEntities: (typeof DigitalCredentialEntity)[];
44
- export declare const DataStoreEntities: (typeof StatusListEntryEntity | typeof StatusListEntity | typeof CorrelationIdentifierEntity | typeof IdentityMetadataItemEntity | typeof PartyTypeEntity | typeof PartyEntity | typeof BaseContactEntity | typeof PartyRelationshipEntity | typeof ConnectionEntity | typeof BaseConfigEntity | typeof ImageDimensionsEntity | typeof ImageAttributesEntity | typeof TextAttributesEntity | typeof BaseLocaleBrandingEntity | typeof CredentialBrandingEntity | typeof IssuerBrandingEntity | typeof AuditEventEntity | typeof DigitalCredentialEntity)[];
45
- export { BaseConfigEntity, ConnectionEntity, PartyEntity, CorrelationIdentifierEntity, DidAuthConfigEntity, IdentityEntity, IdentityMetadataItemEntity, OpenIdConfigEntity, BackgroundAttributesEntity, CredentialBrandingEntity, ImageAttributesEntity, ImageDimensionsEntity, BaseLocaleBrandingEntity, IssuerBrandingEntity, TextAttributesEntity, CredentialLocaleBrandingEntity, IssuerLocaleBrandingEntity, ElectronicAddressEntity, PhysicalAddressEntity, backgroundAttributesEntityFrom, credentialBrandingEntityFrom, imageAttributesEntityFrom, imageDimensionsEntityFrom, issuerBrandingEntityFrom, textAttributesEntityFrom, issuerLocaleBrandingEntityFrom, credentialLocaleBrandingEntityFrom, IStatusListEntity, IStatusListEntryEntity, StatusListEntity, StatusListEntryEntity, AuditEventEntity, auditEventEntityFrom, DigitalCredentialEntity, digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs, };
47
+ export declare const DataStoreMachineStateEntities: (typeof MachineStateInfoEntity)[];
48
+ export declare const DataStoreEntities: (typeof StatusListEntryEntity | typeof StatusListEntity | typeof CorrelationIdentifierEntity | typeof IdentityMetadataItemEntity | typeof PartyTypeEntity | typeof PartyEntity | typeof BaseContactEntity | typeof PartyRelationshipEntity | typeof ConnectionEntity | typeof BaseConfigEntity | typeof ImageDimensionsEntity | typeof ImageAttributesEntity | typeof TextAttributesEntity | typeof BaseLocaleBrandingEntity | typeof CredentialBrandingEntity | typeof IssuerBrandingEntity | typeof MachineStateInfoEntity | typeof AuditEventEntity | typeof DigitalCredentialEntity)[];
49
+ export { BaseConfigEntity, ConnectionEntity, PartyEntity, CorrelationIdentifierEntity, DidAuthConfigEntity, IdentityEntity, IdentityMetadataItemEntity, OpenIdConfigEntity, BackgroundAttributesEntity, CredentialBrandingEntity, ImageAttributesEntity, ImageDimensionsEntity, BaseLocaleBrandingEntity, IssuerBrandingEntity, TextAttributesEntity, CredentialLocaleBrandingEntity, IssuerLocaleBrandingEntity, ElectronicAddressEntity, PhysicalAddressEntity, backgroundAttributesEntityFrom, credentialBrandingEntityFrom, imageAttributesEntityFrom, imageDimensionsEntityFrom, issuerBrandingEntityFrom, textAttributesEntityFrom, issuerLocaleBrandingEntityFrom, credentialLocaleBrandingEntityFrom, IStatusListEntity, IStatusListEntryEntity, StatusListEntity, StatusListEntryEntity, AuditEventEntity, auditEventEntityFrom, DigitalCredentialEntity, digitalCredentialFrom, digitalCredentialsFrom, nonPersistedDigitalCredentialEntityFromAddArgs, MachineStateInfoEntity, };
46
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,EAAE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Ac,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,8BAA8B,CAAA;AAE5C,eAAO,MAAM,wBAAwB,0OAgBpC,CAAA;AAED,eAAO,MAAM,iCAAiC,iMAU7C,CAAA;AAED,eAAO,MAAM,2BAA2B,4DAA4C,CAAA;AAEpF,eAAO,MAAM,4BAA4B,6BAAqB,CAAA;AAE9D,eAAO,MAAM,kCAAkC,oCAA4B,CAAA;AAE3E,eAAO,MAAM,6BAA6B,mCAA2B,CAAA;AAGrE,eAAO,MAAM,iBAAiB,4jBAO7B,CAAA;AAED,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,2BAA2B,EAC3B,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,8BAA8B,EAC9B,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,4BAA4B,EAC5B,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,8CAA8C,EAC9C,sBAAsB,GACvB,CAAA"}
package/dist/index.js CHANGED
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DigitalCredentialEntity = exports.auditEventEntityFrom = exports.AuditEventEntity = exports.StatusListEntryEntity = exports.StatusListEntity = exports.credentialLocaleBrandingEntityFrom = exports.issuerLocaleBrandingEntityFrom = exports.textAttributesEntityFrom = exports.issuerBrandingEntityFrom = exports.imageDimensionsEntityFrom = exports.imageAttributesEntityFrom = exports.credentialBrandingEntityFrom = exports.backgroundAttributesEntityFrom = exports.PhysicalAddressEntity = exports.ElectronicAddressEntity = exports.IssuerLocaleBrandingEntity = exports.CredentialLocaleBrandingEntity = exports.TextAttributesEntity = exports.IssuerBrandingEntity = exports.BaseLocaleBrandingEntity = exports.ImageDimensionsEntity = exports.ImageAttributesEntity = exports.CredentialBrandingEntity = exports.BackgroundAttributesEntity = exports.OpenIdConfigEntity = exports.IdentityMetadataItemEntity = exports.IdentityEntity = exports.DidAuthConfigEntity = exports.CorrelationIdentifierEntity = exports.PartyEntity = exports.ConnectionEntity = exports.BaseConfigEntity = exports.DataStoreEntities = exports.DataStoreDigitalCredentialEntities = exports.DataStoreEventLoggerEntities = exports.DataStoreStatusListEntities = exports.DataStoreIssuanceBrandingEntities = exports.DataStoreContactEntities = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = exports.EventLoggerStore = exports.AbstractEventLoggerStore = exports.StatusListStore = exports.IssuanceBrandingStore = exports.AbstractIssuanceBrandingStore = exports.AbstractContactStore = exports.ContactStore = void 0;
18
- exports.nonPersistedDigitalCredentialEntityFromAddArgs = exports.digitalCredentialsFrom = exports.digitalCredentialFrom = void 0;
17
+ exports.StatusListEntity = exports.credentialLocaleBrandingEntityFrom = exports.issuerLocaleBrandingEntityFrom = exports.textAttributesEntityFrom = exports.issuerBrandingEntityFrom = exports.imageDimensionsEntityFrom = exports.imageAttributesEntityFrom = exports.credentialBrandingEntityFrom = exports.backgroundAttributesEntityFrom = exports.PhysicalAddressEntity = exports.ElectronicAddressEntity = exports.IssuerLocaleBrandingEntity = exports.CredentialLocaleBrandingEntity = exports.TextAttributesEntity = exports.IssuerBrandingEntity = exports.BaseLocaleBrandingEntity = exports.ImageDimensionsEntity = exports.ImageAttributesEntity = exports.CredentialBrandingEntity = exports.BackgroundAttributesEntity = exports.OpenIdConfigEntity = exports.IdentityMetadataItemEntity = exports.IdentityEntity = exports.DidAuthConfigEntity = exports.CorrelationIdentifierEntity = exports.PartyEntity = exports.ConnectionEntity = exports.BaseConfigEntity = exports.DataStoreEntities = exports.DataStoreMachineStateEntities = exports.DataStoreDigitalCredentialEntities = exports.DataStoreEventLoggerEntities = exports.DataStoreStatusListEntities = exports.DataStoreIssuanceBrandingEntities = exports.DataStoreContactEntities = exports.DataStoreMachineStateMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = exports.MachineStateStore = exports.IAbstractMachineStateStore = exports.EventLoggerStore = exports.AbstractEventLoggerStore = exports.StatusListStore = exports.IssuanceBrandingStore = exports.AbstractIssuanceBrandingStore = exports.AbstractContactStore = exports.ContactStore = void 0;
18
+ exports.MachineStateInfoEntity = exports.nonPersistedDigitalCredentialEntityFromAddArgs = exports.digitalCredentialsFrom = exports.digitalCredentialFrom = exports.DigitalCredentialEntity = exports.auditEventEntityFrom = exports.AuditEventEntity = exports.StatusListEntryEntity = void 0;
19
19
  const BaseConfigEntity_1 = require("./entities/contact/BaseConfigEntity");
20
20
  Object.defineProperty(exports, "BaseConfigEntity", { enumerable: true, get: function () { return BaseConfigEntity_1.BaseConfigEntity; } });
21
21
  const BaseLocaleBrandingEntity_1 = require("./entities/issuanceBranding/BaseLocaleBrandingEntity");
@@ -63,6 +63,8 @@ const StatusList2021Entity_1 = require("./entities/statusList2021/StatusList2021
63
63
  Object.defineProperty(exports, "StatusListEntity", { enumerable: true, get: function () { return StatusList2021Entity_1.StatusListEntity; } });
64
64
  const StatusList2021EntryEntity_1 = require("./entities/statusList2021/StatusList2021EntryEntity");
65
65
  Object.defineProperty(exports, "StatusListEntryEntity", { enumerable: true, get: function () { return StatusList2021EntryEntity_1.StatusListEntryEntity; } });
66
+ const MachineStateInfoEntity_1 = require("./entities/machineState/MachineStateInfoEntity");
67
+ Object.defineProperty(exports, "MachineStateInfoEntity", { enumerable: true, get: function () { return MachineStateInfoEntity_1.MachineStateInfoEntity; } });
66
68
  const PartyRelationshipEntity_1 = require("./entities/contact/PartyRelationshipEntity");
67
69
  const PartyTypeEntity_1 = require("./entities/contact/PartyTypeEntity");
68
70
  const OrganizationEntity_1 = require("./entities/contact/OrganizationEntity");
@@ -94,12 +96,17 @@ var AbstractEventLoggerStore_1 = require("./eventLogger/AbstractEventLoggerStore
94
96
  Object.defineProperty(exports, "AbstractEventLoggerStore", { enumerable: true, get: function () { return AbstractEventLoggerStore_1.AbstractEventLoggerStore; } });
95
97
  var EventLoggerStore_1 = require("./eventLogger/EventLoggerStore");
96
98
  Object.defineProperty(exports, "EventLoggerStore", { enumerable: true, get: function () { return EventLoggerStore_1.EventLoggerStore; } });
99
+ var IAbstractMachineStateStore_1 = require("./machineState/IAbstractMachineStateStore");
100
+ Object.defineProperty(exports, "IAbstractMachineStateStore", { enumerable: true, get: function () { return IAbstractMachineStateStore_1.IAbstractMachineStateStore; } });
101
+ var MachineStateStore_1 = require("./machineState/MachineStateStore");
102
+ Object.defineProperty(exports, "MachineStateStore", { enumerable: true, get: function () { return MachineStateStore_1.MachineStateStore; } });
97
103
  var migrations_1 = require("./migrations");
98
104
  Object.defineProperty(exports, "DataStoreMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreMigrations; } });
99
105
  Object.defineProperty(exports, "DataStoreEventLoggerMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreEventLoggerMigrations; } });
100
106
  Object.defineProperty(exports, "DataStoreContactMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreContactMigrations; } });
101
107
  Object.defineProperty(exports, "DataStoreIssuanceBrandingMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreIssuanceBrandingMigrations; } });
102
108
  Object.defineProperty(exports, "DataStoreStatusListMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreStatusListMigrations; } });
109
+ Object.defineProperty(exports, "DataStoreMachineStateMigrations", { enumerable: true, get: function () { return migrations_1.DataStoreMachineStateMigrations; } });
103
110
  __exportStar(require("./types"), exports);
104
111
  __exportStar(require("./utils/contact/MappingUtils"), exports);
105
112
  exports.DataStoreContactEntities = [
@@ -133,6 +140,7 @@ exports.DataStoreIssuanceBrandingEntities = [
133
140
  exports.DataStoreStatusListEntities = [StatusList2021Entity_1.StatusListEntity, StatusList2021EntryEntity_1.StatusListEntryEntity];
134
141
  exports.DataStoreEventLoggerEntities = [AuditEventEntity_1.AuditEventEntity];
135
142
  exports.DataStoreDigitalCredentialEntities = [DigitalCredentialEntity_1.DigitalCredentialEntity];
143
+ exports.DataStoreMachineStateEntities = [MachineStateInfoEntity_1.MachineStateInfoEntity];
136
144
  // All entities combined if a party wants to enable them all at once
137
145
  exports.DataStoreEntities = [
138
146
  ...exports.DataStoreContactEntities,
@@ -140,5 +148,6 @@ exports.DataStoreEntities = [
140
148
  ...exports.DataStoreStatusListEntities,
141
149
  ...exports.DataStoreEventLoggerEntities,
142
150
  ...exports.DataStoreDigitalCredentialEntities,
151
+ ...exports.DataStoreMachineStateEntities,
143
152
  ];
144
153
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,0EAAsE;AA6FpE,iGA7FO,mCAAgB,OA6FP;AA5FlB,mGAA+F;AAwG7F,yGAxGO,mDAAwB,OAwGP;AAvG1B,4EAAwE;AACxE,0EAAsE;AA2FpE,iGA3FO,mCAAgB,OA2FP;AA1FlB,gEAA4D;AA2F1D,4FA3FO,yBAAW,OA2FP;AA1Fb,gGAA4F;AA2F1F,4GA3FO,yDAA2B,OA2FP;AA1F7B,gFAA4E;AA2F1E,oGA3FO,yCAAmB,OA2FP;AA1FrB,sEAAkE;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ChB,mCAAgB;IAChB,yBAAW;IACX,+BAAc;IACd,uDAA0B;IAC1B,yDAA2B;IAC3B,yCAAmB;IACnB,uCAAkB;IAClB,iDAAuB;IACvB,iCAAe;IACf,qCAAiB;IACjB,uCAAkB;IAClB,yCAAmB;IACnB,iDAAuB;IACvB,6CAAqB;CACtB,CAAA;AAEY,QAAA,iCAAiC,GAAG;IAC/C,uDAA0B;IAC1B,mDAAwB;IACxB,6CAAqB;IACrB,6CAAqB;IACrB,mDAAwB;IACxB,2CAAoB;IACpB,2CAAoB;IACpB,+DAA8B;IAC9B,uDAA0B;CAC3B,CAAA;AAEY,QAAA,2BAA2B,GAAG,CAAC,uCAAgB,EAAE,iDAAqB,CAAC,CAAA;AAEvE,QAAA,4BAA4B,GAAG,CAAC,mCAAgB,CAAC,CAAA;AAEjD,QAAA,kCAAkC,GAAG,CAAC,iDAAuB,CAAC,CAAA;AAE9D,QAAA,6BAA6B,GAAG,CAAC,+CAAsB,CAAC,CAAA;AAErE,oEAAoE;AACvD,QAAA,iBAAiB,GAAG;IAC/B,GAAG,gCAAwB;IAC3B,GAAG,yCAAiC;IACpC,GAAG,mCAA2B;IAC9B,GAAG,oCAA4B;IAC/B,GAAG,0CAAkC;IACrC,GAAG,qCAA6B;CACjC,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { StoreMachineStateDeleteExpiredArgs, StoreMachineStateDeleteArgs, StoreMachineStatesFindActiveArgs, StoreFindMachineStatesArgs, StoreMachineStatePersistArgs, StoreMachineStateInfo, StoreMachineStateGetArgs } from '../types';
2
+ /**
3
+ * Represents an abstract class for storing machine states.
4
+ * This class provides methods for persisting, retrieving, and deleting machine states.
5
+ *
6
+ * @interface
7
+ */
8
+ export declare abstract class IAbstractMachineStateStore {
9
+ /**
10
+ * Persists the machine state.
11
+ *
12
+ * @param {StoreMachineStatePersistArgs} state - The object containing the machine state to persist.
13
+ * @return {Promise<StoreMachineStateInfo>} - A Promise that resolves to the information about the persisted machine state.
14
+ */
15
+ abstract persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>;
16
+ /**
17
+ * Finds active machine states based on the given arguments.
18
+ *
19
+ * @param {StoreMachineStatesFindActiveArgs} args - The arguments for finding active machine states.
20
+ * @return {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves with an array of active machine states.
21
+ */
22
+ abstract findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>;
23
+ /**
24
+ * Retrieves the state of a particular machine.
25
+ *
26
+ * @param {StoreMachineStateGetArgs} args - The arguments for retrieving the machine state.
27
+ * @returns {Promise<StoreMachineStateInfo>} - A promise that resolves to the machine state information.
28
+ */
29
+ abstract getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>;
30
+ /**
31
+ * Finds the machine states based on the given arguments.
32
+ *
33
+ * @param {StoreFindMachineStatesArgs} [args] - The arguments to filter the machine states.
34
+ * @returns {Promise<Array<StoreMachineStateInfo>>} - A promise that resolves to an array of machine state information.
35
+ */
36
+ abstract findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>;
37
+ /**
38
+ * Deletes a machine state.
39
+ *
40
+ * @param {StoreMachineStateDeleteArgs} args - The arguments for deleting the machine state.
41
+ * @return {Promise<boolean>} - A promise that resolves to a boolean indicating if the machine state was successfully deleted or not.
42
+ */
43
+ abstract deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>;
44
+ /**
45
+ * Deletes expired machine states from the database.
46
+ *
47
+ * @param {StoreMachineStateDeleteExpiredArgs} args - The arguments for deleting expired machine states.
48
+ * @return {Promise<number>} - A promise that resolves to the number of deleted machine states.
49
+ */
50
+ abstract deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>;
51
+ }
52
+ //# sourceMappingURL=IAbstractMachineStateStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAbstractMachineStateStore.d.ts","sourceRoot":"","sources":["../../src/machineState/IAbstractMachineStateStore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,wBAAwB,EACzB,MAAM,UAAU,CAAA;AAEjB;;;;;GAKG;AACH,8BAAsB,0BAA0B;IAC9C;;;;;OAKG;IACH,QAAQ,CAAC,mBAAmB,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAEjG;;;;;OAKG;IACH,QAAQ,CAAC,uBAAuB,CAAC,IAAI,EAAE,gCAAgC,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAE/G;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAExF;;;;;OAKG;IACH,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEpG;;;;;OAKG;IACH,QAAQ,CAAC,kBAAkB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC;IAEhF;;;;;OAKG;IACH,QAAQ,CAAC,0BAA0B,CAAC,IAAI,EAAE,kCAAkC,GAAG,OAAO,CAAC,MAAM,CAAC;CAC/F"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IAbstractMachineStateStore = void 0;
4
+ /**
5
+ * Represents an abstract class for storing machine states.
6
+ * This class provides methods for persisting, retrieving, and deleting machine states.
7
+ *
8
+ * @interface
9
+ */
10
+ class IAbstractMachineStateStore {
11
+ }
12
+ exports.IAbstractMachineStateStore = IAbstractMachineStateStore;
13
+ //# sourceMappingURL=IAbstractMachineStateStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAbstractMachineStateStore.js","sourceRoot":"","sources":["../../src/machineState/IAbstractMachineStateStore.ts"],"names":[],"mappings":";;;AAUA;;;;;GAKG;AACH,MAAsB,0BAA0B;CAgD/C;AAhDD,gEAgDC"}
@@ -0,0 +1,21 @@
1
+ import { OrPromise } from '@sphereon/ssi-types';
2
+ import { DataSource } from 'typeorm';
3
+ import { MachineStateInfoEntity } from '../entities/machineState/MachineStateInfoEntity';
4
+ import { StoreFindMachineStatesArgs, StoreMachineStateDeleteArgs, StoreMachineStateDeleteExpiredArgs, StoreMachineStateGetArgs, StoreMachineStateInfo, StoreMachineStatePersistArgs, StoreMachineStatesFindActiveArgs } from '../types';
5
+ import { IAbstractMachineStateStore } from './IAbstractMachineStateStore';
6
+ /**
7
+ * Represents a data store for managing machine states.
8
+ */
9
+ export declare class MachineStateStore extends IAbstractMachineStateStore {
10
+ private readonly _dbConnection;
11
+ constructor(dbConnection: OrPromise<DataSource>);
12
+ persistMachineState(state: StoreMachineStatePersistArgs): Promise<StoreMachineStateInfo>;
13
+ findActiveMachineStates(args: StoreMachineStatesFindActiveArgs): Promise<Array<StoreMachineStateInfo>>;
14
+ findMachineStates(args?: StoreFindMachineStatesArgs): Promise<Array<StoreMachineStateInfo>>;
15
+ getMachineState(args: StoreMachineStateGetArgs): Promise<StoreMachineStateInfo>;
16
+ deleteMachineState(args: StoreMachineStateDeleteArgs): Promise<boolean>;
17
+ deleteExpiredMachineStates(args: StoreMachineStateDeleteExpiredArgs): Promise<number>;
18
+ protected static machineInfoFrom: (machineStateInfoEntity: MachineStateInfoEntity) => StoreMachineStateInfo;
19
+ static machineStateInfoEntityFrom: (machineStateInfo: StoreMachineStateInfo | StoreMachineStatePersistArgs) => MachineStateInfoEntity;
20
+ }
21
+ //# sourceMappingURL=MachineStateStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MachineStateStore.d.ts","sourceRoot":"","sources":["../../src/machineState/MachineStateStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAY,UAAU,EAA2C,MAAM,SAAS,CAAA;AAEvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAA;AACxF,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,gCAAgC,EACjC,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAIzE;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,0BAA0B;IAC/D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAuB;gBAEzC,YAAY,EAAE,SAAS,CAAC,UAAU,CAAC;IAKzC,mBAAmB,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAyBxF,uBAAuB,CAAC,IAAI,EAAE,gCAAgC,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAgCtG,iBAAiB,CAAC,IAAI,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAW3F,eAAe,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAM/E,kBAAkB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC;IAgBvE,0BAA0B,CAAC,IAAI,EAAE,kCAAkC,GAAG,OAAO,CAAC,MAAM,CAAC;IAqB3F,SAAS,CAAC,MAAM,CAAC,eAAe,2BAA4B,sBAAsB,KAAG,qBAAqB,CAGzG;IAED,MAAM,CAAC,0BAA0B,qBAAsB,qBAAqB,GAAG,4BAA4B,KAAG,sBAAsB,CAInI;CACF"}
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.MachineStateStore = void 0;
16
+ const debug_1 = __importDefault(require("debug"));
17
+ const typeorm_1 = require("typeorm");
18
+ const MachineStateInfoEntity_1 = require("../entities/machineState/MachineStateInfoEntity");
19
+ const IAbstractMachineStateStore_1 = require("./IAbstractMachineStateStore");
20
+ const debug = (0, debug_1.default)('sphereon:ssi-sdk:machine-state:store');
21
+ /**
22
+ * Represents a data store for managing machine states.
23
+ */
24
+ class MachineStateStore extends IAbstractMachineStateStore_1.IAbstractMachineStateStore {
25
+ constructor(dbConnection) {
26
+ super();
27
+ this._dbConnection = dbConnection;
28
+ }
29
+ persistMachineState(state) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const connection = yield this._dbConnection;
32
+ const { machineName, instanceId, tenantId } = state;
33
+ debug(`Executing persistMachineState for machine ${machineName}, instance ${instanceId}, tenantId: ${tenantId}...`);
34
+ const entity = MachineStateStore.machineStateInfoEntityFrom(state);
35
+ const existing = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).findOne({
36
+ where: {
37
+ instanceId: state.instanceId,
38
+ },
39
+ });
40
+ if (existing && existing.updatedCount > state.updatedCount) {
41
+ return Promise.reject(new Error(`Updating machine state with an older version is not allowed. Machine ${existing.machineName}, last count: ${existing.updatedCount}, new count: ${existing.updatedCount}, last updated: ${existing.updatedAt}, current: ${new Date()}, instance: ${existing.instanceId}`));
42
+ }
43
+ // No need for a transaction. This is a single entity. We don't want to be surprised by an isolation level hiding the state from others
44
+ const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).save(entity, { transaction: false });
45
+ debug(`Done persistMachineState machine ${machineName}, instance ${instanceId}, tenantId: ${tenantId}`);
46
+ return MachineStateStore.machineInfoFrom(result);
47
+ });
48
+ }
49
+ findActiveMachineStates(args) {
50
+ var _a;
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const { tenantId, machineName, instanceId } = args;
53
+ const connection = yield this._dbConnection;
54
+ debug(`Executing findActiveMachineStates query with machineName: ${machineName}, tenantId: ${tenantId}`);
55
+ const queryBuilder = connection
56
+ .getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity)
57
+ .createQueryBuilder('state')
58
+ .where('state.completedAt IS NULL')
59
+ .andWhere(new typeorm_1.Brackets((qb) => {
60
+ qb.where('state.expiresAt IS NULL').orWhere('state.expiresAt > :now', { now: new Date() });
61
+ }));
62
+ if (instanceId) {
63
+ queryBuilder.andWhere('state.instanceId = :instanceId', { instanceId });
64
+ }
65
+ if (tenantId) {
66
+ queryBuilder.andWhere('state.tenantId = :tenantId', { tenantId });
67
+ }
68
+ if (machineName) {
69
+ queryBuilder.andWhere('state.machineName = :machineName', { machineName });
70
+ }
71
+ return ((_a = (yield queryBuilder
72
+ .orderBy('state.updatedAt', 'DESC')
73
+ .getMany()
74
+ .then((entities) => entities.map(MachineStateStore.machineInfoFrom)))) !== null && _a !== void 0 ? _a : []);
75
+ });
76
+ }
77
+ findMachineStates(args) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const connection = yield this._dbConnection;
80
+ debug('findMachineStates', args);
81
+ const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).find(Object.assign(Object.assign({}, ((args === null || args === void 0 ? void 0 : args.filter) && { where: args === null || args === void 0 ? void 0 : args.filter })), { transaction: false }));
82
+ return result.map((event) => MachineStateStore.machineInfoFrom(event));
83
+ });
84
+ }
85
+ getMachineState(args) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ const connection = yield this._dbConnection;
88
+ debug('getMachineState', args);
89
+ return connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).findOneOrFail({ where: { instanceId: args.instanceId } });
90
+ });
91
+ }
92
+ deleteMachineState(args) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ debug(`Executing deleteMachineState query with id: ${args.instanceId}`);
95
+ if (!args.instanceId) {
96
+ throw new Error('No instanceId parameter is provided.');
97
+ }
98
+ try {
99
+ const connection = yield this._dbConnection;
100
+ const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).delete(args.instanceId);
101
+ return result.affected != null && result.affected > 0;
102
+ }
103
+ catch (error) {
104
+ debug(`Error deleting state: ${error}`);
105
+ return false;
106
+ }
107
+ });
108
+ }
109
+ deleteExpiredMachineStates(args) {
110
+ var _a;
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ const { machineName, tenantId, deleteDoneStates } = args;
113
+ debug(`Executing deleteExpiredMachineStates query with params: ${JSON.stringify(args)}`);
114
+ try {
115
+ const connection = yield this._dbConnection;
116
+ const deleteCriteria = Object.assign(Object.assign(Object.assign(Object.assign({}, (machineName && { machineName })), (tenantId && { tenantId })), (!deleteDoneStates && { expiresAt: (0, typeorm_1.LessThan)(new Date()) })), (deleteDoneStates && { completedAt: (0, typeorm_1.Not)((0, typeorm_1.IsNull)()) }));
117
+ const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).delete(deleteCriteria);
118
+ return (_a = result.affected) !== null && _a !== void 0 ? _a : 0;
119
+ }
120
+ catch (error) {
121
+ debug(`Error deleting machine info: ${error}`);
122
+ return Promise.reject(new Error(`Error deleting expired machine states for machine type ${machineName}`));
123
+ }
124
+ });
125
+ }
126
+ }
127
+ exports.MachineStateStore = MachineStateStore;
128
+ MachineStateStore.machineInfoFrom = (machineStateInfoEntity) => {
129
+ // We are making sure no entity function get copied
130
+ return JSON.parse(JSON.stringify(machineStateInfoEntity));
131
+ };
132
+ MachineStateStore.machineStateInfoEntityFrom = (machineStateInfo) => {
133
+ const entity = new MachineStateInfoEntity_1.MachineStateInfoEntity();
134
+ Object.assign(entity, machineStateInfo);
135
+ return entity;
136
+ };
137
+ //# sourceMappingURL=MachineStateStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MachineStateStore.js","sourceRoot":"","sources":["../../src/machineState/MachineStateStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAAyB;AACzB,qCAAuF;AAEvF,4FAAwF;AAUxF,6EAAyE;AAEzE,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,sCAAsC,CAAC,CAAA;AAE3D;;GAEG;AACH,MAAa,iBAAkB,SAAQ,uDAA0B;IAG/D,YAAY,YAAmC;QAC7C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,aAAa,GAAG,YAAY,CAAA;IACnC,CAAC;IAEK,mBAAmB,CAAC,KAAmC;;YAC3D,MAAM,UAAU,GAAe,MAAM,IAAI,CAAC,aAAa,CAAA;YACvD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;YACnD,KAAK,CAAC,6CAA6C,WAAW,cAAc,UAAU,eAAe,QAAQ,KAAK,CAAC,CAAA;YACnH,MAAM,MAAM,GAAG,iBAAiB,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAA;YAClE,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,+CAAsB,CAAC,CAAC,OAAO,CAAC;gBAC9E,KAAK,EAAE;oBACL,UAAU,EAAE,KAAK,CAAC,UAAU;iBAC7B;aACF,CAAC,CAAA;YACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE;gBAC1D,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,wEAAwE,QAAQ,CAAC,WAAW,iBAC1F,QAAQ,CAAC,YAC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cAAc,CAAC,CAAA;gBAC5F,OAAO,MAAA,MAAM,CAAC,QAAQ,mCAAI,CAAC,CAAA;aAC5B;YAAC,OAAO,KAAK,EAAE;gBACd,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAA;gBAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,WAAW,EAAE,CAAC,CAAC,CAAA;aAC1G;;KACF;;AArHH,8CAiIC;AAVkB,iCAAe,GAAG,CAAC,sBAA8C,EAAyB,EAAE;IAC3G,mDAAmD;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,CAAA;AAC3D,CAAC,CAAA;AAEM,4CAA0B,GAAG,CAAC,gBAAsE,EAA0B,EAAE;IACrI,MAAM,MAAM,GAAG,IAAI,+CAAsB,EAAE,CAAA;IAC3C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IACvC,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+ export declare class CreateMachineStateStore1708098041262 implements MigrationInterface {
3
+ name: string;
4
+ up(queryRunner: QueryRunner): Promise<void>;
5
+ down(queryRunner: QueryRunner): Promise<void>;
6
+ }
7
+ //# sourceMappingURL=7-CreateMachineStateStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"7-CreateMachineStateStore.d.ts","sourceRoot":"","sources":["../../../src/migrations/generic/7-CreateMachineStateStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAOvE,qBAAa,oCAAqC,YAAW,kBAAkB;IAC7E,IAAI,SAAyC;IAEhC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA2B3D"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CreateMachineStateStore1708098041262 = void 0;
16
+ const debug_1 = __importDefault(require("debug"));
17
+ const _1708797018115_CreateMachineStateStore_1 = require("../postgres/1708797018115-CreateMachineStateStore");
18
+ const _1708796002272_CreateMachineStateStore_1 = require("../sqlite/1708796002272-CreateMachineStateStore");
19
+ const debug = (0, debug_1.default)('sphereon:ssi-sdk:migrations');
20
+ class CreateMachineStateStore1708098041262 {
21
+ constructor() {
22
+ this.name = 'CreateMachineStateStore1708098041262';
23
+ }
24
+ up(queryRunner) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ debug('migration: creating machine state tables');
27
+ const dbType = queryRunner.connection.driver.options.type;
28
+ switch (dbType) {
29
+ case 'postgres': {
30
+ debug('using postgres migration file');
31
+ const mig = new _1708797018115_CreateMachineStateStore_1.CreateMachineStateStore1708797018115();
32
+ yield mig.up(queryRunner);
33
+ debug('Migration statements executed');
34
+ return;
35
+ }
36
+ case 'sqlite':
37
+ case 'expo':
38
+ case 'react-native': {
39
+ debug('using sqlite/react-native migration file');
40
+ const mig = new _1708796002272_CreateMachineStateStore_1.CreateMachineStateStore1708796002272();
41
+ yield mig.up(queryRunner);
42
+ debug('Migration statements executed');
43
+ return;
44
+ }
45
+ default:
46
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
47
+ }
48
+ });
49
+ }
50
+ down(queryRunner) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ debug('migration: reverting machine state tables');
53
+ const dbType = queryRunner.connection.driver.options.type;
54
+ switch (dbType) {
55
+ case 'postgres': {
56
+ debug('using postgres migration file');
57
+ const mig = new _1708797018115_CreateMachineStateStore_1.CreateMachineStateStore1708797018115();
58
+ yield mig.down(queryRunner);
59
+ debug('Migration statements executed');
60
+ return;
61
+ }
62
+ case 'sqlite':
63
+ case 'expo':
64
+ case 'react-native': {
65
+ debug('using sqlite/react-native migration file');
66
+ const mig = new _1708796002272_CreateMachineStateStore_1.CreateMachineStateStore1708796002272();
67
+ yield mig.down(queryRunner);
68
+ debug('Migration statements executed');
69
+ return;
70
+ }
71
+ default:
72
+ return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo and postgres. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
73
+ }
74
+ });
75
+ }
76
+ }
77
+ exports.CreateMachineStateStore1708098041262 = CreateMachineStateStore1708098041262;
78
+ //# sourceMappingURL=7-CreateMachineStateStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"7-CreateMachineStateStore.js","sourceRoot":"","sources":["../../../src/migrations/generic/7-CreateMachineStateStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAAyB;AACzB,8GAAwG;AACxG,4GAAsG;AAEtG,MAAM,KAAK,GAAmB,IAAA,eAAK,EAAC,6BAA6B,CAAC,CAAA;AAElE,MAAa,oCAAoC;IAAjD;QACE,SAAI,GAAG,sCAAsC,CAAA;IAyD/C,CAAC;IAvDc,EAAE,CAAC,WAAwB;;YACtC,KAAK,CAAC,0CAA0C,CAAC,C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