@questpie/admin 3.2.3 → 3.2.5

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 (244) 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 +106 -220
  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 +107 -313
  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 -182
  47. package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
  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 +196 -530
  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 +39 -74
  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 +306 -611
  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 +177 -494
  68. package/dist/client/components/preview/live-preview-mode.mjs +240 -438
  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 +200 -559
  77. package/dist/client/components/primitives/select-single.mjs +165 -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.d.mts +4 -0
  123. package/dist/client/contexts/focus-context.mjs +87 -150
  124. package/dist/client/hooks/typed-hooks.mjs +241 -701
  125. package/dist/client/hooks/use-action.mjs +62 -198
  126. package/dist/client/hooks/use-admin-config.mjs +5 -35
  127. package/dist/client/hooks/use-admin-preferences.mjs +16 -88
  128. package/dist/client/hooks/use-admin-routes.mjs +22 -56
  129. package/dist/client/hooks/use-audit-history.mjs +21 -69
  130. package/dist/client/hooks/use-brand.mjs +1 -9
  131. package/dist/client/hooks/use-collection-fields.mjs +17 -57
  132. package/dist/client/hooks/use-collection-meta.mjs +12 -44
  133. package/dist/client/hooks/use-collection-schema.mjs +10 -33
  134. package/dist/client/hooks/use-collection-validation.mjs +23 -53
  135. package/dist/client/hooks/use-collection.mjs +194 -614
  136. package/dist/client/hooks/use-current-user.mjs +0 -1
  137. package/dist/client/hooks/use-field-hooks.mjs +10 -10
  138. package/dist/client/hooks/use-field-options.mjs +61 -202
  139. package/dist/client/hooks/use-global-fields.mjs +14 -46
  140. package/dist/client/hooks/use-global-meta.mjs +9 -30
  141. package/dist/client/hooks/use-global-schema.mjs +9 -30
  142. package/dist/client/hooks/use-global.mjs +63 -219
  143. package/dist/client/hooks/use-locks.mjs +117 -325
  144. package/dist/client/hooks/use-media-query.mjs +16 -36
  145. package/dist/client/hooks/use-prefill-params.mjs +0 -1
  146. package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
  147. package/dist/client/hooks/use-reactive-fields.mjs +1 -1
  148. package/dist/client/hooks/use-reactive-prop.mjs +65 -223
  149. package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
  150. package/dist/client/hooks/use-saved-views.mjs +22 -103
  151. package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
  152. package/dist/client/hooks/use-search.mjs +31 -143
  153. package/dist/client/hooks/use-server-actions.mjs +18 -50
  154. package/dist/client/hooks/use-server-validation.mjs +72 -166
  155. package/dist/client/hooks/use-server-widget-data.mjs +7 -33
  156. package/dist/client/hooks/use-setup-status.mjs +12 -25
  157. package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
  158. package/dist/client/hooks/use-transition-stage.mjs +8 -38
  159. package/dist/client/hooks/use-upload.mjs +54 -152
  160. package/dist/client/hooks/use-validation-error-map.mjs +6 -26
  161. package/dist/client/hooks/use-view-state.mjs +187 -437
  162. package/dist/client/i18n/hooks.mjs +65 -197
  163. package/dist/client/lib/render-profiler.mjs +14 -41
  164. package/dist/client/preview/block-scope-context.d.mts +2 -2
  165. package/dist/client/preview/block-scope-context.mjs +14 -36
  166. package/dist/client/preview/diff.mjs +110 -0
  167. package/dist/client/preview/preview-banner.mjs +42 -108
  168. package/dist/client/preview/preview-field.d.mts +4 -4
  169. package/dist/client/preview/preview-field.mjs +166 -409
  170. package/dist/client/preview/use-collection-preview.mjs +135 -201
  171. package/dist/client/runtime/content-locales-provider.mjs +31 -83
  172. package/dist/client/runtime/locale-scope.mjs +22 -63
  173. package/dist/client/runtime/provider.mjs +100 -255
  174. package/dist/client/runtime/translations-provider.mjs +41 -107
  175. package/dist/client/scope/picker.d.mts +2 -2
  176. package/dist/client/scope/picker.mjs +86 -321
  177. package/dist/client/scope/provider.d.mts +2 -2
  178. package/dist/client/scope/provider.mjs +8 -17
  179. package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
  180. package/dist/client/views/auth/accept-invite-form.mjs +121 -412
  181. package/dist/client/views/auth/auth-layout.d.mts +3 -3
  182. package/dist/client/views/auth/auth-layout.mjs +104 -284
  183. package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
  184. package/dist/client/views/auth/forgot-password-form.mjs +94 -325
  185. package/dist/client/views/auth/invite-form.mjs +107 -442
  186. package/dist/client/views/auth/login-form.d.mts +2 -2
  187. package/dist/client/views/auth/login-form.mjs +116 -337
  188. package/dist/client/views/auth/reset-password-form.mjs +128 -453
  189. package/dist/client/views/auth/setup-form.mjs +140 -478
  190. package/dist/client/views/collection/auto-form-fields.mjs +243 -615
  191. package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
  192. package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
  193. package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
  194. package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
  195. package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
  196. package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
  197. package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
  198. package/dist/client/views/collection/columns/build-columns.mjs +8 -48
  199. package/dist/client/views/collection/field-renderer.mjs +11 -24
  200. package/dist/client/views/collection/form-view.mjs +288 -560
  201. package/dist/client/views/collection/table-view.mjs +239 -469
  202. package/dist/client/views/collection/view-skeletons.mjs +112 -237
  203. package/dist/client/views/common/global-search.mjs +241 -543
  204. package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
  205. package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
  206. package/dist/client/views/dashboard/widget-card.mjs +61 -269
  207. package/dist/client/views/globals/global-form-view.mjs +478 -1298
  208. package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
  209. package/dist/client/views/layout/admin-layout.mjs +83 -246
  210. package/dist/client/views/layout/admin-router.mjs +457 -1289
  211. package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
  212. package/dist/client/views/layout/admin-theme.mjs +30 -64
  213. package/dist/client/views/layout/admin-view-layout.mjs +40 -144
  214. package/dist/client/views/pages/accept-invite-page.mjs +95 -290
  215. package/dist/client/views/pages/dashboard-page.mjs +11 -57
  216. package/dist/client/views/pages/forgot-password-page.mjs +31 -83
  217. package/dist/client/views/pages/invite-page.mjs +35 -90
  218. package/dist/client/views/pages/login-page.mjs +41 -121
  219. package/dist/client/views/pages/reset-password-page.d.mts +2 -2
  220. package/dist/client/views/pages/reset-password-page.mjs +46 -173
  221. package/dist/client/views/pages/setup-page.d.mts +2 -2
  222. package/dist/client/views/pages/setup-page.mjs +33 -95
  223. package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
  224. package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
  225. package/dist/server/modules/admin/collections/account.d.mts +50 -50
  226. package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
  227. package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
  228. package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
  229. package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
  230. package/dist/server/modules/admin/collections/assets.d.mts +34 -34
  231. package/dist/server/modules/admin/collections/session.d.mts +42 -42
  232. package/dist/server/modules/admin/collections/user.d.mts +53 -53
  233. package/dist/server/modules/admin/collections/verification.d.mts +36 -36
  234. package/dist/server/modules/admin/index.d.mts +21 -20
  235. package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
  236. package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
  237. package/dist/server/modules/admin/routes/locales.d.mts +2 -2
  238. package/dist/server/modules/admin/routes/preview.d.mts +11 -11
  239. package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
  240. package/dist/server/modules/admin/routes/setup.d.mts +7 -7
  241. package/dist/server/modules/admin/routes/translations.d.mts +4 -4
  242. package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
  243. package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
  244. package/package.json +3 -5
@@ -1,6 +1,5 @@
1
1
  import { selectClient, selectContentLocale, useAdminStore } from "../runtime/provider.mjs";
2
2
  import { useScopedLocale } from "../runtime/locale-scope.mjs";
3
- import { c } from "react/compiler-runtime";
4
3
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
4
  import { createQuestpieQueryOptions } from "@questpie/tanstack-query";
6
5
 
@@ -58,814 +57,355 @@ import { createQuestpieQueryOptions } from "@questpie/tanstack-query";
58
57
  */
59
58
  function createTypedHooks() {
60
59
  function useCollectionList(collection, options, queryOptions) {
61
- const $ = c(9);
62
60
  const client = useAdminStore(selectClient);
63
61
  const { locale: contentLocale } = useScopedLocale();
64
- let t0;
65
- let t1;
66
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale || $[3] !== options) {
67
- const queryOpts = createQuestpieQueryOptions(client, {
62
+ return useQuery({
63
+ ...createQuestpieQueryOptions(client, {
68
64
  keyPrefix: ["questpie", "collections"],
69
65
  locale: contentLocale
70
- });
71
- t1 = useQuery;
72
- t0 = queryOpts.collections[collection].find({
66
+ }).collections[collection].find({
73
67
  ...options,
74
68
  locale: contentLocale
75
- });
76
- $[0] = client;
77
- $[1] = collection;
78
- $[2] = contentLocale;
79
- $[3] = options;
80
- $[4] = t0;
81
- $[5] = t1;
82
- } else {
83
- t0 = $[4];
84
- t1 = $[5];
85
- }
86
- let t2;
87
- if ($[6] !== queryOptions || $[7] !== t0) {
88
- t2 = {
89
- ...t0,
90
- ...queryOptions
91
- };
92
- $[6] = queryOptions;
93
- $[7] = t0;
94
- $[8] = t2;
95
- } else t2 = $[8];
96
- return t1(t2);
69
+ }),
70
+ ...queryOptions
71
+ });
97
72
  }
98
73
  function useCollectionCount(collection, options, queryOptions) {
99
- const $ = c(9);
100
74
  const client = useAdminStore(selectClient);
101
75
  const { locale: contentLocale } = useScopedLocale();
102
- let t0;
103
- let t1;
104
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale || $[3] !== options) {
105
- const queryOpts = createQuestpieQueryOptions(client, {
76
+ return useQuery({
77
+ ...createQuestpieQueryOptions(client, {
106
78
  keyPrefix: ["questpie", "collections"],
107
79
  locale: contentLocale
108
- });
109
- t1 = useQuery;
110
- t0 = queryOpts.collections[collection].count({
80
+ }).collections[collection].count({
111
81
  ...options,
112
82
  locale: contentLocale
113
- });
114
- $[0] = client;
115
- $[1] = collection;
116
- $[2] = contentLocale;
117
- $[3] = options;
118
- $[4] = t0;
119
- $[5] = t1;
120
- } else {
121
- t0 = $[4];
122
- t1 = $[5];
123
- }
124
- let t2;
125
- if ($[6] !== queryOptions || $[7] !== t0) {
126
- t2 = {
127
- ...t0,
128
- ...queryOptions
129
- };
130
- $[6] = queryOptions;
131
- $[7] = t0;
132
- $[8] = t2;
133
- } else t2 = $[8];
134
- return t1(t2);
83
+ }),
84
+ ...queryOptions
85
+ });
135
86
  }
136
87
  function useCollectionItem(collection, id, options, queryOptions) {
137
- const $ = c(10);
138
88
  const client = useAdminStore(selectClient);
139
89
  const { locale: contentLocale } = useScopedLocale();
140
- let t0;
141
- let t1;
142
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale || $[3] !== id || $[4] !== options) {
143
- const queryOpts = createQuestpieQueryOptions(client, {
90
+ return useQuery({
91
+ ...createQuestpieQueryOptions(client, {
144
92
  keyPrefix: ["questpie", "collections"],
145
93
  locale: contentLocale
146
- });
147
- t1 = useQuery;
148
- t0 = queryOpts.collections[collection].findOne({
94
+ }).collections[collection].findOne({
149
95
  where: { id },
150
96
  locale: contentLocale,
151
97
  ...options
152
- });
153
- $[0] = client;
154
- $[1] = collection;
155
- $[2] = contentLocale;
156
- $[3] = id;
157
- $[4] = options;
158
- $[5] = t0;
159
- $[6] = t1;
160
- } else {
161
- t0 = $[5];
162
- t1 = $[6];
163
- }
164
- let t2;
165
- if ($[7] !== queryOptions || $[8] !== t0) {
166
- t2 = {
167
- ...t0,
168
- ...queryOptions
169
- };
170
- $[7] = queryOptions;
171
- $[8] = t0;
172
- $[9] = t2;
173
- } else t2 = $[9];
174
- return t1(t2);
98
+ }),
99
+ ...queryOptions
100
+ });
175
101
  }
176
102
  function useCollectionCreate(collection, mutationOptions) {
177
- const $ = c(18);
178
103
  const client = useAdminStore(selectClient);
179
104
  const { locale: contentLocale } = useScopedLocale();
180
105
  const queryClient = useQueryClient();
181
- let baseOptions;
182
- let listQueryKey;
183
- let t0;
184
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale) {
185
- const queryOpts = createQuestpieQueryOptions(client, {
186
- keyPrefix: ["questpie", "collections"],
187
- locale: contentLocale
188
- });
189
- baseOptions = queryOpts.collections[collection].create();
190
- listQueryKey = queryOpts.key([
191
- "collections",
192
- collection,
193
- "find",
194
- contentLocale
195
- ]);
196
- t0 = queryOpts.key([
197
- "collections",
198
- collection,
199
- "count",
200
- contentLocale
201
- ]);
202
- $[0] = client;
203
- $[1] = collection;
204
- $[2] = contentLocale;
205
- $[3] = baseOptions;
206
- $[4] = listQueryKey;
207
- $[5] = t0;
208
- } else {
209
- baseOptions = $[3];
210
- listQueryKey = $[4];
211
- t0 = $[5];
212
- }
213
- const countQueryKey = t0;
214
- let t1;
215
- if ($[6] !== mutationOptions?.onSuccess) {
216
- t1 = (data, variables, context) => {
106
+ const queryOpts = createQuestpieQueryOptions(client, {
107
+ keyPrefix: ["questpie", "collections"],
108
+ locale: contentLocale
109
+ });
110
+ const baseOptions = queryOpts.collections[collection].create();
111
+ const listQueryKey = queryOpts.key([
112
+ "collections",
113
+ collection,
114
+ "find",
115
+ contentLocale
116
+ ]);
117
+ const countQueryKey = queryOpts.key([
118
+ "collections",
119
+ collection,
120
+ "count",
121
+ contentLocale
122
+ ]);
123
+ return useMutation({
124
+ ...baseOptions,
125
+ onSuccess: (data, variables, context) => {
217
126
  (mutationOptions?.onSuccess)?.(data, variables, context);
218
- };
219
- $[6] = mutationOptions?.onSuccess;
220
- $[7] = t1;
221
- } else t1 = $[7];
222
- let t2;
223
- if ($[8] !== countQueryKey || $[9] !== listQueryKey || $[10] !== mutationOptions?.onSettled || $[11] !== queryClient) {
224
- t2 = (data_0, error, variables_0, context_0) => {
127
+ },
128
+ onSettled: (data, error, variables, context) => {
225
129
  queryClient.invalidateQueries({ queryKey: listQueryKey });
226
130
  queryClient.invalidateQueries({ queryKey: countQueryKey });
227
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
228
- };
229
- $[8] = countQueryKey;
230
- $[9] = listQueryKey;
231
- $[10] = mutationOptions?.onSettled;
232
- $[11] = queryClient;
233
- $[12] = t2;
234
- } else t2 = $[12];
235
- let t3;
236
- if ($[13] !== baseOptions || $[14] !== mutationOptions || $[15] !== t1 || $[16] !== t2) {
237
- t3 = {
238
- ...baseOptions,
239
- onSuccess: t1,
240
- onSettled: t2,
241
- ...mutationOptions
242
- };
243
- $[13] = baseOptions;
244
- $[14] = mutationOptions;
245
- $[15] = t1;
246
- $[16] = t2;
247
- $[17] = t3;
248
- } else t3 = $[17];
249
- return useMutation(t3);
131
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
132
+ },
133
+ ...mutationOptions
134
+ });
250
135
  }
251
136
  function useCollectionUpdate(collection, mutationOptions) {
252
- const $ = c(20);
253
137
  const client = useAdminStore(selectClient);
254
138
  const { locale: contentLocale } = useScopedLocale();
255
139
  const queryClient = useQueryClient();
256
- let baseOptions;
257
- let countQueryKey;
258
- let listQueryKey;
259
- let t0;
260
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale) {
261
- const queryOpts = createQuestpieQueryOptions(client, {
262
- keyPrefix: ["questpie", "collections"],
263
- locale: contentLocale
264
- });
265
- baseOptions = queryOpts.collections[collection].update();
266
- listQueryKey = queryOpts.key([
267
- "collections",
268
- collection,
269
- "find",
270
- contentLocale
271
- ]);
272
- countQueryKey = queryOpts.key([
273
- "collections",
274
- collection,
275
- "count",
276
- contentLocale
277
- ]);
278
- t0 = queryOpts.key([
279
- "collections",
280
- collection,
281
- "findOne",
282
- contentLocale
283
- ]);
284
- $[0] = client;
285
- $[1] = collection;
286
- $[2] = contentLocale;
287
- $[3] = baseOptions;
288
- $[4] = countQueryKey;
289
- $[5] = listQueryKey;
290
- $[6] = t0;
291
- } else {
292
- baseOptions = $[3];
293
- countQueryKey = $[4];
294
- listQueryKey = $[5];
295
- t0 = $[6];
296
- }
297
- const itemQueryKey = t0;
298
- let t1;
299
- if ($[7] !== mutationOptions?.onSuccess) {
300
- t1 = (data, variables, context) => {
140
+ const queryOpts = createQuestpieQueryOptions(client, {
141
+ keyPrefix: ["questpie", "collections"],
142
+ locale: contentLocale
143
+ });
144
+ const baseOptions = queryOpts.collections[collection].update();
145
+ const listQueryKey = queryOpts.key([
146
+ "collections",
147
+ collection,
148
+ "find",
149
+ contentLocale
150
+ ]);
151
+ const countQueryKey = queryOpts.key([
152
+ "collections",
153
+ collection,
154
+ "count",
155
+ contentLocale
156
+ ]);
157
+ const itemQueryKey = queryOpts.key([
158
+ "collections",
159
+ collection,
160
+ "findOne",
161
+ contentLocale
162
+ ]);
163
+ return useMutation({
164
+ ...baseOptions,
165
+ onSuccess: (data, variables, context) => {
301
166
  (mutationOptions?.onSuccess)?.(data, variables, context);
302
- };
303
- $[7] = mutationOptions?.onSuccess;
304
- $[8] = t1;
305
- } else t1 = $[8];
306
- let t2;
307
- if ($[9] !== countQueryKey || $[10] !== itemQueryKey || $[11] !== listQueryKey || $[12] !== mutationOptions?.onSettled || $[13] !== queryClient) {
308
- t2 = (data_0, error, variables_0, context_0) => {
167
+ },
168
+ onSettled: (data, error, variables, context) => {
309
169
  queryClient.invalidateQueries({ queryKey: listQueryKey });
310
170
  queryClient.invalidateQueries({ queryKey: countQueryKey });
311
171
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
312
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
313
- };
314
- $[9] = countQueryKey;
315
- $[10] = itemQueryKey;
316
- $[11] = listQueryKey;
317
- $[12] = mutationOptions?.onSettled;
318
- $[13] = queryClient;
319
- $[14] = t2;
320
- } else t2 = $[14];
321
- let t3;
322
- if ($[15] !== baseOptions || $[16] !== mutationOptions || $[17] !== t1 || $[18] !== t2) {
323
- t3 = {
324
- ...baseOptions,
325
- onSuccess: t1,
326
- onSettled: t2,
327
- ...mutationOptions
328
- };
329
- $[15] = baseOptions;
330
- $[16] = mutationOptions;
331
- $[17] = t1;
332
- $[18] = t2;
333
- $[19] = t3;
334
- } else t3 = $[19];
335
- return useMutation(t3);
172
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
173
+ },
174
+ ...mutationOptions
175
+ });
336
176
  }
337
177
  function useCollectionDelete(collection, mutationOptions) {
338
- const $ = c(20);
339
178
  const client = useAdminStore(selectClient);
340
179
  const { locale: contentLocale } = useScopedLocale();
341
180
  const queryClient = useQueryClient();
342
- let baseOptions;
343
- let countQueryKey;
344
- let listQueryKey;
345
- let t0;
346
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale) {
347
- const queryOpts = createQuestpieQueryOptions(client, {
348
- keyPrefix: ["questpie", "collections"],
349
- locale: contentLocale
350
- });
351
- baseOptions = queryOpts.collections[collection].delete();
352
- listQueryKey = queryOpts.key([
353
- "collections",
354
- collection,
355
- "find",
356
- contentLocale
357
- ]);
358
- countQueryKey = queryOpts.key([
359
- "collections",
360
- collection,
361
- "count",
362
- contentLocale
363
- ]);
364
- t0 = queryOpts.key([
365
- "collections",
366
- collection,
367
- "findOne",
368
- contentLocale
369
- ]);
370
- $[0] = client;
371
- $[1] = collection;
372
- $[2] = contentLocale;
373
- $[3] = baseOptions;
374
- $[4] = countQueryKey;
375
- $[5] = listQueryKey;
376
- $[6] = t0;
377
- } else {
378
- baseOptions = $[3];
379
- countQueryKey = $[4];
380
- listQueryKey = $[5];
381
- t0 = $[6];
382
- }
383
- const itemQueryKey = t0;
384
- let t1;
385
- if ($[7] !== mutationOptions?.onSuccess) {
386
- t1 = (data, variables, context) => {
181
+ const queryOpts = createQuestpieQueryOptions(client, {
182
+ keyPrefix: ["questpie", "collections"],
183
+ locale: contentLocale
184
+ });
185
+ const baseOptions = queryOpts.collections[collection].delete();
186
+ const listQueryKey = queryOpts.key([
187
+ "collections",
188
+ collection,
189
+ "find",
190
+ contentLocale
191
+ ]);
192
+ const countQueryKey = queryOpts.key([
193
+ "collections",
194
+ collection,
195
+ "count",
196
+ contentLocale
197
+ ]);
198
+ const itemQueryKey = queryOpts.key([
199
+ "collections",
200
+ collection,
201
+ "findOne",
202
+ contentLocale
203
+ ]);
204
+ return useMutation({
205
+ ...baseOptions,
206
+ onSuccess: (data, variables, context) => {
387
207
  (mutationOptions?.onSuccess)?.(data, variables, context);
388
- };
389
- $[7] = mutationOptions?.onSuccess;
390
- $[8] = t1;
391
- } else t1 = $[8];
392
- let t2;
393
- if ($[9] !== countQueryKey || $[10] !== itemQueryKey || $[11] !== listQueryKey || $[12] !== mutationOptions?.onSettled || $[13] !== queryClient) {
394
- t2 = (data_0, error, variables_0, context_0) => {
208
+ },
209
+ onSettled: (data, error, variables, context) => {
395
210
  queryClient.invalidateQueries({ queryKey: listQueryKey });
396
211
  queryClient.invalidateQueries({ queryKey: countQueryKey });
397
212
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
398
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
399
- };
400
- $[9] = countQueryKey;
401
- $[10] = itemQueryKey;
402
- $[11] = listQueryKey;
403
- $[12] = mutationOptions?.onSettled;
404
- $[13] = queryClient;
405
- $[14] = t2;
406
- } else t2 = $[14];
407
- let t3;
408
- if ($[15] !== baseOptions || $[16] !== mutationOptions || $[17] !== t1 || $[18] !== t2) {
409
- t3 = {
410
- ...baseOptions,
411
- onSuccess: t1,
412
- onSettled: t2,
413
- ...mutationOptions
414
- };
415
- $[15] = baseOptions;
416
- $[16] = mutationOptions;
417
- $[17] = t1;
418
- $[18] = t2;
419
- $[19] = t3;
420
- } else t3 = $[19];
421
- return useMutation(t3);
213
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
214
+ },
215
+ ...mutationOptions
216
+ });
422
217
  }
423
218
  function useCollectionRestore(collection, mutationOptions) {
424
- const $ = c(20);
425
219
  const client = useAdminStore(selectClient);
426
220
  const { locale: contentLocale } = useScopedLocale();
427
221
  const queryClient = useQueryClient();
428
- let baseOptions;
429
- let countQueryKey;
430
- let listQueryKey;
431
- let t0;
432
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale) {
433
- const queryOpts = createQuestpieQueryOptions(client, {
434
- keyPrefix: ["questpie", "collections"],
435
- locale: contentLocale
436
- });
437
- baseOptions = queryOpts.collections[collection].restore();
438
- listQueryKey = queryOpts.key([
439
- "collections",
440
- collection,
441
- "find",
442
- contentLocale
443
- ]);
444
- countQueryKey = queryOpts.key([
445
- "collections",
446
- collection,
447
- "count",
448
- contentLocale
449
- ]);
450
- t0 = queryOpts.key([
451
- "collections",
452
- collection,
453
- "findOne",
454
- contentLocale
455
- ]);
456
- $[0] = client;
457
- $[1] = collection;
458
- $[2] = contentLocale;
459
- $[3] = baseOptions;
460
- $[4] = countQueryKey;
461
- $[5] = listQueryKey;
462
- $[6] = t0;
463
- } else {
464
- baseOptions = $[3];
465
- countQueryKey = $[4];
466
- listQueryKey = $[5];
467
- t0 = $[6];
468
- }
469
- const itemQueryKey = t0;
470
- let t1;
471
- if ($[7] !== mutationOptions?.onSuccess) {
472
- t1 = (data, variables, context) => {
222
+ const queryOpts = createQuestpieQueryOptions(client, {
223
+ keyPrefix: ["questpie", "collections"],
224
+ locale: contentLocale
225
+ });
226
+ const baseOptions = queryOpts.collections[collection].restore();
227
+ const listQueryKey = queryOpts.key([
228
+ "collections",
229
+ collection,
230
+ "find",
231
+ contentLocale
232
+ ]);
233
+ const countQueryKey = queryOpts.key([
234
+ "collections",
235
+ collection,
236
+ "count",
237
+ contentLocale
238
+ ]);
239
+ const itemQueryKey = queryOpts.key([
240
+ "collections",
241
+ collection,
242
+ "findOne",
243
+ contentLocale
244
+ ]);
245
+ return useMutation({
246
+ ...baseOptions,
247
+ onSuccess: (data, variables, context) => {
473
248
  (mutationOptions?.onSuccess)?.(data, variables, context);
474
- };
475
- $[7] = mutationOptions?.onSuccess;
476
- $[8] = t1;
477
- } else t1 = $[8];
478
- let t2;
479
- if ($[9] !== countQueryKey || $[10] !== itemQueryKey || $[11] !== listQueryKey || $[12] !== mutationOptions?.onSettled || $[13] !== queryClient) {
480
- t2 = (data_0, error, variables_0, context_0) => {
249
+ },
250
+ onSettled: (data, error, variables, context) => {
481
251
  queryClient.invalidateQueries({ queryKey: listQueryKey });
482
252
  queryClient.invalidateQueries({ queryKey: countQueryKey });
483
253
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
484
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
485
- };
486
- $[9] = countQueryKey;
487
- $[10] = itemQueryKey;
488
- $[11] = listQueryKey;
489
- $[12] = mutationOptions?.onSettled;
490
- $[13] = queryClient;
491
- $[14] = t2;
492
- } else t2 = $[14];
493
- let t3;
494
- if ($[15] !== baseOptions || $[16] !== mutationOptions || $[17] !== t1 || $[18] !== t2) {
495
- t3 = {
496
- ...baseOptions,
497
- onSuccess: t1,
498
- onSettled: t2,
499
- ...mutationOptions
500
- };
501
- $[15] = baseOptions;
502
- $[16] = mutationOptions;
503
- $[17] = t1;
504
- $[18] = t2;
505
- $[19] = t3;
506
- } else t3 = $[19];
507
- return useMutation(t3);
254
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
255
+ },
256
+ ...mutationOptions
257
+ });
508
258
  }
509
259
  function useCollectionVersions(collection, id, options, queryOptions) {
510
- const $ = c(11);
511
260
  const client = useAdminStore(selectClient);
512
261
  const { locale: contentLocale } = useScopedLocale();
513
- let t0;
514
- let t1;
515
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale || $[3] !== id || $[4] !== options) {
516
- const queryOpts = createQuestpieQueryOptions(client, {
262
+ return useQuery({
263
+ ...createQuestpieQueryOptions(client, {
517
264
  keyPrefix: ["questpie", "collections"],
518
265
  locale: contentLocale
519
- });
520
- t1 = useQuery;
521
- t0 = queryOpts.collections[collection].findVersions({
266
+ }).collections[collection].findVersions({
522
267
  id,
523
268
  ...options?.limit !== void 0 ? { limit: options.limit } : {},
524
269
  ...options?.offset !== void 0 ? { offset: options.offset } : {}
525
- });
526
- $[0] = client;
527
- $[1] = collection;
528
- $[2] = contentLocale;
529
- $[3] = id;
530
- $[4] = options;
531
- $[5] = t0;
532
- $[6] = t1;
533
- } else {
534
- t0 = $[5];
535
- t1 = $[6];
536
- }
537
- const t2 = !!id && (queryOptions?.enabled ?? true);
538
- let t3;
539
- if ($[7] !== queryOptions || $[8] !== t0 || $[9] !== t2) {
540
- t3 = {
541
- ...t0,
542
- enabled: t2,
543
- ...queryOptions
544
- };
545
- $[7] = queryOptions;
546
- $[8] = t0;
547
- $[9] = t2;
548
- $[10] = t3;
549
- } else t3 = $[10];
550
- return t1(t3);
270
+ }),
271
+ enabled: !!id && (queryOptions?.enabled ?? true),
272
+ ...queryOptions
273
+ });
551
274
  }
552
275
  function useCollectionRevertVersion(collection, mutationOptions) {
553
- const $ = c(22);
554
276
  const client = useAdminStore(selectClient);
555
277
  const { locale: contentLocale } = useScopedLocale();
556
278
  const queryClient = useQueryClient();
557
- let baseOptions;
558
- let countQueryKey;
559
- let itemQueryKey;
560
- let listQueryKey;
561
- let t0;
562
- if ($[0] !== client || $[1] !== collection || $[2] !== contentLocale) {
563
- const queryOpts = createQuestpieQueryOptions(client, {
564
- keyPrefix: ["questpie", "collections"],
565
- locale: contentLocale
566
- });
567
- baseOptions = queryOpts.collections[collection].revertToVersion();
568
- listQueryKey = queryOpts.key([
569
- "collections",
570
- collection,
571
- "find",
572
- contentLocale
573
- ]);
574
- countQueryKey = queryOpts.key([
575
- "collections",
576
- collection,
577
- "count",
578
- contentLocale
579
- ]);
580
- itemQueryKey = queryOpts.key([
581
- "collections",
582
- collection,
583
- "findOne",
584
- contentLocale
585
- ]);
586
- t0 = queryOpts.key([
587
- "collections",
588
- collection,
589
- "findVersions",
590
- contentLocale
591
- ]);
592
- $[0] = client;
593
- $[1] = collection;
594
- $[2] = contentLocale;
595
- $[3] = baseOptions;
596
- $[4] = countQueryKey;
597
- $[5] = itemQueryKey;
598
- $[6] = listQueryKey;
599
- $[7] = t0;
600
- } else {
601
- baseOptions = $[3];
602
- countQueryKey = $[4];
603
- itemQueryKey = $[5];
604
- listQueryKey = $[6];
605
- t0 = $[7];
606
- }
607
- const versionsQueryKey = t0;
608
- let t1;
609
- if ($[8] !== mutationOptions?.onSuccess) {
610
- t1 = (data, variables, context) => {
279
+ const queryOpts = createQuestpieQueryOptions(client, {
280
+ keyPrefix: ["questpie", "collections"],
281
+ locale: contentLocale
282
+ });
283
+ const baseOptions = queryOpts.collections[collection].revertToVersion();
284
+ const listQueryKey = queryOpts.key([
285
+ "collections",
286
+ collection,
287
+ "find",
288
+ contentLocale
289
+ ]);
290
+ const countQueryKey = queryOpts.key([
291
+ "collections",
292
+ collection,
293
+ "count",
294
+ contentLocale
295
+ ]);
296
+ const itemQueryKey = queryOpts.key([
297
+ "collections",
298
+ collection,
299
+ "findOne",
300
+ contentLocale
301
+ ]);
302
+ const versionsQueryKey = queryOpts.key([
303
+ "collections",
304
+ collection,
305
+ "findVersions",
306
+ contentLocale
307
+ ]);
308
+ return useMutation({
309
+ ...baseOptions,
310
+ onSuccess: (data, variables, context) => {
611
311
  (mutationOptions?.onSuccess)?.(data, variables, context);
612
- };
613
- $[8] = mutationOptions?.onSuccess;
614
- $[9] = t1;
615
- } else t1 = $[9];
616
- let t2;
617
- if ($[10] !== countQueryKey || $[11] !== itemQueryKey || $[12] !== listQueryKey || $[13] !== mutationOptions?.onSettled || $[14] !== queryClient || $[15] !== versionsQueryKey) {
618
- t2 = (data_0, error, variables_0, context_0) => {
312
+ },
313
+ onSettled: (data, error, variables, context) => {
619
314
  queryClient.invalidateQueries({ queryKey: listQueryKey });
620
315
  queryClient.invalidateQueries({ queryKey: countQueryKey });
621
316
  queryClient.invalidateQueries({ queryKey: itemQueryKey });
622
317
  queryClient.invalidateQueries({ queryKey: versionsQueryKey });
623
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
624
- };
625
- $[10] = countQueryKey;
626
- $[11] = itemQueryKey;
627
- $[12] = listQueryKey;
628
- $[13] = mutationOptions?.onSettled;
629
- $[14] = queryClient;
630
- $[15] = versionsQueryKey;
631
- $[16] = t2;
632
- } else t2 = $[16];
633
- let t3;
634
- if ($[17] !== baseOptions || $[18] !== mutationOptions || $[19] !== t1 || $[20] !== t2) {
635
- t3 = {
636
- ...baseOptions,
637
- onSuccess: t1,
638
- onSettled: t2,
639
- ...mutationOptions
640
- };
641
- $[17] = baseOptions;
642
- $[18] = mutationOptions;
643
- $[19] = t1;
644
- $[20] = t2;
645
- $[21] = t3;
646
- } else t3 = $[21];
647
- return useMutation(t3);
318
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
319
+ },
320
+ ...mutationOptions
321
+ });
648
322
  }
649
323
  function useGlobal(globalName, options, queryOptions) {
650
- const $ = c(9);
651
324
  const client = useAdminStore(selectClient);
652
325
  const contentLocale = useAdminStore(selectContentLocale);
653
- let t0;
654
- let t1;
655
- if ($[0] !== client || $[1] !== contentLocale || $[2] !== globalName || $[3] !== options) {
656
- const queryOpts = createQuestpieQueryOptions(client, {
326
+ return useQuery({
327
+ ...createQuestpieQueryOptions(client, {
657
328
  keyPrefix: ["questpie", "globals"],
658
329
  locale: contentLocale
659
- });
660
- t1 = useQuery;
661
- t0 = queryOpts.globals[globalName].get({
330
+ }).globals[globalName].get({
662
331
  ...options,
663
332
  locale: contentLocale
664
- });
665
- $[0] = client;
666
- $[1] = contentLocale;
667
- $[2] = globalName;
668
- $[3] = options;
669
- $[4] = t0;
670
- $[5] = t1;
671
- } else {
672
- t0 = $[4];
673
- t1 = $[5];
674
- }
675
- let t2;
676
- if ($[6] !== queryOptions || $[7] !== t0) {
677
- t2 = {
678
- ...t0,
679
- ...queryOptions
680
- };
681
- $[6] = queryOptions;
682
- $[7] = t0;
683
- $[8] = t2;
684
- } else t2 = $[8];
685
- return t1(t2);
333
+ }),
334
+ ...queryOptions
335
+ });
686
336
  }
687
337
  function useGlobalUpdate(globalName, mutationOptions) {
688
- const $ = c(17);
689
338
  const client = useAdminStore(selectClient);
690
339
  const contentLocale = useAdminStore(selectContentLocale);
691
340
  const queryClient = useQueryClient();
692
- let globalQueryKey;
693
- let t0;
694
- let t1;
695
- if ($[0] !== client || $[1] !== contentLocale || $[2] !== globalName) {
696
- const queryOpts = createQuestpieQueryOptions(client, {
697
- keyPrefix: ["questpie", "globals"],
698
- locale: contentLocale
699
- });
700
- globalQueryKey = queryOpts.key([
701
- "globals",
702
- globalName,
703
- "get",
704
- contentLocale
705
- ]);
706
- t1 = useMutation;
707
- t0 = queryOpts.globals[globalName].update();
708
- $[0] = client;
709
- $[1] = contentLocale;
710
- $[2] = globalName;
711
- $[3] = globalQueryKey;
712
- $[4] = t0;
713
- $[5] = t1;
714
- } else {
715
- globalQueryKey = $[3];
716
- t0 = $[4];
717
- t1 = $[5];
718
- }
719
- let t2;
720
- if ($[6] !== mutationOptions?.onSuccess) {
721
- t2 = (data, variables, context) => {
341
+ const queryOpts = createQuestpieQueryOptions(client, {
342
+ keyPrefix: ["questpie", "globals"],
343
+ locale: contentLocale
344
+ });
345
+ const globalQueryKey = queryOpts.key([
346
+ "globals",
347
+ globalName,
348
+ "get",
349
+ contentLocale
350
+ ]);
351
+ return useMutation({
352
+ ...queryOpts.globals[globalName].update(),
353
+ onSuccess: (data, variables, context) => {
722
354
  (mutationOptions?.onSuccess)?.(data, variables, context);
723
- };
724
- $[6] = mutationOptions?.onSuccess;
725
- $[7] = t2;
726
- } else t2 = $[7];
727
- let t3;
728
- if ($[8] !== globalQueryKey || $[9] !== mutationOptions?.onSettled || $[10] !== queryClient) {
729
- t3 = (data_0, error, variables_0, context_0) => {
355
+ },
356
+ onSettled: (data, error, variables, context) => {
730
357
  queryClient.invalidateQueries({ queryKey: globalQueryKey });
731
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
732
- };
733
- $[8] = globalQueryKey;
734
- $[9] = mutationOptions?.onSettled;
735
- $[10] = queryClient;
736
- $[11] = t3;
737
- } else t3 = $[11];
738
- let t4;
739
- if ($[12] !== mutationOptions || $[13] !== t0 || $[14] !== t2 || $[15] !== t3) {
740
- t4 = {
741
- ...t0,
742
- onSuccess: t2,
743
- onSettled: t3,
744
- ...mutationOptions
745
- };
746
- $[12] = mutationOptions;
747
- $[13] = t0;
748
- $[14] = t2;
749
- $[15] = t3;
750
- $[16] = t4;
751
- } else t4 = $[16];
752
- return t1(t4);
358
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
359
+ },
360
+ ...mutationOptions
361
+ });
753
362
  }
754
363
  function useGlobalVersions(globalName, options, queryOptions) {
755
- const $ = c(9);
756
364
  const client = useAdminStore(selectClient);
757
365
  const contentLocale = useAdminStore(selectContentLocale);
758
- let t0;
759
- let t1;
760
- if ($[0] !== client || $[1] !== contentLocale || $[2] !== globalName || $[3] !== options) {
761
- const queryOpts = createQuestpieQueryOptions(client, {
366
+ return useQuery({
367
+ ...createQuestpieQueryOptions(client, {
762
368
  keyPrefix: ["questpie", "globals"],
763
369
  locale: contentLocale
764
- });
765
- t1 = useQuery;
766
- t0 = queryOpts.globals[globalName].findVersions({
370
+ }).globals[globalName].findVersions({
767
371
  ...options,
768
372
  locale: contentLocale
769
- });
770
- $[0] = client;
771
- $[1] = contentLocale;
772
- $[2] = globalName;
773
- $[3] = options;
774
- $[4] = t0;
775
- $[5] = t1;
776
- } else {
777
- t0 = $[4];
778
- t1 = $[5];
779
- }
780
- let t2;
781
- if ($[6] !== queryOptions || $[7] !== t0) {
782
- t2 = {
783
- ...t0,
784
- ...queryOptions
785
- };
786
- $[6] = queryOptions;
787
- $[7] = t0;
788
- $[8] = t2;
789
- } else t2 = $[8];
790
- return t1(t2);
373
+ }),
374
+ ...queryOptions
375
+ });
791
376
  }
792
377
  function useGlobalRevertVersion(globalName, mutationOptions) {
793
- const $ = c(19);
794
378
  const client = useAdminStore(selectClient);
795
379
  const contentLocale = useAdminStore(selectContentLocale);
796
380
  const queryClient = useQueryClient();
797
- let globalQueryKey;
798
- let t0;
799
- let t1;
800
- let versionsQueryKey;
801
- if ($[0] !== client || $[1] !== contentLocale || $[2] !== globalName) {
802
- const queryOpts = createQuestpieQueryOptions(client, {
803
- keyPrefix: ["questpie", "globals"],
804
- locale: contentLocale
805
- });
806
- globalQueryKey = queryOpts.key([
807
- "globals",
808
- globalName,
809
- "get",
810
- contentLocale
811
- ]);
812
- versionsQueryKey = queryOpts.key([
813
- "globals",
814
- globalName,
815
- "findVersions",
816
- contentLocale
817
- ]);
818
- t1 = useMutation;
819
- t0 = queryOpts.globals[globalName].revertToVersion();
820
- $[0] = client;
821
- $[1] = contentLocale;
822
- $[2] = globalName;
823
- $[3] = globalQueryKey;
824
- $[4] = t0;
825
- $[5] = t1;
826
- $[6] = versionsQueryKey;
827
- } else {
828
- globalQueryKey = $[3];
829
- t0 = $[4];
830
- t1 = $[5];
831
- versionsQueryKey = $[6];
832
- }
833
- let t2;
834
- if ($[7] !== mutationOptions?.onSuccess) {
835
- t2 = (data, variables, context) => {
381
+ const queryOpts = createQuestpieQueryOptions(client, {
382
+ keyPrefix: ["questpie", "globals"],
383
+ locale: contentLocale
384
+ });
385
+ const globalQueryKey = queryOpts.key([
386
+ "globals",
387
+ globalName,
388
+ "get",
389
+ contentLocale
390
+ ]);
391
+ const versionsQueryKey = queryOpts.key([
392
+ "globals",
393
+ globalName,
394
+ "findVersions",
395
+ contentLocale
396
+ ]);
397
+ return useMutation({
398
+ ...queryOpts.globals[globalName].revertToVersion(),
399
+ onSuccess: (data, variables, context) => {
836
400
  (mutationOptions?.onSuccess)?.(data, variables, context);
837
- };
838
- $[7] = mutationOptions?.onSuccess;
839
- $[8] = t2;
840
- } else t2 = $[8];
841
- let t3;
842
- if ($[9] !== globalQueryKey || $[10] !== mutationOptions?.onSettled || $[11] !== queryClient || $[12] !== versionsQueryKey) {
843
- t3 = (data_0, error, variables_0, context_0) => {
401
+ },
402
+ onSettled: (data, error, variables, context) => {
844
403
  queryClient.invalidateQueries({ queryKey: globalQueryKey });
845
404
  queryClient.invalidateQueries({ queryKey: versionsQueryKey });
846
- (mutationOptions?.onSettled)?.(data_0, error, variables_0, context_0);
847
- };
848
- $[9] = globalQueryKey;
849
- $[10] = mutationOptions?.onSettled;
850
- $[11] = queryClient;
851
- $[12] = versionsQueryKey;
852
- $[13] = t3;
853
- } else t3 = $[13];
854
- let t4;
855
- if ($[14] !== mutationOptions || $[15] !== t0 || $[16] !== t2 || $[17] !== t3) {
856
- t4 = {
857
- ...t0,
858
- onSuccess: t2,
859
- onSettled: t3,
860
- ...mutationOptions
861
- };
862
- $[14] = mutationOptions;
863
- $[15] = t0;
864
- $[16] = t2;
865
- $[17] = t3;
866
- $[18] = t4;
867
- } else t4 = $[18];
868
- return t1(t4);
405
+ (mutationOptions?.onSettled)?.(data, error, variables, context);
406
+ },
407
+ ...mutationOptions
408
+ });
869
409
  }
870
410
  return {
871
411
  useCollectionList,