@btst/stack 2.2.0 → 2.3.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/packages/stack/src/plugins/blog/api/plugin.cjs +52 -1
- package/dist/packages/stack/src/plugins/blog/api/plugin.mjs +52 -1
- package/dist/packages/stack/src/plugins/blog/api/query-key-defs.cjs +18 -0
- package/dist/packages/stack/src/plugins/blog/api/query-key-defs.mjs +15 -0
- package/dist/packages/stack/src/plugins/blog/api/serializers.cjs +21 -0
- package/dist/packages/stack/src/plugins/blog/api/serializers.mjs +18 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/blog/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/cms/api/getters.cjs +10 -0
- package/dist/packages/stack/src/plugins/cms/api/getters.mjs +10 -1
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +70 -1
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +71 -2
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.cjs +29 -0
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.mjs +26 -0
- package/dist/packages/stack/src/plugins/cms/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/cms/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/form-builder/api/getters.cjs +9 -0
- package/dist/packages/stack/src/plugins/form-builder/api/getters.mjs +9 -1
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.cjs +62 -1
- package/dist/packages/stack/src/plugins/form-builder/api/plugin.mjs +63 -2
- package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.cjs +37 -0
- package/dist/packages/stack/src/plugins/form-builder/api/query-key-defs.mjs +33 -0
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.cjs +15 -0
- package/dist/packages/stack/src/plugins/form-builder/client/plugin.mjs +16 -1
- package/dist/packages/stack/src/plugins/kanban/api/plugin.cjs +29 -1
- package/dist/packages/stack/src/plugins/kanban/api/plugin.mjs +29 -1
- package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.cjs +26 -0
- package/dist/packages/stack/src/plugins/kanban/api/query-key-defs.mjs +23 -0
- package/dist/packages/stack/src/plugins/kanban/api/serializers.cjs +30 -0
- package/dist/packages/stack/src/plugins/kanban/api/serializers.mjs +26 -0
- package/dist/packages/stack/src/plugins/kanban/client/plugin.cjs +10 -0
- package/dist/packages/stack/src/plugins/kanban/client/plugin.mjs +11 -1
- package/dist/packages/stack/src/plugins/utils.cjs +6 -0
- package/dist/packages/stack/src/plugins/utils.mjs +6 -1
- package/dist/plugins/blog/api/index.cjs +5 -0
- package/dist/plugins/blog/api/index.d.cts +19 -4
- package/dist/plugins/blog/api/index.d.mts +19 -4
- package/dist/plugins/blog/api/index.d.ts +19 -4
- package/dist/plugins/blog/api/index.mjs +2 -0
- package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.cjs +6 -5
- package/dist/plugins/blog/query-keys.d.cts +8 -387
- package/dist/plugins/blog/query-keys.d.mts +8 -387
- package/dist/plugins/blog/query-keys.d.ts +8 -387
- package/dist/plugins/blog/query-keys.mjs +6 -5
- package/dist/plugins/client/index.cjs +1 -0
- package/dist/plugins/client/index.d.cts +8 -1
- package/dist/plugins/client/index.d.mts +8 -1
- package/dist/plugins/client/index.d.ts +8 -1
- package/dist/plugins/client/index.mjs +1 -1
- package/dist/plugins/cms/api/index.cjs +6 -0
- package/dist/plugins/cms/api/index.d.cts +7 -219
- package/dist/plugins/cms/api/index.d.mts +7 -219
- package/dist/plugins/cms/api/index.d.ts +7 -219
- package/dist/plugins/cms/api/index.mjs +2 -1
- package/dist/plugins/cms/client/hooks/index.d.cts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.mts +1 -1
- package/dist/plugins/cms/client/hooks/index.d.ts +1 -1
- package/dist/plugins/cms/query-keys.cjs +2 -1
- package/dist/plugins/cms/query-keys.d.cts +5 -9
- package/dist/plugins/cms/query-keys.d.mts +5 -9
- package/dist/plugins/cms/query-keys.d.ts +5 -9
- package/dist/plugins/cms/query-keys.mjs +2 -1
- package/dist/plugins/form-builder/api/index.cjs +6 -0
- package/dist/plugins/form-builder/api/index.d.cts +7 -211
- package/dist/plugins/form-builder/api/index.d.mts +7 -211
- package/dist/plugins/form-builder/api/index.d.ts +7 -211
- package/dist/plugins/form-builder/api/index.mjs +2 -1
- package/dist/plugins/form-builder/client/components/index.d.cts +1 -1
- package/dist/plugins/form-builder/client/components/index.d.mts +1 -1
- package/dist/plugins/form-builder/client/components/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.cjs +3 -2
- package/dist/plugins/form-builder/query-keys.d.cts +6 -6
- package/dist/plugins/form-builder/query-keys.d.mts +6 -6
- package/dist/plugins/form-builder/query-keys.d.ts +6 -6
- package/dist/plugins/form-builder/query-keys.mjs +3 -2
- package/dist/plugins/kanban/api/index.cjs +6 -0
- package/dist/plugins/kanban/api/index.d.cts +17 -392
- package/dist/plugins/kanban/api/index.d.mts +17 -392
- package/dist/plugins/kanban/api/index.d.ts +17 -392
- package/dist/plugins/kanban/api/index.mjs +2 -0
- package/dist/plugins/kanban/client/components/index.d.cts +1 -1
- package/dist/plugins/kanban/client/components/index.d.mts +1 -1
- package/dist/plugins/kanban/client/components/index.d.ts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
- package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
- package/dist/plugins/kanban/client/index.d.cts +1 -1
- package/dist/plugins/kanban/client/index.d.mts +1 -1
- package/dist/plugins/kanban/client/index.d.ts +1 -1
- package/dist/plugins/kanban/query-keys.cjs +2 -9
- package/dist/plugins/kanban/query-keys.d.cts +4 -16
- package/dist/plugins/kanban/query-keys.d.mts +4 -16
- package/dist/plugins/kanban/query-keys.d.ts +4 -16
- package/dist/plugins/kanban/query-keys.mjs +2 -9
- package/dist/plugins/ui-builder/index.d.cts +1 -1
- package/dist/plugins/ui-builder/index.d.mts +1 -1
- package/dist/plugins/ui-builder/index.d.ts +1 -1
- package/dist/shared/stack.B1EeBt1b.d.ts +297 -0
- package/dist/shared/stack.BIXEI6v_.d.mts +419 -0
- package/dist/shared/stack.BKfolAyK.d.ts +419 -0
- package/dist/shared/stack.BpolpQpf.d.cts +445 -0
- package/dist/shared/stack.C5dtIncc.d.mts +293 -0
- package/dist/shared/stack.CIP6QS9l.d.ts +293 -0
- package/dist/shared/stack.CP68pFEH.d.mts +297 -0
- package/dist/shared/{stack.CXjzTMsb.d.mts → stack.CVDTkMoO.d.cts} +7 -1
- package/dist/shared/{stack.CXjzTMsb.d.ts → stack.CVDTkMoO.d.mts} +7 -1
- package/dist/shared/{stack.CXjzTMsb.d.cts → stack.CVDTkMoO.d.ts} +7 -1
- package/dist/shared/{stack.QD1y_7NY.d.mts → stack.DJaKVY7v.d.cts} +1 -1
- package/dist/shared/{stack.QD1y_7NY.d.ts → stack.DJaKVY7v.d.mts} +1 -1
- package/dist/shared/{stack.QD1y_7NY.d.cts → stack.DJaKVY7v.d.ts} +1 -1
- package/dist/shared/{stack.CIrIsc-A.d.mts → stack.DdI5W6MB.d.cts} +7 -1
- package/dist/shared/{stack.CIrIsc-A.d.ts → stack.DdI5W6MB.d.mts} +7 -1
- package/dist/shared/{stack.CIrIsc-A.d.cts → stack.DdI5W6MB.d.ts} +7 -1
- package/dist/shared/stack.Dw0Ly2TM.d.cts +293 -0
- package/dist/shared/stack.IdtKDRka.d.cts +297 -0
- package/dist/shared/stack.TIBF2AOx.d.ts +445 -0
- package/dist/shared/stack.rTy7-wQU.d.mts +445 -0
- package/dist/shared/stack.snB1EDP7.d.cts +419 -0
- package/package.json +3 -3
- package/src/plugins/blog/api/index.ts +2 -0
- package/src/plugins/blog/api/plugin.ts +85 -0
- package/src/plugins/blog/api/query-key-defs.ts +46 -0
- package/src/plugins/blog/api/serializers.ts +27 -0
- package/src/plugins/blog/client/plugin.tsx +19 -0
- package/src/plugins/blog/query-keys.ts +5 -7
- package/src/plugins/client/index.ts +1 -1
- package/src/plugins/cms/api/getters.ts +24 -0
- package/src/plugins/cms/api/index.ts +10 -1
- package/src/plugins/cms/api/plugin.ts +105 -0
- package/src/plugins/cms/api/query-key-defs.ts +53 -0
- package/src/plugins/cms/api/serializers.ts +12 -0
- package/src/plugins/cms/client/plugin.tsx +19 -0
- package/src/plugins/cms/query-keys.ts +2 -1
- package/src/plugins/form-builder/api/getters.ts +23 -0
- package/src/plugins/form-builder/api/index.ts +15 -2
- package/src/plugins/form-builder/api/plugin.ts +91 -0
- package/src/plugins/form-builder/api/query-key-defs.ts +79 -0
- package/src/plugins/form-builder/api/serializers.ts +12 -0
- package/src/plugins/form-builder/client/plugin.tsx +19 -0
- package/src/plugins/form-builder/query-keys.ts +6 -2
- package/src/plugins/kanban/api/index.ts +3 -0
- package/src/plugins/kanban/api/plugin.ts +49 -0
- package/src/plugins/kanban/api/query-key-defs.ts +54 -0
- package/src/plugins/kanban/api/serializers.ts +49 -0
- package/src/plugins/kanban/client/plugin.tsx +13 -0
- package/src/plugins/kanban/query-keys.ts +2 -9
- package/src/plugins/utils.ts +19 -0
- package/dist/shared/{stack.BkYlUT_8.d.cts → stack.CBON0dWL.d.cts} +6 -6
- package/dist/shared/{stack.BkYlUT_8.d.mts → stack.CBON0dWL.d.mts} +6 -6
- package/dist/shared/{stack.BkYlUT_8.d.ts → stack.CBON0dWL.d.ts} +6 -6
|
@@ -24,6 +24,54 @@ import {
|
|
|
24
24
|
updateTaskSchema,
|
|
25
25
|
} from "../schemas";
|
|
26
26
|
import { getAllBoards, getBoardById } from "./getters";
|
|
27
|
+
import { KANBAN_QUERY_KEYS } from "./query-key-defs";
|
|
28
|
+
import { serializeBoard } from "./serializers";
|
|
29
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Route keys for the Kanban plugin — matches the keys returned by
|
|
33
|
+
* `stackClient.router.getRoute(path).routeKey`.
|
|
34
|
+
*/
|
|
35
|
+
export type KanbanRouteKey = "boards" | "newBoard" | "board";
|
|
36
|
+
|
|
37
|
+
interface KanbanPrefetchForRoute {
|
|
38
|
+
(key: "boards" | "newBoard", qc: QueryClient): Promise<void>;
|
|
39
|
+
(key: "board", qc: QueryClient, params: { boardId: string }): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createKanbanPrefetchForRoute(
|
|
43
|
+
adapter: Adapter,
|
|
44
|
+
): KanbanPrefetchForRoute {
|
|
45
|
+
return async function prefetchForRoute(
|
|
46
|
+
key: KanbanRouteKey,
|
|
47
|
+
qc: QueryClient,
|
|
48
|
+
params?: Record<string, string>,
|
|
49
|
+
): Promise<void> {
|
|
50
|
+
switch (key) {
|
|
51
|
+
case "boards": {
|
|
52
|
+
const result = await getAllBoards(adapter, { limit: 50, offset: 0 });
|
|
53
|
+
qc.setQueryData(
|
|
54
|
+
KANBAN_QUERY_KEYS.boardsList({}),
|
|
55
|
+
result.items.map(serializeBoard),
|
|
56
|
+
);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "board": {
|
|
60
|
+
const boardId = params?.boardId ?? "";
|
|
61
|
+
if (boardId) {
|
|
62
|
+
const board = await getBoardById(adapter, boardId);
|
|
63
|
+
qc.setQueryData(
|
|
64
|
+
KANBAN_QUERY_KEYS.boardDetail(boardId),
|
|
65
|
+
board ? serializeBoard(board) : null,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
default:
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
} as KanbanPrefetchForRoute;
|
|
74
|
+
}
|
|
27
75
|
|
|
28
76
|
/**
|
|
29
77
|
* Context passed to kanban API hooks
|
|
@@ -268,6 +316,7 @@ export const kanbanBackendPlugin = (hooks?: KanbanBackendHooks) =>
|
|
|
268
316
|
getAllBoards: (params?: Parameters<typeof getAllBoards>[1]) =>
|
|
269
317
|
getAllBoards(adapter, params),
|
|
270
318
|
getBoardById: (id: string) => getBoardById(adapter, id),
|
|
319
|
+
prefetchForRoute: createKanbanPrefetchForRoute(adapter),
|
|
271
320
|
}),
|
|
272
321
|
|
|
273
322
|
routes: (adapter: Adapter) => {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal query key constants for the Kanban plugin.
|
|
3
|
+
* Shared between query-keys.ts (HTTP path) and prefetchForRoute (DB path)
|
|
4
|
+
* to prevent key drift between SSR loaders and SSG prefetching.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface BoardsListDiscriminator {
|
|
8
|
+
slug: string | undefined;
|
|
9
|
+
ownerId: string | undefined;
|
|
10
|
+
organizationId: string | undefined;
|
|
11
|
+
limit: number;
|
|
12
|
+
offset: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Builds the discriminator object for the boards list query key.
|
|
17
|
+
* Mirrors the inline object used in createBoardsQueries.list.
|
|
18
|
+
*/
|
|
19
|
+
export function boardsListDiscriminator(params?: {
|
|
20
|
+
slug?: string;
|
|
21
|
+
ownerId?: string;
|
|
22
|
+
organizationId?: string;
|
|
23
|
+
limit?: number;
|
|
24
|
+
offset?: number;
|
|
25
|
+
}): BoardsListDiscriminator {
|
|
26
|
+
return {
|
|
27
|
+
slug: params?.slug,
|
|
28
|
+
ownerId: params?.ownerId,
|
|
29
|
+
organizationId: params?.organizationId,
|
|
30
|
+
limit: params?.limit ?? 50,
|
|
31
|
+
offset: params?.offset ?? 0,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Full query key builders — use these with queryClient.setQueryData() */
|
|
36
|
+
export const KANBAN_QUERY_KEYS = {
|
|
37
|
+
/**
|
|
38
|
+
* Key for boards.list(params) query.
|
|
39
|
+
* Full key: ["boards", "list", { slug, ownerId, organizationId, limit, offset }]
|
|
40
|
+
*/
|
|
41
|
+
boardsList: (params?: {
|
|
42
|
+
slug?: string;
|
|
43
|
+
ownerId?: string;
|
|
44
|
+
organizationId?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
}) => ["boards", "list", boardsListDiscriminator(params)] as const,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Key for boards.detail(boardId) query.
|
|
51
|
+
* Full key: ["boards", "detail", boardId]
|
|
52
|
+
*/
|
|
53
|
+
boardDetail: (boardId: string) => ["boards", "detail", boardId] as const,
|
|
54
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Task,
|
|
3
|
+
ColumnWithTasks,
|
|
4
|
+
BoardWithColumns,
|
|
5
|
+
SerializedTask,
|
|
6
|
+
SerializedColumn,
|
|
7
|
+
SerializedBoardWithColumns,
|
|
8
|
+
} from "../types";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serialize a Task for SSR/SSG use (convert dates to strings).
|
|
12
|
+
* Pure function — no DB access, no hooks.
|
|
13
|
+
*/
|
|
14
|
+
export function serializeTask(task: Task): SerializedTask {
|
|
15
|
+
return {
|
|
16
|
+
...task,
|
|
17
|
+
completedAt: task.completedAt?.toISOString(),
|
|
18
|
+
createdAt: task.createdAt.toISOString(),
|
|
19
|
+
updatedAt: task.updatedAt.toISOString(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Serialize a Column (with its tasks) for SSR/SSG use (convert dates to strings).
|
|
25
|
+
* Pure function — no DB access, no hooks.
|
|
26
|
+
*/
|
|
27
|
+
export function serializeColumn(col: ColumnWithTasks): SerializedColumn {
|
|
28
|
+
return {
|
|
29
|
+
...col,
|
|
30
|
+
createdAt: col.createdAt.toISOString(),
|
|
31
|
+
updatedAt: col.updatedAt.toISOString(),
|
|
32
|
+
tasks: col.tasks.map(serializeTask),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Serialize a Board (with columns and tasks) for SSR/SSG use (convert dates to strings).
|
|
38
|
+
* Pure function — no DB access, no hooks.
|
|
39
|
+
*/
|
|
40
|
+
export function serializeBoard(
|
|
41
|
+
board: BoardWithColumns,
|
|
42
|
+
): SerializedBoardWithColumns {
|
|
43
|
+
return {
|
|
44
|
+
...board,
|
|
45
|
+
createdAt: board.createdAt.toISOString(),
|
|
46
|
+
updatedAt: board.updatedAt.toISOString(),
|
|
47
|
+
columns: board.columns.map(serializeColumn),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineClientPlugin,
|
|
3
3
|
createApiClient,
|
|
4
|
+
isConnectionError,
|
|
4
5
|
} from "@btst/stack/plugins/client";
|
|
5
6
|
import { createRoute } from "@btst/yar";
|
|
6
7
|
import type { QueryClient } from "@tanstack/react-query";
|
|
@@ -178,6 +179,12 @@ function createBoardsLoader(config: KanbanClientConfig) {
|
|
|
178
179
|
await hooks.onLoadError(error, context);
|
|
179
180
|
}
|
|
180
181
|
} catch (error) {
|
|
182
|
+
if (isConnectionError(error)) {
|
|
183
|
+
console.warn(
|
|
184
|
+
"[btst/kanban] route.loader() failed — no server running at build time. " +
|
|
185
|
+
"Use myStack.api.kanban.prefetchForRoute() for SSG data prefetching.",
|
|
186
|
+
);
|
|
187
|
+
}
|
|
181
188
|
if (hooks?.onLoadError) {
|
|
182
189
|
await hooks.onLoadError(error as Error, context);
|
|
183
190
|
}
|
|
@@ -241,6 +248,12 @@ function createBoardLoader(boardId: string, config: KanbanClientConfig) {
|
|
|
241
248
|
await hooks.onLoadError(error, context);
|
|
242
249
|
}
|
|
243
250
|
} catch (error) {
|
|
251
|
+
if (isConnectionError(error)) {
|
|
252
|
+
console.warn(
|
|
253
|
+
"[btst/kanban] route.loader() failed — no server running at build time. " +
|
|
254
|
+
"Use myStack.api.kanban.prefetchForRoute() for SSG data prefetching.",
|
|
255
|
+
);
|
|
256
|
+
}
|
|
244
257
|
if (hooks?.onLoadError) {
|
|
245
258
|
await hooks.onLoadError(error as Error, context);
|
|
246
259
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
import type { KanbanApiRouter } from "./api";
|
|
6
6
|
import { createApiClient } from "@btst/stack/plugins/client";
|
|
7
7
|
import type { SerializedBoardWithColumns } from "./types";
|
|
8
|
+
import { boardsListDiscriminator } from "./api/query-key-defs";
|
|
8
9
|
|
|
9
10
|
interface BoardsListParams {
|
|
10
11
|
slug?: string;
|
|
@@ -63,15 +64,7 @@ function createBoardsQueries(
|
|
|
63
64
|
) {
|
|
64
65
|
return createQueryKeys("boards", {
|
|
65
66
|
list: (params?: BoardsListParams) => ({
|
|
66
|
-
queryKey: [
|
|
67
|
-
{
|
|
68
|
-
slug: params?.slug,
|
|
69
|
-
ownerId: params?.ownerId,
|
|
70
|
-
organizationId: params?.organizationId,
|
|
71
|
-
limit: params?.limit ?? 50,
|
|
72
|
-
offset: params?.offset ?? 0,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
67
|
+
queryKey: [boardsListDiscriminator(params)],
|
|
75
68
|
queryFn: async () => {
|
|
76
69
|
try {
|
|
77
70
|
const response = await client("/boards", {
|
package/src/plugins/utils.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { createClient } from "better-call/client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns true when a fetch error is a connection-refused / no-server error.
|
|
5
|
+
* Used in SSR loaders to emit an actionable build-time warning when
|
|
6
|
+
* `route.loader()` is called during `next build` with no HTTP server running.
|
|
7
|
+
*/
|
|
8
|
+
export function isConnectionError(err: unknown): boolean {
|
|
9
|
+
if (!(err instanceof Error)) return false;
|
|
10
|
+
const code =
|
|
11
|
+
(err as unknown as { cause?: { code?: string } }).cause?.code ??
|
|
12
|
+
(err as unknown as { code?: string }).code;
|
|
13
|
+
return (
|
|
14
|
+
err.message.includes("ECONNREFUSED") ||
|
|
15
|
+
err.message.includes("fetch failed") ||
|
|
16
|
+
err.message.includes("ERR_CONNECTION_REFUSED") ||
|
|
17
|
+
code === "ECONNREFUSED" ||
|
|
18
|
+
code === "ERR_CONNECTION_REFUSED"
|
|
19
|
+
);
|
|
20
|
+
}
|
|
2
21
|
import type { Router, Endpoint } from "better-call";
|
|
3
22
|
|
|
4
23
|
interface CreateApiClientOptions {
|
|
@@ -35,12 +35,6 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
40
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
44
38
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
45
39
|
name: z.ZodString;
|
|
46
40
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -48,9 +42,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
48
42
|
name: z.ZodString;
|
|
49
43
|
slug: z.ZodString;
|
|
50
44
|
}, z.core.$strip>]>>>>;
|
|
45
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
46
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
47
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
48
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
49
|
+
title: z.ZodString;
|
|
51
50
|
content: z.ZodString;
|
|
52
51
|
excerpt: z.ZodString;
|
|
53
52
|
image: z.ZodOptional<z.ZodString>;
|
|
53
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
declare const updatePostSchema: z.ZodObject<{
|
|
56
56
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
@@ -35,12 +35,6 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
40
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
44
38
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
45
39
|
name: z.ZodString;
|
|
46
40
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -48,9 +42,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
48
42
|
name: z.ZodString;
|
|
49
43
|
slug: z.ZodString;
|
|
50
44
|
}, z.core.$strip>]>>>>;
|
|
45
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
46
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
47
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
48
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
49
|
+
title: z.ZodString;
|
|
51
50
|
content: z.ZodString;
|
|
52
51
|
excerpt: z.ZodString;
|
|
53
52
|
image: z.ZodOptional<z.ZodString>;
|
|
53
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
declare const updatePostSchema: z.ZodObject<{
|
|
56
56
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
@@ -35,12 +35,6 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
|
-
slug: z.ZodOptional<z.ZodString>;
|
|
40
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
|
-
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
-
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
44
38
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
45
39
|
name: z.ZodString;
|
|
46
40
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -48,9 +42,15 @@ declare const createPostSchema: z.ZodObject<{
|
|
|
48
42
|
name: z.ZodString;
|
|
49
43
|
slug: z.ZodString;
|
|
50
44
|
}, z.core.$strip>]>>>>;
|
|
45
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
46
|
+
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
47
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
48
|
+
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
49
|
+
title: z.ZodString;
|
|
51
50
|
content: z.ZodString;
|
|
52
51
|
excerpt: z.ZodString;
|
|
53
52
|
image: z.ZodOptional<z.ZodString>;
|
|
53
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
declare const updatePostSchema: z.ZodObject<{
|
|
56
56
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|