joist-codegen 2.3.0 → 2.4.0-next.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 (431) hide show
  1. package/build/EntityDbMetadata.cjs +672 -0
  2. package/build/EntityDbMetadata.cjs.map +1 -0
  3. package/build/EntityDbMetadata.d.cts +301 -0
  4. package/build/EntityDbMetadata.d.cts.map +1 -0
  5. package/build/EntityDbMetadata.d.mts +301 -0
  6. package/build/EntityDbMetadata.d.mts.map +1 -0
  7. package/build/EntityDbMetadata.js +550 -662
  8. package/build/EntityDbMetadata.js.map +1 -1
  9. package/build/_virtual/_rolldown/runtime.cjs +23 -0
  10. package/build/_virtual/_rolldown/runtime.js +5 -0
  11. package/build/assignTags.cjs +45 -0
  12. package/build/assignTags.cjs.map +1 -0
  13. package/build/{assignTags.d.ts → assignTags.d.cts} +8 -4
  14. package/build/assignTags.d.cts.map +1 -0
  15. package/build/assignTags.d.mts +16 -0
  16. package/build/assignTags.d.mts.map +1 -0
  17. package/build/assignTags.js +37 -59
  18. package/build/assignTags.js.map +1 -1
  19. package/build/codemods/Codemod.cjs +2 -0
  20. package/build/codemods/Codemod.d.cts +17 -0
  21. package/build/codemods/Codemod.d.cts.map +1 -0
  22. package/build/codemods/Codemod.d.mts +17 -0
  23. package/build/codemods/Codemod.d.mts.map +1 -0
  24. package/build/codemods/Codemod.js +2 -3
  25. package/build/codemods/JscodeshiftMod.cjs +42 -0
  26. package/build/codemods/JscodeshiftMod.cjs.map +1 -0
  27. package/build/codemods/JscodeshiftMod.d.cts +14 -0
  28. package/build/codemods/JscodeshiftMod.d.cts.map +1 -0
  29. package/build/codemods/JscodeshiftMod.d.mts +14 -0
  30. package/build/codemods/JscodeshiftMod.d.mts.map +1 -0
  31. package/build/codemods/JscodeshiftMod.js +33 -33
  32. package/build/codemods/JscodeshiftMod.js.map +1 -1
  33. package/build/codemods/codemod_0001-rename_has_async_property.cjs +30 -0
  34. package/build/codemods/codemod_0001-rename_has_async_property.cjs.map +1 -0
  35. package/build/codemods/codemod_0001-rename_has_async_property.d.cts +9 -0
  36. package/build/codemods/codemod_0001-rename_has_async_property.d.cts.map +1 -0
  37. package/build/codemods/codemod_0001-rename_has_async_property.d.mts +9 -0
  38. package/build/codemods/codemod_0001-rename_has_async_property.d.mts.map +1 -0
  39. package/build/codemods/codemod_0001-rename_has_async_property.js +21 -25
  40. package/build/codemods/codemod_0001-rename_has_async_property.js.map +1 -1
  41. package/build/codemods/codemod_0002-rename_async_query_fields.cjs +50 -0
  42. package/build/codemods/codemod_0002-rename_async_query_fields.cjs.map +1 -0
  43. package/build/codemods/codemod_0002-rename_async_query_fields.d.cts +9 -0
  44. package/build/codemods/codemod_0002-rename_async_query_fields.d.cts.map +1 -0
  45. package/build/codemods/codemod_0002-rename_async_query_fields.d.mts +9 -0
  46. package/build/codemods/codemod_0002-rename_async_query_fields.d.mts.map +1 -0
  47. package/build/codemods/codemod_0002-rename_async_query_fields.js +38 -52
  48. package/build/codemods/codemod_0002-rename_async_query_fields.js.map +1 -1
  49. package/build/codemods/codemod_0003-rename_find_paginated.cjs +25 -0
  50. package/build/codemods/codemod_0003-rename_find_paginated.cjs.map +1 -0
  51. package/build/codemods/codemod_0003-rename_find_paginated.d.cts +9 -0
  52. package/build/codemods/codemod_0003-rename_find_paginated.d.cts.map +1 -0
  53. package/build/codemods/codemod_0003-rename_find_paginated.d.mts +9 -0
  54. package/build/codemods/codemod_0003-rename_find_paginated.d.mts.map +1 -0
  55. package/build/codemods/codemod_0003-rename_find_paginated.js +17 -26
  56. package/build/codemods/codemod_0003-rename_find_paginated.js.map +1 -1
  57. package/build/codemods/index.cjs +49 -0
  58. package/build/codemods/index.cjs.map +1 -0
  59. package/build/codemods/index.d.cts +12 -0
  60. package/build/codemods/index.d.cts.map +1 -0
  61. package/build/codemods/index.d.mts +12 -0
  62. package/build/codemods/index.d.mts.map +1 -0
  63. package/build/codemods/index.js +34 -42
  64. package/build/codemods/index.js.map +1 -1
  65. package/build/config.cjs +377 -0
  66. package/build/config.cjs.map +1 -0
  67. package/build/config.d.cts +181 -0
  68. package/build/config.d.cts.map +1 -0
  69. package/build/config.d.mts +181 -0
  70. package/build/config.d.mts.map +1 -0
  71. package/build/config.js +309 -347
  72. package/build/config.js.map +1 -1
  73. package/build/docs/cache.cjs +62 -0
  74. package/build/docs/cache.cjs.map +1 -0
  75. package/build/docs/cache.d.cts +17 -0
  76. package/build/docs/cache.d.cts.map +1 -0
  77. package/build/docs/cache.d.mts +17 -0
  78. package/build/docs/cache.d.mts.map +1 -0
  79. package/build/docs/cache.js +52 -53
  80. package/build/docs/cache.js.map +1 -1
  81. package/build/docs/generate-metadata-docs.cjs +32 -0
  82. package/build/docs/generate-metadata-docs.cjs.map +1 -0
  83. package/build/docs/generate-metadata-docs.d.cts +9 -0
  84. package/build/docs/generate-metadata-docs.d.cts.map +1 -0
  85. package/build/docs/generate-metadata-docs.d.mts +9 -0
  86. package/build/docs/generate-metadata-docs.d.mts.map +1 -0
  87. package/build/docs/generate-metadata-docs.js +19 -24
  88. package/build/docs/generate-metadata-docs.js.map +1 -1
  89. package/build/docs/index.cjs +90 -0
  90. package/build/docs/index.cjs.map +1 -0
  91. package/build/docs/index.d.cts +16 -0
  92. package/build/docs/index.d.cts.map +1 -0
  93. package/build/docs/index.d.mts +16 -0
  94. package/build/docs/index.d.mts.map +1 -0
  95. package/build/docs/index.js +75 -80
  96. package/build/docs/index.js.map +1 -1
  97. package/build/docs/markdown.cjs +181 -0
  98. package/build/docs/markdown.cjs.map +1 -0
  99. package/build/docs/{markdown.d.ts → markdown.d.cts} +14 -12
  100. package/build/docs/markdown.d.cts.map +1 -0
  101. package/build/docs/markdown.d.mts +32 -0
  102. package/build/docs/markdown.d.mts.map +1 -0
  103. package/build/docs/markdown.js +152 -220
  104. package/build/docs/markdown.js.map +1 -1
  105. package/build/docs/parsing.cjs +117 -0
  106. package/build/docs/parsing.cjs.map +1 -0
  107. package/build/docs/parsing.d.cts +48 -0
  108. package/build/docs/parsing.d.cts.map +1 -0
  109. package/build/docs/parsing.d.mts +48 -0
  110. package/build/docs/parsing.d.mts.map +1 -0
  111. package/build/docs/parsing.js +89 -88
  112. package/build/docs/parsing.js.map +1 -1
  113. package/build/findEntityScopes.cjs +119 -0
  114. package/build/findEntityScopes.cjs.map +1 -0
  115. package/build/findEntityScopes.d.cts +14 -0
  116. package/build/findEntityScopes.d.cts.map +1 -0
  117. package/build/findEntityScopes.d.mts +14 -0
  118. package/build/findEntityScopes.d.mts.map +1 -0
  119. package/build/findEntityScopes.js +83 -111
  120. package/build/findEntityScopes.js.map +1 -1
  121. package/build/foreignKeyOrdering.cjs +52 -0
  122. package/build/foreignKeyOrdering.cjs.map +1 -0
  123. package/build/foreignKeyOrdering.d.cts +8 -0
  124. package/build/foreignKeyOrdering.d.cts.map +1 -0
  125. package/build/foreignKeyOrdering.d.mts +8 -0
  126. package/build/foreignKeyOrdering.d.mts.map +1 -0
  127. package/build/foreignKeyOrdering.js +46 -55
  128. package/build/foreignKeyOrdering.js.map +1 -1
  129. package/build/generate.cjs +128 -0
  130. package/build/generate.cjs.map +1 -0
  131. package/build/generate.d.cts +17 -0
  132. package/build/generate.d.cts.map +1 -0
  133. package/build/generate.d.mts +17 -0
  134. package/build/generate.d.mts.map +1 -0
  135. package/build/generate.js +111 -124
  136. package/build/generate.js.map +1 -1
  137. package/build/generateEntitiesFile.cjs +46 -0
  138. package/build/generateEntitiesFile.cjs.map +1 -0
  139. package/build/generateEntitiesFile.d.cts +11 -0
  140. package/build/generateEntitiesFile.d.cts.map +1 -0
  141. package/build/generateEntitiesFile.d.mts +11 -0
  142. package/build/generateEntitiesFile.d.mts.map +1 -0
  143. package/build/generateEntitiesFile.js +28 -25
  144. package/build/generateEntitiesFile.js.map +1 -1
  145. package/build/generateEntityCodegenFile.cjs +1011 -0
  146. package/build/generateEntityCodegenFile.cjs.map +1 -0
  147. package/build/generateEntityCodegenFile.d.cts +16 -0
  148. package/build/generateEntityCodegenFile.d.cts.map +1 -0
  149. package/build/generateEntityCodegenFile.d.mts +16 -0
  150. package/build/generateEntityCodegenFile.d.mts.map +1 -0
  151. package/build/generateEntityCodegenFile.js +794 -827
  152. package/build/generateEntityCodegenFile.js.map +1 -1
  153. package/build/generateEntityFile.cjs +23 -0
  154. package/build/generateEntityFile.cjs.map +1 -0
  155. package/build/generateEntityFile.d.cts +9 -0
  156. package/build/generateEntityFile.d.cts.map +1 -0
  157. package/build/generateEntityFile.d.mts +9 -0
  158. package/build/generateEntityFile.d.mts.map +1 -0
  159. package/build/generateEntityFile.js +11 -8
  160. package/build/generateEntityFile.js.map +1 -1
  161. package/build/generateEntityTestFile.cjs +25 -0
  162. package/build/generateEntityTestFile.cjs.map +1 -0
  163. package/build/generateEntityTestFile.d.cts +9 -0
  164. package/build/generateEntityTestFile.d.cts.map +1 -0
  165. package/build/generateEntityTestFile.d.mts +9 -0
  166. package/build/generateEntityTestFile.d.mts.map +1 -0
  167. package/build/generateEntityTestFile.js +10 -7
  168. package/build/generateEntityTestFile.js.map +1 -1
  169. package/build/generateEnumFile.cjs +73 -0
  170. package/build/generateEnumFile.cjs.map +1 -0
  171. package/build/generateEnumFile.d.cts +9 -0
  172. package/build/generateEnumFile.d.cts.map +1 -0
  173. package/build/generateEnumFile.d.mts +9 -0
  174. package/build/generateEnumFile.d.mts.map +1 -0
  175. package/build/generateEnumFile.js +33 -43
  176. package/build/generateEnumFile.js.map +1 -1
  177. package/build/generateFactoriesFiles.cjs +28 -0
  178. package/build/generateFactoriesFiles.cjs.map +1 -0
  179. package/build/generateFactoriesFiles.d.cts +7 -0
  180. package/build/generateFactoriesFiles.d.cts.map +1 -0
  181. package/build/generateFactoriesFiles.d.mts +7 -0
  182. package/build/generateFactoriesFiles.d.mts.map +1 -0
  183. package/build/generateFactoriesFiles.js +21 -16
  184. package/build/generateFactoriesFiles.js.map +1 -1
  185. package/build/generateFlushFunction.cjs +61 -0
  186. package/build/generateFlushFunction.cjs.map +1 -0
  187. package/build/{generateFlushFunction.d.ts → generateFlushFunction.d.cts} +8 -5
  188. package/build/generateFlushFunction.d.cts.map +1 -0
  189. package/build/generateFlushFunction.d.mts +23 -0
  190. package/build/generateFlushFunction.d.mts.map +1 -0
  191. package/build/generateFlushFunction.js +32 -78
  192. package/build/generateFlushFunction.js.map +1 -1
  193. package/build/generateMetadataFile.cjs +315 -0
  194. package/build/generateMetadataFile.cjs.map +1 -0
  195. package/build/generateMetadataFile.d.cts +10 -0
  196. package/build/generateMetadataFile.d.cts.map +1 -0
  197. package/build/generateMetadataFile.d.mts +10 -0
  198. package/build/generateMetadataFile.d.mts.map +1 -0
  199. package/build/generateMetadataFile.js +156 -156
  200. package/build/generateMetadataFile.js.map +1 -1
  201. package/build/generatePgEnumFile.cjs +21 -0
  202. package/build/generatePgEnumFile.cjs.map +1 -0
  203. package/build/generatePgEnumFile.d.cts +9 -0
  204. package/build/generatePgEnumFile.d.cts.map +1 -0
  205. package/build/generatePgEnumFile.d.mts +9 -0
  206. package/build/generatePgEnumFile.d.mts.map +1 -0
  207. package/build/generatePgEnumFile.js +12 -9
  208. package/build/generatePgEnumFile.js.map +1 -1
  209. package/build/index.cjs +135 -0
  210. package/build/index.cjs.map +1 -0
  211. package/build/index.d.cts +12 -0
  212. package/build/index.d.cts.map +1 -0
  213. package/build/index.d.mts +12 -0
  214. package/build/index.d.mts.map +1 -0
  215. package/build/index.js +109 -127
  216. package/build/index.js.map +1 -1
  217. package/build/inheritance.cjs +258 -0
  218. package/build/inheritance.cjs.map +1 -0
  219. package/build/inheritance.d.cts +13 -0
  220. package/build/inheritance.d.cts.map +1 -0
  221. package/build/inheritance.d.mts +13 -0
  222. package/build/inheritance.d.mts.map +1 -0
  223. package/build/inheritance.js +238 -247
  224. package/build/inheritance.js.map +1 -1
  225. package/build/installSkills.cjs +68 -0
  226. package/build/installSkills.cjs.map +1 -0
  227. package/build/installSkills.d.cts +16 -0
  228. package/build/installSkills.d.cts.map +1 -0
  229. package/build/installSkills.d.mts +16 -0
  230. package/build/installSkills.d.mts.map +1 -0
  231. package/build/installSkills.js +67 -0
  232. package/build/installSkills.js.map +1 -0
  233. package/build/keywords.cjs +7 -0
  234. package/build/keywords.cjs.map +1 -0
  235. package/build/keywords.d.cts +5 -0
  236. package/build/keywords.d.cts.map +1 -0
  237. package/build/keywords.d.mts +5 -0
  238. package/build/keywords.d.mts.map +1 -0
  239. package/build/keywords.js +5 -4
  240. package/build/keywords.js.map +1 -1
  241. package/build/loadMetadata.cjs +39 -0
  242. package/build/loadMetadata.cjs.map +1 -0
  243. package/build/loadMetadata.d.cts +31 -0
  244. package/build/loadMetadata.d.cts.map +1 -0
  245. package/build/loadMetadata.d.mts +31 -0
  246. package/build/loadMetadata.d.mts.map +1 -0
  247. package/build/loadMetadata.js +32 -39
  248. package/build/loadMetadata.js.map +1 -1
  249. package/build/logger.cjs +28 -0
  250. package/build/logger.cjs.map +1 -0
  251. package/build/logger.d.cts +13 -0
  252. package/build/logger.d.cts.map +1 -0
  253. package/build/logger.d.mts +13 -0
  254. package/build/logger.d.mts.map +1 -0
  255. package/build/logger.js +17 -16
  256. package/build/logger.js.map +1 -1
  257. package/build/pgMetadata.cjs +332 -0
  258. package/build/pgMetadata.cjs.map +1 -0
  259. package/build/pgMetadata.d.cts +128 -0
  260. package/build/pgMetadata.d.cts.map +1 -0
  261. package/build/pgMetadata.d.mts +128 -0
  262. package/build/pgMetadata.d.mts.map +1 -0
  263. package/build/pgMetadata.js +320 -0
  264. package/build/pgMetadata.js.map +1 -0
  265. package/build/scanEntityFiles.cjs +46 -0
  266. package/build/scanEntityFiles.cjs.map +1 -0
  267. package/build/scanEntityFiles.d.cts +8 -0
  268. package/build/scanEntityFiles.d.cts.map +1 -0
  269. package/build/scanEntityFiles.d.mts +8 -0
  270. package/build/scanEntityFiles.d.mts.map +1 -0
  271. package/build/scanEntityFiles.js +37 -42
  272. package/build/scanEntityFiles.js.map +1 -1
  273. package/build/sortForeignKeys.cjs +99 -0
  274. package/build/sortForeignKeys.cjs.map +1 -0
  275. package/build/{sortForeignKeys.d.ts → sortForeignKeys.d.cts} +8 -5
  276. package/build/sortForeignKeys.d.cts.map +1 -0
  277. package/build/sortForeignKeys.d.mts +35 -0
  278. package/build/sortForeignKeys.d.mts.map +1 -0
  279. package/build/sortForeignKeys.js +88 -117
  280. package/build/sortForeignKeys.js.map +1 -1
  281. package/build/symbols.cjs +238 -0
  282. package/build/symbols.cjs.map +1 -0
  283. package/build/symbols.d.cts +120 -0
  284. package/build/symbols.d.cts.map +1 -0
  285. package/build/symbols.d.mts +120 -0
  286. package/build/symbols.d.mts.map +1 -0
  287. package/build/symbols.js +121 -113
  288. package/build/symbols.js.map +1 -1
  289. package/build/tsdoc.cjs +22 -0
  290. package/build/tsdoc.cjs.map +1 -0
  291. package/build/tsdoc.d.cts +15 -0
  292. package/build/tsdoc.d.cts.map +1 -0
  293. package/build/tsdoc.d.mts +15 -0
  294. package/build/tsdoc.d.mts.map +1 -0
  295. package/build/tsdoc.js +18 -15
  296. package/build/tsdoc.js.map +1 -1
  297. package/build/utils.cjs +175 -0
  298. package/build/utils.cjs.map +1 -0
  299. package/build/utils.d.cts +36 -0
  300. package/build/utils.d.cts.map +1 -0
  301. package/build/utils.d.mts +36 -0
  302. package/build/utils.d.mts.map +1 -0
  303. package/build/utils.js +113 -166
  304. package/build/utils.js.map +1 -1
  305. package/build/write-json-schema.cjs +23 -0
  306. package/build/write-json-schema.cjs.map +1 -0
  307. package/build/write-json-schema.d.cts +1 -0
  308. package/build/write-json-schema.d.mts +1 -0
  309. package/build/write-json-schema.js +19 -13
  310. package/build/write-json-schema.js.map +1 -1
  311. package/package.json +47 -18
  312. package/skills/joist-docs/SKILL.md +142 -0
  313. package/skills/joist-em-basics/SKILL.md +114 -0
  314. package/skills/joist-em-execute/SKILL.md +35 -0
  315. package/skills/joist-em-find/SKILL.md +27 -0
  316. package/skills/joist-em-query/SKILL.md +32 -0
  317. package/skills/joist-partial-updates/SKILL.md +352 -0
  318. package/skills/joist-reactive-hints/SKILL.md +150 -0
  319. package/skills/joist-test-factories/SKILL.md +397 -0
  320. package/skills/joist-upsert/SKILL.md +95 -0
  321. package/build/EntityDbMetadata.d.ts +0 -269
  322. package/build/EntityDbMetadata.d.ts.map +0 -1
  323. package/build/EntityDbMetadata.test.d.ts +0 -2
  324. package/build/EntityDbMetadata.test.d.ts.map +0 -1
  325. package/build/EntityDbMetadata.test.js +0 -211
  326. package/build/EntityDbMetadata.test.js.map +0 -1
  327. package/build/assignTags.d.ts.map +0 -1
  328. package/build/codemods/Codemod.d.ts +0 -14
  329. package/build/codemods/Codemod.d.ts.map +0 -1
  330. package/build/codemods/Codemod.js.map +0 -1
  331. package/build/codemods/JscodeshiftMod.d.ts +0 -11
  332. package/build/codemods/JscodeshiftMod.d.ts.map +0 -1
  333. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts +0 -2
  334. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts.map +0 -1
  335. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js +0 -9
  336. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js.map +0 -1
  337. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts +0 -2
  338. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts.map +0 -1
  339. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js +0 -9
  340. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js.map +0 -1
  341. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts +0 -2
  342. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts.map +0 -1
  343. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js +0 -9
  344. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js.map +0 -1
  345. package/build/codemods/codemod_0001-rename_has_async_property.d.ts +0 -7
  346. package/build/codemods/codemod_0001-rename_has_async_property.d.ts.map +0 -1
  347. package/build/codemods/codemod_0002-rename_async_query_fields.d.ts +0 -7
  348. package/build/codemods/codemod_0002-rename_async_query_fields.d.ts.map +0 -1
  349. package/build/codemods/codemod_0003-rename_find_paginated.d.ts +0 -7
  350. package/build/codemods/codemod_0003-rename_find_paginated.d.ts.map +0 -1
  351. package/build/codemods/index.d.ts +0 -9
  352. package/build/codemods/index.d.ts.map +0 -1
  353. package/build/codemods/index.test.d.ts +0 -2
  354. package/build/codemods/index.test.d.ts.map +0 -1
  355. package/build/codemods/index.test.js +0 -24
  356. package/build/codemods/index.test.js.map +0 -1
  357. package/build/config.d.ts +0 -167
  358. package/build/config.d.ts.map +0 -1
  359. package/build/config.test.d.ts +0 -2
  360. package/build/config.test.d.ts.map +0 -1
  361. package/build/config.test.js +0 -78
  362. package/build/config.test.js.map +0 -1
  363. package/build/docs/cache.d.ts +0 -14
  364. package/build/docs/cache.d.ts.map +0 -1
  365. package/build/docs/cache.test.d.ts +0 -2
  366. package/build/docs/cache.test.d.ts.map +0 -1
  367. package/build/docs/cache.test.js +0 -47
  368. package/build/docs/cache.test.js.map +0 -1
  369. package/build/docs/generate-metadata-docs.d.ts +0 -6
  370. package/build/docs/generate-metadata-docs.d.ts.map +0 -1
  371. package/build/docs/index.d.ts +0 -9
  372. package/build/docs/index.d.ts.map +0 -1
  373. package/build/docs/index.test.d.ts +0 -2
  374. package/build/docs/index.test.d.ts.map +0 -1
  375. package/build/docs/index.test.js +0 -100
  376. package/build/docs/index.test.js.map +0 -1
  377. package/build/docs/markdown.d.ts.map +0 -1
  378. package/build/docs/markdown.test.d.ts +0 -2
  379. package/build/docs/markdown.test.d.ts.map +0 -1
  380. package/build/docs/markdown.test.js +0 -280
  381. package/build/docs/markdown.test.js.map +0 -1
  382. package/build/docs/parsing.d.ts +0 -42
  383. package/build/docs/parsing.d.ts.map +0 -1
  384. package/build/docs/parsing.test.d.ts +0 -2
  385. package/build/docs/parsing.test.d.ts.map +0 -1
  386. package/build/docs/parsing.test.js +0 -190
  387. package/build/docs/parsing.test.js.map +0 -1
  388. package/build/findEntityScopes.d.ts +0 -11
  389. package/build/findEntityScopes.d.ts.map +0 -1
  390. package/build/foreignKeyOrdering.d.ts +0 -3
  391. package/build/foreignKeyOrdering.d.ts.map +0 -1
  392. package/build/generate.d.ts +0 -12
  393. package/build/generate.d.ts.map +0 -1
  394. package/build/generateEntitiesFile.d.ts +0 -7
  395. package/build/generateEntitiesFile.d.ts.map +0 -1
  396. package/build/generateEntityCodegenFile.d.ts +0 -11
  397. package/build/generateEntityCodegenFile.d.ts.map +0 -1
  398. package/build/generateEntityFile.d.ts +0 -6
  399. package/build/generateEntityFile.d.ts.map +0 -1
  400. package/build/generateEntityTestFile.d.ts +0 -6
  401. package/build/generateEntityTestFile.d.ts.map +0 -1
  402. package/build/generateEnumFile.d.ts +0 -5
  403. package/build/generateEnumFile.d.ts.map +0 -1
  404. package/build/generateFactoriesFiles.d.ts +0 -4
  405. package/build/generateFactoriesFiles.d.ts.map +0 -1
  406. package/build/generateFlushFunction.d.ts.map +0 -1
  407. package/build/generateMetadataFile.d.ts +0 -5
  408. package/build/generateMetadataFile.d.ts.map +0 -1
  409. package/build/generatePgEnumFile.d.ts +0 -5
  410. package/build/generatePgEnumFile.d.ts.map +0 -1
  411. package/build/index.d.ts +0 -11
  412. package/build/index.d.ts.map +0 -1
  413. package/build/inheritance.d.ts +0 -10
  414. package/build/inheritance.d.ts.map +0 -1
  415. package/build/keywords.d.ts +0 -2
  416. package/build/keywords.d.ts.map +0 -1
  417. package/build/loadMetadata.d.ts +0 -26
  418. package/build/loadMetadata.d.ts.map +0 -1
  419. package/build/logger.d.ts +0 -10
  420. package/build/logger.d.ts.map +0 -1
  421. package/build/scanEntityFiles.d.ts +0 -5
  422. package/build/scanEntityFiles.d.ts.map +0 -1
  423. package/build/sortForeignKeys.d.ts.map +0 -1
  424. package/build/symbols.d.ts +0 -108
  425. package/build/symbols.d.ts.map +0 -1
  426. package/build/tsdoc.d.ts +0 -12
  427. package/build/tsdoc.d.ts.map +0 -1
  428. package/build/utils.d.ts +0 -31
  429. package/build/utils.d.ts.map +0 -1
  430. package/build/write-json-schema.d.ts +0 -2
  431. package/build/write-json-schema.d.ts.map +0 -1
@@ -0,0 +1,301 @@
1
+ import { Config } from "./config.mjs";
2
+ import { Action, Column, M2MRelation, M2ORelation, O2MRelation, Table } from "./pgMetadata.mjs";
3
+ import { EnumMetadata, EnumRow, PgEnumMetadata } from "./loadMetadata.mjs";
4
+ import { Code, Import } from "ts-poet";
5
+ //#region src/EntityDbMetadata.d.ts
6
+ /** All the entities + enums in our database. */
7
+ interface DbMetadata {
8
+ entities: EntityDbMetadata[];
9
+ /** Type name i.e. `Author` to metadata. */
10
+ entitiesByName: Record<string, EntityDbMetadata>;
11
+ enums: EnumMetadata;
12
+ pgEnums: PgEnumMetadata;
13
+ joinTables: string[];
14
+ /** Other non-joist tables in the schema. */
15
+ otherTables: string[];
16
+ totalTables: number;
17
+ }
18
+ /** Codegen-time metadata about a given domain entity. */
19
+ type Entity = {
20
+ name: string;
21
+ /** The _type_ symbol pointing to the entity itself. */
22
+ type: Import;
23
+ /** The symbol pointing to the entity itself. */
24
+ typeSymbol: Import;
25
+ /** The symbol pointing to the entity itself, directly rather than via entities.ts */
26
+ typeForMetadataFile: Import;
27
+ /** The name of the entity's runtime metadata const. */
28
+ metaName: string;
29
+ /** The symbol pointing to the entity's runtime metadata const. */
30
+ metaType: Import;
31
+ /** The symbol pointing to the entity's EntityId type. */
32
+ idType: Import;
33
+ /** The symbol pointing to the entity's Order type. */
34
+ orderType: Import;
35
+ /** The symbol pointing to the entity's config const. */
36
+ configConst: Import;
37
+ optsType: Import;
38
+ /** i.e. `AuthorId` (or `Author_Id` on conflict). */
39
+ idName: string;
40
+ /** i.e. `AuthorFields`. */
41
+ fieldsName: string;
42
+ /** i.e. `AuthorOpts`. */
43
+ optsName: string;
44
+ /** i.e. `AuthorIdsOpts`. */
45
+ idsOptsName: string;
46
+ /** i.e. `AuthorFilter`. */
47
+ filterName: string;
48
+ /** i.e. `AuthorGraphQLFilter`. */
49
+ graphqlFilterName: string;
50
+ /** i.e. `AuthorOrder`. */
51
+ orderName: string;
52
+ /** i.e. `AuthorFactoryExtras`. */
53
+ factoryExtrasName: string;
54
+ /** i.e. `AuthorScope`. */
55
+ scopeName: string;
56
+ /** i.e. `AuthorScopes`. */
57
+ scopesName: string;
58
+ };
59
+ type DatabaseColumnType = "boolean" | "int" | "uuid" | "numeric" | "smallint" | "integer" | "bigint" | "decimal" | "real" | "smallserial" | "serial" | "bigserial" | "double precision" | "text" | "citext" | "character varying" | "varchar" | "time without time zone" | "timestamp with time zone" | "timestamp without time zone" | "date" | "jsonb" | "bytea" | "tsvector" | "tstzrange";
60
+ /**
61
+ * A logical entity field.
62
+ *
63
+ * I.e. it may be a physical db column, or multiple physical db columns, or a "virtual" field like
64
+ * the one-to-many collection side of a many-to-one foreign key. */
65
+ interface Field {
66
+ fieldName: string;
67
+ ignore?: boolean;
68
+ }
69
+ type PrimitiveTypescriptType = "boolean" | "string" | "number" | "Object" | "bigint" | "Uint8Array" | Code;
70
+ type PrimitiveField = Field & {
71
+ kind: "primitive";
72
+ columnName: string;
73
+ /** Physical table owner, unchanged by domain inheritance specialization. */
74
+ columnOwner: Entity;
75
+ columnType: DatabaseColumnType;
76
+ columnDefault: number | boolean | string | null;
77
+ columnGenerated: boolean;
78
+ /** Database nullability, unchanged by domain inheritance specialization. */
79
+ columnNotNull: boolean;
80
+ fieldType: PrimitiveTypescriptType | Import;
81
+ rawFieldType: PrimitiveTypescriptType;
82
+ notNull: boolean;
83
+ derived: "orm" | "sync" | "async" | false;
84
+ protected: boolean;
85
+ unique: boolean;
86
+ superstruct: Import | undefined;
87
+ zodSchema: Import | undefined;
88
+ customSerde: Import | undefined;
89
+ isArray: boolean;
90
+ hasConfigDefault: boolean;
91
+ lazy?: boolean;
92
+ };
93
+ type EnumField = Field & {
94
+ kind: "enum";
95
+ columnName: string;
96
+ /** Physical table owner, unchanged by domain inheritance specialization. */
97
+ columnOwner: Entity;
98
+ columnType: DatabaseColumnType;
99
+ columnDefault: number | boolean | string | null;
100
+ columnGenerated: boolean;
101
+ columnNotNull: boolean;
102
+ derived: "sync" | "async" | false;
103
+ enumName: string;
104
+ enumType: Import;
105
+ enumDetailType: Import;
106
+ enumDetailsType: Import;
107
+ enumRows: EnumRow[];
108
+ notNull: boolean;
109
+ isArray: boolean;
110
+ hasConfigDefault: boolean;
111
+ };
112
+ type PgEnumField = Field & {
113
+ kind: "pg-enum";
114
+ columnName: string;
115
+ /** Physical table owner, unchanged by domain inheritance specialization. */
116
+ columnOwner: Entity;
117
+ columnDefault: number | boolean | string | null;
118
+ columnGenerated: boolean;
119
+ columnNotNull: boolean;
120
+ /** I.e. `favorite_shape`. */
121
+ dbType: string;
122
+ /** I.e. `FavoriteShape`. */
123
+ enumName: string;
124
+ enumType: Import;
125
+ enumValues: string[];
126
+ notNull: boolean;
127
+ hasConfigDefault: boolean;
128
+ };
129
+ /** I.e. a `Book.author` reference pointing to an `Author`. */
130
+ type ManyToOneField = Field & {
131
+ kind: "m2o";
132
+ columnName: string;
133
+ /** Physical table owner, unchanged by domain inheritance specialization. */
134
+ columnOwner: Entity;
135
+ columnDefault?: number | boolean | string | null;
136
+ columnGenerated: boolean;
137
+ columnNotNull: boolean;
138
+ dbType: string;
139
+ otherFieldName: string;
140
+ otherEntity: Entity;
141
+ notNull: boolean;
142
+ isDeferredAndDeferrable: boolean;
143
+ constraintName: string;
144
+ derived: "async" | false;
145
+ hasConfigDefault: boolean;
146
+ onDelete: Action;
147
+ };
148
+ /** I.e. a `Author.books` collection. */
149
+ type OneToManyField = Field & {
150
+ kind: "o2m";
151
+ singularName: string;
152
+ otherEntity: Entity;
153
+ otherFieldName: string;
154
+ otherColumnName: string;
155
+ otherColumnNotNull: boolean;
156
+ isLargeCollection: boolean;
157
+ orderBy: {
158
+ field: string;
159
+ direction: "ASC" | "DESC";
160
+ } | undefined;
161
+ softDeletes: "include" | "exclude" | undefined;
162
+ };
163
+ /** I.e. a `Author.image` reference when `image.author_id` is unique. */
164
+ type OneToOneField = Field & {
165
+ kind: "o2o";
166
+ otherEntity: Entity;
167
+ otherFieldName: string;
168
+ otherColumnName: string;
169
+ otherColumnNotNull: boolean;
170
+ };
171
+ type ManyToManyField = Field & {
172
+ kind: "m2m";
173
+ joinTableName: string;
174
+ singularName: string;
175
+ columnName: string;
176
+ otherEntity: Entity;
177
+ otherFieldName: string;
178
+ otherColumnName: string;
179
+ isLargeCollection: boolean;
180
+ isDeferredAndDeferrable: boolean;
181
+ derived: "async" | "otherSide" | false;
182
+ softDeletes: "include" | "exclude" | undefined;
183
+ /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
184
+ hasJoinTableId: boolean;
185
+ };
186
+ /** I.e. a `Publisher.logoColors` m2m to the `color` enum table, backed by `publisher_logo_colors`. */
187
+ type ManyToManyEnumField = Field & {
188
+ kind: "m2mEnum";
189
+ joinTableName: string;
190
+ /** The entity's FK column, e.g. `publisher_id`. */
191
+ columnName: string;
192
+ /** The enum's FK column, e.g. `logo_color_id`. */
193
+ otherColumnName: string;
194
+ enumName: string;
195
+ enumType: Import;
196
+ enumDetailType: Import;
197
+ enumDetailsType: Import;
198
+ enumRows: EnumRow[];
199
+ /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
200
+ hasJoinTableId: boolean;
201
+ };
202
+ /** I.e. a `Comment.parent` reference that groups `comments.parent_book_id` and `comments.parent_book_review_id`. */
203
+ type PolymorphicField = Field & {
204
+ kind: "poly";
205
+ fieldType: string;
206
+ notNull: boolean;
207
+ hasConfigDefault: boolean;
208
+ components: PolymorphicFieldComponent[];
209
+ };
210
+ /** A column such as `parent_book_id` or `parent_book_review_id`. */
211
+ type PolymorphicFieldComponent = {
212
+ columnName: string;
213
+ /** Physical table owner, unchanged by domain inheritance specialization. */
214
+ columnOwner: Entity;
215
+ otherFieldName: string;
216
+ otherEntity: Entity;
217
+ isDeferredAndDeferrable: boolean;
218
+ constraintName: string;
219
+ notNull: false;
220
+ };
221
+ type FieldNameOverrides = {
222
+ fieldName?: string;
223
+ otherFieldName?: string;
224
+ };
225
+ /** Adapts PostgreSQL catalog metadata into our specific ORM types. */
226
+ declare class EntityDbMetadata {
227
+ entity: Entity;
228
+ primaryKey: PrimitiveField;
229
+ primitives: PrimitiveField[];
230
+ enums: EnumField[];
231
+ pgEnums: PgEnumField[];
232
+ manyToOnes: ManyToOneField[];
233
+ oneToManys: OneToManyField[];
234
+ largeOneToManys: OneToManyField[];
235
+ oneToOnes: OneToOneField[];
236
+ manyToManys: ManyToManyField[];
237
+ largeManyToManys: ManyToManyField[];
238
+ manyToManyEnums: ManyToManyEnumField[];
239
+ polymorphics: PolymorphicField[];
240
+ tableName: string;
241
+ tagName: string;
242
+ createdAt: PrimitiveField | undefined;
243
+ updatedAt: PrimitiveField | undefined;
244
+ deletedAt: PrimitiveField | undefined;
245
+ baseClassName: string | undefined;
246
+ baseType: EntityDbMetadata | undefined;
247
+ subTypes: EntityDbMetadata[];
248
+ inheritanceType: "sti" | "cti" | undefined;
249
+ /** This will only be set on the base meta. */
250
+ stiDiscriminatorField?: string;
251
+ /** This will only be set on the sub metas. */
252
+ stiDiscriminatorValue?: number;
253
+ abstract: boolean;
254
+ nonDeferredFkOrder: number;
255
+ uniqueConstraints?: string[][];
256
+ /** Gates mutation targets, not reads; false when required columns or array storage have no supported mutation mapping. */
257
+ supportsEmExecute?: boolean;
258
+ /** Original table fields, captured before inheritance partitions or specializes them. */
259
+ physicalMetadata?: EntityDbMetadata;
260
+ /** Physical columns ignored by entity fields, retained for direct SQL reads and writes. */
261
+ ignoredColumns: PrimitiveField[];
262
+ constructor(config: Config, table: Table, enums?: EnumMetadata);
263
+ get name(): string;
264
+ get nonDeferredFks(): Array<ManyToOneField | PolymorphicFieldComponent>;
265
+ get nonDeferredManyToManyFks(): Array<ManyToManyField>;
266
+ }
267
+ /** Finds the field name for o2o side of a o2o/m2o. */
268
+ declare function oneToOneName(config: Config, refEntity: Entity, keyEntity: Entity, r: M2ORelation | O2MRelation): string;
269
+ declare function referenceName(config: Config, entity: Entity, r: M2ORelation | O2MRelation): string;
270
+ declare function manyToManyName(column: Column): string;
271
+ /** Returns the collection name to use on `entity` when referring to `otherEntity`s. */
272
+ declare function collectionName(config: Config, singleEntity: Entity, collectionEntity: Entity, r: M2ORelation | O2MRelation | M2MRelation): {
273
+ fieldName: string;
274
+ singularName: string;
275
+ };
276
+ declare function failIfOverlappingFieldNames(entity: EntityDbMetadata): void;
277
+ declare function makeEntity(entityName: string): Entity;
278
+ /**
279
+ * Collapses the per-relation `otherEntity` copies down to the one primary `Entity` per name.
280
+ *
281
+ * `makeEntity` mints a fresh `Entity` for every relation's `otherEntity`, so each entity ends up with
282
+ * many duplicate objects floating around. Pointing them all at the single `entitiesByName[name].entity`
283
+ * instance means later passes (i.e. `resolveNameConflicts`) only have to update one object per name.
284
+ *
285
+ * Must run after inheritance, since STI/CTI specialization both adds and re-points `otherEntity`s.
286
+ */
287
+ declare function canonicalizeOtherEntities(db: DbMetadata): void;
288
+ /**
289
+ * Rewrites codegen'd type names that collide with another exported type name.
290
+ *
291
+ * `makeEntity` defaults each name to the conventional `${name}<Suffix>`, but if a separate entity or
292
+ * enum is literally named e.g. `AuthorScope` or `AuthorOrder`, our generated type of the same name
293
+ * would collide with it, so we fall back to `Author_Scope` / `Author_Order`.
294
+ *
295
+ * Relies on `canonicalizeOtherEntities` having run, so mutating each primary `meta.entity` also updates
296
+ * the `otherEntity` references that point at it (e.g. `Book.author: AuthorId` follows `Author`'s rename).
297
+ */
298
+ declare function resolveNameConflicts(config: Config, db: DbMetadata): void;
299
+ //#endregion
300
+ export { DatabaseColumnType, DbMetadata, Entity, EntityDbMetadata, EnumField, FieldNameOverrides, ManyToManyEnumField, ManyToManyField, ManyToOneField, OneToManyField, OneToOneField, PgEnumField, PolymorphicField, PolymorphicFieldComponent, PrimitiveField, PrimitiveTypescriptType, canonicalizeOtherEntities, collectionName, failIfOverlappingFieldNames, makeEntity, manyToManyName, oneToOneName, referenceName, resolveNameConflicts };
301
+ //# sourceMappingURL=EntityDbMetadata.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityDbMetadata.d.mts","names":[],"sources":["../src/EntityDbMetadata.ts"],"mappings":";;;;;;UAmDiB;EACf,UAAU;;EAEV,gBAAgB,eAAe;EAC/B,OAAO;EACP,SAAS;EACT;;EAEA;EACA;;;KAIU;EACV;;EAEA,MAAM;;EAEN,YAAY;;EAEZ,qBAAqB;;EAErB;;EAEA,UAAU;;EAEV,QAAQ;;EAER,WAAW;;EAEX,aAAa;EACb,UAAU;;EAKV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;KAGU;;;;;;UAgCF;EACR;EACA;;KAGU,iGAAiG;KAEjG,iBAAiB;EAC3B;EACA;;EAEA,aAAa;EACb,YAAY;EACZ;EACA;;EAEA;EAEA,WAAW,0BAA0B;EACrC,cAAc;EACd;EACA;EACA;EACA;EACA,aAAa;EACb,WAAW;EACX,aAAa;EACb;EACA;EACA;;KAGU,YAAY;EACtB;EACA;;EAEA,aAAa;EACb,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,iBAAiB;EACjB,UAAU;EACV;EACA;EACA;;KAGU,cAAc;EACxB;EACA;;EAEA,aAAa;EACb;EACA;EACA;;EAEA;;EAEA;EACA,UAAU;EACV;EACA;EACA;;;KAIU,iBAAiB;EAC3B;EACA;;EAEA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA,UAAU;;;KAIA,iBAAiB;EAC3B;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;IAAW;IAAe;;EAC1B;;;KAIU,gBAAgB;EAC1B;EACA,aAAa;EACb;EACA;EACA;;KAGU,kBAAkB;EAC5B;EACA;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;EACA;;EAEA;;;KAIU,sBAAsB;EAChC;EACA;;EAEA;;EAEA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,iBAAiB;EACjB,UAAU;;EAEV;;;KAIU,mBAAmB;EAC7B;EACA;EACA;EACA;EACA,YAAY;;;KAIF;EACV;;EAEA,aAAa;EACb;EACA,aAAa;EACb;EACA;EACA;;KAGU;EACV;EACA;;;cAIW;EACX,QAAQ;EACR,YAAY;EACZ,YAAY;EACZ,OAAO;EACP,SAAS;EACT,YAAY;EACZ,YAAY;EACZ,iBAAiB;EACjB,WAAW;EACX,aAAa;EACb,kBAAkB;EAClB,iBAAiB;EACjB,cAAc;EACd;EACA;EACA,WAAW;EACX,WAAW;EACX,WAAW;EACX;EACA,UAAU;EACV,UAAU;EACV;;EAEA;;EAEA;EACA;EACA;EACA;;EAEA;;EAEA,mBAAmB;;EAEnB,gBAAgB;EAEhB,YAAY,QAAQ,QAAQ,OAAO,OAAO,QAAO;MAqI7C;MAIA,kBAAkB,MAAM,iBAAiB;MAOzC,4BAA4B,MAAM;;;iBAqcxB,aACd,QAAQ,QAER,WAAW,QAEX,WAAW,QACX,GAAG,cAAc;iBAgCH,cAAc,QAAQ,QAAQ,QAAQ,QAAQ,GAAG,cAAc;iBAmB/D,eAAe,QAAQ;;iBAUvB,eACd,QAAQ,QAER,cAAc,QAEd,kBAAkB,QAClB,GAAG,cAAc,cAAc;EAC5B;EAAmB;;iBA4BR,4BAA4B,QAAQ;iBAwBpC,WAAW,qBAAqB;;;;;;;;;;iBA6BhC,0BAA0B,IAAI;;;;;;;;;;;iBAgC9B,qBAAqB,QAAQ,QAAQ,IAAI"}