@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 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, options: any): any;
332
- declare function useResourceUpdate(id: string, options: any): any;
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, id, t0) {
1123
- const $ = c(19);
1124
- let t1;
1125
- if ($[0] !== t0) {
1126
- t1 = t0 === undefined ? {} : t0;
1127
- $[0] = t0;
1128
- $[1] = t1;
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
- t1 = $[1];
1131
+ t2 = $[1];
1131
1132
  }
1132
- const options = t1;
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 t2;
1139
- if ($[2] !== api || $[3] !== finalId || $[4] !== finalResource) {
1140
- t2 = data => api.resources.update(finalResource, finalId, data);
1141
- $[2] = api;
1142
- $[3] = finalId;
1143
- $[4] = finalResource;
1144
- $[5] = t2;
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
- t2 = $[5];
1157
+ t4 = $[8];
1147
1158
  }
1148
- let t3;
1149
- if ($[6] !== options || $[7] !== t2) {
1150
- t3 = {
1151
- mutationFn: t2,
1152
- ...options
1159
+ let t5;
1160
+ if ($[9] !== finalOptions || $[10] !== t4) {
1161
+ t5 = {
1162
+ mutationFn: t4,
1163
+ ...finalOptions
1153
1164
  };
1154
- $[6] = options;
1155
- $[7] = t2;
1156
- $[8] = t3;
1165
+ $[9] = finalOptions;
1166
+ $[10] = t4;
1167
+ $[11] = t5;
1157
1168
  } else {
1158
- t3 = $[8];
1169
+ t5 = $[11];
1159
1170
  }
1160
- const t4 = useMutation(t3);
1171
+ const t6 = useMutation(t5);
1161
1172
  let isPending;
1162
1173
  let mutate;
1163
1174
  let mutateAsync;
1164
1175
  let other;
1165
- if ($[9] !== t4) {
1176
+ if ($[12] !== t6) {
1166
1177
  ({
1167
1178
  mutate,
1168
1179
  mutateAsync,
1169
1180
  isPending,
1170
1181
  ...other
1171
- } = t4);
1172
- $[9] = t4;
1173
- $[10] = isPending;
1174
- $[11] = mutate;
1175
- $[12] = mutateAsync;
1176
- $[13] = other;
1182
+ } = t6);
1183
+ $[12] = t6;
1184
+ $[13] = isPending;
1185
+ $[14] = mutate;
1186
+ $[15] = mutateAsync;
1187
+ $[16] = other;
1177
1188
  } else {
1178
- isPending = $[10];
1179
- mutate = $[11];
1180
- mutateAsync = $[12];
1181
- other = $[13];
1189
+ isPending = $[13];
1190
+ mutate = $[14];
1191
+ mutateAsync = $[15];
1192
+ other = $[16];
1182
1193
  }
1183
- let t5;
1184
- if ($[14] !== isPending || $[15] !== mutate || $[16] !== mutateAsync || $[17] !== other) {
1185
- t5 = {
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
- $[14] = isPending;
1195
- $[15] = mutate;
1196
- $[16] = mutateAsync;
1197
- $[17] = other;
1198
- $[18] = t5;
1205
+ $[17] = isPending;
1206
+ $[18] = mutate;
1207
+ $[19] = mutateAsync;
1208
+ $[20] = other;
1209
+ $[21] = t7;
1199
1210
  } else {
1200
- t5 = $[18];
1211
+ t7 = $[21];
1201
1212
  }
1202
- return t5;
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.74",
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.74",
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": "122cadcf8ea5faacc035e7fe911fbdfb9fb87d26"
74
+ "gitHead": "2eb608f88ad5041b3fa9c472e97a68680e281766"
75
75
  }