kuzzle 2.54.0 → 2.54.1

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,90 @@
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
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.54.0",
4
+ "version": "2.54.1",
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",
@@ -105,7 +105,7 @@
105
105
  "engineStrict": true,
106
106
  "license": "Apache-2.0",
107
107
  "files": [
108
- "dist/bin/check-node-version.js",
108
+ "dist/bin/start-kuzzle-server.js",
109
109
  "dist/bin/copy-protobuf.js",
110
110
  "dist/index.d.ts",
111
111
  "dist/index.js",
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.54.0",
4
+ "version": "2.54.1",
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",
@@ -105,7 +105,7 @@
105
105
  "engineStrict": true,
106
106
  "license": "Apache-2.0",
107
107
  "files": [
108
- "dist/bin/check-node-version.js",
108
+ "dist/bin/start-kuzzle-server.js",
109
109
  "dist/bin/copy-protobuf.js",
110
110
  "dist/index.d.ts",
111
111
  "dist/index.js",