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.
Files changed (48) hide show
  1. package/dist/bin/migration/migrate-tenant-classes.d.ts +2 -0
  2. package/dist/lib/modules/asset/AssetHistoryService.d.ts +1 -1
  3. package/dist/lib/modules/asset/AssetService.d.ts +18 -12
  4. package/dist/lib/modules/asset/AssetsController.d.ts +1 -1
  5. package/dist/lib/modules/asset/roles/RoleAssetsAdmin.d.ts +1 -0
  6. package/dist/lib/modules/asset/roles/RoleAssetsReader.d.ts +1 -0
  7. package/dist/lib/modules/asset/types/AssetApi.d.ts +6 -6
  8. package/dist/lib/modules/asset/types/AssetEvents.d.ts +1 -1
  9. package/dist/lib/modules/device/DeviceService.d.ts +11 -11
  10. package/dist/lib/modules/device/roles/RoleDevicesAdmin.d.ts +1 -0
  11. package/dist/lib/modules/device/roles/RoleDevicesReader.d.ts +1 -0
  12. package/dist/lib/modules/device/types/DeviceApi.d.ts +2 -2
  13. package/dist/lib/modules/device/types/DeviceContent.d.ts +2 -2
  14. package/dist/lib/modules/device/types/DeviceEvents.d.ts +1 -1
  15. package/dist/lib/modules/group/GroupsController.d.ts +3 -3
  16. package/dist/lib/modules/group/GroupsService.d.ts +19 -14
  17. package/dist/lib/modules/group/index.d.ts +1 -0
  18. package/dist/lib/modules/group/roles/RoleGroupsAdmin.d.ts +1 -0
  19. package/dist/lib/modules/group/roles/RoleGroupsReader.d.ts +1 -0
  20. package/dist/lib/modules/group/types/GroupEvents.d.ts +8 -0
  21. package/dist/lib/modules/group/types/GroupsApi.d.ts +1 -1
  22. package/dist/lib/modules/measure/MeasureExporter.d.ts +5 -5
  23. package/dist/lib/modules/measure/MeasureService.d.ts +2 -2
  24. package/dist/lib/modules/measure/MeasureTargetBuilder.d.ts +1 -1
  25. package/dist/lib/modules/measure/types/MeasureTarget.d.ts +1 -1
  26. package/dist/lib/modules/model/MetadataReferential.d.ts +119 -0
  27. package/dist/lib/modules/model/ModelService.d.ts +120 -22
  28. package/dist/lib/modules/model/ModelsConflicts.d.ts +23 -0
  29. package/dist/lib/modules/model/ModelsController.d.ts +11 -2
  30. package/dist/lib/modules/model/ModelsRegister.d.ts +37 -5
  31. package/dist/lib/modules/model/types/ModelApi.d.ts +105 -14
  32. package/dist/lib/modules/model/types/ModelContent.d.ts +73 -7
  33. package/dist/lib/modules/model/types/ModelDefinition.d.ts +6 -3
  34. package/dist/lib/modules/model/types/ModelEvents.d.ts +9 -4
  35. package/dist/lib/modules/plugin/DeviceManagerEngine.d.ts +58 -25
  36. package/dist/lib/modules/plugin/DeviceManagerPlugin.d.ts +46 -4
  37. package/dist/lib/modules/plugin/types/DeviceManagerConfiguration.d.ts +11 -0
  38. package/dist/lib/modules/shared/services/AbstractExporter.d.ts +8 -8
  39. package/dist/lib/modules/shared/services/BaseService.d.ts +7 -7
  40. package/dist/lib/modules/shared/services/DigitalTwinExporter.d.ts +3 -3
  41. package/dist/lib/modules/shared/services/DigitalTwinService.d.ts +8 -8
  42. package/dist/lib/modules/shared/types/DigitalTwinApi.d.ts +1 -1
  43. package/dist/lib/modules/shared/types/DigitalTwinEvents.d.ts +2 -2
  44. package/dist/lib/modules/shared/utils/lock.d.ts +7 -1
  45. package/dist/tests/application/assets/Pole.d.ts +5 -0
  46. package/dist/tests/application/assets/index.d.ts +1 -0
  47. package/dist/tests/application/metadata.d.ts +5 -0
  48. package/package.json +1 -1
@@ -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
- engineGroups?: string[];
7
- engineIds?: string[];
6
+ tenantClasses?: string[];
7
+ indexes?: string[];
8
8
  measure: MeasureDefinition & {
9
9
  type: string;
10
10
  locales?: {
@@ -22,7 +22,20 @@ export interface MetadataObject {
22
22
  [key: string]: MetadataProperty | MetadataObject;
23
23
  };
24
24
  }
25
+ /**
26
+ * Marks, in the metadataMappings of a model, a metadata defined in the metadata referential.
27
+ * Its mappings are the referential ones, they are already merged into the engines collections.
28
+ */
29
+ export interface ReferentialMetadataMapping {
30
+ referential: true;
31
+ }
25
32
  export interface MetadataMappings {
33
+ [key: string]: MetadataProperty | MetadataObject | ReferentialMetadataMapping;
34
+ }
35
+ /**
36
+ * Metadata mappings without referential markers, as merged into the engines collections
37
+ */
38
+ export interface ResolvedMetadataMappings {
26
39
  [key: string]: MetadataProperty | MetadataObject;
27
40
  }
28
41
  export interface GroupAffinity {
@@ -95,9 +108,62 @@ export interface MetadataDetails {
95
108
  * Then add a new field in EditorHintEnum to define the type of your hint.
96
109
  * Finally add the new editor hint interface with a pipe to take in account the new type.
97
110
  */
98
- editorHint?: BaseEditorHint | OptionsSelectorEditorHint | DatetimeEditorHint;
111
+ editorHint?: EditorHint;
112
+ /**
113
+ * Icon representing the metadata.
114
+ * Free-form string, e.g. a FontAwesome icon name, a URL to a PNG/SVG image, or inline SVG markup.
115
+ */
116
+ icon?: string;
99
117
  };
100
118
  }
119
+ export type EditorHint = BaseEditorHint | OptionsSelectorEditorHint | DatetimeEditorHint;
120
+ /**
121
+ * A metadata defined once in the application metadata referential.
122
+ * Its mappings are merged into the engines collections when it is written,
123
+ * models use it with `{ referential: true }` in their metadataMappings.
124
+ */
125
+ export interface MetadataReferentialEntry {
126
+ /**
127
+ * Mappings of the metadata.
128
+ * They cannot be modified once written, as they are merged into the engines collections.
129
+ *
130
+ * @example
131
+ * { type: "keyword" }
132
+ * { properties: { name: { type: "keyword" } } }
133
+ */
134
+ mappings: MetadataProperty | MetadataObject;
135
+ /**
136
+ * Default translations of the metadata, copied into the metadataDetails of a model using it
137
+ */
138
+ locales: {
139
+ [locale: string]: LocaleDetails;
140
+ };
141
+ /**
142
+ * Default editor hint of the metadata
143
+ */
144
+ editorHint?: EditorHint;
145
+ /**
146
+ * Default value of the metadata
147
+ */
148
+ defaultValue?: unknown;
149
+ /**
150
+ * Default icon of the metadata.
151
+ * Free-form string, e.g. a FontAwesome icon name, a URL to a PNG/SVG image, or inline SVG markup.
152
+ */
153
+ icon?: string;
154
+ /**
155
+ * Set by the plugin: true for a metadata registered from code.
156
+ * It is written at every startup and cannot be modified or deleted through the API.
157
+ */
158
+ managed?: boolean;
159
+ }
160
+ export interface MetadataReferential {
161
+ [name: string]: MetadataReferentialEntry;
162
+ }
163
+ export interface MetadataReferentialContent extends KDocumentContent {
164
+ type: "metadata-referential";
165
+ metadata: MetadataReferential;
166
+ }
101
167
  export interface MetadataGroupLocale {
102
168
  groupFriendlyName: string;
103
169
  description: string;
@@ -155,13 +221,13 @@ export interface TooltipModels {
155
221
  }
156
222
  export interface AssetModelContent extends KDocumentContent {
157
223
  type: "asset";
158
- engineGroups: string[];
224
+ tenantClasses: string[];
159
225
  /**
160
226
  * Optional list of engine IDs (tenant IDs) this model is scoped to.
161
227
  * When set, the model is only available to the specified tenants.
162
- * When absent, the model is available to all tenants in the engineGroups.
228
+ * When absent, the model is available to all tenants in the tenantClasses.
163
229
  */
164
- engineIds?: string[];
230
+ indexes?: string[];
165
231
  asset: {
166
232
  /**
167
233
  * Name of the model
@@ -408,7 +474,7 @@ export interface DeviceModelContent extends KDocumentContent {
408
474
  }
409
475
  export interface GroupModelContent extends KDocumentContent {
410
476
  type: "group";
411
- engineGroups: string[];
477
+ tenantClasses: string[];
412
478
  group: {
413
479
  /**
414
480
  * Name of the model
@@ -118,7 +118,8 @@ export type AssetModelDefinition = {
118
118
  */
119
119
  icon?: string;
120
120
  /**
121
- * Metadata mappings definition
121
+ * Metadata mappings definition.
122
+ * Use `{ referential: true }` for a metadata of the metadata referential.
122
123
  */
123
124
  metadataMappings?: MetadataMappings;
124
125
  /**
@@ -201,7 +202,8 @@ export type DeviceModelDefinition = {
201
202
  */
202
203
  icon?: string;
203
204
  /**
204
- * Metadata mappings definition
205
+ * Metadata mappings definition.
206
+ * Use `{ referential: true }` for a metadata of the metadata referential.
205
207
  */
206
208
  metadataMappings?: MetadataMappings;
207
209
  /**
@@ -296,7 +298,8 @@ export type GroupModelDefinition = {
296
298
  */
297
299
  icon?: string;
298
300
  /**
299
- * Metadata mappings definition
301
+ * Metadata mappings definition.
302
+ * Use `{ referential: true }` for a metadata of the metadata referential.
300
303
  */
301
304
  metadataMappings?: MetadataMappings;
302
305
  /**
@@ -1,9 +1,9 @@
1
- import { AssetModelContent, DeviceModelContent, GroupModelContent, MeasureModelContent } from "./ModelContent";
1
+ import { AssetModelContent, DeviceModelContent, GroupModelContent, MeasureModelContent, MetadataReferential } from "./ModelContent";
2
2
  export type AskModelAssetGet = {
3
3
  name: "ask:device-manager:model:asset:get";
4
4
  payload: {
5
- engineGroups: string[];
6
- engineId?: string;
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
- engineId?: string;
22
+ index?: string;
23
23
  };
24
24
  result: MeasureModelContent;
25
25
  };
@@ -30,3 +30,8 @@ export type AskModelGroupGet = {
30
30
  };
31
31
  result: GroupModelContent;
32
32
  };
33
+ export type AskModelMetadataReferentialGet = {
34
+ name: "ask:device-manager:model:metadata-referential:get";
35
+ payload: void;
36
+ result: MetadataReferential;
37
+ };
@@ -5,6 +5,7 @@ import { DeviceManagerPlugin } from "./DeviceManagerPlugin";
5
5
  import { DeviceManagerConfiguration } from "./types/DeviceManagerConfiguration";
6
6
  import { InternalCollection } from "./types/InternalCollection";
7
7
  import { ConflictChunk } from "../model/ModelsConflicts";
8
+ import { MetadataMappings } from "../model/types/ModelContent";
8
9
  export type TwinType = "asset" | "device";
9
10
  export type TwinModelContent = AssetModelContent | DeviceModelContent;
10
11
  export interface EngineDocument extends KDocumentContent {
@@ -18,7 +19,7 @@ export interface EngineDocument extends KDocumentContent {
18
19
  export type AskEngineList = {
19
20
  name: "ask:device-manager:engine:list";
20
21
  payload: {
21
- group?: string;
22
+ tenantClass?: string;
22
23
  };
23
24
  result: EngineContent[];
24
25
  };
@@ -39,10 +40,42 @@ export type AskEngineUpdateConflict = {
39
40
  };
40
41
  result: ConflictChunk[];
41
42
  };
43
+ /**
44
+ * Checks a metadata of the metadata referential against the actual metadata mappings
45
+ * of the assets, devices and groups collections of every engine
46
+ */
47
+ export type AskEngineMetadataConflict = {
48
+ name: "ask:device-manager:engine:doesMetadataConflict";
49
+ payload: {
50
+ metadataMappings: MetadataMappings;
51
+ };
52
+ result: ConflictChunk[];
53
+ };
42
54
  export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlugin> {
43
55
  config: DeviceManagerConfiguration;
44
56
  get app(): Backend;
45
57
  constructor(plugin: Plugin, platformConfigManager: ConfigManager, engineConfigManager: ConfigManager);
58
+ /**
59
+ * Returns the actual metadata mappings of an engine collection
60
+ *
61
+ * @returns The mappings of the metadata properties, empty if the collection does not exist
62
+ */
63
+ private getCollectionMetadataMappings;
64
+ /**
65
+ * Return conflicts between the metadata mappings of models and the actual mappings
66
+ * of their collection in an engine
67
+ *
68
+ * @param engineIndex The target engine
69
+ * @param modelType The models type
70
+ * @param models The new or updated models, with their referential metadata resolved
71
+ * @returns An array of ConflictChunk
72
+ */
73
+ private getModelsMetadataConflicts;
74
+ /**
75
+ * Merges the mappings of the metadata referential and of models into metadata mappings.
76
+ * Every referential metadata is merged, used by a model or not.
77
+ */
78
+ private mergeMetadataMappings;
46
79
  /**
47
80
  * Return conflicts between the new and already present twin models
48
81
  *
@@ -79,10 +112,10 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
79
112
  */
80
113
  getEngines(): Promise<EngineDocument[]>;
81
114
  updateMeasuresSchema(): Promise<void>;
82
- onCreate(index: string, group?: string): Promise<{
115
+ onCreate(index: string, tenantClass?: string): Promise<{
83
116
  collections: any[];
84
117
  }>;
85
- onUpdate(index: string, group?: string): Promise<{
118
+ onUpdate(index: string, tenantClass?: string): Promise<{
86
119
  collections: any[];
87
120
  }>;
88
121
  onDelete(index: string): Promise<{
@@ -91,44 +124,44 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
91
124
  /**
92
125
  * Generate assets mappings and create the assets collection in the engine
93
126
  *
94
- * @param engineId The target engine Id
95
- * @param engineGroup The engine group
127
+ * @param index The target engine Id
128
+ * @param tenantClass The tenant class
96
129
  *
97
130
  * @throws If it failed during the assets collection creation
98
131
  */
99
- createAssetsCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
132
+ createAssetsCollection(index: string, tenantClass: string): Promise<InternalCollection>;
100
133
  /**
101
134
  * Generate assets mappings and create the assets history collection in the engine
102
135
  *
103
- * @param engineId The target engine Id
104
- * @param engineGroup The engine group
136
+ * @param index The target engine Id
137
+ * @param tenantClass The tenant class
105
138
  *
106
139
  * @throws If it failed during the assets history collection creation
107
140
  */
108
- createAssetsHistoryCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
141
+ createAssetsHistoryCollection(index: string, tenantClass: string): Promise<InternalCollection>;
109
142
  /**
110
143
  * Create the groups collection with the groups mappings in the engine
111
144
  *
112
- * @param engineId The target engine Id
113
- * @param engineGroup The engine group
145
+ * @param index The target engine Id
146
+ * @param tenantClass The tenant class
114
147
  *
115
148
  * @throws If it failed during the groups collection creation
116
149
  */
117
- createGroupsCollection(engineId: string): Promise<InternalCollection>;
150
+ createGroupsCollection(index: string): Promise<InternalCollection>;
118
151
  /**
119
152
  * Generate devices mappings and create the devices collection in the engine
120
153
  *
121
- * @param engineId The target engine Id
122
- * @param engineGroup The engine group
154
+ * @param index The target engine Id
155
+ * @param tenantClass The tenant class
123
156
  *
124
157
  * @throws If it failed during the devices collection creation
125
158
  */
126
- createDevicesCollection(engineId: string): Promise<InternalCollection>;
159
+ createDevicesCollection(index: string): Promise<InternalCollection>;
127
160
  /**
128
161
  * Generate devices mappings and create the devices collection in the engine
129
162
  *
130
- * @param engineId The target engine Id
131
- * @param engineGroup The engine group
163
+ * @param index The target engine Id
164
+ * @param tenantClass The tenant class
132
165
  *
133
166
  * @throws If it failed during the devices collection creation
134
167
  */
@@ -136,12 +169,12 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
136
169
  /**
137
170
  * Generate measures mappings and create the measures collection in the engine
138
171
  *
139
- * @param engineId The target engine Id
140
- * @param engineGroup The engine group
172
+ * @param index The target engine Id
173
+ * @param tenantClass The tenant class
141
174
  *
142
175
  * @throws If it failed during the measures collection creation
143
176
  */
144
- createMeasuresCollection(engineId: string, engineGroup: string): Promise<InternalCollection>;
177
+ createMeasuresCollection(index: string, tenantClass: string): Promise<InternalCollection>;
145
178
  /**
146
179
  * Create a collection with custom mappings in an engine
147
180
  *
@@ -156,7 +189,7 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
156
189
  * Generate ES mappings from twin models and theirs associated measures, all fetched from the database
157
190
  *
158
191
  * @param digitalTwinType The target twin type
159
- * @param engineGroup The twin engine group
192
+ * @param tenantClass The twin tenant class
160
193
  * @returns The complete ES mappings produces by merging all the target type twins
161
194
  */
162
195
  private getDigitalTwinMappingsFromDB;
@@ -172,7 +205,7 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
172
205
  /**
173
206
  * Generate ES mappings from measures and theirs associated assets, all fetched via the database
174
207
  *
175
- * @param engineGroup The target engine group
208
+ * @param tenantClass The target tenant class
176
209
  * @returns The complete ES mappings produced by merging models mappings
177
210
  */
178
211
  private getMeasuresMappingsFromDB;
@@ -188,16 +221,16 @@ export declare class DeviceManagerEngine extends AbstractEngine<DeviceManagerPlu
188
221
  /**
189
222
  * Retrieve a certain type of models associated to an engine
190
223
  *
191
- * @param engineId The target engine Id
224
+ * @param index The target engine Id
192
225
  * @param type The desired model type
193
- * @param engineGroup The target engine group
226
+ * @param tenantClass The target tenant class
194
227
  * @returns An array of the generic type provided
195
228
  */
196
229
  private getModels;
197
230
  /**
198
231
  * Detach all devices of an index in the platform index
199
232
  *
200
- * @param engineId The target engine Id
233
+ * @param index The target engine Id
201
234
  * @returns {any}
202
235
  */
203
236
  private detachDevicesFromPlatformIndex;
@@ -2,7 +2,7 @@ import { Plugin, PluginContext } from "kuzzle";
2
2
  import { JSONObject } from "kuzzle-sdk";
3
3
  import { MeasureDefinition } from "../measure";
4
4
  import { DecoderModule, DecodersRegister } from "../decoder";
5
- import { AssetModelDefinition, DeviceModelDefinition, GroupModelDefinition, ModelsRegister } from "../model";
5
+ import { AssetModelDefinition, DeviceModelDefinition, GroupModelDefinition, MetadataReferentialEntry, ModelsRegister } from "../model";
6
6
  import { DeviceManagerConfiguration } from "./types/DeviceManagerConfiguration";
7
7
  export declare class DeviceManagerPlugin extends Plugin {
8
8
  config: DeviceManagerConfiguration;
@@ -24,7 +24,7 @@ export declare class DeviceManagerPlugin extends Plugin {
24
24
  /**
25
25
  * Register an asset model
26
26
  *
27
- * @param engineGroups Engine group names
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: (engineGroups: string[], model: string, definition: AssetModelDefinition) => void;
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: (engineGroups: string[], model: string, definition: GroupModelDefinition) => void;
235
+ registerGroup: (tenantClasses: string[], model: string, definition: GroupModelDefinition) => void;
236
236
  /**
237
237
  * Register a new measure
238
238
  *
@@ -249,6 +249,41 @@ export declare class DeviceManagerPlugin extends Plugin {
249
249
  * ```
250
250
  */
251
251
  registerMeasure: (name: string, measureDefinition: MeasureDefinition) => void;
252
+ /**
253
+ * Register a metadata in the metadata referential.
254
+ *
255
+ * Its mappings are merged into the assets, devices and groups collections of every engine,
256
+ * and cannot be modified afterwards.
257
+ * Asset, device and group models then use it with `{ referential: true }` in their
258
+ * metadataMappings instead of redefining its mappings.
259
+ * A model defining inline a metadata that conflicts with the referential is rejected.
260
+ *
261
+ * @param name Name of the metadata
262
+ * @param definition Mappings, default translations, editor hint, default value and icon
263
+ *
264
+ * @example
265
+ * ```
266
+ * deviceManager.models.registerMetadata("color", {
267
+ * mappings: { type: "keyword" },
268
+ * locales: {
269
+ * en: { friendlyName: "Color", description: "Color of the asset" },
270
+ * fr: { friendlyName: "Couleur", description: "Couleur de l'asset" },
271
+ * },
272
+ * editorHint: {
273
+ * type: EditorHintEnum.OPTION_SELECTOR,
274
+ * values: ["red", "blue"],
275
+ * },
276
+ * defaultValue: "red",
277
+ * icon: "palette",
278
+ * });
279
+ *
280
+ * deviceManager.models.registerAsset("commons", "Container", {
281
+ * measures: [],
282
+ * metadataMappings: { color: { referential: true } },
283
+ * });
284
+ * ```
285
+ */
286
+ registerMetadata: (name: string, definition: MetadataReferentialEntry) => void;
252
287
  };
253
288
  constructor();
254
289
  /**
@@ -270,5 +305,12 @@ export declare class DeviceManagerPlugin extends Plugin {
270
305
  * Initialize the config document if it does not exists
271
306
  */
272
307
  private initializeConfig;
308
+ /**
309
+ * Moves the tenant scope of the models written before the rename from the
310
+ * former `engineIds` field to `indexes`. Idempotent: once a document carries
311
+ * `indexes` and no `engineIds`, it is left alone. Models are few, so the
312
+ * whole set fits in one search.
313
+ */
314
+ private migrateModelIndexes;
273
315
  private pipeCheckEngine;
274
316
  }
@@ -15,6 +15,17 @@ export type DeviceManagerConfiguration = {
15
15
  */
16
16
  autoUpdate: true;
17
17
  };
18
+ models: {
19
+ metadata: {
20
+ /**
21
+ * Only accept new metadata referenced from the metadata referential in the models written through the API.
22
+ *
23
+ * New inline metadataMappings keys are rejected, the inline metadata already defined
24
+ * by a model are kept (legacy). Models registered from code are not affected.
25
+ */
26
+ referentialOnly: boolean;
27
+ };
28
+ };
18
29
  /**
19
30
  * Platform index name
20
31
  */
@@ -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[], engineId: string) => Promise<void>;
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(engineId: string): Promise<EngineContent>;
36
- protected abstract exportRedisKey(engineId: string, exportId: string): string;
37
- protected abstract getLink(engineId: string, exportId: UUID, params: P): string;
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(engineId: string, exportId: string): Promise<Readable>;
45
- prepareExport(engineId: string, user: User, params: P): Promise<string>;
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(engineId: string, exportId: string): Promise<P>;
48
- getExportStream(request: SearchResult<KHit<KDocumentContentGeneric>>, columns: Column[], engineId: string): Promise<PassThrough>;
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
- engineId: string;
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, engineId }: PayloadRequest): KuzzleRequest;
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, engineId }: PayloadRequest, options?: ArgsDocumentControllerCreate): Promise<KDocument<T>>;
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, engineId }: PayloadRequest, options?: ArgsDocumentControllerCreate): Promise<KDocument<T>>;
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, engineId }: PayloadRequest, options?: ArgsDocumentControllerUpdate): Promise<KDocument<T>>;
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, engineId }: PayloadRequest, options?: ArgsDocumentControllerDelete): Promise<{
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, engineId }: PayloadRequest): Promise<SearchResult<KHit<T>>>;
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(engineId: string, exportId: string): string;
11
- protected getLink(engineId: string, exportId: UUID): string;
12
- sendExport(engineId: string, exportId: string): Promise<import("stream").PassThrough>;
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(engineId: string, digitalTwinId: string, measureCount?: number): Promise<MeasureContent[]>;
22
+ getLastMeasures(index: string, digitalTwinId: string, measureCount?: number): Promise<MeasureContent[]>;
23
23
  /**
24
24
  * Link a device to an asset.
25
25
  */
26
- linkAssetDevice(engineId: string, deviceId: string, assetId: string, measureSlots: {
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(engineId: string, digitalTwinIds: string[], measureCount?: number): Promise<Record<string, MeasureContent[]>>;
48
- getLastMeasuredAt(engineId: string, digitalTwinId: string): Promise<number>;
49
- mGetLastMeasuredAt(engineId: string, digitalTwinIds: string[]): Promise<ApiDigitalTwinMGetLastMeasuredAtResult>;
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} engineGroup:string
81
+ * @param {any} tenantClass:string
82
82
  * @param {any} model:string
83
83
  * @returns {any}
84
84
  */
85
- protected getAssetModel(engineGroup: string, model: string, engineId?: string): Promise<AssetModelContent>;
85
+ protected getAssetModel(tenantClass: string, model: string, index?: string): Promise<AssetModelContent>;
86
86
  protected getDeviceModel(model: string): Promise<DeviceModelContent>;
87
- getEngine(engineId: string): Promise<JSONObject>;
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
- engineId: string;
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
- engineId: string;
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
- engineId: string;
14
+ index: string;
15
15
  assetId: string;
16
16
  deviceId: string;
17
17
  user: User;