kuzzle-device-manager-types 2.4.0-beta.2 → 2.4.0-beta.21
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/AssetHistoryService.d.ts +2 -4
- package/dist/lib/modules/asset/AssetService.d.ts +25 -26
- package/dist/lib/modules/asset/AssetsController.d.ts +8 -1
- package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +4 -0
- package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsConfiguration.d.ts +8 -0
- package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsCreation.d.ts +8 -0
- package/dist/lib/modules/asset/roles/specificRoles/index.d.ts +2 -0
- package/dist/lib/modules/asset/types/AssetApi.d.ts +43 -2
- package/dist/lib/modules/asset/types/AssetContent.d.ts +1 -1
- package/dist/lib/modules/decoder/Decoder.d.ts +11 -0
- package/dist/lib/modules/decoder/PayloadService.d.ts +3 -6
- package/dist/lib/modules/decoder/types/DecoderContent.d.ts +1 -0
- package/dist/lib/modules/device/DeviceService.d.ts +31 -46
- package/dist/lib/modules/device/DevicesController.d.ts +7 -1
- package/dist/lib/modules/device/collections/deviceMappings.d.ts +2 -46
- package/dist/lib/modules/device/roles/RoleDevicesReader.d.ts +4 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesAssetAssociation.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesConfiguration.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesCreation.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/index.d.ts +3 -0
- package/dist/lib/modules/device/types/DeviceApi.d.ts +23 -2
- package/dist/lib/modules/device/types/DeviceEvents.d.ts +29 -0
- package/dist/lib/modules/measure/MeasureExporter.d.ts +5 -2
- package/dist/lib/modules/measure/MeasureService.d.ts +2 -6
- package/dist/lib/modules/measure/collections/measuresMappings.d.ts +18 -0
- package/dist/lib/modules/measure/types/MeasureContent.d.ts +4 -0
- package/dist/lib/modules/measure/types/MeasureDefinition.d.ts +28 -3
- package/dist/lib/modules/model/MappingsConflictsError.d.ts +7 -0
- package/dist/lib/modules/model/ModelService.d.ts +17 -9
- package/dist/lib/modules/model/ModelsConflicts.d.ts +30 -0
- package/dist/lib/modules/model/ModelsController.d.ts +5 -1
- package/dist/lib/modules/model/ModelsRegister.d.ts +28 -3
- package/dist/lib/modules/model/types/ModelApi.d.ts +50 -4
- package/dist/lib/modules/model/types/ModelContent.d.ts +263 -2
- package/dist/lib/modules/model/types/ModelDefinition.d.ts +141 -5
- package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +141 -5
- package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +113 -8
- package/dist/lib/modules/plugin/exports.d.ts +1 -1
- package/dist/lib/modules/plugin/index.d.ts +1 -2
- package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +27 -5
- package/dist/lib/modules/plugin/types/Pipes.d.ts +17 -0
- package/dist/lib/modules/plugin/types/exports.d.ts +1 -0
- package/dist/lib/modules/plugin/types/index.d.ts +3 -0
- package/dist/lib/modules/shared/exports.d.ts +2 -0
- package/dist/lib/modules/shared/index.d.ts +6 -4
- package/dist/lib/modules/shared/services/AbstractExporter.d.ts +1 -0
- package/dist/lib/modules/shared/services/BaseService.d.ts +69 -0
- package/dist/lib/modules/shared/services/DigitalTwinService.d.ts +21 -0
- package/dist/lib/modules/shared/services/index.d.ts +2 -0
- package/dist/lib/modules/shared/types/DigitalTwinApi.d.ts +34 -0
- package/dist/lib/modules/shared/types/DigitalTwinContent.d.ts +2 -4
- package/dist/lib/modules/shared/types/DigitalTwinEvents.d.ts +9 -0
- package/dist/lib/modules/shared/types/DigitalTwinMeasures.d.ts +5 -0
- package/dist/tests/application/assets/Container.d.ts +3 -0
- package/dist/tests/application/assets/Room.d.ts +2 -0
- package/dist/tests/application/assets/StreetLamp.d.ts +2 -0
- package/dist/tests/application/decoders/DummyTempPositionDecoder.d.ts +1 -0
- package/dist/tests/application/measures/BrightnessMeasure.d.ts +2 -0
- package/dist/tests/application/measures/CO2Measure.d.ts +2 -0
- package/dist/tests/application/measures/IlluminanceMeasure.d.ts +2 -0
- package/dist/tests/application/measures/PowerConsumptionMeasure.d.ts +2 -0
- package/package.json +4 -3
- package/dist/lib/modules/shared/utils/ask.d.ts +0 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONObject } from "kuzzle-sdk";
|
|
2
2
|
import { Decoder, NamedMeasures } from "../../../modules/decoder";
|
|
3
|
+
import { MetadataDetails, MetadataGroups, MetadataMappings, TooltipModels } from "./ModelContent";
|
|
3
4
|
/**
|
|
4
5
|
* Define an asset model
|
|
5
6
|
*
|
|
@@ -16,6 +17,83 @@ import { Decoder, NamedMeasures } from "../../../modules/decoder";
|
|
|
16
17
|
* },
|
|
17
18
|
* defaultMetadata: {
|
|
18
19
|
* height: 20
|
|
20
|
+
* },
|
|
21
|
+
* metadataDetails: {
|
|
22
|
+
* "extTemp": {
|
|
23
|
+
* "group": "buildingEnv",
|
|
24
|
+
* "locales": {
|
|
25
|
+
* "en": {
|
|
26
|
+
* "friendlyName": "External temperature",
|
|
27
|
+
* "description": "Container external temperature"
|
|
28
|
+
* },
|
|
29
|
+
* "fr": {
|
|
30
|
+
* "friendlyName": "Température externe",
|
|
31
|
+
* "description": "Température externe du conteneur"
|
|
32
|
+
* }
|
|
33
|
+
* },
|
|
34
|
+
* "definition": {
|
|
35
|
+
* "readOnly": false,
|
|
36
|
+
* "type": MetadataDetailsEnum.DATETIME,
|
|
37
|
+
* "date": true,
|
|
38
|
+
* "time": true,
|
|
39
|
+
* "customTimeZoneAllowed": true,
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* },
|
|
43
|
+
* metadataGroups: {
|
|
44
|
+
* buildingEnv: {
|
|
45
|
+
* locales: {
|
|
46
|
+
* en: {
|
|
47
|
+
* groupFriendlyName: "Building environment",
|
|
48
|
+
* description: "The building environment"
|
|
49
|
+
* },
|
|
50
|
+
* fr: {
|
|
51
|
+
* groupFriendlyName: "Environnement du bâtiment",
|
|
52
|
+
* description: "L'environnement du bâtiment"
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
* },
|
|
57
|
+
* tooltipModels: {
|
|
58
|
+
* "defaultTooltipKey": {
|
|
59
|
+
* "tooltipLabel": "Default Tooltip Model",
|
|
60
|
+
* "content": [
|
|
61
|
+
* {
|
|
62
|
+
* "category": "metadata",
|
|
63
|
+
* "label": {
|
|
64
|
+
* "locales": {
|
|
65
|
+
* "en": {
|
|
66
|
+
* "friendlyName": "Container position",
|
|
67
|
+
* "description": ""
|
|
68
|
+
* },
|
|
69
|
+
* "fr": {
|
|
70
|
+
* "friendlyName": "Position du conteneur",
|
|
71
|
+
* "description": ""
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* },
|
|
75
|
+
* "metadataPath": "geolocation"
|
|
76
|
+
* },
|
|
77
|
+
* {
|
|
78
|
+
* "category": "measure",
|
|
79
|
+
* "label": {
|
|
80
|
+
* "locales": {
|
|
81
|
+
* "en": {
|
|
82
|
+
* "friendlyName": "External temperature",
|
|
83
|
+
* "description": ""
|
|
84
|
+
* },
|
|
85
|
+
* "fr": {
|
|
86
|
+
* "friendlyName": "Température extérieure",
|
|
87
|
+
* "description": ""
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* },
|
|
91
|
+
* "measureSlot": "externalTemperature",
|
|
92
|
+
* "measureValuePath": "externalTemperature",
|
|
93
|
+
* "suffix": "°C"
|
|
94
|
+
* }
|
|
95
|
+
* ]
|
|
96
|
+
* }
|
|
19
97
|
* }
|
|
20
98
|
* }
|
|
21
99
|
*
|
|
@@ -28,11 +106,23 @@ export type AssetModelDefinition = {
|
|
|
28
106
|
/**
|
|
29
107
|
* Metadata mappings definition
|
|
30
108
|
*/
|
|
31
|
-
metadataMappings?:
|
|
109
|
+
metadataMappings?: MetadataMappings;
|
|
32
110
|
/**
|
|
33
111
|
* Default metadata values
|
|
34
112
|
*/
|
|
35
113
|
defaultMetadata?: JSONObject;
|
|
114
|
+
/**
|
|
115
|
+
* Metadata details including tanslations and group.
|
|
116
|
+
*/
|
|
117
|
+
metadataDetails?: MetadataDetails;
|
|
118
|
+
/**
|
|
119
|
+
* Metadata groups
|
|
120
|
+
*/
|
|
121
|
+
metadataGroups?: MetadataGroups;
|
|
122
|
+
/**
|
|
123
|
+
* Tooltip models
|
|
124
|
+
*/
|
|
125
|
+
tooltipModels?: TooltipModels;
|
|
36
126
|
};
|
|
37
127
|
/**
|
|
38
128
|
* Define a device model
|
|
@@ -42,9 +132,47 @@ export type AssetModelDefinition = {
|
|
|
42
132
|
* decoder: new DummyTempPositionDecoder(),
|
|
43
133
|
* metadataMappings: {
|
|
44
134
|
* serial: { type: "keyword" },
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
*
|
|
135
|
+
* },
|
|
136
|
+
* defaultMetadata: {
|
|
137
|
+
* company: "Firebird"
|
|
138
|
+
* },
|
|
139
|
+
* metadataDetails: {
|
|
140
|
+
* sensorType: {
|
|
141
|
+
* group: "sensorSpecs",
|
|
142
|
+
* locales: {
|
|
143
|
+
* en: {
|
|
144
|
+
* friendlyName: "Sensor type",
|
|
145
|
+
* description: "Type of the sensor"
|
|
146
|
+
* },
|
|
147
|
+
* fr: {
|
|
148
|
+
* friendlyName: "Type de traceur",
|
|
149
|
+
* description: "Type du traceur"
|
|
150
|
+
* }
|
|
151
|
+
* },
|
|
152
|
+
* definition: {
|
|
153
|
+
* readOnly: false,
|
|
154
|
+
* type: MetadataDetailsEnum.DATETIME,
|
|
155
|
+
* date: true,
|
|
156
|
+
* time: true,
|
|
157
|
+
* customTimeZoneAllowed: true,
|
|
158
|
+
* },
|
|
159
|
+
* },
|
|
160
|
+
* },
|
|
161
|
+
* metadataGroups: {
|
|
162
|
+
* sensorSpecs: {
|
|
163
|
+
* locales: {
|
|
164
|
+
* en: {
|
|
165
|
+
* groupFriendlyName: "Sensor specifications",
|
|
166
|
+
* description : "All sensors specifications"
|
|
167
|
+
* },
|
|
168
|
+
* fr: {
|
|
169
|
+
* groupFriendlyName: "Spécifications techniques",
|
|
170
|
+
* description: "Toutes les spécifications techniques"
|
|
171
|
+
* }
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
* }
|
|
48
176
|
*/
|
|
49
177
|
export type DeviceModelDefinition = {
|
|
50
178
|
/**
|
|
@@ -54,9 +182,17 @@ export type DeviceModelDefinition = {
|
|
|
54
182
|
/**
|
|
55
183
|
* Metadata mappings definition
|
|
56
184
|
*/
|
|
57
|
-
metadataMappings?:
|
|
185
|
+
metadataMappings?: MetadataMappings;
|
|
58
186
|
/**
|
|
59
187
|
* Default metadata values
|
|
60
188
|
*/
|
|
61
189
|
defaultMetadata?: JSONObject;
|
|
190
|
+
/**
|
|
191
|
+
* Metadata details including tanslations and group.
|
|
192
|
+
*/
|
|
193
|
+
metadataDetails?: MetadataDetails;
|
|
194
|
+
/**
|
|
195
|
+
* Metadata groups list and details.
|
|
196
|
+
*/
|
|
197
|
+
metadataGroups?: MetadataGroups;
|
|
62
198
|
};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { Backend, Plugin } from "kuzzle";
|
|
2
|
-
import { AbstractEngine, ConfigManager } from "kuzzle-plugin-commons";
|
|
3
|
-
import {
|
|
4
|
-
import { DeviceManagerConfiguration } from "./types/DeviceManagerConfiguration";
|
|
1
|
+
import { Backend, KDocumentContent, Plugin } from "kuzzle";
|
|
2
|
+
import { AbstractEngine, ConfigManager, EngineContent } from "kuzzle-plugin-commons";
|
|
3
|
+
import { AssetModelContent, DeviceModelContent, MeasureModelContent } from "../model";
|
|
5
4
|
import { DeviceManagerPlugin } from "./DeviceManagerPlugin";
|
|
5
|
+
import { DeviceManagerConfiguration } from "./types/DeviceManagerConfiguration";
|
|
6
6
|
import { InternalCollection } from "./types/InternalCollection";
|
|
7
|
+
import { ConflictChunk } from "../model/ModelsConflicts";
|
|
8
|
+
export type TwinType = "asset" | "device";
|
|
9
|
+
export type TwinModelContent = AssetModelContent | DeviceModelContent;
|
|
10
|
+
export interface EngineDocument extends KDocumentContent {
|
|
11
|
+
type: "engine-device-manager";
|
|
12
|
+
engine: {
|
|
13
|
+
group: string;
|
|
14
|
+
index: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
7
18
|
export type AskEngineList = {
|
|
8
19
|
name: "ask:device-manager:engine:list";
|
|
9
20
|
payload: {
|
|
@@ -16,11 +27,48 @@ export type AskEngineUpdateAll = {
|
|
|
16
27
|
payload: void;
|
|
17
28
|
result: void;
|
|
18
29
|
};
|
|
30
|
+
export type AskEngineUpdateConflict = {
|
|
31
|
+
name: "ask:device-manager:engine:doesUpdateConflict";
|
|
32
|
+
payload: {
|
|
33
|
+
twin?: {
|
|
34
|
+
type: TwinType;
|
|
35
|
+
models: TwinModelContent[];
|
|
36
|
+
};
|
|
37
|
+
measuresModels?: MeasureModelContent[];
|
|
38
|
+
};
|
|
39
|
+
result: ConflictChunk[];
|
|
40
|
+
};
|
|
19
41
|
export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlugin> {
|
|
20
42
|
config: DeviceManagerConfiguration;
|
|
21
43
|
get app(): Backend;
|
|
22
44
|
constructor(plugin: Plugin, adminConfigManager: ConfigManager, engineConfigManager: ConfigManager);
|
|
45
|
+
/**
|
|
46
|
+
* Return conflicts between the new and already present twin models
|
|
47
|
+
*
|
|
48
|
+
* @param twinType The target twin type
|
|
49
|
+
* @param twinModels The already present twin models
|
|
50
|
+
* @param additionalModels The new or updated twin models
|
|
51
|
+
* @param measureModels The already present measures models
|
|
52
|
+
*
|
|
53
|
+
* @throws If a measure type declared in the twin does not exists
|
|
54
|
+
* @returns An array of conflict chunk
|
|
55
|
+
*/
|
|
56
|
+
private doesTwinUpdateConflicts;
|
|
57
|
+
/**
|
|
58
|
+
* Return conflicts between the new and already present measure models
|
|
59
|
+
*
|
|
60
|
+
* @param measuresModels The already present measure models
|
|
61
|
+
* @param additionalMeasures The new or updated measure models
|
|
62
|
+
* @returns An array of ConflictChunk
|
|
63
|
+
*/
|
|
64
|
+
private doesMeasuresUpdateConflicts;
|
|
23
65
|
updateEngines(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Search and return every engines in use
|
|
68
|
+
*
|
|
69
|
+
* @returns An array of the available engines
|
|
70
|
+
*/
|
|
71
|
+
getEngines(): Promise<EngineDocument[]>;
|
|
24
72
|
onCreate(index: string, group?: string): Promise<{
|
|
25
73
|
collections: any[];
|
|
26
74
|
}>;
|
|
@@ -30,12 +78,100 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
30
78
|
onDelete(index: string): Promise<{
|
|
31
79
|
collections: InternalCollection[];
|
|
32
80
|
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Generate assets mappings and create the assets collection in the engine
|
|
83
|
+
*
|
|
84
|
+
* @param engineId The target engine Id
|
|
85
|
+
* @param engineGroup The engine group
|
|
86
|
+
*
|
|
87
|
+
* @throws If it failed during the assets collection creation
|
|
88
|
+
*/
|
|
33
89
|
createAssetsCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
90
|
+
/**
|
|
91
|
+
* Generate assets mappings and create the assets history collection in the engine
|
|
92
|
+
*
|
|
93
|
+
* @param engineId The target engine Id
|
|
94
|
+
* @param engineGroup The engine group
|
|
95
|
+
*
|
|
96
|
+
* @throws If it failed during the assets history collection creation
|
|
97
|
+
*/
|
|
34
98
|
createAssetsHistoryCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
99
|
+
/**
|
|
100
|
+
* Create the assets groups collection with the assets groups mappings in the engine
|
|
101
|
+
*
|
|
102
|
+
* @param engineId The target engine Id
|
|
103
|
+
* @param engineGroup The engine group
|
|
104
|
+
*
|
|
105
|
+
* @throws If it failed during the assets groups collection creation
|
|
106
|
+
*/
|
|
35
107
|
createAssetsGroupsCollection(engineId: string): Promise<InternalCollection>;
|
|
36
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Generate devices mappings and create the devices collection in the engine
|
|
110
|
+
*
|
|
111
|
+
* @param engineId The target engine Id
|
|
112
|
+
* @param engineGroup The engine group
|
|
113
|
+
*
|
|
114
|
+
* @throws If it failed during the devices collection creation
|
|
115
|
+
*/
|
|
37
116
|
createDevicesCollection(engineId: string): Promise<InternalCollection>;
|
|
117
|
+
/**
|
|
118
|
+
* Generate measures mappings and create the measures collection in the engine
|
|
119
|
+
*
|
|
120
|
+
* @param engineId The target engine Id
|
|
121
|
+
* @param engineGroup The engine group
|
|
122
|
+
*
|
|
123
|
+
* @throws If it failed during the measures collection creation
|
|
124
|
+
*/
|
|
38
125
|
createMeasuresCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
126
|
+
/**
|
|
127
|
+
* Create a collection with custom mappings in an engine
|
|
128
|
+
*
|
|
129
|
+
* @param engineIndex The target engine
|
|
130
|
+
* @param collection The collection name
|
|
131
|
+
* @param mappings The collection mappings
|
|
132
|
+
*
|
|
133
|
+
* @throws If it failed to create the collection
|
|
134
|
+
*/
|
|
135
|
+
private tryCreateCollection;
|
|
136
|
+
/**
|
|
137
|
+
* Generate ES mappings from twin models and theirs associated measures, all fetched from the database
|
|
138
|
+
*
|
|
139
|
+
* @param digitalTwinType The target twin type
|
|
140
|
+
* @param engineGroup The twin engine group
|
|
141
|
+
* @returns The complete ES mappings produces by merging all the target type twins
|
|
142
|
+
*/
|
|
143
|
+
private getDigitalTwinMappingsFromDB;
|
|
144
|
+
/**
|
|
145
|
+
* Generate ES mappings from twin models and theirs associated measures
|
|
146
|
+
*
|
|
147
|
+
* @param digitalTwinType The target twin type
|
|
148
|
+
* @param models The twin models
|
|
149
|
+
* @param measureModels The associated measures
|
|
150
|
+
* @returns The complete ES mappings produces by merging all the target type twins
|
|
151
|
+
*/
|
|
152
|
+
private getDigitalTwinMappings;
|
|
153
|
+
/**
|
|
154
|
+
* Generate ES mappings from measures and theirs associated assets, all fetched via the database
|
|
155
|
+
*
|
|
156
|
+
* @param engineGroup The target engine group
|
|
157
|
+
* @returns The complete ES mappings produced by merging models mappings
|
|
158
|
+
*/
|
|
159
|
+
private getMeasuresMappingsFromDB;
|
|
160
|
+
/**
|
|
161
|
+
* Generate ES mappings from measures and theirs associated assets
|
|
162
|
+
*
|
|
163
|
+
* @param models The measures models
|
|
164
|
+
* @param assetsMappings The assets complete mappings
|
|
165
|
+
* @returns The complete ES mappings produced by merging models mappings
|
|
166
|
+
*/
|
|
39
167
|
private getMeasuresMappings;
|
|
168
|
+
/**
|
|
169
|
+
* Retrieve a certain type of models associated to an engine
|
|
170
|
+
*
|
|
171
|
+
* @param engineId The target engine Id
|
|
172
|
+
* @param type The desired model type
|
|
173
|
+
* @param engineGroup The target engine group
|
|
174
|
+
* @returns An array of the generic type provided
|
|
175
|
+
*/
|
|
40
176
|
private getModels;
|
|
41
177
|
}
|
|
@@ -22,10 +22,14 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
22
22
|
* Register an asset model
|
|
23
23
|
*
|
|
24
24
|
* @param engineGroup Engine group name
|
|
25
|
-
* @param model Name of the asset model
|
|
26
|
-
* @param definition
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* @param model Name of the asset model. Must follow a naming convention in PascalCase.
|
|
26
|
+
* @param definition Object containing the asset model definition, including:
|
|
27
|
+
* - measures: Array describing measure names and their types.
|
|
28
|
+
* - metadataMappings: Definition of metadata mappings, specifying types for each metadata field.
|
|
29
|
+
* - defaultMetadata: Default values for metadata fields, applied when actual data is not provided.
|
|
30
|
+
* - metadataDetails: Optional detailed descriptions for each metadata, including localizations, group association and definition.
|
|
31
|
+
* - metadataGroups: Optional description of metadata groups, organizing metadata logically, with localizations for group names.
|
|
32
|
+
* - tooltipModels: Optional tooltip model list, containing each labels and tooltip content to display.
|
|
29
33
|
*
|
|
30
34
|
* @example
|
|
31
35
|
* ```
|
|
@@ -44,6 +48,74 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
44
48
|
* },
|
|
45
49
|
* defaultMetadata: {
|
|
46
50
|
* height: 20
|
|
51
|
+
* },
|
|
52
|
+
* metadataDetails: {
|
|
53
|
+
* "extTemp": {
|
|
54
|
+
* "group": "environment",
|
|
55
|
+
* "locales": {
|
|
56
|
+
* "en": {
|
|
57
|
+
* "friendlyName": "External Temperature",
|
|
58
|
+
* "description": "The temperature outside the container"
|
|
59
|
+
* },
|
|
60
|
+
* "fr": {
|
|
61
|
+
* "friendlyName": "Température Externe",
|
|
62
|
+
* "description": "La température à l'extérieur du conteneur"
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* }
|
|
66
|
+
* },
|
|
67
|
+
* metadataGroups: {
|
|
68
|
+
* "environment": {
|
|
69
|
+
* "locales": {
|
|
70
|
+
* "en": {
|
|
71
|
+
* "groupFriendlyName": "Environment"
|
|
72
|
+
* },
|
|
73
|
+
* "fr": {
|
|
74
|
+
* "groupFriendlyName": "Environnement"
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
* }
|
|
78
|
+
* },
|
|
79
|
+
* tooltipModels: {
|
|
80
|
+
* "defaultTooltipKey": {
|
|
81
|
+
* "tooltipLabel": "Default Tooltip Model",
|
|
82
|
+
* "content": [
|
|
83
|
+
* {
|
|
84
|
+
* "category": "metadata",
|
|
85
|
+
* "label": {
|
|
86
|
+
* "locales": {
|
|
87
|
+
* "en": {
|
|
88
|
+
* "friendlyName": "Container position",
|
|
89
|
+
* "description": ""
|
|
90
|
+
* },
|
|
91
|
+
* "fr": {
|
|
92
|
+
* "friendlyName": "Position du conteneur",
|
|
93
|
+
* "description": ""
|
|
94
|
+
* }
|
|
95
|
+
* }
|
|
96
|
+
* },
|
|
97
|
+
* "metadataPath": "geolocation"
|
|
98
|
+
* },
|
|
99
|
+
* {
|
|
100
|
+
* "category": "measure",
|
|
101
|
+
* "label": {
|
|
102
|
+
* "locales": {
|
|
103
|
+
* "en": {
|
|
104
|
+
* "friendlyName": "External temperature",
|
|
105
|
+
* "description": ""
|
|
106
|
+
* },
|
|
107
|
+
* "fr": {
|
|
108
|
+
* "friendlyName": "Température extérieure",
|
|
109
|
+
* "description": ""
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
* },
|
|
113
|
+
* "measureSlot": "externalTemperature",
|
|
114
|
+
* "measureValuePath": "externalTemperature",
|
|
115
|
+
* "suffix": "°C"
|
|
116
|
+
* }
|
|
117
|
+
* ]
|
|
118
|
+
* }
|
|
47
119
|
* }
|
|
48
120
|
* }
|
|
49
121
|
* );
|
|
@@ -51,12 +123,15 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
51
123
|
*/
|
|
52
124
|
registerAsset: (engineGroup: string, model: string, definition: AssetModelDefinition) => void;
|
|
53
125
|
/**
|
|
54
|
-
* Register a device
|
|
126
|
+
* Register a device.
|
|
55
127
|
*
|
|
56
128
|
* @param model Name of the device model
|
|
57
|
-
* @param definition
|
|
58
|
-
*
|
|
59
|
-
*
|
|
129
|
+
* @param definition Object containing the device model definition, including:
|
|
130
|
+
* - decoder: Decoder used to decode payloads
|
|
131
|
+
* - metadataMappings: Metadata mappings definition
|
|
132
|
+
* - defaultMetadata: Default metadata values
|
|
133
|
+
* - metadataDetails: Localizations, detailed metadata descriptions and definition
|
|
134
|
+
* - metadataGroups: Groups for organizing metadata, with localizations
|
|
60
135
|
*
|
|
61
136
|
* @example
|
|
62
137
|
* ```
|
|
@@ -66,6 +141,36 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
66
141
|
* decoder: new DummyTempPositionDecoder(),
|
|
67
142
|
* metadataMappings: {
|
|
68
143
|
* serial: { type: "keyword" },
|
|
144
|
+
* },
|
|
145
|
+
* defaultMetadata: {
|
|
146
|
+
* company: "Acme Inc"
|
|
147
|
+
* },
|
|
148
|
+
* metadataDetails: {
|
|
149
|
+
* sensorVersion: {
|
|
150
|
+
* group: "sensorSpecs",
|
|
151
|
+
* locales: {
|
|
152
|
+
* en: {
|
|
153
|
+
* friendlyName: "Sensor version",
|
|
154
|
+
* description: "Firmware version of the sensor"
|
|
155
|
+
* },
|
|
156
|
+
* fr: {
|
|
157
|
+
* friendlyName: "Version du capteur",
|
|
158
|
+
* description: "Version du micrologiciel du capteur"
|
|
159
|
+
* }
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
162
|
+
* },
|
|
163
|
+
* metadataGroups: {
|
|
164
|
+
* sensorSpecs: {
|
|
165
|
+
* locales: {
|
|
166
|
+
* en: {
|
|
167
|
+
* groupFriendlyName: "Sensors specifications"
|
|
168
|
+
* },
|
|
169
|
+
* fr: {
|
|
170
|
+
* groupFriendlyName: "Spécifications des capteurs"
|
|
171
|
+
* }
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
69
174
|
* }
|
|
70
175
|
* }
|
|
71
176
|
* );
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./types/
|
|
1
|
+
export * from "./types/exports";
|
|
2
2
|
export * from "./DeviceManagerPlugin";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONObject } from "kuzzle-sdk";
|
|
1
|
+
import { CollectionMappings, JSONObject } from "kuzzle-sdk";
|
|
2
2
|
export type DeviceManagerConfiguration = {
|
|
3
3
|
/**
|
|
4
4
|
* Ignore errors at startup such as wrong mappings update.
|
|
@@ -26,24 +26,46 @@ export type DeviceManagerConfiguration = {
|
|
|
26
26
|
config: {
|
|
27
27
|
name: string;
|
|
28
28
|
mappings: JSONObject;
|
|
29
|
-
settings
|
|
29
|
+
settings?: JSONObject;
|
|
30
30
|
};
|
|
31
31
|
devices: {
|
|
32
32
|
name: string;
|
|
33
33
|
mappings: JSONObject;
|
|
34
|
-
settings
|
|
34
|
+
settings?: JSONObject;
|
|
35
35
|
};
|
|
36
36
|
payloads: {
|
|
37
37
|
name: string;
|
|
38
38
|
mappings: JSONObject;
|
|
39
|
-
settings
|
|
39
|
+
settings?: JSONObject;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
engineCollections: {
|
|
43
43
|
config: {
|
|
44
44
|
name: string;
|
|
45
45
|
mappings: JSONObject;
|
|
46
|
-
settings
|
|
46
|
+
settings?: JSONObject;
|
|
47
|
+
};
|
|
48
|
+
asset: {
|
|
49
|
+
name: string;
|
|
50
|
+
mappings: CollectionMappings;
|
|
51
|
+
settings?: JSONObject;
|
|
52
|
+
};
|
|
53
|
+
assetGroups: {
|
|
54
|
+
name: string;
|
|
55
|
+
settings?: JSONObject;
|
|
56
|
+
};
|
|
57
|
+
assetHistory: {
|
|
58
|
+
name: string;
|
|
59
|
+
settings?: JSONObject;
|
|
60
|
+
};
|
|
61
|
+
device: {
|
|
62
|
+
name: string;
|
|
63
|
+
mappings: CollectionMappings;
|
|
64
|
+
settings?: JSONObject;
|
|
65
|
+
};
|
|
66
|
+
measures: {
|
|
67
|
+
name: string;
|
|
68
|
+
settings?: JSONObject;
|
|
47
69
|
};
|
|
48
70
|
};
|
|
49
71
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { JSONObject, KDocumentContent, KHit, KuzzleRequest } from "kuzzle";
|
|
2
|
+
export interface SearchQueryResult<T extends KDocumentContent> {
|
|
3
|
+
aggregations?: JSONObject;
|
|
4
|
+
hits: Array<KHit<T>>;
|
|
5
|
+
remaining: unknown;
|
|
6
|
+
scrollId: string;
|
|
7
|
+
suggest: JSONObject;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export type EventGenericDocumentBeforeSearch = {
|
|
11
|
+
name: `generic:document:beforeSearch`;
|
|
12
|
+
args: [JSONObject, KuzzleRequest];
|
|
13
|
+
};
|
|
14
|
+
export type EventGenericDocumentAfterSearch<T extends KDocumentContent = KDocumentContent> = {
|
|
15
|
+
name: `generic:document:afterSearch`;
|
|
16
|
+
args: [SearchQueryResult<T>, KuzzleRequest];
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DeviceManagerConfiguration";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
export * from "./services";
|
|
2
1
|
export * from "./Module";
|
|
2
|
+
export * from "./services";
|
|
3
|
+
export * from "./types/DigitalTwinApi";
|
|
3
4
|
export * from "./types/DigitalTwinContent";
|
|
4
|
-
export * from "./types/
|
|
5
|
+
export * from "./types/DigitalTwinEvents";
|
|
6
|
+
export * from "./types/DigitalTwinMeasures";
|
|
5
7
|
export * from "./types/EmbeddedMeasure";
|
|
6
8
|
export * from "./types/KuzzleRole";
|
|
7
|
-
export * from "./
|
|
9
|
+
export * from "./types/Metadata";
|
|
8
10
|
export * from "./utils/flattenObject";
|
|
9
|
-
export * from "./utils/ask";
|
|
10
11
|
export * from "./utils/keepStack";
|
|
12
|
+
export * from "./utils/lock";
|
|
11
13
|
export * from "./utils/objectDiff";
|