@carlonicora/nextjs-jsonapi 3.12.0 → 3.13.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/dist/{AssistantInterface-DwdBzS9f.d.ts → AssistantInterface-RvZzlcA_.d.ts} +2 -0
- package/dist/{AssistantInterface-DMh-zApr.d.mts → AssistantInterface-jL56dyNc.d.mts} +2 -0
- package/dist/{AssistantMessageInterface-0zyVingf.d.ts → AssistantMessageInterface-CuaMDs2i.d.ts} +1 -1
- package/dist/{AssistantMessageInterface-ddyG114R.d.mts → AssistantMessageInterface-Du3ShThp.d.mts} +1 -1
- package/dist/{BlockNoteEditor-6G27S6P3.js → BlockNoteEditor-CFVSHS46.js} +19 -19
- package/dist/{BlockNoteEditor-6G27S6P3.js.map → BlockNoteEditor-CFVSHS46.js.map} +1 -1
- package/dist/{BlockNoteEditor-CR5KH4AI.mjs → BlockNoteEditor-SERY337S.mjs} +4 -4
- package/dist/{BlockNoteViewer-5MITJ7AD.js → BlockNoteViewer-CWFPYYIU.js} +3 -3
- package/dist/{BlockNoteViewer-5MITJ7AD.js.map → BlockNoteViewer-CWFPYYIU.js.map} +1 -1
- package/dist/{BlockNoteViewer-NJKFUNXP.mjs → BlockNoteViewer-P2VKEFRN.mjs} +2 -2
- package/dist/{ai-connection.module-28f-hux0.d.mts → HandbookSectionInterface-BOxIdBdd.d.mts} +54 -1
- package/dist/{ai-connection.module-Bqwh_DnR.d.ts → HandbookSectionInterface-CAXxbDw0.d.ts} +54 -1
- package/dist/{auth.interface-B6ZQLGjS.d.ts → auth.interface-BC1jp_ni.d.ts} +1 -1
- package/dist/{auth.interface-jYD8Gc4P.d.mts → auth.interface-dR2-6gPM.d.mts} +1 -1
- package/dist/billing/index.js +401 -401
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-L7DZSTFU.js → chunk-IB7DTXWG.js} +846 -129
- package/dist/chunk-IB7DTXWG.js.map +1 -0
- package/dist/{chunk-OKGGYCO5.js → chunk-LVE3BJ6K.js} +2088 -1134
- package/dist/chunk-LVE3BJ6K.js.map +1 -0
- package/dist/{chunk-Q2BREXH3.mjs → chunk-OSFYCSTW.mjs} +724 -7
- package/dist/chunk-OSFYCSTW.mjs.map +1 -0
- package/dist/{chunk-JEGL7KHK.mjs → chunk-UQXE3SME.mjs} +2081 -1127
- package/dist/chunk-UQXE3SME.mjs.map +1 -0
- package/dist/{chunk-HVNEWDRF.mjs → chunk-VZKJIAND.mjs} +2 -2
- package/dist/{chunk-4ETVCRQD.js → chunk-XH4IURUD.js} +7 -7
- package/dist/{chunk-4ETVCRQD.js.map → chunk-XH4IURUD.js.map} +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +258 -7
- package/dist/components/index.d.ts +258 -7
- package/dist/components/index.js +30 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +29 -3
- package/dist/contexts/index.d.mts +17 -5
- package/dist/contexts/index.d.ts +17 -5
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +491 -11
- package/dist/core/index.d.ts +491 -11
- package/dist/core/index.js +38 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +37 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +101 -101
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +39 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -2
- package/dist/{notification.interface-DYF56CtE.d.ts → notification.interface-CjzV_KII.d.ts} +1 -1
- package/dist/{notification.interface-BWOCvKRP.d.mts → notification.interface-MnRt1Tjm.d.mts} +1 -1
- package/dist/{s3.service-D_dswjgz.d.mts → s3.service-C0Yq2Sx3.d.mts} +2 -2
- package/dist/{s3.service-DserU9VK.d.ts → s3.service-CUGarZs3.d.ts} +2 -2
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/{useSocket-BZG9oX-L.d.mts → useSocket-BcH7l7B8.d.mts} +1 -1
- package/dist/{useSocket-CiyTtYFj.d.ts → useSocket-DCZd_eJk.d.ts} +1 -1
- package/package.json +1 -1
- package/src/components/containers/ReactMarkdownContainer.tsx +61 -11
- package/src/components/index.ts +1 -0
- package/src/core/index.ts +5 -0
- package/src/core/registry/ModuleRegistry.ts +4 -0
- package/src/features/assistant/components/parts/AssistantComposer.tsx +22 -3
- package/src/features/assistant/components/parts/AssistantSidebar.tsx +13 -3
- package/src/features/assistant/components/parts/AssistantThreadHeader.tsx +10 -3
- package/src/features/assistant/contexts/AssistantContext.tsx +30 -3
- package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +32 -0
- package/src/features/assistant/data/Assistant.ts +2 -0
- package/src/features/assistant/data/AssistantInterface.ts +2 -0
- package/src/features/assistant/data/AssistantService.ts +4 -0
- package/src/features/assistant-message/components/parts/MessageSourcesContainer.tsx +5 -1
- package/src/features/assistant-message/data/AssistantMessage.ts +27 -2
- package/src/features/content/data/content.interface.ts +1 -1
- package/src/features/handbook/HandbookPageModule.ts +41 -0
- package/src/features/handbook/HandbookSectionModule.ts +35 -0
- package/src/features/handbook/HandbookThreadMessageModule.ts +21 -0
- package/src/features/handbook/HandbookThreadModule.ts +29 -0
- package/src/features/handbook/components/containers/HandbookAdminContainer.tsx +17 -0
- package/src/features/handbook/components/containers/HandbookAskContainer.tsx +142 -0
- package/src/features/handbook/components/containers/HandbookAskSheet.tsx +149 -0
- package/src/features/handbook/components/containers/HandbookPageContainer.tsx +143 -0
- package/src/features/handbook/components/containers/__tests__/HandbookAskContainer.spec.tsx +268 -0
- package/src/features/handbook/components/containers/__tests__/HandbookAskSheet.spec.tsx +143 -0
- package/src/features/handbook/components/containers/__tests__/HandbookPageContainer.spec.tsx +288 -0
- package/src/features/handbook/components/details/HandbookPageDetails.tsx +27 -0
- package/src/features/handbook/components/details/HandbookPageNeighbours.tsx +72 -0
- package/src/features/handbook/components/details/HandbookPageToc.tsx +165 -0
- package/src/features/handbook/components/forms/HandbookSyncButton.tsx +43 -0
- package/src/features/handbook/components/forms/__tests__/HandbookSyncButton.spec.tsx +42 -0
- package/src/features/handbook/components/index.ts +12 -0
- package/src/features/handbook/components/lists/HandbookContents.tsx +196 -0
- package/src/features/handbook/components/lists/HandbookSectionGroup.tsx +153 -0
- package/src/features/handbook/components/lists/__tests__/HandbookContents.spec.tsx +247 -0
- package/src/features/handbook/components/parts/HandbookIndexStatus.tsx +62 -0
- package/src/features/handbook/components/parts/HandbookPageNavigator.tsx +143 -0
- package/src/features/handbook/contexts/HandbookContext.tsx +109 -0
- package/src/features/handbook/contexts/__tests__/HandbookContext.spec.tsx +131 -0
- package/src/features/handbook/data/HandbookPage.spec.ts +136 -0
- package/src/features/handbook/data/HandbookPage.ts +99 -0
- package/src/features/handbook/data/HandbookPageFields.ts +31 -0
- package/src/features/handbook/data/HandbookPageInput.ts +8 -0
- package/src/features/handbook/data/HandbookPageInterface.ts +29 -0
- package/src/features/handbook/data/HandbookPageService.ts +60 -0
- package/src/features/handbook/data/HandbookSection.spec.ts +58 -0
- package/src/features/handbook/data/HandbookSection.ts +73 -0
- package/src/features/handbook/data/HandbookSectionInput.ts +12 -0
- package/src/features/handbook/data/HandbookSectionInterface.ts +26 -0
- package/src/features/handbook/data/HandbookSectionService.ts +26 -0
- package/src/features/handbook/data/HandbookThread.ts +114 -0
- package/src/features/handbook/data/HandbookThreadInterface.ts +31 -0
- package/src/features/handbook/data/HandbookThreadMessage.ts +144 -0
- package/src/features/handbook/data/HandbookThreadMessageInterface.ts +35 -0
- package/src/features/handbook/data/HandbookThreadMessageService.ts +30 -0
- package/src/features/handbook/data/HandbookThreadService.ts +86 -0
- package/src/features/handbook/data/__tests__/HandbookThreadService.spec.ts +112 -0
- package/src/features/handbook/data/handbookDisplay.spec.ts +92 -0
- package/src/features/handbook/data/handbookDisplay.ts +55 -0
- package/src/features/handbook/data/index.ts +16 -0
- package/src/features/handbook/hooks/__tests__/useHandbookAsk.spec.ts +198 -0
- package/src/features/handbook/hooks/useHandbookAsk.ts +213 -0
- package/src/features/handbook/i18n-keys.ts +46 -0
- package/src/features/handbook/index.ts +7 -0
- package/src/features/how-to/components/forms/HowToEditor.tsx +0 -1
- package/src/features/how-to/components/forms/HowToReindexButton.spec.tsx +84 -0
- package/src/features/how-to/components/forms/HowToReindexButton.tsx +46 -0
- package/src/features/how-to/components/index.ts +1 -0
- package/src/features/how-to/components/lists/HowToList.tsx +5 -1
- package/src/features/how-to/data/HowTo.spec.ts +61 -1
- package/src/features/how-to/data/HowToService.ts +13 -0
- package/dist/chunk-JEGL7KHK.mjs.map +0 -1
- package/dist/chunk-L7DZSTFU.js.map +0 -1
- package/dist/chunk-OKGGYCO5.js.map +0 -1
- package/dist/chunk-Q2BREXH3.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-CR5KH4AI.mjs.map → BlockNoteEditor-SERY337S.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-NJKFUNXP.mjs.map → BlockNoteViewer-P2VKEFRN.mjs.map} +0 -0
- /package/dist/{chunk-HVNEWDRF.mjs.map → chunk-VZKJIAND.mjs.map} +0 -0
|
@@ -7,5 +7,6 @@ export { default as HowToDetails } from "./details/HowToDetails";
|
|
|
7
7
|
export { default as HowToDeleter } from "./forms/HowToDeleter";
|
|
8
8
|
export { default as HowToEditor } from "./forms/HowToEditor";
|
|
9
9
|
export { default as HowToMultiSelector } from "./forms/HowToMultiSelector";
|
|
10
|
+
export { default as HowToReindexButton } from "./forms/HowToReindexButton";
|
|
10
11
|
export { default as HowToSelector } from "./forms/HowToSelector";
|
|
11
12
|
export { default as HowToList } from "./lists/HowToList";
|
|
@@ -10,6 +10,7 @@ import { HowToInterface } from "../../data/HowToInterface";
|
|
|
10
10
|
import { HowToService } from "../../data/HowToService";
|
|
11
11
|
import "../../hooks/useHowToTableStructure";
|
|
12
12
|
import HowToEditor from "../forms/HowToEditor";
|
|
13
|
+
import HowToReindexButton from "../forms/HowToReindexButton";
|
|
13
14
|
|
|
14
15
|
type HowToListProps = {
|
|
15
16
|
fullWidth?: boolean;
|
|
@@ -24,7 +25,10 @@ export default function HowToList({ fullWidth }: HowToListProps) {
|
|
|
24
25
|
retrieverParams: {},
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
const functions: ReactNode[] = [
|
|
28
|
+
const functions: ReactNode[] = [
|
|
29
|
+
<HowToReindexButton key="reindex-how-tos" refresh={data.refresh} />,
|
|
30
|
+
<HowToEditor key="create-how-to" />,
|
|
31
|
+
];
|
|
28
32
|
|
|
29
33
|
return (
|
|
30
34
|
<ContentListTable
|
|
@@ -11,16 +11,34 @@ const howToModule: ApiRequestDataTypeInterface = {
|
|
|
11
11
|
model: HowTo,
|
|
12
12
|
} as any;
|
|
13
13
|
|
|
14
|
+
const userModule: ApiRequestDataTypeInterface = {
|
|
15
|
+
name: "users",
|
|
16
|
+
model: HowTo,
|
|
17
|
+
} as any;
|
|
18
|
+
|
|
14
19
|
beforeAll(() => {
|
|
15
20
|
ModuleRegistry.register("HowTo", howToModule);
|
|
21
|
+
ModuleRegistry.register("User", userModule);
|
|
16
22
|
});
|
|
17
23
|
|
|
24
|
+
/** Collect every `id` value at any depth of a serialised payload. */
|
|
25
|
+
function collectIds(value: any, ids: string[] = []): string[] {
|
|
26
|
+
if (Array.isArray(value)) {
|
|
27
|
+
for (const item of value) collectIds(item, ids);
|
|
28
|
+
} else if (value && typeof value === "object") {
|
|
29
|
+
for (const [key, child] of Object.entries(value)) {
|
|
30
|
+
if (key === "id") ids.push(child as string);
|
|
31
|
+
else collectIds(child, ids);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return ids;
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
describe("HowTo.createJsonApi", () => {
|
|
19
38
|
it("serialises the new attributes", () => {
|
|
20
39
|
const res = new HowTo().createJsonApi({
|
|
21
40
|
id: "11111111-1111-4111-8111-111111111111",
|
|
22
41
|
name: "Add an NPC",
|
|
23
|
-
authorId: "",
|
|
24
42
|
description: [{ type: "paragraph", content: [] }],
|
|
25
43
|
howToType: "how-to",
|
|
26
44
|
slug: "add-an-npc",
|
|
@@ -40,4 +58,46 @@ describe("HowTo.createJsonApi", () => {
|
|
|
40
58
|
expect(a.draft).toBe(false);
|
|
41
59
|
expect(typeof a.description).toBe("string"); // existing: BlockNote JSON stringified
|
|
42
60
|
});
|
|
61
|
+
|
|
62
|
+
it("emits no author relationship when the how-to has no author", () => {
|
|
63
|
+
// The backend HowTo descriptor declares `relationships: {}` — a how-to has no
|
|
64
|
+
// author on the wire, so the editor must not invent one.
|
|
65
|
+
const res = new HowTo().createJsonApi({
|
|
66
|
+
id: "11111111-1111-4111-8111-111111111111",
|
|
67
|
+
name: "Add an NPC",
|
|
68
|
+
description: [{ type: "paragraph", content: [] }],
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
expect(res.data.relationships).toEqual({});
|
|
72
|
+
expect(res.data.relationships.author).toBeUndefined();
|
|
73
|
+
expect("author" in res.data.relationships).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("emits no empty-string id anywhere in the payload", () => {
|
|
77
|
+
const res = new HowTo().createJsonApi({
|
|
78
|
+
id: "11111111-1111-4111-8111-111111111111",
|
|
79
|
+
name: "Add an NPC",
|
|
80
|
+
description: [{ type: "paragraph", content: [] }],
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const ids = collectIds(res);
|
|
84
|
+
expect(ids).toEqual(["11111111-1111-4111-8111-111111111111"]);
|
|
85
|
+
expect(ids).not.toContain("");
|
|
86
|
+
expect(JSON.stringify(res)).not.toContain('"id":""');
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("still emits the author relationship when a real author id is supplied", () => {
|
|
90
|
+
// Guards the ContentInput widening: content types that DO carry an author
|
|
91
|
+
// keep serialising it through Content.addContentInput.
|
|
92
|
+
const res = new HowTo().createJsonApi({
|
|
93
|
+
id: "11111111-1111-4111-8111-111111111111",
|
|
94
|
+
name: "Add an NPC",
|
|
95
|
+
authorId: "22222222-2222-4222-8222-222222222222",
|
|
96
|
+
description: [{ type: "paragraph", content: [] }],
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
expect(res.data.relationships.author).toEqual({
|
|
100
|
+
data: { type: "users", id: "22222222-2222-4222-8222-222222222222" },
|
|
101
|
+
});
|
|
102
|
+
});
|
|
43
103
|
});
|
|
@@ -59,6 +59,19 @@ export class HowToService extends AbstractService {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* POST /howtos/reindex — re-queues every guide for chunking. Replies 204.
|
|
64
|
+
* Chunking otherwise only happens on create and update, so a guide that was
|
|
65
|
+
* never chunked stays invisible to help-mode retrieval with no way back.
|
|
66
|
+
*/
|
|
67
|
+
static async reindex(): Promise<void> {
|
|
68
|
+
await this.callApi({
|
|
69
|
+
type: Modules.HowTo,
|
|
70
|
+
method: HttpMethod.POST,
|
|
71
|
+
endpoint: new EndpointCreator({ endpoint: Modules.HowTo, id: "reindex" }).generate(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
62
75
|
static async findPublished(params: { howToType?: string } = {}): Promise<HowToInterface[]> {
|
|
63
76
|
const endpoint = new EndpointCreator({ endpoint: `public/${Modules.HowTo.name}` });
|
|
64
77
|
if (params.howToType) endpoint.addAdditionalParam("type", params.howToType);
|