@btst/stack 1.1.9 → 1.1.10

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.
@@ -71,12 +71,12 @@ function createPostsLoader(published, config) {
71
71
  }
72
72
  };
73
73
  }
74
- function createPostLoader(slug, config) {
74
+ function createPostLoader(slug, config, path) {
75
75
  return async () => {
76
76
  if (typeof window === "undefined") {
77
77
  const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
78
78
  const context = {
79
- path: `/blog/${slug}`,
79
+ path: path ?? `/blog/${slug}`,
80
80
  params: { slug },
81
81
  isSSR: true,
82
82
  apiBaseURL,
@@ -434,7 +434,7 @@ const blogClientPlugin = (config) => client.defineClientPlugin({
434
434
  editPost: yar.createRoute("/blog/:slug/edit", ({ params: { slug } }) => {
435
435
  return {
436
436
  PageComponent: () => /* @__PURE__ */ jsxRuntime.jsx(editPostPage.EditPostPageComponent, { slug }),
437
- loader: createPostLoader(slug, config),
437
+ loader: createPostLoader(slug, config, `/blog/${slug}/edit`),
438
438
  meta: createEditPostMeta(slug, config)
439
439
  };
440
440
  }),
@@ -69,12 +69,12 @@ function createPostsLoader(published, config) {
69
69
  }
70
70
  };
71
71
  }
72
- function createPostLoader(slug, config) {
72
+ function createPostLoader(slug, config, path) {
73
73
  return async () => {
74
74
  if (typeof window === "undefined") {
75
75
  const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
76
76
  const context = {
77
- path: `/blog/${slug}`,
77
+ path: path ?? `/blog/${slug}`,
78
78
  params: { slug },
79
79
  isSSR: true,
80
80
  apiBaseURL,
@@ -432,7 +432,7 @@ const blogClientPlugin = (config) => defineClientPlugin({
432
432
  editPost: createRoute("/blog/:slug/edit", ({ params: { slug } }) => {
433
433
  return {
434
434
  PageComponent: () => /* @__PURE__ */ jsx(EditPostPageComponent, { slug }),
435
- loader: createPostLoader(slug, config),
435
+ loader: createPostLoader(slug, config, `/blog/${slug}/edit`),
436
436
  meta: createEditPostMeta(slug, config)
437
437
  };
438
438
  }),
@@ -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.CoPoHVfV.cjs';
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.CoPoHVfV.mjs';
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.CoPoHVfV.js';
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.CoPoHVfV.cjs';
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.CoPoHVfV.mjs';
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.CoPoHVfV.js';
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.CoPoHVfV.cjs';
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
 
@@ -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.CoPoHVfV.mjs';
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
 
@@ -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.CoPoHVfV.js';
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
 
@@ -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.CoPoHVfV.cjs';
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';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { createApiClient } from '@btst/stack/plugins/client';
7
7
 
@@ -173,12 +173,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
173
173
  options: {
174
174
  method: "POST";
175
175
  body: z.ZodObject<{
176
+ title: z.ZodString;
176
177
  slug: z.ZodOptional<z.ZodString>;
177
178
  published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
178
179
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
179
180
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
180
181
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
181
- title: z.ZodString;
182
182
  content: z.ZodString;
183
183
  excerpt: z.ZodString;
184
184
  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.CoPoHVfV.mjs';
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';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { createApiClient } from '@btst/stack/plugins/client';
7
7
 
@@ -173,12 +173,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
173
173
  options: {
174
174
  method: "POST";
175
175
  body: z.ZodObject<{
176
+ title: z.ZodString;
176
177
  slug: z.ZodOptional<z.ZodString>;
177
178
  published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
178
179
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
179
180
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
180
181
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
181
- title: z.ZodString;
182
182
  content: z.ZodString;
183
183
  excerpt: z.ZodString;
184
184
  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.CoPoHVfV.js';
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';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { createApiClient } from '@btst/stack/plugins/client';
7
7
 
@@ -173,12 +173,12 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
173
173
  options: {
174
174
  method: "POST";
175
175
  body: z.ZodObject<{
176
+ title: z.ZodString;
176
177
  slug: z.ZodOptional<z.ZodString>;
177
178
  published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
178
179
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
179
180
  publishedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
180
181
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
181
- title: z.ZodString;
182
182
  content: z.ZodString;
183
183
  excerpt: z.ZodString;
184
184
  image: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btst/stack",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "A composable, plugin-based library for building full-stack applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -181,13 +181,17 @@ function createPostsLoader(published: boolean, config: BlogClientConfig) {
181
181
  };
182
182
  }
183
183
 
184
- function createPostLoader(slug: string, config: BlogClientConfig) {
184
+ function createPostLoader(
185
+ slug: string,
186
+ config: BlogClientConfig,
187
+ path?: string,
188
+ ) {
185
189
  return async () => {
186
190
  if (typeof window === "undefined") {
187
191
  const { queryClient, apiBasePath, apiBaseURL, hooks, headers } = config;
188
192
 
189
193
  const context: LoaderContext = {
190
- path: `/blog/${slug}`,
194
+ path: path ?? `/blog/${slug}`,
191
195
  params: { slug },
192
196
  isSSR: true,
193
197
  apiBaseURL,
@@ -648,7 +652,7 @@ export const blogClientPlugin = (config: BlogClientConfig) =>
648
652
  editPost: createRoute("/blog/:slug/edit", ({ params: { slug } }) => {
649
653
  return {
650
654
  PageComponent: () => <EditPostPageComponent slug={slug} />,
651
- loader: createPostLoader(slug, config),
655
+ loader: createPostLoader(slug, config, `/blog/${slug}/edit`),
652
656
  meta: createEditPostMeta(slug, config),
653
657
  };
654
658
  }),
@@ -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>;