kuzzle-device-manager 2.0.0-rc16 → 2.0.0-rc20

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.
@@ -170,7 +170,13 @@ class AssetController extends RelationalController_1.RelationalController {
170
170
  const body = request.getBody();
171
171
  const asset = await this.sdk.document.get(engineId, this.collection, id);
172
172
  let assetMetadata = request.input.body.metadata;
173
- request.input.body.metadata = await this.assetCategoryService.formatMetadataForES(assetMetadata);
173
+ if (assetMetadata) {
174
+ const previousMetadata = asset._source.metadata
175
+ ? asset._source.metadata.filter(m => !Object.keys(assetMetadata).includes(m.key))
176
+ : [];
177
+ const updatedMetadata = this.assetCategoryService.formatMetadataForES(assetMetadata);
178
+ request.input.body.metadata = [...updatedMetadata, ...previousMetadata];
179
+ }
174
180
  const response = await global.app.trigger('device-manager:asset:update:before', {
175
181
  asset,
176
182
  updates: body
@@ -123,7 +123,7 @@ class RelationalController extends kuzzle_plugin_commons_1.CRUDController {
123
123
  request.input.args.index = request.getString('engineId');
124
124
  const promises = [];
125
125
  promises.push(this.deleteNested(request, nestedFields));
126
- if (manyToManyLinkedFields !== [] || oneToManyLinkedFields !== []) {
126
+ if (manyToManyLinkedFields.length > 0 || oneToManyLinkedFields.length > 0) {
127
127
  const document = await this.sdk.document.get(request.getString('engineId'), this.collection, request.getId());
128
128
  for (const childrenField of manyToManyLinkedFields) {
129
129
  promises.push(this.propagateDelete(document._source[childrenField], childrenField, true, request));
@@ -186,7 +186,7 @@ class MeasureService {
186
186
  deviceMeasureName: null,
187
187
  measuredAt: measurement.measuredAt ? measurement.measuredAt : Date.now(),
188
188
  origin: {
189
- assetId: null,
189
+ assetId,
190
190
  id: kuid,
191
191
  type: types_1.OriginType.USER,
192
192
  },
@@ -46,7 +46,6 @@ export declare const measuresMappings: {
46
46
  * Define the origin of the measure.
47
47
  */
48
48
  origin: {
49
- type: string;
50
49
  properties: {
51
50
  /**
52
51
  * From what the measure has been pushed. Can be:
@@ -42,7 +42,6 @@ exports.measuresMappings = {
42
42
  * Define the origin of the measure.
43
43
  */
44
44
  origin: {
45
- type: 'nested',
46
45
  properties: {
47
46
  /**
48
47
  * From what the measure has been pushed. Can be:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kuzzle-device-manager",
3
- "version": "2.0.0-rc16",
3
+ "version": "2.0.0-rc20",
4
4
  "description": "Manage your IoT devices and assets. Choose a provisioning strategy, receive and decode payload, handle your IoT business logic.",
5
5
  "author": "The Kuzzle Team (support@kuzzle.io)",
6
6
  "repository": {
@@ -31,18 +31,18 @@
31
31
  "lodash": "^4.17.21"
32
32
  },
33
33
  "devDependencies": {
34
- "@types/node": "^17.0.21",
35
- "@typescript-eslint/eslint-plugin": "^5.14.0",
36
- "@typescript-eslint/parser": "^5.14.0",
34
+ "@types/node": "^18.7.14",
35
+ "@typescript-eslint/eslint-plugin": "^5.36.1",
36
+ "@typescript-eslint/parser": "^5.36.1",
37
37
  "axios": "^0.27.2",
38
38
  "cucumber": "^6.0.5",
39
39
  "ergol": "^1.0.2",
40
- "eslint": "^8.10.0",
41
- "kuzzle": "^2.18.1",
42
- "kuzzle-sdk": "^7.9.1",
40
+ "eslint": "^8.23.0",
41
+ "kuzzle": "^2.19.3",
42
+ "kuzzle-sdk": "^7.10.0",
43
43
  "should": "^13.2.3",
44
- "ts-node": "^10.7.0",
45
- "typescript": "^4.6.2"
44
+ "ts-node": "^10.9.1",
45
+ "typescript": "^4.8.2"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "kuzzle": "^2.17.3"