kuzzle 2.54.1 → 2.54.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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const fs = require("fs/promises");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
async function main() {
|
|
6
|
+
const projectRoot = path.join(__dirname, "..");
|
|
7
|
+
const protobufSourceDir = path.join(projectRoot, "lib", "cluster", "protobuf");
|
|
8
|
+
const protobufTargetDir = path.join(projectRoot, "dist", "lib", "cluster", "protobuf");
|
|
9
|
+
const binSourceFile = path.join(projectRoot, "bin", "start-kuzzle-server");
|
|
10
|
+
const binTargetDir = path.join(projectRoot, "dist", "bin");
|
|
11
|
+
const binTargetFile = path.join(binTargetDir, "start-kuzzle-server");
|
|
12
|
+
await fs.mkdir(protobufTargetDir, { recursive: true });
|
|
13
|
+
await fs.cp(protobufSourceDir, protobufTargetDir, { recursive: true });
|
|
14
|
+
await fs.mkdir(binTargetDir, { recursive: true });
|
|
15
|
+
await fs.copyFile(binSourceFile, binTargetFile);
|
|
16
|
+
await fs.chmod(binTargetFile, 0o755);
|
|
17
|
+
}
|
|
18
|
+
main().catch((error) => {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.error("Failed to copy protobuf definitions:", error);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=copy-binaries.js.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Kuzzle, a backend software, self-hostable and ready to use
|
|
5
|
+
* to power modern apps
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2015-2022 Kuzzle
|
|
8
|
+
* mailto: support AT kuzzle.io
|
|
9
|
+
* website: http://kuzzle.io
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
"use strict";
|
|
25
|
+
|
|
26
|
+
/* eslint-disable no-console */
|
|
27
|
+
|
|
28
|
+
const fs = require("fs");
|
|
29
|
+
|
|
30
|
+
const yargs = require("yargs");
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* When builded this file is reachable the bin folder
|
|
34
|
+
* Leave it this way on build
|
|
35
|
+
*/
|
|
36
|
+
const { Backend } = require("../index");
|
|
37
|
+
|
|
38
|
+
function loadJson(path) {
|
|
39
|
+
if (!path) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return JSON.parse(fs.readFileSync(path, "utf8"));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function startKuzzle(options = {}) {
|
|
47
|
+
const app = new Backend("kuzzle");
|
|
48
|
+
|
|
49
|
+
if (options.enablePlugins) {
|
|
50
|
+
const additionalPlugins = options.enablePlugins
|
|
51
|
+
.trim()
|
|
52
|
+
.split(",")
|
|
53
|
+
.map((x) => x.trim().replace(/(^")|("$)/g, ""));
|
|
54
|
+
|
|
55
|
+
for (const additionalPlugin of additionalPlugins) {
|
|
56
|
+
const PluginClass = require(`./plugins/available/${additionalPlugin}`);
|
|
57
|
+
const manifest = require(
|
|
58
|
+
`./plugins/available/${additionalPlugin}/manifest.json`,
|
|
59
|
+
);
|
|
60
|
+
const plugin = new PluginClass();
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
plugin.version = require(
|
|
64
|
+
`./plugins/available/${additionalPlugin}/package.json`,
|
|
65
|
+
).version;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
// ignore
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
app.plugin.use(plugin, { manifest, name: manifest.name });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
app.import.mappings = loadJson(options.mappings);
|
|
75
|
+
|
|
76
|
+
app.import.fixtures = loadJson(options.fixtures);
|
|
77
|
+
|
|
78
|
+
app.import.securities = loadJson(options.securities);
|
|
79
|
+
|
|
80
|
+
app.vault.key = options.vaultKey;
|
|
81
|
+
|
|
82
|
+
app.vault.file = options.secretsFile;
|
|
83
|
+
|
|
84
|
+
app.version = "1.0.0";
|
|
85
|
+
|
|
86
|
+
await app.start();
|
|
87
|
+
|
|
88
|
+
const { total: admins } = await app.sdk.security.searchUsers({
|
|
89
|
+
query: { term: { profileIds: "admin" } },
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (admins.length === 0) {
|
|
93
|
+
app.log(
|
|
94
|
+
"[!] [WARNING] There is no administrator user yet: everyone has administrator rights.",
|
|
95
|
+
);
|
|
96
|
+
app.log(
|
|
97
|
+
"[ℹ] You can use the CLI or the admin console to create the first administrator user.",
|
|
98
|
+
);
|
|
99
|
+
app.log(
|
|
100
|
+
" For more information: https://docs.kuzzle.io/core/2/guides/essentials/security/",
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const options = yargs()
|
|
106
|
+
.scriptName("kuzzle")
|
|
107
|
+
.usage("start-kuzzle-server [options]")
|
|
108
|
+
.describe("fixtures", "Import data from file")
|
|
109
|
+
.describe("mappings", "Apply mappings from file")
|
|
110
|
+
.describe("securities", "Import roles, profiles and users from file")
|
|
111
|
+
.describe("vault-key", "Vault key used to decrypt secrets")
|
|
112
|
+
.describe("secrets-file", "Output file to write decrypted secrets")
|
|
113
|
+
.describe(
|
|
114
|
+
"enable-plugins",
|
|
115
|
+
'Enable plugins from "plugins/available" directory',
|
|
116
|
+
).argv;
|
|
117
|
+
|
|
118
|
+
const run = async () => {
|
|
119
|
+
try {
|
|
120
|
+
await startKuzzle(options);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(`[x] [ERROR] ${error.stack}`);
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
run();
|
|
128
|
+
|
|
129
|
+
// Used for tests only
|
|
130
|
+
module.exports = startKuzzle;
|
package/dist/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle",
|
|
3
3
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
4
|
-
"version": "2.54.
|
|
4
|
+
"version": "2.54.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
|
-
"build": "rm -Rf ./dist && tsc && node ./bin/copy-
|
|
7
|
+
"build": "rm -Rf ./dist && tsc && node ./bin/copy-binaries.js",
|
|
8
8
|
"cucumber": "cucumber.js --fail-fast",
|
|
9
9
|
"dev": "tsx watch start-kuzzle-dev.ts",
|
|
10
10
|
"doc-error-codes": "node -r ts-node/register doc/build-error-codes",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"engineStrict": true,
|
|
106
106
|
"license": "Apache-2.0",
|
|
107
107
|
"files": [
|
|
108
|
-
"dist/bin/start-kuzzle-server
|
|
109
|
-
"dist/bin/copy-
|
|
108
|
+
"dist/bin/start-kuzzle-server",
|
|
109
|
+
"dist/bin/copy-binaries.js",
|
|
110
110
|
"dist/index.d.ts",
|
|
111
111
|
"dist/index.js",
|
|
112
112
|
"dist/lib/**/*.d.ts",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle",
|
|
3
3
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
4
|
-
"version": "2.54.
|
|
4
|
+
"version": "2.54.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
|
-
"build": "rm -Rf ./dist && tsc && node ./bin/copy-
|
|
7
|
+
"build": "rm -Rf ./dist && tsc && node ./bin/copy-binaries.js",
|
|
8
8
|
"cucumber": "cucumber.js --fail-fast",
|
|
9
9
|
"dev": "tsx watch start-kuzzle-dev.ts",
|
|
10
10
|
"doc-error-codes": "node -r ts-node/register doc/build-error-codes",
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"engineStrict": true,
|
|
106
106
|
"license": "Apache-2.0",
|
|
107
107
|
"files": [
|
|
108
|
-
"dist/bin/start-kuzzle-server
|
|
109
|
-
"dist/bin/copy-
|
|
108
|
+
"dist/bin/start-kuzzle-server",
|
|
109
|
+
"dist/bin/copy-binaries.js",
|
|
110
110
|
"dist/index.d.ts",
|
|
111
111
|
"dist/index.js",
|
|
112
112
|
"dist/lib/**/*.d.ts",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
const fs = require("fs/promises");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
async function main() {
|
|
6
|
-
const projectRoot = path.join(__dirname, "..");
|
|
7
|
-
const sourceDir = path.join(projectRoot, "lib", "cluster", "protobuf");
|
|
8
|
-
const targetDir = path.join(projectRoot, "dist", "lib", "cluster", "protobuf");
|
|
9
|
-
await fs.mkdir(targetDir, { recursive: true });
|
|
10
|
-
await fs.cp(sourceDir, targetDir, { recursive: true });
|
|
11
|
-
}
|
|
12
|
-
main().catch((error) => {
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.error("Failed to copy protobuf definitions:", error);
|
|
15
|
-
process.exit(1);
|
|
16
|
-
});
|
|
17
|
-
//# sourceMappingURL=copy-protobuf.js.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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
|
-
"use strict";
|
|
23
|
-
/* eslint-disable no-console */
|
|
24
|
-
const fs = require("fs");
|
|
25
|
-
const yargs = require("yargs");
|
|
26
|
-
const { Backend } = require("../index");
|
|
27
|
-
function loadJson(path) {
|
|
28
|
-
if (!path) {
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
return JSON.parse(fs.readFileSync(path, "utf8"));
|
|
32
|
-
}
|
|
33
|
-
async function startKuzzle(options = {}) {
|
|
34
|
-
const app = new Backend("kuzzle");
|
|
35
|
-
if (options.enablePlugins) {
|
|
36
|
-
const additionalPlugins = options.enablePlugins
|
|
37
|
-
.trim()
|
|
38
|
-
.split(",")
|
|
39
|
-
.map((x) => x.trim().replace(/(^")|("$)/g, ""));
|
|
40
|
-
for (const additionalPlugin of additionalPlugins) {
|
|
41
|
-
const PluginClass = require(`./plugins/available/${additionalPlugin}`);
|
|
42
|
-
const manifest = require(`./plugins/available/${additionalPlugin}/manifest.json`);
|
|
43
|
-
const plugin = new PluginClass();
|
|
44
|
-
try {
|
|
45
|
-
plugin.version = require(`./plugins/available/${additionalPlugin}/package.json`).version;
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
// ignore
|
|
49
|
-
}
|
|
50
|
-
app.plugin.use(plugin, { manifest, name: manifest.name });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
app.import.mappings = loadJson(options.mappings);
|
|
54
|
-
app.import.fixtures = loadJson(options.fixtures);
|
|
55
|
-
app.import.securities = loadJson(options.securities);
|
|
56
|
-
app.vault.key = options.vaultKey;
|
|
57
|
-
app.vault.file = options.secretsFile;
|
|
58
|
-
app.version = "1.0.0";
|
|
59
|
-
await app.start();
|
|
60
|
-
const { total: admins } = await app.sdk.security.searchUsers({
|
|
61
|
-
query: { term: { profileIds: "admin" } },
|
|
62
|
-
});
|
|
63
|
-
if (admins.length === 0) {
|
|
64
|
-
app.log("[!] [WARNING] There is no administrator user yet: everyone has administrator rights.");
|
|
65
|
-
app.log("[ℹ] You can use the CLI or the admin console to create the first administrator user.");
|
|
66
|
-
app.log(" For more information: https://docs.kuzzle.io/core/2/guides/essentials/security/");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const options = yargs()
|
|
70
|
-
.scriptName("kuzzle")
|
|
71
|
-
.usage("start-kuzzle-server [options]")
|
|
72
|
-
.describe("fixtures", "Import data from file")
|
|
73
|
-
.describe("mappings", "Apply mappings from file")
|
|
74
|
-
.describe("securities", "Import roles, profiles and users from file")
|
|
75
|
-
.describe("vault-key", "Vault key used to decrypt secrets")
|
|
76
|
-
.describe("secrets-file", "Output file to write decrypted secrets")
|
|
77
|
-
.describe("enable-plugins", 'Enable plugins from "plugins/available" directory').argv;
|
|
78
|
-
const run = async () => {
|
|
79
|
-
try {
|
|
80
|
-
await startKuzzle(options);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
console.error(`[x] [ERROR] ${error.stack}`);
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
run();
|
|
88
|
-
// Used for tests only
|
|
89
|
-
module.exports = startKuzzle;
|
|
90
|
-
//# sourceMappingURL=start-kuzzle-server.js.map
|