@vexcms/core 0.0.19 → 0.1.0-alpha.2
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/LICENSE +202 -0
- package/dist/.build +1 -0
- package/dist/access/buildChecks.d.ts +58 -0
- package/dist/access/buildChecks.d.ts.map +1 -0
- package/dist/access/canAccessAdminPanel.d.ts +53 -0
- package/dist/access/canAccessAdminPanel.d.ts.map +1 -0
- package/dist/access/compileConstraints.d.ts +155 -0
- package/dist/access/compileConstraints.d.ts.map +1 -0
- package/dist/access/config.d.ts +62 -0
- package/dist/access/config.d.ts.map +1 -0
- package/dist/access/constants.d.ts +95 -0
- package/dist/access/constants.d.ts.map +1 -0
- package/dist/access/constraintTypes.d.ts +337 -0
- package/dist/access/constraintTypes.d.ts.map +1 -0
- package/dist/access/createAccessQueryBuilder.d.ts +59 -0
- package/dist/access/createAccessQueryBuilder.d.ts.map +1 -0
- package/dist/access/createFilterConstraintBuilder.d.ts +26 -0
- package/dist/access/createFilterConstraintBuilder.d.ts.map +1 -0
- package/dist/access/createIndexConstraintBuilder.d.ts +40 -0
- package/dist/access/createIndexConstraintBuilder.d.ts.map +1 -0
- package/dist/access/hasPermission.d.ts +85 -0
- package/dist/access/hasPermission.d.ts.map +1 -0
- package/dist/access/index.d.ts +13 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/pickQueryIndex.d.ts +42 -0
- package/dist/access/pickQueryIndex.d.ts.map +1 -0
- package/dist/access/resolveAccessRule.d.ts +85 -0
- package/dist/access/resolveAccessRule.d.ts.map +1 -0
- package/dist/access/types.d.ts +738 -0
- package/dist/access/types.d.ts.map +1 -0
- package/dist/access/validateAccessConstraints.d.ts +57 -0
- package/dist/access/validateAccessConstraints.d.ts.map +1 -0
- package/dist/api/client.d.ts +20 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +117 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/convex.d.ts +296 -0
- package/dist/api/convex.d.ts.map +1 -0
- package/dist/api/create/client.d.ts +50 -0
- package/dist/api/create/client.d.ts.map +1 -0
- package/dist/api/create/server.d.ts +43 -0
- package/dist/api/create/server.d.ts.map +1 -0
- package/dist/api/depth.d.ts +39 -0
- package/dist/api/depth.d.ts.map +1 -0
- package/dist/api/find/client.d.ts +90 -0
- package/dist/api/find/client.d.ts.map +1 -0
- package/dist/api/find/server.d.ts +73 -0
- package/dist/api/find/server.d.ts.map +1 -0
- package/dist/api/get/client.d.ts +56 -0
- package/dist/api/get/client.d.ts.map +1 -0
- package/dist/api/get/server.d.ts +49 -0
- package/dist/api/get/server.d.ts.map +1 -0
- package/dist/api/globals/find.client.d.ts +20 -0
- package/dist/api/globals/find.client.d.ts.map +1 -0
- package/dist/api/globals/find.server.d.ts +29 -0
- package/dist/api/globals/find.server.d.ts.map +1 -0
- package/dist/api/globals/get.client.d.ts +46 -0
- package/dist/api/globals/get.client.d.ts.map +1 -0
- package/dist/api/globals/get.server.d.ts +55 -0
- package/dist/api/globals/get.server.d.ts.map +1 -0
- package/dist/api/globals/types.d.ts +65 -0
- package/dist/api/globals/types.d.ts.map +1 -0
- package/dist/api/globals/upsert.client.d.ts +24 -0
- package/dist/api/globals/upsert.client.d.ts.map +1 -0
- package/dist/api/globals/upsert.server.d.ts +47 -0
- package/dist/api/globals/upsert.server.d.ts.map +1 -0
- package/dist/api/populate.d.ts +23 -0
- package/dist/api/populate.d.ts.map +1 -0
- package/dist/api/remove/client.d.ts +58 -0
- package/dist/api/remove/client.d.ts.map +1 -0
- package/dist/api/remove/server.d.ts +65 -0
- package/dist/api/remove/server.d.ts.map +1 -0
- package/dist/api/search/client.d.ts +58 -0
- package/dist/api/search/client.d.ts.map +1 -0
- package/dist/api/search/server.d.ts +54 -0
- package/dist/api/search/server.d.ts.map +1 -0
- package/dist/api/server.d.ts +370 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +33 -0
- package/dist/api/server.js.map +1 -0
- package/dist/api/types.d.ts +525 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/update/client.d.ts +53 -0
- package/dist/api/update/client.d.ts.map +1 -0
- package/dist/api/update/server.d.ts +47 -0
- package/dist/api/update/server.d.ts.map +1 -0
- package/dist/api/utils.d.ts +57 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/auth/mergeCollections.d.ts +28 -0
- package/dist/auth/mergeCollections.d.ts.map +1 -0
- package/dist/auth/types.d.ts +84 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/chunk-2DU7JDEX.js +1877 -0
- package/dist/chunk-2DU7JDEX.js.map +1 -0
- package/dist/chunk-2IB2DCN7.js +75 -0
- package/dist/chunk-2IB2DCN7.js.map +1 -0
- package/dist/collections/config.d.ts +28 -0
- package/dist/collections/config.d.ts.map +1 -0
- package/dist/collections/constants.d.ts +27 -0
- package/dist/collections/constants.d.ts.map +1 -0
- package/dist/collections/index.d.ts +7 -0
- package/dist/collections/index.d.ts.map +1 -0
- package/dist/collections/indexFields.d.ts +20 -0
- package/dist/collections/indexFields.d.ts.map +1 -0
- package/dist/collections/interfaceGen.d.ts +59 -0
- package/dist/collections/interfaceGen.d.ts.map +1 -0
- package/dist/collections/internal/index.d.ts +2 -0
- package/dist/collections/internal/index.d.ts.map +1 -0
- package/dist/collections/types.d.ts +282 -0
- package/dist/collections/types.d.ts.map +1 -0
- package/dist/collections/utils.d.ts +71 -0
- package/dist/collections/utils.d.ts.map +1 -0
- package/dist/collections/validator.d.ts +73 -0
- package/dist/collections/validator.d.ts.map +1 -0
- package/dist/config/config.d.ts +43 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/sanitizeConfig.d.ts +82 -0
- package/dist/config/sanitizeConfig.d.ts.map +1 -0
- package/dist/config/types.d.ts +316 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/fields/array/config.d.ts +57 -0
- package/dist/fields/array/config.d.ts.map +1 -0
- package/dist/fields/array/index.d.ts +5 -0
- package/dist/fields/array/index.d.ts.map +1 -0
- package/dist/fields/array/inputSchema.d.ts +32 -0
- package/dist/fields/array/inputSchema.d.ts.map +1 -0
- package/dist/fields/array/types.d.ts +127 -0
- package/dist/fields/array/types.d.ts.map +1 -0
- package/dist/fields/array/validator.d.ts +30 -0
- package/dist/fields/array/validator.d.ts.map +1 -0
- package/dist/fields/baseTypes.d.ts +251 -0
- package/dist/fields/baseTypes.d.ts.map +1 -0
- package/dist/fields/blocks/config.d.ts +63 -0
- package/dist/fields/blocks/config.d.ts.map +1 -0
- package/dist/fields/blocks/index.d.ts +5 -0
- package/dist/fields/blocks/index.d.ts.map +1 -0
- package/dist/fields/blocks/inputSchema.d.ts +22 -0
- package/dist/fields/blocks/inputSchema.d.ts.map +1 -0
- package/dist/fields/blocks/types.d.ts +253 -0
- package/dist/fields/blocks/types.d.ts.map +1 -0
- package/dist/fields/blocks/validator.d.ts +32 -0
- package/dist/fields/blocks/validator.d.ts.map +1 -0
- package/dist/fields/checkbox/config.d.ts +46 -0
- package/dist/fields/checkbox/config.d.ts.map +1 -0
- package/dist/fields/checkbox/index.d.ts +5 -0
- package/dist/fields/checkbox/index.d.ts.map +1 -0
- package/dist/fields/checkbox/inputSchema.d.ts +27 -0
- package/dist/fields/checkbox/inputSchema.d.ts.map +1 -0
- package/dist/fields/checkbox/types.d.ts +67 -0
- package/dist/fields/checkbox/types.d.ts.map +1 -0
- package/dist/fields/checkbox/validator.d.ts +34 -0
- package/dist/fields/checkbox/validator.d.ts.map +1 -0
- package/dist/fields/color/config.d.ts +49 -0
- package/dist/fields/color/config.d.ts.map +1 -0
- package/dist/fields/color/convert.d.ts +72 -0
- package/dist/fields/color/convert.d.ts.map +1 -0
- package/dist/fields/color/formats.d.ts +38 -0
- package/dist/fields/color/formats.d.ts.map +1 -0
- package/dist/fields/color/index.d.ts +8 -0
- package/dist/fields/color/index.d.ts.map +1 -0
- package/dist/fields/color/inputSchema.d.ts +29 -0
- package/dist/fields/color/inputSchema.d.ts.map +1 -0
- package/dist/fields/color/types.d.ts +100 -0
- package/dist/fields/color/types.d.ts.map +1 -0
- package/dist/fields/color/utils.d.ts +100 -0
- package/dist/fields/color/utils.d.ts.map +1 -0
- package/dist/fields/color/validator.d.ts +27 -0
- package/dist/fields/color/validator.d.ts.map +1 -0
- package/dist/fields/constants.d.ts +108 -0
- package/dist/fields/constants.d.ts.map +1 -0
- package/dist/fields/date/config.d.ts +57 -0
- package/dist/fields/date/config.d.ts.map +1 -0
- package/dist/fields/date/index.d.ts +5 -0
- package/dist/fields/date/index.d.ts.map +1 -0
- package/dist/fields/date/inputSchema.d.ts +29 -0
- package/dist/fields/date/inputSchema.d.ts.map +1 -0
- package/dist/fields/date/types.d.ts +147 -0
- package/dist/fields/date/types.d.ts.map +1 -0
- package/dist/fields/date/validator.d.ts +34 -0
- package/dist/fields/date/validator.d.ts.map +1 -0
- package/dist/fields/group/config.d.ts +47 -0
- package/dist/fields/group/config.d.ts.map +1 -0
- package/dist/fields/group/index.d.ts +5 -0
- package/dist/fields/group/index.d.ts.map +1 -0
- package/dist/fields/group/inputSchema.d.ts +27 -0
- package/dist/fields/group/inputSchema.d.ts.map +1 -0
- package/dist/fields/group/types.d.ts +105 -0
- package/dist/fields/group/types.d.ts.map +1 -0
- package/dist/fields/group/validator.d.ts +41 -0
- package/dist/fields/group/validator.d.ts.map +1 -0
- package/dist/fields/index.d.ts +20 -0
- package/dist/fields/index.d.ts.map +1 -0
- package/dist/fields/inputSchemas/index.d.ts +23 -0
- package/dist/fields/inputSchemas/index.d.ts.map +1 -0
- package/dist/fields/inputSchemas/utils.d.ts +25 -0
- package/dist/fields/inputSchemas/utils.d.ts.map +1 -0
- package/dist/fields/interfaceGen.d.ts +15 -0
- package/dist/fields/interfaceGen.d.ts.map +1 -0
- package/dist/fields/number/config.d.ts +48 -0
- package/dist/fields/number/config.d.ts.map +1 -0
- package/dist/fields/number/index.d.ts +5 -0
- package/dist/fields/number/index.d.ts.map +1 -0
- package/dist/fields/number/inputSchema.d.ts +23 -0
- package/dist/fields/number/inputSchema.d.ts.map +1 -0
- package/dist/fields/number/types.d.ts +100 -0
- package/dist/fields/number/types.d.ts.map +1 -0
- package/dist/fields/number/validator.d.ts +39 -0
- package/dist/fields/number/validator.d.ts.map +1 -0
- package/dist/fields/relationship/config.d.ts +45 -0
- package/dist/fields/relationship/config.d.ts.map +1 -0
- package/dist/fields/relationship/index.d.ts +5 -0
- package/dist/fields/relationship/index.d.ts.map +1 -0
- package/dist/fields/relationship/inputSchema.d.ts +31 -0
- package/dist/fields/relationship/inputSchema.d.ts.map +1 -0
- package/dist/fields/relationship/types.d.ts +126 -0
- package/dist/fields/relationship/types.d.ts.map +1 -0
- package/dist/fields/relationship/validator.d.ts +27 -0
- package/dist/fields/relationship/validator.d.ts.map +1 -0
- package/dist/fields/select/config.d.ts +59 -0
- package/dist/fields/select/config.d.ts.map +1 -0
- package/dist/fields/select/index.d.ts +5 -0
- package/dist/fields/select/index.d.ts.map +1 -0
- package/dist/fields/select/inputSchema.d.ts +28 -0
- package/dist/fields/select/inputSchema.d.ts.map +1 -0
- package/dist/fields/select/types.d.ts +89 -0
- package/dist/fields/select/types.d.ts.map +1 -0
- package/dist/fields/select/validator.d.ts +31 -0
- package/dist/fields/select/validator.d.ts.map +1 -0
- package/dist/fields/text/config.d.ts +48 -0
- package/dist/fields/text/config.d.ts.map +1 -0
- package/dist/fields/text/index.d.ts +5 -0
- package/dist/fields/text/index.d.ts.map +1 -0
- package/dist/fields/text/inputSchema.d.ts +24 -0
- package/dist/fields/text/inputSchema.d.ts.map +1 -0
- package/dist/fields/text/types.d.ts +132 -0
- package/dist/fields/text/types.d.ts.map +1 -0
- package/dist/fields/text/validator.d.ts +39 -0
- package/dist/fields/text/validator.d.ts.map +1 -0
- package/dist/fields/types.d.ts +135 -0
- package/dist/fields/types.d.ts.map +1 -0
- package/dist/fields/upload/config.d.ts +24 -0
- package/dist/fields/upload/config.d.ts.map +1 -0
- package/dist/fields/upload/index.d.ts +5 -0
- package/dist/fields/upload/index.d.ts.map +1 -0
- package/dist/fields/upload/inputSchema.d.ts +17 -0
- package/dist/fields/upload/inputSchema.d.ts.map +1 -0
- package/dist/fields/upload/types.d.ts +78 -0
- package/dist/fields/upload/types.d.ts.map +1 -0
- package/dist/fields/upload/validator.d.ts +16 -0
- package/dist/fields/upload/validator.d.ts.map +1 -0
- package/dist/fields/url/config.d.ts +49 -0
- package/dist/fields/url/config.d.ts.map +1 -0
- package/dist/fields/url/index.d.ts +5 -0
- package/dist/fields/url/index.d.ts.map +1 -0
- package/dist/fields/url/inputSchema.d.ts +31 -0
- package/dist/fields/url/inputSchema.d.ts.map +1 -0
- package/dist/fields/url/types.d.ts +70 -0
- package/dist/fields/url/types.d.ts.map +1 -0
- package/dist/fields/url/validator.d.ts +37 -0
- package/dist/fields/url/validator.d.ts.map +1 -0
- package/dist/fields/utils.d.ts +47 -0
- package/dist/fields/utils.d.ts.map +1 -0
- package/dist/fields/validators/index.d.ts +23 -0
- package/dist/fields/validators/index.d.ts.map +1 -0
- package/dist/fields/validators/utils.d.ts +24 -0
- package/dist/fields/validators/utils.d.ts.map +1 -0
- package/dist/framework.d.ts +227 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/globals/config/config.d.ts +1 -0
- package/dist/globals/config/config.d.ts.map +1 -0
- package/dist/globals/config/types.d.ts +1 -0
- package/dist/globals/config/types.d.ts.map +1 -0
- package/dist/globals/config.d.ts +47 -0
- package/dist/globals/config.d.ts.map +1 -0
- package/dist/globals/index.d.ts +5 -0
- package/dist/globals/index.d.ts.map +1 -0
- package/dist/globals/interfaceGen.d.ts +33 -0
- package/dist/globals/interfaceGen.d.ts.map +1 -0
- package/dist/globals/types.d.ts +175 -0
- package/dist/globals/types.d.ts.map +1 -0
- package/dist/globals/utils.d.ts +37 -0
- package/dist/globals/utils.d.ts.map +1 -0
- package/dist/index.d.ts +15 -3165
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2101 -3470
- package/dist/index.js.map +1 -1
- package/dist/media/api/index.d.ts +5 -0
- package/dist/media/api/index.d.ts.map +1 -0
- package/dist/media/api/mutations.d.ts +76 -0
- package/dist/media/api/mutations.d.ts.map +1 -0
- package/dist/media/api/queries.d.ts +28 -0
- package/dist/media/api/queries.d.ts.map +1 -0
- package/dist/media/api/server.d.ts +68 -0
- package/dist/media/api/server.d.ts.map +1 -0
- package/dist/media/api/types.d.ts +171 -0
- package/dist/media/api/types.d.ts.map +1 -0
- package/dist/media/config.d.ts +25 -0
- package/dist/media/config.d.ts.map +1 -0
- package/dist/media/index.d.ts +6 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/types.d.ts +332 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/utils.d.ts +35 -0
- package/dist/media/utils.d.ts.map +1 -0
- package/dist/media/validators.d.ts +61 -0
- package/dist/media/validators.d.ts.map +1 -0
- package/dist/schema/generateVexSchema.d.ts +36 -0
- package/dist/schema/generateVexSchema.d.ts.map +1 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/migrate.d.ts +73 -0
- package/dist/schema/migrate.d.ts.map +1 -0
- package/dist/types/generateVexTypes.d.ts +41 -0
- package/dist/types/generateVexTypes.d.ts.map +1 -0
- package/dist/types/generated.d.ts +382 -0
- package/dist/types/generated.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils.d.ts +57 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +67 -24
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { VexDocument } from "../api/convex";
|
|
2
|
+
/**
|
|
3
|
+
* Empty interface augmented by the generated `vex.types.ts` file.
|
|
4
|
+
*
|
|
5
|
+
* When `vex generate` has been run, this interface gains two properties:
|
|
6
|
+
* - `CollectionSlug` — the specific union of collection slugs in the project
|
|
7
|
+
* - `DocumentBySlug` — a map of slug → document interface
|
|
8
|
+
*
|
|
9
|
+
* When empty (before generation), all derived types fall back to their widest
|
|
10
|
+
* safe variants (`string`, `Record<string, unknown>`).
|
|
11
|
+
*
|
|
12
|
+
* Do not populate this interface manually. It is populated by the
|
|
13
|
+
* `declare module '@vexcms/core'` block emitted at the bottom of
|
|
14
|
+
* the generated `vex.types.ts` file.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // After running `vex generate`, this interface is augmented to:
|
|
19
|
+
* interface GeneratedVexTypes {
|
|
20
|
+
* CollectionSlug: "posts" | "authors";
|
|
21
|
+
* DocumentBySlug: { posts: PostsDocument; authors: AuthorsDocument };
|
|
22
|
+
* CollectionsFieldTypeMap: {
|
|
23
|
+
* posts: {
|
|
24
|
+
* text: "title" | "slug" | "body";
|
|
25
|
+
* relationship: "author" | "category";
|
|
26
|
+
* select: "status";
|
|
27
|
+
* date: "publishedAt";
|
|
28
|
+
* };
|
|
29
|
+
* authors: {
|
|
30
|
+
* text: "name" | "email";
|
|
31
|
+
* };
|
|
32
|
+
* };
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface GeneratedVexTypes {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Union of all collection slugs registered in this project's VexCMS config.
|
|
40
|
+
*
|
|
41
|
+
* - **Before `vex generate`:** resolves to `string` — any string is accepted.
|
|
42
|
+
* - **After `vex generate`:** resolves to a specific union, e.g. `"posts" | "authors"`.
|
|
43
|
+
*
|
|
44
|
+
* Used by `RelationshipFieldInput.collection` so that invalid slugs are caught
|
|
45
|
+
* at compile time without the user passing explicit generic parameters.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* // After generation — type is "posts" | "authors" | "tags"
|
|
50
|
+
* import type { CollectionSlug } from "@vexcms/core"
|
|
51
|
+
*
|
|
52
|
+
* relationship({ collection: "nonexistent" }) // ✗ Type error after generation
|
|
53
|
+
* relationship({ collection: "posts" }) // ✓
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
57
|
+
* @see {@link RelationshipFieldInput} for the primary consumer of this type
|
|
58
|
+
*/
|
|
59
|
+
export type CollectionSlug = GeneratedVexTypes extends {
|
|
60
|
+
CollectionSlug: infer S extends string;
|
|
61
|
+
} ? S : string;
|
|
62
|
+
/**
|
|
63
|
+
* Maps each collection slug to its generated document interface.
|
|
64
|
+
*
|
|
65
|
+
* - **Before `vex generate`:** resolves to `Record<string, unknown>`.
|
|
66
|
+
* - **After `vex generate`:** resolves to a typed map, e.g.
|
|
67
|
+
* `{ posts: PostsDocument; authors: AuthorsDocument }`.
|
|
68
|
+
*
|
|
69
|
+
* Used by `useCollectionForm` to type the `document` prop per collection.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* // After generation:
|
|
74
|
+
* import type { DocumentBySlug } from "@vexcms/core"
|
|
75
|
+
* type Post = DocumentBySlug["posts"] // → PostsDocument
|
|
76
|
+
* type Author = DocumentBySlug["authors"] // → AuthorsDocument
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
80
|
+
*/
|
|
81
|
+
export type DocumentBySlug = GeneratedVexTypes extends {
|
|
82
|
+
DocumentBySlug: infer D extends Record<string, unknown>;
|
|
83
|
+
} ? D : Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Custom query/mutation actions per subject slug, as declared in the project's
|
|
86
|
+
* `defineAccess({ customActions })` and emitted by `vex generate`.
|
|
87
|
+
*
|
|
88
|
+
* - **Before `vex generate`:** resolves to `{}` — no slug has declared custom
|
|
89
|
+
* actions, and {@link QueryCallActionFor} falls back to accepting any string.
|
|
90
|
+
* - **After `vex generate`:** e.g.
|
|
91
|
+
* `{ articles: { query: "listFeatured"; mutation: "publish" } }`. A missing
|
|
92
|
+
* list emits `never`, so single-list declarations stay exact.
|
|
93
|
+
*/
|
|
94
|
+
export type CustomActionsBySlug = GeneratedVexTypes extends {
|
|
95
|
+
CustomActionsBySlug: infer C extends Record<string, {
|
|
96
|
+
query: string;
|
|
97
|
+
mutation: string;
|
|
98
|
+
}>;
|
|
99
|
+
} ? C : {};
|
|
100
|
+
/**
|
|
101
|
+
* Maps each collection slug to its declared Convex indexes, each as a
|
|
102
|
+
* `readonly` tuple of field names in declaration order (`.index(name,
|
|
103
|
+
* [...])` — search indexes excluded, since `withIndex` never targets
|
|
104
|
+
* those). Field order is exactly what `ConstraintBuilder`
|
|
105
|
+
* (`access/constraintTypes.ts`) narrows against, so this registry is the
|
|
106
|
+
* sole source of truth both the constraint builder and `IndexNameFor`
|
|
107
|
+
* resolve through — no parallel name-union map (supersedes the old
|
|
108
|
+
* `IndexesBySlug`).
|
|
109
|
+
*
|
|
110
|
+
* - **Before `vex generate`:** resolves to
|
|
111
|
+
* `Record<string, Record<string, readonly string[]>>`.
|
|
112
|
+
* - **After `vex generate`:** e.g.
|
|
113
|
+
* `{ pages: { by_author_category: readonly ["authorId", "categoryId"] } }`.
|
|
114
|
+
* A collection with NO indexed fields maps to `{}`, never `never` — see
|
|
115
|
+
* {@link IndexNameFor}.
|
|
116
|
+
*/
|
|
117
|
+
export type IndexFieldsBySlug = GeneratedVexTypes extends {
|
|
118
|
+
IndexFieldsBySlug: infer I extends Record<string, Record<string, readonly string[]>>;
|
|
119
|
+
} ? I : Record<string, Record<string, readonly string[]>>;
|
|
120
|
+
/**
|
|
121
|
+
* Index-name union for one slug — the keys of its {@link IndexFieldsBySlug}
|
|
122
|
+
* entry. Widens to `string` pre-generation. An index-less slug's entry is
|
|
123
|
+
* `{}`, and `keyof {}` is `never`, so this still correctly yields `never`
|
|
124
|
+
* for that slug post-generation — the same result the old name-union form
|
|
125
|
+
* gave by emitting `never` directly, reached here through an empty object
|
|
126
|
+
* instead (an empty object stays a well-typed `keyof` target; a bare
|
|
127
|
+
* `never` union would not, if `IndexFieldsFor` ever needed to index into
|
|
128
|
+
* it).
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
export type IndexNameFor<S extends string> = S extends keyof IndexFieldsBySlug ? keyof IndexFieldsBySlug[S] : string;
|
|
133
|
+
/**
|
|
134
|
+
* The field tuple for one slug + index name, in declaration order — what
|
|
135
|
+
* `ConstraintBuilder<TFields, TDoc>` (`access/constraintTypes.ts`) is
|
|
136
|
+
* instantiated with.
|
|
137
|
+
*
|
|
138
|
+
* @typeParam S - Collection slug.
|
|
139
|
+
* @typeParam N - Index name declared on `S` (a member of `IndexNameFor<S>`).
|
|
140
|
+
* @see {@link IndexFieldsBySlug}
|
|
141
|
+
*/
|
|
142
|
+
export type IndexFieldsFor<S extends keyof IndexFieldsBySlug, N extends keyof IndexFieldsBySlug[S]> = IndexFieldsBySlug[S][N] extends readonly string[] ? IndexFieldsBySlug[S][N] : never;
|
|
143
|
+
/**
|
|
144
|
+
* Union of all media collection slugs registered by storage adapters.
|
|
145
|
+
*
|
|
146
|
+
* - **Before `vex generate`:** resolves to `string` — any string is accepted.
|
|
147
|
+
* - **After `vex generate`:** resolves to a specific union, e.g. `"images" | "videos"`.
|
|
148
|
+
*
|
|
149
|
+
* Used by `upload({ to: ... })` so that invalid media collection slugs are
|
|
150
|
+
* caught at compile time after generation.
|
|
151
|
+
*
|
|
152
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
153
|
+
*/
|
|
154
|
+
export type MediaCollectionSlug = GeneratedVexTypes extends {
|
|
155
|
+
MediaCollectionSlug: infer S extends string;
|
|
156
|
+
} ? S : string;
|
|
157
|
+
/**
|
|
158
|
+
* Union of all storage adapter names registered in this project's VexCMS config.
|
|
159
|
+
*
|
|
160
|
+
* - **Before `vex generate`:** resolves to `string` — any string is accepted.
|
|
161
|
+
* - **After `vex generate`:** resolves to a specific union, e.g. `"convex"`.
|
|
162
|
+
*
|
|
163
|
+
* Only adapters whose `type` is `"presigned-url"` (i.e. those implementing
|
|
164
|
+
* `StorageAdapterPresignedUrlInterface`) are included. Adapters using other
|
|
165
|
+
* protocols (e.g. `"direct-upload"`, `"streaming"`) are excluded because
|
|
166
|
+
* they require different client-side upload logic.
|
|
167
|
+
*
|
|
168
|
+
* Used by `VexConfig.storage.clientUploads` and `StorageAdapterMap` so that
|
|
169
|
+
* only adapters actually registered in `defineConfig({ storage: { adapters: [...] } })`
|
|
170
|
+
* can be referenced. Invalid adapter names are caught at compile time after
|
|
171
|
+
* generation.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* // After generation — type is "convex"
|
|
176
|
+
* import type { StorageAdapterSlug } from "@vexcms/core"
|
|
177
|
+
*
|
|
178
|
+
* const registry: StorageAdapterMap = {
|
|
179
|
+
* convex: { uploadFile: convexUploadFile }, // ✓
|
|
180
|
+
* s3: { uploadFile: s3UploadFile }, // ✗ Type error — "s3" not registered
|
|
181
|
+
* fake: { uploadFile: fakeUploadFile }, // ✗ Type error — not a registered adapter
|
|
182
|
+
* };
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
186
|
+
* @see {@link StorageAdapterPresignedUrlInterface} for the protocol requirement
|
|
187
|
+
* @see {@link VexConfig} for the `storage.clientUploads` consumer
|
|
188
|
+
*/
|
|
189
|
+
export type StorageAdapterSlug = GeneratedVexTypes extends {
|
|
190
|
+
StorageAdapterSlug: infer S extends string;
|
|
191
|
+
} ? S : string;
|
|
192
|
+
/**
|
|
193
|
+
* Per-collection field-type map. Augmented by `vex generate` from the user's
|
|
194
|
+
* collection configs. Powers all per-field-type helper types (`RelationshipKeysOf`,
|
|
195
|
+
* `TextKeysOf`, `SortableKeysOf`, etc.).
|
|
196
|
+
*
|
|
197
|
+
* Keyed: collection slug → field type → union of field keys with that type.
|
|
198
|
+
*
|
|
199
|
+
* Empty by default; the user's `vex.types.ts` augments it via `declare module
|
|
200
|
+
* "@vexcms/core"`. Helper types in `packages/core/src/api/types.ts` resolve to
|
|
201
|
+
* `never` until augmentation runs, which is the intended behaviour for fresh
|
|
202
|
+
* projects (no collections registered yet).
|
|
203
|
+
*
|
|
204
|
+
* @example Generated content after running vex generate
|
|
205
|
+
* ```ts
|
|
206
|
+
* declare module "@vexcms/core" {
|
|
207
|
+
* interface GeneratedVexTypes {
|
|
208
|
+
* CollectionSlug: "posts" | "authors";
|
|
209
|
+
* DocumentBySlug: { posts: PostsDocument; authors: AuthorsDocument };
|
|
210
|
+
* CollectionsFieldTypeMap: {
|
|
211
|
+
* posts: {
|
|
212
|
+
* text: "title" | "slug" | "body";
|
|
213
|
+
* relationship: "author" | "category";
|
|
214
|
+
* select: "status";
|
|
215
|
+
* date: "publishedAt";
|
|
216
|
+
* };
|
|
217
|
+
* authors: {
|
|
218
|
+
* text: "name" | "email";
|
|
219
|
+
* };
|
|
220
|
+
* };
|
|
221
|
+
* }
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export type CollectionsFieldTypeMap = GeneratedVexTypes extends {
|
|
226
|
+
CollectionsFieldTypeMap: infer M extends Record<string, Record<string, string>>;
|
|
227
|
+
} ? M : Record<string, Record<string, never>>;
|
|
228
|
+
/**
|
|
229
|
+
* Union of all global slugs registered in this project's VexCMS config.
|
|
230
|
+
*
|
|
231
|
+
* - **Before `vex generate`:** resolves to `string`.
|
|
232
|
+
* - **After `vex generate`:** resolves to e.g. `"siteSettings" | "navigationConfig"`.
|
|
233
|
+
*
|
|
234
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
235
|
+
*/
|
|
236
|
+
export type GlobalSlug = GeneratedVexTypes extends {
|
|
237
|
+
GlobalSlug: infer S extends string;
|
|
238
|
+
} ? S : string;
|
|
239
|
+
/**
|
|
240
|
+
* Maps each global slug to its generated flat document interface.
|
|
241
|
+
*
|
|
242
|
+
* Each value type extends `VexDocumentGlobal<TSlug>` (which extends `VexDocument`)
|
|
243
|
+
* and adds user fields at root level — identical ergonomics to `DocumentBySlug`.
|
|
244
|
+
*
|
|
245
|
+
* - **Before `vex generate`:** resolves to `Record<string, unknown>`.
|
|
246
|
+
* - **After:** e.g. `{ siteSettings: SiteSettingsGlobal; nav: NavigationConfigGlobal }`.
|
|
247
|
+
*
|
|
248
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
249
|
+
*/
|
|
250
|
+
export type GlobalDocumentBySlug = GeneratedVexTypes extends {
|
|
251
|
+
GlobalDocumentBySlug: infer D extends Record<string, unknown>;
|
|
252
|
+
} ? D : Record<string, unknown>;
|
|
253
|
+
/**
|
|
254
|
+
* Per-global field-type map. Augmented by `vex generate`. Powers
|
|
255
|
+
* `GlobalRelationshipKeysOf<TGlobalSlug>` for populate type narrowing.
|
|
256
|
+
*
|
|
257
|
+
* Structure: `{ globalSlug: { fieldType: "fieldKey1" | "fieldKey2" } }`.
|
|
258
|
+
*/
|
|
259
|
+
export type GlobalsFieldTypeMap = GeneratedVexTypes extends {
|
|
260
|
+
GlobalsFieldTypeMap: infer M extends Record<string, Record<string, string>>;
|
|
261
|
+
} ? M : Record<string, Record<string, never>>;
|
|
262
|
+
/**
|
|
263
|
+
* Flat global document returned by `globals.get` and `globals.find`.
|
|
264
|
+
*
|
|
265
|
+
* Extends `VexDocument` (inheriting `_id: string` and `_creationTime: number`)
|
|
266
|
+
* and adds `_slug: TSlug` as the discriminator field. The generated per-global
|
|
267
|
+
* interfaces (e.g. `SiteSettingsGlobal`) extend this type and add user fields.
|
|
268
|
+
*
|
|
269
|
+
* When called with a typed `TSlug`, `globals.get` returns
|
|
270
|
+
* `GlobalDocumentBySlug[TSlug]` (the concrete generated interface), not this
|
|
271
|
+
* base type. This type is the fallback for unnarrowed contexts (e.g. the return
|
|
272
|
+
* of `findGlobals`).
|
|
273
|
+
*
|
|
274
|
+
* @typeParam TSlug - The global slug. Defaults to `GlobalSlug` (all slugs).
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const doc: VexDocumentGlobal<"siteSettings"> = ...;
|
|
279
|
+
* doc._slug; // "siteSettings"
|
|
280
|
+
* doc._id; // string (from VexDocument)
|
|
281
|
+
* doc._creationTime; // number (from VexDocument)
|
|
282
|
+
* // user fields are accessible via the index signature: doc["siteName"]
|
|
283
|
+
* ```
|
|
284
|
+
*
|
|
285
|
+
* @see {@link VexDocument} for the base type
|
|
286
|
+
*/
|
|
287
|
+
export interface VexDocumentGlobal<TSlug extends GlobalSlug = GlobalSlug> extends VexDocument {
|
|
288
|
+
/**
|
|
289
|
+
* The global slug — uniquely identifies which global this document is.
|
|
290
|
+
* Renamed from `slug` (the DB column name) at the API layer to avoid
|
|
291
|
+
* collisions with user-defined field keys.
|
|
292
|
+
*/
|
|
293
|
+
_slug: TSlug;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Relationship field keys on `TGlobalSlug`. Reads `GlobalsFieldTypeMap`.
|
|
297
|
+
* Used to narrow the `populate` arg of `globals.get` / `globals.find`.
|
|
298
|
+
*
|
|
299
|
+
* @typeParam TGlobalSlug - The global slug.
|
|
300
|
+
*/
|
|
301
|
+
export type GlobalRelationshipKeysOf<TGlobalSlug extends GlobalSlug> = TGlobalSlug extends keyof GlobalsFieldTypeMap ? "relationship" extends keyof GlobalsFieldTypeMap[TGlobalSlug] ? GlobalsFieldTypeMap[TGlobalSlug]["relationship"] & string : never : never;
|
|
302
|
+
/**
|
|
303
|
+
* Populate options for a global — keys restricted to relationship fields via
|
|
304
|
+
* `GlobalRelationshipKeysOf<TGlobalSlug>`. Mirrors `PopulateShape` for
|
|
305
|
+
* collections; nested populate resolves to collection populate shapes since
|
|
306
|
+
* globals relate to collections, not to other globals.
|
|
307
|
+
*
|
|
308
|
+
* @typeParam TGlobalSlug - The global slug.
|
|
309
|
+
*/
|
|
310
|
+
export type GlobalPopulateShape<TGlobalSlug extends GlobalSlug = GlobalSlug> = {
|
|
311
|
+
[K in GlobalRelationshipKeysOf<TGlobalSlug>]?: true | {
|
|
312
|
+
populate: Record<string, unknown>;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Return type of `globals.get` when `populate` is provided. Maps over
|
|
317
|
+
* `GlobalDocumentBySlug[TGlobalSlug]` replacing each populated relationship
|
|
318
|
+
* field's `string` type with `Doc<TargetSlug>[]`.
|
|
319
|
+
*
|
|
320
|
+
* Mirrors `Populated<TCollectionSlug, TPopulate>` from the collection API;
|
|
321
|
+
* operates on `GlobalDocumentBySlug` instead of `DocumentBySlug`.
|
|
322
|
+
*
|
|
323
|
+
* @typeParam TGlobalSlug - The global slug.
|
|
324
|
+
* @typeParam TPopulate - The populate options object.
|
|
325
|
+
*/
|
|
326
|
+
export type GlobalPopulated<TGlobalSlug extends GlobalSlug, TPopulate extends GlobalPopulateShape<TGlobalSlug>> = TGlobalSlug extends keyof GlobalDocumentBySlug ? {
|
|
327
|
+
[K in keyof GlobalDocumentBySlug[TGlobalSlug]]: K extends keyof TPopulate ? K extends string ? GlobalDocumentBySlug[TGlobalSlug][K] extends string | undefined ? TPopulate[K] extends {
|
|
328
|
+
populate: infer _NestedPopulate;
|
|
329
|
+
} ? Record<string, unknown>[] : Record<string, unknown>[] : GlobalDocumentBySlug[TGlobalSlug][K] : GlobalDocumentBySlug[TGlobalSlug][K] : GlobalDocumentBySlug[TGlobalSlug][K];
|
|
330
|
+
} : never;
|
|
331
|
+
/**
|
|
332
|
+
* The collection slugs `defineAccess` was configured with, as emitted by
|
|
333
|
+
* `vex generate` from `vex.config.ts`.
|
|
334
|
+
*
|
|
335
|
+
* - **Before `vex generate`:** both resolve to `never`.
|
|
336
|
+
* - **After:** e.g. `{ user: "user"; organization: "organization" }`.
|
|
337
|
+
*
|
|
338
|
+
* This exists so core can resolve the project's user and organization DOCUMENT types
|
|
339
|
+
* without a project passing them in. It is what lets `AccessCheck<S>` take one type
|
|
340
|
+
* parameter instead of three, so a project's composable access checks need no local
|
|
341
|
+
* type aliases at all.
|
|
342
|
+
*
|
|
343
|
+
* @see {@link GeneratedVexTypes} for the augmentation interface
|
|
344
|
+
*/
|
|
345
|
+
export type AuthSlugs = GeneratedVexTypes extends {
|
|
346
|
+
AuthSlugs: infer A extends {
|
|
347
|
+
organization: string;
|
|
348
|
+
user: string;
|
|
349
|
+
};
|
|
350
|
+
} ? A : {
|
|
351
|
+
organization: never;
|
|
352
|
+
user: never;
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Document type for slug `S`, or `TFallback` when `S` is not a registered collection.
|
|
356
|
+
*
|
|
357
|
+
* `S` is a naked type parameter on purpose: TypeScript narrows a conditional's checked
|
|
358
|
+
* type only when it is a bare parameter, so writing the lookup inline as
|
|
359
|
+
* `AuthSlugs["user"] extends keyof DocumentBySlug ? DocumentBySlug[AuthSlugs["user"]]`
|
|
360
|
+
* fails with "Type 'never' cannot be used as an index type".
|
|
361
|
+
*
|
|
362
|
+
* @typeParam S - Collection slug to resolve.
|
|
363
|
+
* @typeParam TFallback - Resolved type when `S` is not registered.
|
|
364
|
+
*/
|
|
365
|
+
type DocumentForSlug<S, TFallback> = S extends keyof DocumentBySlug ? DocumentBySlug[S] : TFallback;
|
|
366
|
+
/**
|
|
367
|
+
* The project's user document type, resolved through {@link AuthSlugs}.
|
|
368
|
+
*
|
|
369
|
+
* Falls back to the wide `Record<string, unknown>` when the registry is unaugmented or
|
|
370
|
+
* no user collection is configured — the same widening every other pre-generation
|
|
371
|
+
* lookup uses, so a check stays writable before `vex generate` has run.
|
|
372
|
+
*/
|
|
373
|
+
export type AuthUserDocument = [AuthSlugs["user"]] extends [never] ? Record<string, unknown> : DocumentForSlug<AuthSlugs["user"], Record<string, unknown>>;
|
|
374
|
+
/**
|
|
375
|
+
* The project's organization document type, resolved through {@link AuthSlugs}.
|
|
376
|
+
*
|
|
377
|
+
* Resolves to `never` when no organization collection is configured, which is how
|
|
378
|
+
* `ConstraintsCallbackProps` already signals "no `organization` key on the props".
|
|
379
|
+
*/
|
|
380
|
+
export type AuthOrgDocument = [AuthSlugs["organization"]] extends [never] ? never : DocumentForSlug<AuthSlugs["organization"], never>;
|
|
381
|
+
export {};
|
|
382
|
+
//# sourceMappingURL=generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../src/types/generated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,iBAAiB;CAAG;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,SAAS;IACrD,cAAc,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC;CACxC,GACG,CAAC,GACD,MAAM,CAAC;AAEX;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,SAAS;IACrD,cAAc,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzD,GACG,CAAC,GACD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,SAAS;IAC1D,mBAAmB,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1F,GACG,CAAC,GACD,EAAE,CAAC;AAEP;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,SAAS;IACxD,iBAAiB,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,S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AAC,KAAK,CAAC,GAC9D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACrE,KAAK,GACL,eAAe,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { icons } from "lucide-react";
|
|
2
|
+
/**
|
|
3
|
+
* Valid Lucide icon name string (e.g. `"FileText"`, `"Users"`, `"Settings"`).
|
|
4
|
+
*
|
|
5
|
+
* Derived from the `icons` map exported by `lucide-react` — the same map the
|
|
6
|
+
* `Icon` component in `@vexcms/react` indexes at render time. This is
|
|
7
|
+
* deliberately narrower than the set of names `lucide-react` exports as
|
|
8
|
+
* components: alias exports (`AlertCircle` → `CircleAlert`), the `*Icon`
|
|
9
|
+
* suffixed duplicates (`UsersIcon`), and non-icon exports (`createLucideIcon`,
|
|
10
|
+
* `icons`, `Icon`) are absent from the map and would render nothing.
|
|
11
|
+
*
|
|
12
|
+
* Use the canonical PascalCase name as listed on the Lucide site.
|
|
13
|
+
* @see https://lucide.dev/icons
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const icon: LucideIconName = "CircleAlert"; // ✅ canonical, renders
|
|
18
|
+
* const alias: LucideIconName = "AlertCircle"; // ❌ alias export, not in `icons`
|
|
19
|
+
* const bad: LucideIconName = "NotAnIcon"; // ❌ not an icon at all
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @see the `Icon` component from `@vexcms/react` that renders a `LucideIconName`
|
|
23
|
+
*/
|
|
24
|
+
export type LucideIconName = keyof typeof icons;
|
|
25
|
+
/**
|
|
26
|
+
* Converts a string to title case, handling camelCase, snake_case, and kebab-case inputs.
|
|
27
|
+
* Minor words (e.g. "a", "and", "the") are lowercased unless they appear at the start.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The string to convert.
|
|
30
|
+
* @returns The title-cased string.
|
|
31
|
+
*/
|
|
32
|
+
export declare function toTitleCase(input: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the plural form of an English word using common suffix rules.
|
|
35
|
+
*
|
|
36
|
+
* Handles the most common cases: words ending in s/x/z/ch/sh, consonant+y,
|
|
37
|
+
* and f/fe. Falls back to appending "s" for everything else.
|
|
38
|
+
*
|
|
39
|
+
* @param word - The singular word to pluralise (e.g. `"Post"`, `"Category"`)
|
|
40
|
+
* @returns The pluralised word (e.g. `"Posts"`, `"Categories"`)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* plural("Post") // "Posts"
|
|
45
|
+
* plural("Category") // "Categories"
|
|
46
|
+
* plural("Leaf") // "Leaves"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function plural(word: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Ensures a string starts with a `/`, prepending one if it is absent.
|
|
52
|
+
*
|
|
53
|
+
* @param text - The path string to normalise.
|
|
54
|
+
* @returns The path with a guaranteed leading slash (e.g. `"admin"` → `"/admin"`).
|
|
55
|
+
*/
|
|
56
|
+
export declare function addLeadingSlash(text: string): string;
|
|
57
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,KAAK,CAAC;AAwBhD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW3C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD"}
|
package/package.json
CHANGED
|
@@ -1,44 +1,87 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vexcms/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
|
+
"description": "Convex-native headless CMS core: field factories, schema generation, and typed collection APIs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cms",
|
|
7
|
+
"headless-cms",
|
|
8
|
+
"convex",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"author": "Isaiah Anyimi",
|
|
13
|
+
"homepage": "https://docs.vexcms.dev",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ianyimi/vex.git",
|
|
17
|
+
"directory": "packages/core"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
4
23
|
"type": "module",
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
5
26
|
"exports": {
|
|
6
27
|
".": {
|
|
28
|
+
"source": "./src/index.ts",
|
|
7
29
|
"types": "./dist/index.d.ts",
|
|
8
30
|
"import": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./server": {
|
|
33
|
+
"source": "./src/api/server.ts",
|
|
34
|
+
"types": "./dist/api/server.d.ts",
|
|
35
|
+
"import": "./dist/api/server.js"
|
|
36
|
+
},
|
|
37
|
+
"./client": {
|
|
38
|
+
"source": "./src/api/client.ts",
|
|
39
|
+
"types": "./dist/api/client.d.ts",
|
|
40
|
+
"import": "./dist/api/client.js"
|
|
41
|
+
},
|
|
42
|
+
"./convex": {
|
|
43
|
+
"source": "./src/api/server.ts",
|
|
44
|
+
"types": "./dist/api/server.d.ts",
|
|
45
|
+
"import": "./dist/api/server.js"
|
|
9
46
|
}
|
|
10
47
|
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"zod": "^3.24.0"
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"tag": "alpha"
|
|
18
51
|
},
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"react": ">=18.0.0"
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"nanoid": "5.1.16",
|
|
54
|
+
"zod": "4.4.3"
|
|
23
55
|
},
|
|
24
56
|
"devDependencies": {
|
|
57
|
+
"@convex-dev/react-query": "0.1.0",
|
|
58
|
+
"@edge-runtime/vm": "5.0.0",
|
|
59
|
+
"@tanstack/react-query": "5.101.2",
|
|
25
60
|
"@tanstack/react-table": "8.21.3",
|
|
26
|
-
"@types/node": "
|
|
27
|
-
"@types/react": "
|
|
28
|
-
"@vitest/coverage-v8": "
|
|
29
|
-
"convex": "
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
61
|
+
"@types/node": "20.19.43",
|
|
62
|
+
"@types/react": "19.2.17",
|
|
63
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
64
|
+
"convex": "1.44.0",
|
|
65
|
+
"convex-helpers": "0.1.120",
|
|
66
|
+
"convex-test": "0.0.38",
|
|
67
|
+
"lucide-react": "0.577.0",
|
|
68
|
+
"react": "19.2.7",
|
|
69
|
+
"tsup": "8.5.1",
|
|
70
|
+
"typescript": "6.0.3",
|
|
71
|
+
"vitest": "4.1.10",
|
|
34
72
|
"@vexcms/tsconfig": "0.0.0"
|
|
35
73
|
},
|
|
36
|
-
"
|
|
37
|
-
"
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@convex-dev/react-query": ">=0.1.0 <0.2.0",
|
|
76
|
+
"@tanstack/react-query": ">=5.0.0 <6",
|
|
77
|
+
"@tanstack/react-table": ">=8.0.0 <9",
|
|
78
|
+
"convex": ">=1.44.0 <2",
|
|
79
|
+
"lucide-react": ">=0.577.0 <1",
|
|
80
|
+
"react": ">=18.0.0"
|
|
38
81
|
},
|
|
39
82
|
"scripts": {
|
|
40
|
-
"build": "tsup",
|
|
41
|
-
"dev": "
|
|
83
|
+
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
84
|
+
"dev": "node --watch-path src watch.mjs",
|
|
42
85
|
"clean": "rm -rf dist",
|
|
43
86
|
"typecheck": "tsc --noEmit -p tsconfig.check.json",
|
|
44
87
|
"test": "vitest run",
|