diff --git a/.github/workflows/pull_request.workflow.yml b/.github/workflows/pull_request.workflow.yml index 72cf74f5..83d78713 100644 --- a/.github/workflows/pull_request.workflow.yml +++ b/.github/workflows/pull_request.workflow.yml @@ -8,17 +8,6 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - uses: actions/setup-node@v1.4.4 with: node-version: "12" @@ -30,39 +19,28 @@ jobs: needs: [lint] steps: - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - uses: actions/setup-node@v1.4.4 with: node-version: "12" - uses: ./.github/actions/functional-test - documentation-dead-links: - name: Dead links - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - uses: actions/setup-node@v1.4.4 - with: - node-version: "12" - - uses: ./.github/actions/dead-links + # documentation-dead-links: + # name: Dead links + # runs-on: ubuntu-18.04 + # steps: + # - uses: actions/checkout@v2 + # - name: Cache node modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-node-modules + # with: + # path: ~/.npm + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # ${{ runner.os }}-build- + # ${{ runner.os }}- + # - uses: actions/setup-node@v1.4.4 + # with: + # node-version: "12" + # - uses: ./.github/actions/dead-links diff --git a/.github/workflows/push_master.workflow.yml b/.github/workflows/push_master.workflow.yml index 684dc76c..17fc80d8 100644 --- a/.github/workflows/push_master.workflow.yml +++ b/.github/workflows/push_master.workflow.yml @@ -11,17 +11,6 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - uses: actions/setup-node@v1.4.4 with: node-version: "12" @@ -33,42 +22,31 @@ jobs: needs: [lint] steps: - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - uses: actions/setup-node@v1.4.4 with: node-version: "12" - uses: ./.github/actions/functional-test - documentation-dead-links: - name: Dead links - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - name: Cache node modules - uses: actions/cache@v2 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - uses: actions/setup-node@v1.4.4 - with: - node-version: "12" - - uses: ./.github/actions/dead-links + # documentation-dead-links: + # name: Dead links + # runs-on: ubuntu-18.04 + # steps: + # - uses: actions/checkout@v2 + # - name: Cache node modules + # uses: actions/cache@v2 + # env: + # cache-name: cache-node-modules + # with: + # path: ~/.npm + # key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + # restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + # ${{ runner.os }}-build- + # ${{ runner.os }}- + # - uses: actions/setup-node@v1.4.4 + # with: + # node-version: "12" + # - uses: ./.github/actions/dead-links documentation-production: name: Deployment Doc Prod diff --git a/doc/1/classes/assets-custom-properties/constructor/index.md b/doc/1/classes/assets-custom-properties/constructor/index.md new file mode 100644 index 00000000..5c2c0901 --- /dev/null +++ b/doc/1/classes/assets-custom-properties/constructor/index.md @@ -0,0 +1,18 @@ +--- +code: false +type: page +title: Constructor +description: AssetsCustomProperties class constructor +--- + +# AssetsCustomProperties + +This class is used within the plugin in order to register custom properties definitions to the `assets` collection. +They are automatically loaded at application startup. +--- + +## Constructor + +```ts +AssetsCustomProperties() +``` diff --git a/doc/1/classes/assets-custom-properties/index.md b/doc/1/classes/assets-custom-properties/index.md new file mode 100644 index 00000000..f6794fdc --- /dev/null +++ b/doc/1/classes/assets-custom-properties/index.md @@ -0,0 +1,6 @@ +--- +code: true +type: branch +title: AssetsCustomProperties +description: Kuzzle IoT Platform - AssetsCustomProperties class +--- \ No newline at end of file diff --git a/doc/1/classes/assets-custom-properties/register-metadata/index.md b/doc/1/classes/assets-custom-properties/register-metadata/index.md new file mode 100644 index 00000000..f7d55d3b --- /dev/null +++ b/doc/1/classes/assets-custom-properties/register-metadata/index.md @@ -0,0 +1,44 @@ +--- +code: true +type: page +title: registerMetadata +description: Add properties definition to the 'metadata' field +--- + +# registerMetadata + +Add properties definition to the `metadata` field of the `assets` collection. + + +```ts +registerMetadata (mapping: JSONObject, options: JSONObject); +``` + +
+ +| Arguments | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `mapping` |
JSONObject
| Mapping definiton of the `metadata` property | +| `options` |
JSONObject
| Additional options | + +### options + +| Properties | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `tenantGroup` |
string
| Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. | + +## Usage + +```ts +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManagerPlugin = new DeviceManagerPlugin(); + +deviceManagerPlugin.assets.registerMetadata({ + serial: { + type: 'keyword', + fields: { + text: { type: 'text' } } + } +}, { tenantGroup: 'water_management' }); +``` \ No newline at end of file diff --git a/doc/1/classes/devices-custom-properties/constructor/index.md b/doc/1/classes/devices-custom-properties/constructor/index.md new file mode 100644 index 00000000..b832cfb9 --- /dev/null +++ b/doc/1/classes/devices-custom-properties/constructor/index.md @@ -0,0 +1,18 @@ +--- +code: false +type: page +title: Constructor +description: DevicesCustomProperties class constructor +--- + +# DevicesCustomProperties + +This class is used within the plugin in order to register custom properties definitions to the `devices` collection. +They are automatically loaded at application startup. +--- + +## Constructor + +```ts +DeviceCustomProperties() +``` diff --git a/doc/1/classes/devices-custom-properties/index.md b/doc/1/classes/devices-custom-properties/index.md new file mode 100644 index 00000000..1864bf9a --- /dev/null +++ b/doc/1/classes/devices-custom-properties/index.md @@ -0,0 +1,6 @@ +--- +code: true +type: branch +title: DevicesCustomProperties +description: Kuzzle IoT Platform - DevicesCustomProperties class +--- \ No newline at end of file diff --git a/doc/1/classes/devices-custom-properties/register-measure/index.md b/doc/1/classes/devices-custom-properties/register-measure/index.md new file mode 100644 index 00000000..7ad5340c --- /dev/null +++ b/doc/1/classes/devices-custom-properties/register-measure/index.md @@ -0,0 +1,62 @@ +--- +code: true +type: page +title: registerMeasure +description: Add properties definition to the 'measures' field +--- + +# registerMeasure + +Add properties definition to the `measures` field of the `devices` collection. + + +```ts +registerMeasure (measureName: string, mapping: JSONObject, options: JSONObject); +``` + +
+ +| Arguments | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `measureName` |
string
| Name of the measure you are willing to add to the `measures` field | +| `mapping` |
JSONObject
| Mapping definiton of the custom measure property | +| `options` |
JSONObject
| Additional options | + +### options + +| Properties | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `tenantGroup` |
string
| Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition | + +## Usage + +```ts +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManagerPlugin = new DeviceManagerPlugin(); + +deviceManagerPlugin.devices.registerMeasure( + 'temperature', + { + dynamic: 'false', + properties: { + fahrenheit: { type: 'float' }, + celsius: { type: 'float' } + } + }, + { tenantGroup: 'water_management' }); + +deviceManagerPlugin.devices.registerMeasure( + 'humidity', + { + dynamic: 'false', + properties: { + percentage: { + type: 'keyword', + fields: { + text: { type: 'text' } } + } + } + }, + { tenantGroup: 'air_quality' }); +``` \ No newline at end of file diff --git a/doc/1/classes/devices-custom-properties/register-metadata/index.md b/doc/1/classes/devices-custom-properties/register-metadata/index.md new file mode 100644 index 00000000..c36d1b63 --- /dev/null +++ b/doc/1/classes/devices-custom-properties/register-metadata/index.md @@ -0,0 +1,44 @@ +--- +code: true +type: page +title: registerMetadata +description: Add properties definition to the 'metadata' field +--- + +# registerMetadata + +Add properties definition to the `metadata` field of the `devices` collection. + + +```ts +registerMetadata (mapping: JSONObject, options: JSONObject); +``` + +
+ +| Arguments | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `mapping` |
JSONObject
| Mapping definiton of the `metadata` property | +| `options` |
JSONObject
| Additional options | + +### options + +| Properties | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `tenantGroup` |
string
| Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. | + +## Usage + +```ts +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManagerPlugin = new DeviceManagerPlugin(); + +deviceManagerPlugin.devices.registerMetadata({ + serial: { + type: 'keyword', + fields: { + text: { type: 'text' } } + } +}, { tenantGroup: 'water_management' }); +``` \ No newline at end of file diff --git a/doc/1/classes/devices-custom-properties/register-qos/index.md b/doc/1/classes/devices-custom-properties/register-qos/index.md new file mode 100644 index 00000000..b0a44f96 --- /dev/null +++ b/doc/1/classes/devices-custom-properties/register-qos/index.md @@ -0,0 +1,40 @@ +--- +code: true +type: page +title: registerQos +description: Add properties definition to the 'qos' field +--- + +# registerQos + +Add properties definition to the `qos` field of the `devices` collection. + + +```ts +registerQos (mapping: JSONObject, options: JSONObject); +``` + +
+ +| Arguments | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `mapping` |
JSONObject
| Mapping definiton of the `qos` property | +| `options` |
JSONObject
| Additional options | + +### options + +| Properties | Type | Description | +|-----------|-----------------------|---------------------------------------------| +| `tenantGroup` |
string
| Name of the group for which the mapping should apply. If unspecified, mappings will apply to every group who does not have specific definition. | + +## Usage + +```ts +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManagerPlugin = new DeviceManagerPlugin(); + +deviceManagerPlugin.devices.registerQos({ + battery: { type: 'integer' } +}, { tenantGroup: 'water_management' }); +``` \ No newline at end of file diff --git a/doc/1/controllers/device/m-attach/index.md b/doc/1/controllers/device/m-attach/index.md index 74e13c79..d51ab784 100644 --- a/doc/1/controllers/device/m-attach/index.md +++ b/doc/1/controllers/device/m-attach/index.md @@ -18,7 +18,7 @@ The device document will be duplicated inside the tenant "devices" collection. ### HTTP ``` http -URL: http://kuzzle:7512/_/device-manager/devices/_mAttach[?refresh=wait_for][&strict=true|false] +URL: http://kuzzle:7512/_/device-manager/devices/_mAttach[?refresh=wait_for][&strict] Method: PUT Body: ``` diff --git a/doc/1/controllers/device/m-detach/index.md b/doc/1/controllers/device/m-detach/index.md index d3f633e3..7b2d9233 100644 --- a/doc/1/controllers/device/m-detach/index.md +++ b/doc/1/controllers/device/m-detach/index.md @@ -24,9 +24,9 @@ Body: ``` js { // Using JSON - "sensorIds" ["test-id"], + "deviceIds" ["test-id"], // Using CSV syntax - "csv": "sensorId\ntest-id" + "csv": "deviceId\ntest-id" } ``` @@ -34,13 +34,13 @@ Body: ``` js { - "controller": "device-manager/sensor", + "controller": "device-manager/device", "action": "mAttachTenant", "body": { // Using JSON - "sensorIds" ["test-id"], + "deviceIds" ["test-id"], // Using CSV syntax - "csv": "sensorId\ntest-id" + "csv": "deviceId\ntest-id" } } ``` @@ -51,8 +51,8 @@ Body: Body properties, must contain at least one of -* `sensorIds`: an array of string containing identifiers of a sensor already attached -* `csv`: a csv syntax compatible containing at least one header `sensorId` with his corresponding values +* `deviceIds`: an array of string containing identifiers of a device already attached +* `csv`: a csv syntax compatible containing at least one header `deviceId` with his corresponding values --- @@ -70,7 +70,7 @@ Body properties, must contain at least one of "status": 200, "error": null, "index": "", - "controller": "device-manager/sensor", + "controller": "device-manager/device", "action": "mDetach", "requestId": "", "result": { diff --git a/doc/1/controllers/device/m-unlink/index.md b/doc/1/controllers/device/m-unlink/index.md new file mode 100644 index 00000000..3f68e75f --- /dev/null +++ b/doc/1/controllers/device/m-unlink/index.md @@ -0,0 +1,84 @@ +--- +code: true +type: page +title: mUnlink +description: Unlink multiple devices from multiple assets +--- + +# mUnlink + +Unlink multiple devices from multiple assets + +--- + +## Query Syntax + +### HTTP + +``` http +URL: http://kuzzle:7512/_/device-manager/devices/_mUnlink[?refresh=wait_for][&strict] +Method: PUT +Body: +``` + +``` js +{ + // Using JSON + "records" [{ + "deviceId": "test-id" + }], + // Using CSV syntax + "csv": " deviceId\ntest-id" +} +``` + +### Other protocols + +``` js +{ + "controller": "device-manager/device", + "action": "mUnlink", + "body": { + // Using JSON + "records" [{ + "deviceId": "test-id" + }], + // Using CSV syntax + "csv": "deviceId\ntest-id", + } +} +``` + +--- + +## Body properties + +Body properties, must contain at least one of the following: + +- `records`: an array of objects, each containing a `deviceId` properties +- `csv`: a csv syntax compatible containing at least this header `deviceId` with his corresponding values + +--- + +### Optional: + +* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed +* `strict`: (boolean) if set, makes the process fail preemptively if at least one Unlink cannot be applied (e.g. devices that aren't attached to a tenant, or because of non-existing assets) + +--- + +## Response + +``` js +{ + "status": 200, + "error": null, + "controller": "device-manager/device", + "action": "mUnlink", + "requestId": "", + "result": { + "errors": [], + "successes": [] + } +} +``` diff --git a/doc/1/controllers/device/prune-payloads/index.md b/doc/1/controllers/device/prune-payloads/index.md new file mode 100644 index 00000000..4ba917f3 --- /dev/null +++ b/doc/1/controllers/device/prune-payloads/index.md @@ -0,0 +1,55 @@ +--- +code: true +type: page +title: prunePayloads +description: Cleans the payload collection +--- + +# prunePayloads + +Delete payloads according to their age and/or validity and/or to which device model they are affiliated with. + +--- + +## Query Syntax + +### HTTP + +```http +URL: http://kuzzle:7512/_/device-manager/devices/_prunePayloads +Method: DELETE +``` + +### Other protocols + +```js +{ + "controller": "device-manager/device", + "action": "prunePayloads", + "body": { + // + } +} +``` + +### Kourou + +```bash +kourou device-manager/device:prunePayloads '{ + days: , + keepInvalid: true|false, + deviceModel: "" +}' +``` + +--- + +## Arguments + +- `days`: The maximum age of a payload, in days (`default: 7`). +- `keepInvalid`: If set to `true`, invalid payloads will not be deleted. +- `deviceModel`: deviceModel name. + +## Response + +Returns the number of deleted payloads. diff --git a/doc/1/controllers/engine/create/index.md b/doc/1/controllers/engine/create/index.md index 9753e268..b277f00e 100644 --- a/doc/1/controllers/engine/create/index.md +++ b/doc/1/controllers/engine/create/index.md @@ -17,7 +17,7 @@ Creates a new device manager engine on an index ### HTTP ```http -URL: http://kuzzle:7512/_/device-manager/engine/:index +URL: http://kuzzle:7512/_/device-manager/engine/:index/[?group] Method: POST ``` @@ -28,13 +28,14 @@ Method: POST "controller": "device-manager/engine", "action": "create", "index": "tenant-ayse" + "group": "tenant-group" // Optional. Specify the tenant group to apply custom mappings. } ``` ### Kourou ```bash -kourou device-manager/engine:create +kourou device-manager/engine:create [group] ``` --- diff --git a/doc/1/guides/decoders/index.md b/doc/1/guides/decoders/index.md index a1b66e22..eb0173f1 100644 --- a/doc/1/guides/decoders/index.md +++ b/doc/1/guides/decoders/index.md @@ -8,15 +8,15 @@ order: 200 # Decoders -Each device model can receive a different payload, it is then necessary to decode this payload in order to retrieve the necessary information and put it in the right place in the document of the associated device. +Since payload formats can differ among device models, it is necessary to decode each payload in order to retrieve the necessary information and store it correctly in the document of the associated device. ![devices payloads collect and decode schema](./devices-payload-collect-and-decode.png) -To do this, it is necessary to implement a decoder by implementing the `Decoder` class. +To do this, you can create a decoder by implementing the `Decoder` class. -This class must at least implement the `decode` method in order to retrieve at the right place the payload data. +This class must at least implement the `decode` method, which contains the logic allowing to process the payload data and format it in a way that suits your business needs. -A decoder is linked to a device model. Its registration triggers the creation of a specific API action to receive payloads from this device model. Each payload will be decoded by the decoder provided. +Each decoder is linked to its corresponding device model. Its registration triggers the creation of a specific API action to receive payloads from this device model. Each payload will be decoded by the decoder provided for its model. **Example:** _Decoder for the device model "Karakoy"_ diff --git a/doc/1/guides/devices/index.md b/doc/1/guides/devices/index.md index 63752db9..651cae60 100644 --- a/doc/1/guides/devices/index.md +++ b/doc/1/guides/devices/index.md @@ -44,7 +44,7 @@ A device is uniquely identified by the pair `model` + `reference`. ## Measures -A device can receive several measurements in the same payload. +A device can send several measurements in the same payload. Each measurement must be stored in the key corresponding to its type: `measures.`. @@ -118,20 +118,20 @@ The format used can be either __CSV__ in the form of a string in the format `ten When attached, all devices documents are copied inside the `devices` collections of all different tenant index. -## Detach a sensor from a tenant +## Detach a device from a tenant -Sensors can be detached to tenant by using the [device-manager/sensor:detach](/official-plugins/device-manager/1/controllers/sensor/detach) API action. +Sensors can be detached to tenant by using the [device-manager/device:detach](/kuzzle-iot-platform/device-manager/1/controllers/device/detach) API action. -When detached, the sensor document is deleted from the `sensors` collection of the tenant index. +When detached, the device document is deleted from the `devices` collection of the tenant index. the `tenantId` property is set to `null` in the `device-manager` index. -## Detach multiple sensors from multiple tenants +## Detach multiple devices from multiple tenants -Multiple different Sensors can also be detached to multiple defferents tenant by using the [device-manager/sensor:mDetach](/official-plugins/device-manager/1/controllers/sensor/mDetach) API action. +Multiple different Sensors can also be detached to multiple defferents tenant by using the [device-manager/device:mDetach](/kuzzle-iot-platform/device-manager/1/controllers/device/mDetach) API action. -The format used can be either __CSV__ in the form of a string in the format "tenantId,sensorId,mysensorId" or __JSON__ in the form of an array of objects. +The format used can be either __CSV__ in the form of a string in the format "tenantId, deviceId, myDeviceId" or __JSON__ in the form of an array of objects. -When detached, all sensors documents are deleted from the `sensors` collections of all different tenant index. +When detached, all devices documents are deleted from the `devices` collections of all different tenant index. The `tenantId` property is set to `null` for all of them in the `device-manager` index @@ -151,6 +151,19 @@ Once linked, each device's measures are copied inside their corresponding asset New measures received by the device will be propagated inside each assets documents. + +## unlink from an asset + +Devices can be unlinked from an asset by using the [device-manager/device:unlink](/kuzzle-iot-platform/device-manager/1/controllers/device/unlink) API action. + +When unlinked, the device measures are erased inside the asset document. + +## unlink Multiple Devices to Multiple Assets + +Multiple Devices can be unlinked at the same time from multiple assets by using the [device-manager/device:mUnlink](/kuzzle-iot-platform/device-manager/1/controllers/device/m-unlink) API action. + +Once unlinked, each device's measures are erased inside their corresponding asset document. + ## Metadata It is possible to attach metadata to the devices within the `metadata` property. diff --git a/doc/1/guides/mappings/index.md b/doc/1/guides/mappings/index.md new file mode 100644 index 00000000..7ae45c93 --- /dev/null +++ b/doc/1/guides/mappings/index.md @@ -0,0 +1,228 @@ +--- +code: false +type: page +title: Customize Mappings +description: How to customize 'assets' and 'devices' collection mappings +order: 500 +--- + +# Mappings + +## "assets" collection + +At startup of your application, the plugin will store default mappings for the `assets` collection which is meant to be loaded when you [create an engine](/kuzzle-iot-platform/device-manager/1/controllers/engine/create): + +```js +{ + dynamic: 'strict', + properties: { + type: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + measures: { + properties: { + // autogenerated from devices mappings + } + }, + metadata: { + dynamic: 'false', + properties: {} + } + } +} +``` + +### Customize + +Through the plugin, it is possible to add custom properties to: + +- The `metadata` field, by using the [registerMetadata method](/kuzzle-iot-platform/device-manager/1/classes/assets-custom-properties/register-metadata). + +It allows you to store your custom `metadata` properties for a specific tenant, and/or setting some by default. + +### Example + +```js +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManager = new DeviceManagerPlugin(); + +deviceManager.assets.registerMetadata({ + warranty: { + type: 'keyword', // Since no tenant group is specified, + fields: { // this mapping will be applied to every + text: { type: 'text' } // tenant by default + } + } +}); + +deviceManager.assets.registerMetadata({ + stillAlive: { type: 'boolean' } +}, { tenantGroup: 'astronaut' }); // A tenant group is specified : 'astronaut'. + // This mapping definition for the `metadata` field + // of the `assets` collection will only be applied for + // the 'astronaut' tenant. +``` + +## "devices" collection + +Same as the `assets` collection, the `devices` collection has its default mappings loaded when you [create an engine](/kuzzle-iot-platform/device-manager/1/controllers/engine/create): + +```js +{ + dynamic: 'strict', + properties: { + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + measures: { + properties: { + temperature: { + properties: { + updatedAt: { type: 'date' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + degree: { type: 'float' } + } + }, + position: { + properties: { + updatedAt: { type: 'date' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + point: { type: 'geo_point' }, + altitude: { type: 'float' }, + accuracy: { type: 'integer' }, + } + }, + movement: { + properties: { + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + updatedAt: { type: 'date' }, + moving: { type: 'boolean' }, + } + } + } + }, + qos: { + dynamic: 'false', + properties: {}, + }, + metadata: { + dynamic: 'false', + properties: {}, + }, + assetId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + tenantId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + } + } +} +``` + +### Customize + +Through the plugin, it is possible to add custom properties to: + +- The `qos` field, by using the [registerQos method](/kuzzle-iot-platform/device-manager/1/classes/devices-custom-properties/register-qos). +- The `measures` field, by using the [registerMeasure method](/kuzzle-iot-platform/device-manager/1/classes/devices-custom-properties/register-measure). +- The `metadata` field, by using the [registerMetadata method](/kuzzle-iot-platform/device-manager/1/classes/devices-custom-properties/register-metadata). + +Those methods allow you to store custom properties into those fields for a specific tenant, and/or setting some by default. + +### Example + +```js +import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager'; + +const deviceManager = new DeviceManagerPlugin(); + +deviceManager.devices.registerMeasure('humidity', { + properties: { + updatedAt: { type: 'date' }, // By default, every 'devices' tenant collection + payloadUuid: { // will have the 'humidity' property with the provided + type: 'keyword', // mapping inside the 'measures' field. + fields: { + text: { type: 'text' } + } + }, + value: { type: 'float' }, + } +}); + +deviceManager.devices.registerMeasure('gravity', { + properties: { + updatedAt: { type: 'date' }, // The 'devices' collection of the 'astronaut' tenant + payloadUuid: { // will have the 'gravity' property with the provided + type: 'keyword', // mapping inside the 'measures' field. + fields: { + text: { type: 'text' } + } + }, + value: { type: 'float' }, + } +}, { tenantGroup: 'astronaut' }); + +deviceManager.devices.registerQos({ // By default, every 'devices' tenant collection + battery: { type: 'integer' } // will have the 'battery' property with the provided +}); // mapping inside the 'qod' field. + + +deviceManager.devices.registerQos({ // The 'devices' collection of the 'astronaut' tenant + durability: { type: 'float' } // will have the 'durability' property with the provided +}, { tenantGroup: 'astronaut' }); // mapping inside the 'qos' field. + +deviceManager.devices.registerMetadata({ // By default, every 'devices' tenant collection + group: { // will have the 'group' property with the provided + type: 'keyword', // mapping inside the 'metadata' field. + fields: { + text: { type: 'text' } + } + } +}); +``` diff --git a/features/AssetController.feature b/features/AssetController.feature index 44fd54fd..a990c9ca 100644 --- a/features/AssetController.feature +++ b/features/AssetController.feature @@ -6,13 +6,13 @@ Feature: Device Manager asset controller | index | "tenant-kuzzle" | | body.type | "outils" | | body.model | "PERFO" | - | body.reference | "asset-01" | - Then The document "tenant-kuzzle":"assets":"outils_PERFO_asset-01" exists + | body.reference | "asset_01" | + Then The document "tenant-kuzzle":"assets":"outils-PERFO-asset_01" exists When I successfully execute the action "device-manager/asset":"update" with args: | index | "tenant-kuzzle" | - | _id | "outils_PERFO_asset-01" | + | _id | "outils-PERFO-asset_01" | | body.metadata.foobar | 42 | And I successfully execute the action "device-manager/asset":"delete" with args: | index | "tenant-kuzzle" | - | _id | "outils_PERFO_asset-01" | - Then The document "tenant-kuzzle":"assets":"outils_PERFO_asset-01" does not exists + | _id | "outils-PERFO-asset_01" | + Then The document "tenant-kuzzle":"assets":"outils-PERFO-asset_01" does not exists diff --git a/features/DeviceController.feature b/features/DeviceController.feature index ea6e8f87..0d91706e 100644 --- a/features/DeviceController.feature +++ b/features/DeviceController.feature @@ -3,36 +3,36 @@ Feature: Device Manager device controller Scenario: Attach a device to a tenant Given an engine on index "tenant-kuzzle" When I successfully execute the action "device-manager/device":"attachTenant" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | index | "tenant-kuzzle" | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | "tenant-kuzzle" | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" exists Scenario: Attach multiple devices to a tenant using JSON Given an engine on index "tenant-kuzzle" When I successfully execute the action "device-manager/device":"mAttach" with args: | body.records.0.tenantId | "tenant-kuzzle" | - | body.records.0.deviceId | "DummyTemp_detached" | + | body.records.0.deviceId | "DummyTemp-detached" | | body.records.1.tenantId | "tenant-kuzzle" | - | body.records.1.deviceId | "DummyTemp_attached-ayse-unlinked" | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + | body.records.1.deviceId | "DummyTemp-attached_ayse_unlinked" | + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | "tenant-kuzzle" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-kuzzle" | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" exists - And The document "tenant-kuzzle":"devices":"DummyTemp_attached-ayse-unlinked" exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" exists + And The document "tenant-kuzzle":"devices":"DummyTemp-attached_ayse_unlinked" exists Scenario: Attach multiple device to a tenant using CSV Given an engine on index "tenant-kuzzle" When I successfully execute the action "device-manager/device":"mAttach" with args: - | body.csv | "tenantId,deviceId\\ntenant-kuzzle,DummyTemp_detached\\ntenant-kuzzle,DummyTemp_attached-ayse-unlinked," | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + | body.csv | "tenantId,deviceId\\ntenant-kuzzle,DummyTemp-detached\\ntenant-kuzzle,DummyTemp-attached_ayse_unlinked," | + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | "tenant-kuzzle" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-kuzzle" | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" exists - And The document "tenant-kuzzle":"devices":"DummyTemp_attached-ayse-unlinked" exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" exists + And The document "tenant-kuzzle":"devices":"DummyTemp-attached_ayse_unlinked" exists Scenario: Attach multiple device to a tenant while exceeding documentsWriteCount limit Given an engine on index "tenant-kuzzle" @@ -43,58 +43,58 @@ Feature: Device Manager device controller Scenario: Error when assigning a device to a tenant Given an engine on index "tenant-kuzzle" When I execute the action "device-manager/device":"attachTenant" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | index | "tenant-kaliop" | Then I should receive an error matching: | message | "Tenant \"tenant-kaliop\" does not have a device-manager engine" | And I successfully execute the action "device-manager/device":"attachTenant" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | index | "tenant-kuzzle" | When I execute the action "device-manager/device":"attachTenant" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | index | "tenant-kuzzle" | Then I should receive an error matching: - | message | "These devices \"DummyTemp_detached\" are already attached to a tenant" | + | message | "These devices \"DummyTemp-detached\" are already attached to a tenant" | Scenario: Detach device from a tenant Given an engine on index "tenant-kuzzle" And I successfully execute the action "device-manager/device":"attachTenant" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | index | "tenant-kuzzle" | When I successfully execute the action "device-manager/device":"detach" with args: - | _id | "DummyTemp_detached" | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + | _id | "DummyTemp-detached" | + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | null | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" does not exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" does not exists Scenario: Detach multiple devices to a tenant using JSON Given an engine on index "tenant-kuzzle" When I successfully execute the action "device-manager/device":"mAttach" with args: | body.records.0.tenantId | "tenant-kuzzle" | - | body.records.0.deviceId | "DummyTemp_detached" | + | body.records.0.deviceId | "DummyTemp-detached" | | body.records.1.tenantId | "tenant-kuzzle" | - | body.records.1.deviceId | "DummyTemp_attached-ayse-unlinked" | + | body.records.1.deviceId | "DummyTemp-attached_ayse_unlinked" | When I successfully execute the action "device-manager/device":"mDetach" with args: - | body.deviceIds | ["DummyTemp_detached","DummyTemp_attached-ayse-unlinked"] | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + | body.deviceIds | ["DummyTemp-detached","DummyTemp-attached_ayse_unlinked"] | + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | null | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | null | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" does not exists - And The document "tenant-kuzzle":"devices":"DummyTemp_attached-ayse-unlinked" does not exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" does not exists + And The document "tenant-kuzzle":"devices":"DummyTemp-attached_ayse_unlinked" does not exists Scenario: Detach multiple devices to a tenant using CSV Given an engine on index "tenant-kuzzle" When I successfully execute the action "device-manager/device":"mAttach" with args: - | body.csv | "tenantId,deviceId\\ntenant-kuzzle,DummyTemp_detached\\ntenant-kuzzle,DummyTemp_attached-ayse-unlinked," | + | body.csv | "tenantId,deviceId\\ntenant-kuzzle,DummyTemp-detached\\ntenant-kuzzle,DummyTemp-attached_ayse_unlinked," | When I successfully execute the action "device-manager/device":"mDetach" with args: - | body.csv | "deviceId\\nDummyTemp_detached\\nDummyTemp_attached-ayse-unlinked," | - Then The document "device-manager":"devices":"DummyTemp_detached" content match: + | body.csv | "deviceId\\nDummyTemp-detached\\nDummyTemp-attached_ayse_unlinked," | + Then The document "device-manager":"devices":"DummyTemp-detached" content match: | tenantId | null | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | null | - And The document "tenant-kuzzle":"devices":"DummyTemp_detached" does not exists - And The document "tenant-kuzzle":"devices":"DummyTemp_attached-ayse-unlinked" does not exists + And The document "tenant-kuzzle":"devices":"DummyTemp-detached" does not exists + And The document "tenant-kuzzle":"devices":"DummyTemp-attached_ayse_unlinked" does not exists Scenario: Detach multiple device to a tenant while exceeding documentsWriteCount limit Given an engine on index "tenant-kuzzle" @@ -106,29 +106,29 @@ Feature: Device Manager device controller Scenario: Error when detaching from a tenant Given an engine on index "tenant-kuzzle" When I execute the action "device-manager/device":"detach" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | Then I should receive an error matching: - | message | "Devices \"DummyTemp_detached\" are not attached to a tenant" | + | message | "Devices \"DummyTemp-detached\" are not attached to a tenant" | Given I successfully execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | | assetId | "PERFO-unlinked" | When I execute the action "device-manager/device":"detach" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | Then I should receive an error matching: - | message | "Devices \"DummyTemp_attached-ayse-unlinked\" are still linked to an asset" | + | message | "Devices \"DummyTemp-attached_ayse_unlinked\" are still linked to an asset" | Scenario: Link device to an asset When I successfully execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | | assetId | "PERFO-unlinked" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | - And The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: - | measures.temperature.id | "DummyTemp_attached-ayse-unlinked" | + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | | measures.temperature.model | "DummyTemp" | - | measures.temperature.reference | "attached-ayse-unlinked" | + | measures.temperature.reference | "attached_ayse_unlinked" | | measures.temperature.updatedAt | 1610793427950 | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 23.3 | @@ -136,16 +136,16 @@ Feature: Device Manager device controller Scenario: Link multiple device to multiple assets using JSON When I successfully execute the action "device-manager/device":"mLink" with args: - | body.records.0.deviceId | "DummyTemp_attached-ayse-unlinked" | + | body.records.0.deviceId | "DummyTemp-attached_ayse_unlinked" | | body.records.0.assetId | "PERFO-unlinked" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | - And The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: - | measures.temperature.id | "DummyTemp_attached-ayse-unlinked" | + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | | measures.temperature.model | "DummyTemp" | - | measures.temperature.reference | "attached-ayse-unlinked" | + | measures.temperature.reference | "attached_ayse_unlinked" | | measures.temperature.updatedAt | 1610793427950 | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 23.3 | @@ -153,15 +153,81 @@ Feature: Device Manager device controller Scenario: Link multiple device to multiple assets using CSV When I successfully execute the action "device-manager/device":"mLink" with args: - | body.csv | "deviceId,assetId\\nDummyTemp_attached-ayse-unlinked,PERFO-unlinked" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + | body.csv | "deviceId,assetId\\nDummyTemp-attached_ayse_unlinked,PERFO-unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | - And The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | "PERFO-unlinked" | And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: - | measures.temperature.id | "DummyTemp_attached-ayse-unlinked" | + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | | measures.temperature.model | "DummyTemp" | - | measures.temperature.reference | "attached-ayse-unlinked" | + | measures.temperature.reference | "attached_ayse_unlinked" | + | measures.temperature.updatedAt | 1610793427950 | + | measures.temperature.payloadUuid | "_STRING_" | + | measures.temperature.degree | 23.3 | + | measures.temperature.qos.battery | 80 | + + Scenario: Link multiple device to multiple assets using JSON + When I successfully execute the action "device-manager/device":"mLink" with args: + | body.records.0.deviceId | "DummyTemp-attached_ayse_unlinked" | + | body.records.0.assetId | "PERFO-unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | + | measures.temperature.model | "DummyTemp" | + | measures.temperature.reference | "attached_ayse_unlinked" | + | measures.temperature.updatedAt | 1610793427950 | + | measures.temperature.payloadUuid | "_STRING_" | + | measures.temperature.degree | 23.3 | + | measures.temperature.qos.battery | 80 | + + Scenario: Link multiple device to multiple assets using CSV + When I successfully execute the action "device-manager/device":"mLink" with args: + | body.csv | "deviceId,assetId\\nDummyTemp-attached_ayse_unlinked,PERFO-unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | + | measures.temperature.model | "DummyTemp" | + | measures.temperature.reference | "attached_ayse_unlinked" | + | measures.temperature.updatedAt | 1610793427950 | + | measures.temperature.payloadUuid | "_STRING_" | + | measures.temperature.degree | 23.3 | + | measures.temperature.qos.battery | 80 | + + Scenario: Link multiple device to multiple assets using JSON + When I successfully execute the action "device-manager/device":"mLink" with args: + | body.records.0.deviceId | "DummyTemp-attached_ayse_unlinked" | + | body.records.0.assetId | "PERFO-unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | + | measures.temperature.model | "DummyTemp" | + | measures.temperature.reference | "attached_ayse_unlinked" | + | measures.temperature.updatedAt | 1610793427950 | + | measures.temperature.payloadUuid | "_STRING_" | + | measures.temperature.degree | 23.3 | + | measures.temperature.qos.battery | 80 | + + Scenario: Link multiple device to multiple assets using CSV + When I successfully execute the action "device-manager/device":"mLink" with args: + | body.csv | "deviceId,assetId\\nDummyTemp-attached_ayse_unlinked,PERFO-unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | "PERFO-unlinked" | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | + | measures.temperature.model | "DummyTemp" | + | measures.temperature.reference | "attached_ayse_unlinked" | | measures.temperature.updatedAt | 1610793427950 | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 23.3 | @@ -169,31 +235,103 @@ Feature: Device Manager device controller Scenario: Error when linking device to an asset When I execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_detached" | + | _id | "DummyTemp-detached" | | assetId | "PERFO-unlinked" | Then I should receive an error matching: - | message | "Devices \"DummyTemp_detached\" are not attached to a tenant" | + | message | "Devices \"DummyTemp-detached\" are not attached to a tenant" | When I execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | | assetId | "PERFO-non-existing" | Then I should receive an error matching: | message | "Assets \"PERFO-non-existing\" do not exist" | - Scenario: Unlink device from an asset + Scenario: Error when unlinking from an asset + When I execute the action "device-manager/device":"unlink" with args: + | _id | "DummyTemp-attached_ayse_unlinked" | + Then I should receive an error matching: + | message | "Devices \"DummyTemp-attached_ayse_unlinked\" are not linked to an asset" | + + Scenario: Unlink multiple devices from multiple assets using JSON Given I successfully execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | | assetId | "PERFO-unlinked" | + When I successfully execute the action "device-manager/device":"mUnlink" with args: + | body.records.0.deviceId | "DummyTemp-attached_ayse_unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | null | + Then The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | null | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures | {} | + + Scenario: Unlink multiple devices from multiple assets using CSV + Given I successfully execute the action "device-manager/device":"linkAsset" with args: + | _id | "DummyTemp-attached_ayse_unlinked" | + | assetId | "PERFO-unlinked" | + When I successfully execute the action "device-manager/device":"mUnlink" with args: + | body.csv | "deviceId\\nDummyTemp-attached_ayse_unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | null | + Then The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: + | assetId | null | + And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: + | measures | {} | + + Scenario: Unlink device from an asset + And I successfully execute the action "device-manager/device":"attachTenant" with args: + | _id | "DummyTemp-detached" | + | index | "tenant-ayse" | + When I successfully execute the action "device-manager/device":"mLink" with args: + | body.records.0.deviceId | "DummyTemp-attached_ayse_unlinked" | + | body.records.0.assetId | "PERFO-unlinked" | + | body.records.1.deviceId | "DummyTemp-detached" | + | body.records.1.assetId | "PERFO-unlinked" | When I successfully execute the action "device-manager/device":"unlink" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + | _id | "DummyTemp-attached_ayse_unlinked" | + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | null | - Then The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | assetId | null | And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: - | measures | null | + | measures.position.reference | "detached" | + | measures.position.payloadUuid | "some-uuid" | + | measures.position.accuracy | 42 | + | measures.position.model | "_STRING_" | + | measures.position.id | "_STRING_" | + | measures.position.point.lon | 3.876716 | + | measures.position.point.lat | 43.610767 | + | measures.position.updatedAt | 1610793427950 | - Scenario: Error when unlinking from an asset - When I execute the action "device-manager/device":"unlink" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | - Then I should receive an error matching: - | message | "Device \"DummyTemp_attached-ayse-unlinked\" is not linked to an asset" | + Scenario: Clean payloads collection + Given I successfully execute the action "collection":"truncate" with args: + | index | "device-manager" | + | collection | "payloads" | + Then I successfully receive a "dummy-temp" payload with: + | deviceEUI | "12345" | + | register55 | 23.3 | + | batteryLevel | 0.8 | + And I successfully receive a "dummy-temp-position" payload with: + | deviceEUI | "12345" | + | register55 | 23.3 | + | location.lat | 42.2 | + | location.lon | 2.42 | + | location.accu | 2100 | + And I successfully execute the action "collection":"refresh" with args: + | index | "device-manager" | + | collection | "payloads" | + Then I successfully execute the action "document":"search" with args: + | index | "device-manager" | + | collection | "payloads" | + Then I should receive a result matching: + | total | 2 | + And I successfully execute the action "device-manager/device":"prunePayloads" with args: + | body.days | 0 | + | body.deviceModel | "DummyTemp" | + And I successfully execute the action "collection":"refresh" with args: + | index | "device-manager" | + | collection | "payloads" | + Then I successfully execute the action "document":"search" with args: + | index | "device-manager" | + | collection | "payloads" | + Then I should receive a result matching: + | total | 1 | diff --git a/features/DeviceManager.feature b/features/DeviceManager.feature index 80fd2591..23c6600c 100644 --- a/features/DeviceManager.feature +++ b/features/DeviceManager.feature @@ -21,3 +21,18 @@ Feature: Device Manager Plugin | collection | "payloads" | Then I should receive a result matching: | properties.payload.properties.deviceEUI.type | "keyword" | + When I successfully execute the action "device-manager/engine":"create" with args: + | index | "tenant-custom" | + | group | "astronaut" | + When I successfully execute the action "collection":"getMapping" with args: + | index | "tenant-custom" | + | collection | "devices" | + Then I should receive a result matching: + | properties.metadata.properties.awake.type | "boolean" | + | properties.qos.properties.durability.type | "float" | + | properties.measures.properties.gravity.properties.value.type | "float" | + When I successfully execute the action "collection":"getMapping" with args: + | index | "tenant-custom" | + | collection | "assets" | + Then I should receive a result matching: + | properties.metadata.properties.stillAlive.type | "boolean" | \ No newline at end of file diff --git a/features/PayloadController.feature b/features/PayloadController.feature index 9acda7b9..6ee34ca1 100644 --- a/features/PayloadController.feature +++ b/features/PayloadController.feature @@ -5,7 +5,7 @@ Feature: Payloads Controller | deviceEUI | "12345" | | register55 | 23.3 | | batteryLevel | 0.8 | - Then The document "device-manager":"devices":"DummyTemp_12345" content match: + Then The document "device-manager":"devices":"DummyTemp-12345" content match: | reference | "12345" | | model | "DummyTemp" | | measures.temperature.updatedAt | "_DATE_NOW_" | @@ -24,7 +24,7 @@ Feature: Payloads Controller | deviceEUI | "12345" | | register55 | 42.2 | | batteryLevel | 0.7 | - Then The document "device-manager":"devices":"DummyTemp_12345" content match: + Then The document "device-manager":"devices":"DummyTemp-12345" content match: | reference | "12345" | | model | "DummyTemp" | | measures.temperature.updatedAt | "_DATE_NOW_" | @@ -49,7 +49,7 @@ Feature: Payloads Controller | location.lat | 42.2 | | location.lon | 2.42 | | location.accu | 2100 | - Then The document "device-manager":"devices":"DummyTempPosition_12345" content match: + Then The document "device-manager":"devices":"DummyTempPosition-12345" content match: | reference | "12345" | | model | "DummyTempPosition" | | measures.temperature.updatedAt | "_DATE_NOW_" | @@ -69,7 +69,7 @@ Feature: Payloads Controller | deviceEUI | "12345" | | register55 | 23.3 | | batteryLevel | 0.8 | - Then The document "device-manager":"devices":"DummyTemp_12345" content match: + Then The document "device-manager":"devices":"DummyTemp-12345" content match: | qos.registerEnriched | true | | qos.updateEnriched | "_UNDEFINED_" | # Update @@ -77,7 +77,7 @@ Feature: Payloads Controller | deviceEUI | "12345" | | register55 | 23.3 | | batteryLevel | 0.8 | - Then The document "device-manager":"devices":"DummyTemp_12345" content match: + Then The document "device-manager":"devices":"DummyTemp-12345" content match: | qos.registerEnriched | true | | qos.updateEnriched | true | @@ -98,50 +98,50 @@ Feature: Payloads Controller Scenario: Propagate device to tenant index When I successfully receive a "dummy-temp" payload with: - | deviceEUI | "attached-ayse-unlinked" | + | deviceEUI | "attached_ayse_unlinked" | | register55 | 42.2 | | batteryLevel | 0.4 | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-ayse" | | measures.temperature.updatedAt | "_DATE_NOW_" | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 42.2 | | qos.battery | 40 | - And The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + And The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-ayse" | | measures.temperature.updatedAt | "_DATE_NOW_" | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 42.2 | | qos.battery | 40 | And I should receive a result matching: - | device._id | "DummyTemp_attached-ayse-unlinked" | + | device._id | "DummyTemp-attached_ayse_unlinked" | | asset | null | | tenantId | "tenant-ayse" | Scenario: Propagate device measures to asset Given I successfully execute the action "device-manager/device":"linkAsset" with args: - | _id | "DummyTemp_attached-ayse-unlinked" | + | _id | "DummyTemp-attached_ayse_unlinked" | | assetId | "PERFO-unlinked" | When I successfully receive a "dummy-temp" payload with: - | deviceEUI | "attached-ayse-unlinked" | + | deviceEUI | "attached_ayse_unlinked" | | register55 | 42.2 | | batteryLevel | 0.4 | - Then The document "device-manager":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "device-manager":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-ayse" | | assetId | "PERFO-unlinked" | - Then The document "tenant-ayse":"devices":"DummyTemp_attached-ayse-unlinked" content match: + Then The document "tenant-ayse":"devices":"DummyTemp-attached_ayse_unlinked" content match: | tenantId | "tenant-ayse" | | assetId | "PERFO-unlinked" | And The document "tenant-ayse":"assets":"PERFO-unlinked" content match: - | measures.temperature.id | "DummyTemp_attached-ayse-unlinked" | - | measures.temperature.reference | "attached-ayse-unlinked" | + | measures.temperature.id | "DummyTemp-attached_ayse_unlinked" | + | measures.temperature.reference | "attached_ayse_unlinked" | | measures.temperature.model | "DummyTemp" | | measures.temperature.updatedAt | "_DATE_NOW_" | | measures.temperature.payloadUuid | "_STRING_" | | measures.temperature.degree | 42.2 | | measures.temperature.qos.battery | 40 | And I should receive a result matching: - | device._id | "DummyTemp_attached-ayse-unlinked" | + | device._id | "DummyTemp-attached_ayse_unlinked" | | asset._id | "PERFO-unlinked" | | tenantId | "tenant-ayse" | diff --git a/features/fixtures/application/app.ts b/features/fixtures/application/app.ts index 30011910..b0303f01 100644 --- a/features/fixtures/application/app.ts +++ b/features/fixtures/application/app.ts @@ -10,27 +10,65 @@ const deviceManager = new DeviceManagerPlugin(); deviceManager.registerDecoder(new DummyTempDecoder()); deviceManager.registerDecoder(new DummyTempPositionDecoder()); -deviceManager.mappings.devices.measures = { - humidity: { - properties: { - updatedAt: { type: 'date' }, - payloadUuid: { type: 'keyword' }, - value: { type: 'float' }, - } +deviceManager.devices.registerMeasure('humidity', { + properties: { + updatedAt: { type: 'date' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + value: { type: 'float' }, + } +}); + +deviceManager.devices.registerMeasure('gravity', { + properties: { + updatedAt: { type: 'date' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + value: { type: 'float' }, } -}; +}, { tenantGroup: 'astronaut' }); -deviceManager.mappings.devices.qos = { +deviceManager.devices.registerQos({ battery: { type: 'integer' } -}; +}); + +deviceManager.devices.registerQos({ + durability: { type: 'float' } +}, { tenantGroup: 'astronaut' }); + +deviceManager.devices.registerMetadata({ + group: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + } +}); + +deviceManager.devices.registerMetadata({ + awake: { type: 'boolean' } +}, { tenantGroup: 'astronaut' }); -deviceManager.mappings.devices.metadata = { - group: { type: 'keyword' } -}; +deviceManager.assets.registerMetadata({ + warranty: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + } +}); -deviceManager.mappings.assets.metadata = { - warranty: { type: 'keyword' } -}; +deviceManager.assets.registerMetadata({ + stillAlive: { type: 'boolean' } +}, { tenantGroup: 'astronaut' }); app.plugin.use(deviceManager); diff --git a/features/fixtures/devices.js b/features/fixtures/devices.js index 1462bb92..505434f3 100644 --- a/features/fixtures/devices.js +++ b/features/fixtures/devices.js @@ -1,7 +1,7 @@ const devices = []; for (let i = 0; i < 50; i++) { - devices.push({ index: { _id: `DummyTemp_detached-${i}` } }); + devices.push({ index: { _id: `DummyTemp-detached-${i}` } }); devices.push({ reference: 'detached', model: `DummyTemp-${i}`, diff --git a/features/fixtures/fixtures.js b/features/fixtures/fixtures.js index 2c89730b..5598ad90 100644 --- a/features/fixtures/fixtures.js +++ b/features/fixtures/fixtures.js @@ -4,18 +4,28 @@ module.exports = { 'device-manager': { devices: [ ...devices, - { index: { _id: 'DummyTemp_detached' } }, + { index: { _id: 'DummyTemp-detached' } }, { reference: 'detached', model: 'DummyTemp', - measures: {}, + measures: { + position: { + updatedAt: 1610793427950, + payloadUuid: 'some-uuid', + point: { + lat: 43.610767, + lon: 3.876716, + }, + accuracy: 42, + } + }, metadata: {}, tenantId: null, assetId: null }, - { index: { _id: 'DummyTemp_attached-ayse-unlinked' } }, + { index: { _id: 'DummyTemp-attached_ayse_unlinked' } }, { - reference: 'attached-ayse-unlinked', + reference: 'attached_ayse_unlinked', model: 'DummyTemp', measures: { temperature: { @@ -34,9 +44,9 @@ module.exports = { }, 'tenant-ayse': { devices: [ - { index: { _id: 'DummyTemp_attached-ayse-unlinked' } }, + { index: { _id: 'DummyTemp-attached_ayse_unlinked' } }, { - reference: 'attached-ayse-unlinked', + reference: 'attached_ayse_unlinked', model: 'DummyTemp', measures: { temperature: { diff --git a/features/fixtures/rights.js b/features/fixtures/rights.js index de8ccaa4..4021ff5e 100644 --- a/features/fixtures/rights.js +++ b/features/fixtures/rights.js @@ -13,7 +13,7 @@ module.exports = { } } } - } + }, }, users: { melis: { diff --git a/features/step_definitions/device-controller-steps.js b/features/step_definitions/device-controller-steps.js index 4839c388..ef357fa2 100644 --- a/features/step_definitions/device-controller-steps.js +++ b/features/step_definitions/device-controller-steps.js @@ -5,7 +5,7 @@ const { devicesTests } = require('../fixtures/devices'); When('I succesfully execute {string}:{string} while exeding documentsWriteCount limit', async function (controller, action) { const records = []; for (let i = 0; i < devicesTests.length; i++) { - records.push({ deviceId: `DummyTemp_detached-${i}`, tenantId: 'tenant-kuzzle' }); + records.push({ deviceId: `DummyTemp-detached-${i}`, tenantId: 'tenant-kuzzle' }); } @@ -21,7 +21,7 @@ When('I succesfully execute {string}:{string} while exeding documentsWriteCount Then('All devices in {string} {string} have the property {string} to {string}', async function (index, collection, key, value) { const deviceIds = []; for (let i = 0; i < devicesTests.length; i++) { - deviceIds.push(`DummyTemp_detached-${i}`); + deviceIds.push(`DummyTemp-detached-${i}`); } const { successes, errors } = await this.sdk.document.mGet(index, collection, deviceIds); @@ -43,7 +43,7 @@ Then('All devices in {string} {string} have the property {string} to {string}', Then('All {string} devices documents exists', async function (tenant) { const deviceIds = []; for (let i = 0; i < devicesTests.length; i++) { - deviceIds.push(`DummyTemp_detached-${i}`); + deviceIds.push(`DummyTemp-detached-${i}`); } const { errors } = await this.sdk.document.mGet(tenant, 'devices', deviceIds); @@ -56,7 +56,7 @@ Then('All {string} devices documents exists', async function (tenant) { Then(/All documents "(.*?)":"(.*?)" (does not)? exists/, async function (index, collection, not) { const deviceIds = []; for (let i = 0; i < devicesTests.length; i++) { - deviceIds.push(`DummyTemp_detached-${i}`); + deviceIds.push(`DummyTemp-detached-${i}`); } const { successes, errors } = await this.sdk.document.mGet(index, collection, deviceIds); diff --git a/lib/DeviceManagerPlugin.ts b/lib/DeviceManagerPlugin.ts index f657ff2d..12966fb4 100644 --- a/lib/DeviceManagerPlugin.ts +++ b/lib/DeviceManagerPlugin.ts @@ -15,8 +15,12 @@ import { import { EngineService, PayloadService, DeviceService } from './services'; import { Decoder } from './decoders'; -import { devicesMappings, assetsMappings } from './models'; - +import { + assetsMappings, + devicesMappings, + AssetsCustomProperties, + DevicesCustomProperties +} from './models'; export class DeviceManagerPlugin extends Plugin { private defaultConfig: JSONObject; @@ -32,91 +36,30 @@ export class DeviceManagerPlugin extends Plugin { return this.context.accessors.sdk; } - /** - * Define custom mappings for "devices" and "assets" colections - */ - public mappings: { - /** - * Define custom mappings for the "devices" collection. - */ - devices: { - /** - * Define custom mappings for the "devices.metadata" property - */ - metadata: JSONObject; - /** - * Define custom mappings for the "devices.qos" property - */ - qos: JSONObject; - /** - * Define custom mappings for the "devices.measures" property - */ - measures: JSONObject; - }, - /** - * Define custom mappings for the "assets" collection. - */ - assets: { - /** - * Define custom mappings for the "assets.metadata" property - */ - metadata: JSONObject; - }, - } - /** * List of registered decoders. * Map */ private decoders = new Map(); + public devices = new DevicesCustomProperties(devicesMappings); + + public assets = new AssetsCustomProperties(assetsMappings); + /** * Constructor */ constructor() { super({ - kuzzleVersion: '>=2.10.0 <3' + kuzzleVersion: '>=2.11.1 <3' }); - this.mappings = { - devices: { - metadata: {}, - qos: {}, - measures: {}, - }, - assets: { - metadata: {}, - }, - }; - this.api = { 'device-manager/payload': { actions: {} } }; - this.pipes = { - 'multi-tenancy/tenant:afterCreate': async request => { - const { index: tenantIndex } = request.result; - - const { collections } = await this.engineService.create(tenantIndex); - - if (!Array.isArray(request.result.collections)) { - request.result.collections = []; - } - request.result.collections.push(...collections); - - return request; - }, - 'multi-tenancy/tenant:afterDelete': async request => { - const { index: tenantIndex } = request.result; - - await this.engineService.delete(tenantIndex); - - return request; - } - }; - this.defaultConfig = { adminIndex: 'device-manager', adminCollections: { @@ -129,7 +72,6 @@ export class DeviceManagerPlugin extends Plugin { devices: devicesMappings, payloads: { dynamic: 'false', - // @todo have API action to clean properties: { uuid: { type: 'keyword' }, valid: { type: 'boolean' }, @@ -142,7 +84,7 @@ export class DeviceManagerPlugin extends Plugin { }, collections: { assets: assetsMappings, - devices: devicesMappings, + devices: devicesMappings } }; } @@ -152,16 +94,19 @@ export class DeviceManagerPlugin extends Plugin { */ async init (config: JSONObject, context: PluginContext) { this.config = { ...this.defaultConfig, ...config }; + this.context = context; - this.mergeCustomMappings(); + this.config.mappings = new Map(); + this.mergeMappings(); + this.engineService = new EngineService(this.config, context); this.payloadService = new PayloadService(this.config, context); - this.deviceService = new DeviceService(this.config, context); + this.deviceService = new DeviceService(this.config, context, this.decoders); this.assetController = new AssetController(this.config, context); this.engineController = new EngineController(this.config, context, this.engineService); - this.deviceController = new DeviceController(this.config, context, this.decoders, this.deviceService); + this.deviceController = new DeviceController(this.config, context, this.deviceService); this.api['device-manager/asset'] = this.assetController.definition; this.api['device-manager/device'] = this.deviceController.definition; @@ -229,50 +174,81 @@ export class DeviceManagerPlugin extends Plugin { ); } - private mergeCustomMappings () { - // Merge devices qos custom mappings - this.config.collections.devices.properties.qos.properties = { - ...this.config.collections.devices.properties.qos.properties, - ...this.mappings.devices.qos, - }; - - // Merge devices metadata custom mappings - this.config.collections.devices.properties.metadata.properties = { - ...this.config.collections.devices.properties.metadata.properties, - ...this.mappings.devices.metadata, - }; + /** + * Merge custom properties mappings for 'assets' and 'devices' collection by tenant group + */ + private mergeMappings() { + const assetsProperties = this.assets.definitions.get('shared'); + const devicesProperties = this.devices.definitions.get('shared'); + + // Retrieve each group name which has custom properties definition + const tenantGroups = [...new Set(Array.from(this.devices.definitions.keys()) + .concat(Array.from(this.assets.definitions.keys())))]; + + // Init each group with 'devices' and 'assets' shared properties definition + for (const tenantGroup of tenantGroups) { + this.config.mappings.set(tenantGroup, { + assets: { + dynamic: 'false', + properties: assetsProperties + }, + devices: { + dynamic: 'false', + properties: devicesProperties + } + }); + } - // Merge devices measures custom mappings - this.config.collections.devices.properties.measures.properties = { - ...this.config.collections.devices.properties.measures.properties, - ...this.mappings.devices.measures, - }; + // Merge custom 'devices' properties with shared properties + for (const [tenantGroup, customProperties] of this.devices.definitions) { + this.config.mappings.set(tenantGroup, { + assets: this.config.mappings.get(tenantGroup).assets, + devices: { + dynamic: 'false', + properties: { + ...devicesProperties, + ...customProperties, + } + } + }); + } - // Merge assets metadata custom mappings - this.config.collections.assets.properties.metadata.properties = { - ...this.config.collections.assets.properties.metadata.properties, - ...this.mappings.assets.metadata, - }; + // Merge custom 'assets' properties with shared properties + for (const [tenantGroup, customProperties] of this.assets.definitions) { + this.config.mappings.set(tenantGroup, { + assets: { + dynamic: 'false', + properties: { + ...assetsProperties, + ...customProperties + } + }, + devices: this.config.mappings.get(tenantGroup).devices, + }); + + // Use "devices" mappings to generate "assets" collection mappings + // for the "measures" property + const deviceProperties = { + id: { type: 'keyword' }, + reference: { type: 'keyword' }, + model: { type: 'keyword' }, + }; - // Use "devices" mappings to generate "assets" collection mappings - // for the "measures" property - const deviceProperties = { - id: { type: 'keyword' }, - reference: { type: 'keyword' }, - model: { type: 'keyword' }, - }; + const tenantMappings = this.config.mappings.get(tenantGroup); - for (const [measureType, definition] of Object.entries(this.config.collections.devices.properties.measures.properties) as any) { - this.config.collections.assets.properties.measures.properties[measureType] = { - dynamic: 'false', - properties: { - ...deviceProperties, - ...definition.properties, - qos: { - properties: this.config.collections.devices.properties.qos.properties + for (const [measureType, definition] of Object.entries(tenantMappings.devices.properties.measures.properties) as any) { + tenantMappings.assets.properties.measures.properties[measureType] = { + dynamic: 'false', + properties: { + ...deviceProperties, + ...definition.properties, + qos: { + properties: tenantMappings.devices.properties.qos.properties + } } - } - }; + }; + } + this.config.mappings.set(tenantGroup, tenantMappings); } // Merge custom mappings from decoders for payloads collection @@ -282,6 +258,10 @@ export class DeviceManagerPlugin extends Plugin { ...decoder.payloadsMappings, }; } + + // Copy common mappings into the config + this.config.collections = this.config.mappings.get('shared'); + this.config.adminCollections.devices = this.config.mappings.get('shared').devices; } } diff --git a/lib/controllers/AssetController.ts b/lib/controllers/AssetController.ts index 0c70fb73..89b1a1a7 100644 --- a/lib/controllers/AssetController.ts +++ b/lib/controllers/AssetController.ts @@ -43,9 +43,9 @@ export class AssetController extends CRUDController { } async create (request: KuzzleRequest) { - const type = this.getBodyString(request, 'type'); - const model = this.getBodyString(request, 'model'); - const reference = this.getBodyString(request, 'reference'); + const type = request.getBodyString('type'); + const model = request.getBodyString('model'); + const reference = request.getBodyString('reference'); if (! request.input.resource._id) { const assetContent: BaseAssetContent = { diff --git a/lib/controllers/CRUDController.ts b/lib/controllers/CRUDController.ts index 4403ef15..ee8db569 100644 --- a/lib/controllers/CRUDController.ts +++ b/lib/controllers/CRUDController.ts @@ -5,19 +5,13 @@ import { ControllerDefinition, } from 'kuzzle'; -import { NativeController } from 'kuzzle/lib/api/controllers/baseController.js' - -export class CRUDController extends NativeController { - [key: string]: any; - +export class CRUDController { protected context: PluginContext; protected config: JSONObject; private collection: string; public definition: ControllerDefinition; constructor (config: JSONObject, context: PluginContext, collection: string) { - super(); - this.config = config; this.context = context; this.collection = collection; @@ -32,9 +26,9 @@ export class CRUDController extends NativeController { * * @param request */ - create (request: KuzzleRequest) { - const index = this.getIndex(request); - const asset = this.getBody(request); + async create (request: KuzzleRequest) { + const index = request.getIndex(); + const asset = request.getBody(); const id = request.input.resource._id; return this.as(request.context.user).document.create( @@ -51,8 +45,8 @@ export class CRUDController extends NativeController { * @param request */ async delete (request: KuzzleRequest) { - const index = this.getIndex(request); - const id = this.getId(request); + const index = request.getIndex(); + const id = request.getId(); return this.as(request.context.user).document.delete( index, @@ -66,15 +60,20 @@ export class CRUDController extends NativeController { * * @param request */ - search (request: KuzzleRequest) { - const index = this.getIndex(request); - const { searchBody } = this.getSearchParams(request); + async search (request: KuzzleRequest) { + const index = request.getIndex(); + const { searchBody } = request.getSearchParams(); - return this.as(request.context.user).document.search( - index, - this.collection, - searchBody, - { ...request.input.args }); + return this.as(request.context.user).query( + { + controller: 'document', + action: 'search', + index, + collection: this.collection, + body: searchBody, + ...request.input.args + } + ); } /** @@ -82,10 +81,10 @@ export class CRUDController extends NativeController { * * @param request */ - update (request: KuzzleRequest) { - const index = this.getIndex(request); - const body = this.getBody(request); - const id = this.getId(request); + async update (request: KuzzleRequest) { + const index = request.getIndex(); + const body = request.getBody(); + const id = request.getId(); return this.as(request.context.user).document.update( index, @@ -94,5 +93,4 @@ export class CRUDController extends NativeController { body, { ...request.input.args }); } - } diff --git a/lib/controllers/DeviceController.ts b/lib/controllers/DeviceController.ts index dd972519..3e1c74d2 100644 --- a/lib/controllers/DeviceController.ts +++ b/lib/controllers/DeviceController.ts @@ -8,23 +8,24 @@ import { } from 'kuzzle'; import { CRUDController } from './CRUDController'; -import { Decoder } from '../decoders'; import { Device } from '../models'; import { DeviceBulkContent } from '../types'; import { DeviceService } from '../services'; export class DeviceController extends CRUDController { - private decoders: Map; + private deviceService: DeviceService; get sdk(): EmbeddedSDK { return this.context.accessors.sdk; } - constructor(config: JSONObject, context: PluginContext, decoders: Map, deviceService: DeviceService) { + constructor( + config: JSONObject, + context: PluginContext, + deviceService: DeviceService + ) { super(config, context, 'devices'); - this.decoders = decoders; - this.deviceService = deviceService; this.definition = { @@ -68,6 +69,14 @@ export class DeviceController extends CRUDController { handler: this.unlink.bind(this), http: [{ verb: 'delete', path: 'device-manager/:index/devices/:_id/_unlink' }] }, + mUnlink: { + handler: this.mUnlink.bind(this), + http: [{ verb: 'put', path: 'device-manager/devices/_mUnlink' }] + }, + prunePayloads: { + handler: this.prunePayloads.bind(this), + http: [{ verb: 'delete', path: 'device-manager/devices/_prunePayloads' }] + }, } }; } @@ -76,13 +85,19 @@ export class DeviceController extends CRUDController { * Attach a device to a tenant */ async attachTenant (request: KuzzleRequest) { - const tenantId = this.getIndex(request); - const deviceId = this.getId(request); + const tenantId = request.getIndex(); + const deviceId = request.getId(); const document = { tenantId: tenantId, deviceId: deviceId }; const devices = await this.mGetDevice([document]); - await this.deviceService.mAttach(devices, [document], { strict: true }); + await this.deviceService.mAttach( + devices, + [document], + { + strict: true, + options: { ...request.input.args } + }); } /** @@ -93,43 +108,67 @@ export class DeviceController extends CRUDController { const devices = await this.mGetDevice(bulkData); - return this.deviceService.mAttach(devices, bulkData, { strict }); + return this.deviceService.mAttach( + devices, + bulkData, + { + strict, + options: { ...request.input.args } + }); } /** * Unattach a device from it's tenant */ async detach (request: KuzzleRequest) { - const deviceId = this.getId(request); + const deviceId = request.getId(); const document: DeviceBulkContent = { deviceId }; const devices = await this.mGetDevice([document]); - await this.deviceService.mDetach(devices, [document], { strict: true }); + await this.deviceService.mDetach( + devices, + [document], + { + strict: true, + options: { ...request.input.args } + }); } - + /** - * Unattach multiple devices from multiple tenants + * Detach multiple devices from multiple tenants */ async mDetach (request: KuzzleRequest) { const { bulkData, strict } = await this.mParseRequest(request); const devices = await this.mGetDevice(bulkData); - return this.deviceService.mDetach(devices, bulkData, { strict }); + return this.deviceService.mDetach( + devices, + bulkData, + { + strict, + options: { ...request.input.args } + }); } /** * Link a device to an asset. */ async linkAsset (request: KuzzleRequest) { - const assetId = this.getString(request, 'assetId'); - const deviceId = this.getId(request); + const assetId = request.getString('assetId'); + const deviceId = request.getId(); const document: DeviceBulkContent = { deviceId, assetId }; const devices = await this.mGetDevice([document]); - await this.deviceService.mLink(devices, [document], this.decoders, { strict: true }); + await this.deviceService.mLink( + devices, + [document], + { + strict: true, + options: { ...request.input.args } + }); } /** @@ -140,27 +179,76 @@ export class DeviceController extends CRUDController { const devices = await this.mGetDevice(bulkData); - return this.deviceService.mLink(devices, bulkData, this.decoders, { strict }); + return this.deviceService.mLink( + devices, + bulkData, + { + strict, + options: { ...request.input.args } + }); } /** * Unlink a device from an asset. */ - async unlink (request: KuzzleRequest) { - const deviceId = this.getId(request); + async unlink (request: KuzzleRequest) { + const deviceId = request.getId(); - const device = await this.getDevice(deviceId); + const document: DeviceBulkContent = { deviceId }; + const devices = await this.mGetDevice([document]); - await this.deviceService.unlink(device); + await this.deviceService.mUnlink( + devices, + { + strict: true, + options: { ...request.input.args } + }); } - private async getDevice (deviceId: string): Promise { - const document: any = await this.sdk.document.get( - this.config.adminIndex, - 'devices', - deviceId); + /** + * Unlink multiple device from multiple assets. + */ + async mUnlink (request: KuzzleRequest) { + const { bulkData, strict } = await this.mParseRequest(request); - return new Device(document._source, document._id); + const devices = await this.mGetDevice(bulkData); + + return this.deviceService.mUnlink( + devices, + { + strict, + options: { ...request.input.args } + }); + } + + /** + * Clean payload collection for a time period + */ + async prunePayloads (request: KuzzleRequest) { + const body = request.getBody(); + + const date = new Date().setDate(new Date().getDate() - body.days || 7); + const filter = [] + filter.push({ + range: { + '_kuzzle_info.createdAt': { + lt: date + } + } + }); + + if (body.deviceModel) { + filter.push({ term: { deviceModel: body.deviceModel } }); + } + + if (body.keepInvalid) { + filter.push({ term: { valid: true } }) + } + + return await this.as(request.context.user).bulk.deleteByQuery( + this.config.adminIndex, + 'payloads', + { query: { bool: { filter } } }); } @@ -176,7 +264,7 @@ export class DeviceController extends CRUDController { } private async mParseRequest (request: KuzzleRequest) { - const { body, args } = request.input; + const body = request.input.body; let bulkData: DeviceBulkContent[]; @@ -184,7 +272,11 @@ export class DeviceController extends CRUDController { const lines = await csv({ delimiter: 'auto' }) .fromString(body.csv); - bulkData = lines.map(line => ({ tenantId: line.tenantId, deviceId: line.deviceId, assetId: line.assetId })); + bulkData = lines.map(({ tenantId, deviceId, assetId}) => ({ + tenantId, + deviceId, + assetId + })); } else if (body.records) { bulkData = body.records; @@ -196,7 +288,7 @@ export class DeviceController extends CRUDController { throw new BadRequestError(`Malformed request missing property csv, records, deviceIds`); } - const strict = args.strict ? args.strict : false; + const strict = request.getBoolean('strict'); return { strict, bulkData }; } diff --git a/lib/controllers/EngineController.ts b/lib/controllers/EngineController.ts index bbf5f626..0e18fdea 100644 --- a/lib/controllers/EngineController.ts +++ b/lib/controllers/EngineController.ts @@ -6,12 +6,12 @@ import { JSONObject, } from 'kuzzle'; -import { NativeController } from 'kuzzle/lib/api/controllers/baseController.js' import { EngineService } from '../services'; -export class EngineController extends NativeController { - [key: string]: any; +export class EngineController { private engineService: EngineService; + private context: PluginContext; + private config: JSONObject; public definition: ControllerDefinition; @@ -20,8 +20,6 @@ export class EngineController extends NativeController { } constructor (config: JSONObject, context: PluginContext, engineService: EngineService) { - super(); - this.config = config; this.context = context; this.engineService = engineService; @@ -53,21 +51,22 @@ export class EngineController extends NativeController { } async create (request: KuzzleRequest) { - const index = this.getIndex(request); - const { collections } = await this.engineService.create(index); + const index = request.getIndex(); + const tenantGroup = request.getString('group', 'shared'); + const { collections } = await this.engineService.create(index, tenantGroup); return { index, collections }; } async update (request: KuzzleRequest) { - const index = this.getIndex(request); + const index = request.getIndex(); const { collections } = await this.engineService.update(index); return { index, collections }; } async delete (request: KuzzleRequest) { - const index = this.getIndex(request); + const index = request.getIndex(); const { collections } = await this.engineService.delete(index); return { index, collections }; @@ -78,7 +77,7 @@ export class EngineController extends NativeController { } async exists (request: KuzzleRequest) { - const index = this.getIndex(request); + const index = request.getIndex(); return this.sdk.document.exists(this.config.adminIndex, 'engines', index); } diff --git a/lib/models/BaseAsset.ts b/lib/models/BaseAsset.ts index 6c5ac723..f9b251df 100644 --- a/lib/models/BaseAsset.ts +++ b/lib/models/BaseAsset.ts @@ -1,13 +1,12 @@ import { JSONObject } from 'kuzzle'; import { BaseAssetContent } from '../types'; - export class BaseAsset { _id: string; _source: BaseAssetContent; constructor (content: BaseAssetContent, _id?: string) { - this._id = _id || `${content.type}_${content.model}_${content.reference}`; + this._id = _id || `${content.type}-${content.model}-${content.reference}`; this._source = content; } @@ -20,12 +19,27 @@ export class BaseAsset { } } -export const assetsMappings ={ +export const assetsMappings = { dynamic: 'strict', properties: { - type: { type: 'keyword' }, - model: { type: 'keyword' }, - reference: { type: 'keyword' }, + type: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, measures: { properties: { // autogenerated from devices mappings diff --git a/lib/models/CustomProperties.ts b/lib/models/CustomProperties.ts new file mode 100644 index 00000000..509dd590 --- /dev/null +++ b/lib/models/CustomProperties.ts @@ -0,0 +1,124 @@ +import { JSONObject } from 'kuzzle'; + +export class AssetsCustomProperties { + + /** + * Custom mappings for "assets" collection + */ + public definitions: Map; + + constructor(assetsMappings: JSONObject) { + this.definitions = new Map(); + + // Initialize shared assets properties from default mappings + this.definitions.set('shared', assetsMappings.properties); + } + + /** + * Define custom mappings for the "metadata" property + * + * @param mapping Mapping definiton of the "metadata" property + * @param options Additional options + * - `tenantGroup` Name of the group for which the mapping should apply + */ + registerMetadata (mapping: JSONObject, options: JSONObject = { tenantGroup: 'shared' }) { + const tenantGroup = options.tenantGroup; + + this.definitions.set(tenantGroup, { + ...this.definitions.get(tenantGroup), + metadata: { + dynamic: 'false', + properties: { + ...mapping + } + } + }); + } +} + +export class DevicesCustomProperties { + + /** + * Custom mappings for "devices" collection + */ + public definitions: Map; + + constructor(deviceMappings: JSONObject) { + this.definitions = new Map(); + + // Initialize shared devices properties from default mappings + this.definitions.set('shared', deviceMappings.properties); + } + + /** + * Define custom mappings for the "qos" property + * + * @param mapping Mapping definiton of the "qos" property + * @param options Additional options + * - `tenantGroup` Name of the group for which the mapping should apply + */ + registerQos (mapping: JSONObject, options: JSONObject = { tenantGroup: 'shared' }) { + const tenantGroup = options.tenantGroup; + + this.definitions.set(tenantGroup, { + ...this.definitions.get(tenantGroup), + qos: { + dynamic: 'false', + properties: { + ...mapping + } + } + }); + } + + /** + * Define custom mappings for the "metadata" property + * + * @param mapping Mapping definiton of the "metadata" property + * @param options Additional options + * - `tenantGroup` Name of the group for which the mapping should apply + */ + registerMetadata (mapping: JSONObject, options: JSONObject = { tenantGroup: 'shared' }) { + const tenantGroup = options.tenantGroup; + + this.definitions.set(tenantGroup, { + ...this.definitions.get(tenantGroup), + metadata: { + dynamic: 'false', + properties: { + ...mapping + } + } + }); + } + + /** + * Define custom mappings for the "measures" property + * + * @param measureName Name of the measure property you mean to add (eg. 'temperature') + * @param mapping Mapping definiton of the added measure property + * @param options Additional options + * - `tenantGroup` Name of the group for which the mapping should apply + */ + registerMeasure (measureName: string, mapping: JSONObject, options: JSONObject = { tenantGroup: 'shared' }) { + const tenantGroup = options.tenantGroup; + let properties; + + const group = this.definitions.get(tenantGroup); + if (group) { + properties = group.measures && group.measures.properties + ? group.measures.properties + : undefined + } + this.definitions.set(tenantGroup, { + ...this.definitions.get(tenantGroup), + measures: { + dynamic: 'false', + properties: { + ...properties, + [measureName]: { ...mapping } + } + } + }); + } +} diff --git a/lib/models/Device.ts b/lib/models/Device.ts index 783e6d5b..c100eb97 100644 --- a/lib/models/Device.ts +++ b/lib/models/Device.ts @@ -7,12 +7,12 @@ export class Device { _source: DeviceContent; constructor (content: DeviceContent, _id?: string) { - this._id = _id || `${content.model}_${content.reference}`; + this._id = _id || `${content.model}-${content.reference}`; this._source = { qos: {}, metadata: {}, - ...content, + ...content }; } @@ -27,24 +27,44 @@ export class Device { export const devicesMappings = { dynamic: 'strict', properties: { - reference: { type: 'keyword' }, - model: { type: 'keyword' }, + reference: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, + model: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, measures: { properties: { temperature: { properties: { // common updatedAt: { type: 'date' }, - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, // temperature - degree: { type: 'float' }, + degree: { type: 'float' } } }, position: { properties: { // common updatedAt: { type: 'date' }, - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, // position point: { type: 'geo_point' }, altitude: { type: 'float' }, @@ -54,23 +74,38 @@ export const devicesMappings = { movement: { properties: { // common - payloadUuid: { type: 'keyword' }, + payloadUuid: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + }, updatedAt: { type: 'date' }, // movement state moving: { type: 'boolean' }, } - }, + } } }, qos: { dynamic: 'false', - properties: {} + properties: {}, }, metadata: { dynamic: 'false', - properties: {} + properties: {}, + }, + assetId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } }, - assetId: { type: 'keyword' }, - tenantId: { type: 'keyword' } + tenantId: { + type: 'keyword', + fields: { + text: { type: 'text' } + } + } } }; diff --git a/lib/models/index.ts b/lib/models/index.ts index 7edda09d..4e3750da 100644 --- a/lib/models/index.ts +++ b/lib/models/index.ts @@ -1,3 +1,5 @@ export * from './Device'; export * from './BaseAsset'; + +export * from './CustomProperties'; \ No newline at end of file diff --git a/lib/services/DeviceService.ts b/lib/services/DeviceService.ts index 7aed6cf9..a6bbf99b 100644 --- a/lib/services/DeviceService.ts +++ b/lib/services/DeviceService.ts @@ -21,16 +21,24 @@ export class DeviceService { private config: JSONObject; private context: PluginContext; + private decoders: Map; + get sdk(): EmbeddedSDK { return this.context.accessors.sdk; } - constructor(config: JSONObject, context: PluginContext) { + constructor(config: JSONObject, context: PluginContext, decoders: Map) { this.config = config; this.context = context; + + this.decoders = decoders; } - async mAttach (devices: Device[], bulkData: DeviceBulkContent[], { strict }): Promise { + async mAttach ( + devices: Device[], + bulkData: DeviceBulkContent[], + { strict, options }: { strict?: boolean, options?: JSONObject } + ): Promise { const attachedDevices = devices.filter(device => device._source.tenantId); if (strict && attachedDevices.length > 0) { @@ -64,12 +72,14 @@ export class DeviceService { const updated = await this.sdk.document.mUpdate( this.config.adminIndex, 'devices', - deviceDocuments); + deviceDocuments, + options); await this.sdk.document.mCreate( document.tenantId, 'devices', - deviceDocuments); + deviceDocuments, + options); return { successes: results.successes.concat(updated.successes), @@ -84,8 +94,14 @@ export class DeviceService { return results; } - async mDetach (devices: Device[], bulkData: DeviceBulkContent[], { strict }) { - const detachedDevices = devices.filter(device => !device._source.tenantId || device._source.tenantId === null); + async mDetach ( + devices: Device[], + bulkData: DeviceBulkContent[], + { strict, options }: { strict?: boolean, options?: JSONObject } + ) { + const detachedDevices = devices.filter(device => { + return ! device._source.tenantId || device._source.tenantId === null + }); if (strict && detachedDevices.length > 0) { const ids = detachedDevices.map(device => device._id).join(',') @@ -115,7 +131,7 @@ export class DeviceService { for (let i = 0; i < documents.length; i++) { const document = documents[i]; - const devicesContent = devices.filter(device => document.deviceIds.includes(device._id)); + const devicesContent = devices.filter(({ _id }) => document.deviceIds.includes(_id)); const deviceDocuments = devicesContent.map(device => { return { _id: device._id, body: { tenantId: null } } }) @@ -127,12 +143,14 @@ export class DeviceService { const updated = await this.sdk.document.mUpdate( this.config.adminIndex, 'devices', - deviceDocuments); + deviceDocuments, + options); await this.sdk.document.mDelete( document.tenantId, 'devices', - deviceDocuments.map(device => device._id)); + deviceDocuments.map(device => device._id), + options); return { successes: results.successes.concat(updated.successes), @@ -147,8 +165,14 @@ export class DeviceService { return results; } - async mLink (devices: Device[], bulkData: DeviceBulkContent[], decoders: Map, { strict }) { - const detachedDevices = devices.filter(device => !device._source.tenantId || device._source.tenantId === null); + async mLink ( + devices: Device[], + bulkData: DeviceBulkContent[], + { strict, options }: { strict?: boolean, options?: JSONObject } + ) { + const detachedDevices = devices.filter(device => { + return ! device._source.tenantId || device._source.tenantId === null + }); if (strict && detachedDevices.length > 0) { const ids = detachedDevices.map(device => device._id).join(',') @@ -174,17 +198,17 @@ export class DeviceService { document.tenantId, 'assets', document.assetIds); - + if (strict && existingAssets.errors.length > 0) { throw new NotFoundError(`Assets "${existingAssets.errors}" do not exist`); } - const devicesContent = devices.filter(device => document.deviceIds.includes(device._id)); + const devicesContent = devices.filter(({ _id }) => document.deviceIds.includes(_id)); const deviceDocuments = []; const assetDocuments = []; for (const device of devicesContent) { - const decoder = decoders.get(device._source.model); + const decoder = this.decoders.get(device._source.model); const measures = await decoder.copyToAsset(device); const { assetId } = bulkData.find(data => data.deviceId === device._id) @@ -199,12 +223,14 @@ export class DeviceService { const updated = await this.sdk.document.mUpdate( this.config.adminIndex, 'devices', - deviceDocuments); - + deviceDocuments, + options); + await this.sdk.document.mUpdate( document.tenantId, 'devices', - deviceDocuments); + deviceDocuments, + options); return { successes: results.successes.concat(updated.successes), @@ -219,7 +245,8 @@ export class DeviceService { const updated = await this.sdk.document.mUpdate( document.tenantId, 'assets', - assetDocuments); + assetDocuments, + options); return { successes: results.successes.concat(updated.successes), @@ -235,29 +262,104 @@ export class DeviceService { return results; } - async unlink (device: Device) { - if (! device._source.assetId) { - throw new BadRequestError(`Device "${device._id}" is not linked to an asset`); + async mUnlink ( + devices: Device[], + { strict, options }: { strict?: boolean, options?: JSONObject } + ) { + const unlinkedDevices = devices.filter(device => !device._source.assetId); + + if (strict && unlinkedDevices.length > 0) { + const ids = unlinkedDevices.map(d => d._id); + throw new BadRequestError(`Devices "${ids}" are not linked to an asset`); + } + + + const builder = devices.map(device => { + const { _id, _source } = device; + return { tenantId: _source.tenantId, deviceId: _id, assetId: _source.assetId }; + }); + + const documents = this.buildBulkDevices(builder); + + const results = { + errors: [], + successes: [], + }; + + for (let i = 0; i < documents.length; i++) { + const document = documents[i]; + + const devicesContent = devices.filter(({ _id }) => document.deviceIds.includes(_id)); + const deviceDocuments = []; + const assetDocuments = []; + + for (const device of devicesContent) { + deviceDocuments.push({ _id: device._id, body: { assetId: null } }); + + const measures = await this.eraseAssetMeasure(document.tenantId, device); + + assetDocuments.push({ _id: device._source.assetId, body: { measures } }); + } + + const updatedDevice = await this.writeToDatabase( + deviceDocuments, + async (deviceDocuments: DeviceMRequestContent[]): Promise => { + const updated = await this.sdk.document.mUpdate( + this.config.adminIndex, + 'devices', + deviceDocuments, + options); + + await this.sdk.document.mUpdate( + document.tenantId, + 'devices', + deviceDocuments, + options); + + return { + successes: results.successes.concat(updated.successes), + errors: results.errors.concat(updated.errors) + } + }) + + const updatedAssets = await this.writeToDatabase( + assetDocuments, + async (assetDocuments: DeviceMRequestContent[]): Promise => { + + const updated = await this.sdk.document.mUpdate( + document.tenantId, + 'assets', + assetDocuments, + options); + + return { + successes: results.successes.concat(updated.successes), + errors: results.errors.concat(updated.errors) + } + } + ) + + results.successes.concat(updatedDevice.successes, updatedAssets.successes); + results.errors.concat(updatedDevice.errors, updatedDevice.errors); } - await this.sdk.document.update( - this.config.adminIndex, - 'devices', - device._id, - { assetId: null }); - - await this.sdk.document.update( - device._source.tenantId, - 'devices', - device._id, - { assetId: null }); - - // @todo only remove the measures coming from the unlinked device - await this.sdk.document.update( - device._source.tenantId, + return results; + } + + private async eraseAssetMeasure (tenantId: string, device: Device) { + const { _source: { measures } } = await this.sdk.document.get( + tenantId, 'assets', - device._source.assetId, - { measures: null }); + device._source.assetId); + + + for (const [measureName] of Object.entries(device._source.measures)) { + if (measures[measureName]) { + measures[measureName] = undefined; + } + } + + return measures; } private async tenantExists (tenantId: string) { @@ -287,7 +389,10 @@ export class DeviceService { return documents; } - private formatDevicesContent (devices: Device[], document: DeviceBulkBuildedContent): DeviceMRequestContent[] { + private formatDevicesContent ( + devices: Device[], + document: DeviceBulkBuildedContent + ): DeviceMRequestContent[] { const devicesContent = devices.filter(device => document.deviceIds.includes(device._id)); const devicesDocuments = devicesContent.map(device => { device._source.tenantId = document.tenantId; @@ -297,7 +402,10 @@ export class DeviceService { return devicesDocuments; } - private async writeToDatabase (deviceDocuments: DeviceMRequestContent[], writer: (deviceDocuments: DeviceMRequestContent[]) => Promise) { + private async writeToDatabase ( + deviceDocuments: DeviceMRequestContent[], + writer: (deviceDocuments: DeviceMRequestContent[]) => Promise + ) { const results = { errors: [], successes: [], @@ -319,7 +427,7 @@ export class DeviceService { results.successes.push(successes); results.errors.push(errors); - } + }; let offset = 0; let offsetLimit = limit; diff --git a/lib/services/EngineService.ts b/lib/services/EngineService.ts index 0f41df8f..dfa9a2e2 100644 --- a/lib/services/EngineService.ts +++ b/lib/services/EngineService.ts @@ -30,11 +30,13 @@ export class EngineService { } } - async create (index: string) { + async create (index: string, tenantGroup = 'shared') { const promises = []; - const templates = this.config.collections; + const templates = this.config.mappings.get(tenantGroup) + ? this.config.mappings.get(tenantGroup) + : this.config.mappings.get('shared'); + const collections = []; - for (const [collection, mappings] of Object.entries(templates)) { promises.push( this.sdk.collection.create(index, collection, { mappings }) @@ -56,7 +58,7 @@ export class EngineService { async update (index: string) { const promises = []; - const templates = this.config.collections; + const templates = this.config.mappings.get('shared'); const collections = []; await this.hasEngine(index); @@ -74,7 +76,7 @@ export class EngineService { async delete (index: string) { const promises = []; - const templates = Object.keys(this.config.collections); + const templates = Object.keys(this.config.mappings.get('shared')); const collections = []; await this.hasEngine(index); diff --git a/package-lock.json b/package-lock.json index 5fda7b24..a2321ce0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "kuzzle-plugin-device-manager", - "version": "1.0.0", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "1.0.0", + "version": "0.2.0", "license": "Apache-2.0", "dependencies": { "csvtojson": "~2.0.10", @@ -19,7 +19,7 @@ "eslint": "^7.21.0", "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^4.0.2", - "kuzzle": "^2.10.3", + "kuzzle": "^2.11.1", "kuzzle-sdk": "^7.5.6", "lodash": "^4.17.21", "mocha": "^8.3.0", @@ -33,7 +33,7 @@ "typescript": "^4.2.3" }, "peerDependencies": { - "kuzzle": "^2.10.3" + "kuzzle": "^2.10.4" } }, "node_modules/@babel/code-frame": { @@ -106,22 +106,54 @@ "kuler": "^2.0.0" } }, + "node_modules/@elastic/ecs-helpers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@elastic/ecs-helpers/-/ecs-helpers-1.1.0.tgz", + "integrity": "sha512-MDLb2aFeGjg46O5mLpdCzT5yOUDnXToJSrco2ShqGIXxNJaM8uJjX+4nd+hRYV4Vex8YJyDtOFEVBldQct6ndg==", + "dev": true, + "optional": true, + "dependencies": { + "fast-json-stringify": "^2.4.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@elastic/ecs-pino-format": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@elastic/ecs-pino-format/-/ecs-pino-format-1.1.1.tgz", + "integrity": "sha512-I7SzS0JYA8tdfsw4aTR+33HWWCaU7QY759kzt4sXm+O1waILaUWMzW3C2RL0ihQ66M99t+XMhRrA4cKStkHNXg==", + "dev": true, + "optional": true, + "dependencies": { + "@elastic/ecs-helpers": "^1.1.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@elastic/elasticsearch": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-7.11.0.tgz", - "integrity": "sha512-AFVVuANIdbV1qYjuOi4hnsX/DehWYG+bbhQO4amq9K4/NnzU7mpGWOPgVlRQTiX+vBfBkx7SL6h4QEjIlM3ztA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-7.12.0.tgz", + "integrity": "sha512-GquUEytCijFRPEk3DKkkDdyhspB3qbucVQOwih9uNyz3iz804I+nGBUsFo2LwVvLQmQfEM0IY2+yoYfEz5wMug==", "dev": true, "dependencies": { - "debug": "^4.1.1", + "debug": "^4.3.1", "hpagent": "^0.1.1", - "ms": "^2.1.1", + "ms": "^2.1.3", "pump": "^3.0.0", - "secure-json-parse": "^2.1.0" + "secure-json-parse": "^2.3.1" }, "engines": { - "node": ">=8" + "node": ">=10" } }, + "node_modules/@elastic/elasticsearch/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "node_modules/@eslint/eslintrc": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.0.tgz", @@ -177,6 +209,70 @@ "node": ">= 8" } }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", + "dev": true + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "dev": true + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", + "dev": true + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", + "dev": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", + "dev": true + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", + "dev": true + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", + "dev": true + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", + "dev": true + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", + "dev": true + }, "node_modules/@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -239,6 +335,12 @@ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", "dev": true }, + "node_modules/@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==", + "dev": true + }, "node_modules/@types/node": { "version": "14.14.31", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", @@ -762,12 +864,15 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, - "node_modules/await-event": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/await-event/-/await-event-2.1.0.tgz", - "integrity": "sha1-eOn5JoS65AIvn6C18xShFVD5qnY=", + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", "dev": true, - "optional": true + "optional": true, + "engines": { + "node": ">=8.0.0" + } }, "node_modules/aws-sign2": { "version": "0.7.0", @@ -886,6 +991,7 @@ "resolved": "https://registry.npmjs.org/boost-geospatial-index/-/boost-geospatial-index-1.1.0.tgz", "integrity": "sha512-ucul2dJYmpFBaKRgHQqQ9xHuzoV7aTO9W4LcA02NWgiy8E74xShgKEhiS9hjPdvfZwO5n1J1bsiPHOflq1411g==", "dev": true, + "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", "nan": "^2.14.0" @@ -1097,15 +1203,6 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "node_modules/bufferutil": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.3.tgz", - "integrity": "sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw==", - "dev": true, - "dependencies": { - "node-gyp-build": "^4.2.0" - } - }, "node_modules/bulk-write-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/bulk-write-stream/-/bulk-write-stream-2.0.1.tgz", @@ -1116,18 +1213,6 @@ "readable-stream": "^3.1.1" } }, - "node_modules/busboy": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", - "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", - "dev": true, - "dependencies": { - "dicer": "0.3.0" - }, - "engines": { - "node": ">=4.5.0" - } - }, "node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -1176,6 +1261,9 @@ "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/callsites": { @@ -1609,7 +1697,8 @@ "version": "3.7.0", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.7.0.tgz", "integrity": "sha512-EZD2ckZysv8MMt4J6HSvS9K2GdtlZtdBncKAmF9lr2n0c9dJUaUN88PSTjvgwCgQPWKTkERXITgS6JJRAnljtg==", - "dev": true + "dev": true, + "hasInstallScript": true }, "node_modules/core-util-is": { "version": "1.0.2", @@ -1748,15 +1837,20 @@ "dev": true }, "node_modules/debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "dependencies": { "ms": "2.1.2" }, "engines": { "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/decamelize": { @@ -1768,18 +1862,6 @@ "node": ">=10" } }, - "node_modules/decompress-response": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "dev": true, - "dependencies": { - "mimic-response": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -1795,6 +1877,16 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", @@ -1850,18 +1942,6 @@ "node": ">=0.10" } }, - "node_modules/dicer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", - "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", - "dev": true, - "dependencies": { - "streamsearch": "0.1.2" - }, - "engines": { - "node": ">=4.5.0" - } - }, "node_modules/didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -1918,6 +1998,7 @@ "resolved": "https://registry.npmjs.org/dumpme/-/dumpme-1.0.3.tgz", "integrity": "sha512-OKsH4VcOq5GopNwEo6Qb6KwtPFZ3mo7m1nutcQcN4VXhGxlZ/3xhfy2kKmx5cpqdN59uqIKWMXA+mw0y8PgKQg==", "dev": true, + "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", "nan": "^2.14.0" @@ -1963,9 +2044,9 @@ } }, "node_modules/elastic-apm-http-client": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-9.6.0.tgz", - "integrity": "sha512-uITnqWbl2HdJpEAmuy+eAxHjAdx7xvQun96uUDxIL701ggK11HK8Z8akKqtTOj/sxzuqJTUUDiUJS/qV74dqJA==", + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-9.8.0.tgz", + "integrity": "sha512-JrlQbijs4dY8539zH+QNKLqLDCNyNymyy720tDaj+/i5pcwWYz5ipPARAdrKkor56AmKBxib8Fd6KsSWtIYjcA==", "dev": true, "optional": true, "dependencies": { @@ -1974,7 +2055,7 @@ "end-of-stream": "^1.4.4", "fast-safe-stringify": "^2.0.7", "fast-stream-to-buffer": "^1.0.0", - "pump": "^3.0.0", + "object-filter-sequence": "^1.0.0", "readable-stream": "^3.4.0", "stream-chopper": "^3.0.1", "unicode-byte-truncate": "^1.0.0" @@ -1984,34 +2065,33 @@ } }, "node_modules/elastic-apm-node": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/elastic-apm-node/-/elastic-apm-node-3.12.1.tgz", - "integrity": "sha512-HUVEECspvN6SpFIRZdLnMTnS1vIi5nLR4/j3KoWvgofjCqXtjKMgMnYiwmvd/NpZjS1IGZR+qpAEOyjqv0hk7Q==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/elastic-apm-node/-/elastic-apm-node-3.14.0.tgz", + "integrity": "sha512-B7Xkz6UL44mm+2URdZy2yxpEB2C5CvZLOP3sGpf2h/hepXr4NgrVoRxGqO1F2b2wCB48smPv4a3v35b396VSwA==", "dev": true, "optional": true, "dependencies": { + "@elastic/ecs-pino-format": "^1.1.0", "after-all-results": "^2.0.0", "async-value-promise": "^1.1.1", "basic-auth": "^2.0.1", - "console-log-level": "^1.4.1", "cookie": "^0.4.0", "core-util-is": "^1.0.2", - "elastic-apm-http-client": "^9.5.1", + "elastic-apm-http-client": "^9.8.0", "end-of-stream": "^1.4.4", "error-stack-parser": "^2.0.6", "escape-string-regexp": "^4.0.0", "fast-safe-stringify": "^2.0.7", "http-headers": "^3.0.2", - "http-request-to-url": "^1.0.0", "is-native": "^1.0.1", "measured-reporting": "^1.51.1", "monitor-event-loop-delay": "^1.0.0", "object-filter-sequence": "^1.0.0", "object-identity-map": "^1.0.2", "original-url": "^1.2.3", + "pino": "^6.11.2", "read-pkg-up": "^7.0.1", "relative-microtime": "^2.0.0", - "require-ancestors": "^1.0.0", "require-in-the-middle": "^5.0.3", "semver": "^6.3.0", "set-cookie-serde": "^1.0.0", @@ -2034,6 +2114,9 @@ "optional": true, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/elastic-apm-node/node_modules/semver": { @@ -2156,6 +2239,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es-to-primitive": { @@ -2171,6 +2257,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/es5-ext": { @@ -2622,6 +2711,7 @@ "resolved": "https://registry.npmjs.org/espresso-logic-minimizer/-/espresso-logic-minimizer-2.0.3.tgz", "integrity": "sha512-aAt/cDIr9UorriIVadPZIOhozHBsWwWEaJj18zzkNJsPgxPOFWP5SSiw5ZJt4J+l60+qQr5yehXdF/DKGg7+Mg==", "dev": true, + "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", "debug": "^4.1.1", @@ -2734,15 +2824,6 @@ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/ext": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", @@ -2816,12 +2897,38 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fast-json-stringify": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.7.3.tgz", + "integrity": "sha512-QNIh4CQ5S3D5vO7Bv88Si8TFQGZgxv15h2n/79TESr4lhZ8ptq3R9SCTteslr+pwrZQlvrAFgcXgFuUIgS3UQA==", + "dev": true, + "optional": true, + "dependencies": { + "ajv": "^6.11.0", + "deepmerge": "^4.2.2", + "rfdc": "^1.2.0", + "string-similarity": "^4.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "node_modules/fast-redact": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.1.tgz", + "integrity": "sha512-kYpn4Y/valC9MdrISg47tZOpYBNoTXKgT9GYXFpHN/jYFs+lFkPoisY+LcBODdKVMY96ATzvzsWv+ES/4Kmufw==", + "dev": true, + "optional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/fast-safe-stringify": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", @@ -2876,9 +2983,9 @@ "dev": true }, "node_modules/fecha": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.0.tgz", - "integrity": "sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", + "integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==", "dev": true }, "node_modules/figures": { @@ -2982,6 +3089,13 @@ "node": ">=4" } }, + "node_modules/flatstr": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", + "dev": true, + "optional": true + }, "node_modules/flatted": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", @@ -3064,12 +3178,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -3206,6 +3314,9 @@ "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/get-stream": { @@ -3238,12 +3349,6 @@ "gherkin-javascript": "bin/gherkin" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", - "dev": true - }, "node_modules/glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -3444,7 +3549,10 @@ "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", "dev": true, - "optional": true + "optional": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/has-flag": { "version": "3.0.0", @@ -3463,6 +3571,9 @@ "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-unicode": { @@ -3490,9 +3601,9 @@ } }, "node_modules/hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true, "optional": true }, @@ -3518,17 +3629,6 @@ "next-line": "^1.1.0" } }, - "node_modules/http-request-to-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-request-to-url/-/http-request-to-url-1.0.0.tgz", - "integrity": "sha512-YYx0lKXG9+T1fT2q3ZgXLczMI3jW09g9BvIA6L3BG0tFqGm83Ka/+RUZGANRG7Ut/yueD7LPcZQ/+pA5ndNajw==", - "dev": true, - "optional": true, - "dependencies": { - "await-event": "^2.1.0", - "socket-location": "^1.0.0" - } - }, "node_modules/http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -3765,9 +3865,9 @@ } }, "node_modules/ioredis": { - "version": "4.24.2", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.24.2.tgz", - "integrity": "sha512-SSuVXwoG747sZetxxs9gyAno5kfUfvo4s5mSZp4dh8vzuTnrtA5mTf2OjL6sPfIfNbVTROg2c+VbXceGlpucPQ==", + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.27.2.tgz", + "integrity": "sha512-7OpYymIthonkC2Jne5uGWXswdhlua1S1rWGAERaotn0hGJWTSURvxdHA9G6wNbT/qKCloCja/FHsfKXW8lpTmg==", "dev": true, "dependencies": { "cluster-key-slot": "^1.1.0", @@ -3783,18 +3883,10 @@ }, "engines": { "node": ">=6" - } - }, - "node_modules/ioredis/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" }, - "engines": { - "node": ">=6.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ioredis" } }, "node_modules/ip": { @@ -3810,11 +3902,14 @@ "dev": true }, "node_modules/is-bigint": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", - "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz", + "integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==", "dev": true, - "optional": true + "optional": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/is-binary-path": { "version": "2.1.0", @@ -3839,6 +3934,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-callable": { @@ -3849,6 +3947,9 @@ "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-ci": { @@ -3873,13 +3974,16 @@ } }, "node_modules/is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.3.tgz", + "integrity": "sha512-tDpEUInNcy2Yw3lNSepK3Wdw1RnXLcIVienz6Ou631Acl15cJyRWK4dgA1vCmOEgIbtOV0W7MHg+AR2Gdg1NXQ==", "dev": true, "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-extglob": { @@ -3899,6 +4003,9 @@ "optional": true, "engines": { "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-fullwidth-code-point": { @@ -3970,6 +4077,9 @@ "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-nil": { @@ -4005,6 +4115,9 @@ "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-obj": { @@ -4052,6 +4165,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-stream": { @@ -4071,6 +4187,9 @@ "optional": true, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-symbol": { @@ -4084,6 +4203,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-typedarray": { @@ -4244,10 +4366,7 @@ "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", - "dev": true, - "engines": { - "node": "*" - } + "dev": true }, "node_modules/jsonwebtoken": { "version": "8.5.1", @@ -4376,16 +4495,14 @@ "dev": true }, "node_modules/kuzzle": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/kuzzle/-/kuzzle-2.10.3.tgz", - "integrity": "sha512-cG5LjjR6mJKWE7X3eOB6Xp9amcpW4SDtHRt2ekkvyNiC+PC976H9dkGBh7Hqts2o3qTmsP4VVfdBL6MUfHxnhg==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/kuzzle/-/kuzzle-2.11.2.tgz", + "integrity": "sha512-98jtyEa26s5rdZZBry7Oaf39QNDoFiG67V0ZD31Exb0iXipHe7Ys/NVUpPnfYhR5NsvraACUfaMfnLi/DmqCQg==", "dev": true, "dependencies": { - "@elastic/elasticsearch": "^7.11.0", + "@elastic/elasticsearch": "^7.12.0", "aedes": "^0.45.0", "bluebird": "^3.7.2", - "bufferutil": "^4.0.3", - "busboy": "^0.3.1", "cli-color": "^2.0.0", "cookie": "^0.4.1", "debug": "^4.3.1", @@ -4394,34 +4511,35 @@ "dumpme": "^1.0.3", "eventemitter3": "^4.0.7", "inquirer": "^8.0.0", - "ioredis": "^4.23.0", + "ioredis": "^4.26.0", "ip": "^1.1.5", "json-stable-stringify": "^1.0.1", "json2yaml": "^1.1.0", "jsonwebtoken": "^8.5.1", "koncorde": "^3.0.0", "kuzzle-plugin-auth-passport-local": "^6.2.0", - "kuzzle-plugin-logger": "^3.0.2", - "kuzzle-sdk": "7.5.6", + "kuzzle-plugin-logger": "^3.0.3", + "kuzzle-sdk": "7.6.1", "kuzzle-vault": "^2.0.4", "lodash": "4.17.21", + "long": "^4.0.0", "moment": "^2.29.1", "ms": "^2.1.3", "murmurhash-native": "^3.5.0", "passport": "^0.4.1", + "protobufjs": "~6.10.2", "rc": "1.2.8", - "semver": "^7.3.4", + "semver": "^7.3.5", "sorted-array": "^2.0.4", - "utf-8-validate": "^5.0.4", "uuid": "^8.3.2", + "uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v18.14.0.tar.gz", "validator": "^13.5.2", "winston": "^3.3.3", - "winston-elasticsearch": "0.15.2", + "winston-elasticsearch": "0.15.4", "winston-syslog": "^2.4.4", "winston-transport": "^4.4.0", - "ws": "^7.4.4", "yargs": "^16.2.0", - "zeromq": "^5.2.0" + "zeromq": "^6.0.0-beta.6" }, "bin": { "kuzzle": "bin/start-kuzzle-server" @@ -4861,9 +4979,9 @@ } }, "node_modules/kuzzle-plugin-logger": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/kuzzle-plugin-logger/-/kuzzle-plugin-logger-3.0.2.tgz", - "integrity": "sha512-hmvPAn6/E3vE5t2PQpDITKPhQevuEe1kHGF9LLoX/sqkCTfKKVJazgyEk2Y4XiIHL3Fcfue9YJC8UEdXGjJHdQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kuzzle-plugin-logger/-/kuzzle-plugin-logger-3.0.3.tgz", + "integrity": "sha512-lXnm+oJS75FQALrYa41I5T9ZRywjy05/mZ1crD/ZZj4JNOgcKjWo+mEwLGR0lSNFX9bonmj1kPIYIPgWZ1wy6w==", "dev": true, "dependencies": { "moment": "^2.29.1", @@ -4877,13 +4995,13 @@ } }, "node_modules/kuzzle-sdk": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.5.6.tgz", - "integrity": "sha512-yDFusdiTLU921dgBAEEaA6cS84oYrs1OympSPBk/fuZCwWl0eDoVQaBEtBJSN1dI3kmi1+iKkrjHpjYsrmRJxQ==", + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.6.1.tgz", + "integrity": "sha512-cSLvvuy6nu3Ra5EtZd+5+c8aFEgFBmjlZV6c9n/4GyGYSyOCTPvWWZ4tKBKaD6N9L1jsi+1acyUjKrzxr/xY8Q==", "dev": true, "dependencies": { "min-req-promise": "^1.0.1", - "ws": "^7.4.2" + "ws": "^7.4.4" }, "engines": { "node": ">= 10.13.0" @@ -4907,24 +5025,6 @@ "node": ">=8" } }, - "node_modules/kuzzle/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/kuzzle/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/kuzzle/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -5008,15 +5108,6 @@ "node": ">=8" } }, - "node_modules/kuzzle/node_modules/ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", - "dev": true, - "engines": { - "node": ">=8.3.0" - } - }, "node_modules/latest-version": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", @@ -5193,6 +5284,12 @@ "triple-beam": "^1.3.0" } }, + "node_modules/long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "dev": true + }, "node_modules/lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -5376,15 +5473,6 @@ "node": ">=6" } }, - "node_modules/mimic-response": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", - "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/min-req-promise": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-req-promise/-/min-req-promise-1.0.1.tgz", @@ -5446,12 +5534,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, "node_modules/mocha": { "version": "8.3.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.1.tgz", @@ -5498,24 +5580,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/mocha/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - } - }, - "node_modules/mocha/node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, "node_modules/mocha/node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -5720,6 +5784,7 @@ "resolved": "https://registry.npmjs.org/murmurhash-native/-/murmurhash-native-3.5.0.tgz", "integrity": "sha512-FRBbK08EU75KkdvnFeSPWbmvLQsVZiUU5EDBEd4937B4Yw9cjVXbHMRtu1KcBFaAk5AxR0KzuBqOy1wWTzoO4Q==", "dev": true, + "hasInstallScript": true, "dependencies": { "nan": "^2.14.1", "node-pre-gyp": "^0.14.0" @@ -5763,12 +5828,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", - "dev": true - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -5851,24 +5910,6 @@ "lower-case": "^1.1.1" } }, - "node_modules/node-abi": { - "version": "2.21.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.21.0.tgz", - "integrity": "sha512-smhrivuPqEM3H5LmnY3KU6HfYv0u4QklgAxfFyRNujKUzbUcYZ+Jc2EhukB9SRcD2VpqhxM7n/MIcp1Ua1/JMg==", - "dev": true, - "dependencies": { - "semver": "^5.4.1" - } - }, - "node_modules/node-abi/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/node-gyp": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz", @@ -6062,6 +6103,7 @@ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.7.tgz", "integrity": "sha512-XHzK69Awgnec9UzHr1kc8EomQh4sjTQ8oRf8TsGrSmHDx9/UmiGG9E/mM3BuTfNeFwdNBvrqQq/RHL0xIeyFOA==", "dev": true, + "hasInstallScript": true, "dependencies": { "chokidar": "^3.2.2", "debug": "^3.2.6", @@ -6099,12 +6141,6 @@ "semver": "bin/semver" } }, - "node_modules/noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", - "dev": true - }, "node_modules/nopt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", @@ -6257,11 +6293,14 @@ } }, "node_modules/object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.2.tgz", + "integrity": "sha512-gz58rdPpadwztRrPjZE9DZLOABUpTGdcANUgOwBFO1C+HZZhePoP83M65WGDmbpwFYJSWqavbl4SgDn4k8RYTA==", "dev": true, - "optional": true + "optional": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/object-keys": { "version": "1.1.1", @@ -6287,6 +6326,9 @@ }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/object.entries": { @@ -6510,6 +6552,9 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/passport": { @@ -6630,6 +6675,31 @@ "node": ">=8.6" } }, + "node_modules/pino": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/pino/-/pino-6.11.3.tgz", + "integrity": "sha512-drPtqkkSf0ufx2gaea3TryFiBHdNIdXKf5LN0hTM82SXI4xVIve2wLwNg92e1MT6m3jASLu6VO7eGY6+mmGeyw==", + "dev": true, + "optional": true, + "dependencies": { + "fast-redact": "^3.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^3.1.0", + "quick-format-unescaped": "^4.0.3", + "sonic-boom": "^1.0.2" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-std-serializers": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==", + "dev": true, + "optional": true + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -6642,35 +6712,6 @@ "node": ">=8" } }, - "node_modules/prebuild-install": { - "version": "5.3.6", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.6.tgz", - "integrity": "sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg==", - "dev": true, - "dependencies": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.7.0", - "noop-logger": "^0.1.1", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0", - "which-pm-runs": "^1.0.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -6713,6 +6754,38 @@ "asap": "~2.0.6" } }, + "node_modules/protobufjs": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", + "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": "^13.7.0", + "long": "^4.0.0" + }, + "bin": { + "pbjs": "bin/pbjs", + "pbts": "bin/pbts" + } + }, + "node_modules/protobufjs/node_modules/@types/node": { + "version": "13.13.51", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.51.tgz", + "integrity": "sha512-66/xg5I5Te4oGi5Jws11PtNmKkZbOPZWyBZZ/l5AOrWj1Dyw+6Ge/JhYTq/2/Yvdqyhrue8RL+DGI298OJ0xcg==", + "dev": true + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -6787,6 +6860,13 @@ "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", "dev": true }, + "node_modules/quick-format-unescaped": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.3.tgz", + "integrity": "sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==", + "dev": true, + "optional": true + }, "node_modules/random-poly-fill": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/random-poly-fill/-/random-poly-fill-1.0.1.tgz", @@ -6832,6 +6912,7 @@ "resolved": "https://registry.npmjs.org/re2/-/re2-1.15.9.tgz", "integrity": "sha512-AXWEhpMTBdC+3oqbjdU07dk0pBCvxh5vbOMLERL6Y8FYBSGn4vXlLe8cYszn64Yy7H8keVMrgPzoSvOd4mePpg==", "dev": true, + "hasInstallScript": true, "dependencies": { "install-artifact-from-github": "^1.2.0", "nan": "^2.14.2", @@ -6867,6 +6948,9 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/read-pkg-up/node_modules/type-fest": { @@ -7088,13 +7172,6 @@ "uuid": "bin/uuid" } }, - "node_modules/require-ancestors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/require-ancestors/-/require-ancestors-1.0.0.tgz", - "integrity": "sha512-Nqeo9Gfp0KvnxTixnxLGEbThMAi+YYgnwRoigtOs1Oo3eGBYfqCd3dagq1vBCVVuc1EnIt3Eu1eGemwOOEZozw==", - "dev": true, - "optional": true - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7457,6 +7534,13 @@ "which": "bin/which" } }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true, + "optional": true + }, "node_modules/rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -7532,9 +7616,9 @@ } }, "node_modules/secure-json-parse": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.3.2.tgz", - "integrity": "sha512-4oUSFU0w2d8/XQb7NO9dbMYyp/hxIwZPcZcGAlAAEziMRHs+NbUcx2Z5dda/z8o+avyQ8gpuYnTMlGh8SVwg9g==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==", "dev": true }, "node_modules/seed-random": { @@ -7544,9 +7628,9 @@ "dev": true }, "node_modules/semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "dependencies": { "lru-cache": "^6.0.0" @@ -7713,23 +7797,6 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true - }, - "node_modules/simple-get": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", - "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", - "dev": true, - "dependencies": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -7797,14 +7864,15 @@ "node": ">=6" } }, - "node_modules/socket-location": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/socket-location/-/socket-location-1.0.0.tgz", - "integrity": "sha512-TwxpRM0pPE/3b24XQGLx8zq2J8kOwTy40FtiNC1KrWvl/Tsf7RYXruE9icecMhQwicXMo/HUJlGap8DNt2cgYw==", + "node_modules/sonic-boom": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", + "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", "dev": true, "optional": true, "dependencies": { - "await-event": "^2.1.0" + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" } }, "node_modules/sorted-array": { @@ -7912,11 +7980,6 @@ "safer-buffer": "^2.0.2", "tweetnacl": "~0.14.0" }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, "engines": { "node": ">=0.10.0" } @@ -8002,15 +8065,6 @@ "readable-stream": "^3.0.6" } }, - "node_modules/streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -8029,6 +8083,13 @@ "node": ">=0.6.19" } }, + "node_modules/string-similarity": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==", + "dev": true, + "optional": true + }, "node_modules/string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -8051,6 +8112,9 @@ "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { @@ -8062,6 +8126,9 @@ "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/strip-ansi": { @@ -8176,34 +8243,6 @@ "node": ">=4.5" } }, - "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dev": true, - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/tar/node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -8343,9 +8382,6 @@ }, "bin": { "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" } }, "node_modules/tough-cookie": { @@ -8502,16 +8538,19 @@ } }, "node_modules/unbox-primitive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", - "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", "dev": true, "optional": true, "dependencies": { "function-bind": "^1.1.1", - "has-bigints": "^1.0.0", - "has-symbols": "^1.0.0", - "which-boxed-primitive": "^1.0.1" + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/undefsafe": { @@ -8582,6 +8621,7 @@ "resolved": "https://registry.npmjs.org/unix-dgram/-/unix-dgram-2.0.3.tgz", "integrity": "sha512-Bay5CkSLcdypcBCsxvHEvaG3mftzT5FlUnRToPWEAVxwYI8NI/8zSJ/Gknlp86MPhV6hBA8I8TBsETj2tssoHQ==", "dev": true, + "hasInstallScript": true, "optional": true, "dependencies": { "bindings": "^1.3.0", @@ -8706,15 +8746,6 @@ "node": ">=4" } }, - "node_modules/utf-8-validate": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.4.tgz", - "integrity": "sha512-MEF05cPSq3AwJ2C7B7sHAA6i53vONoZbMGX8My5auEVm6W+dJ2Jd/TZPyGJ5CH42V2XtbI5FD28HeHeqlPzZ3Q==", - "dev": true, - "dependencies": { - "node-gyp-build": "^4.2.0" - } - }, "node_modules/util-arity": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/util-arity/-/util-arity-1.1.0.tgz", @@ -8741,6 +8772,12 @@ "integrity": "sha512-OdmXxA8rDsQ7YpNVbKSJkNzTw2I+S5WsbMDnCtIWSQaosNAcWtFuI/YK1TjzUI6nbkgiqEyh8gWngfcv8Asd9A==", "dev": true }, + "node_modules/uWebSockets.js": { + "version": "18.14.0", + "resolved": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v18.14.0.tar.gz", + "integrity": "sha512-1YaUwux9uJIlvtczyWKuD+MtgF0ors71SGicvjYpOAN5d4SW11YXuxY5R3UD9M94xZbVEScgY/2Eyy+Pe6A+Lw==", + "dev": true + }, "node_modules/v8-compile-cache": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", @@ -8808,14 +8845,11 @@ "is-number-object": "^1.0.4", "is-string": "^1.0.5", "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true - }, "node_modules/wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -8908,12 +8942,12 @@ } }, "node_modules/winston-elasticsearch": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.15.2.tgz", - "integrity": "sha512-7v1D94cv1e0bNSbMUS0sQBxw+esJZ3XQOMjrRSXgqLk6BMUIkTgQXwCoUlBIcF/tfwPi+zgZsL9RwDwzDM+tbA==", + "version": "0.15.4", + "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.15.4.tgz", + "integrity": "sha512-MtGqVILFzj3P8hWTIQvoT6baeslRwi8/U8y5mr7BSOpRynYejILpFhcfuGsnAvgIKAKBRUzOsDHJMGakJlpsKA==", "dev": true, "dependencies": { - "@elastic/elasticsearch": "^7.11.0", + "@elastic/elasticsearch": "^7.12.0", "dayjs": "^1.10.4", "debug": "^4.3.1", "lodash.defaults": "^4.2.0", @@ -8930,18 +8964,6 @@ "elastic-apm-node": "^3.9.0" } }, - "node_modules/winston-elasticsearch/node_modules/debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - } - }, "node_modules/winston-syslog": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/winston-syslog/-/winston-syslog-2.4.4.tgz", @@ -8955,6 +8977,9 @@ }, "optionalDependencies": { "unix-dgram": "2.0.3" + }, + "peerDependencies": { + "winston": "^3.0.0" } }, "node_modules/winston-transport": { @@ -9140,12 +9165,24 @@ } }, "node_modules/ws": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", - "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", + "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", "dev": true, "engines": { "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/xdg-basedir": { @@ -9319,16 +9356,16 @@ } }, "node_modules/zeromq": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/zeromq/-/zeromq-5.2.0.tgz", - "integrity": "sha512-qsckhCmrg6et6zrAJytC971SSN/4iLxKgkXK1Wqn2Gij5KXMY+TA+3cy/iFwehaWdU5usg5HNOOgaBdjSqtCVw==", + "version": "6.0.0-beta.6", + "resolved": "https://registry.npmjs.org/zeromq/-/zeromq-6.0.0-beta.6.tgz", + "integrity": "sha512-wLf6M7pBHijl+BRltUL2VoDpgbQcOZetiX8UzycHL8CcYFxYnRrpoG5fi3UX3+Umavz1lk4/dGaQez8qiDgr/Q==", "dev": true, + "hasInstallScript": true, "dependencies": { - "nan": "^2.14.0", - "prebuild-install": "^5.3.2" + "node-gyp-build": "^4.1.0" }, "engines": { - "node": ">=6.0" + "node": ">= 10.2" } } }, @@ -9399,17 +9436,45 @@ "kuler": "^2.0.0" } }, + "@elastic/ecs-helpers": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@elastic/ecs-helpers/-/ecs-helpers-1.1.0.tgz", + "integrity": "sha512-MDLb2aFeGjg46O5mLpdCzT5yOUDnXToJSrco2ShqGIXxNJaM8uJjX+4nd+hRYV4Vex8YJyDtOFEVBldQct6ndg==", + "dev": true, + "optional": true, + "requires": { + "fast-json-stringify": "^2.4.1" + } + }, + "@elastic/ecs-pino-format": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@elastic/ecs-pino-format/-/ecs-pino-format-1.1.1.tgz", + "integrity": "sha512-I7SzS0JYA8tdfsw4aTR+33HWWCaU7QY759kzt4sXm+O1waILaUWMzW3C2RL0ihQ66M99t+XMhRrA4cKStkHNXg==", + "dev": true, + "optional": true, + "requires": { + "@elastic/ecs-helpers": "^1.1.0" + } + }, "@elastic/elasticsearch": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-7.11.0.tgz", - "integrity": "sha512-AFVVuANIdbV1qYjuOi4hnsX/DehWYG+bbhQO4amq9K4/NnzU7mpGWOPgVlRQTiX+vBfBkx7SL6h4QEjIlM3ztA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-7.12.0.tgz", + "integrity": "sha512-GquUEytCijFRPEk3DKkkDdyhspB3qbucVQOwih9uNyz3iz804I+nGBUsFo2LwVvLQmQfEM0IY2+yoYfEz5wMug==", "dev": true, "requires": { - "debug": "^4.1.1", + "debug": "^4.3.1", "hpagent": "^0.1.1", - "ms": "^2.1.1", + "ms": "^2.1.3", "pump": "^3.0.0", - "secure-json-parse": "^2.1.0" + "secure-json-parse": "^2.3.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + } } }, "@eslint/eslintrc": { @@ -9439,22 +9504,86 @@ "run-parallel": "^1.1.9" } }, - "@nodelib/fs.stat": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=", + "dev": true + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true + }, + "@protobufjs/codegen": { "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", "dev": true }, - "@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=", + "dev": true + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", "dev": true, "requires": { - "@nodelib/fs.scandir": "2.1.4", - "fastq": "^1.6.0" + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" } }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=", + "dev": true + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=", + "dev": true + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=", + "dev": true + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=", + "dev": true + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=", + "dev": true + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -9511,6 +9640,12 @@ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", "dev": true }, + "@types/long": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", + "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==", + "dev": true + }, "@types/node": { "version": "14.14.31", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", @@ -9969,10 +10104,10 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, - "await-event": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/await-event/-/await-event-2.1.0.tgz", - "integrity": "sha1-eOn5JoS65AIvn6C18xShFVD5qnY=", + "atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", "dev": true, "optional": true }, @@ -10256,15 +10391,6 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "bufferutil": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.3.tgz", - "integrity": "sha512-yEYTwGndELGvfXsImMBLop58eaGW+YdONi1fNjTINSY98tmMmFijBG6WXgdkfuLNt4imzQNtIE+eBp1PVpMCSw==", - "dev": true, - "requires": { - "node-gyp-build": "^4.2.0" - } - }, "bulk-write-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/bulk-write-stream/-/bulk-write-stream-2.0.1.tgz", @@ -10275,15 +10401,6 @@ "readable-stream": "^3.1.1" } }, - "busboy": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", - "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", - "dev": true, - "requires": { - "dicer": "0.3.0" - } - }, "cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -10810,9 +10927,9 @@ "dev": true }, "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -10824,15 +10941,6 @@ "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, - "decompress-response": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", - "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", - "dev": true, - "requires": { - "mimic-response": "^2.0.0" - } - }, "deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -10845,6 +10953,13 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "optional": true + }, "defer-to-connect": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", @@ -10885,15 +11000,6 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true }, - "dicer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", - "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", - "dev": true, - "requires": { - "streamsearch": "0.1.2" - } - }, "didyoumean": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.1.tgz", @@ -10979,9 +11085,9 @@ } }, "elastic-apm-http-client": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-9.6.0.tgz", - "integrity": "sha512-uITnqWbl2HdJpEAmuy+eAxHjAdx7xvQun96uUDxIL701ggK11HK8Z8akKqtTOj/sxzuqJTUUDiUJS/qV74dqJA==", + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/elastic-apm-http-client/-/elastic-apm-http-client-9.8.0.tgz", + "integrity": "sha512-JrlQbijs4dY8539zH+QNKLqLDCNyNymyy720tDaj+/i5pcwWYz5ipPARAdrKkor56AmKBxib8Fd6KsSWtIYjcA==", "dev": true, "optional": true, "requires": { @@ -10990,41 +11096,40 @@ "end-of-stream": "^1.4.4", "fast-safe-stringify": "^2.0.7", "fast-stream-to-buffer": "^1.0.0", - "pump": "^3.0.0", + "object-filter-sequence": "^1.0.0", "readable-stream": "^3.4.0", "stream-chopper": "^3.0.1", "unicode-byte-truncate": "^1.0.0" } }, "elastic-apm-node": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/elastic-apm-node/-/elastic-apm-node-3.12.1.tgz", - "integrity": "sha512-HUVEECspvN6SpFIRZdLnMTnS1vIi5nLR4/j3KoWvgofjCqXtjKMgMnYiwmvd/NpZjS1IGZR+qpAEOyjqv0hk7Q==", + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/elastic-apm-node/-/elastic-apm-node-3.14.0.tgz", + "integrity": "sha512-B7Xkz6UL44mm+2URdZy2yxpEB2C5CvZLOP3sGpf2h/hepXr4NgrVoRxGqO1F2b2wCB48smPv4a3v35b396VSwA==", "dev": true, "optional": true, "requires": { + "@elastic/ecs-pino-format": "^1.1.0", "after-all-results": "^2.0.0", "async-value-promise": "^1.1.1", "basic-auth": "^2.0.1", - "console-log-level": "^1.4.1", "cookie": "^0.4.0", "core-util-is": "^1.0.2", - "elastic-apm-http-client": "^9.5.1", + "elastic-apm-http-client": "^9.8.0", "end-of-stream": "^1.4.4", "error-stack-parser": "^2.0.6", "escape-string-regexp": "^4.0.0", "fast-safe-stringify": "^2.0.7", "http-headers": "^3.0.2", - "http-request-to-url": "^1.0.0", "is-native": "^1.0.1", "measured-reporting": "^1.51.1", "monitor-event-loop-delay": "^1.0.0", "object-filter-sequence": "^1.0.0", "object-identity-map": "^1.0.2", "original-url": "^1.2.3", + "pino": "^6.11.2", "read-pkg-up": "^7.0.1", "relative-microtime": "^2.0.0", - "require-ancestors": "^1.0.0", "require-in-the-middle": "^5.0.3", "semver": "^6.3.0", "set-cookie-serde": "^1.0.0", @@ -11623,12 +11728,6 @@ "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, - "expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true - }, "ext": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", @@ -11695,12 +11794,32 @@ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "fast-json-stringify": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-2.7.3.tgz", + "integrity": "sha512-QNIh4CQ5S3D5vO7Bv88Si8TFQGZgxv15h2n/79TESr4lhZ8ptq3R9SCTteslr+pwrZQlvrAFgcXgFuUIgS3UQA==", + "dev": true, + "optional": true, + "requires": { + "ajv": "^6.11.0", + "deepmerge": "^4.2.2", + "rfdc": "^1.2.0", + "string-similarity": "^4.0.1" + } + }, "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, + "fast-redact": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.0.1.tgz", + "integrity": "sha512-kYpn4Y/valC9MdrISg47tZOpYBNoTXKgT9GYXFpHN/jYFs+lFkPoisY+LcBODdKVMY96ATzvzsWv+ES/4Kmufw==", + "dev": true, + "optional": true + }, "fast-safe-stringify": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", @@ -11752,9 +11871,9 @@ "dev": true }, "fecha": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.0.tgz", - "integrity": "sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", + "integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==", "dev": true }, "figures": { @@ -11836,6 +11955,13 @@ "write": "1.0.3" } }, + "flatstr": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/flatstr/-/flatstr-1.0.12.tgz", + "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==", + "dev": true, + "optional": true + }, "flatted": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", @@ -11914,12 +12040,6 @@ } } }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -12060,12 +12180,6 @@ "integrity": "sha1-lt70EZjsOQgli1Ea909lWidk0qE=", "dev": true }, - "github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", - "dev": true - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -12263,9 +12377,9 @@ "dev": true }, "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true, "optional": true }, @@ -12291,17 +12405,6 @@ "next-line": "^1.1.0" } }, - "http-request-to-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-request-to-url/-/http-request-to-url-1.0.0.tgz", - "integrity": "sha512-YYx0lKXG9+T1fT2q3ZgXLczMI3jW09g9BvIA6L3BG0tFqGm83Ka/+RUZGANRG7Ut/yueD7LPcZQ/+pA5ndNajw==", - "dev": true, - "optional": true, - "requires": { - "await-event": "^2.1.0", - "socket-location": "^1.0.0" - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -12492,9 +12595,9 @@ "dev": true }, "ioredis": { - "version": "4.24.2", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.24.2.tgz", - "integrity": "sha512-SSuVXwoG747sZetxxs9gyAno5kfUfvo4s5mSZp4dh8vzuTnrtA5mTf2OjL6sPfIfNbVTROg2c+VbXceGlpucPQ==", + "version": "4.27.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-4.27.2.tgz", + "integrity": "sha512-7OpYymIthonkC2Jne5uGWXswdhlua1S1rWGAERaotn0hGJWTSURvxdHA9G6wNbT/qKCloCja/FHsfKXW8lpTmg==", "dev": true, "requires": { "cluster-key-slot": "^1.1.0", @@ -12507,17 +12610,6 @@ "redis-errors": "^1.2.0", "redis-parser": "^3.0.0", "standard-as-callback": "^2.1.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - } } }, "ip": { @@ -12533,9 +12625,9 @@ "dev": true }, "is-bigint": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", - "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz", + "integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==", "dev": true, "optional": true }, @@ -12584,9 +12676,9 @@ } }, "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.3.tgz", + "integrity": "sha512-tDpEUInNcy2Yw3lNSepK3Wdw1RnXLcIVienz6Ou631Acl15cJyRWK4dgA1vCmOEgIbtOV0W7MHg+AR2Gdg1NXQ==", "dev": true, "optional": true }, @@ -13006,16 +13098,14 @@ "dev": true }, "kuzzle": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/kuzzle/-/kuzzle-2.10.3.tgz", - "integrity": "sha512-cG5LjjR6mJKWE7X3eOB6Xp9amcpW4SDtHRt2ekkvyNiC+PC976H9dkGBh7Hqts2o3qTmsP4VVfdBL6MUfHxnhg==", + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/kuzzle/-/kuzzle-2.11.2.tgz", + "integrity": "sha512-98jtyEa26s5rdZZBry7Oaf39QNDoFiG67V0ZD31Exb0iXipHe7Ys/NVUpPnfYhR5NsvraACUfaMfnLi/DmqCQg==", "dev": true, "requires": { - "@elastic/elasticsearch": "^7.11.0", + "@elastic/elasticsearch": "^7.12.0", "aedes": "^0.45.0", "bluebird": "^3.7.2", - "bufferutil": "^4.0.3", - "busboy": "^0.3.1", "cli-color": "^2.0.0", "cookie": "^0.4.1", "debug": "^4.3.1", @@ -13024,34 +13114,35 @@ "dumpme": "^1.0.3", "eventemitter3": "^4.0.7", "inquirer": "^8.0.0", - "ioredis": "^4.23.0", + "ioredis": "^4.26.0", "ip": "^1.1.5", "json-stable-stringify": "^1.0.1", "json2yaml": "^1.1.0", "jsonwebtoken": "^8.5.1", "koncorde": "^3.0.0", "kuzzle-plugin-auth-passport-local": "^6.2.0", - "kuzzle-plugin-logger": "^3.0.2", - "kuzzle-sdk": "7.5.6", + "kuzzle-plugin-logger": "^3.0.3", + "kuzzle-sdk": "7.6.1", "kuzzle-vault": "^2.0.4", "lodash": "4.17.21", + "long": "^4.0.0", "moment": "^2.29.1", "ms": "^2.1.3", "murmurhash-native": "^3.5.0", "passport": "^0.4.1", + "protobufjs": "~6.10.2", "rc": "1.2.8", - "semver": "^7.3.4", + "semver": "^7.3.5", "sorted-array": "^2.0.4", - "utf-8-validate": "^5.0.4", "uuid": "^8.3.2", + "uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v18.14.0.tar.gz", "validator": "^13.5.2", "winston": "^3.3.3", - "winston-elasticsearch": "0.15.2", + "winston-elasticsearch": "0.15.4", "winston-syslog": "^2.4.4", "winston-transport": "^4.4.0", - "ws": "^7.4.4", "yargs": "^16.2.0", - "zeromq": "^5.2.0" + "zeromq": "^6.0.0-beta.6" }, "dependencies": { "ansi-regex": { @@ -13060,23 +13151,6 @@ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -13144,12 +13218,6 @@ "requires": { "ansi-regex": "^5.0.0" } - }, - "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", - "dev": true } } }, @@ -13488,9 +13556,9 @@ } }, "kuzzle-plugin-logger": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/kuzzle-plugin-logger/-/kuzzle-plugin-logger-3.0.2.tgz", - "integrity": "sha512-hmvPAn6/E3vE5t2PQpDITKPhQevuEe1kHGF9LLoX/sqkCTfKKVJazgyEk2Y4XiIHL3Fcfue9YJC8UEdXGjJHdQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kuzzle-plugin-logger/-/kuzzle-plugin-logger-3.0.3.tgz", + "integrity": "sha512-lXnm+oJS75FQALrYa41I5T9ZRywjy05/mZ1crD/ZZj4JNOgcKjWo+mEwLGR0lSNFX9bonmj1kPIYIPgWZ1wy6w==", "dev": true, "requires": { "moment": "^2.29.1", @@ -13501,13 +13569,13 @@ } }, "kuzzle-sdk": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.5.6.tgz", - "integrity": "sha512-yDFusdiTLU921dgBAEEaA6cS84oYrs1OympSPBk/fuZCwWl0eDoVQaBEtBJSN1dI3kmi1+iKkrjHpjYsrmRJxQ==", + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.6.1.tgz", + "integrity": "sha512-cSLvvuy6nu3Ra5EtZd+5+c8aFEgFBmjlZV6c9n/4GyGYSyOCTPvWWZ4tKBKaD6N9L1jsi+1acyUjKrzxr/xY8Q==", "dev": true, "requires": { "min-req-promise": "^1.0.1", - "ws": "^7.4.2" + "ws": "^7.4.4" } }, "kuzzle-vault": { @@ -13679,6 +13747,12 @@ "triple-beam": "^1.3.0" } }, + "long": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", + "dev": true + }, "lower-case": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", @@ -13833,12 +13907,6 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "mimic-response": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", - "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", - "dev": true - }, "min-req-promise": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/min-req-promise/-/min-req-promise-1.0.1.tgz", @@ -13896,12 +13964,6 @@ "minimist": "^1.2.5" } }, - "mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, "mocha": { "version": "8.3.1", "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.1.tgz", @@ -13941,23 +14003,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -14158,12 +14203,6 @@ "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", "dev": true }, - "napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -14239,23 +14278,6 @@ "lower-case": "^1.1.1" } }, - "node-abi": { - "version": "2.21.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.21.0.tgz", - "integrity": "sha512-smhrivuPqEM3H5LmnY3KU6HfYv0u4QklgAxfFyRNujKUzbUcYZ+Jc2EhukB9SRcD2VpqhxM7n/MIcp1Ua1/JMg==", - "dev": true, - "requires": { - "semver": "^5.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "node-gyp": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-7.1.2.tgz", @@ -14433,12 +14455,6 @@ } } }, - "noop-logger": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", - "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", - "dev": true - }, "nopt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz", @@ -14569,9 +14585,9 @@ } }, "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.10.2.tgz", + "integrity": "sha512-gz58rdPpadwztRrPjZE9DZLOABUpTGdcANUgOwBFO1C+HZZhePoP83M65WGDmbpwFYJSWqavbl4SgDn4k8RYTA==", "dev": true, "optional": true }, @@ -14871,6 +14887,28 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, + "pino": { + "version": "6.11.3", + "resolved": "https://registry.npmjs.org/pino/-/pino-6.11.3.tgz", + "integrity": "sha512-drPtqkkSf0ufx2gaea3TryFiBHdNIdXKf5LN0hTM82SXI4xVIve2wLwNg92e1MT6m3jASLu6VO7eGY6+mmGeyw==", + "dev": true, + "optional": true, + "requires": { + "fast-redact": "^3.0.0", + "fast-safe-stringify": "^2.0.7", + "flatstr": "^1.0.12", + "pino-std-serializers": "^3.1.0", + "quick-format-unescaped": "^4.0.3", + "sonic-boom": "^1.0.2" + } + }, + "pino-std-serializers": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", + "integrity": "sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg==", + "dev": true, + "optional": true + }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -14880,29 +14918,6 @@ "find-up": "^4.0.0" } }, - "prebuild-install": { - "version": "5.3.6", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.6.tgz", - "integrity": "sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg==", - "dev": true, - "requires": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.7.0", - "noop-logger": "^0.1.1", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0", - "which-pm-runs": "^1.0.0" - } - }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -14936,6 +14951,35 @@ "asap": "~2.0.6" } }, + "protobufjs": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", + "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", + "dev": true, + "requires": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/long": "^4.0.1", + "@types/node": "^13.7.0", + "long": "^4.0.0" + }, + "dependencies": { + "@types/node": { + "version": "13.13.51", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.51.tgz", + "integrity": "sha512-66/xg5I5Te4oGi5Jws11PtNmKkZbOPZWyBZZ/l5AOrWj1Dyw+6Ge/JhYTq/2/Yvdqyhrue8RL+DGI298OJ0xcg==", + "dev": true + } + } + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -14998,6 +15042,13 @@ "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", "dev": true }, + "quick-format-unescaped": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.3.tgz", + "integrity": "sha512-MaL/oqh02mhEo5m5J2rwsVL23Iw2PEaGVHgT2vFt8AAsr0lfvQA5dpXo9TPu0rz7tSBdUPgkbam0j/fj5ZM8yg==", + "dev": true, + "optional": true + }, "random-poly-fill": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/random-poly-fill/-/random-poly-fill-1.0.1.tgz", @@ -15246,13 +15297,6 @@ } } }, - "require-ancestors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/require-ancestors/-/require-ancestors-1.0.0.tgz", - "integrity": "sha512-Nqeo9Gfp0KvnxTixnxLGEbThMAi+YYgnwRoigtOs1Oo3eGBYfqCd3dagq1vBCVVuc1EnIt3Eu1eGemwOOEZozw==", - "dev": true, - "optional": true - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -15540,6 +15584,13 @@ } } }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true, + "optional": true + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -15603,9 +15654,9 @@ } }, "secure-json-parse": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.3.2.tgz", - "integrity": "sha512-4oUSFU0w2d8/XQb7NO9dbMYyp/hxIwZPcZcGAlAAEziMRHs+NbUcx2Z5dda/z8o+avyQ8gpuYnTMlGh8SVwg9g==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.4.0.tgz", + "integrity": "sha512-Q5Z/97nbON5t/L/sH6mY2EacfjVGwrCcSi5D3btRO2GZ8pf1K1UN7Z9H5J57hjVU2Qzxr1xO+FmBhOvEkzCMmg==", "dev": true }, "seed-random": { @@ -15615,9 +15666,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -15765,23 +15816,6 @@ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "dev": true }, - "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true - }, - "simple-get": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz", - "integrity": "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==", - "dev": true, - "requires": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -15839,14 +15873,15 @@ "is-fullwidth-code-point": "^2.0.0" } }, - "socket-location": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/socket-location/-/socket-location-1.0.0.tgz", - "integrity": "sha512-TwxpRM0pPE/3b24XQGLx8zq2J8kOwTy40FtiNC1KrWvl/Tsf7RYXruE9icecMhQwicXMo/HUJlGap8DNt2cgYw==", + "sonic-boom": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-1.4.1.tgz", + "integrity": "sha512-LRHh/A8tpW7ru89lrlkU4AszXt1dbwSjVWguGrmlxE7tawVmDBlI1PILMkXAxJTwqhgsEeTHzj36D5CmHgQmNg==", "dev": true, "optional": true, "requires": { - "await-event": "^2.1.0" + "atomic-sleep": "^1.0.0", + "flatstr": "^1.0.12" } }, "sorted-array": { @@ -16029,11 +16064,14 @@ "readable-stream": "^3.0.6" } }, - "streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=", - "dev": true + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } }, "string_decoder": { "version": "1.3.0", @@ -16050,6 +16088,13 @@ "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", "dev": true }, + "string-similarity": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", + "integrity": "sha512-/q/8Q4Bl4ZKAPjj8WerIBJWALKkaPRfrvhfF8k/B23i4nzrlRj2/go1m90In7nG/3XDSbOo0+pu6RvCTM9RGMQ==", + "dev": true, + "optional": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -16177,31 +16222,6 @@ } } }, - "tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dev": true, - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - }, "term-size": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", @@ -16438,16 +16458,16 @@ "dev": true }, "unbox-primitive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", - "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", "dev": true, "optional": true, "requires": { "function-bind": "^1.1.1", - "has-bigints": "^1.0.0", - "has-symbols": "^1.0.0", - "which-boxed-primitive": "^1.0.1" + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" } }, "undefsafe": { @@ -16616,15 +16636,6 @@ "prepend-http": "^2.0.0" } }, - "utf-8-validate": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.4.tgz", - "integrity": "sha512-MEF05cPSq3AwJ2C7B7sHAA6i53vONoZbMGX8My5auEVm6W+dJ2Jd/TZPyGJ5CH42V2XtbI5FD28HeHeqlPzZ3Q==", - "dev": true, - "requires": { - "node-gyp-build": "^4.2.0" - } - }, "util-arity": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/util-arity/-/util-arity-1.1.0.tgz", @@ -16648,6 +16659,11 @@ "integrity": "sha512-OdmXxA8rDsQ7YpNVbKSJkNzTw2I+S5WsbMDnCtIWSQaosNAcWtFuI/YK1TjzUI6nbkgiqEyh8gWngfcv8Asd9A==", "dev": true }, + "uWebSockets.js": { + "version": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v18.14.0.tar.gz", + "integrity": "sha512-1YaUwux9uJIlvtczyWKuD+MtgF0ors71SGicvjYpOAN5d4SW11YXuxY5R3UD9M94xZbVEScgY/2Eyy+Pe6A+Lw==", + "dev": true + }, "v8-compile-cache": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", @@ -16705,12 +16721,6 @@ "is-symbol": "^1.0.3" } }, - "which-pm-runs": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", - "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", - "dev": true - }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -16787,12 +16797,12 @@ } }, "winston-elasticsearch": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.15.2.tgz", - "integrity": "sha512-7v1D94cv1e0bNSbMUS0sQBxw+esJZ3XQOMjrRSXgqLk6BMUIkTgQXwCoUlBIcF/tfwPi+zgZsL9RwDwzDM+tbA==", + "version": "0.15.4", + "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.15.4.tgz", + "integrity": "sha512-MtGqVILFzj3P8hWTIQvoT6baeslRwi8/U8y5mr7BSOpRynYejILpFhcfuGsnAvgIKAKBRUzOsDHJMGakJlpsKA==", "dev": true, "requires": { - "@elastic/elasticsearch": "^7.11.0", + "@elastic/elasticsearch": "^7.12.0", "dayjs": "^1.10.4", "debug": "^4.3.1", "elastic-apm-node": "^3.9.0", @@ -16802,17 +16812,6 @@ "retry": "^0.12.0", "winston": "^3.3.3", "winston-transport": "^4.4.0" - }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - } } }, "winston-syslog": { @@ -16982,10 +16981,11 @@ } }, "ws": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", - "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", - "dev": true + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", + "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", + "dev": true, + "requires": {} }, "xdg-basedir": { "version": "4.0.0", @@ -17120,13 +17120,12 @@ "dev": true }, "zeromq": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/zeromq/-/zeromq-5.2.0.tgz", - "integrity": "sha512-qsckhCmrg6et6zrAJytC971SSN/4iLxKgkXK1Wqn2Gij5KXMY+TA+3cy/iFwehaWdU5usg5HNOOgaBdjSqtCVw==", + "version": "6.0.0-beta.6", + "resolved": "https://registry.npmjs.org/zeromq/-/zeromq-6.0.0-beta.6.tgz", + "integrity": "sha512-wLf6M7pBHijl+BRltUL2VoDpgbQcOZetiX8UzycHL8CcYFxYnRrpoG5fi3UX3+Umavz1lk4/dGaQez8qiDgr/Q==", "dev": true, "requires": { - "nan": "^2.14.0", - "prebuild-install": "^5.3.2" + "node-gyp-build": "^4.1.0" } } } diff --git a/package.json b/package.json index 9a9eb248..a820397e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kuzzle-plugin-device-manager", - "version": "1.0.0", + "version": "0.2.0", "description": "", "author": "", "scripts": { @@ -37,7 +37,7 @@ "eslint": "^7.21.0", "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^4.0.2", - "kuzzle": "^2.10.3", + "kuzzle": "^2.11.1", "kuzzle-sdk": "^7.5.6", "lodash": "^4.17.21", "mocha": "^8.3.0", @@ -51,7 +51,7 @@ "typescript": "^4.2.3" }, "peerDependencies": { - "kuzzle": "^2.10.3" + "kuzzle": "^2.10.4" }, "files": [ "index.js",