adula 2.2.0 → 2.3.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.
Files changed (132) hide show
  1. package/README.md +1 -1
  2. package/build/agent/capabilities.md +2 -3
  3. package/build/agent/skills/adula-frontend-design/SKILL.md +5 -3
  4. package/build/commands/adula_assistant_prune.d.ts +10 -0
  5. package/build/commands/adula_assistant_prune.js +12 -0
  6. package/build/commands/backup_open.d.ts +16 -0
  7. package/build/commands/backup_open.js +48 -0
  8. package/build/commands/backup_restore_test.js +3 -0
  9. package/build/commands/backup_seal.d.ts +12 -0
  10. package/build/commands/backup_seal.js +36 -0
  11. package/build/commands/backup_services.d.ts +3 -1
  12. package/build/commands/doctor.js +18 -1
  13. package/build/commands/install.js +6 -0
  14. package/build/commands/main.d.ts +2 -2
  15. package/build/commands/main.js +6 -0
  16. package/build/commands/resource_migration.js +12 -3
  17. package/build/commands/resource_snapshot.js +18 -4
  18. package/build/database/migrations/1770000000051_comment_notifications.d.ts +5 -0
  19. package/build/database/migrations/1770000000051_comment_notifications.js +10 -0
  20. package/build/database/migrations/1770000000054_cloud_backups.d.ts +5 -0
  21. package/build/database/migrations/1770000000054_cloud_backups.js +10 -0
  22. package/build/database/migrations/1770000000055_ai_assistant.d.ts +5 -0
  23. package/build/database/migrations/1770000000055_ai_assistant.js +10 -0
  24. package/build/database/migrations/1770000000056_appearance.d.ts +5 -0
  25. package/build/database/migrations/1770000000056_appearance.js +10 -0
  26. package/build/index.d.ts +36 -6
  27. package/build/index.js +18 -3
  28. package/build/src/admin/controller.js +18 -4
  29. package/build/src/admin/resource/editor.d.ts +1 -0
  30. package/build/src/admin/resource/editor.js +26 -4
  31. package/build/src/admin/resource/export.d.ts +21 -4
  32. package/build/src/admin/resource/export.js +117 -36
  33. package/build/src/admin/resource/lifecycle.d.ts +2 -0
  34. package/build/src/admin/resource/query.d.ts +14 -3
  35. package/build/src/admin/resource/query.js +98 -11
  36. package/build/src/admin/resource/read.d.ts +3 -0
  37. package/build/src/admin/resource/read.js +75 -14
  38. package/build/src/admin/resource/shared.d.ts +16 -0
  39. package/build/src/admin/resource/shared.js +47 -4
  40. package/build/src/admin/resource/write.js +37 -8
  41. package/build/src/admin/resource_service.d.ts +17 -3
  42. package/build/src/admin/resource_service.js +16 -2
  43. package/build/src/admin/resource_tools.d.ts +111 -0
  44. package/build/src/admin/resource_tools.js +139 -0
  45. package/build/src/ai/assistant.d.ts +100 -0
  46. package/build/src/ai/assistant.js +487 -0
  47. package/build/src/ai/client.d.ts +49 -0
  48. package/build/src/ai/client.js +85 -0
  49. package/build/src/ai/prompt.d.ts +23 -0
  50. package/build/src/ai/prompt.js +83 -0
  51. package/build/src/ai/settings.d.ts +56 -0
  52. package/build/src/ai/settings.js +214 -0
  53. package/build/src/ai/usage.d.ts +16 -0
  54. package/build/src/ai/usage.js +33 -0
  55. package/build/src/appearance/appearance.d.ts +134 -0
  56. package/build/src/appearance/appearance.js +461 -0
  57. package/build/src/appearance/colors.d.ts +43 -0
  58. package/build/src/appearance/colors.js +99 -0
  59. package/build/src/appearance/logo.d.ts +32 -0
  60. package/build/src/appearance/logo.js +112 -0
  61. package/build/src/auth/actor_store.d.ts +5 -1
  62. package/build/src/auth/actor_store.js +8 -4
  63. package/build/src/backups/archive.d.ts +52 -0
  64. package/build/src/backups/archive.js +362 -0
  65. package/build/src/backups/cloud_backups.d.ts +133 -0
  66. package/build/src/backups/cloud_backups.js +650 -0
  67. package/build/src/backups/doctor.d.ts +7 -0
  68. package/build/src/backups/doctor.js +55 -0
  69. package/build/src/backups/providers.d.ts +81 -0
  70. package/build/src/backups/providers.js +470 -0
  71. package/build/src/collaboration/assignments.d.ts +24 -2
  72. package/build/src/collaboration/assignments.js +88 -32
  73. package/build/src/collaboration/record_collaboration.d.ts +19 -1
  74. package/build/src/collaboration/record_collaboration.js +109 -37
  75. package/build/src/collaboration/shared.d.ts +10 -2
  76. package/build/src/collaboration/shared.js +14 -1
  77. package/build/src/commands/capabilities.js +1 -1
  78. package/build/src/commands/doctor.d.ts +10 -0
  79. package/build/src/commands/doctor.js +31 -1
  80. package/build/src/commands/snapshot.d.ts +14 -0
  81. package/build/src/commands/snapshot.js +23 -0
  82. package/build/src/core/administrators.js +19 -3
  83. package/build/src/core/avatar_image.d.ts +33 -0
  84. package/build/src/core/avatar_image.js +278 -0
  85. package/build/src/core/mail_settings.d.ts +83 -0
  86. package/build/src/core/mail_settings.js +274 -0
  87. package/build/src/core/mail_test.d.ts +16 -0
  88. package/build/src/core/mail_test.js +81 -6
  89. package/build/src/core/message_templates.d.ts +8 -0
  90. package/build/src/core/message_templates.js +12 -3
  91. package/build/src/core/roles.js +24 -7
  92. package/build/src/core/saved_views.js +55 -24
  93. package/build/src/core/settings.d.ts +2 -2
  94. package/build/src/core/settings.js +15 -4
  95. package/build/src/core/ui_preferences.d.ts +6 -0
  96. package/build/src/core/ui_preferences.js +12 -1
  97. package/build/src/core/user_avatars.d.ts +79 -0
  98. package/build/src/core/user_avatars.js +186 -0
  99. package/build/src/core/user_preferences.d.ts +36 -0
  100. package/build/src/core/user_preferences.js +125 -0
  101. package/build/src/core/users.d.ts +2 -0
  102. package/build/src/core/users.js +4 -2
  103. package/build/src/database/schema.d.ts +46 -0
  104. package/build/src/database/schema.js +182 -0
  105. package/build/src/database/schema_diff.d.ts +16 -2
  106. package/build/src/database/schema_diff.js +40 -7
  107. package/build/src/integrations/api_client.js +18 -3
  108. package/build/src/integrations/imports.d.ts +16 -4
  109. package/build/src/integrations/imports.js +36 -8
  110. package/build/src/integrations/openapi.js +15 -4
  111. package/build/src/integrations/outbound.d.ts +43 -0
  112. package/build/src/integrations/outbound.js +98 -17
  113. package/build/src/integrations/print.d.ts +2 -1
  114. package/build/src/integrations/print.js +7 -3
  115. package/build/src/integrations/print_templates.js +3 -1
  116. package/build/src/integrations/xlsx.d.ts +41 -0
  117. package/build/src/integrations/xlsx.js +519 -0
  118. package/build/src/languages/ar.js +22 -0
  119. package/build/src/languages/ar_ui.d.ts +143 -14
  120. package/build/src/languages/ar_ui.js +145 -14
  121. package/build/src/languages/en.js +22 -0
  122. package/build/src/languages/en_ui.js +144 -14
  123. package/build/src/lists/dashboards.d.ts +42 -0
  124. package/build/src/lists/dashboards.js +49 -0
  125. package/build/src/mcp/tools.js +9 -104
  126. package/build/src/resource/define_resource.js +7 -0
  127. package/build/src/resource/types.d.ts +9 -0
  128. package/build/src/workflows/delegations.d.ts +15 -1
  129. package/build/src/workflows/delegations.js +49 -10
  130. package/build/src/workflows/engine.d.ts +11 -0
  131. package/build/src/workflows/engine.js +29 -7
  132. package/package.json +5 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div dir="rtl" lang="ar">
4
4
 
5
- **عدولة (AdulaJS)** إطار عمل عربي أولًا لبناء أنظمة الأعمال. تنشئ كل شركة **نظامًا** واحدًا، وفي داخله **تطبيقات** لكل مجال عمل، مثل الإجازات أو الأصول أو الصيانة. تتشارك التطبيقات المستخدمين والأدوار والهيكل التنظيمي والإشعارات وصندوق المهام.
5
+ **أدولا (AdulaJS)** إطار عمل عربي أولًا لبناء أنظمة الأعمال. تنشئ كل شركة **نظامًا** واحدًا، وفي داخله **تطبيقات** لكل مجال عمل، مثل الإجازات أو الأصول أو الصيانة. تتشارك التطبيقات المستخدمين والأدوار والهيكل التنظيمي والإشعارات وصندوق المهام.
6
6
 
7
7
  تكتب تعريف المورد (الجدول وحقوله) مرة واحدة في ملف واحد، فيُبنى منه تلقائيًا كل ما يلي:
8
8
 
@@ -1,4 +1,4 @@
1
- # AdulaJS capabilities (2.2.0)
1
+ # AdulaJS capabilities (2.3.0)
2
2
 
3
3
  Generated by `node ace adula:capabilities`. Read this before proposing an application (a module under app/modules); anything not listed here is not provided by AdulaJS.
4
4
 
@@ -42,7 +42,7 @@ Workflow steps: condition, update, notify, approval, decision, delay, http, end.
42
42
  - **Records and collaboration:** `RecordCollaboration`, `followerListeners`, `Assignments`, `SavedViews`, `logActivity`
43
43
  - **Documents and workflows:** `defineWorkflow`, `WorkflowEngine`, `workflowListeners`, `WorkflowDelegations`
44
44
  - **Notifications and messages:** `notify`, `notifyWithTemplate`, `MessageTemplates`, `deliverNotificationMail`, `listenForNotifications`, `NotificationsAdmin`
45
- - **Integration:** `Webhooks`, `signWebhook`, `InboundWebhooks`, `openApiDocument`, `apiClientSource`, `ImportBatches`, `renderPrintHtml`, `htmlToPdf`
45
+ - **Integration:** `Webhooks`, `signWebhook`, `InboundWebhooks`, `openApiDocument`, `apiClientSource`, `ImportBatches`, `xlsxImportAdapter`, `renderPrintHtml`, `htmlToPdf`
46
46
  - **Security:** `UserInvitations`, `UsersAdmin`, `RolesAdmin`
47
47
  - **Data and operations:** `sequence`, `Settings`, `SettingsAdmin`, `publishOutbox`, `consumeEvent`, `recordMutation`, `moveOrgUnit`, `migrateStorage`, `verifyBackup`, `runtimeHealth`
48
48
 
@@ -68,4 +68,3 @@ Workflow steps: condition, update, notify, approval, decision, delay, http, end.
68
68
  - Runtime plugins
69
69
  - A visual workflow editor
70
70
  - Multi-tenant SaaS in one database (one deployment per organization)
71
- - XLSX import until a maintained parser passes the dependency rule (GAP-006)
@@ -31,6 +31,8 @@ Optimize for repeated daily work: finding a record, understanding its status, en
31
31
  - Forms: group related fields, order them according to the business workflow, expose required fields and format hints, distinguish editable and read-only values, and place validation beside the affected field. Use sensible existing defaults, clear save/cancel actions and visible saving/success/conflict feedback. Keep inline document items within the parent transaction.
32
32
  - Details: lead with the record identifier and current status, followed by the business facts, permitted next actions, related items and audit history when available. Do not expose hidden fields or use color as the only status indicator.
33
33
  - Appearance: reuse the application's typography and design tokens, quiet surfaces, clear borders and a restrained accent for the primary action. Reserve warning/destructive colors for their actual meaning. Avoid gradients, decorative motion, arbitrary font changes and excess whitespace that slows scanning unless the user specifically requests them.
34
+ - Light and dark themes: every screen must work in both. Use theme tokens only (`bg-card`, `bg-background`, `text-foreground`, `text-muted-foreground`, `border-border`, and the status tokens `text-success`, `text-warning`, `text-info`, `text-destructive` with tinted surfaces such as `bg-warning/10 border-warning/30`). Never write `bg-white`, `text-white`, palette classes (`bg-amber-50`, `text-red-700`) or hex colors in components; printed documents stay light.
35
+ - Navigation: keep the workspace shell. Add an administration page to `components/admin_sections.ts`, as a page of «الإعدادات» (`settings`) or of «الأشخاص والصلاحيات» (`people`): the sidebar keeps exactly these two administration entries, and a section's pages appear as one horizontal row of the registry `Tabs` (default look) under the header, each tab a link to its own address. Never add links to the shell by hand, sub-items under a sidebar entry, or a second sidebar of styled links for sub-pages. Per-user interface state belongs in `start/preferences.ts` (`definePreference`) and `usePreference`, not in localStorage.
34
36
  - Arabic and accessibility: use RTL logical spacing and Arabic labels, keep identifiers and numeric/date inputs legible with appropriate direction, maintain keyboard order and visible focus, and keep controls usable on mobile. Long forms scroll inside their Dialog rather than switching presentation automatically.
35
37
  - Operational states: provide specific Arabic loading, empty, no-results, permission-denied, validation and recoverable-error states. Distinguish an empty dataset from a failed request; never invent sample success data in a live screen.
36
38
 
@@ -46,11 +48,11 @@ Install missing registry components with `node ace adula:ui add <component>`. Ne
46
48
 
47
49
  Every form and every row/record detail view opens in a shadcn Dialog unless the user explicitly requests another presentation. This includes create/edit forms and custom page overrides. Do not infer a page or Sheet exception from screen size, form length or personal design preference.
48
50
 
49
- For resource routes, use `ResourcePage`, which selects the modal surface by default. For a custom form/detail override, wrap its content in `ResourceSurface` with a title, description and the list's `backHref`. It keeps direct URLs usable and returns to the list when dismissed. From a list, open records with `openRecord(resource, id, 'show' | 'edit')` (exported by `resource-surface`): the dialog opens over the mounted list, and closing keeps its query, loaded rows and scroll. Use `presentation="page"` only for a user-requested page exception. Keep embedded line-item fields within their parent's form, not separate nested forms. Search and filter controls may stay in the list toolbar; their form element is submission structure, not a separate record form.
51
+ For resource routes, use `ResourcePage`, which selects the modal surface by default. For a custom form/detail override, wrap its content in `ResourceSurface` with a title, description and the list's `backHref`. It keeps direct URLs usable and returns to the list when dismissed. From a list, open records with `openRecord(resource, id, 'show' | 'edit')` and the create form with `openCreate(resource)` (exported by `resource-surface`): the dialog opens at once over the mounted list, its body loads inside it, and closing keeps its query, loaded rows and scroll. Saving a new record closes the dialog and pins the new row first in the list, highlighted; saving an edit shows the record's details in the same dialog. A page other than the generic list that opens records this way renders `RecordOverlayDialog` (exported by `resource-page`). Never open a dialog by visiting a page that renders it: the page behind it would render again. Use `presentation="page"` only for a user-requested page exception. Keep embedded line-item fields within their parent's form, not separate nested forms. Search and filter controls may stay in the list toolbar; their form element is submission structure, not a separate record form.
50
52
 
51
- Give every Dialog a visible DialogTitle and a useful DialogDescription. Keep long content scrollable within the viewport, Arabic RTL alignment, an accessible close control, focus containment and Escape dismissal. Use shadcn components inside the modal too. Keep validation and conflict messages inside it, preserve typed values on errors, and keep unauthorized actions absent. Do not replace server authorization with UI checks.
53
+ Give every Dialog a visible DialogTitle and a useful DialogDescription. Keep long content scrollable within the viewport, Arabic RTL alignment, an accessible close control, focus containment and Escape dismissal. A dialog whose content can exceed the screen height uses `LongDialogContent` (registry `long-dialog`) inside the shadcn `Dialog`: a fixed header with the title and description, a body that alone scrolls with its scrollbar always visible in both themes, and a fixed footer with the actions («إلغاء» or «إغلاق» as outline first, then the primary action). Do not hand-build this layout or let the whole dialog scroll. Record dialogs already follow it: `ResourceSurface` renders `LongDialogContent`, and a record body puts its actions in `RecordFooter` (secondary actions at the start, then «إلغاء» or `RecordFooterClose`, then the primary), with the submit button naming its form through `form`; a custom record override does the same instead of placing buttons at the end of the body. Use shadcn components inside the modal too. Keep validation and conflict messages inside it, preserve typed values on errors, and keep unauthorized actions absent. Do not replace server authorization with UI checks.
52
54
 
53
- Use `mode="view"` for details and `mode="edit"` for custom forms. Details close on outside click; editors ask for confirmation on outside click, close or Escape by default and preserve input when the user continues editing. Respect `ui.preferences` rather than rebuilding dismissal logic. Confirm permission changes and destructive actions with distinct labels, and display server rejection/success feedback. Administrative access protection must remain enforced on the server.
55
+ Use `mode="view"` for details and `mode="edit"` for custom forms. Details close on outside click. Editors ask for confirmation on outside click, close, «إلغاء» or Escape only when there are unsaved changes, and preserve input when the user continues editing; an untouched editor, or one whose values were changed back, closes at once. The shared Dialog decides this itself; never compute a dialog's dirty state or report `data-dirty`. A dialog whose state is plain inputs, text areas and selects declares nothing: the Dialog compares each control with the value it had before the user changed it. Any other state (a draft object, a list order, switches, a chosen file, a typed secret) is declared with the `value` prop of `Dialog`, or with `useDialogValue(value)` from a component inside it (ResourceForm does this); the Dialog captures it as it renders until the user first interacts, compares it with stable serialization on closing and treats a restored value as clean. A step saved within one opening (an uploaded file becoming a mapping), or a save that keeps the dialog open, starts afresh with `<DialogValue key={step} value={...} />` whose key changes after the save. A dialog that declares a value declares its full form state: once anything is declared its plain controls are no longer compared, and the Dialog warns on the console when a control changed while no declaration did. Respect `ui.preferences` rather than rebuilding dismissal logic. Confirm permission changes and destructive actions with distinct labels, and display server rejection/success feedback. Administrative access protection must remain enforced on the server.
54
56
 
55
57
  Honor the system calendar preference: Gregorian, Umm al-Qura Hijri, or both. Reuse FieldControl/ResourceValue and the shared formatter; never store formatted Hijri text in a date column. Both mode shows two representations of one date and allows either input calendar. Keep transitions short, preserve the workspace shell and honor reduced motion. Installation terminal instructions are English for terminal compatibility; the application remains Arabic.
56
58
 
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '@adonisjs/core/ace';
2
+ /** Applies the assistant's retention through the application's wiring in `#services/adula`. */
3
+ export default class AdulaAssistantPrune extends BaseCommand {
4
+ static commandName: string;
5
+ static description: string;
6
+ static options: {
7
+ startApp: boolean;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '@adonisjs/core/ace';
2
+ /** Applies the assistant's retention through the application's wiring in `#services/adula`. */
3
+ export default class AdulaAssistantPrune extends BaseCommand {
4
+ static commandName = 'adula:assistant:prune';
5
+ static description = 'Delete assistant conversation metadata after 30 days, used proposals after a day and token usage after 90 days';
6
+ static options = { startApp: true };
7
+ async run() {
8
+ const { adula } = (await this.app.import('#services/adula'));
9
+ const removed = await adula().assistant.prune();
10
+ this.logger.info(`Removed ${removed.conversations} conversations, ${removed.proposals} proposals and ${removed.usage} usage rows`);
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '@adonisjs/core/ace';
2
+ /**
3
+ * Opens an encrypted `.adulabackup` file into a new snapshot directory for the existing
4
+ * restore commands (ADR 051). The directory holds plaintext data and must be deleted after
5
+ * the restore.
6
+ */
7
+ export default class BackupOpen extends BaseCommand {
8
+ static commandName: string;
9
+ static description: string;
10
+ static options: {
11
+ startApp: boolean;
12
+ };
13
+ file: string;
14
+ snapshot: string;
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,48 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { BaseCommand, flags } from '@adonisjs/core/ace';
8
+ import { rm } from 'node:fs/promises';
9
+ import { resolve } from 'node:path';
10
+ import { openBackupArchive, parseBackupKey } from '../src/backups/archive.js';
11
+ import { applicationEnv, backupSnapshotService } from './backup_services.js';
12
+ /**
13
+ * Opens an encrypted `.adulabackup` file into a new snapshot directory for the existing
14
+ * restore commands (ADR 051). The directory holds plaintext data and must be deleted after
15
+ * the restore.
16
+ */
17
+ export default class BackupOpen extends BaseCommand {
18
+ static commandName = 'backup:open';
19
+ static description = 'Decrypt an .adulabackup file into a new snapshot directory for restore';
20
+ static options = { startApp: true };
21
+ async run() {
22
+ const env = await applicationEnv(this.app);
23
+ const value = env.get('BACKUP_ENCRYPTION_KEY');
24
+ if (!value) {
25
+ this.logger.error('BACKUP_ENCRYPTION_KEY is not set');
26
+ this.exitCode = 1;
27
+ return;
28
+ }
29
+ const target = resolve(this.snapshot);
30
+ await openBackupArchive(resolve(this.file), target, parseBackupKey(value));
31
+ const { verifySnapshot } = await backupSnapshotService(this.app);
32
+ try {
33
+ await verifySnapshot(target);
34
+ }
35
+ catch (error) {
36
+ await rm(target, { recursive: true, force: true });
37
+ throw error;
38
+ }
39
+ this.logger.success(`Snapshot opened in ${target}`);
40
+ this.logger.warning('This directory holds unencrypted data: delete it after backup:verify-snapshot and the restore');
41
+ }
42
+ }
43
+ __decorate([
44
+ flags.string({ required: true })
45
+ ], BackupOpen.prototype, "file", void 0);
46
+ __decorate([
47
+ flags.string({ required: true })
48
+ ], BackupOpen.prototype, "snapshot", void 0);
@@ -114,9 +114,12 @@ export default class BackupRestoreTest extends BaseCommand {
114
114
  else if (await restored('attachments').whereNot('disk', 'local').first()) {
115
115
  throw new Error('Legacy snapshot does not contain non-local attachments');
116
116
  }
117
+ // Only files of registered resources have a record the drill can open; profile
118
+ // pictures (ADR 050) and other owners are verified with every file above.
117
119
  const candidate = await restored('attachments')
118
120
  .whereNull('deleted_at')
119
121
  .whereNotNull('record_id')
122
+ .whereIn('resource', registry.all().map((entry) => entry.name))
120
123
  .orderBy('id', 'desc')
121
124
  .first();
122
125
  if (!candidate) {
@@ -0,0 +1,12 @@
1
+ import { BaseCommand } from '@adonisjs/core/ace';
2
+ /** Seals a verified snapshot directory into an encrypted `.adulabackup` file (ADR 051). */
3
+ export default class BackupSeal extends BaseCommand {
4
+ static commandName: string;
5
+ static description: string;
6
+ static options: {
7
+ startApp: boolean;
8
+ };
9
+ snapshot: string;
10
+ file: string;
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,36 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { BaseCommand, flags } from '@adonisjs/core/ace';
8
+ import { resolve } from 'node:path';
9
+ import { parseBackupKey, sealBackupArchive } from '../src/backups/archive.js';
10
+ import { applicationEnv, backupSnapshotService } from './backup_services.js';
11
+ /** Seals a verified snapshot directory into an encrypted `.adulabackup` file (ADR 051). */
12
+ export default class BackupSeal extends BaseCommand {
13
+ static commandName = 'backup:seal';
14
+ static description = 'Encrypt a verified snapshot directory into a new .adulabackup file';
15
+ static options = { startApp: true };
16
+ async run() {
17
+ const env = await applicationEnv(this.app);
18
+ const value = env.get('BACKUP_ENCRYPTION_KEY');
19
+ if (!value) {
20
+ this.logger.error('BACKUP_ENCRYPTION_KEY is not set');
21
+ this.exitCode = 1;
22
+ return;
23
+ }
24
+ const directory = resolve(this.snapshot);
25
+ const { verifySnapshot } = await backupSnapshotService(this.app);
26
+ await verifySnapshot(directory);
27
+ const { size, sha256 } = await sealBackupArchive(directory, resolve(this.file), parseBackupKey(value));
28
+ this.logger.success(`Sealed ${size} bytes, sha256 ${sha256}`);
29
+ }
30
+ }
31
+ __decorate([
32
+ flags.string({ required: true })
33
+ ], BackupSeal.prototype, "snapshot", void 0);
34
+ __decorate([
35
+ flags.string({ required: true })
36
+ ], BackupSeal.prototype, "file", void 0);
@@ -12,7 +12,9 @@ export type ArchivedAttachment = {
12
12
  sha256: string;
13
13
  };
14
14
  export type BackupSnapshotService = {
15
- createSnapshot(directory: string): Promise<void>;
15
+ createSnapshot(directory: string, options?: {
16
+ workDirectory?: string;
17
+ }): Promise<void>;
16
18
  verifySnapshot(directory: string): Promise<ArchivedAttachment[] | null>;
17
19
  extractSnapshot(directory: string, target: string): Promise<void>;
18
20
  verifyAttachments(files: ArchivedAttachment[], extracted: string, rows: Record<string, any>[]): Promise<void>;
@@ -1,8 +1,9 @@
1
1
  import { BaseCommand } from '@adonisjs/core/ace';
2
2
  import { fileURLToPath } from 'node:url';
3
- import { diagnose, diagnoseResourceSnapshots, diagnoseResourceSchemas, diagnoseOutbox, diagnoseWorkflowRoles, } from '../src/commands/doctor.js';
3
+ import { diagnose, diagnoseResourceSnapshots, diagnoseResourceSchemas, diagnoseOutbox, diagnoseWorkflowRoles, diagnoseScopeParentRoles, } from '../src/commands/doctor.js';
4
4
  import { runtimeHealth } from '../src/core/health.js';
5
5
  import { diagnoseAttachments } from '../src/attachments/doctor.js';
6
+ import { diagnoseCloudBackups } from '../src/backups/doctor.js';
6
7
  import { Settings } from '../src/services/settings.js';
7
8
  import { MigrationRunner } from '@adonisjs/lucid/migration';
8
9
  import { readFile } from 'node:fs/promises';
@@ -16,6 +17,7 @@ export default class Doctor extends BaseCommand {
16
17
  const findings = await diagnose(fileURLToPath(this.app.appRoot), new Settings(db.connection().getWriteClient()), this.app.inProduction, process.env);
17
18
  findings.push(await diagnoseAttachments(db.connection().getWriteClient()));
18
19
  findings.push(diagnoseOutbox(await runtimeHealth(db.connection().getWriteClient())));
20
+ findings.push(...diagnoseCloudBackups(process.env));
19
21
  const migrations = await new MigrationRunner(db, this.app, { direction: 'up' }).getList();
20
22
  const missing = migrations.filter((entry) => entry.status === 'corrupt');
21
23
  const pending = migrations.filter((entry) => entry.status === 'pending');
@@ -54,6 +56,21 @@ export default class Doctor extends BaseCommand {
54
56
  key: role.key ? String(role.key) : null,
55
57
  name: String(role.name),
56
58
  }))));
59
+ const rules = await db
60
+ .from('role_rules as rr')
61
+ .join('roles as r', 'r.id', 'rr.role_id')
62
+ .select('r.name', 'rr.subject', 'rr.action', 'rr.inverted');
63
+ const byRole = new Map();
64
+ for (const rule of rules)
65
+ byRole.set(String(rule.name), [
66
+ ...(byRole.get(String(rule.name)) ?? []),
67
+ {
68
+ subject: String(rule.subject),
69
+ action: String(rule.action),
70
+ inverted: Boolean(rule.inverted),
71
+ },
72
+ ]);
73
+ findings.push(diagnoseScopeParentRoles(registry.all(), [...byRole].map(([name, roleRules]) => ({ name, rules: roleRules }))));
57
74
  }
58
75
  if (registry)
59
76
  findings.push(diagnoseResourceSnapshots(sources, (name) => {
@@ -10,6 +10,7 @@ import { readFile, writeFile, access } from 'node:fs/promises';
10
10
  import { grantInstallAdministrator, resolveInstallAdministrator, } from '../src/core/administrators.js';
11
11
  import { seedModules } from '../src/core/module_seed.js';
12
12
  import { syncAgentAssets } from '../src/commands/agent_assets.js';
13
+ import { diagnoseScopeParentRoles } from '../src/commands/doctor.js';
13
14
  import { GAPS_TEMPLATE } from '../src/commands/gap_report.js';
14
15
  import { ADULA_VERSION } from '../src/version.js';
15
16
  import { fileURLToPath } from 'node:url';
@@ -78,6 +79,11 @@ export default class Install extends BaseCommand {
78
79
  if (registry) {
79
80
  const seeded = await seedModules(knex, registry, user.id);
80
81
  this.logger.info(`Module defaults: ${seeded.lookups} lookup rows added; roles created: ${seeded.created.join(', ') || 'none'}; adopted by name: ${seeded.adopted.join(', ') || 'none'}`);
82
+ const parents = diagnoseScopeParentRoles(registry.all(), registry
83
+ .modules()
84
+ .flatMap((module) => (module.defaultRoles ?? []).map((role) => ({ name: role.key, rules: role.rules }))));
85
+ if (parents.status === 'warn')
86
+ this.logger.warning(parents.message);
81
87
  }
82
88
  for (const [name, content] of [
83
89
  ['CLAUDE.md', 'Read and follow AGENTS.md.\nThe project rules are maintained there.\n'],
@@ -1,9 +1,9 @@
1
1
  import Resource from './resource.js';
2
2
  import ModuleAdd from './module_add.js';
3
3
  import Ui from './ui.js';
4
- import AdulaOutbox from './adula_outbox.js';
4
+ import AdulaAssistantPrune from './adula_assistant_prune.js';
5
5
  import App from './app.js';
6
6
  export declare function getMetaData(): Promise<import("@adonisjs/core/types/ace").CommandMetaData[]>;
7
7
  export declare function getCommand(meta: {
8
8
  commandName: string;
9
- }): Promise<typeof AdulaOutbox | typeof App | typeof Resource | typeof ModuleAdd | typeof Ui | null>;
9
+ }): Promise<typeof AdulaAssistantPrune | typeof App | typeof Resource | typeof ModuleAdd | typeof Ui | null>;
@@ -13,12 +13,15 @@ import Upgrade from './upgrade.js';
13
13
  import AdulaOutbox from './adula_outbox.js';
14
14
  import AdulaRuntimeHealth from './adula_runtime_health.js';
15
15
  import AdulaUploadsPrune from './adula_uploads_prune.js';
16
+ import AdulaAssistantPrune from './adula_assistant_prune.js';
16
17
  import AdulaRestoreReconcile from './adula_restore_reconcile.js';
17
18
  import BackupCreate from './backup_create.js';
18
19
  import BackupRestoreFiles from './backup_restore_files.js';
19
20
  import BackupRestoreTest from './backup_restore_test.js';
20
21
  import BackupVerify from './backup_verify.js';
21
22
  import BackupVerifySnapshot from './backup_verify_snapshot.js';
23
+ import BackupSeal from './backup_seal.js';
24
+ import BackupOpen from './backup_open.js';
22
25
  import App from './app.js';
23
26
  import Client from './client.js';
24
27
  import SlaEvaluate from './sla_evaluate.js';
@@ -38,12 +41,15 @@ const commands = [
38
41
  AdulaOutbox,
39
42
  AdulaRuntimeHealth,
40
43
  AdulaUploadsPrune,
44
+ AdulaAssistantPrune,
41
45
  AdulaRestoreReconcile,
42
46
  BackupCreate,
43
47
  BackupRestoreFiles,
44
48
  BackupRestoreTest,
45
49
  BackupVerify,
46
50
  BackupVerifySnapshot,
51
+ BackupSeal,
52
+ BackupOpen,
47
53
  App,
48
54
  Client,
49
55
  SlaEvaluate,
@@ -9,7 +9,7 @@ import { mkdir, readFile, writeFile } from 'node:fs/promises';
9
9
  import { dirname } from 'node:path';
10
10
  import { MigrationRunner } from '@adonisjs/lucid/migration';
11
11
  import { embeddedResource } from '../src/commands/snapshot.js';
12
- import { additionMigrationSource, describeDrift, resourceAddition, schemaDrift, } from '../src/database/schema_diff.js';
12
+ import { additionMigrationSource, describeDrift, missingStandardColumns, resourceAddition, schemaDrift, } from '../src/database/schema_diff.js';
13
13
  /**
14
14
  * Writes an additive migration with what the database lacks for a resource: new
15
15
  * columns, join tables and unique indexes (see alterResourceTable). Only the new pieces
@@ -40,7 +40,16 @@ export default class ResourceMigration extends BaseCommand {
40
40
  for (const entry of drift.wrongTypes)
41
41
  this.logger.warning(`${this.name}.${entry.column} is ${entry.actual}, the definition expects ${entry.expected}; types are never changed automatically (write an expand/contract migration).`);
42
42
  const addition = resourceAddition(resource, drift);
43
- if (!Object.keys(addition).length) {
43
+ // Standard columns are not fields: the version column is added by a fixed statement
44
+ // (#138); the others need a hand-written expand migration and fail the command.
45
+ const standard = missingStandardColumns(drift);
46
+ for (const column of standard.unsupported) {
47
+ this.logger.error(`${this.name}.${column} is missing and cannot be generated: write an expand migration by hand.`);
48
+ this.exitCode = 1;
49
+ }
50
+ if (!Object.keys(addition).length && !standard.statements.length) {
51
+ if (standard.unsupported.length)
52
+ return;
44
53
  this.logger.info(`${this.name}: the database already has every column, join table and unique index.`);
45
54
  return;
46
55
  }
@@ -58,7 +67,7 @@ export default class ResourceMigration extends BaseCommand {
58
67
  catch { }
59
68
  const file = `${folder}/${Date.now()}_alter_${this.name}.ts`;
60
69
  await mkdir(this.app.makePath(folder), { recursive: true });
61
- await writeFile(this.app.makePath(file), additionMigrationSource(this.name, addition), {
70
+ await writeFile(this.app.makePath(file), additionMigrationSource(this.name, addition, standard.statements), {
62
71
  flag: 'wx',
63
72
  });
64
73
  for (const line of describeDrift(drift))
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { BaseCommand, args } from '@adonisjs/core/ace';
8
8
  import { readFile, writeFile } from 'node:fs/promises';
9
9
  import { MigrationRunner } from '@adonisjs/lucid/migration';
10
- import { embeddedResource, resourceSnapshot, rewriteResourceSnapshot, } from '../src/commands/snapshot.js';
10
+ import { embeddedResource, laterRelationTargets, resourceSnapshot, rewriteResourceSnapshot, } from '../src/commands/snapshot.js';
11
11
  /**
12
12
  * Rewrites the definition embedded in a resource's generated create-migration from the
13
13
  * current resource, while that migration has not run yet (#20). A migration that already
@@ -34,16 +34,20 @@ export default class ResourceSnapshot extends BaseCommand {
34
34
  }
35
35
  const migrations = await new MigrationRunner(db, this.app, { direction: 'up' }).getList();
36
36
  const matches = [];
37
- for (const entry of migrations)
37
+ const embedded = [];
38
+ for (const entry of migrations) {
39
+ embedded.push({ name: entry.name });
38
40
  for (const extension of ['.ts', '.js'])
39
41
  try {
40
42
  const file = `${entry.name}${extension}`;
41
43
  const source = await readFile(this.app.makePath(file), 'utf8');
44
+ embedded[embedded.length - 1].resource = embeddedResource(source);
42
45
  if (embeddedResource(source) === this.name)
43
- matches.push({ file, source, pending: entry.status === 'pending' });
46
+ matches.push({ name: entry.name, file, source, pending: entry.status === 'pending' });
44
47
  break;
45
48
  }
46
49
  catch { }
50
+ }
47
51
  const pending = matches.filter((match) => match.pending);
48
52
  if (!pending.length) {
49
53
  this.logger.error(matches.length
@@ -52,8 +56,18 @@ export default class ResourceSnapshot extends BaseCommand {
52
56
  this.exitCode = 1;
53
57
  return;
54
58
  }
59
+ // A relation to a table created by a later migration would fail its foreign key on a
60
+ // fresh database (#99): refuse before writing anything.
61
+ const snapshot = resourceSnapshot(resource);
62
+ const later = pending.flatMap((match) => laterRelationTargets(snapshot, match.name, embedded).map((entry) => ({ ...entry, match })));
63
+ if (later.length) {
64
+ for (const entry of later)
65
+ this.logger.error(`${entry.match.file}: ${entry.field} links ${entry.target}, whose create-migration ${entry.migration} runs later, so its foreign key would fail. Keep ${entry.field} out of this create-migration and add it with node ace adula:resource:migration ${this.name} once both tables exist.`);
66
+ this.exitCode = 1;
67
+ return;
68
+ }
55
69
  for (const match of pending) {
56
- await writeFile(this.app.makePath(match.file), rewriteResourceSnapshot(match.source, resourceSnapshot(resource)));
70
+ await writeFile(this.app.makePath(match.file), rewriteResourceSnapshot(match.source, snapshot));
57
71
  this.logger.success(match.file);
58
72
  }
59
73
  this.logger.info('Update the model, factory and contract fixture to the same fields, then run migration:run.');
@@ -0,0 +1,5 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ export default class CommentNotifications extends BaseSchema {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ import { createCommentNotificationsSchema } from '../../src/database/schema.js';
3
+ export default class CommentNotifications extends BaseSchema {
4
+ async up() {
5
+ await createCommentNotificationsSchema(this.db.getWriteClient());
6
+ }
7
+ async down() {
8
+ throw new Error('AdulaJS migrations are additive. Restore a tested backup instead of rolling back.');
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ export default class CloudBackups extends BaseSchema {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ import { createCloudBackupsSchema } from '../../src/database/schema.js';
3
+ export default class CloudBackups extends BaseSchema {
4
+ async up() {
5
+ await createCloudBackupsSchema(this.db.getWriteClient());
6
+ }
7
+ async down() {
8
+ throw new Error('AdulaJS migrations are additive. Restore a tested backup instead of rolling back.');
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ export default class AiAssistant extends BaseSchema {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ import { createAssistantSchema } from '../../src/database/schema.js';
3
+ export default class AiAssistant extends BaseSchema {
4
+ async up() {
5
+ await createAssistantSchema(this.db.getWriteClient());
6
+ }
7
+ async down() {
8
+ throw new Error('AdulaJS migrations are additive. Restore a tested backup instead of rolling back.');
9
+ }
10
+ }
@@ -0,0 +1,5 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ export default class Appearance extends BaseSchema {
3
+ up(): Promise<void>;
4
+ down(): Promise<void>;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { BaseSchema } from '@adonisjs/lucid/schema';
2
+ import { createAppearanceSchema } from '../../src/database/schema.js';
3
+ export default class Appearance extends BaseSchema {
4
+ async up() {
5
+ await createAppearanceSchema(this.db.getWriteClient());
6
+ }
7
+ async down() {
8
+ throw new Error('AdulaJS migrations are additive. Restore a tested backup instead of rolling back.');
9
+ }
10
+ }
package/build/index.d.ts CHANGED
@@ -14,12 +14,12 @@ export { accessibleBy, authorizationSql, conditionSql } from './src/auth/sql.js'
14
14
  export { ACTOR_ID, resolveActorConditions } from './src/auth/conditions.js';
15
15
  export { ResourceService, canQueryField } from './src/admin/resource_service.js';
16
16
  export type { AggregateOptions, AggregateRow, ListOptions } from './src/admin/resource_service.js';
17
- export { EXPORT_ROW_LIMIT } from './src/admin/resource_service.js';
18
- export type { CsvExport, ExportOptions, ListFilterScalar, ListFilterValue, } from './src/admin/resource_service.js';
17
+ export { EXPORT_ROW_LIMIT, guardFormula } from './src/admin/resource_service.js';
18
+ export type { CsvExport, XlsxExport, ExportOptions, ListFilterScalar, ListFilterValue, } from './src/admin/resource_service.js';
19
19
  export { BulkActions, defineBulkActions, BULK_ID_LIMIT } from './src/lists/bulk_actions.js';
20
20
  export type { BulkActionDefinition, BulkActionOption, BulkActionSet, BulkActionsOptions, BulkFailure, BulkRequest, BulkResult, } from './src/lists/bulk_actions.js';
21
21
  export { Dashboards, defineDashboard } from './src/lists/dashboards.js';
22
- export type { DashboardDefinition, DashboardFormat, DashboardGroupRow, DashboardMeasure, DashboardResult, DashboardSummary, DashboardWidgetDefinition, DashboardWidgetResult, } from './src/lists/dashboards.js';
22
+ export type { DashboardDefinition, DashboardFormat, DashboardGroupRow, DashboardMeasure, DashboardResult, DashboardSummary, DashboardWidgetDefinition, DashboardWidgetResult, OverviewBuiltin, OverviewLayout, OverviewState, OverviewWidget, } from './src/lists/dashboards.js';
23
23
  export { serialize, writableInput, selectedFields } from './src/admin/contracts.js';
24
24
  export { AdulaError } from './src/admin/errors.js';
25
25
  export { BASE_LANGUAGE, registerLanguage, registeredLanguages, enabledLanguages, resolveLanguage, languageDirection, translate, localizeText, messageKeyOf, clientMessages, runWithLanguage, currentLanguage, labelText, } from './src/languages/catalog.js';
@@ -45,6 +45,8 @@ export { ImportBatches, importCell, IMPORT_ROW_LIMIT } from './src/integrations/
45
45
  export type { ImportBatch, ImportStatus, ImportTarget, ActorSource, } from './src/integrations/imports.js';
46
46
  export type { ImportBatchRecord, ImportBatchStatus, ImportTargetField, ImportMode, ImportReportRow, ImportBatchesOptions, ImportCreateInput, ImportStartOptions, } from './src/integrations/imports.js';
47
47
  export { csvImportAdapter, importFile } from './src/integrations/import_adapters.js';
48
+ export { guardXlsx, readXlsxTable, xlsxImportAdapter, XLSX_LIMITS, XLSX_MIME_TYPE, } from './src/integrations/xlsx.js';
49
+ export type { GuardedXlsx, XlsxLimits } from './src/integrations/xlsx.js';
48
50
  export type { ImportAdapter, ImportFile, ImportTable } from './src/integrations/import_adapters.js';
49
51
  export { createImportModesSchema, createImportLeasesSchema } from './src/database/schema.js';
50
52
  export { openApiDocument } from './src/integrations/openapi.js';
@@ -59,7 +61,7 @@ export { parseTemplate } from './src/core/template_language.js';
59
61
  export type { TemplateNode, TemplateRef } from './src/core/template_language.js';
60
62
  export { createPrintTemplatesSchema } from './src/database/schema.js';
61
63
  export { Webhooks, signWebhook, WEBHOOK_MAX_ATTEMPTS } from './src/integrations/webhooks.js';
62
- export { createOutboundPoster, isBlockedAddress, outboundErrorCategory, } from './src/integrations/outbound.js';
64
+ export { createOutboundPoster, createOutboundRequester, OutboundResponseTooLargeError, isBlockedAddress, outboundErrorCategory, } from './src/integrations/outbound.js';
63
65
  export type { OutboundOptions, OutboundRequest, OutboundTarget, OutboundErrorCategory, } from './src/integrations/outbound.js';
64
66
  export { InboundWebhooks, inboundEventName, INBOUND_BODY_LIMIT, INBOUND_RETENTION_DAYS, } from './src/integrations/inbound_webhooks.js';
65
67
  export type { InboundSource, InboundSourceInput, InboundDelivery, InboundReceipt, } from './src/integrations/inbound_webhooks.js';
@@ -81,7 +83,9 @@ export { diagnoseAttachments } from './src/attachments/doctor.js';
81
83
  export { Settings, sequence, formatSequence, notify } from './src/services/settings.js';
82
84
  export type { NotificationTarget } from './src/services/settings.js';
83
85
  export { uiPreferences, validateUiPreferences, UI_PREFERENCES_KEY, DEFAULT_UI_PREFERENCES, } from './src/core/ui_preferences.js';
84
- export type { UiPreferences, CalendarSystem, CalendarPreference, DigitsPreference, } from './src/core/ui_preferences.js';
86
+ export type { UiPreferences, CalendarSystem, CalendarPreference, DigitsPreference, NavigationLayout, } from './src/core/ui_preferences.js';
87
+ export { UserPreferences, definePreference, isPreferenceSetting, PREFERENCE_PREFIX, PREFERENCE_MAX_BYTES, } from './src/core/user_preferences.js';
88
+ export type { PreferenceDefinition } from './src/core/user_preferences.js';
85
89
  export { moveOrgUnit } from './src/org/org_service.js';
86
90
  export { publishOutbox, consumeEvent } from './src/events/outbox.js';
87
91
  export type { Jobs, DomainEvent, Listener } from './src/events/outbox.js';
@@ -89,6 +93,12 @@ export { AdonisJobs } from './src/events/adonis_jobs.js';
89
93
  export { recordMutation } from './src/events/record_mutation.js';
90
94
  export { assessBackup, verifyBackup } from './src/services/backup.js';
91
95
  export type { BackupObject, BackupStatus } from './src/services/backup.js';
96
+ export { BACKUP_ARCHIVE_EXTENSION, BACKUP_ARCHIVE_FILES, BackupArchiveError, createOpenStream, createSealStream, openBackupArchive, parseBackupKey, sealBackupArchive, } from './src/backups/archive.js';
97
+ export type { BackupArchiveErrorCode } from './src/backups/archive.js';
98
+ export { BackupProviderError, googleDriveProvider, oneDriveProvider, } from './src/backups/providers.js';
99
+ export type { BackupProvider, BackupProviderClient, BackupProviderErrorCategory, BackupProviderOptions, GoogleDriveEndpoints, OneDriveEndpoints, } from './src/backups/providers.js';
100
+ export { BACKUP_FAILURE_MESSAGES, CloudBackups } from './src/backups/cloud_backups.js';
101
+ export type { BackupConnection, BackupKind, BackupRun, BackupRunStatus, BackupSchedule, BackupTrigger, CloudBackupStatus, CloudBackupsOptions, } from './src/backups/cloud_backups.js';
92
102
  export { ActivityAdmin, logActivity } from './src/core/activity.js';
93
103
  export type { ActivityEntry, ActivityFilters, ActivityPage, ActivityRow, } from './src/core/activity.js';
94
104
  export { RolesAdmin, ALL_SUBJECT_LABEL } from './src/core/roles.js';
@@ -96,6 +106,10 @@ export { seedModules } from './src/core/module_seed.js';
96
106
  export type { ModuleSeedResult } from './src/core/module_seed.js';
97
107
  export type { RoleSummary, RoleDetail, RoleRule, RuleInput, RoleMatrix, MatrixSubject, MatrixField, } from './src/core/roles.js';
98
108
  export { UsersAdmin } from './src/core/users.js';
109
+ export { UserAvatars, avatarUrl, avatarUrlFor, avatarVersionColumn, avatarHeaders, } from './src/core/user_avatars.js';
110
+ export type { AvatarRecord, RemovedAvatarFile } from './src/core/user_avatars.js';
111
+ export { prepareAvatarImage, AVATAR_LIMITS } from './src/core/avatar_image.js';
112
+ export type { AvatarImage } from './src/core/avatar_image.js';
99
113
  export { UserInvitations, type InvitationDelivery } from './src/core/user_invitations.js';
100
114
  export type { UserSummary, UserPage, UserRoleAssignment, UserOrgUnit } from './src/core/users.js';
101
115
  export { OrgUnitsAdmin } from './src/core/org_units.js';
@@ -112,7 +126,7 @@ export { SequencesAdmin } from './src/core/sequences.js';
112
126
  export type { SequenceRow } from './src/core/sequences.js';
113
127
  export { runtimeHealth, isBackupStale, backupStale, heartbeat, HEARTBEAT_MAX_AGE_MS, BACKUP_MAX_AGE_MS, } from './src/core/health.js';
114
128
  export type { RuntimeHealth, HeartbeatStatus, QueueSnapshot, QueueCounts, FailedJob, } from './src/core/health.js';
115
- export { MailDeliveryTest, MAIL_TEST_KEY, type MailTestState } from './src/core/mail_test.js';
129
+ export { MailDeliveryTest, MAIL_TEST_KEY, classifyMailFailure, type MailFailure, type MailFailureReason, type MailTestState, } from './src/core/mail_test.js';
116
130
  export { InitialSetup, type SetupCheck } from './src/core/setup.js';
117
131
  export { administratorExists, grantInstallAdministrator, resolveInstallAdministrator, } from './src/core/administrators.js';
118
132
  export { ADULA_VERSION } from './src/version.js';
@@ -124,3 +138,19 @@ export { createNotificationChannelsSchema, createChannelConfirmationsSchema, } f
124
138
  export { NotificationChannels, HttpChannelSettings, ChannelDeliveryError, inAppChannel, mailChannel, httpNotificationChannel, phoneAddress, IN_APP_CHANNEL, MAIL_CHANNEL, CHANNEL_MAX_ATTEMPTS, HTTP_CHANNEL_SETTING_KEY, HTTP_CHANNEL_KINDS, CHANNEL_KIND_LABELS, } from './src/core/notification_channels.js';
125
139
  export type { NotificationChannel, ChannelLabel, ChannelMessage, ChannelRecipient, ChannelContext, ChannelDelivery, ChannelPreference, ChannelPreferenceInput, ChannelDispatchResult, HttpChannelOptions, HttpChannelKind, HttpChannelConfig, HttpChannelInput, } from './src/core/notification_channels.js';
126
140
  export { isSealedSetting } from './src/core/settings.js';
141
+ export { parseResourceToolArgs, runResourceTool, resourceToolError, RESOURCE_READ_SCHEMA, RESOURCE_WRITE_SCHEMA, } from './src/admin/resource_tools.js';
142
+ export type { ResourceToolCall, ResourceToolError } from './src/admin/resource_tools.js';
143
+ export { Assistant } from './src/ai/assistant.js';
144
+ export type { AssistantProposal, AssistantTurnResult, AssistantStatus } from './src/ai/assistant.js';
145
+ export { AssistantSettings, ASSISTANT_LIMITS } from './src/ai/settings.js';
146
+ export { MailSettings, MAIL_SETTINGS_KEY } from './src/core/mail_settings.js';
147
+ export type { MailSettingsView, MailSettingsInput, MailRuntime, MailSecurity, } from './src/core/mail_settings.js';
148
+ export type { AssistantSettingsView, AssistantSettingsInput } from './src/ai/settings.js';
149
+ export { createChatClient, AssistantError } from './src/ai/client.js';
150
+ export type { ChatClient, ChatRequest, ChatCompletion } from './src/ai/client.js';
151
+ export { Appearance, APPEARANCE_LOGO_OWNER, APPEARANCE_SETTING_KEY, APPEARANCE_TEXT_LIMITS, BASE_LOGO_RECORD, dateIn, } from './src/appearance/appearance.js';
152
+ export type { AppearanceIdentity, AppearanceLogo, AppearanceOccasion, RemovedLogoFile, ResolvedAppearance, } from './src/appearance/appearance.js';
153
+ export { checkPrimaryColor, contrast, derivePrimaryTheme, normalizeColor, WCAG_AA, } from './src/appearance/colors.js';
154
+ export type { ContrastCheck, DerivedTheme, ThemeColors } from './src/appearance/colors.js';
155
+ export { LOGO_LIMITS, detectLogoType, logoHeaders, prepareLogoImage, } from './src/appearance/logo.js';
156
+ export type { LogoImage, LogoType } from './src/appearance/logo.js';