kuzzle 2.50.0 → 2.50.1-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.
Files changed (30) hide show
  1. package/dist/lib/api/controllers/securityController.js +2 -1
  2. package/dist/lib/api/openapi/openApiGenerator.d.ts +1 -1
  3. package/dist/lib/api/request/kuzzleRequest.d.ts +2 -2
  4. package/dist/lib/api/request/kuzzleRequest.js +2 -2
  5. package/dist/lib/core/backend/backend.d.ts +2 -1
  6. package/dist/lib/core/backend/backend.js +7 -7
  7. package/dist/lib/core/backend/backendImport.d.ts +1 -1
  8. package/dist/lib/core/backend/backendPlugin.d.ts +1 -1
  9. package/dist/lib/core/backend/backendVault.d.ts +1 -1
  10. package/dist/lib/core/backend/backendVault.js +0 -20
  11. package/dist/lib/core/realtime/hotelClerk.d.ts +2 -1
  12. package/dist/lib/kuzzle/Logger.d.ts +1 -1
  13. package/dist/lib/types/ClientConnection.d.ts +1 -1
  14. package/dist/lib/types/HttpMessage.d.ts +1 -1
  15. package/dist/lib/types/Kuzzle.d.ts +1 -1
  16. package/dist/lib/types/Plugin.d.ts +1 -1
  17. package/dist/lib/types/config/PluginsConfiguration.d.ts +1 -1
  18. package/dist/lib/types/config/SecurityConfiguration.d.ts +1 -1
  19. package/dist/lib/types/config/ServerConfiguration.d.ts +1 -1
  20. package/dist/lib/types/events/EventGenericDocument.d.ts +2 -1
  21. package/dist/lib/types/events/EventProtocol.d.ts +2 -1
  22. package/dist/lib/types/index.d.ts +0 -1
  23. package/dist/lib/types/index.js +0 -1
  24. package/dist/lib/types/shared/StoreCollectionsDefinition.d.ts +1 -1
  25. package/dist/lib/util/dump-collection.d.ts +2 -2
  26. package/dist/lib/util/dump-collection.js +6 -5
  27. package/dist/package.json +5 -5
  28. package/package.json +5 -5
  29. package/dist/lib/types/User.d.ts +0 -14
  30. package/dist/lib/types/User.js +0 -23
@@ -888,7 +888,8 @@ class SecurityController extends baseController_1.NativeController {
888
888
  await validateMethod(request, body, id, strategy, true);
889
889
  const updateMethod = this.getStrategyMethod(strategy, "update");
890
890
  this.logger.info(`[SECURITY] ${SecurityController.userOrSdk(request.getKuid())} applied action "${request.input.action}" on user "${id}."`);
891
- return updateMethod(request, body, id, strategy);
891
+ const response = await updateMethod(request, body, id, strategy);
892
+ return response;
892
893
  }
893
894
  /**
894
895
  * @param {Request} request
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  /**
3
3
  * Generates JSON OpenApi object
4
4
  *
@@ -3,7 +3,7 @@ import { RequestInput } from "./requestInput";
3
3
  import { RequestResponse } from "./requestResponse";
4
4
  import { RequestContext } from "./requestContext";
5
5
  import { KuzzleError } from "../../kerror/errors";
6
- import { Deprecation, User } from "../../types";
6
+ import { Deprecation } from "../../types";
7
7
  /**
8
8
  * The `KuzzleRequest` class represents a request being processed by Kuzzle.
9
9
  *
@@ -376,7 +376,7 @@ export declare class KuzzleRequest {
376
376
  /**
377
377
  * Returns the current user
378
378
  */
379
- getUser(): User | null;
379
+ getUser(): import("../../model/security/user").User;
380
380
  /**
381
381
  * Returns the search body query according to the http method
382
382
  */
@@ -714,7 +714,7 @@ class KuzzleRequest {
714
714
  * Returns the current user kuid
715
715
  */
716
716
  getKuid() {
717
- if (this.context && this.context.user && this.context.user._id) {
717
+ if (this.context?.user?._id) {
718
718
  return this.context.user._id;
719
719
  }
720
720
  return null;
@@ -723,7 +723,7 @@ class KuzzleRequest {
723
723
  * Returns the current user
724
724
  */
725
725
  getUser() {
726
- if (this.context && this.context.user) {
726
+ if (this.context?.user) {
727
727
  return this.context.user;
728
728
  }
729
729
  return null;
@@ -1,5 +1,6 @@
1
+ import { JSONObject } from "kuzzle-sdk";
1
2
  import { EmbeddedSDK } from "../shared/sdk/embeddedSdk";
2
- import { EventDefinition, JSONObject } from "../../../index";
3
+ import { EventDefinition } from "../../../index";
3
4
  import { BackendCluster, BackendConfig, BackendController, BackendHook, BackendImport, BackendPipe, BackendPlugin, BackendStorage, BackendVault, BackendOpenApi, BackendErrors, BackendSubscription } from "./index";
4
5
  import { Logger } from "../../kuzzle/Logger";
5
6
  export declare class Backend {
@@ -47,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
47
47
  };
48
48
  Object.defineProperty(exports, "__esModule", { value: true });
49
49
  exports.Backend = void 0;
50
- const fs_1 = __importDefault(require("fs"));
50
+ const node_fs_1 = __importDefault(require("node:fs"));
51
51
  const kuzzle_1 = __importDefault(require("../../kuzzle"));
52
52
  const embeddedSdk_1 = require("../shared/sdk/embeddedSdk");
53
53
  const kerror = __importStar(require("../../kerror"));
@@ -142,7 +142,7 @@ class Backend {
142
142
  },
143
143
  ];
144
144
  try {
145
- const info = JSON.parse(fs_1.default.readFileSync("./package.json", "utf8"));
145
+ const info = JSON.parse(node_fs_1.default.readFileSync("./package.json", "utf8"));
146
146
  this.version = info.version;
147
147
  }
148
148
  catch (error) {
@@ -280,18 +280,18 @@ class Backend {
280
280
  return null;
281
281
  }
282
282
  const gitDir = `${dir}/.git`;
283
- if (!fs_1.default.existsSync(gitDir) && depth > 0) {
283
+ if (!node_fs_1.default.existsSync(gitDir) && depth > 0) {
284
284
  return this._readCommit(`${dir}/..`, depth - 1);
285
285
  }
286
- if (!fs_1.default.statSync(gitDir).isDirectory()) {
286
+ if (!node_fs_1.default.statSync(gitDir).isDirectory()) {
287
287
  return null;
288
288
  }
289
- const ref = fs_1.default.readFileSync(`${dir}/.git/HEAD`, "utf8").split("ref: ")[1];
289
+ const ref = node_fs_1.default.readFileSync(`${dir}/.git/HEAD`, "utf8").split("ref: ")[1];
290
290
  const refFile = `${dir}/.git/${ref}`.replace("\n", "");
291
- if (!fs_1.default.existsSync(refFile)) {
291
+ if (!node_fs_1.default.existsSync(refFile)) {
292
292
  return null;
293
293
  }
294
- return fs_1.default.readFileSync(refFile, "utf8").replace("\n", "");
294
+ return node_fs_1.default.readFileSync(refFile, "utf8").replace("\n", "");
295
295
  }
296
296
  }
297
297
  exports.Backend = Backend;
@@ -1,5 +1,5 @@
1
+ import { JSONObject } from "kuzzle-sdk";
1
2
  import { ApplicationManager } from "./index";
2
- import { JSONObject } from "../../../index";
3
3
  export type DefaultMappings = {
4
4
  [index: string]: {
5
5
  [collection: string]: {
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  import { Plugin } from "../../types";
3
3
  import { ApplicationManager } from "./index";
4
4
  export declare class BackendPlugin extends ApplicationManager {
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  import { ApplicationManager } from "./index";
3
3
  export declare class BackendVault extends ApplicationManager {
4
4
  private decrypted;
@@ -1,24 +1,4 @@
1
1
  "use strict";
2
- /*
3
- * Kuzzle, a backend software, self-hostable and ready to use
4
- * to power modern apps
5
- *
6
- * Copyright 2015-2022 Kuzzle
7
- * mailto: support AT kuzzle.io
8
- * website: http://kuzzle.io
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * https://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
3
  if (k2 === undefined) k2 = k;
24
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -1,5 +1,6 @@
1
1
  import { KuzzleRequest } from "../../api/request";
2
- import { User, RoomList } from "../../types";
2
+ import { RoomList } from "../../types";
3
+ import { User } from "../../model/security/user";
3
4
  /**
4
5
  * The HotelClerk is responsible of keeping the list of rooms and subscriptions
5
6
  * made to those rooms.
@@ -1,5 +1,5 @@
1
1
  import { KuzzleLogger } from "kuzzle-logger";
2
- import { KuzzleConfiguration } from "../../";
2
+ import { KuzzleConfiguration } from "../../index";
3
3
  /**
4
4
  * The Logger class provides logging functionality for Kuzzle.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../..";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  export interface ClientConnection {
3
3
  id: string;
4
4
  protocol: string;
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../..";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  import { ClientConnection } from "./ClientConnection";
3
3
  export interface HttpMessage {
4
4
  connection: ClientConnection;
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  export type InstallationConfig = {
3
3
  id: string;
4
4
  handler: () => Promise<void>;
@@ -1,9 +1,9 @@
1
+ import { JSONObject } from "kuzzle-sdk";
1
2
  import { PluginContext } from "../core/plugin/pluginContext";
2
3
  import { ControllerDefinition } from "./controllers/ControllerDefinition";
3
4
  import { PluginManifest } from "./PluginManifest";
4
5
  import { StrategyDefinition } from "./StrategyDefinition";
5
6
  import { PipeEventHandler, HookEventHandler } from "./EventHandler";
6
- import { JSONObject } from "../../index";
7
7
  import { ImportConfig } from "./Kuzzle";
8
8
  /**
9
9
  * Allows to define plugins controllers and actions
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  import { PasswordPolicy } from "../index";
3
3
  export type PluginsConfiguration = {
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { JSONObject } from "../../../index";
3
+ import { JSONObject } from "kuzzle-sdk";
4
4
  import { RoleDefinition, ProfileDefinition } from "../index";
5
5
  export type SecurityConfiguration = {
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { KuzzleLoggerConfig } from "kuzzle-logger";
2
- import { JSONObject } from "../../../index";
2
+ import { JSONObject } from "kuzzle-sdk";
3
3
  export type ServerConfiguration = {
4
4
  /**
5
5
  * The maximum size of an incoming request.
@@ -1,4 +1,5 @@
1
- import { KuzzleRequest, KDocument, JSONObject, PipeEventHandler } from "../../../";
1
+ import { KDocument, JSONObject } from "kuzzle-sdk";
2
+ import { KuzzleRequest, PipeEventHandler } from "../../../index";
2
3
  /**
3
4
  * Events with documents only having the `_id`
4
5
  */
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { JSONObject, PipeEventHandler } from "../../../";
3
+ import { JSONObject } from "kuzzle-sdk";
4
+ import { PipeEventHandler } from "../../../index";
4
5
  import { ClientConnection } from "../ClientConnection";
5
6
  import { HttpMessage } from "../HttpMessage";
6
7
  export type EventHTTPBeforeParsingPayload = {
@@ -15,7 +15,6 @@ export * from "./ProfileDefinition";
15
15
  export * from "./RoleDefinition";
16
16
  export * from "./Target";
17
17
  export * from "./Token";
18
- export * from "./User";
19
18
  export * from "./config/DumpConfiguration";
20
19
  export * from "./config/HttpConfiguration";
21
20
  export * from "./config/KuzzleConfiguration";
@@ -51,7 +51,6 @@ __exportStar(require("./ProfileDefinition"), exports);
51
51
  __exportStar(require("./RoleDefinition"), exports);
52
52
  __exportStar(require("./Target"), exports);
53
53
  __exportStar(require("./Token"), exports);
54
- __exportStar(require("./User"), exports);
55
54
  __exportStar(require("./config/DumpConfiguration"), exports);
56
55
  __exportStar(require("./config/HttpConfiguration"), exports);
57
56
  __exportStar(require("./config/KuzzleConfiguration"), exports);
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  export interface StoreCollectionDefinition {
3
3
  /**
4
4
  * Collection mappings
@@ -1,4 +1,4 @@
1
- import { JSONObject } from "../../index";
1
+ import { JSONObject } from "kuzzle-sdk";
2
2
  import { HttpStream } from "../types";
3
3
  /**
4
4
  * Flatten an object transform:
@@ -25,7 +25,7 @@ export declare function flattenObject(target: JSONObject): JSONObject;
25
25
  * @param mapping
26
26
  * @returns
27
27
  */
28
- export declare function extractMappingFields(mapping: JSONObject): {};
28
+ export declare function extractMappingFields(mapping: JSONObject): JSONObject;
29
29
  /**
30
30
  * An iteration-order-safe version of lodash.values
31
31
  *
@@ -27,9 +27,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.dumpCollectionDocuments = exports.pickValues = exports.extractMappingFields = exports.flattenObject = void 0;
30
- const ndjson_1 = __importDefault(require("ndjson"));
31
30
  const get_1 = __importDefault(require("lodash/get"));
32
31
  const isObject_1 = __importDefault(require("lodash/isObject"));
32
+ const ndjson_1 = __importDefault(require("ndjson"));
33
33
  const kerror = __importStar(require("../kerror"));
34
34
  const bufferedPassThrough_1 = require("./bufferedPassThrough");
35
35
  const types_1 = require("../types");
@@ -82,11 +82,12 @@ function extractMappingFields(mapping) {
82
82
  return extractMappingFields(mapping.properties);
83
83
  }
84
84
  for (const key of Object.keys(mapping)) {
85
- if ((0, isObject_1.default)(mapping[key]) && mapping[key].type) {
86
- newMapping[key] = mapping[key].type;
85
+ const property = mapping[key];
86
+ if ((0, isObject_1.default)(property) && property.type) {
87
+ newMapping[key] = property.type;
87
88
  }
88
- else if ((0, isObject_1.default)(mapping[key])) {
89
- newMapping[key] = extractMappingFields(mapping[key]);
89
+ else if ((0, isObject_1.default)(property)) {
90
+ newMapping[key] = extractMappingFields(property);
90
91
  }
91
92
  }
92
93
  return newMapping;
package/dist/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.50.0",
4
+ "version": "2.50.1-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
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node ./bin/copy-protobuf.js",
@@ -42,7 +42,7 @@
42
42
  "koncorde": "4.7.0",
43
43
  "kuzzle-logger": "1.4.0",
44
44
  "kuzzle-plugin-auth-passport-local": "6.4.1",
45
- "kuzzle-sdk": ">=7.17.0",
45
+ "kuzzle-sdk": ">=7.17.1",
46
46
  "kuzzle-vault": "2.1.0",
47
47
  "lodash": "4.17.21",
48
48
  "long": "5.3.2",
@@ -73,13 +73,13 @@
73
73
  "url": "git://github.com/kuzzleio/kuzzle.git"
74
74
  },
75
75
  "devDependencies": {
76
- "@cucumber/cucumber": "12.4.0",
76
+ "@cucumber/cucumber": "12.5.0",
77
77
  "@types/bluebird": "3.5.42",
78
78
  "@types/cookie": "1.0.0",
79
79
  "@types/lodash": "4.17.21",
80
80
  "@types/mocha": "10.0.10",
81
81
  "@types/passport": "1.0.17",
82
- "@vitest/coverage-v8": "4.0.15",
82
+ "@vitest/coverage-v8": "4.0.16",
83
83
  "async": "3.2.6",
84
84
  "eslint-plugin-kuzzle": "0.0.15",
85
85
  "mocha": "11.7.5",
@@ -95,7 +95,7 @@
95
95
  "ts-node": "10.9.2",
96
96
  "tsx": "4.21.0",
97
97
  "typescript": "5.4.5",
98
- "vitest": "4.0.15",
98
+ "vitest": "4.0.16",
99
99
  "yaml": "2.8.2"
100
100
  },
101
101
  "engines": {
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.50.0",
4
+ "version": "2.50.1-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
  "scripts": {
7
7
  "build": "rm -Rf ./dist && tsc && node ./bin/copy-protobuf.js",
@@ -42,7 +42,7 @@
42
42
  "koncorde": "4.7.0",
43
43
  "kuzzle-logger": "1.4.0",
44
44
  "kuzzle-plugin-auth-passport-local": "6.4.1",
45
- "kuzzle-sdk": ">=7.17.0",
45
+ "kuzzle-sdk": ">=7.17.1",
46
46
  "kuzzle-vault": "2.1.0",
47
47
  "lodash": "4.17.21",
48
48
  "long": "5.3.2",
@@ -73,13 +73,13 @@
73
73
  "url": "git://github.com/kuzzleio/kuzzle.git"
74
74
  },
75
75
  "devDependencies": {
76
- "@cucumber/cucumber": "12.4.0",
76
+ "@cucumber/cucumber": "12.5.0",
77
77
  "@types/bluebird": "3.5.42",
78
78
  "@types/cookie": "1.0.0",
79
79
  "@types/lodash": "4.17.21",
80
80
  "@types/mocha": "10.0.10",
81
81
  "@types/passport": "1.0.17",
82
- "@vitest/coverage-v8": "4.0.15",
82
+ "@vitest/coverage-v8": "4.0.16",
83
83
  "async": "3.2.6",
84
84
  "eslint-plugin-kuzzle": "0.0.15",
85
85
  "mocha": "11.7.5",
@@ -95,7 +95,7 @@
95
95
  "ts-node": "10.9.2",
96
96
  "tsx": "4.21.0",
97
97
  "typescript": "5.4.5",
98
- "vitest": "4.0.15",
98
+ "vitest": "4.0.16",
99
99
  "yaml": "2.8.2"
100
100
  },
101
101
  "engines": {
@@ -1,14 +0,0 @@
1
- import { JSONObject } from "kuzzle-sdk";
2
- /**
3
- * Kuzzle user.
4
- */
5
- export interface User extends JSONObject {
6
- /**
7
- * Unique ID
8
- */
9
- _id: string;
10
- /**
11
- * User profiles
12
- */
13
- profileIds: Array<string>;
14
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /*
3
- * Kuzzle, a backend software, self-hostable and ready to use
4
- * to power modern apps
5
- *
6
- * Copyright 2015-2022 Kuzzle
7
- * mailto: support AT kuzzle.io
8
- * website: http://kuzzle.io
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * https://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- //# sourceMappingURL=User.js.map