@questpie/admin 3.2.4 → 3.2.6

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.
Files changed (255) hide show
  1. package/dist/client/blocks/block-renderer.d.mts +2 -2
  2. package/dist/client/blocks/block-renderer.mjs +164 -339
  3. package/dist/client/components/actions/action-button.mjs +9 -9
  4. package/dist/client/components/actions/action-dialog.mjs +195 -493
  5. package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
  6. package/dist/client/components/actions/header-actions.mjs +73 -165
  7. package/dist/client/components/admin-link.d.mts +2 -2
  8. package/dist/client/components/admin-link.mjs +40 -126
  9. package/dist/client/components/auth/auth-loading.mjs +9 -44
  10. package/dist/client/components/blocks/block-canvas.mjs +31 -95
  11. package/dist/client/components/blocks/block-editor-context.mjs +13 -57
  12. package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
  13. package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
  14. package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
  15. package/dist/client/components/blocks/block-insert-button.mjs +49 -165
  16. package/dist/client/components/blocks/block-item-menu.mjs +102 -301
  17. package/dist/client/components/blocks/block-item.mjs +136 -370
  18. package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
  19. package/dist/client/components/blocks/block-tree.mjs +12 -68
  20. package/dist/client/components/blocks/block-type-icon.mjs +14 -56
  21. package/dist/client/components/brand-logo.mjs +35 -149
  22. package/dist/client/components/component-renderer.mjs +42 -118
  23. package/dist/client/components/error-boundary.mjs +14 -58
  24. package/dist/client/components/fields/array-field.mjs +209 -521
  25. package/dist/client/components/fields/asset-preview-field.mjs +41 -141
  26. package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
  27. package/dist/client/components/fields/boolean-field.mjs +29 -59
  28. package/dist/client/components/fields/date-field.mjs +7 -37
  29. package/dist/client/components/fields/datetime-field.mjs +7 -38
  30. package/dist/client/components/fields/email-field.mjs +25 -54
  31. package/dist/client/components/fields/field-wrapper.mjs +30 -105
  32. package/dist/client/components/fields/json-field.mjs +94 -296
  33. package/dist/client/components/fields/locale-badge.mjs +6 -15
  34. package/dist/client/components/fields/number-field.mjs +27 -60
  35. package/dist/client/components/fields/object-array-field.mjs +283 -659
  36. package/dist/client/components/fields/object-field.mjs +165 -633
  37. package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
  38. package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
  39. package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
  40. package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
  41. package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
  42. package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
  43. package/dist/client/components/fields/relation-field.mjs +10 -66
  44. package/dist/client/components/fields/relation-picker.mjs +18 -18
  45. package/dist/client/components/fields/relation-select.mjs +12 -12
  46. package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
  48. package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
  49. package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
  50. package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
  51. package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
  52. package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
  53. package/dist/client/components/fields/rich-text-field.mjs +14 -53
  54. package/dist/client/components/fields/select-field.mjs +61 -72
  55. package/dist/client/components/fields/text-field.mjs +26 -59
  56. package/dist/client/components/fields/textarea-field.mjs +26 -58
  57. package/dist/client/components/fields/time-field.mjs +7 -35
  58. package/dist/client/components/fields/upload-field.mjs +47 -165
  59. package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
  60. package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
  61. package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
  62. package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
  63. package/dist/client/components/history-sidebar.mjs +285 -605
  64. package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
  65. package/dist/client/components/locale-switcher.mjs +106 -228
  66. package/dist/client/components/media/media-grid.mjs +84 -273
  67. package/dist/client/components/media/media-picker-dialog.mjs +176 -476
  68. package/dist/client/components/preview/live-preview-mode.mjs +233 -458
  69. package/dist/client/components/preview/preview-pane.mjs +22 -22
  70. package/dist/client/components/primitives/asset-preview.mjs +290 -666
  71. package/dist/client/components/primitives/checkbox-input.mjs +9 -35
  72. package/dist/client/components/primitives/date-input.mjs +109 -327
  73. package/dist/client/components/primitives/dropzone.mjs +209 -336
  74. package/dist/client/components/primitives/field-select-control.mjs +12 -80
  75. package/dist/client/components/primitives/number-input.mjs +4 -4
  76. package/dist/client/components/primitives/select-multi.mjs +229 -572
  77. package/dist/client/components/primitives/select-single.mjs +179 -499
  78. package/dist/client/components/primitives/time-input.mjs +43 -117
  79. package/dist/client/components/primitives/toggle-input.mjs +9 -29
  80. package/dist/client/components/sheets/resource-sheet.mjs +61 -70
  81. package/dist/client/components/ui/accordion.mjs +35 -155
  82. package/dist/client/components/ui/alert.mjs +13 -68
  83. package/dist/client/components/ui/badge.mjs +9 -51
  84. package/dist/client/components/ui/button.mjs +8 -54
  85. package/dist/client/components/ui/card.mjs +37 -193
  86. package/dist/client/components/ui/checkbox.mjs +12 -68
  87. package/dist/client/components/ui/command.mjs +48 -219
  88. package/dist/client/components/ui/dialog.mjs +50 -262
  89. package/dist/client/components/ui/drawer.mjs +55 -259
  90. package/dist/client/components/ui/dropdown-menu.mjs +86 -427
  91. package/dist/client/components/ui/empty-state.mjs +28 -98
  92. package/dist/client/components/ui/field.mjs +73 -309
  93. package/dist/client/components/ui/input-group.mjs +42 -167
  94. package/dist/client/components/ui/input.mjs +7 -37
  95. package/dist/client/components/ui/kbd.mjs +6 -36
  96. package/dist/client/components/ui/label.mjs +7 -37
  97. package/dist/client/components/ui/popover.mjs +34 -169
  98. package/dist/client/components/ui/responsive-dialog.mjs +67 -273
  99. package/dist/client/components/ui/scroll-fade.mjs +63 -158
  100. package/dist/client/components/ui/search-input.mjs +33 -100
  101. package/dist/client/components/ui/select.mjs +72 -393
  102. package/dist/client/components/ui/separator.mjs +7 -38
  103. package/dist/client/components/ui/sheet.mjs +49 -269
  104. package/dist/client/components/ui/sidebar.mjs +171 -690
  105. package/dist/client/components/ui/skeleton.mjs +7 -38
  106. package/dist/client/components/ui/sonner.mjs +11 -42
  107. package/dist/client/components/ui/switch.mjs +9 -45
  108. package/dist/client/components/ui/table.mjs +48 -266
  109. package/dist/client/components/ui/tabs.mjs +26 -139
  110. package/dist/client/components/ui/textarea.mjs +6 -32
  111. package/dist/client/components/ui/tooltip.mjs +27 -129
  112. package/dist/client/components/widgets/chart-widget.mjs +174 -522
  113. package/dist/client/components/widgets/progress-widget.mjs +66 -172
  114. package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
  115. package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
  116. package/dist/client/components/widgets/stats-widget.mjs +41 -175
  117. package/dist/client/components/widgets/table-widget.mjs +9 -9
  118. package/dist/client/components/widgets/timeline-widget.mjs +86 -226
  119. package/dist/client/components/widgets/value-widget.mjs +74 -381
  120. package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
  121. package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
  122. package/dist/client/contexts/focus-context.mjs +63 -146
  123. package/dist/client/hooks/typed-hooks.mjs +241 -701
  124. package/dist/client/hooks/use-action.mjs +62 -198
  125. package/dist/client/hooks/use-admin-config.mjs +5 -35
  126. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  127. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  128. package/dist/client/hooks/use-audit-history.mjs +21 -69
  129. package/dist/client/hooks/use-brand.mjs +1 -9
  130. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  131. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  132. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  133. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  134. package/dist/client/hooks/use-collection.mjs +194 -614
  135. package/dist/client/hooks/use-current-user.mjs +0 -1
  136. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  137. package/dist/client/hooks/use-field-options.mjs +61 -202
  138. package/dist/client/hooks/use-global-fields.mjs +14 -46
  139. package/dist/client/hooks/use-global-meta.mjs +9 -30
  140. package/dist/client/hooks/use-global-schema.mjs +9 -30
  141. package/dist/client/hooks/use-global.mjs +63 -219
  142. package/dist/client/hooks/use-locks.mjs +117 -325
  143. package/dist/client/hooks/use-media-query.mjs +16 -36
  144. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  145. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  146. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  147. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  148. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  149. package/dist/client/hooks/use-saved-views.mjs +22 -103
  150. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  151. package/dist/client/hooks/use-search.mjs +31 -143
  152. package/dist/client/hooks/use-server-actions.mjs +18 -50
  153. package/dist/client/hooks/use-server-validation.mjs +72 -166
  154. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  155. package/dist/client/hooks/use-setup-status.mjs +12 -25
  156. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  157. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  158. package/dist/client/hooks/use-upload.mjs +54 -152
  159. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  160. package/dist/client/hooks/use-view-state.mjs +187 -437
  161. package/dist/client/i18n/hooks.mjs +65 -197
  162. package/dist/client/lib/render-profiler.mjs +14 -41
  163. package/dist/client/preview/block-scope-context.mjs +14 -36
  164. package/dist/client/preview/preview-banner.d.mts +2 -2
  165. package/dist/client/preview/preview-banner.mjs +42 -108
  166. package/dist/client/preview/preview-field.d.mts +4 -4
  167. package/dist/client/preview/preview-field.mjs +167 -348
  168. package/dist/client/preview/use-collection-preview.mjs +121 -215
  169. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  170. package/dist/client/runtime/locale-scope.mjs +22 -63
  171. package/dist/client/runtime/provider.mjs +100 -255
  172. package/dist/client/runtime/translations-provider.mjs +41 -107
  173. package/dist/client/scope/picker.mjs +86 -321
  174. package/dist/client/scope/provider.mjs +8 -17
  175. package/dist/client/utils/build-field-definitions-from-schema.mjs +4 -2
  176. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  177. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  178. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  179. package/dist/client/views/auth/auth-layout.mjs +104 -284
  180. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  181. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  182. package/dist/client/views/auth/invite-form.mjs +107 -442
  183. package/dist/client/views/auth/login-form.d.mts +2 -2
  184. package/dist/client/views/auth/login-form.mjs +116 -337
  185. package/dist/client/views/auth/reset-password-form.d.mts +2 -2
  186. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  187. package/dist/client/views/auth/setup-form.d.mts +2 -2
  188. package/dist/client/views/auth/setup-form.mjs +140 -478
  189. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  190. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
  191. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  192. package/dist/client/views/collection/cells/primitive-cells.mjs +116 -356
  193. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  194. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  195. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  196. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  197. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  198. package/dist/client/views/collection/field-renderer.mjs +58 -182
  199. package/dist/client/views/collection/form-view.mjs +284 -518
  200. package/dist/client/views/collection/table-view.mjs +231 -463
  201. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  202. package/dist/client/views/common/global-search.mjs +241 -560
  203. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  204. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  205. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  206. package/dist/client/views/globals/global-form-view.mjs +477 -1301
  207. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  208. package/dist/client/views/layout/admin-layout.mjs +83 -246
  209. package/dist/client/views/layout/admin-router.mjs +458 -1274
  210. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  211. package/dist/client/views/layout/admin-theme.mjs +30 -64
  212. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  213. package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.d.mts +2 -2
  216. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  217. package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
  218. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  219. package/dist/client/views/pages/invite-page.d.mts +2 -2
  220. package/dist/client/views/pages/invite-page.mjs +35 -90
  221. package/dist/client/views/pages/login-page.d.mts +2 -2
  222. package/dist/client/views/pages/login-page.mjs +41 -121
  223. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  224. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  225. package/dist/client/views/pages/setup-page.d.mts +2 -2
  226. package/dist/client/views/pages/setup-page.mjs +33 -95
  227. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  228. package/dist/server/adapters/index.d.mts +2 -0
  229. package/dist/server/adapters/nextjs.d.mts +1 -0
  230. package/dist/server/auth-helpers.d.mts +1 -0
  231. package/dist/server/modules/admin/.generated/module.d.mts +1 -0
  232. package/dist/server/modules/admin/collections/account.d.mts +46 -46
  233. package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
  234. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  235. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  236. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  237. package/dist/server/modules/admin/collections/assets.d.mts +39 -39
  238. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  239. package/dist/server/modules/admin/collections/user.d.mts +62 -62
  240. package/dist/server/modules/admin/collections/verification.d.mts +23 -23
  241. package/dist/server/modules/admin/index.d.mts +20 -19
  242. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  243. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  244. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  245. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  246. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  247. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  248. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  249. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  250. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
  251. package/dist/server/modules/audit/.generated/module.d.mts +6 -6
  252. package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
  253. package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
  254. package/dist/server.d.mts +2 -0
  255. package/package.json +3 -5
@@ -1,5 +1,4 @@
1
1
  import { useQuestpieQueryOptions } from "./use-questpie-query-options.mjs";
2
- import { c } from "react/compiler-runtime";
3
2
  import { useMutation, useQuery } from "@tanstack/react-query";
4
3
 
5
4
  //#region src/client/hooks/use-collection.ts
@@ -15,34 +14,15 @@ import { useMutation, useQuery } from "@tanstack/react-query";
15
14
  * ```
16
15
  */
17
16
  function useCollectionList(collection, options, queryOptions, realtimeOptions) {
18
- const $ = c(9);
19
17
  const { queryOpts, locale } = useQuestpieQueryOptions();
20
- let t0;
21
- if ($[0] !== collection || $[1] !== locale || $[2] !== options || $[3] !== queryOpts || $[4] !== realtimeOptions?.realtime) {
22
- const findOptions = {
23
- ...options,
24
- locale
25
- };
26
- t0 = queryOpts.collections[collection].find(findOptions, { realtime: realtimeOptions?.realtime });
27
- $[0] = collection;
28
- $[1] = locale;
29
- $[2] = options;
30
- $[3] = queryOpts;
31
- $[4] = realtimeOptions?.realtime;
32
- $[5] = t0;
33
- } else t0 = $[5];
34
- const baseQuery = t0;
35
- let t1;
36
- if ($[6] !== baseQuery || $[7] !== queryOptions) {
37
- t1 = {
38
- ...baseQuery,
39
- ...queryOptions
40
- };
41
- $[6] = baseQuery;
42
- $[7] = queryOptions;
43
- $[8] = t1;
44
- } else t1 = $[8];
45
- return useQuery(t1);
18
+ const findOptions = {
19
+ ...options,
20
+ locale
21
+ };
22
+ return useQuery({
23
+ ...queryOpts.collections[collection].find(findOptions, { realtime: realtimeOptions?.realtime }),
24
+ ...queryOptions
25
+ });
46
26
  }
47
27
  /**
48
28
  * Hook to count collection items with optional filters
@@ -62,34 +42,15 @@ function useCollectionList(collection, options, queryOptions, realtimeOptions) {
62
42
  * ```
63
43
  */
64
44
  function useCollectionCount(collection, options, queryOptions, realtimeOptions) {
65
- const $ = c(9);
66
45
  const { queryOpts, locale } = useQuestpieQueryOptions();
67
- let t0;
68
- if ($[0] !== collection || $[1] !== locale || $[2] !== options || $[3] !== queryOpts || $[4] !== realtimeOptions?.realtime) {
69
- const countOptions = {
70
- ...options,
71
- locale
72
- };
73
- t0 = queryOpts.collections[collection].count(countOptions, { realtime: realtimeOptions?.realtime });
74
- $[0] = collection;
75
- $[1] = locale;
76
- $[2] = options;
77
- $[3] = queryOpts;
78
- $[4] = realtimeOptions?.realtime;
79
- $[5] = t0;
80
- } else t0 = $[5];
81
- const baseQuery = t0;
82
- let t1;
83
- if ($[6] !== baseQuery || $[7] !== queryOptions) {
84
- t1 = {
85
- ...baseQuery,
86
- ...queryOptions
87
- };
88
- $[6] = baseQuery;
89
- $[7] = queryOptions;
90
- $[8] = t1;
91
- } else t1 = $[8];
92
- return useQuery(t1);
46
+ const countOptions = {
47
+ ...options,
48
+ locale
49
+ };
50
+ return useQuery({
51
+ ...queryOpts.collections[collection].count(countOptions, { realtime: realtimeOptions?.realtime }),
52
+ ...queryOptions
53
+ });
93
54
  }
94
55
  /**
95
56
  * Hook to fetch single collection item
@@ -103,33 +64,15 @@ function useCollectionCount(collection, options, queryOptions, realtimeOptions)
103
64
  * ```
104
65
  */
105
66
  function useCollectionItem(collection, id, options, queryOptions) {
106
- const $ = c(8);
107
67
  const { queryOpts, locale } = useQuestpieQueryOptions();
108
- const t0 = queryOpts.collections[collection];
109
- let t1;
110
- if ($[0] !== id || $[1] !== locale || $[2] !== options || $[3] !== t0) {
111
- t1 = t0.findOne({
68
+ return useQuery({
69
+ ...queryOpts.collections[collection].findOne({
112
70
  where: { id },
113
71
  locale,
114
72
  ...options
115
- });
116
- $[0] = id;
117
- $[1] = locale;
118
- $[2] = options;
119
- $[3] = t0;
120
- $[4] = t1;
121
- } else t1 = $[4];
122
- let t2;
123
- if ($[5] !== queryOptions || $[6] !== t1) {
124
- t2 = {
125
- ...t1,
126
- ...queryOptions
127
- };
128
- $[5] = queryOptions;
129
- $[6] = t1;
130
- $[7] = t2;
131
- } else t2 = $[7];
132
- return useQuery(t2);
73
+ }),
74
+ ...queryOptions
75
+ });
133
76
  }
134
77
  /**
135
78
  * Hook to create collection item
@@ -144,80 +87,32 @@ function useCollectionItem(collection, id, options, queryOptions) {
144
87
  * ```
145
88
  */
146
89
  function useCollectionCreate(collection, mutationOptions) {
147
- const $ = c(22);
148
90
  const { queryOpts, queryClient, locale } = useQuestpieQueryOptions();
149
- const t0 = queryOpts.collections[collection];
150
- let t1;
151
- if ($[0] !== t0) {
152
- t1 = t0.create();
153
- $[0] = t0;
154
- $[1] = t1;
155
- } else t1 = $[1];
156
- const baseOptions = t1;
157
- let t2;
158
- if ($[2] !== collection || $[3] !== locale || $[4] !== queryOpts) {
159
- t2 = queryOpts.key([
160
- "collections",
161
- collection,
162
- "find",
163
- locale
164
- ]);
165
- $[2] = collection;
166
- $[3] = locale;
167
- $[4] = queryOpts;
168
- $[5] = t2;
169
- } else t2 = $[5];
170
- const listQueryKey = t2;
171
- let t3;
172
- if ($[6] !== collection || $[7] !== locale || $[8] !== queryOpts) {
173
- t3 = queryOpts.key([
174
- "collections",
175
- collection,
176
- "count",
177
- locale
178
- ]);
179
- $[6] = collection;
180
- $[7] = locale;
181
- $[8] = queryOpts;
182
- $[9] = t3;
183
- } else t3 = $[9];
184
- const countQueryKey = t3;
185
- let t4;
186
- if ($[10] !== mutationOptions?.onSuccess) {
187
- t4 = (data, variables, context) => {
91
+ const baseOptions = queryOpts.collections[collection].create();
92
+ const listQueryKey = queryOpts.key([
93
+ "collections",
94
+ collection,
95
+ "find",
96
+ locale
97
+ ]);
98
+ const countQueryKey = queryOpts.key([
99
+ "collections",
100
+ collection,
101
+ "count",
102
+ locale
103
+ ]);
104
+ return useMutation({
105
+ ...baseOptions,
106
+ onSuccess: (data, variables, context) => {
188
107
  (mutationOptions?.onSuccess)?.(data, variables, context);
189
- };
190
- $[10] = mutationOptions?.onSuccess;
191
- $[11] = t4;
192
- } else t4 = $[11];
193
- let t5;
194
- if ($[12] !== countQueryKey || $[13] !== listQueryKey || $[14] !== mutationOptions?.onSettled || $[15] !== queryClient) {
195
- t5 = (data_0, error, variables_0, context_0) => {
108
+ },
109
+ onSettled: (data, error, variables, context) => {
196
110
  queryClient.invalidateQueries({ queryKey: listQueryKey });
197
111
  queryClient.invalidateQueries({ queryKey: countQueryKey });
198
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
199
- };
200
- $[12] = countQueryKey;
201
- $[13] = listQueryKey;
202
- $[14] = mutationOptions?.onSettled;
203
- $[15] = queryClient;
204
- $[16] = t5;
205
- } else t5 = $[16];
206
- let t6;
207
- if ($[17] !== baseOptions || $[18] !== mutationOptions || $[19] !== t4 || $[20] !== t5) {
208
- t6 = {
209
- ...baseOptions,
210
- onSuccess: t4,
211
- onSettled: t5,
212
- ...mutationOptions
213
- };
214
- $[17] = baseOptions;
215
- $[18] = mutationOptions;
216
- $[19] = t4;
217
- $[20] = t5;
218
- $[21] = t6;
219
- } else t6 = $[21];
220
- return useMutation(t6);
112
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
113
+ },
114
+ ...mutationOptions
115
+ });
221
116
  }
222
117
  /**
223
118
  * Hook to update collection item
@@ -232,191 +127,76 @@ function useCollectionCreate(collection, mutationOptions) {
232
127
  * ```
233
128
  */
234
129
  function useCollectionUpdate(collection, mutationOptions) {
235
- const $ = c(27);
236
130
  const { queryOpts, queryClient, locale } = useQuestpieQueryOptions();
237
- const t0 = queryOpts.collections[collection];
238
- let t1;
239
- if ($[0] !== t0) {
240
- t1 = t0.update();
241
- $[0] = t0;
242
- $[1] = t1;
243
- } else t1 = $[1];
244
- const baseOptions = t1;
245
- let t2;
246
- if ($[2] !== collection || $[3] !== locale || $[4] !== queryOpts) {
247
- t2 = queryOpts.key([
248
- "collections",
249
- collection,
250
- "find",
251
- locale
252
- ]);
253
- $[2] = collection;
254
- $[3] = locale;
255
- $[4] = queryOpts;
256
- $[5] = t2;
257
- } else t2 = $[5];
258
- const listQueryKey = t2;
259
- let t3;
260
- if ($[6] !== collection || $[7] !== locale || $[8] !== queryOpts) {
261
- t3 = queryOpts.key([
262
- "collections",
263
- collection,
264
- "count",
265
- locale
266
- ]);
267
- $[6] = collection;
268
- $[7] = locale;
269
- $[8] = queryOpts;
270
- $[9] = t3;
271
- } else t3 = $[9];
272
- const countQueryKey = t3;
273
- let t4;
274
- if ($[10] !== collection || $[11] !== locale || $[12] !== queryOpts) {
275
- t4 = queryOpts.key([
276
- "collections",
277
- collection,
278
- "findOne",
279
- locale
280
- ]);
281
- $[10] = collection;
282
- $[11] = locale;
283
- $[12] = queryOpts;
284
- $[13] = t4;
285
- } else t4 = $[13];
286
- const itemQueryKey = t4;
287
- let t5;
288
- if ($[14] !== mutationOptions?.onSuccess) {
289
- t5 = (data, variables, context) => {
131
+ const baseOptions = queryOpts.collections[collection].update();
132
+ const listQueryKey = queryOpts.key([
133
+ "collections",
134
+ collection,
135
+ "find",
136
+ locale
137
+ ]);
138
+ const countQueryKey = queryOpts.key([
139
+ "collections",
140
+ collection,
141
+ "count",
142
+ locale
143
+ ]);
144
+ const itemQueryKey = queryOpts.key([
145
+ "collections",
146
+ collection,
147
+ "findOne",
148
+ locale
149
+ ]);
150
+ return useMutation({
151
+ ...baseOptions,
152
+ onSuccess: (data, variables, context) => {
290
153
  (mutationOptions?.onSuccess)?.(data, variables, context);
291
- };
292
- $[14] = mutationOptions?.onSuccess;
293
- $[15] = t5;
294
- } else t5 = $[15];
295
- let t6;
296
- if ($[16] !== countQueryKey || $[17] !== itemQueryKey || $[18] !== listQueryKey || $[19] !== mutationOptions?.onSettled || $[20] !== queryClient) {
297
- t6 = (data_0, error, variables_0, context_0) => {
154
+ },
155
+ onSettled: (data, error, variables, context) => {
298
156
  queryClient.invalidateQueries({ queryKey: listQueryKey });
299
157
  queryClient.invalidateQueries({ queryKey: countQueryKey });
300
158
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
301
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
302
- };
303
- $[16] = countQueryKey;
304
- $[17] = itemQueryKey;
305
- $[18] = listQueryKey;
306
- $[19] = mutationOptions?.onSettled;
307
- $[20] = queryClient;
308
- $[21] = t6;
309
- } else t6 = $[21];
310
- let t7;
311
- if ($[22] !== baseOptions || $[23] !== mutationOptions || $[24] !== t5 || $[25] !== t6) {
312
- t7 = {
313
- ...baseOptions,
314
- onSuccess: t5,
315
- onSettled: t6,
316
- ...mutationOptions
317
- };
318
- $[22] = baseOptions;
319
- $[23] = mutationOptions;
320
- $[24] = t5;
321
- $[25] = t6;
322
- $[26] = t7;
323
- } else t7 = $[26];
324
- return useMutation(t7);
159
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
160
+ },
161
+ ...mutationOptions
162
+ });
325
163
  }
326
164
  /**
327
165
  * Hook to update multiple collection items with distinct data per record.
328
166
  */
329
167
  function useCollectionUpdateBatch(collection, mutationOptions) {
330
- const $ = c(29);
331
168
  const { client, queryOpts, queryClient, locale } = useQuestpieQueryOptions();
332
- let t0;
333
- if ($[0] !== collection || $[1] !== locale || $[2] !== queryOpts) {
334
- t0 = queryOpts.key([
335
- "collections",
336
- collection,
337
- "find",
338
- locale
339
- ]);
340
- $[0] = collection;
341
- $[1] = locale;
342
- $[2] = queryOpts;
343
- $[3] = t0;
344
- } else t0 = $[3];
345
- const listQueryKey = t0;
346
- let t1;
347
- if ($[4] !== collection || $[5] !== locale || $[6] !== queryOpts) {
348
- t1 = queryOpts.key([
349
- "collections",
350
- collection,
351
- "count",
352
- locale
353
- ]);
354
- $[4] = collection;
355
- $[5] = locale;
356
- $[6] = queryOpts;
357
- $[7] = t1;
358
- } else t1 = $[7];
359
- const countQueryKey = t1;
360
- let t2;
361
- if ($[8] !== collection || $[9] !== locale || $[10] !== queryOpts) {
362
- t2 = queryOpts.key([
363
- "collections",
364
- collection,
365
- "findOne",
366
- locale
367
- ]);
368
- $[8] = collection;
369
- $[9] = locale;
370
- $[10] = queryOpts;
371
- $[11] = t2;
372
- } else t2 = $[11];
373
- const itemQueryKey = t2;
374
- let t3;
375
- if ($[12] !== client || $[13] !== collection || $[14] !== locale) {
376
- t3 = (params) => client.collections[collection].updateBatch(params, { locale });
377
- $[12] = client;
378
- $[13] = collection;
379
- $[14] = locale;
380
- $[15] = t3;
381
- } else t3 = $[15];
382
- let t4;
383
- if ($[16] !== mutationOptions?.onSuccess) {
384
- t4 = (data, variables, context) => {
169
+ const listQueryKey = queryOpts.key([
170
+ "collections",
171
+ collection,
172
+ "find",
173
+ locale
174
+ ]);
175
+ const countQueryKey = queryOpts.key([
176
+ "collections",
177
+ collection,
178
+ "count",
179
+ locale
180
+ ]);
181
+ const itemQueryKey = queryOpts.key([
182
+ "collections",
183
+ collection,
184
+ "findOne",
185
+ locale
186
+ ]);
187
+ return useMutation({
188
+ mutationFn: (params) => client.collections[collection].updateBatch(params, { locale }),
189
+ onSuccess: (data, variables, context) => {
385
190
  (mutationOptions?.onSuccess)?.(data, variables, context);
386
- };
387
- $[16] = mutationOptions?.onSuccess;
388
- $[17] = t4;
389
- } else t4 = $[17];
390
- let t5;
391
- if ($[18] !== countQueryKey || $[19] !== itemQueryKey || $[20] !== listQueryKey || $[21] !== mutationOptions?.onSettled || $[22] !== queryClient) {
392
- t5 = (data_0, error, variables_0, context_0) => {
191
+ },
192
+ onSettled: (data, error, variables, context) => {
393
193
  queryClient.invalidateQueries({ queryKey: listQueryKey });
394
194
  queryClient.invalidateQueries({ queryKey: countQueryKey });
395
195
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
396
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
397
- };
398
- $[18] = countQueryKey;
399
- $[19] = itemQueryKey;
400
- $[20] = listQueryKey;
401
- $[21] = mutationOptions?.onSettled;
402
- $[22] = queryClient;
403
- $[23] = t5;
404
- } else t5 = $[23];
405
- let t6;
406
- if ($[24] !== mutationOptions || $[25] !== t3 || $[26] !== t4 || $[27] !== t5) {
407
- t6 = {
408
- mutationFn: t3,
409
- onSuccess: t4,
410
- onSettled: t5,
411
- ...mutationOptions
412
- };
413
- $[24] = mutationOptions;
414
- $[25] = t3;
415
- $[26] = t4;
416
- $[27] = t5;
417
- $[28] = t6;
418
- } else t6 = $[28];
419
- return useMutation(t6);
196
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
197
+ },
198
+ ...mutationOptions
199
+ });
420
200
  }
421
201
  /**
422
202
  * Hook to delete collection item
@@ -431,337 +211,137 @@ function useCollectionUpdateBatch(collection, mutationOptions) {
431
211
  * ```
432
212
  */
433
213
  function useCollectionDelete(collection, mutationOptions) {
434
- const $ = c(27);
435
214
  const { queryOpts, queryClient, locale } = useQuestpieQueryOptions();
436
- const t0 = queryOpts.collections[collection];
437
- let t1;
438
- if ($[0] !== t0) {
439
- t1 = t0.delete();
440
- $[0] = t0;
441
- $[1] = t1;
442
- } else t1 = $[1];
443
- const baseOptions = t1;
444
- let t2;
445
- if ($[2] !== collection || $[3] !== locale || $[4] !== queryOpts) {
446
- t2 = queryOpts.key([
447
- "collections",
448
- collection,
449
- "find",
450
- locale
451
- ]);
452
- $[2] = collection;
453
- $[3] = locale;
454
- $[4] = queryOpts;
455
- $[5] = t2;
456
- } else t2 = $[5];
457
- const listQueryKey = t2;
458
- let t3;
459
- if ($[6] !== collection || $[7] !== locale || $[8] !== queryOpts) {
460
- t3 = queryOpts.key([
461
- "collections",
462
- collection,
463
- "count",
464
- locale
465
- ]);
466
- $[6] = collection;
467
- $[7] = locale;
468
- $[8] = queryOpts;
469
- $[9] = t3;
470
- } else t3 = $[9];
471
- const countQueryKey = t3;
472
- let t4;
473
- if ($[10] !== collection || $[11] !== locale || $[12] !== queryOpts) {
474
- t4 = queryOpts.key([
475
- "collections",
476
- collection,
477
- "findOne",
478
- locale
479
- ]);
480
- $[10] = collection;
481
- $[11] = locale;
482
- $[12] = queryOpts;
483
- $[13] = t4;
484
- } else t4 = $[13];
485
- const itemQueryKey = t4;
486
- let t5;
487
- if ($[14] !== mutationOptions?.onSuccess) {
488
- t5 = (data, variables, context) => {
215
+ const baseOptions = queryOpts.collections[collection].delete();
216
+ const listQueryKey = queryOpts.key([
217
+ "collections",
218
+ collection,
219
+ "find",
220
+ locale
221
+ ]);
222
+ const countQueryKey = queryOpts.key([
223
+ "collections",
224
+ collection,
225
+ "count",
226
+ locale
227
+ ]);
228
+ const itemQueryKey = queryOpts.key([
229
+ "collections",
230
+ collection,
231
+ "findOne",
232
+ locale
233
+ ]);
234
+ return useMutation({
235
+ ...baseOptions,
236
+ onSuccess: (data, variables, context) => {
489
237
  (mutationOptions?.onSuccess)?.(data, variables, context);
490
- };
491
- $[14] = mutationOptions?.onSuccess;
492
- $[15] = t5;
493
- } else t5 = $[15];
494
- let t6;
495
- if ($[16] !== countQueryKey || $[17] !== itemQueryKey || $[18] !== listQueryKey || $[19] !== mutationOptions?.onSettled || $[20] !== queryClient) {
496
- t6 = (data_0, error, variables_0, context_0) => {
238
+ },
239
+ onSettled: (data, error, variables, context) => {
497
240
  queryClient.invalidateQueries({ queryKey: listQueryKey });
498
241
  queryClient.invalidateQueries({ queryKey: countQueryKey });
499
242
  queryClient.removeQueries({ queryKey: itemQueryKey });
500
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
501
- };
502
- $[16] = countQueryKey;
503
- $[17] = itemQueryKey;
504
- $[18] = listQueryKey;
505
- $[19] = mutationOptions?.onSettled;
506
- $[20] = queryClient;
507
- $[21] = t6;
508
- } else t6 = $[21];
509
- let t7;
510
- if ($[22] !== baseOptions || $[23] !== mutationOptions || $[24] !== t5 || $[25] !== t6) {
511
- t7 = {
512
- ...baseOptions,
513
- onSuccess: t5,
514
- onSettled: t6,
515
- ...mutationOptions
516
- };
517
- $[22] = baseOptions;
518
- $[23] = mutationOptions;
519
- $[24] = t5;
520
- $[25] = t6;
521
- $[26] = t7;
522
- } else t7 = $[26];
523
- return useMutation(t7);
243
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
244
+ },
245
+ ...mutationOptions
246
+ });
524
247
  }
525
248
  /**
526
249
  * Hook to restore soft-deleted collection item
527
250
  */
528
251
  function useCollectionRestore(collection, mutationOptions) {
529
- const $ = c(27);
530
252
  const { queryOpts, queryClient, locale } = useQuestpieQueryOptions();
531
- const t0 = queryOpts.collections[collection];
532
- let t1;
533
- if ($[0] !== t0) {
534
- t1 = t0.restore();
535
- $[0] = t0;
536
- $[1] = t1;
537
- } else t1 = $[1];
538
- const baseOptions = t1;
539
- let t2;
540
- if ($[2] !== collection || $[3] !== locale || $[4] !== queryOpts) {
541
- t2 = queryOpts.key([
542
- "collections",
543
- collection,
544
- "find",
545
- locale
546
- ]);
547
- $[2] = collection;
548
- $[3] = locale;
549
- $[4] = queryOpts;
550
- $[5] = t2;
551
- } else t2 = $[5];
552
- const listQueryKey = t2;
553
- let t3;
554
- if ($[6] !== collection || $[7] !== locale || $[8] !== queryOpts) {
555
- t3 = queryOpts.key([
556
- "collections",
557
- collection,
558
- "count",
559
- locale
560
- ]);
561
- $[6] = collection;
562
- $[7] = locale;
563
- $[8] = queryOpts;
564
- $[9] = t3;
565
- } else t3 = $[9];
566
- const countQueryKey = t3;
567
- let t4;
568
- if ($[10] !== collection || $[11] !== locale || $[12] !== queryOpts) {
569
- t4 = queryOpts.key([
570
- "collections",
571
- collection,
572
- "findOne",
573
- locale
574
- ]);
575
- $[10] = collection;
576
- $[11] = locale;
577
- $[12] = queryOpts;
578
- $[13] = t4;
579
- } else t4 = $[13];
580
- const itemQueryKey = t4;
581
- let t5;
582
- if ($[14] !== mutationOptions?.onSuccess) {
583
- t5 = (data, variables, context) => {
253
+ const baseOptions = queryOpts.collections[collection].restore();
254
+ const listQueryKey = queryOpts.key([
255
+ "collections",
256
+ collection,
257
+ "find",
258
+ locale
259
+ ]);
260
+ const countQueryKey = queryOpts.key([
261
+ "collections",
262
+ collection,
263
+ "count",
264
+ locale
265
+ ]);
266
+ const itemQueryKey = queryOpts.key([
267
+ "collections",
268
+ collection,
269
+ "findOne",
270
+ locale
271
+ ]);
272
+ return useMutation({
273
+ ...baseOptions,
274
+ onSuccess: (data, variables, context) => {
584
275
  (mutationOptions?.onSuccess)?.(data, variables, context);
585
- };
586
- $[14] = mutationOptions?.onSuccess;
587
- $[15] = t5;
588
- } else t5 = $[15];
589
- let t6;
590
- if ($[16] !== countQueryKey || $[17] !== itemQueryKey || $[18] !== listQueryKey || $[19] !== mutationOptions?.onSettled || $[20] !== queryClient) {
591
- t6 = (data_0, error, variables_0, context_0) => {
276
+ },
277
+ onSettled: (data, error, variables, context) => {
592
278
  queryClient.invalidateQueries({ queryKey: listQueryKey });
593
279
  queryClient.invalidateQueries({ queryKey: countQueryKey });
594
280
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
595
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
596
- };
597
- $[16] = countQueryKey;
598
- $[17] = itemQueryKey;
599
- $[18] = listQueryKey;
600
- $[19] = mutationOptions?.onSettled;
601
- $[20] = queryClient;
602
- $[21] = t6;
603
- } else t6 = $[21];
604
- let t7;
605
- if ($[22] !== baseOptions || $[23] !== mutationOptions || $[24] !== t5 || $[25] !== t6) {
606
- t7 = {
607
- ...baseOptions,
608
- onSuccess: t5,
609
- onSettled: t6,
610
- ...mutationOptions
611
- };
612
- $[22] = baseOptions;
613
- $[23] = mutationOptions;
614
- $[24] = t5;
615
- $[25] = t6;
616
- $[26] = t7;
617
- } else t7 = $[26];
618
- return useMutation(t7);
281
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
282
+ },
283
+ ...mutationOptions
284
+ });
619
285
  }
620
286
  /**
621
287
  * Hook to fetch version history for a collection item
622
288
  */
623
289
  function useCollectionVersions(collection, id, options, queryOptions) {
624
- const $ = c(8);
625
290
  const { queryOpts } = useQuestpieQueryOptions();
626
- const t0 = queryOpts.collections[collection];
627
- let t1;
628
- if ($[0] !== id || $[1] !== options || $[2] !== t0) {
629
- t1 = t0.findVersions({
291
+ return useQuery({
292
+ ...queryOpts.collections[collection].findVersions({
630
293
  id,
631
294
  ...options?.limit !== void 0 ? { limit: options.limit } : {},
632
295
  ...options?.offset !== void 0 ? { offset: options.offset } : {}
633
- });
634
- $[0] = id;
635
- $[1] = options;
636
- $[2] = t0;
637
- $[3] = t1;
638
- } else t1 = $[3];
639
- const baseQuery = t1;
640
- const t2 = !!id && (queryOptions?.enabled ?? true);
641
- let t3;
642
- if ($[4] !== baseQuery || $[5] !== queryOptions || $[6] !== t2) {
643
- t3 = {
644
- ...baseQuery,
645
- enabled: t2,
646
- ...queryOptions
647
- };
648
- $[4] = baseQuery;
649
- $[5] = queryOptions;
650
- $[6] = t2;
651
- $[7] = t3;
652
- } else t3 = $[7];
653
- return useQuery(t3);
296
+ }),
297
+ enabled: !!id && (queryOptions?.enabled ?? true),
298
+ ...queryOptions
299
+ });
654
300
  }
655
301
  /**
656
302
  * Hook to revert a collection item to a previous version
657
303
  */
658
304
  function useCollectionRevertVersion(collection, mutationOptions) {
659
- const $ = c(32);
660
305
  const { queryOpts, queryClient, locale } = useQuestpieQueryOptions();
661
- const t0 = queryOpts.collections[collection];
662
- let t1;
663
- if ($[0] !== t0) {
664
- t1 = t0.revertToVersion();
665
- $[0] = t0;
666
- $[1] = t1;
667
- } else t1 = $[1];
668
- const baseOptions = t1;
669
- let t2;
670
- if ($[2] !== collection || $[3] !== locale || $[4] !== queryOpts) {
671
- t2 = queryOpts.key([
672
- "collections",
673
- collection,
674
- "find",
675
- locale
676
- ]);
677
- $[2] = collection;
678
- $[3] = locale;
679
- $[4] = queryOpts;
680
- $[5] = t2;
681
- } else t2 = $[5];
682
- const listQueryKey = t2;
683
- let t3;
684
- if ($[6] !== collection || $[7] !== locale || $[8] !== queryOpts) {
685
- t3 = queryOpts.key([
686
- "collections",
687
- collection,
688
- "count",
689
- locale
690
- ]);
691
- $[6] = collection;
692
- $[7] = locale;
693
- $[8] = queryOpts;
694
- $[9] = t3;
695
- } else t3 = $[9];
696
- const countQueryKey = t3;
697
- let t4;
698
- if ($[10] !== collection || $[11] !== locale || $[12] !== queryOpts) {
699
- t4 = queryOpts.key([
700
- "collections",
701
- collection,
702
- "findOne",
703
- locale
704
- ]);
705
- $[10] = collection;
706
- $[11] = locale;
707
- $[12] = queryOpts;
708
- $[13] = t4;
709
- } else t4 = $[13];
710
- const itemQueryKey = t4;
711
- let t5;
712
- if ($[14] !== collection || $[15] !== locale || $[16] !== queryOpts) {
713
- t5 = queryOpts.key([
714
- "collections",
715
- collection,
716
- "findVersions",
717
- locale
718
- ]);
719
- $[14] = collection;
720
- $[15] = locale;
721
- $[16] = queryOpts;
722
- $[17] = t5;
723
- } else t5 = $[17];
724
- const versionsQueryKey = t5;
725
- let t6;
726
- if ($[18] !== mutationOptions?.onSuccess) {
727
- t6 = (data, variables, context) => {
306
+ const baseOptions = queryOpts.collections[collection].revertToVersion();
307
+ const listQueryKey = queryOpts.key([
308
+ "collections",
309
+ collection,
310
+ "find",
311
+ locale
312
+ ]);
313
+ const countQueryKey = queryOpts.key([
314
+ "collections",
315
+ collection,
316
+ "count",
317
+ locale
318
+ ]);
319
+ const itemQueryKey = queryOpts.key([
320
+ "collections",
321
+ collection,
322
+ "findOne",
323
+ locale
324
+ ]);
325
+ const versionsQueryKey = queryOpts.key([
326
+ "collections",
327
+ collection,
328
+ "findVersions",
329
+ locale
330
+ ]);
331
+ return useMutation({
332
+ ...baseOptions,
333
+ onSuccess: (data, variables, context) => {
728
334
  (mutationOptions?.onSuccess)?.(data, variables, context);
729
- };
730
- $[18] = mutationOptions?.onSuccess;
731
- $[19] = t6;
732
- } else t6 = $[19];
733
- let t7;
734
- if ($[20] !== countQueryKey || $[21] !== itemQueryKey || $[22] !== listQueryKey || $[23] !== mutationOptions?.onSettled || $[24] !== queryClient || $[25] !== versionsQueryKey) {
735
- t7 = (data_0, error, variables_0, context_0) => {
335
+ },
336
+ onSettled: (data, error, variables, context) => {
736
337
  queryClient.invalidateQueries({ queryKey: listQueryKey });
737
338
  queryClient.invalidateQueries({ queryKey: countQueryKey });
738
339
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
739
340
  queryClient.invalidateQueries({ queryKey: versionsQueryKey });
740
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
741
- };
742
- $[20] = countQueryKey;
743
- $[21] = itemQueryKey;
744
- $[22] = listQueryKey;
745
- $[23] = mutationOptions?.onSettled;
746
- $[24] = queryClient;
747
- $[25] = versionsQueryKey;
748
- $[26] = t7;
749
- } else t7 = $[26];
750
- let t8;
751
- if ($[27] !== baseOptions || $[28] !== mutationOptions || $[29] !== t6 || $[30] !== t7) {
752
- t8 = {
753
- ...baseOptions,
754
- onSuccess: t6,
755
- onSettled: t7,
756
- ...mutationOptions
757
- };
758
- $[27] = baseOptions;
759
- $[28] = mutationOptions;
760
- $[29] = t6;
761
- $[30] = t7;
762
- $[31] = t8;
763
- } else t8 = $[31];
764
- return useMutation(t8);
341
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
342
+ },
343
+ ...mutationOptions
344
+ });
765
345
  }
766
346
 
767
347
  //#endregion