kuzzle-device-manager-types 3.0.0-3-dev.19 → 3.0.0-3-dev.20
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/bin/migration/migrate-tenant-classes.d.ts +2 -0
- package/dist/lib/modules/asset/AssetHistoryService.d.ts +1 -1
- package/dist/lib/modules/asset/AssetService.d.ts +12 -12
- package/dist/lib/modules/asset/AssetsController.d.ts +1 -1
- package/dist/lib/modules/asset/types/AssetApi.d.ts +6 -6
- package/dist/lib/modules/asset/types/AssetEvents.d.ts +1 -1
- package/dist/lib/modules/device/DeviceService.d.ts +11 -11
- package/dist/lib/modules/device/types/DeviceApi.d.ts +2 -2
- package/dist/lib/modules/device/types/DeviceContent.d.ts +2 -2
- package/dist/lib/modules/device/types/DeviceEvents.d.ts +1 -1
- package/dist/lib/modules/group/GroupsController.d.ts +3 -3
- package/dist/lib/modules/group/GroupsService.d.ts +14 -14
- package/dist/lib/modules/group/types/GroupsApi.d.ts +1 -1
- package/dist/lib/modules/measure/MeasureExporter.d.ts +5 -5
- package/dist/lib/modules/measure/MeasureService.d.ts +2 -2
- package/dist/lib/modules/measure/MeasureTargetBuilder.d.ts +1 -1
- package/dist/lib/modules/measure/types/MeasureTarget.d.ts +1 -1
- package/dist/lib/modules/model/ModelService.d.ts +17 -21
- package/dist/lib/modules/model/ModelsRegister.d.ts +4 -4
- package/dist/lib/modules/model/types/ModelApi.d.ts +13 -13
- package/dist/lib/modules/model/types/ModelContent.d.ts +6 -6
- package/dist/lib/modules/model/types/ModelEvents.d.ts +3 -3
- package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +25 -25
- package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +10 -3
- package/dist/lib/modules/shared/services/AbstractExporter.d.ts +8 -8
- package/dist/lib/modules/shared/services/BaseService.d.ts +7 -7
- package/dist/lib/modules/shared/services/DigitalTwinExporter.d.ts +3 -3
- package/dist/lib/modules/shared/services/DigitalTwinService.d.ts +8 -8
- package/dist/lib/modules/shared/types/DigitalTwinApi.d.ts +1 -1
- package/dist/lib/modules/shared/types/DigitalTwinEvents.d.ts +2 -2
- package/package.json +1 -1
|
@@ -5,5 +5,5 @@ import { KuzzleLogger } from "kuzzle-logger";
|
|
|
5
5
|
export declare class AssetHistoryService extends BaseService {
|
|
6
6
|
readonly logger: KuzzleLogger;
|
|
7
7
|
constructor(plugin: DeviceManagerPlugin, assetLogger: KuzzleLogger);
|
|
8
|
-
add<TAssetHistoryEvent extends AssetHistoryEvent>(
|
|
8
|
+
add<TAssetHistoryEvent extends AssetHistoryEvent>(index: string, histories: AssetHistoryContent[]): Promise<void>;
|
|
9
9
|
}
|
|
@@ -11,35 +11,35 @@ export declare class AssetService extends DigitalTwinService {
|
|
|
11
11
|
readonly logger: KuzzleLogger;
|
|
12
12
|
constructor(plugin: DeviceManagerPlugin, assetHistoryService: AssetHistoryService, assetLogger: KuzzleLogger);
|
|
13
13
|
registerAskEvents(): void;
|
|
14
|
-
get(
|
|
14
|
+
get(index: string, assetId: string, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
15
15
|
/**
|
|
16
16
|
* Update an asset metadata
|
|
17
17
|
*/
|
|
18
|
-
update(
|
|
18
|
+
update(index: string, assetId: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
19
19
|
/**
|
|
20
20
|
* Replace an asset metadata
|
|
21
21
|
*/
|
|
22
|
-
replaceMetadata(
|
|
22
|
+
replaceMetadata(index: string, assetId: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
23
23
|
/**
|
|
24
24
|
* Update or Create an asset metadata
|
|
25
25
|
*/
|
|
26
|
-
upsert(
|
|
26
|
+
upsert(index: string, model: string, reference: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
27
27
|
private _create;
|
|
28
28
|
/**
|
|
29
29
|
* Create an asset metadata
|
|
30
30
|
*/
|
|
31
|
-
create(
|
|
31
|
+
create(index: string, model: string, reference: string, metadata: JSONObject, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
32
32
|
/**
|
|
33
33
|
* Delete an asset metadata
|
|
34
34
|
*/
|
|
35
|
-
delete(
|
|
36
|
-
search(
|
|
35
|
+
delete(index: string, assetId: string, request: KuzzleRequest): Promise<void>;
|
|
36
|
+
search(index: string, searchParams: SearchParams, request: KuzzleRequest): Promise<SearchResult<KHit<AssetContent>>>;
|
|
37
37
|
unlinkDevices(assetId: string, allMeasures: boolean, deviceIds: string[], measureSlots: string[], request: KuzzleRequest): Promise<ApiAssetUnlinkDevicesResult>;
|
|
38
|
-
migrateTenant(user: User, assetsList: string[],
|
|
38
|
+
migrateTenant(user: User, assetsList: string[], index: string, newIndex: string, includeDevices: boolean, request: KuzzleRequest): Promise<ApiAssetMigrateTenantResult>;
|
|
39
39
|
/**
|
|
40
40
|
* Replace an asset metadata
|
|
41
41
|
*/
|
|
42
|
-
mReplaceAndHistorize(
|
|
42
|
+
mReplaceAndHistorize(index: string, assets: KDocument<AssetContent>[], removedMetadata: string[], { refresh }: {
|
|
43
43
|
refresh: any;
|
|
44
44
|
}): Promise<mReplaceResponse>;
|
|
45
45
|
/**
|
|
@@ -49,13 +49,13 @@ export declare class AssetService extends DigitalTwinService {
|
|
|
49
49
|
* @param model
|
|
50
50
|
*/
|
|
51
51
|
updateModelLocales(request: KuzzleRequest, model: string): Promise<ApiAssetUpdateModelLocales[]>;
|
|
52
|
-
addMeasureSlot(assetId: string, measureSlot: AssetContent["measureSlots"][0],
|
|
53
|
-
removeMeasureSlot(assetId: string, measureSlotName: string,
|
|
52
|
+
addMeasureSlot(assetId: string, measureSlot: AssetContent["measureSlots"][0], index: string, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
53
|
+
removeMeasureSlot(assetId: string, measureSlotName: string, index: string, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
54
54
|
/**
|
|
55
55
|
* Update the display name of a measure slot on an asset
|
|
56
56
|
*/
|
|
57
57
|
updateMeasureSlotDisplayName(assetId: string, measureSlotName: string, displayName: {
|
|
58
58
|
[locale: string]: string;
|
|
59
|
-
},
|
|
59
|
+
}, index: string, request: KuzzleRequest): Promise<KDocument<AssetContent>>;
|
|
60
60
|
private refreshModel;
|
|
61
61
|
}
|
|
@@ -28,7 +28,7 @@ export declare class AssetsController {
|
|
|
28
28
|
* @param indexId The asset index
|
|
29
29
|
* @param assetId The target asset ID
|
|
30
30
|
* @param measureName The measureName to get the type from
|
|
31
|
-
* @param
|
|
31
|
+
* @param tenantClass The target tenant class
|
|
32
32
|
* @returns The measure type if used in the asset, null otherwise
|
|
33
33
|
* @throws If the asset does not exists
|
|
34
34
|
*/
|
|
@@ -7,7 +7,7 @@ import { ApiMeasureSource } from "../../measure/types/MeasureSources";
|
|
|
7
7
|
import { DeviceContent } from "lib/modules/device";
|
|
8
8
|
interface AssetsControllerRequest {
|
|
9
9
|
controller: AssetsControllerName;
|
|
10
|
-
|
|
10
|
+
index: string;
|
|
11
11
|
}
|
|
12
12
|
export interface ApiAssetGetRequest extends AssetsControllerRequest {
|
|
13
13
|
action: "get";
|
|
@@ -90,7 +90,7 @@ type TypelessApiMeasureSource = Omit<ApiMeasureSource, "type">;
|
|
|
90
90
|
export interface ApiAssetMeasureIngestRequest extends AssetsControllerRequest {
|
|
91
91
|
action: "ingestMeasure";
|
|
92
92
|
assetId: string;
|
|
93
|
-
|
|
93
|
+
index: string;
|
|
94
94
|
slotName: string;
|
|
95
95
|
body: {
|
|
96
96
|
dataSource: TypelessApiMeasureSource;
|
|
@@ -105,7 +105,7 @@ type APIDecodedMeasurement = Omit<Measurement, "type"> & {
|
|
|
105
105
|
export interface ApiAssetmMeasureIngestRequest extends AssetsControllerRequest {
|
|
106
106
|
action: "mIngestMeasure";
|
|
107
107
|
assetId: string;
|
|
108
|
-
|
|
108
|
+
index: string;
|
|
109
109
|
body: {
|
|
110
110
|
dataSource: TypelessApiMeasureSource;
|
|
111
111
|
measurements: APIDecodedMeasurement[];
|
|
@@ -120,7 +120,7 @@ export type ApiAssetMGetLastMeasuresResult = ApiDigitalTwinMGetLastMeasuresResul
|
|
|
120
120
|
* This action can be used only with WebSocket or POST
|
|
121
121
|
*
|
|
122
122
|
* Then the export can be download using HTTP Get and the following route:
|
|
123
|
-
* `/_/device-manager/:
|
|
123
|
+
* `/_/device-manager/:index/devices/:_id/measures/_export/:exportId`
|
|
124
124
|
*/
|
|
125
125
|
export interface ApiAssetExportMeasuresRequest extends AssetsControllerRequest {
|
|
126
126
|
action: "exportMeasures";
|
|
@@ -150,10 +150,10 @@ export type ApiAssetExportResult = {
|
|
|
150
150
|
};
|
|
151
151
|
export interface ApiAssetMigrateTenantRequest extends AssetsControllerRequest {
|
|
152
152
|
action: "migrateTenant";
|
|
153
|
-
|
|
153
|
+
index: string;
|
|
154
154
|
body: {
|
|
155
155
|
assetsList: string[];
|
|
156
|
-
|
|
156
|
+
newIndex: string;
|
|
157
157
|
includeDevices?: boolean;
|
|
158
158
|
};
|
|
159
159
|
}
|
|
@@ -30,7 +30,7 @@ export type AskAssetRefreshModel = {
|
|
|
30
30
|
export type AskAssetHistoryAdd<TAssetHistoryEvent extends AssetHistoryEvent> = {
|
|
31
31
|
name: "ask:device-manager:asset:history:add";
|
|
32
32
|
payload: {
|
|
33
|
-
|
|
33
|
+
index: string;
|
|
34
34
|
histories: AssetHistoryContent<TAssetHistoryEvent>[];
|
|
35
35
|
};
|
|
36
36
|
result: void;
|
|
@@ -17,29 +17,29 @@ export declare class DeviceService extends DigitalTwinService {
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
create(model: string, reference: string, metadata: JSONObject, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
20
|
-
get(
|
|
20
|
+
get(index: string, deviceId: string, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
21
21
|
/**
|
|
22
22
|
* Replace a device metadata
|
|
23
23
|
*/
|
|
24
|
-
replaceMetadata(
|
|
24
|
+
replaceMetadata(index: string, deviceId: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
25
25
|
/**
|
|
26
26
|
* Update the display name of a measure slot on a device
|
|
27
27
|
*/
|
|
28
|
-
updateMeasureSlotDisplayName(
|
|
28
|
+
updateMeasureSlotDisplayName(index: string, deviceId: string, measureSlotName: string, displayName: {
|
|
29
29
|
[locale: string]: string;
|
|
30
30
|
}, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
31
31
|
/**
|
|
32
32
|
* Update or Create an device metadata
|
|
33
33
|
*/
|
|
34
|
-
upsert(
|
|
35
|
-
update(
|
|
36
|
-
delete(
|
|
37
|
-
search(
|
|
34
|
+
upsert(index: string, model: string, reference: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
35
|
+
update(index: string, deviceId: string, metadata: Metadata, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
36
|
+
delete(index: string, deviceId: string, request: KuzzleRequest): Promise<void>;
|
|
37
|
+
search(index: string, searchParams: SearchParams, request: KuzzleRequest): Promise<SearchResult<KHit<DeviceContent>>>;
|
|
38
38
|
unlinkAssets(deviceId: string, allMeasures: boolean, assetIds: string[], measureSlots: string[], request: KuzzleRequest): Promise<ApiDeviceUnlinkAssetsResult>;
|
|
39
39
|
/**
|
|
40
40
|
* Internal logic to attach the device to an engine
|
|
41
41
|
*
|
|
42
|
-
* @param
|
|
42
|
+
* @param index Engine id to attach to
|
|
43
43
|
* @param deviceId Device id to attach
|
|
44
44
|
* @param options.refresh Wait for ES indexation
|
|
45
45
|
*/
|
|
@@ -47,12 +47,12 @@ export declare class DeviceService extends DigitalTwinService {
|
|
|
47
47
|
/**
|
|
48
48
|
* Attach the device to an engine
|
|
49
49
|
*
|
|
50
|
-
* @param
|
|
50
|
+
* @param index Engine id to attach to
|
|
51
51
|
* @param deviceId Device id to attach
|
|
52
52
|
* @param options.refresh Wait for ES indexation
|
|
53
53
|
* @param options.strict If true, throw if an operation isn't possible
|
|
54
54
|
*/
|
|
55
|
-
attachEngine(
|
|
55
|
+
attachEngine(index: string, deviceId: string, request: KuzzleRequest): Promise<KDocument<DeviceContent>>;
|
|
56
56
|
/**
|
|
57
57
|
* Detach a device from its attached engine
|
|
58
58
|
*
|
|
@@ -60,7 +60,7 @@ export declare class DeviceService extends DigitalTwinService {
|
|
|
60
60
|
* @param {KuzzleRequest} request kuzzle request
|
|
61
61
|
*/
|
|
62
62
|
detachEngine(deviceId: string, request: KuzzleRequest): Promise<KDocument<DeviceProvisioningContent>>;
|
|
63
|
-
receiveMeasures(
|
|
63
|
+
receiveMeasures(index: string, deviceId: string, measures: DecodedMeasurement[], payloadUuids: string[], request: KuzzleRequest): Promise<void>;
|
|
64
64
|
private checkEngineExists;
|
|
65
65
|
private checkAttachedToEngine;
|
|
66
66
|
private refreshModel;
|
|
@@ -6,7 +6,7 @@ import { DeviceContent } from "./DeviceContent";
|
|
|
6
6
|
type DevicesControllerName = "device-manager/devices";
|
|
7
7
|
interface DevicesControllerRequest {
|
|
8
8
|
controller: DevicesControllerName;
|
|
9
|
-
|
|
9
|
+
index: string;
|
|
10
10
|
}
|
|
11
11
|
export interface ApiDeviceGetRequest extends DevicesControllerRequest {
|
|
12
12
|
action: "get";
|
|
@@ -204,7 +204,7 @@ export type ApiDeviceMGetLastMeasuresResult = ApiDigitalTwinMGetLastMeasuresResu
|
|
|
204
204
|
* This action can be used only with WebSocket or POST
|
|
205
205
|
*
|
|
206
206
|
* Then the export can be download using HTTP Get and the following route:
|
|
207
|
-
* `/_/device-manager/:
|
|
207
|
+
* `/_/device-manager/:index/devices/:_id/measures/_export/:exportId`
|
|
208
208
|
*/
|
|
209
209
|
export interface ApiDeviceExportMeasuresRequest extends DevicesControllerRequest {
|
|
210
210
|
action: "exportMeasures";
|
|
@@ -30,7 +30,7 @@ export interface DeviceContent<TMetadata extends Metadata = any> extends Digital
|
|
|
30
30
|
}>;
|
|
31
31
|
/**
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
index: string | null;
|
|
34
34
|
/**
|
|
35
35
|
* Path's of device's groups
|
|
36
36
|
*/
|
|
@@ -42,7 +42,7 @@ export interface DeviceContent<TMetadata extends Metadata = any> extends Digital
|
|
|
42
42
|
/**
|
|
43
43
|
* Platform index Device document content
|
|
44
44
|
*/
|
|
45
|
-
interface DeviceProvisioningContentFields extends Pick<DeviceContent, "model" | "reference" | "
|
|
45
|
+
interface DeviceProvisioningContentFields extends Pick<DeviceContent, "model" | "reference" | "index" | "measureSlots"> {
|
|
46
46
|
/**
|
|
47
47
|
* Date of provisioning of the device on the platform
|
|
48
48
|
*/
|
|
@@ -13,13 +13,13 @@ export declare class GroupsController {
|
|
|
13
13
|
private get as();
|
|
14
14
|
/**
|
|
15
15
|
* Check that the path property is valid, and closest parent exists.
|
|
16
|
-
* @param {string}
|
|
16
|
+
* @param {string} index Engine ID
|
|
17
17
|
* @param {string} path The path of a group
|
|
18
18
|
* @throws {BadRequestError} If the path is not a string or if the path is not valid.
|
|
19
19
|
* @returns {void}
|
|
20
20
|
*/
|
|
21
|
-
checkPath(
|
|
22
|
-
checkGroupName(
|
|
21
|
+
checkPath(index: string, path: GroupsBodyRequest["path"], groupId?: string): Promise<void>;
|
|
22
|
+
checkGroupName(index: string, name: GroupsBodyRequest["name"], assetId?: string): Promise<void>;
|
|
23
23
|
create(request: KuzzleRequest): Promise<ApiGroupCreateResult>;
|
|
24
24
|
get(request: KuzzleRequest): Promise<ApiGroupGetResult>;
|
|
25
25
|
upsert(request: KuzzleRequest): Promise<ApiGroupUpsertResult>;
|
|
@@ -9,17 +9,17 @@ import { KuzzleLogger } from "kuzzle-logger";
|
|
|
9
9
|
export declare class GroupsService extends BaseService {
|
|
10
10
|
readonly logger: KuzzleLogger;
|
|
11
11
|
constructor(plugin: DeviceManagerPlugin, logger: KuzzleLogger);
|
|
12
|
-
create(_id: string,
|
|
13
|
-
get(
|
|
14
|
-
update(request: KuzzleRequest, _id: string,
|
|
12
|
+
create(_id: string, index: string, metadata: JSONObject, model: string, name: string, path: string, request: KuzzleRequest): Promise<KDocument<GroupContent>>;
|
|
13
|
+
get(index: string, _id: string, request: KuzzleRequest): Promise<import("kuzzle").KDocument<GroupContent>>;
|
|
14
|
+
update(request: KuzzleRequest, _id: string, index: string, name?: string, metadata?: Metadata): Promise<import("kuzzle").KDocument<GroupContent>>;
|
|
15
15
|
private _updatePath;
|
|
16
|
-
moveGroup(
|
|
16
|
+
moveGroup(index: string, _id: string, targetGroupId: string | null, request: KuzzleRequest): Promise<{
|
|
17
17
|
group: KDocument<GroupContent>;
|
|
18
18
|
targetGroupId: string | null;
|
|
19
19
|
}>;
|
|
20
|
-
delete(_id: string,
|
|
21
|
-
search(
|
|
22
|
-
listItems(
|
|
20
|
+
delete(_id: string, index: string, request: KuzzleRequest): Promise<string>;
|
|
21
|
+
search(index: string, searchParams: SearchParams, request: KuzzleRequest): Promise<import("kuzzle").SearchResult<import("kuzzle").KHit<GroupContent>>>;
|
|
22
|
+
listItems(index: string, _id: string, includeChildren: boolean, options: {
|
|
23
23
|
from?: number;
|
|
24
24
|
size?: number;
|
|
25
25
|
}, request: KuzzleRequest): Promise<{
|
|
@@ -32,7 +32,7 @@ export declare class GroupsService extends BaseService {
|
|
|
32
32
|
total: number;
|
|
33
33
|
};
|
|
34
34
|
}>;
|
|
35
|
-
addAssets(
|
|
35
|
+
addAssets(index: string, path: string, assetIds: string[], request: KuzzleRequest): Promise<{
|
|
36
36
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
37
37
|
successes: {
|
|
38
38
|
_id: string;
|
|
@@ -48,7 +48,7 @@ export declare class GroupsService extends BaseService {
|
|
|
48
48
|
reason: string;
|
|
49
49
|
}[];
|
|
50
50
|
}>;
|
|
51
|
-
removeAssets(
|
|
51
|
+
removeAssets(index: string, path: string, assetIds: string[], request: KuzzleRequest): Promise<{
|
|
52
52
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
53
53
|
successes: {
|
|
54
54
|
_id: string;
|
|
@@ -64,7 +64,7 @@ export declare class GroupsService extends BaseService {
|
|
|
64
64
|
reason: string;
|
|
65
65
|
}[];
|
|
66
66
|
}>;
|
|
67
|
-
addDevices(
|
|
67
|
+
addDevices(index: string, path: string, deviceIds: string[], request: KuzzleRequest): Promise<{
|
|
68
68
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
69
69
|
successes: {
|
|
70
70
|
_id: string;
|
|
@@ -80,7 +80,7 @@ export declare class GroupsService extends BaseService {
|
|
|
80
80
|
reason: string;
|
|
81
81
|
}[];
|
|
82
82
|
}>;
|
|
83
|
-
removeDevices(
|
|
83
|
+
removeDevices(index: string, path: string, deviceIds: string[], request: KuzzleRequest): Promise<{
|
|
84
84
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
85
85
|
successes: {
|
|
86
86
|
_id: string;
|
|
@@ -96,20 +96,20 @@ export declare class GroupsService extends BaseService {
|
|
|
96
96
|
reason: string;
|
|
97
97
|
}[];
|
|
98
98
|
}>;
|
|
99
|
-
mCreate(
|
|
99
|
+
mCreate(index: string, groups: Array<{
|
|
100
100
|
_id: string;
|
|
101
101
|
metadata: Metadata;
|
|
102
102
|
model: string;
|
|
103
103
|
name: string;
|
|
104
104
|
path: string;
|
|
105
105
|
}>): Promise<ApiGroupMCreateResult>;
|
|
106
|
-
mUpdate(
|
|
106
|
+
mUpdate(index: string, groups: Array<{
|
|
107
107
|
_id: string;
|
|
108
108
|
metadata: Metadata;
|
|
109
109
|
model: string;
|
|
110
110
|
name: string;
|
|
111
111
|
}>, request: KuzzleRequest): Promise<ApiGroupMUpdateResult>;
|
|
112
|
-
mUpsert(
|
|
112
|
+
mUpsert(index: string, groups: Array<{
|
|
113
113
|
_id: string;
|
|
114
114
|
metadata: Metadata;
|
|
115
115
|
model: string;
|
|
@@ -9,7 +9,7 @@ export type UpdateLinkResponse = mUpdateResponse & {
|
|
|
9
9
|
};
|
|
10
10
|
interface GroupControllerRequest {
|
|
11
11
|
controller: "device-manager/groups";
|
|
12
|
-
|
|
12
|
+
index: string;
|
|
13
13
|
}
|
|
14
14
|
export interface ApiGroupCreateRequest extends GroupControllerRequest {
|
|
15
15
|
action: "create";
|
|
@@ -19,12 +19,12 @@ interface MeasureExportParams extends ExportParams {
|
|
|
19
19
|
model: string;
|
|
20
20
|
}
|
|
21
21
|
export declare class MeasureExporter extends AbstractExporter<MeasureExportParams> {
|
|
22
|
-
protected exportRedisKey(
|
|
23
|
-
protected getLink(
|
|
22
|
+
protected exportRedisKey(index: string, exportId: string): string;
|
|
23
|
+
protected getLink(index: string, exportId: UUID, params: MeasureExportParams): string;
|
|
24
24
|
/**
|
|
25
25
|
* Searches for measures and return them in a standard JSON
|
|
26
26
|
*/
|
|
27
|
-
search(
|
|
27
|
+
search(index: string, params: MeasureSearchParams, options?: MeasuresSearchOptions): Promise<{
|
|
28
28
|
measures: KHit<MeasureContent<any, any>>[];
|
|
29
29
|
total: number;
|
|
30
30
|
}>;
|
|
@@ -37,7 +37,7 @@ export declare class MeasureExporter extends AbstractExporter<MeasureExportParam
|
|
|
37
37
|
*
|
|
38
38
|
* Never return a rejected promise and write potential error on the stream
|
|
39
39
|
*/
|
|
40
|
-
prepareExport(
|
|
40
|
+
prepareExport(index: string, user: User, params: MeasureSearchParams): Promise<string>;
|
|
41
41
|
protected formatHit(columns: Array<Column & {
|
|
42
42
|
shouldCheckName: boolean;
|
|
43
43
|
name: string;
|
|
@@ -48,7 +48,7 @@ export declare class MeasureExporter extends AbstractExporter<MeasureExportParam
|
|
|
48
48
|
* This method never returns a rejected promise, but write potential error in
|
|
49
49
|
* the stream.
|
|
50
50
|
*/
|
|
51
|
-
sendExport(
|
|
51
|
+
sendExport(index: string, exportId: string): Promise<import("stream").PassThrough>;
|
|
52
52
|
private generateMeasureColumns;
|
|
53
53
|
private prepareMeasureSearch;
|
|
54
54
|
}
|
|
@@ -29,14 +29,14 @@ export declare class MeasureService extends BaseService {
|
|
|
29
29
|
* @param asset The target asset to build the measure for
|
|
30
30
|
* @param measure The decoded raw measures
|
|
31
31
|
* @param payloadUuids The uuid's of the payloads used to create the measure
|
|
32
|
-
* @param
|
|
32
|
+
* @param tenantClass tenantClass of model
|
|
33
33
|
* @returns A MeasurementContent builded from parameters
|
|
34
34
|
*/
|
|
35
35
|
private buildApiMeasures;
|
|
36
36
|
/**
|
|
37
37
|
* Find an asset by its ID and its engine ID.
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
39
|
+
* @param index The target index ID
|
|
40
40
|
* @param assetId the target asset ID
|
|
41
41
|
* @returns The asset or null if not found
|
|
42
42
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ApiMeasureTarget, DeviceMeasureTarget } from "./types/MeasureTarget";
|
|
2
|
-
export declare function toApiTarget(indexId: string, assetId: string,
|
|
2
|
+
export declare function toApiTarget(indexId: string, assetId: string, tenantClasses?: string[]): ApiMeasureTarget;
|
|
3
3
|
export declare function toDeviceTarget(indexId: string, assetId?: string): DeviceMeasureTarget;
|
|
@@ -9,7 +9,7 @@ export interface DeviceMeasureTarget extends AbstractMeasureTarget {
|
|
|
9
9
|
export interface ApiMeasureTarget extends AbstractMeasureTarget {
|
|
10
10
|
type: "api";
|
|
11
11
|
assetId: string;
|
|
12
|
-
|
|
12
|
+
tenantClasses?: string[];
|
|
13
13
|
}
|
|
14
14
|
export declare function isTarget(target: any): target is AbstractMeasureTarget;
|
|
15
15
|
export declare function isTargetDevice(target: any): target is DeviceMeasureTarget;
|
|
@@ -14,51 +14,47 @@ export declare class ModelService extends BaseService {
|
|
|
14
14
|
private checkModelsConflicts;
|
|
15
15
|
private checkDefaultValues;
|
|
16
16
|
private checkGroupAffinity;
|
|
17
|
-
writeAsset(
|
|
17
|
+
writeAsset(tenantClasses: string[], model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: NamedMeasures, tooltipModels: TooltipModels, locales: {
|
|
18
18
|
[valueName: string]: LocaleDetails;
|
|
19
|
-
},
|
|
19
|
+
}, indexes?: string[], icon?: string): Promise<KDocument<AssetModelContent>>;
|
|
20
20
|
writeDevice(model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: NamedMeasures, icon?: string): Promise<KDocument<DeviceModelContent>>;
|
|
21
|
-
writeGroup(
|
|
21
|
+
writeGroup(tenantClasses: string[], model: string, affinity: JSONObject, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, icon?: string, locales?: {
|
|
22
22
|
[valueName: string]: LocaleDetails;
|
|
23
23
|
}): Promise<KDocument<GroupModelContent>>;
|
|
24
24
|
writeMeasure(type: string, valuesMappings: JSONObject, validationSchema?: SchemaObject, valuesDetails?: MeasureValuesDetails, locales?: {
|
|
25
25
|
[valueName: string]: LocaleDetails;
|
|
26
|
-
},
|
|
26
|
+
}, indexes?: string[], icon?: string): Promise<KDocument<MeasureModelContent>>;
|
|
27
27
|
deleteAsset(_id: string): Promise<void>;
|
|
28
28
|
deleteDevice(_id: string): Promise<void>;
|
|
29
29
|
deleteGroup(_id: string): Promise<void>;
|
|
30
30
|
deleteMeasure(_id: string): Promise<void>;
|
|
31
31
|
/**
|
|
32
|
-
* List all asset models regardless of
|
|
32
|
+
* List all asset models regardless of tenant class scope.
|
|
33
33
|
* Used for super admin global view.
|
|
34
34
|
*/
|
|
35
35
|
listAllAssets(): Promise<KDocument<AssetModelContent>[]>;
|
|
36
36
|
/**
|
|
37
37
|
* Check if an engine (tenant) exists by its ID.
|
|
38
38
|
*/
|
|
39
|
-
engineExists(
|
|
39
|
+
engineExists(index: string): Promise<boolean>;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Find tenant classes that don't exist.
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* Find engine groups that don't exist.
|
|
46
|
-
*/
|
|
47
|
-
findInvalidEngineGroups(engineGroups: string[]): Promise<string[]>;
|
|
48
|
-
listAsset(engineGroups: string[], engineId?: string): Promise<KDocument<AssetModelContent>[]>;
|
|
43
|
+
findInvalidTenantClasses(tenantClasses: string[]): Promise<string[]>;
|
|
44
|
+
listAsset(tenantClasses: string[], index?: string): Promise<KDocument<AssetModelContent>[]>;
|
|
49
45
|
listDevices(): Promise<KDocument<DeviceModelContent>[]>;
|
|
50
|
-
listGroups(
|
|
51
|
-
listMeasures(
|
|
52
|
-
searchAssets(
|
|
46
|
+
listGroups(tenantClasses: string[]): Promise<KDocument<GroupModelContent>[]>;
|
|
47
|
+
listMeasures(index?: string): Promise<KDocument<MeasureModelContent>[]>;
|
|
48
|
+
searchAssets(tenantClasses: string[], index: string | undefined, searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<AssetModelContent>>>;
|
|
53
49
|
searchDevices(searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<DeviceModelContent>>>;
|
|
54
|
-
searchGroups(
|
|
55
|
-
searchMeasures(
|
|
50
|
+
searchGroups(tenantClasses: string[], searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<GroupModelContent>>>;
|
|
51
|
+
searchMeasures(index: string | undefined, searchParams: Partial<SearchParams>): Promise<SearchResult<KHit<MeasureModelContent>>>;
|
|
56
52
|
assetExists(model: string): Promise<boolean>;
|
|
57
53
|
deviceExists(model: string): Promise<boolean>;
|
|
58
|
-
getAsset(
|
|
54
|
+
getAsset(tenantClasses: string[], index: string | undefined, model: string): Promise<KDocument<AssetModelContent>>;
|
|
59
55
|
getDevice(model: string): Promise<KDocument<DeviceModelContent>>;
|
|
60
56
|
getGroup(model: string): Promise<KDocument<GroupModelContent>>;
|
|
61
|
-
getMeasure(type: string,
|
|
57
|
+
getMeasure(type: string, index?: string): Promise<KDocument<MeasureModelContent>>;
|
|
62
58
|
/**
|
|
63
59
|
* Checks that creating/updating a measure model does not shadow an existing
|
|
64
60
|
* one at a different scope (global vs tenant-scoped).
|
|
@@ -67,7 +63,7 @@ export declare class ModelService extends BaseService {
|
|
|
67
63
|
/**
|
|
68
64
|
* Update an asset model
|
|
69
65
|
*/
|
|
70
|
-
updateAsset(
|
|
66
|
+
updateAsset(tenantClasses: string[], index: string | undefined, model: string, metadataMappings: MetadataMappings, defaultMetadata: JSONObject, metadataDetails: MetadataDetails, metadataGroups: MetadataGroups, measures: AssetModelContent["asset"]["measures"], tooltipModels: TooltipModels, locales: {
|
|
71
67
|
[valueName: string]: LocaleDetails;
|
|
72
68
|
}, icon: string | undefined, request: KuzzleRequest): Promise<KDocument<AssetModelContent>>;
|
|
73
69
|
}
|
|
@@ -17,7 +17,7 @@ export declare class ModelsRegister {
|
|
|
17
17
|
/**
|
|
18
18
|
* Registers an asset model.
|
|
19
19
|
*
|
|
20
|
-
* @param
|
|
20
|
+
* @param tenantClasses - The tenant class names.
|
|
21
21
|
* @param model - The name of the asset model, which must be in PascalCase.
|
|
22
22
|
* @param measures - The measures associated with this asset model.
|
|
23
23
|
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
@@ -28,7 +28,7 @@ export declare class ModelsRegister {
|
|
|
28
28
|
* @param icon - Optional icon representing the model.
|
|
29
29
|
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
30
30
|
*/
|
|
31
|
-
registerAsset(
|
|
31
|
+
registerAsset(tenantClasses: string[], model: string, measures: NamedMeasures, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups, tooltipModels?: TooltipModels, locales?: {
|
|
32
32
|
[valueName: string]: LocaleDetails;
|
|
33
33
|
}, icon?: string): void;
|
|
34
34
|
/**
|
|
@@ -48,7 +48,7 @@ export declare class ModelsRegister {
|
|
|
48
48
|
* Registers a group model.
|
|
49
49
|
*
|
|
50
50
|
*
|
|
51
|
-
* @param
|
|
51
|
+
* @param tenantClasses - The tenant class names.
|
|
52
52
|
* @param model - The name of the group model, which must be in PascalCase.
|
|
53
53
|
* @param affinity - The type of object accepted and their model affinity.
|
|
54
54
|
* @param metadataMappings - The metadata mappings for the model, defaults to an empty object.
|
|
@@ -59,7 +59,7 @@ export declare class ModelsRegister {
|
|
|
59
59
|
* @param locales - Optional translations specific to the model.
|
|
60
60
|
* @throws PluginImplementationError if the model name is not in PascalCase.
|
|
61
61
|
*/
|
|
62
|
-
registerGroup(
|
|
62
|
+
registerGroup(tenantClasses: string[], model: string, affinity: GroupAffinity, metadataMappings?: MetadataMappings, defaultMetadata?: JSONObject, metadataDetails?: MetadataDetails, metadataGroups?: MetadataGroups, icon?: string, locales?: {
|
|
63
63
|
[valueName: string]: LocaleDetails;
|
|
64
64
|
}): void;
|
|
65
65
|
registerMeasure(type: string, measureDefinition: MeasureDefinition): void;
|
|
@@ -8,7 +8,7 @@ interface ModelsControllerRequest {
|
|
|
8
8
|
export interface ApiModelGetAssetRequest extends ModelsControllerRequest {
|
|
9
9
|
action: "getAsset";
|
|
10
10
|
model: string;
|
|
11
|
-
|
|
11
|
+
tenantClasses: string[];
|
|
12
12
|
}
|
|
13
13
|
export type ApiModelGetAssetResult = KDocument<AssetModelContent>;
|
|
14
14
|
export interface ApiModelGetDeviceRequest extends ModelsControllerRequest {
|
|
@@ -24,14 +24,14 @@ export type ApiModelGetGroupResult = KDocument<GroupModelContent>;
|
|
|
24
24
|
export interface ApiModelGetMeasureRequest extends ModelsControllerRequest {
|
|
25
25
|
action: "getMeasure";
|
|
26
26
|
type: string;
|
|
27
|
-
|
|
27
|
+
index?: string;
|
|
28
28
|
}
|
|
29
29
|
export type ApiModelGetMeasureResult = KDocument<MeasureModelContent>;
|
|
30
30
|
export interface ApiModelWriteAssetRequest extends ModelsControllerRequest {
|
|
31
31
|
action: "writeAsset";
|
|
32
32
|
body: {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
tenantClasses: string[];
|
|
34
|
+
indexes?: string[];
|
|
35
35
|
model: string;
|
|
36
36
|
icon?: string;
|
|
37
37
|
metadataDetails?: MetadataDetails;
|
|
@@ -63,7 +63,7 @@ export interface ApiModelWriteGroupRequest extends ModelsControllerRequest {
|
|
|
63
63
|
action: "writeGroup";
|
|
64
64
|
body: {
|
|
65
65
|
affinity: GroupAffinity;
|
|
66
|
-
|
|
66
|
+
tenantClasses: string[];
|
|
67
67
|
model: string;
|
|
68
68
|
icon?: string;
|
|
69
69
|
metadataDetails?: MetadataDetails;
|
|
@@ -80,7 +80,7 @@ export interface ApiModelWriteMeasureRequest extends ModelsControllerRequest {
|
|
|
80
80
|
action: "writeMeasure";
|
|
81
81
|
body: {
|
|
82
82
|
type: string;
|
|
83
|
-
|
|
83
|
+
indexes?: string[];
|
|
84
84
|
icon?: string;
|
|
85
85
|
locales?: {
|
|
86
86
|
[valueName: string]: LocaleDetails;
|
|
@@ -93,7 +93,7 @@ export interface ApiModelWriteMeasureRequest extends ModelsControllerRequest {
|
|
|
93
93
|
export type ApiModelWriteMeasureResult = KDocument<MeasureModelContent>;
|
|
94
94
|
export interface ApiModelUpdateAssetRequest extends ModelsControllerRequest {
|
|
95
95
|
action: "updateAsset";
|
|
96
|
-
|
|
96
|
+
tenantClasses: string[];
|
|
97
97
|
model: string;
|
|
98
98
|
body: {
|
|
99
99
|
icon?: string;
|
|
@@ -131,7 +131,7 @@ export interface ApiModelDeleteMeasureRequest extends ModelsControllerRequest {
|
|
|
131
131
|
export type ApiModelDeleteMeasureResult = void;
|
|
132
132
|
export interface ApiModelListAssetsRequest extends ModelsControllerRequest {
|
|
133
133
|
action: "listAssets";
|
|
134
|
-
|
|
134
|
+
tenantClasses: string[];
|
|
135
135
|
}
|
|
136
136
|
export type ApiModelListAssetsResult = {
|
|
137
137
|
models: KDocument<AssetModelContent>[];
|
|
@@ -146,7 +146,7 @@ export type ApiModelListDevicesResult = {
|
|
|
146
146
|
};
|
|
147
147
|
export interface ApiModelListGroupsRequest extends ModelsControllerRequest {
|
|
148
148
|
action: "listGroups";
|
|
149
|
-
|
|
149
|
+
tenantClasses: string[];
|
|
150
150
|
}
|
|
151
151
|
export type ApiModelListGroupsResult = {
|
|
152
152
|
models: KDocument<GroupModelContent>[];
|
|
@@ -154,7 +154,7 @@ export type ApiModelListGroupsResult = {
|
|
|
154
154
|
};
|
|
155
155
|
export interface ApiModelListMeasuresRequest extends ModelsControllerRequest {
|
|
156
156
|
action: "listMeasures";
|
|
157
|
-
|
|
157
|
+
index?: string;
|
|
158
158
|
}
|
|
159
159
|
export type ApiModelListMeasuresResult = {
|
|
160
160
|
models: KDocument<MeasureModelContent>[];
|
|
@@ -162,7 +162,7 @@ export type ApiModelListMeasuresResult = {
|
|
|
162
162
|
};
|
|
163
163
|
export interface ApiModelSearchAssetsRequest extends ModelsControllerRequest {
|
|
164
164
|
action: "searchAssets";
|
|
165
|
-
|
|
165
|
+
tenantClasses: string[];
|
|
166
166
|
from?: number;
|
|
167
167
|
size?: number;
|
|
168
168
|
scrollTTL?: string;
|
|
@@ -179,7 +179,7 @@ export interface ApiModelSearchDevicesRequest extends ModelsControllerRequest {
|
|
|
179
179
|
export type ApiModelSearchDevicesResult = SearchResult<KHit<DeviceModelContent>>;
|
|
180
180
|
export interface ApiModelSearchGroupsRequest extends ModelsControllerRequest {
|
|
181
181
|
action: "searchGroups";
|
|
182
|
-
|
|
182
|
+
tenantClasses: string[];
|
|
183
183
|
from?: number;
|
|
184
184
|
size?: number;
|
|
185
185
|
scrollTTL?: string;
|
|
@@ -188,7 +188,7 @@ export interface ApiModelSearchGroupsRequest extends ModelsControllerRequest {
|
|
|
188
188
|
export type ApiModelSearchGroupsResult = SearchResult<KHit<GroupModelContent>>;
|
|
189
189
|
export interface ApiModelSearchMeasuresRequest extends ModelsControllerRequest {
|
|
190
190
|
action: "searchMeasures";
|
|
191
|
-
|
|
191
|
+
index?: string;
|
|
192
192
|
from?: number;
|
|
193
193
|
size?: number;
|
|
194
194
|
scrollTTL?: string;
|
|
@@ -3,8 +3,8 @@ import { NamedMeasures } from "../../decoder";
|
|
|
3
3
|
import { MeasureDefinition } from "../../measure";
|
|
4
4
|
export interface MeasureModelContent extends KDocumentContent {
|
|
5
5
|
type: "measure";
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
tenantClasses?: string[];
|
|
7
|
+
indexes?: string[];
|
|
8
8
|
measure: MeasureDefinition & {
|
|
9
9
|
type: string;
|
|
10
10
|
locales?: {
|
|
@@ -155,13 +155,13 @@ export interface TooltipModels {
|
|
|
155
155
|
}
|
|
156
156
|
export interface AssetModelContent extends KDocumentContent {
|
|
157
157
|
type: "asset";
|
|
158
|
-
|
|
158
|
+
tenantClasses: string[];
|
|
159
159
|
/**
|
|
160
160
|
* Optional list of engine IDs (tenant IDs) this model is scoped to.
|
|
161
161
|
* When set, the model is only available to the specified tenants.
|
|
162
|
-
* When absent, the model is available to all tenants in the
|
|
162
|
+
* When absent, the model is available to all tenants in the tenantClasses.
|
|
163
163
|
*/
|
|
164
|
-
|
|
164
|
+
indexes?: string[];
|
|
165
165
|
asset: {
|
|
166
166
|
/**
|
|
167
167
|
* Name of the model
|
|
@@ -408,7 +408,7 @@ export interface DeviceModelContent extends KDocumentContent {
|
|
|
408
408
|
}
|
|
409
409
|
export interface GroupModelContent extends KDocumentContent {
|
|
410
410
|
type: "group";
|
|
411
|
-
|
|
411
|
+
tenantClasses: string[];
|
|
412
412
|
group: {
|
|
413
413
|
/**
|
|
414
414
|
* Name of the model
|
|
@@ -2,8 +2,8 @@ import { AssetModelContent, DeviceModelContent, GroupModelContent, MeasureModelC
|
|
|
2
2
|
export type AskModelAssetGet = {
|
|
3
3
|
name: "ask:device-manager:model:asset:get";
|
|
4
4
|
payload: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
tenantClasses: string[];
|
|
6
|
+
index?: string;
|
|
7
7
|
model: string;
|
|
8
8
|
};
|
|
9
9
|
result: AssetModelContent;
|
|
@@ -19,7 +19,7 @@ export type AskModelMeasureGet = {
|
|
|
19
19
|
name: "ask:device-manager:model:measure:get";
|
|
20
20
|
payload: {
|
|
21
21
|
type: string;
|
|
22
|
-
|
|
22
|
+
index?: string;
|
|
23
23
|
};
|
|
24
24
|
result: MeasureModelContent;
|
|
25
25
|
};
|
|
@@ -18,7 +18,7 @@ export interface EngineDocument extends KDocumentContent {
|
|
|
18
18
|
export type AskEngineList = {
|
|
19
19
|
name: "ask:device-manager:engine:list";
|
|
20
20
|
payload: {
|
|
21
|
-
|
|
21
|
+
tenantClass?: string;
|
|
22
22
|
};
|
|
23
23
|
result: EngineContent[];
|
|
24
24
|
};
|
|
@@ -79,10 +79,10 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
79
79
|
*/
|
|
80
80
|
getEngines(): Promise<EngineDocument[]>;
|
|
81
81
|
updateMeasuresSchema(): Promise<void>;
|
|
82
|
-
onCreate(index: string,
|
|
82
|
+
onCreate(index: string, tenantClass?: string): Promise<{
|
|
83
83
|
collections: any[];
|
|
84
84
|
}>;
|
|
85
|
-
onUpdate(index: string,
|
|
85
|
+
onUpdate(index: string, tenantClass?: string): Promise<{
|
|
86
86
|
collections: any[];
|
|
87
87
|
}>;
|
|
88
88
|
onDelete(index: string): Promise<{
|
|
@@ -91,44 +91,44 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
91
91
|
/**
|
|
92
92
|
* Generate assets mappings and create the assets collection in the engine
|
|
93
93
|
*
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
94
|
+
* @param index The target engine Id
|
|
95
|
+
* @param tenantClass The tenant class
|
|
96
96
|
*
|
|
97
97
|
* @throws If it failed during the assets collection creation
|
|
98
98
|
*/
|
|
99
|
-
createAssetsCollection(
|
|
99
|
+
createAssetsCollection(index: string, tenantClass: string): Promise<InternalCollection>;
|
|
100
100
|
/**
|
|
101
101
|
* Generate assets mappings and create the assets history collection in the engine
|
|
102
102
|
*
|
|
103
|
-
* @param
|
|
104
|
-
* @param
|
|
103
|
+
* @param index The target engine Id
|
|
104
|
+
* @param tenantClass The tenant class
|
|
105
105
|
*
|
|
106
106
|
* @throws If it failed during the assets history collection creation
|
|
107
107
|
*/
|
|
108
|
-
createAssetsHistoryCollection(
|
|
108
|
+
createAssetsHistoryCollection(index: string, tenantClass: string): Promise<InternalCollection>;
|
|
109
109
|
/**
|
|
110
110
|
* Create the groups collection with the groups mappings in the engine
|
|
111
111
|
*
|
|
112
|
-
* @param
|
|
113
|
-
* @param
|
|
112
|
+
* @param index The target engine Id
|
|
113
|
+
* @param tenantClass The tenant class
|
|
114
114
|
*
|
|
115
115
|
* @throws If it failed during the groups collection creation
|
|
116
116
|
*/
|
|
117
|
-
createGroupsCollection(
|
|
117
|
+
createGroupsCollection(index: string): Promise<InternalCollection>;
|
|
118
118
|
/**
|
|
119
119
|
* Generate devices mappings and create the devices collection in the engine
|
|
120
120
|
*
|
|
121
|
-
* @param
|
|
122
|
-
* @param
|
|
121
|
+
* @param index The target engine Id
|
|
122
|
+
* @param tenantClass The tenant class
|
|
123
123
|
*
|
|
124
124
|
* @throws If it failed during the devices collection creation
|
|
125
125
|
*/
|
|
126
|
-
createDevicesCollection(
|
|
126
|
+
createDevicesCollection(index: string): Promise<InternalCollection>;
|
|
127
127
|
/**
|
|
128
128
|
* Generate devices mappings and create the devices collection in the engine
|
|
129
129
|
*
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
130
|
+
* @param index The target engine Id
|
|
131
|
+
* @param tenantClass The tenant class
|
|
132
132
|
*
|
|
133
133
|
* @throws If it failed during the devices collection creation
|
|
134
134
|
*/
|
|
@@ -136,12 +136,12 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
136
136
|
/**
|
|
137
137
|
* Generate measures mappings and create the measures collection in the engine
|
|
138
138
|
*
|
|
139
|
-
* @param
|
|
140
|
-
* @param
|
|
139
|
+
* @param index The target engine Id
|
|
140
|
+
* @param tenantClass The tenant class
|
|
141
141
|
*
|
|
142
142
|
* @throws If it failed during the measures collection creation
|
|
143
143
|
*/
|
|
144
|
-
createMeasuresCollection(
|
|
144
|
+
createMeasuresCollection(index: string, tenantClass: string): Promise<InternalCollection>;
|
|
145
145
|
/**
|
|
146
146
|
* Create a collection with custom mappings in an engine
|
|
147
147
|
*
|
|
@@ -156,7 +156,7 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
156
156
|
* Generate ES mappings from twin models and theirs associated measures, all fetched from the database
|
|
157
157
|
*
|
|
158
158
|
* @param digitalTwinType The target twin type
|
|
159
|
-
* @param
|
|
159
|
+
* @param tenantClass The twin tenant class
|
|
160
160
|
* @returns The complete ES mappings produces by merging all the target type twins
|
|
161
161
|
*/
|
|
162
162
|
private getDigitalTwinMappingsFromDB;
|
|
@@ -172,7 +172,7 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
172
172
|
/**
|
|
173
173
|
* Generate ES mappings from measures and theirs associated assets, all fetched via the database
|
|
174
174
|
*
|
|
175
|
-
* @param
|
|
175
|
+
* @param tenantClass The target tenant class
|
|
176
176
|
* @returns The complete ES mappings produced by merging models mappings
|
|
177
177
|
*/
|
|
178
178
|
private getMeasuresMappingsFromDB;
|
|
@@ -188,16 +188,16 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
|
|
|
188
188
|
/**
|
|
189
189
|
* Retrieve a certain type of models associated to an engine
|
|
190
190
|
*
|
|
191
|
-
* @param
|
|
191
|
+
* @param index The target engine Id
|
|
192
192
|
* @param type The desired model type
|
|
193
|
-
* @param
|
|
193
|
+
* @param tenantClass The target tenant class
|
|
194
194
|
* @returns An array of the generic type provided
|
|
195
195
|
*/
|
|
196
196
|
private getModels;
|
|
197
197
|
/**
|
|
198
198
|
* Detach all devices of an index in the platform index
|
|
199
199
|
*
|
|
200
|
-
* @param
|
|
200
|
+
* @param index The target engine Id
|
|
201
201
|
* @returns {any}
|
|
202
202
|
*/
|
|
203
203
|
private detachDevicesFromPlatformIndex;
|
|
@@ -24,7 +24,7 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
24
24
|
/**
|
|
25
25
|
* Register an asset model
|
|
26
26
|
*
|
|
27
|
-
* @param
|
|
27
|
+
* @param tenantClasses Tenant class names
|
|
28
28
|
* @param model Name of the asset model. Must follow a naming convention in PascalCase.
|
|
29
29
|
* @param definition Object containing the asset model definition, including:
|
|
30
30
|
* - measures: Array describing measure names and their types.
|
|
@@ -124,7 +124,7 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
124
124
|
* );
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
|
-
registerAsset: (
|
|
127
|
+
registerAsset: (tenantClasses: string[], model: string, definition: AssetModelDefinition) => void;
|
|
128
128
|
/**
|
|
129
129
|
* Register a device.
|
|
130
130
|
*
|
|
@@ -232,7 +232,7 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
232
232
|
* );
|
|
233
233
|
* ```
|
|
234
234
|
*/
|
|
235
|
-
registerGroup: (
|
|
235
|
+
registerGroup: (tenantClasses: string[], model: string, definition: GroupModelDefinition) => void;
|
|
236
236
|
/**
|
|
237
237
|
* Register a new measure
|
|
238
238
|
*
|
|
@@ -270,5 +270,12 @@ export declare class DeviceManagerPlugin extends Plugin {
|
|
|
270
270
|
* Initialize the config document if it does not exists
|
|
271
271
|
*/
|
|
272
272
|
private initializeConfig;
|
|
273
|
+
/**
|
|
274
|
+
* Moves the tenant scope of the models written before the rename from the
|
|
275
|
+
* former `engineIds` field to `indexes`. Idempotent: once a document carries
|
|
276
|
+
* `indexes` and no `engineIds`, it is left alone. Models are few, so the
|
|
277
|
+
* whole set fits in one search.
|
|
278
|
+
*/
|
|
279
|
+
private migrateModelIndexes;
|
|
273
280
|
private pipeCheckEngine;
|
|
274
281
|
}
|
|
@@ -22,7 +22,7 @@ export interface Column {
|
|
|
22
22
|
isMeasure?: boolean;
|
|
23
23
|
isIsoDate?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export type ExportStreamAugmenter = (result: SearchResult<KHit<KDocumentContentGeneric>>, columns: Column[],
|
|
25
|
+
export type ExportStreamAugmenter = (result: SearchResult<KHit<KDocumentContentGeneric>>, columns: Column[], index: string) => Promise<void>;
|
|
26
26
|
export declare abstract class AbstractExporter<P extends ExportParams = ExportParams> {
|
|
27
27
|
protected plugin: DeviceManagerPlugin;
|
|
28
28
|
protected target: InternalCollection;
|
|
@@ -32,18 +32,18 @@ export declare abstract class AbstractExporter<P extends ExportParams = ExportPa
|
|
|
32
32
|
protected get sdk(): import("kuzzle").EmbeddedSDK;
|
|
33
33
|
protected get ms(): any;
|
|
34
34
|
protected get log(): import("kuzzle-logger").KuzzleLogger;
|
|
35
|
-
protected getEngine(
|
|
36
|
-
protected abstract exportRedisKey(
|
|
37
|
-
protected abstract getLink(
|
|
35
|
+
protected getEngine(index: string): Promise<EngineContent>;
|
|
36
|
+
protected abstract exportRedisKey(index: string, exportId: string): string;
|
|
37
|
+
protected abstract getLink(index: string, exportId: UUID, params: P): string;
|
|
38
38
|
/**
|
|
39
39
|
* Retrieve a prepared export and write each document as a CSV in the stream
|
|
40
40
|
*
|
|
41
41
|
* This method never returns a rejected promise, but write potential error in
|
|
42
42
|
* the stream.
|
|
43
43
|
*/
|
|
44
|
-
abstract sendExport(
|
|
45
|
-
prepareExport(
|
|
44
|
+
abstract sendExport(index: string, exportId: string): Promise<Readable>;
|
|
45
|
+
prepareExport(index: string, user: User, params: P): Promise<string>;
|
|
46
46
|
protected formatHit(columns: Column[], hit: KHit<KDocumentContentGeneric>): string[];
|
|
47
|
-
getExport(
|
|
48
|
-
getExportStream(request: SearchResult<KHit<KDocumentContentGeneric>>, columns: Column[],
|
|
47
|
+
getExport(index: string, exportId: string): Promise<P>;
|
|
48
|
+
getExportStream(request: SearchResult<KHit<KDocumentContentGeneric>>, columns: Column[], index: string): Promise<PassThrough>;
|
|
49
49
|
}
|
|
@@ -2,7 +2,7 @@ import { ArgsDocumentControllerCreate, ArgsDocumentControllerDelete, ArgsDocumen
|
|
|
2
2
|
import { DeviceManagerPlugin, DeviceManagerConfiguration, InternalCollection } from "../../plugin";
|
|
3
3
|
interface PayloadRequest {
|
|
4
4
|
collection: InternalCollection;
|
|
5
|
-
|
|
5
|
+
index: string;
|
|
6
6
|
}
|
|
7
7
|
export type SearchParams = ReturnType<KuzzleRequest["getSearchParams"]>;
|
|
8
8
|
export declare abstract class BaseService {
|
|
@@ -12,7 +12,7 @@ export declare abstract class BaseService {
|
|
|
12
12
|
protected get sdk(): EmbeddedSDK;
|
|
13
13
|
protected get config(): DeviceManagerConfiguration;
|
|
14
14
|
protected get impersonatedSdk(): (user: User) => EmbeddedSDK;
|
|
15
|
-
protected normalizeKuzzleRequest(request: KuzzleRequest, { collection,
|
|
15
|
+
protected normalizeKuzzleRequest(request: KuzzleRequest, { collection, index }: PayloadRequest): KuzzleRequest;
|
|
16
16
|
/**
|
|
17
17
|
* Wrapper to SDK create method with trigger generic:document events
|
|
18
18
|
*
|
|
@@ -22,7 +22,7 @@ export declare abstract class BaseService {
|
|
|
22
22
|
* @param {ArgsDocumentControllerCreate} [options]
|
|
23
23
|
* @returns {Promise<KDocument>}
|
|
24
24
|
*/
|
|
25
|
-
protected getDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, documentId: string, { collection,
|
|
25
|
+
protected getDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, documentId: string, { collection, index }: PayloadRequest, options?: ArgsDocumentControllerCreate): Promise<KDocument<T>>;
|
|
26
26
|
/**
|
|
27
27
|
* Wrapper to SDK create method with trigger generic:document events
|
|
28
28
|
*
|
|
@@ -32,7 +32,7 @@ export declare abstract class BaseService {
|
|
|
32
32
|
* @param {ArgsDocumentControllerCreate} [options]
|
|
33
33
|
* @returns {Promise<KDocument>}
|
|
34
34
|
*/
|
|
35
|
-
protected createDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, document: KDocument<T>, { collection,
|
|
35
|
+
protected createDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, document: KDocument<T>, { collection, index }: PayloadRequest, options?: ArgsDocumentControllerCreate): Promise<KDocument<T>>;
|
|
36
36
|
/**
|
|
37
37
|
* Wrapper to SDK update method with trigger generic:document events
|
|
38
38
|
*
|
|
@@ -42,7 +42,7 @@ export declare abstract class BaseService {
|
|
|
42
42
|
* @param {ArgsDocumentControllerUpdate} [options]
|
|
43
43
|
* @returns {Promise<KDocument>}
|
|
44
44
|
*/
|
|
45
|
-
protected updateDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, document: KDocument<Partial<T>>, { collection,
|
|
45
|
+
protected updateDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, document: KDocument<Partial<T>>, { collection, index }: PayloadRequest, options?: ArgsDocumentControllerUpdate): Promise<KDocument<T>>;
|
|
46
46
|
/**
|
|
47
47
|
* Wrapper to SDK delete method with trigger generic:document events
|
|
48
48
|
*
|
|
@@ -52,7 +52,7 @@ export declare abstract class BaseService {
|
|
|
52
52
|
* @param {ArgsDocumentControllerUpdate} [options]
|
|
53
53
|
* @returns {Promise<{ _id: string }>}
|
|
54
54
|
*/
|
|
55
|
-
protected deleteDocument(request: KuzzleRequest, documentId: string, { collection,
|
|
55
|
+
protected deleteDocument(request: KuzzleRequest, documentId: string, { collection, index }: PayloadRequest, options?: ArgsDocumentControllerDelete): Promise<{
|
|
56
56
|
_id: string;
|
|
57
57
|
}>;
|
|
58
58
|
/**
|
|
@@ -64,6 +64,6 @@ export declare abstract class BaseService {
|
|
|
64
64
|
* @param {PayloadRequest} payload
|
|
65
65
|
* @returns {Promise<SearchResult<KHit>>}
|
|
66
66
|
*/
|
|
67
|
-
protected searchDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, { from, size, scrollTTL: scroll }: SearchParams, { collection,
|
|
67
|
+
protected searchDocument<T extends KDocumentContent = KDocumentContent>(request: KuzzleRequest, { from, size, scrollTTL: scroll }: SearchParams, { collection, index }: PayloadRequest): Promise<SearchResult<KHit<T>>>;
|
|
68
68
|
}
|
|
69
69
|
export {};
|
|
@@ -7,9 +7,9 @@ export declare class DigitalTwinExporter extends AbstractExporter {
|
|
|
7
7
|
protected plugin: DeviceManagerPlugin;
|
|
8
8
|
protected target: InternalCollection;
|
|
9
9
|
constructor(plugin: DeviceManagerPlugin, target: InternalCollection, config?: Partial<ExporterOption>);
|
|
10
|
-
protected exportRedisKey(
|
|
11
|
-
protected getLink(
|
|
12
|
-
sendExport(
|
|
10
|
+
protected exportRedisKey(index: string, exportId: string): string;
|
|
11
|
+
protected getLink(index: string, exportId: UUID): string;
|
|
12
|
+
sendExport(index: string, exportId: string): Promise<import("stream").PassThrough>;
|
|
13
13
|
/**
|
|
14
14
|
* Get the deduplicated Named Measures get from models
|
|
15
15
|
*/
|
|
@@ -19,11 +19,11 @@ export declare class DigitalTwinService extends BaseService {
|
|
|
19
19
|
/**
|
|
20
20
|
* Gets the last measures of a digital twin
|
|
21
21
|
*/
|
|
22
|
-
getLastMeasures(
|
|
22
|
+
getLastMeasures(index: string, digitalTwinId: string, measureCount?: number): Promise<MeasureContent[]>;
|
|
23
23
|
/**
|
|
24
24
|
* Link a device to an asset.
|
|
25
25
|
*/
|
|
26
|
-
linkAssetDevice(
|
|
26
|
+
linkAssetDevice(index: string, deviceId: string, assetId: string, measureSlots: {
|
|
27
27
|
asset: string;
|
|
28
28
|
device: string;
|
|
29
29
|
}[], implicitMeasuresLinking: boolean, request: KuzzleRequest): Promise<{
|
|
@@ -44,9 +44,9 @@ export declare class DigitalTwinService extends BaseService {
|
|
|
44
44
|
/**
|
|
45
45
|
* Gets the last measures of multiple digital twins
|
|
46
46
|
*/
|
|
47
|
-
mGetLastMeasures(
|
|
48
|
-
getLastMeasuredAt(
|
|
49
|
-
mGetLastMeasuredAt(
|
|
47
|
+
mGetLastMeasures(index: string, digitalTwinIds: string[], measureCount?: number): Promise<Record<string, MeasureContent[]>>;
|
|
48
|
+
getLastMeasuredAt(index: string, digitalTwinId: string): Promise<number>;
|
|
49
|
+
mGetLastMeasuredAt(index: string, digitalTwinIds: string[]): Promise<ApiDigitalTwinMGetLastMeasuredAtResult>;
|
|
50
50
|
private getAggregationQueryParameters;
|
|
51
51
|
/**
|
|
52
52
|
* Checks if the asset does not already have a linked device using one of the
|
|
@@ -78,13 +78,13 @@ export declare class DigitalTwinService extends BaseService {
|
|
|
78
78
|
}>;
|
|
79
79
|
/**
|
|
80
80
|
* Retrieve the model document of an asset
|
|
81
|
-
* @param {any}
|
|
81
|
+
* @param {any} tenantClass:string
|
|
82
82
|
* @param {any} model:string
|
|
83
83
|
* @returns {any}
|
|
84
84
|
*/
|
|
85
|
-
protected getAssetModel(
|
|
85
|
+
protected getAssetModel(tenantClass: string, model: string, index?: string): Promise<AssetModelContent>;
|
|
86
86
|
protected getDeviceModel(model: string): Promise<DeviceModelContent>;
|
|
87
|
-
getEngine(
|
|
87
|
+
getEngine(index: string): Promise<JSONObject>;
|
|
88
88
|
protected getDeviceProvisioning(deviceId: string): Promise<import("kuzzle").KDocument<DeviceProvisioningContent>>;
|
|
89
89
|
protected checkDeviceAttachedToEngine(device: KDocument<DeviceProvisioningContent>): void;
|
|
90
90
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DigitalTwinMeasures } from "./DigitalTwinMeasures";
|
|
2
2
|
interface DigitalTwinControllerRequest<ControllerName extends string> {
|
|
3
3
|
controller: ControllerName;
|
|
4
|
-
|
|
4
|
+
index: string;
|
|
5
5
|
}
|
|
6
6
|
export interface ApiDigitalTwinGetLastMeasuresRequest<ControllerName extends string> extends DigitalTwinControllerRequest<ControllerName> {
|
|
7
7
|
action: "getLastMeasures";
|
|
@@ -3,7 +3,7 @@ import { MeasureContent } from "../../measure";
|
|
|
3
3
|
export type AskDigitalTwinLastMeasuresGet = {
|
|
4
4
|
name: "ask:device-manager:asset:get-last-measures" | "ask:device-manager:device:get-last-measures";
|
|
5
5
|
payload: {
|
|
6
|
-
|
|
6
|
+
index: string;
|
|
7
7
|
digitalTwinId: string;
|
|
8
8
|
};
|
|
9
9
|
result: MeasureContent[];
|
|
@@ -11,7 +11,7 @@ export type AskDigitalTwinLastMeasuresGet = {
|
|
|
11
11
|
export type AskDigitalTwinLink = {
|
|
12
12
|
name: "ask:device-manager:device:link-asset" | "ask:device-manager:asset:link-device";
|
|
13
13
|
payload: {
|
|
14
|
-
|
|
14
|
+
index: string;
|
|
15
15
|
assetId: string;
|
|
16
16
|
deviceId: string;
|
|
17
17
|
user: User;
|