create-vexcms 0.1.0-alpha.19 → 0.1.0-alpha.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.1.0-alpha.19",
3
+ "version": "0.1.0-alpha.20",
4
4
  "description": "Scaffold a new VexCMS project",
5
5
  "keywords": [
6
6
  "cms",
@@ -4,7 +4,8 @@ import { globalsApi } from "@vexcms/core/server";
4
4
  import { TABLE_SLUG_ORGANIZATIONS, TABLE_SLUG_SESSIONS, TABLE_SLUG_USERS } from "~/db/constants";
5
5
  import config from "~/vex.config.server";
6
6
 
7
- import { mutation, query } from "../_generated/server";
7
+ import { query } from "../_generated/server";
8
+ import { vexMutation as mutation } from "../vex";
8
9
 
9
10
  export const { get, find, upsert } = globalsApi({
10
11
  config,
@@ -4,7 +4,8 @@ import { mediaApi } from "@vexcms/core";
4
4
  import { TABLE_SLUG_ORGANIZATIONS, TABLE_SLUG_SESSIONS, TABLE_SLUG_USERS } from "~/db/constants";
5
5
  import config from "~/vex.config.server";
6
6
 
7
- import { mutation, query } from "../_generated/server";
7
+ import { query } from "../_generated/server";
8
+ import { vexMutation as mutation } from "../vex";
8
9
 
9
10
  export const { getUrl, generateUploadUrl, createMediaDocument, deleteMedia } = mediaApi({
10
11
  config,
@@ -1,15 +1,28 @@
1
1
  import { createGetAuth } from "@vexcms/better-auth";
2
- import { collectionsApi } from "@vexcms/core/server";
2
+ import { collectionsApi, createVexMutations } from "@vexcms/core/server";
3
3
 
4
4
  import { TABLE_SLUG_ORGANIZATIONS, TABLE_SLUG_SESSIONS, TABLE_SLUG_USERS } from "~/db/constants";
5
5
  import config from "~/vex.config.server";
6
6
 
7
- import { mutation, query } from "./_generated/server";
7
+ import { internalMutation, mutation, query } from "./_generated/server";
8
+
9
+ /**
10
+ * Trigger-wrapped `mutation`/`internalMutation` builders — every write made
11
+ * through them fires the written collection's `afterChange`/`afterDelete`
12
+ * hooks (`@vexcms/core`'s `createVexMutations`). Used, not exported: this
13
+ * file's own `create`/`update`/`remove` (below) and `globals.ts`/`media.ts`
14
+ * build their mutations on `vexMutation`, never the raw builder above.
15
+ */
16
+ export const { mutation: vexMutation, internalMutation: vexInternalMutation } = createVexMutations({
17
+ config,
18
+ mutation,
19
+ internalMutation,
20
+ });
8
21
 
9
22
  export const { find, get, search, create, update, remove } = collectionsApi({
10
23
  config,
11
24
  query,
12
- mutation,
25
+ mutation: vexMutation,
13
26
  getAuth: createGetAuth({
14
27
  orgCollectionSlug: TABLE_SLUG_ORGANIZATIONS,
15
28
  userCollectionSlug: TABLE_SLUG_USERS,
@@ -24,11 +24,11 @@
24
24
  "@t3-oss/env-nextjs": "0.13.11",
25
25
  "@tanstack/react-form": "1.33.1",
26
26
  "@tanstack/react-query": "5.101.2",
27
- "@vexcms/better-auth": "~0.1.0-alpha.19",
28
- "@vexcms/core": "~0.1.0-alpha.19",
29
- "@vexcms/file-storage-convex": "~0.1.0-alpha.19",
30
- "@vexcms/next": "~0.1.0-alpha.19",
31
- "@vexcms/react": "~0.1.0-alpha.19",
27
+ "@vexcms/better-auth": "~0.1.0-alpha.20",
28
+ "@vexcms/core": "~0.1.0-alpha.20",
29
+ "@vexcms/file-storage-convex": "~0.1.0-alpha.20",
30
+ "@vexcms/next": "~0.1.0-alpha.20",
31
+ "@vexcms/react": "~0.1.0-alpha.20",
32
32
  "better-auth": "1.6.23",
33
33
  "class-variance-authority": "0.7.1",
34
34
  "clsx": "2.1.1",
@@ -52,7 +52,7 @@
52
52
  "@types/node": "20.19.43",
53
53
  "@types/react": "19.2.17",
54
54
  "@types/react-dom": "19.2.3",
55
- "@vexcms/cli": "~0.1.0-alpha.19",
55
+ "@vexcms/cli": "~0.1.0-alpha.20",
56
56
  "babel-plugin-react-compiler": "1.0.0",
57
57
  "eslint": "9.39.5",
58
58
  "eslint-config-next": "15.5.9",
@@ -1,4 +1,6 @@
1
- import { blocks, defineCollection, text, upload } from "@vexcms/core"
1
+ import type { DataModel } from "@convex/_generated/dataModel"
2
+
3
+ import { blocks, defineCollection, text, textValidator, upload } from "@vexcms/core"
2
4
 
3
5
  import { TABLE_SLUG_IMAGES, TABLE_SLUG_PAGES } from "~/db/constants"
4
6
  import { pageBlocks } from "~/vexcms/blocks/config"
@@ -20,6 +22,18 @@ export const pages = defineCollection({
20
22
  index: "by_slug",
21
23
  label: "Slug",
22
24
  required: true,
25
+ validate: textValidator<typeof TABLE_SLUG_PAGES, DataModel>(
26
+ TABLE_SLUG_PAGES,
27
+ async ({ value, doc, ctx }) => {
28
+ const existing = await ctx.db
29
+ .query("pages")
30
+ .withIndex("by_slug", (q) => q.eq("slug", value))
31
+ .first()
32
+ if (existing && existing._id !== doc._id) {
33
+ return `This slug is already in use by the page '${existing.title}'.`
34
+ }
35
+ },
36
+ ),
23
37
  }),
24
38
  blocks: blocks({
25
39
  admin: {