@dbml/core 11.0.1 → 11.0.2-arch.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/lib/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/lib/_virtual/_rolldown/runtime.mjs +2 -3
  3. package/lib/export/DbmlExporter.cjs +1 -1
  4. package/lib/export/DbmlExporter.mjs +2 -3
  5. package/lib/export/JsonExporter.mjs +1 -2
  6. package/lib/export/ModelExporter.cjs +1 -1
  7. package/lib/export/ModelExporter.mjs +9 -10
  8. package/lib/export/MysqlExporter.mjs +1 -2
  9. package/lib/export/OracleExporter.mjs +1 -2
  10. package/lib/export/PostgresExporter.cjs +8 -8
  11. package/lib/export/PostgresExporter.mjs +30 -31
  12. package/lib/export/SqlServerExporter.mjs +1 -2
  13. package/lib/export/index.cjs +1 -1
  14. package/lib/export/index.mjs +5 -6
  15. package/lib/export/utils.mjs +1 -2
  16. package/lib/import/index.cjs +1 -1
  17. package/lib/import/index.mjs +10 -11
  18. package/lib/index.cjs +1 -1
  19. package/lib/index.mjs +9 -9
  20. package/lib/model_structure/check.mjs +1 -2
  21. package/lib/model_structure/config.mjs +1 -2
  22. package/lib/model_structure/database.cjs +1 -1
  23. package/lib/model_structure/database.mjs +81 -23
  24. package/lib/model_structure/dbState.cjs +1 -1
  25. package/lib/model_structure/dbState.mjs +2 -3
  26. package/lib/model_structure/dep.cjs +1 -1
  27. package/lib/model_structure/dep.mjs +6 -7
  28. package/lib/model_structure/depEdge.cjs +1 -1
  29. package/lib/model_structure/depEdge.mjs +10 -11
  30. package/lib/model_structure/element.mjs +1 -2
  31. package/lib/model_structure/endpoint.cjs +1 -1
  32. package/lib/model_structure/endpoint.mjs +17 -18
  33. package/lib/model_structure/enum.cjs +1 -1
  34. package/lib/model_structure/enum.mjs +8 -9
  35. package/lib/model_structure/enumValue.mjs +1 -2
  36. package/lib/model_structure/field.cjs +1 -1
  37. package/lib/model_structure/field.mjs +5 -6
  38. package/lib/model_structure/group.cjs +1 -0
  39. package/lib/model_structure/group.mjs +29 -0
  40. package/lib/model_structure/indexColumn.mjs +1 -2
  41. package/lib/model_structure/indexes.mjs +1 -2
  42. package/lib/model_structure/link.cjs +1 -0
  43. package/lib/model_structure/link.mjs +27 -0
  44. package/lib/model_structure/node.cjs +1 -0
  45. package/lib/model_structure/node.mjs +30 -0
  46. package/lib/model_structure/ref.mjs +1 -2
  47. package/lib/model_structure/schema.cjs +1 -1
  48. package/lib/model_structure/schema.mjs +15 -16
  49. package/lib/model_structure/stickyNote.mjs +1 -2
  50. package/lib/model_structure/table.cjs +1 -1
  51. package/lib/model_structure/table.mjs +28 -29
  52. package/lib/model_structure/tableGroup.cjs +1 -1
  53. package/lib/model_structure/tableGroup.mjs +5 -6
  54. package/lib/model_structure/tablePartial.mjs +1 -2
  55. package/lib/model_structure/utils.mjs +1 -2
  56. package/lib/node_modules/antlr4/dist/antlr4.web.mjs +1 -2
  57. package/lib/node_modules/lodash-es/_DataView.cjs +1 -1
  58. package/lib/node_modules/lodash-es/_DataView.mjs +4 -5
  59. package/lib/node_modules/lodash-es/_Hash.mjs +1 -2
  60. package/lib/node_modules/lodash-es/_ListCache.mjs +1 -2
  61. package/lib/node_modules/lodash-es/_Map.cjs +1 -1
  62. package/lib/node_modules/lodash-es/_Map.mjs +4 -5
  63. package/lib/node_modules/lodash-es/_MapCache.mjs +1 -2
  64. package/lib/node_modules/lodash-es/_Promise.cjs +1 -1
  65. package/lib/node_modules/lodash-es/_Promise.mjs +4 -5
  66. package/lib/node_modules/lodash-es/_Set.cjs +1 -1
  67. package/lib/node_modules/lodash-es/_Set.mjs +4 -5
  68. package/lib/node_modules/lodash-es/_SetCache.mjs +1 -2
  69. package/lib/node_modules/lodash-es/_Stack.mjs +1 -2
  70. package/lib/node_modules/lodash-es/_Symbol.mjs +1 -2
  71. package/lib/node_modules/lodash-es/_Uint8Array.mjs +1 -2
  72. package/lib/node_modules/lodash-es/_WeakMap.cjs +1 -1
  73. package/lib/node_modules/lodash-es/_WeakMap.mjs +4 -5
  74. package/lib/node_modules/lodash-es/_arrayAggregator.mjs +1 -2
  75. package/lib/node_modules/lodash-es/_arrayEach.mjs +1 -2
  76. package/lib/node_modules/lodash-es/_arrayFilter.mjs +1 -2
  77. package/lib/node_modules/lodash-es/_arrayLikeKeys.cjs +1 -1
  78. package/lib/node_modules/lodash-es/_arrayLikeKeys.mjs +9 -10
  79. package/lib/node_modules/lodash-es/_arrayMap.mjs +1 -2
  80. package/lib/node_modules/lodash-es/_arrayPush.mjs +1 -2
  81. package/lib/node_modules/lodash-es/_arrayReduce.mjs +1 -2
  82. package/lib/node_modules/lodash-es/_arraySome.mjs +1 -2
  83. package/lib/node_modules/lodash-es/_asciiToArray.mjs +1 -2
  84. package/lib/node_modules/lodash-es/_assocIndexOf.mjs +1 -2
  85. package/lib/node_modules/lodash-es/_baseAggregator.mjs +1 -2
  86. package/lib/node_modules/lodash-es/_baseAssignValue.mjs +1 -2
  87. package/lib/node_modules/lodash-es/_baseEach.mjs +1 -2
  88. package/lib/node_modules/lodash-es/_baseFlatten.mjs +1 -2
  89. package/lib/node_modules/lodash-es/_baseFor.mjs +1 -2
  90. package/lib/node_modules/lodash-es/_baseForOwn.cjs +1 -1
  91. package/lib/node_modules/lodash-es/_baseForOwn.mjs +5 -6
  92. package/lib/node_modules/lodash-es/_baseGet.mjs +1 -2
  93. package/lib/node_modules/lodash-es/_baseGetAllKeys.cjs +1 -1
  94. package/lib/node_modules/lodash-es/_baseGetAllKeys.mjs +5 -6
  95. package/lib/node_modules/lodash-es/_baseGetTag.mjs +1 -2
  96. package/lib/node_modules/lodash-es/_baseHasIn.mjs +1 -2
  97. package/lib/node_modules/lodash-es/_baseIsArguments.mjs +1 -2
  98. package/lib/node_modules/lodash-es/_baseIsEqual.cjs +1 -1
  99. package/lib/node_modules/lodash-es/_baseIsEqual.mjs +5 -6
  100. package/lib/node_modules/lodash-es/_baseIsEqualDeep.cjs +1 -1
  101. package/lib/node_modules/lodash-es/_baseIsEqualDeep.mjs +15 -16
  102. package/lib/node_modules/lodash-es/_baseIsMatch.mjs +1 -2
  103. package/lib/node_modules/lodash-es/_baseIsNative.cjs +1 -1
  104. package/lib/node_modules/lodash-es/_baseIsNative.mjs +6 -7
  105. package/lib/node_modules/lodash-es/_baseIsTypedArray.cjs +1 -1
  106. package/lib/node_modules/lodash-es/_baseIsTypedArray.mjs +5 -6
  107. package/lib/node_modules/lodash-es/_baseIteratee.cjs +1 -1
  108. package/lib/node_modules/lodash-es/_baseIteratee.mjs +7 -8
  109. package/lib/node_modules/lodash-es/_baseKeys.mjs +1 -2
  110. package/lib/node_modules/lodash-es/_baseMatches.mjs +1 -2
  111. package/lib/node_modules/lodash-es/_baseMatchesProperty.cjs +1 -1
  112. package/lib/node_modules/lodash-es/_baseMatchesProperty.mjs +10 -11
  113. package/lib/node_modules/lodash-es/_baseNth.mjs +1 -2
  114. package/lib/node_modules/lodash-es/_baseProperty.mjs +1 -2
  115. package/lib/node_modules/lodash-es/_basePropertyDeep.mjs +1 -2
  116. package/lib/node_modules/lodash-es/_baseReduce.mjs +1 -2
  117. package/lib/node_modules/lodash-es/_baseSlice.mjs +1 -2
  118. package/lib/node_modules/lodash-es/_baseTimes.mjs +1 -2
  119. package/lib/node_modules/lodash-es/_baseToString.cjs +1 -1
  120. package/lib/node_modules/lodash-es/_baseToString.mjs +7 -8
  121. package/lib/node_modules/lodash-es/_baseTrim.mjs +1 -2
  122. package/lib/node_modules/lodash-es/_baseUnary.mjs +1 -2
  123. package/lib/node_modules/lodash-es/_cacheHas.mjs +1 -2
  124. package/lib/node_modules/lodash-es/_castFunction.mjs +1 -2
  125. package/lib/node_modules/lodash-es/_castPath.mjs +1 -2
  126. package/lib/node_modules/lodash-es/_castSlice.mjs +1 -2
  127. package/lib/node_modules/lodash-es/_copyArray.mjs +1 -2
  128. package/lib/node_modules/lodash-es/_coreJsData.mjs +1 -2
  129. package/lib/node_modules/lodash-es/_createAggregator.cjs +1 -1
  130. package/lib/node_modules/lodash-es/_createAggregator.mjs +8 -9
  131. package/lib/node_modules/lodash-es/_createBaseEach.mjs +1 -2
  132. package/lib/node_modules/lodash-es/_createBaseFor.mjs +1 -2
  133. package/lib/node_modules/lodash-es/_createCaseFirst.cjs +1 -1
  134. package/lib/node_modules/lodash-es/_createCaseFirst.mjs +8 -9
  135. package/lib/node_modules/lodash-es/_defineProperty.mjs +1 -2
  136. package/lib/node_modules/lodash-es/_equalArrays.mjs +1 -2
  137. package/lib/node_modules/lodash-es/_equalByTag.cjs +1 -1
  138. package/lib/node_modules/lodash-es/_equalByTag.mjs +6 -7
  139. package/lib/node_modules/lodash-es/_equalObjects.mjs +1 -2
  140. package/lib/node_modules/lodash-es/_freeGlobal.mjs +1 -2
  141. package/lib/node_modules/lodash-es/_getAllKeys.cjs +1 -1
  142. package/lib/node_modules/lodash-es/_getAllKeys.mjs +5 -6
  143. package/lib/node_modules/lodash-es/_getMapData.mjs +1 -2
  144. package/lib/node_modules/lodash-es/_getMatchData.cjs +1 -1
  145. package/lib/node_modules/lodash-es/_getMatchData.mjs +6 -7
  146. package/lib/node_modules/lodash-es/_getNative.mjs +1 -2
  147. package/lib/node_modules/lodash-es/_getRawTag.mjs +1 -2
  148. package/lib/node_modules/lodash-es/_getSymbols.mjs +1 -2
  149. package/lib/node_modules/lodash-es/_getTag.cjs +1 -1
  150. package/lib/node_modules/lodash-es/_getTag.mjs +12 -13
  151. package/lib/node_modules/lodash-es/_getValue.mjs +1 -2
  152. package/lib/node_modules/lodash-es/_hasPath.cjs +1 -1
  153. package/lib/node_modules/lodash-es/_hasPath.mjs +9 -10
  154. package/lib/node_modules/lodash-es/_hasUnicode.mjs +1 -2
  155. package/lib/node_modules/lodash-es/_hashClear.mjs +1 -2
  156. package/lib/node_modules/lodash-es/_hashDelete.mjs +1 -2
  157. package/lib/node_modules/lodash-es/_hashGet.mjs +1 -2
  158. package/lib/node_modules/lodash-es/_hashHas.mjs +1 -2
  159. package/lib/node_modules/lodash-es/_hashSet.mjs +1 -2
  160. package/lib/node_modules/lodash-es/_isFlattenable.cjs +1 -1
  161. package/lib/node_modules/lodash-es/_isFlattenable.mjs +5 -6
  162. package/lib/node_modules/lodash-es/_isIndex.mjs +1 -2
  163. package/lib/node_modules/lodash-es/_isKey.cjs +1 -1
  164. package/lib/node_modules/lodash-es/_isKey.mjs +6 -7
  165. package/lib/node_modules/lodash-es/_isKeyable.mjs +1 -2
  166. package/lib/node_modules/lodash-es/_isMasked.mjs +1 -2
  167. package/lib/node_modules/lodash-es/_isPrototype.mjs +1 -2
  168. package/lib/node_modules/lodash-es/_isStrictComparable.mjs +1 -2
  169. package/lib/node_modules/lodash-es/_listCacheClear.mjs +1 -2
  170. package/lib/node_modules/lodash-es/_listCacheDelete.mjs +1 -2
  171. package/lib/node_modules/lodash-es/_listCacheGet.mjs +1 -2
  172. package/lib/node_modules/lodash-es/_listCacheHas.mjs +1 -2
  173. package/lib/node_modules/lodash-es/_listCacheSet.mjs +1 -2
  174. package/lib/node_modules/lodash-es/_mapCacheClear.mjs +1 -2
  175. package/lib/node_modules/lodash-es/_mapCacheDelete.mjs +1 -2
  176. package/lib/node_modules/lodash-es/_mapCacheGet.mjs +1 -2
  177. package/lib/node_modules/lodash-es/_mapCacheHas.mjs +1 -2
  178. package/lib/node_modules/lodash-es/_mapCacheSet.mjs +1 -2
  179. package/lib/node_modules/lodash-es/_mapToArray.mjs +1 -2
  180. package/lib/node_modules/lodash-es/_matchesStrictComparable.mjs +1 -2
  181. package/lib/node_modules/lodash-es/_memoizeCapped.mjs +1 -2
  182. package/lib/node_modules/lodash-es/_nativeCreate.mjs +1 -2
  183. package/lib/node_modules/lodash-es/_nativeKeys.mjs +1 -2
  184. package/lib/node_modules/lodash-es/_nodeUtil.mjs +1 -2
  185. package/lib/node_modules/lodash-es/_objectToString.mjs +1 -2
  186. package/lib/node_modules/lodash-es/_overArg.mjs +1 -2
  187. package/lib/node_modules/lodash-es/_root.mjs +1 -2
  188. package/lib/node_modules/lodash-es/_setCacheAdd.mjs +1 -2
  189. package/lib/node_modules/lodash-es/_setCacheHas.mjs +1 -2
  190. package/lib/node_modules/lodash-es/_setToArray.mjs +1 -2
  191. package/lib/node_modules/lodash-es/_stackClear.mjs +1 -2
  192. package/lib/node_modules/lodash-es/_stackDelete.mjs +1 -2
  193. package/lib/node_modules/lodash-es/_stackGet.mjs +1 -2
  194. package/lib/node_modules/lodash-es/_stackHas.mjs +1 -2
  195. package/lib/node_modules/lodash-es/_stackSet.mjs +1 -2
  196. package/lib/node_modules/lodash-es/_stringToArray.cjs +1 -1
  197. package/lib/node_modules/lodash-es/_stringToArray.mjs +5 -6
  198. package/lib/node_modules/lodash-es/_stringToPath.mjs +1 -2
  199. package/lib/node_modules/lodash-es/_toKey.mjs +1 -2
  200. package/lib/node_modules/lodash-es/_toSource.mjs +1 -2
  201. package/lib/node_modules/lodash-es/_trimmedEndIndex.mjs +1 -2
  202. package/lib/node_modules/lodash-es/_unicodeToArray.mjs +1 -2
  203. package/lib/node_modules/lodash-es/capitalize.mjs +1 -2
  204. package/lib/node_modules/lodash-es/concat.cjs +1 -1
  205. package/lib/node_modules/lodash-es/concat.mjs +7 -8
  206. package/lib/node_modules/lodash-es/eq.mjs +1 -2
  207. package/lib/node_modules/lodash-es/first.mjs +1 -1
  208. package/lib/node_modules/lodash-es/flatten.mjs +1 -2
  209. package/lib/node_modules/lodash-es/flattenDeep.mjs +1 -2
  210. package/lib/node_modules/lodash-es/flattenDepth.cjs +1 -1
  211. package/lib/node_modules/lodash-es/flattenDepth.mjs +5 -6
  212. package/lib/node_modules/lodash-es/forEach.cjs +1 -1
  213. package/lib/node_modules/lodash-es/forEach.mjs +7 -8
  214. package/lib/node_modules/lodash-es/get.mjs +1 -2
  215. package/lib/node_modules/lodash-es/groupBy.mjs +1 -2
  216. package/lib/node_modules/lodash-es/hasIn.mjs +1 -2
  217. package/lib/node_modules/lodash-es/head.mjs +1 -2
  218. package/lib/node_modules/lodash-es/identity.mjs +1 -2
  219. package/lib/node_modules/lodash-es/isArguments.cjs +1 -1
  220. package/lib/node_modules/lodash-es/isArguments.mjs +6 -7
  221. package/lib/node_modules/lodash-es/isArray.mjs +1 -2
  222. package/lib/node_modules/lodash-es/isArrayLike.mjs +1 -2
  223. package/lib/node_modules/lodash-es/isBuffer.mjs +1 -2
  224. package/lib/node_modules/lodash-es/isEmpty.cjs +1 -1
  225. package/lib/node_modules/lodash-es/isEmpty.mjs +13 -14
  226. package/lib/node_modules/lodash-es/isFunction.mjs +1 -2
  227. package/lib/node_modules/lodash-es/isLength.mjs +1 -2
  228. package/lib/node_modules/lodash-es/isNil.mjs +1 -2
  229. package/lib/node_modules/lodash-es/isObject.mjs +1 -2
  230. package/lib/node_modules/lodash-es/isObjectLike.mjs +1 -2
  231. package/lib/node_modules/lodash-es/isSymbol.mjs +1 -2
  232. package/lib/node_modules/lodash-es/isTypedArray.mjs +1 -2
  233. package/lib/node_modules/lodash-es/keys.cjs +1 -1
  234. package/lib/node_modules/lodash-es/keys.mjs +6 -7
  235. package/lib/node_modules/lodash-es/last.mjs +1 -2
  236. package/lib/node_modules/lodash-es/lodash.cjs +1 -1
  237. package/lib/node_modules/lodash-es/lodash.mjs +19 -19
  238. package/lib/node_modules/lodash-es/memoize.mjs +1 -2
  239. package/lib/node_modules/lodash-es/nth.cjs +1 -1
  240. package/lib/node_modules/lodash-es/nth.mjs +5 -6
  241. package/lib/node_modules/lodash-es/property.cjs +1 -1
  242. package/lib/node_modules/lodash-es/property.mjs +7 -8
  243. package/lib/node_modules/lodash-es/reduce.cjs +1 -1
  244. package/lib/node_modules/lodash-es/reduce.mjs +8 -9
  245. package/lib/node_modules/lodash-es/stubArray.mjs +1 -2
  246. package/lib/node_modules/lodash-es/stubFalse.mjs +1 -2
  247. package/lib/node_modules/lodash-es/toFinite.mjs +1 -2
  248. package/lib/node_modules/lodash-es/toInteger.mjs +1 -2
  249. package/lib/node_modules/lodash-es/toNumber.cjs +1 -1
  250. package/lib/node_modules/lodash-es/toNumber.mjs +9 -10
  251. package/lib/node_modules/lodash-es/toString.mjs +1 -2
  252. package/lib/node_modules/lodash-es/upperFirst.mjs +1 -2
  253. package/lib/node_modules/luxon/build/es6/luxon.mjs +1 -2
  254. package/lib/node_modules/parsimmon/build/parsimmon.umd.min.cjs +1 -1
  255. package/lib/node_modules/parsimmon/build/parsimmon.umd.min.mjs +3 -4
  256. package/lib/node_modules/pluralize/pluralize.cjs +1 -1
  257. package/lib/node_modules/pluralize/pluralize.mjs +3 -4
  258. package/lib/packages/dbml-core/node_modules/lodash/lodash.cjs +2 -2
  259. package/lib/packages/dbml-core/node_modules/lodash/lodash.mjs +3 -4
  260. package/lib/packages/dbml-core/package.json.cjs +1 -1
  261. package/lib/packages/dbml-core/package.json.mjs +2 -3
  262. package/lib/parse/ANTLR/ASTGeneration/AST.mjs +1 -2
  263. package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.mjs +1 -2
  264. package/lib/parse/ANTLR/ASTGeneration/SyntaxError.mjs +1 -2
  265. package/lib/parse/ANTLR/ASTGeneration/constants.mjs +1 -2
  266. package/lib/parse/ANTLR/ASTGeneration/helpers.mjs +1 -2
  267. package/lib/parse/ANTLR/ASTGeneration/index.mjs +1 -2
  268. package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.mjs +1 -2
  269. package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.cjs +1 -1
  270. package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.mjs +2 -3
  271. package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.cjs +1 -1
  272. package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.mjs +57 -58
  273. package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.cjs +1 -1
  274. package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.mjs +2 -3
  275. package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.mjs +1 -2
  276. package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.mjs +1 -2
  277. package/lib/parse/ANTLR/parsers/mssql/TSqlParser.mjs +1 -2
  278. package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.mjs +1 -2
  279. package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.mjs +1 -2
  280. package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.mjs +1 -2
  281. package/lib/parse/ANTLR/parsers/mysql/MySqlParser.mjs +1 -2
  282. package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.mjs +1 -2
  283. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.mjs +1 -2
  284. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.mjs +1 -2
  285. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.mjs +1 -2
  286. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.mjs +1 -2
  287. package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.mjs +1 -2
  288. package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.mjs +1 -2
  289. package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexerBase.mjs +1 -2
  290. package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.mjs +1 -2
  291. package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserBase.mjs +1 -2
  292. package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.mjs +1 -2
  293. package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.mjs +1 -2
  294. package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.mjs +1 -2
  295. package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.mjs +1 -2
  296. package/lib/parse/Parser.cjs +1 -1
  297. package/lib/parse/Parser.mjs +37 -38
  298. package/lib/parse/databaseGenerator.mjs +1 -2
  299. package/lib/parse/deprecated/dbmlParser.mjs +1 -2
  300. package/lib/parse/deprecated/mssql/base_parsers.cjs +1 -1
  301. package/lib/parse/deprecated/mssql/base_parsers.mjs +27 -28
  302. package/lib/parse/deprecated/mssql/column_definition/actions.mjs +1 -2
  303. package/lib/parse/deprecated/mssql/column_definition/index.cjs +1 -1
  304. package/lib/parse/deprecated/mssql/column_definition/index.mjs +19 -19
  305. package/lib/parse/deprecated/mssql/constraint_definition/actions.mjs +1 -2
  306. package/lib/parse/deprecated/mssql/constraint_definition/index.cjs +1 -1
  307. package/lib/parse/deprecated/mssql/constraint_definition/index.mjs +10 -10
  308. package/lib/parse/deprecated/mssql/expression.cjs +1 -1
  309. package/lib/parse/deprecated/mssql/expression.mjs +17 -18
  310. package/lib/parse/deprecated/mssql/fk_definition/actions.mjs +1 -2
  311. package/lib/parse/deprecated/mssql/fk_definition/index.cjs +1 -1
  312. package/lib/parse/deprecated/mssql/fk_definition/index.mjs +7 -8
  313. package/lib/parse/deprecated/mssql/index.mjs +1 -2
  314. package/lib/parse/deprecated/mssql/index_definition/actions.mjs +1 -2
  315. package/lib/parse/deprecated/mssql/index_definition/index.cjs +1 -1
  316. package/lib/parse/deprecated/mssql/index_definition/index.mjs +13 -14
  317. package/lib/parse/deprecated/mssql/keyword_parsers.mjs +1 -2
  318. package/lib/parse/deprecated/mssql/keyword_utils.mjs +1 -2
  319. package/lib/parse/deprecated/mssql/statements/actions.mjs +1 -2
  320. package/lib/parse/deprecated/mssql/statements/index.cjs +1 -1
  321. package/lib/parse/deprecated/mssql/statements/index.mjs +23 -24
  322. package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/actions.mjs +1 -2
  323. package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/actions.mjs +1 -1
  324. package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/index.cjs +1 -1
  325. package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/index.mjs +13 -14
  326. package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/index.mjs +1 -2
  327. package/lib/parse/deprecated/mssql/statements/statement_types/comments/actions.mjs +1 -2
  328. package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.cjs +1 -1
  329. package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.mjs +5 -6
  330. package/lib/parse/deprecated/mssql/statements/statement_types/create_index/actions.mjs +1 -2
  331. package/lib/parse/deprecated/mssql/statements/statement_types/create_index/index.cjs +1 -1
  332. package/lib/parse/deprecated/mssql/statements/statement_types/create_index/index.mjs +11 -12
  333. package/lib/parse/deprecated/mssql/statements/statement_types/create_table/actions.mjs +1 -2
  334. package/lib/parse/deprecated/mssql/statements/statement_types/create_table/index.cjs +1 -1
  335. package/lib/parse/deprecated/mssql/statements/statement_types/create_table/index.mjs +11 -12
  336. package/lib/parse/deprecated/mssql/statements/statement_types/index.mjs +1 -1
  337. package/lib/parse/deprecated/mssql/utils.cjs +1 -1
  338. package/lib/parse/deprecated/mssql/utils.mjs +10 -11
  339. package/lib/parse/deprecated/mssql/whitespaces.mjs +1 -2
  340. package/lib/parse/deprecated/mssqlParser.mjs +1 -2
  341. package/lib/parse/deprecated/mysqlParser.mjs +1 -2
  342. package/lib/parse/deprecated/postgresParser.mjs +1 -2
  343. package/lib/parse/deprecated/schemarbParser.mjs +1 -2
  344. package/lib/parse/error.mjs +1 -2
  345. package/lib/transform/index.cjs +1 -1
  346. package/lib/transform/index.mjs +10 -7
  347. package/lib/transform/relations.mjs +1 -2
  348. package/lib/utils/version.mjs +1 -2
  349. package/package.json +3 -3
  350. package/types/index.d.ts +8 -0
  351. package/types/model_structure/database.d.ts +26 -0
  352. package/types/model_structure/dbState.d.ts +3 -0
  353. package/types/model_structure/group.d.ts +41 -0
  354. package/types/model_structure/link.d.ts +37 -0
  355. package/types/model_structure/node.d.ts +41 -0
  356. package/types/transform/index.d.ts +7 -0
@@ -3,26 +3,61 @@ import t from "../node_modules/lodash-es/capitalize.mjs";
3
3
  import { init_lodash as n } from "../node_modules/lodash-es/lodash.mjs";
4
4
  import { DEFAULT_SCHEMA_NAME as r, ENUM as i, NOTE as a, TABLE as o, TABLE_GROUP as s } from "./config.mjs";
5
5
  import c from "./dbState.mjs";
6
- import l from "./element.mjs";
7
- import u from "./dep.mjs";
6
+ import l from "./dep.mjs";
7
+ import u from "./element.mjs";
8
8
  import d from "./enum.mjs";
9
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";
10
+ import p from "./schema.mjs";
11
+ import m from "./stickyNote.mjs";
12
+ import h from "./table.mjs";
13
+ import g from "./tableGroup.mjs";
14
14
  import _ from "./tablePartial.mjs";
15
- import { makeCardinalityRequired as v, parseCardinality as y } from "@dbml/parse";
16
- //#region src/model_structure/database.ts
15
+ import v from "./node.mjs";
16
+ import y from "./group.mjs";
17
+ import b from "./link.mjs";
18
+ import { makeCardinalityRequired as x, parseCardinality as S } from "@dbml/parse";
19
+ // src/model_structure/database.ts
17
20
  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 = [] } = {}) {
21
+ var C = class extends u {
22
+ constructor({ schemas: t = [], tables: n = [], notes: l = [], enums: u = [], refs: d = [], deps: p = [], tableGroups: m = [], project: h = {}, aliases: g = [], records: _ = [], tablePartials: v = [], diagramViews: y = [], nodes: b = [], groups: x = [], links: S = [], frontMatter: C, diagramType: w } = {}) {
20
23
  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
24
  let t = this.findOrCreateSchema(r), n = new f({
22
25
  ...e,
23
26
  schema: t
24
27
  });
25
28
  t.refs.some((e) => e.equals(n)) || t.pushRef(n);
29
+ }), this.nodes = [], this.groups = [], this.links = [], this.diagramType = w ?? null, this.frontMatter = C ?? null, this.processArch(b, x, S);
30
+ }
31
+ processArch(e, t, n) {
32
+ e.forEach((e) => this.nodes.push(new v({
33
+ ...e,
34
+ database: this
35
+ }))), t.forEach((e) => this.groups.push(new y({
36
+ ...e,
37
+ database: this
38
+ })));
39
+ let r = (e, t) => `${t}\u0000${e}`, i = /* @__PURE__ */ new Map(), a = (e, t, n, a) => {
40
+ let o = r(e, t);
41
+ i.has(o) || i.set(o, {
42
+ type: n,
43
+ element: a
44
+ });
45
+ };
46
+ this.nodes.forEach((e) => a(e.alias ?? e.name, e.role, "node", e)), this.groups.forEach((e) => a(e.alias ?? e.name, "Group", "group", e)), this.notes.forEach((e) => a(e.name, "Note", "note", e)), this.groups.forEach((e) => {
47
+ e.children.forEach(({ handle: t, role: n }) => {
48
+ let a = i.get(r(t, n));
49
+ a && (e.childIds.push(a.element.id), e.childTypes.push(a.type), (a.element instanceof v || a.element instanceof y) && (a.element.groupId = e.id));
50
+ });
51
+ }), n.forEach(({ from: e, fromRole: t, to: n, toRole: a, ...o }) => {
52
+ let s = i.get(r(e, t)), c = i.get(r(n, a));
53
+ s && c && this.links.push(new b({
54
+ ...o,
55
+ fromId: s.element.id,
56
+ fromType: s.type,
57
+ toId: c.element.id,
58
+ toType: c.type,
59
+ database: this
60
+ }));
26
61
  });
27
62
  }
28
63
  generateId() {
@@ -30,7 +65,7 @@ var b = class extends l {
30
65
  }
31
66
  processNotes(e) {
32
67
  e.forEach((e) => {
33
- this.pushNote(new g({
68
+ this.pushNote(new m({
34
69
  ...e,
35
70
  database: this
36
71
  }));
@@ -65,7 +100,7 @@ var b = class extends l {
65
100
  }
66
101
  processSchemas(e) {
67
102
  e.forEach((e) => {
68
- this.pushSchema(new h({
103
+ this.pushSchema(new p({
69
104
  ...e,
70
105
  database: this
71
106
  }));
@@ -82,7 +117,7 @@ var b = class extends l {
82
117
  e.forEach((e) => {
83
118
  switch (e.schemaName ? (n = this.findOrCreateSchema(e.schemaName), e.schemaName) : n = this.findOrCreateSchema(r), t) {
84
119
  case o:
85
- n.pushTable(new p({
120
+ n.pushTable(new h({
86
121
  ...e,
87
122
  schema: n
88
123
  }));
@@ -94,7 +129,7 @@ var b = class extends l {
94
129
  }));
95
130
  break;
96
131
  case s:
97
- n.pushTableGroup(new m({
132
+ n.pushTableGroup(new g({
98
133
  ...e,
99
134
  schema: n
100
135
  }));
@@ -105,7 +140,7 @@ var b = class extends l {
105
140
  schema: n
106
141
  }));
107
142
  break;
108
- case "dep": n.pushDep(new u({
143
+ case "dep": n.pushDep(new l({
109
144
  ...e,
110
145
  schema: n
111
146
  }));
@@ -125,7 +160,7 @@ var b = class extends l {
125
160
  }
126
161
  findOrCreateSchema(e) {
127
162
  let n = this.schemas.find((t) => t.name === e || t.alias === e);
128
- return n || (n = new h({
163
+ return n || (n = new p({
129
164
  name: e,
130
165
  note: { value: e === "public" ? `Default ${t(r)} Schema` : null },
131
166
  database: this
@@ -155,10 +190,10 @@ var b = class extends l {
155
190
  adjustCardinalitiesFromColumns() {
156
191
  this.schemas.forEach((e) => {
157
192
  e.refs.forEach((e) => {
158
- let t = e.endpoints.find((e) => y(e.relation).max === "*"), n = e.endpoints.find((e) => y(e.relation).max === 1);
193
+ let t = e.endpoints.find((e) => S(e.relation).max === "*"), n = e.endpoints.find((e) => S(e.relation).max === 1);
159
194
  if (!n) return;
160
195
  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 = v(i.relation));
196
+ 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 = x(i.relation));
162
197
  });
163
198
  });
164
199
  }
@@ -177,13 +212,35 @@ var b = class extends l {
177
212
  return {
178
213
  schemas: this.schemas.map((e) => e.export()),
179
214
  notes: this.notes.map((e) => e.export()),
180
- records: this.records.map((e) => ({ ...e }))
215
+ records: this.records.map((e) => ({ ...e })),
216
+ ...this.archEntries((e) => e.map((e) => e.export()))
181
217
  };
182
218
  }
183
219
  exportChildIds() {
184
220
  return {
185
221
  schemaIds: this.schemas.map((e) => e.id),
186
- noteIds: this.notes.map((e) => e.id)
222
+ noteIds: this.notes.map((e) => e.id),
223
+ ...this.archIds(),
224
+ ...this.diagramType ? { diagramType: this.diagramType } : {},
225
+ ...this.frontMatter ? { frontMatter: this.frontMatter } : {}
226
+ };
227
+ }
228
+ archEntries(e) {
229
+ let t = {}, n = {
230
+ nodes: this.nodes,
231
+ groups: this.groups,
232
+ links: this.links
233
+ };
234
+ return Object.entries(n).forEach(([n, r]) => {
235
+ r.length && (t[n] = e(r));
236
+ }), t;
237
+ }
238
+ archIds() {
239
+ let e = this.archEntries((e) => e.map((e) => e.id));
240
+ return {
241
+ ...e.nodes ? { nodeIds: e.nodes } : {},
242
+ ...e.groups ? { groupIds: e.groups } : {},
243
+ ...e.links ? { linkIds: e.links } : {}
187
244
  };
188
245
  }
189
246
  normalize() {
@@ -212,8 +269,9 @@ var b = class extends l {
212
269
  };
213
270
  return this.schemas.forEach((t) => t.normalize(e)), this.notes.forEach((t) => t.normalize(e)), this.records.forEach((t) => {
214
271
  e.records[t.id] = { ...t };
215
- }), this.tablePartials.forEach((t) => t.normalize(e)), e;
272
+ }), this.tablePartials.forEach((t) => t.normalize(e)), Object.entries(this.archEntries((e) => e)).forEach(([t, n]) => {
273
+ e[t] = {}, n.forEach((t) => t.normalize(e));
274
+ }), e;
216
275
  }
217
276
  };
218
- //#endregion
219
- export { b as default };
277
+ export { C as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs");var e=class{constructor(){this.dbId=1,this.schemaId=1,this.enumId=1,this.tableGroupId=1,this.refId=1,this.depId=1,this.depEdgeId=1,this.tableId=1,this.noteId=1,this.enumValueId=1,this.endpointId=1,this.indexId=1,this.checkId=1,this.fieldId=1,this.indexColumnId=1,this.recordId=1,this.tablePartialId=1}generateId(e){let t=this[e];return this[e]+=1,t}};exports.default=e;
1
+ require("../_virtual/_rolldown/runtime.cjs");var e=class{constructor(){this.dbId=1,this.schemaId=1,this.enumId=1,this.tableGroupId=1,this.refId=1,this.depId=1,this.depEdgeId=1,this.tableId=1,this.noteId=1,this.enumValueId=1,this.endpointId=1,this.indexId=1,this.checkId=1,this.fieldId=1,this.indexColumnId=1,this.recordId=1,this.tablePartialId=1,this.nodeId=1,this.groupId=1,this.linkId=1}generateId(e){let t=this[e];return this[e]+=1,t}};exports.default=e;
@@ -1,12 +1,11 @@
1
- //#region src/model_structure/dbState.ts
1
+ // src/model_structure/dbState.ts
2
2
  var e = class {
3
3
  constructor() {
4
- this.dbId = 1, this.schemaId = 1, this.enumId = 1, this.tableGroupId = 1, this.refId = 1, this.depId = 1, this.depEdgeId = 1, this.tableId = 1, this.noteId = 1, this.enumValueId = 1, this.endpointId = 1, this.indexId = 1, this.checkId = 1, this.fieldId = 1, this.indexColumnId = 1, this.recordId = 1, this.tablePartialId = 1;
4
+ this.dbId = 1, this.schemaId = 1, this.enumId = 1, this.tableGroupId = 1, this.refId = 1, this.depId = 1, this.depEdgeId = 1, this.tableId = 1, this.noteId = 1, this.enumValueId = 1, this.endpointId = 1, this.indexId = 1, this.checkId = 1, this.fieldId = 1, this.indexColumnId = 1, this.recordId = 1, this.tablePartialId = 1, this.nodeId = 1, this.groupId = 1, this.linkId = 1;
5
5
  }
6
6
  generateId(e) {
7
7
  let t = this[e];
8
8
  return this[e] += 1, t;
9
9
  }
10
10
  };
11
- //#endregion
12
11
  export { e as default };
@@ -1 +1 @@
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
+ 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("./depEdge.cjs"),r=require("./element.cjs");t.init_lodash();var i=class extends r.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`,r=e.downstream?.schemaName||`public`,i=e.upstream?.tableName,a=e.downstream?.tableName,o=e.upstream?.fieldNames?.join(`,`),s=e.downstream?.fieldNames?.join(`,`);t===r&&i===a&&o===s&&o&&this.error(`Self-loop Dep edge not allowed: "${t}"."${i}" columns cannot depend on itself`),this.edges.push(new n.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,11 +1,11 @@
1
1
  import e from "../node_modules/lodash-es/get.mjs";
2
2
  import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
3
  import "./config.mjs";
4
- import n from "./element.mjs";
5
- import r from "./depEdge.mjs";
6
- //#region src/model_structure/dep.ts
4
+ import n from "./depEdge.mjs";
5
+ import r from "./element.mjs";
6
+ // src/model_structure/dep.ts
7
7
  t();
8
- var i = class extends n {
8
+ var i = class extends r {
9
9
  constructor({ name: t, color: n, note: r, metadata: i, edges: a, token: o, schema: s = {} }) {
10
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 ?? []);
11
11
  }
@@ -14,8 +14,8 @@ var i = class extends n {
14
14
  }
15
15
  processEdges(e) {
16
16
  e.forEach((e) => {
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
+ let t = 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(",");
18
+ t === r && i === a && o === s && o && this.error(`Self-loop Dep edge not allowed: "${t}"."${i}" columns cannot depend on itself`), this.edges.push(new n({
19
19
  ...e,
20
20
  dep: this
21
21
  }));
@@ -53,5 +53,4 @@ var i = class extends n {
53
53
  }, this.edges.forEach((t) => t.normalize(e));
54
54
  }
55
55
  };
56
- //#endregion
57
56
  export { i as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./utils.cjs"),t=require("./element.cjs");var n=class extends t.default{constructor({upstream:e,downstream:t,token:n,dep:r}){super(n),this.upstream={schemaName:e.schemaName??null,tableName:e.tableName,fieldNames:e.fieldNames??[]},this.downstream={schemaName:t.schemaName??null,tableName:t.tableName,fieldNames:t.fieldNames??[]},this.dep=r,this.dbState=this.dep.dbState,this.generateId();let i=this.dep.schema.database,a=this.resolveEndpoint(this.upstream,i),o=this.resolveEndpoint(this.downstream,i);this.upstreamTable=a.table,this.upstreamFields=a.fields,this.downstreamTable=o.table,this.downstreamFields=o.fields,this.upstreamFields.forEach(e=>e.pushDepEdge(this)),this.downstreamFields.forEach(e=>e.pushDepEdge(this))}resolveEndpoint(t,n){let r=t.schemaName||`public`,i=n.findTable(r,t.tableName);return i||this.error(`Can't find table ${e.shouldPrintSchemaName(r)?`"${r}".`:``}"${t.tableName}" referenced in Dep edge`),{table:i,fields:(t.fieldNames??[]).map(t=>{let n=i.findField(t);return n||this.error(`Can't find field ${e.shouldPrintSchema(i.schema)?`"${i.schema.name}".`:``}"${t}" in table "${i.name}" referenced in Dep edge`),n})}}generateId(){this.id=this.dbState.generateId(`depEdgeId`)}export(){return this.shallowExport()}shallowExport(){return{upstream:this.upstream,downstream:this.downstream}}exportParentIds(){return{depId:this.dep.id,upstreamTableId:this.upstreamTable?this.upstreamTable.id:null,upstreamFieldIds:this.upstreamFields.map(e=>e.id),downstreamTableId:this.downstreamTable?this.downstreamTable.id:null,downstreamFieldIds:this.downstreamFields.map(e=>e.id)}}normalize(e){e.depEdges||={},e.depEdges[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=n;
1
+ require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./element.cjs"),t=require("./utils.cjs");var n=class extends e.default{constructor({upstream:e,downstream:t,token:n,dep:r}){super(n),this.upstream={schemaName:e.schemaName??null,tableName:e.tableName,fieldNames:e.fieldNames??[]},this.downstream={schemaName:t.schemaName??null,tableName:t.tableName,fieldNames:t.fieldNames??[]},this.dep=r,this.dbState=this.dep.dbState,this.generateId();let i=this.dep.schema.database,a=this.resolveEndpoint(this.upstream,i),o=this.resolveEndpoint(this.downstream,i);this.upstreamTable=a.table,this.upstreamFields=a.fields,this.downstreamTable=o.table,this.downstreamFields=o.fields,this.upstreamFields.forEach(e=>e.pushDepEdge(this)),this.downstreamFields.forEach(e=>e.pushDepEdge(this))}resolveEndpoint(e,n){let r=e.schemaName||`public`,i=n.findTable(r,e.tableName);return i||this.error(`Can't find table ${t.shouldPrintSchemaName(r)?`"${r}".`:``}"${e.tableName}" referenced in Dep edge`),{table:i,fields:(e.fieldNames??[]).map(e=>{let n=i.findField(e);return n||this.error(`Can't find field ${t.shouldPrintSchema(i.schema)?`"${i.schema.name}".`:``}"${e}" in table "${i.name}" referenced in Dep edge`),n})}}generateId(){this.id=this.dbState.generateId(`depEdgeId`)}export(){return this.shallowExport()}shallowExport(){return{upstream:this.upstream,downstream:this.downstream}}exportParentIds(){return{depId:this.dep.id,upstreamTableId:this.upstreamTable?this.upstreamTable.id:null,upstreamFieldIds:this.upstreamFields.map(e=>e.id),downstreamTableId:this.downstreamTable?this.downstreamTable.id:null,downstreamFieldIds:this.downstreamFields.map(e=>e.id)}}normalize(e){e.depEdges||={},e.depEdges[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=n;
@@ -1,8 +1,8 @@
1
1
  import "./config.mjs";
2
- import { shouldPrintSchema as e, shouldPrintSchemaName as t } from "./utils.mjs";
3
- import n from "./element.mjs";
4
- //#region src/model_structure/depEdge.ts
5
- var r = class extends n {
2
+ import e from "./element.mjs";
3
+ import { shouldPrintSchema as t, shouldPrintSchemaName as n } from "./utils.mjs";
4
+ // src/model_structure/depEdge.ts
5
+ var r = class extends e {
6
6
  constructor({ upstream: e, downstream: t, token: n, dep: r }) {
7
7
  super(n), this.upstream = {
8
8
  schemaName: e.schemaName ?? null,
@@ -16,13 +16,13 @@ var r = class extends n {
16
16
  let i = this.dep.schema.database, a = this.resolveEndpoint(this.upstream, i), o = this.resolveEndpoint(this.downstream, i);
17
17
  this.upstreamTable = a.table, this.upstreamFields = a.fields, this.downstreamTable = o.table, this.downstreamFields = o.fields, this.upstreamFields.forEach((e) => e.pushDepEdge(this)), this.downstreamFields.forEach((e) => e.pushDepEdge(this));
18
18
  }
19
- resolveEndpoint(n, r) {
20
- let i = n.schemaName || "public", a = r.findTable(i, n.tableName);
21
- return a || this.error(`Can't find table ${t(i) ? `"${i}".` : ""}"${n.tableName}" referenced in Dep edge`), {
19
+ resolveEndpoint(e, r) {
20
+ let i = e.schemaName || "public", a = r.findTable(i, e.tableName);
21
+ return a || this.error(`Can't find table ${n(i) ? `"${i}".` : ""}"${e.tableName}" referenced in Dep edge`), {
22
22
  table: a,
23
- fields: (n.fieldNames ?? []).map((t) => {
24
- let n = a.findField(t);
25
- return n || this.error(`Can't find field ${e(a.schema) ? `"${a.schema.name}".` : ""}"${t}" in table "${a.name}" referenced in Dep edge`), n;
23
+ fields: (e.fieldNames ?? []).map((e) => {
24
+ let n = a.findField(e);
25
+ return n || this.error(`Can't find field ${t(a.schema) ? `"${a.schema.name}".` : ""}"${e}" in table "${a.name}" referenced in Dep edge`), n;
26
26
  })
27
27
  };
28
28
  }
@@ -55,5 +55,4 @@ var r = class extends n {
55
55
  };
56
56
  }
57
57
  };
58
- //#endregion
59
58
  export { r as default };
@@ -1,4 +1,4 @@
1
- //#region src/model_structure/element.js
1
+ // src/model_structure/element.js
2
2
  var e = class extends Error {
3
3
  constructor(e, t = { start: {
4
4
  line: 1,
@@ -17,5 +17,4 @@ var e = class extends Error {
17
17
  throw new e(t, this.token);
18
18
  }
19
19
  };
20
- //#endregion
21
20
  export { t as default };
@@ -1 +1 @@
1
- require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./utils.cjs"),t=require("./element.cjs");var n=class extends t.default{constructor({tableName:t,schemaName:n,fieldNames:r,relation:i,token:a,ref:o}){super(a),this.relation=i,this.schemaName=n,this.tableName=t,this.fieldNames=r,this.fields=[],this.ref=o,this.dbState=this.ref.dbState,this.generateId();let s=o.schema.database.findOrCreateSchema(n||`public`).database.findTable(n,t);s||this.error(`Can't find table ${e.shouldPrintSchemaName(n)?`"${n}".`:``}"${t}"`),this.setFields(r,s)}generateId(){this.id=this.dbState.generateId(`endpointId`)}equals(e){return this.fields.length===e.fields.length&&this.compareFields(e)}compareFields(e){let t=this.fields.map(e=>e.id).sort(),n=e.fields.map(e=>e.id).sort();for(let e=0;e<t.length;e+=1)if(t[e]!==n[e])return!1;return!0}export(){return{...this.shallowExport()}}exportParentIds(){return{refId:this.ref.id,fieldIds:this.fields.map(e=>e.id)}}shallowExport(){return{schemaName:this.schemaName,tableName:this.tableName,fieldNames:this.fieldNames,relation:this.relation}}setFields(t,n){let r=t&&t.length?[...t]:[];if(!r.length){let t=n.fields.find(e=>e.pk);if(t)r.push(t.name);else{let t=n.indexes.find(e=>e.pk);t?r=t.columns.map(e=>e.value):this.error(`Can't find primary or composite key in table ${e.shouldPrintSchema(n.schema)?`"${n.schema.name}".`:``}"${n.name}"`)}}r.forEach(t=>{let r=n.findField(t);r||this.error(`Can't find field ${e.shouldPrintSchema(n.schema)?`"${n.schema.name}".`:``}"${t}" in table "${n.name}"`),this.fields.push(r),r.pushEndpoint(this)})}normalize(e){e.endpoints[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=n;
1
+ require("../_virtual/_rolldown/runtime.cjs"),require("./config.cjs");const e=require("./element.cjs"),t=require("./utils.cjs");var n=class extends e.default{constructor({tableName:e,schemaName:n,fieldNames:r,relation:i,token:a,ref:o}){super(a),this.relation=i,this.schemaName=n,this.tableName=e,this.fieldNames=r,this.fields=[],this.ref=o,this.dbState=this.ref.dbState,this.generateId();let s=o.schema.database.findOrCreateSchema(n||`public`).database.findTable(n,e);s||this.error(`Can't find table ${t.shouldPrintSchemaName(n)?`"${n}".`:``}"${e}"`),this.setFields(r,s)}generateId(){this.id=this.dbState.generateId(`endpointId`)}equals(e){return this.fields.length===e.fields.length&&this.compareFields(e)}compareFields(e){let t=this.fields.map(e=>e.id).sort(),n=e.fields.map(e=>e.id).sort();for(let e=0;e<t.length;e+=1)if(t[e]!==n[e])return!1;return!0}export(){return{...this.shallowExport()}}exportParentIds(){return{refId:this.ref.id,fieldIds:this.fields.map(e=>e.id)}}shallowExport(){return{schemaName:this.schemaName,tableName:this.tableName,fieldNames:this.fieldNames,relation:this.relation}}setFields(e,n){let r=e&&e.length?[...e]:[];if(!r.length){let e=n.fields.find(e=>e.pk);if(e)r.push(e.name);else{let e=n.indexes.find(e=>e.pk);e?r=e.columns.map(e=>e.value):this.error(`Can't find primary or composite key in table ${t.shouldPrintSchema(n.schema)?`"${n.schema.name}".`:``}"${n.name}"`)}}r.forEach(e=>{let r=n.findField(e);r||this.error(`Can't find field ${t.shouldPrintSchema(n.schema)?`"${n.schema.name}".`:``}"${e}" in table "${n.name}"`),this.fields.push(r),r.pushEndpoint(this)})}normalize(e){e.endpoints[this.id]={id:this.id,...this.shallowExport(),...this.exportParentIds()}}};exports.default=n;
@@ -1,12 +1,12 @@
1
1
  import "./config.mjs";
2
- import { shouldPrintSchema as e, shouldPrintSchemaName as t } from "./utils.mjs";
3
- import n from "./element.mjs";
4
- //#region src/model_structure/endpoint.js
5
- var r = class extends n {
6
- constructor({ tableName: e, schemaName: n, fieldNames: r, relation: i, token: a, ref: o }) {
7
- super(a), this.relation = i, this.schemaName = n, this.tableName = e, this.fieldNames = r, this.fields = [], this.ref = o, this.dbState = this.ref.dbState, this.generateId();
8
- let s = o.schema.database.findOrCreateSchema(n || "public").database.findTable(n, e);
9
- s || this.error(`Can't find table ${t(n) ? `"${n}".` : ""}"${e}"`), this.setFields(r, s);
2
+ import e from "./element.mjs";
3
+ import { shouldPrintSchema as t, shouldPrintSchemaName as n } from "./utils.mjs";
4
+ // src/model_structure/endpoint.js
5
+ var r = class extends e {
6
+ constructor({ tableName: e, schemaName: t, fieldNames: r, relation: i, token: a, ref: o }) {
7
+ super(a), this.relation = i, this.schemaName = t, this.tableName = e, this.fieldNames = r, this.fields = [], this.ref = o, this.dbState = this.ref.dbState, this.generateId();
8
+ let s = o.schema.database.findOrCreateSchema(t || "public").database.findTable(t, e);
9
+ s || this.error(`Can't find table ${n(t) ? `"${t}".` : ""}"${e}"`), this.setFields(r, s);
10
10
  }
11
11
  generateId() {
12
12
  this.id = this.dbState.generateId("endpointId");
@@ -36,19 +36,19 @@ var r = class extends n {
36
36
  relation: this.relation
37
37
  };
38
38
  }
39
- setFields(t, n) {
40
- let r = t && t.length ? [...t] : [];
39
+ setFields(e, n) {
40
+ let r = e && e.length ? [...e] : [];
41
41
  if (!r.length) {
42
- let t = n.fields.find((e) => e.pk);
43
- if (t) r.push(t.name);
42
+ let e = n.fields.find((e) => e.pk);
43
+ if (e) r.push(e.name);
44
44
  else {
45
- let t = n.indexes.find((e) => e.pk);
46
- t ? r = t.columns.map((e) => e.value) : this.error(`Can't find primary or composite key in table ${e(n.schema) ? `"${n.schema.name}".` : ""}"${n.name}"`);
45
+ let e = n.indexes.find((e) => e.pk);
46
+ e ? r = e.columns.map((e) => e.value) : this.error(`Can't find primary or composite key in table ${t(n.schema) ? `"${n.schema.name}".` : ""}"${n.name}"`);
47
47
  }
48
48
  }
49
- r.forEach((t) => {
50
- let r = n.findField(t);
51
- r || this.error(`Can't find field ${e(n.schema) ? `"${n.schema.name}".` : ""}"${t}" in table "${n.name}"`), this.fields.push(r), r.pushEndpoint(this);
49
+ r.forEach((e) => {
50
+ let r = n.findField(e);
51
+ r || this.error(`Can't find field ${t(n.schema) ? `"${n.schema.name}".` : ""}"${e}" in table "${n.name}"`), this.fields.push(r), r.pushEndpoint(this);
52
52
  });
53
53
  }
54
54
  normalize(e) {
@@ -59,5 +59,4 @@ var r = class extends n {
59
59
  };
60
60
  }
61
61
  };
62
- //#endregion
63
62
  export { r as default };
@@ -1 +1 @@
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
+ 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"),r=require("./enumValue.cjs"),i=require("./utils.cjs");t.init_lodash();var a=class extends n.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 r.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 ${i.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 ${i.shouldPrintSchema(e.table.schema)?`"${e.table.schema.name}".`:``}"${e.table.name}"."${e.name}" already associated with enum ${i.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,11 +1,11 @@
1
1
  import e from "../node_modules/lodash-es/get.mjs";
2
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";
6
- //#region src/model_structure/enum.js
3
+ import n from "./element.mjs";
4
+ import r from "./enumValue.mjs";
5
+ import { shouldPrintSchema as i } from "./utils.mjs";
6
+ // src/model_structure/enum.js
7
7
  t();
8
- var a = class extends r {
8
+ var a = class extends n {
9
9
  constructor({ name: t, token: n, values: r, note: i, schema: a, noteToken: o = null } = {}) {
10
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);
11
11
  }
@@ -14,7 +14,7 @@ var a = class extends r {
14
14
  }
15
15
  processValues(e) {
16
16
  e.forEach((e) => {
17
- this.pushValue(new i({
17
+ this.pushValue(new r({
18
18
  ...e,
19
19
  _enum: this
20
20
  }));
@@ -24,13 +24,13 @@ var a = class extends r {
24
24
  this.checkValue(e), this.values.push(e);
25
25
  }
26
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}"`);
27
+ this.values.some((t) => t.name === e.name) && e.error(`Enum value "${e.name}" existed in enum ${i(this.schema) ? `"${this.schema.name}".` : ""}"${this.name}"`);
28
28
  }
29
29
  pushField(e) {
30
30
  this.checkField(e), this.fields.push(e);
31
31
  }
32
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}"`);
33
+ this.fields.some((t) => t.id === e.id) && this.error(`Field ${i(e.table.schema) ? `"${e.table.schema.name}".` : ""}"${e.table.name}"."${e.name}" already associated with enum ${i(this.schema) ? `"${this.schema.name}".` : ""}${this.name}"`);
34
34
  }
35
35
  export() {
36
36
  return {
@@ -65,5 +65,4 @@ var a = class extends r {
65
65
  }, this.values.forEach((t) => t.normalize(e));
66
66
  }
67
67
  };
68
- //#endregion
69
68
  export { a as default };
@@ -1,7 +1,7 @@
1
1
  import e from "../node_modules/lodash-es/get.mjs";
2
2
  import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
3
  import n from "./element.mjs";
4
- //#region src/model_structure/enumValue.js
4
+ // src/model_structure/enumValue.js
5
5
  t();
6
6
  var r = class extends n {
7
7
  constructor({ name: t, token: n, note: r, _enum: i, noteToken: a = null } = {}) {
@@ -30,5 +30,4 @@ var r = class extends n {
30
30
  };
31
31
  }
32
32
  };
33
- //#endregion
34
33
  export { r as default };
@@ -1 +1 @@
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
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("../node_modules/lodash-es/get.cjs"),t=require("../node_modules/lodash-es/lodash.cjs"),n=require("./check.cjs");require("./config.cjs");const r=require("./element.cjs");t.init_lodash();var i=class extends r.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 n.default({...e,table:this.table,column:this}))})}};exports.default=i;
@@ -1,11 +1,11 @@
1
1
  import e from "../node_modules/lodash-es/get.mjs";
2
2
  import { init_lodash as t } from "../node_modules/lodash-es/lodash.mjs";
3
+ import n from "./check.mjs";
3
4
  import "./config.mjs";
4
- import n from "./element.mjs";
5
- import r from "./check.mjs";
6
- //#region src/model_structure/field.ts
5
+ import r from "./element.mjs";
6
+ // src/model_structure/field.ts
7
7
  t();
8
- var i = class extends n {
8
+ var i = class extends r {
9
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
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);
11
11
  }
@@ -73,7 +73,7 @@ var i = class extends n {
73
73
  }
74
74
  processChecks(e) {
75
75
  e.forEach((e) => {
76
- this.checks.push(new r({
76
+ this.checks.push(new n({
77
77
  ...e,
78
78
  table: this.table,
79
79
  column: this
@@ -81,5 +81,4 @@ var i = class extends n {
81
81
  });
82
82
  }
83
83
  };
84
- //#endregion
85
84
  export { i as default };
@@ -0,0 +1 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("./element.cjs");var t=class extends e.default{constructor({name:e,alias:t,children:n,settings:r,metadata:i={},note:a,token:o,database:s}){super(o),this.name=e,this.alias=t,this.children=n,this.childIds=[],this.childTypes=[],this.settings=r,this.metadata=i,this.note=a?.value??null,this.noteToken=a?.token??null,this.groupId=null,this.database=s,this.dbState=s.dbState,this.generateId()}generateId(){this.id=this.dbState.generateId(`groupId`)}export(){return{name:this.name,alias:this.alias,settings:this.settings,metadata:this.metadata,note:this.note}}normalize(e){e.groups[this.id]={id:this.id,...this.export(),childIds:this.childIds,childTypes:this.childTypes,groupId:this.groupId}}};exports.default=t;
@@ -0,0 +1,29 @@
1
+ import e from "./element.mjs";
2
+ // src/model_structure/group.ts
3
+ var t = class extends e {
4
+ constructor({ name: e, alias: t, children: n, settings: r, metadata: i = {}, note: a, token: o, database: s }) {
5
+ super(o), this.name = e, this.alias = t, this.children = n, this.childIds = [], this.childTypes = [], this.settings = r, this.metadata = i, this.note = a?.value ?? null, this.noteToken = a?.token ?? null, this.groupId = null, this.database = s, this.dbState = s.dbState, this.generateId();
6
+ }
7
+ generateId() {
8
+ this.id = this.dbState.generateId("groupId");
9
+ }
10
+ export() {
11
+ return {
12
+ name: this.name,
13
+ alias: this.alias,
14
+ settings: this.settings,
15
+ metadata: this.metadata,
16
+ note: this.note
17
+ };
18
+ }
19
+ normalize(e) {
20
+ e.groups[this.id] = {
21
+ id: this.id,
22
+ ...this.export(),
23
+ childIds: this.childIds,
24
+ childTypes: this.childTypes,
25
+ groupId: this.groupId
26
+ };
27
+ }
28
+ };
29
+ export { t as default };
@@ -1,5 +1,5 @@
1
1
  import e from "./element.mjs";
2
- //#region src/model_structure/indexColumn.js
2
+ // src/model_structure/indexColumn.js
3
3
  var t = class extends e {
4
4
  constructor({ type: e, value: t, sortOrder: n, index: r, token: i }) {
5
5
  super(), this.type = e, this.value = t, this.sortOrder = n, this.index = r, this.token = i, this.dbState = this.index.dbState, this.generateId();
@@ -28,5 +28,4 @@ var t = class extends e {
28
28
  };
29
29
  }
30
30
  };
31
- //#endregion
32
31
  export { t as default };
@@ -1,6 +1,6 @@
1
1
  import e from "./element.mjs";
2
2
  import t from "./indexColumn.mjs";
3
- //#region src/model_structure/indexes.js
3
+ // src/model_structure/indexes.js
4
4
  var n = class extends e {
5
5
  constructor({ columns: e, type: t, unique: n, pk: r, token: i, name: a, note: o, table: s = {}, injectedPartial: c = null } = {}) {
6
6
  super(i), this.name = a, this.type = t, this.unique = n, this.note = o ? o.value : null, this.noteToken = o ? o.token : null, this.pk = r, this.columns = [], this.table = s, this.injectedPartial = c, this.dbState = this.table.dbState, this.generateId(), this.processIndexColumns(e);
@@ -58,5 +58,4 @@ var n = class extends e {
58
58
  }, this.columns.forEach((t) => t.normalize(e));
59
59
  }
60
60
  };
61
- //#endregion
62
61
  export { n as default };
@@ -0,0 +1 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("./element.cjs");var t=class extends e.default{constructor({fromId:e,fromType:t,toId:n,toType:r,op:i,settings:a,token:o,database:s}){super(o),this.fromId=e,this.fromType=t,this.toId=n,this.toType=r,this.op=i,this.settings=a,this.database=s,this.dbState=s.dbState,this.generateId()}generateId(){this.id=this.dbState.generateId(`linkId`)}export(){return{op:this.op,settings:this.settings}}normalize(e){e.links[this.id]={id:this.id,...this.export(),fromId:this.fromId,fromType:this.fromType,toId:this.toId,toType:this.toType}}};exports.default=t;
@@ -0,0 +1,27 @@
1
+ import e from "./element.mjs";
2
+ // src/model_structure/link.ts
3
+ var t = class extends e {
4
+ constructor({ fromId: e, fromType: t, toId: n, toType: r, op: i, settings: a, token: o, database: s }) {
5
+ super(o), this.fromId = e, this.fromType = t, this.toId = n, this.toType = r, this.op = i, this.settings = a, this.database = s, this.dbState = s.dbState, this.generateId();
6
+ }
7
+ generateId() {
8
+ this.id = this.dbState.generateId("linkId");
9
+ }
10
+ export() {
11
+ return {
12
+ op: this.op,
13
+ settings: this.settings
14
+ };
15
+ }
16
+ normalize(e) {
17
+ e.links[this.id] = {
18
+ id: this.id,
19
+ ...this.export(),
20
+ fromId: this.fromId,
21
+ fromType: this.fromType,
22
+ toId: this.toId,
23
+ toType: this.toType
24
+ };
25
+ }
26
+ };
27
+ export { t as default };
@@ -0,0 +1 @@
1
+ require("../_virtual/_rolldown/runtime.cjs");const e=require("./element.cjs");var t=class extends e.default{constructor({name:e,alias:t,role:n,type:r,icon:i,settings:a,metadata:o={},note:s,token:c,database:l}){super(c),this.name=e,this.alias=t,this.role=n,this.type=r,this.icon=i,this.settings=a,this.metadata=o,this.note=s?.value??null,this.noteToken=s?.token??null,this.groupId=null,this.database=l,this.dbState=l.dbState,this.generateId()}generateId(){this.id=this.dbState.generateId(`nodeId`)}export(){return{name:this.name,alias:this.alias,role:this.role,type:this.type,icon:this.icon,settings:this.settings,metadata:this.metadata,note:this.note}}normalize(e){e.nodes[this.id]={id:this.id,...this.export(),groupId:this.groupId}}};exports.default=t;
@@ -0,0 +1,30 @@
1
+ import e from "./element.mjs";
2
+ // src/model_structure/node.ts
3
+ var t = class extends e {
4
+ constructor({ name: e, alias: t, role: n, type: r, icon: i, settings: a, metadata: o = {}, note: s, token: c, database: l }) {
5
+ super(c), this.name = e, this.alias = t, this.role = n, this.type = r, this.icon = i, this.settings = a, this.metadata = o, this.note = s?.value ?? null, this.noteToken = s?.token ?? null, this.groupId = null, this.database = l, this.dbState = l.dbState, this.generateId();
6
+ }
7
+ generateId() {
8
+ this.id = this.dbState.generateId("nodeId");
9
+ }
10
+ export() {
11
+ return {
12
+ name: this.name,
13
+ alias: this.alias,
14
+ role: this.role,
15
+ type: this.type,
16
+ icon: this.icon,
17
+ settings: this.settings,
18
+ metadata: this.metadata,
19
+ note: this.note
20
+ };
21
+ }
22
+ normalize(e) {
23
+ e.nodes[this.id] = {
24
+ id: this.id,
25
+ ...this.export(),
26
+ groupId: this.groupId
27
+ };
28
+ }
29
+ };
30
+ export { t as default };