@questpie/admin 3.5.3 → 3.5.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/README.md +8 -0
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/builder/index.d.mts +1 -1
- package/dist/client/builder/types/collection-types.d.mts +80 -5
- package/dist/client/builder/types/common.d.mts +5 -0
- package/dist/client/builder/types/field-types.d.mts +41 -1
- package/dist/client/builder/view/view.d.mts +3 -2
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/fields/boolean-field.mjs +2 -1
- package/dist/client/components/fields/date-field.mjs +2 -1
- package/dist/client/components/fields/datetime-field.mjs +2 -1
- package/dist/client/components/fields/email-field.mjs +2 -1
- package/dist/client/components/fields/field-utils.d.mts +11 -0
- package/dist/client/components/fields/field-utils.mjs +3 -1
- package/dist/client/components/fields/field-wrapper.mjs +3 -3
- package/dist/client/components/fields/number-field.mjs +2 -1
- package/dist/client/components/fields/object-field.mjs +2 -1
- package/dist/client/components/fields/relation/displays/types.mjs +3 -3
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +2 -1
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +6 -2
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +2 -1
- package/dist/client/components/fields/rich-text-editor/index.d.mts +3 -2
- package/dist/client/components/fields/rich-text-editor/index.mjs +4 -3
- package/dist/client/components/fields/select-field.mjs +2 -1
- package/dist/client/components/fields/text-field.mjs +2 -1
- package/dist/client/components/fields/textarea-field.mjs +2 -1
- package/dist/client/components/fields/time-field.mjs +2 -1
- package/dist/client/components/layout/field-layout-renderer.mjs +4 -4
- package/dist/client/components/media/media-grid.mjs +2 -1
- package/dist/client/components/primitives/asset-preview.mjs +4 -2
- package/dist/client/components/primitives/dropzone.d.mts +100 -0
- package/dist/client/components/primitives/field-select-control.mjs +2 -1
- package/dist/client/components/ui/button.d.mts +23 -0
- package/dist/client/components/ui/button.mjs +2 -2
- package/dist/client/components/ui/dropdown-menu.d.mts +49 -0
- package/dist/client/components/ui/dropdown-menu.mjs +22 -1
- package/dist/client/components/ui/popover.mjs +1 -1
- package/dist/client/components/ui/search-input.d.mts +56 -0
- package/dist/client/components/ui/select.mjs +2 -2
- package/dist/client/components/ui/sheet.d.mts +40 -0
- package/dist/client/components/ui/table.d.mts +49 -0
- package/dist/client/components/ui/table.mjs +15 -1
- package/dist/client/components/ui/tooltip.d.mts +21 -0
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-admin-config.mjs +20 -1
- package/dist/client/hooks/use-autosave.mjs +91 -0
- package/dist/client/hooks/use-collection.mjs +65 -23
- package/dist/client/hooks/use-upload.d.mts +40 -0
- package/dist/client/hooks/use-upload.mjs +4 -2
- package/dist/client/i18n/hooks.d.mts +20 -0
- package/dist/client/lib/utils.d.mts +6 -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/runtime/provider.mjs +22 -3
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +22 -18
- package/dist/client/utils/asset-url.mjs +27 -0
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +4 -4
- package/dist/client/views/collection/cells/shared/asset-thumbnail.d.mts +7 -0
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +3 -2
- package/dist/client/views/collection/cells/shared/cell-helpers.mjs +3 -2
- package/dist/client/views/collection/cells/upload-cells.mjs +2 -1
- package/dist/client/views/collection/document-view.d.mts +30 -0
- package/dist/client/views/collection/document-view.mjs +377 -0
- package/dist/client/views/collection/field-context.mjs +3 -2
- package/dist/client/views/collection/field-renderer.mjs +2 -2
- package/dist/client/views/collection/form-view.mjs +14 -80
- package/dist/client/views/collection/list-view.mjs +19 -15
- package/dist/client/views/collection/table-view.mjs +1 -1
- package/dist/client/views/layout/admin-layout-provider.mjs +4 -3
- package/dist/client/views/layout/admin-layout.mjs +107 -20
- package/dist/client/views/layout/admin-router.mjs +19 -3
- package/dist/client/views/layout/admin-sidebar.mjs +50 -6
- package/dist/client/views/layout/admin-view-layout.d.mts +36 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/login-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client.d.mts +17 -2
- package/dist/client.mjs +16 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/factories.d.mts +2 -2
- package/dist/factories.mjs +2 -2
- package/dist/index.d.mts +17 -3
- package/dist/index.mjs +16 -1
- package/dist/server/augmentation/actions.d.mts +5 -0
- package/dist/server/augmentation/form-layout.d.mts +5 -0
- package/dist/server/augmentation/views.d.mts +4 -1
- package/dist/server/fields/blocks.mjs +4 -1
- package/dist/server/fields/reactive-runtime.mjs +3 -0
- package/dist/server/modules/admin/.generated/module.d.mts +1 -1
- package/dist/server/modules/admin/auth-helpers.mjs +7 -1
- package/dist/server/modules/admin/block/introspection.mjs +28 -4
- package/dist/server/modules/admin/block/prefetch.d.mts +11 -0
- package/dist/server/modules/admin/block/prefetch.mjs +108 -27
- package/dist/server/modules/admin/client/.generated/module.d.mts +68 -67
- package/dist/server/modules/admin/client/.generated/module.mjs +2 -0
- package/dist/server/modules/admin/client/views/collection-document.d.mts +6 -0
- package/dist/server/modules/admin/client/views/collection-document.mjs +10 -0
- package/dist/server/modules/admin/collections/account.d.mts +46 -46
- package/dist/server/modules/admin/collections/admin-locks.d.mts +57 -57
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +42 -42
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +50 -50
- package/dist/server/modules/admin/collections/apikey.d.mts +79 -71
- package/dist/server/modules/admin/collections/assets.d.mts +42 -42
- package/dist/server/modules/admin/collections/session.d.mts +45 -45
- package/dist/server/modules/admin/collections/user.d.mts +66 -66
- package/dist/server/modules/admin/collections/verification.d.mts +39 -39
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +34 -4
- package/dist/server/modules/admin/factories.mjs +4 -34
- package/dist/server/modules/admin/routes/admin-config.d.mts +3 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +18 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +10 -4
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/locales.mjs +1 -1
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/preview.mjs +6 -5
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/reactive.mjs +2 -2
- package/dist/server/modules/admin/routes/route-helpers.mjs +1 -1
- 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/routes/widget-data.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- package/dist/server/plugin.mjs +8 -3
- package/dist/server/proxy-factories.d.mts +8 -1
- package/dist/server/proxy-factories.mjs +33 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServerActionDefinition, ServerActionResult } from "../../../augmentation/actions.mjs";
|
|
2
2
|
import "../../../augmentation.mjs";
|
|
3
3
|
import { App } from "./route-helpers.mjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as questpie117 from "questpie";
|
|
5
5
|
|
|
6
6
|
//#region src/server/modules/admin/routes/execute-action.d.ts
|
|
7
7
|
|
|
@@ -56,37 +56,37 @@ declare function executeAction(app: App, request: ExecuteActionRequest, session?
|
|
|
56
56
|
* });
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
declare const executeActionFn:
|
|
59
|
+
declare const executeActionFn: questpie117.JsonRouteDefinition<{
|
|
60
60
|
collection: string;
|
|
61
61
|
actionId: string;
|
|
62
62
|
itemId?: string | undefined;
|
|
63
63
|
itemIds?: string[] | undefined;
|
|
64
64
|
data?: Record<string, unknown> | undefined;
|
|
65
65
|
locale?: string | undefined;
|
|
66
|
-
}, any,
|
|
66
|
+
}, any, questpie117.JsonRouteParams>;
|
|
67
67
|
/**
|
|
68
68
|
* Get actions configuration for a collection.
|
|
69
69
|
* Returns action definitions without handlers for client rendering.
|
|
70
70
|
*/
|
|
71
|
-
declare const getActionsConfigFn:
|
|
71
|
+
declare const getActionsConfigFn: questpie117.JsonRouteDefinition<{
|
|
72
72
|
collection: string;
|
|
73
|
-
}, any,
|
|
73
|
+
}, any, questpie117.JsonRouteParams>;
|
|
74
74
|
/**
|
|
75
75
|
* QUESTPIE functions for action execution.
|
|
76
76
|
* These are registered on the `adminModule`.
|
|
77
77
|
*/
|
|
78
78
|
declare const actionFunctions: {
|
|
79
|
-
executeAction:
|
|
79
|
+
executeAction: questpie117.JsonRouteDefinition<{
|
|
80
80
|
collection: string;
|
|
81
81
|
actionId: string;
|
|
82
82
|
itemId?: string | undefined;
|
|
83
83
|
itemIds?: string[] | undefined;
|
|
84
84
|
data?: Record<string, unknown> | undefined;
|
|
85
85
|
locale?: string | undefined;
|
|
86
|
-
}, any,
|
|
87
|
-
getActionsConfig:
|
|
86
|
+
}, any, questpie117.JsonRouteParams>;
|
|
87
|
+
getActionsConfig: questpie117.JsonRouteDefinition<{
|
|
88
88
|
collection: string;
|
|
89
|
-
}, any,
|
|
89
|
+
}, any, questpie117.JsonRouteParams>;
|
|
90
90
|
};
|
|
91
91
|
//#endregion
|
|
92
92
|
export { ExecuteActionRequest, ExecuteActionResponse, actionFunctions, executeAction, executeActionFn, getActionsConfig, getActionsConfigFn };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getApp, getCollection, getCollectionCrud, getCollectionCruds, getGlobalCruds, getSession } from "./route-helpers.mjs";
|
|
2
2
|
import { translateAdminMessage } from "./i18n-helpers.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { route, runWithContext } from "questpie";
|
|
4
|
+
import { extractAppServices, route, runWithContext } from "questpie";
|
|
5
5
|
|
|
6
6
|
//#region src/server/modules/admin/routes/execute-action.ts
|
|
7
7
|
/**
|
|
@@ -144,6 +144,11 @@ async function executeAction(app, request, session) {
|
|
|
144
144
|
}
|
|
145
145
|
try {
|
|
146
146
|
const appRec = app;
|
|
147
|
+
const services = extractAppServices(app, {
|
|
148
|
+
db: appRec.db,
|
|
149
|
+
session,
|
|
150
|
+
locale
|
|
151
|
+
});
|
|
147
152
|
const context = {
|
|
148
153
|
data: data || {},
|
|
149
154
|
itemId,
|
|
@@ -154,7 +159,8 @@ async function executeAction(app, request, session) {
|
|
|
154
159
|
db: appRec.db,
|
|
155
160
|
session,
|
|
156
161
|
locale,
|
|
157
|
-
t
|
|
162
|
+
t,
|
|
163
|
+
workflows: services.workflows
|
|
158
164
|
};
|
|
159
165
|
const result = await runWithContext({
|
|
160
166
|
app,
|
|
@@ -474,7 +480,7 @@ const getActionsConfigResponseSchema = z.object({
|
|
|
474
480
|
* });
|
|
475
481
|
* ```
|
|
476
482
|
*/
|
|
477
|
-
const executeActionFn = route().post().access((ctx) =>
|
|
483
|
+
const executeActionFn = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(executeActionRequestSchema).outputSchema(executeActionResponseSchema).handler(async (ctx) => {
|
|
478
484
|
const app = getApp(ctx);
|
|
479
485
|
const session = getSession(ctx);
|
|
480
486
|
return executeAction(app, ctx.input, session);
|
|
@@ -483,7 +489,7 @@ const executeActionFn = route().post().access((ctx) => !!ctx.session).schema(exe
|
|
|
483
489
|
* Get actions configuration for a collection.
|
|
484
490
|
* Returns action definitions without handlers for client rendering.
|
|
485
491
|
*/
|
|
486
|
-
const getActionsConfigFn = route().post().access((ctx) =>
|
|
492
|
+
const getActionsConfigFn = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(getActionsConfigRequestSchema).outputSchema(getActionsConfigResponseSchema).handler((ctx) => {
|
|
487
493
|
return getActionsConfig(getApp(ctx), ctx.input.collection);
|
|
488
494
|
});
|
|
489
495
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie435 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/locales.d.ts
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ import * as questpie344 from "questpie";
|
|
|
12
12
|
* Bundle of locale-related functions.
|
|
13
13
|
*/
|
|
14
14
|
declare const localeFunctions: {
|
|
15
|
-
readonly getContentLocales:
|
|
15
|
+
readonly getContentLocales: questpie435.JsonRouteDefinition<Record<string, never> | undefined, any, questpie435.JsonRouteParams>;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
18
|
export { localeFunctions };
|
|
@@ -39,7 +39,7 @@ const getContentLocalesOutputSchema = z.object({
|
|
|
39
39
|
* // }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
const getContentLocales = route().post().schema(getContentLocalesSchema).outputSchema(getContentLocalesOutputSchema).handler(async (ctx) => {
|
|
42
|
+
const getContentLocales = route().post().access(true).schema(getContentLocalesSchema).outputSchema(getContentLocalesOutputSchema).handler(async (ctx) => {
|
|
43
43
|
const localeConfig = getApp(ctx).config.locale;
|
|
44
44
|
if (!localeConfig) return {
|
|
45
45
|
locales: [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie133 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/preview.d.ts
|
|
4
4
|
|
|
@@ -25,13 +25,13 @@ interface PreviewTokenPayload {
|
|
|
25
25
|
* @returns Object with preview functions
|
|
26
26
|
*/
|
|
27
27
|
declare function createPreviewFunctions(secret?: PreviewSecretSource): {
|
|
28
|
-
mintPreviewToken:
|
|
28
|
+
mintPreviewToken: questpie133.JsonRouteDefinition<{
|
|
29
29
|
path: string;
|
|
30
30
|
ttlMs?: number | undefined;
|
|
31
|
-
}, any,
|
|
32
|
-
verifyPreviewToken:
|
|
31
|
+
}, any, questpie133.JsonRouteParams>;
|
|
32
|
+
verifyPreviewToken: questpie133.JsonRouteDefinition<{
|
|
33
33
|
token: string;
|
|
34
|
-
}, any,
|
|
34
|
+
}, any, questpie133.JsonRouteParams>;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Verify a preview token without RPC.
|
|
@@ -68,18 +68,18 @@ declare function createPreviewTokenVerifier(secret: string): (token: string) =>
|
|
|
68
68
|
* Used by the `adminModule` to register preview RPC functions.
|
|
69
69
|
*/
|
|
70
70
|
declare const previewFunctions: {
|
|
71
|
-
getPreviewUrl:
|
|
71
|
+
getPreviewUrl: questpie133.JsonRouteDefinition<{
|
|
72
72
|
collection: string;
|
|
73
73
|
record: Record<string, unknown>;
|
|
74
74
|
locale?: string | undefined;
|
|
75
|
-
}, any,
|
|
76
|
-
mintPreviewToken:
|
|
75
|
+
}, any, questpie133.JsonRouteParams>;
|
|
76
|
+
mintPreviewToken: questpie133.JsonRouteDefinition<{
|
|
77
77
|
path: string;
|
|
78
78
|
ttlMs?: number | undefined;
|
|
79
|
-
}, any,
|
|
80
|
-
verifyPreviewToken:
|
|
79
|
+
}, any, questpie133.JsonRouteParams>;
|
|
80
|
+
verifyPreviewToken: questpie133.JsonRouteDefinition<{
|
|
81
81
|
token: string;
|
|
82
|
-
}, any,
|
|
82
|
+
}, any, questpie133.JsonRouteParams>;
|
|
83
83
|
};
|
|
84
84
|
//#endregion
|
|
85
85
|
export { PreviewTokenPayload, createPreviewFunctions, createPreviewTokenVerifier, previewFunctions, verifyPreviewTokenDirect };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasAdminRole } from "../auth-helpers.mjs";
|
|
2
|
+
import { getApp, getCollectionState, getLocale } from "./route-helpers.mjs";
|
|
2
3
|
import { translateAdminMessage } from "./i18n-helpers.mjs";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
import { ApiError, route } from "questpie";
|
|
@@ -103,11 +104,11 @@ const DEFAULT_TTL_MS = 3600 * 1e3;
|
|
|
103
104
|
*/
|
|
104
105
|
function createPreviewFunctions(secret = defaultPreviewSecret) {
|
|
105
106
|
return {
|
|
106
|
-
mintPreviewToken: route().post().schema(mintPreviewTokenSchema).outputSchema(mintPreviewTokenOutputSchema).handler(async (ctx) => {
|
|
107
|
+
mintPreviewToken: route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(mintPreviewTokenSchema).outputSchema(mintPreviewTokenOutputSchema).handler(async (ctx) => {
|
|
107
108
|
const { input } = ctx;
|
|
108
109
|
const locale = getLocale(ctx);
|
|
109
110
|
const t = (key, params) => translateAdminMessage(locale, key, params);
|
|
110
|
-
if (!
|
|
111
|
+
if (!hasAdminRole(ctx)) throw ApiError.unauthorized(t("preview.adminSessionRequired"));
|
|
111
112
|
const { path, ttlMs = DEFAULT_TTL_MS } = input;
|
|
112
113
|
const expiresAt = Date.now() + ttlMs;
|
|
113
114
|
const payload = {
|
|
@@ -210,11 +211,11 @@ const getPreviewUrlOutputSchema = z.object({
|
|
|
210
211
|
* // Returns: "/about?preview=true"
|
|
211
212
|
* ```
|
|
212
213
|
*/
|
|
213
|
-
const getPreviewUrl = route().post().schema(getPreviewUrlSchema).outputSchema(getPreviewUrlOutputSchema).handler(async (ctx) => {
|
|
214
|
+
const getPreviewUrl = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(getPreviewUrlSchema).outputSchema(getPreviewUrlOutputSchema).handler(async (ctx) => {
|
|
214
215
|
const { input } = ctx;
|
|
215
216
|
const messageLocale = getLocale(ctx) ?? input.locale;
|
|
216
217
|
const t = (key, params) => translateAdminMessage(messageLocale, key, params);
|
|
217
|
-
if (!
|
|
218
|
+
if (!hasAdminRole(ctx)) return {
|
|
218
219
|
url: null,
|
|
219
220
|
error: t("preview.adminSessionRequired")
|
|
220
221
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie143 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/reactive.d.ts
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ import * as questpie121 from "questpie";
|
|
|
13
13
|
* Batch reactive endpoint.
|
|
14
14
|
* Executes multiple reactive handlers in a single request.
|
|
15
15
|
*/
|
|
16
|
-
declare const batchReactive:
|
|
16
|
+
declare const batchReactive: questpie143.JsonRouteDefinition<{
|
|
17
17
|
collection: string;
|
|
18
18
|
type: "collection" | "global";
|
|
19
19
|
requests: {
|
|
@@ -27,12 +27,12 @@ declare const batchReactive: questpie121.JsonRouteDefinition<{
|
|
|
27
27
|
}[];
|
|
28
28
|
formData?: Record<string, unknown> | undefined;
|
|
29
29
|
prevData?: Record<string, unknown> | null | undefined;
|
|
30
|
-
}, any,
|
|
30
|
+
}, any, questpie143.JsonRouteParams>;
|
|
31
31
|
/**
|
|
32
32
|
* Dynamic options endpoint.
|
|
33
33
|
* Fetches options for select/relation fields with search and pagination.
|
|
34
34
|
*/
|
|
35
|
-
declare const fieldOptions:
|
|
35
|
+
declare const fieldOptions: questpie143.JsonRouteDefinition<{
|
|
36
36
|
collection: string;
|
|
37
37
|
type: "collection" | "global";
|
|
38
38
|
field: string;
|
|
@@ -41,12 +41,12 @@ declare const fieldOptions: questpie121.JsonRouteDefinition<{
|
|
|
41
41
|
page: number;
|
|
42
42
|
limit: number;
|
|
43
43
|
siblingData?: Record<string, unknown> | null | undefined;
|
|
44
|
-
}, any,
|
|
44
|
+
}, any, questpie143.JsonRouteParams>;
|
|
45
45
|
/**
|
|
46
46
|
* Reactive functions bundle.
|
|
47
47
|
*/
|
|
48
48
|
declare const reactiveFunctions: {
|
|
49
|
-
readonly batchReactive:
|
|
49
|
+
readonly batchReactive: questpie143.JsonRouteDefinition<{
|
|
50
50
|
collection: string;
|
|
51
51
|
type: "collection" | "global";
|
|
52
52
|
requests: {
|
|
@@ -60,8 +60,8 @@ declare const reactiveFunctions: {
|
|
|
60
60
|
}[];
|
|
61
61
|
formData?: Record<string, unknown> | undefined;
|
|
62
62
|
prevData?: Record<string, unknown> | null | undefined;
|
|
63
|
-
}, any,
|
|
64
|
-
readonly fieldOptions:
|
|
63
|
+
}, any, questpie143.JsonRouteParams>;
|
|
64
|
+
readonly fieldOptions: questpie143.JsonRouteDefinition<{
|
|
65
65
|
collection: string;
|
|
66
66
|
type: "collection" | "global";
|
|
67
67
|
field: string;
|
|
@@ -70,7 +70,7 @@ declare const reactiveFunctions: {
|
|
|
70
70
|
page: number;
|
|
71
71
|
limit: number;
|
|
72
72
|
siblingData?: Record<string, unknown> | null | undefined;
|
|
73
|
-
}, any,
|
|
73
|
+
}, any, questpie143.JsonRouteParams>;
|
|
74
74
|
};
|
|
75
75
|
//#endregion
|
|
76
76
|
export { batchReactive, fieldOptions, reactiveFunctions };
|
|
@@ -306,7 +306,7 @@ const optionsOutputSchema = z.object({
|
|
|
306
306
|
* Batch reactive endpoint.
|
|
307
307
|
* Executes multiple reactive handlers in a single request.
|
|
308
308
|
*/
|
|
309
|
-
const batchReactive = route().post().access((ctx) =>
|
|
309
|
+
const batchReactive = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(batchReactiveInputSchema).outputSchema(batchReactiveOutputSchema).handler(async (ctx) => {
|
|
310
310
|
const app = getApp(ctx);
|
|
311
311
|
const { collection: entityName, type: entityType, requests, formData: sharedFormData, prevData: sharedPrevData } = ctx.input;
|
|
312
312
|
const serverCtx = buildServerContext(ctx);
|
|
@@ -359,7 +359,7 @@ const batchReactive = route().post().access((ctx) => !!ctx.session).schema(batch
|
|
|
359
359
|
* Dynamic options endpoint.
|
|
360
360
|
* Fetches options for select/relation fields with search and pagination.
|
|
361
361
|
*/
|
|
362
|
-
const fieldOptions = route().post().access((ctx) =>
|
|
362
|
+
const fieldOptions = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(optionsInputSchema).outputSchema(optionsOutputSchema).handler(async (ctx) => {
|
|
363
363
|
const app = getApp(ctx);
|
|
364
364
|
const { collection: entityName, type: entityType, field: field$1, formData, siblingData, search, page, limit } = ctx.input;
|
|
365
365
|
const serverCtx = buildServerContext(ctx);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie125 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/setup.d.ts
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ import * as questpie139 from "questpie";
|
|
|
13
13
|
* }
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
declare const isSetupRequired:
|
|
16
|
+
declare const isSetupRequired: questpie125.JsonRouteDefinition<Record<string, never>, any, questpie125.JsonRouteParams>;
|
|
17
17
|
/**
|
|
18
18
|
* Create the first admin user in the system.
|
|
19
19
|
* This function only works when no admin users exist (setup mode).
|
|
@@ -36,21 +36,21 @@ declare const isSetupRequired: questpie139.JsonRouteDefinition<Record<string, ne
|
|
|
36
36
|
* }
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
declare const createFirstAdmin:
|
|
39
|
+
declare const createFirstAdmin: questpie125.JsonRouteDefinition<{
|
|
40
40
|
email: string;
|
|
41
41
|
password: string;
|
|
42
42
|
name: string;
|
|
43
|
-
}, any,
|
|
43
|
+
}, any, questpie125.JsonRouteParams>;
|
|
44
44
|
/**
|
|
45
45
|
* Bundle of setup-related functions.
|
|
46
46
|
*/
|
|
47
47
|
declare const setupFunctions: {
|
|
48
|
-
readonly isSetupRequired:
|
|
49
|
-
readonly createFirstAdmin:
|
|
48
|
+
readonly isSetupRequired: questpie125.JsonRouteDefinition<Record<string, never>, any, questpie125.JsonRouteParams>;
|
|
49
|
+
readonly createFirstAdmin: questpie125.JsonRouteDefinition<{
|
|
50
50
|
email: string;
|
|
51
51
|
password: string;
|
|
52
52
|
name: string;
|
|
53
|
-
}, any,
|
|
53
|
+
}, any, questpie125.JsonRouteParams>;
|
|
54
54
|
};
|
|
55
55
|
//#endregion
|
|
56
56
|
export { createFirstAdmin, isSetupRequired, setupFunctions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie463 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/translations.d.ts
|
|
4
4
|
|
|
@@ -17,10 +17,10 @@ import * as questpie346 from "questpie";
|
|
|
17
17
|
* Bundle of translation-related functions.
|
|
18
18
|
*/
|
|
19
19
|
declare const translationFunctions: {
|
|
20
|
-
readonly getAdminTranslations:
|
|
20
|
+
readonly getAdminTranslations: questpie463.JsonRouteDefinition<{
|
|
21
21
|
locale: string;
|
|
22
|
-
}, any,
|
|
23
|
-
readonly getAdminLocales:
|
|
22
|
+
}, any, questpie463.JsonRouteParams>;
|
|
23
|
+
readonly getAdminLocales: questpie463.JsonRouteDefinition<Record<string, never> | undefined, any, questpie463.JsonRouteParams>;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { translationFunctions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as questpie69 from "questpie";
|
|
2
2
|
|
|
3
3
|
//#region src/server/modules/admin/routes/widget-data.d.ts
|
|
4
4
|
|
|
@@ -20,13 +20,13 @@ import * as questpie147 from "questpie";
|
|
|
20
20
|
* const data = await client.routes.fetchWidgetData({ widgetId: "my-widget" });
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const fetchWidgetData:
|
|
23
|
+
declare const fetchWidgetData: questpie69.JsonRouteDefinition<{
|
|
24
24
|
widgetId: string;
|
|
25
|
-
}, any,
|
|
25
|
+
}, any, questpie69.JsonRouteParams>;
|
|
26
26
|
declare const widgetDataFunctions: {
|
|
27
|
-
readonly fetchWidgetData:
|
|
27
|
+
readonly fetchWidgetData: questpie69.JsonRouteDefinition<{
|
|
28
28
|
widgetId: string;
|
|
29
|
-
}, any,
|
|
29
|
+
}, any, questpie69.JsonRouteParams>;
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
32
|
export { fetchWidgetData, widgetDataFunctions };
|
|
@@ -39,7 +39,7 @@ const fetchWidgetDataSchema = z.object({ widgetId: z.string() });
|
|
|
39
39
|
* const data = await client.routes.fetchWidgetData({ widgetId: "my-widget" });
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
const fetchWidgetData = route().post().access((ctx) =>
|
|
42
|
+
const fetchWidgetData = route().post().access((ctx) => ctx.session?.user?.role === "admin").schema(fetchWidgetDataSchema).outputSchema(z.unknown()).handler(async (ctx) => {
|
|
43
43
|
const stored = tryGetContext();
|
|
44
44
|
const routeApp = ctx.app ?? stored?.app;
|
|
45
45
|
const appState = routeApp?.state || {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FilterOperator, FilterRule, SortConfig, ViewConfiguration } from "../../../../shared/types/saved-views.types.mjs";
|
|
2
2
|
import * as questpie_shared16 from "questpie/shared";
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
3
|
+
import * as questpie89 from "questpie";
|
|
4
|
+
import * as questpie_src_server_modules_core_fields_email_js2 from "questpie/src/server/modules/core/fields/email.js";
|
|
5
|
+
import * as questpie_src_server_modules_core_fields_json_js2 from "questpie/src/server/modules/core/fields/json.js";
|
|
6
6
|
import * as drizzle_orm_pg_core22 from "drizzle-orm/pg-core";
|
|
7
7
|
import * as drizzle_orm5 from "drizzle-orm";
|
|
8
8
|
|
|
@@ -31,22 +31,22 @@ import * as drizzle_orm5 from "drizzle-orm";
|
|
|
31
31
|
* });
|
|
32
32
|
* ```
|
|
33
33
|
*/
|
|
34
|
-
declare const savedViewsCollection:
|
|
35
|
-
readonly text: typeof
|
|
36
|
-
readonly textarea: typeof
|
|
37
|
-
readonly email: typeof
|
|
38
|
-
readonly url: typeof
|
|
39
|
-
readonly number: typeof
|
|
40
|
-
readonly boolean: typeof
|
|
41
|
-
readonly date: typeof
|
|
42
|
-
readonly datetime: typeof
|
|
43
|
-
readonly time: typeof
|
|
44
|
-
readonly select: typeof
|
|
45
|
-
readonly upload: typeof
|
|
46
|
-
readonly relation: typeof
|
|
47
|
-
readonly object: typeof
|
|
48
|
-
readonly json: typeof
|
|
49
|
-
readonly from: typeof
|
|
34
|
+
declare const savedViewsCollection: questpie89.CollectionBuilder<questpie_shared16.Override<questpie_shared16.Override<questpie89.EmptyCollectionState<"admin_saved_views", undefined, {
|
|
35
|
+
readonly text: typeof questpie89.text;
|
|
36
|
+
readonly textarea: typeof questpie89.textarea;
|
|
37
|
+
readonly email: typeof questpie_src_server_modules_core_fields_email_js2.email;
|
|
38
|
+
readonly url: typeof questpie89.url;
|
|
39
|
+
readonly number: typeof questpie89.number;
|
|
40
|
+
readonly boolean: typeof questpie89.boolean;
|
|
41
|
+
readonly date: typeof questpie89.date;
|
|
42
|
+
readonly datetime: typeof questpie89.datetime;
|
|
43
|
+
readonly time: typeof questpie89.time;
|
|
44
|
+
readonly select: typeof questpie89.select;
|
|
45
|
+
readonly upload: typeof questpie89.upload;
|
|
46
|
+
readonly relation: typeof questpie89.relation;
|
|
47
|
+
readonly object: typeof questpie89.object;
|
|
48
|
+
readonly json: typeof questpie_src_server_modules_core_fields_json_js2.json;
|
|
49
|
+
readonly from: typeof questpie89.from;
|
|
50
50
|
}>, {
|
|
51
51
|
fields: {
|
|
52
52
|
readonly userId: drizzle_orm5.NotNull<drizzle_orm_pg_core22.PgVarcharBuilder<[string, ...string[]]>>;
|
|
@@ -57,31 +57,31 @@ declare const savedViewsCollection: questpie77.CollectionBuilder<questpie_shared
|
|
|
57
57
|
};
|
|
58
58
|
localized: readonly string[];
|
|
59
59
|
fieldDefinitions: {
|
|
60
|
-
readonly userId:
|
|
60
|
+
readonly userId: questpie89.FieldWithMethods<Omit<questpie89.TextFieldState, "notNull" | "column"> & {
|
|
61
61
|
notNull: true;
|
|
62
62
|
column: drizzle_orm5.NotNull<drizzle_orm_pg_core22.PgVarcharBuilder<[string, ...string[]]>>;
|
|
63
63
|
} & {
|
|
64
64
|
label: questpie_shared16.I18nText;
|
|
65
|
-
},
|
|
66
|
-
readonly collectionName:
|
|
65
|
+
}, questpie89.TextFieldMethods>;
|
|
66
|
+
readonly collectionName: questpie89.FieldWithMethods<Omit<questpie89.TextFieldState, "notNull" | "column"> & {
|
|
67
67
|
notNull: true;
|
|
68
68
|
column: drizzle_orm5.NotNull<drizzle_orm_pg_core22.PgVarcharBuilder<[string, ...string[]]>>;
|
|
69
69
|
} & {
|
|
70
70
|
label: questpie_shared16.I18nText;
|
|
71
|
-
},
|
|
72
|
-
readonly name:
|
|
71
|
+
}, questpie89.TextFieldMethods>;
|
|
72
|
+
readonly name: questpie89.FieldWithMethods<Omit<questpie89.TextFieldState, "notNull" | "column"> & {
|
|
73
73
|
notNull: true;
|
|
74
74
|
column: drizzle_orm5.NotNull<drizzle_orm_pg_core22.PgVarcharBuilder<[string, ...string[]]>>;
|
|
75
75
|
} & {
|
|
76
76
|
label: questpie_shared16.I18nText;
|
|
77
|
-
},
|
|
78
|
-
readonly configuration:
|
|
77
|
+
}, questpie89.TextFieldMethods>;
|
|
78
|
+
readonly configuration: questpie89.Field<Omit<questpie89.JsonFieldState, "notNull" | "column"> & {
|
|
79
79
|
notNull: true;
|
|
80
80
|
column: drizzle_orm5.NotNull<drizzle_orm_pg_core22.PgJsonbBuilder>;
|
|
81
81
|
} & {
|
|
82
82
|
label: questpie_shared16.I18nText;
|
|
83
83
|
}>;
|
|
84
|
-
readonly isDefault:
|
|
84
|
+
readonly isDefault: questpie89.Field<Omit<questpie89.BooleanFieldState, "column" | "hasDefault"> & {
|
|
85
85
|
hasDefault: true;
|
|
86
86
|
column: drizzle_orm5.HasDefault<drizzle_orm_pg_core22.PgBooleanBuilder>;
|
|
87
87
|
} & {
|
package/dist/server/plugin.mjs
CHANGED
|
@@ -131,12 +131,13 @@ function adminPlugin() {
|
|
|
131
131
|
from: "@questpie/admin/factories"
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
|
-
configType: "(ctx: ListViewConfigContext<TState extends { fieldDefinitions: infer F extends Record<string, unknown> } ? F : Record<string, unknown>, FilterViewsByKind<$VIEWS_RECORD, \"list\"
|
|
134
|
+
configType: "(ctx: ListViewConfigContext<TState extends { fieldDefinitions: infer F extends Record<string, unknown> } ? F : Record<string, unknown>, FilterViewsByKind<$VIEWS_RECORD, \"list\">, $COMPONENTS>) => ListViewConfig",
|
|
135
135
|
isCallback: true,
|
|
136
136
|
callbackContextParams: [
|
|
137
137
|
"v",
|
|
138
138
|
"f",
|
|
139
|
-
"a"
|
|
139
|
+
"a",
|
|
140
|
+
"c"
|
|
140
141
|
],
|
|
141
142
|
defaults: {
|
|
142
143
|
view: "collection-table",
|
|
@@ -192,7 +193,11 @@ function adminPlugin() {
|
|
|
192
193
|
"a",
|
|
193
194
|
"c",
|
|
194
195
|
"f"
|
|
195
|
-
]
|
|
196
|
+
],
|
|
197
|
+
callbackParams: { f: {
|
|
198
|
+
factory: "createActionFieldBuilderProxy",
|
|
199
|
+
from: "@questpie/admin/factories"
|
|
200
|
+
} }
|
|
196
201
|
}
|
|
197
202
|
},
|
|
198
203
|
globalExtensions: {
|
|
@@ -19,6 +19,13 @@ declare function createViewCallbackProxy(): Record<string, (config?: Record<stri
|
|
|
19
19
|
* Used as the `c` callback param: `c.icon("ph:article")` → `{ type: "icon", props: { name: "ph:article" } }`.
|
|
20
20
|
*/
|
|
21
21
|
declare function createComponentCallbackProxy(): Record<string, (...args: unknown[]) => Record<string, unknown>>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a field builder proxy for action form contexts.
|
|
24
|
+
*
|
|
25
|
+
* Returns a chainable builder: `f.text().required().label({en: "Title"})` → `{ type: "text", required: true, label: {en: "Title"} }`.
|
|
26
|
+
* Used as the `f` callback param in `.actions()` for defining form fields.
|
|
27
|
+
*/
|
|
28
|
+
declare function createActionFieldBuilderProxy(): Record<string, (...args: unknown[]) => Record<string, unknown>>;
|
|
22
29
|
/**
|
|
23
30
|
* Create an action proxy for builder callback contexts.
|
|
24
31
|
*
|
|
@@ -83,4 +90,4 @@ declare function resolveSidebarCallback(value: unknown): SidebarContribution | u
|
|
|
83
90
|
*/
|
|
84
91
|
declare function resolveDashboardCallback(value: unknown): DashboardContribution | undefined;
|
|
85
92
|
//#endregion
|
|
86
|
-
export { createActionCallbackProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback };
|
|
93
|
+
export { createActionCallbackProxy, createActionFieldBuilderProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback };
|
|
@@ -66,6 +66,38 @@ function createComponentCallbackProxy() {
|
|
|
66
66
|
});
|
|
67
67
|
} });
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Create a field builder proxy for action form contexts.
|
|
71
|
+
*
|
|
72
|
+
* Returns a chainable builder: `f.text().required().label({en: "Title"})` → `{ type: "text", required: true, label: {en: "Title"} }`.
|
|
73
|
+
* Used as the `f` callback param in `.actions()` for defining form fields.
|
|
74
|
+
*/
|
|
75
|
+
function createActionFieldBuilderProxy() {
|
|
76
|
+
function chainable(def) {
|
|
77
|
+
return new Proxy(def, { get: (target, prop) => {
|
|
78
|
+
if (typeof prop !== "string") return Reflect.get(target, prop);
|
|
79
|
+
if (prop in target) return target[prop];
|
|
80
|
+
if (prop === "set") return (key, value) => chainable({
|
|
81
|
+
...target,
|
|
82
|
+
[key]: value
|
|
83
|
+
});
|
|
84
|
+
return (...args) => chainable({
|
|
85
|
+
...target,
|
|
86
|
+
[prop]: args.length === 0 ? true : args[0]
|
|
87
|
+
});
|
|
88
|
+
} });
|
|
89
|
+
}
|
|
90
|
+
return new Proxy({}, { get: (_, prop) => {
|
|
91
|
+
if (typeof prop !== "string") return void 0;
|
|
92
|
+
return (...args) => {
|
|
93
|
+
const def = { type: prop };
|
|
94
|
+
if (Array.isArray(args[0])) def.options = args[0];
|
|
95
|
+
else if (args[0] && typeof args[0] === "object") Object.assign(def, args[0]);
|
|
96
|
+
else if (args[0] !== void 0) def.value = args[0];
|
|
97
|
+
return chainable(def);
|
|
98
|
+
};
|
|
99
|
+
} });
|
|
100
|
+
}
|
|
69
101
|
function createBuiltinActionReference(name) {
|
|
70
102
|
const ref = (() => name);
|
|
71
103
|
Object.defineProperties(ref, {
|
|
@@ -325,4 +357,4 @@ function resolveDashboardCallback(value) {
|
|
|
325
357
|
}
|
|
326
358
|
|
|
327
359
|
//#endregion
|
|
328
|
-
export { createActionCallbackProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback };
|
|
360
|
+
export { createActionCallbackProxy, createActionFieldBuilderProxy, createActionProxy, createComponentCallbackProxy, createComponentProxy, createDashboardCallbackContext, createDashboardContributionProxy, createFieldProxy, createSidebarCallbackContext, createSidebarContributionProxy, createViewCallbackProxy, createViewProxy, resolveDashboardCallback, resolveSidebarCallback };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@questpie/admin",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/questpie/questpie.git",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@fontsource-variable/jetbrains-mono": "^5.2.8",
|
|
73
73
|
"@hookform/resolvers": "^5.1.0",
|
|
74
74
|
"@iconify/react": "^6.0.2",
|
|
75
|
-
"@questpie/tanstack-query": "^3.5.
|
|
75
|
+
"@questpie/tanstack-query": "^3.5.5",
|
|
76
76
|
"@tailwindcss/vite": "^4.0.6",
|
|
77
77
|
"@tiptap/core": "^2.x",
|
|
78
78
|
"@tiptap/extension-character-count": "^2.x",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"date-fns": "^4.1.0",
|
|
99
99
|
"lowlight": "^3.x",
|
|
100
100
|
"next-themes": "^0.4.6",
|
|
101
|
-
"questpie": "^3.5.
|
|
101
|
+
"questpie": "^3.5.5",
|
|
102
102
|
"react-day-picker": "^9.12.0",
|
|
103
103
|
"react-hook-form": "^7.54.0",
|
|
104
104
|
"react-resizable-panels": "^4.4.2",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"@tanstack/db": "^0.x",
|
|
127
127
|
"@tanstack/react-query": "^5.x",
|
|
128
128
|
"@tanstack/react-table": "^8.x",
|
|
129
|
-
"better-auth": "^1.
|
|
129
|
+
"better-auth": "^1.6.11",
|
|
130
130
|
"drizzle-orm": "1.0.0-beta.6-4414a19",
|
|
131
131
|
"react": "^19.2.0",
|
|
132
132
|
"react-dom": "^19.2.0",
|