nucleus-core-ts 0.8.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/LICENSE +48 -0
- package/README.md +177 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/dist/index-0yyw12k6.d.ts +8 -0
- package/dist/dist/index-tv67j5qd.d.ts +488 -0
- package/dist/dist/index.d.ts +40 -0
- package/dist/fe/components/AbstractAnimatedBackground/index.d.ts +7 -0
- package/dist/fe/components/AuthorizationPage/components/AuthorizationPage.d.ts +3 -0
- package/dist/fe/components/AuthorizationPage/components/ClaimList.d.ts +3 -0
- package/dist/fe/components/AuthorizationPage/components/RoleClaimEditor.d.ts +3 -0
- package/dist/fe/components/AuthorizationPage/components/RoleList.d.ts +3 -0
- package/dist/fe/components/AuthorizationPage/index.d.ts +9 -0
- package/dist/fe/components/AuthorizationPage/store/index.d.ts +47 -0
- package/dist/fe/components/AuthorizationPage/theme/index.d.ts +82 -0
- package/dist/fe/components/AuthorizationPage/types/index.d.ts +64 -0
- package/dist/fe/components/Button/components/Button.d.ts +3 -0
- package/dist/fe/components/Button/components/ButtonSpinner.d.ts +3 -0
- package/dist/fe/components/Button/index.d.ts +6 -0
- package/dist/fe/components/Button/theme/index.d.ts +183 -0
- package/dist/fe/components/Button/types/index.d.ts +24 -0
- package/dist/fe/components/Button/utils/cn.d.ts +3 -0
- package/dist/fe/components/Captcha/components/Captcha.d.ts +4 -0
- package/dist/fe/components/Captcha/index.d.ts +4 -0
- package/dist/fe/components/Captcha/theme.d.ts +53 -0
- package/dist/fe/components/Captcha/types.d.ts +60 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordForm.d.ts +4 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordHeader.d.ts +4 -0
- package/dist/fe/components/ChangePasswordPage/components/ChangePasswordPage.d.ts +4 -0
- package/dist/fe/components/ChangePasswordPage/index.d.ts +7 -0
- package/dist/fe/components/ChangePasswordPage/store/index.d.ts +16 -0
- package/dist/fe/components/ChangePasswordPage/theme/index.d.ts +48 -0
- package/dist/fe/components/ChangePasswordPage/types/index.d.ts +56 -0
- package/dist/fe/components/Checkbox/components/Checkbox.d.ts +3 -0
- package/dist/fe/components/Checkbox/components/CheckboxIcon.d.ts +3 -0
- package/dist/fe/components/Checkbox/components/SwitchTrack.d.ts +3 -0
- package/dist/fe/components/Checkbox/index.d.ts +7 -0
- package/dist/fe/components/Checkbox/theme/index.d.ts +218 -0
- package/dist/fe/components/Checkbox/types/index.d.ts +39 -0
- package/dist/fe/components/Checkbox/utils/cn.d.ts +3 -0
- package/dist/fe/components/DataTable/DataTable.d.ts +3 -0
- package/dist/fe/components/DataTable/components/ActionCell.d.ts +10 -0
- package/dist/fe/components/DataTable/components/DataCell.d.ts +18 -0
- package/dist/fe/components/DataTable/components/EditableCell.d.ts +14 -0
- package/dist/fe/components/DataTable/components/EmptyState.d.ts +8 -0
- package/dist/fe/components/DataTable/components/HeaderCell.d.ts +16 -0
- package/dist/fe/components/DataTable/components/InfiniteScrollTrigger.d.ts +11 -0
- package/dist/fe/components/DataTable/components/LoadingSpinner.d.ts +7 -0
- package/dist/fe/components/DataTable/components/ResizeHandle.d.ts +9 -0
- package/dist/fe/components/DataTable/components/SelectionCell.d.ts +9 -0
- package/dist/fe/components/DataTable/components/SkeletonRow.d.ts +9 -0
- package/dist/fe/components/DataTable/components/SkeletonTable.d.ts +10 -0
- package/dist/fe/components/DataTable/components/SortIcon.d.ts +9 -0
- package/dist/fe/components/DataTable/components/TableHeader.d.ts +20 -0
- package/dist/fe/components/DataTable/components/TableRow.d.ts +20 -0
- package/dist/fe/components/DataTable/components/index.d.ts +15 -0
- package/dist/fe/components/DataTable/hooks/index.d.ts +3 -0
- package/dist/fe/components/DataTable/hooks/useAutoFitColumn.d.ts +8 -0
- package/dist/fe/components/DataTable/hooks/useResizeColumn.d.ts +12 -0
- package/dist/fe/components/DataTable/index.d.ts +6 -0
- package/dist/fe/components/DataTable/store/index.d.ts +52 -0
- package/dist/fe/components/DataTable/theme/index.d.ts +131 -0
- package/dist/fe/components/DataTable/types/index.d.ts +151 -0
- package/dist/fe/components/DataTable/utils/cn.d.ts +3 -0
- package/dist/fe/components/DatePicker/components/CalendarGrid.d.ts +3 -0
- package/dist/fe/components/DatePicker/components/CalendarHeader.d.ts +3 -0
- package/dist/fe/components/DatePicker/components/DatePicker.d.ts +3 -0
- package/dist/fe/components/DatePicker/components/MonthYearSelector.d.ts +10 -0
- package/dist/fe/components/DatePicker/index.d.ts +10 -0
- package/dist/fe/components/DatePicker/locales/index.d.ts +5 -0
- package/dist/fe/components/DatePicker/theme/index.d.ts +312 -0
- package/dist/fe/components/DatePicker/types/index.d.ts +88 -0
- package/dist/fe/components/DatePicker/utils/cn.d.ts +3 -0
- package/dist/fe/components/DatePicker/utils/date.d.ts +21 -0
- package/dist/fe/components/DevicesPage/components/DeviceCard.d.ts +4 -0
- package/dist/fe/components/DevicesPage/components/DevicesHeader.d.ts +4 -0
- package/dist/fe/components/DevicesPage/components/DevicesPage.d.ts +4 -0
- package/dist/fe/components/DevicesPage/index.d.ts +8 -0
- package/dist/fe/components/DevicesPage/store/index.d.ts +20 -0
- package/dist/fe/components/DevicesPage/theme/index.d.ts +92 -0
- package/dist/fe/components/DevicesPage/types/index.d.ts +147 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordForm.d.ts +4 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordHeader.d.ts +4 -0
- package/dist/fe/components/ForgotPasswordPage/components/ForgotPasswordPage.d.ts +4 -0
- package/dist/fe/components/ForgotPasswordPage/index.d.ts +7 -0
- package/dist/fe/components/ForgotPasswordPage/store/index.d.ts +14 -0
- package/dist/fe/components/ForgotPasswordPage/theme/index.d.ts +48 -0
- package/dist/fe/components/ForgotPasswordPage/types/index.d.ts +48 -0
- package/dist/fe/components/FormBuilder/components/FormBuilder.d.ts +3 -0
- package/dist/fe/components/FormBuilder/components/FormField.d.ts +3 -0
- package/dist/fe/components/FormBuilder/hooks/useFormBuilder.d.ts +3 -0
- package/dist/fe/components/FormBuilder/index.d.ts +6 -0
- package/dist/fe/components/FormBuilder/theme/index.d.ts +136 -0
- package/dist/fe/components/FormBuilder/types/index.d.ts +150 -0
- package/dist/fe/components/FormBuilder/utils/cn.d.ts +3 -0
- package/dist/fe/components/FormBuilder/utils/fieldMapping.d.ts +12 -0
- package/dist/fe/components/FormBuilder/utils/validation.d.ts +11 -0
- package/dist/fe/components/LoginPage/components/LoginForm.d.ts +4 -0
- package/dist/fe/components/LoginPage/components/LoginHeader.d.ts +4 -0
- package/dist/fe/components/LoginPage/components/LoginPage.d.ts +4 -0
- package/dist/fe/components/LoginPage/index.d.ts +8 -0
- package/dist/fe/components/LoginPage/store/index.d.ts +22 -0
- package/dist/fe/components/LoginPage/theme/index.d.ts +55 -0
- package/dist/fe/components/LoginPage/types/index.d.ts +129 -0
- package/dist/fe/components/MagicLinkVerifyPage/components/MagicLinkVerifyPage.d.ts +4 -0
- package/dist/fe/components/MagicLinkVerifyPage/index.d.ts +5 -0
- package/dist/fe/components/MagicLinkVerifyPage/store.d.ts +15 -0
- package/dist/fe/components/MagicLinkVerifyPage/theme.d.ts +37 -0
- package/dist/fe/components/MagicLinkVerifyPage/types.d.ts +35 -0
- package/dist/fe/components/NucleusEntityShowcase.d.ts +3 -0
- package/dist/fe/components/NucleusTextInput/components/FloatingLabel.d.ts +3 -0
- package/dist/fe/components/NucleusTextInput/components/InputIcons.d.ts +15 -0
- package/dist/fe/components/NucleusTextInput/components/NucleusTextInput.d.ts +3 -0
- package/dist/fe/components/NucleusTextInput/components/PasswordStrengthIndicator.d.ts +15 -0
- package/dist/fe/components/NucleusTextInput/components/TypewriterText.d.ts +3 -0
- package/dist/fe/components/NucleusTextInput/index.d.ts +11 -0
- package/dist/fe/components/NucleusTextInput/theme/index.d.ts +108 -0
- package/dist/fe/components/NucleusTextInput/types/index.d.ts +65 -0
- package/dist/fe/components/NucleusTextInput/utils/cn.d.ts +3 -0
- package/dist/fe/components/NucleusTextInput/utils/format.d.ts +8 -0
- package/dist/fe/components/NucleusTextInput/utils/validation.d.ts +23 -0
- package/dist/fe/components/ProfilePage/components/AddressCard.d.ts +4 -0
- package/dist/fe/components/ProfilePage/components/PhoneCard.d.ts +4 -0
- package/dist/fe/components/ProfilePage/components/ProfileHeader.d.ts +4 -0
- package/dist/fe/components/ProfilePage/components/ProfilePage.d.ts +4 -0
- package/dist/fe/components/ProfilePage/index.d.ts +10 -0
- package/dist/fe/components/ProfilePage/store/index.d.ts +37 -0
- package/dist/fe/components/ProfilePage/theme/index.d.ts +101 -0
- package/dist/fe/components/ProfilePage/types/index.d.ts +150 -0
- package/dist/fe/components/RangePicker/components/RangePicker.d.ts +3 -0
- package/dist/fe/components/RangePicker/components/RangeThumb.d.ts +3 -0
- package/dist/fe/components/RangePicker/components/RangeTooltip.d.ts +3 -0
- package/dist/fe/components/RangePicker/components/RangeTrack.d.ts +3 -0
- package/dist/fe/components/RangePicker/index.d.ts +8 -0
- package/dist/fe/components/RangePicker/theme/index.d.ts +90 -0
- package/dist/fe/components/RangePicker/types/index.d.ts +66 -0
- package/dist/fe/components/RangePicker/utils/cn.d.ts +3 -0
- package/dist/fe/components/RegisterPage/components/PasswordStrengthIndicator.d.ts +14 -0
- package/dist/fe/components/RegisterPage/components/RegisterForm.d.ts +4 -0
- package/dist/fe/components/RegisterPage/components/RegisterHeader.d.ts +4 -0
- package/dist/fe/components/RegisterPage/components/RegisterPage.d.ts +4 -0
- package/dist/fe/components/RegisterPage/index.d.ts +9 -0
- package/dist/fe/components/RegisterPage/store/index.d.ts +19 -0
- package/dist/fe/components/RegisterPage/theme/index.d.ts +81 -0
- package/dist/fe/components/RegisterPage/types/index.d.ts +141 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordForm.d.ts +4 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordHeader.d.ts +4 -0
- package/dist/fe/components/ResetPasswordPage/components/ResetPasswordPage.d.ts +4 -0
- package/dist/fe/components/ResetPasswordPage/index.d.ts +7 -0
- package/dist/fe/components/ResetPasswordPage/store/index.d.ts +15 -0
- package/dist/fe/components/ResetPasswordPage/theme/index.d.ts +56 -0
- package/dist/fe/components/ResetPasswordPage/types/index.d.ts +50 -0
- package/dist/fe/components/SearchBox/components/SearchBox.d.ts +3 -0
- package/dist/fe/components/SearchBox/components/SearchBoxDropdown.d.ts +3 -0
- package/dist/fe/components/SearchBox/index.d.ts +8 -0
- package/dist/fe/components/SearchBox/theme/index.d.ts +141 -0
- package/dist/fe/components/SearchBox/types/index.d.ts +47 -0
- package/dist/fe/components/SearchBox/utils/cn.d.ts +3 -0
- package/dist/fe/components/SearchBox/utils/debounce.d.ts +5 -0
- package/dist/fe/components/SearchBox/utils/sanitize.d.ts +9 -0
- package/dist/fe/components/SelectBox/components/SelectBox.d.ts +3 -0
- package/dist/fe/components/SelectBox/components/SelectDropdown.d.ts +6 -0
- package/dist/fe/components/SelectBox/components/SelectOptionItem.d.ts +3 -0
- package/dist/fe/components/SelectBox/components/SelectTrigger.d.ts +5 -0
- package/dist/fe/components/SelectBox/index.d.ts +8 -0
- package/dist/fe/components/SelectBox/theme/index.d.ts +100 -0
- package/dist/fe/components/SelectBox/types/index.d.ts +66 -0
- package/dist/fe/components/SelectBox/utils/cn.d.ts +3 -0
- package/dist/fe/components/SetPasswordPage/components/PasswordStrengthIndicator.d.ts +14 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordForm.d.ts +4 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordHeader.d.ts +4 -0
- package/dist/fe/components/SetPasswordPage/components/SetPasswordPage.d.ts +4 -0
- package/dist/fe/components/SetPasswordPage/index.d.ts +9 -0
- package/dist/fe/components/SetPasswordPage/store/index.d.ts +16 -0
- package/dist/fe/components/SetPasswordPage/theme/index.d.ts +95 -0
- package/dist/fe/components/SetPasswordPage/types/index.d.ts +137 -0
- package/dist/fe/components/UsersPage/components/InviteUserModal.d.ts +10 -0
- package/dist/fe/components/UsersPage/components/Pagination.d.ts +13 -0
- package/dist/fe/components/UsersPage/components/RoleAssignmentModal.d.ts +12 -0
- package/dist/fe/components/UsersPage/components/StatsCards.d.ts +10 -0
- package/dist/fe/components/UsersPage/components/UserDetailDrawer.d.ts +24 -0
- package/dist/fe/components/UsersPage/components/UserFilters.d.ts +18 -0
- package/dist/fe/components/UsersPage/components/UserListItem.d.ts +11 -0
- package/dist/fe/components/UsersPage/components/UserListSkeleton.d.ts +7 -0
- package/dist/fe/components/UsersPage/components/UsersPage.d.ts +8 -0
- package/dist/fe/components/UsersPage/index.d.ts +13 -0
- package/dist/fe/components/UsersPage/store/index.d.ts +51 -0
- package/dist/fe/components/UsersPage/theme/index.d.ts +180 -0
- package/dist/fe/components/UsersPage/types/index.d.ts +73 -0
- package/dist/fe/components/VerifyEmailPage/components/VerifyEmailPage.d.ts +4 -0
- package/dist/fe/components/VerifyEmailPage/index.d.ts +5 -0
- package/dist/fe/components/VerifyEmailPage/store/index.d.ts +18 -0
- package/dist/fe/components/VerifyEmailPage/theme/index.d.ts +49 -0
- package/dist/fe/components/VerifyEmailPage/types/index.d.ts +84 -0
- package/dist/fe/hooks/useNucleusEntity.d.ts +3 -0
- package/dist/fe/index.d.ts +42 -0
- package/dist/fe/index.js +1 -0
- package/dist/fe/types/index.d.ts +233 -0
- package/dist/fe/utils/cn.d.ts +3 -0
- package/dist/fe/utils/columnUtils.d.ts +63 -0
- package/dist/fe/utils/endpointKeys.d.ts +9 -0
- package/dist/index-0yyw12k6.js +1 -0
- package/dist/index-tv67j5qd.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/nucleus.config.d.ts +95 -0
- package/dist/public/components/CTA.d.ts +2 -0
- package/dist/public/components/Capabilities.d.ts +9 -0
- package/dist/public/components/Features.d.ts +9 -0
- package/dist/public/components/Footer.d.ts +2 -0
- package/dist/public/components/Hero.d.ts +2 -0
- package/dist/public/components/Managers.d.ts +7 -0
- package/dist/public/components/Nav.d.ts +2 -0
- package/dist/public/components/Stack.d.ts +7 -0
- package/dist/public/components/docs/Docs.d.ts +2 -0
- package/dist/public/components/docs/DocsContent.d.ts +19 -0
- package/dist/public/components/docs/DocsRightSidebar.d.ts +9 -0
- package/dist/public/components/docs/DocsSidebar.d.ts +8 -0
- package/dist/public/components/docs/content/authentication.d.ts +3 -0
- package/dist/public/components/docs/content/gettingStarted.d.ts +3 -0
- package/dist/public/components/docs/docsData.d.ts +18 -0
- package/dist/public/components/docs/index.d.ts +7 -0
- package/dist/public/components/index.d.ts +10 -0
- package/dist/public/index.d.ts +3 -0
- package/dist/public/store.d.ts +20 -0
- package/dist/scripts/build.d.ts +7 -0
- package/dist/scripts/generate-schema.d.ts +3 -0
- package/dist/scripts/generate-system-tables-types.d.ts +2 -0
- package/dist/scripts/generate-types-schema.d.ts +7 -0
- package/dist/scripts/publish.d.ts +7 -0
- package/dist/scripts/version.d.ts +7 -0
- package/dist/src/Client/ApiCaller/client.d.ts +5 -0
- package/dist/src/Client/ApiCaller/examples/usage.example.d.ts +8 -0
- package/dist/src/Client/ApiCaller/generator.d.ts +10 -0
- package/dist/src/Client/ApiCaller/index.d.ts +7 -0
- package/dist/src/Client/ApiCaller/server.d.ts +4 -0
- package/dist/src/Client/ApiCaller/system-tables.d.ts +1215 -0
- package/dist/src/Client/ApiCaller/types.d.ts +907 -0
- package/dist/src/Client/Proxy/httpProxy.d.ts +5 -0
- package/dist/src/Client/Proxy/index.d.ts +6 -0
- package/dist/src/Client/Proxy/index.js +1 -0
- package/dist/src/Client/Proxy/server.d.ts +5 -0
- package/dist/src/Client/Proxy/types.d.ts +69 -0
- package/dist/src/Client/Proxy/utils.d.ts +12 -0
- package/dist/src/Client/Proxy/wsProxy.d.ts +20 -0
- package/dist/src/Client/ServerFetch/index.d.ts +19 -0
- package/dist/src/Client/ServerFetch/types.d.ts +34 -0
- package/dist/src/Client/index.d.ts +4 -0
- package/dist/src/ElysiaPlugin/index.d.ts +12 -0
- package/dist/src/ElysiaPlugin/publicRoutes.d.ts +9 -0
- package/dist/src/ElysiaPlugin/routes/auth/captcha/index.d.ts +46 -0
- package/dist/src/ElysiaPlugin/routes/auth/emailVerification/index.d.ts +38 -0
- package/dist/src/ElysiaPlugin/routes/auth/index.d.ts +68 -0
- package/dist/src/ElysiaPlugin/routes/auth/invite/index.d.ts +43 -0
- package/dist/src/ElysiaPlugin/routes/auth/login/index.d.ts +68 -0
- package/dist/src/ElysiaPlugin/routes/auth/login/types.d.ts +22 -0
- package/dist/src/ElysiaPlugin/routes/auth/login/utils.d.ts +19 -0
- package/dist/src/ElysiaPlugin/routes/auth/logout/index.d.ts +33 -0
- package/dist/src/ElysiaPlugin/routes/auth/logout/types.d.ts +6 -0
- package/dist/src/ElysiaPlugin/routes/auth/logout/utils.d.ts +2 -0
- package/dist/src/ElysiaPlugin/routes/auth/magicLink/index.d.ts +41 -0
- package/dist/src/ElysiaPlugin/routes/auth/magicLink/types.d.ts +23 -0
- package/dist/src/ElysiaPlugin/routes/auth/magicLink/utils.d.ts +4 -0
- package/dist/src/ElysiaPlugin/routes/auth/me/index.d.ts +40 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordChange/index.d.ts +33 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordChange/types.d.ts +12 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordChange/utils.d.ts +2 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordReset/index.d.ts +36 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordReset/types.d.ts +16 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordReset/utils.d.ts +3 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordSet/index.d.ts +33 -0
- package/dist/src/ElysiaPlugin/routes/auth/passwordSet/types.d.ts +9 -0
- package/dist/src/ElysiaPlugin/routes/auth/refresh/index.d.ts +39 -0
- package/dist/src/ElysiaPlugin/routes/auth/refresh/types.d.ts +9 -0
- package/dist/src/ElysiaPlugin/routes/auth/refresh/utils.d.ts +2 -0
- package/dist/src/ElysiaPlugin/routes/auth/register/index.d.ts +47 -0
- package/dist/src/ElysiaPlugin/routes/auth/register/types.d.ts +18 -0
- package/dist/src/ElysiaPlugin/routes/auth/register/utils.d.ts +8 -0
- package/dist/src/ElysiaPlugin/routes/auth/sessions/index.d.ts +33 -0
- package/dist/src/ElysiaPlugin/routes/auth/sessions/types.d.ts +67 -0
- package/dist/src/ElysiaPlugin/routes/auth/sessions/utils.d.ts +36 -0
- package/dist/src/ElysiaPlugin/routes/auth/types.d.ts +153 -0
- package/dist/src/ElysiaPlugin/routes/entity/index.d.ts +5 -0
- package/dist/src/ElysiaPlugin/routes/entity/types.d.ts +50 -0
- package/dist/src/ElysiaPlugin/routes/entity/utils.d.ts +11 -0
- package/dist/src/ElysiaPlugin/routes/index.d.ts +5 -0
- package/dist/src/ElysiaPlugin/routes/monitoring/index.d.ts +58 -0
- package/dist/src/ElysiaPlugin/routes/storage/cdn.d.ts +51 -0
- package/dist/src/ElysiaPlugin/routes/storage/helpers.d.ts +53 -0
- package/dist/src/ElysiaPlugin/routes/storage/index.d.ts +3 -0
- package/dist/src/ElysiaPlugin/routes/verification/index.d.ts +39 -0
- package/dist/src/ElysiaPlugin/swagger.d.ts +28 -0
- package/dist/src/ElysiaPlugin/utils.d.ts +70 -0
- package/dist/src/Managers/Dapr/clients/binding-client.d.ts +15 -0
- package/dist/src/Managers/Dapr/clients/config-client.d.ts +27 -0
- package/dist/src/Managers/Dapr/clients/crypto-client.d.ts +27 -0
- package/dist/src/Managers/Dapr/clients/invoke-client.d.ts +32 -0
- package/dist/src/Managers/Dapr/clients/lock-client.d.ts +23 -0
- package/dist/src/Managers/Dapr/clients/pubsub-client.d.ts +23 -0
- package/dist/src/Managers/Dapr/clients/secret-client.d.ts +19 -0
- package/dist/src/Managers/Dapr/clients/state-client.d.ts +55 -0
- package/dist/src/Managers/Dapr/clients/workflow-client.d.ts +39 -0
- package/dist/src/Managers/Dapr/connection-manager.d.ts +51 -0
- package/dist/src/Managers/Dapr/constants.d.ts +49 -0
- package/dist/src/Managers/Dapr/dapr-manager.d.ts +160 -0
- package/dist/src/Managers/Dapr/error-handling.d.ts +29 -0
- package/dist/src/Managers/Dapr/index.d.ts +102 -0
- package/dist/src/Managers/Dapr/types.d.ts +121 -0
- package/dist/src/Managers/Dapr/utils.d.ts +44 -0
- package/dist/src/Managers/File/atomic.d.ts +64 -0
- package/dist/src/Managers/File/core.d.ts +188 -0
- package/dist/src/Managers/File/index.d.ts +18 -0
- package/dist/src/Managers/File/permissions.d.ts +72 -0
- package/dist/src/Managers/File/streaming.d.ts +30 -0
- package/dist/src/Managers/File/types.d.ts +146 -0
- package/dist/src/Managers/File/utils.d.ts +112 -0
- package/dist/src/Managers/Postgre/index.d.ts +25 -0
- package/dist/src/Managers/Redis/index.d.ts +33 -0
- package/dist/src/Managers/index.d.ts +5 -0
- package/dist/src/Services/Auth/Fingerprint/Generate/index.d.ts +3 -0
- package/dist/src/Services/Auth/Fingerprint/Validate/index.d.ts +3 -0
- package/dist/src/Services/Auth/Fingerprint/index.d.ts +5 -0
- package/dist/src/Services/Auth/Fingerprint/types.d.ts +20 -0
- package/dist/src/Services/Auth/Fingerprint/utils.d.ts +3 -0
- package/dist/src/Services/Auth/JWT/Decode/index.d.ts +3 -0
- package/dist/src/Services/Auth/JWT/Sign/index.d.ts +3 -0
- package/dist/src/Services/Auth/JWT/Verify/index.d.ts +3 -0
- package/dist/src/Services/Auth/JWT/index.d.ts +5 -0
- package/dist/src/Services/Auth/JWT/types.d.ts +38 -0
- package/dist/src/Services/Auth/JWT/utils.d.ts +10 -0
- package/dist/src/Services/Auth/Password/Generate/index.d.ts +3 -0
- package/dist/src/Services/Auth/Password/Validate/index.d.ts +3 -0
- package/dist/src/Services/Auth/Password/index.d.ts +2 -0
- package/dist/src/Services/Auth/Password/types.d.ts +16 -0
- package/dist/src/Services/Auth/RefreshToken/Delete/index.d.ts +3 -0
- package/dist/src/Services/Auth/RefreshToken/Generate/index.d.ts +11 -0
- package/dist/src/Services/Auth/RefreshToken/Read/index.d.ts +11 -0
- package/dist/src/Services/Auth/RefreshToken/Validate/index.d.ts +11 -0
- package/dist/src/Services/Auth/RefreshToken/index.d.ts +5 -0
- package/dist/src/Services/Auth/RefreshToken/types.d.ts +27 -0
- package/dist/src/Services/Auth/RefreshToken/utils.d.ts +6 -0
- package/dist/src/Services/Auth/Session/Issue/index.d.ts +9 -0
- package/dist/src/Services/Auth/Session/index.d.ts +2 -0
- package/dist/src/Services/Auth/Session/types.d.ts +13 -0
- package/dist/src/Services/Auth/SessionStore/Delete/index.d.ts +3 -0
- package/dist/src/Services/Auth/SessionStore/Generate/index.d.ts +11 -0
- package/dist/src/Services/Auth/SessionStore/Read/index.d.ts +3 -0
- package/dist/src/Services/Auth/SessionStore/Update/index.d.ts +24 -0
- package/dist/src/Services/Auth/SessionStore/Validate/index.d.ts +3 -0
- package/dist/src/Services/Auth/SessionStore/index.d.ts +7 -0
- package/dist/src/Services/Auth/SessionStore/types.d.ts +59 -0
- package/dist/src/Services/Auth/SessionStore/utils.d.ts +6 -0
- package/dist/src/Services/Auth/index.d.ts +7 -0
- package/dist/src/Services/Authorization/ClaimSeeder/index.d.ts +6 -0
- package/dist/src/Services/Authorization/GodminSetup/index.d.ts +10 -0
- package/dist/src/Services/Authorization/Middleware/index.d.ts +21 -0
- package/dist/src/Services/Authorization/index.d.ts +5 -0
- package/dist/src/Services/Authorization/types.d.ts +68 -0
- package/dist/src/Services/Captcha/index.d.ts +15 -0
- package/dist/src/Services/Captcha/types.d.ts +69 -0
- package/dist/src/Services/Gmail/index.d.ts +62 -0
- package/dist/src/Services/Logger/Logger.d.ts +77 -0
- package/dist/src/Services/Logger/index.d.ts +5 -0
- package/dist/src/Services/Logger/transports.d.ts +54 -0
- package/dist/src/Services/Logger/types.d.ts +88 -0
- package/dist/src/Services/Logger/utils.d.ts +8 -0
- package/dist/src/Services/Monitoring/AlertService.d.ts +29 -0
- package/dist/src/Services/Monitoring/collectors/ApplicationCollector.d.ts +30 -0
- package/dist/src/Services/Monitoring/collectors/SystemCollector.d.ts +13 -0
- package/dist/src/Services/Monitoring/collectors/index.d.ts +3 -0
- package/dist/src/Services/Monitoring/index.d.ts +109 -0
- package/dist/src/Services/Monitoring/types.d.ts +163 -0
- package/dist/src/Services/Notification/index.d.ts +31 -0
- package/dist/src/Services/Notification/types.d.ts +59 -0
- package/dist/src/Services/RateLimiter/index.d.ts +99 -0
- package/dist/src/Services/Verification/index.d.ts +23 -0
- package/dist/src/Services/Verification/types.d.ts +135 -0
- package/dist/src/Services/index.d.ts +10 -0
- package/dist/src/types.d.ts +588 -0
- package/package.json +99 -0
- package/public/components/CTA.tsx +25 -0
- package/public/components/Capabilities.tsx +69 -0
- package/public/components/Features.tsx +107 -0
- package/public/components/Footer.tsx +60 -0
- package/public/components/Hero.tsx +53 -0
- package/public/components/Managers.tsx +60 -0
- package/public/components/Nav.tsx +107 -0
- package/public/components/Stack.tsx +36 -0
- package/public/components/docs/Docs.tsx +62 -0
- package/public/components/docs/DocsContent.tsx +203 -0
- package/public/components/docs/DocsRightSidebar.tsx +53 -0
- package/public/components/docs/DocsSidebar.tsx +62 -0
- package/public/components/docs/content/authentication.ts +1670 -0
- package/public/components/docs/content/gettingStarted.ts +627 -0
- package/public/components/docs/docsData.ts +36 -0
- package/public/components/docs/index.ts +6 -0
- package/public/components/index.ts +9 -0
- package/public/docs.css +633 -0
- package/public/index.html +81 -0
- package/public/index.tsx +52 -0
- package/public/store.ts +79 -0
- package/public/styles.css +877 -0
- package/schemas/bckp/config.nucleus.json +1488 -0
- package/schemas/bckp/nucleus.tables.schema.json +24 -0
- package/schemas/bckp/table.schema.json +472 -0
- package/schemas/config.nucleus.json +1010 -0
- package/schemas/nucleus.tables.schema.json +19 -0
- package/schemas/table.schema.json +498 -0
- package/scripts/build.ts +197 -0
- package/scripts/generate-schema.ts +556 -0
- package/scripts/generate-system-tables-types.ts +18 -0
- package/scripts/generate-types-schema.ts +962 -0
- package/scripts/publish.ts +210 -0
- package/scripts/version.ts +125 -0
- package/src/system.tables.json +1590 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
|
|
5
|
+
interface Column {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
length?: number;
|
|
9
|
+
precision?: number;
|
|
10
|
+
scale?: number;
|
|
11
|
+
notNull?: boolean;
|
|
12
|
+
nullable?: boolean;
|
|
13
|
+
primaryKey?: boolean;
|
|
14
|
+
unique?: boolean;
|
|
15
|
+
default?: unknown;
|
|
16
|
+
defaultRaw?: string;
|
|
17
|
+
defaultRandom?: boolean;
|
|
18
|
+
array?: boolean;
|
|
19
|
+
references?: {
|
|
20
|
+
table: string;
|
|
21
|
+
column: string;
|
|
22
|
+
onDelete?: string;
|
|
23
|
+
onUpdate?: string;
|
|
24
|
+
};
|
|
25
|
+
enumValues?: string[];
|
|
26
|
+
enum?: {
|
|
27
|
+
name: string;
|
|
28
|
+
values: string[];
|
|
29
|
+
};
|
|
30
|
+
mode?: string;
|
|
31
|
+
dimensions?: number;
|
|
32
|
+
generatedAlwaysAs?: string;
|
|
33
|
+
comment?: string;
|
|
34
|
+
check?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Index {
|
|
38
|
+
name?: string;
|
|
39
|
+
columns: string[];
|
|
40
|
+
unique?: boolean;
|
|
41
|
+
where?: string;
|
|
42
|
+
using?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface Constraint {
|
|
46
|
+
unique?: { name: string; columns: string[] }[];
|
|
47
|
+
check?: { name: string; expression: string }[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TableDef {
|
|
51
|
+
table_name: string;
|
|
52
|
+
feature_set?: string[];
|
|
53
|
+
add_base_columns?: boolean;
|
|
54
|
+
columns: Column[];
|
|
55
|
+
indexes?: Index[];
|
|
56
|
+
constraints?: Constraint;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
interface Config {
|
|
60
|
+
authentication?: { enabled?: boolean };
|
|
61
|
+
authorization?: { enabled?: boolean };
|
|
62
|
+
audit?: { enabled?: boolean };
|
|
63
|
+
verification?: { enabled?: boolean };
|
|
64
|
+
notification?: { enabled?: boolean };
|
|
65
|
+
storage?: { enabled?: boolean };
|
|
66
|
+
"multi-tenant"?: { enabled?: boolean };
|
|
67
|
+
entities?: TableDef[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface SystemTables {
|
|
71
|
+
tables: TableDef[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const BASE_COLUMNS: Column[] = [
|
|
75
|
+
{
|
|
76
|
+
name: "id",
|
|
77
|
+
type: "uuid",
|
|
78
|
+
primaryKey: true,
|
|
79
|
+
defaultRaw: "gen_random_uuid()",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "created_at",
|
|
83
|
+
type: "timestamptz",
|
|
84
|
+
notNull: true,
|
|
85
|
+
defaultRaw: "now()",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "updated_at",
|
|
89
|
+
type: "timestamptz",
|
|
90
|
+
notNull: true,
|
|
91
|
+
defaultRaw: "now()",
|
|
92
|
+
},
|
|
93
|
+
{ name: "is_active", type: "boolean", notNull: true, default: true },
|
|
94
|
+
{ name: "created_by", type: "uuid" },
|
|
95
|
+
{ name: "updated_by", type: "uuid" },
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const TYPE_MAP: Record<string, string> = {
|
|
99
|
+
integer: "integer",
|
|
100
|
+
smallint: "smallint",
|
|
101
|
+
bigint: "bigint",
|
|
102
|
+
serial: "serial",
|
|
103
|
+
smallserial: "smallserial",
|
|
104
|
+
bigserial: "bigserial",
|
|
105
|
+
real: "real",
|
|
106
|
+
doublePrecision: "doublePrecision",
|
|
107
|
+
numeric: "numeric",
|
|
108
|
+
decimal: "decimal",
|
|
109
|
+
text: "text",
|
|
110
|
+
varchar: "varchar",
|
|
111
|
+
char: "char",
|
|
112
|
+
uuid: "uuid",
|
|
113
|
+
boolean: "boolean",
|
|
114
|
+
date: "date",
|
|
115
|
+
time: "time",
|
|
116
|
+
timestamp: "timestamp",
|
|
117
|
+
timestamptz: "timestamp",
|
|
118
|
+
interval: "interval",
|
|
119
|
+
json: "json",
|
|
120
|
+
jsonb: "jsonb",
|
|
121
|
+
vector: "vector",
|
|
122
|
+
tsvector: "text",
|
|
123
|
+
geometry: "text",
|
|
124
|
+
customType: "text",
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
function toCamelCase(str: string): string {
|
|
128
|
+
return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function getEnabledFeatures(config: Config): Set<string> {
|
|
132
|
+
const features = new Set<string>();
|
|
133
|
+
if (config.authentication?.enabled) features.add("authentication");
|
|
134
|
+
if (config.authorization?.enabled) features.add("authorization");
|
|
135
|
+
if (config.audit?.enabled) features.add("audit");
|
|
136
|
+
if (config.verification?.enabled) features.add("verification");
|
|
137
|
+
if (config.notification?.enabled) features.add("notification");
|
|
138
|
+
if (config.storage?.enabled) features.add("storage");
|
|
139
|
+
if (config["multi-tenant"]?.enabled) features.add("multi-tenant");
|
|
140
|
+
return features;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isTableEnabled(
|
|
144
|
+
table: TableDef,
|
|
145
|
+
enabledFeatures: Set<string>,
|
|
146
|
+
): boolean {
|
|
147
|
+
if (!table.feature_set || table.feature_set.length === 0) return true;
|
|
148
|
+
return table.feature_set.every((f) => enabledFeatures.has(f));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function generateColumnCode(
|
|
152
|
+
col: Column,
|
|
153
|
+
allTables: string[],
|
|
154
|
+
currentTable?: string,
|
|
155
|
+
): string {
|
|
156
|
+
const drizzleType = TYPE_MAP[col.type] || "text";
|
|
157
|
+
let code = "";
|
|
158
|
+
|
|
159
|
+
if (col.type === "varchar" && col.length) {
|
|
160
|
+
code = `varchar('${col.name}', { length: ${col.length} })`;
|
|
161
|
+
} else if (col.type === "char" && col.length) {
|
|
162
|
+
code = `char('${col.name}', { length: ${col.length} })`;
|
|
163
|
+
} else if (
|
|
164
|
+
(col.type === "numeric" || col.type === "decimal") &&
|
|
165
|
+
col.precision
|
|
166
|
+
) {
|
|
167
|
+
code = `numeric('${col.name}', { precision: ${col.precision}, scale: ${col.scale ?? 0} })`;
|
|
168
|
+
} else if (col.type === "timestamp" || col.type === "timestamptz") {
|
|
169
|
+
const withTz = col.type === "timestamptz";
|
|
170
|
+
code = `timestamp('${col.name}'${withTz ? ", { withTimezone: true }" : ""})`;
|
|
171
|
+
} else if (col.type === "bigint" && col.mode) {
|
|
172
|
+
code = `bigint('${col.name}', { mode: '${col.mode}' })`;
|
|
173
|
+
} else if (col.type === "vector" && col.dimensions) {
|
|
174
|
+
code = `vector('${col.name}', { dimensions: ${col.dimensions} })`;
|
|
175
|
+
} else {
|
|
176
|
+
code = `${drizzleType}('${col.name}')`;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (col.primaryKey) code += ".primaryKey()";
|
|
180
|
+
if (col.notNull) code += ".notNull()";
|
|
181
|
+
if (col.unique) code += ".unique()";
|
|
182
|
+
|
|
183
|
+
if (col.defaultRaw) {
|
|
184
|
+
code += `.default(sql\`${col.defaultRaw}\`)`;
|
|
185
|
+
} else if (col.defaultRandom) {
|
|
186
|
+
code += ".defaultRandom()";
|
|
187
|
+
} else if (col.default !== undefined) {
|
|
188
|
+
if (typeof col.default === "string") {
|
|
189
|
+
code += `.default('${col.default}')`;
|
|
190
|
+
} else if (typeof col.default === "boolean") {
|
|
191
|
+
code += `.default(${col.default})`;
|
|
192
|
+
} else if (typeof col.default === "number") {
|
|
193
|
+
code += `.default(${col.default})`;
|
|
194
|
+
} else if (Array.isArray(col.default)) {
|
|
195
|
+
code += `.default(sql\`'{}'\`)`;
|
|
196
|
+
} else if (typeof col.default === "object") {
|
|
197
|
+
code += `.default(sql\`'{}'\`)`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const isSelfReference =
|
|
202
|
+
col.references && col.references.table === currentTable;
|
|
203
|
+
if (
|
|
204
|
+
col.references &&
|
|
205
|
+
allTables.includes(col.references.table) &&
|
|
206
|
+
!isSelfReference
|
|
207
|
+
) {
|
|
208
|
+
const refTable = toCamelCase(col.references.table);
|
|
209
|
+
let refCode = `.references(() => ${refTable}.${col.references.column}`;
|
|
210
|
+
if (col.references.onDelete) {
|
|
211
|
+
refCode += `, { onDelete: '${col.references.onDelete}' }`;
|
|
212
|
+
}
|
|
213
|
+
refCode += ")";
|
|
214
|
+
code += refCode;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return code;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function generateTableCode(table: TableDef, allTables: string[]): string {
|
|
221
|
+
const tableName = toCamelCase(table.table_name);
|
|
222
|
+
const TableName = tableName.charAt(0).toUpperCase() + tableName.slice(1);
|
|
223
|
+
const columns = table.add_base_columns
|
|
224
|
+
? [
|
|
225
|
+
...BASE_COLUMNS,
|
|
226
|
+
...table.columns.filter(
|
|
227
|
+
(c) => !BASE_COLUMNS.find((bc) => bc.name === c.name),
|
|
228
|
+
),
|
|
229
|
+
]
|
|
230
|
+
: table.columns;
|
|
231
|
+
|
|
232
|
+
let code = `export const ${tableName}Columns = {\n`;
|
|
233
|
+
for (const col of columns) {
|
|
234
|
+
const colCode = generateColumnCode(col, allTables, table.table_name);
|
|
235
|
+
code += `\t${toCamelCase(col.name)}: ${colCode},\n`;
|
|
236
|
+
}
|
|
237
|
+
code += "};\n\n";
|
|
238
|
+
|
|
239
|
+
const vectorColumns = new Set(
|
|
240
|
+
columns.filter((c) => c.type === "vector").map((c) => c.name),
|
|
241
|
+
);
|
|
242
|
+
const validIndexes = (table.indexes || []).filter(
|
|
243
|
+
(idx) => !idx.columns.some((c) => vectorColumns.has(c)),
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
if (validIndexes.length > 0) {
|
|
247
|
+
const indexColTypes = [
|
|
248
|
+
...new Set(validIndexes.flatMap((idx) => idx.columns)),
|
|
249
|
+
]
|
|
250
|
+
.map((c) => `${toCamelCase(c)}: PgColumn`)
|
|
251
|
+
.join("; ");
|
|
252
|
+
code += `export const ${tableName}Indexes = (t: { ${indexColTypes} }) => [\n`;
|
|
253
|
+
for (const idx of validIndexes) {
|
|
254
|
+
const idxName =
|
|
255
|
+
idx.name || `${table.table_name}_${idx.columns.join("_")}_idx`;
|
|
256
|
+
const cols = idx.columns.map((c) => `t.${toCamelCase(c)}`).join(", ");
|
|
257
|
+
if (idx.unique) {
|
|
258
|
+
code += `\tuniqueIndex('${idxName}').on(${cols}),\n`;
|
|
259
|
+
} else {
|
|
260
|
+
code += `\tindex('${idxName}').on(${cols}),\n`;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
code += "];\n\n";
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
code += `export const ${tableName} = pgTable('${table.table_name}', ${tableName}Columns`;
|
|
267
|
+
if (validIndexes.length > 0) {
|
|
268
|
+
code += `, (t) => [\n`;
|
|
269
|
+
for (const idx of validIndexes) {
|
|
270
|
+
const idxName =
|
|
271
|
+
idx.name || `${table.table_name}_${idx.columns.join("_")}_idx`;
|
|
272
|
+
const cols = idx.columns.map((c) => `t.${toCamelCase(c)}`).join(", ");
|
|
273
|
+
if (idx.unique) {
|
|
274
|
+
code += `\tuniqueIndex('${idxName}').on(${cols}),\n`;
|
|
275
|
+
} else {
|
|
276
|
+
code += `\tindex('${idxName}').on(${cols}),\n`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
code += `]`;
|
|
280
|
+
}
|
|
281
|
+
code += ");\n\n";
|
|
282
|
+
|
|
283
|
+
const referencedTables = columns
|
|
284
|
+
.filter(
|
|
285
|
+
(c): c is typeof c & { references: NonNullable<typeof c.references> } =>
|
|
286
|
+
c.references !== undefined && allTables.includes(c.references.table),
|
|
287
|
+
)
|
|
288
|
+
.map((c) => ({
|
|
289
|
+
col: c,
|
|
290
|
+
refTable: c.references.table,
|
|
291
|
+
isSelf: c.references.table === table.table_name,
|
|
292
|
+
}));
|
|
293
|
+
|
|
294
|
+
const externalRefs = referencedTables.filter((r) => !r.isSelf);
|
|
295
|
+
|
|
296
|
+
code += `export function create${TableName}ForSchema(schema: ReturnType<typeof pgSchema>) {\n`;
|
|
297
|
+
|
|
298
|
+
if (externalRefs.length > 0) {
|
|
299
|
+
const uniqueRefTables = [...new Set(externalRefs.map((r) => r.refTable))];
|
|
300
|
+
for (const refTable of uniqueRefTables) {
|
|
301
|
+
const refTableName = toCamelCase(refTable);
|
|
302
|
+
code += `\tconst ${refTableName}Table = schema.table('${refTable}', ${refTableName}Columns, (t) => ${refTableName}Indexes(t));\n`;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (referencedTables.length > 0) {
|
|
307
|
+
code += `\treturn schema.table('${table.table_name}', {\n`;
|
|
308
|
+
code += `\t\t...${tableName}Columns,\n`;
|
|
309
|
+
for (const { col, refTable, isSelf } of referencedTables) {
|
|
310
|
+
const colName = toCamelCase(col.name);
|
|
311
|
+
const refTableName = toCamelCase(refTable);
|
|
312
|
+
let colCode = "";
|
|
313
|
+
if (col.type === "uuid") {
|
|
314
|
+
colCode = `uuid('${col.name}')`;
|
|
315
|
+
} else {
|
|
316
|
+
colCode = `${TYPE_MAP[col.type] || "text"}('${col.name}')`;
|
|
317
|
+
}
|
|
318
|
+
if (col.notNull) colCode += ".notNull()";
|
|
319
|
+
if (isSelf) {
|
|
320
|
+
code += `\t\t${colName}: ${colCode},\n`;
|
|
321
|
+
} else {
|
|
322
|
+
const refColName = col.references?.column || "id";
|
|
323
|
+
colCode += `.references(() => ${refTableName}Table.${refColName}`;
|
|
324
|
+
if (col.references?.onDelete) {
|
|
325
|
+
colCode += `, { onDelete: '${col.references.onDelete}' }`;
|
|
326
|
+
}
|
|
327
|
+
colCode += ")";
|
|
328
|
+
code += `\t\t${colName}: ${colCode},\n`;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
code += `\t}`;
|
|
332
|
+
} else {
|
|
333
|
+
code += `\treturn schema.table('${table.table_name}', ${tableName}Columns`;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (validIndexes.length > 0) {
|
|
337
|
+
code += `, (t) => [\n`;
|
|
338
|
+
for (const idx of validIndexes) {
|
|
339
|
+
const idxName =
|
|
340
|
+
idx.name || `${table.table_name}_${idx.columns.join("_")}_idx`;
|
|
341
|
+
const cols = idx.columns.map((c) => `t.${toCamelCase(c)}`).join(", ");
|
|
342
|
+
if (idx.unique) {
|
|
343
|
+
code += `\t\tuniqueIndex('${idxName}').on(${cols}),\n`;
|
|
344
|
+
} else {
|
|
345
|
+
code += `\t\tindex('${idxName}').on(${cols}),\n`;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
code += `\t]`;
|
|
349
|
+
}
|
|
350
|
+
code += ");\n";
|
|
351
|
+
code += "}\n";
|
|
352
|
+
|
|
353
|
+
return code;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function generateSchemaFile(tables: TableDef[]): string {
|
|
357
|
+
const allTableNames = tables.map((t) => t.table_name);
|
|
358
|
+
const imports = new Set<string>();
|
|
359
|
+
|
|
360
|
+
imports.add("pgTable");
|
|
361
|
+
imports.add("pgSchema");
|
|
362
|
+
imports.add("PgColumn");
|
|
363
|
+
imports.add("uuid");
|
|
364
|
+
imports.add("timestamp");
|
|
365
|
+
imports.add("boolean");
|
|
366
|
+
imports.add("index");
|
|
367
|
+
imports.add("uniqueIndex");
|
|
368
|
+
|
|
369
|
+
for (const table of tables) {
|
|
370
|
+
const columns = table.add_base_columns
|
|
371
|
+
? [...BASE_COLUMNS, ...table.columns]
|
|
372
|
+
: table.columns;
|
|
373
|
+
for (const col of columns) {
|
|
374
|
+
const drizzleType = TYPE_MAP[col.type];
|
|
375
|
+
if (drizzleType) imports.add(drizzleType);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
let code = `import { ${Array.from(imports).sort().join(", ")} } from 'drizzle-orm/pg-core';\n`;
|
|
380
|
+
code += `import { sql } from 'drizzle-orm';\n\n`;
|
|
381
|
+
|
|
382
|
+
for (const table of tables) {
|
|
383
|
+
code += generateTableCode(table, allTableNames);
|
|
384
|
+
code += "\n";
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
code += generateCreateAllForSchemaFunction(tables, allTableNames);
|
|
388
|
+
|
|
389
|
+
return code;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function generateCreateAllForSchemaFunction(
|
|
393
|
+
tables: TableDef[],
|
|
394
|
+
allTableNames: string[],
|
|
395
|
+
): string {
|
|
396
|
+
const sortedTables = topologicalSort(tables, allTableNames);
|
|
397
|
+
|
|
398
|
+
let code = `export function createAllTablesForSchema(schema: ReturnType<typeof pgSchema>) {\n`;
|
|
399
|
+
code += `\tconst tables: Record<string, unknown> = {};\n\n`;
|
|
400
|
+
|
|
401
|
+
for (const table of sortedTables) {
|
|
402
|
+
const tableName = toCamelCase(table.table_name);
|
|
403
|
+
const TableName = tableName.charAt(0).toUpperCase() + tableName.slice(1);
|
|
404
|
+
code += `\ttables.${tableName} = create${TableName}ForSchema(schema);\n`;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
code += `\n\treturn tables;\n`;
|
|
408
|
+
code += `}\n`;
|
|
409
|
+
|
|
410
|
+
return code;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function topologicalSort(
|
|
414
|
+
tables: TableDef[],
|
|
415
|
+
allTableNames: string[],
|
|
416
|
+
): TableDef[] {
|
|
417
|
+
const graph: Map<string, Set<string>> = new Map();
|
|
418
|
+
const tableMap: Map<string, TableDef> = new Map();
|
|
419
|
+
|
|
420
|
+
for (const table of tables) {
|
|
421
|
+
tableMap.set(table.table_name, table);
|
|
422
|
+
graph.set(table.table_name, new Set());
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
for (const table of tables) {
|
|
426
|
+
const columns = table.add_base_columns
|
|
427
|
+
? [...BASE_COLUMNS, ...table.columns]
|
|
428
|
+
: table.columns;
|
|
429
|
+
for (const col of columns) {
|
|
430
|
+
if (col.references && allTableNames.includes(col.references.table)) {
|
|
431
|
+
graph.get(table.table_name)?.add(col.references.table);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const visited = new Set<string>();
|
|
437
|
+
const result: TableDef[] = [];
|
|
438
|
+
|
|
439
|
+
function visit(name: string) {
|
|
440
|
+
if (visited.has(name)) return;
|
|
441
|
+
visited.add(name);
|
|
442
|
+
const deps = graph.get(name);
|
|
443
|
+
if (deps) {
|
|
444
|
+
for (const dep of deps) {
|
|
445
|
+
visit(dep);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const table = tableMap.get(name);
|
|
449
|
+
if (table) result.push(table);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
for (const table of tables) {
|
|
453
|
+
visit(table.table_name);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return result;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
function generateRelationsFile(tables: TableDef[]): string {
|
|
460
|
+
const allTableNames = new Set(tables.map((t) => t.table_name));
|
|
461
|
+
const relationsByTable: Map<
|
|
462
|
+
string,
|
|
463
|
+
{ to: string; fromCol: string; toCol: string; isSelf: boolean }[]
|
|
464
|
+
> = new Map();
|
|
465
|
+
|
|
466
|
+
for (const table of tables) {
|
|
467
|
+
const columns = table.add_base_columns
|
|
468
|
+
? [...BASE_COLUMNS, ...table.columns]
|
|
469
|
+
: table.columns;
|
|
470
|
+
for (const col of columns) {
|
|
471
|
+
if (col.references && allTableNames.has(col.references.table)) {
|
|
472
|
+
if (!relationsByTable.has(table.table_name)) {
|
|
473
|
+
relationsByTable.set(table.table_name, []);
|
|
474
|
+
}
|
|
475
|
+
relationsByTable.get(table.table_name)?.push({
|
|
476
|
+
to: col.references.table,
|
|
477
|
+
fromCol: col.name,
|
|
478
|
+
toCol: col.references.column,
|
|
479
|
+
isSelf: col.references.table === table.table_name,
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
let code = `import { relations } from 'drizzle-orm';\n`;
|
|
486
|
+
code += `import { ${tables.map((t) => toCamelCase(t.table_name)).join(", ")} } from './schema';\n\n`;
|
|
487
|
+
|
|
488
|
+
for (const [tableName, rels] of relationsByTable) {
|
|
489
|
+
const fromTable = toCamelCase(tableName);
|
|
490
|
+
code += `export const ${fromTable}Relations = relations(${fromTable}, ({ one, many }) => ({\n`;
|
|
491
|
+
|
|
492
|
+
for (const rel of rels) {
|
|
493
|
+
const toTable = toCamelCase(rel.to);
|
|
494
|
+
const relationName = rel.isSelf ? "parent" : toTable;
|
|
495
|
+
const fields = `${fromTable}.${toCamelCase(rel.fromCol)}`;
|
|
496
|
+
const references = `${toTable}.${toCamelCase(rel.toCol)}`;
|
|
497
|
+
|
|
498
|
+
code += `\t${relationName}: one(${toTable}, {\n`;
|
|
499
|
+
code += `\t\tfields: [${fields}],\n`;
|
|
500
|
+
code += `\t\treferences: [${references}],\n`;
|
|
501
|
+
code += `\t}),\n`;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
code += `}));\n\n`;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return code;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function main() {
|
|
511
|
+
const args = process.argv.slice(2);
|
|
512
|
+
const configArg = args[0];
|
|
513
|
+
const outputArg = args[1];
|
|
514
|
+
if (!configArg || !outputArg) {
|
|
515
|
+
console.error(
|
|
516
|
+
"Usage: bun run generate-schema.ts <config.json> <output-dir>",
|
|
517
|
+
);
|
|
518
|
+
process.exit(1);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const configPath = path.resolve(configArg);
|
|
522
|
+
const outputDir = path.resolve(outputArg);
|
|
523
|
+
|
|
524
|
+
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
525
|
+
const config: Config = JSON.parse(configContent);
|
|
526
|
+
|
|
527
|
+
const systemTablesPath = path.resolve(__dirname, "../src/system.tables.json");
|
|
528
|
+
let systemTables: SystemTables = { tables: [] };
|
|
529
|
+
if (fs.existsSync(systemTablesPath)) {
|
|
530
|
+
const systemContent = fs.readFileSync(systemTablesPath, "utf-8");
|
|
531
|
+
systemTables = JSON.parse(systemContent);
|
|
532
|
+
} else {
|
|
533
|
+
console.warn(`System tables not found at ${systemTablesPath}`);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const enabledFeatures = getEnabledFeatures(config);
|
|
537
|
+
const enabledSystemTables = systemTables.tables.filter((t) =>
|
|
538
|
+
isTableEnabled(t, enabledFeatures),
|
|
539
|
+
);
|
|
540
|
+
const customTables = config.entities || [];
|
|
541
|
+
const allTables = [...enabledSystemTables, ...customTables];
|
|
542
|
+
|
|
543
|
+
if (!fs.existsSync(outputDir)) {
|
|
544
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const schemaCode = generateSchemaFile(allTables);
|
|
548
|
+
fs.writeFileSync(path.join(outputDir, "schema.ts"), schemaCode);
|
|
549
|
+
console.log(`Generated: ${path.join(outputDir, "schema.ts")}`);
|
|
550
|
+
|
|
551
|
+
const relationsCode = generateRelationsFile(allTables);
|
|
552
|
+
fs.writeFileSync(path.join(outputDir, "relations.ts"), relationsCode);
|
|
553
|
+
console.log(`Generated: ${path.join(outputDir, "relations.ts")}`);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
main();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
|
|
4
|
+
const systemTablesPath = join(__dirname, "../src/system.tables.json");
|
|
5
|
+
const outputPath = join(__dirname, "../src/Client/ApiCaller/system-tables.ts");
|
|
6
|
+
|
|
7
|
+
const systemTablesJson = JSON.parse(readFileSync(systemTablesPath, "utf-8"));
|
|
8
|
+
|
|
9
|
+
const output = `// Auto-generated from system.tables.json - DO NOT EDIT MANUALLY
|
|
10
|
+
// Run: bun run scripts/generate-system-tables-types.ts
|
|
11
|
+
|
|
12
|
+
export const SYSTEM_TABLES = ${JSON.stringify(systemTablesJson.tables, null, 2)} as const
|
|
13
|
+
|
|
14
|
+
export type SystemTables = typeof SYSTEM_TABLES
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
writeFileSync(outputPath, output);
|
|
18
|
+
console.log("Generated system-tables.ts");
|