Skip to content

Commit 731b99f

Browse files
authored
Rename KuzzleRequest to RequestPayload (#565)
Rename KuzzleRequest and KuzzleResponse to RequestPayload and ResponsePayload Also move type definitions to types/ Those types are exactly the same as in Kuzzle.
1 parent 76f3e5b commit 731b99f

33 files changed

+565
-470
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ src/protocols/abstract/Realtime.js
1818
src/protocols/Http.js
1919
src/protocols/WebSocket.js
2020
src/protocols/index.js
21-
src/utils/interfaces.js
21+
src/types/*.js
2222
src/core/KuzzleEventEmitter.js
2323
src/core/searchResult/SearchResultBase.js
2424
src/core/searchResult/Document.js

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ src/protocols/abstract/Realtime.js
4646
src/protocols/Http.js
4747
src/protocols/WebSocket.js
4848
src/protocols/index.js
49-
src/utils/interfaces.js
49+
src/types/*.js
5050
src/core/KuzzleEventEmitter.js
5151
src/core/searchResult/SearchResultBase.js
5252
src/core/searchResult/Document.js

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export * from './src/core/searchResult/Role';
2020
export * from './src/core/searchResult/Specifications';
2121
export * from './src/core/searchResult/User';
2222

23-
export * from './src/utils/interfaces';
23+
export * from './src/types';
2424

2525
export * from './src/controllers/Auth';
2626
export * from './src/controllers/Base';

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kuzzle-sdk",
3-
"version": "7.4.3",
3+
"version": "7.4.4",
44
"description": "Official Javascript SDK for Kuzzle",
55
"author": "The Kuzzle Team <[email protected]>",
66
"repository": {

src/Kuzzle.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import { MemoryStorageController } from './controllers/MemoryStorage';
1313

1414
import { uuidv4 } from './utils/uuidv4';
1515
import { proxify } from './utils/proxify';
16-
import { JSONObject, KuzzleRequest, KuzzleResponse } from './utils/interfaces';
16+
import { JSONObject } from './types';
17+
import { RequestPayload } from './types/RequestPayload';
18+
import { ResponsePayload } from './types/ResponsePayload';
1719

1820
// Defined by webpack plugin
1921
declare const SDKVERSION: any;
@@ -132,7 +134,7 @@ export class Kuzzle extends KuzzleEventEmitter {
132134
* Custom function called during offline mode to filter
133135
* queued requests on-the-fly
134136
*/
135-
queueFilter?: (request: KuzzleRequest) => boolean;
137+
queueFilter?: (request: RequestPayload) => boolean;
136138
/**
137139
* Called before dequeuing requests after exiting offline mode,
138140
* to add items at the beginning of the offline queue
@@ -524,7 +526,7 @@ export class Kuzzle extends KuzzleEventEmitter {
524526
* @param request
525527
* @param options - Optional arguments
526528
*/
527-
query (request: KuzzleRequest = {}, options: JSONObject = {}): Promise<KuzzleResponse> {
529+
query (request: RequestPayload = {}, options: JSONObject = {}): Promise<ResponsePayload> {
528530
if (typeof request !== 'object' || Array.isArray(request)) {
529531
throw new Error(`Kuzzle.query: Invalid request: ${JSON.stringify(request)}`);
530532
}

src/KuzzleError.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export class KuzzleError extends Error {
4848
});
4949
}
5050

51+
if (stack) {
52+
this.stack = stack;
53+
}
54+
5155
this.id = apiError.id;
5256
this.code = apiError.code;
5357

src/controllers/Auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Jwt } from '../core/Jwt';
22
import { BaseController } from './Base';
33
import { User } from '../core/security/User';
4-
import { JSONObject, ApiKey } from '../utils/interfaces';
4+
import { JSONObject, ApiKey } from '../types';
55

66
/**
77
* Auth controller

src/controllers/Base.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { KuzzleRequest, JSONObject } from '../utils/interfaces';
1+
import { JSONObject } from '../types';
2+
import { RequestPayload } from '../types/RequestPayload';
23

34
export class BaseController {
45
private _name: string;
@@ -34,7 +35,7 @@ export class BaseController {
3435
* @param request
3536
* @param options
3637
*/
37-
query (request: KuzzleRequest = {}, options: any = {}): Promise<JSONObject> {
38+
query (request: RequestPayload = {}, options: any = {}): Promise<JSONObject> {
3839
request.controller = request.controller || this.name;
3940

4041
return this._kuzzle.query(request, options);

src/controllers/Collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BaseController } from './Base';
22
import { SpecificationsSearchResult } from '../core/searchResult/Specifications';
3-
import { CollectionMappings, JSONObject } from '../utils/interfaces';
3+
import { CollectionMappings, JSONObject } from '../types';
44

55
export class CollectionController extends BaseController {
66
constructor (kuzzle) {

0 commit comments

Comments
 (0)