@lobb-js/studio 0.1.31 → 0.1.32
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/{src/lib/components → dist}/LlmButton.svelte +2 -2
- package/dist/LlmButton.svelte.d.ts +17 -0
- package/{src → dist}/Studio.svelte +15 -15
- package/dist/Studio.svelte.d.ts +6 -0
- package/{src/lib/components → dist}/alertView.svelte +1 -1
- package/dist/alertView.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/breadCrumbs.svelte +2 -2
- package/dist/breadCrumbs.svelte.d.ts +3 -0
- package/{src/lib/components → dist}/combobox.svelte +4 -4
- package/dist/combobox.svelte.d.ts +15 -0
- package/{src/lib/components → dist}/confirmationDialog/confirmationDialog.svelte +1 -1
- package/dist/confirmationDialog/confirmationDialog.svelte.d.ts +8 -0
- package/dist/confirmationDialog/store.svelte.d.ts +1 -0
- package/dist/confirmationDialog/store.svelte.js +69 -0
- package/{src/lib/components → dist}/createManyButton.svelte +2 -2
- package/dist/createManyButton.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/dataTable/childRecords.svelte +2 -2
- package/dist/dataTable/childRecords.svelte.d.ts +9 -0
- package/{src/lib/components → dist}/dataTable/dataTable.svelte +3 -3
- package/dist/dataTable/dataTable.svelte.d.ts +15 -0
- package/{src/lib/components → dist}/dataTable/fieldCell.svelte +1 -1
- package/dist/dataTable/fieldCell.svelte.d.ts +10 -0
- package/{src/lib/components → dist}/dataTable/filter.svelte +2 -2
- package/dist/dataTable/filter.svelte.d.ts +10 -0
- package/{src/lib/components → dist}/dataTable/filterButton.svelte +1 -1
- package/dist/dataTable/filterButton.svelte.d.ts +8 -0
- package/dist/dataTable/footer.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/dataTable/header.svelte +2 -2
- package/dist/dataTable/header.svelte.d.ts +10 -0
- package/{src/lib/components → dist}/dataTable/sort.svelte +2 -2
- package/dist/dataTable/sort.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/dataTable/sortButton.svelte +2 -2
- package/dist/dataTable/sortButton.svelte.d.ts +8 -0
- package/dist/dataTable/table.svelte.d.ts +32 -0
- package/dist/dataTable/utils.d.ts +7 -0
- package/dist/dataTable/utils.js +111 -0
- package/{src/lib/components → dist}/detailView/create/children.svelte +3 -3
- package/dist/detailView/create/children.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/detailView/create/createDetailView.svelte +6 -6
- package/dist/detailView/create/createDetailView.svelte.d.ts +18 -0
- package/{src/lib/components → dist}/detailView/create/createDetailViewButton.svelte +2 -2
- package/dist/detailView/create/createDetailViewButton.svelte.d.ts +11 -0
- package/{src/lib/components → dist}/detailView/create/createManyView.svelte +5 -5
- package/dist/detailView/create/createManyView.svelte.d.ts +16 -0
- package/{src/lib/components → dist}/detailView/create/subRecords.svelte +1 -1
- package/dist/detailView/create/subRecords.svelte.d.ts +8 -0
- package/dist/detailView/detailViewForm.svelte.d.ts +48 -0
- package/dist/detailView/fieldCustomInput.svelte.d.ts +10 -0
- package/{src/lib/components → dist}/detailView/fieldInput.svelte +4 -4
- package/dist/detailView/fieldInput.svelte.d.ts +10 -0
- package/{src/lib/components → dist}/detailView/fieldInputReplacement.svelte +1 -1
- package/dist/detailView/fieldInputReplacement.svelte.d.ts +11 -0
- package/dist/detailView/store.svelte.d.ts +4 -0
- package/dist/detailView/store.svelte.js +125 -0
- package/{src/lib/components → dist}/detailView/update/children.svelte +4 -4
- package/dist/detailView/update/children.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/detailView/update/updateDetailView.svelte +6 -6
- package/dist/detailView/update/updateDetailView.svelte.d.ts +19 -0
- package/{src/lib/components → dist}/detailView/update/updateDetailViewButton.svelte +2 -2
- package/dist/detailView/update/updateDetailViewButton.svelte.d.ts +11 -0
- package/dist/detailView/utils.d.ts +8 -0
- package/dist/detailView/utils.js +165 -0
- package/{src/lib/components → dist}/diffViewer.svelte +1 -1
- package/dist/diffViewer.svelte.d.ts +9 -0
- package/{src/lib/components → dist}/drawer.svelte +1 -1
- package/dist/drawer.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/extensionsComponents.svelte +1 -2
- package/dist/extensionsComponents.svelte.d.ts +11 -0
- package/dist/foreingKeyInput.svelte.d.ts +11 -0
- package/{src/lib/components → dist}/header.svelte +1 -1
- package/dist/header.svelte.d.ts +6 -0
- package/dist/loadingTypesForMonacoEditor.d.ts +7 -0
- package/dist/loadingTypesForMonacoEditor.js +72 -0
- package/{src/lib/components → dist}/miniSidebar.svelte +7 -7
- package/dist/miniSidebar.svelte.d.ts +20 -0
- package/{src/lib/components → dist}/monacoEditor.svelte +1 -1
- package/dist/monacoEditor.svelte.d.ts +13 -0
- package/{src/lib/components → dist}/rangeCalendarButton.svelte +4 -4
- package/dist/rangeCalendarButton.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/selectRecord.svelte +1 -1
- package/dist/selectRecord.svelte.d.ts +15 -0
- package/{src/lib/components → dist}/setServerPage.svelte +2 -2
- package/dist/setServerPage.svelte.d.ts +18 -0
- package/{src/lib/components/sidebar/index.ts → dist/sidebar/index.d.ts} +1 -2
- package/dist/sidebar/index.js +3 -0
- package/{src/lib/components → dist}/sidebar/sidebar.svelte +1 -1
- package/dist/sidebar/sidebar.svelte.d.ts +17 -0
- package/dist/sidebar/sidebarElements.svelte.d.ts +19 -0
- package/dist/sidebar/sidebarTrigger.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/singletone.svelte +1 -1
- package/dist/singletone.svelte.d.ts +6 -0
- package/{src/lib/components → dist}/ui/accordion/accordion-content.svelte +1 -1
- package/dist/ui/accordion/accordion-content.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/accordion/accordion-item.svelte +1 -1
- package/dist/ui/accordion/accordion-item.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/accordion/accordion-trigger.svelte +1 -1
- package/dist/ui/accordion/accordion-trigger.svelte.d.ts +7 -0
- package/dist/ui/accordion/index.d.ts +6 -0
- package/{src/lib/components/ui/accordion/index.ts → dist/ui/accordion/index.js} +4 -13
- package/{src/lib/components → dist}/ui/alert/alert-description.svelte +1 -1
- package/dist/ui/alert/alert-description.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/alert/alert-title.svelte +1 -1
- package/dist/ui/alert/alert-title.svelte.d.ts +8 -0
- package/{src/lib/components → dist}/ui/alert/alert.svelte +1 -1
- package/dist/ui/alert/alert.svelte.d.ts +26 -0
- package/{src/lib/components/ui/alert/index.ts → dist/ui/alert/index.d.ts} +1 -10
- package/dist/ui/alert/index.js +7 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-action.svelte +2 -2
- package/dist/ui/alert-dialog/alert-dialog-action.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-cancel.svelte +2 -2
- package/dist/ui/alert-dialog/alert-dialog-cancel.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-content.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-content.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-description.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-description.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-footer.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-footer.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-header.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-header.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-overlay.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-overlay.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/alert-dialog/alert-dialog-title.svelte +1 -1
- package/dist/ui/alert-dialog/alert-dialog-title.svelte.d.ts +4 -0
- package/dist/ui/alert-dialog/index.d.ts +13 -0
- package/dist/ui/alert-dialog/index.js +15 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-ellipsis.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-ellipsis.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-item.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-item.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-link.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-link.svelte.d.ts +11 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-list.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-list.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-page.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-page.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb-separator.svelte +1 -1
- package/dist/ui/breadcrumb/breadcrumb-separator.svelte.d.ts +5 -0
- package/dist/ui/breadcrumb/breadcrumb.svelte.d.ts +5 -0
- package/{src/lib/components/ui/breadcrumb/index.ts → dist/ui/breadcrumb/index.d.ts} +1 -18
- package/dist/ui/breadcrumb/index.js +10 -0
- package/{src/lib/components → dist}/ui/button/button.svelte +1 -1
- package/dist/ui/button/button.svelte.d.ts +60 -0
- package/dist/ui/button/index.d.ts +2 -0
- package/dist/ui/button/index.js +4 -0
- package/{src/lib/components → dist}/ui/checkbox/checkbox.svelte +1 -1
- package/dist/ui/checkbox/checkbox.svelte.d.ts +4 -0
- package/dist/ui/checkbox/index.d.ts +2 -0
- package/dist/ui/checkbox/index.js +4 -0
- package/{src/lib/components → dist}/ui/command/command-dialog.svelte +1 -1
- package/dist/ui/command/command-dialog.svelte.d.ts +9 -0
- package/{src/lib/components → dist}/ui/command/command-empty.svelte +1 -1
- package/dist/ui/command/command-empty.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-group.svelte +1 -1
- package/dist/ui/command/command-group.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/ui/command/command-input.svelte +1 -1
- package/dist/ui/command/command-input.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-item.svelte +1 -1
- package/dist/ui/command/command-item.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-link-item.svelte +1 -1
- package/dist/ui/command/command-link-item.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-list.svelte +1 -1
- package/dist/ui/command/command-list.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-separator.svelte +1 -1
- package/dist/ui/command/command-separator.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/command/command-shortcut.svelte +1 -1
- package/dist/ui/command/command-shortcut.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/command/command.svelte +1 -1
- package/dist/ui/command/command.svelte.d.ts +4 -0
- package/{src/lib/components/ui/command/index.ts → dist/ui/command/index.d.ts} +2 -29
- package/dist/ui/command/index.js +15 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-content.svelte +1 -1
- package/dist/ui/dialog/dialog-content.svelte.d.ts +9 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-description.svelte +1 -1
- package/dist/ui/dialog/dialog-description.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-footer.svelte +1 -1
- package/dist/ui/dialog/dialog-footer.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-header.svelte +1 -1
- package/dist/ui/dialog/dialog-header.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-overlay.svelte +1 -1
- package/dist/ui/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/dialog/dialog-title.svelte +1 -1
- package/dist/ui/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/ui/dialog/index.d.ts +12 -0
- package/dist/ui/dialog/index.js +14 -0
- package/dist/ui/input/index.d.ts +2 -0
- package/dist/ui/input/index.js +4 -0
- package/{src/lib/components → dist}/ui/input/input.svelte +1 -1
- package/dist/ui/input/input.svelte.d.ts +13 -0
- package/dist/ui/label/index.d.ts +2 -0
- package/dist/ui/label/index.js +4 -0
- package/{src/lib/components → dist}/ui/label/label.svelte +1 -1
- package/dist/ui/label/label.svelte.d.ts +4 -0
- package/dist/ui/popover/index.d.ts +6 -0
- package/dist/ui/popover/index.js +8 -0
- package/{src/lib/components → dist}/ui/popover/popover-content.svelte +1 -1
- package/dist/ui/popover/popover-content.svelte.d.ts +7 -0
- package/{src/lib/components/ui/range-calendar/index.ts → dist/ui/range-calendar/index.d.ts} +1 -17
- package/dist/ui/range-calendar/index.js +16 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-cell.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-cell.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-day.svelte +2 -2
- package/dist/ui/range-calendar/range-calendar-day.svelte.d.ts +6 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-grid-body.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-grid-body.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-grid-head.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-grid-head.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-grid-row.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-grid-row.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-grid.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-grid.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-head-cell.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-head-cell.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-header.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-header.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-heading.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-heading.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-months.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar-months.svelte.d.ts +5 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-next-button.svelte +2 -2
- package/dist/ui/range-calendar/range-calendar-next-button.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar-prev-button.svelte +2 -2
- package/dist/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/range-calendar/range-calendar.svelte +1 -1
- package/dist/ui/range-calendar/range-calendar.svelte.d.ts +5 -0
- package/dist/ui/select/index.d.ts +11 -0
- package/dist/ui/select/index.js +13 -0
- package/{src/lib/components → dist}/ui/select/select-content.svelte +1 -1
- package/dist/ui/select/select-content.svelte.d.ts +7 -0
- package/{src/lib/components → dist}/ui/select/select-group-heading.svelte +1 -1
- package/dist/ui/select/select-group-heading.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/select/select-item.svelte +1 -1
- package/dist/ui/select/select-item.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/select/select-scroll-down-button.svelte +1 -1
- package/dist/ui/select/select-scroll-down-button.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/select/select-scroll-up-button.svelte +1 -1
- package/dist/ui/select/select-scroll-up-button.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/select/select-separator.svelte +2 -2
- package/dist/ui/select/select-separator.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/ui/select/select-trigger.svelte +1 -1
- package/dist/ui/select/select-trigger.svelte.d.ts +4 -0
- package/dist/ui/separator/index.d.ts +2 -0
- package/dist/ui/separator/index.js +4 -0
- package/{src/lib/components → dist}/ui/separator/separator.svelte +1 -1
- package/dist/ui/separator/separator.svelte.d.ts +4 -0
- package/dist/ui/skeleton/index.d.ts +2 -0
- package/dist/ui/skeleton/index.js +4 -0
- package/{src/lib/components → dist}/ui/skeleton/skeleton.svelte +1 -1
- package/dist/ui/skeleton/skeleton.svelte.d.ts +5 -0
- package/dist/ui/sonner/index.js +1 -0
- package/dist/ui/sonner/sonner.svelte.d.ts +4 -0
- package/dist/ui/switch/index.d.ts +2 -0
- package/dist/ui/switch/index.js +4 -0
- package/{src/lib/components → dist}/ui/switch/switch.svelte +1 -1
- package/dist/ui/switch/switch.svelte.d.ts +4 -0
- package/dist/ui/textarea/index.d.ts +2 -0
- package/dist/ui/textarea/index.js +4 -0
- package/{src/lib/components → dist}/ui/textarea/textarea.svelte +1 -1
- package/dist/ui/textarea/textarea.svelte.d.ts +5 -0
- package/dist/ui/tooltip/index.d.ts +6 -0
- package/dist/ui/tooltip/index.js +8 -0
- package/{src/lib/components → dist}/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/ui/tooltip/tooltip-content.svelte.d.ts +4 -0
- package/{src/lib/components → dist}/workflowEditor.svelte +5 -5
- package/dist/workflowEditor.svelte.d.ts +16 -0
- package/package.json +24 -14
- package/{vite-plugin-contextual-lib.js → vite-plugins/contextual-lib-alias.js} +2 -7
- package/vite-plugins/index.js +21 -0
- package/vite-plugins/studio-source-resolver.js +41 -0
- package/.env.example +0 -1
- package/.storybook/main.ts +0 -31
- package/.storybook/preview.ts +0 -21
- package/.storybook/vitest.setup.ts +0 -7
- package/components.json +0 -16
- package/docker-entrypoint.sh +0 -7
- package/dockerfile +0 -27
- package/index.html +0 -13
- package/public/lobb.svg +0 -15
- package/src/app.css +0 -121
- package/src/components-export.ts +0 -21
- package/src/extensions/extension.types.ts +0 -93
- package/src/extensions/extensionUtils.ts +0 -192
- package/src/lib/Lobb.ts +0 -241
- package/src/lib/components/confirmationDialog/store.svelte.ts +0 -28
- package/src/lib/components/dataTable/utils.ts +0 -127
- package/src/lib/components/detailView/store.svelte.ts +0 -61
- package/src/lib/components/detailView/utils.ts +0 -177
- package/src/lib/components/loadingTypesForMonacoEditor.ts +0 -36
- package/src/lib/components/ui/alert-dialog/index.ts +0 -40
- package/src/lib/components/ui/button/index.ts +0 -17
- package/src/lib/components/ui/checkbox/index.ts +0 -6
- package/src/lib/components/ui/dialog/index.ts +0 -37
- package/src/lib/components/ui/input/index.ts +0 -7
- package/src/lib/components/ui/label/index.ts +0 -7
- package/src/lib/components/ui/popover/index.ts +0 -17
- package/src/lib/components/ui/select/index.ts +0 -34
- package/src/lib/components/ui/separator/index.ts +0 -7
- package/src/lib/components/ui/skeleton/index.ts +0 -7
- package/src/lib/components/ui/switch/index.ts +0 -7
- package/src/lib/components/ui/textarea/index.ts +0 -7
- package/src/lib/components/ui/tooltip/index.ts +0 -18
- package/src/lib/eventSystem.ts +0 -38
- package/src/lib/index.ts +0 -40
- package/src/lib/store.svelte.ts +0 -21
- package/src/lib/store.types.ts +0 -28
- package/src/lib/utils.ts +0 -84
- package/src/main.ts +0 -18
- package/src/routes/collections/collection.svelte +0 -46
- package/src/routes/collections/collections.svelte +0 -43
- package/src/routes/data_model/dataModel.svelte +0 -40
- package/src/routes/data_model/flow.css +0 -22
- package/src/routes/data_model/flow.svelte +0 -82
- package/src/routes/data_model/syncManager.svelte +0 -93
- package/src/routes/data_model/utils.ts +0 -35
- package/src/routes/extensions/extension.svelte +0 -16
- package/src/routes/home.svelte +0 -36
- package/src/routes/workflows/workflows.svelte +0 -135
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/detailView/detailViewForm.stories.svelte +0 -79
- package/src/stories/examples/Button.stories.svelte +0 -31
- package/src/stories/examples/Button.svelte +0 -30
- package/src/stories/examples/Header.stories.svelte +0 -26
- package/src/stories/examples/Header.svelte +0 -45
- package/src/stories/examples/Page.stories.svelte +0 -29
- package/src/stories/examples/Page.svelte +0 -70
- package/src/stories/examples/button.css +0 -30
- package/src/stories/examples/header.css +0 -32
- package/src/stories/examples/page.css +0 -68
- package/src/vite-env.d.ts +0 -2
- package/svelte.config.js +0 -7
- package/todo.md +0 -24
- package/tsconfig.app.json +0 -25
- package/tsconfig.json +0 -14
- package/tsconfig.node.json +0 -24
- package/vite.build.svelte.config.ts +0 -18
- package/vite.config.ts +0 -84
- package/vite.extension.config.ts +0 -81
- package/vite_utils.ts +0 -28
- package/vitest.shims.d.ts +0 -1
- /package/{src/lib/components → dist}/dataTable/footer.svelte +0 -0
- /package/{src/lib/components → dist}/dataTable/table.svelte +0 -0
- /package/{src/lib/components → dist}/detailView/detailViewForm.svelte +0 -0
- /package/{src/lib/components → dist}/detailView/fieldCustomInput.svelte +0 -0
- /package/{src/lib/components → dist}/foreingKeyInput.svelte +0 -0
- /package/{src/lib/components → dist}/sidebar/sidebarElements.svelte +0 -0
- /package/{src/lib/components → dist}/sidebar/sidebarTrigger.svelte +0 -0
- /package/{src/lib/components → dist}/ui/breadcrumb/breadcrumb.svelte +0 -0
- /package/{src/lib/components/ui/sonner/index.ts → dist/ui/sonner/index.d.ts} +0 -0
- /package/{src/lib/components → dist}/ui/sonner/sonner.svelte +0 -0
package/src/lib/Lobb.ts
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import qs from "qs";
|
|
2
|
-
import { parseFunction } from "./utils";
|
|
3
|
-
|
|
4
|
-
interface RouteParams {
|
|
5
|
-
method: string;
|
|
6
|
-
route: string;
|
|
7
|
-
payload?: any;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type OnResponseHandlers = (reponse: Response) => void;
|
|
11
|
-
|
|
12
|
-
export class Lobb {
|
|
13
|
-
public lobbUrl: string;
|
|
14
|
-
private headers: HeadersInit = [];
|
|
15
|
-
private onResponseHandlers: Array<OnResponseHandlers> = [];
|
|
16
|
-
|
|
17
|
-
constructor(lobbUrl: string) {
|
|
18
|
-
this.lobbUrl = lobbUrl;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public async onResponse(callback: OnResponseHandlers) {
|
|
22
|
-
this.onResponseHandlers.push(callback);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public setHeaders(headers: HeadersInit) {
|
|
26
|
-
this.headers = headers;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public getHeaders() {
|
|
30
|
-
return this.headers;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public async getMeta() {
|
|
34
|
-
const response = await fetch(`${this.lobbUrl}/api/meta`, {
|
|
35
|
-
headers: this.headers,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const metaResponse = await this.handleResponse(response);
|
|
39
|
-
const meta = await metaResponse.json();
|
|
40
|
-
|
|
41
|
-
meta.studio_workflows = meta.studio_workflows.map((workflow: any) => {
|
|
42
|
-
return {
|
|
43
|
-
...workflow,
|
|
44
|
-
handler: parseFunction(workflow.handler),
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return meta;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// CRUD methods
|
|
52
|
-
public async findAll(collectionName: string, params: any) {
|
|
53
|
-
const response = await fetch(
|
|
54
|
-
`${this.lobbUrl}/api/collections/${collectionName}/search`,
|
|
55
|
-
{
|
|
56
|
-
method: "POST",
|
|
57
|
-
headers: this.headers,
|
|
58
|
-
body: JSON.stringify(params),
|
|
59
|
-
},
|
|
60
|
-
);
|
|
61
|
-
return await this.handleResponse(response);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public async findOne(
|
|
65
|
-
collectionName: string,
|
|
66
|
-
id: string,
|
|
67
|
-
queryParams?: any,
|
|
68
|
-
) {
|
|
69
|
-
queryParams = queryParams ? `?${qs.stringify(queryParams)}` : "";
|
|
70
|
-
const response = await fetch(
|
|
71
|
-
`${this.lobbUrl}/api/collections/${collectionName}/${id}${queryParams}`,
|
|
72
|
-
{
|
|
73
|
-
method: "GET",
|
|
74
|
-
headers: this.headers,
|
|
75
|
-
},
|
|
76
|
-
);
|
|
77
|
-
return await this.handleResponse(response);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public async createOne(collectionName: string, body: any, file?: File) {
|
|
81
|
-
if (file) {
|
|
82
|
-
const formData = new FormData();
|
|
83
|
-
Object.keys(body).forEach((key) => {
|
|
84
|
-
formData.append(key, body[key]);
|
|
85
|
-
});
|
|
86
|
-
formData.append("file", file, file.name);
|
|
87
|
-
formData.append(
|
|
88
|
-
"payload",
|
|
89
|
-
JSON.stringify({
|
|
90
|
-
data: body,
|
|
91
|
-
}),
|
|
92
|
-
);
|
|
93
|
-
body = formData;
|
|
94
|
-
} else {
|
|
95
|
-
body = JSON.stringify({
|
|
96
|
-
data: body,
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const response = await fetch(
|
|
100
|
-
`${this.lobbUrl}/api/collections/${collectionName}`,
|
|
101
|
-
{
|
|
102
|
-
method: "POST",
|
|
103
|
-
headers: this.headers,
|
|
104
|
-
body,
|
|
105
|
-
},
|
|
106
|
-
);
|
|
107
|
-
return await this.handleResponse(response);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
public async updateOne(collectionName: string, id: string, body: any) {
|
|
111
|
-
const response = await fetch(
|
|
112
|
-
`${this.lobbUrl}/api/collections/${collectionName}/${id}`,
|
|
113
|
-
{
|
|
114
|
-
method: "PATCH",
|
|
115
|
-
headers: this.headers,
|
|
116
|
-
body: JSON.stringify({
|
|
117
|
-
data: body,
|
|
118
|
-
}),
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
return await this.handleResponse(response);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public async readSingleton(
|
|
125
|
-
collectionName: string,
|
|
126
|
-
) {
|
|
127
|
-
const response = await fetch(
|
|
128
|
-
`${this.lobbUrl}/api/collections/${collectionName}/singleton`,
|
|
129
|
-
{
|
|
130
|
-
method: "GET",
|
|
131
|
-
headers: this.headers,
|
|
132
|
-
},
|
|
133
|
-
);
|
|
134
|
-
return await this.handleResponse(response);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
public async updateSingleton(
|
|
138
|
-
collectionName: string,
|
|
139
|
-
body: Record<string, any>
|
|
140
|
-
) {
|
|
141
|
-
const response = await fetch(
|
|
142
|
-
`${this.lobbUrl}/api/collections/${collectionName}/singleton`,
|
|
143
|
-
{
|
|
144
|
-
method: "PATCH",
|
|
145
|
-
headers: this.headers,
|
|
146
|
-
body: JSON.stringify({
|
|
147
|
-
data: body,
|
|
148
|
-
}),
|
|
149
|
-
},
|
|
150
|
-
);
|
|
151
|
-
return await this.handleResponse(response);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public async deleteOne(collectionName: string, id: string, force = false) {
|
|
155
|
-
const response = await fetch(
|
|
156
|
-
`${this.lobbUrl}/api/collections/${collectionName}/${id}${force ? "?force" : ""}`,
|
|
157
|
-
{
|
|
158
|
-
method: "DELETE",
|
|
159
|
-
headers: this.headers,
|
|
160
|
-
},
|
|
161
|
-
);
|
|
162
|
-
return await this.handleResponse(response);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public async deleteMany(collectionName: string, filter: any, force = false) {
|
|
166
|
-
const response = await fetch(
|
|
167
|
-
`${this.lobbUrl}/api/collections/${collectionName}${force ? "?force" : ""}`,
|
|
168
|
-
{
|
|
169
|
-
method: "DELETE",
|
|
170
|
-
headers: this.headers,
|
|
171
|
-
body: JSON.stringify({
|
|
172
|
-
filter,
|
|
173
|
-
}),
|
|
174
|
-
},
|
|
175
|
-
);
|
|
176
|
-
return await this.handleResponse(response);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
public async createMany(collectionName: string, body: any) {
|
|
180
|
-
body = JSON.stringify({
|
|
181
|
-
data: body,
|
|
182
|
-
});
|
|
183
|
-
const response = await fetch(
|
|
184
|
-
`${this.lobbUrl}/api/collections/${collectionName}`,
|
|
185
|
-
{
|
|
186
|
-
method: "POST",
|
|
187
|
-
headers: this.headers,
|
|
188
|
-
body,
|
|
189
|
-
},
|
|
190
|
-
);
|
|
191
|
-
return await this.handleResponse(response);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
public async updateMany(collectionName: string, body: any, filter: any) {
|
|
195
|
-
const response = await fetch(
|
|
196
|
-
`${this.lobbUrl}/api/collections/${collectionName}`,
|
|
197
|
-
{
|
|
198
|
-
method: "PATCH",
|
|
199
|
-
headers: this.headers,
|
|
200
|
-
body: JSON.stringify({
|
|
201
|
-
filter,
|
|
202
|
-
data: body,
|
|
203
|
-
}),
|
|
204
|
-
},
|
|
205
|
-
);
|
|
206
|
-
return await this.handleResponse(response);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
public async transactions(body: any[], rollback?: boolean) {
|
|
210
|
-
const response = await fetch(
|
|
211
|
-
`${this.lobbUrl}/api/collections/transactions${
|
|
212
|
-
rollback ? "?rollback" : ""
|
|
213
|
-
}`,
|
|
214
|
-
{
|
|
215
|
-
method: "POST",
|
|
216
|
-
headers: this.headers,
|
|
217
|
-
body: JSON.stringify(body),
|
|
218
|
-
},
|
|
219
|
-
);
|
|
220
|
-
return await this.handleResponse(response);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// CUSTOM REQUEST methods
|
|
224
|
-
public async request(params: RouteParams) {
|
|
225
|
-
const response = await fetch(`${this.lobbUrl}${params.route}`, {
|
|
226
|
-
method: params.method,
|
|
227
|
-
headers: this.headers,
|
|
228
|
-
body: JSON.stringify(params.payload),
|
|
229
|
-
});
|
|
230
|
-
return await this.handleResponse(response);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// HELPER methods
|
|
234
|
-
private async handleResponse(response: Response): Promise<Response> {
|
|
235
|
-
for (let index = 0; index < this.onResponseHandlers.length; index++) {
|
|
236
|
-
const handler = this.onResponseHandlers[index];
|
|
237
|
-
handler(response.clone());
|
|
238
|
-
}
|
|
239
|
-
return response;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { mount, unmount } from "svelte";
|
|
2
|
-
import ConfirmationDialog from "./confirmationDialog.svelte";
|
|
3
|
-
|
|
4
|
-
export function showDialog(title: string, description: string): Promise<boolean> {
|
|
5
|
-
return new Promise((resolve) => {
|
|
6
|
-
const targetElement = document.querySelector('main');
|
|
7
|
-
|
|
8
|
-
if (!targetElement) {
|
|
9
|
-
throw new Error("main html element doesn't exist for some reason");
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const mountedElement = mount(ConfirmationDialog, {
|
|
13
|
-
target: targetElement,
|
|
14
|
-
props: {
|
|
15
|
-
title,
|
|
16
|
-
description,
|
|
17
|
-
onDecision: async (result: boolean) => {
|
|
18
|
-
resolve(result);
|
|
19
|
-
await unmount(mountedElement, {
|
|
20
|
-
outro: true
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
console.log("the dialog is mounted man")
|
|
27
|
-
});
|
|
28
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { TableProps } from "./table.svelte";
|
|
2
|
-
|
|
3
|
-
import { ctx } from "$lib/store.svelte";
|
|
4
|
-
import {
|
|
5
|
-
Binary,
|
|
6
|
-
Braces,
|
|
7
|
-
Brackets,
|
|
8
|
-
Calendar,
|
|
9
|
-
CalendarClock,
|
|
10
|
-
Clock,
|
|
11
|
-
Hash,
|
|
12
|
-
Key,
|
|
13
|
-
Text,
|
|
14
|
-
Type,
|
|
15
|
-
} from "lucide-svelte/icons";
|
|
16
|
-
|
|
17
|
-
export function getCollectionColumns(collectionName: string): TableProps['columns'] {
|
|
18
|
-
const collectionFields = getFields(collectionName);
|
|
19
|
-
const headers: TableProps['columns'] = [];
|
|
20
|
-
for (const fieldName in collectionFields) {
|
|
21
|
-
const field = collectionFields[fieldName];
|
|
22
|
-
headers.push({
|
|
23
|
-
id: field.key,
|
|
24
|
-
subtext: field.type,
|
|
25
|
-
icon: getFieldIcon(fieldName, collectionName),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return headers;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getFieldIcon(fieldName: string, collectionName: string) {
|
|
32
|
-
const field = getField(fieldName, collectionName);
|
|
33
|
-
if (fieldName === "id") {
|
|
34
|
-
return Key;
|
|
35
|
-
} else if (field.type === "string") {
|
|
36
|
-
return Type;
|
|
37
|
-
} else if (field.type === "text") {
|
|
38
|
-
return Text;
|
|
39
|
-
} else if (field.type === "object") {
|
|
40
|
-
return Braces;
|
|
41
|
-
} else if (field.type === "array") {
|
|
42
|
-
return Brackets;
|
|
43
|
-
} else if (field.type === "bool") {
|
|
44
|
-
return Binary;
|
|
45
|
-
} else if (field.type === "integer") {
|
|
46
|
-
return Hash;
|
|
47
|
-
} else if (field.type === "long") {
|
|
48
|
-
return Hash;
|
|
49
|
-
} else if (field.type === "float") {
|
|
50
|
-
return Hash;
|
|
51
|
-
} else if (field.type === "decimal") {
|
|
52
|
-
return Hash;
|
|
53
|
-
} else if (field.type === "date") {
|
|
54
|
-
return Calendar;
|
|
55
|
-
} else if (field.type === "datetime") {
|
|
56
|
-
return CalendarClock;
|
|
57
|
-
} else if (field.type === "time") {
|
|
58
|
-
return Clock;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
throw new Error(`(${field.type}) doesnt have an icon`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function getFields(collectionName: string) {
|
|
65
|
-
return ctx.meta.collections[collectionName].fields;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function getField(fieldName: string, collectionName: string) {
|
|
69
|
-
return getFields(collectionName)[fieldName];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function getCollectionPrimaryField(collectionName: string): string | undefined {
|
|
73
|
-
const collectionFields =
|
|
74
|
-
ctx.meta.collections[collectionName].fields;
|
|
75
|
-
|
|
76
|
-
const primaryFieldObject: any = Object.values(collectionFields).find(
|
|
77
|
-
(field) => (field as any).type === "string",
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
primaryFieldObject &&
|
|
82
|
-
typeof primaryFieldObject === "object" &&
|
|
83
|
-
"key" in primaryFieldObject
|
|
84
|
-
) {
|
|
85
|
-
const fieldName = primaryFieldObject.key;
|
|
86
|
-
return fieldName;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function getCollectionParamsFields(collectionName: string, allFields = false) {
|
|
91
|
-
const relations = ctx.meta.relations;
|
|
92
|
-
const foreignFields = relations
|
|
93
|
-
.filter((relation) => {
|
|
94
|
-
return relation.from.collection === collectionName
|
|
95
|
-
})
|
|
96
|
-
.map((relation) => {
|
|
97
|
-
return {
|
|
98
|
-
field: relation.from.field,
|
|
99
|
-
collection: relation.to.collection,
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const columns = [];
|
|
104
|
-
for (let index = 0; index < foreignFields.length; index++) {
|
|
105
|
-
const foreignField = foreignFields[index];
|
|
106
|
-
if (!foreignField.collection) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
columns.push(`${foreignField.field}.id`);
|
|
110
|
-
|
|
111
|
-
if (!allFields) {
|
|
112
|
-
const primaryField = getCollectionPrimaryField(foreignField.collection)
|
|
113
|
-
if (primaryField) {
|
|
114
|
-
columns.push(`${foreignField.field}.${primaryField}`);
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
const fieldNames = Object.keys(ctx.meta.collections[foreignField.collection].fields);
|
|
118
|
-
for (let index = 0; index < fieldNames.length; index++) {
|
|
119
|
-
const fieldName = fieldNames[index];
|
|
120
|
-
columns.push(`${foreignField.field}.${fieldName}`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const foreignColumns = columns.join(",");
|
|
126
|
-
return `*${foreignColumns ? `,${foreignColumns}` : ""}`;
|
|
127
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { CreateDetailViewProp } from "./create/createDetailView.svelte";
|
|
2
|
-
import type { UpdateDetailViewProp } from "./update/updateDetailView.svelte";
|
|
3
|
-
import CreateDetailView from "./create/createDetailView.svelte";
|
|
4
|
-
import UpdateDetailView from "./update/updateDetailView.svelte";
|
|
5
|
-
import { lobb } from "$lib";
|
|
6
|
-
import { getCollectionParamsFields } from "../dataTable/utils";
|
|
7
|
-
import { mount, unmount } from "svelte";
|
|
8
|
-
|
|
9
|
-
export function openCreateDetailView(props: CreateDetailViewProp) {
|
|
10
|
-
const targetElement = document.querySelector('main');
|
|
11
|
-
|
|
12
|
-
if (!targetElement) {
|
|
13
|
-
throw new Error("main html element doesn't exist for some reason")
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const mountedCreateDetailView = mount(CreateDetailView, {
|
|
17
|
-
target: targetElement,
|
|
18
|
-
props: {
|
|
19
|
-
...props,
|
|
20
|
-
onCancel: async () => {
|
|
21
|
-
props.onCancel?.()
|
|
22
|
-
await unmount(mountedCreateDetailView, {
|
|
23
|
-
outro: true
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export async function openUpdateDetailView(props: UpdateDetailViewProp) {
|
|
31
|
-
let params = {
|
|
32
|
-
fields: getCollectionParamsFields(props.collectionName, true),
|
|
33
|
-
filter: {
|
|
34
|
-
id: props.recordId,
|
|
35
|
-
},
|
|
36
|
-
limit: 1,
|
|
37
|
-
};
|
|
38
|
-
const response = await lobb.findAll(props.collectionName, params);
|
|
39
|
-
const result = await response.json();
|
|
40
|
-
const entry = result.data[0];
|
|
41
|
-
|
|
42
|
-
const targetElement = document.querySelector('main');
|
|
43
|
-
|
|
44
|
-
if (!targetElement) {
|
|
45
|
-
throw new Error("main html element doesn't exist for some reason")
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const mountedUpdateDetailView = mount(UpdateDetailView, {
|
|
49
|
-
target: targetElement,
|
|
50
|
-
props: {
|
|
51
|
-
...props,
|
|
52
|
-
onCancel: async () => {
|
|
53
|
-
props.onCancel?.()
|
|
54
|
-
await unmount(mountedUpdateDetailView, {
|
|
55
|
-
outro: true
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
values: entry,
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import Mustache from "mustache";
|
|
2
|
-
import { ctx } from "$lib/store.svelte";
|
|
3
|
-
import { getFieldRelation } from "$lib/utils";
|
|
4
|
-
import { getField } from "../dataTable/utils";
|
|
5
|
-
import type { DetailFormField } from "./detailViewForm.svelte";
|
|
6
|
-
|
|
7
|
-
export function getDefaultEntry(fieldNames: string[], collectionName: string, values?: Record<string, any>) {
|
|
8
|
-
return Object.fromEntries(
|
|
9
|
-
fieldNames.map((fieldName) => {
|
|
10
|
-
let value = null;
|
|
11
|
-
const field = getField(fieldName, collectionName);
|
|
12
|
-
if (values && values[fieldName] !== undefined) {
|
|
13
|
-
value = values[fieldName];
|
|
14
|
-
} else if (field.pre_processors?.default) {
|
|
15
|
-
const defualtValue = field.pre_processors.default;
|
|
16
|
-
if (typeof defualtValue === "string") {
|
|
17
|
-
value = Mustache.render(defualtValue, {
|
|
18
|
-
now: new Date().toISOString(),
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
value = defualtValue;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return [fieldName, value];
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function serializeEntry(
|
|
30
|
-
collectionName: string,
|
|
31
|
-
entry: Record<string, any>,
|
|
32
|
-
rollback: boolean = false,
|
|
33
|
-
) {
|
|
34
|
-
// deep clone the object
|
|
35
|
-
entry = { ...entry }
|
|
36
|
-
|
|
37
|
-
// serialize the foreign key field's value
|
|
38
|
-
for (const [fieldName, fieldValue] of Object.entries(entry)) {
|
|
39
|
-
const isRefrenceField = Boolean(getFieldRelation(collectionName, fieldName));
|
|
40
|
-
if (isRefrenceField && fieldValue !== null && fieldValue.id !== undefined) {
|
|
41
|
-
entry[fieldName] = fieldValue.id;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// check for related collections properties and serialize them too
|
|
46
|
-
if (!rollback) {
|
|
47
|
-
const childrenRelations = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName);
|
|
48
|
-
const childrenCollectionNames = childrenRelations.map((relation) => relation.from.collection);
|
|
49
|
-
for (let index = 0; index < childrenCollectionNames.length; index++) {
|
|
50
|
-
const childrenCollectionName = childrenCollectionNames[index];
|
|
51
|
-
const childrenEntries = entry[childrenCollectionName];
|
|
52
|
-
if (childrenEntries) {
|
|
53
|
-
for (let index = 0; index < childrenEntries.length; index++) {
|
|
54
|
-
childrenEntries[index] = serializeEntry(childrenCollectionName, childrenEntries[index]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return entry;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function generateTransactionBody(
|
|
64
|
-
collectionName: string,
|
|
65
|
-
entry: Record<string, any>,
|
|
66
|
-
) {
|
|
67
|
-
entry = { ...entry }
|
|
68
|
-
function handleEntryRecursive(
|
|
69
|
-
transactionBody: any[],
|
|
70
|
-
collectionName: string,
|
|
71
|
-
entry: Record<string, any>,
|
|
72
|
-
parentTransactionIndex?: number,
|
|
73
|
-
) {
|
|
74
|
-
const parentCollectionName = parentTransactionIndex !== undefined ? transactionBody[parentTransactionIndex].collection : null;
|
|
75
|
-
const foreignKeyFieldName = ctx.meta.relations.find(relation => relation.from.collection === collectionName && relation.to.collection === parentCollectionName)?.from.field;
|
|
76
|
-
const collectionFieldNames = Object.keys(ctx.meta.collections[collectionName].fields);
|
|
77
|
-
const payload: any = {};
|
|
78
|
-
for (let index = 0; index < collectionFieldNames.length; index++) {
|
|
79
|
-
const fieldName = collectionFieldNames[index];
|
|
80
|
-
const isForeignKeyField = fieldName === foreignKeyFieldName;
|
|
81
|
-
if (isForeignKeyField) {
|
|
82
|
-
payload[fieldName] = `{{ responses[${parentTransactionIndex}].data.id }}`
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
payload[fieldName] = entry[fieldName];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const localTransactionIndex = transactionBody.length;
|
|
90
|
-
if (payload.id) {
|
|
91
|
-
const localPayload = {
|
|
92
|
-
[foreignKeyFieldName]: payload[foreignKeyFieldName],
|
|
93
|
-
};
|
|
94
|
-
transactionBody.push({
|
|
95
|
-
collection: collectionName,
|
|
96
|
-
method: "updateMany",
|
|
97
|
-
args: [
|
|
98
|
-
localPayload,
|
|
99
|
-
{
|
|
100
|
-
id: payload.id
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
transactionBody.push({
|
|
106
|
-
collection: collectionName,
|
|
107
|
-
method: "createOne",
|
|
108
|
-
args: [payload],
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const childrenRelations = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName);
|
|
113
|
-
const childrenCollectionNames = childrenRelations.map((relation) => relation.from.collection);
|
|
114
|
-
for (let index = 0; index < childrenCollectionNames.length; index++) {
|
|
115
|
-
const childrenCollectionName = childrenCollectionNames[index];
|
|
116
|
-
const childrenEntries = entry[childrenCollectionName];
|
|
117
|
-
if (childrenEntries) {
|
|
118
|
-
for (let index = 0; index < childrenEntries.length; index++) {
|
|
119
|
-
const childrenEntry = childrenEntries[index];
|
|
120
|
-
handleEntryRecursive(transactionBody, childrenCollectionName, childrenEntry, localTransactionIndex);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const transactionBody: any[] = [];
|
|
127
|
-
|
|
128
|
-
handleEntryRecursive(transactionBody, collectionName, entry);
|
|
129
|
-
|
|
130
|
-
return transactionBody
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function parseDetailViewValues(collectionName: string, values: Record<string, any>) {
|
|
134
|
-
const forignFieldNames = ctx.meta.relations
|
|
135
|
-
.filter((relation) => relation.from.collection === collectionName)
|
|
136
|
-
.map((relation) => relation.from.field);
|
|
137
|
-
const childCollectionNames = ctx.meta.relations
|
|
138
|
-
.filter((relation) => relation.to.collection === collectionName)
|
|
139
|
-
.map((relation) => relation.from.collection);
|
|
140
|
-
|
|
141
|
-
for (const [key, value] of Object.entries(values)) {
|
|
142
|
-
if (forignFieldNames.includes(key)) {
|
|
143
|
-
if (typeof value === 'number') {
|
|
144
|
-
values[key] = {
|
|
145
|
-
id: value,
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
} else if (childCollectionNames.includes(key)) {
|
|
149
|
-
for (let index = 0; index < values[key].length; index++) {
|
|
150
|
-
parseDetailViewValues(key, values[key][index]);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function getCollectionFields(collectionName: string) {
|
|
157
|
-
let returnedData: DetailFormField[] = [];
|
|
158
|
-
|
|
159
|
-
const collectionFields = ctx.meta.collections[collectionName].fields;
|
|
160
|
-
const isSingleton = ctx.meta.collections[collectionName].singleton;
|
|
161
|
-
for (const [fieldName, value] of Object.entries(collectionFields)) {
|
|
162
|
-
|
|
163
|
-
if (isSingleton && fieldName === "id") {
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
returnedData.push({
|
|
168
|
-
type: "input",
|
|
169
|
-
key: fieldName,
|
|
170
|
-
label: fieldName,
|
|
171
|
-
disabled: fieldName == "id",
|
|
172
|
-
placeholder: fieldName == "id" ? "AUTO_GENERATED" : "",
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return returnedData;
|
|
177
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TODO
|
|
3
|
-
*
|
|
4
|
-
* this file shows an example of downloading the types files of a library from npm to use them in adding type support of that library in the vscode editor
|
|
5
|
-
* so the whole point is that for users to be able to paste a url from npm or jsr of a library and have all ts support from its types
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { gunzipSync } from "fflate";
|
|
9
|
-
import { untar } from "@andrewbranch/untar.js";
|
|
10
|
-
|
|
11
|
-
async function extractTgz(buffer: ArrayBuffer) {
|
|
12
|
-
const tarBuffer = gunzipSync(new Uint8Array(buffer));
|
|
13
|
-
|
|
14
|
-
const cleanBuffer = tarBuffer.buffer.slice(
|
|
15
|
-
tarBuffer.byteOffset,
|
|
16
|
-
tarBuffer.byteOffset + tarBuffer.byteLength,
|
|
17
|
-
);
|
|
18
|
-
const files = await untar(cleanBuffer as ArrayBuffer);
|
|
19
|
-
|
|
20
|
-
const dtsFiles = [];
|
|
21
|
-
|
|
22
|
-
for (const file of files) {
|
|
23
|
-
if (file.filename.endsWith(".d.ts")) {
|
|
24
|
-
const content = new TextDecoder().decode(file.fileData);
|
|
25
|
-
dtsFiles.push({ name: file.filename, content });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return dtsFiles;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const tgzURL = "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz";
|
|
33
|
-
const response = await fetch(tgzURL);
|
|
34
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
35
|
-
|
|
36
|
-
const files = await extractTgz(arrayBuffer);
|