kuzzle 2.19.9 → 2.19.10
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/lib/api/controllers/documentController.js +4 -1
- package/lib/api/request/requestContext.d.ts +1 -1
- package/lib/cluster/idCardHandler.d.ts +1 -1
- package/lib/cluster/state.d.ts +3 -3
- package/lib/core/backend/backend.js +2 -1
- package/lib/core/backend/backendImport.d.ts +1 -1
- package/lib/core/network/protocols/httpwsProtocol.js +8 -1
- package/lib/core/realtime/channel.js +12 -12
- package/lib/core/security/profileRepository.d.ts +3 -3
- package/lib/model/security/profile.d.ts +1 -1
- package/lib/service/storage/elasticsearch.js +27 -2
- package/lib/types/Controller.js +3 -3
- package/lib/types/ControllerDefinition.d.ts +2 -2
- package/lib/types/ControllerRights.d.ts +2 -2
- package/lib/types/DebugModule.d.ts +1 -1
- package/lib/types/Deprecation.d.ts +1 -1
- package/lib/types/EventHandler.d.ts +5 -5
- package/lib/types/HttpStream.d.ts +1 -1
- package/lib/types/HttpStream.js +4 -4
- package/lib/types/Kuzzle.d.ts +4 -4
- package/lib/types/OpenApiDefinition.d.ts +1 -1
- package/lib/types/PasswordPolicy.d.ts +1 -1
- package/lib/types/Plugin.d.ts +3 -3
- package/lib/types/PluginManifest.d.ts +1 -1
- package/lib/types/Policy.d.ts +2 -2
- package/lib/types/PolicyRestrictions.d.ts +2 -2
- package/lib/types/ProfileDefinition.d.ts +1 -1
- package/lib/types/RoleDefinition.d.ts +1 -1
- package/lib/types/StrategyDefinition.d.ts +1 -1
- package/lib/types/Target.d.ts +1 -1
- package/lib/types/config/DumpConfiguration.d.ts +1 -1
- package/lib/types/config/HttpConfiguration.d.ts +1 -1
- package/lib/types/config/KuzzleConfiguration.d.ts +1 -1
- package/lib/types/config/LimitsConfiguration.d.ts +1 -1
- package/lib/types/config/PluginsConfiguration.d.ts +1 -1
- package/lib/types/config/SecurityConfiguration.d.ts +1 -1
- package/lib/types/config/ServerConfiguration.d.ts +1 -1
- package/lib/types/config/ServicesConfiguration.d.ts +1 -1
- package/lib/types/config/internalCache/InternalCacheRedisConfiguration.d.ts +1 -1
- package/lib/types/config/publicCache/PublicCacheRedisConfiguration.d.ts +1 -1
- package/lib/types/config/storageEngine/StorageEngineElasticsearchConfiguration.d.ts +1 -1
- package/lib/types/errors/ErrorDefinition.d.ts +3 -3
- package/lib/types/errors/ErrorDomains.d.ts +1 -1
- package/lib/types/events/EventGenericDocument.d.ts +10 -10
- package/lib/types/realtime/RealtimeScope.d.ts +1 -1
- package/lib/types/realtime/RealtimeUsers.d.ts +1 -1
- package/lib/types/realtime/RoomList.d.ts +1 -1
- package/lib/util/bufferedPassThrough.d.ts +4 -4
- package/lib/util/dump-collection.js +21 -16
- package/lib/util/name-generator.d.ts +1 -1
- package/package.json +15 -15
|
@@ -363,7 +363,10 @@ class DocumentController extends NativeController {
|
|
|
363
363
|
async count(request) {
|
|
364
364
|
const { searchBody } = request.getSearchParams();
|
|
365
365
|
const { index, collection } = request.getIndexAndCollection();
|
|
366
|
-
|
|
366
|
+
const lang = request.getLangParam();
|
|
367
|
+
if (lang === "koncorde") {
|
|
368
|
+
searchBody.query = await this.translateKoncorde(searchBody.query);
|
|
369
|
+
}
|
|
367
370
|
const count = await this.ask(
|
|
368
371
|
"core:storage:public:document:count",
|
|
369
372
|
index,
|
package/lib/cluster/state.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ import { JSONObject } from "kuzzle-sdk";
|
|
|
3
3
|
import { RoomList } from "../types";
|
|
4
4
|
import Long from "long";
|
|
5
5
|
import "../types/Global";
|
|
6
|
-
export
|
|
6
|
+
export type SerializedRoomSubscriptions = {
|
|
7
7
|
nodeId: string;
|
|
8
8
|
messageId: Long;
|
|
9
9
|
subscribers: number;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type SerializedRoomState = {
|
|
12
12
|
collection: string;
|
|
13
13
|
filters: string;
|
|
14
14
|
index: string;
|
|
@@ -88,7 +88,7 @@ export default class State {
|
|
|
88
88
|
*/
|
|
89
89
|
loadFullState(serialized: SerializedState): void;
|
|
90
90
|
}
|
|
91
|
-
export
|
|
91
|
+
export type SerializedState = {
|
|
92
92
|
authStrategies: JSONObject[];
|
|
93
93
|
rooms: SerializedRoomState[];
|
|
94
94
|
};
|
|
@@ -163,12 +163,13 @@ class Backend {
|
|
|
163
163
|
* Starts the Kuzzle application with the defined features
|
|
164
164
|
*/
|
|
165
165
|
async start() {
|
|
166
|
+
var _a;
|
|
166
167
|
if (this.started) {
|
|
167
168
|
throw runtimeError.get("already_started", "start");
|
|
168
169
|
}
|
|
169
170
|
this._kuzzle = new kuzzle_1.default(this.config.content);
|
|
170
171
|
for (const plugin of this.config.content.plugins.common.include) {
|
|
171
|
-
const { default: PluginClass } = await Promise.resolve().then(() => __importStar(require(
|
|
172
|
+
const { default: PluginClass } = await (_a = plugin, Promise.resolve().then(() => __importStar(require(_a))));
|
|
172
173
|
this.plugin.use(new PluginClass(), {
|
|
173
174
|
deprecationWarning: false,
|
|
174
175
|
name: plugin,
|
|
@@ -81,12 +81,13 @@ const HTTP_ALLOWED_CONTENT_TYPES = [
|
|
|
81
81
|
"application/x-www-form-urlencoded",
|
|
82
82
|
"multipart/form-data",
|
|
83
83
|
];
|
|
84
|
-
const HTTP_SKIPPED_HEADERS = ["content-length"];
|
|
84
|
+
const HTTP_SKIPPED_HEADERS = ["content-length", "set-cookie"];
|
|
85
85
|
const HTTP_HEADER_CONNECTION = Buffer.from("Connection");
|
|
86
86
|
const HTTP_HEADER_CONTENT_LENGTH = Buffer.from("Content-Length");
|
|
87
87
|
const HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = Buffer.from(
|
|
88
88
|
"Access-Control-Allow-Origin"
|
|
89
89
|
);
|
|
90
|
+
const HTTP_HEADER_SET_COOKIE = Buffer.from("Set-Cookie");
|
|
90
91
|
const HTTP_HEADER_VARY = Buffer.from("Vary");
|
|
91
92
|
const HTTP_HEADER_TRANSFER_ENCODING = Buffer.from("Transfer-Encoding");
|
|
92
93
|
const CHUNKED = Buffer.from("chunked");
|
|
@@ -702,6 +703,12 @@ class HttpWsProtocol extends Protocol {
|
|
|
702
703
|
response.writeHeader(HTTP_HEADER_VARY, ORIGIN);
|
|
703
704
|
}
|
|
704
705
|
|
|
706
|
+
if (request.response.headers["set-cookie"]) {
|
|
707
|
+
for (const cookie of request.response.headers["set-cookie"]) {
|
|
708
|
+
response.writeHeader(HTTP_HEADER_SET_COOKIE, Buffer.from(cookie));
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
705
712
|
for (const [key, value] of Object.entries(request.response.headers)) {
|
|
706
713
|
// Skip some headers that are not allowed to be sent or modified
|
|
707
714
|
if (HTTP_SKIPPED_HEADERS.includes(key.toLowerCase())) {
|
|
@@ -68,18 +68,6 @@ const realtimeError = kerror.wrap("core", "realtime");
|
|
|
68
68
|
* @property cluster
|
|
69
69
|
*/
|
|
70
70
|
class Channel {
|
|
71
|
-
constructor(roomId, { scope = "all", users = "none", propagate = true, } = {}) {
|
|
72
|
-
this.scope = scope;
|
|
73
|
-
this.users = users;
|
|
74
|
-
this.cluster = propagate;
|
|
75
|
-
if (!Channel.SCOPE_ALLOWED_VALUES.includes(this.scope)) {
|
|
76
|
-
throw realtimeError.get("invalid_scope");
|
|
77
|
-
}
|
|
78
|
-
if (!Channel.USERS_ALLOWED_VALUES.includes(this.users)) {
|
|
79
|
-
throw realtimeError.get("invalid_users");
|
|
80
|
-
}
|
|
81
|
-
this.name = `${roomId}-${Channel.hash(this)}`;
|
|
82
|
-
}
|
|
83
71
|
/**
|
|
84
72
|
* Dummy hash function since we only need to keep the channel configuration.
|
|
85
73
|
*
|
|
@@ -122,6 +110,18 @@ class Channel {
|
|
|
122
110
|
}
|
|
123
111
|
return str;
|
|
124
112
|
}
|
|
113
|
+
constructor(roomId, { scope = "all", users = "none", propagate = true, } = {}) {
|
|
114
|
+
this.scope = scope;
|
|
115
|
+
this.users = users;
|
|
116
|
+
this.cluster = propagate;
|
|
117
|
+
if (!Channel.SCOPE_ALLOWED_VALUES.includes(this.scope)) {
|
|
118
|
+
throw realtimeError.get("invalid_scope");
|
|
119
|
+
}
|
|
120
|
+
if (!Channel.USERS_ALLOWED_VALUES.includes(this.users)) {
|
|
121
|
+
throw realtimeError.get("invalid_users");
|
|
122
|
+
}
|
|
123
|
+
this.name = `${roomId}-${Channel.hash(this)}`;
|
|
124
|
+
}
|
|
125
125
|
}
|
|
126
126
|
exports.Channel = Channel;
|
|
127
127
|
Channel.USERS_ALLOWED_VALUES = ["all", "in", "out", "none"];
|
|
@@ -3,21 +3,21 @@ import { Profile } from "../../model/security/profile";
|
|
|
3
3
|
import Repository from "../shared/repository";
|
|
4
4
|
import { JSONObject } from "kuzzle-sdk";
|
|
5
5
|
/** @internal */
|
|
6
|
-
|
|
6
|
+
type CreateOrReplaceOptions = {
|
|
7
7
|
method?: string;
|
|
8
8
|
refresh?: string;
|
|
9
9
|
strict?: boolean;
|
|
10
10
|
userId?: string;
|
|
11
11
|
};
|
|
12
12
|
/** @internal */
|
|
13
|
-
|
|
13
|
+
type ValidateAndSaveProfileOptions = {
|
|
14
14
|
method?: string;
|
|
15
15
|
refresh?: string;
|
|
16
16
|
strict?: boolean;
|
|
17
17
|
retryOnConflict?: number;
|
|
18
18
|
};
|
|
19
19
|
/** @internal */
|
|
20
|
-
|
|
20
|
+
type UpdateOptions = {
|
|
21
21
|
userId?: string;
|
|
22
22
|
refresh?: string;
|
|
23
23
|
strict?: boolean;
|
|
@@ -2,7 +2,7 @@ import { Policy, OptimizedPolicy, OptimizedPolicyRestrictions } from "../../type
|
|
|
2
2
|
import { Role } from "./role";
|
|
3
3
|
import { KuzzleRequest } from "../../../index";
|
|
4
4
|
/** @internal */
|
|
5
|
-
|
|
5
|
+
type InternalProfilePolicy = {
|
|
6
6
|
role: Role;
|
|
7
7
|
restrictedTo: OptimizedPolicyRestrictions;
|
|
8
8
|
};
|
|
@@ -1375,6 +1375,7 @@ class ElasticSearch extends Service {
|
|
|
1375
1375
|
settings,
|
|
1376
1376
|
},
|
|
1377
1377
|
index: await this._getAvailableIndice(index, collection),
|
|
1378
|
+
wait_for_active_shards: await this._getWaitForActiveShards(),
|
|
1378
1379
|
};
|
|
1379
1380
|
|
|
1380
1381
|
this._checkDynamicProperty(mappings);
|
|
@@ -1692,6 +1693,7 @@ class ElasticSearch extends Service {
|
|
|
1692
1693
|
mappings,
|
|
1693
1694
|
settings,
|
|
1694
1695
|
},
|
|
1696
|
+
wait_for_active_shards: await this._getWaitForActiveShards(),
|
|
1695
1697
|
});
|
|
1696
1698
|
|
|
1697
1699
|
return null;
|
|
@@ -3143,7 +3145,7 @@ class ElasticSearch extends Service {
|
|
|
3143
3145
|
return;
|
|
3144
3146
|
}
|
|
3145
3147
|
|
|
3146
|
-
|
|
3148
|
+
const esRequest = {
|
|
3147
3149
|
body: {
|
|
3148
3150
|
aliases: {
|
|
3149
3151
|
[this._getAlias(index, HIDDEN_COLLECTION)]: {},
|
|
@@ -3154,7 +3156,10 @@ class ElasticSearch extends Service {
|
|
|
3154
3156
|
},
|
|
3155
3157
|
},
|
|
3156
3158
|
index: await this._getAvailableIndice(index, HIDDEN_COLLECTION),
|
|
3157
|
-
|
|
3159
|
+
wait_for_active_shards: await this._getWaitForActiveShards(),
|
|
3160
|
+
};
|
|
3161
|
+
|
|
3162
|
+
await this._client.indices.create(esRequest);
|
|
3158
3163
|
} catch (e) {
|
|
3159
3164
|
throw this._esWrapper.formatESError(e);
|
|
3160
3165
|
} finally {
|
|
@@ -3162,6 +3167,26 @@ class ElasticSearch extends Service {
|
|
|
3162
3167
|
}
|
|
3163
3168
|
}
|
|
3164
3169
|
|
|
3170
|
+
/**
|
|
3171
|
+
* We need to always wait for a minimal number of shards to be available
|
|
3172
|
+
* before answering to the client. This is to avoid Elasticsearch node
|
|
3173
|
+
* to return a 404 Not Found error when the client tries to index a
|
|
3174
|
+
* document in the index.
|
|
3175
|
+
* To find the best value for this setting, we need to take into account
|
|
3176
|
+
* the number of nodes in the cluster and the number of shards per index.
|
|
3177
|
+
*/
|
|
3178
|
+
async _getWaitForActiveShards() {
|
|
3179
|
+
const { body } = await this._client.cat.nodes({ format: "json" });
|
|
3180
|
+
|
|
3181
|
+
const numberOfNodes = body.length;
|
|
3182
|
+
|
|
3183
|
+
if (numberOfNodes > 1) {
|
|
3184
|
+
return "all";
|
|
3185
|
+
}
|
|
3186
|
+
|
|
3187
|
+
return 1;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3165
3190
|
/**
|
|
3166
3191
|
* Scroll indice in elasticsearch and return all document that match the filter
|
|
3167
3192
|
* /!\ throws a write_limit_exceed error: this method is intended to be used
|
package/lib/types/Controller.js
CHANGED
|
@@ -25,15 +25,15 @@ exports.Controller = void 0;
|
|
|
25
25
|
* Base class to declare a controller class
|
|
26
26
|
*/
|
|
27
27
|
class Controller {
|
|
28
|
-
constructor(app) {
|
|
29
|
-
this.app = app;
|
|
30
|
-
}
|
|
31
28
|
/**
|
|
32
29
|
* EmbeddedSDK instance
|
|
33
30
|
*/
|
|
34
31
|
get sdk() {
|
|
35
32
|
return this.app.sdk;
|
|
36
33
|
}
|
|
34
|
+
constructor(app) {
|
|
35
|
+
this.app = app;
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
38
|
exports.Controller = Controller;
|
|
39
39
|
//# sourceMappingURL=Controller.js.map
|
|
@@ -13,7 +13,7 @@ import { KuzzleRequest } from "../api/request";
|
|
|
13
13
|
* }
|
|
14
14
|
* }
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type ControllerDefinition = {
|
|
17
17
|
/**
|
|
18
18
|
* Definition of controller actions
|
|
19
19
|
*
|
|
@@ -64,7 +64,7 @@ export declare type ControllerDefinition = {
|
|
|
64
64
|
/**
|
|
65
65
|
* Http route definition
|
|
66
66
|
*/
|
|
67
|
-
export
|
|
67
|
+
export type HttpRoute = {
|
|
68
68
|
/**
|
|
69
69
|
* HTTP verb.
|
|
70
70
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export
|
|
2
|
+
export type ControllerRight = {
|
|
3
3
|
actions: {
|
|
4
4
|
[action: string]: boolean;
|
|
5
5
|
};
|
|
@@ -17,6 +17,6 @@ export declare type ControllerRight = {
|
|
|
17
17
|
* }
|
|
18
18
|
* }
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type ControllerRights = {
|
|
21
21
|
[controller: string]: ControllerRight;
|
|
22
22
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Describe an event with it's name and the handler function arguments
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type EventDefinition = {
|
|
5
5
|
/**
|
|
6
6
|
* Name of the event
|
|
7
7
|
*
|
|
@@ -17,18 +17,18 @@ export declare type EventDefinition = {
|
|
|
17
17
|
/**
|
|
18
18
|
* Handler for hook events
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export type HookEventHandler<TEventDefinition extends EventDefinition = EventDefinition> = (...args: TEventDefinition["args"]) => void;
|
|
21
21
|
/**
|
|
22
22
|
* Handler for pipe event.
|
|
23
23
|
*
|
|
24
24
|
* It should return a promise resolving the first received argument.
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type PipeEventHandler<TEventDefinition extends EventDefinition = EventDefinition> = (...args: TEventDefinition["args"]) => Promise<TEventDefinition["args"][0]>;
|
|
27
27
|
/**
|
|
28
28
|
* Handler for cluster event.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export type ClusterEventHandler<TEventDefinition extends EventDefinition = EventDefinition> = (...args: TEventDefinition["args"]) => any;
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated Use HookEventHandler, PipeEventHandler or ClusterEventHandler
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type EventHandler = (...payload: any) => any;
|
package/lib/types/HttpStream.js
CHANGED
|
@@ -26,16 +26,16 @@ exports.HttpStream = void 0;
|
|
|
26
26
|
* and provide additional informations about the given data
|
|
27
27
|
*/
|
|
28
28
|
class HttpStream {
|
|
29
|
+
get readableState() {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
return this.stream._readableState;
|
|
32
|
+
}
|
|
29
33
|
constructor(readableStream, { totalBytes = -1 } = {}) {
|
|
30
34
|
this._destroyed = false;
|
|
31
35
|
this.stream = readableStream;
|
|
32
36
|
this.totalBytes = totalBytes;
|
|
33
37
|
this._destroyed = readableStream.destroyed;
|
|
34
38
|
}
|
|
35
|
-
get readableState() {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
return this.stream._readableState;
|
|
38
|
-
}
|
|
39
39
|
/**
|
|
40
40
|
* Returns if the stream is errored
|
|
41
41
|
*/
|
package/lib/types/Kuzzle.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { JSONObject } from "../../index";
|
|
2
|
-
export
|
|
2
|
+
export type InstallationConfig = {
|
|
3
3
|
id: string;
|
|
4
4
|
handler: () => Promise<void>;
|
|
5
5
|
description?: string;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type StartOptions = {
|
|
8
8
|
import?: JSONObject;
|
|
9
9
|
plugins?: JSONObject;
|
|
10
10
|
secretsFile?: JSONObject;
|
|
@@ -12,7 +12,7 @@ export declare type StartOptions = {
|
|
|
12
12
|
vaultKey?: JSONObject;
|
|
13
13
|
installations?: Array<InstallationConfig>;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
15
|
+
export type ImportConfig = {
|
|
16
16
|
mappings?: JSONObject;
|
|
17
17
|
onExistingUsers?: string;
|
|
18
18
|
profiles?: JSONObject;
|
|
@@ -20,7 +20,7 @@ export declare type ImportConfig = {
|
|
|
20
20
|
userMappings?: JSONObject;
|
|
21
21
|
users?: JSONObject;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type SupportConfig = {
|
|
24
24
|
fixtures?: JSONObject;
|
|
25
25
|
mappings?: JSONObject;
|
|
26
26
|
securities?: {
|
package/lib/types/Plugin.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { JSONObject } from "../../index";
|
|
|
7
7
|
/**
|
|
8
8
|
* Allows to define plugins controllers and actions
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type PluginApiDefinition = {
|
|
11
11
|
/**
|
|
12
12
|
* Name of the API controller.
|
|
13
13
|
*/
|
|
@@ -16,7 +16,7 @@ export declare type PluginApiDefinition = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Allows to define hooks on events
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type PluginHookDefinition = {
|
|
20
20
|
/**
|
|
21
21
|
* Event name or wildcard event.
|
|
22
22
|
*/
|
|
@@ -25,7 +25,7 @@ export declare type PluginHookDefinition = {
|
|
|
25
25
|
/**
|
|
26
26
|
* Allows to define pipes on events
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type PluginPipeDefinition = {
|
|
29
29
|
/**
|
|
30
30
|
* Event name or wildcard event.
|
|
31
31
|
*/
|
package/lib/types/Policy.d.ts
CHANGED
|
@@ -14,12 +14,12 @@ import { PolicyRestrictions, OptimizedPolicyRestrictions } from "./PolicyRestric
|
|
|
14
14
|
* ]
|
|
15
15
|
* }
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export type Policy = {
|
|
18
18
|
roleId: string;
|
|
19
19
|
restrictedTo?: PolicyRestrictions[];
|
|
20
20
|
};
|
|
21
21
|
/** @internal */
|
|
22
|
-
export
|
|
22
|
+
export type OptimizedPolicy = {
|
|
23
23
|
roleId: string;
|
|
24
24
|
restrictedTo?: OptimizedPolicyRestrictions;
|
|
25
25
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* "collections": ["foo", "bar"]
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type PolicyRestrictions = {
|
|
12
12
|
index: string;
|
|
13
13
|
collections: string[];
|
|
14
14
|
};
|
|
@@ -18,4 +18,4 @@ export declare type PolicyRestrictions = {
|
|
|
18
18
|
* the key {string} represent the index name
|
|
19
19
|
* the value {string[]} represent the collection names
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type OptimizedPolicyRestrictions = Map<string, string[]>;
|
package/lib/types/Target.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* send responses to the client
|
|
5
5
|
* (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type HttpConfiguration = {
|
|
8
8
|
routes: any;
|
|
9
9
|
/**
|
|
10
10
|
* Sets the default Access-Control-Allow-Origin HTTP
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { JSONObject } from "../../../index";
|
|
3
3
|
import { RoleDefinition, ProfileDefinition } from "../index";
|
|
4
|
-
export
|
|
4
|
+
export type SecurityConfiguration = {
|
|
5
5
|
/**
|
|
6
6
|
* Debugger configuration
|
|
7
7
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicCacheRedisConfiguration, InternalCacheConfiguration, StorageEngineElasticsearch } from "../index";
|
|
2
|
-
export
|
|
2
|
+
export type ServicesConfiguration = {
|
|
3
3
|
common: {
|
|
4
4
|
/**
|
|
5
5
|
* Time in ms after which a service is considered failing if
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Available error class
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type ErrorClassNames = "BadRequestError" | "ExternalServiceError" | "ForbiddenError" | "GatewayTimeoutError" | "InternalError" | "KuzzleError" | "MultipleErrorsError" | "NotFoundError" | "PartialError" | "PluginImplementationError" | "ServiceUnavailableError" | "SizeLimitError" | "UnauthorizedError" | "PreconditionError" | "TooManyRequestsError";
|
|
5
5
|
/**
|
|
6
6
|
* Represents a standardized error definition
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export type ErrorDefinition = CustomErrorDefinition & {
|
|
9
9
|
code: number;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Represents a custom standardized error definition
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type CustomErrorDefinition = {
|
|
15
15
|
/**
|
|
16
16
|
* Error description for documentation purpose
|
|
17
17
|
*/
|
|
@@ -2,7 +2,7 @@ import { ErrorDefinition } from "./ErrorDefinition";
|
|
|
2
2
|
/**
|
|
3
3
|
* Represents the domains, subDomains and error names with associated definitions
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type ErrorDomains = {
|
|
6
6
|
[domain: string]: {
|
|
7
7
|
code: number;
|
|
8
8
|
subDomains?: {
|
|
@@ -2,25 +2,25 @@ import { KuzzleRequest, KDocument, JSONObject } from "../../../";
|
|
|
2
2
|
/**
|
|
3
3
|
* Events with documents only having the `_id`
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
type EventGenericDocumentPartial<name extends string> = {
|
|
6
6
|
name: `generic:document:${name}`;
|
|
7
7
|
args: [Array<{
|
|
8
8
|
_id: string;
|
|
9
9
|
}>, KuzzleRequest];
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
11
|
+
export type EventGenericDocumentBeforeDelete = EventGenericDocumentPartial<"beforeDelete">;
|
|
12
|
+
export type EventGenericDocumentAfterDelete = EventGenericDocumentPartial<"afterDelete">;
|
|
13
|
+
export type EventGenericDocumentBeforeGet = EventGenericDocumentPartial<"beforeGet">;
|
|
14
14
|
/**
|
|
15
15
|
* Events having entire documents
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
type EventGenericDocument<name extends string, KDocumentContent> = {
|
|
18
18
|
name: `generic:document:${name}`;
|
|
19
19
|
args: [KDocument<KDocumentContent>[], KuzzleRequest];
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
21
|
+
export type EventGenericDocumentBeforeWrite<KDocumentContent = JSONObject> = EventGenericDocument<"beforeWrite", KDocumentContent>;
|
|
22
|
+
export type EventGenericDocumentAfterWrite<KDocumentContent = JSONObject> = EventGenericDocument<"afterWrite", KDocumentContent>;
|
|
23
|
+
export type EventGenericDocumentBeforeUpdate<KDocumentContent = JSONObject> = EventGenericDocument<"beforeUpdate", KDocumentContent>;
|
|
24
|
+
export type EventGenericDocumentAfterUpdate<KDocumentContent = JSONObject> = EventGenericDocument<"afterUpdate", KDocumentContent>;
|
|
25
|
+
export type EventGenericDocumentAfterGet<KDocumentContent = JSONObject> = EventGenericDocument<"afterGet", KDocumentContent>;
|
|
26
26
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import stream from "stream";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type Encoding = BufferEncoding | "buffer";
|
|
5
|
+
type ChunkData = Buffer | string;
|
|
6
|
+
type Chunk = {
|
|
7
7
|
chunk: ChunkData;
|
|
8
8
|
encoding: Encoding;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type Callback = (error?: Error) => void;
|
|
11
11
|
/**
|
|
12
12
|
* This streams accumulate chunks data into a buffer until the amount of data is equal or exceed the buffer size.
|
|
13
13
|
* Then, it emits a single chunk with the accumulated data.
|
|
@@ -171,22 +171,27 @@ class AbstractDumper {
|
|
|
171
171
|
this.writeStream.on("error", (error) => {
|
|
172
172
|
throw error;
|
|
173
173
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
174
|
+
try {
|
|
175
|
+
await this.setup();
|
|
176
|
+
await this.writeHeader();
|
|
177
|
+
let results = await global.kuzzle.ask("core:storage:public:document:search", this.index, this.collection, this.query, {
|
|
178
|
+
lang: this.options.lang,
|
|
179
|
+
scroll: this.options.scroll,
|
|
180
|
+
size: this.options.size,
|
|
181
|
+
});
|
|
182
|
+
do {
|
|
183
|
+
for (const hit of results.hits) {
|
|
184
|
+
await this.onResult({
|
|
185
|
+
_id: hit._id,
|
|
186
|
+
_source: hit._source,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
} while ((results = await this.scroll(results.scrollId)));
|
|
190
|
+
await this.tearDown();
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
this.writeStream.write(e.toString());
|
|
194
|
+
}
|
|
190
195
|
this.writeStream.end();
|
|
191
196
|
return waitWrite;
|
|
192
197
|
}
|
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.19.
|
|
4
|
+
"version": "2.19.10",
|
|
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
|
"bin": "bin/start-kuzzle-server",
|
|
7
7
|
"scripts": {
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"dumpme": "^1.0.3",
|
|
53
53
|
"eslint-plugin-kuzzle": "^0.0.6",
|
|
54
54
|
"eventemitter3": "^4.0.7",
|
|
55
|
-
"inquirer": "^9.1.
|
|
56
|
-
"ioredis": "^5.2.
|
|
55
|
+
"inquirer": "^9.1.4",
|
|
56
|
+
"ioredis": "^5.2.4",
|
|
57
57
|
"js-yaml": "^4.1.0",
|
|
58
|
-
"json-stable-stringify": "^1.0.
|
|
58
|
+
"json-stable-stringify": "^1.0.2",
|
|
59
59
|
"json2yaml": "^1.1.0",
|
|
60
60
|
"jsonwebtoken": "^8.5.1",
|
|
61
61
|
"koncorde": "^4.0.3",
|
|
@@ -64,25 +64,25 @@
|
|
|
64
64
|
"kuzzle-sdk": "^7.10.3",
|
|
65
65
|
"kuzzle-vault": "^2.0.4",
|
|
66
66
|
"lodash": "4.17.21",
|
|
67
|
-
"long": "^5.2.
|
|
67
|
+
"long": "^5.2.1",
|
|
68
68
|
"moment": "^2.29.4",
|
|
69
69
|
"ms": "^2.1.3",
|
|
70
70
|
"murmurhash-native": "^3.5.0",
|
|
71
71
|
"ndjson": "^2.0.0",
|
|
72
72
|
"node-segfault-handler": "^1.1.0",
|
|
73
73
|
"passport": "^0.6.0",
|
|
74
|
-
"protobufjs": "~7.1.
|
|
74
|
+
"protobufjs": "~7.1.2",
|
|
75
75
|
"rc": "1.2.8",
|
|
76
|
-
"semver": "^7.3.
|
|
76
|
+
"semver": "^7.3.8",
|
|
77
77
|
"sorted-array": "^2.0.4",
|
|
78
78
|
"uuid": "^9.0.0",
|
|
79
79
|
"uWebSockets.js": "https://github.com/uNetworking/uWebSockets.js/archive/refs/tags/v20.0.0.tar.gz",
|
|
80
80
|
"validator": "^13.7.0",
|
|
81
|
-
"winston": "^3.8.
|
|
81
|
+
"winston": "^3.8.2",
|
|
82
82
|
"winston-elasticsearch": "0.17.1",
|
|
83
|
-
"winston-syslog": "^2.
|
|
83
|
+
"winston-syslog": "^2.7.0",
|
|
84
84
|
"winston-transport": "^4.5.0",
|
|
85
|
-
"yargs": "^17.
|
|
85
|
+
"yargs": "^17.6.2",
|
|
86
86
|
"zeromq": "6.0.0-beta.6"
|
|
87
87
|
},
|
|
88
88
|
"repository": {
|
|
@@ -91,13 +91,13 @@
|
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@types/js-yaml": "^4.0.5",
|
|
94
|
-
"@types/lodash": "^4.14.
|
|
94
|
+
"@types/lodash": "^4.14.190",
|
|
95
95
|
"async": "^3.2.4",
|
|
96
96
|
"chokidar": "^3.5.3",
|
|
97
97
|
"codecov": "^3.8.3",
|
|
98
98
|
"cucumber": "^6.0.5",
|
|
99
99
|
"ergol": "^1.0.2",
|
|
100
|
-
"mocha": "^
|
|
100
|
+
"mocha": "^10.1.0",
|
|
101
101
|
"mock-require": "^3.0.3",
|
|
102
102
|
"mqtt": "^4.3.7",
|
|
103
103
|
"nyc": "^15.1.0",
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
"rewire": "^5.0.0",
|
|
107
107
|
"should": "13.2.3",
|
|
108
108
|
"should-sinon": "0.0.6",
|
|
109
|
-
"sinon": "^
|
|
109
|
+
"sinon": "^14.0.2",
|
|
110
110
|
"strip-json-comments": "https://github.com/sindresorhus/strip-json-comments/archive/refs/tags/v3.1.1.tar.gz",
|
|
111
111
|
"ts-node": "^10.9.1",
|
|
112
|
-
"typescript": "^4.
|
|
113
|
-
"yaml": "^2.1.
|
|
112
|
+
"typescript": "^4.9.3",
|
|
113
|
+
"yaml": "^2.1.3"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|
|
116
116
|
"node": ">= 12.13.0"
|