@questpie/admin 3.2.7 → 3.4.0
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/README.md +4 -6
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/builder/admin-types.d.mts +3 -3
- package/dist/client/builder/types/action-types.d.mts +1 -1
- package/dist/client/builder/types/collection-types.d.mts +59 -2
- package/dist/client/components/blocks/block-editor-provider.mjs +13 -0
- package/dist/client/components/fields/array-field.mjs +105 -122
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +1 -1
- package/dist/client/components/fields/boolean-field.mjs +1 -1
- package/dist/client/components/fields/date-field.mjs +1 -1
- package/dist/client/components/fields/datetime-field.mjs +1 -1
- package/dist/client/components/fields/email-field.mjs +1 -1
- package/dist/client/components/fields/field-wrapper.mjs +44 -15
- package/dist/client/components/fields/number-field.mjs +1 -1
- package/dist/client/components/fields/object-array-field.mjs +179 -149
- package/dist/client/components/fields/object-field.mjs +96 -87
- package/dist/client/components/fields/relation-picker.mjs +1 -1
- package/dist/client/components/fields/relation-select.mjs +1 -1
- package/dist/client/components/fields/rich-text-editor/index.mjs +1 -1
- package/dist/client/components/fields/select-field.mjs +1 -1
- package/dist/client/components/fields/text-field.mjs +1 -1
- package/dist/client/components/fields/textarea-field.mjs +1 -1
- package/dist/client/components/fields/time-field.mjs +1 -1
- package/dist/client/components/fields/upload-field.mjs +1 -1
- package/dist/client/components/history-sidebar.mjs +10 -4
- package/dist/client/components/structured-diff.mjs +367 -0
- package/dist/client/components/ui/sidebar.mjs +1 -1
- package/dist/client/hooks/use-field-options.mjs +34 -15
- package/dist/client/hooks/use-transition-stage.mjs +2 -2
- package/dist/client/modules/admin.d.mts +3 -0
- package/dist/client/modules/admin.mjs +3 -0
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/utils/auto-expand-fields.mjs +1 -1
- package/dist/client/views/collection/auto-form-fields.mjs +23 -19
- package/dist/client/views/collection/cells/complex-cells.mjs +1 -1
- package/dist/client/views/collection/columns/build-columns.mjs +1 -1
- package/dist/client/views/collection/columns/column-defaults.mjs +17 -4
- package/dist/client/views/collection/field-renderer.mjs +19 -7
- package/dist/client/views/collection/form-view.mjs +10 -6
- package/dist/client/views/collection/list-view.mjs +830 -0
- package/dist/client/views/collection/outline.mjs +363 -0
- package/dist/client/views/collection/table-view.mjs +25 -16
- package/dist/client/views/globals/global-form-view.mjs +47 -27
- package/dist/client/views/layout/admin-layout.d.mts +15 -1
- package/dist/client/views/layout/admin-layout.mjs +95 -31
- package/dist/client/views/layout/admin-sidebar.mjs +2 -2
- package/dist/client.d.mts +6 -6
- package/dist/client.mjs +1 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/factories.d.mts +19 -0
- package/dist/factories.mjs +11 -0
- package/dist/fields.d.mts +4 -0
- package/dist/fields.mjs +5 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/modules/admin.d.mts +10 -0
- package/dist/modules/admin.mjs +9 -0
- package/dist/modules/audit.d.mts +5 -0
- package/dist/modules/audit.mjs +5 -0
- package/dist/server/augmentation/form-layout.d.mts +57 -2
- package/dist/server/augmentation/index.d.mts +3 -1
- package/dist/server/augmentation/shell.d.mts +48 -0
- package/dist/server/augmentation.d.mts +2 -1
- package/dist/server/codegen/admin-client-template.mjs +11 -4
- package/dist/server/fields/blocks.d.mts +9 -2
- package/dist/server/fields/blocks.mjs +1 -1
- package/dist/server/fields/index.d.mts +2 -2
- package/dist/server/fields/index.mjs +2 -2
- package/dist/server/fields/rich-text.d.mts +9 -2
- package/dist/server/fields/rich-text.mjs +1 -1
- package/dist/server/i18n/messages/cs.mjs +8 -0
- package/dist/server/i18n/messages/de.mjs +8 -0
- package/dist/server/i18n/messages/en.mjs +8 -0
- package/dist/server/i18n/messages/es.mjs +8 -0
- package/dist/server/i18n/messages/fr.mjs +8 -0
- package/dist/server/i18n/messages/pl.mjs +8 -0
- package/dist/server/i18n/messages/pt.mjs +8 -0
- package/dist/server/i18n/messages/sk.mjs +8 -0
- package/dist/server/modules/admin/.generated/module.d.mts +24 -19
- package/dist/server/modules/admin/.generated/module.mjs +5 -1
- package/dist/server/modules/admin/.generated/registries.d.mts +6 -4
- package/dist/server/modules/admin/client/.generated/module.d.mts +70 -70
- package/dist/server/modules/admin/client/.generated/module.mjs +3 -1
- package/dist/server/modules/admin/client/views/collection-form.d.mts +6 -0
- package/dist/server/modules/admin/client/views/collection-table.d.mts +6 -0
- package/dist/server/modules/admin/client/views/global-form.d.mts +6 -0
- package/dist/server/modules/admin/client/views/list-view.d.mts +6 -0
- package/dist/server/modules/admin/client/views/list-view.mjs +10 -0
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- 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 +39 -39
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- 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/dto/admin-config.dto.mjs +17 -0
- package/dist/server/modules/admin/index.d.mts +30 -31
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -17
- package/dist/server/modules/admin/routes/admin-config.mjs +21 -5
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +18 -12
- package/dist/server/modules/admin/routes/i18n-helpers.d.mts +4 -0
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +24 -19
- package/dist/server/modules/admin/routes/preview.mjs +83 -62
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/route-helpers.mjs +36 -1
- package/dist/server/modules/admin/routes/setup.d.mts +7 -14
- package/dist/server/modules/admin/routes/setup.mjs +16 -3
- 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/views/list-view.d.mts +8 -0
- package/dist/server/modules/admin/views/list-view.mjs +7 -0
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +41 -41
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +87 -80
- package/dist/server/modules/audit/collections/audit-log.mjs +7 -2
- package/dist/server/modules/audit/config/localize-title.mjs +67 -0
- package/dist/server/modules/audit/index.d.mts +3 -2
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/dist/server/modules/audit/log-audit-entry.d.mts +85 -0
- package/dist/server/modules/audit/log-audit-entry.mjs +125 -0
- package/dist/server/plugin.d.mts +1 -1
- package/dist/server/plugin.mjs +31 -31
- package/dist/server.d.mts +6 -4
- package/dist/server.mjs +9 -8
- package/dist/shared/preview-utils.d.mts +4 -4
- package/dist/shared/preview-utils.mjs +5 -7
- package/package.json +13 -3
- package/dist/client/hooks/use-audit-history.mjs +0 -38
package/dist/server/plugin.mjs
CHANGED
|
@@ -49,7 +49,7 @@ function adminPlugin() {
|
|
|
49
49
|
placeholder: "$COMPONENT_NAMES",
|
|
50
50
|
recordPlaceholder: "$COMPONENTS",
|
|
51
51
|
typeRegistry: {
|
|
52
|
-
module: "@questpie/admin/
|
|
52
|
+
module: "@questpie/admin/factories",
|
|
53
53
|
interface: "ComponentTypeRegistry"
|
|
54
54
|
},
|
|
55
55
|
includeInAppState: true,
|
|
@@ -71,7 +71,7 @@ function adminPlugin() {
|
|
|
71
71
|
prefix: "ftype",
|
|
72
72
|
factoryImports: [{
|
|
73
73
|
name: "adminFields",
|
|
74
|
-
from: "@questpie/admin/
|
|
74
|
+
from: "@questpie/admin/fields"
|
|
75
75
|
}]
|
|
76
76
|
}
|
|
77
77
|
},
|
|
@@ -84,10 +84,10 @@ function adminPlugin() {
|
|
|
84
84
|
builderClass: "BlockBuilder",
|
|
85
85
|
import: {
|
|
86
86
|
name: "BlockBuilder",
|
|
87
|
-
from: "@questpie/admin/
|
|
87
|
+
from: "@questpie/admin/factories"
|
|
88
88
|
},
|
|
89
89
|
createMethod: "create",
|
|
90
|
-
returnType: "import('@questpie/admin/
|
|
90
|
+
returnType: "import('@questpie/admin/factories').BlockBuilder<{ name: TName }>"
|
|
91
91
|
} },
|
|
92
92
|
fieldExtensions: {
|
|
93
93
|
admin: {
|
|
@@ -96,7 +96,7 @@ function adminPlugin() {
|
|
|
96
96
|
},
|
|
97
97
|
form: {
|
|
98
98
|
stateKey: "form",
|
|
99
|
-
configType: "(ctx: { f: Record<string, string> }) => { fields: import('@questpie/admin/
|
|
99
|
+
configType: "(ctx: { f: Record<string, string> }) => { fields: import('@questpie/admin/factories').FieldLayoutItem[] }",
|
|
100
100
|
isCallback: true,
|
|
101
101
|
callbackContextParams: ["f"]
|
|
102
102
|
}
|
|
@@ -106,10 +106,10 @@ function adminPlugin() {
|
|
|
106
106
|
stateKey: "admin",
|
|
107
107
|
imports: [{
|
|
108
108
|
name: "AdminCollectionConfig",
|
|
109
|
-
from: "@questpie/admin/
|
|
109
|
+
from: "@questpie/admin/factories"
|
|
110
110
|
}, {
|
|
111
111
|
name: "AdminConfigContext",
|
|
112
|
-
from: "@questpie/admin/
|
|
112
|
+
from: "@questpie/admin/factories"
|
|
113
113
|
}],
|
|
114
114
|
configType: "AdminCollectionConfig | ((ctx: AdminConfigContext<$COMPONENTS>) => AdminCollectionConfig)",
|
|
115
115
|
isCallback: true,
|
|
@@ -120,15 +120,15 @@ function adminPlugin() {
|
|
|
120
120
|
imports: [
|
|
121
121
|
{
|
|
122
122
|
name: "ListViewConfig",
|
|
123
|
-
from: "@questpie/admin/
|
|
123
|
+
from: "@questpie/admin/factories"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
name: "ListViewConfigContext",
|
|
127
|
-
from: "@questpie/admin/
|
|
127
|
+
from: "@questpie/admin/factories"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
name: "FilterViewsByKind",
|
|
131
|
-
from: "@questpie/admin/
|
|
131
|
+
from: "@questpie/admin/factories"
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
134
|
configType: "(ctx: ListViewConfigContext<TState extends { fieldDefinitions: infer F extends Record<string, any> } ? F : Record<string, any>, FilterViewsByKind<$VIEWS_RECORD, \"list\">>) => ListViewConfig",
|
|
@@ -150,15 +150,15 @@ function adminPlugin() {
|
|
|
150
150
|
imports: [
|
|
151
151
|
{
|
|
152
152
|
name: "FormViewConfig",
|
|
153
|
-
from: "@questpie/admin/
|
|
153
|
+
from: "@questpie/admin/factories"
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
name: "FormViewConfigContext",
|
|
157
|
-
from: "@questpie/admin/
|
|
157
|
+
from: "@questpie/admin/factories"
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
name: "FilterViewsByKind",
|
|
161
|
-
from: "@questpie/admin/
|
|
161
|
+
from: "@questpie/admin/factories"
|
|
162
162
|
}
|
|
163
163
|
],
|
|
164
164
|
configType: "(ctx: FormViewConfigContext<TState extends { fieldDefinitions: infer F extends Record<string, any> } ? F : Record<string, any>, FilterViewsByKind<$VIEWS_RECORD, \"form\">>) => FormViewConfig",
|
|
@@ -173,7 +173,7 @@ function adminPlugin() {
|
|
|
173
173
|
stateKey: "adminPreview",
|
|
174
174
|
imports: [{
|
|
175
175
|
name: "PreviewConfig",
|
|
176
|
-
from: "@questpie/admin/
|
|
176
|
+
from: "@questpie/admin/factories"
|
|
177
177
|
}],
|
|
178
178
|
configType: "PreviewConfig"
|
|
179
179
|
},
|
|
@@ -181,10 +181,10 @@ function adminPlugin() {
|
|
|
181
181
|
stateKey: "adminActions",
|
|
182
182
|
imports: [{
|
|
183
183
|
name: "ServerActionsConfig",
|
|
184
|
-
from: "@questpie/admin/
|
|
184
|
+
from: "@questpie/admin/factories"
|
|
185
185
|
}, {
|
|
186
186
|
name: "ActionsConfigContext",
|
|
187
|
-
from: "@questpie/admin/
|
|
187
|
+
from: "@questpie/admin/factories"
|
|
188
188
|
}],
|
|
189
189
|
configType: "(ctx: ActionsConfigContext<Record<string, unknown>, $COMPONENTS>) => ServerActionsConfig",
|
|
190
190
|
isCallback: true,
|
|
@@ -200,10 +200,10 @@ function adminPlugin() {
|
|
|
200
200
|
stateKey: "admin",
|
|
201
201
|
imports: [{
|
|
202
202
|
name: "AdminGlobalConfig",
|
|
203
|
-
from: "@questpie/admin/
|
|
203
|
+
from: "@questpie/admin/factories"
|
|
204
204
|
}, {
|
|
205
205
|
name: "AdminConfigContext",
|
|
206
|
-
from: "@questpie/admin/
|
|
206
|
+
from: "@questpie/admin/factories"
|
|
207
207
|
}],
|
|
208
208
|
configType: "AdminGlobalConfig | ((ctx: AdminConfigContext<$COMPONENTS>) => AdminGlobalConfig)",
|
|
209
209
|
isCallback: true,
|
|
@@ -214,15 +214,15 @@ function adminPlugin() {
|
|
|
214
214
|
imports: [
|
|
215
215
|
{
|
|
216
216
|
name: "FormViewConfig",
|
|
217
|
-
from: "@questpie/admin/
|
|
217
|
+
from: "@questpie/admin/factories"
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
220
|
name: "FormViewConfigContext",
|
|
221
|
-
from: "@questpie/admin/
|
|
221
|
+
from: "@questpie/admin/factories"
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
name: "FilterViewsByKind",
|
|
225
|
-
from: "@questpie/admin/
|
|
225
|
+
from: "@questpie/admin/factories"
|
|
226
226
|
}
|
|
227
227
|
],
|
|
228
228
|
configType: "(ctx: FormViewConfigContext<TState extends { fieldDefinitions: infer F extends Record<string, any> } ? F : Record<string, any>, FilterViewsByKind<$VIEWS_RECORD, \"form\">>) => FormViewConfig",
|
|
@@ -238,7 +238,7 @@ function adminPlugin() {
|
|
|
238
238
|
configType: "AdminConfigInput",
|
|
239
239
|
imports: [{
|
|
240
240
|
name: "AdminConfigInput",
|
|
241
|
-
from: "@questpie/admin/
|
|
241
|
+
from: "@questpie/admin/factories"
|
|
242
242
|
}],
|
|
243
243
|
isCallback: true
|
|
244
244
|
} }
|
|
@@ -247,15 +247,15 @@ function adminPlugin() {
|
|
|
247
247
|
callbackParams: {
|
|
248
248
|
v: {
|
|
249
249
|
factory: "createViewCallbackProxy",
|
|
250
|
-
from: "@questpie/admin/
|
|
250
|
+
from: "@questpie/admin/factories"
|
|
251
251
|
},
|
|
252
252
|
c: {
|
|
253
253
|
factory: "createComponentCallbackProxy",
|
|
254
|
-
from: "@questpie/admin/
|
|
254
|
+
from: "@questpie/admin/factories"
|
|
255
255
|
},
|
|
256
256
|
a: {
|
|
257
257
|
factory: "createActionCallbackProxy",
|
|
258
|
-
from: "@questpie/admin/
|
|
258
|
+
from: "@questpie/admin/factories"
|
|
259
259
|
}
|
|
260
260
|
},
|
|
261
261
|
scaffolds: {
|
|
@@ -267,12 +267,12 @@ function adminPlugin() {
|
|
|
267
267
|
view: {
|
|
268
268
|
dir: "views",
|
|
269
269
|
description: "Server-side view definition",
|
|
270
|
-
template: ({ kebab, camel }) => `import { view } from "@questpie/admin/
|
|
270
|
+
template: ({ kebab, camel }) => `import { view } from "@questpie/admin/factories";\n\nexport const ${camel}View = view("${kebab}", {\n\tkind: "list",\n});\n`
|
|
271
271
|
},
|
|
272
272
|
component: {
|
|
273
273
|
dir: "components",
|
|
274
274
|
description: "Server-side component definition",
|
|
275
|
-
template: ({ kebab, camel }) => `import { component } from "@questpie/admin/
|
|
275
|
+
template: ({ kebab, camel }) => `import { component } from "@questpie/admin/factories";\n\nexport const ${camel}Component = component("${kebab}", {\n\t// TODO: configure component props\n});\n`
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
},
|
|
@@ -336,7 +336,7 @@ function adminPlugin() {
|
|
|
336
336
|
const blockFiles = ctx.categories.get("blocks");
|
|
337
337
|
if (!blockFiles || blockFiles.size === 0) return;
|
|
338
338
|
ctx.addImport("type { BlockRendererProps }", "@questpie/admin/client");
|
|
339
|
-
ctx.addImport("type { InferBlockValues, InferBlockData }", "@questpie/admin/
|
|
339
|
+
ctx.addImport("type { InferBlockValues, InferBlockData }", "@questpie/admin/factories");
|
|
340
340
|
const entries = [];
|
|
341
341
|
for (const [key, file] of [...blockFiles.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
342
342
|
const varName = `${key}Block`;
|
|
@@ -362,19 +362,19 @@ function adminPlugin() {
|
|
|
362
362
|
dir: "views",
|
|
363
363
|
extension: ".tsx",
|
|
364
364
|
description: "Client-side view component",
|
|
365
|
-
template: ({ kebab, pascal }) => `import {
|
|
365
|
+
template: ({ kebab, pascal }) => `import { type CollectionListViewProps, view } from "@questpie/admin/client";\n\nfunction ${pascal}View(_props: CollectionListViewProps) {\n\treturn (\n\t\t<div>\n\t\t\t<h2>${pascal} View</h2>\n\t\t\t{/* TODO: implement view */}\n\t\t</div>\n\t);\n}\n\nexport default view("${kebab}", {\n\tkind: "list",\n\tcomponent: ${pascal}View,\n});\n`
|
|
366
366
|
},
|
|
367
367
|
field: {
|
|
368
368
|
dir: "fields",
|
|
369
369
|
extension: ".tsx",
|
|
370
370
|
description: "Client-side field component",
|
|
371
|
-
template: ({ kebab, pascal }) => `import { field } from "@questpie/admin";\n\
|
|
371
|
+
template: ({ kebab, pascal }) => `import { type BaseFieldProps, field } from "@questpie/admin/client";\n\nfunction ${pascal}Field({ label, value, onChange, onBlur }: BaseFieldProps) {\n\treturn (\n\t\t<label>\n\t\t\t<span>{label ?? "${pascal}"}</span>\n\t\t\t<input\n\t\t\t\tvalue={typeof value === "string" ? value : ""}\n\t\t\t\tonChange={(event) => onChange?.(event.target.value)}\n\t\t\t\tonBlur={onBlur}\n\t\t\t/>\n\t\t</label>\n\t);\n}\n\nexport default field("${kebab}", {\n\tcomponent: ${pascal}Field,\n});\n`
|
|
372
372
|
},
|
|
373
373
|
widget: {
|
|
374
374
|
dir: "widgets",
|
|
375
375
|
extension: ".tsx",
|
|
376
376
|
description: "Client-side dashboard widget",
|
|
377
|
-
template: ({ kebab, pascal }) => `import {
|
|
377
|
+
template: ({ kebab, pascal }) => `import { type WidgetComponentProps, widget } from "@questpie/admin/client";\n\nfunction ${pascal}Widget(_props: WidgetComponentProps) {\n\treturn (\n\t\t<div>\n\t\t\t<h3>${pascal} Widget</h3>\n\t\t\t{/* TODO: implement widget */}\n\t\t</div>\n\t);\n}\n\nexport default widget("${kebab}", {\n\tcomponent: ${pascal}Widget,\n});\n`
|
|
378
378
|
}
|
|
379
379
|
},
|
|
380
380
|
generate: (ctx) => generateAdminClientTemplate(ctx)
|
package/dist/server.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { AdminBlockConfig, AdminCollectionConfig, AdminGlobalConfig, BlockCatego
|
|
|
3
3
|
import { AdminConfigContext, ComponentDefinition, ComponentFactory, EditViewDefinition, EditViewFactory, FilterViewsByKind, FormViewConfigContext, ListViewConfigContext, ListViewDefinition, ListViewFactory, ViewDefinition, ViewKind, ViewKindRegistry } from "./server/augmentation/views.mjs";
|
|
4
4
|
import { DashboardActionFactory, DashboardActionProxy, DashboardCallback, DashboardCallbackContext, DashboardConfigContext, DashboardContribution, DashboardItemDef, DashboardProxy, DashboardSectionDef, ServerBrandingConfig, ServerChartWidget, ServerCustomWidget, ServerDashboardAction, ServerDashboardConfig, ServerDashboardItem, ServerDashboardSection, ServerDashboardTab, ServerDashboardTabs, ServerDashboardWidget, ServerProgressWidget, ServerQuickAction, ServerQuickActionsWidget, ServerRecentItemsWidget, ServerStatsWidget, ServerTableWidget, ServerTimelineWidget, ServerValueWidget, WidgetAccessRule, WidgetFetchContext } from "./server/augmentation/dashboard.mjs";
|
|
5
5
|
import { ServerSidebarCollectionItem, ServerSidebarConfig, ServerSidebarDividerItem, ServerSidebarGlobalItem, ServerSidebarItem, ServerSidebarLinkItem, ServerSidebarPageItem, ServerSidebarSection, SidebarCallback, SidebarCallbackContext, SidebarConfigContext, SidebarContribution, SidebarItemDef, SidebarProxy, SidebarSectionDef } from "./server/augmentation/sidebar.mjs";
|
|
6
|
+
import { AdminShellRailPlacement, AdminShellRouteRules, ServerAdminShellConfig, ServerAdminShellRailConfig } from "./server/augmentation/shell.mjs";
|
|
6
7
|
import { ActionsConfigContext, BuiltinActionType, ServerActionContext, ServerActionDefinition, ServerActionDownload, ServerActionEffects, ServerActionError, ServerActionForm, ServerActionFormField, ServerActionHandler, ServerActionRedirect, ServerActionResult, ServerActionSuccess, ServerActionsConfig } from "./server/augmentation/actions.mjs";
|
|
7
8
|
import { AdminConfigInput, adminConfig } from "./server/augmentation/index.mjs";
|
|
8
9
|
import "./server/augmentation.mjs";
|
|
@@ -13,7 +14,8 @@ import { AnyBlockBuilder, AnyBlockDefinition, BlockBuilder, BlockBuilderState, B
|
|
|
13
14
|
import { BlockSchema, getBlocksByCategory, introspectBlock, introspectBlocks } from "./server/modules/admin/block/introspection.mjs";
|
|
14
15
|
import { BlocksPrefetchContext, createBlocksPrefetchHook, processBlocksDocument, processDocumentBlocksPrefetch } from "./server/modules/admin/block/prefetch.mjs";
|
|
15
16
|
import "./server/block/index.mjs";
|
|
16
|
-
import {
|
|
17
|
+
import { component, editView, filterViewsByKind, listView, view } from "./server/registry-helpers.mjs";
|
|
18
|
+
import { createActionCallbackProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback } from "./server/proxy-factories.mjs";
|
|
17
19
|
import { AuthSession, GetAdminSessionOptions, RequireAdminAuthOptions, getAdminSession, isAdminUser, requireAdminAuth } from "./server/modules/admin/auth-helpers.mjs";
|
|
18
20
|
import { NextAuthMiddlewareOptions, createNextAuthMiddleware, getNextAdminSession } from "./server/adapters/nextjs.mjs";
|
|
19
21
|
import { BeforeLoadContext, TanStackAuthGuardOptions, createTanStackAuthGuard, createTanStackSessionLoader } from "./server/adapters/tanstack.mjs";
|
|
@@ -27,7 +29,7 @@ import { savedViewsCollection } from "./server/modules/admin-preferences/collect
|
|
|
27
29
|
import { AdminModule, adminModule, adminRoutes } from "./server/modules/admin/index.mjs";
|
|
28
30
|
import { auditLogCollection } from "./server/modules/audit/collections/audit-log.mjs";
|
|
29
31
|
import { AuditModule, _module } from "./server/modules/audit/.generated/module.mjs";
|
|
32
|
+
import { AuditActorType, AuditContext, LogAuditEntryOptions, logAuditEntry } from "./server/modules/audit/log-audit-entry.mjs";
|
|
30
33
|
import "./server/modules/audit/index.mjs";
|
|
31
|
-
import {
|
|
32
|
-
|
|
33
|
-
export { type ActionReference, type ActionsConfigContext, type AdminBlockConfig, type AdminCollectionConfig, type AdminConfigContext, type AdminConfigInput, type AdminGlobalConfig, type AdminLocaleConfig, type AdminModule, type AnyBlockBuilder, type AnyBlockDefinition, type AuditModule, type AuthSession, BeforeLoadContext, BlockBuilder, type BlockBuilderState, type BlockCategoryConfig, type BlockDefinition, type BlockNode, type BlockPrefetchContext, type BlockPrefetchFn, type BlockPrefetchWith, type BlockPrefetchWithOptions, type BlockSchema, type BlockValues, type BlocksDocument, type BlocksFieldMeta, type BlocksPrefetchContext, type BuiltinActionType, type ComponentDefinition, type ComponentFactory, type ComponentReference, type ComponentType, type ComponentTypeRegistry, type DashboardActionFactory, type DashboardActionProxy, type DashboardCallback, type DashboardCallbackContext, type DashboardConfigContext, type DashboardContribution, type DashboardItemDef, type DashboardProxy, type DashboardSectionDef, type EditViewDefinition, type EditViewFactory, type ExecuteActionRequest, type ExecuteActionResponse, type ExpandWithResult, type ExpandedRecord, type FieldLayoutItem, type FilterOperator, type FilterRule, type FilterViewsByKind, type FormFieldLayoutItem, type FormReactiveConfig, type FormReactiveContext, type FormSectionLayout, type FormSidebarConfig, type FormTabConfig, type FormTabsLayout, type FormViewConfig, type FormViewConfigContext, type GetAdminSessionOptions, type InferBlockData, type InferBlockValues, type ListViewConfig, type ListViewConfigContext, type ListViewDefinition, type ListViewFactory, NextAuthMiddlewareOptions, type PreviewConfig, type PreviewTokenPayload, type RequireAdminAuthOptions, type RichTextFeature, type RichTextFieldMeta, type ServerActionContext, type ServerActionDefinition, type ServerActionDownload, type ServerActionEffects, type ServerActionError, type ServerActionForm, type ServerActionFormField, type ServerActionHandler, type ServerActionRedirect, type ServerActionResult, type ServerActionSuccess, type ServerActionsConfig, type ServerBrandingConfig, type ServerChartWidget, type ServerCustomWidget, type ServerDashboardAction, type ServerDashboardConfig, type ServerDashboardItem, type ServerDashboardSection, type ServerDashboardTab, type ServerDashboardTabs, type ServerDashboardWidget, type ServerProgressWidget, type ServerQuickAction, type ServerQuickActionsWidget, type ServerRecentItemsWidget, type ServerSidebarCollectionItem, type ServerSidebarConfig, type ServerSidebarDividerItem, type ServerSidebarGlobalItem, type ServerSidebarItem, type ServerSidebarLinkItem, type ServerSidebarPageItem, type ServerSidebarSection, type ServerStatsWidget, type ServerTableWidget, type ServerTimelineWidget, type ServerValueWidget, type SidebarCallback, type SidebarCallbackContext, type SidebarConfigContext, type SidebarContribution, type SidebarItemDef, type SidebarProxy, type SidebarSectionDef, type SortConfig, TanStackAuthGuardOptions, type TipTapDocument, type TipTapNode, type ViewConfiguration, type ViewDefinition, type ViewKind, type ViewKindRegistry, type WidgetAccessRule, type WidgetFetchContext, actionFunctions, adminConfig, adminFields, adminModule, adminPlugin, adminRoutes, auditLogCollection, _module as auditModule, batchReactive, block, component, createActionCallbackProxy, createActionProxy, createBlocksPrefetchHook, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createFirstAdmin, createNextAuthMiddleware, createPreviewFunctions, createPreviewTokenVerifier, createSidebarCallbackContext, createSidebarContributionProxy, createTanStackAuthGuard, createTanStackSessionLoader, createViewCallbackProxy, createViewProxy, editView, executeAction, executeActionFn, fetchWidgetData, fieldOptions, filterViewsByKind, getActionsConfig, getActionsConfigFn, getAdminSession, getBlocksByCategory, getNextAdminSession, introspectBlock, introspectBlocks, isAdminUser, isSetupRequired, listView, processBlocksDocument, processDocumentBlocksPrefetch, reactiveFunctions, requireAdminAuth, resolveDashboardCallback, resolveSidebarCallback, savedViewsCollection, setupFunctions, verifyPreviewTokenDirect, view, widgetDataFunctions };
|
|
34
|
+
import { adminPlugin } from "./server/plugin.mjs";
|
|
35
|
+
export { type ActionReference, type ActionsConfigContext, type AdminBlockConfig, type AdminCollectionConfig, type AdminConfigContext, type AdminConfigInput, type AdminGlobalConfig, type AdminLocaleConfig, type AdminModule, type AdminShellRailPlacement, type AdminShellRouteRules, type AnyBlockBuilder, type AnyBlockDefinition, type AuditActorType, type AuditContext, type AuditModule, type AuthSession, BeforeLoadContext, BlockBuilder, type BlockBuilderState, type BlockCategoryConfig, type BlockDefinition, type BlockNode, type BlockPrefetchContext, type BlockPrefetchFn, type BlockPrefetchWith, type BlockPrefetchWithOptions, type BlockSchema, type BlockValues, type BlocksDocument, type BlocksFieldMeta, type BlocksPrefetchContext, type BuiltinActionType, type ComponentDefinition, type ComponentFactory, type ComponentReference, type ComponentType, type ComponentTypeRegistry, type DashboardActionFactory, type DashboardActionProxy, type DashboardCallback, type DashboardCallbackContext, type DashboardConfigContext, type DashboardContribution, type DashboardItemDef, type DashboardProxy, type DashboardSectionDef, type EditViewDefinition, type EditViewFactory, type ExecuteActionRequest, type ExecuteActionResponse, type ExpandWithResult, type ExpandedRecord, type FieldLayoutItem, type FilterOperator, type FilterRule, type FilterViewsByKind, type FormFieldLayoutItem, type FormReactiveConfig, type FormReactiveContext, type FormSectionLayout, type FormSidebarConfig, type FormTabConfig, type FormTabsLayout, type FormViewConfig, type FormViewConfigContext, type GetAdminSessionOptions, type InferBlockData, type InferBlockValues, type ListViewConfig, type ListViewConfigContext, type ListViewDefinition, type ListViewFactory, type LogAuditEntryOptions, NextAuthMiddlewareOptions, type PreviewConfig, type PreviewTokenPayload, type RequireAdminAuthOptions, type RichTextFeature, type RichTextFieldMeta, type ServerActionContext, type ServerActionDefinition, type ServerActionDownload, type ServerActionEffects, type ServerActionError, type ServerActionForm, type ServerActionFormField, type ServerActionHandler, type ServerActionRedirect, type ServerActionResult, type ServerActionSuccess, type ServerActionsConfig, type ServerAdminShellConfig, type ServerAdminShellRailConfig, type ServerBrandingConfig, type ServerChartWidget, type ServerCustomWidget, type ServerDashboardAction, type ServerDashboardConfig, type ServerDashboardItem, type ServerDashboardSection, type ServerDashboardTab, type ServerDashboardTabs, type ServerDashboardWidget, type ServerProgressWidget, type ServerQuickAction, type ServerQuickActionsWidget, type ServerRecentItemsWidget, type ServerSidebarCollectionItem, type ServerSidebarConfig, type ServerSidebarDividerItem, type ServerSidebarGlobalItem, type ServerSidebarItem, type ServerSidebarLinkItem, type ServerSidebarPageItem, type ServerSidebarSection, type ServerStatsWidget, type ServerTableWidget, type ServerTimelineWidget, type ServerValueWidget, type SidebarCallback, type SidebarCallbackContext, type SidebarConfigContext, type SidebarContribution, type SidebarItemDef, type SidebarProxy, type SidebarSectionDef, type SortConfig, TanStackAuthGuardOptions, type TipTapDocument, type TipTapNode, type ViewConfiguration, type ViewDefinition, type ViewKind, type ViewKindRegistry, type WidgetAccessRule, type WidgetFetchContext, actionFunctions, adminConfig, adminFields, adminModule, adminPlugin, adminRoutes, auditLogCollection, _module as auditModule, batchReactive, block, component, createActionCallbackProxy, createActionProxy, createBlocksPrefetchHook, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createFirstAdmin, createNextAuthMiddleware, createPreviewFunctions, createPreviewTokenVerifier, createSidebarCallbackContext, createSidebarContributionProxy, createTanStackAuthGuard, createTanStackSessionLoader, createViewCallbackProxy, createViewProxy, editView, executeAction, executeActionFn, fetchWidgetData, fieldOptions, filterViewsByKind, getActionsConfig, getActionsConfigFn, getAdminSession, getBlocksByCategory, getNextAdminSession, introspectBlock, introspectBlocks, isAdminUser, isSetupRequired, listView, logAuditEntry, processBlocksDocument, processDocumentBlocksPrefetch, reactiveFunctions, requireAdminAuth, resolveDashboardCallback, resolveSidebarCallback, savedViewsCollection, setupFunctions, verifyPreviewTokenDirect, view, widgetDataFunctions };
|
package/dist/server.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createTanStackAuthGuard, createTanStackSessionLoader } from "./server/adapters/tanstack.mjs";
|
|
1
|
+
import { adminConfig } from "./server/augmentation/index.mjs";
|
|
2
|
+
import { component, editView, filterViewsByKind, listView, view } from "./server/registry-helpers.mjs";
|
|
3
|
+
import { createActionCallbackProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback } from "./server/proxy-factories.mjs";
|
|
5
4
|
import { createBlocksPrefetchHook, processBlocksDocument, processDocumentBlocksPrefetch } from "./server/modules/admin/block/prefetch.mjs";
|
|
6
5
|
import { adminFields } from "./server/fields/index.mjs";
|
|
7
6
|
import { BlockBuilder, block } from "./server/modules/admin/block/block-builder.mjs";
|
|
8
7
|
import { getBlocksByCategory, introspectBlock, introspectBlocks } from "./server/modules/admin/block/introspection.mjs";
|
|
8
|
+
import { getAdminSession, isAdminUser, requireAdminAuth } from "./server/modules/admin/auth-helpers.mjs";
|
|
9
|
+
import { createNextAuthMiddleware, getNextAdminSession } from "./server/adapters/nextjs.mjs";
|
|
10
|
+
import { createTanStackAuthGuard, createTanStackSessionLoader } from "./server/adapters/tanstack.mjs";
|
|
11
|
+
import { adminPlugin } from "./server/plugin.mjs";
|
|
9
12
|
import { savedViewsCollection } from "./server/modules/admin-preferences/collections/saved-views.mjs";
|
|
10
|
-
import { createActionCallbackProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback } from "./server/proxy-factories.mjs";
|
|
11
13
|
import { actionFunctions, executeAction, executeActionFn, getActionsConfig, getActionsConfigFn } from "./server/modules/admin/routes/execute-action.mjs";
|
|
12
14
|
import { createPreviewFunctions, createPreviewTokenVerifier, verifyPreviewTokenDirect } from "./server/modules/admin/routes/preview.mjs";
|
|
13
15
|
import { batchReactive, fieldOptions, reactiveFunctions } from "./server/modules/admin/routes/reactive.mjs";
|
|
14
16
|
import { createFirstAdmin, isSetupRequired, setupFunctions } from "./server/modules/admin/routes/setup.mjs";
|
|
15
17
|
import { fetchWidgetData, widgetDataFunctions } from "./server/modules/admin/routes/widget-data.mjs";
|
|
16
|
-
import { component, editView, filterViewsByKind, listView, view } from "./server/registry-helpers.mjs";
|
|
17
|
-
import { adminConfig } from "./server/augmentation/index.mjs";
|
|
18
18
|
import { adminModule, adminRoutes } from "./server/modules/admin/index.mjs";
|
|
19
19
|
import { auditLogCollection } from "./server/modules/audit/collections/audit-log.mjs";
|
|
20
20
|
import module_default from "./server/modules/audit/.generated/module.mjs";
|
|
21
|
+
import { logAuditEntry } from "./server/modules/audit/log-audit-entry.mjs";
|
|
21
22
|
|
|
22
|
-
export { BlockBuilder, actionFunctions, adminConfig, adminFields, adminModule, adminPlugin, adminRoutes, auditLogCollection, module_default as auditModule, batchReactive, block, component, createActionCallbackProxy, createActionProxy, createBlocksPrefetchHook, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createFirstAdmin, createNextAuthMiddleware, createPreviewFunctions, createPreviewTokenVerifier, createSidebarCallbackContext, createSidebarContributionProxy, createTanStackAuthGuard, createTanStackSessionLoader, createViewCallbackProxy, createViewProxy, editView, executeAction, executeActionFn, fetchWidgetData, fieldOptions, filterViewsByKind, getActionsConfig, getActionsConfigFn, getAdminSession, getBlocksByCategory, getNextAdminSession, introspectBlock, introspectBlocks, isAdminUser, isSetupRequired, listView, processBlocksDocument, processDocumentBlocksPrefetch, reactiveFunctions, requireAdminAuth, resolveDashboardCallback, resolveSidebarCallback, savedViewsCollection, setupFunctions, verifyPreviewTokenDirect, view, widgetDataFunctions };
|
|
23
|
+
export { BlockBuilder, actionFunctions, adminConfig, adminFields, adminModule, adminPlugin, adminRoutes, auditLogCollection, module_default as auditModule, batchReactive, block, component, createActionCallbackProxy, createActionProxy, createBlocksPrefetchHook, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createFirstAdmin, createNextAuthMiddleware, createPreviewFunctions, createPreviewTokenVerifier, createSidebarCallbackContext, createSidebarContributionProxy, createTanStackAuthGuard, createTanStackSessionLoader, createViewCallbackProxy, createViewProxy, editView, executeAction, executeActionFn, fetchWidgetData, fieldOptions, filterViewsByKind, getActionsConfig, getActionsConfigFn, getAdminSession, getBlocksByCategory, getNextAdminSession, introspectBlock, introspectBlocks, isAdminUser, isSetupRequired, listView, logAuditEntry, processBlocksDocument, processDocumentBlocksPrefetch, reactiveFunctions, requireAdminAuth, resolveDashboardCallback, resolveSidebarCallback, savedViewsCollection, setupFunctions, verifyPreviewTokenDirect, view, widgetDataFunctions };
|
|
@@ -76,11 +76,11 @@ declare function isDraftMode(cookieHeader: string | null | undefined): boolean;
|
|
|
76
76
|
*/
|
|
77
77
|
declare function createDraftModeCookie(enabled: boolean, maxAge?: number): string;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
* Falls back to SECRET if PREVIEW_SECRET is not set.
|
|
79
|
+
* Resolve a preview secret from an explicit value.
|
|
81
80
|
*
|
|
82
|
-
* @
|
|
81
|
+
* @deprecated Preview token signing now reads `app.config.secret` in server
|
|
82
|
+
* route handlers. Pass a secret explicitly when using standalone helpers.
|
|
83
83
|
*/
|
|
84
|
-
declare function getPreviewSecret(): string;
|
|
84
|
+
declare function getPreviewSecret(secret?: string): string;
|
|
85
85
|
//#endregion
|
|
86
86
|
export { ADMIN_API_PREFIX, DRAFT_MODE_COOKIE, createDraftModeCookie, getPreviewSecret, isAdminRequest, isDraftMode };
|
|
@@ -127,15 +127,13 @@ function createDraftModeCookie(enabled, maxAge = 3600) {
|
|
|
127
127
|
return `${DRAFT_MODE_COOKIE}=; Path=/; Max-Age=0; SameSite=Lax; HttpOnly`;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
* Falls back to SECRET if PREVIEW_SECRET is not set.
|
|
130
|
+
* Resolve a preview secret from an explicit value.
|
|
132
131
|
*
|
|
133
|
-
* @
|
|
132
|
+
* @deprecated Preview token signing now reads `app.config.secret` in server
|
|
133
|
+
* route handlers. Pass a secret explicitly when using standalone helpers.
|
|
134
134
|
*/
|
|
135
|
-
function getPreviewSecret() {
|
|
136
|
-
|
|
137
|
-
if (process.env.NODE_ENV === "production" && secret === "dev-preview-secret") console.warn("[preview] Using default secret in production. Set PREVIEW_SECRET or SECRET env var.");
|
|
138
|
-
return secret;
|
|
135
|
+
function getPreviewSecret(secret) {
|
|
136
|
+
return secret ?? "dev-preview-secret";
|
|
139
137
|
}
|
|
140
138
|
|
|
141
139
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@questpie/admin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/questpie/questpie.git",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
".": "./dist/index.mjs",
|
|
25
25
|
"./client": "./dist/client.mjs",
|
|
26
26
|
"./client-module": "./dist/client-module.mjs",
|
|
27
|
+
"./client/modules/admin": "./dist/client/modules/admin.mjs",
|
|
28
|
+
"./factories": "./dist/factories.mjs",
|
|
29
|
+
"./fields": "./dist/fields.mjs",
|
|
30
|
+
"./modules/admin": "./dist/modules/admin.mjs",
|
|
31
|
+
"./modules/audit": "./dist/modules/audit.mjs",
|
|
27
32
|
"./plugin": "./dist/plugin.mjs",
|
|
28
33
|
"./server": "./dist/server.mjs",
|
|
29
34
|
"./shared": "./dist/shared.mjs",
|
|
@@ -37,6 +42,11 @@
|
|
|
37
42
|
".": "./dist/index.mjs",
|
|
38
43
|
"./client": "./dist/client.mjs",
|
|
39
44
|
"./client-module": "./dist/client-module.mjs",
|
|
45
|
+
"./client/modules/admin": "./dist/client/modules/admin.mjs",
|
|
46
|
+
"./factories": "./dist/factories.mjs",
|
|
47
|
+
"./fields": "./dist/fields.mjs",
|
|
48
|
+
"./modules/admin": "./dist/modules/admin.mjs",
|
|
49
|
+
"./modules/audit": "./dist/modules/audit.mjs",
|
|
40
50
|
"./plugin": "./dist/plugin.mjs",
|
|
41
51
|
"./server": "./dist/server.mjs",
|
|
42
52
|
"./shared": "./dist/shared.mjs",
|
|
@@ -62,7 +72,7 @@
|
|
|
62
72
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
63
73
|
"@hookform/resolvers": "^5.1.0",
|
|
64
74
|
"@iconify/react": "^6.0.2",
|
|
65
|
-
"@questpie/tanstack-query": "^3.
|
|
75
|
+
"@questpie/tanstack-query": "^3.4.0",
|
|
66
76
|
"@tailwindcss/vite": "^4.0.6",
|
|
67
77
|
"@tiptap/core": "^2.x",
|
|
68
78
|
"@tiptap/extension-character-count": "^2.x",
|
|
@@ -88,7 +98,7 @@
|
|
|
88
98
|
"date-fns": "^4.1.0",
|
|
89
99
|
"lowlight": "^3.x",
|
|
90
100
|
"next-themes": "^0.4.6",
|
|
91
|
-
"questpie": "^3.
|
|
101
|
+
"questpie": "^3.4.0",
|
|
92
102
|
"react-day-picker": "^9.12.0",
|
|
93
103
|
"react-hook-form": "^7.54.0",
|
|
94
104
|
"react-resizable-panels": "^4.4.2",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { selectBasePath, useAdminStore } from "../runtime/provider.mjs";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useQuery } from "@tanstack/react-query";
|
|
4
|
-
|
|
5
|
-
//#region src/client/hooks/use-audit-history.ts
|
|
6
|
-
function useAuditFetcher(path) {
|
|
7
|
-
const basePath = useAdminStore(selectBasePath);
|
|
8
|
-
return React.useCallback(async (signal) => {
|
|
9
|
-
const response = await fetch(`${basePath}${path}`, {
|
|
10
|
-
credentials: "include",
|
|
11
|
-
headers: { Accept: "application/json" },
|
|
12
|
-
signal
|
|
13
|
-
});
|
|
14
|
-
if (!response.ok) throw new Error(`Failed to fetch audit history: ${response.status}`);
|
|
15
|
-
const data = await response.json();
|
|
16
|
-
return Array.isArray(data) ? data : data?.docs ?? data ?? [];
|
|
17
|
-
}, [basePath, path]);
|
|
18
|
-
}
|
|
19
|
-
function useGlobalAuditHistory(globalName, options, queryOptions) {
|
|
20
|
-
const params = new URLSearchParams();
|
|
21
|
-
if (options?.limit) params.set("limit", String(options.limit));
|
|
22
|
-
const fetchAudit = useAuditFetcher(`/globals/${globalName}/audit${params.toString() ? `?${params}` : ""}`);
|
|
23
|
-
return useQuery({
|
|
24
|
-
queryKey: [
|
|
25
|
-
"questpie",
|
|
26
|
-
"audit",
|
|
27
|
-
"global",
|
|
28
|
-
globalName,
|
|
29
|
-
options
|
|
30
|
-
],
|
|
31
|
-
queryFn: ({ signal }) => fetchAudit(signal),
|
|
32
|
-
enabled: !!globalName && (queryOptions?.enabled ?? true),
|
|
33
|
-
...queryOptions
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
export { useGlobalAuditHistory };
|