joist-codegen 2.3.0 → 2.4.0

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,15 @@
1
+ //#region src/tsdoc.d.ts
2
+ declare const tsdocComments: {
3
+ entity: {
4
+ setPartial: string;
5
+ setDeepPartial: string;
6
+ changes: string;
7
+ load: string;
8
+ populate: string;
9
+ isLoaded: string;
10
+ toJSON: string;
11
+ };
12
+ };
13
+ //#endregion
14
+ export { tsdocComments };
15
+ //# sourceMappingURL=tsdoc.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsdoc.d.cts","names":[],"sources":["../src/tsdoc.ts"],"mappings":";cAIa;EACX;IACE;IAmBA;IAoBA;IAKA;IAKA;IAKA;IAMA"}
@@ -0,0 +1,15 @@
1
+ //#region src/tsdoc.d.ts
2
+ declare const tsdocComments: {
3
+ entity: {
4
+ setPartial: string;
5
+ setDeepPartial: string;
6
+ changes: string;
7
+ load: string;
8
+ populate: string;
9
+ isLoaded: string;
10
+ toJSON: string;
11
+ };
12
+ };
13
+ //#endregion
14
+ export { tsdocComments };
15
+ //# sourceMappingURL=tsdoc.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsdoc.d.mts","names":[],"sources":["../src/tsdoc.ts"],"mappings":";cAIa;EACX;IACE;IAmBA;IAoBA;IAKA;IAKA;IAKA;IAMA"}
package/build/tsdoc.js CHANGED
@@ -1,18 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tsdocComments = void 0;
1
+ //#region src/tsdoc.ts
4
2
  function makeTsDocComment(...lines) {
5
- return ["/**", ...lines.map((l) => `* ${l}`), "*/"].join("\n");
3
+ return [
4
+ "/**",
5
+ ...lines.map((l) => `* ${l}`),
6
+ "*/"
7
+ ].join("\n");
6
8
  }
7
- exports.tsdocComments = {
8
- entity: {
9
- setPartial: makeTsDocComment("Partial update taking any subset of the entities fields.", "", 'Unlike `set`, null is used as a marker to mean "unset this field", and undefined', "is left as untouched.", "", "Collections are exhaustively set to the new values, however,", "{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. ", "", "@example", "```", "entity.setPartial({", " firstName: 'foo' // updated", " lastName: undefined // do nothing", " age: null // unset, (i.e. set it as undefined)", "});", "```", "@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs "),
10
- setDeepPartial: makeTsDocComment("Partial update taking any nested subset of the entities fields.", "", 'Unlike `set`, null is used as a marker to mean "unset this field", and undefined', "is left as untouched.", "", "Collections are exhaustively set to the new values, however,", "{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. ", "", "@example", "```", "entity.setDeepPartial({", " firstName: 'foo' // updated", " lastName: undefined // do nothing", " age: null // unset, (i.e. set it as undefined)", ' books: [{ title: "b1" }], // create a child book', "});", "```", "@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs "),
11
- changes: makeTsDocComment("Details the field changes of the entity within the current unit of work.", "", "@see {@link https://joist-orm.io/features/changed-fields | Changed Fields} on the Joist docs "),
12
- load: makeTsDocComment("Traverse from this entity using a lens, and load the result.", "", "@see {@link https://joist-orm.io/advanced/lenses | Lens Traversal} on the Joist docs"),
13
- populate: makeTsDocComment("Hydrate this entity using a load hint", "", "@see {@link https://joist-orm.io/features/loading-entities#1-object-graph-navigation | Loading entities} on the Joist docs"),
14
- isLoaded: makeTsDocComment("Given a load hint, checks if it is loaded within the unit of work.", "", "Type Guarded via Loaded<>", ""),
15
- toJSON: makeTsDocComment("Build a type-safe, loadable and relation aware POJO from this entity, given a hint.", "", "Note: As the hint might load, this returns a Promise", "", "@example", "```", "const payload = await a.toJSON({", " id: true,", " books: { id: true, reviews: { rating: true } }", "});", "```", "@see {@link https://joist-orm.io/advanced/json-payloads | Json Payloads} on the Joist docs"),
16
- },
17
- };
9
+ const tsdocComments = { entity: {
10
+ setPartial: makeTsDocComment("Partial update taking any subset of the entities fields.", "", "Unlike `set`, null is used as a marker to mean \"unset this field\", and undefined", "is left as untouched.", "", "Collections are exhaustively set to the new values, however,", "{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. ", "", "@example", "```", "entity.setPartial({", " firstName: 'foo' // updated", " lastName: undefined // do nothing", " age: null // unset, (i.e. set it as undefined)", "});", "```", "@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs "),
11
+ setDeepPartial: makeTsDocComment("Partial update taking any nested subset of the entities fields.", "", "Unlike `set`, null is used as a marker to mean \"unset this field\", and undefined", "is left as untouched.", "", "Collections are exhaustively set to the new values, however,", "{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. ", "", "@example", "```", "entity.setDeepPartial({", " firstName: 'foo' // updated", " lastName: undefined // do nothing", " age: null // unset, (i.e. set it as undefined)", " books: [{ title: \"b1\" }], // create a child book", "});", "```", "@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs "),
12
+ changes: makeTsDocComment("Details the field changes of the entity within the current unit of work.", "", "@see {@link https://joist-orm.io/features/changed-fields | Changed Fields} on the Joist docs "),
13
+ load: makeTsDocComment("Traverse from this entity using a lens, and load the result.", "", "@see {@link https://joist-orm.io/advanced/lenses | Lens Traversal} on the Joist docs"),
14
+ populate: makeTsDocComment("Hydrate this entity using a load hint", "", "@see {@link https://joist-orm.io/features/loading-entities#1-object-graph-navigation | Loading entities} on the Joist docs"),
15
+ isLoaded: makeTsDocComment("Given a load hint, checks if it is loaded within the unit of work.", "", "Type Guarded via Loaded<>", ""),
16
+ toJSON: makeTsDocComment("Build a type-safe, loadable and relation aware POJO from this entity, given a hint.", "", "Note: As the hint might load, this returns a Promise", "", "@example", "```", "const payload = await a.toJSON({", " id: true,", " books: { id: true, reviews: { rating: true } }", "});", "```", "@see {@link https://joist-orm.io/advanced/json-payloads | Json Payloads} on the Joist docs")
17
+ } };
18
+ //#endregion
19
+ export { tsdocComments };
20
+
18
21
  //# sourceMappingURL=tsdoc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc.js","sourceRoot":"","sources":["../src/tsdoc.ts"],"names":[],"mappings":";;;AAAA,SAAS,gBAAgB,CAAC,GAAG,KAAe;IAC1C,OAAO,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAEY,QAAA,aAAa,GAAG;IAC3B,MAAM,EAAE;QACN,UAAU,EAAE,gBAAgB,CAC1B,0DAA0D,EAC1D,EAAE,EACF,kFAAkF,EAClF,uBAAuB,EACvB,EAAE,EACF,8DAA8D,EAC9D,2IAA2I,EAC3I,EAAE,EACF,UAAU,EACV,KAAK,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,qCAAqC,EACrC,kDAAkD,EAClD,KAAK,EACL,KAAK,EACL,yGAAyG,CAC1G;QACD,cAAc,EAAE,gBAAgB,CAC9B,iEAAiE,EACjE,EAAE,EACF,kFAAkF,EAClF,uBAAuB,EACvB,EAAE,EACF,8DAA8D,EAC9D,2IAA2I,EAC3I,EAAE,EACF,UAAU,EACV,KAAK,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,qCAAqC,EACrC,kDAAkD,EAClD,oDAAoD,EACpD,KAAK,EACL,KAAK,EACL,yGAAyG,CAC1G;QACD,OAAO,EAAE,gBAAgB,CACvB,0EAA0E,EAC1E,EAAE,EACF,+FAA+F,CAChG;QACD,IAAI,EAAE,gBAAgB,CACpB,8DAA8D,EAC9D,EAAE,EACF,sFAAsF,CACvF;QACD,QAAQ,EAAE,gBAAgB,CACxB,uCAAuC,EACvC,EAAE,EACF,4HAA4H,CAC7H;QACD,QAAQ,EAAE,gBAAgB,CACxB,oEAAoE,EACpE,EAAE,EACF,2BAA2B,EAC3B,EAAE,CACH;QACD,MAAM,EAAE,gBAAgB,CACtB,qFAAqF,EACrF,EAAE,EACF,sDAAsD,EACtD,EAAE,EACF,UAAU,EACV,KAAK,EACL,kCAAkC,EAClC,aAAa,EACb,kDAAkD,EAClD,KAAK,EACL,KAAK,EACL,4FAA4F,CAC7F;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"tsdoc.js","names":[],"sources":["../src/tsdoc.ts"],"sourcesContent":["function makeTsDocComment(...lines: string[]): string {\n return [\"/**\", ...lines.map((l) => `* ${l}`), \"*/\"].join(\"\\n\");\n}\n\nexport const tsdocComments = {\n entity: {\n setPartial: makeTsDocComment(\n \"Partial update taking any subset of the entities fields.\",\n \"\",\n 'Unlike `set`, null is used as a marker to mean \"unset this field\", and undefined',\n \"is left as untouched.\",\n \"\",\n \"Collections are exhaustively set to the new values, however,\",\n \"{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. \",\n \"\",\n \"@example\",\n \"```\",\n \"entity.setPartial({\",\n \" firstName: 'foo' // updated\",\n \" lastName: undefined // do nothing\",\n \" age: null // unset, (i.e. set it as undefined)\",\n \"});\",\n \"```\",\n \"@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs \",\n ),\n setDeepPartial: makeTsDocComment(\n \"Partial update taking any nested subset of the entities fields.\",\n \"\",\n 'Unlike `set`, null is used as a marker to mean \"unset this field\", and undefined',\n \"is left as untouched.\",\n \"\",\n \"Collections are exhaustively set to the new values, however,\",\n \"{@link https://joist-orm.io/features/partial-update-apis#incremental-collection-updates | Incremental collection updates} are supported. \",\n \"\",\n \"@example\",\n \"```\",\n \"entity.setDeepPartial({\",\n \" firstName: 'foo' // updated\",\n \" lastName: undefined // do nothing\",\n \" age: null // unset, (i.e. set it as undefined)\",\n ' books: [{ title: \"b1\" }], // create a child book',\n \"});\",\n \"```\",\n \"@see {@link https://joist-orm.io/features/partial-update-apis | Partial Update APIs} on the Joist docs \",\n ),\n changes: makeTsDocComment(\n \"Details the field changes of the entity within the current unit of work.\",\n \"\",\n \"@see {@link https://joist-orm.io/features/changed-fields | Changed Fields} on the Joist docs \",\n ),\n load: makeTsDocComment(\n \"Traverse from this entity using a lens, and load the result.\",\n \"\",\n \"@see {@link https://joist-orm.io/advanced/lenses | Lens Traversal} on the Joist docs\",\n ),\n populate: makeTsDocComment(\n \"Hydrate this entity using a load hint\",\n \"\",\n \"@see {@link https://joist-orm.io/features/loading-entities#1-object-graph-navigation | Loading entities} on the Joist docs\",\n ),\n isLoaded: makeTsDocComment(\n \"Given a load hint, checks if it is loaded within the unit of work.\",\n \"\",\n \"Type Guarded via Loaded<>\",\n \"\",\n ),\n toJSON: makeTsDocComment(\n \"Build a type-safe, loadable and relation aware POJO from this entity, given a hint.\",\n \"\",\n \"Note: As the hint might load, this returns a Promise\",\n \"\",\n \"@example\",\n \"```\",\n \"const payload = await a.toJSON({\",\n \" id: true,\",\n \" books: { id: true, reviews: { rating: true } }\",\n \"});\",\n \"```\",\n \"@see {@link https://joist-orm.io/advanced/json-payloads | Json Payloads} on the Joist docs\",\n ),\n },\n};\n"],"mappings":";AAAA,SAAS,iBAAiB,GAAG,OAAyB;CACpD,OAAO;EAAC;EAAO,GAAG,MAAM,KAAK,MAAM,KAAK,GAAG;EAAG;CAAI,CAAC,CAAC,KAAK,IAAI;AAC/D;AAEA,MAAa,gBAAgB,EAC3B,QAAQ;CACN,YAAY,iBACV,4DACA,IACA,sFACA,yBACA,IACA,gEACA,6IACA,IACA,YACA,OACA,uBACA,iCACA,uCACA,oDACA,OACA,OACA,yGACF;CACA,gBAAgB,iBACd,mEACA,IACA,sFACA,yBACA,IACA,gEACA,6IACA,IACA,YACA,OACA,2BACA,iCACA,uCACA,oDACA,wDACA,OACA,OACA,yGACF;CACA,SAAS,iBACP,4EACA,IACA,+FACF;CACA,MAAM,iBACJ,gEACA,IACA,sFACF;CACA,UAAU,iBACR,yCACA,IACA,4HACF;CACA,UAAU,iBACR,sEACA,IACA,6BACA,EACF;CACA,QAAQ,iBACN,uFACA,IACA,wDACA,IACA,YACA,OACA,oCACA,eACA,oDACA,OACA,OACA,4FACF;AACF,EACF"}
@@ -0,0 +1,175 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
3
+ require("./pgMetadata.cjs");
4
+ const require_config = require("./config.cjs");
5
+ require("./EntityDbMetadata.cjs");
6
+ let change_case = require("change-case");
7
+ let joist_utils = require("joist-utils");
8
+ let pluralize = require("pluralize");
9
+ pluralize = require_runtime.__toESM(pluralize, 1);
10
+ let ts_poet = require("ts-poet");
11
+ //#region src/utils.ts
12
+ function assertNever(x) {
13
+ throw new Error("Unexpected object: " + x);
14
+ }
15
+ function isEntityTable(config, t) {
16
+ if (isIgnored(config, t) || isJoinTable(config, t)) return false;
17
+ const columnNames = t.columns.map((c) => c.name);
18
+ const { updatedAtConf, createdAtConf } = require_config.getTimestampConfig(config);
19
+ const hasCreatedAt = createdAtConf.names.some((c) => columnNames.includes(c));
20
+ const hasUpdatedAt = updatedAtConf.names.some((c) => columnNames.includes(c));
21
+ const hasIdColumn = columnNames.includes("id");
22
+ if (!hasIdColumn) return false;
23
+ if (hasIdColumn && !hasCreatedAt && !hasUpdatedAt) {
24
+ if (["name", "code"].every((c) => columnNames.includes(c))) return false;
25
+ }
26
+ if (isSubClassTable(t)) return true;
27
+ return hasIdColumn && (hasCreatedAt || !createdAtConf.required) && (hasUpdatedAt || !updatedAtConf.required);
28
+ }
29
+ function isSubClassTable(t) {
30
+ return t.columns.get("id").foreignKeys.length === 1;
31
+ }
32
+ function isEnumTable(config, t) {
33
+ if (isIgnored(config, t)) return false;
34
+ const columnNames = t.columns.map((c) => c.name);
35
+ return [
36
+ "id",
37
+ "code",
38
+ "name"
39
+ ].every((c) => columnNames.includes(c)) && !isEntityTable(config, t);
40
+ }
41
+ const joinTables = /* @__PURE__ */ new Map();
42
+ function isJoinTable(config, t) {
43
+ if (isIgnored(config, t)) return false;
44
+ return getOrElse(joinTables, t.name, () => {
45
+ const { columns } = t;
46
+ const fks = columns.filter((c) => c.isForeignKey);
47
+ const pks = columns.filter((c) => c.isPrimaryKey);
48
+ if (fks.length !== 2) return false;
49
+ if (!joinTableHasId(t) && !(pks.length === 2 && pks.every((c) => c.isForeignKey))) return false;
50
+ const others = columns.length - fks.length - (joinTableHasId(t) ? 1 : 0);
51
+ const createdAts = columns.filter((c) => c.name === "created_at" || c.name === "createdAt").length;
52
+ return others === 0 || others === 1 && createdAts === 1;
53
+ });
54
+ }
55
+ /** Whether a join table has a surrogate `id` primary key (vs. an id-less FK-pair composite PK). */
56
+ function joinTableHasId(t) {
57
+ const pks = t.columns.filter((c) => c.isPrimaryKey);
58
+ return pks.length === 1 && !pks[0].isForeignKey;
59
+ }
60
+ function getOrElse(map, key, fn) {
61
+ let value = map.get(key);
62
+ if (value === void 0) {
63
+ value = fn();
64
+ map.set(key, value);
65
+ }
66
+ return value;
67
+ }
68
+ /** Converts `projects` to `Project`. */
69
+ function tableToEntityName(config, table) {
70
+ let entityName = config.__tableToEntityName?.[table.name];
71
+ if (!entityName) {
72
+ entityName = Object.entries(config.entities).filter(([, conf]) => conf.tableName === table.name).map(([entityName]) => entityName)[0] || (0, change_case.pascalCase)(pluralize.default.singular(table.name));
73
+ (config.__tableToEntityName ??= {})[table.name] = entityName;
74
+ }
75
+ return entityName;
76
+ }
77
+ const dateCode = ts_poet.code`Date`;
78
+ const plainDateCode = ts_poet.code`${(0, ts_poet.imp)("Temporal@joist-orm")}.PlainDate`;
79
+ const plainTimeCode = ts_poet.code`${(0, ts_poet.imp)("Temporal@joist-orm")}.PlainTime`;
80
+ const plainDateTimeCode = ts_poet.code`${(0, ts_poet.imp)("Temporal@joist-orm")}.PlainDateTime`;
81
+ const zonedDateTimeCode = ts_poet.code`${(0, ts_poet.imp)("Temporal@joist-orm")}.ZonedDateTime`;
82
+ /** Maps db types, i.e. `int`, to JS types, i.e. `number`. */
83
+ function mapSimpleDbTypeToTypescriptType(config, dbType) {
84
+ switch (dbType) {
85
+ case "boolean": return "boolean";
86
+ case "int":
87
+ case "numeric":
88
+ case "smallint":
89
+ case "integer":
90
+ case "decimal":
91
+ case "real":
92
+ case "smallserial":
93
+ case "serial":
94
+ case "double precision": return "number";
95
+ case "bigserial":
96
+ case "bigint": return "bigint";
97
+ case "text":
98
+ case "citext":
99
+ case "character varying":
100
+ case "varchar":
101
+ case "uuid":
102
+ case "tsvector":
103
+ case "tstzrange": return "string";
104
+ case "time without time zone": return config.temporal ? plainTimeCode : fail("Joist doesn't support 'time without time zone' unless temporal is enabled");
105
+ case "timestamp with time zone": return config.temporal ? zonedDateTimeCode : dateCode;
106
+ case "timestamp without time zone": return config.temporal ? plainDateTimeCode : dateCode;
107
+ case "date": return config.temporal ? plainDateCode : dateCode;
108
+ case "jsonb": return "Object";
109
+ case "bytea": return "Uint8Array";
110
+ default: assertNever(dbType);
111
+ }
112
+ }
113
+ function merge(a, b) {
114
+ return [...a, ...b];
115
+ }
116
+ /** Returns true if `p` is resolved, otherwise false if it is rejected. */
117
+ async function trueIfResolved(p) {
118
+ return p.then(() => true, () => false);
119
+ }
120
+ function fail(message) {
121
+ throw new Error(message || "Failed");
122
+ }
123
+ function sortKeys(o) {
124
+ return Object.keys(o).sort().reduce((acc, key) => {
125
+ const value = o[key];
126
+ acc[key] = typeof value === "object" && (0, joist_utils.isPlainObject)(value) ? sortKeys(value) : value;
127
+ return acc;
128
+ }, {});
129
+ }
130
+ function parseOrder(order) {
131
+ if (!order) return;
132
+ const [field, direction = "ASC"] = order.split(" ");
133
+ if (direction !== "ASC" && direction !== "DESC") throw new Error(`Invalid direction: ${direction} (must be "ASC" or "DESC")`);
134
+ return {
135
+ field,
136
+ direction
137
+ };
138
+ }
139
+ function q(s) {
140
+ return s === void 0 ? "undefined" : `"${s}"`;
141
+ }
142
+ function uncapitalize(s) {
143
+ return s.charAt(0).toLowerCase() + s.slice(1);
144
+ }
145
+ function isIgnored(config, t) {
146
+ return (config.ignoredTables || ["migrations", "pgmigrations"]).includes(t.name) || !shouldIncludeSchema(config, t);
147
+ }
148
+ /** Uses the same schema selection for metadata and test database cleanup. */
149
+ function shouldIncludeSchema(config, t) {
150
+ return config.schemas ? config.schemas.includes(t.schema.name) : t.schema.name === "public";
151
+ }
152
+ //#endregion
153
+ exports.assertNever = assertNever;
154
+ exports.dateCode = dateCode;
155
+ exports.fail = fail;
156
+ exports.isEntityTable = isEntityTable;
157
+ exports.isEnumTable = isEnumTable;
158
+ exports.isJoinTable = isJoinTable;
159
+ exports.isSubClassTable = isSubClassTable;
160
+ exports.joinTableHasId = joinTableHasId;
161
+ exports.mapSimpleDbTypeToTypescriptType = mapSimpleDbTypeToTypescriptType;
162
+ exports.merge = merge;
163
+ exports.parseOrder = parseOrder;
164
+ exports.plainDateCode = plainDateCode;
165
+ exports.plainDateTimeCode = plainDateTimeCode;
166
+ exports.plainTimeCode = plainTimeCode;
167
+ exports.q = q;
168
+ exports.shouldIncludeSchema = shouldIncludeSchema;
169
+ exports.sortKeys = sortKeys;
170
+ exports.tableToEntityName = tableToEntityName;
171
+ exports.trueIfResolved = trueIfResolved;
172
+ exports.uncapitalize = uncapitalize;
173
+ exports.zonedDateTimeCode = zonedDateTimeCode;
174
+
175
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["getTimestampConfig","pascalCase","imp","isPlainObject"],"sources":["../src/utils.ts"],"sourcesContent":["import { pascalCase } from \"change-case\";\nimport { isPlainObject } from \"joist-utils\";\nimport pluralize from \"pluralize\";\nimport { code, imp } from \"ts-poet\";\n\nimport { type Config, getTimestampConfig } from \"./config.ts\";\nimport { type DatabaseColumnType, type PrimitiveTypescriptType } from \"./EntityDbMetadata.ts\";\nimport { type Table } from \"./pgMetadata.ts\";\n\nexport function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x);\n}\n\nexport function isEntityTable(config: Config, t: Table): boolean {\n if (isIgnored(config, t) || isJoinTable(config, t)) {\n return false;\n }\n\n // Depending on the config settings, we may/may not require the presence of timestamp\n // fields to determine whether a table is an entity.\n const columnNames = t.columns.map((c) => c.name);\n const { updatedAtConf, createdAtConf } = getTimestampConfig(config);\n const hasCreatedAt = createdAtConf.names.some((c) => columnNames.includes(c));\n const hasUpdatedAt = updatedAtConf.names.some((c) => columnNames.includes(c));\n\n // Entities always require an id column\n const hasIdColumn = columnNames.includes(\"id\");\n if (!hasIdColumn) return false;\n\n // If we have no timestamp columns, but do have `name` and `code`, we're probably an enum.\n if (hasIdColumn && !hasCreatedAt && !hasUpdatedAt) {\n if ([\"name\", \"code\"].every((c) => columnNames.includes(c))) {\n return false;\n }\n }\n\n // If the ID column is a FK then we're a subclass\n if (isSubClassTable(t)) return true;\n\n // Otherwise respect the created_at/updated_at required rules\n return hasIdColumn && (hasCreatedAt || !createdAtConf.required) && (hasUpdatedAt || !updatedAtConf.required);\n}\n\nexport function isSubClassTable(t: Table): boolean {\n // Note that `.get(\"id\")` will blow up if there is no id column\n return t.columns.get(\"id\").foreignKeys.length === 1;\n}\n\nexport function isEnumTable(config: Config, t: Table): boolean {\n if (isIgnored(config, t)) {\n return false;\n }\n const columnNames = t.columns.map((c) => c.name);\n return [\"id\", \"code\", \"name\"].every((c) => columnNames.includes(c)) && !isEntityTable(config, t);\n}\n\n// Oddly enough isJoinTable showed up as a hot spot, so cache its calculation.\nconst joinTables: Map<string, boolean> = new Map();\n\nexport function isJoinTable(config: Config, t: Table): boolean {\n if (isIgnored(config, t)) {\n return false;\n }\n return getOrElse(joinTables, t.name, () => {\n const { columns } = t;\n const fks = columns.filter((c) => c.isForeignKey);\n const pks = columns.filter((c) => c.isPrimaryKey);\n // Every join table is two FKs, plus either a surrogate `id` PK (\"id-ful\") or no surrogate\n // at all, in which case the two FKs are themselves the composite PK (\"id-less\").\n if (fks.length !== 2) return false;\n if (!joinTableHasId(t) && !(pks.length === 2 && pks.every((c) => c.isForeignKey))) return false;\n // Any column beyond the two FKs and the optional `id` PK must be a single created_at.\n const others = columns.length - fks.length - (joinTableHasId(t) ? 1 : 0);\n const createdAts = columns.filter((c) => c.name === \"created_at\" || c.name === \"createdAt\").length;\n return others === 0 || (others === 1 && createdAts === 1);\n });\n}\n\n/** Whether a join table has a surrogate `id` primary key (vs. an id-less FK-pair composite PK). */\nexport function joinTableHasId(t: Table): boolean {\n const pks = t.columns.filter((c) => c.isPrimaryKey);\n return pks.length === 1 && !pks[0].isForeignKey;\n}\n\nfunction getOrElse<K, V>(map: Map<K, V>, key: K, fn: () => V): V {\n let value = map.get(key);\n if (value === undefined) {\n value = fn();\n map.set(key, value);\n }\n return value;\n}\n\n/** Converts `projects` to `Project`. */\nexport function tableToEntityName(config: Config, table: Table): string {\n let entityName = config.__tableToEntityName?.[table.name];\n if (!entityName) {\n const configEntityName = Object.entries(config.entities)\n .filter(([, conf]) => conf.tableName === table.name)\n .map(([entityName]) => entityName)[0];\n entityName = configEntityName || pascalCase(pluralize.singular(table.name));\n (config.__tableToEntityName ??= {})[table.name] = entityName;\n }\n return entityName;\n}\n\nexport const dateCode = code`Date`;\nexport const plainDateCode = code`${imp(\"Temporal@joist-orm\")}.PlainDate`;\nexport const plainTimeCode = code`${imp(\"Temporal@joist-orm\")}.PlainTime`;\nexport const plainDateTimeCode = code`${imp(\"Temporal@joist-orm\")}.PlainDateTime`;\nexport const zonedDateTimeCode = code`${imp(\"Temporal@joist-orm\")}.ZonedDateTime`;\n\n/** Maps db types, i.e. `int`, to JS types, i.e. `number`. */\nexport function mapSimpleDbTypeToTypescriptType(config: Config, dbType: DatabaseColumnType): PrimitiveTypescriptType {\n switch (dbType) {\n case \"boolean\":\n return \"boolean\";\n case \"int\":\n case \"numeric\":\n case \"smallint\":\n case \"integer\":\n case \"decimal\":\n case \"real\":\n case \"smallserial\":\n case \"serial\":\n case \"double precision\":\n return \"number\";\n case \"bigserial\":\n case \"bigint\":\n return \"bigint\";\n case \"text\":\n case \"citext\":\n case \"character varying\":\n case \"varchar\":\n case \"uuid\":\n case \"tsvector\":\n case \"tstzrange\":\n return \"string\";\n case \"time without time zone\":\n return config.temporal\n ? plainTimeCode\n : fail(\"Joist doesn't support 'time without time zone' unless temporal is enabled\");\n case \"timestamp with time zone\":\n return config.temporal ? zonedDateTimeCode : dateCode;\n case \"timestamp without time zone\":\n return config.temporal ? plainDateTimeCode : dateCode;\n case \"date\":\n return config.temporal ? plainDateCode : dateCode;\n case \"jsonb\":\n return \"Object\";\n case \"bytea\":\n return \"Uint8Array\";\n default:\n assertNever(dbType);\n }\n}\n\nexport function merge<T>(a: T[], b: T[]): T[] {\n return [...a, ...b];\n}\n\n/** Returns true if `p` is resolved, otherwise false if it is rejected. */\nexport async function trueIfResolved(p: Promise<unknown>): Promise<boolean> {\n return p.then(\n () => true,\n () => false,\n );\n}\n\nexport function fail(message?: string): never {\n throw new Error(message || \"Failed\");\n}\n\nexport function sortKeys<T extends object>(o: T): T {\n return Object.keys(o)\n .sort()\n .reduce(\n (acc, key) => {\n const value = o[key as keyof T];\n const newValue = typeof value === \"object\" && isPlainObject(value) ? sortKeys(value as any as object) : value;\n acc[key as keyof T] = newValue as any;\n return acc;\n },\n {} as any as T,\n );\n}\n\nexport function parseOrder(order: string | undefined): { field: string; direction: \"ASC\" | \"DESC\" } | undefined {\n if (!order) {\n return undefined;\n }\n const [field, direction = \"ASC\"] = order.split(\" \");\n if (direction !== \"ASC\" && direction !== \"DESC\") {\n throw new Error(`Invalid direction: ${direction} (must be \"ASC\" or \"DESC\")`);\n }\n return { field, direction };\n}\n\nexport function q(s: string | undefined): string {\n return s === undefined ? \"undefined\" : `\"${s}\"`;\n}\n\nexport function uncapitalize(s: string): string {\n return s.charAt(0).toLowerCase() + s.slice(1);\n}\n\nfunction isIgnored(config: Config, t: Table): boolean {\n return (config.ignoredTables || [\"migrations\", \"pgmigrations\"]).includes(t.name) || !shouldIncludeSchema(config, t);\n}\n\n/** Uses the same schema selection for metadata and test database cleanup. */\nexport function shouldIncludeSchema(config: Config, t: Table): boolean {\n return config.schemas ? config.schemas.includes(t.schema.name) : t.schema.name === \"public\";\n}\n"],"mappings":"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"}
@@ -0,0 +1,36 @@
1
+ import { Config } from "./config.cjs";
2
+ import { Table } from "./pgMetadata.cjs";
3
+ import { DatabaseColumnType, PrimitiveTypescriptType } from "./EntityDbMetadata.cjs";
4
+ //#region src/utils.d.ts
5
+ declare function assertNever(x: never): never;
6
+ declare function isEntityTable(config: Config, t: Table): boolean;
7
+ declare function isSubClassTable(t: Table): boolean;
8
+ declare function isEnumTable(config: Config, t: Table): boolean;
9
+ declare function isJoinTable(config: Config, t: Table): boolean;
10
+ /** Whether a join table has a surrogate `id` primary key (vs. an id-less FK-pair composite PK). */
11
+ declare function joinTableHasId(t: Table): boolean;
12
+ /** Converts `projects` to `Project`. */
13
+ declare function tableToEntityName(config: Config, table: Table): string;
14
+ declare const dateCode: import("ts-poet").Code;
15
+ declare const plainDateCode: import("ts-poet").Code;
16
+ declare const plainTimeCode: import("ts-poet").Code;
17
+ declare const plainDateTimeCode: import("ts-poet").Code;
18
+ declare const zonedDateTimeCode: import("ts-poet").Code;
19
+ /** Maps db types, i.e. `int`, to JS types, i.e. `number`. */
20
+ declare function mapSimpleDbTypeToTypescriptType(config: Config, dbType: DatabaseColumnType): PrimitiveTypescriptType;
21
+ declare function merge<T>(a: T[], b: T[]): T[];
22
+ /** Returns true if `p` is resolved, otherwise false if it is rejected. */
23
+ declare function trueIfResolved(p: Promise<unknown>): Promise<boolean>;
24
+ declare function fail(message?: string): never;
25
+ declare function sortKeys<T extends object>(o: T): T;
26
+ declare function parseOrder(order: string | undefined): {
27
+ field: string;
28
+ direction: "ASC" | "DESC";
29
+ } | undefined;
30
+ declare function q(s: string | undefined): string;
31
+ declare function uncapitalize(s: string): string;
32
+ /** Uses the same schema selection for metadata and test database cleanup. */
33
+ declare function shouldIncludeSchema(config: Config, t: Table): boolean;
34
+ //#endregion
35
+ export { assertNever, dateCode, fail, isEntityTable, isEnumTable, isJoinTable, isSubClassTable, joinTableHasId, mapSimpleDbTypeToTypescriptType, merge, parseOrder, plainDateCode, plainDateTimeCode, plainTimeCode, q, shouldIncludeSchema, sortKeys, tableToEntityName, trueIfResolved, uncapitalize, zonedDateTimeCode };
36
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;iBASgB,YAAY;iBAIZ,cAAc,QAAQ,QAAQ,GAAG;iBA8BjC,gBAAgB,GAAG;iBAKnB,YAAY,QAAQ,QAAQ,GAAG;iBAW/B,YAAY,QAAQ,QAAQ,GAAG;;iBAoB/B,eAAe,GAAG;;iBAelB,kBAAkB,QAAQ,QAAQ,OAAO;cAY5C,4BAAQ;cACR,iCAAa;cACb,iCAAa;cACb,qCAAiB;cACjB,qCAAiB;;iBAGd,gCAAgC,QAAQ,QAAQ,QAAQ,qBAAqB;iBA4C7E,MAAM,GAAG,GAAG,KAAK,GAAG,MAAM;;iBAKpB,eAAe,GAAG,mBAAmB;iBAO3C,KAAK;iBAIL,SAAS,kBAAkB,GAAG,IAAI;iBAclC,WAAW;EAA8B;EAAe;;iBAWxD,EAAE;iBAIF,aAAa;;iBASb,oBAAoB,QAAQ,QAAQ,GAAG"}
@@ -0,0 +1,36 @@
1
+ import { Config } from "./config.mjs";
2
+ import { Table } from "./pgMetadata.mjs";
3
+ import { DatabaseColumnType, PrimitiveTypescriptType } from "./EntityDbMetadata.mjs";
4
+ //#region src/utils.d.ts
5
+ declare function assertNever(x: never): never;
6
+ declare function isEntityTable(config: Config, t: Table): boolean;
7
+ declare function isSubClassTable(t: Table): boolean;
8
+ declare function isEnumTable(config: Config, t: Table): boolean;
9
+ declare function isJoinTable(config: Config, t: Table): boolean;
10
+ /** Whether a join table has a surrogate `id` primary key (vs. an id-less FK-pair composite PK). */
11
+ declare function joinTableHasId(t: Table): boolean;
12
+ /** Converts `projects` to `Project`. */
13
+ declare function tableToEntityName(config: Config, table: Table): string;
14
+ declare const dateCode: import("ts-poet").Code;
15
+ declare const plainDateCode: import("ts-poet").Code;
16
+ declare const plainTimeCode: import("ts-poet").Code;
17
+ declare const plainDateTimeCode: import("ts-poet").Code;
18
+ declare const zonedDateTimeCode: import("ts-poet").Code;
19
+ /** Maps db types, i.e. `int`, to JS types, i.e. `number`. */
20
+ declare function mapSimpleDbTypeToTypescriptType(config: Config, dbType: DatabaseColumnType): PrimitiveTypescriptType;
21
+ declare function merge<T>(a: T[], b: T[]): T[];
22
+ /** Returns true if `p` is resolved, otherwise false if it is rejected. */
23
+ declare function trueIfResolved(p: Promise<unknown>): Promise<boolean>;
24
+ declare function fail(message?: string): never;
25
+ declare function sortKeys<T extends object>(o: T): T;
26
+ declare function parseOrder(order: string | undefined): {
27
+ field: string;
28
+ direction: "ASC" | "DESC";
29
+ } | undefined;
30
+ declare function q(s: string | undefined): string;
31
+ declare function uncapitalize(s: string): string;
32
+ /** Uses the same schema selection for metadata and test database cleanup. */
33
+ declare function shouldIncludeSchema(config: Config, t: Table): boolean;
34
+ //#endregion
35
+ export { assertNever, dateCode, fail, isEntityTable, isEnumTable, isJoinTable, isSubClassTable, joinTableHasId, mapSimpleDbTypeToTypescriptType, merge, parseOrder, plainDateCode, plainDateTimeCode, plainTimeCode, q, shouldIncludeSchema, sortKeys, tableToEntityName, trueIfResolved, uncapitalize, zonedDateTimeCode };
36
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";;;;iBASgB,YAAY;iBAIZ,cAAc,QAAQ,QAAQ,GAAG;iBA8BjC,gBAAgB,GAAG;iBAKnB,YAAY,QAAQ,QAAQ,GAAG;iBAW/B,YAAY,QAAQ,QAAQ,GAAG;;iBAoB/B,eAAe,GAAG;;iBAelB,kBAAkB,QAAQ,QAAQ,OAAO;cAY5C,4BAAQ;cACR,iCAAa;cACb,iCAAa;cACb,qCAAiB;cACjB,qCAAiB;;iBAGd,gCAAgC,QAAQ,QAAQ,QAAQ,qBAAqB;iBA4C7E,MAAM,GAAG,GAAG,KAAK,GAAG,MAAM;;iBAKpB,eAAe,GAAG,mBAAmB;iBAO3C,KAAK;iBAIL,SAAS,kBAAkB,GAAG,IAAI;iBAclC,WAAW;EAA8B;EAAe;;iBAWxD,EAAE;iBAIF,aAAa;;iBASb,oBAAoB,QAAQ,QAAQ,GAAG"}