flamerest 1.0.112 → 1.0.113
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/REST.d.ts +21 -25
- package/package.json +2 -2
package/REST.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ interface IREST {
|
|
|
45
45
|
* @param {string} responseType Тип ответа: json или blob
|
|
46
46
|
* @param {Object} customHeaders объект с доп заголовками, которые надо включить в запрос
|
|
47
47
|
*/
|
|
48
|
-
request(url: string, params: object | string, type?: string, responseType?: 'json' | 'blob', isNeedToken?: boolean, customHeaders?: object): Promise<
|
|
48
|
+
request(url: string, params: object | string, type?: string, responseType?: 'json' | 'blob', isNeedToken?: boolean, customHeaders?: object): Promise<CustomAnyRequest | Rows<any> | Row<any>>,
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Получить выборку из таблицы через REST
|
|
@@ -198,30 +198,21 @@ interface IREST {
|
|
|
198
198
|
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
201
|
+
* Базовый ответ от сервера
|
|
202
202
|
*/
|
|
203
|
-
export type
|
|
203
|
+
export type BaseResponse<T> = {
|
|
204
204
|
type: string,
|
|
205
205
|
status: number,
|
|
206
206
|
ok: boolean,
|
|
207
|
-
data?:
|
|
207
|
+
data?: T,
|
|
208
208
|
errors: object | undefined,
|
|
209
209
|
message: string | undefined,
|
|
210
|
-
pages: {
|
|
211
|
-
page: number,
|
|
212
|
-
perPage: number,
|
|
213
|
-
count: number,
|
|
214
|
-
total: number,
|
|
215
|
-
}
|
|
216
210
|
}
|
|
217
211
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
data?: T,
|
|
223
|
-
errors: object | undefined,
|
|
224
|
-
message: string | undefined,
|
|
212
|
+
/**
|
|
213
|
+
* Часть ответа с пагинацией
|
|
214
|
+
*/
|
|
215
|
+
export type Paginated = {
|
|
225
216
|
pages: {
|
|
226
217
|
page: number,
|
|
227
218
|
perPage: number,
|
|
@@ -230,17 +221,22 @@ export type Row<T> = {
|
|
|
230
221
|
}
|
|
231
222
|
}
|
|
232
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Стандартный ответ от Request с несколькими строками
|
|
226
|
+
*/
|
|
227
|
+
export type Rows<T> = BaseResponse<Array<T>> & Paginated;
|
|
228
|
+
|
|
229
|
+
export type Row<T> = BaseResponse<T> & Paginated;
|
|
230
|
+
|
|
231
|
+
export type CustomRequest<T> = BaseResponse<T>;
|
|
232
|
+
|
|
233
|
+
export type CustomAnyRequest = BaseResponse<any>;
|
|
234
|
+
|
|
235
|
+
|
|
233
236
|
/**
|
|
234
237
|
* Стандартный ответ от Request с изменённой строкой
|
|
235
238
|
*/
|
|
236
|
-
export type SavedObject<T> =
|
|
237
|
-
type: string,
|
|
238
|
-
status: Number,
|
|
239
|
-
ok: boolean,
|
|
240
|
-
data?: T,
|
|
241
|
-
errors: Object | undefined,
|
|
242
|
-
message: string | undefined,
|
|
243
|
-
}
|
|
239
|
+
export type SavedObject<T> = BaseResponse<T>;
|
|
244
240
|
|
|
245
241
|
/**
|
|
246
242
|
* Результат авторизации
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flamerest",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.113",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "REST.js",
|
|
6
6
|
"typings": "./REST.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"publish": "git push && npm --no-git-tag-version version patch && npm publish"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|