@btst/stack 1.1.5 → 1.1.7
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/better-stack/src/plugins/blog/api/plugin.cjs +14 -7
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +14 -7
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.cjs +16 -16
- package/dist/packages/better-stack/src/plugins/blog/client/hooks/blog-hooks.mjs +16 -16
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.cjs +6 -6
- package/dist/packages/better-stack/src/plugins/blog/client/plugin.mjs +6 -6
- 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 +6 -1
- package/dist/plugins/blog/client/index.d.mts +6 -1
- package/dist/plugins/blog/client/index.d.ts +6 -1
- package/dist/plugins/blog/query-keys.cjs +19 -13
- package/dist/plugins/blog/query-keys.d.cts +4 -3
- package/dist/plugins/blog/query-keys.d.mts +4 -3
- package/dist/plugins/blog/query-keys.d.ts +4 -3
- package/dist/plugins/blog/query-keys.mjs +19 -13
- package/package.json +5 -3
- package/src/plugins/blog/api/plugin.ts +14 -6
- package/src/plugins/blog/client/hooks/blog-hooks.tsx +16 -16
- package/src/plugins/blog/client/overrides.ts +4 -0
- package/src/plugins/blog/client/plugin.tsx +9 -6
- package/src/plugins/blog/query-keys.ts +13 -3
- package/dist/shared/{stack.CoPoHVfV.d.cts → stack.Cr2JoQdo.d.cts} +1 -1
- package/dist/shared/{stack.CoPoHVfV.d.mts → stack.Cr2JoQdo.d.mts} +1 -1
- package/dist/shared/{stack.CoPoHVfV.d.ts → stack.Cr2JoQdo.d.ts} +1 -1
|
@@ -55,16 +55,18 @@ function toError(error: unknown): Error {
|
|
|
55
55
|
|
|
56
56
|
export function createBlogQueryKeys(
|
|
57
57
|
client: ReturnType<typeof createApiClient<BlogApiRouter>>,
|
|
58
|
+
headers?: HeadersInit,
|
|
58
59
|
) {
|
|
59
|
-
const posts = createPostsQueries(client);
|
|
60
|
-
const drafts = createDraftsQueries(client);
|
|
61
|
-
const tags = createTagsQueries(client);
|
|
60
|
+
const posts = createPostsQueries(client, headers);
|
|
61
|
+
const drafts = createDraftsQueries(client, headers);
|
|
62
|
+
const tags = createTagsQueries(client, headers);
|
|
62
63
|
|
|
63
64
|
return mergeQueryKeys(posts, drafts, tags);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
function createPostsQueries(
|
|
67
68
|
client: ReturnType<typeof createApiClient<BlogApiRouter>>,
|
|
69
|
+
headers?: HeadersInit,
|
|
68
70
|
) {
|
|
69
71
|
return createQueryKeys("posts", {
|
|
70
72
|
list: (params?: PostsListParams) => ({
|
|
@@ -95,6 +97,7 @@ function createPostsQueries(
|
|
|
95
97
|
: undefined,
|
|
96
98
|
tagSlug: params?.tagSlug,
|
|
97
99
|
},
|
|
100
|
+
headers,
|
|
98
101
|
});
|
|
99
102
|
// Check for errors (better-call returns Error$1<unknown> | Data<Post[]>)
|
|
100
103
|
if (isErrorResponse(response)) {
|
|
@@ -121,6 +124,7 @@ function createPostsQueries(
|
|
|
121
124
|
const response = await client("/posts", {
|
|
122
125
|
method: "GET",
|
|
123
126
|
query: { slug, limit: 1 },
|
|
127
|
+
headers,
|
|
124
128
|
});
|
|
125
129
|
// Check for errors (better-call returns Error$1<unknown> | Data<Post[]>)
|
|
126
130
|
if (isErrorResponse(response)) {
|
|
@@ -148,6 +152,7 @@ function createPostsQueries(
|
|
|
148
152
|
query: {
|
|
149
153
|
date: dateValue.toISOString(),
|
|
150
154
|
},
|
|
155
|
+
headers,
|
|
151
156
|
});
|
|
152
157
|
// Check for errors (better-call returns Error$1<unknown> | Data<...>)
|
|
153
158
|
if (isErrorResponse(response)) {
|
|
@@ -174,6 +179,7 @@ function createPostsQueries(
|
|
|
174
179
|
limit: params?.limit ?? 5,
|
|
175
180
|
published: "true",
|
|
176
181
|
},
|
|
182
|
+
headers,
|
|
177
183
|
});
|
|
178
184
|
// Check for errors (better-call returns Error$1<unknown> | Data<Post[]>)
|
|
179
185
|
if (isErrorResponse(response)) {
|
|
@@ -201,6 +207,7 @@ function createPostsQueries(
|
|
|
201
207
|
|
|
202
208
|
function createDraftsQueries(
|
|
203
209
|
client: ReturnType<typeof createApiClient<BlogApiRouter>>,
|
|
210
|
+
headers?: HeadersInit,
|
|
204
211
|
) {
|
|
205
212
|
return createQueryKeys("drafts", {
|
|
206
213
|
list: (params?: PostsListParams) => ({
|
|
@@ -219,6 +226,7 @@ function createDraftsQueries(
|
|
|
219
226
|
limit: params?.limit ?? 10,
|
|
220
227
|
published: "false",
|
|
221
228
|
},
|
|
229
|
+
headers,
|
|
222
230
|
});
|
|
223
231
|
// Check for errors (better-call returns Error$1<unknown> | Data<Post[]>)
|
|
224
232
|
if (isErrorResponse(response)) {
|
|
@@ -239,6 +247,7 @@ function createDraftsQueries(
|
|
|
239
247
|
|
|
240
248
|
function createTagsQueries(
|
|
241
249
|
client: ReturnType<typeof createApiClient<BlogApiRouter>>,
|
|
250
|
+
headers?: HeadersInit,
|
|
242
251
|
) {
|
|
243
252
|
return createQueryKeys("tags", {
|
|
244
253
|
list: () => ({
|
|
@@ -247,6 +256,7 @@ function createTagsQueries(
|
|
|
247
256
|
try {
|
|
248
257
|
const response = await client("/tags", {
|
|
249
258
|
method: "GET",
|
|
259
|
+
headers,
|
|
250
260
|
});
|
|
251
261
|
// Check for errors (better-call returns Error$1<unknown> | Data<Tag[]>)
|
|
252
262
|
if (isErrorResponse(response)) {
|
|
@@ -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;
|
|
38
39
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
40
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
41
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
42
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
43
|
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;
|
|
38
39
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
40
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
41
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
42
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
43
|
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;
|
|
38
39
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
40
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
41
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
42
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
43
|
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>;
|