kuzzle-device-manager-types 2.0.8 → 2.1.0
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/core/DeviceManagerPlugin.d.ts +0 -3
- package/dist/lib/core/registers/DecodersRegister.d.ts +8 -8
- package/dist/lib/modules/decoder/PayloadService.d.ts +7 -2
- package/dist/lib/modules/decoder/collections/payloadsMappings.d.ts +3 -0
- package/dist/lib/modules/decoder/types/PayloadEvents.d.ts +15 -0
- package/dist/lib/modules/device/DeviceService.d.ts +4 -0
- package/dist/lib/modules/device/DevicesController.d.ts +1 -0
- package/dist/lib/modules/device/types/DeviceApi.d.ts +16 -1
- package/dist/lib/modules/measure/types/MeasureEvents.d.ts +8 -9
- package/dist/lib/modules/shared/index.d.ts +0 -1
- package/dist/lib/modules/shared/utils/ask.d.ts +1 -1
- package/package.json +1 -1
- package/dist/lib/modules/shared/utils/snakeCase.d.ts +0 -7
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Plugin, PluginContext, JSONObject } from "kuzzle";
|
|
2
2
|
import { MeasureDefinition } from "../modules/measure";
|
|
3
3
|
import { AssetModelDefinition, DeviceModelDefinition } from "../modules/model";
|
|
4
|
-
import { KuzzleRole } from "../modules/shared";
|
|
5
4
|
import { DeviceManagerConfiguration } from "./DeviceManagerConfiguration";
|
|
6
5
|
export declare class DeviceManagerPlugin extends Plugin {
|
|
7
6
|
config: DeviceManagerConfiguration;
|
|
8
|
-
roles: KuzzleRole[];
|
|
9
7
|
private deviceManagerEngine;
|
|
10
8
|
private adminConfigManager;
|
|
11
9
|
private engineConfigManager;
|
|
@@ -95,7 +93,6 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
95
93
|
* Init the plugin
|
|
96
94
|
*/
|
|
97
95
|
init(config: JSONObject, context: PluginContext): Promise<void>;
|
|
98
|
-
private createDefaultRoles;
|
|
99
96
|
/**
|
|
100
97
|
* Initialize the administration index of the plugin
|
|
101
98
|
*/
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { PluginContext } from "kuzzle";
|
|
2
2
|
import { Decoder, DecoderContent } from "../../modules/decoder";
|
|
3
|
+
import { DeviceManagerPlugin } from "..";
|
|
3
4
|
export declare class DecodersRegister {
|
|
4
5
|
private context;
|
|
6
|
+
private plugin;
|
|
5
7
|
/**
|
|
6
8
|
* Map<deviceModel, Decoder>
|
|
7
9
|
*/
|
|
8
10
|
private _decoders;
|
|
9
11
|
private get sdk();
|
|
10
12
|
get decoders(): Decoder[];
|
|
11
|
-
init(context: PluginContext): void;
|
|
13
|
+
init(plugin: DeviceManagerPlugin, context: PluginContext): void;
|
|
12
14
|
get(deviceModel: string): Decoder;
|
|
13
15
|
list(): DecoderContent[];
|
|
14
16
|
/**
|
|
@@ -29,13 +31,11 @@ export declare class DecodersRegister {
|
|
|
29
31
|
};
|
|
30
32
|
printDecoders(): void;
|
|
31
33
|
/**
|
|
32
|
-
*
|
|
34
|
+
* Register default role, profile and user associated to the generated actions
|
|
33
35
|
* in the Payload controller.
|
|
34
|
-
*
|
|
35
|
-
* This method never returns a rejected promise.
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
private
|
|
40
|
-
private
|
|
37
|
+
registerDefaultRights(): void;
|
|
38
|
+
private registerDefaultUser;
|
|
39
|
+
private registerDefaultProfile;
|
|
40
|
+
private registerDefaultRole;
|
|
41
41
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { JSONObject, KuzzleRequest } from "kuzzle";
|
|
1
|
+
import { JSONObject, KDocument, KuzzleRequest } from "kuzzle";
|
|
2
2
|
import { DeviceManagerPlugin } from "../../core";
|
|
3
|
+
import { DeviceContent } from "../device";
|
|
4
|
+
import { DecodedMeasurement } from "../measure";
|
|
3
5
|
import { Decoder } from "./Decoder";
|
|
4
6
|
export declare class PayloadService {
|
|
5
7
|
private config;
|
|
@@ -16,6 +18,9 @@ export declare class PayloadService {
|
|
|
16
18
|
receive(request: KuzzleRequest, decoder: Decoder, { refresh }?: any): Promise<{
|
|
17
19
|
valid: boolean;
|
|
18
20
|
}>;
|
|
21
|
+
receiveFormated(device: KDocument<DeviceContent>, measurements: DecodedMeasurement[], { payloadUuids }?: {
|
|
22
|
+
payloadUuids?: string[];
|
|
23
|
+
}): Promise<void>;
|
|
19
24
|
/**
|
|
20
25
|
* Method used to save the payload and catch + log the error if any.
|
|
21
26
|
*
|
|
@@ -30,5 +35,5 @@ export declare class PayloadService {
|
|
|
30
35
|
prune(days: number, onlyValid: boolean, { deviceModel }?: {
|
|
31
36
|
deviceModel?: string;
|
|
32
37
|
}): Promise<number>;
|
|
33
|
-
receiveUnknown(deviceModel: string, payload: JSONObject): Promise<void>;
|
|
38
|
+
receiveUnknown(deviceModel: string, payload: JSONObject, apiAction: string): Promise<void>;
|
|
34
39
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KDocument } from "kuzzle-sdk";
|
|
2
|
+
import { DeviceContent } from "../../device";
|
|
3
|
+
import { DecodedMeasurement } from "../../measure";
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export type AskPayloadReceiveFormated = {
|
|
8
|
+
name: "ask:device-manager:payload:receive-formated";
|
|
9
|
+
payload: {
|
|
10
|
+
device: KDocument<DeviceContent>;
|
|
11
|
+
measures: DecodedMeasurement[];
|
|
12
|
+
payloadUuids: string[];
|
|
13
|
+
};
|
|
14
|
+
result: void;
|
|
15
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSONObject, KDocument, KHit, Plugin, SearchResult, User } from "kuzzle";
|
|
2
2
|
import { AssetContent } from "./../asset";
|
|
3
3
|
import { Metadata } from "../shared";
|
|
4
|
+
import { DecodedMeasurement } from "../measure";
|
|
4
5
|
import { DeviceContent } from "./types/DeviceContent";
|
|
5
6
|
import { ApiDeviceLinkAssetRequest, ApiDeviceGetMeasuresResult } from "./types/DeviceApi";
|
|
6
7
|
export declare class DeviceService {
|
|
@@ -64,6 +65,7 @@ export declare class DeviceService {
|
|
|
64
65
|
asset: KDocument<AssetContent>;
|
|
65
66
|
device: KDocument<DeviceContent>;
|
|
66
67
|
}>;
|
|
68
|
+
receiveMeasures(engineId: string, deviceId: string, measures: DecodedMeasurement[], payloadUuids: string[]): Promise<void>;
|
|
67
69
|
/**
|
|
68
70
|
* Checks if the asset does not already have a linked device using one of the
|
|
69
71
|
* requested measure names.
|
|
@@ -100,4 +102,6 @@ export declare class DeviceService {
|
|
|
100
102
|
private checkEngineExists;
|
|
101
103
|
private checkAttachedToEngine;
|
|
102
104
|
private getEngine;
|
|
105
|
+
private getDeviceModel;
|
|
106
|
+
private getAssetModel;
|
|
103
107
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONObject, KDocument, KHit, SearchResult } from "kuzzle";
|
|
2
|
-
import { MeasureContent } from "../../measure";
|
|
2
|
+
import { DecodedMeasurement, MeasureContent } from "../../measure";
|
|
3
3
|
import { AssetContent } from "../../asset";
|
|
4
4
|
import { Metadata } from "../../shared";
|
|
5
5
|
import { DeviceContent } from "./DeviceContent";
|
|
@@ -43,6 +43,7 @@ export interface ApiDeviceSearchRequest extends DevicesControllerRequest {
|
|
|
43
43
|
from?: number;
|
|
44
44
|
size?: number;
|
|
45
45
|
scrollTTL?: string;
|
|
46
|
+
lang?: "koncorde" | "elasticsearch";
|
|
46
47
|
body: JSONObject;
|
|
47
48
|
}
|
|
48
49
|
export type ApiDeviceSearchResult = SearchResult<KHit<DeviceContent>>;
|
|
@@ -129,4 +130,18 @@ export type ApiDeviceGetMeasuresResult = {
|
|
|
129
130
|
measures: Array<KDocument<MeasureContent<JSONObject>>>;
|
|
130
131
|
total: number;
|
|
131
132
|
};
|
|
133
|
+
export interface ApiDeviceReceiveMeasuresRequest<TMeasureValues extends JSONObject = JSONObject> extends DevicesControllerRequest {
|
|
134
|
+
action: "receiveMeasures";
|
|
135
|
+
_id: string;
|
|
136
|
+
body: {
|
|
137
|
+
payloadUuids?: string[];
|
|
138
|
+
measures: Array<{
|
|
139
|
+
measureName: DecodedMeasurement<TMeasureValues>["measureName"];
|
|
140
|
+
measuredAt?: DecodedMeasurement<TMeasureValues>["measuredAt"];
|
|
141
|
+
type: DecodedMeasurement<TMeasureValues>["type"];
|
|
142
|
+
values: DecodedMeasurement<TMeasureValues>["values"];
|
|
143
|
+
}>;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export type ApiDeviceReceiveMeasuresResult = void;
|
|
132
147
|
export {};
|
|
@@ -6,16 +6,15 @@ import { DecodedMeasurement, MeasureContent } from "./MeasureContent";
|
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export type
|
|
9
|
+
export type AskMeasureIngest = {
|
|
10
10
|
name: "device-manager:measures:ingest";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
];
|
|
11
|
+
payload: {
|
|
12
|
+
device: KDocument<DeviceContent>;
|
|
13
|
+
measurements: DecodedMeasurement<JSONObject>[];
|
|
14
|
+
metadata: Metadata;
|
|
15
|
+
payloadUuids: string[];
|
|
16
|
+
};
|
|
17
|
+
result: void;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
20
|
* Event before starting to process new measures.
|
|
@@ -4,5 +4,5 @@ export type AskEventDefinition = {
|
|
|
4
4
|
result: any;
|
|
5
5
|
};
|
|
6
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>):
|
|
7
|
+
export declare function onAsk<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], handler: AskEventHandler<TAskEventDefinition>): any;
|
|
8
8
|
export declare function ask<TAskEventDefinition extends AskEventDefinition = AskEventDefinition>(event: TAskEventDefinition["name"], payload?: TAskEventDefinition["payload"]): Promise<TAskEventDefinition["result"]>;
|
package/package.json
CHANGED