kuzzle-device-manager-types 2.4.0-beta.2 → 2.4.0-beta.21
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/asset/AssetHistoryService.d.ts +2 -4
- package/dist/lib/modules/asset/AssetService.d.ts +25 -26
- package/dist/lib/modules/asset/AssetsController.d.ts +8 -1
- package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +4 -0
- package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsConfiguration.d.ts +8 -0
- package/dist/lib/modules/asset/roles/specificRoles/RoleAssetsCreation.d.ts +8 -0
- package/dist/lib/modules/asset/roles/specificRoles/index.d.ts +2 -0
- package/dist/lib/modules/asset/types/AssetApi.d.ts +43 -2
- package/dist/lib/modules/asset/types/AssetContent.d.ts +1 -1
- package/dist/lib/modules/decoder/Decoder.d.ts +11 -0
- package/dist/lib/modules/decoder/PayloadService.d.ts +3 -6
- package/dist/lib/modules/decoder/types/DecoderContent.d.ts +1 -0
- package/dist/lib/modules/device/DeviceService.d.ts +31 -46
- package/dist/lib/modules/device/DevicesController.d.ts +7 -1
- package/dist/lib/modules/device/collections/deviceMappings.d.ts +2 -46
- package/dist/lib/modules/device/roles/RoleDevicesReader.d.ts +4 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesAssetAssociation.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesConfiguration.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/RoleDevicesCreation.d.ts +8 -0
- package/dist/lib/modules/device/roles/specificRoles/index.d.ts +3 -0
- package/dist/lib/modules/device/types/DeviceApi.d.ts +23 -2
- package/dist/lib/modules/device/types/DeviceEvents.d.ts +29 -0
- package/dist/lib/modules/measure/MeasureExporter.d.ts +5 -2
- package/dist/lib/modules/measure/MeasureService.d.ts +2 -6
- package/dist/lib/modules/measure/collections/measuresMappings.d.ts +18 -0
- package/dist/lib/modules/measure/types/MeasureContent.d.ts +4 -0
- package/dist/lib/modules/measure/types/MeasureDefinition.d.ts +28 -3
- package/dist/lib/modules/model/MappingsConflictsError.d.ts +7 -0
- package/dist/lib/modules/model/ModelService.d.ts +17 -9
- package/dist/lib/modules/model/ModelsConflicts.d.ts +30 -0
- package/dist/lib/modules/model/ModelsController.d.ts +5 -1
- package/dist/lib/modules/model/ModelsRegister.d.ts +28 -3
- package/dist/lib/modules/model/types/ModelApi.d.ts +50 -4
- package/dist/lib/modules/model/types/ModelContent.d.ts +263 -2
- package/dist/lib/modules/model/types/ModelDefinition.d.ts +141 -5
- package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +141 -5
- package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +113 -8
- package/dist/lib/modules/plugin/exports.d.ts +1 -1
- package/dist/lib/modules/plugin/index.d.ts +1 -2
- package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +27 -5
- package/dist/lib/modules/plugin/types/Pipes.d.ts +17 -0
- package/dist/lib/modules/plugin/types/exports.d.ts +1 -0
- package/dist/lib/modules/plugin/types/index.d.ts +3 -0
- package/dist/lib/modules/shared/exports.d.ts +2 -0
- package/dist/lib/modules/shared/index.d.ts +6 -4
- package/dist/lib/modules/shared/services/AbstractExporter.d.ts +1 -0
- package/dist/lib/modules/shared/services/BaseService.d.ts +69 -0
- package/dist/lib/modules/shared/services/DigitalTwinService.d.ts +21 -0
- package/dist/lib/modules/shared/services/index.d.ts +2 -0
- package/dist/lib/modules/shared/types/DigitalTwinApi.d.ts +34 -0
- package/dist/lib/modules/shared/types/DigitalTwinContent.d.ts +2 -4
- package/dist/lib/modules/shared/types/DigitalTwinEvents.d.ts +9 -0
- package/dist/lib/modules/shared/types/DigitalTwinMeasures.d.ts +5 -0
- package/dist/tests/application/assets/Container.d.ts +3 -0
- package/dist/tests/application/assets/Room.d.ts +2 -0
- package/dist/tests/application/assets/StreetLamp.d.ts +2 -0
- package/dist/tests/application/decoders/DummyTempPositionDecoder.d.ts +1 -0
- package/dist/tests/application/measures/BrightnessMeasure.d.ts +2 -0
- package/dist/tests/application/measures/CO2Measure.d.ts +2 -0
- package/dist/tests/application/measures/IlluminanceMeasure.d.ts +2 -0
- package/dist/tests/application/measures/PowerConsumptionMeasure.d.ts +2 -0
- package/package.json +4 -3
- package/dist/lib/modules/shared/utils/ask.d.ts +0 -8
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { JSONObject, KDocument } from "kuzzle";
|
|
2
2
|
import { DeviceContent } from "../device";
|
|
3
3
|
import { DeviceManagerPlugin } from "../plugin";
|
|
4
|
-
import { Metadata } from "../shared";
|
|
4
|
+
import { BaseService, Metadata } from "../shared";
|
|
5
5
|
import { DecodedMeasurement } from "./types/MeasureContent";
|
|
6
|
-
export declare class MeasureService {
|
|
7
|
-
private config;
|
|
8
|
-
private context;
|
|
9
|
-
private get sdk();
|
|
10
|
-
private get app();
|
|
6
|
+
export declare class MeasureService extends BaseService {
|
|
11
7
|
constructor(plugin: DeviceManagerPlugin);
|
|
12
8
|
/**
|
|
13
9
|
* Register new measures from a device, updates :
|
|
@@ -35,6 +35,21 @@ export declare const measuresMappings: {
|
|
|
35
35
|
metadata: {
|
|
36
36
|
properties: {};
|
|
37
37
|
};
|
|
38
|
+
groups: {
|
|
39
|
+
properties: {
|
|
40
|
+
id: {
|
|
41
|
+
type: string;
|
|
42
|
+
fields: {
|
|
43
|
+
text: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
date: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
38
53
|
};
|
|
39
54
|
};
|
|
40
55
|
/**
|
|
@@ -48,6 +63,9 @@ export declare const measuresMappings: {
|
|
|
48
63
|
measureName: {
|
|
49
64
|
type: string;
|
|
50
65
|
};
|
|
66
|
+
deviceMetadata: {
|
|
67
|
+
properties: {};
|
|
68
|
+
};
|
|
51
69
|
payloadUuids: {
|
|
52
70
|
type: string;
|
|
53
71
|
};
|
|
@@ -1,15 +1,40 @@
|
|
|
1
1
|
import { JSONObject } from "kuzzle-sdk";
|
|
2
|
+
interface MeasureLocales {
|
|
3
|
+
[localeString: string]: {
|
|
4
|
+
friendlyName: string;
|
|
5
|
+
unit?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface MeasureValuesDetails {
|
|
9
|
+
[valueName: string]: MeasureLocales;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
12
|
* Represents a measure definition registered by the Device Manager
|
|
4
13
|
*
|
|
5
14
|
* @example
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
15
|
+
*{
|
|
16
|
+
* valuesMappings: { temperature: { type: "float" } },
|
|
17
|
+
* valuesDetails: {
|
|
18
|
+
* temperature: {
|
|
19
|
+
* en: {
|
|
20
|
+
* friendlyName: "Temperature",
|
|
21
|
+
* unit: "°C",
|
|
22
|
+
* },
|
|
23
|
+
* fr: {
|
|
24
|
+
* friendlyName: "Température",
|
|
25
|
+
* unit: "°C",
|
|
26
|
+
* },
|
|
27
|
+
* },
|
|
28
|
+
* },
|
|
29
|
+
*}
|
|
9
30
|
*/
|
|
10
31
|
export interface MeasureDefinition {
|
|
11
32
|
/**
|
|
12
33
|
* Mappings for the measurement values in order to index the fields
|
|
13
34
|
*/
|
|
14
35
|
valuesMappings: JSONObject;
|
|
36
|
+
valuesDetails?: {
|
|
37
|
+
[valueName: string]: MeasureLocales;
|
|
38
|
+
};
|
|
15
39
|
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JSONObject, KuzzleError } from "kuzzle";
|
|
2
|
+
export declare class MappingsConflictsError extends KuzzleError {
|
|
3
|
+
private conflicts;
|
|
4
|
+
constructor(message: string, conflicts: JSONObject, id?: string, code?: number);
|
|
5
|
+
get name(): string;
|
|
6
|
+
toJSON(): JSONObject;
|
|
7
|
+
}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KuzzleRequest } from "kuzzle";
|
|
2
|
+
import { JSONObject, KDocument, KHit, SearchResult } from "kuzzle-sdk";
|
|
2
3
|
import { DeviceManagerPlugin } from "../plugin";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
private get sdk();
|
|
4
|
+
import { BaseService, SearchParams } from "../shared";
|
|
5
|
+
import { AssetModelContent, DeviceModelContent, MeasureModelContent, MetadataDetails, MetadataGroups, MetadataMappings, TooltipModels } from "./types/ModelContent";
|
|
6
|
+
import { MeasureValuesDetails } from "../measure";
|
|
7
|
+
export declare class ModelService extends BaseService {
|
|
8
8
|
constructor(plugin: DeviceManagerPlugin);
|
|
9
9
|
registerAskEvents(): void;
|
|
10
|
-
|
|
10
|
+
private checkModelsConflicts;
|
|
11
|
+
writeAsset(engineGroup: string, model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: AssetModelContent["asset"]["measures"], tooltipModels: TooltipModels): Promise<KDocument<AssetModelContent>>;
|
|
11
12
|
private checkDefaultValues;
|
|
12
|
-
writeDevice(model: string, metadataMappings:
|
|
13
|
-
writeMeasure(type: string, valuesMappings: JSONObject): Promise<KDocument<MeasureModelContent>>;
|
|
13
|
+
writeDevice(model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: DeviceModelContent["device"]["measures"]): Promise<KDocument<DeviceModelContent>>;
|
|
14
|
+
writeMeasure(type: string, valuesMappings: JSONObject, valuesDetails?: MeasureValuesDetails): Promise<KDocument<MeasureModelContent>>;
|
|
14
15
|
deleteAsset(_id: string): Promise<void>;
|
|
15
16
|
deleteDevice(_id: string): Promise<void>;
|
|
16
17
|
deleteMeasure(_id: string): Promise<void>;
|
|
17
18
|
listAsset(engineGroup: string): Promise<KDocument<AssetModelContent>[]>;
|
|
18
19
|
listDevices(): Promise<KDocument<DeviceModelContent>[]>;
|
|
19
20
|
listMeasures(): Promise<KDocument<MeasureModelContent>[]>;
|
|
21
|
+
searchAssets(engineGroup: string, searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<AssetModelContent>>>;
|
|
22
|
+
searchDevices(searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<DeviceModelContent>>>;
|
|
23
|
+
searchMeasures(searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<MeasureModelContent>>>;
|
|
20
24
|
assetExists(model: string): Promise<boolean>;
|
|
21
25
|
deviceExists(model: string): Promise<boolean>;
|
|
22
26
|
getAsset(engineGroup: string, model: string): Promise<KDocument<AssetModelContent>>;
|
|
23
27
|
getDevice(model: string): Promise<KDocument<DeviceModelContent>>;
|
|
24
28
|
getMeasure(type: string): Promise<KDocument<MeasureModelContent>>;
|
|
29
|
+
/**
|
|
30
|
+
* Update an asset model
|
|
31
|
+
*/
|
|
32
|
+
updateAsset(engineGroup: string, model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: AssetModelContent["asset"]["measures"], tooltipModels: TooltipModels, request: KuzzleRequest): Promise<KDocument<AssetModelContent>>;
|
|
25
33
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TwinModelContent, TwinType } from "../plugin";
|
|
2
|
+
import { MeasureModelContent } from "./exports";
|
|
3
|
+
export type ConflictChunk = {
|
|
4
|
+
sourceModel: string;
|
|
5
|
+
newModel: string;
|
|
6
|
+
modelType: string;
|
|
7
|
+
conflicts: MappingsConflict[];
|
|
8
|
+
};
|
|
9
|
+
export type MappingsConflict = {
|
|
10
|
+
path: string;
|
|
11
|
+
currentType: string | undefined;
|
|
12
|
+
newType: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Return every conflicts between the mappings of twins and a new twin model
|
|
16
|
+
*
|
|
17
|
+
* @param twinType The target twin type
|
|
18
|
+
* @param models The already present twin models
|
|
19
|
+
* @param additional The new asset
|
|
20
|
+
* @returns An array of ConflictChunk between current twins and the new twin
|
|
21
|
+
*/
|
|
22
|
+
export declare function getTwinConflicts<TDigitalTwin extends TwinModelContent>(twinType: TwinType, models: TDigitalTwin[], additional: TDigitalTwin): ConflictChunk[];
|
|
23
|
+
/**
|
|
24
|
+
* Return every conflicts between the mappings of measure models and a new measure model
|
|
25
|
+
*
|
|
26
|
+
* @param measures The already present measure models
|
|
27
|
+
* @param additional The new measure
|
|
28
|
+
* @returns An array of ConflictChunk between current measures and the new measure
|
|
29
|
+
*/
|
|
30
|
+
export declare function getMeasureConflicts(measures: MeasureModelContent[], additional: MeasureModelContent): ConflictChunk[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControllerDefinition, KuzzleRequest } from "kuzzle";
|
|
2
2
|
import { ModelService } from "./ModelService";
|
|
3
|
-
import { ApiModelWriteAssetResult, ApiModelWriteDeviceResult, ApiModelWriteMeasureResult, ApiModelDeleteAssetResult, ApiModelDeleteDeviceResult, ApiModelDeleteMeasureResult, ApiModelListAssetsResult, ApiModelListDevicesResult, ApiModelListMeasuresResult, ApiModelGetAssetResult, ApiModelGetDeviceResult, ApiModelGetMeasureResult } from "./types/ModelApi";
|
|
3
|
+
import { ApiModelWriteAssetResult, ApiModelWriteDeviceResult, ApiModelWriteMeasureResult, ApiModelUpdateAssetResult, ApiModelDeleteAssetResult, ApiModelDeleteDeviceResult, ApiModelDeleteMeasureResult, ApiModelListAssetsResult, ApiModelListDevicesResult, ApiModelListMeasuresResult, ApiModelGetAssetResult, ApiModelGetDeviceResult, ApiModelGetMeasureResult, ApiModelSearchAssetsResult, ApiModelSearchDevicesResult, ApiModelSearchMeasuresResult } from "./types/ModelApi";
|
|
4
4
|
export declare class ModelsController {
|
|
5
5
|
private modelService;
|
|
6
6
|
definition: ControllerDefinition;
|
|
@@ -17,4 +17,8 @@ export declare class ModelsController {
|
|
|
17
17
|
listAssets(request: KuzzleRequest): Promise<ApiModelListAssetsResult>;
|
|
18
18
|
listDevices(): Promise<ApiModelListDevicesResult>;
|
|
19
19
|
listMeasures(): Promise<ApiModelListMeasuresResult>;
|
|
20
|
+
searchAssets(request: KuzzleRequest): Promise<ApiModelSearchAssetsResult>;
|
|
21
|
+
searchDevices(request: KuzzleRequest): Promise<ApiModelSearchDevicesResult>;
|
|
22
|
+
searchMeasures(request: KuzzleRequest): Promise<ApiModelSearchMeasuresResult>;
|
|
23
|
+
updateAsset(request: KuzzleRequest): Promise<ApiModelUpdateAssetResult>;
|
|
20
24
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { JSONObject } from "kuzzle-sdk";
|
|
2
1
|
import { DeviceManagerPlugin } from "../plugin";
|
|
3
2
|
import { NamedMeasures } from "../decoder";
|
|
4
3
|
import { MeasureDefinition } from "../measure";
|
|
4
|
+
import { MetadataDetails, MetadataGroups, MetadataMappings, TooltipModels } from "./types/ModelContent";
|
|
5
|
+
import { JSONObject } from "kuzzle-sdk";
|
|
5
6
|
export declare class ModelsRegister {
|
|
6
7
|
private config;
|
|
7
8
|
private context;
|
|
@@ -11,8 +12,32 @@ export declare class ModelsRegister {
|
|
|
11
12
|
private get sdk();
|
|
12
13
|
init(plugin: DeviceManagerPlugin): void;
|
|
13
14
|
loadModels(): Promise<void>;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Registers an asset model.
|
|
17
|
+
*
|
|
18
|
+
* @param engineGroup - The engine group name.
|
|
19
|
+
* @param model - The name of the asset model, which must be in PascalCase.
|
|
20
|
+
* @param measures - The measures associated with this asset model.
|
|
21
|
+
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
22
|
+
* @param defaultMetadata - The default metadata values for the model, defaults to an empty object.
|
|
23
|
+
* @param metadataDetails - Optional detailed metadata descriptions, localizations and definition.
|
|
24
|
+
* @param metadataGroups - Optional groups for organizing metadata, with localizations.
|
|
25
|
+
* @param tooltipModels - Optional model list for tooltip, containing labels and tooltip content.
|
|
26
|
+
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
27
|
+
*/
|
|
28
|
+
registerAsset(engineGroup: string, model: string, measures: NamedMeasures, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups, tooltipModels?: TooltipModels): void;
|
|
29
|
+
/**
|
|
30
|
+
* Registers a device model.
|
|
31
|
+
*
|
|
32
|
+
* @param model - The name of the device model, which must be in PascalCase.
|
|
33
|
+
* @param measures - The measures associated with this device model.
|
|
34
|
+
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
35
|
+
* @param defaultMetadata - The default metadata values for the model, defaults to an empty object.
|
|
36
|
+
* @param metadataDetails - Optional detailed metadata descriptions, localizations and definition.
|
|
37
|
+
* @param metadataGroups - Optional groups for organizing metadata, with localizations.
|
|
38
|
+
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
39
|
+
*/
|
|
40
|
+
registerDevice(model: string, measures: NamedMeasures, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups): void;
|
|
16
41
|
registerMeasure(type: string, measureDefinition: MeasureDefinition): void;
|
|
17
42
|
private load;
|
|
18
43
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { JSONObject, KDocument } from "kuzzle-sdk";
|
|
2
|
-
import { AssetModelContent, DeviceModelContent, MeasureModelContent } from "./ModelContent";
|
|
1
|
+
import { JSONObject, KDocument, KHit, SearchResult } from "kuzzle-sdk";
|
|
2
|
+
import { AssetModelContent, DeviceModelContent, MeasureModelContent, MetadataDetails, MetadataGroups, MetadataMappings, TooltipModels } from "./ModelContent";
|
|
3
|
+
import { MeasureValuesDetails } from "../../measure/types/MeasureDefinition";
|
|
3
4
|
interface ModelsControllerRequest {
|
|
4
5
|
controller: "device-manager/models";
|
|
5
6
|
}
|
|
@@ -24,9 +25,12 @@ export interface ApiModelWriteAssetRequest extends ModelsControllerRequest {
|
|
|
24
25
|
body: {
|
|
25
26
|
engineGroup: string;
|
|
26
27
|
model: string;
|
|
27
|
-
|
|
28
|
+
metadataDetails?: MetadataDetails;
|
|
29
|
+
metadataGroups?: MetadataGroups;
|
|
30
|
+
metadataMappings?: MetadataMappings;
|
|
28
31
|
defaultValues?: JSONObject;
|
|
29
32
|
measures?: AssetModelContent["asset"]["measures"];
|
|
33
|
+
tooltipModels?: TooltipModels;
|
|
30
34
|
};
|
|
31
35
|
}
|
|
32
36
|
export type ApiModelWriteAssetResult = KDocument<AssetModelContent>;
|
|
@@ -34,7 +38,9 @@ export interface ApiModelWriteDeviceRequest extends ModelsControllerRequest {
|
|
|
34
38
|
action: "writeDevice";
|
|
35
39
|
body: {
|
|
36
40
|
model: string;
|
|
37
|
-
|
|
41
|
+
metadataDetails?: MetadataDetails;
|
|
42
|
+
metadataGroups?: MetadataGroups;
|
|
43
|
+
metadataMappings?: MetadataMappings;
|
|
38
44
|
defaultValues?: JSONObject;
|
|
39
45
|
measures: DeviceModelContent["device"]["measures"];
|
|
40
46
|
};
|
|
@@ -45,9 +51,24 @@ export interface ApiModelWriteMeasureRequest extends ModelsControllerRequest {
|
|
|
45
51
|
body: {
|
|
46
52
|
type: string;
|
|
47
53
|
valuesMappings: JSONObject;
|
|
54
|
+
valuesDetails?: MeasureValuesDetails;
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
export type ApiModelWriteMeasureResult = KDocument<MeasureModelContent>;
|
|
58
|
+
export interface ApiModelUpdateAssetRequest extends ModelsControllerRequest {
|
|
59
|
+
action: "updateAsset";
|
|
60
|
+
engineGroup: string;
|
|
61
|
+
model: string;
|
|
62
|
+
body: {
|
|
63
|
+
metadataDetails?: MetadataDetails;
|
|
64
|
+
metadataGroups?: MetadataGroups;
|
|
65
|
+
metadataMappings?: MetadataMappings;
|
|
66
|
+
defaultValues?: JSONObject;
|
|
67
|
+
measures?: AssetModelContent["asset"]["measures"];
|
|
68
|
+
tooltipModels?: TooltipModels;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export type ApiModelUpdateAssetResult = KDocument<AssetModelContent>;
|
|
51
72
|
export interface ApiModelDeleteAssetRequest extends ModelsControllerRequest {
|
|
52
73
|
action: "deleteAsset";
|
|
53
74
|
_id: string;
|
|
@@ -85,4 +106,29 @@ export type ApiModelListMeasuresResult = {
|
|
|
85
106
|
models: KDocument<MeasureModelContent>[];
|
|
86
107
|
total: number;
|
|
87
108
|
};
|
|
109
|
+
export interface ApiModelSearchAssetsRequest extends ModelsControllerRequest {
|
|
110
|
+
action: "searchAssets";
|
|
111
|
+
engineGroup: string;
|
|
112
|
+
from?: number;
|
|
113
|
+
size?: number;
|
|
114
|
+
scrollTTL?: string;
|
|
115
|
+
body?: JSONObject;
|
|
116
|
+
}
|
|
117
|
+
export type ApiModelSearchAssetsResult = SearchResult<KHit<AssetModelContent>>;
|
|
118
|
+
export interface ApiModelSearchDevicesRequest extends ModelsControllerRequest {
|
|
119
|
+
action: "searchDevices";
|
|
120
|
+
from?: number;
|
|
121
|
+
size?: number;
|
|
122
|
+
scrollTTL?: string;
|
|
123
|
+
body?: JSONObject;
|
|
124
|
+
}
|
|
125
|
+
export type ApiModelSearchDevicesResult = SearchResult<KHit<DeviceModelContent>>;
|
|
126
|
+
export interface ApiModelSearchMeasuresRequest extends ModelsControllerRequest {
|
|
127
|
+
action: "searchMeasures";
|
|
128
|
+
from?: number;
|
|
129
|
+
size?: number;
|
|
130
|
+
scrollTTL?: string;
|
|
131
|
+
body?: JSONObject;
|
|
132
|
+
}
|
|
133
|
+
export type ApiModelSearchMeasuresResult = SearchResult<KHit<MeasureModelContent>>;
|
|
88
134
|
export {};
|
|
@@ -7,6 +7,129 @@ export interface MeasureModelContent extends KDocumentContent {
|
|
|
7
7
|
type: string;
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
+
export interface MetadataProperty {
|
|
11
|
+
type: string;
|
|
12
|
+
strategy?: string;
|
|
13
|
+
format?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface MetadataObject {
|
|
16
|
+
properties: {
|
|
17
|
+
[key: string]: MetadataProperty | MetadataObject;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface MetadataMappings {
|
|
21
|
+
[key: string]: MetadataProperty | MetadataObject;
|
|
22
|
+
}
|
|
23
|
+
export interface LocaleDetails {
|
|
24
|
+
friendlyName: string;
|
|
25
|
+
description: string;
|
|
26
|
+
}
|
|
27
|
+
export interface BaseEditorHint {
|
|
28
|
+
readOnly?: boolean;
|
|
29
|
+
type: EditorHintEnum;
|
|
30
|
+
}
|
|
31
|
+
export declare enum EditorHintEnum {
|
|
32
|
+
BASE = "base",
|
|
33
|
+
OPTION_SELECTOR = "optionSelector",
|
|
34
|
+
DATETIME = "datetime"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Allows to display a list of values to choose in a dropdown, it has to be defined in the the editorHint property of the asset/device's metadataDetails.
|
|
38
|
+
*/
|
|
39
|
+
export interface OptionsSelectorEditorHint extends BaseEditorHint {
|
|
40
|
+
type: EditorHintEnum.OPTION_SELECTOR;
|
|
41
|
+
/**
|
|
42
|
+
* A list that contains all the values displayed in the dropdown.
|
|
43
|
+
*/
|
|
44
|
+
values: string[] | number[] | boolean[];
|
|
45
|
+
/**
|
|
46
|
+
* Allow the user to add custom values.
|
|
47
|
+
*/
|
|
48
|
+
customValueAllowed?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Allows to display either a date picker with or without a time picker, or a clock picker, it has to be defined in the editorHint property of the asset/device's metadataDetails.
|
|
52
|
+
*/
|
|
53
|
+
export interface DatetimeEditorHint extends BaseEditorHint {
|
|
54
|
+
type: EditorHintEnum.DATETIME;
|
|
55
|
+
/**
|
|
56
|
+
* If true, displays a date picker, otherwise displays a clock picker.
|
|
57
|
+
*/
|
|
58
|
+
date: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* If `date` is true, setting this to true will add time picking to the date picker.
|
|
61
|
+
*/
|
|
62
|
+
time?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface MetadataDetails {
|
|
65
|
+
[key: string]: {
|
|
66
|
+
group?: string;
|
|
67
|
+
locales: {
|
|
68
|
+
[locale: string]: LocaleDetails;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* To add new editor hint, create an interface with the properties that extends BaseEditorHint.
|
|
72
|
+
* Then add a new field in EditorHintEnum to define the type of your hint.
|
|
73
|
+
* Finally add the new editor hint interface with a pipe to take in account the new type.
|
|
74
|
+
*/
|
|
75
|
+
editorHint?: BaseEditorHint | OptionsSelectorEditorHint | DatetimeEditorHint;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface MetadataGroupLocale {
|
|
79
|
+
groupFriendlyName: string;
|
|
80
|
+
description: string;
|
|
81
|
+
}
|
|
82
|
+
export interface MetadataGroups {
|
|
83
|
+
[groupName: string]: {
|
|
84
|
+
locales: {
|
|
85
|
+
[locale: string]: MetadataGroupLocale;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export interface MetadataTooltipContent {
|
|
90
|
+
category: "metadata";
|
|
91
|
+
label?: {
|
|
92
|
+
locales: {
|
|
93
|
+
[locale: string]: LocaleDetails;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
metadataPath: string;
|
|
97
|
+
suffix?: string;
|
|
98
|
+
}
|
|
99
|
+
export interface MeasureTooltipContent {
|
|
100
|
+
category: "measure";
|
|
101
|
+
label?: {
|
|
102
|
+
locales: {
|
|
103
|
+
[locale: string]: LocaleDetails;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
measureSlot: string;
|
|
107
|
+
measureValuePath: string;
|
|
108
|
+
suffix?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface StaticTooltipContent {
|
|
111
|
+
category: "static";
|
|
112
|
+
label?: {
|
|
113
|
+
locales: {
|
|
114
|
+
[locale: string]: LocaleDetails;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
type: StaticTooltipContentType;
|
|
118
|
+
value: string;
|
|
119
|
+
}
|
|
120
|
+
export declare enum StaticTooltipContentType {
|
|
121
|
+
link = "link",
|
|
122
|
+
image = "image",
|
|
123
|
+
text = "text",
|
|
124
|
+
title = "title",
|
|
125
|
+
separator = "separator"
|
|
126
|
+
}
|
|
127
|
+
export interface TooltipModels {
|
|
128
|
+
[key: string]: {
|
|
129
|
+
tooltipLabel: string;
|
|
130
|
+
content: (MetadataTooltipContent | MeasureTooltipContent | StaticTooltipContent)[];
|
|
131
|
+
};
|
|
132
|
+
}
|
|
10
133
|
export interface AssetModelContent extends KDocumentContent {
|
|
11
134
|
type: "asset";
|
|
12
135
|
engineGroup: string;
|
|
@@ -27,7 +150,7 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
27
150
|
* }
|
|
28
151
|
* }
|
|
29
152
|
*/
|
|
30
|
-
metadataMappings:
|
|
153
|
+
metadataMappings: MetadataMappings;
|
|
31
154
|
/**
|
|
32
155
|
* Default values for metadata.
|
|
33
156
|
*
|
|
@@ -37,6 +160,51 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
37
160
|
* }
|
|
38
161
|
*/
|
|
39
162
|
defaultMetadata: JSONObject;
|
|
163
|
+
/**
|
|
164
|
+
* Metadata details
|
|
165
|
+
* @example
|
|
166
|
+
* {
|
|
167
|
+
* "extTemp": {
|
|
168
|
+
* "group": "buildingEnv",
|
|
169
|
+
* "locales": {
|
|
170
|
+
* "en": {
|
|
171
|
+
* "friendlyName": "External temperature",
|
|
172
|
+
* "description": "Building external temperature"
|
|
173
|
+
* },
|
|
174
|
+
* "fr": {
|
|
175
|
+
* "friendlyName": "Température extérieure",
|
|
176
|
+
* "description": "Température à l'exterieur du bâtiment"
|
|
177
|
+
* },
|
|
178
|
+
* },
|
|
179
|
+
* "editorHint": {
|
|
180
|
+
* "readOnly": true,
|
|
181
|
+
* "type": EditorHintEnum.OPTION_SELECTOR,
|
|
182
|
+
* "values": ["red", "blue"],
|
|
183
|
+
* "customValueAllowed": true,
|
|
184
|
+
* },
|
|
185
|
+
* },
|
|
186
|
+
* }
|
|
187
|
+
*/
|
|
188
|
+
metadataDetails?: MetadataDetails;
|
|
189
|
+
/**
|
|
190
|
+
* Metadata groups list
|
|
191
|
+
* @example
|
|
192
|
+
* {
|
|
193
|
+
* "buildingEnv": {
|
|
194
|
+
* "locales": {
|
|
195
|
+
* "en": {
|
|
196
|
+
* "groupFriendlyName": "Building environment",
|
|
197
|
+
* "description": "The building environment"
|
|
198
|
+
* },
|
|
199
|
+
* "fr": {
|
|
200
|
+
* "groupFriendlyName": "Environnement du bâtiment",
|
|
201
|
+
* "description": "L'environnement du bâtiment"
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
* }
|
|
206
|
+
*/
|
|
207
|
+
metadataGroups?: MetadataGroups;
|
|
40
208
|
/**
|
|
41
209
|
* List of accepted measures for this model
|
|
42
210
|
*
|
|
@@ -49,6 +217,53 @@ export interface AssetModelContent extends KDocumentContent {
|
|
|
49
217
|
* ]
|
|
50
218
|
*/
|
|
51
219
|
measures: NamedMeasures;
|
|
220
|
+
/**
|
|
221
|
+
* List of tooltip models for this asset model
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* [
|
|
225
|
+
* "defaultTooltipKey": {
|
|
226
|
+
* "tooltipLabel": "Default tooltip model",
|
|
227
|
+
* "content": [
|
|
228
|
+
* {
|
|
229
|
+
* "metadataPath": "geolocation",
|
|
230
|
+
* "label": {
|
|
231
|
+
* "locales": {
|
|
232
|
+
* "en": {
|
|
233
|
+
* "description": "",
|
|
234
|
+
* "friendlyName": "Container position"
|
|
235
|
+
* },
|
|
236
|
+
* "fr": {
|
|
237
|
+
* "description": "",
|
|
238
|
+
* "friendlyName": "Position du conteneur"
|
|
239
|
+
* }
|
|
240
|
+
* }
|
|
241
|
+
* },
|
|
242
|
+
* "category": "metadata"
|
|
243
|
+
* },
|
|
244
|
+
* {
|
|
245
|
+
* "measureValuePath": "externalTemperature",
|
|
246
|
+
* "measureSlot": "externalTemperature",
|
|
247
|
+
* "label": {
|
|
248
|
+
* "locales": {
|
|
249
|
+
* "en": {
|
|
250
|
+
* "description": "",
|
|
251
|
+
* "friendlyName": "External temperature"
|
|
252
|
+
* },
|
|
253
|
+
* "fr": {
|
|
254
|
+
* "description": "",
|
|
255
|
+
* "friendlyName": "Température extérieure"
|
|
256
|
+
* }
|
|
257
|
+
* }
|
|
258
|
+
* },
|
|
259
|
+
* "category": "measure",
|
|
260
|
+
* "suffix": "°C"
|
|
261
|
+
* }
|
|
262
|
+
* ]
|
|
263
|
+
* }
|
|
264
|
+
* ]
|
|
265
|
+
*/
|
|
266
|
+
tooltipModels?: TooltipModels;
|
|
52
267
|
};
|
|
53
268
|
}
|
|
54
269
|
export interface DeviceModelContent extends KDocumentContent {
|
|
@@ -70,7 +285,7 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
70
285
|
* }
|
|
71
286
|
* }
|
|
72
287
|
*/
|
|
73
|
-
metadataMappings:
|
|
288
|
+
metadataMappings: MetadataMappings;
|
|
74
289
|
/**
|
|
75
290
|
* Default values for metadata.
|
|
76
291
|
*
|
|
@@ -80,6 +295,52 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
80
295
|
* }
|
|
81
296
|
*/
|
|
82
297
|
defaultMetadata: JSONObject;
|
|
298
|
+
/**
|
|
299
|
+
* Metadata details
|
|
300
|
+
* @example
|
|
301
|
+
* {
|
|
302
|
+
* "sensorVersion": {
|
|
303
|
+
* "group": "sensorSpecs",
|
|
304
|
+
* "locales": {
|
|
305
|
+
* "en": {
|
|
306
|
+
* "friendlyName": "Sensor version",
|
|
307
|
+
* "description": "Firmware version of the sensor"
|
|
308
|
+
* },
|
|
309
|
+
* "fr": {
|
|
310
|
+
* "friendlyName": "Version du capteur",
|
|
311
|
+
* "description": "Version du micrologiciel du capteur"
|
|
312
|
+
* },
|
|
313
|
+
* },
|
|
314
|
+
* "editorHint": {
|
|
315
|
+
* "readOnly": false,
|
|
316
|
+
* "type": EditorHintEnum.DATETIME,
|
|
317
|
+
* "date": true,
|
|
318
|
+
* "time": true,
|
|
319
|
+
* "customTimeZoneAllowed": true,
|
|
320
|
+
* },
|
|
321
|
+
* },
|
|
322
|
+
* }
|
|
323
|
+
*/
|
|
324
|
+
metadataDetails?: MetadataDetails;
|
|
325
|
+
/**
|
|
326
|
+
* Metadata groups list
|
|
327
|
+
* @example
|
|
328
|
+
* {
|
|
329
|
+
* "sensorSpecs": {
|
|
330
|
+
* "locales": {
|
|
331
|
+
* "en": {
|
|
332
|
+
* "groupFriendlyName": "Sensor specifications",
|
|
333
|
+
* "description" : "All sensors specifications"
|
|
334
|
+
* },
|
|
335
|
+
* "fr": {
|
|
336
|
+
* "groupFriendlyName": "Spécifications techniques",
|
|
337
|
+
* "description": "Toutes les spécifications techniques"
|
|
338
|
+
* },
|
|
339
|
+
* }
|
|
340
|
+
* }
|
|
341
|
+
* }
|
|
342
|
+
*/
|
|
343
|
+
metadataGroups?: MetadataGroups;
|
|
83
344
|
/**
|
|
84
345
|
* List of decoded measures for this model
|
|
85
346
|
*
|