kuzzle-device-manager-types 3.0.0-next.2 → 3.0.0-next.3
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/lib/modules/asset/AssetService.d.ts +1 -0
- package/dist/lib/modules/asset/types/AssetApi.d.ts +5 -1
- package/dist/lib/modules/asset/types/AssetContent.d.ts +6 -1
- package/dist/lib/modules/asset/types/AssetGroupContent.d.ts +1 -0
- package/dist/lib/modules/asset/types/AssetGroupsApi.d.ts +1 -1
- package/dist/lib/modules/asset/types/AssetHistoryContent.d.ts +1 -8
- package/dist/lib/modules/decoder/DecodedPayload.d.ts +2 -0
- package/dist/lib/modules/decoder/types/DecoderApi.d.ts +0 -1
- package/dist/lib/modules/device/DeviceService.d.ts +18 -1
- package/dist/lib/modules/device/types/DeviceApi.d.ts +0 -1
- package/dist/lib/modules/measure/MeasureExporter.d.ts +2 -0
- package/dist/lib/modules/measure/MeasureService.d.ts +11 -38
- package/dist/lib/modules/measure/MeasureSourcesBuilder.d.ts +1 -2
- package/dist/lib/modules/measure/collections/measuresMappings.d.ts +8 -0
- package/dist/lib/modules/measure/exports.d.ts +0 -1
- package/dist/lib/modules/measure/index.d.ts +0 -1
- package/dist/lib/modules/measure/types/MeasureEvents.d.ts +5 -148
- package/dist/lib/modules/measure/types/MeasureSources.d.ts +1 -0
- package/dist/lib/modules/model/types/ModelContent.d.ts +2 -1
- package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +2 -2
- package/dist/lib/modules/shared/errors/index.d.ts +1 -0
- package/dist/lib/modules/shared/exports.d.ts +1 -5
- package/dist/lib/modules/shared/index.d.ts +3 -11
- package/dist/lib/modules/shared/services/AbstractExporter.d.ts +2 -0
- package/dist/lib/modules/shared/services/DigitalTwinExporter.d.ts +2 -0
- package/dist/lib/modules/shared/types/Models.d.ts +17 -0
- package/dist/lib/modules/shared/types/exports.d.ts +6 -0
- package/dist/lib/modules/shared/types/index.d.ts +9 -0
- package/dist/lib/modules/shared/utils/index.d.ts +5 -0
- package/dist/tests/application/assets/Container.d.ts +6 -3
- package/dist/tests/application/assets/MagicHouse.d.ts +2 -2
- package/dist/tests/application/assets/Room.d.ts +2 -2
- package/dist/tests/application/assets/StreetLamp.d.ts +2 -2
- package/dist/tests/application/assets/Warehouse.d.ts +2 -2
- package/dist/tests/application/assets/index.d.ts +1 -0
- package/dist/tests/application/decoders/EmptyTempDecoder.d.ts +8 -0
- package/dist/tests/application/devices/DummyTemp.d.ts +2 -0
- package/dist/tests/application/devices/DummyTempPosition.d.ts +2 -0
- package/dist/tests/application/devices/EmptyTemp.d.ts +2 -0
- package/dist/tests/application/devices/index.d.ts +3 -0
- package/dist/tests/application/measures/{AccelerationMeasure.d.ts → Acceleration.d.ts} +2 -2
- package/dist/tests/application/measures/BatteryMeasure.d.ts +5 -0
- package/dist/tests/application/measures/Brightness.d.ts +2 -0
- package/dist/tests/application/measures/CO2.d.ts +2 -0
- package/dist/tests/application/measures/HumidityMeasure.d.ts +5 -0
- package/dist/tests/application/measures/Illuminance.d.ts +2 -0
- package/dist/tests/application/measures/Magicule.d.ts +2 -2
- package/dist/tests/application/measures/MovementMeasure.d.ts +5 -0
- package/dist/{lib/modules/measure → tests/application}/measures/PositionMeasure.d.ts +2 -2
- package/dist/tests/application/measures/PowerConsumption.d.ts +2 -0
- package/dist/tests/application/measures/TemperatureMeasure.d.ts +5 -0
- package/dist/tests/application/measures/index.d.ts +11 -0
- package/dist/tests/application/models.d.ts +2 -0
- package/package.json +1 -1
- package/dist/lib/modules/measure/measures/BatteryMeasure.d.ts +0 -5
- package/dist/lib/modules/measure/measures/HumidityMeasure.d.ts +0 -5
- package/dist/lib/modules/measure/measures/MovementMeasure.d.ts +0 -5
- package/dist/lib/modules/measure/measures/TemperatureMeasure.d.ts +0 -5
- package/dist/lib/modules/measure/measures/index.d.ts +0 -5
- package/dist/tests/application/measures/BrightnessMeasure.d.ts +0 -2
- package/dist/tests/application/measures/CO2Measure.d.ts +0 -2
- package/dist/tests/application/measures/IlluminanceMeasure.d.ts +0 -2
- package/dist/tests/application/measures/PowerConsumptionMeasure.d.ts +0 -2
|
@@ -22,6 +22,7 @@ export declare class AssetService extends DigitalTwinService {
|
|
|
22
22
|
* Update or Create an asset metadata
|
|
23
23
|
*/
|
|
24
24
|
upsert(engineId: string, model: string, reference: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
25
|
+
private _create;
|
|
25
26
|
/**
|
|
26
27
|
* Create an asset metadata
|
|
27
28
|
*/
|
|
@@ -7,6 +7,11 @@ import { ApiMeasureSource } from "../../measure/types/MeasureSources";
|
|
|
7
7
|
interface AssetsControllerRequest {
|
|
8
8
|
controller: AssetsControllerName;
|
|
9
9
|
engineId: string;
|
|
10
|
+
/**
|
|
11
|
+
* ? Request parameter used by SoftTenant module
|
|
12
|
+
* ! Not used directly in this plugin
|
|
13
|
+
*/
|
|
14
|
+
softTenantId?: string | string[] | null;
|
|
10
15
|
}
|
|
11
16
|
export interface ApiAssetGetRequest extends AssetsControllerRequest {
|
|
12
17
|
action: "get";
|
|
@@ -33,7 +38,6 @@ export interface ApiAssetMetadataReplaceRequest extends AssetsControllerRequest
|
|
|
33
38
|
export type ApiAssetMetadataReplaceResult = KDocument<AssetContent>;
|
|
34
39
|
export interface ApiAssetUpsertRequest extends AssetsControllerRequest {
|
|
35
40
|
action: "upsert";
|
|
36
|
-
_id: string;
|
|
37
41
|
refresh?: string;
|
|
38
42
|
body: {
|
|
39
43
|
model: string;
|
|
@@ -36,6 +36,11 @@ export interface AssetContent<TMeasures extends JSONObject = any, TMetadata exte
|
|
|
36
36
|
id: string;
|
|
37
37
|
date: number;
|
|
38
38
|
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Id's of soft tenants
|
|
41
|
+
* ! Not used directly in this plugin
|
|
42
|
+
*/
|
|
43
|
+
softTenant?: Array<string>;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
46
|
* Asset description used to contextualize each measure data point
|
|
@@ -49,4 +54,4 @@ export type AssetMeasureContext<TMetadata extends Metadata = Metadata> = {
|
|
|
49
54
|
* Name of the measure for the Asset
|
|
50
55
|
*/
|
|
51
56
|
measureName: string;
|
|
52
|
-
} & Pick<AssetContent<JSONObject, TMetadata>, "model" | "reference" | "metadata" | "groups">;
|
|
57
|
+
} & Pick<AssetContent<JSONObject, TMetadata>, "model" | "reference" | "metadata" | "groups" | "softTenant">;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSONObject, KDocument, KHit, SearchResult, mUpdateResponse } from "kuzzle-sdk";
|
|
2
2
|
import { AssetsGroupsBody, AssetsGroupContent } from "./AssetGroupContent";
|
|
3
3
|
type AssetsGroupsRequest = Omit<AssetsGroupsBody, "lastUpdate">;
|
|
4
|
-
export type AssetsGroupsBodyRequest = Partial<AssetsGroupsRequest> & Omit<AssetsGroupsRequest, "parent">;
|
|
4
|
+
export type AssetsGroupsBodyRequest = Partial<AssetsGroupsRequest> & Omit<AssetsGroupsRequest, "parent" | "type">;
|
|
5
5
|
export type UpdateAssetLinkResponse = mUpdateResponse & {
|
|
6
6
|
assetsGroups: KDocument<AssetsGroupContent>;
|
|
7
7
|
};
|
|
@@ -4,13 +4,6 @@ import { AssetContent } from "./AssetContent";
|
|
|
4
4
|
export type AssetHistoryMetadata = {
|
|
5
5
|
names: string[];
|
|
6
6
|
};
|
|
7
|
-
export type AssetHistoryEventMeasure = {
|
|
8
|
-
name: "measure";
|
|
9
|
-
measure: {
|
|
10
|
-
names: string[];
|
|
11
|
-
};
|
|
12
|
-
metadata?: AssetHistoryMetadata;
|
|
13
|
-
};
|
|
14
7
|
export type AssetHistoryEventMetadata = {
|
|
15
8
|
name: "metadata";
|
|
16
9
|
metadata: AssetHistoryMetadata;
|
|
@@ -27,7 +20,7 @@ export type AssetHistoryEventUnlink = {
|
|
|
27
20
|
deviceId: string;
|
|
28
21
|
};
|
|
29
22
|
};
|
|
30
|
-
export type AssetHistoryEvent =
|
|
23
|
+
export type AssetHistoryEvent = AssetHistoryEventMetadata | AssetHistoryEventLink | AssetHistoryEventUnlink;
|
|
31
24
|
/**
|
|
32
25
|
* Asset History document content
|
|
33
26
|
*/
|
|
@@ -9,6 +9,7 @@ import { DeviceContent } from "./types/DeviceContent";
|
|
|
9
9
|
export declare class DeviceService extends DigitalTwinService {
|
|
10
10
|
constructor(plugin: DeviceManagerPlugin);
|
|
11
11
|
registerAskEvents(): void;
|
|
12
|
+
private _create;
|
|
12
13
|
/**
|
|
13
14
|
* Create a new device.
|
|
14
15
|
*
|
|
@@ -30,6 +31,15 @@ export declare class DeviceService extends DigitalTwinService {
|
|
|
30
31
|
update(engineId: string, deviceId: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
31
32
|
delete(engineId: string, deviceId: string, request: KuzzleRequest): Promise<void>;
|
|
32
33
|
search(engineId: string, searchParams: SearchParams, request: KuzzleRequest): Promise<SearchResult<KHit<DeviceContent>>>;
|
|
34
|
+
/**
|
|
35
|
+
* Internal logic to attach the device to an engine
|
|
36
|
+
*
|
|
37
|
+
* @param engineId Engine id to attach to
|
|
38
|
+
* @param deviceId Device id to attach
|
|
39
|
+
* @param options.refresh Wait for ES indexation
|
|
40
|
+
* @param options.strict If true, throw if an operation isn't possible
|
|
41
|
+
*/
|
|
42
|
+
private _attachEngine;
|
|
33
43
|
/**
|
|
34
44
|
* Attach the device to an engine
|
|
35
45
|
*
|
|
@@ -67,7 +77,14 @@ export declare class DeviceService extends DigitalTwinService {
|
|
|
67
77
|
*/
|
|
68
78
|
private generateMissingAssetMeasureNames;
|
|
69
79
|
/**
|
|
70
|
-
*
|
|
80
|
+
* Internal logic of unlink a device of an asset
|
|
81
|
+
*
|
|
82
|
+
* @param {string} deviceId Id of the device
|
|
83
|
+
* @param {KuzzleRequest} request kuzzle request
|
|
84
|
+
*/
|
|
85
|
+
private _unlinkAsset;
|
|
86
|
+
/**
|
|
87
|
+
* Unlink a device of an asset with lock
|
|
71
88
|
*
|
|
72
89
|
* @param {string} deviceId Id of the device
|
|
73
90
|
* @param {KuzzleRequest} request kuzzle request
|
|
@@ -25,7 +25,6 @@ export type ApiDeviceUpdateResult = KDocument<DeviceContent>;
|
|
|
25
25
|
export type ApiDeviceMetadataReplaceResult = KDocument<DeviceContent>;
|
|
26
26
|
export interface ApiDeviceUpsertRequest extends DevicesControllerRequest {
|
|
27
27
|
action: "upsert";
|
|
28
|
-
_id: string;
|
|
29
28
|
refresh?: string;
|
|
30
29
|
body: {
|
|
31
30
|
model: string;
|
|
@@ -1,48 +1,25 @@
|
|
|
1
|
-
import { JSONObject
|
|
2
|
-
import { DeviceContent } from "../device";
|
|
1
|
+
import { JSONObject } from "kuzzle";
|
|
3
2
|
import { DeviceManagerPlugin } from "../plugin";
|
|
4
|
-
import { BaseService
|
|
3
|
+
import { BaseService } from "../shared";
|
|
5
4
|
import { DecodedMeasurement } from "./types/MeasureContent";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { MeasureSource } from "./types/MeasureSources";
|
|
6
|
+
import { MeasureTarget } from "./types/MeasureTarget";
|
|
8
7
|
export declare class MeasureService extends BaseService {
|
|
9
8
|
constructor(plugin: DeviceManagerPlugin);
|
|
10
9
|
/**
|
|
11
|
-
* Register new measures
|
|
10
|
+
* Register new measures updates :
|
|
12
11
|
* - asset
|
|
13
12
|
* - engine measures
|
|
14
13
|
*
|
|
15
14
|
* This method represents the ingestion pipeline:
|
|
16
15
|
* - trigger events `before` (measure enrichment)
|
|
17
|
-
* - save documents (measures
|
|
16
|
+
* - save documents (measures & device metadata)
|
|
18
17
|
* - trigger events `after`
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* - engine device
|
|
25
|
-
* - linked asset
|
|
26
|
-
* - engine measures
|
|
27
|
-
*
|
|
28
|
-
* A mutex ensure that a device can ingest one measure at a time.
|
|
29
|
-
*
|
|
30
|
-
* This method represents the ingestion pipeline:
|
|
31
|
-
* - build measures documents and update digital twins (device and asset)
|
|
32
|
-
* - trigger events `before` (measure enrichment)
|
|
33
|
-
* - save documents (measures, device and asset)
|
|
34
|
-
* - trigger events `after`
|
|
35
|
-
*
|
|
36
|
-
* @deprecated
|
|
37
|
-
*/
|
|
38
|
-
ingest(device: KDocument<DeviceContent>, measurements: DecodedMeasurement<JSONObject>[], metadata: Metadata, payloadUuids: string[]): Promise<void>;
|
|
39
|
-
private updateDeviceMeasures;
|
|
40
|
-
/**
|
|
41
|
-
* Update asset with each non-null non-computed measures.
|
|
42
|
-
*
|
|
43
|
-
* @returns A map of each asset state by measuredAt timestamp.
|
|
44
|
-
*/
|
|
45
|
-
private updateAssetMeasures;
|
|
19
|
+
ingest(source: MeasureSource, target: MeasureTarget, measurements: DecodedMeasurement<JSONObject>[], payloadUuids: string[]): Promise<void>;
|
|
20
|
+
private buildDeviceMeasures;
|
|
21
|
+
private ingestDeviceMeasures;
|
|
22
|
+
private ingestApiMeasures;
|
|
46
23
|
/**
|
|
47
24
|
* Build the measures document received from the API
|
|
48
25
|
*
|
|
@@ -50,14 +27,10 @@ export declare class MeasureService extends BaseService {
|
|
|
50
27
|
* @param asset The target asset to build the measure for
|
|
51
28
|
* @param measure The decoded raw measures
|
|
52
29
|
* @param payloadUuids The uuid's of the payloads used to create the measure
|
|
53
|
-
*
|
|
30
|
+
* @param engineGroup engineGroup of model
|
|
54
31
|
* @returns A MeasurementContent builded from parameters
|
|
55
32
|
*/
|
|
56
33
|
private buildApiMeasures;
|
|
57
|
-
/**
|
|
58
|
-
* Build the measures documents to save
|
|
59
|
-
*/
|
|
60
|
-
private buildMeasures;
|
|
61
34
|
/**
|
|
62
35
|
* Find an asset by its ID and its engine ID.
|
|
63
36
|
*
|
|
@@ -6,5 +6,4 @@ export declare const enum DATA_SOURCE_METADATA_TYPE {
|
|
|
6
6
|
DEVICE = "device"
|
|
7
7
|
}
|
|
8
8
|
export declare function apiSourceToOriginApi(source: ApiMeasureSource, payloadUuids: string[]): MeasureOriginApi;
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function deviceSourceToOriginDevice(source: DeviceMeasureSource, measureName: string, payloadUuids: string[]): MeasureOriginDevice;
|
|
9
|
+
export declare function deviceSourceToOriginDevice(source: DeviceMeasureSource, measureName: string, payloadUuids: string[], deviceMetadata: Metadata): MeasureOriginDevice;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from "./types/MeasureEvents";
|
|
2
2
|
export * from "./types/MeasureContent";
|
|
3
3
|
export * from "./types/MeasureDefinition";
|
|
4
|
-
export * from "./measures";
|
|
5
4
|
export * from "./roles/RoleMeasuresAdmin";
|
|
6
5
|
export * from "./roles/RoleMeasuresReader";
|
|
7
6
|
export * from "./collections/measuresMappings";
|
|
@@ -2,7 +2,6 @@ export * from "./collections/measuresMappings";
|
|
|
2
2
|
export * from "./types/MeasureEvents";
|
|
3
3
|
export * from "./types/MeasureContent";
|
|
4
4
|
export * from "./types/MeasureDefinition";
|
|
5
|
-
export * from "./measures";
|
|
6
5
|
export * from "./MeasureModule";
|
|
7
6
|
export * from "./roles/RoleMeasuresAdmin";
|
|
8
7
|
export * from "./roles/RoleMeasuresReader";
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
import { JSONObject
|
|
2
|
-
import { DeviceContent } from "../../../modules/device";
|
|
1
|
+
import { JSONObject } from "kuzzle-sdk";
|
|
3
2
|
import { AssetContent } from "../../../modules/asset";
|
|
4
|
-
import { Metadata } from "../../../modules/shared";
|
|
5
3
|
import { DecodedMeasurement, MeasureContent } from "./MeasureContent";
|
|
6
4
|
import { MeasureSource } from "./MeasureSources";
|
|
7
5
|
import { MeasureTarget } from "./MeasureTarget";
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*
|
|
11
|
-
* @deprecated Replaced by new Ask implementing data sources
|
|
12
|
-
*/
|
|
13
|
-
export type AskMeasureIngest = {
|
|
14
|
-
name: "device-manager:measures:ingest";
|
|
15
|
-
payload: {
|
|
16
|
-
device: KDocument<DeviceContent>;
|
|
17
|
-
measurements: DecodedMeasurement<JSONObject>[];
|
|
18
|
-
metadata: Metadata;
|
|
19
|
-
payloadUuids: string[];
|
|
20
|
-
};
|
|
21
|
-
result: void;
|
|
22
|
-
};
|
|
23
6
|
/**
|
|
24
7
|
* @internal
|
|
25
8
|
*/
|
|
@@ -34,29 +17,12 @@ export type AskMeasureSourceIngest = {
|
|
|
34
17
|
result: void;
|
|
35
18
|
};
|
|
36
19
|
/**
|
|
37
|
-
* Event before starting to process new measures.
|
|
20
|
+
* Event before starting to process new measures from data source.
|
|
38
21
|
*
|
|
39
22
|
* Useful to enrich measures before they are saved.
|
|
40
|
-
*
|
|
41
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
42
23
|
*/
|
|
43
24
|
export type EventMeasureProcessBefore = {
|
|
44
25
|
name: "device-manager:measures:process:before";
|
|
45
|
-
args: [
|
|
46
|
-
{
|
|
47
|
-
asset: KDocument<AssetContent>;
|
|
48
|
-
device: KDocument<DeviceContent>;
|
|
49
|
-
measures: MeasureContent[];
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Event before starting to process new measures from data source.
|
|
55
|
-
*
|
|
56
|
-
* Useful to enrich measures before they are saved.
|
|
57
|
-
*/
|
|
58
|
-
export type EventMeasureProcessSourceBefore = {
|
|
59
|
-
name: "device-manager:measures:process:sourceBefore";
|
|
60
26
|
args: [
|
|
61
27
|
{
|
|
62
28
|
source: MeasureSource;
|
|
@@ -67,60 +33,12 @@ export type EventMeasureProcessSourceBefore = {
|
|
|
67
33
|
];
|
|
68
34
|
};
|
|
69
35
|
/**
|
|
70
|
-
* Tenant event before starting to process new measures.
|
|
36
|
+
* Tenant event before starting to process new measures from data source.
|
|
71
37
|
*
|
|
72
38
|
* Useful to enrich measures before they are saved.
|
|
73
|
-
*
|
|
74
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
75
39
|
*/
|
|
76
40
|
export type TenantEventMeasureProcessBefore = {
|
|
77
41
|
name: `engine:${string}:device-manager:measures:process:before`;
|
|
78
|
-
args: [
|
|
79
|
-
{
|
|
80
|
-
asset: KDocument<AssetContent>;
|
|
81
|
-
device: KDocument<DeviceContent>;
|
|
82
|
-
measures: MeasureContent[];
|
|
83
|
-
}
|
|
84
|
-
];
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Tenant event before starting to process new measures from data source.
|
|
88
|
-
*
|
|
89
|
-
* Useful to enrich measures before they are saved.
|
|
90
|
-
*/
|
|
91
|
-
export type TenantEventMeasureProcessSourceBefore = {
|
|
92
|
-
name: `engine:${string}:device-manager:measures:process:sourceBefore`;
|
|
93
|
-
args: [
|
|
94
|
-
{
|
|
95
|
-
source: MeasureSource;
|
|
96
|
-
target: MeasureTarget;
|
|
97
|
-
asset?: AssetContent;
|
|
98
|
-
measures: MeasureContent[];
|
|
99
|
-
}
|
|
100
|
-
];
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Event triggered after updating device and asset with new measures but
|
|
104
|
-
* before persistence in database.
|
|
105
|
-
*
|
|
106
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
107
|
-
*/
|
|
108
|
-
export type EventMeasurePersistBefore = {
|
|
109
|
-
name: "device-manager:measures:persist:before";
|
|
110
|
-
args: [
|
|
111
|
-
{
|
|
112
|
-
asset: KDocument<AssetContent>;
|
|
113
|
-
device: KDocument<DeviceContent>;
|
|
114
|
-
measures: MeasureContent[];
|
|
115
|
-
}
|
|
116
|
-
];
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Event triggered after updating the data source and asset with new measures but
|
|
120
|
-
* before persistence in database.
|
|
121
|
-
*/
|
|
122
|
-
export type EventMeasurePersistSourceBefore = {
|
|
123
|
-
name: "device-manager:measures:persist:sourceBefore";
|
|
124
42
|
args: [
|
|
125
43
|
{
|
|
126
44
|
source: MeasureSource;
|
|
@@ -131,56 +49,10 @@ export type EventMeasurePersistSourceBefore = {
|
|
|
131
49
|
];
|
|
132
50
|
};
|
|
133
51
|
/**
|
|
134
|
-
*
|
|
135
|
-
* before persistence in database.
|
|
136
|
-
*
|
|
137
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
138
|
-
*/
|
|
139
|
-
export type TenantEventMeasurePersistBefore = {
|
|
140
|
-
name: `engine:${string}:device-manager:measures:persist:before`;
|
|
141
|
-
args: [
|
|
142
|
-
{
|
|
143
|
-
asset: KDocument<AssetContent>;
|
|
144
|
-
device: KDocument<DeviceContent>;
|
|
145
|
-
measures: MeasureContent[];
|
|
146
|
-
}
|
|
147
|
-
];
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Tenant event triggered after updating the data source and asset with new measures but
|
|
151
|
-
* before persistence in database.
|
|
152
|
-
*/
|
|
153
|
-
export type TenantEventMeasurePersistSourceBefore = {
|
|
154
|
-
name: `engine:${string}:device-manager:measures:persist:sourceBefore`;
|
|
155
|
-
args: [
|
|
156
|
-
{
|
|
157
|
-
source: MeasureSource;
|
|
158
|
-
target: MeasureTarget;
|
|
159
|
-
asset?: AssetContent;
|
|
160
|
-
measures: MeasureContent[];
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Event after processing new measures.
|
|
166
|
-
*
|
|
167
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
52
|
+
* Event after processing new measures from data source.
|
|
168
53
|
*/
|
|
169
54
|
export type EventMeasureProcessAfter = {
|
|
170
55
|
name: "device-manager:measures:process:after";
|
|
171
|
-
args: [
|
|
172
|
-
{
|
|
173
|
-
asset: KDocument<AssetContent>;
|
|
174
|
-
device: KDocument<DeviceContent>;
|
|
175
|
-
measures: MeasureContent[];
|
|
176
|
-
}
|
|
177
|
-
];
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Event after processing new measures from data source.
|
|
181
|
-
*/
|
|
182
|
-
export type EventMeasureProcessSourceAfter = {
|
|
183
|
-
name: "device-manager:measures:process:sourceAfter";
|
|
184
56
|
args: [
|
|
185
57
|
{
|
|
186
58
|
source: MeasureSource;
|
|
@@ -191,26 +63,11 @@ export type EventMeasureProcessSourceAfter = {
|
|
|
191
63
|
];
|
|
192
64
|
};
|
|
193
65
|
/**
|
|
194
|
-
* Tenant event after processing new measures.
|
|
66
|
+
* Tenant event after processing new measures from data source.
|
|
195
67
|
*
|
|
196
|
-
* @deprecated Replaced by new triggers implementing data sources
|
|
197
68
|
*/
|
|
198
69
|
export type TenantEventMeasureProcessAfter = {
|
|
199
70
|
name: `engine:${string}:device-manager:measures:process:after`;
|
|
200
|
-
args: [
|
|
201
|
-
{
|
|
202
|
-
asset: KDocument<AssetContent>;
|
|
203
|
-
device: KDocument<DeviceContent>;
|
|
204
|
-
measures: MeasureContent[];
|
|
205
|
-
}
|
|
206
|
-
];
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* Tenant event after processing new measures from data source.
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
export type TenantEventMeasureProcessSourceAfter = {
|
|
213
|
-
name: `engine:${string}:device-manager:measures:process:sourceAfter`;
|
|
214
71
|
args: [
|
|
215
72
|
{
|
|
216
73
|
source: MeasureSource;
|
|
@@ -45,7 +45,7 @@ export type DeviceManagerConfiguration = {
|
|
|
45
45
|
mappings: JSONObject;
|
|
46
46
|
settings?: JSONObject;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
assets: {
|
|
49
49
|
name: string;
|
|
50
50
|
mappings: CollectionMappings;
|
|
51
51
|
settings?: JSONObject;
|
|
@@ -58,7 +58,7 @@ export type DeviceManagerConfiguration = {
|
|
|
58
58
|
name: string;
|
|
59
59
|
settings?: JSONObject;
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
devices: {
|
|
62
62
|
name: string;
|
|
63
63
|
mappings: CollectionMappings;
|
|
64
64
|
settings?: JSONObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SchemaValidationError";
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
export * from "./Module";
|
|
2
|
+
export * from "./errors";
|
|
2
3
|
export * from "./services";
|
|
3
|
-
export * from "./types
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./types/DigitalTwinEvents";
|
|
6
|
-
export * from "./types/DigitalTwinMeasures";
|
|
7
|
-
export * from "./types/EmbeddedMeasure";
|
|
8
|
-
export * from "./types/KuzzleRole";
|
|
9
|
-
export * from "./types/Metadata";
|
|
10
|
-
export * from "./utils/flattenObject";
|
|
11
|
-
export * from "./utils/keepStack";
|
|
12
|
-
export * from "./utils/lock";
|
|
13
|
-
export * from "./utils/objectDiff";
|
|
4
|
+
export * from "./types";
|
|
5
|
+
export * from "./utils";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MeasureDefinition } from "../../measure";
|
|
2
|
+
import { AssetModelDefinition, DeviceModelDefinition } from "../../model";
|
|
3
|
+
interface ModelDefinition<Definition> {
|
|
4
|
+
/**
|
|
5
|
+
* Name of model
|
|
6
|
+
*/
|
|
7
|
+
modelName: string;
|
|
8
|
+
/**
|
|
9
|
+
* Model definition used by the plugin to create associated ressources
|
|
10
|
+
* and updates mappings.
|
|
11
|
+
*/
|
|
12
|
+
definition: Definition;
|
|
13
|
+
}
|
|
14
|
+
export type AssetModel = ModelDefinition<AssetModelDefinition>;
|
|
15
|
+
export type DeviceModel = ModelDefinition<DeviceModelDefinition>;
|
|
16
|
+
export type MeasureModel = ModelDefinition<MeasureDefinition>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./DigitalTwinApi";
|
|
2
|
+
export * from "./DigitalTwinContent";
|
|
3
|
+
export * from "./DigitalTwinEvents";
|
|
4
|
+
export * from "./DigitalTwinMeasures";
|
|
5
|
+
export * from "./EmbeddedMeasure";
|
|
6
|
+
export * from "./KuzzleRole";
|
|
7
|
+
export * from "./Metadata";
|
|
8
|
+
export * from "./Models";
|
|
9
|
+
export * from "./exports";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Metadata, AssetContent,
|
|
1
|
+
import { Metadata, AssetContent, AssetModel } from "../../../index";
|
|
2
|
+
import { TemperatureMeasurement, PositionMeasurement } from "../measures";
|
|
3
|
+
declare const modelName = "Container";
|
|
2
4
|
export interface ContainerMetadata extends Metadata {
|
|
3
5
|
height: number;
|
|
4
6
|
width: number;
|
|
@@ -17,6 +19,7 @@ export type ContainerMeasurements = {
|
|
|
17
19
|
temperatureWeather: TemperatureMeasurement;
|
|
18
20
|
};
|
|
19
21
|
export interface ContainerAssetContent extends AssetContent<ContainerMeasurements, ContainerMetadata> {
|
|
20
|
-
model:
|
|
22
|
+
model: typeof modelName;
|
|
21
23
|
}
|
|
22
|
-
export declare const
|
|
24
|
+
export declare const Container: AssetModel;
|
|
25
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { AssetModel } from "../../../index";
|
|
2
|
+
export declare const MagicHouse: AssetModel;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { AssetModel } from "../../../index";
|
|
2
|
+
export declare const Room: AssetModel;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { AssetModel } from "../../../index";
|
|
2
|
+
export declare const StreetLamp: AssetModel;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
1
|
+
import { AssetModel } from "../../../index";
|
|
2
|
+
export declare const Warehouse: AssetModel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONObject } from "kuzzle-sdk";
|
|
2
|
+
import { Decoder, DecodedPayload } from "../../../index";
|
|
3
|
+
export declare class EmptyTempDecoder extends Decoder {
|
|
4
|
+
measures: any[];
|
|
5
|
+
constructor();
|
|
6
|
+
validate(rawPayload: JSONObject): Promise<boolean>;
|
|
7
|
+
decode(decodedPayload: DecodedPayload<EmptyTempDecoder>, rawPayload: JSONObject): Promise<DecodedPayload<EmptyTempDecoder>>;
|
|
8
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MeasureModel } from "../../../index";
|
|
2
2
|
export type AccelerationMeasurement = {
|
|
3
3
|
acceleration: {
|
|
4
4
|
x: number;
|
|
@@ -7,4 +7,4 @@ export type AccelerationMeasurement = {
|
|
|
7
7
|
};
|
|
8
8
|
accuracy: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const Acceleration: MeasureModel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MeasureModel } from "../../../index";
|
|
2
2
|
export type MagiculeMeasurement = {
|
|
3
3
|
magicule: number;
|
|
4
4
|
};
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const Magicule: MeasureModel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MeasureModel } from "lib/modules/shared";
|
|
2
2
|
export type PositionMeasurement = {
|
|
3
3
|
position: {
|
|
4
4
|
lat: number;
|
|
@@ -7,4 +7,4 @@ export type PositionMeasurement = {
|
|
|
7
7
|
altitude?: number;
|
|
8
8
|
accuracy?: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const positionMeasureModel: MeasureModel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./Acceleration";
|
|
2
|
+
export * from "./Brightness";
|
|
3
|
+
export * from "./CO2";
|
|
4
|
+
export * from "./Illuminance";
|
|
5
|
+
export * from "./Magicule";
|
|
6
|
+
export * from "./PowerConsumption";
|
|
7
|
+
export * from "./MovementMeasure";
|
|
8
|
+
export * from "./PositionMeasure";
|
|
9
|
+
export * from "./TemperatureMeasure";
|
|
10
|
+
export * from "./HumidityMeasure";
|
|
11
|
+
export * from "./BatteryMeasure";
|
package/package.json
CHANGED