@questpie/admin 3.2.4 → 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.
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +103 -230
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +94 -296
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -180
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +2 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +195 -513
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +39 -74
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +285 -605
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +176 -476
- package/dist/client/components/preview/live-preview-mode.mjs +233 -458
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +200 -559
- package/dist/client/components/primitives/select-single.mjs +165 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.mjs +63 -146
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +167 -348
- package/dist/client/preview/use-collection-preview.mjs +121 -215
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -379
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +58 -182
- package/dist/client/views/collection/form-view.mjs +284 -518
- package/dist/client/views/collection/table-view.mjs +231 -463
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -560
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +477 -1301
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +458 -1274
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/modules/admin/collections/account.d.mts +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +41 -41
- package/dist/server/modules/admin/collections/user.d.mts +63 -63
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +20 -19
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +45 -45
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- 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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
|
|
109
|
-
|
|
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
|
-
|
|
117
|
-
|
|
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
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
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)?.(
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
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
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
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)?.(
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
-
|
|
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)?.(
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
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
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
-
|
|
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)?.(
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
|
|
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
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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
|
-
|
|
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)?.(
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
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
|
-
|
|
627
|
-
|
|
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
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
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
|
-
|
|
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)?.(
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
|
|
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
|