kuzzle-device-manager-types 3.0.0-3-dev.19 → 3.0.0-3-dev.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/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 +18 -12
- package/dist/lib/modules/asset/AssetsController.d.ts +1 -1
- package/dist/lib/modules/asset/roles/RoleAssetsAdmin.d.ts +1 -0
- package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +1 -0
- 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/roles/RoleDevicesAdmin.d.ts +1 -0
- package/dist/lib/modules/device/roles/RoleDevicesReader.d.ts +1 -0
- 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 +19 -14
- package/dist/lib/modules/group/index.d.ts +1 -0
- package/dist/lib/modules/group/roles/RoleGroupsAdmin.d.ts +1 -0
- package/dist/lib/modules/group/roles/RoleGroupsReader.d.ts +1 -0
- package/dist/lib/modules/group/types/GroupEvents.d.ts +8 -0
- 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/MetadataReferential.d.ts +119 -0
- package/dist/lib/modules/model/ModelService.d.ts +120 -22
- package/dist/lib/modules/model/ModelsConflicts.d.ts +23 -0
- package/dist/lib/modules/model/ModelsController.d.ts +11 -2
- package/dist/lib/modules/model/ModelsRegister.d.ts +37 -5
- package/dist/lib/modules/model/types/ModelApi.d.ts +105 -14
- package/dist/lib/modules/model/types/ModelContent.d.ts +73 -7
- package/dist/lib/modules/model/types/ModelDefinition.d.ts +6 -3
- package/dist/lib/modules/model/types/ModelEvents.d.ts +9 -4
- package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +58 -25
- package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +46 -4
- package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +11 -0
- 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/dist/lib/modules/shared/utils/lock.d.ts +7 -1
- package/dist/tests/application/assets/Pole.d.ts +5 -0
- package/dist/tests/application/assets/index.d.ts +1 -0
- package/dist/tests/application/metadata.d.ts +5 -0
- 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,19 @@ 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
|
+
/**
|
|
62
|
+
* Lists the engines whose assets use the given model:
|
|
63
|
+
* the model indexes for a tenant-scoped model, every engine for a commons model,
|
|
64
|
+
* and the engines of the model tenantClasses otherwise.
|
|
65
|
+
*/
|
|
66
|
+
private getModelEngines;
|
|
61
67
|
}
|
|
@@ -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,22 @@ 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Refreshes the metadata of the groups of a model, in every engine of the model scope:
|
|
14
|
+
* added metadata are set to their default value, removed metadata are deleted.
|
|
15
|
+
*/
|
|
16
|
+
private refreshModel;
|
|
17
|
+
create(_id: string, index: string, metadata: JSONObject, model: string, name: string, path: string, request: KuzzleRequest): Promise<KDocument<GroupContent>>;
|
|
18
|
+
get(index: string, _id: string, request: KuzzleRequest): Promise<import("kuzzle").KDocument<GroupContent>>;
|
|
19
|
+
update(request: KuzzleRequest, _id: string, index: string, name?: string, metadata?: Metadata): Promise<import("kuzzle").KDocument<GroupContent>>;
|
|
15
20
|
private _updatePath;
|
|
16
|
-
moveGroup(
|
|
21
|
+
moveGroup(index: string, _id: string, targetGroupId: string | null, request: KuzzleRequest): Promise<{
|
|
17
22
|
group: KDocument<GroupContent>;
|
|
18
23
|
targetGroupId: string | null;
|
|
19
24
|
}>;
|
|
20
|
-
delete(_id: string,
|
|
21
|
-
search(
|
|
22
|
-
listItems(
|
|
25
|
+
delete(_id: string, index: string, request: KuzzleRequest): Promise<string>;
|
|
26
|
+
search(index: string, searchParams: SearchParams, request: KuzzleRequest): Promise<import("kuzzle").SearchResult<import("kuzzle").KHit<GroupContent>>>;
|
|
27
|
+
listItems(index: string, _id: string, includeChildren: boolean, options: {
|
|
23
28
|
from?: number;
|
|
24
29
|
size?: number;
|
|
25
30
|
}, request: KuzzleRequest): Promise<{
|
|
@@ -32,7 +37,7 @@ export declare class GroupsService extends BaseService {
|
|
|
32
37
|
total: number;
|
|
33
38
|
};
|
|
34
39
|
}>;
|
|
35
|
-
addAssets(
|
|
40
|
+
addAssets(index: string, path: string, assetIds: string[], request: KuzzleRequest): Promise<{
|
|
36
41
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
37
42
|
successes: {
|
|
38
43
|
_id: string;
|
|
@@ -48,7 +53,7 @@ export declare class GroupsService extends BaseService {
|
|
|
48
53
|
reason: string;
|
|
49
54
|
}[];
|
|
50
55
|
}>;
|
|
51
|
-
removeAssets(
|
|
56
|
+
removeAssets(index: string, path: string, assetIds: string[], request: KuzzleRequest): Promise<{
|
|
52
57
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
53
58
|
successes: {
|
|
54
59
|
_id: string;
|
|
@@ -64,7 +69,7 @@ export declare class GroupsService extends BaseService {
|
|
|
64
69
|
reason: string;
|
|
65
70
|
}[];
|
|
66
71
|
}>;
|
|
67
|
-
addDevices(
|
|
72
|
+
addDevices(index: string, path: string, deviceIds: string[], request: KuzzleRequest): Promise<{
|
|
68
73
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
69
74
|
successes: {
|
|
70
75
|
_id: string;
|
|
@@ -80,7 +85,7 @@ export declare class GroupsService extends BaseService {
|
|
|
80
85
|
reason: string;
|
|
81
86
|
}[];
|
|
82
87
|
}>;
|
|
83
|
-
removeDevices(
|
|
88
|
+
removeDevices(index: string, path: string, deviceIds: string[], request: KuzzleRequest): Promise<{
|
|
84
89
|
group: import("kuzzle").KDocument<GroupContent>;
|
|
85
90
|
successes: {
|
|
86
91
|
_id: string;
|
|
@@ -96,20 +101,20 @@ export declare class GroupsService extends BaseService {
|
|
|
96
101
|
reason: string;
|
|
97
102
|
}[];
|
|
98
103
|
}>;
|
|
99
|
-
mCreate(
|
|
104
|
+
mCreate(index: string, groups: Array<{
|
|
100
105
|
_id: string;
|
|
101
106
|
metadata: Metadata;
|
|
102
107
|
model: string;
|
|
103
108
|
name: string;
|
|
104
109
|
path: string;
|
|
105
110
|
}>): Promise<ApiGroupMCreateResult>;
|
|
106
|
-
mUpdate(
|
|
111
|
+
mUpdate(index: string, groups: Array<{
|
|
107
112
|
_id: string;
|
|
108
113
|
metadata: Metadata;
|
|
109
114
|
model: string;
|
|
110
115
|
name: string;
|
|
111
116
|
}>, request: KuzzleRequest): Promise<ApiGroupMUpdateResult>;
|
|
112
|
-
mUpsert(
|
|
117
|
+
mUpsert(index: string, groups: Array<{
|
|
113
118
|
_id: string;
|
|
114
119
|
metadata: Metadata;
|
|
115
120
|
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;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { EmbeddedSDK } from "kuzzle";
|
|
2
|
+
import { JSONObject, KDocument } from "kuzzle-sdk";
|
|
3
|
+
import { ConflictChunk } from "./ModelsConflicts";
|
|
4
|
+
import { AssetModelContent, DeviceModelContent, GroupModelContent, MetadataDetails, MetadataMappings, MetadataReferential, MetadataReferentialContent, MetadataReferentialEntry, ReferentialMetadataMapping, ResolvedMetadataMappings } from "./types/ModelContent";
|
|
5
|
+
export declare const METADATA_REFERENTIAL_ID = "model-metadata-referential";
|
|
6
|
+
/**
|
|
7
|
+
* Runs cb holding the metadata referential lock, taken by every write of the referential
|
|
8
|
+
* and of asset, device and group models, so their conflicts checks see each other writes
|
|
9
|
+
*/
|
|
10
|
+
export declare function withMetadataReferentialLock<T>(cb: () => Promise<T>): Promise<T>;
|
|
11
|
+
export type MetadataModelContent = AssetModelContent | DeviceModelContent | GroupModelContent;
|
|
12
|
+
export type MetadataModelType = MetadataModelContent["type"];
|
|
13
|
+
/**
|
|
14
|
+
* Metadata related fields of an asset, device or group model
|
|
15
|
+
*/
|
|
16
|
+
export type ModelMetadataFields = {
|
|
17
|
+
metadataMappings: MetadataMappings;
|
|
18
|
+
defaultMetadata: JSONObject;
|
|
19
|
+
metadataDetails: MetadataDetails;
|
|
20
|
+
};
|
|
21
|
+
export type MetadataResolutionContext = {
|
|
22
|
+
modelType: MetadataModelType;
|
|
23
|
+
model: string;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the error thrown on an invalid use of the referential.
|
|
26
|
+
* PluginImplementationError when registering from code, BadRequestError from the API.
|
|
27
|
+
*/
|
|
28
|
+
createError: (message: string) => Error;
|
|
29
|
+
};
|
|
30
|
+
export type MetadataEnrichment = {
|
|
31
|
+
/**
|
|
32
|
+
* Metadata fields to store: referential markers are kept in metadataMappings,
|
|
33
|
+
* metadataDetails and defaultMetadata are enriched with the referential values
|
|
34
|
+
*/
|
|
35
|
+
fields: ModelMetadataFields;
|
|
36
|
+
/**
|
|
37
|
+
* Metadata mappings with the referential markers replaced by the referential mappings
|
|
38
|
+
*/
|
|
39
|
+
resolvedMappings: ResolvedMetadataMappings;
|
|
40
|
+
/**
|
|
41
|
+
* Inline metadata identical to a referential entry, which should use the referential instead
|
|
42
|
+
*/
|
|
43
|
+
warnings: string[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @returns true if the metadata mappings mark a metadata of the referential
|
|
47
|
+
*/
|
|
48
|
+
export declare function isReferentialMapping(mapping: unknown): mapping is ReferentialMetadataMapping;
|
|
49
|
+
/**
|
|
50
|
+
* Lists the metadata of a model coming from the metadata referential
|
|
51
|
+
*/
|
|
52
|
+
export declare function getReferentialNames(metadataMappings?: MetadataMappings): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Replaces the referential markers of metadata mappings by the referential mappings.
|
|
55
|
+
* A marker of a metadata missing from the referential is dropped.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveMetadataMappings(referential: MetadataReferential, metadataMappings?: MetadataMappings): ResolvedMetadataMappings;
|
|
58
|
+
/**
|
|
59
|
+
* @returns The model with the referential markers of its metadata mappings resolved
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveModelMappings<T extends MetadataModelContent>(referential: MetadataReferential, content: T): T;
|
|
62
|
+
/**
|
|
63
|
+
* Resolves the referential metadata of a stored model, to be read:
|
|
64
|
+
* the markers are replaced by the referential mappings, the details and default values
|
|
65
|
+
* are merged over the current referential values.
|
|
66
|
+
* A marker of a metadata missing from the referential is dropped.
|
|
67
|
+
*
|
|
68
|
+
* @returns The model with its referential metadata resolved
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveModelMetadata<T extends MetadataModelContent>(referential: MetadataReferential, content: T): T;
|
|
71
|
+
/**
|
|
72
|
+
* Validates the shape of a metadata referential entry
|
|
73
|
+
*
|
|
74
|
+
* @throws The error built by createError if the entry is invalid
|
|
75
|
+
*/
|
|
76
|
+
export declare function checkMetadataReferentialEntry(name: string, entry: MetadataReferentialEntry, createError: (message: string) => Error): void;
|
|
77
|
+
/**
|
|
78
|
+
* Validates the metadata mappings of a model against the metadata referential and enriches
|
|
79
|
+
* the details and default values of the metadata coming from the referential.
|
|
80
|
+
*
|
|
81
|
+
* A metadata of the referential is marked `{ referential: true }` in metadataMappings, the marker is kept.
|
|
82
|
+
* Its details are the referential locales (merged per locale), editorHint and icon, overridden by the
|
|
83
|
+
* model ones. Its default value is the referential one, unless the model defines one.
|
|
84
|
+
*
|
|
85
|
+
* An inline metadata with the name of a referential entry must have the same mappings (legacy).
|
|
86
|
+
*
|
|
87
|
+
* @throws The error built by createError on an invalid marker or an unknown metadata
|
|
88
|
+
* @throws MappingsConflictsError if an inline metadata conflicts with the referential
|
|
89
|
+
*/
|
|
90
|
+
export declare function enrichModelMetadata(referential: MetadataReferential, fields: Partial<ModelMetadataFields>, context: MetadataResolutionContext): MetadataEnrichment;
|
|
91
|
+
/**
|
|
92
|
+
* Lists the conflicts between a referential entry and the inline metadata of the same name of models
|
|
93
|
+
*/
|
|
94
|
+
export declare function getEntryModelsConflicts(name: string, entry: MetadataReferentialEntry, models: MetadataModelContent[]): ConflictChunk[];
|
|
95
|
+
/**
|
|
96
|
+
* Lists the inline metadata a model write adds: metadataMappings keys that neither
|
|
97
|
+
* use the referential nor are already defined inline by the stored model.
|
|
98
|
+
*/
|
|
99
|
+
export declare function getAddedInlineMetadata(metadataMappings: MetadataMappings, stored: MetadataModelContent | null): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Reads the metadata referential document
|
|
102
|
+
*
|
|
103
|
+
* @returns The referential metadata, empty if the document does not exist yet
|
|
104
|
+
*/
|
|
105
|
+
export declare function fetchMetadataReferential(sdk: EmbeddedSDK, platformIndex: string): Promise<MetadataReferential>;
|
|
106
|
+
/**
|
|
107
|
+
* Writes the whole metadata referential document
|
|
108
|
+
*/
|
|
109
|
+
export declare function saveMetadataReferential(sdk: EmbeddedSDK, platformIndex: string, referential: MetadataReferential): Promise<import("kuzzle").KDocument<MetadataReferentialContent>>;
|
|
110
|
+
/**
|
|
111
|
+
* Lists every stored asset, device and group model
|
|
112
|
+
*/
|
|
113
|
+
export declare function fetchMetadataModels(sdk: EmbeddedSDK, platformIndex: string): Promise<KDocument<MetadataModelContent>[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Lists every stored asset, device and group model using the given metadata of the referential.
|
|
116
|
+
*
|
|
117
|
+
* metadataMappings is not indexed, the filtering is done after fetching the models.
|
|
118
|
+
*/
|
|
119
|
+
export declare function fetchReferencingModels(sdk: EmbeddedSDK, platformIndex: string, name: string): Promise<KDocument<MetadataModelContent>[]>;
|