@btst/stack 1.2.2 → 1.3.1

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 (32) hide show
  1. package/dist/packages/better-stack/src/plugins/blog/api/plugin.cjs +101 -120
  2. package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +101 -120
  3. package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +1 -1
  4. package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +1 -1
  5. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/on-this-page.cjs +1 -1
  6. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/on-this-page.mjs +1 -1
  7. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.cjs +2 -2
  8. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.mjs +2 -2
  9. package/dist/packages/better-stack/src/plugins/blog/db.cjs +12 -2
  10. package/dist/packages/better-stack/src/plugins/blog/db.mjs +12 -2
  11. package/dist/plugins/blog/api/index.d.cts +1 -1
  12. package/dist/plugins/blog/api/index.d.mts +1 -1
  13. package/dist/plugins/blog/api/index.d.ts +1 -1
  14. package/dist/plugins/blog/client/hooks/index.d.cts +3 -3
  15. package/dist/plugins/blog/client/hooks/index.d.mts +3 -3
  16. package/dist/plugins/blog/client/hooks/index.d.ts +3 -3
  17. package/dist/plugins/blog/client/index.d.cts +1 -1
  18. package/dist/plugins/blog/client/index.d.mts +1 -1
  19. package/dist/plugins/blog/client/index.d.ts +1 -1
  20. package/dist/plugins/blog/query-keys.d.cts +6 -6
  21. package/dist/plugins/blog/query-keys.d.mts +6 -6
  22. package/dist/plugins/blog/query-keys.d.ts +6 -6
  23. package/package.json +3 -3
  24. package/src/plugins/blog/api/plugin.ts +122 -147
  25. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +1 -1
  26. package/src/plugins/blog/client/components/shared/on-this-page.tsx +1 -1
  27. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +2 -2
  28. package/src/plugins/blog/db.ts +10 -0
  29. package/src/plugins/blog/types.ts +7 -0
  30. package/dist/shared/{stack.Cr2JoQdo.d.cts → stack.CbuN2zVV.d.cts} +3 -3
  31. package/dist/shared/{stack.Cr2JoQdo.d.mts → stack.CbuN2zVV.d.mts} +3 -3
  32. package/dist/shared/{stack.Cr2JoQdo.d.ts → stack.CbuN2zVV.d.ts} +3 -3
@@ -40,7 +40,7 @@ function OnThisPage({ markdown, className }) {
40
40
  className
41
41
  ),
42
42
  "aria-label": "Table of contents",
43
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto px-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 p-4 pt-0 text-sm", children: [
43
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-y-auto px-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 p-2 pt-0 text-sm", children: [
44
44
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 font-semibold text-muted-foreground sticky top-0 h-6 text-xs", children: [
45
45
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TextAlignStart, { className: "w-3 h-3" }),
46
46
  " ",
@@ -38,7 +38,7 @@ function OnThisPage({ markdown, className }) {
38
38
  className
39
39
  ),
40
40
  "aria-label": "Table of contents",
41
- children: /* @__PURE__ */ jsx("div", { className: "overflow-y-auto px-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 p-4 pt-0 text-sm", children: [
41
+ children: /* @__PURE__ */ jsx("div", { className: "overflow-y-auto px-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 p-2 pt-0 text-sm", children: [
42
42
  /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 font-semibold text-muted-foreground sticky top-0 h-6 text-xs", children: [
43
43
  /* @__PURE__ */ jsx(TextAlignStart, { className: "w-3 h-3" }),
44
44
  " ",
@@ -47,8 +47,8 @@ function RecentPostsCarousel({ posts, ref }) {
47
47
  },
48
48
  post.id
49
49
  )) }),
50
- /* @__PURE__ */ jsxRuntime.jsx(carousel.CarouselPrevious, { className: "-left-4 lg:-left-12 hover:cursor-pointer" }),
51
- /* @__PURE__ */ jsxRuntime.jsx(carousel.CarouselNext, { className: "-right-4 lg:-right-12 hover:cursor-pointer" })
50
+ /* @__PURE__ */ jsxRuntime.jsx(carousel.CarouselPrevious, { className: "-left-4 z-50 hover:cursor-pointer" }),
51
+ /* @__PURE__ */ jsxRuntime.jsx(carousel.CarouselNext, { className: "-right-4 z-50 hover:cursor-pointer" })
52
52
  ]
53
53
  }
54
54
  ) })
@@ -45,8 +45,8 @@ function RecentPostsCarousel({ posts, ref }) {
45
45
  },
46
46
  post.id
47
47
  )) }),
48
- /* @__PURE__ */ jsx(CarouselPrevious, { className: "-left-4 lg:-left-12 hover:cursor-pointer" }),
49
- /* @__PURE__ */ jsx(CarouselNext, { className: "-right-4 lg:-right-12 hover:cursor-pointer" })
48
+ /* @__PURE__ */ jsx(CarouselPrevious, { className: "-left-4 z-50 hover:cursor-pointer" }),
49
+ /* @__PURE__ */ jsx(CarouselNext, { className: "-right-4 z-50 hover:cursor-pointer" })
50
50
  ]
51
51
  }
52
52
  ) })
@@ -77,11 +77,21 @@ const blogSchema = db.createDbPlugin("blog", {
77
77
  fields: {
78
78
  postId: {
79
79
  type: "string",
80
- required: true
80
+ required: true,
81
+ references: {
82
+ model: "post",
83
+ field: "id",
84
+ onDelete: "cascade"
85
+ }
81
86
  },
82
87
  tagId: {
83
88
  type: "string",
84
- required: true
89
+ required: true,
90
+ references: {
91
+ model: "tag",
92
+ field: "id",
93
+ onDelete: "cascade"
94
+ }
85
95
  }
86
96
  }
87
97
  }
@@ -75,11 +75,21 @@ const blogSchema = createDbPlugin("blog", {
75
75
  fields: {
76
76
  postId: {
77
77
  type: "string",
78
- required: true
78
+ required: true,
79
+ references: {
80
+ model: "post",
81
+ field: "id",
82
+ onDelete: "cascade"
83
+ }
79
84
  },
80
85
  tagId: {
81
86
  type: "string",
82
- required: true
87
+ required: true,
88
+ references: {
89
+ model: "tag",
90
+ field: "id",
91
+ onDelete: "cascade"
92
+ }
83
93
  }
84
94
  }
85
95
  }
@@ -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.Cr2JoQdo.cjs';
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.Cr2JoQdo.mjs';
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.Cr2JoQdo.js';
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.Cr2JoQdo.cjs';
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
  /**
@@ -129,9 +129,9 @@ declare function useSuspenseTags(): {
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
131
  title: string;
132
- published: boolean;
133
132
  content: string;
134
133
  excerpt: string;
134
+ published: boolean;
135
135
  tags: ({
136
136
  name: string;
137
137
  } | {
@@ -140,8 +140,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
140
140
  slug: string;
141
141
  })[];
142
142
  slug?: string | undefined;
143
- createdAt?: Date | undefined;
144
143
  publishedAt?: Date | undefined;
144
+ createdAt?: Date | undefined;
145
145
  updatedAt?: Date | undefined;
146
146
  image?: string | undefined;
147
147
  }, 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.Cr2JoQdo.mjs';
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
  /**
@@ -129,9 +129,9 @@ declare function useSuspenseTags(): {
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
131
  title: string;
132
- published: boolean;
133
132
  content: string;
134
133
  excerpt: string;
134
+ published: boolean;
135
135
  tags: ({
136
136
  name: string;
137
137
  } | {
@@ -140,8 +140,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
140
140
  slug: string;
141
141
  })[];
142
142
  slug?: string | undefined;
143
- createdAt?: Date | undefined;
144
143
  publishedAt?: Date | undefined;
144
+ createdAt?: Date | undefined;
145
145
  updatedAt?: Date | undefined;
146
146
  image?: string | undefined;
147
147
  }, 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.Cr2JoQdo.js';
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
  /**
@@ -129,9 +129,9 @@ declare function useSuspenseTags(): {
129
129
  /** Create a new post */
130
130
  declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
131
131
  title: string;
132
- published: boolean;
133
132
  content: string;
134
133
  excerpt: string;
134
+ published: boolean;
135
135
  tags: ({
136
136
  name: string;
137
137
  } | {
@@ -140,8 +140,8 @@ declare function useCreatePost(): _tanstack_react_query.UseMutationResult<Serial
140
140
  slug: string;
141
141
  })[];
142
142
  slug?: string | undefined;
143
- createdAt?: Date | undefined;
144
143
  publishedAt?: Date | undefined;
144
+ createdAt?: Date | undefined;
145
145
  updatedAt?: Date | undefined;
146
146
  image?: string | undefined;
147
147
  }, 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.Cr2JoQdo.cjs';
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.Cr2JoQdo.mjs';
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.Cr2JoQdo.js';
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.Cr2JoQdo.cjs';
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
 
@@ -197,11 +197,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
197
197
  content: string;
198
198
  excerpt: string;
199
199
  slug?: string | undefined;
200
- published?: boolean | undefined;
201
- createdAt?: unknown;
202
200
  publishedAt?: unknown;
201
+ createdAt?: unknown;
203
202
  updatedAt?: unknown;
204
203
  image?: string | undefined;
204
+ published?: boolean | undefined;
205
205
  tags?: ({
206
206
  name: string;
207
207
  } | {
@@ -235,15 +235,15 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
235
235
  options: {
236
236
  method: "POST";
237
237
  body: z.ZodObject<{
238
- title: z.ZodString;
239
238
  slug: z.ZodOptional<z.ZodString>;
240
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
241
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
239
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
240
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
243
241
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
+ title: z.ZodString;
244
243
  content: z.ZodString;
245
244
  excerpt: z.ZodString;
246
245
  image: z.ZodOptional<z.ZodString>;
246
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
247
247
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
248
248
  name: z.ZodString;
249
249
  }, 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.Cr2JoQdo.mjs';
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
 
@@ -197,11 +197,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
197
197
  content: string;
198
198
  excerpt: string;
199
199
  slug?: string | undefined;
200
- published?: boolean | undefined;
201
- createdAt?: unknown;
202
200
  publishedAt?: unknown;
201
+ createdAt?: unknown;
203
202
  updatedAt?: unknown;
204
203
  image?: string | undefined;
204
+ published?: boolean | undefined;
205
205
  tags?: ({
206
206
  name: string;
207
207
  } | {
@@ -235,15 +235,15 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
235
235
  options: {
236
236
  method: "POST";
237
237
  body: z.ZodObject<{
238
- title: z.ZodString;
239
238
  slug: z.ZodOptional<z.ZodString>;
240
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
241
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
239
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
240
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
243
241
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
+ title: z.ZodString;
244
243
  content: z.ZodString;
245
244
  excerpt: z.ZodString;
246
245
  image: z.ZodOptional<z.ZodString>;
246
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
247
247
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
248
248
  name: z.ZodString;
249
249
  }, 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.Cr2JoQdo.js';
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
 
@@ -197,11 +197,11 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
197
197
  content: string;
198
198
  excerpt: string;
199
199
  slug?: string | undefined;
200
- published?: boolean | undefined;
201
- createdAt?: unknown;
202
200
  publishedAt?: unknown;
201
+ createdAt?: unknown;
203
202
  updatedAt?: unknown;
204
203
  image?: string | undefined;
204
+ published?: boolean | undefined;
205
205
  tags?: ({
206
206
  name: string;
207
207
  } | {
@@ -235,15 +235,15 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
235
235
  options: {
236
236
  method: "POST";
237
237
  body: z.ZodObject<{
238
- title: z.ZodString;
239
238
  slug: z.ZodOptional<z.ZodString>;
240
- published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
241
- createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
239
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
240
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
243
241
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
242
+ title: z.ZodString;
244
243
  content: z.ZodString;
245
244
  excerpt: z.ZodString;
246
245
  image: z.ZodOptional<z.ZodString>;
246
+ published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
247
247
  tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
248
248
  name: z.ZodString;
249
249
  }, z.core.$strip>, z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btst/stack",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "A composable, plugin-based library for building full-stack applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -157,7 +157,7 @@
157
157
  }
158
158
  },
159
159
  "dependencies": {
160
- "@btst/db": "2.0.1",
160
+ "@btst/db": "2.0.3",
161
161
  "@lukemorales/query-key-factory": "^1.3.4",
162
162
  "@milkdown/crepe": "^7.17.1",
163
163
  "@milkdown/kit": "^7.17.1",
@@ -196,7 +196,7 @@
196
196
  "zod": ">=3.24.0"
197
197
  },
198
198
  "devDependencies": {
199
- "@btst/adapter-memory": "2.0.1",
199
+ "@btst/adapter-memory": "2.0.3",
200
200
  "@btst/yar": "1.1.1",
201
201
  "@types/react": "^19.0.0",
202
202
  "@types/slug": "^5.0.9",