@escapenavigator/services 1.10.113 → 1.10.115
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/api/cashboxes-api/query.d.ts +3 -3
- package/dist/api/locations-api/query.d.ts +3 -3
- package/dist/api/orders-api/fast-stat.d.ts +10 -1
- package/dist/api/orders-api/index.d.ts +2 -0
- package/dist/api/orders-api/index.js +2 -0
- package/dist/api/orders-api/query-light.d.ts +8 -0
- package/dist/api/orders-api/query-light.js +9 -0
- package/dist/api/questrooms-api/query.d.ts +3 -3
- package/dist/api/roles-api/query.d.ts +3 -3
- package/dist/api/tariffs-api/query.d.ts +3 -3
- package/dist/api/users-api/query.d.ts +3 -3
- package/dist/hooks/use-api-method/index.js +16 -5
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CashboxLightRO } from '@escapenavigator/types/dist/cashbox/cashbox-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = CashboxLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocationLightRO } from '@escapenavigator/types/dist/location/location-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = LocationLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { QueryDto } from '@escapenavigator/types/dist/shared/query.dto';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = QueryDto;
|
|
4
|
+
/**
|
|
5
|
+
* Бэк отдаёт уже сконвертированные в number значения (`paginateLight`
|
|
6
|
+
* / `fastStat` в `OrderService` приводят `getRawOne()`-строки к
|
|
7
|
+
* `Number(... ) || 0`) + эффективное окно после клампа 30 дней.
|
|
8
|
+
* Поле `addonsTotal` убрано: UI его не показывает и подзапрос-агрегат
|
|
9
|
+
* по `order-upsellings` мог материализоваться полностью на жирных
|
|
10
|
+
* профилях — см. `packages/api/docs/optimization/08-order-fast-stat.md`.
|
|
11
|
+
*/
|
|
4
12
|
type ResponseData = {
|
|
5
13
|
total: number;
|
|
6
14
|
happendAmountTotal: number;
|
|
7
15
|
happend: number;
|
|
8
16
|
cancelled: number;
|
|
9
|
-
|
|
17
|
+
periodFrom: string;
|
|
18
|
+
periodTo: string;
|
|
10
19
|
};
|
|
11
20
|
export declare const fastStat: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
12
21
|
export {};
|
|
@@ -14,6 +14,7 @@ import { getMetadata } from './metadata/get-metadata';
|
|
|
14
14
|
import { query } from './query';
|
|
15
15
|
import { queryAggregatorOrders } from './query-aggregator-orders';
|
|
16
16
|
import { queryAgregaotrOrder } from './query-agregator-orders';
|
|
17
|
+
import { queryLight } from './query-light';
|
|
17
18
|
import { remove } from './remove';
|
|
18
19
|
import { deleteTransaction } from './transactions/delete-transaction';
|
|
19
20
|
import { recoverTransaction } from './transactions/recover-transaction';
|
|
@@ -67,6 +68,7 @@ type ApiDeclaration = {
|
|
|
67
68
|
resendEmail: typeof resendEmail;
|
|
68
69
|
getOne: typeof getOne;
|
|
69
70
|
query: typeof query;
|
|
71
|
+
queryLight: typeof queryLight;
|
|
70
72
|
updateSlot: typeof updateSlot;
|
|
71
73
|
update: typeof update;
|
|
72
74
|
cancel: typeof cancel;
|
|
@@ -17,6 +17,7 @@ var get_metadata_1 = require("./metadata/get-metadata");
|
|
|
17
17
|
var query_1 = require("./query");
|
|
18
18
|
var query_aggregator_orders_1 = require("./query-aggregator-orders");
|
|
19
19
|
var query_agregator_orders_1 = require("./query-agregator-orders");
|
|
20
|
+
var query_light_1 = require("./query-light");
|
|
20
21
|
var remove_1 = require("./remove");
|
|
21
22
|
var delete_transaction_1 = require("./transactions/delete-transaction");
|
|
22
23
|
var recover_transaction_1 = require("./transactions/recover-transaction");
|
|
@@ -71,6 +72,7 @@ exports.ordersApiDeclaration = {
|
|
|
71
72
|
getCancelPreview: get_cancel_preview_1.getCancelPreview,
|
|
72
73
|
update: update_1.update,
|
|
73
74
|
query: query_1.query,
|
|
75
|
+
queryLight: query_light_1.queryLight,
|
|
74
76
|
getOne: get_one_1.getOne,
|
|
75
77
|
updateSlot: update_slot_1.updateSlot,
|
|
76
78
|
resendEmail: resend_email_1.resendEmail,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OrderLightRO } from '@escapenavigator/types/dist/order/order-light.ro';
|
|
2
|
+
import { QueryDto } from '@escapenavigator/types/dist/shared/query.dto';
|
|
3
|
+
import { QueryRO } from '@escapenavigator/types/dist/shared/query.ro';
|
|
4
|
+
import { ApiMethodDeclaration } from '..';
|
|
5
|
+
type ParamsData = QueryDto;
|
|
6
|
+
type ResponseData = QueryRO<OrderLightRO>;
|
|
7
|
+
export declare const queryLight: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QuestroomLightRO } from '@escapenavigator/types/dist/questroom/questroom-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = QuestroomLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RoleLightRO } from '@escapenavigator/types/dist/role/role-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = RoleLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TariffLightRO } from '@escapenavigator/types/dist/tariff/tariff-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = TariffLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UserLightRO } from '@escapenavigator/types/dist/user/crud/user-light.ro';
|
|
2
2
|
import { ApiMethodDeclaration } from '..';
|
|
3
3
|
type ParamsData = {
|
|
4
|
-
etag?:
|
|
4
|
+
etag?: string | null;
|
|
5
5
|
};
|
|
6
|
-
type ResponseData =
|
|
6
|
+
type ResponseData = UserLightRO[];
|
|
7
7
|
export declare const query: ApiMethodDeclaration<ParamsData, ResponseData>;
|
|
8
8
|
export {};
|
|
@@ -51,6 +51,17 @@ var useApiMethod = function (_a) {
|
|
|
51
51
|
var mounted = (0, react_1.useRef)(false);
|
|
52
52
|
var source = (0, react_1.useRef)(null);
|
|
53
53
|
var _c = (0, react_1.useReducer)((api_2.apiReducer), api_2.initialState), state = _c[0], dispatch = _c[1];
|
|
54
|
+
// КРИТИЧНО: коллбэки держим в ref, а не в deps useCallback. Иначе
|
|
55
|
+
// call-site вроде `useApiMethod({ api, successCallback: () => ... })`
|
|
56
|
+
// создаёт новую ссылку на колбэк каждый рендер → fetch меняет ссылку →
|
|
57
|
+
// консьюмер с useEffect([fetch]) попадает в бесконечный цикл
|
|
58
|
+
// (см. ERR_INSUFFICIENT_RESOURCES в проде на auth/login-questrooms).
|
|
59
|
+
// Ref всегда указывает на актуальную версию колбэка, при этом fetch —
|
|
60
|
+
// стабильная ссылка, безопасная для использования в deps хуков.
|
|
61
|
+
var successCallbackRef = (0, react_1.useRef)(successCallback);
|
|
62
|
+
var errorCallbackRef = (0, react_1.useRef)(errorCallback);
|
|
63
|
+
successCallbackRef.current = successCallback;
|
|
64
|
+
errorCallbackRef.current = errorCallback;
|
|
54
65
|
var fetch = (0, react_1.useCallback)(function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
66
|
var response, error_1, err;
|
|
56
67
|
var _a;
|
|
@@ -68,8 +79,8 @@ var useApiMethod = function (_a) {
|
|
|
68
79
|
})];
|
|
69
80
|
case 2:
|
|
70
81
|
response = _b.sent();
|
|
71
|
-
if (
|
|
72
|
-
|
|
82
|
+
if (successCallbackRef.current)
|
|
83
|
+
successCallbackRef.current(response, params);
|
|
73
84
|
dispatch((0, api_1.fetchSuccess)(response));
|
|
74
85
|
return [2 /*return*/, response];
|
|
75
86
|
case 3:
|
|
@@ -79,15 +90,15 @@ var useApiMethod = function (_a) {
|
|
|
79
90
|
if (!mounted.current)
|
|
80
91
|
return [2 /*return*/, null];
|
|
81
92
|
err = (0, get_service_error_1.getServiceError)(error_1);
|
|
82
|
-
if (
|
|
83
|
-
|
|
93
|
+
if (errorCallbackRef.current)
|
|
94
|
+
errorCallbackRef.current(err);
|
|
84
95
|
dispatch((0, api_1.fetchFailure)(err));
|
|
85
96
|
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
86
97
|
throw err;
|
|
87
98
|
case 4: return [2 /*return*/];
|
|
88
99
|
}
|
|
89
100
|
});
|
|
90
|
-
}); }, [api
|
|
101
|
+
}); }, [api]);
|
|
91
102
|
(0, react_1.useEffect)(function () {
|
|
92
103
|
mounted.current = true;
|
|
93
104
|
return function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@escapenavigator/services",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.115",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rm -rf dist && tsc --project tsconfig.json"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "1224f2af8858d8339e46d67041b7cbbce5dc7920",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@escapenavigator/types": "^1.10.
|
|
18
|
-
"@escapenavigator/utils": "^1.10.
|
|
17
|
+
"@escapenavigator/types": "^1.10.106",
|
|
18
|
+
"@escapenavigator/utils": "^1.10.110",
|
|
19
19
|
"axios": "^0.21.4",
|
|
20
20
|
"class-transformer": "^0.5.1",
|
|
21
21
|
"class-validator": "^0.13.2",
|