@dbml/core 10.3.0-alpha.0 → 10.3.0-alpha.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/export/DbmlExporter.cjs +13 -13
- package/lib/export/DbmlExporter.mjs +88 -84
- package/lib/export/MysqlExporter.cjs +8 -8
- package/lib/export/MysqlExporter.mjs +54 -50
- package/lib/export/OracleExporter.cjs +7 -7
- package/lib/export/OracleExporter.mjs +79 -74
- package/lib/export/PostgresExporter.cjs +9 -9
- package/lib/export/PostgresExporter.mjs +82 -78
- package/lib/export/SqlServerExporter.cjs +11 -11
- package/lib/export/SqlServerExporter.mjs +64 -60
- package/lib/model_structure/database.cjs +1 -1
- package/lib/model_structure/database.mjs +56 -53
- package/lib/model_structure/dep.cjs +1 -1
- package/lib/model_structure/dep.mjs +11 -9
- package/lib/model_structure/enum.cjs +1 -1
- package/lib/model_structure/enum.mjs +15 -13
- package/lib/model_structure/enumValue.cjs +1 -1
- package/lib/model_structure/enumValue.mjs +8 -6
- package/lib/model_structure/field.cjs +1 -1
- package/lib/model_structure/field.mjs +10 -8
- package/lib/model_structure/schema.cjs +1 -1
- package/lib/model_structure/schema.mjs +25 -23
- package/lib/model_structure/table.cjs +1 -1
- package/lib/model_structure/table.mjs +43 -40
- package/lib/model_structure/tableGroup.cjs +1 -1
- package/lib/model_structure/tableGroup.mjs +11 -9
- package/lib/model_structure/tablePartial.cjs +1 -1
- package/lib/model_structure/tablePartial.mjs +8 -6
- package/lib/node_modules/lodash-es/_DataView.cjs +1 -0
- package/lib/node_modules/lodash-es/_DataView.mjs +10 -0
- package/lib/node_modules/lodash-es/_Hash.cjs +1 -0
- package/lib/node_modules/lodash-es/_Hash.mjs +20 -0
- package/lib/node_modules/lodash-es/_ListCache.cjs +1 -0
- package/lib/node_modules/lodash-es/_ListCache.mjs +20 -0
- package/lib/node_modules/lodash-es/_Map.cjs +1 -0
- package/lib/node_modules/lodash-es/_Map.mjs +10 -0
- package/lib/node_modules/lodash-es/_MapCache.cjs +1 -0
- package/lib/node_modules/lodash-es/_MapCache.mjs +20 -0
- package/lib/node_modules/lodash-es/_Promise.cjs +1 -0
- package/lib/node_modules/lodash-es/_Promise.mjs +10 -0
- package/lib/node_modules/lodash-es/_Set.cjs +1 -0
- package/lib/node_modules/lodash-es/_Set.mjs +10 -0
- package/lib/node_modules/lodash-es/_SetCache.cjs +1 -0
- package/lib/node_modules/lodash-es/_SetCache.mjs +15 -0
- package/lib/node_modules/lodash-es/_Stack.cjs +1 -0
- package/lib/node_modules/lodash-es/_Stack.mjs +18 -0
- package/lib/node_modules/lodash-es/_Symbol.cjs +1 -0
- package/lib/node_modules/lodash-es/_Symbol.mjs +9 -0
- package/lib/node_modules/lodash-es/_Uint8Array.cjs +1 -0
- package/lib/node_modules/lodash-es/_Uint8Array.mjs +9 -0
- package/lib/node_modules/lodash-es/_WeakMap.cjs +1 -0
- package/lib/node_modules/lodash-es/_WeakMap.mjs +10 -0
- package/lib/node_modules/lodash-es/_arrayAggregator.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayAggregator.mjs +13 -0
- package/lib/node_modules/lodash-es/_arrayEach.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayEach.mjs +10 -0
- package/lib/node_modules/lodash-es/_arrayFilter.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayFilter.mjs +13 -0
- package/lib/node_modules/lodash-es/_arrayLikeKeys.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayLikeKeys.mjs +19 -0
- package/lib/node_modules/lodash-es/_arrayMap.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayMap.mjs +10 -0
- package/lib/node_modules/lodash-es/_arrayPush.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayPush.mjs +10 -0
- package/lib/node_modules/lodash-es/_arrayReduce.cjs +1 -0
- package/lib/node_modules/lodash-es/_arrayReduce.mjs +11 -0
- package/lib/node_modules/lodash-es/_arraySome.cjs +1 -0
- package/lib/node_modules/lodash-es/_arraySome.mjs +10 -0
- package/lib/node_modules/lodash-es/_asciiToArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_asciiToArray.mjs +9 -0
- package/lib/node_modules/lodash-es/_assocIndexOf.cjs +1 -0
- package/lib/node_modules/lodash-es/_assocIndexOf.mjs +13 -0
- package/lib/node_modules/lodash-es/_baseAggregator.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseAggregator.mjs +14 -0
- package/lib/node_modules/lodash-es/_baseAssignValue.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseAssignValue.mjs +17 -0
- package/lib/node_modules/lodash-es/_baseEach.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseEach.mjs +10 -0
- package/lib/node_modules/lodash-es/_baseFlatten.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseFlatten.mjs +18 -0
- package/lib/node_modules/lodash-es/_baseFor.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseFor.mjs +9 -0
- package/lib/node_modules/lodash-es/_baseForOwn.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseForOwn.mjs +13 -0
- package/lib/node_modules/lodash-es/_baseGet.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseGet.mjs +15 -0
- package/lib/node_modules/lodash-es/_baseGetAllKeys.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseGetAllKeys.mjs +14 -0
- package/lib/node_modules/lodash-es/_baseGetTag.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseGetTag.mjs +14 -0
- package/lib/node_modules/lodash-es/_baseHasIn.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseHasIn.mjs +9 -0
- package/lib/node_modules/lodash-es/_baseIsArguments.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsArguments.mjs +13 -0
- package/lib/node_modules/lodash-es/_baseIsEqual.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsEqual.mjs +13 -0
- package/lib/node_modules/lodash-es/_baseIsEqualDeep.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsEqualDeep.mjs +34 -0
- package/lib/node_modules/lodash-es/_baseIsMatch.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsMatch.mjs +30 -0
- package/lib/node_modules/lodash-es/_baseIsNative.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsNative.mjs +15 -0
- package/lib/node_modules/lodash-es/_baseIsTypedArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIsTypedArray.mjs +14 -0
- package/lib/node_modules/lodash-es/_baseIteratee.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseIteratee.mjs +16 -0
- package/lib/node_modules/lodash-es/_baseKeys.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseKeys.mjs +16 -0
- package/lib/node_modules/lodash-es/_baseMatches.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseMatches.mjs +17 -0
- package/lib/node_modules/lodash-es/_baseMatchesProperty.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseMatchesProperty.mjs +21 -0
- package/lib/node_modules/lodash-es/_baseNth.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseNth.mjs +13 -0
- package/lib/node_modules/lodash-es/_baseProperty.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseProperty.mjs +11 -0
- package/lib/node_modules/lodash-es/_basePropertyDeep.cjs +1 -0
- package/lib/node_modules/lodash-es/_basePropertyDeep.mjs +14 -0
- package/lib/node_modules/lodash-es/_baseReduce.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseReduce.mjs +11 -0
- package/lib/node_modules/lodash-es/_baseSlice.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseSlice.mjs +12 -0
- package/lib/node_modules/lodash-es/_baseTimes.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseTimes.mjs +10 -0
- package/lib/node_modules/lodash-es/_baseToString.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseToString.mjs +19 -0
- package/lib/node_modules/lodash-es/_baseTrim.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseTrim.mjs +12 -0
- package/lib/node_modules/lodash-es/_baseUnary.cjs +1 -0
- package/lib/node_modules/lodash-es/_baseUnary.mjs +11 -0
- package/lib/node_modules/lodash-es/_cacheHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_cacheHas.mjs +9 -0
- package/lib/node_modules/lodash-es/_castFunction.cjs +1 -0
- package/lib/node_modules/lodash-es/_castFunction.mjs +12 -0
- package/lib/node_modules/lodash-es/_castPath.cjs +1 -0
- package/lib/node_modules/lodash-es/_castPath.mjs +15 -0
- package/lib/node_modules/lodash-es/_castSlice.cjs +1 -0
- package/lib/node_modules/lodash-es/_castSlice.mjs +13 -0
- package/lib/node_modules/lodash-es/_copyArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_copyArray.mjs +11 -0
- package/lib/node_modules/lodash-es/_coreJsData.cjs +1 -0
- package/lib/node_modules/lodash-es/_coreJsData.mjs +9 -0
- package/lib/node_modules/lodash-es/_createAggregator.cjs +1 -0
- package/lib/node_modules/lodash-es/_createAggregator.mjs +18 -0
- package/lib/node_modules/lodash-es/_createBaseEach.cjs +1 -0
- package/lib/node_modules/lodash-es/_createBaseEach.mjs +17 -0
- package/lib/node_modules/lodash-es/_createBaseFor.cjs +1 -0
- package/lib/node_modules/lodash-es/_createBaseFor.mjs +15 -0
- package/lib/node_modules/lodash-es/_createCaseFirst.cjs +1 -0
- package/lib/node_modules/lodash-es/_createCaseFirst.mjs +19 -0
- package/lib/node_modules/lodash-es/_defineProperty.cjs +1 -0
- package/lib/node_modules/lodash-es/_defineProperty.mjs +14 -0
- package/lib/node_modules/lodash-es/_equalArrays.cjs +1 -0
- package/lib/node_modules/lodash-es/_equalArrays.mjs +39 -0
- package/lib/node_modules/lodash-es/_equalByTag.cjs +1 -0
- package/lib/node_modules/lodash-es/_equalByTag.mjs +39 -0
- package/lib/node_modules/lodash-es/_equalObjects.cjs +1 -0
- package/lib/node_modules/lodash-es/_equalObjects.mjs +36 -0
- package/lib/node_modules/lodash-es/_freeGlobal.cjs +1 -0
- package/lib/node_modules/lodash-es/_freeGlobal.mjs +8 -0
- package/lib/node_modules/lodash-es/_getAllKeys.cjs +1 -0
- package/lib/node_modules/lodash-es/_getAllKeys.mjs +14 -0
- package/lib/node_modules/lodash-es/_getMapData.cjs +1 -0
- package/lib/node_modules/lodash-es/_getMapData.mjs +13 -0
- package/lib/node_modules/lodash-es/_getMatchData.cjs +1 -0
- package/lib/node_modules/lodash-es/_getMatchData.mjs +21 -0
- package/lib/node_modules/lodash-es/_getNative.cjs +1 -0
- package/lib/node_modules/lodash-es/_getNative.mjs +14 -0
- package/lib/node_modules/lodash-es/_getRawTag.cjs +1 -0
- package/lib/node_modules/lodash-es/_getRawTag.mjs +18 -0
- package/lib/node_modules/lodash-es/_getSymbols.cjs +1 -0
- package/lib/node_modules/lodash-es/_getSymbols.mjs +14 -0
- package/lib/node_modules/lodash-es/_getTag.cjs +1 -0
- package/lib/node_modules/lodash-es/_getTag.mjs +25 -0
- package/lib/node_modules/lodash-es/_getValue.cjs +1 -0
- package/lib/node_modules/lodash-es/_getValue.mjs +9 -0
- package/lib/node_modules/lodash-es/_hasPath.cjs +1 -0
- package/lib/node_modules/lodash-es/_hasPath.mjs +23 -0
- package/lib/node_modules/lodash-es/_hasUnicode.cjs +1 -0
- package/lib/node_modules/lodash-es/_hasUnicode.mjs +11 -0
- package/lib/node_modules/lodash-es/_hashClear.cjs +1 -0
- package/lib/node_modules/lodash-es/_hashClear.mjs +12 -0
- package/lib/node_modules/lodash-es/_hashDelete.cjs +1 -0
- package/lib/node_modules/lodash-es/_hashDelete.mjs +10 -0
- package/lib/node_modules/lodash-es/_hashGet.cjs +1 -0
- package/lib/node_modules/lodash-es/_hashGet.mjs +17 -0
- package/lib/node_modules/lodash-es/_hashHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_hashHas.mjs +13 -0
- package/lib/node_modules/lodash-es/_hashSet.cjs +1 -0
- package/lib/node_modules/lodash-es/_hashSet.mjs +13 -0
- package/lib/node_modules/lodash-es/_isFlattenable.cjs +1 -0
- package/lib/node_modules/lodash-es/_isFlattenable.mjs +14 -0
- package/lib/node_modules/lodash-es/_isIndex.cjs +1 -0
- package/lib/node_modules/lodash-es/_isIndex.mjs +12 -0
- package/lib/node_modules/lodash-es/_isKey.cjs +1 -0
- package/lib/node_modules/lodash-es/_isKey.mjs +15 -0
- package/lib/node_modules/lodash-es/_isKeyable.cjs +1 -0
- package/lib/node_modules/lodash-es/_isKeyable.mjs +10 -0
- package/lib/node_modules/lodash-es/_isMasked.cjs +1 -0
- package/lib/node_modules/lodash-es/_isMasked.mjs +15 -0
- package/lib/node_modules/lodash-es/_isPrototype.cjs +1 -0
- package/lib/node_modules/lodash-es/_isPrototype.mjs +12 -0
- package/lib/node_modules/lodash-es/_isStrictComparable.cjs +1 -0
- package/lib/node_modules/lodash-es/_isStrictComparable.mjs +12 -0
- package/lib/node_modules/lodash-es/_listCacheClear.cjs +1 -0
- package/lib/node_modules/lodash-es/_listCacheClear.mjs +9 -0
- package/lib/node_modules/lodash-es/_listCacheDelete.cjs +1 -0
- package/lib/node_modules/lodash-es/_listCacheDelete.mjs +13 -0
- package/lib/node_modules/lodash-es/_listCacheGet.cjs +1 -0
- package/lib/node_modules/lodash-es/_listCacheGet.mjs +13 -0
- package/lib/node_modules/lodash-es/_listCacheHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_listCacheHas.mjs +12 -0
- package/lib/node_modules/lodash-es/_listCacheSet.cjs +1 -0
- package/lib/node_modules/lodash-es/_listCacheSet.mjs +13 -0
- package/lib/node_modules/lodash-es/_mapCacheClear.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapCacheClear.mjs +18 -0
- package/lib/node_modules/lodash-es/_mapCacheDelete.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapCacheDelete.mjs +13 -0
- package/lib/node_modules/lodash-es/_mapCacheGet.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapCacheGet.mjs +12 -0
- package/lib/node_modules/lodash-es/_mapCacheHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapCacheHas.mjs +12 -0
- package/lib/node_modules/lodash-es/_mapCacheSet.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapCacheSet.mjs +13 -0
- package/lib/node_modules/lodash-es/_mapToArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_mapToArray.mjs +12 -0
- package/lib/node_modules/lodash-es/_matchesStrictComparable.cjs +1 -0
- package/lib/node_modules/lodash-es/_matchesStrictComparable.mjs +11 -0
- package/lib/node_modules/lodash-es/_memoizeCapped.cjs +1 -0
- package/lib/node_modules/lodash-es/_memoizeCapped.mjs +15 -0
- package/lib/node_modules/lodash-es/_nativeCreate.cjs +1 -0
- package/lib/node_modules/lodash-es/_nativeCreate.mjs +9 -0
- package/lib/node_modules/lodash-es/_nativeKeys.cjs +1 -0
- package/lib/node_modules/lodash-es/_nativeKeys.mjs +9 -0
- package/lib/node_modules/lodash-es/_nodeUtil.cjs +1 -0
- package/lib/node_modules/lodash-es/_nodeUtil.mjs +13 -0
- package/lib/node_modules/lodash-es/_objectToString.cjs +1 -0
- package/lib/node_modules/lodash-es/_objectToString.mjs +11 -0
- package/lib/node_modules/lodash-es/_overArg.cjs +1 -0
- package/lib/node_modules/lodash-es/_overArg.mjs +11 -0
- package/lib/node_modules/lodash-es/_root.cjs +1 -0
- package/lib/node_modules/lodash-es/_root.mjs +9 -0
- package/lib/node_modules/lodash-es/_setCacheAdd.cjs +1 -0
- package/lib/node_modules/lodash-es/_setCacheAdd.mjs +11 -0
- package/lib/node_modules/lodash-es/_setCacheHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_setCacheHas.mjs +9 -0
- package/lib/node_modules/lodash-es/_setToArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_setToArray.mjs +12 -0
- package/lib/node_modules/lodash-es/_stackClear.cjs +1 -0
- package/lib/node_modules/lodash-es/_stackClear.mjs +12 -0
- package/lib/node_modules/lodash-es/_stackDelete.cjs +1 -0
- package/lib/node_modules/lodash-es/_stackDelete.mjs +10 -0
- package/lib/node_modules/lodash-es/_stackGet.cjs +1 -0
- package/lib/node_modules/lodash-es/_stackGet.mjs +9 -0
- package/lib/node_modules/lodash-es/_stackHas.cjs +1 -0
- package/lib/node_modules/lodash-es/_stackHas.mjs +9 -0
- package/lib/node_modules/lodash-es/_stackSet.cjs +1 -0
- package/lib/node_modules/lodash-es/_stackSet.mjs +20 -0
- package/lib/node_modules/lodash-es/_stringToArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_stringToArray.mjs +14 -0
- package/lib/node_modules/lodash-es/_stringToPath.cjs +1 -0
- package/lib/node_modules/lodash-es/_stringToPath.mjs +14 -0
- package/lib/node_modules/lodash-es/_toKey.cjs +1 -0
- package/lib/node_modules/lodash-es/_toKey.mjs +14 -0
- package/lib/node_modules/lodash-es/_toSource.cjs +1 -0
- package/lib/node_modules/lodash-es/_toSource.mjs +19 -0
- package/lib/node_modules/lodash-es/_trimmedEndIndex.cjs +1 -0
- package/lib/node_modules/lodash-es/_trimmedEndIndex.mjs +12 -0
- package/lib/node_modules/lodash-es/_unicodeToArray.cjs +1 -0
- package/lib/node_modules/lodash-es/_unicodeToArray.mjs +21 -0
- package/lib/node_modules/lodash-es/capitalize.cjs +1 -0
- package/lib/node_modules/lodash-es/capitalize.mjs +13 -0
- package/lib/node_modules/lodash-es/concat.cjs +1 -0
- package/lib/node_modules/lodash-es/concat.mjs +18 -0
- package/lib/node_modules/lodash-es/eq.cjs +1 -0
- package/lib/node_modules/lodash-es/eq.mjs +9 -0
- package/lib/node_modules/lodash-es/first.cjs +1 -0
- package/lib/node_modules/lodash-es/first.mjs +9 -0
- package/lib/node_modules/lodash-es/flatten.cjs +1 -0
- package/lib/node_modules/lodash-es/flatten.mjs +12 -0
- package/lib/node_modules/lodash-es/flattenDeep.cjs +1 -0
- package/lib/node_modules/lodash-es/flattenDeep.mjs +12 -0
- package/lib/node_modules/lodash-es/flattenDepth.cjs +1 -0
- package/lib/node_modules/lodash-es/flattenDepth.mjs +13 -0
- package/lib/node_modules/lodash-es/forEach.cjs +1 -0
- package/lib/node_modules/lodash-es/forEach.mjs +15 -0
- package/lib/node_modules/lodash-es/get.cjs +1 -0
- package/lib/node_modules/lodash-es/get.mjs +13 -0
- package/lib/node_modules/lodash-es/groupBy.cjs +1 -0
- package/lib/node_modules/lodash-es/groupBy.mjs +12 -0
- package/lib/node_modules/lodash-es/hasIn.cjs +1 -0
- package/lib/node_modules/lodash-es/hasIn.mjs +13 -0
- package/lib/node_modules/lodash-es/head.cjs +1 -0
- package/lib/node_modules/lodash-es/head.mjs +9 -0
- package/lib/node_modules/lodash-es/identity.cjs +1 -0
- package/lib/node_modules/lodash-es/identity.mjs +9 -0
- package/lib/node_modules/lodash-es/isArguments.cjs +1 -0
- package/lib/node_modules/lodash-es/isArguments.mjs +14 -0
- package/lib/node_modules/lodash-es/isArray.cjs +1 -0
- package/lib/node_modules/lodash-es/isArray.mjs +8 -0
- package/lib/node_modules/lodash-es/isArrayLike.cjs +1 -0
- package/lib/node_modules/lodash-es/isArrayLike.mjs +13 -0
- package/lib/node_modules/lodash-es/isBuffer.cjs +1 -0
- package/lib/node_modules/lodash-es/isBuffer.mjs +10 -0
- package/lib/node_modules/lodash-es/isEmpty.cjs +1 -0
- package/lib/node_modules/lodash-es/isEmpty.mjs +25 -0
- package/lib/node_modules/lodash-es/isFunction.cjs +1 -0
- package/lib/node_modules/lodash-es/isFunction.mjs +15 -0
- package/lib/node_modules/lodash-es/isLength.cjs +1 -0
- package/lib/node_modules/lodash-es/isLength.mjs +11 -0
- package/lib/node_modules/lodash-es/isNil.cjs +1 -0
- package/lib/node_modules/lodash-es/isNil.mjs +9 -0
- package/lib/node_modules/lodash-es/isObject.cjs +1 -0
- package/lib/node_modules/lodash-es/isObject.mjs +10 -0
- package/lib/node_modules/lodash-es/isObjectLike.cjs +1 -0
- package/lib/node_modules/lodash-es/isObjectLike.mjs +9 -0
- package/lib/node_modules/lodash-es/isSymbol.cjs +1 -0
- package/lib/node_modules/lodash-es/isSymbol.mjs +13 -0
- package/lib/node_modules/lodash-es/isTypedArray.cjs +1 -0
- package/lib/node_modules/lodash-es/isTypedArray.mjs +11 -0
- package/lib/node_modules/lodash-es/keys.cjs +1 -0
- package/lib/node_modules/lodash-es/keys.mjs +14 -0
- package/lib/node_modules/lodash-es/last.cjs +1 -0
- package/lib/node_modules/lodash-es/last.mjs +10 -0
- package/lib/node_modules/lodash-es/lodash.cjs +1 -0
- package/lib/node_modules/lodash-es/lodash.mjs +46 -0
- package/lib/node_modules/lodash-es/memoize.cjs +1 -0
- package/lib/node_modules/lodash-es/memoize.mjs +19 -0
- package/lib/node_modules/lodash-es/nth.cjs +1 -0
- package/lib/node_modules/lodash-es/nth.mjs +13 -0
- package/lib/node_modules/lodash-es/property.cjs +1 -0
- package/lib/node_modules/lodash-es/property.mjs +15 -0
- package/lib/node_modules/lodash-es/reduce.cjs +1 -0
- package/lib/node_modules/lodash-es/reduce.mjs +17 -0
- package/lib/node_modules/lodash-es/stubArray.cjs +1 -0
- package/lib/node_modules/lodash-es/stubArray.mjs +9 -0
- package/lib/node_modules/lodash-es/stubFalse.cjs +1 -0
- package/lib/node_modules/lodash-es/stubFalse.mjs +9 -0
- package/lib/node_modules/lodash-es/toFinite.cjs +1 -0
- package/lib/node_modules/lodash-es/toFinite.mjs +12 -0
- package/lib/node_modules/lodash-es/toInteger.cjs +1 -0
- package/lib/node_modules/lodash-es/toInteger.mjs +13 -0
- package/lib/node_modules/lodash-es/toNumber.cjs +1 -0
- package/lib/node_modules/lodash-es/toNumber.mjs +23 -0
- package/lib/node_modules/lodash-es/toString.cjs +1 -0
- package/lib/node_modules/lodash-es/toString.mjs +12 -0
- package/lib/node_modules/lodash-es/upperFirst.cjs +1 -0
- package/lib/node_modules/lodash-es/upperFirst.mjs +9 -0
- package/lib/node_modules/parsimmon/build/parsimmon.umd.min.cjs +16 -0
- package/lib/node_modules/parsimmon/build/parsimmon.umd.min.mjs +689 -0
- package/lib/node_modules/pluralize/pluralize.cjs +1 -0
- package/lib/node_modules/pluralize/pluralize.mjs +276 -0
- package/lib/packages/dbml-core/node_modules/lodash/lodash.cjs +20 -0
- package/lib/packages/dbml-core/node_modules/lodash/lodash.mjs +3306 -0
- package/lib/packages/dbml-core/package.json.cjs +1 -0
- package/lib/{package.json.mjs → packages/dbml-core/package.json.mjs} +1 -1
- package/lib/parse/ANTLR/ASTGeneration/helpers.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/helpers.mjs +5 -3
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.mjs +149 -143
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.mjs +146 -142
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.mjs +184 -181
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.mjs +149 -145
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.cjs +1 -1
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.mjs +89 -85
- package/lib/parse/deprecated/dbmlParser.cjs +3 -3
- package/lib/parse/deprecated/dbmlParser.mjs +27 -25
- package/lib/parse/deprecated/mssql/base_parsers.cjs +1 -1
- package/lib/parse/deprecated/mssql/base_parsers.mjs +38 -38
- package/lib/parse/deprecated/mssql/column_definition/actions.cjs +1 -1
- package/lib/parse/deprecated/mssql/column_definition/actions.mjs +9 -6
- package/lib/parse/deprecated/mssql/column_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/column_definition/index.mjs +28 -28
- package/lib/parse/deprecated/mssql/constraint_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/constraint_definition/index.mjs +24 -24
- package/lib/parse/deprecated/mssql/expression.cjs +1 -1
- package/lib/parse/deprecated/mssql/expression.mjs +28 -27
- package/lib/parse/deprecated/mssql/fk_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/fk_definition/index.mjs +20 -20
- package/lib/parse/deprecated/mssql/index_definition/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/index_definition/index.mjs +21 -21
- package/lib/parse/deprecated/mssql/keyword_utils.cjs +1 -1
- package/lib/parse/deprecated/mssql/keyword_utils.mjs +13 -13
- package/lib/parse/deprecated/mssql/statements/actions.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/actions.mjs +36 -33
- package/lib/parse/deprecated/mssql/statements/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/index.mjs +28 -28
- 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 +24 -24
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/alter_table/index.mjs +16 -16
- package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.cjs +1 -1
- package/lib/parse/deprecated/mssql/statements/statement_types/comments/index.mjs +31 -31
- 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 +20 -20
- 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 +21 -21
- package/lib/parse/deprecated/mssql/utils.cjs +1 -1
- package/lib/parse/deprecated/mssql/utils.mjs +21 -20
- package/lib/parse/deprecated/mssql/whitespaces.cjs +1 -1
- package/lib/parse/deprecated/mssql/whitespaces.mjs +11 -11
- package/lib/parse/deprecated/mysqlParser.cjs +6 -6
- package/lib/parse/deprecated/mysqlParser.mjs +20 -18
- package/lib/parse/deprecated/postgresParser.cjs +2 -2
- package/lib/parse/deprecated/postgresParser.mjs +25 -23
- package/lib/parse/deprecated/schemarbParser.cjs +10 -10
- package/lib/parse/deprecated/schemarbParser.mjs +313 -311
- package/lib/utils/version.cjs +1 -1
- package/lib/utils/version.mjs +1 -1
- package/package.json +2 -2
- package/lib/package.json.cjs +0 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { __commonJSMin as e
|
|
1
|
+
import { __commonJSMin as e } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { require_lodash as t } from "../../packages/dbml-core/node_modules/lodash/lodash.mjs";
|
|
3
|
+
import { require_pluralize as n } from "../../node_modules/pluralize/pluralize.mjs";
|
|
2
4
|
//#region src/parse/deprecated/postgresParser.cjs
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
function
|
|
5
|
+
var r = /* @__PURE__ */ e(((e, r) => {
|
|
6
|
+
var i = t();
|
|
7
|
+
n();
|
|
8
|
+
function a(e, t) {
|
|
7
9
|
function n() {
|
|
8
10
|
this.constructor = e;
|
|
9
11
|
}
|
|
10
12
|
n.prototype = t.prototype, e.prototype = new n();
|
|
11
13
|
}
|
|
12
|
-
function
|
|
13
|
-
this.message = e, this.expected = t, this.found = n, this.location = r, this.name = "SyntaxError", typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this,
|
|
14
|
+
function o(e, t, n, r) {
|
|
15
|
+
this.message = e, this.expected = t, this.found = n, this.location = r, this.name = "SyntaxError", typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, o);
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
a(o, Error), o.buildMessage = function(e, t) {
|
|
16
18
|
var n = {
|
|
17
19
|
literal: function(e) {
|
|
18
20
|
return "\"" + i(e.text) + "\"";
|
|
@@ -70,9 +72,9 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
70
72
|
}
|
|
71
73
|
return "Expected " + s(e) + " but " + c(t) + " found.";
|
|
72
74
|
};
|
|
73
|
-
function
|
|
75
|
+
function s(e, t) {
|
|
74
76
|
t = t === void 0 ? {} : t;
|
|
75
|
-
var n = {},
|
|
77
|
+
var n = {}, r = { parser: Dl }, a = Dl, s = function(e) {
|
|
76
78
|
return e.forEach((e) => {
|
|
77
79
|
let { command_name: t, value: { syntax_name: n, value: r }, warning: i } = e;
|
|
78
80
|
switch (t.toLowerCase()) {
|
|
@@ -163,9 +165,9 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
163
165
|
enums: ep
|
|
164
166
|
};
|
|
165
167
|
}, c = "create", l = U("CREATE", !0), u = "alter", d = U("ALTER", !0), f = "unique", p = U("UNIQUE", !0), m = "index", h = U("INDEX", !0), g = "type", _ = U("TYPE", !0), v = "enum", y = U("ENUM", !0), b = "concurrenly", x = U("CONCURRENLY", !0), S = "foreign", C = U("FOREIGN", !0), w = "key", T = U("KEY", !0), E = "references", D = U("REFERENCES", !0), O = "on", k = U("ON", !0), A = "using", j = U("USING", !0), M = "table", N = U("TABLE", !0), ee = "if", te = U("IF", !0), ne = "not", re = U("NOT", !0), ie = "exists", ae = U("EXISTS", !0), oe = "global", se = U("GLOBAL", !0), ce = "local", le = U("LOCAL", !0), ue = "temporary", de = U("TEMPORARY", !0), fe = "temp", pe = U("TEMP", !0), me = "unlogged", he = U("UNLOGGED", !0), ge = "collate", _e = U("COLLATE", !0), ve = "partition", ye = U("PARTITION", !0), be = "by", xe = U("BY", !0), Se = "range", Ce = U("RANGE", !0), we = "list", Te = U("LIST", !0), Ee = "hash", De = U("HASH", !0), Oe = "like", ke = U("LIKE", !0), Ae = "inherits", je = U("INHERITS", !0), Me = "inherit", Ne = U("INHERIT", !0), Pe = "with", Fe = U("WITH", !0), Ie = "without", Le = U("WITHOUT", !0), Re = "oids", ze = U("OIDS", !0), Be = "commit", Ve = U("COMMIT", !0), He = "preserve", Ue = U("PRESERVE", !0), We = "rows", Ge = U("ROWS", !0), Ke = "delete", qe = U("DELETE", !0), Je = "drop", Ye = U("DROP", !0), Xe = "tablespace", Ze = U("TABLESPACE", !0), Qe = "constraint", $e = U("CONSTRAINT", !0), et = "no", tt = U("NO", !0), nt = "null", rt = U("NULL", !0), it = "check", at = U("CHECK", !0), ot = "default", st = U("DEFAULT", !0), ct = "primary", lt = U("PRIMARY", !0), ut = "match", dt = U("MATCH", !0), ft = "full", pt = U("FULL", !0), mt = "partial", ht = U("PARTIAL", !0), gt = "simple", _t = U("SIMPLE", !0), vt = "update", yt = U("UPDATE", !0), bt = "deferrable", xt = U("DEFERRABLE", !0), St = "initially", Ct = U("INITIALLY", !0), wt = "deferred", Tt = U("DEFERRED", !0), Et = "immediate", Dt = U("IMMEDIATE", !0), Ot = "exclude", kt = U("EXCLUDE", !0), At = "where", jt = U("WHERE", !0), Mt = "including", Nt = U("INCLUDING", !0), Pt = "excluding", Ft = U("EXCLUDING", !0), It = "comments", Lt = U("COMMENTS", !0), Rt = "constraints", zt = U("CONSTRAINTS", !0), Bt = "generated", Vt = U("GENERATED", !0), Ht = "always", Ut = U("ALWAYS", !0), Wt = "as", Gt = U("AS", !0), Kt = "add", qt = U("ADD", !0), Jt = "only", Yt = U("ONLY", !0), Xt = "defaults", Zt = U("DEFAULTS", !0), Qt = "identity", $t = U("IDENTITY", !0), en = "indexes", tn = U("INDEXES", !0), nn = "statistics", rn = U("STATISTICS", !0), an = "storage", on = U("STORAGE", !0), sn = "include", cn = U("INCLUDE", !0), ln = "includes", un = U("INCLUDES", !0), dn = "all", fn = U("ALL", !0), pn = "of", mn = U("OF", !0), hn = "options", gn = U("OPTIONS", !0), _n = "for", vn = U("FOR", !0), yn = "values", bn = U("VALUES", !0), xn = "in", Sn = U("IN", !0), Cn = "from", wn = U("FROM", !0), Tn = "to", En = U("TO", !0), Dn = "modulus", On = U("MODULUS", !0), kn = "remainder", An = U("REMAINDER", !0), jn = "true", Mn = U("TRUE", !0), Nn = "false", Pn = U("FALSE", !0), Fn = "maxvalue", In = U("MAXVALUE", !0), Ln = "minvalue", Rn = U("MINVALUE", !0), zn = "subtype", Bn = U("SUBTYPE", !0), Vn = "subtype_opclass", Hn = U("SUBTYPE_OPCLASS", !0), Un = "canonical", Wn = U("CANONICAL", !0), Gn = "subtype_diff", Kn = U("SUBTYPE_DIFF", !0), qn = "valid", Jn = U("VALID", !0), Yn = "column", Xn = U("COLUMN", !0), Zn = "set", Qn = U("SET", !0), $n = "data", er = U("DATA", !0), tr = "reset", nr = U("RESET", !0), rr = "plain", ir = U("PLAIN", !0), ar = "external", or = U("EXTERNAL", !0), sr = "extended", cr = U("EXTENDED", !0), lr = "main", ur = U("MAIN", !0), dr = "comment", fr = U("COMMENT", !0), pr = "IS", mr = U("IS", !1), hr = "insert", gr = U("INSERT", !0), _r = "select", vr = U("SELECT", !0), yr = "use", br = U("USE", !0), xr = "sequence", Sr = U("SEQUENCE", !0), Cr = "schema", wr = U("SCHEMA", !0), Tr = "view", Er = U("VIEW", !0), Dr = "rename", Or = U("RENAME", !0), kr = "owned", Ar = U("OWNED", !0), jr = "attach", Mr = U("ATTACH", !0), Nr = "detach", Pr = U("DETACH", !0), Fr = Cl("expression"), Ir = function(e) {
|
|
166
|
-
return tp(
|
|
168
|
+
return tp(i.flattenDeep(e).join(""));
|
|
167
169
|
}, P = "(", F = U("(", !1), I = ")", L = U(")", !1), Lr = ",", Rr = U(",", !1), zr = ");", Br = U(");", !1), Vr = xl(), Hr = function(e) {
|
|
168
|
-
return
|
|
170
|
+
return i.flattenDeep(e).join("");
|
|
169
171
|
}, Ur = /^["',.a-z0-9_+-:<>=!*]/i, Wr = bl([
|
|
170
172
|
"\"",
|
|
171
173
|
"'",
|
|
@@ -208,7 +210,7 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
208
210
|
}, fi = "\"\"", pi = U("\"\"", !1), mi = function() {
|
|
209
211
|
return "\"";
|
|
210
212
|
}, hi = /^[^"]/, gi = bl(["\""], !0, !1), _i = Cl("number"), vi = "e", yi = U("e", !1), bi = "+", xi = U("+", !1), Si = "-", Ci = U("-", !1), wi = function(e) {
|
|
211
|
-
return
|
|
213
|
+
return i.flattenDeep(e).filter((e) => e).join("");
|
|
212
214
|
}, Ti = function(e) {
|
|
213
215
|
return e.join("");
|
|
214
216
|
}, Ei = /^[0-9]/, Di = bl([["0", "9"]], !1, !1), Oi = Cl("VALID TYPE"), ki = "character", Ai = U("CHARACTER", !0), ji = "varying", Mi = U("VARYING", !0), Ni = function(e, t, n, r) {
|
|
@@ -630,7 +632,7 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
630
632
|
};
|
|
631
633
|
}, yc = function(e, t) {
|
|
632
634
|
return {
|
|
633
|
-
value: `${e}(${tp(
|
|
635
|
+
value: `${e}(${tp(i.flattenDeep(t).join(""))})`,
|
|
634
636
|
type: "expression"
|
|
635
637
|
};
|
|
636
638
|
}, bc = function(e) {
|
|
@@ -717,8 +719,8 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
717
719
|
column: 1
|
|
718
720
|
}], hl = 0, gl = [], H = 0, _l;
|
|
719
721
|
if ("startRule" in t) {
|
|
720
|
-
if (!(t.startRule in
|
|
721
|
-
|
|
722
|
+
if (!(t.startRule in r)) throw Error("Can't start parsing from rule \"" + t.startRule + "\".");
|
|
723
|
+
a = r[t.startRule];
|
|
722
724
|
}
|
|
723
725
|
function vl() {
|
|
724
726
|
return e.substring(V, B);
|
|
@@ -782,7 +784,7 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
782
784
|
B < hl || (B > hl && (hl = B, gl = []), gl.push(e));
|
|
783
785
|
}
|
|
784
786
|
function El(e, t, n) {
|
|
785
|
-
return new
|
|
787
|
+
return new o(o.buildMessage(e, t), e, t, n);
|
|
786
788
|
}
|
|
787
789
|
function Dl() {
|
|
788
790
|
for (var e = B, t = [], r = Zf(); r !== n;) t.push(r), r = Zf();
|
|
@@ -2736,14 +2738,14 @@ var n = /* @__PURE__ */ e(((e, n) => {
|
|
|
2736
2738
|
let n = e || "public";
|
|
2737
2739
|
return Qf.find((e) => (e.schemaName || "public") === n && e.name === t);
|
|
2738
2740
|
}, rp = (e, t) => e.fields.find((e) => e.name === t);
|
|
2739
|
-
if (_l =
|
|
2741
|
+
if (_l = a(), _l !== n && B === e.length) return _l;
|
|
2740
2742
|
throw _l !== n && B < e.length && W(Sl()), El(gl, hl < e.length ? e.charAt(hl) : null, hl < e.length ? Tl(hl, hl + 1) : Tl(hl, hl));
|
|
2741
2743
|
}
|
|
2742
|
-
|
|
2743
|
-
SyntaxError:
|
|
2744
|
-
parse:
|
|
2744
|
+
r.exports = {
|
|
2745
|
+
SyntaxError: o,
|
|
2746
|
+
parse: s
|
|
2745
2747
|
};
|
|
2746
2748
|
}));
|
|
2747
2749
|
//#endregion
|
|
2748
|
-
export default
|
|
2749
|
-
export {
|
|
2750
|
+
export default r();
|
|
2751
|
+
export { r as require_postgresParser };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
`],!0,!1),
|
|
3
|
-
`],!0,!1),
|
|
4
|
-
`],!0,!1),
|
|
5
|
-
`],!0,!1),
|
|
6
|
-
`,
|
|
7
|
-
`,!1),
|
|
8
|
-
`,
|
|
9
|
-
`,!1),
|
|
10
|
-
`,`\r`],!1,!1),dt=` `,ft=L(` `,!1),k=0,A=0,j=[{line:1,column:1}],M=0,N=[],P=0,F;if(`startRule`in t){if(!(t.startRule in i))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);a=i[t.startRule]}function I(e,t){throw t=t===void 0?B(A,k):t,ht(e,t)}function L(e,t){return{type:`literal`,text:e,ignoreCase:t}}function R(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function pt(){return{type:`end`}}function z(e){return{type:`other`,description:e}}function mt(t){var n=j[t],r;if(n)return n;for(r=t-1;!j[r];)r--;for(n=j[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return j[t]=n,n}function B(e,t){var n=mt(e),r=mt(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function V(e){k<M||(k>M&&(M=k,N=[]),N.push(e))}function ht(e,t){return new r(e,null,null,t)}function gt(e,t,n){return new r(r.buildMessage(e,t),e,t,n)}function _t(){for(var e=k,t=[],r=vt();r!==n;)t.push(r),r=vt();return t!==n&&(A=e,t=o()),e=t,e}function vt(){for(var e=k,t=[],r=J();r!==n;)t.push(r),r=J();return t===n?(k=e,e=n):(r=yt(),r===n?(k=e,e=n):(t=[t,r],e=t)),e===n&&(e=Yt(),e===n&&(e=Jt(),e===n&&(e=$t()))),e}function yt(){var e=k,t=Ct();return t!==n&&(A=e,t=s(t)),e=t,e===n&&(e=k,t=xt(),t!==n&&(A=e,t=c(t)),e=t,e===n&&(e=bt(),e===n&&(e=Ht()))),e}function bt(){for(var t=k,r=[],i=Y(),a,o,s,c,f,p,m;i!==n;)r.push(i),i=Y();if(r!==n)if(i=Lt(),i!==n){for(a=[],o=Y();o!==n;)a.push(o),o=Y();if(a!==n)if(o=Gt(),o===n&&(o=U()),o!==n)if(e.charCodeAt(k)===44?(s=l,k++):(s=n,P===0&&V(u)),s!==n){for(c=[],f=Y();f!==n;)c.push(f),f=Y();if(c!==n)if(f=U(),f!==n){for(p=[],m=H();m!==n;)p.push(m),m=H();p===n?(k=t,t=n):(A=t,r=d(o,f,p),t=r)}else k=t,t=n;else k=t,t=n}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n;else k=t,t=n;return t}function xt(){for(var t=k,r=[],i=Y(),a,o,s,c,d,p,m;i!==n;)r.push(i),i=Y();if(r!==n)if(i=Rt(),i!==n){for(a=[],o=Y();o!==n;)a.push(o),o=Y();if(a!==n)if(o=U(),o!==n)if(e.charCodeAt(k)===44?(s=l,k++):(s=n,P===0&&V(u)),s!==n){for(c=[],d=Y();d!==n;)c.push(d),d=Y();if(c!==n)if(d=U(),d!==n){for(p=[],m=St();m!==n;)p.push(m),m=St();p===n?(k=t,t=n):(A=t,r=f(o,d,p),t=r)}else k=t,t=n;else k=t,t=n}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n;else k=t,t=n;return t}function St(){var t=k,r,i,a,o,s,c;if(e.charCodeAt(k)===44?(r=l,k++):(r=n,P===0&&V(u)),r!==n){for(i=[],a=Y();a!==n;)i.push(a),a=Y();if(i!==n)if(a=zt(),a!==n)if(e.charCodeAt(k)===58?(o=p,k++):(o=n,P===0&&V(m)),o!==n){for(s=[],c=Y();c!==n;)s.push(c),c=Y();s===n?(k=t,t=n):(c=U(),c===n?(k=t,t=n):(A=t,r=ee(c),t=r))}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n;if(t===n){if(t=k,e.charCodeAt(k)===44?(r=l,k++):(r=n,P===0&&V(u)),r!==n){for(i=[],a=Y();a!==n;)i.push(a),a=Y();if(i!==n)if(a=Bt(),a!==n)if(e.charCodeAt(k)===58?(o=p,k++):(o=n,P===0&&V(m)),o!==n){for(s=[],c=Y();c!==n;)s.push(c),c=Y();s===n?(k=t,t=n):(c=U(),c===n?(k=t,t=n):(A=t,r=te(c),t=r))}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n;if(t===n)if(t=k,e.charCodeAt(k)===44?(r=l,k++):(r=n,P===0&&V(u)),r!==n){for(i=[],a=Y();a!==n;)i.push(a),a=Y();if(i!==n)if(a=Mt(),a!==n)if(e.charCodeAt(k)===58?(o=p,k++):(o=n,P===0&&V(m)),o!==n){for(s=[],c=Y();c!==n;)s.push(c),c=Y();s===n?(k=t,t=n):(c=Gt(),c===n?(k=t,t=n):(A=t,r=ne(a,c),t=r))}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n}return t}function Ct(){var e=k,t=Nt(),r,i,a,o,s,c;if(t!==n){for(r=[],i=Y();i!==n;)r.push(i),i=Y();r===n?(k=e,e=n):(i=U(),i===n?(k=e,e=n):(a=G(),a===n?(k=e,e=n):(o=K(),o===n?(k=e,e=n):(s=wt(),s===n?(k=e,e=n):(c=Jt(),c===n?(k=e,e=n):(A=e,t=re(i,s),e=t))))))}else k=e,e=n;return e}function wt(){for(var e=k,t=[],r=Tt();r!==n;)t.push(r),r=Tt();return t!==n&&(A=e,t=ie(t)),e=t,e}function Tt(){for(var e=k,t=[],r=J(),i,a;r!==n;)t.push(r),r=J();if(t!==n)if(r=Et(),r!==n){for(i=[],a=Xt();a!==n;)i.push(a),a=Xt();i===n?(k=e,e=n):(a=K(),a===n?(k=e,e=n):(A=e,t=ae(r),e=t))}else k=e,e=n;else k=e,e=n;return e}function Et(){var e=Dt(),t;return e===n&&(e=k,t=Ot(),t!==n&&(A=e,t=oe(t)),e=t,e===n&&(e=k,t=kt(),t!==n&&(A=e,t=se(t)),e=t,e===n&&(e=k,t=At(),t!==n&&(A=e,t=ce(t)),e=t))),e}function Dt(){var e=k,t=Pt(),r,i;if(t!==n){if(r=[],i=Y(),i!==n)for(;i!==n;)r.push(i),i=Y();else r=n;r===n?(k=e,e=n):(i=G(),i===n?(k=e,e=n):(t=[t,r,i],e=t))}else k=e,e=n;return e}function Ot(){var e=k,t=Ft(),r,i;if(t!==n){if(r=[],i=Y(),i!==n)for(;i!==n;)r.push(i),i=Y();else r=n;r===n?(k=e,e=n):(i=jt(),i===n?(k=e,e=n):(A=e,t=le(i),e=t))}else k=e,e=n;return e}function kt(){var e=k,t=It(),r,i,a,o;if(t!==n){if(r=[],i=Y(),i!==n)for(;i!==n;)r.push(i),i=Y();else r=n;if(r!==n)if(i=U(),i!==n){for(a=[],o=H();o!==n;)a.push(o),o=H();a===n?(k=e,e=n):(A=e,t=ue(i,a),e=t)}else k=e,e=n;else k=e,e=n}else k=e,e=n;return e}function At(){var e=k,t=qt(),r,i;if(t!==n){if(r=[],i=Y(),i!==n)for(;i!==n;)r.push(i),i=Y();else r=n;r===n?(k=e,e=n):(i=U(),i===n?(k=e,e=n):(A=e,t=de(t,i),e=t))}else k=e,e=n;return e}function jt(){var t=k,r,i;return e.charCodeAt(k)===58?(r=p,k++):(r=n,P===0&&V(m)),r===n?(k=t,t=n):(i=Kt(),i===n?(k=t,t=n):(A=t,r=h(i),t=r)),t===n&&(t=k,r=U(),r!==n&&(A=t,r=h(r)),t=r),t}function H(){var t=k,r,i,a,o,s,c;if(e.charCodeAt(k)===44?(r=l,k++):(r=n,P===0&&V(u)),r!==n){for(i=[],a=Y();a!==n;)i.push(a),a=Y();if(i!==n)if(e.substr(k,4).toLowerCase()===fe?(a=e.substr(k,4),k+=4):(a=n,P===0&&V(pe)),a!==n)if(e.charCodeAt(k)===58?(o=p,k++):(o=n,P===0&&V(m)),o!==n){for(s=[],c=Y();c!==n;)s.push(c),c=Y();s===n?(k=t,t=n):(c=U(),c===n?(k=t,t=n):(A=t,r=me(c),t=r))}else k=t,t=n;else k=t,t=n;else k=t,t=n}else k=t,t=n;return t}function Mt(){var t;return e.substr(k,9).toLowerCase()===he?(t=e.substr(k,9),k+=9):(t=n,P===0&&V(ge)),t===n&&(e.substr(k,9).toLowerCase()===_e?(t=e.substr(k,9),k+=9):(t=n,P===0&&V(ve))),t}function Nt(){var t;return P++,e.substr(k,12).toLowerCase()===be?(t=e.substr(k,12),k+=12):(t=n,P===0&&V(xe)),P--,t===n&&P===0&&V(ye),t}function Pt(){var t,r,i;return P++,t=k,r=W(),r===n?(k=t,t=n):(e.substr(k,6)===Ce?(i=Ce,k+=6):(i=n,P===0&&V(we)),i===n?(k=t,t=n):(r=[r,i],t=r)),P--,t===n&&(r=n,P===0&&V(Se)),t}function Ft(){var t,r,i;return P++,t=k,r=W(),r===n?(k=t,t=n):(e.substr(k,11)===Ee?(i=Ee,k+=11):(i=n,P===0&&V(De)),i===n?(k=t,t=n):(r=[r,i],t=r)),P--,t===n&&(r=n,P===0&&V(Te)),t}function It(){var t,r,i;return P++,t=k,r=W(),r===n?(k=t,t=n):(e.substr(k,17)===g?(i=g,k+=17):(i=n,P===0&&V(ke)),i===n?(k=t,t=n):(r=[r,i],t=r)),P--,t===n&&(r=n,P===0&&V(Oe)),t}function Lt(){var t;return P++,e.substr(k,20).toLowerCase()===je?(t=e.substr(k,20),k+=20):(t=n,P===0&&V(Me)),P--,t===n&&P===0&&V(Ae),t}function Rt(){var t;return P++,e.substr(k,15).toLowerCase()===Pe?(t=e.substr(k,15),k+=15):(t=n,P===0&&V(Fe)),P--,t===n&&P===0&&V(Ne),t}function zt(){var t;return P++,e.substr(k,6)===_?(t=_,k+=6):(t=n,P===0&&V(Le)),P--,t===n&&P===0&&V(Ie),t}function Bt(){var t;return P++,e.substr(k,11)===v?(t=v,k+=11):(t=n,P===0&&V(ze)),P--,t===n&&P===0&&V(Re),t}function Vt(){var t;return e.substr(k,3)===y?(t=y,k+=3):(t=n,P===0&&V(Be)),t}function Ht(){var e=k,t=Kt(),r,i;return t===n?(k=e,e=n):(r=G(),r===n?(k=e,e=n):(i=K(),i===n&&(i=null),i===n?(k=e,e=n):(t=[t,r,i],e=t))),e}function U(){var e=Ut();return e===n&&(e=Wt()),e}function Ut(){var t=k,r=Qt(),i,a;if(r!==n){for(i=[],b.test(e.charAt(k))?(a=e.charAt(k),k++):(a=n,P===0&&V(x));a!==n;)i.push(a),b.test(e.charAt(k))?(a=e.charAt(k),k++):(a=n,P===0&&V(x));i===n?(k=t,t=n):(a=Qt(),a===n?(k=t,t=n):(A=t,r=S(i),t=r))}else k=t,t=n;return t}function Wt(){var t=k,r=Zt(),i,a;if(r!==n){for(i=[],C.test(e.charAt(k))?(a=e.charAt(k),k++):(a=n,P===0&&V(w));a!==n;)i.push(a),C.test(e.charAt(k))?(a=e.charAt(k),k++):(a=n,P===0&&V(w));i===n?(k=t,t=n):(a=Zt(),a===n?(k=t,t=n):(A=t,r=S(i),t=r))}else k=t,t=n;return t}function Gt(){var t=k,r,i,a;if(e.charCodeAt(k)===58?(r=p,k++):(r=n,P===0&&V(m)),r!==n){for(i=[],a=W();a!==n;)i.push(a),a=W();i===n?(k=t,t=n):(A=t,r=S(i),t=r)}else k=t,t=n;return t}function Kt(){var e=k,t=[],r=W();if(r!==n)for(;r!==n;)t.push(r),r=W();else t=n;return t!==n&&(A=e,t=S(t)),e=t,e}function qt(){var t=k,r=W(),i,a,o;if(r!==n)if(e.charCodeAt(k)===46?(i=Ve,k++):(i=n,P===0&&V(He)),i!==n){if(a=[],o=W(),o!==n)for(;o!==n;)a.push(o),o=W();else a=n;a===n?(k=t,t=n):(A=t,r=S(a),t=r)}else k=t,t=n;else k=t,t=n;return t}function W(){var t;return P++,We.test(e.charAt(k))?(t=e.charAt(k),k++):(t=n,P===0&&V(Ge)),P--,t===n&&P===0&&V(Ue),t}function Jt(){for(var e=k,t=[],r=J(),i;r!==n;)t.push(r),r=J();return t===n?(k=e,e=n):(r=Vt(),r===n?(k=e,e=n):(i=K(),i===n&&(i=null),i===n?(k=e,e=n):(t=[t,r,i],e=t))),e}function Yt(){var t,r,i,a,o;for(P++,t=k,r=[],i=J();i!==n;)r.push(i),i=J();return r===n?(k=t,t=n):(e.charCodeAt(k)===35?(i=qe,k++):(i=n,P===0&&V(Je)),i===n?(k=t,t=n):(a=G(),a===n?(k=t,t=n):(o=K(),o===n&&(o=null),o===n?(k=t,t=n):(r=[r,i,a,o],t=r)))),P--,t===n&&(r=n,P===0&&V(Ke)),t}function G(){var t,r;for(P++,t=[],T.test(e.charAt(k))?(r=e.charAt(k),k++):(r=n,P===0&&V(E));r!==n;)t.push(r),T.test(e.charAt(k))?(r=e.charAt(k),k++):(r=n,P===0&&V(E));return P--,t===n&&(r=n,P===0&&V(Ye)),t}function Xt(){var t;return T.test(e.charAt(k))?(t=e.charAt(k),k++):(t=n,P===0&&V(E)),t}function Zt(){var t;return e.charCodeAt(k)===39?(t=Xe,k++):(t=n,P===0&&V(Ze)),t}function Qt(){var t;return e.charCodeAt(k)===34?(t=Qe,k++):(t=n,P===0&&V($e)),t}function $t(){var e=[],t=q();if(t===n&&(t=J()),t!==n)for(;t!==n;)e.push(t),t=q(),t===n&&(t=J());else e=n;return e}function K(){for(var e=k,t=[],r=Y();r!==n;)t.push(r),r=Y();return t===n?(k=e,e=n):(r=en(),r===n?(k=e,e=n):(t=[t,r],e=t)),e}function q(){var t,r,i;return P++,t=k,e.substr(k,2)===D?(r=D,k+=2):(r=n,P===0&&V(tt)),r===n?(k=t,t=n):(nt.test(e.charAt(k))?(i=e.charAt(k),k++):(i=n,P===0&&V(rt)),i===n&&(i=null),i===n?(k=t,t=n):(r=[r,i],t=r)),P--,t===n&&(r=n,P===0&&V(et)),t}function en(){var t;return P++,e.substr(k,2)===O?(t=O,k+=2):(t=n,P===0&&V(at)),t===n&&(e.charCodeAt(k)===10?(t=ot,k++):(t=n,P===0&&V(st))),P--,t===n&&P===0&&V(it),t}function J(){var t;return P++,lt.test(e.charAt(k))?(t=e.charAt(k),k++):(t=n,P===0&&V(ut)),P--,t===n&&P===0&&V(ct),t}function Y(){var t;return e.charCodeAt(k)===32?(t=dt,k++):(t=n,P===0&&V(ft)),t}var X=require("pluralize"),Z=require("lodash");let Q={tables:[],refs:[]};function tn(e){Q.tables.find(t=>t.name==e.name)?I(`Duplicated table name`):(e.fields.find(e=>e.name===`id`)||e.fields.unshift({name:`id`,type:{type_name:`varchar`}}),Q.tables.push(e))}function nn(e,t,n){let r=Q.tables.find(t=>t.name===e);r||I("Table ${tableName} not found"),r.checks||=[];let i={expression:t};n&&(i.name=n),r.checks.push(i)}function rn(e=[],t=[]){let n=t.find(e=>e.name===`primary_key`);return n?e.find(e=>e.name===n.value)?e.map(({name:e,type:t})=>({name:e,type:t,PK:n.value===field.name})):[{name:n.value,type:{type_name:`varchar`},PK:!0}].concat(e):e}function an(e,t){return e.tableName==t.tableName&&Z.isEqual(Z.sortBy(e.fieldNames),Z.sortBy(t.fieldNames))}function on(e,t){return an(e[0],t[0])&&an(e[1],t[1])}function sn(e,t){return on(e.endpoints,t.endpoints)||on(e.endpoints,t.endpoints.slice().reverse())}function $(e){e&&(Q.refs.find(t=>sn(t,e))&&I(`Duplicated references`),Q.refs.push(e))}function cn(e=[]){if(!(!e||e.length===0))for(let t=0;t<e.length;t+=1)$(e[t])}function ln(e){let{tables:t}=Q,{endpoints:n}=e,r=t.find(e=>e.name===n[0].tableName);if(!r||!t.find(e=>e.name===n[1].tableName))return null;if(!n[0].fieldNames){let e=`${X.singular(n[1].tableName)}_id`;if(n[0].fieldNames=[e],!r.fields.find(t=>t.name===e))return null;n[0].fieldNames=[e]}return n[1].fieldNames||(n[1].fieldNames=[`id`]),e}function un(e,t,n){let r=[{tableName:e,relation:`1`},{tableName:t,relation:`1`}],i={};for(let e=0;e<n.length;e+=1){let t=n[e];t.columnName&&(r[0].fieldNames=[t.columnName]),t.primaryKey&&(r[1].fieldNames=[t.primaryKey]),t.onDelete&&(i={...i,onDelete:t.onDelete}),t.onUpdate&&(i={...i,onUpdate:t.onUpdate})}return{name:`fk_rails_${e}_${t}`,endpoints:r,...i}}function dn(e,t){if(!t||t.length===0)return[];let n=[];for(let r=0;r<t.length;r+=1){let i=t[r],a=X.plural(i),{tables:o}=Q,s=o.find(e=>e.name===a);if(!s)continue;let c=`${i}_id`,l=e.fields.find(e=>e.name===c),u=s.fields.find(e=>e.name===`id`);l||e.fields.push({name:c,type:{type_name:u?u.type.type_name:`varchar`}}),n.push({name:`fk_rails_${e.name}_${a}`,endpoints:[{tableName:e.name,fieldNames:[c],relation:`1`},{tableName:a,fieldNames:[`id`],relation:`1`}]})}return n}function fn(e){let{tables:t,refs:n}=e,r=t.map(e=>{let{name:t}=e;return{name:t,field:`${X.singular(t)}_id`}});for(let e=0;e<t.length;e+=1){let i=t[e],{fields:a}=i;for(let e=0;e<a.length;e+=1){let t=a[e],o=r.find(e=>e.field===t.name);if(o){let e={name:`fk_rails_${i.name}_${o.name}`,endpoints:[{tableName:i.name,fieldNames:[t.name],relation:`1`},{tableName:o.name,fieldNames:[`id`],relation:`1`}]};n.find(t=>sn(t,e))||n.push(e)}}}return e}if(F=a(),F!==n&&k===e.length)return F;throw F!==n&&k<e.length&&V(pt()),gt(N,M<e.length?e.charAt(M):null,M<e.length?B(M,M+1):B(M,M))}t.exports={SyntaxError:r,parse:i}}));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e()}});
|
|
1
|
+
"use strict";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../packages/dbml-core/node_modules/lodash/lodash.cjs"),n=require("../../node_modules/pluralize/pluralize.cjs");var r=e.__commonJSMin(((e,r)=>{t.default,n.default;function i(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function a(e,t,n,r){this.message=e,this.expected=t,this.found=n,this.location=r,this.name=`SyntaxError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,a)}i(a,Error),a.buildMessage=function(e,t){var n={literal:function(e){return`"`+i(e.text)+`"`},class:function(e){var t=``,n;for(n=0;n<e.parts.length;n++)t+=e.parts[n]instanceof Array?a(e.parts[n][0])+`-`+a(e.parts[n][1]):a(e.parts[n]);return`[`+(e.inverted?`^`:``)+t+`]`},any:function(e){return`any character`},end:function(e){return`end of input`},other:function(e){return e.description}};function r(e){return e.charCodeAt(0).toString(16).toUpperCase()}function i(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,function(e){return`\\x0`+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return`\\x`+r(e)})}function a(e){return e.replace(/\\/g,`\\\\`).replace(/\]/g,`\\]`).replace(/\^/g,`\\^`).replace(/-/g,`\\-`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,function(e){return`\\x0`+r(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return`\\x`+r(e)})}function o(e){return n[e.type](e)}function s(e){var t=Array(e.length),n,r;for(n=0;n<e.length;n++)t[n]=o(e[n]);if(t.sort(),t.length>0){for(n=1,r=1;n<t.length;n++)t[n-1]!==t[n]&&(t[r]=t[n],r++);t.length=r}switch(t.length){case 1:return t[0];case 2:return t[0]+` or `+t[1];default:return t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}}function c(e){return e?`"`+i(e)+`"`:`end of input`}return`Expected `+s(e)+` but `+c(t)+` found.`};function o(e,r){r=r===void 0?{}:r;var i={},o={schema:yt},s=yt,c=function(){return mn(Z)},l=function(e){let{table:t,refs:n}=e;an(t),un(n)},u=function(e){$(e)},d=`,`,f=L(`,`,!1),p=function(e,t,n){let r=n.find(e=>e.name)?.name;on(e,t,r)},m=function(e,t,n){return dn(fn(e,t,n))},h=`:`,g=L(`:`,!1),ee=function(e){return{columnName:e}},te=function(e){return{primaryKey:e}},ne=function(e,t){switch(e.toLowerCase()){case`on_delete`:return{onDelete:t.split(`_`).join(` `)};case`on_update`:return{onUpdate:t.split(`_`).join(` `)}}},re=function(e,t){let n={name:e,fields:sn(t.fields)};return t.checks&&t.checks.length>0&&(n.checks=t.checks),{table:n,refs:pn(n,t.references)}},ie=function(e){return{fields:e.filter(e=>e.isField).map(e=>e.field),index:e.filter(e=>e.isIndex).map(e=>e.index),references:e.filter(e=>e.isReferences).map(e=>e.reference),checks:e.filter(e=>e.isCheck).map(e=>e.check)}},ae=function(e){return e},oe=function(e){return{reference:e,isReferences:!0}},se=function(e){return{check:e,isCheck:!0}},ce=function(e){return{field:e,isField:!0}},le=function(e){return e},ue=function(e,t){let n={expression:e};for(let e=0;e<t.length;e++)t[e].name&&(n.name=t[e].name);return n},de=function(e,t){return{name:t,type:{type_name:e}}},fe=function(e){return e},pe=`name`,me=L(`name`,!0),he=function(e){return{name:e}},ge=`on_delete`,_e=L(`on_delete`,!0),ve=`on_update`,ye=L(`on_update`,!0),be=z(`create table`),xe=`create_table`,Se=L(`create_table`,!0),Ce=z(`index`),we=`.index`,Te=L(`.index`,!1),Ee=z(`references`),De=`.references`,Oe=L(`.references`,!1),ke=z(`check constraint`),_=`.check_constraint`,Ae=L(`.check_constraint`,!1),je=z(`add check constraint`),Me=`add_check_constraint`,Ne=L(`add_check_constraint`,!0),Pe=z(`add foreign key`),Fe=`add_foreign_key`,Ie=L(`add_foreign_key`,!0),Le=z(`column`),v=`column`,Re=L(`column`,!1),ze=z(`primary key`),y=`primary_key`,Be=L(`primary_key`,!1),b=`end`,Ve=L(`end`,!1),x=/^[^"\n]/,S=R([`"`,`
|
|
2
|
+
`],!0,!1),C=function(e){return e.join(``)},w=/^[^'\n]/,T=R([`'`,`
|
|
3
|
+
`],!0,!1),He=`.`,Ue=L(`.`,!1),We=z(`letter, number or underscore`),Ge=/^[a-z0-9_.]/i,Ke=R([[`a`,`z`],[`0`,`9`],`_`,`.`],!1,!0),qe=z(`comment line`),Je=`#`,Ye=L(`#`,!1),Xe=z(`whatever`),E=/^[^\t\r\n]/,D=R([` `,`\r`,`
|
|
4
|
+
`],!0,!1),Ze=`'`,Qe=L(`'`,!1),$e=`"`,et=L(`"`,!1),tt=z(`comment`),O=`//`,nt=L(`//`,!1),rt=/^[^\n]/,it=R([`
|
|
5
|
+
`],!0,!1),at=z(`newline`),ot=`\r
|
|
6
|
+
`,st=L(`\r
|
|
7
|
+
`,!1),ct=`
|
|
8
|
+
`,lt=L(`
|
|
9
|
+
`,!1),ut=z(`whitespace`),dt=/^[ \t\r\n\r]/,ft=R([` `,` `,`\r`,`
|
|
10
|
+
`,`\r`],!1,!1),pt=` `,mt=L(` `,!1),k=0,A=0,j=[{line:1,column:1}],M=0,N=[],P=0,F;if(`startRule`in r){if(!(r.startRule in o))throw Error(`Can't start parsing from rule "`+r.startRule+`".`);s=o[r.startRule]}function I(e,t){throw t=t===void 0?B(A,k):t,_t(e,t)}function L(e,t){return{type:`literal`,text:e,ignoreCase:t}}function R(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function ht(){return{type:`end`}}function z(e){return{type:`other`,description:e}}function gt(t){var n=j[t],r;if(n)return n;for(r=t-1;!j[r];)r--;for(n=j[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return j[t]=n,n}function B(e,t){var n=gt(e),r=gt(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function V(e){k<M||(k>M&&(M=k,N=[]),N.push(e))}function _t(e,t){return new a(e,null,null,t)}function vt(e,t,n){return new a(a.buildMessage(e,t),e,t,n)}function yt(){for(var e=k,t=[],n=bt();n!==i;)t.push(n),n=bt();return t!==i&&(A=e,t=c()),e=t,e}function bt(){for(var e=k,t=[],n=q();n!==i;)t.push(n),n=q();return t===i?(k=e,e=i):(n=xt(),n===i?(k=e,e=i):(t=[t,n],e=t)),e===i&&(e=Zt(),e===i&&(e=Xt(),e===i&&(e=tn()))),e}function xt(){var e=k,t=Tt();return t!==i&&(A=e,t=l(t)),e=t,e===i&&(e=k,t=Ct(),t!==i&&(A=e,t=u(t)),e=t,e===i&&(e=St(),e===i&&(e=Wt()))),e}function St(){for(var t=k,n=[],r=J(),a,o,s,c,l,u,m;r!==i;)n.push(r),r=J();if(n!==i)if(r=zt(),r!==i){for(a=[],o=J();o!==i;)a.push(o),o=J();if(a!==i)if(o=qt(),o===i&&(o=U()),o!==i)if(e.charCodeAt(k)===44?(s=d,k++):(s=i,P===0&&V(f)),s!==i){for(c=[],l=J();l!==i;)c.push(l),l=J();if(c!==i)if(l=U(),l!==i){for(u=[],m=H();m!==i;)u.push(m),m=H();u===i?(k=t,t=i):(A=t,n=p(o,l,u),t=n)}else k=t,t=i;else k=t,t=i}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i;else k=t,t=i;return t}function Ct(){for(var t=k,n=[],r=J(),a,o,s,c,l,u,p;r!==i;)n.push(r),r=J();if(n!==i)if(r=Bt(),r!==i){for(a=[],o=J();o!==i;)a.push(o),o=J();if(a!==i)if(o=U(),o!==i)if(e.charCodeAt(k)===44?(s=d,k++):(s=i,P===0&&V(f)),s!==i){for(c=[],l=J();l!==i;)c.push(l),l=J();if(c!==i)if(l=U(),l!==i){for(u=[],p=wt();p!==i;)u.push(p),p=wt();u===i?(k=t,t=i):(A=t,n=m(o,l,u),t=n)}else k=t,t=i;else k=t,t=i}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i;else k=t,t=i;return t}function wt(){var t=k,n,r,a,o,s,c;if(e.charCodeAt(k)===44?(n=d,k++):(n=i,P===0&&V(f)),n!==i){for(r=[],a=J();a!==i;)r.push(a),a=J();if(r!==i)if(a=Vt(),a!==i)if(e.charCodeAt(k)===58?(o=h,k++):(o=i,P===0&&V(g)),o!==i){for(s=[],c=J();c!==i;)s.push(c),c=J();s===i?(k=t,t=i):(c=U(),c===i?(k=t,t=i):(A=t,n=ee(c),t=n))}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i;if(t===i){if(t=k,e.charCodeAt(k)===44?(n=d,k++):(n=i,P===0&&V(f)),n!==i){for(r=[],a=J();a!==i;)r.push(a),a=J();if(r!==i)if(a=Ht(),a!==i)if(e.charCodeAt(k)===58?(o=h,k++):(o=i,P===0&&V(g)),o!==i){for(s=[],c=J();c!==i;)s.push(c),c=J();s===i?(k=t,t=i):(c=U(),c===i?(k=t,t=i):(A=t,n=te(c),t=n))}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i;if(t===i)if(t=k,e.charCodeAt(k)===44?(n=d,k++):(n=i,P===0&&V(f)),n!==i){for(r=[],a=J();a!==i;)r.push(a),a=J();if(r!==i)if(a=Pt(),a!==i)if(e.charCodeAt(k)===58?(o=h,k++):(o=i,P===0&&V(g)),o!==i){for(s=[],c=J();c!==i;)s.push(c),c=J();s===i?(k=t,t=i):(c=qt(),c===i?(k=t,t=i):(A=t,n=ne(a,c),t=n))}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i}return t}function Tt(){var e=k,t=Ft(),n,r,a,o,s,c;if(t!==i){for(n=[],r=J();r!==i;)n.push(r),r=J();n===i?(k=e,e=i):(r=U(),r===i?(k=e,e=i):(a=G(),a===i?(k=e,e=i):(o=K(),o===i?(k=e,e=i):(s=Et(),s===i?(k=e,e=i):(c=Xt(),c===i?(k=e,e=i):(A=e,t=re(r,s),e=t))))))}else k=e,e=i;return e}function Et(){for(var e=k,t=[],n=Dt();n!==i;)t.push(n),n=Dt();return t!==i&&(A=e,t=ie(t)),e=t,e}function Dt(){for(var e=k,t=[],n=q(),r,a;n!==i;)t.push(n),n=q();if(t!==i)if(n=Ot(),n!==i){for(r=[],a=Qt();a!==i;)r.push(a),a=Qt();r===i?(k=e,e=i):(a=K(),a===i?(k=e,e=i):(A=e,t=ae(n),e=t))}else k=e,e=i;else k=e,e=i;return e}function Ot(){var e=kt(),t;return e===i&&(e=k,t=At(),t!==i&&(A=e,t=oe(t)),e=t,e===i&&(e=k,t=jt(),t!==i&&(A=e,t=se(t)),e=t,e===i&&(e=k,t=Mt(),t!==i&&(A=e,t=ce(t)),e=t))),e}function kt(){var e=k,t=It(),n,r;if(t!==i){if(n=[],r=J(),r!==i)for(;r!==i;)n.push(r),r=J();else n=i;n===i?(k=e,e=i):(r=G(),r===i?(k=e,e=i):(t=[t,n,r],e=t))}else k=e,e=i;return e}function At(){var e=k,t=Lt(),n,r;if(t!==i){if(n=[],r=J(),r!==i)for(;r!==i;)n.push(r),r=J();else n=i;n===i?(k=e,e=i):(r=Nt(),r===i?(k=e,e=i):(A=e,t=le(r),e=t))}else k=e,e=i;return e}function jt(){var e=k,t=Rt(),n,r,a,o;if(t!==i){if(n=[],r=J(),r!==i)for(;r!==i;)n.push(r),r=J();else n=i;if(n!==i)if(r=U(),r!==i){for(a=[],o=H();o!==i;)a.push(o),o=H();a===i?(k=e,e=i):(A=e,t=ue(r,a),e=t)}else k=e,e=i;else k=e,e=i}else k=e,e=i;return e}function Mt(){var e=k,t=Yt(),n,r;if(t!==i){if(n=[],r=J(),r!==i)for(;r!==i;)n.push(r),r=J();else n=i;n===i?(k=e,e=i):(r=U(),r===i?(k=e,e=i):(A=e,t=de(t,r),e=t))}else k=e,e=i;return e}function Nt(){var t=k,n,r;return e.charCodeAt(k)===58?(n=h,k++):(n=i,P===0&&V(g)),n===i?(k=t,t=i):(r=Jt(),r===i?(k=t,t=i):(A=t,n=fe(r),t=n)),t===i&&(t=k,n=U(),n!==i&&(A=t,n=fe(n)),t=n),t}function H(){var t=k,n,r,a,o,s,c;if(e.charCodeAt(k)===44?(n=d,k++):(n=i,P===0&&V(f)),n!==i){for(r=[],a=J();a!==i;)r.push(a),a=J();if(r!==i)if(e.substr(k,4).toLowerCase()===pe?(a=e.substr(k,4),k+=4):(a=i,P===0&&V(me)),a!==i)if(e.charCodeAt(k)===58?(o=h,k++):(o=i,P===0&&V(g)),o!==i){for(s=[],c=J();c!==i;)s.push(c),c=J();s===i?(k=t,t=i):(c=U(),c===i?(k=t,t=i):(A=t,n=he(c),t=n))}else k=t,t=i;else k=t,t=i;else k=t,t=i}else k=t,t=i;return t}function Pt(){var t;return e.substr(k,9).toLowerCase()===ge?(t=e.substr(k,9),k+=9):(t=i,P===0&&V(_e)),t===i&&(e.substr(k,9).toLowerCase()===ve?(t=e.substr(k,9),k+=9):(t=i,P===0&&V(ye))),t}function Ft(){var t;return P++,e.substr(k,12).toLowerCase()===xe?(t=e.substr(k,12),k+=12):(t=i,P===0&&V(Se)),P--,t===i&&P===0&&V(be),t}function It(){var t,n,r;return P++,t=k,n=W(),n===i?(k=t,t=i):(e.substr(k,6)===we?(r=we,k+=6):(r=i,P===0&&V(Te)),r===i?(k=t,t=i):(n=[n,r],t=n)),P--,t===i&&(n=i,P===0&&V(Ce)),t}function Lt(){var t,n,r;return P++,t=k,n=W(),n===i?(k=t,t=i):(e.substr(k,11)===De?(r=De,k+=11):(r=i,P===0&&V(Oe)),r===i?(k=t,t=i):(n=[n,r],t=n)),P--,t===i&&(n=i,P===0&&V(Ee)),t}function Rt(){var t,n,r;return P++,t=k,n=W(),n===i?(k=t,t=i):(e.substr(k,17)===_?(r=_,k+=17):(r=i,P===0&&V(Ae)),r===i?(k=t,t=i):(n=[n,r],t=n)),P--,t===i&&(n=i,P===0&&V(ke)),t}function zt(){var t;return P++,e.substr(k,20).toLowerCase()===Me?(t=e.substr(k,20),k+=20):(t=i,P===0&&V(Ne)),P--,t===i&&P===0&&V(je),t}function Bt(){var t;return P++,e.substr(k,15).toLowerCase()===Fe?(t=e.substr(k,15),k+=15):(t=i,P===0&&V(Ie)),P--,t===i&&P===0&&V(Pe),t}function Vt(){var t;return P++,e.substr(k,6)===v?(t=v,k+=6):(t=i,P===0&&V(Re)),P--,t===i&&P===0&&V(Le),t}function Ht(){var t;return P++,e.substr(k,11)===y?(t=y,k+=11):(t=i,P===0&&V(Be)),P--,t===i&&P===0&&V(ze),t}function Ut(){var t;return e.substr(k,3)===b?(t=b,k+=3):(t=i,P===0&&V(Ve)),t}function Wt(){var e=k,t=Jt(),n,r;return t===i?(k=e,e=i):(n=G(),n===i?(k=e,e=i):(r=K(),r===i&&(r=null),r===i?(k=e,e=i):(t=[t,n,r],e=t))),e}function U(){var e=Gt();return e===i&&(e=Kt()),e}function Gt(){var t=k,n=en(),r,a;if(n!==i){for(r=[],x.test(e.charAt(k))?(a=e.charAt(k),k++):(a=i,P===0&&V(S));a!==i;)r.push(a),x.test(e.charAt(k))?(a=e.charAt(k),k++):(a=i,P===0&&V(S));r===i?(k=t,t=i):(a=en(),a===i?(k=t,t=i):(A=t,n=C(r),t=n))}else k=t,t=i;return t}function Kt(){var t=k,n=$t(),r,a;if(n!==i){for(r=[],w.test(e.charAt(k))?(a=e.charAt(k),k++):(a=i,P===0&&V(T));a!==i;)r.push(a),w.test(e.charAt(k))?(a=e.charAt(k),k++):(a=i,P===0&&V(T));r===i?(k=t,t=i):(a=$t(),a===i?(k=t,t=i):(A=t,n=C(r),t=n))}else k=t,t=i;return t}function qt(){var t=k,n,r,a;if(e.charCodeAt(k)===58?(n=h,k++):(n=i,P===0&&V(g)),n!==i){for(r=[],a=W();a!==i;)r.push(a),a=W();r===i?(k=t,t=i):(A=t,n=C(r),t=n)}else k=t,t=i;return t}function Jt(){var e=k,t=[],n=W();if(n!==i)for(;n!==i;)t.push(n),n=W();else t=i;return t!==i&&(A=e,t=C(t)),e=t,e}function Yt(){var t=k,n=W(),r,a,o;if(n!==i)if(e.charCodeAt(k)===46?(r=He,k++):(r=i,P===0&&V(Ue)),r!==i){if(a=[],o=W(),o!==i)for(;o!==i;)a.push(o),o=W();else a=i;a===i?(k=t,t=i):(A=t,n=C(a),t=n)}else k=t,t=i;else k=t,t=i;return t}function W(){var t;return P++,Ge.test(e.charAt(k))?(t=e.charAt(k),k++):(t=i,P===0&&V(Ke)),P--,t===i&&P===0&&V(We),t}function Xt(){for(var e=k,t=[],n=q(),r;n!==i;)t.push(n),n=q();return t===i?(k=e,e=i):(n=Ut(),n===i?(k=e,e=i):(r=K(),r===i&&(r=null),r===i?(k=e,e=i):(t=[t,n,r],e=t))),e}function Zt(){var t,n,r,a,o;for(P++,t=k,n=[],r=q();r!==i;)n.push(r),r=q();return n===i?(k=t,t=i):(e.charCodeAt(k)===35?(r=Je,k++):(r=i,P===0&&V(Ye)),r===i?(k=t,t=i):(a=G(),a===i?(k=t,t=i):(o=K(),o===i&&(o=null),o===i?(k=t,t=i):(n=[n,r,a,o],t=n)))),P--,t===i&&(n=i,P===0&&V(qe)),t}function G(){var t,n;for(P++,t=[],E.test(e.charAt(k))?(n=e.charAt(k),k++):(n=i,P===0&&V(D));n!==i;)t.push(n),E.test(e.charAt(k))?(n=e.charAt(k),k++):(n=i,P===0&&V(D));return P--,t===i&&(n=i,P===0&&V(Xe)),t}function Qt(){var t;return E.test(e.charAt(k))?(t=e.charAt(k),k++):(t=i,P===0&&V(D)),t}function $t(){var t;return e.charCodeAt(k)===39?(t=Ze,k++):(t=i,P===0&&V(Qe)),t}function en(){var t;return e.charCodeAt(k)===34?(t=$e,k++):(t=i,P===0&&V(et)),t}function tn(){var e=[],t=nn();if(t===i&&(t=q()),t!==i)for(;t!==i;)e.push(t),t=nn(),t===i&&(t=q());else e=i;return e}function K(){for(var e=k,t=[],n=J();n!==i;)t.push(n),n=J();return t===i?(k=e,e=i):(n=rn(),n===i?(k=e,e=i):(t=[t,n],e=t)),e}function nn(){var t,n,r;return P++,t=k,e.substr(k,2)===O?(n=O,k+=2):(n=i,P===0&&V(nt)),n===i?(k=t,t=i):(rt.test(e.charAt(k))?(r=e.charAt(k),k++):(r=i,P===0&&V(it)),r===i&&(r=null),r===i?(k=t,t=i):(n=[n,r],t=n)),P--,t===i&&(n=i,P===0&&V(tt)),t}function rn(){var t;return P++,e.substr(k,2)===ot?(t=ot,k+=2):(t=i,P===0&&V(st)),t===i&&(e.charCodeAt(k)===10?(t=ct,k++):(t=i,P===0&&V(lt))),P--,t===i&&P===0&&V(at),t}function q(){var t;return P++,dt.test(e.charAt(k))?(t=e.charAt(k),k++):(t=i,P===0&&V(ft)),P--,t===i&&P===0&&V(ut),t}function J(){var t;return e.charCodeAt(k)===32?(t=pt,k++):(t=i,P===0&&V(mt)),t}var Y=n.default,X=t.default;let Z={tables:[],refs:[]};function an(e){Z.tables.find(t=>t.name==e.name)?I(`Duplicated table name`):(e.fields.find(e=>e.name===`id`)||e.fields.unshift({name:`id`,type:{type_name:`varchar`}}),Z.tables.push(e))}function on(e,t,n){let r=Z.tables.find(t=>t.name===e);r||I("Table ${tableName} not found"),r.checks||=[];let i={expression:t};n&&(i.name=n),r.checks.push(i)}function sn(e=[],t=[]){let n=t.find(e=>e.name===`primary_key`);return n?e.find(e=>e.name===n.value)?e.map(({name:e,type:t})=>({name:e,type:t,PK:n.value===field.name})):[{name:n.value,type:{type_name:`varchar`},PK:!0}].concat(e):e}function cn(e,t){return e.tableName==t.tableName&&X.isEqual(X.sortBy(e.fieldNames),X.sortBy(t.fieldNames))}function Q(e,t){return cn(e[0],t[0])&&cn(e[1],t[1])}function ln(e,t){return Q(e.endpoints,t.endpoints)||Q(e.endpoints,t.endpoints.slice().reverse())}function $(e){e&&(Z.refs.find(t=>ln(t,e))&&I(`Duplicated references`),Z.refs.push(e))}function un(e=[]){if(!(!e||e.length===0))for(let t=0;t<e.length;t+=1)$(e[t])}function dn(e){let{tables:t}=Z,{endpoints:n}=e,r=t.find(e=>e.name===n[0].tableName);if(!r||!t.find(e=>e.name===n[1].tableName))return null;if(!n[0].fieldNames){let e=`${Y.singular(n[1].tableName)}_id`;if(n[0].fieldNames=[e],!r.fields.find(t=>t.name===e))return null;n[0].fieldNames=[e]}return n[1].fieldNames||(n[1].fieldNames=[`id`]),e}function fn(e,t,n){let r=[{tableName:e,relation:`1`},{tableName:t,relation:`1`}],i={};for(let e=0;e<n.length;e+=1){let t=n[e];t.columnName&&(r[0].fieldNames=[t.columnName]),t.primaryKey&&(r[1].fieldNames=[t.primaryKey]),t.onDelete&&(i={...i,onDelete:t.onDelete}),t.onUpdate&&(i={...i,onUpdate:t.onUpdate})}return{name:`fk_rails_${e}_${t}`,endpoints:r,...i}}function pn(e,t){if(!t||t.length===0)return[];let n=[];for(let r=0;r<t.length;r+=1){let i=t[r],a=Y.plural(i),{tables:o}=Z,s=o.find(e=>e.name===a);if(!s)continue;let c=`${i}_id`,l=e.fields.find(e=>e.name===c),u=s.fields.find(e=>e.name===`id`);l||e.fields.push({name:c,type:{type_name:u?u.type.type_name:`varchar`}}),n.push({name:`fk_rails_${e.name}_${a}`,endpoints:[{tableName:e.name,fieldNames:[c],relation:`1`},{tableName:a,fieldNames:[`id`],relation:`1`}]})}return n}function mn(e){let{tables:t,refs:n}=e,r=t.map(e=>{let{name:t}=e;return{name:t,field:`${Y.singular(t)}_id`}});for(let e=0;e<t.length;e+=1){let i=t[e],{fields:a}=i;for(let e=0;e<a.length;e+=1){let t=a[e],o=r.find(e=>e.field===t.name);if(o){let e={name:`fk_rails_${i.name}_${o.name}`,endpoints:[{tableName:i.name,fieldNames:[t.name],relation:`1`},{tableName:o.name,fieldNames:[`id`],relation:`1`}]};n.find(t=>ln(t,e))||n.push(e)}}}return e}if(F=s(),F!==i&&k===e.length)return F;throw F!==i&&k<e.length&&V(ht()),vt(N,M<e.length?e.charAt(M):null,M<e.length?B(M,M+1):B(M,M))}r.exports={SyntaxError:a,parse:o}}));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r()}});
|