@btst/stack 2.11.6 → 2.11.8
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/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +2 -6
- package/dist/packages/stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +5 -9
- package/dist/packages/stack/src/plugins/blog/client/components/shared/collapsible-tag-list.cjs +44 -0
- package/dist/packages/stack/src/plugins/blog/client/components/shared/collapsible-tag-list.mjs +42 -0
- package/dist/packages/stack/src/plugins/blog/client/components/shared/tags-list.cjs +2 -8
- package/dist/packages/stack/src/plugins/blog/client/components/shared/tags-list.mjs +2 -8
- package/dist/packages/stack/src/plugins/blog/client/localization/blog-common.cjs +3 -1
- package/dist/packages/stack/src/plugins/blog/client/localization/blog-common.mjs +3 -1
- package/dist/packages/ui/src/components/form-builder/components/index.cjs +2 -1
- package/dist/packages/ui/src/components/form-builder/components/index.mjs +2 -1
- package/dist/packages/ui/src/components/form-builder/schema-utils.cjs +3 -1
- package/dist/packages/ui/src/components/form-builder/schema-utils.mjs +3 -1
- package/dist/plugins/blog/api/index.d.cts +2 -2
- package/dist/plugins/blog/api/index.d.mts +2 -2
- package/dist/plugins/blog/api/index.d.ts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +4 -2
- package/dist/plugins/blog/client/index.d.mts +4 -2
- package/dist/plugins/blog/client/index.d.ts +4 -2
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/kanban/api/index.d.cts +1 -1
- package/dist/plugins/kanban/api/index.d.mts +1 -1
- package/dist/plugins/kanban/api/index.d.ts +1 -1
- package/dist/plugins/kanban/query-keys.d.cts +1 -1
- package/dist/plugins/kanban/query-keys.d.mts +1 -1
- package/dist/plugins/kanban/query-keys.d.ts +1 -1
- package/dist/shared/{stack.CLWhMntf.d.cts → stack.04aMRz_W.d.cts} +5 -5
- package/dist/shared/{stack.DNLuzDb3.d.cts → stack.BvuqACtA.d.cts} +3 -3
- package/dist/shared/{stack.Dfc44JiE.d.mts → stack.Cs8R5HxD.d.mts} +3 -3
- package/dist/shared/{stack.ufcExQIR.d.ts → stack.CxWEN62M.d.ts} +5 -5
- package/dist/shared/{stack.BnSAhKJi.d.ts → stack.DPTRuLUH.d.ts} +3 -3
- package/dist/shared/{stack.DiodAFAa.d.mts → stack.ueI-K4xy.d.mts} +5 -5
- package/package.json +1 -1
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +4 -21
- package/src/plugins/blog/client/components/shared/collapsible-tag-list.tsx +76 -0
- package/src/plugins/blog/client/components/shared/tags-list.tsx +2 -18
- package/src/plugins/blog/client/localization/blog-common.ts +2 -0
- package/src/plugins/form-builder/__tests__/schema-utils.test.ts +87 -0
- package/dist/shared/{stack.f6MrG7ys.d.cts → stack.B6S3cgwN.d.cts} +15 -15
- package/dist/shared/{stack.BzKW7ToW.d.mts → stack.Bzfx-_lq.d.mts} +15 -15
- package/dist/shared/{stack.CuhcFsAx.d.cts → stack.DuQOcInS.d.cts} +3 -3
- package/dist/shared/{stack.CuhcFsAx.d.mts → stack.DuQOcInS.d.mts} +3 -3
- package/dist/shared/{stack.CuhcFsAx.d.ts → stack.DuQOcInS.d.ts} +3 -3
- package/dist/shared/{stack.9dFHtvXR.d.ts → stack.j5SFLC1d.d.ts} +15 -15
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema } from './stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema } from './stack.DuQOcInS.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for the usePosts hook
|
|
@@ -136,14 +136,14 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
136
136
|
name: string;
|
|
137
137
|
slug: string;
|
|
138
138
|
})[];
|
|
139
|
-
published: boolean;
|
|
140
139
|
title: string;
|
|
141
140
|
content: string;
|
|
142
141
|
excerpt: string;
|
|
142
|
+
published: boolean;
|
|
143
143
|
slug?: string | undefined;
|
|
144
|
-
publishedAt?: Date | undefined;
|
|
145
144
|
createdAt?: Date | undefined;
|
|
146
145
|
updatedAt?: Date | undefined;
|
|
146
|
+
publishedAt?: Date | undefined;
|
|
147
147
|
image?: string | undefined;
|
|
148
148
|
}, unknown>;
|
|
149
149
|
/** Update an existing post by id */
|
|
@@ -6,7 +6,7 @@ import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
|
6
6
|
import { DBAdapter } from '@btst/db';
|
|
7
7
|
import * as better_call from 'better-call';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { c as createPostSchema, u as updatePostSchema } from './stack.
|
|
9
|
+
import { c as createPostSchema, u as updatePostSchema } from './stack.DuQOcInS.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Parameters for filtering/paginating posts.
|
|
@@ -325,11 +325,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
325
325
|
slug: string;
|
|
326
326
|
})[] | undefined;
|
|
327
327
|
slug?: string | undefined;
|
|
328
|
-
published?: boolean | undefined;
|
|
329
|
-
publishedAt?: unknown;
|
|
330
328
|
createdAt?: unknown;
|
|
331
329
|
updatedAt?: unknown;
|
|
330
|
+
publishedAt?: unknown;
|
|
332
331
|
image?: string | undefined;
|
|
332
|
+
published?: boolean | undefined;
|
|
333
333
|
}, {
|
|
334
334
|
title: string;
|
|
335
335
|
content: string;
|
|
@@ -342,11 +342,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
342
342
|
slug: string;
|
|
343
343
|
})[] | undefined;
|
|
344
344
|
slug?: string | undefined;
|
|
345
|
-
published?: boolean | undefined;
|
|
346
|
-
publishedAt?: unknown;
|
|
347
345
|
createdAt?: unknown;
|
|
348
346
|
updatedAt?: unknown;
|
|
347
|
+
publishedAt?: unknown;
|
|
349
348
|
image?: string | undefined;
|
|
349
|
+
published?: boolean | undefined;
|
|
350
350
|
}>;
|
|
351
351
|
}, Post>;
|
|
352
352
|
readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema } from './stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema } from './stack.DuQOcInS.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for the usePosts hook
|
|
@@ -136,14 +136,14 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
136
136
|
name: string;
|
|
137
137
|
slug: string;
|
|
138
138
|
})[];
|
|
139
|
-
published: boolean;
|
|
140
139
|
title: string;
|
|
141
140
|
content: string;
|
|
142
141
|
excerpt: string;
|
|
142
|
+
published: boolean;
|
|
143
143
|
slug?: string | undefined;
|
|
144
|
-
publishedAt?: Date | undefined;
|
|
145
144
|
createdAt?: Date | undefined;
|
|
146
145
|
updatedAt?: Date | undefined;
|
|
146
|
+
publishedAt?: Date | undefined;
|
|
147
147
|
image?: string | undefined;
|
|
148
148
|
}, unknown>;
|
|
149
149
|
/** Update an existing post by id */
|
|
@@ -6,7 +6,7 @@ import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
|
6
6
|
import { DBAdapter } from '@btst/db';
|
|
7
7
|
import * as better_call from 'better-call';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import { c as createPostSchema, u as updatePostSchema } from './stack.
|
|
9
|
+
import { c as createPostSchema, u as updatePostSchema } from './stack.DuQOcInS.mjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Parameters for filtering/paginating posts.
|
|
@@ -325,11 +325,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
325
325
|
slug: string;
|
|
326
326
|
})[] | undefined;
|
|
327
327
|
slug?: string | undefined;
|
|
328
|
-
published?: boolean | undefined;
|
|
329
|
-
publishedAt?: unknown;
|
|
330
328
|
createdAt?: unknown;
|
|
331
329
|
updatedAt?: unknown;
|
|
330
|
+
publishedAt?: unknown;
|
|
332
331
|
image?: string | undefined;
|
|
332
|
+
published?: boolean | undefined;
|
|
333
333
|
}, {
|
|
334
334
|
title: string;
|
|
335
335
|
content: string;
|
|
@@ -342,11 +342,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
342
342
|
slug: string;
|
|
343
343
|
})[] | undefined;
|
|
344
344
|
slug?: string | undefined;
|
|
345
|
-
published?: boolean | undefined;
|
|
346
|
-
publishedAt?: unknown;
|
|
347
345
|
createdAt?: unknown;
|
|
348
346
|
updatedAt?: unknown;
|
|
347
|
+
publishedAt?: unknown;
|
|
349
348
|
image?: string | undefined;
|
|
349
|
+
published?: boolean | undefined;
|
|
350
350
|
}>;
|
|
351
351
|
}, Post>;
|
|
352
352
|
readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { usePluginOverrides
|
|
3
|
+
import { usePluginOverrides } from "@btst/stack/context";
|
|
4
4
|
import { formatDate } from "date-fns";
|
|
5
5
|
import {
|
|
6
6
|
useSuspensePost,
|
|
@@ -12,11 +12,10 @@ import { MarkdownContent } from "../shared/markdown-content";
|
|
|
12
12
|
import { PageHeader } from "../shared/page-header";
|
|
13
13
|
import { PageWrapper } from "../shared/page-wrapper";
|
|
14
14
|
import type { BlogPluginOverrides } from "../../overrides";
|
|
15
|
-
import { DefaultImage
|
|
15
|
+
import { DefaultImage } from "../shared/defaults";
|
|
16
16
|
import { BLOG_LOCALIZATION } from "../../localization";
|
|
17
17
|
import { PostNavigation } from "../shared/post-navigation";
|
|
18
18
|
import { RecentPostsCarousel } from "../shared/recent-posts-carousel";
|
|
19
|
-
import { Badge } from "@workspace/ui/components/badge";
|
|
20
19
|
import { useRouteLifecycle } from "@workspace/ui/hooks/use-route-lifecycle";
|
|
21
20
|
import { OnThisPage, OnThisPageSelect } from "../shared/on-this-page";
|
|
22
21
|
import type { SerializedPost } from "../../../types";
|
|
@@ -24,6 +23,7 @@ import { useRegisterPageAIContext } from "@btst/stack/plugins/ai-chat/client/con
|
|
|
24
23
|
import { WhenVisible } from "@workspace/ui/components/when-visible";
|
|
25
24
|
import { PostNavigationSkeleton } from "../loading/post-navigation-skeleton";
|
|
26
25
|
import { RecentPostsCarouselSkeleton } from "../loading/recent-posts-carousel-skeleton";
|
|
26
|
+
import { CollapsibleTagList } from "../shared/collapsible-tag-list";
|
|
27
27
|
|
|
28
28
|
// Internal component with actual page content
|
|
29
29
|
export function PostPage({ slug }: { slug: string }) {
|
|
@@ -151,29 +151,12 @@ export function PostPage({ slug }: { slug: string }) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
function PostHeaderTop({ post }: { post: SerializedPost }) {
|
|
154
|
-
const { Link } = usePluginOverrides<
|
|
155
|
-
BlogPluginOverrides,
|
|
156
|
-
Partial<BlogPluginOverrides>
|
|
157
|
-
>("blog", {
|
|
158
|
-
Link: DefaultLink,
|
|
159
|
-
});
|
|
160
|
-
const basePath = useBasePath();
|
|
161
154
|
return (
|
|
162
155
|
<div className="flex flex-row items-center justify-center gap-2 flex-wrap mt-8">
|
|
163
156
|
<span className="font-light text-muted-foreground text-sm">
|
|
164
157
|
{formatDate(post.createdAt, "MMMM d, yyyy")}
|
|
165
158
|
</span>
|
|
166
|
-
{post.tags
|
|
167
|
-
<>
|
|
168
|
-
{post.tags.map((tag) => (
|
|
169
|
-
<Link key={tag.id} href={`${basePath}/blog/tag/${tag.slug}`}>
|
|
170
|
-
<Badge variant="secondary" className="text-xs">
|
|
171
|
-
{tag.name}
|
|
172
|
-
</Badge>
|
|
173
|
-
</Link>
|
|
174
|
-
))}
|
|
175
|
-
</>
|
|
176
|
-
)}
|
|
159
|
+
<CollapsibleTagList tags={post.tags ?? []} />
|
|
177
160
|
</div>
|
|
178
161
|
);
|
|
179
162
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { usePluginOverrides, useBasePath } from "@btst/stack/context";
|
|
4
|
+
import type { BlogPluginOverrides } from "../../overrides";
|
|
5
|
+
import { DefaultLink } from "./defaults";
|
|
6
|
+
import { Badge } from "@workspace/ui/components/badge";
|
|
7
|
+
import { BLOG_LOCALIZATION } from "../../localization";
|
|
8
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import type { SerializedTag } from "../../../types";
|
|
11
|
+
|
|
12
|
+
const MAX_VISIBLE_TAGS = 15;
|
|
13
|
+
|
|
14
|
+
interface CollapsibleTagListProps {
|
|
15
|
+
tags: SerializedTag[];
|
|
16
|
+
maxVisible?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function CollapsibleTagList({
|
|
20
|
+
tags,
|
|
21
|
+
maxVisible = MAX_VISIBLE_TAGS,
|
|
22
|
+
}: CollapsibleTagListProps) {
|
|
23
|
+
const { Link, localization } = usePluginOverrides<
|
|
24
|
+
BlogPluginOverrides,
|
|
25
|
+
Partial<BlogPluginOverrides>
|
|
26
|
+
>("blog", {
|
|
27
|
+
Link: DefaultLink,
|
|
28
|
+
localization: BLOG_LOCALIZATION,
|
|
29
|
+
});
|
|
30
|
+
const basePath = useBasePath();
|
|
31
|
+
const [showAll, setShowAll] = useState(false);
|
|
32
|
+
|
|
33
|
+
if (!tags || tags.length === 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const hasMore = tags.length > maxVisible;
|
|
38
|
+
const visibleTags = showAll || !hasMore ? tags : tags.slice(0, maxVisible);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{visibleTags.map((tag) => (
|
|
43
|
+
<Link key={tag.id} href={`${basePath}/blog/tag/${tag.slug}`}>
|
|
44
|
+
<Badge variant="secondary" className="text-xs">
|
|
45
|
+
{tag.name}
|
|
46
|
+
</Badge>
|
|
47
|
+
</Link>
|
|
48
|
+
))}
|
|
49
|
+
{hasMore && (
|
|
50
|
+
<Badge asChild variant="secondary" className="text-xs cursor-pointer">
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
onClick={() => setShowAll((prev) => !prev)}
|
|
54
|
+
aria-expanded={showAll}
|
|
55
|
+
aria-label={
|
|
56
|
+
showAll
|
|
57
|
+
? localization.BLOG_TAGS_SHOW_LESS
|
|
58
|
+
: localization.BLOG_TAGS_SHOW_ALL
|
|
59
|
+
}
|
|
60
|
+
title={
|
|
61
|
+
showAll
|
|
62
|
+
? localization.BLOG_TAGS_SHOW_LESS
|
|
63
|
+
: localization.BLOG_TAGS_SHOW_ALL
|
|
64
|
+
}
|
|
65
|
+
>
|
|
66
|
+
{showAll ? (
|
|
67
|
+
<ChevronUp aria-hidden="true" />
|
|
68
|
+
) : (
|
|
69
|
+
<ChevronDown aria-hidden="true" />
|
|
70
|
+
)}
|
|
71
|
+
</button>
|
|
72
|
+
</Badge>
|
|
73
|
+
)}
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { usePluginOverrides, useBasePath } from "@btst/stack/context";
|
|
4
|
-
import type { BlogPluginOverrides } from "../../overrides";
|
|
5
|
-
import { DefaultLink } from "./defaults";
|
|
6
|
-
import { Badge } from "@workspace/ui/components/badge";
|
|
7
3
|
import { useSuspenseTags } from "../../hooks/blog-hooks";
|
|
4
|
+
import { CollapsibleTagList } from "./collapsible-tag-list";
|
|
8
5
|
|
|
9
6
|
export function TagsList() {
|
|
10
7
|
const { tags } = useSuspenseTags();
|
|
11
|
-
const { Link } = usePluginOverrides<
|
|
12
|
-
BlogPluginOverrides,
|
|
13
|
-
Partial<BlogPluginOverrides>
|
|
14
|
-
>("blog", {
|
|
15
|
-
Link: DefaultLink,
|
|
16
|
-
});
|
|
17
|
-
const basePath = useBasePath();
|
|
18
8
|
|
|
19
9
|
if (!tags || tags.length === 0) {
|
|
20
10
|
return null;
|
|
@@ -22,13 +12,7 @@ export function TagsList() {
|
|
|
22
12
|
|
|
23
13
|
return (
|
|
24
14
|
<div className="flex flex-wrap gap-2 justify-center">
|
|
25
|
-
{tags
|
|
26
|
-
<Link key={tag.id} href={`${basePath}/blog/tag/${tag.slug}`}>
|
|
27
|
-
<Badge variant="secondary" className="text-xs">
|
|
28
|
-
{tag.name}
|
|
29
|
-
</Badge>
|
|
30
|
-
</Link>
|
|
31
|
-
))}
|
|
15
|
+
<CollapsibleTagList tags={tags} />
|
|
32
16
|
</div>
|
|
33
17
|
);
|
|
34
18
|
}
|
|
@@ -107,6 +107,93 @@ describe("jsonSchemaToFieldsAndSteps", () => {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
+
describe("label resolution", () => {
|
|
111
|
+
// Label resolution must mirror what `AutoForm` shows on the public form,
|
|
112
|
+
// so a Zod-seeded schema (whose properties only carry `description`,
|
|
113
|
+
// not `label`/`title`) reads identically in the admin canvas.
|
|
114
|
+
// See `auto-form/fields/object.tsx` → `beautifyObjectName(name)`.
|
|
115
|
+
|
|
116
|
+
it("uses an explicit `label` when present", () => {
|
|
117
|
+
const schema: JSONSchema = {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
primaryGoal: {
|
|
121
|
+
type: "string",
|
|
122
|
+
label: "What's your main focus?",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const { fields } = jsonSchemaToFieldsAndSteps(schema, defaultComponents);
|
|
128
|
+
expect(fields[0]?.props.label).toBe("What's your main focus?");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("falls back to JSON Schema `title` when `label` is absent", () => {
|
|
132
|
+
const schema: JSONSchema = {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
primaryGoal: {
|
|
136
|
+
type: "string",
|
|
137
|
+
title: "Primary Goal (titled)",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const { fields } = jsonSchemaToFieldsAndSteps(schema, defaultComponents);
|
|
143
|
+
expect(fields[0]?.props.label).toBe("Primary Goal (titled)");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("humanises the field key when no `label` or `title` is present", () => {
|
|
147
|
+
// This is the regression: previously the admin showed the raw key
|
|
148
|
+
// (`primaryGoal`) when no label/title was set, while the public form
|
|
149
|
+
// showed `Primary Goal`. Now both paths agree.
|
|
150
|
+
const schema: JSONSchema = {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
primaryGoal: { type: "string" },
|
|
154
|
+
riskTolerance: {
|
|
155
|
+
type: "string",
|
|
156
|
+
enum: ["low", "moderate", "high"],
|
|
157
|
+
},
|
|
158
|
+
noInjections: { type: "boolean", fieldType: "switch" },
|
|
159
|
+
email: { type: "string", format: "email" },
|
|
160
|
+
age: { type: "number" },
|
|
161
|
+
notes: { type: "string", fieldType: "textarea" },
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const { fields } = jsonSchemaToFieldsAndSteps(schema, defaultComponents);
|
|
166
|
+
const labels = Object.fromEntries(
|
|
167
|
+
fields.map((f) => [f.id, f.props.label]),
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
expect(labels).toEqual({
|
|
171
|
+
primaryGoal: "Primary Goal",
|
|
172
|
+
riskTolerance: "Risk Tolerance",
|
|
173
|
+
noInjections: "No Injections",
|
|
174
|
+
email: "Email",
|
|
175
|
+
age: "Age",
|
|
176
|
+
notes: "Notes",
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("humanises the field key in the unknown-field-type fallback", () => {
|
|
181
|
+
// When no component matches, propertiesToFields creates a generic
|
|
182
|
+
// text field. That branch must humanise the key too.
|
|
183
|
+
const schema: JSONSchema = {
|
|
184
|
+
type: "object",
|
|
185
|
+
properties: {
|
|
186
|
+
mysteriousField: {
|
|
187
|
+
// no `type` — falls through to the generic text fallback
|
|
188
|
+
} as JSONSchema["properties"][string],
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const { fields } = jsonSchemaToFieldsAndSteps(schema, defaultComponents);
|
|
193
|
+
expect(fields[0]?.props.label).toBe("Mysterious Field");
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
110
197
|
describe("multi-step: Path A — per-property stepGroup", () => {
|
|
111
198
|
// Canonical format written by the visual FormBuilder when saving.
|
|
112
199
|
const schema: JSONSchema = {
|
|
@@ -7,12 +7,12 @@ import { QueryClient } from '@tanstack/react-query';
|
|
|
7
7
|
|
|
8
8
|
declare const createBoardSchema: z.ZodObject<{
|
|
9
9
|
description: z.ZodOptional<z.ZodString>;
|
|
10
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
11
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
12
|
-
name: z.ZodString;
|
|
13
10
|
slug: z.ZodOptional<z.ZodString>;
|
|
14
11
|
ownerId: z.ZodOptional<z.ZodString>;
|
|
15
12
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
|
+
name: z.ZodString;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
declare const updateBoardSchema: z.ZodObject<{
|
|
18
18
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -28,8 +28,8 @@ declare const createColumnSchema: z.ZodObject<{
|
|
|
28
28
|
title: z.ZodString;
|
|
29
29
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
30
30
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
31
|
-
boardId: z.ZodString;
|
|
32
31
|
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
32
|
+
boardId: z.ZodString;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
declare const updateColumnSchema: z.ZodObject<{
|
|
35
35
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -331,19 +331,19 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
331
331
|
body: better_call.StandardSchemaV1<{
|
|
332
332
|
name: string;
|
|
333
333
|
description?: string | undefined;
|
|
334
|
-
createdAt?: unknown;
|
|
335
|
-
updatedAt?: unknown;
|
|
336
334
|
slug?: string | undefined;
|
|
337
335
|
ownerId?: string | undefined;
|
|
338
336
|
organizationId?: string | undefined;
|
|
337
|
+
createdAt?: unknown;
|
|
338
|
+
updatedAt?: unknown;
|
|
339
339
|
}, {
|
|
340
340
|
name: string;
|
|
341
341
|
description?: string | undefined;
|
|
342
|
-
createdAt?: unknown;
|
|
343
|
-
updatedAt?: unknown;
|
|
344
342
|
slug?: string | undefined;
|
|
345
343
|
ownerId?: string | undefined;
|
|
346
344
|
organizationId?: string | undefined;
|
|
345
|
+
createdAt?: unknown;
|
|
346
|
+
updatedAt?: unknown;
|
|
347
347
|
}>;
|
|
348
348
|
}, {
|
|
349
349
|
columns: ColumnWithTasks[];
|
|
@@ -360,20 +360,20 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
360
360
|
method: "PUT";
|
|
361
361
|
body: better_call.StandardSchemaV1<{
|
|
362
362
|
description?: string | undefined;
|
|
363
|
-
createdAt?: unknown;
|
|
364
|
-
updatedAt?: unknown;
|
|
365
|
-
name?: string | undefined;
|
|
366
363
|
slug?: string | undefined;
|
|
367
364
|
ownerId?: string | undefined;
|
|
368
365
|
organizationId?: string | undefined;
|
|
369
|
-
}, {
|
|
370
|
-
description?: string | undefined;
|
|
371
366
|
createdAt?: unknown;
|
|
372
367
|
updatedAt?: unknown;
|
|
373
368
|
name?: string | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
description?: string | undefined;
|
|
374
371
|
slug?: string | undefined;
|
|
375
372
|
ownerId?: string | undefined;
|
|
376
373
|
organizationId?: string | undefined;
|
|
374
|
+
createdAt?: unknown;
|
|
375
|
+
updatedAt?: unknown;
|
|
376
|
+
name?: string | undefined;
|
|
377
377
|
}>;
|
|
378
378
|
}, Board>;
|
|
379
379
|
readonly deleteBoard: better_call.StrictEndpoint<"/boards/:id", {} & {
|
|
@@ -404,14 +404,14 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
404
404
|
title?: string | undefined;
|
|
405
405
|
createdAt?: unknown;
|
|
406
406
|
updatedAt?: unknown;
|
|
407
|
-
boardId?: string | undefined;
|
|
408
407
|
order?: number | undefined;
|
|
408
|
+
boardId?: string | undefined;
|
|
409
409
|
}, {
|
|
410
410
|
title?: string | undefined;
|
|
411
411
|
createdAt?: unknown;
|
|
412
412
|
updatedAt?: unknown;
|
|
413
|
-
boardId?: string | undefined;
|
|
414
413
|
order?: number | undefined;
|
|
414
|
+
boardId?: string | undefined;
|
|
415
415
|
}>;
|
|
416
416
|
}, Column>;
|
|
417
417
|
readonly deleteColumn: better_call.StrictEndpoint<"/columns/:id", {} & {
|
|
@@ -7,12 +7,12 @@ import { QueryClient } from '@tanstack/react-query';
|
|
|
7
7
|
|
|
8
8
|
declare const createBoardSchema: z.ZodObject<{
|
|
9
9
|
description: z.ZodOptional<z.ZodString>;
|
|
10
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
11
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
12
|
-
name: z.ZodString;
|
|
13
10
|
slug: z.ZodOptional<z.ZodString>;
|
|
14
11
|
ownerId: z.ZodOptional<z.ZodString>;
|
|
15
12
|
organizationId: z.ZodOptional<z.ZodString>;
|
|
13
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
|
+
name: z.ZodString;
|
|
16
16
|
}, z.core.$strip>;
|
|
17
17
|
declare const updateBoardSchema: z.ZodObject<{
|
|
18
18
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -28,8 +28,8 @@ declare const createColumnSchema: z.ZodObject<{
|
|
|
28
28
|
title: z.ZodString;
|
|
29
29
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
30
30
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
31
|
-
boardId: z.ZodString;
|
|
32
31
|
order: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
32
|
+
boardId: z.ZodString;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
declare const updateColumnSchema: z.ZodObject<{
|
|
35
35
|
createdAt: z.ZodOptional<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
@@ -331,19 +331,19 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
331
331
|
body: better_call.StandardSchemaV1<{
|
|
332
332
|
name: string;
|
|
333
333
|
description?: string | undefined;
|
|
334
|
-
createdAt?: unknown;
|
|
335
|
-
updatedAt?: unknown;
|
|
336
334
|
slug?: string | undefined;
|
|
337
335
|
ownerId?: string | undefined;
|
|
338
336
|
organizationId?: string | undefined;
|
|
337
|
+
createdAt?: unknown;
|
|
338
|
+
updatedAt?: unknown;
|
|
339
339
|
}, {
|
|
340
340
|
name: string;
|
|
341
341
|
description?: string | undefined;
|
|
342
|
-
createdAt?: unknown;
|
|
343
|
-
updatedAt?: unknown;
|
|
344
342
|
slug?: string | undefined;
|
|
345
343
|
ownerId?: string | undefined;
|
|
346
344
|
organizationId?: string | undefined;
|
|
345
|
+
createdAt?: unknown;
|
|
346
|
+
updatedAt?: unknown;
|
|
347
347
|
}>;
|
|
348
348
|
}, {
|
|
349
349
|
columns: ColumnWithTasks[];
|
|
@@ -360,20 +360,20 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
360
360
|
method: "PUT";
|
|
361
361
|
body: better_call.StandardSchemaV1<{
|
|
362
362
|
description?: string | undefined;
|
|
363
|
-
createdAt?: unknown;
|
|
364
|
-
updatedAt?: unknown;
|
|
365
|
-
name?: string | undefined;
|
|
366
363
|
slug?: string | undefined;
|
|
367
364
|
ownerId?: string | undefined;
|
|
368
365
|
organizationId?: string | undefined;
|
|
369
|
-
}, {
|
|
370
|
-
description?: string | undefined;
|
|
371
366
|
createdAt?: unknown;
|
|
372
367
|
updatedAt?: unknown;
|
|
373
368
|
name?: string | undefined;
|
|
369
|
+
}, {
|
|
370
|
+
description?: string | undefined;
|
|
374
371
|
slug?: string | undefined;
|
|
375
372
|
ownerId?: string | undefined;
|
|
376
373
|
organizationId?: string | undefined;
|
|
374
|
+
createdAt?: unknown;
|
|
375
|
+
updatedAt?: unknown;
|
|
376
|
+
name?: string | undefined;
|
|
377
377
|
}>;
|
|
378
378
|
}, Board>;
|
|
379
379
|
readonly deleteBoard: better_call.StrictEndpoint<"/boards/:id", {} & {
|
|
@@ -404,14 +404,14 @@ declare const kanbanBackendPlugin: (hooks?: KanbanBackendHooks) => _btst_stack_p
|
|
|
404
404
|
title?: string | undefined;
|
|
405
405
|
createdAt?: unknown;
|
|
406
406
|
updatedAt?: unknown;
|
|
407
|
-
boardId?: string | undefined;
|
|
408
407
|
order?: number | undefined;
|
|
408
|
+
boardId?: string | undefined;
|
|
409
409
|
}, {
|
|
410
410
|
title?: string | undefined;
|
|
411
411
|
createdAt?: unknown;
|
|
412
412
|
updatedAt?: unknown;
|
|
413
|
-
boardId?: string | undefined;
|
|
414
413
|
order?: number | undefined;
|
|
414
|
+
boardId?: string | undefined;
|
|
415
415
|
}>;
|
|
416
416
|
}, Column>;
|
|
417
417
|
readonly deleteColumn: better_call.StrictEndpoint<"/columns/:id", {} & {
|
|
@@ -8,15 +8,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
8
8
|
name: z.ZodString;
|
|
9
9
|
slug: z.ZodString;
|
|
10
10
|
}, z.core.$strip>]>>>>;
|
|
11
|
+
title: z.ZodString;
|
|
11
12
|
slug: z.ZodOptional<z.ZodString>;
|
|
12
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
13
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
14
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
16
|
-
|
|
15
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
17
16
|
content: z.ZodString;
|
|
18
17
|
excerpt: z.ZodString;
|
|
19
18
|
image: z.ZodOptional<z.ZodString>;
|
|
19
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
declare const updatePostSchema: z.ZodObject<{
|
|
22
22
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
@@ -8,15 +8,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
8
8
|
name: z.ZodString;
|
|
9
9
|
slug: z.ZodString;
|
|
10
10
|
}, z.core.$strip>]>>>>;
|
|
11
|
+
title: z.ZodString;
|
|
11
12
|
slug: z.ZodOptional<z.ZodString>;
|
|
12
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
13
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
14
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
16
|
-
|
|
15
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
17
16
|
content: z.ZodString;
|
|
18
17
|
excerpt: z.ZodString;
|
|
19
18
|
image: z.ZodOptional<z.ZodString>;
|
|
19
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
declare const updatePostSchema: z.ZodObject<{
|
|
22
22
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
@@ -8,15 +8,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
8
8
|
name: z.ZodString;
|
|
9
9
|
slug: z.ZodString;
|
|
10
10
|
}, z.core.$strip>]>>>>;
|
|
11
|
+
title: z.ZodString;
|
|
11
12
|
slug: z.ZodOptional<z.ZodString>;
|
|
12
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
13
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
14
13
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
15
14
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
16
|
-
|
|
15
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
17
16
|
content: z.ZodString;
|
|
18
17
|
excerpt: z.ZodString;
|
|
19
18
|
image: z.ZodOptional<z.ZodString>;
|
|
19
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
declare const updatePostSchema: z.ZodObject<{
|
|
22
22
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|