@dineug/erd-editor 3.10.0 → 4.1.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 +140 -158
- package/dist/components/appContext.d.ts +4 -0
- package/dist/components/erd/Erd.d.ts +3 -0
- package/dist/components/erd/automatic-table-placement/AutomaticTablePlacement.d.ts +2 -1
- package/dist/components/erd/automatic-table-placement/createAutomaticTablePlacement.d.ts +38 -2
- package/dist/components/erd/automatic-table-placement/elkPlacement.d.ts +42 -0
- package/dist/components/erd/automatic-table-placement/flowPlacement.d.ts +21 -0
- package/dist/components/erd/automatic-table-placement/placementActions.d.ts +14 -0
- package/dist/components/erd/automatic-table-placement/runElkPlacement.d.ts +0 -11
- package/dist/components/erd/canvas/DiffOutline.template.d.ts +14 -0
- package/dist/components/erd/canvas/SceneIcon.template.d.ts +2 -2
- package/dist/components/erd/canvas/entityDrag.d.ts +17 -1
- package/dist/components/erd/canvas/middleButtonPan.d.ts +11 -0
- package/dist/components/erd/canvas/sceneTokens.d.ts +40 -0
- package/dist/components/erd/canvas/table/Table.d.ts +9 -1
- package/dist/components/erd/canvas/table/doubleClick.d.ts +3 -4
- package/dist/components/erd/canvas/table-group/TableGroup.d.ts +17 -0
- package/dist/components/erd/canvas/table-group/TableGroupBody.d.ts +17 -0
- package/dist/components/erd/canvas/table-group/TableGroupDropTarget.d.ts +10 -0
- package/dist/components/erd/canvas/table-group/TableGroupSash.d.ts +35 -0
- package/dist/components/erd/canvas/table-group/TableGroups.d.ts +10 -0
- package/dist/components/erd/canvas/table-group/tableGroupBox.d.ts +40 -0
- package/dist/components/erd/canvas/table-group/titleLayout.d.ts +45 -0
- package/dist/components/erd/canvas/useMoveEntity.d.ts +2 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.d.ts +19 -0
- package/dist/components/erd/diff-viewer/diff-tree/DiffTree.styles.d.ts +12 -0
- package/dist/components/erd/diff-viewer/diff-tree/diffTreeModel.d.ts +49 -0
- package/dist/components/erd/diff-viewer/diff.d.ts +21 -19
- package/dist/components/erd/draw-target/DrawTargetButtons.d.ts +16 -0
- package/dist/components/erd/draw-target/DrawTargetButtons.styles.d.ts +14 -0
- package/dist/components/erd/draw-target/drawTargetState.d.ts +26 -0
- package/dist/components/erd/draw-target/findDrawTarget.d.ts +29 -0
- package/dist/components/erd/draw-target/placePill.d.ts +47 -0
- package/dist/components/erd/erd-context-menu/ErdContextMenu.d.ts +6 -0
- package/dist/components/erd/erd-context-menu/menus/drawRelationshipMenus.d.ts +3 -0
- package/dist/components/erd/erd-context-menu/menus/exportMenus.d.ts +7 -2
- package/dist/components/erd/erd-context-menu/menus/importMenus.d.ts +5 -1
- package/dist/components/erd/erd-context-menu/menus/relationshipMenus.d.ts +6 -2
- package/dist/components/erd/erd-context-menu/menus/showMenus.d.ts +3 -1
- package/dist/components/erd/erd-context-menu/menus/tablePlacementMenus.d.ts +3 -0
- package/dist/components/erd/floating-toolbar/FloatingToolbar.d.ts +7 -4
- package/dist/components/erd/floating-toolbar/ToolbarCompass.template.d.ts +3 -1
- package/dist/components/erd/goToErdTarget.d.ts +40 -16
- package/dist/components/erd/hitTest.d.ts +16 -1
- package/dist/components/erd/minimap/MinimapScene.d.ts +1 -1
- package/dist/components/erd/minimap/table/Table.d.ts +3 -3
- package/dist/components/erd/minimap/table-group/TableGroup.d.ts +17 -0
- package/dist/components/erd/relationshipHighlight.d.ts +18 -0
- package/dist/components/erd/table-group/TableGroupDraft.d.ts +15 -0
- package/dist/components/erd/table-group/TableGroupDraft.styles.d.ts +6 -0
- package/dist/components/erd/table-group/tableGroupName.d.ts +21 -0
- package/dist/components/erd/table-group/useTableGroupDraw.d.ts +25 -0
- package/dist/components/erd/table-properties/TableProperties.styles.d.ts +2 -2
- package/dist/components/erd/table-properties/table-properties-indexes/indexes-key/IndexesKey.d.ts +6 -0
- package/dist/components/erd/table-properties/table-properties-tabs/TablePropertiesTabs.d.ts +3 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.d.ts +17 -0
- package/dist/components/erd/welcome-screen/WelcomeScreen.styles.d.ts +17 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.d.ts +21 -0
- package/dist/components/erd/welcome-screen/welcome-hints/WelcomeHints.styles.d.ts +19 -0
- package/dist/components/erd/welcome-screen/welcome-hints/hintArrows.d.ts +10 -0
- package/dist/components/erd/welcome-screen/welcomeLayout.d.ts +91 -0
- package/dist/components/erd-editor/ErdEditor.d.ts +66 -6
- package/dist/components/erd-editor/ErdEditor.styles.d.ts +4 -0
- package/dist/components/erd-editor/useErdEditorAttachElement.d.ts +14 -1
- package/dist/components/erd-editor/viewportLayout.d.ts +52 -0
- package/dist/components/explorer/Explorer.d.ts +12 -0
- package/dist/components/explorer/explorer-controller/ExplorerController.d.ts +11 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.d.ts +14 -0
- package/dist/components/explorer/explorer-panel/ExplorerPanel.styles.d.ts +13 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.d.ts +12 -0
- package/dist/components/explorer/explorer-search/ExplorerSearch.styles.d.ts +13 -0
- package/dist/components/explorer/explorerCommands.d.ts +28 -0
- package/dist/components/explorer/explorerNavigation.d.ts +14 -0
- package/dist/components/explorer/explorerSearch.d.ts +71 -0
- package/dist/components/explorer/explorerTree.d.ts +90 -0
- package/dist/components/explorer/explorerView.d.ts +54 -0
- package/dist/components/{find-replace → explorer}/matchTarget.d.ts +5 -7
- package/dist/components/export-image/ExportImage.d.ts +23 -0
- package/dist/components/export-image/ExportImage.styles.d.ts +34 -0
- package/dist/components/export-image/exportImageActions.d.ts +48 -0
- package/dist/components/generator-code/GeneratorCode.d.ts +1 -0
- package/dist/components/generator-code/generator-code-context-menu/GeneratorCodeContextMenu.d.ts +3 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/columnNameCaseMenus.d.ts +3 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/languageMenus.d.ts +8 -0
- package/dist/components/generator-code/generator-code-context-menu/menus/tableNameCaseMenus.d.ts +3 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.d.ts +17 -0
- package/dist/components/generator-code/generator-code-options/GeneratorCodeOptions.styles.d.ts +5 -0
- package/dist/components/generator-code/generatorCodeView.d.ts +12 -0
- package/dist/components/generator-code/languageSettings.d.ts +14 -0
- package/dist/components/locale-picker/LocalePicker.d.ts +13 -0
- package/dist/components/locale-picker/LocalePicker.styles.d.ts +19 -0
- package/dist/components/localeContext.d.ts +10 -0
- package/dist/components/localized/Localized.d.ts +18 -0
- package/dist/components/map-columns/MapColumnsBody.d.ts +24 -0
- package/dist/components/map-columns/MapColumnsDialog.d.ts +13 -0
- package/dist/components/map-columns/MapColumnsDialog.styles.d.ts +38 -0
- package/dist/components/map-columns/mapColumnsAction.d.ts +13 -0
- package/dist/components/map-columns/nameOf.d.ts +6 -0
- package/dist/components/map-columns/openMapColumns.d.ts +9 -0
- package/dist/components/primitives/code-block/CodeBlock.d.ts +6 -1
- package/dist/components/primitives/code-block/CodeBlock.styles.d.ts +2 -0
- package/dist/components/primitives/color-picker/ColorPicker.d.ts +10 -1
- package/dist/components/primitives/color-picker/ColorPicker.styles.d.ts +25 -0
- package/dist/components/primitives/color-picker/colorModel.d.ts +36 -0
- package/dist/components/primitives/color-picker/presetColors.d.ts +13 -0
- package/dist/components/primitives/color-picker/resolveColor.d.ts +7 -0
- package/dist/components/primitives/context-menu/ContextMenu.d.ts +2 -0
- package/dist/components/primitives/context-menu/context-menu-content/ContextMenuContent.d.ts +1 -0
- package/dist/components/primitives/context-menu/context-menu-content/fitMenu.d.ts +4 -4
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.d.ts +8 -0
- package/dist/components/primitives/context-menu/context-menu-separator/ContextMenuSeparator.styles.d.ts +2 -0
- package/dist/components/primitives/context-menu/menu/Menu.d.ts +2 -0
- package/dist/components/primitives/context-menu/submenu-chevron/SubmenuChevron.d.ts +5 -0
- package/dist/components/primitives/dialog/Dialog.d.ts +21 -0
- package/dist/components/primitives/dialog/Dialog.styles.d.ts +12 -0
- package/dist/components/primitives/highlighted-text/HighlightedText.d.ts +2 -5
- package/dist/components/primitives/icon/icons.d.ts +24 -3
- package/dist/components/primitives/sash/Sash.d.ts +1 -0
- package/dist/components/primitives/select/Select.d.ts +18 -0
- package/dist/components/primitives/select/Select.styles.d.ts +13 -0
- package/dist/components/primitives/text-input/TextInput.d.ts +2 -0
- package/dist/components/primitives/toast/Toast.d.ts +5 -1
- package/dist/components/primitives/toast/Toast.styles.d.ts +2 -2
- package/dist/components/primitives/tree/Tree.d.ts +30 -0
- package/dist/components/primitives/tree/Tree.styles.d.ts +5 -0
- package/dist/components/primitives/tree/treeModel.d.ts +42 -0
- package/dist/components/quick-search/QuickSearch.d.ts +2 -1
- package/dist/components/quick-search/QuickSearch.styles.d.ts +1 -0
- package/dist/components/quick-search/actions.d.ts +39 -7
- package/dist/components/quick-search/hangul.d.ts +16 -10
- package/dist/components/quick-search/paletteList.d.ts +7 -0
- package/dist/components/quick-search/paletteQuery.d.ts +5 -4
- package/dist/components/quick-search/scopedActions.d.ts +10 -15
- package/dist/components/schema-sql/SchemaSQL.d.ts +2 -0
- package/dist/components/schema-sql/SchemaSQL.styles.d.ts +7 -0
- package/dist/components/schema-sql/schema-sql-context-menu/SchemaSQLContextMenu.d.ts +3 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/bracketMenus.d.ts +3 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/headerMenus.d.ts +29 -0
- package/dist/components/schema-sql/schema-sql-context-menu/menus/statementsMenus.d.ts +27 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.d.ts +24 -0
- package/dist/components/schema-sql/schema-sql-options/SchemaSQLOptions.styles.d.ts +45 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.d.ts +20 -0
- package/dist/components/schema-sql/schema-sql-options/ScriptEditor.styles.d.ts +13 -0
- package/dist/components/schema-sql/schema-sql-options/dropWarning.d.ts +8 -0
- package/dist/components/schema-sql/schemaSQLView.d.ts +71 -0
- package/dist/components/settings/Settings.styles.d.ts +7 -0
- package/dist/components/settings/columnTypeLabels.d.ts +8 -0
- package/dist/components/settings/lockSettingRows.d.ts +16 -0
- package/dist/components/settings/settings-lnb/SettingsLnb.d.ts +3 -0
- package/dist/components/settings/settingsPage.d.ts +10 -0
- package/dist/components/theme-builder/ThemeBuilder.d.ts +9 -1
- package/dist/components/theme-builder/ThemeBuilder.styles.d.ts +7 -4
- package/dist/components/toast-container/openStatusToast.d.ts +29 -0
- package/dist/components/toast-container/openToastWhileRunning.d.ts +1 -1
- package/dist/components/toolbar/Toolbar.d.ts +1 -0
- package/dist/components/toolbar/Toolbar.styles.d.ts +0 -1
- package/dist/components/visualization/graph-node/GraphNode.d.ts +2 -2
- package/dist/components/visualization/graphPan.d.ts +12 -0
- package/dist/components/visualization/visualizationView.d.ts +2 -2
- package/dist/constants/language.d.ts +1 -1
- package/dist/constants/layout.d.ts +41 -1
- package/dist/constants/open.d.ts +3 -1
- package/dist/constants/schema.d.ts +25 -4
- package/dist/constants/sql/dataType/PostgreSQL.d.ts +2 -1
- package/dist/constants/sql/dataType/SQLite.d.ts +3 -1
- package/dist/engine/actions.d.ts +20 -2
- package/dist/engine/context.d.ts +6 -0
- package/dist/engine/index.js +26 -21
- package/dist/engine/modules/editor/actions.d.ts +10 -2
- package/dist/engine/modules/editor/atom.actions.d.ts +49 -11
- package/dist/engine/modules/editor/generator.actions.d.ts +107 -8
- package/dist/engine/modules/editor/state.d.ts +16 -3
- package/dist/engine/modules/editor/utils/color.d.ts +21 -0
- package/dist/engine/modules/editor/utils/duplicate.d.ts +28 -1
- package/dist/engine/modules/editor/utils/focus.d.ts +16 -0
- package/dist/engine/modules/editor/utils/releaseHidden.d.ts +16 -0
- package/dist/engine/modules/editor/utils/selection.d.ts +12 -0
- package/dist/engine/modules/relationship/actions.d.ts +6 -0
- package/dist/engine/modules/relationship/atom.actions.d.ts +57 -1
- package/dist/engine/modules/relationship/endFlags.d.ts +14 -0
- package/dist/engine/modules/relationship/fkColumns.d.ts +25 -6
- package/dist/engine/modules/relationship/history.d.ts +1 -0
- package/dist/engine/modules/relationship/hooks.d.ts +0 -11
- package/dist/engine/modules/relationship/referenceType.d.ts +12 -0
- package/dist/engine/modules/settings/actions.d.ts +17 -4
- package/dist/engine/modules/settings/atom.actions.d.ts +63 -19
- package/dist/engine/modules/settings/generator.actions.d.ts +7 -0
- package/dist/engine/modules/settings/history.d.ts +1 -0
- package/dist/engine/modules/table/actions.d.ts +8 -0
- package/dist/engine/modules/table/atom.actions.d.ts +31 -0
- package/dist/engine/modules/table/generator.actions.d.ts +3 -3
- package/dist/engine/modules/table/history.d.ts +1 -0
- package/dist/engine/modules/table-column/generator.actions.d.ts +8 -0
- package/dist/engine/modules/table-column/hooks.d.ts +0 -6
- package/dist/engine/modules/table-column/keys.d.ts +14 -0
- package/dist/engine/modules/table-column/utils/dataType.d.ts +19 -1
- package/dist/engine/modules/table-group/actions.d.ts +63 -0
- package/dist/engine/modules/table-group/atom.actions.d.ts +238 -0
- package/dist/engine/modules/table-group/generator.actions.d.ts +111 -0
- package/dist/engine/modules/table-group/history.d.ts +13 -0
- package/dist/engine/peer-store.d.ts +9 -3
- package/dist/engine/replication-store.d.ts +6 -3
- package/dist/engine/rx-operators/groupByStreamActions.d.ts +5 -1
- package/dist/engine/rx-operators/lockIgnoreFilter.d.ts +8 -0
- package/dist/engine/rx-store.d.ts +2 -0
- package/dist/engine/settle.d.ts +9 -0
- package/dist/engine/store-hooks.d.ts +0 -8
- package/dist/erd-editor.umd.js +2350 -4222
- package/dist/hooks/useNavigatorLanguages.d.ts +7 -0
- package/dist/i18n/locales.d.ts +126 -0
- package/dist/i18n/menuLabel.d.ts +12 -0
- package/dist/i18n/messages/ar-SA.d.ts +425 -0
- package/dist/i18n/messages/de-DE.d.ts +405 -0
- package/dist/i18n/messages/en/code.d.ts +16 -0
- package/dist/i18n/messages/en/colorPicker.d.ts +35 -0
- package/dist/i18n/messages/en/common.d.ts +64 -0
- package/dist/i18n/messages/en/contextMenu.d.ts +29 -0
- package/dist/i18n/messages/en/explorer.d.ts +37 -0
- package/dist/i18n/messages/en/exportImage.d.ts +25 -0
- package/dist/i18n/messages/en/feedback.d.ts +11 -0
- package/dist/i18n/messages/en/findReplace.d.ts +40 -0
- package/dist/i18n/messages/en/floatingToolbar.d.ts +12 -0
- package/dist/i18n/messages/en/index.d.ts +408 -0
- package/dist/i18n/messages/en/mapColumns.d.ts +39 -0
- package/dist/i18n/messages/en/palette.d.ts +34 -0
- package/dist/i18n/messages/en/schemaSql.d.ts +28 -0
- package/dist/i18n/messages/en/settings.d.ts +22 -0
- package/dist/i18n/messages/en/shortcuts.d.ts +34 -0
- package/dist/i18n/messages/en/tableProperties.d.ts +34 -0
- package/dist/i18n/messages/en/themeBuilder.d.ts +7 -0
- package/dist/i18n/messages/en/toolbar.d.ts +8 -0
- package/dist/i18n/messages/en/visualization.d.ts +12 -0
- package/dist/i18n/messages/en/welcome.d.ts +13 -0
- package/dist/i18n/messages/es-ES.d.ts +410 -0
- package/dist/i18n/messages/eu-ES.d.ts +405 -0
- package/dist/i18n/messages/fa-IR.d.ts +405 -0
- package/dist/i18n/messages/fr-FR.d.ts +410 -0
- package/dist/i18n/messages/he-IL.d.ts +410 -0
- package/dist/i18n/messages/id-ID.d.ts +400 -0
- package/dist/i18n/messages/index.d.ts +11 -0
- package/dist/i18n/messages/it-IT.d.ts +410 -0
- package/dist/i18n/messages/ja-JP.d.ts +400 -0
- package/dist/i18n/messages/ko-KR.d.ts +400 -0
- package/dist/i18n/messages/nl-NL.d.ts +405 -0
- package/dist/i18n/messages/pl-PL.d.ts +415 -0
- package/dist/i18n/messages/pt-BR.d.ts +410 -0
- package/dist/i18n/messages/pt-PT.d.ts +410 -0
- package/dist/i18n/messages/ro-RO.d.ts +410 -0
- package/dist/i18n/messages/ru-RU.d.ts +415 -0
- package/dist/i18n/messages/sk-SK.d.ts +415 -0
- package/dist/i18n/messages/sl-SI.d.ts +415 -0
- package/dist/i18n/messages/sv-SE.d.ts +405 -0
- package/dist/i18n/messages/tr-TR.d.ts +405 -0
- package/dist/i18n/messages/uk-UA.d.ts +415 -0
- package/dist/i18n/messages/zh-CN.d.ts +400 -0
- package/dist/i18n/messages/zh-TW.d.ts +400 -0
- package/dist/i18n/resolveLocale.d.ts +11 -0
- package/dist/i18n/source.d.ts +7 -0
- package/dist/i18n/translate.d.ts +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +31169 -12611
- package/dist/internal-types/index.d.ts +2 -4
- package/dist/konva/scene/contentBounds.d.ts +18 -12
- package/dist/konva/scene/metrics.d.ts +2 -0
- package/dist/konva/scene/renderScene.d.ts +10 -4
- package/dist/konva/scene/stacking.d.ts +21 -0
- package/dist/konva/scene/viewLayout.d.ts +2 -1
- package/dist/loadValue-BKvXDYoC.js +12925 -0
- package/dist/peer/index.d.ts +6 -3
- package/dist/peer/index.js +82 -75
- package/dist/services/elk-layout/elkGraph.d.ts +6 -4
- package/dist/services/elk-layout/elkLayoutOptions.d.ts +20 -0
- package/dist/services/elk-layout/elkLayoutService.d.ts +3 -3
- package/dist/services/export-png/ExportScene.d.ts +3 -3
- package/dist/services/export-png/documentScene.d.ts +14 -9
- package/dist/services/export-png/exportBox.d.ts +40 -5
- package/dist/services/export-png/exportPngService.d.ts +15 -0
- package/dist/services/export-png/exportTheme.d.ts +26 -0
- package/dist/services/export-png/index.d.ts +44 -11
- package/dist/services/export-png/renderPng.d.ts +18 -10
- package/dist/services/export-png/renderSvg.d.ts +22 -0
- package/dist/services/export-png/sceneSvg.d.ts +54 -0
- package/dist/services/shiki/graphqlGrammar.d.ts +8 -0
- package/dist/shared-store-2IUOt99m.js +1341 -0
- package/dist/styles/scrollbar.styles.d.ts +1 -1
- package/dist/themes/radix-ui-theme.d.ts +11 -3
- package/dist/themes/tokens.d.ts +18 -4
- package/dist/utils/calcTable.d.ts +9 -0
- package/dist/utils/clipboard.d.ts +9 -0
- package/dist/utils/collection/tableGroup.entity.d.ts +3 -0
- package/dist/utils/contrastText.d.ts +21 -0
- package/dist/utils/deepMerge.d.ts +8 -0
- package/dist/utils/device-detect/index.d.ts +2 -6
- package/dist/utils/diff/compareEntities.d.ts +39 -0
- package/dist/utils/diff/diffDocuments.d.ts +12 -0
- package/dist/utils/diff/index.d.ts +5 -0
- package/dist/utils/diff/pairEntities.d.ts +41 -0
- package/dist/utils/diff/types.d.ts +77 -0
- package/dist/utils/domEvent.d.ts +18 -0
- package/dist/utils/dragSelect.d.ts +2 -0
- package/dist/utils/draw-relationship/bezier.d.ts +2 -0
- package/dist/utils/draw-relationship/corner.d.ts +9 -0
- package/dist/utils/draw-relationship/index.d.ts +18 -18
- package/dist/utils/draw-relationship/loop.d.ts +29 -0
- package/dist/utils/draw-relationship/pathFinding.d.ts +1 -1
- package/dist/utils/draw-relationship/sort.d.ts +8 -1
- package/dist/utils/draw-relationship/stub.d.ts +4 -3
- package/dist/utils/emitter.d.ts +53 -12
- package/dist/utils/file/exportFile.d.ts +15 -5
- package/dist/utils/file/importFile.d.ts +9 -5
- package/dist/utils/file/importSchema.d.ts +45 -0
- package/dist/utils/find-replace/findMatches.d.ts +25 -12
- package/dist/utils/find-replace/matcher.d.ts +2 -0
- package/dist/utils/find-replace/present.d.ts +8 -5
- package/dist/utils/find-replace/preserveCase.d.ts +10 -0
- package/dist/utils/generator-code/columnTypes.d.ts +99 -0
- package/dist/utils/generator-code/doctrine.d.ts +6 -0
- package/dist/utils/generator-code/doctrineReservedWords.d.ts +7 -0
- package/dist/utils/generator-code/graphql.d.ts +6 -0
- package/dist/utils/generator-code/heck.d.ts +5 -0
- package/dist/utils/generator-code/java.d.ts +28 -0
- package/dist/utils/generator-code/jsonSchema.d.ts +50 -0
- package/dist/utils/generator-code/jsonShape.d.ts +37 -0
- package/dist/utils/generator-code/kotlin.d.ts +1 -0
- package/dist/utils/generator-code/mermaid.d.ts +5 -0
- package/dist/utils/generator-code/php.d.ts +28 -0
- package/dist/utils/generator-code/rust.d.ts +13 -0
- package/dist/utils/generator-code/rustTypes.d.ts +44 -0
- package/dist/utils/generator-code/scala.d.ts +1 -0
- package/dist/utils/generator-code/seaorm.d.ts +22 -0
- package/dist/utils/generator-code/swift.d.ts +44 -0
- package/dist/utils/generator-code/utils.d.ts +19 -0
- package/dist/utils/generator-code/zod.d.ts +25 -0
- package/dist/utils/globalEventObservable.d.ts +10 -1
- package/dist/utils/highlightWords.d.ts +29 -0
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/keyboard-shortcut/bindKeys.d.ts +9 -0
- package/dist/utils/keyboard-shortcut/index.d.ts +19 -4
- package/dist/utils/keyboard-shortcut/utils.d.ts +21 -0
- package/dist/utils/map-columns/alignTypes.d.ts +37 -0
- package/dist/utils/map-columns/buildRows.d.ts +102 -0
- package/dist/utils/map-columns/candidateKeys.d.ts +24 -0
- package/dist/utils/map-columns/index.d.ts +8 -0
- package/dist/utils/map-columns/mapping.d.ts +67 -0
- package/dist/utils/map-columns/prefill.d.ts +26 -0
- package/dist/utils/map-columns/toMapColumnsActions.d.ts +10 -0
- package/dist/utils/map-columns/validate.d.ts +45 -0
- package/dist/utils/memo.d.ts +4 -0
- package/dist/utils/schema-aml-parser/types.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/tokenizer.d.ts +2 -0
- package/dist/utils/schema-dbml-parser/types.d.ts +11 -0
- package/dist/utils/schema-sql/Databricks.d.ts +8 -3
- package/dist/utils/schema-sql/MSSQL.d.ts +14 -2
- package/dist/utils/schema-sql/MariaDB.d.ts +6 -5
- package/dist/utils/schema-sql/MySQL.d.ts +13 -4
- package/dist/utils/schema-sql/Oracle.d.ts +19 -5
- package/dist/utils/schema-sql/PostgreSQL.d.ts +16 -4
- package/dist/utils/schema-sql/SQLite.d.ts +16 -4
- package/dist/utils/schema-sql/Snowflake.d.ts +8 -3
- package/dist/utils/schema-sql/index.d.ts +16 -1
- package/dist/utils/schema-sql/options.d.ts +57 -0
- package/dist/utils/schema-sql/utils.d.ts +101 -2
- package/dist/utils/stageCursor.d.ts +20 -0
- package/dist/utils/table-clipboard/placement.d.ts +2 -0
- package/dist/utils/tableColor.d.ts +29 -0
- package/dist/utils/tableGroup.d.ts +142 -0
- package/dist/utils/tableKeys.d.ts +11 -3
- package/dist/utils/takeover.d.ts +6 -0
- package/dist/utils/virtualRange.d.ts +15 -0
- package/dist/workers/elkLayout.shared-worker.js +1 -1
- package/dist/workers/exportPng.shared-worker.js +30 -30
- package/dist/workers/shiki.shared-worker.js +1 -1
- package/dist/workers/spawn.d.ts +1 -2
- package/dist/workers/spawn.inline.d.ts +0 -1
- package/package.json +4 -11
- package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.d.ts +0 -12
- package/dist/components/erd/diff-viewer/tree-viewer/TreeViewer.styles.d.ts +0 -6
- package/dist/components/find-replace/FindReplace.d.ts +0 -13
- package/dist/components/find-replace/FindReplace.styles.d.ts +0 -27
- package/dist/components/find-replace/panelLayout.d.ts +0 -17
- package/dist/components/generator-code/GeneratorCode.styles.d.ts +0 -2
- package/dist/loadValue-Mdc5K4qO.js +0 -10858
- package/dist/schemaGCService-CZtGFh2z.js +0 -42
- package/dist/services/schema-gc/index.d.ts +0 -18
- package/dist/services/schema-gc/procGC.d.ts +0 -4
- package/dist/services/schema-gc/schemaGC.shared-worker.d.ts +0 -2
- package/dist/services/schema-gc/schemaGCService.d.ts +0 -10
- package/dist/shared-store-D82WVL5a.js +0 -1129
- package/dist/styles/colorPicker.style.d.ts +0 -7
- package/dist/utils/draw-relationship/chamfer.d.ts +0 -3
- package/dist/workers/schemaGC.shared-worker.js +0 -1
- /package/dist/components/{find-replace → explorer}/fieldIcon.d.ts +0 -0
|
@@ -1,1129 +0,0 @@
|
|
|
1
|
-
import { A as e, Ai as t, At as n, Ba as r, Bi as i, C as a, Ct as o, D as s, Dt as c, Et as l, Fn as u, Fr as d, Ft as f, Ha as p, Mt as m, Nt as h, O as g, Oi as _, Ot as v, Pt as y, Qn as b, S as ee, St as x, T as S, Ta as C, Tt as w, Vi as T, Wa as te, _a as E, d as D, f as O, g as k, h as A, j, ji as M, jt as N, k as ne, ka as P, ki as F, kt as I, ln as re, m as ie, n as ae, p as oe, tr as se, u as ce, w as le, wt as L, x as ue } from "./loadValue-Mdc5K4qO.js";
|
|
2
|
-
import { isEmpty as de } from "es-toolkit/compat";
|
|
3
|
-
import { isFunction as fe, isNil as R } from "es-toolkit";
|
|
4
|
-
import { nanoid as z } from "nanoid";
|
|
5
|
-
import { Observable as B, Subject as V, debounceTime as pe, map as H, merge as me, race as he, startWith as ge, switchMap as U, take as W, timer as _e } from "rxjs";
|
|
6
|
-
//#region src/engine/history.ts
|
|
7
|
-
function G({ notify: e, dispatch: t, getNextVersion: n }, r) {
|
|
8
|
-
let i = r?.commands ?? [], a = r?.cursor ?? -1, o = r?.limit ?? 0, s = !0, c = () => a !== -1, l = () => a < i.length - 1, u = (e) => o = e, d = () => ({
|
|
9
|
-
hasRedo: l(),
|
|
10
|
-
hasUndo: c()
|
|
11
|
-
}), f = (e, r) => {
|
|
12
|
-
s = !1, e[r](t, n), s = !0;
|
|
13
|
-
};
|
|
14
|
-
return Object.freeze({
|
|
15
|
-
get cursor() {
|
|
16
|
-
return a;
|
|
17
|
-
},
|
|
18
|
-
get size() {
|
|
19
|
-
return i.length;
|
|
20
|
-
},
|
|
21
|
-
hasUndo: c,
|
|
22
|
-
hasRedo: l,
|
|
23
|
-
push: (t) => {
|
|
24
|
-
s && (i.splice(a + 1, i.length - a), i.push(t), o !== 0 && i.length > o && (i = i.slice(i.length - o, i.length)), a = i.length - 1, e(d()));
|
|
25
|
-
},
|
|
26
|
-
undo: () => {
|
|
27
|
-
if (!c()) return;
|
|
28
|
-
let t = i[a];
|
|
29
|
-
f(t, "undo"), a--, e(d());
|
|
30
|
-
},
|
|
31
|
-
redo: () => {
|
|
32
|
-
if (!l()) return;
|
|
33
|
-
let t = i[a + 1];
|
|
34
|
-
f(t, "redo"), a++, e(d());
|
|
35
|
-
},
|
|
36
|
-
clear: () => {
|
|
37
|
-
let t = i.length;
|
|
38
|
-
i = [], a = -1, t > 0 && e(d());
|
|
39
|
-
},
|
|
40
|
-
setLimit: u,
|
|
41
|
-
clone: (e) => G(e, {
|
|
42
|
-
commands: [...i],
|
|
43
|
-
cursor: a,
|
|
44
|
-
limit: o
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/engine/rx-operators/flushOnNotifier.ts
|
|
50
|
-
var K = (e) => (t) => t.pipe(U((t) => e.pipe(W(1), H(() => t)))), ve = (e, t = 200) => (n) => n.pipe(U((n) => he(_e(t), e.pipe(W(1))).pipe(H(() => n)))), q = (e, t = []) => {
|
|
51
|
-
let n = E(a), r = (e) => !R(e.tags) && t.some((t) => _(e.tags, t)) || !n(e.type);
|
|
52
|
-
return (t) => new B((n) => t.subscribe({
|
|
53
|
-
next: (t) => {
|
|
54
|
-
n.next(e() ? t.filter(r) : t);
|
|
55
|
-
},
|
|
56
|
-
error: (e) => n.error(e),
|
|
57
|
-
complete: () => n.complete()
|
|
58
|
-
})).pipe(k);
|
|
59
|
-
}, ye = {
|
|
60
|
-
[d.scrollTo]: r.viewScrollTo,
|
|
61
|
-
[d.streamScrollTo]: r.viewStreamScrollTo,
|
|
62
|
-
[d.changeZoomLevel]: r.viewChangeZoomLevel,
|
|
63
|
-
[d.streamZoomLevel]: r.viewStreamZoomLevel
|
|
64
|
-
}, be = ({ tags: e }) => !R(e) && (_(e, F.shared) || _(e, F.following)), xe = (e) => {
|
|
65
|
-
let t = ye[e.type];
|
|
66
|
-
return t && !be(e) ? {
|
|
67
|
-
...e,
|
|
68
|
-
type: t
|
|
69
|
-
} : e;
|
|
70
|
-
}, Se = (e) => (t) => new B((n) => t.subscribe({
|
|
71
|
-
next: (t) => {
|
|
72
|
-
n.next(e() ? t.map(xe) : t);
|
|
73
|
-
},
|
|
74
|
-
error: (e) => n.error(e),
|
|
75
|
-
complete: () => n.complete()
|
|
76
|
-
})), J = (e, t = []) => {
|
|
77
|
-
let n = E(j), r = (e) => !R(e.tags) && t.some((t) => _(e.tags, t)) || !n(e.type);
|
|
78
|
-
return (t) => new B((n) => t.subscribe({
|
|
79
|
-
next: (t) => {
|
|
80
|
-
n.next(e() ? t.filter(r) : t);
|
|
81
|
-
},
|
|
82
|
-
error: (e) => n.error(e),
|
|
83
|
-
complete: () => n.complete()
|
|
84
|
-
})).pipe(k);
|
|
85
|
-
}, Y = 2048;
|
|
86
|
-
function Ce(t, { getReadonly: n = () => !1, getHistory: r, manualStreamFlush: a = !1, observable: o = !0 } = {}) {
|
|
87
|
-
let c = /* @__PURE__ */ new Set(), l = ce(t, o), d = ae(l), f = {
|
|
88
|
-
notify: (e) => l.dispatch(u(e)),
|
|
89
|
-
dispatch: l.dispatchSync,
|
|
90
|
-
getNextVersion: () => t.clock.getNextVersion()
|
|
91
|
-
}, p = r?.(f) ?? G(f);
|
|
92
|
-
p.setLimit(Y);
|
|
93
|
-
let m = () => i(l.state), h = new V(), _ = h.pipe(Se(m)), v = new V(), y = new V(), b = new V(), x = y.pipe(ge(void 0), U(() => v.pipe(oe(s, [
|
|
94
|
-
["@@move", ne],
|
|
95
|
-
["@@scroll", e],
|
|
96
|
-
["@@color", g]
|
|
97
|
-
], a ? K(b) : void 0)))), S = new B((e) => l.subscribe((t) => e.next(t))).pipe(A(ue), q(n, [F.shared]), pe(200)), C = (...e) => {
|
|
98
|
-
let n = t.clock.getNextVersion();
|
|
99
|
-
return te(l.state, l.context, e).map((e) => (R(e.version) && (e.version = n), e));
|
|
100
|
-
}, w = (...e) => {
|
|
101
|
-
let t = C(e);
|
|
102
|
-
h.next(t);
|
|
103
|
-
}, T = (...e) => {
|
|
104
|
-
queueMicrotask(() => w(e));
|
|
105
|
-
}, E = () => {
|
|
106
|
-
Array.from(c).forEach((e) => fe(e) ? e() : e.unsubscribe()), c.clear(), l.destroy(), d.destroy(), p.clear(), h.complete(), b.complete();
|
|
107
|
-
}, D = () => {
|
|
108
|
-
y.next(), p.clear();
|
|
109
|
-
}, k = () => {
|
|
110
|
-
n() || m() || p.undo();
|
|
111
|
-
}, j = () => {
|
|
112
|
-
n() || m() || p.redo();
|
|
113
|
-
}, M = () => {
|
|
114
|
-
a && b.next();
|
|
115
|
-
};
|
|
116
|
-
return c.add(x.subscribe(re(l, p))).add(_.pipe(A(ee), O([F.changeOnly, F.shared]), q(n), J(m)).subscribe(v)).add(_.pipe(q(n, [F.shared]), J(m, [F.shared])).subscribe(l.dispatchSync)).add(l.subscribe((e) => {
|
|
117
|
-
e.forEach((e) => t.clock.merge(e.version));
|
|
118
|
-
})), Object.freeze({
|
|
119
|
-
...l,
|
|
120
|
-
dispatch: T,
|
|
121
|
-
dispatchSync: w,
|
|
122
|
-
destroy: E,
|
|
123
|
-
undo: k,
|
|
124
|
-
redo: j,
|
|
125
|
-
history: p,
|
|
126
|
-
resetHistory: D,
|
|
127
|
-
change$: S,
|
|
128
|
-
flushStreamBuffers: M
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region src/utils/focus.ts
|
|
133
|
-
function we(e, t, n, r = null) {
|
|
134
|
-
if (!e || n !== e.tableId) return !1;
|
|
135
|
-
switch (t) {
|
|
136
|
-
case "tableName":
|
|
137
|
-
case "tableComment": return t === e.focusType;
|
|
138
|
-
}
|
|
139
|
-
return r === e.columnId && t === e.focusType;
|
|
140
|
-
}
|
|
141
|
-
var Te = (e, t, n) => e?.tableId === t && e.selectColumnIds.includes(n);
|
|
142
|
-
function Ee(e, t, n, r = null) {
|
|
143
|
-
if (e?.tableId !== n) return !1;
|
|
144
|
-
switch (t) {
|
|
145
|
-
case T.tableName:
|
|
146
|
-
case T.tableComment: return t === e.focusType && e.edit;
|
|
147
|
-
}
|
|
148
|
-
return r === e.columnId && t === e.focusType && e.edit;
|
|
149
|
-
}
|
|
150
|
-
function De(e) {
|
|
151
|
-
let t = e.value.length;
|
|
152
|
-
e.selectionStart = t, e.selectionEnd = t, e.focus();
|
|
153
|
-
}
|
|
154
|
-
var Oe = (e) => e ? {
|
|
155
|
-
tableId: e.tableId,
|
|
156
|
-
columnId: e.columnId,
|
|
157
|
-
focusType: e.focusType
|
|
158
|
-
} : null, ke = (e) => e ? JSON.stringify([
|
|
159
|
-
e.tableId,
|
|
160
|
-
e.columnId,
|
|
161
|
-
e.focusType
|
|
162
|
-
]) : "", X = "`";
|
|
163
|
-
function Z(e) {
|
|
164
|
-
return `'${e.replace(/[\\']/g, "\\$&")}'`;
|
|
165
|
-
}
|
|
166
|
-
var Ae = "NOT ENFORCED RELY", je = N(P.Databricks);
|
|
167
|
-
function Me(e) {
|
|
168
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
169
|
-
return c.forEach((t) => {
|
|
170
|
-
Ne(e, {
|
|
171
|
-
table: t,
|
|
172
|
-
buffer: s
|
|
173
|
-
}), s.push(""), Q(e, {
|
|
174
|
-
table: t,
|
|
175
|
-
buffer: s
|
|
176
|
-
});
|
|
177
|
-
}), l.forEach((t) => {
|
|
178
|
-
Fe(e, {
|
|
179
|
-
relationship: t,
|
|
180
|
-
buffer: s,
|
|
181
|
-
fkNames: a
|
|
182
|
-
}), s.push("");
|
|
183
|
-
}), u.forEach((t) => {
|
|
184
|
-
Ie(e, {
|
|
185
|
-
index: t,
|
|
186
|
-
buffer: s,
|
|
187
|
-
indexNames: o
|
|
188
|
-
}), s.push("");
|
|
189
|
-
}), s.join("\n");
|
|
190
|
-
}
|
|
191
|
-
function Ne(e, { buffer: t, table: r }) {
|
|
192
|
-
let { collections: i } = e, a = p(i).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
193
|
-
t.push(`CREATE TABLE ${X}${r.name}${X}`), t.push("(");
|
|
194
|
-
let s = I(a), c = w(a);
|
|
195
|
-
if (a.forEach((n, r) => {
|
|
196
|
-
Pe(e, {
|
|
197
|
-
column: n,
|
|
198
|
-
isComma: s || a.length !== r + 1,
|
|
199
|
-
spaceSize: c,
|
|
200
|
-
buffer: t
|
|
201
|
-
});
|
|
202
|
-
}), s) {
|
|
203
|
-
let e = n(a);
|
|
204
|
-
t.push(` CONSTRAINT ${X}PK_${r.name}${X} PRIMARY KEY (${o(e, X)}) ${Ae}`);
|
|
205
|
-
}
|
|
206
|
-
t.push(")"), r.comment.trim() === "" ? t.push("USING DELTA;") : (t.push("USING DELTA"), t.push(`COMMENT ${Z(r.comment)};`));
|
|
207
|
-
}
|
|
208
|
-
function Q({ collections: e }, { buffer: t, table: n }) {
|
|
209
|
-
let r = p(e).collection("tableColumnEntities").selectByIds(n.columnIds);
|
|
210
|
-
f(r).forEach((e) => {
|
|
211
|
-
t.push(`-- Databricks does not support UNIQUE constraints: ${X}${n.name}${X}.${X}${e.name}${X}`), t.push("");
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function Pe(e, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
215
|
-
let a = [];
|
|
216
|
-
a.push(` ${X}${n.name}${X}` + l(i.name - n.name.length)), a.push(`${n.dataType}` + l(i.dataType - n.dataType.length));
|
|
217
|
-
let o = _(n.options, C.notNull) || _(n.options, C.primaryKey);
|
|
218
|
-
a.push(o ? "NOT NULL" : " "), _(n.options, C.autoIncrement) ? a.push("GENERATED ALWAYS AS IDENTITY") : n.default.trim() !== "" && a.push(`DEFAULT ${n.default}`), n.comment.trim() !== "" && a.push(`COMMENT ${Z(n.comment)}`), t.push(a.join(" ").trimEnd() + `${r ? "," : ""}`);
|
|
219
|
-
}
|
|
220
|
-
function Fe({ collections: e }, { buffer: t, relationship: n, fkNames: r }) {
|
|
221
|
-
let i = p(e).collection("tableEntities"), a = p(e).collection("tableColumnEntities"), s = i.selectById(n.start.tableId), c = i.selectById(n.end.tableId);
|
|
222
|
-
if (s && c) {
|
|
223
|
-
t.push(`ALTER TABLE ${X}${c.name}${X}`);
|
|
224
|
-
let e = `FK_${s.name}_TO_${c.name}`;
|
|
225
|
-
e = x(r, "", e), r.push({
|
|
226
|
-
id: z(),
|
|
227
|
-
name: e
|
|
228
|
-
}), t.push(` ADD CONSTRAINT ${X}${e}${X}`);
|
|
229
|
-
let i = {
|
|
230
|
-
start: [],
|
|
231
|
-
end: []
|
|
232
|
-
};
|
|
233
|
-
n.end.columnIds.forEach((e) => {
|
|
234
|
-
let t = a.selectById(e);
|
|
235
|
-
t && i.end.push(t);
|
|
236
|
-
}), n.start.columnIds.forEach((e) => {
|
|
237
|
-
let t = a.selectById(e);
|
|
238
|
-
t && i.start.push(t);
|
|
239
|
-
}), t.push(` FOREIGN KEY (${o(i.end, X)})`), t.push([
|
|
240
|
-
` REFERENCES ${X}${s.name}${X} (${o(i.start, X)})`,
|
|
241
|
-
...L(n, je),
|
|
242
|
-
`${Ae};`
|
|
243
|
-
].join(" "));
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function Ie({ collections: e }, { buffer: t, index: n, indexNames: r }) {
|
|
247
|
-
let i = p(e).collection("tableEntities").selectById(n.tableId);
|
|
248
|
-
if (!i) return;
|
|
249
|
-
let a = p(e).collection("indexColumnEntities").selectByIds(n.indexColumnIds).map((t) => {
|
|
250
|
-
let n = p(e).collection("tableColumnEntities").selectById(t.columnId);
|
|
251
|
-
return n ? { name: `${X}${n.name}${X} ${m(t.orderType)}` } : null;
|
|
252
|
-
}).filter((e) => e !== null);
|
|
253
|
-
if (a.length === 0) return;
|
|
254
|
-
let s = n.name;
|
|
255
|
-
n.name.trim() === "" && (s = `IDX_${i.name}`, s = x(r, "", s), r.push({
|
|
256
|
-
id: z(),
|
|
257
|
-
name: s
|
|
258
|
-
})), t.push(`-- Databricks has no secondary indexes. ${X}${s}${X} on ${X}${i.name}${X} (${o(a)})`), t.push(`-- ALTER TABLE ${X}${i.name}${X} CLUSTER BY (${o(p(e).collection("indexColumnEntities").selectByIds(n.indexColumnIds).map((t) => p(e).collection("tableColumnEntities").selectById(t.columnId)).filter((e) => e !== void 0), X)});`);
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
|
-
//#region src/utils/schema-sql/MariaDB.ts
|
|
262
|
-
var Le = N(P.MariaDB);
|
|
263
|
-
function Re(e) {
|
|
264
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
265
|
-
return c.forEach((t) => {
|
|
266
|
-
ze(e, {
|
|
267
|
-
table: t,
|
|
268
|
-
buffer: s
|
|
269
|
-
}), s.push(""), Be(e, {
|
|
270
|
-
table: t,
|
|
271
|
-
buffer: s
|
|
272
|
-
});
|
|
273
|
-
}), l.forEach((t) => {
|
|
274
|
-
He(e, {
|
|
275
|
-
relationship: t,
|
|
276
|
-
buffer: s,
|
|
277
|
-
fkNames: a
|
|
278
|
-
}), s.push("");
|
|
279
|
-
}), u.forEach((t) => {
|
|
280
|
-
Ue(e, {
|
|
281
|
-
index: t,
|
|
282
|
-
buffer: s,
|
|
283
|
-
indexNames: o
|
|
284
|
-
}), s.push("");
|
|
285
|
-
}), s.join("\n");
|
|
286
|
-
}
|
|
287
|
-
function ze(e, { buffer: t, table: r }) {
|
|
288
|
-
let { settings: { bracketType: i }, collections: a } = e, s = c(i), l = p(a).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
289
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
290
|
-
let u = I(l), d = w(l);
|
|
291
|
-
if (l.forEach((n, r) => {
|
|
292
|
-
u ? Ve(e, {
|
|
293
|
-
column: n,
|
|
294
|
-
isComma: !0,
|
|
295
|
-
spaceSize: d,
|
|
296
|
-
buffer: t
|
|
297
|
-
}) : Ve(e, {
|
|
298
|
-
column: n,
|
|
299
|
-
isComma: l.length !== r + 1,
|
|
300
|
-
spaceSize: d,
|
|
301
|
-
buffer: t
|
|
302
|
-
});
|
|
303
|
-
}), u) {
|
|
304
|
-
let e = n(l);
|
|
305
|
-
t.push(` PRIMARY KEY (${o(e, s)})`);
|
|
306
|
-
}
|
|
307
|
-
r.comment.trim() === "" ? t.push(");") : t.push(`) COMMENT ${h(r.comment)};`);
|
|
308
|
-
}
|
|
309
|
-
function Be({ settings: { bracketType: e }, collections: t }, { buffer: n, table: r }) {
|
|
310
|
-
let i = c(e), a = p(t).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
311
|
-
y(a) && f(a).forEach((e) => {
|
|
312
|
-
n.push(`ALTER TABLE ${i}${r.name}${i}`), n.push(` ADD CONSTRAINT ${i}UQ_${r.name}_${e.name}${i} UNIQUE (${i}${e.name}${i});`), n.push("");
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
function Ve({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
316
|
-
let a = c(e), o = [];
|
|
317
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), o.push(`${_(n.options, C.notNull) ? "NOT NULL" : "NULL "}`), _(n.options, C.autoIncrement) ? o.push("AUTO_INCREMENT") : n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), n.comment.trim() !== "" && o.push(`COMMENT ${h(n.comment)}`), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
318
|
-
}
|
|
319
|
-
function He({ settings: { bracketType: e }, collections: t }, { buffer: n, relationship: r, fkNames: i }) {
|
|
320
|
-
let a = c(e), s = p(t).collection("tableEntities"), l = p(t).collection("tableColumnEntities"), u = s.selectById(r.start.tableId), d = s.selectById(r.end.tableId);
|
|
321
|
-
if (u && d) {
|
|
322
|
-
n.push(`ALTER TABLE ${a}${d.name}${a}`);
|
|
323
|
-
let e = `FK_${u.name}_TO_${d.name}`;
|
|
324
|
-
e = x(i, "", e), i.push({
|
|
325
|
-
id: z(),
|
|
326
|
-
name: e
|
|
327
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
328
|
-
let t = {
|
|
329
|
-
start: [],
|
|
330
|
-
end: []
|
|
331
|
-
};
|
|
332
|
-
r.end.columnIds.forEach((e) => {
|
|
333
|
-
let n = l.selectById(e);
|
|
334
|
-
n && t.end.push(n);
|
|
335
|
-
}), r.start.columnIds.forEach((e) => {
|
|
336
|
-
let n = l.selectById(e);
|
|
337
|
-
n && t.start.push(n);
|
|
338
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${u.name}${a} (${o(t.start, a)})`, ...L(r, Le).map((e) => ` ${e}`)), n[n.length - 1] += ";";
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
function Ue({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
342
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
343
|
-
if (!s) return;
|
|
344
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
345
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
346
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
347
|
-
}).filter((e) => e !== null);
|
|
348
|
-
if (l.length !== 0) {
|
|
349
|
-
let e = r.name;
|
|
350
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
351
|
-
id: z(),
|
|
352
|
-
name: e
|
|
353
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)});`);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
//#endregion
|
|
357
|
-
//#region src/utils/schema-sql/MSSQL.ts
|
|
358
|
-
var We = N(P.MSSQL);
|
|
359
|
-
function Ge(e) {
|
|
360
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
361
|
-
return c.forEach((t) => {
|
|
362
|
-
Ke(e, {
|
|
363
|
-
table: t,
|
|
364
|
-
buffer: s
|
|
365
|
-
}), s.push(""), qe(e, {
|
|
366
|
-
table: t,
|
|
367
|
-
buffer: s
|
|
368
|
-
}), Ye(e, {
|
|
369
|
-
table: t,
|
|
370
|
-
buffer: s
|
|
371
|
-
});
|
|
372
|
-
}), l.forEach((t) => {
|
|
373
|
-
Xe(e, {
|
|
374
|
-
relationship: t,
|
|
375
|
-
buffer: s,
|
|
376
|
-
fkNames: a
|
|
377
|
-
}), s.push("");
|
|
378
|
-
}), u.forEach((t) => {
|
|
379
|
-
Ze(e, {
|
|
380
|
-
index: t,
|
|
381
|
-
buffer: s,
|
|
382
|
-
indexNames: o
|
|
383
|
-
}), s.push("");
|
|
384
|
-
}), s.join("\n");
|
|
385
|
-
}
|
|
386
|
-
function Ke(e, { buffer: t, table: r }) {
|
|
387
|
-
let { settings: { bracketType: i }, collections: a } = e, s = c(i), l = p(a).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
388
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
389
|
-
let u = I(l), d = w(l);
|
|
390
|
-
if (l.forEach((n, r) => {
|
|
391
|
-
u ? Je(e, {
|
|
392
|
-
column: n,
|
|
393
|
-
isComma: !0,
|
|
394
|
-
spaceSize: d,
|
|
395
|
-
buffer: t
|
|
396
|
-
}) : Je(e, {
|
|
397
|
-
column: n,
|
|
398
|
-
isComma: l.length !== r + 1,
|
|
399
|
-
spaceSize: d,
|
|
400
|
-
buffer: t
|
|
401
|
-
});
|
|
402
|
-
}), u) {
|
|
403
|
-
let e = n(l);
|
|
404
|
-
t.push(` CONSTRAINT ${s}PK_${r.name}${s} PRIMARY KEY (${o(e, s)})`);
|
|
405
|
-
}
|
|
406
|
-
t.push(")\nGO");
|
|
407
|
-
}
|
|
408
|
-
function qe({ settings: { bracketType: e }, collections: t }, { buffer: n, table: r }) {
|
|
409
|
-
let i = c(e), a = p(t).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
410
|
-
y(a) && f(a).forEach((e) => {
|
|
411
|
-
n.push(`ALTER TABLE ${i}${r.name}${i}`), n.push(` ADD CONSTRAINT ${i}UQ_${r.name}_${e.name}${i} UNIQUE (${i}${e.name}${i})\nGO`), n.push("");
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
function Je({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
415
|
-
let a = c(e), o = [];
|
|
416
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), _(n.options, C.notNull) && o.push("NOT NULL"), _(n.options, C.autoIncrement) ? o.push("IDENTITY(1,1)") : n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
417
|
-
}
|
|
418
|
-
function Ye({ collections: e }, { table: t, buffer: n }) {
|
|
419
|
-
let r = h(t.name);
|
|
420
|
-
t.comment.trim() !== "" && (n.push("EXECUTE sys.sp_addextendedproperty 'MS_Description',"), n.push(` ${h(t.comment)}, 'user', dbo, 'table', ${r}\nGO`), n.push("")), p(e).collection("tableColumnEntities").selectByIds(t.columnIds).forEach((e) => {
|
|
421
|
-
e.comment.trim() !== "" && (n.push("EXECUTE sys.sp_addextendedproperty 'MS_Description',"), n.push(` ${h(e.comment)}, 'user', dbo, 'table', ${r}, 'column', ${h(e.name)}\nGO`), n.push(""));
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
function Xe({ settings: { bracketType: e }, collections: t }, { buffer: n, relationship: r, fkNames: i }) {
|
|
425
|
-
let a = c(e), s = p(t).collection("tableEntities"), l = p(t).collection("tableColumnEntities"), u = s.selectById(r.start.tableId), d = s.selectById(r.end.tableId);
|
|
426
|
-
if (u && d) {
|
|
427
|
-
n.push(`ALTER TABLE ${a}${d.name}${a}`);
|
|
428
|
-
let e = `FK_${u.name}_TO_${d.name}`;
|
|
429
|
-
e = x(i, "", e), i.push({
|
|
430
|
-
id: z(),
|
|
431
|
-
name: e
|
|
432
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
433
|
-
let t = {
|
|
434
|
-
start: [],
|
|
435
|
-
end: []
|
|
436
|
-
};
|
|
437
|
-
r.end.columnIds.forEach((e) => {
|
|
438
|
-
let n = l.selectById(e);
|
|
439
|
-
n && t.end.push(n);
|
|
440
|
-
}), r.start.columnIds.forEach((e) => {
|
|
441
|
-
let n = l.selectById(e);
|
|
442
|
-
n && t.start.push(n);
|
|
443
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${u.name}${a} (${o(t.start, a)})`, ...L(r, We).map((e) => ` ${e}`)), n[n.length - 1] += "\nGO";
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
function Ze({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
447
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
448
|
-
if (!s) return;
|
|
449
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
450
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
451
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
452
|
-
}).filter((e) => e !== null);
|
|
453
|
-
if (l.length !== 0) {
|
|
454
|
-
let e = r.name;
|
|
455
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
456
|
-
id: z(),
|
|
457
|
-
name: e
|
|
458
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)})\nGO`);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
//#endregion
|
|
462
|
-
//#region src/utils/schema-sql/MySQL.ts
|
|
463
|
-
var Qe = N(P.MySQL);
|
|
464
|
-
function $e(e) {
|
|
465
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
466
|
-
return c.forEach((t) => {
|
|
467
|
-
et(e, {
|
|
468
|
-
table: t,
|
|
469
|
-
buffer: s
|
|
470
|
-
}), s.push(""), tt(e, {
|
|
471
|
-
table: t,
|
|
472
|
-
buffer: s
|
|
473
|
-
});
|
|
474
|
-
}), l.forEach((t) => {
|
|
475
|
-
rt(e, {
|
|
476
|
-
relationship: t,
|
|
477
|
-
buffer: s,
|
|
478
|
-
fkNames: a
|
|
479
|
-
}), s.push("");
|
|
480
|
-
}), u.forEach((t) => {
|
|
481
|
-
it(e, {
|
|
482
|
-
index: t,
|
|
483
|
-
buffer: s,
|
|
484
|
-
indexNames: o
|
|
485
|
-
}), s.push("");
|
|
486
|
-
}), s.join("\n");
|
|
487
|
-
}
|
|
488
|
-
function et(e, { buffer: t, table: r }) {
|
|
489
|
-
let { settings: { bracketType: i }, collections: a } = e, s = c(i), l = p(a).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
490
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
491
|
-
let u = I(l), d = w(l);
|
|
492
|
-
if (l.forEach((n, r) => {
|
|
493
|
-
u ? nt(e, {
|
|
494
|
-
column: n,
|
|
495
|
-
isComma: !0,
|
|
496
|
-
spaceSize: d,
|
|
497
|
-
buffer: t
|
|
498
|
-
}) : nt(e, {
|
|
499
|
-
column: n,
|
|
500
|
-
isComma: l.length !== r + 1,
|
|
501
|
-
spaceSize: d,
|
|
502
|
-
buffer: t
|
|
503
|
-
});
|
|
504
|
-
}), u) {
|
|
505
|
-
let e = n(l);
|
|
506
|
-
t.push(` PRIMARY KEY (${o(e, s)})`);
|
|
507
|
-
}
|
|
508
|
-
r.comment.trim() === "" ? t.push(");") : t.push(`) COMMENT ${h(r.comment)};`);
|
|
509
|
-
}
|
|
510
|
-
function tt({ settings: { bracketType: e }, collections: t }, { buffer: n, table: r }) {
|
|
511
|
-
let i = c(e), a = p(t).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
512
|
-
y(a) && f(a).forEach((e) => {
|
|
513
|
-
n.push(`ALTER TABLE ${i}${r.name}${i}`), n.push(` ADD CONSTRAINT ${i}UQ_${r.name}_${e.name}${i} UNIQUE (${i}${e.name}${i});`), n.push("");
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
function nt({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
517
|
-
let a = c(e), o = [];
|
|
518
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), o.push(`${_(n.options, C.notNull) ? "NOT NULL" : "NULL "}`), _(n.options, C.autoIncrement) ? o.push("AUTO_INCREMENT") : n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), n.comment.trim() !== "" && o.push(`COMMENT ${h(n.comment)}`), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
519
|
-
}
|
|
520
|
-
function rt({ settings: { bracketType: e }, collections: t }, { buffer: n, relationship: r, fkNames: i }) {
|
|
521
|
-
let a = c(e), s = p(t).collection("tableEntities"), l = p(t).collection("tableColumnEntities"), u = s.selectById(r.start.tableId), d = s.selectById(r.end.tableId);
|
|
522
|
-
if (u && d) {
|
|
523
|
-
n.push(`ALTER TABLE ${a}${d.name}${a}`);
|
|
524
|
-
let e = `FK_${u.name}_TO_${d.name}`;
|
|
525
|
-
e = x(i, "", e), i.push({
|
|
526
|
-
id: z(),
|
|
527
|
-
name: e
|
|
528
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
529
|
-
let t = {
|
|
530
|
-
start: [],
|
|
531
|
-
end: []
|
|
532
|
-
};
|
|
533
|
-
r.end.columnIds.forEach((e) => {
|
|
534
|
-
let n = l.selectById(e);
|
|
535
|
-
n && t.end.push(n);
|
|
536
|
-
}), r.start.columnIds.forEach((e) => {
|
|
537
|
-
let n = l.selectById(e);
|
|
538
|
-
n && t.start.push(n);
|
|
539
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${u.name}${a} (${o(t.start, a)})`, ...L(r, Qe).map((e) => ` ${e}`)), n[n.length - 1] += ";";
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function it({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
543
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
544
|
-
if (!s) return;
|
|
545
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
546
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
547
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
548
|
-
}).filter((e) => e !== null);
|
|
549
|
-
if (l.length !== 0) {
|
|
550
|
-
let e = r.name;
|
|
551
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
552
|
-
id: z(),
|
|
553
|
-
name: e
|
|
554
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)});`);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
//#endregion
|
|
558
|
-
//#region src/utils/schema-sql/Oracle.ts
|
|
559
|
-
var at = N(P.Oracle);
|
|
560
|
-
function ot(e) {
|
|
561
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [], c = [], l = [""], u = p(i).collection("tableEntities").selectByIds(t).sort(v), d = p(i).collection("relationshipEntities").selectByIds(n), f = p(i).collection("indexEntities").selectByIds(r);
|
|
562
|
-
return u.forEach((t) => {
|
|
563
|
-
st(e, {
|
|
564
|
-
table: t,
|
|
565
|
-
buffer: l
|
|
566
|
-
}), l.push(""), ct(e, {
|
|
567
|
-
table: t,
|
|
568
|
-
buffer: l
|
|
569
|
-
}), p(i).collection("tableColumnEntities").selectByIds(t.columnIds).forEach((e) => {
|
|
570
|
-
if (_(e.options, C.autoIncrement)) {
|
|
571
|
-
let n = `SEQ_${t.name}`;
|
|
572
|
-
n = x(o, "", n), o.push({
|
|
573
|
-
id: z(),
|
|
574
|
-
name: n
|
|
575
|
-
}), l.push(`CREATE SEQUENCE ${n}`), l.push("START WITH 1"), l.push("INCREMENT BY 1;"), l.push("");
|
|
576
|
-
let r = `SEQ_TRG_${t.name}`;
|
|
577
|
-
r = x(o, "", r), s.push({
|
|
578
|
-
id: z(),
|
|
579
|
-
name: r
|
|
580
|
-
}), l.push(`CREATE OR REPLACE TRIGGER ${r}`), l.push(`BEFORE INSERT ON ${t.name}`), l.push("REFERENCING NEW AS NEW FOR EACH ROW"), l.push("BEGIN"), l.push(` SELECT ${n}.NEXTVAL`), l.push(` INTO: NEW.${e.name}`), l.push(" FROM DUAL;"), l.push("END;"), l.push("");
|
|
581
|
-
}
|
|
582
|
-
}), ut(e, {
|
|
583
|
-
table: t,
|
|
584
|
-
buffer: l
|
|
585
|
-
});
|
|
586
|
-
}), d.forEach((t) => {
|
|
587
|
-
dt(e, {
|
|
588
|
-
relationship: t,
|
|
589
|
-
buffer: l,
|
|
590
|
-
fkNames: a
|
|
591
|
-
}), l.push("");
|
|
592
|
-
}), f.forEach((t) => {
|
|
593
|
-
ft(e, {
|
|
594
|
-
index: t,
|
|
595
|
-
buffer: l,
|
|
596
|
-
indexNames: c
|
|
597
|
-
}), l.push("");
|
|
598
|
-
}), l.join("\n");
|
|
599
|
-
}
|
|
600
|
-
function st(e, { buffer: t, table: r }) {
|
|
601
|
-
let { settings: { bracketType: i }, collections: a } = e, s = c(i), l = p(a).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
602
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
603
|
-
let u = I(l), d = w(l);
|
|
604
|
-
if (l.forEach((n, r) => {
|
|
605
|
-
u ? lt(e, {
|
|
606
|
-
column: n,
|
|
607
|
-
isComma: !0,
|
|
608
|
-
spaceSize: d,
|
|
609
|
-
buffer: t
|
|
610
|
-
}) : lt(e, {
|
|
611
|
-
column: n,
|
|
612
|
-
isComma: l.length !== r + 1,
|
|
613
|
-
spaceSize: d,
|
|
614
|
-
buffer: t
|
|
615
|
-
});
|
|
616
|
-
}), u) {
|
|
617
|
-
let e = n(l);
|
|
618
|
-
t.push(` CONSTRAINT ${s}PK_${r.name}${s} PRIMARY KEY (${o(e, s)})`);
|
|
619
|
-
}
|
|
620
|
-
t.push(");");
|
|
621
|
-
}
|
|
622
|
-
function ct({ settings: { bracketType: e }, collections: t }, { buffer: n, table: r }) {
|
|
623
|
-
let i = c(e), a = p(t).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
624
|
-
y(a) && f(a).forEach((e) => {
|
|
625
|
-
n.push(`ALTER TABLE ${i}${r.name}${i}`), n.push(` ADD CONSTRAINT ${i}UQ_${r.name}_${e.name}${i} UNIQUE (${i}${e.name}${i});`), n.push("");
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
function lt({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
629
|
-
let a = c(e), o = [];
|
|
630
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), _(n.options, C.notNull) && o.push("NOT NULL"), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
631
|
-
}
|
|
632
|
-
function ut({ settings: { bracketType: e }, collections: t }, { table: n, buffer: r }) {
|
|
633
|
-
let i = c(e);
|
|
634
|
-
n.comment.trim() !== "" && (r.push(`COMMENT ON TABLE ${i}${n.name}${i} IS ${h(n.comment)};`), r.push("")), p(t).collection("tableColumnEntities").selectByIds(n.columnIds).forEach((e) => {
|
|
635
|
-
e.comment.trim() !== "" && (r.push(`COMMENT ON COLUMN ${i}${n.name}${i}.${i}${e.name}${i} IS ${h(e.comment)};`), r.push(""));
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
function dt({ settings: { bracketType: e }, collections: t }, { buffer: n, relationship: r, fkNames: i }) {
|
|
639
|
-
let a = c(e), s = p(t).collection("tableEntities"), l = p(t).collection("tableColumnEntities"), u = s.selectById(r.start.tableId), d = s.selectById(r.end.tableId);
|
|
640
|
-
if (u && d) {
|
|
641
|
-
n.push(`ALTER TABLE ${a}${d.name}${a}`);
|
|
642
|
-
let e = `FK_${u.name}_TO_${d.name}`;
|
|
643
|
-
e = x(i, "", e), i.push({
|
|
644
|
-
id: z(),
|
|
645
|
-
name: e
|
|
646
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
647
|
-
let t = {
|
|
648
|
-
start: [],
|
|
649
|
-
end: []
|
|
650
|
-
};
|
|
651
|
-
r.end.columnIds.forEach((e) => {
|
|
652
|
-
let n = l.selectById(e);
|
|
653
|
-
n && t.end.push(n);
|
|
654
|
-
}), r.start.columnIds.forEach((e) => {
|
|
655
|
-
let n = l.selectById(e);
|
|
656
|
-
n && t.start.push(n);
|
|
657
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${u.name}${a} (${o(t.start, a)})`, ...L(r, at).map((e) => ` ${e}`)), n[n.length - 1] += ";";
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
function ft({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
661
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
662
|
-
if (!s) return;
|
|
663
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
664
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
665
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
666
|
-
}).filter((e) => e !== null);
|
|
667
|
-
if (l.length !== 0) {
|
|
668
|
-
let e = r.name;
|
|
669
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
670
|
-
id: z(),
|
|
671
|
-
name: e
|
|
672
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)});`);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
//#endregion
|
|
676
|
-
//#region src/utils/schema-sql/PostgreSQL.ts
|
|
677
|
-
var pt = N(P.PostgreSQL);
|
|
678
|
-
function mt(e) {
|
|
679
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
680
|
-
return c.forEach((t) => {
|
|
681
|
-
ht(e, {
|
|
682
|
-
table: t,
|
|
683
|
-
buffer: s
|
|
684
|
-
}), s.push(""), _t(e, {
|
|
685
|
-
table: t,
|
|
686
|
-
buffer: s
|
|
687
|
-
});
|
|
688
|
-
}), l.forEach((t) => {
|
|
689
|
-
vt(e, {
|
|
690
|
-
relationship: t,
|
|
691
|
-
buffer: s,
|
|
692
|
-
fkNames: a
|
|
693
|
-
}), s.push("");
|
|
694
|
-
}), u.forEach((t) => {
|
|
695
|
-
yt(e, {
|
|
696
|
-
index: t,
|
|
697
|
-
buffer: s,
|
|
698
|
-
indexNames: o
|
|
699
|
-
}), s.push("");
|
|
700
|
-
}), s.join("\n");
|
|
701
|
-
}
|
|
702
|
-
function ht(e, { buffer: t, table: r }) {
|
|
703
|
-
let { settings: { bracketType: i }, collections: a } = e, s = c(i), l = p(a).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
704
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
705
|
-
let u = I(l), d = w(l);
|
|
706
|
-
if (l.forEach((n, r) => {
|
|
707
|
-
u ? gt(e, {
|
|
708
|
-
column: n,
|
|
709
|
-
isComma: !0,
|
|
710
|
-
spaceSize: d,
|
|
711
|
-
buffer: t
|
|
712
|
-
}) : gt(e, {
|
|
713
|
-
column: n,
|
|
714
|
-
isComma: l.length !== r + 1,
|
|
715
|
-
spaceSize: d,
|
|
716
|
-
buffer: t
|
|
717
|
-
});
|
|
718
|
-
}), u) {
|
|
719
|
-
let e = n(l);
|
|
720
|
-
t.push(` PRIMARY KEY (${o(e, s)})`);
|
|
721
|
-
}
|
|
722
|
-
t.push(");");
|
|
723
|
-
}
|
|
724
|
-
function gt({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
725
|
-
let a = c(e), o = [];
|
|
726
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), _(n.options, C.notNull) && o.push("NOT NULL"), _(n.options, C.autoIncrement) ? o.push("GENERATED ALWAYS AS IDENTITY") : n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), _(n.options, C.unique) && o.push("UNIQUE"), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
727
|
-
}
|
|
728
|
-
function _t({ settings: { bracketType: e }, collections: t }, { buffer: n, table: r }) {
|
|
729
|
-
let i = c(e);
|
|
730
|
-
r.comment.trim() !== "" && (n.push(`COMMENT ON TABLE ${i}${r.name}${i} IS ${h(r.comment)};`), n.push("")), p(t).collection("tableColumnEntities").selectByIds(r.columnIds).forEach((e) => {
|
|
731
|
-
e.comment.trim() !== "" && (n.push(`COMMENT ON COLUMN ${i}${r.name}${i}.${i}${e.name}${i} IS ${h(e.comment)};`), n.push(""));
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
function vt({ settings: { bracketType: e }, collections: t }, { buffer: n, relationship: r, fkNames: i }) {
|
|
735
|
-
let a = c(e), s = p(t).collection("tableEntities"), l = p(t).collection("tableColumnEntities"), u = s.selectById(r.start.tableId), d = s.selectById(r.end.tableId);
|
|
736
|
-
if (u && d) {
|
|
737
|
-
n.push(`ALTER TABLE ${a}${d.name}${a}`);
|
|
738
|
-
let e = `FK_${u.name}_TO_${d.name}`;
|
|
739
|
-
e = x(i, "", e), i.push({
|
|
740
|
-
id: z(),
|
|
741
|
-
name: e
|
|
742
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
743
|
-
let t = {
|
|
744
|
-
start: [],
|
|
745
|
-
end: []
|
|
746
|
-
};
|
|
747
|
-
r.end.columnIds.forEach((e) => {
|
|
748
|
-
let n = l.selectById(e);
|
|
749
|
-
n && t.end.push(n);
|
|
750
|
-
}), r.start.columnIds.forEach((e) => {
|
|
751
|
-
let n = l.selectById(e);
|
|
752
|
-
n && t.start.push(n);
|
|
753
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${u.name}${a} (${o(t.start, a)})`, ...L(r, pt).map((e) => ` ${e}`)), n[n.length - 1] += ";";
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
function yt({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
757
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
758
|
-
if (!s) return;
|
|
759
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
760
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
761
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
762
|
-
}).filter((e) => e !== null);
|
|
763
|
-
if (l.length !== 0) {
|
|
764
|
-
let e = r.name;
|
|
765
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
766
|
-
id: z(),
|
|
767
|
-
name: e
|
|
768
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)});`);
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
//#endregion
|
|
772
|
-
//#region src/utils/schema-sql/Snowflake.ts
|
|
773
|
-
var bt = N(P.Snowflake), $ = (e) => c(e) === "" ? "" : "\"";
|
|
774
|
-
function xt(e) {
|
|
775
|
-
let { doc: { tableIds: t, relationshipIds: n, indexIds: r }, collections: i } = e, a = [], o = [], s = [""], c = p(i).collection("tableEntities").selectByIds(t).sort(v), l = p(i).collection("relationshipEntities").selectByIds(n), u = p(i).collection("indexEntities").selectByIds(r);
|
|
776
|
-
return c.forEach((t) => {
|
|
777
|
-
St(e, {
|
|
778
|
-
table: t,
|
|
779
|
-
buffer: s
|
|
780
|
-
}), s.push("");
|
|
781
|
-
}), l.forEach((t) => {
|
|
782
|
-
wt(e, {
|
|
783
|
-
relationship: t,
|
|
784
|
-
buffer: s,
|
|
785
|
-
fkNames: a
|
|
786
|
-
}), s.push("");
|
|
787
|
-
}), u.forEach((t) => {
|
|
788
|
-
Tt(e, {
|
|
789
|
-
index: t,
|
|
790
|
-
buffer: s,
|
|
791
|
-
indexNames: o
|
|
792
|
-
}), s.push("");
|
|
793
|
-
}), s.join("\n");
|
|
794
|
-
}
|
|
795
|
-
function St(e, { buffer: t, table: r }) {
|
|
796
|
-
let { collections: i, settings: { bracketType: a } } = e, s = $(a), c = p(i).collection("tableColumnEntities").selectByIds(r.columnIds);
|
|
797
|
-
t.push(`CREATE TABLE ${s}${r.name}${s}`), t.push("(");
|
|
798
|
-
let l = I(c), u = w(c);
|
|
799
|
-
if (c.forEach((n, r) => {
|
|
800
|
-
Ct(e, {
|
|
801
|
-
column: n,
|
|
802
|
-
isComma: l || c.length !== r + 1,
|
|
803
|
-
spaceSize: u,
|
|
804
|
-
buffer: t
|
|
805
|
-
});
|
|
806
|
-
}), l) {
|
|
807
|
-
let e = n(c);
|
|
808
|
-
t.push(` CONSTRAINT ${s}PK_${r.name}${s} PRIMARY KEY (${o(e, s)})`);
|
|
809
|
-
}
|
|
810
|
-
r.comment.trim() === "" ? t.push(");") : (t.push(")"), t.push(`COMMENT = ${h(r.comment)};`));
|
|
811
|
-
}
|
|
812
|
-
function Ct({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
813
|
-
let a = $(e), o = [];
|
|
814
|
-
o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), _(n.options, C.unique) && o.push("UNIQUE");
|
|
815
|
-
let s = _(n.options, C.notNull) || _(n.options, C.primaryKey);
|
|
816
|
-
o.push(s ? "NOT NULL" : " "), _(n.options, C.autoIncrement) ? o.push("AUTOINCREMENT") : n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), n.comment.trim() !== "" && o.push(`COMMENT ${h(n.comment)}`), t.push(o.join(" ").trimEnd() + `${r ? "," : ""}`);
|
|
817
|
-
}
|
|
818
|
-
function wt({ collections: e, settings: { bracketType: t } }, { buffer: n, relationship: r, fkNames: i }) {
|
|
819
|
-
let a = $(t), s = p(e).collection("tableEntities"), c = p(e).collection("tableColumnEntities"), l = s.selectById(r.start.tableId), u = s.selectById(r.end.tableId);
|
|
820
|
-
if (l && u) {
|
|
821
|
-
n.push(`ALTER TABLE ${a}${u.name}${a}`);
|
|
822
|
-
let e = `FK_${l.name}_TO_${u.name}`;
|
|
823
|
-
e = x(i, "", e), i.push({
|
|
824
|
-
id: z(),
|
|
825
|
-
name: e
|
|
826
|
-
}), n.push(` ADD CONSTRAINT ${a}${e}${a}`);
|
|
827
|
-
let t = {
|
|
828
|
-
start: [],
|
|
829
|
-
end: []
|
|
830
|
-
};
|
|
831
|
-
r.end.columnIds.forEach((e) => {
|
|
832
|
-
let n = c.selectById(e);
|
|
833
|
-
n && t.end.push(n);
|
|
834
|
-
}), r.start.columnIds.forEach((e) => {
|
|
835
|
-
let n = c.selectById(e);
|
|
836
|
-
n && t.start.push(n);
|
|
837
|
-
}), n.push(` FOREIGN KEY (${o(t.end, a)})`), n.push(` REFERENCES ${a}${l.name}${a} (${o(t.start, a)})`, ...L(r, bt).map((e) => ` ${e}`)), n[n.length - 1] += ";";
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
function Tt({ collections: e, settings: { bracketType: t } }, { buffer: n, index: r, indexNames: i }) {
|
|
841
|
-
let a = $(t), s = p(e).collection("tableEntities").selectById(r.tableId);
|
|
842
|
-
if (!s) return;
|
|
843
|
-
let c = p(e).collection("indexColumnEntities").selectByIds(r.indexColumnIds), l = c.map((t) => p(e).collection("tableColumnEntities").selectById(t.columnId)).filter((e) => e !== void 0);
|
|
844
|
-
if (l.length === 0) return;
|
|
845
|
-
let u = r.name;
|
|
846
|
-
if (r.name.trim() === "" && (u = `IDX_${s.name}`, u = x(i, "", u), i.push({
|
|
847
|
-
id: z(),
|
|
848
|
-
name: u
|
|
849
|
-
})), r.unique) {
|
|
850
|
-
n.push(`ALTER TABLE ${a}${s.name}${a}`), n.push(` ADD CONSTRAINT ${a}${u}${a} UNIQUE (${o(l, a)});`);
|
|
851
|
-
return;
|
|
852
|
-
}
|
|
853
|
-
let d = c.map((t) => {
|
|
854
|
-
let n = p(e).collection("tableColumnEntities").selectById(t.columnId);
|
|
855
|
-
return n ? { name: `${a}${n.name}${a} ${m(t.orderType)}` } : null;
|
|
856
|
-
}).filter((e) => e !== null);
|
|
857
|
-
n.push(`-- Snowflake has no secondary indexes. ${a}${u}${a} on ${a}${s.name}${a} (${o(d)})`), n.push(`-- ALTER TABLE ${a}${s.name}${a} CLUSTER BY (${o(l, a)});`);
|
|
858
|
-
}
|
|
859
|
-
//#endregion
|
|
860
|
-
//#region src/utils/schema-sql/SQLite.ts
|
|
861
|
-
var Et = N(P.SQLite);
|
|
862
|
-
function Dt(e) {
|
|
863
|
-
let { doc: { tableIds: t, indexIds: n }, collections: r } = e, i = [], a = [""], o = p(r).collection("tableEntities").selectByIds(t).sort(v), s = p(r).collection("indexEntities").selectByIds(n);
|
|
864
|
-
return o.forEach((t) => {
|
|
865
|
-
Ot(e, {
|
|
866
|
-
table: t,
|
|
867
|
-
buffer: a
|
|
868
|
-
}), a.push("");
|
|
869
|
-
}), s.forEach((t) => {
|
|
870
|
-
At(e, {
|
|
871
|
-
index: t,
|
|
872
|
-
buffer: a,
|
|
873
|
-
indexNames: i
|
|
874
|
-
}), a.push("");
|
|
875
|
-
}), a.join("\n");
|
|
876
|
-
}
|
|
877
|
-
function Ot(e, { buffer: t, table: r }) {
|
|
878
|
-
let { settings: { bracketType: i }, doc: { relationshipIds: a }, collections: s } = e, l = c(i), u = p(s).collection("tableEntities"), d = p(s).collection("tableColumnEntities"), f = d.selectByIds(r.columnIds), m = p(s).collection("relationshipEntities").selectByIds(a).filter(({ end: e }) => e.tableId === r.id);
|
|
879
|
-
r.comment.trim() !== "" && t.push(`-- ${r.comment}`), t.push(`CREATE TABLE ${l}${r.name}${l}`), t.push("(");
|
|
880
|
-
let h = I(f), g = w(f);
|
|
881
|
-
if (f.forEach((n, r) => {
|
|
882
|
-
h ? kt(e, {
|
|
883
|
-
column: n,
|
|
884
|
-
isComma: !0,
|
|
885
|
-
spaceSize: g,
|
|
886
|
-
buffer: t
|
|
887
|
-
}) : kt(e, {
|
|
888
|
-
column: n,
|
|
889
|
-
isComma: f.length !== r + 1,
|
|
890
|
-
spaceSize: g,
|
|
891
|
-
buffer: t
|
|
892
|
-
});
|
|
893
|
-
}), h) {
|
|
894
|
-
let e = n(f);
|
|
895
|
-
if (m.length !== 0) {
|
|
896
|
-
if (e.length === 1) {
|
|
897
|
-
let n = _(e[0].options, C.autoIncrement) ? " AUTOINCREMENT" : "";
|
|
898
|
-
t.push(` PRIMARY KEY (${o(e, l)}${n}),`);
|
|
899
|
-
} else t.push(` PRIMARY KEY (${o(e, l)}),`);
|
|
900
|
-
} else if (e.length === 1) {
|
|
901
|
-
let n = _(e[0].options, C.autoIncrement) ? " AUTOINCREMENT" : "";
|
|
902
|
-
t.push(` PRIMARY KEY (${o(e, l)}${n})`);
|
|
903
|
-
} else t.push(` PRIMARY KEY (${o(e, l)})`);
|
|
904
|
-
}
|
|
905
|
-
m.forEach((e, n) => {
|
|
906
|
-
let r = u.selectById(e.start.tableId), i = u.selectById(e.end.tableId);
|
|
907
|
-
if (r && i) {
|
|
908
|
-
let i = {
|
|
909
|
-
start: [],
|
|
910
|
-
end: []
|
|
911
|
-
};
|
|
912
|
-
e.end.columnIds.forEach((e) => {
|
|
913
|
-
let t = d.selectById(e);
|
|
914
|
-
t && i.end.push(t);
|
|
915
|
-
}), e.start.columnIds.forEach((e) => {
|
|
916
|
-
let t = d.selectById(e);
|
|
917
|
-
t && i.start.push(t);
|
|
918
|
-
});
|
|
919
|
-
let a = L(e, Et).map((e) => ` ${e}`).join("");
|
|
920
|
-
m.length - 1 > n ? t.push(` FOREIGN KEY (${o(i.end, l)}) REFERENCES ${l}${r.name}${l} (${o(i.start, l)})${a},`) : t.push(` FOREIGN KEY (${o(i.end, l)}) REFERENCES ${l}${r.name}${l} (${o(i.start, l)})${a}`);
|
|
921
|
-
}
|
|
922
|
-
}), t.push(");");
|
|
923
|
-
}
|
|
924
|
-
function kt({ settings: { bracketType: e } }, { buffer: t, column: n, isComma: r, spaceSize: i }) {
|
|
925
|
-
let a = c(e), o = [];
|
|
926
|
-
n.comment.trim() !== "" && t.push(` -- ${n.comment}`), o.push(` ${a}${n.name}${a}` + l(i.name - n.name.length)), o.push(`${n.dataType}` + l(i.dataType - n.dataType.length)), o.push(`${_(n.options, C.notNull) ? "NOT NULL" : "NULL "}`), _(n.options, C.unique) && o.push("UNIQUE"), !_(n.options, C.autoIncrement) && n.default.trim() !== "" && o.push(`DEFAULT ${n.default}`), t.push(o.join(" ") + `${r ? "," : ""}`);
|
|
927
|
-
}
|
|
928
|
-
function At({ settings: { bracketType: e }, collections: t }, { buffer: n, index: r, indexNames: i }) {
|
|
929
|
-
let a = c(e), s = p(t).collection("tableEntities").selectById(r.tableId);
|
|
930
|
-
if (!s) return;
|
|
931
|
-
let l = p(t).collection("indexColumnEntities").selectByIds(r.indexColumnIds).map((e) => {
|
|
932
|
-
let n = p(t).collection("tableColumnEntities").selectById(e.columnId);
|
|
933
|
-
return n ? { name: `${a}${n.name}${a} ${m(e.orderType)}` } : null;
|
|
934
|
-
}).filter((e) => e !== null);
|
|
935
|
-
if (l.length !== 0) {
|
|
936
|
-
let e = r.name;
|
|
937
|
-
r.name.trim() === "" && (e = `IDX_${s.name}`, e = x(i, "", e), i.push({
|
|
938
|
-
id: z(),
|
|
939
|
-
name: e
|
|
940
|
-
})), r.unique ? n.push(`CREATE UNIQUE INDEX ${a}${e}${a}`) : n.push(`CREATE INDEX ${a}${e}${a}`), n.push(` ON ${a}${s.name}${a} (${o(l)});`);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
//#endregion
|
|
944
|
-
//#region src/utils/schema-sql/index.ts
|
|
945
|
-
function jt(e, t) {
|
|
946
|
-
switch (t || e.settings.database) {
|
|
947
|
-
case P.Databricks: return Me(e);
|
|
948
|
-
case P.MariaDB: return Re(e);
|
|
949
|
-
case P.MSSQL: return Ge(e);
|
|
950
|
-
case P.MySQL: return $e(e);
|
|
951
|
-
case P.Oracle: return ot(e);
|
|
952
|
-
case P.PostgreSQL: return mt(e);
|
|
953
|
-
case P.Snowflake: return xt(e);
|
|
954
|
-
case P.SQLite: return Dt(e);
|
|
955
|
-
}
|
|
956
|
-
return "";
|
|
957
|
-
}
|
|
958
|
-
function Mt(e, t) {
|
|
959
|
-
let { settings: n, doc: { indexIds: r }, collections: i } = e, a = [""], o = n.database, s = [], c = p(i).collection("indexEntities").selectByIds(r).filter((e) => e.tableId === t.id);
|
|
960
|
-
switch (o) {
|
|
961
|
-
case P.Databricks:
|
|
962
|
-
Ne(e, {
|
|
963
|
-
buffer: a,
|
|
964
|
-
table: t
|
|
965
|
-
}), a.push(""), Q(e, {
|
|
966
|
-
buffer: a,
|
|
967
|
-
table: t
|
|
968
|
-
}), c.forEach((t) => {
|
|
969
|
-
Ie(e, {
|
|
970
|
-
index: t,
|
|
971
|
-
buffer: a,
|
|
972
|
-
indexNames: s
|
|
973
|
-
}), a.push("");
|
|
974
|
-
});
|
|
975
|
-
break;
|
|
976
|
-
case P.MariaDB:
|
|
977
|
-
ze(e, {
|
|
978
|
-
buffer: a,
|
|
979
|
-
table: t
|
|
980
|
-
}), a.push(""), Be(e, {
|
|
981
|
-
buffer: a,
|
|
982
|
-
table: t
|
|
983
|
-
}), c.forEach((t) => {
|
|
984
|
-
Ue(e, {
|
|
985
|
-
index: t,
|
|
986
|
-
buffer: a,
|
|
987
|
-
indexNames: s
|
|
988
|
-
}), a.push("");
|
|
989
|
-
});
|
|
990
|
-
break;
|
|
991
|
-
case P.MSSQL:
|
|
992
|
-
Ke(e, {
|
|
993
|
-
buffer: a,
|
|
994
|
-
table: t
|
|
995
|
-
}), a.push(""), qe(e, {
|
|
996
|
-
buffer: a,
|
|
997
|
-
table: t
|
|
998
|
-
}), c.forEach((t) => {
|
|
999
|
-
Ze(e, {
|
|
1000
|
-
index: t,
|
|
1001
|
-
buffer: a,
|
|
1002
|
-
indexNames: s
|
|
1003
|
-
}), a.push("");
|
|
1004
|
-
});
|
|
1005
|
-
break;
|
|
1006
|
-
case P.MySQL:
|
|
1007
|
-
et(e, {
|
|
1008
|
-
buffer: a,
|
|
1009
|
-
table: t
|
|
1010
|
-
}), a.push(""), tt(e, {
|
|
1011
|
-
buffer: a,
|
|
1012
|
-
table: t
|
|
1013
|
-
}), c.forEach((t) => {
|
|
1014
|
-
it(e, {
|
|
1015
|
-
index: t,
|
|
1016
|
-
buffer: a,
|
|
1017
|
-
indexNames: s
|
|
1018
|
-
}), a.push("");
|
|
1019
|
-
});
|
|
1020
|
-
break;
|
|
1021
|
-
case P.Oracle:
|
|
1022
|
-
st(e, {
|
|
1023
|
-
buffer: a,
|
|
1024
|
-
table: t
|
|
1025
|
-
}), a.push(""), ct(e, {
|
|
1026
|
-
buffer: a,
|
|
1027
|
-
table: t
|
|
1028
|
-
}), c.forEach((t) => {
|
|
1029
|
-
ft(e, {
|
|
1030
|
-
index: t,
|
|
1031
|
-
buffer: a,
|
|
1032
|
-
indexNames: s
|
|
1033
|
-
}), a.push("");
|
|
1034
|
-
});
|
|
1035
|
-
break;
|
|
1036
|
-
case P.PostgreSQL:
|
|
1037
|
-
ht(e, {
|
|
1038
|
-
buffer: a,
|
|
1039
|
-
table: t
|
|
1040
|
-
}), a.push(""), c.forEach((t) => {
|
|
1041
|
-
yt(e, {
|
|
1042
|
-
index: t,
|
|
1043
|
-
buffer: a,
|
|
1044
|
-
indexNames: s
|
|
1045
|
-
}), a.push("");
|
|
1046
|
-
});
|
|
1047
|
-
break;
|
|
1048
|
-
case P.Snowflake:
|
|
1049
|
-
St(e, {
|
|
1050
|
-
buffer: a,
|
|
1051
|
-
table: t
|
|
1052
|
-
}), a.push(""), c.forEach((t) => {
|
|
1053
|
-
Tt(e, {
|
|
1054
|
-
index: t,
|
|
1055
|
-
buffer: a,
|
|
1056
|
-
indexNames: s
|
|
1057
|
-
}), a.push("");
|
|
1058
|
-
});
|
|
1059
|
-
break;
|
|
1060
|
-
case P.SQLite: Ot(e, {
|
|
1061
|
-
buffer: a,
|
|
1062
|
-
table: t
|
|
1063
|
-
}), a.push(""), c.forEach((t) => {
|
|
1064
|
-
At(e, {
|
|
1065
|
-
index: t,
|
|
1066
|
-
buffer: a,
|
|
1067
|
-
indexNames: s
|
|
1068
|
-
}), a.push("");
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
return a.join("\n");
|
|
1072
|
-
}
|
|
1073
|
-
//#endregion
|
|
1074
|
-
//#region src/engine/shared-store.ts
|
|
1075
|
-
var Nt = 2, Pt = E(S);
|
|
1076
|
-
function Ft(e, n, r) {
|
|
1077
|
-
let i = r?.manualStreamFlush ?? !1, a = { editorId: e.state.editor.id }, o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = new V(), l = new V(), u = new V(), d = new V(), f = new V(), p = D(i ? K(f) : ve(f)), m = !0, h = !0;
|
|
1078
|
-
o.add(me(new B((t) => e.subscribe((e) => t.next(e))), l).pipe(A(le), O([F.shared]), p, ie(u, d), p, H((e) => M(F.shared, e.map((e) => {
|
|
1079
|
-
let r = {
|
|
1080
|
-
...e,
|
|
1081
|
-
meta: Object.assign({}, e.meta ?? {}, {
|
|
1082
|
-
...a,
|
|
1083
|
-
nickname: n?.getNickname?.()
|
|
1084
|
-
})
|
|
1085
|
-
};
|
|
1086
|
-
return Pt(e.type) ? t(F.following, r) : r;
|
|
1087
|
-
})))).subscribe((e) => c.next(e)));
|
|
1088
|
-
let g = () => {
|
|
1089
|
-
let e = 0 < s.size;
|
|
1090
|
-
m && e ? u.next() : d.next();
|
|
1091
|
-
}, _ = (t) => {
|
|
1092
|
-
let n = (Array.isArray(t) ? t : [t]).some((e) => e.type === b.type), r = e.state.lww;
|
|
1093
|
-
n && !de(r) && l.next([{
|
|
1094
|
-
...se({ lww: r }),
|
|
1095
|
-
version: e.context.clock.getVersion()
|
|
1096
|
-
}]);
|
|
1097
|
-
};
|
|
1098
|
-
return Object.freeze({
|
|
1099
|
-
connection: () => {
|
|
1100
|
-
m = !0, g();
|
|
1101
|
-
},
|
|
1102
|
-
disconnect: () => {
|
|
1103
|
-
m = !1, g();
|
|
1104
|
-
},
|
|
1105
|
-
dispatch: (t) => {
|
|
1106
|
-
e.dispatch(t), _(t);
|
|
1107
|
-
},
|
|
1108
|
-
dispatchSync: (t) => {
|
|
1109
|
-
e.dispatchSync(t), _(t);
|
|
1110
|
-
},
|
|
1111
|
-
subscribe: (t) => {
|
|
1112
|
-
let n = c.subscribe((e) => t(e));
|
|
1113
|
-
return s.add(n), g(), h &&= (l.next([{
|
|
1114
|
-
...b(),
|
|
1115
|
-
version: e.context.clock.getVersion()
|
|
1116
|
-
}]), !1), () => {
|
|
1117
|
-
n.unsubscribe(), s.delete(n), g();
|
|
1118
|
-
};
|
|
1119
|
-
},
|
|
1120
|
-
flushStreamBuffers: () => {
|
|
1121
|
-
for (let e = 0; e < Nt; e++) f.next();
|
|
1122
|
-
},
|
|
1123
|
-
destroy: () => {
|
|
1124
|
-
Array.from(o).forEach((e) => e.unsubscribe()), Array.from(s).forEach((e) => e.unsubscribe()), o.clear(), s.clear(), c.complete(), u.complete(), d.complete(), f.complete();
|
|
1125
|
-
}
|
|
1126
|
-
});
|
|
1127
|
-
}
|
|
1128
|
-
//#endregion
|
|
1129
|
-
export { we as a, Oe as c, Ce as d, G as f, Ee as i, ke as l, jt as n, Te as o, Mt as r, De as s, Ft as t, Y as u };
|