opacacms 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.lock +34 -0
- package/dist/admin/api-client.d.ts +8 -0
- package/dist/admin/auth-client.d.ts +940 -0
- package/dist/admin/custom-field.d.ts +71 -0
- package/dist/admin/index.d.ts +11 -0
- package/dist/admin/react.d.ts +3 -0
- package/dist/admin/router.d.ts +7 -0
- package/dist/admin/stores/admin-queries.d.ts +32 -0
- package/dist/admin/stores/auth.d.ts +33 -0
- package/dist/admin/stores/column-visibility.d.ts +21 -0
- package/dist/admin/stores/config.d.ts +7 -0
- package/dist/admin/stores/media.d.ts +44 -0
- package/dist/admin/stores/query.d.ts +4 -0
- package/dist/admin/stores/ui.d.ts +11 -0
- package/dist/admin/ui/admin-client.d.ts +7 -0
- package/dist/admin/ui/admin-layout.d.ts +14 -0
- package/dist/admin/ui/components/ColumnVisibilityToggle.d.ts +10 -0
- package/dist/admin/ui/components/DataDetailSheet.d.ts +13 -0
- package/dist/admin/ui/components/DataDetailView.d.ts +9 -0
- package/dist/admin/ui/components/Table.d.ts +10 -0
- package/dist/admin/ui/components/fields/ArrayField.d.ts +13 -0
- package/dist/admin/ui/components/fields/BlocksField.d.ts +17 -0
- package/dist/admin/ui/components/fields/BooleanField.d.ts +13 -0
- package/dist/admin/ui/components/fields/CollapsibleField.d.ts +16 -0
- package/dist/admin/ui/components/fields/DateField.d.ts +13 -0
- package/dist/admin/ui/components/fields/FileField.d.ts +23 -0
- package/dist/admin/ui/components/fields/GroupField.d.ts +13 -0
- package/dist/admin/ui/components/fields/JoinField.d.ts +15 -0
- package/dist/admin/ui/components/fields/NumberField.d.ts +14 -0
- package/dist/admin/ui/components/fields/RadioField.d.ts +17 -0
- package/dist/admin/ui/components/fields/RelationshipField.d.ts +16 -0
- package/dist/admin/ui/components/fields/RowField.d.ts +12 -0
- package/dist/admin/ui/components/fields/SelectField.d.ts +18 -0
- package/dist/admin/ui/components/fields/TabsField.d.ts +15 -0
- package/dist/admin/ui/components/fields/TextAreaField.d.ts +14 -0
- package/dist/admin/ui/components/fields/TextField.d.ts +14 -0
- package/dist/admin/ui/components/fields/VirtualField.d.ts +8 -0
- package/dist/admin/ui/components/fields/index.d.ts +28 -0
- package/dist/admin/ui/components/fields/richtext-editor/index.d.ts +10 -0
- package/dist/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.d.ts +7 -0
- package/dist/admin/ui/components/fields/richtext-editor/nodes/ImageNode.d.ts +27 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.d.ts +5 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.d.ts +1 -0
- package/dist/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.d.ts +5 -0
- package/dist/admin/ui/components/fields/utils.d.ts +1 -0
- package/dist/admin/ui/components/link.d.ts +8 -0
- package/dist/admin/ui/components/media/AssetManagerModal.d.ts +17 -0
- package/dist/admin/ui/components/toast.d.ts +10 -0
- package/dist/admin/ui/components/ui/accordion.d.ts +11 -0
- package/dist/admin/ui/components/ui/alert-dialog.d.ts +12 -0
- package/dist/admin/ui/components/ui/blocks.d.ts +5 -0
- package/dist/admin/ui/components/ui/breadcrumbs.d.ts +7 -0
- package/dist/admin/ui/components/ui/button.d.ts +7 -0
- package/dist/admin/ui/components/ui/collapsible.d.ts +16 -0
- package/dist/admin/ui/components/ui/dialog.d.ts +27 -0
- package/dist/admin/ui/components/ui/group.d.ts +6 -0
- package/dist/admin/ui/components/ui/index.d.ts +17 -0
- package/dist/admin/ui/components/ui/input.d.ts +5 -0
- package/dist/admin/ui/components/ui/join.d.ts +7 -0
- package/dist/admin/ui/components/ui/label.d.ts +3 -0
- package/dist/admin/ui/components/ui/radio-group.d.ts +13 -0
- package/dist/admin/ui/components/ui/relationship-detail-sheet.d.ts +9 -0
- package/dist/admin/ui/components/ui/relationship.d.ts +8 -0
- package/dist/admin/ui/components/ui/scroll-area.d.ts +7 -0
- package/dist/admin/ui/components/ui/select.d.ts +37 -0
- package/dist/admin/ui/components/ui/separator.d.ts +8 -0
- package/dist/admin/ui/components/ui/sheet.d.ts +28 -0
- package/dist/admin/ui/components/ui/tabs.d.ts +17 -0
- package/dist/admin/ui/components/ui/utils.d.ts +1 -0
- package/dist/admin/ui/hooks/use-debounce.d.ts +1 -0
- package/dist/admin/ui/views/collection-list-view.d.ts +5 -0
- package/dist/admin/ui/views/dashboard-view.d.ts +10 -0
- package/dist/admin/ui/views/document-edit-view.d.ts +7 -0
- package/dist/admin/ui/views/global-edit-view.d.ts +19 -0
- package/dist/admin/ui/views/init-view.d.ts +4 -0
- package/dist/admin/ui/views/login-view.d.ts +4 -0
- package/dist/admin/ui/views/media-registry-view.d.ts +7 -0
- package/dist/admin/ui/views/settings-view.d.ts +7 -0
- package/dist/admin/webcomponent.d.ts +1 -0
- package/dist/api.d.ts +6 -0
- package/dist/auth/index.d.ts +2107 -0
- package/dist/auth/migrations.d.ts +5 -0
- package/dist/auth/premissions.d.ts +6 -0
- package/dist/chunk-16vgcf3k.js +88 -0
- package/dist/chunk-2zm8cy1w.js +9482 -0
- package/dist/chunk-5gvbp2qa.js +167 -0
- package/dist/chunk-62ev8gnc.js +41 -0
- package/dist/chunk-6dhs73zq.js +126 -0
- package/dist/chunk-6ew02s0c.js +472 -0
- package/dist/chunk-7a9kn0np.js +116 -0
- package/dist/chunk-8gkhn1d4.js +309 -0
- package/dist/chunk-8sqjbsgt.js +42 -0
- package/dist/chunk-9kxpbcb1.js +85 -0
- package/dist/chunk-cvdd4eqh.js +110 -0
- package/dist/chunk-d3ffeqp9.js +87 -0
- package/dist/chunk-dy5t83hr.js +261 -0
- package/dist/chunk-f3nvxn63.js +17 -0
- package/dist/chunk-hmhcense.js +1352 -0
- package/dist/chunk-j4d50hrx.js +20 -0
- package/dist/chunk-jwjk85ze.js +15 -0
- package/dist/chunk-kwp83w8b.js +250 -0
- package/dist/chunk-s8mqwnm1.js +14 -0
- package/dist/chunk-srsac177.js +85 -0
- package/dist/chunk-v521d72w.js +10 -0
- package/dist/chunk-xa7rjsn2.js +20 -0
- package/dist/chunk-xg35h5a3.js +15 -0
- package/dist/chunk-ybbbqj63.js +130 -0
- package/dist/chunk-zvwb67nd.js +332 -0
- package/dist/cli/commands/generate-types.d.ts +1 -0
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/migrate-commands.d.ts +5 -0
- package/dist/cli/commands/seed-command.d.ts +2 -0
- package/dist/cli/d1-mock.d.ts +30 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.test.d.ts +1 -0
- package/dist/cli/r2-mock.d.ts +46 -0
- package/dist/cli/seeding.d.ts +17 -0
- package/dist/client.d.ts +51 -0
- package/dist/config-utils.d.ts +6 -0
- package/dist/config.d.ts +10 -0
- package/dist/db/adapter.d.ts +34 -0
- package/dist/db/better-sqlite.d.ts +40 -0
- package/dist/db/bun-sqlite.d.ts +40 -0
- package/dist/db/d1.d.ts +42 -0
- package/dist/db/kysely/data-mapper.d.ts +6 -0
- package/dist/db/kysely/field-mapper.d.ts +22 -0
- package/dist/db/kysely/migration-generator.d.ts +9 -0
- package/dist/db/kysely/query-builder.d.ts +9 -0
- package/dist/db/kysely/schema-builder.d.ts +15 -0
- package/dist/db/kysely/sql-utils.d.ts +1 -0
- package/dist/db/postgres.d.ts +51 -0
- package/dist/db/sqlite.d.ts +41 -0
- package/dist/db/system-schema.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/runtimes/bun.d.ts +17 -0
- package/dist/runtimes/cloudflare-workers.d.ts +10 -0
- package/dist/runtimes/next.d.ts +16 -0
- package/dist/runtimes/node.d.ts +18 -0
- package/dist/schema/collection.d.ts +100 -0
- package/dist/schema/fields/base.d.ts +83 -0
- package/dist/schema/fields/index.d.ts +135 -0
- package/dist/schema/global.d.ts +82 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/infer.d.ts +55 -0
- package/dist/server/admin-router.d.ts +9 -0
- package/dist/server/admin.d.ts +18 -0
- package/dist/server/assets.d.ts +47 -0
- package/dist/server/collection-router.d.ts +14 -0
- package/dist/server/handlers.d.ts +76 -0
- package/dist/server/middlewares/admin.d.ts +6 -0
- package/dist/server/middlewares/auth.d.ts +16 -0
- package/dist/server/middlewares/context.d.ts +9 -0
- package/dist/server/middlewares/cors.d.ts +3 -0
- package/dist/server/middlewares/database-init.d.ts +11 -0
- package/dist/server/middlewares/rate-limit.d.ts +3 -0
- package/dist/server/router.d.ts +7 -0
- package/dist/server/setup-middlewares.d.ts +17 -0
- package/dist/server/system-router.d.ts +9 -0
- package/dist/server.d.ts +6 -0
- package/dist/src/admin/index.css +47 -0
- package/dist/src/admin/index.js +176 -0
- package/dist/src/admin/webcomponent.js +19 -0
- package/dist/src/api.js +27 -0
- package/dist/src/cli/index.js +157 -0
- package/dist/src/client.js +9 -0
- package/dist/src/db/bun-sqlite.js +523 -0
- package/dist/src/db/d1.js +568 -0
- package/dist/src/db/postgres.js +520 -0
- package/dist/src/db/sqlite.js +534 -0
- package/dist/src/index.js +20 -0
- package/dist/src/runtimes/bun.js +36 -0
- package/dist/src/runtimes/cloudflare-workers.js +29 -0
- package/dist/src/runtimes/next.js +26 -0
- package/dist/src/runtimes/node.js +38 -0
- package/dist/src/server.js +27 -0
- package/dist/src/storage/index.js +355 -0
- package/dist/storage/adapters/cloudflare-r2.d.ts +6 -0
- package/dist/storage/adapters/local.d.ts +6 -0
- package/dist/storage/adapters/s3.d.ts +13 -0
- package/dist/storage/errors.d.ts +12 -0
- package/dist/storage/index.d.ts +5 -0
- package/dist/storage/types.d.ts +31 -0
- package/dist/types.d.ts +484 -0
- package/dist/utils/lexical.d.ts +5 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/validation.d.ts +300 -0
- package/dist/validator.d.ts +9 -0
- package/global.d.ts +11 -0
- package/package.json +151 -0
- package/src/admin/api-client.ts +63 -0
- package/src/admin/auth-client.ts +40 -0
- package/src/admin/custom-field.ts +179 -0
- package/src/admin/index.ts +15 -0
- package/src/admin/react.tsx +72 -0
- package/src/admin/router.ts +9 -0
- package/src/admin/stores/admin-queries.ts +121 -0
- package/src/admin/stores/auth.ts +61 -0
- package/src/admin/stores/column-visibility.ts +67 -0
- package/src/admin/stores/config.ts +15 -0
- package/src/admin/stores/media.ts +95 -0
- package/src/admin/stores/query.ts +13 -0
- package/src/admin/stores/ui.ts +29 -0
- package/src/admin/ui/admin-client.tsx +283 -0
- package/src/admin/ui/admin-layout.tsx +276 -0
- package/src/admin/ui/components/ColumnVisibilityToggle.tsx +141 -0
- package/src/admin/ui/components/DataDetailSheet.tsx +141 -0
- package/src/admin/ui/components/DataDetailView.tsx +175 -0
- package/src/admin/ui/components/Table.tsx +67 -0
- package/src/admin/ui/components/fields/ArrayField.tsx +166 -0
- package/src/admin/ui/components/fields/BlocksField.tsx +202 -0
- package/src/admin/ui/components/fields/BooleanField.tsx +50 -0
- package/src/admin/ui/components/fields/CollapsibleField.tsx +75 -0
- package/src/admin/ui/components/fields/DateField.tsx +45 -0
- package/src/admin/ui/components/fields/FileField.tsx +322 -0
- package/src/admin/ui/components/fields/GroupField.tsx +50 -0
- package/src/admin/ui/components/fields/JoinField.tsx +23 -0
- package/src/admin/ui/components/fields/NumberField.tsx +46 -0
- package/src/admin/ui/components/fields/RadioField.tsx +62 -0
- package/src/admin/ui/components/fields/RelationshipField.tsx +278 -0
- package/src/admin/ui/components/fields/RowField.tsx +40 -0
- package/src/admin/ui/components/fields/SelectField.tsx +59 -0
- package/src/admin/ui/components/fields/TabsField.tsx +101 -0
- package/src/admin/ui/components/fields/TextAreaField.tsx +54 -0
- package/src/admin/ui/components/fields/TextField.tsx +49 -0
- package/src/admin/ui/components/fields/VirtualField.tsx +53 -0
- package/src/admin/ui/components/fields/index.tsx +371 -0
- package/src/admin/ui/components/fields/richtext-editor/index.tsx +211 -0
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageComponent.tsx +142 -0
- package/src/admin/ui/components/fields/richtext-editor/nodes/ImageNode.tsx +95 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/ComponentPickerPlugin.tsx +226 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/EditableSyncPlugin.tsx +16 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/NotionToolbarPlugin.tsx +184 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/SimpleToolbarPlugin.tsx +240 -0
- package/src/admin/ui/components/fields/richtext-editor/plugins/ValueSyncPlugin.tsx +40 -0
- package/src/admin/ui/components/fields/utils.ts +1 -0
- package/src/admin/ui/components/link.tsx +41 -0
- package/src/admin/ui/components/media/AssetManagerModal.tsx +334 -0
- package/src/admin/ui/components/toast.tsx +72 -0
- package/src/admin/ui/components/ui/accordion.tsx +51 -0
- package/src/admin/ui/components/ui/alert-dialog.tsx +98 -0
- package/src/admin/ui/components/ui/blocks.tsx +32 -0
- package/src/admin/ui/components/ui/breadcrumbs.tsx +59 -0
- package/src/admin/ui/components/ui/button.tsx +26 -0
- package/src/admin/ui/components/ui/collapsible.tsx +124 -0
- package/src/admin/ui/components/ui/dialog.tsx +79 -0
- package/src/admin/ui/components/ui/group.tsx +20 -0
- package/src/admin/ui/components/ui/index.ts +17 -0
- package/src/admin/ui/components/ui/input.tsx +12 -0
- package/src/admin/ui/components/ui/join.tsx +53 -0
- package/src/admin/ui/components/ui/label.tsx +11 -0
- package/src/admin/ui/components/ui/radio-group.tsx +75 -0
- package/src/admin/ui/components/ui/relationship-detail-sheet.tsx +122 -0
- package/src/admin/ui/components/ui/relationship.tsx +58 -0
- package/src/admin/ui/components/ui/scroll-area.tsx +19 -0
- package/src/admin/ui/components/ui/select.tsx +187 -0
- package/src/admin/ui/components/ui/separator.tsx +21 -0
- package/src/admin/ui/components/ui/sheet.tsx +106 -0
- package/src/admin/ui/components/ui/tabs.tsx +116 -0
- package/src/admin/ui/components/ui/utils.ts +3 -0
- package/src/admin/ui/hooks/use-debounce.ts +15 -0
- package/src/admin/ui/styles/_locale-switcher.scss +33 -0
- package/src/admin/ui/styles/accordion.scss +60 -0
- package/src/admin/ui/styles/animations.scss +41 -0
- package/src/admin/ui/styles/asset-manager.scss +547 -0
- package/src/admin/ui/styles/badge.scss +13 -0
- package/src/admin/ui/styles/base.scss +22 -0
- package/src/admin/ui/styles/button.scss +161 -0
- package/src/admin/ui/styles/card.scss +13 -0
- package/src/admin/ui/styles/collapsible.scss +75 -0
- package/src/admin/ui/styles/data-detail.scss +92 -0
- package/src/admin/ui/styles/dialog.scss +102 -0
- package/src/admin/ui/styles/empty-state.scss +22 -0
- package/src/admin/ui/styles/group.scss +19 -0
- package/src/admin/ui/styles/index.scss +33 -0
- package/src/admin/ui/styles/input.scss +80 -0
- package/src/admin/ui/styles/label.scss +12 -0
- package/src/admin/ui/styles/layout.scss +56 -0
- package/src/admin/ui/styles/lexical.scss +469 -0
- package/src/admin/ui/styles/loading.scss +102 -0
- package/src/admin/ui/styles/media-registry.scss +597 -0
- package/src/admin/ui/styles/pagination.scss +20 -0
- package/src/admin/ui/styles/radio-group.scss +66 -0
- package/src/admin/ui/styles/row.scss +17 -0
- package/src/admin/ui/styles/scrollbar.scss +36 -0
- package/src/admin/ui/styles/select.scss +121 -0
- package/src/admin/ui/styles/separator.scss +14 -0
- package/src/admin/ui/styles/sheet.scss +152 -0
- package/src/admin/ui/styles/sidebar.scss +148 -0
- package/src/admin/ui/styles/switch.scss +59 -0
- package/src/admin/ui/styles/table.scss +207 -0
- package/src/admin/ui/styles/tabs.scss +62 -0
- package/src/admin/ui/styles/toast.scss +45 -0
- package/src/admin/ui/styles/variables.scss +24 -0
- package/src/admin/ui/views/collection-list-view.tsx +720 -0
- package/src/admin/ui/views/dashboard-view.tsx +263 -0
- package/src/admin/ui/views/document-edit-view.tsx +384 -0
- package/src/admin/ui/views/global-edit-view.tsx +226 -0
- package/src/admin/ui/views/init-view.tsx +182 -0
- package/src/admin/ui/views/login-view.tsx +123 -0
- package/src/admin/ui/views/media-registry-view.tsx +1104 -0
- package/src/admin/ui/views/settings-view.tsx +729 -0
- package/src/admin/webcomponent.tsx +15 -0
- package/src/api.ts +9 -0
- package/src/auth/index.ts +194 -0
- package/src/auth/migrations.ts +87 -0
- package/src/auth/premissions.ts +46 -0
- package/src/cli/commands/generate-types.ts +116 -0
- package/src/cli/commands/init.ts +95 -0
- package/src/cli/commands/migrate-commands.ts +160 -0
- package/src/cli/commands/seed-command.ts +11 -0
- package/src/cli/d1-mock.ts +101 -0
- package/src/cli/index.test.ts +84 -0
- package/src/cli/index.ts +183 -0
- package/src/cli/r2-mock.ts +217 -0
- package/src/cli/seeding.ts +405 -0
- package/src/client.ts +181 -0
- package/src/config-utils.ts +102 -0
- package/src/config.ts +49 -0
- package/src/db/adapter.ts +53 -0
- package/src/db/better-sqlite.ts +630 -0
- package/src/db/bun-sqlite.ts +646 -0
- package/src/db/d1.ts +711 -0
- package/src/db/kysely/data-mapper.ts +142 -0
- package/src/db/kysely/field-mapper.ts +148 -0
- package/src/db/kysely/migration-generator.ts +223 -0
- package/src/db/kysely/query-builder.ts +92 -0
- package/src/db/kysely/schema-builder.ts +439 -0
- package/src/db/kysely/sql-utils.ts +13 -0
- package/src/db/postgres.ts +621 -0
- package/src/db/sqlite.ts +658 -0
- package/src/db/system-schema.ts +121 -0
- package/src/index.ts +13 -0
- package/src/runtimes/README.md +59 -0
- package/src/runtimes/bun.ts +49 -0
- package/src/runtimes/cloudflare-workers.ts +38 -0
- package/src/runtimes/next.ts +26 -0
- package/src/runtimes/node.ts +52 -0
- package/src/schema/collection.ts +184 -0
- package/src/schema/fields/base.ts +164 -0
- package/src/schema/fields/index.ts +427 -0
- package/src/schema/global.ts +145 -0
- package/src/schema/index.ts +4 -0
- package/src/schema/infer.ts +72 -0
- package/src/server/admin-router.ts +20 -0
- package/src/server/admin.ts +142 -0
- package/src/server/assets.ts +306 -0
- package/src/server/collection-router.ts +55 -0
- package/src/server/handlers.ts +722 -0
- package/src/server/middlewares/admin.ts +27 -0
- package/src/server/middlewares/auth.ts +89 -0
- package/src/server/middlewares/context.ts +17 -0
- package/src/server/middlewares/cors.ts +24 -0
- package/src/server/middlewares/database-init.ts +74 -0
- package/src/server/middlewares/rate-limit.ts +71 -0
- package/src/server/router.ts +47 -0
- package/src/server/setup-middlewares.ts +58 -0
- package/src/server/system-router.ts +35 -0
- package/src/server.ts +9 -0
- package/src/storage/adapters/cloudflare-r2.ts +136 -0
- package/src/storage/adapters/local.ts +146 -0
- package/src/storage/adapters/s3.ts +186 -0
- package/src/storage/errors.ts +46 -0
- package/src/storage/index.ts +5 -0
- package/src/storage/types.ts +39 -0
- package/src/types.ts +577 -0
- package/src/utils/lexical.ts +37 -0
- package/src/utils/logger.ts +73 -0
- package/src/validation.ts +429 -0
- package/src/validator.ts +179 -0
- package/test/admin-custom-field.test.ts +162 -0
- package/test/admin-react-field.test.tsx +134 -0
- package/test/api-features.test.ts +78 -0
- package/test/api.test.ts +178 -0
- package/test/auth.test.ts +62 -0
- package/test/cli-integration.test.ts +146 -0
- package/test/cli.test.ts +25 -0
- package/test/db/postgres.test.ts +95 -0
- package/test/db/sqlite-filter.test.ts +53 -0
- package/test/db/sqlite.test.ts +82 -0
- package/test/engine-features.test.ts +79 -0
- package/test/globals.test.ts +74 -0
- package/test/integration-tmp/db-app/opacacms.config.ts +15 -0
- package/test/integration-tmp/my-sqlite-app/opacacms.config.ts +25 -0
- package/test/integration-tmp/my-test-app/index.ts +8 -0
- package/test/integration-tmp/my-test-app/opacacms.config.ts +16 -0
- package/test/integration-tmp/my-test-app/package.json +12 -0
- package/test/populate.test.ts +79 -0
- package/test/runtimes.test.ts +43 -0
- package/test/schema-builder.test.ts +107 -0
- package/test/schema-features.test.ts +63 -0
- package/test/seeding.test.ts +68 -0
- package/test/storage/local.test.ts +72 -0
- package/test/storage/s3.test.ts +60 -0
- package/test/structural-data.test.ts +100 -0
- package/test/test-setup.ts +11 -0
- package/test/validation.test.ts +162 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/admin/stores/ui.ts
|
|
2
|
+
import { persistentAtom } from "@nanostores/persistent";
|
|
3
|
+
import { atom } from "nanostores";
|
|
4
|
+
var $toasts = atom([]);
|
|
5
|
+
var $isSidebarCollapsed = persistentAtom("opaca-sidebar-collapsed", false, {
|
|
6
|
+
encode: JSON.stringify,
|
|
7
|
+
decode: JSON.parse
|
|
8
|
+
});
|
|
9
|
+
function toggleSidebar() {
|
|
10
|
+
$isSidebarCollapsed.set(!$isSidebarCollapsed.get());
|
|
11
|
+
}
|
|
12
|
+
function notify(message, type = "success") {
|
|
13
|
+
const id = Math.random().toString(36).substring(2, 9);
|
|
14
|
+
$toasts.set([...$toasts.get(), { id, message, type }]);
|
|
15
|
+
}
|
|
16
|
+
function clearToast(id) {
|
|
17
|
+
$toasts.set($toasts.get().filter((t) => t.id !== id));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { $toasts, $isSidebarCollapsed, toggleSidebar, notify, clearToast };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import {
|
|
2
|
+
flattenFields,
|
|
3
|
+
mapFieldToPostgresType,
|
|
4
|
+
mapFieldToSQLiteType,
|
|
5
|
+
toSnakeCase
|
|
6
|
+
} from "./chunk-cvdd4eqh.js";
|
|
7
|
+
import"./chunk-8sqjbsgt.js";
|
|
8
|
+
|
|
9
|
+
// src/db/kysely/migration-generator.ts
|
|
10
|
+
function generateMigrationCode(collections, globals = [], dialect) {
|
|
11
|
+
const allSchemas = [...collections, ...globals];
|
|
12
|
+
const mapType = dialect === "postgres" ? mapFieldToPostgresType : mapFieldToSQLiteType;
|
|
13
|
+
const tsType = dialect === "postgres" ? "timestamp with time zone" : "text";
|
|
14
|
+
let upCode = "";
|
|
15
|
+
let downCode = "";
|
|
16
|
+
for (const collection of allSchemas) {
|
|
17
|
+
const slug = collection.slug;
|
|
18
|
+
const flattenedFields = flattenFields(collection.fields);
|
|
19
|
+
upCode += ` await db.schema.createTable('${slug}')
|
|
20
|
+
`;
|
|
21
|
+
upCode += ` .addColumn('id', 'text', (col) => col.primaryKey())
|
|
22
|
+
`;
|
|
23
|
+
for (const field of flattenedFields) {
|
|
24
|
+
if (field.type === "relationship" && "hasMany" in field && field.hasMany)
|
|
25
|
+
continue;
|
|
26
|
+
const colName = toSnakeCase(field.name);
|
|
27
|
+
if (colName === "id")
|
|
28
|
+
continue;
|
|
29
|
+
const colType = mapType(field);
|
|
30
|
+
const constraints = [];
|
|
31
|
+
if (field.required)
|
|
32
|
+
constraints.push("notNull()");
|
|
33
|
+
if (field.unique)
|
|
34
|
+
constraints.push("unique()");
|
|
35
|
+
if (field.defaultValue !== undefined) {
|
|
36
|
+
let val = field.defaultValue;
|
|
37
|
+
if (typeof val === "string") {
|
|
38
|
+
val = `'${val}'`;
|
|
39
|
+
} else if (typeof val === "boolean") {
|
|
40
|
+
val = dialect === "sqlite" || dialect === "d1" ? val ? 1 : 0 : val;
|
|
41
|
+
}
|
|
42
|
+
constraints.push(`defaultTo(${val})`);
|
|
43
|
+
}
|
|
44
|
+
const constraintChain = constraints.length > 0 ? `.${constraints.join(".")}` : "";
|
|
45
|
+
upCode += ` .addColumn('${colName}', '${colType}', (col) => col${constraintChain})
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
const ts = collection.timestamps !== false;
|
|
49
|
+
if (ts) {
|
|
50
|
+
const config = typeof collection.timestamps === "object" ? collection.timestamps : {};
|
|
51
|
+
const createdField = toSnakeCase(config.createdAt || "createdAt");
|
|
52
|
+
const updatedField = toSnakeCase(config.updatedAt || "updatedAt");
|
|
53
|
+
upCode += ` .addColumn('${createdField}', '${tsType}', (col) => col.defaultTo(sql\`CURRENT_TIMESTAMP\`))
|
|
54
|
+
`;
|
|
55
|
+
upCode += ` .addColumn('${updatedField}', '${tsType}', (col) => col.defaultTo(sql\`CURRENT_TIMESTAMP\`))
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
upCode += ` .execute();
|
|
59
|
+
|
|
60
|
+
`;
|
|
61
|
+
downCode = ` await db.schema.dropTable('${slug}').execute();
|
|
62
|
+
` + downCode;
|
|
63
|
+
for (const field of flattenedFields) {
|
|
64
|
+
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
65
|
+
const colName = toSnakeCase(field.name);
|
|
66
|
+
const joinTableName = `${slug}_${colName}_relations`.toLowerCase();
|
|
67
|
+
upCode += ` await db.schema.createTable('${joinTableName}')
|
|
68
|
+
`;
|
|
69
|
+
upCode += ` .addColumn('id', 'text', (col) => col.primaryKey())
|
|
70
|
+
`;
|
|
71
|
+
upCode += ` .addColumn('source_id', 'text', (col) => col.notNull())
|
|
72
|
+
`;
|
|
73
|
+
upCode += ` .addColumn('target_id', 'text', (col) => col.notNull())
|
|
74
|
+
`;
|
|
75
|
+
upCode += ` .addColumn('order', 'integer', (col) => col.defaultTo(0))
|
|
76
|
+
`;
|
|
77
|
+
upCode += ` .execute();
|
|
78
|
+
|
|
79
|
+
`;
|
|
80
|
+
downCode = ` await db.schema.dropTable('${joinTableName}').execute();
|
|
81
|
+
` + downCode;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const field of collection.fields) {
|
|
85
|
+
if (field.type === "blocks" && field.blocks && Array.isArray(field.blocks)) {
|
|
86
|
+
for (const block of field.blocks) {
|
|
87
|
+
const blockName = toSnakeCase(field.name);
|
|
88
|
+
const blockTableName = `${slug}_${blockName}_${block.slug}`.toLowerCase();
|
|
89
|
+
upCode += ` await db.schema.createTable('${blockTableName}')
|
|
90
|
+
`;
|
|
91
|
+
upCode += ` .addColumn('id', 'text', (col) => col.primaryKey())
|
|
92
|
+
`;
|
|
93
|
+
upCode += ` .addColumn('_parent_id', 'text', (col) => col.notNull())
|
|
94
|
+
`;
|
|
95
|
+
upCode += ` .addColumn('_order', 'integer', (col) => col.defaultTo(0))
|
|
96
|
+
`;
|
|
97
|
+
upCode += ` .addColumn('block_type', 'text', (col) => col.notNull())
|
|
98
|
+
`;
|
|
99
|
+
const blockFlattened = flattenFields(block.fields);
|
|
100
|
+
for (const bField of blockFlattened) {
|
|
101
|
+
const bColName = toSnakeCase(bField.name);
|
|
102
|
+
if (bColName === "id")
|
|
103
|
+
continue;
|
|
104
|
+
const bColType = mapType(bField);
|
|
105
|
+
const bConstraints = [];
|
|
106
|
+
if (bField.required)
|
|
107
|
+
bConstraints.push("notNull()");
|
|
108
|
+
if (bField.unique)
|
|
109
|
+
bConstraints.push("unique()");
|
|
110
|
+
if (bField.defaultValue !== undefined) {
|
|
111
|
+
let bVal = bField.defaultValue;
|
|
112
|
+
if (typeof bVal === "string")
|
|
113
|
+
bVal = `'${bVal}'`;
|
|
114
|
+
else if (typeof bVal === "boolean")
|
|
115
|
+
bVal = dialect === "sqlite" || dialect === "d1" ? bVal ? 1 : 0 : bVal;
|
|
116
|
+
bConstraints.push(`defaultTo(${bVal})`);
|
|
117
|
+
}
|
|
118
|
+
const bConstraintChain = bConstraints.length > 0 ? `.${bConstraints.join(".")}` : "";
|
|
119
|
+
upCode += ` .addColumn('${bColName}', '${bColType}', (col) => col${bConstraintChain})
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
upCode += ` .addColumn('created_at', '${tsType}', (col) => col.defaultTo(sql\`CURRENT_TIMESTAMP\`))
|
|
123
|
+
`;
|
|
124
|
+
upCode += ` .addColumn('updated_at', '${tsType}', (col) => col.defaultTo(sql\`CURRENT_TIMESTAMP\`))
|
|
125
|
+
`;
|
|
126
|
+
upCode += ` .execute();
|
|
127
|
+
|
|
128
|
+
`;
|
|
129
|
+
downCode = ` await db.schema.dropTable('${blockTableName}').execute();
|
|
130
|
+
` + downCode;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return `import { Kysely, sql } from 'kysely';
|
|
136
|
+
|
|
137
|
+
export async function up(db: Kysely<any>): Promise<void> {
|
|
138
|
+
${upCode}}
|
|
139
|
+
|
|
140
|
+
export async function down(db: Kysely<any>): Promise<void> {
|
|
141
|
+
${downCode}}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
function generateSQLCode(collections, globals = []) {
|
|
145
|
+
const allSchemas = [...collections, ...globals];
|
|
146
|
+
let sql = `-- OpacaCMS Auto-generated SQL Migration
|
|
147
|
+
|
|
148
|
+
`;
|
|
149
|
+
for (const collection of allSchemas) {
|
|
150
|
+
const slug = collection.slug;
|
|
151
|
+
const flattenedFields = flattenFields(collection.fields);
|
|
152
|
+
sql += `CREATE TABLE IF NOT EXISTS "${slug}" (
|
|
153
|
+
`;
|
|
154
|
+
sql += ` "id" TEXT PRIMARY KEY`;
|
|
155
|
+
for (const field of flattenedFields) {
|
|
156
|
+
if (field.type === "relationship" && "hasMany" in field && field.hasMany)
|
|
157
|
+
continue;
|
|
158
|
+
const colName = toSnakeCase(field.name);
|
|
159
|
+
if (colName === "id")
|
|
160
|
+
continue;
|
|
161
|
+
const colType = mapFieldToSQLiteType(field);
|
|
162
|
+
sql += `,
|
|
163
|
+
"${colName}" ${colType.toUpperCase()}`;
|
|
164
|
+
if (field.required)
|
|
165
|
+
sql += " NOT NULL";
|
|
166
|
+
if (field.unique)
|
|
167
|
+
sql += " UNIQUE";
|
|
168
|
+
if (field.defaultValue !== undefined) {
|
|
169
|
+
let val = field.defaultValue;
|
|
170
|
+
if (typeof val === "string")
|
|
171
|
+
val = `'${val}'`;
|
|
172
|
+
else if (typeof val === "boolean")
|
|
173
|
+
val = val ? 1 : 0;
|
|
174
|
+
sql += ` DEFAULT ${val}`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const ts = collection.timestamps !== false;
|
|
178
|
+
if (ts) {
|
|
179
|
+
const config = typeof collection.timestamps === "object" ? collection.timestamps : {};
|
|
180
|
+
const createdField = toSnakeCase(config.createdAt || "createdAt");
|
|
181
|
+
const updatedField = toSnakeCase(config.updatedAt || "updatedAt");
|
|
182
|
+
sql += `,
|
|
183
|
+
"${createdField}" TEXT DEFAULT CURRENT_TIMESTAMP`;
|
|
184
|
+
sql += `,
|
|
185
|
+
"${updatedField}" TEXT DEFAULT CURRENT_TIMESTAMP`;
|
|
186
|
+
}
|
|
187
|
+
sql += `
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
`;
|
|
191
|
+
for (const field of flattenedFields) {
|
|
192
|
+
if (field.type === "relationship" && "hasMany" in field && field.hasMany) {
|
|
193
|
+
const colName = toSnakeCase(field.name);
|
|
194
|
+
const joinTableName = `${slug}_${colName}_relations`.toLowerCase();
|
|
195
|
+
sql += `CREATE TABLE IF NOT EXISTS "${joinTableName}" (
|
|
196
|
+
`;
|
|
197
|
+
sql += ` "id" TEXT PRIMARY KEY,
|
|
198
|
+
`;
|
|
199
|
+
sql += ` "source_id" TEXT NOT NULL,
|
|
200
|
+
`;
|
|
201
|
+
sql += ` "target_id" TEXT NOT NULL,
|
|
202
|
+
`;
|
|
203
|
+
sql += ` "order" INTEGER DEFAULT 0
|
|
204
|
+
`;
|
|
205
|
+
sql += `);
|
|
206
|
+
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
for (const field of collection.fields) {
|
|
211
|
+
if (field.type === "blocks" && field.blocks && Array.isArray(field.blocks)) {
|
|
212
|
+
for (const block of field.blocks) {
|
|
213
|
+
const blockName = toSnakeCase(field.name);
|
|
214
|
+
const blockTableName = `${slug}_${blockName}_${block.slug}`.toLowerCase();
|
|
215
|
+
sql += `CREATE TABLE IF NOT EXISTS "${blockTableName}" (
|
|
216
|
+
`;
|
|
217
|
+
sql += ` "id" TEXT PRIMARY KEY,
|
|
218
|
+
`;
|
|
219
|
+
sql += ` "_parent_id" TEXT NOT NULL,
|
|
220
|
+
`;
|
|
221
|
+
sql += ` "_order" INTEGER DEFAULT 0,
|
|
222
|
+
`;
|
|
223
|
+
sql += ` "block_type" TEXT NOT NULL`;
|
|
224
|
+
const blockFlattened = flattenFields(block.fields);
|
|
225
|
+
for (const bField of blockFlattened) {
|
|
226
|
+
const bColName = toSnakeCase(bField.name);
|
|
227
|
+
if (bColName === "id")
|
|
228
|
+
continue;
|
|
229
|
+
const bColType = mapFieldToSQLiteType(bField);
|
|
230
|
+
sql += `,
|
|
231
|
+
"${bColName}" ${bColType.toUpperCase()}`;
|
|
232
|
+
}
|
|
233
|
+
sql += `,
|
|
234
|
+
"created_at" TEXT DEFAULT CURRENT_TIMESTAMP,
|
|
235
|
+
`;
|
|
236
|
+
sql += ` "updated_at" TEXT DEFAULT CURRENT_TIMESTAMP
|
|
237
|
+
`;
|
|
238
|
+
sql += `);
|
|
239
|
+
|
|
240
|
+
`;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return sql;
|
|
246
|
+
}
|
|
247
|
+
export {
|
|
248
|
+
generateSQLCode,
|
|
249
|
+
generateMigrationCode
|
|
250
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import"./chunk-8sqjbsgt.js";
|
|
2
|
+
|
|
3
|
+
// src/cli/commands/init.ts
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
async function initCommand(target, example) {
|
|
7
|
+
console.log(`[OpacaCMS] Initializing new project in ./${target}...`);
|
|
8
|
+
if (example) {
|
|
9
|
+
console.log(`[OpacaCMS] Using example template: ${example}`);
|
|
10
|
+
let currentDir = resolve(import.meta.dirname);
|
|
11
|
+
let exampleDir = "";
|
|
12
|
+
const localExample = resolve(process.cwd(), "examples", example);
|
|
13
|
+
if (fs.existsSync(localExample)) {
|
|
14
|
+
exampleDir = localExample;
|
|
15
|
+
} else {
|
|
16
|
+
while (currentDir !== resolve(currentDir, "..")) {
|
|
17
|
+
const potential = resolve(currentDir, "examples", example);
|
|
18
|
+
if (fs.existsSync(potential)) {
|
|
19
|
+
exampleDir = potential;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
currentDir = resolve(currentDir, "..");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!exampleDir) {
|
|
26
|
+
console.error(`[OpacaCMS] Example ${example} not found.`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
fs.cpSync(exampleDir, resolve(process.cwd(), target), { recursive: true });
|
|
30
|
+
console.log(`[OpacaCMS] Copied example ${example} to ${target}!`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
console.log(`[OpacaCMS] Generating default boilerplate...`);
|
|
34
|
+
fs.mkdirSync(resolve(process.cwd(), target), { recursive: true });
|
|
35
|
+
const configCode = `import { defineConfig } from 'opacacms';
|
|
36
|
+
import { createSQLiteAdapter } from 'opacacms/db/sqlite';
|
|
37
|
+
|
|
38
|
+
export default defineConfig({
|
|
39
|
+
appName: "My OpacaCMS App",
|
|
40
|
+
db: createSQLiteAdapter('local.db'),
|
|
41
|
+
collections: [
|
|
42
|
+
{
|
|
43
|
+
slug: 'posts',
|
|
44
|
+
fields: [
|
|
45
|
+
{ name: 'title', type: 'text', required: true },
|
|
46
|
+
{ name: 'content', type: 'text' }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
`;
|
|
52
|
+
fs.writeFileSync(resolve(process.cwd(), target, "opacacms.config.ts"), configCode);
|
|
53
|
+
const serverCode = `import { Hono } from 'hono';
|
|
54
|
+
import { createAPIRouter } from 'opacacms/server';
|
|
55
|
+
import config from './opacacms.config';
|
|
56
|
+
|
|
57
|
+
const app = new Hono();
|
|
58
|
+
app.route('/api', createAPIRouter(config));
|
|
59
|
+
|
|
60
|
+
export default app;
|
|
61
|
+
`;
|
|
62
|
+
fs.writeFileSync(resolve(process.cwd(), target, "index.ts"), serverCode);
|
|
63
|
+
const pkgJson = {
|
|
64
|
+
name: target,
|
|
65
|
+
type: "module",
|
|
66
|
+
scripts: {
|
|
67
|
+
start: "bun run index.ts",
|
|
68
|
+
dev: "bun run --watch index.ts"
|
|
69
|
+
},
|
|
70
|
+
dependencies: {
|
|
71
|
+
opacacms: "latest",
|
|
72
|
+
hono: "^4.0.0"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
fs.writeFileSync(resolve(process.cwd(), target, "package.json"), JSON.stringify(pkgJson, null, 2));
|
|
76
|
+
console.log(`[OpacaCMS] Project created successfully!`);
|
|
77
|
+
console.log(`
|
|
78
|
+
cd ${target}`);
|
|
79
|
+
console.log(`bun install`);
|
|
80
|
+
console.log(`bun run dev
|
|
81
|
+
`);
|
|
82
|
+
}
|
|
83
|
+
export {
|
|
84
|
+
initCommand
|
|
85
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$isAuthPending,
|
|
3
|
+
$isAuthenticated,
|
|
4
|
+
$session,
|
|
5
|
+
$user,
|
|
6
|
+
login,
|
|
7
|
+
logout,
|
|
8
|
+
syncSession
|
|
9
|
+
} from "./chunk-16vgcf3k.js";
|
|
10
|
+
import"./chunk-j4d50hrx.js";
|
|
11
|
+
import"./chunk-8sqjbsgt.js";
|
|
12
|
+
export {
|
|
13
|
+
syncSession,
|
|
14
|
+
logout,
|
|
15
|
+
login,
|
|
16
|
+
$user,
|
|
17
|
+
$session,
|
|
18
|
+
$isAuthenticated,
|
|
19
|
+
$isAuthPending
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
flattenFields,
|
|
3
|
+
getRelationalFields,
|
|
4
|
+
mapFieldToPostgresType,
|
|
5
|
+
mapFieldToSQLiteType,
|
|
6
|
+
toSnakeCase
|
|
7
|
+
} from "./chunk-cvdd4eqh.js";
|
|
8
|
+
import"./chunk-8sqjbsgt.js";
|
|
9
|
+
export {
|
|
10
|
+
toSnakeCase,
|
|
11
|
+
mapFieldToSQLiteType,
|
|
12
|
+
mapFieldToPostgresType,
|
|
13
|
+
getRelationalFields,
|
|
14
|
+
flattenFields
|
|
15
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__esm,
|
|
3
|
+
__export
|
|
4
|
+
} from "./chunk-8sqjbsgt.js";
|
|
5
|
+
|
|
6
|
+
// src/db/system-schema.ts
|
|
7
|
+
var exports_system_schema = {};
|
|
8
|
+
__export(exports_system_schema, {
|
|
9
|
+
getSystemCollections: () => getSystemCollections
|
|
10
|
+
});
|
|
11
|
+
var getSystemCollections = () => [
|
|
12
|
+
{
|
|
13
|
+
slug: "_opaca_assets",
|
|
14
|
+
label: "Assets",
|
|
15
|
+
apiPath: "assets",
|
|
16
|
+
fields: [
|
|
17
|
+
{ name: "id", type: "text", required: true },
|
|
18
|
+
{ name: "key", type: "text", required: true },
|
|
19
|
+
{ name: "filename", type: "text", required: true },
|
|
20
|
+
{ name: "originalFilename", type: "text", required: true },
|
|
21
|
+
{ name: "mimeType", type: "text", required: true },
|
|
22
|
+
{ name: "filesize", type: "number", required: true },
|
|
23
|
+
{ name: "bucket", type: "text", required: true },
|
|
24
|
+
{ name: "folder", type: "text" },
|
|
25
|
+
{ name: "altText", type: "text" },
|
|
26
|
+
{ name: "caption", type: "text" },
|
|
27
|
+
{ name: "uploadedBy", type: "text" }
|
|
28
|
+
],
|
|
29
|
+
timestamps: true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
slug: "_users",
|
|
33
|
+
apiPath: "users",
|
|
34
|
+
fields: [
|
|
35
|
+
{ name: "id", type: "text", required: true },
|
|
36
|
+
{ name: "name", type: "text", required: true },
|
|
37
|
+
{ name: "email", type: "text", required: true, unique: true },
|
|
38
|
+
{ name: "emailVerified", type: "boolean", required: true, defaultValue: false },
|
|
39
|
+
{ name: "image", type: "text" },
|
|
40
|
+
{ name: "role", type: "text" },
|
|
41
|
+
{ name: "banned", type: "boolean" },
|
|
42
|
+
{ name: "banReason", type: "text" },
|
|
43
|
+
{ name: "banExpires", type: "date" }
|
|
44
|
+
],
|
|
45
|
+
timestamps: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
slug: "_sessions",
|
|
49
|
+
fields: [
|
|
50
|
+
{ name: "id", type: "text", required: true },
|
|
51
|
+
{ name: "expiresAt", type: "date", required: true },
|
|
52
|
+
{ name: "token", type: "text", required: true, unique: true },
|
|
53
|
+
{ name: "ipAddress", type: "text" },
|
|
54
|
+
{ name: "userAgent", type: "text" },
|
|
55
|
+
{
|
|
56
|
+
name: "userId",
|
|
57
|
+
type: "text",
|
|
58
|
+
required: true,
|
|
59
|
+
references: { table: "_users", column: "id", onDelete: "cascade" }
|
|
60
|
+
},
|
|
61
|
+
{ name: "impersonatedBy", type: "text" }
|
|
62
|
+
],
|
|
63
|
+
timestamps: true,
|
|
64
|
+
hidden: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
slug: "_accounts",
|
|
68
|
+
fields: [
|
|
69
|
+
{ name: "id", type: "text", required: true },
|
|
70
|
+
{ name: "accountId", type: "text", required: true },
|
|
71
|
+
{ name: "providerId", type: "text", required: true },
|
|
72
|
+
{
|
|
73
|
+
name: "userId",
|
|
74
|
+
type: "text",
|
|
75
|
+
required: true,
|
|
76
|
+
references: { table: "_users", column: "id", onDelete: "cascade" }
|
|
77
|
+
},
|
|
78
|
+
{ name: "accessToken", type: "text" },
|
|
79
|
+
{ name: "refreshToken", type: "text" },
|
|
80
|
+
{ name: "idToken", type: "text" },
|
|
81
|
+
{ name: "accessTokenExpiresAt", type: "date" },
|
|
82
|
+
{ name: "refreshTokenExpiresAt", type: "date" },
|
|
83
|
+
{ name: "scope", type: "text" },
|
|
84
|
+
{ name: "password", type: "text" }
|
|
85
|
+
],
|
|
86
|
+
timestamps: true,
|
|
87
|
+
hidden: true
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
slug: "_verifications",
|
|
91
|
+
fields: [
|
|
92
|
+
{ name: "id", type: "text", required: true },
|
|
93
|
+
{ name: "identifier", type: "text", required: true },
|
|
94
|
+
{ name: "value", type: "text", required: true },
|
|
95
|
+
{ name: "expiresAt", type: "date", required: true }
|
|
96
|
+
],
|
|
97
|
+
timestamps: true,
|
|
98
|
+
hidden: true
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
slug: "_api_keys",
|
|
102
|
+
fields: [
|
|
103
|
+
{ name: "id", type: "text", required: true },
|
|
104
|
+
{ name: "configId", type: "text", required: true },
|
|
105
|
+
{ name: "name", type: "text" },
|
|
106
|
+
{ name: "start", type: "text" },
|
|
107
|
+
{ name: "prefix", type: "text" },
|
|
108
|
+
{ name: "key", type: "text", required: true },
|
|
109
|
+
{ name: "referenceId", type: "text", required: true },
|
|
110
|
+
{ name: "refillInterval", type: "number" },
|
|
111
|
+
{ name: "refillAmount", type: "number" },
|
|
112
|
+
{ name: "lastRefillAt", type: "date" },
|
|
113
|
+
{ name: "enabled", type: "boolean", required: true },
|
|
114
|
+
{ name: "rateLimitEnabled", type: "boolean", required: true },
|
|
115
|
+
{ name: "rateLimitTimeWindow", type: "number" },
|
|
116
|
+
{ name: "rateLimitMax", type: "number" },
|
|
117
|
+
{ name: "requestCount", type: "number", required: true },
|
|
118
|
+
{ name: "remaining", type: "number" },
|
|
119
|
+
{ name: "lastRequest", type: "date" },
|
|
120
|
+
{ name: "expiresAt", type: "date" },
|
|
121
|
+
{ name: "permissions", type: "text" },
|
|
122
|
+
{ name: "metadata", type: "text" }
|
|
123
|
+
],
|
|
124
|
+
timestamps: { createdAt: "createdAt", updatedAt: "updatedAt" },
|
|
125
|
+
hidden: true
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
var init_system_schema = () => {};
|
|
129
|
+
|
|
130
|
+
export { getSystemCollections, exports_system_schema, init_system_schema };
|