@btst/stack 1.1.5 → 1.1.6
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/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 +3 -3
- package/dist/plugins/blog/client/hooks/index.d.mts +3 -3
- package/dist/plugins/blog/client/hooks/index.d.ts +3 -3
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +6 -5
- package/dist/plugins/blog/query-keys.d.mts +6 -5
- package/dist/plugins/blog/query-keys.d.ts +6 -5
- package/package.json +5 -3
- package/src/plugins/blog/api/plugin.ts +14 -6
- package/dist/shared/{stack.CoPoHVfV.d.cts → stack.CbuN2zVV.d.cts} +2 -2
- package/dist/shared/{stack.CoPoHVfV.d.mts → stack.CbuN2zVV.d.mts} +2 -2
- package/dist/shared/{stack.CoPoHVfV.d.ts → stack.CbuN2zVV.d.ts} +2 -2
|
@@ -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 {
|
|
@@ -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.CbuN2zVV.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.CbuN2zVV.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.CbuN2zVV.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.CbuN2zVV.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,10 +81,10 @@ 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;
|
|
86
85
|
content: string;
|
|
87
86
|
excerpt: string;
|
|
87
|
+
published: boolean;
|
|
88
88
|
tags: ({
|
|
89
89
|
name: string;
|
|
90
90
|
} | {
|
|
@@ -93,8 +93,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
93
93
|
slug: string;
|
|
94
94
|
})[];
|
|
95
95
|
slug?: string | undefined;
|
|
96
|
-
createdAt?: Date | undefined;
|
|
97
96
|
publishedAt?: Date | undefined;
|
|
97
|
+
createdAt?: Date | undefined;
|
|
98
98
|
updatedAt?: Date | undefined;
|
|
99
99
|
image?: string | undefined;
|
|
100
100
|
}, unknown>;
|
|
@@ -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.CbuN2zVV.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,10 +81,10 @@ 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;
|
|
86
85
|
content: string;
|
|
87
86
|
excerpt: string;
|
|
87
|
+
published: boolean;
|
|
88
88
|
tags: ({
|
|
89
89
|
name: string;
|
|
90
90
|
} | {
|
|
@@ -93,8 +93,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
93
93
|
slug: string;
|
|
94
94
|
})[];
|
|
95
95
|
slug?: string | undefined;
|
|
96
|
-
createdAt?: Date | undefined;
|
|
97
96
|
publishedAt?: Date | undefined;
|
|
97
|
+
createdAt?: Date | undefined;
|
|
98
98
|
updatedAt?: Date | undefined;
|
|
99
99
|
image?: string | undefined;
|
|
100
100
|
}, unknown>;
|
|
@@ -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.CbuN2zVV.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
interface UsePostsOptions {
|
|
@@ -81,10 +81,10 @@ 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;
|
|
86
85
|
content: string;
|
|
87
86
|
excerpt: string;
|
|
87
|
+
published: boolean;
|
|
88
88
|
tags: ({
|
|
89
89
|
name: string;
|
|
90
90
|
} | {
|
|
@@ -93,8 +93,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
|
|
|
93
93
|
slug: string;
|
|
94
94
|
})[];
|
|
95
95
|
slug?: string | undefined;
|
|
96
|
-
createdAt?: Date | undefined;
|
|
97
96
|
publishedAt?: Date | undefined;
|
|
97
|
+
createdAt?: Date | undefined;
|
|
98
98
|
updatedAt?: Date | undefined;
|
|
99
99
|
image?: string | undefined;
|
|
100
100
|
}, unknown>;
|
|
@@ -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.CbuN2zVV.cjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.cjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -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.CbuN2zVV.mjs';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.mjs';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -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.CbuN2zVV.js';
|
|
7
7
|
export { UsePostsOptions, UsePostsResult } from './hooks/index.js';
|
|
8
8
|
import 'zod';
|
|
9
9
|
|
|
@@ -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.CbuN2zVV.cjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
|
24
24
|
params?: TParams;
|
|
25
25
|
query?: TQuery;
|
|
26
26
|
request?: Request;
|
|
27
|
+
headers?: Headers;
|
|
27
28
|
[key: string]: any;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
@@ -134,11 +135,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
134
135
|
content: string;
|
|
135
136
|
excerpt: string;
|
|
136
137
|
slug?: string | undefined;
|
|
137
|
-
published?: boolean | undefined;
|
|
138
|
-
createdAt?: unknown;
|
|
139
138
|
publishedAt?: unknown;
|
|
139
|
+
createdAt?: unknown;
|
|
140
140
|
updatedAt?: unknown;
|
|
141
141
|
image?: string | undefined;
|
|
142
|
+
published?: boolean | undefined;
|
|
142
143
|
tags?: ({
|
|
143
144
|
name: string;
|
|
144
145
|
} | {
|
|
@@ -173,14 +174,14 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
173
174
|
method: "POST";
|
|
174
175
|
body: z.ZodObject<{
|
|
175
176
|
slug: z.ZodOptional<z.ZodString>;
|
|
176
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
177
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
177
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
180
|
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
184
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
184
185
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
185
186
|
name: z.ZodString;
|
|
186
187
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -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.CbuN2zVV.mjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
|
24
24
|
params?: TParams;
|
|
25
25
|
query?: TQuery;
|
|
26
26
|
request?: Request;
|
|
27
|
+
headers?: Headers;
|
|
27
28
|
[key: string]: any;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
@@ -134,11 +135,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
134
135
|
content: string;
|
|
135
136
|
excerpt: string;
|
|
136
137
|
slug?: string | undefined;
|
|
137
|
-
published?: boolean | undefined;
|
|
138
|
-
createdAt?: unknown;
|
|
139
138
|
publishedAt?: unknown;
|
|
139
|
+
createdAt?: unknown;
|
|
140
140
|
updatedAt?: unknown;
|
|
141
141
|
image?: string | undefined;
|
|
142
|
+
published?: boolean | undefined;
|
|
142
143
|
tags?: ({
|
|
143
144
|
name: string;
|
|
144
145
|
} | {
|
|
@@ -173,14 +174,14 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
173
174
|
method: "POST";
|
|
174
175
|
body: z.ZodObject<{
|
|
175
176
|
slug: z.ZodOptional<z.ZodString>;
|
|
176
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
177
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
177
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
180
|
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
184
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
184
185
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
185
186
|
name: z.ZodString;
|
|
186
187
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -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.CbuN2zVV.js';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -24,6 +24,7 @@ interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
|
24
24
|
params?: TParams;
|
|
25
25
|
query?: TQuery;
|
|
26
26
|
request?: Request;
|
|
27
|
+
headers?: Headers;
|
|
27
28
|
[key: string]: any;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
@@ -134,11 +135,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
134
135
|
content: string;
|
|
135
136
|
excerpt: string;
|
|
136
137
|
slug?: string | undefined;
|
|
137
|
-
published?: boolean | undefined;
|
|
138
|
-
createdAt?: unknown;
|
|
139
138
|
publishedAt?: unknown;
|
|
139
|
+
createdAt?: unknown;
|
|
140
140
|
updatedAt?: unknown;
|
|
141
141
|
image?: string | undefined;
|
|
142
|
+
published?: boolean | undefined;
|
|
142
143
|
tags?: ({
|
|
143
144
|
name: string;
|
|
144
145
|
} | {
|
|
@@ -173,14 +174,14 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
173
174
|
method: "POST";
|
|
174
175
|
body: z.ZodObject<{
|
|
175
176
|
slug: z.ZodOptional<z.ZodString>;
|
|
176
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
177
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
177
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
178
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
179
179
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
180
180
|
title: z.ZodString;
|
|
181
181
|
content: z.ZodString;
|
|
182
182
|
excerpt: z.ZodString;
|
|
183
183
|
image: z.ZodOptional<z.ZodString>;
|
|
184
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
184
185
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
185
186
|
name: z.ZodString;
|
|
186
187
|
}, z.core.$strip>, z.ZodObject<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btst/stack",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "A composable, plugin-based library for building full-stack applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -158,20 +158,20 @@
|
|
|
158
158
|
},
|
|
159
159
|
"dependencies": {
|
|
160
160
|
"@btst/db": "1.0.2",
|
|
161
|
-
"@btst/yar": "1.1.1",
|
|
162
161
|
"@lukemorales/query-key-factory": "^1.3.4",
|
|
163
162
|
"@milkdown/crepe": "^7.17.1",
|
|
164
163
|
"@milkdown/kit": "^7.17.1",
|
|
165
|
-
"better-call": "1.0.19",
|
|
166
164
|
"slug": "^11.0.1"
|
|
167
165
|
},
|
|
168
166
|
"peerDependencies": {
|
|
167
|
+
"@btst/yar": ">=1.1.0",
|
|
169
168
|
"@hookform/resolvers": ">=5.0.0",
|
|
170
169
|
"@radix-ui/react-dialog": ">=1.1.0",
|
|
171
170
|
"@radix-ui/react-label": ">=2.1.0",
|
|
172
171
|
"@radix-ui/react-slot": ">=1.1.0",
|
|
173
172
|
"@radix-ui/react-switch": ">=1.1.0",
|
|
174
173
|
"@tanstack/react-query": "^5.0.0",
|
|
174
|
+
"better-call": ">=1.0.0",
|
|
175
175
|
"class-variance-authority": ">=0.7.0",
|
|
176
176
|
"clsx": ">=2.1.0",
|
|
177
177
|
"cmdk": ">=1.1.0",
|
|
@@ -197,9 +197,11 @@
|
|
|
197
197
|
},
|
|
198
198
|
"devDependencies": {
|
|
199
199
|
"@btst/adapter-memory": "1.0.2",
|
|
200
|
+
"@btst/yar": "1.1.1",
|
|
200
201
|
"@types/react": "^19.0.0",
|
|
201
202
|
"@types/slug": "^5.0.9",
|
|
202
203
|
"@workspace/ui": "workspace:*",
|
|
204
|
+
"better-call": "1.0.19",
|
|
203
205
|
"react": "^19.1.1",
|
|
204
206
|
"react-dom": "^19.1.1",
|
|
205
207
|
"react-error-boundary": "^4.1.2",
|
|
@@ -36,6 +36,7 @@ export interface BlogApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
|
36
36
|
params?: TParams;
|
|
37
37
|
query?: TQuery;
|
|
38
38
|
request?: Request;
|
|
39
|
+
headers?: Headers;
|
|
39
40
|
[key: string]: any;
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -282,8 +283,8 @@ export const blogBackendPlugin = (hooks?: BlogBackendHooks) =>
|
|
|
282
283
|
query: PostListQuerySchema,
|
|
283
284
|
},
|
|
284
285
|
async (ctx) => {
|
|
285
|
-
const { query } = ctx;
|
|
286
|
-
const context: BlogApiContext = { query };
|
|
286
|
+
const { query, headers } = ctx;
|
|
287
|
+
const context: BlogApiContext = { query, headers };
|
|
287
288
|
const tagCache = createTagCache();
|
|
288
289
|
const postTagCache = createPostTagCache();
|
|
289
290
|
|
|
@@ -402,7 +403,10 @@ export const blogBackendPlugin = (hooks?: BlogBackendHooks) =>
|
|
|
402
403
|
body: createPostSchema,
|
|
403
404
|
},
|
|
404
405
|
async (ctx) => {
|
|
405
|
-
const context: BlogApiContext = {
|
|
406
|
+
const context: BlogApiContext = {
|
|
407
|
+
body: ctx.body,
|
|
408
|
+
headers: ctx.headers,
|
|
409
|
+
};
|
|
406
410
|
const tagCache = createTagCache();
|
|
407
411
|
|
|
408
412
|
try {
|
|
@@ -475,6 +479,7 @@ export const blogBackendPlugin = (hooks?: BlogBackendHooks) =>
|
|
|
475
479
|
const context: BlogApiContext = {
|
|
476
480
|
body: ctx.body,
|
|
477
481
|
params: ctx.params,
|
|
482
|
+
headers: ctx.headers,
|
|
478
483
|
};
|
|
479
484
|
const tagCache = createTagCache();
|
|
480
485
|
|
|
@@ -583,7 +588,10 @@ export const blogBackendPlugin = (hooks?: BlogBackendHooks) =>
|
|
|
583
588
|
method: "DELETE",
|
|
584
589
|
},
|
|
585
590
|
async (ctx) => {
|
|
586
|
-
const context: BlogApiContext = {
|
|
591
|
+
const context: BlogApiContext = {
|
|
592
|
+
params: ctx.params,
|
|
593
|
+
headers: ctx.headers,
|
|
594
|
+
};
|
|
587
595
|
|
|
588
596
|
try {
|
|
589
597
|
// Authorization hook
|
|
@@ -634,8 +642,8 @@ export const blogBackendPlugin = (hooks?: BlogBackendHooks) =>
|
|
|
634
642
|
query: NextPreviousPostsQuerySchema,
|
|
635
643
|
},
|
|
636
644
|
async (ctx) => {
|
|
637
|
-
const { query } = ctx;
|
|
638
|
-
const context: BlogApiContext = { query };
|
|
645
|
+
const { query, headers } = ctx;
|
|
646
|
+
const context: BlogApiContext = { query, headers };
|
|
639
647
|
const tagCache = createTagCache();
|
|
640
648
|
const postTagCache = createPostTagCache();
|
|
641
649
|
|
|
@@ -36,14 +36,14 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
39
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
40
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
title: z.ZodString;
|
|
44
43
|
content: z.ZodString;
|
|
45
44
|
excerpt: z.ZodString;
|
|
46
45
|
image: z.ZodOptional<z.ZodString>;
|
|
46
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
47
47
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -36,14 +36,14 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
39
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
40
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
title: z.ZodString;
|
|
44
43
|
content: z.ZodString;
|
|
45
44
|
excerpt: z.ZodString;
|
|
46
45
|
image: z.ZodOptional<z.ZodString>;
|
|
46
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
47
47
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -36,14 +36,14 @@ interface SerializedTag extends Omit<Tag, "createdAt" | "updatedAt"> {
|
|
|
36
36
|
|
|
37
37
|
declare const createPostSchema: z.ZodObject<{
|
|
38
38
|
slug: z.ZodOptional<z.ZodString>;
|
|
39
|
-
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
-
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
41
39
|
publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
40
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
42
41
|
updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
43
42
|
title: z.ZodString;
|
|
44
43
|
content: z.ZodString;
|
|
45
44
|
excerpt: z.ZodString;
|
|
46
45
|
image: z.ZodOptional<z.ZodString>;
|
|
46
|
+
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
47
47
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
}, z.core.$strip>, z.ZodObject<{
|