@ryuzaki13/react-foundation-api 1.1.9 → 1.1.11
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/odata/index.d.ts +0 -1
- package/dist/odata/index.d.ts.map +1 -1
- package/dist/odata/index.js +88 -96
- package/dist/odata/index.js.map +1 -1
- package/package.json +3 -1
- package/src/README.md +937 -0
- package/src/async/README.md +623 -0
- package/src/async/async.mdx +6 -0
- package/src/odata/README.md +761 -0
- package/src/odata/odataFetchFn.mdx +6 -0
- package/src/persisted/README.md +598 -0
- package/src/persisted/persisted.mdx +6 -0
- package/dist/odata/useTextServiceQuery.d.ts +0 -3
- package/dist/odata/useTextServiceQuery.d.ts.map +0 -1
package/dist/odata/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export * from "./useODataEntity";
|
|
|
14
14
|
export * from "./useODataMetadata";
|
|
15
15
|
export * from "./useODataMetadataQuery";
|
|
16
16
|
export * from "./useODataTableColumns";
|
|
17
|
-
export * from "./useTextServiceQuery";
|
|
18
17
|
export { odataFetch, type ODataFetchOptions } from "./odataFetch";
|
|
19
18
|
export { odataCreateFn, odataDeleteFn, odataFunctionImportFn, odataQueryFn, odataReadFn, odataUpdateFn, type ODataFetchFnRequest } from "./odataFetchFn";
|
|
20
19
|
export { odataCreateFnDev, odataDeleteFnDev, odataFunctionImportFnDev, odataQueryFnDev, odataReadFnDev, odataUpdateFnDev } from "./odataFetchFnDev";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/odata/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/odata/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EACN,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,KAAK,mBAAmB,EACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,gBAAgB,EAChB,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,MAAM,mBAAmB,CAAC"}
|
package/dist/odata/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as
|
|
2
|
-
import { S as
|
|
3
|
-
import { logError as
|
|
4
|
-
import { parseDate as
|
|
5
|
-
import { compareStrings as
|
|
6
|
-
import { useCallback as
|
|
7
|
-
import { queryOptions as
|
|
8
|
-
import { buildSeparatedArrays as
|
|
9
|
-
import { persistedQueryMeta as
|
|
10
|
-
import { buildEntityPath as
|
|
11
|
-
import { createTableColumnVisibilityFromODataMetadata as
|
|
12
|
-
import { notify as
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as d, m as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as C } from "../chunks/fetch-PmN9NBra.js";
|
|
2
|
+
import { S as ee, _ as te, a as ne, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as w, s as he, t as ge, u as _e, v as T, x as E, y as ve } from "../chunks/odataFetchFn-CzhXMYXj.js";
|
|
3
|
+
import { logError as ye } from "@ryuzaki13/react-foundation-lib/utils";
|
|
4
|
+
import { parseDate as be } from "@ryuzaki13/react-foundation-lib/formatters";
|
|
5
|
+
import { compareStrings as xe } from "@ryuzaki13/react-foundation-lib/string-comparison";
|
|
6
|
+
import { useCallback as D, useEffect as Se, useMemo as O, useRef as Ce, useState as k } from "react";
|
|
7
|
+
import { queryOptions as we, useQuery as A, useQueryClient as j } from "@tanstack/react-query";
|
|
8
|
+
import { buildSeparatedArrays as Te, useODataCollectionStore as Ee } from "@ryuzaki13/react-foundation-lib/odata";
|
|
9
|
+
import { persistedQueryMeta as M } from "@ryuzaki13/react-foundation-lib/query-client";
|
|
10
|
+
import { buildEntityPath as De } from "@ryuzaki13/react-foundation-lib/odata-service";
|
|
11
|
+
import { createTableColumnVisibilityFromODataMetadata as N, createTableColumnsFromODataMetadata as Oe, enrichTableColumnsWithODataFormatting as ke, resolveStableColumnId as Ae } from "@ryuzaki13/react-foundation-lib/table";
|
|
12
|
+
import { notify as je } from "@ryuzaki13/react-foundation-lib/notifications";
|
|
13
13
|
//#region src/odata/createODataCollectionQueryKey.ts
|
|
14
|
-
var
|
|
14
|
+
var Me = () => [...ee, "collection"], P = ({ service: e, target: t, limitedKeys: n, serverFilter: r }) => [...Me(), {
|
|
15
15
|
service: e,
|
|
16
16
|
target: t,
|
|
17
17
|
limitedKeys: n,
|
|
@@ -88,7 +88,7 @@ function Ie(e, t, n) {
|
|
|
88
88
|
if (!n?.length) return e;
|
|
89
89
|
let r = new Map(n.map((e, t) => [e.codeKey, t])), i = Object.entries(e.segments).sort(([e], [t]) => {
|
|
90
90
|
let n = r.get(e), i = r.get(t);
|
|
91
|
-
return n !== void 0 && i !== void 0 ? n - i : n === void 0 ? i === void 0 ?
|
|
91
|
+
return n !== void 0 && i !== void 0 ? n - i : n === void 0 ? i === void 0 ? xe(e, t) : 1 : -1;
|
|
92
92
|
});
|
|
93
93
|
return {
|
|
94
94
|
...e,
|
|
@@ -101,24 +101,24 @@ function Ie(e, t, n) {
|
|
|
101
101
|
async function Le(e) {
|
|
102
102
|
let { url: t, query: n, signal: r } = e;
|
|
103
103
|
try {
|
|
104
|
-
let e = await
|
|
104
|
+
let e = await E(t, n, { signal: r });
|
|
105
105
|
if (a(e)) throw Error("отсутствует тело ответа");
|
|
106
106
|
return { items: e.data.map(({ ID: e, CNT: t, __metadata: n, __Parameters: r, ...i }) => i) };
|
|
107
107
|
} catch (e) {
|
|
108
|
-
return
|
|
108
|
+
return ye("Ошибка загрузки справочника:", e), { items: [] };
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
//#endregion
|
|
112
112
|
//#region src/odata/useODataCollectionUpdatesQuery.ts
|
|
113
113
|
var Re = __APP_BUILD_ID__, ze = 1e3 * 60 * 60 * 4, F = 1e3 * 60 * 60 * 24 * 7, I = "ttl=forever;name=ref", L = "bust=forever;name=ref", R = "ttl=4h;name=ref-updates", z = () => [
|
|
114
|
-
...
|
|
114
|
+
...ee,
|
|
115
115
|
"collection-updates",
|
|
116
116
|
{ buildId: Re }
|
|
117
117
|
];
|
|
118
118
|
function Be(e) {
|
|
119
119
|
return {
|
|
120
120
|
...e,
|
|
121
|
-
lastChangedAt:
|
|
121
|
+
lastChangedAt: be(e.lastChanged)
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
function B(e, t) {
|
|
@@ -132,27 +132,27 @@ function B(e, t) {
|
|
|
132
132
|
}
|
|
133
133
|
function V() {
|
|
134
134
|
return async ({ signal: t }) => {
|
|
135
|
-
let n = Date.now(), r =
|
|
136
|
-
return r ? B((await
|
|
135
|
+
let n = Date.now(), r = S().collectionUpdates;
|
|
136
|
+
return r ? B((await E(`/${r.service}/${r.target}`, {
|
|
137
137
|
baseUrl: e(r.service, r.baseUrl),
|
|
138
138
|
swCache: R
|
|
139
139
|
}, { signal: t })).data, Math.max(n, Date.now())) : B([], n);
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
var H = (e = {}) =>
|
|
142
|
+
var H = (e = {}) => we({
|
|
143
143
|
queryKey: z(),
|
|
144
144
|
queryFn: V(),
|
|
145
|
-
meta:
|
|
145
|
+
meta: M,
|
|
146
146
|
staleTime: e.staleTime ?? ze,
|
|
147
147
|
gcTime: Infinity
|
|
148
148
|
});
|
|
149
149
|
function U(e = {}) {
|
|
150
|
-
return
|
|
150
|
+
return A(H(e));
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/odata/useODataMetadata.ts
|
|
154
154
|
function W(e) {
|
|
155
|
-
let { data: t, dataUpdatedAt: n = 0, isLoading: r, isLoadingError: i } =
|
|
155
|
+
let { data: t, dataUpdatedAt: n = 0, isLoading: r, isLoadingError: i } = T({ service: e.service }), a = t?.entities[e.target];
|
|
156
156
|
if (!r && !a && t?.functionImports[e.target]) throw Error(`OData target '${e.target}' является FunctionImport и не может использоваться как сущность`);
|
|
157
157
|
if (i) throw Error(`Ошибка загрузки метаданных сервиса ${e.service}`);
|
|
158
158
|
return {
|
|
@@ -171,10 +171,10 @@ function K(e) {
|
|
|
171
171
|
metadata: t,
|
|
172
172
|
metadataUpdatedAt: n,
|
|
173
173
|
isLoading: r,
|
|
174
|
-
actions:
|
|
174
|
+
actions: O(() => ({
|
|
175
175
|
getEntityPath: (n = {}) => {
|
|
176
176
|
if (!t) throw Error(G);
|
|
177
|
-
return
|
|
177
|
+
return De(t, e, n);
|
|
178
178
|
},
|
|
179
179
|
getKeys: () => {
|
|
180
180
|
if (!t) throw Error(G);
|
|
@@ -211,7 +211,7 @@ function Y(e, t) {
|
|
|
211
211
|
return !!(J(r) && (!t || !n || r > n) || J(e.metadataUpdatedAt) && (!t || !n || e.metadataUpdatedAt > n) || J(e.updatesCoverageStartedAt) && (!t || !n || n < e.updatesCoverageStartedAt));
|
|
212
212
|
}
|
|
213
213
|
function X(e) {
|
|
214
|
-
let { service: t, target: n, limitedKeys: r, excludeEmpty: i, sortByCode: a, serverFilter: o, clientFilter: s, swCache: c = I } = e, l =
|
|
214
|
+
let { service: t, target: n, limitedKeys: r, excludeEmpty: i, sortByCode: a, serverFilter: o, clientFilter: s, swCache: c = I } = e, l = j(), { actions: u, metadata: d, metadataUpdatedAt: f, isLoading: p } = K(e), m = U(), h = O(() => P({
|
|
215
215
|
service: t,
|
|
216
216
|
target: n,
|
|
217
217
|
limitedKeys: r,
|
|
@@ -226,14 +226,14 @@ function X(e) {
|
|
|
226
226
|
metadataUpdatedAt: f,
|
|
227
227
|
updatesCoverageStartedAt: m.data?.coverageStartedAt
|
|
228
228
|
}, g), y = q(c, v), b = m.isError || m.isSuccess && !m.isFetching;
|
|
229
|
-
return
|
|
229
|
+
return Se(() => {
|
|
230
230
|
!g || !v || l.invalidateQueries({ queryKey: h });
|
|
231
231
|
}, [
|
|
232
232
|
g,
|
|
233
233
|
l,
|
|
234
234
|
h,
|
|
235
235
|
v
|
|
236
|
-
]),
|
|
236
|
+
]), A({
|
|
237
237
|
queryKey: h,
|
|
238
238
|
queryFn: async ({ signal: e }) => {
|
|
239
239
|
let c = Date.now(), l = r ? [...r] : u.getKeys(), d = u.getKeyPairs(), p = u.getKeyPairsMap();
|
|
@@ -251,7 +251,7 @@ function X(e) {
|
|
|
251
251
|
signal: e
|
|
252
252
|
}), h = m;
|
|
253
253
|
s && (h = m.filter(s));
|
|
254
|
-
let g =
|
|
254
|
+
let g = Te(h, d, i, a), v = d.map((e) => ({
|
|
255
255
|
codeKey: e.codeKey,
|
|
256
256
|
count: g[e.codeKey].length
|
|
257
257
|
})).sort((e, t) => e.count - t.count);
|
|
@@ -266,7 +266,7 @@ function X(e) {
|
|
|
266
266
|
};
|
|
267
267
|
},
|
|
268
268
|
enabled: !!(!p && d && t && n && b),
|
|
269
|
-
meta:
|
|
269
|
+
meta: M,
|
|
270
270
|
staleTime: 1e3 * 60 * 60 * 2,
|
|
271
271
|
gcTime: 1e3 * 60 * 60 * 1
|
|
272
272
|
});
|
|
@@ -274,7 +274,7 @@ function X(e) {
|
|
|
274
274
|
//#endregion
|
|
275
275
|
//#region src/odata/useODataCollection.ts
|
|
276
276
|
function Ve({ odata: e, model: t, pageSize: n = 50 }) {
|
|
277
|
-
let { codeKey: r, maxVisibleItems: i } = t, { data: a, isLoading: o, isError: s, refetch: c } = X(e), l = a?.keyPairsMap[r] ?? "", u =
|
|
277
|
+
let { codeKey: r, maxVisibleItems: i } = t, { data: a, isLoading: o, isError: s, refetch: c } = X(e), l = a?.keyPairsMap[r] ?? "", u = j(), [d, f] = k(), p = Ce(/* @__PURE__ */ new Map()), { itemsMap: m, separatedItems: h, orderedKeys: g } = O(() => {
|
|
278
278
|
let e = /* @__PURE__ */ new Map(), t = [], n = [];
|
|
279
279
|
if (a && a.separated[r]) {
|
|
280
280
|
n = a.separated[r];
|
|
@@ -288,7 +288,7 @@ function Ve({ odata: e, model: t, pageSize: n = 50 }) {
|
|
|
288
288
|
separatedItems: n,
|
|
289
289
|
orderedKeys: t
|
|
290
290
|
};
|
|
291
|
-
}, [a, r]), _ =
|
|
291
|
+
}, [a, r]), _ = D((e) => {
|
|
292
292
|
let t = a?.separated[r];
|
|
293
293
|
if (!t) return /* @__PURE__ */ new Map();
|
|
294
294
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -300,11 +300,11 @@ function Ve({ odata: e, model: t, pageSize: n = 50 }) {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
return n;
|
|
303
|
-
}, [a, r]), v =
|
|
303
|
+
}, [a, r]), v = D((e) => {
|
|
304
304
|
f(() => {
|
|
305
305
|
if (e?.length) return new Set(e.map((e) => e[r]));
|
|
306
306
|
});
|
|
307
|
-
}, [r]), y =
|
|
307
|
+
}, [r]), y = D((e, t) => {
|
|
308
308
|
if (!g.length) return [];
|
|
309
309
|
let n = i, a = /* @__PURE__ */ new Set(), o = [];
|
|
310
310
|
if (t?.length) for (let e = 0; e < t.length; e++) a.add(t[e][r]);
|
|
@@ -324,39 +324,39 @@ function Ve({ odata: e, model: t, pageSize: n = 50 }) {
|
|
|
324
324
|
m,
|
|
325
325
|
d,
|
|
326
326
|
l
|
|
327
|
-
]), b =
|
|
327
|
+
]), b = D((e) => {
|
|
328
328
|
let t = a?.separated[r] || [], i = e * n, o = i + n;
|
|
329
329
|
return t.slice(i, o);
|
|
330
330
|
}, [
|
|
331
331
|
a,
|
|
332
332
|
n,
|
|
333
333
|
r
|
|
334
|
-
]),
|
|
334
|
+
]), x = D((e, t) => {
|
|
335
335
|
if (!a) return [];
|
|
336
336
|
let n = new Set(t);
|
|
337
337
|
return a.items.filter((t) => n.has(t[e]));
|
|
338
|
-
}, [a]),
|
|
338
|
+
}, [a]), S = D((e, t, n = 200) => {
|
|
339
339
|
p.current.has(e) && clearTimeout(p.current.get(e));
|
|
340
340
|
let r = setTimeout(t, n);
|
|
341
341
|
p.current.set(e, r);
|
|
342
|
-
}, []),
|
|
342
|
+
}, []), C = D(() => {
|
|
343
343
|
for (let e of p.current.values()) clearTimeout(e);
|
|
344
344
|
p.current.clear();
|
|
345
345
|
}, []);
|
|
346
|
-
return
|
|
347
|
-
|
|
348
|
-
}, [
|
|
346
|
+
return O(() => () => {
|
|
347
|
+
C();
|
|
348
|
+
}, [C]), {
|
|
349
349
|
data: a,
|
|
350
350
|
isLoading: o,
|
|
351
351
|
isError: s,
|
|
352
352
|
codeKey: r,
|
|
353
353
|
textKey: l,
|
|
354
354
|
getItems: y,
|
|
355
|
-
findSourceItemsByKeys:
|
|
355
|
+
findSourceItemsByKeys: x,
|
|
356
356
|
setFilteredItems: v,
|
|
357
357
|
getPage: b,
|
|
358
358
|
buildSearchIndex: _,
|
|
359
|
-
debounce:
|
|
359
|
+
debounce: S,
|
|
360
360
|
itemsMap: m,
|
|
361
361
|
separatedItems: h,
|
|
362
362
|
orderedKeys: g,
|
|
@@ -369,8 +369,8 @@ function Ve({ odata: e, model: t, pageSize: n = 50 }) {
|
|
|
369
369
|
//#endregion
|
|
370
370
|
//#region src/odata/useODataCollectionChains.ts
|
|
371
371
|
function He(e) {
|
|
372
|
-
let t =
|
|
373
|
-
return
|
|
372
|
+
let t = j(), [n, r] = k({}), i = O(() => e.map((e) => P(e)), [e]);
|
|
373
|
+
return Se(() => {
|
|
374
374
|
function n() {
|
|
375
375
|
let n = {};
|
|
376
376
|
for (let r of e) {
|
|
@@ -394,8 +394,8 @@ function He(e) {
|
|
|
394
394
|
//#endregion
|
|
395
395
|
//#region src/odata/useODataCollectionModel.ts
|
|
396
396
|
function Ue(e) {
|
|
397
|
-
let [t] =
|
|
398
|
-
let t =
|
|
397
|
+
let [t] = k(() => {
|
|
398
|
+
let t = Ee.getState(), { codeKey: n, maxVisibleItems: r = t.defaultMaxVisibleItems, minSearchCodeLength: i = t.defaultMinSearchCodeLength, minSearchTextLength: a = t.defaultMinSearchTextLength, searchDebounceDelay: o = t.defaultSearchDebounceDelay } = e;
|
|
399
399
|
return {
|
|
400
400
|
codeKey: n,
|
|
401
401
|
maxVisibleItems: r,
|
|
@@ -415,7 +415,7 @@ function We(e, t) {
|
|
|
415
415
|
r(i.columns);
|
|
416
416
|
continue;
|
|
417
417
|
}
|
|
418
|
-
let e =
|
|
418
|
+
let e = Ae(i);
|
|
419
419
|
!e || !(e in t) || (n[e] = t[e]);
|
|
420
420
|
}
|
|
421
421
|
};
|
|
@@ -424,14 +424,14 @@ function We(e, t) {
|
|
|
424
424
|
function Ge(e) {
|
|
425
425
|
let { metadata: t, isLoading: n } = W(e);
|
|
426
426
|
return {
|
|
427
|
-
columns:
|
|
427
|
+
columns: O(() => t ? e.mode === "build" ? Oe(t.columns, {
|
|
428
428
|
resolveHeader: e.resolveHeader,
|
|
429
429
|
resolveFormatting: e.resolveFormatting
|
|
430
|
-
}) :
|
|
431
|
-
defaultColumnVisibility:
|
|
430
|
+
}) : ke(e.columns, t.columns) : e.mode === "build" ? [] : [...e.columns], [e, t]),
|
|
431
|
+
defaultColumnVisibility: O(() => {
|
|
432
432
|
if (!t) return;
|
|
433
|
-
if (e.mode === "build") return
|
|
434
|
-
let n =
|
|
433
|
+
if (e.mode === "build") return N(t.columns, { resolveVisible: e.resolveVisible });
|
|
434
|
+
let n = N(t.columns);
|
|
435
435
|
return We(e.columns, n);
|
|
436
436
|
}, [e, t]),
|
|
437
437
|
metadata: t,
|
|
@@ -439,25 +439,17 @@ function Ge(e) {
|
|
|
439
439
|
};
|
|
440
440
|
}
|
|
441
441
|
//#endregion
|
|
442
|
-
//#region src/odata/useTextServiceQuery.ts
|
|
443
|
-
function Ke(e) {
|
|
444
|
-
return X({
|
|
445
|
-
service: "TEXT_DICTIONARY_SRV",
|
|
446
|
-
target: e
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
//#endregion
|
|
450
442
|
//#region src/odata/odataFetchFnDev.ts
|
|
451
|
-
function
|
|
443
|
+
function Ke() {
|
|
452
444
|
return globalThis.console;
|
|
453
445
|
}
|
|
454
|
-
function
|
|
446
|
+
function qe(e) {
|
|
455
447
|
let t = {};
|
|
456
448
|
return new Headers(e).forEach((e, n) => {
|
|
457
449
|
t[n] = e;
|
|
458
450
|
}), t;
|
|
459
451
|
}
|
|
460
|
-
function
|
|
452
|
+
function Je(e) {
|
|
461
453
|
if (e != null) {
|
|
462
454
|
if (typeof e != "string") return e;
|
|
463
455
|
try {
|
|
@@ -467,32 +459,32 @@ function Ye(e) {
|
|
|
467
459
|
}
|
|
468
460
|
}
|
|
469
461
|
}
|
|
470
|
-
function
|
|
462
|
+
function Ye(e) {
|
|
471
463
|
return e !== void 0 && !["GET", "HEAD"].includes(e.toUpperCase());
|
|
472
464
|
}
|
|
473
|
-
function
|
|
465
|
+
function Xe(e) {
|
|
474
466
|
return (e.baseUrl ?? "odata") !== "" || e.path.startsWith("/sap/") || e.path.startsWith("/sap-dp0/");
|
|
475
467
|
}
|
|
476
|
-
function
|
|
468
|
+
function Ze(e, t) {
|
|
477
469
|
let n = t.toLowerCase();
|
|
478
470
|
return Object.keys(e).some((e) => e.toLowerCase() === n);
|
|
479
471
|
}
|
|
480
472
|
function Z(e, t, n) {
|
|
481
|
-
|
|
473
|
+
Ze(e, t) || (e[t] = n);
|
|
482
474
|
}
|
|
483
|
-
function
|
|
484
|
-
let t =
|
|
485
|
-
return Z(t, "DataServiceVersion", "2.0"), Z(t, "MaxDataServiceVersion", "2.0"), Z(t, "Accept", "application/json"), t["sap-language"] = "ru", r && (t["sap-contextid-accept"] = "header"),
|
|
475
|
+
function Qe(e) {
|
|
476
|
+
let t = qe(e.init.headers), n = e.init.method, r = Xe(e);
|
|
477
|
+
return Z(t, "DataServiceVersion", "2.0"), Z(t, "MaxDataServiceVersion", "2.0"), Z(t, "Accept", "application/json"), t["sap-language"] = "ru", r && (t["sap-contextid-accept"] = "header"), Ye(n) && e.init.body && Z(t, "Content-Type", "application/json"), Ye(n) && r && Z(t, "x-csrf-token", "<получается отдельным GET перед реальным write-запросом>"), t;
|
|
486
478
|
}
|
|
487
|
-
function
|
|
488
|
-
return
|
|
479
|
+
function $e(e) {
|
|
480
|
+
return ue(e) ? "FunctionImport" : e.result ? "Parameterized Entity" : "Entity";
|
|
489
481
|
}
|
|
490
482
|
function Q(e, t) {
|
|
491
|
-
let n =
|
|
483
|
+
let n = Ke();
|
|
492
484
|
n.groupCollapsed(e), n.info(t), n.groupEnd();
|
|
493
485
|
}
|
|
494
|
-
function
|
|
495
|
-
let t =
|
|
486
|
+
function et(e) {
|
|
487
|
+
let t = Ke(), n = Je(e.request.init.body), r = qe(e.request.init.headers), i = Qe(e.request), a = {
|
|
496
488
|
method: e.request.init.method,
|
|
497
489
|
headers: r,
|
|
498
490
|
body: n,
|
|
@@ -502,7 +494,7 @@ function tt(e) {
|
|
|
502
494
|
helper: e.helperName,
|
|
503
495
|
operation: e.operation,
|
|
504
496
|
target: e.odata.target,
|
|
505
|
-
targetKind:
|
|
497
|
+
targetKind: $e(e.target),
|
|
506
498
|
service: e.odata.service,
|
|
507
499
|
realFetch: "не выполнялся"
|
|
508
500
|
}]), t.info("Итоговый URL:", e.request.fullUrl), t.info("Path без base URL:", e.request.path), t.info("Target path до query options:", e.targetPath), t.info("Query string:", e.request.queryString || "<пусто>"), t.info("Body:", n ?? "<пусто>"), t.info("Auto parse:", e.autoParse ?? !1), t.info("Transform:", e.hasTransform ? "передан, но не вызывается без ответа backend" : "не передан"), t.info("Dry-run result:", e.operation === "query" ? {
|
|
@@ -510,34 +502,34 @@ function tt(e) {
|
|
|
510
502
|
totalCount: 0
|
|
511
503
|
} : { data: void 0 }), Q("OData config", e.odata), Q("Target metadata", e.target), Q("Target params", e.params), Q("Query options", e.queryOptions), Q("RequestInit, переданный в transport", a), Q("Заголовки после transport defaults (без реального fetch)", i), t.groupEnd();
|
|
512
504
|
}
|
|
513
|
-
function
|
|
514
|
-
|
|
505
|
+
function tt(e) {
|
|
506
|
+
je.warning(`${e}: DEV dry-run OData запроса. Реальный запрос не выполняется, payload выведен в console.`, { title: "OData DEV helper" });
|
|
515
507
|
}
|
|
516
508
|
function $(t, n, r) {
|
|
517
509
|
let { odata: i, options: a = {}, init: o = {}, autoParse: s, swCache: c } = n, l = n.params ?? {};
|
|
518
510
|
return async ({ client: u, signal: d }) => {
|
|
519
|
-
|
|
520
|
-
let f = e(i.service, a.baseUrl), p = await
|
|
511
|
+
tt(r);
|
|
512
|
+
let f = e(i.service, a.baseUrl), p = await se({
|
|
521
513
|
service: i.service,
|
|
522
514
|
baseUrl: f
|
|
523
515
|
}, u);
|
|
524
516
|
if (!p) throw Error(`Не удалось загрузить metadata OData-сервиса '${i.service}'`);
|
|
525
|
-
let m =
|
|
526
|
-
|
|
527
|
-
let h =
|
|
517
|
+
let m = _e(p, i.target);
|
|
518
|
+
me(m, t, i);
|
|
519
|
+
let h = ae(n.body, t), g = oe(m, t), _ = ie(m, i, l, t), v = c ? {
|
|
528
520
|
...a,
|
|
529
521
|
baseUrl: f,
|
|
530
522
|
swCache: c
|
|
531
523
|
} : {
|
|
532
524
|
...a,
|
|
533
525
|
baseUrl: f
|
|
534
|
-
}, y =
|
|
526
|
+
}, y = re(_, v, {
|
|
535
527
|
...o,
|
|
536
528
|
method: g,
|
|
537
529
|
body: h,
|
|
538
530
|
signal: d
|
|
539
531
|
});
|
|
540
|
-
return
|
|
532
|
+
return et({
|
|
541
533
|
helperName: r,
|
|
542
534
|
operation: t,
|
|
543
535
|
odata: i,
|
|
@@ -556,25 +548,25 @@ function $(t, n, r) {
|
|
|
556
548
|
} : { data: void 0 };
|
|
557
549
|
};
|
|
558
550
|
}
|
|
551
|
+
function nt(e) {
|
|
552
|
+
return __DEV__ ? $("create", e, "odataCreateFnDev") : w("create", e);
|
|
553
|
+
}
|
|
559
554
|
function rt(e) {
|
|
560
|
-
return __DEV__ ? $("
|
|
555
|
+
return __DEV__ ? $("update", e, "odataUpdateFnDev") : w("update", e);
|
|
561
556
|
}
|
|
562
557
|
function it(e) {
|
|
563
|
-
return __DEV__ ? $("
|
|
558
|
+
return __DEV__ ? $("delete", e, "odataDeleteFnDev") : w("delete", e);
|
|
564
559
|
}
|
|
565
560
|
function at(e) {
|
|
566
|
-
return __DEV__ ? $("
|
|
561
|
+
return __DEV__ ? $("read", e, "odataReadFnDev") : w("read", e);
|
|
567
562
|
}
|
|
568
563
|
function ot(e) {
|
|
569
|
-
return __DEV__ ? $("
|
|
564
|
+
return __DEV__ ? $("query", e, "odataQueryFnDev") : w("query", e);
|
|
570
565
|
}
|
|
571
566
|
function st(e) {
|
|
572
|
-
return __DEV__ ? $("
|
|
573
|
-
}
|
|
574
|
-
function ct(e) {
|
|
575
|
-
return __DEV__ ? $("fi", e, "odataFunctionImportFnDev") : C("fi", e);
|
|
567
|
+
return __DEV__ ? $("fi", e, "odataFunctionImportFnDev") : w("fi", e);
|
|
576
568
|
}
|
|
577
569
|
//#endregion
|
|
578
|
-
export { h as BaseAppConfigURL, f as BaseODataDp0URL, l as BaseODataUI2URL, c as BaseODataURL, n as BaseUrlMap, L as ODATA_COLLECTION_BUST_SW_CACHE, I as ODATA_COLLECTION_DEFAULT_SW_CACHE, F as ODATA_COLLECTION_UPDATES_LOOKBACK_MS, R as ODATA_COLLECTION_UPDATES_SW_CACHE, d as SsoRequiredError,
|
|
570
|
+
export { h as BaseAppConfigURL, f as BaseODataDp0URL, l as BaseODataUI2URL, c as BaseODataURL, n as BaseUrlMap, L as ODATA_COLLECTION_BUST_SW_CACHE, I as ODATA_COLLECTION_DEFAULT_SW_CACHE, F as ODATA_COLLECTION_UPDATES_LOOKBACK_MS, R as ODATA_COLLECTION_UPDATES_SW_CACHE, d as SsoRequiredError, de as applyODataMetadataVersion, i as configureODataProjectAdapter, Me as createODataCollectionBaseQueryKey, P as createODataCollectionQueryKey, z as createODataCollectionUpdatesQueryKey, v as fetchBase, p as fetchDeleteFn, g as fetchJson, u as fetchJsonMutationFn, r as fetchJsonQueryFn, ce as fetchMetadata, V as fetchODataCollectionUpdates, m as fetchODataJson, _ as fetchQueryFn, Ne as flattenODataDependentServices, b as getInputUrl, se as getODataMetadataData, S as getODataProjectAdapter, a as isNoContentResponse, y as isSsoForm, t as normalizeODataServiceName, C as normalizeRelativePath, H as odataCollectionUpdatesQueryOptions, ge as odataCreateFn, nt as odataCreateFnDev, fe as odataDeleteFn, it as odataDeleteFnDev, E as odataFetch, le as odataFunctionImportFn, st as odataFunctionImportFnDev, te as odataMetadataQueryOptions, ne as odataQueryFn, ot as odataQueryFnDev, pe as odataReadFn, at as odataReadFnDev, he as odataUpdateFn, rt as odataUpdateFnDev, o as recoverSsoSession, e as resolveODataBaseUrl, q as resolveODataCollectionSwCachePolicy, x as resolveODataSapClient, Y as shouldRefreshODataCollectionCache, Pe as sortODataDependentSegmentItemsByChains, Ie as sortODataDependentServicesByChains, s as submitSsoForm, Ve as useODataCollection, He as useODataCollectionChains, Ue as useODataCollectionModel, X as useODataCollectionQuery, U as useODataCollectionUpdatesQuery, K as useODataEntity, W as useODataMetadata, T as useODataMetadataQuery, ve as useODataMetadataVersionQuery, Ge as useODataTableColumns };
|
|
579
571
|
|
|
580
572
|
//# sourceMappingURL=index.js.map
|