@btst/stack 3.1.2 → 4.0.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 +2 -2
- package/dist/packages/stack/src/plugins/ai-chat/client/hooks/chat-hooks.cjs +5 -5
- package/dist/packages/stack/src/plugins/ai-chat/client/hooks/chat-hooks.mjs +5 -5
- package/dist/packages/stack/src/plugins/kanban/api/getters.cjs +7 -5
- package/dist/packages/stack/src/plugins/kanban/api/getters.mjs +7 -5
- package/dist/packages/stack/src/plugins/media/client/hooks/use-media.cjs +10 -8
- package/dist/packages/stack/src/plugins/media/client/hooks/use-media.mjs +10 -8
- 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 +2 -2
- package/dist/plugins/blog/client/index.d.mts +2 -2
- package/dist/plugins/blog/client/index.d.ts +2 -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/cms/api/index.d.cts +1 -1
- package/dist/plugins/cms/api/index.d.mts +1 -1
- package/dist/plugins/cms/api/index.d.ts +1 -1
- package/dist/plugins/cms/query-keys.d.cts +1 -1
- package/dist/plugins/cms/query-keys.d.mts +1 -1
- package/dist/plugins/cms/query-keys.d.ts +1 -1
- package/dist/plugins/form-builder/api/index.d.cts +1 -1
- package/dist/plugins/form-builder/api/index.d.mts +1 -1
- package/dist/plugins/form-builder/api/index.d.ts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/form-builder/query-keys.d.cts +1 -1
- package/dist/plugins/form-builder/query-keys.d.mts +1 -1
- package/dist/plugins/form-builder/query-keys.d.ts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.cts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.mts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.ts +1 -1
- package/dist/plugins/ui-builder/client/index.d.cts +1 -1
- package/dist/plugins/ui-builder/client/index.d.mts +1 -1
- package/dist/plugins/ui-builder/client/index.d.ts +1 -1
- package/dist/plugins/ui-builder/query-keys.d.cts +1 -1
- package/dist/plugins/ui-builder/query-keys.d.mts +1 -1
- package/dist/plugins/ui-builder/query-keys.d.ts +1 -1
- package/dist/shared/{stack.BTStHVTy.d.cts → stack.BGzgFx3R.d.cts} +5 -5
- package/dist/shared/{stack.CtrnoQgH.d.cts → stack.BOZRaVpu.d.cts} +35 -35
- package/dist/shared/{stack.94kN3pEK.d.mts → stack.CjCSDfWy.d.mts} +5 -5
- package/dist/shared/{stack.lPKwd_v0.d.ts → stack.DlBoNqYu.d.ts} +35 -35
- package/dist/shared/{stack.DfrRYOIl.d.ts → stack.Dpg_JjIo.d.ts} +5 -5
- package/dist/shared/{stack.BggTHKlo.d.mts → stack.Dvy7FmaA.d.mts} +35 -35
- package/package.json +11 -7
- package/src/__tests__/package-metadata.test.ts +4 -4
- package/src/plugins/ai-chat/__tests__/hooks.test.tsx +70 -54
- package/src/plugins/ai-chat/client/hooks/chat-hooks.tsx +6 -9
- package/src/plugins/kanban/__tests__/getters.test.ts +14 -1
- package/src/plugins/kanban/api/getters.ts +9 -7
- package/src/plugins/kanban/types.ts +4 -6
- package/src/plugins/media/client/hooks/use-media.tsx +7 -8
- package/dist/shared/{stack.lsbdKRj7.d.mts → stack.B8PG21zX.d.mts} +16 -16
- package/dist/shared/{stack.CGmh-Lpe.d.ts → stack.BuxUQqL8.d.ts} +12 -12
- package/dist/shared/{stack.zch70Loj.d.cts → stack.CX83YNuS.d.cts} +12 -12
- package/dist/shared/{stack.CKc_Bais.d.cts → stack.Csi-4Mgz.d.cts} +7 -7
- package/dist/shared/{stack.CKc_Bais.d.mts → stack.Csi-4Mgz.d.mts} +7 -7
- package/dist/shared/{stack.CKc_Bais.d.ts → stack.Csi-4Mgz.d.ts} +7 -7
- package/dist/shared/{stack.BMlTZnZp.d.ts → stack.CyalJ0j6.d.ts} +16 -16
- package/dist/shared/{stack.BV0uNV4f.d.cts → stack.D6Pg-ufX.d.cts} +16 -16
- package/dist/shared/{stack.Doy2_wgl.d.mts → stack.Egr3RWhA.d.mts} +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btst/stack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "A composable, plugin-based library for building full-stack applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1067,7 +1067,7 @@
|
|
|
1067
1067
|
}
|
|
1068
1068
|
},
|
|
1069
1069
|
"dependencies": {
|
|
1070
|
-
"@btst/db": "
|
|
1070
|
+
"@btst/db": "3.0.0",
|
|
1071
1071
|
"@milkdown/crepe": "^7.17.1",
|
|
1072
1072
|
"@milkdown/kit": "^7.17.1",
|
|
1073
1073
|
"remend": "^1.0.1",
|
|
@@ -1088,7 +1088,7 @@
|
|
|
1088
1088
|
"@tanstack/react-router": ">=1.0.0",
|
|
1089
1089
|
"@vercel/blob": ">=0.14.0",
|
|
1090
1090
|
"ai": ">=5.0.0",
|
|
1091
|
-
"better-call": "1.
|
|
1091
|
+
"better-call": "1.4.0",
|
|
1092
1092
|
"class-variance-authority": ">=0.7.0",
|
|
1093
1093
|
"clsx": ">=2.1.0",
|
|
1094
1094
|
"cmdk": ">=1.1.0",
|
|
@@ -1097,8 +1097,8 @@
|
|
|
1097
1097
|
"katex": ">=0.16.0",
|
|
1098
1098
|
"lucide-react": ">=0.469.0",
|
|
1099
1099
|
"next": ">=15.0.0",
|
|
1100
|
-
"react": "
|
|
1101
|
-
"react-dom": "
|
|
1100
|
+
"react": ">=19.2.6",
|
|
1101
|
+
"react-dom": ">=19.2.6",
|
|
1102
1102
|
"react-error-boundary": ">=4.0.0",
|
|
1103
1103
|
"react-hook-form": ">=7.55.0",
|
|
1104
1104
|
"react-markdown": ">=9.1.0",
|
|
@@ -1110,7 +1110,7 @@
|
|
|
1110
1110
|
"remark-math": ">=6.0.0",
|
|
1111
1111
|
"sonner": ">=2.0.0",
|
|
1112
1112
|
"tailwind-merge": ">=2.6.0",
|
|
1113
|
-
"tailwindcss": ">=3.
|
|
1113
|
+
"tailwindcss": ">=4.3.2",
|
|
1114
1114
|
"zod": ">=4.2.0"
|
|
1115
1115
|
},
|
|
1116
1116
|
"peerDependenciesMeta": {
|
|
@@ -1137,7 +1137,10 @@
|
|
|
1137
1137
|
"@ai-sdk/react": "^2.0.94",
|
|
1138
1138
|
"@aws-sdk/client-s3": "^3.1011.0",
|
|
1139
1139
|
"@aws-sdk/s3-request-presigner": "^3.1011.0",
|
|
1140
|
-
"@
|
|
1140
|
+
"@better-auth/core": "1.7.6",
|
|
1141
|
+
"@better-auth/utils": "0.4.2",
|
|
1142
|
+
"@better-fetch/fetch": "1.3.2",
|
|
1143
|
+
"@btst/adapter-memory": "3.0.0",
|
|
1141
1144
|
"@btst/yar": "1.3.2",
|
|
1142
1145
|
"@tanstack/react-router": "1.168.10",
|
|
1143
1146
|
"@types/react": "^19.0.0",
|
|
@@ -1146,6 +1149,7 @@
|
|
|
1146
1149
|
"@vercel/blob": "^0.27.3",
|
|
1147
1150
|
"@workspace/ui": "workspace:*",
|
|
1148
1151
|
"ai": "^5.0.94",
|
|
1152
|
+
"better-auth": "1.7.6",
|
|
1149
1153
|
"better-call": "catalog:",
|
|
1150
1154
|
"jsdom": "^28.1.0",
|
|
1151
1155
|
"knip": "^5.61.2",
|
|
@@ -11,7 +11,7 @@ import { z } from "zod";
|
|
|
11
11
|
const execFileAsync = promisify(execFile);
|
|
12
12
|
|
|
13
13
|
describe("published dependency alignment", () => {
|
|
14
|
-
it("uses the Better DB release that shares the Better Auth 1.6
|
|
14
|
+
it("uses the Better DB release that shares the Better Auth 1.7.6 cohort", async () => {
|
|
15
15
|
const manifest = JSON.parse(
|
|
16
16
|
await readFile(resolve("package.json"), "utf8"),
|
|
17
17
|
) as {
|
|
@@ -20,11 +20,11 @@ describe("published dependency alignment", () => {
|
|
|
20
20
|
peerDependencies?: Record<string, string>;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
expect(manifest.dependencies?.["@btst/db"]).toBe("
|
|
24
|
-
expect(manifest.devDependencies?.["@btst/adapter-memory"]).toBe("
|
|
23
|
+
expect(manifest.dependencies?.["@btst/db"]).toBe("3.0.0");
|
|
24
|
+
expect(manifest.devDependencies?.["@btst/adapter-memory"]).toBe("3.0.0");
|
|
25
25
|
expect(manifest.devDependencies?.["@btst/yar"]).toBe("1.3.2");
|
|
26
26
|
expect(manifest.peerDependencies?.["@btst/yar"]).toBe(">=1.3.2");
|
|
27
|
-
expect(manifest.peerDependencies?.["better-call"]).toBe("1.
|
|
27
|
+
expect(manifest.peerDependencies?.["better-call"]).toBe("1.4.0");
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -177,58 +177,74 @@ describe("useRenameConversationForm", () => {
|
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
describe("useDeleteConversation", () => {
|
|
180
|
-
it("
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
180
|
+
it.each(["mutate", "mutateAsync"] as const)(
|
|
181
|
+
"%s forwards callbacks and evicts only the deleted detail in the starting identity partition",
|
|
182
|
+
async (method) => {
|
|
183
|
+
const identityPartition = "anonymous" as const;
|
|
184
|
+
const otherConversation = {
|
|
185
|
+
...conversation,
|
|
186
|
+
id: "conv-2",
|
|
187
|
+
title: "Other",
|
|
188
|
+
};
|
|
189
|
+
const otherIdentity = { id: "other-user", role: "user" } as const;
|
|
190
|
+
const listKey = buildQueryKey(
|
|
191
|
+
"conversations",
|
|
192
|
+
"list",
|
|
193
|
+
aiChatResources.conversations.queries.list,
|
|
194
|
+
[identityPartition],
|
|
195
|
+
);
|
|
196
|
+
const deletedDetailKey = buildQueryKey(
|
|
197
|
+
"conversations",
|
|
198
|
+
"detail",
|
|
199
|
+
aiChatResources.conversations.queries.detail,
|
|
200
|
+
[conversation.id, identityPartition],
|
|
201
|
+
);
|
|
202
|
+
const otherDetailKey = buildQueryKey(
|
|
203
|
+
"conversations",
|
|
204
|
+
"detail",
|
|
205
|
+
aiChatResources.conversations.queries.detail,
|
|
206
|
+
[otherConversation.id, identityPartition],
|
|
207
|
+
);
|
|
208
|
+
const otherIdentityDetailKey = buildQueryKey(
|
|
209
|
+
"conversations",
|
|
210
|
+
"detail",
|
|
211
|
+
aiChatResources.conversations.queries.detail,
|
|
212
|
+
[conversation.id, otherIdentity],
|
|
213
|
+
);
|
|
214
|
+
let listFetches = 0;
|
|
215
|
+
await queryClient.fetchQuery({
|
|
216
|
+
queryKey: listKey,
|
|
217
|
+
queryFn: async () => {
|
|
218
|
+
listFetches += 1;
|
|
219
|
+
return [conversation, otherConversation];
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
listFetches = 0;
|
|
223
|
+
queryClient.setQueryData(deletedDetailKey, conversation);
|
|
224
|
+
queryClient.setQueryData(otherDetailKey, otherConversation);
|
|
225
|
+
queryClient.setQueryData(otherIdentityDetailKey, conversation);
|
|
226
|
+
fetchMock.mockResolvedValue(jsonResponse({ success: true }));
|
|
227
|
+
const getMutation = await renderDeleteProbe();
|
|
228
|
+
const onSuccess = vi.fn();
|
|
229
|
+
|
|
230
|
+
await act(async () => {
|
|
231
|
+
await getMutation()[method]({ id: conversation.id }, { onSuccess });
|
|
232
|
+
await vi.waitFor(() =>
|
|
233
|
+
expect(queryClient.getQueryData(deletedDetailKey)).toBeUndefined(),
|
|
234
|
+
);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
expect(onSuccess).toHaveBeenCalledTimes(1);
|
|
238
|
+
expect(onSuccess.mock.calls[0]?.[1]).toEqual({ id: conversation.id });
|
|
239
|
+
|
|
240
|
+
expect(listFetches).toBe(1);
|
|
241
|
+
expect(queryClient.getQueryData(deletedDetailKey)).toBeUndefined();
|
|
242
|
+
expect(queryClient.getQueryData(otherDetailKey)).toEqual(
|
|
243
|
+
otherConversation,
|
|
244
|
+
);
|
|
245
|
+
expect(queryClient.getQueryData(otherIdentityDetailKey)).toEqual(
|
|
246
|
+
conversation,
|
|
247
|
+
);
|
|
248
|
+
},
|
|
249
|
+
);
|
|
234
250
|
});
|
|
@@ -146,25 +146,22 @@ function withCurrentHistoryRefresh<TData, TVariables>(
|
|
|
146
146
|
refresh: ReturnType<typeof useCurrentHistoryRefresh>,
|
|
147
147
|
queryKey?: readonly unknown[],
|
|
148
148
|
afterSuccess?: (
|
|
149
|
-
variables:
|
|
149
|
+
variables: Parameters<typeof mutation.mutateAsync>[0],
|
|
150
150
|
startedAs: ReturnType<typeof useAiChatIdentityPartition>,
|
|
151
151
|
) => void,
|
|
152
152
|
): UseMutationResult<TData, Error, TVariables> {
|
|
153
|
-
const mutateAsync: typeof mutation.mutateAsync = async (
|
|
154
|
-
variables,
|
|
155
|
-
options,
|
|
156
|
-
) => {
|
|
153
|
+
const mutateAsync: typeof mutation.mutateAsync = async (...args) => {
|
|
157
154
|
const startedAs = refresh.currentPartition();
|
|
158
|
-
const result = await mutation.mutateAsync(
|
|
155
|
+
const result = await mutation.mutateAsync(...args);
|
|
159
156
|
try {
|
|
160
157
|
await refresh.refreshAfterSuccess(startedAs, queryKey);
|
|
161
158
|
} finally {
|
|
162
|
-
afterSuccess?.(
|
|
159
|
+
afterSuccess?.(args[0], startedAs);
|
|
163
160
|
}
|
|
164
161
|
return result;
|
|
165
162
|
};
|
|
166
|
-
const mutate: typeof mutation.mutate = (
|
|
167
|
-
void mutateAsync(
|
|
163
|
+
const mutate: typeof mutation.mutate = (...args) => {
|
|
164
|
+
void mutateAsync(...args).catch(() => {});
|
|
168
165
|
};
|
|
169
166
|
return { ...mutation, mutate, mutateAsync };
|
|
170
167
|
}
|
|
@@ -3,7 +3,7 @@ import { createMemoryAdapter } from "@btst/adapter-memory";
|
|
|
3
3
|
import { defineDb } from "@btst/db";
|
|
4
4
|
import type { DBAdapter as Adapter } from "@btst/db";
|
|
5
5
|
import { kanbanSchema } from "../db";
|
|
6
|
-
import { getAllBoards, getBoardById } from "../api/getters";
|
|
6
|
+
import { getAllBoards, getBoardById, getBoardSummaries } from "../api/getters";
|
|
7
7
|
|
|
8
8
|
const createTestAdapter = (): Adapter => {
|
|
9
9
|
const db = defineDb({}).use(kanbanSchema);
|
|
@@ -90,6 +90,7 @@ describe("kanban getters", () => {
|
|
|
90
90
|
expect(total).toBe(1);
|
|
91
91
|
expect(boards[0]!.slug).toBe("my-board");
|
|
92
92
|
expect(boards[0]!.columns).toHaveLength(1);
|
|
93
|
+
expect(boards[0]).not.toHaveProperty("kanbanColumn");
|
|
93
94
|
expect(boards[0]!.columns[0]!.title).toBe("To Do");
|
|
94
95
|
expect(boards[0]!.columns[0]!.tasks).toHaveLength(1);
|
|
95
96
|
expect(boards[0]!.columns[0]!.tasks[0]!.title).toBe("Task 1");
|
|
@@ -139,6 +140,18 @@ describe("kanban getters", () => {
|
|
|
139
140
|
});
|
|
140
141
|
});
|
|
141
142
|
|
|
143
|
+
it("returns joined column summaries without leaking raw relations or tasks", async () => {
|
|
144
|
+
const board = await createBoard(adapter, "Board", "board");
|
|
145
|
+
const column = await createColumn(adapter, board.id, "To Do", 0);
|
|
146
|
+
await createTask(adapter, column.id, "Private task", 0);
|
|
147
|
+
|
|
148
|
+
const { items } = await getBoardSummaries(adapter);
|
|
149
|
+
expect(items[0]?.columns).toHaveLength(1);
|
|
150
|
+
expect(items[0]?.columns[0]?.title).toBe("To Do");
|
|
151
|
+
expect(items[0]).not.toHaveProperty("kanbanColumn");
|
|
152
|
+
expect(items[0]?.columns[0]).not.toHaveProperty("tasks");
|
|
153
|
+
});
|
|
154
|
+
|
|
142
155
|
describe("getBoardById", () => {
|
|
143
156
|
it("returns null when board does not exist", async () => {
|
|
144
157
|
const board = await getBoardById(adapter, "nonexistent");
|
|
@@ -65,15 +65,15 @@ async function getBoardRows(
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* Given a raw board record (with a `
|
|
68
|
+
* Given a raw board record (with a `kanbanColumn` join), fetches tasks for every
|
|
69
69
|
* column in parallel and returns the sorted columns with their tasks attached.
|
|
70
|
-
* Strips the raw `
|
|
70
|
+
* Strips the raw `kanbanColumn` join field from the returned board object.
|
|
71
71
|
*/
|
|
72
72
|
async function hydrateColumnsWithTasks(
|
|
73
73
|
adapter: Adapter,
|
|
74
74
|
board: BoardWithKanbanColumn,
|
|
75
75
|
): Promise<BoardWithColumns> {
|
|
76
|
-
const columnIds = (board.
|
|
76
|
+
const columnIds = (board.kanbanColumn || []).map((c) => c.id);
|
|
77
77
|
const tasksByColumn = new Map<string, Task[]>();
|
|
78
78
|
|
|
79
79
|
if (columnIds.length > 0) {
|
|
@@ -97,11 +97,11 @@ async function hydrateColumnsWithTasks(
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const columns: ColumnWithTasks[] = (board.
|
|
100
|
+
const columns: ColumnWithTasks[] = (board.kanbanColumn || [])
|
|
101
101
|
.sort((a, b) => a.order - b.order)
|
|
102
102
|
.map((col) => ({ ...col, tasks: tasksByColumn.get(col.id) || [] }));
|
|
103
103
|
|
|
104
|
-
const {
|
|
104
|
+
const { kanbanColumn: _, ...boardWithoutJoin } = board;
|
|
105
105
|
return { ...boardWithoutJoin, columns };
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -131,9 +131,11 @@ export async function getBoardSummaries(
|
|
|
131
131
|
const result = await getBoardRows(adapter, params);
|
|
132
132
|
return {
|
|
133
133
|
...result,
|
|
134
|
-
items: result.items.map(({
|
|
134
|
+
items: result.items.map(({ kanbanColumn = [], ...board }) => ({
|
|
135
135
|
...board,
|
|
136
|
-
columns: [...
|
|
136
|
+
columns: [...kanbanColumn].sort(
|
|
137
|
+
(left, right) => left.order - right.order,
|
|
138
|
+
),
|
|
137
139
|
})),
|
|
138
140
|
};
|
|
139
141
|
}
|
|
@@ -85,20 +85,18 @@ export type BoardWithColumnsOnly = Board & {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Board with joined column relationships from the database
|
|
88
|
-
*
|
|
89
|
-
* not the model name ("kanbanColumn")
|
|
88
|
+
* Better DB 3 returns joined data under the canonical model name.
|
|
90
89
|
*/
|
|
91
90
|
export type BoardWithKanbanColumn = Board & {
|
|
92
|
-
|
|
91
|
+
kanbanColumn?: Column[];
|
|
93
92
|
};
|
|
94
93
|
|
|
95
94
|
/**
|
|
96
95
|
* Column with joined task relationships from the database
|
|
97
|
-
*
|
|
98
|
-
* not the model name ("kanbanTask")
|
|
96
|
+
* Better DB 3 returns joined data under the canonical model name.
|
|
99
97
|
*/
|
|
100
98
|
export type ColumnWithKanbanTask = Column & {
|
|
101
|
-
|
|
99
|
+
kanbanTask?: Task[];
|
|
102
100
|
};
|
|
103
101
|
|
|
104
102
|
// Serialized types for API responses (dates as strings)
|
|
@@ -157,12 +157,10 @@ function withCurrentListRefresh<TData, TVariables>(
|
|
|
157
157
|
mapResult: (data: TData) => TData = (data) => data,
|
|
158
158
|
data: TData | undefined = mutation.data,
|
|
159
159
|
): UseMutationResult<TData, Error, TVariables> {
|
|
160
|
-
const mutateAsync: typeof mutation.mutateAsync = async (
|
|
161
|
-
|
|
162
|
-
options,
|
|
163
|
-
) => {
|
|
160
|
+
const mutateAsync: typeof mutation.mutateAsync = async (...args) => {
|
|
161
|
+
const options = args[1];
|
|
164
162
|
const startedAs = listRefresh.currentScope();
|
|
165
|
-
|
|
163
|
+
args[1] = {
|
|
166
164
|
...options,
|
|
167
165
|
onSuccess: options?.onSuccess
|
|
168
166
|
? (data, ...args) => options.onSuccess?.(mapResult(data), ...args)
|
|
@@ -174,14 +172,15 @@ function withCurrentListRefresh<TData, TVariables>(
|
|
|
174
172
|
...args,
|
|
175
173
|
)
|
|
176
174
|
: undefined,
|
|
177
|
-
}
|
|
175
|
+
};
|
|
176
|
+
const result = await mutation.mutateAsync(...args);
|
|
178
177
|
await listRefresh.refreshAfterSuccess(startedAs);
|
|
179
178
|
return mapResult(result);
|
|
180
179
|
};
|
|
181
|
-
const mutate: typeof mutation.mutate = (
|
|
180
|
+
const mutate: typeof mutation.mutate = (...args) => {
|
|
182
181
|
// Each invocation owns an awaited promise, so a later mutation cannot
|
|
183
182
|
// detach the successful call's required cache refresh.
|
|
184
|
-
void mutateAsync(
|
|
183
|
+
void mutateAsync(...args).catch(() => {});
|
|
185
184
|
};
|
|
186
185
|
return {
|
|
187
186
|
...mutation,
|
|
@@ -95,8 +95,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
95
95
|
readonly id: string;
|
|
96
96
|
readonly slug: string;
|
|
97
97
|
readonly contentTypeId: string;
|
|
98
|
-
readonly data: string;
|
|
99
98
|
readonly authorId?: string | undefined;
|
|
99
|
+
readonly data: string;
|
|
100
100
|
}[];
|
|
101
101
|
readonly total: number;
|
|
102
102
|
}>;
|
|
@@ -128,8 +128,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
128
128
|
readonly id: string;
|
|
129
129
|
readonly slug: string;
|
|
130
130
|
readonly contentTypeId: string;
|
|
131
|
-
readonly data: string;
|
|
132
131
|
readonly authorId?: string | undefined;
|
|
132
|
+
readonly data: string;
|
|
133
133
|
}>;
|
|
134
134
|
readonly createContentItem: better_call.StrictEndpoint<"/content/:typeSlug", {
|
|
135
135
|
params: z.ZodObject<{
|
|
@@ -165,8 +165,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
165
165
|
readonly id: string;
|
|
166
166
|
readonly slug: string;
|
|
167
167
|
readonly contentTypeId: string;
|
|
168
|
-
readonly data: string;
|
|
169
168
|
readonly authorId?: string | undefined;
|
|
169
|
+
readonly data: string;
|
|
170
170
|
}>;
|
|
171
171
|
readonly updateContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
|
|
172
172
|
params: z.ZodObject<{
|
|
@@ -203,8 +203,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
203
203
|
readonly id: string;
|
|
204
204
|
readonly slug: string;
|
|
205
205
|
readonly contentTypeId: string;
|
|
206
|
-
readonly data: string;
|
|
207
206
|
readonly authorId?: string | undefined;
|
|
207
|
+
readonly data: string;
|
|
208
208
|
}>;
|
|
209
209
|
readonly deleteContentItem: better_call.StrictEndpoint<"/content/:typeSlug/:id", {
|
|
210
210
|
params: z.ZodObject<{
|
|
@@ -248,8 +248,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
248
248
|
readonly id: string;
|
|
249
249
|
readonly slug: string;
|
|
250
250
|
readonly contentTypeId: string;
|
|
251
|
-
readonly data: string;
|
|
252
251
|
readonly authorId?: string | undefined;
|
|
252
|
+
readonly data: string;
|
|
253
253
|
}[];
|
|
254
254
|
};
|
|
255
255
|
readonly contentType?: {
|
|
@@ -271,8 +271,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
271
271
|
readonly id: string;
|
|
272
272
|
readonly slug: string;
|
|
273
273
|
readonly contentTypeId: string;
|
|
274
|
-
readonly data: string;
|
|
275
274
|
readonly authorId?: string | undefined;
|
|
275
|
+
readonly data: string;
|
|
276
276
|
}>;
|
|
277
277
|
readonly listContentByRelation: better_call.StrictEndpoint<"/content/:typeSlug/by-relation", {
|
|
278
278
|
params: z.ZodObject<{
|
|
@@ -314,8 +314,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
314
314
|
readonly id: string;
|
|
315
315
|
readonly slug: string;
|
|
316
316
|
readonly contentTypeId: string;
|
|
317
|
-
readonly data: string;
|
|
318
317
|
readonly authorId?: string | undefined;
|
|
318
|
+
readonly data: string;
|
|
319
319
|
}[];
|
|
320
320
|
readonly total: number;
|
|
321
321
|
readonly limit: number;
|
|
@@ -383,8 +383,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
383
383
|
readonly id: string;
|
|
384
384
|
readonly slug: string;
|
|
385
385
|
readonly contentTypeId: string;
|
|
386
|
-
readonly data: string;
|
|
387
386
|
readonly authorId?: string | undefined;
|
|
387
|
+
readonly data: string;
|
|
388
388
|
}[];
|
|
389
389
|
readonly total: number;
|
|
390
390
|
readonly limit: number;
|
|
@@ -459,8 +459,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
459
459
|
id: string;
|
|
460
460
|
slug: string;
|
|
461
461
|
contentTypeId: string;
|
|
462
|
-
data: string;
|
|
463
462
|
authorId?: string | undefined;
|
|
463
|
+
data: string;
|
|
464
464
|
}[];
|
|
465
465
|
total: number;
|
|
466
466
|
}, false>;
|
|
@@ -493,8 +493,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
493
493
|
id: string;
|
|
494
494
|
slug: string;
|
|
495
495
|
contentTypeId: string;
|
|
496
|
-
data: string;
|
|
497
496
|
authorId?: string | undefined;
|
|
497
|
+
data: string;
|
|
498
498
|
}, false>;
|
|
499
499
|
readonly createContentItem: _btst_stack_plugins_api.Operation<z.ZodObject<{
|
|
500
500
|
typeSlug: z.ZodString;
|
|
@@ -522,8 +522,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
522
522
|
id: string;
|
|
523
523
|
slug: string;
|
|
524
524
|
contentTypeId: string;
|
|
525
|
-
data: string;
|
|
526
525
|
authorId?: string | undefined;
|
|
526
|
+
data: string;
|
|
527
527
|
}, false>;
|
|
528
528
|
readonly updateContentItem: _btst_stack_plugins_api.Operation<z.ZodObject<{
|
|
529
529
|
typeSlug: z.ZodString;
|
|
@@ -554,8 +554,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
554
554
|
id: string;
|
|
555
555
|
slug: string;
|
|
556
556
|
contentTypeId: string;
|
|
557
|
-
data: string;
|
|
558
557
|
authorId?: string | undefined;
|
|
558
|
+
data: string;
|
|
559
559
|
}, false>;
|
|
560
560
|
readonly deleteContentItem: _btst_stack_plugins_api.Operation<z.ZodObject<{
|
|
561
561
|
typeSlug: z.ZodString;
|
|
@@ -598,8 +598,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
598
598
|
id: string;
|
|
599
599
|
slug: string;
|
|
600
600
|
contentTypeId: string;
|
|
601
|
-
data: string;
|
|
602
601
|
authorId?: string | undefined;
|
|
602
|
+
data: string;
|
|
603
603
|
}[];
|
|
604
604
|
};
|
|
605
605
|
contentType?: {
|
|
@@ -619,8 +619,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
619
619
|
id: string;
|
|
620
620
|
slug: string;
|
|
621
621
|
contentTypeId: string;
|
|
622
|
-
data: string;
|
|
623
622
|
authorId?: string | undefined;
|
|
623
|
+
data: string;
|
|
624
624
|
}, false>;
|
|
625
625
|
readonly listContentByRelation: _btst_stack_plugins_api.Operation<z.ZodObject<{
|
|
626
626
|
typeSlug: z.ZodString;
|
|
@@ -657,8 +657,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
657
657
|
id: string;
|
|
658
658
|
slug: string;
|
|
659
659
|
contentTypeId: string;
|
|
660
|
-
data: string;
|
|
661
660
|
authorId?: string | undefined;
|
|
661
|
+
data: string;
|
|
662
662
|
}[];
|
|
663
663
|
total: number;
|
|
664
664
|
limit: number;
|
|
@@ -715,8 +715,8 @@ declare const cmsBackendPlugin: (config: CMSBackendConfig) => _btst_stack_plugin
|
|
|
715
715
|
id: string;
|
|
716
716
|
slug: string;
|
|
717
717
|
contentTypeId: string;
|
|
718
|
-
data: string;
|
|
719
718
|
authorId?: string | undefined;
|
|
719
|
+
data: string;
|
|
720
720
|
}[];
|
|
721
721
|
total: number;
|
|
722
722
|
limit: number;
|
|
@@ -127,11 +127,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
127
127
|
readonly status: Form["status"];
|
|
128
128
|
readonly createdAt: string;
|
|
129
129
|
readonly updatedAt: string;
|
|
130
|
-
readonly id: string;
|
|
131
|
-
readonly name: string;
|
|
132
130
|
readonly schema: string;
|
|
131
|
+
readonly id: string;
|
|
133
132
|
readonly description?: string | undefined;
|
|
134
133
|
readonly slug: string;
|
|
134
|
+
readonly name: string;
|
|
135
135
|
readonly successMessage?: string | undefined;
|
|
136
136
|
readonly redirectUrl?: string | undefined;
|
|
137
137
|
readonly createdBy?: string | undefined;
|
|
@@ -151,11 +151,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
151
151
|
readonly status: Form["status"];
|
|
152
152
|
readonly createdAt: string;
|
|
153
153
|
readonly updatedAt: string;
|
|
154
|
-
readonly id: string;
|
|
155
|
-
readonly name: string;
|
|
156
154
|
readonly schema: string;
|
|
155
|
+
readonly id: string;
|
|
157
156
|
readonly description?: string | undefined;
|
|
158
157
|
readonly slug: string;
|
|
158
|
+
readonly name: string;
|
|
159
159
|
readonly successMessage?: string | undefined;
|
|
160
160
|
readonly redirectUrl?: string | undefined;
|
|
161
161
|
readonly createdBy?: string | undefined;
|
|
@@ -171,11 +171,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
171
171
|
readonly status: Form["status"];
|
|
172
172
|
readonly createdAt: string;
|
|
173
173
|
readonly updatedAt: string;
|
|
174
|
-
readonly id: string;
|
|
175
|
-
readonly name: string;
|
|
176
174
|
readonly schema: string;
|
|
175
|
+
readonly id: string;
|
|
177
176
|
readonly description?: string | undefined;
|
|
178
177
|
readonly slug: string;
|
|
178
|
+
readonly name: string;
|
|
179
179
|
readonly successMessage?: string | undefined;
|
|
180
180
|
readonly redirectUrl?: string | undefined;
|
|
181
181
|
readonly createdBy?: string | undefined;
|
|
@@ -191,11 +191,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
191
191
|
readonly status: Form["status"];
|
|
192
192
|
readonly createdAt: string;
|
|
193
193
|
readonly updatedAt: string;
|
|
194
|
-
readonly id: string;
|
|
195
|
-
readonly name: string;
|
|
196
194
|
readonly schema: string;
|
|
195
|
+
readonly id: string;
|
|
197
196
|
readonly description?: string | undefined;
|
|
198
197
|
readonly slug: string;
|
|
198
|
+
readonly name: string;
|
|
199
199
|
readonly successMessage?: string | undefined;
|
|
200
200
|
readonly redirectUrl?: string | undefined;
|
|
201
201
|
readonly createdBy?: string | undefined;
|
|
@@ -225,11 +225,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
225
225
|
readonly status: Form["status"];
|
|
226
226
|
readonly createdAt: string;
|
|
227
227
|
readonly updatedAt: string;
|
|
228
|
-
readonly id: string;
|
|
229
|
-
readonly name: string;
|
|
230
228
|
readonly schema: string;
|
|
229
|
+
readonly id: string;
|
|
231
230
|
readonly description?: string | undefined;
|
|
232
231
|
readonly slug: string;
|
|
232
|
+
readonly name: string;
|
|
233
233
|
readonly successMessage?: string | undefined;
|
|
234
234
|
readonly redirectUrl?: string | undefined;
|
|
235
235
|
readonly createdBy?: string | undefined;
|
|
@@ -259,11 +259,11 @@ declare const formBuilderBackendPlugin: (config?: FormBuilderBackendConfig) => _
|
|
|
259
259
|
readonly status: Form["status"];
|
|
260
260
|
readonly createdAt: string;
|
|
261
261
|
readonly updatedAt: string;
|
|
262
|
-
readonly id: string;
|
|
263
|
-
readonly name: string;
|
|
264
262
|
readonly schema: string;
|
|
263
|
+
readonly id: string;
|
|
265
264
|
readonly description?: string | undefined;
|
|
266
265
|
readonly slug: string;
|
|
266
|
+
readonly name: string;
|
|
267
267
|
readonly successMessage?: string | undefined;
|
|
268
268
|
readonly redirectUrl?: string | undefined;
|
|
269
269
|
readonly createdBy?: string | undefined;
|