@btst/stack 3.0.0-rc.1 → 3.0.0-rc.2

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.
Files changed (87) hide show
  1. package/README.md +4 -8
  2. package/dist/next/index.d.cts +13 -7
  3. package/dist/next/index.d.mts +13 -7
  4. package/dist/next/index.d.ts +13 -7
  5. package/dist/packages/stack/src/next/page.cjs +8 -6
  6. package/dist/packages/stack/src/next/page.mjs +8 -6
  7. package/dist/packages/stack/src/plugins/comments/client/components/comment-thread.cjs +1 -1
  8. package/dist/packages/stack/src/plugins/comments/client/components/comment-thread.mjs +1 -1
  9. package/dist/packages/stack/src/react-router/page.cjs +17 -11
  10. package/dist/packages/stack/src/react-router/page.mjs +17 -11
  11. package/dist/packages/stack/src/tanstack/page.cjs +5 -3
  12. package/dist/packages/stack/src/tanstack/page.mjs +5 -3
  13. package/dist/plugins/blog/api/index.d.cts +2 -2
  14. package/dist/plugins/blog/api/index.d.mts +2 -2
  15. package/dist/plugins/blog/api/index.d.ts +2 -2
  16. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  17. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  18. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  19. package/dist/plugins/blog/client/index.d.cts +2 -2
  20. package/dist/plugins/blog/client/index.d.mts +2 -2
  21. package/dist/plugins/blog/client/index.d.ts +2 -2
  22. package/dist/plugins/blog/query-keys.d.cts +2 -2
  23. package/dist/plugins/blog/query-keys.d.mts +2 -2
  24. package/dist/plugins/blog/query-keys.d.ts +2 -2
  25. package/dist/plugins/cms/api/index.d.cts +1 -1
  26. package/dist/plugins/cms/api/index.d.mts +1 -1
  27. package/dist/plugins/cms/api/index.d.ts +1 -1
  28. package/dist/plugins/cms/query-keys.d.cts +1 -1
  29. package/dist/plugins/cms/query-keys.d.mts +1 -1
  30. package/dist/plugins/cms/query-keys.d.ts +1 -1
  31. package/dist/plugins/comments/client/components/index.d.cts +5 -0
  32. package/dist/plugins/comments/client/components/index.d.mts +5 -0
  33. package/dist/plugins/comments/client/components/index.d.ts +5 -0
  34. package/dist/plugins/kanban/api/index.d.cts +1 -1
  35. package/dist/plugins/kanban/api/index.d.mts +1 -1
  36. package/dist/plugins/kanban/api/index.d.ts +1 -1
  37. package/dist/plugins/kanban/client/hooks/index.d.cts +1 -1
  38. package/dist/plugins/kanban/client/hooks/index.d.mts +1 -1
  39. package/dist/plugins/kanban/client/hooks/index.d.ts +1 -1
  40. package/dist/plugins/kanban/query-keys.d.cts +1 -1
  41. package/dist/plugins/kanban/query-keys.d.mts +1 -1
  42. package/dist/plugins/kanban/query-keys.d.ts +1 -1
  43. package/dist/plugins/ui-builder/client/hooks/index.d.cts +1 -1
  44. package/dist/plugins/ui-builder/client/hooks/index.d.mts +1 -1
  45. package/dist/plugins/ui-builder/client/hooks/index.d.ts +1 -1
  46. package/dist/plugins/ui-builder/client/index.d.cts +1 -1
  47. package/dist/plugins/ui-builder/client/index.d.mts +1 -1
  48. package/dist/plugins/ui-builder/client/index.d.ts +1 -1
  49. package/dist/plugins/ui-builder/query-keys.d.cts +1 -1
  50. package/dist/plugins/ui-builder/query-keys.d.mts +1 -1
  51. package/dist/plugins/ui-builder/query-keys.d.ts +1 -1
  52. package/dist/react-router/index.d.cts +14 -4
  53. package/dist/react-router/index.d.mts +14 -4
  54. package/dist/react-router/index.d.ts +14 -4
  55. package/dist/shared/{stack.H5B8miAV.d.cts → stack.CKGjOI3Z.d.cts} +11 -11
  56. package/dist/shared/{stack.80-y2TTR.d.mts → stack.DZHEHd-S.d.mts} +11 -11
  57. package/dist/shared/{stack.CRelKJfH.d.ts → stack.DseBJmGF.d.ts} +4 -4
  58. package/dist/shared/{stack.INBa9-TO.d.cts → stack.DzwZw-Ck.d.cts} +4 -4
  59. package/dist/shared/{stack.DrUBX-QE.d.mts → stack.EOPVnJrF.d.cts} +6 -1
  60. package/dist/shared/{stack.DrUBX-QE.d.ts → stack.EOPVnJrF.d.mts} +6 -1
  61. package/dist/shared/{stack.DrUBX-QE.d.cts → stack.EOPVnJrF.d.ts} +6 -1
  62. package/dist/shared/{stack.Bk5UB_BT.d.ts → stack.WELCDuMs.d.ts} +11 -11
  63. package/dist/shared/{stack.3di7vQs6.d.mts → stack.oVIdV7XS.d.mts} +4 -4
  64. package/dist/tanstack/index.d.cts +20 -12
  65. package/dist/tanstack/index.d.mts +20 -12
  66. package/dist/tanstack/index.d.ts +20 -12
  67. package/package.json +6 -6
  68. package/src/__tests__/entry-factories.test.tsx +104 -4
  69. package/src/__tests__/package-metadata.test.ts +21 -0
  70. package/src/next/index.tsx +2 -0
  71. package/src/next/page.tsx +17 -9
  72. package/src/plugins/comments/__tests__/client-sweep.test.tsx +23 -0
  73. package/src/plugins/comments/client/components/comment-thread.tsx +6 -2
  74. package/src/react-router/index.tsx +1 -0
  75. package/src/react-router/page.tsx +34 -12
  76. package/src/shared/entry-factories.ts +9 -0
  77. package/src/tanstack/index.tsx +2 -0
  78. package/src/tanstack/page.tsx +28 -11
  79. package/dist/shared/{stack.BvxHSZYT.d.cts → stack.BsmDN8r9.d.cts} +3 -3
  80. package/dist/shared/{stack.eq5eg1yt.d.cts → stack.CuI_-z-_.d.cts} +22 -22
  81. package/dist/shared/{stack.B0muOwUF.d.mts → stack.D18Dq3ve.d.cts} +7 -7
  82. package/dist/shared/{stack.B0muOwUF.d.ts → stack.D18Dq3ve.d.mts} +7 -7
  83. package/dist/shared/{stack.B0muOwUF.d.cts → stack.D18Dq3ve.d.ts} +7 -7
  84. package/dist/shared/{stack.Dj04W2c3.d.mts → stack.D2RVkQD8.d.mts} +22 -22
  85. package/dist/shared/{stack.B-hEIoUw.d.ts → stack.DOzsgzkY.d.ts} +3 -3
  86. package/dist/shared/{stack.CMbX8Q5C.d.ts → stack.DXrOtuek.d.ts} +22 -22
  87. package/dist/shared/{stack.f8Vke-eH.d.mts → stack.NGKtwA6S.d.mts} +3 -3
@@ -30,6 +30,11 @@ interface CommentThreadProps {
30
30
  className?: string;
31
31
  /** Localization strings — defaults to English */
32
32
  localization?: Partial<CommentsLocalization>;
33
+ /**
34
+ * Sign-in URL for unauthenticated users in this thread.
35
+ * Overrides the `loginPath` from the nearest `StackProvider`.
36
+ */
37
+ loginHref?: string;
33
38
  /**
34
39
  * Number of top-level comments to load per page.
35
40
  * Clicking "Load more" fetches the next page. Default: 10.
@@ -1,4 +1,4 @@
1
- export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.eq5eg1yt.cjs';
1
+ export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.CuI_-z-_.cjs';
2
2
  import { B as BoardWithColumns, S as SerializedBoardWithColumns, C as ColumnWithTasks, a as SerializedColumn, T as Task, b as SerializedTask } from '../../../shared/stack.DJaKVY7v.cjs';
3
3
  import '@btst/stack/plugins/api';
4
4
  import '@btst/db';
@@ -1,4 +1,4 @@
1
- export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.Dj04W2c3.mjs';
1
+ export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.D2RVkQD8.mjs';
2
2
  import { B as BoardWithColumns, S as SerializedBoardWithColumns, C as ColumnWithTasks, a as SerializedColumn, T as Task, b as SerializedTask } from '../../../shared/stack.DJaKVY7v.mjs';
3
3
  import '@btst/stack/plugins/api';
4
4
  import '@btst/db';
@@ -1,4 +1,4 @@
1
- export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.CMbX8Q5C.js';
1
+ export { B as BoardListResult, C as CreateKanbanTaskInput, i as KANBAN_QUERY_KEYS, b as KanbanApiContext, K as KanbanApiRouter, c as KanbanBackendHooks, a as KanbanRouteKey, e as createKanbanTask, f as findOrCreateKanbanBoard, g as getAllBoards, d as getBoardById, h as getKanbanColumnsByBoardId, k as kanbanBackendPlugin } from '../../../shared/stack.DXrOtuek.js';
2
2
  import { B as BoardWithColumns, S as SerializedBoardWithColumns, C as ColumnWithTasks, a as SerializedColumn, T as Task, b as SerializedTask } from '../../../shared/stack.DJaKVY7v.js';
3
3
  import '@btst/stack/plugins/api';
4
4
  import '@btst/db';
@@ -4,7 +4,7 @@ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedC
4
4
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
5
5
  import { a as KanbanUser } from '../../../../shared/stack.Dlgtumru.cjs';
6
6
  import '@btst/stack/plugins/client';
7
- import '../../../../shared/stack.eq5eg1yt.cjs';
7
+ import '../../../../shared/stack.CuI_-z-_.cjs';
8
8
  import '@btst/stack/plugins/api';
9
9
  import '@btst/db';
10
10
  import 'zod';
@@ -4,7 +4,7 @@ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedC
4
4
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
5
5
  import { a as KanbanUser } from '../../../../shared/stack.Cp_6mO5s.mjs';
6
6
  import '@btst/stack/plugins/client';
7
- import '../../../../shared/stack.Dj04W2c3.mjs';
7
+ import '../../../../shared/stack.D2RVkQD8.mjs';
8
8
  import '@btst/stack/plugins/api';
9
9
  import '@btst/db';
10
10
  import 'zod';
@@ -4,7 +4,7 @@ import { S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedC
4
4
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
5
5
  import { a as KanbanUser } from '../../../../shared/stack.B9NtGpAR.js';
6
6
  import '@btst/stack/plugins/client';
7
- import '../../../../shared/stack.CMbX8Q5C.js';
7
+ import '../../../../shared/stack.DXrOtuek.js';
8
8
  import '@btst/stack/plugins/api';
9
9
  import '@btst/db';
10
10
  import 'zod';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.eq5eg1yt.cjs';
3
+ import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.CuI_-z-_.cjs';
4
4
  import { P as Priority, S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask } from '../../shared/stack.DJaKVY7v.cjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.Dj04W2c3.mjs';
3
+ import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.D2RVkQD8.mjs';
4
4
  import { P as Priority, S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask } from '../../shared/stack.DJaKVY7v.mjs';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.CMbX8Q5C.js';
3
+ import { j as BoardsListDiscriminator, K as KanbanApiRouter } from '../../shared/stack.DXrOtuek.js';
4
4
  import { P as Priority, S as SerializedBoardWithColumns, c as SerializedBoard, a as SerializedColumn, b as SerializedTask } from '../../shared/stack.DJaKVY7v.js';
5
5
  import '@btst/stack/plugins/api';
6
6
  import '@btst/db';
@@ -9,7 +9,7 @@ import '../../../../shared/stack.CPsYC2-Z.cjs';
9
9
  import 'react-hook-form';
10
10
  import 'react/jsx-runtime';
11
11
  import '@btst/stack/plugins/client';
12
- import '../../../../shared/stack.BvxHSZYT.cjs';
12
+ import '../../../../shared/stack.BsmDN8r9.cjs';
13
13
  import '@btst/stack/plugins/api';
14
14
  import '../../../../shared/stack.aXdBOJAR.cjs';
15
15
  import 'better-call';
@@ -9,7 +9,7 @@ import '../../../../shared/stack.CPsYC2-Z.mjs';
9
9
  import 'react-hook-form';
10
10
  import 'react/jsx-runtime';
11
11
  import '@btst/stack/plugins/client';
12
- import '../../../../shared/stack.f8Vke-eH.mjs';
12
+ import '../../../../shared/stack.NGKtwA6S.mjs';
13
13
  import '@btst/stack/plugins/api';
14
14
  import '../../../../shared/stack.aXdBOJAR.mjs';
15
15
  import 'better-call';
@@ -9,7 +9,7 @@ import '../../../../shared/stack.CPsYC2-Z.js';
9
9
  import 'react-hook-form';
10
10
  import 'react/jsx-runtime';
11
11
  import '@btst/stack/plugins/client';
12
- import '../../../../shared/stack.B-hEIoUw.js';
12
+ import '../../../../shared/stack.DOzsgzkY.js';
13
13
  import '@btst/stack/plugins/api';
14
14
  import '../../../../shared/stack.aXdBOJAR.js';
15
15
  import 'better-call';
@@ -15,7 +15,7 @@ import 'zod';
15
15
  import '../../../shared/stack.aXdBOJAR.cjs';
16
16
  import 'react-hook-form';
17
17
  import '@btst/stack/plugins/client/hooks';
18
- import '../../../shared/stack.BvxHSZYT.cjs';
18
+ import '../../../shared/stack.BsmDN8r9.cjs';
19
19
  import '@btst/stack/plugins/api';
20
20
  import 'better-call';
21
21
  import '@btst/db';
@@ -15,7 +15,7 @@ import 'zod';
15
15
  import '../../../shared/stack.aXdBOJAR.mjs';
16
16
  import 'react-hook-form';
17
17
  import '@btst/stack/plugins/client/hooks';
18
- import '../../../shared/stack.f8Vke-eH.mjs';
18
+ import '../../../shared/stack.NGKtwA6S.mjs';
19
19
  import '@btst/stack/plugins/api';
20
20
  import 'better-call';
21
21
  import '@btst/db';
@@ -15,7 +15,7 @@ import 'zod';
15
15
  import '../../../shared/stack.aXdBOJAR.js';
16
16
  import 'react-hook-form';
17
17
  import '@btst/stack/plugins/client/hooks';
18
- import '../../../shared/stack.B-hEIoUw.js';
18
+ import '../../../shared/stack.DOzsgzkY.js';
19
19
  import '@btst/stack/plugins/api';
20
20
  import 'better-call';
21
21
  import '@btst/db';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.BvxHSZYT.cjs';
3
+ import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.BsmDN8r9.cjs';
4
4
  import { C as ComponentLayer, V as Variable } from '../../shared/stack.B2xi4jj7.cjs';
5
5
  import { P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.aXdBOJAR.cjs';
6
6
  import { UIBuilderPageSchemaType, PaginatedUIBuilderPages, SerializedUIBuilderPage } from './index.cjs';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.f8Vke-eH.mjs';
3
+ import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.NGKtwA6S.mjs';
4
4
  import { C as ComponentLayer, V as Variable } from '../../shared/stack.DycBcTeg.mjs';
5
5
  import { P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.aXdBOJAR.mjs';
6
6
  import { UIBuilderPageSchemaType, PaginatedUIBuilderPages, SerializedUIBuilderPage } from './index.mjs';
@@ -1,6 +1,6 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
- import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.B-hEIoUw.js';
3
+ import { C as ContentListDiscriminator, a as CMSApiRouter } from '../../shared/stack.DOzsgzkY.js';
4
4
  import { C as ComponentLayer, V as Variable } from '../../shared/stack.7b3vsM8_.js';
5
5
  import { P as PaginatedContentItems, a as SerializedContentItemWithType } from '../../shared/stack.aXdBOJAR.js';
6
6
  import { UIBuilderPageSchemaType, PaginatedUIBuilderPages, SerializedUIBuilderPage } from './index.js';
@@ -1,4 +1,4 @@
1
- import { S as StackRequestHandler, G as GetStackClient } from '../shared/stack.DrUBX-QE.cjs';
1
+ import { S as StackRequestHandler, G as GetStackClient, R as ResolveStackClient } from '../shared/stack.EOPVnJrF.cjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, DehydrateOptions } from '@tanstack/react-query';
@@ -38,10 +38,15 @@ declare function toReactRouterHandlers(handler: StackRequestHandler): {
38
38
  * are not available inside the library, so the factory types the subset it
39
39
  * uses; the results remain assignable to the generated route exports.
40
40
  */
41
- interface ReactRouterPageLoaderArgs {
41
+ interface ReactRouterPageLoaderArgs<TContext = unknown> {
42
+ /** The request that triggered the route loader. */
43
+ request: Request;
44
+ /** Parameters for the React Router catch-all route. */
42
45
  params: {
43
46
  "*"?: string;
44
47
  } & Record<string, string | undefined>;
48
+ /** Request-local values supplied by React Router middleware. */
49
+ context: TContext;
45
50
  }
46
51
  interface CreateReactRouterPageOptions {
47
52
  /** Returns the stack client for a given QueryClient (`lib/stack-client`). */
@@ -85,7 +90,12 @@ interface CreateReactRouterPageOptions {
85
90
  * ```
86
91
  */
87
92
  declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
88
- loader: ({ params }: ReactRouterPageLoaderArgs) => Promise<{
93
+ loader: (loaderArgs: ReactRouterPageLoaderArgs<unknown>) => Promise<{
94
+ path: string;
95
+ dehydratedState: _tanstack_react_query.DehydratedState;
96
+ meta: any;
97
+ }>;
98
+ createLoader: <TContext = unknown>(getLoaderStackClient?: ResolveStackClient<ReactRouterPageLoaderArgs<TContext>>) => (loaderArgs: ReactRouterPageLoaderArgs<TContext>) => Promise<{
89
99
  path: string;
90
100
  dehydratedState: _tanstack_react_query.DehydratedState;
91
101
  meta: any;
@@ -118,5 +128,5 @@ declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
118
128
  */
119
129
  declare function reactRouter(): StackRouterConfig;
120
130
 
121
- export { GetStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
131
+ export { GetStackClient, ResolveStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
122
132
  export type { CreateReactRouterPageOptions, ReactRouterPageLoaderArgs };
@@ -1,4 +1,4 @@
1
- import { S as StackRequestHandler, G as GetStackClient } from '../shared/stack.DrUBX-QE.mjs';
1
+ import { S as StackRequestHandler, G as GetStackClient, R as ResolveStackClient } from '../shared/stack.EOPVnJrF.mjs';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, DehydrateOptions } from '@tanstack/react-query';
@@ -38,10 +38,15 @@ declare function toReactRouterHandlers(handler: StackRequestHandler): {
38
38
  * are not available inside the library, so the factory types the subset it
39
39
  * uses; the results remain assignable to the generated route exports.
40
40
  */
41
- interface ReactRouterPageLoaderArgs {
41
+ interface ReactRouterPageLoaderArgs<TContext = unknown> {
42
+ /** The request that triggered the route loader. */
43
+ request: Request;
44
+ /** Parameters for the React Router catch-all route. */
42
45
  params: {
43
46
  "*"?: string;
44
47
  } & Record<string, string | undefined>;
48
+ /** Request-local values supplied by React Router middleware. */
49
+ context: TContext;
45
50
  }
46
51
  interface CreateReactRouterPageOptions {
47
52
  /** Returns the stack client for a given QueryClient (`lib/stack-client`). */
@@ -85,7 +90,12 @@ interface CreateReactRouterPageOptions {
85
90
  * ```
86
91
  */
87
92
  declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
88
- loader: ({ params }: ReactRouterPageLoaderArgs) => Promise<{
93
+ loader: (loaderArgs: ReactRouterPageLoaderArgs<unknown>) => Promise<{
94
+ path: string;
95
+ dehydratedState: _tanstack_react_query.DehydratedState;
96
+ meta: any;
97
+ }>;
98
+ createLoader: <TContext = unknown>(getLoaderStackClient?: ResolveStackClient<ReactRouterPageLoaderArgs<TContext>>) => (loaderArgs: ReactRouterPageLoaderArgs<TContext>) => Promise<{
89
99
  path: string;
90
100
  dehydratedState: _tanstack_react_query.DehydratedState;
91
101
  meta: any;
@@ -118,5 +128,5 @@ declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
118
128
  */
119
129
  declare function reactRouter(): StackRouterConfig;
120
130
 
121
- export { GetStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
131
+ export { GetStackClient, ResolveStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
122
132
  export type { CreateReactRouterPageOptions, ReactRouterPageLoaderArgs };
@@ -1,4 +1,4 @@
1
- import { S as StackRequestHandler, G as GetStackClient } from '../shared/stack.DrUBX-QE.js';
1
+ import { S as StackRequestHandler, G as GetStackClient, R as ResolveStackClient } from '../shared/stack.EOPVnJrF.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { QueryClient, DehydrateOptions } from '@tanstack/react-query';
@@ -38,10 +38,15 @@ declare function toReactRouterHandlers(handler: StackRequestHandler): {
38
38
  * are not available inside the library, so the factory types the subset it
39
39
  * uses; the results remain assignable to the generated route exports.
40
40
  */
41
- interface ReactRouterPageLoaderArgs {
41
+ interface ReactRouterPageLoaderArgs<TContext = unknown> {
42
+ /** The request that triggered the route loader. */
43
+ request: Request;
44
+ /** Parameters for the React Router catch-all route. */
42
45
  params: {
43
46
  "*"?: string;
44
47
  } & Record<string, string | undefined>;
48
+ /** Request-local values supplied by React Router middleware. */
49
+ context: TContext;
45
50
  }
46
51
  interface CreateReactRouterPageOptions {
47
52
  /** Returns the stack client for a given QueryClient (`lib/stack-client`). */
@@ -85,7 +90,12 @@ interface CreateReactRouterPageOptions {
85
90
  * ```
86
91
  */
87
92
  declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
88
- loader: ({ params }: ReactRouterPageLoaderArgs) => Promise<{
93
+ loader: (loaderArgs: ReactRouterPageLoaderArgs<unknown>) => Promise<{
94
+ path: string;
95
+ dehydratedState: _tanstack_react_query.DehydratedState;
96
+ meta: any;
97
+ }>;
98
+ createLoader: <TContext = unknown>(getLoaderStackClient?: ResolveStackClient<ReactRouterPageLoaderArgs<TContext>>) => (loaderArgs: ReactRouterPageLoaderArgs<TContext>) => Promise<{
89
99
  path: string;
90
100
  dehydratedState: _tanstack_react_query.DehydratedState;
91
101
  meta: any;
@@ -118,5 +128,5 @@ declare function createReactRouterPage(options: CreateReactRouterPageOptions): {
118
128
  */
119
129
  declare function reactRouter(): StackRouterConfig;
120
130
 
121
- export { GetStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
131
+ export { GetStackClient, ResolveStackClient, StackRequestHandler, createReactRouterPage, reactRouter, toReactRouterHandlers };
122
132
  export type { CreateReactRouterPageOptions, ReactRouterPageLoaderArgs };
@@ -1,7 +1,7 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
3
  import { z } from 'zod';
4
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.cjs';
4
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.cjs';
5
5
  import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.cjs';
6
6
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
7
7
  import { DBAdapter } from '@btst/db';
@@ -317,12 +317,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
317
317
  title: string;
318
318
  content: string;
319
319
  excerpt: string;
320
- slug?: string | undefined;
321
- publishedAt?: unknown;
322
- createdAt?: unknown;
323
- updatedAt?: unknown;
324
- image?: string | undefined;
325
- published?: boolean | undefined;
326
320
  tags?: ({
327
321
  name: string;
328
322
  } | {
@@ -330,16 +324,16 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
330
324
  name: string;
331
325
  slug: string;
332
326
  })[] | undefined;
333
- }, {
334
- title: string;
335
- content: string;
336
- excerpt: string;
337
327
  slug?: string | undefined;
338
328
  publishedAt?: unknown;
339
329
  createdAt?: unknown;
340
330
  updatedAt?: unknown;
341
331
  image?: string | undefined;
342
332
  published?: boolean | undefined;
333
+ }, {
334
+ title: string;
335
+ content: string;
336
+ excerpt: string;
343
337
  tags?: ({
344
338
  name: string;
345
339
  } | {
@@ -347,6 +341,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
347
341
  name: string;
348
342
  slug: string;
349
343
  })[] | undefined;
344
+ slug?: string | undefined;
345
+ publishedAt?: unknown;
346
+ createdAt?: unknown;
347
+ updatedAt?: unknown;
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 _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
3
  import { z } from 'zod';
4
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.mjs';
4
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.mjs';
5
5
  import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.mjs';
6
6
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
7
7
  import { DBAdapter } from '@btst/db';
@@ -317,12 +317,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
317
317
  title: string;
318
318
  content: string;
319
319
  excerpt: string;
320
- slug?: string | undefined;
321
- publishedAt?: unknown;
322
- createdAt?: unknown;
323
- updatedAt?: unknown;
324
- image?: string | undefined;
325
- published?: boolean | undefined;
326
320
  tags?: ({
327
321
  name: string;
328
322
  } | {
@@ -330,16 +324,16 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
330
324
  name: string;
331
325
  slug: string;
332
326
  })[] | undefined;
333
- }, {
334
- title: string;
335
- content: string;
336
- excerpt: string;
337
327
  slug?: string | undefined;
338
328
  publishedAt?: unknown;
339
329
  createdAt?: unknown;
340
330
  updatedAt?: unknown;
341
331
  image?: string | undefined;
342
332
  published?: boolean | undefined;
333
+ }, {
334
+ title: string;
335
+ content: string;
336
+ excerpt: string;
343
337
  tags?: ({
344
338
  name: string;
345
339
  } | {
@@ -347,6 +341,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
347
341
  name: string;
348
342
  slug: string;
349
343
  })[] | undefined;
344
+ slug?: string | undefined;
345
+ publishedAt?: unknown;
346
+ createdAt?: unknown;
347
+ updatedAt?: unknown;
348
+ image?: string | undefined;
349
+ published?: boolean | undefined;
350
350
  }>;
351
351
  }, Post>;
352
352
  readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
@@ -2,7 +2,7 @@ import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
4
4
  import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.js';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.js';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.js';
6
6
 
7
7
  /**
8
8
  * Options for the usePosts hook
@@ -137,9 +137,6 @@ declare function usePostForm<TValues>(config: ResourceFormConfig<TValues, Serial
137
137
  /** Create a new post */
138
138
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
139
139
  title: string;
140
- content: string;
141
- excerpt: string;
142
- published: boolean;
143
140
  tags: ({
144
141
  name: string;
145
142
  } | {
@@ -147,6 +144,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
147
144
  name: string;
148
145
  slug: string;
149
146
  })[];
147
+ content: string;
148
+ excerpt: string;
149
+ published: boolean;
150
150
  slug?: string | undefined;
151
151
  publishedAt?: Date | undefined;
152
152
  createdAt?: Date | undefined;
@@ -2,7 +2,7 @@ import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
4
4
  import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.cjs';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.cjs';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.cjs';
6
6
 
7
7
  /**
8
8
  * Options for the usePosts hook
@@ -137,9 +137,6 @@ declare function usePostForm<TValues>(config: ResourceFormConfig<TValues, Serial
137
137
  /** Create a new post */
138
138
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
139
139
  title: string;
140
- content: string;
141
- excerpt: string;
142
- published: boolean;
143
140
  tags: ({
144
141
  name: string;
145
142
  } | {
@@ -147,6 +144,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
147
144
  name: string;
148
145
  slug: string;
149
146
  })[];
147
+ content: string;
148
+ excerpt: string;
149
+ published: boolean;
150
150
  slug?: string | undefined;
151
151
  publishedAt?: Date | undefined;
152
152
  createdAt?: Date | undefined;
@@ -25,10 +25,15 @@ interface StackClientLike {
25
25
  * QueryClient (per-request on the server, singleton on the client).
26
26
  */
27
27
  type GetStackClient = (queryClient: QueryClient) => StackClientLike;
28
+ /**
29
+ * Consumer-provided resolver for lifecycle phases that can await request-aware
30
+ * stack client creation.
31
+ */
32
+ type ResolveStackClient<TContext> = (queryClient: QueryClient, context: TContext) => StackClientLike | PromiseLike<StackClientLike>;
28
33
  /**
29
34
  * A framework-agnostic BTST API handler, as returned by
30
35
  * `createBackendHandler(...).handler`.
31
36
  */
32
37
  type StackRequestHandler = (request: Request) => Response | Promise<Response>;
33
38
 
34
- export type { GetStackClient as G, StackRequestHandler as S };
39
+ export type { GetStackClient as G, ResolveStackClient as R, StackRequestHandler as S };
@@ -25,10 +25,15 @@ interface StackClientLike {
25
25
  * QueryClient (per-request on the server, singleton on the client).
26
26
  */
27
27
  type GetStackClient = (queryClient: QueryClient) => StackClientLike;
28
+ /**
29
+ * Consumer-provided resolver for lifecycle phases that can await request-aware
30
+ * stack client creation.
31
+ */
32
+ type ResolveStackClient<TContext> = (queryClient: QueryClient, context: TContext) => StackClientLike | PromiseLike<StackClientLike>;
28
33
  /**
29
34
  * A framework-agnostic BTST API handler, as returned by
30
35
  * `createBackendHandler(...).handler`.
31
36
  */
32
37
  type StackRequestHandler = (request: Request) => Response | Promise<Response>;
33
38
 
34
- export type { GetStackClient as G, StackRequestHandler as S };
39
+ export type { GetStackClient as G, ResolveStackClient as R, StackRequestHandler as S };
@@ -25,10 +25,15 @@ interface StackClientLike {
25
25
  * QueryClient (per-request on the server, singleton on the client).
26
26
  */
27
27
  type GetStackClient = (queryClient: QueryClient) => StackClientLike;
28
+ /**
29
+ * Consumer-provided resolver for lifecycle phases that can await request-aware
30
+ * stack client creation.
31
+ */
32
+ type ResolveStackClient<TContext> = (queryClient: QueryClient, context: TContext) => StackClientLike | PromiseLike<StackClientLike>;
28
33
  /**
29
34
  * A framework-agnostic BTST API handler, as returned by
30
35
  * `createBackendHandler(...).handler`.
31
36
  */
32
37
  type StackRequestHandler = (request: Request) => Response | Promise<Response>;
33
38
 
34
- export type { GetStackClient as G, StackRequestHandler as S };
39
+ export type { GetStackClient as G, ResolveStackClient as R, StackRequestHandler as S };
@@ -1,7 +1,7 @@
1
1
  import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
2
2
  import { createApiClient } from '@btst/stack/plugins/client';
3
3
  import { z } from 'zod';
4
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.js';
4
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.js';
5
5
  import { P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.js';
6
6
  import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
7
7
  import { DBAdapter } from '@btst/db';
@@ -317,12 +317,6 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
317
317
  title: string;
318
318
  content: string;
319
319
  excerpt: string;
320
- slug?: string | undefined;
321
- publishedAt?: unknown;
322
- createdAt?: unknown;
323
- updatedAt?: unknown;
324
- image?: string | undefined;
325
- published?: boolean | undefined;
326
320
  tags?: ({
327
321
  name: string;
328
322
  } | {
@@ -330,16 +324,16 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
330
324
  name: string;
331
325
  slug: string;
332
326
  })[] | undefined;
333
- }, {
334
- title: string;
335
- content: string;
336
- excerpt: string;
337
327
  slug?: string | undefined;
338
328
  publishedAt?: unknown;
339
329
  createdAt?: unknown;
340
330
  updatedAt?: unknown;
341
331
  image?: string | undefined;
342
332
  published?: boolean | undefined;
333
+ }, {
334
+ title: string;
335
+ content: string;
336
+ excerpt: string;
343
337
  tags?: ({
344
338
  name: string;
345
339
  } | {
@@ -347,6 +341,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
347
341
  name: string;
348
342
  slug: string;
349
343
  })[] | undefined;
344
+ slug?: string | undefined;
345
+ publishedAt?: unknown;
346
+ createdAt?: unknown;
347
+ updatedAt?: unknown;
348
+ image?: string | undefined;
349
+ published?: boolean | undefined;
350
350
  }>;
351
351
  }, Post>;
352
352
  readonly updatePost: better_call.StrictEndpoint<"/posts/:id", {} & {
@@ -2,7 +2,7 @@ import * as _tanstack_react_query from '@tanstack/react-query';
2
2
  import { z } from 'zod';
3
3
  import { ResourceFormConfig, ResourceFormResult } from '@btst/stack/plugins/client/hooks';
4
4
  import { S as SerializedPost, a as SerializedTag } from './stack.Dsatjh0B.mjs';
5
- import { c as createPostSchema, u as updatePostSchema } from './stack.B0muOwUF.mjs';
5
+ import { c as createPostSchema, u as updatePostSchema } from './stack.D18Dq3ve.mjs';
6
6
 
7
7
  /**
8
8
  * Options for the usePosts hook
@@ -137,9 +137,6 @@ declare function usePostForm<TValues>(config: ResourceFormConfig<TValues, Serial
137
137
  /** Create a new post */
138
138
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
139
139
  title: string;
140
- content: string;
141
- excerpt: string;
142
- published: boolean;
143
140
  tags: ({
144
141
  name: string;
145
142
  } | {
@@ -147,6 +144,9 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
147
144
  name: string;
148
145
  slug: string;
149
146
  })[];
147
+ content: string;
148
+ excerpt: string;
149
+ published: boolean;
150
150
  slug?: string | undefined;
151
151
  publishedAt?: Date | undefined;
152
152
  createdAt?: Date | undefined;