shutro-erp 0.3.1 → 0.3.3

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.
Files changed (168) hide show
  1. package/dist/account_portal/.kosh/bindings.js +1 -1
  2. package/dist/account_portal/.kosh/schema.d.ts +29 -1
  3. package/dist/account_portal/index.js +3 -2
  4. package/dist/accounting/.kosh/bindings.js +1 -1
  5. package/dist/accounting/.kosh/schema.d.ts +29 -1
  6. package/dist/accounting/index.js +4 -0
  7. package/dist/assistant/index.js +1 -1
  8. package/dist/cli/init.js +2 -0
  9. package/dist/cli/launch.js +8 -5
  10. package/dist/cli/templates.js +4 -1
  11. package/dist/cli/ui.js +19 -1
  12. package/dist/contacts/.kosh/bindings.js +1 -1
  13. package/dist/contacts/.kosh/schema.d.ts +29 -1
  14. package/dist/integrations/inbound.d.ts +36 -0
  15. package/dist/integrations/inbound.js +171 -0
  16. package/dist/integrations/index.d.ts +18 -0
  17. package/dist/integrations/index.js +400 -0
  18. package/dist/integrations/models.d.ts +6 -0
  19. package/dist/integrations/models.js +119 -0
  20. package/dist/integrations/web/DeliveryTools.d.ts +4 -0
  21. package/dist/integrations/web/DeliveryTools.js +15 -0
  22. package/dist/integrations/web/EndpointTools.d.ts +7 -0
  23. package/dist/integrations/web/EndpointTools.js +25 -0
  24. package/dist/integrations/web/InboundTools.d.ts +4 -0
  25. package/dist/integrations/web/InboundTools.js +15 -0
  26. package/dist/integrations/web/WebhookTools.d.ts +7 -0
  27. package/dist/integrations/web/WebhookTools.js +25 -0
  28. package/dist/integrations/web/index.d.ts +16 -0
  29. package/dist/integrations/web/index.js +27 -0
  30. package/dist/integrations/web/messages.d.ts +2 -0
  31. package/dist/integrations/web/messages.js +53 -0
  32. package/dist/integrations/webhooks.d.ts +63 -0
  33. package/dist/integrations/webhooks.js +217 -0
  34. package/dist/l10n_bd/.kosh/bindings.js +1 -1
  35. package/dist/l10n_bd/.kosh/schema.d.ts +29 -1
  36. package/dist/l10n_in/.kosh/bindings.js +1 -1
  37. package/dist/l10n_in/.kosh/schema.d.ts +29 -4
  38. package/dist/l10n_in/module.d.ts +0 -62
  39. package/dist/l10n_in/module.js +2 -4
  40. package/dist/modules-sdk/index.d.ts +1 -1
  41. package/dist/modules-sdk/manifest.d.ts +48 -0
  42. package/dist/payment/.kosh/bindings.d.ts +22 -0
  43. package/dist/payment/.kosh/bindings.js +15 -0
  44. package/dist/payment/.kosh/schema.d.ts +1581 -0
  45. package/dist/payment/bkash.d.ts +28 -0
  46. package/dist/payment/bkash.js +169 -0
  47. package/dist/payment/index.d.ts +38 -0
  48. package/dist/payment/index.js +431 -0
  49. package/dist/payment/module.d.ts +6856 -0
  50. package/dist/payment/module.js +77 -0
  51. package/dist/payment/money.d.ts +7 -0
  52. package/dist/payment/money.js +37 -0
  53. package/dist/payment/providers.d.ts +75 -0
  54. package/dist/payment/providers.js +77 -0
  55. package/dist/payment/razorpay.d.ts +12 -0
  56. package/dist/payment/razorpay.js +149 -0
  57. package/dist/payment/settle.d.ts +11 -0
  58. package/dist/payment/settle.js +59 -0
  59. package/dist/payment/sslcommerz.d.ts +12 -0
  60. package/dist/payment/sslcommerz.js +185 -0
  61. package/dist/payment/stripe.d.ts +15 -0
  62. package/dist/payment/stripe.js +182 -0
  63. package/dist/permissions/admin.d.ts +3 -0
  64. package/dist/permissions/admin.js +108 -10
  65. package/dist/permissions/index.d.ts +1 -0
  66. package/dist/permissions/index.js +3 -0
  67. package/dist/permissions/roles.d.ts +2 -0
  68. package/dist/permissions/roles.js +236 -0
  69. package/dist/portal/.kosh/bindings.js +1 -1
  70. package/dist/portal/.kosh/schema.d.ts +29 -1
  71. package/dist/portal/routes-documents.js +5 -0
  72. package/dist/product/.kosh/bindings.js +1 -1
  73. package/dist/product/.kosh/schema.d.ts +29 -1
  74. package/dist/project/.kosh/bindings.js +1 -1
  75. package/dist/project/.kosh/schema.d.ts +29 -1
  76. package/dist/project_portal/.kosh/bindings.js +1 -1
  77. package/dist/project_portal/.kosh/schema.d.ts +29 -1
  78. package/dist/purchase/.kosh/bindings.js +1 -1
  79. package/dist/purchase/.kosh/schema.d.ts +29 -1
  80. package/dist/purchase_account/.kosh/bindings.js +1 -1
  81. package/dist/purchase_account/.kosh/schema.d.ts +29 -1
  82. package/dist/purchase_portal/.kosh/bindings.js +1 -1
  83. package/dist/purchase_portal/.kosh/schema.d.ts +29 -1
  84. package/dist/sale_account/.kosh/bindings.js +1 -1
  85. package/dist/sale_account/.kosh/schema.d.ts +29 -1
  86. package/dist/sale_portal/.kosh/bindings.js +1 -1
  87. package/dist/sale_portal/.kosh/schema.d.ts +29 -1
  88. package/dist/sale_project/.kosh/bindings.js +1 -1
  89. package/dist/sale_project/.kosh/schema.d.ts +29 -1
  90. package/dist/sales/.kosh/bindings.js +1 -1
  91. package/dist/sales/.kosh/schema.d.ts +29 -1
  92. package/dist/sales/index.js +2 -0
  93. package/dist/server/api/rest.d.ts +6 -1
  94. package/dist/server/api/rest.js +11 -0
  95. package/dist/server/auth/base.js +22 -0
  96. package/dist/server/auth/routes.d.ts +3 -0
  97. package/dist/server/auth/routes.js +29 -0
  98. package/dist/server/auth/service.d.ts +52 -0
  99. package/dist/server/auth/service.js +168 -3
  100. package/dist/server/identity.d.ts +2 -0
  101. package/dist/server/index.d.ts +2 -2
  102. package/dist/server/index.js +1 -1
  103. package/dist/server/server.js +11 -3
  104. package/dist/settings/company.d.ts +34 -0
  105. package/dist/settings/company.js +187 -0
  106. package/dist/settings/index.d.ts +10 -10
  107. package/dist/settings/index.js +159 -30
  108. package/dist/settings/people.d.ts +16 -0
  109. package/dist/settings/people.js +505 -0
  110. package/dist/settings/security.d.ts +13 -0
  111. package/dist/settings/security.js +158 -0
  112. package/dist/settings/web/AuditPage.d.ts +8 -0
  113. package/dist/settings/web/AuditPage.js +74 -0
  114. package/dist/settings/web/CompaniesPage.d.ts +8 -0
  115. package/dist/settings/web/CompaniesPage.js +52 -0
  116. package/dist/settings/web/CompanyPage.d.ts +9 -0
  117. package/dist/settings/web/CompanyPage.js +94 -0
  118. package/dist/settings/web/OverviewPage.d.ts +9 -0
  119. package/dist/settings/web/OverviewPage.js +66 -0
  120. package/dist/settings/web/PeoplePage.d.ts +9 -0
  121. package/dist/settings/web/PeoplePage.js +163 -0
  122. package/dist/settings/web/ProfilePage.d.ts +14 -0
  123. package/dist/settings/web/ProfilePage.js +194 -0
  124. package/dist/settings/web/RolesEditor.d.ts +35 -0
  125. package/dist/settings/web/RolesEditor.js +49 -0
  126. package/dist/settings/web/RolesPage.d.ts +9 -0
  127. package/dist/settings/web/RolesPage.js +296 -0
  128. package/dist/settings/web/SecurityPage.d.ts +8 -0
  129. package/dist/settings/web/SecurityPage.js +81 -0
  130. package/dist/settings/web/index.d.ts +9 -0
  131. package/dist/settings/web/index.js +26 -1
  132. package/dist/settings/web/messages.js +566 -0
  133. package/dist/ui/api.d.ts +4 -0
  134. package/dist/ui/app.d.ts +5 -0
  135. package/dist/ui/app.js +108 -31
  136. package/dist/ui/components/primitives.d.ts +9 -1
  137. package/dist/ui/components/primitives.js +12 -4
  138. package/dist/ui/context.d.ts +10 -1
  139. package/dist/ui/context.js +60 -2
  140. package/dist/ui/i18n/messages.d.ts +46 -0
  141. package/dist/ui/i18n/messages.js +92 -0
  142. package/dist/ui/index.d.ts +2 -1
  143. package/dist/ui/index.js +2 -1
  144. package/dist/ui/lib/accent.d.ts +13 -0
  145. package/dist/ui/lib/accent.js +36 -0
  146. package/dist/ui/shell/Activate.d.ts +6 -0
  147. package/dist/ui/shell/Activate.js +39 -0
  148. package/dist/ui/shell/CommandPalette.d.ts +7 -1
  149. package/dist/ui/shell/CommandPalette.js +16 -2
  150. package/dist/ui/shell/Sidebar.d.ts +27 -0
  151. package/dist/ui/shell/Sidebar.js +84 -0
  152. package/dist/ui/shell/TwoFactorSetup.d.ts +5 -0
  153. package/dist/ui/shell/TwoFactorSetup.js +32 -0
  154. package/dist/ui/shell/shortcuts.d.ts +3 -0
  155. package/dist/ui/shell/shortcuts.js +13 -4
  156. package/dist/ui/styles.css +70 -28
  157. package/dist/ui/views/DateField.d.ts +10 -0
  158. package/dist/ui/views/DateField.js +129 -0
  159. package/dist/ui/views/FormView.js +161 -21
  160. package/dist/ui/views/ListView.d.ts +2 -0
  161. package/dist/ui/views/ListView.js +8 -3
  162. package/dist/ui/views/StatusChip.d.ts +10 -0
  163. package/dist/ui/views/StatusChip.js +22 -0
  164. package/dist/ui/views/widgets.d.ts +3 -0
  165. package/dist/ui/views/widgets.js +26 -8
  166. package/dist/views/types.d.ts +7 -0
  167. package/dist/views/validate.js +4 -0
  168. package/package.json +14 -2
@@ -1,51 +1,180 @@
1
1
  /**
2
2
  * @packageDocumentation
3
- * `shutro-erp/settings` (RFC 0008): the Settings app. Its App manager lists the installed, disabled and available apps and
4
- * installs, enables or disables them (`/api/v1/settings/apps`, the Settings → Apps page). Every installation has it;
5
- * it cannot be disabled. Changing apps needs the Administrator role or the `settings.apps` access level.
3
+ * `shutro-erp/settings` (RFC 0008, RFC 0019): the Settings app. Its App manager lists the installed, disabled and
4
+ * available apps and installs, enables or disables them (`/api/v1/settings/apps`); it cannot be disabled. Changing
5
+ * apps needs the Administrator role or the `settings.apps` access level. Its Company page sets the current company's
6
+ * name, number grouping, brand colour and details, and Companies lists them, switches and adds one (`settings.company`, RFC 0018,
7
+ * RFC 0019 §3.4). People (RFC 0019 §3.2) invites, deactivates
8
+ * and gives roles to the installation's users (`settings.people`).
6
9
  */
10
+ import { mailerFromEnv } from '../mail/index.js';
7
11
  import { defineModule } from '../modules-sdk/index.js';
8
12
  import { base, baseShutro } from '../server/index.js';
9
13
  import { orm } from '../server/orm.js';
14
+ import { registerCompanyRoutes } from './company.js';
15
+ import { registerPeopleRoutes } from './people.js';
10
16
  import { registerAppRoutes } from './routes.js';
17
+ import { registerSecurityRoutes } from './security.js';
18
+ export { registerCompanyRoutes } from './company.js';
19
+ export { INVITATION_DAYS, registerPeopleRoutes, } from './people.js';
11
20
  export { PROTECTED_APPS, registerAppRoutes } from './routes.js';
21
+ export { registerSecurityRoutes } from './security.js';
12
22
  /** Package identity. */
13
23
  export const PACKAGE = Object.freeze({
14
24
  name: 'shutro-erp/settings',
15
25
  rfc: 'RFC 0008',
16
26
  });
17
- /** The Shutro module: the App manager group. */
27
+ /** A one-time link that lets an invited person choose their password. Private: read through the People routes. */
28
+ const Invitation = orm.defineModel('settings.invitation', {
29
+ label: 'Invitation',
30
+ order: ['id desc'],
31
+ access: {},
32
+ fields: {
33
+ user: orm.f.many2one('res.users', { required: true, ondelete: 'cascade' }),
34
+ tokenHash: orm.f.char({ required: true, index: 'unique' }),
35
+ expiresAt: orm.f.datetime({ required: true }),
36
+ usedAt: orm.f.datetime(),
37
+ invitedBy: orm.f.many2one('res.users', { ondelete: 'set null' }),
38
+ },
39
+ });
40
+ /** The Shutro module: the Settings groups and invitations. */
18
41
  export const settingsShutro = orm.defineModule({
19
42
  name: 'settings',
20
43
  version: '0.1.0',
21
44
  depends: [baseShutro],
22
45
  groups: [
23
46
  orm.defineGroup({ code: 'settings.apps', label: 'App manager', implies: ['base.user'] }),
47
+ orm.defineGroup({
48
+ code: 'settings.company',
49
+ label: 'Company settings',
50
+ implies: ['base.user'],
51
+ }),
52
+ orm.defineGroup({ code: 'settings.people', label: 'People manager', implies: ['base.user'] }),
24
53
  ],
25
- models: [],
26
- });
27
- /** The Settings app. */
28
- export const settings = defineModule({
29
- shutro: settingsShutro,
30
- kosh: '^0.1.0',
31
- depends: [base],
32
- app: {
33
- code: 'settings',
34
- label: 'Settings',
35
- icon: 'settings',
36
- sequence: 1000,
37
- category: 'Administration',
38
- summary: 'Apps, and the settings of this installation',
39
- },
40
- accessLevels: {
41
- apps: { label: 'App manager', groups: ['settings.apps'] },
42
- },
43
- actions: {
44
- 'settings.action_apps': { type: 'client', page: 'settings.Apps', label: 'Apps' },
45
- },
46
- menus: [
47
- { id: 'settings.root', label: 'Settings', app: 'settings' },
48
- { id: 'settings.apps', parent: 'settings.root', label: 'Apps', action: 'settings.action_apps' },
49
- ],
50
- routes: (context) => registerAppRoutes(context),
54
+ models: [Invitation],
51
55
  });
56
+ /** The Settings app with explicit options (tests): the back-office's address and the mailer of invitations. */
57
+ export function settingsModule(options = {}) {
58
+ return defineModule({
59
+ shutro: settingsShutro,
60
+ kosh: '^0.1.0',
61
+ depends: [base],
62
+ app: {
63
+ code: 'settings',
64
+ label: 'Settings',
65
+ icon: 'settings',
66
+ sequence: 1000,
67
+ category: 'Administration',
68
+ summary: 'Apps, people and the settings of this installation',
69
+ },
70
+ accessLevels: {
71
+ apps: { label: 'App manager', groups: ['settings.apps'] },
72
+ company: { label: 'Company settings', groups: ['settings.company'] },
73
+ people: { label: 'People manager', groups: ['settings.people'] },
74
+ },
75
+ privateModels: ['settings.invitation'],
76
+ actions: {
77
+ 'settings.action_overview': { type: 'client', page: 'settings.Overview', label: 'Settings' },
78
+ 'settings.action_apps': { type: 'client', page: 'settings.Apps', label: 'Apps' },
79
+ 'settings.action_company': { type: 'client', page: 'settings.Company', label: 'Company' },
80
+ 'settings.action_companies': {
81
+ type: 'client',
82
+ page: 'settings.Companies',
83
+ label: 'Companies',
84
+ },
85
+ 'settings.action_security': { type: 'client', page: 'settings.Security', label: 'Security' },
86
+ 'settings.action_audit': { type: 'client', page: 'settings.Audit', label: 'Audit log' },
87
+ 'settings.action_people': { type: 'client', page: 'settings.People', label: 'People' },
88
+ 'settings.action_roles': {
89
+ type: 'client',
90
+ page: 'settings.Roles',
91
+ label: 'Roles & permissions',
92
+ },
93
+ },
94
+ menus: [
95
+ { id: 'settings.root', label: 'Settings', app: 'settings' },
96
+ // The overview first (the app's home), then the sections in groups (RFC 0019 §3.1). Modules add their
97
+ // settings under `settings.group_apps`.
98
+ {
99
+ id: 'settings.overview',
100
+ parent: 'settings.root',
101
+ label: 'Overview',
102
+ action: 'settings.action_overview',
103
+ sequence: 0,
104
+ },
105
+ { id: 'settings.group_workspace', parent: 'settings.root', label: 'Workspace', sequence: 10 },
106
+ {
107
+ id: 'settings.company',
108
+ parent: 'settings.group_workspace',
109
+ label: 'Company',
110
+ action: 'settings.action_company',
111
+ sequence: 1,
112
+ },
113
+ {
114
+ id: 'settings.companies',
115
+ parent: 'settings.group_workspace',
116
+ label: 'Companies',
117
+ action: 'settings.action_companies',
118
+ sequence: 2,
119
+ },
120
+ { id: 'settings.group_people', parent: 'settings.root', label: 'People', sequence: 20 },
121
+ {
122
+ id: 'settings.people',
123
+ parent: 'settings.group_people',
124
+ label: 'People',
125
+ action: 'settings.action_people',
126
+ sequence: 1,
127
+ },
128
+ {
129
+ id: 'settings.roles',
130
+ parent: 'settings.group_people',
131
+ label: 'Roles & permissions',
132
+ action: 'settings.action_roles',
133
+ sequence: 2,
134
+ },
135
+ // Security: administrators only (the server refuses everyone else).
136
+ {
137
+ id: 'settings.group_security',
138
+ parent: 'settings.root',
139
+ label: 'Security',
140
+ sequence: 30,
141
+ visibleTo: ['base.admin'],
142
+ },
143
+ {
144
+ id: 'settings.security',
145
+ parent: 'settings.group_security',
146
+ label: 'Security',
147
+ action: 'settings.action_security',
148
+ sequence: 1,
149
+ visibleTo: ['base.admin'],
150
+ },
151
+ {
152
+ id: 'settings.audit',
153
+ parent: 'settings.group_security',
154
+ label: 'Audit log',
155
+ action: 'settings.action_audit',
156
+ sequence: 2,
157
+ visibleTo: ['base.admin'],
158
+ },
159
+ { id: 'settings.group_apps', parent: 'settings.root', label: 'Apps', sequence: 40 },
160
+ {
161
+ id: 'settings.apps',
162
+ parent: 'settings.group_apps',
163
+ label: 'App manager',
164
+ action: 'settings.action_apps',
165
+ sequence: 1,
166
+ },
167
+ ],
168
+ routes: (context) => {
169
+ registerAppRoutes(context);
170
+ registerCompanyRoutes(context);
171
+ registerSecurityRoutes(context);
172
+ registerPeopleRoutes(context, {
173
+ baseUrl: options.baseUrl ?? process.env['KOSH_BASE_URL'] ?? 'http://localhost:5173',
174
+ mailer: 'mailer' in options ? options.mailer : mailerFromEnv(),
175
+ });
176
+ },
177
+ });
178
+ }
179
+ /** The Settings app (the back-office's address and the mailer from the environment). */
180
+ export const settings = settingsModule();
@@ -0,0 +1,16 @@
1
+ import { type Mailer } from '../mail/index.js';
2
+ import { type ModuleContext } from '../server/index.js';
3
+ /** How long an invitation works. */
4
+ export declare const INVITATION_DAYS = 7;
5
+ export interface PeopleOptions {
6
+ /** The back-office's address (`SHUTRO_ERP_BASE_URL`): activation links point there. */
7
+ readonly baseUrl: string;
8
+ /** Sends the invitations; without one, the inviter passes the link on. */
9
+ readonly mailer?: Mailer | undefined;
10
+ }
11
+ export interface Assignment {
12
+ readonly group: string;
13
+ /** null: every company. */
14
+ readonly company: number | null;
15
+ }
16
+ export declare function registerPeopleRoutes(context: ModuleContext, options: PeopleOptions): void;