@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
|
@@ -162,8 +162,8 @@ const blogBackendPlugin = (hooks) => api.defineBackendPlugin({
|
|
|
162
162
|
query: PostListQuerySchema
|
|
163
163
|
},
|
|
164
164
|
async (ctx) => {
|
|
165
|
-
const { query } = ctx;
|
|
166
|
-
const context = { query };
|
|
165
|
+
const { query, headers } = ctx;
|
|
166
|
+
const context = { query, headers };
|
|
167
167
|
const tagCache = createTagCache();
|
|
168
168
|
const postTagCache = createPostTagCache();
|
|
169
169
|
try {
|
|
@@ -258,7 +258,10 @@ const blogBackendPlugin = (hooks) => api.defineBackendPlugin({
|
|
|
258
258
|
body: schemas.createPostSchema
|
|
259
259
|
},
|
|
260
260
|
async (ctx) => {
|
|
261
|
-
const context = {
|
|
261
|
+
const context = {
|
|
262
|
+
body: ctx.body,
|
|
263
|
+
headers: ctx.headers
|
|
264
|
+
};
|
|
262
265
|
const tagCache = createTagCache();
|
|
263
266
|
try {
|
|
264
267
|
if (hooks?.onBeforeCreatePost) {
|
|
@@ -322,7 +325,8 @@ const blogBackendPlugin = (hooks) => api.defineBackendPlugin({
|
|
|
322
325
|
async (ctx) => {
|
|
323
326
|
const context = {
|
|
324
327
|
body: ctx.body,
|
|
325
|
-
params: ctx.params
|
|
328
|
+
params: ctx.params,
|
|
329
|
+
headers: ctx.headers
|
|
326
330
|
};
|
|
327
331
|
const tagCache = createTagCache();
|
|
328
332
|
try {
|
|
@@ -416,7 +420,10 @@ const blogBackendPlugin = (hooks) => api.defineBackendPlugin({
|
|
|
416
420
|
method: "DELETE"
|
|
417
421
|
},
|
|
418
422
|
async (ctx) => {
|
|
419
|
-
const context = {
|
|
423
|
+
const context = {
|
|
424
|
+
params: ctx.params,
|
|
425
|
+
headers: ctx.headers
|
|
426
|
+
};
|
|
420
427
|
try {
|
|
421
428
|
if (hooks?.onBeforeDeletePost) {
|
|
422
429
|
const canDelete = await hooks.onBeforeDeletePost(
|
|
@@ -458,8 +465,8 @@ const blogBackendPlugin = (hooks) => api.defineBackendPlugin({
|
|
|
458
465
|
query: NextPreviousPostsQuerySchema
|
|
459
466
|
},
|
|
460
467
|
async (ctx) => {
|
|
461
|
-
const { query } = ctx;
|
|
462
|
-
const context = { query };
|
|
468
|
+
const { query, headers } = ctx;
|
|
469
|
+
const context = { query, headers };
|
|
463
470
|
const tagCache = createTagCache();
|
|
464
471
|
const postTagCache = createPostTagCache();
|
|
465
472
|
try {
|
|
@@ -160,8 +160,8 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
160
160
|
query: PostListQuerySchema
|
|
161
161
|
},
|
|
162
162
|
async (ctx) => {
|
|
163
|
-
const { query } = ctx;
|
|
164
|
-
const context = { query };
|
|
163
|
+
const { query, headers } = ctx;
|
|
164
|
+
const context = { query, headers };
|
|
165
165
|
const tagCache = createTagCache();
|
|
166
166
|
const postTagCache = createPostTagCache();
|
|
167
167
|
try {
|
|
@@ -256,7 +256,10 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
256
256
|
body: createPostSchema
|
|
257
257
|
},
|
|
258
258
|
async (ctx) => {
|
|
259
|
-
const context = {
|
|
259
|
+
const context = {
|
|
260
|
+
body: ctx.body,
|
|
261
|
+
headers: ctx.headers
|
|
262
|
+
};
|
|
260
263
|
const tagCache = createTagCache();
|
|
261
264
|
try {
|
|
262
265
|
if (hooks?.onBeforeCreatePost) {
|
|
@@ -320,7 +323,8 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
320
323
|
async (ctx) => {
|
|
321
324
|
const context = {
|
|
322
325
|
body: ctx.body,
|
|
323
|
-
params: ctx.params
|
|
326
|
+
params: ctx.params,
|
|
327
|
+
headers: ctx.headers
|
|
324
328
|
};
|
|
325
329
|
const tagCache = createTagCache();
|
|
326
330
|
try {
|
|
@@ -414,7 +418,10 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
414
418
|
method: "DELETE"
|
|
415
419
|
},
|
|
416
420
|
async (ctx) => {
|
|
417
|
-
const context = {
|
|
421
|
+
const context = {
|
|
422
|
+
params: ctx.params,
|
|
423
|
+
headers: ctx.headers
|
|
424
|
+
};
|
|
418
425
|
try {
|
|
419
426
|
if (hooks?.onBeforeDeletePost) {
|
|
420
427
|
const canDelete = await hooks.onBeforeDeletePost(
|
|
@@ -456,8 +463,8 @@ const blogBackendPlugin = (hooks) => defineBackendPlugin({
|
|
|
456
463
|
query: NextPreviousPostsQuerySchema
|
|
457
464
|
},
|
|
458
465
|
async (ctx) => {
|
|
459
|
-
const { query } = ctx;
|
|
460
|
-
const context = { query };
|
|
466
|
+
const { query, headers } = ctx;
|
|
467
|
+
const context = { query, headers };
|
|
461
468
|
const tagCache = createTagCache();
|
|
462
469
|
const postTagCache = createPostTagCache();
|
|
463
470
|
try {
|
|
@@ -20,7 +20,7 @@ const SHARED_QUERY_CONFIG = {
|
|
|
20
20
|
// 10 minutes
|
|
21
21
|
};
|
|
22
22
|
function usePosts(options = {}) {
|
|
23
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
23
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
24
24
|
const client$1 = client.createApiClient({
|
|
25
25
|
baseURL: apiBaseURL,
|
|
26
26
|
basePath: apiBasePath
|
|
@@ -33,7 +33,7 @@ function usePosts(options = {}) {
|
|
|
33
33
|
query,
|
|
34
34
|
published
|
|
35
35
|
} = options;
|
|
36
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
36
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
37
37
|
const queryParams = {
|
|
38
38
|
tag,
|
|
39
39
|
tagSlug,
|
|
@@ -73,7 +73,7 @@ function usePosts(options = {}) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
function useSuspensePosts(options = {}) {
|
|
76
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
76
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
77
77
|
const client$1 = client.createApiClient({
|
|
78
78
|
baseURL: apiBaseURL,
|
|
79
79
|
basePath: apiBasePath
|
|
@@ -86,7 +86,7 @@ function useSuspensePosts(options = {}) {
|
|
|
86
86
|
query,
|
|
87
87
|
published
|
|
88
88
|
} = options;
|
|
89
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
89
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
90
90
|
const queryParams = { tag, tagSlug, limit, query, published };
|
|
91
91
|
const basePosts = queries.posts.list(queryParams);
|
|
92
92
|
const {
|
|
@@ -120,12 +120,12 @@ function useSuspensePosts(options = {}) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
function usePost(slug) {
|
|
123
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
123
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
124
124
|
const client$1 = client.createApiClient({
|
|
125
125
|
baseURL: apiBaseURL,
|
|
126
126
|
basePath: apiBasePath
|
|
127
127
|
});
|
|
128
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
128
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
129
129
|
const basePost = queries.posts.detail(slug ?? "");
|
|
130
130
|
const { data, isLoading, error, refetch } = reactQuery.useQuery({
|
|
131
131
|
...basePost,
|
|
@@ -140,12 +140,12 @@ function usePost(slug) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
function useSuspensePost(slug) {
|
|
143
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
143
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
144
144
|
const client$1 = client.createApiClient({
|
|
145
145
|
baseURL: apiBaseURL,
|
|
146
146
|
basePath: apiBasePath
|
|
147
147
|
});
|
|
148
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
148
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
149
149
|
const basePost = queries.posts.detail(slug);
|
|
150
150
|
const { data, refetch, error, isFetching } = reactQuery.useSuspenseQuery({
|
|
151
151
|
...basePost,
|
|
@@ -157,12 +157,12 @@ function useSuspensePost(slug) {
|
|
|
157
157
|
return { post: data || null, refetch };
|
|
158
158
|
}
|
|
159
159
|
function useTags() {
|
|
160
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
160
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
161
161
|
const client$1 = client.createApiClient({
|
|
162
162
|
baseURL: apiBaseURL,
|
|
163
163
|
basePath: apiBasePath
|
|
164
164
|
});
|
|
165
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
165
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
166
166
|
const baseTags = queries.tags.list();
|
|
167
167
|
const { data, isLoading, error, refetch } = reactQuery.useQuery({
|
|
168
168
|
...baseTags,
|
|
@@ -177,12 +177,12 @@ function useTags() {
|
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
function useSuspenseTags() {
|
|
180
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
180
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
181
181
|
const client$1 = client.createApiClient({
|
|
182
182
|
baseURL: apiBaseURL,
|
|
183
183
|
basePath: apiBasePath
|
|
184
184
|
});
|
|
185
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
185
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
186
186
|
const baseTags = queries.tags.list();
|
|
187
187
|
const { data, refetch, error, isFetching } = reactQuery.useSuspenseQuery({
|
|
188
188
|
...baseTags,
|
|
@@ -336,12 +336,12 @@ function usePostSearch({
|
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function useNextPreviousPosts(createdAt, options = {}) {
|
|
339
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
339
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
340
340
|
const client$1 = client.createApiClient({
|
|
341
341
|
baseURL: apiBaseURL,
|
|
342
342
|
basePath: apiBasePath
|
|
343
343
|
});
|
|
344
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
344
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
345
345
|
const { ref, inView } = reactIntersectionObserver.useInView({
|
|
346
346
|
// start a little early so the data is ready as it scrolls in
|
|
347
347
|
rootMargin: "200px 0px",
|
|
@@ -366,12 +366,12 @@ function useNextPreviousPosts(createdAt, options = {}) {
|
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
function useRecentPosts(options = {}) {
|
|
369
|
-
const { apiBaseURL, apiBasePath } = context.usePluginOverrides("blog");
|
|
369
|
+
const { apiBaseURL, apiBasePath, headers } = context.usePluginOverrides("blog");
|
|
370
370
|
const client$1 = client.createApiClient({
|
|
371
371
|
baseURL: apiBaseURL,
|
|
372
372
|
basePath: apiBasePath
|
|
373
373
|
});
|
|
374
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
374
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
375
375
|
const { ref, inView } = reactIntersectionObserver.useInView({
|
|
376
376
|
// start a little early so the data is ready as it scrolls in
|
|
377
377
|
rootMargin: "200px 0px",
|
|
@@ -18,7 +18,7 @@ const SHARED_QUERY_CONFIG = {
|
|
|
18
18
|
// 10 minutes
|
|
19
19
|
};
|
|
20
20
|
function usePosts(options = {}) {
|
|
21
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
21
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
22
22
|
const client = createApiClient({
|
|
23
23
|
baseURL: apiBaseURL,
|
|
24
24
|
basePath: apiBasePath
|
|
@@ -31,7 +31,7 @@ function usePosts(options = {}) {
|
|
|
31
31
|
query,
|
|
32
32
|
published
|
|
33
33
|
} = options;
|
|
34
|
-
const queries = createBlogQueryKeys(client);
|
|
34
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
35
35
|
const queryParams = {
|
|
36
36
|
tag,
|
|
37
37
|
tagSlug,
|
|
@@ -71,7 +71,7 @@ function usePosts(options = {}) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
function useSuspensePosts(options = {}) {
|
|
74
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
74
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
75
75
|
const client = createApiClient({
|
|
76
76
|
baseURL: apiBaseURL,
|
|
77
77
|
basePath: apiBasePath
|
|
@@ -84,7 +84,7 @@ function useSuspensePosts(options = {}) {
|
|
|
84
84
|
query,
|
|
85
85
|
published
|
|
86
86
|
} = options;
|
|
87
|
-
const queries = createBlogQueryKeys(client);
|
|
87
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
88
88
|
const queryParams = { tag, tagSlug, limit, query, published };
|
|
89
89
|
const basePosts = queries.posts.list(queryParams);
|
|
90
90
|
const {
|
|
@@ -118,12 +118,12 @@ function useSuspensePosts(options = {}) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
function usePost(slug) {
|
|
121
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
121
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
122
122
|
const client = createApiClient({
|
|
123
123
|
baseURL: apiBaseURL,
|
|
124
124
|
basePath: apiBasePath
|
|
125
125
|
});
|
|
126
|
-
const queries = createBlogQueryKeys(client);
|
|
126
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
127
127
|
const basePost = queries.posts.detail(slug ?? "");
|
|
128
128
|
const { data, isLoading, error, refetch } = useQuery({
|
|
129
129
|
...basePost,
|
|
@@ -138,12 +138,12 @@ function usePost(slug) {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
function useSuspensePost(slug) {
|
|
141
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
141
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
142
142
|
const client = createApiClient({
|
|
143
143
|
baseURL: apiBaseURL,
|
|
144
144
|
basePath: apiBasePath
|
|
145
145
|
});
|
|
146
|
-
const queries = createBlogQueryKeys(client);
|
|
146
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
147
147
|
const basePost = queries.posts.detail(slug);
|
|
148
148
|
const { data, refetch, error, isFetching } = useSuspenseQuery({
|
|
149
149
|
...basePost,
|
|
@@ -155,12 +155,12 @@ function useSuspensePost(slug) {
|
|
|
155
155
|
return { post: data || null, refetch };
|
|
156
156
|
}
|
|
157
157
|
function useTags() {
|
|
158
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
158
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
159
159
|
const client = createApiClient({
|
|
160
160
|
baseURL: apiBaseURL,
|
|
161
161
|
basePath: apiBasePath
|
|
162
162
|
});
|
|
163
|
-
const queries = createBlogQueryKeys(client);
|
|
163
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
164
164
|
const baseTags = queries.tags.list();
|
|
165
165
|
const { data, isLoading, error, refetch } = useQuery({
|
|
166
166
|
...baseTags,
|
|
@@ -175,12 +175,12 @@ function useTags() {
|
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
function useSuspenseTags() {
|
|
178
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
178
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
179
179
|
const client = createApiClient({
|
|
180
180
|
baseURL: apiBaseURL,
|
|
181
181
|
basePath: apiBasePath
|
|
182
182
|
});
|
|
183
|
-
const queries = createBlogQueryKeys(client);
|
|
183
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
184
184
|
const baseTags = queries.tags.list();
|
|
185
185
|
const { data, refetch, error, isFetching } = useSuspenseQuery({
|
|
186
186
|
...baseTags,
|
|
@@ -334,12 +334,12 @@ function usePostSearch({
|
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
336
|
function useNextPreviousPosts(createdAt, options = {}) {
|
|
337
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
337
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
338
338
|
const client = createApiClient({
|
|
339
339
|
baseURL: apiBaseURL,
|
|
340
340
|
basePath: apiBasePath
|
|
341
341
|
});
|
|
342
|
-
const queries = createBlogQueryKeys(client);
|
|
342
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
343
343
|
const { ref, inView } = useInView({
|
|
344
344
|
// start a little early so the data is ready as it scrolls in
|
|
345
345
|
rootMargin: "200px 0px",
|
|
@@ -364,12 +364,12 @@ function useNextPreviousPosts(createdAt, options = {}) {
|
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
function useRecentPosts(options = {}) {
|
|
367
|
-
const { apiBaseURL, apiBasePath } = usePluginOverrides("blog");
|
|
367
|
+
const { apiBaseURL, apiBasePath, headers } = usePluginOverrides("blog");
|
|
368
368
|
const client = createApiClient({
|
|
369
369
|
baseURL: apiBaseURL,
|
|
370
370
|
basePath: apiBasePath
|
|
371
371
|
});
|
|
372
|
-
const queries = createBlogQueryKeys(client);
|
|
372
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
373
373
|
const { ref, inView } = useInView({
|
|
374
374
|
// start a little early so the data is ready as it scrolls in
|
|
375
375
|
rootMargin: "200px 0px",
|
|
@@ -13,7 +13,7 @@ const postPage = require('./components/pages/post-page.cjs');
|
|
|
13
13
|
function createPostsLoader(published, config) {
|
|
14
14
|
return async () => {
|
|
15
15
|
if (typeof window === "undefined") {
|
|
16
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
16
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
17
17
|
const context = {
|
|
18
18
|
path: published ? "/blog" : "/blog/drafts",
|
|
19
19
|
isSSR: true,
|
|
@@ -32,7 +32,7 @@ function createPostsLoader(published, config) {
|
|
|
32
32
|
baseURL: apiBaseURL,
|
|
33
33
|
basePath: apiBasePath
|
|
34
34
|
});
|
|
35
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
35
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
36
36
|
const listQuery = queries.posts.list({
|
|
37
37
|
query: void 0,
|
|
38
38
|
limit,
|
|
@@ -66,7 +66,7 @@ function createPostsLoader(published, config) {
|
|
|
66
66
|
function createPostLoader(slug, config) {
|
|
67
67
|
return async () => {
|
|
68
68
|
if (typeof window === "undefined") {
|
|
69
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
69
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
70
70
|
const context = {
|
|
71
71
|
path: `/blog/${slug}`,
|
|
72
72
|
params: { slug },
|
|
@@ -85,7 +85,7 @@ function createPostLoader(slug, config) {
|
|
|
85
85
|
baseURL: apiBaseURL,
|
|
86
86
|
basePath: apiBasePath
|
|
87
87
|
});
|
|
88
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
88
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
89
89
|
const postQuery = queries.posts.detail(slug);
|
|
90
90
|
await queryClient.prefetchQuery(postQuery);
|
|
91
91
|
if (hooks?.afterLoadPost) {
|
|
@@ -110,7 +110,7 @@ function createPostLoader(slug, config) {
|
|
|
110
110
|
function createTagLoader(tagSlug, config) {
|
|
111
111
|
return async () => {
|
|
112
112
|
if (typeof window === "undefined") {
|
|
113
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
113
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
114
114
|
const context = {
|
|
115
115
|
path: `/blog/tag/${tagSlug}`,
|
|
116
116
|
params: { tagSlug },
|
|
@@ -124,7 +124,7 @@ function createTagLoader(tagSlug, config) {
|
|
|
124
124
|
baseURL: apiBaseURL,
|
|
125
125
|
basePath: apiBasePath
|
|
126
126
|
});
|
|
127
|
-
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1);
|
|
127
|
+
const queries = plugins_blog_queryKeys.createBlogQueryKeys(client$1, headers);
|
|
128
128
|
const listQuery = queries.posts.list({
|
|
129
129
|
query: void 0,
|
|
130
130
|
limit,
|
|
@@ -11,7 +11,7 @@ import { PostPageComponent } from './components/pages/post-page.mjs';
|
|
|
11
11
|
function createPostsLoader(published, config) {
|
|
12
12
|
return async () => {
|
|
13
13
|
if (typeof window === "undefined") {
|
|
14
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
14
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
15
15
|
const context = {
|
|
16
16
|
path: published ? "/blog" : "/blog/drafts",
|
|
17
17
|
isSSR: true,
|
|
@@ -30,7 +30,7 @@ function createPostsLoader(published, config) {
|
|
|
30
30
|
baseURL: apiBaseURL,
|
|
31
31
|
basePath: apiBasePath
|
|
32
32
|
});
|
|
33
|
-
const queries = createBlogQueryKeys(client);
|
|
33
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
34
34
|
const listQuery = queries.posts.list({
|
|
35
35
|
query: void 0,
|
|
36
36
|
limit,
|
|
@@ -64,7 +64,7 @@ function createPostsLoader(published, config) {
|
|
|
64
64
|
function createPostLoader(slug, config) {
|
|
65
65
|
return async () => {
|
|
66
66
|
if (typeof window === "undefined") {
|
|
67
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
67
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
68
68
|
const context = {
|
|
69
69
|
path: `/blog/${slug}`,
|
|
70
70
|
params: { slug },
|
|
@@ -83,7 +83,7 @@ function createPostLoader(slug, config) {
|
|
|
83
83
|
baseURL: apiBaseURL,
|
|
84
84
|
basePath: apiBasePath
|
|
85
85
|
});
|
|
86
|
-
const queries = createBlogQueryKeys(client);
|
|
86
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
87
87
|
const postQuery = queries.posts.detail(slug);
|
|
88
88
|
await queryClient.prefetchQuery(postQuery);
|
|
89
89
|
if (hooks?.afterLoadPost) {
|
|
@@ -108,7 +108,7 @@ function createPostLoader(slug, config) {
|
|
|
108
108
|
function createTagLoader(tagSlug, config) {
|
|
109
109
|
return async () => {
|
|
110
110
|
if (typeof window === "undefined") {
|
|
111
|
-
const { queryClient, apiBasePath, apiBaseURL, hooks } = config;
|
|
111
|
+
const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
|
|
112
112
|
const context = {
|
|
113
113
|
path: `/blog/tag/${tagSlug}`,
|
|
114
114
|
params: { tagSlug },
|
|
@@ -122,7 +122,7 @@ function createTagLoader(tagSlug, config) {
|
|
|
122
122
|
baseURL: apiBaseURL,
|
|
123
123
|
basePath: apiBasePath
|
|
124
124
|
});
|
|
125
|
-
const queries = createBlogQueryKeys(client);
|
|
125
|
+
const queries = createBlogQueryKeys(client, headers);
|
|
126
126
|
const listQuery = queries.posts.list({
|
|
127
127
|
query: void 0,
|
|
128
128
|
limit,
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.Cr2JoQdo.cjs';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.Cr2JoQdo.mjs';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -2,6 +2,6 @@ export { B as BlogApiContext, c as BlogApiRouter, a as BlogBackendHooks, N as Ne
|
|
|
2
2
|
import '@btst/stack/plugins/api';
|
|
3
3
|
import 'better-call';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import '../../../shared/stack.
|
|
5
|
+
import '../../../shared/stack.Cr2JoQdo.js';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
import '@btst/stack/plugins/client';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.Cr2JoQdo.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,8 +81,8 @@ declare function useSuspenseTags(): {
|
|
|
81
81
|
};
|
|
82
82
|
/** Create a new post */
|
|
83
83
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
84
|
-
published: boolean;
|
|
85
84
|
title: string;
|
|
85
|
+
published: boolean;
|
|
86
86
|
content: string;
|
|
87
87
|
excerpt: string;
|
|
88
88
|
tags: ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.Cr2JoQdo.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,8 +81,8 @@ declare function useSuspenseTags(): {
|
|
|
81
81
|
};
|
|
82
82
|
/** Create a new post */
|
|
83
83
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
84
|
-
published: boolean;
|
|
85
84
|
title: string;
|
|
85
|
+
published: boolean;
|
|
86
86
|
content: string;
|
|
87
87
|
excerpt: string;
|
|
88
88
|
tags: ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.
|
|
2
|
+
import { S as SerializedPost, c as createPostSchema, u as updatePostSchema, a as SerializedTag } from '../../../../shared/stack.Cr2JoQdo.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,8 +81,8 @@ declare function useSuspenseTags(): {
|
|
|
81
81
|
};
|
|
82
82
|
/** Create a new post */
|
|
83
83
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
84
|
-
published: boolean;
|
|
85
84
|
title: string;
|
|
85
|
+
published: boolean;
|
|
86
86
|
content: string;
|
|
87
87
|
excerpt: string;
|
|
88
88
|
tags: ({
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.Cr2JoQdo.cjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.cjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -45,6 +45,7 @@ interface BlogClientConfig {
|
|
|
45
45
|
defaultImage?: string;
|
|
46
46
|
};
|
|
47
47
|
hooks?: BlogClientHooks;
|
|
48
|
+
headers?: HeadersInit;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Hooks for blog client plugin
|
|
@@ -357,6 +358,10 @@ interface BlogPluginOverrides {
|
|
|
357
358
|
* Whether to show the attribution
|
|
358
359
|
*/
|
|
359
360
|
showAttribution?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Optional headers to pass with API requests (e.g., for SSR auth)
|
|
363
|
+
*/
|
|
364
|
+
headers?: HeadersInit;
|
|
360
365
|
/**
|
|
361
366
|
* Called when a route is rendered
|
|
362
367
|
* @param routeName - Name of the route (e.g., 'posts', 'post', 'newPost')
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.Cr2JoQdo.mjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.mjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -45,6 +45,7 @@ interface BlogClientConfig {
|
|
|
45
45
|
defaultImage?: string;
|
|
46
46
|
};
|
|
47
47
|
hooks?: BlogClientHooks;
|
|
48
|
+
headers?: HeadersInit;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Hooks for blog client plugin
|
|
@@ -357,6 +358,10 @@ interface BlogPluginOverrides {
|
|
|
357
358
|
* Whether to show the attribution
|
|
358
359
|
*/
|
|
359
360
|
showAttribution?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Optional headers to pass with API requests (e.g., for SSR auth)
|
|
363
|
+
*/
|
|
364
|
+
headers?: HeadersInit;
|
|
360
365
|
/**
|
|
361
366
|
* Called when a route is rendered
|
|
362
367
|
* @param routeName - Name of the route (e.g., 'posts', 'post', 'newPost')
|
|
@@ -3,7 +3,7 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
4
|
import * as _btst_yar from '@btst/yar';
|
|
5
5
|
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { P as Post, S as SerializedPost } from '../../../shared/stack.
|
|
6
|
+
import { P as Post, S as SerializedPost } from '../../../shared/stack.Cr2JoQdo.js';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.js';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -45,6 +45,7 @@ interface BlogClientConfig {
|
|
|
45
45
|
defaultImage?: string;
|
|
46
46
|
};
|
|
47
47
|
hooks?: BlogClientHooks;
|
|
48
|
+
headers?: HeadersInit;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Hooks for blog client plugin
|
|
@@ -357,6 +358,10 @@ interface BlogPluginOverrides {
|
|
|
357
358
|
* Whether to show the attribution
|
|
358
359
|
*/
|
|
359
360
|
showAttribution?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Optional headers to pass with API requests (e.g., for SSR auth)
|
|
363
|
+
*/
|
|
364
|
+
headers?: HeadersInit;
|
|
360
365
|
/**
|
|
361
366
|
* Called when a route is rendered
|
|
362
367
|
* @param routeName - Name of the route (e.g., 'posts', 'post', 'newPost')
|