kuzzle-device-manager 2.0.0-rc4 → 2.0.0-rc8

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.
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AssetCategoryService = void 0;
7
- const lodash_isequal_1 = __importDefault(require("lodash.isequal"));
7
+ const lodash_1 = __importDefault(require("lodash"));
8
8
  class AssetCategoryService {
9
9
  constructor(plugin) {
10
10
  this.config = plugin.config;
@@ -93,7 +93,7 @@ class AssetCategoryService {
93
93
  let find = false;
94
94
  for (const objectValue of metadata.objectValueList) {
95
95
  const fromattedObjectValue = this.formatMetadataForGet(objectValue.object);
96
- if ((0, lodash_isequal_1.default)(fromattedObjectValue, value)) {
96
+ if (lodash_1.default.isEqual(fromattedObjectValue, value)) {
97
97
  find = true;
98
98
  break;
99
99
  }
@@ -1,5 +1,5 @@
1
1
  import { ControllerDefinition, PluginContext } from 'kuzzle';
2
- import { DecoderContent } from 'lib/types';
2
+ import { DecoderContent } from '../../types';
3
3
  import { Decoder } from '../Decoder';
4
4
  import { PayloadService } from '../PayloadService';
5
5
  export declare class DecodersRegister {
@@ -19,7 +19,7 @@ export declare class MeasuresRegister {
19
19
  * sign: '%',
20
20
  * type: 'number',
21
21
  * },
22
- * mappings: { humidity: { type: 'float' } },
22
+ * valuesMappings: { humidity: { type: 'float' } },
23
23
  * });
24
24
  * ```
25
25
  */
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.MeasuresRegister = void 0;
4
7
  const kuzzle_1 = require("kuzzle");
8
+ const lodash_1 = __importDefault(require("lodash"));
5
9
  const mappings_1 = require("../../mappings");
6
10
  class MeasuresRegister {
7
11
  constructor() {
@@ -23,7 +27,7 @@ class MeasuresRegister {
23
27
  * sign: '%',
24
28
  * type: 'number',
25
29
  * },
26
- * mappings: { humidity: { type: 'float' } },
30
+ * valuesMappings: { humidity: { type: 'float' } },
27
31
  * });
28
32
  * ```
29
33
  */
@@ -32,8 +36,8 @@ class MeasuresRegister {
32
36
  throw new kuzzle_1.PluginImplementationError(`Measure "${type}" already exists.`);
33
37
  }
34
38
  for (const [field, definition] of Object.entries(measure.valuesMappings)) {
35
- if (this.mappings.properties.values.properties[field]) {
36
- throw new kuzzle_1.PluginImplementationError(`Field "${type}" already exists in measures mappings.`);
39
+ if (this.mappings.properties.values.properties[field] && !lodash_1.default.isEqual(this.mappings.properties.values.properties[field], definition)) {
40
+ throw new kuzzle_1.PluginImplementationError(`Measure "${type}" register a different type for value "${field}".`);
37
41
  }
38
42
  this.mappings.properties.values.properties[field] = definition;
39
43
  }
@@ -1,4 +1,4 @@
1
- import { LinkRequest } from 'lib/types/Request';
1
+ import { LinkRequest } from '../types/Request';
2
2
  import { DeviceContent, MeasureContent } from '../types';
3
3
  export declare class Device {
4
4
  static id(model: string, reference: string): string;
@@ -1,6 +1,5 @@
1
- import { KDocumentContent } from 'kuzzle-sdk';
1
+ import { JSONObject, KDocumentContent } from 'kuzzle';
2
2
  import { MetadataContent } from './MetadataContent';
3
- import { JSONObject } from 'kuzzle';
4
3
  export interface FormattedValue {
5
4
  boolean?: boolean;
6
5
  integer?: number;
@@ -1,5 +1,4 @@
1
- import { KDocumentContent } from 'kuzzle-sdk';
2
- import { JSONObject } from 'kuzzle';
1
+ import { JSONObject, KDocumentContent } from 'kuzzle';
3
2
  import { FormattedMetadata } from './AssetCategoryContent';
4
3
  export declare enum metadataType {
5
4
  string = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kuzzle-device-manager",
3
- "version": "2.0.0-rc4",
3
+ "version": "2.0.0-rc8",
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": {
@@ -27,8 +27,8 @@
27
27
  "csvtojson": "~2.0.10",
28
28
  "json-stable-stringify": "^1.0.1",
29
29
  "kuzzle-plugin-commons": "https://github.com/kuzzleio/kuzzle-plugin-commons/archive/refs/tags/1.0.4.tar.gz",
30
- "lodash.isequal": "^4.5.0",
31
- "uuid": "~8.3.2"
30
+ "uuid": "~8.3.2",
31
+ "lodash": "^4.17.21"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^17.0.21",
@@ -40,7 +40,6 @@
40
40
  "eslint": "^8.10.0",
41
41
  "kuzzle": "^2.18.1",
42
42
  "kuzzle-sdk": "^7.9.1",
43
- "lodash": "^4.17.21",
44
43
  "should": "^13.2.3",
45
44
  "ts-node": "^10.7.0",
46
45
  "typescript": "^4.6.2"