From 2c13783f18736f11717cf8295048bded4fdb547e Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 09:12:50 +0200 Subject: [PATCH 01/28] Add typescript to elasticsearch service --- .kuzzlerc.sample => .kuzzlerc.sample.jsonc | 0 docker-compose.yml | 50 +-- lib/core/backend/backendStorage.ts | 6 +- lib/core/plugin/pluginContext.ts | 4 +- lib/core/storage/clientAdapter.js | 52 +-- .../{elasticsearch.js => elasticsearch.ts} | 416 +++++++++++------- lib/types/storage/Elasticsearch.ts | 33 ++ test/mocks/elasticsearch.mock.js | 4 +- 8 files changed, 350 insertions(+), 215 deletions(-) rename .kuzzlerc.sample => .kuzzlerc.sample.jsonc (100%) rename lib/service/storage/{elasticsearch.js => elasticsearch.ts} (92%) create mode 100644 lib/types/storage/Elasticsearch.ts diff --git a/.kuzzlerc.sample b/.kuzzlerc.sample.jsonc similarity index 100% rename from .kuzzlerc.sample rename to .kuzzlerc.sample.jsonc diff --git a/docker-compose.yml b/docker-compose.yml index 58827fe9cb..795e9f90d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,8 +47,6 @@ services: container_name: kuzzle_nginx depends_on: - kuzzle_node_1 - - kuzzle_node_2 - - kuzzle_node_3 ports: - '7512:7512' volumes: @@ -67,31 +65,31 @@ services: interval: 2s retries: 10 - kuzzle_node_2: - <<: *kuzzle-config - container_name: kuzzle_node_2 - ports: - - '17511:7512' # Kuzzle API port - - '11883:1883' # Kuzzle MQTT port - - '9230:9229' # Debug port - healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - timeout: 1s - interval: 2s - retries: 10 + # kuzzle_node_2: + # <<: *kuzzle-config + # container_name: kuzzle_node_2 + # ports: + # - '17511:7512' # Kuzzle API port + # - '11883:1883' # Kuzzle MQTT port + # - '9230:9229' # Debug port + # healthcheck: + # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + # timeout: 1s + # interval: 2s + # retries: 10 - kuzzle_node_3: - <<: *kuzzle-config - container_name: kuzzle_node_3 - ports: - - '17512:7512' # Kuzzle API port - - '11884:1883' # Kuzzle MQTT port - - '9231:9229' # Debug port - healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - timeout: 1s - interval: 2s - retries: 10 + # kuzzle_node_3: + # <<: *kuzzle-config + # container_name: kuzzle_node_3 + # ports: + # - '17512:7512' # Kuzzle API port + # - '11884:1883' # Kuzzle MQTT port + # - '9231:9229' # Debug port + # healthcheck: + # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + # timeout: 1s + # interval: 2s + # retries: 10 redis: image: redis:6 diff --git a/lib/core/backend/backendStorage.ts b/lib/core/backend/backendStorage.ts index 294de544c7..493e046a2b 100644 --- a/lib/core/backend/backendStorage.ts +++ b/lib/core/backend/backendStorage.ts @@ -21,7 +21,7 @@ import { Client } from "@elastic/elasticsearch"; -import Elasticsearch from "../../service/storage/elasticsearch"; +import { ElasticSearch } from "../../service/storage/elasticsearch"; import { JSONObject } from "../../../index"; import { ApplicationManager, Backend } from "./index"; @@ -44,7 +44,7 @@ export class BackendStorage extends ApplicationManager { const kuzzle = this._kuzzle; this._Client = function ESClient(clientConfig: JSONObject = {}) { - return Elasticsearch.buildClient({ + return ElasticSearch.buildClient({ ...kuzzle.config.services.storageEngine.client, ...clientConfig, }); @@ -60,7 +60,7 @@ export class BackendStorage extends ApplicationManager { */ get storageClient(): Client { if (!this._client) { - this._client = Elasticsearch.buildClient( + this._client = ElasticSearch.buildClient( this._kuzzle.config.services.storageEngine.client ); } diff --git a/lib/core/plugin/pluginContext.ts b/lib/core/plugin/pluginContext.ts index 3e112990d4..38d2ea5a4c 100644 --- a/lib/core/plugin/pluginContext.ts +++ b/lib/core/plugin/pluginContext.ts @@ -27,7 +27,7 @@ import { JSONObject } from "kuzzle-sdk"; import { EmbeddedSDK } from "../shared/sdk/embeddedSdk"; import PluginRepository from "./pluginRepository"; import Store from "../shared/store"; -import Elasticsearch from "../../service/storage/elasticsearch"; +import { ElasticSearch } from "../../service/storage/elasticsearch"; import { isPlainObject } from "../../util/safeObject"; import Promback from "../../util/promback"; import { Mutex } from "../../util/mutex"; @@ -307,7 +307,7 @@ export class PluginContext { // eslint-disable-next-line no-inner-declarations function PluginContextESClient(): Client { - return Elasticsearch.buildClient( + return ElasticSearch.buildClient( global.kuzzle.config.services.storageEngine.client ); } diff --git a/lib/core/storage/clientAdapter.js b/lib/core/storage/clientAdapter.js index a6712e8ff7..dd4851f3ea 100644 --- a/lib/core/storage/clientAdapter.js +++ b/lib/core/storage/clientAdapter.js @@ -21,7 +21,7 @@ "use strict"; -const Elasticsearch = require("../../service/storage/elasticsearch"); +const { ElasticSearch } = require("../../service/storage/elasticsearch"); const { IndexCache } = require("./indexCache"); const { isPlainObject } = require("../../util/safeObject"); const kerror = require("../../kerror"); @@ -38,7 +38,7 @@ class ClientAdapter { * @param {storeScopeEnum} scope */ constructor(scope) { - this.client = new Elasticsearch( + this.client = new ElasticSearch( global.kuzzle.config.services.storageEngine, scope ); @@ -74,10 +74,10 @@ class ClientAdapter { ); /** - * Translate Koncorde filters to Elasticsearch query + * Translate Koncorde filters to ElasticSearch query * * @param {Object} koncordeFilters - Set of valid Koncorde filters - * @returns {Object} Equivalent Elasticsearch query + * @returns {Object} Equivalent ElasticSearch query */ global.kuzzle.onAsk(`core:storage:${this.scope}:translate`, (filters) => this.client.translateKoncordeFilters(filters) @@ -362,7 +362,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} bulk data, in ES format - * @param {Object} [opts] -- see Elasticsearch "import" options + * @param {Object} [opts] -- see ElasticSearch "import" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -395,7 +395,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} content - * @param {Object} [opts] -- see Elasticsearch "create" options + * @param {Object} [opts] -- see ElasticSearch "create" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -413,7 +413,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content - * @param {Object} [opts] -- see Elasticsearch "createOrReplace" options + * @param {Object} [opts] -- see ElasticSearch "createOrReplace" options * @returns {Promise.<{ _id, _version, _source, created }>} */ global.kuzzle.onAsk( @@ -436,7 +436,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {string} id - * @param {Object} [opts] -- see Elasticsearch "delete" options + * @param {Object} [opts] -- see ElasticSearch "delete" options * @returns {Promise} */ global.kuzzle.onAsk( @@ -453,7 +453,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} query - * @param {Object} [opts] -- see Elasticsearch "deleteByQuery" options + * @param {Object} [opts] -- see ElasticSearch "deleteByQuery" options * @returns {Promise.<{ documents, total, deleted, failures: [ _shardId, reason ] }>} */ global.kuzzle.onAsk( @@ -471,7 +471,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id * @param {Array} fields -- fields to delete - * @param {Object} [opts] -- see Elasticsearch "deleteFields" options + * @param {Object} [opts] -- see ElasticSearch "deleteFields" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -546,7 +546,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see Elasticsearch "mCreate" options + * @param {Object} [opts] -- see ElasticSearch "mCreate" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -563,7 +563,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see Elasticsearch "mCreateOrReplace" options + * @param {Object} [opts] -- see ElasticSearch "mCreateOrReplace" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -580,7 +580,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {string[]} ids - * @param {Object} [opts] -- see Elasticsearch "mDelete" options + * @param {Object} [opts] -- see ElasticSearch "mDelete" options * @returns {Promise.<{ documents, errors }> */ global.kuzzle.onAsk( @@ -597,7 +597,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see Elasticsearch "mReplace" options + * @param {Object} [opts] -- see ElasticSearch "mReplace" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -614,7 +614,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see Elasticsearch "mUpdate" options + * @param {Object} [opts] -- see ElasticSearch "mUpdate" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -632,7 +632,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see Elasticsearch "mUpsert" options + * @param {Object} [opts] -- see ElasticSearch "mUpsert" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -650,7 +650,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query (ES format) * @param {Function} callback -- callback applied to matched documents - * @param {Object} [opts] -- see Elasticsearch "mExecute" options + * @param {Object} [opts] -- see ElasticSearch "mExecute" options * @returns {Promise.} Array of results returned by the callback */ global.kuzzle.onAsk( @@ -684,7 +684,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id * @param {Object} content -- new document content - * @param {Object} [opts] -- see Elasticsearch "replace" options + * @param {Object} [opts] -- see ElasticSearch "replace" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -699,7 +699,7 @@ class ClientAdapter { * Fetch the next page of results of a search query * * @param {string} scrollId - * @param {Object} [opts] -- see Elasticsearch "scroll" options + * @param {Object} [opts] -- see ElasticSearch "scroll" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -713,7 +713,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} searchBody -- search query, in ES format - * @param {Object} [opts] -- see Elasticsearch "search" options + * @param {Object} [opts] -- see ElasticSearch "search" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -729,7 +729,7 @@ class ClientAdapter { * * @param {Object[]} targets * @param {Object} searchBody -- search query, in ES format - * @param {Object} [opts] -- see Elasticsearch "search" options + * @param {Object} [opts] -- see ElasticSearch "search" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -752,7 +752,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content -- partial content to update - * @param {Object} [opts] -- see Elasticsearch "update" options + * @param {Object} [opts] -- see ElasticSearch "update" options * @returns {Promise.<{ _id, _version }>} */ global.kuzzle.onAsk( @@ -771,7 +771,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query, in ES format * @param {Object} changes -- partial changes to apply to matched documents - * @param {Object} [opts] -- see Elasticsearch "updateByQuery" options + * @param {Object} [opts] -- see ElasticSearch "updateByQuery" options * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ global.kuzzle.onAsk( @@ -796,7 +796,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query, in ES format * @param {Object} changes -- partial changes to apply to matched documents - * @param {Object} [opts] -- see Elasticsearch "updateByQuery" options + * @param {Object} [opts] -- see ElasticSearch "updateByQuery" options * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ global.kuzzle.onAsk( @@ -821,7 +821,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content -- partial content to update - * @param {Object} [opts] -- see Elasticsearch "upsert" options + * @param {Object} [opts] -- see ElasticSearch "upsert" options * @returns {Promise.<{ _id, _version }>} */ global.kuzzle.onAsk( @@ -839,7 +839,7 @@ class ClientAdapter { * * @param {string} index * @param {string} collection - * @param {Object} [opts] -- see Elasticsearch "getMapping" options + * @param {Object} [opts] -- see ElasticSearch "getMapping" options * * @returns {Promise.<{ dynamic, _meta, properties }>} */ diff --git a/lib/service/storage/elasticsearch.js b/lib/service/storage/elasticsearch.ts similarity index 92% rename from lib/service/storage/elasticsearch.js rename to lib/service/storage/elasticsearch.ts index 988fd5f63c..2746147469 100644 --- a/lib/service/storage/elasticsearch.js +++ b/lib/service/storage/elasticsearch.ts @@ -19,11 +19,24 @@ * limitations under the License. */ -"use strict"; +import _ from "lodash"; + +import { + ApiResponse, + RequestParams, + Client as StorageClient, +} from "@elastic/elasticsearch"; +import { + InfoResult, + KRequestBody, + JSONObject, + KImportError, +} from "../../types/storage/Elasticsearch"; +import { Index } from "@elastic/elasticsearch/api/requestParams"; + +import { TypeMapping } from "@elastic/elasticsearch/api/types"; const assert = require("assert"); -const _ = require("lodash"); -const { Client: StorageClient } = require("@elastic/elasticsearch"); const ms = require("ms"); const Bluebird = require("bluebird"); const semver = require("semver"); @@ -63,11 +76,12 @@ const FORBIDDEN_CHARS = `\\/*?"<>| \t\r\n,+#:${NAME_SEPARATOR}${PUBLIC_PREFIX}${ const DYNAMIC_PROPERTY_VALUES = ["true", "false", "strict"]; // used to check whether we need to wait for ES to initialize or not -const esStateEnum = Object.freeze({ - AWAITING: 1, - NONE: 2, - OK: 3, -}); +enum esStateEnum { + AWAITING = 1, + NONE = 2, + OK = 3, +} + let esState = esStateEnum.NONE; /** @@ -76,7 +90,9 @@ let esState = esStateEnum.NONE; * @param {storeScopeEnum} scope * @constructor */ -class ElasticSearch extends Service { +export class ElasticSearch extends Service { + public _client: StorageClient; + /** * Returns a new elasticsearch client instance * @@ -208,7 +224,7 @@ class ElasticSearch extends Service { * @returns {Promise.} service informations */ info() { - const result = { + const result: InfoResult = { type: "elasticsearch", version: this._esVersion, }; @@ -250,6 +266,7 @@ class ElasticSearch extends Service { let size = 0; for (const [indice, indiceInfo] of Object.entries(body.indices)) { + const infos = indiceInfo as any; // Ignore non-Kuzzle indices if ( indice[INDEX_PREFIX_POSITION_IN_INDICE] !== PRIVATE_PREFIX && @@ -278,12 +295,12 @@ class ElasticSearch extends Service { }; } indexes[indexName].collections.push({ - documentCount: indiceInfo.total.docs.count, + documentCount: infos.total.docs.count, name: collectionName, - size: indiceInfo.total.store.size_in_bytes, + size: infos.total.store.size_in_bytes, }); - indexes[indexName].size += indiceInfo.total.store.size_in_bytes; - size += indiceInfo.total.store.size_in_bytes; + indexes[indexName].size += infos.total.store.size_in_bytes; + size += infos.total.store.size_in_bytes; } return { @@ -302,7 +319,7 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ - async scroll(scrollId, { scrollTTL } = {}) { + async scroll(scrollId, { scrollTTL }) { const _scrollTTL = scrollTTL || this._config.defaults.scrollTTL; const esRequest = { scroll: _scrollTTL, @@ -372,10 +389,10 @@ class ElasticSearch extends Service { * @returns {Promise.<{ scrollId, hits, aggregations, suggest, total }>} */ async search( - { index, collection, searchBody, targets } = {}, - { from, size, scroll } = {} + { index, collection, searchBody, targets }, + { from, size, scroll } ) { - let esIndexes; + let esIndexes: any; if (targets && targets.length > 0) { const indexes = new Set(); @@ -468,7 +485,7 @@ class ElasticSearch extends Service { return aliasToTargets; } - async _formatSearchResult(body, searchInfo = {}) { + async _formatSearchResult(body: any, searchInfo: any) { let aliasToTargets = {}; const aliasCache = new Map(); @@ -527,7 +544,7 @@ class ElasticSearch extends Service { const formattedInnerHits = {}; for (const [name, innerHit] of Object.entries(innerHits)) { formattedInnerHits[name] = await Bluebird.map( - innerHit.hits.hits, + (innerHit as any).hits.hits, formatHit ); } @@ -678,14 +695,14 @@ class ElasticSearch extends Service { * @returns {Promise.} { _id, _version, _source } */ async create( - index, - collection, - content, - { id, refresh, userId = null, injectKuzzleMeta = true } = {} + index: string, + collection: string, + content: JSONObject, + { id, refresh, userId = null, injectKuzzleMeta = true } ) { assertIsObject(content); - const esRequest = { + const esRequest: Index> = { body: content, id, index: this._getAlias(index, collection), @@ -737,7 +754,7 @@ class ElasticSearch extends Service { collection, id, content, - { refresh, userId = null, injectKuzzleMeta = true } = {} + { refresh, userId = null, injectKuzzleMeta = true } ) { const esRequest = { body: content, @@ -787,14 +804,14 @@ class ElasticSearch extends Service { * @returns {Promise.<{ _id, _version }>} */ async update( - index, - collection, - id, - content, - { refresh, userId = null, retryOnConflict, injectKuzzleMeta = true } = {} + index: string, + collection: string, + id: string, + content: JSONObject, + { refresh, userId = null, retryOnConflict, injectKuzzleMeta = true } ) { - const esRequest = { - _source: true, + const esRequest: RequestParams.Update> = { + _source: "true", body: { doc: content }, id, index: this._getAlias(index, collection), @@ -841,20 +858,20 @@ class ElasticSearch extends Service { * @returns {Promise.<{ _id, _version }>} */ async upsert( - index, - collection, - id, - content, + index: string, + collection: string, + id: string, + content: JSONObject, { defaultValues = {}, refresh, userId = null, retryOnConflict, injectKuzzleMeta = true, - } = {} + } ) { - const esRequest = { - _source: true, + const esRequest: RequestParams.Update> = { + _source: "true", body: { doc: content, upsert: { ...defaultValues, ...content }, @@ -912,11 +929,11 @@ class ElasticSearch extends Service { * @returns {Promise.<{ _id, _version, _source }>} */ async replace( - index, - collection, - id, - content, - { refresh, userId = null, injectKuzzleMeta = true } = {} + index: string, + collection: string, + id: string, + content: JSONObject, + { refresh, userId = null, injectKuzzleMeta = true } ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -970,7 +987,7 @@ class ElasticSearch extends Service { * * @returns {Promise} */ - async delete(index, collection, id, { refresh } = {}) { + async delete(index: string, collection: string, id: string, { refresh }) { const esRequest = { id, index: this._getAlias(index, collection), @@ -1006,12 +1023,12 @@ class ElasticSearch extends Service { * @returns {Promise.<{ documents, total, deleted, failures: Array<{ _shardId, reason }> }>} */ async deleteByQuery( - index, - collection, - query, - { refresh, size = 1000, fetch = true } = {} + index: string, + collection: string, + query: string, + { refresh, size = 1000, fetch = true } ) { - const esRequest = { + const esRequest: RequestParams.DeleteByQuery> = { body: this._sanitizeSearchBody({ query }), index: this._getAlias(index, collection), scroll: "5s", @@ -1061,11 +1078,11 @@ class ElasticSearch extends Service { * @returns {Promise.<{ _id, _version, _source }>} */ async deleteFields( - index, - collection, - id, - fields, - { refresh, userId = null } = {} + index: string, + collection: string, + id: string, + fields: string, + { refresh, userId = null } ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -1123,11 +1140,11 @@ class ElasticSearch extends Service { * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ async updateByQuery( - index, - collection, - query, - changes, - { refresh, size = 1000, userId = null } = {} + index: string, + collection: string, + query: string, + changes: JSONObject, + { refresh, size = 1000, userId = null } ) { try { const esRequest = { @@ -1176,11 +1193,11 @@ class ElasticSearch extends Service { * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ async bulkUpdateByQuery( - index, - collection, - query, - changes, - { refresh = "false" } = {} + index: string, + collection: string, + query: JSONObject, + changes: JSONObject, + { refresh = false } ) { const script = { params: {}, @@ -1194,7 +1211,7 @@ class ElasticSearch extends Service { script.params[key] = value; } - const esRequest = { + const esRequest: RequestParams.UpdateByQuery> = { body: { query: this._sanitizeSearchBody({ query }).query, script, @@ -1239,13 +1256,13 @@ class ElasticSearch extends Service { * @returns {Promise.} Array of results returned by the callback */ async mExecute( - index, - collection, - query, - callback, + index: string, + collection: string, + query: JSONObject, + callback: Function, { size = 10, scrollTTl = "5s" } = {} ) { - const esRequest = { + const esRequest: RequestParams.Search = { body: this._sanitizeSearchBody({ query }), from: 0, index: this._getAlias(index, collection), @@ -1288,7 +1305,7 @@ class ElasticSearch extends Service { { scroll: esRequest.scroll, scrollId: _scroll_id, - }, + } as RequestParams.Scroll, getMoreUntilDone ); } else { @@ -1316,13 +1333,13 @@ class ElasticSearch extends Service { * * @returns {Promise} */ - async createIndex(index) { + async createIndex(index: string) { this._assertValidIndexAndCollection(index); - let body; + let body: ApiResponse>["body"]; try { - ({ body } = await this._client.cat.aliases({ format: "json" })); // NOSONAR + body = (await this._client.cat.aliases({ format: "json" })).body; } catch (error) { throw this._esWrapper.formatESError(error); } @@ -1357,9 +1374,12 @@ class ElasticSearch extends Service { * @returns {Promise} */ async createCollection( - index, - collection, - { mappings = {}, settings = {} } = {} + index: string, + collection: string, + { + mappings = {}, + settings = {}, + }: { mappings?: TypeMapping; settings?: Record } ) { this._assertValidIndexAndCollection(index, collection); @@ -1380,7 +1400,7 @@ class ElasticSearch extends Service { await mutex.unlock(); } - const esRequest = { + const esRequest: RequestParams.IndicesCreate> = { body: { aliases: { [this._getAlias(index, collection)]: {}, @@ -1444,9 +1464,9 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ settings }>} */ - async getSettings(index, collection) { + async getSettings(index: string, collection: string) { const indice = await this._getIndice(index, collection); - const esRequest = { + const esRequest: RequestParams.IndicesGetSettings = { index: indice, }; @@ -1470,7 +1490,11 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ dynamic, _meta, properties }>} */ - async getMapping(index, collection, { includeKuzzleMeta = false } = {}) { + async getMapping( + index: string, + collection: string, + { includeKuzzleMeta = false } + ) { const indice = await this._getIndice(index, collection); const esRequest = { index: indice, @@ -1505,9 +1529,12 @@ class ElasticSearch extends Service { * @returns {Promise} */ async updateCollection( - index, - collection, - { mappings = {}, settings = {} } = {} + index: string, + collection: string, + { + mappings = {}, + settings = {}, + }: { mappings?: TypeMapping; settings?: Record } ) { const esRequest = { index: await this._getIndice(index, collection), @@ -1518,6 +1545,7 @@ class ElasticSearch extends Service { // update the settings first, then the mappings and we rollback the settings // if putMappings fail. let indexSettings; + try { indexSettings = await this._getSettings(esRequest); } catch (error) { @@ -1530,7 +1558,9 @@ class ElasticSearch extends Service { try { if (!_.isEmpty(mappings)) { - const previousMappings = await this.getMapping(index, collection); + const previousMappings = await this.getMapping(index, collection, { + includeKuzzleMeta: true, + }); await this.updateMapping(index, collection, mappings); @@ -1576,8 +1606,8 @@ class ElasticSearch extends Service { * @param {String} collection - Collection name * @returns {Promise.} {} */ - async updateSearchIndex(index, collection) { - const esRequest = { + async updateSearchIndex(index: string, collection: string) { + const esRequest: RequestParams.UpdateByQuery> = { body: {}, // @cluster: conflicts when two nodes start at the same time conflicts: "proceed", @@ -1586,7 +1616,7 @@ class ElasticSearch extends Service { // This operation can take some time: this should be an ES // background task. And it's preferable to a request timeout when // processing large indexes. - waitForCompletion: false, + wait_for_completion: false, }; debug("UpdateByQuery: %o", esRequest); @@ -1607,14 +1637,21 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ dynamic, _meta, properties }>} */ - async updateMapping(index, collection, mappings = {}) { - const esRequest = { + async updateMapping( + index: string, + collection: string, + mappings: TypeMapping = {} + ): Promise<{ dynamic: string; _meta: JSONObject; properties: JSONObject }> { + const esRequest: RequestParams.IndicesPutMapping> = { index: this._getAlias(index, collection), + body: {}, }; this._checkDynamicProperty(mappings); - const collectionMappings = await this.getMapping(index, collection, true); + const collectionMappings = await this.getMapping(index, collection, { + includeKuzzleMeta: true, + }); this._checkMappings(mappings); @@ -1727,10 +1764,10 @@ class ElasticSearch extends Service { * @returns {Promise.<{ items, errors }> */ async import( - index, - collection, - documents, - { refresh, timeout, userId = null } = {} + index: string, + collection: string, + documents: JSONObject[], + { refresh, timeout, userId = null } ) { const alias = this._getAlias(index, collection); const actionNames = ["index", "create", "update", "delete"]; @@ -1788,7 +1825,8 @@ class ElasticSearch extends Service { } /* end critical code section */ - let response; + let response: Record; + try { response = await this._client.bulk(esRequest); } catch (error) { @@ -1815,7 +1853,7 @@ class ElasticSearch extends Service { const item = row[action]; if (item.status >= 400) { - const error = { + const error: KImportError = { _id: item._id, status: item.status, }; @@ -1887,7 +1925,7 @@ class ElasticSearch extends Service { * @returns {Promise.} Index names */ async listIndexes() { - let body; + let body: ApiResponse["body"]; try { ({ body } = await this._client.cat.aliases({ format: "json" })); @@ -1908,7 +1946,8 @@ class ElasticSearch extends Service { * @returns {Object.} Object */ async getSchema() { - let body; + let body: ApiResponse["body"]; + try { ({ body } = await this._client.cat.aliases({ format: "json" })); } catch (error) { @@ -1920,7 +1959,9 @@ class ElasticSearch extends Service { const schema = this._extractSchema(aliases, { includeHidden: true }); for (const [index, collections] of Object.entries(schema)) { - schema[index] = collections.filter((c) => c !== HIDDEN_COLLECTION); + schema[index] = (collections as string[]).filter( + (c) => c !== HIDDEN_COLLECTION + ); } return schema; @@ -1963,17 +2004,20 @@ class ElasticSearch extends Service { * * @returns {Promise} */ - async deleteCollection(index, collection) { - const esRequest = { - index: await this._getIndice(index, collection), + async deleteCollection(index: string, collection: string): Promise { + const indice = await this._getIndice(index, collection); + const esRequest: RequestParams.IndicesDelete = { + index: indice, }; try { await this._client.indices.delete(esRequest); + const alias = this._getAlias(index, collection); - if (await this._checkIfAliasExists(this._getAlias(index, collection))) { + if (await this._checkIfAliasExists(alias)) { await this._client.indices.deleteAlias({ - name: this._getAlias(index, collection), + name: alias, + index: indice, }); } @@ -1992,7 +2036,7 @@ class ElasticSearch extends Service { * * @returns {Promise.} */ - async deleteIndexes(indexes = []) { + async deleteIndexes(indexes: string[] = []) { if (indexes.length === 0) { return Bluebird.resolve([]); } @@ -2041,8 +2085,9 @@ class ElasticSearch extends Service { * * @returns {Promise} */ - async deleteIndex(index) { + async deleteIndex(index: string): Promise { await this.deleteIndexes([index]); + return null; } @@ -2057,12 +2102,12 @@ class ElasticSearch extends Service { * * @returns {Promise.} { _shards } */ - async refreshCollection(index, collection) { - const esRequest = { + async refreshCollection(index: string, collection: string) { + const esRequest: RequestParams.IndicesRefresh = { index: this._getAlias(index, collection), }; - let _shards; + let _shards: any; try { ({ @@ -2084,8 +2129,12 @@ class ElasticSearch extends Service { * * @returns {Promise.} */ - async exists(index, collection, id) { - const esRequest = { + async exists( + index: string, + collection: string, + id: string + ): Promise { + const esRequest: RequestParams.Exists = { id, index: this._getAlias(index, collection), }; @@ -2110,13 +2159,13 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ items: Array<{ _id, _source, _version }>, errors }>} */ - async mExists(index, collection, ids) { + async mExists(index: string, collection: string, ids: string[]) { if (ids.length === 0) { return { errors: [], item: [] }; } - const esRequest = { - _source: false, + const esRequest: RequestParams.Mget = { + _source: "false", body: { docs: ids.map((_id) => ({ _id })), }, @@ -2156,7 +2205,7 @@ class ElasticSearch extends Service { * * @returns {Promise.} */ - async hasIndex(index) { + async hasIndex(index: string): Promise { const indexes = await this.listIndexes(); return indexes.some((idx) => idx === index); @@ -2170,10 +2219,10 @@ class ElasticSearch extends Service { * * @returns {Promise.} */ - async hasCollection(index, collection) { + async hasCollection(index: string, collection: string): Promise { const collections = await this.listCollections(index); - return collections.some((col) => col === collection); + return collections.some((col: string) => col === collection); } /** @@ -2204,10 +2253,14 @@ class ElasticSearch extends Service { * @returns {Promise.} { items, errors } */ async mCreate( - index, - collection, - documents, - { refresh, timeout, userId = null } = {} + index: string, + collection: string, + documents: string[], + { + refresh, + timeout, + userId = null, + }: { refresh?: string; timeout?: number; userId?: string } = {} ) { const alias = this._getAlias(index, collection), kuzzleMeta = { @@ -2296,9 +2349,9 @@ class ElasticSearch extends Service { * @returns {Promise.<{ items, errors }> */ async mCreateOrReplace( - index, - collection, - documents, + index: string, + collection: string, + documents: JSONObject[], { refresh, timeout, @@ -2306,6 +2359,13 @@ class ElasticSearch extends Service { injectKuzzleMeta = true, limits = true, source = true, + }: { + refresh?: string; + timeout?: number; + userId?: string; + injectKuzzleMeta?: boolean; + limits?: boolean; + source?: boolean; } = {} ) { let kuzzleMeta = {}; @@ -2373,7 +2433,12 @@ class ElasticSearch extends Service { index, collection, documents, - { refresh, retryOnConflict = 0, timeout, userId = null } = {} + { + refresh = undefined, + retryOnConflict = 0, + timeout = undefined, + userId = null, + } ) { const alias = this._getAlias(index, collection), toImport = [], @@ -2461,10 +2526,20 @@ class ElasticSearch extends Service { * @returns {Promise.<{ items, errors }> */ async mUpsert( - index, - collection, - documents, - { refresh, retryOnConflict = 0, timeout, userId = null } = {} + index: string, + collection: string, + documents: JSONObject[], + { + refresh, + retryOnConflict = 0, + timeout, + userId = null, + }: { + refresh?: string; + retryOnConflict?: number; + timeout?: number; + userId?: string; + } = {} ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -2560,10 +2635,18 @@ class ElasticSearch extends Service { * @returns {Promise.} { items, errors } */ async mReplace( - index, - collection, - documents, - { refresh, timeout, userId = null } = {} + index: string, + collection: string, + documents: JSONObject[], + { + refresh, + timeout, + userId = null, + }: { + refresh?: string; + timeout?: number; + userId?: string; + } = {} ) { const alias = this._getAlias(index, collection), kuzzleMeta = { @@ -2644,7 +2727,18 @@ class ElasticSearch extends Service { * * @returns {Promise.<{ documents, errors }> */ - async mDelete(index, collection, ids, { refresh, timeout } = {}) { + async mDelete( + index: string, + collection: string, + ids: string[], + { + refresh, + timeout, + }: { + refresh?: string; + timeout?: number; + } = {} + ) { const query = { ids: { values: [] } }; const validIds = []; const partialErrors = []; @@ -2698,10 +2792,14 @@ class ElasticSearch extends Service { // @todo duplicated query to get documents body, mGet here and search in // deleteByQuery - const { documents } = await this.deleteByQuery(index, collection, query, { - refresh, - timeout, - }); + const { documents } = await this.deleteByQuery( + index, + collection, + JSON.stringify(query), + { + refresh, + } + ); return { documents, errors: partialErrors }; } @@ -2957,7 +3055,7 @@ class ElasticSearch extends Service { * @returns {String} Indice name (eg: '&nepali.liia') * @throws If there is not exactly one indice associated */ - async _getIndice(index, collection) { + async _getIndice(index: string, collection: string): Promise { const alias = `${ALIAS_PREFIX}${this._indexPrefix}${index}${NAME_SEPARATOR}${collection}`; const { body } = await this._client.cat.aliases({ format: "json", @@ -2984,9 +3082,11 @@ class ElasticSearch extends Service { * @return {Promise<*>} the settings of the indice. * @private */ - async _getSettings(esRequest) { + async _getSettings(esRequest: RequestParams.IndicesGetSettings) { const response = await this._client.indices.getSettings(esRequest); - return response.body[esRequest.index].settings; + const index = esRequest.index as string; + + return response.body[index].settings; } /** @@ -2998,7 +3098,10 @@ class ElasticSearch extends Service { * * @returns {String} Available indice name (eg: '&nepali.liia2') */ - async _getAvailableIndice(index, collection) { + async _getAvailableIndice( + index: string, + collection: string + ): Promise { let indice = this._getAlias(index, collection).substr( INDEX_PREFIX_POSITION_IN_ALIAS ); @@ -3020,9 +3123,11 @@ class ElasticSearch extends Service { .toString(); } - notAvailable = await this._client.indices.exists({ + const response = await this._client.indices.exists({ index: indice + suffix, - }).body; + }); + + notAvailable = response.body; } while (notAvailable); return indice + suffix; @@ -3135,6 +3240,7 @@ class ElasticSearch extends Service { * @returns {Object.} Indexes as key and an array of their collections as value */ _extractSchema(aliases, { includeHidden = false } = {}) { + console.log("ALIAS", aliases); const schema = {}; for (const alias of aliases) { @@ -3214,7 +3320,7 @@ class ElasticSearch extends Service { return "all"; } - return 1; + return "1"; } /** @@ -3243,7 +3349,7 @@ class ElasticSearch extends Service { } = await this._client.scroll({ scroll: esRequest.scroll, scrollId: _scroll_id, - })); + } as RequestParams.Scroll)); documents = documents.concat( hits.hits.map((h) => ({ @@ -3330,10 +3436,10 @@ class ElasticSearch extends Service { * @param {[type]} id [description] * @returns {[type]} [description] */ - async clearScroll(id) { + async clearScroll(id: string) { if (id) { debug("clearing scroll: %s", id); - await this._client.clearScroll({ scrollId: id }); + await this._client.clearScroll({ scroll_id: id }); } } @@ -3402,7 +3508,7 @@ class ElasticSearch extends Service { try { // Wait for at least 1 shard to be initialized const health = await this._client.cluster.health({ - waitForNoInitializingShards: true, + wait_for_no_initializing_shards: true, }); if (health.body.number_of_pending_tasks === 0) { @@ -3450,8 +3556,6 @@ class ElasticSearch extends Service { } } -module.exports = ElasticSearch; - /** * Finds paths and values of mappings dynamic properties * @@ -3501,7 +3605,7 @@ function assertWellFormedRefresh(esRequest) { } } -function getKuid(userId) { +function getKuid(userId: string): string | null { if (!userId) { return null; } @@ -3524,7 +3628,7 @@ function getKuid(userId) { * @param {string} name * @returns {Boolean} */ -function _isObjectNameValid(name) { +function _isObjectNameValid(name: string): boolean { if (typeof name !== "string" || name.length === 0) { return false; } diff --git a/lib/types/storage/Elasticsearch.ts b/lib/types/storage/Elasticsearch.ts new file mode 100644 index 0000000000..4ac98d8235 --- /dev/null +++ b/lib/types/storage/Elasticsearch.ts @@ -0,0 +1,33 @@ +import { ByteSize, ClusterNodesStats } from "@elastic/elasticsearch/api/types"; + +export type InfoResult = { + type: string; + version: string; + status?: string; + lucene?: string; + spaceUsed?: ByteSize; + nodes?: ClusterNodesStats; +}; + +export type KRequestBody = T & { + _kuzzle_info?: { + author: string; + createdAt: number; + updatedAt: number | null; + updater: string | null; + }; +}; + +export interface JSONObject { + [key: string]: JSONObject | any; +} + +export type KImportError = { + _id: string; + status: string; + _source?: JSONObject; + error?: { + reason: string; + type: string; + } +}; diff --git a/test/mocks/elasticsearch.mock.js b/test/mocks/elasticsearch.mock.js index 4c963a7107..b34ee7006a 100644 --- a/test/mocks/elasticsearch.mock.js +++ b/test/mocks/elasticsearch.mock.js @@ -1,9 +1,9 @@ "use strict"; const sinon = require("sinon"); -const Elasticsearch = require("../../lib/service/storage/elasticsearch"); +const { ElasticSearch } = require("../../lib/service/storage/elasticsearch"); -class ElasticsearchMock extends Elasticsearch { +class ElasticsearchMock extends ElasticSearch { constructor(kuzzle, config, scope) { super(kuzzle, config, scope); From 2396aad66e498ae66c26cc9fc07c53e5730b68a9 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 09:39:45 +0200 Subject: [PATCH 02/28] Update default parameters --- lib/service/storage/elasticsearch.ts | 152 +++++++++++++++++++++++---- 1 file changed, 133 insertions(+), 19 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 2746147469..b618617524 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -389,8 +389,26 @@ export class ElasticSearch extends Service { * @returns {Promise.<{ scrollId, hits, aggregations, suggest, total }>} */ async search( - { index, collection, searchBody, targets }, - { from, size, scroll } + { + index, + collection, + searchBody, + targets, + }: { + index?: string; + collection?: string; + searchBody?: JSONObject; + targets?: any[]; + } = {}, + { + from, + size, + scroll, + }: { + from?: number; + size?: number; + scroll?: string; + } = {} ) { let esIndexes: any; @@ -485,7 +503,7 @@ export class ElasticSearch extends Service { return aliasToTargets; } - async _formatSearchResult(body: any, searchInfo: any) { + async _formatSearchResult(body: any, searchInfo: any = {}) { let aliasToTargets = {}; const aliasCache = new Map(); @@ -698,7 +716,17 @@ export class ElasticSearch extends Service { index: string, collection: string, content: JSONObject, - { id, refresh, userId = null, injectKuzzleMeta = true } + { + id, + refresh, + userId = null, + injectKuzzleMeta = true, + }: { + id?: string; + refresh?: boolean | "wait_for"; + userId?: string; + injectKuzzleMeta?: boolean; + } = {} ) { assertIsObject(content); @@ -754,7 +782,15 @@ export class ElasticSearch extends Service { collection, id, content, - { refresh, userId = null, injectKuzzleMeta = true } + { + refresh, + userId = null, + injectKuzzleMeta = true, + }: { + refresh?: boolean | "wait_for"; + userId?: string; + injectKuzzleMeta?: boolean; + } = {} ) { const esRequest = { body: content, @@ -808,7 +844,17 @@ export class ElasticSearch extends Service { collection: string, id: string, content: JSONObject, - { refresh, userId = null, retryOnConflict, injectKuzzleMeta = true } + { + refresh, + userId = null, + retryOnConflict, + injectKuzzleMeta = true, + }: { + refresh?: boolean | "wait_for"; + userId?: string; + retryOnConflict?: number; + injectKuzzleMeta?: boolean; + } = {} ) { const esRequest: RequestParams.Update> = { _source: "true", @@ -868,7 +914,13 @@ export class ElasticSearch extends Service { userId = null, retryOnConflict, injectKuzzleMeta = true, - } + }: { + defaultValues?: JSONObject; + refresh?: boolean | "wait_for"; + userId?: string; + retryOnConflict?: number; + injectKuzzleMeta?: boolean; + } = {} ) { const esRequest: RequestParams.Update> = { _source: "true", @@ -933,7 +985,15 @@ export class ElasticSearch extends Service { collection: string, id: string, content: JSONObject, - { refresh, userId = null, injectKuzzleMeta = true } + { + refresh, + userId = null, + injectKuzzleMeta = true, + }: { + refresh?: boolean | "wait_for"; + userId?: string; + injectKuzzleMeta?: boolean; + } = {} ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -987,7 +1047,16 @@ export class ElasticSearch extends Service { * * @returns {Promise} */ - async delete(index: string, collection: string, id: string, { refresh }) { + async delete( + index: string, + collection: string, + id: string, + { + refresh, + }: { + refresh?: boolean | "wait_for"; + } = {} + ) { const esRequest = { id, index: this._getAlias(index, collection), @@ -1026,7 +1095,15 @@ export class ElasticSearch extends Service { index: string, collection: string, query: string, - { refresh, size = 1000, fetch = true } + { + refresh, + size = 1000, + fetch = true, + }: { + refresh?: boolean | "wait_for"; + size?: number; + fetch?: boolean; + } = {} ) { const esRequest: RequestParams.DeleteByQuery> = { body: this._sanitizeSearchBody({ query }), @@ -1082,7 +1159,13 @@ export class ElasticSearch extends Service { collection: string, id: string, fields: string, - { refresh, userId = null } + { + refresh, + userId = null, + }: { + refresh?: boolean | "wait_for"; + userId?: string; + } = {} ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -1144,7 +1227,15 @@ export class ElasticSearch extends Service { collection: string, query: string, changes: JSONObject, - { refresh, size = 1000, userId = null } + { + refresh, + size = 1000, + userId = null, + }: { + refresh?: boolean | "wait_for"; + size?: number; + userId?: string; + } = {} ) { try { const esRequest = { @@ -1197,7 +1288,11 @@ export class ElasticSearch extends Service { collection: string, query: JSONObject, changes: JSONObject, - { refresh = false } + { + refresh = false, + }: { + refresh?: boolean; + } = {} ) { const script = { params: {}, @@ -1223,6 +1318,7 @@ export class ElasticSearch extends Service { debug("Bulk Update by query: %o", esRequest); let response; + try { response = await this._client.updateByQuery(esRequest); } catch (error) { @@ -1260,7 +1356,13 @@ export class ElasticSearch extends Service { collection: string, query: JSONObject, callback: Function, - { size = 10, scrollTTl = "5s" } = {} + { + size = 10, + scrollTTl = "5s", + }: { + size?: number; + scrollTTl?: string; + } = {} ) { const esRequest: RequestParams.Search = { body: this._sanitizeSearchBody({ query }), @@ -1379,7 +1481,7 @@ export class ElasticSearch extends Service { { mappings = {}, settings = {}, - }: { mappings?: TypeMapping; settings?: Record } + }: { mappings?: TypeMapping; settings?: Record } = {} ) { this._assertValidIndexAndCollection(index, collection); @@ -1493,7 +1595,11 @@ export class ElasticSearch extends Service { async getMapping( index: string, collection: string, - { includeKuzzleMeta = false } + { + includeKuzzleMeta = false, + }: { + includeKuzzleMeta?: boolean; + } = {} ) { const indice = await this._getIndice(index, collection); const esRequest = { @@ -1534,7 +1640,7 @@ export class ElasticSearch extends Service { { mappings = {}, settings = {}, - }: { mappings?: TypeMapping; settings?: Record } + }: { mappings?: TypeMapping; settings?: Record } = {} ) { const esRequest = { index: await this._getIndice(index, collection), @@ -1767,7 +1873,15 @@ export class ElasticSearch extends Service { index: string, collection: string, documents: JSONObject[], - { refresh, timeout, userId = null } + { + refresh, + timeout, + userId = null, + }: { + refresh?: boolean | "wait_for"; + timeout?: string; + userId?: string; + } = {} ) { const alias = this._getAlias(index, collection); const actionNames = ["index", "create", "update", "delete"]; @@ -2735,7 +2849,7 @@ export class ElasticSearch extends Service { refresh, timeout, }: { - refresh?: string; + refresh?: boolean | "wait_for"; timeout?: number; } = {} ) { From 1d07b8d66d64756d410ef78ae7c6d7f85111d498 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 09:46:04 +0200 Subject: [PATCH 03/28] Update docker compose --- docker-compose.yml | 50 ++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 795e9f90d9..58827fe9cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,6 +47,8 @@ services: container_name: kuzzle_nginx depends_on: - kuzzle_node_1 + - kuzzle_node_2 + - kuzzle_node_3 ports: - '7512:7512' volumes: @@ -65,31 +67,31 @@ services: interval: 2s retries: 10 - # kuzzle_node_2: - # <<: *kuzzle-config - # container_name: kuzzle_node_2 - # ports: - # - '17511:7512' # Kuzzle API port - # - '11883:1883' # Kuzzle MQTT port - # - '9230:9229' # Debug port - # healthcheck: - # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - # timeout: 1s - # interval: 2s - # retries: 10 + kuzzle_node_2: + <<: *kuzzle-config + container_name: kuzzle_node_2 + ports: + - '17511:7512' # Kuzzle API port + - '11883:1883' # Kuzzle MQTT port + - '9230:9229' # Debug port + healthcheck: + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + timeout: 1s + interval: 2s + retries: 10 - # kuzzle_node_3: - # <<: *kuzzle-config - # container_name: kuzzle_node_3 - # ports: - # - '17512:7512' # Kuzzle API port - # - '11884:1883' # Kuzzle MQTT port - # - '9231:9229' # Debug port - # healthcheck: - # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - # timeout: 1s - # interval: 2s - # retries: 10 + kuzzle_node_3: + <<: *kuzzle-config + container_name: kuzzle_node_3 + ports: + - '17512:7512' # Kuzzle API port + - '11884:1883' # Kuzzle MQTT port + - '9231:9229' # Debug port + healthcheck: + test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + timeout: 1s + interval: 2s + retries: 10 redis: image: redis:6 From f333d5ae829093a04c9f93808da988eb589c7ed9 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 13:11:53 +0200 Subject: [PATCH 04/28] Update imports, lint & types --- lib/service/storage/elasticsearch.ts | 48 +++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index b618617524..28d0221720 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -36,23 +36,24 @@ import { Index } from "@elastic/elasticsearch/api/requestParams"; import { TypeMapping } from "@elastic/elasticsearch/api/types"; -const assert = require("assert"); -const ms = require("ms"); -const Bluebird = require("bluebird"); -const semver = require("semver"); +import assert from "assert"; + +import ms from "ms"; +import Bluebird from "bluebird"; +import semver from "semver"; const debug = require("../../util/debug")("kuzzle:services:elasticsearch"); -const ESWrapper = require("./esWrapper"); -const QueryTranslator = require("./queryTranslator"); -const didYouMean = require("../../util/didYouMean"); -const Service = require("../service"); -const { assertIsObject } = require("../../util/requestAssertions"); +import ESWrapper from "./esWrapper"; +import QueryTranslator from "./queryTranslator"; +import didYouMean from "../../util/didYouMean"; +import Service from "../service"; +import { assertIsObject } from "../../util/requestAssertions"; const kerror = require("../../kerror").wrap("services", "storage"); -const { isPlainObject } = require("../../util/safeObject"); -const scopeEnum = require("../../core/storage/storeScopeEnum"); -const extractFields = require("../../util/extractFields"); -const { Mutex } = require("../../util/mutex"); -const { randomNumber } = require("../../util/name-generator"); +import { isPlainObject } from "../../util/safeObject"; +import scopeEnum from "../../core/storage/storeScopeEnum"; +import extractFields from "../../util/extractFields"; +import { Mutex } from "../../util/mutex"; +import { randomNumber } from "../../util/name-generator"; const SCROLL_CACHE_PREFIX = "_docscroll_"; @@ -92,6 +93,17 @@ let esState = esStateEnum.NONE; */ export class ElasticSearch extends Service { public _client: StorageClient; + public _scope: scopeEnum; + public _indexPrefix: string; + public _esWrapper: ESWrapper; + public _esVersion: any; + public _translator: QueryTranslator; + public searchBodyKeys: string[]; + public scriptKeys: string[]; + public scriptAllowedArgs: string[]; + public maxScrollDuration: number; + public scrollTTL: number; + public _config: any; /** * Returns a new elasticsearch client instance @@ -1534,11 +1546,11 @@ export class ElasticSearch extends Service { esRequest.body.settings.number_of_replicas = esRequest.body.settings.number_of_replicas || - this.config.defaultSettings.number_of_replicas; + this._config.defaultSettings.number_of_replicas; esRequest.body.settings.number_of_shards = esRequest.body.settings.number_of_shards || - this.config.defaultSettings.number_of_shards; + this._config.defaultSettings.number_of_shards; try { await this._client.indices.create(esRequest); @@ -3401,8 +3413,8 @@ export class ElasticSearch extends Service { [this._getAlias(index, HIDDEN_COLLECTION)]: {}, }, settings: { - number_of_replicas: this.config.defaultSettings.number_of_replicas, - number_of_shards: this.config.defaultSettings.number_of_shards, + number_of_replicas: this._config.defaultSettings.number_of_replicas, + number_of_shards: this._config.defaultSettings.number_of_shards, }, }, index: await this._getAvailableIndice(index, HIDDEN_COLLECTION), From 4acba1f71a683d4cf30ef67f011763d2e83f66ba Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 13:50:43 +0200 Subject: [PATCH 05/28] fix(lint): fixed lint and ts issues in elasticsearch file --- lib/service/storage/elasticsearch.ts | 117 ++++++++++++++++++++------- lib/types/storage/Elasticsearch.ts | 2 +- 2 files changed, 91 insertions(+), 28 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 28d0221720..d5d4be1170 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -41,20 +41,22 @@ import assert from "assert"; import ms from "ms"; import Bluebird from "bluebird"; import semver from "semver"; +import debug from "../../util/debug"; -const debug = require("../../util/debug")("kuzzle:services:elasticsearch"); import ESWrapper from "./esWrapper"; import QueryTranslator from "./queryTranslator"; import didYouMean from "../../util/didYouMean"; import Service from "../service"; +import * as kerror from "../../kerror"; import { assertIsObject } from "../../util/requestAssertions"; -const kerror = require("../../kerror").wrap("services", "storage"); import { isPlainObject } from "../../util/safeObject"; import scopeEnum from "../../core/storage/storeScopeEnum"; import extractFields from "../../util/extractFields"; import { Mutex } from "../../util/mutex"; import { randomNumber } from "../../util/name-generator"; +debug("kuzzle:services:elasticsearch"); + const SCROLL_CACHE_PREFIX = "_docscroll_"; const ROOT_MAPPING_PROPERTIES = [ @@ -213,7 +215,12 @@ export class ElasticSearch extends Service { version && !semver.satisfies(semver.coerce(version.number), ">= 7.0.0") ) { - throw kerror.get("version_mismatch", version.number); + throw kerror.get( + "services", + "storage", + "version_mismatch", + version.number + ); } this._esVersion = version; @@ -347,7 +354,12 @@ export class ElasticSearch extends Service { const scrollDuration = ms(_scrollTTL); if (scrollDuration > this.maxScrollDuration) { - throw kerror.get("scroll_duration_too_great", _scrollTTL); + throw kerror.get( + "services", + "storage", + "scroll_duration_too_great", + _scrollTTL + ); } } @@ -357,7 +369,7 @@ export class ElasticSearch extends Service { ); if (!stringifiedScrollInfo) { - throw kerror.get("unknown_scroll_id"); + throw kerror.get("services", "storage", "unknown_scroll_id"); } const scrollInfo = JSON.parse(stringifiedScrollInfo); @@ -452,7 +464,12 @@ export class ElasticSearch extends Service { const scrollDuration = ms(scroll); if (scrollDuration > this.maxScrollDuration) { - throw kerror.get("scroll_duration_too_great", scroll); + throw kerror.get( + "services", + "storage", + "scroll_duration_too_great", + scroll + ); } } @@ -615,7 +632,7 @@ export class ElasticSearch extends Service { // Without this test we return something weird: a result.hits.hits with all // document without filter because the body is empty in HTTP by default if (esRequest.id === "_search") { - return kerror.reject("search_as_an_id"); + return kerror.reject("services", "storage", "search_as_an_id"); } debug("Get document: %o", esRequest); @@ -1032,7 +1049,14 @@ export class ElasticSearch extends Service { const { body: exists } = await this._client.exists({ id, index: alias }); if (!exists) { - throw kerror.get("not_found", id, index, collection); + throw kerror.get( + "services", + "storage", + "not_found", + id, + index, + collection + ); } debug("Replace document: %o", esRequest); @@ -1125,7 +1149,7 @@ export class ElasticSearch extends Service { }; if (!isPlainObject(query)) { - throw kerror.get("missing_argument", "body.query"); + throw kerror.get("services", "storage", "missing_argument", "body.query"); } try { @@ -1343,7 +1367,13 @@ export class ElasticSearch extends Service { shardId, })); - throw kerror.get("incomplete_update", response.body.updated, errors); + throw kerror.get( + "services", + "storage", + "incomplete_update", + response.body.updated, + errors + ); } return { @@ -1367,7 +1397,7 @@ export class ElasticSearch extends Service { index: string, collection: string, query: JSONObject, - callback: Function, + callback: any, { size = 10, scrollTTl = "5s", @@ -1385,7 +1415,7 @@ export class ElasticSearch extends Service { }; if (!isPlainObject(query)) { - throw kerror.get("missing_argument", "body.query"); + throw kerror.get("services", "storage", "missing_argument", "body.query"); } const client = this._client; @@ -1468,7 +1498,13 @@ export class ElasticSearch extends Service { ? "private" : "public"; - throw kerror.get("index_already_exists", indexType, index); + throw kerror.get( + "services", + "storage", + "index_already_exists", + indexType, + index + ); } } @@ -1498,7 +1534,12 @@ export class ElasticSearch extends Service { this._assertValidIndexAndCollection(index, collection); if (collection === HIDDEN_COLLECTION) { - throw kerror.get("collection_reserved", HIDDEN_COLLECTION); + throw kerror.get( + "services", + "storage", + "collection_reserved", + HIDDEN_COLLECTION + ); } const mutex = new Mutex(`hiddenCollection/create/${index}`); @@ -1761,8 +1802,8 @@ export class ElasticSearch extends Service { mappings: TypeMapping = {} ): Promise<{ dynamic: string; _meta: JSONObject; properties: JSONObject }> { const esRequest: RequestParams.IndicesPutMapping> = { - index: this._getAlias(index, collection), body: {}, + index: this._getAlias(index, collection), }; this._checkDynamicProperty(mappings); @@ -2142,8 +2183,8 @@ export class ElasticSearch extends Service { if (await this._checkIfAliasExists(alias)) { await this._client.indices.deleteAlias({ - name: alias, index: indice, + name: alias, }); } @@ -2859,7 +2900,6 @@ export class ElasticSearch extends Service { ids: string[], { refresh, - timeout, }: { refresh?: boolean | "wait_for"; timeout?: number; @@ -3132,6 +3172,8 @@ export class ElasticSearch extends Service { const currentPath = [...path, property].join("."); throw kerror.get( + "services", + "storage", "invalid_mapping", currentPath, didYouMean(property, mappingProperties) @@ -3189,9 +3231,11 @@ export class ElasticSearch extends Service { }); if (body.length < 1) { - throw kerror.get("unknown_index_collection"); + throw kerror.get("services", "storage", "unknown_index_collection"); } else if (body.length > 1) { throw kerror.get( + "services", + "storage", "multiple_indice_alias", `"alias" starting with "${ALIAS_PREFIX}"`, '"indices"' @@ -3274,7 +3318,7 @@ export class ElasticSearch extends Service { ); if (aliases.length < 1) { - throw kerror.get("unknown_index_collection"); + throw kerror.get("services", "storage", "unknown_index_collection"); } return aliases; @@ -3322,11 +3366,16 @@ export class ElasticSearch extends Service { */ _assertValidIndexAndCollection(index, collection = null) { if (!this.isIndexNameValid(index)) { - throw kerror.get("invalid_index_name", index); + throw kerror.get("services", "storage", "invalid_index_name", index); } if (collection !== null && !this.isCollectionNameValid(collection)) { - throw kerror.get("invalid_collection_name", collection); + throw kerror.get( + "services", + "storage", + "invalid_collection_name", + collection + ); } } @@ -3366,7 +3415,6 @@ export class ElasticSearch extends Service { * @returns {Object.} Indexes as key and an array of their collections as value */ _extractSchema(aliases, { includeHidden = false } = {}) { - console.log("ALIAS", aliases); const schema = {}; for (const alias of aliases) { @@ -3464,7 +3512,7 @@ export class ElasticSearch extends Service { } = await this._client.search(esRequest); if (hits.total.value > global.kuzzle.config.limits.documentsWriteCount) { - throw kerror.get("write_limit_exceeded"); + throw kerror.get("services", "storage", "write_limit_exceeded"); } let documents = hits.hits.map((h) => ({ _id: h._id, _source: h._source })); @@ -3500,7 +3548,7 @@ export class ElasticSearch extends Service { // Only allow a whitelist of top level properties for (const key of Object.keys(searchBody)) { if (searchBody[key] !== undefined && !this.searchBodyKeys.includes(key)) { - throw kerror.get("invalid_search_query", key); + throw kerror.get("services", "storage", "invalid_search_query", key); } } @@ -3528,7 +3576,12 @@ export class ElasticSearch extends Service { if (this.scriptKeys.includes(key)) { for (const scriptArg of Object.keys(value)) { if (!this.scriptAllowedArgs.includes(scriptArg)) { - throw kerror.get("invalid_query_keyword", `${key}.${scriptArg}`); + throw kerror.get( + "services", + "storage", + "invalid_query_keyword", + `${key}.${scriptArg}` + ); } } } @@ -3663,6 +3716,8 @@ export class ElasticSearch extends Service { _.set(mappings, path, value.toString()); } else if (typeof value !== "string") { throw kerror.get( + "services", + "storage", "invalid_mapping", path, "Dynamic property value should be a string." @@ -3671,6 +3726,8 @@ export class ElasticSearch extends Service { if (!DYNAMIC_PROPERTY_VALUES.includes(value.toString())) { throw kerror.get( + "services", + "storage", "invalid_mapping", path, `Incorrect dynamic property value (${value}). Should be one of "${DYNAMIC_PROPERTY_VALUES.join( @@ -3715,7 +3772,7 @@ function findDynamic(mappings, path = [], results = {}) { */ function assertNoRouting(esRequest) { if (esRequest.body._routing) { - throw kerror.get("no_routing"); + throw kerror.get("services", "storage", "no_routing"); } } @@ -3727,7 +3784,13 @@ function assertNoRouting(esRequest) { */ function assertWellFormedRefresh(esRequest) { if (!["wait_for", "false", false, undefined].includes(esRequest.refresh)) { - throw kerror.get("invalid_argument", "refresh", '"wait_for", false'); + throw kerror.get( + "services", + "storage", + "invalid_argument", + "refresh", + '"wait_for", false' + ); } } diff --git a/lib/types/storage/Elasticsearch.ts b/lib/types/storage/Elasticsearch.ts index 4ac98d8235..d5ac188908 100644 --- a/lib/types/storage/Elasticsearch.ts +++ b/lib/types/storage/Elasticsearch.ts @@ -29,5 +29,5 @@ export type KImportError = { error?: { reason: string; type: string; - } + }; }; From 69f96cb60c59ce5eb20b6aa0ac4bf5c3a5681739 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Sep 2023 15:57:56 +0200 Subject: [PATCH 06/28] Typescript update --- lib/service/storage/elasticsearch.ts | 12 +++--------- lib/types/storage/Elasticsearch.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index d5d4be1170..dabd5f9e26 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -31,6 +31,7 @@ import { KRequestBody, JSONObject, KImportError, + KRequestParams, } from "../../types/storage/Elasticsearch"; import { Index } from "@elastic/elasticsearch/api/requestParams"; @@ -2526,14 +2527,7 @@ export class ElasticSearch extends Service { injectKuzzleMeta = true, limits = true, source = true, - }: { - refresh?: string; - timeout?: number; - userId?: string; - injectKuzzleMeta?: boolean; - limits?: boolean; - source?: boolean; - } = {} + }: KRequestParams = {} ) { let kuzzleMeta = {}; @@ -2994,7 +2988,7 @@ export class ElasticSearch extends Service { limits && documents.length > global.kuzzle.config.limits.documentsWriteCount ) { - return kerror.reject("write_limit_exceeded"); + return kerror.reject("services", "storage", "write_limit_exceeded"); } let response = { body: { items: [] } }; diff --git a/lib/types/storage/Elasticsearch.ts b/lib/types/storage/Elasticsearch.ts index d5ac188908..35fae4816b 100644 --- a/lib/types/storage/Elasticsearch.ts +++ b/lib/types/storage/Elasticsearch.ts @@ -31,3 +31,12 @@ export type KImportError = { type: string; }; }; + +export type KRequestParams = { + refresh?: string; + timeout?: number; + userId?: string; + injectKuzzleMeta?: boolean; + limits?: boolean; + source?: boolean; +}; From 6c95c7e8dbb594e1fe55a998601d2c761d9e1f27 Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 7 Sep 2023 13:35:52 +0200 Subject: [PATCH 07/28] Fixes tests on elasticsearch --- docker-compose.yml | 52 +- lib/core/backend/backendStorage.ts | 2 +- lib/core/plugin/pluginContext.ts | 2 +- lib/core/storage/clientAdapter.js | 2 +- lib/service/storage/elasticsearch.ts | 66 +- package-lock.json | 3618 +++++++++++--------- test/kuzzle/kuzzlerc.test.js | 4 +- test/mocks/elasticsearch.mock.js | 2 +- test/service/storage/elasticsearch.test.js | 34 +- 9 files changed, 2006 insertions(+), 1776 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 58827fe9cb..5bc94afedf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,8 +47,8 @@ services: container_name: kuzzle_nginx depends_on: - kuzzle_node_1 - - kuzzle_node_2 - - kuzzle_node_3 + # - kuzzle_node_2 + # - kuzzle_node_3 ports: - '7512:7512' volumes: @@ -67,31 +67,31 @@ services: interval: 2s retries: 10 - kuzzle_node_2: - <<: *kuzzle-config - container_name: kuzzle_node_2 - ports: - - '17511:7512' # Kuzzle API port - - '11883:1883' # Kuzzle MQTT port - - '9230:9229' # Debug port - healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - timeout: 1s - interval: 2s - retries: 10 + # kuzzle_node_2: + # <<: *kuzzle-config + # container_name: kuzzle_node_2 + # ports: + # - '17511:7512' # Kuzzle API port + # - '11883:1883' # Kuzzle MQTT port + # - '9230:9229' # Debug port + # healthcheck: + # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + # timeout: 1s + # interval: 2s + # retries: 10 - kuzzle_node_3: - <<: *kuzzle-config - container_name: kuzzle_node_3 - ports: - - '17512:7512' # Kuzzle API port - - '11884:1883' # Kuzzle MQTT port - - '9231:9229' # Debug port - healthcheck: - test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] - timeout: 1s - interval: 2s - retries: 10 + # kuzzle_node_3: + # <<: *kuzzle-config + # container_name: kuzzle_node_3 + # ports: + # - '17512:7512' # Kuzzle API port + # - '11884:1883' # Kuzzle MQTT port + # - '9231:9229' # Debug port + # healthcheck: + # test: ['CMD', 'curl', '-f', 'http://kuzzle:7512/_healthCheck'] + # timeout: 1s + # interval: 2s + # retries: 10 redis: image: redis:6 diff --git a/lib/core/backend/backendStorage.ts b/lib/core/backend/backendStorage.ts index 493e046a2b..c9253c4e83 100644 --- a/lib/core/backend/backendStorage.ts +++ b/lib/core/backend/backendStorage.ts @@ -21,7 +21,7 @@ import { Client } from "@elastic/elasticsearch"; -import { ElasticSearch } from "../../service/storage/elasticsearch"; +import ElasticSearch from "../../service/storage/elasticsearch"; import { JSONObject } from "../../../index"; import { ApplicationManager, Backend } from "./index"; diff --git a/lib/core/plugin/pluginContext.ts b/lib/core/plugin/pluginContext.ts index 38d2ea5a4c..21976e9391 100644 --- a/lib/core/plugin/pluginContext.ts +++ b/lib/core/plugin/pluginContext.ts @@ -27,7 +27,7 @@ import { JSONObject } from "kuzzle-sdk"; import { EmbeddedSDK } from "../shared/sdk/embeddedSdk"; import PluginRepository from "./pluginRepository"; import Store from "../shared/store"; -import { ElasticSearch } from "../../service/storage/elasticsearch"; +import ElasticSearch from "../../service/storage/elasticsearch"; import { isPlainObject } from "../../util/safeObject"; import Promback from "../../util/promback"; import { Mutex } from "../../util/mutex"; diff --git a/lib/core/storage/clientAdapter.js b/lib/core/storage/clientAdapter.js index dd4851f3ea..108f0a5071 100644 --- a/lib/core/storage/clientAdapter.js +++ b/lib/core/storage/clientAdapter.js @@ -21,7 +21,7 @@ "use strict"; -const { ElasticSearch } = require("../../service/storage/elasticsearch"); +const ElasticSearch = require("../../service/storage/elasticsearch").default; const { IndexCache } = require("./indexCache"); const { isPlainObject } = require("../../util/safeObject"); const kerror = require("../../kerror"); diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index dabd5f9e26..a26db89a27 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -33,7 +33,7 @@ import { KImportError, KRequestParams, } from "../../types/storage/Elasticsearch"; -import { Index } from "@elastic/elasticsearch/api/requestParams"; +import { Index, IndicesCreate } from "@elastic/elasticsearch/api/requestParams"; import { TypeMapping } from "@elastic/elasticsearch/api/types"; @@ -94,7 +94,7 @@ let esState = esStateEnum.NONE; * @param {storeScopeEnum} scope * @constructor */ -export class ElasticSearch extends Service { +export default class ElasticSearch extends Service { public _client: StorageClient; public _scope: scopeEnum; public _indexPrefix: string; @@ -339,15 +339,15 @@ export class ElasticSearch extends Service { * * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ - async scroll(scrollId, { scrollTTL }) { + async scroll(scrollId: string, { scrollTTL }: { scrollTTL?: string } = {}) { const _scrollTTL = scrollTTL || this._config.defaults.scrollTTL; - const esRequest = { + const esRequest: RequestParams.Scroll> = { scroll: _scrollTTL, - scrollId, + scroll_id: scrollId, }; const cacheKey = - SCROLL_CACHE_PREFIX + global.kuzzle.hash(esRequest.scrollId); + SCROLL_CACHE_PREFIX + global.kuzzle.hash(esRequest.scroll_id); debug("Scroll: %o", esRequest); @@ -608,7 +608,7 @@ export class ElasticSearch extends Service { aggregations: body.aggregations, hits, remaining: body.remaining, - scrollId: body._scroll_id, + scroll_id: body._scroll_id, suggest: body.suggest, total: body.hits.total.value, }; @@ -1131,7 +1131,7 @@ export class ElasticSearch extends Service { async deleteByQuery( index: string, collection: string, - query: string, + query: JSONObject, { refresh, size = 1000, @@ -1262,7 +1262,7 @@ export class ElasticSearch extends Service { async updateByQuery( index: string, collection: string, - query: string, + query: JSONObject, changes: JSONObject, { refresh, @@ -1449,8 +1449,8 @@ export class ElasticSearch extends Service { client.scroll( { scroll: esRequest.scroll, - scrollId: _scroll_id, - } as RequestParams.Scroll, + scroll_id: _scroll_id, + }, getMoreUntilDone ); } else { @@ -2591,15 +2591,15 @@ export class ElasticSearch extends Service { * @returns {Promise.} { items, errors } */ async mUpdate( - index, - collection, - documents, + index: string, + collection: string, + documents: JSONObject[], { refresh = undefined, retryOnConflict = 0, timeout = undefined, userId = null, - } + } = {} ) { const alias = this._getAlias(index, collection), toImport = [], @@ -2952,14 +2952,9 @@ export class ElasticSearch extends Service { // @todo duplicated query to get documents body, mGet here and search in // deleteByQuery - const { documents } = await this.deleteByQuery( - index, - collection, - JSON.stringify(query), - { - refresh, - } - ); + const { documents } = await this.deleteByQuery(index, collection, query, { + refresh, + }); return { documents, errors: partialErrors }; } @@ -3449,7 +3444,7 @@ export class ElasticSearch extends Service { return; } - const esRequest = { + const esRequest: IndicesCreate> = { body: { aliases: { [this._getAlias(index, HIDDEN_COLLECTION)]: {}, @@ -3479,7 +3474,7 @@ export class ElasticSearch extends Service { * To find the best value for this setting, we need to take into account * the number of nodes in the cluster and the number of shards per index. */ - async _getWaitForActiveShards() { + async _getWaitForActiveShards(): Promise { const { body } = await this._client.cat.nodes({ format: "json" }); const numberOfNodes = body.length; @@ -3500,7 +3495,9 @@ export class ElasticSearch extends Service { * * @returns {Promise.} resolve to an array of documents */ - async _getAllDocumentsFromQuery(esRequest) { + async _getAllDocumentsFromQuery( + esRequest: RequestParams.Search> + ) { let { body: { hits, _scroll_id }, } = await this._client.search(esRequest); @@ -3509,18 +3506,21 @@ export class ElasticSearch extends Service { throw kerror.get("services", "storage", "write_limit_exceeded"); } - let documents = hits.hits.map((h) => ({ _id: h._id, _source: h._source })); + let documents = hits.hits.map((h: JSONObject) => ({ + _id: h._id, + _source: h._source, + })); while (hits.total.value !== documents.length) { ({ body: { hits, _scroll_id }, } = await this._client.scroll({ scroll: esRequest.scroll, - scrollId: _scroll_id, - } as RequestParams.Scroll)); + scroll_id: _scroll_id, + })); documents = documents.concat( - hits.hits.map((h) => ({ + hits.hits.map((h: JSONObject) => ({ _id: h._id, _source: h._source, })) @@ -3609,7 +3609,7 @@ export class ElasticSearch extends Service { * @param {[type]} id [description] * @returns {[type]} [description] */ - async clearScroll(id: string) { + async clearScroll(id?: string) { if (id) { debug("clearing scroll: %s", id); await this._client.clearScroll({ scroll_id: id }); @@ -3836,3 +3836,7 @@ function _isObjectNameValid(name: string): boolean { return valid; } + +// TODO: Remove this function when we move to Jest +// This is kept because we use an old ReRequire that use require() instead of import +module.exports = ElasticSearch; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3f9049f953..7943b5dbe3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,6 +87,14 @@ "node": ">= 12.13.0" } }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "dev": true, @@ -273,9 +281,10 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.20.2", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -483,12 +492,12 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -578,12 +587,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", - "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.19.0" + "@babel/helper-plugin-utils": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -738,15 +747,16 @@ } }, "node_modules/@elastic/transport": { - "version": "8.3.1", - "license": "Apache-2.0", + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.3.3.tgz", + "integrity": "sha512-g5nc//dq/RQUTMkJUB8Ui8KJa/WflWmUa7yLl4SRZd67PPxIp3cn+OvGMNIhpiLRcfz1upanzgZHb/7Po2eEdQ==", "dependencies": { "debug": "^4.3.4", "hpagent": "^1.0.0", "ms": "^2.1.3", "secure-json-parse": "^2.4.0", "tslib": "^2.4.0", - "undici": "^5.5.1" + "undici": "^5.22.1" }, "engines": { "node": ">=14" @@ -754,18 +764,42 @@ }, "node_modules/@elastic/transport/node_modules/hpagent": { "version": "1.2.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", "engines": { "node": ">=14" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.0.tgz", + "integrity": "sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "license": "MIT", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -780,6 +814,14 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/js": { + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", + "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@flatten-js/interval-tree": { "version": "1.0.20", "license": "MIT" @@ -789,8 +831,9 @@ "license": "MIT" }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.8", - "license": "Apache-2.0", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", @@ -813,7 +856,8 @@ }, "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", - "license": "BSD-3-Clause" + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" }, "node_modules/@ioredis/commands": { "version": "1.2.0", @@ -919,16 +963,16 @@ } }, "node_modules/@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.4.tgz", + "integrity": "sha512-wNK6gC0Ha9QeEPSkeJedQuTQqxZYnDPuDcDhVuVatRvMkL4D0VTvFVZj+Yuh6caG2aOfzkUZ36KtCmLNtR02hw==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", "slash": "^3.0.0" }, "engines": { @@ -936,37 +980,37 @@ } }, "node_modules/@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.4.tgz", + "integrity": "sha512-U/vq5ccNTSVgYH7mHnodHmCffGWHJnz/E1BEWlLuK5pM4FZmGfBn/nrJGLjUsSmyx3otCeqc1T31F4y08AMDLg==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/reporters": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", + "jest-changed-files": "^29.6.3", + "jest-config": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-resolve-dependencies": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "jest-watcher": "^29.6.4", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "strip-ansi": "^6.0.0" }, @@ -982,135 +1026,90 @@ } } }, - "node_modules/@jest/core/node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@jest/core/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.6.4.tgz", + "integrity": "sha512-sQ0SULEjA1XUTHmkBRl7A1dyITM9yb1yb3ZNKPX3KlTd6IG7mWUe3e2yfExtC2Zz1Q+mMckOLHmL/qLiuQJrBQ==", "dev": true, "dependencies": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1" + "jest-mock": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.6.4.tgz", + "integrity": "sha512-Warhsa7d23+3X5bLbrbYvaehcgX5TLYhI03JKoedTiI8uJU4IhqYBWF7OSSgUyz4IgLpUYPkK0AehA5/fRclAA==", "dev": true, "dependencies": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" + "expect": "^29.6.4", + "jest-snapshot": "^29.6.4" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.6.4.tgz", + "integrity": "sha512-FEhkJhqtvBwgSpiTrocquJCdXPsyvNKcl/n7A3u7X4pVoF4bswm11c9d4AV+kfq2Gpv/mM8x7E7DsRvH+djkrg==", "dev": true, "dependencies": { - "jest-get-type": "^29.2.0" + "jest-get-type": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.6.4.tgz", + "integrity": "sha512-6UkCwzoBK60edXIIWb0/KWkuj7R7Qq91vVInOe3De6DSpaEiqjKcJw4F7XUet24Wupahj9J6PlR09JqJ5ySDHw==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/@jest/fake-timers/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@jest/fake-timers/node_modules/@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", - "dev": true, - "dependencies": { - "@sinonjs/commons": "^2.0.0" - } - }, "node_modules/@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.6.4.tgz", + "integrity": "sha512-wVIn5bdtjlChhXAzVXavcY/3PEjf4VqM174BM3eGL5kMxLiZD5CLnbmkEyA1Dwh9q8XjP6E8RwjBsY/iCWrWsA==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/types": "^29.6.3", + "jest-mock": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.4.tgz", + "integrity": "sha512-sxUjWxm7QdchdrD3NfWKrL8FBsortZeibSJv4XLjESOOjSUOkjQcb0ZHJwfhEGIvBvTluTzfG2yZWZhkrXJu8g==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/console": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", @@ -1118,13 +1117,13 @@ "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", @@ -1142,25 +1141,41 @@ } } }, + "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz", + "integrity": "sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "dev": true, "dependencies": { - "@sinclair/typebox": "^0.25.16" + "@sinclair/typebox": "^0.27.8" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", "dev": true, "dependencies": { - "@jridgewell/trace-mapping": "^0.3.15", + "@jridgewell/trace-mapping": "^0.3.18", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" }, @@ -1169,13 +1184,13 @@ } }, "node_modules/@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.4.tgz", + "integrity": "sha512-uQ1C0AUEN90/dsyEirgMLlouROgSY+Wc/JanVVk0OiUKa5UFh7sJpMEM3aoUBAz2BRNvUJ8j3d294WFuRxSyOQ==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/types": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, @@ -1184,14 +1199,14 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.4.tgz", + "integrity": "sha512-E84M6LbpcRq3fT4ckfKs9ryVanwkaIB0Ws9bw3/yP4seRLg/VaCZ/LgW0MCq5wwk4/iP/qnilD41aj2fsw2RMg==", "dev": true, "dependencies": { - "@jest/test-result": "^29.4.1", + "@jest/test-result": "^29.6.4", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.6.4", "slash": "^3.0.0" }, "engines": { @@ -1199,38 +1214,38 @@ } }, "node_modules/@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.6.4.tgz", + "integrity": "sha512-8thgRSiXUqtr/pPGY/OsyHuMjGyhVnWrFAwoxmIemlBuiMyU1WFs0tXoNxzcr4A4uErs/ABre76SGmrr5ab/AA==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", + "jest-haste-map": "^29.6.4", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.6.3", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" + "write-file-atomic": "^4.0.2" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dev": true, "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -1275,12 +1290,21 @@ "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.17", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "dev": true, - "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==", + "engines": { + "node": ">= 0.4" } }, "node_modules/@nodelib/fs.scandir": { @@ -1397,31 +1421,34 @@ "license": "BSD-3-Clause" }, "node_modules/@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, "node_modules/@sinonjs/commons": { - "version": "1.8.6", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" } }, "node_modules/@sinonjs/fake-timers": { - "version": "9.1.2", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^1.7.0" + "@sinonjs/commons": "^3.0.0" } }, "node_modules/@sinonjs/samsam": { "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz", + "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "@sinonjs/commons": "^2.0.0", "lodash.get": "^4.4.2", @@ -1430,8 +1457,9 @@ }, "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" } @@ -1469,9 +1497,9 @@ "license": "MIT" }, "node_modules/@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -1501,11 +1529,12 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.18.3", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/types": "^7.3.0" + "@babel/types": "^7.20.7" } }, "node_modules/@types/graceful-fs": { @@ -1539,9 +1568,9 @@ } }, "node_modules/@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", + "version": "29.5.4", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.4.tgz", + "integrity": "sha512-PhglGmhWeD46FYOVLt3X7TiWjzwuVGW9wG/4qocPevXMjCmrIc5b6db9WjeGE4QYVpUAWMDv3v0IiBwObY289A==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -1558,20 +1587,15 @@ "license": "MIT" }, "node_modules/@types/lodash": { - "version": "4.14.191", - "dev": true, - "license": "MIT" + "version": "4.14.198", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", + "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", + "dev": true }, "node_modules/@types/node": { "version": "18.11.18", "license": "MIT" }, - "node_modules/@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", - "dev": true - }, "node_modules/@types/semver": { "version": "7.3.13", "license": "MIT" @@ -1789,8 +1813,9 @@ "license": "ISC" }, "node_modules/acorn": { - "version": "8.8.1", - "license": "MIT", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "bin": { "acorn": "bin/acorn" }, @@ -1800,7 +1825,8 @@ }, "node_modules/acorn-jsx": { "version": "5.3.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -1940,23 +1966,25 @@ } }, "node_modules/ansi-escapes": { - "version": "6.0.0", - "license": "MIT", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dependencies": { - "type-fest": "^3.0.0" + "type-fest": "^0.21.3" }, "engines": { - "node": ">=14.16" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "3.5.2", - "license": "(MIT OR CC0-1.0)", + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "engines": { - "node": ">=14.16" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2110,8 +2138,9 @@ }, "node_modules/astral-regex": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } @@ -2193,15 +2222,15 @@ "license": "MIT" }, "node_modules/babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.4.tgz", + "integrity": "sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw==", "dev": true, "dependencies": { - "@jest/transform": "^29.4.1", + "@jest/transform": "^29.6.4", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", + "babel-preset-jest": "^29.6.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" @@ -2229,9 +2258,9 @@ } }, "node_modules/babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "dev": true, "dependencies": { "@babel/template": "^7.3.3", @@ -2266,12 +2295,12 @@ } }, "node_modules/babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "dev": true, "dependencies": { - "babel-plugin-jest-hoist": "^29.4.0", + "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { @@ -2287,6 +2316,8 @@ }, "node_modules/base64-js": { "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", @@ -2300,8 +2331,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/basic-auth": { "version": "2.0.1", @@ -2354,7 +2384,8 @@ }, "node_modules/bl": { "version": "4.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -2458,6 +2489,8 @@ }, "node_modules/buffer": { "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "funding": [ { "type": "github", @@ -2472,7 +2505,6 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -2498,6 +2530,8 @@ }, "node_modules/busboy": { "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "dependencies": { "streamsearch": "^1.1.0" }, @@ -2664,7 +2698,8 @@ }, "node_modules/callsites": { "version": "3.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "engines": { "node": ">=6" } @@ -2772,9 +2807,9 @@ } }, "node_modules/cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, "node_modules/clean-stack": { @@ -2799,21 +2834,20 @@ } }, "node_modules/cli-cursor": { - "version": "4.0.0", - "license": "MIT", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dependencies": { - "restore-cursor": "^4.0.0" + "restore-cursor": "^3.1.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/cli-spinners": { - "version": "2.7.0", - "license": "MIT", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", "engines": { "node": ">=6" }, @@ -2837,8 +2871,9 @@ } }, "node_modules/cli-width": { - "version": "4.0.0", - "license": "ISC", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==", "engines": { "node": ">= 12" } @@ -2891,7 +2926,8 @@ }, "node_modules/clone": { "version": "1.0.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", "engines": { "node": ">=0.8" } @@ -2959,9 +2995,9 @@ } }, "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, "node_modules/color": { @@ -3046,8 +3082,9 @@ }, "node_modules/commist": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/commist/-/commist-1.1.0.tgz", + "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", "dev": true, - "license": "MIT", "dependencies": { "leven": "^2.1.0", "minimist": "^1.1.0" @@ -3055,8 +3092,9 @@ }, "node_modules/commist/node_modules/leven": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3210,8 +3248,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.7", - "license": "MIT" + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" }, "node_modules/debug": { "version": "4.3.4", @@ -3241,10 +3280,18 @@ } }, "node_modules/dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } }, "node_modules/deep-extend": { "version": "0.6.0", @@ -3255,7 +3302,8 @@ }, "node_modules/deep-is": { "version": "0.1.4", - "license": "MIT" + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "node_modules/deepmerge": { "version": "4.2.2", @@ -3281,7 +3329,8 @@ }, "node_modules/defaults": { "version": "1.0.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", "dependencies": { "clone": "^1.0.2" }, @@ -3362,9 +3411,9 @@ } }, "node_modules/diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -3423,10 +3472,6 @@ "es5-ext": "~0.10.46" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "license": "MIT" - }, "node_modules/ecc-jsbn": { "version": "0.1.2", "dev": true, @@ -3821,47 +3866,46 @@ } }, "node_modules/eslint": { - "version": "8.32.0", - "license": "MIT", - "dependencies": { - "@eslint/eslintrc": "^1.4.1", - "@humanwhocodes/config-array": "^0.11.8", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", + "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.48.0", + "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -3888,7 +3932,8 @@ }, "node_modules/eslint-plugin-prettier": { "version": "4.2.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", "dependencies": { "prettier-linter-helpers": "^1.0.0" }, @@ -3906,14 +3951,18 @@ } }, "node_modules/eslint-scope": { - "version": "7.1.1", - "license": "BSD-2-Clause", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-utils": { @@ -3940,10 +3989,14 @@ } }, "node_modules/eslint-visitor-keys": { - "version": "3.3.0", - "license": "Apache-2.0", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint/node_modules/escape-string-regexp": { @@ -3967,12 +4020,13 @@ } }, "node_modules/espree": { - "version": "9.4.1", - "license": "BSD-2-Clause", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -4029,8 +4083,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "license": "BSD-3-Clause", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dependencies": { "estraverse": "^5.1.0" }, @@ -4072,7 +4127,8 @@ }, "node_modules/eventemitter3": { "version": "4.0.7", - "license": "MIT" + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, "node_modules/execa": { "version": "5.1.1", @@ -4107,16 +4163,16 @@ } }, "node_modules/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.6.4.tgz", + "integrity": "sha512-F2W2UyQ8XYyftHT57dtfg8Ue3X5qLgm2sSug0ivvLRH/VKNRL/pDxg/TH7zVzbQB0tu80clNFy6LU7OS/VSEKA==", "dev": true, "dependencies": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" + "@jest/expect-utils": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -4163,12 +4219,14 @@ "license": "MIT" }, "node_modules/fast-diff": { - "version": "1.2.0", - "license": "Apache-2.0" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==" }, "node_modules/fast-glob": { - "version": "3.2.12", - "license": "MIT", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -4200,7 +4258,8 @@ }, "node_modules/fast-levenshtein": { "version": "2.0.6", - "license": "MIT" + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" }, "node_modules/fast-redact": { "version": "3.1.2", @@ -4448,9 +4507,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "node_modules/from2/node_modules/readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -4545,8 +4604,9 @@ }, "node_modules/functional-red-black-tree": { "version": "1.0.1", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true }, "node_modules/functions-have-names": { "version": "1.2.3", @@ -4715,8 +4775,9 @@ } }, "node_modules/globals": { - "version": "13.19.0", - "license": "MIT", + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", "dependencies": { "type-fest": "^0.20.2" }, @@ -4780,9 +4841,10 @@ "version": "4.2.10", "license": "ISC" }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "license": "MIT" + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" }, "node_modules/har-schema": { "version": "2.0.0", @@ -4914,8 +4976,9 @@ }, "node_modules/help-me": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-3.0.0.tgz", + "integrity": "sha512-hx73jClhyk910sidBB7ERlnhMlFsJJIBqSVMFDwPN8o2v9nmp5KgLq1Xz1Bf1fCMMZ6mPrX159iG0VLy/fPMtQ==", "dev": true, - "license": "MIT", "dependencies": { "glob": "^7.1.6", "readable-stream": "^3.6.0" @@ -4996,8 +5059,9 @@ } }, "node_modules/hyperid": { - "version": "3.1.0", - "license": "MIT", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hyperid/-/hyperid-3.1.1.tgz", + "integrity": "sha512-RveV33kIksycSf7HLkq1sHB5wW0OwuX8ot8MYnY++gaaPXGFfKpBncHrAWxdpuEeRlazUMGWefwP1w6o6GaumA==", "dependencies": { "uuid": "^8.3.2", "uuid-parse": "^1.1.0" @@ -5005,7 +5069,8 @@ }, "node_modules/hyperid/node_modules/uuid": { "version": "8.3.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", "bin": { "uuid": "dist/bin/uuid" } @@ -5022,6 +5087,8 @@ }, "node_modules/ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -5035,8 +5102,7 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" + ] }, "node_modules/ignore": { "version": "5.2.4", @@ -5054,7 +5120,8 @@ }, "node_modules/import-fresh": { "version": "3.3.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -5120,42 +5187,34 @@ "license": "ISC" }, "node_modules/inquirer": { - "version": "9.1.4", - "license": "MIT", + "version": "9.2.10", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.10.tgz", + "integrity": "sha512-tVVNFIXU8qNHoULiazz612GFl+yqNfjMTbLuViNJE/d860Qxrd3NMrse8dm40VUQLOQeULvaQF8lpAhvysjeyA==", "dependencies": { - "ansi-escapes": "^6.0.0", - "chalk": "^5.1.2", - "cli-cursor": "^4.0.0", - "cli-width": "^4.0.0", - "external-editor": "^3.0.3", + "@ljharb/through": "^2.3.9", + "ansi-escapes": "^4.3.2", + "chalk": "^5.3.0", + "cli-cursor": "^3.1.0", + "cli-width": "^4.1.0", + "external-editor": "^3.1.0", "figures": "^5.0.0", "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^6.1.2", - "run-async": "^2.4.0", - "rxjs": "^7.5.7", - "string-width": "^5.1.2", - "strip-ansi": "^7.0.1", - "through": "^2.3.6", - "wrap-ansi": "^8.0.1" + "mute-stream": "1.0.0", + "ora": "^5.4.1", + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0" }, "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/inquirer/node_modules/ansi-regex": { - "version": "6.0.1", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=14.18.0" } }, "node_modules/inquirer/node_modules/chalk": { - "version": "5.2.0", - "license": "MIT", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" }, @@ -5163,10 +5222,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/inquirer/node_modules/emoji-regex": { - "version": "9.2.2", - "license": "MIT" - }, "node_modules/inquirer/node_modules/escape-string-regexp": { "version": "5.0.0", "license": "MIT", @@ -5191,6 +5246,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/inquirer/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, "node_modules/inquirer/node_modules/is-unicode-supported": { "version": "1.3.0", "license": "MIT", @@ -5202,31 +5265,16 @@ } }, "node_modules/inquirer/node_modules/string-width": { - "version": "5.1.2", - "license": "MIT", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/inquirer/node_modules/strip-ansi": { - "version": "7.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">=8" } }, "node_modules/install-artifact-from-github": { @@ -5251,9 +5299,9 @@ } }, "node_modules/ioredis": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.0.tgz", - "integrity": "sha512-Id9jKHhsILuIZpHc61QkagfVdUj2Rag5GzG1TGEvRNeM7dtTOjICgjC+tvqYxi//PuX2wjQ+Xjva2ONBuf92Pw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", + "integrity": "sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==", "dependencies": { "@ioredis/commands": "^1.1.1", "cluster-key-slot": "^1.1.0", @@ -5427,13 +5475,11 @@ } }, "node_modules/is-interactive": { - "version": "2.0.0", - "license": "MIT", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/is-lambda": { @@ -5594,7 +5640,6 @@ }, "node_modules/is-unicode-supported": { "version": "0.1.0", - "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -5741,15 +5786,15 @@ } }, "node_modules/jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.4.tgz", + "integrity": "sha512-tEFhVQFF/bzoYV1YuGyzLPZ6vlPrdfvDmmAxudA1dLEuiztqg2Rkx20vkKY32xiDROcD2KXlgZ7Cu8RPeEHRKw==", "dev": true, "dependencies": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.6.4", + "@jest/types": "^29.6.3", "import-local": "^3.0.2", - "jest-cli": "^29.4.1" + "jest-cli": "^29.6.4" }, "bin": { "jest": "bin/jest.js" @@ -5767,12 +5812,13 @@ } }, "node_modules/jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.6.3.tgz", + "integrity": "sha512-G5wDnElqLa4/c66ma5PG9eRjE342lIbF6SUnTJi26C3J28Fv2TVY2rOyKB9YGbSA5ogwevgmxc4j4aVjrEK6Yg==", "dev": true, "dependencies": { "execa": "^5.0.0", + "jest-util": "^29.6.3", "p-limit": "^3.1.0" }, "engines": { @@ -5780,28 +5826,29 @@ } }, "node_modules/jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.4.tgz", + "integrity": "sha512-YXNrRyntVUgDfZbjXWBMPslX1mQ8MrSG0oM/Y06j9EYubODIyHWP8hMUbjbZ19M3M+zamqEur7O80HODwACoJw==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "dedent": "^0.7.0", + "dedent": "^1.0.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", + "jest-each": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -5810,21 +5857,21 @@ } }, "node_modules/jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.4.tgz", + "integrity": "sha512-+uMCQ7oizMmh8ZwRfZzKIEszFY9ksjjEQnTEMTaL7fYiL3Kw4XhqT9bYh+A4DQKUb67hZn2KbtEnDuHvcgK4pQ==", "dev": true, "dependencies": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-config": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "prompts": "^2.0.1", "yargs": "^17.3.1" }, @@ -5844,31 +5891,31 @@ } }, "node_modules/jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.4.tgz", + "integrity": "sha512-JWohr3i9m2cVpBumQFv2akMEnFEPVOh+9L2xIBJhJ0zOaci2ZXuKJj0tgMKQCBZAKA09H049IR4HVS/43Qb19A==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", + "@jest/test-sequencer": "^29.6.4", + "@jest/types": "^29.6.3", + "babel-jest": "^29.6.4", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-circus": "^29.6.4", + "jest-environment-node": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, @@ -5889,24 +5936,24 @@ } }, "node_modules/jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.4.tgz", + "integrity": "sha512-9F48UxR9e4XOEZvoUXEHSWY4qC4zERJaOfrbBg9JpbJOO43R1vN76REt/aMGZoY6GD5g84nnJiBIVlscegefpw==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.6.3.tgz", + "integrity": "sha512-2+H+GOTQBEm2+qFSQ7Ma+BvyV+waiIFxmZF5LdpBsAEjWX8QYjSCa4FrkIYtbfXUJJJnFCYrOtt6TZ+IAiTjBQ==", "dev": true, "dependencies": { "detect-newline": "^3.0.0" @@ -5916,62 +5963,62 @@ } }, "node_modules/jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.3.tgz", + "integrity": "sha512-KoXfJ42k8cqbkfshW7sSHcdfnv5agDdHCPA87ZBdmHP+zJstTJc0ttQaJ/x7zK6noAL76hOuTIJ6ZkQRS5dcyg==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "jest-util": "^29.6.3", + "pretty-format": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.4.tgz", + "integrity": "sha512-i7SbpH2dEIFGNmxGCpSc2w9cA4qVD+wfvg2ZnfQ7XVrKL0NA5uDVBIiGH8SR4F0dKEv/0qI5r+aDomDf04DpEQ==", "dev": true, "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", "dev": true, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.6.4.tgz", + "integrity": "sha512-12Ad+VNTDHxKf7k+M65sviyynRoZYuL1/GTuhEVb8RYsNSNln71nANRb/faSyWvx0j+gHcivChXHIoMJrGYjog==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", "micromatch": "^4.0.4", "walker": "^1.0.8" }, @@ -5983,46 +6030,46 @@ } }, "node_modules/jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.3.tgz", + "integrity": "sha512-0kfbESIHXYdhAdpLsW7xdwmYhLf1BRu4AA118/OxFm0Ho1b2RcTmO4oF6aAMaxpxdxnJ3zve2rgwzNBD4Zbm7Q==", "dev": true, "dependencies": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.6.4.tgz", + "integrity": "sha512-KSzwyzGvK4HcfnserYqJHYi7sZVqdREJ9DMPAKVbS98JsIAvumihaNUbjrWw0St7p9IY7A9UskCW5MYlGmBQFQ==", "dev": true, "dependencies": { "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-diff": "^29.6.4", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.3.tgz", + "integrity": "sha512-FtzaEEHzjDpQp51HX4UMkPZjy46ati4T5pEMyM6Ik48ztu4T9LQplZ6OsimHx7EuM9dfEh5HJa6D3trEftu3dA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -6031,14 +6078,14 @@ } }, "node_modules/jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.6.3.tgz", + "integrity": "sha512-Z7Gs/mOyTSR4yPsaZ72a/MtuK6RnC3JYqWONe48oLaoEcYwEDxqvbXz85G4SJrm2Z5Ar9zp6MiHF4AlFlRM4Pg==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-util": "^29.4.1" + "jest-util": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -6062,25 +6109,26 @@ } }, "node_modules/jest-regex-util": { - "version": "29.2.0", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", "dev": true, - "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.4.tgz", + "integrity": "sha512-fPRq+0vcxsuGlG0O3gyoqGTAxasagOxEuyoxHeyxaZbc9QNek0AmJWSkhjlMG+mTsj+8knc/mWb3fXlRNVih7Q==", "dev": true, "dependencies": { "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.6.4", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" @@ -6090,43 +6138,43 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.4.tgz", + "integrity": "sha512-7+6eAmr1ZBF3vOAJVsfLj1QdqeXG+WYhidfLHBRZqGN24MFRIiKG20ItpLw2qRAsW/D2ZUUmCNf6irUr/v6KHA==", "dev": true, "dependencies": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.6.4" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.4.tgz", + "integrity": "sha512-SDaLrMmtVlQYDuG0iSPYLycG8P9jLI+fRm8AF/xPKhYDB2g6xDWjXBrR5M8gEWsK6KVFlebpZ4QsrxdyIX1Jaw==", "dev": true, "dependencies": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/environment": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.13.1", "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-docblock": "^29.6.3", + "jest-environment-node": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-leak-detector": "^29.6.3", + "jest-message-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-util": "^29.6.3", + "jest-watcher": "^29.6.4", + "jest-worker": "^29.6.4", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, @@ -6135,32 +6183,31 @@ } }, "node_modules/jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "dependencies": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.4.tgz", + "integrity": "sha512-s/QxMBLvmwLdchKEjcLfwzP7h+jsHvNEtxGP5P+Fl1FMaJX2jMiIqe4rJw4tFprzCwuSvVUo9bn0uj4gNRXsbA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/globals": "^29.6.4", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, @@ -6169,47 +6216,43 @@ } }, "node_modules/jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.6.4.tgz", + "integrity": "sha512-VC1N8ED7+4uboUKGIDsbvNAZb6LakgIPgAF4RSpF13dN6YaMokfRqO+BaqK4zIh6X3JffgwbzuGqDEjHm/MrvA==", "dev": true, "dependencies": { "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-jsx": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", + "@jest/expect-utils": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.4.1", + "expect": "^29.6.4", "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-diff": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", - "semver": "^7.3.5" + "pretty-format": "^29.6.3", + "semver": "^7.5.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, "node_modules/jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz", + "integrity": "sha512-QUjna/xSy4B32fzcKTSz1w7YYzgiHrjjJjevdRf61HYk998R5vVMMNmrHESYZVDS5DSWs+1srPLPKxXPkeSDOA==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -6221,17 +6264,17 @@ } }, "node_modules/jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.3.tgz", + "integrity": "sha512-e7KWZcAIX+2W1o3cHfnqpGajdCs1jSM3DkXjGeLSNmCazv1EeI1ggTeK5wdZhF+7N+g44JI2Od3veojoaumlfg==", "dev": true, "dependencies": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", + "jest-get-type": "^29.6.3", "leven": "^3.1.0", - "pretty-format": "^29.4.1" + "pretty-format": "^29.6.3" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -6250,59 +6293,32 @@ } }, "node_modules/jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.4.tgz", + "integrity": "sha512-oqUWvx6+On04ShsT00Ir9T4/FvBeEh2M9PTubgITPxDa739p4hoQweWPRGyYeaojgT0xTpZKF0Y/rSY1UgMxvQ==", "dev": true, "dependencies": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.13.1", - "jest-util": "^29.4.1", + "jest-util": "^29.6.3", "string-length": "^4.0.1" }, "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/jest-watcher/node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-watcher/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.4.tgz", + "integrity": "sha512-6dpvFV4WjcWbDVGgHTWo/aupl8/LbBx2NSKfiwqf79xC/yeJjKHT1+StcKy/2KTmW16hE68ccKVOtXf+WZGz7Q==", "dev": true, "dependencies": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.6.3", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -6326,8 +6342,10 @@ } }, "node_modules/js-sdsl": { - "version": "4.2.0", - "license": "MIT", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/js-sdsl" @@ -6433,7 +6451,8 @@ }, "node_modules/jsonwebtoken": { "version": "8.5.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", "dependencies": { "jws": "^3.2.2", "lodash.includes": "^4.3.0", @@ -6452,8 +6471,9 @@ } }, "node_modules/jsonwebtoken/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "bin": { "semver": "bin/semver" } @@ -6525,9 +6545,9 @@ } }, "node_modules/koncorde": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/koncorde/-/koncorde-4.1.0.tgz", - "integrity": "sha512-YaeTfaVaqD4XXplnZwNnxeHEQxz/FaT+4YUFufhrmKyBgi2wJEIBMUx4TJoj+CuevQuwzQmBm2lDeFXaeMBk2Q==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/koncorde/-/koncorde-4.2.0.tgz", + "integrity": "sha512-VsLJ3Rdtt71jm2uzEkCerTiXgTm8nX4Vfu93ZS98IjciFIqOEEwI7sO/mCIAf97SEp8jH/tb5ZnDAd4BvJaj6w==", "dependencies": { "@flatten-js/interval-tree": "^1.0.14", "boost-geospatial-index": "^1.1.1", @@ -6676,12 +6696,12 @@ } }, "node_modules/kuzzle-sdk": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.10.5.tgz", - "integrity": "sha512-Iy2mLReKIHZWWDZoOkHoPSyQx8hDF5Zn3fwYnljW39cfjfM+dqvwg4c+2ltNQp077LppWLpyZSv+jxFOOOHKQA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.11.0.tgz", + "integrity": "sha512-g1fvQLCm5/zFntwNa+09bIniyzofVVIanVBWcOuzjwqgg7sHeILJQUsiGdLaKQFQmZHrdfkYWQrcoD9f0Qb7Fg==", "dependencies": { "min-req-promise": "^1.0.1", - "ws": "^8.8.1" + "ws": "^8.13.0" }, "engines": { "node": ">= 10.13.0" @@ -6742,7 +6762,8 @@ }, "node_modules/levn": { "version": "0.4.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -6785,8 +6806,9 @@ }, "node_modules/lodash.get": { "version": "4.4.2", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true }, "node_modules/lodash.includes": { "version": "4.3.0", @@ -6840,7 +6862,6 @@ }, "node_modules/log-symbols": { "version": "4.1.0", - "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.1.0", @@ -6865,8 +6886,9 @@ } }, "node_modules/long": { - "version": "5.2.1", - "license": "Apache-2.0" + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "node_modules/lower-case": { "version": "1.1.4", @@ -7046,7 +7068,8 @@ }, "node_modules/mimic-fn": { "version": "2.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "engines": { "node": ">=6" } @@ -7066,8 +7089,9 @@ } }, "node_modules/minimist": { - "version": "1.2.7", - "license": "MIT", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -7413,8 +7437,9 @@ }, "node_modules/mqtt": { "version": "4.3.7", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.3.7.tgz", + "integrity": "sha512-ew3qwG/TJRorTz47eW46vZ5oBw5MEYbQZVaEji44j5lAUSQSqIEoul7Kua/BatBW0H0kKQcC9kwUHa1qzaWHSw==", "dev": true, - "license": "MIT", "dependencies": { "commist": "^1.0.0", "concat-stream": "^2.0.0", @@ -7455,8 +7480,9 @@ }, "node_modules/mqtt/node_modules/lru-cache": { "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, - "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -7466,8 +7492,9 @@ }, "node_modules/mqtt/node_modules/mqtt-packet": { "version": "6.10.0", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.10.0.tgz", + "integrity": "sha512-ja8+mFKIHdB1Tpl6vac+sktqy3gA8t9Mduom1BA75cI+R9AHnZOiaBQwpGiWnaVJLDGRdNhQmFaAqd7tkKSMGA==", "dev": true, - "license": "MIT", "dependencies": { "bl": "^4.0.2", "debug": "^4.1.1", @@ -7476,8 +7503,9 @@ }, "node_modules/mqtt/node_modules/ws": { "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=8.3.0" }, @@ -7496,8 +7524,9 @@ }, "node_modules/mqtt/node_modules/yallist": { "version": "4.0.0", - "dev": true, - "license": "ISC" + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true }, "node_modules/ms": { "version": "2.1.3", @@ -7516,8 +7545,12 @@ } }, "node_modules/mute-stream": { - "version": "0.0.8", - "license": "ISC" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } }, "node_modules/mz": { "version": "2.7.0", @@ -7616,8 +7649,9 @@ }, "node_modules/nice-try": { "version": "1.0.5", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true }, "node_modules/nise": { "version": "5.1.4", @@ -7639,14 +7673,6 @@ "type-detect": "4.0.8" } }, - "node_modules/nise/node_modules/@sinonjs/fake-timers": { - "version": "10.0.2", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^2.0.0" - } - }, "node_modules/no-case": { "version": "2.3.2", "dev": true, @@ -7953,19 +7979,15 @@ } }, "node_modules/number-allocator": { - "version": "1.0.12", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/number-allocator/-/number-allocator-1.0.14.tgz", + "integrity": "sha512-OrL44UTVAvkKdOdRQZIJpLkAdjXGTRda052sN4sO77bKEzYYqWKMBjQvrJFzqygI99gL6Z4u2xctPW1tB8ErvA==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^4.3.1", - "js-sdsl": "4.1.4" + "js-sdsl": "4.3.0" } }, - "node_modules/number-allocator/node_modules/js-sdsl": { - "version": "4.1.4", - "dev": true, - "license": "MIT" - }, "node_modules/number-is-nan": { "version": "1.0.1", "license": "MIT", @@ -8139,19 +8161,6 @@ "node": ">=8" } }, - "node_modules/nyc/node_modules/wrap-ansi": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/nyc/node_modules/y18n": { "version": "4.0.3", "dev": true, @@ -8280,7 +8289,8 @@ }, "node_modules/onetime": { "version": "5.1.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -8297,129 +8307,43 @@ "optional": true }, "node_modules/optionator": { - "version": "0.9.1", - "license": "MIT", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" }, "engines": { "node": ">= 0.8.0" } }, "node_modules/ora": { - "version": "6.1.2", - "license": "MIT", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dependencies": { - "bl": "^5.0.0", - "chalk": "^5.0.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.6.1", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^1.1.0", - "log-symbols": "^5.1.0", - "strip-ansi": "^7.0.1", + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/ansi-regex": { - "version": "6.0.1", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ora/node_modules/bl": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/ora/node_modules/buffer": { - "version": "6.0.3", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/ora/node_modules/chalk": { - "version": "5.2.0", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ora/node_modules/is-unicode-supported": { - "version": "1.3.0", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/log-symbols": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "chalk": "^5.0.0", - "is-unicode-supported": "^1.1.0" - }, - "engines": { - "node": ">=12" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ora/node_modules/strip-ansi": { - "version": "7.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, "node_modules/original-url": { "version": "1.2.3", "license": "MIT", @@ -8522,7 +8446,8 @@ }, "node_modules/parent-module": { "version": "1.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dependencies": { "callsites": "^3.0.0" }, @@ -8734,14 +8659,16 @@ }, "node_modules/prelude-ls": { "version": "1.2.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "engines": { "node": ">= 0.8.0" } }, "node_modules/prettier": { - "version": "2.8.3", - "license": "MIT", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "bin": { "prettier": "bin-prettier.js" }, @@ -8754,7 +8681,8 @@ }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dependencies": { "fast-diff": "^1.1.2" }, @@ -8763,12 +8691,12 @@ } }, "node_modules/pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.3.tgz", + "integrity": "sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==", "dev": true, "dependencies": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -8851,9 +8779,9 @@ } }, "node_modules/protobufjs": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.1.tgz", - "integrity": "sha512-L3pCItypTnPK27+CS8nuhZMYtsY+i8dqdq2vZsYHlG17CnWp1DWPQ/sos0vOKrj1fHEAzo3GBqSHLaeZyKUCDA==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", + "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", "hasInstallScript": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", @@ -8885,8 +8813,9 @@ }, "node_modules/pump": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, - "license": "MIT", "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -8899,6 +8828,22 @@ "node": ">=6" } }, + "node_modules/pure-rand": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz", + "integrity": "sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, "node_modules/qlobber": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-5.0.3.tgz", @@ -9226,32 +9171,31 @@ }, "node_modules/resolve-from": { "version": "4.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "engines": { "node": ">=4" } }, "node_modules/resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true, "engines": { "node": ">=10" } }, "node_modules/restore-cursor": { - "version": "4.0.0", - "license": "MIT", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/retimer": { @@ -9275,16 +9219,18 @@ }, "node_modules/rewire": { "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rewire/-/rewire-5.0.0.tgz", + "integrity": "sha512-1zfitNyp9RH5UDyGGLe9/1N0bMlPQ0WrX0Tmg11kMHBpqwPJI4gfPpP7YngFyLbFmhXh19SToAG0sKKEFcOIJA==", "dev": true, - "license": "MIT", "dependencies": { "eslint": "^6.8.0" } }, "node_modules/rewire/node_modules/acorn": { "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true, - "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -9292,43 +9238,20 @@ "node": ">=0.4.0" } }, - "node_modules/rewire/node_modules/ansi-escapes": { - "version": "4.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/rewire/node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/rewire/node_modules/ansi-regex": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/rewire/node_modules/ansi-styles": { "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -9338,16 +9261,18 @@ }, "node_modules/rewire/node_modules/argparse": { "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, - "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" } }, "node_modules/rewire/node_modules/chalk": { "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -9357,42 +9282,35 @@ "node": ">=4" } }, - "node_modules/rewire/node_modules/cli-cursor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/rewire/node_modules/cli-width": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", "dev": true, - "license": "ISC", "engines": { "node": ">= 10" } }, "node_modules/rewire/node_modules/color-convert": { "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "1.1.3" } }, "node_modules/rewire/node_modules/color-name": { "version": "1.1.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/rewire/node_modules/cross-spawn": { "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, - "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -9405,25 +9323,28 @@ } }, "node_modules/rewire/node_modules/cross-spawn/node_modules/semver": { - "version": "5.7.1", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/rewire/node_modules/escape-string-regexp": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8.0" } }, "node_modules/rewire/node_modules/eslint": { "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", "dev": true, - "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", @@ -9475,8 +9396,9 @@ }, "node_modules/rewire/node_modules/eslint-scope": { "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -9487,8 +9409,9 @@ }, "node_modules/rewire/node_modules/eslint-utils": { "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", "dev": true, - "license": "MIT", "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -9498,16 +9421,18 @@ }, "node_modules/rewire/node_modules/eslint-visitor-keys": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true, - "license": "Apache-2.0", "engines": { "node": ">=4" } }, "node_modules/rewire/node_modules/eslint/node_modules/strip-ansi": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-regex": "^4.1.0" }, @@ -9517,8 +9442,9 @@ }, "node_modules/rewire/node_modules/espree": { "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { "acorn": "^7.1.1", "acorn-jsx": "^5.2.0", @@ -9530,16 +9456,18 @@ }, "node_modules/rewire/node_modules/estraverse": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } }, "node_modules/rewire/node_modules/file-entry-cache": { "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, - "license": "MIT", "dependencies": { "flat-cache": "^2.0.1" }, @@ -9549,8 +9477,9 @@ }, "node_modules/rewire/node_modules/flat-cache": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, - "license": "MIT", "dependencies": { "flatted": "^2.0.0", "rimraf": "2.6.3", @@ -9562,13 +9491,15 @@ }, "node_modules/rewire/node_modules/flatted": { "version": "2.0.2", - "dev": true, - "license": "ISC" + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", + "dev": true }, "node_modules/rewire/node_modules/globals": { "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", "dev": true, - "license": "MIT", "dependencies": { "type-fest": "^0.8.1" }, @@ -9581,24 +9512,27 @@ }, "node_modules/rewire/node_modules/has-flag": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/rewire/node_modules/ignore": { "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 4" } }, "node_modules/rewire/node_modules/inquirer": { "version": "7.3.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", + "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-escapes": "^4.2.1", "chalk": "^4.1.0", @@ -9620,8 +9554,9 @@ }, "node_modules/rewire/node_modules/inquirer/node_modules/ansi-styles": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -9634,8 +9569,9 @@ }, "node_modules/rewire/node_modules/inquirer/node_modules/chalk": { "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -9649,8 +9585,9 @@ }, "node_modules/rewire/node_modules/inquirer/node_modules/color-convert": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -9660,21 +9597,24 @@ }, "node_modules/rewire/node_modules/inquirer/node_modules/color-name": { "version": "1.1.4", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/rewire/node_modules/inquirer/node_modules/has-flag": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/rewire/node_modules/inquirer/node_modules/supports-color": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -9684,16 +9624,18 @@ }, "node_modules/rewire/node_modules/is-fullwidth-code-point": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/rewire/node_modules/js-yaml": { "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, - "license": "MIT", "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -9704,8 +9646,9 @@ }, "node_modules/rewire/node_modules/levn": { "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", "dev": true, - "license": "MIT", "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -9714,10 +9657,17 @@ "node": ">= 0.8.0" } }, + "node_modules/rewire/node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "node_modules/rewire/node_modules/optionator": { "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, - "license": "MIT", "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -9732,14 +9682,17 @@ }, "node_modules/rewire/node_modules/path-key": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", "dev": true, - "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/rewire/node_modules/prelude-ls": { "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", "dev": true, "engines": { "node": ">= 0.8.0" @@ -9747,28 +9700,18 @@ }, "node_modules/rewire/node_modules/regexpp": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.5.0" } }, - "node_modules/rewire/node_modules/restore-cursor": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/rewire/node_modules/rimraf": { "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, - "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -9776,10 +9719,20 @@ "rimraf": "bin.js" } }, + "node_modules/rewire/node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/rewire/node_modules/rxjs": { "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { "tslib": "^1.9.0" }, @@ -9788,17 +9741,19 @@ } }, "node_modules/rewire/node_modules/semver": { - "version": "6.3.0", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, - "license": "ISC", "bin": { "semver": "bin/semver.js" } }, "node_modules/rewire/node_modules/shebang-command": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", "dev": true, - "license": "MIT", "dependencies": { "shebang-regex": "^1.0.0" }, @@ -9808,16 +9763,18 @@ }, "node_modules/rewire/node_modules/shebang-regex": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/rewire/node_modules/string-width": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -9829,8 +9786,9 @@ }, "node_modules/rewire/node_modules/supports-color": { "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -9840,13 +9798,15 @@ }, "node_modules/rewire/node_modules/tslib": { "version": "1.14.1", - "dev": true, - "license": "0BSD" + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "node_modules/rewire/node_modules/type-check": { "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", "dev": true, - "license": "MIT", "dependencies": { "prelude-ls": "~1.1.2" }, @@ -9856,16 +9816,18 @@ }, "node_modules/rewire/node_modules/type-fest": { "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, - "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=8" } }, "node_modules/rewire/node_modules/which": { "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, - "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -9892,8 +9854,9 @@ } }, "node_modules/run-async": { - "version": "2.4.1", - "license": "MIT", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==", "engines": { "node": ">=0.12.0" } @@ -9920,8 +9883,9 @@ } }, "node_modules/rxjs": { - "version": "7.8.0", - "license": "Apache-2.0", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "dependencies": { "tslib": "^2.1.0" } @@ -9982,8 +9946,9 @@ "license": "MIT" }, "node_modules/semver": { - "version": "7.3.8", - "license": "ISC", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -10152,8 +10117,9 @@ }, "node_modules/sinon": { "version": "14.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz", + "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "@sinonjs/commons": "^2.0.0", "@sinonjs/fake-timers": "^9.1.2", @@ -10169,8 +10135,27 @@ }, "node_modules/sinon/node_modules/@sinonjs/commons": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/sinon/node_modules/@sinonjs/fake-timers": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/sinon/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" } @@ -10198,8 +10183,9 @@ }, "node_modules/slice-ansi": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", @@ -10211,8 +10197,9 @@ }, "node_modules/slice-ansi/node_modules/ansi-styles": { "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -10222,16 +10209,18 @@ }, "node_modules/slice-ansi/node_modules/color-convert": { "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "1.1.3" } }, "node_modules/slice-ansi/node_modules/color-name": { "version": "1.1.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/smart-buffer": { "version": "4.2.0", @@ -10461,6 +10450,8 @@ }, "node_modules/streamsearch": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", "engines": { "node": ">=10.0.0" } @@ -10619,8 +10610,9 @@ }, "node_modules/table": { "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { "ajv": "^6.10.2", "lodash": "^4.17.14", @@ -10633,21 +10625,24 @@ }, "node_modules/table/node_modules/ansi-regex": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/table/node_modules/emoji-regex": { "version": "7.0.3", - "dev": true, - "license": "MIT" + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true }, "node_modules/table/node_modules/string-width": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, - "license": "MIT", "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", @@ -10659,8 +10654,9 @@ }, "node_modules/table/node_modules/strip-ansi": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-regex": "^4.1.0" }, @@ -10796,7 +10792,9 @@ }, "node_modules/through": { "version": "2.3.8", - "license": "MIT" + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true }, "node_modules/through2": { "version": "4.0.2", @@ -10898,9 +10896,10 @@ "license": "MIT" }, "node_modules/ts-jest": { - "version": "29.0.5", + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", + "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", "dev": true, - "license": "MIT", "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", @@ -10908,7 +10907,7 @@ "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", - "semver": "7.x", + "semver": "^7.5.3", "yargs-parser": "^21.0.1" }, "bin": { @@ -10922,7 +10921,7 @@ "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { @@ -10990,8 +10989,9 @@ } }, "node_modules/tslib": { - "version": "2.4.1", - "license": "0BSD" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/tsutils": { "version": "3.21.0", @@ -11032,7 +11032,8 @@ }, "node_modules/type-check": { "version": "0.4.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dependencies": { "prelude-ls": "^1.2.1" }, @@ -11050,7 +11051,8 @@ }, "node_modules/type-fest": { "version": "0.20.2", - "license": "(MIT OR CC0-1.0)", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "engines": { "node": ">=10" }, @@ -11111,13 +11113,14 @@ } }, "node_modules/undici": { - "version": "5.15.0", - "license": "MIT", + "version": "5.23.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz", + "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==", "dependencies": { "busboy": "^1.6.0" }, "engines": { - "node": ">=12.18" + "node": ">=14.0" } }, "node_modules/unicode-byte-truncate": { @@ -11237,7 +11240,8 @@ }, "node_modules/uuid-parse": { "version": "1.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/uuid-parse/-/uuid-parse-1.1.0.tgz", + "integrity": "sha512-OdmXxA8rDsQ7YpNVbKSJkNzTw2I+S5WsbMDnCtIWSQaosNAcWtFuI/YK1TjzUI6nbkgiqEyh8gWngfcv8Asd9A==" }, "node_modules/uWebSockets.js": { "version": "20.7.0", @@ -11245,9 +11249,10 @@ "integrity": "sha512-1SNylEM0lt36S+0cB6loCIf+qp1HQuSNPx68MUJrZNUgpygWtw9ukSCOxecDRF0qbviVvsphdbA6w6hgOoaNtw==" }, "node_modules/v8-compile-cache": { - "version": "2.3.0", - "dev": true, - "license": "MIT" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", + "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", + "dev": true }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", @@ -11255,9 +11260,9 @@ "license": "MIT" }, "node_modules/v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", @@ -11275,9 +11280,9 @@ "dev": true }, "node_modules/validator": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", - "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==", + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", + "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", "engines": { "node": ">= 0.10" } @@ -11306,7 +11311,8 @@ }, "node_modules/wcwidth": { "version": "1.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dependencies": { "defaults": "^1.0.3" } @@ -11385,8 +11391,9 @@ } }, "node_modules/winston": { - "version": "3.8.2", - "license": "MIT", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.10.0.tgz", + "integrity": "sha512-nT6SIDaE9B7ZRO0u3UvdrimG0HkB7dSTAgInQnNR2SOPJ4bvq5q79+pXLftKmP52lJGW15+H5MCK0nM9D3KB/g==", "dependencies": { "@colors/colors": "1.5.0", "@dabh/diagnostics": "^2.0.2", @@ -11406,7 +11413,8 @@ }, "node_modules/winston-elasticsearch": { "version": "0.17.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.17.1.tgz", + "integrity": "sha512-wqSHtuNRp/92ghM1fZbs/WfA6rFI2VEqShobPpnGxQ8JmqvW/q9VfRenWJ21qddYQCsaQTspyoG9NxUFezDXqQ==", "dependencies": { "@elastic/elasticsearch": "^8.2.0-patch.1", "dayjs": "^1.11.2", @@ -11426,10 +11434,11 @@ } }, "node_modules/winston-elasticsearch/node_modules/@elastic/elasticsearch": { - "version": "8.6.0", - "license": "Apache-2.0", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.9.0.tgz", + "integrity": "sha512-UyolnzjOYTRL2966TYS3IoJP4tQbvak/pmYmbP3JdphD53RjkyVDdxMpTBv+2LcNBRrvYPTzxQbpRW/nGSXA9g==", "dependencies": { - "@elastic/transport": "^8.3.1", + "@elastic/transport": "^8.3.2", "tslib": "^2.4.0" }, "engines": { @@ -11472,8 +11481,10 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "license": "MIT", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -11484,70 +11495,37 @@ "license": "Apache-2.0" }, "node_modules/wrap-ansi": { - "version": "8.0.1", - "license": "MIT", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=8" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.1", - "license": "MIT", + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">=8" } }, - "node_modules/wrap-ansi/node_modules/emoji-regex": { - "version": "9.2.2", - "license": "MIT" - }, "node_modules/wrap-ansi/node_modules/string-width": { - "version": "5.1.2", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.0.1", - "license": "MIT", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dependencies": { - "ansi-regex": "^6.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">=8" } }, "node_modules/wrappy": { @@ -11556,8 +11534,9 @@ }, "node_modules/write": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, - "license": "MIT", "dependencies": { "mkdirp": "^0.5.1" }, @@ -11566,21 +11545,22 @@ } }, "node_modules/write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/ws": { - "version": "8.12.0", - "license": "MIT", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.0.tgz", + "integrity": "sha512-WR0RJE9Ehsio6U4TuM+LmunEsjQ5ncHlw4sn9ihD6RoJKZrVyH9FWV3dmnwu8B2aNib1OvG2X6adUCyFpQyWcg==", "engines": { "node": ">=10.0.0" }, @@ -11607,7 +11587,8 @@ }, "node_modules/xtend": { "version": "4.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "engines": { "node": ">=0.4" } @@ -11624,16 +11605,18 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.2.1", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", + "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", "dev": true, - "license": "ISC", "engines": { "node": ">= 14" } }, "node_modules/yargs": { - "version": "17.6.2", - "license": "MIT", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -11755,6 +11738,11 @@ } }, "dependencies": { + "@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==" + }, "@ampproject/remapping": { "version": "2.2.0", "dev": true, @@ -11883,7 +11871,9 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.20.2", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", "dev": true }, "@babel/helper-simple-access": { @@ -12014,12 +12004,12 @@ } }, "@babel/plugin-syntax-jsx": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", - "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.22.5" } }, "@babel/plugin-syntax-logical-assignment-operators": { @@ -12072,12 +12062,12 @@ } }, "@babel/plugin-syntax-typescript": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz", - "integrity": "sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.19.0" + "@babel/helper-plugin-utils": "^7.22.5" } }, "@babel/runtime-corejs3": { @@ -12187,27 +12177,46 @@ } }, "@elastic/transport": { - "version": "8.3.1", + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.3.3.tgz", + "integrity": "sha512-g5nc//dq/RQUTMkJUB8Ui8KJa/WflWmUa7yLl4SRZd67PPxIp3cn+OvGMNIhpiLRcfz1upanzgZHb/7Po2eEdQ==", "requires": { "debug": "^4.3.4", "hpagent": "^1.0.0", "ms": "^2.1.3", "secure-json-parse": "^2.4.0", "tslib": "^2.4.0", - "undici": "^5.5.1" + "undici": "^5.22.1" }, "dependencies": { "hpagent": { - "version": "1.2.0" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==" } } }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.0.tgz", + "integrity": "sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==" + }, "@eslint/eslintrc": { - "version": "1.4.1", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", "requires": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -12216,6 +12225,11 @@ "strip-json-comments": "^3.1.1" } }, + "@eslint/js": { + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.48.0.tgz", + "integrity": "sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==" + }, "@flatten-js/interval-tree": { "version": "1.0.20" }, @@ -12223,7 +12237,9 @@ "version": "1.1.3" }, "@humanwhocodes/config-array": { - "version": "0.11.8", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "requires": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", @@ -12234,7 +12250,9 @@ "version": "1.0.1" }, "@humanwhocodes/object-schema": { - "version": "1.2.1" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" }, "@ioredis/commands": { "version": "1.2.0" @@ -12305,161 +12323,124 @@ "dev": true }, "@jest/console": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.4.1.tgz", - "integrity": "sha512-m+XpwKSi3PPM9znm5NGS8bBReeAJJpSkL1OuFCqaMaJL2YX9YXLkkI+MBchMPwu+ZuM2rynL51sgfkQteQ1CKQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.4.tgz", + "integrity": "sha512-wNK6gC0Ha9QeEPSkeJedQuTQqxZYnDPuDcDhVuVatRvMkL4D0VTvFVZj+Yuh6caG2aOfzkUZ36KtCmLNtR02hw==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", "slash": "^3.0.0" } }, "@jest/core": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.4.1.tgz", - "integrity": "sha512-RXFTohpBqpaTebNdg5l3I5yadnKo9zLBajMT0I38D0tDhreVBYv3fA8kywthI00sWxPztWLD3yjiUkewwu/wKA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.4.tgz", + "integrity": "sha512-U/vq5ccNTSVgYH7mHnodHmCffGWHJnz/E1BEWlLuK5pM4FZmGfBn/nrJGLjUsSmyx3otCeqc1T31F4y08AMDLg==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/reporters": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/reporters": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.4.0", - "jest-config": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-resolve-dependencies": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", - "jest-watcher": "^29.4.1", + "jest-changed-files": "^29.6.3", + "jest-config": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-resolve-dependencies": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "jest-watcher": "^29.6.4", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true - } } }, "@jest/environment": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.4.1.tgz", - "integrity": "sha512-pJ14dHGSQke7Q3mkL/UZR9ZtTOxqskZaC91NzamEH4dlKRt42W+maRBXiw/LWkdJe+P0f/zDR37+SPMplMRlPg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.6.4.tgz", + "integrity": "sha512-sQ0SULEjA1XUTHmkBRl7A1dyITM9yb1yb3ZNKPX3KlTd6IG7mWUe3e2yfExtC2Zz1Q+mMckOLHmL/qLiuQJrBQ==", "dev": true, "requires": { - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1" + "jest-mock": "^29.6.3" } }, "@jest/expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-ZxKJP5DTUNF2XkpJeZIzvnzF1KkfrhEF6Rz0HGG69fHl6Bgx5/GoU3XyaeFYEjuuKSOOsbqD/k72wFvFxc3iTw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.6.4.tgz", + "integrity": "sha512-Warhsa7d23+3X5bLbrbYvaehcgX5TLYhI03JKoedTiI8uJU4IhqYBWF7OSSgUyz4IgLpUYPkK0AehA5/fRclAA==", "dev": true, "requires": { - "expect": "^29.4.1", - "jest-snapshot": "^29.4.1" + "expect": "^29.6.4", + "jest-snapshot": "^29.6.4" } }, "@jest/expect-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.4.1.tgz", - "integrity": "sha512-w6YJMn5DlzmxjO00i9wu2YSozUYRBhIoJ6nQwpMYcBMtiqMGJm1QBzOf6DDgRao8dbtpDoaqLg6iiQTvv0UHhQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.6.4.tgz", + "integrity": "sha512-FEhkJhqtvBwgSpiTrocquJCdXPsyvNKcl/n7A3u7X4pVoF4bswm11c9d4AV+kfq2Gpv/mM8x7E7DsRvH+djkrg==", "dev": true, "requires": { - "jest-get-type": "^29.2.0" + "jest-get-type": "^29.6.3" } }, "@jest/fake-timers": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.4.1.tgz", - "integrity": "sha512-/1joI6rfHFmmm39JxNfmNAO3Nwm6Y0VoL5fJDy7H1AtWrD1CgRtqJbN9Ld6rhAkGO76qqp4cwhhxJ9o9kYjQMw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.6.4.tgz", + "integrity": "sha512-6UkCwzoBK60edXIIWb0/KWkuj7R7Qq91vVInOe3De6DSpaEiqjKcJw4F7XUet24Wupahj9J6PlR09JqJ5ySDHw==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@sinonjs/fake-timers": "^10.0.2", "@types/node": "*", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" - }, - "dependencies": { - "@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", - "dev": true, - "requires": { - "@sinonjs/commons": "^2.0.0" - } - } + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" } }, "@jest/globals": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.4.1.tgz", - "integrity": "sha512-znoK2EuFytbHH0ZSf2mQK2K1xtIgmaw4Da21R2C/NE/+NnItm5mPEFQmn8gmF3f0rfOlmZ3Y3bIf7bFj7DHxAA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.6.4.tgz", + "integrity": "sha512-wVIn5bdtjlChhXAzVXavcY/3PEjf4VqM174BM3eGL5kMxLiZD5CLnbmkEyA1Dwh9q8XjP6E8RwjBsY/iCWrWsA==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/types": "^29.4.1", - "jest-mock": "^29.4.1" + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/types": "^29.6.3", + "jest-mock": "^29.6.3" } }, "@jest/reporters": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.4.1.tgz", - "integrity": "sha512-AISY5xpt2Xpxj9R6y0RF1+O6GRy9JsGa8+vK23Lmzdy1AYcpQn5ItX79wJSsTmfzPKSAcsY1LNt/8Y5Xe5LOSg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.4.tgz", + "integrity": "sha512-sxUjWxm7QdchdrD3NfWKrL8FBsortZeibSJv4XLjESOOjSUOkjQcb0ZHJwfhEGIvBvTluTzfG2yZWZhkrXJu8g==", "dev": true, "requires": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/console": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", @@ -12467,93 +12448,108 @@ "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^5.1.0", + "istanbul-lib-instrument": "^6.0.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", "slash": "^3.0.0", "string-length": "^4.0.1", "strip-ansi": "^6.0.0", "v8-to-istanbul": "^9.0.1" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.0.tgz", + "integrity": "sha512-x58orMzEVfzPUKqlbLd1hXCnySCxKdDKa6Rjg97CwuLLRI4g3FHTdnExu1OqffVFay6zeMW+T6/DowFLndWnIw==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + } + } } }, "@jest/schemas": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.4.0.tgz", - "integrity": "sha512-0E01f/gOZeNTG76i5eWWSupvSHaIINrTie7vCyjiYFKgzNdyEGd12BUv4oNBFHOqlHDbtoJi3HrQ38KCC90NsQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", "dev": true, "requires": { - "@sinclair/typebox": "^0.25.16" + "@sinclair/typebox": "^0.27.8" } }, "@jest/source-map": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.2.0.tgz", - "integrity": "sha512-1NX9/7zzI0nqa6+kgpSdKPK+WU1p+SJk3TloWZf5MzPbxri9UEeXX5bWZAPCzbQcyuAzubcdUHA7hcNznmRqWQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", "dev": true, "requires": { - "@jridgewell/trace-mapping": "^0.3.15", + "@jridgewell/trace-mapping": "^0.3.18", "callsites": "^3.0.0", "graceful-fs": "^4.2.9" } }, "@jest/test-result": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.4.1.tgz", - "integrity": "sha512-WRt29Lwt+hEgfN8QDrXqXGgCTidq1rLyFqmZ4lmJOpVArC8daXrZWkWjiaijQvgd3aOUj2fM8INclKHsQW9YyQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.4.tgz", + "integrity": "sha512-uQ1C0AUEN90/dsyEirgMLlouROgSY+Wc/JanVVk0OiUKa5UFh7sJpMEM3aoUBAz2BRNvUJ8j3d294WFuRxSyOQ==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/types": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.4.1.tgz", - "integrity": "sha512-v5qLBNSsM0eHzWLXsQ5fiB65xi49A3ILPSFQKPXzGL4Vyux0DPZAIN7NAFJa9b4BiTDP9MBF/Zqc/QA1vuiJ0w==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.4.tgz", + "integrity": "sha512-E84M6LbpcRq3fT4ckfKs9ryVanwkaIB0Ws9bw3/yP4seRLg/VaCZ/LgW0MCq5wwk4/iP/qnilD41aj2fsw2RMg==", "dev": true, "requires": { - "@jest/test-result": "^29.4.1", + "@jest/test-result": "^29.6.4", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.6.4", "slash": "^3.0.0" } }, "@jest/transform": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.4.1.tgz", - "integrity": "sha512-5w6YJrVAtiAgr0phzKjYd83UPbCXsBRTeYI4BXokv9Er9CcrH9hfXL/crCvP2d2nGOcovPUnlYiLPFLZrkG5Hg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.6.4.tgz", + "integrity": "sha512-8thgRSiXUqtr/pPGY/OsyHuMjGyhVnWrFAwoxmIemlBuiMyU1WFs0tXoNxzcr4A4uErs/ABre76SGmrr5ab/AA==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/types": "^29.4.1", - "@jridgewell/trace-mapping": "^0.3.15", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", + "jest-haste-map": "^29.6.4", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.6.3", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "write-file-atomic": "^5.0.0" + "write-file-atomic": "^4.0.2" } }, "@jest/types": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.4.1.tgz", - "integrity": "sha512-zbrAXDUOnpJ+FMST2rV7QZOgec8rskg2zv8g2ajeqitp4tvZiyqTCYXANrKsM+ryj5o+LI+ZN2EgU9drrkiwSA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", "dev": true, "requires": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", @@ -12582,13 +12578,20 @@ "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.17", + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "requires": { @@ -12664,27 +12667,33 @@ "version": "1.1.0" }, "@sinclair/typebox": { - "version": "0.25.21", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.21.tgz", - "integrity": "sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==", + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, "@sinonjs/commons": { - "version": "1.8.6", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", "dev": true, "requires": { "type-detect": "4.0.8" } }, "@sinonjs/fake-timers": { - "version": "9.1.2", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", "dev": true, "requires": { - "@sinonjs/commons": "^1.7.0" + "@sinonjs/commons": "^3.0.0" } }, "@sinonjs/samsam": { "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz", + "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==", "dev": true, "requires": { "@sinonjs/commons": "^2.0.0", @@ -12694,6 +12703,8 @@ "dependencies": { "@sinonjs/commons": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -12725,9 +12736,9 @@ "dev": true }, "@types/babel__core": { - "version": "7.20.0", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", - "integrity": "sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", "dev": true, "requires": { "@babel/parser": "^7.20.7", @@ -12757,10 +12768,12 @@ } }, "@types/babel__traverse": { - "version": "7.18.3", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", "dev": true, "requires": { - "@babel/types": "^7.3.0" + "@babel/types": "^7.20.7" } }, "@types/graceful-fs": { @@ -12791,9 +12804,9 @@ } }, "@types/jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.0.tgz", - "integrity": "sha512-VaywcGQ9tPorCX/Jkkni7RWGFfI11whqzs8dvxF41P17Z+z872thvEvlIbznjPJ02kl1HMX3LmLOonsj2n7HeQ==", + "version": "29.5.4", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.4.tgz", + "integrity": "sha512-PhglGmhWeD46FYOVLt3X7TiWjzwuVGW9wG/4qocPevXMjCmrIc5b6db9WjeGE4QYVpUAWMDv3v0IiBwObY289A==", "dev": true, "requires": { "expect": "^29.0.0", @@ -12808,18 +12821,14 @@ "version": "7.0.11" }, "@types/lodash": { - "version": "4.14.191", + "version": "4.14.198", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz", + "integrity": "sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==", "dev": true }, "@types/node": { "version": "18.11.18" }, - "@types/prettier": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", - "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", - "dev": true - }, "@types/semver": { "version": "7.3.13" }, @@ -12930,10 +12939,14 @@ "version": "1.1.1" }, "acorn": { - "version": "8.8.1" + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==" }, "acorn-jsx": { "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "requires": {} }, "acorn-walk": { @@ -13037,13 +13050,17 @@ "dev": true }, "ansi-escapes": { - "version": "6.0.0", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "requires": { - "type-fest": "^3.0.0" + "type-fest": "^0.21.3" }, "dependencies": { "type-fest": { - "version": "3.5.2" + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" } } }, @@ -13154,6 +13171,8 @@ }, "astral-regex": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", + "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", "dev": true }, "async": { @@ -13212,15 +13231,15 @@ "dev": true }, "babel-jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.1.tgz", - "integrity": "sha512-xBZa/pLSsF/1sNpkgsiT3CmY7zV1kAsZ9OxxtrFqYucnOuRftXAfcJqcDVyOPeN4lttWTwhLdu0T9f8uvoPEUg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.4.tgz", + "integrity": "sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw==", "dev": true, "requires": { - "@jest/transform": "^29.4.1", + "@jest/transform": "^29.6.4", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.4.0", + "babel-preset-jest": "^29.6.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" @@ -13238,9 +13257,9 @@ } }, "babel-plugin-jest-hoist": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.4.0.tgz", - "integrity": "sha512-a/sZRLQJEmsmejQ2rPEUe35nO1+C9dc9O1gplH1SXmJxveQSRUYdBk8yGZG/VOUuZs1u2aHZJusEGoRMbhhwCg==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", "dev": true, "requires": { "@babel/template": "^7.3.3", @@ -13268,12 +13287,12 @@ } }, "babel-preset-jest": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.4.0.tgz", - "integrity": "sha512-fUB9vZflUSM3dO/6M2TCAepTzvA4VkOvl67PjErcrQMGt9Eve7uazaeyCZ2th3UtI7ljpiBJES0F7A1vBRsLZA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", "dev": true, "requires": { - "babel-plugin-jest-hoist": "^29.4.0", + "babel-plugin-jest-hoist": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0" } }, @@ -13281,7 +13300,9 @@ "version": "1.0.2" }, "base64-js": { - "version": "1.5.1" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "basic-auth": { "version": "2.0.1", @@ -13323,6 +13344,8 @@ }, "bl": { "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -13391,6 +13414,8 @@ }, "buffer": { "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -13414,6 +13439,8 @@ }, "busboy": { "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "requires": { "streamsearch": "^1.1.0" } @@ -13530,7 +13557,9 @@ } }, "callsites": { - "version": "3.1.0" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" }, "camelcase": { "version": "5.3.1", @@ -13582,9 +13611,9 @@ "dev": true }, "cjs-module-lexer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz", - "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", "dev": true }, "clean-stack": { @@ -13601,13 +13630,17 @@ } }, "cli-cursor": { - "version": "4.0.0", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "requires": { - "restore-cursor": "^4.0.0" + "restore-cursor": "^3.1.0" } }, "cli-spinners": { - "version": "2.7.0" + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==" }, "cli-table3": { "version": "0.5.1", @@ -13619,7 +13652,9 @@ } }, "cli-width": { - "version": "4.0.0" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz", + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==" }, "cliui": { "version": "8.0.1", @@ -13651,7 +13686,9 @@ } }, "clone": { - "version": "1.0.4" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" }, "cluster-key-slot": { "version": "1.1.2" @@ -13694,9 +13731,9 @@ } }, "collect-v8-coverage": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz", - "integrity": "sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, "color": { @@ -13760,6 +13797,8 @@ }, "commist": { "version": "1.1.0", + "resolved": "https://registry.npmjs.org/commist/-/commist-1.1.0.tgz", + "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", "dev": true, "requires": { "leven": "^2.1.0", @@ -13768,6 +13807,8 @@ "dependencies": { "leven": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA==", "dev": true } } @@ -13882,7 +13923,9 @@ } }, "dayjs": { - "version": "1.11.7" + "version": "1.11.9", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz", + "integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==" }, "debug": { "version": "4.3.4", @@ -13900,16 +13943,19 @@ "dev": true }, "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA==", - "dev": true + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "requires": {} }, "deep-extend": { "version": "0.6.0" }, "deep-is": { - "version": "0.1.4" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" }, "deepmerge": { "version": "4.2.2", @@ -13924,6 +13970,8 @@ }, "defaults": { "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", "requires": { "clone": "^1.0.2" } @@ -13966,9 +14014,9 @@ "dev": true }, "diff-sequences": { - "version": "29.3.1", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.3.1.tgz", - "integrity": "sha512-hlM3QR272NXCi4pq+N4Kok4kOp6EsgOM3ZSpJI7Da3UAs+Ttsi8MRmB6trM/lhyzUxGfOgnpkHtgqm5Q/CTcfQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", "dev": true }, "dir-glob": { @@ -14008,9 +14056,6 @@ "es5-ext": "~0.10.46" } }, - "eastasianwidth": { - "version": "0.2.0" - }, "ecc-jsbn": { "version": "0.1.2", "dev": true, @@ -14307,46 +14352,46 @@ "dev": true }, "eslint": { - "version": "8.32.0", - "requires": { - "@eslint/eslintrc": "^1.4.1", - "@humanwhocodes/config-array": "^0.11.8", + "version": "8.48.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.48.0.tgz", + "integrity": "sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==", + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.48.0", + "@humanwhocodes/config-array": "^0.11.10", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "globals": "^13.19.0", - "grapheme-splitter": "^1.0.4", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "dependencies": { @@ -14375,12 +14420,16 @@ }, "eslint-plugin-prettier": { "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz", + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", "requires": { "prettier-linter-helpers": "^1.0.0" } }, "eslint-scope": { - "version": "7.1.1", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "requires": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -14398,14 +14447,18 @@ } }, "eslint-visitor-keys": { - "version": "3.3.0" + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==" }, "espree": { - "version": "9.4.1", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "requires": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" } }, "espresso-logic-minimizer": { @@ -14436,7 +14489,9 @@ "dev": true }, "esquery": { - "version": "1.4.0", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "requires": { "estraverse": "^5.1.0" } @@ -14461,7 +14516,9 @@ } }, "eventemitter3": { - "version": "4.0.7" + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, "execa": { "version": "5.1.1", @@ -14487,16 +14544,16 @@ "dev": true }, "expect": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.4.1.tgz", - "integrity": "sha512-OKrGESHOaMxK3b6zxIq9SOW8kEXztKff/Dvg88j4xIJxur1hspEbedVkR3GpHe5LO+WB2Qw7OWN0RMTdp6as5A==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.6.4.tgz", + "integrity": "sha512-F2W2UyQ8XYyftHT57dtfg8Ue3X5qLgm2sSug0ivvLRH/VKNRL/pDxg/TH7zVzbQB0tu80clNFy6LU7OS/VSEKA==", "dev": true, "requires": { - "@jest/expect-utils": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1" + "@jest/expect-utils": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3" } }, "ext": { @@ -14530,10 +14587,14 @@ "version": "3.1.3" }, "fast-diff": { - "version": "1.2.0" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==" }, "fast-glob": { - "version": "3.2.12", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -14556,7 +14617,9 @@ } }, "fast-levenshtein": { - "version": "2.0.6" + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" }, "fast-redact": { "version": "3.1.2", @@ -14734,9 +14797,9 @@ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" }, "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -14798,6 +14861,8 @@ }, "functional-red-black-tree": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", "dev": true }, "functions-have-names": { @@ -14906,7 +14971,9 @@ } }, "globals": { - "version": "13.19.0", + "version": "13.21.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", + "integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", "requires": { "type-fest": "^0.20.2" } @@ -14942,8 +15009,10 @@ "graceful-fs": { "version": "4.2.10" }, - "grapheme-splitter": { - "version": "1.0.4" + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" }, "har-schema": { "version": "2.0.0", @@ -15016,6 +15085,8 @@ }, "help-me": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-3.0.0.tgz", + "integrity": "sha512-hx73jClhyk910sidBB7ERlnhMlFsJJIBqSVMFDwPN8o2v9nmp5KgLq1Xz1Bf1fCMMZ6mPrX159iG0VLy/fPMtQ==", "dev": true, "requires": { "glob": "^7.1.6", @@ -15076,14 +15147,18 @@ } }, "hyperid": { - "version": "3.1.0", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hyperid/-/hyperid-3.1.1.tgz", + "integrity": "sha512-RveV33kIksycSf7HLkq1sHB5wW0OwuX8ot8MYnY++gaaPXGFfKpBncHrAWxdpuEeRlazUMGWefwP1w6o6GaumA==", "requires": { "uuid": "^8.3.2", "uuid-parse": "^1.1.0" }, "dependencies": { "uuid": { - "version": "8.3.2" + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" } } }, @@ -15094,7 +15169,9 @@ } }, "ieee754": { - "version": "1.2.1" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "5.2.4" @@ -15107,6 +15184,8 @@ }, "import-fresh": { "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "requires": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -15145,33 +15224,31 @@ "version": "1.3.8" }, "inquirer": { - "version": "9.1.4", + "version": "9.2.10", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.10.tgz", + "integrity": "sha512-tVVNFIXU8qNHoULiazz612GFl+yqNfjMTbLuViNJE/d860Qxrd3NMrse8dm40VUQLOQeULvaQF8lpAhvysjeyA==", "requires": { - "ansi-escapes": "^6.0.0", - "chalk": "^5.1.2", - "cli-cursor": "^4.0.0", - "cli-width": "^4.0.0", - "external-editor": "^3.0.3", + "@ljharb/through": "^2.3.9", + "ansi-escapes": "^4.3.2", + "chalk": "^5.3.0", + "cli-cursor": "^3.1.0", + "cli-width": "^4.1.0", + "external-editor": "^3.1.0", "figures": "^5.0.0", "lodash": "^4.17.21", - "mute-stream": "0.0.8", - "ora": "^6.1.2", - "run-async": "^2.4.0", - "rxjs": "^7.5.7", - "string-width": "^5.1.2", - "strip-ansi": "^7.0.1", - "through": "^2.3.6", - "wrap-ansi": "^8.0.1" + "mute-stream": "1.0.0", + "ora": "^5.4.1", + "run-async": "^3.0.0", + "rxjs": "^7.8.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^6.2.0" }, "dependencies": { - "ansi-regex": { - "version": "6.0.1" - }, "chalk": { - "version": "5.2.0" - }, - "emoji-regex": { - "version": "9.2.2" + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==" }, "escape-string-regexp": { "version": "5.0.0" @@ -15183,21 +15260,22 @@ "is-unicode-supported": "^1.2.0" } }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, "is-unicode-supported": { "version": "1.3.0" }, "string-width": { - "version": "5.1.2", - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - }, - "strip-ansi": { - "version": "7.0.1", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "requires": { - "ansi-regex": "^6.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" } } } @@ -15215,9 +15293,9 @@ } }, "ioredis": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.0.tgz", - "integrity": "sha512-Id9jKHhsILuIZpHc61QkagfVdUj2Rag5GzG1TGEvRNeM7dtTOjICgjC+tvqYxi//PuX2wjQ+Xjva2ONBuf92Pw==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", + "integrity": "sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==", "requires": { "@ioredis/commands": "^1.1.1", "cluster-key-slot": "^1.1.0", @@ -15322,7 +15400,9 @@ } }, "is-interactive": { - "version": "2.0.0" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" }, "is-lambda": { "version": "1.0.1" @@ -15411,8 +15491,7 @@ "dev": true }, "is-unicode-supported": { - "version": "0.1.0", - "dev": true + "version": "0.1.0" }, "is-weakref": { "version": "1.0.2", @@ -15509,226 +15588,228 @@ } }, "jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-cknimw7gAXPDOmj0QqztlxVtBVCw2lYY9CeIE5N6kD+kET1H4H79HSNISJmijb1HF+qk+G+ploJgiDi5k/fRlg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.4.tgz", + "integrity": "sha512-tEFhVQFF/bzoYV1YuGyzLPZ6vlPrdfvDmmAxudA1dLEuiztqg2Rkx20vkKY32xiDROcD2KXlgZ7Cu8RPeEHRKw==", "dev": true, "requires": { - "@jest/core": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.6.4", + "@jest/types": "^29.6.3", "import-local": "^3.0.2", - "jest-cli": "^29.4.1" + "jest-cli": "^29.6.4" } }, "jest-changed-files": { - "version": "29.4.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.4.0.tgz", - "integrity": "sha512-rnI1oPxgFghoz32Y8eZsGJMjW54UlqT17ycQeCEktcxxwqqKdlj9afl8LNeO0Pbu+h2JQHThQP0BzS67eTRx4w==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.6.3.tgz", + "integrity": "sha512-G5wDnElqLa4/c66ma5PG9eRjE342lIbF6SUnTJi26C3J28Fv2TVY2rOyKB9YGbSA5ogwevgmxc4j4aVjrEK6Yg==", "dev": true, "requires": { "execa": "^5.0.0", + "jest-util": "^29.6.3", "p-limit": "^3.1.0" } }, "jest-circus": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.4.1.tgz", - "integrity": "sha512-v02NuL5crMNY4CGPHBEflLzl4v91NFb85a+dH9a1pUNx6Xjggrd8l9pPy4LZ1VYNRXlb+f65+7O/MSIbLir6pA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.4.tgz", + "integrity": "sha512-YXNrRyntVUgDfZbjXWBMPslX1mQ8MrSG0oM/Y06j9EYubODIyHWP8hMUbjbZ19M3M+zamqEur7O80HODwACoJw==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/expect": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "dedent": "^0.7.0", + "dedent": "^1.0.0", "is-generator-fn": "^2.0.0", - "jest-each": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", + "jest-each": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", "p-limit": "^3.1.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", + "pure-rand": "^6.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "jest-cli": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.4.1.tgz", - "integrity": "sha512-jz7GDIhtxQ37M+9dlbv5K+/FVcIo1O/b1sX3cJgzlQUf/3VG25nvuWzlDC4F1FLLzUThJeWLu8I7JF9eWpuURQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.4.tgz", + "integrity": "sha512-+uMCQ7oizMmh8ZwRfZzKIEszFY9ksjjEQnTEMTaL7fYiL3Kw4XhqT9bYh+A4DQKUb67hZn2KbtEnDuHvcgK4pQ==", "dev": true, "requires": { - "@jest/core": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/core": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-config": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "prompts": "^2.0.1", "yargs": "^17.3.1" } }, "jest-config": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.4.1.tgz", - "integrity": "sha512-g7p3q4NuXiM4hrS4XFATTkd+2z0Ml2RhFmFPM8c3WyKwVDNszbl4E7cV7WIx1YZeqqCtqbtTtZhGZWJlJqngzg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.4.tgz", + "integrity": "sha512-JWohr3i9m2cVpBumQFv2akMEnFEPVOh+9L2xIBJhJ0zOaci2ZXuKJj0tgMKQCBZAKA09H049IR4HVS/43Qb19A==", "dev": true, "requires": { "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.4.1", - "@jest/types": "^29.4.1", - "babel-jest": "^29.4.1", + "@jest/test-sequencer": "^29.6.4", + "@jest/types": "^29.6.3", + "babel-jest": "^29.6.4", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^29.4.1", - "jest-environment-node": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-runner": "^29.4.1", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-circus": "^29.6.4", + "jest-environment-node": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" } }, "jest-diff": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.4.1.tgz", - "integrity": "sha512-uazdl2g331iY56CEyfbNA0Ut7Mn2ulAG5vUaEHXycf1L6IPyuImIxSz4F0VYBKi7LYIuxOwTZzK3wh5jHzASMw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.4.tgz", + "integrity": "sha512-9F48UxR9e4XOEZvoUXEHSWY4qC4zERJaOfrbBg9JpbJOO43R1vN76REt/aMGZoY6GD5g84nnJiBIVlscegefpw==", "dev": true, "requires": { "chalk": "^4.0.0", - "diff-sequences": "^29.3.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" } }, "jest-docblock": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.2.0.tgz", - "integrity": "sha512-bkxUsxTgWQGbXV5IENmfiIuqZhJcyvF7tU4zJ/7ioTutdz4ToB5Yx6JOFBpgI+TphRY4lhOyCWGNH/QFQh5T6A==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.6.3.tgz", + "integrity": "sha512-2+H+GOTQBEm2+qFSQ7Ma+BvyV+waiIFxmZF5LdpBsAEjWX8QYjSCa4FrkIYtbfXUJJJnFCYrOtt6TZ+IAiTjBQ==", "dev": true, "requires": { "detect-newline": "^3.0.0" } }, "jest-each": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.4.1.tgz", - "integrity": "sha512-QlYFiX3llJMWUV0BtWht/esGEz9w+0i7BHwODKCze7YzZzizgExB9MOfiivF/vVT0GSQ8wXLhvHXh3x2fVD4QQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.3.tgz", + "integrity": "sha512-KoXfJ42k8cqbkfshW7sSHcdfnv5agDdHCPA87ZBdmHP+zJstTJc0ttQaJ/x7zK6noAL76hOuTIJ6ZkQRS5dcyg==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", - "jest-util": "^29.4.1", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "jest-util": "^29.6.3", + "pretty-format": "^29.6.3" } }, "jest-environment-node": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.4.1.tgz", - "integrity": "sha512-x/H2kdVgxSkxWAIlIh9MfMuBa0hZySmfsC5lCsWmWr6tZySP44ediRKDUiNggX/eHLH7Cd5ZN10Rw+XF5tXsqg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.4.tgz", + "integrity": "sha512-i7SbpH2dEIFGNmxGCpSc2w9cA4qVD+wfvg2ZnfQ7XVrKL0NA5uDVBIiGH8SR4F0dKEv/0qI5r+aDomDf04DpEQ==", "dev": true, "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-mock": "^29.4.1", - "jest-util": "^29.4.1" + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" } }, "jest-get-type": { - "version": "29.2.0", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.2.0.tgz", - "integrity": "sha512-uXNJlg8hKFEnDgFsrCjznB+sTxdkuqiCL6zMgA75qEbAJjJYTs9XPrvDctrEig2GDow22T/LvHgO57iJhXB/UA==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", "dev": true }, "jest-haste-map": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.4.1.tgz", - "integrity": "sha512-imTjcgfVVTvg02khXL11NNLTx9ZaofbAWhilrMg/G8dIkp+HYCswhxf0xxJwBkfhWb3e8dwbjuWburvxmcr58w==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.6.4.tgz", + "integrity": "sha512-12Ad+VNTDHxKf7k+M65sviyynRoZYuL1/GTuhEVb8RYsNSNln71nANRb/faSyWvx0j+gHcivChXHIoMJrGYjog==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "fsevents": "^2.3.2", "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.2.0", - "jest-util": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", "micromatch": "^4.0.4", "walker": "^1.0.8" } }, "jest-leak-detector": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.4.1.tgz", - "integrity": "sha512-akpZv7TPyGMnH2RimOCgy+hPmWZf55EyFUvymQ4LMsQP8xSPlZumCPtXGoDhFNhUE2039RApZkTQDKU79p/FiQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.3.tgz", + "integrity": "sha512-0kfbESIHXYdhAdpLsW7xdwmYhLf1BRu4AA118/OxFm0Ho1b2RcTmO4oF6aAMaxpxdxnJ3zve2rgwzNBD4Zbm7Q==", "dev": true, "requires": { - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" } }, "jest-matcher-utils": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.4.1.tgz", - "integrity": "sha512-k5h0u8V4nAEy6lSACepxL/rw78FLDkBnXhZVgFneVpnJONhb2DhZj/Gv4eNe+1XqQ5IhgUcqj745UwH0HJmMnA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.6.4.tgz", + "integrity": "sha512-KSzwyzGvK4HcfnserYqJHYi7sZVqdREJ9DMPAKVbS98JsIAvumihaNUbjrWw0St7p9IY7A9UskCW5MYlGmBQFQ==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "pretty-format": "^29.4.1" + "jest-diff": "^29.6.4", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" } }, "jest-message-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.4.1.tgz", - "integrity": "sha512-H4/I0cXUaLeCw6FM+i4AwCnOwHRgitdaUFOdm49022YD5nfyr8C/DrbXOBEyJaj+w/y0gGJ57klssOaUiLLQGQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.3.tgz", + "integrity": "sha512-FtzaEEHzjDpQp51HX4UMkPZjy46ati4T5pEMyM6Ik48ztu4T9LQplZ6OsimHx7EuM9dfEh5HJa6D3trEftu3dA==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^29.4.1", + "pretty-format": "^29.6.3", "slash": "^3.0.0", "stack-utils": "^2.0.3" } }, "jest-mock": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.4.1.tgz", - "integrity": "sha512-MwA4hQ7zBOcgVCVnsM8TzaFLVUD/pFWTfbkY953Y81L5ret3GFRZtmPmRFAjKQSdCKoJvvqOu6Bvfpqlwwb0dQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.6.3.tgz", + "integrity": "sha512-Z7Gs/mOyTSR4yPsaZ72a/MtuK6RnC3JYqWONe48oLaoEcYwEDxqvbXz85G4SJrm2Z5Ar9zp6MiHF4AlFlRM4Pg==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", - "jest-util": "^29.4.1" + "jest-util": "^29.6.3" } }, "jest-pnp-resolver": { @@ -15739,135 +15820,132 @@ "requires": {} }, "jest-regex-util": { - "version": "29.2.0", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", "dev": true }, "jest-resolve": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.4.1.tgz", - "integrity": "sha512-j/ZFNV2lm9IJ2wmlq1uYK0Y/1PiyDq9g4HEGsNTNr3viRbJdV+8Lf1SXIiLZXFvyiisu0qUyIXGBnw+OKWkJwQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.4.tgz", + "integrity": "sha512-fPRq+0vcxsuGlG0O3gyoqGTAxasagOxEuyoxHeyxaZbc9QNek0AmJWSkhjlMG+mTsj+8knc/mWb3fXlRNVih7Q==", "dev": true, "requires": { "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", + "jest-haste-map": "^29.6.4", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.4.1", - "jest-validate": "^29.4.1", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", "resolve": "^1.20.0", "resolve.exports": "^2.0.0", "slash": "^3.0.0" } }, "jest-resolve-dependencies": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.4.1.tgz", - "integrity": "sha512-Y3QG3M1ncAMxfjbYgtqNXC5B595zmB6e//p/qpA/58JkQXu/IpLDoLeOa8YoYfsSglBKQQzNUqtfGJJT/qLmJg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.4.tgz", + "integrity": "sha512-7+6eAmr1ZBF3vOAJVsfLj1QdqeXG+WYhidfLHBRZqGN24MFRIiKG20ItpLw2qRAsW/D2ZUUmCNf6irUr/v6KHA==", "dev": true, "requires": { - "jest-regex-util": "^29.2.0", - "jest-snapshot": "^29.4.1" + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.6.4" } }, "jest-runner": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.4.1.tgz", - "integrity": "sha512-8d6XXXi7GtHmsHrnaqBKWxjKb166Eyj/ksSaUYdcBK09VbjPwIgWov1VwSmtupCIz8q1Xv4Qkzt/BTo3ZqiCeg==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.4.tgz", + "integrity": "sha512-SDaLrMmtVlQYDuG0iSPYLycG8P9jLI+fRm8AF/xPKhYDB2g6xDWjXBrR5M8gEWsK6KVFlebpZ4QsrxdyIX1Jaw==", "dev": true, "requires": { - "@jest/console": "^29.4.1", - "@jest/environment": "^29.4.1", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/console": "^29.6.4", + "@jest/environment": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.13.1", "graceful-fs": "^4.2.9", - "jest-docblock": "^29.2.0", - "jest-environment-node": "^29.4.1", - "jest-haste-map": "^29.4.1", - "jest-leak-detector": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-resolve": "^29.4.1", - "jest-runtime": "^29.4.1", - "jest-util": "^29.4.1", - "jest-watcher": "^29.4.1", - "jest-worker": "^29.4.1", + "jest-docblock": "^29.6.3", + "jest-environment-node": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-leak-detector": "^29.6.3", + "jest-message-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-util": "^29.6.3", + "jest-watcher": "^29.6.4", + "jest-worker": "^29.6.4", "p-limit": "^3.1.0", "source-map-support": "0.5.13" } }, "jest-runtime": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.4.1.tgz", - "integrity": "sha512-UXTMU9uKu2GjYwTtoAw5rn4STxWw/nadOfW7v1sx6LaJYa3V/iymdCLQM6xy3+7C6mY8GfX22vKpgxY171UIoA==", - "dev": true, - "requires": { - "@jest/environment": "^29.4.1", - "@jest/fake-timers": "^29.4.1", - "@jest/globals": "^29.4.1", - "@jest/source-map": "^29.2.0", - "@jest/test-result": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.4.tgz", + "integrity": "sha512-s/QxMBLvmwLdchKEjcLfwzP7h+jsHvNEtxGP5P+Fl1FMaJX2jMiIqe4rJw4tFprzCwuSvVUo9bn0uj4gNRXsbA==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/globals": "^29.6.4", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-mock": "^29.4.1", - "jest-regex-util": "^29.2.0", - "jest-resolve": "^29.4.1", - "jest-snapshot": "^29.4.1", - "jest-util": "^29.4.1", - "semver": "^7.3.5", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", "slash": "^3.0.0", "strip-bom": "^4.0.0" } }, "jest-snapshot": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.4.1.tgz", - "integrity": "sha512-l4iV8EjGgQWVz3ee/LR9sULDk2pCkqb71bjvlqn+qp90lFwpnulHj4ZBT8nm1hA1C5wowXLc7MGnw321u0tsYA==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.6.4.tgz", + "integrity": "sha512-VC1N8ED7+4uboUKGIDsbvNAZb6LakgIPgAF4RSpF13dN6YaMokfRqO+BaqK4zIh6X3JffgwbzuGqDEjHm/MrvA==", "dev": true, "requires": { "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-jsx": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/traverse": "^7.7.2", "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.4.1", - "@jest/transform": "^29.4.1", - "@jest/types": "^29.4.1", - "@types/babel__traverse": "^7.0.6", - "@types/prettier": "^2.1.5", + "@jest/expect-utils": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^29.4.1", + "expect": "^29.6.4", "graceful-fs": "^4.2.9", - "jest-diff": "^29.4.1", - "jest-get-type": "^29.2.0", - "jest-haste-map": "^29.4.1", - "jest-matcher-utils": "^29.4.1", - "jest-message-util": "^29.4.1", - "jest-util": "^29.4.1", + "jest-diff": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", "natural-compare": "^1.4.0", - "pretty-format": "^29.4.1", - "semver": "^7.3.5" + "pretty-format": "^29.6.3", + "semver": "^7.5.3" } }, "jest-util": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.4.1.tgz", - "integrity": "sha512-bQy9FPGxVutgpN4VRc0hk6w7Hx/m6L53QxpDreTZgJd9gfx/AV2MjyPde9tGyZRINAUrSv57p2inGBu2dRLmkQ==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.3.tgz", + "integrity": "sha512-QUjna/xSy4B32fzcKTSz1w7YYzgiHrjjJjevdRf61HYk998R5vVMMNmrHESYZVDS5DSWs+1srPLPKxXPkeSDOA==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -15876,17 +15954,17 @@ } }, "jest-validate": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.4.1.tgz", - "integrity": "sha512-qNZXcZQdIQx4SfUB/atWnI4/I2HUvhz8ajOSYUu40CSmf9U5emil8EDHgE7M+3j9/pavtk3knlZBDsgFvv/SWw==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.3.tgz", + "integrity": "sha512-e7KWZcAIX+2W1o3cHfnqpGajdCs1jSM3DkXjGeLSNmCazv1EeI1ggTeK5wdZhF+7N+g44JI2Od3veojoaumlfg==", "dev": true, "requires": { - "@jest/types": "^29.4.1", + "@jest/types": "^29.6.3", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^29.2.0", + "jest-get-type": "^29.6.3", "leven": "^3.1.0", - "pretty-format": "^29.4.1" + "pretty-format": "^29.6.3" }, "dependencies": { "camelcase": { @@ -15898,46 +15976,29 @@ } }, "jest-watcher": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.4.1.tgz", - "integrity": "sha512-vFOzflGFs27nU6h8dpnVRER3O2rFtL+VMEwnG0H3KLHcllLsU8y9DchSh0AL/Rg5nN1/wSiQ+P4ByMGpuybaVw==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.4.tgz", + "integrity": "sha512-oqUWvx6+On04ShsT00Ir9T4/FvBeEh2M9PTubgITPxDa739p4hoQweWPRGyYeaojgT0xTpZKF0Y/rSY1UgMxvQ==", "dev": true, "requires": { - "@jest/test-result": "^29.4.1", - "@jest/types": "^29.4.1", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "emittery": "^0.13.1", - "jest-util": "^29.4.1", + "jest-util": "^29.6.3", "string-length": "^4.0.1" - }, - "dependencies": { - "ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - } - }, - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true - } } }, "jest-worker": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.4.1.tgz", - "integrity": "sha512-O9doU/S1EBe+yp/mstQ0VpPwpv0Clgn68TkNwGxL6/usX/KUW9Arnn4ag8C3jc6qHcXznhsT5Na1liYzAsuAbQ==", + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.6.4.tgz", + "integrity": "sha512-6dpvFV4WjcWbDVGgHTWo/aupl8/LbBx2NSKfiwqf79xC/yeJjKHT1+StcKy/2KTmW16hE68ccKVOtXf+WZGz7Q==", "dev": true, "requires": { "@types/node": "*", - "jest-util": "^29.4.1", + "jest-util": "^29.6.3", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" }, @@ -15954,7 +16015,10 @@ } }, "js-sdsl": { - "version": "4.2.0" + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", + "dev": true }, "js-tokens": { "version": "4.0.0", @@ -16014,6 +16078,8 @@ }, "jsonwebtoken": { "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", "requires": { "jws": "^3.2.2", "lodash.includes": "^4.3.0", @@ -16028,7 +16094,9 @@ }, "dependencies": { "semver": { - "version": "5.7.1" + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==" } } }, @@ -16086,9 +16154,9 @@ } }, "koncorde": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/koncorde/-/koncorde-4.1.0.tgz", - "integrity": "sha512-YaeTfaVaqD4XXplnZwNnxeHEQxz/FaT+4YUFufhrmKyBgi2wJEIBMUx4TJoj+CuevQuwzQmBm2lDeFXaeMBk2Q==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/koncorde/-/koncorde-4.2.0.tgz", + "integrity": "sha512-VsLJ3Rdtt71jm2uzEkCerTiXgTm8nX4Vfu93ZS98IjciFIqOEEwI7sO/mCIAf97SEp8jH/tb5ZnDAd4BvJaj6w==", "requires": { "@flatten-js/interval-tree": "^1.0.14", "boost-geospatial-index": "^1.1.1", @@ -16227,12 +16295,12 @@ } }, "kuzzle-sdk": { - "version": "7.10.5", - "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.10.5.tgz", - "integrity": "sha512-Iy2mLReKIHZWWDZoOkHoPSyQx8hDF5Zn3fwYnljW39cfjfM+dqvwg4c+2ltNQp077LppWLpyZSv+jxFOOOHKQA==", + "version": "7.11.0", + "resolved": "https://registry.npmjs.org/kuzzle-sdk/-/kuzzle-sdk-7.11.0.tgz", + "integrity": "sha512-g1fvQLCm5/zFntwNa+09bIniyzofVVIanVBWcOuzjwqgg7sHeILJQUsiGdLaKQFQmZHrdfkYWQrcoD9f0Qb7Fg==", "requires": { "min-req-promise": "^1.0.1", - "ws": "^8.8.1" + "ws": "^8.13.0" } }, "kuzzle-vault": { @@ -16254,6 +16322,8 @@ }, "levn": { "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "requires": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -16283,6 +16353,8 @@ }, "lodash.get": { "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", "dev": true }, "lodash.includes": { @@ -16325,7 +16397,6 @@ }, "log-symbols": { "version": "4.1.0", - "dev": true, "requires": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -16342,7 +16413,9 @@ } }, "long": { - "version": "5.2.1" + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" }, "lower-case": { "version": "1.1.4", @@ -16476,7 +16549,9 @@ } }, "mimic-fn": { - "version": "2.1.0" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "min-req-promise": { "version": "1.0.1" @@ -16488,7 +16563,9 @@ } }, "minimist": { - "version": "1.2.7" + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" }, "minipass": { "version": "3.3.6", @@ -16720,6 +16797,8 @@ }, "mqtt": { "version": "4.3.7", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.3.7.tgz", + "integrity": "sha512-ew3qwG/TJRorTz47eW46vZ5oBw5MEYbQZVaEji44j5lAUSQSqIEoul7Kua/BatBW0H0kKQcC9kwUHa1qzaWHSw==", "dev": true, "requires": { "commist": "^1.0.0", @@ -16743,6 +16822,8 @@ "dependencies": { "lru-cache": { "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, "requires": { "yallist": "^4.0.0" @@ -16750,6 +16831,8 @@ }, "mqtt-packet": { "version": "6.10.0", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.10.0.tgz", + "integrity": "sha512-ja8+mFKIHdB1Tpl6vac+sktqy3gA8t9Mduom1BA75cI+R9AHnZOiaBQwpGiWnaVJLDGRdNhQmFaAqd7tkKSMGA==", "dev": true, "requires": { "bl": "^4.0.2", @@ -16759,11 +16842,15 @@ }, "ws": { "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "dev": true, "requires": {} }, "yallist": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true } } @@ -16789,7 +16876,9 @@ } }, "mute-stream": { - "version": "0.0.8" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz", + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==" }, "mz": { "version": "2.7.0", @@ -16854,6 +16943,8 @@ }, "nice-try": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, "nise": { @@ -16873,13 +16964,6 @@ "requires": { "type-detect": "4.0.8" } - }, - "@sinonjs/fake-timers": { - "version": "10.0.2", - "dev": true, - "requires": { - "@sinonjs/commons": "^2.0.0" - } } } }, @@ -17089,17 +17173,13 @@ } }, "number-allocator": { - "version": "1.0.12", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/number-allocator/-/number-allocator-1.0.14.tgz", + "integrity": "sha512-OrL44UTVAvkKdOdRQZIJpLkAdjXGTRda052sN4sO77bKEzYYqWKMBjQvrJFzqygI99gL6Z4u2xctPW1tB8ErvA==", "dev": true, "requires": { "debug": "^4.3.1", - "js-sdsl": "4.1.4" - }, - "dependencies": { - "js-sdsl": { - "version": "4.1.4", - "dev": true - } + "js-sdsl": "4.3.0" } }, "number-is-nan": { @@ -17218,15 +17298,6 @@ "strip-ansi": "^6.0.1" } }, - "wrap-ansi": { - "version": "6.2.0", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, "y18n": { "version": "4.0.3", "dev": true @@ -17317,6 +17388,8 @@ }, "onetime": { "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "requires": { "mimic-fn": "^2.1.0" } @@ -17326,67 +17399,32 @@ "optional": true }, "optionator": { - "version": "0.9.1", + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "requires": { + "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "type-check": "^0.4.0" } }, "ora": { - "version": "6.1.2", - "requires": { - "bl": "^5.0.0", - "chalk": "^5.0.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.6.1", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^1.1.0", - "log-symbols": "^5.1.0", - "strip-ansi": "^7.0.1", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", + "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "requires": { + "bl": "^4.1.0", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.5.0", + "is-interactive": "^1.0.0", + "is-unicode-supported": "^0.1.0", + "log-symbols": "^4.1.0", + "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "6.0.1" - }, - "bl": { - "version": "5.1.0", - "requires": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "buffer": { - "version": "6.0.3", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "chalk": { - "version": "5.2.0" - }, - "is-unicode-supported": { - "version": "1.3.0" - }, - "log-symbols": { - "version": "5.1.0", - "requires": { - "chalk": "^5.0.0", - "is-unicode-supported": "^1.1.0" - } - }, - "strip-ansi": { - "version": "7.0.1", - "requires": { - "ansi-regex": "^6.0.1" - } - } } }, "original-url": { @@ -17451,6 +17489,8 @@ }, "parent-module": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "requires": { "callsites": "^3.0.0" } @@ -17581,24 +17621,30 @@ } }, "prelude-ls": { - "version": "1.2.1" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" }, "prettier": { - "version": "2.8.3" + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==" }, "prettier-linter-helpers": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "requires": { "fast-diff": "^1.1.2" } }, "pretty-format": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.1.tgz", - "integrity": "sha512-dt/Z761JUVsrIKaY215o1xQJBGlSmTx/h4cSqXqjHLnU1+Kt+mavVE7UgqJJO5ukx5HjSswHfmXz4LjS2oIJfg==", + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.3.tgz", + "integrity": "sha512-ZsBgjVhFAj5KeK+nHfF1305/By3lechHQSMWCTl8iHSbfOm2TN5nHEtFc/+W7fAyUeCs2n5iow72gld4gW0xDw==", "dev": true, "requires": { - "@jest/schemas": "^29.4.0", + "@jest/schemas": "^29.6.3", "ansi-styles": "^5.0.0", "react-is": "^18.0.0" }, @@ -17654,9 +17700,9 @@ } }, "protobufjs": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.1.tgz", - "integrity": "sha512-L3pCItypTnPK27+CS8nuhZMYtsY+i8dqdq2vZsYHlG17CnWp1DWPQ/sos0vOKrj1fHEAzo3GBqSHLaeZyKUCDA==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", + "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", "requires": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -17682,6 +17728,8 @@ }, "pump": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, "requires": { "end-of-stream": "^1.1.0", @@ -17691,6 +17739,12 @@ "punycode": { "version": "2.2.0" }, + "pure-rand": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.3.tgz", + "integrity": "sha512-KddyFewCsO0j3+np81IQ+SweXLDnDQTs5s67BOnrYmYe/yNmUhttQyGsYzy8yUnoljGAQ9sl38YB4vH8ur7Y+w==", + "dev": true + }, "qlobber": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/qlobber/-/qlobber-5.0.3.tgz", @@ -17898,16 +17952,20 @@ } }, "resolve-from": { - "version": "4.0.0" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" }, "resolve.exports": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.0.tgz", - "integrity": "sha512-6K/gDlqgQscOlg9fSRpWstA8sYe8rbELsSTNpx+3kTrsVCzvSl0zIvRErM7fdl9ERWDsKnrLnwB+Ne89918XOg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true }, "restore-cursor": { - "version": "4.0.0", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "requires": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -17924,6 +17982,8 @@ }, "rewire": { "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rewire/-/rewire-5.0.0.tgz", + "integrity": "sha512-1zfitNyp9RH5UDyGGLe9/1N0bMlPQ0WrX0Tmg11kMHBpqwPJI4gfPpP7YngFyLbFmhXh19SToAG0sKKEFcOIJA==", "dev": true, "requires": { "eslint": "^6.8.0" @@ -17931,27 +17991,20 @@ "dependencies": { "acorn": { "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true }, - "ansi-escapes": { - "version": "4.3.2", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - }, - "dependencies": { - "type-fest": { - "version": "0.21.3", - "dev": true - } - } - }, "ansi-regex": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "ansi-styles": { "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "^1.9.0" @@ -17959,6 +18012,8 @@ }, "argparse": { "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { "sprintf-js": "~1.0.2" @@ -17966,6 +18021,8 @@ }, "chalk": { "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, "requires": { "ansi-styles": "^3.2.1", @@ -17973,19 +18030,16 @@ "supports-color": "^5.3.0" } }, - "cli-cursor": { - "version": "3.1.0", - "dev": true, - "requires": { - "restore-cursor": "^3.1.0" - } - }, "cli-width": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", "dev": true }, "color-convert": { "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { "color-name": "1.1.3" @@ -17993,10 +18047,14 @@ }, "color-name": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "cross-spawn": { "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "dev": true, "requires": { "nice-try": "^1.0.4", @@ -18007,17 +18065,23 @@ }, "dependencies": { "semver": { - "version": "5.7.1", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true } } }, "escape-string-regexp": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true }, "eslint": { "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -18061,6 +18125,8 @@ "dependencies": { "strip-ansi": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" @@ -18070,6 +18136,8 @@ }, "eslint-scope": { "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "requires": { "esrecurse": "^4.3.0", @@ -18078,6 +18146,8 @@ }, "eslint-utils": { "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" @@ -18085,10 +18155,14 @@ }, "eslint-visitor-keys": { "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true }, "espree": { "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "dev": true, "requires": { "acorn": "^7.1.1", @@ -18098,10 +18172,14 @@ }, "estraverse": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, "file-entry-cache": { "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, "requires": { "flat-cache": "^2.0.1" @@ -18109,6 +18187,8 @@ }, "flat-cache": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, "requires": { "flatted": "^2.0.0", @@ -18118,10 +18198,14 @@ }, "flatted": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, "globals": { "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", "dev": true, "requires": { "type-fest": "^0.8.1" @@ -18129,14 +18213,20 @@ }, "has-flag": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true }, "ignore": { "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, "inquirer": { "version": "7.3.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", + "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", "dev": true, "requires": { "ansi-escapes": "^4.2.1", @@ -18156,6 +18246,8 @@ "dependencies": { "ansi-styles": { "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { "color-convert": "^2.0.1" @@ -18163,6 +18255,8 @@ }, "chalk": { "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -18171,6 +18265,8 @@ }, "color-convert": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, "requires": { "color-name": "~1.1.4" @@ -18178,14 +18274,20 @@ }, "color-name": { "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, "has-flag": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "supports-color": { "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -18195,10 +18297,14 @@ }, "is-fullwidth-code-point": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, "js-yaml": { "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -18207,14 +18313,24 @@ }, "levn": { "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", "dev": true, "requires": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" } }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, "optionator": { "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, "requires": { "deep-is": "~0.1.3", @@ -18227,44 +18343,56 @@ }, "path-key": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", "dev": true }, "prelude-ls": { "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", "dev": true }, "regexpp": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, - "restore-cursor": { - "version": "3.1.0", - "dev": true, - "requires": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - } - }, "rimraf": { "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", "dev": true, "requires": { "glob": "^7.1.3" } }, + "run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true + }, "rxjs": { "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, "requires": { "tslib": "^1.9.0" } }, "semver": { - "version": "6.3.0", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, "shebang-command": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", "dev": true, "requires": { "shebang-regex": "^1.0.0" @@ -18272,10 +18400,14 @@ }, "shebang-regex": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", "dev": true }, "string-width": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, "requires": { "emoji-regex": "^8.0.0", @@ -18285,6 +18417,8 @@ }, "supports-color": { "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { "has-flag": "^3.0.0" @@ -18292,10 +18426,14 @@ }, "tslib": { "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, "type-check": { "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", "dev": true, "requires": { "prelude-ls": "~1.1.2" @@ -18303,10 +18441,14 @@ }, "type-fest": { "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "which": { "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, "requires": { "isexe": "^2.0.0" @@ -18325,7 +18467,9 @@ } }, "run-async": { - "version": "2.4.1" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", + "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==" }, "run-parallel": { "version": "1.2.0", @@ -18334,7 +18478,9 @@ } }, "rxjs": { - "version": "7.8.0", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "requires": { "tslib": "^2.1.0" } @@ -18368,7 +18514,9 @@ "dev": true }, "semver": { - "version": "7.3.8", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "requires": { "lru-cache": "^6.0.0" }, @@ -18496,6 +18644,8 @@ }, "sinon": { "version": "14.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz", + "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==", "dev": true, "requires": { "@sinonjs/commons": "^2.0.0", @@ -18508,11 +18658,33 @@ "dependencies": { "@sinonjs/commons": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", "dev": true, "requires": { "type-detect": "4.0.8" } }, + "@sinonjs/fake-timers": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + }, + "dependencies": { + "@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + } + } + }, "diff": { "version": "5.1.0", "dev": true @@ -18530,6 +18702,8 @@ }, "slice-ansi": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", + "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", "dev": true, "requires": { "ansi-styles": "^3.2.0", @@ -18539,6 +18713,8 @@ "dependencies": { "ansi-styles": { "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { "color-convert": "^1.9.0" @@ -18546,6 +18722,8 @@ }, "color-convert": { "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { "color-name": "1.1.3" @@ -18553,6 +18731,8 @@ }, "color-name": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true } } @@ -18723,7 +18903,9 @@ "dev": true }, "streamsearch": { - "version": "1.1.0" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" }, "string_decoder": { "version": "1.3.0", @@ -18821,6 +19003,8 @@ }, "table": { "version": "5.4.6", + "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", + "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, "requires": { "ajv": "^6.10.2", @@ -18831,14 +19015,20 @@ "dependencies": { "ansi-regex": { "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", "dev": true }, "emoji-regex": { "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, "string-width": { "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "dev": true, "requires": { "emoji-regex": "^7.0.1", @@ -18848,6 +19038,8 @@ }, "strip-ansi": { "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" @@ -18951,7 +19143,10 @@ } }, "through": { - "version": "2.3.8" + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true }, "through2": { "version": "4.0.2", @@ -19026,7 +19221,9 @@ "version": "1.0.0" }, "ts-jest": { - "version": "29.0.5", + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", + "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", "dev": true, "requires": { "bs-logger": "0.x", @@ -19035,7 +19232,7 @@ "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", - "semver": "7.x", + "semver": "^7.5.3", "yargs-parser": "^21.0.1" }, "dependencies": { @@ -19065,7 +19262,9 @@ } }, "tslib": { - "version": "2.4.1" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "tsutils": { "version": "3.21.0", @@ -19094,6 +19293,8 @@ }, "type-check": { "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "requires": { "prelude-ls": "^1.2.1" } @@ -19103,7 +19304,9 @@ "dev": true }, "type-fest": { - "version": "0.20.2" + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" }, "typed-array-length": { "version": "1.0.4", @@ -19141,7 +19344,9 @@ } }, "undici": { - "version": "5.15.0", + "version": "5.23.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz", + "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==", "requires": { "busboy": "^1.6.0" } @@ -19217,14 +19422,18 @@ "version": "9.0.0" }, "uuid-parse": { - "version": "1.1.0" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/uuid-parse/-/uuid-parse-1.1.0.tgz", + "integrity": "sha512-OdmXxA8rDsQ7YpNVbKSJkNzTw2I+S5WsbMDnCtIWSQaosNAcWtFuI/YK1TjzUI6nbkgiqEyh8gWngfcv8Asd9A==" }, "uWebSockets.js": { "version": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v20.7.0.tar.gz", "integrity": "sha512-1SNylEM0lt36S+0cB6loCIf+qp1HQuSNPx68MUJrZNUgpygWtw9ukSCOxecDRF0qbviVvsphdbA6w6hgOoaNtw==" }, "v8-compile-cache": { - "version": "2.3.0", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", + "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", "dev": true }, "v8-compile-cache-lib": { @@ -19232,9 +19441,9 @@ "dev": true }, "v8-to-istanbul": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.0.1.tgz", - "integrity": "sha512-74Y4LqY74kLE6IFyIjPtkSTWzUZmj8tdHT9Ii/26dvQ6K9Dl2NbEfj0XgU2sHCtKgt5VupqhlO/5aWuqS+IY1w==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", "dev": true, "requires": { "@jridgewell/trace-mapping": "^0.3.12", @@ -19251,9 +19460,9 @@ } }, "validator": { - "version": "13.9.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz", - "integrity": "sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==" + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", + "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" }, "verror": { "version": "1.10.1", @@ -19275,6 +19484,8 @@ }, "wcwidth": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "requires": { "defaults": "^1.0.3" } @@ -19331,7 +19542,9 @@ } }, "winston": { - "version": "3.8.2", + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.10.0.tgz", + "integrity": "sha512-nT6SIDaE9B7ZRO0u3UvdrimG0HkB7dSTAgInQnNR2SOPJ4bvq5q79+pXLftKmP52lJGW15+H5MCK0nM9D3KB/g==", "requires": { "@colors/colors": "1.5.0", "@dabh/diagnostics": "^2.0.2", @@ -19348,6 +19561,8 @@ }, "winston-elasticsearch": { "version": "0.17.1", + "resolved": "https://registry.npmjs.org/winston-elasticsearch/-/winston-elasticsearch-0.17.1.tgz", + "integrity": "sha512-wqSHtuNRp/92ghM1fZbs/WfA6rFI2VEqShobPpnGxQ8JmqvW/q9VfRenWJ21qddYQCsaQTspyoG9NxUFezDXqQ==", "requires": { "@elastic/elasticsearch": "^8.2.0-patch.1", "dayjs": "^1.11.2", @@ -19362,9 +19577,11 @@ }, "dependencies": { "@elastic/elasticsearch": { - "version": "8.6.0", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.9.0.tgz", + "integrity": "sha512-UyolnzjOYTRL2966TYS3IoJP4tQbvak/pmYmbP3JdphD53RjkyVDdxMpTBv+2LcNBRrvYPTzxQbpRW/nGSXA9g==", "requires": { - "@elastic/transport": "^8.3.1", + "@elastic/transport": "^8.3.2", "tslib": "^2.4.0" } }, @@ -19389,41 +19606,38 @@ } }, "word-wrap": { - "version": "1.2.3" + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true }, "workerpool": { "version": "6.2.1", "dev": true }, "wrap-ansi": { - "version": "8.0.1", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "dependencies": { - "ansi-regex": { - "version": "6.0.1" - }, - "ansi-styles": { - "version": "6.2.1" - }, - "emoji-regex": { - "version": "9.2.2" + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { - "version": "5.1.2", - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - } - }, - "strip-ansi": { - "version": "7.0.1", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "requires": { - "ansi-regex": "^6.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" } } } @@ -19433,15 +19647,17 @@ }, "write": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, "requires": { "mkdirp": "^0.5.1" } }, "write-file-atomic": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-5.0.0.tgz", - "integrity": "sha512-R7NYMnHSlV42K54lwY9lvW6MnSm1HSJqZL3xiSgi9E7//FYaI74r2G0rd+/X6VAMkHEdzxQaU5HUOXWUz5kA/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "requires": { "imurmurhash": "^0.1.4", @@ -19449,7 +19665,9 @@ } }, "ws": { - "version": "8.12.0", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.0.tgz", + "integrity": "sha512-WR0RJE9Ehsio6U4TuM+LmunEsjQ5ncHlw4sn9ihD6RoJKZrVyH9FWV3dmnwu8B2aNib1OvG2X6adUCyFpQyWcg==", "requires": {} }, "xregexp": { @@ -19460,7 +19678,9 @@ } }, "xtend": { - "version": "4.0.2" + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, "y18n": { "version": "5.0.8" @@ -19469,11 +19689,15 @@ "version": "3.1.1" }, "yaml": { - "version": "2.2.1", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.2.tgz", + "integrity": "sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==", "dev": true }, "yargs": { - "version": "17.6.2", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "requires": { "cliui": "^8.0.1", "escalade": "^3.1.1", diff --git a/test/kuzzle/kuzzlerc.test.js b/test/kuzzle/kuzzlerc.test.js index efc27f6b9e..62a50ad1b3 100644 --- a/test/kuzzle/kuzzlerc.test.js +++ b/test/kuzzle/kuzzlerc.test.js @@ -5,7 +5,9 @@ const fs = require("fs"); describe(".kuzzlerc.sample", () => { it("should be able to load the kuzzlerc sample file without errors", () => { - const content = fs.readFileSync(`${__dirname}/../../.kuzzlerc.sample`); + const content = fs.readFileSync( + `${__dirname}/../../.kuzzlerc.sample.jsonc` + ); const stripped = stripJson(content.toString()); // throw if malformed diff --git a/test/mocks/elasticsearch.mock.js b/test/mocks/elasticsearch.mock.js index b34ee7006a..577fccd882 100644 --- a/test/mocks/elasticsearch.mock.js +++ b/test/mocks/elasticsearch.mock.js @@ -1,7 +1,7 @@ "use strict"; const sinon = require("sinon"); -const { ElasticSearch } = require("../../lib/service/storage/elasticsearch"); +const ElasticSearch = require("../../lib/service/storage/elasticsearch"); class ElasticsearchMock extends ElasticSearch { constructor(kuzzle, config, scope) { diff --git a/test/service/storage/elasticsearch.test.js b/test/service/storage/elasticsearch.test.js index 414986ef07..75af0353a1 100644 --- a/test/service/storage/elasticsearch.test.js +++ b/test/service/storage/elasticsearch.test.js @@ -242,7 +242,7 @@ describe("Test: ElasticSearch service", () => { should(elasticsearch._client.scroll.firstCall.args[0]).be.deepEqual({ scroll: "10s", - scrollId: "i-am-scroll-id", + scroll_id: "i-am-scroll-id", }); should(result).be.match({ @@ -262,7 +262,7 @@ describe("Test: ElasticSearch service", () => { }, ], remaining: 997, - scrollId: "azerty", + scroll_id: "azerty", total: 1000, }); }); @@ -318,11 +318,11 @@ describe("Test: ElasticSearch service", () => { should(elasticsearch._client.clearScroll) .calledOnce() - .calledWithMatch({ scrollId: "azerty" }); + .calledWithMatch({ scroll_id: "azerty" }); should(elasticsearch._client.scroll.firstCall.args[0]).be.deepEqual({ scroll: "10s", - scrollId: "i-am-scroll-id", + scroll_id: "i-am-scroll-id", }); should(result).be.match({ @@ -342,7 +342,7 @@ describe("Test: ElasticSearch service", () => { }, ], remaining: 0, - scrollId: "azerty", + scroll_id: "azerty", total: 1000, }); }); @@ -410,8 +410,8 @@ describe("Test: ElasticSearch service", () => { ); should(elasticsearch._client.scroll.firstCall.args[0]).be.deepEqual({ - scrollId: "scroll-id", scroll: elasticsearch.config.defaults.scrollTTL, + scroll_id: "scroll-id", }); }); }); @@ -541,7 +541,7 @@ describe("Test: ElasticSearch service", () => { ], remaining: 0, suggest: { some: "suggest" }, - scrollId: "i-am-scroll-id", + scroll_id: "i-am-scroll-id", total: 1, }); }); @@ -1067,7 +1067,7 @@ describe("Test: ElasticSearch service", () => { }, id: "liia", refresh: "wait_for", - _source: true, + _source: "true", retry_on_conflict: 42, }); @@ -1119,7 +1119,7 @@ describe("Test: ElasticSearch service", () => { }, id: "liia", refresh: "wait_for", - _source: true, + _source: "true", retry_on_conflict: elasticsearch.config.defaults.onUpdateConflictRetries, }); @@ -1307,7 +1307,7 @@ describe("Test: ElasticSearch service", () => { }, id: "liia", refresh: "wait_for", - _source: true, + _source: "true", retry_on_conflict: 42, }); @@ -1361,7 +1361,7 @@ describe("Test: ElasticSearch service", () => { }, id: "liia", refresh: "wait_for", - _source: true, + _source: "true", retry_on_conflict: elasticsearch.config.defaults.onUpdateConflictRetries, }); @@ -1691,7 +1691,7 @@ describe("Test: ElasticSearch service", () => { }, }, index: alias, - refresh: "false", + refresh: false, }; elasticsearch._client.updateByQuery.resolves({ @@ -2178,7 +2178,7 @@ describe("Test: ElasticSearch service", () => { sinon.stub(elasticsearch, "_hasHiddenCollection").resolves(false); sinon.stub(elasticsearch, "deleteCollection").resolves(); sinon.stub(elasticsearch, "_getAvailableIndice").resolves(indice); - sinon.stub(elasticsearch, "_getWaitForActiveShards").returns(1); + sinon.stub(elasticsearch, "_getWaitForActiveShards").returns("1"); }); afterEach(() => { @@ -2514,12 +2514,12 @@ describe("Test: ElasticSearch service", () => { }); it("should only wait for one shard to being active when using a single node", async () => { - elasticsearch._getWaitForActiveShards = sinon.stub().returns(1); + elasticsearch._getWaitForActiveShards = sinon.stub().returns("1"); await elasticsearch.createCollection(index, collection); const esReq = elasticsearch._client.indices.create.firstCall.args[0]; - should(esReq.wait_for_active_shards).eql(1); + should(esReq.wait_for_active_shards).eql("1"); }); }); @@ -2956,7 +2956,7 @@ describe("Test: ElasticSearch service", () => { conflicts: "proceed", index: alias, refresh: true, - waitForCompletion: false, + wait_for_completion: false, }); }); }); @@ -5507,7 +5507,7 @@ describe("Test: ElasticSearch service", () => { const waitForActiveShards = await elasticsearch._getWaitForActiveShards(); - should(waitForActiveShards).be.eql(1); + should(waitForActiveShards).be.eql("1"); }); }); From 1de1bef7f1858808e2b60c6ff268e9beec64cc10 Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 7 Sep 2023 13:47:25 +0200 Subject: [PATCH 08/28] insert space (linting) --- lib/service/storage/elasticsearch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index a26db89a27..426420e36f 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -3839,4 +3839,4 @@ function _isObjectNameValid(name: string): boolean { // TODO: Remove this function when we move to Jest // This is kept because we use an old ReRequire that use require() instead of import -module.exports = ElasticSearch; \ No newline at end of file +module.exports = ElasticSearch; From b4c3cb1d34fea6c8577531bf2633a50394d8dcfc Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 7 Sep 2023 14:33:13 +0200 Subject: [PATCH 09/28] Update import --- docker/nginx-dev/kuzzle.conf | 4 ++-- lib/core/storage/clientAdapter.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/nginx-dev/kuzzle.conf b/docker/nginx-dev/kuzzle.conf index ab3dc5fbe2..0b042dda03 100644 --- a/docker/nginx-dev/kuzzle.conf +++ b/docker/nginx-dev/kuzzle.conf @@ -5,8 +5,8 @@ map $http_upgrade $connection_upgrade { upstream kuzzle { server kuzzle_node_1:7512; - server kuzzle_node_2:7512; - server kuzzle_node_3:7512; + # server kuzzle_node_2:7512; + # server kuzzle_node_3:7512; } server { diff --git a/lib/core/storage/clientAdapter.js b/lib/core/storage/clientAdapter.js index 108f0a5071..6362c2d465 100644 --- a/lib/core/storage/clientAdapter.js +++ b/lib/core/storage/clientAdapter.js @@ -21,7 +21,7 @@ "use strict"; -const ElasticSearch = require("../../service/storage/elasticsearch").default; +const ElasticSearch = require("../../service/storage/elasticsearch"); const { IndexCache } = require("./indexCache"); const { isPlainObject } = require("../../util/safeObject"); const kerror = require("../../kerror"); From d138c3390542d43167c3c7109c12a8ad4cfece2e Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 7 Sep 2023 15:00:40 +0200 Subject: [PATCH 10/28] Testing --- .kuzzlerc.sample.jsonc => .kuzzlerc.sample | 0 features-legacy/step_definitions/profiles.js | 556 ++++++++++-------- .../step_definitions/readDocument.js | 369 +++++++----- features-legacy/step_definitions/users.js | 385 ++++++------ .../step_definitions/validation.js | 362 +++++++----- test/kuzzle/kuzzlerc.test.js | 4 +- 6 files changed, 932 insertions(+), 744 deletions(-) rename .kuzzlerc.sample.jsonc => .kuzzlerc.sample (100%) diff --git a/.kuzzlerc.sample.jsonc b/.kuzzlerc.sample similarity index 100% rename from .kuzzlerc.sample.jsonc rename to .kuzzlerc.sample diff --git a/features-legacy/step_definitions/profiles.js b/features-legacy/step_definitions/profiles.js index 2551d076b3..9acc88e316 100644 --- a/features-legacy/step_definitions/profiles.js +++ b/features-legacy/step_definitions/profiles.js @@ -1,313 +1,385 @@ -'use strict'; +"use strict"; -const - { - Given, - When, - Then - } = require('cucumber'), - async = require('async'), - stringify = require('json-stable-stringify'); +const { Given, When, Then } = require("cucumber"), + async = require("async"), + stringify = require("json-stable-stringify"); When(/^I get the profile mapping$/, function () { - return this.api.getProfileMapping() - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.getProfileMapping().then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (! response.result) { - throw new Error('No result provided'); - } + if (!response.result) { + throw new Error("No result provided"); + } - if (! response.result.mapping) { - throw new Error('No mapping provided'); - } + if (!response.result.mapping) { + throw new Error("No mapping provided"); + } - this.result = response.result.mapping; - }); + this.result = response.result.mapping; + }); }); Then(/^I change the profile mapping$/, function () { - return this.api.updateProfileMapping() - .then(body => { - if (body.error !== null) { - throw new Error(body.error.message); - } - }); + return this.api.updateProfileMapping().then((body) => { + if (body.error !== null) { + throw new Error(body.error.message); + } + }); }); -When(/^I create a new profile "([^"]*)" with id "([^"]*)"$/, { timeout: 20 * 1000 }, function (profile, id) { - if (! this.profiles[profile]) { - throw new Error('Fixture for profile ' + profile + ' does not exists'); - } - - id = this.idPrefix + id; - - return this.api.createOrReplaceProfile(id, this.profiles[profile]) - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } - }); -}); +When( + /^I create a new profile "([^"]*)" with id "([^"]*)"$/, + { timeout: 20 * 1000 }, + function (profile, id) { + if (!this.profiles[profile]) { + throw new Error("Fixture for profile " + profile + " does not exists"); + } -Then(/^I cannot create an invalid profile$/, { timeout: 20 * 1000 }, function (callback) { - this.api.createOrReplaceProfile('invalid-profile', this.profiles.invalidProfile) - .then(() => { - callback(new Error('Creating profile with unexisting role succeeded. Expected to throw.')); - }) - .catch(() => callback()); -}); + id = this.idPrefix + id; -Then(/^I cannot create a profile with an empty set of roles$/, { timeout: 20 * 1000 }, function (callback) { - this.api.createOrReplaceProfile('invalid-profile', this.profiles.empty) - .then(() => { - callback(new Error('Creating profile without roles succeeded. Expected to throw.')); - }) - .catch(() => callback()); -}); + return this.api + .createOrReplaceProfile(id, this.profiles[profile]) + .then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + }); + } +); + +Then( + /^I cannot create an invalid profile$/, + { timeout: 20 * 1000 }, + function (callback) { + this.api + .createOrReplaceProfile("invalid-profile", this.profiles.invalidProfile) + .then(() => { + callback( + new Error( + "Creating profile with unexisting role succeeded. Expected to throw." + ) + ); + }) + .catch(() => callback()); + } +); + +Then( + /^I cannot create a profile with an empty set of roles$/, + { timeout: 20 * 1000 }, + function (callback) { + this.api + .createOrReplaceProfile("invalid-profile", this.profiles.empty) + .then(() => { + callback( + new Error( + "Creating profile without roles succeeded. Expected to throw." + ) + ); + }) + .catch(() => callback()); + } +); Then(/^I cannot get a profile without ID$/, function (callback) { - this.api.getProfile('') + this.api + .getProfile("") .then(() => { - callback(new Error('Getting profile without id succeeded. Expected to throw.')); + callback( + new Error("Getting profile without id succeeded. Expected to throw.") + ); }) .catch(() => callback()); }); -Then(/^I'm ?(not)* able to find the ?(default)* profile with id "([^"]*)"(?: with profile "([^"]*)")?$/, { timeout: 20 * 1000 }, function (not, _default, id, profile, callback) { - if (profile && ! this.profiles[profile]) { - return callback(new Error('Fixture for profile ' + profile + ' not exists')); - } +Then( + /^I'm ?(not)* able to find the ?(default)* profile with id "([^"]*)"(?: with profile "([^"]*)")?$/, + { timeout: 20 * 1000 }, + function (not, _default, id, profile, callback) { + if (profile && !this.profiles[profile]) { + return callback( + new Error("Fixture for profile " + profile + " not exists") + ); + } - if (! _default) { - id = this.idPrefix + id; - } + if (!_default) { + id = this.idPrefix + id; + } - const main = function (callbackAsync) { - setTimeout(() => { - this.api.getProfile(id) - .then(body => { - if (body.error) { - return callbackAsync(new Error(body.error.message)); - } - - if (not) { - return callbackAsync(new Error(`Profile with id ${id} exists`)); - } - - if (profile) { - const - compare = (a, b) => { - return a.roleId <= b.roleId; - }, - policies = stringify(body.result._source.policies.sort(compare)), - expected = stringify(this.profiles[profile].policies.sort(compare)); - - if (policies !== expected) { - return callbackAsync('policies does not match'); + const main = function (callbackAsync) { + setTimeout(() => { + this.api + .getProfile(id) + .then((body) => { + if (body.error) { + return callbackAsync(new Error(body.error.message)); } - } - - callbackAsync(); - }) - .catch(error => callback(not ? null : error)); - }, 20); // end setTimeout - }; - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(err); - } - - callback(); - }); -}); + if (not) { + return callbackAsync(new Error(`Profile with id ${id} exists`)); + } -Then(/^I'm ?(not)* able to find rights for profile "([^"]*)"$/, { timeout: 20 * 1000 }, function (not, id) { - return this.api.getProfileRights(this.idPrefix + id) - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } + if (profile) { + const compare = (a, b) => { + return a.roleId <= b.roleId; + }, + policies = stringify( + body.result._source.policies.sort(compare) + ), + expected = stringify( + this.profiles[profile].policies.sort(compare) + ); + + if (policies !== expected) { + return callbackAsync("policies does not match"); + } + } - const - policies = stringify(body.result.hits), - expected = stringify(this.policies[id]); + callbackAsync(); + }) + .catch((error) => callback(not ? null : error)); + }, 20); // end setTimeout + }; - if (policies !== expected) { - throw new Error(`Bad profileRights for ${id}.\nExpected: ${expected}\nGot: ${policies}`); + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(err); } - if (not) { - throw new Error(`Profile with id ${id} exists`); - } - }) - .catch(err => { - if (! not || err.statusCode !== 404) { - return Promise.reject(err); - } + callback(); }); -}); + } +); + +Then( + /^I'm ?(not)* able to find rights for profile "([^"]*)"$/, + { timeout: 20 * 1000 }, + function (not, id) { + return this.api + .getProfileRights(this.idPrefix + id) + .then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + + const policies = stringify(body.result.hits), + expected = stringify(this.policies[id]); + + if (policies !== expected) { + throw new Error( + `Bad profileRights for ${id}.\nExpected: ${expected}\nGot: ${policies}` + ); + } + + if (not) { + throw new Error(`Profile with id ${id} exists`); + } + }) + .catch((err) => { + if (!not || err.statusCode !== 404) { + return Promise.reject(err); + } + }); + } +); When(/^I delete the profile (?:with id )?"([^"]*)"$/, function (id) { if (id) { id = this.idPrefix + id; } - return this.api.deleteProfile(id) - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.deleteProfile(id).then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); -Then(/^I'm not able to delete profile (?:with id )?"([^"]*)"$/, function (id, callback) { - if (id) { - id = this.idPrefix + id; - } +Then( + /^I'm not able to delete profile (?:with id )?"([^"]*)"$/, + function (id, callback) { + if (id) { + id = this.idPrefix + id; + } - this.api.deleteProfile(id) - .then(() => { - callback(new Error('Trying to delete a profile still used by a user. Expected to throw.')); - }) - .catch(() => callback()); -}); + this.api + .deleteProfile(id) + .then(() => { + callback( + new Error( + "Trying to delete a profile still used by a user. Expected to throw." + ) + ); + }) + .catch(() => callback()); + } +); -Then(/^I'm able to find "([\d]*)" profiles(?: containing the role with id "([^"]*)")?$/, function (profilesCount, roleId, callback) { - const roles = []; +Then( + /^I'm able to find "([\d]*)" profiles(?: containing the role with id "([^"]*)")?$/, + function (profilesCount, roleId, callback) { + const roles = []; - if (roleId) { - roles.push(this.idPrefix + roleId); - } + if (roleId) { + roles.push(this.idPrefix + roleId); + } - let main = function (callbackAsync) { - setTimeout(() => { - this.api.searchProfiles(roles) - .then(response => { - if (response.error) { - return callbackAsync(new Error(response.error.message)); - } + let main = function (callbackAsync) { + setTimeout(() => { + this.api + .searchProfiles(roles) + .then((response) => { + if (response.error) { + return callbackAsync(new Error(response.error.message)); + } - if (! response.result) { - return callbackAsync(new Error('Malformed response (no error, no result)')); - } + if (!response.result) { + return callbackAsync( + new Error("Malformed response (no error, no result)") + ); + } - if (! Array.isArray(response.result.hits)) { - return callbackAsync(new Error('Malformed response (hits is not an array)')); - } + if (!Array.isArray(response.result.hits)) { + return callbackAsync( + new Error("Malformed response (hits is not an array)") + ); + } - if (! response.result.hits) { - response.result.hits = response.result.hits.filter(doc => doc._id.indexOf(this.idPrefix)); + if (!response.result.hits) { + response.result.hits = response.result.hits.filter((doc) => + doc._id.indexOf(this.idPrefix) + ); - if (response.result.hits.length !== parseInt(profilesCount)) { - return callbackAsync(`Expected ${profilesCount} profiles. Got ${response.result.hits.length}`); + if (response.result.hits.length !== parseInt(profilesCount)) { + return callbackAsync( + `Expected ${profilesCount} profiles. Got ${response.result.hits.length}` + ); + } } - } - callbackAsync(); - }) - .catch(err => callbackAsync(err)); - }, 200); - }; + callbackAsync(); + }) + .catch((err) => callbackAsync(err)); + }, 200); + }; + + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(new Error(err)); + } - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(new Error(err)); + callback(); + }); + } +); + +Given( + /^I update the ?(default)* profile with id "([^"]*)" by adding the role "([^"]*)"$/, + { timeout: 20 * 1000 }, + function (_default, profileId, roleId) { + if (!this.roles[roleId]) { + throw new Error("Fixture for role " + roleId + " does not exists"); } - callback(); - }); -}); + const policies = [{ roleId: this.idPrefix + roleId }]; + + if (_default) { + // keep `admin`/`default`/`anonymous` roles for eponymous profiles + // (to avoid error if we try to update anonymous profile without anonymous role) + policies.push({ roleId: profileId }); + } else { + profileId = this.idPrefix + profileId; + } -Given(/^I update the ?(default)* profile with id "([^"]*)" by adding the role "([^"]*)"$/, { timeout: 20 * 1000 }, function (_default, profileId, roleId) { - if (! this.roles[roleId]) { - throw new Error('Fixture for role ' + roleId + ' does not exists'); + return this.api + .createOrReplaceProfile(profileId, { policies }) + .then((response) => { + if (response.error) { + throw new Error(response.error.message); + } + }); } +); + +Then( + /^I'm able to do a multi get with "([^"]*)" and get "(\d*)" profiles$/, + function (profiles, count, callback) { + let body = { + ids: profiles.split(",").map((roleId) => this.idPrefix + roleId), + }; + + let main = function (callbackAsync) { + setTimeout(() => { + this.api + .mGetProfiles(body) + .then((response) => { + if (response.error) { + return callbackAsync(response.error.message); + } - const policies = [{ roleId: this.idPrefix + roleId }]; + if ( + !response.result.hits || + response.result.hits.length !== parseInt(count) + ) { + return callbackAsync( + "Expected " + + count + + " profiles, get " + + response.result.hits.length + ); + } - if (_default) { - // keep `admin`/`default`/`anonymous` roles for eponymous profiles - // (to avoid error if we try to update anonymous profile without anonymous role) - policies.push({ roleId: profileId }); - } - else { - profileId = this.idPrefix + profileId; - } + callbackAsync(); + }) + .catch((err) => callbackAsync(err)); + }, 100); // end setTimeout + }; - return this.api.createOrReplaceProfile(profileId, { policies }) - .then(response => { - if (response.error) { - throw new Error(response.error.message); + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(err); } - }); -}); -Then(/^I'm able to do a multi get with "([^"]*)" and get "(\d*)" profiles$/, function (profiles, count, callback) { - let body = { - ids: profiles.split(',').map(roleId => this.idPrefix + roleId) - }; - - let main = function (callbackAsync) { - setTimeout(() => { - this.api.mGetProfiles(body) - .then(response => { - if (response.error) { - return callbackAsync(response.error.message); - } - - if (! response.result.hits || response.result.hits.length !== parseInt(count)) { - return callbackAsync('Expected ' + count + ' profiles, get ' + response.result.hits.length); - } - - callbackAsync(); - }) - .catch(err => callbackAsync(err)); - }, 100); // end setTimeout - }; - - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(err); - } - - callback(); - }); -}); + callback(); + }); + } +); Given(/^A scrolled search on profiles$/, function () { this.scrollId = null; - return this.api.searchProfiles([], { scroll: '2s' }) - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.searchProfiles([], { scroll: "2s" }).then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (! response.result.scrollId) { - throw new Error('No scrollId returned by the searchProfile query'); - } + if (!response.result.scroll_id) { + throw new Error("No scrollId returned by the searchProfile query"); + } - this.scrollId = response.result.scrollId; - }); + this.scrollId = response.result.scroll_id; + }); }); Then(/^I am able to perform a scrollProfiles request$/, function () { - if (! this.scrollId) { - throw new Error('No previous scrollId found'); + if (!this.scrollId) { + throw new Error("No previous scrollId found"); } - return this.api.scrollProfiles(this.scrollId) - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.scrollProfiles(this.scrollId).then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { - throw new Error('Incomplete scroll results'); - } - }); + if ( + ["hits", "scrollId", "total"].some( + (prop) => response.result[prop] === undefined + ) + ) { + throw new Error("Incomplete scroll results"); + } + }); }); diff --git a/features-legacy/step_definitions/readDocument.js b/features-legacy/step_definitions/readDocument.js index 8dd6f4c200..7af209f0c8 100644 --- a/features-legacy/step_definitions/readDocument.js +++ b/features-legacy/step_definitions/readDocument.js @@ -1,165 +1,189 @@ -'use strict'; - -const - { - Then - } = require('cucumber'), - async = require('async'), - Bluebird = require('bluebird'); - -Then(/^I'm ?(not)* able to get the document(?: in index "([^"]*)")?$/, function (not, index, callback) { - var main = function (callbackAsync) { - this.api.get(this.result._id, index) - .then(body => { - if (body.error && ! not) { - if (body.error.message) { - callbackAsync(body.error.message); +"use strict"; + +const { Then } = require("cucumber"), + async = require("async"), + Bluebird = require("bluebird"); + +Then( + /^I'm ?(not)* able to get the document(?: in index "([^"]*)")?$/, + function (not, index, callback) { + var main = function (callbackAsync) { + this.api + .get(this.result._id, index) + .then((body) => { + if (body.error && !not) { + if (body.error.message) { + callbackAsync(body.error.message); + return false; + } + + callbackAsync(body.error); return false; } - callbackAsync(body.error); - return false; - } + if (!body.result || !body.result._source) { + if (not) { + callbackAsync(); + return false; + } - if (! body.result || ! body.result._source) { - if (not) { - callbackAsync(); + callbackAsync("No result provided"); return false; } - callbackAsync('No result provided'); - return false; - } - - if (not) { - callbackAsync('Object with id ' + this.result._id + ' exists'); - return false; - } - - callbackAsync(); - }) - .catch(function (error) { - if (not) { - callbackAsync(); - return false; - } - - callbackAsync(error); - }); - }; - - - async.retry({ times: 20, interval: 20 }, main.bind(this), function (err) { - if (err) { - if (err.message) { - err = err.message; - } - callback(new Error(err)); - return false; - } - - callback(); - }); -}); - -Then(/^my document has the value "([^"]*)" in field "([^"]*)"$/, function (value, field, callback) { - var main = function (callbackAsync) { - setTimeout(function () { - this.api.get(this.result._id) - .then(function (body) { - - if (body.error) { - callbackAsync(body.error.message); - return false; - } - - if (body.result._source[field] === undefined) { - callbackAsync('Undefined field ' + field); - return false; - } - - if (body.result._source[field] !== value) { - callbackAsync('Value in field ' + field + ' is ' + body.result._source[field] + ' expected to be ' + value); + if (not) { + callbackAsync("Object with id " + this.result._id + " exists"); return false; } callbackAsync(); }) .catch(function (error) { + if (not) { + callbackAsync(); + return false; + } + callbackAsync(error); }); - }.bind(this), 100); // end setTimeout - }; + }; - async.retry(20, main.bind(this), function (err) { - if (err) { - if (err.message) { - err = err.message; + async.retry({ times: 20, interval: 20 }, main.bind(this), function (err) { + if (err) { + if (err.message) { + err = err.message; + } + callback(new Error(err)); + return false; } - callback(new Error(err)); - return false; - } - - callback(); - }); -}); + callback(); + }); + } +); + +Then( + /^my document has the value "([^"]*)" in field "([^"]*)"$/, + function (value, field, callback) { + var main = function (callbackAsync) { + setTimeout( + function () { + this.api + .get(this.result._id) + .then(function (body) { + if (body.error) { + callbackAsync(body.error.message); + return false; + } + + if (body.result._source[field] === undefined) { + callbackAsync("Undefined field " + field); + return false; + } + + if (body.result._source[field] !== value) { + callbackAsync( + "Value in field " + + field + + " is " + + body.result._source[field] + + " expected to be " + + value + ); + return false; + } + + callbackAsync(); + }) + .catch(function (error) { + callbackAsync(error); + }); + }.bind(this), + 100 + ); // end setTimeout + }; + + async.retry(20, main.bind(this), function (err) { + if (err) { + if (err.message) { + err = err.message; + } -Then(/^I ?(don't)* find a document with "([^"]*)"(?: in field "([^"]*)")?(?: in index "([^"]*)")?(?: with scroll "([^"]*)")?$/, function (dont, value, field, index, scroll) { - const query = { query: { match: { [field]: (value === 'true' ? true : value) } } }; - const args = {}; + callback(new Error(err)); + return false; + } - if (scroll) { - args.scroll = scroll; - args.from = 0; - args.size = 1; + callback(); + }); } +); + +Then( + /^I ?(don't)* find a document with "([^"]*)"(?: in field "([^"]*)")?(?: in index "([^"]*)")?(?: with scroll "([^"]*)")?$/, + function (dont, value, field, index, scroll) { + const query = { + query: { match: { [field]: value === "true" ? true : value } }, + }; + const args = {}; + + if (scroll) { + args.scroll = scroll; + args.from = 0; + args.size = 1; + } - return this.api.search(query, index, null, args) - .then(body => { - if (body.error !== null) { - if (dont) { - return Bluebird.resolve(); + return this.api + .search(query, index, null, args) + .then((body) => { + if (body.error !== null) { + if (dont) { + return Bluebird.resolve(); + } + + return Bluebird.reject(body.error); } - return Bluebird.reject(body.error); - } + if (body.result && body.result.scroll_id) { + this.scrollId = body.result.scroll_id; + } - if (body.result && body.result.scrollId) { - this.scrollId = body.result.scrollId; - } + if (body.result && body.result.hits && body.result.total !== 0) { + if (dont) { + return Bluebird.reject( + new Error("A document exists for the query") + ); + } + return Bluebird.resolve(); + } - if (body.result && body.result.hits && body.result.total !== 0) { if (dont) { - return Bluebird.reject(new Error('A document exists for the query')); + return Bluebird.resolve(); } - return Bluebird.resolve(); - } - - if (dont) { - return Bluebird.resolve(); - } - return Bluebird.reject(new Error('No result for query search')); - }) - .catch(error => { - if (dont) { - return Bluebird.resolve(); - } - return Bluebird.reject(error); - }); -}); + return Bluebird.reject(new Error("No result for query search")); + }) + .catch((error) => { + if (dont) { + return Bluebird.resolve(); + } + return Bluebird.reject(error); + }); + } +); Then(/^I am ?(not)* able to scroll previous search$/, function (not) { - if (! this.scrollId) { + if (!this.scrollId) { if (not) { return Bluebird.resolve(); } - return Bluebird.reject(new Error('No scroll id from previous search available')); + return Bluebird.reject( + new Error("No scroll id from previous search available") + ); } - return this.api.scroll(this.scrollId) - .then(body => { + return this.api + .scroll(this.scrollId) + .then((body) => { if (body.error !== null) { if (not) { return Bluebird.resolve(); @@ -170,19 +194,21 @@ Then(/^I am ?(not)* able to scroll previous search$/, function (not) { if (body.result && body.result.hits && body.result.hits.length > 0) { if (not) { - return Bluebird.reject(new Error('A document exists for the scrollId')); + return Bluebird.reject( + new Error("A document exists for the scrollId") + ); } return Bluebird.resolve(); } if (not) { - return Bluebird.resolve(); + return Bluebird.resolve(); } - return Bluebird.reject(new Error('No result for scrollId search')); + return Bluebird.reject(new Error("No result for scrollId search")); }) - .catch(error => { + .catch((error) => { if (not) { - return Bluebird.resolve(); + return Bluebird.resolve(); } return Bluebird.reject(error); }); @@ -194,40 +220,57 @@ Then(/^I should receive a document id$/, function (callback) { return false; } - callback(new Error('No id information in returned object')); + callback(new Error("No id information in returned object")); }); -Then(/^I get ([\d]+) documents '([^']+)'?$/, function (count, documents, callback) { - documents = JSON.parse(documents); - - this.api.mGet({ ids: documents }) - .then(response => { - if (response.error !== null) { - callback(response.error.message); - return false; - } - else if (response.result.total !== Number.parseInt(count)) { - callback('Document count (' + response.result.total + ') not as expected (' + count + ')'); - return false; - } +Then( + /^I get ([\d]+) documents '([^']+)'?$/, + function (count, documents, callback) { + documents = JSON.parse(documents); - callback(); - }) - .catch(function (error) { - callback(error); - }); -}); + this.api + .mGet({ ids: documents }) + .then((response) => { + if (response.error !== null) { + callback(response.error.message); + return false; + } else if (response.result.total !== Number.parseInt(count)) { + callback( + "Document count (" + + response.result.total + + ") not as expected (" + + count + + ")" + ); + return false; + } -Then(/^I check that the document "([^"]*)" ?(doesn't)* exists$/, function (id, doesnt, callback) { - this.api.exists(id) - .then(response => { - if (response.result) { - return (doesnt === undefined) ? callback() : callback(new Error('The document exists')); - } + callback(); + }) + .catch(function (error) { + callback(error); + }); + } +); + +Then( + /^I check that the document "([^"]*)" ?(doesn't)* exists$/, + function (id, doesnt, callback) { + this.api + .exists(id) + .then((response) => { + if (response.result) { + return doesnt === undefined + ? callback() + : callback(new Error("The document exists")); + } - return (doesnt === undefined) ? callback(new Error('The document doesn\'t exists')) : callback(); - }) - .catch(function (error) { - callback(error); - }); -}); + return doesnt === undefined + ? callback(new Error("The document doesn't exists")) + : callback(); + }) + .catch(function (error) { + callback(error); + }); + } +); diff --git a/features-legacy/step_definitions/users.js b/features-legacy/step_definitions/users.js index 51e78a12af..94a9f139e9 100644 --- a/features-legacy/step_definitions/users.js +++ b/features-legacy/step_definitions/users.js @@ -1,97 +1,96 @@ -'use strict'; +"use strict"; -const - { - When, - Given, - Then - } = require('cucumber'), - _ = require('lodash'), - async = require('async'); +const { When, Given, Then } = require("cucumber"), + _ = require("lodash"), + async = require("async"); When(/^I get the user mapping$/, function () { - return this.api.getUserMapping() - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.getUserMapping().then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (! response.result) { - throw new Error('No result provided'); - } + if (!response.result) { + throw new Error("No result provided"); + } - if (! response.result.mapping) { - throw new Error('No mapping provided'); - } + if (!response.result.mapping) { + throw new Error("No mapping provided"); + } - this.result = response.result.mapping; - }); + this.result = response.result.mapping; + }); }); Then(/^I change the user mapping$/, function () { - return this.api.updateUserMapping() - .then(body => { - if (body.error !== null) { - throw new Error(body.error.message); - } - }); + return this.api.updateUserMapping().then((body) => { + if (body.error !== null) { + throw new Error(body.error.message); + } + }); }); -When(/^I (can't )?create a (restricted )?user "(.*?)" with id "(.*?)"$/, { timeout: 20000 }, function (not, isRestricted, user, id, callback) { - var - userObject = this.users[user], - method; +When( + /^I (can't )?create a (restricted )?user "(.*?)" with id "(.*?)"$/, + { timeout: 20000 }, + function (not, isRestricted, user, id, callback) { + var userObject = this.users[user], + method; + + if (isRestricted) { + method = "createRestrictedUser"; + } else { + method = "createUser"; + } - if (isRestricted) { - method = 'createRestrictedUser'; - } - else { - method = 'createUser'; - } + id = this.idPrefix + id; - id = this.idPrefix + id; + this.api[method](userObject, id) + .then((body) => { + if (body.error) { + if (not) { + return callback(); + } + return callback(new Error(body.error.message)); + } - this.api[method](userObject, id) - .then(body => { - if (body.error) { if (not) { - return callback(); + return callback(new Error(JSON.stringify(body))); } - return callback(new Error(body.error.message)); - } - - if (not) { - return callback(new Error(JSON.stringify(body))); - } - return callback(); - }) - .catch(error => callback(not ? null : error)); -}); + return callback(); + }) + .catch((error) => callback(not ? null : error)); + } +); -When(/^I create the first admin with id "(.*?)"( and reset profiles and roles)?$/, { timeout: 20000 }, function (id, reset, callback) { - var - userObject = this.users.useradmin; +When( + /^I create the first admin with id "(.*?)"( and reset profiles and roles)?$/, + { timeout: 20000 }, + function (id, reset, callback) { + var userObject = this.users.useradmin; - delete userObject.content.profileIds; - id = this.idPrefix + id; + delete userObject.content.profileIds; + id = this.idPrefix + id; - this.api.createFirstAdmin(userObject, id, reset) - .then(body => { - if (body.error) { - return callback(new Error(body.error.message)); - } - - return callback(); - }) - .catch(error => callback(error)); -}); + this.api + .createFirstAdmin(userObject, id, reset) + .then((body) => { + if (body.error) { + return callback(new Error(body.error.message)); + } + return callback(); + }) + .catch((error) => callback(error)); + } +); -Then(/^I am able to get the user "(.*?)"(?: matching {(.*)})?$/, function (id, match) { - id = this.idPrefix + id; +Then( + /^I am able to get the user "(.*?)"(?: matching {(.*)})?$/, + function (id, match) { + id = this.idPrefix + id; - return this.api.getUser(id) - .then(body => { + return this.api.getUser(id).then((body) => { if (body.error) { throw new Error(body.error.message); } @@ -99,60 +98,88 @@ Then(/^I am able to get the user "(.*?)"(?: matching {(.*)})?$/, function (id, m if (match) { match = match.replace(/#prefix#/g, this.idPrefix); - const matchingObject = JSON.parse('{' + match + '}'); + const matchingObject = JSON.parse("{" + match + "}"); - if (! _.matches(matchingObject)(body.result)) { - throw new Error('Error: ' + JSON.stringify(body.result) + ' does not match {' + match + '}'); + if (!_.matches(matchingObject)(body.result)) { + throw new Error( + "Error: " + + JSON.stringify(body.result) + + " does not match {" + + match + + "}" + ); } } }); -}); - -Then(/^I search for {(.*?)} and find (\d+) users(?: matching {(.*?)})?$/, function (query, count, match, callback) { - if (count) { - count = parseInt(count); } +); - let run = (cb) => { - query = query.replace(/#prefix#/g, this.idPrefix); - - this.api.searchUsers(JSON.parse('{' + query + '}')) - .then(body => { - if (body.error) { - return cb(new Error(body.error.message)); - } +Then( + /^I search for {(.*?)} and find (\d+) users(?: matching {(.*?)})?$/, + function (query, count, match, callback) { + if (count) { + count = parseInt(count); + } - if (count !== body.result.total) { - return cb(new Error('Expected ' + count + ' results, got ' + body.result.total + '\n' + JSON.stringify(body.result.hits))); - } + let run = (cb) => { + query = query.replace(/#prefix#/g, this.idPrefix); - if (match) { - match = match.replace(/#prefix#/g, this.idPrefix); + this.api + .searchUsers(JSON.parse("{" + query + "}")) + .then((body) => { + if (body.error) { + return cb(new Error(body.error.message)); + } - const matchFunc = _.matches(JSON.parse('{' + match + '}')); + if (count !== body.result.total) { + return cb( + new Error( + "Expected " + + count + + " results, got " + + body.result.total + + "\n" + + JSON.stringify(body.result.hits) + ) + ); + } - if (! body.result.hits.every(hit => matchFunc(hit))) { - return cb(new Error('Error: ' + JSON.stringify(body.result.hits) + ' does not match ' + match)); + if (match) { + match = match.replace(/#prefix#/g, this.idPrefix); + + const matchFunc = _.matches(JSON.parse("{" + match + "}")); + + if (!body.result.hits.every((hit) => matchFunc(hit))) { + return cb( + new Error( + "Error: " + + JSON.stringify(body.result.hits) + + " does not match " + + match + ) + ); + } } - } - cb(null); - }) - .catch(error => cb(error)); - }; + cb(null); + }) + .catch((error) => cb(error)); + }; - async.retry({ times: 40, interval: 50 }, run, err => { - if (err) { - return callback(new Error(err.message)); - } + async.retry({ times: 40, interval: 50 }, run, (err) => { + if (err) { + return callback(new Error(err.message)); + } - return callback(); - }); -}); + return callback(); + }); + } +); Then(/^I replace the user "(.*?)" with data {(.*?)}$/, function (id, data) { - return this.api.replaceUser(this.idPrefix + id, JSON.parse('{' + data + '}')) - .then(body => { + return this.api + .replaceUser(this.idPrefix + id, JSON.parse("{" + data + "}")) + .then((body) => { if (body.error) { throw new Error(body.error.message); } @@ -160,60 +187,66 @@ Then(/^I replace the user "(.*?)" with data {(.*?)}$/, function (id, data) { }); Then(/^I revoke all tokens of the user "(.*?)"$/, function (id) { - return this.api.revokeTokens(this.idPrefix + id) - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.revokeTokens(this.idPrefix + id).then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); Then(/^I delete the user "(.*?)"$/, function (id) { - return this.api.deleteUser(this.idPrefix + id, true) - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.deleteUser(this.idPrefix + id, true).then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); -Then(/^I am getting the current user, which matches \{(.*?)}$/, function (match) { - return this.api.getCurrentUser() - .then(body => { +Then( + /^I am getting the current user, which matches \{(.*?)}$/, + function (match) { + return this.api.getCurrentUser().then((body) => { if (body.error) { throw new Error(body.error.message); } match = match.replace(/#prefix#/g, this.idPrefix); - if (! _.matches(JSON.parse('{' + match + '}'))(body.result)) { - throw new Error('Expected: ' + match + '\nGot: ' + JSON.stringify(body.result)); + if (!_.matches(JSON.parse("{" + match + "}"))(body.result)) { + throw new Error( + "Expected: " + match + "\nGot: " + JSON.stringify(body.result) + ); } }); -}); - -Then(/^I'm ?(not)* able to find rights for user "([^"]*)"$/, function (not, id, callback) { - id = this.idPrefix + id; + } +); - this.api.getUserRights(id) - .then(body => { - if (body.error) { - return callback(new Error(body.error.message)); - } +Then( + /^I'm ?(not)* able to find rights for user "([^"]*)"$/, + function (not, id, callback) { + id = this.idPrefix + id; - if (not) { - return callback(new Error(`User with id ${id} exists`)); - } + this.api + .getUserRights(id) + .then((body) => { + if (body.error) { + return callback(new Error(body.error.message)); + } - callback(); - }) - .catch(error => callback(not ? null : error)); -}); + if (not) { + return callback(new Error(`User with id ${id} exists`)); + } -Then(/^I'm ?(not)* able to check the token for current user/, function (not, callback) { + callback(); + }) + .catch((error) => callback(not ? null : error)); + } +); - this.api.checkToken(this.currentUser.token) - .then(body => { - if (! body.result.valid) { +Then( + /^I'm ?(not)* able to check the token for current user/, + function (not, callback) { + this.api.checkToken(this.currentUser.token).then((body) => { + if (!body.result.valid) { if (not) { return callback(); } @@ -221,47 +254,49 @@ Then(/^I'm ?(not)* able to check the token for current user/, function (not, cal } callback(); }); -}); + } +); Then(/^I'm able to find my rights$/, function () { - return this.api.getMyRights() - .then(body => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.getMyRights().then((body) => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); Given(/^A scrolled search on users$/, function () { this.scrollId = null; - return this.api.searchUsers({}, { scroll: '2s' }) - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.searchUsers({}, { scroll: "2s" }).then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (! response.result.scrollId) { - throw new Error('No scrollId returned by the searchProfile query'); - } + if (!response.result.scrollId) { + throw new Error("No scrollId returned by the searchProfile query"); + } - this.scrollId = response.result.scrollId; - }); + this.scrollId = response.result.scroll_id; + }); }); Then(/^I am able to perform a scrollUsers request$/, function () { - if (! this.scrollId) { - throw new Error('No previous scrollId found'); + if (!this.scrollId) { + throw new Error("No previous scrollId found"); } - return this.api.scrollUsers(this.scrollId) - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.scrollUsers(this.scrollId).then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { - throw new Error('Incomplete scroll results'); - } - }); + if ( + ["hits", "scrollId", "total"].some( + (prop) => response.result[prop] === undefined + ) + ) { + throw new Error("Incomplete scroll results"); + } + }); }); diff --git a/features-legacy/step_definitions/validation.js b/features-legacy/step_definitions/validation.js index bd3bed6a3d..8146e74c6c 100644 --- a/features-legacy/step_definitions/validation.js +++ b/features-legacy/step_definitions/validation.js @@ -1,127 +1,144 @@ -'use strict'; +"use strict"; -const - { - When, - Then - } = require('cucumber'), - async = require('async'); +const { When, Then } = require("cucumber"), + async = require("async"); -const - validSpecifications = { +const validSpecifications = { strict: true, fields: { myField: { mandatory: true, - type: 'integer', - defaultValue: 42 - } - } + type: "integer", + defaultValue: 42, + }, + }, }, notValidSpecifications = { strict: true, fields: { myField: { mandatory: true, - type: 'not valid', - defaultValue: 42 - } - } + type: "not valid", + defaultValue: 42, + }, + }, }, validDocument = { - myField: 42 + myField: 42, }, notValidDocument = { - myField: 'fooBarBaz' + myField: "fooBarBaz", }; -When(/^There is (no)?(a)? specifications? for index "([^"]*)" and collection "([^"]*)"$/, {}, function (no, some, index, collection, callback) { - const - idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection; +When( + /^There is (no)?(a)? specifications? for index "([^"]*)" and collection "([^"]*)"$/, + {}, + function (no, some, index, collection, callback) { + const idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection; + + this.api + .getSpecifications(idx, coll) + .then((body) => { + if (body.error) { + if (no) { + return callback(); + } + return callback(new Error(body.error.message)); + } - this.api.getSpecifications(idx, coll) - .then(body => { - if (body.error) { if (no) { + return callback(new Error(JSON.stringify(body))); + } + return callback(); + }) + .catch((error) => callback(no ? null : error)); + } +); + +Then( + /^I put a (not )?valid ?specification for index "([^"]*)" and collection "([^"]*)"$/, + {}, + function (not, index, collection, callback) { + const idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection, + specifications = not ? notValidSpecifications : validSpecifications, + body = specifications; + + this.api + .updateSpecifications(idx, coll, body) + .then((_body) => { + this.statusCode = _body.status; + if (not) { + return callback(new Error(JSON.stringify(_body))); + } + return callback(); + }) + .catch((error) => { + this.statusCode = error.statusCode; + if (not) { return callback(); } - return callback(new Error(body.error.message)); - } - - if (no) { - return callback(new Error(JSON.stringify(body))); - } - return callback(); - }) - .catch(error => callback(no ? null : error)); -}); - -Then(/^I put a (not )?valid ?specification for index "([^"]*)" and collection "([^"]*)"$/, {}, function (not, index, collection, callback) { - const - idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection, - specifications = not ? notValidSpecifications : validSpecifications, - body = specifications; - - this.api.updateSpecifications( - idx, - coll, - body) - .then(_body => { - this.statusCode = _body.status; - if (not) { - return callback(new Error(JSON.stringify(_body))); - } - return callback(); - }) - .catch(error => { - this.statusCode = error.statusCode; - if (not) { + callback(error); + }); + } +); + +Then( + /^There is (an)?(no)? error message( in the response body)?$/, + {}, + function (noError, withError, inBody, callback) { + if (this.statusCode !== 200) { + if (noError) { + if (inBody) { + // we should always have a 200 response status, error whould be in the response body + return callback( + new Error( + "Status code is " + this.statusCode + ", but 200 was expected" + ) + ); + } return callback(); } - callback(error); - }); -}); + return callback( + new Error( + "Status code is " + this.statusCode + ", but 200 was expected" + ) + ); + } -Then(/^There is (an)?(no)? error message( in the response body)?$/, {}, function (noError, withError, inBody, callback) { - if (this.statusCode !== 200) { + // Status is 200 if (noError) { if (inBody) { - // we should always have a 200 response status, error whould be in the response body - return callback(new Error('Status code is ' + this.statusCode + ', but 200 was expected')); + if ( + this.body.result.valid === false && + this.body.result.details && + this.body.result.description + ) { + return callback(); + } + return callback(new Error(JSON.stringify(this.body))); } - return callback(); + return callback( + new Error( + "Status code is " + this.statusCode + ", but an error was expected" + ) + ); } - return callback(new Error('Status code is ' + this.statusCode + ', but 200 was expected')); - } - // Status is 200 - if (noError) { - if (inBody) { - if (this.body.result.valid === false && this.body.result.details && this.body.result.description) { - return callback(); - } - return callback(new Error(JSON.stringify(this.body))); - } - return callback(new Error('Status code is ' + this.statusCode + ', but an error was expected')); + return callback(); } - - return callback(); -}); +); When(/^I post a(n in)? ?valid ?specification$/, {}, function (not, callback) { - const - index = this.fakeIndex, + const index = this.fakeIndex, collection = this.fakeCollection, specifications = not ? notValidSpecifications : validSpecifications, body = specifications; - this.api.validateSpecifications( - index, - collection, - body) - .then(_body => { + this.api + .validateSpecifications(index, collection, body) + .then((_body) => { this.statusCode = _body.status; this.body = _body; @@ -130,27 +147,27 @@ When(/^I post a(n in)? ?valid ?specification$/, {}, function (not, callback) { return callback(); }) - .catch(error => { + .catch((error) => { this.statusCode = error.statusCode; return callback(error); }); }); When(/^I post a(n in)? ?valid document/, {}, function (not, callback) { - const - index = this.fakeIndex, + const index = this.fakeIndex, collection = this.fakeCollection, document = not ? notValidDocument : validDocument; - this.api.postDocument(index, collection, document) - .then(body => { + this.api + .postDocument(index, collection, document) + .then((body) => { this.statusCode = body.status; if (not) { return callback(new Error(JSON.stringify(body))); } return callback(); }) - .catch(error => { + .catch((error) => { this.statusCode = error.statusCode; if (not) { return callback(); @@ -159,80 +176,103 @@ When(/^I post a(n in)? ?valid document/, {}, function (not, callback) { }); }); -When(/^I delete the specifications (again )?for index "([^"]*)" and collection "([^"]*)"$/, {}, function (again, index, collection, callback) { - const - idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection; +When( + /^I delete the specifications (again )?for index "([^"]*)" and collection "([^"]*)"$/, + {}, + function (again, index, collection, callback) { + const idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection; + + this.api + .deleteSpecifications(idx, coll) + .then((body) => { + this.statusCode = body.status; + callback(); + + return null; + }) + .catch((error) => { + this.statusCode = error.statusCode; + callback(); + + return null; + }); + } +); + +Then( + /^I find (\d+) specifications(?: with scroll "([^"]+)")?/, + function (hits, scroll, callback) { + this.scrollId = null; + + hits = Number.parseInt(hits); + + let search = function (callbackAsync) { + setTimeout(() => { + this.api + .searchSpecifications({}, scroll && { scroll }) + .then((response) => { + if (response.error) { + return callbackAsync(new Error(response.error.message)); + } + + if (scroll && !response.result.scrollId) { + return callbackAsync( + new Error("No scrollId returned by the searchProfile query") + ); + } + + if ( + response.result.hits === undefined || + response.result.total === undefined + ) { + return callbackAsync(new Error("Malformed search results")); + } + + if ( + response.result.hits.length !== hits || + response.result.total !== hits + ) { + return callbackAsync( + new Error( + `Wrong number of results. Expected: ${hits}, got ${response.result.hits.length} (or ${response.result.total})` + ) + ); + } + + this.scrollId = response.result.scroll_id; + callbackAsync(); + }) + .catch((err) => callbackAsync(err)); + }, 200); + }; + + async.retry(20, search.bind(this), function (err) { + if (err) { + return callback(new Error(err)); + } - this.api.deleteSpecifications(idx, coll) - .then(body => { - this.statusCode = body.status; callback(); - - return null; - }) - .catch(error => { - this.statusCode = error.statusCode; - callback(); - - return null; }); -}); - -Then(/^I find (\d+) specifications(?: with scroll "([^"]+)")?/, function (hits, scroll, callback) { - this.scrollId = null; - - hits = Number.parseInt(hits); - - let search = function (callbackAsync) { - setTimeout(() => { - this.api.searchSpecifications({}, scroll && { scroll }) - .then(response => { - if (response.error) { - return callbackAsync(new Error(response.error.message)); - } - - if (scroll && ! response.result.scrollId) { - return callbackAsync(new Error('No scrollId returned by the searchProfile query')); - } - - if (response.result.hits === undefined || response.result.total === undefined) { - return callbackAsync(new Error('Malformed search results')); - } - - if (response.result.hits.length !== hits || response.result.total !== hits) { - return callbackAsync(new Error(`Wrong number of results. Expected: ${hits}, got ${response.result.hits.length} (or ${response.result.total})`)); - } - - this.scrollId = response.result.scrollId; - callbackAsync(); - }) - .catch(err => callbackAsync(err)); - }, 200); - }; - - async.retry(20, search.bind(this), function (err) { - if (err) { - return callback(new Error(err)); - } - - callback(); - }); -}); + } +); Then(/^I am able to perform a scrollSpecifications request$/, function () { - if (! this.scrollId) { - throw new Error('No previous scrollId found'); + if (!this.scrollId) { + throw new Error("No previous scrollId found"); } - return this.api.scrollSpecifications(this.scrollId) - .then(response => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.scrollSpecifications(this.scrollId).then((response) => { + if (response.error) { + throw new Error(response.error.message); + } - if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { - throw new Error('Incomplete scroll results'); - } - }); + if ( + ["hits", "scrollId", "total"].some( + (prop) => response.result[prop] === undefined + ) + ) { + throw new Error("Incomplete scroll results"); + } + }); }); diff --git a/test/kuzzle/kuzzlerc.test.js b/test/kuzzle/kuzzlerc.test.js index 62a50ad1b3..efc27f6b9e 100644 --- a/test/kuzzle/kuzzlerc.test.js +++ b/test/kuzzle/kuzzlerc.test.js @@ -5,9 +5,7 @@ const fs = require("fs"); describe(".kuzzlerc.sample", () => { it("should be able to load the kuzzlerc sample file without errors", () => { - const content = fs.readFileSync( - `${__dirname}/../../.kuzzlerc.sample.jsonc` - ); + const content = fs.readFileSync(`${__dirname}/../../.kuzzlerc.sample`); const stripped = stripJson(content.toString()); // throw if malformed From 733d3f92b0cf7ab110c84bbb09def6987254f048 Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 7 Sep 2023 15:54:46 +0200 Subject: [PATCH 11/28] Update to avoid breaking change --- features-legacy/step_definitions/readDocument.js | 4 ++-- lib/service/storage/elasticsearch.ts | 2 +- package.json | 2 +- test/service/storage/elasticsearch.test.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/features-legacy/step_definitions/readDocument.js b/features-legacy/step_definitions/readDocument.js index 7af209f0c8..5eb39f17e8 100644 --- a/features-legacy/step_definitions/readDocument.js +++ b/features-legacy/step_definitions/readDocument.js @@ -143,8 +143,8 @@ Then( return Bluebird.reject(body.error); } - if (body.result && body.result.scroll_id) { - this.scrollId = body.result.scroll_id; + if (body.result && body.result.scrollId) { + this.scrollId = body.result.scrollId; } if (body.result && body.result.hits && body.result.total !== 0) { diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 426420e36f..08f562f956 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -608,7 +608,7 @@ export default class ElasticSearch extends Service { aggregations: body.aggregations, hits, remaining: body.remaining, - scroll_id: body._scroll_id, + scrollId: body._scroll_id, suggest: body.suggest, total: body.hits.total.value, }; diff --git a/package.json b/package.json index 7b5e64556e..3c4d934f69 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test:lint:ts": "eslint --max-warnings=0 ./lib --ext .ts --config .eslintc-ts.json", "test:lint": "npm run test:lint:js && npm run test:lint:ts", "test:unit:coverage": "DEBUG= nyc --reporter=text-summary --reporter=lcov mocha --exit", - "test:unit": "DEBUG= npx --node-arg=--trace-warnings mocha --exit", + "test:unit": "DEBUG= npx mocha --exit", "test": "npm run clean && npm run --silent test:lint && npm run build && npm run test:unit:coverage && npm run test:functional" }, "directories": { diff --git a/test/service/storage/elasticsearch.test.js b/test/service/storage/elasticsearch.test.js index 75af0353a1..850c81c819 100644 --- a/test/service/storage/elasticsearch.test.js +++ b/test/service/storage/elasticsearch.test.js @@ -262,7 +262,7 @@ describe("Test: ElasticSearch service", () => { }, ], remaining: 997, - scroll_id: "azerty", + scrollId: "azerty", total: 1000, }); }); @@ -342,7 +342,7 @@ describe("Test: ElasticSearch service", () => { }, ], remaining: 0, - scroll_id: "azerty", + scrollId: "azerty", total: 1000, }); }); @@ -541,7 +541,7 @@ describe("Test: ElasticSearch service", () => { ], remaining: 0, suggest: { some: "suggest" }, - scroll_id: "i-am-scroll-id", + scrollId: "i-am-scroll-id", total: 1, }); }); From 4414cfb98d472f0c2e0eb212441057704397325a Mon Sep 17 00:00:00 2001 From: rolljee Date: Tue, 19 Sep 2023 09:40:11 +0200 Subject: [PATCH 12/28] Update some commands --- .ci/scripts/run-monkey-tests.sh | 2 +- .ci/scripts/run-test-cluster.sh | 2 +- .github/actions/dockerhub/action.yml | 2 +- .github/workflows/workflow-deployments.yaml | 2 +- package.json | 26 ++++++++++----------- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.ci/scripts/run-monkey-tests.sh b/.ci/scripts/run-monkey-tests.sh index 43462fbbef..9059a32e99 100755 --- a/.ci/scripts/run-monkey-tests.sh +++ b/.ci/scripts/run-monkey-tests.sh @@ -18,7 +18,7 @@ then docker-compose -f ./.ci/test-cluster.yml run kuzzle_node_1 npm rebuild fi -npm run build-ts +npm run build echo "[$(date)] - Starting Kuzzle Cluster..." diff --git a/.ci/scripts/run-test-cluster.sh b/.ci/scripts/run-test-cluster.sh index 4380962e1d..ad85cd6141 100755 --- a/.ci/scripts/run-test-cluster.sh +++ b/.ci/scripts/run-test-cluster.sh @@ -19,7 +19,7 @@ then docker-compose -f ./.ci/test-cluster.yml run kuzzle_node_1 npm rebuild fi -npm run build-ts +npm run build echo "[$(date)] - Starting Kuzzle Cluster..." diff --git a/.github/actions/dockerhub/action.yml b/.github/actions/dockerhub/action.yml index 8108b88295..432fe19a67 100644 --- a/.github/actions/dockerhub/action.yml +++ b/.github/actions/dockerhub/action.yml @@ -18,7 +18,7 @@ runs: - name: Create JS from TS files run: | npm install - npm run build-ts + npm run build shell: bash - name: Build and deploy Docker images run: | diff --git a/.github/workflows/workflow-deployments.yaml b/.github/workflows/workflow-deployments.yaml index 788353bc62..fcfb8fe7f2 100644 --- a/.github/workflows/workflow-deployments.yaml +++ b/.github/workflows/workflow-deployments.yaml @@ -111,7 +111,7 @@ jobs: - name: Build TS files run: | npm install - npm run build-ts + npm run build - name: Build and push uses: docker/build-push-action@v2 with: diff --git a/package.json b/package.json index 3c4d934f69..ba9fe03c7b 100644 --- a/package.json +++ b/package.json @@ -5,30 +5,28 @@ "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.", "bin": "bin/start-kuzzle-server", "scripts": { - "build-ts": "tsc", - "build": "npm run build-ts", + "build": "tsc", "clean": "touch index.ts && npm run build | grep TSFILE | cut -d' ' -f 2 | xargs rm", "codecov": "codecov", "cucumber": "cucumber.js --fail-fast", "dev:test": "npm run dev -- docker/scripts/start-kuzzle-test.ts --enable-plugins functional-test-plugin", - "dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", + "dev": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", "doc-error-codes": "node -r ts-node/register doc/build-error-codes", "docker:install": "docker-compose run kuzzle_node_1 npm install", "docker:npm": "docker-compose run kuzzle_node_1 npm run --", "docker:test:unit": "docker-compose run kuzzle_node_1 npm run test:unit", "docker": "docker-compose run kuzzle_node_1 ", - "file": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", + "file": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", "prepublishOnly": "npm run build", - "prettier": "npx prettier ./lib ./test ./bin ./features ./plugins/available/functional-test-plugin --write", - "services": "npx kourou app:start-services", - "start:dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin", - "test:functional:http": "KUZZLE_PROTOCOL=http npx cucumber-js --profile http", + "prettier": "prettier ./lib ./test ./bin ./features ./plugins/available/functional-test-plugin --write", + "start:dev": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin", + "test:functional:http": "KUZZLE_PROTOCOL=http cucumber-js --profile http", "test:functional:jest": "npm run test:jest", - "test:functional:legacy:http": "npx cucumber-js --format progress-bar --profile http ./features-legacy", - "test:functional:legacy:mqtt": "npx cucumber-js --format progress-bar --profile mqtt ./features-legacy", - "test:functional:legacy:websocket": "npx cucumber-js --format progress-bar --profile websocket ./features-legacy", + "test:functional:legacy:http": "cucumber-js --format progress-bar --profile http ./features-legacy", + "test:functional:legacy:mqtt": "cucumber-js --format progress-bar --profile mqtt ./features-legacy", + "test:functional:legacy:websocket": "cucumber-js --format progress-bar --profile websocket ./features-legacy", "test:functional:legacy": "npm run test:functional:legacy:http && npm run test:functional:legacy:websocket && npm run test:functional:legacy:mqtt", - "test:functional:websocket": "KUZZLE_PROTOCOL=websocket npx cucumber-js --profile websocket", + "test:functional:websocket": "KUZZLE_PROTOCOL=websocket cucumber-js --profile websocket", "test:functional": "npm run test:functional:http && npm run test:functional:websocket && npm run test:jest", "test:jest": "jest", "test:lint:js:fix": "eslint --max-warnings=0 --fix ./lib ./test ./bin ./features", @@ -37,7 +35,7 @@ "test:lint:ts": "eslint --max-warnings=0 ./lib --ext .ts --config .eslintc-ts.json", "test:lint": "npm run test:lint:js && npm run test:lint:ts", "test:unit:coverage": "DEBUG= nyc --reporter=text-summary --reporter=lcov mocha --exit", - "test:unit": "DEBUG= npx mocha --exit", + "test:unit": "DEBUG= mocha --exit", "test": "npm run clean && npm run --silent test:lint && npm run build && npm run test:unit:coverage && npm run test:functional" }, "directories": { @@ -135,4 +133,4 @@ "LICENSE.md", "README.md" ] -} +} \ No newline at end of file From 7953f58f9f70661531e6bc6d2765bb48a2ed2f27 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 20 Sep 2023 15:46:24 +0200 Subject: [PATCH 13/28] Functional tests legacy --- .../step_definitions/collections.js | 321 ++-- features-legacy/step_definitions/profiles.js | 6 +- features-legacy/support/api/apiBase.js | 1313 ++++++++--------- features-legacy/support/api/http.js | 1101 ++++++++------ features-legacy/support/api/mqtt.js | 175 +-- features-legacy/support/api/websocket.js | 67 +- features-legacy/support/api/websocketBase.js | 159 +- features-legacy/support/config.js | 19 +- features-legacy/support/env.js | 2 +- features-legacy/support/hooks.js | 191 ++- features-legacy/support/stepUtils.js | 12 +- features-legacy/support/world.js | 453 +++--- 12 files changed, 2009 insertions(+), 1810 deletions(-) diff --git a/features-legacy/step_definitions/collections.js b/features-legacy/step_definitions/collections.js index ffaa817856..2f8e77a0e7 100644 --- a/features-legacy/step_definitions/collections.js +++ b/features-legacy/step_definitions/collections.js @@ -1,173 +1,226 @@ -'use strict'; - -const - { - When, - Then - } = require('cucumber'), - should = require('should'), - stepUtils = require('../support/stepUtils'); - -When(/^I list "([^"]*)" data collections(?: in index "([^"]*)")?$/, function (type, index, callback) { - this.api.listCollections(index, type) - .then(response => { - if (response.error) { - callback(new Error(response.error.message)); - return false; - } - - if (! response.result) { - return callback(new Error('No result provided')); - } - - this.result = response.result; - callback(); - }) - .catch(error => callback(error)); -}); +"use strict"; + +const { When, Then } = require("cucumber"), + should = require("should"), + stepUtils = require("../support/stepUtils"); + +When( + /^I list "([^"]*)" data collections(?: in index "([^"]*)")?$/, + function (type, index, callback) { + this.api + .listCollections(index, type) + .then((response) => { + if (response.error) { + callback(new Error(response.error.message)); + return false; + } + + if (!response.result) { + return callback(new Error("No result provided")); + } + + this.result = response.result; + callback(); + }) + .catch((error) => callback(error)); + } +); -When('I try to create the collection {string}', async function (collection) { +When("I try to create the collection {string}", async function (collection) { try { const response = await this.api.createCollection(null, collection); this.result = response; - } - catch (error) { + } catch (error) { this.result = { error }; } }); -When('I create a collection named {string} in index {string}', async function (collection, index) { - await this.api.createCollection(index, collection); -}); - -Then(/^I can ?(not)* find a ?(.*?) collection ?(.*)$/, function (not, type, collection, callback) { - if (! this.result.collections) { - return callback('Expected a collections list result, got: ' + this.result); +When( + "I create a collection named {string} in index {string}", + async function (collection, index) { + await this.api.createCollection(index, collection); } - - if (! collection) { - if (this.result.collections.length === 0) { - if (not) { - return callback(); - } - - return callback('Collection list is empty, expected collections to be listed'); +); + +Then( + /^I can ?(not)* find a ?(.*?) collection ?(.*)$/, + function (not, type, collection, callback) { + if (!this.result.collections) { + return callback( + "Expected a collections list result, got: " + this.result + ); } - } - if (this.result.collections.filter(item => item.type === type && item.name === collection).length !== 0) { - if (not) { - return callback('Expected collection ' + collection + ' not to appear in the collection list'); - } - - return callback(); - } + if (!collection) { + if (this.result.collections.length === 0) { + if (not) { + return callback(); + } - callback('Expected to find the collection <' + collection + '> in this collections list: ' + JSON.stringify(this.result.collections)); -}); - -Then(/^I change the mapping(?: in index "([^"]*)")?$/, function (index, callback) { - this.api.updateMapping() - .then(body => { - if (body.error !== null) { - callback(new Error(body.error.message)); - return false; + return callback( + "Collection list is empty, expected collections to be listed" + ); } + } - callback(); - }) - .catch(function (error) { - callback(new Error(error)); - }); -}); - -Then(/^I truncate the collection(?: "(.*?)")?(?: in index "([^"]*)")?$/, function (collection, index, callback) { - this.api.truncateCollection(index, collection) - .then(body => { - if (body.error !== null) { - return callback(body.error); + if ( + this.result.collections.filter( + (item) => item.type === type && item.name === collection + ).length !== 0 + ) { + if (not) { + return callback( + "Expected collection " + + collection + + " not to appear in the collection list" + ); } - callback(); - }) - .catch(error => callback(error)); -}); + return callback(); + } + + callback( + "Expected to find the collection <" + + collection + + "> in this collections list: " + + JSON.stringify(this.result.collections) + ); + } +); + +Then( + /^I change the mapping(?: in index "([^"]*)")?$/, + function (index, callback) { + this.api + .updateMapping() + .then((body) => { + if (body.error !== null) { + callback(new Error(body.error.message)); + return false; + } + + callback(); + }) + .catch(function (error) { + callback(new Error(error)); + }); + } +); + +Then( + /^I truncate the collection(?: "(.*?)")?(?: in index "([^"]*)")?$/, + function (collection, index, callback) { + this.api + .truncateCollection(index, collection) + .then((body) => { + if (body.error !== null) { + return callback(body.error); + } + + callback(); + }) + .catch((error) => callback(error)); + } +); Then(/I refresh the collection( "(.*?)")?/, function (indexCollection) { indexCollection = indexCollection ? indexCollection - : this.fakeIndex + ':' + this.fakeCollection; + : this.fakeIndex + ":" + this.fakeCollection; - const [index, collection] = indexCollection.split(':'); + const [index, collection] = indexCollection.split(":"); return this.api.refreshCollection(index, collection); }); When(/^I check if index "(.*?)" exists$/, function (index, cb) { - return stepUtils.getReturn.call(this, 'indexExists', index, cb); + return stepUtils.getReturn.call(this, "indexExists", index, cb); }); -When(/I check if collection "(.*?)" exists on index "(.*?)"$/, function (collection, index, cb) { - return stepUtils.getReturn.call(this, 'collectionExists', index, collection, cb); -}); +When( + /I check if collection "(.*?)" exists on index "(.*?)"$/, + function (collection, index, cb) { + return stepUtils.getReturn.call( + this, + "collectionExists", + index, + collection, + cb + ); + } +); -When(/I create a collection "([\w-]+)":"([\w-]+)"( with "([\d]+)" documents)?/, function (index, collection, countRaw) { - return this.api.createCollection(index, collection) - .then(() => { - const - promises = [], +When( + /I create a collection "([\w-]+)":"([\w-]+)"( with "([\d]+)" documents)?/, + function (index, collection, countRaw) { + return this.api.createCollection(index, collection).then(() => { + const promises = [], count = parseInt(countRaw); for (let i = 0; i < count; ++i) { - promises.push(this.api.create({ number: `doc-${i}` }, index, collection)); + promises.push( + this.api.create({ number: `doc-${i}` }, index, collection) + ); } return Promise.all(promises); }); -}); - -Then('The mapping dynamic field of {string}:{string} is {string}', function (index, collection, dynamicValue) { - return this.api.getCollectionMapping(index, collection) - .then(({ result }) => { - const expectedValue = dynamicValue === 'the default value' - ? 'true' // we set the default value to true in the environment for tests - : dynamicValue; - - should(result.dynamic) - .not.be.undefined() - .be.eql(expectedValue); - }); -}); - -When('I update the mapping of {string}:{string} with {string}', function (index, collection, rawMapping) { - const mapping = JSON.parse(rawMapping); - - return this.api.updateMapping(index, collection, mapping); -}); - -Then('The mapping properties field of {string}:{string} is {string}', function (index, collection, rawMapping) { - const includeKuzzleMeta = rawMapping === 'the default value'; - - return this.api.getCollectionMapping(index, collection, includeKuzzleMeta) - .then(({ result }) => { - const expectedValue = rawMapping === 'the default value' - ? this.kuzzleConfig.services.storageEngine.commonMapping.properties - : JSON.parse(rawMapping); - - should(result.properties) - .be.eql(expectedValue); - }); -}); - -Then('The mapping _meta field of {string}:{string} is {string}', function (index, collection, rawMapping) { - const mapping = JSON.parse(rawMapping); + } +); + +Then( + "The mapping dynamic field of {string}:{string} is {string}", + function (index, collection, dynamicValue) { + return this.api + .getCollectionMapping(index, collection) + .then(({ result }) => { + const expectedValue = + dynamicValue === "the default value" + ? "true" // we set the default value to true in the environment for tests + : dynamicValue; + + should(result.dynamic).not.be.undefined().be.eql(expectedValue); + }); + } +); - return this.api.getCollectionMapping(index, collection) - .then(({ result }) => { +When( + "I update the mapping of {string}:{string} with {string}", + function (index, collection, rawMapping) { + const mapping = JSON.parse(rawMapping); - should(result._meta) - .not.be.undefined() - .be.eql(mapping._meta); - }); -}); + return this.api.updateMapping(index, collection, mapping); + } +); + +Then( + "The mapping properties field of {string}:{string} is {string}", + function (index, collection, rawMapping) { + const includeKuzzleMeta = rawMapping === "the default value"; + + return this.api + .getCollectionMapping(index, collection, includeKuzzleMeta) + .then(({ result }) => { + const expectedValue = + rawMapping === "the default value" + ? this.kuzzleConfig.services.storageEngine.commonMapping.properties + : JSON.parse(rawMapping); + + should(result.properties).be.eql(expectedValue); + }); + } +); + +Then( + "The mapping _meta field of {string}:{string} is {string}", + function (index, collection, rawMapping) { + const mapping = JSON.parse(rawMapping); + + return this.api + .getCollectionMapping(index, collection) + .then(({ result }) => { + should(result._meta).not.be.undefined().be.eql(mapping._meta); + }); + } +); diff --git a/features-legacy/step_definitions/profiles.js b/features-legacy/step_definitions/profiles.js index 9acc88e316..321afcd9cd 100644 --- a/features-legacy/step_definitions/profiles.js +++ b/features-legacy/step_definitions/profiles.js @@ -352,15 +352,17 @@ Given(/^A scrolled search on profiles$/, function () { this.scrollId = null; return this.api.searchProfiles([], { scroll: "2s" }).then((response) => { + console.log("response", response); + if (response.error) { throw new Error(response.error.message); } - if (!response.result.scroll_id) { + if (!response.result.scrollId) { throw new Error("No scrollId returned by the searchProfile query"); } - this.scrollId = response.result.scroll_id; + this.scrollId = response.result.scrollId; }); }); diff --git a/features-legacy/support/api/apiBase.js b/features-legacy/support/api/apiBase.js index 0d09032012..50051941af 100644 --- a/features-legacy/support/api/apiBase.js +++ b/features-legacy/support/api/apiBase.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; /** * This file contains the main API method for real-time protocols. @@ -7,12 +7,11 @@ * NOTE: must be added in api HTTP because the apiHttp file doesn't extend this ApiRT */ -const - _ = require('lodash'), - Bluebird = require('bluebird'); +const _ = require("lodash"), + Bluebird = require("bluebird"); class ApiBase { - constructor (world) { + constructor(world) { this.world = world; this.clientId = null; @@ -22,93 +21,89 @@ class ApiBase { this.isRealTimeCapable = true; } - send () { - throw new Error('not implemented'); + send() { + throw new Error("not implemented"); } - sendAndListen () { - throw new Error('not implemented'); + sendAndListen() { + throw new Error("not implemented"); } - adminResetDatabase () { + adminResetDatabase() { const msg = { - controller: 'admin', - action: 'resetDatabase' + controller: "admin", + action: "resetDatabase", }; return this.send(msg); } - serverPublicApi () { + serverPublicApi() { const msg = { - controller: 'server', - action: 'publicApi' + controller: "server", + action: "publicApi", }; return this.send(msg); } - bulkImport (bulk, index, collection) { - const - msg = { - controller: 'bulk', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'import', - body: { bulkData: bulk } - }; + bulkImport(bulk, index, collection) { + const msg = { + controller: "bulk", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "import", + body: { bulkData: bulk }, + }; return this.send(msg); } - bulkMWrite (index, collection, body) { - const - msg = { - controller: 'bulk', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mWrite', - body - }; + bulkMWrite(index, collection, body) { + const msg = { + controller: "bulk", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mWrite", + body, + }; return this.send(msg); } - bulkWrite (index, collection, body, _id = null) { - const - msg = { - controller: 'bulk', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'write', - _id, - body - }; + bulkWrite(index, collection, body, _id = null) { + const msg = { + controller: "bulk", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "write", + _id, + body, + }; return this.send(msg); } - collectionExists (index, collection) { + collectionExists(index, collection) { return this.send({ index, collection, - controller: 'collection', - action: 'exists' + controller: "collection", + action: "exists", }); } - callMemoryStorage (command, args) { + callMemoryStorage(command, args) { const msg = { - controller: 'ms', - action: command + controller: "ms", + action: command, }; _.forEach(args, (value, prop) => { - if (prop === 'args') { + if (prop === "args") { _.forEach(value, (item, k) => { msg[k] = item; }); - } - else { + } else { msg[prop] = value; } }); @@ -116,7 +111,7 @@ class ApiBase { return this.send(msg); } - checkToken (token) { + checkToken(token) { let _token = null; if (this.world.currentUser && this.world.currentUser.token) { @@ -124,15 +119,19 @@ class ApiBase { this.world.currentUser.token = null; } - return this.send({ controller: 'auth', action: 'checkToken', body: { token } }) - .then(response => { + return this.send({ + controller: "auth", + action: "checkToken", + body: { token }, + }) + .then((response) => { if (_token !== null) { this.world.currentUser.token = _token; } return response; }) - .catch(error => { + .catch((error) => { if (_token !== null) { this.world.currentUser.token = _token; } @@ -141,46 +140,43 @@ class ApiBase { }); } - count (query, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'count', - body: query - }; + count(query, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "count", + body: query, + }; return this.send(msg); } - countSubscription () { - const - clients = Object.keys(this.subscribedRooms), + countSubscription() { + const clients = Object.keys(this.subscribedRooms), rooms = Object.keys(this.subscribedRooms[clients[0]]), msg = { - controller: 'realtime', + controller: "realtime", collection: this.world.fakeCollection, index: this.world.fakeIndex, - action: 'count', + action: "count", body: { - roomId: rooms[0] - } + roomId: rooms[0], + }, }; return this.send(msg); } - create (body, index, collection, jwtToken, id) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'create', - body, - refresh: 'wait_for' - }; + create(body, index, collection, jwtToken, id) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "create", + body, + refresh: "wait_for", + }; if (id) { msg._id = id; @@ -188,78 +184,74 @@ class ApiBase { if (jwtToken !== undefined) { msg.headers = { - authorization: 'Bearer ' + jwtToken + authorization: "Bearer " + jwtToken, }; } return this.send(msg); } - createIndex (index) { - const - msg = { - controller: 'index', - action: 'create', - index: index - }; + createIndex(index) { + const msg = { + controller: "index", + action: "create", + index: index, + }; return this.send(msg); } - createCollection (index, collection, mappings) { - const - msg = { - controller: 'collection', - action: 'create', - index: index || this.world.fakeIndex, - collection, - body: mappings - }; + createCollection(index, collection, mappings) { + const msg = { + controller: "collection", + action: "create", + index: index || this.world.fakeIndex, + collection, + body: mappings, + }; return this.send(msg); } - getCollectionMapping (index, collection, includeKuzzleMeta = false) { - const - msg = { - includeKuzzleMeta, - controller: 'collection', - action: 'getMapping', - index, - collection - }; + getCollectionMapping(index, collection, includeKuzzleMeta = false) { + const msg = { + includeKuzzleMeta, + controller: "collection", + action: "getMapping", + index, + collection, + }; return this.send(msg); } - createCredentials (strategy, userId, body) { + createCredentials(strategy, userId, body) { return this.send({ - controller: 'security', - action: 'createCredentials', + controller: "security", + action: "createCredentials", strategy, body, - _id: userId + _id: userId, }); } - createMyCredentials (strategy, body) { + createMyCredentials(strategy, body) { return this.send({ - controller: 'auth', - action: 'createMyCredentials', + controller: "auth", + action: "createMyCredentials", strategy, - body + body, }); } - createOrReplace (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'createOrReplace', - body: body - }; + createOrReplace(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "createOrReplace", + body: body, + }; if (body._id) { msg._id = body._id; @@ -269,35 +261,33 @@ class ApiBase { return this.send(msg); } - createOrReplaceProfile (id, body) { - const - msg = { - controller: 'security', - action: 'createOrReplaceProfile', - _id: id, - body: body - }; + createOrReplaceProfile(id, body) { + const msg = { + controller: "security", + action: "createOrReplaceProfile", + _id: id, + body: body, + }; return this.send(msg); } - createOrReplaceRole (id, body) { - const - msg = { - controller: 'security', - action: 'createOrReplaceRole', - _id: id, - body: body - }; + createOrReplaceRole(id, body) { + const msg = { + controller: "security", + action: "createOrReplaceRole", + _id: id, + body: body, + }; return this.send(msg); } - createRestrictedUser (body, id) { + createRestrictedUser(body, id) { const msg = { - controller: 'security', - action: 'createRestrictedUser', - body: body + controller: "security", + action: "createRestrictedUser", + body: body, }; if (id !== undefined) { msg._id = id; @@ -306,12 +296,12 @@ class ApiBase { return this.send(msg); } - createUser (body, id) { + createUser(body, id) { const msg = { - controller: 'security', - action: 'createUser', - refresh: 'wait_for', - body + controller: "security", + action: "createUser", + refresh: "wait_for", + body, }; if (id !== undefined) { @@ -321,11 +311,11 @@ class ApiBase { return this.send(msg); } - createFirstAdmin (body, id, reset) { + createFirstAdmin(body, id, reset) { const msg = { - controller: 'security', - action: 'createFirstAdmin', - body: body + controller: "security", + action: "createFirstAdmin", + body: body, }; if (id !== undefined) { @@ -339,457 +329,436 @@ class ApiBase { return this.send(msg); } - credentialsExist (strategy, body) { + credentialsExist(strategy, body) { return this.send({ - controller: 'auth', - action: 'credentialsExist', + controller: "auth", + action: "credentialsExist", strategy, - body + body, }); } - deleteById (id, index) { - const - msg = { - controller: 'document', - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'delete', - _id: id - }; + deleteById(id, index) { + const msg = { + controller: "document", + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "delete", + _id: id, + }; return this.send(msg); } - deleteByQuery (query, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'deleteByQuery', - body: query - }; + deleteByQuery(query, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "deleteByQuery", + body: query, + }; return this.send(msg); } - deleteCredentials (strategy, userId) { + deleteCredentials(strategy, userId) { return this.send({ - controller: 'security', - action: 'deleteCredentials', + controller: "security", + action: "deleteCredentials", strategy, - _id: userId + _id: userId, }); } - deleteIndex (index) { - const - msg = { - controller: 'index', - action: 'delete', - index: index - }; + deleteIndex(index) { + const msg = { + controller: "index", + action: "delete", + index: index, + }; return this.send(msg); } - deleteIndexes () { - const - msg = { - controller: 'index', - action: 'mdelete' - }; + deleteIndexes() { + const msg = { + controller: "index", + action: "mdelete", + }; return this.send(msg); } - deleteMyCredentials (strategy) { + deleteMyCredentials(strategy) { return this.send({ - controller: 'auth', - action: 'deleteMyCredentials', - strategy + controller: "auth", + action: "deleteMyCredentials", + strategy, }); } - deleteProfile (id, waitFor = false) { + deleteProfile(id, waitFor = false) { const msg = { - controller: 'security', - action: 'deleteProfile', - _id: id + controller: "security", + action: "deleteProfile", + _id: id, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - deleteProfiles (ids, waitFor = false) { + deleteProfiles(ids, waitFor = false) { const msg = { - controller: 'security', - action: 'mDeleteProfiles', + controller: "security", + action: "mDeleteProfiles", body: { - ids - } + ids, + }, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - deleteRole (id, waitFor = false) { + deleteRole(id, waitFor = false) { const msg = { - controller: 'security', - action: 'deleteRole', - _id: id + controller: "security", + action: "deleteRole", + _id: id, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - deleteRoles (ids, waitFor = false) { + deleteRoles(ids, waitFor = false) { const msg = { - controller: 'security', - action: 'mDeleteRoles', + controller: "security", + action: "mDeleteRoles", body: { - ids - } + ids, + }, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - deleteSpecifications (index, collection) { + deleteSpecifications(index, collection) { return this.send({ index: index, collection: collection, - controller: 'collection', - action: 'deleteSpecifications', - body: null + controller: "collection", + action: "deleteSpecifications", + body: null, }); } - deleteUser (id, waitFor = false) { + deleteUser(id, waitFor = false) { const msg = { - controller: 'security', - action: 'deleteUser', - _id: id + controller: "security", + action: "deleteUser", + _id: id, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - deleteUsers (ids, waitFor = false) { + deleteUsers(ids, waitFor = false) { const msg = { - controller: 'security', - action: 'mDeleteUsers', + controller: "security", + action: "mDeleteUsers", body: { - ids - } + ids, + }, }; if (waitFor) { - msg.refresh = 'wait_for'; + msg.refresh = "wait_for"; } return this.send(msg); } - exists (id, index) { - const - msg = { - controller: 'document', - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'exists', - _id: id - }; + exists(id, index) { + const msg = { + controller: "document", + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "exists", + _id: id, + }; return this.send(msg); } - get (id, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'get', - _id: id - }; + get(id, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "get", + _id: id, + }; return this.send(msg); } - getAllStats () { - const - msg = { - controller: 'server', - action: 'getAllStats' - }; + getAllStats() { + const msg = { + controller: "server", + action: "getAllStats", + }; return this.send(msg); } - getAuthenticationStrategies () { + getAuthenticationStrategies() { return this.send({ - controller: 'auth', - action: 'getStrategies', - body: {} + controller: "auth", + action: "getStrategies", + body: {}, }); } - getCredentials (strategy, userId) { + getCredentials(strategy, userId) { return this.send({ - controller: 'security', - action: 'getCredentials', + controller: "security", + action: "getCredentials", strategy, - _id: userId + _id: userId, }); } - getCredentialsById (strategy, userId) { + getCredentialsById(strategy, userId) { return this.send({ - controller: 'security', - action: 'getCredentialsById', + controller: "security", + action: "getCredentialsById", strategy, - _id: userId + _id: userId, }); } - getCurrentUser () { + getCurrentUser() { return this.send({ - controller: 'auth', - action: 'getCurrentUser' + controller: "auth", + action: "getCurrentUser", }); } - getLastStats () { - const - msg = { - controller: 'server', - action: 'getLastStats' - }; + getLastStats() { + const msg = { + controller: "server", + action: "getLastStats", + }; return this.send(msg); } - getMyCredentials (strategy) { + getMyCredentials(strategy) { return this.send({ - controller: 'auth', - action: 'getMyCredentials', - strategy + controller: "auth", + action: "getMyCredentials", + strategy, }); } - getMyRights (id) { + getMyRights(id) { return this.send({ - controller: 'auth', - action: 'getMyRights', - _id: id + controller: "auth", + action: "getMyRights", + _id: id, }); } - getProfile (id) { - const - msg = { - controller: 'security', - action: 'getProfile', - _id: id - }; + getProfile(id) { + const msg = { + controller: "security", + action: "getProfile", + _id: id, + }; return this.send(msg); } - getProfileMapping () { - const - msg = { - controller: 'security', - action: 'getProfileMapping' - }; + getProfileMapping() { + const msg = { + controller: "security", + action: "getProfileMapping", + }; return this.send(msg); } - getProfileRights (id) { - const - msg = { - controller: 'security', - action: 'getProfileRights', - _id: id - }; + getProfileRights(id) { + const msg = { + controller: "security", + action: "getProfileRights", + _id: id, + }; return this.send(msg); } - getRole (id) { - const - msg = { - controller: 'security', - action: 'getRole', - _id: id - }; + getRole(id) { + const msg = { + controller: "security", + action: "getRole", + _id: id, + }; return this.send(msg); } - getRoleMapping () { - const - msg = { - controller: 'security', - action: 'getRoleMapping' - }; + getRoleMapping() { + const msg = { + controller: "security", + action: "getRoleMapping", + }; return this.send(msg); } - getSpecifications (index, collection) { + getSpecifications(index, collection) { return this.send({ index: index, collection: collection, - controller: 'collection', - action: 'getSpecifications' + controller: "collection", + action: "getSpecifications", }); } - getStats (dates) { - const - msg = { - controller: 'server', - action: 'getStats', - body: dates - }; + getStats(dates) { + const msg = { + controller: "server", + action: "getStats", + body: dates, + }; return this.send(msg); } - getUser (id) { + getUser(id) { return this.send({ - controller: 'security', - action: 'getUser', - _id: id + controller: "security", + action: "getUser", + _id: id, }); } - getUserMapping () { - const - msg = { - controller: 'security', - action: 'getUserMapping' - }; + getUserMapping() { + const msg = { + controller: "security", + action: "getUserMapping", + }; return this.send(msg); } - getUserRights (id) { + getUserRights(id) { return this.send({ - controller: 'security', - action: 'getUserRights', - _id: id + controller: "security", + action: "getUserRights", + _id: id, }); } - hasCredentials (strategy, userId) { + hasCredentials(strategy, userId) { return this.send({ - controller: 'security', - action: 'hasCredentials', + controller: "security", + action: "hasCredentials", strategy, - _id: userId + _id: userId, }); } - indexExists (index) { + indexExists(index) { return this.send({ index, - controller: 'index', - action: 'exists' + controller: "index", + action: "exists", }); } - refreshCollection (index, collection) { - const - msg = { - controller: 'collection', - action: 'refresh', - index: index || this.world.fakeIndex, - collection: collection || this.world.fakeCollection - }; + refreshCollection(index, collection) { + const msg = { + controller: "collection", + action: "refresh", + index: index || this.world.fakeIndex, + collection: collection || this.world.fakeCollection, + }; return this.send(msg); } - listCollections (index, type) { - const - msg = { - controller: 'collection', - index: index || this.world.fakeIndex, - action: 'list', - body: { type } - }; + listCollections(index, type) { + const msg = { + controller: "collection", + index: index || this.world.fakeIndex, + action: "list", + body: { type }, + }; return this.send(msg); } - listIndexes () { - const - msg = { - controller: 'index', - action: 'list' - }; + listIndexes() { + const msg = { + controller: "index", + action: "list", + }; return this.send(msg); } - listSubscriptions () { - const - msg = { - controller: 'realtime', - action: 'list' - }; + listSubscriptions() { + const msg = { + controller: "realtime", + action: "list", + }; return this.send(msg); } - login (strategy, credentials) { - const - msg = { - controller: 'auth', - action: 'login', - strategy: strategy, - expiresIn: credentials.expiresIn, - body: { - username: credentials.username, - password: credentials.password - } - }; + login(strategy, credentials) { + const msg = { + controller: "auth", + action: "login", + strategy: strategy, + expiresIn: credentials.expiresIn, + body: { + username: credentials.username, + password: credentials.password, + }, + }; return this.send(msg); } - logout (jwtToken, global = false) { - const - msg = { - controller: 'auth', - action: 'logout', - jwt: jwtToken - }; + logout(jwtToken, global = false) { + const msg = { + controller: "auth", + action: "logout", + jwt: jwtToken, + }; if (global) { msg.global = true; @@ -797,161 +766,150 @@ class ApiBase { return this.send(msg); } - mCreate (body, index, collection, jwtToken) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mCreate', - body - }; + mCreate(body, index, collection, jwtToken) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mCreate", + body, + }; if (jwtToken !== undefined) { msg.headers = { - authorization: 'Bearer ' + jwtToken + authorization: "Bearer " + jwtToken, }; } return this.send(msg); } - mCreateOrReplace (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mCreateOrReplace', - body: body - }; + mCreateOrReplace(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mCreateOrReplace", + body: body, + }; return this.send(msg); } - mDelete (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mDelete', - body - }; + mDelete(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mDelete", + body, + }; return this.send(msg); } - mGet (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mGet', - body - }; + mGet(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mGet", + body, + }; return this.send(msg); } - mGetProfiles (body) { - const - msg = { - controller: 'security', - action: 'mGetProfiles', - body: body - }; + mGetProfiles(body) { + const msg = { + controller: "security", + action: "mGetProfiles", + body: body, + }; return this.send(msg); } - mGetRoles (body) { - const - msg = { - controller: 'security', - action: 'mGetRoles', - body: body - }; + mGetRoles(body) { + const msg = { + controller: "security", + action: "mGetRoles", + body: body, + }; return this.send(msg); } - mReplace (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mReplace', - body: body - }; + mReplace(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mReplace", + body: body, + }; return this.send(msg); } - mUpdate (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'mUpdate', - body: body - }; + mUpdate(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "mUpdate", + body: body, + }; return this.send(msg); } - now () { - const - msg = { - controller: 'server', - action: 'now' - }; + now() { + const msg = { + controller: "server", + action: "now", + }; return this.send(msg); } - postDocument (index, collection, document) { + postDocument(index, collection, document) { return this.send({ index, collection, - controller: 'document', - action: 'create', - body: document + controller: "document", + action: "create", + body: document, }); } - publish (body, index) { - const - msg = { - controller: 'realtime', - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'publish', - body: body - }; + publish(body, index) { + const msg = { + controller: "realtime", + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "publish", + body: body, + }; return this.send(msg); } - refreshToken () { + refreshToken() { return this.send({ - controller: 'auth', - action: 'refreshToken' + controller: "auth", + action: "refreshToken", }); } - replace (body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'replace', - body: body - }; + replace(body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "replace", + body: body, + }; if (body._id) { msg._id = body._id; @@ -961,68 +919,66 @@ class ApiBase { return this.send(msg); } - replaceUser (id, body) { + replaceUser(id, body) { return this.send({ - controller: 'security', - action: 'replaceUser', + controller: "security", + action: "replaceUser", _id: id, - body + body, }); } - revokeTokens (id) { + revokeTokens(id) { return this.send({ - controller: 'security', - action: 'revokeTokens', - _id: id + controller: "security", + action: "revokeTokens", + _id: id, }); } - scroll (scrollId, scroll) { - const - msg = { - controller: 'document', - action: 'scroll', - scrollId, - scroll - }; + scroll(scrollId, scroll) { + const msg = { + controller: "document", + action: "scroll", + scrollId, + scroll, + }; return this.send(msg); } - scrollProfiles (scrollId) { + scrollProfiles(scrollId) { return this.send({ - controller: 'security', - action: 'scrollProfiles', - scrollId + controller: "security", + action: "scrollProfiles", + scrollId, }); } - scrollSpecifications (scrollId) { + scrollSpecifications(scrollId) { return this.send({ - controller: 'collection', - action: 'scrollSpecifications', - scrollId + controller: "collection", + action: "scrollSpecifications", + scrollId, }); } - scrollUsers (scrollId) { + scrollUsers(scrollId) { return this.send({ - controller: 'security', - action: 'scrollUsers', - scrollId + controller: "security", + action: "scrollUsers", + scrollId, }); } - search (query, index, collection, args) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'search', - body: query - }; + search(query, index, collection, args) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "search", + body: query, + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -1031,15 +987,14 @@ class ApiBase { return this.send(msg); } - searchProfiles (roles, args) { - const - msg = { - controller: 'security', - action: 'searchProfiles', - body: { - roles - } - }; + searchProfiles(roles, args) { + const msg = { + controller: "security", + action: "searchProfiles", + body: { + roles, + }, + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -1048,13 +1003,12 @@ class ApiBase { return this.send(msg); } - searchRoles (body, args) { - const - msg = { - controller: 'security', - action: 'searchRoles', - body - }; + searchRoles(body, args) { + const msg = { + controller: "security", + action: "searchRoles", + body, + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -1063,11 +1017,11 @@ class ApiBase { return this.send(msg); } - searchSpecifications (body, args) { + searchSpecifications(body, args) { let msg = { - controller: 'collection', - action: 'searchSpecifications', - body: body + controller: "collection", + action: "searchSpecifications", + body: body, }; if (args) { @@ -1077,13 +1031,13 @@ class ApiBase { return this.send(msg); } - searchUsers (query, args) { + searchUsers(query, args) { const msg = { - controller: 'security', - action: 'searchUsers', + controller: "security", + action: "searchUsers", body: { - query - } + query, + }, }; if (args) { @@ -1093,16 +1047,15 @@ class ApiBase { return this.send(msg); } - subscribe (filters, client, authentified = false) { - const - msg = { - controller: 'realtime', - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - action: 'subscribe', - users: 'all', - body: null - }; + subscribe(filters, client, authentified = false) { + const msg = { + controller: "realtime", + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + action: "subscribe", + users: "all", + body: null, + }; if (authentified) { msg.jwt = this.world.currentUser.token; @@ -1115,28 +1068,26 @@ class ApiBase { return this.sendAndListen(msg, client); } - truncateCollection (index, collection) { - const - msg = { - controller: 'collection', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'truncate' - }; + truncateCollection(index, collection) { + const msg = { + controller: "collection", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "truncate", + }; return this.send(msg); } - unsubscribe (room, clientId) { - const - msg = { - clientId: clientId, - controller: 'realtime', - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - action: 'unsubscribe', - body: { roomId: room } - }; + unsubscribe(room, clientId) { + const msg = { + clientId: clientId, + controller: "realtime", + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + action: "unsubscribe", + body: { roomId: room }, + }; this.subscribedRooms[clientId][room].close(); delete this.subscribedRooms[clientId]; @@ -1144,193 +1095,187 @@ class ApiBase { return this.send(msg, false); } - update (id, body, index, collection) { - const - msg = { - controller: 'document', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'update', - _id: id, - body: body - }; + update(id, body, index, collection) { + const msg = { + controller: "document", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "update", + _id: id, + body: body, + }; return this.send(msg); } - updateCredentials (strategy, userId, body) { + updateCredentials(strategy, userId, body) { return this.send({ - controller: 'security', - action: 'updateCredentials', + controller: "security", + action: "updateCredentials", strategy, body, - _id: userId + _id: userId, }); } - updateMapping (index, collection, mapping) { - const - msg = { - controller: 'collection', - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: 'updateMapping', - body: mapping || this.world.mapping - }; + updateMapping(index, collection, mapping) { + const msg = { + controller: "collection", + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: "updateMapping", + body: mapping || this.world.mapping, + }; return this.send(msg); } - updateMyCredentials (strategy, body) { + updateMyCredentials(strategy, body) { return this.send({ - controller: 'auth', - action: 'updateMyCredentials', + controller: "auth", + action: "updateMyCredentials", strategy, - body + body, }); } - updateProfileMapping () { - const - msg = { - controller: 'security', - action: 'updateProfileMapping', - body: this.world.securitymapping - }; + updateProfileMapping() { + const msg = { + controller: "security", + action: "updateProfileMapping", + body: this.world.securitymapping, + }; return this.send(msg); } - updateRoleMapping () { - const - msg = { - controller: 'security', - action: 'updateRoleMapping', - body: this.world.securitymapping - }; + updateRoleMapping() { + const msg = { + controller: "security", + action: "updateRoleMapping", + body: this.world.securitymapping, + }; return this.send(msg); } - updateSelf (body) { + updateSelf(body) { return this.send({ - controller: 'auth', - action: 'updateSelf', - body: body + controller: "auth", + action: "updateSelf", + body: body, }); } - updateSpecifications (index, collection, specifications) { + updateSpecifications(index, collection, specifications) { return this.send({ index, collection, - controller: 'collection', - action: 'updateSpecifications', - body: specifications + controller: "collection", + action: "updateSpecifications", + body: specifications, }); } - updateUserMapping () { - const - msg = { - controller: 'security', - action: 'updateUserMapping', - body: this.world.securitymapping - }; + updateUserMapping() { + const msg = { + controller: "security", + action: "updateUserMapping", + body: this.world.securitymapping, + }; return this.send(msg); } - validateCredentials (strategy, userId, body) { + validateCredentials(strategy, userId, body) { return this.send({ - controller: 'security', - action: 'validateCredentials', + controller: "security", + action: "validateCredentials", strategy, body, - _id: userId + _id: userId, }); } - validateDocument (index, collection, document) { + validateDocument(index, collection, document) { return this.create(document, index, collection); } - validateMyCredentials (strategy, body) { + validateMyCredentials(strategy, body) { return this.send({ - controller: 'auth', - action: 'validateMyCredentials', + controller: "auth", + action: "validateMyCredentials", strategy, - body + body, }); } - validateSpecifications (index, collection, specifications) { + validateSpecifications(index, collection, specifications) { return this.send({ index, collection, - controller: 'collection', - action: 'validateSpecifications', - body: specifications + controller: "collection", + action: "validateSpecifications", + body: specifications, }); } - resetCache (database) { + resetCache(database) { return this.send({ - controller: 'admin', - action: 'resetCache', - database + controller: "admin", + action: "resetCache", + database, }); } - resetKuzzleData () { + resetKuzzleData() { return this.send({ - controller: 'admin', - action: 'resetKuzzleData' + controller: "admin", + action: "resetKuzzleData", }); } - resetSecurity () { + resetSecurity() { return this.send({ - controller: 'admin', - action: 'resetSecurity', - refresh: 'wait_for' + controller: "admin", + action: "resetSecurity", + refresh: "wait_for", }); } - resetDatabase () { + resetDatabase() { return this.send({ - controller: 'admin', - action: 'resetDatabase' + controller: "admin", + action: "resetDatabase", }); } - loadMappings (body) { + loadMappings(body) { return this.send({ body, - controller: 'admin', - action: 'loadMappings', - refresh: 'wait_for' + controller: "admin", + action: "loadMappings", + refresh: "wait_for", }); } - loadFixtures (body) { + loadFixtures(body) { return this.send({ body, - controller: 'admin', - action: 'loadFixtures', - refresh: 'wait_for' + controller: "admin", + action: "loadFixtures", + refresh: "wait_for", }); } - loadSecurities (body) { + loadSecurities(body) { return this.send({ body, - controller: 'admin', - action: 'loadSecurities', - refresh: 'wait_for' + controller: "admin", + action: "loadSecurities", + refresh: "wait_for", }); } } - module.exports = ApiBase; diff --git a/features-legacy/support/api/http.js b/features-legacy/support/api/http.js index 79bbf31b6b..a20eb11f86 100644 --- a/features-legacy/support/api/http.js +++ b/features-legacy/support/api/http.js @@ -1,61 +1,60 @@ -'use strict'; +"use strict"; -const zlib = require('zlib'); +const zlib = require("zlib"); -const _ = require('lodash'); -const rp = require('request-promise'); +const _ = require("lodash"); +const rp = require("request-promise"); -const routes = require('../../../lib/api/httpRoutes'); +const routes = require("../../../lib/api/httpRoutes"); -function checkAlgorithm (algorithm) { - const - supported = ['identity', 'gzip', 'deflate'], - list = algorithm.split(',').map(a => a.trim().toLowerCase()); +function checkAlgorithm(algorithm) { + const supported = ["identity", "gzip", "deflate"], + list = algorithm.split(",").map((a) => a.trim().toLowerCase()); for (const l of list) { - if (! supported.some(a => a === l)) { + if (!supported.some((a) => a === l)) { throw new Error(`Unsupported compression algorithm: ${l}`); } } } class HttpApi { - constructor (world) { + constructor(world) { this.world = world; this.baseUri = `http://${world.config.host}:${world.config.port}`; this.util = { - getIndex: index => typeof index !== 'string' ? this.world.fakeIndex : index, - getCollection: collection => typeof collection !== 'string' ? this.world.fakeCollection : collection + getIndex: (index) => + typeof index !== "string" ? this.world.fakeIndex : index, + getCollection: (collection) => + typeof collection !== "string" ? this.world.fakeCollection : collection, }; this.isRealtimeCapable = false; - this.encoding = 'identity'; - this.expectedEncoding = 'identity'; + this.encoding = "identity"; + this.expectedEncoding = "identity"; } - _getRequest (index, collection, controller, action, args) { - let - url = '', + _getRequest(index, collection, controller, action, args) { + let url = "", queryString = [], - verb = 'GET', + verb = "GET", result; - if (! args) { + if (!args) { args = {}; } - if (! args.body) { + if (!args.body) { if (args.args) { args.body = args.args; - } - else { + } else { args.body = {}; } } - routes.some(route => { + routes.some((route) => { const hits = []; // Try / Catch mechanism avoids to match routes that have not all @@ -64,67 +63,65 @@ class HttpApi { if (route.controller === controller && route.action === action) { verb = route.verb.toUpperCase(); - url = route.url.replace(/(:[^/]+)/g, function (match) { - hits.push(match.substring(1)); + url = route.url + .replace(/(:[^/]+)/g, function (match) { + hits.push(match.substring(1)); - if (match === ':index') { - if (! index) { - throw new Error('No index provided'); + if (match === ":index") { + if (!index) { + throw new Error("No index provided"); + } + return index; } - return index; - } - if (match === ':collection') { - if (! collection) { - throw new Error('No collection provided'); + if (match === ":collection") { + if (!collection) { + throw new Error("No collection provided"); + } + return collection; } - return collection; - } - if (match === ':_id') { - if (args._id) { - return args._id; - } - if (args.body._id) { - return args.body._id; + if (match === ":_id") { + if (args._id) { + return args._id; + } + if (args.body._id) { + return args.body._id; + } + throw new Error("No _id provided"); } - throw new Error('No _id provided'); - } - if (args.body[match.substring(1)] !== undefined) { - return args.body[match.substring(1)]; - } + if (args.body[match.substring(1)] !== undefined) { + return args.body[match.substring(1)]; + } - return ''; - }).substring(1); + return ""; + }) + .substring(1); // add extra aguments in the query string - if (verb === 'GET') { - _.difference(Object.keys(args.body), hits).forEach(key => { + if (verb === "GET") { + _.difference(Object.keys(args.body), hits).forEach((key) => { const value = args.body[key]; if (value !== undefined) { if (Array.isArray(value)) { - queryString.push(...value.map(v => `${key}=${v}`)); - } - else { + queryString.push(...value.map((v) => `${key}=${v}`)); + } else { queryString.push(`${key}=${value}`); } } }); if (queryString.length) { - url += '?' + queryString.join('&'); + url += "?" + queryString.join("&"); } } - url = url - .replace(/\/\//g, '/') - .replace(/\/$/, ''); + url = url.replace(/\/\//g, "/").replace(/\/$/, ""); return true; } - } - catch (error) { + } catch (error) { return false; } @@ -133,66 +130,75 @@ class HttpApi { result = { url: this.apiPath(url), - method: verb + method: verb, }; - if (verb !== 'GET') { + if (verb !== "GET") { result.body = args.body; } return result; } - apiBasePath (path) { + apiBasePath(path) { return this.apiPath(path); } - apiPath (path) { - return path.startsWith('/') + apiPath(path) { + return path.startsWith("/") ? encodeURI(`${this.baseUri}${path}`) : encodeURI(`${this.baseUri}/${path}`); } - adminResetDatabase () { + adminResetDatabase() { const options = { - url: this.apiPath('/admin/_resetDatabase/'), - method: 'POST' + url: this.apiPath("/admin/_resetDatabase/"), + method: "POST", }; return this.callApi(options); } - serverPublicApi () { + serverPublicApi() { const options = { - url: this.apiPath('/_publicApi'), - method: 'GET' + url: this.apiPath("/_publicApi"), + method: "GET", }; return this.callApi(options); } - bulkImport (bulk, index) { + bulkImport(bulk, index) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/_bulk'), - method: 'POST', - body: { bulkData: bulk } + url: this.apiPath( + this.util.getIndex(index) + "/" + this.world.fakeCollection + "/_bulk" + ), + method: "POST", + body: { bulkData: bulk }, }; return this.callApi(options); } - bulkMWrite (index, collection, body) { + bulkMWrite(index, collection, body) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mWrite'), - method: 'POST', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mWrite" + ), + method: "POST", + body, }; return this.callApi(options); } - bulkWrite (index, collection, body, _id = null) { - let url = `${this.util.getIndex(index)}/${this.util.getCollection(collection)}/_write`; + bulkWrite(index, collection, body, _id = null) { + let url = `${this.util.getIndex(index)}/${this.util.getCollection( + collection + )}/_write`; if (_id) { url += `?_id=${_id}`; @@ -200,8 +206,8 @@ class HttpApi { const options = { url: this.apiPath(url), - method: 'POST', - body + method: "POST", + body, }; return this.callApi(options); @@ -211,8 +217,8 @@ class HttpApi { * @param options * @returns {Promise.} */ - async callApi (options) { - if (! options.headers) { + async callApi(options) { + if (!options.headers) { options.headers = {}; } @@ -222,27 +228,27 @@ class HttpApi { }); } - if (options.body && this.encoding !== 'identity') { + if (options.body && this.encoding !== "identity") { options.body = JSON.stringify(options.body); - options.headers['content-encoding'] = this.encoding; + options.headers["content-encoding"] = this.encoding; - const algorithms = this.encoding.split(',').map(a => a.trim().toLowerCase()); + const algorithms = this.encoding + .split(",") + .map((a) => a.trim().toLowerCase()); for (const algorithm of algorithms) { - if (algorithm === 'gzip') { + if (algorithm === "gzip") { options.body = zlib.gzipSync(options.body); - } - else if (algorithm === 'deflate') { + } else if (algorithm === "deflate") { options.body = zlib.deflateSync(options.body); } } - } - else { + } else { options.json = true; } - if (this.expectedEncoding !== 'identity') { - options.headers['accept-encoding'] = this.expectedEncoding; + if (this.expectedEncoding !== "identity") { + options.headers["accept-encoding"] = this.expectedEncoding; // despite the name, that options asks "request" to handle // both gzip or deflate compressed responses @@ -255,23 +261,23 @@ class HttpApi { // we need to manually parse the stringified json if // we sent a compressed buffer through the request module - if (options.body && this.encoding !== 'identity') { + if (options.body && this.encoding !== "identity") { return JSON.parse(response); } return response; } - callMemoryStorage (command, args) { - return this.callApi(this._getRequest(null, null, 'ms', command, args)); + callMemoryStorage(command, args) { + return this.callApi(this._getRequest(null, null, "ms", command, args)); } - checkToken (token) { + checkToken(token) { let _token = null; const request = { - url: this.apiPath('_checkToken'), - method: 'POST', - body: { token } + url: this.apiPath("_checkToken"), + method: "POST", + body: { token }, }; if (this.world.currentUser && this.world.currentUser.token) { @@ -280,14 +286,14 @@ class HttpApi { } return this.callApi(request) - .then(response => { + .then((response) => { if (_token !== null) { this.world.currentUser.token = _token; } return response; }) - .catch(error => { + .catch((error) => { if (_token !== null) { this.world.currentUser.token = _token; } @@ -296,78 +302,98 @@ class HttpApi { }); } - collectionExists (index, collection) { - return this.callApi(this._getRequest(index, collection, 'collection', 'exists')); + collectionExists(index, collection) { + return this.callApi( + this._getRequest(index, collection, "collection", "exists") + ); } - count (query, index, collection) { + count(query, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_count'), - method: 'POST', - body: query + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_count" + ), + method: "POST", + body: query, }; return this.callApi(options); } - create (body, index, collection, jwtToken, id) { - const - url = id - ? this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + id + '/_create') - : this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_create'), + create(body, index, collection, jwtToken, id) { + const url = id + ? this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/" + + id + + "/_create" + ) + : this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_create" + ), options = { url: url, - method: 'POST', - body + method: "POST", + body, }; if (jwtToken) { options.headers = { - authorization: 'Bearer ' + jwtToken + authorization: "Bearer " + jwtToken, }; } return this.callApi(options); } - createCollection (index, collection, mappings) { + createCollection(index, collection, mappings) { index = index || this.world.fakeIndex; const options = { url: this.apiPath(`${index}/${collection}`), - method: 'PUT', - body: mappings + method: "PUT", + body: mappings, }; return this.callApi(options); } - getCollectionMapping (index, collection, includeKuzzleMeta = false) { - const url = `${index}/${collection}/_mapping${includeKuzzleMeta ? '?includeKuzzleMeta' : ''}`; + getCollectionMapping(index, collection, includeKuzzleMeta = false) { + const url = `${index}/${collection}/_mapping${ + includeKuzzleMeta ? "?includeKuzzleMeta" : "" + }`; const options = { url: this.apiPath(url), - method: 'GET' + method: "GET", }; return this.callApi(options); } - createCredentials (strategy, userId, body) { + createCredentials(strategy, userId, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId + '/_create'), - method: 'POST', - body + url: this.apiPath("credentials/" + strategy + "/" + userId + "/_create"), + method: "POST", + body, }; return this.callApi(options); } - createFirstAdmin (body, id, reset) { + createFirstAdmin(body, id, reset) { const options = { - url: this.apiPath('_createFirstAdmin'), - method: 'POST', - body + url: this.apiPath("_createFirstAdmin"), + method: "POST", + body, }; if (id !== undefined) { @@ -375,36 +401,42 @@ class HttpApi { } if (reset) { - options.url += '?reset=1'; + options.url += "?reset=1"; } return this.callApi(options); } - createIndex (index) { + createIndex(index) { const options = { - url: this.apiPath(index + '/_create'), - method: 'POST' + url: this.apiPath(index + "/_create"), + method: "POST", }; return this.callApi(options); } - createMyCredentials (strategy, body) { + createMyCredentials(strategy, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me/_create'), - method: 'POST', - body + url: this.apiPath("credentials/" + strategy + "/_me/_create"), + method: "POST", + body, }; return this.callApi(options); } - createOrReplace (body, index, collection) { + createOrReplace(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + body._id), - method: 'PUT', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/" + + body._id + ), + method: "PUT", + body, }; delete body._id; @@ -412,543 +444,610 @@ class HttpApi { return this.callApi(options); } - createOrReplaceProfile (id, body) { + createOrReplaceProfile(id, body) { const options = { - url: this.apiPath('profiles/' + id), - method: 'PUT', - body + url: this.apiPath("profiles/" + id), + method: "PUT", + body, }; return this.callApi(options); } - createOrReplaceRole (id, body) { + createOrReplaceRole(id, body) { const options = { - url: this.apiPath('roles/' + id), - method: 'PUT', - body + url: this.apiPath("roles/" + id), + method: "PUT", + body, }; return this.callApi(options); } - createRestrictedUser (body, id) { + createRestrictedUser(body, id) { const options = { - url: this.apiPath('users/' + id + '/_createRestricted'), - method: 'POST', - body + url: this.apiPath("users/" + id + "/_createRestricted"), + method: "POST", + body, }; return this.callApi(options); } - createUser (body, id) { + createUser(body, id) { const options = { - url: this.apiPath('users/' + id + '/_create' + '?refresh=wait_for'), - method: 'POST', - body + url: this.apiPath("users/" + id + "/_create" + "?refresh=wait_for"), + method: "POST", + body, }; return this.callApi(options); } - credentialsExist (strategy) { + credentialsExist(strategy) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me/_exists'), - method: 'GET' + url: this.apiPath("credentials/" + strategy + "/_me/_exists"), + method: "GET", }; return this.callApi(options); } - deleteById (id, index) { + deleteById(id, index) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id), - method: 'DELETE' + url: this.apiPath( + this.util.getIndex(index) + "/" + this.world.fakeCollection + "/" + id + ), + method: "DELETE", }; return this.callApi(options); } - deleteByQuery (query, index, collection) { + deleteByQuery(query, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_query'), - method: 'DELETE', - body: query + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_query" + ), + method: "DELETE", + body: query, }; return this.callApi(options); } - deleteCredentials (strategy, userId) { + deleteCredentials(strategy, userId) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId), - method: 'DELETE' + url: this.apiPath("credentials/" + strategy + "/" + userId), + method: "DELETE", }; return this.callApi(options); } - deleteIndex (index) { + deleteIndex(index) { const options = { url: this.apiPath(index), - method: 'DELETE' + method: "DELETE", }; return this.callApi(options); } - deleteIndexes () { + deleteIndexes() { const options = { - url: this.apiPath('_mDelete'), - method: 'DELETE' + url: this.apiPath("_mDelete"), + method: "DELETE", }; return this.callApi(options); } - deleteMyCredentials (strategy) { + deleteMyCredentials(strategy) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me'), - method: 'DELETE' + url: this.apiPath("credentials/" + strategy + "/_me"), + method: "DELETE", }; return this.callApi(options); } - deleteProfile (id, waitFor = false) { + deleteProfile(id, waitFor = false) { return this.callApi({ - url: this.apiPath('profiles/' + id + (waitFor ? '?refresh=wait_for' : '')), - method: 'DELETE' + url: this.apiPath( + "profiles/" + id + (waitFor ? "?refresh=wait_for" : "") + ), + method: "DELETE", }); } - deleteProfiles (ids, waitFor = false) { + deleteProfiles(ids, waitFor = false) { return this.callApi({ - url: this.apiPath('profiles/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), - method: 'POST', + url: this.apiPath( + "profiles/_mDelete" + (waitFor ? "?refresh=wait_for" : "") + ), + method: "POST", body: { - ids - } + ids, + }, }); } - deleteRole (id, waitFor = false) { + deleteRole(id, waitFor = false) { return this.callApi({ - url: this.apiPath('roles/' + id + (waitFor ? '?refresh=wait_for' : '')), - method: 'DELETE' + url: this.apiPath("roles/" + id + (waitFor ? "?refresh=wait_for" : "")), + method: "DELETE", }); } - deleteRoles (ids, waitFor = false) { + deleteRoles(ids, waitFor = false) { return this.callApi({ - url: this.apiPath('roles/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), - method: 'POST', + url: this.apiPath( + "roles/_mDelete" + (waitFor ? "?refresh=wait_for" : "") + ), + method: "POST", body: { - ids - } + ids, + }, }); } - deleteSpecifications (index, collection) { + deleteSpecifications(index, collection) { const options = { - url: this.apiPath(index + '/' + collection + '/_specifications'), - method: 'DELETE' + url: this.apiPath(index + "/" + collection + "/_specifications"), + method: "DELETE", }; return this.callApi(options); } - deleteUser (id, waitFor = false) { + deleteUser(id, waitFor = false) { return this.callApi({ - url: this.apiPath('users/' + id + (waitFor ? '?refresh=wait_for' : '')), - method: 'DELETE' + url: this.apiPath("users/" + id + (waitFor ? "?refresh=wait_for" : "")), + method: "DELETE", }); } - deleteUsers (ids, waitFor = false) { + deleteUsers(ids, waitFor = false) { return this.callApi({ - url: this.apiPath('users/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), - method: 'POST', + url: this.apiPath( + "users/_mDelete" + (waitFor ? "?refresh=wait_for" : "") + ), + method: "POST", body: { - ids - } + ids, + }, }); } - disconnect () {} + disconnect() {} - exists (id, index) { + exists(id, index) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id + '/_exists'), - method: 'GET' + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.world.fakeCollection + + "/" + + id + + "/_exists" + ), + method: "GET", }; return this.callApi(options); } - get (id, index) { + get(id, index) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id), - method: 'GET' + url: this.apiPath( + this.util.getIndex(index) + "/" + this.world.fakeCollection + "/" + id + ), + method: "GET", }; return this.callApi(options); } - getAllStats () { + getAllStats() { const options = { - url: this.apiPath('_getAllStats'), - method: 'GET' + url: this.apiPath("_getAllStats"), + method: "GET", }; return this.callApi(options); } - getAuthenticationStrategies () { + getAuthenticationStrategies() { const options = { - url: this.apiPath('strategies'), - method: 'GET' + url: this.apiPath("strategies"), + method: "GET", }; return this.callApi(options); } - getCredentials (strategy, userId) { + getCredentials(strategy, userId) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId), - method: 'GET' + url: this.apiPath("credentials/" + strategy + "/" + userId), + method: "GET", }; return this.callApi(options); } - getCredentialsById (strategy, userId) { + getCredentialsById(strategy, userId) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId + '/_byId'), - method: 'GET' + url: this.apiPath("credentials/" + strategy + "/" + userId + "/_byId"), + method: "GET", }; return this.callApi(options); } - getCurrentUser () { + getCurrentUser() { return this.callApi({ - url: this.apiPath('users/_me'), - method: 'GET' + url: this.apiPath("users/_me"), + method: "GET", }); } - getLastStats () { + getLastStats() { const options = { - url: this.apiPath('_getLastStats'), - method: 'GET' + url: this.apiPath("_getLastStats"), + method: "GET", }; return this.callApi(options); } - getMyCredentials (strategy) { + getMyCredentials(strategy) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me'), - method: 'GET' + url: this.apiPath("credentials/" + strategy + "/_me"), + method: "GET", }; return this.callApi(options); } - getMyRights () { + getMyRights() { const options = { - url: this.apiPath('users/_me/_rights'), - method: 'GET' + url: this.apiPath("users/_me/_rights"), + method: "GET", }; return this.callApi(options); } - getProfile (id) { + getProfile(id) { const options = { - url: this.apiPath('profiles/' + id), - method: 'GET' + url: this.apiPath("profiles/" + id), + method: "GET", }; return this.callApi(options); } - getProfileMapping () { + getProfileMapping() { const options = { - url: this.apiPath('/profiles/_mapping'), - method: 'GET' + url: this.apiPath("/profiles/_mapping"), + method: "GET", }; return this.callApi(options); } - getProfileRights (id) { + getProfileRights(id) { const options = { - url: this.apiPath('profiles/' + id + '/_rights'), - method: 'GET' + url: this.apiPath("profiles/" + id + "/_rights"), + method: "GET", }; return this.callApi(options); } - getRole (id) { + getRole(id) { const options = { - url: this.apiPath('roles/' + id), - method: 'GET' + url: this.apiPath("roles/" + id), + method: "GET", }; return this.callApi(options); } - getRoleMapping () { + getRoleMapping() { const options = { - url: this.apiPath('/roles/_mapping'), - method: 'GET' + url: this.apiPath("/roles/_mapping"), + method: "GET", }; return this.callApi(options); } - getSpecifications (index, collection) { + getSpecifications(index, collection) { const options = { - url: this.apiPath(index + '/' + collection + '/_specifications'), - method: 'GET' + url: this.apiPath(index + "/" + collection + "/_specifications"), + method: "GET", }; return this.callApi(options); } - getStats (dates) { - return this.callApi(this._getRequest(null, null, 'server', 'getStats', { body: dates })); + getStats(dates) { + return this.callApi( + this._getRequest(null, null, "server", "getStats", { body: dates }) + ); } - getUser (id) { + getUser(id) { const options = { - url: this.apiPath('users/' + id), - method: 'GET' + url: this.apiPath("users/" + id), + method: "GET", }; return this.callApi(options); } - getUserMapping () { + getUserMapping() { const options = { - url: this.apiPath('/users/_mapping'), - method: 'GET' + url: this.apiPath("/users/_mapping"), + method: "GET", }; return this.callApi(options); } - getUserRights (id) { + getUserRights(id) { const options = { - url: this.apiPath('users/' + id + '/_rights'), - method: 'GET' + url: this.apiPath("users/" + id + "/_rights"), + method: "GET", }; return this.callApi(options); } - hasCredentials (strategy, userId) { + hasCredentials(strategy, userId) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId + '/_exists'), - method: 'GET' + url: this.apiPath("credentials/" + strategy + "/" + userId + "/_exists"), + method: "GET", }; return this.callApi(options); } - indexExists (index) { - return this.callApi(this._getRequest(index, null, 'index', 'exists')); + indexExists(index) { + return this.callApi(this._getRequest(index, null, "index", "exists")); } - refreshCollection (index, collection) { - const - _index = index || this.world.fakeIndex, + refreshCollection(index, collection) { + const _index = index || this.world.fakeIndex, _collection = collection || this.world.fakeCollection, options = { url: this.apiPath(`${_index}/${_collection}/_refresh`), - method: 'POST' + method: "POST", }; return this.callApi(options); } - listCollections (index, type) { + listCollections(index, type) { const options = { url: this.apiPath(`${index || this.world.fakeIndex}/_list`), - method: 'GET' + method: "GET", }; if (type) { - options.url += '?type=' + type; + options.url += "?type=" + type; } return this.callApi(options); } - listIndexes () { + listIndexes() { const options = { - url: this.apiPath('_list'), - method: 'GET' + url: this.apiPath("_list"), + method: "GET", }; return this.callApi(options); } - login (strategy, credentials) { + login(strategy, credentials) { const options = { url: this.apiPath(`_login/${strategy}`), - method: 'POST', + method: "POST", body: { username: credentials.username, - password: credentials.password - } + password: credentials.password, + }, }; return this.callApi(options); } - logout (jwtToken) { + logout(jwtToken) { const options = { - url: this.apiPath('_logout'), - method: 'POST', + url: this.apiPath("_logout"), + method: "POST", headers: { - authorization: 'Bearer ' + jwtToken - } + authorization: "Bearer " + jwtToken, + }, }; return this.callApi(options); } - mCreate (body, index, collection, jwtToken) { + mCreate(body, index, collection, jwtToken) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mCreate'), - method: 'POST', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mCreate" + ), + method: "POST", + body, }; if (jwtToken) { options.headers = { - authorization: 'Bearer ' + jwtToken + authorization: "Bearer " + jwtToken, }; } return this.callApi(options); } - mCreateOrReplace (body, index, collection) { + mCreateOrReplace(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mCreateOrReplace'), - method: 'PUT', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mCreateOrReplace" + ), + method: "PUT", + body, }; return this.callApi(options); } - mDelete (body, index, collection) { + mDelete(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mDelete'), - method: 'DELETE', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mDelete" + ), + method: "DELETE", + body, }; return this.callApi(options); } - mGet (body, index, collection) { + mGet(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mGet'), - method: 'POST', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mGet" + ), + method: "POST", + body, }; return this.callApi(options); } - mGetProfiles (body) { + mGetProfiles(body) { const options = { - url: this.apiPath('profiles/_mGet'), - method: 'POST', - body + url: this.apiPath("profiles/_mGet"), + method: "POST", + body, }; return this.callApi(options); } - mGetRoles (body) { + mGetRoles(body) { const options = { - url: this.apiPath('roles/_mGet'), - method: 'POST', - body + url: this.apiPath("roles/_mGet"), + method: "POST", + body, }; return this.callApi(options); } - mReplace (body, index, collection) { + mReplace(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mReplace'), - method: 'PUT', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mReplace" + ), + method: "PUT", + body, }; return this.callApi(options); } - mUpdate (body, index, collection) { + mUpdate(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mUpdate'), - method: 'PUT', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_mUpdate" + ), + method: "PUT", + body, }; return this.callApi(options); } - now () { + now() { const options = { - url: this.apiPath('_now'), - method: 'GET' + url: this.apiPath("_now"), + method: "GET", }; return this.callApi(options); } - postDocument (index, collection, document) { + postDocument(index, collection, document) { const options = { - url: this.apiPath(index + '/' + collection + '/_create'), - method: 'POST', - body: document + url: this.apiPath(index + "/" + collection + "/_create"), + method: "POST", + body: document, }; return this.callApi(options); } - publish (body, index) { + publish(body, index) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/_publish'), - method: 'POST', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.world.fakeCollection + + "/_publish" + ), + method: "POST", + body, }; return this.callApi(options); } - refreshToken () { + refreshToken() { return this.callApi({ - url: this.apiPath('_refreshToken'), - method: 'POST' + url: this.apiPath("_refreshToken"), + method: "POST", }); } - replace (body, index, collection) { + replace(body, index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + body._id + '/_replace'), - method: 'PUT', - body + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/" + + body._id + + "/_replace" + ), + method: "PUT", + body, }; delete body._id; @@ -956,102 +1055,106 @@ class HttpApi { return this.callApi(options); } - replaceUser (id, body) { + replaceUser(id, body) { return this.callApi({ - url: this.apiPath('users/' + id + '/_replace'), - method: 'PUT', - body + url: this.apiPath("users/" + id + "/_replace"), + method: "PUT", + body, }); } - revokeTokens (id) { + revokeTokens(id) { return this.callApi({ url: this.apiPath(`users/${id}/tokens`), - method: 'DELETE' + method: "DELETE", }); } - scroll (scrollId, scroll) { + scroll(scrollId, scroll) { const options = { url: this.apiPath(`_scroll/${scrollId}`), - method: 'GET' + method: "GET", }; if (scroll) { - options.url += '?scroll=' + scroll; + options.url += "?scroll=" + scroll; } return this.callApi(options); } - scrollProfiles (scrollId) { + scrollProfiles(scrollId) { const options = { - url: this.apiPath('profiles/_scroll/' + scrollId), - method: 'GET' + url: this.apiPath("profiles/_scroll/" + scrollId), + method: "GET", }; return this.callApi(options); } - scrollSpecifications (scrollId) { + scrollSpecifications(scrollId) { const options = { - url: this.apiPath('validations/_scroll/' + scrollId), - method: 'GET' + url: this.apiPath("validations/_scroll/" + scrollId), + method: "GET", }; return this.callApi(options); } - scrollUsers (scrollId) { + scrollUsers(scrollId) { const options = { - url: this.apiPath('users/_scroll/' + scrollId), - method: 'GET' + url: this.apiPath("users/_scroll/" + scrollId), + method: "GET", }; return this.callApi(options); } - search (query, index, collection, args) { - const - options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_search'), - method: 'POST', - body: query - }; + search(query, index, collection, args) { + const options = { + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_search" + ), + method: "POST", + body: query, + }; if (args) { let qs = []; - options.url += '?'; + options.url += "?"; if (args.scroll) { - qs.push('scroll=' + args.scroll); + qs.push("scroll=" + args.scroll); } if (args.from) { - qs.push('from=' + args.from); + qs.push("from=" + args.from); } if (args.size) { - qs.push('size=' + args.size); + qs.push("size=" + args.size); } - options.url += qs.join('&'); + options.url += qs.join("&"); } return this.callApi(options); } - searchProfiles (roles, args) { + searchProfiles(roles, args) { const options = { - url: this.apiPath('profiles/_search'), - method: 'POST', + url: this.apiPath("profiles/_search"), + method: "POST", body: { - roles - } + roles, + }, }; if (args) { let first = true; - Object.keys(args).forEach(arg => { - options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; + Object.keys(args).forEach((arg) => { + options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; first = false; }); } @@ -1059,41 +1162,41 @@ class HttpApi { return this.callApi(options); } - searchRoles (body, args) { + searchRoles(body, args) { const options = { - url: this.apiPath('roles/_search'), - method: 'POST', - body + url: this.apiPath("roles/_search"), + method: "POST", + body, }; if (args) { let qs = []; - options.url += '?'; + options.url += "?"; if (args.from) { - qs.push('from=' + args.from); + qs.push("from=" + args.from); } if (args.size) { - qs.push('size=' + args.size); + qs.push("size=" + args.size); } - options.url += qs.join('&'); + options.url += qs.join("&"); } return this.callApi(options); } - searchSpecifications (body, args) { + searchSpecifications(body, args) { const options = { - url: this.apiPath('validations/_search'), - method: 'POST', - body + url: this.apiPath("validations/_search"), + method: "POST", + body, }; if (args) { let first = true; - Object.keys(args).forEach(arg => { - options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; + Object.keys(args).forEach((arg) => { + options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; first = false; }); } @@ -1101,19 +1204,19 @@ class HttpApi { return this.callApi(options); } - searchUsers (query, args) { + searchUsers(query, args) { const options = { - url: this.apiPath('users/_search'), - method: 'POST', + url: this.apiPath("users/_search"), + method: "POST", body: { - query - } + query, + }, }; if (args) { let first = true; - Object.keys(args).forEach(arg => { - options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; + Object.keys(args).forEach((arg) => { + options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; first = false; }); } @@ -1121,22 +1224,28 @@ class HttpApi { return this.callApi(options); } - truncateCollection (index, collection) { + truncateCollection(index, collection) { const options = { - url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_truncate'), - method: 'DELETE' + url: this.apiPath( + this.util.getIndex(index) + + "/" + + this.util.getCollection(collection) + + "/_truncate" + ), + method: "DELETE", }; return this.callApi(options); } - update (id, body, index, collection) { - const - _collection = collection || this.world.fakeCollection, + update(id, body, index, collection) { + const _collection = collection || this.world.fakeCollection, options = { - url: this.apiPath(`${this.util.getIndex(index)}/${_collection}/${id}/_update`), - method: 'PUT', - body + url: this.apiPath( + `${this.util.getIndex(index)}/${_collection}/${id}/_update` + ), + method: "PUT", + body, }; delete body._id; @@ -1144,218 +1253,230 @@ class HttpApi { return this.callApi(options); } - updateCredentials (strategy, userId, body) { + updateCredentials(strategy, userId, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId + '/_update'), - method: 'PUT', - body + url: this.apiPath("credentials/" + strategy + "/" + userId + "/_update"), + method: "PUT", + body, }; return this.callApi(options); } - updateProfileMapping () { + updateProfileMapping() { const options = { - url: this.apiPath('/profiles/_mapping'), - method: 'PUT', - body: this.world.securitymapping + url: this.apiPath("/profiles/_mapping"), + method: "PUT", + body: this.world.securitymapping, }; return this.callApi(options); } - updateMapping (index, collection, mapping) { + updateMapping(index, collection, mapping) { const options = { - url: `${this.apiPath(this.util.getIndex(index))}/${collection || this.world.fakeCollection}/_mapping`, - method: 'PUT', - body: mapping || this.world.mapping + url: `${this.apiPath(this.util.getIndex(index))}/${ + collection || this.world.fakeCollection + }/_mapping`, + method: "PUT", + body: mapping || this.world.mapping, }; return this.callApi(options); } - updateMyCredentials (strategy, body) { + updateMyCredentials(strategy, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me/_update'), - method: 'PUT', - body + url: this.apiPath("credentials/" + strategy + "/_me/_update"), + method: "PUT", + body, }; return this.callApi(options); } - updateRoleMapping () { + updateRoleMapping() { const options = { - url: this.apiPath('/roles/_mapping'), - method: 'PUT', - body: this.world.securitymapping + url: this.apiPath("/roles/_mapping"), + method: "PUT", + body: this.world.securitymapping, }; return this.callApi(options); } - updateSelf (body) { + updateSelf(body) { const options = { - url: this.apiPath('_updateSelf'), - method: 'PUT', - body + url: this.apiPath("_updateSelf"), + method: "PUT", + body, }; return this.callApi(options); } - updateSpecifications (index, collection, specifications) { + updateSpecifications(index, collection, specifications) { const options = { url: this.apiPath(`${index}/${collection}/_specifications`), - method: 'PUT', - body: specifications + method: "PUT", + body: specifications, }; return this.callApi(options); } - updateUserMapping () { + updateUserMapping() { const options = { - url: this.apiPath('/users/_mapping'), - method: 'PUT', - body: this.world.securitymapping + url: this.apiPath("/users/_mapping"), + method: "PUT", + body: this.world.securitymapping, }; return this.callApi(options); } - validateCredentials (strategy, userId, body) { + validateCredentials(strategy, userId, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/' + userId + '/_validate'), - method: 'POST', - body + url: this.apiPath( + "credentials/" + strategy + "/" + userId + "/_validate" + ), + method: "POST", + body, }; return this.callApi(options); } - validateDocument (index, collection, document) { + validateDocument(index, collection, document) { const options = { - url: this.apiPath(index + '/' + collection + '/_validate'), - method: 'POST', - body: document + url: this.apiPath(index + "/" + collection + "/_validate"), + method: "POST", + body: document, }; return this.callApi(options); } - validateMyCredentials (strategy, body) { + validateMyCredentials(strategy, body) { const options = { - url: this.apiPath('credentials/' + strategy + '/_me/_validate'), - method: 'POST', - body + url: this.apiPath("credentials/" + strategy + "/_me/_validate"), + method: "POST", + body, }; return this.callApi(options); } - validateSpecifications (index, collection, specifications) { + validateSpecifications(index, collection, specifications) { const options = { - url: this.apiPath(index ? `${index}/${collection}/_validateSpecifications` : '_validateSpecifications'), - method: 'POST', - body: specifications + url: this.apiPath( + index + ? `${index}/${collection}/_validateSpecifications` + : "_validateSpecifications" + ), + method: "POST", + body: specifications, }; return this.callApi(options); } - resetCache (database) { + resetCache(database) { const options = { url: this.apiPath(`admin/_resetCache/${database}`), - method: 'POST' + method: "POST", }; return this.callApi(options); } - resetKuzzleData () { + resetKuzzleData() { const options = { - url: this.apiPath('admin/_resetKuzzleData'), - method: 'POST' + url: this.apiPath("admin/_resetKuzzleData"), + method: "POST", }; return this.callApi(options); } - resetSecurity () { + resetSecurity() { const options = { - url: this.apiPath('admin/_resetSecurity'), - method: 'POST', + url: this.apiPath("admin/_resetSecurity"), + method: "POST", body: { - refresh: 'wait_for' - } + refresh: "wait_for", + }, }; return this.callApi(options); } - resetDatabase () { + resetDatabase() { const options = { - url: this.apiPath('admin/_resetDatabase'), - method: 'POST' + url: this.apiPath("admin/_resetDatabase"), + method: "POST", }; return this.callApi(options); } - loadMappings (body) { + loadMappings(body) { const options = { - url: this.apiPath('admin/_loadMappings?refresh=wait_for'), - method: 'POST', - body + url: this.apiPath("admin/_loadMappings?refresh=wait_for"), + method: "POST", + body, }; return this.callApi(options); } - loadFixtures (body) { + loadFixtures(body) { const options = { - url: this.apiPath('admin/_loadFixtures?refresh=wait_for'), - method: 'POST', - body + url: this.apiPath("admin/_loadFixtures?refresh=wait_for"), + method: "POST", + body, }; return this.callApi(options); } - loadSecurities (body) { + loadSecurities(body) { const options = { - url: this.apiPath('admin/_loadSecurities?refresh=wait_for'), - method: 'POST', - body + url: this.apiPath("admin/_loadSecurities?refresh=wait_for"), + method: "POST", + body, }; return this.callApi(options); } - encode (algorithm) { + encode(algorithm) { checkAlgorithm(algorithm); this.encoding = algorithm; } - decode (algorithm) { + decode(algorithm) { checkAlgorithm(algorithm); this.expectedEncoding = algorithm; } - urlEncodedCreate (form) { + urlEncodedCreate(form) { return this.callApi({ form, - method: 'POST', - url: this.apiPath(`${this.world.fakeIndex}/${this.world.fakeCollection}/_create`), + method: "POST", + url: this.apiPath( + `${this.world.fakeIndex}/${this.world.fakeCollection}/_create` + ), }); } - multipartCreate (formData) { + multipartCreate(formData) { return this.callApi({ formData, - method: 'POST', - url: this.apiPath(`${this.world.fakeIndex}/${this.world.fakeCollection}/_create`), + method: "POST", + url: this.apiPath( + `${this.world.fakeIndex}/${this.world.fakeCollection}/_create` + ), }); } } diff --git a/features-legacy/support/api/mqtt.js b/features-legacy/support/api/mqtt.js index 891aa34aac..2cbccfac5c 100644 --- a/features-legacy/support/api/mqtt.js +++ b/features-legacy/support/api/mqtt.js @@ -1,13 +1,12 @@ -'use strict'; +"use strict"; -const - Bluebird = require('bluebird'), - ApiBase = require('./apiBase'), - mqtt = require('mqtt'), - uuid = require('uuid'); +const Bluebird = require("bluebird"), + ApiBase = require("./apiBase"), + mqtt = require("mqtt"), + uuid = require("uuid"); class MqttApi extends ApiBase { - constructor (world) { + constructor(world) { super(world); this.clients = {}; @@ -15,14 +14,14 @@ class MqttApi extends ApiBase { this.subscribedRooms = {}; } - disconnect () { + disconnect() { for (const k of Object.keys(this.clients)) { this.clients[k].end(); } } - send (msg, getAnswer = true, clientName = 'client1') { - if (! msg.requestId) { + send(msg, getAnswer = true, clientName = "client1") { + if (!msg.requestId) { msg.requestId = uuid.v4(); } @@ -32,75 +31,75 @@ class MqttApi extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._getClient(clientName) - .then(client => { - let promise = Bluebird.resolve({}); - if (getAnswer) { - promise = new Bluebird((resolve, reject) => { - this.requests[msg.requestId] = result => { - if (! result) { - const error = new Error('Returned result is null'); - return reject(Object.assign(error, msg)); - } - - if (result.error && result.status !== 206) { - const error = new Error(result.error.stack); - Object.assign(error, result); - - // used to fit with rest api (used with request-promise) - error.details = result.error._source || {}; - error.statusCode = result.status; - return reject(error); - } - - resolve(result); - }; - }); - } + return this._getClient(clientName).then((client) => { + let promise = Bluebird.resolve({}); + if (getAnswer) { + promise = new Bluebird((resolve, reject) => { + this.requests[msg.requestId] = (result) => { + if (!result) { + const error = new Error("Returned result is null"); + return reject(Object.assign(error, msg)); + } - client.publish('Kuzzle/request', JSON.stringify(msg)); + if (result.error && result.status !== 206) { + const error = new Error(result.error.stack); + Object.assign(error, result); - return promise; - }); + // used to fit with rest api (used with request-promise) + error.details = result.error._source || {}; + error.statusCode = result.status; + return reject(error); + } + resolve(result); + }; + }); + } + + client.publish("Kuzzle/request", JSON.stringify(msg)); + + return promise; + }); } - sendAndListen (msg, clientName = 'client1') { - if (! msg.requestId) { + sendAndListen(msg, clientName = "client1") { + if (!msg.requestId) { msg.requestId = uuid.v4(); } msg.volatile = this.world.volatile; - return this._getClient(clientName) - .then(client => { - const promise = new Bluebird((resolve, reject) => { - this.requests[msg.requestId] = response => { - const listener = document => { - this.responses = document; - }; - - if (response.error) { - return reject(response.error.message); - } + return this._getClient(clientName).then((client) => { + const promise = new Bluebird((resolve, reject) => { + this.requests[msg.requestId] = (response) => { + const listener = (document) => { + this.responses = document; + }; - if (! this.subscribedRooms[clientName]) { - this.subscribedRooms[clientName] = {}; - } - this.subscribedRooms[clientName][response.result.roomId] = { channel: response.result.channel, listener }; - client.subscribe(response.result.channel); + if (response.error) { + return reject(response.error.message); + } - resolve(response); + if (!this.subscribedRooms[clientName]) { + this.subscribedRooms[clientName] = {}; + } + this.subscribedRooms[clientName][response.result.roomId] = { + channel: response.result.channel, + listener, }; - }); + client.subscribe(response.result.channel); - client.publish('Kuzzle/request', JSON.stringify(msg)); - - return promise; + resolve(response); + }; }); + + client.publish("Kuzzle/request", JSON.stringify(msg)); + + return promise; + }); } - _getClient (name) { + _getClient(name) { if (this.clients[name]) { return Bluebird.resolve(this.clients[name]); } @@ -109,31 +108,32 @@ class MqttApi extends ApiBase { const client = mqtt.connect({ host: this.world.config.host }); this.clients[name] = client; - client.on('error', reject); - client.on('connect', () => resolve(client)); - client.on('message', (topic, raw) => { + client.on("error", reject); + client.on("connect", () => resolve(client)); + client.on("message", (topic, raw) => { const message = JSON.parse(Buffer.from(raw)); - if (topic === 'Kuzzle/response') { + if (topic === "Kuzzle/response") { if (this.requests[message.requestId]) { this.requests[message.requestId](message); } - } - else { - if (message.type === 'TokenExpired') { + } else { + if (message.type === "TokenExpired") { this.responses = message; } // notification const channel = topic; - const roomId = topic.split('-')[0]; + const roomId = topic.split("-")[0]; - if (this.subscribedRooms[name] && this.subscribedRooms[name][roomId]) { + if ( + this.subscribedRooms[name] && + this.subscribedRooms[name][roomId] + ) { const room = this.subscribedRooms[name][roomId]; if (room.channel === channel) { room.listener(message); - } - else { - throw new Error('Channels do not match'); + } else { + throw new Error("Channels do not match"); } } } @@ -141,9 +141,9 @@ class MqttApi extends ApiBase { }); } - unsubscribe (roomId, clientName, waitForResponse = false) { + unsubscribe(roomId, clientName, waitForResponse = false) { const client = this.clients[clientName]; - if (! client) { + if (!client) { return; } @@ -151,17 +151,20 @@ class MqttApi extends ApiBase { client.unsubscribe(room.channel); delete this.subscribedRooms[clientName][roomId]; - return this.send({ - controller: 'realtime', - action: 'unsubscribe', - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - body: { roomId } - }, waitForResponse, clientName); - + return this.send( + { + controller: "realtime", + action: "unsubscribe", + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + body: { roomId }, + }, + waitForResponse, + clientName + ); } - unsubscribeAll () { + unsubscribeAll() { const promises = []; for (const clientName of Object.keys(this.subscribedRooms)) { @@ -172,8 +175,6 @@ class MqttApi extends ApiBase { return Bluebird.all(promises); } - } module.exports = MqttApi; - diff --git a/features-legacy/support/api/websocket.js b/features-legacy/support/api/websocket.js index 910d117422..10c89b2815 100644 --- a/features-legacy/support/api/websocket.js +++ b/features-legacy/support/api/websocket.js @@ -1,13 +1,11 @@ -'use strict'; +"use strict"; -const - Bluebird = require('bluebird'), - WsApiBase = require('./websocketBase'), - Ws = require('ws'); +const Bluebird = require("bluebird"), + WsApiBase = require("./websocketBase"), + Ws = require("ws"); class WebSocketApi extends WsApiBase { - - constructor (world) { + constructor(world) { super(world); this.responses = null; @@ -17,52 +15,60 @@ class WebSocketApi extends WsApiBase { this.requests = {}; } - get socket () { + get socket() { return this.socket.client1; } - _initSocket (name = 'client1') { + _initSocket(name = "client1") { if (this.sockets[name]) { return Bluebird.resolve(); } return new Bluebird((resolve, reject) => { - this.sockets[name] = new Ws(`ws://${this.world.config.host}:${this.world.config.port}`, { - perMessageDeflate: false - }); + this.sockets[name] = new Ws( + `ws://${this.world.config.host}:${this.world.config.port}`, + { + perMessageDeflate: false, + } + ); - this.sockets[name].on('message', message => { + this.sockets[name].on("message", (message) => { const data = JSON.parse(message); - if (data.scope || data.type === 'user' || data.type === 'TokenExpired') { - if (data.type === 'TokenExpired') { + if ( + data.scope || + data.type === "user" || + data.type === "TokenExpired" + ) { + if (data.type === "TokenExpired") { this.responses = data; } // notification const channel = data.room; - const roomId = channel.split('-')[0]; + const roomId = channel.split("-")[0]; - if (this.subscribedRooms[name] && this.subscribedRooms[name][roomId]) { + if ( + this.subscribedRooms[name] && + this.subscribedRooms[name][roomId] + ) { const room = this.subscribedRooms[name][roomId]; if (room.channel === channel) { room.listener(data); - } - else { - throw new Error('Channels do not match'); + } else { + throw new Error("Channels do not match"); } } - } - else if (this.requests[data.requestId]) { + } else if (this.requests[data.requestId]) { // response this.requests[data.requestId](data); } }); - this.sockets[name].on('error', reject); - this.sockets[name].on('open', resolve); + this.sockets[name].on("error", reject); + this.sockets[name].on("open", resolve); }); } - _socketOn () { + _socketOn() { // do nothing } @@ -74,11 +80,11 @@ class WebSocketApi extends WsApiBase { * @returns {*} * @private */ - _socketOnce (socket, requestId, cb) { + _socketOnce(socket, requestId, cb) { this.requests[requestId] = cb; } - _socketRemoveListener () { + _socketRemoveListener() { // do nothing } @@ -89,21 +95,20 @@ class WebSocketApi extends WsApiBase { * @returns {*} * @private */ - _socketSend (socket, msg) { - return socket.send(JSON.stringify(msg), err => { + _socketSend(socket, msg) { + return socket.send(JSON.stringify(msg), (err) => { if (err) { throw err; } }); } - disconnect () { + disconnect() { for (const socketKey of Object.keys(this.sockets)) { this.sockets[socketKey].terminate(); delete this.sockets[socketKey]; } } - } module.exports = WebSocketApi; diff --git a/features-legacy/support/api/websocketBase.js b/features-legacy/support/api/websocketBase.js index 01788cc512..24b73f7e55 100644 --- a/features-legacy/support/api/websocketBase.js +++ b/features-legacy/support/api/websocketBase.js @@ -1,23 +1,20 @@ -'use strict'; - -const - Bluebird = require('bluebird'), - ApiBase = require('./apiBase'), - uuid = require('uuid'); +"use strict"; +const Bluebird = require("bluebird"), + ApiBase = require("./apiBase"), + uuid = require("uuid"); class WebSocketApiBase extends ApiBase { - - _socketOnce () { - throw new Error('not implemented'); + _socketOnce() { + throw new Error("not implemented"); } - _socketSend () { - throw new Error('not implemented'); + _socketSend() { + throw new Error("not implemented"); } - send (msg, getAnswer = true, socketName = 'client1') { - if (! msg.requestId) { + send(msg, getAnswer = true, socketName = "client1") { + if (!msg.requestId) { msg.requestId = uuid.v4(); } @@ -27,42 +24,41 @@ class WebSocketApiBase extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._initSocket(socketName) - .then(() => { - const socket = this.sockets[socketName]; - - let promise = Bluebird.resolve({}); - if (getAnswer) { - promise = new Bluebird((resolve, reject) => { - this._socketOnce(socket, msg.requestId, result => { - if (! result) { - const error = new Error('Returned result is null'); - return reject(Object.assign(error, msg)); - } - - if (result.error && result.status !== 206) { - const error = new Error(result.error.stack); - Object.assign(error, result); - - // used to fit with rest api (used with request-promise) - error.details = result.error._source || {}; - error.statusCode = result.status; - return reject(error); - } - - resolve(result); - }); + return this._initSocket(socketName).then(() => { + const socket = this.sockets[socketName]; + + let promise = Bluebird.resolve({}); + if (getAnswer) { + promise = new Bluebird((resolve, reject) => { + this._socketOnce(socket, msg.requestId, (result) => { + if (!result) { + const error = new Error("Returned result is null"); + return reject(Object.assign(error, msg)); + } + + if (result.error && result.status !== 206) { + const error = new Error(result.error.stack); + Object.assign(error, result); + + // used to fit with rest api (used with request-promise) + error.details = result.error._source || {}; + error.statusCode = result.status; + return reject(error); + } + + resolve(result); }); - } + }); + } - this._socketSend(socket, msg); + this._socketSend(socket, msg); - return promise; - }); + return promise; + }); } - sendAndListen (msg, socketName = 'client1') { - if (! msg.requestId) { + sendAndListen(msg, socketName = "client1") { + if (!msg.requestId) { msg.requestId = uuid.v4(); } @@ -72,48 +68,51 @@ class WebSocketApiBase extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._initSocket(socketName) - .then(() => { - const socket = this.sockets[socketName]; - - let promise = new Bluebird((resolve, reject) => { - this._socketOnce(socket, msg.requestId, response => { - const listener = document => { - this.responses = document; - }; - - if (response.error) { - return reject(response.error.message); - } - - if (! this.subscribedRooms[socketName]) { - this.subscribedRooms[socketName] = {}; - } - - this.subscribedRooms[socketName][response.result.roomId] = { channel: response.result.channel, listener }; - this._socketOn(socket, response.result.channel, document => listener(document)); - resolve(response); - }); + return this._initSocket(socketName).then(() => { + const socket = this.sockets[socketName]; + + let promise = new Bluebird((resolve, reject) => { + this._socketOnce(socket, msg.requestId, (response) => { + const listener = (document) => { + this.responses = document; + }; + + if (response.error) { + return reject(response.error.message); + } + + if (!this.subscribedRooms[socketName]) { + this.subscribedRooms[socketName] = {}; + } + + this.subscribedRooms[socketName][response.result.roomId] = { + channel: response.result.channel, + listener, + }; + this._socketOn(socket, response.result.channel, (document) => + listener(document) + ); + resolve(response); }); + }); - this._socketSend(socket, msg); + this._socketSend(socket, msg); - return promise; - }); + return promise; + }); } - unsubscribe (roomId, socketName, waitForResponse = false) { - const - msg = { - controller: 'realtime', - action: 'unsubscribe', - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - body: { roomId: roomId } - }; + unsubscribe(roomId, socketName, waitForResponse = false) { + const msg = { + controller: "realtime", + action: "unsubscribe", + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + body: { roomId: roomId }, + }; const socket = this.sockets[socketName]; - if (! socket) { + if (!socket) { return; } @@ -126,7 +125,7 @@ class WebSocketApiBase extends ApiBase { return this.send(msg, waitForResponse, socketName); } - unsubscribeAll () { + unsubscribeAll() { const promises = []; for (const socketName of Object.keys(this.subscribedRooms)) { diff --git a/features-legacy/support/config.js b/features-legacy/support/config.js index 8fbc6496f8..2c00ff527d 100644 --- a/features-legacy/support/config.js +++ b/features-legacy/support/config.js @@ -1,16 +1,17 @@ -'use strict'; +"use strict"; -const rc = require('rc'); +const rc = require("rc"); -const kuzzleConfig = require('../../lib/config'); +const kuzzleConfig = require("../../lib/config"); -module.exports = rc('kuzzle', { - scheme: 'http', - host: 'localhost', +module.exports = rc("kuzzle", { + scheme: "http", + host: "localhost", port: 7512, services: { storageEngine: { - commonMapping: kuzzleConfig.loadConfig().services.storageEngine.commonMapping - } - } + commonMapping: + kuzzleConfig.loadConfig().services.storageEngine.commonMapping, + }, + }, }); diff --git a/features-legacy/support/env.js b/features-legacy/support/env.js index b3e80174b9..e35c50bd4c 100644 --- a/features-legacy/support/env.js +++ b/features-legacy/support/env.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; var configure = function () { this.setDefaultTimeout(30 * 1000); diff --git a/features-legacy/support/hooks.js b/features-legacy/support/hooks.js index 3ced86225f..941774e578 100644 --- a/features-legacy/support/hooks.js +++ b/features-legacy/support/hooks.js @@ -1,39 +1,47 @@ -'use strict'; +"use strict"; -const _ = require('lodash'); -const { After, Before, BeforeAll } = require('cucumber'); -const Bluebird = require('bluebird'); +const _ = require("lodash"); +const { After, Before, BeforeAll } = require("cucumber"); +const Bluebird = require("bluebird"); -const Http = require('./api/http'); -const World = require('./world'); +const Http = require("./api/http"); +const World = require("./world"); -function bootstrapDatabase () { - const - fixtures = require('../fixtures/functionalTestsFixtures.json'), +function bootstrapDatabase() { + const fixtures = require("../fixtures/functionalTestsFixtures.json"), promises = [], world = new World({ parameters: parseWorldParameters() }), http = new Http(world); for (const index of Object.keys(fixtures)) { - promises.push(() => http.deleteIndex(index) - .catch(() => true)); + promises.push(() => http.deleteIndex(index).catch(() => true)); } - const mappings = { dynamic: 'true', properties: { foo: { type: 'keyword' } } }; + const mappings = { + dynamic: "true", + properties: { foo: { type: "keyword" } }, + }; promises.push(() => http.createIndex(world.fakeIndex)); - promises.push(() => http.createCollection(world.fakeIndex, world.fakeCollection, mappings)); - promises.push(() => http.createCollection(world.fakeIndex, world.fakeAltCollection, mappings)); + promises.push(() => + http.createCollection(world.fakeIndex, world.fakeCollection, mappings) + ); + promises.push(() => + http.createCollection(world.fakeIndex, world.fakeAltCollection, mappings) + ); promises.push(() => http.createIndex(world.fakeAltIndex)); - promises.push(() => http.createCollection(world.fakeAltIndex, world.fakeCollection, mappings)); - promises.push(() => http.createCollection(world.fakeAltIndex, world.fakeAltCollection, mappings)); - - return Bluebird.each(promises, promise => promise()); + promises.push(() => + http.createCollection(world.fakeAltIndex, world.fakeCollection, mappings) + ); + promises.push(() => + http.createCollection(world.fakeAltIndex, world.fakeAltCollection, mappings) + ); + + return Bluebird.each(promises, (promise) => promise()); } -function cleanDatabase () { - const - promises = [], +function cleanDatabase() { + const promises = [], world = new World({ parameters: parseWorldParameters() }), http = new Http(world); @@ -41,10 +49,9 @@ function cleanDatabase () { world.fakeIndex, world.fakeAltIndex, world.fakeNewIndex, - 'tolkien' + "tolkien", ]) { - promises.push(http.deleteIndex(index) - .catch(() => true)); + promises.push(http.deleteIndex(index).catch(() => true)); } return Bluebird.all(promises); @@ -52,21 +59,23 @@ function cleanDatabase () { // before first BeforeAll(function () { - return cleanDatabase() - .then(() => bootstrapDatabase()); + return cleanDatabase().then(() => bootstrapDatabase()); }); Before({ timeout: 10 * 2000 }, function () { const world = new World({ parameters: parseWorldParameters() }); - return this.api.truncateCollection(world.fakeIndex, world.fakeCollection) + return this.api + .truncateCollection(world.fakeIndex, world.fakeCollection) .catch(() => {}) - .then(() => this.api.truncateCollection(world.fakeAltIndex, world.fakeAltCollection)) + .then(() => + this.api.truncateCollection(world.fakeAltIndex, world.fakeAltCollection) + ) .catch(() => {}) .then(() => this.api.resetSecurity()); }); -Before({ timeout: 10 * 2000, tags: '@resetDatabase' }, async function () { +Before({ timeout: 10 * 2000, tags: "@resetDatabase" }, async function () { await cleanDatabase(); await bootstrapDatabase(); }); @@ -75,45 +84,44 @@ After(function () { return this.api.disconnect(); }); -After({ tags: '@realtime' }, function () { - return this.api.unsubscribeAll() - .catch(() => true); +After({ tags: "@realtime" }, function () { + return this.api.unsubscribeAll().catch(() => true); }); -Before({ tags: '@security' }, function () { +Before({ tags: "@security" }, function () { return cleanSecurity.call(this); }); -Before({ tags: '@firstAdmin' }, function () { +Before({ tags: "@firstAdmin" }, function () { return cleanSecurity.call(this); }); -After({ tags: '@firstAdmin' }, function () { +After({ tags: "@firstAdmin" }, function () { return grantDefaultRoles.call(this).then(() => cleanSecurity.call(this)); }); -Before({ tags: '@redis' }, function () { +Before({ tags: "@redis" }, function () { return cleanRedis.call(this); }); -After({ tags: '@redis' }, function () { +After({ tags: "@redis" }, function () { return cleanRedis.call(this); }); -Before({ tags: '@validation' }, function () { +Before({ tags: "@validation" }, function () { return cleanValidations.call(this); }); -After({ tags: '@validation' }, function () { +After({ tags: "@validation" }, function () { return cleanValidations.call(this); }); -After({ tags: '@http' }, function () { - this.api.encode('identity'); - this.api.decode('identity'); +After({ tags: "@http" }, function () { + this.api.encode("identity"); + this.api.decode("identity"); }); -function cleanSecurity () { +function cleanSecurity() { if (this.currentUser) { delete this.currentUser; } @@ -121,19 +129,20 @@ function cleanSecurity () { return this.api.resetSecurity(); } -function grantDefaultRoles () { - return this.api.login('local', this.users.useradmin.credentials.local) - .then(body => { +function grantDefaultRoles() { + return this.api + .login("local", this.users.useradmin.credentials.local) + .then((body) => { if (body.error) { return Promise.reject(new Error(body.error.message)); } - if (! body.result) { - return Promise.reject(new Error('No result provided')); + if (!body.result) { + return Promise.reject(new Error("No result provided")); } - if (! body.result.jwt) { - return Promise.reject(new Error('No token received')); + if (!body.result.jwt) { + return Promise.reject(new Error("No token received")); } if (this.currentUser === null || this.currentUser === undefined) { @@ -143,47 +152,71 @@ function grantDefaultRoles () { this.currentToken = { jwt: body.result.jwt }; this.currentUser.token = body.result.jwt; - return this.api.createOrReplaceRole('anonymous', { controllers: { '*': { actions: { '*': true } } } }); + return this.api.createOrReplaceRole("anonymous", { + controllers: { "*": { actions: { "*": true } } }, + }); }) - .then(() => this.api.createOrReplaceRole('default', { controllers: { '*': { actions: { '*': true } } } })) - .then(() => this.api.createOrReplaceRole('admin', { controllers: { '*': { actions: { '*': true } } } })); + .then(() => + this.api.createOrReplaceRole("default", { + controllers: { "*": { actions: { "*": true } } }, + }) + ) + .then(() => + this.api.createOrReplaceRole("admin", { + controllers: { "*": { actions: { "*": true } } }, + }) + ); } -function cleanRedis () { - return this.api.callMemoryStorage('keys', { args: { pattern: this.idPrefix + '*' } }) - .then(response => { +function cleanRedis() { + return this.api + .callMemoryStorage("keys", { args: { pattern: this.idPrefix + "*" } }) + .then((response) => { if (_.isArray(response.result) && response.result.length) { - return this.api.callMemoryStorage('del', { body: { keys: response.result } }); + return this.api.callMemoryStorage("del", { + body: { keys: response.result }, + }); } return null; }); } -function cleanValidations () { - return this.api.searchSpecifications({ - query: { - match_all: { boost: 1 } - } - }) - .then(body => Bluebird.all(body.result.hits - .filter(r => r._id.match(/^kuzzle-test-/)) - .map(r => this.api.deleteSpecifications(r._id.split('#')[0], r._id.split('#')[1])) - )); +function cleanValidations() { + return this.api + .searchSpecifications({ + query: { + match_all: { boost: 1 }, + }, + }) + .then((body) => + Bluebird.all( + body.result.hits + .filter((r) => r._id.match(/^kuzzle-test-/)) + .map((r) => + this.api.deleteSpecifications( + r._id.split("#")[0], + r._id.split("#")[1] + ) + ) + ) + ); } -function parseWorldParameters () { - const worldParamIndex = process.argv.indexOf('--world-parameters'); - const worldParam = worldParamIndex > -1 - ? JSON.parse(process.argv[worldParamIndex + 1]) - : {}; - - const parameters = Object.assign({ - host: 'localhost', - port: 7512, - protocol: 'websocket', - silent: true, - }, worldParam); +function parseWorldParameters() { + const worldParamIndex = process.argv.indexOf("--world-parameters"); + const worldParam = + worldParamIndex > -1 ? JSON.parse(process.argv[worldParamIndex + 1]) : {}; + + const parameters = Object.assign( + { + host: "localhost", + port: 7512, + protocol: "websocket", + silent: true, + }, + worldParam + ); return parameters; } diff --git a/features-legacy/support/stepUtils.js b/features-legacy/support/stepUtils.js index b34b67a070..cb7d47b339 100644 --- a/features-legacy/support/stepUtils.js +++ b/features-legacy/support/stepUtils.js @@ -1,13 +1,13 @@ -'use strict'; +"use strict"; exports.getReturn = function () { - var - args = Array.prototype.slice.call(arguments), + var args = Array.prototype.slice.call(arguments), action = args.shift(), cb = args.pop(); - this.api[action].apply(this.api, args) - .then(response => { + this.api[action] + .apply(this.api, args) + .then((response) => { if (response.error) { this.result = response; return cb(); @@ -16,7 +16,7 @@ exports.getReturn = function () { this.result = response; cb(); }) - .catch(error => { + .catch((error) => { this.result = error; cb(); }); diff --git a/features-legacy/support/world.js b/features-legacy/support/world.js index fd87033938..cf4876a135 100644 --- a/features-legacy/support/world.js +++ b/features-legacy/support/world.js @@ -1,189 +1,192 @@ -'use strict'; +"use strict"; -const - { setWorldConstructor } = require('cucumber'), - HttpApi = require('./api/http'), - MqttApi = require('./api/mqtt'), - WebSocketApi = require('./api/websocket'); +const { setWorldConstructor } = require("cucumber"), + HttpApi = require("./api/http"), + MqttApi = require("./api/mqtt"), + WebSocketApi = require("./api/websocket"); -let - _init; +let _init; class KWorld { - constructor (config) { - this.config = Object.assign({ - protocol: 'websocket', - host: 'localhost', - port: 7512 - }, config.parameters); + constructor(config) { + this.config = Object.assign( + { + protocol: "websocket", + host: "localhost", + port: 7512, + }, + config.parameters + ); switch (this.config.protocol) { - case 'http': + case "http": this.api = new HttpApi(this); break; - case 'mqtt': + case "mqtt": this.api = new MqttApi(this); break; default: // websocket this.api = new WebSocketApi(this); - this.config.protocol = 'websocket'; + this.config.protocol = "websocket"; } - if (! _init && ! this.config.silent) { - console.log(`[${this.config.protocol}] ${this.config.host}:${this.config.port}`); + if (!_init && !this.config.silent) { + console.log( + `[${this.config.protocol}] ${this.config.host}:${this.config.port}` + ); _init = true; } - this.kuzzleConfig = require('../../lib/config').loadConfig(); - this.idPrefix = 'kuzzle-functional-tests-'; + this.kuzzleConfig = require("../../lib/config").loadConfig(); + this.idPrefix = "kuzzle-functional-tests-"; this.currentUser = null; // Fake values for test - this.fakeIndex = 'kuzzle-test-index'; - this.fakeAltIndex = 'kuzzle-test-index-alt'; - this.fakeNewIndex = 'kuzzle-test-index-new'; - this.fakeCollection = 'kuzzle-collection-test'; - this.fakeAltCollection = 'kuzzle-collection-test-alt'; + this.fakeIndex = "kuzzle-test-index"; + this.fakeAltIndex = "kuzzle-test-index-alt"; + this.fakeNewIndex = "kuzzle-test-index-new"; + this.fakeCollection = "kuzzle-collection-test"; + this.fakeAltCollection = "kuzzle-collection-test-alt"; this.documentGrace = { - firstName: 'Grace', - lastName: 'Hopper', + firstName: "Grace", + lastName: "Hopper", info: { age: 85, - city: 'NYC', - hobby: 'computer' + city: "NYC", + hobby: "computer", }, location: { lat: 32.692742, - lon: -97.114127 - } + lon: -97.114127, + }, }; this.documentAda = { - firstName: 'Ada', - lastName: 'Lovelace', + firstName: "Ada", + lastName: "Lovelace", info: { age: 36, - city: 'London', - hobby: 'computer' + city: "London", + hobby: "computer", }, location: { lat: 51.519291, - lon: -0.149817 - } + lon: -0.149817, + }, }; this.bulk = [ { index: { _id: 1 } }, - { title: 'foo' }, + { title: "foo" }, { index: { _id: 2 } }, - { title: 'bar' }, + { title: "bar" }, { update: { _id: 1 } }, - { doc: { title: 'foobar' } }, - { delete: { _id: 2 } } + { doc: { title: "foobar" } }, + { delete: { _id: 2 } }, ]; this.mapping = { properties: { firstName: { - type: 'text', - copy_to: 'newFirstName' + type: "text", + copy_to: "newFirstName", }, newFirstName: { - type: 'keyword', - store: true - } - } + type: "keyword", + store: true, + }, + }, }; this.securitymapping = { properties: { foo: { - type: 'text', - copy_to: 'bar' + type: "text", + copy_to: "bar", }, bar: { - type: 'keyword', - store: true - } - } + type: "keyword", + store: true, + }, + }, }; this.volatile = { - iwant: 'to break free', - we: ['will', 'rock', 'you'] + iwant: "to break free", + we: ["will", "rock", "you"], }; this.roles = { role1: { controllers: { - '*': { + "*": { actions: { - '*': true - } - } - } + "*": true, + }, + }, + }, }, role2: { controllers: { - 'document': { + document: { actions: { - '*': true - } + "*": true, + }, }, - 'auth': { actions: { logout: true } } - } + auth: { actions: { logout: true } }, + }, }, role3: { controllers: { - 'document': { + document: { actions: { - 'search': true - } + search: true, + }, }, - 'auth': { actions: { logout: true } } - } + auth: { actions: { logout: true } }, + }, }, foo: { controllers: { - 'foo': { + foo: { actions: { - '*': true - } - } - } + "*": true, + }, + }, + }, }, bar: { controllers: { - 'bar': { + bar: { actions: { - '*': true - } - } - } + "*": true, + }, + }, + }, }, foobar: { controllers: { - 'foo': { + foo: { actions: { - '*': true - } + "*": true, + }, }, - 'bar': { + bar: { actions: { - '*': true - } - } - } + "*": true, + }, + }, + }, }, admin: { controllers: { - '*': { + "*": { actions: { - '*': true - } - } - } + "*": true, + }, + }, + }, }, default: { controllers: { @@ -193,15 +196,15 @@ class KWorld { getCurrentUser: true, getMyRights: true, logout: true, - updateSelf: true - } + updateSelf: true, + }, }, server: { actions: { - info: true - } - } - } + info: true, + }, + }, + }, }, anonymous: { controllers: { @@ -210,230 +213,266 @@ class KWorld { checkToken: true, getCurrentUser: true, getMyRights: true, - login: true - } + login: true, + }, }, server: { actions: { - info: true - } - } - } - } + info: true, + }, + }, + }, + }, }; this.policies = { profile1: [ - { controller: '*', action: '*', index: '*', collection: '*', value: 'allowed' } + { + controller: "*", + action: "*", + index: "*", + collection: "*", + value: "allowed", + }, ], profile2: [ - { controller: '*', action: '*', index: this.fakeIndex, collection: '*', value: 'allowed' }, - { controller: 'document', action: '*', index: '*', collection: '*', value: 'allowed' }, - { controller: 'auth', action: 'logout', index: '*', collection: '*', value: 'allowed' } - ] + { + controller: "*", + action: "*", + index: this.fakeIndex, + collection: "*", + value: "allowed", + }, + { + controller: "document", + action: "*", + index: "*", + collection: "*", + value: "allowed", + }, + { + controller: "auth", + action: "logout", + index: "*", + collection: "*", + value: "allowed", + }, + ], }; this.profiles = { profile1: { - policies: [{ roleId: this.idPrefix + 'role1' }] + policies: [{ roleId: this.idPrefix + "role1" }], }, profile2: { policies: [ { - roleId: this.idPrefix + 'role1', - restrictedTo: [{ index: this.fakeIndex }] + roleId: this.idPrefix + "role1", + restrictedTo: [{ index: this.fakeIndex }], }, { - roleId: this.idPrefix + 'role2' - } - ] + roleId: this.idPrefix + "role2", + }, + ], }, profile3: { - policies: [{ - roleId: this.idPrefix + 'role2', - restrictedTo: [{ index: this.fakeAltIndex, collections: [this.fakeCollection] }] - }] + policies: [ + { + roleId: this.idPrefix + "role2", + restrictedTo: [ + { index: this.fakeAltIndex, collections: [this.fakeCollection] }, + ], + }, + ], }, profile4: { - policies: [{ - roleId: this.idPrefix + 'role3' - }] + policies: [ + { + roleId: this.idPrefix + "role3", + }, + ], }, profile5: { - policies: [{ - roleId: this.idPrefix + 'role3', - restrictedTo: [{ index: this.fakeIndex }] - }] + policies: [ + { + roleId: this.idPrefix + "role3", + restrictedTo: [{ index: this.fakeIndex }], + }, + ], }, profile6: { - policies: [{ - roleId: this.idPrefix + 'role3', - restrictedTo: [{ index: this.fakeIndex, collections: [this.fakeCollection] }] - }] + policies: [ + { + roleId: this.idPrefix + "role3", + restrictedTo: [ + { index: this.fakeIndex, collections: [this.fakeCollection] }, + ], + }, + ], }, invalidProfile: { - policies: [{ roleId: 'unexisting-role' }] + policies: [{ roleId: "unexisting-role" }], }, emptyProfile: { - policies: [] + policies: [], }, admin: { - policies: [{ roleId: 'admin' }] + policies: [{ roleId: "admin" }], }, adminfoo: { - policies: [{ roleId: 'admin' }, { roleId: this.idPrefix + 'foo' }] + policies: [{ roleId: "admin" }, { roleId: this.idPrefix + "foo" }], }, default: { - policies: [{ roleId: 'default' }] + policies: [{ roleId: "default" }], }, defaultfoo: { - policies: [{ roleId: 'default' }, { roleId: this.idPrefix + 'foo' }] + policies: [{ roleId: "default" }, { roleId: this.idPrefix + "foo" }], }, anonymous: { - policies: [{ roleId: 'anonymous' }] + policies: [{ roleId: "anonymous" }], }, anonymousfoo: { - policies: [{ roleId: 'anonymous' }, { roleId: this.idPrefix + 'foo' }] - } + policies: [{ roleId: "anonymous" }, { roleId: this.idPrefix + "foo" }], + }, }; this.users = { useradmin: { content: { name: { - first: 'David', - last: 'Bowie', - real: 'David Robert Jones' + first: "David", + last: "Bowie", + real: "David Robert Jones", }, - profileIds: ['admin'] + profileIds: ["admin"], }, credentials: { local: { - username: this.idPrefix + 'useradmin', - password: 'testpwd' - } - } + username: this.idPrefix + "useradmin", + password: "testpwd", + }, + }, }, user1: { content: { - profileIds: [this.idPrefix + 'profile1'] + profileIds: [this.idPrefix + "profile1"], }, credentials: { local: { - username: this.idPrefix + 'user1', - password: 'testpwd1' - } - } + username: this.idPrefix + "user1", + password: "testpwd1", + }, + }, }, user2: { content: { name: { - first: 'Steve', - last: 'Wozniak' + first: "Steve", + last: "Wozniak", }, - hobby: 'Segway Polo', - profileIds: [this.idPrefix + 'profile2'] + hobby: "Segway Polo", + profileIds: [this.idPrefix + "profile2"], }, credentials: { local: { - username: this.idPrefix + 'user2', - password: 'testpwd2' - } - } + username: this.idPrefix + "user2", + password: "testpwd2", + }, + }, }, user3: { content: { - profileIds: [this.idPrefix + 'profile3'] + profileIds: [this.idPrefix + "profile3"], }, credentials: { local: { - username: this.idPrefix + 'user3', - password: 'testpwd3' - } - } + username: this.idPrefix + "user3", + password: "testpwd3", + }, + }, }, user4: { content: { - profileIds: [this.idPrefix + 'profile4'] + profileIds: [this.idPrefix + "profile4"], }, credentials: { local: { - username: this.idPrefix + 'user4', - password: 'testpwd4' - } - } + username: this.idPrefix + "user4", + password: "testpwd4", + }, + }, }, user5: { content: { - profileIds: [this.idPrefix + 'profile5'] + profileIds: [this.idPrefix + "profile5"], }, - password: 'testpwd5', + password: "testpwd5", credentials: { local: { - username: this.idPrefix + 'user5', - password: 'testpwd5' - } - } + username: this.idPrefix + "user5", + password: "testpwd5", + }, + }, }, user6: { content: { - profileIds: [this.idPrefix + 'profile6'] + profileIds: [this.idPrefix + "profile6"], }, credentials: { local: { - username: this.idPrefix + 'user6', - password: 'testpwd6' - } - } + username: this.idPrefix + "user6", + password: "testpwd6", + }, + }, }, restricteduser1: { content: { name: { - first: 'Restricted', - last: 'User' - } + first: "Restricted", + last: "User", + }, }, credentials: { local: { - username: this.idPrefix + 'restricteduser1', - password: 'testpwd1' - } - } + username: this.idPrefix + "restricteduser1", + password: "testpwd1", + }, + }, }, nocredentialuser: { content: { name: { - first: 'Non Connectable', - last: 'User' + first: "Non Connectable", + last: "User", }, - profileIds: ['admin'] - } + profileIds: ["admin"], + }, }, unexistingprofile: { content: { name: { - first: 'John', - last: 'Doe' + first: "John", + last: "Doe", }, - profileIds: [this.idPrefix + 'i-dont-exist'] - } + profileIds: [this.idPrefix + "i-dont-exist"], + }, }, invalidprofileType: { content: { name: { - first: 'John', - last: 'Doe' + first: "John", + last: "Doe", }, - profileIds: [null] - } - } + profileIds: [null], + }, + }, }; this.credentials = { nocredentialuser: { - username: this.idPrefix + 'nocredentialuser', - password: 'testpwd1' - } + username: this.idPrefix + "nocredentialuser", + password: "testpwd1", + }, }; this.memoryStorageResult = null; From c646f6730e216d1e80ad5a6d4e1db148cf13f73f Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 20 Sep 2023 16:23:12 +0200 Subject: [PATCH 14/28] Update scrollId in features-legacy --- features-legacy/step_definitions/users.js | 2 +- features-legacy/step_definitions/validation.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features-legacy/step_definitions/users.js b/features-legacy/step_definitions/users.js index 94a9f139e9..71a52a8429 100644 --- a/features-legacy/step_definitions/users.js +++ b/features-legacy/step_definitions/users.js @@ -277,7 +277,7 @@ Given(/^A scrolled search on users$/, function () { throw new Error("No scrollId returned by the searchProfile query"); } - this.scrollId = response.result.scroll_id; + this.scrollId = response.result.scrollId; }); }); diff --git a/features-legacy/step_definitions/validation.js b/features-legacy/step_definitions/validation.js index 8146e74c6c..b4342ce93e 100644 --- a/features-legacy/step_definitions/validation.js +++ b/features-legacy/step_definitions/validation.js @@ -240,7 +240,7 @@ Then( ); } - this.scrollId = response.result.scroll_id; + this.scrollId = response.result.scrollId; callbackAsync(); }) .catch((err) => callbackAsync(err)); From 20eaa6d4bdbc4c70e1740359cbbad4ea86c1987d Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 21 Sep 2023 11:54:14 +0200 Subject: [PATCH 15/28] Taking time to make sonarcloud happy --- lib/service/storage/elasticsearch.ts | 228 +++++++++++++++------------ lib/types/storage/Elasticsearch.ts | 4 +- 2 files changed, 132 insertions(+), 100 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 08f562f956..6f63c17a84 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -289,8 +289,8 @@ export default class ElasticSearch extends Service { const infos = indiceInfo as any; // Ignore non-Kuzzle indices if ( - indice[INDEX_PREFIX_POSITION_IN_INDICE] !== PRIVATE_PREFIX && - indice[INDEX_PREFIX_POSITION_IN_INDICE] !== PUBLIC_PREFIX + !indice.startsWith(PRIVATE_PREFIX) && + !indice.startsWith(PUBLIC_PREFIX) ) { continue; } @@ -662,7 +662,7 @@ export default class ElasticSearch extends Service { * * @returns {Promise.<{ items: Array<{ _id, _source, _version }>, errors }>} */ - async mGet(index, collection, ids) { + async mGet(index: string, collection: string, ids: string[]) { if (ids.length === 0) { return { errors: [], item: [] }; } @@ -689,9 +689,7 @@ export default class ElasticSearch extends Service { const errors = []; const items = []; - for (let i = 0; i < body.docs.length; i++) { - const doc = body.docs[i]; - + for (const doc of body.docs) { if (doc.found) { items.push({ _id: doc._id, @@ -715,7 +713,7 @@ export default class ElasticSearch extends Service { * * @returns {Promise.} count */ - async count(index, collection, searchBody = {}) { + async count(index: string, collection: string, searchBody = {}) { const esRequest = { body: this._sanitizeSearchBody(searchBody), index: this._getAlias(index, collection), @@ -1284,9 +1282,7 @@ export default class ElasticSearch extends Service { const documents = await this._getAllDocumentsFromQuery(esRequest); - for (let i = 0; i < documents.length; i++) { - const document = documents[i]; - + for (const document of documents) { document._source = undefined; document.body = changes; } @@ -1406,7 +1402,7 @@ export default class ElasticSearch extends Service { size?: number; scrollTTl?: string; } = {} - ) { + ): Promise { const esRequest: RequestParams.Search = { body: this._sanitizeSearchBody({ query }), from: 0, @@ -1938,7 +1934,6 @@ export default class ElasticSearch extends Service { } = {} ) { const alias = this._getAlias(index, collection); - const actionNames = ["index", "create", "update", "delete"]; const dateNow = Date.now(); const esRequest = { body: documents, @@ -1961,37 +1956,7 @@ export default class ElasticSearch extends Service { assertWellFormedRefresh(esRequest); this._scriptCheck(documents); - let lastAction; // NOSONAR - - /** - * @warning Critical code section - * - * bulk body can contain more than 10K elements - */ - for (let i = 0; i < esRequest.body.length; i++) { - const item = esRequest.body[i]; - const action = Object.keys(item)[0]; - - if (actionNames.indexOf(action) !== -1) { - lastAction = action; - - item[action]._index = alias; - - if (item[action]._type) { - item[action]._type = undefined; - } - } else if (lastAction === "index" || lastAction === "create") { - item._kuzzle_info = kuzzleMeta.created; - } else if (lastAction === "update") { - // we can only update metadata on a partial update, or on an upsert - for (const prop of ["doc", "upsert"]) { - if (isPlainObject(item[prop])) { - item[prop]._kuzzle_info = kuzzleMeta.updated; - } - } - } - } - /* end critical code section */ + this._setLastActionToKuzzleMeta(esRequest, alias, kuzzleMeta); let response: Record; @@ -2423,12 +2388,16 @@ export default class ElasticSearch extends Service { async mCreate( index: string, collection: string, - documents: string[], + documents: JSON[], { refresh, timeout, userId = null, - }: { refresh?: string; timeout?: number; userId?: string } = {} + }: { + refresh?: boolean | "wait_for"; + timeout?: string; + userId?: string; + } = {} ) { const alias = this._getAlias(index, collection), kuzzleMeta = { @@ -2696,9 +2665,9 @@ export default class ElasticSearch extends Service { timeout, userId = null, }: { - refresh?: string; + refresh?: boolean | "wait_for"; retryOnConflict?: number; - timeout?: number; + timeout?: string; userId?: string; } = {} ) { @@ -2804,8 +2773,8 @@ export default class ElasticSearch extends Service { timeout, userId = null, }: { - refresh?: string; - timeout?: number; + refresh?: boolean | "wait_for"; + timeout?: string; userId?: string; } = {} ) { @@ -2850,7 +2819,7 @@ export default class ElasticSearch extends Service { const document = extractedDocuments[i]; // Documents are retrieved in the same order than we got them from user - if (existingDocuments[i] && existingDocuments[i].found) { + if (existingDocuments[i]?.found) { esRequest.body.push({ index: { _id: document._id, @@ -2972,19 +2941,13 @@ export default class ElasticSearch extends Service { * @returns {Promise.} results */ async _mExecute( - esRequest, - documents, - partialErrors, + esRequest: RequestParams.Bulk, + documents: JSONObject[], + partialErrors: JSONObject[] = [], { limits = true, source = true } = {} ) { assertWellFormedRefresh(esRequest); - - if ( - limits && - documents.length > global.kuzzle.config.limits.documentsWriteCount - ) { - return kerror.reject("services", "storage", "write_limit_exceeded"); - } + assertLimitNotExceeded(limits, documents); let response = { body: { items: [] } }; @@ -3058,8 +3021,8 @@ export default class ElasticSearch extends Service { * @returns {Object} { rejected, extractedDocuments, documentsToGet } */ _extractMDocuments( - documents, - metadata, + documents: JSONObject[], + metadata: JSONObject, { prepareMGet = false, requireId = false, prepareMUpsert = false } = {} ) { const rejected = []; @@ -3072,7 +3035,7 @@ export default class ElasticSearch extends Service { * request can contain more than 10K elements */ for (let i = 0; i < documents.length; i++) { - const document = documents[i]; + const document = documents[i].length; if (!isPlainObject(document.body) && !prepareMUpsert) { rejected.push({ @@ -3103,45 +3066,63 @@ export default class ElasticSearch extends Service { status: 400, }); } else { - let extractedDocument; - if (prepareMUpsert) { - extractedDocument = { - _source: { - // Do not use destructuring, it's 10x slower - changes: Object.assign({}, metadata.doc, document.changes), - default: Object.assign( - {}, - metadata.upsert, - document.changes, - document.default - ), - }, - }; - } else { - extractedDocument = { - // Do not use destructuring, it's 10x slower - _source: Object.assign({}, metadata, document.body), - }; - } - - if (document._id) { - extractedDocument._id = document._id; - } - - extractedDocuments.push(extractedDocument); - - if (prepareMGet && typeof document._id === "string") { - documentsToGet.push({ - _id: document._id, - _source: false, - }); - } + this._processExtract( + prepareMUpsert, + prepareMGet, + metadata, + document, + extractedDocuments, + documentsToGet + ); } } /* end critical code section */ return { documentsToGet, extractedDocuments, rejected }; } + private _processExtract( + prepareMUpsert: boolean, + prepareMGet: boolean, + metadata: JSONObject, + document: JSONObject, + extractedDocuments: JSONObject[], + documentsToGet: JSONObject[] + ) { + let extractedDocument; + + if (prepareMUpsert) { + extractedDocument = { + _source: { + // Do not use destructuring, it's 10x slower + changes: Object.assign({}, metadata.doc, document.changes), + default: Object.assign( + {}, + metadata.upsert, + document.changes, + document.default + ), + }, + }; + } else { + extractedDocument = { + // Do not use destructuring, it's 10x slower + _source: Object.assign({}, metadata, document.body), + }; + } + + if (document._id) { + extractedDocument._id = document._id; + } + + extractedDocuments.push(extractedDocument); + + if (prepareMGet && typeof document._id === "string") { + documentsToGet.push({ + _id: document._id, + _source: false, + }); + } + } /** * Throws an error if the provided mapping is invalid @@ -3149,7 +3130,7 @@ export default class ElasticSearch extends Service { * @param {Object} mapping * @throws */ - _checkMappings(mapping, path = [], check = true) { + _checkMappings(mapping: JSONObject, path = [], check = true) { const properties = Object.keys(mapping); const mappingProperties = path.length === 0 @@ -3172,7 +3153,7 @@ export default class ElasticSearch extends Service { if (property === "properties") { // type definition level, we don't check this._checkMappings(mapping[property], [...path, "properties"], false); - } else if (mapping[property] && mapping[property].properties) { + } else if (mapping[property]?.properties) { // root properties level, check for "properties", "dynamic" and "_meta" this._checkMappings(mapping[property], [...path, property], true); } @@ -3731,6 +3712,48 @@ export default class ElasticSearch extends Service { } } } + + _setLastActionToKuzzleMeta( + esRequest: JSONObject, + alias: string, + kuzzleMeta: JSONObject + ) { + /** + * @warning Critical code section + * + * bulk body can contain more than 10K elements + */ + let lastAction = ""; + const actionNames = ["index", "create", "update", "delete"]; + + for (let i = 0; i < esRequest.body.length; i++) { + const item = esRequest.body[i]; + const action = Object.keys(item)[0]; + + if (actionNames.indexOf(action) !== -1) { + lastAction = action; + + item[action]._index = alias; + + if (item[action]?._type) { + item[action]._type = undefined; + } + } else if (lastAction === "index" || lastAction === "create") { + item._kuzzle_info = kuzzleMeta.created; + } else if (lastAction === "update") { + this._setLastActionToKuzzleMetaUpdate(item, kuzzleMeta); + } + } + /* end critical code section */ + } + + _setLastActionToKuzzleMetaUpdate(item: JSONObject, kuzzleMeta: JSONObject) { + for (const prop of ["doc", "upsert"]) { + if (isPlainObject(item[prop])) { + item[prop]._kuzzle_info = kuzzleMeta.updated; + } + } + } } /** @@ -3788,6 +3811,15 @@ function assertWellFormedRefresh(esRequest) { } } +function assertLimitNotExceeded(limits: boolean, documents: JSONObject[]) { + if ( + limits && + documents.length > global.kuzzle.config.limits.documentsWriteCount + ) { + throw kerror.reject("services", "storage", "write_limit_exceeded"); + } +} + function getKuid(userId: string): string | null { if (!userId) { return null; diff --git a/lib/types/storage/Elasticsearch.ts b/lib/types/storage/Elasticsearch.ts index 35fae4816b..f90a9a35c4 100644 --- a/lib/types/storage/Elasticsearch.ts +++ b/lib/types/storage/Elasticsearch.ts @@ -33,8 +33,8 @@ export type KImportError = { }; export type KRequestParams = { - refresh?: string; - timeout?: number; + refresh?: boolean | "wait_for"; + timeout?: string; userId?: string; injectKuzzleMeta?: boolean; limits?: boolean; From 0d4130520a930df8d0639bdd86959700b32bf107 Mon Sep 17 00:00:00 2001 From: rolljee Date: Thu, 21 Sep 2023 12:18:06 +0200 Subject: [PATCH 16/28] Mistake where made --- lib/service/storage/elasticsearch.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 6f63c17a84..04cddd2507 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -2947,7 +2947,10 @@ export default class ElasticSearch extends Service { { limits = true, source = true } = {} ) { assertWellFormedRefresh(esRequest); - assertLimitNotExceeded(limits, documents); + + if (this._hasExceededLimit(limits, documents)) { + return kerror.reject("services", "storage", "write_limit_exceeded"); + } let response = { body: { items: [] } }; @@ -3035,7 +3038,7 @@ export default class ElasticSearch extends Service { * request can contain more than 10K elements */ for (let i = 0; i < documents.length; i++) { - const document = documents[i].length; + const document = documents[i]; if (!isPlainObject(document.body) && !prepareMUpsert) { rejected.push({ @@ -3080,6 +3083,14 @@ export default class ElasticSearch extends Service { return { documentsToGet, extractedDocuments, rejected }; } + + private _hasExceededLimit(limits: boolean, documents: JSONObject[]) { + return ( + limits && + documents.length > global.kuzzle.config.limits.documentsWriteCount + ); + } + private _processExtract( prepareMUpsert: boolean, prepareMGet: boolean, @@ -3811,15 +3822,6 @@ function assertWellFormedRefresh(esRequest) { } } -function assertLimitNotExceeded(limits: boolean, documents: JSONObject[]) { - if ( - limits && - documents.length > global.kuzzle.config.limits.documentsWriteCount - ) { - throw kerror.reject("services", "storage", "write_limit_exceeded"); - } -} - function getKuid(userId: string): string | null { if (!userId) { return null; From 677c6869994fd60cb43445623459cb29ff967f70 Mon Sep 17 00:00:00 2001 From: rolljee Date: Mon, 25 Sep 2023 10:02:11 +0200 Subject: [PATCH 17/28] Sonarlint --- lib/service/storage/elasticsearch.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 04cddd2507..55584804cf 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -1980,7 +1980,7 @@ export default class ElasticSearch extends Service { * * bulk body can contain more than 10K elements */ - for (let i = 0; i < body.items.length; i++) { + for (let i = 0; i < body.items.length; i++) { //NOSONAR const row = body.items[i]; const action = Object.keys(row)[0]; const item = row[action]; @@ -2318,7 +2318,7 @@ export default class ElasticSearch extends Service { const errors = []; const items = []; - for (let i = 0; i < body.docs.length; i++) { + for (let i = 0; i < body.docs.length; i++) { //NOSONAR const doc = body.docs[i]; if (doc.found) { @@ -2530,7 +2530,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { + for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR esRequest.body.push({ index: { _id: extractedDocuments[i]._id, @@ -2594,7 +2594,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { + for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR const extractedDocument = extractedDocuments[i]; if (typeof extractedDocument._id === "string") { @@ -2709,7 +2709,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { + for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR esRequest.body.push( { update: { @@ -2877,7 +2877,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < ids.length; i++) { + for (let i = 0; i < ids.length; i++) { //NOSONAR const _id = ids[i]; if (typeof _id === "string") { @@ -2902,7 +2902,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < validIds.length; i++) { + for (let i = 0; i < validIds.length; i++) { //NOSONAR const validId = validIds[i]; const item = items[idx]; @@ -3037,7 +3037,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < documents.length; i++) { + for (let i = 0; i < documents.length; i++) { //NOSONAR const document = documents[i]; if (!isPlainObject(document.body) && !prepareMUpsert) { @@ -3105,8 +3105,8 @@ export default class ElasticSearch extends Service { extractedDocument = { _source: { // Do not use destructuring, it's 10x slower - changes: Object.assign({}, metadata.doc, document.changes), - default: Object.assign( + changes: Object.assign({}, metadata.doc, document.changes), //NOSONAR + default: Object.assign( //NOSONAR {}, metadata.upsert, document.changes, @@ -3117,7 +3117,7 @@ export default class ElasticSearch extends Service { } else { extractedDocument = { // Do not use destructuring, it's 10x slower - _source: Object.assign({}, metadata, document.body), + _source: Object.assign({}, metadata, document.body), //NOSONAR }; } @@ -3253,7 +3253,7 @@ export default class ElasticSearch extends Service { index: string, collection: string ): Promise { - let indice = this._getAlias(index, collection).substr( + let indice = this._getAlias(index, collection).substring( INDEX_PREFIX_POSITION_IN_ALIAS ); @@ -3270,7 +3270,7 @@ export default class ElasticSearch extends Service { if (overflow > 0) { const indiceBuffer = Buffer.from(indice); indice = indiceBuffer - .slice(0, indiceBuffer.length - overflow) + .subarray(0, indiceBuffer.length - overflow) .toString(); } @@ -3737,7 +3737,7 @@ export default class ElasticSearch extends Service { let lastAction = ""; const actionNames = ["index", "create", "update", "delete"]; - for (let i = 0; i < esRequest.body.length; i++) { + for (let i = 0; i < esRequest.body.length; i++) { //NOSONAR const item = esRequest.body[i]; const action = Object.keys(item)[0]; From 6128d70273e8063284fe473bcc7ed371748ab8b9 Mon Sep 17 00:00:00 2001 From: rolljee Date: Mon, 25 Sep 2023 10:35:11 +0200 Subject: [PATCH 18/28] Update types for linting and sonar --- lib/service/storage/elasticsearch.ts | 30 +++++++++++++++------------- lib/types/storage/Elasticsearch.ts | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index 55584804cf..4d454620bb 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -1872,7 +1872,7 @@ export default class ElasticSearch extends Service { * * @returns {Promise} */ - async truncateCollection(index, collection) { + async truncateCollection(index: string, collection: string) { let mappings; let settings; @@ -1980,7 +1980,7 @@ export default class ElasticSearch extends Service { * * bulk body can contain more than 10K elements */ - for (let i = 0; i < body.items.length; i++) { //NOSONAR + for (let i = 0; i < body.items.length; i++) { const row = body.items[i]; const action = Object.keys(row)[0]; const item = row[action]; @@ -2318,7 +2318,7 @@ export default class ElasticSearch extends Service { const errors = []; const items = []; - for (let i = 0; i < body.docs.length; i++) { //NOSONAR + for (let i = 0; i < body.docs.length; i++) { const doc = body.docs[i]; if (doc.found) { @@ -2530,7 +2530,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR + for (let i = 0; i < extractedDocuments.length; i++) { esRequest.body.push({ index: { _id: extractedDocuments[i]._id, @@ -2594,7 +2594,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR + for (let i = 0; i < extractedDocuments.length; i++) { const extractedDocument = extractedDocuments[i]; if (typeof extractedDocument._id === "string") { @@ -2709,7 +2709,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR + for (let i = 0; i < extractedDocuments.length; i++) { esRequest.body.push( { update: { @@ -2877,7 +2877,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < ids.length; i++) { //NOSONAR + for (let i = 0; i < ids.length; i++) { const _id = ids[i]; if (typeof _id === "string") { @@ -2902,7 +2902,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < validIds.length; i++) { //NOSONAR + for (let i = 0; i < validIds.length; i++) { const validId = validIds[i]; const item = items[idx]; @@ -3037,7 +3037,7 @@ export default class ElasticSearch extends Service { * * request can contain more than 10K elements */ - for (let i = 0; i < documents.length; i++) { //NOSONAR + for (let i = 0; i < documents.length; i++) { const document = documents[i]; if (!isPlainObject(document.body) && !prepareMUpsert) { @@ -3105,8 +3105,8 @@ export default class ElasticSearch extends Service { extractedDocument = { _source: { // Do not use destructuring, it's 10x slower - changes: Object.assign({}, metadata.doc, document.changes), //NOSONAR - default: Object.assign( //NOSONAR + changes: Object.assign({}, metadata.doc, document.changes), + default: Object.assign( {}, metadata.upsert, document.changes, @@ -3117,7 +3117,7 @@ export default class ElasticSearch extends Service { } else { extractedDocument = { // Do not use destructuring, it's 10x slower - _source: Object.assign({}, metadata, document.body), //NOSONAR + _source: Object.assign({}, metadata, document.body), }; } @@ -3233,7 +3233,9 @@ export default class ElasticSearch extends Service { * @return {Promise<*>} the settings of the indice. * @private */ - async _getSettings(esRequest: RequestParams.IndicesGetSettings) { + async _getSettings( + esRequest: RequestParams.IndicesGetSettings + ): Promise { const response = await this._client.indices.getSettings(esRequest); const index = esRequest.index as string; @@ -3737,7 +3739,7 @@ export default class ElasticSearch extends Service { let lastAction = ""; const actionNames = ["index", "create", "update", "delete"]; - for (let i = 0; i < esRequest.body.length; i++) { //NOSONAR + for (let i = 0; i < esRequest.body.length; i++) { const item = esRequest.body[i]; const action = Object.keys(item)[0]; diff --git a/lib/types/storage/Elasticsearch.ts b/lib/types/storage/Elasticsearch.ts index f90a9a35c4..9a1f2adf3d 100644 --- a/lib/types/storage/Elasticsearch.ts +++ b/lib/types/storage/Elasticsearch.ts @@ -19,7 +19,7 @@ export type KRequestBody = T & { }; export interface JSONObject { - [key: string]: JSONObject | any; + [key: string]: any; } export type KImportError = { From ad722c35bbc87de5c72262b1cc3c1677e2e6017d Mon Sep 17 00:00:00 2001 From: rolljee Date: Mon, 25 Sep 2023 12:04:49 +0200 Subject: [PATCH 19/28] Uncomment lines --- docker-compose.yml | 4 ++-- docker/nginx-dev/kuzzle.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 070b9ac6a0..cc728bf312 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,8 +48,8 @@ services: container_name: kuzzle_nginx depends_on: - kuzzle_node_1 - # - kuzzle_node_2 - # - kuzzle_node_3 + - kuzzle_node_2 + - kuzzle_node_3 ports: - '7512:7512' volumes: diff --git a/docker/nginx-dev/kuzzle.conf b/docker/nginx-dev/kuzzle.conf index 0b042dda03..ab3dc5fbe2 100644 --- a/docker/nginx-dev/kuzzle.conf +++ b/docker/nginx-dev/kuzzle.conf @@ -5,8 +5,8 @@ map $http_upgrade $connection_upgrade { upstream kuzzle { server kuzzle_node_1:7512; - # server kuzzle_node_2:7512; - # server kuzzle_node_3:7512; + server kuzzle_node_2:7512; + server kuzzle_node_3:7512; } server { From bf2e080eba7d8d068608c0a527349d411e947712 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 11:50:23 +0100 Subject: [PATCH 20/28] Update classname to avoid modifying thing that don't need to --- test/mocks/elasticsearch.mock.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/mocks/elasticsearch.mock.js b/test/mocks/elasticsearch.mock.js index 577fccd882..4c963a7107 100644 --- a/test/mocks/elasticsearch.mock.js +++ b/test/mocks/elasticsearch.mock.js @@ -1,9 +1,9 @@ "use strict"; const sinon = require("sinon"); -const ElasticSearch = require("../../lib/service/storage/elasticsearch"); +const Elasticsearch = require("../../lib/service/storage/elasticsearch"); -class ElasticsearchMock extends ElasticSearch { +class ElasticsearchMock extends Elasticsearch { constructor(kuzzle, config, scope) { super(kuzzle, config, scope); From f8b14638520c86133262674f5dee1f031bbfed25 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:06:09 +0100 Subject: [PATCH 21/28] Revert some changes --- .ci/scripts/run-monkey-tests.sh | 2 +- .ci/scripts/run-test-cluster.sh | 2 +- .github/actions/dockerhub/action.yml | 2 +- .github/workflows/workflow-deployments.yaml | 2 +- lib/core/storage/clientAdapter.js | 52 ++++++++++----------- package.json | 24 +++++----- 6 files changed, 43 insertions(+), 41 deletions(-) diff --git a/.ci/scripts/run-monkey-tests.sh b/.ci/scripts/run-monkey-tests.sh index 3762d043bc..0c77e522f4 100755 --- a/.ci/scripts/run-monkey-tests.sh +++ b/.ci/scripts/run-monkey-tests.sh @@ -18,7 +18,7 @@ then docker-compose -f ./.ci/test-cluster.yml run kuzzle_node_1 npm rebuild fi -npm run build +npm run build-ts echo "[$(date)] - Starting Kuzzle Cluster..." diff --git a/.ci/scripts/run-test-cluster.sh b/.ci/scripts/run-test-cluster.sh index df57f99bcd..50836b7808 100755 --- a/.ci/scripts/run-test-cluster.sh +++ b/.ci/scripts/run-test-cluster.sh @@ -19,7 +19,7 @@ then docker-compose -f ./.ci/test-cluster.yml run kuzzle_node_1 npm rebuild fi -npm run build +npm run build-ts echo "[$(date)] - Starting Kuzzle Cluster..." diff --git a/.github/actions/dockerhub/action.yml b/.github/actions/dockerhub/action.yml index 432fe19a67..8108b88295 100644 --- a/.github/actions/dockerhub/action.yml +++ b/.github/actions/dockerhub/action.yml @@ -18,7 +18,7 @@ runs: - name: Create JS from TS files run: | npm install - npm run build + npm run build-ts shell: bash - name: Build and deploy Docker images run: | diff --git a/.github/workflows/workflow-deployments.yaml b/.github/workflows/workflow-deployments.yaml index 55a0e0ce7b..8601f2c366 100644 --- a/.github/workflows/workflow-deployments.yaml +++ b/.github/workflows/workflow-deployments.yaml @@ -121,7 +121,7 @@ jobs: - name: Build TS files run: | npm install - npm run build + npm run build-ts - name: Build and push uses: docker/build-push-action@v2 with: diff --git a/lib/core/storage/clientAdapter.js b/lib/core/storage/clientAdapter.js index 6362c2d465..a6712e8ff7 100644 --- a/lib/core/storage/clientAdapter.js +++ b/lib/core/storage/clientAdapter.js @@ -21,7 +21,7 @@ "use strict"; -const ElasticSearch = require("../../service/storage/elasticsearch"); +const Elasticsearch = require("../../service/storage/elasticsearch"); const { IndexCache } = require("./indexCache"); const { isPlainObject } = require("../../util/safeObject"); const kerror = require("../../kerror"); @@ -38,7 +38,7 @@ class ClientAdapter { * @param {storeScopeEnum} scope */ constructor(scope) { - this.client = new ElasticSearch( + this.client = new Elasticsearch( global.kuzzle.config.services.storageEngine, scope ); @@ -74,10 +74,10 @@ class ClientAdapter { ); /** - * Translate Koncorde filters to ElasticSearch query + * Translate Koncorde filters to Elasticsearch query * * @param {Object} koncordeFilters - Set of valid Koncorde filters - * @returns {Object} Equivalent ElasticSearch query + * @returns {Object} Equivalent Elasticsearch query */ global.kuzzle.onAsk(`core:storage:${this.scope}:translate`, (filters) => this.client.translateKoncordeFilters(filters) @@ -362,7 +362,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} bulk data, in ES format - * @param {Object} [opts] -- see ElasticSearch "import" options + * @param {Object} [opts] -- see Elasticsearch "import" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -395,7 +395,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} content - * @param {Object} [opts] -- see ElasticSearch "create" options + * @param {Object} [opts] -- see Elasticsearch "create" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -413,7 +413,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content - * @param {Object} [opts] -- see ElasticSearch "createOrReplace" options + * @param {Object} [opts] -- see Elasticsearch "createOrReplace" options * @returns {Promise.<{ _id, _version, _source, created }>} */ global.kuzzle.onAsk( @@ -436,7 +436,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {string} id - * @param {Object} [opts] -- see ElasticSearch "delete" options + * @param {Object} [opts] -- see Elasticsearch "delete" options * @returns {Promise} */ global.kuzzle.onAsk( @@ -453,7 +453,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} query - * @param {Object} [opts] -- see ElasticSearch "deleteByQuery" options + * @param {Object} [opts] -- see Elasticsearch "deleteByQuery" options * @returns {Promise.<{ documents, total, deleted, failures: [ _shardId, reason ] }>} */ global.kuzzle.onAsk( @@ -471,7 +471,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id * @param {Array} fields -- fields to delete - * @param {Object} [opts] -- see ElasticSearch "deleteFields" options + * @param {Object} [opts] -- see Elasticsearch "deleteFields" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -546,7 +546,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see ElasticSearch "mCreate" options + * @param {Object} [opts] -- see Elasticsearch "mCreate" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -563,7 +563,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see ElasticSearch "mCreateOrReplace" options + * @param {Object} [opts] -- see Elasticsearch "mCreateOrReplace" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -580,7 +580,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {string[]} ids - * @param {Object} [opts] -- see ElasticSearch "mDelete" options + * @param {Object} [opts] -- see Elasticsearch "mDelete" options * @returns {Promise.<{ documents, errors }> */ global.kuzzle.onAsk( @@ -597,7 +597,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see ElasticSearch "mReplace" options + * @param {Object} [opts] -- see Elasticsearch "mReplace" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -614,7 +614,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see ElasticSearch "mUpdate" options + * @param {Object} [opts] -- see Elasticsearch "mUpdate" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -632,7 +632,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object[]} documents - * @param {Object} [opts] -- see ElasticSearch "mUpsert" options + * @param {Object} [opts] -- see Elasticsearch "mUpsert" options * @returns {Promise.<{ items, errors }> */ global.kuzzle.onAsk( @@ -650,7 +650,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query (ES format) * @param {Function} callback -- callback applied to matched documents - * @param {Object} [opts] -- see ElasticSearch "mExecute" options + * @param {Object} [opts] -- see Elasticsearch "mExecute" options * @returns {Promise.} Array of results returned by the callback */ global.kuzzle.onAsk( @@ -684,7 +684,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id * @param {Object} content -- new document content - * @param {Object} [opts] -- see ElasticSearch "replace" options + * @param {Object} [opts] -- see Elasticsearch "replace" options * @returns {Promise.<{ _id, _version, _source }>} */ global.kuzzle.onAsk( @@ -699,7 +699,7 @@ class ClientAdapter { * Fetch the next page of results of a search query * * @param {string} scrollId - * @param {Object} [opts] -- see ElasticSearch "scroll" options + * @param {Object} [opts] -- see Elasticsearch "scroll" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -713,7 +713,7 @@ class ClientAdapter { * @param {string} index * @param {string} collection * @param {Object} searchBody -- search query, in ES format - * @param {Object} [opts] -- see ElasticSearch "search" options + * @param {Object} [opts] -- see Elasticsearch "search" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -729,7 +729,7 @@ class ClientAdapter { * * @param {Object[]} targets * @param {Object} searchBody -- search query, in ES format - * @param {Object} [opts] -- see ElasticSearch "search" options + * @param {Object} [opts] -- see Elasticsearch "search" options * @returns {Promise.<{ scrollId, hits, aggregations, total }>} */ global.kuzzle.onAsk( @@ -752,7 +752,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content -- partial content to update - * @param {Object} [opts] -- see ElasticSearch "update" options + * @param {Object} [opts] -- see Elasticsearch "update" options * @returns {Promise.<{ _id, _version }>} */ global.kuzzle.onAsk( @@ -771,7 +771,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query, in ES format * @param {Object} changes -- partial changes to apply to matched documents - * @param {Object} [opts] -- see ElasticSearch "updateByQuery" options + * @param {Object} [opts] -- see Elasticsearch "updateByQuery" options * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ global.kuzzle.onAsk( @@ -796,7 +796,7 @@ class ClientAdapter { * @param {string} collection * @param {Object} query -- search query, in ES format * @param {Object} changes -- partial changes to apply to matched documents - * @param {Object} [opts] -- see ElasticSearch "updateByQuery" options + * @param {Object} [opts] -- see Elasticsearch "updateByQuery" options * @returns {Promise.<{ successes: [_id, _source, _status], errors: [ document, status, reason ] }>} */ global.kuzzle.onAsk( @@ -821,7 +821,7 @@ class ClientAdapter { * @param {string} collection * @param {string} id -- document unique identifier * @param {Object} content -- partial content to update - * @param {Object} [opts] -- see ElasticSearch "upsert" options + * @param {Object} [opts] -- see Elasticsearch "upsert" options * @returns {Promise.<{ _id, _version }>} */ global.kuzzle.onAsk( @@ -839,7 +839,7 @@ class ClientAdapter { * * @param {string} index * @param {string} collection - * @param {Object} [opts] -- see ElasticSearch "getMapping" options + * @param {Object} [opts] -- see Elasticsearch "getMapping" options * * @returns {Promise.<{ dynamic, _meta, properties }>} */ diff --git a/package.json b/package.json index 2099aa61cc..b12d2422e2 100644 --- a/package.json +++ b/package.json @@ -5,28 +5,30 @@ "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.", "bin": "bin/start-kuzzle-server", "scripts": { - "build": "tsc", + "build-ts": "tsc", + "build": "npm run build-ts", "clean": "touch index.ts && npm run build | grep TSFILE | cut -d' ' -f 2 | xargs rm", "codecov": "codecov", "cucumber": "cucumber.js --fail-fast", "dev:test": "npm run dev -- docker/scripts/start-kuzzle-test.ts --enable-plugins functional-test-plugin", - "dev": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", + "dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", "doc-error-codes": "node -r ts-node/register doc/build-error-codes", "docker:install": "docker-compose run kuzzle_node_1 npm install", "docker:npm": "docker-compose run kuzzle_node_1 npm run --", "docker:test:unit": "docker-compose run kuzzle_node_1 npm run test:unit", "docker": "docker-compose run kuzzle_node_1 ", - "file": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", + "file": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json", "prepublishOnly": "npm run build", - "prettier": "prettier ./lib ./test ./bin ./features ./plugins/available/functional-test-plugin --write", - "start:dev": "ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin", + "prettier": "npx prettier ./lib ./test ./bin ./features ./plugins/available/functional-test-plugin --write", + "services": "npx kourou app:start-services", + "start:dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin", "test:functional:http": "KUZZLE_PROTOCOL=http cucumber-js --profile http", "test:functional:jest": "npm run test:jest", - "test:functional:legacy:http": "cucumber-js --format progress-bar --profile http ./features-legacy", - "test:functional:legacy:mqtt": "cucumber-js --format progress-bar --profile mqtt ./features-legacy", - "test:functional:legacy:websocket": "cucumber-js --format progress-bar --profile websocket ./features-legacy", + "test:functional:legacy:http": "npx cucumber-js --format progress-bar --profile http ./features-legacy", + "test:functional:legacy:mqtt": "npx cucumber-js --format progress-bar --profile mqtt ./features-legacy", + "test:functional:legacy:websocket": "npx cucumber-js --format progress-bar --profile websocket ./features-legacy", "test:functional:legacy": "npm run test:functional:legacy:http && npm run test:functional:legacy:websocket && npm run test:functional:legacy:mqtt", - "test:functional:websocket": "KUZZLE_PROTOCOL=websocket cucumber-js --profile websocket", + "test:functional:websocket": "KUZZLE_PROTOCOL=websocket npx cucumber-js --profile websocket", "test:functional": "npm run test:functional:http && npm run test:functional:websocket && npm run test:jest", "test:jest": "jest", "test:lint:js:fix": "eslint --max-warnings=0 --fix ./lib ./test ./bin ./features", @@ -34,7 +36,7 @@ "test:lint:ts:fix": "eslint --max-warnings=0 --fix ./lib --ext .ts --config .eslintc-ts.json", "test:lint:ts": "eslint --max-warnings=0 ./lib --ext .ts --config .eslintc-ts.json", "test:lint": "npm run test:lint:js && npm run test:lint:ts", - "test:unit:coverage": "DEBUG= nyc --reporter=text-summary --reporter=lcov mocha --exit", + "test:unit:coverage": "DEBUG= npx nyc --reporter=text-summary --reporter=lcov mocha --exit", "test:unit": "DEBUG= mocha --exit", "test": "npm run clean && npm run --silent test:lint && npm run build && npm run test:unit:coverage && npm run test:functional" }, @@ -133,4 +135,4 @@ "LICENSE.md", "README.md" ] -} \ No newline at end of file +} From 3f0ab19ff4af0f13cb1b2cf6541d3af410d91715 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:12:39 +0100 Subject: [PATCH 22/28] Revert some changes --- features-legacy/support/stepUtils.js | 14 +- features-legacy/support/world.js | 455 ++++++++++++--------------- lib/core/backend/backendStorage.ts | 6 +- lib/core/plugin/pluginContext.ts | 4 +- package.json | 6 +- 5 files changed, 223 insertions(+), 262 deletions(-) diff --git a/features-legacy/support/stepUtils.js b/features-legacy/support/stepUtils.js index cb7d47b339..dfed59cce9 100644 --- a/features-legacy/support/stepUtils.js +++ b/features-legacy/support/stepUtils.js @@ -1,13 +1,13 @@ -"use strict"; +'use strict'; exports.getReturn = function () { - var args = Array.prototype.slice.call(arguments), + var + args = Array.prototype.slice.call(arguments), action = args.shift(), cb = args.pop(); - this.api[action] - .apply(this.api, args) - .then((response) => { + this.api[action].apply(this.api, args) + .then(response => { if (response.error) { this.result = response; return cb(); @@ -16,8 +16,8 @@ exports.getReturn = function () { this.result = response; cb(); }) - .catch((error) => { + .catch(error => { this.result = error; cb(); }); -}; +}; \ No newline at end of file diff --git a/features-legacy/support/world.js b/features-legacy/support/world.js index cf4876a135..e837f1d34d 100644 --- a/features-legacy/support/world.js +++ b/features-legacy/support/world.js @@ -1,192 +1,189 @@ -"use strict"; +'use strict'; -const { setWorldConstructor } = require("cucumber"), - HttpApi = require("./api/http"), - MqttApi = require("./api/mqtt"), - WebSocketApi = require("./api/websocket"); +const + { setWorldConstructor } = require('cucumber'), + HttpApi = require('./api/http'), + MqttApi = require('./api/mqtt'), + WebSocketApi = require('./api/websocket'); -let _init; +let + _init; class KWorld { - constructor(config) { - this.config = Object.assign( - { - protocol: "websocket", - host: "localhost", - port: 7512, - }, - config.parameters - ); + constructor (config) { + this.config = Object.assign({ + protocol: 'websocket', + host: 'localhost', + port: 7512 + }, config.parameters); switch (this.config.protocol) { - case "http": + case 'http': this.api = new HttpApi(this); break; - case "mqtt": + case 'mqtt': this.api = new MqttApi(this); break; default: // websocket this.api = new WebSocketApi(this); - this.config.protocol = "websocket"; + this.config.protocol = 'websocket'; } - if (!_init && !this.config.silent) { - console.log( - `[${this.config.protocol}] ${this.config.host}:${this.config.port}` - ); + if (! _init && ! this.config.silent) { + console.log(`[${this.config.protocol}] ${this.config.host}:${this.config.port}`); _init = true; } - this.kuzzleConfig = require("../../lib/config").loadConfig(); - this.idPrefix = "kuzzle-functional-tests-"; + this.kuzzleConfig = require('../../lib/config').loadConfig(); + this.idPrefix = 'kuzzle-functional-tests-'; this.currentUser = null; // Fake values for test - this.fakeIndex = "kuzzle-test-index"; - this.fakeAltIndex = "kuzzle-test-index-alt"; - this.fakeNewIndex = "kuzzle-test-index-new"; - this.fakeCollection = "kuzzle-collection-test"; - this.fakeAltCollection = "kuzzle-collection-test-alt"; + this.fakeIndex = 'kuzzle-test-index'; + this.fakeAltIndex = 'kuzzle-test-index-alt'; + this.fakeNewIndex = 'kuzzle-test-index-new'; + this.fakeCollection = 'kuzzle-collection-test'; + this.fakeAltCollection = 'kuzzle-collection-test-alt'; this.documentGrace = { - firstName: "Grace", - lastName: "Hopper", + firstName: 'Grace', + lastName: 'Hopper', info: { age: 85, - city: "NYC", - hobby: "computer", + city: 'NYC', + hobby: 'computer' }, location: { lat: 32.692742, - lon: -97.114127, - }, + lon: -97.114127 + } }; this.documentAda = { - firstName: "Ada", - lastName: "Lovelace", + firstName: 'Ada', + lastName: 'Lovelace', info: { age: 36, - city: "London", - hobby: "computer", + city: 'London', + hobby: 'computer' }, location: { lat: 51.519291, - lon: -0.149817, - }, + lon: -0.149817 + } }; this.bulk = [ { index: { _id: 1 } }, - { title: "foo" }, + { title: 'foo' }, { index: { _id: 2 } }, - { title: "bar" }, + { title: 'bar' }, { update: { _id: 1 } }, - { doc: { title: "foobar" } }, - { delete: { _id: 2 } }, + { doc: { title: 'foobar' } }, + { delete: { _id: 2 } } ]; this.mapping = { properties: { firstName: { - type: "text", - copy_to: "newFirstName", + type: 'text', + copy_to: 'newFirstName' }, newFirstName: { - type: "keyword", - store: true, - }, - }, + type: 'keyword', + store: true + } + } }; this.securitymapping = { properties: { foo: { - type: "text", - copy_to: "bar", + type: 'text', + copy_to: 'bar' }, bar: { - type: "keyword", - store: true, - }, - }, + type: 'keyword', + store: true + } + } }; this.volatile = { - iwant: "to break free", - we: ["will", "rock", "you"], + iwant: 'to break free', + we: ['will', 'rock', 'you'] }; this.roles = { role1: { controllers: { - "*": { + '*': { actions: { - "*": true, - }, - }, - }, + '*': true + } + } + } }, role2: { controllers: { - document: { + 'document': { actions: { - "*": true, - }, + '*': true + } }, - auth: { actions: { logout: true } }, - }, + 'auth': { actions: { logout: true } } + } }, role3: { controllers: { - document: { + 'document': { actions: { - search: true, - }, + 'search': true + } }, - auth: { actions: { logout: true } }, - }, + 'auth': { actions: { logout: true } } + } }, foo: { controllers: { - foo: { + 'foo': { actions: { - "*": true, - }, - }, - }, + '*': true + } + } + } }, bar: { controllers: { - bar: { + 'bar': { actions: { - "*": true, - }, - }, - }, + '*': true + } + } + } }, foobar: { controllers: { - foo: { + 'foo': { actions: { - "*": true, - }, + '*': true + } }, - bar: { + 'bar': { actions: { - "*": true, - }, - }, - }, + '*': true + } + } + } }, admin: { controllers: { - "*": { + '*': { actions: { - "*": true, - }, - }, - }, + '*': true + } + } + } }, default: { controllers: { @@ -196,15 +193,15 @@ class KWorld { getCurrentUser: true, getMyRights: true, logout: true, - updateSelf: true, - }, + updateSelf: true + } }, server: { actions: { - info: true, - }, - }, - }, + info: true + } + } + } }, anonymous: { controllers: { @@ -213,266 +210,230 @@ class KWorld { checkToken: true, getCurrentUser: true, getMyRights: true, - login: true, - }, + login: true + } }, server: { actions: { - info: true, - }, - }, - }, - }, + info: true + } + } + } + } }; this.policies = { profile1: [ - { - controller: "*", - action: "*", - index: "*", - collection: "*", - value: "allowed", - }, + { controller: '*', action: '*', index: '*', collection: '*', value: 'allowed' } ], profile2: [ - { - controller: "*", - action: "*", - index: this.fakeIndex, - collection: "*", - value: "allowed", - }, - { - controller: "document", - action: "*", - index: "*", - collection: "*", - value: "allowed", - }, - { - controller: "auth", - action: "logout", - index: "*", - collection: "*", - value: "allowed", - }, - ], + { controller: '*', action: '*', index: this.fakeIndex, collection: '*', value: 'allowed' }, + { controller: 'document', action: '*', index: '*', collection: '*', value: 'allowed' }, + { controller: 'auth', action: 'logout', index: '*', collection: '*', value: 'allowed' } + ] }; this.profiles = { profile1: { - policies: [{ roleId: this.idPrefix + "role1" }], + policies: [{ roleId: this.idPrefix + 'role1' }] }, profile2: { policies: [ { - roleId: this.idPrefix + "role1", - restrictedTo: [{ index: this.fakeIndex }], + roleId: this.idPrefix + 'role1', + restrictedTo: [{ index: this.fakeIndex }] }, { - roleId: this.idPrefix + "role2", - }, - ], + roleId: this.idPrefix + 'role2' + } + ] }, profile3: { - policies: [ - { - roleId: this.idPrefix + "role2", - restrictedTo: [ - { index: this.fakeAltIndex, collections: [this.fakeCollection] }, - ], - }, - ], + policies: [{ + roleId: this.idPrefix + 'role2', + restrictedTo: [{ index: this.fakeAltIndex, collections: [this.fakeCollection] }] + }] }, profile4: { - policies: [ - { - roleId: this.idPrefix + "role3", - }, - ], + policies: [{ + roleId: this.idPrefix + 'role3' + }] }, profile5: { - policies: [ - { - roleId: this.idPrefix + "role3", - restrictedTo: [{ index: this.fakeIndex }], - }, - ], + policies: [{ + roleId: this.idPrefix + 'role3', + restrictedTo: [{ index: this.fakeIndex }] + }] }, profile6: { - policies: [ - { - roleId: this.idPrefix + "role3", - restrictedTo: [ - { index: this.fakeIndex, collections: [this.fakeCollection] }, - ], - }, - ], + policies: [{ + roleId: this.idPrefix + 'role3', + restrictedTo: [{ index: this.fakeIndex, collections: [this.fakeCollection] }] + }] }, invalidProfile: { - policies: [{ roleId: "unexisting-role" }], + policies: [{ roleId: 'unexisting-role' }] }, emptyProfile: { - policies: [], + policies: [] }, admin: { - policies: [{ roleId: "admin" }], + policies: [{ roleId: 'admin' }] }, adminfoo: { - policies: [{ roleId: "admin" }, { roleId: this.idPrefix + "foo" }], + policies: [{ roleId: 'admin' }, { roleId: this.idPrefix + 'foo' }] }, default: { - policies: [{ roleId: "default" }], + policies: [{ roleId: 'default' }] }, defaultfoo: { - policies: [{ roleId: "default" }, { roleId: this.idPrefix + "foo" }], + policies: [{ roleId: 'default' }, { roleId: this.idPrefix + 'foo' }] }, anonymous: { - policies: [{ roleId: "anonymous" }], + policies: [{ roleId: 'anonymous' }] }, anonymousfoo: { - policies: [{ roleId: "anonymous" }, { roleId: this.idPrefix + "foo" }], - }, + policies: [{ roleId: 'anonymous' }, { roleId: this.idPrefix + 'foo' }] + } }; this.users = { useradmin: { content: { name: { - first: "David", - last: "Bowie", - real: "David Robert Jones", + first: 'David', + last: 'Bowie', + real: 'David Robert Jones' }, - profileIds: ["admin"], + profileIds: ['admin'] }, credentials: { local: { - username: this.idPrefix + "useradmin", - password: "testpwd", - }, - }, + username: this.idPrefix + 'useradmin', + password: 'testpwd' + } + } }, user1: { content: { - profileIds: [this.idPrefix + "profile1"], + profileIds: [this.idPrefix + 'profile1'] }, credentials: { local: { - username: this.idPrefix + "user1", - password: "testpwd1", - }, - }, + username: this.idPrefix + 'user1', + password: 'testpwd1' + } + } }, user2: { content: { name: { - first: "Steve", - last: "Wozniak", + first: 'Steve', + last: 'Wozniak' }, - hobby: "Segway Polo", - profileIds: [this.idPrefix + "profile2"], + hobby: 'Segway Polo', + profileIds: [this.idPrefix + 'profile2'] }, credentials: { local: { - username: this.idPrefix + "user2", - password: "testpwd2", - }, - }, + username: this.idPrefix + 'user2', + password: 'testpwd2' + } + } }, user3: { content: { - profileIds: [this.idPrefix + "profile3"], + profileIds: [this.idPrefix + 'profile3'] }, credentials: { local: { - username: this.idPrefix + "user3", - password: "testpwd3", - }, - }, + username: this.idPrefix + 'user3', + password: 'testpwd3' + } + } }, user4: { content: { - profileIds: [this.idPrefix + "profile4"], + profileIds: [this.idPrefix + 'profile4'] }, credentials: { local: { - username: this.idPrefix + "user4", - password: "testpwd4", - }, - }, + username: this.idPrefix + 'user4', + password: 'testpwd4' + } + } }, user5: { content: { - profileIds: [this.idPrefix + "profile5"], + profileIds: [this.idPrefix + 'profile5'] }, - password: "testpwd5", + password: 'testpwd5', credentials: { local: { - username: this.idPrefix + "user5", - password: "testpwd5", - }, - }, + username: this.idPrefix + 'user5', + password: 'testpwd5' + } + } }, user6: { content: { - profileIds: [this.idPrefix + "profile6"], + profileIds: [this.idPrefix + 'profile6'] }, credentials: { local: { - username: this.idPrefix + "user6", - password: "testpwd6", - }, - }, + username: this.idPrefix + 'user6', + password: 'testpwd6' + } + } }, restricteduser1: { content: { name: { - first: "Restricted", - last: "User", - }, + first: 'Restricted', + last: 'User' + } }, credentials: { local: { - username: this.idPrefix + "restricteduser1", - password: "testpwd1", - }, - }, + username: this.idPrefix + 'restricteduser1', + password: 'testpwd1' + } + } }, nocredentialuser: { content: { name: { - first: "Non Connectable", - last: "User", + first: 'Non Connectable', + last: 'User' }, - profileIds: ["admin"], - }, + profileIds: ['admin'] + } }, unexistingprofile: { content: { name: { - first: "John", - last: "Doe", + first: 'John', + last: 'Doe' }, - profileIds: [this.idPrefix + "i-dont-exist"], - }, + profileIds: [this.idPrefix + 'i-dont-exist'] + } }, invalidprofileType: { content: { name: { - first: "John", - last: "Doe", + first: 'John', + last: 'Doe' }, - profileIds: [null], - }, - }, + profileIds: [null] + } + } }; this.credentials = { nocredentialuser: { - username: this.idPrefix + "nocredentialuser", - password: "testpwd1", - }, + username: this.idPrefix + 'nocredentialuser', + password: 'testpwd1' + } }; this.memoryStorageResult = null; @@ -481,4 +442,4 @@ class KWorld { setWorldConstructor(KWorld); -module.exports = KWorld; +module.exports = KWorld; \ No newline at end of file diff --git a/lib/core/backend/backendStorage.ts b/lib/core/backend/backendStorage.ts index c9253c4e83..294de544c7 100644 --- a/lib/core/backend/backendStorage.ts +++ b/lib/core/backend/backendStorage.ts @@ -21,7 +21,7 @@ import { Client } from "@elastic/elasticsearch"; -import ElasticSearch from "../../service/storage/elasticsearch"; +import Elasticsearch from "../../service/storage/elasticsearch"; import { JSONObject } from "../../../index"; import { ApplicationManager, Backend } from "./index"; @@ -44,7 +44,7 @@ export class BackendStorage extends ApplicationManager { const kuzzle = this._kuzzle; this._Client = function ESClient(clientConfig: JSONObject = {}) { - return ElasticSearch.buildClient({ + return Elasticsearch.buildClient({ ...kuzzle.config.services.storageEngine.client, ...clientConfig, }); @@ -60,7 +60,7 @@ export class BackendStorage extends ApplicationManager { */ get storageClient(): Client { if (!this._client) { - this._client = ElasticSearch.buildClient( + this._client = Elasticsearch.buildClient( this._kuzzle.config.services.storageEngine.client ); } diff --git a/lib/core/plugin/pluginContext.ts b/lib/core/plugin/pluginContext.ts index 21976e9391..3e112990d4 100644 --- a/lib/core/plugin/pluginContext.ts +++ b/lib/core/plugin/pluginContext.ts @@ -27,7 +27,7 @@ import { JSONObject } from "kuzzle-sdk"; import { EmbeddedSDK } from "../shared/sdk/embeddedSdk"; import PluginRepository from "./pluginRepository"; import Store from "../shared/store"; -import ElasticSearch from "../../service/storage/elasticsearch"; +import Elasticsearch from "../../service/storage/elasticsearch"; import { isPlainObject } from "../../util/safeObject"; import Promback from "../../util/promback"; import { Mutex } from "../../util/mutex"; @@ -307,7 +307,7 @@ export class PluginContext { // eslint-disable-next-line no-inner-declarations function PluginContextESClient(): Client { - return ElasticSearch.buildClient( + return Elasticsearch.buildClient( global.kuzzle.config.services.storageEngine.client ); } diff --git a/package.json b/package.json index b12d2422e2..6ad71e0dfe 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "prettier": "npx prettier ./lib ./test ./bin ./features ./plugins/available/functional-test-plugin --write", "services": "npx kourou app:start-services", "start:dev": "npx ergol docker/scripts/start-kuzzle-dev.ts -c ./config/ergol.config.json --script-args=--enable-plugins functional-test-plugin", - "test:functional:http": "KUZZLE_PROTOCOL=http cucumber-js --profile http", + "test:functional:http": "KUZZLE_PROTOCOL=http npx cucumber-js --profile http", "test:functional:jest": "npm run test:jest", "test:functional:legacy:http": "npx cucumber-js --format progress-bar --profile http ./features-legacy", "test:functional:legacy:mqtt": "npx cucumber-js --format progress-bar --profile mqtt ./features-legacy", @@ -36,8 +36,8 @@ "test:lint:ts:fix": "eslint --max-warnings=0 --fix ./lib --ext .ts --config .eslintc-ts.json", "test:lint:ts": "eslint --max-warnings=0 ./lib --ext .ts --config .eslintc-ts.json", "test:lint": "npm run test:lint:js && npm run test:lint:ts", - "test:unit:coverage": "DEBUG= npx nyc --reporter=text-summary --reporter=lcov mocha --exit", - "test:unit": "DEBUG= mocha --exit", + "test:unit:coverage": "DEBUG= nyc --reporter=text-summary --reporter=lcov mocha --exit", + "test:unit": "DEBUG= npx --node-arg=--trace-warnings mocha --exit", "test": "npm run clean && npm run --silent test:lint && npm run build && npm run test:unit:coverage && npm run test:functional" }, "directories": { From 739994bb854c1b5ee42be3b774b882ca71080ead Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:14:35 +0100 Subject: [PATCH 23/28] Revert --- features-legacy/support/hooks.js | 339 +++++++++++++-------------- features-legacy/support/stepUtils.js | 2 +- features-legacy/support/world.js | 2 +- 3 files changed, 163 insertions(+), 180 deletions(-) diff --git a/features-legacy/support/hooks.js b/features-legacy/support/hooks.js index 941774e578..b622fceafd 100644 --- a/features-legacy/support/hooks.js +++ b/features-legacy/support/hooks.js @@ -1,222 +1,205 @@ "use strict"; -const _ = require("lodash"); -const { After, Before, BeforeAll } = require("cucumber"); -const Bluebird = require("bluebird"); - -const Http = require("./api/http"); -const World = require("./world"); +const { After, Before, BeforeAll } = require("cucumber"), + testMappings = require("../fixtures/mappings"), + testPermissions = require("../fixtures/permissions"), + testFixtures = require("../fixtures/fixtures"), + World = require("./world"); + +async function resetSecurityDefault(sdk) { + await sdk.query({ + controller: "admin", + action: "resetSecurity", + refresh: "wait_for", + }); + + sdk.jwt = null; + + await sdk.query({ + controller: "admin", + action: "loadSecurities", + body: testPermissions, + refresh: "wait_for", + }); + + await sdk.auth.login("local", { + username: "test-admin", + password: "password", + }); +} -function bootstrapDatabase() { - const fixtures = require("../fixtures/functionalTestsFixtures.json"), - promises = [], - world = new World({ parameters: parseWorldParameters() }), - http = new Http(world); +// Common hooks ================================================================ - for (const index of Object.keys(fixtures)) { - promises.push(() => http.deleteIndex(index).catch(() => true)); - } - const mappings = { - dynamic: "true", - properties: { foo: { type: "keyword" } }, - }; - - promises.push(() => http.createIndex(world.fakeIndex)); - promises.push(() => - http.createCollection(world.fakeIndex, world.fakeCollection, mappings) - ); - promises.push(() => - http.createCollection(world.fakeIndex, world.fakeAltCollection, mappings) - ); +BeforeAll({ timeout: 10 * 1000 }, async function () { + const world = new World({}); - promises.push(() => http.createIndex(world.fakeAltIndex)); - promises.push(() => - http.createCollection(world.fakeAltIndex, world.fakeCollection, mappings) - ); - promises.push(() => - http.createCollection(world.fakeAltIndex, world.fakeAltCollection, mappings) + console.log( + `Start tests with ${world.protocol.toLocaleUpperCase()} protocol.` ); - return Bluebird.each(promises, (promise) => promise()); -} + await world.sdk.connect(); -function cleanDatabase() { - const promises = [], - world = new World({ parameters: parseWorldParameters() }), - http = new Http(world); - - for (const index of [ - world.fakeIndex, - world.fakeAltIndex, - world.fakeNewIndex, - "tolkien", - ]) { - promises.push(http.deleteIndex(index).catch(() => true)); - } + console.log("Loading default permissions.."); - return Bluebird.all(promises); -} + await world.sdk.query({ + controller: "admin", + action: "loadSecurities", + body: testPermissions, + onExistingUsers: "overwrite", + refresh: "wait_for", + }); -// before first -BeforeAll(function () { - return cleanDatabase().then(() => bootstrapDatabase()); + world.sdk.disconnect(); }); -Before({ timeout: 10 * 2000 }, function () { - const world = new World({ parameters: parseWorldParameters() }); +Before({ timeout: 10 * 1000 }, async function () { + await this.sdk.connect(); - return this.api - .truncateCollection(world.fakeIndex, world.fakeCollection) - .catch(() => {}) - .then(() => - this.api.truncateCollection(world.fakeAltIndex, world.fakeAltCollection) - ) - .catch(() => {}) - .then(() => this.api.resetSecurity()); + await this.sdk.auth.login("local", { + username: "test-admin", + password: "password", + }); }); -Before({ timeout: 10 * 2000, tags: "@resetDatabase" }, async function () { - await cleanDatabase(); - await bootstrapDatabase(); +Before({ tags: "not @preserveDatabase" }, async function () { + await this.sdk.query({ + controller: "admin", + action: "resetDatabase", + refresh: "wait_for", + }); }); -After(function () { - return this.api.disconnect(); +After(async function () { + // Clean values stored by the scenario + this.props = {}; + + if (this.sdk && typeof this.sdk.disconnect === "function") { + this.sdk.disconnect(); + } }); -After({ tags: "@realtime" }, function () { - return this.api.unsubscribeAll().catch(() => true); +Before({ tags: "@production" }, async function () { + if (process.env.NODE_ENV !== "production") { + return "skipped"; + } }); -Before({ tags: "@security" }, function () { - return cleanSecurity.call(this); +Before({ tags: "@development" }, async function () { + if (process.env.NODE_ENV !== "development") { + return "skipped"; + } }); -Before({ tags: "@firstAdmin" }, function () { - return cleanSecurity.call(this); +Before({ tags: "@http" }, async function () { + if (process.env.KUZZLE_PROTOCOL !== "http") { + return "skipped"; + } }); -After({ tags: "@firstAdmin" }, function () { - return grantDefaultRoles.call(this).then(() => cleanSecurity.call(this)); +Before({ tags: "@not-http" }, async function () { + if (process.env.KUZZLE_PROTOCOL === "http") { + return "skipped"; + } +}); + +// firstAdmin hooks ============================================================ + +Before({ tags: "@firstAdmin" }, async function () { + await this.sdk.query({ + controller: "admin", + action: "resetSecurity", + refresh: "wait_for", + }); + + this.sdk.jwt = null; }); -Before({ tags: "@redis" }, function () { - return cleanRedis.call(this); +After({ tags: "@firstAdmin", timeout: 60 * 1000 }, async function () { + await resetSecurityDefault(this.sdk); }); -After({ tags: "@redis" }, function () { - return cleanRedis.call(this); +// security hooks ============================================================== + +After({ tags: "@security", timeout: 60 * 1000 }, async function () { + await resetSecurityDefault(this.sdk); }); -Before({ tags: "@validation" }, function () { - return cleanValidations.call(this); +// mappings hooks ============================================================== + +Before({ tags: "@mappings" }, async function () { + await this.sdk.query({ + controller: "admin", + action: "loadMappings", + body: testMappings, + refresh: "wait_for", + }); + + await this.sdk.query({ + controller: "admin", + action: "loadFixtures", + body: testFixtures, + refresh: "wait_for", + }); }); -After({ tags: "@validation" }, function () { - return cleanValidations.call(this); +// events hooks ================================================================ + +After({ tags: "@events" }, async function () { + await this.sdk.query({ + controller: "functional-test-plugin/pipes", + action: "deactivateAll", + }); + + await this.sdk.query({ + controller: "pipes", + action: "deactivateAll", + }); }); -After({ tags: "@http" }, function () { - this.api.encode("identity"); - this.api.decode("identity"); +// login hooks ================================================================= + +After({ tags: "@login" }, async function () { + await this.sdk.auth.login("local", { + username: "test-admin", + password: "password", + }); }); -function cleanSecurity() { - if (this.currentUser) { - delete this.currentUser; +// realtime hooks ============================================================== + +After({ tags: "@realtime" }, function () { + if (!this.props.subscriptions) { + return; } + const promises = Object.values(this.props.subscriptions).map( + ({ unsubscribe }) => unsubscribe() + ); - return this.api.resetSecurity(); -} + return Promise.all(promises); +}); -function grantDefaultRoles() { - return this.api - .login("local", this.users.useradmin.credentials.local) - .then((body) => { - if (body.error) { - return Promise.reject(new Error(body.error.message)); - } - - if (!body.result) { - return Promise.reject(new Error("No result provided")); - } - - if (!body.result.jwt) { - return Promise.reject(new Error("No token received")); - } - - if (this.currentUser === null || this.currentUser === undefined) { - this.currentUser = {}; - } - - this.currentToken = { jwt: body.result.jwt }; - this.currentUser.token = body.result.jwt; - - return this.api.createOrReplaceRole("anonymous", { - controllers: { "*": { actions: { "*": true } } }, - }); - }) - .then(() => - this.api.createOrReplaceRole("default", { - controllers: { "*": { actions: { "*": true } } }, - }) - ) - .then(() => - this.api.createOrReplaceRole("admin", { - controllers: { "*": { actions: { "*": true } } }, - }) - ); -} +After({ tags: "@websocket" }, function () { + this.props.client.terminate(); +}); -function cleanRedis() { - return this.api - .callMemoryStorage("keys", { args: { pattern: this.idPrefix + "*" } }) - .then((response) => { - if (_.isArray(response.result) && response.result.length) { - return this.api.callMemoryStorage("del", { - body: { keys: response.result }, - }); - } - - return null; - }); -} +// cluster hooks =============================================================== -function cleanValidations() { - return this.api - .searchSpecifications({ - query: { - match_all: { boost: 1 }, - }, - }) - .then((body) => - Bluebird.all( - body.result.hits - .filter((r) => r._id.match(/^kuzzle-test-/)) - .map((r) => - this.api.deleteSpecifications( - r._id.split("#")[0], - r._id.split("#")[1] - ) - ) - ) - ); -} +Before({ tags: "@cluster" }, async function () { + this.sdk.disconnect(); -function parseWorldParameters() { - const worldParamIndex = process.argv.indexOf("--world-parameters"); - const worldParam = - worldParamIndex > -1 ? JSON.parse(process.argv[worldParamIndex + 1]) : {}; - - const parameters = Object.assign( - { - host: "localhost", - port: 7512, - protocol: "websocket", - silent: true, - }, - worldParam - ); + this.node1 = this.getSDK({ port: 17510 }); + this.node2 = this.getSDK({ port: 17511 }); + this.node3 = this.getSDK({ port: 17512 }); - return parameters; -} + await Promise.all([ + this.node1.connect(), + this.node2.connect(), + this.node3.connect(), + ]); +}); + +After({ tags: "@cluster" }, async function () { + this.node1.disconnect(); + this.node2.disconnect(); + this.node3.disconnect(); +}); diff --git a/features-legacy/support/stepUtils.js b/features-legacy/support/stepUtils.js index dfed59cce9..b34b67a070 100644 --- a/features-legacy/support/stepUtils.js +++ b/features-legacy/support/stepUtils.js @@ -20,4 +20,4 @@ exports.getReturn = function () { this.result = error; cb(); }); -}; \ No newline at end of file +}; diff --git a/features-legacy/support/world.js b/features-legacy/support/world.js index e837f1d34d..fd87033938 100644 --- a/features-legacy/support/world.js +++ b/features-legacy/support/world.js @@ -442,4 +442,4 @@ class KWorld { setWorldConstructor(KWorld); -module.exports = KWorld; \ No newline at end of file +module.exports = KWorld; From c6cc2908ec0affc424d2535c3e09f31d3bbff91c Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:19:06 +0100 Subject: [PATCH 24/28] Revert linting of some files --- features-legacy/support/api/apiBase.js | 1313 +++++++++--------- features-legacy/support/api/http.js | 1101 +++++++-------- features-legacy/support/api/mqtt.js | 174 ++- features-legacy/support/api/websocket.js | 67 +- features-legacy/support/api/websocketBase.js | 159 +-- features-legacy/support/config.js | 19 +- features-legacy/support/env.js | 2 +- features-legacy/support/hooks.js | 300 ++-- 8 files changed, 1523 insertions(+), 1612 deletions(-) diff --git a/features-legacy/support/api/apiBase.js b/features-legacy/support/api/apiBase.js index 50051941af..0d09032012 100644 --- a/features-legacy/support/api/apiBase.js +++ b/features-legacy/support/api/apiBase.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; /** * This file contains the main API method for real-time protocols. @@ -7,11 +7,12 @@ * NOTE: must be added in api HTTP because the apiHttp file doesn't extend this ApiRT */ -const _ = require("lodash"), - Bluebird = require("bluebird"); +const + _ = require('lodash'), + Bluebird = require('bluebird'); class ApiBase { - constructor(world) { + constructor (world) { this.world = world; this.clientId = null; @@ -21,89 +22,93 @@ class ApiBase { this.isRealTimeCapable = true; } - send() { - throw new Error("not implemented"); + send () { + throw new Error('not implemented'); } - sendAndListen() { - throw new Error("not implemented"); + sendAndListen () { + throw new Error('not implemented'); } - adminResetDatabase() { + adminResetDatabase () { const msg = { - controller: "admin", - action: "resetDatabase", + controller: 'admin', + action: 'resetDatabase' }; return this.send(msg); } - serverPublicApi() { + serverPublicApi () { const msg = { - controller: "server", - action: "publicApi", + controller: 'server', + action: 'publicApi' }; return this.send(msg); } - bulkImport(bulk, index, collection) { - const msg = { - controller: "bulk", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "import", - body: { bulkData: bulk }, - }; + bulkImport (bulk, index, collection) { + const + msg = { + controller: 'bulk', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'import', + body: { bulkData: bulk } + }; return this.send(msg); } - bulkMWrite(index, collection, body) { - const msg = { - controller: "bulk", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mWrite", - body, - }; + bulkMWrite (index, collection, body) { + const + msg = { + controller: 'bulk', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mWrite', + body + }; return this.send(msg); } - bulkWrite(index, collection, body, _id = null) { - const msg = { - controller: "bulk", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "write", - _id, - body, - }; + bulkWrite (index, collection, body, _id = null) { + const + msg = { + controller: 'bulk', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'write', + _id, + body + }; return this.send(msg); } - collectionExists(index, collection) { + collectionExists (index, collection) { return this.send({ index, collection, - controller: "collection", - action: "exists", + controller: 'collection', + action: 'exists' }); } - callMemoryStorage(command, args) { + callMemoryStorage (command, args) { const msg = { - controller: "ms", - action: command, + controller: 'ms', + action: command }; _.forEach(args, (value, prop) => { - if (prop === "args") { + if (prop === 'args') { _.forEach(value, (item, k) => { msg[k] = item; }); - } else { + } + else { msg[prop] = value; } }); @@ -111,7 +116,7 @@ class ApiBase { return this.send(msg); } - checkToken(token) { + checkToken (token) { let _token = null; if (this.world.currentUser && this.world.currentUser.token) { @@ -119,19 +124,15 @@ class ApiBase { this.world.currentUser.token = null; } - return this.send({ - controller: "auth", - action: "checkToken", - body: { token }, - }) - .then((response) => { + return this.send({ controller: 'auth', action: 'checkToken', body: { token } }) + .then(response => { if (_token !== null) { this.world.currentUser.token = _token; } return response; }) - .catch((error) => { + .catch(error => { if (_token !== null) { this.world.currentUser.token = _token; } @@ -140,43 +141,46 @@ class ApiBase { }); } - count(query, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "count", - body: query, - }; + count (query, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'count', + body: query + }; return this.send(msg); } - countSubscription() { - const clients = Object.keys(this.subscribedRooms), + countSubscription () { + const + clients = Object.keys(this.subscribedRooms), rooms = Object.keys(this.subscribedRooms[clients[0]]), msg = { - controller: "realtime", + controller: 'realtime', collection: this.world.fakeCollection, index: this.world.fakeIndex, - action: "count", + action: 'count', body: { - roomId: rooms[0], - }, + roomId: rooms[0] + } }; return this.send(msg); } - create(body, index, collection, jwtToken, id) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "create", - body, - refresh: "wait_for", - }; + create (body, index, collection, jwtToken, id) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'create', + body, + refresh: 'wait_for' + }; if (id) { msg._id = id; @@ -184,74 +188,78 @@ class ApiBase { if (jwtToken !== undefined) { msg.headers = { - authorization: "Bearer " + jwtToken, + authorization: 'Bearer ' + jwtToken }; } return this.send(msg); } - createIndex(index) { - const msg = { - controller: "index", - action: "create", - index: index, - }; + createIndex (index) { + const + msg = { + controller: 'index', + action: 'create', + index: index + }; return this.send(msg); } - createCollection(index, collection, mappings) { - const msg = { - controller: "collection", - action: "create", - index: index || this.world.fakeIndex, - collection, - body: mappings, - }; + createCollection (index, collection, mappings) { + const + msg = { + controller: 'collection', + action: 'create', + index: index || this.world.fakeIndex, + collection, + body: mappings + }; return this.send(msg); } - getCollectionMapping(index, collection, includeKuzzleMeta = false) { - const msg = { - includeKuzzleMeta, - controller: "collection", - action: "getMapping", - index, - collection, - }; + getCollectionMapping (index, collection, includeKuzzleMeta = false) { + const + msg = { + includeKuzzleMeta, + controller: 'collection', + action: 'getMapping', + index, + collection + }; return this.send(msg); } - createCredentials(strategy, userId, body) { + createCredentials (strategy, userId, body) { return this.send({ - controller: "security", - action: "createCredentials", + controller: 'security', + action: 'createCredentials', strategy, body, - _id: userId, + _id: userId }); } - createMyCredentials(strategy, body) { + createMyCredentials (strategy, body) { return this.send({ - controller: "auth", - action: "createMyCredentials", + controller: 'auth', + action: 'createMyCredentials', strategy, - body, + body }); } - createOrReplace(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "createOrReplace", - body: body, - }; + createOrReplace (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'createOrReplace', + body: body + }; if (body._id) { msg._id = body._id; @@ -261,33 +269,35 @@ class ApiBase { return this.send(msg); } - createOrReplaceProfile(id, body) { - const msg = { - controller: "security", - action: "createOrReplaceProfile", - _id: id, - body: body, - }; + createOrReplaceProfile (id, body) { + const + msg = { + controller: 'security', + action: 'createOrReplaceProfile', + _id: id, + body: body + }; return this.send(msg); } - createOrReplaceRole(id, body) { - const msg = { - controller: "security", - action: "createOrReplaceRole", - _id: id, - body: body, - }; + createOrReplaceRole (id, body) { + const + msg = { + controller: 'security', + action: 'createOrReplaceRole', + _id: id, + body: body + }; return this.send(msg); } - createRestrictedUser(body, id) { + createRestrictedUser (body, id) { const msg = { - controller: "security", - action: "createRestrictedUser", - body: body, + controller: 'security', + action: 'createRestrictedUser', + body: body }; if (id !== undefined) { msg._id = id; @@ -296,12 +306,12 @@ class ApiBase { return this.send(msg); } - createUser(body, id) { + createUser (body, id) { const msg = { - controller: "security", - action: "createUser", - refresh: "wait_for", - body, + controller: 'security', + action: 'createUser', + refresh: 'wait_for', + body }; if (id !== undefined) { @@ -311,11 +321,11 @@ class ApiBase { return this.send(msg); } - createFirstAdmin(body, id, reset) { + createFirstAdmin (body, id, reset) { const msg = { - controller: "security", - action: "createFirstAdmin", - body: body, + controller: 'security', + action: 'createFirstAdmin', + body: body }; if (id !== undefined) { @@ -329,436 +339,457 @@ class ApiBase { return this.send(msg); } - credentialsExist(strategy, body) { + credentialsExist (strategy, body) { return this.send({ - controller: "auth", - action: "credentialsExist", + controller: 'auth', + action: 'credentialsExist', strategy, - body, + body }); } - deleteById(id, index) { - const msg = { - controller: "document", - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "delete", - _id: id, - }; + deleteById (id, index) { + const + msg = { + controller: 'document', + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'delete', + _id: id + }; return this.send(msg); } - deleteByQuery(query, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "deleteByQuery", - body: query, - }; + deleteByQuery (query, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'deleteByQuery', + body: query + }; return this.send(msg); } - deleteCredentials(strategy, userId) { + deleteCredentials (strategy, userId) { return this.send({ - controller: "security", - action: "deleteCredentials", + controller: 'security', + action: 'deleteCredentials', strategy, - _id: userId, + _id: userId }); } - deleteIndex(index) { - const msg = { - controller: "index", - action: "delete", - index: index, - }; + deleteIndex (index) { + const + msg = { + controller: 'index', + action: 'delete', + index: index + }; return this.send(msg); } - deleteIndexes() { - const msg = { - controller: "index", - action: "mdelete", - }; + deleteIndexes () { + const + msg = { + controller: 'index', + action: 'mdelete' + }; return this.send(msg); } - deleteMyCredentials(strategy) { + deleteMyCredentials (strategy) { return this.send({ - controller: "auth", - action: "deleteMyCredentials", - strategy, + controller: 'auth', + action: 'deleteMyCredentials', + strategy }); } - deleteProfile(id, waitFor = false) { + deleteProfile (id, waitFor = false) { const msg = { - controller: "security", - action: "deleteProfile", - _id: id, + controller: 'security', + action: 'deleteProfile', + _id: id }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - deleteProfiles(ids, waitFor = false) { + deleteProfiles (ids, waitFor = false) { const msg = { - controller: "security", - action: "mDeleteProfiles", + controller: 'security', + action: 'mDeleteProfiles', body: { - ids, - }, + ids + } }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - deleteRole(id, waitFor = false) { + deleteRole (id, waitFor = false) { const msg = { - controller: "security", - action: "deleteRole", - _id: id, + controller: 'security', + action: 'deleteRole', + _id: id }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - deleteRoles(ids, waitFor = false) { + deleteRoles (ids, waitFor = false) { const msg = { - controller: "security", - action: "mDeleteRoles", + controller: 'security', + action: 'mDeleteRoles', body: { - ids, - }, + ids + } }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - deleteSpecifications(index, collection) { + deleteSpecifications (index, collection) { return this.send({ index: index, collection: collection, - controller: "collection", - action: "deleteSpecifications", - body: null, + controller: 'collection', + action: 'deleteSpecifications', + body: null }); } - deleteUser(id, waitFor = false) { + deleteUser (id, waitFor = false) { const msg = { - controller: "security", - action: "deleteUser", - _id: id, + controller: 'security', + action: 'deleteUser', + _id: id }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - deleteUsers(ids, waitFor = false) { + deleteUsers (ids, waitFor = false) { const msg = { - controller: "security", - action: "mDeleteUsers", + controller: 'security', + action: 'mDeleteUsers', body: { - ids, - }, + ids + } }; if (waitFor) { - msg.refresh = "wait_for"; + msg.refresh = 'wait_for'; } return this.send(msg); } - exists(id, index) { - const msg = { - controller: "document", - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "exists", - _id: id, - }; + exists (id, index) { + const + msg = { + controller: 'document', + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'exists', + _id: id + }; return this.send(msg); } - get(id, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "get", - _id: id, - }; + get (id, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'get', + _id: id + }; return this.send(msg); } - getAllStats() { - const msg = { - controller: "server", - action: "getAllStats", - }; + getAllStats () { + const + msg = { + controller: 'server', + action: 'getAllStats' + }; return this.send(msg); } - getAuthenticationStrategies() { + getAuthenticationStrategies () { return this.send({ - controller: "auth", - action: "getStrategies", - body: {}, + controller: 'auth', + action: 'getStrategies', + body: {} }); } - getCredentials(strategy, userId) { + getCredentials (strategy, userId) { return this.send({ - controller: "security", - action: "getCredentials", + controller: 'security', + action: 'getCredentials', strategy, - _id: userId, + _id: userId }); } - getCredentialsById(strategy, userId) { + getCredentialsById (strategy, userId) { return this.send({ - controller: "security", - action: "getCredentialsById", + controller: 'security', + action: 'getCredentialsById', strategy, - _id: userId, + _id: userId }); } - getCurrentUser() { + getCurrentUser () { return this.send({ - controller: "auth", - action: "getCurrentUser", + controller: 'auth', + action: 'getCurrentUser' }); } - getLastStats() { - const msg = { - controller: "server", - action: "getLastStats", - }; + getLastStats () { + const + msg = { + controller: 'server', + action: 'getLastStats' + }; return this.send(msg); } - getMyCredentials(strategy) { + getMyCredentials (strategy) { return this.send({ - controller: "auth", - action: "getMyCredentials", - strategy, + controller: 'auth', + action: 'getMyCredentials', + strategy }); } - getMyRights(id) { + getMyRights (id) { return this.send({ - controller: "auth", - action: "getMyRights", - _id: id, + controller: 'auth', + action: 'getMyRights', + _id: id }); } - getProfile(id) { - const msg = { - controller: "security", - action: "getProfile", - _id: id, - }; + getProfile (id) { + const + msg = { + controller: 'security', + action: 'getProfile', + _id: id + }; return this.send(msg); } - getProfileMapping() { - const msg = { - controller: "security", - action: "getProfileMapping", - }; + getProfileMapping () { + const + msg = { + controller: 'security', + action: 'getProfileMapping' + }; return this.send(msg); } - getProfileRights(id) { - const msg = { - controller: "security", - action: "getProfileRights", - _id: id, - }; + getProfileRights (id) { + const + msg = { + controller: 'security', + action: 'getProfileRights', + _id: id + }; return this.send(msg); } - getRole(id) { - const msg = { - controller: "security", - action: "getRole", - _id: id, - }; + getRole (id) { + const + msg = { + controller: 'security', + action: 'getRole', + _id: id + }; return this.send(msg); } - getRoleMapping() { - const msg = { - controller: "security", - action: "getRoleMapping", - }; + getRoleMapping () { + const + msg = { + controller: 'security', + action: 'getRoleMapping' + }; return this.send(msg); } - getSpecifications(index, collection) { + getSpecifications (index, collection) { return this.send({ index: index, collection: collection, - controller: "collection", - action: "getSpecifications", + controller: 'collection', + action: 'getSpecifications' }); } - getStats(dates) { - const msg = { - controller: "server", - action: "getStats", - body: dates, - }; + getStats (dates) { + const + msg = { + controller: 'server', + action: 'getStats', + body: dates + }; return this.send(msg); } - getUser(id) { + getUser (id) { return this.send({ - controller: "security", - action: "getUser", - _id: id, + controller: 'security', + action: 'getUser', + _id: id }); } - getUserMapping() { - const msg = { - controller: "security", - action: "getUserMapping", - }; + getUserMapping () { + const + msg = { + controller: 'security', + action: 'getUserMapping' + }; return this.send(msg); } - getUserRights(id) { + getUserRights (id) { return this.send({ - controller: "security", - action: "getUserRights", - _id: id, + controller: 'security', + action: 'getUserRights', + _id: id }); } - hasCredentials(strategy, userId) { + hasCredentials (strategy, userId) { return this.send({ - controller: "security", - action: "hasCredentials", + controller: 'security', + action: 'hasCredentials', strategy, - _id: userId, + _id: userId }); } - indexExists(index) { + indexExists (index) { return this.send({ index, - controller: "index", - action: "exists", + controller: 'index', + action: 'exists' }); } - refreshCollection(index, collection) { - const msg = { - controller: "collection", - action: "refresh", - index: index || this.world.fakeIndex, - collection: collection || this.world.fakeCollection, - }; + refreshCollection (index, collection) { + const + msg = { + controller: 'collection', + action: 'refresh', + index: index || this.world.fakeIndex, + collection: collection || this.world.fakeCollection + }; return this.send(msg); } - listCollections(index, type) { - const msg = { - controller: "collection", - index: index || this.world.fakeIndex, - action: "list", - body: { type }, - }; + listCollections (index, type) { + const + msg = { + controller: 'collection', + index: index || this.world.fakeIndex, + action: 'list', + body: { type } + }; return this.send(msg); } - listIndexes() { - const msg = { - controller: "index", - action: "list", - }; + listIndexes () { + const + msg = { + controller: 'index', + action: 'list' + }; return this.send(msg); } - listSubscriptions() { - const msg = { - controller: "realtime", - action: "list", - }; + listSubscriptions () { + const + msg = { + controller: 'realtime', + action: 'list' + }; return this.send(msg); } - login(strategy, credentials) { - const msg = { - controller: "auth", - action: "login", - strategy: strategy, - expiresIn: credentials.expiresIn, - body: { - username: credentials.username, - password: credentials.password, - }, - }; + login (strategy, credentials) { + const + msg = { + controller: 'auth', + action: 'login', + strategy: strategy, + expiresIn: credentials.expiresIn, + body: { + username: credentials.username, + password: credentials.password + } + }; return this.send(msg); } - logout(jwtToken, global = false) { - const msg = { - controller: "auth", - action: "logout", - jwt: jwtToken, - }; + logout (jwtToken, global = false) { + const + msg = { + controller: 'auth', + action: 'logout', + jwt: jwtToken + }; if (global) { msg.global = true; @@ -766,150 +797,161 @@ class ApiBase { return this.send(msg); } - mCreate(body, index, collection, jwtToken) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mCreate", - body, - }; + mCreate (body, index, collection, jwtToken) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mCreate', + body + }; if (jwtToken !== undefined) { msg.headers = { - authorization: "Bearer " + jwtToken, + authorization: 'Bearer ' + jwtToken }; } return this.send(msg); } - mCreateOrReplace(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mCreateOrReplace", - body: body, - }; + mCreateOrReplace (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mCreateOrReplace', + body: body + }; return this.send(msg); } - mDelete(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mDelete", - body, - }; + mDelete (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mDelete', + body + }; return this.send(msg); } - mGet(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mGet", - body, - }; + mGet (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mGet', + body + }; return this.send(msg); } - mGetProfiles(body) { - const msg = { - controller: "security", - action: "mGetProfiles", - body: body, - }; + mGetProfiles (body) { + const + msg = { + controller: 'security', + action: 'mGetProfiles', + body: body + }; return this.send(msg); } - mGetRoles(body) { - const msg = { - controller: "security", - action: "mGetRoles", - body: body, - }; + mGetRoles (body) { + const + msg = { + controller: 'security', + action: 'mGetRoles', + body: body + }; return this.send(msg); } - mReplace(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mReplace", - body: body, - }; + mReplace (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mReplace', + body: body + }; return this.send(msg); } - mUpdate(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "mUpdate", - body: body, - }; + mUpdate (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'mUpdate', + body: body + }; return this.send(msg); } - now() { - const msg = { - controller: "server", - action: "now", - }; + now () { + const + msg = { + controller: 'server', + action: 'now' + }; return this.send(msg); } - postDocument(index, collection, document) { + postDocument (index, collection, document) { return this.send({ index, collection, - controller: "document", - action: "create", - body: document, + controller: 'document', + action: 'create', + body: document }); } - publish(body, index) { - const msg = { - controller: "realtime", - collection: this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "publish", - body: body, - }; + publish (body, index) { + const + msg = { + controller: 'realtime', + collection: this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'publish', + body: body + }; return this.send(msg); } - refreshToken() { + refreshToken () { return this.send({ - controller: "auth", - action: "refreshToken", + controller: 'auth', + action: 'refreshToken' }); } - replace(body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "replace", - body: body, - }; + replace (body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'replace', + body: body + }; if (body._id) { msg._id = body._id; @@ -919,66 +961,68 @@ class ApiBase { return this.send(msg); } - replaceUser(id, body) { + replaceUser (id, body) { return this.send({ - controller: "security", - action: "replaceUser", + controller: 'security', + action: 'replaceUser', _id: id, - body, + body }); } - revokeTokens(id) { + revokeTokens (id) { return this.send({ - controller: "security", - action: "revokeTokens", - _id: id, + controller: 'security', + action: 'revokeTokens', + _id: id }); } - scroll(scrollId, scroll) { - const msg = { - controller: "document", - action: "scroll", - scrollId, - scroll, - }; + scroll (scrollId, scroll) { + const + msg = { + controller: 'document', + action: 'scroll', + scrollId, + scroll + }; return this.send(msg); } - scrollProfiles(scrollId) { + scrollProfiles (scrollId) { return this.send({ - controller: "security", - action: "scrollProfiles", - scrollId, + controller: 'security', + action: 'scrollProfiles', + scrollId }); } - scrollSpecifications(scrollId) { + scrollSpecifications (scrollId) { return this.send({ - controller: "collection", - action: "scrollSpecifications", - scrollId, + controller: 'collection', + action: 'scrollSpecifications', + scrollId }); } - scrollUsers(scrollId) { + scrollUsers (scrollId) { return this.send({ - controller: "security", - action: "scrollUsers", - scrollId, + controller: 'security', + action: 'scrollUsers', + scrollId }); } - search(query, index, collection, args) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "search", - body: query, - }; + search (query, index, collection, args) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'search', + body: query + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -987,14 +1031,15 @@ class ApiBase { return this.send(msg); } - searchProfiles(roles, args) { - const msg = { - controller: "security", - action: "searchProfiles", - body: { - roles, - }, - }; + searchProfiles (roles, args) { + const + msg = { + controller: 'security', + action: 'searchProfiles', + body: { + roles + } + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -1003,12 +1048,13 @@ class ApiBase { return this.send(msg); } - searchRoles(body, args) { - const msg = { - controller: "security", - action: "searchRoles", - body, - }; + searchRoles (body, args) { + const + msg = { + controller: 'security', + action: 'searchRoles', + body + }; _.forEach(args, (item, k) => { msg[k] = item; @@ -1017,11 +1063,11 @@ class ApiBase { return this.send(msg); } - searchSpecifications(body, args) { + searchSpecifications (body, args) { let msg = { - controller: "collection", - action: "searchSpecifications", - body: body, + controller: 'collection', + action: 'searchSpecifications', + body: body }; if (args) { @@ -1031,13 +1077,13 @@ class ApiBase { return this.send(msg); } - searchUsers(query, args) { + searchUsers (query, args) { const msg = { - controller: "security", - action: "searchUsers", + controller: 'security', + action: 'searchUsers', body: { - query, - }, + query + } }; if (args) { @@ -1047,15 +1093,16 @@ class ApiBase { return this.send(msg); } - subscribe(filters, client, authentified = false) { - const msg = { - controller: "realtime", - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - action: "subscribe", - users: "all", - body: null, - }; + subscribe (filters, client, authentified = false) { + const + msg = { + controller: 'realtime', + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + action: 'subscribe', + users: 'all', + body: null + }; if (authentified) { msg.jwt = this.world.currentUser.token; @@ -1068,26 +1115,28 @@ class ApiBase { return this.sendAndListen(msg, client); } - truncateCollection(index, collection) { - const msg = { - controller: "collection", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "truncate", - }; + truncateCollection (index, collection) { + const + msg = { + controller: 'collection', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'truncate' + }; return this.send(msg); } - unsubscribe(room, clientId) { - const msg = { - clientId: clientId, - controller: "realtime", - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - action: "unsubscribe", - body: { roomId: room }, - }; + unsubscribe (room, clientId) { + const + msg = { + clientId: clientId, + controller: 'realtime', + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + action: 'unsubscribe', + body: { roomId: room } + }; this.subscribedRooms[clientId][room].close(); delete this.subscribedRooms[clientId]; @@ -1095,187 +1144,193 @@ class ApiBase { return this.send(msg, false); } - update(id, body, index, collection) { - const msg = { - controller: "document", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "update", - _id: id, - body: body, - }; + update (id, body, index, collection) { + const + msg = { + controller: 'document', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'update', + _id: id, + body: body + }; return this.send(msg); } - updateCredentials(strategy, userId, body) { + updateCredentials (strategy, userId, body) { return this.send({ - controller: "security", - action: "updateCredentials", + controller: 'security', + action: 'updateCredentials', strategy, body, - _id: userId, + _id: userId }); } - updateMapping(index, collection, mapping) { - const msg = { - controller: "collection", - collection: collection || this.world.fakeCollection, - index: index || this.world.fakeIndex, - action: "updateMapping", - body: mapping || this.world.mapping, - }; + updateMapping (index, collection, mapping) { + const + msg = { + controller: 'collection', + collection: collection || this.world.fakeCollection, + index: index || this.world.fakeIndex, + action: 'updateMapping', + body: mapping || this.world.mapping + }; return this.send(msg); } - updateMyCredentials(strategy, body) { + updateMyCredentials (strategy, body) { return this.send({ - controller: "auth", - action: "updateMyCredentials", + controller: 'auth', + action: 'updateMyCredentials', strategy, - body, + body }); } - updateProfileMapping() { - const msg = { - controller: "security", - action: "updateProfileMapping", - body: this.world.securitymapping, - }; + updateProfileMapping () { + const + msg = { + controller: 'security', + action: 'updateProfileMapping', + body: this.world.securitymapping + }; return this.send(msg); } - updateRoleMapping() { - const msg = { - controller: "security", - action: "updateRoleMapping", - body: this.world.securitymapping, - }; + updateRoleMapping () { + const + msg = { + controller: 'security', + action: 'updateRoleMapping', + body: this.world.securitymapping + }; return this.send(msg); } - updateSelf(body) { + updateSelf (body) { return this.send({ - controller: "auth", - action: "updateSelf", - body: body, + controller: 'auth', + action: 'updateSelf', + body: body }); } - updateSpecifications(index, collection, specifications) { + updateSpecifications (index, collection, specifications) { return this.send({ index, collection, - controller: "collection", - action: "updateSpecifications", - body: specifications, + controller: 'collection', + action: 'updateSpecifications', + body: specifications }); } - updateUserMapping() { - const msg = { - controller: "security", - action: "updateUserMapping", - body: this.world.securitymapping, - }; + updateUserMapping () { + const + msg = { + controller: 'security', + action: 'updateUserMapping', + body: this.world.securitymapping + }; return this.send(msg); } - validateCredentials(strategy, userId, body) { + validateCredentials (strategy, userId, body) { return this.send({ - controller: "security", - action: "validateCredentials", + controller: 'security', + action: 'validateCredentials', strategy, body, - _id: userId, + _id: userId }); } - validateDocument(index, collection, document) { + validateDocument (index, collection, document) { return this.create(document, index, collection); } - validateMyCredentials(strategy, body) { + validateMyCredentials (strategy, body) { return this.send({ - controller: "auth", - action: "validateMyCredentials", + controller: 'auth', + action: 'validateMyCredentials', strategy, - body, + body }); } - validateSpecifications(index, collection, specifications) { + validateSpecifications (index, collection, specifications) { return this.send({ index, collection, - controller: "collection", - action: "validateSpecifications", - body: specifications, + controller: 'collection', + action: 'validateSpecifications', + body: specifications }); } - resetCache(database) { + resetCache (database) { return this.send({ - controller: "admin", - action: "resetCache", - database, + controller: 'admin', + action: 'resetCache', + database }); } - resetKuzzleData() { + resetKuzzleData () { return this.send({ - controller: "admin", - action: "resetKuzzleData", + controller: 'admin', + action: 'resetKuzzleData' }); } - resetSecurity() { + resetSecurity () { return this.send({ - controller: "admin", - action: "resetSecurity", - refresh: "wait_for", + controller: 'admin', + action: 'resetSecurity', + refresh: 'wait_for' }); } - resetDatabase() { + resetDatabase () { return this.send({ - controller: "admin", - action: "resetDatabase", + controller: 'admin', + action: 'resetDatabase' }); } - loadMappings(body) { + loadMappings (body) { return this.send({ body, - controller: "admin", - action: "loadMappings", - refresh: "wait_for", + controller: 'admin', + action: 'loadMappings', + refresh: 'wait_for' }); } - loadFixtures(body) { + loadFixtures (body) { return this.send({ body, - controller: "admin", - action: "loadFixtures", - refresh: "wait_for", + controller: 'admin', + action: 'loadFixtures', + refresh: 'wait_for' }); } - loadSecurities(body) { + loadSecurities (body) { return this.send({ body, - controller: "admin", - action: "loadSecurities", - refresh: "wait_for", + controller: 'admin', + action: 'loadSecurities', + refresh: 'wait_for' }); } } + module.exports = ApiBase; diff --git a/features-legacy/support/api/http.js b/features-legacy/support/api/http.js index a20eb11f86..79bbf31b6b 100644 --- a/features-legacy/support/api/http.js +++ b/features-legacy/support/api/http.js @@ -1,60 +1,61 @@ -"use strict"; +'use strict'; -const zlib = require("zlib"); +const zlib = require('zlib'); -const _ = require("lodash"); -const rp = require("request-promise"); +const _ = require('lodash'); +const rp = require('request-promise'); -const routes = require("../../../lib/api/httpRoutes"); +const routes = require('../../../lib/api/httpRoutes'); -function checkAlgorithm(algorithm) { - const supported = ["identity", "gzip", "deflate"], - list = algorithm.split(",").map((a) => a.trim().toLowerCase()); +function checkAlgorithm (algorithm) { + const + supported = ['identity', 'gzip', 'deflate'], + list = algorithm.split(',').map(a => a.trim().toLowerCase()); for (const l of list) { - if (!supported.some((a) => a === l)) { + if (! supported.some(a => a === l)) { throw new Error(`Unsupported compression algorithm: ${l}`); } } } class HttpApi { - constructor(world) { + constructor (world) { this.world = world; this.baseUri = `http://${world.config.host}:${world.config.port}`; this.util = { - getIndex: (index) => - typeof index !== "string" ? this.world.fakeIndex : index, - getCollection: (collection) => - typeof collection !== "string" ? this.world.fakeCollection : collection, + getIndex: index => typeof index !== 'string' ? this.world.fakeIndex : index, + getCollection: collection => typeof collection !== 'string' ? this.world.fakeCollection : collection }; this.isRealtimeCapable = false; - this.encoding = "identity"; - this.expectedEncoding = "identity"; + this.encoding = 'identity'; + this.expectedEncoding = 'identity'; } - _getRequest(index, collection, controller, action, args) { - let url = "", + _getRequest (index, collection, controller, action, args) { + let + url = '', queryString = [], - verb = "GET", + verb = 'GET', result; - if (!args) { + if (! args) { args = {}; } - if (!args.body) { + if (! args.body) { if (args.args) { args.body = args.args; - } else { + } + else { args.body = {}; } } - routes.some((route) => { + routes.some(route => { const hits = []; // Try / Catch mechanism avoids to match routes that have not all @@ -63,65 +64,67 @@ class HttpApi { if (route.controller === controller && route.action === action) { verb = route.verb.toUpperCase(); - url = route.url - .replace(/(:[^/]+)/g, function (match) { - hits.push(match.substring(1)); + url = route.url.replace(/(:[^/]+)/g, function (match) { + hits.push(match.substring(1)); - if (match === ":index") { - if (!index) { - throw new Error("No index provided"); - } - return index; + if (match === ':index') { + if (! index) { + throw new Error('No index provided'); } - if (match === ":collection") { - if (!collection) { - throw new Error("No collection provided"); - } - return collection; + return index; + } + if (match === ':collection') { + if (! collection) { + throw new Error('No collection provided'); } + return collection; + } - if (match === ":_id") { - if (args._id) { - return args._id; - } - if (args.body._id) { - return args.body._id; - } - throw new Error("No _id provided"); + if (match === ':_id') { + if (args._id) { + return args._id; } - - if (args.body[match.substring(1)] !== undefined) { - return args.body[match.substring(1)]; + if (args.body._id) { + return args.body._id; } + throw new Error('No _id provided'); + } + + if (args.body[match.substring(1)] !== undefined) { + return args.body[match.substring(1)]; + } - return ""; - }) - .substring(1); + return ''; + }).substring(1); // add extra aguments in the query string - if (verb === "GET") { - _.difference(Object.keys(args.body), hits).forEach((key) => { + if (verb === 'GET') { + _.difference(Object.keys(args.body), hits).forEach(key => { const value = args.body[key]; if (value !== undefined) { if (Array.isArray(value)) { - queryString.push(...value.map((v) => `${key}=${v}`)); - } else { + queryString.push(...value.map(v => `${key}=${v}`)); + } + else { queryString.push(`${key}=${value}`); } } }); if (queryString.length) { - url += "?" + queryString.join("&"); + url += '?' + queryString.join('&'); } } - url = url.replace(/\/\//g, "/").replace(/\/$/, ""); + url = url + .replace(/\/\//g, '/') + .replace(/\/$/, ''); return true; } - } catch (error) { + } + catch (error) { return false; } @@ -130,75 +133,66 @@ class HttpApi { result = { url: this.apiPath(url), - method: verb, + method: verb }; - if (verb !== "GET") { + if (verb !== 'GET') { result.body = args.body; } return result; } - apiBasePath(path) { + apiBasePath (path) { return this.apiPath(path); } - apiPath(path) { - return path.startsWith("/") + apiPath (path) { + return path.startsWith('/') ? encodeURI(`${this.baseUri}${path}`) : encodeURI(`${this.baseUri}/${path}`); } - adminResetDatabase() { + adminResetDatabase () { const options = { - url: this.apiPath("/admin/_resetDatabase/"), - method: "POST", + url: this.apiPath('/admin/_resetDatabase/'), + method: 'POST' }; return this.callApi(options); } - serverPublicApi() { + serverPublicApi () { const options = { - url: this.apiPath("/_publicApi"), - method: "GET", + url: this.apiPath('/_publicApi'), + method: 'GET' }; return this.callApi(options); } - bulkImport(bulk, index) { + bulkImport (bulk, index) { const options = { - url: this.apiPath( - this.util.getIndex(index) + "/" + this.world.fakeCollection + "/_bulk" - ), - method: "POST", - body: { bulkData: bulk }, + url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/_bulk'), + method: 'POST', + body: { bulkData: bulk } }; return this.callApi(options); } - bulkMWrite(index, collection, body) { + bulkMWrite (index, collection, body) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mWrite" - ), - method: "POST", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mWrite'), + method: 'POST', + body }; return this.callApi(options); } - bulkWrite(index, collection, body, _id = null) { - let url = `${this.util.getIndex(index)}/${this.util.getCollection( - collection - )}/_write`; + bulkWrite (index, collection, body, _id = null) { + let url = `${this.util.getIndex(index)}/${this.util.getCollection(collection)}/_write`; if (_id) { url += `?_id=${_id}`; @@ -206,8 +200,8 @@ class HttpApi { const options = { url: this.apiPath(url), - method: "POST", - body, + method: 'POST', + body }; return this.callApi(options); @@ -217,8 +211,8 @@ class HttpApi { * @param options * @returns {Promise.} */ - async callApi(options) { - if (!options.headers) { + async callApi (options) { + if (! options.headers) { options.headers = {}; } @@ -228,27 +222,27 @@ class HttpApi { }); } - if (options.body && this.encoding !== "identity") { + if (options.body && this.encoding !== 'identity') { options.body = JSON.stringify(options.body); - options.headers["content-encoding"] = this.encoding; + options.headers['content-encoding'] = this.encoding; - const algorithms = this.encoding - .split(",") - .map((a) => a.trim().toLowerCase()); + const algorithms = this.encoding.split(',').map(a => a.trim().toLowerCase()); for (const algorithm of algorithms) { - if (algorithm === "gzip") { + if (algorithm === 'gzip') { options.body = zlib.gzipSync(options.body); - } else if (algorithm === "deflate") { + } + else if (algorithm === 'deflate') { options.body = zlib.deflateSync(options.body); } } - } else { + } + else { options.json = true; } - if (this.expectedEncoding !== "identity") { - options.headers["accept-encoding"] = this.expectedEncoding; + if (this.expectedEncoding !== 'identity') { + options.headers['accept-encoding'] = this.expectedEncoding; // despite the name, that options asks "request" to handle // both gzip or deflate compressed responses @@ -261,23 +255,23 @@ class HttpApi { // we need to manually parse the stringified json if // we sent a compressed buffer through the request module - if (options.body && this.encoding !== "identity") { + if (options.body && this.encoding !== 'identity') { return JSON.parse(response); } return response; } - callMemoryStorage(command, args) { - return this.callApi(this._getRequest(null, null, "ms", command, args)); + callMemoryStorage (command, args) { + return this.callApi(this._getRequest(null, null, 'ms', command, args)); } - checkToken(token) { + checkToken (token) { let _token = null; const request = { - url: this.apiPath("_checkToken"), - method: "POST", - body: { token }, + url: this.apiPath('_checkToken'), + method: 'POST', + body: { token } }; if (this.world.currentUser && this.world.currentUser.token) { @@ -286,14 +280,14 @@ class HttpApi { } return this.callApi(request) - .then((response) => { + .then(response => { if (_token !== null) { this.world.currentUser.token = _token; } return response; }) - .catch((error) => { + .catch(error => { if (_token !== null) { this.world.currentUser.token = _token; } @@ -302,98 +296,78 @@ class HttpApi { }); } - collectionExists(index, collection) { - return this.callApi( - this._getRequest(index, collection, "collection", "exists") - ); + collectionExists (index, collection) { + return this.callApi(this._getRequest(index, collection, 'collection', 'exists')); } - count(query, index, collection) { + count (query, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_count" - ), - method: "POST", - body: query, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_count'), + method: 'POST', + body: query }; return this.callApi(options); } - create(body, index, collection, jwtToken, id) { - const url = id - ? this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/" + - id + - "/_create" - ) - : this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_create" - ), + create (body, index, collection, jwtToken, id) { + const + url = id + ? this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + id + '/_create') + : this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_create'), options = { url: url, - method: "POST", - body, + method: 'POST', + body }; if (jwtToken) { options.headers = { - authorization: "Bearer " + jwtToken, + authorization: 'Bearer ' + jwtToken }; } return this.callApi(options); } - createCollection(index, collection, mappings) { + createCollection (index, collection, mappings) { index = index || this.world.fakeIndex; const options = { url: this.apiPath(`${index}/${collection}`), - method: "PUT", - body: mappings, + method: 'PUT', + body: mappings }; return this.callApi(options); } - getCollectionMapping(index, collection, includeKuzzleMeta = false) { - const url = `${index}/${collection}/_mapping${ - includeKuzzleMeta ? "?includeKuzzleMeta" : "" - }`; + getCollectionMapping (index, collection, includeKuzzleMeta = false) { + const url = `${index}/${collection}/_mapping${includeKuzzleMeta ? '?includeKuzzleMeta' : ''}`; const options = { url: this.apiPath(url), - method: "GET", + method: 'GET' }; return this.callApi(options); } - createCredentials(strategy, userId, body) { + createCredentials (strategy, userId, body) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId + "/_create"), - method: "POST", - body, + url: this.apiPath('credentials/' + strategy + '/' + userId + '/_create'), + method: 'POST', + body }; return this.callApi(options); } - createFirstAdmin(body, id, reset) { + createFirstAdmin (body, id, reset) { const options = { - url: this.apiPath("_createFirstAdmin"), - method: "POST", - body, + url: this.apiPath('_createFirstAdmin'), + method: 'POST', + body }; if (id !== undefined) { @@ -401,42 +375,36 @@ class HttpApi { } if (reset) { - options.url += "?reset=1"; + options.url += '?reset=1'; } return this.callApi(options); } - createIndex(index) { + createIndex (index) { const options = { - url: this.apiPath(index + "/_create"), - method: "POST", + url: this.apiPath(index + '/_create'), + method: 'POST' }; return this.callApi(options); } - createMyCredentials(strategy, body) { + createMyCredentials (strategy, body) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me/_create"), - method: "POST", - body, + url: this.apiPath('credentials/' + strategy + '/_me/_create'), + method: 'POST', + body }; return this.callApi(options); } - createOrReplace(body, index, collection) { + createOrReplace (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/" + - body._id - ), - method: "PUT", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + body._id), + method: 'PUT', + body }; delete body._id; @@ -444,610 +412,543 @@ class HttpApi { return this.callApi(options); } - createOrReplaceProfile(id, body) { + createOrReplaceProfile (id, body) { const options = { - url: this.apiPath("profiles/" + id), - method: "PUT", - body, + url: this.apiPath('profiles/' + id), + method: 'PUT', + body }; return this.callApi(options); } - createOrReplaceRole(id, body) { + createOrReplaceRole (id, body) { const options = { - url: this.apiPath("roles/" + id), - method: "PUT", - body, + url: this.apiPath('roles/' + id), + method: 'PUT', + body }; return this.callApi(options); } - createRestrictedUser(body, id) { + createRestrictedUser (body, id) { const options = { - url: this.apiPath("users/" + id + "/_createRestricted"), - method: "POST", - body, + url: this.apiPath('users/' + id + '/_createRestricted'), + method: 'POST', + body }; return this.callApi(options); } - createUser(body, id) { + createUser (body, id) { const options = { - url: this.apiPath("users/" + id + "/_create" + "?refresh=wait_for"), - method: "POST", - body, + url: this.apiPath('users/' + id + '/_create' + '?refresh=wait_for'), + method: 'POST', + body }; return this.callApi(options); } - credentialsExist(strategy) { + credentialsExist (strategy) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me/_exists"), - method: "GET", + url: this.apiPath('credentials/' + strategy + '/_me/_exists'), + method: 'GET' }; return this.callApi(options); } - deleteById(id, index) { + deleteById (id, index) { const options = { - url: this.apiPath( - this.util.getIndex(index) + "/" + this.world.fakeCollection + "/" + id - ), - method: "DELETE", + url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id), + method: 'DELETE' }; return this.callApi(options); } - deleteByQuery(query, index, collection) { + deleteByQuery (query, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_query" - ), - method: "DELETE", - body: query, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_query'), + method: 'DELETE', + body: query }; return this.callApi(options); } - deleteCredentials(strategy, userId) { + deleteCredentials (strategy, userId) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId), - method: "DELETE", + url: this.apiPath('credentials/' + strategy + '/' + userId), + method: 'DELETE' }; return this.callApi(options); } - deleteIndex(index) { + deleteIndex (index) { const options = { url: this.apiPath(index), - method: "DELETE", + method: 'DELETE' }; return this.callApi(options); } - deleteIndexes() { + deleteIndexes () { const options = { - url: this.apiPath("_mDelete"), - method: "DELETE", + url: this.apiPath('_mDelete'), + method: 'DELETE' }; return this.callApi(options); } - deleteMyCredentials(strategy) { + deleteMyCredentials (strategy) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me"), - method: "DELETE", + url: this.apiPath('credentials/' + strategy + '/_me'), + method: 'DELETE' }; return this.callApi(options); } - deleteProfile(id, waitFor = false) { + deleteProfile (id, waitFor = false) { return this.callApi({ - url: this.apiPath( - "profiles/" + id + (waitFor ? "?refresh=wait_for" : "") - ), - method: "DELETE", + url: this.apiPath('profiles/' + id + (waitFor ? '?refresh=wait_for' : '')), + method: 'DELETE' }); } - deleteProfiles(ids, waitFor = false) { + deleteProfiles (ids, waitFor = false) { return this.callApi({ - url: this.apiPath( - "profiles/_mDelete" + (waitFor ? "?refresh=wait_for" : "") - ), - method: "POST", + url: this.apiPath('profiles/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), + method: 'POST', body: { - ids, - }, + ids + } }); } - deleteRole(id, waitFor = false) { + deleteRole (id, waitFor = false) { return this.callApi({ - url: this.apiPath("roles/" + id + (waitFor ? "?refresh=wait_for" : "")), - method: "DELETE", + url: this.apiPath('roles/' + id + (waitFor ? '?refresh=wait_for' : '')), + method: 'DELETE' }); } - deleteRoles(ids, waitFor = false) { + deleteRoles (ids, waitFor = false) { return this.callApi({ - url: this.apiPath( - "roles/_mDelete" + (waitFor ? "?refresh=wait_for" : "") - ), - method: "POST", + url: this.apiPath('roles/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), + method: 'POST', body: { - ids, - }, + ids + } }); } - deleteSpecifications(index, collection) { + deleteSpecifications (index, collection) { const options = { - url: this.apiPath(index + "/" + collection + "/_specifications"), - method: "DELETE", + url: this.apiPath(index + '/' + collection + '/_specifications'), + method: 'DELETE' }; return this.callApi(options); } - deleteUser(id, waitFor = false) { + deleteUser (id, waitFor = false) { return this.callApi({ - url: this.apiPath("users/" + id + (waitFor ? "?refresh=wait_for" : "")), - method: "DELETE", + url: this.apiPath('users/' + id + (waitFor ? '?refresh=wait_for' : '')), + method: 'DELETE' }); } - deleteUsers(ids, waitFor = false) { + deleteUsers (ids, waitFor = false) { return this.callApi({ - url: this.apiPath( - "users/_mDelete" + (waitFor ? "?refresh=wait_for" : "") - ), - method: "POST", + url: this.apiPath('users/_mDelete' + (waitFor ? '?refresh=wait_for' : '')), + method: 'POST', body: { - ids, - }, + ids + } }); } - disconnect() {} + disconnect () {} - exists(id, index) { + exists (id, index) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.world.fakeCollection + - "/" + - id + - "/_exists" - ), - method: "GET", + url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id + '/_exists'), + method: 'GET' }; return this.callApi(options); } - get(id, index) { + get (id, index) { const options = { - url: this.apiPath( - this.util.getIndex(index) + "/" + this.world.fakeCollection + "/" + id - ), - method: "GET", + url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/' + id), + method: 'GET' }; return this.callApi(options); } - getAllStats() { + getAllStats () { const options = { - url: this.apiPath("_getAllStats"), - method: "GET", + url: this.apiPath('_getAllStats'), + method: 'GET' }; return this.callApi(options); } - getAuthenticationStrategies() { + getAuthenticationStrategies () { const options = { - url: this.apiPath("strategies"), - method: "GET", + url: this.apiPath('strategies'), + method: 'GET' }; return this.callApi(options); } - getCredentials(strategy, userId) { + getCredentials (strategy, userId) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId), - method: "GET", + url: this.apiPath('credentials/' + strategy + '/' + userId), + method: 'GET' }; return this.callApi(options); } - getCredentialsById(strategy, userId) { + getCredentialsById (strategy, userId) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId + "/_byId"), - method: "GET", + url: this.apiPath('credentials/' + strategy + '/' + userId + '/_byId'), + method: 'GET' }; return this.callApi(options); } - getCurrentUser() { + getCurrentUser () { return this.callApi({ - url: this.apiPath("users/_me"), - method: "GET", + url: this.apiPath('users/_me'), + method: 'GET' }); } - getLastStats() { + getLastStats () { const options = { - url: this.apiPath("_getLastStats"), - method: "GET", + url: this.apiPath('_getLastStats'), + method: 'GET' }; return this.callApi(options); } - getMyCredentials(strategy) { + getMyCredentials (strategy) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me"), - method: "GET", + url: this.apiPath('credentials/' + strategy + '/_me'), + method: 'GET' }; return this.callApi(options); } - getMyRights() { + getMyRights () { const options = { - url: this.apiPath("users/_me/_rights"), - method: "GET", + url: this.apiPath('users/_me/_rights'), + method: 'GET' }; return this.callApi(options); } - getProfile(id) { + getProfile (id) { const options = { - url: this.apiPath("profiles/" + id), - method: "GET", + url: this.apiPath('profiles/' + id), + method: 'GET' }; return this.callApi(options); } - getProfileMapping() { + getProfileMapping () { const options = { - url: this.apiPath("/profiles/_mapping"), - method: "GET", + url: this.apiPath('/profiles/_mapping'), + method: 'GET' }; return this.callApi(options); } - getProfileRights(id) { + getProfileRights (id) { const options = { - url: this.apiPath("profiles/" + id + "/_rights"), - method: "GET", + url: this.apiPath('profiles/' + id + '/_rights'), + method: 'GET' }; return this.callApi(options); } - getRole(id) { + getRole (id) { const options = { - url: this.apiPath("roles/" + id), - method: "GET", + url: this.apiPath('roles/' + id), + method: 'GET' }; return this.callApi(options); } - getRoleMapping() { + getRoleMapping () { const options = { - url: this.apiPath("/roles/_mapping"), - method: "GET", + url: this.apiPath('/roles/_mapping'), + method: 'GET' }; return this.callApi(options); } - getSpecifications(index, collection) { + getSpecifications (index, collection) { const options = { - url: this.apiPath(index + "/" + collection + "/_specifications"), - method: "GET", + url: this.apiPath(index + '/' + collection + '/_specifications'), + method: 'GET' }; return this.callApi(options); } - getStats(dates) { - return this.callApi( - this._getRequest(null, null, "server", "getStats", { body: dates }) - ); + getStats (dates) { + return this.callApi(this._getRequest(null, null, 'server', 'getStats', { body: dates })); } - getUser(id) { + getUser (id) { const options = { - url: this.apiPath("users/" + id), - method: "GET", + url: this.apiPath('users/' + id), + method: 'GET' }; return this.callApi(options); } - getUserMapping() { + getUserMapping () { const options = { - url: this.apiPath("/users/_mapping"), - method: "GET", + url: this.apiPath('/users/_mapping'), + method: 'GET' }; return this.callApi(options); } - getUserRights(id) { + getUserRights (id) { const options = { - url: this.apiPath("users/" + id + "/_rights"), - method: "GET", + url: this.apiPath('users/' + id + '/_rights'), + method: 'GET' }; return this.callApi(options); } - hasCredentials(strategy, userId) { + hasCredentials (strategy, userId) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId + "/_exists"), - method: "GET", + url: this.apiPath('credentials/' + strategy + '/' + userId + '/_exists'), + method: 'GET' }; return this.callApi(options); } - indexExists(index) { - return this.callApi(this._getRequest(index, null, "index", "exists")); + indexExists (index) { + return this.callApi(this._getRequest(index, null, 'index', 'exists')); } - refreshCollection(index, collection) { - const _index = index || this.world.fakeIndex, + refreshCollection (index, collection) { + const + _index = index || this.world.fakeIndex, _collection = collection || this.world.fakeCollection, options = { url: this.apiPath(`${_index}/${_collection}/_refresh`), - method: "POST", + method: 'POST' }; return this.callApi(options); } - listCollections(index, type) { + listCollections (index, type) { const options = { url: this.apiPath(`${index || this.world.fakeIndex}/_list`), - method: "GET", + method: 'GET' }; if (type) { - options.url += "?type=" + type; + options.url += '?type=' + type; } return this.callApi(options); } - listIndexes() { + listIndexes () { const options = { - url: this.apiPath("_list"), - method: "GET", + url: this.apiPath('_list'), + method: 'GET' }; return this.callApi(options); } - login(strategy, credentials) { + login (strategy, credentials) { const options = { url: this.apiPath(`_login/${strategy}`), - method: "POST", + method: 'POST', body: { username: credentials.username, - password: credentials.password, - }, + password: credentials.password + } }; return this.callApi(options); } - logout(jwtToken) { + logout (jwtToken) { const options = { - url: this.apiPath("_logout"), - method: "POST", + url: this.apiPath('_logout'), + method: 'POST', headers: { - authorization: "Bearer " + jwtToken, - }, + authorization: 'Bearer ' + jwtToken + } }; return this.callApi(options); } - mCreate(body, index, collection, jwtToken) { + mCreate (body, index, collection, jwtToken) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mCreate" - ), - method: "POST", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mCreate'), + method: 'POST', + body }; if (jwtToken) { options.headers = { - authorization: "Bearer " + jwtToken, + authorization: 'Bearer ' + jwtToken }; } return this.callApi(options); } - mCreateOrReplace(body, index, collection) { + mCreateOrReplace (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mCreateOrReplace" - ), - method: "PUT", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mCreateOrReplace'), + method: 'PUT', + body }; return this.callApi(options); } - mDelete(body, index, collection) { + mDelete (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mDelete" - ), - method: "DELETE", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mDelete'), + method: 'DELETE', + body }; return this.callApi(options); } - mGet(body, index, collection) { + mGet (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mGet" - ), - method: "POST", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mGet'), + method: 'POST', + body }; return this.callApi(options); } - mGetProfiles(body) { + mGetProfiles (body) { const options = { - url: this.apiPath("profiles/_mGet"), - method: "POST", - body, + url: this.apiPath('profiles/_mGet'), + method: 'POST', + body }; return this.callApi(options); } - mGetRoles(body) { + mGetRoles (body) { const options = { - url: this.apiPath("roles/_mGet"), - method: "POST", - body, + url: this.apiPath('roles/_mGet'), + method: 'POST', + body }; return this.callApi(options); } - mReplace(body, index, collection) { + mReplace (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mReplace" - ), - method: "PUT", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mReplace'), + method: 'PUT', + body }; return this.callApi(options); } - mUpdate(body, index, collection) { + mUpdate (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_mUpdate" - ), - method: "PUT", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_mUpdate'), + method: 'PUT', + body }; return this.callApi(options); } - now() { + now () { const options = { - url: this.apiPath("_now"), - method: "GET", + url: this.apiPath('_now'), + method: 'GET' }; return this.callApi(options); } - postDocument(index, collection, document) { + postDocument (index, collection, document) { const options = { - url: this.apiPath(index + "/" + collection + "/_create"), - method: "POST", - body: document, + url: this.apiPath(index + '/' + collection + '/_create'), + method: 'POST', + body: document }; return this.callApi(options); } - publish(body, index) { + publish (body, index) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.world.fakeCollection + - "/_publish" - ), - method: "POST", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.world.fakeCollection + '/_publish'), + method: 'POST', + body }; return this.callApi(options); } - refreshToken() { + refreshToken () { return this.callApi({ - url: this.apiPath("_refreshToken"), - method: "POST", + url: this.apiPath('_refreshToken'), + method: 'POST' }); } - replace(body, index, collection) { + replace (body, index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/" + - body._id + - "/_replace" - ), - method: "PUT", - body, + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/' + body._id + '/_replace'), + method: 'PUT', + body }; delete body._id; @@ -1055,106 +956,102 @@ class HttpApi { return this.callApi(options); } - replaceUser(id, body) { + replaceUser (id, body) { return this.callApi({ - url: this.apiPath("users/" + id + "/_replace"), - method: "PUT", - body, + url: this.apiPath('users/' + id + '/_replace'), + method: 'PUT', + body }); } - revokeTokens(id) { + revokeTokens (id) { return this.callApi({ url: this.apiPath(`users/${id}/tokens`), - method: "DELETE", + method: 'DELETE' }); } - scroll(scrollId, scroll) { + scroll (scrollId, scroll) { const options = { url: this.apiPath(`_scroll/${scrollId}`), - method: "GET", + method: 'GET' }; if (scroll) { - options.url += "?scroll=" + scroll; + options.url += '?scroll=' + scroll; } return this.callApi(options); } - scrollProfiles(scrollId) { + scrollProfiles (scrollId) { const options = { - url: this.apiPath("profiles/_scroll/" + scrollId), - method: "GET", + url: this.apiPath('profiles/_scroll/' + scrollId), + method: 'GET' }; return this.callApi(options); } - scrollSpecifications(scrollId) { + scrollSpecifications (scrollId) { const options = { - url: this.apiPath("validations/_scroll/" + scrollId), - method: "GET", + url: this.apiPath('validations/_scroll/' + scrollId), + method: 'GET' }; return this.callApi(options); } - scrollUsers(scrollId) { + scrollUsers (scrollId) { const options = { - url: this.apiPath("users/_scroll/" + scrollId), - method: "GET", + url: this.apiPath('users/_scroll/' + scrollId), + method: 'GET' }; return this.callApi(options); } - search(query, index, collection, args) { - const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_search" - ), - method: "POST", - body: query, - }; + search (query, index, collection, args) { + const + options = { + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_search'), + method: 'POST', + body: query + }; if (args) { let qs = []; - options.url += "?"; + options.url += '?'; if (args.scroll) { - qs.push("scroll=" + args.scroll); + qs.push('scroll=' + args.scroll); } if (args.from) { - qs.push("from=" + args.from); + qs.push('from=' + args.from); } if (args.size) { - qs.push("size=" + args.size); + qs.push('size=' + args.size); } - options.url += qs.join("&"); + options.url += qs.join('&'); } return this.callApi(options); } - searchProfiles(roles, args) { + searchProfiles (roles, args) { const options = { - url: this.apiPath("profiles/_search"), - method: "POST", + url: this.apiPath('profiles/_search'), + method: 'POST', body: { - roles, - }, + roles + } }; if (args) { let first = true; - Object.keys(args).forEach((arg) => { - options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; + Object.keys(args).forEach(arg => { + options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; first = false; }); } @@ -1162,41 +1059,41 @@ class HttpApi { return this.callApi(options); } - searchRoles(body, args) { + searchRoles (body, args) { const options = { - url: this.apiPath("roles/_search"), - method: "POST", - body, + url: this.apiPath('roles/_search'), + method: 'POST', + body }; if (args) { let qs = []; - options.url += "?"; + options.url += '?'; if (args.from) { - qs.push("from=" + args.from); + qs.push('from=' + args.from); } if (args.size) { - qs.push("size=" + args.size); + qs.push('size=' + args.size); } - options.url += qs.join("&"); + options.url += qs.join('&'); } return this.callApi(options); } - searchSpecifications(body, args) { + searchSpecifications (body, args) { const options = { - url: this.apiPath("validations/_search"), - method: "POST", - body, + url: this.apiPath('validations/_search'), + method: 'POST', + body }; if (args) { let first = true; - Object.keys(args).forEach((arg) => { - options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; + Object.keys(args).forEach(arg => { + options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; first = false; }); } @@ -1204,19 +1101,19 @@ class HttpApi { return this.callApi(options); } - searchUsers(query, args) { + searchUsers (query, args) { const options = { - url: this.apiPath("users/_search"), - method: "POST", + url: this.apiPath('users/_search'), + method: 'POST', body: { - query, - }, + query + } }; if (args) { let first = true; - Object.keys(args).forEach((arg) => { - options.url += (first ? "?" : "&") + `${arg}=${args[arg]}`; + Object.keys(args).forEach(arg => { + options.url += (first ? '?' : '&') + `${arg}=${args[arg]}`; first = false; }); } @@ -1224,28 +1121,22 @@ class HttpApi { return this.callApi(options); } - truncateCollection(index, collection) { + truncateCollection (index, collection) { const options = { - url: this.apiPath( - this.util.getIndex(index) + - "/" + - this.util.getCollection(collection) + - "/_truncate" - ), - method: "DELETE", + url: this.apiPath(this.util.getIndex(index) + '/' + this.util.getCollection(collection) + '/_truncate'), + method: 'DELETE' }; return this.callApi(options); } - update(id, body, index, collection) { - const _collection = collection || this.world.fakeCollection, + update (id, body, index, collection) { + const + _collection = collection || this.world.fakeCollection, options = { - url: this.apiPath( - `${this.util.getIndex(index)}/${_collection}/${id}/_update` - ), - method: "PUT", - body, + url: this.apiPath(`${this.util.getIndex(index)}/${_collection}/${id}/_update`), + method: 'PUT', + body }; delete body._id; @@ -1253,230 +1144,218 @@ class HttpApi { return this.callApi(options); } - updateCredentials(strategy, userId, body) { + updateCredentials (strategy, userId, body) { const options = { - url: this.apiPath("credentials/" + strategy + "/" + userId + "/_update"), - method: "PUT", - body, + url: this.apiPath('credentials/' + strategy + '/' + userId + '/_update'), + method: 'PUT', + body }; return this.callApi(options); } - updateProfileMapping() { + updateProfileMapping () { const options = { - url: this.apiPath("/profiles/_mapping"), - method: "PUT", - body: this.world.securitymapping, + url: this.apiPath('/profiles/_mapping'), + method: 'PUT', + body: this.world.securitymapping }; return this.callApi(options); } - updateMapping(index, collection, mapping) { + updateMapping (index, collection, mapping) { const options = { - url: `${this.apiPath(this.util.getIndex(index))}/${ - collection || this.world.fakeCollection - }/_mapping`, - method: "PUT", - body: mapping || this.world.mapping, + url: `${this.apiPath(this.util.getIndex(index))}/${collection || this.world.fakeCollection}/_mapping`, + method: 'PUT', + body: mapping || this.world.mapping }; return this.callApi(options); } - updateMyCredentials(strategy, body) { + updateMyCredentials (strategy, body) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me/_update"), - method: "PUT", - body, + url: this.apiPath('credentials/' + strategy + '/_me/_update'), + method: 'PUT', + body }; return this.callApi(options); } - updateRoleMapping() { + updateRoleMapping () { const options = { - url: this.apiPath("/roles/_mapping"), - method: "PUT", - body: this.world.securitymapping, + url: this.apiPath('/roles/_mapping'), + method: 'PUT', + body: this.world.securitymapping }; return this.callApi(options); } - updateSelf(body) { + updateSelf (body) { const options = { - url: this.apiPath("_updateSelf"), - method: "PUT", - body, + url: this.apiPath('_updateSelf'), + method: 'PUT', + body }; return this.callApi(options); } - updateSpecifications(index, collection, specifications) { + updateSpecifications (index, collection, specifications) { const options = { url: this.apiPath(`${index}/${collection}/_specifications`), - method: "PUT", - body: specifications, + method: 'PUT', + body: specifications }; return this.callApi(options); } - updateUserMapping() { + updateUserMapping () { const options = { - url: this.apiPath("/users/_mapping"), - method: "PUT", - body: this.world.securitymapping, + url: this.apiPath('/users/_mapping'), + method: 'PUT', + body: this.world.securitymapping }; return this.callApi(options); } - validateCredentials(strategy, userId, body) { + validateCredentials (strategy, userId, body) { const options = { - url: this.apiPath( - "credentials/" + strategy + "/" + userId + "/_validate" - ), - method: "POST", - body, + url: this.apiPath('credentials/' + strategy + '/' + userId + '/_validate'), + method: 'POST', + body }; return this.callApi(options); } - validateDocument(index, collection, document) { + validateDocument (index, collection, document) { const options = { - url: this.apiPath(index + "/" + collection + "/_validate"), - method: "POST", - body: document, + url: this.apiPath(index + '/' + collection + '/_validate'), + method: 'POST', + body: document }; return this.callApi(options); } - validateMyCredentials(strategy, body) { + validateMyCredentials (strategy, body) { const options = { - url: this.apiPath("credentials/" + strategy + "/_me/_validate"), - method: "POST", - body, + url: this.apiPath('credentials/' + strategy + '/_me/_validate'), + method: 'POST', + body }; return this.callApi(options); } - validateSpecifications(index, collection, specifications) { + validateSpecifications (index, collection, specifications) { const options = { - url: this.apiPath( - index - ? `${index}/${collection}/_validateSpecifications` - : "_validateSpecifications" - ), - method: "POST", - body: specifications, + url: this.apiPath(index ? `${index}/${collection}/_validateSpecifications` : '_validateSpecifications'), + method: 'POST', + body: specifications }; return this.callApi(options); } - resetCache(database) { + resetCache (database) { const options = { url: this.apiPath(`admin/_resetCache/${database}`), - method: "POST", + method: 'POST' }; return this.callApi(options); } - resetKuzzleData() { + resetKuzzleData () { const options = { - url: this.apiPath("admin/_resetKuzzleData"), - method: "POST", + url: this.apiPath('admin/_resetKuzzleData'), + method: 'POST' }; return this.callApi(options); } - resetSecurity() { + resetSecurity () { const options = { - url: this.apiPath("admin/_resetSecurity"), - method: "POST", + url: this.apiPath('admin/_resetSecurity'), + method: 'POST', body: { - refresh: "wait_for", - }, + refresh: 'wait_for' + } }; return this.callApi(options); } - resetDatabase() { + resetDatabase () { const options = { - url: this.apiPath("admin/_resetDatabase"), - method: "POST", + url: this.apiPath('admin/_resetDatabase'), + method: 'POST' }; return this.callApi(options); } - loadMappings(body) { + loadMappings (body) { const options = { - url: this.apiPath("admin/_loadMappings?refresh=wait_for"), - method: "POST", - body, + url: this.apiPath('admin/_loadMappings?refresh=wait_for'), + method: 'POST', + body }; return this.callApi(options); } - loadFixtures(body) { + loadFixtures (body) { const options = { - url: this.apiPath("admin/_loadFixtures?refresh=wait_for"), - method: "POST", - body, + url: this.apiPath('admin/_loadFixtures?refresh=wait_for'), + method: 'POST', + body }; return this.callApi(options); } - loadSecurities(body) { + loadSecurities (body) { const options = { - url: this.apiPath("admin/_loadSecurities?refresh=wait_for"), - method: "POST", - body, + url: this.apiPath('admin/_loadSecurities?refresh=wait_for'), + method: 'POST', + body }; return this.callApi(options); } - encode(algorithm) { + encode (algorithm) { checkAlgorithm(algorithm); this.encoding = algorithm; } - decode(algorithm) { + decode (algorithm) { checkAlgorithm(algorithm); this.expectedEncoding = algorithm; } - urlEncodedCreate(form) { + urlEncodedCreate (form) { return this.callApi({ form, - method: "POST", - url: this.apiPath( - `${this.world.fakeIndex}/${this.world.fakeCollection}/_create` - ), + method: 'POST', + url: this.apiPath(`${this.world.fakeIndex}/${this.world.fakeCollection}/_create`), }); } - multipartCreate(formData) { + multipartCreate (formData) { return this.callApi({ formData, - method: "POST", - url: this.apiPath( - `${this.world.fakeIndex}/${this.world.fakeCollection}/_create` - ), + method: 'POST', + url: this.apiPath(`${this.world.fakeIndex}/${this.world.fakeCollection}/_create`), }); } } diff --git a/features-legacy/support/api/mqtt.js b/features-legacy/support/api/mqtt.js index 2cbccfac5c..a2b8fa7753 100644 --- a/features-legacy/support/api/mqtt.js +++ b/features-legacy/support/api/mqtt.js @@ -1,12 +1,13 @@ -"use strict"; +'use strict'; -const Bluebird = require("bluebird"), - ApiBase = require("./apiBase"), - mqtt = require("mqtt"), - uuid = require("uuid"); +const + Bluebird = require('bluebird'), + ApiBase = require('./apiBase'), + mqtt = require('mqtt'), + uuid = require('uuid'); class MqttApi extends ApiBase { - constructor(world) { + constructor (world) { super(world); this.clients = {}; @@ -14,14 +15,14 @@ class MqttApi extends ApiBase { this.subscribedRooms = {}; } - disconnect() { + disconnect () { for (const k of Object.keys(this.clients)) { this.clients[k].end(); } } - send(msg, getAnswer = true, clientName = "client1") { - if (!msg.requestId) { + send (msg, getAnswer = true, clientName = 'client1') { + if (! msg.requestId) { msg.requestId = uuid.v4(); } @@ -31,75 +32,75 @@ class MqttApi extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._getClient(clientName).then((client) => { - let promise = Bluebird.resolve({}); - if (getAnswer) { - promise = new Bluebird((resolve, reject) => { - this.requests[msg.requestId] = (result) => { - if (!result) { - const error = new Error("Returned result is null"); - return reject(Object.assign(error, msg)); - } - - if (result.error && result.status !== 206) { - const error = new Error(result.error.stack); - Object.assign(error, result); + return this._getClient(clientName) + .then(client => { + let promise = Bluebird.resolve({}); + if (getAnswer) { + promise = new Bluebird((resolve, reject) => { + this.requests[msg.requestId] = result => { + if (! result) { + const error = new Error('Returned result is null'); + return reject(Object.assign(error, msg)); + } + + if (result.error && result.status !== 206) { + const error = new Error(result.error.stack); + Object.assign(error, result); + + // used to fit with rest api (used with request-promise) + error.details = result.error._source || {}; + error.statusCode = result.status; + return reject(error); + } + + resolve(result); + }; + }); + } - // used to fit with rest api (used with request-promise) - error.details = result.error._source || {}; - error.statusCode = result.status; - return reject(error); - } + client.publish('Kuzzle/request', JSON.stringify(msg)); - resolve(result); - }; - }); - } - - client.publish("Kuzzle/request", JSON.stringify(msg)); + return promise; + }); - return promise; - }); } - sendAndListen(msg, clientName = "client1") { - if (!msg.requestId) { + sendAndListen (msg, clientName = 'client1') { + if (! msg.requestId) { msg.requestId = uuid.v4(); } msg.volatile = this.world.volatile; - return this._getClient(clientName).then((client) => { - const promise = new Bluebird((resolve, reject) => { - this.requests[msg.requestId] = (response) => { - const listener = (document) => { - this.responses = document; - }; + return this._getClient(clientName) + .then(client => { + const promise = new Bluebird((resolve, reject) => { + this.requests[msg.requestId] = response => { + const listener = document => { + this.responses = document; + }; - if (response.error) { - return reject(response.error.message); - } + if (response.error) { + return reject(response.error.message); + } - if (!this.subscribedRooms[clientName]) { - this.subscribedRooms[clientName] = {}; - } - this.subscribedRooms[clientName][response.result.roomId] = { - channel: response.result.channel, - listener, - }; - client.subscribe(response.result.channel); + if (! this.subscribedRooms[clientName]) { + this.subscribedRooms[clientName] = {}; + } + this.subscribedRooms[clientName][response.result.roomId] = { channel: response.result.channel, listener }; + client.subscribe(response.result.channel); - resolve(response); - }; - }); + resolve(response); + }; + }); - client.publish("Kuzzle/request", JSON.stringify(msg)); + client.publish('Kuzzle/request', JSON.stringify(msg)); - return promise; - }); + return promise; + }); } - _getClient(name) { + _getClient (name) { if (this.clients[name]) { return Bluebird.resolve(this.clients[name]); } @@ -108,32 +109,31 @@ class MqttApi extends ApiBase { const client = mqtt.connect({ host: this.world.config.host }); this.clients[name] = client; - client.on("error", reject); - client.on("connect", () => resolve(client)); - client.on("message", (topic, raw) => { + client.on('error', reject); + client.on('connect', () => resolve(client)); + client.on('message', (topic, raw) => { const message = JSON.parse(Buffer.from(raw)); - if (topic === "Kuzzle/response") { + if (topic === 'Kuzzle/response') { if (this.requests[message.requestId]) { this.requests[message.requestId](message); } - } else { - if (message.type === "TokenExpired") { + } + else { + if (message.type === 'TokenExpired') { this.responses = message; } // notification const channel = topic; - const roomId = topic.split("-")[0]; + const roomId = topic.split('-')[0]; - if ( - this.subscribedRooms[name] && - this.subscribedRooms[name][roomId] - ) { + if (this.subscribedRooms[name] && this.subscribedRooms[name][roomId]) { const room = this.subscribedRooms[name][roomId]; if (room.channel === channel) { room.listener(message); - } else { - throw new Error("Channels do not match"); + } + else { + throw new Error('Channels do not match'); } } } @@ -141,9 +141,9 @@ class MqttApi extends ApiBase { }); } - unsubscribe(roomId, clientName, waitForResponse = false) { + unsubscribe (roomId, clientName, waitForResponse = false) { const client = this.clients[clientName]; - if (!client) { + if (! client) { return; } @@ -151,20 +151,17 @@ class MqttApi extends ApiBase { client.unsubscribe(room.channel); delete this.subscribedRooms[clientName][roomId]; - return this.send( - { - controller: "realtime", - action: "unsubscribe", - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - body: { roomId }, - }, - waitForResponse, - clientName - ); + return this.send({ + controller: 'realtime', + action: 'unsubscribe', + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + body: { roomId } + }, waitForResponse, clientName); + } - unsubscribeAll() { + unsubscribeAll () { const promises = []; for (const clientName of Object.keys(this.subscribedRooms)) { @@ -175,6 +172,7 @@ class MqttApi extends ApiBase { return Bluebird.all(promises); } + } module.exports = MqttApi; diff --git a/features-legacy/support/api/websocket.js b/features-legacy/support/api/websocket.js index 10c89b2815..910d117422 100644 --- a/features-legacy/support/api/websocket.js +++ b/features-legacy/support/api/websocket.js @@ -1,11 +1,13 @@ -"use strict"; +'use strict'; -const Bluebird = require("bluebird"), - WsApiBase = require("./websocketBase"), - Ws = require("ws"); +const + Bluebird = require('bluebird'), + WsApiBase = require('./websocketBase'), + Ws = require('ws'); class WebSocketApi extends WsApiBase { - constructor(world) { + + constructor (world) { super(world); this.responses = null; @@ -15,60 +17,52 @@ class WebSocketApi extends WsApiBase { this.requests = {}; } - get socket() { + get socket () { return this.socket.client1; } - _initSocket(name = "client1") { + _initSocket (name = 'client1') { if (this.sockets[name]) { return Bluebird.resolve(); } return new Bluebird((resolve, reject) => { - this.sockets[name] = new Ws( - `ws://${this.world.config.host}:${this.world.config.port}`, - { - perMessageDeflate: false, - } - ); + this.sockets[name] = new Ws(`ws://${this.world.config.host}:${this.world.config.port}`, { + perMessageDeflate: false + }); - this.sockets[name].on("message", (message) => { + this.sockets[name].on('message', message => { const data = JSON.parse(message); - if ( - data.scope || - data.type === "user" || - data.type === "TokenExpired" - ) { - if (data.type === "TokenExpired") { + if (data.scope || data.type === 'user' || data.type === 'TokenExpired') { + if (data.type === 'TokenExpired') { this.responses = data; } // notification const channel = data.room; - const roomId = channel.split("-")[0]; + const roomId = channel.split('-')[0]; - if ( - this.subscribedRooms[name] && - this.subscribedRooms[name][roomId] - ) { + if (this.subscribedRooms[name] && this.subscribedRooms[name][roomId]) { const room = this.subscribedRooms[name][roomId]; if (room.channel === channel) { room.listener(data); - } else { - throw new Error("Channels do not match"); + } + else { + throw new Error('Channels do not match'); } } - } else if (this.requests[data.requestId]) { + } + else if (this.requests[data.requestId]) { // response this.requests[data.requestId](data); } }); - this.sockets[name].on("error", reject); - this.sockets[name].on("open", resolve); + this.sockets[name].on('error', reject); + this.sockets[name].on('open', resolve); }); } - _socketOn() { + _socketOn () { // do nothing } @@ -80,11 +74,11 @@ class WebSocketApi extends WsApiBase { * @returns {*} * @private */ - _socketOnce(socket, requestId, cb) { + _socketOnce (socket, requestId, cb) { this.requests[requestId] = cb; } - _socketRemoveListener() { + _socketRemoveListener () { // do nothing } @@ -95,20 +89,21 @@ class WebSocketApi extends WsApiBase { * @returns {*} * @private */ - _socketSend(socket, msg) { - return socket.send(JSON.stringify(msg), (err) => { + _socketSend (socket, msg) { + return socket.send(JSON.stringify(msg), err => { if (err) { throw err; } }); } - disconnect() { + disconnect () { for (const socketKey of Object.keys(this.sockets)) { this.sockets[socketKey].terminate(); delete this.sockets[socketKey]; } } + } module.exports = WebSocketApi; diff --git a/features-legacy/support/api/websocketBase.js b/features-legacy/support/api/websocketBase.js index 24b73f7e55..01788cc512 100644 --- a/features-legacy/support/api/websocketBase.js +++ b/features-legacy/support/api/websocketBase.js @@ -1,20 +1,23 @@ -"use strict"; +'use strict'; + +const + Bluebird = require('bluebird'), + ApiBase = require('./apiBase'), + uuid = require('uuid'); -const Bluebird = require("bluebird"), - ApiBase = require("./apiBase"), - uuid = require("uuid"); class WebSocketApiBase extends ApiBase { - _socketOnce() { - throw new Error("not implemented"); + + _socketOnce () { + throw new Error('not implemented'); } - _socketSend() { - throw new Error("not implemented"); + _socketSend () { + throw new Error('not implemented'); } - send(msg, getAnswer = true, socketName = "client1") { - if (!msg.requestId) { + send (msg, getAnswer = true, socketName = 'client1') { + if (! msg.requestId) { msg.requestId = uuid.v4(); } @@ -24,41 +27,42 @@ class WebSocketApiBase extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._initSocket(socketName).then(() => { - const socket = this.sockets[socketName]; - - let promise = Bluebird.resolve({}); - if (getAnswer) { - promise = new Bluebird((resolve, reject) => { - this._socketOnce(socket, msg.requestId, (result) => { - if (!result) { - const error = new Error("Returned result is null"); - return reject(Object.assign(error, msg)); - } - - if (result.error && result.status !== 206) { - const error = new Error(result.error.stack); - Object.assign(error, result); - - // used to fit with rest api (used with request-promise) - error.details = result.error._source || {}; - error.statusCode = result.status; - return reject(error); - } - - resolve(result); + return this._initSocket(socketName) + .then(() => { + const socket = this.sockets[socketName]; + + let promise = Bluebird.resolve({}); + if (getAnswer) { + promise = new Bluebird((resolve, reject) => { + this._socketOnce(socket, msg.requestId, result => { + if (! result) { + const error = new Error('Returned result is null'); + return reject(Object.assign(error, msg)); + } + + if (result.error && result.status !== 206) { + const error = new Error(result.error.stack); + Object.assign(error, result); + + // used to fit with rest api (used with request-promise) + error.details = result.error._source || {}; + error.statusCode = result.status; + return reject(error); + } + + resolve(result); + }); }); - }); - } + } - this._socketSend(socket, msg); + this._socketSend(socket, msg); - return promise; - }); + return promise; + }); } - sendAndListen(msg, socketName = "client1") { - if (!msg.requestId) { + sendAndListen (msg, socketName = 'client1') { + if (! msg.requestId) { msg.requestId = uuid.v4(); } @@ -68,51 +72,48 @@ class WebSocketApiBase extends ApiBase { msg.jwt = this.world.currentUser.token; } - return this._initSocket(socketName).then(() => { - const socket = this.sockets[socketName]; - - let promise = new Bluebird((resolve, reject) => { - this._socketOnce(socket, msg.requestId, (response) => { - const listener = (document) => { - this.responses = document; - }; - - if (response.error) { - return reject(response.error.message); - } - - if (!this.subscribedRooms[socketName]) { - this.subscribedRooms[socketName] = {}; - } - - this.subscribedRooms[socketName][response.result.roomId] = { - channel: response.result.channel, - listener, - }; - this._socketOn(socket, response.result.channel, (document) => - listener(document) - ); - resolve(response); + return this._initSocket(socketName) + .then(() => { + const socket = this.sockets[socketName]; + + let promise = new Bluebird((resolve, reject) => { + this._socketOnce(socket, msg.requestId, response => { + const listener = document => { + this.responses = document; + }; + + if (response.error) { + return reject(response.error.message); + } + + if (! this.subscribedRooms[socketName]) { + this.subscribedRooms[socketName] = {}; + } + + this.subscribedRooms[socketName][response.result.roomId] = { channel: response.result.channel, listener }; + this._socketOn(socket, response.result.channel, document => listener(document)); + resolve(response); + }); }); - }); - this._socketSend(socket, msg); + this._socketSend(socket, msg); - return promise; - }); + return promise; + }); } - unsubscribe(roomId, socketName, waitForResponse = false) { - const msg = { - controller: "realtime", - action: "unsubscribe", - collection: this.world.fakeCollection, - index: this.world.fakeIndex, - body: { roomId: roomId }, - }; + unsubscribe (roomId, socketName, waitForResponse = false) { + const + msg = { + controller: 'realtime', + action: 'unsubscribe', + collection: this.world.fakeCollection, + index: this.world.fakeIndex, + body: { roomId: roomId } + }; const socket = this.sockets[socketName]; - if (!socket) { + if (! socket) { return; } @@ -125,7 +126,7 @@ class WebSocketApiBase extends ApiBase { return this.send(msg, waitForResponse, socketName); } - unsubscribeAll() { + unsubscribeAll () { const promises = []; for (const socketName of Object.keys(this.subscribedRooms)) { diff --git a/features-legacy/support/config.js b/features-legacy/support/config.js index 2c00ff527d..8fbc6496f8 100644 --- a/features-legacy/support/config.js +++ b/features-legacy/support/config.js @@ -1,17 +1,16 @@ -"use strict"; +'use strict'; -const rc = require("rc"); +const rc = require('rc'); -const kuzzleConfig = require("../../lib/config"); +const kuzzleConfig = require('../../lib/config'); -module.exports = rc("kuzzle", { - scheme: "http", - host: "localhost", +module.exports = rc('kuzzle', { + scheme: 'http', + host: 'localhost', port: 7512, services: { storageEngine: { - commonMapping: - kuzzleConfig.loadConfig().services.storageEngine.commonMapping, - }, - }, + commonMapping: kuzzleConfig.loadConfig().services.storageEngine.commonMapping + } + } }); diff --git a/features-legacy/support/env.js b/features-legacy/support/env.js index e35c50bd4c..b3e80174b9 100644 --- a/features-legacy/support/env.js +++ b/features-legacy/support/env.js @@ -1,4 +1,4 @@ -"use strict"; +'use strict'; var configure = function () { this.setDefaultTimeout(30 * 1000); diff --git a/features-legacy/support/hooks.js b/features-legacy/support/hooks.js index b622fceafd..3ced86225f 100644 --- a/features-legacy/support/hooks.js +++ b/features-legacy/support/hooks.js @@ -1,205 +1,189 @@ -"use strict"; - -const { After, Before, BeforeAll } = require("cucumber"), - testMappings = require("../fixtures/mappings"), - testPermissions = require("../fixtures/permissions"), - testFixtures = require("../fixtures/fixtures"), - World = require("./world"); - -async function resetSecurityDefault(sdk) { - await sdk.query({ - controller: "admin", - action: "resetSecurity", - refresh: "wait_for", - }); - - sdk.jwt = null; - - await sdk.query({ - controller: "admin", - action: "loadSecurities", - body: testPermissions, - refresh: "wait_for", - }); - - await sdk.auth.login("local", { - username: "test-admin", - password: "password", - }); -} +'use strict'; -// Common hooks ================================================================ +const _ = require('lodash'); +const { After, Before, BeforeAll } = require('cucumber'); +const Bluebird = require('bluebird'); -BeforeAll({ timeout: 10 * 1000 }, async function () { - const world = new World({}); +const Http = require('./api/http'); +const World = require('./world'); - console.log( - `Start tests with ${world.protocol.toLocaleUpperCase()} protocol.` - ); +function bootstrapDatabase () { + const + fixtures = require('../fixtures/functionalTestsFixtures.json'), + promises = [], + world = new World({ parameters: parseWorldParameters() }), + http = new Http(world); - await world.sdk.connect(); + for (const index of Object.keys(fixtures)) { + promises.push(() => http.deleteIndex(index) + .catch(() => true)); + } + const mappings = { dynamic: 'true', properties: { foo: { type: 'keyword' } } }; - console.log("Loading default permissions.."); + promises.push(() => http.createIndex(world.fakeIndex)); + promises.push(() => http.createCollection(world.fakeIndex, world.fakeCollection, mappings)); + promises.push(() => http.createCollection(world.fakeIndex, world.fakeAltCollection, mappings)); - await world.sdk.query({ - controller: "admin", - action: "loadSecurities", - body: testPermissions, - onExistingUsers: "overwrite", - refresh: "wait_for", - }); + promises.push(() => http.createIndex(world.fakeAltIndex)); + promises.push(() => http.createCollection(world.fakeAltIndex, world.fakeCollection, mappings)); + promises.push(() => http.createCollection(world.fakeAltIndex, world.fakeAltCollection, mappings)); - world.sdk.disconnect(); -}); + return Bluebird.each(promises, promise => promise()); +} -Before({ timeout: 10 * 1000 }, async function () { - await this.sdk.connect(); +function cleanDatabase () { + const + promises = [], + world = new World({ parameters: parseWorldParameters() }), + http = new Http(world); + + for (const index of [ + world.fakeIndex, + world.fakeAltIndex, + world.fakeNewIndex, + 'tolkien' + ]) { + promises.push(http.deleteIndex(index) + .catch(() => true)); + } - await this.sdk.auth.login("local", { - username: "test-admin", - password: "password", - }); -}); + return Bluebird.all(promises); +} -Before({ tags: "not @preserveDatabase" }, async function () { - await this.sdk.query({ - controller: "admin", - action: "resetDatabase", - refresh: "wait_for", - }); +// before first +BeforeAll(function () { + return cleanDatabase() + .then(() => bootstrapDatabase()); }); -After(async function () { - // Clean values stored by the scenario - this.props = {}; +Before({ timeout: 10 * 2000 }, function () { + const world = new World({ parameters: parseWorldParameters() }); - if (this.sdk && typeof this.sdk.disconnect === "function") { - this.sdk.disconnect(); - } + return this.api.truncateCollection(world.fakeIndex, world.fakeCollection) + .catch(() => {}) + .then(() => this.api.truncateCollection(world.fakeAltIndex, world.fakeAltCollection)) + .catch(() => {}) + .then(() => this.api.resetSecurity()); }); -Before({ tags: "@production" }, async function () { - if (process.env.NODE_ENV !== "production") { - return "skipped"; - } +Before({ timeout: 10 * 2000, tags: '@resetDatabase' }, async function () { + await cleanDatabase(); + await bootstrapDatabase(); }); -Before({ tags: "@development" }, async function () { - if (process.env.NODE_ENV !== "development") { - return "skipped"; - } +After(function () { + return this.api.disconnect(); }); -Before({ tags: "@http" }, async function () { - if (process.env.KUZZLE_PROTOCOL !== "http") { - return "skipped"; - } +After({ tags: '@realtime' }, function () { + return this.api.unsubscribeAll() + .catch(() => true); }); -Before({ tags: "@not-http" }, async function () { - if (process.env.KUZZLE_PROTOCOL === "http") { - return "skipped"; - } +Before({ tags: '@security' }, function () { + return cleanSecurity.call(this); }); -// firstAdmin hooks ============================================================ +Before({ tags: '@firstAdmin' }, function () { + return cleanSecurity.call(this); +}); -Before({ tags: "@firstAdmin" }, async function () { - await this.sdk.query({ - controller: "admin", - action: "resetSecurity", - refresh: "wait_for", - }); +After({ tags: '@firstAdmin' }, function () { + return grantDefaultRoles.call(this).then(() => cleanSecurity.call(this)); +}); - this.sdk.jwt = null; +Before({ tags: '@redis' }, function () { + return cleanRedis.call(this); }); -After({ tags: "@firstAdmin", timeout: 60 * 1000 }, async function () { - await resetSecurityDefault(this.sdk); +After({ tags: '@redis' }, function () { + return cleanRedis.call(this); }); -// security hooks ============================================================== +Before({ tags: '@validation' }, function () { + return cleanValidations.call(this); +}); -After({ tags: "@security", timeout: 60 * 1000 }, async function () { - await resetSecurityDefault(this.sdk); +After({ tags: '@validation' }, function () { + return cleanValidations.call(this); }); -// mappings hooks ============================================================== - -Before({ tags: "@mappings" }, async function () { - await this.sdk.query({ - controller: "admin", - action: "loadMappings", - body: testMappings, - refresh: "wait_for", - }); - - await this.sdk.query({ - controller: "admin", - action: "loadFixtures", - body: testFixtures, - refresh: "wait_for", - }); +After({ tags: '@http' }, function () { + this.api.encode('identity'); + this.api.decode('identity'); }); -// events hooks ================================================================ +function cleanSecurity () { + if (this.currentUser) { + delete this.currentUser; + } -After({ tags: "@events" }, async function () { - await this.sdk.query({ - controller: "functional-test-plugin/pipes", - action: "deactivateAll", - }); + return this.api.resetSecurity(); +} - await this.sdk.query({ - controller: "pipes", - action: "deactivateAll", - }); -}); +function grantDefaultRoles () { + return this.api.login('local', this.users.useradmin.credentials.local) + .then(body => { + if (body.error) { + return Promise.reject(new Error(body.error.message)); + } -// login hooks ================================================================= + if (! body.result) { + return Promise.reject(new Error('No result provided')); + } -After({ tags: "@login" }, async function () { - await this.sdk.auth.login("local", { - username: "test-admin", - password: "password", - }); -}); + if (! body.result.jwt) { + return Promise.reject(new Error('No token received')); + } -// realtime hooks ============================================================== + if (this.currentUser === null || this.currentUser === undefined) { + this.currentUser = {}; + } -After({ tags: "@realtime" }, function () { - if (!this.props.subscriptions) { - return; - } - const promises = Object.values(this.props.subscriptions).map( - ({ unsubscribe }) => unsubscribe() - ); + this.currentToken = { jwt: body.result.jwt }; + this.currentUser.token = body.result.jwt; - return Promise.all(promises); -}); + return this.api.createOrReplaceRole('anonymous', { controllers: { '*': { actions: { '*': true } } } }); + }) + .then(() => this.api.createOrReplaceRole('default', { controllers: { '*': { actions: { '*': true } } } })) + .then(() => this.api.createOrReplaceRole('admin', { controllers: { '*': { actions: { '*': true } } } })); +} -After({ tags: "@websocket" }, function () { - this.props.client.terminate(); -}); +function cleanRedis () { + return this.api.callMemoryStorage('keys', { args: { pattern: this.idPrefix + '*' } }) + .then(response => { + if (_.isArray(response.result) && response.result.length) { + return this.api.callMemoryStorage('del', { body: { keys: response.result } }); + } -// cluster hooks =============================================================== + return null; + }); +} -Before({ tags: "@cluster" }, async function () { - this.sdk.disconnect(); +function cleanValidations () { + return this.api.searchSpecifications({ + query: { + match_all: { boost: 1 } + } + }) + .then(body => Bluebird.all(body.result.hits + .filter(r => r._id.match(/^kuzzle-test-/)) + .map(r => this.api.deleteSpecifications(r._id.split('#')[0], r._id.split('#')[1])) + )); +} - this.node1 = this.getSDK({ port: 17510 }); - this.node2 = this.getSDK({ port: 17511 }); - this.node3 = this.getSDK({ port: 17512 }); +function parseWorldParameters () { + const worldParamIndex = process.argv.indexOf('--world-parameters'); + const worldParam = worldParamIndex > -1 + ? JSON.parse(process.argv[worldParamIndex + 1]) + : {}; - await Promise.all([ - this.node1.connect(), - this.node2.connect(), - this.node3.connect(), - ]); -}); + const parameters = Object.assign({ + host: 'localhost', + port: 7512, + protocol: 'websocket', + silent: true, + }, worldParam); -After({ tags: "@cluster" }, async function () { - this.node1.disconnect(); - this.node2.disconnect(); - this.node3.disconnect(); -}); + return parameters; +} From 4cafa70b881e1b2b66f9875be9b0d54aeaba5286 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:23:13 +0100 Subject: [PATCH 25/28] Revert linting --- .../step_definitions/readDocument.js | 369 ++++++++--------- features-legacy/step_definitions/users.js | 385 ++++++++---------- .../step_definitions/validation.js | 362 ++++++++-------- 3 files changed, 499 insertions(+), 617 deletions(-) diff --git a/features-legacy/step_definitions/readDocument.js b/features-legacy/step_definitions/readDocument.js index 5eb39f17e8..8dd6f4c200 100644 --- a/features-legacy/step_definitions/readDocument.js +++ b/features-legacy/step_definitions/readDocument.js @@ -1,189 +1,165 @@ -"use strict"; - -const { Then } = require("cucumber"), - async = require("async"), - Bluebird = require("bluebird"); - -Then( - /^I'm ?(not)* able to get the document(?: in index "([^"]*)")?$/, - function (not, index, callback) { - var main = function (callbackAsync) { - this.api - .get(this.result._id, index) - .then((body) => { - if (body.error && !not) { - if (body.error.message) { - callbackAsync(body.error.message); - return false; - } - - callbackAsync(body.error); +'use strict'; + +const + { + Then + } = require('cucumber'), + async = require('async'), + Bluebird = require('bluebird'); + +Then(/^I'm ?(not)* able to get the document(?: in index "([^"]*)")?$/, function (not, index, callback) { + var main = function (callbackAsync) { + this.api.get(this.result._id, index) + .then(body => { + if (body.error && ! not) { + if (body.error.message) { + callbackAsync(body.error.message); return false; } - if (!body.result || !body.result._source) { - if (not) { - callbackAsync(); - return false; - } + callbackAsync(body.error); + return false; + } - callbackAsync("No result provided"); + if (! body.result || ! body.result._source) { + if (not) { + callbackAsync(); return false; } - if (not) { - callbackAsync("Object with id " + this.result._id + " exists"); + callbackAsync('No result provided'); + return false; + } + + if (not) { + callbackAsync('Object with id ' + this.result._id + ' exists'); + return false; + } + + callbackAsync(); + }) + .catch(function (error) { + if (not) { + callbackAsync(); + return false; + } + + callbackAsync(error); + }); + }; + + + async.retry({ times: 20, interval: 20 }, main.bind(this), function (err) { + if (err) { + if (err.message) { + err = err.message; + } + callback(new Error(err)); + return false; + } + + callback(); + }); +}); + +Then(/^my document has the value "([^"]*)" in field "([^"]*)"$/, function (value, field, callback) { + var main = function (callbackAsync) { + setTimeout(function () { + this.api.get(this.result._id) + .then(function (body) { + + if (body.error) { + callbackAsync(body.error.message); return false; } - callbackAsync(); - }) - .catch(function (error) { - if (not) { - callbackAsync(); + if (body.result._source[field] === undefined) { + callbackAsync('Undefined field ' + field); + return false; + } + + if (body.result._source[field] !== value) { + callbackAsync('Value in field ' + field + ' is ' + body.result._source[field] + ' expected to be ' + value); return false; } + callbackAsync(); + }) + .catch(function (error) { callbackAsync(error); }); - }; + }.bind(this), 100); // end setTimeout + }; - async.retry({ times: 20, interval: 20 }, main.bind(this), function (err) { - if (err) { - if (err.message) { - err = err.message; - } - callback(new Error(err)); - return false; + async.retry(20, main.bind(this), function (err) { + if (err) { + if (err.message) { + err = err.message; } - callback(); - }); - } -); - -Then( - /^my document has the value "([^"]*)" in field "([^"]*)"$/, - function (value, field, callback) { - var main = function (callbackAsync) { - setTimeout( - function () { - this.api - .get(this.result._id) - .then(function (body) { - if (body.error) { - callbackAsync(body.error.message); - return false; - } - - if (body.result._source[field] === undefined) { - callbackAsync("Undefined field " + field); - return false; - } - - if (body.result._source[field] !== value) { - callbackAsync( - "Value in field " + - field + - " is " + - body.result._source[field] + - " expected to be " + - value - ); - return false; - } - - callbackAsync(); - }) - .catch(function (error) { - callbackAsync(error); - }); - }.bind(this), - 100 - ); // end setTimeout - }; - - async.retry(20, main.bind(this), function (err) { - if (err) { - if (err.message) { - err = err.message; - } - - callback(new Error(err)); - return false; - } - - callback(); - }); - } -); - -Then( - /^I ?(don't)* find a document with "([^"]*)"(?: in field "([^"]*)")?(?: in index "([^"]*)")?(?: with scroll "([^"]*)")?$/, - function (dont, value, field, index, scroll) { - const query = { - query: { match: { [field]: value === "true" ? true : value } }, - }; - const args = {}; - - if (scroll) { - args.scroll = scroll; - args.from = 0; - args.size = 1; + callback(new Error(err)); + return false; } - return this.api - .search(query, index, null, args) - .then((body) => { - if (body.error !== null) { - if (dont) { - return Bluebird.resolve(); - } - - return Bluebird.reject(body.error); - } + callback(); + }); +}); - if (body.result && body.result.scrollId) { - this.scrollId = body.result.scrollId; - } +Then(/^I ?(don't)* find a document with "([^"]*)"(?: in field "([^"]*)")?(?: in index "([^"]*)")?(?: with scroll "([^"]*)")?$/, function (dont, value, field, index, scroll) { + const query = { query: { match: { [field]: (value === 'true' ? true : value) } } }; + const args = {}; - if (body.result && body.result.hits && body.result.total !== 0) { - if (dont) { - return Bluebird.reject( - new Error("A document exists for the query") - ); - } - return Bluebird.resolve(); - } + if (scroll) { + args.scroll = scroll; + args.from = 0; + args.size = 1; + } + return this.api.search(query, index, null, args) + .then(body => { + if (body.error !== null) { if (dont) { return Bluebird.resolve(); } - return Bluebird.reject(new Error("No result for query search")); - }) - .catch((error) => { + + return Bluebird.reject(body.error); + } + + if (body.result && body.result.scrollId) { + this.scrollId = body.result.scrollId; + } + + if (body.result && body.result.hits && body.result.total !== 0) { if (dont) { - return Bluebird.resolve(); + return Bluebird.reject(new Error('A document exists for the query')); } - return Bluebird.reject(error); - }); - } -); + return Bluebird.resolve(); + } + + if (dont) { + return Bluebird.resolve(); + } + return Bluebird.reject(new Error('No result for query search')); + }) + .catch(error => { + if (dont) { + return Bluebird.resolve(); + } + return Bluebird.reject(error); + }); +}); Then(/^I am ?(not)* able to scroll previous search$/, function (not) { - if (!this.scrollId) { + if (! this.scrollId) { if (not) { return Bluebird.resolve(); } - return Bluebird.reject( - new Error("No scroll id from previous search available") - ); + return Bluebird.reject(new Error('No scroll id from previous search available')); } - return this.api - .scroll(this.scrollId) - .then((body) => { + return this.api.scroll(this.scrollId) + .then(body => { if (body.error !== null) { if (not) { return Bluebird.resolve(); @@ -194,21 +170,19 @@ Then(/^I am ?(not)* able to scroll previous search$/, function (not) { if (body.result && body.result.hits && body.result.hits.length > 0) { if (not) { - return Bluebird.reject( - new Error("A document exists for the scrollId") - ); + return Bluebird.reject(new Error('A document exists for the scrollId')); } return Bluebird.resolve(); } if (not) { - return Bluebird.resolve(); + return Bluebird.resolve(); } - return Bluebird.reject(new Error("No result for scrollId search")); + return Bluebird.reject(new Error('No result for scrollId search')); }) - .catch((error) => { + .catch(error => { if (not) { - return Bluebird.resolve(); + return Bluebird.resolve(); } return Bluebird.reject(error); }); @@ -220,57 +194,40 @@ Then(/^I should receive a document id$/, function (callback) { return false; } - callback(new Error("No id information in returned object")); + callback(new Error('No id information in returned object')); }); -Then( - /^I get ([\d]+) documents '([^']+)'?$/, - function (count, documents, callback) { - documents = JSON.parse(documents); +Then(/^I get ([\d]+) documents '([^']+)'?$/, function (count, documents, callback) { + documents = JSON.parse(documents); - this.api - .mGet({ ids: documents }) - .then((response) => { - if (response.error !== null) { - callback(response.error.message); - return false; - } else if (response.result.total !== Number.parseInt(count)) { - callback( - "Document count (" + - response.result.total + - ") not as expected (" + - count + - ")" - ); - return false; - } + this.api.mGet({ ids: documents }) + .then(response => { + if (response.error !== null) { + callback(response.error.message); + return false; + } + else if (response.result.total !== Number.parseInt(count)) { + callback('Document count (' + response.result.total + ') not as expected (' + count + ')'); + return false; + } - callback(); - }) - .catch(function (error) { - callback(error); - }); - } -); - -Then( - /^I check that the document "([^"]*)" ?(doesn't)* exists$/, - function (id, doesnt, callback) { - this.api - .exists(id) - .then((response) => { - if (response.result) { - return doesnt === undefined - ? callback() - : callback(new Error("The document exists")); - } + callback(); + }) + .catch(function (error) { + callback(error); + }); +}); - return doesnt === undefined - ? callback(new Error("The document doesn't exists")) - : callback(); - }) - .catch(function (error) { - callback(error); - }); - } -); +Then(/^I check that the document "([^"]*)" ?(doesn't)* exists$/, function (id, doesnt, callback) { + this.api.exists(id) + .then(response => { + if (response.result) { + return (doesnt === undefined) ? callback() : callback(new Error('The document exists')); + } + + return (doesnt === undefined) ? callback(new Error('The document doesn\'t exists')) : callback(); + }) + .catch(function (error) { + callback(error); + }); +}); diff --git a/features-legacy/step_definitions/users.js b/features-legacy/step_definitions/users.js index 71a52a8429..51e78a12af 100644 --- a/features-legacy/step_definitions/users.js +++ b/features-legacy/step_definitions/users.js @@ -1,96 +1,97 @@ -"use strict"; +'use strict'; -const { When, Given, Then } = require("cucumber"), - _ = require("lodash"), - async = require("async"); +const + { + When, + Given, + Then + } = require('cucumber'), + _ = require('lodash'), + async = require('async'); When(/^I get the user mapping$/, function () { - return this.api.getUserMapping().then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.getUserMapping() + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if (!response.result) { - throw new Error("No result provided"); - } + if (! response.result) { + throw new Error('No result provided'); + } - if (!response.result.mapping) { - throw new Error("No mapping provided"); - } + if (! response.result.mapping) { + throw new Error('No mapping provided'); + } - this.result = response.result.mapping; - }); + this.result = response.result.mapping; + }); }); Then(/^I change the user mapping$/, function () { - return this.api.updateUserMapping().then((body) => { - if (body.error !== null) { - throw new Error(body.error.message); - } - }); + return this.api.updateUserMapping() + .then(body => { + if (body.error !== null) { + throw new Error(body.error.message); + } + }); }); -When( - /^I (can't )?create a (restricted )?user "(.*?)" with id "(.*?)"$/, - { timeout: 20000 }, - function (not, isRestricted, user, id, callback) { - var userObject = this.users[user], - method; - - if (isRestricted) { - method = "createRestrictedUser"; - } else { - method = "createUser"; - } +When(/^I (can't )?create a (restricted )?user "(.*?)" with id "(.*?)"$/, { timeout: 20000 }, function (not, isRestricted, user, id, callback) { + var + userObject = this.users[user], + method; - id = this.idPrefix + id; + if (isRestricted) { + method = 'createRestrictedUser'; + } + else { + method = 'createUser'; + } - this.api[method](userObject, id) - .then((body) => { - if (body.error) { - if (not) { - return callback(); - } - return callback(new Error(body.error.message)); - } + id = this.idPrefix + id; + this.api[method](userObject, id) + .then(body => { + if (body.error) { if (not) { - return callback(new Error(JSON.stringify(body))); + return callback(); } - return callback(); - }) - .catch((error) => callback(not ? null : error)); - } -); + return callback(new Error(body.error.message)); + } -When( - /^I create the first admin with id "(.*?)"( and reset profiles and roles)?$/, - { timeout: 20000 }, - function (id, reset, callback) { - var userObject = this.users.useradmin; + if (not) { + return callback(new Error(JSON.stringify(body))); + } + return callback(); + }) + .catch(error => callback(not ? null : error)); +}); - delete userObject.content.profileIds; - id = this.idPrefix + id; +When(/^I create the first admin with id "(.*?)"( and reset profiles and roles)?$/, { timeout: 20000 }, function (id, reset, callback) { + var + userObject = this.users.useradmin; - this.api - .createFirstAdmin(userObject, id, reset) - .then((body) => { - if (body.error) { - return callback(new Error(body.error.message)); - } + delete userObject.content.profileIds; + id = this.idPrefix + id; - return callback(); - }) - .catch((error) => callback(error)); - } -); + this.api.createFirstAdmin(userObject, id, reset) + .then(body => { + if (body.error) { + return callback(new Error(body.error.message)); + } + + return callback(); + }) + .catch(error => callback(error)); +}); -Then( - /^I am able to get the user "(.*?)"(?: matching {(.*)})?$/, - function (id, match) { - id = this.idPrefix + id; - return this.api.getUser(id).then((body) => { +Then(/^I am able to get the user "(.*?)"(?: matching {(.*)})?$/, function (id, match) { + id = this.idPrefix + id; + + return this.api.getUser(id) + .then(body => { if (body.error) { throw new Error(body.error.message); } @@ -98,88 +99,60 @@ Then( if (match) { match = match.replace(/#prefix#/g, this.idPrefix); - const matchingObject = JSON.parse("{" + match + "}"); + const matchingObject = JSON.parse('{' + match + '}'); - if (!_.matches(matchingObject)(body.result)) { - throw new Error( - "Error: " + - JSON.stringify(body.result) + - " does not match {" + - match + - "}" - ); + if (! _.matches(matchingObject)(body.result)) { + throw new Error('Error: ' + JSON.stringify(body.result) + ' does not match {' + match + '}'); } } }); +}); + +Then(/^I search for {(.*?)} and find (\d+) users(?: matching {(.*?)})?$/, function (query, count, match, callback) { + if (count) { + count = parseInt(count); } -); -Then( - /^I search for {(.*?)} and find (\d+) users(?: matching {(.*?)})?$/, - function (query, count, match, callback) { - if (count) { - count = parseInt(count); - } + let run = (cb) => { + query = query.replace(/#prefix#/g, this.idPrefix); - let run = (cb) => { - query = query.replace(/#prefix#/g, this.idPrefix); + this.api.searchUsers(JSON.parse('{' + query + '}')) + .then(body => { + if (body.error) { + return cb(new Error(body.error.message)); + } - this.api - .searchUsers(JSON.parse("{" + query + "}")) - .then((body) => { - if (body.error) { - return cb(new Error(body.error.message)); - } + if (count !== body.result.total) { + return cb(new Error('Expected ' + count + ' results, got ' + body.result.total + '\n' + JSON.stringify(body.result.hits))); + } - if (count !== body.result.total) { - return cb( - new Error( - "Expected " + - count + - " results, got " + - body.result.total + - "\n" + - JSON.stringify(body.result.hits) - ) - ); - } + if (match) { + match = match.replace(/#prefix#/g, this.idPrefix); - if (match) { - match = match.replace(/#prefix#/g, this.idPrefix); - - const matchFunc = _.matches(JSON.parse("{" + match + "}")); - - if (!body.result.hits.every((hit) => matchFunc(hit))) { - return cb( - new Error( - "Error: " + - JSON.stringify(body.result.hits) + - " does not match " + - match - ) - ); - } + const matchFunc = _.matches(JSON.parse('{' + match + '}')); + + if (! body.result.hits.every(hit => matchFunc(hit))) { + return cb(new Error('Error: ' + JSON.stringify(body.result.hits) + ' does not match ' + match)); } + } - cb(null); - }) - .catch((error) => cb(error)); - }; + cb(null); + }) + .catch(error => cb(error)); + }; - async.retry({ times: 40, interval: 50 }, run, (err) => { - if (err) { - return callback(new Error(err.message)); - } + async.retry({ times: 40, interval: 50 }, run, err => { + if (err) { + return callback(new Error(err.message)); + } - return callback(); - }); - } -); + return callback(); + }); +}); Then(/^I replace the user "(.*?)" with data {(.*?)}$/, function (id, data) { - return this.api - .replaceUser(this.idPrefix + id, JSON.parse("{" + data + "}")) - .then((body) => { + return this.api.replaceUser(this.idPrefix + id, JSON.parse('{' + data + '}')) + .then(body => { if (body.error) { throw new Error(body.error.message); } @@ -187,66 +160,60 @@ Then(/^I replace the user "(.*?)" with data {(.*?)}$/, function (id, data) { }); Then(/^I revoke all tokens of the user "(.*?)"$/, function (id) { - return this.api.revokeTokens(this.idPrefix + id).then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.revokeTokens(this.idPrefix + id) + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); Then(/^I delete the user "(.*?)"$/, function (id) { - return this.api.deleteUser(this.idPrefix + id, true).then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.deleteUser(this.idPrefix + id, true) + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); -Then( - /^I am getting the current user, which matches \{(.*?)}$/, - function (match) { - return this.api.getCurrentUser().then((body) => { +Then(/^I am getting the current user, which matches \{(.*?)}$/, function (match) { + return this.api.getCurrentUser() + .then(body => { if (body.error) { throw new Error(body.error.message); } match = match.replace(/#prefix#/g, this.idPrefix); - if (!_.matches(JSON.parse("{" + match + "}"))(body.result)) { - throw new Error( - "Expected: " + match + "\nGot: " + JSON.stringify(body.result) - ); + if (! _.matches(JSON.parse('{' + match + '}'))(body.result)) { + throw new Error('Expected: ' + match + '\nGot: ' + JSON.stringify(body.result)); } }); - } -); +}); -Then( - /^I'm ?(not)* able to find rights for user "([^"]*)"$/, - function (not, id, callback) { - id = this.idPrefix + id; +Then(/^I'm ?(not)* able to find rights for user "([^"]*)"$/, function (not, id, callback) { + id = this.idPrefix + id; - this.api - .getUserRights(id) - .then((body) => { - if (body.error) { - return callback(new Error(body.error.message)); - } + this.api.getUserRights(id) + .then(body => { + if (body.error) { + return callback(new Error(body.error.message)); + } - if (not) { - return callback(new Error(`User with id ${id} exists`)); - } + if (not) { + return callback(new Error(`User with id ${id} exists`)); + } - callback(); - }) - .catch((error) => callback(not ? null : error)); - } -); + callback(); + }) + .catch(error => callback(not ? null : error)); +}); -Then( - /^I'm ?(not)* able to check the token for current user/, - function (not, callback) { - this.api.checkToken(this.currentUser.token).then((body) => { - if (!body.result.valid) { +Then(/^I'm ?(not)* able to check the token for current user/, function (not, callback) { + + this.api.checkToken(this.currentUser.token) + .then(body => { + if (! body.result.valid) { if (not) { return callback(); } @@ -254,49 +221,47 @@ Then( } callback(); }); - } -); +}); Then(/^I'm able to find my rights$/, function () { - return this.api.getMyRights().then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.getMyRights() + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); Given(/^A scrolled search on users$/, function () { this.scrollId = null; - return this.api.searchUsers({}, { scroll: "2s" }).then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.searchUsers({}, { scroll: '2s' }) + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if (!response.result.scrollId) { - throw new Error("No scrollId returned by the searchProfile query"); - } + if (! response.result.scrollId) { + throw new Error('No scrollId returned by the searchProfile query'); + } - this.scrollId = response.result.scrollId; - }); + this.scrollId = response.result.scrollId; + }); }); Then(/^I am able to perform a scrollUsers request$/, function () { - if (!this.scrollId) { - throw new Error("No previous scrollId found"); + if (! this.scrollId) { + throw new Error('No previous scrollId found'); } - return this.api.scrollUsers(this.scrollId).then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.scrollUsers(this.scrollId) + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if ( - ["hits", "scrollId", "total"].some( - (prop) => response.result[prop] === undefined - ) - ) { - throw new Error("Incomplete scroll results"); - } - }); + if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { + throw new Error('Incomplete scroll results'); + } + }); }); diff --git a/features-legacy/step_definitions/validation.js b/features-legacy/step_definitions/validation.js index b4342ce93e..bd3bed6a3d 100644 --- a/features-legacy/step_definitions/validation.js +++ b/features-legacy/step_definitions/validation.js @@ -1,144 +1,127 @@ -"use strict"; +'use strict'; -const { When, Then } = require("cucumber"), - async = require("async"); +const + { + When, + Then + } = require('cucumber'), + async = require('async'); -const validSpecifications = { +const + validSpecifications = { strict: true, fields: { myField: { mandatory: true, - type: "integer", - defaultValue: 42, - }, - }, + type: 'integer', + defaultValue: 42 + } + } }, notValidSpecifications = { strict: true, fields: { myField: { mandatory: true, - type: "not valid", - defaultValue: 42, - }, - }, + type: 'not valid', + defaultValue: 42 + } + } }, validDocument = { - myField: 42, + myField: 42 }, notValidDocument = { - myField: "fooBarBaz", + myField: 'fooBarBaz' }; -When( - /^There is (no)?(a)? specifications? for index "([^"]*)" and collection "([^"]*)"$/, - {}, - function (no, some, index, collection, callback) { - const idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection; - - this.api - .getSpecifications(idx, coll) - .then((body) => { - if (body.error) { - if (no) { - return callback(); - } - return callback(new Error(body.error.message)); - } +When(/^There is (no)?(a)? specifications? for index "([^"]*)" and collection "([^"]*)"$/, {}, function (no, some, index, collection, callback) { + const + idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection; + this.api.getSpecifications(idx, coll) + .then(body => { + if (body.error) { if (no) { - return callback(new Error(JSON.stringify(body))); - } - return callback(); - }) - .catch((error) => callback(no ? null : error)); - } -); - -Then( - /^I put a (not )?valid ?specification for index "([^"]*)" and collection "([^"]*)"$/, - {}, - function (not, index, collection, callback) { - const idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection, - specifications = not ? notValidSpecifications : validSpecifications, - body = specifications; - - this.api - .updateSpecifications(idx, coll, body) - .then((_body) => { - this.statusCode = _body.status; - if (not) { - return callback(new Error(JSON.stringify(_body))); - } - return callback(); - }) - .catch((error) => { - this.statusCode = error.statusCode; - if (not) { return callback(); } - callback(error); - }); - } -); - -Then( - /^There is (an)?(no)? error message( in the response body)?$/, - {}, - function (noError, withError, inBody, callback) { - if (this.statusCode !== 200) { - if (noError) { - if (inBody) { - // we should always have a 200 response status, error whould be in the response body - return callback( - new Error( - "Status code is " + this.statusCode + ", but 200 was expected" - ) - ); - } + return callback(new Error(body.error.message)); + } + + if (no) { + return callback(new Error(JSON.stringify(body))); + } + return callback(); + }) + .catch(error => callback(no ? null : error)); +}); + +Then(/^I put a (not )?valid ?specification for index "([^"]*)" and collection "([^"]*)"$/, {}, function (not, index, collection, callback) { + const + idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection, + specifications = not ? notValidSpecifications : validSpecifications, + body = specifications; + + this.api.updateSpecifications( + idx, + coll, + body) + .then(_body => { + this.statusCode = _body.status; + if (not) { + return callback(new Error(JSON.stringify(_body))); + } + return callback(); + }) + .catch(error => { + this.statusCode = error.statusCode; + if (not) { return callback(); } - return callback( - new Error( - "Status code is " + this.statusCode + ", but 200 was expected" - ) - ); - } + callback(error); + }); +}); - // Status is 200 +Then(/^There is (an)?(no)? error message( in the response body)?$/, {}, function (noError, withError, inBody, callback) { + if (this.statusCode !== 200) { if (noError) { if (inBody) { - if ( - this.body.result.valid === false && - this.body.result.details && - this.body.result.description - ) { - return callback(); - } - return callback(new Error(JSON.stringify(this.body))); + // we should always have a 200 response status, error whould be in the response body + return callback(new Error('Status code is ' + this.statusCode + ', but 200 was expected')); } - return callback( - new Error( - "Status code is " + this.statusCode + ", but an error was expected" - ) - ); + return callback(); } + return callback(new Error('Status code is ' + this.statusCode + ', but 200 was expected')); + } - return callback(); + // Status is 200 + if (noError) { + if (inBody) { + if (this.body.result.valid === false && this.body.result.details && this.body.result.description) { + return callback(); + } + return callback(new Error(JSON.stringify(this.body))); + } + return callback(new Error('Status code is ' + this.statusCode + ', but an error was expected')); } -); + + return callback(); +}); When(/^I post a(n in)? ?valid ?specification$/, {}, function (not, callback) { - const index = this.fakeIndex, + const + index = this.fakeIndex, collection = this.fakeCollection, specifications = not ? notValidSpecifications : validSpecifications, body = specifications; - this.api - .validateSpecifications(index, collection, body) - .then((_body) => { + this.api.validateSpecifications( + index, + collection, + body) + .then(_body => { this.statusCode = _body.status; this.body = _body; @@ -147,27 +130,27 @@ When(/^I post a(n in)? ?valid ?specification$/, {}, function (not, callback) { return callback(); }) - .catch((error) => { + .catch(error => { this.statusCode = error.statusCode; return callback(error); }); }); When(/^I post a(n in)? ?valid document/, {}, function (not, callback) { - const index = this.fakeIndex, + const + index = this.fakeIndex, collection = this.fakeCollection, document = not ? notValidDocument : validDocument; - this.api - .postDocument(index, collection, document) - .then((body) => { + this.api.postDocument(index, collection, document) + .then(body => { this.statusCode = body.status; if (not) { return callback(new Error(JSON.stringify(body))); } return callback(); }) - .catch((error) => { + .catch(error => { this.statusCode = error.statusCode; if (not) { return callback(); @@ -176,103 +159,80 @@ When(/^I post a(n in)? ?valid document/, {}, function (not, callback) { }); }); -When( - /^I delete the specifications (again )?for index "([^"]*)" and collection "([^"]*)"$/, - {}, - function (again, index, collection, callback) { - const idx = index ? index : this.fakeIndex, - coll = collection ? collection : this.fakeCollection; - - this.api - .deleteSpecifications(idx, coll) - .then((body) => { - this.statusCode = body.status; - callback(); - - return null; - }) - .catch((error) => { - this.statusCode = error.statusCode; - callback(); - - return null; - }); - } -); - -Then( - /^I find (\d+) specifications(?: with scroll "([^"]+)")?/, - function (hits, scroll, callback) { - this.scrollId = null; - - hits = Number.parseInt(hits); - - let search = function (callbackAsync) { - setTimeout(() => { - this.api - .searchSpecifications({}, scroll && { scroll }) - .then((response) => { - if (response.error) { - return callbackAsync(new Error(response.error.message)); - } - - if (scroll && !response.result.scrollId) { - return callbackAsync( - new Error("No scrollId returned by the searchProfile query") - ); - } - - if ( - response.result.hits === undefined || - response.result.total === undefined - ) { - return callbackAsync(new Error("Malformed search results")); - } - - if ( - response.result.hits.length !== hits || - response.result.total !== hits - ) { - return callbackAsync( - new Error( - `Wrong number of results. Expected: ${hits}, got ${response.result.hits.length} (or ${response.result.total})` - ) - ); - } - - this.scrollId = response.result.scrollId; - callbackAsync(); - }) - .catch((err) => callbackAsync(err)); - }, 200); - }; - - async.retry(20, search.bind(this), function (err) { - if (err) { - return callback(new Error(err)); - } +When(/^I delete the specifications (again )?for index "([^"]*)" and collection "([^"]*)"$/, {}, function (again, index, collection, callback) { + const + idx = index ? index : this.fakeIndex, + coll = collection ? collection : this.fakeCollection; + this.api.deleteSpecifications(idx, coll) + .then(body => { + this.statusCode = body.status; callback(); + + return null; + }) + .catch(error => { + this.statusCode = error.statusCode; + callback(); + + return null; }); - } -); +}); -Then(/^I am able to perform a scrollSpecifications request$/, function () { - if (!this.scrollId) { - throw new Error("No previous scrollId found"); - } +Then(/^I find (\d+) specifications(?: with scroll "([^"]+)")?/, function (hits, scroll, callback) { + this.scrollId = null; - return this.api.scrollSpecifications(this.scrollId).then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + hits = Number.parseInt(hits); + + let search = function (callbackAsync) { + setTimeout(() => { + this.api.searchSpecifications({}, scroll && { scroll }) + .then(response => { + if (response.error) { + return callbackAsync(new Error(response.error.message)); + } + + if (scroll && ! response.result.scrollId) { + return callbackAsync(new Error('No scrollId returned by the searchProfile query')); + } + + if (response.result.hits === undefined || response.result.total === undefined) { + return callbackAsync(new Error('Malformed search results')); + } - if ( - ["hits", "scrollId", "total"].some( - (prop) => response.result[prop] === undefined - ) - ) { - throw new Error("Incomplete scroll results"); + if (response.result.hits.length !== hits || response.result.total !== hits) { + return callbackAsync(new Error(`Wrong number of results. Expected: ${hits}, got ${response.result.hits.length} (or ${response.result.total})`)); + } + + this.scrollId = response.result.scrollId; + callbackAsync(); + }) + .catch(err => callbackAsync(err)); + }, 200); + }; + + async.retry(20, search.bind(this), function (err) { + if (err) { + return callback(new Error(err)); } + + callback(); }); }); + +Then(/^I am able to perform a scrollSpecifications request$/, function () { + if (! this.scrollId) { + throw new Error('No previous scrollId found'); + } + + return this.api.scrollSpecifications(this.scrollId) + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } + + if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { + throw new Error('Incomplete scroll results'); + } + }); +}); From 0e6b1cc3f13b58f3a59f7c3224e73d0f9e007c22 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:25:24 +0100 Subject: [PATCH 26/28] Revert --- features-legacy/step_definitions/profiles.js | 558 ++++++++----------- features-legacy/support/api/mqtt.js | 2 +- 2 files changed, 243 insertions(+), 317 deletions(-) diff --git a/features-legacy/step_definitions/profiles.js b/features-legacy/step_definitions/profiles.js index 321afcd9cd..2551d076b3 100644 --- a/features-legacy/step_definitions/profiles.js +++ b/features-legacy/step_definitions/profiles.js @@ -1,387 +1,313 @@ -"use strict"; +'use strict'; -const { Given, When, Then } = require("cucumber"), - async = require("async"), - stringify = require("json-stable-stringify"); +const + { + Given, + When, + Then + } = require('cucumber'), + async = require('async'), + stringify = require('json-stable-stringify'); When(/^I get the profile mapping$/, function () { - return this.api.getProfileMapping().then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.getProfileMapping() + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if (!response.result) { - throw new Error("No result provided"); - } + if (! response.result) { + throw new Error('No result provided'); + } - if (!response.result.mapping) { - throw new Error("No mapping provided"); - } + if (! response.result.mapping) { + throw new Error('No mapping provided'); + } - this.result = response.result.mapping; - }); + this.result = response.result.mapping; + }); }); Then(/^I change the profile mapping$/, function () { - return this.api.updateProfileMapping().then((body) => { - if (body.error !== null) { - throw new Error(body.error.message); - } - }); + return this.api.updateProfileMapping() + .then(body => { + if (body.error !== null) { + throw new Error(body.error.message); + } + }); }); -When( - /^I create a new profile "([^"]*)" with id "([^"]*)"$/, - { timeout: 20 * 1000 }, - function (profile, id) { - if (!this.profiles[profile]) { - throw new Error("Fixture for profile " + profile + " does not exists"); - } +When(/^I create a new profile "([^"]*)" with id "([^"]*)"$/, { timeout: 20 * 1000 }, function (profile, id) { + if (! this.profiles[profile]) { + throw new Error('Fixture for profile ' + profile + ' does not exists'); + } - id = this.idPrefix + id; + id = this.idPrefix + id; - return this.api - .createOrReplaceProfile(id, this.profiles[profile]) - .then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - }); - } -); - -Then( - /^I cannot create an invalid profile$/, - { timeout: 20 * 1000 }, - function (callback) { - this.api - .createOrReplaceProfile("invalid-profile", this.profiles.invalidProfile) - .then(() => { - callback( - new Error( - "Creating profile with unexisting role succeeded. Expected to throw." - ) - ); - }) - .catch(() => callback()); - } -); - -Then( - /^I cannot create a profile with an empty set of roles$/, - { timeout: 20 * 1000 }, - function (callback) { - this.api - .createOrReplaceProfile("invalid-profile", this.profiles.empty) - .then(() => { - callback( - new Error( - "Creating profile without roles succeeded. Expected to throw." - ) - ); - }) - .catch(() => callback()); - } -); + return this.api.createOrReplaceProfile(id, this.profiles[profile]) + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + }); +}); + +Then(/^I cannot create an invalid profile$/, { timeout: 20 * 1000 }, function (callback) { + this.api.createOrReplaceProfile('invalid-profile', this.profiles.invalidProfile) + .then(() => { + callback(new Error('Creating profile with unexisting role succeeded. Expected to throw.')); + }) + .catch(() => callback()); +}); + +Then(/^I cannot create a profile with an empty set of roles$/, { timeout: 20 * 1000 }, function (callback) { + this.api.createOrReplaceProfile('invalid-profile', this.profiles.empty) + .then(() => { + callback(new Error('Creating profile without roles succeeded. Expected to throw.')); + }) + .catch(() => callback()); +}); Then(/^I cannot get a profile without ID$/, function (callback) { - this.api - .getProfile("") + this.api.getProfile('') .then(() => { - callback( - new Error("Getting profile without id succeeded. Expected to throw.") - ); + callback(new Error('Getting profile without id succeeded. Expected to throw.')); }) .catch(() => callback()); }); -Then( - /^I'm ?(not)* able to find the ?(default)* profile with id "([^"]*)"(?: with profile "([^"]*)")?$/, - { timeout: 20 * 1000 }, - function (not, _default, id, profile, callback) { - if (profile && !this.profiles[profile]) { - return callback( - new Error("Fixture for profile " + profile + " not exists") - ); - } +Then(/^I'm ?(not)* able to find the ?(default)* profile with id "([^"]*)"(?: with profile "([^"]*)")?$/, { timeout: 20 * 1000 }, function (not, _default, id, profile, callback) { + if (profile && ! this.profiles[profile]) { + return callback(new Error('Fixture for profile ' + profile + ' not exists')); + } - if (!_default) { - id = this.idPrefix + id; - } + if (! _default) { + id = this.idPrefix + id; + } - const main = function (callbackAsync) { - setTimeout(() => { - this.api - .getProfile(id) - .then((body) => { - if (body.error) { - return callbackAsync(new Error(body.error.message)); + const main = function (callbackAsync) { + setTimeout(() => { + this.api.getProfile(id) + .then(body => { + if (body.error) { + return callbackAsync(new Error(body.error.message)); + } + + if (not) { + return callbackAsync(new Error(`Profile with id ${id} exists`)); + } + + if (profile) { + const + compare = (a, b) => { + return a.roleId <= b.roleId; + }, + policies = stringify(body.result._source.policies.sort(compare)), + expected = stringify(this.profiles[profile].policies.sort(compare)); + + if (policies !== expected) { + return callbackAsync('policies does not match'); } + } - if (not) { - return callbackAsync(new Error(`Profile with id ${id} exists`)); - } + callbackAsync(); + }) + .catch(error => callback(not ? null : error)); + }, 20); // end setTimeout + }; - if (profile) { - const compare = (a, b) => { - return a.roleId <= b.roleId; - }, - policies = stringify( - body.result._source.policies.sort(compare) - ), - expected = stringify( - this.profiles[profile].policies.sort(compare) - ); - - if (policies !== expected) { - return callbackAsync("policies does not match"); - } - } + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(err); + } - callbackAsync(); - }) - .catch((error) => callback(not ? null : error)); - }, 20); // end setTimeout - }; + callback(); + }); +}); + +Then(/^I'm ?(not)* able to find rights for profile "([^"]*)"$/, { timeout: 20 * 1000 }, function (not, id) { + return this.api.getProfileRights(this.idPrefix + id) + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + + const + policies = stringify(body.result.hits), + expected = stringify(this.policies[id]); - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(err); + if (policies !== expected) { + throw new Error(`Bad profileRights for ${id}.\nExpected: ${expected}\nGot: ${policies}`); } - callback(); + if (not) { + throw new Error(`Profile with id ${id} exists`); + } + }) + .catch(err => { + if (! not || err.statusCode !== 404) { + return Promise.reject(err); + } }); - } -); - -Then( - /^I'm ?(not)* able to find rights for profile "([^"]*)"$/, - { timeout: 20 * 1000 }, - function (not, id) { - return this.api - .getProfileRights(this.idPrefix + id) - .then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - - const policies = stringify(body.result.hits), - expected = stringify(this.policies[id]); - - if (policies !== expected) { - throw new Error( - `Bad profileRights for ${id}.\nExpected: ${expected}\nGot: ${policies}` - ); - } - - if (not) { - throw new Error(`Profile with id ${id} exists`); - } - }) - .catch((err) => { - if (!not || err.statusCode !== 404) { - return Promise.reject(err); - } - }); - } -); +}); When(/^I delete the profile (?:with id )?"([^"]*)"$/, function (id) { if (id) { id = this.idPrefix + id; } - return this.api.deleteProfile(id).then((body) => { - if (body.error) { - throw new Error(body.error.message); - } - }); + return this.api.deleteProfile(id) + .then(body => { + if (body.error) { + throw new Error(body.error.message); + } + }); }); -Then( - /^I'm not able to delete profile (?:with id )?"([^"]*)"$/, - function (id, callback) { - if (id) { - id = this.idPrefix + id; - } - - this.api - .deleteProfile(id) - .then(() => { - callback( - new Error( - "Trying to delete a profile still used by a user. Expected to throw." - ) - ); - }) - .catch(() => callback()); +Then(/^I'm not able to delete profile (?:with id )?"([^"]*)"$/, function (id, callback) { + if (id) { + id = this.idPrefix + id; } -); -Then( - /^I'm able to find "([\d]*)" profiles(?: containing the role with id "([^"]*)")?$/, - function (profilesCount, roleId, callback) { - const roles = []; + this.api.deleteProfile(id) + .then(() => { + callback(new Error('Trying to delete a profile still used by a user. Expected to throw.')); + }) + .catch(() => callback()); +}); - if (roleId) { - roles.push(this.idPrefix + roleId); - } +Then(/^I'm able to find "([\d]*)" profiles(?: containing the role with id "([^"]*)")?$/, function (profilesCount, roleId, callback) { + const roles = []; - let main = function (callbackAsync) { - setTimeout(() => { - this.api - .searchProfiles(roles) - .then((response) => { - if (response.error) { - return callbackAsync(new Error(response.error.message)); - } + if (roleId) { + roles.push(this.idPrefix + roleId); + } - if (!response.result) { - return callbackAsync( - new Error("Malformed response (no error, no result)") - ); - } + let main = function (callbackAsync) { + setTimeout(() => { + this.api.searchProfiles(roles) + .then(response => { + if (response.error) { + return callbackAsync(new Error(response.error.message)); + } - if (!Array.isArray(response.result.hits)) { - return callbackAsync( - new Error("Malformed response (hits is not an array)") - ); - } + if (! response.result) { + return callbackAsync(new Error('Malformed response (no error, no result)')); + } - if (!response.result.hits) { - response.result.hits = response.result.hits.filter((doc) => - doc._id.indexOf(this.idPrefix) - ); + if (! Array.isArray(response.result.hits)) { + return callbackAsync(new Error('Malformed response (hits is not an array)')); + } - if (response.result.hits.length !== parseInt(profilesCount)) { - return callbackAsync( - `Expected ${profilesCount} profiles. Got ${response.result.hits.length}` - ); - } - } + if (! response.result.hits) { + response.result.hits = response.result.hits.filter(doc => doc._id.indexOf(this.idPrefix)); - callbackAsync(); - }) - .catch((err) => callbackAsync(err)); - }, 200); - }; + if (response.result.hits.length !== parseInt(profilesCount)) { + return callbackAsync(`Expected ${profilesCount} profiles. Got ${response.result.hits.length}`); + } + } - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(new Error(err)); - } + callbackAsync(); + }) + .catch(err => callbackAsync(err)); + }, 200); + }; - callback(); - }); - } -); - -Given( - /^I update the ?(default)* profile with id "([^"]*)" by adding the role "([^"]*)"$/, - { timeout: 20 * 1000 }, - function (_default, profileId, roleId) { - if (!this.roles[roleId]) { - throw new Error("Fixture for role " + roleId + " does not exists"); + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(new Error(err)); } - const policies = [{ roleId: this.idPrefix + roleId }]; - - if (_default) { - // keep `admin`/`default`/`anonymous` roles for eponymous profiles - // (to avoid error if we try to update anonymous profile without anonymous role) - policies.push({ roleId: profileId }); - } else { - profileId = this.idPrefix + profileId; - } + callback(); + }); +}); - return this.api - .createOrReplaceProfile(profileId, { policies }) - .then((response) => { - if (response.error) { - throw new Error(response.error.message); - } - }); +Given(/^I update the ?(default)* profile with id "([^"]*)" by adding the role "([^"]*)"$/, { timeout: 20 * 1000 }, function (_default, profileId, roleId) { + if (! this.roles[roleId]) { + throw new Error('Fixture for role ' + roleId + ' does not exists'); } -); - -Then( - /^I'm able to do a multi get with "([^"]*)" and get "(\d*)" profiles$/, - function (profiles, count, callback) { - let body = { - ids: profiles.split(",").map((roleId) => this.idPrefix + roleId), - }; - - let main = function (callbackAsync) { - setTimeout(() => { - this.api - .mGetProfiles(body) - .then((response) => { - if (response.error) { - return callbackAsync(response.error.message); - } - if ( - !response.result.hits || - response.result.hits.length !== parseInt(count) - ) { - return callbackAsync( - "Expected " + - count + - " profiles, get " + - response.result.hits.length - ); - } + const policies = [{ roleId: this.idPrefix + roleId }]; - callbackAsync(); - }) - .catch((err) => callbackAsync(err)); - }, 100); // end setTimeout - }; + if (_default) { + // keep `admin`/`default`/`anonymous` roles for eponymous profiles + // (to avoid error if we try to update anonymous profile without anonymous role) + policies.push({ roleId: profileId }); + } + else { + profileId = this.idPrefix + profileId; + } - async.retry(20, main.bind(this), function (err) { - if (err) { - return callback(err); + return this.api.createOrReplaceProfile(profileId, { policies }) + .then(response => { + if (response.error) { + throw new Error(response.error.message); } - - callback(); }); - } -); +}); + +Then(/^I'm able to do a multi get with "([^"]*)" and get "(\d*)" profiles$/, function (profiles, count, callback) { + let body = { + ids: profiles.split(',').map(roleId => this.idPrefix + roleId) + }; + + let main = function (callbackAsync) { + setTimeout(() => { + this.api.mGetProfiles(body) + .then(response => { + if (response.error) { + return callbackAsync(response.error.message); + } + + if (! response.result.hits || response.result.hits.length !== parseInt(count)) { + return callbackAsync('Expected ' + count + ' profiles, get ' + response.result.hits.length); + } + + callbackAsync(); + }) + .catch(err => callbackAsync(err)); + }, 100); // end setTimeout + }; + + async.retry(20, main.bind(this), function (err) { + if (err) { + return callback(err); + } + + callback(); + }); +}); Given(/^A scrolled search on profiles$/, function () { this.scrollId = null; - return this.api.searchProfiles([], { scroll: "2s" }).then((response) => { - console.log("response", response); - - if (response.error) { - throw new Error(response.error.message); - } + return this.api.searchProfiles([], { scroll: '2s' }) + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if (!response.result.scrollId) { - throw new Error("No scrollId returned by the searchProfile query"); - } + if (! response.result.scrollId) { + throw new Error('No scrollId returned by the searchProfile query'); + } - this.scrollId = response.result.scrollId; - }); + this.scrollId = response.result.scrollId; + }); }); Then(/^I am able to perform a scrollProfiles request$/, function () { - if (!this.scrollId) { - throw new Error("No previous scrollId found"); + if (! this.scrollId) { + throw new Error('No previous scrollId found'); } - return this.api.scrollProfiles(this.scrollId).then((response) => { - if (response.error) { - throw new Error(response.error.message); - } + return this.api.scrollProfiles(this.scrollId) + .then(response => { + if (response.error) { + throw new Error(response.error.message); + } - if ( - ["hits", "scrollId", "total"].some( - (prop) => response.result[prop] === undefined - ) - ) { - throw new Error("Incomplete scroll results"); - } - }); + if (['hits', 'scrollId', 'total'].some(prop => response.result[prop] === undefined)) { + throw new Error('Incomplete scroll results'); + } + }); }); diff --git a/features-legacy/support/api/mqtt.js b/features-legacy/support/api/mqtt.js index a2b8fa7753..97ad59a7bc 100644 --- a/features-legacy/support/api/mqtt.js +++ b/features-legacy/support/api/mqtt.js @@ -175,4 +175,4 @@ class MqttApi extends ApiBase { } -module.exports = MqttApi; +module.exports = MqttApi; \ No newline at end of file From 41578391dd4dec05dc72558bc894396d5c805137 Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 29 Nov 2023 15:27:16 +0100 Subject: [PATCH 27/28] Revert Linting --- .../step_definitions/collections.js | 321 ++++++++---------- features-legacy/support/api/mqtt.js | 2 +- 2 files changed, 135 insertions(+), 188 deletions(-) diff --git a/features-legacy/step_definitions/collections.js b/features-legacy/step_definitions/collections.js index 2f8e77a0e7..ffaa817856 100644 --- a/features-legacy/step_definitions/collections.js +++ b/features-legacy/step_definitions/collections.js @@ -1,226 +1,173 @@ -"use strict"; - -const { When, Then } = require("cucumber"), - should = require("should"), - stepUtils = require("../support/stepUtils"); - -When( - /^I list "([^"]*)" data collections(?: in index "([^"]*)")?$/, - function (type, index, callback) { - this.api - .listCollections(index, type) - .then((response) => { - if (response.error) { - callback(new Error(response.error.message)); - return false; - } - - if (!response.result) { - return callback(new Error("No result provided")); - } - - this.result = response.result; - callback(); - }) - .catch((error) => callback(error)); - } -); +'use strict'; + +const + { + When, + Then + } = require('cucumber'), + should = require('should'), + stepUtils = require('../support/stepUtils'); + +When(/^I list "([^"]*)" data collections(?: in index "([^"]*)")?$/, function (type, index, callback) { + this.api.listCollections(index, type) + .then(response => { + if (response.error) { + callback(new Error(response.error.message)); + return false; + } + + if (! response.result) { + return callback(new Error('No result provided')); + } -When("I try to create the collection {string}", async function (collection) { + this.result = response.result; + callback(); + }) + .catch(error => callback(error)); +}); + +When('I try to create the collection {string}', async function (collection) { try { const response = await this.api.createCollection(null, collection); this.result = response; - } catch (error) { + } + catch (error) { this.result = { error }; } }); -When( - "I create a collection named {string} in index {string}", - async function (collection, index) { - await this.api.createCollection(index, collection); - } -); - -Then( - /^I can ?(not)* find a ?(.*?) collection ?(.*)$/, - function (not, type, collection, callback) { - if (!this.result.collections) { - return callback( - "Expected a collections list result, got: " + this.result - ); - } - - if (!collection) { - if (this.result.collections.length === 0) { - if (not) { - return callback(); - } +When('I create a collection named {string} in index {string}', async function (collection, index) { + await this.api.createCollection(index, collection); +}); - return callback( - "Collection list is empty, expected collections to be listed" - ); - } - } +Then(/^I can ?(not)* find a ?(.*?) collection ?(.*)$/, function (not, type, collection, callback) { + if (! this.result.collections) { + return callback('Expected a collections list result, got: ' + this.result); + } - if ( - this.result.collections.filter( - (item) => item.type === type && item.name === collection - ).length !== 0 - ) { + if (! collection) { + if (this.result.collections.length === 0) { if (not) { - return callback( - "Expected collection " + - collection + - " not to appear in the collection list" - ); + return callback(); } - return callback(); + return callback('Collection list is empty, expected collections to be listed'); } - - callback( - "Expected to find the collection <" + - collection + - "> in this collections list: " + - JSON.stringify(this.result.collections) - ); - } -); - -Then( - /^I change the mapping(?: in index "([^"]*)")?$/, - function (index, callback) { - this.api - .updateMapping() - .then((body) => { - if (body.error !== null) { - callback(new Error(body.error.message)); - return false; - } - - callback(); - }) - .catch(function (error) { - callback(new Error(error)); - }); } -); - -Then( - /^I truncate the collection(?: "(.*?)")?(?: in index "([^"]*)")?$/, - function (collection, index, callback) { - this.api - .truncateCollection(index, collection) - .then((body) => { - if (body.error !== null) { - return callback(body.error); - } - - callback(); - }) - .catch((error) => callback(error)); + + if (this.result.collections.filter(item => item.type === type && item.name === collection).length !== 0) { + if (not) { + return callback('Expected collection ' + collection + ' not to appear in the collection list'); + } + + return callback(); } -); + + callback('Expected to find the collection <' + collection + '> in this collections list: ' + JSON.stringify(this.result.collections)); +}); + +Then(/^I change the mapping(?: in index "([^"]*)")?$/, function (index, callback) { + this.api.updateMapping() + .then(body => { + if (body.error !== null) { + callback(new Error(body.error.message)); + return false; + } + + callback(); + }) + .catch(function (error) { + callback(new Error(error)); + }); +}); + +Then(/^I truncate the collection(?: "(.*?)")?(?: in index "([^"]*)")?$/, function (collection, index, callback) { + this.api.truncateCollection(index, collection) + .then(body => { + if (body.error !== null) { + return callback(body.error); + } + + callback(); + }) + .catch(error => callback(error)); +}); Then(/I refresh the collection( "(.*?)")?/, function (indexCollection) { indexCollection = indexCollection ? indexCollection - : this.fakeIndex + ":" + this.fakeCollection; + : this.fakeIndex + ':' + this.fakeCollection; - const [index, collection] = indexCollection.split(":"); + const [index, collection] = indexCollection.split(':'); return this.api.refreshCollection(index, collection); }); When(/^I check if index "(.*?)" exists$/, function (index, cb) { - return stepUtils.getReturn.call(this, "indexExists", index, cb); + return stepUtils.getReturn.call(this, 'indexExists', index, cb); }); -When( - /I check if collection "(.*?)" exists on index "(.*?)"$/, - function (collection, index, cb) { - return stepUtils.getReturn.call( - this, - "collectionExists", - index, - collection, - cb - ); - } -); +When(/I check if collection "(.*?)" exists on index "(.*?)"$/, function (collection, index, cb) { + return stepUtils.getReturn.call(this, 'collectionExists', index, collection, cb); +}); -When( - /I create a collection "([\w-]+)":"([\w-]+)"( with "([\d]+)" documents)?/, - function (index, collection, countRaw) { - return this.api.createCollection(index, collection).then(() => { - const promises = [], +When(/I create a collection "([\w-]+)":"([\w-]+)"( with "([\d]+)" documents)?/, function (index, collection, countRaw) { + return this.api.createCollection(index, collection) + .then(() => { + const + promises = [], count = parseInt(countRaw); for (let i = 0; i < count; ++i) { - promises.push( - this.api.create({ number: `doc-${i}` }, index, collection) - ); + promises.push(this.api.create({ number: `doc-${i}` }, index, collection)); } return Promise.all(promises); }); - } -); - -Then( - "The mapping dynamic field of {string}:{string} is {string}", - function (index, collection, dynamicValue) { - return this.api - .getCollectionMapping(index, collection) - .then(({ result }) => { - const expectedValue = - dynamicValue === "the default value" - ? "true" // we set the default value to true in the environment for tests - : dynamicValue; - - should(result.dynamic).not.be.undefined().be.eql(expectedValue); - }); - } -); +}); -When( - "I update the mapping of {string}:{string} with {string}", - function (index, collection, rawMapping) { - const mapping = JSON.parse(rawMapping); +Then('The mapping dynamic field of {string}:{string} is {string}', function (index, collection, dynamicValue) { + return this.api.getCollectionMapping(index, collection) + .then(({ result }) => { + const expectedValue = dynamicValue === 'the default value' + ? 'true' // we set the default value to true in the environment for tests + : dynamicValue; - return this.api.updateMapping(index, collection, mapping); - } -); - -Then( - "The mapping properties field of {string}:{string} is {string}", - function (index, collection, rawMapping) { - const includeKuzzleMeta = rawMapping === "the default value"; - - return this.api - .getCollectionMapping(index, collection, includeKuzzleMeta) - .then(({ result }) => { - const expectedValue = - rawMapping === "the default value" - ? this.kuzzleConfig.services.storageEngine.commonMapping.properties - : JSON.parse(rawMapping); - - should(result.properties).be.eql(expectedValue); - }); - } -); - -Then( - "The mapping _meta field of {string}:{string} is {string}", - function (index, collection, rawMapping) { - const mapping = JSON.parse(rawMapping); - - return this.api - .getCollectionMapping(index, collection) - .then(({ result }) => { - should(result._meta).not.be.undefined().be.eql(mapping._meta); - }); - } -); + should(result.dynamic) + .not.be.undefined() + .be.eql(expectedValue); + }); +}); + +When('I update the mapping of {string}:{string} with {string}', function (index, collection, rawMapping) { + const mapping = JSON.parse(rawMapping); + + return this.api.updateMapping(index, collection, mapping); +}); + +Then('The mapping properties field of {string}:{string} is {string}', function (index, collection, rawMapping) { + const includeKuzzleMeta = rawMapping === 'the default value'; + + return this.api.getCollectionMapping(index, collection, includeKuzzleMeta) + .then(({ result }) => { + const expectedValue = rawMapping === 'the default value' + ? this.kuzzleConfig.services.storageEngine.commonMapping.properties + : JSON.parse(rawMapping); + + should(result.properties) + .be.eql(expectedValue); + }); +}); + +Then('The mapping _meta field of {string}:{string} is {string}', function (index, collection, rawMapping) { + const mapping = JSON.parse(rawMapping); + + return this.api.getCollectionMapping(index, collection) + .then(({ result }) => { + + should(result._meta) + .not.be.undefined() + .be.eql(mapping._meta); + }); +}); diff --git a/features-legacy/support/api/mqtt.js b/features-legacy/support/api/mqtt.js index 97ad59a7bc..a2b8fa7753 100644 --- a/features-legacy/support/api/mqtt.js +++ b/features-legacy/support/api/mqtt.js @@ -175,4 +175,4 @@ class MqttApi extends ApiBase { } -module.exports = MqttApi; \ No newline at end of file +module.exports = MqttApi; From 6b5addbec347faa98ffbfd391f7390fd924638eb Mon Sep 17 00:00:00 2001 From: rolljee Date: Wed, 6 Dec 2023 16:09:47 +0100 Subject: [PATCH 28/28] Lint the application --- lib/service/storage/elasticsearch.ts | 92 ++++++++++++++-------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/service/storage/elasticsearch.ts b/lib/service/storage/elasticsearch.ts index d38fb74fa8..2a7b410ac3 100644 --- a/lib/service/storage/elasticsearch.ts +++ b/lib/service/storage/elasticsearch.ts @@ -221,7 +221,7 @@ export default class ElasticSearch extends Service { "services", "storage", "version_mismatch", - version.number + version.number, ); } @@ -360,7 +360,7 @@ export default class ElasticSearch extends Service { "services", "storage", "scroll_duration_too_great", - _scrollTTL + _scrollTTL, ); } } @@ -434,7 +434,7 @@ export default class ElasticSearch extends Service { from?: number; size?: number; scroll?: string; - } = {} + } = {}, ) { let esIndexes: any; @@ -470,7 +470,7 @@ export default class ElasticSearch extends Service { "services", "storage", "scroll_duration_too_great", - scroll + scroll, ); } } @@ -594,7 +594,7 @@ export default class ElasticSearch extends Service { for (const [name, innerHit] of Object.entries(innerHits)) { formattedInnerHits[name] = await Bluebird.map( (innerHit as any).hits.hits, - formatHit + formatHit, ); } return formattedInnerHits; @@ -755,7 +755,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; userId?: string; injectKuzzleMeta?: boolean; - } = {} + } = {}, ) { assertIsObject(content); @@ -819,7 +819,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; userId?: string; injectKuzzleMeta?: boolean; - } = {} + } = {}, ) { const esRequest = { body: content, @@ -883,7 +883,7 @@ export default class ElasticSearch extends Service { userId?: string; retryOnConflict?: number; injectKuzzleMeta?: boolean; - } = {} + } = {}, ) { const esRequest: RequestParams.Update> = { _source: "true", @@ -949,7 +949,7 @@ export default class ElasticSearch extends Service { userId?: string; retryOnConflict?: number; injectKuzzleMeta?: boolean; - } = {} + } = {}, ) { const esRequest: RequestParams.Update> = { _source: "true", @@ -1022,7 +1022,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; userId?: string; injectKuzzleMeta?: boolean; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -1055,7 +1055,7 @@ export default class ElasticSearch extends Service { "not_found", id, index, - collection + collection, ); } @@ -1091,7 +1091,7 @@ export default class ElasticSearch extends Service { refresh, }: { refresh?: boolean | "wait_for"; - } = {} + } = {}, ) { const esRequest = { id, @@ -1139,7 +1139,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; size?: number; fetch?: boolean; - } = {} + } = {}, ) { const esRequest: RequestParams.DeleteByQuery> = { body: this._sanitizeSearchBody({ query }), @@ -1201,7 +1201,7 @@ export default class ElasticSearch extends Service { }: { refresh?: boolean | "wait_for"; userId?: string; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -1271,7 +1271,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; size?: number; userId?: string; - } = {} + } = {}, ) { try { const esRequest = { @@ -1326,7 +1326,7 @@ export default class ElasticSearch extends Service { refresh = false, }: { refresh?: boolean; - } = {} + } = {}, ) { const script = { params: {}, @@ -1370,7 +1370,7 @@ export default class ElasticSearch extends Service { "storage", "incomplete_update", response.body.updated, - errors + errors, ); } @@ -1402,7 +1402,7 @@ export default class ElasticSearch extends Service { }: { size?: number; scrollTTl?: string; - } = {} + } = {}, ): Promise { const esRequest: RequestParams.Search = { body: this._sanitizeSearchBody({ query }), @@ -1501,7 +1501,7 @@ export default class ElasticSearch extends Service { "storage", "index_already_exists", indexType, - index + index, ); } } @@ -1527,7 +1527,7 @@ export default class ElasticSearch extends Service { { mappings = {}, settings = {}, - }: { mappings?: TypeMapping; settings?: Record } = {} + }: { mappings?: TypeMapping; settings?: Record } = {}, ) { this._assertValidIndexAndCollection(index, collection); @@ -1536,7 +1536,7 @@ export default class ElasticSearch extends Service { "services", "storage", "collection_reserved", - HIDDEN_COLLECTION + HIDDEN_COLLECTION, ); } @@ -1650,7 +1650,7 @@ export default class ElasticSearch extends Service { includeKuzzleMeta = false, }: { includeKuzzleMeta?: boolean; - } = {} + } = {}, ) { const indice = await this._getIndice(index, collection); const esRequest = { @@ -1691,7 +1691,7 @@ export default class ElasticSearch extends Service { { mappings = {}, settings = {}, - }: { mappings?: TypeMapping; settings?: Record } = {} + }: { mappings?: TypeMapping; settings?: Record } = {}, ) { const esRequest = { index: await this._getIndice(index, collection), @@ -1797,7 +1797,7 @@ export default class ElasticSearch extends Service { async updateMapping( index: string, collection: string, - mappings: TypeMapping = {} + mappings: TypeMapping = {}, ): Promise<{ dynamic: string; _meta: JSONObject; properties: JSONObject }> { const esRequest: RequestParams.IndicesPutMapping> = { body: {}, @@ -1932,7 +1932,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; timeout?: string; userId?: string; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection); const dateNow = Date.now(); @@ -2094,7 +2094,7 @@ export default class ElasticSearch extends Service { for (const [index, collections] of Object.entries(schema)) { schema[index] = (collections as string[]).filter( - (c) => c !== HIDDEN_COLLECTION + (c) => c !== HIDDEN_COLLECTION, ); } @@ -2266,7 +2266,7 @@ export default class ElasticSearch extends Service { async exists( index: string, collection: string, - id: string + id: string, ): Promise { const esRequest: RequestParams.Exists = { id, @@ -2398,7 +2398,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; timeout?: string; userId?: string; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection), kuzzleMeta = { @@ -2496,7 +2496,7 @@ export default class ElasticSearch extends Service { injectKuzzleMeta = true, limits = true, source = true, - }: KRequestParams = {} + }: KRequestParams = {}, ) { let kuzzleMeta = {}; @@ -2568,7 +2568,7 @@ export default class ElasticSearch extends Service { retryOnConflict = 0, timeout = undefined, userId = null, - } = {} + } = {}, ) { const alias = this._getAlias(index, collection), toImport = [], @@ -2669,7 +2669,7 @@ export default class ElasticSearch extends Service { retryOnConflict?: number; timeout?: string; userId?: string; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection); const esRequest = { @@ -2776,7 +2776,7 @@ export default class ElasticSearch extends Service { refresh?: boolean | "wait_for"; timeout?: string; userId?: string; - } = {} + } = {}, ) { const alias = this._getAlias(index, collection), kuzzleMeta = { @@ -2866,7 +2866,7 @@ export default class ElasticSearch extends Service { }: { refresh?: boolean | "wait_for"; timeout?: number; - } = {} + } = {}, ) { const query = { ids: { values: [] } }; const validIds = []; @@ -2944,7 +2944,7 @@ export default class ElasticSearch extends Service { esRequest: RequestParams.Bulk, documents: JSONObject[], partialErrors: JSONObject[] = [], - { limits = true, source = true } = {} + { limits = true, source = true } = {}, ) { assertWellFormedRefresh(esRequest); @@ -3026,7 +3026,7 @@ export default class ElasticSearch extends Service { _extractMDocuments( documents: JSONObject[], metadata: JSONObject, - { prepareMGet = false, requireId = false, prepareMUpsert = false } = {} + { prepareMGet = false, requireId = false, prepareMUpsert = false } = {}, ) { const rejected = []; const extractedDocuments = []; @@ -3075,7 +3075,7 @@ export default class ElasticSearch extends Service { metadata, document, extractedDocuments, - documentsToGet + documentsToGet, ); } } @@ -3097,7 +3097,7 @@ export default class ElasticSearch extends Service { metadata: JSONObject, document: JSONObject, extractedDocuments: JSONObject[], - documentsToGet: JSONObject[] + documentsToGet: JSONObject[], ) { let extractedDocument; @@ -3110,7 +3110,7 @@ export default class ElasticSearch extends Service { {}, metadata.upsert, document.changes, - document.default + document.default, ), }, }; @@ -3234,7 +3234,7 @@ export default class ElasticSearch extends Service { * @private */ async _getSettings( - esRequest: RequestParams.IndicesGetSettings + esRequest: RequestParams.IndicesGetSettings, ): Promise { const response = await this._client.indices.getSettings(esRequest); const index = esRequest.index as string; @@ -3253,10 +3253,10 @@ export default class ElasticSearch extends Service { */ async _getAvailableIndice( index: string, - collection: string + collection: string, ): Promise { let indice = this._getAlias(index, collection).substring( - INDEX_PREFIX_POSITION_IN_ALIAS + INDEX_PREFIX_POSITION_IN_ALIAS, ); if (!(await this._client.indices.exists({ index: indice })).body) { @@ -3357,7 +3357,7 @@ export default class ElasticSearch extends Service { "services", "storage", "invalid_collection_name", - collection + collection, ); } } @@ -3490,7 +3490,7 @@ export default class ElasticSearch extends Service { * @returns {Promise.} resolve to an array of documents */ async _getAllDocumentsFromQuery( - esRequest: RequestParams.Search> + esRequest: RequestParams.Search>, ) { let { body: { hits, _scroll_id }, @@ -3568,7 +3568,7 @@ export default class ElasticSearch extends Service { "services", "storage", "invalid_query_keyword", - `${key}.${scriptArg}` + `${key}.${scriptArg}`, ); } } @@ -3729,7 +3729,7 @@ export default class ElasticSearch extends Service { _setLastActionToKuzzleMeta( esRequest: JSONObject, alias: string, - kuzzleMeta: JSONObject + kuzzleMeta: JSONObject, ) { /** * @warning Critical code section @@ -3819,7 +3819,7 @@ function assertWellFormedRefresh(esRequest) { "storage", "invalid_argument", "refresh", - '"wait_for", false' + '"wait_for", false', ); } }