@sphereon/ssi-sdk.data-store 0.19.0 → 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/digitalCredential/AbstractDigitalCredentialStore.d.ts +10 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js +7 -0
- package/dist/digitalCredential/AbstractDigitalCredentialStore.js.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts +15 -0
- package/dist/digitalCredential/DigitalCredentialStore.d.ts.map +1 -0
- package/dist/digitalCredential/DigitalCredentialStore.js +118 -0
- package/dist/digitalCredential/DigitalCredentialStore.js.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts +23 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.d.ts.map +1 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js +93 -0
- package/dist/entities/digitalCredential/DigitalCredentialEntity.js.map +1 -0
- 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 +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.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/6-CreateDigitalCredential.d.ts +7 -0
- package/dist/migrations/generic/6-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/generic/6-CreateDigitalCredential.js +78 -0
- package/dist/migrations/generic/6-CreateDigitalCredential.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 +4 -0
- package/dist/migrations/generic/index.d.ts.map +1 -1
- package/dist/migrations/generic/index.js +7 -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 +3 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.d.ts +7 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js +59 -0
- package/dist/migrations/postgres/1708525189001-CreateDigitalCredential.js.map +1 -0
- 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/1708525189002-CreateDigitalCredential.d.ts +7 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.d.ts.map +1 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.js +50 -0
- package/dist/migrations/sqlite/1708525189002-CreateDigitalCredential.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/digitalCredential/IAbstractDigitalCredentialStore.d.ts +42 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.d.ts.map +1 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js +3 -0
- package/dist/types/digitalCredential/IAbstractDigitalCredentialStore.js.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts +42 -0
- package/dist/types/digitalCredential/digitalCredential.d.ts.map +1 -0
- package/dist/types/digitalCredential/digitalCredential.js +28 -0
- package/dist/types/digitalCredential/digitalCredential.js.map +1 -0
- 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/dist/utils/SortingUtils.d.ts +3 -0
- package/dist/utils/SortingUtils.d.ts.map +1 -0
- package/dist/utils/SortingUtils.js +18 -0
- package/dist/utils/SortingUtils.js.map +1 -0
- package/dist/utils/digitalCredential/MappingUtils.d.ts +7 -0
- package/dist/utils/digitalCredential/MappingUtils.d.ts.map +1 -0
- package/dist/utils/digitalCredential/MappingUtils.js +99 -0
- package/dist/utils/digitalCredential/MappingUtils.js.map +1 -0
- package/package.json +5 -4
- package/src/__tests__/digitalCredential.entities.test.ts +254 -0
- package/src/__tests__/digitalCredential.store.test.ts +294 -0
- package/src/__tests__/machineState.entities.test.ts +51 -0
- package/src/__tests__/machineState.store.test.ts +174 -0
- package/src/digitalCredential/AbstractDigitalCredentialStore.ts +17 -0
- package/src/digitalCredential/DigitalCredentialStore.ts +127 -0
- package/src/entities/digitalCredential/DigitalCredentialEntity.ts +64 -0
- package/src/entities/machineState/MachineStateInfoEntity.ts +58 -0
- package/src/index.ts +18 -0
- package/src/machineState/IAbstractMachineStateStore.ts +65 -0
- package/src/machineState/MachineStateStore.ts +149 -0
- package/src/migrations/generic/6-CreateDigitalCredential.ts +66 -0
- package/src/migrations/generic/7-CreateMachineStateStore.ts +66 -0
- package/src/migrations/generic/index.ts +6 -0
- package/src/migrations/index.ts +2 -0
- package/src/migrations/postgres/1708525189001-CreateDigitalCredential.ts +44 -0
- package/src/migrations/postgres/1708797018115-CreateMachineStateStore.ts +29 -0
- package/src/migrations/sqlite/1708525189002-CreateDigitalCredential.ts +34 -0
- package/src/migrations/sqlite/1708796002272-CreateMachineStateStore.ts +28 -0
- package/src/types/digitalCredential/IAbstractDigitalCredentialStore.ts +37 -0
- package/src/types/digitalCredential/digitalCredential.ts +46 -0
- package/src/types/index.ts +1 -0
- package/src/types/machineState/IAbstractMachineStateStore.ts +68 -0
- package/src/utils/SortingUtils.ts +16 -0
- package/src/utils/digitalCredential/MappingUtils.ts +122 -0
|
@@ -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;IAuBxF,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,139 @@
|
|
|
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
|
+
const 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
|
+
console.log(error);
|
|
43
|
+
return Promise.reject(new Error(error));
|
|
44
|
+
}
|
|
45
|
+
// 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
|
|
46
|
+
const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).save(entity, { transaction: false });
|
|
47
|
+
debug(`Done persistMachineState machine ${machineName}, instance ${instanceId}, tenantId: ${tenantId}`);
|
|
48
|
+
return MachineStateStore.machineInfoFrom(result);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
findActiveMachineStates(args) {
|
|
52
|
+
var _a;
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const { tenantId, machineName, instanceId } = args;
|
|
55
|
+
const connection = yield this._dbConnection;
|
|
56
|
+
debug(`Executing findActiveMachineStates query with machineName: ${machineName}, tenantId: ${tenantId}`);
|
|
57
|
+
const queryBuilder = connection
|
|
58
|
+
.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity)
|
|
59
|
+
.createQueryBuilder('state')
|
|
60
|
+
.where('state.completedAt IS NULL')
|
|
61
|
+
.andWhere(new typeorm_1.Brackets((qb) => {
|
|
62
|
+
qb.where('state.expiresAt IS NULL').orWhere('state.expiresAt > :now', { now: new Date() });
|
|
63
|
+
}));
|
|
64
|
+
if (instanceId) {
|
|
65
|
+
queryBuilder.andWhere('state.instanceId = :instanceId', { instanceId });
|
|
66
|
+
}
|
|
67
|
+
if (tenantId) {
|
|
68
|
+
queryBuilder.andWhere('state.tenantId = :tenantId', { tenantId });
|
|
69
|
+
}
|
|
70
|
+
if (machineName) {
|
|
71
|
+
queryBuilder.andWhere('state.machineName = :machineName', { machineName });
|
|
72
|
+
}
|
|
73
|
+
return ((_a = (yield queryBuilder
|
|
74
|
+
.orderBy('state.updatedAt', 'DESC')
|
|
75
|
+
.getMany()
|
|
76
|
+
.then((entities) => entities.map(MachineStateStore.machineInfoFrom)))) !== null && _a !== void 0 ? _a : []);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
findMachineStates(args) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const connection = yield this._dbConnection;
|
|
82
|
+
debug('findMachineStates', args);
|
|
83
|
+
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 }));
|
|
84
|
+
return result.map((event) => MachineStateStore.machineInfoFrom(event));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
getMachineState(args) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const connection = yield this._dbConnection;
|
|
90
|
+
debug('getMachineState', args);
|
|
91
|
+
return connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).findOneOrFail({ where: { instanceId: args.instanceId } });
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
deleteMachineState(args) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
debug(`Executing deleteMachineState query with id: ${args.instanceId}`);
|
|
97
|
+
if (!args.instanceId) {
|
|
98
|
+
throw new Error('No instanceId parameter is provided.');
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const connection = yield this._dbConnection;
|
|
102
|
+
const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).delete(args.instanceId);
|
|
103
|
+
return result.affected != null && result.affected > 0;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
debug(`Error deleting state: ${error}`);
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
deleteExpiredMachineStates(args) {
|
|
112
|
+
var _a;
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
const { machineName, tenantId, deleteDoneStates } = args;
|
|
115
|
+
debug(`Executing deleteExpiredMachineStates query with params: ${JSON.stringify(args)}`);
|
|
116
|
+
try {
|
|
117
|
+
const connection = yield this._dbConnection;
|
|
118
|
+
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)()) }));
|
|
119
|
+
const result = yield connection.getRepository(MachineStateInfoEntity_1.MachineStateInfoEntity).delete(deleteCriteria);
|
|
120
|
+
return (_a = result.affected) !== null && _a !== void 0 ? _a : 0;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
debug(`Error deleting machine info: ${error}`);
|
|
124
|
+
return Promise.reject(new Error(`Error deleting expired machine states for machine type ${machineName}`));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.MachineStateStore = MachineStateStore;
|
|
130
|
+
MachineStateStore.machineInfoFrom = (machineStateInfoEntity) => {
|
|
131
|
+
// We are making sure no entity function get copied
|
|
132
|
+
return JSON.parse(JSON.stringify(machineStateInfoEntity));
|
|
133
|
+
};
|
|
134
|
+
MachineStateStore.machineStateInfoEntityFrom = (machineStateInfo) => {
|
|
135
|
+
const entity = new MachineStateInfoEntity_1.MachineStateInfoEntity();
|
|
136
|
+
Object.assign(entity, machineStateInfo);
|
|
137
|
+
return entity;
|
|
138
|
+
};
|
|
139
|
+
//# 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,C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
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=6-CreateDigitalCredential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"6-CreateDigitalCredential.d.ts","sourceRoot":"","sources":["../../../src/migrations/generic/6-CreateDigitalCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAOvE,qBAAa,oCAAqC,YAAW,kBAAkB;IAC7E,IAAI,EAAE,MAAM,CAAyC;IAExC,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.CreateDigitalCredential1708525189000 = void 0;
|
|
16
|
+
const debug_1 = __importDefault(require("debug"));
|
|
17
|
+
const _1708525189001_CreateDigitalCredential_1 = require("../postgres/1708525189001-CreateDigitalCredential");
|
|
18
|
+
const _1708525189002_CreateDigitalCredential_1 = require("../sqlite/1708525189002-CreateDigitalCredential");
|
|
19
|
+
const debug = (0, debug_1.default)('sphereon:ssi-sdk:migrations');
|
|
20
|
+
class CreateDigitalCredential1708525189000 {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.name = 'CreateDigitalCredential1708525189000';
|
|
23
|
+
}
|
|
24
|
+
up(queryRunner) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
debug('migration: creating DigitalCredential tables');
|
|
27
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
28
|
+
switch (dbType) {
|
|
29
|
+
case 'postgres': {
|
|
30
|
+
debug('using postgres migration file for DigitalCredential');
|
|
31
|
+
const mig = new _1708525189001_CreateDigitalCredential_1.CreateDigitalCredential1708525189001();
|
|
32
|
+
yield mig.up(queryRunner);
|
|
33
|
+
debug('Postgres Migration statements for DigitalCredential executed');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
case 'sqlite':
|
|
37
|
+
case 'expo':
|
|
38
|
+
case 'react-native': {
|
|
39
|
+
debug('using sqlite/react-native migration file for DigitalCredential');
|
|
40
|
+
const mig = new _1708525189002_CreateDigitalCredential_1.CreateDigitalCredential1708525189002();
|
|
41
|
+
yield mig.up(queryRunner);
|
|
42
|
+
debug('SQLite Migration statements for DigitalCredential executed');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
default:
|
|
46
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for UniformCredential. 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 DigitalCredential tables');
|
|
53
|
+
const dbType = queryRunner.connection.driver.options.type;
|
|
54
|
+
switch (dbType) {
|
|
55
|
+
case 'postgres': {
|
|
56
|
+
debug('using postgres migration file for DigitalCredential');
|
|
57
|
+
const mig = new _1708525189001_CreateDigitalCredential_1.CreateDigitalCredential1708525189001();
|
|
58
|
+
yield mig.down(queryRunner);
|
|
59
|
+
debug('Postgres Migration statements for DigitalCredential reverted');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
case 'sqlite':
|
|
63
|
+
case 'expo':
|
|
64
|
+
case 'react-native': {
|
|
65
|
+
debug('using sqlite/react-native migration file for DigitalCredential');
|
|
66
|
+
const mig = new _1708525189002_CreateDigitalCredential_1.CreateDigitalCredential1708525189002();
|
|
67
|
+
yield mig.down(queryRunner);
|
|
68
|
+
debug('SQLite Migration statements for DigitalCredential reverted');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
default:
|
|
72
|
+
return Promise.reject(`Migrations are currently only supported for sqlite, react-native, expo, and postgres for DigitalCredential. Was ${dbType}. Please run your database without migrations and with 'migrationsRun: false' and 'synchronize: true' for now`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.CreateDigitalCredential1708525189000 = CreateDigitalCredential1708525189000;
|
|
78
|
+
//# sourceMappingURL=6-CreateDigitalCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"6-CreateDigitalCredential.js","sourceRoot":"","sources":["../../../src/migrations/generic/6-CreateDigitalCredential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAAuC;AACvC,8GAAwG;AACxG,4GAAsG;AAEtG,MAAM,KAAK,GAAa,IAAA,eAAK,EAAC,6BAA6B,CAAC,CAAA;AAE5D,MAAa,oCAAoC;IAAjD;QACE,SAAI,GAAW,sCAAsC,CAAA;IAyDvD,CAAC;IAvDc,EAAE,CAAC,WAAwB;;YACtC,KAAK,CAAC,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KAAK,cAAc,CAAC,CAAC;oBACnB,KAAK,CAAC,gEAAgE,CAAC,CAAA;oBACvE,MAAM,GAAG,GAAyC,IAAI,6EAAoC,EAAE,CAAA;oBAC5F,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;oBAC3B,KAAK,CAAC,4DAA4D,CAAC,CAAA;oBACnE,OAAM;iBACP;gBACD;oBACE,OAAO,OAAO,CAAC,MAAM,CACnB,mHAAmH,MAAM,+GAA+G,CACzO,CAAA;aACJ;QACH,CAAC;KAAA;CACF;AA1DD,oFA0DC"}
|
|
@@ -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,CAAA;YACjD,MAAM,MAAM,GAAiB,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAA;YAEvE,QAAQ,MAAM,EAAE;gBACd,KAAK,UAAU,CAAC,CAAC;oBACf,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,MAAM,GAAG,GAAyC,IAAI,6EAAoC,EAAE,CAAA;oBAC5F,MAAM,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;oBACzB,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,OAAM;iBACP;gBACD,KAAK,QAAQ,CAAC;gBACd,KAAK,MAAM,CAAC;gBACZ,KAAK,cAAc,CAAC,CAAC;oBACnB,KAAK,CAAC,0CAA0C,CAAC,CAAA;oBACjD,MAAM,GAAG,GAAyC,IAAI,6EAAoC,EAAE,CAAA;oBAC5F,MAAM,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;oBACzB,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,OAAM;iBACP;gBACD;oBACE,OAAO,OAAO,CAAC,MAAM,CACnB,4FAA4F,MAAM,+GAA+G,CAClN,CAAA;aACJ;QACH,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,KAAK,CAAC,2CAA2C,CAAC,CAAA;YAClD,MAAM,MAAM,GAAiB,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAA;YAEvE,QAAQ,MAAM,EAAE;gBACd,KAAK,UAAU,CAAC,CAAC;oBACf,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,MAAM,GAAG,GAAyC,IAAI,6EAAoC,EAAE,CAAA;oBAC5F,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;oBAC3B,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,OAAM;iBACP;gBACD,KAAK,QAAQ,CAAC;gBACd,KAAK,MAAM,CAAC;gBACZ,KAAK,cAAc,CAAC,CAAC;oBACnB,KAAK,CAAC,0CAA0C,CAAC,CAAA;oBACjD,MAAM,GAAG,GAAyC,IAAI,6EAAoC,EAAE,CAAA;oBAC5F,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;oBAC3B,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBACtC,OAAM;iBACP;gBACD;oBACE,OAAO,OAAO,CAAC,MAAM,CACnB,4FAA4F,MAAM,+GAA+G,CAClN,CAAA;aACJ;QACH,CAAC;KAAA;CACF;AA1DD,oFA0DC"}
|
|
@@ -2,6 +2,8 @@ import { CreateContacts1659463079429 } from './1-CreateContacts';
|
|
|
2
2
|
import { CreateIssuanceBranding1659463079429 } from './2-CreateIssuanceBranding';
|
|
3
3
|
import { CreateStatusList1693866470000 } from './4-CreateStatusList';
|
|
4
4
|
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents';
|
|
5
|
+
import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredential';
|
|
6
|
+
import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore';
|
|
5
7
|
/**
|
|
6
8
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
7
9
|
*
|
|
@@ -13,5 +15,7 @@ export declare const DataStoreContactMigrations: (typeof CreateContacts165946307
|
|
|
13
15
|
export declare const DataStoreIssuanceBrandingMigrations: (typeof CreateIssuanceBranding1659463079429)[];
|
|
14
16
|
export declare const DataStoreStatusListMigrations: (typeof CreateStatusList1693866470000)[];
|
|
15
17
|
export declare const DataStoreEventLoggerMigrations: (typeof CreateAuditEvents1701635835330)[];
|
|
18
|
+
export declare const DataStoreDigitalCredentialMigrations: (typeof CreateDigitalCredential1708525189000)[];
|
|
19
|
+
export declare const DataStoreMachineStateMigrations: (typeof CreateMachineStateStore1708098041262)[];
|
|
16
20
|
export declare const DataStoreMigrations: (typeof CreateContacts1659463079429)[];
|
|
17
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/generic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,4BAA4B,CAAA;AAEhF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/migrations/generic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,mCAAmC,EAAE,MAAM,4BAA4B,CAAA;AAEhF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,6BAA6B,CAAA;AAClF,OAAO,EAAE,oCAAoC,EAAE,MAAM,6BAA6B,CAAA;AAElF;;;;;;GAMG;AAGH,eAAO,MAAM,0BAA0B,wCAA6D,CAAA;AACpG,eAAO,MAAM,mCAAmC,gDAAwC,CAAA;AACxF,eAAO,MAAM,6BAA6B,0CAAkC,CAAA;AAC5E,eAAO,MAAM,8BAA8B,2CAAmC,CAAA;AAC9E,eAAO,MAAM,oCAAoC,iDAAyC,CAAA;AAC1F,eAAO,MAAM,+BAA+B,iDAAyC,CAAA;AAGrF,eAAO,MAAM,mBAAmB,wCAO/B,CAAA"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataStoreMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = void 0;
|
|
3
|
+
exports.DataStoreMigrations = exports.DataStoreMachineStateMigrations = exports.DataStoreDigitalCredentialMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = void 0;
|
|
4
4
|
const _1_CreateContacts_1 = require("./1-CreateContacts");
|
|
5
5
|
const _2_CreateIssuanceBranding_1 = require("./2-CreateIssuanceBranding");
|
|
6
6
|
const _3_CreateContacts_1 = require("./3-CreateContacts");
|
|
7
7
|
const _4_CreateStatusList_1 = require("./4-CreateStatusList");
|
|
8
8
|
const _5_CreateAuditEvents_1 = require("./5-CreateAuditEvents");
|
|
9
|
+
const _6_CreateDigitalCredential_1 = require("./6-CreateDigitalCredential");
|
|
10
|
+
const _7_CreateMachineStateStore_1 = require("./7-CreateMachineStateStore");
|
|
9
11
|
/**
|
|
10
12
|
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
|
|
11
13
|
*
|
|
@@ -18,11 +20,15 @@ exports.DataStoreContactMigrations = [_1_CreateContacts_1.CreateContacts16594630
|
|
|
18
20
|
exports.DataStoreIssuanceBrandingMigrations = [_2_CreateIssuanceBranding_1.CreateIssuanceBranding1659463079429];
|
|
19
21
|
exports.DataStoreStatusListMigrations = [_4_CreateStatusList_1.CreateStatusList1693866470000];
|
|
20
22
|
exports.DataStoreEventLoggerMigrations = [_5_CreateAuditEvents_1.CreateAuditEvents1701635835330];
|
|
23
|
+
exports.DataStoreDigitalCredentialMigrations = [_6_CreateDigitalCredential_1.CreateDigitalCredential1708525189000];
|
|
24
|
+
exports.DataStoreMachineStateMigrations = [_7_CreateMachineStateStore_1.CreateMachineStateStore1708098041262];
|
|
21
25
|
// All migrations together
|
|
22
26
|
exports.DataStoreMigrations = [
|
|
23
27
|
...exports.DataStoreContactMigrations,
|
|
24
28
|
...exports.DataStoreIssuanceBrandingMigrations,
|
|
25
29
|
...exports.DataStoreStatusListMigrations,
|
|
26
30
|
...exports.DataStoreEventLoggerMigrations,
|
|
31
|
+
...exports.DataStoreDigitalCredentialMigrations,
|
|
32
|
+
...exports.DataStoreMachineStateMigrations,
|
|
27
33
|
];
|
|
28
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migrations/generic/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgE;AAChE,0EAAgF;AAChF,0DAAgE;AAChE,8DAAoE;AACpE,gEAAsE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/migrations/generic/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgE;AAChE,0EAAgF;AAChF,0DAAgE;AAChE,8DAAoE;AACpE,gEAAsE;AACtE,4EAAkF;AAClF,4EAAkF;AAElF;;;;;;GAMG;AAEH,yJAAyJ;AAC5I,QAAA,0BAA0B,GAAG,CAAC,+CAA2B,EAAE,+CAA2B,CAAC,CAAA;AACvF,QAAA,mCAAmC,GAAG,CAAC,+DAAmC,CAAC,CAAA;AAC3E,QAAA,6BAA6B,GAAG,CAAC,mDAA6B,CAAC,CAAA;AAC/D,QAAA,8BAA8B,GAAG,CAAC,qDAA8B,CAAC,CAAA;AACjE,QAAA,oCAAoC,GAAG,CAAC,iEAAoC,CAAC,CAAA;AAC7E,QAAA,+BAA+B,GAAG,CAAC,iEAAoC,CAAC,CAAA;AAErF,0BAA0B;AACb,QAAA,mBAAmB,GAAG;IACjC,GAAG,kCAA0B;IAC7B,GAAG,2CAAmC;IACtC,GAAG,qCAA6B;IAChC,GAAG,sCAA8B;IACjC,GAAG,4CAAoC;IACvC,GAAG,uCAA+B;CACnC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { DataStoreMigrations, DataStoreEventLoggerMigrations, DataStoreContactMigrations, DataStoreIssuanceBrandingMigrations, DataStoreStatusListMigrations, } from './generic';
|
|
1
|
+
export { DataStoreMigrations, DataStoreEventLoggerMigrations, DataStoreContactMigrations, DataStoreIssuanceBrandingMigrations, DataStoreStatusListMigrations, DataStoreDigitalCredentialMigrations, DataStoreMachineStateMigrations, } from './generic';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,EACnC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,EAC1B,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,WAAW,CAAA"}
|
package/dist/migrations/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = void 0;
|
|
3
|
+
exports.DataStoreMachineStateMigrations = exports.DataStoreDigitalCredentialMigrations = exports.DataStoreStatusListMigrations = exports.DataStoreIssuanceBrandingMigrations = exports.DataStoreContactMigrations = exports.DataStoreEventLoggerMigrations = exports.DataStoreMigrations = void 0;
|
|
4
4
|
var generic_1 = require("./generic");
|
|
5
5
|
Object.defineProperty(exports, "DataStoreMigrations", { enumerable: true, get: function () { return generic_1.DataStoreMigrations; } });
|
|
6
6
|
Object.defineProperty(exports, "DataStoreEventLoggerMigrations", { enumerable: true, get: function () { return generic_1.DataStoreEventLoggerMigrations; } });
|
|
7
7
|
Object.defineProperty(exports, "DataStoreContactMigrations", { enumerable: true, get: function () { return generic_1.DataStoreContactMigrations; } });
|
|
8
8
|
Object.defineProperty(exports, "DataStoreIssuanceBrandingMigrations", { enumerable: true, get: function () { return generic_1.DataStoreIssuanceBrandingMigrations; } });
|
|
9
9
|
Object.defineProperty(exports, "DataStoreStatusListMigrations", { enumerable: true, get: function () { return generic_1.DataStoreStatusListMigrations; } });
|
|
10
|
+
Object.defineProperty(exports, "DataStoreDigitalCredentialMigrations", { enumerable: true, get: function () { return generic_1.DataStoreDigitalCredentialMigrations; } });
|
|
11
|
+
Object.defineProperty(exports, "DataStoreMachineStateMigrations", { enumerable: true, get: function () { return generic_1.DataStoreMachineStateMigrations; } });
|
|
10
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":";;;AAAA,qCAQkB;AAPhB,8GAAA,mBAAmB,OAAA;AACnB,yHAAA,8BAA8B,OAAA;AAC9B,qHAAA,0BAA0B,OAAA;AAC1B,8HAAA,mCAAmC,OAAA;AACnC,wHAAA,6BAA6B,OAAA;AAC7B,+HAAA,oCAAoC,OAAA;AACpC,0HAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreateDigitalCredential1708525189001 implements MigrationInterface {
|
|
3
|
+
name: string;
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=1708525189001-CreateDigitalCredential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1708525189001-CreateDigitalCredential.d.ts","sourceRoot":"","sources":["../../../src/migrations/postgres/1708525189001-CreateDigitalCredential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzD,qBAAa,oCAAqC,YAAW,kBAAkB;IAC7E,IAAI,SAAyC;IAEhC,EAAE,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B3C,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAO3D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateDigitalCredential1708525189001 = void 0;
|
|
13
|
+
class CreateDigitalCredential1708525189001 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.name = 'CreateDigitalCredential1708525189001';
|
|
16
|
+
}
|
|
17
|
+
up(queryRunner) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield queryRunner.query(`CREATE TYPE "digital_document_type" AS ENUM('VC', 'VP', 'C', 'P')`);
|
|
20
|
+
yield queryRunner.query(`CREATE TYPE "digital_credential_document_format" AS ENUM('JSON_LD', 'JWT', 'SD_JWT', 'MDOC')`);
|
|
21
|
+
yield queryRunner.query(`CREATE TYPE "digital_credential_correlation_type" AS ENUM('DID')`);
|
|
22
|
+
yield queryRunner.query(`CREATE TYPE "digital_credential_state_type" AS ENUM('REVOKED', 'VERIFIED', 'EXPIRED')`);
|
|
23
|
+
yield queryRunner.query(`
|
|
24
|
+
CREATE TABLE "DigitalCredential" (
|
|
25
|
+
"id" uuid NOT NULL DEFAULT uuid_generate_v4(),
|
|
26
|
+
"document_type" "digital_document_type" NOT NULL,
|
|
27
|
+
"document_format" "digital_credential_document_format" NOT NULL,
|
|
28
|
+
"raw_document" text NOT NULL,
|
|
29
|
+
"uniform_document" text NOT NULL,
|
|
30
|
+
"hash" text NOT NULL UNIQUE,
|
|
31
|
+
"issuer_correlation_type" "digital_credential_correlation_type" NOT NULL,
|
|
32
|
+
"subject_correlation_type" "digital_credential_correlation_type",
|
|
33
|
+
"issuer_correlation_id" text NOT NULL,
|
|
34
|
+
"subject_correlation_id" text,
|
|
35
|
+
"verified_state" "digital_credential_state_type",
|
|
36
|
+
"tenant_id" text,
|
|
37
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
38
|
+
"last_updated_at" TIMESTAMP NOT NULL DEFAULT now(),
|
|
39
|
+
"valid_from" DATE,
|
|
40
|
+
"valid_until" DATE,
|
|
41
|
+
"verified_at" DATE,
|
|
42
|
+
"revoked_at" DATE,
|
|
43
|
+
PRIMARY KEY ("id")
|
|
44
|
+
)
|
|
45
|
+
`);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
down(queryRunner) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield queryRunner.query(`DROP TABLE "DigitalCredential"`);
|
|
51
|
+
yield queryRunner.query(`DROP TYPE "digital_credential_state_type"`);
|
|
52
|
+
yield queryRunner.query(`DROP TYPE "digital_credential_correlation_type"`);
|
|
53
|
+
yield queryRunner.query(`DROP TYPE "digital_credential_document_format"`);
|
|
54
|
+
yield queryRunner.query(`DROP TYPE "digital_document_type"`);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.CreateDigitalCredential1708525189001 = CreateDigitalCredential1708525189001;
|
|
59
|
+
//# sourceMappingURL=1708525189001-CreateDigitalCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1708525189001-CreateDigitalCredential.js","sourceRoot":"","sources":["../../../src/migrations/postgres/1708525189001-CreateDigitalCredential.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,oCAAoC;IAAjD;QACE,SAAI,GAAG,sCAAsC,CAAA;IAwC/C,CAAC;IAtCc,EAAE,CAAC,WAAwB;;YACtC,MAAM,WAAW,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAA;YAC5F,MAAM,WAAW,CAAC,KAAK,CAAC,8FAA8F,CAAC,CAAA;YACvH,MAAM,WAAW,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAA;YAC3F,MAAM,WAAW,CAAC,KAAK,CAAC,uFAAuF,CAAC,CAAA;YAEhH,MAAM,WAAW,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;KAsBvB,CAAC,CAAA;QACJ,CAAC;KAAA;IAEY,IAAI,CAAC,WAAwB;;YACxC,MAAM,WAAW,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAA;YACzD,MAAM,WAAW,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;YACpE,MAAM,WAAW,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAA;YAC1E,MAAM,WAAW,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAA;YACzE,MAAM,WAAW,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAA;QAC9D,CAAC;KAAA;CACF;AAzCD,oFAyCC"}
|