kuzzle-device-manager-types 2.0.5 → 2.0.6

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.
@@ -57,8 +57,9 @@ export declare class DeviceService {
57
57
  /**
58
58
  * Link a device to an asset.
59
59
  */
60
- linkAsset(user: User, engineId: string, deviceId: string, assetId: string, measureNames: ApiDeviceLinkAssetRequest["body"]["measureNames"], { refresh }?: {
60
+ linkAsset(user: User, engineId: string, deviceId: string, assetId: string, measureNames: ApiDeviceLinkAssetRequest["body"]["measureNames"], { refresh, implicitMeasuresLinking, }?: {
61
61
  refresh?: any;
62
+ implicitMeasuresLinking?: boolean;
62
63
  }): Promise<{
63
64
  asset: KDocument<AssetContent>;
64
65
  device: KDocument<DeviceContent>;
@@ -67,7 +68,14 @@ export declare class DeviceService {
67
68
  * Checks if the asset does not already have a linked device using one of the
68
69
  * requested measure names.
69
70
  */
70
- private checkAssetMeasureNamesAvailability;
71
+ private checkAlreadyProvidedMeasures;
72
+ /**
73
+ * Goes through the device available measures and add them into the link if:
74
+ * - they are not already provided by another device
75
+ * - they are not already present in the link request
76
+ * - they are declared in the asset model
77
+ */
78
+ private generateMissingAssetMeasureNames;
71
79
  /**
72
80
  * Unlink a device of an asset
73
81
  *
@@ -91,4 +99,5 @@ export declare class DeviceService {
91
99
  }): Promise<ApiDeviceGetMeasuresResult>;
92
100
  private checkEngineExists;
93
101
  private checkAttachedToEngine;
102
+ private getEngine;
94
103
  }
@@ -73,9 +73,26 @@ export interface ApiDeviceLinkAssetRequest extends DevicesControllerRequest {
73
73
  _id: string;
74
74
  refresh?: string;
75
75
  assetId: string;
76
+ /**
77
+ * This option allows to not specify the names of all the measures that should
78
+ * be linked to the asset.
79
+ *
80
+ * The algorithm will go through all the measures names provided by the device
81
+ * and add the one who are present with the same name in the asset.
82
+ *
83
+ * It will not add the measure if:
84
+ * - it has been specified in the link request
85
+ * - it was already present in the asset
86
+ *
87
+ * @example
88
+ * if the device provide a measure of type "temperature" with the name "temp"
89
+ * if the asset has declared a measure of type "temperature" with the name "temp"
90
+ * then the measure will be automatically added in the link and will later be propagated to the asset
91
+ */
92
+ implicitMeasuresLinking?: boolean;
76
93
  body?: {
77
94
  /**
78
- * Names of the linked measures
95
+ * Names of the linked measures.
79
96
  *
80
97
  * Array<{ asset: string, device: string }>
81
98
  *
@@ -85,7 +102,7 @@ export interface ApiDeviceLinkAssetRequest extends DevicesControllerRequest {
85
102
  * { asset: "externalTemperature", device: "temperature" }
86
103
  * ]
87
104
  */
88
- measureNames: Array<{
105
+ measureNames?: Array<{
89
106
  asset: string;
90
107
  device: string;
91
108
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kuzzle-device-manager-types",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Shared types for Kuzzle Device Manager",
5
5
  "author": "The Kuzzle Team (support@kuzzle.io)",
6
6
  "types": "dist/index.d.ts",