@gaganref/confect-server 0.0.0-stage → 10.3.1-fork.10

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 (367) hide show
  1. package/CHANGELOG.md +2119 -0
  2. package/LICENSE +7 -0
  3. package/README.md +16 -2
  4. package/dist/ActionCtx.d.ts +10 -0
  5. package/dist/ActionCtx.d.ts.map +1 -0
  6. package/dist/ActionCtx.js +18 -0
  7. package/dist/ActionCtx.js.map +1 -0
  8. package/dist/ActionRunner.d.ts +16 -0
  9. package/dist/ActionRunner.d.ts.map +1 -0
  10. package/dist/ActionRunner.js +18 -0
  11. package/dist/ActionRunner.js.map +1 -0
  12. package/dist/AiGatewayDecisionClient.d.ts +20 -0
  13. package/dist/AiGatewayDecisionClient.d.ts.map +1 -0
  14. package/dist/AiGatewayDecisionClient.js +31 -0
  15. package/dist/AiGatewayDecisionClient.js.map +1 -0
  16. package/dist/AiGatewayDecisionModel.d.ts +24 -0
  17. package/dist/AiGatewayDecisionModel.d.ts.map +1 -0
  18. package/dist/AiGatewayDecisionModel.js +27 -0
  19. package/dist/AiGatewayDecisionModel.js.map +1 -0
  20. package/dist/AiGatewayLanguageClient.d.ts +21 -0
  21. package/dist/AiGatewayLanguageClient.d.ts.map +1 -0
  22. package/dist/AiGatewayLanguageClient.js +32 -0
  23. package/dist/AiGatewayLanguageClient.js.map +1 -0
  24. package/dist/AiGatewayLanguageModel.d.ts +95 -0
  25. package/dist/AiGatewayLanguageModel.d.ts.map +1 -0
  26. package/dist/AiGatewayLanguageModel.js +42 -0
  27. package/dist/AiGatewayLanguageModel.js.map +1 -0
  28. package/dist/Auth.d.ts +20 -0
  29. package/dist/Auth.d.ts.map +1 -0
  30. package/dist/Auth.js +31 -0
  31. package/dist/Auth.js.map +1 -0
  32. package/dist/BlobNotFoundError.d.ts +9 -0
  33. package/dist/BlobNotFoundError.d.ts.map +1 -0
  34. package/dist/BlobNotFoundError.js +13 -0
  35. package/dist/BlobNotFoundError.js.map +1 -0
  36. package/dist/Callback.d.ts +31 -0
  37. package/dist/Callback.d.ts.map +1 -0
  38. package/dist/Callback.js +182 -0
  39. package/dist/Callback.js.map +1 -0
  40. package/dist/ComponentCtx.d.ts +71 -0
  41. package/dist/ComponentCtx.d.ts.map +1 -0
  42. package/dist/ComponentCtx.js +0 -0
  43. package/dist/ConvexConfigProvider.d.ts +21 -0
  44. package/dist/ConvexConfigProvider.d.ts.map +1 -0
  45. package/dist/ConvexConfigProvider.js +36 -0
  46. package/dist/ConvexConfigProvider.js.map +1 -0
  47. package/dist/ConvexFunctionDefinitions.d.ts +25 -0
  48. package/dist/ConvexFunctionDefinitions.d.ts.map +1 -0
  49. package/dist/ConvexFunctionDefinitions.js +25 -0
  50. package/dist/ConvexFunctionDefinitions.js.map +1 -0
  51. package/dist/ConvexLogger.d.ts +17 -0
  52. package/dist/ConvexLogger.d.ts.map +1 -0
  53. package/dist/ConvexLogger.js +33 -0
  54. package/dist/ConvexLogger.js.map +1 -0
  55. package/dist/CronJob.d.ts +14 -0
  56. package/dist/CronJob.d.ts.map +1 -0
  57. package/dist/CronJob.js +22 -0
  58. package/dist/CronJob.js.map +1 -0
  59. package/dist/CronJobs.d.ts +22 -0
  60. package/dist/CronJobs.d.ts.map +1 -0
  61. package/dist/CronJobs.js +83 -0
  62. package/dist/CronJobs.js.map +1 -0
  63. package/dist/DataModel.d.ts +28 -0
  64. package/dist/DataModel.d.ts.map +1 -0
  65. package/dist/DataModel.js +7 -0
  66. package/dist/DataModel.js.map +1 -0
  67. package/dist/DatabaseReader.d.ts +26 -0
  68. package/dist/DatabaseReader.d.ts.map +1 -0
  69. package/dist/DatabaseReader.js +33 -0
  70. package/dist/DatabaseReader.js.map +1 -0
  71. package/dist/DatabaseSchema.d.ts +67 -0
  72. package/dist/DatabaseSchema.d.ts.map +1 -0
  73. package/dist/DatabaseSchema.js +61 -0
  74. package/dist/DatabaseSchema.js.map +1 -0
  75. package/dist/DatabaseWriter.d.ts +44 -0
  76. package/dist/DatabaseWriter.d.ts.map +1 -0
  77. package/dist/DatabaseWriter.js +47 -0
  78. package/dist/DatabaseWriter.js.map +1 -0
  79. package/dist/Document.d.ts +37 -0
  80. package/dist/Document.d.ts.map +1 -0
  81. package/dist/Document.js +54 -0
  82. package/dist/Document.js.map +1 -0
  83. package/dist/ExecutionMetadata.d.ts +13 -0
  84. package/dist/ExecutionMetadata.d.ts.map +1 -0
  85. package/dist/ExecutionMetadata.js +19 -0
  86. package/dist/ExecutionMetadata.js.map +1 -0
  87. package/dist/FunctionImpl.d.ts +39 -0
  88. package/dist/FunctionImpl.d.ts.map +1 -0
  89. package/dist/FunctionImpl.js +46 -0
  90. package/dist/FunctionImpl.js.map +1 -0
  91. package/dist/FunctionRegistryItem.d.ts +36 -0
  92. package/dist/FunctionRegistryItem.d.ts.map +1 -0
  93. package/dist/FunctionRegistryItem.js +34 -0
  94. package/dist/FunctionRegistryItem.js.map +1 -0
  95. package/dist/GroupImpl.d.ts +77 -0
  96. package/dist/GroupImpl.d.ts.map +1 -0
  97. package/dist/GroupImpl.js +81 -0
  98. package/dist/GroupImpl.js.map +1 -0
  99. package/dist/GroupRegistry.d.ts +8 -0
  100. package/dist/GroupRegistry.d.ts.map +1 -0
  101. package/dist/GroupRegistry.js +26 -0
  102. package/dist/GroupRegistry.js.map +1 -0
  103. package/dist/Handler.d.ts +47 -0
  104. package/dist/Handler.d.ts.map +1 -0
  105. package/dist/Handler.js +7 -0
  106. package/dist/Handler.js.map +1 -0
  107. package/dist/HttpRouter.d.ts +80 -0
  108. package/dist/HttpRouter.d.ts.map +1 -0
  109. package/dist/HttpRouter.js +195 -0
  110. package/dist/HttpRouter.js.map +1 -0
  111. package/dist/MiddlewareImpl.d.ts +79 -0
  112. package/dist/MiddlewareImpl.d.ts.map +1 -0
  113. package/dist/MiddlewareImpl.js +58 -0
  114. package/dist/MiddlewareImpl.js.map +1 -0
  115. package/dist/MiddlewareRegistryItem.d.ts +12 -0
  116. package/dist/MiddlewareRegistryItem.d.ts.map +1 -0
  117. package/dist/MiddlewareRegistryItem.js +15 -0
  118. package/dist/MiddlewareRegistryItem.js.map +1 -0
  119. package/dist/MutationCtx.d.ts +10 -0
  120. package/dist/MutationCtx.d.ts.map +1 -0
  121. package/dist/MutationCtx.js +18 -0
  122. package/dist/MutationCtx.js.map +1 -0
  123. package/dist/MutationRunner.d.ts +27 -0
  124. package/dist/MutationRunner.d.ts.map +1 -0
  125. package/dist/MutationRunner.js +28 -0
  126. package/dist/MutationRunner.js.map +1 -0
  127. package/dist/MutationTransactionContext.d.ts +17 -0
  128. package/dist/MutationTransactionContext.d.ts.map +1 -0
  129. package/dist/MutationTransactionContext.js +20 -0
  130. package/dist/MutationTransactionContext.js.map +1 -0
  131. package/dist/OrderedQuery.d.ts +32 -0
  132. package/dist/OrderedQuery.d.ts.map +1 -0
  133. package/dist/OrderedQuery.js +36 -0
  134. package/dist/OrderedQuery.js.map +1 -0
  135. package/dist/QueryCtx.d.ts +10 -0
  136. package/dist/QueryCtx.d.ts.map +1 -0
  137. package/dist/QueryCtx.js +18 -0
  138. package/dist/QueryCtx.js.map +1 -0
  139. package/dist/QueryInitializer.d.ts +75 -0
  140. package/dist/QueryInitializer.d.ts.map +1 -0
  141. package/dist/QueryInitializer.js +105 -0
  142. package/dist/QueryInitializer.js.map +1 -0
  143. package/dist/QueryRunner.d.ts +46 -0
  144. package/dist/QueryRunner.d.ts.map +1 -0
  145. package/dist/QueryRunner.js +30 -0
  146. package/dist/QueryRunner.js.map +1 -0
  147. package/dist/QueryStream.d.ts +678 -0
  148. package/dist/QueryStream.d.ts.map +1 -0
  149. package/dist/QueryStream.js +943 -0
  150. package/dist/QueryStream.js.map +1 -0
  151. package/dist/QueryStreamCursor.d.ts +39 -0
  152. package/dist/QueryStreamCursor.d.ts.map +1 -0
  153. package/dist/QueryStreamCursor.js +52 -0
  154. package/dist/QueryStreamCursor.js.map +1 -0
  155. package/dist/QueryStreamIndexPrefix.d.ts +48 -0
  156. package/dist/QueryStreamIndexPrefix.d.ts.map +1 -0
  157. package/dist/QueryStreamIndexPrefix.js +38 -0
  158. package/dist/QueryStreamIndexPrefix.js.map +1 -0
  159. package/dist/QueryStreamIndexRange.d.ts +193 -0
  160. package/dist/QueryStreamIndexRange.d.ts.map +1 -0
  161. package/dist/QueryStreamIndexRange.js +241 -0
  162. package/dist/QueryStreamIndexRange.js.map +1 -0
  163. package/dist/QueryStreamKey.d.ts +64 -0
  164. package/dist/QueryStreamKey.d.ts.map +1 -0
  165. package/dist/QueryStreamKey.js +69 -0
  166. package/dist/QueryStreamKey.js.map +1 -0
  167. package/dist/QueryStreamKeyBounds.d.ts +136 -0
  168. package/dist/QueryStreamKeyBounds.d.ts.map +1 -0
  169. package/dist/QueryStreamKeyBounds.js +208 -0
  170. package/dist/QueryStreamKeyBounds.js.map +1 -0
  171. package/dist/QueryStreamKeyLabels.d.ts +27 -0
  172. package/dist/QueryStreamKeyLabels.d.ts.map +1 -0
  173. package/dist/QueryStreamKeyLabels.js +22 -0
  174. package/dist/QueryStreamKeyLabels.js.map +1 -0
  175. package/dist/QueryStreamKeyLayout.d.ts +179 -0
  176. package/dist/QueryStreamKeyLayout.d.ts.map +1 -0
  177. package/dist/QueryStreamKeyLayout.js +167 -0
  178. package/dist/QueryStreamKeyLayout.js.map +1 -0
  179. package/dist/QueryStreamKeyValues.d.ts +40 -0
  180. package/dist/QueryStreamKeyValues.d.ts.map +1 -0
  181. package/dist/QueryStreamKeyValues.js +57 -0
  182. package/dist/QueryStreamKeyValues.js.map +1 -0
  183. package/dist/QueryStreamOrderDirection.d.ts +24 -0
  184. package/dist/QueryStreamOrderDirection.d.ts.map +1 -0
  185. package/dist/QueryStreamOrderDirection.js +11 -0
  186. package/dist/QueryStreamOrderDirection.js.map +1 -0
  187. package/dist/QueryStreamPagination.d.ts +264 -0
  188. package/dist/QueryStreamPagination.d.ts.map +1 -0
  189. package/dist/QueryStreamPagination.js +172 -0
  190. package/dist/QueryStreamPagination.js.map +1 -0
  191. package/dist/QueryStreamReadBudget.d.ts +63 -0
  192. package/dist/QueryStreamReadBudget.d.ts.map +1 -0
  193. package/dist/QueryStreamReadBudget.js +81 -0
  194. package/dist/QueryStreamReadBudget.js.map +1 -0
  195. package/dist/QueryTransactionContext.d.ts +16 -0
  196. package/dist/QueryTransactionContext.d.ts.map +1 -0
  197. package/dist/QueryTransactionContext.js +17 -0
  198. package/dist/QueryTransactionContext.js.map +1 -0
  199. package/dist/RegisteredConvexFunction.d.ts +359 -0
  200. package/dist/RegisteredConvexFunction.d.ts.map +1 -0
  201. package/dist/RegisteredConvexFunction.js +154 -0
  202. package/dist/RegisteredConvexFunction.js.map +1 -0
  203. package/dist/RegisteredFunction.d.ts +143 -0
  204. package/dist/RegisteredFunction.d.ts.map +1 -0
  205. package/dist/RegisteredFunction.js +125 -0
  206. package/dist/RegisteredFunction.js.map +1 -0
  207. package/dist/RegisteredFunctions.d.ts +57 -0
  208. package/dist/RegisteredFunctions.d.ts.map +1 -0
  209. package/dist/RegisteredFunctions.js +32 -0
  210. package/dist/RegisteredFunctions.js.map +1 -0
  211. package/dist/RegisteredNodeFunction.d.ts +11 -0
  212. package/dist/RegisteredNodeFunction.d.ts.map +1 -0
  213. package/dist/RegisteredNodeFunction.js +45 -0
  214. package/dist/RegisteredNodeFunction.js.map +1 -0
  215. package/dist/Registry.d.ts +12 -0
  216. package/dist/Registry.d.ts.map +1 -0
  217. package/dist/Registry.js +17 -0
  218. package/dist/Registry.js.map +1 -0
  219. package/dist/RegistryItems.d.ts +21 -0
  220. package/dist/RegistryItems.d.ts.map +1 -0
  221. package/dist/RegistryItems.js +27 -0
  222. package/dist/RegistryItems.js.map +1 -0
  223. package/dist/RequestMetadata.d.ts +12 -0
  224. package/dist/RequestMetadata.d.ts.map +1 -0
  225. package/dist/RequestMetadata.js +16 -0
  226. package/dist/RequestMetadata.js.map +1 -0
  227. package/dist/ResolvedMiddleware.d.ts +24 -0
  228. package/dist/ResolvedMiddleware.d.ts.map +1 -0
  229. package/dist/ResolvedMiddleware.js +34 -0
  230. package/dist/ResolvedMiddleware.js.map +1 -0
  231. package/dist/Scheduler.d.ts +31 -0
  232. package/dist/Scheduler.d.ts.map +1 -0
  233. package/dist/Scheduler.js +35 -0
  234. package/dist/Scheduler.js.map +1 -0
  235. package/dist/Storage.d.ts +22 -0
  236. package/dist/Storage.d.ts.map +1 -0
  237. package/dist/Storage.js +27 -0
  238. package/dist/Storage.js.map +1 -0
  239. package/dist/StorageActionWriter.d.ts +35 -0
  240. package/dist/StorageActionWriter.d.ts.map +1 -0
  241. package/dist/StorageActionWriter.js +24 -0
  242. package/dist/StorageActionWriter.js.map +1 -0
  243. package/dist/StorageReader.d.ts +26 -0
  244. package/dist/StorageReader.d.ts.map +1 -0
  245. package/dist/StorageReader.js +22 -0
  246. package/dist/StorageReader.js.map +1 -0
  247. package/dist/StorageWriter.d.ts +29 -0
  248. package/dist/StorageWriter.d.ts.map +1 -0
  249. package/dist/StorageWriter.js +24 -0
  250. package/dist/StorageWriter.js.map +1 -0
  251. package/dist/Table.d.ts +274 -0
  252. package/dist/Table.d.ts.map +1 -0
  253. package/dist/Table.js +70 -0
  254. package/dist/Table.js.map +1 -0
  255. package/dist/TableInfo.d.ts +44 -0
  256. package/dist/TableInfo.d.ts.map +1 -0
  257. package/dist/TableInfo.js +7 -0
  258. package/dist/TableInfo.js.map +1 -0
  259. package/dist/TransactionMetadata.d.ts +12 -0
  260. package/dist/TransactionMetadata.d.ts.map +1 -0
  261. package/dist/TransactionMetadata.js +16 -0
  262. package/dist/TransactionMetadata.js.map +1 -0
  263. package/dist/VectorSearch.d.ts +23 -0
  264. package/dist/VectorSearch.d.ts.map +1 -0
  265. package/dist/VectorSearch.js +17 -0
  266. package/dist/VectorSearch.js.map +1 -0
  267. package/dist/_virtual/_rolldown/runtime.js +13 -0
  268. package/dist/index.d.ts +88 -0
  269. package/dist/index.d.ts.map +1 -0
  270. package/dist/index.js +61 -0
  271. package/dist/internal/AiGatewayDecisionClient.d.ts +7 -0
  272. package/dist/internal/AiGatewayDecisionClient.d.ts.map +1 -0
  273. package/dist/internal/AiGatewayDecisionClient.js +19 -0
  274. package/dist/internal/AiGatewayDecisionClient.js.map +1 -0
  275. package/dist/internal/AiGatewayLanguageClient.d.ts +7 -0
  276. package/dist/internal/AiGatewayLanguageClient.d.ts.map +1 -0
  277. package/dist/internal/AiGatewayLanguageClient.js +19 -0
  278. package/dist/internal/AiGatewayLanguageClient.js.map +1 -0
  279. package/dist/internal/AiGatewayServiceToken.d.ts +46 -0
  280. package/dist/internal/AiGatewayServiceToken.d.ts.map +1 -0
  281. package/dist/internal/AiGatewayServiceToken.js +62 -0
  282. package/dist/internal/AiGatewayServiceToken.js.map +1 -0
  283. package/dist/internal/constants.d.ts +2 -0
  284. package/dist/internal/constants.d.ts.map +1 -0
  285. package/dist/internal/constants.js +6 -0
  286. package/dist/internal/constants.js.map +1 -0
  287. package/dist/internal/utils.d.ts +13 -0
  288. package/dist/internal/utils.d.ts.map +1 -0
  289. package/dist/internal/utils.js +50 -0
  290. package/dist/internal/utils.js.map +1 -0
  291. package/dist/node.d.ts +2 -0
  292. package/dist/node.d.ts.map +1 -0
  293. package/dist/node.js +1 -0
  294. package/package.json +68 -3
  295. package/src/ActionCtx.ts +45 -0
  296. package/src/ActionRunner.ts +36 -0
  297. package/src/AiGatewayDecisionClient.ts +40 -0
  298. package/src/AiGatewayDecisionModel.ts +46 -0
  299. package/src/AiGatewayLanguageClient.ts +41 -0
  300. package/src/AiGatewayLanguageModel.ts +61 -0
  301. package/src/Auth.ts +51 -0
  302. package/src/BlobNotFoundError.ts +12 -0
  303. package/src/Callback.ts +313 -0
  304. package/src/ComponentCtx.ts +192 -0
  305. package/src/ConvexConfigProvider.ts +39 -0
  306. package/src/ConvexFunctionDefinitions.ts +91 -0
  307. package/src/ConvexLogger.ts +43 -0
  308. package/src/CronJob.ts +42 -0
  309. package/src/CronJobs.ts +165 -0
  310. package/src/DataModel.ts +81 -0
  311. package/src/DatabaseReader.ts +118 -0
  312. package/src/DatabaseSchema.ts +139 -0
  313. package/src/DatabaseWriter.ts +232 -0
  314. package/src/Document.ts +146 -0
  315. package/src/ExecutionMetadata.ts +26 -0
  316. package/src/FunctionImpl.ts +96 -0
  317. package/src/FunctionRegistryItem.ts +85 -0
  318. package/src/GroupImpl.ts +167 -0
  319. package/src/GroupRegistry.ts +41 -0
  320. package/src/Handler.ts +191 -0
  321. package/src/HttpRouter.ts +388 -0
  322. package/src/MiddlewareImpl.ts +247 -0
  323. package/src/MiddlewareRegistryItem.ts +21 -0
  324. package/src/MutationCtx.ts +45 -0
  325. package/src/MutationRunner.ts +66 -0
  326. package/src/MutationTransactionContext.ts +48 -0
  327. package/src/OrderedQuery.ts +136 -0
  328. package/src/QueryCtx.ts +45 -0
  329. package/src/QueryInitializer.ts +537 -0
  330. package/src/QueryRunner.ts +91 -0
  331. package/src/QueryStream.ts +2476 -0
  332. package/src/QueryStreamCursor.ts +99 -0
  333. package/src/QueryStreamIndexPrefix.ts +79 -0
  334. package/src/QueryStreamIndexRange.ts +489 -0
  335. package/src/QueryStreamKey.ts +118 -0
  336. package/src/QueryStreamKeyBounds.ts +395 -0
  337. package/src/QueryStreamKeyLabels.ts +56 -0
  338. package/src/QueryStreamKeyLayout.ts +382 -0
  339. package/src/QueryStreamKeyValues.ts +112 -0
  340. package/src/QueryStreamOrderDirection.ts +29 -0
  341. package/src/QueryStreamPagination.ts +357 -0
  342. package/src/QueryStreamReadBudget.ts +167 -0
  343. package/src/QueryTransactionContext.ts +37 -0
  344. package/src/RegisteredConvexFunction.ts +415 -0
  345. package/src/RegisteredFunction.ts +391 -0
  346. package/src/RegisteredFunctions.ts +88 -0
  347. package/src/RegisteredNodeFunction.ts +120 -0
  348. package/src/Registry.ts +17 -0
  349. package/src/RegistryItems.ts +40 -0
  350. package/src/RequestMetadata.ts +20 -0
  351. package/src/ResolvedMiddleware.ts +70 -0
  352. package/src/Scheduler.ts +85 -0
  353. package/src/Storage.ts +37 -0
  354. package/src/StorageActionWriter.ts +59 -0
  355. package/src/StorageReader.ts +59 -0
  356. package/src/StorageWriter.ts +58 -0
  357. package/src/Table.ts +156 -0
  358. package/src/TableInfo.ts +106 -0
  359. package/src/TransactionMetadata.ts +20 -0
  360. package/src/VectorSearch.ts +75 -0
  361. package/src/index.ts +87 -0
  362. package/src/internal/AiGatewayDecisionClient.ts +16 -0
  363. package/src/internal/AiGatewayLanguageClient.ts +16 -0
  364. package/src/internal/AiGatewayServiceToken.ts +129 -0
  365. package/src/internal/constants.ts +1 -0
  366. package/src/internal/utils.ts +89 -0
  367. package/src/node.ts +1 -0
@@ -0,0 +1,192 @@
1
+ import type * as IdScope from "@confect/core/IdScope";
2
+ import type { GenericId, Rebase } from "@confect/core/GenericId";
3
+ import type {
4
+ DocumentByName,
5
+ GenericActionCtx,
6
+ GenericDataModel,
7
+ GenericMutationCtx,
8
+ GenericQueryCtx,
9
+ QueryInitializer,
10
+ NamedTableInfo,
11
+ TableNamesInDataModel,
12
+ SystemDataModel,
13
+ WithoutSystemFields,
14
+ WithOptionalSystemFields,
15
+ SchedulableFunctionReference,
16
+ OptionalRestArgs,
17
+ VectorIndexNames,
18
+ VectorSearchQuery,
19
+ } from "convex/server";
20
+ import type { PatchValue } from "./DatabaseWriter.js";
21
+
22
+ /**
23
+ * Distinguishes raw component services from structurally compatible app ctxs.
24
+ */
25
+ export interface Identifier<
26
+ Kind extends string,
27
+ DataModel,
28
+ Scope extends IdScope.IdScope,
29
+ > {
30
+ readonly "~@confect/server/ComponentCtx": {
31
+ readonly kind: Kind;
32
+ readonly dataModel: DataModel;
33
+ readonly scope: Scope;
34
+ };
35
+ }
36
+
37
+ interface Reader<
38
+ DataModel extends GenericDataModel,
39
+ Scope extends IdScope.IdScope,
40
+ > {
41
+ get<TableName extends TableNamesInDataModel<DataModel>>(
42
+ table: TableName,
43
+ id: GenericId<NoInfer<TableName>, Scope>,
44
+ ): Promise<DocumentByName<DataModel, TableName> | null>;
45
+ get<TableName extends TableNamesInDataModel<DataModel>>(
46
+ id: GenericId<TableName, Scope>,
47
+ ): Promise<DocumentByName<DataModel, TableName> | null>;
48
+ normalizeId<TableName extends TableNamesInDataModel<DataModel>>(
49
+ table: TableName,
50
+ id: string,
51
+ ): GenericId<TableName, Scope> | null;
52
+ query<TableName extends TableNamesInDataModel<DataModel>>(
53
+ table: TableName,
54
+ ): QueryInitializer<NamedTableInfo<DataModel, TableName>>;
55
+ }
56
+
57
+ type ScopedSystem<Scope extends IdScope.IdScope> = Rebase<
58
+ SystemDataModel,
59
+ IdScope.App,
60
+ Scope
61
+ >;
62
+
63
+ export interface DatabaseReader<
64
+ DataModel extends GenericDataModel,
65
+ Scope extends IdScope.IdScope,
66
+ > extends Reader<DataModel, Scope> {
67
+ readonly system: Reader<ScopedSystem<Scope>, Scope>;
68
+ }
69
+
70
+ export interface DatabaseWriter<
71
+ DataModel extends GenericDataModel,
72
+ Scope extends IdScope.IdScope,
73
+ > extends DatabaseReader<DataModel, Scope> {
74
+ insert<TableName extends TableNamesInDataModel<DataModel>>(
75
+ table: TableName,
76
+ value: WithoutSystemFields<DocumentByName<DataModel, TableName>>,
77
+ ): Promise<GenericId<TableName, Scope>>;
78
+ patch<TableName extends TableNamesInDataModel<DataModel>>(
79
+ table: TableName,
80
+ id: GenericId<NoInfer<TableName>, Scope>,
81
+ value: PatchValue<
82
+ WithoutSystemFields<DocumentByName<DataModel, TableName>>
83
+ >,
84
+ ): Promise<void>;
85
+ patch<TableName extends TableNamesInDataModel<DataModel>>(
86
+ id: GenericId<TableName, Scope>,
87
+ value: PatchValue<
88
+ WithoutSystemFields<DocumentByName<DataModel, TableName>>
89
+ >,
90
+ ): Promise<void>;
91
+ replace<TableName extends TableNamesInDataModel<DataModel>>(
92
+ table: TableName,
93
+ id: GenericId<NoInfer<TableName>, Scope>,
94
+ value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,
95
+ ): Promise<void>;
96
+ replace<TableName extends TableNamesInDataModel<DataModel>>(
97
+ id: GenericId<TableName, Scope>,
98
+ value: WithOptionalSystemFields<DocumentByName<DataModel, TableName>>,
99
+ ): Promise<void>;
100
+ delete<TableName extends TableNamesInDataModel<DataModel>>(
101
+ table: TableName,
102
+ id: GenericId<NoInfer<TableName>, Scope>,
103
+ ): Promise<void>;
104
+ delete<TableName extends TableNamesInDataModel<DataModel>>(
105
+ id: GenericId<TableName, Scope>,
106
+ ): Promise<void>;
107
+ }
108
+
109
+ export interface StorageReader<Scope extends IdScope.IdScope> {
110
+ getUrl(id: GenericId<"_storage", Scope>): Promise<string | null>;
111
+ getMetadata(
112
+ id: GenericId<"_storage", Scope>,
113
+ ): Promise<
114
+ Rebase<
115
+ Awaited<
116
+ ReturnType<GenericQueryCtx<GenericDataModel>["storage"]["getMetadata"]>
117
+ >,
118
+ IdScope.App,
119
+ Scope
120
+ >
121
+ >;
122
+ }
123
+
124
+ export interface StorageWriter<
125
+ Scope extends IdScope.IdScope,
126
+ > extends StorageReader<Scope> {
127
+ generateUploadUrl(): Promise<string>;
128
+ delete(id: GenericId<"_storage", Scope>): Promise<void>;
129
+ }
130
+
131
+ export interface StorageActionWriter<
132
+ Scope extends IdScope.IdScope,
133
+ > extends StorageWriter<Scope> {
134
+ get(id: GenericId<"_storage", Scope>): Promise<Blob | null>;
135
+ store(
136
+ blob: Blob,
137
+ options?: { sha256?: string },
138
+ ): Promise<GenericId<"_storage", Scope>>;
139
+ }
140
+
141
+ export interface Scheduler<Scope extends IdScope.IdScope> {
142
+ runAfter<FunctionReference extends SchedulableFunctionReference>(
143
+ delayMs: number,
144
+ ref: FunctionReference,
145
+ ...args: OptionalRestArgs<FunctionReference>
146
+ ): Promise<GenericId<"_scheduled_functions", Scope>>;
147
+ runAt<FunctionReference extends SchedulableFunctionReference>(
148
+ timestamp: number | Date,
149
+ ref: FunctionReference,
150
+ ...args: OptionalRestArgs<FunctionReference>
151
+ ): Promise<GenericId<"_scheduled_functions", Scope>>;
152
+ cancel(id: GenericId<"_scheduled_functions", Scope>): Promise<void>;
153
+ }
154
+
155
+ export type Query<
156
+ DataModel extends GenericDataModel,
157
+ Scope extends IdScope.IdScope,
158
+ > = Omit<GenericQueryCtx<DataModel>, "auth" | "db" | "storage"> & {
159
+ readonly db: DatabaseReader<DataModel, Scope>;
160
+ readonly storage: StorageReader<Scope>;
161
+ };
162
+
163
+ export type Mutation<
164
+ DataModel extends GenericDataModel,
165
+ Scope extends IdScope.IdScope,
166
+ > = Omit<
167
+ GenericMutationCtx<DataModel>,
168
+ "auth" | "db" | "storage" | "scheduler"
169
+ > & {
170
+ readonly db: DatabaseWriter<DataModel, Scope>;
171
+ readonly storage: StorageWriter<Scope>;
172
+ readonly scheduler: Scheduler<Scope>;
173
+ };
174
+
175
+ export type Action<
176
+ DataModel extends GenericDataModel,
177
+ Scope extends IdScope.IdScope,
178
+ > = Omit<
179
+ GenericActionCtx<DataModel>,
180
+ "auth" | "storage" | "vectorSearch" | "scheduler"
181
+ > & {
182
+ readonly storage: StorageActionWriter<Scope>;
183
+ readonly scheduler: Scheduler<Scope>;
184
+ readonly vectorSearch: <
185
+ TableName extends TableNamesInDataModel<DataModel>,
186
+ IndexName extends VectorIndexNames<NamedTableInfo<DataModel, TableName>>,
187
+ >(
188
+ table: TableName,
189
+ index: IndexName,
190
+ query: VectorSearchQuery<NamedTableInfo<DataModel, TableName>, IndexName>,
191
+ ) => Promise<Array<{ _id: GenericId<TableName, Scope>; _score: number }>>;
192
+ };
@@ -0,0 +1,39 @@
1
+ import { pipe } from "effect/Function";
2
+ import * as Array from "effect/Array";
3
+ import * as ConfigProvider from "effect/ConfigProvider";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
+
7
+ declare const process: { env: Record<string, string | undefined> };
8
+
9
+ /**
10
+ * A `ConfigProvider` that reads configuration directly from `process.env` by
11
+ * exact path lookup.
12
+ *
13
+ * The Convex runtime exposes `process.env` for direct key access but does not
14
+ * make it enumerable, so the built-in `ConfigProvider.fromEnv` (which builds a
15
+ * trie over the environment to resolve and enumerate config paths) cannot be
16
+ * used. This provider resolves each requested path to a single environment
17
+ * variable, joining the path segments with `"_"` to match the key convention
18
+ * `fromEnv` uses. As with the built-in providers, an empty string is treated as
19
+ * a missing value, so `Config.withDefault` and `Config.option` recover from
20
+ * it.
21
+ */
22
+ export const make = (): ConfigProvider.ConfigProvider =>
23
+ ConfigProvider.make((path) => {
24
+ const value = process.env[pipe(path, Array.map(String), Array.join("_"))];
25
+
26
+ return Effect.succeed(
27
+ value === undefined || value === ""
28
+ ? undefined
29
+ : ConfigProvider.makeValue(value),
30
+ );
31
+ });
32
+
33
+ /**
34
+ * Installs the Convex-aware `ConfigProvider` as the ambient provider.
35
+ */
36
+ export const layer: Layer.Layer<never> = Layer.succeed(
37
+ ConfigProvider.ConfigProvider,
38
+ make(),
39
+ );
@@ -0,0 +1,91 @@
1
+ import type * as Layer from "effect/Layer";
2
+ import * as Match from "effect/Match";
3
+ import * as Record from "effect/Record";
4
+ import type * as GroupSpec from "@confect/core/GroupSpec";
5
+ import type * as FunctionSpec from "@confect/core/FunctionSpec";
6
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
7
+ import type * as GroupImpl from "./GroupImpl.js";
8
+ import * as GroupRegistry from "./GroupRegistry.js";
9
+ import * as FunctionRegistryItem from "./FunctionRegistryItem.js";
10
+ import * as RegisteredConvexFunction from "./RegisteredConvexFunction.js";
11
+ import type * as RegisteredFunctions from "./RegisteredFunctions.js";
12
+ import * as ResolvedMiddleware from "./ResolvedMiddleware.js";
13
+ import { mapLeaves } from "./internal/utils.js";
14
+
15
+ export interface Definitions {
16
+ readonly [name: string]: RegisteredConvexFunction.Definition | Definitions;
17
+ }
18
+
19
+ type DefinitionTag<
20
+ Function extends FunctionSpec.AnyWithProps,
21
+ Provenance = Function["functionProvenance"],
22
+ > = Provenance extends { readonly _tag: "Convex" }
23
+ ? "Registered"
24
+ : `${Capitalize<Function["functionVisibility"]>}${Capitalize<Function["runtimeAndFunctionType"]["functionType"]>}`;
25
+
26
+ export type ForGroup<Group extends GroupSpec.AnyWithProps> = {
27
+ readonly [Name in FunctionSpec.Name<GroupSpec.Functions<Group>>]: Extract<
28
+ RegisteredConvexFunction.Definition,
29
+ {
30
+ readonly _tag: DefinitionTag<
31
+ FunctionSpec.WithName<GroupSpec.Functions<Group>, Name>
32
+ >;
33
+ }
34
+ >;
35
+ } & {
36
+ readonly [Name in GroupSpec.Name<GroupSpec.Groups<Group>>]: ForGroup<
37
+ GroupSpec.WithName<GroupSpec.Groups<Group>, Name>
38
+ >;
39
+ };
40
+
41
+ export const isDefinition = (
42
+ value: RegisteredConvexFunction.Definition | Definitions,
43
+ ): value is RegisteredConvexFunction.Definition =>
44
+ typeof value._tag === "string";
45
+
46
+ const registerDefinitions = (
47
+ definitions: Definitions,
48
+ ): RegisteredFunctions.AnyWithProps =>
49
+ Record.map(definitions, (value) =>
50
+ isDefinition(value)
51
+ ? RegisteredConvexFunction.register(value)
52
+ : registerDefinitions(value),
53
+ );
54
+
55
+ export const register = <Group extends GroupSpec.AnyWithProps>(
56
+ definitions: Definitions,
57
+ ): RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group> =>
58
+ registerDefinitions(
59
+ definitions,
60
+ ) as RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group>;
61
+
62
+ export const buildForGroup = <Group extends GroupSpec.AnyWithProps>(
63
+ databaseSchema: DatabaseSchema.AnyWithProps,
64
+ groupLayer: Layer.Layer<GroupImpl.GroupImpl<"Finalized">>,
65
+ ): ForGroup<Group> => {
66
+ const { functionRegistryItems, middlewareRegistryItems } =
67
+ GroupRegistry.make(groupLayer);
68
+ return mapLeaves<
69
+ FunctionRegistryItem.AnyWithProps,
70
+ RegisteredConvexFunction.Definition
71
+ >(
72
+ functionRegistryItems as {
73
+ [key: string]: FunctionRegistryItem.AnyWithProps;
74
+ },
75
+ FunctionRegistryItem.isFunctionRegistryItem,
76
+ (item) =>
77
+ Match.value(item).pipe(
78
+ Match.tag("Convex", ({ handler }) =>
79
+ RegisteredConvexFunction.Definition.Registered({ handler }),
80
+ ),
81
+ Match.tag("Confect", (confect) =>
82
+ RegisteredConvexFunction.prepare(
83
+ databaseSchema,
84
+ confect,
85
+ ResolvedMiddleware.resolve(confect, middlewareRegistryItems),
86
+ ),
87
+ ),
88
+ Match.exhaustive,
89
+ ),
90
+ ) as ForGroup<Group>;
91
+ };
@@ -0,0 +1,43 @@
1
+ import * as Console from "effect/Console";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
+ import * as Logger from "effect/Logger";
5
+ import * as Match from "effect/Match";
6
+
7
+ /**
8
+ * Writes structured Effect logs through Convex's severity-aware console
9
+ * methods. Trace and Debug use `console.debug`, Info uses `console.info`, Warn
10
+ * uses `console.warn`, and Error and Fatal use `console.error`. The payload
11
+ * retains the original Effect level, cause, annotations, spans, timestamp, and
12
+ * fiber ID.
13
+ */
14
+ export const logger: Logger.Logger<unknown, void> = Logger.make((options) => {
15
+ const console = options.fiber.getRef(Console.Console);
16
+ const output = Logger.formatStructured.log(options);
17
+ return Match.value(options.logLevel).pipe(
18
+ Match.whenOr("Trace", "Debug", () => console.debug(output)),
19
+ Match.when("Info", () => console.info(output)),
20
+ Match.when("Warn", () => console.warn(output)),
21
+ Match.whenOr("Error", "Fatal", () => console.error(output)),
22
+ Match.whenOr("All", "None", () => console.log(output)),
23
+ Match.exhaustive,
24
+ );
25
+ });
26
+
27
+ /**
28
+ * Replaces Effect's default console logger without changing custom loggers,
29
+ * tracing, or the minimum log level. Confect installs this layer automatically
30
+ * for function handlers and HTTP routes.
31
+ */
32
+ export const layer: Layer.Layer<never> = Layer.effect(
33
+ Logger.CurrentLoggers,
34
+ Effect.map(
35
+ Logger.CurrentLoggers,
36
+ (loggers) =>
37
+ new Set(
38
+ Array.from(loggers, (current) =>
39
+ current === Logger.defaultLogger ? logger : current,
40
+ ),
41
+ ),
42
+ ),
43
+ );
package/src/CronJob.ts ADDED
@@ -0,0 +1,42 @@
1
+ import type { Ref } from "@confect/core";
2
+ import type { Cron, Duration } from "effect";
3
+ import * as Predicate from "effect/Predicate";
4
+
5
+ export const TypeId = "~@confect/server/CronJob";
6
+ export type TypeId = typeof TypeId;
7
+
8
+ export interface CronJob {
9
+ readonly [TypeId]: TypeId;
10
+
11
+ readonly identifier: string;
12
+ readonly schedule: Cron.Cron | Duration.Duration;
13
+ readonly ref: Ref.AnyMutation | Ref.AnyAction;
14
+ readonly args: Record<string, unknown>;
15
+ }
16
+
17
+ export const isCronJob = (u: unknown): u is CronJob =>
18
+ Predicate.hasProperty(u, TypeId);
19
+
20
+ const Proto = {
21
+ [TypeId]: TypeId,
22
+ };
23
+
24
+ const makeProto = (
25
+ identifier: string,
26
+ schedule: Cron.Cron | Duration.Duration,
27
+ ref: Ref.AnyMutation | Ref.AnyAction,
28
+ args: Record<string, unknown>,
29
+ ): CronJob =>
30
+ Object.assign(Object.create(Proto), {
31
+ identifier,
32
+ schedule,
33
+ ref,
34
+ args,
35
+ });
36
+
37
+ export const make = <R extends Ref.AnyMutation | Ref.AnyAction>(
38
+ identifier: string,
39
+ schedule: Cron.Cron | Duration.Duration,
40
+ ref: R,
41
+ ...args: Ref.OptionalArgs<R>
42
+ ): CronJob => makeProto(identifier, schedule, ref, args[0] ?? {});
@@ -0,0 +1,165 @@
1
+ import { Ref } from "@confect/core";
2
+ import type { CronJob as ConvexCronJob } from "convex/server";
3
+ import { cronJobs as makeConvexCrons, type Crons } from "convex/server";
4
+ import { pipe } from "effect/Function";
5
+ import * as Array from "effect/Array";
6
+ import * as Cron from "effect/Cron";
7
+ import * as DateTime from "effect/DateTime";
8
+ import * as Duration from "effect/Duration";
9
+ import * as Match from "effect/Match";
10
+ import * as Option from "effect/Option";
11
+ import * as Order from "effect/Order";
12
+ import * as Predicate from "effect/Predicate";
13
+ import * as Record from "effect/Record";
14
+ import type * as CronJob from "./CronJob.js";
15
+
16
+ export const TypeId = "~@confect/server/CronJobs";
17
+ export type TypeId = typeof TypeId;
18
+
19
+ export interface CronJobs {
20
+ readonly [TypeId]: TypeId;
21
+ readonly cronJobs: Record<string, CronJob.CronJob>;
22
+ readonly convexCronJobs: Crons;
23
+
24
+ add(cron: CronJob.CronJob): CronJobs;
25
+ }
26
+
27
+ export const isCronJobs = (u: unknown): u is CronJobs =>
28
+ Predicate.hasProperty(u, TypeId);
29
+
30
+ const Proto = {
31
+ [TypeId]: TypeId,
32
+
33
+ add(this: CronJobs, cronJob: CronJob.CronJob) {
34
+ const newConvexCrons = Object.assign(makeConvexCrons(), {
35
+ crons: { ...this.convexCronJobs.crons },
36
+ });
37
+
38
+ const functionReference = Ref.getFunctionReference(cronJob.ref);
39
+ const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);
40
+
41
+ Match.value(cronJob.schedule).pipe(
42
+ Match.when(Cron.isCron, (cron) => {
43
+ newConvexCrons.cron(
44
+ cronJob.identifier,
45
+ cronToConvexCronString(cron),
46
+ functionReference,
47
+ encodedArgs,
48
+ );
49
+ }),
50
+ Match.when(Duration.isDuration, (duration) => {
51
+ newConvexCrons.interval(
52
+ cronJob.identifier,
53
+ durationToConvexIntervalSchedule(duration),
54
+ functionReference,
55
+ encodedArgs,
56
+ );
57
+ }),
58
+ Match.exhaustive,
59
+ );
60
+
61
+ return makeProto(
62
+ Record.set(this.cronJobs, cronJob.identifier, cronJob),
63
+ newConvexCrons,
64
+ );
65
+ },
66
+ };
67
+
68
+ const makeProto = (
69
+ cronJobs: Record<string, CronJob.CronJob>,
70
+ convexCronJobs: Crons,
71
+ ): CronJobs =>
72
+ Object.assign(Object.create(Proto), {
73
+ cronJobs,
74
+ convexCronJobs,
75
+ });
76
+
77
+ export const make = (): CronJobs => makeProto({}, makeConvexCrons());
78
+
79
+ export const cronToConvexCronString = (cron: Cron.Cron): string => {
80
+ pipe(
81
+ cron.tz,
82
+ Option.filter((tz) =>
83
+ pipe(
84
+ tz,
85
+ Match.value,
86
+ Match.tag("Offset", ({ offset }) => offset !== 0),
87
+ Match.tag("Named", ({ id }) => id !== "UTC" && id !== "Etc/UTC"),
88
+ Match.exhaustive,
89
+ ),
90
+ ),
91
+ Option.map((tz) => {
92
+ throw new Error(
93
+ `Convex cron expressions are always evaluated in UTC, but this cron ` +
94
+ `specifies the time zone "${DateTime.zoneToString(tz)}". ` +
95
+ `Either omit the timezone or specify UTC.`,
96
+ );
97
+ }),
98
+ );
99
+
100
+ const hasNonDefaultSeconds = cron.seconds.size !== 1 || !cron.seconds.has(0);
101
+ if (hasNonDefaultSeconds) {
102
+ throw new Error(
103
+ "Convex cron expressions do not support a seconds field. " +
104
+ "The seconds field must be the default {0}. " +
105
+ "Sub-minute scheduling is supported only by interval schedules defined using a Duration.",
106
+ );
107
+ }
108
+
109
+ return Array.join(
110
+ [
111
+ setToField(cron.minutes),
112
+ setToField(cron.hours),
113
+ setToField(cron.days),
114
+ setToField(cron.months),
115
+ setToField(cron.weekdays),
116
+ ],
117
+ " ",
118
+ );
119
+ };
120
+
121
+ const setToField = (set: ReadonlySet<number>): string => {
122
+ if (set.size === 0) return "*";
123
+ return pipe(
124
+ set,
125
+ Array.sort(Order.Number),
126
+ Array.map((n) => n.toString()),
127
+ Array.join(","),
128
+ );
129
+ };
130
+
131
+ export const durationToConvexIntervalSchedule = (
132
+ duration: Duration.Duration,
133
+ ): IntervalSchedule => {
134
+ const millis = Duration.toMillis(duration);
135
+ if (millis <= 0) {
136
+ throw new Error("Interval must be a positive duration.");
137
+ }
138
+
139
+ const oneHourInMillis = Duration.hours(1).pipe(Duration.toMillis);
140
+ const hours = millis / oneHourInMillis;
141
+ if (Number.isInteger(hours)) {
142
+ return { type: "interval", hours };
143
+ }
144
+
145
+ const oneMinuteInMillis = Duration.minutes(1).pipe(Duration.toMillis);
146
+ const minutes = millis / oneMinuteInMillis;
147
+ if (Number.isInteger(minutes)) {
148
+ return { type: "interval", minutes };
149
+ }
150
+
151
+ const oneSecondInMillis = Duration.seconds(1).pipe(Duration.toMillis);
152
+ const seconds = millis / oneSecondInMillis;
153
+ if (Number.isInteger(seconds)) {
154
+ return { type: "interval", seconds };
155
+ }
156
+
157
+ throw new Error(
158
+ "Interval must be a whole number of seconds, minutes, or hours.",
159
+ );
160
+ };
161
+
162
+ type IntervalSchedule = Extract<
163
+ ConvexCronJob["schedule"],
164
+ { type: "interval" }
165
+ >;
@@ -0,0 +1,81 @@
1
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
2
+ import type * as Table from "./Table.js";
3
+ import type * as TableInfo from "./TableInfo.js";
4
+ import type * as GenericId from "@confect/core/GenericId";
5
+
6
+ export declare const TypeId: "~@confect/server/DataModel";
7
+ export type TypeId = typeof TypeId;
8
+
9
+ export interface DataModel<
10
+ Tables_ extends Readonly<Record<string, Table.AnyWithProps>>,
11
+ > {
12
+ readonly [TypeId]: Readonly<Tables_>;
13
+ }
14
+
15
+ export interface Any {
16
+ readonly [TypeId]: unknown;
17
+ }
18
+
19
+ export interface AnyWithProps extends DataModel<
20
+ Readonly<Record<string, Table.AnyWithProps>>
21
+ > {}
22
+
23
+ export type FromSchema<Schema extends DatabaseSchema.AnyWithProps> = DataModel<
24
+ Schema[DatabaseSchema.TypeId]
25
+ >;
26
+
27
+ export type FromTables<Tables_ extends Table.AnyWithProps> = DataModel<
28
+ Table.TablesRecord<Tables_>
29
+ >;
30
+
31
+ export type ToConvex<DataModel_ extends AnyWithProps> = {
32
+ [TableName_ in TableNames<DataModel_>]: TableInfoWithName<
33
+ DataModel_,
34
+ TableName_
35
+ >;
36
+ };
37
+
38
+ export type Tables<DataModel_ extends AnyWithProps> =
39
+ DataModel_[TypeId][keyof DataModel_[TypeId]];
40
+
41
+ export type TableNames<DataModel_ extends AnyWithProps> = Table.Name<
42
+ Tables<DataModel_>
43
+ > &
44
+ string;
45
+
46
+ export type TableWithName<
47
+ DataModel_ extends AnyWithProps,
48
+ TableName extends TableNames<DataModel_>,
49
+ > = Table.WithName<Tables<DataModel_>, TableName>;
50
+
51
+ export type TableInfoWithName_<
52
+ DataModel_ extends AnyWithProps,
53
+ TableName extends TableNames<DataModel_>,
54
+ > = TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>;
55
+
56
+ export type TableInfoWithName<
57
+ DataModel_ extends AnyWithProps,
58
+ TableName extends TableNames<DataModel_>,
59
+ > = TableInfo.ConvexTableInfo<
60
+ TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>
61
+ >;
62
+
63
+ export type DocumentWithName<
64
+ DataModel_ extends AnyWithProps,
65
+ TableName extends TableNames<DataModel_>,
66
+ > = TableInfo.Document<
67
+ TableInfo.TableInfo<Table.WithName<Tables<DataModel_>, TableName>>
68
+ >;
69
+
70
+ export type DocumentByName<
71
+ DataModel_ extends AnyWithProps,
72
+ TableName extends TableNames<DataModel_>,
73
+ > = DocumentWithName<DataModel_, TableName>;
74
+
75
+ export type Id<
76
+ DataModel_ extends AnyWithProps,
77
+ TableName extends TableNames<DataModel_>,
78
+ > = GenericId.GenericId<
79
+ TableName,
80
+ Table.Scope<TableWithName<DataModel_, TableName>>
81
+ >;