@vexcms/core 0.0.20 → 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.
Files changed (323) hide show
  1. package/LICENSE +202 -0
  2. package/dist/.build +1 -0
  3. package/dist/access/buildChecks.d.ts +58 -0
  4. package/dist/access/buildChecks.d.ts.map +1 -0
  5. package/dist/access/canAccessAdminPanel.d.ts +53 -0
  6. package/dist/access/canAccessAdminPanel.d.ts.map +1 -0
  7. package/dist/access/compileConstraints.d.ts +155 -0
  8. package/dist/access/compileConstraints.d.ts.map +1 -0
  9. package/dist/access/config.d.ts +62 -0
  10. package/dist/access/config.d.ts.map +1 -0
  11. package/dist/access/constants.d.ts +95 -0
  12. package/dist/access/constants.d.ts.map +1 -0
  13. package/dist/access/constraintTypes.d.ts +337 -0
  14. package/dist/access/constraintTypes.d.ts.map +1 -0
  15. package/dist/access/createAccessQueryBuilder.d.ts +59 -0
  16. package/dist/access/createAccessQueryBuilder.d.ts.map +1 -0
  17. package/dist/access/createFilterConstraintBuilder.d.ts +26 -0
  18. package/dist/access/createFilterConstraintBuilder.d.ts.map +1 -0
  19. package/dist/access/createIndexConstraintBuilder.d.ts +40 -0
  20. package/dist/access/createIndexConstraintBuilder.d.ts.map +1 -0
  21. package/dist/access/hasPermission.d.ts +85 -0
  22. package/dist/access/hasPermission.d.ts.map +1 -0
  23. package/dist/access/index.d.ts +13 -0
  24. package/dist/access/index.d.ts.map +1 -0
  25. package/dist/access/pickQueryIndex.d.ts +42 -0
  26. package/dist/access/pickQueryIndex.d.ts.map +1 -0
  27. package/dist/access/resolveAccessRule.d.ts +85 -0
  28. package/dist/access/resolveAccessRule.d.ts.map +1 -0
  29. package/dist/access/types.d.ts +738 -0
  30. package/dist/access/types.d.ts.map +1 -0
  31. package/dist/access/validateAccessConstraints.d.ts +57 -0
  32. package/dist/access/validateAccessConstraints.d.ts.map +1 -0
  33. package/dist/api/client.d.ts +20 -0
  34. package/dist/api/client.d.ts.map +1 -0
  35. package/dist/api/client.js +117 -0
  36. package/dist/api/client.js.map +1 -0
  37. package/dist/api/convex.d.ts +296 -0
  38. package/dist/api/convex.d.ts.map +1 -0
  39. package/dist/api/create/client.d.ts +50 -0
  40. package/dist/api/create/client.d.ts.map +1 -0
  41. package/dist/api/create/server.d.ts +43 -0
  42. package/dist/api/create/server.d.ts.map +1 -0
  43. package/dist/api/depth.d.ts +39 -0
  44. package/dist/api/depth.d.ts.map +1 -0
  45. package/dist/api/find/client.d.ts +90 -0
  46. package/dist/api/find/client.d.ts.map +1 -0
  47. package/dist/api/find/server.d.ts +73 -0
  48. package/dist/api/find/server.d.ts.map +1 -0
  49. package/dist/api/get/client.d.ts +56 -0
  50. package/dist/api/get/client.d.ts.map +1 -0
  51. package/dist/api/get/server.d.ts +49 -0
  52. package/dist/api/get/server.d.ts.map +1 -0
  53. package/dist/api/globals/find.client.d.ts +20 -0
  54. package/dist/api/globals/find.client.d.ts.map +1 -0
  55. package/dist/api/globals/find.server.d.ts +29 -0
  56. package/dist/api/globals/find.server.d.ts.map +1 -0
  57. package/dist/api/globals/get.client.d.ts +46 -0
  58. package/dist/api/globals/get.client.d.ts.map +1 -0
  59. package/dist/api/globals/get.server.d.ts +55 -0
  60. package/dist/api/globals/get.server.d.ts.map +1 -0
  61. package/dist/api/globals/types.d.ts +65 -0
  62. package/dist/api/globals/types.d.ts.map +1 -0
  63. package/dist/api/globals/upsert.client.d.ts +24 -0
  64. package/dist/api/globals/upsert.client.d.ts.map +1 -0
  65. package/dist/api/globals/upsert.server.d.ts +47 -0
  66. package/dist/api/globals/upsert.server.d.ts.map +1 -0
  67. package/dist/api/populate.d.ts +23 -0
  68. package/dist/api/populate.d.ts.map +1 -0
  69. package/dist/api/remove/client.d.ts +58 -0
  70. package/dist/api/remove/client.d.ts.map +1 -0
  71. package/dist/api/remove/server.d.ts +65 -0
  72. package/dist/api/remove/server.d.ts.map +1 -0
  73. package/dist/api/search/client.d.ts +58 -0
  74. package/dist/api/search/client.d.ts.map +1 -0
  75. package/dist/api/search/server.d.ts +54 -0
  76. package/dist/api/search/server.d.ts.map +1 -0
  77. package/dist/api/server.d.ts +370 -0
  78. package/dist/api/server.d.ts.map +1 -0
  79. package/dist/api/server.js +33 -0
  80. package/dist/api/server.js.map +1 -0
  81. package/dist/api/types.d.ts +525 -0
  82. package/dist/api/types.d.ts.map +1 -0
  83. package/dist/api/update/client.d.ts +53 -0
  84. package/dist/api/update/client.d.ts.map +1 -0
  85. package/dist/api/update/server.d.ts +47 -0
  86. package/dist/api/update/server.d.ts.map +1 -0
  87. package/dist/api/utils.d.ts +57 -0
  88. package/dist/api/utils.d.ts.map +1 -0
  89. package/dist/auth/mergeCollections.d.ts +28 -0
  90. package/dist/auth/mergeCollections.d.ts.map +1 -0
  91. package/dist/auth/types.d.ts +84 -0
  92. package/dist/auth/types.d.ts.map +1 -0
  93. package/dist/chunk-2DU7JDEX.js +1877 -0
  94. package/dist/chunk-2DU7JDEX.js.map +1 -0
  95. package/dist/chunk-2IB2DCN7.js +75 -0
  96. package/dist/chunk-2IB2DCN7.js.map +1 -0
  97. package/dist/collections/config.d.ts +28 -0
  98. package/dist/collections/config.d.ts.map +1 -0
  99. package/dist/collections/constants.d.ts +27 -0
  100. package/dist/collections/constants.d.ts.map +1 -0
  101. package/dist/collections/index.d.ts +7 -0
  102. package/dist/collections/index.d.ts.map +1 -0
  103. package/dist/collections/indexFields.d.ts +20 -0
  104. package/dist/collections/indexFields.d.ts.map +1 -0
  105. package/dist/collections/interfaceGen.d.ts +59 -0
  106. package/dist/collections/interfaceGen.d.ts.map +1 -0
  107. package/dist/collections/internal/index.d.ts +2 -0
  108. package/dist/collections/internal/index.d.ts.map +1 -0
  109. package/dist/collections/types.d.ts +282 -0
  110. package/dist/collections/types.d.ts.map +1 -0
  111. package/dist/collections/utils.d.ts +71 -0
  112. package/dist/collections/utils.d.ts.map +1 -0
  113. package/dist/collections/validator.d.ts +73 -0
  114. package/dist/collections/validator.d.ts.map +1 -0
  115. package/dist/config/config.d.ts +43 -0
  116. package/dist/config/config.d.ts.map +1 -0
  117. package/dist/config/index.d.ts +5 -0
  118. package/dist/config/index.d.ts.map +1 -0
  119. package/dist/config/sanitizeConfig.d.ts +82 -0
  120. package/dist/config/sanitizeConfig.d.ts.map +1 -0
  121. package/dist/config/types.d.ts +316 -0
  122. package/dist/config/types.d.ts.map +1 -0
  123. package/dist/fields/array/config.d.ts +57 -0
  124. package/dist/fields/array/config.d.ts.map +1 -0
  125. package/dist/fields/array/index.d.ts +5 -0
  126. package/dist/fields/array/index.d.ts.map +1 -0
  127. package/dist/fields/array/inputSchema.d.ts +32 -0
  128. package/dist/fields/array/inputSchema.d.ts.map +1 -0
  129. package/dist/fields/array/types.d.ts +127 -0
  130. package/dist/fields/array/types.d.ts.map +1 -0
  131. package/dist/fields/array/validator.d.ts +30 -0
  132. package/dist/fields/array/validator.d.ts.map +1 -0
  133. package/dist/fields/baseTypes.d.ts +251 -0
  134. package/dist/fields/baseTypes.d.ts.map +1 -0
  135. package/dist/fields/blocks/config.d.ts +63 -0
  136. package/dist/fields/blocks/config.d.ts.map +1 -0
  137. package/dist/fields/blocks/index.d.ts +5 -0
  138. package/dist/fields/blocks/index.d.ts.map +1 -0
  139. package/dist/fields/blocks/inputSchema.d.ts +22 -0
  140. package/dist/fields/blocks/inputSchema.d.ts.map +1 -0
  141. package/dist/fields/blocks/types.d.ts +253 -0
  142. package/dist/fields/blocks/types.d.ts.map +1 -0
  143. package/dist/fields/blocks/validator.d.ts +32 -0
  144. package/dist/fields/blocks/validator.d.ts.map +1 -0
  145. package/dist/fields/checkbox/config.d.ts +46 -0
  146. package/dist/fields/checkbox/config.d.ts.map +1 -0
  147. package/dist/fields/checkbox/index.d.ts +5 -0
  148. package/dist/fields/checkbox/index.d.ts.map +1 -0
  149. package/dist/fields/checkbox/inputSchema.d.ts +27 -0
  150. package/dist/fields/checkbox/inputSchema.d.ts.map +1 -0
  151. package/dist/fields/checkbox/types.d.ts +67 -0
  152. package/dist/fields/checkbox/types.d.ts.map +1 -0
  153. package/dist/fields/checkbox/validator.d.ts +34 -0
  154. package/dist/fields/checkbox/validator.d.ts.map +1 -0
  155. package/dist/fields/color/config.d.ts +49 -0
  156. package/dist/fields/color/config.d.ts.map +1 -0
  157. package/dist/fields/color/convert.d.ts +72 -0
  158. package/dist/fields/color/convert.d.ts.map +1 -0
  159. package/dist/fields/color/formats.d.ts +38 -0
  160. package/dist/fields/color/formats.d.ts.map +1 -0
  161. package/dist/fields/color/index.d.ts +8 -0
  162. package/dist/fields/color/index.d.ts.map +1 -0
  163. package/dist/fields/color/inputSchema.d.ts +29 -0
  164. package/dist/fields/color/inputSchema.d.ts.map +1 -0
  165. package/dist/fields/color/types.d.ts +100 -0
  166. package/dist/fields/color/types.d.ts.map +1 -0
  167. package/dist/fields/color/utils.d.ts +100 -0
  168. package/dist/fields/color/utils.d.ts.map +1 -0
  169. package/dist/fields/color/validator.d.ts +27 -0
  170. package/dist/fields/color/validator.d.ts.map +1 -0
  171. package/dist/fields/constants.d.ts +108 -0
  172. package/dist/fields/constants.d.ts.map +1 -0
  173. package/dist/fields/date/config.d.ts +57 -0
  174. package/dist/fields/date/config.d.ts.map +1 -0
  175. package/dist/fields/date/index.d.ts +5 -0
  176. package/dist/fields/date/index.d.ts.map +1 -0
  177. package/dist/fields/date/inputSchema.d.ts +29 -0
  178. package/dist/fields/date/inputSchema.d.ts.map +1 -0
  179. package/dist/fields/date/types.d.ts +147 -0
  180. package/dist/fields/date/types.d.ts.map +1 -0
  181. package/dist/fields/date/validator.d.ts +34 -0
  182. package/dist/fields/date/validator.d.ts.map +1 -0
  183. package/dist/fields/group/config.d.ts +47 -0
  184. package/dist/fields/group/config.d.ts.map +1 -0
  185. package/dist/fields/group/index.d.ts +5 -0
  186. package/dist/fields/group/index.d.ts.map +1 -0
  187. package/dist/fields/group/inputSchema.d.ts +27 -0
  188. package/dist/fields/group/inputSchema.d.ts.map +1 -0
  189. package/dist/fields/group/types.d.ts +105 -0
  190. package/dist/fields/group/types.d.ts.map +1 -0
  191. package/dist/fields/group/validator.d.ts +41 -0
  192. package/dist/fields/group/validator.d.ts.map +1 -0
  193. package/dist/fields/index.d.ts +20 -0
  194. package/dist/fields/index.d.ts.map +1 -0
  195. package/dist/fields/inputSchemas/index.d.ts +23 -0
  196. package/dist/fields/inputSchemas/index.d.ts.map +1 -0
  197. package/dist/fields/inputSchemas/utils.d.ts +25 -0
  198. package/dist/fields/inputSchemas/utils.d.ts.map +1 -0
  199. package/dist/fields/interfaceGen.d.ts +15 -0
  200. package/dist/fields/interfaceGen.d.ts.map +1 -0
  201. package/dist/fields/number/config.d.ts +48 -0
  202. package/dist/fields/number/config.d.ts.map +1 -0
  203. package/dist/fields/number/index.d.ts +5 -0
  204. package/dist/fields/number/index.d.ts.map +1 -0
  205. package/dist/fields/number/inputSchema.d.ts +23 -0
  206. package/dist/fields/number/inputSchema.d.ts.map +1 -0
  207. package/dist/fields/number/types.d.ts +100 -0
  208. package/dist/fields/number/types.d.ts.map +1 -0
  209. package/dist/fields/number/validator.d.ts +39 -0
  210. package/dist/fields/number/validator.d.ts.map +1 -0
  211. package/dist/fields/relationship/config.d.ts +45 -0
  212. package/dist/fields/relationship/config.d.ts.map +1 -0
  213. package/dist/fields/relationship/index.d.ts +5 -0
  214. package/dist/fields/relationship/index.d.ts.map +1 -0
  215. package/dist/fields/relationship/inputSchema.d.ts +31 -0
  216. package/dist/fields/relationship/inputSchema.d.ts.map +1 -0
  217. package/dist/fields/relationship/types.d.ts +126 -0
  218. package/dist/fields/relationship/types.d.ts.map +1 -0
  219. package/dist/fields/relationship/validator.d.ts +27 -0
  220. package/dist/fields/relationship/validator.d.ts.map +1 -0
  221. package/dist/fields/select/config.d.ts +59 -0
  222. package/dist/fields/select/config.d.ts.map +1 -0
  223. package/dist/fields/select/index.d.ts +5 -0
  224. package/dist/fields/select/index.d.ts.map +1 -0
  225. package/dist/fields/select/inputSchema.d.ts +28 -0
  226. package/dist/fields/select/inputSchema.d.ts.map +1 -0
  227. package/dist/fields/select/types.d.ts +89 -0
  228. package/dist/fields/select/types.d.ts.map +1 -0
  229. package/dist/fields/select/validator.d.ts +31 -0
  230. package/dist/fields/select/validator.d.ts.map +1 -0
  231. package/dist/fields/text/config.d.ts +48 -0
  232. package/dist/fields/text/config.d.ts.map +1 -0
  233. package/dist/fields/text/index.d.ts +5 -0
  234. package/dist/fields/text/index.d.ts.map +1 -0
  235. package/dist/fields/text/inputSchema.d.ts +24 -0
  236. package/dist/fields/text/inputSchema.d.ts.map +1 -0
  237. package/dist/fields/text/types.d.ts +132 -0
  238. package/dist/fields/text/types.d.ts.map +1 -0
  239. package/dist/fields/text/validator.d.ts +39 -0
  240. package/dist/fields/text/validator.d.ts.map +1 -0
  241. package/dist/fields/types.d.ts +135 -0
  242. package/dist/fields/types.d.ts.map +1 -0
  243. package/dist/fields/upload/config.d.ts +24 -0
  244. package/dist/fields/upload/config.d.ts.map +1 -0
  245. package/dist/fields/upload/index.d.ts +5 -0
  246. package/dist/fields/upload/index.d.ts.map +1 -0
  247. package/dist/fields/upload/inputSchema.d.ts +17 -0
  248. package/dist/fields/upload/inputSchema.d.ts.map +1 -0
  249. package/dist/fields/upload/types.d.ts +78 -0
  250. package/dist/fields/upload/types.d.ts.map +1 -0
  251. package/dist/fields/upload/validator.d.ts +16 -0
  252. package/dist/fields/upload/validator.d.ts.map +1 -0
  253. package/dist/fields/url/config.d.ts +49 -0
  254. package/dist/fields/url/config.d.ts.map +1 -0
  255. package/dist/fields/url/index.d.ts +5 -0
  256. package/dist/fields/url/index.d.ts.map +1 -0
  257. package/dist/fields/url/inputSchema.d.ts +31 -0
  258. package/dist/fields/url/inputSchema.d.ts.map +1 -0
  259. package/dist/fields/url/types.d.ts +70 -0
  260. package/dist/fields/url/types.d.ts.map +1 -0
  261. package/dist/fields/url/validator.d.ts +37 -0
  262. package/dist/fields/url/validator.d.ts.map +1 -0
  263. package/dist/fields/utils.d.ts +47 -0
  264. package/dist/fields/utils.d.ts.map +1 -0
  265. package/dist/fields/validators/index.d.ts +23 -0
  266. package/dist/fields/validators/index.d.ts.map +1 -0
  267. package/dist/fields/validators/utils.d.ts +24 -0
  268. package/dist/fields/validators/utils.d.ts.map +1 -0
  269. package/dist/framework.d.ts +227 -0
  270. package/dist/framework.d.ts.map +1 -0
  271. package/dist/globals/config/config.d.ts +1 -0
  272. package/dist/globals/config/config.d.ts.map +1 -0
  273. package/dist/globals/config/types.d.ts +1 -0
  274. package/dist/globals/config/types.d.ts.map +1 -0
  275. package/dist/globals/config.d.ts +47 -0
  276. package/dist/globals/config.d.ts.map +1 -0
  277. package/dist/globals/index.d.ts +5 -0
  278. package/dist/globals/index.d.ts.map +1 -0
  279. package/dist/globals/interfaceGen.d.ts +33 -0
  280. package/dist/globals/interfaceGen.d.ts.map +1 -0
  281. package/dist/globals/types.d.ts +175 -0
  282. package/dist/globals/types.d.ts.map +1 -0
  283. package/dist/globals/utils.d.ts +37 -0
  284. package/dist/globals/utils.d.ts.map +1 -0
  285. package/dist/index.d.ts +15 -3165
  286. package/dist/index.d.ts.map +1 -0
  287. package/dist/index.js +2101 -3475
  288. package/dist/index.js.map +1 -1
  289. package/dist/media/api/index.d.ts +5 -0
  290. package/dist/media/api/index.d.ts.map +1 -0
  291. package/dist/media/api/mutations.d.ts +76 -0
  292. package/dist/media/api/mutations.d.ts.map +1 -0
  293. package/dist/media/api/queries.d.ts +28 -0
  294. package/dist/media/api/queries.d.ts.map +1 -0
  295. package/dist/media/api/server.d.ts +68 -0
  296. package/dist/media/api/server.d.ts.map +1 -0
  297. package/dist/media/api/types.d.ts +171 -0
  298. package/dist/media/api/types.d.ts.map +1 -0
  299. package/dist/media/config.d.ts +25 -0
  300. package/dist/media/config.d.ts.map +1 -0
  301. package/dist/media/index.d.ts +6 -0
  302. package/dist/media/index.d.ts.map +1 -0
  303. package/dist/media/types.d.ts +332 -0
  304. package/dist/media/types.d.ts.map +1 -0
  305. package/dist/media/utils.d.ts +35 -0
  306. package/dist/media/utils.d.ts.map +1 -0
  307. package/dist/media/validators.d.ts +61 -0
  308. package/dist/media/validators.d.ts.map +1 -0
  309. package/dist/schema/generateVexSchema.d.ts +36 -0
  310. package/dist/schema/generateVexSchema.d.ts.map +1 -0
  311. package/dist/schema/index.d.ts +3 -0
  312. package/dist/schema/index.d.ts.map +1 -0
  313. package/dist/schema/migrate.d.ts +73 -0
  314. package/dist/schema/migrate.d.ts.map +1 -0
  315. package/dist/types/generateVexTypes.d.ts +41 -0
  316. package/dist/types/generateVexTypes.d.ts.map +1 -0
  317. package/dist/types/generated.d.ts +382 -0
  318. package/dist/types/generated.d.ts.map +1 -0
  319. package/dist/types/index.d.ts +5 -0
  320. package/dist/types/index.d.ts.map +1 -0
  321. package/dist/utils.d.ts +57 -0
  322. package/dist/utils.d.ts.map +1 -0
  323. package/package.json +67 -24
@@ -0,0 +1,50 @@
1
+ import type { CollectionSlug } from "../../types/generated";
2
+ import type { GenericMutationClientParams } from "../types";
3
+ /**
4
+ * Client-side args for {@link create}.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { create, type CreateClientArgs } from "@vexcms/core/client";
9
+ * import { useMutation } from "@tanstack/react-query";
10
+ *
11
+ * // Inside a React component:
12
+ * const { mutateAsync } = useMutation({ mutationFn: create() });
13
+ * await mutateAsync({ collection: "posts", data: { title: "My first post" } });
14
+ * ```
15
+ */
16
+ export interface CreateClientArgs extends GenericMutationClientParams {
17
+ /** The collection slug to insert into. */
18
+ collection: CollectionSlug;
19
+ /** Field values for the new document. */
20
+ data: Record<string, unknown>;
21
+ }
22
+ /**
23
+ * Returns a `mutationFn` for creating a document in a VexCMS collection.
24
+ *
25
+ * Wraps `useConvexMutation(vexConvexApi.create)`. Call at the top level of
26
+ * a React component (obeys the Rules of Hooks); pass the return value as
27
+ * `mutationFn` to `useMutation`.
28
+ *
29
+ * Import from `@vexcms/core/client`. For the server-side version, import
30
+ * `create` from `@vexcms/core/server`.
31
+ *
32
+ * @returns A mutation function compatible with tanstack-query `useMutation`.
33
+ * @see {@link CreateClientArgs} for the typed args shape.
34
+ * @example
35
+ * ```tsx
36
+ * import { create } from "@vexcms/core/client";
37
+ * import { useMutation } from "@tanstack/react-query";
38
+ *
39
+ * export function CreatePostButton() {
40
+ * const { mutateAsync, isPending } = useMutation({ mutationFn: create() });
41
+ * return (
42
+ * <button onClick={() => mutateAsync({ collection: "posts", data: { title: "Hi" } })}>
43
+ * {isPending ? "Creating…" : "Create"}
44
+ * </button>
45
+ * );
46
+ * }
47
+ * ```
48
+ */
49
+ export declare function create(): import("convex/react").ReactMutation<import("convex/server").FunctionReference<"mutation", "public", import("../convex").VexCreateArgs, string>>;
50
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/create/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAE5D;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAiB,SAAQ,2BAA2B;IACnE,0CAA0C;IAC1C,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,MAAM,qJAErB"}
@@ -0,0 +1,43 @@
1
+ import type { BetterOmit, DocumentByName, Expand, GenericDataModel, TableNamesInDataModel } from "convex/server";
2
+ import type { CollectionSlug } from "../../types/generated";
3
+ import type { GenericMutationServerParams } from "../types";
4
+ /**
5
+ * Server-side args for `create`.
6
+ *
7
+ * @typeParam DataModel - The Convex data model (inferred from `ctx`).
8
+ * @typeParam TCollectionSlug - Collection slug.
9
+ */
10
+ export interface CreateServerArgs<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug> extends GenericMutationServerParams<DataModel> {
11
+ /** The collection slug to insert into. */
12
+ collection: TCollectionSlug;
13
+ /**
14
+ * Field values for the new document. `_id` and `_creationTime` are
15
+ * excluded — Convex assigns these automatically.
16
+ *
17
+ * Passed through `v.any()` at the network boundary; CLI codegen validates
18
+ * the shape against the Convex schema at build time.
19
+ */
20
+ data: Expand<BetterOmit<DocumentByName<DataModel, TableNamesInDataModel<DataModel>>, "_creationTime" | "_id">>;
21
+ }
22
+ /**
23
+ * Inserts a document into a VexCMS collection and returns its ID.
24
+ * Server-side only — call inside a Convex mutation handler.
25
+ *
26
+ * Import from `@vexcms/core/server`.
27
+ *
28
+ * @typeParam DataModel - Convex data model (inferred from `args.ctx`).
29
+ * @typeParam TCollectionSlug - Collection slug.
30
+ * @param args - `{ ctx, collection, data }`. `ctx` must be a mutation context.
31
+ * @returns Promise resolving to the new document's ID as a string.
32
+ * @example
33
+ * ```ts
34
+ * import { create } from "@vexcms/core/server";
35
+ *
36
+ * export const createPost = mutation({
37
+ * args: { data: v.any() },
38
+ * handler: (ctx, args) => create({ ctx, collection: "posts", data: args.data }),
39
+ * });
40
+ * ```
41
+ */
42
+ export declare function create<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug>(args: CreateServerArgs<DataModel, TCollectionSlug>): Promise<string>;
43
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/create/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAI5D;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAC/B,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,CACtC,SAAQ,2BAA2B,CAAC,SAAS,CAAC;IAC9C,0CAA0C;IAC1C,UAAU,EAAE,eAAe,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CACV,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,KAAK,CAAC,CACjG,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,MAAM,CAC1B,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,IAAI,EAAE,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCrE"}
@@ -0,0 +1,39 @@
1
+ import type { VexConfig } from "../config";
2
+ import { PopulateShape } from "./types";
3
+ /**
4
+ * Builds a `PopulateShape`-compatible object covering every relationship field
5
+ * on `slug`'s collection down to `depth` levels.
6
+ *
7
+ * This is the runtime counterpart of the compile-time `DepthPopulate<TCollectionSlug, D>`
8
+ * type. The returned object can be passed directly to `populateDocs` because it
9
+ * matches the `PopulateShape` structure:
10
+ * - Leaf fields (at the requested depth, or targets with no relationships) → `true`
11
+ * - Intermediate fields → `{ populate: <nested result> }`
12
+ *
13
+ * The function relies on the live `VexConfig` available in the `queryApi`
14
+ * closure. It never touches the database — it only walks the in-memory config.
15
+ *
16
+ * **Circular schema guard:** the `visited` set prevents infinite recursion when
17
+ * two collections point to each other. A circular edge is treated as a leaf
18
+ * (`true`) — the field is populated one level, but the cycle is cut.
19
+ *
20
+ * @param config - The user's resolved `VexConfig`.
21
+ * @param slug - The collection or global slug to start from.
22
+ * @param depth - Levels to descend. `0` returns `{}` (no population).
23
+ * @param visited - Internal cycle guard — callers must not supply this.
24
+ * @returns A plain object usable as the `populate` arg to `populateDocs`.
25
+ *
26
+ * @example depth 1 — all direct relationships populated
27
+ * ```ts
28
+ * buildDepthPopulate(config, "posts", 1)
29
+ * // → { author: true, category: true }
30
+ * ```
31
+ * @example depth 2 — relationships of relationships also populated
32
+ * ```ts
33
+ * buildDepthPopulate(config, "posts", 2)
34
+ * // → { author: { populate: { team: true } }, category: true }
35
+ * // (category has no relationships → collapses to `true`)
36
+ * ```
37
+ */
38
+ export declare function buildDepthPopulate<TPopulate extends PopulateShape = PopulateShape>(config: VexConfig, slug: string, depth: number, visited?: ReadonlySet<string>): TPopulate;
39
+ //# sourceMappingURL=depth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"depth.d.ts","sourceRoot":"","sources":["../../src/api/depth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,SAAS,aAAa,GAAG,aAAa,EAChF,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,WAAW,CAAC,MAAM,CAAa,GACvC,SAAS,CA8BX"}
@@ -0,0 +1,90 @@
1
+ import type { FunctionReference } from "convex/server";
2
+ import { type VexFindArgs, type VexFindPaginatedArgs } from "../convex";
3
+ import type { CollectionSlug } from "../../types/generated";
4
+ import type { DocReturnItem, GenericQueryClientParams, PaginationOptions, PaginationResult, PopulateShape, VexQueryOptions } from "../types";
5
+ /**
6
+ * Client-side args for `find`. Extends {@link GenericQueryClientParams}
7
+ * to inherit `ctx?: never`, `populate?: TPopulate`, `depth?: D`, and `skip?`.
8
+ *
9
+ * @typeParam TCollectionSlug - Collection slug.
10
+ * @typeParam TPopulate - Populate object, narrowed against `RelationshipKeysOf<TCollectionSlug>`.
11
+ * @typeParam D - Depth literal (0 = none). Inferred from `depth`.
12
+ */
13
+ export interface FindClientArgs<TCollectionSlug extends CollectionSlug = CollectionSlug, TPopulate extends PopulateShape<TCollectionSlug> = PopulateShape<TCollectionSlug>, D extends number = number> extends GenericQueryClientParams<TCollectionSlug, TPopulate, D> {
14
+ collection: TCollectionSlug;
15
+ limit?: number;
16
+ paginationOpts?: PaginationOptions;
17
+ }
18
+ /**
19
+ * Internal Client-side args for `find` with pagination options required. Extends {@link GenericQueryClientParams}
20
+ * to inherit `ctx?: never`, `populate?: TPopulate`, `depth?: D`, and `skip?`.
21
+ *
22
+ * @typeParam TCollectionSlug - Collection slug.
23
+ * @typeParam TPopulate - Populate object, narrowed against `RelationshipKeysOf<TCollectionSlug>`.
24
+ * @typeParam D - Depth literal (0 = none). Inferred from `depth`.
25
+ */
26
+ export interface FindClientPaginatedArgs<TCollectionSlug extends CollectionSlug = CollectionSlug, TPopulate extends PopulateShape<TCollectionSlug> = PopulateShape<TCollectionSlug>, D extends number = number> extends GenericQueryClientParams<TCollectionSlug, TPopulate, D> {
27
+ collection: TCollectionSlug;
28
+ limit?: number;
29
+ paginationOpts: PaginationOptions;
30
+ }
31
+ /**
32
+ * Returns tanstack-query options for listing documents in a VexCMS collection,
33
+ * typed to the document of the `collection` slug passed in.
34
+ *
35
+ * Client-side only — pass to `useQuery` / `useSuspenseQuery` / `prefetchQuery`.
36
+ *
37
+ * Import from `@vexcms/core/client`. For the server-side version, import
38
+ * `find` from `@vexcms/core/server`.
39
+ *
40
+ * Two overloads mirror the server function: without `paginationOpts` the data is
41
+ * an array; with it, a `PaginationResult`. This keeps callers from having to
42
+ * narrow a union at every callsite.
43
+ *
44
+ * The funcRef is cast per instantiation for the reason documented on `get` —
45
+ * `api.vex.find` is one registered function serving every collection, so its
46
+ * return type is fixed at codegen and a runtime `collection` value cannot
47
+ * narrow it.
48
+ *
49
+ * @typeParam TCollectionSlug - Collection slug; compile-error if not registered.
50
+ * @typeParam TPopulate - Populate object, narrowed against `RelationshipKeysOf<TCollectionSlug>`.
51
+ * @typeParam D - Depth literal (0 = none). A non-literal `number` degrades to
52
+ * `VexDocument`, matching the runtime guard in `DepthPopulated`.
53
+ * @param args - `{ collection, populate?, depth?, limit?, paginationOpts?, skip? }`.
54
+ * @returns Tanstack-query options for `useQuery` / `useSuspenseQuery`.
55
+ * @example
56
+ * ```tsx
57
+ * import { find } from "@vexcms/core/client";
58
+ *
59
+ * const { data: posts } = useQuery(find({ collection: "posts" }));
60
+ * // ^? Post[]
61
+ *
62
+ * const { data: page } = useQuery(
63
+ * find({ collection: "posts", paginationOpts: { numItems: 20, cursor: null } }),
64
+ * );
65
+ * // ^? PaginationResult<Post>
66
+ * ```
67
+ */
68
+ export declare function find<TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: FindClientArgs<TCollectionSlug, TPopulate, D> & {
69
+ paginationOpts?: never;
70
+ }): VexQueryOptions<VexFindArgs, DocReturnItem<TCollectionSlug, TPopulate, D>[]>;
71
+ export declare function find<TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: FindClientPaginatedArgs<TCollectionSlug, TPopulate, D>): VexQueryOptions<VexFindPaginatedArgs, PaginationResult<DocReturnItem<TCollectionSlug, TPopulate, D>>>;
72
+ export declare namespace find {
73
+ var queryKey: typeof findQueryKey;
74
+ }
75
+ /**
76
+ * Returns the tanstack-query queryKey for `find` without issuing a full call.
77
+ * Use to invalidate the list query after a mutation.
78
+ *
79
+ * @typeParam TCollectionSlug - Collection slug.
80
+ * @typeParam TPopulate - Populate object.
81
+ * @typeParam D - Depth literal (0 = none).
82
+ * @param args - The find args to compute the queryKey for.
83
+ * @returns The tanstack-query `queryKey` array for the given collection.
84
+ * @example
85
+ * ```ts
86
+ * queryClient.invalidateQueries({ queryKey: findQueryKey({ collection: "posts" }) });
87
+ * ```
88
+ */
89
+ export declare function findQueryKey<TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: FindClientArgs<TCollectionSlug, TPopulate, D>): ["convexQuery", FunctionReference<"query", "public", VexFindArgs, import("../convex").VexDocument[] | PaginationResult<import("../convex").VexDocument>>, VexFindArgs];
90
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/find/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,aAAa,EAGb,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc,CAC7B,eAAe,SAAS,cAAc,GAAG,cAAc,EACvD,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,EACjF,CAAC,SAAS,MAAM,GAAG,MAAM,CACzB,SAAQ,wBAAwB,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/D,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB,CACtC,eAAe,SAAS,cAAc,GAAG,cAAc,EACvD,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,aAAa,CAAC,eAAe,CAAC,EACjF,CAAC,SAAS,MAAM,GAAG,MAAM,CACzB,SAAQ,wBAAwB,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/D,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,IAAI,CAClB,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,cAAc,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG;IAAE,cAAc,CAAC,EAAE,KAAK,CAAA;CAAE,GAG/E,eAAe,CAAC,WAAW,EAAE,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAChF,wBAAgB,IAAI,CAClB,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,uBAAuB,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GAC3D,eAAe,CAChB,oBAAoB,EACpB,gBAAgB,CAAC,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAC/D,CAAC;yBATc,IAAI;;;AAiDpB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAC1B,IAAI,EAAE,cAAc,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,0KAQpD"}
@@ -0,0 +1,73 @@
1
+ import type { ExpressionOrValue, FilterBuilder, GenericDataModel, IndexNames, IndexRange, IndexRangeBuilder, NamedIndex, NamedTableInfo, TableNamesInDataModel } from "convex/server";
2
+ import type { CollectionSlug } from "../../types/generated";
3
+ import type { DocReturnItem, GenericQueryServerParams, PaginationOptions, PaginationResult, PopulateShape } from "../types";
4
+ /**
5
+ * Server-side args for `find`. Extends {@link GenericQueryServerParams}
6
+ * to inherit `ctx`, `populate`, `depth`, and `config` (with their mutual-exclusion
7
+ * constraints). All query-chain options map to `ctx.db.query()` equivalents
8
+ * applied in order: `withIndex` → `order` → `filter` → `take`.
9
+ *
10
+ * @typeParam DataModel - The Convex data model (inferred from `ctx`).
11
+ * @typeParam TCollectionSlug - Collection slug.
12
+ * @typeParam TPopulate - Populate object.
13
+ * @typeParam D - Depth literal (0 = no depth, default).
14
+ */
15
+ export interface FindServerArgs<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug, TPopulate extends PopulateShape<TCollectionSlug>, D extends number = 0> extends GenericQueryServerParams<DataModel, TCollectionSlug, TPopulate, D> {
16
+ /** The collection to query — must match a registered collection slug. */
17
+ collection: TCollectionSlug;
18
+ /**
19
+ * Maximum number of documents to return. Defaults to 100.
20
+ * Applied as the terminal `.take(n)` on the Convex query.
21
+ */
22
+ limit?: number;
23
+ /**
24
+ * Result ordering. Equivalent to `.order("asc" | "desc")` on the Convex
25
+ * query. Defaults to `"asc"` (insertion order).
26
+ */
27
+ order?: "asc" | "desc";
28
+ /**
29
+ * Filter predicate applied after index narrowing. Equivalent to
30
+ * `.filter(q => q.eq(q.field("published"), true))` on the Convex query.
31
+ *
32
+ * Prefer `withIndex` for performance — `filter` scans every document
33
+ * in the range and is O(n). Use `filter` for secondary conditions that
34
+ * can't be expressed as index equality ranges.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * find({ ctx, collection: "posts", filter: q => q.eq(q.field("published"), true) })
39
+ * ```
40
+ */
41
+ filter?: (q: FilterBuilder<NamedTableInfo<DataModel, TCollectionSlug extends TableNamesInDataModel<DataModel> ? TCollectionSlug : never>>) => ExpressionOrValue<boolean>;
42
+ /**
43
+ * Index to use for the query, with an optional equality/range constraint.
44
+ * Equivalent to `.withIndex(name, range?)` on the Convex query.
45
+ *
46
+ * Using an index is strongly preferred over `filter` for performance.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * find({ ctx, collection: "posts", withIndex: { name: "by_slug", range: q => q.eq("slug", "hello") } })
51
+ * find({ ctx, collection: "posts", withIndex: { name: "by_score", range: q => q.gte("score", 50) } })
52
+ * find({ ctx, collection: "posts", withIndex: { name: "by_publishedAt" } })
53
+ * ```
54
+ */
55
+ withIndex?: TCollectionSlug extends TableNamesInDataModel<DataModel> ? {
56
+ name: IndexNames<NamedTableInfo<DataModel, TCollectionSlug>>;
57
+ range?: (q: IndexRangeBuilder<any, NamedIndex<NamedTableInfo<DataModel, TCollectionSlug>, IndexNames<NamedTableInfo<DataModel, TCollectionSlug>>>>) => IndexRange;
58
+ } : never;
59
+ /**
60
+ * Pagination options. When provided, the function returns a `PaginationResult`
61
+ * with `{ page, continueCursor, isDone }` instead of a plain array.
62
+ *
63
+ * Uses Convex's native `.paginate(opts)` API under the hood.
64
+ */
65
+ paginationOpts?: PaginationOptions;
66
+ }
67
+ export declare function find<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: FindServerArgs<DataModel, TCollectionSlug, TPopulate, D> & {
68
+ paginationOpts?: never;
69
+ }): Promise<DocReturnItem<TCollectionSlug, TPopulate, D>[]>;
70
+ export declare function find<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: FindServerArgs<DataModel, TCollectionSlug, TPopulate, D> & {
71
+ paginationOpts: PaginationOptions;
72
+ }): Promise<PaginationResult<DocReturnItem<TCollectionSlug, TPopulate, D>>>;
73
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/find/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EACV,aAAa,EAGb,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAalB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc,CAC7B,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,EAChD,CAAC,SAAS,MAAM,GAAG,CAAC,CACpB,SAAQ,wBAAwB,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1E,yEAAyE;IACzE,UAAU,EAAE,eAAe,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAEvB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,CACP,CAAC,EAAE,aAAa,CACd,cAAc,CACZ,SAAS,EACT,eAAe,SAAS,qBAAqB,CAAC,SAAS,CAAC,GAAG,eAAe,GAAG,KAAK,CACnF,CACF,KACE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,eAAe,SAAS,qBAAqB,CAAC,SAAS,CAAC,GAChE;QACE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;QAC7D,KAAK,CAAC,EAAE,CACN,CAAC,EAAE,iBAAiB,CAElB,GAAG,EACH,UAAU,CACR,cAAc,CAAC,SAAS,EAAE,eAAe,CAAC,EAC1C,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CACvD,CACF,KACE,UAAU,CAAC;KACjB,GACD,KAAK,CAAC;IAEV;;;;;OAKG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;CACpC;AAGD,wBAAsB,IAAI,CACxB,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG;IAC/D,cAAc,CAAC,EAAE,KAAK,CAAC;CACxB,GAGA,OAAO,CAAC,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;AAG3D,wBAAsB,IAAI,CACxB,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG;IAC/D,cAAc,EAAE,iBAAiB,CAAC;CACnC,GACA,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { GenericId } from "convex/values";
2
+ import { type VexGetArgs } from "../convex";
3
+ import type { CollectionSlug } from "../../types/generated";
4
+ import type { GenericQueryClientParams, GetReturn, PopulateShape, VexQueryOptions } from "../types";
5
+ /**
6
+ * Client-side args for `get`. Extends {@link GenericQueryClientParams}
7
+ * to inherit `ctx?: never`, `populate?: TPopulate`, and `depth?: D`.
8
+ *
9
+ * @typeParam TCollectionSlug - Collection slug, recovered from the `Id` brand.
10
+ * @typeParam TPopulate - Populate object.
11
+ * @typeParam D - Depth literal (0 = none). Inferred from `depth`.
12
+ */
13
+ export interface GetClientArgs<TCollectionSlug extends CollectionSlug, TPopulate extends PopulateShape<TCollectionSlug>, D extends number = 0> extends GenericQueryClientParams<TCollectionSlug, TPopulate, D> {
14
+ id: GenericId<TCollectionSlug>;
15
+ collection: TCollectionSlug;
16
+ }
17
+ /**
18
+ * Returns tanstack-query options for fetching a single document by ID, typed to
19
+ * the document of the `collection` slug passed in.
20
+ *
21
+ * Client-side only — pass to `useQuery` / `useSuspenseQuery`.
22
+ *
23
+ * Import from `@vexcms/core/client`. For the server-side version, import
24
+ * `get` from `@vexcms/core/server`.
25
+ *
26
+ * ### Why the funcRef is cast
27
+ *
28
+ * `api.vex.get` is a single registered Convex function serving every
29
+ * collection, so codegen fixes one return type for it (`VexDocument | null`) —
30
+ * `collection` crosses the network boundary as a runtime *value* and can never
31
+ * narrow it. This wrapper captures the slug as a type (`TCollectionSlug`) at the
32
+ * call site and casts the reference to {@link GetReturn}, restoring the type the
33
+ * boundary erased. Sound because the endpoint really does return that
34
+ * collection's document: the server `get` reads the row from that table.
35
+ *
36
+ * @typeParam TCollectionSlug - Collection slug, recovered from the `Id` brand.
37
+ * @typeParam TPopulate - Populate object.
38
+ * @typeParam D - Depth literal (0 = none). A non-literal `number` degrades to
39
+ * `VexDocument`, matching the runtime guard in `DepthPopulated`.
40
+ * @param args - `{ id, collection, populate?, depth? }`.
41
+ * @returns Tanstack-query options whose data is the doc or `null`.
42
+ * @example
43
+ * ```tsx
44
+ * import { get } from "@vexcms/core/client";
45
+ *
46
+ * const { data: post } = useQuery(get({ id: postId, collection: "posts" }));
47
+ * // ^? Post | null
48
+ *
49
+ * const { data: withAuthor } = useQuery(
50
+ * get({ id: postId, collection: "posts", populate: { author: true } }),
51
+ * );
52
+ * // ^? (Post & { author: Author[] }) | null
53
+ * ```
54
+ */
55
+ export declare function get<TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: GetClientArgs<TCollectionSlug, TPopulate, D>): VexQueryOptions<VexGetArgs, GetReturn<TCollectionSlug, TPopulate, D>>;
56
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/get/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEpG;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa,CAC5B,eAAe,SAAS,cAAc,EACtC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,EAChD,CAAC,SAAS,MAAM,GAAG,CAAC,CACpB,SAAQ,wBAAwB,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/D,EAAE,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC/B,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,GAAG,CACjB,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,aAAa,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GACjD,eAAe,CAAC,UAAU,EAAE,SAAS,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAkBvE"}
@@ -0,0 +1,49 @@
1
+ import type { GenericDataModel } from "convex/server";
2
+ import type { GenericId } from "convex/values";
3
+ import type { CollectionSlug } from "../../types/generated";
4
+ import type { GenericQueryServerParams, GetReturn, PopulateShape } from "../types";
5
+ /**
6
+ * Server-side args for `get`.
7
+ *
8
+ * Inherits `ctx`, `populate`, `depth`, and `config` (with mutual-exclusion
9
+ * constraints) from {@link GenericQueryServerParams}.
10
+ *
11
+ * @typeParam DataModel - The Convex data model (inferred from `ctx`).
12
+ * @typeParam TCollectionSlug - Collection slug.
13
+ * @typeParam TPopulate - Populate object.
14
+ * @typeParam D - Depth literal (0 = no depth, default).
15
+ */
16
+ export interface GetServerArgs<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug, TPopulate extends PopulateShape<TCollectionSlug>, D extends number = 0> extends GenericQueryServerParams<DataModel, TCollectionSlug, TPopulate, D> {
17
+ /** The document ID to fetch. */
18
+ id: GenericId<TCollectionSlug>;
19
+ /** The collection slug to patch this document. */
20
+ collection: TCollectionSlug;
21
+ }
22
+ /**
23
+ * Fetches a single document by its `Id<TCollectionSlug>`. Server-side only.
24
+ *
25
+ * Pass `populate` to explicitly name the relationship fields to resolve
26
+ * (documented, recommended). Pass `depth` (with `config`) to automatically
27
+ * populate all relationship fields to N levels — internal use only.
28
+ *
29
+ * Import from `@vexcms/core/server`. For the client-side version, import
30
+ * `get` from `@vexcms/core/client`.
31
+ *
32
+ * @typeParam DataModel - Convex data model (inferred from `args.ctx`).
33
+ * @typeParam TCollectionSlug - Collection slug, recovered from the `Id` brand.
34
+ * @typeParam TPopulate - Populate object.
35
+ * @typeParam D - Depth literal (0 = none).
36
+ * @param args - `{ ctx, id, populate? }` or `{ ctx, id, depth, config }`.
37
+ * @returns Promise resolving to the doc or `null` if not found.
38
+ * @example
39
+ * ```ts
40
+ * import { get } from "@vexcms/core/server";
41
+ *
42
+ * export const post = query({
43
+ * args: { id: v.id("posts") },
44
+ * handler: (ctx, args) => get({ ctx, id: args.id, populate: { author: true } }),
45
+ * });
46
+ * ```
47
+ */
48
+ export declare function get<DataModel extends GenericDataModel, TCollectionSlug extends CollectionSlug, const TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>, const D extends number = 0>(args: GetServerArgs<DataModel, TCollectionSlug, TPopulate, D>): Promise<GetReturn<TCollectionSlug, TPopulate, D>>;
49
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/api/get/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAInF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa,CAC5B,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,EAChD,CAAC,SAAS,MAAM,GAAG,CAAC,CACpB,SAAQ,wBAAwB,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1E,gCAAgC;IAChC,EAAE,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC/B,kDAAkD;IAClD,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,GAAG,CACvB,SAAS,SAAS,gBAAgB,EAClC,eAAe,SAAS,cAAc,EACtC,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC9E,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,EAE1B,IAAI,EAAE,aAAa,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,GAC5D,OAAO,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAoDnD"}
@@ -0,0 +1,20 @@
1
+ import { type VexGlobalsFindArgs } from "../convex";
2
+ import type { VexDocumentGlobal } from "../../types/generated";
3
+ import type { VexQueryOptions } from "../types";
4
+ /**
5
+ * Returns tanstack-query options for listing all saved global documents.
6
+ * Each element is a flat `VexDocumentGlobal` (unnarrowed). For typed
7
+ * single-global access use `globals.get` instead. Client-side only.
8
+ *
9
+ * @returns Tanstack-query `queryOptions` for `useQuery`.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * import { globals } from "@vexcms/core/client";
14
+ *
15
+ * const { data } = useQuery(globals.find({}));
16
+ * data?.map((g) => g._slug); // ["siteSettings", "nav"]
17
+ * ```
18
+ */
19
+ export declare function findGlobals(): VexQueryOptions<VexGlobalsFindArgs, VexDocumentGlobal[]>;
20
+ //# sourceMappingURL=find.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.client.d.ts","sourceRoot":"","sources":["../../../src/api/globals/find.client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,IAAI,eAAe,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,CAAC,CAUtF"}
@@ -0,0 +1,29 @@
1
+ import type { GenericDataModel } from "convex/server";
2
+ import type { VexDocumentGlobal } from "../../types/generated";
3
+ import type { GenericGlobalsQueryServerArgs } from "./types";
4
+ /**
5
+ * Returns all rows from `vex_globals` as flat documents, ordered by
6
+ * `_creationTime` ascending. Only includes globals that have been saved at
7
+ * least once — globals registered in config but never saved are absent.
8
+ *
9
+ * The return type is `VexDocumentGlobal[]` (unnarrowed) because each element
10
+ * may be a different slug with different user fields. Access specific fields
11
+ * via the index signature: `doc["siteName"]`. For typed single-global access,
12
+ * use `getGlobal` instead.
13
+ *
14
+ * Server-side only. Import from `@vexcms/core/server`.
15
+ *
16
+ * @typeParam DataModel - Convex data model.
17
+ * @param args - `{ ctx }`.
18
+ * @returns Flat global documents, unnarrowed.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { findGlobals } from "@vexcms/core/server";
23
+ *
24
+ * const all = await findGlobals({ ctx });
25
+ * all.map((g) => g._slug); // ["siteSettings", "nav"]
26
+ * ```
27
+ */
28
+ export declare function findGlobals<DataModel extends GenericDataModel>(args: GenericGlobalsQueryServerArgs<DataModel>): Promise<VexDocumentGlobal[]>;
29
+ //# sourceMappingURL=find.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.server.d.ts","sourceRoot":"","sources":["../../../src/api/globals/find.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,WAAW,CAAC,SAAS,SAAS,gBAAgB,EAClE,IAAI,EAAE,6BAA6B,CAAC,SAAS,CAAC,GAC7C,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAyB9B"}
@@ -0,0 +1,46 @@
1
+ import { type VexGlobalsGetArgs } from "../convex";
2
+ import type { GlobalSlug, GlobalPopulateShape } from "../../types/generated";
3
+ import type { VexQueryOptions } from "../types";
4
+ import type { GetGlobalReturn } from "./get.server";
5
+ /**
6
+ * Client-side args for `globals.get`.
7
+ *
8
+ * @typeParam TSlug - Global slug; narrowed after `vex generate`.
9
+ * @typeParam TPopulate - Populate shape; keys restricted to relationship fields.
10
+ */
11
+ export interface GetGlobalClientArgs<TGlobalSlug extends GlobalSlug = GlobalSlug, TPopulate extends GlobalPopulateShape<TGlobalSlug> = Record<string, never>> {
12
+ /** Discriminator: client args must NOT include `ctx`. */
13
+ ctx?: never;
14
+ /** Global slug to fetch. Compile-error on unknown slugs after `vex generate`. */
15
+ slug: TGlobalSlug;
16
+ /** Relationship fields to populate. Keys narrowed to relationship fields post-generate. */
17
+ populate?: TPopulate;
18
+ }
19
+ /**
20
+ * Returns tanstack-query options for fetching a single global by slug.
21
+ * The returned document is flat — user fields are at root level alongside
22
+ * `_id`, `_creationTime`, and `_slug`. Client-side only.
23
+ *
24
+ * Import from `@vexcms/core/client`. For the server-side version, import
25
+ * `getGlobal` from `@vexcms/core/server`.
26
+ *
27
+ * @typeParam TSlug - Global slug.
28
+ * @typeParam TPopulate - Populate shape.
29
+ * @param args - `{ slug, populate? }`.
30
+ * @returns Tanstack-query `queryOptions` for `useQuery`.
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { globals } from "@vexcms/core/client";
35
+ *
36
+ * // Basic
37
+ * const { data } = useQuery(globals.get({ slug: "siteSettings" }));
38
+ * data?.siteName; // string | undefined
39
+ *
40
+ * // With populate
41
+ * const { data } = useQuery(globals.get({ slug: "siteSettings", populate: { activeTheme: true } }));
42
+ * data?.activeTheme; // Doc<"themes">[] (runtime) | Record<string, unknown>[] (type)
43
+ * ```
44
+ */
45
+ export declare function getGlobal<TSlug extends GlobalSlug = GlobalSlug, const TPopulate extends GlobalPopulateShape<TSlug> = Record<string, never>>(args: GetGlobalClientArgs<TSlug, TPopulate>): VexQueryOptions<VexGlobalsGetArgs, GetGlobalReturn<TSlug, TPopulate, 0>>;
46
+ //# sourceMappingURL=get.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.client.d.ts","sourceRoot":"","sources":["../../../src/api/globals/get.client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB,CAClC,WAAW,SAAS,UAAU,GAAG,UAAU,EAC3C,SAAS,SAAS,mBAAmB,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAE1E,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,iFAAiF;IACjF,IAAI,EAAE,WAAW,CAAC;IAClB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CACvB,KAAK,SAAS,UAAU,GAAG,UAAU,EACrC,KAAK,CAAC,SAAS,SAAS,mBAAmB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAE1E,IAAI,EAAE,mBAAmB,CAAC,KAAK,EAAE,SAAS,CAAC,GAC1C,eAAe,CAAC,iBAAiB,EAAE,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAe1E"}
@@ -0,0 +1,55 @@
1
+ import type { GenericDataModel } from "convex/server";
2
+ import type { GlobalSlug, GlobalDocumentBySlug, GlobalPopulateShape, GlobalPopulated, VexDocumentGlobal } from "../../types/generated";
3
+ import type { Prettify } from "../types";
4
+ import { GenericGlobalsQueryServerArgs } from "./types";
5
+ /**
6
+ * Server-side args for `getGlobal`. Populate and depth are mutually exclusive.
7
+ *
8
+ * @typeParam DataModel - Convex data model.
9
+ * @typeParam TSlug - Global slug.
10
+ * @typeParam TPopulate - Populate shape.
11
+ * @typeParam D - Depth literal.
12
+ */
13
+ export interface GetGlobalServerArgs<DataModel extends GenericDataModel, TGlobalSlug extends GlobalSlug = GlobalSlug, TPopulate extends GlobalPopulateShape<TGlobalSlug> = Record<string, never>, D extends number = 0> extends GenericGlobalsQueryServerArgs<DataModel, TGlobalSlug> {
14
+ /** Global slug to fetch. Narrowed to `GlobalSlug` after `vex generate`. */
15
+ slug: TGlobalSlug;
16
+ /** Relationship fields to populate. Mutually exclusive with `depth`. */
17
+ populate?: [D] extends [0] ? TPopulate : never;
18
+ /** Auto-populate all relationship fields to N levels. Mutually exclusive with `populate`. */
19
+ depth?: [TPopulate] extends [Record<string, never>] ? D : never;
20
+ }
21
+ /**
22
+ * Return type of `getGlobal` — narrows by populate/depth presence.
23
+ */
24
+ export type GetGlobalReturn<TSlug extends GlobalSlug, TPopulate extends GlobalPopulateShape<TSlug>, D extends number> = [TPopulate] extends [Record<string, never>] ? [D] extends [0] ? TSlug extends keyof GlobalDocumentBySlug ? GlobalDocumentBySlug[TSlug] | null : VexDocumentGlobal<TSlug> | null : (VexDocumentGlobal<TSlug> & Record<string, unknown>) | null : TSlug extends keyof GlobalDocumentBySlug ? Prettify<GlobalPopulated<TSlug, TPopulate>> | null : never;
25
+ /**
26
+ * Fetches a single global by slug and returns it as a flat document.
27
+ * User fields (`siteName`, `activeTheme`, …) are at root level alongside
28
+ * `_id`, `_creationTime`, and `_slug`. Server-side only.
29
+ *
30
+ * Import from `@vexcms/core/server`.
31
+ *
32
+ * @typeParam DataModel - Convex data model.
33
+ * @typeParam TSlug - Global slug.
34
+ * @typeParam TPopulate - Populate shape.
35
+ * @typeParam D - Depth literal.
36
+ * @param args - `{ ctx, slug, populate? }` or `{ ctx, slug, depth, config }`.
37
+ * @returns Flat global document or `null` if not yet saved.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { getGlobal } from "@vexcms/core/server";
42
+ *
43
+ * const settings = await getGlobal({ ctx, slug: "siteSettings" });
44
+ * settings?.siteName; // string | undefined
45
+ *
46
+ * const populated = await getGlobal({
47
+ * ctx,
48
+ * slug: "siteSettings",
49
+ * populate: { activeTheme: true },
50
+ * });
51
+ * populated?.activeTheme; // Doc<"themes">[] | undefined (runtime correct, type widened)
52
+ * ```
53
+ */
54
+ export declare function getGlobal<DataModel extends GenericDataModel, TGlobalSlug extends GlobalSlug = GlobalSlug, TPopulate extends GlobalPopulateShape<TGlobalSlug> = Record<string, never>, D extends number = 0>(args: GetGlobalServerArgs<DataModel, TGlobalSlug, TPopulate, D>): Promise<GetGlobalReturn<TGlobalSlug, TPopulate, D>>;
55
+ //# sourceMappingURL=get.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.server.d.ts","sourceRoot":"","sources":["../../../src/api/globals/get.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAmBxD;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB,CAClC,SAAS,SAAS,gBAAgB,EAClC,WAAW,SAAS,UAAU,GAAG,UAAU,EAC3C,SAAS,SAAS,mBAAmB,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1E,CAAC,SAAS,MAAM,GAAG,CAAC,CACpB,SAAQ,6BAA6B,CAAC,SAAS,EAAE,WAAW,CAAC;IAC7D,2EAA2E;IAC3E,IAAI,EAAE,WAAW,CAAC;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC;IAC/C,6FAA6F;IAC7F,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,UAAU,EACxB,SAAS,SAAS,mBAAmB,CAAC,KAAK,CAAC,EAC5C,CAAC,SAAS,MAAM,IACd,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,GAC3C,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GACb,KAAK,SAAS,MAAM,oBAAoB,GACtC,oBAAoB,CAAC,KAAK,CAAC,GAAG,IAAI,GAClC,iBAAiB,CAAC,KAAK,CAAC,GAAG,IAAI,GACjC,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAC7D,KAAK,SAAS,MAAM,oBAAoB,GACtC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,GAClD,KAAK,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,SAAS,CAC7B,SAAS,SAAS,gBAAgB,EAClC,WAAW,SAAS,UAAU,GAAG,UAAU,EAC3C,SAAS,SAAS,mBAAmB,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1E,CAAC,SAAS,MAAM,GAAG,CAAC,EAEpB,IAAI,EAAE,mBAAmB,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,GAC9D,OAAO,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAiDrD"}