shutro-erp 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +411 -2
- package/dist/accounting/.kosh/bindings.d.ts +22 -0
- package/dist/accounting/.kosh/bindings.js +15 -0
- package/dist/accounting/.kosh/schema.d.ts +1140 -0
- package/dist/accounting/chart.d.ts +57 -0
- package/dist/accounting/chart.js +213 -0
- package/dist/accounting/closing.d.ts +47 -0
- package/dist/accounting/closing.js +223 -0
- package/dist/accounting/demo.d.ts +7 -0
- package/dist/accounting/demo.js +132 -0
- package/dist/accounting/index.d.ts +20 -0
- package/dist/accounting/index.js +910 -0
- package/dist/accounting/module.d.ts +6982 -0
- package/dist/accounting/module.js +1094 -0
- package/dist/accounting/payments.d.ts +63 -0
- package/dist/accounting/payments.js +451 -0
- package/dist/accounting/web/AgingPage.d.ts +4 -0
- package/dist/accounting/web/AgingPage.js +19 -0
- package/dist/accounting/web/ReconcilePage.d.ts +7 -0
- package/dist/accounting/web/ReconcilePage.js +79 -0
- package/dist/accounting/web/RegisterPayment.d.ts +8 -0
- package/dist/accounting/web/RegisterPayment.js +52 -0
- package/dist/accounting/web/SettingsPage.d.ts +7 -0
- package/dist/accounting/web/SettingsPage.js +58 -0
- package/dist/accounting/web/index.d.ts +15 -0
- package/dist/accounting/web/index.js +26 -0
- package/dist/accounting/web/messages.d.ts +2 -0
- package/dist/accounting/web/messages.js +117 -0
- package/dist/assistant/client.d.ts +62 -0
- package/dist/assistant/client.js +120 -0
- package/dist/assistant/form.d.ts +41 -0
- package/dist/assistant/form.js +134 -0
- package/dist/assistant/index.d.ts +31 -0
- package/dist/assistant/index.js +63 -0
- package/dist/assistant/models.d.ts +2 -0
- package/dist/assistant/models.js +47 -0
- package/dist/assistant/record.d.ts +26 -0
- package/dist/assistant/record.js +125 -0
- package/dist/assistant/routes.d.ts +31 -0
- package/dist/assistant/routes.js +498 -0
- package/dist/assistant/search.d.ts +38 -0
- package/dist/assistant/search.js +168 -0
- package/dist/assistant/web/AskButton.d.ts +17 -0
- package/dist/assistant/web/AskButton.js +48 -0
- package/dist/assistant/web/AssistantSettings.d.ts +8 -0
- package/dist/assistant/web/AssistantSettings.js +42 -0
- package/dist/assistant/web/ChatterAssist.d.ts +8 -0
- package/dist/assistant/web/ChatterAssist.js +77 -0
- package/dist/assistant/web/FillButton.d.ts +8 -0
- package/dist/assistant/web/FillButton.js +74 -0
- package/dist/assistant/web/index.d.ts +15 -0
- package/dist/assistant/web/index.js +26 -0
- package/dist/assistant/web/messages.d.ts +2 -0
- package/dist/assistant/web/messages.js +126 -0
- package/dist/automation/cron.d.ts +18 -0
- package/dist/automation/cron.js +82 -0
- package/dist/automation/engine.d.ts +186 -0
- package/dist/automation/engine.js +1082 -0
- package/dist/automation/index.d.ts +24 -0
- package/dist/automation/index.js +177 -0
- package/dist/automation/models.d.ts +6 -0
- package/dist/automation/models.js +130 -0
- package/dist/automation/module-rules.d.ts +19 -0
- package/dist/automation/module-rules.js +78 -0
- package/dist/automation/routes.d.ts +14 -0
- package/dist/automation/routes.js +81 -0
- package/dist/automation/web/RetryRun.d.ts +4 -0
- package/dist/automation/web/RetryRun.js +20 -0
- package/dist/automation/web/RuleEditor.d.ts +9 -0
- package/dist/automation/web/RuleEditor.js +316 -0
- package/dist/automation/web/index.d.ts +13 -0
- package/dist/automation/web/index.js +20 -0
- package/dist/automation/web/messages.d.ts +2 -0
- package/dist/automation/web/messages.js +217 -0
- package/dist/cli/apps.d.ts +12 -0
- package/dist/cli/apps.js +249 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +6 -0
- package/dist/cli/index.d.ts +21 -0
- package/dist/cli/index.js +145 -0
- package/dist/cli/init.d.ts +13 -0
- package/dist/cli/init.js +832 -0
- package/dist/cli/project.d.ts +36 -0
- package/dist/cli/project.js +473 -0
- package/dist/cli/prompt.d.ts +33 -0
- package/dist/cli/prompt.js +118 -0
- package/dist/cli/templates.d.ts +56 -0
- package/dist/cli/templates.js +443 -0
- package/dist/cli/ui.d.ts +87 -0
- package/dist/cli/ui.js +231 -0
- package/dist/contacts/.kosh/bindings.d.ts +22 -0
- package/dist/contacts/.kosh/bindings.js +15 -0
- package/dist/contacts/.kosh/schema.d.ts +267 -0
- package/dist/contacts/demo.d.ts +9 -0
- package/dist/contacts/demo.js +38 -0
- package/dist/contacts/index.d.ts +9 -0
- package/dist/contacts/index.js +81 -0
- package/dist/contacts/module.d.ts +780 -0
- package/dist/contacts/module.js +63 -0
- package/dist/mail/inbound/handle.d.ts +72 -0
- package/dist/mail/inbound/handle.js +509 -0
- package/dist/mail/inbound/index.d.ts +7 -0
- package/dist/mail/inbound/index.js +7 -0
- package/dist/mail/inbound/models.d.ts +4 -0
- package/dist/mail/inbound/models.js +66 -0
- package/dist/mail/inbound/parse.d.ts +52 -0
- package/dist/mail/inbound/parse.js +310 -0
- package/dist/mail/inbound/poller.d.ts +26 -0
- package/dist/mail/inbound/poller.js +100 -0
- package/dist/mail/inbound/routes.d.ts +6 -0
- package/dist/mail/inbound/routes.js +88 -0
- package/dist/mail/inbound/token.d.ts +22 -0
- package/dist/mail/inbound/token.js +65 -0
- package/dist/mail/index.d.ts +77 -0
- package/dist/mail/index.js +172 -0
- package/dist/mail/web/InboundPage.d.ts +7 -0
- package/dist/mail/web/InboundPage.js +74 -0
- package/dist/mail/web/index.d.ts +12 -0
- package/dist/mail/web/index.js +17 -0
- package/dist/mail/web/messages.d.ts +2 -0
- package/dist/mail/web/messages.js +81 -0
- package/dist/messaging/body.d.ts +17 -0
- package/dist/messaging/body.js +98 -0
- package/dist/messaging/chat-routes.d.ts +20 -0
- package/dist/messaging/chat-routes.js +83 -0
- package/dist/messaging/chat.d.ts +108 -0
- package/dist/messaging/chat.js +524 -0
- package/dist/messaging/chatter.d.ts +173 -0
- package/dist/messaging/chatter.js +657 -0
- package/dist/messaging/index.d.ts +22 -0
- package/dist/messaging/index.js +71 -0
- package/dist/messaging/models.d.ts +15 -0
- package/dist/messaging/models.js +194 -0
- package/dist/messaging/routes.d.ts +21 -0
- package/dist/messaging/routes.js +97 -0
- package/dist/messaging/web/Chat.d.ts +25 -0
- package/dist/messaging/web/Chat.js +382 -0
- package/dist/messaging/web/ChatDock.d.ts +8 -0
- package/dist/messaging/web/ChatDock.js +72 -0
- package/dist/messaging/web/Chatter.d.ts +47 -0
- package/dist/messaging/web/Chatter.js +441 -0
- package/dist/messaging/web/index.d.ts +15 -0
- package/dist/messaging/web/index.js +24 -0
- package/dist/messaging/web/messages.d.ts +2 -0
- package/dist/messaging/web/messages.js +229 -0
- package/dist/modules-sdk/apps.d.ts +74 -0
- package/dist/modules-sdk/apps.js +213 -0
- package/dist/modules-sdk/demo.d.ts +3 -0
- package/dist/modules-sdk/demo.js +9 -0
- package/dist/modules-sdk/errors.d.ts +11 -0
- package/dist/modules-sdk/errors.js +20 -0
- package/dist/modules-sdk/index.d.ts +10 -0
- package/dist/modules-sdk/index.js +10 -0
- package/dist/modules-sdk/loader.d.ts +25 -0
- package/dist/modules-sdk/loader.js +111 -0
- package/dist/modules-sdk/manifest.d.ts +264 -0
- package/dist/modules-sdk/manifest.js +84 -0
- package/dist/modules-sdk/semver.d.ts +7 -0
- package/dist/modules-sdk/semver.js +70 -0
- package/dist/notify/digest.d.ts +17 -0
- package/dist/notify/digest.js +137 -0
- package/dist/notify/email.d.ts +71 -0
- package/dist/notify/email.js +271 -0
- package/dist/notify/fallback.d.ts +24 -0
- package/dist/notify/fallback.js +101 -0
- package/dist/notify/inbox.d.ts +36 -0
- package/dist/notify/inbox.js +240 -0
- package/dist/notify/index.d.ts +43 -0
- package/dist/notify/index.js +89 -0
- package/dist/notify/jobs.d.ts +9 -0
- package/dist/notify/jobs.js +7 -0
- package/dist/notify/messages.d.ts +24 -0
- package/dist/notify/messages.js +61 -0
- package/dist/notify/messenger.d.ts +45 -0
- package/dist/notify/messenger.js +90 -0
- package/dist/notify/models.d.ts +8 -0
- package/dist/notify/models.js +145 -0
- package/dist/notify/prefs.d.ts +20 -0
- package/dist/notify/prefs.js +60 -0
- package/dist/notify/push.d.ts +87 -0
- package/dist/notify/push.js +172 -0
- package/dist/notify/quiet.d.ts +34 -0
- package/dist/notify/quiet.js +92 -0
- package/dist/notify/routes.d.ts +33 -0
- package/dist/notify/routes.js +211 -0
- package/dist/notify/web/NotificationBell.d.ts +8 -0
- package/dist/notify/web/NotificationBell.js +72 -0
- package/dist/notify/web/NotificationSettings.d.ts +12 -0
- package/dist/notify/web/NotificationSettings.js +75 -0
- package/dist/notify/web/index.d.ts +13 -0
- package/dist/notify/web/index.js +18 -0
- package/dist/notify/web/messages.d.ts +1 -0
- package/dist/notify/web/messages.js +116 -0
- package/dist/notify/web/push.d.ts +12 -0
- package/dist/notify/web/push.js +83 -0
- package/dist/permissions/admin.d.ts +13 -0
- package/dist/permissions/admin.js +389 -0
- package/dist/permissions/approvals.d.ts +56 -0
- package/dist/permissions/approvals.js +273 -0
- package/dist/permissions/index.d.ts +18 -0
- package/dist/permissions/index.js +41 -0
- package/dist/permissions/models.d.ts +3 -0
- package/dist/permissions/models.js +142 -0
- package/dist/permissions/routes.d.ts +11 -0
- package/dist/permissions/routes.js +41 -0
- package/dist/permissions/web/ApprovalPanel.d.ts +9 -0
- package/dist/permissions/web/ApprovalPanel.js +48 -0
- package/dist/permissions/web/index.d.ts +9 -0
- package/dist/permissions/web/index.js +6 -0
- package/dist/product/.kosh/bindings.d.ts +22 -0
- package/dist/product/.kosh/bindings.js +15 -0
- package/dist/product/.kosh/schema.d.ts +330 -0
- package/dist/product/demo.d.ts +3 -0
- package/dist/product/demo.js +74 -0
- package/dist/product/index.d.ts +8 -0
- package/dist/product/index.js +117 -0
- package/dist/product/module.d.ts +1251 -0
- package/dist/product/module.js +136 -0
- package/dist/project/.kosh/bindings.d.ts +22 -0
- package/dist/project/.kosh/bindings.js +15 -0
- package/dist/project/.kosh/schema.d.ts +592 -0
- package/dist/project/demo.d.ts +11 -0
- package/dist/project/demo.js +148 -0
- package/dist/project/index.d.ts +4 -0
- package/dist/project/index.js +222 -0
- package/dist/project/module.d.ts +2069 -0
- package/dist/project/module.js +193 -0
- package/dist/purchase/.kosh/bindings.d.ts +22 -0
- package/dist/purchase/.kosh/bindings.js +15 -0
- package/dist/purchase/.kosh/schema.d.ts +734 -0
- package/dist/purchase/demo.d.ts +12 -0
- package/dist/purchase/demo.js +101 -0
- package/dist/purchase/index.d.ts +3 -0
- package/dist/purchase/index.js +177 -0
- package/dist/purchase/module.d.ts +2321 -0
- package/dist/purchase/module.js +207 -0
- package/dist/purchase_account/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_account/.kosh/bindings.js +15 -0
- package/dist/purchase_account/.kosh/schema.d.ts +1216 -0
- package/dist/purchase_account/demo.d.ts +3 -0
- package/dist/purchase_account/demo.js +19 -0
- package/dist/purchase_account/index.d.ts +3 -0
- package/dist/purchase_account/index.js +52 -0
- package/dist/purchase_account/module.d.ts +5643 -0
- package/dist/purchase_account/module.js +105 -0
- package/dist/realtime/gateway.d.ts +29 -0
- package/dist/realtime/gateway.js +364 -0
- package/dist/realtime/index.d.ts +18 -0
- package/dist/realtime/index.js +34 -0
- package/dist/reporting/documents.d.ts +51 -0
- package/dist/reporting/documents.js +321 -0
- package/dist/reporting/index.d.ts +25 -0
- package/dist/reporting/index.js +142 -0
- package/dist/reporting/models.d.ts +2 -0
- package/dist/reporting/models.js +125 -0
- package/dist/reporting/pivot.d.ts +91 -0
- package/dist/reporting/pivot.js +427 -0
- package/dist/reporting/routes-documents.d.ts +36 -0
- package/dist/reporting/routes-documents.js +430 -0
- package/dist/reporting/routes.d.ts +22 -0
- package/dist/reporting/routes.js +314 -0
- package/dist/reporting/schedules.d.ts +68 -0
- package/dist/reporting/schedules.js +204 -0
- package/dist/reporting/web/CalendarView.d.ts +10 -0
- package/dist/reporting/web/CalendarView.js +105 -0
- package/dist/reporting/web/CohortView.d.ts +19 -0
- package/dist/reporting/web/CohortView.js +77 -0
- package/dist/reporting/web/DashboardView.d.ts +23 -0
- package/dist/reporting/web/DashboardView.js +214 -0
- package/dist/reporting/web/DesignerView.d.ts +3 -0
- package/dist/reporting/web/DesignerView.js +229 -0
- package/dist/reporting/web/GanttView.d.ts +12 -0
- package/dist/reporting/web/GanttView.js +93 -0
- package/dist/reporting/web/GraphView.d.ts +37 -0
- package/dist/reporting/web/GraphView.js +158 -0
- package/dist/reporting/web/HierarchyView.d.ts +8 -0
- package/dist/reporting/web/HierarchyView.js +89 -0
- package/dist/reporting/web/MapView.d.ts +10 -0
- package/dist/reporting/web/MapView.js +97 -0
- package/dist/reporting/web/PivotView.d.ts +8 -0
- package/dist/reporting/web/PivotView.js +148 -0
- package/dist/reporting/web/SpreadsheetView.d.ts +8 -0
- package/dist/reporting/web/SpreadsheetView.js +159 -0
- package/dist/reporting/web/components.d.ts +9 -0
- package/dist/reporting/web/components.js +48 -0
- package/dist/reporting/web/formula.d.ts +24 -0
- package/dist/reporting/web/formula.js +357 -0
- package/dist/reporting/web/index.d.ts +24 -0
- package/dist/reporting/web/index.js +51 -0
- package/dist/reporting/web/messages.d.ts +2 -0
- package/dist/reporting/web/messages.js +125 -0
- package/dist/reporting/web/shared.d.ts +33 -0
- package/dist/reporting/web/shared.js +88 -0
- package/dist/reporting/xlsx.d.ts +26 -0
- package/dist/reporting/xlsx.js +178 -0
- package/dist/sale_account/.kosh/bindings.d.ts +22 -0
- package/dist/sale_account/.kosh/bindings.js +15 -0
- package/dist/sale_account/.kosh/schema.d.ts +1213 -0
- package/dist/sale_account/demo.d.ts +3 -0
- package/dist/sale_account/demo.js +15 -0
- package/dist/sale_account/index.d.ts +3 -0
- package/dist/sale_account/index.js +52 -0
- package/dist/sale_account/module.d.ts +5603 -0
- package/dist/sale_account/module.js +105 -0
- package/dist/sale_project/.kosh/bindings.d.ts +22 -0
- package/dist/sale_project/.kosh/bindings.js +15 -0
- package/dist/sale_project/.kosh/schema.d.ts +769 -0
- package/dist/sale_project/demo.d.ts +6 -0
- package/dist/sale_project/demo.js +28 -0
- package/dist/sale_project/index.d.ts +13 -0
- package/dist/sale_project/index.js +60 -0
- package/dist/sale_project/module.d.ts +3615 -0
- package/dist/sale_project/module.js +110 -0
- package/dist/sales/.kosh/bindings.d.ts +22 -0
- package/dist/sales/.kosh/bindings.js +15 -0
- package/dist/sales/.kosh/schema.d.ts +648 -0
- package/dist/sales/demo.d.ts +9 -0
- package/dist/sales/demo.js +91 -0
- package/dist/sales/index.d.ts +3 -0
- package/dist/sales/index.js +144 -0
- package/dist/sales/module.d.ts +2245 -0
- package/dist/sales/module.js +195 -0
- package/dist/search/index.d.ts +62 -0
- package/dist/search/index.js +141 -0
- package/dist/server/api/changes.d.ts +29 -0
- package/dist/server/api/changes.js +40 -0
- package/dist/server/api/client.d.ts +17 -0
- package/dist/server/api/client.js +379 -0
- package/dist/server/api/idempotency.d.ts +22 -0
- package/dist/server/api/idempotency.js +56 -0
- package/dist/server/api/metadata.d.ts +64 -0
- package/dist/server/api/metadata.js +87 -0
- package/dist/server/api/navigation.d.ts +74 -0
- package/dist/server/api/navigation.js +195 -0
- package/dist/server/api/openapi.d.ts +21 -0
- package/dist/server/api/openapi.js +348 -0
- package/dist/server/api/rest.d.ts +27 -0
- package/dist/server/api/rest.js +449 -0
- package/dist/server/api/views.d.ts +66 -0
- package/dist/server/api/views.js +306 -0
- package/dist/server/apps.d.ts +131 -0
- package/dist/server/apps.js +445 -0
- package/dist/server/audit.d.ts +20 -0
- package/dist/server/audit.js +25 -0
- package/dist/server/auth/admins.d.ts +25 -0
- package/dist/server/auth/admins.js +69 -0
- package/dist/server/auth/base.d.ts +11 -0
- package/dist/server/auth/base.js +193 -0
- package/dist/server/auth/crypto.d.ts +19 -0
- package/dist/server/auth/crypto.js +99 -0
- package/dist/server/auth/install.d.ts +23 -0
- package/dist/server/auth/install.js +17 -0
- package/dist/server/auth/routes.d.ts +19 -0
- package/dist/server/auth/routes.js +55 -0
- package/dist/server/auth/service.d.ts +107 -0
- package/dist/server/auth/service.js +481 -0
- package/dist/server/demo.d.ts +28 -0
- package/dist/server/demo.js +84 -0
- package/dist/server/errors.d.ts +20 -0
- package/dist/server/errors.js +88 -0
- package/dist/server/host.d.ts +48 -0
- package/dist/server/host.js +179 -0
- package/dist/server/identity.d.ts +48 -0
- package/dist/server/identity.js +57 -0
- package/dist/server/index.d.ts +29 -0
- package/dist/server/index.js +29 -0
- package/dist/server/orm.d.ts +25 -0
- package/dist/server/orm.js +24 -0
- package/dist/server/registry.d.ts +20 -0
- package/dist/server/registry.js +58 -0
- package/dist/server/server.d.ts +115 -0
- package/dist/server/server.js +230 -0
- package/dist/server/telemetry.d.ts +22 -0
- package/dist/server/telemetry.js +37 -0
- package/dist/settings/index.d.ts +18 -0
- package/dist/settings/index.js +51 -0
- package/dist/settings/routes.d.ts +45 -0
- package/dist/settings/routes.js +155 -0
- package/dist/settings/web/AppsPage.d.ts +9 -0
- package/dist/settings/web/AppsPage.js +135 -0
- package/dist/settings/web/index.d.ts +12 -0
- package/dist/settings/web/index.js +17 -0
- package/dist/settings/web/messages.d.ts +2 -0
- package/dist/settings/web/messages.js +113 -0
- package/dist/storage/attachments.d.ts +48 -0
- package/dist/storage/attachments.js +137 -0
- package/dist/storage/backends.d.ts +49 -0
- package/dist/storage/backends.js +162 -0
- package/dist/storage/index.d.ts +20 -0
- package/dist/storage/index.js +29 -0
- package/dist/storage/models.d.ts +2 -0
- package/dist/storage/models.js +34 -0
- package/dist/storage/routes.d.ts +24 -0
- package/dist/storage/routes.js +134 -0
- package/dist/storage/sigv4.d.ts +20 -0
- package/dist/storage/sigv4.js +70 -0
- package/dist/studio/build.d.ts +16 -0
- package/dist/studio/build.js +67 -0
- package/dist/studio/diff.d.ts +9 -0
- package/dist/studio/diff.js +106 -0
- package/dist/studio/edit.d.ts +74 -0
- package/dist/studio/edit.js +150 -0
- package/dist/studio/generate.d.ts +26 -0
- package/dist/studio/generate.js +278 -0
- package/dist/studio/git.d.ts +43 -0
- package/dist/studio/git.js +167 -0
- package/dist/studio/index.d.ts +18 -0
- package/dist/studio/index.js +18 -0
- package/dist/studio/module.d.ts +45 -0
- package/dist/studio/module.js +488 -0
- package/dist/studio/spec.d.ts +148 -0
- package/dist/studio/spec.js +173 -0
- package/dist/studio/web/FieldEditor.d.ts +31 -0
- package/dist/studio/web/FieldEditor.js +54 -0
- package/dist/studio/web/Review.d.ts +24 -0
- package/dist/studio/web/Review.js +65 -0
- package/dist/studio/web/Sections.d.ts +24 -0
- package/dist/studio/web/Sections.js +59 -0
- package/dist/studio/web/StudioPage.d.ts +8 -0
- package/dist/studio/web/StudioPage.js +47 -0
- package/dist/studio/web/StudioToggle.d.ts +34 -0
- package/dist/studio/web/StudioToggle.js +86 -0
- package/dist/studio/web/index.d.ts +15 -0
- package/dist/studio/web/index.js +22 -0
- package/dist/studio/web/messages.d.ts +2 -0
- package/dist/studio/web/messages.js +151 -0
- package/dist/ui/api.d.ts +198 -0
- package/dist/ui/api.js +307 -0
- package/dist/ui/app.d.ts +13 -0
- package/dist/ui/app.js +539 -0
- package/dist/ui/components/AppIcon.d.ts +6 -0
- package/dist/ui/components/AppIcon.js +45 -0
- package/dist/ui/components/primitives.d.ts +70 -0
- package/dist/ui/components/primitives.js +114 -0
- package/dist/ui/context.d.ts +41 -0
- package/dist/ui/context.js +67 -0
- package/dist/ui/design.d.ts +40 -0
- package/dist/ui/design.js +34 -0
- package/dist/ui/i18n/index.d.ts +13 -0
- package/dist/ui/i18n/index.js +42 -0
- package/dist/ui/i18n/messages.d.ts +262 -0
- package/dist/ui/i18n/messages.js +490 -0
- package/dist/ui/index.d.ts +41 -0
- package/dist/ui/index.js +52 -0
- package/dist/ui/lib/cn.d.ts +3 -0
- package/dist/ui/lib/cn.js +6 -0
- package/dist/ui/lib/format.d.ts +17 -0
- package/dist/ui/lib/format.js +47 -0
- package/dist/ui/live.d.ts +16 -0
- package/dist/ui/live.js +75 -0
- package/dist/ui/offline/db.d.ts +4 -0
- package/dist/ui/offline/db.js +37 -0
- package/dist/ui/offline/persist.d.ts +27 -0
- package/dist/ui/offline/persist.js +100 -0
- package/dist/ui/offline/queue.d.ts +61 -0
- package/dist/ui/offline/queue.js +155 -0
- package/dist/ui/prefill.d.ts +13 -0
- package/dist/ui/prefill.js +15 -0
- package/dist/ui/pwa/register.d.ts +3 -0
- package/dist/ui/pwa/register.js +37 -0
- package/dist/ui/pwa/vite.d.ts +17 -0
- package/dist/ui/pwa/vite.js +44 -0
- package/dist/ui/pwa/worker.d.ts +15 -0
- package/dist/ui/pwa/worker.js +92 -0
- package/dist/ui/realtime.d.ts +39 -0
- package/dist/ui/realtime.js +148 -0
- package/dist/ui/registry.d.ts +157 -0
- package/dist/ui/registry.js +112 -0
- package/dist/ui/search/SearchBar.d.ts +18 -0
- package/dist/ui/search/SearchBar.js +88 -0
- package/dist/ui/shell/CommandPalette.d.ts +11 -0
- package/dist/ui/shell/CommandPalette.js +273 -0
- package/dist/ui/shell/Home.d.ts +2 -0
- package/dist/ui/shell/Home.js +75 -0
- package/dist/ui/shell/Login.d.ts +6 -0
- package/dist/ui/shell/Login.js +40 -0
- package/dist/ui/shell/OfflineMenu.d.ts +4 -0
- package/dist/ui/shell/OfflineMenu.js +64 -0
- package/dist/ui/shell/recent.d.ts +17 -0
- package/dist/ui/shell/recent.js +27 -0
- package/dist/ui/shell/shortcuts.d.ts +29 -0
- package/dist/ui/shell/shortcuts.js +118 -0
- package/dist/ui/shell/toast.d.ts +22 -0
- package/dist/ui/shell/toast.js +44 -0
- package/dist/ui/styles.css +105 -0
- package/dist/ui/views/FormView.d.ts +4 -0
- package/dist/ui/views/FormView.js +401 -0
- package/dist/ui/views/KanbanView.d.ts +12 -0
- package/dist/ui/views/KanbanView.js +235 -0
- package/dist/ui/views/ListView.d.ts +4 -0
- package/dist/ui/views/ListView.js +838 -0
- package/dist/ui/views/grid.d.ts +48 -0
- package/dist/ui/views/grid.js +216 -0
- package/dist/ui/views/listMemory.d.ts +9 -0
- package/dist/ui/views/listMemory.js +24 -0
- package/dist/ui/views/widgets.d.ts +14 -0
- package/dist/ui/views/widgets.js +252 -0
- package/dist/views/builders.d.ts +139 -0
- package/dist/views/builders.js +175 -0
- package/dist/views/condition.d.ts +23 -0
- package/dist/views/condition.js +121 -0
- package/dist/views/documents.d.ts +63 -0
- package/dist/views/documents.js +1 -0
- package/dist/views/extend.d.ts +23 -0
- package/dist/views/extend.js +221 -0
- package/dist/views/index.d.ts +17 -0
- package/dist/views/index.js +15 -0
- package/dist/views/types.d.ts +291 -0
- package/dist/views/types.js +6 -0
- package/dist/views/validate.d.ts +17 -0
- package/dist/views/validate.js +228 -0
- package/package.json +266 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Isahaq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,412 @@
|
|
|
1
|
-
#
|
|
1
|
+
# shutro-erp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Kosh** is an ERP framework for Node.js, TypeScript and PostgreSQL, built on the
|
|
4
|
+
[Shutro](https://www.npmjs.com/package/shutro) ORM. Define a model once and get a REST API with OpenAPI, a typed
|
|
5
|
+
client, list / form / kanban / pivot / graph / calendar / gantt / map / dashboard views, exports, PDF documents and a
|
|
6
|
+
chatter on every record. Permissions are checked on the server on every route.
|
|
7
|
+
|
|
8
|
+
- [Requirements](#requirements)
|
|
9
|
+
- [Install with the terminal](#install-with-the-terminal)
|
|
10
|
+
- [Install with Docker](#install-with-docker)
|
|
11
|
+
- [Project structure](#project-structure)
|
|
12
|
+
- [Modules](#modules): structure, create, install, remove
|
|
13
|
+
- [Migrations](#migrations): schema and per-module data migrations
|
|
14
|
+
- [Seed data](#seed-data): per-module seeders
|
|
15
|
+
- [Users and roles](#users-and-roles)
|
|
16
|
+
- [Configuration (.env)](#configuration-env)
|
|
17
|
+
- [Command reference](#command-reference)
|
|
18
|
+
- [Entry points](#entry-points) · [Troubleshooting](#troubleshooting)
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- **Node.js 24** or later (`node --version`)
|
|
23
|
+
- **PostgreSQL 16** or later, or **Docker** (Kosh can start PostgreSQL for you)
|
|
24
|
+
- An authenticator app for the administrator's second factor (Google Authenticator, Microsoft Authenticator,
|
|
25
|
+
1Password, …)
|
|
26
|
+
|
|
27
|
+
## Install with the terminal
|
|
28
|
+
|
|
29
|
+
One command creates the project, installs Kosh and asks for everything it needs:
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npx shutro-erp@latest init my-erp # the project my-erp
|
|
33
|
+
npx shutro-erp@latest init # asks for the project name first
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
(`pnpm dlx shutro-erp init my-erp` and `yarn dlx shutro-erp init my-erp` work too.) In an existing folder:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
npm install shutro-erp # Shutro, the ORM, comes with it
|
|
40
|
+
npx kosh init
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The setup asks for what the installation needs. Press **Enter** to keep the value in `[brackets]`:
|
|
44
|
+
|
|
45
|
+
| Question | Example | Notes |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| PostgreSQL | `1` your server, `2` start one in Docker | `2` needs Docker Desktop running; it writes `compose.yaml` and starts the `db` service |
|
|
48
|
+
| Username, password, port, host, database name | `postgres`, (hidden), `5432`, `localhost`, `my_erp` | for `1`; a missing database is created after you confirm; if nothing answers, it offers Docker instead |
|
|
49
|
+
| Company name, currency | `Padma Traders`, `BDT` | the first company; more companies later |
|
|
50
|
+
| Language, time zone | `bn`, `Asia/Dhaka` | the administrator's |
|
|
51
|
+
| Administrator login, name, email, password | `admin`, …, 12+ characters | the password is typed hidden and stored only as a hash |
|
|
52
|
+
| Apps | `permissions,reporting,messaging` | roles and approvals, reports and documents, chatter and attachments |
|
|
53
|
+
| File storage | `1` a folder, `2` S3-compatible | S3, SeaweedFS, MinIO; the bucket is created |
|
|
54
|
+
| Valkey/Redis URL | empty | optional: rate limits and caches shared by several servers |
|
|
55
|
+
| API port | `3000` | |
|
|
56
|
+
| Authenticator code | `123456` | scan the printed secret, type a code; **keep the recovery codes** it prints |
|
|
57
|
+
|
|
58
|
+
Then it writes the project, creates the database tables (`migrations/0001_init.sql`), the company and the
|
|
59
|
+
administrator, and loads the apps' default data. Run `npm install` once in the project, then start it:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
npm start # the API on http://localhost:3000
|
|
63
|
+
npm run web # the back-office on http://localhost:5173, in a second terminal
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Sign in with the administrator's login, password and a code from the authenticator app.
|
|
67
|
+
|
|
68
|
+
**Without questions** (scripts, CI): pass the answers as flags.
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npx shutro-erp@latest init my-erp --yes --docker-db --admin-password "a long passphrase here"
|
|
72
|
+
|
|
73
|
+
npx kosh init --yes \
|
|
74
|
+
--database-url postgres://postgres:postgres@localhost:5432/my_erp --create-database \
|
|
75
|
+
--company "Padma Traders" --currency BDT --lang bn --tz Asia/Dhaka \
|
|
76
|
+
--admin-login admin --admin-password "a long passphrase here" \
|
|
77
|
+
--apps permissions,reporting,messaging --storage-dir ./var/attachments --port 3000
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
With `--yes` nothing is asked, so the authenticator is not enrolled: run `npx kosh init` again in a terminal to
|
|
81
|
+
enrol it (administrator rights wait for it). `npx kosh init --help` lists every flag. Replies by email: set `MAIL_INBOUND_DOMAIN` in `.env` (the secrets are generated) and point your email provider's inbound webhook at `/api/v1/mail/inbound` with the `MAIL_INBOUND_WEBHOOK_SECRET`. `--demo` (or a yes to the
|
|
82
|
+
question after the apps) loads a sample company with contacts, products, orders, invoices and projects, made by
|
|
83
|
+
the demo users `dina`, `rahim`, `karim` and `sumi` (one shared password, printed at the end); not for production.
|
|
84
|
+
|
|
85
|
+
## Install with Docker
|
|
86
|
+
|
|
87
|
+
`kosh init` writes `Dockerfile`, `compose.yaml`, `nginx.conf` and `.dockerignore` into every project.
|
|
88
|
+
|
|
89
|
+
**PostgreSQL in Docker, the app on your machine** (development):
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
npx shutro-erp@latest init my-erp # answer 2 to "PostgreSQL": it starts the db service for you
|
|
93
|
+
cd my-erp && npm start # the API; npm run web for the back-office
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
or start the database yourself first:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
docker compose up -d db # uses POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB / POSTGRES_PORT from .env
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Everything in Docker** (a server, a demo):
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
npx shutro-erp@latest init my-erp # once: the project, .env, tables, administrator (answer 2 for PostgreSQL)
|
|
106
|
+
cd my-erp
|
|
107
|
+
docker compose up -d --build # db + api + web; the back-office on http://localhost:8080
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
| Service | What | Port |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| `db` | PostgreSQL 18, data in the `db` volume | `127.0.0.1:5432` (`POSTGRES_PORT`) |
|
|
113
|
+
| `api` | the Kosh API; runs `kosh migrate` on every start, then serves | inside the network (`api:3000`) |
|
|
114
|
+
| `web` | nginx with the built back-office, `/api` proxied to `api` | `8080` (`WEB_PORT`) |
|
|
115
|
+
|
|
116
|
+
Useful commands:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
docker compose logs -f api # the API's log
|
|
120
|
+
docker compose exec api npx kosh migrate status # any kosh command inside the container
|
|
121
|
+
docker compose exec api npx kosh seed
|
|
122
|
+
docker compose up -d --build api # after changing modules: rebuild and migrate
|
|
123
|
+
docker compose down # stop (volumes keep the data)
|
|
124
|
+
docker compose exec db pg_dump -U kosh my_erp > backup.sql # a backup
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Behind HTTPS, set `KOSH_SECURE_COOKIES: "true"` in `compose.yaml`. To use a PostgreSQL server outside Docker, set
|
|
128
|
+
`DOCKER_DATABASE_URL` in `.env` (an address the container can reach, not `localhost`).
|
|
129
|
+
|
|
130
|
+
## Project structure
|
|
131
|
+
|
|
132
|
+
```text
|
|
133
|
+
my-erp/
|
|
134
|
+
├── .env settings and credentials (not committed)
|
|
135
|
+
├── package.json scripts: start, web, build:web, migrate, seed, docker:up
|
|
136
|
+
├── migrations/ versioned schema migrations: 0001_init.sql, 0002_update.sql, … (commit them)
|
|
137
|
+
├── src/
|
|
138
|
+
│ ├── modules.ts the installed modules: base, the apps, your modules
|
|
139
|
+
│ ├── server.ts the API server (npm start)
|
|
140
|
+
│ ├── modules/ your modules (kosh module create <name>)
|
|
141
|
+
│ │ └── library/
|
|
142
|
+
│ │ ├── index.ts the module: groups, access levels, app, menus, actions, views
|
|
143
|
+
│ │ ├── models.ts its models (fields, access per group, record rules)
|
|
144
|
+
│ │ ├── data.ts its seed data
|
|
145
|
+
│ │ └── migrations.ts its data migrations
|
|
146
|
+
│ └── web/
|
|
147
|
+
│ ├── main.tsx the back-office (React): renderers of each installed app
|
|
148
|
+
│ └── index.css Tailwind + Kosh's design tokens
|
|
149
|
+
├── index.html, vite.config.ts the back-office build (npm run web / build:web)
|
|
150
|
+
├── Dockerfile, compose.yaml, nginx.conf, .dockerignore
|
|
151
|
+
└── var/attachments/ uploaded files (with folder storage)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Modules
|
|
155
|
+
|
|
156
|
+
A module is a folder with its models and a manifest. Create one:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
npx kosh module create library
|
|
160
|
+
npx kosh migrate # creates its tables, records it, loads its seed data
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
It writes `src/modules/library/` and adds `library` to `src/modules.ts`. After `npm start` and a reload of the
|
|
164
|
+
back-office, the **Library** app appears for the administrator.
|
|
165
|
+
|
|
166
|
+
**`models.ts`**: models and their fields, with access per group (nobody has access by default):
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import { orm } from 'shutro-erp/orm';
|
|
170
|
+
const { defineModel, f } = orm;
|
|
171
|
+
|
|
172
|
+
export const Book = defineModel('library.book', {
|
|
173
|
+
archivable: true,
|
|
174
|
+
access: {
|
|
175
|
+
'library.user': ['read', 'write', 'create'],
|
|
176
|
+
'library.manager': ['read', 'write', 'create', 'unlink', 'export', 'import'],
|
|
177
|
+
},
|
|
178
|
+
order: ['title asc'],
|
|
179
|
+
fields: {
|
|
180
|
+
title: f.char({ required: true }),
|
|
181
|
+
isbn: f.char({ index: 'unique' }),
|
|
182
|
+
author: f.many2one('res.partner'),
|
|
183
|
+
price: f.decimal({ scale: 2 }),
|
|
184
|
+
state: f.state({
|
|
185
|
+
states: { draft: 'Draft', available: 'Available', lent: 'Lent' },
|
|
186
|
+
initial: 'draft',
|
|
187
|
+
transitions: { publish: { from: ['draft'], to: 'available' }, lend: { from: ['available'], to: 'lent' } },
|
|
188
|
+
}),
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**`index.ts`**: the module: its Shutro part (name, version, groups, models, seed data, data migrations) and its
|
|
194
|
+
Kosh part (access levels, app, menus, actions, views):
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { base, baseShutro } from 'shutro-erp';
|
|
198
|
+
import { defineModule } from 'shutro-erp/modules-sdk';
|
|
199
|
+
import { orm } from 'shutro-erp/orm';
|
|
200
|
+
import { form, list } from 'shutro-erp/views';
|
|
201
|
+
import { data } from './data.ts';
|
|
202
|
+
import { migrations } from './migrations.ts';
|
|
203
|
+
import { Book } from './models.ts';
|
|
204
|
+
|
|
205
|
+
export const libraryShutro = orm.defineModule({
|
|
206
|
+
name: 'library',
|
|
207
|
+
version: '0.1.0', // raise it when data migrations must run
|
|
208
|
+
depends: [baseShutro],
|
|
209
|
+
groups: [
|
|
210
|
+
orm.defineGroup({ code: 'library.user', label: 'Library user', implies: ['base.user'] }),
|
|
211
|
+
orm.defineGroup({ code: 'library.manager', label: 'Library manager', implies: ['library.user'] }),
|
|
212
|
+
],
|
|
213
|
+
models: [Book],
|
|
214
|
+
data,
|
|
215
|
+
migrations,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
export const library = defineModule({
|
|
219
|
+
shutro: libraryShutro,
|
|
220
|
+
kosh: '^0.1.0',
|
|
221
|
+
depends: [base], // also messaging, reporting, other modules
|
|
222
|
+
accessLevels: { // what administrators grant (roles: library.user, library.manager)
|
|
223
|
+
user: { label: 'User', groups: ['library.user'] },
|
|
224
|
+
manager: { label: 'Manager', groups: ['library.manager'], implies: ['user'] },
|
|
225
|
+
},
|
|
226
|
+
app: { code: 'library', label: 'Library', icon: 'box', sequence: 50 },
|
|
227
|
+
actions: { 'library.action_books': { model: 'library.book', label: 'Books', views: ['list', 'form'] } },
|
|
228
|
+
menus: [
|
|
229
|
+
{ id: 'library.root', label: 'Library', app: 'library' },
|
|
230
|
+
{ id: 'library.books', parent: 'library.root', label: 'Books', action: 'library.action_books' },
|
|
231
|
+
],
|
|
232
|
+
views: {
|
|
233
|
+
'library.book.list': list(Book, { columns: ['title', 'isbn', 'author', 'state'] }),
|
|
234
|
+
'library.book.form': form(Book, (f) => ({
|
|
235
|
+
header: { statusbar: 'state', buttons: [f.button('publish', { primary: true, label: 'Publish' })] },
|
|
236
|
+
sheet: [f.group('main', ['title', 'isbn', 'author', 'price'])],
|
|
237
|
+
chatter: true, // messages, activities and the change log (needs messaging)
|
|
238
|
+
})),
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Install a module**: list it in `src/modules.ts`, then migrate:
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
// src/modules.ts
|
|
247
|
+
import { base } from 'shutro-erp';
|
|
248
|
+
import { messaging } from 'shutro-erp/messaging';
|
|
249
|
+
import { library } from './modules/library/index.ts';
|
|
250
|
+
|
|
251
|
+
export const modules = [base, messaging, library];
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```sh
|
|
255
|
+
npx kosh migrate # tables, the module's version (shutro_module), its seed data
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
A module published on npm installs the same way: `npm install <package>`, import it in `src/modules.ts`, then
|
|
259
|
+
`npx kosh migrate`. Installing does not give anyone access: grant its roles to users ([Users and roles](#users-and-roles)).
|
|
260
|
+
|
|
261
|
+
**Remove a module**: take it out of `src/modules.ts`; `npx kosh migrate` then plans dropping its tables, which is
|
|
262
|
+
destructive: it stops for review, and `npx kosh migrate --allow-destructive` applies it. Back up first.
|
|
263
|
+
|
|
264
|
+
## Migrations
|
|
265
|
+
|
|
266
|
+
```sh
|
|
267
|
+
npx kosh migrate # plan + apply + seed
|
|
268
|
+
npx kosh migrate --plan # only write the plan, to review it
|
|
269
|
+
npx kosh migrate --name add_isbn # name the new file (migrations/0002_add_isbn.sql)
|
|
270
|
+
npx kosh migrate status # applied and pending files
|
|
271
|
+
npx kosh migrate --allow-destructive
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
- **Schema migrations** are SQL files in `migrations/`. `kosh migrate` compares your modules with the live database
|
|
275
|
+
and writes the differences as the next file (`0002_update.sql`), applies every pending file in order (each in its
|
|
276
|
+
own transaction, recorded in `shutro_migration`), then loads the seed data. Commit the files: a deployment runs the
|
|
277
|
+
same ones (the Docker `api` service runs `kosh migrate` on start).
|
|
278
|
+
- **Destructive changes** (dropping a column or a table, narrowing a type) are written but not applied without
|
|
279
|
+
`--allow-destructive`. A file written earlier and not applied yet is applied first.
|
|
280
|
+
- **Per-module data migrations** change existing data when a module is upgraded. Declare them in the module's
|
|
281
|
+
`migrations.ts` and raise the module's `version`; each runs once, in version order, when the installed version
|
|
282
|
+
goes past it (never on a fresh install):
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
// src/modules/library/migrations.ts
|
|
286
|
+
import type { DataMigration } from 'shutro-erp/orm';
|
|
287
|
+
|
|
288
|
+
export const migrations: DataMigration[] = [
|
|
289
|
+
{
|
|
290
|
+
version: '0.2.0',
|
|
291
|
+
description: 'ISBNs without dashes',
|
|
292
|
+
up: async ({ sql }) => {
|
|
293
|
+
await sql`UPDATE library_book SET isbn = replace(isbn, '-', '')`;
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
];
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
```sh
|
|
300
|
+
# index.ts: version: '0.2.0'
|
|
301
|
+
npx kosh migrate # … module library: 0.1.0 → 0.2.0, data migration library@0.2.0
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Seed data
|
|
305
|
+
|
|
306
|
+
Each module declares its seed data in `data.ts` as records with external ids (`library.book_welcome`). Seeding is
|
|
307
|
+
idempotent: new records are created, changed ones updated, records removed from the list deleted, and `noupdate`
|
|
308
|
+
records created once and then left to the users.
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
// src/modules/library/data.ts
|
|
312
|
+
import { orm } from 'shutro-erp/orm';
|
|
313
|
+
|
|
314
|
+
export const data = [
|
|
315
|
+
orm.record('res.partner', 'author_tagore', { name: 'Rabindranath Tagore' }),
|
|
316
|
+
orm.record('library.book', 'book_gitanjali', {
|
|
317
|
+
title: 'Gitanjali',
|
|
318
|
+
author: orm.ref('res.partner', 'library.author_tagore'), // by external id
|
|
319
|
+
}),
|
|
320
|
+
orm.record('library.book', 'book_sample', { title: 'Sample' }, { noupdate: true }),
|
|
321
|
+
];
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```sh
|
|
325
|
+
npx kosh seed # every module's seed data, and the apps' defaults
|
|
326
|
+
npx kosh seed library # one module (or several: kosh seed library inventory)
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`kosh migrate` seeds too (skip with `--no-seed`). The apps' defaults are also seeded: approval policies
|
|
330
|
+
(permissions), document templates (reporting), activity types (messaging); users may edit them afterwards.
|
|
331
|
+
|
|
332
|
+
## Users and roles
|
|
333
|
+
|
|
334
|
+
```sh
|
|
335
|
+
npx kosh user create rahim --name "Rahim Uddin" --email rahim@example.com --roles library.user,messaging.user
|
|
336
|
+
npx kosh user password rahim # a new password (asked, hidden)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Roles are the groups of the installed modules' access levels (`library.user`, `library.manager`,
|
|
340
|
+
`reporting.user`, `messaging.user`, …; `base.admin` is the administrator). Users see an app only when one of
|
|
341
|
+
their roles grants it. Administrators manage roles, field security and grants in the admin API
|
|
342
|
+
(`/api/v1/admin/...`, with the permissions app) and every change is audited.
|
|
343
|
+
|
|
344
|
+
## Configuration (.env)
|
|
345
|
+
|
|
346
|
+
| Variable | Meaning |
|
|
347
|
+
|---|---|
|
|
348
|
+
| `DATABASE_URL` | PostgreSQL: `postgres://user:password@host:5432/database` |
|
|
349
|
+
| `PORT`, `HOST` | the API's port (3000) and address (127.0.0.1; 0.0.0.0 in Docker) |
|
|
350
|
+
| `KOSH_STORAGE_DIR` | attachments in this folder, or: |
|
|
351
|
+
| `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY`, `S3_SECRET_KEY`, `S3_REGION` | S3-compatible storage |
|
|
352
|
+
| `KOSH_ATTACHMENT_MAX_BYTES` | upload limit (25 MB) |
|
|
353
|
+
| `VALKEY_URL` | optional Valkey/Redis: rate limits and caches across servers |
|
|
354
|
+
| `KOSH_SECURE_COOKIES` | `true` behind HTTPS (default in production), `false` for plain HTTP |
|
|
355
|
+
| `KOSH_SCHEDULES` | `off` stops the scheduled-report ticker on this server |
|
|
356
|
+
| `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`, `POSTGRES_PORT` | the Docker `db` service |
|
|
357
|
+
| `DOCKER_DATABASE_URL`, `WEB_PORT` | Docker: another database for `api`; the back-office's port (8080) |
|
|
358
|
+
|
|
359
|
+
## Command reference
|
|
360
|
+
|
|
361
|
+
Run them in the project folder (`npx kosh …`, or `npm run migrate` / `npm run seed`). They read `.env` and
|
|
362
|
+
`src/modules.ts` (`--modules <file>` for another list).
|
|
363
|
+
|
|
364
|
+
| Command | What |
|
|
365
|
+
|---|---|
|
|
366
|
+
| `kosh init [folder]` | set up an installation (questions, or flags with `--yes`); again later to enrol 2FA |
|
|
367
|
+
| `kosh migrate` | apply pending files, plan what is missing into a new file and apply it, run data migrations, seed |
|
|
368
|
+
| `kosh migrate --plan` · `--name <n>` · `--allow-destructive` · `--no-seed` | review only · file name · drops · no seeding |
|
|
369
|
+
| `kosh migrate status` | applied and pending migration files |
|
|
370
|
+
| `kosh seed [module …]` | seed data of all modules, or of those named |
|
|
371
|
+
| `kosh module create <name>` | a new module in `src/modules/<name>/`, listed in `src/modules.ts` |
|
|
372
|
+
| `kosh user create <login>` | a user: `--name`, `--email`, `--roles`, `--password` (asked when missing) |
|
|
373
|
+
| `kosh user password <login>` | a new password |
|
|
374
|
+
| `kosh generate client` | a typed API client for your front-end (`--out src/api/kosh.gen.ts`) |
|
|
375
|
+
| `npm start` · `npm run web` · `npm run build:web` | the API · the back-office (dev) · the back-office build (`dist/`) |
|
|
376
|
+
| `npm run docker:up` | `docker compose up -d --build` |
|
|
377
|
+
|
|
378
|
+
## Entry points
|
|
379
|
+
|
|
380
|
+
| Import | What |
|
|
381
|
+
|---|---|
|
|
382
|
+
| `shutro-erp` | the server: `createServer`, `startServer`, `base`, REST + OpenAPI, sessions and 2FA |
|
|
383
|
+
| `shutro-erp/orm` | Shutro (models, fields, groups, records, migrations) as Kosh uses it |
|
|
384
|
+
| `shutro-erp/modules-sdk` | `defineModule`: manifests, access levels, menus, actions |
|
|
385
|
+
| `shutro-erp/views`, `shutro-erp/search` | view definitions (`list`, `form`, `kanban`, `pivot`, …) and the search layer |
|
|
386
|
+
| `shutro-erp/permissions` | roles, field security, approvals (`/web`: the approval panel) |
|
|
387
|
+
| `shutro-erp/reporting` | pivots, exports, documents, scheduled reports (`/web`: the report views) |
|
|
388
|
+
| `shutro-erp/messaging`, `shutro-erp/storage` | the chatter, activities, attachments (`/web`: the chatter) |
|
|
389
|
+
| `shutro-erp/ui` | the React app shell, design system and renderers; `shutro-erp/ui/styles.css` the tokens |
|
|
390
|
+
| `shutro-erp/cli` | the `kosh` command's functions |
|
|
391
|
+
|
|
392
|
+
## Troubleshooting
|
|
393
|
+
|
|
394
|
+
- **"PostgreSQL did not answer"**: nothing listens at that host and port. Start your PostgreSQL service, or
|
|
395
|
+
answer `2` (Docker) to the first question; Docker Desktop must be running.
|
|
396
|
+
- **"password authentication failed"**: the user or password in `DATABASE_URL` is wrong.
|
|
397
|
+
- **Signed in but no apps**: the user has no role granting them (`kosh user create … --roles`); administrators need
|
|
398
|
+
their authenticator enrolled (`npx kosh init` again).
|
|
399
|
+
- **Sign-in works on the API but not in the browser over plain HTTP**: `KOSH_SECURE_COOKIES=false`.
|
|
400
|
+
- **Lost the phone**: sign in with one of the recovery codes `kosh init` printed.
|
|
401
|
+
- **"It drops or changes existing data"**: `kosh migrate` found a destructive change; read the new file in
|
|
402
|
+
`migrations/`, back up, then `npx kosh migrate --allow-destructive`.
|
|
403
|
+
|
|
404
|
+
Documentation, design notes and the source: https://github.com/isahaq1/kosh
|
|
405
|
+
|
|
406
|
+
## Author
|
|
407
|
+
|
|
408
|
+
**Isahaq**, hmisahaq01@gmail.com, mobile +8801852376598
|
|
409
|
+
|
|
410
|
+
## License
|
|
411
|
+
|
|
412
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
2
|
+
import { type DefinitionHelpers } from '../../server/orm.js';
|
|
3
|
+
import type { DefaultLoaded, Env as CoreEnv, RecordSet as CoreRecordSet, Shutro as CoreShutro } from '../../server/orm.js';
|
|
4
|
+
import type { SchemaView } from './schema.js';
|
|
5
|
+
export type { SchemaView };
|
|
6
|
+
/** Every model visible in this view. */
|
|
7
|
+
export type ModelName = keyof SchemaView & string;
|
|
8
|
+
/** `Env` typed to this view. */
|
|
9
|
+
export type Env = CoreEnv<SchemaView>;
|
|
10
|
+
/** `Shutro` typed to this view. */
|
|
11
|
+
export type Shutro = CoreShutro<SchemaView>;
|
|
12
|
+
/** A recordset of `M`, with the default loaded shape unless `L` is given. */
|
|
13
|
+
export type Records<M extends ModelName, L = DefaultLoaded<SchemaView, M>> = CoreRecordSet<SchemaView, M, L>;
|
|
14
|
+
export declare const compute: DefinitionHelpers<SchemaView>['compute'];
|
|
15
|
+
export declare const check: DefinitionHelpers<SchemaView>['check'];
|
|
16
|
+
export declare const onchange: DefinitionHelpers<SchemaView>['onchange'];
|
|
17
|
+
export declare const records: DefinitionHelpers<SchemaView>['records'];
|
|
18
|
+
export declare const method: DefinitionHelpers<SchemaView>['method'];
|
|
19
|
+
/** Module data (RFC 0017): records, overrides of dependencies' records, and references, typed like creates. */
|
|
20
|
+
export declare const record: DefinitionHelpers<SchemaView>['record'];
|
|
21
|
+
export declare const override: DefinitionHelpers<SchemaView>['override'];
|
|
22
|
+
export declare const ref: DefinitionHelpers<SchemaView>['ref'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 5dbc1f9f7f888acd
|
|
2
|
+
// Bindings of module `accounting`: import the definition API from here to get types scoped to what it can see.
|
|
3
|
+
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
4
|
+
import { definitions } from '../../server/orm.js';
|
|
5
|
+
/** Definition callbacks typed against this module's view: no casts in computes, checks, onchange, methods. */
|
|
6
|
+
const helpers = definitions();
|
|
7
|
+
export const compute = helpers.compute;
|
|
8
|
+
export const check = helpers.check;
|
|
9
|
+
export const onchange = helpers.onchange;
|
|
10
|
+
export const records = helpers.records;
|
|
11
|
+
export const method = helpers.method;
|
|
12
|
+
/** Module data (RFC 0017): records, overrides of dependencies' records, and references, typed like creates. */
|
|
13
|
+
export const record = helpers.record;
|
|
14
|
+
export const override = helpers.override;
|
|
15
|
+
export const ref = helpers.ref;
|