kuzzle-sdk 7.10.7 → 7.11.0-beta.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.
- package/dist/kuzzle.js +1 -1
- package/dist/kuzzle.js.LICENSE.txt +1 -1
- package/package.json +19 -10
- package/src/controllers/Auth.d.ts +12 -12
- package/src/controllers/Bulk.d.ts +1 -1
- package/src/controllers/Collection.d.ts +11 -11
- package/src/controllers/Document.d.ts +2 -2
- package/src/controllers/Index.d.ts +6 -6
- package/src/controllers/Realtime.d.ts +2 -2
- package/src/controllers/Security.d.ts +41 -41
- package/src/controllers/Server.d.ts +7 -7
- package/src/core/KuzzleEventEmitter.d.ts +4 -4
- package/src/core/Observer.d.ts +1 -1
- package/src/core/Observer.js +9 -9
- package/src/core/batchWriter/BatchBuffer.d.ts +2 -2
- package/src/core/batchWriter/BatchWriter.js +16 -16
- package/src/protocols/abstract/Base.js +3 -3
- package/src/types/ApiKey.d.ts +1 -1
- package/src/types/HttpRoutes.d.ts +1 -1
- package/src/types/JSONObject.d.ts +1 -1
- package/src/types/KDocument.d.ts +10 -0
- package/src/types/Mappings.d.ts +5 -5
- package/src/types/Notification.d.ts +2 -2
- package/src/types/ProfilePolicy.d.ts +1 -1
- package/src/types/RoleRightsDefinition.d.ts +1 -1
- package/src/types/mRequests.d.ts +6 -6
- package/src/types/mResponses.d.ts +7 -7
- package/dist/.gitignore +0 -2
- package/dist/.npmignore +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! Kuzzle Javascript SDK version 7.
|
|
1
|
+
/*! Kuzzle Javascript SDK version 7.11.0-beta.1 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kuzzle-sdk",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.0-beta.1",
|
|
4
4
|
"description": "Official Javascript SDK for Kuzzle",
|
|
5
5
|
"author": "The Kuzzle Team <support@kuzzle.io>",
|
|
6
6
|
"repository": {
|
|
@@ -38,21 +38,30 @@
|
|
|
38
38
|
"license": "Apache-2.0",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"min-req-promise": "^1.0.1",
|
|
41
|
-
"ws": "^8.
|
|
41
|
+
"ws": "^8.13.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
44
|
+
"@commitlint/cli": "^17.6.7",
|
|
45
|
+
"@commitlint/config-conventional": "^17.6.7",
|
|
46
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
47
|
+
"@semantic-release/commit-analyzer": "^10.0.1",
|
|
48
|
+
"@semantic-release/git": "^10.0.1",
|
|
49
|
+
"@semantic-release/release-notes-generator": "^11.0.4",
|
|
50
|
+
"@babel/core": "^7.21.4",
|
|
51
|
+
"@babel/preset-env": "^7.21.4",
|
|
52
|
+
"@types/node": "^18.15.11",
|
|
53
|
+
"babel-loader": "^8.3.0",
|
|
48
54
|
"buffer": "^6.0.3",
|
|
49
55
|
"codecov": "^3.8.3",
|
|
50
56
|
"cucumber": "^6.0.5",
|
|
57
|
+
"semantic-release-config-kuzzle": "^1.0.0",
|
|
58
|
+
"semantic-release-slack-bot": "^4.0.2",
|
|
59
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
51
60
|
"eslint-plugin-kuzzle": "^0.0.6",
|
|
52
61
|
"https-browserify": "^1.0.0",
|
|
53
62
|
"lodash": "^4.17.21",
|
|
54
63
|
"lolex": "^6.0.0",
|
|
55
|
-
"mocha": "10.
|
|
64
|
+
"mocha": "10.2.0",
|
|
56
65
|
"mock-require": "^3.0.3",
|
|
57
66
|
"nyc": "^15.1.0",
|
|
58
67
|
"proxyquire": "^2.1.3",
|
|
@@ -60,13 +69,13 @@
|
|
|
60
69
|
"rewire": "^6.0.0",
|
|
61
70
|
"should": "13.2.3",
|
|
62
71
|
"should-sinon": "0.0.6",
|
|
63
|
-
"sinon": "^14.0.
|
|
72
|
+
"sinon": "^14.0.2",
|
|
64
73
|
"stream-http": "^3.2.0",
|
|
65
74
|
"ts-morph": "^15.1.0",
|
|
66
75
|
"ts-node": "^10.9.1",
|
|
67
|
-
"typescript": "^4.
|
|
76
|
+
"typescript": "^4.9.5",
|
|
68
77
|
"url": "^0.11.0",
|
|
69
|
-
"webpack": "^5.
|
|
78
|
+
"webpack": "^5.79.0",
|
|
70
79
|
"webpack-cli": "^4.10.0"
|
|
71
80
|
},
|
|
72
81
|
"engines": {
|
|
@@ -320,7 +320,7 @@ export interface ArgsAuthControllerCreateApiKey extends ArgsDefault {
|
|
|
320
320
|
expiresIn?: number;
|
|
321
321
|
refresh?: "wait_for" | "false";
|
|
322
322
|
}
|
|
323
|
-
export
|
|
323
|
+
export type ArgsAuthControllerCheckRights = ArgsDefault;
|
|
324
324
|
export interface ArgsAuthControllerDeleteApiKey extends ArgsDefault {
|
|
325
325
|
refresh?: "wait_for" | "false";
|
|
326
326
|
}
|
|
@@ -329,17 +329,17 @@ export interface ArgsAuthControllerSearchApiKeys extends ArgsDefault {
|
|
|
329
329
|
size?: number;
|
|
330
330
|
lang?: string;
|
|
331
331
|
}
|
|
332
|
-
export
|
|
333
|
-
export
|
|
334
|
-
export
|
|
335
|
-
export
|
|
336
|
-
export
|
|
337
|
-
export
|
|
338
|
-
export
|
|
339
|
-
export
|
|
340
|
-
export
|
|
341
|
-
export
|
|
342
|
-
export
|
|
332
|
+
export type ArgsAuthControllerCheckToken = ArgsDefault;
|
|
333
|
+
export type ArgsAuthControllerCreateMyCredentials = ArgsDefault;
|
|
334
|
+
export type ArgsAuthControllerCredentialsExist = ArgsDefault;
|
|
335
|
+
export type ArgsAuthControllerDeleteMyCredentials = ArgsDefault;
|
|
336
|
+
export type ArgsAuthControllerGetCurrentUser = ArgsDefault;
|
|
337
|
+
export type ArgsAuthControllerGetMyCredentials = ArgsDefault;
|
|
338
|
+
export type ArgsAuthControllerGetMyRights = ArgsDefault;
|
|
339
|
+
export type ArgsAuthControllerGetStrategies = ArgsDefault;
|
|
340
|
+
export type ArgsAuthControllerUpdateMyCredentials = ArgsDefault;
|
|
341
|
+
export type ArgsAuthControllerUpdateSelf = ArgsDefault;
|
|
342
|
+
export type ArgsAuthControllerValidateMyCredentials = ArgsDefault;
|
|
343
343
|
export interface ArgsAuthControllerRefreshToken extends ArgsDefault {
|
|
344
344
|
expiresIn?: number | string;
|
|
345
345
|
}
|
|
@@ -167,7 +167,7 @@ export declare class BulkController extends BaseController {
|
|
|
167
167
|
export interface ArgsBulkControllerDeleteByQuery extends ArgsDefault {
|
|
168
168
|
refresh?: "wait_for" | "false";
|
|
169
169
|
}
|
|
170
|
-
export
|
|
170
|
+
export type ArgsBulkControllerImport = ArgsDefault;
|
|
171
171
|
export interface ArgsBulkControllerUpdateByQuery extends ArgsDefault {
|
|
172
172
|
refresh?: "wait_for" | "false";
|
|
173
173
|
}
|
|
@@ -225,14 +225,14 @@ export declare class CollectionController extends BaseController {
|
|
|
225
225
|
*/
|
|
226
226
|
delete(index: string, collection: string, options?: ArgsCollectionControllerDelete): Promise<void>;
|
|
227
227
|
}
|
|
228
|
-
export
|
|
229
|
-
export
|
|
230
|
-
export
|
|
231
|
-
export
|
|
228
|
+
export type ArgsCollectionControllerCreate = ArgsDefault;
|
|
229
|
+
export type ArgsCollectionControllerDeleteSpecifications = ArgsDefault;
|
|
230
|
+
export type ArgsCollectionControllerExists = ArgsDefault;
|
|
231
|
+
export type ArgsCollectionControllerRefresh = ArgsDefault;
|
|
232
232
|
export interface ArgsCollectionControllerGetMapping extends ArgsDefault {
|
|
233
233
|
includeKuzzleMeta?: boolean;
|
|
234
234
|
}
|
|
235
|
-
export
|
|
235
|
+
export type ArgsCollectionControllerGetSpecifications = ArgsDefault;
|
|
236
236
|
export interface ArgsCollectionControllerList extends ArgsDefault {
|
|
237
237
|
from?: number;
|
|
238
238
|
size?: number;
|
|
@@ -242,9 +242,9 @@ export interface ArgsCollectionControllerSearchSpecifications extends ArgsDefaul
|
|
|
242
242
|
size?: number;
|
|
243
243
|
scroll?: string;
|
|
244
244
|
}
|
|
245
|
-
export
|
|
246
|
-
export
|
|
247
|
-
export
|
|
248
|
-
export
|
|
249
|
-
export
|
|
250
|
-
export
|
|
245
|
+
export type ArgsCollectionControllerTruncate = ArgsDefault;
|
|
246
|
+
export type ArgsCollectionControllerUpdate = ArgsDefault;
|
|
247
|
+
export type ArgsCollectionControllerUpdateMapping = ArgsDefault;
|
|
248
|
+
export type ArgsCollectionControllerUpdateSpecifications = ArgsDefault;
|
|
249
|
+
export type ArgsCollectionControllerValidateSpecifications = ArgsDefault;
|
|
250
|
+
export type ArgsCollectionControllerDelete = ArgsDefault;
|
|
@@ -413,7 +413,7 @@ export declare class DocumentController extends BaseController {
|
|
|
413
413
|
*/
|
|
414
414
|
validate<TKDocumentContent extends KDocumentContentGeneric>(index: string, collection: string, content: TKDocumentContent, options?: ArgsDocumentControllerValidate): Promise<boolean>;
|
|
415
415
|
}
|
|
416
|
-
export
|
|
416
|
+
export type ArgsDocumentControllerCount = ArgsDefault;
|
|
417
417
|
export interface ArgsDocumentControllerCreate extends ArgsDefault {
|
|
418
418
|
refresh?: "wait_for" | "false";
|
|
419
419
|
silent?: boolean;
|
|
@@ -509,4 +509,4 @@ export interface ArgsDocumentControllerUpsert<TKDocumentContent> extends ArgsDef
|
|
|
509
509
|
retryOnConflict?: boolean;
|
|
510
510
|
source?: boolean;
|
|
511
511
|
}
|
|
512
|
-
export
|
|
512
|
+
export type ArgsDocumentControllerValidate = ArgsDefault;
|
|
@@ -69,9 +69,9 @@ export declare class IndexController extends BaseController {
|
|
|
69
69
|
*/
|
|
70
70
|
stats(options?: ArgsIndexControllerStats): Promise<JSONObject>;
|
|
71
71
|
}
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
75
|
-
export
|
|
76
|
-
export
|
|
77
|
-
export
|
|
72
|
+
export type ArgsIndexControllerCreate = ArgsDefault;
|
|
73
|
+
export type ArgsIndexControllerDelete = ArgsDefault;
|
|
74
|
+
export type ArgsIndexControllerExists = ArgsDefault;
|
|
75
|
+
export type ArgsIndexControllerList = ArgsDefault;
|
|
76
|
+
export type ArgsIndexControllerMDelete = ArgsDefault;
|
|
77
|
+
export type ArgsIndexControllerStats = ArgsDefault;
|
|
@@ -120,7 +120,7 @@ export declare class RealtimeController extends BaseController {
|
|
|
120
120
|
*/
|
|
121
121
|
private removeSubscriptions;
|
|
122
122
|
}
|
|
123
|
-
export
|
|
123
|
+
export type ArgsRealtimeControllerCount = ArgsDefault;
|
|
124
124
|
export interface ArgsRealtimeControllerPublish extends ArgsDefault {
|
|
125
125
|
_id?: string;
|
|
126
126
|
}
|
|
@@ -130,4 +130,4 @@ export interface ArgsRealtimeControllerSubscribe extends ArgsDefault {
|
|
|
130
130
|
subscribeToSelf?: boolean;
|
|
131
131
|
volatile?: JSONObject;
|
|
132
132
|
}
|
|
133
|
-
export
|
|
133
|
+
export type ArgsRealtimeControllerUnsubscribe = ArgsDefault;
|
|
@@ -99,7 +99,7 @@ export interface ArgsSecurityControllerCreateApiKey extends ArgsDefault {
|
|
|
99
99
|
_id?: string;
|
|
100
100
|
refresh?: "wait_for" | "false";
|
|
101
101
|
}
|
|
102
|
-
export
|
|
102
|
+
export type ArgsSecurityControllerCheckRights = ArgsDefault;
|
|
103
103
|
export interface ArgsSecurityControllerDeleteApiKey extends ArgsDefault {
|
|
104
104
|
refresh?: "wait_for" | "false";
|
|
105
105
|
}
|
|
@@ -108,55 +108,55 @@ export interface ArgsSecurityControllerSearchApiKeys extends ArgsDefault {
|
|
|
108
108
|
size?: number;
|
|
109
109
|
lang?: string;
|
|
110
110
|
}
|
|
111
|
-
export
|
|
111
|
+
export type ArgsSecurityControllerCreateCredentials = ArgsDefault;
|
|
112
112
|
export interface ArgsSecurityControllerCreateFirstAdmin extends ArgsDefault {
|
|
113
113
|
reset?: boolean;
|
|
114
114
|
}
|
|
115
|
-
export
|
|
115
|
+
export type ArgsSecurityControllerCreateOrReplaceProfile = ArgsDefault;
|
|
116
116
|
export interface ArgsSecurityControllerCreateOrReplaceRole extends ArgsDefault {
|
|
117
117
|
force?: boolean;
|
|
118
118
|
}
|
|
119
|
-
export
|
|
120
|
-
export
|
|
119
|
+
export type ArgsSecurityControllerCreateProfile = ArgsDefault;
|
|
120
|
+
export type ArgsSecurityControllerCreateRestrictedUser = ArgsDefault;
|
|
121
121
|
export interface ArgsSecurityControllerCreateRole extends ArgsDefault {
|
|
122
122
|
force?: boolean;
|
|
123
123
|
}
|
|
124
|
-
export
|
|
125
|
-
export
|
|
126
|
-
export
|
|
127
|
-
export
|
|
128
|
-
export
|
|
129
|
-
export
|
|
130
|
-
export
|
|
131
|
-
export
|
|
132
|
-
export
|
|
133
|
-
export
|
|
134
|
-
export
|
|
135
|
-
export
|
|
136
|
-
export
|
|
137
|
-
export
|
|
138
|
-
export
|
|
139
|
-
export
|
|
140
|
-
export
|
|
141
|
-
export
|
|
142
|
-
export
|
|
143
|
-
export
|
|
144
|
-
export
|
|
145
|
-
export
|
|
146
|
-
export
|
|
147
|
-
export
|
|
148
|
-
export
|
|
149
|
-
export
|
|
150
|
-
export
|
|
151
|
-
export
|
|
152
|
-
export
|
|
153
|
-
export
|
|
154
|
-
export
|
|
155
|
-
export
|
|
124
|
+
export type ArgsSecurityControllerCreateUser = ArgsDefault;
|
|
125
|
+
export type ArgsSecurityControllerDeleteCredentials = ArgsDefault;
|
|
126
|
+
export type ArgsSecurityControllerDeleteProfile = ArgsDefault;
|
|
127
|
+
export type ArgsSecurityControllerDeleteRole = ArgsDefault;
|
|
128
|
+
export type ArgsSecurityControllerDeleteUser = ArgsDefault;
|
|
129
|
+
export type ArgsSecurityControllerGetAllCredentialFields = ArgsDefault;
|
|
130
|
+
export type ArgsSecurityControllerGetCredentialFields = ArgsDefault;
|
|
131
|
+
export type ArgsSecurityControllerGetCredentials = ArgsDefault;
|
|
132
|
+
export type ArgsSecurityControllerGetCredentialsById = ArgsDefault;
|
|
133
|
+
export type ArgsSecurityControllerGetProfile = ArgsDefault;
|
|
134
|
+
export type ArgsSecurityControllerGetProfileMapping = ArgsDefault;
|
|
135
|
+
export type ArgsSecurityControllerGetProfileRights = ArgsDefault;
|
|
136
|
+
export type ArgsSecurityControllerGetRole = ArgsDefault;
|
|
137
|
+
export type ArgsSecurityControllerGetRoleMapping = ArgsDefault;
|
|
138
|
+
export type ArgsSecurityControllerGetUser = ArgsDefault;
|
|
139
|
+
export type ArgsSecurityControllerGetUserMapping = ArgsDefault;
|
|
140
|
+
export type ArgsSecurityControllerGetUserRights = ArgsDefault;
|
|
141
|
+
export type ArgsSecurityControllerGetUserStrategies = ArgsDefault;
|
|
142
|
+
export type ArgsSecurityControllerHasCredentials = ArgsDefault;
|
|
143
|
+
export type ArgsSecurityControllerMDeleteProfiles = ArgsDefault;
|
|
144
|
+
export type ArgsSecurityControllerMDeleteRoles = ArgsDefault;
|
|
145
|
+
export type ArgsSecurityControllerMDeleteUsers = ArgsDefault;
|
|
146
|
+
export type ArgsSecurityControllerMGetProfiles = ArgsDefault;
|
|
147
|
+
export type ArgsSecurityControllerMGetUsers = ArgsDefault;
|
|
148
|
+
export type ArgsSecurityControllerMGetRoles = ArgsDefault;
|
|
149
|
+
export type ArgsSecurityControllerReplaceUser = ArgsDefault;
|
|
150
|
+
export type ArgsSecurityControllerSearchProfiles = ArgsDefault;
|
|
151
|
+
export type ArgsSecurityControllerSearchRoles = ArgsDefault;
|
|
152
|
+
export type ArgsSecurityControllerSearchUsers = ArgsDefault;
|
|
153
|
+
export type ArgsSecurityControllerUpdateCredentials = ArgsDefault;
|
|
154
|
+
export type ArgsSecurityControllerUpdateProfile = ArgsDefault;
|
|
155
|
+
export type ArgsSecurityControllerUpdateProfileMapping = ArgsDefault;
|
|
156
156
|
export interface ArgsSecurityControllerUpdateRole extends ArgsDefault {
|
|
157
157
|
force?: boolean;
|
|
158
158
|
}
|
|
159
|
-
export
|
|
160
|
-
export
|
|
161
|
-
export
|
|
162
|
-
export
|
|
159
|
+
export type ArgsSecurityControllerUpdateRoleMapping = ArgsDefault;
|
|
160
|
+
export type ArgsSecurityControllerUpdateUser = ArgsDefault;
|
|
161
|
+
export type ArgsSecurityControllerUpdateUserMapping = ArgsDefault;
|
|
162
|
+
export type ArgsSecurityControllerValidateCredentials = ArgsDefault;
|
|
@@ -68,10 +68,10 @@ export declare class ServerController extends BaseController {
|
|
|
68
68
|
*/
|
|
69
69
|
now(options: ArgsServerControllerNow): Promise<any>;
|
|
70
70
|
}
|
|
71
|
-
export
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
75
|
-
export
|
|
76
|
-
export
|
|
77
|
-
export
|
|
71
|
+
export type ArgsServerControllerAdminExists = ArgsDefault;
|
|
72
|
+
export type ArgsServerControllerGetAllStats = ArgsDefault;
|
|
73
|
+
export type ArgsServerControllerGetConfig = ArgsDefault;
|
|
74
|
+
export type ArgsServerControllerGetLastStats = ArgsDefault;
|
|
75
|
+
export type ArgsServerControllerGetStats = ArgsDefault;
|
|
76
|
+
export type ArgsServerControllerInfo = ArgsDefault;
|
|
77
|
+
export type ArgsServerControllerNow = ArgsDefault;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
type ListenerFunction = (...args: unknown[]) => unknown;
|
|
2
|
+
export type PublicKuzzleEvents = "callbackError" | "connected" | "discarded" | "disconnected" | "loginAttempt" | "logoutAttempt" | "networkError" | "offlineQueuePush" | "offlineQueuePop" | "queryError" | "reAuthenticated" | "reconnected" | "reconnectionError" | "tokenExpired";
|
|
3
|
+
type PrivateKuzzleEvents = "connect" | "reconnect" | "disconnect" | "offlineQueuePush" | "websocketRenewalStart" | "websocketRenewalDone";
|
|
4
4
|
/**
|
|
5
5
|
* For internal use only
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type PrivateAndPublicSDKEvents = PublicKuzzleEvents | PrivateKuzzleEvents;
|
|
8
8
|
/**
|
|
9
9
|
* @todo proper TS conversion
|
|
10
10
|
*/
|
package/src/core/Observer.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { RealtimeDocument } from "./RealtimeDocument";
|
|
|
3
3
|
import { JSONObject, KDocument, KDocumentContentGeneric } from "../types";
|
|
4
4
|
import { RealtimeDocumentSearchResult } from "./searchResult/RealtimeDocument";
|
|
5
5
|
import { ArgsDocumentControllerGet, ArgsDocumentControllerMGet, ArgsDocumentControllerSearch } from "../controllers/Document";
|
|
6
|
-
export
|
|
6
|
+
export type ObserverOptions = {
|
|
7
7
|
/**
|
|
8
8
|
* Refresh delay in ms when the SDK is using the HTTP protocol.
|
|
9
9
|
*
|
package/src/core/Observer.js
CHANGED
|
@@ -10,15 +10,6 @@ const RealtimeDocument_2 = require("./searchResult/RealtimeDocument");
|
|
|
10
10
|
* @internal
|
|
11
11
|
*/
|
|
12
12
|
class ObservedDocuments extends Set {
|
|
13
|
-
constructor(index, collection) {
|
|
14
|
-
super();
|
|
15
|
-
/**
|
|
16
|
-
* Room ID for the realtime subscription on the collection of observed documents
|
|
17
|
-
*/
|
|
18
|
-
this.roomId = null;
|
|
19
|
-
this.index = index;
|
|
20
|
-
this.collection = collection;
|
|
21
|
-
}
|
|
22
13
|
/**
|
|
23
14
|
* Gets documents IDs
|
|
24
15
|
*/
|
|
@@ -33,6 +24,15 @@ class ObservedDocuments extends Set {
|
|
|
33
24
|
ids: { values: Array.from(this.values()) },
|
|
34
25
|
};
|
|
35
26
|
}
|
|
27
|
+
constructor(index, collection) {
|
|
28
|
+
super();
|
|
29
|
+
/**
|
|
30
|
+
* Room ID for the realtime subscription on the collection of observed documents
|
|
31
|
+
*/
|
|
32
|
+
this.roomId = null;
|
|
33
|
+
this.index = index;
|
|
34
|
+
this.collection = collection;
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Provide an Uniform Resource Locator given an index, a collection and a document
|
|
@@ -3,7 +3,7 @@ import { InstrumentablePromise } from "../InstrumentablePromise";
|
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type DocumentsBuffer = {
|
|
7
7
|
documents: Array<{
|
|
8
8
|
_id: string;
|
|
9
9
|
body: JSONObject;
|
|
@@ -18,7 +18,7 @@ export declare type DocumentsBuffer = {
|
|
|
18
18
|
*
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type IndexBuffer = Map<string, Map<string, DocumentsBuffer>>;
|
|
22
22
|
/**
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
@@ -16,22 +16,6 @@ const BatchBuffer_1 = require("./BatchBuffer");
|
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
18
|
class BatchWriter {
|
|
19
|
-
constructor(sdk, { interval = 10, maxWriteBufferSize = 200, maxReadBufferSize = 200 } = {}) {
|
|
20
|
-
// Buffers
|
|
21
|
-
this.buffers = {
|
|
22
|
-
create: new BatchBuffer_1.BatchBuffer(),
|
|
23
|
-
createOrReplace: new BatchBuffer_1.BatchBuffer(),
|
|
24
|
-
delete: new BatchBuffer_1.BatchBuffer(),
|
|
25
|
-
exists: new BatchBuffer_1.BatchBuffer(),
|
|
26
|
-
get: new BatchBuffer_1.BatchBuffer(),
|
|
27
|
-
replace: new BatchBuffer_1.BatchBuffer(),
|
|
28
|
-
update: new BatchBuffer_1.BatchBuffer(),
|
|
29
|
-
};
|
|
30
|
-
this.sdk = sdk;
|
|
31
|
-
this.interval = interval;
|
|
32
|
-
this.maxWriteBufferSize = maxWriteBufferSize;
|
|
33
|
-
this.maxReadBufferSize = maxReadBufferSize;
|
|
34
|
-
}
|
|
35
19
|
get addCreate() {
|
|
36
20
|
// @todo implements the send of buffer if approaching the limit
|
|
37
21
|
return this.buffers.create.add.bind(this.buffers.create);
|
|
@@ -54,6 +38,22 @@ class BatchWriter {
|
|
|
54
38
|
get addCreateOrReplace() {
|
|
55
39
|
return this.buffers.createOrReplace.add.bind(this.buffers.createOrReplace);
|
|
56
40
|
}
|
|
41
|
+
constructor(sdk, { interval = 10, maxWriteBufferSize = 200, maxReadBufferSize = 200 } = {}) {
|
|
42
|
+
// Buffers
|
|
43
|
+
this.buffers = {
|
|
44
|
+
create: new BatchBuffer_1.BatchBuffer(),
|
|
45
|
+
createOrReplace: new BatchBuffer_1.BatchBuffer(),
|
|
46
|
+
delete: new BatchBuffer_1.BatchBuffer(),
|
|
47
|
+
exists: new BatchBuffer_1.BatchBuffer(),
|
|
48
|
+
get: new BatchBuffer_1.BatchBuffer(),
|
|
49
|
+
replace: new BatchBuffer_1.BatchBuffer(),
|
|
50
|
+
update: new BatchBuffer_1.BatchBuffer(),
|
|
51
|
+
};
|
|
52
|
+
this.sdk = sdk;
|
|
53
|
+
this.interval = interval;
|
|
54
|
+
this.maxWriteBufferSize = maxWriteBufferSize;
|
|
55
|
+
this.maxReadBufferSize = maxReadBufferSize;
|
|
56
|
+
}
|
|
57
57
|
/**
|
|
58
58
|
* Execute API actions with documents stored in the buffers.
|
|
59
59
|
*/
|
|
@@ -6,6 +6,9 @@ const uuidv4_1 = require("../../utils/uuidv4");
|
|
|
6
6
|
const KuzzleEventEmitter_1 = require("../../core/KuzzleEventEmitter");
|
|
7
7
|
const PendingRequest_1 = require("./PendingRequest");
|
|
8
8
|
class KuzzleAbstractProtocol extends KuzzleEventEmitter_1.KuzzleEventEmitter {
|
|
9
|
+
get sslConnection() {
|
|
10
|
+
return this._ssl;
|
|
11
|
+
}
|
|
9
12
|
constructor(host, options = {}, name = undefined) {
|
|
10
13
|
super();
|
|
11
14
|
this._pendingRequests = new Map();
|
|
@@ -38,9 +41,6 @@ class KuzzleAbstractProtocol extends KuzzleEventEmitter_1.KuzzleEventEmitter {
|
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
}
|
|
41
|
-
get sslConnection() {
|
|
42
|
-
return this._ssl;
|
|
43
|
-
}
|
|
44
44
|
/**
|
|
45
45
|
* Kuzzle server host or IP.
|
|
46
46
|
*/
|
package/src/types/ApiKey.d.ts
CHANGED
package/src/types/KDocument.d.ts
CHANGED
|
@@ -56,4 +56,14 @@ export interface KHit<TKDocumentContent extends KDocumentContent> extends KDocum
|
|
|
56
56
|
* Elasticsearch relevance score
|
|
57
57
|
*/
|
|
58
58
|
_score: number;
|
|
59
|
+
/**
|
|
60
|
+
* Document index
|
|
61
|
+
* Present only in the case of a multi search
|
|
62
|
+
*/
|
|
63
|
+
index?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Document collection
|
|
66
|
+
* Present only in the case of a multi search
|
|
67
|
+
*/
|
|
68
|
+
collection?: string;
|
|
59
69
|
}
|
package/src/types/Mappings.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSONObject } from "./JSONObject";
|
|
2
|
-
|
|
2
|
+
type PropertyObject = {
|
|
3
3
|
properties?: MappingsProperties;
|
|
4
4
|
};
|
|
5
|
-
|
|
5
|
+
type PropertyDynamic = {
|
|
6
6
|
/**
|
|
7
7
|
* Dynamic mapping policy
|
|
8
8
|
*
|
|
@@ -10,12 +10,12 @@ declare type PropertyDynamic = {
|
|
|
10
10
|
*/
|
|
11
11
|
dynamic?: "true" | "false" | "strict";
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type PropertyType = {
|
|
14
14
|
[name: string]: {
|
|
15
15
|
type?: string;
|
|
16
16
|
} | PropertyObject | JSONObject;
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type MappingsProperties = PropertyObject | PropertyDynamic | PropertyType;
|
|
19
19
|
/**
|
|
20
20
|
* Collection mappings definition
|
|
21
21
|
*
|
|
@@ -35,7 +35,7 @@ export declare type MappingsProperties = PropertyObject | PropertyDynamic | Prop
|
|
|
35
35
|
* }
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
|
-
export
|
|
38
|
+
export type CollectionMappings = {
|
|
39
39
|
/**
|
|
40
40
|
* Collection metadata
|
|
41
41
|
*
|
|
@@ -3,7 +3,7 @@ import { KDocument, KDocumentContentGeneric } from ".";
|
|
|
3
3
|
/**
|
|
4
4
|
* Enum for notification types
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type NotificationType = "document" | "user" | "TokenExpired";
|
|
7
7
|
export interface BaseNotification {
|
|
8
8
|
/**
|
|
9
9
|
* Notification type
|
|
@@ -92,4 +92,4 @@ export interface ServerNotification extends BaseNotification {
|
|
|
92
92
|
/**
|
|
93
93
|
* Real-time notifications sent by Kuzzle.
|
|
94
94
|
*/
|
|
95
|
-
export
|
|
95
|
+
export type Notification = DocumentNotification | UserNotification | ServerNotification;
|
package/src/types/mRequests.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KDocumentContentGeneric } from "./KDocument";
|
|
2
|
-
export
|
|
2
|
+
export type mCreateRequest<TKDocumentContent extends KDocumentContentGeneric> = Array<{
|
|
3
3
|
/**
|
|
4
4
|
* Document unique identifier
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ export declare type mCreateRequest<TKDocumentContent extends KDocumentContentGen
|
|
|
9
9
|
*/
|
|
10
10
|
body: Partial<TKDocumentContent>;
|
|
11
11
|
}>;
|
|
12
|
-
export
|
|
12
|
+
export type mCreateOrReplaceRequest<TKDocumentContent extends KDocumentContentGeneric> = Array<{
|
|
13
13
|
/**
|
|
14
14
|
* Document unique identifier
|
|
15
15
|
*/
|
|
@@ -19,9 +19,9 @@ export declare type mCreateOrReplaceRequest<TKDocumentContent extends KDocumentC
|
|
|
19
19
|
*/
|
|
20
20
|
body: Partial<TKDocumentContent>;
|
|
21
21
|
}>;
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
22
|
+
export type mReplaceRequest<TKDocumentContent extends KDocumentContentGeneric> = mCreateOrReplaceRequest<TKDocumentContent>;
|
|
23
|
+
export type mUpdateRequest<TKDocumentContent extends KDocumentContentGeneric> = mCreateOrReplaceRequest<TKDocumentContent>;
|
|
24
|
+
export type mUpsertRequest<TKDocumentContent extends KDocumentContentGeneric> = Array<{
|
|
25
25
|
/**
|
|
26
26
|
* Document unique identifier
|
|
27
27
|
*/
|
|
@@ -35,4 +35,4 @@ export declare type mUpsertRequest<TKDocumentContent extends KDocumentContentGen
|
|
|
35
35
|
*/
|
|
36
36
|
default?: Partial<TKDocumentContent>;
|
|
37
37
|
}>;
|
|
38
|
-
export
|
|
38
|
+
export type mDeleteRequest = string[];
|