kuzzle-device-manager 2.2.7 → 2.2.8
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/decoder/DecodingState.js +1 -1
- package/dist/lib/modules/decoder/DecodingState.js.map +1 -1
- package/dist/lib/modules/plugin/types/InternalCollection.js +1 -1
- package/dist/lib/modules/plugin/types/InternalCollection.js.map +1 -1
- package/package.json +4 -3
- package/dist/tests/application/app.d.ts +0 -1
- package/dist/tests/application/app.js +0 -71
- package/dist/tests/application/app.js.map +0 -1
- package/dist/tests/application/assets/Container.d.ts +0 -19
- package/dist/tests/application/assets/Container.js +0 -41
- package/dist/tests/application/assets/Container.js.map +0 -1
- package/dist/tests/application/assets/Warehouse.d.ts +0 -2
- package/dist/tests/application/assets/Warehouse.js +0 -10
- package/dist/tests/application/assets/Warehouse.js.map +0 -1
- package/dist/tests/application/decoders/DummyTempDecoder.d.ts +0 -15
- package/dist/tests/application/decoders/DummyTempDecoder.js +0 -70
- package/dist/tests/application/decoders/DummyTempDecoder.js.map +0 -1
- package/dist/tests/application/decoders/DummyTempPositionDecoder.d.ts +0 -16
- package/dist/tests/application/decoders/DummyTempPositionDecoder.js +0 -49
- package/dist/tests/application/decoders/DummyTempPositionDecoder.js.map +0 -1
- package/dist/tests/application/decoders/index.d.ts +0 -2
- package/dist/tests/application/decoders/index.js +0 -19
- package/dist/tests/application/decoders/index.js.map +0 -1
- package/dist/tests/application/tests/controller.d.ts +0 -5
- package/dist/tests/application/tests/controller.js +0 -40
- package/dist/tests/application/tests/controller.js.map +0 -1
- package/dist/tests/application/tests/pipes.d.ts +0 -2
- package/dist/tests/application/tests/pipes.js +0 -109
- package/dist/tests/application/tests/pipes.js.map +0 -1
|
@@ -6,5 +6,5 @@ var DecodingState;
|
|
|
6
6
|
DecodingState[DecodingState["SKIP"] = 0] = "SKIP";
|
|
7
7
|
DecodingState[DecodingState["ERROR"] = 1] = "ERROR";
|
|
8
8
|
DecodingState[DecodingState["VALID"] = 2] = "VALID";
|
|
9
|
-
})(DecodingState
|
|
9
|
+
})(DecodingState || (exports.DecodingState = DecodingState = {}));
|
|
10
10
|
//# sourceMappingURL=DecodingState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecodingState.js","sourceRoot":"","sources":["../../../../lib/modules/decoder/DecodingState.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,mDAAK,CAAA;IACL,mDAAK,CAAA;AACP,CAAC,EAJW,aAAa,
|
|
1
|
+
{"version":3,"file":"DecodingState.js","sourceRoot":"","sources":["../../../../lib/modules/decoder/DecodingState.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,mDAAK,CAAA;IACL,mDAAK,CAAA;AACP,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
|
|
@@ -9,5 +9,5 @@ var InternalCollection;
|
|
|
9
9
|
InternalCollection["MEASURES"] = "measures";
|
|
10
10
|
InternalCollection["MODELS"] = "models";
|
|
11
11
|
InternalCollection["CONFIG"] = "config";
|
|
12
|
-
})(InternalCollection
|
|
12
|
+
})(InternalCollection || (exports.InternalCollection = InternalCollection = {}));
|
|
13
13
|
//# sourceMappingURL=InternalCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalCollection.js","sourceRoot":"","sources":["../../../../../lib/modules/plugin/types/InternalCollection.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,uDAAiC,CAAA;IACjC,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;AACnB,CAAC,EAPW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"InternalCollection.js","sourceRoot":"","sources":["../../../../../lib/modules/plugin/types/InternalCollection.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,uDAAiC,CAAA;IACjC,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;AACnB,CAAC,EAPW,kBAAkB,kCAAlB,kBAAkB,QAO7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle-device-manager",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "Manage your IoT devices and assets. Choose a provisioning strategy, receive and decode payload, handle your IoT business logic.",
|
|
5
5
|
"author": "The Kuzzle Team (support@kuzzle.io)",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"test": "jest --runInBand",
|
|
17
17
|
"lint": "eslint ./lib ./tests --ext .ts --config .eslintrc.json",
|
|
18
18
|
"lint:fix": "eslint ./lib ./tests --ext .ts --config .eslintrc.json --fix",
|
|
19
|
-
"prettier": "
|
|
19
|
+
"prettier": "prettier lib/ tests/ --write",
|
|
20
20
|
"build": "tsc --build tsconfig.json",
|
|
21
21
|
"postinstall": "node -e \"process.exit(require('fs').existsSync('./dist') ? 1 : 0)\" && npm run build || true",
|
|
22
22
|
"prepack": "npm run build"
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"kuzzle": "^2.21.0"
|
|
48
48
|
},
|
|
49
49
|
"files": [
|
|
50
|
-
"dist/**/*"
|
|
50
|
+
"dist/**/*",
|
|
51
|
+
"!dist/tests"
|
|
51
52
|
]
|
|
52
53
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_util_1 = __importDefault(require("node:util"));
|
|
7
|
-
const kuzzle_1 = require("kuzzle");
|
|
8
|
-
const index_1 = require("../../index");
|
|
9
|
-
const decoders_1 = require("./decoders");
|
|
10
|
-
const pipes_1 = require("./tests/pipes");
|
|
11
|
-
const controller_1 = require("./tests/controller");
|
|
12
|
-
const Container_1 = require("./assets/Container");
|
|
13
|
-
const Warehouse_1 = require("./assets/Warehouse");
|
|
14
|
-
const app = new kuzzle_1.Backend("kuzzle");
|
|
15
|
-
const deviceManager = new index_1.DeviceManagerPlugin();
|
|
16
|
-
deviceManager.models.registerDevice("DummyTempPosition", {
|
|
17
|
-
decoder: new decoders_1.DummyTempPositionDecoder(),
|
|
18
|
-
metadataMappings: {
|
|
19
|
-
serial: { type: "keyword" },
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
deviceManager.models.registerDevice("DummyTemp", {
|
|
23
|
-
decoder: new decoders_1.DummyTempDecoder(),
|
|
24
|
-
metadataMappings: {
|
|
25
|
-
color: { type: "keyword" },
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
// Register an asset for the "commons" group
|
|
29
|
-
deviceManager.models.registerAsset("commons", "Container", Container_1.containerAssetDefinition);
|
|
30
|
-
deviceManager.models.registerAsset("commons", "Warehouse", Warehouse_1.warehouseAssetDefinition);
|
|
31
|
-
deviceManager.models.registerMeasure("acceleration", {
|
|
32
|
-
valuesMappings: {
|
|
33
|
-
x: { type: "float" },
|
|
34
|
-
y: { type: "float" },
|
|
35
|
-
z: { type: "float" },
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
(0, pipes_1.registerTestPipes)(app);
|
|
39
|
-
app.plugin.use(deviceManager);
|
|
40
|
-
app.controller.use(new controller_1.TestsController(app));
|
|
41
|
-
app.hook.register("request:onError", async (request) => {
|
|
42
|
-
app.log.error(request.error);
|
|
43
|
-
});
|
|
44
|
-
node_util_1.default.inspect.defaultOptions = {
|
|
45
|
-
depth: 10,
|
|
46
|
-
};
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
app.config.content.plugins["kuzzle-plugin-logger"].services.stdout.level =
|
|
49
|
-
"debug";
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
app.config.content.limits.documentsWriteCount = 5000;
|
|
52
|
-
let searchQuery;
|
|
53
|
-
async function sendResult(stream, searchQuery) {
|
|
54
|
-
let result = await app.sdk.document.search("device-manager", "payloads", {
|
|
55
|
-
query: searchQuery,
|
|
56
|
-
}, { scroll: "5s" });
|
|
57
|
-
while (result) {
|
|
58
|
-
for (const hit of result.hits) {
|
|
59
|
-
stream.write(JSON.stringify(hit));
|
|
60
|
-
}
|
|
61
|
-
result = await result.next();
|
|
62
|
-
}
|
|
63
|
-
stream.end();
|
|
64
|
-
}
|
|
65
|
-
app
|
|
66
|
-
.start()
|
|
67
|
-
.then(() => {
|
|
68
|
-
app.log.info("Application started");
|
|
69
|
-
})
|
|
70
|
-
.catch(console.error);
|
|
71
|
-
//# sourceMappingURL=app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../tests/application/app.ts"],"names":[],"mappings":";;;;;AAAA,0DAA6B;AAE7B,mCAA4D;AAE5D,uCAAkD;AAElD,yCAAwE;AACxE,yCAAkD;AAClD,mDAAqD;AACrD,kDAA8D;AAC9D,kDAA8D;AAG9D,MAAM,GAAG,GAAG,IAAI,gBAAO,CAAC,QAAQ,CAAC,CAAC;AAElC,MAAM,aAAa,GAAG,IAAI,2BAAmB,EAAE,CAAC;AAEhD,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE;IACvD,OAAO,EAAE,IAAI,mCAAwB,EAAE;IACvC,gBAAgB,EAAE;QAChB,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC5B;CACF,CAAC,CAAC;AAEH,aAAa,CAAC,M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AC,MAAM,CAAC,mBAAmB,GAAG,IAAI,CAAC;AAErD,IAAI,WAAW,CAAC;AAEhB,KAAK,UAAU,UAAU,CAAC,MAAM,EAAE,WAAW;IAC3C,IAAI,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CACxC,gBAAgB,EAChB,UAAU,EACV;QACE,KAAK,EAAE,WAAW;KACnB,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB,CAAC;IAEF,OAAO,MAAM,EAAE;QACb,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE;YAC7B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;SACnC;QAED,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;KAC9B;IAED,MAAM,CAAC,GAAG,EAAE,CAAC;AACf,CAAC;AAED,GAAG;KACA,KAAK,EAAE;KACP,IAAI,CAAC,GAAG,EAAE;IACT,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACtC,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Metadata, AssetContent, TemperatureMeasurement, PositionMeasurement, AssetModelDefinition } from "../../../index";
|
|
2
|
-
export interface ContainerMetadata extends Metadata {
|
|
3
|
-
height: number;
|
|
4
|
-
width: number;
|
|
5
|
-
trailer: {
|
|
6
|
-
weight: number;
|
|
7
|
-
capacity: number;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export type ContainerMeasurements = {
|
|
11
|
-
temperatureExt: TemperatureMeasurement;
|
|
12
|
-
temperatureInt: TemperatureMeasurement;
|
|
13
|
-
position: PositionMeasurement;
|
|
14
|
-
temperatureWeather: TemperatureMeasurement;
|
|
15
|
-
};
|
|
16
|
-
export interface ContainerAssetContent extends AssetContent<ContainerMeasurements, ContainerMetadata> {
|
|
17
|
-
model: "Container";
|
|
18
|
-
}
|
|
19
|
-
export declare const containerAssetDefinition: AssetModelDefinition;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.containerAssetDefinition = void 0;
|
|
4
|
-
exports.containerAssetDefinition = {
|
|
5
|
-
measures: [
|
|
6
|
-
{ name: "temperatureExt", type: "temperature" },
|
|
7
|
-
{ name: "temperatureInt", type: "temperature" },
|
|
8
|
-
{ name: "position", type: "position" },
|
|
9
|
-
{ name: "temperatureWeather", type: "temperature" },
|
|
10
|
-
],
|
|
11
|
-
metadataMappings: {
|
|
12
|
-
weight: { type: "integer" },
|
|
13
|
-
height: { type: "integer" },
|
|
14
|
-
trailer: {
|
|
15
|
-
properties: {
|
|
16
|
-
weight: { type: "integer" },
|
|
17
|
-
capacity: { type: "integer" },
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
defaultMetadata: {
|
|
22
|
-
height: 20,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
// This function is never called and only exists to make sure the types are correct
|
|
26
|
-
function neverCalled() {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
const container = {};
|
|
29
|
-
container.metadata.height = 40;
|
|
30
|
-
if (container.measures.temperatureExt) {
|
|
31
|
-
container.measures.temperatureExt.values.temperature = 20;
|
|
32
|
-
}
|
|
33
|
-
if (container.measures.position) {
|
|
34
|
-
container.measures.position.values.accuracy = 10;
|
|
35
|
-
}
|
|
36
|
-
// @ts-expect-error
|
|
37
|
-
container.measures.unexistingMeasure;
|
|
38
|
-
// @ts-expect-error
|
|
39
|
-
container.measures.temperatureExt.values.notValue;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=Container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Container.js","sourceRoot":"","sources":["../../../../tests/application/assets/Container.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10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.warehouseAssetDefinition = void 0;
|
|
4
|
-
exports.warehouseAssetDefinition = {
|
|
5
|
-
measures: [{ name: "position", type: "position" }],
|
|
6
|
-
metadataMappings: {
|
|
7
|
-
surface: { type: "integer" },
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=Warehouse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Warehouse.js","sourceRoot":"","sources":["../../../../tests/application/assets/Warehouse.ts"],"names":[],"mappings":";;;AAEa,QAAA,wBAAwB,GAAyB;IAC5D,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAClD,gBAAgB,EAAE;QAChB,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC7B;CACF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { JSONObject } from "kuzzle-sdk";
|
|
2
|
-
import { Decoder, DecodedPayload } from "../../../index";
|
|
3
|
-
export declare class DummyTempDecoder extends Decoder {
|
|
4
|
-
measures: readonly [{
|
|
5
|
-
readonly name: "temperature";
|
|
6
|
-
readonly type: "temperature";
|
|
7
|
-
}, {
|
|
8
|
-
readonly name: "battery";
|
|
9
|
-
readonly type: "battery";
|
|
10
|
-
}];
|
|
11
|
-
constructor();
|
|
12
|
-
validate(rawPayload: JSONObject): Promise<boolean>;
|
|
13
|
-
decode(decodedPayload: DecodedPayload<DummyTempDecoder>, rawPayload: JSONObject): Promise<DecodedPayload<DummyTempDecoder>>;
|
|
14
|
-
decodeSimplePayload(decodedPayload: DecodedPayload<DummyTempDecoder>, payload: JSONObject): void;
|
|
15
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DummyTempDecoder = void 0;
|
|
4
|
-
const kuzzle_1 = require("kuzzle");
|
|
5
|
-
const index_1 = require("../../../index");
|
|
6
|
-
class DummyTempDecoder extends index_1.Decoder {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.measures = [
|
|
10
|
-
{ name: "temperature", type: "temperature" },
|
|
11
|
-
{ name: "battery", type: "battery" },
|
|
12
|
-
];
|
|
13
|
-
this.payloadsMappings = {
|
|
14
|
-
deviceEUI: { type: "keyword" },
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
async validate(rawPayload) {
|
|
18
|
-
if (rawPayload.measurements && rawPayload.measurements.length === 0) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
const payloads = rawPayload.measurements ?? [rawPayload];
|
|
22
|
-
return payloads.every((payload) => {
|
|
23
|
-
if (!payload.deviceEUI) {
|
|
24
|
-
throw new kuzzle_1.PreconditionError('Invalid payload: missing "deviceEUI"');
|
|
25
|
-
}
|
|
26
|
-
return !payload.invalid;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
async decode(decodedPayload, rawPayload) {
|
|
30
|
-
const payloads = rawPayload.measurements ?? [rawPayload];
|
|
31
|
-
for (const payload of payloads) {
|
|
32
|
-
this.decodeSimplePayload(decodedPayload, payload);
|
|
33
|
-
}
|
|
34
|
-
return decodedPayload;
|
|
35
|
-
}
|
|
36
|
-
decodeSimplePayload(decodedPayload, payload) {
|
|
37
|
-
if (payload?.metadata?.color) {
|
|
38
|
-
decodedPayload.addMetadata(payload.deviceEUI, {
|
|
39
|
-
color: payload.metadata.color,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
decodedPayload.addMeasurement(payload.deviceEUI, "temperature", {
|
|
43
|
-
measuredAt: payload.measuredAt || Date.now(),
|
|
44
|
-
type: "temperature",
|
|
45
|
-
values: {
|
|
46
|
-
temperature: payload.temperature,
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
decodedPayload.addMeasurement(payload.deviceEUI, "battery", {
|
|
50
|
-
measuredAt: payload.measuredAt || Date.now(),
|
|
51
|
-
type: "battery",
|
|
52
|
-
values: {
|
|
53
|
-
battery: payload.battery || 42,
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
if (payload.unknownMeasure) {
|
|
57
|
-
decodedPayload.addMeasurement(payload.deviceEUI,
|
|
58
|
-
// @ts-expect-error
|
|
59
|
-
"unknownMeasureName", {
|
|
60
|
-
measuredAt: Date.now(),
|
|
61
|
-
type: "temperature",
|
|
62
|
-
values: {
|
|
63
|
-
temperature: payload.unknownMeasure,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.DummyTempDecoder = DummyTempDecoder;
|
|
70
|
-
//# sourceMappingURL=DummyTempDecoder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DummyTempDecoder.js","sourceRoot":"","sources":["../../../../tests/application/decoders/DummyTempDecoder.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAG3C,0CAKwB;AAExB,MAAa,gBAAiB,SAAQ,eAAO;IAM3C;QACE,KAAK,EAAE,CAAC;QANH,aAAQ,GAAG;YAChB,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE;YAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;SAC5B,CAAC;QAKT,IAAI,CAAC,gBAAgB,GAAG;YACtB,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAsB;QACnC,IAAI,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YACnE,OAAO,KAAK,CAAC;SACd;QAED,MAAM,QAAQ,GAAU,UAAU,CAAC,YAAY,IAAI,CAA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QAEF,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,cAAc,CAAC,cAAc,CAC3B,OAAO,CAAC,SAAS;YACjB,mBAAmB;YACnB,oBAAoB,EACpB;gBACE,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;gBACtB,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAE;oBACN,WAAW,EAAE,OAAO,CAAC,cAAc;iBACpC;aACF,CACF,CAAC;SACH;IACH,CAAC;CACF;AA5FD,4CA4FC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { JSONObject } from "kuzzle-sdk";
|
|
2
|
-
import { Decoder, DecodedPayload } from "../../../index";
|
|
3
|
-
export declare class DummyTempPositionDecoder extends Decoder {
|
|
4
|
-
measures: readonly [{
|
|
5
|
-
readonly name: "temperature";
|
|
6
|
-
readonly type: "temperature";
|
|
7
|
-
}, {
|
|
8
|
-
readonly name: "battery";
|
|
9
|
-
readonly type: "battery";
|
|
10
|
-
}, {
|
|
11
|
-
readonly name: "position";
|
|
12
|
-
readonly type: "position";
|
|
13
|
-
}];
|
|
14
|
-
validate(payload: JSONObject): Promise<boolean>;
|
|
15
|
-
decode(decodedPayload: DecodedPayload<DummyTempPositionDecoder>, payload: JSONObject): Promise<DecodedPayload<DummyTempPositionDecoder>>;
|
|
16
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DummyTempPositionDecoder = void 0;
|
|
4
|
-
const kuzzle_1 = require("kuzzle");
|
|
5
|
-
const index_1 = require("../../../index");
|
|
6
|
-
class DummyTempPositionDecoder extends index_1.Decoder {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.measures = [
|
|
10
|
-
{ name: "temperature", type: "temperature" },
|
|
11
|
-
{ name: "battery", type: "battery" },
|
|
12
|
-
{ name: "position", type: "position" },
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
async validate(payload) {
|
|
16
|
-
if (payload.deviceEUI === undefined) {
|
|
17
|
-
throw new kuzzle_1.PreconditionError('Invalid payload: missing "deviceEUI"');
|
|
18
|
-
}
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
async decode(decodedPayload, payload) {
|
|
22
|
-
decodedPayload.addMeasurement(payload.deviceEUI, "temperature", {
|
|
23
|
-
measuredAt: Date.now(),
|
|
24
|
-
type: "temperature",
|
|
25
|
-
values: { temperature: payload.temperature },
|
|
26
|
-
});
|
|
27
|
-
decodedPayload.addMeasurement(payload.deviceEUI, "position", {
|
|
28
|
-
measuredAt: Date.now(),
|
|
29
|
-
type: "position",
|
|
30
|
-
values: {
|
|
31
|
-
position: {
|
|
32
|
-
lat: payload.location.lat,
|
|
33
|
-
lon: payload.location.lon,
|
|
34
|
-
},
|
|
35
|
-
accuracy: payload.location.accuracy,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
decodedPayload.addMeasurement(payload.deviceEUI, "battery", {
|
|
39
|
-
measuredAt: Date.now(),
|
|
40
|
-
type: "battery",
|
|
41
|
-
values: {
|
|
42
|
-
battery: payload.battery * 100,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
return decodedPayload;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.DummyTempPositionDecoder = DummyTempPositionDecoder;
|
|
49
|
-
//# sourceMappingURL=DummyTempPositionDecoder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DummyTempPositionDecoder.js","sourceRoot":"","sources":["../../../../tests/application/decoders/DummyTempPositionDecoder.ts"],"names":[],"mappings":";;;AAAA,mCAA2C;AAG3C,0CAMwB;AAExB,MAAa,wBAAyB,SAAQ,eAAO;IAArD;;QACS,aAAQ,GAAG;YAChB,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE;YAC5C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,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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("./DummyTempDecoder"), exports);
|
|
18
|
-
__exportStar(require("./DummyTempPositionDecoder"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../tests/application/decoders/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,6DAA2C"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestsController = void 0;
|
|
4
|
-
const kuzzle_1 = require("kuzzle");
|
|
5
|
-
class TestsController extends kuzzle_1.Controller {
|
|
6
|
-
constructor(app) {
|
|
7
|
-
super(app);
|
|
8
|
-
this.definition = {
|
|
9
|
-
actions: {
|
|
10
|
-
createDigitalTwinFromBackend: {
|
|
11
|
-
handler: this.createDigitalTwinFromBackend,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
async createDigitalTwinFromBackend(request) {
|
|
17
|
-
const engineId = request.getString("engineId");
|
|
18
|
-
const reference = request.getBodyString("reference");
|
|
19
|
-
await this.app.sdk.query({
|
|
20
|
-
controller: "device-manager/assets",
|
|
21
|
-
action: "create",
|
|
22
|
-
engineId,
|
|
23
|
-
body: {
|
|
24
|
-
model: "Container",
|
|
25
|
-
reference,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
await this.app.sdk.query({
|
|
29
|
-
controller: "device-manager/devices",
|
|
30
|
-
action: "create",
|
|
31
|
-
engineId,
|
|
32
|
-
body: {
|
|
33
|
-
model: "DummyTemp",
|
|
34
|
-
reference,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.TestsController = TestsController;
|
|
40
|
-
//# sourceMappingURL=controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../tests/application/tests/controller.ts"],"names":[],"mappings":";;;AAAA,mCAA4D;AAS5D,MAAa,eAAgB,SAAQ,mBAAU;IAC7C,YAAY,GAAY;QACtB,KAAK,CAAC,GAAG,CAAC,CAAC;QAEX,IAAI,CAAC,UAAU,GAAG;YAChB,OAAO,EAAE;gBACP,4BAA4B,EAAE;oBAC5B,OAAO,EAAE,IAAI,CAAC,4BAA4B;iBAC3C;aACF;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,OAAsB;QACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAErD,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAA8C;YACpE,UAAU,EAAE,uBAAuB;YACnC,MAAM,EAAE,QAAQ;YAChB,QAAQ;YACR,IAAI,EAAE;gBACJ,KAAK,EAAE,WAAW;gBAClB,SAAS;aACV;SACF,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAgD;YACtE,UAAU,EAAE,wBAAwB;YACpC,MAAM,EAAE,QAAQ;YAChB,QAAQ;YACR,IAAI,EAAE;gBACJ,KAAK,EAAE,WAAW;gBAClB,SAAS;aACV;SACF,CAAC,CAAC;IACL,CAAC;CACF;AArCD,0CAqCC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerTestPipes = void 0;
|
|
4
|
-
function registerTestPipes(app) {
|
|
5
|
-
app.pipe.register("device-manager:measures:persist:before", async ({ asset, device, measures }) => {
|
|
6
|
-
const color = device._source.metadata.color;
|
|
7
|
-
if (color === "test-persist-before-event-temperature-42") {
|
|
8
|
-
if (asset._source.measures.temperatureExt.values.temperature !== 42) {
|
|
9
|
-
throw new Error("The asset document in this event should already contains the updated measure");
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return { asset, device, measures };
|
|
13
|
-
});
|
|
14
|
-
app.pipe.register("device-manager:measures:process:before", async ({ asset, device, measures }) => {
|
|
15
|
-
if (device._id === "DummyTemp-enrich_me_master") {
|
|
16
|
-
for (const measure of measures) {
|
|
17
|
-
if (measure.values.temperature) {
|
|
18
|
-
if (device._source.measures.temperature) {
|
|
19
|
-
if (measure.measuredAt <=
|
|
20
|
-
device._source.measures.temperature.measuredAt) {
|
|
21
|
-
throw new Error(`The measure has already been embedded into the device but it shouldn't at this stage of the ingestion pipeline`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
measure.values.temperature *= 2;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (device._id === "DummyTemp-compute_me_master") {
|
|
29
|
-
const computedMeasures = [];
|
|
30
|
-
for (const measure of measures) {
|
|
31
|
-
if (measure.type === "temperature") {
|
|
32
|
-
const temperatureInt = {
|
|
33
|
-
asset: {
|
|
34
|
-
_id: asset._id,
|
|
35
|
-
measureName: "temperatureInt",
|
|
36
|
-
metadata: asset._source.metadata,
|
|
37
|
-
model: asset._source.model,
|
|
38
|
-
reference: asset._source.reference,
|
|
39
|
-
},
|
|
40
|
-
measuredAt: measure.measuredAt,
|
|
41
|
-
origin: {
|
|
42
|
-
type: "computed",
|
|
43
|
-
_id: "compute-temperature-int",
|
|
44
|
-
measureName: "temperatureInt",
|
|
45
|
-
payloadUuids: measure.origin.payloadUuids,
|
|
46
|
-
},
|
|
47
|
-
type: "temperature",
|
|
48
|
-
values: {
|
|
49
|
-
temperature: measure.values.temperature * 2,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
computedMeasures.push(temperatureInt);
|
|
53
|
-
asset._source.measures.temperatureInt = {
|
|
54
|
-
measuredAt: temperatureInt.measuredAt,
|
|
55
|
-
name: "temperatureInt",
|
|
56
|
-
payloadUuids: temperatureInt.origin.payloadUuids,
|
|
57
|
-
type: "temperature",
|
|
58
|
-
values: {
|
|
59
|
-
temperature: temperatureInt.values.temperature,
|
|
60
|
-
},
|
|
61
|
-
originId: device._id,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
for (const computedMeasure of computedMeasures) {
|
|
66
|
-
measures.push(computedMeasure);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const color = device._source.metadata.color;
|
|
70
|
-
if (color === "test-metadata-history-with-measure") {
|
|
71
|
-
asset._source.metadata.weight = 42042;
|
|
72
|
-
asset._source.metadata.trailer.capacity = 2048;
|
|
73
|
-
}
|
|
74
|
-
if (color === "test-create-new-asset-measure") {
|
|
75
|
-
const measure = {
|
|
76
|
-
measuredAt: Date.now(),
|
|
77
|
-
asset: {
|
|
78
|
-
_id: asset._id,
|
|
79
|
-
measureName: "temperatureWeather",
|
|
80
|
-
metadata: asset._source.metadata,
|
|
81
|
-
model: asset._source.model,
|
|
82
|
-
reference: asset._source.reference,
|
|
83
|
-
},
|
|
84
|
-
origin: {
|
|
85
|
-
type: "computed",
|
|
86
|
-
_id: "rule-weather-api",
|
|
87
|
-
measureName: "temperatureWeather",
|
|
88
|
-
payloadUuids: ["uuid"],
|
|
89
|
-
},
|
|
90
|
-
type: "temperature",
|
|
91
|
-
values: {
|
|
92
|
-
temperature: 21.21,
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
measures.push(measure);
|
|
96
|
-
asset._source.measures.temperatureWeather = {
|
|
97
|
-
name: measure.asset?.measureName,
|
|
98
|
-
measuredAt: measure.measuredAt,
|
|
99
|
-
payloadUuids: measure.origin.payloadUuids,
|
|
100
|
-
type: measure.type,
|
|
101
|
-
values: measure.values,
|
|
102
|
-
originId: device._id,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
return { asset, device, measures };
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
exports.registerTestPipes = registerTestPipes;
|
|
109
|
-
//# sourceMappingURL=pipes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipes.js","sourceRoot":"","sources":["../../../../tests/application/tests/pipes.ts"],"names":[],"mappings":";;;AASA,SAAgB,iBAAiB,CAAC,GAAY;IAC5C,GAAG,CAAC,IAAI,CAAC,QAAQ,CACf,wCAAwC,EACxC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;QAE5C,IAAI,KAAK,KAAK,0CAA0C,EAAE;YACxD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,KAAK,EAAE,EAAE;gBACnE,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;aACH;SACF;QAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrC,CAAC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