@dineug/erd-editor 4.2.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +208 -20
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/assertClassBrand.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldGet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldSet2.js +7 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.js +12 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/typeof.js +11 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/appContext.js +45 -0
- package/dist/components/customElementClass.d.ts +10 -0
- package/dist/components/dictionary/Dictionary.js +584 -0
- package/dist/components/dictionary/Dictionary.styles.js +208 -0
- package/dist/components/dictionary/checkCount.js +59 -0
- package/dist/components/dictionary/checkSheet.js +121 -0
- package/dist/components/dictionary/dictionary-context-menu/DictionaryContextMenu.js +17 -0
- package/dist/components/dictionary/dictionaryCommit.js +237 -0
- package/dist/components/dictionary/dictionaryFile.js +72 -0
- package/dist/components/dictionary/dictionaryKeys.js +86 -0
- package/dist/components/dictionary/dictionaryView.js +100 -0
- package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.js +110 -0
- package/dist/components/dictionary/domain-cell-editor/DomainCellEditor.styles.js +65 -0
- package/dist/components/dictionary/domain-cell-editor/openDomainCellEditor.js +16 -0
- package/dist/components/dictionary/gridTheme.js +51 -0
- package/dist/components/dictionary/sheets.js +199 -0
- package/dist/components/diffContext.d.ts +10 -0
- package/dist/components/diffContext.js +7 -0
- package/dist/components/element-host/localeHost.d.ts +43 -0
- package/dist/components/element-host/localeHost.js +81 -0
- package/dist/components/element-host/themeHost.d.ts +30 -0
- package/dist/components/element-host/themeHost.js +101 -0
- package/dist/components/erd/Erd.d.ts +2 -0
- package/dist/components/erd/Erd.js +431 -0
- package/dist/components/erd/Erd.styles.js +12 -0
- package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.js +139 -0
- package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.styles.js +22 -0
- package/dist/components/erd/automatic-table-placement/createAutomaticTablePlacement.js +175 -0
- package/dist/components/erd/automatic-table-placement/elkPlacement.js +56 -0
- package/dist/components/erd/automatic-table-placement/flowPlacement.js +32 -0
- package/dist/components/erd/automatic-table-placement/placementActions.js +33 -0
- package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +3 -2
- package/dist/components/erd/automatic-table-placement/runElkPlacement.js +30 -0
- package/dist/components/erd/canvas/Canvas.d.ts +8 -2
- package/dist/components/erd/canvas/Canvas.js +78 -0
- package/dist/components/erd/canvas/Canvas.styles.js +15 -0
- package/dist/components/erd/canvas/CanvasScene.d.ts +28 -3
- package/dist/components/erd/canvas/CanvasScene.js +80 -0
- package/dist/components/erd/canvas/DiffOutline.template.js +5 -0
- package/dist/components/erd/canvas/EditOverlay.js +349 -0
- package/dist/components/erd/canvas/EditOverlay.styles.js +19 -0
- package/dist/components/erd/canvas/SceneIcon.template.js +14 -0
- package/dist/components/erd/canvas/altDragDuplicate.js +16 -0
- package/dist/components/erd/canvas/column-drag-ghost/ColumnDragGhost.js +61 -0
- package/dist/components/erd/canvas/{column-drag-ghost/columnDragPointer.d.ts → columnDragPointer.d.ts} +2 -2
- package/dist/components/erd/canvas/columnDragPointer.js +30 -0
- package/dist/components/erd/canvas/drag-select/DragSelect.js +109 -0
- package/dist/components/erd/canvas/draw-relationship/DrawRelationship.js +60 -0
- package/dist/components/erd/canvas/duplicate-ghost/DuplicateGhost.js +108 -0
- package/dist/components/erd/canvas/editingLayers.d.ts +8 -0
- package/dist/components/erd/canvas/editingLayers.js +21 -0
- package/dist/components/erd/canvas/entityDrag.d.ts +2 -1
- package/dist/components/erd/canvas/entityDrag.js +42 -0
- package/dist/components/erd/canvas/high-level-table/HighLevelTable.js +82 -0
- package/dist/components/erd/canvas/highlightTransition.d.ts +6 -0
- package/dist/components/erd/canvas/highlightTransition.js +79 -0
- package/dist/components/erd/canvas/memo/Memo.js +152 -0
- package/dist/components/erd/canvas/memo/memo-sash/MemoSash.js +190 -0
- package/dist/components/erd/canvas/memo/memoCaret.js +66 -0
- package/dist/components/erd/canvas/memo/memoScroll.js +14 -0
- package/dist/components/erd/canvas/memo/memoText.js +41 -0
- package/dist/components/erd/canvas/memo/useMoveMemo.js +19 -0
- package/dist/components/erd/canvas/middleButtonPan.js +33 -0
- package/dist/components/erd/canvas/mixColor.js +23 -0
- package/dist/components/erd/canvas/readPress.d.ts +43 -0
- package/dist/components/erd/canvas/readPress.js +102 -0
- package/dist/components/erd/canvas/relationship-group/RelationshipGroup.js +26 -0
- package/dist/components/erd/canvas/relationship-group/relationship/Relationship.js +153 -0
- package/dist/components/erd/canvas/relationship-group/relationship/Relationship.template.js +75 -0
- package/dist/components/erd/canvas/relationship-group/relationship/RelationshipActionLabel.js +68 -0
- package/dist/components/erd/canvas/sceneHit.js +38 -0
- package/dist/components/erd/canvas/sceneKind.js +12 -0
- package/dist/components/erd/canvas/sceneRetention.js +20 -0
- package/dist/components/erd/canvas/sceneTokens.js +110 -0
- package/dist/components/erd/canvas/shared-drag-select/SharedDragSelect.js +35 -0
- package/dist/components/erd/canvas/shared-mouse-tracker/SharedMouseTracker.js +29 -0
- package/dist/components/erd/canvas/shared-mouse-tracker/shared-mouse-cursor/SharedMouseCursor.js +40 -0
- package/dist/components/erd/canvas/stagePressScope.d.ts +11 -0
- package/dist/components/erd/canvas/stagePressScope.js +24 -0
- package/dist/components/erd/canvas/table/Table.js +399 -0
- package/dist/components/erd/canvas/table/blankLogicalName.js +14 -0
- package/dist/components/erd/canvas/table/cellLayout.js +147 -0
- package/dist/components/erd/canvas/table/colorEdge.js +16 -0
- package/dist/components/erd/canvas/table/column/Column.d.ts +6 -1
- package/dist/components/erd/canvas/table/column/Column.js +416 -0
- package/dist/components/erd/canvas/table/dictionaryMarks.js +42 -0
- package/dist/components/erd/canvas/table/doubleClick.js +15 -0
- package/dist/components/erd/canvas/table/goToErd.js +10 -0
- package/dist/components/erd/canvas/table/useFocusTable.js +19 -0
- package/dist/components/erd/canvas/table/useMoveTable.js +21 -0
- package/dist/components/erd/canvas/table/useSharedFocusTable.js +53 -0
- package/dist/components/erd/canvas/table/useViewPin.js +21 -0
- package/dist/components/erd/canvas/table-group/TableGroup.js +141 -0
- package/dist/components/erd/canvas/table-group/TableGroupBody.js +47 -0
- package/dist/components/erd/canvas/table-group/TableGroupDropTarget.js +25 -0
- package/dist/components/erd/canvas/table-group/TableGroupSash.js +143 -0
- package/dist/components/erd/canvas/table-group/TableGroups.js +21 -0
- package/dist/components/erd/canvas/table-group/tableGroupBox.js +57 -0
- package/dist/components/erd/canvas/table-group/tableGroupNameEditor.d.ts +11 -0
- package/dist/components/erd/canvas/table-group/tableGroupNameEditor.js +9 -0
- package/dist/components/erd/canvas/table-group/titleLayout.js +31 -0
- package/dist/components/erd/canvas/useMoveEntity.d.ts +1 -1
- package/dist/components/erd/canvas/useMoveEntity.js +80 -0
- package/dist/components/erd/canvas/useSharedSelectEntity.js +28 -0
- package/dist/components/erd/content-compass/ContentCompass.js +23 -0
- package/dist/components/erd/content-compass/ContentCompass.styles.js +32 -0
- package/dist/components/erd/content-compass/compassGeometry.js +71 -0
- package/dist/components/erd/diff-viewer/DiffViewer.js +75 -0
- package/dist/components/erd/diff-viewer/DiffViewer.styles.js +28 -0
- package/dist/components/erd/diff-viewer/diff-erd-viewer/DiffErdViewer.d.ts +11 -0
- package/dist/components/erd/diff-viewer/diff-erd-viewer/DiffErdViewer.js +105 -0
- package/dist/components/erd/diff-viewer/{erd-viewer/ErdViewer.styles.d.ts → diff-erd-viewer/DiffErdViewer.styles.d.ts} +1 -1
- package/dist/components/erd/diff-viewer/diff-erd-viewer/DiffErdViewer.styles.js +12 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.js +130 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.js +139 -0
- package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.js +203 -0
- package/dist/components/erd/draw-target/DrawTargetButtons.js +284 -0
- package/dist/components/erd/draw-target/DrawTargetButtons.styles.js +64 -0
- package/dist/components/erd/draw-target/drawTargetState.js +37 -0
- package/dist/components/erd/draw-target/findDrawTarget.js +22 -0
- package/dist/components/erd/draw-target/placePill.js +72 -0
- package/dist/components/erd/erd-context-menu/ErdContextMenu.d.ts +6 -0
- package/dist/components/erd/erd-context-menu/ErdContextMenu.js +306 -0
- package/dist/components/erd/erd-context-menu/menus/databaseMenus.js +51 -0
- package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.js +48 -0
- package/dist/components/erd/erd-context-menu/menus/exportMenus.js +38 -0
- package/dist/components/erd/erd-context-menu/menus/importMenus.js +49 -0
- package/dist/components/erd/erd-context-menu/menus/nameViewMenus.d.ts +1 -10
- package/dist/components/erd/erd-context-menu/menus/nameViewMenus.js +16 -0
- package/dist/components/erd/erd-context-menu/menus/relationshipMenus.js +105 -0
- package/dist/components/erd/erd-context-menu/menus/showMenus.js +80 -0
- package/dist/components/erd/erd-context-menu/menus/tablePlacementMenus.js +42 -0
- package/dist/components/erd/erdShortcutPerformCheck.js +20 -0
- package/dist/components/erd/erdTarget.d.ts +9 -0
- package/dist/components/erd/erdTarget.js +65 -0
- package/dist/components/erd/fieldIcon.js +17 -0
- package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +1 -5
- package/dist/components/erd/floating-toolbar/FloatingToolbar.js +105 -0
- package/dist/components/erd/floating-toolbar/FloatingToolbar.styles.d.ts +1 -6
- package/dist/components/erd/goToErdTarget.js +248 -0
- package/dist/components/erd/hitTest.d.ts +9 -0
- package/dist/components/erd/hitTest.js +115 -0
- package/dist/components/erd/minimap/Minimap.js +98 -0
- package/dist/components/erd/minimap/Minimap.styles.js +29 -0
- package/dist/components/erd/minimap/MinimapScene.js +41 -0
- package/dist/components/erd/minimap/memo/Memo.js +17 -0
- package/dist/components/erd/minimap/minimapGeometry.js +140 -0
- package/dist/components/erd/minimap/table/Table.js +22 -0
- package/dist/components/erd/minimap/table-group/TableGroup.js +22 -0
- package/dist/components/erd/minimap/useMinimapScroll.js +83 -0
- package/dist/components/erd/minimap/viewport/Viewport.js +34 -0
- package/dist/components/erd/minimap/viewport/Viewport.styles.js +17 -0
- package/dist/components/erd/nameViewOptions.d.ts +11 -0
- package/dist/components/erd/nameViewOptions.js +18 -0
- package/dist/components/erd/readerNameView.js +5 -0
- package/dist/components/erd/relationshipHighlight.d.ts +8 -3
- package/dist/components/erd/relationshipHighlight.js +32 -0
- package/dist/components/erd/table-group/TableGroupDraft.js +14 -0
- package/dist/components/erd/table-group/TableGroupDraft.styles.js +22 -0
- package/dist/components/erd/table-group/tableGroupName.d.ts +0 -9
- package/dist/components/erd/table-group/tableGroupName.js +10 -0
- package/dist/components/erd/table-group/useTableGroupDraw.js +97 -0
- package/dist/components/erd/table-properties/TableProperties.js +67 -0
- package/dist/components/erd/table-properties/TableProperties.styles.js +172 -0
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.js +76 -0
- package/dist/components/erd/table-properties/table-properties-indexes/TablePropertiesIndexes.styles.js +115 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.js +92 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-checkbox-column/IndexesCheckboxColumn.styles.js +70 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.js +85 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-column/IndexesColumn.styles.js +60 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.js +46 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-index/IndexesIndex.styles.js +85 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.js +30 -0
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.styles.js +62 -0
- package/dist/components/erd/table-properties/table-properties-tabs/TablePropertiesTabs.js +21 -0
- package/dist/components/erd/table-properties/table-properties-tabs/TablePropertiesTabs.styles.js +34 -0
- package/dist/components/erd/time-travel/TimeTravel.js +83 -0
- package/dist/components/erd/time-travel/TimeTravel.styles.js +42 -0
- package/dist/components/erd/useErdShortcut.js +214 -0
- package/dist/components/erd/view-controls/ToolbarCompass.template.js +10 -0
- package/dist/components/erd/view-controls/nameViewDropdown.js +107 -0
- package/dist/components/erd/view-controls/nameViewDropdown.styles.js +31 -0
- package/dist/components/erd/view-controls/viewControls.styles.d.ts +7 -0
- package/dist/components/erd/view-controls/viewControls.styles.js +75 -0
- package/dist/components/erd/view-controls/zoomControls.d.ts +9 -0
- package/dist/components/erd/view-controls/zoomControls.js +31 -0
- package/dist/components/erd/virtual-scroll/VirtualScroll.js +63 -0
- package/dist/components/erd/virtual-scroll/VirtualScroll.styles.js +48 -0
- package/dist/components/erd/virtual-scroll/useVirtualScroll.js +126 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.js +194 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.styles.js +67 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.js +47 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.js +52 -0
- package/dist/components/erd/welcome-screen/welcome-hints/hintArrows.js +10 -0
- package/dist/components/erd/welcome-screen/welcomeLayout.js +65 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +14 -3
- package/dist/components/erd-editor/ErdEditor.js +188 -0
- package/dist/components/erd-editor/ErdEditor.styles.js +47 -0
- package/dist/components/erd-editor/useErdEditorAttachElement.d.ts +6 -20
- package/dist/components/erd-editor/useErdEditorAttachElement.js +284 -0
- package/dist/components/erd-editor/viewportLayout.js +93 -0
- package/dist/components/erd-view/ErdView.d.ts +25 -0
- package/dist/components/erd-view/ErdView.js +125 -0
- package/dist/components/erd-view/ErdView.styles.d.ts +3 -0
- package/dist/components/erd-view/ErdView.styles.js +51 -0
- package/dist/components/erd-view/viewportMeasure.d.ts +9 -0
- package/dist/components/erd-view/viewportMeasure.js +19 -0
- package/dist/components/erd-viewer/ErdViewer.d.ts +67 -0
- package/dist/components/erd-viewer/ErdViewer.js +287 -0
- package/dist/components/erd-viewer/documentSource.d.ts +26 -0
- package/dist/components/erd-viewer/documentSource.js +39 -0
- package/dist/components/explorer/Explorer.js +40 -0
- package/dist/components/explorer/explorer-controller/ExplorerController.js +43 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.js +207 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.styles.js +133 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.js +119 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.styles.js +151 -0
- package/dist/components/explorer/explorerCommands.js +45 -0
- package/dist/components/explorer/explorerNavigation.js +50 -0
- package/dist/components/explorer/explorerSearch.js +298 -0
- package/dist/components/explorer/explorerTree.js +331 -0
- package/dist/components/explorer/explorerView.js +46 -0
- package/dist/components/explorer/matchTarget.d.ts +0 -7
- package/dist/components/explorer/matchTarget.js +51 -0
- package/dist/components/export-image/ExportImage.js +230 -0
- package/dist/components/export-image/ExportImage.styles.js +172 -0
- package/dist/components/export-image/exportImageActions.js +102 -0
- package/dist/components/flowCenters.js +29 -0
- package/dist/components/generator-code/GeneratorCode.d.ts +1 -0
- package/dist/components/generator-code/GeneratorCode.js +96 -0
- package/dist/components/generator-code/generator-code-context-menu/GeneratorCodeContextMenu.js +49 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/columnNameCaseMenus.js +37 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/languageMenus.js +115 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/tableNameCaseMenus.js +37 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.d.ts +4 -3
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.js +122 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.styles.js +12 -0
- package/dist/components/generator-code/generatorCodeView.js +17 -0
- package/dist/components/generator-code/languageSettings.js +48 -0
- package/dist/components/global-styles/GlobalStyles.js +18 -0
- package/dist/components/locale-picker/LocalePicker.js +129 -0
- package/dist/components/locale-picker/LocalePicker.styles.js +112 -0
- package/dist/components/localeContext.js +8 -0
- package/dist/components/localized/Localized.js +15 -0
- package/dist/components/map-columns/MapColumnsBody.js +186 -0
- package/dist/components/map-columns/MapColumnsDialog.js +112 -0
- package/dist/components/map-columns/MapColumnsDialog.styles.js +169 -0
- package/dist/components/map-columns/mapColumnsAction.js +18 -0
- package/dist/components/map-columns/nameOf.js +8 -0
- package/dist/components/map-columns/openMapColumns.js +10 -0
- package/dist/components/primitives/button/Button.js +12 -0
- package/dist/components/primitives/button/Button.styles.js +64 -0
- package/dist/components/primitives/code-block/CodeBlock.js +94 -0
- package/dist/components/primitives/code-block/CodeBlock.styles.js +108 -0
- package/dist/components/primitives/color-picker/ColorPicker.js +333 -0
- package/dist/components/primitives/color-picker/ColorPicker.styles.js +219 -0
- package/dist/components/primitives/color-picker/colorModel.js +116 -0
- package/dist/components/primitives/color-picker/presetColors.js +25 -0
- package/dist/components/primitives/color-picker/resolveColor.js +25 -0
- package/dist/components/primitives/context-menu/ContextMenu.js +13 -0
- package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.js +72 -0
- package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.styles.js +19 -0
- package/dist/components/primitives/context-menu/context-menu-content/fitMenu.js +21 -0
- package/dist/components/primitives/context-menu/context-menu-item/ContextMenuItem.js +47 -0
- package/dist/components/primitives/context-menu/context-menu-item/ContextMenuItem.styles.js +22 -0
- package/dist/components/primitives/context-menu/context-menu-root/ContextMenuRoot.js +10 -0
- package/dist/components/primitives/context-menu/context-menu-root/contextMenuRootContext.js +45 -0
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.js +6 -0
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.styles.js +9 -0
- package/dist/components/primitives/context-menu/menu/Menu.js +6 -0
- package/dist/components/primitives/context-menu/menu/Menu.styles.js +21 -0
- package/dist/components/primitives/context-menu/submenu-chevron/SubmenuChevron.js +10 -0
- package/dist/components/primitives/dialog/Dialog.js +75 -0
- package/dist/components/primitives/dialog/Dialog.styles.js +35 -0
- package/dist/components/primitives/edit-input/EditInput.js +68 -0
- package/dist/components/primitives/edit-input/EditInput.styles.js +40 -0
- package/dist/components/primitives/highlighted-text/HighlightedText.js +14 -0
- package/dist/components/primitives/highlighted-text/HighlightedText.styles.js +7 -0
- package/dist/components/primitives/icon/Icon.js +38 -0
- package/dist/components/primitives/icon/Icon.styles.js +12 -0
- package/dist/components/primitives/icon/icons.js +156 -0
- package/dist/components/primitives/kbd/Kbd.js +12 -0
- package/dist/components/primitives/kbd/Kbd.styles.js +44 -0
- package/dist/components/primitives/sash/Sash.js +46 -0
- package/dist/components/primitives/sash/Sash.styles.js +23 -0
- package/dist/components/primitives/select/Select.js +6 -0
- package/dist/components/primitives/select/Select.styles.js +59 -0
- package/dist/components/primitives/separator/Separator.js +14 -0
- package/dist/components/primitives/separator/Separator.styles.js +11 -0
- package/dist/components/primitives/slider/Slider.js +42 -0
- package/dist/components/primitives/slider/Slider.styles.js +58 -0
- package/dist/components/primitives/switch/Switch.d.ts +2 -0
- package/dist/components/primitives/switch/Switch.js +11 -0
- package/dist/components/primitives/switch/Switch.styles.js +117 -0
- package/dist/components/primitives/text-input/TextInput.js +25 -0
- package/dist/components/primitives/toast/Toast.js +24 -0
- package/dist/components/primitives/toast/Toast.styles.js +87 -0
- package/dist/components/primitives/tree/Tree.js +182 -0
- package/dist/components/primitives/tree/Tree.styles.js +71 -0
- package/dist/components/primitives/tree/treeModel.js +60 -0
- package/dist/components/quick-search/QuickSearch.d.ts +11 -2
- package/dist/components/quick-search/QuickSearch.js +290 -0
- package/dist/components/quick-search/QuickSearch.styles.js +168 -0
- package/dist/components/quick-search/actions.d.ts +2 -56
- package/dist/components/quick-search/actions.js +471 -0
- package/dist/components/quick-search/documentSearch.d.ts +60 -0
- package/dist/components/quick-search/documentSearch.js +132 -0
- package/dist/components/quick-search/hangul.js +183 -0
- package/dist/components/quick-search/paletteList.js +3 -0
- package/dist/components/quick-search/paletteQuery.js +73 -0
- package/dist/components/quick-search/scopedActions.d.ts +1 -1
- package/dist/components/quick-search/scopedActions.js +115 -0
- package/dist/components/sceneInteractionContext.d.ts +27 -0
- package/dist/components/sceneInteractionContext.js +15 -0
- package/dist/components/sceneSourceContext.js +7 -0
- package/dist/components/schema-sql/SchemaSQL.js +120 -0
- package/dist/components/schema-sql/SchemaSQL.styles.js +35 -0
- package/dist/components/schema-sql/schema-sql-context-menu/SchemaSQLContextMenu.js +45 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/bracketMenus.js +37 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/headerMenus.js +62 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/statementsMenus.js +41 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.js +172 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.js +271 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.js +117 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.styles.js +82 -0
- package/dist/components/schema-sql/schema-sql-options/dropWarning.js +13 -0
- package/dist/components/schema-sql/schemaSQLView.js +107 -0
- package/dist/components/settings/Settings.js +112 -0
- package/dist/components/settings/Settings.styles.d.ts +1 -0
- package/dist/components/settings/Settings.styles.js +158 -0
- package/dist/components/settings/columnTypeLabels.js +15 -0
- package/dist/components/settings/lockSettingRows.js +73 -0
- package/dist/components/settings/settings-lnb/SettingsLnb.js +24 -0
- package/dist/components/settings/settings-lnb/SettingsLnb.styles.js +37 -0
- package/dist/components/settings/settingsPage.js +15 -0
- package/dist/components/settings/shortcuts/Shortcuts.js +49 -0
- package/dist/components/settings/shortcuts/Shortcuts.styles.js +36 -0
- package/dist/components/table-view/Table.styles.js +76 -0
- package/dist/components/table-view/column/Column.styles.js +45 -0
- package/dist/components/table-view/column/column-data-type/ColumnDataType.js +93 -0
- package/dist/components/table-view/column/column-data-type/ColumnDataType.styles.js +51 -0
- package/dist/components/table-view/column/column-domain/ColumnDomain.js +77 -0
- package/dist/components/table-view/column/column-domain/domainOptions.js +20 -0
- package/dist/components/table-view/column/column-key/ColumnKey.js +24 -0
- package/dist/components/table-view/column/column-key/ColumnKey.styles.js +19 -0
- package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.js +96 -0
- package/dist/components/table-view/column/column-logical-name/ColumnLogicalName.styles.js +51 -0
- package/dist/components/table-view/column/column-not-null/ColumnNotNull.js +15 -0
- package/dist/components/table-view/column/column-not-null/ColumnNotNull.styles.js +22 -0
- package/dist/components/table-view/column/column-option/ColumnOption.js +18 -0
- package/dist/components/table-view/column/column-option/ColumnOption.styles.js +26 -0
- package/dist/components/table-view/column/columnViewText.js +23 -0
- package/dist/components/table-view/column/useColumnCell.js +117 -0
- package/dist/components/table-view/column/useHintList.js +83 -0
- package/dist/components/theme/Theme.d.ts +5 -0
- package/dist/components/theme/Theme.js +20 -0
- package/dist/components/theme-builder/ThemeBuilder.js +90 -0
- package/dist/components/theme-builder/ThemeBuilder.styles.js +100 -0
- package/dist/components/themeContext.js +7 -0
- package/dist/components/toast-container/ToastContainer.js +46 -0
- package/dist/components/toast-container/ToastContainer.styles.js +48 -0
- package/dist/components/toast-container/openStatusToast.js +28 -0
- package/dist/components/toast-container/openToastWhileRunning.js +20 -0
- package/dist/components/toolbar/Toolbar.js +120 -0
- package/dist/components/toolbar/Toolbar.styles.d.ts +1 -0
- package/dist/components/toolbar/Toolbar.styles.js +68 -0
- package/dist/components/visualization/Visualization.js +39 -0
- package/dist/components/visualization/Visualization.styles.js +16 -0
- package/dist/components/visualization/VisualizationFlow.js +44 -0
- package/dist/components/visualization/VisualizationGraph.js +109 -0
- package/dist/components/visualization/VisualizationScene.js +56 -0
- package/dist/components/visualization/captureDrag.js +15 -0
- package/dist/components/visualization/createVisualization.js +77 -0
- package/dist/components/visualization/flowLayout.js +203 -0
- package/dist/components/visualization/graph-node/GraphNode.js +80 -0
- package/dist/components/visualization/graphPan.js +26 -0
- package/dist/components/visualization/graphViewHandle.js +30 -0
- package/dist/components/visualization/particles/ParticleLayer.js +33 -0
- package/dist/components/visualization/particles/particleEdges.js +36 -0
- package/dist/components/visualization/particles/particleLoop.js +118 -0
- package/dist/components/visualization/particles/particlePath.js +146 -0
- package/dist/components/visualization/table/Table.js +50 -0
- package/dist/components/visualization/table/column/Column.js +77 -0
- package/dist/components/visualization/useViewGestures.js +82 -0
- package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.js +184 -0
- package/dist/components/visualization/visualization-toolbar/VisualizationToolbar.styles.js +24 -0
- package/dist/components/visualization/visualizationView.js +152 -0
- package/dist/components/visualization/zoomVisualization.js +31 -0
- package/dist/constants/language.js +28 -0
- package/dist/constants/layout.js +14 -0
- package/dist/constants/open.js +14 -0
- package/dist/constants/schema.js +54 -0
- package/dist/constants/sql/dataType/Databricks.js +185 -0
- package/dist/constants/sql/dataType/MSSQL.js +197 -0
- package/dist/constants/sql/dataType/MariaDB.js +349 -0
- package/dist/constants/sql/dataType/MySQL.js +285 -0
- package/dist/constants/sql/dataType/Oracle.js +209 -0
- package/dist/constants/sql/dataType/PostgreSQL.js +433 -0
- package/dist/constants/sql/dataType/SQLite.js +129 -0
- package/dist/constants/sql/dataType/Snowflake.js +221 -0
- package/dist/constants/sql/dataType/index.js +22 -0
- package/dist/constants/sql/database.js +25 -0
- package/dist/constants/tablePlacement.js +11 -0
- package/dist/constants/zoom.js +5 -0
- package/dist/engine/actions.d.ts +25 -3
- package/dist/engine/actions.js +280 -0
- package/dist/engine/clock.js +25 -0
- package/dist/engine/context.d.ts +3 -3
- package/dist/engine/context.js +10 -0
- package/dist/engine/documentJson.d.ts +16 -0
- package/dist/engine/documentJson.js +20 -0
- package/dist/engine/history.actions.js +224 -0
- package/dist/engine/history.js +72 -0
- package/dist/engine/index.js +2 -56
- package/dist/engine/modules/dictionary/actions.js +42 -0
- package/dist/engine/modules/dictionary/atom.actions.js +106 -0
- package/dist/engine/modules/dictionary/checks.js +331 -0
- package/dist/engine/modules/dictionary/derive.js +101 -0
- package/dist/engine/modules/dictionary/derivedNames.js +88 -0
- package/dist/engine/modules/dictionary/dictionaryIndex.js +112 -0
- package/dist/engine/modules/dictionary/domainLinks.js +26 -0
- package/dist/engine/modules/dictionary/domainTypes.js +72 -0
- package/dist/engine/modules/dictionary/entryWrites.js +197 -0
- package/dist/engine/modules/dictionary/generator.actions.js +217 -0
- package/dist/engine/modules/dictionary/history.js +54 -0
- package/dist/engine/modules/dictionary/membership.js +42 -0
- package/dist/engine/modules/dictionary/orderKeys.js +28 -0
- package/dist/engine/modules/dictionary/termIndex.js +42 -0
- package/dist/engine/modules/editor/actions.d.ts +5 -1
- package/dist/engine/modules/editor/actions.js +58 -0
- package/dist/engine/modules/editor/atom.actions.d.ts +19 -0
- package/dist/engine/modules/editor/atom.actions.js +584 -0
- package/dist/engine/modules/editor/generator.actions.js +761 -0
- package/dist/engine/modules/editor/history.js +37 -0
- package/dist/engine/modules/editor/state.d.ts +21 -0
- package/dist/engine/modules/editor/state.js +97 -0
- package/dist/engine/modules/editor/utils/color.js +37 -0
- package/dist/engine/modules/editor/utils/duplicate.js +234 -0
- package/dist/engine/modules/editor/utils/findRelationshipColumn.js +34 -0
- package/dist/engine/modules/editor/utils/focus.d.ts +5 -0
- package/dist/engine/modules/editor/utils/focus.js +276 -0
- package/dist/engine/modules/editor/utils/nameView.js +113 -0
- package/dist/engine/modules/editor/utils/releaseHidden.js +25 -0
- package/dist/engine/modules/editor/utils/selectRangeColumn.js +18 -0
- package/dist/engine/modules/editor/utils/selection.js +16 -0
- package/dist/engine/modules/editor/view.actions.js +134 -0
- package/dist/engine/modules/editor/view.generator.actions.js +25 -0
- package/dist/engine/modules/editor/view.js +29 -0
- package/dist/engine/modules/index/actions.js +9 -0
- package/dist/engine/modules/index/atom.actions.js +73 -0
- package/dist/engine/modules/index/generator.actions.js +25 -0
- package/dist/engine/modules/index/history.js +40 -0
- package/dist/engine/modules/index-column/actions.js +9 -0
- package/dist/engine/modules/index-column/atom.actions.js +93 -0
- package/dist/engine/modules/index-column/generator.actions.js +63 -0
- package/dist/engine/modules/index-column/history.js +55 -0
- package/dist/engine/modules/memo/actions.js +13 -0
- package/dist/engine/modules/memo/atom.actions.js +106 -0
- package/dist/engine/modules/memo/generator.actions.js +50 -0
- package/dist/engine/modules/memo/history.js +109 -0
- package/dist/engine/modules/relationship/actions.js +11 -0
- package/dist/engine/modules/relationship/atom.actions.js +103 -0
- package/dist/engine/modules/relationship/endFlags.js +32 -0
- package/dist/engine/modules/relationship/fkColumns.js +85 -0
- package/dist/engine/modules/relationship/generator.actions.js +52 -0
- package/dist/engine/modules/relationship/history.js +72 -0
- package/dist/engine/modules/relationship/hooks.js +250 -0
- package/dist/engine/modules/relationship/referenceType.js +29 -0
- package/dist/engine/modules/settings/actions.js +24 -0
- package/dist/engine/modules/settings/atom.actions.d.ts +1 -1
- package/dist/engine/modules/settings/atom.actions.js +324 -0
- package/dist/engine/modules/settings/generator.actions.d.ts +6 -0
- package/dist/engine/modules/settings/generator.actions.js +132 -0
- package/dist/engine/modules/settings/history.js +65 -0
- package/dist/engine/modules/settings/screenBaseline.d.ts +37 -0
- package/dist/engine/modules/settings/screenBaseline.js +82 -0
- package/dist/engine/modules/settings/scrollRange.js +18 -0
- package/dist/engine/modules/table/actions.js +17 -0
- package/dist/engine/modules/table/atom.actions.js +231 -0
- package/dist/engine/modules/table/generator.actions.js +351 -0
- package/dist/engine/modules/table/history.js +134 -0
- package/dist/engine/modules/table/hooks.js +12 -0
- package/dist/engine/modules/table-column/actions.js +19 -0
- package/dist/engine/modules/table-column/atom.actions.js +223 -0
- package/dist/engine/modules/table-column/generator.actions.js +165 -0
- package/dist/engine/modules/table-column/history.js +146 -0
- package/dist/engine/modules/table-column/hooks.js +33 -0
- package/dist/engine/modules/table-column/keys.js +30 -0
- package/dist/engine/modules/table-column/utils/dataType.js +71 -0
- package/dist/engine/modules/table-group/actions.js +13 -0
- package/dist/engine/modules/table-group/atom.actions.js +108 -0
- package/dist/engine/modules/table-group/generator.actions.js +158 -0
- package/dist/engine/modules/table-group/history.js +106 -0
- package/dist/engine/peer-store.js +318 -0
- package/dist/engine/presence.js +45 -0
- package/dist/engine/replication-store.js +95 -0
- package/dist/engine/rx-operators/actionsFilter.js +14 -0
- package/dist/engine/rx-operators/bufferCircuitBreaker.js +35 -0
- package/dist/engine/rx-operators/createSharedStreamActionsCompressor.js +24 -0
- package/dist/engine/rx-operators/flushOnNotifier.js +6 -0
- package/dist/engine/rx-operators/groupByStreamActions.js +32 -0
- package/dist/engine/rx-operators/ignoreTagFilter.js +17 -0
- package/dist/engine/rx-operators/lockIgnoreFilter.js +20 -0
- package/dist/engine/rx-operators/notEmptyActions.js +5 -0
- package/dist/engine/rx-operators/readonlyIgnoreFilter.d.ts +6 -1
- package/dist/engine/rx-operators/readonlyIgnoreFilter.js +23 -0
- package/dist/engine/rx-operators/readonlyScreenTag.d.ts +16 -0
- package/dist/engine/rx-operators/readonlyScreenTag.js +49 -0
- package/dist/engine/rx-operators/viewActionRedirect.js +32 -0
- package/dist/engine/rx-operators/viewIgnoreFilter.js +22 -0
- package/dist/engine/rx-store.d.ts +12 -1
- package/dist/engine/rx-store.js +158 -0
- package/dist/engine/settle.js +15 -0
- package/dist/engine/shared-store.js +114 -0
- package/dist/engine/store-hooks.js +36 -0
- package/dist/engine/store.js +39 -0
- package/dist/engine/stream-flush.js +9 -0
- package/dist/engine/tag.d.ts +5 -0
- package/dist/engine/tag.js +28 -0
- package/dist/engine/to-width.js +6 -0
- package/dist/erd-editor-schema/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.js +12 -0
- package/dist/erd-editor-schema/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/erd-editor-schema/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/erd-editor-schema/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/typeof.js +11 -0
- package/dist/erd-editor-schema/dist/convert/v2ToV3.js +142 -0
- package/dist/erd-editor-schema/dist/dictionaryRows.js +86 -0
- package/dist/erd-editor-schema/dist/helper.js +28 -0
- package/dist/erd-editor-schema/dist/normalizeSettings.js +24 -0
- package/dist/erd-editor-schema/dist/orderKey.js +139 -0
- package/dist/erd-editor-schema/dist/parser.js +73 -0
- package/dist/erd-editor-schema/dist/query/index.js +98 -0
- package/dist/erd-editor-schema/dist/query/lww.js +38 -0
- package/dist/erd-editor-schema/dist/storageForm.js +209 -0
- package/dist/erd-editor-schema/dist/utils/bit.js +6 -0
- package/dist/erd-editor-schema/dist/v2/migrations/relationshipType.migration.js +14 -0
- package/dist/erd-editor-schema/dist/v2/parser/canvas.js +91 -0
- package/dist/erd-editor-schema/dist/v2/parser/index.js +16 -0
- package/dist/erd-editor-schema/dist/v2/parser/memo.js +40 -0
- package/dist/erd-editor-schema/dist/v2/parser/relationship.js +62 -0
- package/dist/erd-editor-schema/dist/v2/parser/table.js +125 -0
- package/dist/erd-editor-schema/dist/v2/schema/canvasEntity.js +65 -0
- package/dist/erd-editor-schema/dist/v2/schema/relationshipEntity.js +25 -0
- package/dist/erd-editor-schema/dist/v2/schema/tableEntity.js +8 -0
- package/dist/erd-editor-schema/dist/v3/parser/doc.js +29 -0
- package/dist/erd-editor-schema/dist/v3/parser/domain.entity.js +28 -0
- package/dist/erd-editor-schema/dist/v3/parser/index.entity.js +33 -0
- package/dist/erd-editor-schema/dist/v3/parser/index.js +107 -0
- package/dist/erd-editor-schema/dist/v3/parser/indexColumn.entity.js +27 -0
- package/dist/erd-editor-schema/dist/v3/parser/memo.entity.js +38 -0
- package/dist/erd-editor-schema/dist/v3/parser/migrateScroll.js +11 -0
- package/dist/erd-editor-schema/dist/v3/parser/relationship.entity.js +60 -0
- package/dist/erd-editor-schema/dist/v3/parser/settings.js +140 -0
- package/dist/erd-editor-schema/dist/v3/parser/table.entity.js +55 -0
- package/dist/erd-editor-schema/dist/v3/parser/tableColumn.entity.js +54 -0
- package/dist/erd-editor-schema/dist/v3/parser/tableGroup.entity.js +37 -0
- package/dist/erd-editor-schema/dist/v3/parser/term.entity.js +30 -0
- package/dist/erd-editor-schema/dist/v3/parser/word.entity.js +32 -0
- package/dist/erd-editor-schema/dist/v3/schema/index.js +46 -0
- package/dist/erd-editor-schema/dist/v3/schema/indexColumn.entity.js +8 -0
- package/dist/erd-editor-schema/dist/v3/schema/relationship.entity.js +31 -0
- package/dist/erd-editor-schema/dist/v3/schema/settings.js +141 -0
- package/dist/erd-editor-schema/dist/v3/schema/tableColumn.entity.js +14 -0
- package/dist/erd-editor.d.ts +2 -0
- package/dist/erd-editor.js +4 -0
- package/dist/erd-editor.umd.js +789 -750
- package/dist/erd-viewer.d.ts +2 -0
- package/dist/erd-viewer.js +4 -0
- package/dist/erd-viewer.umd.js +696 -0
- package/dist/grid/dist/Grid.js +511 -0
- package/dist/grid/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.js +12 -0
- package/dist/grid/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/grid/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/grid/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/typeof.js +11 -0
- package/dist/grid/dist/font.js +58 -0
- package/dist/grid/dist/input/editing.js +460 -0
- package/dist/grid/dist/input/pointer.js +426 -0
- package/dist/grid/dist/model/columns.js +41 -0
- package/dist/grid/dist/model/editing.js +93 -0
- package/dist/grid/dist/model/keys.js +89 -0
- package/dist/grid/dist/model/selection.js +237 -0
- package/dist/grid/dist/model/text.js +122 -0
- package/dist/grid/dist/model/tsv.js +108 -0
- package/dist/grid/dist/model/viewport.js +75 -0
- package/dist/grid/dist/scene/GridScene.js +64 -0
- package/dist/grid/dist/scene/draw/cells.js +61 -0
- package/dist/grid/dist/scene/draw/context.js +17 -0
- package/dist/grid/dist/scene/draw/headers.js +48 -0
- package/dist/grid/dist/scene/draw/scrollbar.js +70 -0
- package/dist/grid/dist/scene/layout.js +62 -0
- package/dist/grid/dist/scene/overlay.js +144 -0
- package/dist/grid/dist/scene/paint.js +123 -0
- package/dist/grid/dist/scene/state.js +269 -0
- package/dist/grid/dist/theme.js +37 -0
- package/dist/hooks/useDarkMode.d.ts +2 -0
- package/dist/hooks/useDarkMode.js +35 -0
- package/dist/hooks/useFlipAnimation.js +10 -0
- package/dist/hooks/useKeyBindingMap.js +55 -0
- package/dist/hooks/useNavigatorLanguages.js +22 -0
- package/dist/hooks/usePinchZoom.d.ts +6 -1
- package/dist/hooks/usePinchZoom.js +60 -0
- package/dist/hooks/useUnmounted.js +16 -0
- package/dist/hooks/useViewShortcut.d.ts +14 -0
- package/dist/hooks/useViewShortcut.js +34 -0
- package/dist/i18n/loadMessages.d.ts +12 -0
- package/dist/i18n/loadMessages.js +40 -0
- package/dist/i18n/locales.js +145 -0
- package/dist/i18n/menuLabel.js +4 -0
- package/dist/i18n/messages/ar-SA.d.ts +2 -3
- package/dist/i18n/messages/ar-SA.js +550 -0
- package/dist/i18n/messages/de-DE.d.ts +2 -3
- package/dist/i18n/messages/de-DE.js +498 -0
- package/dist/i18n/messages/en/code.js +13 -0
- package/dist/i18n/messages/en/colorPicker.js +36 -0
- package/dist/i18n/messages/en/common.js +76 -0
- package/dist/i18n/messages/en/contextMenu.js +31 -0
- package/dist/i18n/messages/en/dictionary.js +76 -0
- package/dist/i18n/messages/en/explorer.js +38 -0
- package/dist/i18n/messages/en/exportImage.js +23 -0
- package/dist/i18n/messages/en/feedback.js +9 -0
- package/dist/i18n/messages/en/findReplace.js +43 -0
- package/dist/i18n/messages/en/floatingToolbar.js +13 -0
- package/dist/i18n/messages/en/index.d.ts +2 -3
- package/dist/i18n/messages/en/index.js +47 -0
- package/dist/i18n/messages/en/mapColumns.js +36 -0
- package/dist/i18n/messages/en/palette.js +36 -0
- package/dist/i18n/messages/en/schemaSql.js +27 -0
- package/dist/i18n/messages/en/settings.d.ts +0 -3
- package/dist/i18n/messages/en/settings.js +18 -0
- package/dist/i18n/messages/en/shortcuts.js +35 -0
- package/dist/i18n/messages/en/tableProperties.js +35 -0
- package/dist/i18n/messages/en/themeBuilder.js +8 -0
- package/dist/i18n/messages/en/toolbar.js +9 -0
- package/dist/i18n/messages/en/viewer.d.ts +6 -0
- package/dist/i18n/messages/en/viewer.js +7 -0
- package/dist/i18n/messages/en/visualization.js +15 -0
- package/dist/i18n/messages/en/welcome.js +14 -0
- package/dist/i18n/messages/es-ES.d.ts +2 -3
- package/dist/i18n/messages/es-ES.js +511 -0
- package/dist/i18n/messages/eu-ES.d.ts +2 -3
- package/dist/i18n/messages/eu-ES.js +498 -0
- package/dist/i18n/messages/fa-IR.d.ts +2 -3
- package/dist/i18n/messages/fa-IR.js +498 -0
- package/dist/i18n/messages/fr-FR.d.ts +2 -3
- package/dist/i18n/messages/fr-FR.js +511 -0
- package/dist/i18n/messages/he-IL.d.ts +2 -3
- package/dist/i18n/messages/he-IL.js +511 -0
- package/dist/i18n/messages/id-ID.d.ts +2 -3
- package/dist/i18n/messages/id-ID.js +459 -0
- package/dist/i18n/messages/index.d.ts +3 -3
- package/dist/i18n/messages/index.js +58 -0
- package/dist/i18n/messages/it-IT.d.ts +2 -3
- package/dist/i18n/messages/it-IT.js +511 -0
- package/dist/i18n/messages/ja-JP.d.ts +2 -3
- package/dist/i18n/messages/ja-JP.js +459 -0
- package/dist/i18n/messages/ko-KR.d.ts +2 -3
- package/dist/i18n/messages/ko-KR.js +459 -0
- package/dist/i18n/messages/nl-NL.d.ts +2 -3
- package/dist/i18n/messages/nl-NL.js +498 -0
- package/dist/i18n/messages/pl-PL.d.ts +2 -3
- package/dist/i18n/messages/pl-PL.js +524 -0
- package/dist/i18n/messages/pt-BR.d.ts +2 -3
- package/dist/i18n/messages/pt-BR.js +511 -0
- package/dist/i18n/messages/pt-PT.d.ts +2 -3
- package/dist/i18n/messages/pt-PT.js +511 -0
- package/dist/i18n/messages/ro-RO.d.ts +2 -3
- package/dist/i18n/messages/ro-RO.js +511 -0
- package/dist/i18n/messages/ru-RU.d.ts +2 -3
- package/dist/i18n/messages/ru-RU.js +524 -0
- package/dist/i18n/messages/sk-SK.d.ts +2 -3
- package/dist/i18n/messages/sk-SK.js +524 -0
- package/dist/i18n/messages/sl-SI.d.ts +2 -3
- package/dist/i18n/messages/sl-SI.js +524 -0
- package/dist/i18n/messages/sv-SE.d.ts +2 -3
- package/dist/i18n/messages/sv-SE.js +498 -0
- package/dist/i18n/messages/tr-TR.d.ts +2 -3
- package/dist/i18n/messages/tr-TR.js +498 -0
- package/dist/i18n/messages/uk-UA.d.ts +2 -3
- package/dist/i18n/messages/uk-UA.js +524 -0
- package/dist/i18n/messages/zh-CN.d.ts +2 -3
- package/dist/i18n/messages/zh-CN.js +459 -0
- package/dist/i18n/messages/zh-TW.d.ts +2 -3
- package/dist/i18n/messages/zh-TW.js +459 -0
- package/dist/i18n/resolveLocale.js +28 -0
- package/dist/i18n/source.js +6 -0
- package/dist/i18n/translate.js +34 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -48293
- package/dist/konva/scene/columnDropTarget.js +43 -0
- package/dist/konva/scene/contentBounds.js +48 -0
- package/dist/konva/scene/fitZoom.d.ts +7 -0
- package/dist/konva/scene/fitZoom.js +31 -0
- package/dist/konva/scene/konvaFlip.js +125 -0
- package/dist/konva/scene/metrics.js +59 -0
- package/dist/konva/scene/renderScene.js +37 -0
- package/dist/konva/scene/stacking.js +13 -0
- package/dist/konva/scene/viewFreeze.js +29 -0
- package/dist/konva/scene/viewLayout.js +171 -0
- package/dist/konva/scene/viewport.js +86 -0
- package/dist/konva/testHandle.d.ts +9 -3
- package/dist/konva/testHandle.js +5 -0
- package/dist/konva/theme.js +45 -0
- package/dist/peer/index.js +35 -235
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/assertClassBrand.js +7 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/checkPrivateRedeclaration.js +6 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldGet2.js +7 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldInitSpec.js +7 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/classPrivateFieldSet2.js +7 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/defineProperty.js +12 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPrimitive.js +14 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/toPropertyKey.js +9 -0
- package/dist/r-html/dist/_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/typeof.js +11 -0
- package/dist/r-html/dist/constants.js +36 -0
- package/dist/r-html/dist/context/createContext.js +49 -0
- package/dist/r-html/dist/context/useContext.js +28 -0
- package/dist/r-html/dist/context/useProvider.js +41 -0
- package/dist/r-html/dist/css/compile.js +27 -0
- package/dist/r-html/dist/css/diagnostics.js +195 -0
- package/dist/r-html/dist/css/element.js +34 -0
- package/dist/r-html/dist/css/emit.js +26 -0
- package/dist/r-html/dist/css/flatten.js +76 -0
- package/dist/r-html/dist/css/hash.js +15 -0
- package/dist/r-html/dist/css/index.js +31 -0
- package/dist/r-html/dist/css/selector.js +11 -0
- package/dist/r-html/dist/helpers/array.js +9 -0
- package/dist/r-html/dist/helpers/fn.js +14 -0
- package/dist/r-html/dist/helpers/is-type.js +16 -0
- package/dist/r-html/dist/helpers/subject.js +21 -0
- package/dist/r-html/dist/observable/index.js +78 -0
- package/dist/r-html/dist/observable/scheduler.js +84 -0
- package/dist/r-html/dist/parser/html/helper.js +58 -0
- package/dist/r-html/dist/parser/html/index.js +101 -0
- package/dist/r-html/dist/parser/html/tokenizer.js +161 -0
- package/dist/r-html/dist/parser/vNode.js +32 -0
- package/dist/r-html/dist/render/directives/attribute/ref.js +18 -0
- package/dist/r-html/dist/render/directives/attributeDirective.js +7 -0
- package/dist/r-html/dist/render/directives/index.js +13 -0
- package/dist/r-html/dist/render/directives/node/cache.js +56 -0
- package/dist/r-html/dist/render/directives/node/innerHTML.js +20 -0
- package/dist/r-html/dist/render/directives/node/repeat.js +124 -0
- package/dist/r-html/dist/render/directives/nodeDirective.js +15 -0
- package/dist/r-html/dist/render/domAdapter.js +74 -0
- package/dist/r-html/dist/render/helper.js +91 -0
- package/dist/r-html/dist/render/hmr.js +64 -0
- package/dist/r-html/dist/render/host.js +16 -0
- package/dist/r-html/dist/render/hostTemplate.js +35 -0
- package/dist/r-html/dist/render/index.js +9 -0
- package/dist/r-html/dist/render/part/attribute/attribute.js +102 -0
- package/dist/r-html/dist/render/part/attribute/boolean.js +33 -0
- package/dist/r-html/dist/render/part/attribute/directive.js +48 -0
- package/dist/r-html/dist/render/part/attribute/event.js +49 -0
- package/dist/r-html/dist/render/part/attribute/index.js +12 -0
- package/dist/r-html/dist/render/part/attribute/property.js +30 -0
- package/dist/r-html/dist/render/part/attribute/spread.js +28 -0
- package/dist/r-html/dist/render/part/container.js +64 -0
- package/dist/r-html/dist/render/part/index.js +32 -0
- package/dist/r-html/dist/render/part/node/comment.js +34 -0
- package/dist/r-html/dist/render/part/node/component/hooks.js +28 -0
- package/dist/r-html/dist/render/part/node/component/index.js +37 -0
- package/dist/r-html/dist/render/part/node/component/observableComponent.js +111 -0
- package/dist/r-html/dist/render/part/node/component/prop.js +30 -0
- package/dist/r-html/dist/render/part/node/component/webComponent/helper.js +19 -0
- package/dist/r-html/dist/render/part/node/component/webComponent/index.js +79 -0
- package/dist/r-html/dist/render/part/node/text/array.js +87 -0
- package/dist/r-html/dist/render/part/node/text/arrayDiff.js +90 -0
- package/dist/r-html/dist/render/part/node/text/directive.js +51 -0
- package/dist/r-html/dist/render/part/node/text/function.js +7 -0
- package/dist/r-html/dist/render/part/node/text/helper.js +55 -0
- package/dist/r-html/dist/render/part/node/text/index.js +54 -0
- package/dist/r-html/dist/render/part/node/text/node.js +25 -0
- package/dist/r-html/dist/render/part/node/text/object.js +60 -0
- package/dist/r-html/dist/render/part/node/text/primitive.js +26 -0
- package/dist/r-html/dist/render/part/node/text/templateLiterals.js +38 -0
- package/dist/r-html/dist/render/value.js +8 -0
- package/dist/r-html/dist/store/index.js +72 -0
- package/dist/r-html/dist/template/css.js +70 -0
- package/dist/r-html/dist/template/cssDiagnostics.js +23 -0
- package/dist/r-html/dist/template/cssSource.js +62 -0
- package/dist/r-html/dist/template/helper.js +37 -0
- package/dist/r-html/dist/template/html.js +29 -0
- package/dist/r-html/dist/template/index.js +13 -0
- package/dist/r-html/dist/template/tNode.js +107 -0
- package/dist/r-html/dist/template/vCSSStyleSheet.js +162 -0
- package/dist/r-html-konva/dist/batchDraw.js +90 -0
- package/dist/r-html-konva/dist/host.js +336 -0
- package/dist/schema-sql-parser/dist/parser/dataType/Databricks.js +50 -0
- package/dist/schema-sql-parser/dist/parser/dataType/MSSQL.js +53 -0
- package/dist/schema-sql-parser/dist/parser/dataType/MariaDB.js +91 -0
- package/dist/schema-sql-parser/dist/parser/dataType/MySQL.js +75 -0
- package/dist/schema-sql-parser/dist/parser/dataType/Oracle.js +56 -0
- package/dist/schema-sql-parser/dist/parser/dataType/PostgreSQL.js +112 -0
- package/dist/schema-sql-parser/dist/parser/dataType/SQLite.js +36 -0
- package/dist/schema-sql-parser/dist/parser/dataType/Snowflake.js +59 -0
- package/dist/schema-sql-parser/dist/parser/helper.js +701 -0
- package/dist/schema-sql-parser/dist/parser/index.js +70 -0
- package/dist/schema-sql-parser/dist/parser/statement/add.extended.property.js +73 -0
- package/dist/schema-sql-parser/dist/parser/statement/alter.table.add.default.js +75 -0
- package/dist/schema-sql-parser/dist/parser/statement/alter.table.add.foreignKey.js +69 -0
- package/dist/schema-sql-parser/dist/parser/statement/alter.table.add.primaryKey.js +86 -0
- package/dist/schema-sql-parser/dist/parser/statement/alter.table.add.unique.js +128 -0
- package/dist/schema-sql-parser/dist/parser/statement/alter.table.alter.column.js +90 -0
- package/dist/schema-sql-parser/dist/parser/statement/comment.on.column.js +56 -0
- package/dist/schema-sql-parser/dist/parser/statement/comment.on.table.js +52 -0
- package/dist/schema-sql-parser/dist/parser/statement/create.index.js +61 -0
- package/dist/schema-sql-parser/dist/parser/statement/create.table.js +549 -0
- package/dist/schema-sql-parser/dist/parser/statement/default.expression.js +206 -0
- package/dist/schema-sql-parser/dist/parser/statement/index.columns.js +49 -0
- package/dist/schema-sql-parser/dist/parser/statement/index.js +25 -0
- package/dist/schema-sql-parser/dist/parser/tokenizer.js +241 -0
- package/dist/services/elk-layout/elkGraph.js +184 -0
- package/dist/services/elk-layout/elkLayoutOptions.js +52 -0
- package/dist/services/elk-layout/index.js +45 -0
- package/dist/services/export-png/ExportScene.js +30 -0
- package/dist/services/export-png/documentScene.js +45 -0
- package/dist/services/export-png/exportBox.js +63 -0
- package/dist/services/export-png/exportTheme.js +16 -0
- package/dist/services/export-png/index.js +139 -0
- package/dist/services/export-png/pixelRatio.js +12 -0
- package/dist/services/export-png/renderPng.js +52 -0
- package/dist/services/export-png/renderSvg.js +24 -0
- package/dist/services/export-png/sceneSvg.js +315 -0
- package/dist/services/export-png/textWidth.js +12 -0
- package/dist/services/export-png/toImage.d.ts +27 -0
- package/dist/services/export-png/toImage.js +49 -0
- package/dist/services/shiki/index.js +24 -0
- package/dist/styles/elevation.styles.js +9 -0
- package/dist/styles/fonts.styles.js +12 -0
- package/dist/styles/reset.styles.js +104 -0
- package/dist/styles/scrollbar.styles.js +27 -0
- package/dist/styles/typography.styles.js +63 -0
- package/dist/themes/radix-ui-theme.config.js +133 -0
- package/dist/themes/radix-ui-theme.js +231 -0
- package/dist/themes/tokens.js +107 -0
- package/dist/utils/arrayHas.js +7 -0
- package/dist/utils/attribute.js +11 -0
- package/dist/utils/bit.js +6 -0
- package/dist/utils/calcMemo.js +9 -0
- package/dist/utils/calcTable.js +220 -0
- package/dist/utils/clickGesture.js +33 -0
- package/dist/utils/clipboard.js +45 -0
- package/dist/utils/collection/domain.entity.js +13 -0
- package/dist/utils/collection/index.entity.js +13 -0
- package/dist/utils/collection/indexColumn.entity.js +12 -0
- package/dist/utils/collection/memo.entity.js +18 -0
- package/dist/utils/collection/relationship.entity.js +28 -0
- package/dist/utils/collection/sequence.js +21 -0
- package/dist/utils/collection/table.entity.js +24 -0
- package/dist/utils/collection/tableColumn.entity.js +25 -0
- package/dist/utils/collection/tableGroup.entity.js +17 -0
- package/dist/utils/collection/term.entity.js +14 -0
- package/dist/utils/collection/word.entity.js +15 -0
- package/dist/utils/contrastText.js +26 -0
- package/dist/utils/deepMerge.js +24 -0
- package/dist/utils/device-detect/index.js +6 -0
- package/dist/utils/dictionary-csv/csv.js +61 -0
- package/dist/utils/dictionary-csv/decode.js +10 -0
- package/dist/utils/dictionary-csv/dictionaryCsv.js +150 -0
- package/dist/utils/diff/compareEntities.js +200 -0
- package/dist/{components/erd/diff-viewer → utils/diff}/diff.d.ts +1 -1
- package/dist/utils/diff/diff.js +29 -0
- package/dist/utils/diff/diffDocuments.js +224 -0
- package/dist/utils/diff/pairEntities.js +71 -0
- package/dist/utils/diff/types.d.ts +1 -1
- package/dist/utils/diff/types.js +38 -0
- package/dist/utils/domEvent.js +55 -0
- package/dist/utils/dragSelect.js +9 -0
- package/dist/utils/draw-relationship/bezier.js +44 -0
- package/dist/utils/draw-relationship/calc.js +91 -0
- package/dist/utils/draw-relationship/corner.js +60 -0
- package/dist/utils/draw-relationship/draw.js +194 -0
- package/dist/utils/draw-relationship/incremental.d.ts +4 -4
- package/dist/utils/draw-relationship/incremental.js +135 -0
- package/dist/utils/draw-relationship/index.d.ts +16 -1
- package/dist/utils/draw-relationship/index.js +198 -0
- package/dist/utils/draw-relationship/loop.js +25 -0
- package/dist/utils/draw-relationship/nudge.js +402 -0
- package/dist/utils/draw-relationship/pathFinding.js +277 -0
- package/dist/utils/draw-relationship/route.d.ts +12 -0
- package/dist/utils/draw-relationship/route.js +460 -0
- package/dist/utils/draw-relationship/search.d.ts +15 -0
- package/dist/utils/draw-relationship/search.js +294 -0
- package/dist/utils/draw-relationship/sort.js +370 -0
- package/dist/utils/draw-relationship/stub.js +46 -0
- package/dist/utils/emitter.d.ts +15 -0
- package/dist/utils/emitter.js +76 -0
- package/dist/utils/file/exportFile.js +52 -0
- package/dist/utils/file/importFile.js +201 -0
- package/dist/utils/file/importSchema.js +128 -0
- package/dist/utils/find-replace/findMatches.js +212 -0
- package/dist/utils/find-replace/index.d.ts +0 -1
- package/dist/utils/find-replace/matcher.js +128 -0
- package/dist/utils/find-replace/present.js +48 -0
- package/dist/utils/find-replace/preserveCase.js +25 -0
- package/dist/utils/find-replace/replaceActions.js +70 -0
- package/dist/utils/flipAnimation.js +52 -0
- package/dist/utils/focus.js +40 -0
- package/dist/utils/formatCount.js +12 -0
- package/dist/utils/generator-code/aml.js +199 -0
- package/dist/utils/generator-code/columnTypes.js +369 -0
- package/dist/utils/generator-code/csharp.js +230 -0
- package/dist/utils/generator-code/dbml.js +248 -0
- package/dist/utils/generator-code/doctrine.js +964 -0
- package/dist/utils/generator-code/doctrineReservedWords.js +57 -0
- package/dist/utils/generator-code/drizzle.js +1853 -0
- package/dist/utils/generator-code/go.js +160 -0
- package/dist/utils/generator-code/graphql.js +347 -0
- package/dist/utils/generator-code/heck.js +47 -0
- package/dist/utils/generator-code/index.js +179 -0
- package/dist/utils/generator-code/java.js +179 -0
- package/dist/utils/generator-code/jpa.js +218 -0
- package/dist/utils/generator-code/jsonSchema.js +402 -0
- package/dist/utils/generator-code/jsonShape.js +169 -0
- package/dist/utils/generator-code/kotlin.js +102 -0
- package/dist/utils/generator-code/mermaid.js +130 -0
- package/dist/utils/generator-code/php.js +211 -0
- package/dist/utils/generator-code/rust.js +143 -0
- package/dist/utils/generator-code/rustTypes.js +132 -0
- package/dist/utils/generator-code/scala.js +124 -0
- package/dist/utils/generator-code/seaorm.js +581 -0
- package/dist/utils/generator-code/sequelize.js +1225 -0
- package/dist/utils/generator-code/sqlalchemy.js +1250 -0
- package/dist/utils/generator-code/swift.js +222 -0
- package/dist/utils/generator-code/typeorm.js +998 -0
- package/dist/utils/generator-code/typescript.js +67 -0
- package/dist/utils/generator-code/utils.js +87 -0
- package/dist/utils/generator-code/zod.js +106 -0
- package/dist/utils/globalEventObservable.js +67 -0
- package/dist/utils/highlightWords.js +48 -0
- package/dist/utils/icon.js +35 -0
- package/dist/utils/index.js +26 -0
- package/dist/utils/internalEvents.js +26 -0
- package/dist/utils/keyboard-shortcut/bindKeys.js +30 -0
- package/dist/utils/keyboard-shortcut/index.d.ts +7 -1
- package/dist/utils/keyboard-shortcut/index.js +243 -0
- package/dist/utils/keyboard-shortcut/utils.js +32 -0
- package/dist/utils/loadValue.js +11 -0
- package/dist/utils/map-columns/alignTypes.js +48 -0
- package/dist/utils/map-columns/buildRows.js +337 -0
- package/dist/utils/map-columns/candidateKeys.js +24 -0
- package/dist/utils/map-columns/mapping.js +41 -0
- package/dist/utils/map-columns/prefill.js +32 -0
- package/dist/utils/map-columns/toMapColumnsActions.js +63 -0
- package/dist/utils/map-columns/validate.js +81 -0
- package/dist/utils/memo.js +6 -0
- package/dist/utils/pinch.d.ts +5 -1
- package/dist/utils/pinch.js +99 -0
- package/dist/utils/promise.js +16 -0
- package/dist/utils/referentialAction.js +23 -0
- package/dist/utils/rx-operators/fromCopy.js +7 -0
- package/dist/utils/rx-operators/fromPaste.js +7 -0
- package/dist/utils/rx-operators/fromShadowDraggable.js +5 -0
- package/dist/utils/safeCallback.js +10 -0
- package/dist/utils/schema-aml-parser/convert.js +285 -0
- package/dist/utils/schema-aml-parser/dataType.js +57 -0
- package/dist/utils/schema-aml-parser/index.js +22 -0
- package/dist/utils/schema-aml-parser/parser.js +637 -0
- package/dist/utils/schema-aml-parser/tokenizer.js +208 -0
- package/dist/utils/schema-aml-parser/types.js +8 -0
- package/dist/utils/schema-dbml-parser/convert.js +324 -0
- package/dist/utils/schema-dbml-parser/dataType.js +32 -0
- package/dist/utils/schema-dbml-parser/index.js +23 -0
- package/dist/utils/schema-dbml-parser/parser.js +646 -0
- package/dist/utils/schema-dbml-parser/tokenizer.js +185 -0
- package/dist/utils/schema-graphql-parser/convert.js +410 -0
- package/dist/utils/schema-graphql-parser/dataType.js +228 -0
- package/dist/utils/schema-graphql-parser/index.js +23 -0
- package/dist/utils/schema-graphql-parser/parser.js +490 -0
- package/dist/utils/schema-sql/Databricks.js +158 -0
- package/dist/utils/schema-sql/MSSQL.js +214 -0
- package/dist/utils/schema-sql/MariaDB.js +143 -0
- package/dist/utils/schema-sql/MySQL.js +224 -0
- package/dist/utils/schema-sql/Oracle.js +236 -0
- package/dist/utils/schema-sql/PostgreSQL.js +179 -0
- package/dist/utils/schema-sql/SQLite.js +129 -0
- package/dist/utils/schema-sql/Snowflake.js +148 -0
- package/dist/utils/schema-sql/index.d.ts +6 -3
- package/dist/utils/schema-sql/index.js +238 -0
- package/dist/utils/schema-sql/options.js +97 -0
- package/dist/utils/schema-sql/utils.d.ts +1 -43
- package/dist/utils/schema-sql/utils.js +251 -0
- package/dist/utils/schema-sql-parser/index.js +312 -0
- package/dist/utils/schema-sql-parser/utils.js +7 -0
- package/dist/utils/sharedColor.js +19 -0
- package/dist/utils/stageCursor.js +20 -0
- package/dist/utils/table-clipboard/copy.js +208 -0
- package/dist/utils/table-clipboard/index.js +28 -0
- package/dist/utils/table-clipboard/paste.js +154 -0
- package/dist/utils/table-clipboard/payload.js +73 -0
- package/dist/utils/table-clipboard/placement.js +54 -0
- package/dist/utils/tableColor.js +139 -0
- package/dist/utils/tableGroup.js +146 -0
- package/dist/utils/tableKeys.js +82 -0
- package/dist/utils/tableName.d.ts +47 -0
- package/dist/utils/tableName.js +72 -0
- package/dist/utils/takeover.js +10 -0
- package/dist/utils/text.js +47 -0
- package/dist/utils/validation.js +47 -0
- package/dist/utils/virtualRange.js +21 -0
- package/dist/uuid/dist/uuid25.js +11 -0
- package/dist/uuid/dist/uuidv7.js +25 -0
- package/dist/workers/elkLayout.shared-worker.js +327 -1
- package/dist/workers/elkLayout.spawn.d.ts +3 -0
- package/dist/workers/elkLayout.spawn.inline.d.ts +3 -0
- package/dist/workers/elkLayout.spawn.js +9 -0
- package/dist/workers/exportPng.shared-worker.js +32969 -55
- package/dist/workers/exportPng.spawn.d.ts +7 -0
- package/dist/workers/exportPng.spawn.inline.d.ts +7 -0
- package/dist/workers/exportPng.spawn.js +9 -0
- package/dist/workers/shiki.shared-worker.js +119 -1
- package/dist/workers/shiki.spawn.d.ts +3 -0
- package/dist/workers/shiki.spawn.inline.d.ts +3 -0
- package/dist/workers/shiki.spawn.js +9 -0
- package/package.json +35 -3
- package/dist/components/customElementRegistry.d.ts +0 -1
- package/dist/components/erd/diff-viewer/diffContext.d.ts +0 -9
- package/dist/components/erd/diff-viewer/erd-viewer/ErdViewer.d.ts +0 -11
- package/dist/loadValue-B5ojYrZ-.js +0 -14682
- package/dist/shared-store-S7YWEz3E.js +0 -1656
- package/dist/workers/spawn.d.ts +0 -9
- package/dist/workers/spawn.inline.d.ts +0 -9
- /package/dist/components/{explorer → erd}/fieldIcon.d.ts +0 -0
- /package/dist/components/erd/{floating-toolbar → view-controls}/ToolbarCompass.template.d.ts +0 -0
- /package/dist/components/erd/{floating-toolbar → view-controls}/nameViewDropdown.d.ts +0 -0
- /package/dist/components/erd/{floating-toolbar → view-controls}/nameViewDropdown.styles.d.ts +0 -0
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
import { query } from "../../erd-editor-schema/dist/query/index.js";
|
|
2
|
+
import { ColumnOption, Database } from "../../constants/schema.js";
|
|
3
|
+
import { bHas } from "../bit.js";
|
|
4
|
+
import { autoName, orderByNameASC } from "../tableName.js";
|
|
5
|
+
import { referentialActionSupport } from "../schema-sql/utils.js";
|
|
6
|
+
import { isIntegerFamily } from "../schema-sql/SQLite.js";
|
|
7
|
+
import { getNameCase, getPrimitiveType, hasNRelationship, hasOneRelationship, referentialActionEntries } from "./utils.js";
|
|
8
|
+
import { BINARY_TYPES, JSON_TYPES, POSTGRES_TIME_TZ_TYPES, TIMESTAMP_TZ_TYPES, UUID_TYPES, getColumnType, isMySQLFamily } from "./columnTypes.js";
|
|
9
|
+
//#region src/utils/generator-code/sqlalchemy.ts
|
|
10
|
+
var SQLALCHEMY_NAMES = [
|
|
11
|
+
"ARRAY",
|
|
12
|
+
"BINARY",
|
|
13
|
+
"BigInteger",
|
|
14
|
+
"Boolean",
|
|
15
|
+
"CHAR",
|
|
16
|
+
"Date",
|
|
17
|
+
"DateTime",
|
|
18
|
+
"Double",
|
|
19
|
+
"Enum",
|
|
20
|
+
"Float",
|
|
21
|
+
"ForeignKey",
|
|
22
|
+
"ForeignKeyConstraint",
|
|
23
|
+
"Index",
|
|
24
|
+
"Integer",
|
|
25
|
+
"Interval",
|
|
26
|
+
"JSON",
|
|
27
|
+
"LargeBinary",
|
|
28
|
+
"NCHAR",
|
|
29
|
+
"NVARCHAR",
|
|
30
|
+
"Numeric",
|
|
31
|
+
"REAL",
|
|
32
|
+
"SmallInteger",
|
|
33
|
+
"String",
|
|
34
|
+
"Text",
|
|
35
|
+
"Time",
|
|
36
|
+
"UUID",
|
|
37
|
+
"Uuid",
|
|
38
|
+
"VARBINARY",
|
|
39
|
+
"text"
|
|
40
|
+
];
|
|
41
|
+
var DIALECT_NAMES = {
|
|
42
|
+
mssql: [
|
|
43
|
+
"MONEY",
|
|
44
|
+
"NTEXT",
|
|
45
|
+
"SMALLMONEY",
|
|
46
|
+
"TIMESTAMP"
|
|
47
|
+
],
|
|
48
|
+
mysql: [
|
|
49
|
+
"BIGINT",
|
|
50
|
+
"BIT",
|
|
51
|
+
"DATETIME",
|
|
52
|
+
"DECIMAL",
|
|
53
|
+
"DOUBLE",
|
|
54
|
+
"FLOAT",
|
|
55
|
+
"INET4",
|
|
56
|
+
"INET6",
|
|
57
|
+
"INTEGER",
|
|
58
|
+
"LONGBLOB",
|
|
59
|
+
"LONGTEXT",
|
|
60
|
+
"MEDIUMBLOB",
|
|
61
|
+
"MEDIUMINT",
|
|
62
|
+
"MEDIUMTEXT",
|
|
63
|
+
"SET",
|
|
64
|
+
"SMALLINT",
|
|
65
|
+
"TIME",
|
|
66
|
+
"TIMESTAMP",
|
|
67
|
+
"TINYBLOB",
|
|
68
|
+
"TINYINT",
|
|
69
|
+
"TINYTEXT",
|
|
70
|
+
"VARCHAR",
|
|
71
|
+
"YEAR"
|
|
72
|
+
],
|
|
73
|
+
oracle: [
|
|
74
|
+
"DATE",
|
|
75
|
+
"NCLOB",
|
|
76
|
+
"NVARCHAR2",
|
|
77
|
+
"RAW",
|
|
78
|
+
"TIMESTAMP"
|
|
79
|
+
],
|
|
80
|
+
postgresql: [
|
|
81
|
+
"BIT",
|
|
82
|
+
"CIDR",
|
|
83
|
+
"DATEMULTIRANGE",
|
|
84
|
+
"DATERANGE",
|
|
85
|
+
"INET",
|
|
86
|
+
"INT4MULTIRANGE",
|
|
87
|
+
"INT4RANGE",
|
|
88
|
+
"INT8MULTIRANGE",
|
|
89
|
+
"INT8RANGE",
|
|
90
|
+
"INTERVAL",
|
|
91
|
+
"JSONB",
|
|
92
|
+
"JSONPATH",
|
|
93
|
+
"MACADDR",
|
|
94
|
+
"MACADDR8",
|
|
95
|
+
"MONEY",
|
|
96
|
+
"NUMMULTIRANGE",
|
|
97
|
+
"NUMRANGE",
|
|
98
|
+
"OID",
|
|
99
|
+
"REGCLASS",
|
|
100
|
+
"REGCONFIG",
|
|
101
|
+
"Range",
|
|
102
|
+
"TIME",
|
|
103
|
+
"TIMESTAMP",
|
|
104
|
+
"TSMULTIRANGE",
|
|
105
|
+
"TSQUERY",
|
|
106
|
+
"TSRANGE",
|
|
107
|
+
"TSTZMULTIRANGE",
|
|
108
|
+
"TSTZRANGE",
|
|
109
|
+
"TSVECTOR",
|
|
110
|
+
"UUID"
|
|
111
|
+
]
|
|
112
|
+
};
|
|
113
|
+
var ORM_NAMES = [
|
|
114
|
+
"DeclarativeBase",
|
|
115
|
+
"Mapped",
|
|
116
|
+
"mapped_column",
|
|
117
|
+
"relationship"
|
|
118
|
+
];
|
|
119
|
+
var STDLIB_PLAIN_NAMES = ["uuid"];
|
|
120
|
+
var STDLIB_FROM_NAMES = {
|
|
121
|
+
datetime: [
|
|
122
|
+
"date",
|
|
123
|
+
"datetime",
|
|
124
|
+
"time",
|
|
125
|
+
"timedelta"
|
|
126
|
+
],
|
|
127
|
+
decimal: ["Decimal"],
|
|
128
|
+
typing: [
|
|
129
|
+
"Any",
|
|
130
|
+
"List",
|
|
131
|
+
"Optional",
|
|
132
|
+
"Set"
|
|
133
|
+
]
|
|
134
|
+
};
|
|
135
|
+
var BUILTIN_NAMES = [
|
|
136
|
+
"bool",
|
|
137
|
+
"bytes",
|
|
138
|
+
"float",
|
|
139
|
+
"int",
|
|
140
|
+
"str"
|
|
141
|
+
];
|
|
142
|
+
var BASE_CLASS_NAME = "Base";
|
|
143
|
+
var MODULE_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
144
|
+
BASE_CLASS_NAME,
|
|
145
|
+
...SQLALCHEMY_NAMES,
|
|
146
|
+
...Object.values(DIALECT_NAMES).flatMap((names) => [...names]),
|
|
147
|
+
...ORM_NAMES,
|
|
148
|
+
...STDLIB_PLAIN_NAMES,
|
|
149
|
+
...Object.values(STDLIB_FROM_NAMES).flatMap((names) => [...names]),
|
|
150
|
+
...BUILTIN_NAMES
|
|
151
|
+
]);
|
|
152
|
+
var convertTypeMap = {
|
|
153
|
+
int: "Integer",
|
|
154
|
+
long: "BigInteger",
|
|
155
|
+
float: "Float",
|
|
156
|
+
double: "Double",
|
|
157
|
+
decimal: "Numeric",
|
|
158
|
+
boolean: "Boolean",
|
|
159
|
+
string: "String",
|
|
160
|
+
lob: "Text",
|
|
161
|
+
date: "Date",
|
|
162
|
+
dateTime: "DateTime",
|
|
163
|
+
time: "Time"
|
|
164
|
+
};
|
|
165
|
+
var annotationMap = {
|
|
166
|
+
int: "int",
|
|
167
|
+
long: "int",
|
|
168
|
+
float: "float",
|
|
169
|
+
double: "float",
|
|
170
|
+
decimal: "Decimal",
|
|
171
|
+
boolean: "bool",
|
|
172
|
+
string: "str",
|
|
173
|
+
lob: "str",
|
|
174
|
+
date: "date",
|
|
175
|
+
dateTime: "datetime",
|
|
176
|
+
time: "time"
|
|
177
|
+
};
|
|
178
|
+
var LINE_LIMIT = 88;
|
|
179
|
+
var INDENT = " ";
|
|
180
|
+
var OWNING = "owning";
|
|
181
|
+
var INVERSE = "inverse";
|
|
182
|
+
function createCode(state) {
|
|
183
|
+
const { doc: { tableIds }, collections } = state;
|
|
184
|
+
const tables = query(collections).collection("tableEntities").selectByIds(tableIds).sort(orderByNameASC);
|
|
185
|
+
if (tables.length === 0) return "";
|
|
186
|
+
const stringBuffer = [""];
|
|
187
|
+
const classBuffer = [];
|
|
188
|
+
const context = createClassContext(state);
|
|
189
|
+
tables.forEach((table) => {
|
|
190
|
+
classBuffer.push("");
|
|
191
|
+
classBuffer.push("");
|
|
192
|
+
formatClass(state, {
|
|
193
|
+
buffer: classBuffer,
|
|
194
|
+
table
|
|
195
|
+
}, context);
|
|
196
|
+
});
|
|
197
|
+
formatImports(stringBuffer, context.imports);
|
|
198
|
+
formatBase(stringBuffer);
|
|
199
|
+
classBuffer.forEach((line) => stringBuffer.push(line));
|
|
200
|
+
stringBuffer.push("");
|
|
201
|
+
return stringBuffer.join("\n");
|
|
202
|
+
}
|
|
203
|
+
function formatTable(state, { buffer, table }) {
|
|
204
|
+
const classBuffer = [];
|
|
205
|
+
const context = createClassContext(state);
|
|
206
|
+
formatClass(state, {
|
|
207
|
+
buffer: classBuffer,
|
|
208
|
+
table
|
|
209
|
+
}, context);
|
|
210
|
+
formatImports(buffer, context.imports);
|
|
211
|
+
formatBase(buffer);
|
|
212
|
+
buffer.push("");
|
|
213
|
+
buffer.push("");
|
|
214
|
+
classBuffer.forEach((line) => buffer.push(line));
|
|
215
|
+
}
|
|
216
|
+
function formatBase(buffer) {
|
|
217
|
+
buffer.push("");
|
|
218
|
+
buffer.push("");
|
|
219
|
+
buffer.push(`class ${BASE_CLASS_NAME}(DeclarativeBase):`);
|
|
220
|
+
buffer.push(`${INDENT}pass`);
|
|
221
|
+
}
|
|
222
|
+
function formatClass(state, { buffer, table }, context) {
|
|
223
|
+
const { collections } = state;
|
|
224
|
+
const { imports } = context;
|
|
225
|
+
const naming = getNaming(state, context, table);
|
|
226
|
+
const columns = query(collections).collection("tableColumnEntities").selectByIds(naming.columnIds);
|
|
227
|
+
const foreignKeys = /* @__PURE__ */ new Map();
|
|
228
|
+
const entries = [];
|
|
229
|
+
context.relationships.filter(({ relationship }) => relationship.end.tableId === table.id).forEach(({ relationship, startTable, startColumns, endColumns }) => {
|
|
230
|
+
const parentNaming = getNaming(state, context, startTable);
|
|
231
|
+
const actions = referentialActionEntries(relationship, referentialActionSupport(state.settings.database)).map(({ key, sql }) => `${key.toLowerCase()}="${sql}"`);
|
|
232
|
+
if (endColumns.length === 1) {
|
|
233
|
+
addSqlalchemy(imports, "ForeignKey");
|
|
234
|
+
const target = `${startTable.name}.${columnKey(parentNaming, startColumns[0])}`;
|
|
235
|
+
const carrier = columnRef(naming, endColumns[0]);
|
|
236
|
+
const args = [pythonString(target), ...actions];
|
|
237
|
+
const values = foreignKeys.get(carrier) ?? [];
|
|
238
|
+
values.push(`ForeignKey(${args.join(", ")})`);
|
|
239
|
+
foreignKeys.set(carrier, values);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
addSqlalchemy(imports, "ForeignKeyConstraint");
|
|
243
|
+
entries.push({
|
|
244
|
+
head: "ForeignKeyConstraint(",
|
|
245
|
+
args: [
|
|
246
|
+
formatStringList(endColumns.map((column) => columnKey(naming, column))),
|
|
247
|
+
formatStringList(startColumns.map((column) => `${startTable.name}.${columnKey(parentNaming, column)}`)),
|
|
248
|
+
...actions
|
|
249
|
+
]
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
createIndexEntries(state, table, naming, context).forEach((entry) => entries.push(entry));
|
|
253
|
+
buffer.push(`class ${naming.className}(${BASE_CLASS_NAME}):`);
|
|
254
|
+
if (table.comment.trim() !== "") {
|
|
255
|
+
buffer.push(`${INDENT}"""${formatDocstring(table.comment)}"""`);
|
|
256
|
+
buffer.push("");
|
|
257
|
+
}
|
|
258
|
+
buffer.push(`${INDENT}__tablename__ = ${pythonString(table.name)}`);
|
|
259
|
+
formatTableArgs(buffer, entries, table.comment);
|
|
260
|
+
const bodyBuffer = [];
|
|
261
|
+
const { database } = state.settings;
|
|
262
|
+
const isSoleKey = columns.filter((column) => bHas(column.options, ColumnOption.primaryKey)).length === 1;
|
|
263
|
+
const typedColumns = columns.map((column) => {
|
|
264
|
+
const dataType = isSqliteIntegerKey(column, database, isSoleKey) ? SQLITE_ROWID_TYPE : column.dataType;
|
|
265
|
+
const columnType = getColumnType(dataType, database);
|
|
266
|
+
return {
|
|
267
|
+
column,
|
|
268
|
+
columnType,
|
|
269
|
+
type: getSqlalchemyType(columnType, database, imports)
|
|
270
|
+
};
|
|
271
|
+
});
|
|
272
|
+
const autoIncrementKey = typedColumns.filter(({ column }) => bHas(column.options, ColumnOption.primaryKey)).find((typed) => isNumberedByDatabase(typed, database, isSoleKey) || isSoleKey && typed.type.isNumeric && typed.columnType.isSerial);
|
|
273
|
+
typedColumns.forEach((typed) => {
|
|
274
|
+
const { column } = typed;
|
|
275
|
+
const isPrimaryKey = bHas(column.options, ColumnOption.primaryKey);
|
|
276
|
+
formatColumn(state, {
|
|
277
|
+
buffer: bodyBuffer,
|
|
278
|
+
column
|
|
279
|
+
}, {
|
|
280
|
+
imports,
|
|
281
|
+
attribute: naming.columnNames.get(column.id) ?? column.name,
|
|
282
|
+
key: columnKey(naming, column),
|
|
283
|
+
foreignKeys: foreignKeys.get(column.id) ?? [],
|
|
284
|
+
typed,
|
|
285
|
+
isSoleKey,
|
|
286
|
+
isAutoIncrement: isPrimaryKey ? typed === autoIncrementKey : isNumberedByDatabase(typed, database, isSoleKey)
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
const relationBuffer = [];
|
|
290
|
+
formatRelation(state, {
|
|
291
|
+
buffer: relationBuffer,
|
|
292
|
+
table
|
|
293
|
+
}, context);
|
|
294
|
+
if (relationBuffer.length !== 0 && bodyBuffer.length !== 0) bodyBuffer.push("");
|
|
295
|
+
relationBuffer.forEach((line) => bodyBuffer.push(line));
|
|
296
|
+
if (bodyBuffer.length !== 0) {
|
|
297
|
+
buffer.push("");
|
|
298
|
+
bodyBuffer.forEach((line) => buffer.push(line));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function formatColumn({ settings: { database } }, { buffer, column }, { imports, attribute, key, foreignKeys, typed: { columnType, type: { expression, annotation, isNumeric, call } }, isSoleKey, isAutoIncrement }) {
|
|
302
|
+
const isPrimaryKey = bHas(column.options, ColumnOption.primaryKey);
|
|
303
|
+
const isNotNull = bHas(column.options, ColumnOption.notNull);
|
|
304
|
+
const isRowid = database === Database.SQLite && columnType.element.trim().toLowerCase() === "integer";
|
|
305
|
+
const isGeneratedKey = isPrimaryKey && isSoleKey && isNumeric && !isRowid;
|
|
306
|
+
const hasServerDefault = !isAutoIncrement && !bHas(column.options, ColumnOption.autoIncrement) && column.default.trim() !== "";
|
|
307
|
+
const isUnique = bHas(column.options, ColumnOption.unique) || isMySQLFamily(database) && columnType.isSerial;
|
|
308
|
+
const isOptional = !isPrimaryKey && !isNotNull;
|
|
309
|
+
const args = [];
|
|
310
|
+
if (attribute !== column.name) args.push(pythonString(column.name));
|
|
311
|
+
args.push(call ?? expression);
|
|
312
|
+
foreignKeys.forEach((foreignKey) => args.push(foreignKey));
|
|
313
|
+
if (key !== column.name) args.push(`key=${pythonString(key)}`);
|
|
314
|
+
if (isPrimaryKey) args.push("primary_key=True");
|
|
315
|
+
if (isAutoIncrement) args.push("autoincrement=True");
|
|
316
|
+
else if (isGeneratedKey) args.push("autoincrement=False");
|
|
317
|
+
if (!isPrimaryKey && isNotNull) args.push("nullable=False");
|
|
318
|
+
if (isUnique) args.push("unique=True");
|
|
319
|
+
if (hasServerDefault) {
|
|
320
|
+
addSqlalchemy(imports, "text");
|
|
321
|
+
args.push({
|
|
322
|
+
head: "server_default=text(",
|
|
323
|
+
args: [pythonString(column.default)]
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
if (column.comment.trim() !== "") args.push(`comment=${pythonString(column.comment)}`);
|
|
327
|
+
addOrm(imports, "Mapped");
|
|
328
|
+
addOrm(imports, "mapped_column");
|
|
329
|
+
if (isOptional) addStdlibFrom(imports, "typing", "Optional");
|
|
330
|
+
formatAssignment(buffer, attribute, isOptional ? `Optional[${annotation}]` : annotation, "mapped_column(", args);
|
|
331
|
+
}
|
|
332
|
+
function formatRelation(state, { buffer, table }, context) {
|
|
333
|
+
const { imports } = context;
|
|
334
|
+
const naming = getNaming(state, context, table);
|
|
335
|
+
context.relationships.filter(({ relationship }) => relationship.end.tableId === table.id).forEach((resolved) => {
|
|
336
|
+
const { relationship, startTable, endColumns } = resolved;
|
|
337
|
+
const attribute = naming.relationshipNames.get(relationshipKey(relationship, OWNING));
|
|
338
|
+
if (!attribute) return;
|
|
339
|
+
const parentNaming = getNaming(state, context, startTable);
|
|
340
|
+
const annotation = carriedColumns(state, naming, endColumns).every((column) => bHas(column.options, ColumnOption.primaryKey) || bHas(column.options, ColumnOption.notNull)) ? `"${parentNaming.className}"` : `Optional["${parentNaming.className}"]`;
|
|
341
|
+
addOrm(imports, "relationship");
|
|
342
|
+
formatAssignment(buffer, attribute, annotation, "relationship(", relationArguments(state, context, resolved, INVERSE));
|
|
343
|
+
});
|
|
344
|
+
context.relationships.filter(({ relationship }) => relationship.start.tableId === table.id).forEach((resolved) => {
|
|
345
|
+
const { relationship, endTable } = resolved;
|
|
346
|
+
const attribute = naming.relationshipNames.get(relationshipKey(relationship, INVERSE));
|
|
347
|
+
if (!attribute) return;
|
|
348
|
+
const childNaming = getNaming(state, context, endTable);
|
|
349
|
+
const isMany = hasNRelationship(relationship.relationshipType);
|
|
350
|
+
addStdlibFrom(imports, "typing", isMany ? "List" : "Optional");
|
|
351
|
+
const annotation = isMany ? `List["${childNaming.className}"]` : `Optional["${childNaming.className}"]`;
|
|
352
|
+
addOrm(imports, "relationship");
|
|
353
|
+
formatAssignment(buffer, attribute, annotation, "relationship(", relationArguments(state, context, resolved, OWNING));
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function relationArguments(state, context, resolved, backPopulatesSide) {
|
|
357
|
+
const { relationship, startTable, startColumns, endTable, endColumns } = resolved;
|
|
358
|
+
const args = [];
|
|
359
|
+
const backPopulates = getNaming(state, context, backPopulatesSide === OWNING ? endTable : startTable).relationshipNames.get(relationshipKey(relationship, backPopulatesSide));
|
|
360
|
+
if (backPopulates) args.push(`back_populates="${backPopulates}"`);
|
|
361
|
+
if (context.ambiguous.has(pairKey(relationship))) {
|
|
362
|
+
const childNaming = getNaming(state, context, endTable);
|
|
363
|
+
const names = endColumns.map((column) => `${childNaming.className}.${childNaming.columnNames.get(column.id) ?? column.name}`);
|
|
364
|
+
args.push(`foreign_keys="[${names.join(", ")}]"`);
|
|
365
|
+
}
|
|
366
|
+
if (isSelfReferential(relationship) && backPopulatesSide === INVERSE) {
|
|
367
|
+
const parentNaming = getNaming(state, context, startTable);
|
|
368
|
+
const names = startColumns.map((column) => `${parentNaming.className}.${parentNaming.columnNames.get(column.id) ?? column.name}`);
|
|
369
|
+
args.push(`remote_side="[${names.join(", ")}]"`);
|
|
370
|
+
}
|
|
371
|
+
return args;
|
|
372
|
+
}
|
|
373
|
+
function createIndexEntries(state, table, naming, { imports, indexNames }) {
|
|
374
|
+
const { doc: { indexIds }, collections } = state;
|
|
375
|
+
const columnCollection = query(collections).collection("tableColumnEntities");
|
|
376
|
+
const entries = [];
|
|
377
|
+
query(collections).collection("indexEntities").selectByIds(indexIds).filter((index) => index.tableId === table.id).forEach((index) => {
|
|
378
|
+
const columns = query(collections).collection("indexColumnEntities").selectByIds(index.indexColumnIds).map((indexColumn) => columnCollection.selectById(indexColumn.columnId)).filter((column) => column !== void 0);
|
|
379
|
+
if (columns.length === 0) return;
|
|
380
|
+
let indexName = index.name;
|
|
381
|
+
if (index.name.trim() === "") {
|
|
382
|
+
indexName = autoName(indexNames, "", `IDX_${table.name}`);
|
|
383
|
+
indexNames.push({
|
|
384
|
+
id: index.id,
|
|
385
|
+
name: indexName
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
const args = [pythonString(indexName)];
|
|
389
|
+
columns.forEach((column) => args.push(pythonString(columnKey(naming, column))));
|
|
390
|
+
if (index.unique) args.push("unique=True");
|
|
391
|
+
addSqlalchemy(imports, "Index");
|
|
392
|
+
entries.push({
|
|
393
|
+
head: "Index(",
|
|
394
|
+
args
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
return entries;
|
|
398
|
+
}
|
|
399
|
+
function formatTableArgs(buffer, entries, comment) {
|
|
400
|
+
const commentArg = comment.trim() === "" ? null : `"comment": ${pythonString(comment)}`;
|
|
401
|
+
if (entries.length === 0) {
|
|
402
|
+
if (commentArg !== null) formatCall(buffer, INDENT, "__table_args__ = {", [commentArg], "}");
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
const single = `${INDENT}__table_args__ = (${callText(entries[0])},)`;
|
|
406
|
+
if (entries.length === 1 && commentArg === null && lineWidth(single) <= LINE_LIMIT) {
|
|
407
|
+
buffer.push(single);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
buffer.push(`${INDENT}__table_args__ = (`);
|
|
411
|
+
entries.forEach((entry) => {
|
|
412
|
+
formatCall(buffer, `${INDENT}${INDENT}`, entry.head, entry.args, "),");
|
|
413
|
+
});
|
|
414
|
+
if (commentArg !== null) formatCall(buffer, `${INDENT}${INDENT}`, "{", [commentArg], "},");
|
|
415
|
+
buffer.push(`${INDENT})`);
|
|
416
|
+
}
|
|
417
|
+
function formatCall(buffer, indent, head, args, tail) {
|
|
418
|
+
const line = `${indent}${head}${args.map(callText).join(", ")}${tail}`;
|
|
419
|
+
if (lineWidth(line) <= LINE_LIMIT) {
|
|
420
|
+
buffer.push(line);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
buffer.push(`${indent}${head}`);
|
|
424
|
+
args.forEach((arg) => {
|
|
425
|
+
if (typeof arg === "string") {
|
|
426
|
+
buffer.push(`${indent}${INDENT}${arg},`);
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
formatCall(buffer, `${indent}${INDENT}`, arg.head, arg.args, "),");
|
|
430
|
+
});
|
|
431
|
+
buffer.push(`${indent}${tail}`);
|
|
432
|
+
}
|
|
433
|
+
function formatAssignment(buffer, attribute, annotation, head, args) {
|
|
434
|
+
const target = `${attribute}: Mapped[${annotation}]`;
|
|
435
|
+
const opening = `${INDENT}${target} = ${head}`;
|
|
436
|
+
const line = `${opening}${args.map(callText).join(", ")})`;
|
|
437
|
+
const wrapped = `${INDENT}${target} = (`;
|
|
438
|
+
if (lineWidth(line) <= LINE_LIMIT || lineWidth(opening) <= LINE_LIMIT) {
|
|
439
|
+
formatCall(buffer, INDENT, `${target} = ${head}`, args, ")");
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (lineWidth(wrapped) <= LINE_LIMIT) {
|
|
443
|
+
buffer.push(wrapped);
|
|
444
|
+
formatCall(buffer, `${INDENT}${INDENT}`, head, args, ")");
|
|
445
|
+
buffer.push(`${INDENT})`);
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
buffer.push(`${INDENT}${attribute}: Mapped[`);
|
|
449
|
+
buffer.push(`${INDENT}${INDENT}${annotation}`);
|
|
450
|
+
formatCall(buffer, INDENT, `] = ${head}`, args, ")");
|
|
451
|
+
}
|
|
452
|
+
var WIDE_RANGES = [
|
|
453
|
+
[4352, 4447],
|
|
454
|
+
[11904, 11929],
|
|
455
|
+
[11931, 12019],
|
|
456
|
+
[12032, 12245],
|
|
457
|
+
[12272, 12283],
|
|
458
|
+
[12288, 12329],
|
|
459
|
+
[12334, 12350],
|
|
460
|
+
[12353, 12438],
|
|
461
|
+
[12443, 12543],
|
|
462
|
+
[12549, 12591],
|
|
463
|
+
[12593, 12686],
|
|
464
|
+
[12688, 12771],
|
|
465
|
+
[12784, 12830],
|
|
466
|
+
[12832, 12871],
|
|
467
|
+
[12880, 19903],
|
|
468
|
+
[19968, 42124],
|
|
469
|
+
[42128, 42182],
|
|
470
|
+
[43360, 43388],
|
|
471
|
+
[44032, 55203],
|
|
472
|
+
[63744, 64255],
|
|
473
|
+
[65040, 65049],
|
|
474
|
+
[65072, 65106],
|
|
475
|
+
[65108, 65126],
|
|
476
|
+
[65128, 65131],
|
|
477
|
+
[65281, 65376],
|
|
478
|
+
[65504, 65510],
|
|
479
|
+
[131072, 196605],
|
|
480
|
+
[196608, 262141]
|
|
481
|
+
];
|
|
482
|
+
var PRINTABLE_ASCII = /^[\x20-\x7e]*$/;
|
|
483
|
+
function lineWidth(line) {
|
|
484
|
+
if (PRINTABLE_ASCII.test(line)) return line.length;
|
|
485
|
+
let width = 0;
|
|
486
|
+
for (const char of line) {
|
|
487
|
+
const code = char.codePointAt(0);
|
|
488
|
+
width += WIDE_RANGES.some(([first, last]) => first <= code && code <= last) ? 2 : 1;
|
|
489
|
+
}
|
|
490
|
+
return width;
|
|
491
|
+
}
|
|
492
|
+
function callText(arg) {
|
|
493
|
+
return typeof arg === "string" ? arg : `${arg.head}${arg.args.join(", ")})`;
|
|
494
|
+
}
|
|
495
|
+
function formatImports(buffer, imports) {
|
|
496
|
+
const stdlibBuffer = [];
|
|
497
|
+
const sqlalchemyBuffer = [];
|
|
498
|
+
Array.from(imports.stdlibPlain).sort().forEach((name) => stdlibBuffer.push(`import ${name}`));
|
|
499
|
+
Array.from(imports.stdlibFrom.keys()).sort().forEach((module) => {
|
|
500
|
+
formatFromImport(stdlibBuffer, module, imports.stdlibFrom.get(module));
|
|
501
|
+
});
|
|
502
|
+
if (imports.sqlalchemy.size !== 0) formatFromImport(sqlalchemyBuffer, "sqlalchemy", imports.sqlalchemy);
|
|
503
|
+
Array.from(imports.dialects.keys()).sort().forEach((dialect) => {
|
|
504
|
+
formatFromImport(sqlalchemyBuffer, `sqlalchemy.dialects.${dialect}`, imports.dialects.get(dialect));
|
|
505
|
+
});
|
|
506
|
+
formatFromImport(sqlalchemyBuffer, "sqlalchemy.orm", imports.orm);
|
|
507
|
+
stdlibBuffer.forEach((line) => buffer.push(line));
|
|
508
|
+
if (stdlibBuffer.length !== 0) buffer.push("");
|
|
509
|
+
sqlalchemyBuffer.forEach((line) => buffer.push(line));
|
|
510
|
+
}
|
|
511
|
+
function formatFromImport(buffer, module, names) {
|
|
512
|
+
const sorted = sortImportNames(names);
|
|
513
|
+
const line = `from ${module} import ${sorted.join(", ")}`;
|
|
514
|
+
if (line.length <= LINE_LIMIT) {
|
|
515
|
+
buffer.push(line);
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
buffer.push(`from ${module} import (`);
|
|
519
|
+
sorted.forEach((name) => buffer.push(`${INDENT}${name},`));
|
|
520
|
+
buffer.push(")");
|
|
521
|
+
}
|
|
522
|
+
var CONSTANT = /^(?=.*[A-Z])[A-Z0-9_]{2,}$/;
|
|
523
|
+
function importGroup(name) {
|
|
524
|
+
return CONSTANT.test(name) ? 0 : 1;
|
|
525
|
+
}
|
|
526
|
+
function sortImportNames(names) {
|
|
527
|
+
return Array.from(names).sort((a, b) => {
|
|
528
|
+
const group = importGroup(a) - importGroup(b);
|
|
529
|
+
if (group !== 0) return group;
|
|
530
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
function createImportSet() {
|
|
534
|
+
const imports = {
|
|
535
|
+
stdlibPlain: /* @__PURE__ */ new Set(),
|
|
536
|
+
stdlibFrom: /* @__PURE__ */ new Map(),
|
|
537
|
+
sqlalchemy: /* @__PURE__ */ new Set(),
|
|
538
|
+
dialects: /* @__PURE__ */ new Map(),
|
|
539
|
+
orm: /* @__PURE__ */ new Set()
|
|
540
|
+
};
|
|
541
|
+
addOrm(imports, "DeclarativeBase");
|
|
542
|
+
return imports;
|
|
543
|
+
}
|
|
544
|
+
function addSqlalchemy(imports, name) {
|
|
545
|
+
imports.sqlalchemy.add(name);
|
|
546
|
+
}
|
|
547
|
+
function addDialect(imports, dialect, name) {
|
|
548
|
+
const names = imports.dialects.get(dialect) ?? /* @__PURE__ */ new Set();
|
|
549
|
+
names.add(name);
|
|
550
|
+
imports.dialects.set(dialect, names);
|
|
551
|
+
}
|
|
552
|
+
function addOrm(imports, name) {
|
|
553
|
+
imports.orm.add(name);
|
|
554
|
+
}
|
|
555
|
+
function addStdlibPlain(imports, name) {
|
|
556
|
+
imports.stdlibPlain.add(name);
|
|
557
|
+
}
|
|
558
|
+
function addStdlibFrom(imports, module, name) {
|
|
559
|
+
const names = imports.stdlibFrom.get(module) ?? /* @__PURE__ */ new Set();
|
|
560
|
+
names.add(name);
|
|
561
|
+
imports.stdlibFrom.set(module, names);
|
|
562
|
+
}
|
|
563
|
+
var textTypes = /* @__PURE__ */ new Set([
|
|
564
|
+
"clob",
|
|
565
|
+
"long varchar",
|
|
566
|
+
"longtext",
|
|
567
|
+
"mediumtext",
|
|
568
|
+
"nclob",
|
|
569
|
+
"ntext",
|
|
570
|
+
"text",
|
|
571
|
+
"tinytext"
|
|
572
|
+
]);
|
|
573
|
+
var mysqlIntegerTypes = /* @__PURE__ */ new Map([
|
|
574
|
+
["bigint", ["BIGINT", "BigInteger"]],
|
|
575
|
+
["int", ["INTEGER", "Integer"]],
|
|
576
|
+
["int1", ["TINYINT", null]],
|
|
577
|
+
["int2", ["SMALLINT", "SmallInteger"]],
|
|
578
|
+
["int3", ["MEDIUMINT", null]],
|
|
579
|
+
["int4", ["INTEGER", "Integer"]],
|
|
580
|
+
["int8", ["BIGINT", "BigInteger"]],
|
|
581
|
+
["integer", ["INTEGER", "Integer"]],
|
|
582
|
+
["mediumint", ["MEDIUMINT", null]],
|
|
583
|
+
["middleint", ["MEDIUMINT", null]],
|
|
584
|
+
["smallint", ["SMALLINT", "SmallInteger"]],
|
|
585
|
+
["tinyint", ["TINYINT", null]]
|
|
586
|
+
]);
|
|
587
|
+
var mysqlSizedTypes = /* @__PURE__ */ new Map([
|
|
588
|
+
["clob", ["LONGTEXT", "str"]],
|
|
589
|
+
["long", ["MEDIUMTEXT", "str"]],
|
|
590
|
+
["long char varying", ["MEDIUMTEXT", "str"]],
|
|
591
|
+
["long character varying", ["MEDIUMTEXT", "str"]],
|
|
592
|
+
["long varbinary", ["MEDIUMBLOB", "bytes"]],
|
|
593
|
+
["long varchar", ["MEDIUMTEXT", "str"]],
|
|
594
|
+
["long varcharacter", ["MEDIUMTEXT", "str"]],
|
|
595
|
+
["longblob", ["LONGBLOB", "bytes"]],
|
|
596
|
+
["longtext", ["LONGTEXT", "str"]],
|
|
597
|
+
["mediumblob", ["MEDIUMBLOB", "bytes"]],
|
|
598
|
+
["mediumtext", ["MEDIUMTEXT", "str"]],
|
|
599
|
+
["tinyblob", ["TINYBLOB", "bytes"]],
|
|
600
|
+
["tinytext", ["TINYTEXT", "str"]]
|
|
601
|
+
]);
|
|
602
|
+
var intervalDatabases = /* @__PURE__ */ new Set([
|
|
603
|
+
Database.Databricks,
|
|
604
|
+
Database.Oracle,
|
|
605
|
+
Database.PostgreSQL
|
|
606
|
+
]);
|
|
607
|
+
var mysqlDecimalTypes = /* @__PURE__ */ new Set([
|
|
608
|
+
"dec",
|
|
609
|
+
"decimal",
|
|
610
|
+
"fixed",
|
|
611
|
+
"numeric"
|
|
612
|
+
]);
|
|
613
|
+
var mysqlYearTypes = /* @__PURE__ */ new Set(["sql_tsi_year", "year"]);
|
|
614
|
+
var characterTypes = /* @__PURE__ */ new Set(["char", "character"]);
|
|
615
|
+
var nationalCharacterTypes = /* @__PURE__ */ new Set([
|
|
616
|
+
"national char",
|
|
617
|
+
"national character",
|
|
618
|
+
"nchar"
|
|
619
|
+
]);
|
|
620
|
+
var mysqlNationalVaryingTypes = /* @__PURE__ */ new Set([
|
|
621
|
+
"national char varying",
|
|
622
|
+
"national character varying",
|
|
623
|
+
"national varchar",
|
|
624
|
+
"national varcharacter",
|
|
625
|
+
"nchar varchar",
|
|
626
|
+
"nchar varcharacter",
|
|
627
|
+
"nchar varying",
|
|
628
|
+
"nvarchar"
|
|
629
|
+
]);
|
|
630
|
+
var mssqlBinaryReadTypes = /* @__PURE__ */ new Set([
|
|
631
|
+
"geography",
|
|
632
|
+
"geometry",
|
|
633
|
+
"hierarchyid",
|
|
634
|
+
"sql_variant"
|
|
635
|
+
]);
|
|
636
|
+
var oracleObjectTypes = /* @__PURE__ */ new Set([
|
|
637
|
+
"anydata",
|
|
638
|
+
"bfile",
|
|
639
|
+
"uritype",
|
|
640
|
+
"vector"
|
|
641
|
+
]);
|
|
642
|
+
var mssqlNationalVaryingTypes = /* @__PURE__ */ new Set([
|
|
643
|
+
"national char varying",
|
|
644
|
+
"national character varying",
|
|
645
|
+
"nvarchar"
|
|
646
|
+
]);
|
|
647
|
+
var oracleNationalVaryingTypes = /* @__PURE__ */ new Set([
|
|
648
|
+
"national char varying",
|
|
649
|
+
"national character varying",
|
|
650
|
+
"nchar varying",
|
|
651
|
+
"nvarchar2"
|
|
652
|
+
]);
|
|
653
|
+
var postgresSmallintTypes = /* @__PURE__ */ new Set([
|
|
654
|
+
"int2",
|
|
655
|
+
"serial2",
|
|
656
|
+
"smallint",
|
|
657
|
+
"smallserial"
|
|
658
|
+
]);
|
|
659
|
+
var postgresTimeTypes = /* @__PURE__ */ new Set(["time", "time without time zone"]);
|
|
660
|
+
var postgresTimestampTypes = /* @__PURE__ */ new Set(["timestamp", "timestamp without time zone"]);
|
|
661
|
+
var postgresArrayTypes = /* @__PURE__ */ new Set([
|
|
662
|
+
"bigint",
|
|
663
|
+
"bool",
|
|
664
|
+
"boolean",
|
|
665
|
+
"bpchar",
|
|
666
|
+
"bytea",
|
|
667
|
+
"char",
|
|
668
|
+
"character",
|
|
669
|
+
"character varying",
|
|
670
|
+
"cidr",
|
|
671
|
+
"date",
|
|
672
|
+
"daterange",
|
|
673
|
+
"dec",
|
|
674
|
+
"decimal",
|
|
675
|
+
"double precision",
|
|
676
|
+
"float",
|
|
677
|
+
"float4",
|
|
678
|
+
"float8",
|
|
679
|
+
"inet",
|
|
680
|
+
"int",
|
|
681
|
+
"int2",
|
|
682
|
+
"int4",
|
|
683
|
+
"int4range",
|
|
684
|
+
"int8",
|
|
685
|
+
"int8range",
|
|
686
|
+
"integer",
|
|
687
|
+
"json",
|
|
688
|
+
"jsonb",
|
|
689
|
+
"macaddr",
|
|
690
|
+
"name",
|
|
691
|
+
"numeric",
|
|
692
|
+
"numrange",
|
|
693
|
+
"oid",
|
|
694
|
+
"real",
|
|
695
|
+
"smallint",
|
|
696
|
+
"text",
|
|
697
|
+
"time",
|
|
698
|
+
"time with time zone",
|
|
699
|
+
"time without time zone",
|
|
700
|
+
"timestamp",
|
|
701
|
+
"timestamp with time zone",
|
|
702
|
+
"timestamp without time zone",
|
|
703
|
+
"timestamptz",
|
|
704
|
+
"timetz",
|
|
705
|
+
"tsrange",
|
|
706
|
+
"tstzrange",
|
|
707
|
+
"uuid",
|
|
708
|
+
"varchar"
|
|
709
|
+
]);
|
|
710
|
+
var postgresNamedTypes = /* @__PURE__ */ new Map([
|
|
711
|
+
["cidr", ["CIDR", "str"]],
|
|
712
|
+
["inet", ["INET", "str"]],
|
|
713
|
+
["jsonpath", ["JSONPATH", "str"]],
|
|
714
|
+
["macaddr", ["MACADDR", "str"]],
|
|
715
|
+
["macaddr8", ["MACADDR8", "str"]],
|
|
716
|
+
["oid", ["OID", "int"]],
|
|
717
|
+
["regclass", ["REGCLASS", "str"]],
|
|
718
|
+
["regconfig", ["REGCONFIG", "str"]],
|
|
719
|
+
["tsquery", ["TSQUERY", "str"]],
|
|
720
|
+
["tsvector", ["TSVECTOR", "str"]]
|
|
721
|
+
]);
|
|
722
|
+
var postgresRangeTypes = /* @__PURE__ */ new Map([
|
|
723
|
+
["datemultirange", ["DATEMULTIRANGE", "date"]],
|
|
724
|
+
["daterange", ["DATERANGE", "date"]],
|
|
725
|
+
["int4multirange", ["INT4MULTIRANGE", "int"]],
|
|
726
|
+
["int4range", ["INT4RANGE", "int"]],
|
|
727
|
+
["int8multirange", ["INT8MULTIRANGE", "int"]],
|
|
728
|
+
["int8range", ["INT8RANGE", "int"]],
|
|
729
|
+
["nummultirange", ["NUMMULTIRANGE", "Decimal"]],
|
|
730
|
+
["numrange", ["NUMRANGE", "Decimal"]],
|
|
731
|
+
["tsmultirange", ["TSMULTIRANGE", "datetime"]],
|
|
732
|
+
["tsrange", ["TSRANGE", "datetime"]],
|
|
733
|
+
["tstzmultirange", ["TSTZMULTIRANGE", "datetime"]],
|
|
734
|
+
["tstzrange", ["TSTZRANGE", "datetime"]]
|
|
735
|
+
]);
|
|
736
|
+
var INTEGER_AFFINITY = [
|
|
737
|
+
"BIGINT",
|
|
738
|
+
"BigInteger",
|
|
739
|
+
"INTEGER",
|
|
740
|
+
"Integer",
|
|
741
|
+
"MEDIUMINT",
|
|
742
|
+
"SMALLINT",
|
|
743
|
+
"SmallInteger",
|
|
744
|
+
"TINYINT"
|
|
745
|
+
];
|
|
746
|
+
var DECIMAL_AFFINITY = [
|
|
747
|
+
"DECIMAL",
|
|
748
|
+
"DOUBLE",
|
|
749
|
+
"Double",
|
|
750
|
+
"FLOAT",
|
|
751
|
+
"Float",
|
|
752
|
+
"Numeric",
|
|
753
|
+
"REAL"
|
|
754
|
+
];
|
|
755
|
+
var INTEGER_NAMES = new Set(INTEGER_AFFINITY);
|
|
756
|
+
var NUMERIC_NAMES = /* @__PURE__ */ new Set([...INTEGER_AFFINITY, ...DECIMAL_AFFINITY]);
|
|
757
|
+
var POSTGRES_IDENTITY_TYPES = /* @__PURE__ */ new Set([
|
|
758
|
+
"bigint",
|
|
759
|
+
"int",
|
|
760
|
+
"int2",
|
|
761
|
+
"int4",
|
|
762
|
+
"int8",
|
|
763
|
+
"integer",
|
|
764
|
+
"smallint"
|
|
765
|
+
]);
|
|
766
|
+
var DATABRICKS_IDENTITY_TYPES = /* @__PURE__ */ new Set(["bigint", "long"]);
|
|
767
|
+
function isNumberedByDatabase({ column, columnType, type }, database, isSoleKey) {
|
|
768
|
+
if (!bHas(column.options, ColumnOption.autoIncrement) || !type.isNumeric) return false;
|
|
769
|
+
const name = column.dataType.trim().toLowerCase();
|
|
770
|
+
switch (database) {
|
|
771
|
+
case Database.PostgreSQL: return columnType.isSerial || POSTGRES_IDENTITY_TYPES.has(name);
|
|
772
|
+
case Database.SQLite: return isSqliteIntegerKey(column, database, isSoleKey);
|
|
773
|
+
case Database.Databricks: return DATABRICKS_IDENTITY_TYPES.has(name);
|
|
774
|
+
case Database.MySQL: return type.isInteger;
|
|
775
|
+
case Database.MariaDB: return type.isInteger || columnType.isFloat;
|
|
776
|
+
case Database.MSSQL: return type.isInteger || !columnType.isFloat && (columnType.scale ?? 0) === 0;
|
|
777
|
+
}
|
|
778
|
+
return true;
|
|
779
|
+
}
|
|
780
|
+
var SQLITE_ROWID_TYPE = "INTEGER";
|
|
781
|
+
function isSqliteIntegerKey(column, database, isSoleKey) {
|
|
782
|
+
return database === Database.SQLite && isSoleKey && bHas(column.options, ColumnOption.primaryKey) && bHas(column.options, ColumnOption.autoIncrement) && isIntegerFamily(column.dataType);
|
|
783
|
+
}
|
|
784
|
+
var ZEROFILL = /(^|[^0-9a-z_])zerofill([^0-9a-z_]|$)/i;
|
|
785
|
+
var ORACLE_DAY_TO_SECOND = /^\s*interval\s+day\s*(?:\(\s*(\d+)\s*\))?\s+to\s+second\s*(?:\(\s*(\d+)\s*\))?\s*$/i;
|
|
786
|
+
function getSqlalchemyType(column, database, imports) {
|
|
787
|
+
if (column.arrayDepth === 0) return elementType(column, database, imports);
|
|
788
|
+
if (!column.isListed || !postgresArrayTypes.has(column.base) && column.scalar !== "interval") return coreType(imports, "String", "str");
|
|
789
|
+
const element = elementType(column, database, imports);
|
|
790
|
+
const dimensions = column.arrayDepth > 1 ? `, dimensions=${column.arrayDepth}` : "";
|
|
791
|
+
addSqlalchemy(imports, "ARRAY");
|
|
792
|
+
addStdlibFrom(imports, "typing", "List");
|
|
793
|
+
return {
|
|
794
|
+
expression: `ARRAY(${element.expression}${dimensions})`,
|
|
795
|
+
annotation: `${"List[".repeat(column.arrayDepth)}${element.annotation}${"]".repeat(column.arrayDepth)}`,
|
|
796
|
+
isNumeric: false,
|
|
797
|
+
isInteger: false
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
function elementType(column, database, imports) {
|
|
801
|
+
switch (database) {
|
|
802
|
+
case Database.MariaDB:
|
|
803
|
+
case Database.MySQL: return mysqlType(column, database, imports) ?? portableType(column, database, imports);
|
|
804
|
+
case Database.PostgreSQL: return postgresType(column, imports) ?? portableType(column, database, imports);
|
|
805
|
+
case Database.MSSQL: return mssqlType(column, imports) ?? portableType(column, database, imports);
|
|
806
|
+
case Database.Oracle: return oracleType(column, imports) ?? portableType(column, database, imports);
|
|
807
|
+
}
|
|
808
|
+
return portableType(column, database, imports);
|
|
809
|
+
}
|
|
810
|
+
function portableType(column, database, imports) {
|
|
811
|
+
const { base, element, args } = column;
|
|
812
|
+
if (textTypes.has(base)) return coreType(imports, "Text", "str");
|
|
813
|
+
if (BINARY_TYPES.has(base)) return coreType(imports, "LargeBinary", "bytes");
|
|
814
|
+
if (base === "jsonb" && database === Database.PostgreSQL) {
|
|
815
|
+
addStdlibFrom(imports, "typing", "Any");
|
|
816
|
+
return dialectType(imports, "postgresql", "JSONB", "Any");
|
|
817
|
+
}
|
|
818
|
+
if (JSON_TYPES.has(base)) {
|
|
819
|
+
addStdlibFrom(imports, "typing", "Any");
|
|
820
|
+
return coreType(imports, "JSON", "Any");
|
|
821
|
+
}
|
|
822
|
+
if (base === "uuid" && database === Database.PostgreSQL) {
|
|
823
|
+
addStdlibPlain(imports, "uuid");
|
|
824
|
+
return dialectType(imports, "postgresql", "UUID", "uuid.UUID", "(as_uuid=True)");
|
|
825
|
+
}
|
|
826
|
+
if (UUID_TYPES.has(base)) {
|
|
827
|
+
addStdlibPlain(imports, "uuid");
|
|
828
|
+
return coreType(imports, "Uuid", "uuid.UUID");
|
|
829
|
+
}
|
|
830
|
+
if (TIMESTAMP_TZ_TYPES.has(base)) return coreType(imports, "DateTime", "datetime", "(timezone=True)");
|
|
831
|
+
if (POSTGRES_TIME_TZ_TYPES.has(base)) return coreType(imports, "Time", "time", "(timezone=True)");
|
|
832
|
+
if (column.scalar === "interval" && intervalDatabases.has(database)) return coreType(imports, "Interval", "timedelta");
|
|
833
|
+
const primitiveType = getPrimitiveType(element, database);
|
|
834
|
+
const callable = convertTypeMap[primitiveType];
|
|
835
|
+
const annotation = annotationMap[primitiveType];
|
|
836
|
+
if (primitiveType === "string") return coreType(imports, callable, annotation, lengthArgument(column));
|
|
837
|
+
if (primitiveType === "decimal" && (args.length === 1 || args.length === 2)) return coreType(imports, callable, annotation, `(${args.join(", ")})`);
|
|
838
|
+
if (primitiveType === "decimal" && column.precision !== null && column.scale !== null) return coreType(imports, callable, annotation, `(${column.precision}, ${column.scale})`);
|
|
839
|
+
return coreType(imports, callable, annotation);
|
|
840
|
+
}
|
|
841
|
+
function lengthValue({ args, length }) {
|
|
842
|
+
const value = length ?? (args.length === 1 ? args[0] : null);
|
|
843
|
+
return value !== null && value > 0 ? value : null;
|
|
844
|
+
}
|
|
845
|
+
function lengthArgument(column) {
|
|
846
|
+
const value = lengthValue(column);
|
|
847
|
+
return value === null ? "" : `(${value})`;
|
|
848
|
+
}
|
|
849
|
+
function mysqlType(column, database, imports) {
|
|
850
|
+
const { base, args } = column;
|
|
851
|
+
const isMariaDB = database === Database.MariaDB;
|
|
852
|
+
const length = lengthArgument(column);
|
|
853
|
+
const fsp = args.length === 1 && args[0] > 0 ? `(fsp=${args[0]})` : "";
|
|
854
|
+
const integer = mysqlIntegerTypes.get(base);
|
|
855
|
+
const sized = mysqlSizedTypes.get(base);
|
|
856
|
+
if (column.enumMembers) return memberCall(coreType(imports, "Enum", "str"), column.enumMembers);
|
|
857
|
+
if (column.setMembers) {
|
|
858
|
+
addStdlibFrom(imports, "typing", "Set");
|
|
859
|
+
return {
|
|
860
|
+
...memberCall(dialectType(imports, "mysql", "SET", "str"), column.setMembers),
|
|
861
|
+
annotation: "Set[str]"
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
if (column.network === "ipv4") return dialectType(imports, "mysql", "INET4", "str");
|
|
865
|
+
if (column.network === "ipv6") return dialectType(imports, "mysql", "INET6", "str");
|
|
866
|
+
if (isMariaDB && base === "uuid") {
|
|
867
|
+
addStdlibPlain(imports, "uuid");
|
|
868
|
+
return coreType(imports, "UUID", "uuid.UUID");
|
|
869
|
+
}
|
|
870
|
+
if (base === "serial") return dialectType(imports, "mysql", "BIGINT", "int", "(unsigned=True)");
|
|
871
|
+
if (integer) return mysqlInteger(column, integer, imports);
|
|
872
|
+
if (base === "bit") return dialectType(imports, "mysql", "BIT", "int", length);
|
|
873
|
+
if (mysqlYearTypes.has(base)) return dialectType(imports, "mysql", "YEAR", "int");
|
|
874
|
+
if (mysqlDecimalTypes.has(base) && column.isUnsigned) return dialectType(imports, "mysql", "DECIMAL", "Decimal", `(${[...[column.precision, column.scale].filter((value) => value !== null), ...unsignedOptions(column)].join(", ")})`);
|
|
875
|
+
if (column.isFloat && column.isUnsigned) {
|
|
876
|
+
const isDouble = column.scalar === "f64";
|
|
877
|
+
const options = unsignedOptions(column);
|
|
878
|
+
return dialectType(imports, "mysql", isDouble ? "DOUBLE" : "FLOAT", "float", `(${(isDouble ? [...options, "asdecimal=False"] : options).join(", ")})`);
|
|
879
|
+
}
|
|
880
|
+
if (sized && (base !== "clob" || isMariaDB)) return dialectType(imports, "mysql", sized[0], sized[1]);
|
|
881
|
+
if (base === "text" && args.length === 1) return coreType(imports, "Text", "str", `(${args[0]})`);
|
|
882
|
+
if (base === "blob" && args.length === 1) return coreType(imports, "LargeBinary", "bytes", `(${args[0]})`);
|
|
883
|
+
if (base === "binary" || base === "char byte") return coreType(imports, "BINARY", "bytes", length);
|
|
884
|
+
if ((base === "varbinary" || isMariaDB && base === "raw") && length !== "") return coreType(imports, "VARBINARY", "bytes", length);
|
|
885
|
+
if (isMariaDB && base === "number" && column.precision === null) return coreType(imports, "Double", "float");
|
|
886
|
+
if (characterTypes.has(base)) return coreType(imports, "CHAR", "str", length);
|
|
887
|
+
if (nationalCharacterTypes.has(base)) return coreType(imports, "NCHAR", "str", length);
|
|
888
|
+
if (mysqlNationalVaryingTypes.has(base) && length !== "") return dialectType(imports, "mysql", "VARCHAR", "str", `(${lengthValue(column)}, charset="utf8mb3")`);
|
|
889
|
+
if (base === "timestamp") return dialectType(imports, "mysql", "TIMESTAMP", "datetime", fsp);
|
|
890
|
+
if (base === "datetime" && fsp !== "") return dialectType(imports, "mysql", "DATETIME", "datetime", fsp);
|
|
891
|
+
if (base === "time" && fsp !== "") return dialectType(imports, "mysql", "TIME", "time", fsp);
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
function mysqlInteger(column, [name, signed], imports) {
|
|
895
|
+
const { args, element } = column;
|
|
896
|
+
const options = unsignedOptions(column);
|
|
897
|
+
const width = args.length === 1 ? args[0] : null;
|
|
898
|
+
if (!column.isUnsigned && signed) return coreType(imports, signed, "int");
|
|
899
|
+
const values = width !== null && (ZEROFILL.test(element) || name === "TINYINT" && width === 1) ? [String(width), ...options] : options;
|
|
900
|
+
return dialectType(imports, "mysql", name, "int", values.length === 0 ? "" : `(${values.join(", ")})`);
|
|
901
|
+
}
|
|
902
|
+
function unsignedOptions({ element, isUnsigned }) {
|
|
903
|
+
if (ZEROFILL.test(element)) return ["unsigned=True", "zerofill=True"];
|
|
904
|
+
return isUnsigned ? ["unsigned=True"] : [];
|
|
905
|
+
}
|
|
906
|
+
function postgresType(column, imports) {
|
|
907
|
+
const { base, args } = column;
|
|
908
|
+
const precision = args.length === 1 ? args[0] : null;
|
|
909
|
+
const length = lengthArgument(column);
|
|
910
|
+
const named = postgresNamedTypes.get(base);
|
|
911
|
+
const range = postgresRangeTypes.get(base);
|
|
912
|
+
if (column.isTextInteger) return coreType(imports, "String", "str");
|
|
913
|
+
if (postgresSmallintTypes.has(base)) return coreType(imports, "SmallInteger", "int");
|
|
914
|
+
if (column.scalar === "f32") return coreType(imports, "REAL", "float");
|
|
915
|
+
if (characterTypes.has(base) || base === "bpchar" && length !== "") return coreType(imports, "CHAR", "str", length);
|
|
916
|
+
if (column.isBitString) {
|
|
917
|
+
const values = length === "" ? [] : [String(args[0])];
|
|
918
|
+
if (base !== "bit") values.push("varying=True");
|
|
919
|
+
return dialectType(imports, "postgresql", "BIT", "str", values.length === 0 ? "" : `(${values.join(", ")})`);
|
|
920
|
+
}
|
|
921
|
+
if (column.isMoney) return dialectType(imports, "postgresql", "MONEY", "str");
|
|
922
|
+
if (named) return dialectType(imports, "postgresql", named[0], named[1]);
|
|
923
|
+
if (range) {
|
|
924
|
+
const isMultirange = base.endsWith("multirange");
|
|
925
|
+
addDialect(imports, "postgresql", "Range");
|
|
926
|
+
if (isMultirange) addStdlibFrom(imports, "typing", "List");
|
|
927
|
+
return {
|
|
928
|
+
...dialectType(imports, "postgresql", range[0], range[1]),
|
|
929
|
+
annotation: isMultirange ? `List[Range[${range[1]}]]` : `Range[${range[1]}]`
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
if (column.scalar === "interval") return postgresInterval(base, precision, imports);
|
|
933
|
+
if (precision === null) return null;
|
|
934
|
+
if (postgresTimeTypes.has(base) || POSTGRES_TIME_TZ_TYPES.has(base)) return dialectType(imports, "postgresql", "TIME", "time", timePrecision(postgresTimeTypes.has(base), precision));
|
|
935
|
+
if (postgresTimestampTypes.has(base) || TIMESTAMP_TZ_TYPES.has(base)) return dialectType(imports, "postgresql", "TIMESTAMP", "datetime", timePrecision(postgresTimestampTypes.has(base), precision));
|
|
936
|
+
return null;
|
|
937
|
+
}
|
|
938
|
+
function timePrecision(isNaive, precision) {
|
|
939
|
+
return isNaive ? `(precision=${precision})` : `(timezone=True, precision=${precision})`;
|
|
940
|
+
}
|
|
941
|
+
function postgresInterval(base, precision, imports) {
|
|
942
|
+
const fields = base.slice(8).trim();
|
|
943
|
+
const values = [];
|
|
944
|
+
if (fields !== "") values.push(`fields="${fields}"`);
|
|
945
|
+
if (precision !== null) values.push(`precision=${precision}`);
|
|
946
|
+
if (values.length === 0) return coreType(imports, "Interval", "timedelta");
|
|
947
|
+
return dialectType(imports, "postgresql", "INTERVAL", "timedelta", `(${values.join(", ")})`);
|
|
948
|
+
}
|
|
949
|
+
function mssqlType(column, imports) {
|
|
950
|
+
const { base } = column;
|
|
951
|
+
const length = lengthArgument(column);
|
|
952
|
+
if (column.isRowVersion) return dialectType(imports, "mssql", "TIMESTAMP", "bytes");
|
|
953
|
+
if (mssqlBinaryReadTypes.has(base)) return coreType(imports, "String", "bytes");
|
|
954
|
+
if (base === "money") return dialectType(imports, "mssql", "MONEY", "Decimal");
|
|
955
|
+
if (base === "smallmoney") return dialectType(imports, "mssql", "SMALLMONEY", "Decimal");
|
|
956
|
+
if (mssqlNationalVaryingTypes.has(base)) return coreType(imports, "NVARCHAR", "str", length);
|
|
957
|
+
if (characterTypes.has(base)) return coreType(imports, "CHAR", "str", length);
|
|
958
|
+
if (nationalCharacterTypes.has(base)) return coreType(imports, "NCHAR", "str", length);
|
|
959
|
+
if (base === "ntext" || base === "national text") return dialectType(imports, "mssql", "NTEXT", "str");
|
|
960
|
+
if (base === "binary") return coreType(imports, "BINARY", "bytes", length);
|
|
961
|
+
if ((base === "varbinary" || base === "binary varying") && length !== "") return coreType(imports, "VARBINARY", "bytes", length);
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
function oracleType(column, imports) {
|
|
965
|
+
const { base, element } = column;
|
|
966
|
+
const length = lengthArgument(column);
|
|
967
|
+
if (oracleObjectTypes.has(base)) {
|
|
968
|
+
addStdlibFrom(imports, "typing", "Any");
|
|
969
|
+
return {
|
|
970
|
+
...portableType(column, Database.Oracle, imports),
|
|
971
|
+
annotation: "Any"
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
if (base === "date") return dialectType(imports, "oracle", "DATE", "datetime");
|
|
975
|
+
if (base === "timestamp") return dialectType(imports, "oracle", "TIMESTAMP", "datetime");
|
|
976
|
+
if (base === "timestamp with time zone") return dialectType(imports, "oracle", "TIMESTAMP", "datetime", "(timezone=True)");
|
|
977
|
+
if (base === "timestamp with local time zone") return dialectType(imports, "oracle", "TIMESTAMP", "datetime", "(local_timezone=True)");
|
|
978
|
+
if (oracleNationalVaryingTypes.has(base) && length !== "") return dialectType(imports, "oracle", "NVARCHAR2", "str", length);
|
|
979
|
+
if (characterTypes.has(base)) return coreType(imports, "CHAR", "str", length);
|
|
980
|
+
if (nationalCharacterTypes.has(base)) return coreType(imports, "NCHAR", "str", length);
|
|
981
|
+
if (base === "nclob") return dialectType(imports, "oracle", "NCLOB", "str");
|
|
982
|
+
if (base === "raw" && length !== "") return dialectType(imports, "oracle", "RAW", "bytes", length);
|
|
983
|
+
const daySecond = ORACLE_DAY_TO_SECOND.exec(element);
|
|
984
|
+
if (daySecond) {
|
|
985
|
+
const [, day, second] = daySecond;
|
|
986
|
+
const values = [day === void 0 ? null : `day_precision=${day}`, second === void 0 ? null : `second_precision=${second}`].filter((value) => value !== null);
|
|
987
|
+
return coreType(imports, "Interval", "timedelta", values.length === 0 ? "" : `(${values.join(", ")})`);
|
|
988
|
+
}
|
|
989
|
+
return null;
|
|
990
|
+
}
|
|
991
|
+
function coreType(imports, name, annotation, args = "") {
|
|
992
|
+
addSqlalchemy(imports, name);
|
|
993
|
+
addAnnotationImport(imports, annotation);
|
|
994
|
+
return {
|
|
995
|
+
expression: `${name}${args}`,
|
|
996
|
+
annotation,
|
|
997
|
+
isNumeric: NUMERIC_NAMES.has(name),
|
|
998
|
+
isInteger: INTEGER_NAMES.has(name)
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
function dialectType(imports, dialect, name, annotation, args = "") {
|
|
1002
|
+
addDialect(imports, dialect, name);
|
|
1003
|
+
addAnnotationImport(imports, annotation);
|
|
1004
|
+
return {
|
|
1005
|
+
expression: `${name}${args}`,
|
|
1006
|
+
annotation,
|
|
1007
|
+
isNumeric: NUMERIC_NAMES.has(name),
|
|
1008
|
+
isInteger: INTEGER_NAMES.has(name)
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
function addAnnotationImport(imports, annotation) {
|
|
1012
|
+
switch (annotation) {
|
|
1013
|
+
case "Decimal":
|
|
1014
|
+
addStdlibFrom(imports, "decimal", "Decimal");
|
|
1015
|
+
break;
|
|
1016
|
+
case "date":
|
|
1017
|
+
case "datetime":
|
|
1018
|
+
case "time":
|
|
1019
|
+
case "timedelta": addStdlibFrom(imports, "datetime", annotation);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
var PYTHON_ESCAPES = /* @__PURE__ */ new Map([
|
|
1023
|
+
["\\", "\\\\"],
|
|
1024
|
+
["\n", "\\n"],
|
|
1025
|
+
["\r", "\\r"],
|
|
1026
|
+
[" ", "\\t"]
|
|
1027
|
+
]);
|
|
1028
|
+
function memberCall(type, members) {
|
|
1029
|
+
const call = {
|
|
1030
|
+
head: `${type.expression}(`,
|
|
1031
|
+
args: members.map(pythonString)
|
|
1032
|
+
};
|
|
1033
|
+
return {
|
|
1034
|
+
...type,
|
|
1035
|
+
expression: callText(call),
|
|
1036
|
+
call
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function pythonString(value) {
|
|
1040
|
+
const chars = Array.from(value);
|
|
1041
|
+
const quote = chars.filter((char) => char === "\"").length > chars.filter((char) => char === "'").length ? "'" : "\"";
|
|
1042
|
+
return `${quote}${escapeChars(chars, quote)}${quote}`;
|
|
1043
|
+
}
|
|
1044
|
+
function escapeChars(chars, quote) {
|
|
1045
|
+
return chars.map((char) => {
|
|
1046
|
+
if (char === quote) return `\\${char}`;
|
|
1047
|
+
const escaped = PYTHON_ESCAPES.get(char);
|
|
1048
|
+
if (escaped !== void 0) return escaped;
|
|
1049
|
+
const code = char.charCodeAt(0);
|
|
1050
|
+
return code < 32 || code === 127 ? `\\x${code.toString(16).padStart(2, "0")}` : char;
|
|
1051
|
+
}).join("");
|
|
1052
|
+
}
|
|
1053
|
+
function createClassContext(state) {
|
|
1054
|
+
const relationships = resolveRelationships(state);
|
|
1055
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1056
|
+
const ambiguous = /* @__PURE__ */ new Set();
|
|
1057
|
+
relationships.forEach(({ relationship }) => {
|
|
1058
|
+
const key = pairKey(relationship);
|
|
1059
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
1060
|
+
});
|
|
1061
|
+
counts.forEach((count, key) => {
|
|
1062
|
+
if (count > 1) ambiguous.add(key);
|
|
1063
|
+
});
|
|
1064
|
+
const context = {
|
|
1065
|
+
imports: createImportSet(),
|
|
1066
|
+
indexNames: [],
|
|
1067
|
+
relationships,
|
|
1068
|
+
namings: /* @__PURE__ */ new Map(),
|
|
1069
|
+
classNames: new Set(MODULE_SCOPE_NAMES),
|
|
1070
|
+
ambiguous
|
|
1071
|
+
};
|
|
1072
|
+
query(state.collections).collection("tableEntities").selectByIds(state.doc.tableIds).sort(orderByNameASC).forEach((table) => getNaming(state, context, table));
|
|
1073
|
+
return context;
|
|
1074
|
+
}
|
|
1075
|
+
function resolveRelationships(state) {
|
|
1076
|
+
const { doc: { relationshipIds }, collections } = state;
|
|
1077
|
+
const tableCollection = query(collections).collection("tableEntities");
|
|
1078
|
+
const columnCollection = query(collections).collection("tableColumnEntities");
|
|
1079
|
+
return query(collections).collection("relationshipEntities").selectByIds(relationshipIds).map((relationship) => {
|
|
1080
|
+
const startTable = tableCollection.selectById(relationship.start.tableId);
|
|
1081
|
+
const endTable = tableCollection.selectById(relationship.end.tableId);
|
|
1082
|
+
const startColumns = columnCollection.selectByIds(relationship.start.columnIds);
|
|
1083
|
+
const endColumns = columnCollection.selectByIds(relationship.end.columnIds);
|
|
1084
|
+
return !startTable || !endTable || endColumns.length === 0 || startColumns.length !== relationship.start.columnIds.length || endColumns.length !== relationship.end.columnIds.length || startColumns.length !== endColumns.length || !startColumns.every((column) => startTable.columnIds.includes(column.id)) || !endColumns.every((column) => endTable.columnIds.includes(column.id)) ? null : {
|
|
1085
|
+
relationship,
|
|
1086
|
+
startTable,
|
|
1087
|
+
endTable,
|
|
1088
|
+
startColumns,
|
|
1089
|
+
endColumns
|
|
1090
|
+
};
|
|
1091
|
+
}).filter((resolved) => resolved !== null);
|
|
1092
|
+
}
|
|
1093
|
+
function getNaming(state, context, table) {
|
|
1094
|
+
const cached = context.namings.get(table.id);
|
|
1095
|
+
if (cached) return cached;
|
|
1096
|
+
const naming = createTableNaming(state, table, context);
|
|
1097
|
+
context.namings.set(table.id, naming);
|
|
1098
|
+
return naming;
|
|
1099
|
+
}
|
|
1100
|
+
function createTableNaming(state, table, { relationships, classNames }) {
|
|
1101
|
+
const { settings: { tableNameCase, columnNameCase }, collections } = state;
|
|
1102
|
+
const used = new Set(MODULE_SCOPE_NAMES);
|
|
1103
|
+
const declared = [];
|
|
1104
|
+
const columnRefs = /* @__PURE__ */ new Map();
|
|
1105
|
+
const columnNames = /* @__PURE__ */ new Map();
|
|
1106
|
+
const columnKeys = /* @__PURE__ */ new Map();
|
|
1107
|
+
const relationshipNames = /* @__PURE__ */ new Map();
|
|
1108
|
+
const columns = query(collections).collection("tableColumnEntities").selectByIds(table.columnIds);
|
|
1109
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
1110
|
+
columns.forEach((column) => {
|
|
1111
|
+
const carrier = carriers.get(column.name);
|
|
1112
|
+
if (carrier !== void 0) {
|
|
1113
|
+
columnRefs.set(column.id, carrier);
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
carriers.set(column.name, column.id);
|
|
1117
|
+
columnRefs.set(column.id, column.id);
|
|
1118
|
+
declared.push(column);
|
|
1119
|
+
columnNames.set(column.id, uniqueName(used, pyIdentifier(getNameCase(column.name, columnNameCase))));
|
|
1120
|
+
});
|
|
1121
|
+
assignColumnKeys(declared, columnNames, columnKeys);
|
|
1122
|
+
columns.forEach((column) => {
|
|
1123
|
+
const carrier = columnRefs.get(column.id);
|
|
1124
|
+
if (carrier === void 0 || carrier === column.id) return;
|
|
1125
|
+
const name = columnNames.get(carrier);
|
|
1126
|
+
const key = columnKeys.get(carrier);
|
|
1127
|
+
if (name !== void 0) columnNames.set(column.id, name);
|
|
1128
|
+
if (key !== void 0) columnKeys.set(column.id, key);
|
|
1129
|
+
});
|
|
1130
|
+
relationships.filter(({ relationship }) => relationship.end.tableId === table.id).forEach(({ relationship, startTable }) => {
|
|
1131
|
+
if (!hasOneRelationship(relationship.relationshipType) && !hasNRelationship(relationship.relationshipType)) return;
|
|
1132
|
+
const name = isSelfReferential(relationship) ? `parent_${startTable.name}` : startTable.name;
|
|
1133
|
+
relationshipNames.set(relationshipKey(relationship, OWNING), uniqueName(used, pyIdentifier(getNameCase(name, columnNameCase))));
|
|
1134
|
+
});
|
|
1135
|
+
relationships.filter(({ relationship }) => relationship.start.tableId === table.id).forEach(({ relationship, endTable }) => {
|
|
1136
|
+
const name = hasNRelationship(relationship.relationshipType) ? getNameCase(`${endTable.name}List`, columnNameCase) : hasOneRelationship(relationship.relationshipType) ? getNameCase(endTable.name, columnNameCase) : null;
|
|
1137
|
+
if (name === null) return;
|
|
1138
|
+
relationshipNames.set(relationshipKey(relationship, INVERSE), uniqueName(used, pyIdentifier(name)));
|
|
1139
|
+
});
|
|
1140
|
+
return {
|
|
1141
|
+
className: uniqueName(classNames, pyIdentifier(getNameCase(table.name, tableNameCase))),
|
|
1142
|
+
columnIds: declared.map((column) => column.id),
|
|
1143
|
+
columnRefs,
|
|
1144
|
+
columnNames,
|
|
1145
|
+
columnKeys,
|
|
1146
|
+
relationshipNames
|
|
1147
|
+
};
|
|
1148
|
+
}
|
|
1149
|
+
var DOT = ".";
|
|
1150
|
+
function assignColumnKeys(declared, columnNames, columnKeys) {
|
|
1151
|
+
const used = /* @__PURE__ */ new Set();
|
|
1152
|
+
declared.forEach((column) => {
|
|
1153
|
+
if (!column.name.includes(DOT)) {
|
|
1154
|
+
used.add(column.name);
|
|
1155
|
+
columnKeys.set(column.id, column.name);
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
declared.forEach((column) => {
|
|
1159
|
+
if (column.name.includes(DOT)) columnKeys.set(column.id, uniqueName(used, columnNames.get(column.id) ?? column.name));
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
function columnKey(naming, column) {
|
|
1163
|
+
return naming.columnKeys.get(column.id) ?? column.name;
|
|
1164
|
+
}
|
|
1165
|
+
function columnRef(naming, column) {
|
|
1166
|
+
return naming.columnRefs.get(column.id) ?? column.id;
|
|
1167
|
+
}
|
|
1168
|
+
function carriedColumns(state, naming, columns) {
|
|
1169
|
+
const collection = query(state.collections).collection("tableColumnEntities");
|
|
1170
|
+
return columns.map((column) => collection.selectById(columnRef(naming, column)) ?? column);
|
|
1171
|
+
}
|
|
1172
|
+
function relationshipKey(relationship, side) {
|
|
1173
|
+
return `${relationship.id}:${side}`;
|
|
1174
|
+
}
|
|
1175
|
+
function isSelfReferential(relationship) {
|
|
1176
|
+
return relationship.start.tableId === relationship.end.tableId;
|
|
1177
|
+
}
|
|
1178
|
+
function pairKey(relationship) {
|
|
1179
|
+
const [first, second] = [relationship.start.tableId, relationship.end.tableId].sort();
|
|
1180
|
+
return `${first}<->${second}`;
|
|
1181
|
+
}
|
|
1182
|
+
function uniqueName(used, name) {
|
|
1183
|
+
let result = name;
|
|
1184
|
+
let index = 2;
|
|
1185
|
+
while (used.has(result)) {
|
|
1186
|
+
result = `${name}_${index}`;
|
|
1187
|
+
index += 1;
|
|
1188
|
+
}
|
|
1189
|
+
used.add(result);
|
|
1190
|
+
return result;
|
|
1191
|
+
}
|
|
1192
|
+
var NON_IDENTIFIER = /[^0-9A-Za-z_]/g;
|
|
1193
|
+
var IDENTIFIER_START = /^[A-Za-z]/;
|
|
1194
|
+
var RESERVED = /* @__PURE__ */ new Set([
|
|
1195
|
+
"False",
|
|
1196
|
+
"None",
|
|
1197
|
+
"True",
|
|
1198
|
+
"and",
|
|
1199
|
+
"as",
|
|
1200
|
+
"assert",
|
|
1201
|
+
"async",
|
|
1202
|
+
"await",
|
|
1203
|
+
"break",
|
|
1204
|
+
"class",
|
|
1205
|
+
"continue",
|
|
1206
|
+
"def",
|
|
1207
|
+
"del",
|
|
1208
|
+
"elif",
|
|
1209
|
+
"else",
|
|
1210
|
+
"except",
|
|
1211
|
+
"finally",
|
|
1212
|
+
"for",
|
|
1213
|
+
"from",
|
|
1214
|
+
"global",
|
|
1215
|
+
"if",
|
|
1216
|
+
"import",
|
|
1217
|
+
"in",
|
|
1218
|
+
"is",
|
|
1219
|
+
"lambda",
|
|
1220
|
+
"metadata",
|
|
1221
|
+
"nonlocal",
|
|
1222
|
+
"not",
|
|
1223
|
+
"or",
|
|
1224
|
+
"pass",
|
|
1225
|
+
"raise",
|
|
1226
|
+
"return",
|
|
1227
|
+
"self",
|
|
1228
|
+
"try",
|
|
1229
|
+
"while",
|
|
1230
|
+
"with",
|
|
1231
|
+
"yield"
|
|
1232
|
+
]);
|
|
1233
|
+
var SAFE_PREFIX = "x";
|
|
1234
|
+
function pyIdentifier(name) {
|
|
1235
|
+
const value = name.replace(NON_IDENTIFIER, "_");
|
|
1236
|
+
const identifier = IDENTIFIER_START.test(value) ? value : `${SAFE_PREFIX}${value}`;
|
|
1237
|
+
return RESERVED.has(identifier) ? `${identifier}_` : identifier;
|
|
1238
|
+
}
|
|
1239
|
+
var NEWLINE = /\r\n|\r|\n/g;
|
|
1240
|
+
var PYTHON_SPACE = /^[ \x85\xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+|[ \x85\xa0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+$/g;
|
|
1241
|
+
function formatDocstring(comment) {
|
|
1242
|
+
const value = escapeChars(Array.from(comment.replace(NEWLINE, " ")), "\"").replace(PYTHON_SPACE, "");
|
|
1243
|
+
if (value === "") return " ";
|
|
1244
|
+
return value.endsWith("\"") ? `${value} ` : value;
|
|
1245
|
+
}
|
|
1246
|
+
function formatStringList(names) {
|
|
1247
|
+
return `[${names.map(pythonString).join(", ")}]`;
|
|
1248
|
+
}
|
|
1249
|
+
//#endregion
|
|
1250
|
+
export { createCode, formatTable };
|