kuzzle 2.18.1 → 2.19.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.
- package/index.d.ts +1 -0
- package/index.js +3 -0
- package/lib/api/controllers/adminController.js +9 -0
- package/lib/api/controllers/debugController.d.ts +59 -0
- package/lib/api/controllers/debugController.js +285 -0
- package/lib/api/controllers/documentController.js +43 -29
- package/lib/api/controllers/index.js +1 -0
- package/lib/api/controllers/securityController.js +2 -2
- package/lib/api/documentExtractor.js +49 -8
- package/lib/api/funnel.js +30 -8
- package/lib/api/httpRoutes.js +6 -0
- package/lib/api/request/kuzzleRequest.d.ts +12 -4
- package/lib/api/request/kuzzleRequest.js +17 -13
- package/lib/cluster/idCardHandler.js +1 -1
- package/lib/config/default.config.js +3 -0
- package/lib/config/documentEventAliases.d.ts +7 -0
- package/lib/config/documentEventAliases.js +26 -12
- package/lib/core/backend/backend.d.ts +4 -0
- package/lib/core/backend/backend.js +9 -0
- package/lib/core/network/protocols/httpwsProtocol.js +6 -0
- package/lib/core/shared/sdk/embeddedSdk.d.ts +1 -1
- package/lib/core/shared/sdk/embeddedSdk.js +33 -0
- package/lib/kerror/codes/0-core.json +35 -0
- package/lib/kerror/codes/2-api.json +6 -0
- package/lib/kuzzle/kuzzle.d.ts +1 -1
- package/lib/kuzzle/kuzzle.js +27 -8
- package/lib/model/storage/apiKey.js +1 -6
- package/lib/service/storage/elasticsearch.js +40 -13
- package/lib/types/DebugModule.d.ts +23 -0
- package/lib/types/DebugModule.js +39 -0
- package/lib/types/config/SecurityConfiguration.d.ts +10 -0
- package/lib/util/crypto.d.ts +1 -0
- package/lib/util/crypto.js +12 -0
- package/lib/util/name-generator.d.ts +79 -0
- package/lib/util/name-generator.js +1409 -1345
- package/lib/util/time.d.ts +1 -0
- package/lib/util/time.js +9 -0
- package/npm-shrinkwrap.json +19422 -0
- package/package.json +4 -6
- package/lib/core/security/README.md +0 -224
- package/lib/core/shared/README.md +0 -3
- package/package-lock.json +0 -8422
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
import Inspector from 'inspector';
|
|
4
|
+
export declare type DebugModuleOptions = {
|
|
5
|
+
methods?: string[];
|
|
6
|
+
events?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare abstract class DebugModule extends EventEmitter {
|
|
9
|
+
name: string;
|
|
10
|
+
methods: string[];
|
|
11
|
+
events: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Called when the module is loaded, after the debugger has been enabled
|
|
14
|
+
*/
|
|
15
|
+
abstract init(inspector: Inspector.Session): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Called when the module should be cleaned up.
|
|
18
|
+
* - After the Debug Controller has been disabled
|
|
19
|
+
* - Before the debugger is disconnected
|
|
20
|
+
*/
|
|
21
|
+
abstract cleanup(): Promise<void>;
|
|
22
|
+
constructor(name: string, options?: DebugModuleOptions);
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DebugModule = void 0;
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
class DebugModule extends events_1.default {
|
|
9
|
+
constructor(name, options = {}) {
|
|
10
|
+
super();
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.methods = options.methods || [];
|
|
13
|
+
this.events = options.events || [];
|
|
14
|
+
if (!this.name || this.name.length === 0) {
|
|
15
|
+
throw new Error('DebugModule should have a name');
|
|
16
|
+
}
|
|
17
|
+
if (this.name.charAt(0) !== this.name.charAt(0).toUpperCase()) {
|
|
18
|
+
throw new Error(`Debug Module name "${name}" should start with an uppercase letter`);
|
|
19
|
+
}
|
|
20
|
+
for (const event of this.events) {
|
|
21
|
+
if (event.length === 0) {
|
|
22
|
+
throw new Error(`Event name should not be empty for "${name}"`);
|
|
23
|
+
}
|
|
24
|
+
if (event.charAt(0) !== event.charAt(0).toLowerCase()) {
|
|
25
|
+
throw new Error(`Event name "${event}" should start with a lowercase letter for module "${name}"`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const method of this.methods) {
|
|
29
|
+
if (method.length === 0) {
|
|
30
|
+
throw new Error(`Method name should not be empty for Debug Module "${name}"`);
|
|
31
|
+
}
|
|
32
|
+
if (method.charAt(0) !== method.charAt(0).toLowerCase()) {
|
|
33
|
+
throw new Error(`Method name "${method}" should start with a lowercase letter for module "${name}"`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.DebugModule = DebugModule;
|
|
39
|
+
//# sourceMappingURL=DebugModule.js.map
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
import { JSONObject } from '../../../index';
|
|
3
3
|
import { RoleDefinition, ProfileDefinition } from '../index';
|
|
4
4
|
export declare type SecurityConfiguration = {
|
|
5
|
+
/**
|
|
6
|
+
* Debugger configuration
|
|
7
|
+
*/
|
|
8
|
+
debug: {
|
|
9
|
+
/**
|
|
10
|
+
* Allow to use the Chrome DevTools Protocol directly
|
|
11
|
+
* through `debug:post`
|
|
12
|
+
*/
|
|
13
|
+
native_debug_protocol: boolean;
|
|
14
|
+
};
|
|
5
15
|
/**
|
|
6
16
|
* The profileIds applied to a user created with the API action
|
|
7
17
|
* `security:createRestrictedUser`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sha256(string: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sha256 = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
function sha256(string) {
|
|
9
|
+
return crypto_1.default.createHash('sha256').update(string).digest('hex');
|
|
10
|
+
}
|
|
11
|
+
exports.sha256 = sha256;
|
|
12
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare type GenerateRandomNameOpts = {
|
|
2
|
+
/**
|
|
3
|
+
* Optional prefix.
|
|
4
|
+
*/
|
|
5
|
+
prefix?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional separator. Defaults to `-`.
|
|
8
|
+
*/
|
|
9
|
+
separator?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Optional postfix random number range. Set to `false` to disable postfix. Defaults to `{ min: 0, max: 100000 }`
|
|
12
|
+
*/
|
|
13
|
+
postfixRandRange?: {
|
|
14
|
+
/**
|
|
15
|
+
* Optional minimum postfix random number (inclusive). Defaults to `0`.
|
|
16
|
+
*/
|
|
17
|
+
min?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Maximum postfix random number (exclusive).
|
|
20
|
+
*/
|
|
21
|
+
max: number;
|
|
22
|
+
} | false;
|
|
23
|
+
};
|
|
24
|
+
export declare class NameGenerator {
|
|
25
|
+
/**
|
|
26
|
+
* Returns a random name.
|
|
27
|
+
*
|
|
28
|
+
* # Usage:
|
|
29
|
+
*
|
|
30
|
+
* ```js
|
|
31
|
+
* const name = NameGenerator.getRandomName(); // 'verdi'
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @returns a random name
|
|
35
|
+
*/
|
|
36
|
+
static getRandomName(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a random adjective.
|
|
39
|
+
*
|
|
40
|
+
* # Usage
|
|
41
|
+
*
|
|
42
|
+
* ```js
|
|
43
|
+
* const adj = NameGenerator.getRandomAdjective(); // 'absent'
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @returns a random adjective
|
|
47
|
+
*/
|
|
48
|
+
static getRandomAdjective(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Generates a random formatted name that consists of an optional prefix, a random adjective,
|
|
51
|
+
* a random name and an optional random number separated by separator (default: '-').
|
|
52
|
+
*
|
|
53
|
+
* Format: `[prefix<separator>]<adjective><separator><name>[<separator>random number]`
|
|
54
|
+
*
|
|
55
|
+
* Format example: `something-dashing-euler-1164`
|
|
56
|
+
*
|
|
57
|
+
* ## Usage
|
|
58
|
+
*
|
|
59
|
+
* ```js
|
|
60
|
+
* let name = NameGenerator.generateRandomName({
|
|
61
|
+
* prefix: 'my',
|
|
62
|
+
* separator: '_',
|
|
63
|
+
* postfixRandRange: { min: 1, max: 10 }
|
|
64
|
+
* }); // 'my_abandoned_yogi_5'
|
|
65
|
+
*
|
|
66
|
+
* name = NameGenerator.generateRandomName({
|
|
67
|
+
* separator: ' ',
|
|
68
|
+
* postfixRandRange: false
|
|
69
|
+
* }); // 'amused vampire'
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @param {GenerateRandomNameOpts} opts Optional options
|
|
73
|
+
*
|
|
74
|
+
* @returns a random formatted name
|
|
75
|
+
*/
|
|
76
|
+
static generateRandomName({ prefix, separator, postfixRandRange, }?: GenerateRandomNameOpts): string;
|
|
77
|
+
}
|
|
78
|
+
export declare function randomNumber(max: number): number;
|
|
79
|
+
export declare function randomNumber(min: number, max: number): number;
|