@btst/stack 1.5.0 → 1.5.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.
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.cjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/edit-post-page.internal.mjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.cjs +9 -7
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/home-page.internal.mjs +9 -7
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/new-post-page.internal.cjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/new-post-page.internal.mjs +7 -6
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +7 -5
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +7 -5
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.cjs +5 -3
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/tag-page.internal.mjs +5 -3
- 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/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.cjs +19 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-editor-page.internal.mjs +19 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-list-page.internal.cjs +19 -6
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/content-list-page.internal.mjs +19 -6
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/dashboard-page.internal.cjs +18 -2
- package/dist/packages/better-stack/src/plugins/cms/client/components/pages/dashboard-page.internal.mjs +18 -2
- package/dist/packages/better-stack/src/plugins/cms/client/plugin.cjs +112 -22
- package/dist/packages/better-stack/src/plugins/cms/client/plugin.mjs +112 -22
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared → ui/src/hooks}/use-route-lifecycle.cjs +8 -9
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared → ui/src/hooks}/use-route-lifecycle.mjs +1 -2
- 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 +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 +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/cms/client/index.d.cts +66 -1
- package/dist/plugins/cms/client/index.d.mts +66 -1
- package/dist/plugins/cms/client/index.d.ts +66 -1
- package/package.json +1 -1
- package/src/plugins/blog/client/components/pages/edit-post-page.internal.tsx +4 -3
- package/src/plugins/blog/client/components/pages/home-page.internal.tsx +4 -2
- package/src/plugins/blog/client/components/pages/new-post-page.internal.tsx +4 -3
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +4 -2
- package/src/plugins/blog/client/components/pages/tag-page.internal.tsx +4 -2
- package/src/plugins/blog/client/plugin.tsx +10 -9
- package/src/plugins/cms/client/components/pages/content-editor-page.internal.tsx +21 -3
- package/src/plugins/cms/client/components/pages/content-list-page.internal.tsx +21 -6
- package/src/plugins/cms/client/components/pages/dashboard-page.internal.tsx +20 -3
- package/src/plugins/cms/client/index.ts +1 -1
- package/src/plugins/cms/client/plugin.tsx +236 -25
- package/src/plugins/blog/client/components/shared/use-route-lifecycle.tsx +0 -68
- package/dist/shared/{stack.CcI4sYJP.d.ts → stack.DLhzx1-D.d.cts} +1 -1
- package/dist/shared/{stack.CcI4sYJP.d.cts → stack.DLhzx1-D.d.mts} +1 -1
- package/dist/shared/{stack.CcI4sYJP.d.mts → stack.DLhzx1-D.d.ts} +1 -1
|
@@ -24,15 +24,41 @@ const ContentEditorPageComponent = React.lazy(
|
|
|
24
24
|
function createDashboardLoader(config) {
|
|
25
25
|
return async () => {
|
|
26
26
|
if (typeof window === "undefined") {
|
|
27
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
28
|
+
const context = {
|
|
29
|
+
path: "/cms",
|
|
30
|
+
isSSR: true,
|
|
31
|
+
apiBaseURL,
|
|
32
|
+
apiBasePath,
|
|
33
|
+
headers
|
|
34
|
+
};
|
|
33
35
|
try {
|
|
36
|
+
if (hooks?.beforeLoadDashboard) {
|
|
37
|
+
const canLoad = await hooks.beforeLoadDashboard(context);
|
|
38
|
+
if (!canLoad) {
|
|
39
|
+
throw new Error("Load prevented by beforeLoadDashboard hook");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const client$1 = client.createApiClient({
|
|
43
|
+
baseURL: apiBaseURL,
|
|
44
|
+
basePath: apiBasePath
|
|
45
|
+
});
|
|
46
|
+
const queries = plugins_cms_queryKeys.createCMSQueryKeys(client$1, headers);
|
|
34
47
|
await queryClient.prefetchQuery(queries.cmsTypes.list());
|
|
35
|
-
|
|
48
|
+
if (hooks?.afterLoadDashboard) {
|
|
49
|
+
await hooks.afterLoadDashboard(context);
|
|
50
|
+
}
|
|
51
|
+
const queryState = queryClient.getQueryState(
|
|
52
|
+
queries.cmsTypes.list().queryKey
|
|
53
|
+
);
|
|
54
|
+
if (queryState?.error && hooks?.onLoadError) {
|
|
55
|
+
const error = queryState.error instanceof Error ? queryState.error : new Error(String(queryState.error));
|
|
56
|
+
await hooks.onLoadError(error, context);
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (hooks?.onLoadError) {
|
|
60
|
+
await hooks.onLoadError(error, context);
|
|
61
|
+
}
|
|
36
62
|
}
|
|
37
63
|
}
|
|
38
64
|
};
|
|
@@ -40,14 +66,28 @@ function createDashboardLoader(config) {
|
|
|
40
66
|
function createContentListLoader(typeSlug, config) {
|
|
41
67
|
return async () => {
|
|
42
68
|
if (typeof window === "undefined") {
|
|
43
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
69
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
70
|
+
const context = {
|
|
71
|
+
path: `/cms/${typeSlug}`,
|
|
72
|
+
params: { typeSlug },
|
|
73
|
+
isSSR: true,
|
|
74
|
+
apiBaseURL,
|
|
75
|
+
apiBasePath,
|
|
76
|
+
headers
|
|
77
|
+
};
|
|
50
78
|
try {
|
|
79
|
+
if (hooks?.beforeLoadContentList) {
|
|
80
|
+
const canLoad = await hooks.beforeLoadContentList(typeSlug, context);
|
|
81
|
+
if (!canLoad) {
|
|
82
|
+
throw new Error("Load prevented by beforeLoadContentList hook");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const client$1 = client.createApiClient({
|
|
86
|
+
baseURL: apiBaseURL,
|
|
87
|
+
basePath: apiBasePath
|
|
88
|
+
});
|
|
89
|
+
const queries = plugins_cms_queryKeys.createCMSQueryKeys(client$1, headers);
|
|
90
|
+
const limit = 20;
|
|
51
91
|
await queryClient.prefetchQuery(queries.cmsTypes.list());
|
|
52
92
|
const listQuery = queries.cmsContent.list({
|
|
53
93
|
typeSlug,
|
|
@@ -70,7 +110,22 @@ function createContentListLoader(typeSlug, config) {
|
|
|
70
110
|
},
|
|
71
111
|
initialPageParam: 0
|
|
72
112
|
});
|
|
73
|
-
|
|
113
|
+
if (hooks?.afterLoadContentList) {
|
|
114
|
+
await hooks.afterLoadContentList(typeSlug, context);
|
|
115
|
+
}
|
|
116
|
+
const typesState = queryClient.getQueryState(
|
|
117
|
+
queries.cmsTypes.list().queryKey
|
|
118
|
+
);
|
|
119
|
+
const listState = queryClient.getQueryState(listQuery.queryKey);
|
|
120
|
+
const queryError = typesState?.error || listState?.error;
|
|
121
|
+
if (queryError && hooks?.onLoadError) {
|
|
122
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
123
|
+
await hooks.onLoadError(error, context);
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (hooks?.onLoadError) {
|
|
127
|
+
await hooks.onLoadError(error, context);
|
|
128
|
+
}
|
|
74
129
|
}
|
|
75
130
|
}
|
|
76
131
|
};
|
|
@@ -78,13 +133,31 @@ function createContentListLoader(typeSlug, config) {
|
|
|
78
133
|
function createContentEditorLoader(typeSlug, id, config) {
|
|
79
134
|
return async () => {
|
|
80
135
|
if (typeof window === "undefined") {
|
|
81
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
136
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
137
|
+
const context = {
|
|
138
|
+
path: id ? `/cms/${typeSlug}/${id}` : `/cms/${typeSlug}/new`,
|
|
139
|
+
params: id ? { typeSlug, id } : { typeSlug },
|
|
140
|
+
isSSR: true,
|
|
141
|
+
apiBaseURL,
|
|
142
|
+
apiBasePath,
|
|
143
|
+
headers
|
|
144
|
+
};
|
|
87
145
|
try {
|
|
146
|
+
if (hooks?.beforeLoadContentEditor) {
|
|
147
|
+
const canLoad = await hooks.beforeLoadContentEditor(
|
|
148
|
+
typeSlug,
|
|
149
|
+
id,
|
|
150
|
+
context
|
|
151
|
+
);
|
|
152
|
+
if (!canLoad) {
|
|
153
|
+
throw new Error("Load prevented by beforeLoadContentEditor hook");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const client$1 = client.createApiClient({
|
|
157
|
+
baseURL: apiBaseURL,
|
|
158
|
+
basePath: apiBasePath
|
|
159
|
+
});
|
|
160
|
+
const queries = plugins_cms_queryKeys.createCMSQueryKeys(client$1, headers);
|
|
88
161
|
const promises = [queryClient.prefetchQuery(queries.cmsTypes.list())];
|
|
89
162
|
if (id) {
|
|
90
163
|
promises.push(
|
|
@@ -92,7 +165,24 @@ function createContentEditorLoader(typeSlug, id, config) {
|
|
|
92
165
|
);
|
|
93
166
|
}
|
|
94
167
|
await Promise.all(promises);
|
|
95
|
-
|
|
168
|
+
if (hooks?.afterLoadContentEditor) {
|
|
169
|
+
await hooks.afterLoadContentEditor(typeSlug, id, context);
|
|
170
|
+
}
|
|
171
|
+
const typesState = queryClient.getQueryState(
|
|
172
|
+
queries.cmsTypes.list().queryKey
|
|
173
|
+
);
|
|
174
|
+
const itemState = id ? queryClient.getQueryState(
|
|
175
|
+
queries.cmsContent.detail(typeSlug, id).queryKey
|
|
176
|
+
) : null;
|
|
177
|
+
const queryError = typesState?.error || itemState?.error;
|
|
178
|
+
if (queryError && hooks?.onLoadError) {
|
|
179
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
180
|
+
await hooks.onLoadError(error, context);
|
|
181
|
+
}
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if (hooks?.onLoadError) {
|
|
184
|
+
await hooks.onLoadError(error, context);
|
|
185
|
+
}
|
|
96
186
|
}
|
|
97
187
|
}
|
|
98
188
|
};
|
|
@@ -22,15 +22,41 @@ const ContentEditorPageComponent = lazy(
|
|
|
22
22
|
function createDashboardLoader(config) {
|
|
23
23
|
return async () => {
|
|
24
24
|
if (typeof window === "undefined") {
|
|
25
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
26
|
+
const context = {
|
|
27
|
+
path: "/cms",
|
|
28
|
+
isSSR: true,
|
|
29
|
+
apiBaseURL,
|
|
30
|
+
apiBasePath,
|
|
31
|
+
headers
|
|
32
|
+
};
|
|
31
33
|
try {
|
|
34
|
+
if (hooks?.beforeLoadDashboard) {
|
|
35
|
+
const canLoad = await hooks.beforeLoadDashboard(context);
|
|
36
|
+
if (!canLoad) {
|
|
37
|
+
throw new Error("Load prevented by beforeLoadDashboard hook");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const client = createApiClient({
|
|
41
|
+
baseURL: apiBaseURL,
|
|
42
|
+
basePath: apiBasePath
|
|
43
|
+
});
|
|
44
|
+
const queries = createCMSQueryKeys(client, headers);
|
|
32
45
|
await queryClient.prefetchQuery(queries.cmsTypes.list());
|
|
33
|
-
|
|
46
|
+
if (hooks?.afterLoadDashboard) {
|
|
47
|
+
await hooks.afterLoadDashboard(context);
|
|
48
|
+
}
|
|
49
|
+
const queryState = queryClient.getQueryState(
|
|
50
|
+
queries.cmsTypes.list().queryKey
|
|
51
|
+
);
|
|
52
|
+
if (queryState?.error && hooks?.onLoadError) {
|
|
53
|
+
const error = queryState.error instanceof Error ? queryState.error : new Error(String(queryState.error));
|
|
54
|
+
await hooks.onLoadError(error, context);
|
|
55
|
+
}
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (hooks?.onLoadError) {
|
|
58
|
+
await hooks.onLoadError(error, context);
|
|
59
|
+
}
|
|
34
60
|
}
|
|
35
61
|
}
|
|
36
62
|
};
|
|
@@ -38,14 +64,28 @@ function createDashboardLoader(config) {
|
|
|
38
64
|
function createContentListLoader(typeSlug, config) {
|
|
39
65
|
return async () => {
|
|
40
66
|
if (typeof window === "undefined") {
|
|
41
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
67
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
68
|
+
const context = {
|
|
69
|
+
path: `/cms/${typeSlug}`,
|
|
70
|
+
params: { typeSlug },
|
|
71
|
+
isSSR: true,
|
|
72
|
+
apiBaseURL,
|
|
73
|
+
apiBasePath,
|
|
74
|
+
headers
|
|
75
|
+
};
|
|
48
76
|
try {
|
|
77
|
+
if (hooks?.beforeLoadContentList) {
|
|
78
|
+
const canLoad = await hooks.beforeLoadContentList(typeSlug, context);
|
|
79
|
+
if (!canLoad) {
|
|
80
|
+
throw new Error("Load prevented by beforeLoadContentList hook");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const client = createApiClient({
|
|
84
|
+
baseURL: apiBaseURL,
|
|
85
|
+
basePath: apiBasePath
|
|
86
|
+
});
|
|
87
|
+
const queries = createCMSQueryKeys(client, headers);
|
|
88
|
+
const limit = 20;
|
|
49
89
|
await queryClient.prefetchQuery(queries.cmsTypes.list());
|
|
50
90
|
const listQuery = queries.cmsContent.list({
|
|
51
91
|
typeSlug,
|
|
@@ -68,7 +108,22 @@ function createContentListLoader(typeSlug, config) {
|
|
|
68
108
|
},
|
|
69
109
|
initialPageParam: 0
|
|
70
110
|
});
|
|
71
|
-
|
|
111
|
+
if (hooks?.afterLoadContentList) {
|
|
112
|
+
await hooks.afterLoadContentList(typeSlug, context);
|
|
113
|
+
}
|
|
114
|
+
const typesState = queryClient.getQueryState(
|
|
115
|
+
queries.cmsTypes.list().queryKey
|
|
116
|
+
);
|
|
117
|
+
const listState = queryClient.getQueryState(listQuery.queryKey);
|
|
118
|
+
const queryError = typesState?.error || listState?.error;
|
|
119
|
+
if (queryError && hooks?.onLoadError) {
|
|
120
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
121
|
+
await hooks.onLoadError(error, context);
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (hooks?.onLoadError) {
|
|
125
|
+
await hooks.onLoadError(error, context);
|
|
126
|
+
}
|
|
72
127
|
}
|
|
73
128
|
}
|
|
74
129
|
};
|
|
@@ -76,13 +131,31 @@ function createContentListLoader(typeSlug, config) {
|
|
|
76
131
|
function createContentEditorLoader(typeSlug, id, config) {
|
|
77
132
|
return async () => {
|
|
78
133
|
if (typeof window === "undefined") {
|
|
79
|
-
const { queryClient, apiBasePath, apiBaseURL, headers } = config;
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
134
|
+
const { queryClient, apiBasePath, apiBaseURL, headers, hooks } = config;
|
|
135
|
+
const context = {
|
|
136
|
+
path: id ? `/cms/${typeSlug}/${id}` : `/cms/${typeSlug}/new`,
|
|
137
|
+
params: id ? { typeSlug, id } : { typeSlug },
|
|
138
|
+
isSSR: true,
|
|
139
|
+
apiBaseURL,
|
|
140
|
+
apiBasePath,
|
|
141
|
+
headers
|
|
142
|
+
};
|
|
85
143
|
try {
|
|
144
|
+
if (hooks?.beforeLoadContentEditor) {
|
|
145
|
+
const canLoad = await hooks.beforeLoadContentEditor(
|
|
146
|
+
typeSlug,
|
|
147
|
+
id,
|
|
148
|
+
context
|
|
149
|
+
);
|
|
150
|
+
if (!canLoad) {
|
|
151
|
+
throw new Error("Load prevented by beforeLoadContentEditor hook");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const client = createApiClient({
|
|
155
|
+
baseURL: apiBaseURL,
|
|
156
|
+
basePath: apiBasePath
|
|
157
|
+
});
|
|
158
|
+
const queries = createCMSQueryKeys(client, headers);
|
|
86
159
|
const promises = [queryClient.prefetchQuery(queries.cmsTypes.list())];
|
|
87
160
|
if (id) {
|
|
88
161
|
promises.push(
|
|
@@ -90,7 +163,24 @@ function createContentEditorLoader(typeSlug, id, config) {
|
|
|
90
163
|
);
|
|
91
164
|
}
|
|
92
165
|
await Promise.all(promises);
|
|
93
|
-
|
|
166
|
+
if (hooks?.afterLoadContentEditor) {
|
|
167
|
+
await hooks.afterLoadContentEditor(typeSlug, id, context);
|
|
168
|
+
}
|
|
169
|
+
const typesState = queryClient.getQueryState(
|
|
170
|
+
queries.cmsTypes.list().queryKey
|
|
171
|
+
);
|
|
172
|
+
const itemState = id ? queryClient.getQueryState(
|
|
173
|
+
queries.cmsContent.detail(typeSlug, id).queryKey
|
|
174
|
+
) : null;
|
|
175
|
+
const queryError = typesState?.error || itemState?.error;
|
|
176
|
+
if (queryError && hooks?.onLoadError) {
|
|
177
|
+
const error = queryError instanceof Error ? queryError : new Error(String(queryError));
|
|
178
|
+
await hooks.onLoadError(error, context);
|
|
179
|
+
}
|
|
180
|
+
} catch (error) {
|
|
181
|
+
if (hooks?.onLoadError) {
|
|
182
|
+
await hooks.onLoadError(error, context);
|
|
183
|
+
}
|
|
94
184
|
}
|
|
95
185
|
}
|
|
96
186
|
};
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const React = require('react');
|
|
5
|
-
const context = require('@btst/stack/context');
|
|
6
5
|
|
|
7
6
|
function useRouteLifecycle({
|
|
8
7
|
routeName,
|
|
9
|
-
context
|
|
8
|
+
context,
|
|
9
|
+
overrides,
|
|
10
10
|
beforeRenderHook
|
|
11
11
|
}) {
|
|
12
|
-
const overrides = context.usePluginOverrides("blog");
|
|
13
12
|
if (beforeRenderHook) {
|
|
14
|
-
const canRender = beforeRenderHook(overrides, context
|
|
13
|
+
const canRender = beforeRenderHook(overrides, context);
|
|
15
14
|
if (!canRender) {
|
|
16
15
|
const error = new Error(`Unauthorized: Cannot render ${routeName}`);
|
|
17
16
|
if (overrides.onRouteError) {
|
|
18
17
|
try {
|
|
19
|
-
const result = overrides.onRouteError(routeName, error, context
|
|
18
|
+
const result = overrides.onRouteError(routeName, error, context);
|
|
20
19
|
if (result instanceof Promise) {
|
|
21
20
|
result.catch(() => {
|
|
22
21
|
});
|
|
@@ -30,21 +29,21 @@ function useRouteLifecycle({
|
|
|
30
29
|
React.useEffect(() => {
|
|
31
30
|
if (overrides.onRouteRender) {
|
|
32
31
|
try {
|
|
33
|
-
const result = overrides.onRouteRender(routeName, context
|
|
32
|
+
const result = overrides.onRouteRender(routeName, context);
|
|
34
33
|
if (result instanceof Promise) {
|
|
35
34
|
result.catch((error) => {
|
|
36
35
|
if (overrides.onRouteError) {
|
|
37
|
-
overrides.onRouteError(routeName, error, context
|
|
36
|
+
overrides.onRouteError(routeName, error, context);
|
|
38
37
|
}
|
|
39
38
|
});
|
|
40
39
|
}
|
|
41
40
|
} catch (error) {
|
|
42
41
|
if (overrides.onRouteError) {
|
|
43
|
-
overrides.onRouteError(routeName, error, context
|
|
42
|
+
overrides.onRouteError(routeName, error, context);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
}, [routeName, overrides, context
|
|
46
|
+
}, [routeName, overrides, context]);
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
exports.useRouteLifecycle = useRouteLifecycle;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { usePluginOverrides } from '@btst/stack/context';
|
|
4
3
|
|
|
5
4
|
function useRouteLifecycle({
|
|
6
5
|
routeName,
|
|
7
6
|
context,
|
|
7
|
+
overrides,
|
|
8
8
|
beforeRenderHook
|
|
9
9
|
}) {
|
|
10
|
-
const overrides = usePluginOverrides("blog");
|
|
11
10
|
if (beforeRenderHook) {
|
|
12
11
|
const canRender = beforeRenderHook(overrides, context);
|
|
13
12
|
if (!canRender) {
|
|
@@ -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.DLhzx1-D.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.DLhzx1-D.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.DLhzx1-D.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.DLhzx1-D.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
published: boolean;
|
|
132
131
|
title: string;
|
|
132
|
+
published: boolean;
|
|
133
133
|
content: string;
|
|
134
134
|
excerpt: string;
|
|
135
135
|
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.DLhzx1-D.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
published: boolean;
|
|
132
131
|
title: string;
|
|
132
|
+
published: boolean;
|
|
133
133
|
content: string;
|
|
134
134
|
excerpt: string;
|
|
135
135
|
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.DLhzx1-D.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -128,8 +128,8 @@ declare function useSuspenseTags(): {
|
|
|
128
128
|
};
|
|
129
129
|
/** Create a new post */
|
|
130
130
|
declare function useCreatePost(): _tanstack_react_query.UseMutationResult<SerializedPost | null, Error, {
|
|
131
|
-
published: boolean;
|
|
132
131
|
title: string;
|
|
132
|
+
published: boolean;
|
|
133
133
|
content: string;
|
|
134
134
|
excerpt: string;
|
|
135
135
|
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.DLhzx1-D.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.DLhzx1-D.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.DLhzx1-D.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.DLhzx1-D.cjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -144,10 +144,10 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
144
144
|
readonly createPost: better_call.StrictEndpoint<"/posts", {
|
|
145
145
|
method: "POST";
|
|
146
146
|
body: z.ZodObject<{
|
|
147
|
+
title: z.ZodString;
|
|
147
148
|
slug: z.ZodOptional<z.ZodString>;
|
|
148
149
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
149
150
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
150
|
-
title: z.ZodString;
|
|
151
151
|
content: z.ZodString;
|
|
152
152
|
excerpt: z.ZodString;
|
|
153
153
|
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.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.DLhzx1-D.mjs';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -144,10 +144,10 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
144
144
|
readonly createPost: better_call.StrictEndpoint<"/posts", {
|
|
145
145
|
method: "POST";
|
|
146
146
|
body: z.ZodObject<{
|
|
147
|
+
title: z.ZodString;
|
|
147
148
|
slug: z.ZodOptional<z.ZodString>;
|
|
148
149
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
149
150
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
150
|
-
title: z.ZodString;
|
|
151
151
|
content: z.ZodString;
|
|
152
152
|
excerpt: z.ZodString;
|
|
153
153
|
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.
|
|
4
|
+
import { c as createPostSchema, u as updatePostSchema, P as Post, T as Tag, S as SerializedPost, a as SerializedTag } from '../../shared/stack.DLhzx1-D.js';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
6
|
import { createApiClient } from '@btst/stack/plugins/client';
|
|
7
7
|
|
|
@@ -144,10 +144,10 @@ declare const blogBackendPlugin: (hooks?: BlogBackendHooks) => _btst_stack_plugi
|
|
|
144
144
|
readonly createPost: better_call.StrictEndpoint<"/posts", {
|
|
145
145
|
method: "POST";
|
|
146
146
|
body: z.ZodObject<{
|
|
147
|
+
title: z.ZodString;
|
|
147
148
|
slug: z.ZodOptional<z.ZodString>;
|
|
148
149
|
published: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
149
150
|
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
150
|
-
title: z.ZodString;
|
|
151
151
|
content: z.ZodString;
|
|
152
152
|
excerpt: z.ZodString;
|
|
153
153
|
image: z.ZodOptional<z.ZodString>;
|