@btst/stack 1.1.2 → 1.1.3
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/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- 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 +165 -178
- package/dist/plugins/blog/client/index.d.mts +165 -178
- package/dist/plugins/blog/client/index.d.ts +165 -178
- 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/client/index.d.cts +8 -5
- package/dist/plugins/client/index.d.mts +8 -5
- package/dist/plugins/client/index.d.ts +8 -5
- package/package.json +1 -1
- package/src/plugins/client/index.ts +14 -6
- package/dist/shared/{stack.Cr2JoQdo.d.cts → stack.CoPoHVfV.d.cts} +1 -1
- package/dist/shared/{stack.Cr2JoQdo.d.mts → stack.CoPoHVfV.d.mts} +1 -1
- package/dist/shared/{stack.Cr2JoQdo.d.ts → stack.CoPoHVfV.d.ts} +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
import { ComponentType } from 'react';
|
|
3
4
|
import * as _btst_yar from '@btst/yar';
|
|
4
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.CoPoHVfV.js';
|
|
6
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.js';
|
|
7
8
|
import 'zod';
|
|
8
9
|
|
|
@@ -66,190 +67,176 @@ interface BlogClientHooks {
|
|
|
66
67
|
*
|
|
67
68
|
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
68
69
|
*/
|
|
69
|
-
declare const blogClientPlugin: (config: BlogClientConfig) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
})[]) | undefined;
|
|
94
|
-
extra?: (() => any) | undefined;
|
|
95
|
-
};
|
|
96
|
-
options: _btst_yar.RouteOptions | undefined;
|
|
97
|
-
path: "/blog";
|
|
98
|
-
meta: _btst_yar.RouteMeta | undefined;
|
|
70
|
+
declare const blogClientPlugin: (config: BlogClientConfig) => _btst_stack_plugins_client.ClientPlugin<unknown, {
|
|
71
|
+
posts: {
|
|
72
|
+
(inputCtx_0?: _btst_yar.InputContext<"/blog", _btst_yar.RouteOptions> | undefined): {
|
|
73
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
74
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
75
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
76
|
+
loader?: (() => Promise<void>) | undefined;
|
|
77
|
+
meta?: (() => ({
|
|
78
|
+
title: string;
|
|
79
|
+
name?: undefined;
|
|
80
|
+
content?: undefined;
|
|
81
|
+
property?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
name: string;
|
|
84
|
+
content: string;
|
|
85
|
+
title?: undefined;
|
|
86
|
+
property?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
property: string;
|
|
89
|
+
content: string;
|
|
90
|
+
title?: undefined;
|
|
91
|
+
name?: undefined;
|
|
92
|
+
})[]) | undefined;
|
|
93
|
+
extra?: (() => any) | undefined;
|
|
99
94
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
95
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
96
|
+
path: "/blog";
|
|
97
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
98
|
+
};
|
|
99
|
+
drafts: {
|
|
100
|
+
(inputCtx_0?: _btst_yar.InputContext<"/blog/drafts", _btst_yar.RouteOptions> | undefined): {
|
|
101
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
102
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
103
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
104
|
+
loader?: (() => Promise<void>) | undefined;
|
|
105
|
+
meta?: (() => ({
|
|
106
|
+
title: string;
|
|
107
|
+
name?: undefined;
|
|
108
|
+
content?: undefined;
|
|
109
|
+
property?: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
name: string;
|
|
112
|
+
content: string;
|
|
113
|
+
title?: undefined;
|
|
114
|
+
property?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
property: string;
|
|
117
|
+
content: string;
|
|
118
|
+
title?: undefined;
|
|
119
|
+
name?: undefined;
|
|
120
|
+
})[]) | undefined;
|
|
121
|
+
extra?: (() => any) | undefined;
|
|
127
122
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
123
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
124
|
+
path: "/blog/drafts";
|
|
125
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
126
|
+
};
|
|
127
|
+
newPost: {
|
|
128
|
+
(inputCtx_0?: _btst_yar.InputContext<"/blog/new", _btst_yar.RouteOptions> | undefined): {
|
|
129
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
130
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
131
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
132
|
+
loader?: (() => any) | undefined;
|
|
133
|
+
meta?: (() => ({
|
|
134
|
+
title: string;
|
|
135
|
+
name?: undefined;
|
|
136
|
+
content?: undefined;
|
|
137
|
+
property?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
name: string;
|
|
140
|
+
content: string;
|
|
141
|
+
title?: undefined;
|
|
142
|
+
property?: undefined;
|
|
143
|
+
} | {
|
|
144
|
+
property: string;
|
|
145
|
+
content: string;
|
|
146
|
+
title?: undefined;
|
|
147
|
+
name?: undefined;
|
|
148
|
+
})[]) | undefined;
|
|
149
|
+
extra?: (() => any) | undefined;
|
|
155
150
|
};
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
151
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
152
|
+
path: "/blog/new";
|
|
153
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
154
|
+
};
|
|
155
|
+
editPost: {
|
|
156
|
+
(inputCtx_0: _btst_yar.InputContext<"/blog/:slug/edit", _btst_yar.RouteOptions>): {
|
|
157
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
158
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
159
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
160
|
+
loader?: (() => Promise<void>) | undefined;
|
|
161
|
+
meta?: (() => ({
|
|
162
|
+
title: string;
|
|
163
|
+
name?: undefined;
|
|
164
|
+
content?: undefined;
|
|
165
|
+
property?: undefined;
|
|
166
|
+
} | {
|
|
167
|
+
name: string;
|
|
168
|
+
content: string;
|
|
169
|
+
title?: undefined;
|
|
170
|
+
property?: undefined;
|
|
171
|
+
} | {
|
|
172
|
+
property: string;
|
|
173
|
+
content: string;
|
|
174
|
+
title?: undefined;
|
|
175
|
+
name?: undefined;
|
|
176
|
+
})[]) | undefined;
|
|
177
|
+
extra?: (() => any) | undefined;
|
|
183
178
|
};
|
|
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
|
-
|
|
179
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
180
|
+
path: "/blog/:slug/edit";
|
|
181
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
182
|
+
};
|
|
183
|
+
tag: {
|
|
184
|
+
(inputCtx_0: _btst_yar.InputContext<"/blog/tag/:tagSlug", _btst_yar.RouteOptions>): {
|
|
185
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
186
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
187
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
188
|
+
loader?: (() => Promise<void>) | undefined;
|
|
189
|
+
meta?: (() => ({
|
|
190
|
+
title: string;
|
|
191
|
+
name?: undefined;
|
|
192
|
+
content?: undefined;
|
|
193
|
+
property?: undefined;
|
|
194
|
+
} | {
|
|
195
|
+
name: string;
|
|
196
|
+
content: string;
|
|
197
|
+
title?: undefined;
|
|
198
|
+
property?: undefined;
|
|
199
|
+
} | {
|
|
200
|
+
property: string;
|
|
201
|
+
content: string;
|
|
202
|
+
title?: undefined;
|
|
203
|
+
name?: undefined;
|
|
204
|
+
})[]) | undefined;
|
|
205
|
+
extra?: (() => any) | undefined;
|
|
211
206
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
207
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
208
|
+
path: "/blog/tag/:tagSlug";
|
|
209
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
210
|
+
};
|
|
211
|
+
post: {
|
|
212
|
+
(inputCtx_0: _btst_yar.InputContext<"/blog/:slug", _btst_yar.RouteOptions>): {
|
|
213
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
214
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
215
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
216
|
+
loader?: (() => Promise<void>) | undefined;
|
|
217
|
+
meta?: (() => ({
|
|
218
|
+
title: string;
|
|
219
|
+
name?: undefined;
|
|
220
|
+
content?: undefined;
|
|
221
|
+
property?: undefined;
|
|
222
|
+
} | {
|
|
223
|
+
name: string;
|
|
224
|
+
content: string | undefined;
|
|
225
|
+
title?: undefined;
|
|
226
|
+
property?: undefined;
|
|
227
|
+
} | {
|
|
228
|
+
property: string;
|
|
229
|
+
content: string;
|
|
230
|
+
title?: undefined;
|
|
231
|
+
name?: undefined;
|
|
232
|
+
})[]) | undefined;
|
|
233
|
+
extra?: (() => any) | undefined;
|
|
239
234
|
};
|
|
235
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
236
|
+
path: "/blog/:slug";
|
|
237
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
240
238
|
};
|
|
241
|
-
|
|
242
|
-
url: string;
|
|
243
|
-
lastModified: Date | undefined;
|
|
244
|
-
changeFrequency: "monthly";
|
|
245
|
-
priority: number;
|
|
246
|
-
} | {
|
|
247
|
-
url: string;
|
|
248
|
-
lastModified: Date | undefined;
|
|
249
|
-
changeFrequency: "daily";
|
|
250
|
-
priority: number;
|
|
251
|
-
})[]>;
|
|
252
|
-
};
|
|
239
|
+
}>;
|
|
253
240
|
|
|
254
241
|
declare const BLOG_LOCALIZATION: {
|
|
255
242
|
BLOG_FORMS_TITLE_LABEL: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.CoPoHVfV.cjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -172,12 +172,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
172
172
|
options: {
|
|
173
173
|
method: "POST";
|
|
174
174
|
body: z.ZodObject<{
|
|
175
|
-
title: z.ZodString;
|
|
176
175
|
slug: z.ZodOptional<z.ZodString>;
|
|
177
176
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
178
177
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
178
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
|
+
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.CoPoHVfV.mjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -172,12 +172,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
172
172
|
options: {
|
|
173
173
|
method: "POST";
|
|
174
174
|
body: z.ZodObject<{
|
|
175
|
-
title: z.ZodString;
|
|
176
175
|
slug: z.ZodOptional<z.ZodString>;
|
|
177
176
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
178
177
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
178
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
|
+
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.CoPoHVfV.js';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -172,12 +172,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
172
172
|
options: {
|
|
173
173
|
method: "POST";
|
|
174
174
|
body: z.ZodObject<{
|
|
175
|
-
title: z.ZodString;
|
|
176
175
|
slug: z.ZodOptional<z.ZodString>;
|
|
177
176
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
178
177
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
178
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
|
+
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -31,10 +31,16 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
31
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
+
* This ensures types are portable across package boundaries
|
|
37
|
+
*/
|
|
38
|
+
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
34
39
|
/**
|
|
35
40
|
* Helper to define a client plugin with full type inference
|
|
36
41
|
*
|
|
37
42
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
+
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
38
44
|
*
|
|
39
45
|
* @example
|
|
40
46
|
* ```ts
|
|
@@ -43,15 +49,12 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
43
49
|
* routes: () => ({
|
|
44
50
|
* messagesList: createRoute("/messages", () => ({ ... }))
|
|
45
51
|
* }),
|
|
46
|
-
*
|
|
47
|
-
* useMessages: () => { ... }
|
|
48
|
-
* })
|
|
52
|
+
* sitemap: () => [{ url: "/messages", lastModified: new Date(), priority: 0.8 }]
|
|
49
53
|
* });
|
|
50
|
-
* // No casts needed - route keys, hook names, and types are all preserved!
|
|
51
54
|
* ```
|
|
52
55
|
*
|
|
53
56
|
* @template TPlugin - The exact plugin definition (auto-inferred)
|
|
54
57
|
*/
|
|
55
|
-
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): TPlugin
|
|
58
|
+
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): PortableClientPlugin<TPlugin>;
|
|
56
59
|
|
|
57
60
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
@@ -31,10 +31,16 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
31
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
+
* This ensures types are portable across package boundaries
|
|
37
|
+
*/
|
|
38
|
+
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
34
39
|
/**
|
|
35
40
|
* Helper to define a client plugin with full type inference
|
|
36
41
|
*
|
|
37
42
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
+
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
38
44
|
*
|
|
39
45
|
* @example
|
|
40
46
|
* ```ts
|
|
@@ -43,15 +49,12 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
43
49
|
* routes: () => ({
|
|
44
50
|
* messagesList: createRoute("/messages", () => ({ ... }))
|
|
45
51
|
* }),
|
|
46
|
-
*
|
|
47
|
-
* useMessages: () => { ... }
|
|
48
|
-
* })
|
|
52
|
+
* sitemap: () => [{ url: "/messages", lastModified: new Date(), priority: 0.8 }]
|
|
49
53
|
* });
|
|
50
|
-
* // No casts needed - route keys, hook names, and types are all preserved!
|
|
51
54
|
* ```
|
|
52
55
|
*
|
|
53
56
|
* @template TPlugin - The exact plugin definition (auto-inferred)
|
|
54
57
|
*/
|
|
55
|
-
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): TPlugin
|
|
58
|
+
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): PortableClientPlugin<TPlugin>;
|
|
56
59
|
|
|
57
60
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|
|
@@ -31,10 +31,16 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
31
31
|
* - Client: import type { ClientPlugin } from "@btst/stack/plugins/client"
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Helper type to extract plugin structure without leaking internal type references
|
|
36
|
+
* This ensures types are portable across package boundaries
|
|
37
|
+
*/
|
|
38
|
+
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> = ClientPlugin<TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never, TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never>;
|
|
34
39
|
/**
|
|
35
40
|
* Helper to define a client plugin with full type inference
|
|
36
41
|
*
|
|
37
42
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
43
|
+
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
38
44
|
*
|
|
39
45
|
* @example
|
|
40
46
|
* ```ts
|
|
@@ -43,15 +49,12 @@ declare function createApiClient<TRouter extends Router | Record<string, Endpoin
|
|
|
43
49
|
* routes: () => ({
|
|
44
50
|
* messagesList: createRoute("/messages", () => ({ ... }))
|
|
45
51
|
* }),
|
|
46
|
-
*
|
|
47
|
-
* useMessages: () => { ... }
|
|
48
|
-
* })
|
|
52
|
+
* sitemap: () => [{ url: "/messages", lastModified: new Date(), priority: 0.8 }]
|
|
49
53
|
* });
|
|
50
|
-
* // No casts needed - route keys, hook names, and types are all preserved!
|
|
51
54
|
* ```
|
|
52
55
|
*
|
|
53
56
|
* @template TPlugin - The exact plugin definition (auto-inferred)
|
|
54
57
|
*/
|
|
55
|
-
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): TPlugin
|
|
58
|
+
declare function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(plugin: TPlugin): PortableClientPlugin<TPlugin>;
|
|
56
59
|
|
|
57
60
|
export { ClientPlugin, createApiClient, defineClientPlugin };
|
package/package.json
CHANGED
|
@@ -25,10 +25,21 @@ export { createRoute, createRouter } from "@btst/yar";
|
|
|
25
25
|
|
|
26
26
|
export { createClient } from "better-call/client";
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Helper type to extract plugin structure without leaking internal type references
|
|
30
|
+
* This ensures types are portable across package boundaries
|
|
31
|
+
*/
|
|
32
|
+
type PortableClientPlugin<TPlugin extends ClientPlugin<any, any>> =
|
|
33
|
+
ClientPlugin<
|
|
34
|
+
TPlugin extends ClientPlugin<infer TOverrides, any> ? TOverrides : never,
|
|
35
|
+
TPlugin extends ClientPlugin<any, infer TRoutes> ? TRoutes : never
|
|
36
|
+
>;
|
|
37
|
+
|
|
28
38
|
/**
|
|
29
39
|
* Helper to define a client plugin with full type inference
|
|
30
40
|
*
|
|
31
41
|
* Automatically infers route keys, hook names, and their types without needing casts.
|
|
42
|
+
* Returns a portable type that doesn't leak internal pnpm path references.
|
|
32
43
|
*
|
|
33
44
|
* @example
|
|
34
45
|
* ```ts
|
|
@@ -37,17 +48,14 @@ export { createClient } from "better-call/client";
|
|
|
37
48
|
* routes: () => ({
|
|
38
49
|
* messagesList: createRoute("/messages", () => ({ ... }))
|
|
39
50
|
* }),
|
|
40
|
-
*
|
|
41
|
-
* useMessages: () => { ... }
|
|
42
|
-
* })
|
|
51
|
+
* sitemap: () => [{ url: "/messages", lastModified: new Date(), priority: 0.8 }]
|
|
43
52
|
* });
|
|
44
|
-
* // No casts needed - route keys, hook names, and types are all preserved!
|
|
45
53
|
* ```
|
|
46
54
|
*
|
|
47
55
|
* @template TPlugin - The exact plugin definition (auto-inferred)
|
|
48
56
|
*/
|
|
49
57
|
export function defineClientPlugin<TPlugin extends ClientPlugin<any, any>>(
|
|
50
58
|
plugin: TPlugin,
|
|
51
|
-
): TPlugin {
|
|
52
|
-
return plugin
|
|
59
|
+
): PortableClientPlugin<TPlugin> {
|
|
60
|
+
return plugin as PortableClientPlugin<TPlugin>;
|
|
53
61
|
}
|
|
@@ -35,12 +35,12 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
40
39
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
40
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
+
title: z.ZodString;
|
|
44
44
|
content: z.ZodString;
|
|
45
45
|
excerpt: z.ZodString;
|
|
46
46
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -35,12 +35,12 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
40
39
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
40
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
+
title: z.ZodString;
|
|
44
44
|
content: z.ZodString;
|
|
45
45
|
excerpt: z.ZodString;
|
|
46
46
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -35,12 +35,12 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
|
-
title: z.ZodString;
|
|
39
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
40
39
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
40
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
|
+
title: z.ZodString;
|
|
44
44
|
content: z.ZodString;
|
|
45
45
|
excerpt: z.ZodString;
|
|
46
46
|
image: z.ZodOptional<z.ZodString>;
|