kuzzle 2.47.0 → 2.48.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -147,17 +147,17 @@ class TokenManager {
147
147
  */
148
148
  unlink(token, connectionId) {
149
149
  if (!token) {
150
- this.logger.warn(`tried to unlink connection "${connectionId}" with no token`);
150
+ this.logger.trace(`tried to unlink connection "${connectionId}" with no token`);
151
151
  return;
152
152
  }
153
153
  if (token.userId === this.anonymousUserId) {
154
- this.logger.warn(`tried to unlink connection "${connectionId}" from anonymous user`);
154
+ this.logger.trace(`tried to unlink connection "${connectionId}" from anonymous user`);
155
155
  return;
156
156
  }
157
157
  const idx = ManagedToken.indexFor(token);
158
158
  const pos = this.tokens.search({ idx });
159
159
  if (pos === -1) {
160
- this.logger.warn(`tried to unlink connection "${connectionId}" with no token associated`);
160
+ this.logger.trace(`tried to unlink connection "${connectionId}" with no token associated`);
161
161
  return;
162
162
  }
163
163
  this.removeConnectionLinkedToToken(connectionId, this.tokens.array[pos]);
@@ -173,7 +173,7 @@ class TokenManager {
173
173
  async removeConnection(connectionId) {
174
174
  const managedToken = this.tokensByConnection.get(connectionId);
175
175
  if (!managedToken) {
176
- this.logger.warn(`tried to remove connection "${connectionId}" with no token associated`);
176
+ this.logger.trace(`tried to remove connection "${connectionId}" with no token associated`);
177
177
  return;
178
178
  }
179
179
  this.unlink(managedToken, connectionId);
@@ -189,7 +189,7 @@ class TokenManager {
189
189
  */
190
190
  async expire(token) {
191
191
  if (token.userId === this.anonymousUserId) {
192
- this.logger.warn(`tried to expire an anonymous token`);
192
+ this.logger.trace(`tried to expire an anonymous token`);
193
193
  return;
194
194
  }
195
195
  const idx = ManagedToken.indexFor(token);
@@ -4,6 +4,7 @@ import { KuzzleRequest, RequestContext, RequestInput } from "../../../index";
4
4
  import { Mutex } from "../../util/mutex";
5
5
  import { BackendCluster } from "../backend";
6
6
  import { EmbeddedSDK } from "../shared/sdk/embeddedSdk";
7
+ import { KuzzleLogger } from "kuzzle-logger/dist";
7
8
  export interface Repository {
8
9
  create(document: JSONObject, options: any): Promise<any>;
9
10
  createOrReplace(document: JSONObject, options: any): Promise<any>;
@@ -139,6 +140,10 @@ export declare class PluginContext {
139
140
  * Decrypted secrets from Kuzzle Vault
140
141
  */
141
142
  secrets: JSONObject;
143
+ /**
144
+ * Logger instance
145
+ */
146
+ logger: KuzzleLogger;
142
147
  /**
143
148
  * Internal Logger
144
149
  */
@@ -125,14 +125,16 @@ class PluginContext {
125
125
  RequestInput: index_1.RequestInput,
126
126
  };
127
127
  Object.freeze(this.constructors);
128
+ this.logger = globalThis.kuzzle.log.child(`${pluginName}`);
128
129
  /* context.log ======================================================== */
130
+ // @deprecated backward compatibility only
129
131
  this.log = {
130
- debug: (msg) => global.kuzzle.log.debug(`[${pluginName}] ${msg}`),
131
- error: (msg) => global.kuzzle.log.error(`[${pluginName}] ${msg}`),
132
- info: (msg) => global.kuzzle.log.info(`[${pluginName}] ${msg}`),
133
- silly: (msg) => global.kuzzle.log.silly(`[${pluginName}] ${msg}`),
134
- verbose: (msg) => global.kuzzle.log.verbose(`[${pluginName}] ${msg}`),
135
- warn: (msg) => global.kuzzle.log.warn(`[${pluginName}] ${msg}`),
132
+ debug: (msg) => this.logger.debug(`[${pluginName}] ${msg}`),
133
+ error: (msg) => this.logger.error(`[${pluginName}] ${msg}`),
134
+ info: (msg) => this.logger.info(`[${pluginName}] ${msg}`),
135
+ silly: (msg) => this.logger.trace(`[${pluginName}] ${msg}`),
136
+ verbose: (msg) => this.logger.trace(`[${pluginName}] ${msg}`),
137
+ warn: (msg) => this.logger.warn(`[${pluginName}] ${msg}`),
136
138
  };
137
139
  Object.freeze(this.log);
138
140
  /* context.accessors ================================================== */
@@ -2329,6 +2329,9 @@ class ES7 {
2329
2329
  _processExtract(prepareMUpsert, prepareMGet, metadata, document, extractedDocuments, documentsToGet) {
2330
2330
  let extractedDocument;
2331
2331
  if (prepareMUpsert) {
2332
+ if (document.changes !== undefined && document.changes !== null) {
2333
+ delete document.changes._kuzzle_info;
2334
+ }
2332
2335
  extractedDocument = {
2333
2336
  _source: {
2334
2337
  // Do not use destructuring, it's 10x slower
@@ -2338,6 +2341,9 @@ class ES7 {
2338
2341
  };
2339
2342
  }
2340
2343
  else {
2344
+ if (document.body !== undefined && document.body !== null) {
2345
+ delete document.body._kuzzle_info;
2346
+ }
2341
2347
  extractedDocument = {
2342
2348
  // Do not use destructuring, it's 10x slower
2343
2349
  _source: Object.assign({}, metadata, document.body),
@@ -2322,6 +2322,9 @@ class ES8 {
2322
2322
  _processExtract(prepareMUpsert, prepareMGet, metadata, document, extractedDocuments, documentsToGet) {
2323
2323
  let extractedDocument;
2324
2324
  if (prepareMUpsert) {
2325
+ if (document.changes !== undefined && document.changes !== null) {
2326
+ delete document.changes._kuzzle_info;
2327
+ }
2325
2328
  extractedDocument = {
2326
2329
  _source: {
2327
2330
  // Do not use destructuring, it's 10x slower
@@ -2331,6 +2334,9 @@ class ES8 {
2331
2334
  };
2332
2335
  }
2333
2336
  else {
2337
+ if (document.body !== undefined && document.body !== null) {
2338
+ delete document.body._kuzzle_info;
2339
+ }
2334
2340
  extractedDocument = {
2335
2341
  // Do not use destructuring, it's 10x slower
2336
2342
  _source: Object.assign({}, metadata, document.body),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.47.0",
4
+ "version": "2.48.0-beta.2",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "bin": "bin/start-kuzzle-server",
7
7
  "scripts": {
@@ -33,13 +33,13 @@
33
33
  "bluebird": "3.7.2",
34
34
  "cli-color": "2.0.4",
35
35
  "cookie": "1.0.2",
36
- "debug": "4.4.1",
36
+ "debug": "4.4.3",
37
37
  "denque": "2.1.0",
38
38
  "didyoumean": "1.2.2",
39
39
  "dumpme": "2.0.0",
40
40
  "eventemitter3": "5.0.1",
41
- "inquirer": "12.8.2",
42
- "ioredis": "5.6.1",
41
+ "inquirer": "12.9.6",
42
+ "ioredis": "5.8.0",
43
43
  "js-yaml": "4.1.0",
44
44
  "json-stable-stringify": "1.3.0",
45
45
  "json2yaml": "1.1.0",
@@ -47,7 +47,7 @@
47
47
  "koncorde": "4.6.0",
48
48
  "kuzzle-logger": "1.4.0",
49
49
  "kuzzle-plugin-auth-passport-local": "6.4.1",
50
- "kuzzle-sdk": ">=7.15.0",
50
+ "kuzzle-sdk": ">=7.15.1",
51
51
  "kuzzle-vault": "2.1.0",
52
52
  "lodash": "4.17.21",
53
53
  "long": "5.3.2",
@@ -59,9 +59,9 @@
59
59
  "pino-caller": "4.0.0",
60
60
  "pino-elasticsearch": "8.1.0",
61
61
  "pino-loki": "2.6.0",
62
- "pino-pretty": "13.0.0",
62
+ "pino-pretty": "13.1.1",
63
63
  "pino-transport-ecs": "1.1.0",
64
- "protobufjs": "7.5.3",
64
+ "protobufjs": "7.5.4",
65
65
  "rc": "1.2.8",
66
66
  "sdk-es7": "npm:@elastic/elasticsearch@7.13.0",
67
67
  "sdk-es8": "npm:@elastic/elasticsearch@8.17.1",
@@ -82,9 +82,9 @@
82
82
  "url": "git://github.com/kuzzleio/kuzzle.git"
83
83
  },
84
84
  "devDependencies": {
85
- "@commitlint/cli": "19.8.1",
86
- "@commitlint/config-conventional": "19.8.1",
87
- "@jest/globals": "30.0.5",
85
+ "@commitlint/cli": "20.0.0",
86
+ "@commitlint/config-conventional": "20.0.0",
87
+ "@jest/globals": "30.1.2",
88
88
  "@types/bluebird": "3.5.42",
89
89
  "@types/cookie": "1.0.0",
90
90
  "@types/jest": "30.0.0",
@@ -96,10 +96,10 @@
96
96
  "cucumber": "6.0.7",
97
97
  "cz-conventional-changelog": "3.3.0",
98
98
  "eslint-plugin-kuzzle": "0.0.14",
99
- "jest": "30.0.5",
100
- "mocha": "11.7.1",
99
+ "jest": "30.1.3",
100
+ "mocha": "11.7.2",
101
101
  "mock-require": "3.0.3",
102
- "mqtt": "5.13.3",
102
+ "mqtt": "5.14.1",
103
103
  "nyc": "17.1.0",
104
104
  "request": "2.88.2",
105
105
  "request-promise": "4.2.6",
@@ -109,16 +109,16 @@
109
109
  "should-sinon": "0.0.6",
110
110
  "sinon": "21.0.0",
111
111
  "strip-json-comments": "https://github.com/sindresorhus/strip-json-comments/archive/refs/tags/v3.1.1.tar.gz",
112
- "ts-jest": "29.4.0",
112
+ "ts-jest": "29.4.4",
113
113
  "ts-node": "10.9.2",
114
- "tsx": "4.20.3",
115
- "typescript": "5.3.2",
116
- "yaml": "2.8.0"
114
+ "tsx": "4.20.6",
115
+ "typescript": "5.4.5",
116
+ "yaml": "2.8.1"
117
117
  },
118
118
  "engines": {
119
119
  "node": ">=18.0.0 <23.0.0"
120
120
  },
121
- "packageManager": "npm@11.4.2",
121
+ "packageManager": "npm@11.6.1",
122
122
  "engineStrict": true,
123
123
  "license": "Apache-2.0",
124
124
  "files": [