@panneau/data 4.0.74 → 4.0.75
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/index.d.ts +4 -2
- package/dist/index.js +59 -48
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -328,8 +328,10 @@ declare function useResourceItems<T = ResourceItem>(query: Record<string, unknow
|
|
|
328
328
|
declare function useResourceStore(resource: Resource | string, options: any): any;
|
|
329
329
|
declare function useResourceStore(options: any): any;
|
|
330
330
|
|
|
331
|
-
declare function useResourceUpdate(resource: Resource | string, id: string
|
|
332
|
-
declare function useResourceUpdate(id: string, options:
|
|
331
|
+
declare function useResourceUpdate(resource: Resource | string, id: string): any;
|
|
332
|
+
declare function useResourceUpdate(resource: Resource | string, id: string, options: UseMutationOptions): any;
|
|
333
|
+
declare function useResourceUpdate(id: string): any;
|
|
334
|
+
declare function useResourceUpdate(id: string, options: UseMutationOptions): any;
|
|
333
335
|
|
|
334
336
|
declare function useResourceClone(resource: Resource | string): any;
|
|
335
337
|
declare function useResourceClone(id: string | null): any;
|
package/dist/index.js
CHANGED
|
@@ -1119,70 +1119,81 @@ function useResourceStore(resource, t0) {
|
|
|
1119
1119
|
return t5;
|
|
1120
1120
|
}
|
|
1121
1121
|
|
|
1122
|
-
function useResourceUpdate(resource,
|
|
1123
|
-
const $ = c(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
$[
|
|
1122
|
+
function useResourceUpdate(resource, t0, t1) {
|
|
1123
|
+
const $ = c(22);
|
|
1124
|
+
const id = t0 === undefined ? null : t0;
|
|
1125
|
+
let t2;
|
|
1126
|
+
if ($[0] !== t1) {
|
|
1127
|
+
t2 = t1 === undefined ? {} : t1;
|
|
1128
|
+
$[0] = t1;
|
|
1129
|
+
$[1] = t2;
|
|
1129
1130
|
} else {
|
|
1130
|
-
|
|
1131
|
+
t2 = $[1];
|
|
1131
1132
|
}
|
|
1132
|
-
const options =
|
|
1133
|
+
const options = t2;
|
|
1133
1134
|
const providedResource = usePanneauResource(isObject$1(resource) || isString$1(id) ? resource : null);
|
|
1134
1135
|
const contextResource = useResource();
|
|
1135
1136
|
const finalResource = providedResource || contextResource;
|
|
1136
1137
|
const finalId = !isObject$1(id) ? id : resource;
|
|
1138
|
+
let t3;
|
|
1139
|
+
if ($[2] !== id || $[3] !== options) {
|
|
1140
|
+
t3 = isObject$1(id) ? id : options;
|
|
1141
|
+
$[2] = id;
|
|
1142
|
+
$[3] = options;
|
|
1143
|
+
$[4] = t3;
|
|
1144
|
+
} else {
|
|
1145
|
+
t3 = $[4];
|
|
1146
|
+
}
|
|
1147
|
+
const finalOptions = t3;
|
|
1137
1148
|
const api = useApi();
|
|
1138
|
-
let
|
|
1139
|
-
if ($[
|
|
1140
|
-
|
|
1141
|
-
$[
|
|
1142
|
-
$[
|
|
1143
|
-
$[
|
|
1144
|
-
$[
|
|
1149
|
+
let t4;
|
|
1150
|
+
if ($[5] !== api || $[6] !== finalId || $[7] !== finalResource) {
|
|
1151
|
+
t4 = data => api.resources.update(finalResource, finalId, data);
|
|
1152
|
+
$[5] = api;
|
|
1153
|
+
$[6] = finalId;
|
|
1154
|
+
$[7] = finalResource;
|
|
1155
|
+
$[8] = t4;
|
|
1145
1156
|
} else {
|
|
1146
|
-
|
|
1157
|
+
t4 = $[8];
|
|
1147
1158
|
}
|
|
1148
|
-
let
|
|
1149
|
-
if ($[
|
|
1150
|
-
|
|
1151
|
-
mutationFn:
|
|
1152
|
-
...
|
|
1159
|
+
let t5;
|
|
1160
|
+
if ($[9] !== finalOptions || $[10] !== t4) {
|
|
1161
|
+
t5 = {
|
|
1162
|
+
mutationFn: t4,
|
|
1163
|
+
...finalOptions
|
|
1153
1164
|
};
|
|
1154
|
-
$[
|
|
1155
|
-
$[
|
|
1156
|
-
$[
|
|
1165
|
+
$[9] = finalOptions;
|
|
1166
|
+
$[10] = t4;
|
|
1167
|
+
$[11] = t5;
|
|
1157
1168
|
} else {
|
|
1158
|
-
|
|
1169
|
+
t5 = $[11];
|
|
1159
1170
|
}
|
|
1160
|
-
const
|
|
1171
|
+
const t6 = useMutation(t5);
|
|
1161
1172
|
let isPending;
|
|
1162
1173
|
let mutate;
|
|
1163
1174
|
let mutateAsync;
|
|
1164
1175
|
let other;
|
|
1165
|
-
if ($[
|
|
1176
|
+
if ($[12] !== t6) {
|
|
1166
1177
|
({
|
|
1167
1178
|
mutate,
|
|
1168
1179
|
mutateAsync,
|
|
1169
1180
|
isPending,
|
|
1170
1181
|
...other
|
|
1171
|
-
} =
|
|
1172
|
-
$[
|
|
1173
|
-
$[
|
|
1174
|
-
$[
|
|
1175
|
-
$[
|
|
1176
|
-
$[
|
|
1182
|
+
} = t6);
|
|
1183
|
+
$[12] = t6;
|
|
1184
|
+
$[13] = isPending;
|
|
1185
|
+
$[14] = mutate;
|
|
1186
|
+
$[15] = mutateAsync;
|
|
1187
|
+
$[16] = other;
|
|
1177
1188
|
} else {
|
|
1178
|
-
isPending = $[
|
|
1179
|
-
mutate = $[
|
|
1180
|
-
mutateAsync = $[
|
|
1181
|
-
other = $[
|
|
1189
|
+
isPending = $[13];
|
|
1190
|
+
mutate = $[14];
|
|
1191
|
+
mutateAsync = $[15];
|
|
1192
|
+
other = $[16];
|
|
1182
1193
|
}
|
|
1183
|
-
let
|
|
1184
|
-
if ($[
|
|
1185
|
-
|
|
1194
|
+
let t7;
|
|
1195
|
+
if ($[17] !== isPending || $[18] !== mutate || $[19] !== mutateAsync || $[20] !== other) {
|
|
1196
|
+
t7 = {
|
|
1186
1197
|
update: mutate,
|
|
1187
1198
|
updateAsync: mutateAsync,
|
|
1188
1199
|
loading: isPending,
|
|
@@ -1191,15 +1202,15 @@ function useResourceUpdate(resource, id, t0) {
|
|
|
1191
1202
|
isPending,
|
|
1192
1203
|
...other
|
|
1193
1204
|
};
|
|
1194
|
-
$[
|
|
1195
|
-
$[
|
|
1196
|
-
$[
|
|
1197
|
-
$[
|
|
1198
|
-
$[
|
|
1205
|
+
$[17] = isPending;
|
|
1206
|
+
$[18] = mutate;
|
|
1207
|
+
$[19] = mutateAsync;
|
|
1208
|
+
$[20] = other;
|
|
1209
|
+
$[21] = t7;
|
|
1199
1210
|
} else {
|
|
1200
|
-
|
|
1211
|
+
t7 = $[21];
|
|
1201
1212
|
}
|
|
1202
|
-
return
|
|
1213
|
+
return t7;
|
|
1203
1214
|
}
|
|
1204
1215
|
|
|
1205
1216
|
function useResourceClone(t0, t1, t2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/data",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.75",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@babel/runtime": "^7.28.6",
|
|
56
56
|
"@folklore/fetch": "^0.1.21",
|
|
57
57
|
"@folklore/routes": "^0.4.11",
|
|
58
|
-
"@panneau/core": "^4.0.
|
|
58
|
+
"@panneau/core": "^4.0.75",
|
|
59
59
|
"@tanstack/react-query": "^5.100.9",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"query-string": "^9.0.0"
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "2eb608f88ad5041b3fa9c472e97a68680e281766"
|
|
75
75
|
}
|