kuzzle-device-manager-types 2.4.0-beta.9 → 2.4.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/lib/modules/asset/AssetService.d.ts +18 -4
  2. package/dist/lib/modules/asset/AssetsController.d.ts +7 -1
  3. package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +4 -0
  4. package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsConfiguration.d.ts +8 -0
  5. package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsCreation.d.ts +8 -0
  6. package/dist/lib/modules/asset/roles/specificRoles/index.d.ts +2 -0
  7. package/dist/lib/modules/asset/types/AssetApi.d.ts +31 -2
  8. package/dist/lib/modules/decoder/Decoder.d.ts +11 -0
  9. package/dist/lib/modules/decoder/PayloadService.d.ts +1 -1
  10. package/dist/lib/modules/decoder/types/DecoderContent.d.ts +1 -0
  11. package/dist/lib/modules/device/DeviceService.d.ts +13 -5
  12. package/dist/lib/modules/device/DevicesController.d.ts +7 -1
  13. package/dist/lib/modules/device/roles/RoleDevicesReader.d.ts +4 -0
  14. package/dist/lib/modules/device/roles/specificRoles/RoleDevicesAssetAssociation.d.ts +8 -0
  15. package/dist/lib/modules/device/roles/specificRoles/RoleDevicesConfiguration.d.ts +8 -0
  16. package/dist/lib/modules/device/roles/specificRoles/RoleDevicesCreation.d.ts +8 -0
  17. package/dist/lib/modules/device/roles/specificRoles/index.d.ts +3 -0
  18. package/dist/lib/modules/device/types/DeviceApi.d.ts +23 -2
  19. package/dist/lib/modules/measure/MeasureExporter.d.ts +5 -4
  20. package/dist/lib/modules/measure/collections/measuresMappings.d.ts +3 -0
  21. package/dist/lib/modules/measure/types/MeasureContent.d.ts +4 -0
  22. package/dist/lib/modules/measure/types/MeasureDefinition.d.ts +28 -3
  23. package/dist/lib/modules/model/MappingsConflictsError.d.ts +7 -0
  24. package/dist/lib/modules/model/ModelService.d.ts +16 -6
  25. package/dist/lib/modules/model/ModelsConflicts.d.ts +30 -0
  26. package/dist/lib/modules/model/ModelsController.d.ts +5 -1
  27. package/dist/lib/modules/model/ModelsRegister.d.ts +28 -3
  28. package/dist/lib/modules/model/types/ModelApi.d.ts +50 -4
  29. package/dist/lib/modules/model/types/ModelContent.d.ts +263 -2
  30. package/dist/lib/modules/model/types/ModelDefinition.d.ts +141 -5
  31. package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +141 -5
  32. package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +113 -8
  33. package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +18 -4
  34. package/dist/lib/modules/shared/exports.d.ts +2 -0
  35. package/dist/lib/modules/shared/index.d.ts +6 -4
  36. package/dist/lib/modules/shared/services/AbstractExporter.d.ts +1 -2
  37. package/dist/lib/modules/shared/services/DigitalTwinExporter.d.ts +0 -2
  38. package/dist/lib/modules/shared/services/DigitalTwinService.d.ts +21 -0
  39. package/dist/lib/modules/shared/services/index.d.ts +1 -0
  40. package/dist/lib/modules/shared/types/DigitalTwinApi.d.ts +34 -0
  41. package/dist/lib/modules/shared/types/DigitalTwinContent.d.ts +2 -4
  42. package/dist/lib/modules/shared/types/DigitalTwinEvents.d.ts +9 -0
  43. package/dist/lib/modules/shared/types/DigitalTwinMeasures.d.ts +5 -0
  44. package/dist/tests/application/assets/Container.d.ts +3 -0
  45. package/dist/tests/application/assets/Room.d.ts +2 -0
  46. package/dist/tests/application/assets/StreetLamp.d.ts +2 -0
  47. package/dist/tests/application/decoders/DummyTempPositionDecoder.d.ts +1 -0
  48. package/dist/tests/application/measures/BrightnessMeasure.d.ts +2 -0
  49. package/dist/tests/application/measures/CO2Measure.d.ts +2 -0
  50. package/dist/tests/application/measures/IlluminanceMeasure.d.ts +2 -0
  51. package/dist/tests/application/measures/PowerConsumptionMeasure.d.ts +2 -0
  52. package/package.json +4 -3
  53. package/dist/lib/modules/shared/utils/ask.d.ts +0 -8
@@ -1,9 +1,20 @@
1
- import { Backend, Plugin } from "kuzzle";
2
- import { AbstractEngine, ConfigManager } from "kuzzle-plugin-commons";
3
- import { EngineContent } from "kuzzle-plugin-commons";
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
- private getDigitalTwinMappings;
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.measures Array describing measures names and types
27
- * @param definition.metadataMappings Metadata mappings definition
28
- * @param definition.defaultMetadata Default metadata values
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 model
126
+ * Register a device.
55
127
  *
56
128
  * @param model Name of the device model
57
- * @param definition.decoded Decoder used to decode payloads
58
- * @param definition.metadataMappings Metadata mappings definition
59
- * @param definition.defaultMetadata Default metadata values
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
  * );
@@ -26,32 +26,46 @@ export type DeviceManagerConfiguration = {
26
26
  config: {
27
27
  name: string;
28
28
  mappings: JSONObject;
29
- settings: JSONObject;
29
+ settings?: JSONObject;
30
30
  };
31
31
  devices: {
32
32
  name: string;
33
33
  mappings: JSONObject;
34
- settings: JSONObject;
34
+ settings?: JSONObject;
35
35
  };
36
36
  payloads: {
37
37
  name: string;
38
38
  mappings: JSONObject;
39
- settings: JSONObject;
39
+ settings?: JSONObject;
40
40
  };
41
41
  };
42
42
  engineCollections: {
43
43
  config: {
44
44
  name: string;
45
45
  mappings: JSONObject;
46
- settings: JSONObject;
46
+ settings?: JSONObject;
47
47
  };
48
48
  asset: {
49
49
  name: string;
50
50
  mappings: CollectionMappings;
51
+ settings?: JSONObject;
52
+ };
53
+ assetGroups: {
54
+ name: string;
55
+ settings?: JSONObject;
56
+ };
57
+ assetHistory: {
58
+ name: string;
59
+ settings?: JSONObject;
51
60
  };
52
61
  device: {
53
62
  name: string;
54
63
  mappings: CollectionMappings;
64
+ settings?: JSONObject;
65
+ };
66
+ measures: {
67
+ name: string;
68
+ settings?: JSONObject;
55
69
  };
56
70
  };
57
71
  };
@@ -1,3 +1,5 @@
1
1
  export * from "./types/DigitalTwinContent";
2
+ export * from "./types/DigitalTwinEvents";
3
+ export * from "./types/DigitalTwinMeasures";
2
4
  export * from "./types/Metadata";
3
5
  export * from "./types/EmbeddedMeasure";
@@ -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/Metadata";
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 "./utils/lock";
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";
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { UUID } from "node:crypto";
4
2
  import { PassThrough, Readable } from "node:stream";
5
3
  import { JSONObject, KDocumentContentGeneric, KHit, SearchResult, User } from "kuzzle";
@@ -20,6 +18,7 @@ export interface Column {
20
18
  header: string;
21
19
  path: string;
22
20
  isMeasure?: boolean;
21
+ isIsoDate?: boolean;
23
22
  }
24
23
  export declare abstract class AbstractExporter<P extends ExportParams = ExportParams> {
25
24
  protected plugin: DeviceManagerPlugin;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { UUID } from "node:crypto";
4
2
  import { AbstractExporter } from "./AbstractExporter";
5
3
  export declare class DigitalTwinExporter extends AbstractExporter {
@@ -0,0 +1,21 @@
1
+ import { MeasureContent } from "../../measure";
2
+ import { DeviceManagerPlugin, InternalCollection } from "../../plugin";
3
+ import { ApiDigitalTwinMGetLastMeasuredAtResult } from "../types/DigitalTwinApi";
4
+ import { BaseService } from "./BaseService";
5
+ export declare class DigitalTwinService extends BaseService {
6
+ private targetCollection;
7
+ private readonly digitalTwinType;
8
+ constructor(plugin: DeviceManagerPlugin, targetCollection: InternalCollection);
9
+ protected registerAskEvents(): void;
10
+ /**
11
+ * Gets the last measures of a digital twin
12
+ */
13
+ getLastMeasures(engineId: string, digitalTwinId: string, measureCount?: number): Promise<MeasureContent[]>;
14
+ /**
15
+ * Gets the last measures of multiple digital twins
16
+ */
17
+ mGetLastMeasures(engineId: string, digitalTwinIds: string[], measureCount?: number): Promise<Record<string, MeasureContent[]>>;
18
+ getLastMeasuredAt(engineId: string, digitalTwinId: string): Promise<number>;
19
+ mGetLastMeasuredAt(engineId: string, digitalTwinIds: string[]): Promise<ApiDigitalTwinMGetLastMeasuredAtResult>;
20
+ private getAggregationQueryParameters;
21
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./AbstractExporter";
2
2
  export * from "./BaseService";
3
3
  export * from "./DigitalTwinExporter";
4
+ export * from "./DigitalTwinService";
@@ -0,0 +1,34 @@
1
+ import { DigitalTwinMeasures } from "./DigitalTwinMeasures";
2
+ interface DigitalTwinControllerRequest<ControllerName extends string> {
3
+ controller: ControllerName;
4
+ engineId: string;
5
+ }
6
+ export interface ApiDigitalTwinGetLastMeasuresRequest<ControllerName extends string> extends DigitalTwinControllerRequest<ControllerName> {
7
+ action: "getLastMeasures";
8
+ _id: string;
9
+ measureCount?: number;
10
+ }
11
+ export type ApiDigitalTwinGetLastMeasuresResult = DigitalTwinMeasures;
12
+ export interface ApiDigitalTwinMGetLastMeasuresRequest<ControllerName extends string> extends DigitalTwinControllerRequest<ControllerName> {
13
+ action: "mGetLastMeasures";
14
+ measureCount?: number;
15
+ body: {
16
+ ids: string[];
17
+ };
18
+ }
19
+ export type ApiDigitalTwinMGetLastMeasuresResult = Record<string, DigitalTwinMeasures>;
20
+ export interface ApiDigitalTwinGetLastMeasuredAtRequest<ControllerName extends string> extends DigitalTwinControllerRequest<ControllerName> {
21
+ action: "getLastMeasuredAt";
22
+ _id: string;
23
+ }
24
+ export type ApiDigitalTwinGetLastMeasuredAtResult = {
25
+ lastMeasuredAt: number;
26
+ };
27
+ export interface ApiDigitalTwinMGetLastMeasuredAtRequest<ControllerName extends string> extends DigitalTwinControllerRequest<ControllerName> {
28
+ action: "mGetLastMeasuredAt";
29
+ body: {
30
+ ids: string[];
31
+ };
32
+ }
33
+ export type ApiDigitalTwinMGetLastMeasuredAtResult = Record<string, number>;
34
+ export {};
@@ -1,12 +1,10 @@
1
1
  import { JSONObject, KDocumentContent } from "kuzzle-sdk";
2
- import { EmbeddedMeasure } from "./EmbeddedMeasure";
3
2
  import { Metadata } from "./Metadata";
3
+ import { DigitalTwinMeasures } from "./DigitalTwinMeasures";
4
4
  export interface DigitalTwinContent<TMeasures extends JSONObject = JSONObject, TMetadata extends Metadata = Metadata> extends KDocumentContent {
5
5
  model: string;
6
6
  reference: string;
7
7
  metadata: TMetadata;
8
- measures: {
9
- [Property in keyof TMeasures]: EmbeddedMeasure<TMeasures[Property]> | null;
10
- };
8
+ measures: DigitalTwinMeasures<TMeasures>;
11
9
  lastMeasuredAt: number;
12
10
  }
@@ -0,0 +1,9 @@
1
+ import { MeasureContent } from "../../measure";
2
+ export type AskDigitalTwinLastMeasuresGet = {
3
+ name: "ask:device-manager:asset:get-last-measures" | "ask:device-manager:device:get-last-measures";
4
+ payload: {
5
+ engineId: string;
6
+ digitalTwinId: string;
7
+ };
8
+ result: MeasureContent[];
9
+ };
@@ -0,0 +1,5 @@
1
+ import { JSONObject } from "kuzzle-sdk";
2
+ import { EmbeddedMeasure } from "./EmbeddedMeasure";
3
+ export type DigitalTwinMeasures<TMeasures extends JSONObject = JSONObject> = {
4
+ [Property in keyof TMeasures]: EmbeddedMeasure<TMeasures[Property]> | null;
5
+ };
@@ -6,6 +6,9 @@ export interface ContainerMetadata extends Metadata {
6
6
  weight: number;
7
7
  capacity: number;
8
8
  };
9
+ person: {
10
+ company: string;
11
+ };
9
12
  }
10
13
  export type ContainerMeasurements = {
11
14
  temperatureExt: TemperatureMeasurement;
@@ -0,0 +1,2 @@
1
+ import { AssetModelDefinition } from "../../../index";
2
+ export declare const roomAssetDefinition: AssetModelDefinition;
@@ -0,0 +1,2 @@
1
+ import { AssetModelDefinition } from "../../../index";
2
+ export declare const streetLampAssetDefinition: AssetModelDefinition;
@@ -11,6 +11,7 @@ export declare class DummyTempPositionDecoder extends Decoder {
11
11
  readonly name: "position";
12
12
  readonly type: "position";
13
13
  }];
14
+ constructor();
14
15
  validate(payload: JSONObject): Promise<boolean>;
15
16
  decode(decodedPayload: DecodedPayload<DummyTempPositionDecoder>, payload: JSONObject): Promise<DecodedPayload<DummyTempPositionDecoder>>;
16
17
  }
@@ -0,0 +1,2 @@
1
+ import { MeasureDefinition } from "lib/modules/measure";
2
+ export declare const brightnessMeasureDefinition: MeasureDefinition;
@@ -0,0 +1,2 @@
1
+ import { MeasureDefinition } from "lib/modules/measure";
2
+ export declare const co2MeasureDefinition: MeasureDefinition;
@@ -0,0 +1,2 @@
1
+ import { MeasureDefinition } from "lib/modules/measure";
2
+ export declare const illuminanceMeasureDefinition: MeasureDefinition;
@@ -0,0 +1,2 @@
1
+ import { MeasureDefinition } from "lib/modules/measure";
2
+ export declare const powerConsumptionMeasureDefinition: MeasureDefinition;
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "kuzzle-device-manager-types",
3
- "version": "2.4.0-beta.9",
3
+ "version": "2.4.0-dev.1",
4
4
  "description": "Shared types for Kuzzle Device Manager",
5
5
  "author": "The Kuzzle Team (support@kuzzle.io)",
6
6
  "main": "index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/kuzzleio/kuzzle-plugin-device-manager.git"
10
+ "url": "git+https://github.com/kuzzleio/kuzzle-plugin-device-manager.git",
11
+ "directory": "types"
11
12
  },
12
13
  "scripts": {
13
14
  "prepack": "npm run build",
14
- "build": "./copy-types.sh && node scripts/copy-version.js"
15
+ "build": "./copy-types.sh"
15
16
  },
16
17
  "license": "Apache-2.0",
17
18
  "files": [
@@ -1,8 +0,0 @@
1
- export type AskEventDefinition = {
2
- name: string;
3
- payload: any;
4
- result: any;
5
- };
6
- export type AskEventHandler<TAskEventDefinition extends AskEventDefinition = AskEventDefinition> = (payload?: TAskEventDefinition["payload"]) => Promise<TAskEventDefinition["result"]>;
7
- export declare function onAsk<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], handler: AskEventHandler<TAskEventDefinition>): any;
8
- export declare function ask<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], payload?: TAskEventDefinition["payload"]): Promise<TAskEventDefinition["result"]>;