joist-codegen 2.3.0-next.6 → 2.3.0-next.60

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 (420) hide show
  1. package/build/EntityDbMetadata.cjs +608 -0
  2. package/build/EntityDbMetadata.cjs.map +1 -0
  3. package/build/EntityDbMetadata.d.cts +274 -0
  4. package/build/EntityDbMetadata.d.cts.map +1 -0
  5. package/build/EntityDbMetadata.d.mts +274 -0
  6. package/build/EntityDbMetadata.d.mts.map +1 -0
  7. package/build/EntityDbMetadata.js +485 -661
  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 +127 -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 +110 -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 +951 -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 +734 -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 +290 -0
  194. package/build/generateMetadataFile.cjs.map +1 -0
  195. package/build/generateMetadataFile.d.cts +8 -0
  196. package/build/generateMetadataFile.d.cts.map +1 -0
  197. package/build/generateMetadataFile.d.mts +8 -0
  198. package/build/generateMetadataFile.d.mts.map +1 -0
  199. package/build/generateMetadataFile.js +116 -140
  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 +108 -127
  216. package/build/index.js.map +1 -1
  217. package/build/inheritance.cjs +213 -0
  218. package/build/inheritance.cjs.map +1 -0
  219. package/build/inheritance.d.cts +12 -0
  220. package/build/inheritance.d.cts.map +1 -0
  221. package/build/inheritance.d.mts +12 -0
  222. package/build/inheritance.d.mts.map +1 -0
  223. package/build/inheritance.js +193 -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/scanEntityFiles.cjs +46 -0
  258. package/build/scanEntityFiles.cjs.map +1 -0
  259. package/build/scanEntityFiles.d.cts +8 -0
  260. package/build/scanEntityFiles.d.cts.map +1 -0
  261. package/build/scanEntityFiles.d.mts +8 -0
  262. package/build/scanEntityFiles.d.mts.map +1 -0
  263. package/build/scanEntityFiles.js +37 -42
  264. package/build/scanEntityFiles.js.map +1 -1
  265. package/build/sortForeignKeys.cjs +99 -0
  266. package/build/sortForeignKeys.cjs.map +1 -0
  267. package/build/{sortForeignKeys.d.ts → sortForeignKeys.d.cts} +8 -5
  268. package/build/sortForeignKeys.d.cts.map +1 -0
  269. package/build/sortForeignKeys.d.mts +35 -0
  270. package/build/sortForeignKeys.d.mts.map +1 -0
  271. package/build/sortForeignKeys.js +88 -117
  272. package/build/sortForeignKeys.js.map +1 -1
  273. package/build/symbols.cjs +228 -0
  274. package/build/symbols.cjs.map +1 -0
  275. package/build/symbols.d.cts +115 -0
  276. package/build/symbols.d.cts.map +1 -0
  277. package/build/symbols.d.mts +115 -0
  278. package/build/symbols.d.mts.map +1 -0
  279. package/build/symbols.js +116 -113
  280. package/build/symbols.js.map +1 -1
  281. package/build/tsdoc.cjs +22 -0
  282. package/build/tsdoc.cjs.map +1 -0
  283. package/build/tsdoc.d.cts +15 -0
  284. package/build/tsdoc.d.cts.map +1 -0
  285. package/build/tsdoc.d.mts +15 -0
  286. package/build/tsdoc.d.mts.map +1 -0
  287. package/build/tsdoc.js +18 -15
  288. package/build/tsdoc.js.map +1 -1
  289. package/build/utils.cjs +173 -0
  290. package/build/utils.cjs.map +1 -0
  291. package/build/utils.d.cts +34 -0
  292. package/build/utils.d.cts.map +1 -0
  293. package/build/utils.d.mts +34 -0
  294. package/build/utils.d.mts.map +1 -0
  295. package/build/utils.js +112 -166
  296. package/build/utils.js.map +1 -1
  297. package/build/write-json-schema.cjs +23 -0
  298. package/build/write-json-schema.cjs.map +1 -0
  299. package/build/write-json-schema.d.cts +1 -0
  300. package/build/write-json-schema.d.mts +1 -0
  301. package/build/write-json-schema.js +19 -13
  302. package/build/write-json-schema.js.map +1 -1
  303. package/package.json +37 -17
  304. package/skills/joist-docs/SKILL.md +133 -0
  305. package/skills/joist-em-basics/SKILL.md +114 -0
  306. package/skills/joist-partial-updates/SKILL.md +352 -0
  307. package/skills/joist-reactive-hints/SKILL.md +150 -0
  308. package/skills/joist-test-factories/SKILL.md +397 -0
  309. package/skills/joist-upsert/SKILL.md +95 -0
  310. package/build/EntityDbMetadata.d.ts +0 -269
  311. package/build/EntityDbMetadata.d.ts.map +0 -1
  312. package/build/EntityDbMetadata.test.d.ts +0 -2
  313. package/build/EntityDbMetadata.test.d.ts.map +0 -1
  314. package/build/EntityDbMetadata.test.js +0 -211
  315. package/build/EntityDbMetadata.test.js.map +0 -1
  316. package/build/assignTags.d.ts.map +0 -1
  317. package/build/codemods/Codemod.d.ts +0 -14
  318. package/build/codemods/Codemod.d.ts.map +0 -1
  319. package/build/codemods/Codemod.js.map +0 -1
  320. package/build/codemods/JscodeshiftMod.d.ts +0 -11
  321. package/build/codemods/JscodeshiftMod.d.ts.map +0 -1
  322. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts +0 -2
  323. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.d.ts.map +0 -1
  324. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js +0 -9
  325. package/build/codemods/__tests__/codemod_0001-rename_has_async_property.test.js.map +0 -1
  326. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts +0 -2
  327. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.d.ts.map +0 -1
  328. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js +0 -9
  329. package/build/codemods/__tests__/codemod_0002-rename_async_query_fields.test.js.map +0 -1
  330. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts +0 -2
  331. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.d.ts.map +0 -1
  332. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js +0 -9
  333. package/build/codemods/__tests__/codemod_0003-rename_find_paginated.test.js.map +0 -1
  334. package/build/codemods/codemod_0001-rename_has_async_property.d.ts +0 -7
  335. package/build/codemods/codemod_0001-rename_has_async_property.d.ts.map +0 -1
  336. package/build/codemods/codemod_0002-rename_async_query_fields.d.ts +0 -7
  337. package/build/codemods/codemod_0002-rename_async_query_fields.d.ts.map +0 -1
  338. package/build/codemods/codemod_0003-rename_find_paginated.d.ts +0 -7
  339. package/build/codemods/codemod_0003-rename_find_paginated.d.ts.map +0 -1
  340. package/build/codemods/index.d.ts +0 -9
  341. package/build/codemods/index.d.ts.map +0 -1
  342. package/build/codemods/index.test.d.ts +0 -2
  343. package/build/codemods/index.test.d.ts.map +0 -1
  344. package/build/codemods/index.test.js +0 -24
  345. package/build/codemods/index.test.js.map +0 -1
  346. package/build/config.d.ts +0 -167
  347. package/build/config.d.ts.map +0 -1
  348. package/build/config.test.d.ts +0 -2
  349. package/build/config.test.d.ts.map +0 -1
  350. package/build/config.test.js +0 -78
  351. package/build/config.test.js.map +0 -1
  352. package/build/docs/cache.d.ts +0 -14
  353. package/build/docs/cache.d.ts.map +0 -1
  354. package/build/docs/cache.test.d.ts +0 -2
  355. package/build/docs/cache.test.d.ts.map +0 -1
  356. package/build/docs/cache.test.js +0 -47
  357. package/build/docs/cache.test.js.map +0 -1
  358. package/build/docs/generate-metadata-docs.d.ts +0 -6
  359. package/build/docs/generate-metadata-docs.d.ts.map +0 -1
  360. package/build/docs/index.d.ts +0 -9
  361. package/build/docs/index.d.ts.map +0 -1
  362. package/build/docs/index.test.d.ts +0 -2
  363. package/build/docs/index.test.d.ts.map +0 -1
  364. package/build/docs/index.test.js +0 -100
  365. package/build/docs/index.test.js.map +0 -1
  366. package/build/docs/markdown.d.ts.map +0 -1
  367. package/build/docs/markdown.test.d.ts +0 -2
  368. package/build/docs/markdown.test.d.ts.map +0 -1
  369. package/build/docs/markdown.test.js +0 -280
  370. package/build/docs/markdown.test.js.map +0 -1
  371. package/build/docs/parsing.d.ts +0 -42
  372. package/build/docs/parsing.d.ts.map +0 -1
  373. package/build/docs/parsing.test.d.ts +0 -2
  374. package/build/docs/parsing.test.d.ts.map +0 -1
  375. package/build/docs/parsing.test.js +0 -190
  376. package/build/docs/parsing.test.js.map +0 -1
  377. package/build/findEntityScopes.d.ts +0 -11
  378. package/build/findEntityScopes.d.ts.map +0 -1
  379. package/build/foreignKeyOrdering.d.ts +0 -3
  380. package/build/foreignKeyOrdering.d.ts.map +0 -1
  381. package/build/generate.d.ts +0 -12
  382. package/build/generate.d.ts.map +0 -1
  383. package/build/generateEntitiesFile.d.ts +0 -7
  384. package/build/generateEntitiesFile.d.ts.map +0 -1
  385. package/build/generateEntityCodegenFile.d.ts +0 -11
  386. package/build/generateEntityCodegenFile.d.ts.map +0 -1
  387. package/build/generateEntityFile.d.ts +0 -6
  388. package/build/generateEntityFile.d.ts.map +0 -1
  389. package/build/generateEntityTestFile.d.ts +0 -6
  390. package/build/generateEntityTestFile.d.ts.map +0 -1
  391. package/build/generateEnumFile.d.ts +0 -5
  392. package/build/generateEnumFile.d.ts.map +0 -1
  393. package/build/generateFactoriesFiles.d.ts +0 -4
  394. package/build/generateFactoriesFiles.d.ts.map +0 -1
  395. package/build/generateFlushFunction.d.ts.map +0 -1
  396. package/build/generateMetadataFile.d.ts +0 -5
  397. package/build/generateMetadataFile.d.ts.map +0 -1
  398. package/build/generatePgEnumFile.d.ts +0 -5
  399. package/build/generatePgEnumFile.d.ts.map +0 -1
  400. package/build/index.d.ts +0 -11
  401. package/build/index.d.ts.map +0 -1
  402. package/build/inheritance.d.ts +0 -10
  403. package/build/inheritance.d.ts.map +0 -1
  404. package/build/keywords.d.ts +0 -2
  405. package/build/keywords.d.ts.map +0 -1
  406. package/build/loadMetadata.d.ts +0 -26
  407. package/build/loadMetadata.d.ts.map +0 -1
  408. package/build/logger.d.ts +0 -10
  409. package/build/logger.d.ts.map +0 -1
  410. package/build/scanEntityFiles.d.ts +0 -5
  411. package/build/scanEntityFiles.d.ts.map +0 -1
  412. package/build/sortForeignKeys.d.ts.map +0 -1
  413. package/build/symbols.d.ts +0 -108
  414. package/build/symbols.d.ts.map +0 -1
  415. package/build/tsdoc.d.ts +0 -12
  416. package/build/tsdoc.d.ts.map +0 -1
  417. package/build/utils.d.ts +0 -31
  418. package/build/utils.d.ts.map +0 -1
  419. package/build/write-json-schema.d.ts +0 -2
  420. package/build/write-json-schema.d.ts.map +0 -1
@@ -0,0 +1,274 @@
1
+ import { Config } from "./config.mjs";
2
+ import { EnumMetadata, EnumRow, PgEnumMetadata } from "./loadMetadata.mjs";
3
+ import { Action, Column, M2MRelation, M2ORelation, O2MRelation, Table } from "pg-structure";
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
+ columnType: DatabaseColumnType;
74
+ columnDefault: number | boolean | string | null;
75
+ fieldType: PrimitiveTypescriptType | Import;
76
+ rawFieldType: PrimitiveTypescriptType;
77
+ notNull: boolean;
78
+ derived: "orm" | "sync" | "async" | false;
79
+ protected: boolean;
80
+ unique: boolean;
81
+ superstruct: Import | undefined;
82
+ zodSchema: Import | undefined;
83
+ customSerde: Import | undefined;
84
+ isArray: boolean;
85
+ hasConfigDefault: boolean;
86
+ lazy?: boolean;
87
+ };
88
+ type EnumField = Field & {
89
+ kind: "enum";
90
+ columnName: string;
91
+ columnType: DatabaseColumnType;
92
+ columnDefault: number | boolean | string | null;
93
+ derived: "sync" | "async" | false;
94
+ enumName: string;
95
+ enumType: Import;
96
+ enumDetailType: Import;
97
+ enumDetailsType: Import;
98
+ enumRows: EnumRow[];
99
+ notNull: boolean;
100
+ isArray: boolean;
101
+ hasConfigDefault: boolean;
102
+ };
103
+ type PgEnumField = Field & {
104
+ kind: "pg-enum";
105
+ columnName: string;
106
+ columnDefault: number | boolean | string | null;
107
+ /** I.e. `favorite_shape`. */
108
+ dbType: string;
109
+ /** I.e. `FavoriteShape`. */
110
+ enumName: string;
111
+ enumType: Import;
112
+ enumValues: string[];
113
+ notNull: boolean;
114
+ hasConfigDefault: boolean;
115
+ };
116
+ /** I.e. a `Book.author` reference pointing to an `Author`. */
117
+ type ManyToOneField = Field & {
118
+ kind: "m2o";
119
+ columnName: string;
120
+ dbType: string;
121
+ otherFieldName: string;
122
+ otherEntity: Entity;
123
+ notNull: boolean;
124
+ isDeferredAndDeferrable: boolean;
125
+ constraintName: string;
126
+ derived: "async" | false;
127
+ hasConfigDefault: boolean;
128
+ onDelete: Action;
129
+ };
130
+ /** I.e. a `Author.books` collection. */
131
+ type OneToManyField = Field & {
132
+ kind: "o2m";
133
+ singularName: string;
134
+ otherEntity: Entity;
135
+ otherFieldName: string;
136
+ otherColumnName: string;
137
+ otherColumnNotNull: boolean;
138
+ isLargeCollection: boolean;
139
+ orderBy: {
140
+ field: string;
141
+ direction: "ASC" | "DESC";
142
+ } | undefined;
143
+ softDeletes: "include" | "exclude" | undefined;
144
+ };
145
+ /** I.e. a `Author.image` reference when `image.author_id` is unique. */
146
+ type OneToOneField = Field & {
147
+ kind: "o2o";
148
+ otherEntity: Entity;
149
+ otherFieldName: string;
150
+ otherColumnName: string;
151
+ otherColumnNotNull: boolean;
152
+ };
153
+ type ManyToManyField = Field & {
154
+ kind: "m2m";
155
+ joinTableName: string;
156
+ singularName: string;
157
+ columnName: string;
158
+ otherEntity: Entity;
159
+ otherFieldName: string;
160
+ otherColumnName: string;
161
+ isLargeCollection: boolean;
162
+ isDeferredAndDeferrable: boolean;
163
+ derived: "async" | "otherSide" | false;
164
+ softDeletes: "include" | "exclude" | undefined;
165
+ /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
166
+ hasJoinTableId: boolean;
167
+ };
168
+ /** I.e. a `Publisher.logoColors` m2m to the `color` enum table, backed by `publisher_logo_colors`. */
169
+ type ManyToManyEnumField = Field & {
170
+ kind: "m2mEnum";
171
+ joinTableName: string;
172
+ /** The entity's FK column, e.g. `publisher_id`. */
173
+ columnName: string;
174
+ /** The enum's FK column, e.g. `logo_color_id`. */
175
+ otherColumnName: string;
176
+ enumName: string;
177
+ enumType: Import;
178
+ enumDetailType: Import;
179
+ enumDetailsType: Import;
180
+ enumRows: EnumRow[];
181
+ /** Whether the join table has a surrogate `id` PK; if false the FK pair is the composite PK. */
182
+ hasJoinTableId: boolean;
183
+ };
184
+ /** I.e. a `Comment.parent` reference that groups `comments.parent_book_id` and `comments.parent_book_review_id`. */
185
+ type PolymorphicField = Field & {
186
+ kind: "poly";
187
+ fieldType: string;
188
+ notNull: boolean;
189
+ hasConfigDefault: boolean;
190
+ components: PolymorphicFieldComponent[];
191
+ };
192
+ type PolymorphicFieldComponent = {
193
+ columnName: string;
194
+ otherFieldName: string;
195
+ otherEntity: Entity;
196
+ isDeferredAndDeferrable: boolean;
197
+ constraintName: string;
198
+ notNull: false;
199
+ };
200
+ type FieldNameOverrides = {
201
+ fieldName?: string;
202
+ otherFieldName?: string;
203
+ };
204
+ /** Adapts the generally-great pg-structure metadata into our specific ORM types. */
205
+ declare class EntityDbMetadata {
206
+ entity: Entity;
207
+ primaryKey: PrimitiveField;
208
+ primitives: PrimitiveField[];
209
+ enums: EnumField[];
210
+ pgEnums: PgEnumField[];
211
+ manyToOnes: ManyToOneField[];
212
+ oneToManys: OneToManyField[];
213
+ largeOneToManys: OneToManyField[];
214
+ oneToOnes: OneToOneField[];
215
+ manyToManys: ManyToManyField[];
216
+ largeManyToManys: ManyToManyField[];
217
+ manyToManyEnums: ManyToManyEnumField[];
218
+ polymorphics: PolymorphicField[];
219
+ tableName: string;
220
+ tagName: string;
221
+ createdAt: PrimitiveField | undefined;
222
+ updatedAt: PrimitiveField | undefined;
223
+ deletedAt: PrimitiveField | undefined;
224
+ baseClassName: string | undefined;
225
+ baseType: EntityDbMetadata | undefined;
226
+ subTypes: EntityDbMetadata[];
227
+ inheritanceType: "sti" | "cti" | undefined;
228
+ /** This will only be set on the base meta. */
229
+ stiDiscriminatorField?: string;
230
+ /** This will only be set on the sub metas. */
231
+ stiDiscriminatorValue?: number;
232
+ abstract: boolean;
233
+ nonDeferredFkOrder: number;
234
+ uniqueConstraints?: string[][];
235
+ constructor(config: Config, table: Table, enums?: EnumMetadata);
236
+ get name(): string;
237
+ get nonDeferredFks(): Array<ManyToOneField | PolymorphicFieldComponent>;
238
+ get nonDeferredManyToManyFks(): Array<ManyToManyField>;
239
+ }
240
+ /** Finds the field name for o2o side of a o2o/m2o. */
241
+ declare function oneToOneName(config: Config, refEntity: Entity, keyEntity: Entity, r: M2ORelation | O2MRelation): string;
242
+ declare function referenceName(config: Config, entity: Entity, r: M2ORelation | O2MRelation): string;
243
+ declare function manyToManyName(column: Column): string;
244
+ /** Returns the collection name to use on `entity` when referring to `otherEntity`s. */
245
+ declare function collectionName(config: Config, singleEntity: Entity, collectionEntity: Entity, r: M2ORelation | O2MRelation | M2MRelation): {
246
+ fieldName: string;
247
+ singularName: string;
248
+ };
249
+ declare function failIfOverlappingFieldNames(entity: EntityDbMetadata): void;
250
+ declare function makeEntity(entityName: string): Entity;
251
+ /**
252
+ * Collapses the per-relation `otherEntity` copies down to the one primary `Entity` per name.
253
+ *
254
+ * `makeEntity` mints a fresh `Entity` for every relation's `otherEntity`, so each entity ends up with
255
+ * many duplicate objects floating around. Pointing them all at the single `entitiesByName[name].entity`
256
+ * instance means later passes (i.e. `resolveNameConflicts`) only have to update one object per name.
257
+ *
258
+ * Must run after inheritance, since STI/CTI specialization both adds and re-points `otherEntity`s.
259
+ */
260
+ declare function canonicalizeOtherEntities(db: DbMetadata): void;
261
+ /**
262
+ * Rewrites codegen'd type names that collide with another exported type name.
263
+ *
264
+ * `makeEntity` defaults each name to the conventional `${name}<Suffix>`, but if a separate entity or
265
+ * enum is literally named e.g. `AuthorScope` or `AuthorOrder`, our generated type of the same name
266
+ * would collide with it, so we fall back to `Author_Scope` / `Author_Order`.
267
+ *
268
+ * Relies on `canonicalizeOtherEntities` having run, so mutating each primary `meta.entity` also updates
269
+ * the `otherEntity` references that point at it (e.g. `Book.author: AuthorId` follows `Author`'s rename).
270
+ */
271
+ declare function resolveNameConflicts(config: Config, db: DbMetadata): void;
272
+ //#endregion
273
+ 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 };
274
+ //# 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;EACA,YAAY;EACZ;EAEA,WAAW,0BAA0B;EACrC,cAAc;EACd;EACA;EACA;EACA;EACA,aAAa;EACb,WAAW;EACX,aAAa;EACb;EACA;EACA;;KAGU,YAAY;EACtB;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,iBAAiB;EACjB,UAAU;EACV;EACA;EACA;;KAGU,cAAc;EACxB;EACA;EACA;;EAEA;;EAEA;EACA,UAAU;EACV;EACA;EACA;;;KAIU,iBAAiB;EAC3B;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;;KAGF;EACV;EACA;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,YAAY,QAAQ,QAAQ,OAAO,OAAO,QAAO;MAuG7C;MAIA,kBAAkB,MAAM,iBAAiB;MAOzC,4BAA4B,MAAM;;;iBAwZxB,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;;;;;;;;;;;iBA6B9B,qBAAqB,QAAQ,QAAQ,IAAI"}