@contember/create 2.1.0-alpha.3 → 2.1.0-alpha.30
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/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -0
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -0
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +24 -5
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +24 -5
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/development/src/lib/packageManagerDetector.js +22 -0
- package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -0
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -0
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +24 -5
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +24 -5
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
- package/dist/production/src/lib/packageManagerDetector.js +22 -0
- package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +1 -0
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/lib/packageManagerDetector.d.ts +3 -0
- package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/resources/templates/default/.gitignore.dist +154 -0
- package/resources/templates/default/README.md +98 -0
- package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
- package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
- package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
- package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
- package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
- package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
- package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
- package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
- package/resources/templates/default/admin/entrypoint/config.ts +35 -0
- package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
- package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
- package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
- package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +63 -0
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
- package/resources/templates/default/admin/index.css +94 -0
- package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
- package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +8 -8
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +59 -0
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +3 -1
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +147 -0
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/BlockElement.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/editor/sortable-block.tsx +1 -1
- package/resources/templates/default/admin/lib/form/container.tsx +66 -0
- package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +4 -6
- package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +19 -9
- package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/form/upload-repeaters.tsx +61 -28
- package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +6 -3
- package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +6 -6
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/toast/toast.tsx +4 -5
- package/resources/templates/{template-workspace → default}/admin/lib/ui/button.tsx +6 -6
- package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +6 -6
- package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
- package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +14 -14
- package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/switch.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +2 -3
- package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +2 -2
- package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -4
- package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +1 -1
- package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +3 -3
- package/resources/templates/{template-workspace → default}/admin/package.json +5 -2
- package/resources/templates/default/admin/postcss.config.js +5 -0
- package/resources/templates/default/admin/sentry.ts +26 -0
- package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
- package/resources/templates/default/admin/vite-env.d.ts +12 -0
- package/resources/templates/default/admin/vite.config.ts +11 -0
- package/resources/templates/default/api/README.md +87 -0
- package/resources/templates/{template-workspace → default}/biome.json +1 -1
- package/resources/templates/default/client/README.md +285 -0
- package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
- package/resources/templates/{template-workspace → default}/package.json +1 -1
- package/resources/templates/default/scripts/generate-client.sh +7 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
- package/src/commands/WorkspaceCreateCommand.ts +41 -24
- package/src/lib/FileSystem.ts +1 -0
- package/src/lib/TemplateInstaller.ts +30 -7
- package/src/lib/packageManagerDetector.ts +24 -0
- package/resources/templates/template-workspace/.gitignore.dist +0 -3
- package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
- package/resources/templates/template-workspace/admin/index.css +0 -53
- package/resources/templates/template-workspace/admin/index.tsx +0 -268
- package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
- package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
- package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
- package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
- package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
- package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
- package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
- package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
- /package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
- /package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
- /package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/identity.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/buttons.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/multi-select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/select/sortable-select.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +0 -0
- /package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +0 -0
- /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
- /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
- /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
- /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
- /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
- /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
|
@@ -2,12 +2,12 @@ import * as TogglePrimitive from '@radix-ui/react-toggle'
|
|
|
2
2
|
import { ConfigVariants, uic, uiconfig } from '../utils'
|
|
3
3
|
|
|
4
4
|
export const toggleConfig = uiconfig({
|
|
5
|
-
baseClass: 'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-
|
|
5
|
+
baseClass: 'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent data-[active]:shadow-inner data-[active]:text-accent-foreground',
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
default: 'bg-transparent',
|
|
9
9
|
outline:
|
|
10
|
-
'border border-input bg-transparent shadow-
|
|
10
|
+
'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
|
|
11
11
|
},
|
|
12
12
|
size: {
|
|
13
13
|
default: 'h-8 px-3',
|
|
@@ -25,4 +25,3 @@ export type ToggleProps = ConfigVariants<Exclude<typeof toggleConfig.variants, u
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
export const Toggle = uic(TogglePrimitive.Root, toggleConfig)
|
|
28
|
-
|
|
@@ -12,8 +12,8 @@ export const TooltipContent = uic(TooltipPrimitive.Content, {
|
|
|
12
12
|
baseClass: 'z-50 overflow-hidden p-2 text-sm text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
13
13
|
variants: {
|
|
14
14
|
variant: {
|
|
15
|
-
default: 'rounded-md border bg-popover shadow-md',
|
|
16
|
-
blurred: 'rounded-md backdrop-blur shadow-md border',
|
|
15
|
+
default: 'rounded-md border border-gray-200 bg-popover shadow-md',
|
|
16
|
+
blurred: 'rounded-md backdrop-blur-sm shadow-md border border-gray-200',
|
|
17
17
|
seamless: '',
|
|
18
18
|
},
|
|
19
19
|
},
|
|
@@ -3,9 +3,9 @@ import { Loader } from '../ui/loader'
|
|
|
3
3
|
import { GripIcon } from 'lucide-react'
|
|
4
4
|
import { uic } from '../utils/uic'
|
|
5
5
|
|
|
6
|
-
export const UploaderDropzoneWrapperUI = uic('div', { baseClass: 'rounded border p-1 shadow' })
|
|
6
|
+
export const UploaderDropzoneWrapperUI = uic('div', { baseClass: 'rounded-sm border border-gray-200 p-1 shadow-sm' })
|
|
7
7
|
export const UploaderDropzoneAreaUI = uic('div', {
|
|
8
|
-
baseClass: `h-40 w-40 flex flex-col gap-1 justify-center items-center py-4 border-dashed border-2 border-gray-300 rounded relative
|
|
8
|
+
baseClass: `h-40 w-40 flex flex-col gap-1 justify-center items-center py-4 border-dashed border-2 border-gray-300 rounded-sm relative
|
|
9
9
|
transition-colors
|
|
10
10
|
hover:border-gray-300 hover:bg-gray-50 hover:cursor-pointer
|
|
11
11
|
data-[dropzone-accept]:border-green-500 group-data-[dropzone-accept]:bg-green-100
|
|
@@ -23,7 +23,7 @@ export const UploaderDropzoneAreaUI = uic('div', {
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
export const UploaderItemUI = uic('div', {
|
|
26
|
-
baseClass: 'rounded border p-1 shadow bg-gray-100 flex gap-2 relative',
|
|
26
|
+
baseClass: 'rounded-sm border border-gray-200 p-1 shadow-sm bg-gray-100 flex gap-2 relative',
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ export const UploaderRepeaterItemsWrapperUI = uic('div', {
|
|
|
37
37
|
})
|
|
38
38
|
export const UploaderRepeaterItemUI = UploaderItemUI
|
|
39
39
|
export const UploaderRepeaterDragOverlayUI = uic('div', {
|
|
40
|
-
baseClass: 'rounded border border-gray-300 p-4 relative bg-
|
|
40
|
+
baseClass: 'rounded-sm border border-gray-300 p-4 relative bg-gray-100/60 backdrop-blur-xs',
|
|
41
41
|
})
|
|
42
42
|
export const UploaderRepeaterHandleUI = uic('button', {
|
|
43
43
|
baseClass: 'absolute top-0 left-0 h-6 w-6 inline-flex justify-center align-center opacity-10 hover:opacity-100 transition-opacity z-10',
|
package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx
RENAMED
|
@@ -45,7 +45,7 @@ export const UploaderFileProgressUI = ({ file, progress, info, actions }: { file
|
|
|
45
45
|
const extension = file.name.split('.').pop()?.toUpperCase()
|
|
46
46
|
|
|
47
47
|
return (
|
|
48
|
-
<div className="border-t p-2 flex-1">
|
|
48
|
+
<div className="border-t border-gray-200 p-2 flex-1">
|
|
49
49
|
<div className="flex items-center gap-2">
|
|
50
50
|
<div className="relative">
|
|
51
51
|
<FileIcon className="w-10 h-10 text-gray-400" />
|
|
@@ -130,7 +130,7 @@ export const UploadedAnyView = Component<UploadedAnyViewProps>(({ DestroyAction,
|
|
|
130
130
|
const AnyFilePreview = Component(({ urlField, fileNameField }: FileUrlDataExtractorProps & GenericFileMetadataExtractorProps) => <>
|
|
131
131
|
<FieldView<string> field={urlField} render={({ value: url }) => (
|
|
132
132
|
url ? <a href={url ?? '#'} target="_blank" rel="noreferrer"
|
|
133
|
-
className="text-blue-600 hover:text-blue-700 underline overflow-hidden whitespace-nowrap
|
|
133
|
+
className="text-blue-600 hover:text-blue-700 underline overflow-hidden whitespace-nowrap text-ellipsis flex flex-col group/anchor flex-1 items-center justify-center">
|
|
134
134
|
<FileIcon className="h-16 w-16 text-gray-400 group-hover/anchor:text-gray-500 transition-all" />
|
|
135
135
|
{fileNameField ? <span><Field field={fileNameField} /></span> : null}
|
|
136
136
|
</a> : null)} />
|
|
@@ -154,7 +154,7 @@ const Metadata = Component(({ children, urlField, fileSizeField, fileNameField,
|
|
|
154
154
|
<MetaField field={lastModifiedField} label="Date:" format={formatDate} />
|
|
155
155
|
<MetaField field={urlField} label="URL:" format={url => (
|
|
156
156
|
<a href={url} target="_blank" rel="noreferrer"
|
|
157
|
-
className="text-blue-600 underline overflow-hidden whitespace-nowrap
|
|
157
|
+
className="text-blue-600 underline overflow-hidden whitespace-nowrap text-ellipsis">
|
|
158
158
|
{url.replace(/^(.{15}).*(.{15})$/, '$1…$2')}
|
|
159
159
|
</a>
|
|
160
160
|
)} />
|
|
@@ -191,7 +191,7 @@ const FileActions = Component(({ DestroyAction, metadata, actions, edit, baseFie
|
|
|
191
191
|
metadata?: ReactNode
|
|
192
192
|
} & BaseFileViewProps) => {
|
|
193
193
|
return (
|
|
194
|
-
<div className="absolute -top-2 -right-1 p-0.5 bg-gray-200 border border-gray-300 rounded shadow flex gap-2 opacity-0 transition-opacity group-hover:opacity-100">
|
|
194
|
+
<div className="absolute -top-2 -right-1 p-0.5 bg-gray-200 border border-gray-300 rounded-sm shadow-sm flex gap-2 opacity-0 transition-opacity group-hover:opacity-100">
|
|
195
195
|
{actions}
|
|
196
196
|
{edit && <Popover>
|
|
197
197
|
<PopoverTrigger asChild>
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@contember/vite-plugin": "{version}",
|
|
12
|
+
"@tailwindcss/postcss": "^4",
|
|
12
13
|
"@types/react": "^18",
|
|
13
14
|
"@types/react-dom": "^18",
|
|
14
15
|
"@vitejs/plugin-react": "^4.2.1",
|
|
15
|
-
"autoprefixer": "^10",
|
|
16
16
|
"postcss": "^8",
|
|
17
|
-
"tailwindcss": "^
|
|
17
|
+
"tailwindcss": "^4",
|
|
18
18
|
"tailwindcss-animate": "^1.0.7",
|
|
19
19
|
"vite": "^6"
|
|
20
20
|
},
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@contember/react-uploader": "{version}",
|
|
38
38
|
"@contember/react-uploader-dropzone": "{version}",
|
|
39
39
|
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
40
|
+
"@radix-ui/react-avatar": "^1.1.3",
|
|
40
41
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
41
42
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
42
43
|
"@radix-ui/react-label": "^2.1.0",
|
|
@@ -45,12 +46,14 @@
|
|
|
45
46
|
"@radix-ui/react-progress": "^1.1.0",
|
|
46
47
|
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
47
48
|
"@radix-ui/react-select": "^2.1.2",
|
|
49
|
+
"@radix-ui/react-separator": "^1.1.2",
|
|
48
50
|
"@radix-ui/react-slot": "^1.1.0",
|
|
49
51
|
"@radix-ui/react-switch": "^1.1.1",
|
|
50
52
|
"@radix-ui/react-toast": "^1.2.2",
|
|
51
53
|
"@radix-ui/react-toggle": "^1.1.0",
|
|
52
54
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
53
55
|
"@radix-ui/react-tooltip": "^1.1.3",
|
|
56
|
+
"@sentry/react": "^8.47.0",
|
|
54
57
|
"class-variance-authority": "^0.7.0",
|
|
55
58
|
"clsx": "^2.1.1",
|
|
56
59
|
"lucide-react": "^0.451.0",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/react'
|
|
2
|
+
|
|
3
|
+
const sentryDsn = import.meta.env.VITE_SENTRY_DSN
|
|
4
|
+
const enableSentry = sentryDsn && import.meta.env.MODE === 'production'
|
|
5
|
+
const projectName = import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME
|
|
6
|
+
|
|
7
|
+
Sentry.init({
|
|
8
|
+
enabled: enableSentry,
|
|
9
|
+
dsn: sentryDsn,
|
|
10
|
+
integrations: [
|
|
11
|
+
Sentry.browserApiErrorsIntegration(),
|
|
12
|
+
Sentry.browserSessionIntegration(),
|
|
13
|
+
Sentry.browserTracingIntegration(),
|
|
14
|
+
Sentry.captureConsoleIntegration({ levels: ['error'] }),
|
|
15
|
+
Sentry.replayIntegration(),
|
|
16
|
+
],
|
|
17
|
+
initialScope: {
|
|
18
|
+
tags: {
|
|
19
|
+
environment: import.meta.env.MODE,
|
|
20
|
+
projectName: projectName,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
tracesSampleRate: 1,
|
|
24
|
+
replaysSessionSampleRate: 0,
|
|
25
|
+
replaysOnErrorSampleRate: 1,
|
|
26
|
+
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly VITE_CONTEMBER_ADMIN_API_BASE_URL: string
|
|
5
|
+
readonly VITE_CONTEMBER_ADMIN_SESSION_TOKEN: string
|
|
6
|
+
readonly VITE_CONTEMBER_ADMIN_LOGIN_TOKEN: string
|
|
7
|
+
readonly VITE_CONTEMBER_ADMIN_PROJECT_NAME: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ImportMeta {
|
|
11
|
+
readonly env: ImportMetaEnv
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import contember from '@contember/vite-plugin'
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
3
|
+
import react from '@vitejs/plugin-react'
|
|
4
|
+
import { defineConfig } from 'vite'
|
|
5
|
+
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
6
|
+
|
|
7
|
+
export default defineConfig(() => {
|
|
8
|
+
return {
|
|
9
|
+
plugins: [tsconfigPaths(), react(), contember()],
|
|
10
|
+
}
|
|
11
|
+
})
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Contember API
|
|
2
|
+
|
|
3
|
+
Typesafe GraphQL API for managing content and data.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This API project defines the data model and permissions for the Contember API. It is built with the Contember platform, a headless CMS that provides a powerful GraphQL API for managing content and data.
|
|
8
|
+
|
|
9
|
+
## Project Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
├── migrations/ # Database migrations
|
|
13
|
+
└── model/ # Data model definitions
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
- **`migrations/`**: Stores database migration scripts to manage schema changes and data migrations.
|
|
17
|
+
- **`model/`**: Contains the definitions for entities, fields, relations, and permissions.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Key Concepts
|
|
22
|
+
|
|
23
|
+
### Migrations
|
|
24
|
+
Database schema changes are managed through **migrations**. These include both schema alterations and data transformations. Use the Contember CLI to create, amend, or execute migrations.
|
|
25
|
+
|
|
26
|
+
### Data Model
|
|
27
|
+
Defines your application's **entities**, **fields**, **relations**, and **permissions**, serving as the blueprint for your GraphQL API.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Using the Contember CLI
|
|
32
|
+
|
|
33
|
+
The **Contember CLI** is a command-line tool for managing migrations, the data model, and permissions. For detailed guidance, see the [Contember CLI Documentation](https://docs.contember.com/reference/cli/).
|
|
34
|
+
|
|
35
|
+
To view all available commands, run:
|
|
36
|
+
```bash
|
|
37
|
+
yarn run contember
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Common Commands
|
|
43
|
+
|
|
44
|
+
Run these commands from the root of the project directory.
|
|
45
|
+
|
|
46
|
+
#### Amend the Latest Migration
|
|
47
|
+
Modify the most recent migration file to refine your changes:
|
|
48
|
+
```bash
|
|
49
|
+
yarn run contember migrations:amend
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
#### Generate a Schema Migration Diff
|
|
53
|
+
Create a migration diff for a specific project:
|
|
54
|
+
```bash
|
|
55
|
+
yarn run contember migrations:diff <migration-name>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Execute Migrations
|
|
59
|
+
Apply migrations to a Contember instance:
|
|
60
|
+
```bash
|
|
61
|
+
yarn run contember migrations:execute
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Shortcut Commands
|
|
65
|
+
All commands support minimal unique prefixes. For example:
|
|
66
|
+
- `yarn run contember m:a` → Shortcut for `migrations:amend`
|
|
67
|
+
- `yarn run contember m:d` → Shortcut for `migrations:diff`
|
|
68
|
+
|
|
69
|
+
[Contember CLI Reference](https://docs.contember.com/reference/cli/)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
# How to work with Actions locally
|
|
74
|
+
|
|
75
|
+
To test or debug Actions with a local Cloudflare worker running on http://localhost:8787, you need to access the worker from within the Docker container. Docker uses a special DNS name, `host.docker.internal`, which resolves to the host machine's internal IP address.
|
|
76
|
+
|
|
77
|
+
For example, to set up a Contember Action that communicates with the worker, use the following configuration:
|
|
78
|
+
```
|
|
79
|
+
@c.Watch({
|
|
80
|
+
name: 'action_name',
|
|
81
|
+
watch: `fields_to_watch`,
|
|
82
|
+
webhook: 'http://host.docker.internal:8787',
|
|
83
|
+
selection: 'optional_selection_for_payload',
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
[Contember Actions Documentation](https://docs.contember.com/reference/engine/actions/definition)
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# Contember GraphQL Client Documentation
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. [Getting Started](#getting-started)
|
|
5
|
+
2. [Basic Operations](#basic-operations)
|
|
6
|
+
3. [Working with Relations](#working-with-relations)
|
|
7
|
+
4. [Advanced Queries](#advanced-queries)
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Client Setup
|
|
12
|
+
```typescript
|
|
13
|
+
import { ContentClient } from '@contember/client-content'
|
|
14
|
+
import { GraphQlClient } from '@contember/graphql-client'
|
|
15
|
+
|
|
16
|
+
const graphQlClient = new GraphQlClient({
|
|
17
|
+
url: 'http://localhost:1481/content/app/live',
|
|
18
|
+
apiToken: '0000000000000000000000000000000000000000'
|
|
19
|
+
})
|
|
20
|
+
const client = new ContentClient(graphQlClient)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Basic Operations
|
|
24
|
+
|
|
25
|
+
### Reading Data
|
|
26
|
+
|
|
27
|
+
#### Get Single Entity
|
|
28
|
+
```typescript
|
|
29
|
+
// Get by ID
|
|
30
|
+
const entity = await client.query(
|
|
31
|
+
queryBuilder.get('Entity',
|
|
32
|
+
{ by: { id: 'entity-id' } },
|
|
33
|
+
it => it.$('field1').$('field2')
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
// Get by unique field
|
|
38
|
+
const entity = await client.query(
|
|
39
|
+
queryBuilder.get('Entity',
|
|
40
|
+
{ by: { unique: 'value' } },
|
|
41
|
+
it => it.$('field1').$('field2')
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### List Entities
|
|
47
|
+
```typescript
|
|
48
|
+
const entities = await client.query(
|
|
49
|
+
queryBuilder.list('Entity', {
|
|
50
|
+
filter: { publishedAt: { lte: 'now' } },
|
|
51
|
+
limit: 50,
|
|
52
|
+
offset: 0,
|
|
53
|
+
orderBy: [{ publishedAt: 'desc' }]
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Creating Data
|
|
59
|
+
|
|
60
|
+
#### Create Single Entity
|
|
61
|
+
```typescript
|
|
62
|
+
await client.mutate(
|
|
63
|
+
queryBuilder.create('Entity', {
|
|
64
|
+
data: {
|
|
65
|
+
title: 'New Entity',
|
|
66
|
+
description: 'Description'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Updating Data
|
|
73
|
+
|
|
74
|
+
#### Update Entity
|
|
75
|
+
```typescript
|
|
76
|
+
await client.mutate(
|
|
77
|
+
queryBuilder.update('Entity', {
|
|
78
|
+
by: { id: 'entity-id' },
|
|
79
|
+
data: {
|
|
80
|
+
title: 'Updated Title'
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
await client.mutate(
|
|
88
|
+
queryBuilder.upsert('Entity', {
|
|
89
|
+
by: { id: 'entity-id' },
|
|
90
|
+
create: {
|
|
91
|
+
title: 'New Entity'
|
|
92
|
+
},
|
|
93
|
+
update: {
|
|
94
|
+
title: 'Updated Title'
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Deleting Data
|
|
101
|
+
|
|
102
|
+
#### Delete Entity
|
|
103
|
+
```typescript
|
|
104
|
+
await client.mutate(
|
|
105
|
+
queryBuilder.delete('Entity', {
|
|
106
|
+
by: { id: 'entity-id' }
|
|
107
|
+
})
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Working with Relations
|
|
112
|
+
|
|
113
|
+
### HasOne Relations
|
|
114
|
+
|
|
115
|
+
#### Create with Relation
|
|
116
|
+
```typescript
|
|
117
|
+
await client.mutate(
|
|
118
|
+
queryBuilder.create('Entity', {
|
|
119
|
+
data: {
|
|
120
|
+
title: 'Main Entity',
|
|
121
|
+
relation: {
|
|
122
|
+
create: {
|
|
123
|
+
title: 'Related Entity'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### Connect Existing Entity
|
|
132
|
+
```typescript
|
|
133
|
+
await client.mutate(
|
|
134
|
+
queryBuilder.update('Entity', {
|
|
135
|
+
by: { id: 'entity-id' },
|
|
136
|
+
data: {
|
|
137
|
+
relation: {
|
|
138
|
+
connect: { id: 'related-id' }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Disconnect Relation
|
|
146
|
+
```typescript
|
|
147
|
+
await client.mutate(
|
|
148
|
+
queryBuilder.update('Entity', {
|
|
149
|
+
by: { id: 'entity-id' },
|
|
150
|
+
data: {
|
|
151
|
+
relation: {
|
|
152
|
+
disconnect: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Delete Relation
|
|
160
|
+
```typescript
|
|
161
|
+
await client.mutate(
|
|
162
|
+
queryBuilder.update('Entity', {
|
|
163
|
+
by: { id: 'entity-id' },
|
|
164
|
+
data: {
|
|
165
|
+
relation: {
|
|
166
|
+
delete: true
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### HasMany Relations
|
|
174
|
+
|
|
175
|
+
#### Add Multiple Relations
|
|
176
|
+
```typescript
|
|
177
|
+
await client.mutate(
|
|
178
|
+
queryBuilder.create('Entity', {
|
|
179
|
+
data: {
|
|
180
|
+
title: 'Main Entity',
|
|
181
|
+
relations: [
|
|
182
|
+
{ create: { title: 'Related 1' } },
|
|
183
|
+
{ connect: { id: 'related-id' } },
|
|
184
|
+
{
|
|
185
|
+
connectOrCreate: {
|
|
186
|
+
connect: { id: 'related-id' },
|
|
187
|
+
create: { title: 'New Related' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Update Multiple Relations
|
|
197
|
+
```typescript
|
|
198
|
+
await client.mutate(
|
|
199
|
+
queryBuilder.update('Entity', {
|
|
200
|
+
by: { id: 'entity-id' },
|
|
201
|
+
data: {
|
|
202
|
+
relations: [
|
|
203
|
+
{ create: { title: 'New Related' } },
|
|
204
|
+
{ connect: { id: 'related-id' } },
|
|
205
|
+
{
|
|
206
|
+
connectOrCreate: {
|
|
207
|
+
connect: { id: 'related-id' },
|
|
208
|
+
create: { title: 'New Related' },
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
upsert: {
|
|
213
|
+
by: { id: 'related-id' },
|
|
214
|
+
create: { title: 'New Related' },
|
|
215
|
+
update: { title: 'Updated Related' },
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{ disconnect: { id: 'related-id-1' } },
|
|
219
|
+
{ delete: { id: 'related-id' } },
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Advanced Queries
|
|
227
|
+
|
|
228
|
+
### Using Fragments
|
|
229
|
+
```typescript
|
|
230
|
+
// Define fragment
|
|
231
|
+
const entityFragment = queryBuilder.fragment('Entity',
|
|
232
|
+
it => it.$('title').$('description')
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
// Use fragment in query
|
|
236
|
+
const entity = await client.query(
|
|
237
|
+
queryBuilder.get('Entity',
|
|
238
|
+
{ by: { id: 'entity-id' } },
|
|
239
|
+
entityFragment
|
|
240
|
+
)
|
|
241
|
+
)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Connecting or creating related entities
|
|
245
|
+
```typescript
|
|
246
|
+
await client.mutate(
|
|
247
|
+
queryBuilder.update('Entity', {
|
|
248
|
+
by: { id: 'entity-id' },
|
|
249
|
+
data: {
|
|
250
|
+
relation: {
|
|
251
|
+
connectOrCreate: {
|
|
252
|
+
connect: {
|
|
253
|
+
id: 'related-id'
|
|
254
|
+
},
|
|
255
|
+
create: {
|
|
256
|
+
title: 'Updated Related Entity'
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Multiple Queries
|
|
266
|
+
```typescript
|
|
267
|
+
const { entity1, entity2List } = await client.query({
|
|
268
|
+
entity1: queryBuilder.get('Entity1',
|
|
269
|
+
{ by: { id: 'id1' } },
|
|
270
|
+
it => it.$$()
|
|
271
|
+
),
|
|
272
|
+
entity2List: queryBuilder.list('Entity2',
|
|
273
|
+
it => it.$$()
|
|
274
|
+
)
|
|
275
|
+
})
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Counting Entities
|
|
279
|
+
```typescript
|
|
280
|
+
const count = await client.query(
|
|
281
|
+
queryBuilder.count('Entity', {
|
|
282
|
+
filter: { status: { eq: 'published' } }
|
|
283
|
+
})
|
|
284
|
+
)
|
|
285
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
docker-compose run --rm --entrypoint="" contember-cli sh -c "
|
|
4
|
+
bun /opt/contember/run.js project:print-schema --format=schema > /tmp/contember-schema.json
|
|
5
|
+
bun run --silent contember-client-generator /tmp/contember-schema.json ./client/src
|
|
6
|
+
rm /tmp/contember-schema.json
|
|
7
|
+
"
|