flamerest 1.0.111 → 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.
Files changed (2) hide show
  1. package/REST.d.ts +22 -26
  2. 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<object>,
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
@@ -137,7 +137,7 @@ interface IREST {
137
137
  * @param password
138
138
  * @param name
139
139
  */
140
- signup(email: string | null, username: string | null, password: string, name: string | null, data: any, pushNotificationToken: object | null): Promise<Authorized>,
140
+ signup(email: string | null, username: string | null, password: string, name: string | null, pushNotificationToken: object | null, data: any): Promise<Authorized>,
141
141
 
142
142
 
143
143
  /**
@@ -198,30 +198,21 @@ interface IREST {
198
198
 
199
199
 
200
200
  /**
201
- * Стандартный ответ от Request с несколькими строками
201
+ * Базовый ответ от сервера
202
202
  */
203
- export type Rows<T> = {
203
+ export type BaseResponse<T> = {
204
204
  type: string,
205
205
  status: number,
206
206
  ok: boolean,
207
- data?: Array<T>,
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
- export type Row<T> = {
219
- type: string,
220
- status: number,
221
- ok: boolean,
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.111",
3
+ "version": "1.0.113",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",
7
7
  "scripts": {
8
- "push and publish": "git push && npm --no-git-tag-version version patch && npm publish"
8
+ "publish": "git push && npm --no-git-tag-version version patch && npm publish"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",