kuzzle 2.61.0-beta.2 → 2.61.0-beta.3
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.
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
"code": 6,
|
|
358
358
|
"errors": {
|
|
359
359
|
"not_found": {
|
|
360
|
-
"description": "The package named by services.storageEngine.driver
|
|
360
|
+
"description": "The storage driver package cannot be found: the one named by services.storageEngine.driver, or the built-in kuzzle-storage-es-7 / kuzzle-storage-es-8 package of the configured majorVersion. Kuzzle does not start.",
|
|
361
361
|
"code": 1,
|
|
362
362
|
"message": "Cannot find the storage driver \"%s\": %s.",
|
|
363
363
|
"class": "InternalError"
|
|
@@ -2,5 +2,10 @@ import type { Client as ClientES7 } from "sdk-es7";
|
|
|
2
2
|
import type { Client as ClientES8 } from "sdk-es8";
|
|
3
3
|
import type { StorageEngineElasticsearch } from "../../types/config/storageEngine/StorageEngineElasticsearchConfiguration";
|
|
4
4
|
import type { StorageDriverClass } from "../../types/storage/StorageDriver";
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* The built-in driver of an Elasticsearch major version
|
|
7
|
+
*
|
|
8
|
+
* @throws {services.storage_driver.not_found} if its package is not
|
|
9
|
+
* installed: Kuzzle does not start
|
|
10
|
+
*/
|
|
6
11
|
export declare function builtInStorageDriver(majorVersion: StorageEngineElasticsearch["majorVersion"]): StorageDriverClass<ClientES7 | ClientES8, StorageEngineElasticsearch>;
|
|
@@ -59,21 +59,35 @@ exports.builtInStorageDriver = builtInStorageDriver;
|
|
|
59
59
|
// Kuzzle at pinned versions. Dropped from Kuzzle's dependencies at the next
|
|
60
60
|
// major.
|
|
61
61
|
const path = __importStar(require("node:path"));
|
|
62
|
+
const kerror = __importStar(require("../../kerror"));
|
|
63
|
+
const driverError = kerror.wrap("services", "storage_driver");
|
|
62
64
|
const PACKAGES = {
|
|
63
65
|
"7": "kuzzle-storage-es-7",
|
|
64
66
|
"8": "kuzzle-storage-es-8",
|
|
65
67
|
};
|
|
66
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* The built-in driver of an Elasticsearch major version
|
|
70
|
+
*
|
|
71
|
+
* @throws {services.storage_driver.not_found} if its package is not
|
|
72
|
+
* installed: Kuzzle does not start
|
|
73
|
+
*/
|
|
67
74
|
function builtInStorageDriver(majorVersion) {
|
|
68
75
|
const packageName = PACKAGES[majorVersion];
|
|
69
76
|
if (!packageName) {
|
|
70
77
|
throw new Error("Invalid Elasticsearch version.");
|
|
71
78
|
}
|
|
72
|
-
|
|
79
|
+
let entry;
|
|
80
|
+
try {
|
|
81
|
+
entry = require.resolve(packageName);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
throw driverError.get("not_found", packageName, error instanceof Error ? error.message : String(error));
|
|
85
|
+
}
|
|
86
|
+
provideRunningKuzzle(entry);
|
|
73
87
|
// Loaded here, not at module load: the package requires `kuzzle`, which
|
|
74
88
|
// has to be loaded first.
|
|
75
89
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
76
|
-
return require(
|
|
90
|
+
return require(entry).default;
|
|
77
91
|
}
|
|
78
92
|
/**
|
|
79
93
|
* A driver package requires `kuzzle`, a peer dependency. In an application,
|
|
@@ -82,14 +96,14 @@ function builtInStorageDriver(majorVersion) {
|
|
|
82
96
|
* that peer dependency, whose error classes the running Kuzzle does not
|
|
83
97
|
* recognize: the running Kuzzle is put in that copy's place.
|
|
84
98
|
*/
|
|
85
|
-
function provideRunningKuzzle(
|
|
99
|
+
function provideRunningKuzzle(driverEntry) {
|
|
86
100
|
// `index.js` once built, `index.ts` when run from the sources
|
|
87
101
|
const entry = path.join(__dirname, "../../../index");
|
|
88
102
|
const running = require.cache[`${entry}.js`] ?? require.cache[`${entry}.ts`];
|
|
89
103
|
let peer;
|
|
90
104
|
try {
|
|
91
105
|
peer = require.resolve("kuzzle", {
|
|
92
|
-
paths: [path.dirname(
|
|
106
|
+
paths: [path.dirname(driverEntry)],
|
|
93
107
|
});
|
|
94
108
|
}
|
|
95
109
|
catch {
|
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.61.0-beta.
|
|
4
|
+
"version": "2.61.0-beta.3",
|
|
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 -r ts-node/register/transpile-only ./bin/copy-binaries.ts",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"kuzzle-logger": "1.7.0",
|
|
53
53
|
"kuzzle-plugin-auth-passport-local": "6.4.1",
|
|
54
54
|
"kuzzle-sdk": ">=7.17.1 <8.0.0",
|
|
55
|
-
"kuzzle-storage-es-7": "1.0.0
|
|
56
|
-
"kuzzle-storage-es-8": "1.0.0
|
|
55
|
+
"kuzzle-storage-es-7": "1.0.0",
|
|
56
|
+
"kuzzle-storage-es-8": "1.0.0",
|
|
57
57
|
"kuzzle-types": "^1.0.0",
|
|
58
58
|
"kuzzle-vault": "2.2.0",
|
|
59
59
|
"lodash": "4.17.21",
|
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.61.0-beta.
|
|
4
|
+
"version": "2.61.0-beta.3",
|
|
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 -r ts-node/register/transpile-only ./bin/copy-binaries.ts",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"kuzzle-logger": "1.7.0",
|
|
53
53
|
"kuzzle-plugin-auth-passport-local": "6.4.1",
|
|
54
54
|
"kuzzle-sdk": ">=7.17.1 <8.0.0",
|
|
55
|
-
"kuzzle-storage-es-7": "1.0.0
|
|
56
|
-
"kuzzle-storage-es-8": "1.0.0
|
|
55
|
+
"kuzzle-storage-es-7": "1.0.0",
|
|
56
|
+
"kuzzle-storage-es-8": "1.0.0",
|
|
57
57
|
"kuzzle-types": "^1.0.0",
|
|
58
58
|
"kuzzle-vault": "2.2.0",
|
|
59
59
|
"lodash": "4.17.21",
|