@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.
- package/lib/_virtual/_rolldown/runtime.cjs +1 -1
- package/lib/_virtual/_rolldown/runtime.mjs +2 -3
- package/lib/export/DbmlExporter.cjs +1 -1
- package/lib/export/DbmlExporter.mjs +2 -3
- package/lib/export/JsonExporter.mjs +1 -2
- package/lib/export/ModelExporter.cjs +1 -1
- package/lib/export/ModelExporter.mjs +9 -10
- package/lib/export/MysqlExporter.mjs +1 -2
- package/lib/export/OracleExporter.mjs +1 -2
- package/lib/export/PostgresExporter.cjs +8 -8
- package/lib/export/PostgresExporter.mjs +30 -31
- package/lib/export/SqlServerExporter.mjs +1 -2
- package/lib/export/index.cjs +1 -1
- package/lib/export/index.mjs +5 -6
- package/lib/export/utils.mjs +1 -2
- package/lib/import/index.cjs +1 -1
- package/lib/import/index.mjs +10 -11
- package/lib/index.cjs +1 -1
- package/lib/index.mjs +9 -9
- package/lib/model_structure/check.mjs +1 -2
- package/lib/model_structure/config.mjs +1 -2
- package/lib/model_structure/database.cjs +1 -1
- package/lib/model_structure/database.mjs +81 -23
- package/lib/model_structure/dbState.cjs +1 -1
- package/lib/model_structure/dbState.mjs +2 -3
- package/lib/model_structure/dep.cjs +1 -1
- package/lib/model_structure/dep.mjs +6 -7
- package/lib/model_structure/depEdge.cjs +1 -1
- package/lib/model_structure/depEdge.mjs +10 -11
- package/lib/model_structure/element.mjs +1 -2
- package/lib/model_structure/endpoint.cjs +1 -1
- package/lib/model_structure/endpoint.mjs +17 -18
- package/lib/model_structure/enum.cjs +1 -1
- package/lib/model_structure/enum.mjs +8 -9
- package/lib/model_structure/enumValue.mjs +1 -2
- package/lib/model_structure/field.cjs +1 -1
- package/lib/model_structure/field.mjs +5 -6
- package/lib/model_structure/group.cjs +1 -0
- package/lib/model_structure/group.mjs +29 -0
- package/lib/model_structure/indexColumn.mjs +1 -2
- package/lib/model_structure/indexes.mjs +1 -2
- package/lib/model_structure/link.cjs +1 -0
- package/lib/model_structure/link.mjs +27 -0
- package/lib/model_structure/node.cjs +1 -0
- package/lib/model_structure/node.mjs +30 -0
- package/lib/model_structure/ref.mjs +1 -2
- package/lib/model_structure/schema.cjs +1 -1
- package/lib/model_structure/schema.mjs +15 -16
- package/lib/model_structure/stickyNote.mjs +1 -2
- package/lib/model_structure/table.cjs +1 -1
- package/lib/model_structure/table.mjs +28 -29
- package/lib/model_structure/tableGroup.cjs +1 -1
- package/lib/model_structure/tableGroup.mjs +5 -6
- package/lib/model_structure/tablePartial.mjs +1 -2
- package/lib/model_structure/utils.mjs +1 -2
- package/lib/node_modules/antlr4/dist/antlr4.web.mjs +1 -2
- package/lib/node_modules/lodash-es/_DataView.cjs +1 -1
- package/lib/node_modules/lodash-es/_DataView.mjs +4 -5
- package/lib/node_modules/lodash-es/_Hash.mjs +1 -2
- package/lib/node_modules/lodash-es/_ListCache.mjs +1 -2
- package/lib/node_modules/lodash-es/_Map.cjs +1 -1
- package/lib/node_modules/lodash-es/_Map.mjs +4 -5
- package/lib/node_modules/lodash-es/_MapCache.mjs +1 -2
- package/lib/node_modules/lodash-es/_Promise.cjs +1 -1
- package/lib/node_modules/lodash-es/_Promise.mjs +4 -5
- package/lib/node_modules/lodash-es/_Set.cjs +1 -1
- package/lib/node_modules/lodash-es/_Set.mjs +4 -5
- package/lib/node_modules/lodash-es/_SetCache.mjs +1 -2
- package/lib/node_modules/lodash-es/_Stack.mjs +1 -2
- package/lib/node_modules/lodash-es/_Symbol.mjs +1 -2
- package/lib/node_modules/lodash-es/_Uint8Array.mjs +1 -2
- package/lib/node_modules/lodash-es/_WeakMap.cjs +1 -1
- package/lib/node_modules/lodash-es/_WeakMap.mjs +4 -5
- package/lib/node_modules/lodash-es/_arrayAggregator.mjs +1 -2
- package/lib/node_modules/lodash-es/_arrayEach.mjs +1 -2
- package/lib/node_modules/lodash-es/_arrayFilter.mjs +1 -2
- package/lib/node_modules/lodash-es/_arrayLikeKeys.cjs +1 -1
- package/lib/node_modules/lodash-es/_arrayLikeKeys.mjs +9 -10
- package/lib/node_modules/lodash-es/_arrayMap.mjs +1 -2
- package/lib/node_modules/lodash-es/_arrayPush.mjs +1 -2
- package/lib/node_modules/lodash-es/_arrayReduce.mjs +1 -2
- package/lib/node_modules/lodash-es/_arraySome.mjs +1 -2
- package/lib/node_modules/lodash-es/_asciiToArray.mjs +1 -2
- package/lib/node_modules/lodash-es/_assocIndexOf.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseAggregator.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseAssignValue.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseEach.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseFlatten.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseFor.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseForOwn.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseForOwn.mjs +5 -6
- package/lib/node_modules/lodash-es/_baseGet.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseGetAllKeys.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseGetAllKeys.mjs +5 -6
- package/lib/node_modules/lodash-es/_baseGetTag.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseHasIn.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseIsArguments.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseIsEqual.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseIsEqual.mjs +5 -6
- package/lib/node_modules/lodash-es/_baseIsEqualDeep.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseIsEqualDeep.mjs +15 -16
- package/lib/node_modules/lodash-es/_baseIsMatch.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseIsNative.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseIsNative.mjs +6 -7
- package/lib/node_modules/lodash-es/_baseIsTypedArray.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseIsTypedArray.mjs +5 -6
- package/lib/node_modules/lodash-es/_baseIteratee.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseIteratee.mjs +7 -8
- package/lib/node_modules/lodash-es/_baseKeys.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseMatches.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseMatchesProperty.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseMatchesProperty.mjs +10 -11
- package/lib/node_modules/lodash-es/_baseNth.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseProperty.mjs +1 -2
- package/lib/node_modules/lodash-es/_basePropertyDeep.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseReduce.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseSlice.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseTimes.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseToString.cjs +1 -1
- package/lib/node_modules/lodash-es/_baseToString.mjs +7 -8
- package/lib/node_modules/lodash-es/_baseTrim.mjs +1 -2
- package/lib/node_modules/lodash-es/_baseUnary.mjs +1 -2
- package/lib/node_modules/lodash-es/_cacheHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_castFunction.mjs +1 -2
- package/lib/node_modules/lodash-es/_castPath.mjs +1 -2
- package/lib/node_modules/lodash-es/_castSlice.mjs +1 -2
- package/lib/node_modules/lodash-es/_copyArray.mjs +1 -2
- package/lib/node_modules/lodash-es/_coreJsData.mjs +1 -2
- package/lib/node_modules/lodash-es/_createAggregator.cjs +1 -1
- package/lib/node_modules/lodash-es/_createAggregator.mjs +8 -9
- package/lib/node_modules/lodash-es/_createBaseEach.mjs +1 -2
- package/lib/node_modules/lodash-es/_createBaseFor.mjs +1 -2
- package/lib/node_modules/lodash-es/_createCaseFirst.cjs +1 -1
- package/lib/node_modules/lodash-es/_createCaseFirst.mjs +8 -9
- package/lib/node_modules/lodash-es/_defineProperty.mjs +1 -2
- package/lib/node_modules/lodash-es/_equalArrays.mjs +1 -2
- package/lib/node_modules/lodash-es/_equalByTag.cjs +1 -1
- package/lib/node_modules/lodash-es/_equalByTag.mjs +6 -7
- package/lib/node_modules/lodash-es/_equalObjects.mjs +1 -2
- package/lib/node_modules/lodash-es/_freeGlobal.mjs +1 -2
- package/lib/node_modules/lodash-es/_getAllKeys.cjs +1 -1
- package/lib/node_modules/lodash-es/_getAllKeys.mjs +5 -6
- package/lib/node_modules/lodash-es/_getMapData.mjs +1 -2
- package/lib/node_modules/lodash-es/_getMatchData.cjs +1 -1
- package/lib/node_modules/lodash-es/_getMatchData.mjs +6 -7
- package/lib/node_modules/lodash-es/_getNative.mjs +1 -2
- package/lib/node_modules/lodash-es/_getRawTag.mjs +1 -2
- package/lib/node_modules/lodash-es/_getSymbols.mjs +1 -2
- package/lib/node_modules/lodash-es/_getTag.cjs +1 -1
- package/lib/node_modules/lodash-es/_getTag.mjs +12 -13
- package/lib/node_modules/lodash-es/_getValue.mjs +1 -2
- package/lib/node_modules/lodash-es/_hasPath.cjs +1 -1
- package/lib/node_modules/lodash-es/_hasPath.mjs +9 -10
- package/lib/node_modules/lodash-es/_hasUnicode.mjs +1 -2
- package/lib/node_modules/lodash-es/_hashClear.mjs +1 -2
- package/lib/node_modules/lodash-es/_hashDelete.mjs +1 -2
- package/lib/node_modules/lodash-es/_hashGet.mjs +1 -2
- package/lib/node_modules/lodash-es/_hashHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_hashSet.mjs +1 -2
- package/lib/node_modules/lodash-es/_isFlattenable.cjs +1 -1
- package/lib/node_modules/lodash-es/_isFlattenable.mjs +5 -6
- package/lib/node_modules/lodash-es/_isIndex.mjs +1 -2
- package/lib/node_modules/lodash-es/_isKey.cjs +1 -1
- package/lib/node_modules/lodash-es/_isKey.mjs +6 -7
- package/lib/node_modules/lodash-es/_isKeyable.mjs +1 -2
- package/lib/node_modules/lodash-es/_isMasked.mjs +1 -2
- package/lib/node_modules/lodash-es/_isPrototype.mjs +1 -2
- package/lib/node_modules/lodash-es/_isStrictComparable.mjs +1 -2
- package/lib/node_modules/lodash-es/_listCacheClear.mjs +1 -2
- package/lib/node_modules/lodash-es/_listCacheDelete.mjs +1 -2
- package/lib/node_modules/lodash-es/_listCacheGet.mjs +1 -2
- package/lib/node_modules/lodash-es/_listCacheHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_listCacheSet.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapCacheClear.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapCacheDelete.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapCacheGet.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapCacheHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapCacheSet.mjs +1 -2
- package/lib/node_modules/lodash-es/_mapToArray.mjs +1 -2
- package/lib/node_modules/lodash-es/_matchesStrictComparable.mjs +1 -2
- package/lib/node_modules/lodash-es/_memoizeCapped.mjs +1 -2
- package/lib/node_modules/lodash-es/_nativeCreate.mjs +1 -2
- package/lib/node_modules/lodash-es/_nativeKeys.mjs +1 -2
- package/lib/node_modules/lodash-es/_nodeUtil.mjs +1 -2
- package/lib/node_modules/lodash-es/_objectToString.mjs +1 -2
- package/lib/node_modules/lodash-es/_overArg.mjs +1 -2
- package/lib/node_modules/lodash-es/_root.mjs +1 -2
- package/lib/node_modules/lodash-es/_setCacheAdd.mjs +1 -2
- package/lib/node_modules/lodash-es/_setCacheHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_setToArray.mjs +1 -2
- package/lib/node_modules/lodash-es/_stackClear.mjs +1 -2
- package/lib/node_modules/lodash-es/_stackDelete.mjs +1 -2
- package/lib/node_modules/lodash-es/_stackGet.mjs +1 -2
- package/lib/node_modules/lodash-es/_stackHas.mjs +1 -2
- package/lib/node_modules/lodash-es/_stackSet.mjs +1 -2
- package/lib/node_modules/lodash-es/_stringToArray.cjs +1 -1
- package/lib/node_modules/lodash-es/_stringToArray.mjs +5 -6
- package/lib/node_modules/lodash-es/_stringToPath.mjs +1 -2
- package/lib/node_modules/lodash-es/_toKey.mjs +1 -2
- package/lib/node_modules/lodash-es/_toSource.mjs +1 -2
- package/lib/node_modules/lodash-es/_trimmedEndIndex.mjs +1 -2
- package/lib/node_modules/lodash-es/_unicodeToArray.mjs +1 -2
- package/lib/node_modules/lodash-es/capitalize.mjs +1 -2
- package/lib/node_modules/lodash-es/concat.cjs +1 -1
- package/lib/node_modules/lodash-es/concat.mjs +7 -8
- package/lib/node_modules/lodash-es/eq.mjs +1 -2
- package/lib/node_modules/lodash-es/first.mjs +1 -1
- package/lib/node_modules/lodash-es/flatten.mjs +1 -2
- package/lib/node_modules/lodash-es/flattenDeep.mjs +1 -2
- package/lib/node_modules/lodash-es/flattenDepth.cjs +1 -1
- package/lib/node_modules/lodash-es/flattenDepth.mjs +5 -6
- package/lib/node_modules/lodash-es/forEach.cjs +1 -1
- package/lib/node_modules/lodash-es/forEach.mjs +7 -8
- package/lib/node_modules/lodash-es/get.mjs +1 -2
- package/lib/node_modules/lodash-es/groupBy.mjs +1 -2
- package/lib/node_modules/lodash-es/hasIn.mjs +1 -2
- package/lib/node_modules/lodash-es/head.mjs +1 -2
- package/lib/node_modules/lodash-es/identity.mjs +1 -2
- package/lib/node_modules/lodash-es/isArguments.cjs +1 -1
- package/lib/node_modules/lodash-es/isArguments.mjs +6 -7
- package/lib/node_modules/lodash-es/isArray.mjs +1 -2
- package/lib/node_modules/lodash-es/isArrayLike.mjs +1 -2
- package/lib/node_modules/lodash-es/isBuffer.mjs +1 -2
- package/lib/node_modules/lodash-es/isEmpty.cjs +1 -1
- package/lib/node_modules/lodash-es/isEmpty.mjs +13 -14
- package/lib/node_modules/lodash-es/isFunction.mjs +1 -2
- package/lib/node_modules/lodash-es/isLength.mjs +1 -2
- package/lib/node_modules/lodash-es/isNil.mjs +1 -2
- package/lib/node_modules/lodash-es/isObject.mjs +1 -2
- package/lib/node_modules/lodash-es/isObjectLike.mjs +1 -2
- package/lib/node_modules/lodash-es/isSymbol.mjs +1 -2
- package/lib/node_modules/lodash-es/isTypedArray.mjs +1 -2
- package/lib/node_modules/lodash-es/keys.cjs +1 -1
- package/lib/node_modules/lodash-es/keys.mjs +6 -7
- package/lib/node_modules/lodash-es/last.mjs +1 -2
- package/lib/node_modules/lodash-es/lodash.cjs +1 -1
- package/lib/node_modules/lodash-es/lodash.mjs +19 -19
- package/lib/node_modules/lodash-es/memoize.mjs +1 -2
- package/lib/node_modules/lodash-es/nth.cjs +1 -1
- package/lib/node_modules/lodash-es/nth.mjs +5 -6
- package/lib/node_modules/lodash-es/property.cjs +1 -1
- package/lib/node_modules/lodash-es/property.mjs +7 -8
- package/lib/node_modules/lodash-es/reduce.cjs +1 -1
- package/lib/node_modules/lodash-es/reduce.mjs +8 -9
- package/lib/node_modules/lodash-es/stubArray.mjs +1 -2
- package/lib/node_modules/lodash-es/stubFalse.mjs +1 -2
- package/lib/node_modules/lodash-es/toFinite.mjs +1 -2
- package/lib/node_modules/lodash-es/toInteger.mjs +1 -2
- package/lib/node_modules/lodash-es/toNumber.cjs +1 -1
- package/lib/node_modules/lodash-es/toNumber.mjs +9 -10
- package/lib/node_modules/lodash-es/toString.mjs +1 -2
- package/lib/node_modules/lodash-es/upperFirst.mjs +1 -2
- package/lib/node_modules/luxon/build/es6/luxon.mjs +1 -2
- package/lib/node_modules/parsimmon/build/parsimmon.umd.min.cjs +1 -1
- package/lib/node_modules/parsimmon/build/parsimmon.umd.min.mjs +3 -4
- package/lib/node_modules/pluralize/pluralize.cjs +1 -1
- package/lib/node_modules/pluralize/pluralize.mjs +3 -4
- package/lib/packages/dbml-core/node_modules/lodash/lodash.cjs +2 -2
- package/lib/packages/dbml-core/node_modules/lodash/lodash.mjs +3 -4
- package/lib/packages/dbml-core/package.json.cjs +1 -1
- package/lib/packages/dbml-core/package.json.mjs +2 -3
- package/lib/parse/ANTLR/ASTGeneration/AST.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/constants.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/helpers.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/index.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.mjs +1 -2
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.mjs +2 -3
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.mjs +57 -58
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.mjs +2 -3
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.mjs +1 -2
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.mjs +1 -2
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.mjs +1 -2
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.mjs +1 -2
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.mjs +1 -2
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.mjs +1 -2
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.mjs +1 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.mjs +1 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexerBase.mjs +1 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.mjs +1 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserBase.mjs +1 -2
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.mjs +1 -2
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.mjs +1 -2
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.mjs +1 -2
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.mjs +1 -2
- package/lib/parse/Parser.cjs +1 -1
- package/lib/parse/Parser.mjs +37 -38
- package/lib/parse/databaseGenerator.mjs +1 -2
- package/lib/parse/deprecated/dbmlParser.mjs +1 -2
- package/lib/parse/deprecated/mssql/base_parsers.cjs +1 -1
- package/lib/parse/deprecated/mssql/base_parsers.mjs +27 -28
- package/lib/parse/deprecated/mssql/column_definition/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/column_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/column_definition/index.mjs +19 -19
- package/lib/parse/deprecated/mssql/constraint_definition/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/constraint_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/constraint_definition/index.mjs +10 -10
- package/lib/parse/deprecated/mssql/expression.cjs +1 -1
- package/lib/parse/deprecated/mssql/expression.mjs +17 -18
- package/lib/parse/deprecated/mssql/fk_definition/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/fk_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/fk_definition/index.mjs +7 -8
- package/lib/parse/deprecated/mssql/index.mjs +1 -2
- package/lib/parse/deprecated/mssql/index_definition/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/index_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/index_definition/index.mjs +13 -14
- package/lib/parse/deprecated/mssql/keyword_parsers.mjs +1 -2
- package/lib/parse/deprecated/mssql/keyword_utils.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/index.mjs +23 -24
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/actions.mjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/add/index.mjs +13 -14
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/index.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/statement_types/comments/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.mjs +5 -6
- package/lib/parse/deprecated/mssql/statements/statement_types/create_index/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/statement_types/create_index/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/create_index/index.mjs +11 -12
- package/lib/parse/deprecated/mssql/statements/statement_types/create_table/actions.mjs +1 -2
- package/lib/parse/deprecated/mssql/statements/statement_types/create_table/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/create_table/index.mjs +11 -12
- package/lib/parse/deprecated/mssql/statements/statement_types/index.mjs +1 -1
- package/lib/parse/deprecated/mssql/utils.cjs +1 -1
- package/lib/parse/deprecated/mssql/utils.mjs +10 -11
- package/lib/parse/deprecated/mssql/whitespaces.mjs +1 -2
- package/lib/parse/deprecated/mssqlParser.mjs +1 -2
- package/lib/parse/deprecated/mysqlParser.mjs +1 -2
- package/lib/parse/deprecated/postgresParser.mjs +1 -2
- package/lib/parse/deprecated/schemarbParser.mjs +1 -2
- package/lib/parse/error.mjs +1 -2
- package/lib/transform/index.cjs +1 -1
- package/lib/transform/index.mjs +10 -7
- package/lib/transform/relations.mjs +1 -2
- package/lib/utils/version.mjs +1 -2
- package/package.json +3 -3
- package/types/index.d.ts +8 -0
- package/types/model_structure/database.d.ts +26 -0
- package/types/model_structure/dbState.d.ts +3 -0
- package/types/model_structure/group.d.ts +41 -0
- package/types/model_structure/link.d.ts +37 -0
- package/types/model_structure/node.d.ts +41 -0
- 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 "./
|
|
7
|
-
import u from "./
|
|
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 "./
|
|
11
|
-
import m from "./
|
|
12
|
-
import h from "./
|
|
13
|
-
import g from "./
|
|
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
|
|
16
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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) =>
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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("./
|
|
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 "./
|
|
5
|
-
import r from "./
|
|
6
|
-
|
|
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
|
|
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",
|
|
18
|
-
t ===
|
|
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("./
|
|
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
|
|
3
|
-
import n from "./
|
|
4
|
-
|
|
5
|
-
var r = class extends
|
|
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(
|
|
20
|
-
let i =
|
|
21
|
-
return a || this.error(`Can't find table ${
|
|
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: (
|
|
24
|
-
let n = a.findField(
|
|
25
|
-
return n || this.error(`Can't find field ${
|
|
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
|
-
|
|
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("./
|
|
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
|
|
3
|
-
import n from "./
|
|
4
|
-
|
|
5
|
-
var r = class extends
|
|
6
|
-
constructor({ tableName: e, schemaName:
|
|
7
|
-
super(a), this.relation = i, this.schemaName =
|
|
8
|
-
let s = o.schema.database.findOrCreateSchema(
|
|
9
|
-
s || this.error(`Can't find table ${t
|
|
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(
|
|
40
|
-
let r =
|
|
39
|
+
setFields(e, n) {
|
|
40
|
+
let r = e && e.length ? [...e] : [];
|
|
41
41
|
if (!r.length) {
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
42
|
+
let e = n.fields.find((e) => e.pk);
|
|
43
|
+
if (e) r.push(e.name);
|
|
44
44
|
else {
|
|
45
|
-
let
|
|
46
|
-
|
|
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((
|
|
50
|
-
let r = n.findField(
|
|
51
|
-
r || this.error(`Can't find field ${
|
|
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("./
|
|
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
|
|
4
|
-
import r from "./
|
|
5
|
-
import i from "./
|
|
6
|
-
|
|
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
|
|
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
|
|
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 ${
|
|
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 ${
|
|
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
|
-
|
|
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")
|
|
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
|
|
5
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|