kuzzle-device-manager-types 2.0.0-rc35 → 2.0.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/index.d.ts +7 -8
- package/dist/lib/core/DeviceManagerEngine.d.ts +2 -1
- package/dist/lib/core/DeviceManagerPlugin.d.ts +4 -4
- package/dist/lib/core/InternalCollection.d.ts +1 -0
- package/dist/lib/core/exports.d.ts +2 -0
- package/dist/lib/core/registers/ModelsRegister.d.ts +4 -3
- package/dist/lib/modules/asset/AssetHistoryService.d.ts +11 -0
- package/dist/lib/modules/asset/AssetModule.d.ts +1 -0
- package/dist/lib/modules/asset/AssetService.d.ts +11 -5
- package/dist/lib/modules/asset/collections/assetsHistoryMappings.d.ts +63 -0
- package/dist/lib/modules/asset/collections/assetsMappings.d.ts +9 -3
- package/dist/lib/modules/asset/exports.d.ts +6 -0
- package/dist/lib/modules/asset/index.d.ts +2 -0
- package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +1 -1
- package/dist/lib/modules/asset/types/AssetContent.d.ts +9 -6
- package/dist/lib/modules/asset/types/AssetEvents.d.ts +13 -0
- package/dist/lib/modules/asset/types/AssetHistoryContent.d.ts +50 -0
- package/dist/lib/modules/decoder/exports.d.ts +6 -0
- package/dist/lib/modules/device/DeviceService.d.ts +15 -8
- package/dist/lib/modules/device/exports.d.ts +6 -0
- package/dist/lib/modules/device/types/DeviceApi.d.ts +10 -7
- package/dist/lib/modules/device/types/DeviceEvents.d.ts +12 -1
- package/dist/lib/modules/measure/MeasureModule.d.ts +0 -1
- package/dist/lib/modules/measure/MeasureService.d.ts +3 -16
- package/dist/lib/modules/measure/collections/measuresMappings.d.ts +0 -23
- package/dist/lib/modules/measure/exports.d.ts +6 -0
- package/dist/lib/modules/measure/index.d.ts +0 -1
- package/dist/lib/modules/measure/roles/RoleMeasuresAdmin.d.ts +2 -7
- package/dist/lib/modules/measure/roles/RoleMeasuresReader.d.ts +1 -1
- package/dist/lib/modules/measure/types/MeasureContent.d.ts +45 -30
- package/dist/lib/modules/measure/types/MeasureEvents.d.ts +7 -0
- package/dist/lib/modules/model/ModelService.d.ts +2 -2
- package/dist/lib/modules/model/ModelsController.d.ts +4 -4
- package/dist/lib/modules/model/exports.d.ts +3 -0
- package/dist/lib/modules/model/index.d.ts +1 -0
- package/dist/lib/modules/model/types/ModelApi.d.ts +12 -15
- package/dist/lib/modules/model/types/ModelContent.d.ts +11 -10
- package/dist/lib/modules/model/types/ModelDefinition.d.ts +3 -3
- package/dist/lib/modules/shared/exports.d.ts +3 -0
- package/dist/lib/modules/shared/index.d.ts +3 -0
- package/dist/lib/modules/shared/utils/snakeCase.d.ts +7 -0
- package/package.json +1 -1
- package/dist/lib/modules/asset/roles/assetsAdmin.d.ts +0 -16
- package/dist/lib/modules/asset/roles/assetsReader.d.ts +0 -16
- package/dist/lib/modules/decoder/roles/decodersAdmin.d.ts +0 -9
- package/dist/lib/modules/device/roles/devicesAdmin.d.ts +0 -22
- package/dist/lib/modules/device/roles/devicesPlatformAdmin.d.ts +0 -16
- package/dist/lib/modules/device/roles/devicesReader.d.ts +0 -15
- package/dist/lib/modules/measure/MeasuresController.d.ts +0 -9
- package/dist/lib/modules/measure/roles/measuresAdmin.d.ts +0 -16
- package/dist/lib/modules/measure/roles/measuresReader.d.ts +0 -9
- package/dist/lib/modules/measure/types/MeasureApi.d.ts +0 -23
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from './lib/core/
|
|
2
|
-
export * from './lib/
|
|
3
|
-
export * from './lib/modules/
|
|
4
|
-
export * from './lib/modules/
|
|
5
|
-
export * from './lib/modules/
|
|
6
|
-
export * from './lib/modules/
|
|
7
|
-
export * from './lib/modules/
|
|
8
|
-
export * from './lib/modules/model';
|
|
1
|
+
export * from './lib/core/exports';
|
|
2
|
+
export * from './lib/modules/asset/exports';
|
|
3
|
+
export * from './lib/modules/device/exports';
|
|
4
|
+
export * from './lib/modules/measure/exports';
|
|
5
|
+
export * from './lib/modules/decoder/exports';
|
|
6
|
+
export * from './lib/modules/shared/exports';
|
|
7
|
+
export * from './lib/modules/model/exports';
|
|
@@ -20,9 +20,10 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
20
20
|
collections: any[];
|
|
21
21
|
}>;
|
|
22
22
|
onDelete(index: string): Promise<{
|
|
23
|
-
collections:
|
|
23
|
+
collections: InternalCollection[];
|
|
24
24
|
}>;
|
|
25
25
|
createAssetsCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
26
|
+
createAssetsHistoryCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
26
27
|
private getDigitalTwinMappings;
|
|
27
28
|
createDevicesCollection(engineId: string): Promise<InternalCollection>;
|
|
28
29
|
createMeasuresCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
|
|
@@ -1,8 +1,8 @@
|
|
|
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";
|
|
4
5
|
import { DeviceManagerConfiguration } from "./DeviceManagerConfiguration";
|
|
5
|
-
import { KuzzleRole } from "lib/modules/shared/types/KuzzleRole";
|
|
6
6
|
export declare class DeviceManagerPlugin extends Plugin {
|
|
7
7
|
config: DeviceManagerConfiguration;
|
|
8
8
|
roles: KuzzleRole[];
|
|
@@ -24,7 +24,7 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
24
24
|
*
|
|
25
25
|
* @param engineGroup Engine group name
|
|
26
26
|
* @param model Name of the asset model
|
|
27
|
-
* @param definition.
|
|
27
|
+
* @param definition.measures Array describing measures names and types
|
|
28
28
|
* @param definition.metadataMappings Metadata mappings definition
|
|
29
29
|
* @param definition.defaultMetadata Default metadata values
|
|
30
30
|
*
|
|
@@ -32,9 +32,9 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
32
32
|
* ```
|
|
33
33
|
* deviceManager.models.registerAsset(
|
|
34
34
|
* "logistic",
|
|
35
|
-
* "
|
|
35
|
+
* "Container",
|
|
36
36
|
* {
|
|
37
|
-
*
|
|
37
|
+
* measures: [
|
|
38
38
|
* { name: "temperatureExt", type: "temperature" },
|
|
39
39
|
* { name: "temperatureInt", type: "temperature" },
|
|
40
40
|
* { name: "position", type: "position" },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JSONObject } from "kuzzle";
|
|
2
|
-
import {
|
|
2
|
+
import { NamedMeasures } from "../../modules/decoder";
|
|
3
|
+
import { MeasureDefinition } from "../../modules/measure";
|
|
3
4
|
import { DeviceManagerPlugin } from "../DeviceManagerPlugin";
|
|
4
5
|
export declare class ModelsRegister {
|
|
5
6
|
private config;
|
|
@@ -10,8 +11,8 @@ export declare class ModelsRegister {
|
|
|
10
11
|
private get sdk();
|
|
11
12
|
init(plugin: DeviceManagerPlugin): void;
|
|
12
13
|
loadModels(): Promise<void>;
|
|
13
|
-
registerAsset(engineGroup: string, model: string,
|
|
14
|
-
registerDevice(model: string, measures:
|
|
14
|
+
registerAsset(engineGroup: string, model: string, measures: NamedMeasures, metadataMappings?: JSONObject, defaultMetadata?: JSONObject): void;
|
|
15
|
+
registerDevice(model: string, measures: NamedMeasures, metadataMappings?: JSONObject, defaultMetadata?: JSONObject): void;
|
|
15
16
|
registerMeasure(type: string, measureDefinition: MeasureDefinition): void;
|
|
16
17
|
private load;
|
|
17
18
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { KDocument } from "kuzzle";
|
|
2
|
+
import { DeviceManagerPlugin } from "../../core";
|
|
3
|
+
import { AssetHistoryEvent } from "./types/AssetHistoryContent";
|
|
4
|
+
import { AssetContent } from "./types/AssetContent";
|
|
5
|
+
export declare class AssetHistoryService {
|
|
6
|
+
private context;
|
|
7
|
+
private config;
|
|
8
|
+
private get sdk();
|
|
9
|
+
constructor(plugin: DeviceManagerPlugin);
|
|
10
|
+
add<TAssetHistoryEvent extends AssetHistoryEvent>(engineId: string, event: TAssetHistoryEvent, asset: KDocument<AssetContent>): Promise<void>;
|
|
11
|
+
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { JSONObject, KDocument, KHit, SearchResult } from "kuzzle";
|
|
1
|
+
import { JSONObject, KDocument, KHit, SearchResult, User } from "kuzzle";
|
|
2
2
|
import { MeasureContent } from "../measure/";
|
|
3
3
|
import { Metadata } from "../shared";
|
|
4
4
|
import { DeviceManagerPlugin } from "../../core";
|
|
5
5
|
import { AssetContent } from "./types/AssetContent";
|
|
6
|
+
import { AssetHistoryService } from "./AssetHistoryService";
|
|
6
7
|
export declare class AssetService {
|
|
7
8
|
private context;
|
|
8
9
|
private config;
|
|
10
|
+
private assetHistoryService;
|
|
9
11
|
private get sdk();
|
|
10
12
|
private get app();
|
|
11
|
-
|
|
13
|
+
private get impersonatedSdk();
|
|
14
|
+
constructor(plugin: DeviceManagerPlugin, assetHistoryService: AssetHistoryService);
|
|
12
15
|
/**
|
|
13
16
|
* Returns measures history for an asset
|
|
14
17
|
*
|
|
@@ -24,13 +27,16 @@ export declare class AssetService {
|
|
|
24
27
|
endAt?: string;
|
|
25
28
|
}): Promise<KDocument<MeasureContent>[]>;
|
|
26
29
|
get(engineId: string, assetId: string): Promise<KDocument<AssetContent>>;
|
|
27
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Updates an asset metadata
|
|
32
|
+
*/
|
|
33
|
+
update(user: User, engineId: string, assetId: string, metadata: Metadata, { refresh }: {
|
|
28
34
|
refresh: any;
|
|
29
35
|
}): Promise<KDocument<AssetContent>>;
|
|
30
|
-
create(engineId: string, model: string, reference: string, metadata: JSONObject, { refresh }: {
|
|
36
|
+
create(user: User, engineId: string, model: string, reference: string, metadata: JSONObject, { refresh }: {
|
|
31
37
|
refresh: any;
|
|
32
38
|
}): Promise<KDocument<AssetContent>>;
|
|
33
|
-
delete(engineId: string, assetId: string, { refresh, strict }: {
|
|
39
|
+
delete(user: User, engineId: string, assetId: string, { refresh, strict }: {
|
|
34
40
|
refresh: any;
|
|
35
41
|
strict: boolean;
|
|
36
42
|
}): Promise<void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const assetsHistoryMappings: {
|
|
2
|
+
dynamic: string;
|
|
3
|
+
properties: {
|
|
4
|
+
event: {
|
|
5
|
+
properties: {
|
|
6
|
+
name: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
measure: {
|
|
10
|
+
properties: {
|
|
11
|
+
names: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
metadata: {
|
|
17
|
+
properties: {
|
|
18
|
+
names: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
link: {
|
|
24
|
+
properties: {
|
|
25
|
+
deviceId: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
unlink: {
|
|
31
|
+
properties: {
|
|
32
|
+
deviceId: {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
id: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
asset: {
|
|
43
|
+
properties: {
|
|
44
|
+
_kuzzle_info: {
|
|
45
|
+
properties: {
|
|
46
|
+
author: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
createdAt: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
updatedAt: {
|
|
53
|
+
type: string;
|
|
54
|
+
};
|
|
55
|
+
updater: {
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -28,9 +28,15 @@ export declare const assetsMappings: {
|
|
|
28
28
|
_id: {
|
|
29
29
|
type: string;
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
measureNames: {
|
|
32
|
+
properties: {
|
|
33
|
+
asset: {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
device: {
|
|
37
|
+
type: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
34
40
|
};
|
|
35
41
|
};
|
|
36
42
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from "./collections/assetsMappings";
|
|
2
|
+
export * from "./collections/assetsHistoryMappings";
|
|
2
3
|
export * from "./types/AssetContent";
|
|
4
|
+
export * from "./types/AssetHistoryContent";
|
|
3
5
|
export * from "./types/AssetEvents";
|
|
4
6
|
export * from "./types/AssetApi";
|
|
5
7
|
export * from "./model/AssetSerializer";
|
|
@@ -13,17 +13,20 @@ export interface AssetContent<TMeasures extends JSONObject = any, TMetadata exte
|
|
|
13
13
|
*/
|
|
14
14
|
_id: string;
|
|
15
15
|
/**
|
|
16
|
-
* Names
|
|
16
|
+
* Names of the linked measures
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Array<{ asset: string, device: string }>
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
* "
|
|
24
|
-
*
|
|
22
|
+
* [
|
|
23
|
+
* { asset: "externalTemperature", device: "temperature" }
|
|
24
|
+
* ]
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
measureNames: Array<{
|
|
27
|
+
asset: string;
|
|
28
|
+
device: string;
|
|
29
|
+
}>;
|
|
27
30
|
}>;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KDocument } from "kuzzle";
|
|
2
2
|
import { Metadata } from "../../../modules/shared";
|
|
3
3
|
import { AssetContent } from "./AssetContent";
|
|
4
|
+
import { AssetHistoryEvent } from "./AssetHistoryContent";
|
|
4
5
|
export type EventAssetUpdateBefore = {
|
|
5
6
|
name: "device-manager:asset:update:before";
|
|
6
7
|
args: [{
|
|
@@ -15,3 +16,15 @@ export type EventAssetUpdateAfter = {
|
|
|
15
16
|
metadata: Metadata;
|
|
16
17
|
}];
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export type AskAssetHistoryAdd<TAssetHistoryEvent extends AssetHistoryEvent> = {
|
|
23
|
+
name: "ask:device-manager:asset:history:add";
|
|
24
|
+
payload: {
|
|
25
|
+
engineId: string;
|
|
26
|
+
event: TAssetHistoryEvent;
|
|
27
|
+
asset: KDocument<AssetContent>;
|
|
28
|
+
};
|
|
29
|
+
result: void;
|
|
30
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { JSONObject, KDocumentContent } from "kuzzle";
|
|
2
|
+
import { Metadata } from "../../shared";
|
|
3
|
+
import { AssetContent } from "./AssetContent";
|
|
4
|
+
export type AssetHistoryEventMeasure = {
|
|
5
|
+
name: "measure";
|
|
6
|
+
measure: {
|
|
7
|
+
names: string[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type AssetHistoryEventMetadata = {
|
|
11
|
+
name: "metadata";
|
|
12
|
+
metadata: {
|
|
13
|
+
names: string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type AssetHistoryEventLink = {
|
|
17
|
+
name: "link";
|
|
18
|
+
link: {
|
|
19
|
+
deviceId: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type AssetHistoryEventUnlink = {
|
|
23
|
+
name: "unlink";
|
|
24
|
+
unlink: {
|
|
25
|
+
deviceId: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type AssetHistoryEvent = AssetHistoryEventMeasure | AssetHistoryEventMetadata | AssetHistoryEventLink | AssetHistoryEventUnlink;
|
|
29
|
+
/**
|
|
30
|
+
* Asset History document content
|
|
31
|
+
*/
|
|
32
|
+
export interface AssetHistoryContent<TAssetHistoryEvent extends AssetHistoryEvent = any, TMeasures extends JSONObject = any, TMetadata extends Metadata = any> extends KDocumentContent {
|
|
33
|
+
/**
|
|
34
|
+
* Name of the event who caused the historization
|
|
35
|
+
*
|
|
36
|
+
* - `measure` a new measure has been received
|
|
37
|
+
* - `metadata` the asset metadata has been updated
|
|
38
|
+
* - `link` a device has been linked or unlinked to the asset
|
|
39
|
+
* - `unlink` a device has been unlinked from the asset
|
|
40
|
+
*/
|
|
41
|
+
event: TAssetHistoryEvent;
|
|
42
|
+
/**
|
|
43
|
+
* ID of the historized asset
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
/**
|
|
47
|
+
* Asset content after the event
|
|
48
|
+
*/
|
|
49
|
+
asset: AssetContent<TMeasures, TMetadata>;
|
|
50
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { JSONObject, KDocument, KHit, Plugin, SearchResult } from "kuzzle";
|
|
1
|
+
import { JSONObject, KDocument, KHit, Plugin, SearchResult, User } from "kuzzle";
|
|
2
2
|
import { AssetContent } from "./../asset";
|
|
3
3
|
import { Metadata } from "../shared";
|
|
4
4
|
import { DeviceContent } from "./types/DeviceContent";
|
|
5
|
+
import { ApiDeviceLinkAssetRequest } from "./exports";
|
|
5
6
|
export declare class DeviceService {
|
|
6
7
|
private config;
|
|
7
8
|
private context;
|
|
8
9
|
private get sdk();
|
|
9
10
|
private get app();
|
|
11
|
+
private get impersonatedSdk();
|
|
10
12
|
constructor(plugin: Plugin);
|
|
11
13
|
/**
|
|
12
14
|
* Create a new device.
|
|
@@ -15,15 +17,15 @@ export declare class DeviceService {
|
|
|
15
17
|
* method since in this case "engineId" is not really an engine ID but still
|
|
16
18
|
* required as an argument (in part to check the tenant rights)
|
|
17
19
|
*/
|
|
18
|
-
create(model: string, reference: string, metadata: JSONObject, { engineId, refresh, }?: {
|
|
20
|
+
create(user: User, model: string, reference: string, metadata: JSONObject, { engineId, refresh, }?: {
|
|
19
21
|
engineId?: string;
|
|
20
22
|
refresh?: any;
|
|
21
23
|
}): Promise<KDocument<DeviceContent>>;
|
|
22
24
|
get(index: string, deviceId: string): Promise<KDocument<DeviceContent>>;
|
|
23
|
-
update(engineId: string, deviceId: string, metadata: Metadata, { refresh }: {
|
|
25
|
+
update(user: User, engineId: string, deviceId: string, metadata: Metadata, { refresh }: {
|
|
24
26
|
refresh: any;
|
|
25
27
|
}): Promise<KDocument<DeviceContent>>;
|
|
26
|
-
delete(engineId: string, deviceId: string, { refresh }: {
|
|
28
|
+
delete(user: User, engineId: string, deviceId: string, { refresh }: {
|
|
27
29
|
refresh: any;
|
|
28
30
|
}): Promise<void>;
|
|
29
31
|
search(engineId: string, searchBody: JSONObject, { from, size, scroll, lang, }: {
|
|
@@ -40,7 +42,7 @@ export declare class DeviceService {
|
|
|
40
42
|
* @param options.refresh Wait for ES indexation
|
|
41
43
|
* @param options.strict If true, throw if an operation isn't possible
|
|
42
44
|
*/
|
|
43
|
-
attachEngine(engineId: string, deviceId: string, { refresh }?: {
|
|
45
|
+
attachEngine(user: User, engineId: string, deviceId: string, { refresh }?: {
|
|
44
46
|
refresh?: any;
|
|
45
47
|
}): Promise<KDocument<DeviceContent>>;
|
|
46
48
|
/**
|
|
@@ -49,25 +51,30 @@ export declare class DeviceService {
|
|
|
49
51
|
* @param deviceId Device id
|
|
50
52
|
* @param options.refresh Wait for ES indexation
|
|
51
53
|
*/
|
|
52
|
-
detachEngine(deviceId: string, { refresh }?: {
|
|
54
|
+
detachEngine(user: User, deviceId: string, { refresh }?: {
|
|
53
55
|
refresh?: any;
|
|
54
56
|
}): Promise<KDocument<DeviceContent>>;
|
|
55
57
|
/**
|
|
56
58
|
* Link a device to an asset.
|
|
57
59
|
*/
|
|
58
|
-
linkAsset(engineId: string, deviceId: string, assetId: string,
|
|
60
|
+
linkAsset(user: User, engineId: string, deviceId: string, assetId: string, measureNames: ApiDeviceLinkAssetRequest["body"]["measureNames"], { refresh }?: {
|
|
59
61
|
refresh?: any;
|
|
60
62
|
}): Promise<{
|
|
61
63
|
asset: KDocument<AssetContent>;
|
|
62
64
|
device: KDocument<DeviceContent>;
|
|
63
65
|
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the asset does not already have a linked device using one of the
|
|
68
|
+
* requested measure names.
|
|
69
|
+
*/
|
|
70
|
+
private checkAssetMeasureNamesAvailability;
|
|
64
71
|
/**
|
|
65
72
|
* Unlink a device of an asset
|
|
66
73
|
*
|
|
67
74
|
* @param deviceId Id of the device
|
|
68
75
|
* @param options.refresh Wait for ES indexation
|
|
69
76
|
*/
|
|
70
|
-
unlinkAsset(deviceId: string, { refresh }?: {
|
|
77
|
+
unlinkAsset(user: User, deviceId: string, { refresh }?: {
|
|
71
78
|
refresh?: any;
|
|
72
79
|
}): Promise<{
|
|
73
80
|
asset: KDocument<AssetContent>;
|
|
@@ -72,19 +72,22 @@ export interface ApiDeviceLinkAssetRequest extends DevicesControllerRequest {
|
|
|
72
72
|
_id: string;
|
|
73
73
|
refresh?: string;
|
|
74
74
|
assetId: string;
|
|
75
|
-
body
|
|
75
|
+
body?: {
|
|
76
76
|
/**
|
|
77
|
-
* Names
|
|
77
|
+
* Names of the linked measures
|
|
78
78
|
*
|
|
79
|
-
*
|
|
79
|
+
* Array<{ asset: string, device: string }>
|
|
80
80
|
*
|
|
81
81
|
* @example
|
|
82
82
|
*
|
|
83
|
-
*
|
|
84
|
-
* "
|
|
85
|
-
*
|
|
83
|
+
* [
|
|
84
|
+
* { asset: "externalTemperature", device: "temperature" }
|
|
85
|
+
* ]
|
|
86
86
|
*/
|
|
87
|
-
measureNames:
|
|
87
|
+
measureNames: Array<{
|
|
88
|
+
asset: string;
|
|
89
|
+
device: string;
|
|
90
|
+
}>;
|
|
88
91
|
};
|
|
89
92
|
}
|
|
90
93
|
export type ApiDeviceLinkAssetResult = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KDocument } from "kuzzle";
|
|
1
|
+
import { KDocument, User } from "kuzzle";
|
|
2
2
|
import { Metadata } from "../../../modules/shared";
|
|
3
3
|
import { DeviceContent } from "./DeviceContent";
|
|
4
4
|
export type EventDeviceUpdateBefore = {
|
|
@@ -15,3 +15,14 @@ export type EventDeviceUpdateAfter = {
|
|
|
15
15
|
metadata: Metadata;
|
|
16
16
|
}];
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export type AskDeviceUnlinkAsset = {
|
|
22
|
+
name: "ask:device-manager:device:unlink-asset";
|
|
23
|
+
payload: {
|
|
24
|
+
deviceId: string;
|
|
25
|
+
user: User;
|
|
26
|
+
};
|
|
27
|
+
result: void;
|
|
28
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { JSONObject, KDocument } from "kuzzle";
|
|
2
2
|
import { DeviceManagerPlugin } from "../../core";
|
|
3
3
|
import { DeviceContent } from "./../device";
|
|
4
|
-
import { AssetContent } from "../asset";
|
|
5
4
|
import { Metadata } from "../shared";
|
|
6
5
|
import { DecodedMeasurement } from "./types/MeasureContent";
|
|
7
|
-
import { ApiMeasurePushRequest } from "./types/MeasureApi";
|
|
8
6
|
export declare class MeasureService {
|
|
9
7
|
private config;
|
|
10
8
|
private context;
|
|
@@ -27,24 +25,13 @@ export declare class MeasureService {
|
|
|
27
25
|
* - trigger events to trigger business rules
|
|
28
26
|
*/
|
|
29
27
|
ingest(device: KDocument<DeviceContent>, measurements: DecodedMeasurement<JSONObject>[], metadata: Metadata, payloadUuids: string[]): Promise<void>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
private updateEmbeddedMeasures;
|
|
28
|
+
private compareMetadata;
|
|
29
|
+
private updateDeviceMeasures;
|
|
30
|
+
private updateAssetMeasures;
|
|
34
31
|
/**
|
|
35
32
|
* Build the measures documents to save
|
|
36
33
|
*/
|
|
37
34
|
private buildMeasures;
|
|
38
|
-
/**
|
|
39
|
-
* Register new measures from a device, updates :
|
|
40
|
-
* - linked asset
|
|
41
|
-
* - engine measures
|
|
42
|
-
*
|
|
43
|
-
* The `measuredAt` of the measures will be set automatically if not setted
|
|
44
|
-
*/
|
|
45
|
-
registerByAsset(engineId: string, assetId: string, measureInfo: ApiMeasurePushRequest["body"]["measure"], kuid: string, { refresh }?: {
|
|
46
|
-
refresh?: any;
|
|
47
|
-
}): Promise<KDocument<AssetContent>>;
|
|
48
35
|
private tryGetLinkedAsset;
|
|
49
36
|
/**
|
|
50
37
|
* Retrieve the measure name for the asset
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
export declare const measuresMappings: {
|
|
2
2
|
dynamic: string;
|
|
3
3
|
properties: {
|
|
4
|
-
/**
|
|
5
|
-
* Type of the measure. (e.g. "temperature")
|
|
6
|
-
* The type name is also the name of the sub-property to look at
|
|
7
|
-
* in the "values" object to get the measure main value.
|
|
8
|
-
*/
|
|
9
4
|
type: {
|
|
10
5
|
type: string;
|
|
11
6
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Property containing the actual measurement.
|
|
14
|
-
*
|
|
15
|
-
* This should be specialized by child interfaces.
|
|
16
|
-
*/
|
|
17
7
|
values: {
|
|
18
8
|
properties: {};
|
|
19
9
|
};
|
|
@@ -47,20 +37,12 @@ export declare const measuresMappings: {
|
|
|
47
37
|
*/
|
|
48
38
|
origin: {
|
|
49
39
|
properties: {
|
|
50
|
-
/**
|
|
51
|
-
* From what the measure has been pushed. Can be:
|
|
52
|
-
* - 'asset'
|
|
53
|
-
* - 'device'
|
|
54
|
-
*/
|
|
55
40
|
type: {
|
|
56
41
|
type: string;
|
|
57
42
|
};
|
|
58
43
|
measureName: {
|
|
59
44
|
type: string;
|
|
60
45
|
};
|
|
61
|
-
/**
|
|
62
|
-
* Array of payloads uuids that were used to create this measure.
|
|
63
|
-
*/
|
|
64
46
|
payloadUuids: {
|
|
65
47
|
type: string;
|
|
66
48
|
};
|
|
@@ -70,11 +52,6 @@ export declare const measuresMappings: {
|
|
|
70
52
|
reference: {
|
|
71
53
|
type: string;
|
|
72
54
|
};
|
|
73
|
-
/**
|
|
74
|
-
* ID of the origin. Can be:
|
|
75
|
-
* - device id if origin type is `device`
|
|
76
|
-
* - user id if origin type is `asset`
|
|
77
|
-
*/
|
|
78
55
|
_id: {
|
|
79
56
|
type: string;
|
|
80
57
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { KuzzleRole } from "
|
|
1
|
+
import { KuzzleRole } from "../../shared/types/KuzzleRole";
|
|
2
2
|
/**
|
|
3
|
-
* This role allows to
|
|
3
|
+
* This role allows to manage measure models.
|
|
4
4
|
*
|
|
5
5
|
* It's a tenant role.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
"device-manager/measures": {
|
|
9
|
-
actions: {
|
|
10
|
-
"*": true,
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
8
|
"device-manager/models": {
|
|
14
9
|
actions: {
|
|
15
10
|
deleteMeasure: true,
|
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
import { JSONObject, KDocumentContent } from "kuzzle";
|
|
2
2
|
import { Metadata } from "../../../modules/shared";
|
|
3
3
|
import { AssetMeasureContext } from "../../../modules/asset";
|
|
4
|
+
export type MeasureOriginDevice = {
|
|
5
|
+
/**
|
|
6
|
+
* Origin of the measure
|
|
7
|
+
*/
|
|
8
|
+
type: "device";
|
|
9
|
+
/**
|
|
10
|
+
* Name of the measure in the device
|
|
11
|
+
*/
|
|
12
|
+
measureName: string;
|
|
13
|
+
/**
|
|
14
|
+
* Payload uuids that were used to create this measure.
|
|
15
|
+
*/
|
|
16
|
+
payloadUuids: Array<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Model of the device
|
|
19
|
+
*
|
|
20
|
+
* @example "AbeewayTemp"
|
|
21
|
+
*/
|
|
22
|
+
deviceModel: string;
|
|
23
|
+
/**
|
|
24
|
+
* Reference of the device
|
|
25
|
+
*/
|
|
26
|
+
reference: string;
|
|
27
|
+
/**
|
|
28
|
+
* Device ID
|
|
29
|
+
*/
|
|
30
|
+
_id: string;
|
|
31
|
+
};
|
|
32
|
+
export type MeasureOriginComputed = {
|
|
33
|
+
type: "computed";
|
|
34
|
+
/**
|
|
35
|
+
* String that identify the rule used to compute the measure
|
|
36
|
+
*/
|
|
37
|
+
_id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Name of the measure
|
|
40
|
+
*/
|
|
41
|
+
measureName: string;
|
|
42
|
+
/**
|
|
43
|
+
* Payload uuids that were used to create this measure for traceability.
|
|
44
|
+
*/
|
|
45
|
+
payloadUuids: Array<string>;
|
|
46
|
+
};
|
|
47
|
+
export type MeasureOrigin = MeasureOriginDevice | MeasureOriginComputed;
|
|
4
48
|
/**
|
|
5
49
|
* Represents the content of a measure document.
|
|
6
50
|
*/
|
|
@@ -12,36 +56,7 @@ export interface MeasureContent<TMeasureValues extends JSONObject = any, TMetada
|
|
|
12
56
|
/**
|
|
13
57
|
* Define the origin of the measure.
|
|
14
58
|
*/
|
|
15
|
-
origin:
|
|
16
|
-
/**
|
|
17
|
-
* Name of the measure (e.g. from the Device)
|
|
18
|
-
*/
|
|
19
|
-
measureName: string;
|
|
20
|
-
/**
|
|
21
|
-
* Type of the origin
|
|
22
|
-
*/
|
|
23
|
-
type: "user" | "device";
|
|
24
|
-
/**
|
|
25
|
-
* Payload uuids that were used to create this measure.
|
|
26
|
-
*/
|
|
27
|
-
payloadUuids?: Array<string>;
|
|
28
|
-
/**
|
|
29
|
-
* Model of the device
|
|
30
|
-
*
|
|
31
|
-
* @example "AbeewayTemp"
|
|
32
|
-
*/
|
|
33
|
-
deviceModel?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Reference of the device
|
|
36
|
-
*/
|
|
37
|
-
reference?: string;
|
|
38
|
-
/**
|
|
39
|
-
* ID of the origin. Can be:
|
|
40
|
-
* - device id if origin type is `device`
|
|
41
|
-
* - kuid of the request if origin type is `user`
|
|
42
|
-
*/
|
|
43
|
-
_id?: string;
|
|
44
|
-
};
|
|
59
|
+
origin: MeasureOrigin;
|
|
45
60
|
}
|
|
46
61
|
export type Measurement<TMeasureValues extends JSONObject = any> = {
|
|
47
62
|
/**
|
|
@@ -17,6 +17,13 @@ export type EventMeasureIngest = {
|
|
|
17
17
|
}
|
|
18
18
|
];
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Event before starting to process new measures.
|
|
22
|
+
*
|
|
23
|
+
* Useful to enrich measures before they are saved.
|
|
24
|
+
*
|
|
25
|
+
* Only measures documents can be modified
|
|
26
|
+
*/
|
|
20
27
|
export type EventMeasureProcessBefore = {
|
|
21
28
|
name: "device-manager:measures:process:before";
|
|
22
29
|
args: [
|
|
@@ -7,9 +7,9 @@ export declare class ModelService {
|
|
|
7
7
|
private get sdk();
|
|
8
8
|
constructor(plugin: DeviceManagerPlugin);
|
|
9
9
|
registerAskEvents(): void;
|
|
10
|
-
writeAsset(engineGroup: string, model: string, metadataMappings: JSONObject, defaultMetadata: JSONObject, measures:
|
|
10
|
+
writeAsset(engineGroup: string, model: string, metadataMappings: JSONObject, defaultMetadata: JSONObject, measures: AssetModelContent["asset"]["measures"]): Promise<KDocument<AssetModelContent>>;
|
|
11
11
|
private checkDefaultValues;
|
|
12
|
-
writeDevice(model: string, metadataMappings: JSONObject, defaultMetadata: JSONObject, measures:
|
|
12
|
+
writeDevice(model: string, metadataMappings: JSONObject, defaultMetadata: JSONObject, measures: DeviceModelContent["device"]["measures"]): Promise<KDocument<DeviceModelContent>>;
|
|
13
13
|
writeMeasure(type: string, valuesMappings: JSONObject): Promise<KDocument<MeasureModelContent>>;
|
|
14
14
|
deleteAsset(_id: string): Promise<void>;
|
|
15
15
|
deleteDevice(_id: string): Promise<void>;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ControllerDefinition, KuzzleRequest } from "kuzzle";
|
|
2
2
|
import { ModelService } from "./ModelService";
|
|
3
|
-
import {
|
|
3
|
+
import { ApiModelWriteAssetResult, ApiModelWriteDeviceResult, ApiModelWriteMeasureResult, ApiModelDeleteAssetResult, ApiModelDeleteDeviceResult, ApiModelDeleteMeasureResult, ApiModelListAssetsResult, ApiModelListDevicesResult, ApiModelListMeasuresResult } from "./types/ModelApi";
|
|
4
4
|
export declare class ModelsController {
|
|
5
5
|
private modelService;
|
|
6
6
|
definition: ControllerDefinition;
|
|
7
7
|
constructor(modelService: ModelService);
|
|
8
|
-
writeAsset(request: KuzzleRequest): Promise<
|
|
9
|
-
writeDevice(request: KuzzleRequest): Promise<
|
|
10
|
-
writeMeasure(request: KuzzleRequest): Promise<
|
|
8
|
+
writeAsset(request: KuzzleRequest): Promise<ApiModelWriteAssetResult>;
|
|
9
|
+
writeDevice(request: KuzzleRequest): Promise<ApiModelWriteDeviceResult>;
|
|
10
|
+
writeMeasure(request: KuzzleRequest): Promise<ApiModelWriteMeasureResult>;
|
|
11
11
|
deleteAsset(request: KuzzleRequest): Promise<ApiModelDeleteAssetResult>;
|
|
12
12
|
deleteDevice(request: KuzzleRequest): Promise<ApiModelDeleteDeviceResult>;
|
|
13
13
|
deleteMeasure(request: KuzzleRequest): Promise<ApiModelDeleteMeasureResult>;
|
|
@@ -2,5 +2,6 @@ export * from "./collections/modelsMappings";
|
|
|
2
2
|
export * from "./types/ModelApi";
|
|
3
3
|
export * from "./types/ModelContent";
|
|
4
4
|
export * from "./types/ModelDefinition";
|
|
5
|
+
export * from "./types/ModelEvents";
|
|
5
6
|
export * from "./ModelModule";
|
|
6
7
|
export * from "./ModelSerializer";
|
|
@@ -3,38 +3,35 @@ import { AssetModelContent, DeviceModelContent, MeasureModelContent } from "./Mo
|
|
|
3
3
|
interface ModelsControllerRequest {
|
|
4
4
|
controller: "device-manager/models";
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface ApiModelWriteAssetRequest extends ModelsControllerRequest {
|
|
7
7
|
action: "writeAsset";
|
|
8
8
|
body: {
|
|
9
9
|
engineGroup: string;
|
|
10
10
|
model: string;
|
|
11
|
-
metadataMappings
|
|
12
|
-
defaultValues
|
|
11
|
+
metadataMappings?: JSONObject;
|
|
12
|
+
defaultValues?: JSONObject;
|
|
13
|
+
measures?: AssetModelContent["asset"]["measures"];
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
export type
|
|
16
|
-
export interface
|
|
16
|
+
export type ApiModelWriteAssetResult = KDocument<AssetModelContent>;
|
|
17
|
+
export interface ApiModelWriteDeviceRequest extends ModelsControllerRequest {
|
|
17
18
|
action: "writeDevice";
|
|
18
19
|
body: {
|
|
19
20
|
model: string;
|
|
20
|
-
metadataMappings
|
|
21
|
-
defaultValues
|
|
21
|
+
metadataMappings?: JSONObject;
|
|
22
|
+
defaultValues?: JSONObject;
|
|
23
|
+
measures: DeviceModelContent["device"]["measures"];
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
|
-
export type
|
|
25
|
-
export interface
|
|
26
|
+
export type ApiModelWriteDeviceResult = KDocument<DeviceModelContent>;
|
|
27
|
+
export interface ApiModelWriteMeasureRequest extends ModelsControllerRequest {
|
|
26
28
|
action: "writeMeasure";
|
|
27
29
|
body: {
|
|
28
30
|
type: string;
|
|
29
|
-
unit: {
|
|
30
|
-
name: string;
|
|
31
|
-
sign: string;
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
34
31
|
valuesMappings: JSONObject;
|
|
35
32
|
};
|
|
36
33
|
}
|
|
37
|
-
export type
|
|
34
|
+
export type ApiModelWriteMeasureResult = KDocument<MeasureModelContent>;
|
|
38
35
|
export interface ApiModelDeleteAssetRequest extends ModelsControllerRequest {
|
|
39
36
|
action: "deleteAsset";
|
|
40
37
|
_id: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JSONObject, KDocumentContent } from "kuzzle";
|
|
2
|
+
import { NamedMeasures } from "../../../modules/decoder";
|
|
2
3
|
import { MeasureDefinition } from "../../measure";
|
|
3
4
|
export interface MeasureModelContent extends KDocumentContent {
|
|
4
5
|
type: "measure";
|
|
@@ -39,15 +40,15 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
39
40
|
/**
|
|
40
41
|
* List of accepted measures for this model
|
|
41
42
|
*
|
|
42
|
-
*
|
|
43
|
+
* Array<{ type: string, name: string }>
|
|
43
44
|
*
|
|
44
45
|
* @example
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
-
* "
|
|
48
|
-
*
|
|
47
|
+
* [
|
|
48
|
+
* { type: "temperature", name: "externalTemperature" }
|
|
49
|
+
* ]
|
|
49
50
|
*/
|
|
50
|
-
measures:
|
|
51
|
+
measures: NamedMeasures;
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
export interface DeviceModelContent extends KDocumentContent {
|
|
@@ -82,15 +83,15 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
82
83
|
/**
|
|
83
84
|
* List of decoded measures for this model
|
|
84
85
|
*
|
|
85
|
-
*
|
|
86
|
+
* Array<{ type: string, name: string }>
|
|
86
87
|
*
|
|
87
88
|
* @example
|
|
88
89
|
*
|
|
89
|
-
*
|
|
90
|
-
* "
|
|
91
|
-
*
|
|
90
|
+
* [
|
|
91
|
+
* { type: "temperature", name: "externalTemperature" }
|
|
92
|
+
* ]
|
|
92
93
|
*/
|
|
93
|
-
measures:
|
|
94
|
+
measures: NamedMeasures;
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
97
|
export type ModelContent = MeasureModelContent | AssetModelContent | DeviceModelContent;
|
|
@@ -5,7 +5,7 @@ import { Decoder, NamedMeasures } from "../../../modules/decoder";
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
*
|
|
8
|
+
* measures: [
|
|
9
9
|
* { name: "temperatureExt", type: "temperature" },
|
|
10
10
|
* { name: "temperatureInt", type: "temperature" },
|
|
11
11
|
* { name: "position", type: "position" },
|
|
@@ -24,11 +24,11 @@ export type AssetModelDefinition = {
|
|
|
24
24
|
/**
|
|
25
25
|
* Array describing measures names and types
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
measures: NamedMeasures;
|
|
28
28
|
/**
|
|
29
29
|
* Metadata mappings definition
|
|
30
30
|
*/
|
|
31
|
-
metadataMappings
|
|
31
|
+
metadataMappings?: JSONObject;
|
|
32
32
|
/**
|
|
33
33
|
* Default metadata values
|
|
34
34
|
*/
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from "./types/DigitalTwinContent";
|
|
2
2
|
export * from "./types/Metadata";
|
|
3
3
|
export * from "./types/EmbeddedMeasure";
|
|
4
|
+
export * from "./types/KuzzleRole";
|
|
4
5
|
export * from "./utils/lock";
|
|
5
6
|
export * from "./utils/flattenObject";
|
|
6
7
|
export * from "./utils/ask";
|
|
8
|
+
export * from "./utils/snakeCase";
|
|
9
|
+
export * from "./Module";
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const assetsAdmin: {
|
|
2
|
-
controllers: {
|
|
3
|
-
"device-manager/assets": {
|
|
4
|
-
actions: {
|
|
5
|
-
"*": boolean;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
"device-manager/models": {
|
|
9
|
-
actions: {
|
|
10
|
-
deleteAsset: boolean;
|
|
11
|
-
listAssets: boolean;
|
|
12
|
-
writeAsset: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const assetsReader: {
|
|
2
|
-
controllers: {
|
|
3
|
-
"device-manager/assets": {
|
|
4
|
-
actions: {
|
|
5
|
-
get: boolean;
|
|
6
|
-
getMeasures: boolean;
|
|
7
|
-
search: boolean;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
"device-manager/models": {
|
|
11
|
-
actions: {
|
|
12
|
-
listAssets: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const devicesAdmin: {
|
|
2
|
-
controllers: {
|
|
3
|
-
"device-manager/devices": {
|
|
4
|
-
actions: {
|
|
5
|
-
create: boolean;
|
|
6
|
-
delete: boolean;
|
|
7
|
-
get: boolean;
|
|
8
|
-
linkAsset: boolean;
|
|
9
|
-
search: boolean;
|
|
10
|
-
unlinkAsset: boolean;
|
|
11
|
-
update: boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
"device-manager/models": {
|
|
15
|
-
actions: {
|
|
16
|
-
deleteDevice: boolean;
|
|
17
|
-
listDevices: boolean;
|
|
18
|
-
writeDevice: boolean;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const devicesPlatformAdmin: {
|
|
2
|
-
controllers: {
|
|
3
|
-
"device-manager/devices": {
|
|
4
|
-
actions: {
|
|
5
|
-
"*": boolean;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
"device-manager/models": {
|
|
9
|
-
actions: {
|
|
10
|
-
deleteDevice: boolean;
|
|
11
|
-
listDevices: boolean;
|
|
12
|
-
writeDevice: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ControllerDefinition, KuzzleRequest } from "kuzzle";
|
|
2
|
-
import { MeasureService } from "./MeasureService";
|
|
3
|
-
import { ApiMeasurePushResult } from "./types/MeasureApi";
|
|
4
|
-
export declare class MeasuresController {
|
|
5
|
-
private measureService;
|
|
6
|
-
definition: ControllerDefinition;
|
|
7
|
-
constructor(measureService: MeasureService);
|
|
8
|
-
push(request: KuzzleRequest): Promise<ApiMeasurePushResult>;
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare const measuresAdmin: {
|
|
2
|
-
controllers: {
|
|
3
|
-
"device-manager/measures": {
|
|
4
|
-
actions: {
|
|
5
|
-
"*": boolean;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
"device-manager/models": {
|
|
9
|
-
actions: {
|
|
10
|
-
deleteMeasure: boolean;
|
|
11
|
-
listMeasures: boolean;
|
|
12
|
-
writeMeasure: boolean;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { JSONObject, KDocument } from "kuzzle";
|
|
2
|
-
import { AssetContent } from "../../../modules/asset";
|
|
3
|
-
interface MeasuresControllerRequest {
|
|
4
|
-
controller: "device-manager/measures";
|
|
5
|
-
engineId: string;
|
|
6
|
-
}
|
|
7
|
-
export interface ApiMeasurePushRequest extends MeasuresControllerRequest {
|
|
8
|
-
action: "push";
|
|
9
|
-
refresh?: string;
|
|
10
|
-
body: {
|
|
11
|
-
assetId: string;
|
|
12
|
-
measure: {
|
|
13
|
-
name: string;
|
|
14
|
-
type: string;
|
|
15
|
-
measuredAt?: number;
|
|
16
|
-
values: JSONObject;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export type ApiMeasurePushResult = {
|
|
21
|
-
asset: KDocument<AssetContent>;
|
|
22
|
-
};
|
|
23
|
-
export {};
|