@archbase/data 3.0.10 → 3.0.12
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/README.md
CHANGED
|
@@ -21,6 +21,7 @@ yarn add @archbase/data @archbase/core
|
|
|
21
21
|
- 📄 **Pagination**: Built-in pagination support
|
|
22
22
|
- 🔍 **Filtering**: Advanced filtering with RSQL
|
|
23
23
|
- 📊 **Sorting**: Multi-column sorting support
|
|
24
|
+
- 📤 **File Upload**: Multipart/form-data support for file uploads
|
|
24
25
|
|
|
25
26
|
## Usage
|
|
26
27
|
|
|
@@ -56,6 +57,22 @@ const dataSource = useArchbaseLocalDataSource({
|
|
|
56
57
|
});
|
|
57
58
|
```
|
|
58
59
|
|
|
60
|
+
### API Client - File Upload (Multipart)
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { ArchbaseRemoteApiClient } from '@archbase/data';
|
|
64
|
+
|
|
65
|
+
// Upload de arquivos usando multipart/form-data
|
|
66
|
+
const formData = new FormData();
|
|
67
|
+
formData.append('file', file);
|
|
68
|
+
formData.append('description', 'My file');
|
|
69
|
+
|
|
70
|
+
const response = await apiClient.postMultipart<UploadResponse>(
|
|
71
|
+
'/api/upload',
|
|
72
|
+
formData
|
|
73
|
+
);
|
|
74
|
+
```
|
|
75
|
+
|
|
59
76
|
## License
|
|
60
77
|
|
|
61
78
|
MIT © Edson Martins
|
|
@@ -50,7 +50,7 @@ export declare function useArchbaseQueryStates(): {
|
|
|
50
50
|
stale: number;
|
|
51
51
|
fresh: number;
|
|
52
52
|
};
|
|
53
|
-
queries: import('@tanstack/
|
|
53
|
+
queries: import('@tanstack/query-core').Query<unknown, Error, unknown, readonly unknown[]>[];
|
|
54
54
|
invalidateAll: () => Promise<void>;
|
|
55
55
|
clearAll: () => void;
|
|
56
56
|
refetchAll: () => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isDate as we, parseISO as Ee } from "date-fns";
|
|
2
2
|
import { EventEmitter as Le } from "events";
|
|
3
3
|
import { uniqueId as Be, cloneDeep as $e } from "lodash";
|
|
4
|
-
import { archbaseI18next as m, ArchbaseDataSourceError as g, ArchbaseObjectHelper as ye, processErrorMessage as
|
|
5
|
-
import { ADVANCED as Mt, ARCHBASE_IOC_API_TYPE as jt, FILTER_TYPE as
|
|
4
|
+
import { archbaseI18next as m, ArchbaseDataSourceError as g, ArchbaseObjectHelper as ye, processErrorMessage as G, QUICK as Se, NORMAL as Fe, ADVANCED as Ae, ArchbaseFilterDSL as xe, QueryFilterEntity as ue, detectDataSourceVersion as ve, MigrationMetrics as Ne, ARCHBASE_IOC_API_TYPE as He, ArchbaseJacksonParser as ie } from "@archbase/core";
|
|
5
|
+
import { ADVANCED as Mt, ARCHBASE_IOC_API_TYPE as jt, FILTER_TYPE as kt, NORMAL as Ut, QUICK as Gt, useArchbaseBool as qt } from "@archbase/core";
|
|
6
6
|
import { useState as C, useCallback as l, useRef as le, useMemo as H, useEffect as J, useReducer as We } from "react";
|
|
7
7
|
import { produce as _ } from "immer";
|
|
8
8
|
import "reflect-metadata";
|
|
@@ -12,7 +12,7 @@ import { useContainer as ze } from "inversify-react";
|
|
|
12
12
|
import { create as Me } from "zustand";
|
|
13
13
|
import { createTrackedSelector as je } from "react-tracked";
|
|
14
14
|
var d = /* @__PURE__ */ ((n) => (n[n.dataChanged = 0] = "dataChanged", n[n.recordChanged = 1] = "recordChanged", n[n.refreshData = 2] = "refreshData", n[n.fieldChanged = 3] = "fieldChanged", n[n.beforeClose = 4] = "beforeClose", n[n.afterClose = 5] = "afterClose", n[n.beforeOpen = 6] = "beforeOpen", n[n.afterOpen = 7] = "afterOpen", n[n.beforeAppend = 8] = "beforeAppend", n[n.afterAppend = 9] = "afterAppend", n[n.beforeRemove = 10] = "beforeRemove", n[n.afterRemove = 11] = "afterRemove", n[n.beforeInsert = 12] = "beforeInsert", n[n.afterInsert = 13] = "afterInsert", n[n.beforeEdit = 14] = "beforeEdit", n[n.afterEdit = 15] = "afterEdit", n[n.beforeSave = 16] = "beforeSave", n[n.afterSave = 17] = "afterSave", n[n.beforeCancel = 18] = "beforeCancel", n[n.afterCancel = 19] = "afterCancel", n[n.afterScroll = 20] = "afterScroll", n[n.onError = 21] = "onError", n[n.onFieldError = 22] = "onFieldError", n))(d || {});
|
|
15
|
-
class
|
|
15
|
+
class ke {
|
|
16
16
|
eventEmitter;
|
|
17
17
|
listenersDisable = !1;
|
|
18
18
|
constructor() {
|
|
@@ -79,7 +79,7 @@ class Ie {
|
|
|
79
79
|
validator;
|
|
80
80
|
getIdentity;
|
|
81
81
|
constructor(e, t, r) {
|
|
82
|
-
this.name = e, this.label = r || e, this.records = [], this.filteredRecords = [], this.loadOptions(t), this.fieldEventListeners = {}, this.emitter = new
|
|
82
|
+
this.name = e, this.label = r || e, this.records = [], this.filteredRecords = [], this.loadOptions(t), this.fieldEventListeners = {}, this.emitter = new ke(), this.uuid = Be(), this.validator = t.validator, this.getIdentity = t.getIdentity;
|
|
83
83
|
}
|
|
84
84
|
loadOptions(e) {
|
|
85
85
|
this.records = e.records, this.filters = [], e.filters && (this.filters = e.filters), this.currentRecord = void 0, this.currentRecordIndex = -1, this.filteredRecords = this.applyFilters(), this.filteredRecords.length > 0 && (this.currentRecordIndex = 0, this.currentRecord = this.filteredRecords[this.currentRecordIndex]), this.grandTotalRecords = e.grandTotalRecords, this.currentPageIndex = e.currentPage, this.totalPages = e.totalPages, this.pageSize = e.pageSize, this.active = !0, this.filter = e.filter, this.sort = e.sort, this.originFilter = e.originFilter, this.originSort = e.originSort, this.originGlobalFilter = e.originGlobalFilter, this.defaultSortFields = e.defaultSortFields ? e.defaultSortFields : [];
|
|
@@ -690,7 +690,7 @@ class Ce extends Ie {
|
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
692
|
});
|
|
693
|
-
const r =
|
|
693
|
+
const r = G(t);
|
|
694
694
|
throw this.emitter.emit("onError", r, t), this.emit({
|
|
695
695
|
type: d.onError,
|
|
696
696
|
error: r,
|
|
@@ -735,7 +735,7 @@ class Ce extends Ie {
|
|
|
735
735
|
index: i
|
|
736
736
|
}), this.lastDataBrowsingOn = (/* @__PURE__ */ new Date()).getTime(), this.lastDataChangedAt = (/* @__PURE__ */ new Date()).getTime(), e && e(), r;
|
|
737
737
|
} catch (t) {
|
|
738
|
-
const r =
|
|
738
|
+
const r = G(t);
|
|
739
739
|
throw this.emitter.emit("onError", r, t), this.emit({
|
|
740
740
|
type: d.onError,
|
|
741
741
|
error: r,
|
|
@@ -770,7 +770,7 @@ class Ce extends Ie {
|
|
|
770
770
|
return e && e.sort ? e.sort.quickFilterSort : this.defaultSortFields;
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
|
-
class
|
|
773
|
+
class Ue {
|
|
774
774
|
id;
|
|
775
775
|
companyId;
|
|
776
776
|
filter;
|
|
@@ -788,7 +788,7 @@ class Ge {
|
|
|
788
788
|
Object.assign(this, e);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
|
-
class
|
|
791
|
+
class Ge extends Ie {
|
|
792
792
|
getFilterById(e) {
|
|
793
793
|
if (this.locate({ id: e }))
|
|
794
794
|
return this.convertCurrentRecordToFilter();
|
|
@@ -808,7 +808,7 @@ class ke extends Ie {
|
|
|
808
808
|
}
|
|
809
809
|
async addNewFilter(e, t) {
|
|
810
810
|
this.insert(
|
|
811
|
-
new
|
|
811
|
+
new Ue({
|
|
812
812
|
id: e.id,
|
|
813
813
|
name: e.name,
|
|
814
814
|
description: e.description,
|
|
@@ -1050,7 +1050,7 @@ export function MyComponent<T, ID>({ dataSource, dataField, value, onChangeValue
|
|
|
1050
1050
|
);
|
|
1051
1051
|
}
|
|
1052
1052
|
`;
|
|
1053
|
-
class
|
|
1053
|
+
class k {
|
|
1054
1054
|
name;
|
|
1055
1055
|
label;
|
|
1056
1056
|
records = [];
|
|
@@ -1704,7 +1704,7 @@ class Je {
|
|
|
1704
1704
|
index: this.getCurrentIndex()
|
|
1705
1705
|
}), e && e(), r;
|
|
1706
1706
|
} catch (r) {
|
|
1707
|
-
throw this.handleSaveError(r, e), new g(
|
|
1707
|
+
throw this.handleSaveError(r, e), new g(G(r));
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
1710
|
async remove(e) {
|
|
@@ -1733,7 +1733,7 @@ class Je {
|
|
|
1733
1733
|
index: r
|
|
1734
1734
|
}), e && e(), t;
|
|
1735
1735
|
} catch (i) {
|
|
1736
|
-
const s =
|
|
1736
|
+
const s = G(i);
|
|
1737
1737
|
throw this.emit({
|
|
1738
1738
|
type: d.onError,
|
|
1739
1739
|
error: s,
|
|
@@ -2071,7 +2071,7 @@ class Je {
|
|
|
2071
2071
|
originalError: i.message
|
|
2072
2072
|
}), this.onFieldError && this.onFieldError(i.field, i.message));
|
|
2073
2073
|
});
|
|
2074
|
-
const r =
|
|
2074
|
+
const r = G(e);
|
|
2075
2075
|
this.emit({
|
|
2076
2076
|
type: d.onError,
|
|
2077
2077
|
error: r,
|
|
@@ -2146,7 +2146,7 @@ class Je {
|
|
|
2146
2146
|
return this.defaultSortFields;
|
|
2147
2147
|
}
|
|
2148
2148
|
handleRemoteError(e, t) {
|
|
2149
|
-
const r =
|
|
2149
|
+
const r = G(e);
|
|
2150
2150
|
this.emit({
|
|
2151
2151
|
type: d.onError,
|
|
2152
2152
|
error: r,
|
|
@@ -2155,7 +2155,7 @@ class Je {
|
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
2157
|
function be(n) {
|
|
2158
|
-
const e = le(null), [t, r] = C(null), [i, s] = C(-1), [o, c] = C(0), [f, R] = C(!0), [b, N] = C(!1), [W, T] = C(!1), [O, $] = C(!1), [, z] = C({}), u = l(() => z({}), []), a = H(() => (e.current || (e.current = new
|
|
2158
|
+
const e = le(null), [t, r] = C(null), [i, s] = C(-1), [o, c] = C(0), [f, R] = C(!0), [b, N] = C(!1), [W, T] = C(!1), [O, $] = C(!1), [, z] = C({}), u = l(() => z({}), []), a = H(() => (e.current || (e.current = new k(n)), e.current), []), V = l((F) => {
|
|
2159
2159
|
switch (F.type) {
|
|
2160
2160
|
case d.dataChanged:
|
|
2161
2161
|
case d.recordChanged:
|
|
@@ -2189,36 +2189,36 @@ function be(n) {
|
|
|
2189
2189
|
const X = l((F, j) => {
|
|
2190
2190
|
a.setFieldValue(F, j);
|
|
2191
2191
|
}, [a]), S = l((F) => a.getFieldValue(F), [a]), h = l(() => {
|
|
2192
|
-
a instanceof
|
|
2192
|
+
a instanceof k, a.edit();
|
|
2193
2193
|
}, [a]), Q = l(async () => await a.save(), [a]), Z = l(() => {
|
|
2194
|
-
a instanceof
|
|
2194
|
+
a instanceof k, a.cancel();
|
|
2195
2195
|
}, [a]), I = l((F) => {
|
|
2196
|
-
a instanceof
|
|
2197
|
-
}, [a]),
|
|
2198
|
-
a instanceof
|
|
2196
|
+
a instanceof k, a.insert(F);
|
|
2197
|
+
}, [a]), U = l(async (F) => await a.remove(F), [a]), ee = l(() => {
|
|
2198
|
+
a instanceof k, a.first();
|
|
2199
2199
|
}, [a]), D = l(() => {
|
|
2200
|
-
a instanceof
|
|
2200
|
+
a instanceof k, a.last();
|
|
2201
2201
|
}, [a]), E = l(() => {
|
|
2202
|
-
a instanceof
|
|
2202
|
+
a instanceof k, a.next();
|
|
2203
2203
|
}, [a]), A = l(() => {
|
|
2204
|
-
a instanceof
|
|
2204
|
+
a instanceof k, a.prior();
|
|
2205
2205
|
}, [a]), P = l((F) => {
|
|
2206
|
-
a instanceof
|
|
2206
|
+
a instanceof k, a.goToRecord(F);
|
|
2207
2207
|
}, [a]), p = l((F, j) => {
|
|
2208
|
-
a instanceof
|
|
2208
|
+
a instanceof k && a.appendToFieldArray(F, j);
|
|
2209
2209
|
}, [a]), v = l((F, j, he) => {
|
|
2210
|
-
a instanceof
|
|
2210
|
+
a instanceof k && a.updateFieldArrayItem(F, j, he);
|
|
2211
2211
|
}, [a]), x = l((F, j) => {
|
|
2212
|
-
a instanceof
|
|
2212
|
+
a instanceof k && a.removeFromFieldArray(F, j);
|
|
2213
2213
|
}, [a]), L = l((F, j, he) => {
|
|
2214
|
-
a instanceof
|
|
2214
|
+
a instanceof k && a.insertIntoFieldArray(F, j, he);
|
|
2215
2215
|
}, [a]), y = l((F) => {
|
|
2216
|
-
if (a instanceof
|
|
2216
|
+
if (a instanceof k)
|
|
2217
2217
|
return a.getFieldArray(F);
|
|
2218
2218
|
const j = a.getFieldValue(F);
|
|
2219
2219
|
return Array.isArray(j) ? j : [];
|
|
2220
2220
|
}, [a]), q = l((F) => {
|
|
2221
|
-
if (a instanceof
|
|
2221
|
+
if (a instanceof k)
|
|
2222
2222
|
return a.isFieldArray(F);
|
|
2223
2223
|
const j = a.getFieldValue(F);
|
|
2224
2224
|
return Array.isArray(j);
|
|
@@ -2258,7 +2258,7 @@ function be(n) {
|
|
|
2258
2258
|
save: Q,
|
|
2259
2259
|
cancel: Z,
|
|
2260
2260
|
insert: I,
|
|
2261
|
-
remove:
|
|
2261
|
+
remove: U,
|
|
2262
2262
|
// Navegação
|
|
2263
2263
|
first: ee,
|
|
2264
2264
|
last: D,
|
|
@@ -2361,7 +2361,7 @@ function De(n) {
|
|
|
2361
2361
|
}), [h, Q]);
|
|
2362
2362
|
const Z = l((w, M) => {
|
|
2363
2363
|
h.setFieldValue(w, M);
|
|
2364
|
-
}, [h]), I = l((w) => h.getFieldValue(w), [h]),
|
|
2364
|
+
}, [h]), I = l((w) => h.getFieldValue(w), [h]), U = l(() => {
|
|
2365
2365
|
h.edit();
|
|
2366
2366
|
}, [h]), ee = l(async () => {
|
|
2367
2367
|
try {
|
|
@@ -2450,7 +2450,7 @@ function De(n) {
|
|
|
2450
2450
|
// Operações básicas
|
|
2451
2451
|
setFieldValue: Z,
|
|
2452
2452
|
getFieldValue: I,
|
|
2453
|
-
edit:
|
|
2453
|
+
edit: U,
|
|
2454
2454
|
save: ee,
|
|
2455
2455
|
cancel: D,
|
|
2456
2456
|
insert: E,
|
|
@@ -2615,7 +2615,7 @@ const At = {
|
|
|
2615
2615
|
}), [n.dataSource?.uuid || n.dataSource?.getName()]);
|
|
2616
2616
|
}, bt = (n) => {
|
|
2617
2617
|
const { initialData: e, name: t, initialDataSource: r, onLoadComplete: i, validator: s } = n, [o, c] = C(
|
|
2618
|
-
r ?? new
|
|
2618
|
+
r ?? new Ge(t, {
|
|
2619
2619
|
records: e,
|
|
2620
2620
|
grandTotalRecords: e.length,
|
|
2621
2621
|
currentPage: 0,
|
|
@@ -2782,6 +2782,22 @@ class Ve {
|
|
|
2782
2782
|
return Promise.reject(s);
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Faz requisição POST com FormData (multipart/form-data) para upload de arquivos.
|
|
2787
|
+
* Não define Content-Type manualmente para que o axios gere automaticamente com o boundary correto.
|
|
2788
|
+
*/
|
|
2789
|
+
async postMultipart(e, t, r, i) {
|
|
2790
|
+
try {
|
|
2791
|
+
const s = { ...r };
|
|
2792
|
+
if (!i) {
|
|
2793
|
+
const c = this.tokenManager.getToken();
|
|
2794
|
+
c && (s.Authorization = `Bearer ${c.access_token}`);
|
|
2795
|
+
}
|
|
2796
|
+
return (await Y.post(e, t, { headers: s })).data;
|
|
2797
|
+
} catch (s) {
|
|
2798
|
+
return Promise.reject(s);
|
|
2799
|
+
}
|
|
2800
|
+
}
|
|
2785
2801
|
}
|
|
2786
2802
|
ne.decorate(ne.inject(He.TokenManager), Ve, 0);
|
|
2787
2803
|
ne.decorate(ne.injectable(), Ve);
|
|
@@ -2950,7 +2966,7 @@ function Dt(n) {
|
|
|
2950
2966
|
totalPages: 0,
|
|
2951
2967
|
pageSize: $,
|
|
2952
2968
|
validator: X
|
|
2953
|
-
}, t), Z = () => a && a.existsValue(e) ? a.getValue(e).getCurrentPage() : O ? O.getCurrentPage() : 0, [I,
|
|
2969
|
+
}, t), Z = () => a && a.existsValue(e) ? a.getValue(e).getCurrentPage() : O ? O.getCurrentPage() : 0, [I, U] = C({
|
|
2954
2970
|
dataSource: Q(),
|
|
2955
2971
|
isLoading: !1,
|
|
2956
2972
|
isError: !1,
|
|
@@ -2970,7 +2986,7 @@ function Dt(n) {
|
|
|
2970
2986
|
K ? B = ge.createFromValues([K], 1, 0, 0, 0) : B = ge.createFromValues([], 0, 0, 0, 0);
|
|
2971
2987
|
} else
|
|
2972
2988
|
T && L && y && y.length > 0 ? B = await T(L, v, x, y) : W && L ? B = await W(L, v, x) : N && y && y.length > 0 ? B = await N(v, x, y) : b ? B = await b(v, x) : L && y && y.length > 0 ? B = await r.findAllWithFilterAndSort(L, v, x, y) : L ? B = await r.findAllWithFilter(L, v, x) : y && y.length > 0 ? B = await r.findAllWithSort(v, x, y) : B = await r.findAll(v, x);
|
|
2973
|
-
R && (B = R(B)), o && (B = o(B)),
|
|
2989
|
+
R && (B = R(B)), o && (B = o(B)), U((K) => {
|
|
2974
2990
|
const re = {
|
|
2975
2991
|
records: B.content,
|
|
2976
2992
|
grandTotalRecords: Ke(B),
|
|
@@ -3005,7 +3021,7 @@ function Dt(n) {
|
|
|
3005
3021
|
if (p.type === d.refreshData) {
|
|
3006
3022
|
const v = p.options;
|
|
3007
3023
|
try {
|
|
3008
|
-
|
|
3024
|
+
U((x) => ({
|
|
3009
3025
|
...x,
|
|
3010
3026
|
isLoading: !0,
|
|
3011
3027
|
filter: v.filter,
|
|
@@ -3023,8 +3039,8 @@ function Dt(n) {
|
|
|
3023
3039
|
v.originSort,
|
|
3024
3040
|
v.originGlobalFilter
|
|
3025
3041
|
).catch((x) => {
|
|
3026
|
-
const L =
|
|
3027
|
-
|
|
3042
|
+
const L = G(x);
|
|
3043
|
+
U((y) => ({
|
|
3028
3044
|
...y,
|
|
3029
3045
|
isError: !0,
|
|
3030
3046
|
isLoading: !1,
|
|
@@ -3032,8 +3048,8 @@ function Dt(n) {
|
|
|
3032
3048
|
})), n.onError && n.onError(L, x);
|
|
3033
3049
|
});
|
|
3034
3050
|
} catch (x) {
|
|
3035
|
-
const L =
|
|
3036
|
-
|
|
3051
|
+
const L = G(x);
|
|
3052
|
+
U((y) => ({
|
|
3037
3053
|
...y,
|
|
3038
3054
|
isError: !0,
|
|
3039
3055
|
isLoading: !1,
|
|
@@ -3048,7 +3064,7 @@ function Dt(n) {
|
|
|
3048
3064
|
}, [D]);
|
|
3049
3065
|
J(() => {
|
|
3050
3066
|
try {
|
|
3051
|
-
return E(I.dataSource), u && I.loadDataCount === 0 ? (
|
|
3067
|
+
return E(I.dataSource), u && I.loadDataCount === 0 ? (U((p) => ({ ...p, isLoading: !0 })), ee(
|
|
3052
3068
|
I.name,
|
|
3053
3069
|
z,
|
|
3054
3070
|
$,
|
|
@@ -3056,8 +3072,8 @@ function Dt(n) {
|
|
|
3056
3072
|
I.sort,
|
|
3057
3073
|
I.id
|
|
3058
3074
|
).catch((p) => {
|
|
3059
|
-
const v =
|
|
3060
|
-
|
|
3075
|
+
const v = G(p);
|
|
3076
|
+
U((x) => ({
|
|
3061
3077
|
...x,
|
|
3062
3078
|
isError: !0,
|
|
3063
3079
|
isLoading: !1,
|
|
@@ -3067,8 +3083,8 @@ function Dt(n) {
|
|
|
3067
3083
|
f && (A(I.dataSource), f(I.dataSource));
|
|
3068
3084
|
};
|
|
3069
3085
|
} catch (p) {
|
|
3070
|
-
const v =
|
|
3071
|
-
|
|
3086
|
+
const v = G(p);
|
|
3087
|
+
U((x) => ({
|
|
3072
3088
|
...x,
|
|
3073
3089
|
isError: !0,
|
|
3074
3090
|
isLoading: !1,
|
|
@@ -3084,7 +3100,7 @@ function Dt(n) {
|
|
|
3084
3100
|
I.pageSize
|
|
3085
3101
|
]);
|
|
3086
3102
|
const P = () => {
|
|
3087
|
-
|
|
3103
|
+
U((p) => ({
|
|
3088
3104
|
...p,
|
|
3089
3105
|
isError: !1,
|
|
3090
3106
|
isLoading: !1,
|
|
@@ -3194,7 +3210,7 @@ function Vt(n) {
|
|
|
3194
3210
|
E.originSort,
|
|
3195
3211
|
E.originGlobalFilter
|
|
3196
3212
|
).catch((A) => {
|
|
3197
|
-
const P =
|
|
3213
|
+
const P = G(A);
|
|
3198
3214
|
h((p) => ({
|
|
3199
3215
|
...p,
|
|
3200
3216
|
isError: !0,
|
|
@@ -3203,7 +3219,7 @@ function Vt(n) {
|
|
|
3203
3219
|
})), n.onError && n.onError(P, A);
|
|
3204
3220
|
});
|
|
3205
3221
|
} catch (A) {
|
|
3206
|
-
const P =
|
|
3222
|
+
const P = G(A);
|
|
3207
3223
|
h((p) => ({
|
|
3208
3224
|
...p,
|
|
3209
3225
|
isError: !0,
|
|
@@ -3214,7 +3230,7 @@ function Vt(n) {
|
|
|
3214
3230
|
}
|
|
3215
3231
|
}, I = (D) => {
|
|
3216
3232
|
D.addListener(Z);
|
|
3217
|
-
},
|
|
3233
|
+
}, U = (D) => {
|
|
3218
3234
|
D.removeListener(Z);
|
|
3219
3235
|
};
|
|
3220
3236
|
J(() => {
|
|
@@ -3226,7 +3242,7 @@ function Vt(n) {
|
|
|
3226
3242
|
S.filter,
|
|
3227
3243
|
S.sort
|
|
3228
3244
|
).catch((D) => {
|
|
3229
|
-
const E =
|
|
3245
|
+
const E = G(D);
|
|
3230
3246
|
h((A) => ({
|
|
3231
3247
|
...A,
|
|
3232
3248
|
isError: !0,
|
|
@@ -3234,10 +3250,10 @@ function Vt(n) {
|
|
|
3234
3250
|
error: E
|
|
3235
3251
|
})), n.onError && n.onError(E, D);
|
|
3236
3252
|
})), () => {
|
|
3237
|
-
c && (
|
|
3253
|
+
c && (U(S.dataSource), c(S.dataSource));
|
|
3238
3254
|
};
|
|
3239
3255
|
} catch (D) {
|
|
3240
|
-
const E =
|
|
3256
|
+
const E = G(D);
|
|
3241
3257
|
h((A) => ({
|
|
3242
3258
|
...A,
|
|
3243
3259
|
isError: !0,
|
|
@@ -3350,8 +3366,8 @@ export {
|
|
|
3350
3366
|
At as ARCHBASE_QUERY_DEFAULTS,
|
|
3351
3367
|
Ve as ArchbaseAxiosRemoteApiClient,
|
|
3352
3368
|
Ie as ArchbaseDataSource,
|
|
3353
|
-
|
|
3354
|
-
|
|
3369
|
+
k as ArchbaseDataSourceV2,
|
|
3370
|
+
Ge as ArchbaseLocalFilterDataSource,
|
|
3355
3371
|
Ft as ArchbaseQueryUtils,
|
|
3356
3372
|
Qe as ArchbaseRemoteApiService,
|
|
3357
3373
|
Ce as ArchbaseRemoteDataSource,
|
|
@@ -3359,11 +3375,11 @@ export {
|
|
|
3359
3375
|
_e as ArchbaseRemoteFilterDataSource,
|
|
3360
3376
|
d as DataSourceEventNames,
|
|
3361
3377
|
ge as DefaultPage,
|
|
3362
|
-
|
|
3363
|
-
|
|
3378
|
+
kt as FILTER_TYPE,
|
|
3379
|
+
Ue as LocalFilter,
|
|
3364
3380
|
yt as MigrationValidation,
|
|
3365
|
-
|
|
3366
|
-
|
|
3381
|
+
Ut as NORMAL,
|
|
3382
|
+
Gt as QUICK,
|
|
3367
3383
|
qe as RemoteFilter,
|
|
3368
3384
|
vt as USAGE_EXAMPLE,
|
|
3369
3385
|
qt as useArchbaseBool,
|
|
@@ -46,6 +46,8 @@ export interface ArchbaseRemoteApiClient {
|
|
|
46
46
|
getBlob(url: string, headers?: Record<string, string>, withoutToken?: boolean): Promise<Blob>;
|
|
47
47
|
/** Faz requisição POST e retorna Blob (para download de arquivos) */
|
|
48
48
|
postBlob<T>(url: string, data: T, headers?: Record<string, string>, withoutToken?: boolean): Promise<Blob>;
|
|
49
|
+
/** Faz requisição POST com FormData (multipart/form-data) para upload de arquivos */
|
|
50
|
+
postMultipart<R>(url: string, data: FormData, headers?: Record<string, string>, withoutToken?: boolean): Promise<R>;
|
|
49
51
|
}
|
|
50
52
|
export declare class ArchbaseAxiosRemoteApiClient implements ArchbaseRemoteApiClient {
|
|
51
53
|
protected tokenManager: ArchbaseTokenManager;
|
|
@@ -70,6 +72,11 @@ export declare class ArchbaseAxiosRemoteApiClient implements ArchbaseRemoteApiCl
|
|
|
70
72
|
* Útil para exportação de relatórios que requerem parâmetros complexos no body.
|
|
71
73
|
*/
|
|
72
74
|
postBlob<T>(url: string, data: T, headers?: Record<string, string>, withoutToken?: boolean): Promise<Blob>;
|
|
75
|
+
/**
|
|
76
|
+
* Faz requisição POST com FormData (multipart/form-data) para upload de arquivos.
|
|
77
|
+
* Não define Content-Type manualmente para que o axios gere automaticamente com o boundary correto.
|
|
78
|
+
*/
|
|
79
|
+
postMultipart<R>(url: string, data: FormData, headers?: Record<string, string>, withoutToken?: boolean): Promise<R>;
|
|
73
80
|
}
|
|
74
81
|
export interface ArchbaseEntityTransformer<T> {
|
|
75
82
|
transform(entity: T): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archbase/data",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.12",
|
|
4
4
|
"description": "Data management layer for Archbase React v3 - DataSource, hooks, and API services",
|
|
5
5
|
"author": "Edson Martins <edsonmartins2005@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"react-dom": "^18.3.0 || ^19.2.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@archbase/core": "3.0.12",
|
|
28
29
|
"@tanstack/react-query": "^5.81.5",
|
|
29
30
|
"axios": "^1.7.2",
|
|
30
31
|
"date-fns": "^2.30.0",
|
|
@@ -37,8 +38,7 @@
|
|
|
37
38
|
"react-tracked": "^2.0.1",
|
|
38
39
|
"reflect-metadata": "^0.2.2",
|
|
39
40
|
"rxjs": "^7.8.2",
|
|
40
|
-
"zustand": "^5.0.6"
|
|
41
|
-
"@archbase/core": "3.0.10"
|
|
41
|
+
"zustand": "^5.0.6"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@mantine/hooks": "8.3.14",
|
|
Binary file
|