create-vexcms 0.0.19 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vexcms",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-vexcms": "./dist/index.js"
@@ -178,6 +178,9 @@ export const updateDocument = mutation({
178
178
  const match = requireCollection(collectionSlug)
179
179
  const { user, roles } = await requireUser(ctx)
180
180
 
181
+ // Fetch existing document for permission check (dynamic callbacks may need current data)
182
+ const existingDoc = await ctx.db.get(documentId as any)
183
+
181
184
  const fieldNames = Object.keys(fields as Record<string, unknown>)
182
185
  checkPermission({
183
186
  access,
@@ -186,7 +189,7 @@ export const updateDocument = mutation({
186
189
  resource: collectionSlug,
187
190
  action: "update",
188
191
  fields: fieldNames,
189
- data: fields as Record<string, unknown>,
192
+ data: (existingDoc as Record<string, unknown>) ?? (fields as Record<string, unknown>),
190
193
  })
191
194
 
192
195
  return await Collections.updateDocument<DataModel>({
@@ -242,12 +245,16 @@ export const deleteDocument = mutation({
242
245
  const match = requireCollection(collectionSlug)
243
246
  const { user, roles } = await requireUser(ctx)
244
247
 
248
+ // Fetch the document so dynamic permission callbacks can access its data
249
+ const doc = await ctx.db.get(documentId as any)
250
+
245
251
  checkPermission({
246
252
  access,
247
253
  user,
248
254
  userRoles: roles,
249
255
  resource: collectionSlug,
250
256
  action: "delete",
257
+ data: (doc as Record<string, unknown>) ?? {},
251
258
  })
252
259
 
253
260
  await Collections.deleteDocument<DataModel>({
@@ -269,13 +276,18 @@ export const bulkDeleteDocuments = mutation({
269
276
  handler: async (ctx, { collectionSlug, documentIds }) => {
270
277
  const { user, roles } = await requireUser(ctx)
271
278
 
272
- checkPermission({
273
- access,
274
- user,
275
- userRoles: roles,
276
- resource: collectionSlug,
277
- action: "delete",
278
- })
279
+ // Check permission for each document individually (dynamic callbacks need doc data)
280
+ for (const docId of documentIds) {
281
+ const doc = await ctx.db.get(docId as any)
282
+ checkPermission({
283
+ access,
284
+ user,
285
+ userRoles: roles,
286
+ resource: collectionSlug,
287
+ action: "delete",
288
+ data: (doc as Record<string, unknown>) ?? {},
289
+ })
290
+ }
279
291
 
280
292
  return await Collections.bulkDeleteDocuments<DataModel>({
281
293
  args: { documentIds },
@@ -22,12 +22,12 @@
22
22
  "@t3-oss/env-nextjs": "^0.13.10",
23
23
  "@tanstack/react-form": "^1.27.7",
24
24
  "@tanstack/react-query": "^5.90.17",
25
- "@vexcms/admin-next": "~0.0.19",
26
- "@vexcms/better-auth": "~0.0.19",
27
- "@vexcms/core": "~0.0.19",
28
- "@vexcms/richtext": "~0.0.19",
29
- "@vexcms/ui": "~0.0.19",
30
- "@vexcms/file-storage-convex": "~0.0.19",
25
+ "@vexcms/admin-next": "~0.0.20",
26
+ "@vexcms/better-auth": "~0.0.20",
27
+ "@vexcms/core": "~0.0.20",
28
+ "@vexcms/richtext": "~0.0.20",
29
+ "@vexcms/ui": "~0.0.20",
30
+ "@vexcms/file-storage-convex": "~0.0.20",
31
31
  "better-auth": ">=1.4.9 <1.5.0",
32
32
  "class-variance-authority": "^0.7.1",
33
33
  "clsx": "^2.1.1",
@@ -54,7 +54,7 @@
54
54
  "@types/node": "^20",
55
55
  "@types/react": "^19",
56
56
  "@types/react-dom": "^19",
57
- "@vexcms/cli": "~0.0.19",
57
+ "@vexcms/cli": "~0.0.20",
58
58
  "babel-plugin-react-compiler": "^1.0.0",
59
59
  "eslint": "^9",
60
60
  "eslint-config-next": "15.5.9",
@@ -4,7 +4,10 @@ import { cookies } from "next/headers"
4
4
 
5
5
  export async function getSessionToken() {
6
6
  const cookieStore = await cookies()
7
- const sessionToken = cookieStore.get("better-auth.session_token")?.value.split(".")[0]
7
+ // In production (HTTPS), Better Auth prefixes cookies with __Secure-
8
+ const sessionToken =
9
+ cookieStore.get("__Secure-better-auth.session_token")?.value.split(".")[0] ??
10
+ cookieStore.get("better-auth.session_token")?.value.split(".")[0]
8
11
  if (!sessionToken) {
9
12
  console.error("Error getting session token")
10
13
  return null
@@ -7,7 +7,9 @@ export async function proxy(request: NextRequest) {
7
7
  }
8
8
 
9
9
  const cookieStore = await cookies()
10
- const sessionToken = cookieStore.get("better-auth.session_token")
10
+ const sessionToken =
11
+ cookieStore.get("__Secure-better-auth.session_token") ??
12
+ cookieStore.get("better-auth.session_token")
11
13
 
12
14
  if (!sessionToken) {
13
15
  return NextResponse.redirect(new URL("/auth/sign-in", request.url))
@@ -115,8 +115,8 @@ function AnimatedGroup({
115
115
  const containerVariants = variants?.container ?? selectedVariants.container
116
116
  const itemVariants = variants?.item ?? selectedVariants.item
117
117
 
118
- const MotionComponent = motion(as)
119
- const MotionChild = motion(asChild)
118
+ const MotionComponent = motion.create(as)
119
+ const MotionChild = motion.create(asChild)
120
120
 
121
121
  return (
122
122
  <MotionComponent