@dbml/core 10.3.0-alpha.0 → 10.3.0-alpha.1

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 (374) hide show
  1. package/lib/export/DbmlExporter.cjs +13 -13
  2. package/lib/export/DbmlExporter.mjs +88 -84
  3. package/lib/export/MysqlExporter.cjs +8 -8
  4. package/lib/export/MysqlExporter.mjs +54 -50
  5. package/lib/export/OracleExporter.cjs +7 -7
  6. package/lib/export/OracleExporter.mjs +79 -74
  7. package/lib/export/PostgresExporter.cjs +9 -9
  8. package/lib/export/PostgresExporter.mjs +82 -78
  9. package/lib/export/SqlServerExporter.cjs +11 -11
  10. package/lib/export/SqlServerExporter.mjs +64 -60
  11. package/lib/model_structure/database.cjs +1 -1
  12. package/lib/model_structure/database.mjs +56 -53
  13. package/lib/model_structure/dep.cjs +1 -1
  14. package/lib/model_structure/dep.mjs +11 -9
  15. package/lib/model_structure/enum.cjs +1 -1
  16. package/lib/model_structure/enum.mjs +15 -13
  17. package/lib/model_structure/enumValue.cjs +1 -1
  18. package/lib/model_structure/enumValue.mjs +8 -6
  19. package/lib/model_structure/field.cjs +1 -1
  20. package/lib/model_structure/field.mjs +10 -8
  21. package/lib/model_structure/schema.cjs +1 -1
  22. package/lib/model_structure/schema.mjs +25 -23
  23. package/lib/model_structure/table.cjs +1 -1
  24. package/lib/model_structure/table.mjs +43 -40
  25. package/lib/model_structure/tableGroup.cjs +1 -1
  26. package/lib/model_structure/tableGroup.mjs +11 -9
  27. package/lib/model_structure/tablePartial.cjs +1 -1
  28. package/lib/model_structure/tablePartial.mjs +8 -6
  29. package/lib/node_modules/lodash-es/_DataView.cjs +1 -0
  30. package/lib/node_modules/lodash-es/_DataView.mjs +10 -0
  31. package/lib/node_modules/lodash-es/_Hash.cjs +1 -0
  32. package/lib/node_modules/lodash-es/_Hash.mjs +20 -0
  33. package/lib/node_modules/lodash-es/_ListCache.cjs +1 -0
  34. package/lib/node_modules/lodash-es/_ListCache.mjs +20 -0
  35. package/lib/node_modules/lodash-es/_Map.cjs +1 -0
  36. package/lib/node_modules/lodash-es/_Map.mjs +10 -0
  37. package/lib/node_modules/lodash-es/_MapCache.cjs +1 -0
  38. package/lib/node_modules/lodash-es/_MapCache.mjs +20 -0
  39. package/lib/node_modules/lodash-es/_Promise.cjs +1 -0
  40. package/lib/node_modules/lodash-es/_Promise.mjs +10 -0
  41. package/lib/node_modules/lodash-es/_Set.cjs +1 -0
  42. package/lib/node_modules/lodash-es/_Set.mjs +10 -0
  43. package/lib/node_modules/lodash-es/_SetCache.cjs +1 -0
  44. package/lib/node_modules/lodash-es/_SetCache.mjs +15 -0
  45. package/lib/node_modules/lodash-es/_Stack.cjs +1 -0
  46. package/lib/node_modules/lodash-es/_Stack.mjs +18 -0
  47. package/lib/node_modules/lodash-es/_Symbol.cjs +1 -0
  48. package/lib/node_modules/lodash-es/_Symbol.mjs +9 -0
  49. package/lib/node_modules/lodash-es/_Uint8Array.cjs +1 -0
  50. package/lib/node_modules/lodash-es/_Uint8Array.mjs +9 -0
  51. package/lib/node_modules/lodash-es/_WeakMap.cjs +1 -0
  52. package/lib/node_modules/lodash-es/_WeakMap.mjs +10 -0
  53. package/lib/node_modules/lodash-es/_arrayAggregator.cjs +1 -0
  54. package/lib/node_modules/lodash-es/_arrayAggregator.mjs +13 -0
  55. package/lib/node_modules/lodash-es/_arrayEach.cjs +1 -0
  56. package/lib/node_modules/lodash-es/_arrayEach.mjs +10 -0
  57. package/lib/node_modules/lodash-es/_arrayFilter.cjs +1 -0
  58. package/lib/node_modules/lodash-es/_arrayFilter.mjs +13 -0
  59. package/lib/node_modules/lodash-es/_arrayLikeKeys.cjs +1 -0
  60. package/lib/node_modules/lodash-es/_arrayLikeKeys.mjs +19 -0
  61. package/lib/node_modules/lodash-es/_arrayMap.cjs +1 -0
  62. package/lib/node_modules/lodash-es/_arrayMap.mjs +10 -0
  63. package/lib/node_modules/lodash-es/_arrayPush.cjs +1 -0
  64. package/lib/node_modules/lodash-es/_arrayPush.mjs +10 -0
  65. package/lib/node_modules/lodash-es/_arrayReduce.cjs +1 -0
  66. package/lib/node_modules/lodash-es/_arrayReduce.mjs +11 -0
  67. package/lib/node_modules/lodash-es/_arraySome.cjs +1 -0
  68. package/lib/node_modules/lodash-es/_arraySome.mjs +10 -0
  69. package/lib/node_modules/lodash-es/_asciiToArray.cjs +1 -0
  70. package/lib/node_modules/lodash-es/_asciiToArray.mjs +9 -0
  71. package/lib/node_modules/lodash-es/_assocIndexOf.cjs +1 -0
  72. package/lib/node_modules/lodash-es/_assocIndexOf.mjs +13 -0
  73. package/lib/node_modules/lodash-es/_baseAggregator.cjs +1 -0
  74. package/lib/node_modules/lodash-es/_baseAggregator.mjs +14 -0
  75. package/lib/node_modules/lodash-es/_baseAssignValue.cjs +1 -0
  76. package/lib/node_modules/lodash-es/_baseAssignValue.mjs +17 -0
  77. package/lib/node_modules/lodash-es/_baseEach.cjs +1 -0
  78. package/lib/node_modules/lodash-es/_baseEach.mjs +10 -0
  79. package/lib/node_modules/lodash-es/_baseFlatten.cjs +1 -0
  80. package/lib/node_modules/lodash-es/_baseFlatten.mjs +18 -0
  81. package/lib/node_modules/lodash-es/_baseFor.cjs +1 -0
  82. package/lib/node_modules/lodash-es/_baseFor.mjs +9 -0
  83. package/lib/node_modules/lodash-es/_baseForOwn.cjs +1 -0
  84. package/lib/node_modules/lodash-es/_baseForOwn.mjs +13 -0
  85. package/lib/node_modules/lodash-es/_baseGet.cjs +1 -0
  86. package/lib/node_modules/lodash-es/_baseGet.mjs +15 -0
  87. package/lib/node_modules/lodash-es/_baseGetAllKeys.cjs +1 -0
  88. package/lib/node_modules/lodash-es/_baseGetAllKeys.mjs +14 -0
  89. package/lib/node_modules/lodash-es/_baseGetTag.cjs +1 -0
  90. package/lib/node_modules/lodash-es/_baseGetTag.mjs +14 -0
  91. package/lib/node_modules/lodash-es/_baseHasIn.cjs +1 -0
  92. package/lib/node_modules/lodash-es/_baseHasIn.mjs +9 -0
  93. package/lib/node_modules/lodash-es/_baseIsArguments.cjs +1 -0
  94. package/lib/node_modules/lodash-es/_baseIsArguments.mjs +13 -0
  95. package/lib/node_modules/lodash-es/_baseIsEqual.cjs +1 -0
  96. package/lib/node_modules/lodash-es/_baseIsEqual.mjs +13 -0
  97. package/lib/node_modules/lodash-es/_baseIsEqualDeep.cjs +1 -0
  98. package/lib/node_modules/lodash-es/_baseIsEqualDeep.mjs +34 -0
  99. package/lib/node_modules/lodash-es/_baseIsMatch.cjs +1 -0
  100. package/lib/node_modules/lodash-es/_baseIsMatch.mjs +30 -0
  101. package/lib/node_modules/lodash-es/_baseIsNative.cjs +1 -0
  102. package/lib/node_modules/lodash-es/_baseIsNative.mjs +15 -0
  103. package/lib/node_modules/lodash-es/_baseIsTypedArray.cjs +1 -0
  104. package/lib/node_modules/lodash-es/_baseIsTypedArray.mjs +14 -0
  105. package/lib/node_modules/lodash-es/_baseIteratee.cjs +1 -0
  106. package/lib/node_modules/lodash-es/_baseIteratee.mjs +16 -0
  107. package/lib/node_modules/lodash-es/_baseKeys.cjs +1 -0
  108. package/lib/node_modules/lodash-es/_baseKeys.mjs +16 -0
  109. package/lib/node_modules/lodash-es/_baseMatches.cjs +1 -0
  110. package/lib/node_modules/lodash-es/_baseMatches.mjs +17 -0
  111. package/lib/node_modules/lodash-es/_baseMatchesProperty.cjs +1 -0
  112. package/lib/node_modules/lodash-es/_baseMatchesProperty.mjs +21 -0
  113. package/lib/node_modules/lodash-es/_baseNth.cjs +1 -0
  114. package/lib/node_modules/lodash-es/_baseNth.mjs +13 -0
  115. package/lib/node_modules/lodash-es/_baseProperty.cjs +1 -0
  116. package/lib/node_modules/lodash-es/_baseProperty.mjs +11 -0
  117. package/lib/node_modules/lodash-es/_basePropertyDeep.cjs +1 -0
  118. package/lib/node_modules/lodash-es/_basePropertyDeep.mjs +14 -0
  119. package/lib/node_modules/lodash-es/_baseReduce.cjs +1 -0
  120. package/lib/node_modules/lodash-es/_baseReduce.mjs +11 -0
  121. package/lib/node_modules/lodash-es/_baseSlice.cjs +1 -0
  122. package/lib/node_modules/lodash-es/_baseSlice.mjs +12 -0
  123. package/lib/node_modules/lodash-es/_baseTimes.cjs +1 -0
  124. package/lib/node_modules/lodash-es/_baseTimes.mjs +10 -0
  125. package/lib/node_modules/lodash-es/_baseToString.cjs +1 -0
  126. package/lib/node_modules/lodash-es/_baseToString.mjs +19 -0
  127. package/lib/node_modules/lodash-es/_baseTrim.cjs +1 -0
  128. package/lib/node_modules/lodash-es/_baseTrim.mjs +12 -0
  129. package/lib/node_modules/lodash-es/_baseUnary.cjs +1 -0
  130. package/lib/node_modules/lodash-es/_baseUnary.mjs +11 -0
  131. package/lib/node_modules/lodash-es/_cacheHas.cjs +1 -0
  132. package/lib/node_modules/lodash-es/_cacheHas.mjs +9 -0
  133. package/lib/node_modules/lodash-es/_castFunction.cjs +1 -0
  134. package/lib/node_modules/lodash-es/_castFunction.mjs +12 -0
  135. package/lib/node_modules/lodash-es/_castPath.cjs +1 -0
  136. package/lib/node_modules/lodash-es/_castPath.mjs +15 -0
  137. package/lib/node_modules/lodash-es/_castSlice.cjs +1 -0
  138. package/lib/node_modules/lodash-es/_castSlice.mjs +13 -0
  139. package/lib/node_modules/lodash-es/_copyArray.cjs +1 -0
  140. package/lib/node_modules/lodash-es/_copyArray.mjs +11 -0
  141. package/lib/node_modules/lodash-es/_coreJsData.cjs +1 -0
  142. package/lib/node_modules/lodash-es/_coreJsData.mjs +9 -0
  143. package/lib/node_modules/lodash-es/_createAggregator.cjs +1 -0
  144. package/lib/node_modules/lodash-es/_createAggregator.mjs +18 -0
  145. package/lib/node_modules/lodash-es/_createBaseEach.cjs +1 -0
  146. package/lib/node_modules/lodash-es/_createBaseEach.mjs +17 -0
  147. package/lib/node_modules/lodash-es/_createBaseFor.cjs +1 -0
  148. package/lib/node_modules/lodash-es/_createBaseFor.mjs +15 -0
  149. package/lib/node_modules/lodash-es/_createCaseFirst.cjs +1 -0
  150. package/lib/node_modules/lodash-es/_createCaseFirst.mjs +19 -0
  151. package/lib/node_modules/lodash-es/_defineProperty.cjs +1 -0
  152. package/lib/node_modules/lodash-es/_defineProperty.mjs +14 -0
  153. package/lib/node_modules/lodash-es/_equalArrays.cjs +1 -0
  154. package/lib/node_modules/lodash-es/_equalArrays.mjs +39 -0
  155. package/lib/node_modules/lodash-es/_equalByTag.cjs +1 -0
  156. package/lib/node_modules/lodash-es/_equalByTag.mjs +39 -0
  157. package/lib/node_modules/lodash-es/_equalObjects.cjs +1 -0
  158. package/lib/node_modules/lodash-es/_equalObjects.mjs +36 -0
  159. package/lib/node_modules/lodash-es/_freeGlobal.cjs +1 -0
  160. package/lib/node_modules/lodash-es/_freeGlobal.mjs +8 -0
  161. package/lib/node_modules/lodash-es/_getAllKeys.cjs +1 -0
  162. package/lib/node_modules/lodash-es/_getAllKeys.mjs +14 -0
  163. package/lib/node_modules/lodash-es/_getMapData.cjs +1 -0
  164. package/lib/node_modules/lodash-es/_getMapData.mjs +13 -0
  165. package/lib/node_modules/lodash-es/_getMatchData.cjs +1 -0
  166. package/lib/node_modules/lodash-es/_getMatchData.mjs +21 -0
  167. package/lib/node_modules/lodash-es/_getNative.cjs +1 -0
  168. package/lib/node_modules/lodash-es/_getNative.mjs +14 -0
  169. package/lib/node_modules/lodash-es/_getRawTag.cjs +1 -0
  170. package/lib/node_modules/lodash-es/_getRawTag.mjs +18 -0
  171. package/lib/node_modules/lodash-es/_getSymbols.cjs +1 -0
  172. package/lib/node_modules/lodash-es/_getSymbols.mjs +14 -0
  173. package/lib/node_modules/lodash-es/_getTag.cjs +1 -0
  174. package/lib/node_modules/lodash-es/_getTag.mjs +25 -0
  175. package/lib/node_modules/lodash-es/_getValue.cjs +1 -0
  176. package/lib/node_modules/lodash-es/_getValue.mjs +9 -0
  177. package/lib/node_modules/lodash-es/_hasPath.cjs +1 -0
  178. package/lib/node_modules/lodash-es/_hasPath.mjs +23 -0
  179. package/lib/node_modules/lodash-es/_hasUnicode.cjs +1 -0
  180. package/lib/node_modules/lodash-es/_hasUnicode.mjs +11 -0
  181. package/lib/node_modules/lodash-es/_hashClear.cjs +1 -0
  182. package/lib/node_modules/lodash-es/_hashClear.mjs +12 -0
  183. package/lib/node_modules/lodash-es/_hashDelete.cjs +1 -0
  184. package/lib/node_modules/lodash-es/_hashDelete.mjs +10 -0
  185. package/lib/node_modules/lodash-es/_hashGet.cjs +1 -0
  186. package/lib/node_modules/lodash-es/_hashGet.mjs +17 -0
  187. package/lib/node_modules/lodash-es/_hashHas.cjs +1 -0
  188. package/lib/node_modules/lodash-es/_hashHas.mjs +13 -0
  189. package/lib/node_modules/lodash-es/_hashSet.cjs +1 -0
  190. package/lib/node_modules/lodash-es/_hashSet.mjs +13 -0
  191. package/lib/node_modules/lodash-es/_isFlattenable.cjs +1 -0
  192. package/lib/node_modules/lodash-es/_isFlattenable.mjs +14 -0
  193. package/lib/node_modules/lodash-es/_isIndex.cjs +1 -0
  194. package/lib/node_modules/lodash-es/_isIndex.mjs +12 -0
  195. package/lib/node_modules/lodash-es/_isKey.cjs +1 -0
  196. package/lib/node_modules/lodash-es/_isKey.mjs +15 -0
  197. package/lib/node_modules/lodash-es/_isKeyable.cjs +1 -0
  198. package/lib/node_modules/lodash-es/_isKeyable.mjs +10 -0
  199. package/lib/node_modules/lodash-es/_isMasked.cjs +1 -0
  200. package/lib/node_modules/lodash-es/_isMasked.mjs +15 -0
  201. package/lib/node_modules/lodash-es/_isPrototype.cjs +1 -0
  202. package/lib/node_modules/lodash-es/_isPrototype.mjs +12 -0
  203. package/lib/node_modules/lodash-es/_isStrictComparable.cjs +1 -0
  204. package/lib/node_modules/lodash-es/_isStrictComparable.mjs +12 -0
  205. package/lib/node_modules/lodash-es/_listCacheClear.cjs +1 -0
  206. package/lib/node_modules/lodash-es/_listCacheClear.mjs +9 -0
  207. package/lib/node_modules/lodash-es/_listCacheDelete.cjs +1 -0
  208. package/lib/node_modules/lodash-es/_listCacheDelete.mjs +13 -0
  209. package/lib/node_modules/lodash-es/_listCacheGet.cjs +1 -0
  210. package/lib/node_modules/lodash-es/_listCacheGet.mjs +13 -0
  211. package/lib/node_modules/lodash-es/_listCacheHas.cjs +1 -0
  212. package/lib/node_modules/lodash-es/_listCacheHas.mjs +12 -0
  213. package/lib/node_modules/lodash-es/_listCacheSet.cjs +1 -0
  214. package/lib/node_modules/lodash-es/_listCacheSet.mjs +13 -0
  215. package/lib/node_modules/lodash-es/_mapCacheClear.cjs +1 -0
  216. package/lib/node_modules/lodash-es/_mapCacheClear.mjs +18 -0
  217. package/lib/node_modules/lodash-es/_mapCacheDelete.cjs +1 -0
  218. package/lib/node_modules/lodash-es/_mapCacheDelete.mjs +13 -0
  219. package/lib/node_modules/lodash-es/_mapCacheGet.cjs +1 -0
  220. package/lib/node_modules/lodash-es/_mapCacheGet.mjs +12 -0
  221. package/lib/node_modules/lodash-es/_mapCacheHas.cjs +1 -0
  222. package/lib/node_modules/lodash-es/_mapCacheHas.mjs +12 -0
  223. package/lib/node_modules/lodash-es/_mapCacheSet.cjs +1 -0
  224. package/lib/node_modules/lodash-es/_mapCacheSet.mjs +13 -0
  225. package/lib/node_modules/lodash-es/_mapToArray.cjs +1 -0
  226. package/lib/node_modules/lodash-es/_mapToArray.mjs +12 -0
  227. package/lib/node_modules/lodash-es/_matchesStrictComparable.cjs +1 -0
  228. package/lib/node_modules/lodash-es/_matchesStrictComparable.mjs +11 -0
  229. package/lib/node_modules/lodash-es/_memoizeCapped.cjs +1 -0
  230. package/lib/node_modules/lodash-es/_memoizeCapped.mjs +15 -0
  231. package/lib/node_modules/lodash-es/_nativeCreate.cjs +1 -0
  232. package/lib/node_modules/lodash-es/_nativeCreate.mjs +9 -0
  233. package/lib/node_modules/lodash-es/_nativeKeys.cjs +1 -0
  234. package/lib/node_modules/lodash-es/_nativeKeys.mjs +9 -0
  235. package/lib/node_modules/lodash-es/_nodeUtil.cjs +1 -0
  236. package/lib/node_modules/lodash-es/_nodeUtil.mjs +13 -0
  237. package/lib/node_modules/lodash-es/_objectToString.cjs +1 -0
  238. package/lib/node_modules/lodash-es/_objectToString.mjs +11 -0
  239. package/lib/node_modules/lodash-es/_overArg.cjs +1 -0
  240. package/lib/node_modules/lodash-es/_overArg.mjs +11 -0
  241. package/lib/node_modules/lodash-es/_root.cjs +1 -0
  242. package/lib/node_modules/lodash-es/_root.mjs +9 -0
  243. package/lib/node_modules/lodash-es/_setCacheAdd.cjs +1 -0
  244. package/lib/node_modules/lodash-es/_setCacheAdd.mjs +11 -0
  245. package/lib/node_modules/lodash-es/_setCacheHas.cjs +1 -0
  246. package/lib/node_modules/lodash-es/_setCacheHas.mjs +9 -0
  247. package/lib/node_modules/lodash-es/_setToArray.cjs +1 -0
  248. package/lib/node_modules/lodash-es/_setToArray.mjs +12 -0
  249. package/lib/node_modules/lodash-es/_stackClear.cjs +1 -0
  250. package/lib/node_modules/lodash-es/_stackClear.mjs +12 -0
  251. package/lib/node_modules/lodash-es/_stackDelete.cjs +1 -0
  252. package/lib/node_modules/lodash-es/_stackDelete.mjs +10 -0
  253. package/lib/node_modules/lodash-es/_stackGet.cjs +1 -0
  254. package/lib/node_modules/lodash-es/_stackGet.mjs +9 -0
  255. package/lib/node_modules/lodash-es/_stackHas.cjs +1 -0
  256. package/lib/node_modules/lodash-es/_stackHas.mjs +9 -0
  257. package/lib/node_modules/lodash-es/_stackSet.cjs +1 -0
  258. package/lib/node_modules/lodash-es/_stackSet.mjs +20 -0
  259. package/lib/node_modules/lodash-es/_stringToArray.cjs +1 -0
  260. package/lib/node_modules/lodash-es/_stringToArray.mjs +14 -0
  261. package/lib/node_modules/lodash-es/_stringToPath.cjs +1 -0
  262. package/lib/node_modules/lodash-es/_stringToPath.mjs +14 -0
  263. package/lib/node_modules/lodash-es/_toKey.cjs +1 -0
  264. package/lib/node_modules/lodash-es/_toKey.mjs +14 -0
  265. package/lib/node_modules/lodash-es/_toSource.cjs +1 -0
  266. package/lib/node_modules/lodash-es/_toSource.mjs +19 -0
  267. package/lib/node_modules/lodash-es/_trimmedEndIndex.cjs +1 -0
  268. package/lib/node_modules/lodash-es/_trimmedEndIndex.mjs +12 -0
  269. package/lib/node_modules/lodash-es/_unicodeToArray.cjs +1 -0
  270. package/lib/node_modules/lodash-es/_unicodeToArray.mjs +21 -0
  271. package/lib/node_modules/lodash-es/capitalize.cjs +1 -0
  272. package/lib/node_modules/lodash-es/capitalize.mjs +13 -0
  273. package/lib/node_modules/lodash-es/concat.cjs +1 -0
  274. package/lib/node_modules/lodash-es/concat.mjs +18 -0
  275. package/lib/node_modules/lodash-es/eq.cjs +1 -0
  276. package/lib/node_modules/lodash-es/eq.mjs +9 -0
  277. package/lib/node_modules/lodash-es/first.cjs +1 -0
  278. package/lib/node_modules/lodash-es/first.mjs +9 -0
  279. package/lib/node_modules/lodash-es/flatten.cjs +1 -0
  280. package/lib/node_modules/lodash-es/flatten.mjs +12 -0
  281. package/lib/node_modules/lodash-es/flattenDeep.cjs +1 -0
  282. package/lib/node_modules/lodash-es/flattenDeep.mjs +12 -0
  283. package/lib/node_modules/lodash-es/flattenDepth.cjs +1 -0
  284. package/lib/node_modules/lodash-es/flattenDepth.mjs +13 -0
  285. package/lib/node_modules/lodash-es/forEach.cjs +1 -0
  286. package/lib/node_modules/lodash-es/forEach.mjs +15 -0
  287. package/lib/node_modules/lodash-es/get.cjs +1 -0
  288. package/lib/node_modules/lodash-es/get.mjs +13 -0
  289. package/lib/node_modules/lodash-es/groupBy.cjs +1 -0
  290. package/lib/node_modules/lodash-es/groupBy.mjs +12 -0
  291. package/lib/node_modules/lodash-es/hasIn.cjs +1 -0
  292. package/lib/node_modules/lodash-es/hasIn.mjs +13 -0
  293. package/lib/node_modules/lodash-es/head.cjs +1 -0
  294. package/lib/node_modules/lodash-es/head.mjs +9 -0
  295. package/lib/node_modules/lodash-es/identity.cjs +1 -0
  296. package/lib/node_modules/lodash-es/identity.mjs +9 -0
  297. package/lib/node_modules/lodash-es/isArguments.cjs +1 -0
  298. package/lib/node_modules/lodash-es/isArguments.mjs +14 -0
  299. package/lib/node_modules/lodash-es/isArray.cjs +1 -0
  300. package/lib/node_modules/lodash-es/isArray.mjs +8 -0
  301. package/lib/node_modules/lodash-es/isArrayLike.cjs +1 -0
  302. package/lib/node_modules/lodash-es/isArrayLike.mjs +13 -0
  303. package/lib/node_modules/lodash-es/isBuffer.cjs +1 -0
  304. package/lib/node_modules/lodash-es/isBuffer.mjs +10 -0
  305. package/lib/node_modules/lodash-es/isEmpty.cjs +1 -0
  306. package/lib/node_modules/lodash-es/isEmpty.mjs +25 -0
  307. package/lib/node_modules/lodash-es/isFunction.cjs +1 -0
  308. package/lib/node_modules/lodash-es/isFunction.mjs +15 -0
  309. package/lib/node_modules/lodash-es/isLength.cjs +1 -0
  310. package/lib/node_modules/lodash-es/isLength.mjs +11 -0
  311. package/lib/node_modules/lodash-es/isNil.cjs +1 -0
  312. package/lib/node_modules/lodash-es/isNil.mjs +9 -0
  313. package/lib/node_modules/lodash-es/isObject.cjs +1 -0
  314. package/lib/node_modules/lodash-es/isObject.mjs +10 -0
  315. package/lib/node_modules/lodash-es/isObjectLike.cjs +1 -0
  316. package/lib/node_modules/lodash-es/isObjectLike.mjs +9 -0
  317. package/lib/node_modules/lodash-es/isSymbol.cjs +1 -0
  318. package/lib/node_modules/lodash-es/isSymbol.mjs +13 -0
  319. package/lib/node_modules/lodash-es/isTypedArray.cjs +1 -0
  320. package/lib/node_modules/lodash-es/isTypedArray.mjs +11 -0
  321. package/lib/node_modules/lodash-es/keys.cjs +1 -0
  322. package/lib/node_modules/lodash-es/keys.mjs +14 -0
  323. package/lib/node_modules/lodash-es/last.cjs +1 -0
  324. package/lib/node_modules/lodash-es/last.mjs +10 -0
  325. package/lib/node_modules/lodash-es/lodash.cjs +1 -0
  326. package/lib/node_modules/lodash-es/lodash.mjs +46 -0
  327. package/lib/node_modules/lodash-es/memoize.cjs +1 -0
  328. package/lib/node_modules/lodash-es/memoize.mjs +19 -0
  329. package/lib/node_modules/lodash-es/nth.cjs +1 -0
  330. package/lib/node_modules/lodash-es/nth.mjs +13 -0
  331. package/lib/node_modules/lodash-es/property.cjs +1 -0
  332. package/lib/node_modules/lodash-es/property.mjs +15 -0
  333. package/lib/node_modules/lodash-es/reduce.cjs +1 -0
  334. package/lib/node_modules/lodash-es/reduce.mjs +17 -0
  335. package/lib/node_modules/lodash-es/stubArray.cjs +1 -0
  336. package/lib/node_modules/lodash-es/stubArray.mjs +9 -0
  337. package/lib/node_modules/lodash-es/stubFalse.cjs +1 -0
  338. package/lib/node_modules/lodash-es/stubFalse.mjs +9 -0
  339. package/lib/node_modules/lodash-es/toFinite.cjs +1 -0
  340. package/lib/node_modules/lodash-es/toFinite.mjs +12 -0
  341. package/lib/node_modules/lodash-es/toInteger.cjs +1 -0
  342. package/lib/node_modules/lodash-es/toInteger.mjs +13 -0
  343. package/lib/node_modules/lodash-es/toNumber.cjs +1 -0
  344. package/lib/node_modules/lodash-es/toNumber.mjs +23 -0
  345. package/lib/node_modules/lodash-es/toString.cjs +1 -0
  346. package/lib/node_modules/lodash-es/toString.mjs +12 -0
  347. package/lib/node_modules/lodash-es/upperFirst.cjs +1 -0
  348. package/lib/node_modules/lodash-es/upperFirst.mjs +9 -0
  349. package/lib/packages/dbml-core/package.json.cjs +1 -0
  350. package/lib/{package.json.mjs → packages/dbml-core/package.json.mjs} +1 -1
  351. package/lib/parse/ANTLR/ASTGeneration/helpers.cjs +1 -1
  352. package/lib/parse/ANTLR/ASTGeneration/helpers.mjs +5 -3
  353. package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.cjs +1 -1
  354. package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.mjs +149 -143
  355. package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.cjs +1 -1
  356. package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.mjs +146 -142
  357. package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.cjs +1 -1
  358. package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.mjs +184 -181
  359. package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.cjs +1 -1
  360. package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.mjs +149 -145
  361. package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.cjs +1 -1
  362. package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.mjs +89 -85
  363. package/lib/parse/deprecated/mssql/column_definition/actions.cjs +1 -1
  364. package/lib/parse/deprecated/mssql/column_definition/actions.mjs +9 -6
  365. package/lib/parse/deprecated/mssql/expression.cjs +1 -1
  366. package/lib/parse/deprecated/mssql/expression.mjs +26 -25
  367. package/lib/parse/deprecated/mssql/statements/actions.cjs +1 -1
  368. package/lib/parse/deprecated/mssql/statements/actions.mjs +36 -33
  369. package/lib/parse/deprecated/mssql/utils.cjs +1 -1
  370. package/lib/parse/deprecated/mssql/utils.mjs +23 -22
  371. package/lib/utils/version.cjs +1 -1
  372. package/lib/utils/version.mjs +1 -1
  373. package/package.json +2 -2
  374. package/lib/package.json.cjs +0 -1
@@ -1,25 +1,28 @@
1
- import { DEFAULT_SCHEMA_NAME as e, ENUM as t, NOTE as n, TABLE as r, TABLE_GROUP as i } from "./config.mjs";
2
- import a from "./dbState.mjs";
3
- import o from "./element.mjs";
4
- import s from "./dep.mjs";
5
- import c from "./enum.mjs";
6
- import l from "./ref.mjs";
7
- import u from "./table.mjs";
8
- import d from "./tableGroup.mjs";
9
- import f from "./schema.mjs";
10
- import p from "./stickyNote.mjs";
11
- import m from "./tablePartial.mjs";
12
- import { capitalize as h, get as g } from "lodash-es";
13
- import { makeCardinalityRequired as _, parseCardinality as v } from "@dbml/parse";
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import t from "../node_modules/lodash-es/capitalize.mjs";
3
+ import { init_lodash as n } from "../node_modules/lodash-es/lodash.mjs";
4
+ import { DEFAULT_SCHEMA_NAME as r, ENUM as i, NOTE as a, TABLE as o, TABLE_GROUP as s } from "./config.mjs";
5
+ import c from "./dbState.mjs";
6
+ import l from "./element.mjs";
7
+ import u from "./dep.mjs";
8
+ import d from "./enum.mjs";
9
+ import f from "./ref.mjs";
10
+ import p from "./table.mjs";
11
+ import m from "./tableGroup.mjs";
12
+ import h from "./schema.mjs";
13
+ import g from "./stickyNote.mjs";
14
+ import _ from "./tablePartial.mjs";
15
+ import { makeCardinalityRequired as v, parseCardinality as y } from "@dbml/parse";
14
16
  //#region src/model_structure/database.ts
15
- var y = class extends o {
16
- constructor({ schemas: o = [], tables: s = [], notes: c = [], enums: u = [], refs: d = [], deps: f = [], tableGroups: p = [], project: m = {}, aliases: h = [], records: _ = [], tablePartials: v = [], diagramViews: y = [] } = {}) {
17
- super(), this.dbState = new a(), this.generateId(), this.hasDefaultSchema = !1, this.schemas = [], this.notes = [], this.note = m.note ? g(m, "note.value", typeof m.note == "string" ? m.note : null) : null, this.noteToken = m.note ? g(m, "note.token", m.noteToken) : null, this.databaseType = m.database_type, this.name = m.name, this.token = m.token, this.aliases = h, this.records = [], this.tablePartials = [], this.diagramViews = y, this.injectedRawRefs = [], this.processNotes(c), this.processRecords(_), this.processTablePartials(v), this.processSchemas(o), this.processSchemaElements(u, t), this.processSchemaElements(s, r), this.linkRecordsToTables(), this.processSchemaElements(c, n), this.processSchemaElements(d, "ref"), this.processSchemaElements(f, "dep"), this.processSchemaElements(p, i), this.injectedRawRefs.forEach((t) => {
18
- let n = this.findOrCreateSchema(e), r = new l({
19
- ...t,
20
- schema: n
17
+ n();
18
+ var b = class extends l {
19
+ constructor({ schemas: t = [], tables: n = [], notes: l = [], enums: u = [], refs: d = [], deps: p = [], tableGroups: m = [], project: h = {}, aliases: g = [], records: _ = [], tablePartials: v = [], diagramViews: y = [] } = {}) {
20
+ super(), this.dbState = new c(), this.generateId(), this.hasDefaultSchema = !1, this.schemas = [], this.notes = [], this.note = h.note ? e(h, "note.value", typeof h.note == "string" ? h.note : null) : null, this.noteToken = h.note ? e(h, "note.token", h.noteToken) : null, this.databaseType = h.database_type, this.name = h.name, this.token = h.token, this.aliases = g, this.records = [], this.tablePartials = [], this.diagramViews = y, this.injectedRawRefs = [], this.processNotes(l), this.processRecords(_), this.processTablePartials(v), this.processSchemas(t), this.processSchemaElements(u, i), this.processSchemaElements(n, o), this.linkRecordsToTables(), this.processSchemaElements(l, a), this.processSchemaElements(d, "ref"), this.processSchemaElements(p, "dep"), this.processSchemaElements(m, s), this.injectedRawRefs.forEach((e) => {
21
+ let t = this.findOrCreateSchema(r), n = new f({
22
+ ...e,
23
+ schema: t
21
24
  });
22
- n.refs.some((e) => e.equals(r)) || n.pushRef(r);
25
+ t.refs.some((e) => e.equals(n)) || t.pushRef(n);
23
26
  });
24
27
  }
25
28
  generateId() {
@@ -27,7 +30,7 @@ var y = class extends o {
27
30
  }
28
31
  processNotes(e) {
29
32
  e.forEach((e) => {
30
- this.pushNote(new p({
33
+ this.pushNote(new g({
31
34
  ...e,
32
35
  database: this
33
36
  }));
@@ -48,7 +51,7 @@ var y = class extends o {
48
51
  }
49
52
  processTablePartials(e) {
50
53
  e.forEach((e) => {
51
- this.tablePartials.push(new m({
54
+ this.tablePartials.push(new _({
52
55
  ...e,
53
56
  dbState: this.dbState
54
57
  }));
@@ -62,7 +65,7 @@ var y = class extends o {
62
65
  }
63
66
  processSchemas(e) {
64
67
  e.forEach((e) => {
65
- this.pushSchema(new f({
68
+ this.pushSchema(new h({
66
69
  ...e,
67
70
  database: this
68
71
  }));
@@ -74,38 +77,38 @@ var y = class extends o {
74
77
  checkSchema(e) {
75
78
  this.schemas.some((t) => t.name === e.name) && e.error(`Schemas ${e.name} existed`);
76
79
  }
77
- processSchemaElements(n, a) {
78
- let o;
79
- n.forEach((n) => {
80
- switch (n.schemaName ? (o = this.findOrCreateSchema(n.schemaName), n.schemaName) : o = this.findOrCreateSchema(e), a) {
81
- case r:
82
- o.pushTable(new u({
83
- ...n,
84
- schema: o
80
+ processSchemaElements(e, t) {
81
+ let n;
82
+ e.forEach((e) => {
83
+ switch (e.schemaName ? (n = this.findOrCreateSchema(e.schemaName), e.schemaName) : n = this.findOrCreateSchema(r), t) {
84
+ case o:
85
+ n.pushTable(new p({
86
+ ...e,
87
+ schema: n
85
88
  }));
86
89
  break;
87
- case t:
88
- o.pushEnum(new c({
89
- ...n,
90
- schema: o
90
+ case i:
91
+ n.pushEnum(new d({
92
+ ...e,
93
+ schema: n
91
94
  }));
92
95
  break;
93
- case i:
94
- o.pushTableGroup(new d({
95
- ...n,
96
- schema: o
96
+ case s:
97
+ n.pushTableGroup(new m({
98
+ ...e,
99
+ schema: n
97
100
  }));
98
101
  break;
99
102
  case "ref":
100
- o.pushRef(new l({
101
- ...n,
102
- schema: o
103
+ n.pushRef(new f({
104
+ ...e,
105
+ schema: n
103
106
  }));
104
107
  break;
105
108
  case "dep":
106
- o.pushDep(new s({
107
- ...n,
108
- schema: o
109
+ n.pushDep(new u({
110
+ ...e,
111
+ schema: n
109
112
  }));
110
113
  break;
111
114
  default: break;
@@ -123,11 +126,11 @@ var y = class extends o {
123
126
  n && (t.tableId = n.id, n.records.push(t));
124
127
  });
125
128
  }
126
- findOrCreateSchema(t) {
127
- let n = this.schemas.find((e) => e.name === t || e.alias === t);
128
- return n || (n = new f({
129
- name: t,
130
- note: { value: t === "public" ? `Default ${h(e)} Schema` : null },
129
+ findOrCreateSchema(e) {
130
+ let n = this.schemas.find((t) => t.name === e || t.alias === e);
131
+ return n || (n = new h({
132
+ name: e,
133
+ note: { value: e === "public" ? `Default ${t(r)} Schema` : null },
131
134
  database: this
132
135
  }), this.pushSchema(n)), n;
133
136
  }
@@ -155,10 +158,10 @@ var y = class extends o {
155
158
  adjustCardinalitiesFromColumns() {
156
159
  this.schemas.forEach((e) => {
157
160
  e.refs.forEach((e) => {
158
- let t = e.endpoints.find((e) => v(e.relation).max === "*"), n = e.endpoints.find((e) => v(e.relation).max === 1);
161
+ let t = e.endpoints.find((e) => y(e.relation).max === "*"), n = e.endpoints.find((e) => y(e.relation).max === 1);
159
162
  if (!n) return;
160
163
  let r, i;
161
- t ? (r = t, i = n) : (r = e.endpoints[1], i = e.endpoints[0]), !(!r || !i) && r.fields.every((e) => e.not_null || e.pk || e.increment) && (i.relation = _(i.relation));
164
+ t ? (r = t, i = n) : (r = e.endpoints[1], i = e.endpoints[0]), !(!r || !i) && r.fields.every((e) => e.not_null || e.pk || e.increment) && (i.relation = v(i.relation));
162
165
  });
163
166
  });
164
167
  }
@@ -216,4 +219,4 @@ var y = class extends o {
216
219
  }
217
220
  };
218
221
  //#endregion
219
- export { y as default };
222
+ export { b as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./element.cjs"),t=require("./depEdge.cjs");let n=require("lodash-es");var r=class extends e.default{constructor({name:e,color:t,note:r,metadata:i,edges:a,token:o,schema:s={}}){super(o),this.name=e??null,this.color=t,this.note=r?(0,n.get)(r,`value`,r):null,this.noteToken=r?(0,n.get)(r,`token`,null):null,this.metadata=i??null,this.edges=[],this.schema=s,this.dbState=this.schema.dbState,this.generateId(),this.processEdges(a??[])}generateId(){this.id=this.dbState.generateId(`depId`)}processEdges(e){e.forEach(e=>{let n=e.upstream?.schemaName||`public`,r=e.downstream?.schemaName||`public`,i=e.upstream?.tableName,a=e.downstream?.tableName,o=e.upstream?.fieldNames?.join(`,`),s=e.downstream?.fieldNames?.join(`,`);n===r&&i===a&&o===s&&o&&this.error(`Self-loop Dep edge not allowed: "${n}"."${i}" columns cannot depend on itself`),this.edges.push(new t.default({...e,dep:this}))})}export(){return{...this.shallowExport(),...this.exportChild()}}shallowExport(){return{name:this.name,color:this.color,note:this.note,metadata:this.metadata}}exportChild(){return{edges:this.edges.map(e=>e.export())}}exportChildIds(){return{edgeIds:this.edges.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id}}normalize(e){e.deps[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.edges.forEach(t=>t.normalize(e))}};exports.default=r;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs");require("./config.cjs");const n=require("./element.cjs"),r=require("./depEdge.cjs");t.init_lodash();var i=class extends n.default{constructor({name:t,color:n,note:r,metadata:i,edges:a,token:o,schema:s={}}){super(o),this.name=t??null,this.color=n,this.note=r?e.default(r,`value`,r):null,this.noteToken=r?e.default(r,`token`,null):null,this.metadata=i??null,this.edges=[],this.schema=s,this.dbState=this.schema.dbState,this.generateId(),this.processEdges(a??[])}generateId(){this.id=this.dbState.generateId(`depId`)}processEdges(e){e.forEach(e=>{let t=e.upstream?.schemaName||`public`,n=e.downstream?.schemaName||`public`,i=e.upstream?.tableName,a=e.downstream?.tableName,o=e.upstream?.fieldNames?.join(`,`),s=e.downstream?.fieldNames?.join(`,`);t===n&&i===a&&o===s&&o&&this.error(`Self-loop Dep edge not allowed: "${t}"."${i}" columns cannot depend on itself`),this.edges.push(new r.default({...e,dep:this}))})}export(){return{...this.shallowExport(),...this.exportChild()}}shallowExport(){return{name:this.name,color:this.color,note:this.note,metadata:this.metadata}}exportChild(){return{edges:this.edges.map(e=>e.export())}}exportChildIds(){return{edgeIds:this.edges.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id}}normalize(e){e.deps[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.edges.forEach(t=>t.normalize(e))}};exports.default=i;
@@ -1,19 +1,21 @@
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
1
3
  import "./config.mjs";
2
- import e from "./element.mjs";
3
- import t from "./depEdge.mjs";
4
- import { get as n } from "lodash-es";
4
+ import n from "./element.mjs";
5
+ import r from "./depEdge.mjs";
5
6
  //#region src/model_structure/dep.ts
6
- var r = class extends e {
7
- constructor({ name: e, color: t, note: r, metadata: i, edges: a, token: o, schema: s = {} }) {
8
- super(o), this.name = e ?? null, this.color = t, this.note = r ? n(r, "value", r) : null, this.noteToken = r ? n(r, "token", null) : null, this.metadata = i ?? null, this.edges = [], this.schema = s, this.dbState = this.schema.dbState, this.generateId(), this.processEdges(a ?? []);
7
+ t();
8
+ var i = class extends n {
9
+ constructor({ name: t, color: n, note: r, metadata: i, edges: a, token: o, schema: s = {} }) {
10
+ super(o), this.name = t ?? null, this.color = n, this.note = r ? e(r, "value", r) : null, this.noteToken = r ? e(r, "token", null) : null, this.metadata = i ?? null, this.edges = [], this.schema = s, this.dbState = this.schema.dbState, this.generateId(), this.processEdges(a ?? []);
9
11
  }
10
12
  generateId() {
11
13
  this.id = this.dbState.generateId("depId");
12
14
  }
13
15
  processEdges(e) {
14
16
  e.forEach((e) => {
15
- let n = e.upstream?.schemaName || "public", r = e.downstream?.schemaName || "public", i = e.upstream?.tableName, a = e.downstream?.tableName, o = e.upstream?.fieldNames?.join(","), s = e.downstream?.fieldNames?.join(",");
16
- n === r && i === a && o === s && o && this.error(`Self-loop Dep edge not allowed: "${n}"."${i}" columns cannot depend on itself`), this.edges.push(new t({
17
+ let t = e.upstream?.schemaName || "public", n = e.downstream?.schemaName || "public", i = e.upstream?.tableName, a = e.downstream?.tableName, o = e.upstream?.fieldNames?.join(","), s = e.downstream?.fieldNames?.join(",");
18
+ t === n && i === a && o === s && o && this.error(`Self-loop Dep edge not allowed: "${t}"."${i}" columns cannot depend on itself`), this.edges.push(new r({
17
19
  ...e,
18
20
  dep: this
19
21
  }));
@@ -52,4 +54,4 @@ var r = class extends e {
52
54
  }
53
55
  };
54
56
  //#endregion
55
- export { r as default };
57
+ export { i as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs");const e=require("./utils.cjs"),t=require("./element.cjs"),n=require("./enumValue.cjs");let r=require("lodash-es");var i=class extends t.default{constructor({name:e,token:t,values:n,note:i,schema:a,noteToken:o=null}={}){super(t),e||this.error(`Enum must have a name`),this.name=e,this.note=i?(0,r.get)(i,`value`,i):null,this.noteToken=i?(0,r.get)(i,`token`,o):null,this.values=[],this.fields=[],this.schema=a,this.dbState=this.schema.dbState,this.generateId(),this.processValues(n)}generateId(){this.id=this.dbState.generateId(`enumId`)}processValues(e){e.forEach(e=>{this.pushValue(new n.default({...e,_enum:this}))})}pushValue(e){this.checkValue(e),this.values.push(e)}checkValue(t){this.values.some(e=>e.name===t.name)&&t.error(`Enum value "${t.name}" existed in enum ${e.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)}pushField(e){this.checkField(e),this.fields.push(e)}checkField(t){this.fields.some(e=>e.id===t.id)&&this.error(`Field ${e.shouldPrintSchema(t.table.schema)?`"${t.table.schema.name}".`:``}"${t.table.name}"."${t.name}" already associated with enum ${e.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}${this.name}"`)}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{values:this.values.map(e=>e.export())}}exportChildIds(){return{valueIds:this.values.map(e=>e.id),fieldIds:this.fields.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id}}shallowExport(){return{name:this.name,note:this.note}}normalize(e){e.enums[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.values.forEach(t=>t.normalize(e))}};exports.default=i;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs"),n=require("./utils.cjs"),r=require("./element.cjs"),i=require("./enumValue.cjs");t.init_lodash();var a=class extends r.default{constructor({name:t,token:n,values:r,note:i,schema:a,noteToken:o=null}={}){super(n),t||this.error(`Enum must have a name`),this.name=t,this.note=i?e.default(i,`value`,i):null,this.noteToken=i?e.default(i,`token`,o):null,this.values=[],this.fields=[],this.schema=a,this.dbState=this.schema.dbState,this.generateId(),this.processValues(r)}generateId(){this.id=this.dbState.generateId(`enumId`)}processValues(e){e.forEach(e=>{this.pushValue(new i.default({...e,_enum:this}))})}pushValue(e){this.checkValue(e),this.values.push(e)}checkValue(e){this.values.some(t=>t.name===e.name)&&e.error(`Enum value "${e.name}" existed in enum ${n.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)}pushField(e){this.checkField(e),this.fields.push(e)}checkField(e){this.fields.some(t=>t.id===e.id)&&this.error(`Field ${n.shouldPrintSchema(e.table.schema)?`"${e.table.schema.name}".`:``}"${e.table.name}"."${e.name}" already associated with enum ${n.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}${this.name}"`)}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{values:this.values.map(e=>e.export())}}exportChildIds(){return{valueIds:this.values.map(e=>e.id),fieldIds:this.fields.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id}}shallowExport(){return{name:this.name,note:this.note}}normalize(e){e.enums[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.values.forEach(t=>t.normalize(e))}};exports.default=a;
@@ -1,18 +1,20 @@
1
- import { shouldPrintSchema as e } from "./utils.mjs";
2
- import t from "./element.mjs";
3
- import n from "./enumValue.mjs";
4
- import { get as r } from "lodash-es";
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
+ import { shouldPrintSchema as n } from "./utils.mjs";
4
+ import r from "./element.mjs";
5
+ import i from "./enumValue.mjs";
5
6
  //#region src/model_structure/enum.js
6
- var i = class extends t {
7
- constructor({ name: e, token: t, values: n, note: i, schema: a, noteToken: o = null } = {}) {
8
- super(t), e || this.error("Enum must have a name"), this.name = e, this.note = i ? r(i, "value", i) : null, this.noteToken = i ? r(i, "token", o) : null, this.values = [], this.fields = [], this.schema = a, this.dbState = this.schema.dbState, this.generateId(), this.processValues(n);
7
+ t();
8
+ var a = class extends r {
9
+ constructor({ name: t, token: n, values: r, note: i, schema: a, noteToken: o = null } = {}) {
10
+ super(n), t || this.error("Enum must have a name"), this.name = t, this.note = i ? e(i, "value", i) : null, this.noteToken = i ? e(i, "token", o) : null, this.values = [], this.fields = [], this.schema = a, this.dbState = this.schema.dbState, this.generateId(), this.processValues(r);
9
11
  }
10
12
  generateId() {
11
13
  this.id = this.dbState.generateId("enumId");
12
14
  }
13
15
  processValues(e) {
14
16
  e.forEach((e) => {
15
- this.pushValue(new n({
17
+ this.pushValue(new i({
16
18
  ...e,
17
19
  _enum: this
18
20
  }));
@@ -21,14 +23,14 @@ var i = class extends t {
21
23
  pushValue(e) {
22
24
  this.checkValue(e), this.values.push(e);
23
25
  }
24
- checkValue(t) {
25
- this.values.some((e) => e.name === t.name) && t.error(`Enum value "${t.name}" existed in enum ${e(this.schema) ? `"${this.schema.name}".` : ""}"${this.name}"`);
26
+ checkValue(e) {
27
+ this.values.some((t) => t.name === e.name) && e.error(`Enum value "${e.name}" existed in enum ${n(this.schema) ? `"${this.schema.name}".` : ""}"${this.name}"`);
26
28
  }
27
29
  pushField(e) {
28
30
  this.checkField(e), this.fields.push(e);
29
31
  }
30
- checkField(t) {
31
- this.fields.some((e) => e.id === t.id) && this.error(`Field ${e(t.table.schema) ? `"${t.table.schema.name}".` : ""}"${t.table.name}"."${t.name}" already associated with enum ${e(this.schema) ? `"${this.schema.name}".` : ""}${this.name}"`);
32
+ checkField(e) {
33
+ this.fields.some((t) => t.id === e.id) && this.error(`Field ${n(e.table.schema) ? `"${e.table.schema.name}".` : ""}"${e.table.name}"."${e.name}" already associated with enum ${n(this.schema) ? `"${this.schema.name}".` : ""}${this.name}"`);
32
34
  }
33
35
  export() {
34
36
  return {
@@ -64,4 +66,4 @@ var i = class extends t {
64
66
  }
65
67
  };
66
68
  //#endregion
67
- export { i as default };
69
+ export { a as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs");const e=require("./element.cjs");let t=require("lodash-es");var n=class extends e.default{constructor({name:e,token:n,note:r,_enum:i,noteToken:a=null}={}){super(n),e||this.error(`Enum value must have a name`),this.name=e,this.note=r?(0,t.get)(r,`value`,r):null,this.noteToken=r?(0,t.get)(r,`token`,a):null,this._enum=i,this.dbState=this._enum.dbState,this.generateId()}generateId(){this.id=this.dbState.generateId(`enumValueId`)}export(){return{...this.shallowExport()}}exportParentIds(){return{enumId:this._enum.id}}shallowExport(){return{name:this.name,note:this.note}}normalize(e){e.enumValues[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=n;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs"),n=require("./element.cjs");t.init_lodash();var r=class extends n.default{constructor({name:t,token:n,note:r,_enum:i,noteToken:a=null}={}){super(n),t||this.error(`Enum value must have a name`),this.name=t,this.note=r?e.default(r,`value`,r):null,this.noteToken=r?e.default(r,`token`,a):null,this._enum=i,this.dbState=this._enum.dbState,this.generateId()}generateId(){this.id=this.dbState.generateId(`enumValueId`)}export(){return{...this.shallowExport()}}exportParentIds(){return{enumId:this._enum.id}}shallowExport(){return{name:this.name,note:this.note}}normalize(e){e.enumValues[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=r;
@@ -1,9 +1,11 @@
1
- import e from "./element.mjs";
2
- import { get as t } from "lodash-es";
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
+ import n from "./element.mjs";
3
4
  //#region src/model_structure/enumValue.js
4
- var n = class extends e {
5
- constructor({ name: e, token: n, note: r, _enum: i, noteToken: a = null } = {}) {
6
- super(n), e || this.error("Enum value must have a name"), this.name = e, this.note = r ? t(r, "value", r) : null, this.noteToken = r ? t(r, "token", a) : null, this._enum = i, this.dbState = this._enum.dbState, this.generateId();
5
+ t();
6
+ var r = class extends n {
7
+ constructor({ name: t, token: n, note: r, _enum: i, noteToken: a = null } = {}) {
8
+ super(n), t || this.error("Enum value must have a name"), this.name = t, this.note = r ? e(r, "value", r) : null, this.noteToken = r ? e(r, "token", a) : null, this._enum = i, this.dbState = this._enum.dbState, this.generateId();
7
9
  }
8
10
  generateId() {
9
11
  this.id = this.dbState.generateId("enumValueId");
@@ -29,4 +31,4 @@ var n = class extends e {
29
31
  }
30
32
  };
31
33
  //#endregion
32
- export { n as default };
34
+ export { r as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./element.cjs"),t=require("./check.cjs");let n=require("lodash-es");var r=class extends e.default{constructor({name:e,type:t,unique:r,pk:i,token:a,not_null:o,note:s,dbdefault:c,increment:l,checks:u=[],table:d={},noteToken:f=null,injectedPartial:p=null,injectedToken:m=null,metadata:h={}}){super(a),e||this.error(`Field must have a name`),t||this.error(`Field must have a type`),this.name=e,this.type=t,this.unique=r,this.pk=i,this.not_null=o,this.note=s?(0,n.get)(s,`value`,s):null,this.noteToken=s?(0,n.get)(s,`token`,f):null,this.dbdefault=c,this.increment=l,this.checks=[],this.endpoints=[],this.depEdges=[],this.table=d,this.injectedPartial=p,this.injectedToken=m,this.dbState=this.table.dbState,this.metadata=h,this.generateId(),this.bindType(),this.processChecks(u)}generateId(){this.id=this.dbState.generateId(`fieldId`)}bindType(){let e=this.type.type_name,t=this.type.schemaName||`public`;if(this.type.schemaName){let n=this.table.schema.database.findEnum(t,e);if(!n){this.type.type_name=`${t}.${e}`,this.type.originalTypeName=e;return}this._enum=n,n.pushField(this)}else{let n=this.table.schema.database.findEnum(t,e);if(!n)return;this._enum=n,n.pushField(this)}}pushEndpoint(e){this.endpoints.push(e)}pushDepEdge(e){this.depEdges.push(e)}export(){return{...this.shallowExport()}}exportParentIds(){return{tableId:this.table.id,enumId:this._enum?this._enum.id:null}}exportChildIds(){return{endpointIds:this.endpoints.map(e=>e.id),depEdgeIds:this.depEdges.map(e=>e.id)}}shallowExport(){return{name:this.name,type:this.type,unique:this.unique,pk:this.pk,not_null:this.not_null,note:this.note,dbdefault:this.dbdefault,increment:this.increment,injectedPartialId:this.injectedPartial?.id??null,checkIds:this.checks.map(e=>e.id),metadata:this.metadata}}normalize(e){e.fields[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.checks.forEach(t=>t.normalize(e))}processChecks(e){e.forEach(e=>{this.checks.push(new t.default({...e,table:this.table,column:this}))})}};exports.default=r;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs");require("./config.cjs");const n=require("./element.cjs"),r=require("./check.cjs");t.init_lodash();var i=class extends n.default{constructor({name:t,type:n,unique:r,pk:i,token:a,not_null:o,note:s,dbdefault:c,increment:l,checks:u=[],table:d={},noteToken:f=null,injectedPartial:p=null,injectedToken:m=null,metadata:h={}}){super(a),t||this.error(`Field must have a name`),n||this.error(`Field must have a type`),this.name=t,this.type=n,this.unique=r,this.pk=i,this.not_null=o,this.note=s?e.default(s,`value`,s):null,this.noteToken=s?e.default(s,`token`,f):null,this.dbdefault=c,this.increment=l,this.checks=[],this.endpoints=[],this.depEdges=[],this.table=d,this.injectedPartial=p,this.injectedToken=m,this.dbState=this.table.dbState,this.metadata=h,this.generateId(),this.bindType(),this.processChecks(u)}generateId(){this.id=this.dbState.generateId(`fieldId`)}bindType(){let e=this.type.type_name,t=this.type.schemaName||`public`;if(this.type.schemaName){let n=this.table.schema.database.findEnum(t,e);if(!n){this.type.type_name=`${t}.${e}`,this.type.originalTypeName=e;return}this._enum=n,n.pushField(this)}else{let n=this.table.schema.database.findEnum(t,e);if(!n)return;this._enum=n,n.pushField(this)}}pushEndpoint(e){this.endpoints.push(e)}pushDepEdge(e){this.depEdges.push(e)}export(){return{...this.shallowExport()}}exportParentIds(){return{tableId:this.table.id,enumId:this._enum?this._enum.id:null}}exportChildIds(){return{endpointIds:this.endpoints.map(e=>e.id),depEdgeIds:this.depEdges.map(e=>e.id)}}shallowExport(){return{name:this.name,type:this.type,unique:this.unique,pk:this.pk,not_null:this.not_null,note:this.note,dbdefault:this.dbdefault,increment:this.increment,injectedPartialId:this.injectedPartial?.id??null,checkIds:this.checks.map(e=>e.id),metadata:this.metadata}}normalize(e){e.fields[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.checks.forEach(t=>t.normalize(e))}processChecks(e){e.forEach(e=>{this.checks.push(new r.default({...e,table:this.table,column:this}))})}};exports.default=i;
@@ -1,11 +1,13 @@
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
1
3
  import "./config.mjs";
2
- import e from "./element.mjs";
3
- import t from "./check.mjs";
4
- import { get as n } from "lodash-es";
4
+ import n from "./element.mjs";
5
+ import r from "./check.mjs";
5
6
  //#region src/model_structure/field.ts
6
- var r = class extends e {
7
- constructor({ name: e, type: t, unique: r, pk: i, token: a, not_null: o, note: s, dbdefault: c, increment: l, checks: u = [], table: d = {}, noteToken: f = null, injectedPartial: p = null, injectedToken: m = null, metadata: h = {} }) {
8
- super(a), e || this.error("Field must have a name"), t || this.error("Field must have a type"), this.name = e, this.type = t, this.unique = r, this.pk = i, this.not_null = o, this.note = s ? n(s, "value", s) : null, this.noteToken = s ? n(s, "token", f) : null, this.dbdefault = c, this.increment = l, this.checks = [], this.endpoints = [], this.depEdges = [], this.table = d, this.injectedPartial = p, this.injectedToken = m, this.dbState = this.table.dbState, this.metadata = h, this.generateId(), this.bindType(), this.processChecks(u);
7
+ t();
8
+ var i = class extends n {
9
+ constructor({ name: t, type: n, unique: r, pk: i, token: a, not_null: o, note: s, dbdefault: c, increment: l, checks: u = [], table: d = {}, noteToken: f = null, injectedPartial: p = null, injectedToken: m = null, metadata: h = {} }) {
10
+ super(a), t || this.error("Field must have a name"), n || this.error("Field must have a type"), this.name = t, this.type = n, this.unique = r, this.pk = i, this.not_null = o, this.note = s ? e(s, "value", s) : null, this.noteToken = s ? e(s, "token", f) : null, this.dbdefault = c, this.increment = l, this.checks = [], this.endpoints = [], this.depEdges = [], this.table = d, this.injectedPartial = p, this.injectedToken = m, this.dbState = this.table.dbState, this.metadata = h, this.generateId(), this.bindType(), this.processChecks(u);
9
11
  }
10
12
  generateId() {
11
13
  this.id = this.dbState.generateId("fieldId");
@@ -71,7 +73,7 @@ var r = class extends e {
71
73
  }
72
74
  processChecks(e) {
73
75
  e.forEach((e) => {
74
- this.checks.push(new t({
76
+ this.checks.push(new r({
75
77
  ...e,
76
78
  table: this.table,
77
79
  column: this
@@ -80,4 +82,4 @@ var r = class extends e {
80
82
  }
81
83
  };
82
84
  //#endregion
83
- export { r as default };
85
+ export { i as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs");const e=require("./utils.cjs"),t=require("./element.cjs"),n=require("./dep.cjs"),r=require("./enum.cjs"),i=require("./ref.cjs"),a=require("./table.cjs"),o=require("./tableGroup.cjs");let s=require("lodash-es");var c=class extends t.default{constructor({name:e,alias:t,note:n,tables:r=[],refs:i=[],deps:a=[],enums:o=[],tableGroups:c=[],token:l,database:u={},noteToken:d=null}={}){super(l),this.tables=[],this.enums=[],this.tableGroups=[],this.refs=[],this.deps=[],this.name=e,this.note=n?(0,s.get)(n,`value`,typeof n==`string`?n:null):null,this.noteToken=n?(0,s.get)(n,`token`,d):null,this.alias=t,this.database=u,this.dbState=this.database.dbState,this.generateId(),this.processEnums(o),this.processTables(r),this.processRefs(i),this.processDeps(a),this.processTableGroups(c)}generateId(){this.id=this.dbState.generateId(`schemaId`)}processTables(e){e.forEach(e=>{this.pushTable(new a.default({...e,schema:this}))})}pushTable(e){this.checkTable(e),this.tables.push(e)}checkTable(t){this.tables.some(e=>e.name===t.name)&&t.error(`Table ${e.shouldPrintSchema(this)?`"${this.name}".`:``}"${t.name}" existed`)}findTable(e){return this.tables.find(t=>t.name===e)}processEnums(e){e.forEach(e=>{this.pushEnum(new r.default({...e,schema:this}))})}pushEnum(e){this.checkEnum(e),this.enums.push(e)}checkEnum(t){this.enums.some(e=>e.name===t.name)&&t.error(`Enum ${e.shouldPrintSchema(this)?`"${this.name}".`:``}"${t.name}" existed`)}processRefs(e){e.forEach(e=>{this.pushRef(new i.default({...e,schema:this}))})}pushRef(e){this.checkRef(e),this.refs.push(e)}checkRef(e){if(this.refs.some(t=>t.equals(e))){let t=e.endpoints[0],n=t.fieldNames.map(e=>JSON.stringify(e)).join(`, `),r=e.endpoints[1],i=r.fieldNames.map(e=>JSON.stringify(e)).join(`, `),a=`"${t.schemaName?`${t.schemaName}"."`:``}${t.tableName}"(${n})`,o=`"${r.schemaName?`${r.schemaName}"."`:``}${r.tableName}"(${i})`;e.error(`Reference with the same endpoints already exists: ${a} references ${o}`)}}processDeps(e){e.forEach(e=>{this.pushDep(new n.default({...e,schema:this}))})}pushDep(e){this.deps.push(e)}processTableGroups(e){e.forEach(e=>{this.pushTableGroup(new o.default({...e,schema:this}))})}pushTableGroup(e){this.checkTableGroup(e),this.tableGroups.push(e)}checkTableGroup(t){this.tableGroups.some(e=>e.name===t.name)&&t.error(`Table Group ${e.shouldPrintSchema(this)?`"${this.name}".`:``}"${t.name}" existed`)}checkSameId(e){return this.name===e.name||this.alias===e.name||this.name===e.alias||!!this.alias&&this.alias===e.alias}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{tables:this.tables.map(e=>e.export()),enums:this.enums.map(e=>e.export()),tableGroups:this.tableGroups.map(e=>e.export()),refs:this.refs.map(e=>e.export()),deps:this.deps.map(e=>e.export())}}exportChildIds(){return{tableIds:this.tables.map(e=>e.id),enumIds:this.enums.map(e=>e.id),tableGroupIds:this.tableGroups.map(e=>e.id),refIds:this.refs.map(e=>e.id),depIds:this.deps.map(e=>e.id)}}exportParentIds(){return{databaseId:this.database.id}}shallowExport(){return{name:this.name,note:this.note,alias:this.alias}}normalize(e){e.schemas[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.tables.forEach(t=>t.normalize(e)),this.enums.forEach(t=>t.normalize(e)),this.tableGroups.forEach(t=>t.normalize(e)),this.refs.forEach(t=>t.normalize(e)),this.deps.forEach(t=>t.normalize(e))}};exports.default=c;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs"),n=require("./utils.cjs"),r=require("./element.cjs"),i=require("./dep.cjs"),a=require("./enum.cjs"),o=require("./ref.cjs"),s=require("./table.cjs"),c=require("./tableGroup.cjs");t.init_lodash();var l=class extends r.default{constructor({name:t,alias:n,note:r,tables:i=[],refs:a=[],deps:o=[],enums:s=[],tableGroups:c=[],token:l,database:u={},noteToken:d=null}={}){super(l),this.tables=[],this.enums=[],this.tableGroups=[],this.refs=[],this.deps=[],this.name=t,this.note=r?e.default(r,`value`,typeof r==`string`?r:null):null,this.noteToken=r?e.default(r,`token`,d):null,this.alias=n,this.database=u,this.dbState=this.database.dbState,this.generateId(),this.processEnums(s),this.processTables(i),this.processRefs(a),this.processDeps(o),this.processTableGroups(c)}generateId(){this.id=this.dbState.generateId(`schemaId`)}processTables(e){e.forEach(e=>{this.pushTable(new s.default({...e,schema:this}))})}pushTable(e){this.checkTable(e),this.tables.push(e)}checkTable(e){this.tables.some(t=>t.name===e.name)&&e.error(`Table ${n.shouldPrintSchema(this)?`"${this.name}".`:``}"${e.name}" existed`)}findTable(e){return this.tables.find(t=>t.name===e)}processEnums(e){e.forEach(e=>{this.pushEnum(new a.default({...e,schema:this}))})}pushEnum(e){this.checkEnum(e),this.enums.push(e)}checkEnum(e){this.enums.some(t=>t.name===e.name)&&e.error(`Enum ${n.shouldPrintSchema(this)?`"${this.name}".`:``}"${e.name}" existed`)}processRefs(e){e.forEach(e=>{this.pushRef(new o.default({...e,schema:this}))})}pushRef(e){this.checkRef(e),this.refs.push(e)}checkRef(e){if(this.refs.some(t=>t.equals(e))){let t=e.endpoints[0],n=t.fieldNames.map(e=>JSON.stringify(e)).join(`, `),r=e.endpoints[1],i=r.fieldNames.map(e=>JSON.stringify(e)).join(`, `),a=`"${t.schemaName?`${t.schemaName}"."`:``}${t.tableName}"(${n})`,o=`"${r.schemaName?`${r.schemaName}"."`:``}${r.tableName}"(${i})`;e.error(`Reference with the same endpoints already exists: ${a} references ${o}`)}}processDeps(e){e.forEach(e=>{this.pushDep(new i.default({...e,schema:this}))})}pushDep(e){this.deps.push(e)}processTableGroups(e){e.forEach(e=>{this.pushTableGroup(new c.default({...e,schema:this}))})}pushTableGroup(e){this.checkTableGroup(e),this.tableGroups.push(e)}checkTableGroup(e){this.tableGroups.some(t=>t.name===e.name)&&e.error(`Table Group ${n.shouldPrintSchema(this)?`"${this.name}".`:``}"${e.name}" existed`)}checkSameId(e){return this.name===e.name||this.alias===e.name||this.name===e.alias||!!this.alias&&this.alias===e.alias}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{tables:this.tables.map(e=>e.export()),enums:this.enums.map(e=>e.export()),tableGroups:this.tableGroups.map(e=>e.export()),refs:this.refs.map(e=>e.export()),deps:this.deps.map(e=>e.export())}}exportChildIds(){return{tableIds:this.tables.map(e=>e.id),enumIds:this.enums.map(e=>e.id),tableGroupIds:this.tableGroups.map(e=>e.id),refIds:this.refs.map(e=>e.id),depIds:this.deps.map(e=>e.id)}}exportParentIds(){return{databaseId:this.database.id}}shallowExport(){return{name:this.name,note:this.note,alias:this.alias}}normalize(e){e.schemas[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.tables.forEach(t=>t.normalize(e)),this.enums.forEach(t=>t.normalize(e)),this.tableGroups.forEach(t=>t.normalize(e)),this.refs.forEach(t=>t.normalize(e)),this.deps.forEach(t=>t.normalize(e))}};exports.default=l;
@@ -1,22 +1,24 @@
1
- import { shouldPrintSchema as e } from "./utils.mjs";
2
- import t from "./element.mjs";
3
- import n from "./dep.mjs";
4
- import r from "./enum.mjs";
5
- import i from "./ref.mjs";
6
- import a from "./table.mjs";
7
- import o from "./tableGroup.mjs";
8
- import { get as s } from "lodash-es";
1
+ import e from "../node_modules/lodash-es/get.mjs";
2
+ import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
+ import { shouldPrintSchema as n } from "./utils.mjs";
4
+ import r from "./element.mjs";
5
+ import i from "./dep.mjs";
6
+ import a from "./enum.mjs";
7
+ import o from "./ref.mjs";
8
+ import s from "./table.mjs";
9
+ import c from "./tableGroup.mjs";
9
10
  //#region src/model_structure/schema.ts
10
- var c = class extends t {
11
- constructor({ name: e, alias: t, note: n, tables: r = [], refs: i = [], deps: a = [], enums: o = [], tableGroups: c = [], token: l, database: u = {}, noteToken: d = null } = {}) {
12
- super(l), this.tables = [], this.enums = [], this.tableGroups = [], this.refs = [], this.deps = [], this.name = e, this.note = n ? s(n, "value", typeof n == "string" ? n : null) : null, this.noteToken = n ? s(n, "token", d) : null, this.alias = t, this.database = u, this.dbState = this.database.dbState, this.generateId(), this.processEnums(o), this.processTables(r), this.processRefs(i), this.processDeps(a), this.processTableGroups(c);
11
+ t();
12
+ var l = class extends r {
13
+ constructor({ name: t, alias: n, note: r, tables: i = [], refs: a = [], deps: o = [], enums: s = [], tableGroups: c = [], token: l, database: u = {}, noteToken: d = null } = {}) {
14
+ super(l), this.tables = [], this.enums = [], this.tableGroups = [], this.refs = [], this.deps = [], this.name = t, this.note = r ? e(r, "value", typeof r == "string" ? r : null) : null, this.noteToken = r ? e(r, "token", d) : null, this.alias = n, this.database = u, this.dbState = this.database.dbState, this.generateId(), this.processEnums(s), this.processTables(i), this.processRefs(a), this.processDeps(o), this.processTableGroups(c);
13
15
  }
14
16
  generateId() {
15
17
  this.id = this.dbState.generateId("schemaId");
16
18
  }
17
19
  processTables(e) {
18
20
  e.forEach((e) => {
19
- this.pushTable(new a({
21
+ this.pushTable(new s({
20
22
  ...e,
21
23
  schema: this
22
24
  }));
@@ -25,15 +27,15 @@ var c = class extends t {
25
27
  pushTable(e) {
26
28
  this.checkTable(e), this.tables.push(e);
27
29
  }
28
- checkTable(t) {
29
- this.tables.some((e) => e.name === t.name) && t.error(`Table ${e(this) ? `"${this.name}".` : ""}"${t.name}" existed`);
30
+ checkTable(e) {
31
+ this.tables.some((t) => t.name === e.name) && e.error(`Table ${n(this) ? `"${this.name}".` : ""}"${e.name}" existed`);
30
32
  }
31
33
  findTable(e) {
32
34
  return this.tables.find((t) => t.name === e);
33
35
  }
34
36
  processEnums(e) {
35
37
  e.forEach((e) => {
36
- this.pushEnum(new r({
38
+ this.pushEnum(new a({
37
39
  ...e,
38
40
  schema: this
39
41
  }));
@@ -42,12 +44,12 @@ var c = class extends t {
42
44
  pushEnum(e) {
43
45
  this.checkEnum(e), this.enums.push(e);
44
46
  }
45
- checkEnum(t) {
46
- this.enums.some((e) => e.name === t.name) && t.error(`Enum ${e(this) ? `"${this.name}".` : ""}"${t.name}" existed`);
47
+ checkEnum(e) {
48
+ this.enums.some((t) => t.name === e.name) && e.error(`Enum ${n(this) ? `"${this.name}".` : ""}"${e.name}" existed`);
47
49
  }
48
50
  processRefs(e) {
49
51
  e.forEach((e) => {
50
- this.pushRef(new i({
52
+ this.pushRef(new o({
51
53
  ...e,
52
54
  schema: this
53
55
  }));
@@ -64,7 +66,7 @@ var c = class extends t {
64
66
  }
65
67
  processDeps(e) {
66
68
  e.forEach((e) => {
67
- this.pushDep(new n({
69
+ this.pushDep(new i({
68
70
  ...e,
69
71
  schema: this
70
72
  }));
@@ -75,7 +77,7 @@ var c = class extends t {
75
77
  }
76
78
  processTableGroups(e) {
77
79
  e.forEach((e) => {
78
- this.pushTableGroup(new o({
80
+ this.pushTableGroup(new c({
79
81
  ...e,
80
82
  schema: this
81
83
  }));
@@ -84,8 +86,8 @@ var c = class extends t {
84
86
  pushTableGroup(e) {
85
87
  this.checkTableGroup(e), this.tableGroups.push(e);
86
88
  }
87
- checkTableGroup(t) {
88
- this.tableGroups.some((e) => e.name === t.name) && t.error(`Table Group ${e(this) ? `"${this.name}".` : ""}"${t.name}" existed`);
89
+ checkTableGroup(e) {
90
+ this.tableGroups.some((t) => t.name === e.name) && e.error(`Table Group ${n(this) ? `"${this.name}".` : ""}"${e.name}" existed`);
89
91
  }
90
92
  checkSameId(e) {
91
93
  return this.name === e.name || this.alias === e.name || this.name === e.alias || !!this.alias && this.alias === e.alias;
@@ -134,4 +136,4 @@ var c = class extends t {
134
136
  }
135
137
  };
136
138
  //#endregion
137
- export { c as default };
139
+ export { l as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./utils.cjs"),t=require("./element.cjs"),n=require("./check.cjs"),r=require("./field.cjs"),i=require("./indexes.cjs");let a=require("lodash-es"),o=require("@dbml/parse");var s=class extends t.default{constructor({name:e,alias:t,note:n,fields:r=[],indexes:i=[],checks:o=[],schema:s={},token:c,headerColor:l,noteToken:u=null,partials:d=[],metadata:f={}}){super(c),this.metadata=f,this.name=e,this.alias=t,this.note=n?(0,a.get)(n,`value`,n):null,this.noteToken=n?(0,a.get)(n,`token`,u):null,this.headerColor=l,this.fields=[],this.indexes=[],this.checks=[],this.schema=s,this.partials=d,this.records=[],this.dbState=this.schema.dbState,this.generateId(),this.processFields(r),this.processPartials(),this.checkFieldCount(),this.processIndexes(i),this.processChecks(o)}generateId(){this.id=this.dbState.generateId(`tableId`)}checkFieldCount(){this.fields.length===0&&this.error(`Table must have at least one field`)}processFields(e){e.forEach(e=>{this.pushField(new r.default({...e,table:this}))})}pushField(e){this.checkField(e),this.fields.push(e)}checkField(t){this.fields.some(e=>e.name===t.name)&&t.error(`Field "${t.name}" existed in table ${e.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)}processIndexes(e){e.forEach(e=>{this.pushIndex(new i.default({...e,table:this}))})}pushIndex(e){this.checkIndex(e),this.indexes.push(e)}checkIndex(t){t.columns.forEach(n=>{n.type===`column`&&!this.findField(n.value)&&t.error(`Column "${n.value}" do not exist in table ${e.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)})}processChecks(e){e.forEach(e=>{this.pushCheck(new n.default({...e,table:this}))})}pushCheck(e){this.checks.push(e)}findField(e){return this.fields.find(t=>t.name===e)}checkSameId(e){return this.schema.checkSameId(e.schemaName||`public`)&&(this.name===e.name||this.alias===e.name||this.name===e.alias||this.alias&&this.alias===e.alias)}processPartials(){if(!this.partials?.length)return;let e=new Set(this.fields.map(e=>e.name)),t=new Set;(0,a.isNil)(this.note)||t.add(`note`),(0,a.isNil)(this.headerColor)||t.add(`headerColor`);let s=this.partials.sort((e,t)=>t.order-e.order);s.toReversed().forEach(e=>{this.fields.splice(e.order,0,`dummy`)}),s.forEach(s=>{let c=this.schema.database.findTablePartial(s.name);if(c||this.error(`Table partial ${s.name} not found`),s.id=c.id,c.fields){let t=c.fields.filter(t=>!e.has(t.name)).map(t=>(e.add(t.name),t.inline_refs&&t.inline_refs.forEach(e=>{let n=(0,o.getMultiplicities)(e.relation)||[`*`,`*`],r={token:t.token,endpoints:[{tableName:this.name,schemaName:this.schema?.name,fieldNames:[t.name],relation:n[0],token:t.token},{tableName:e.tableName,schemaName:e.schemaName,fieldNames:e.fieldNames,relation:n[1],token:e.token}],injectedPartial:c};this.schema.database.injectedRawRefs.push(r)}),new r.default({...t,noteToken:null,table:this,injectedPartial:c,injectedToken:s.token})));this.fields.splice(s.order,1,...t)}else this.fields.splice(s.order,1);!t.has(`note`)&&!(0,a.isNil)(c.note)&&(this.noteToken=null,this.note=c.note,t.add(`note`)),!t.has(`headerColor`)&&!(0,a.isNil)(c.headerColor)&&(this.headerColor=c.headerColor,t.add(`headerColor`)),c.indexes.forEach(e=>{this.indexes.push(new i.default({...e,table:this,injectedPartial:c}))}),c.checks.forEach(e=>{this.checks.push(new n.default({...e,name:e.name&&`${this.name}.${e.name}`,table:this,injectedPartial:c}))})})}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{fields:this.fields.map(e=>e.export()),indexes:this.indexes.map(e=>e.export())}}exportChildIds(){return{fieldIds:this.fields.map(e=>e.id),indexIds:this.indexes.map(e=>e.id),checkIds:this.checks.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id,groupId:this.group?this.group.id:null}}shallowExport(){return{name:this.name,alias:this.alias,note:this.note,headerColor:this.headerColor,partials:this.partials,recordIds:this.records.map(e=>e.id),metadata:this.metadata}}normalize(e){e.tables[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.fields.forEach(t=>t.normalize(e)),this.indexes.forEach(t=>t.normalize(e)),this.checks.forEach(t=>t.normalize(e))}};exports.default=s;
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/isNil.cjs"),n=require("../node_modules/lodash-es/lodash.cjs");require("./config.cjs");const r=require("./utils.cjs"),i=require("./element.cjs"),a=require("./check.cjs"),o=require("./field.cjs"),s=require("./indexes.cjs");let c=require("@dbml/parse");n.init_lodash();var l=class extends i.default{constructor({name:t,alias:n,note:r,fields:i=[],indexes:a=[],checks:o=[],schema:s={},token:c,headerColor:l,noteToken:u=null,partials:d=[],metadata:f={}}){super(c),this.metadata=f,this.name=t,this.alias=n,this.note=r?e.default(r,`value`,r):null,this.noteToken=r?e.default(r,`token`,u):null,this.headerColor=l,this.fields=[],this.indexes=[],this.checks=[],this.schema=s,this.partials=d,this.records=[],this.dbState=this.schema.dbState,this.generateId(),this.processFields(i),this.processPartials(),this.checkFieldCount(),this.processIndexes(a),this.processChecks(o)}generateId(){this.id=this.dbState.generateId(`tableId`)}checkFieldCount(){this.fields.length===0&&this.error(`Table must have at least one field`)}processFields(e){e.forEach(e=>{this.pushField(new o.default({...e,table:this}))})}pushField(e){this.checkField(e),this.fields.push(e)}checkField(e){this.fields.some(t=>t.name===e.name)&&e.error(`Field "${e.name}" existed in table ${r.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)}processIndexes(e){e.forEach(e=>{this.pushIndex(new s.default({...e,table:this}))})}pushIndex(e){this.checkIndex(e),this.indexes.push(e)}checkIndex(e){e.columns.forEach(t=>{t.type===`column`&&!this.findField(t.value)&&e.error(`Column "${t.value}" do not exist in table ${r.shouldPrintSchema(this.schema)?`"${this.schema.name}".`:``}"${this.name}"`)})}processChecks(e){e.forEach(e=>{this.pushCheck(new a.default({...e,table:this}))})}pushCheck(e){this.checks.push(e)}findField(e){return this.fields.find(t=>t.name===e)}checkSameId(e){return this.schema.checkSameId(e.schemaName||`public`)&&(this.name===e.name||this.alias===e.name||this.name===e.alias||this.alias&&this.alias===e.alias)}processPartials(){if(!this.partials?.length)return;let e=new Set(this.fields.map(e=>e.name)),n=new Set;t.default(this.note)||n.add(`note`),t.default(this.headerColor)||n.add(`headerColor`);let r=this.partials.sort((e,t)=>t.order-e.order);r.toReversed().forEach(e=>{this.fields.splice(e.order,0,`dummy`)}),r.forEach(r=>{let i=this.schema.database.findTablePartial(r.name);if(i||this.error(`Table partial ${r.name} not found`),r.id=i.id,i.fields){let t=i.fields.filter(t=>!e.has(t.name)).map(t=>(e.add(t.name),t.inline_refs&&t.inline_refs.forEach(e=>{let n=(0,c.getMultiplicities)(e.relation)||[`*`,`*`],r={token:t.token,endpoints:[{tableName:this.name,schemaName:this.schema?.name,fieldNames:[t.name],relation:n[0],token:t.token},{tableName:e.tableName,schemaName:e.schemaName,fieldNames:e.fieldNames,relation:n[1],token:e.token}],injectedPartial:i};this.schema.database.injectedRawRefs.push(r)}),new o.default({...t,noteToken:null,table:this,injectedPartial:i,injectedToken:r.token})));this.fields.splice(r.order,1,...t)}else this.fields.splice(r.order,1);!n.has(`note`)&&!t.default(i.note)&&(this.noteToken=null,this.note=i.note,n.add(`note`)),!n.has(`headerColor`)&&!t.default(i.headerColor)&&(this.headerColor=i.headerColor,n.add(`headerColor`)),i.indexes.forEach(e=>{this.indexes.push(new s.default({...e,table:this,injectedPartial:i}))}),i.checks.forEach(e=>{this.checks.push(new a.default({...e,name:e.name&&`${this.name}.${e.name}`,table:this,injectedPartial:i}))})})}export(){return{...this.shallowExport(),...this.exportChild()}}exportChild(){return{fields:this.fields.map(e=>e.export()),indexes:this.indexes.map(e=>e.export())}}exportChildIds(){return{fieldIds:this.fields.map(e=>e.id),indexIds:this.indexes.map(e=>e.id),checkIds:this.checks.map(e=>e.id)}}exportParentIds(){return{schemaId:this.schema.id,groupId:this.group?this.group.id:null}}shallowExport(){return{name:this.name,alias:this.alias,note:this.note,headerColor:this.headerColor,partials:this.partials,recordIds:this.records.map(e=>e.id),metadata:this.metadata}}normalize(e){e.tables[this.id]={id:this.id,...this.shallowExport(),...this.exportChildIds(),...this.exportParentIds()},this.fields.forEach(t=>t.normalize(e)),this.indexes.forEach(t=>t.normalize(e)),this.checks.forEach(t=>t.normalize(e))}};exports.default=l;