@nmshd/runtime 2.5.5 → 2.6.0
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/buildInformation.js +5 -5
- package/dist/types/transport/DeviceDTO.d.ts +1 -0
- package/dist/useCases/transport/account/GetDeviceInfo.js +1 -1
- package/dist/useCases/transport/account/GetDeviceInfo.js.map +1 -1
- package/dist/useCases/transport/devices/CreateDevice.js +1 -1
- package/dist/useCases/transport/devices/CreateDevice.js.map +1 -1
- package/dist/useCases/transport/devices/DeviceMapper.d.ts +1 -1
- package/dist/useCases/transport/devices/DeviceMapper.js +3 -2
- package/dist/useCases/transport/devices/DeviceMapper.js.map +1 -1
- package/dist/useCases/transport/devices/GetDevice.d.ts +3 -2
- package/dist/useCases/transport/devices/GetDevice.js +7 -2
- package/dist/useCases/transport/devices/GetDevice.js.map +1 -1
- package/dist/useCases/transport/devices/GetDevices.d.ts +3 -2
- package/dist/useCases/transport/devices/GetDevices.js +7 -3
- package/dist/useCases/transport/devices/GetDevices.js.map +1 -1
- package/dist/useCases/transport/devices/UpdateDevice.d.ts +3 -2
- package/dist/useCases/transport/devices/UpdateDevice.js +8 -3
- package/dist/useCases/transport/devices/UpdateDevice.js.map +1 -1
- package/lib-web/nmshd.runtime.js +195 -99
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +2 -2
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +6 -6
package/dist/buildInformation.js
CHANGED
|
@@ -7,11 +7,11 @@ const content_1 = require("@nmshd/content");
|
|
|
7
7
|
const crypto_1 = require("@nmshd/crypto");
|
|
8
8
|
const transport_1 = require("@nmshd/transport");
|
|
9
9
|
exports.buildInformation = {
|
|
10
|
-
version: "2.
|
|
11
|
-
build: "
|
|
12
|
-
date: "2023-08-
|
|
13
|
-
commit: "
|
|
14
|
-
dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.9","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.2.2","@nmshd/content":"2.3.6","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.0.5","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.
|
|
10
|
+
version: "2.6.0",
|
|
11
|
+
build: "161",
|
|
12
|
+
date: "2023-08-14T11:46:35+00:00",
|
|
13
|
+
commit: "3bc0a7d1b8c05d5706f9b4cac0b63d689287a732",
|
|
14
|
+
dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.9","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.2.2","@nmshd/content":"2.3.6","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.0.5","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.4.0","qrcode":"1.5.3","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
15
15
|
libraries: {
|
|
16
16
|
serval: ts_serval_1.buildInformation,
|
|
17
17
|
consumption: consumption_1.buildInformation,
|
|
@@ -25,7 +25,7 @@ let GetDeviceInfoUseCase = exports.GetDeviceInfoUseCase = class GetDeviceInfoUse
|
|
|
25
25
|
}
|
|
26
26
|
executeInternal() {
|
|
27
27
|
const device = this.deviceController.device;
|
|
28
|
-
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device));
|
|
28
|
+
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device, true));
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
exports.GetDeviceInfoUseCase = GetDeviceInfoUseCase = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDeviceInfo.js","sourceRoot":"","sources":["../../../../src/useCases/transport/account/GetDeviceInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAoD;AACpD,mDAAwC;AAExC,yCAAuC;AACvC,0DAAuD;AAEvD,IAAa,oBAAoB,kCAAjC,MAAa,oBAAqB,SAAQ,gBAAwB;IAC9D,YAA4C,gBAAkC;QAC1E,KAAK,EAAE,CAAC;QADgC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAE9E,CAAC;IAES,eAAe;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAC5C,OAAO,iBAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"GetDeviceInfo.js","sourceRoot":"","sources":["../../../../src/useCases/transport/account/GetDeviceInfo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAoD;AACpD,mDAAwC;AAExC,yCAAuC;AACvC,0DAAuD;AAEvD,IAAa,oBAAoB,kCAAjC,MAAa,oBAAqB,SAAQ,gBAAwB;IAC9D,YAA4C,gBAAkC;QAC1E,KAAK,EAAE,CAAC;QADgC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAE9E,CAAC;IAES,eAAe;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAC5C,OAAO,iBAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ,CAAA;+BATY,oBAAoB;IACT,WAAA,uBAAM,CAAA;qCAAoC,4BAAgB;GADrE,oBAAoB,CAShC"}
|
|
@@ -36,7 +36,7 @@ let CreateDeviceUseCase = exports.CreateDeviceUseCase = class CreateDeviceUseCas
|
|
|
36
36
|
async executeInternal(request) {
|
|
37
37
|
const device = await this.devicesController.sendDevice(request);
|
|
38
38
|
await this.accountController.syncDatawallet();
|
|
39
|
-
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device));
|
|
39
|
+
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device, false));
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
exports.CreateDeviceUseCase = CreateDeviceUseCase = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/CreateDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAwE;AACxE,mDAAwC;AAExC,yCAA0E;AAC1E,iDAA8C;AAQ9C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAoC;IACxD,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,mBAAmB,iCAAhC,MAAa,mBAAoB,SAAQ,gBAAuC;IAC5E,YAC6B,iBAAoC,EACpC,iBAAoC,EACrD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAJQ,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAIjE,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAA4B;QACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAE9C,OAAO,iBAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/CreateDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAwE;AACxE,mDAAwC;AAExC,yCAA0E;AAC1E,iDAA8C;AAQ9C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAoC;IACxD,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,mBAAmB,iCAAhC,MAAa,mBAAoB,SAAQ,gBAAuC;IAC5E,YAC6B,iBAAoC,EACpC,iBAAoC,EACrD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAJQ,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAIjE,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAA4B;QACxD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,CAAC;QAE9C,OAAO,iBAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAC9D,CAAC;CACJ,CAAA;8BAfY,mBAAmB;IAEvB,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAFqC,6BAAiB;QACjB,6BAAiB;QAC1C,SAAS;GAJvB,mBAAmB,CAe/B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Device, DeviceSharedSecret } from "@nmshd/transport";
|
|
2
2
|
import { DeviceDTO, DeviceOnboardingInfoDTO } from "../../../types";
|
|
3
3
|
export declare class DeviceMapper {
|
|
4
|
-
static toDeviceDTO(device: Device): DeviceDTO;
|
|
4
|
+
static toDeviceDTO(device: Device, isCurrentDevice: boolean): DeviceDTO;
|
|
5
5
|
static toDeviceOnboardingInfoDTO(deviceSharedSecret: DeviceSharedSecret): DeviceOnboardingInfoDTO;
|
|
6
6
|
static toDeviceSharedSecret(deviceOnboardingDTO: DeviceOnboardingInfoDTO): DeviceSharedSecret;
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ exports.DeviceMapper = void 0;
|
|
|
4
4
|
const crypto_1 = require("@nmshd/crypto");
|
|
5
5
|
const transport_1 = require("@nmshd/transport");
|
|
6
6
|
class DeviceMapper {
|
|
7
|
-
static toDeviceDTO(device) {
|
|
7
|
+
static toDeviceDTO(device, isCurrentDevice) {
|
|
8
8
|
return {
|
|
9
9
|
id: device.id.toString(),
|
|
10
10
|
createdAt: device.createdAt.toString(),
|
|
@@ -16,7 +16,8 @@ class DeviceMapper {
|
|
|
16
16
|
description: device.description,
|
|
17
17
|
lastLoginAt: device.lastLoginAt?.toString(),
|
|
18
18
|
operatingSystem: device.operatingSystem,
|
|
19
|
-
publicKey: device.publicKey?.toBase64(false)
|
|
19
|
+
publicKey: device.publicKey?.toBase64(false),
|
|
20
|
+
isCurrentDevice: isCurrentDevice
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
static toDeviceOnboardingInfoDTO(deviceSharedSecret) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceMapper.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/DeviceMapper.ts"],"names":[],"mappings":";;;AAAA,0CAAqG;AACrG,gDAAoG;AAGpG,MAAa,YAAY;IACd,MAAM,CAAC,WAAW,CAAC,MAAc;
|
|
1
|
+
{"version":3,"file":"DeviceMapper.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/DeviceMapper.ts"],"names":[],"mappings":";;;AAAA,0CAAqG;AAC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O,CAAC;gBAC/D,SAAS,EAAE,iCAAwB,CAAC,UAAU,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC;gBACtF,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAc;aACrD;YACD,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;YACtC,QAAQ,EAAE,mBAAmB,CAAC,QAAQ;SACzC,CAAC,CAAC;QACH,OAAO,YAAY,CAAC;IACxB,CAAC;CACJ;AA5DD,oCA4DC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from "@js-soft/ts-utils";
|
|
2
|
-
import { DevicesController } from "@nmshd/transport";
|
|
2
|
+
import { DeviceController, DevicesController } from "@nmshd/transport";
|
|
3
3
|
import { DeviceDTO } from "../../../types";
|
|
4
4
|
import { DeviceIdString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
|
|
5
5
|
export interface GetDeviceRequest {
|
|
@@ -10,7 +10,8 @@ declare class Validator extends SchemaValidator<GetDeviceRequest> {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class GetDeviceUseCase extends UseCase<GetDeviceRequest, DeviceDTO> {
|
|
12
12
|
private readonly devicesController;
|
|
13
|
-
|
|
13
|
+
private readonly deviceController;
|
|
14
|
+
constructor(devicesController: DevicesController, deviceController: DeviceController, validator: Validator);
|
|
14
15
|
protected executeInternal(request: GetDeviceRequest): Promise<Result<DeviceDTO>>;
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
@@ -28,22 +28,27 @@ Validator = __decorate([
|
|
|
28
28
|
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
29
29
|
], Validator);
|
|
30
30
|
let GetDeviceUseCase = exports.GetDeviceUseCase = class GetDeviceUseCase extends common_1.UseCase {
|
|
31
|
-
constructor(devicesController, validator) {
|
|
31
|
+
constructor(devicesController, deviceController, validator) {
|
|
32
32
|
super(validator);
|
|
33
33
|
this.devicesController = devicesController;
|
|
34
|
+
this.deviceController = deviceController;
|
|
34
35
|
}
|
|
35
36
|
async executeInternal(request) {
|
|
36
37
|
const device = await this.devicesController.get(transport_1.CoreId.from(request.id));
|
|
37
38
|
if (!device) {
|
|
38
39
|
return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.Device));
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
const currentDevice = this.deviceController.device;
|
|
42
|
+
const isCurrentDevice = device.id.equals(currentDevice.id);
|
|
43
|
+
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device, isCurrentDevice));
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
46
|
exports.GetDeviceUseCase = GetDeviceUseCase = __decorate([
|
|
44
47
|
__param(0, typescript_ioc_1.Inject),
|
|
45
48
|
__param(1, typescript_ioc_1.Inject),
|
|
49
|
+
__param(2, typescript_ioc_1.Inject),
|
|
46
50
|
__metadata("design:paramtypes", [transport_1.DevicesController,
|
|
51
|
+
transport_1.DeviceController,
|
|
47
52
|
Validator])
|
|
48
53
|
], GetDeviceUseCase);
|
|
49
54
|
//# sourceMappingURL=GetDevice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/GetDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"GetDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/GetDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAuF;AACvF,mDAAwC;AAExC,yCAAyG;AACzG,iDAA8C;AAM9C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAiC;IACrD,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,gBAAgB,8BAA7B,MAAa,gBAAiB,SAAQ,gBAAoC;IACtE,YAC6B,iBAAoC,EACpC,gBAAkC,EACnD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QAJQ,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAI/D,CAAC;IAES,KAAK,CAAC,eAAe,CAAC,OAAyB;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,kBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QAEzE,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,iBAAM,CAAC,IAAI,CAAC,sBAAa,CAAC,OAAO,CAAC,cAAc,CAAC,kBAAM,CAAC,CAAC,CAAC;SACpE;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QACnD,MAAM,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAE3D,OAAO,iBAAM,CAAC,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ,CAAA;2BArBY,gBAAgB;IAEpB,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCAFqC,6BAAiB;QAClB,4BAAgB;QACxC,SAAS;GAJvB,gBAAgB,CAqB5B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Result } from "@js-soft/ts-utils";
|
|
2
|
-
import { DevicesController } from "@nmshd/transport";
|
|
2
|
+
import { DeviceController, DevicesController } from "@nmshd/transport";
|
|
3
3
|
import { DeviceDTO } from "../../../types";
|
|
4
4
|
import { UseCase } from "../../common";
|
|
5
5
|
export declare class GetDevicesUseCase extends UseCase<void, DeviceDTO[]> {
|
|
6
6
|
private readonly devicesController;
|
|
7
|
-
|
|
7
|
+
private readonly deviceController;
|
|
8
|
+
constructor(devicesController: DevicesController, deviceController: DeviceController);
|
|
8
9
|
protected executeInternal(): Promise<Result<DeviceDTO[]>>;
|
|
9
10
|
}
|
|
@@ -19,18 +19,22 @@ const typescript_ioc_1 = require("typescript-ioc");
|
|
|
19
19
|
const common_1 = require("../../common");
|
|
20
20
|
const DeviceMapper_1 = require("./DeviceMapper");
|
|
21
21
|
let GetDevicesUseCase = exports.GetDevicesUseCase = class GetDevicesUseCase extends common_1.UseCase {
|
|
22
|
-
constructor(devicesController) {
|
|
22
|
+
constructor(devicesController, deviceController) {
|
|
23
23
|
super();
|
|
24
24
|
this.devicesController = devicesController;
|
|
25
|
+
this.deviceController = deviceController;
|
|
25
26
|
}
|
|
26
27
|
async executeInternal() {
|
|
27
28
|
const devices = await this.devicesController.list();
|
|
28
|
-
const
|
|
29
|
+
const currentDevice = this.deviceController.device;
|
|
30
|
+
const deviceDTOs = devices.map((device) => DeviceMapper_1.DeviceMapper.toDeviceDTO(device, device.id.equals(currentDevice.id)));
|
|
29
31
|
return ts_utils_1.Result.ok(deviceDTOs);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
exports.GetDevicesUseCase = GetDevicesUseCase = __decorate([
|
|
33
35
|
__param(0, typescript_ioc_1.Inject),
|
|
34
|
-
|
|
36
|
+
__param(1, typescript_ioc_1.Inject),
|
|
37
|
+
__metadata("design:paramtypes", [transport_1.DevicesController,
|
|
38
|
+
transport_1.DeviceController])
|
|
35
39
|
], GetDevicesUseCase);
|
|
36
40
|
//# sourceMappingURL=GetDevices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDevices.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/GetDevices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"GetDevices.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/GetDevices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAAuE;AACvE,mDAAwC;AAExC,yCAAuC;AACvC,iDAA8C;AAE9C,IAAa,iBAAiB,+BAA9B,MAAa,iBAAkB,SAAQ,gBAA0B;IAC7D,YAC6B,iBAAoC,EACpC,gBAAkC;QAE3D,KAAK,EAAE,CAAC;QAHiB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAG/D,CAAC;IAES,KAAK,CAAC,eAAe;QAC3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;QAEnD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,2BAAY,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO,iBAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;CACJ,CAAA;4BAhBY,iBAAiB;IAErB,WAAA,uBAAM,CAAA;IACN,WAAA,uBAAM,CAAA;qCADqC,6BAAiB;QAClB,4BAAgB;GAHtD,iBAAiB,CAgB7B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Result } from "@js-soft/ts-utils";
|
|
2
|
-
import { AccountController, DevicesController } from "@nmshd/transport";
|
|
2
|
+
import { AccountController, DeviceController, DevicesController } from "@nmshd/transport";
|
|
3
3
|
import { DeviceDTO } from "../../../types";
|
|
4
4
|
import { DeviceIdString, SchemaRepository, SchemaValidator, UseCase } from "../../common";
|
|
5
5
|
export interface UpdateDeviceRequest {
|
|
@@ -13,7 +13,8 @@ declare class Validator extends SchemaValidator<UpdateDeviceRequest> {
|
|
|
13
13
|
export declare class UpdateDeviceUseCase extends UseCase<UpdateDeviceRequest, DeviceDTO> {
|
|
14
14
|
private readonly devicesController;
|
|
15
15
|
private readonly accountController;
|
|
16
|
-
|
|
16
|
+
private readonly deviceController;
|
|
17
|
+
constructor(devicesController: DevicesController, accountController: AccountController, deviceController: DeviceController, validator: Validator);
|
|
17
18
|
protected executeInternal(request: UpdateDeviceRequest): Promise<Result<DeviceDTO>>;
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
@@ -28,31 +28,36 @@ Validator = __decorate([
|
|
|
28
28
|
__metadata("design:paramtypes", [common_1.SchemaRepository])
|
|
29
29
|
], Validator);
|
|
30
30
|
let UpdateDeviceUseCase = exports.UpdateDeviceUseCase = class UpdateDeviceUseCase extends common_1.UseCase {
|
|
31
|
-
constructor(devicesController, accountController, validator) {
|
|
31
|
+
constructor(devicesController, accountController, deviceController, validator) {
|
|
32
32
|
super(validator);
|
|
33
33
|
this.devicesController = devicesController;
|
|
34
34
|
this.accountController = accountController;
|
|
35
|
+
this.deviceController = deviceController;
|
|
35
36
|
}
|
|
36
37
|
async executeInternal(request) {
|
|
37
38
|
const device = await this.devicesController.get(transport_1.CoreId.from(request.id));
|
|
38
39
|
if (!device) {
|
|
39
40
|
return ts_utils_1.Result.fail(common_1.RuntimeErrors.general.recordNotFound(transport_1.Device));
|
|
40
41
|
}
|
|
41
|
-
if (request.name) {
|
|
42
|
+
if (typeof request.name !== "undefined") {
|
|
42
43
|
device.name = request.name;
|
|
43
44
|
}
|
|
44
45
|
device.description = request.description;
|
|
45
46
|
await this.devicesController.update(device);
|
|
46
47
|
await this.accountController.syncDatawallet();
|
|
47
|
-
|
|
48
|
+
const currentDevice = this.deviceController.device;
|
|
49
|
+
const isCurrentDevice = device.id.equals(currentDevice.id);
|
|
50
|
+
return ts_utils_1.Result.ok(DeviceMapper_1.DeviceMapper.toDeviceDTO(device, isCurrentDevice));
|
|
48
51
|
}
|
|
49
52
|
};
|
|
50
53
|
exports.UpdateDeviceUseCase = UpdateDeviceUseCase = __decorate([
|
|
51
54
|
__param(0, typescript_ioc_1.Inject),
|
|
52
55
|
__param(1, typescript_ioc_1.Inject),
|
|
53
56
|
__param(2, typescript_ioc_1.Inject),
|
|
57
|
+
__param(3, typescript_ioc_1.Inject),
|
|
54
58
|
__metadata("design:paramtypes", [transport_1.DevicesController,
|
|
55
59
|
transport_1.AccountController,
|
|
60
|
+
transport_1.DeviceController,
|
|
56
61
|
Validator])
|
|
57
62
|
], UpdateDeviceUseCase);
|
|
58
63
|
//# sourceMappingURL=UpdateDevice.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/UpdateDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"UpdateDevice.js","sourceRoot":"","sources":["../../../../src/useCases/transport/devices/UpdateDevice.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAA2C;AAC3C,gDAA0G;AAC1G,mDAAwC;AAExC,yCAAyG;AACzG,iDAA8C;AAQ9C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,wBAAoC;IACxD,YAA2B,gBAAkC;QACzD,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ,CAAA;AAJK,SAAS;IACS,WAAA,uBAAM,CAAA;qCAAmB,yBAAgB;GAD3D,SAAS,CAId;AAED,IAAa,mBAAmB,iCAAhC,MAAa,mBAAoB,SAAQ,gBAAuC;IAC5E,YAC6B,iBAAoC,EACpC,iBAAoC,EACpC,gBAAkC,EACnD,SAAoB;QAE5B,KAAK,CAAC,SAAS,CAAC,CAAC;QALQ,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,sBAAiB,GAAjB,iBAAiB,C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