kuzzle-device-manager 0.4.13 → 2.0.0-rc3
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/index.d.ts +1 -0
- package/index.js +6 -1
- package/lib/DeviceManagerPlugin.d.ts +33 -65
- package/lib/DeviceManagerPlugin.js +142 -131
- package/lib/controllers/AssetController.d.ts +20 -5
- package/lib/controllers/AssetController.js +78 -23
- package/lib/controllers/DecodersController.d.ts +16 -0
- package/lib/controllers/DecodersController.js +27 -0
- package/lib/controllers/DeviceController.d.ts +25 -22
- package/lib/controllers/DeviceController.js +150 -109
- package/lib/controllers/index.d.ts +1 -1
- package/lib/controllers/index.js +6 -2
- package/lib/core-classes/AssetService.d.ts +31 -0
- package/lib/core-classes/AssetService.js +82 -0
- package/lib/core-classes/Decoder.d.ts +14 -59
- package/lib/core-classes/Decoder.js +16 -86
- package/lib/core-classes/DeviceManagerEngine.d.ts +11 -9
- package/lib/core-classes/DeviceManagerEngine.js +20 -32
- package/lib/core-classes/DeviceService.d.ts +81 -24
- package/lib/core-classes/DeviceService.js +178 -220
- package/lib/core-classes/PayloadService.d.ts +39 -26
- package/lib/core-classes/PayloadService.js +132 -124
- package/lib/core-classes/index.d.ts +5 -4
- package/lib/core-classes/index.js +10 -5
- package/lib/core-classes/{CustomMappings/AssetMappingsManager.d.ts → registers/AssetsRegister.d.ts} +8 -9
- package/lib/core-classes/{CustomMappings/AssetMappingsManager.js → registers/AssetsRegister.js} +17 -28
- package/lib/core-classes/registers/DecodersRegister.d.ts +46 -0
- package/lib/core-classes/registers/DecodersRegister.js +167 -0
- package/lib/core-classes/registers/DevicesRegister.d.ts +20 -0
- package/lib/core-classes/registers/DevicesRegister.js +37 -0
- package/lib/core-classes/registers/MeasuresRegister.d.ts +29 -0
- package/lib/core-classes/registers/MeasuresRegister.js +53 -0
- package/lib/mappings/assetsMappings.d.ts +36 -0
- package/lib/mappings/assetsMappings.js +36 -0
- package/lib/mappings/deviceMappings.d.ts +44 -0
- package/lib/mappings/deviceMappings.js +42 -0
- package/lib/mappings/index.d.ts +4 -0
- package/lib/mappings/index.js +21 -0
- package/lib/mappings/measuresMappings.d.ts +53 -0
- package/lib/mappings/measuresMappings.js +48 -0
- package/lib/mappings/payloadsMappings.d.ts +18 -0
- package/lib/mappings/payloadsMappings.js +16 -0
- package/lib/measures/BatteryMeasure.d.ts +7 -0
- package/lib/measures/BatteryMeasure.js +12 -0
- package/lib/measures/HumidityMeasure.d.ts +7 -0
- package/lib/measures/HumidityMeasure.js +12 -0
- package/lib/measures/MovementMeasure.d.ts +7 -0
- package/lib/measures/MovementMeasure.js +12 -0
- package/lib/measures/PositionMeasure.d.ts +12 -0
- package/lib/measures/PositionMeasure.js +16 -0
- package/lib/measures/TemperatureMeasure.d.ts +7 -0
- package/lib/measures/TemperatureMeasure.js +12 -0
- package/lib/measures/index.d.ts +5 -0
- package/lib/measures/index.js +22 -0
- package/lib/models/BaseAsset.d.ts +1 -48
- package/lib/models/BaseAsset.js +5 -43
- package/lib/models/Config.d.ts +1 -13
- package/lib/models/Device.d.ts +5 -96
- package/lib/models/Device.js +5 -73
- package/lib/models/index.d.ts +0 -1
- package/lib/models/index.js +5 -2
- package/lib/types/BaseAssetContent.d.ts +8 -3
- package/lib/types/DecodedPayload.d.ts +42 -0
- package/lib/types/{AssetsHistoryContent.js → DecodedPayload.js} +1 -1
- package/lib/types/DecoderContent.d.ts +4 -0
- package/lib/types/DecoderContent.js +3 -0
- package/lib/types/DeviceContent.d.ts +12 -44
- package/lib/types/DeviceManagerConfiguration.d.ts +40 -0
- package/lib/types/DeviceManagerConfiguration.js +3 -0
- package/lib/types/index.d.ts +7 -2
- package/lib/types/index.js +12 -3
- package/lib/types/measures/MeasureContent.d.ts +56 -0
- package/lib/types/measures/MeasureContent.js +3 -0
- package/lib/types/measures/MeasureDefinition.d.ts +40 -0
- package/lib/types/measures/MeasureDefinition.js +3 -0
- package/lib/types/measures/Measurement.d.ts +19 -0
- package/lib/types/{Measure.js → measures/Measurement.js} +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +6 -2
- package/lib/utils/writeMany.d.ts +13 -0
- package/lib/utils/writeMany.js +37 -0
- package/package.json +14 -18
- package/lib/controllers/CRUDController.d.ts +0 -34
- package/lib/controllers/CRUDController.js +0 -65
- package/lib/core-classes/BatchProcessing/BatchController.d.ts +0 -34
- package/lib/core-classes/BatchProcessing/BatchController.js +0 -115
- package/lib/core-classes/BatchProcessing/BatchWriter.d.ts +0 -110
- package/lib/core-classes/BatchProcessing/BatchWriter.js +0 -264
- package/lib/core-classes/BatchProcessing/InstrumentablePromise.d.ts +0 -6
- package/lib/core-classes/BatchProcessing/InstrumentablePromise.js +0 -13
- package/lib/core-classes/BatchProcessing/index.d.ts +0 -3
- package/lib/core-classes/BatchProcessing/index.js +0 -16
- package/lib/core-classes/CustomMappings/DeviceMappingsManager.d.ts +0 -43
- package/lib/core-classes/CustomMappings/DeviceMappingsManager.js +0 -71
- package/lib/core-classes/MigrationService.d.ts +0 -13
- package/lib/core-classes/MigrationService.js +0 -49
- package/lib/models/Catalog.d.ts +0 -55
- package/lib/models/Catalog.js +0 -38
- package/lib/types/AssetsHistoryContent.d.ts +0 -9
- package/lib/types/Measure.d.ts +0 -54
- package/lib/utils/events.d.ts +0 -8
- package/lib/utils/events.js +0 -17
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.movementMeasure = void 0;
|
|
4
|
+
exports.movementMeasure = {
|
|
5
|
+
valuesMappings: { movement: { type: 'boolean' } },
|
|
6
|
+
unit: {
|
|
7
|
+
name: 'Moving',
|
|
8
|
+
sign: null,
|
|
9
|
+
type: 'boolean',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=MovementMeasure.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Measurement, MeasureDefinition } from '../types';
|
|
2
|
+
export interface PositionMeasurement extends Measurement {
|
|
3
|
+
values: {
|
|
4
|
+
position: {
|
|
5
|
+
lat: number;
|
|
6
|
+
lon: number;
|
|
7
|
+
};
|
|
8
|
+
altitude?: number;
|
|
9
|
+
accuracy?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const positionMeasure: MeasureDefinition;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.positionMeasure = void 0;
|
|
4
|
+
exports.positionMeasure = {
|
|
5
|
+
valuesMappings: {
|
|
6
|
+
accuracy: { type: 'float' },
|
|
7
|
+
altitude: { type: 'float' },
|
|
8
|
+
position: { type: 'geo_point' },
|
|
9
|
+
},
|
|
10
|
+
unit: {
|
|
11
|
+
name: 'GPS',
|
|
12
|
+
sign: null,
|
|
13
|
+
type: 'geo_point',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=PositionMeasure.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.temperatureMeasure = void 0;
|
|
4
|
+
exports.temperatureMeasure = {
|
|
5
|
+
valuesMappings: { temperature: { type: 'float' } },
|
|
6
|
+
unit: {
|
|
7
|
+
name: 'Degree',
|
|
8
|
+
sign: '°',
|
|
9
|
+
type: 'number',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=TemperatureMeasure.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./MovementMeasure"), exports);
|
|
18
|
+
__exportStar(require("./PositionMeasure"), exports);
|
|
19
|
+
__exportStar(require("./TemperatureMeasure"), exports);
|
|
20
|
+
__exportStar(require("./HumidityMeasure"), exports);
|
|
21
|
+
__exportStar(require("./BatteryMeasure"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,56 +1,9 @@
|
|
|
1
1
|
import { JSONObject } from 'kuzzle';
|
|
2
2
|
import { BaseAssetContent } from '../types';
|
|
3
3
|
export declare class BaseAsset {
|
|
4
|
+
static id(type: string, model: string, reference: string): string;
|
|
4
5
|
_id: string;
|
|
5
6
|
_source: BaseAssetContent;
|
|
6
7
|
constructor(content: BaseAssetContent, _id?: string);
|
|
7
8
|
serialize(): JSONObject;
|
|
8
9
|
}
|
|
9
|
-
export declare const assetsMappings: {
|
|
10
|
-
dynamic: string;
|
|
11
|
-
properties: {
|
|
12
|
-
type: {
|
|
13
|
-
type: string;
|
|
14
|
-
fields: {
|
|
15
|
-
text: {
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
model: {
|
|
21
|
-
type: string;
|
|
22
|
-
fields: {
|
|
23
|
-
text: {
|
|
24
|
-
type: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
reference: {
|
|
29
|
-
type: string;
|
|
30
|
-
fields: {
|
|
31
|
-
text: {
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
measures: {
|
|
37
|
-
properties: {};
|
|
38
|
-
};
|
|
39
|
-
metadata: {
|
|
40
|
-
dynamic: string;
|
|
41
|
-
properties: {};
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare const assetsHistoryMappings: {
|
|
46
|
-
dynamic: string;
|
|
47
|
-
properties: {
|
|
48
|
-
assetId: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
measureTypes: {
|
|
52
|
-
type: string;
|
|
53
|
-
};
|
|
54
|
-
asset: any;
|
|
55
|
-
};
|
|
56
|
-
};
|
package/lib/models/BaseAsset.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BaseAsset = void 0;
|
|
4
4
|
class BaseAsset {
|
|
5
5
|
constructor(content, _id) {
|
|
6
|
-
this._id = _id ||
|
|
6
|
+
this._id = _id || BaseAsset.id(content.type, content.model, content.reference);
|
|
7
7
|
this._source = content;
|
|
8
8
|
}
|
|
9
|
+
static id(type, model, reference) {
|
|
10
|
+
return `${type}-${model}-${reference}`;
|
|
11
|
+
}
|
|
9
12
|
serialize() {
|
|
10
13
|
return {
|
|
11
14
|
_id: this._id,
|
|
@@ -14,45 +17,4 @@ class BaseAsset {
|
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
exports.BaseAsset = BaseAsset;
|
|
17
|
-
exports.assetsMappings = {
|
|
18
|
-
dynamic: 'strict',
|
|
19
|
-
properties: {
|
|
20
|
-
type: {
|
|
21
|
-
type: 'keyword',
|
|
22
|
-
fields: {
|
|
23
|
-
text: { type: 'text' }
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
model: {
|
|
27
|
-
type: 'keyword',
|
|
28
|
-
fields: {
|
|
29
|
-
text: { type: 'text' }
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
reference: {
|
|
33
|
-
type: 'keyword',
|
|
34
|
-
fields: {
|
|
35
|
-
text: { type: 'text' }
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
measures: {
|
|
39
|
-
properties: {
|
|
40
|
-
// autogenerated from devices mappings
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
metadata: {
|
|
44
|
-
dynamic: 'false',
|
|
45
|
-
properties: {}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.assetsHistoryMappings = {
|
|
50
|
-
dynamic: 'strict',
|
|
51
|
-
properties: {
|
|
52
|
-
assetId: { type: 'keyword' },
|
|
53
|
-
measureTypes: { type: 'keyword' },
|
|
54
|
-
// Will be replaced by the custom asset mappings
|
|
55
|
-
asset: null,
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
20
|
//# sourceMappingURL=BaseAsset.js.map
|
package/lib/models/Config.d.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { JSONObject } from 'kuzzle';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents either a Rule or Workflow raw configuration document
|
|
5
|
-
*/
|
|
6
|
-
export declare type ConfigContent = ConfigCatalogContent | JSONObject;
|
|
7
|
-
/**
|
|
8
|
-
* Content of a configuration document for a catalog entry
|
|
9
|
-
*/
|
|
10
|
-
export declare type ConfigCatalogContent = {
|
|
11
|
-
type: 'catalog';
|
|
12
|
-
catalog: CatalogContent;
|
|
13
|
-
_kuzzle_info?: JSONObject;
|
|
14
|
-
};
|
|
2
|
+
export declare type ConfigContent = JSONObject;
|
|
15
3
|
/**
|
|
16
4
|
* Class to manipulate configuration documents
|
|
17
5
|
*/
|
package/lib/models/Device.d.ts
CHANGED
|
@@ -1,102 +1,11 @@
|
|
|
1
|
-
import { JSONObject } from 'kuzzle';
|
|
2
1
|
import { DeviceContent } from '../types';
|
|
3
2
|
export declare class Device {
|
|
3
|
+
static id(model: string, reference: string): string;
|
|
4
4
|
_id: string;
|
|
5
5
|
_source: DeviceContent;
|
|
6
6
|
constructor(content: DeviceContent, _id?: string);
|
|
7
|
-
serialize():
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
dynamic: string;
|
|
11
|
-
properties: {
|
|
12
|
-
reference: {
|
|
13
|
-
type: string;
|
|
14
|
-
fields: {
|
|
15
|
-
text: {
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
model: {
|
|
21
|
-
type: string;
|
|
22
|
-
fields: {
|
|
23
|
-
text: {
|
|
24
|
-
type: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
measures: {
|
|
29
|
-
properties: {
|
|
30
|
-
temperature: {
|
|
31
|
-
properties: {
|
|
32
|
-
updatedAt: {
|
|
33
|
-
type: string;
|
|
34
|
-
};
|
|
35
|
-
payloadUuid: {
|
|
36
|
-
type: string;
|
|
37
|
-
};
|
|
38
|
-
degree: {
|
|
39
|
-
type: string;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
position: {
|
|
44
|
-
properties: {
|
|
45
|
-
updatedAt: {
|
|
46
|
-
type: string;
|
|
47
|
-
};
|
|
48
|
-
payloadUuid: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
point: {
|
|
52
|
-
type: string;
|
|
53
|
-
};
|
|
54
|
-
altitude: {
|
|
55
|
-
type: string;
|
|
56
|
-
};
|
|
57
|
-
accuracy: {
|
|
58
|
-
type: string;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
movement: {
|
|
63
|
-
properties: {
|
|
64
|
-
updatedAt: {
|
|
65
|
-
type: string;
|
|
66
|
-
};
|
|
67
|
-
payloadUuid: {
|
|
68
|
-
type: string;
|
|
69
|
-
};
|
|
70
|
-
moving: {
|
|
71
|
-
type: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
qos: {
|
|
78
|
-
dynamic: string;
|
|
79
|
-
properties: {};
|
|
80
|
-
};
|
|
81
|
-
metadata: {
|
|
82
|
-
dynamic: string;
|
|
83
|
-
properties: {};
|
|
84
|
-
};
|
|
85
|
-
assetId: {
|
|
86
|
-
type: string;
|
|
87
|
-
fields: {
|
|
88
|
-
text: {
|
|
89
|
-
type: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
tenantId: {
|
|
94
|
-
type: string;
|
|
95
|
-
fields: {
|
|
96
|
-
text: {
|
|
97
|
-
type: string;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
};
|
|
7
|
+
serialize(): {
|
|
8
|
+
_id: string;
|
|
9
|
+
_source: DeviceContent;
|
|
101
10
|
};
|
|
102
|
-
}
|
|
11
|
+
}
|
package/lib/models/Device.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Device = void 0;
|
|
4
4
|
class Device {
|
|
5
5
|
constructor(content, _id) {
|
|
6
|
-
this._id = _id ||
|
|
6
|
+
this._id = _id || Device.id(content.model, content.reference);
|
|
7
7
|
this._source = {
|
|
8
|
-
qos: {},
|
|
9
8
|
metadata: {},
|
|
10
9
|
...content
|
|
11
10
|
};
|
|
12
11
|
}
|
|
12
|
+
static id(model, reference) {
|
|
13
|
+
return `${model}-${reference}`;
|
|
14
|
+
}
|
|
13
15
|
serialize() {
|
|
14
16
|
return {
|
|
15
17
|
_id: this._id,
|
|
@@ -18,74 +20,4 @@ class Device {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
exports.Device = Device;
|
|
21
|
-
exports.devicesMappings = {
|
|
22
|
-
dynamic: 'strict',
|
|
23
|
-
properties: {
|
|
24
|
-
reference: {
|
|
25
|
-
type: 'keyword',
|
|
26
|
-
fields: {
|
|
27
|
-
text: { type: 'text' }
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
model: {
|
|
31
|
-
type: 'keyword',
|
|
32
|
-
fields: {
|
|
33
|
-
text: { type: 'text' }
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
measures: {
|
|
37
|
-
properties: {
|
|
38
|
-
temperature: {
|
|
39
|
-
properties: {
|
|
40
|
-
// common
|
|
41
|
-
updatedAt: { type: 'date' },
|
|
42
|
-
payloadUuid: { type: 'keyword' },
|
|
43
|
-
// temperature
|
|
44
|
-
degree: { type: 'float' }
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
position: {
|
|
48
|
-
properties: {
|
|
49
|
-
// common
|
|
50
|
-
updatedAt: { type: 'date' },
|
|
51
|
-
payloadUuid: { type: 'keyword' },
|
|
52
|
-
// position
|
|
53
|
-
point: { type: 'geo_point' },
|
|
54
|
-
altitude: { type: 'float' },
|
|
55
|
-
accuracy: { type: 'integer' },
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
movement: {
|
|
59
|
-
properties: {
|
|
60
|
-
// common
|
|
61
|
-
updatedAt: { type: 'date' },
|
|
62
|
-
payloadUuid: { type: 'keyword' },
|
|
63
|
-
// movement state
|
|
64
|
-
moving: { type: 'boolean' },
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
qos: {
|
|
70
|
-
dynamic: 'false',
|
|
71
|
-
properties: {},
|
|
72
|
-
},
|
|
73
|
-
metadata: {
|
|
74
|
-
dynamic: 'false',
|
|
75
|
-
properties: {},
|
|
76
|
-
},
|
|
77
|
-
assetId: {
|
|
78
|
-
type: 'keyword',
|
|
79
|
-
fields: {
|
|
80
|
-
text: { type: 'text' }
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
tenantId: {
|
|
84
|
-
type: 'keyword',
|
|
85
|
-
fields: {
|
|
86
|
-
text: { type: 'text' }
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
23
|
//# sourceMappingURL=Device.js.map
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -12,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
__exportStar(require("./Device"), exports);
|
|
14
18
|
__exportStar(require("./BaseAsset"), exports);
|
|
15
|
-
__exportStar(require("./Catalog"), exports);
|
|
16
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { JSONObject } from
|
|
2
|
-
|
|
1
|
+
import { JSONObject } from 'kuzzle';
|
|
2
|
+
import { KDocumentContent } from 'kuzzle-sdk';
|
|
3
|
+
import { MeasureContent } from './measures/MeasureContent';
|
|
4
|
+
/**
|
|
5
|
+
* Asset document
|
|
6
|
+
*/
|
|
7
|
+
export interface BaseAssetContent extends KDocumentContent {
|
|
3
8
|
type: string;
|
|
4
9
|
model: string;
|
|
5
10
|
reference: string;
|
|
6
|
-
measures?:
|
|
11
|
+
measures?: MeasureContent[];
|
|
7
12
|
metadata?: JSONObject;
|
|
8
13
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Measurement } from './measures/Measurement';
|
|
2
|
+
/**
|
|
3
|
+
* Result of the `Decoder.decode` method.
|
|
4
|
+
*
|
|
5
|
+
* Contains the decoded measures.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* const decodedPayload: DecodedPayload = {
|
|
10
|
+
* reference: 'BZH42AZF',
|
|
11
|
+
* measures: {
|
|
12
|
+
* temperature: {
|
|
13
|
+
* measuredAt: Date.now(),
|
|
14
|
+
* values: {
|
|
15
|
+
* temperature: 23.8,
|
|
16
|
+
* }
|
|
17
|
+
* },
|
|
18
|
+
* position: {
|
|
19
|
+
* measuredAt: Date.now(),
|
|
20
|
+
* values: {
|
|
21
|
+
* position: {
|
|
22
|
+
* lat: 21.297,
|
|
23
|
+
* lon: 4.8421,
|
|
24
|
+
* },
|
|
25
|
+
* accuracy: 100,
|
|
26
|
+
* }
|
|
27
|
+
* },
|
|
28
|
+
* },
|
|
29
|
+
* };
|
|
30
|
+
*/
|
|
31
|
+
export interface DecodedPayload {
|
|
32
|
+
/**
|
|
33
|
+
* Device unique reference
|
|
34
|
+
*/
|
|
35
|
+
reference: string;
|
|
36
|
+
/**
|
|
37
|
+
* Array of decoded measures.
|
|
38
|
+
*/
|
|
39
|
+
measures: {
|
|
40
|
+
[measureType: string]: Measurement;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { JSONObject } from 'kuzzle';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Device unique reference for a model
|
|
6
|
-
*/
|
|
7
|
-
reference: string;
|
|
8
|
-
/**
|
|
9
|
-
* Device measures gathered from a payload
|
|
10
|
-
*/
|
|
11
|
-
measures?: DeviceMeasures;
|
|
2
|
+
import { KDocumentContent } from 'kuzzle-sdk';
|
|
3
|
+
import { MeasureContent } from './measures/MeasureContent';
|
|
4
|
+
export interface DeviceContent extends KDocumentContent {
|
|
12
5
|
/**
|
|
13
6
|
* Device model
|
|
14
7
|
* (This will be auto-filled by Kuzzle)
|
|
15
8
|
*/
|
|
16
9
|
model?: string;
|
|
17
10
|
/**
|
|
18
|
-
* Device
|
|
19
|
-
* (e.g. battery, network strength, etc.)
|
|
11
|
+
* Device unique reference for a model
|
|
20
12
|
*/
|
|
21
|
-
|
|
13
|
+
reference: string;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
measures?: MeasureContent[];
|
|
22
18
|
/**
|
|
23
19
|
* Device metadata
|
|
24
20
|
*/
|
|
@@ -28,35 +24,7 @@ export declare type DeviceContent = {
|
|
|
28
24
|
*/
|
|
29
25
|
assetId?: string;
|
|
30
26
|
/**
|
|
31
|
-
* Attached
|
|
27
|
+
* Attached engine ID (index name)
|
|
32
28
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* Document metadata
|
|
36
|
-
* @todo use DocumentMetadata when it's not an interface anymore
|
|
37
|
-
*/
|
|
38
|
-
_kuzzle_info?: {
|
|
39
|
-
author?: string;
|
|
40
|
-
createdAt?: number;
|
|
41
|
-
updater?: string | null;
|
|
42
|
-
updatedAt?: number | null;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare type DeviceBulkContent = {
|
|
46
|
-
tenantId?: string;
|
|
47
|
-
deviceId: string;
|
|
48
|
-
assetId?: string;
|
|
49
|
-
};
|
|
50
|
-
export declare type DeviceBulkBuildedContent = {
|
|
51
|
-
tenantId: string;
|
|
52
|
-
deviceIds: string[];
|
|
53
|
-
assetIds: string[];
|
|
54
|
-
};
|
|
55
|
-
export declare type DeviceMAttachementContent = {
|
|
56
|
-
errors: JSONObject[];
|
|
57
|
-
successes: JSONObject[];
|
|
58
|
-
};
|
|
59
|
-
export declare type DeviceMRequestContent = {
|
|
60
|
-
_id: string;
|
|
61
|
-
body: JSONObject;
|
|
62
|
-
};
|
|
29
|
+
engineId?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JSONObject } from 'kuzzle';
|
|
2
|
+
export declare type DeviceManagerConfiguration = {
|
|
3
|
+
/**
|
|
4
|
+
* Administration index name
|
|
5
|
+
*/
|
|
6
|
+
adminIndex: string;
|
|
7
|
+
/**
|
|
8
|
+
* Administration collections mappings (in admin index)
|
|
9
|
+
*/
|
|
10
|
+
adminCollections: {
|
|
11
|
+
config: {
|
|
12
|
+
name: string;
|
|
13
|
+
mappings: JSONObject;
|
|
14
|
+
settings: JSONObject;
|
|
15
|
+
};
|
|
16
|
+
devices: {
|
|
17
|
+
name: string;
|
|
18
|
+
mappings: JSONObject;
|
|
19
|
+
settings: JSONObject;
|
|
20
|
+
};
|
|
21
|
+
payloads: {
|
|
22
|
+
name: string;
|
|
23
|
+
mappings: JSONObject;
|
|
24
|
+
settings: JSONObject;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
engineCollections: {
|
|
28
|
+
config: {
|
|
29
|
+
name: string;
|
|
30
|
+
mappings: JSONObject;
|
|
31
|
+
settings: JSONObject;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Interval to write documents from the buffer
|
|
36
|
+
*
|
|
37
|
+
* @see https://docs.kuzzle.io/sdk/js/7/essentials/batch-processing/
|
|
38
|
+
*/
|
|
39
|
+
batchInterval: number;
|
|
40
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export * from './Measure';
|
|
2
|
-
export * from './DeviceContent';
|
|
3
1
|
export * from './BaseAssetContent';
|
|
2
|
+
export * from './DeviceContent';
|
|
3
|
+
export * from './measures/MeasureContent';
|
|
4
|
+
export * from './measures/Measurement';
|
|
5
|
+
export * from './measures/MeasureDefinition';
|
|
6
|
+
export * from './DecoderContent';
|
|
7
|
+
export * from './DecodedPayload';
|
|
8
|
+
export * from './DeviceManagerConfiguration';
|