adula 2.1.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 (269) hide show
  1. package/README.md +149 -18
  2. package/build/agent/AGENTS.template.md +4 -4
  3. package/build/agent/capabilities.md +22 -12
  4. package/build/agent/skills/adula-frontend-design/SKILL.md +6 -4
  5. package/build/agent/skills/idea-review/SKILL.md +2 -2
  6. package/build/commands/adula_assistant_prune.d.ts +10 -0
  7. package/build/commands/adula_assistant_prune.js +12 -0
  8. package/build/commands/adula_outbox.d.ts +10 -0
  9. package/build/commands/adula_outbox.js +11 -0
  10. package/build/commands/adula_restore_reconcile.d.ts +10 -0
  11. package/build/commands/adula_restore_reconcile.js +34 -0
  12. package/build/commands/adula_runtime_health.d.ts +10 -0
  13. package/build/commands/adula_runtime_health.js +27 -0
  14. package/build/commands/adula_uploads_prune.d.ts +10 -0
  15. package/build/commands/adula_uploads_prune.js +16 -0
  16. package/build/commands/app.d.ts +10 -0
  17. package/build/commands/app.js +64 -0
  18. package/build/commands/backup_create.d.ts +11 -0
  19. package/build/commands/backup_create.js +99 -0
  20. package/build/commands/backup_open.d.ts +16 -0
  21. package/build/commands/backup_open.js +48 -0
  22. package/build/commands/backup_restore_files.d.ts +11 -0
  23. package/build/commands/backup_restore_files.js +44 -0
  24. package/build/commands/backup_restore_test.d.ts +12 -0
  25. package/build/commands/backup_restore_test.js +188 -0
  26. package/build/commands/backup_seal.d.ts +12 -0
  27. package/build/commands/backup_seal.js +36 -0
  28. package/build/commands/backup_services.d.ts +33 -0
  29. package/build/commands/backup_services.js +6 -0
  30. package/build/commands/backup_verify.d.ts +9 -0
  31. package/build/commands/backup_verify.js +59 -0
  32. package/build/commands/backup_verify_snapshot.d.ts +10 -0
  33. package/build/commands/backup_verify_snapshot.js +37 -0
  34. package/build/commands/client.d.ts +16 -0
  35. package/build/commands/client.js +71 -0
  36. package/build/commands/doctor.js +21 -1
  37. package/build/commands/install.d.ts +8 -0
  38. package/build/commands/install.js +69 -45
  39. package/build/commands/main.d.ts +3 -2
  40. package/build/commands/main.js +32 -0
  41. package/build/commands/module_add.js +4 -20
  42. package/build/commands/resource.d.ts +2 -0
  43. package/build/commands/resource.js +12 -3
  44. package/build/commands/resource_migration.d.ts +15 -0
  45. package/build/commands/resource_migration.js +81 -0
  46. package/build/commands/resource_snapshot.d.ts +2 -0
  47. package/build/commands/resource_snapshot.js +21 -4
  48. package/build/commands/sla_evaluate.d.ts +14 -0
  49. package/build/commands/sla_evaluate.js +16 -0
  50. package/build/commands/ui.js +4 -2
  51. package/build/commands/ui_css.d.ts +9 -0
  52. package/build/commands/ui_css.js +19 -0
  53. package/build/commands/upgrade.d.ts +1 -1
  54. package/build/commands/upgrade.js +1 -1
  55. package/build/configure.js +1 -1
  56. package/build/database/migrations/1770000000020_two_factor.d.ts +5 -0
  57. package/build/database/migrations/1770000000020_two_factor.js +10 -0
  58. package/build/database/migrations/1770000000041_import_modes.d.ts +5 -0
  59. package/build/database/migrations/1770000000041_import_modes.js +10 -0
  60. package/build/database/migrations/1770000000042_sync_jobs.d.ts +5 -0
  61. package/build/database/migrations/1770000000042_sync_jobs.js +10 -0
  62. package/build/database/migrations/1770000000043_notification_channels.d.ts +5 -0
  63. package/build/database/migrations/1770000000043_notification_channels.js +10 -0
  64. package/build/database/migrations/1770000000044_channel_confirmations.d.ts +5 -0
  65. package/build/database/migrations/1770000000044_channel_confirmations.js +10 -0
  66. package/build/database/migrations/1770000000045_import_leases.d.ts +5 -0
  67. package/build/database/migrations/1770000000045_import_leases.js +10 -0
  68. package/build/database/migrations/1770000000046_workflow_delegation_sla.d.ts +5 -0
  69. package/build/database/migrations/1770000000046_workflow_delegation_sla.js +10 -0
  70. package/build/database/migrations/1770000000049_print_templates.d.ts +5 -0
  71. package/build/database/migrations/1770000000049_print_templates.js +10 -0
  72. package/build/database/migrations/1770000000051_comment_notifications.d.ts +5 -0
  73. package/build/database/migrations/1770000000051_comment_notifications.js +10 -0
  74. package/build/database/migrations/1770000000054_cloud_backups.d.ts +5 -0
  75. package/build/database/migrations/1770000000054_cloud_backups.js +10 -0
  76. package/build/database/migrations/1770000000055_ai_assistant.d.ts +5 -0
  77. package/build/database/migrations/1770000000055_ai_assistant.js +10 -0
  78. package/build/database/migrations/1770000000056_appearance.d.ts +5 -0
  79. package/build/database/migrations/1770000000056_appearance.js +10 -0
  80. package/build/index.d.ts +87 -11
  81. package/build/index.js +50 -7
  82. package/build/providers/adula_provider.d.ts +2 -0
  83. package/build/providers/adula_provider.js +7 -0
  84. package/build/src/admin/contracts.js +1 -1
  85. package/build/src/admin/controller.d.ts +14 -1
  86. package/build/src/admin/controller.js +91 -13
  87. package/build/src/admin/errors.d.ts +32 -0
  88. package/build/src/admin/errors.js +63 -1
  89. package/build/src/admin/presentation.d.ts +21 -2
  90. package/build/src/admin/resource/editor.d.ts +60 -0
  91. package/build/src/admin/resource/editor.js +345 -0
  92. package/build/src/admin/resource/export.d.ts +54 -0
  93. package/build/src/admin/resource/export.js +262 -0
  94. package/build/src/admin/resource/lifecycle.d.ts +23 -0
  95. package/build/src/admin/resource/lifecycle.js +91 -0
  96. package/build/src/admin/resource/query.d.ts +111 -0
  97. package/build/src/admin/resource/query.js +595 -0
  98. package/build/src/admin/resource/read.d.ts +109 -0
  99. package/build/src/admin/resource/read.js +388 -0
  100. package/build/src/admin/resource/shared.d.ts +93 -0
  101. package/build/src/admin/resource/shared.js +265 -0
  102. package/build/src/admin/resource/trash.d.ts +10 -0
  103. package/build/src/admin/resource/trash.js +56 -0
  104. package/build/src/admin/resource/write.d.ts +57 -0
  105. package/build/src/admin/resource/write.js +603 -0
  106. package/build/src/admin/resource_service.d.ts +80 -193
  107. package/build/src/admin/resource_service.js +81 -1343
  108. package/build/src/admin/resource_tools.d.ts +111 -0
  109. package/build/src/admin/resource_tools.js +139 -0
  110. package/build/src/ai/assistant.d.ts +100 -0
  111. package/build/src/ai/assistant.js +487 -0
  112. package/build/src/ai/client.d.ts +49 -0
  113. package/build/src/ai/client.js +85 -0
  114. package/build/src/ai/prompt.d.ts +23 -0
  115. package/build/src/ai/prompt.js +83 -0
  116. package/build/src/ai/settings.d.ts +56 -0
  117. package/build/src/ai/settings.js +214 -0
  118. package/build/src/ai/usage.d.ts +16 -0
  119. package/build/src/ai/usage.js +33 -0
  120. package/build/src/appearance/appearance.d.ts +134 -0
  121. package/build/src/appearance/appearance.js +461 -0
  122. package/build/src/appearance/colors.d.ts +43 -0
  123. package/build/src/appearance/colors.js +99 -0
  124. package/build/src/appearance/logo.d.ts +32 -0
  125. package/build/src/appearance/logo.js +112 -0
  126. package/build/src/attachments/attachment_service.d.ts +46 -2
  127. package/build/src/attachments/attachment_service.js +96 -4
  128. package/build/src/auth/actor_store.d.ts +5 -1
  129. package/build/src/auth/actor_store.js +8 -4
  130. package/build/src/auth/conditions.d.ts +5 -0
  131. package/build/src/auth/conditions.js +26 -3
  132. package/build/src/auth/sql.js +17 -5
  133. package/build/src/auth/two_factor.d.ts +96 -0
  134. package/build/src/auth/two_factor.js +259 -0
  135. package/build/src/backups/archive.d.ts +52 -0
  136. package/build/src/backups/archive.js +362 -0
  137. package/build/src/backups/cloud_backups.d.ts +133 -0
  138. package/build/src/backups/cloud_backups.js +650 -0
  139. package/build/src/backups/doctor.d.ts +7 -0
  140. package/build/src/backups/doctor.js +55 -0
  141. package/build/src/backups/providers.d.ts +81 -0
  142. package/build/src/backups/providers.js +470 -0
  143. package/build/src/collaboration/assignments.d.ts +59 -2
  144. package/build/src/collaboration/assignments.js +196 -74
  145. package/build/src/collaboration/record_collaboration.d.ts +21 -4
  146. package/build/src/collaboration/record_collaboration.js +126 -51
  147. package/build/src/collaboration/shared.d.ts +24 -0
  148. package/build/src/collaboration/shared.js +34 -0
  149. package/build/src/commands/app_scaffold.d.ts +72 -0
  150. package/build/src/commands/app_scaffold.js +285 -0
  151. package/build/src/commands/capabilities.js +35 -9
  152. package/build/src/commands/doctor.d.ts +24 -2
  153. package/build/src/commands/doctor.js +81 -6
  154. package/build/src/commands/gap_report.d.ts +1 -1
  155. package/build/src/commands/gap_report.js +2 -2
  156. package/build/src/commands/generator.d.ts +37 -1
  157. package/build/src/commands/generator.js +61 -18
  158. package/build/src/commands/snapshot.d.ts +24 -13
  159. package/build/src/commands/snapshot.js +54 -14
  160. package/build/src/commands/source_markers.d.ts +10 -0
  161. package/build/src/commands/source_markers.js +29 -0
  162. package/build/src/core/activity.d.ts +2 -0
  163. package/build/src/core/activity.js +7 -1
  164. package/build/src/core/administrators.d.ts +38 -0
  165. package/build/src/core/administrators.js +145 -0
  166. package/build/src/core/avatar_image.d.ts +33 -0
  167. package/build/src/core/avatar_image.js +278 -0
  168. package/build/src/core/html_sanitizer.d.ts +20 -0
  169. package/build/src/core/html_sanitizer.js +261 -0
  170. package/build/src/core/like.d.ts +5 -0
  171. package/build/src/core/like.js +5 -0
  172. package/build/src/core/lookups.d.ts +80 -0
  173. package/build/src/core/lookups.js +319 -0
  174. package/build/src/core/mail_settings.d.ts +83 -0
  175. package/build/src/core/mail_settings.js +274 -0
  176. package/build/src/core/mail_test.d.ts +16 -0
  177. package/build/src/core/mail_test.js +81 -6
  178. package/build/src/core/message_templates.d.ts +15 -2
  179. package/build/src/core/message_templates.js +81 -11
  180. package/build/src/core/module_seed.js +2 -1
  181. package/build/src/core/notification_channels.d.ts +235 -0
  182. package/build/src/core/notification_channels.js +660 -0
  183. package/build/src/core/roles.js +26 -9
  184. package/build/src/core/saved_views.d.ts +8 -1
  185. package/build/src/core/saved_views.js +91 -26
  186. package/build/src/core/sequences.d.ts +32 -0
  187. package/build/src/core/sequences.js +97 -0
  188. package/build/src/core/settings.d.ts +5 -0
  189. package/build/src/core/settings.js +31 -3
  190. package/build/src/core/template_language.d.ts +61 -0
  191. package/build/src/core/template_language.js +141 -0
  192. package/build/src/core/ui_preferences.d.ts +10 -0
  193. package/build/src/core/ui_preferences.js +15 -1
  194. package/build/src/core/user_avatars.d.ts +79 -0
  195. package/build/src/core/user_avatars.js +186 -0
  196. package/build/src/core/user_invitations.d.ts +5 -1
  197. package/build/src/core/user_invitations.js +7 -1
  198. package/build/src/core/user_preferences.d.ts +36 -0
  199. package/build/src/core/user_preferences.js +125 -0
  200. package/build/src/core/users.d.ts +2 -0
  201. package/build/src/core/users.js +5 -3
  202. package/build/src/database/calendar_days.d.ts +19 -0
  203. package/build/src/database/calendar_days.js +36 -0
  204. package/build/src/database/schema.d.ts +201 -2
  205. package/build/src/database/schema.js +713 -59
  206. package/build/src/database/schema_diff.d.ts +70 -0
  207. package/build/src/database/schema_diff.js +190 -0
  208. package/build/src/events/record_mutation.d.ts +2 -1
  209. package/build/src/events/record_mutation.js +1 -0
  210. package/build/src/integrations/api_client.d.ts +37 -0
  211. package/build/src/integrations/api_client.js +567 -0
  212. package/build/src/integrations/import_adapters.d.ts +37 -0
  213. package/build/src/integrations/import_adapters.js +35 -0
  214. package/build/src/integrations/imports.d.ts +130 -16
  215. package/build/src/integrations/imports.js +434 -73
  216. package/build/src/integrations/openapi.d.ts +3 -1
  217. package/build/src/integrations/openapi.js +465 -31
  218. package/build/src/integrations/outbound.d.ts +94 -0
  219. package/build/src/integrations/outbound.js +276 -0
  220. package/build/src/integrations/print.d.ts +22 -1
  221. package/build/src/integrations/print.js +68 -22
  222. package/build/src/integrations/print_templates.d.ts +216 -0
  223. package/build/src/integrations/print_templates.js +1017 -0
  224. package/build/src/integrations/sync_jobs.d.ts +139 -0
  225. package/build/src/integrations/sync_jobs.js +416 -0
  226. package/build/src/integrations/webhooks.d.ts +12 -12
  227. package/build/src/integrations/webhooks.js +34 -43
  228. package/build/src/integrations/xlsx.d.ts +41 -0
  229. package/build/src/integrations/xlsx.js +519 -0
  230. package/build/src/languages/ar.d.ts +11 -0
  231. package/build/src/languages/ar.js +358 -0
  232. package/build/src/languages/ar_ui.d.ts +461 -0
  233. package/build/src/languages/ar_ui.js +464 -0
  234. package/build/src/languages/catalog.d.ts +66 -0
  235. package/build/src/languages/catalog.js +152 -0
  236. package/build/src/languages/en.d.ts +7 -0
  237. package/build/src/languages/en.js +352 -0
  238. package/build/src/languages/en_ui.d.ts +3 -0
  239. package/build/src/languages/en_ui.js +458 -0
  240. package/build/src/languages/validation.d.ts +26 -0
  241. package/build/src/languages/validation.js +60 -0
  242. package/build/src/lists/bulk_actions.d.ts +89 -0
  243. package/build/src/lists/bulk_actions.js +268 -0
  244. package/build/src/lists/dashboards.d.ts +138 -0
  245. package/build/src/lists/dashboards.js +290 -0
  246. package/build/src/mcp/tools.js +9 -104
  247. package/build/src/resource/define_resource.d.ts +18 -1
  248. package/build/src/resource/define_resource.js +212 -18
  249. package/build/src/resource/definition.d.ts +44 -0
  250. package/build/src/resource/definition.js +171 -0
  251. package/build/src/resource/registry.js +15 -4
  252. package/build/src/resource/types.d.ts +313 -16
  253. package/build/src/resource/values.d.ts +56 -1
  254. package/build/src/resource/values.js +237 -5
  255. package/build/src/services/settings.d.ts +2 -0
  256. package/build/src/services/settings.js +5 -1
  257. package/build/src/upgrade/legacy.js +2 -2
  258. package/build/src/workflows/calendar.d.ts +9 -0
  259. package/build/src/workflows/calendar.js +44 -0
  260. package/build/src/workflows/define_workflow.d.ts +48 -3
  261. package/build/src/workflows/define_workflow.js +57 -13
  262. package/build/src/workflows/delegations.d.ts +107 -0
  263. package/build/src/workflows/delegations.js +326 -0
  264. package/build/src/workflows/engine.d.ts +80 -4
  265. package/build/src/workflows/engine.js +466 -86
  266. package/build/src/workflows/sla.d.ts +15 -0
  267. package/build/src/workflows/sla.js +8 -0
  268. package/build/stubs/resource_contract.txt +12 -1
  269. package/package.json +9 -2
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { defineResource, columnName } from './src/resource/define_resource.js';
1
+ export { defineResource, columnName, joinTable } from './src/resource/define_resource.js';
2
2
  export { configure } from './configure.js';
3
3
  export { withAdulaDatabase } from './src/database/configure.js';
4
4
  export { createResourceController } from './src/admin/controller.js';
@@ -9,41 +9,84 @@ export { ActorStore } from './src/auth/actor_store.js';
9
9
  export { accessibleBy, authorizationSql, conditionSql } from './src/auth/sql.js';
10
10
  export { ACTOR_ID, resolveActorConditions } from './src/auth/conditions.js';
11
11
  export { ResourceService, canQueryField } from './src/admin/resource_service.js';
12
+ export { EXPORT_ROW_LIMIT, guardFormula } from './src/admin/resource_service.js';
13
+ export { BulkActions, defineBulkActions, BULK_ID_LIMIT } from './src/lists/bulk_actions.js';
14
+ export { Dashboards, defineDashboard } from './src/lists/dashboards.js';
12
15
  export { serialize, writableInput, selectedFields } from './src/admin/contracts.js';
13
16
  export { AdulaError } from './src/admin/errors.js';
14
- export { createCoreSchema, createResourceTable, createAttachmentsSchema, createSavedViewsSchema, createCollaborationSchema, createAssignmentsSchema, createMessagingSchema, createWebhooksSchema, createImportsSchema, createWorkflowSchema, createManagedAssignmentsSchema, createRoleKeysSchema, createNotificationTargetsSchema, createUploadGrantsSchema, createInboundWebhooksSchema, } from './src/database/schema.js';
17
+ export { BASE_LANGUAGE, registerLanguage, registeredLanguages, enabledLanguages, resolveLanguage, languageDirection, translate, localizeText, messageKeyOf, clientMessages, runWithLanguage, currentLanguage, labelText, } from './src/languages/catalog.js';
18
+ export { arabicMessages } from './src/languages/ar.js';
19
+ export { englishMessages } from './src/languages/en.js';
20
+ export { CatalogMessagesProvider, installCatalogMessages } from './src/languages/validation.js';
21
+ export { TwoFactor, normalizeRecoveryCode, RECOVERY_CODE_COUNT, TWO_FACTOR_PERIOD, TWO_FACTOR_DIGITS, TWO_FACTOR_WINDOW, TWO_FACTOR_UNREADABLE, } from './src/auth/two_factor.js';
22
+ export { createCoreSchema, createResourceTable, createAttachmentsSchema, createSavedViewsSchema, createCollaborationSchema, createAssignmentsSchema, createMessagingSchema, createWebhooksSchema, createImportsSchema, createWorkflowSchema, createManagedAssignmentsSchema, createRoleKeysSchema, createNotificationTargetsSchema, createUploadGrantsSchema, createInboundWebhooksSchema, createTwoFactorSchema, createWorkflowDelegationSlaSchema, resourceSchema, alterResourceTable, fieldColumnType, } from './src/database/schema.js';
23
+ export { schemaDrift, resourceAddition, describeDrift } from './src/database/schema_diff.js';
24
+ export { definitionSchema, definitionValidator, resourceValidator, isVisible, applyVisibility, } from './src/resource/definition.js';
25
+ export { FieldValueError, canonicalDecimal, decimalShape, isMultipleAttachment, attachmentLimit, MULTIPLE_ATTACHMENT_LIMIT, MULTIPLE_ATTACHMENT_MAX, } from './src/resource/values.js';
15
26
  export { defineWorkflow, nextStep } from './src/workflows/define_workflow.js';
16
- export { WorkflowEngine, workflowListeners } from './src/workflows/engine.js';
27
+ export { WorkflowEngine, workflowListeners, slaState } from './src/workflows/engine.js';
28
+ export { WorkflowDelegations } from './src/workflows/delegations.js';
17
29
  export { ImportBatches, importCell, IMPORT_ROW_LIMIT } from './src/integrations/imports.js';
30
+ export { csvImportAdapter, importFile } from './src/integrations/import_adapters.js';
31
+ export { guardXlsx, readXlsxTable, xlsxImportAdapter, XLSX_LIMITS, XLSX_MIME_TYPE, } from './src/integrations/xlsx.js';
32
+ export { createImportModesSchema, createImportLeasesSchema } from './src/database/schema.js';
18
33
  export { openApiDocument } from './src/integrations/openapi.js';
19
- export { renderPrintHtml, htmlToPdf } from './src/integrations/print.js';
34
+ export { apiClientSource, apiClientDeclarations } from './src/integrations/api_client.js';
35
+ export { renderPrintHtml, htmlToPdf, imageDataUri, PRINT_LOGO_LIMIT, } from './src/integrations/print.js';
36
+ export { PrintTemplates, DEFAULT_PRINT_TEMPLATE, PRINT_HELPERS, PRINT_PAPERS, PRINT_ORIENTATIONS, codeTemplateVersion, renderTemplateDocument, printableGroups, PRINT_LINE_LIMIT, } from './src/integrations/print_templates.js';
37
+ export { sanitizePrintHtml } from './src/core/html_sanitizer.js';
38
+ export { parseTemplate } from './src/core/template_language.js';
39
+ export { createPrintTemplatesSchema } from './src/database/schema.js';
20
40
  export { Webhooks, signWebhook, WEBHOOK_MAX_ATTEMPTS } from './src/integrations/webhooks.js';
41
+ export { createOutboundPoster, createOutboundRequester, OutboundResponseTooLargeError, isBlockedAddress, outboundErrorCategory, } from './src/integrations/outbound.js';
21
42
  export { InboundWebhooks, inboundEventName, INBOUND_BODY_LIMIT, INBOUND_RETENTION_DAYS, } from './src/integrations/inbound_webhooks.js';
22
43
  export { MessageTemplates, DEFAULT_TEMPLATES, renderTemplate, notifyWithTemplate, deliverNotificationMail, listenForNotifications, } from './src/core/message_templates.js';
23
44
  export { Assignments } from './src/collaboration/assignments.js';
24
45
  export { RecordCollaboration, followerListeners } from './src/collaboration/record_collaboration.js';
25
- export { registerUpload, findAttachment, loadAttachments, claimAttachment, releaseAttachment, summarizeAttachment, attachmentUrl, isAttachmentId, isRelativeDiskPath, attachmentPolicy, pendingUploadCount, staleUploads, forgetUpload, DEFAULT_ATTACHMENT_EXTENSIONS, PENDING_UPLOAD_LIMIT, UNBOUND_UPLOAD_TTL_MS, } from './src/attachments/attachment_service.js';
46
+ export { registerUpload, findAttachment, loadAttachments, claimAttachment, releaseAttachment, summarizeAttachment, attachmentUrl, isAttachmentId, isRelativeDiskPath, attachmentPolicy, attachmentPreview, attachmentHeaders, pendingUploadCount, staleUploads, forgetUpload, DEFAULT_ATTACHMENT_EXTENSIONS, PENDING_UPLOAD_LIMIT, UNBOUND_UPLOAD_TTL_MS, } from './src/attachments/attachment_service.js';
26
47
  export { grantUpload, redeemUploadGrant, pruneUploadGrants, UPLOAD_GRANT_MAX_TTL_MS, } from './src/attachments/upload_grants.js';
27
48
  export { migrateStorage } from './src/attachments/storage_migrate.js';
28
49
  export { diagnoseAttachments } from './src/attachments/doctor.js';
29
- export { Settings, sequence, notify } from './src/services/settings.js';
50
+ export { Settings, sequence, formatSequence, notify } from './src/services/settings.js';
30
51
  export { uiPreferences, validateUiPreferences, UI_PREFERENCES_KEY, DEFAULT_UI_PREFERENCES, } from './src/core/ui_preferences.js';
52
+ export { UserPreferences, definePreference, isPreferenceSetting, PREFERENCE_PREFIX, PREFERENCE_MAX_BYTES, } from './src/core/user_preferences.js';
31
53
  export { moveOrgUnit } from './src/org/org_service.js';
32
54
  export { publishOutbox, consumeEvent } from './src/events/outbox.js';
33
55
  export { AdonisJobs } from './src/events/adonis_jobs.js';
34
56
  export { recordMutation } from './src/events/record_mutation.js';
35
57
  export { assessBackup, verifyBackup } from './src/services/backup.js';
58
+ export { BACKUP_ARCHIVE_EXTENSION, BACKUP_ARCHIVE_FILES, BackupArchiveError, createOpenStream, createSealStream, openBackupArchive, parseBackupKey, sealBackupArchive, } from './src/backups/archive.js';
59
+ export { BackupProviderError, googleDriveProvider, oneDriveProvider, } from './src/backups/providers.js';
60
+ export { BACKUP_FAILURE_MESSAGES, CloudBackups } from './src/backups/cloud_backups.js';
36
61
  export { ActivityAdmin, logActivity } from './src/core/activity.js';
37
62
  export { RolesAdmin, ALL_SUBJECT_LABEL } from './src/core/roles.js';
38
63
  export { seedModules } from './src/core/module_seed.js';
39
64
  export { UsersAdmin } from './src/core/users.js';
65
+ export { UserAvatars, avatarUrl, avatarUrlFor, avatarVersionColumn, avatarHeaders, } from './src/core/user_avatars.js';
66
+ export { prepareAvatarImage, AVATAR_LIMITS } from './src/core/avatar_image.js';
40
67
  export { UserInvitations } from './src/core/user_invitations.js';
41
68
  export { OrgUnitsAdmin } from './src/core/org_units.js';
42
69
  export { SavedViews } from './src/core/saved_views.js';
43
70
  export { NotificationsAdmin } from './src/core/notifications.js';
44
71
  export { SettingsAdmin, isProtectedSetting, parseSettingValue, SETTING_SCOPES, PROTECTED_SETTING_KEYS, } from './src/core/settings.js';
72
+ export { LookupsAdmin } from './src/core/lookups.js';
73
+ export { SequencesAdmin } from './src/core/sequences.js';
45
74
  export { runtimeHealth, isBackupStale, backupStale, heartbeat, HEARTBEAT_MAX_AGE_MS, BACKUP_MAX_AGE_MS, } from './src/core/health.js';
46
- export { MailDeliveryTest, MAIL_TEST_KEY } from './src/core/mail_test.js';
75
+ export { MailDeliveryTest, MAIL_TEST_KEY, classifyMailFailure, } from './src/core/mail_test.js';
47
76
  export { InitialSetup } from './src/core/setup.js';
77
+ export { administratorExists, grantInstallAdministrator, resolveInstallAdministrator, } from './src/core/administrators.js';
48
78
  export { ADULA_VERSION } from './src/version.js';
49
79
  export { capabilityCatalog, SERVICES as CAPABILITY_SERVICES, FIELD_TYPES, WORKFLOW_STEPS, } from './src/commands/capabilities.js';
80
+ export { createSyncJobsSchema } from './src/database/schema.js';
81
+ export { defineSyncJob, SyncJobs, SyncJobError, syncErrorCategory, SYNC_DEFAULT_TIMEOUT_MS, } from './src/integrations/sync_jobs.js';
82
+ export { createNotificationChannelsSchema, createChannelConfirmationsSchema, } from './src/database/schema.js';
83
+ 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';
84
+ export { isSealedSetting } from './src/core/settings.js';
85
+ export { parseResourceToolArgs, runResourceTool, resourceToolError, RESOURCE_READ_SCHEMA, RESOURCE_WRITE_SCHEMA, } from './src/admin/resource_tools.js';
86
+ export { Assistant } from './src/ai/assistant.js';
87
+ export { AssistantSettings, ASSISTANT_LIMITS } from './src/ai/settings.js';
88
+ export { MailSettings, MAIL_SETTINGS_KEY } from './src/core/mail_settings.js';
89
+ export { createChatClient, AssistantError } from './src/ai/client.js';
90
+ export { Appearance, APPEARANCE_LOGO_OWNER, APPEARANCE_SETTING_KEY, APPEARANCE_TEXT_LIMITS, BASE_LOGO_RECORD, dateIn, } from './src/appearance/appearance.js';
91
+ export { checkPrimaryColor, contrast, derivePrimaryTheme, normalizeColor, WCAG_AA, } from './src/appearance/colors.js';
92
+ export { LOGO_LIMITS, detectLogoType, logoHeaders, prepareLogoImage, } from './src/appearance/logo.js';
@@ -3,4 +3,6 @@ export default class AdulaProvider {
3
3
  protected app: ApplicationService;
4
4
  constructor(app: ApplicationService);
5
5
  register(): void;
6
+ /** DATE columns stay calendar days in every time zone (see keepCalendarDays). */
7
+ boot(): Promise<void>;
6
8
  }
@@ -1,4 +1,5 @@
1
1
  import { ResourceRegistry } from '../src/resource/registry.js';
2
+ import { keepCalendarDays } from '../src/database/calendar_days.js';
2
3
  export default class AdulaProvider {
3
4
  app;
4
5
  constructor(app) {
@@ -7,4 +8,10 @@ export default class AdulaProvider {
7
8
  register() {
8
9
  this.app.container.singleton(ResourceRegistry, () => new ResourceRegistry());
9
10
  }
11
+ /** DATE columns stay calendar days in every time zone (see keepCalendarDays). */
12
+ async boot() {
13
+ if (!this.app.container.hasBinding('lucid.db'))
14
+ return;
15
+ keepCalendarDays((await this.app.container.make('lucid.db')));
16
+ }
10
17
  }
@@ -17,7 +17,7 @@ export function selectedFields(resource, ability, options = {}) {
17
17
  ...(options.extra ?? []),
18
18
  ...conditionFields(ability, resource),
19
19
  ]),
20
- ].filter((key) => key !== 'orgPath' && resource.fields[key]?.type !== 'hasMany');
20
+ ].filter((key) => key !== 'orgPath' && !['hasMany', 'manyToMany'].includes(resource.fields[key]?.type ?? ''));
21
21
  }
22
22
  const rowKeys = new WeakMap();
23
23
  /** Record keys and their columns for a resource, computed once per definition. */
@@ -3,10 +3,13 @@ import type { Actor } from '../auth/ability.js';
3
3
  import type { ResourceRegistry } from '../resource/registry.js';
4
4
  import type { Resource } from '../resource/types.js';
5
5
  import type { ResourceService } from './resource_service.js';
6
+ import { BulkActions } from '../lists/bulk_actions.js';
6
7
  export type ResourceRuntime = {
7
8
  registry: ResourceRegistry;
8
9
  resources: ResourceService;
9
10
  actor: Actor;
11
+ /** Bulk actions with the application's definitions; built-in actions only when absent. */
12
+ bulk?: BulkActions;
10
13
  };
11
14
  export type ResourceList = Awaited<ReturnType<ResourceService['list']>>;
12
15
  export type ResourceEditor = Awaited<ReturnType<ResourceService['editor']>>;
@@ -27,6 +30,16 @@ export interface ResourceController {
27
30
  edit(ctx: HttpContext): Promise<unknown>;
28
31
  options(ctx: HttpContext): Promise<unknown>;
29
32
  aggregate(ctx: HttpContext): Promise<unknown>;
33
+ /** GET …/export: the filtered list as CSV (ADR 046). */
34
+ export(ctx: HttpContext): Promise<unknown>;
35
+ /** GET …/trash: soft-deleted records for actors who may delete (ADR 046). */
36
+ trash(ctx: HttpContext): Promise<unknown>;
37
+ /** POST …/:id/restore */
38
+ restore(ctx: HttpContext): Promise<unknown>;
39
+ /** GET …/bulk: the bulk actions the actor may offer. */
40
+ bulkActions(ctx: HttpContext): Promise<unknown>;
41
+ /** POST …/bulk: { action, ids, versions? } → { data: { succeeded, failed } }. */
42
+ bulk(ctx: HttpContext): Promise<unknown>;
30
43
  }
31
44
  /** The host supplies its authenticated actor; ResourceService authorizes every action. */
32
- export declare function createResourceController(resolveRuntime: (ctx: HttpContext) => Promise<ResourceRuntime>, renderList?: (ctx: HttpContext, resource: Resource, result: ResourceList) => unknown, renderForm?: (ctx: HttpContext, resource: Resource, editor: ResourceEditor) => unknown, renderShow?: (ctx: HttpContext, resource: Resource, result: ResourceShow) => unknown): new () => ResourceController;
45
+ export declare function createResourceController(resolveRuntime: (ctx: HttpContext) => Promise<ResourceRuntime>, renderList?: (ctx: HttpContext, resource: Resource, result: ResourceList) => unknown, renderForm?: (ctx: HttpContext, resource: Resource, editor: ResourceEditor) => unknown, renderShow?: (ctx: HttpContext, resource: Resource, result: ResourceShow) => unknown, renderTrash?: (ctx: HttpContext, resource: Resource, result: ResourceList) => unknown): new () => ResourceController;
@@ -1,6 +1,8 @@
1
1
  import { AdulaError } from './errors.js';
2
+ import { translate } from '../languages/catalog.js';
3
+ import { BulkActions } from '../lists/bulk_actions.js';
2
4
  /** The host supplies its authenticated actor; ResourceService authorizes every action. */
3
- export function createResourceController(resolveRuntime, renderList, renderForm, renderShow) {
5
+ export function createResourceController(resolveRuntime, renderList, renderForm, renderShow, renderTrash) {
4
6
  return class ResourcesController {
5
7
  async create(ctx) {
6
8
  return this.#execute(ctx, async ({ resources, actor }, resource) => {
@@ -26,21 +28,78 @@ export function createResourceController(resolveRuntime, renderList, renderForm,
26
28
  }
27
29
  async index(ctx) {
28
30
  return this.#execute(ctx, async ({ resources, actor }, resource) => {
29
- const result = await resources.list(resource.name, actor, {
30
- limit: ctx.request.input('limit'),
31
- cursor: ctx.request.input('cursor'),
32
- search: ctx.request.input('search'),
33
- sort: ctx.request.input('sort'),
34
- direction: ctx.request.input('direction'),
35
- filters: ctx.request.input('filters'),
36
- tag: ctx.request.input('tag'),
37
- estimate: ctx.request.input('estimate') !== 'false' && ctx.request.input('estimate') !== false,
38
- });
31
+ const result = await resources.list(resource.name, actor, this.#listOptions(ctx));
39
32
  return renderList && ctx.request.accepts(['html', 'json']) === 'html'
40
33
  ? renderList(ctx, resource, result)
41
34
  : result;
42
35
  });
43
36
  }
37
+ async trash(ctx) {
38
+ return this.#execute(ctx, async ({ resources, actor }, resource) => {
39
+ const result = await resources.list(resource.name, actor, {
40
+ ...this.#listOptions(ctx),
41
+ trashed: true,
42
+ });
43
+ return renderTrash && ctx.request.accepts(['html', 'json']) === 'html'
44
+ ? renderTrash(ctx, resource, result)
45
+ : result;
46
+ });
47
+ }
48
+ async export(ctx) {
49
+ return this.#execute(ctx, async ({ resources, actor }, resource) => {
50
+ const format = exportFormat(ctx);
51
+ const { search, sort, direction, filters, tag } = this.#listOptions(ctx);
52
+ const options = {
53
+ search,
54
+ sort,
55
+ direction,
56
+ filters,
57
+ tag,
58
+ trashed: ctx.request.input('trashed') === 'true' || ctx.request.input('trashed') === true,
59
+ };
60
+ const file = format === 'xlsx'
61
+ ? await resources.exportXlsx(resource.name, actor, options)
62
+ : await resources.export(resource.name, actor, options);
63
+ ctx.response.header('Content-Type', format === 'xlsx' ? XLSX_CONTENT_TYPE : 'text/csv; charset=utf-8');
64
+ ctx.response.header('Content-Disposition', `attachment; filename="${file.asciiFilename}"; filename*=UTF-8''${rfc5987(file.filename)}`);
65
+ ctx.response.header('Cache-Control', 'no-store');
66
+ ctx.response.send(typeof file.content === 'string' ? file.content : Buffer.from(file.content));
67
+ });
68
+ }
69
+ async restore(ctx) {
70
+ return this.#execute(ctx, async ({ resources, actor }, resource) => ({
71
+ data: await resources.restore(resource.name, this.#id(ctx), actor),
72
+ }));
73
+ }
74
+ async bulkActions(ctx) {
75
+ return this.#execute(ctx, async (runtime, resource) => ({
76
+ data: this.#bulk(runtime).available(resource.name, runtime.actor),
77
+ }));
78
+ }
79
+ async bulk(ctx) {
80
+ return this.#execute(ctx, async (runtime, resource) => ({
81
+ data: await this.#bulk(runtime).run(resource.name, runtime.actor, {
82
+ action: ctx.request.input('action'),
83
+ ids: ctx.request.input('ids'),
84
+ versions: ctx.request.input('versions'),
85
+ }),
86
+ }));
87
+ }
88
+ #bulk(runtime) {
89
+ return runtime.bulk ?? new BulkActions(runtime.registry, runtime.resources);
90
+ }
91
+ #listOptions(ctx) {
92
+ return {
93
+ limit: ctx.request.input('limit'),
94
+ cursor: ctx.request.input('cursor'),
95
+ search: ctx.request.input('search'),
96
+ sort: ctx.request.input('sort'),
97
+ direction: ctx.request.input('direction'),
98
+ filters: ctx.request.input('filters'),
99
+ tag: ctx.request.input('tag'),
100
+ estimate: ctx.request.input('estimate') !== 'false' && ctx.request.input('estimate') !== false,
101
+ };
102
+ }
44
103
  async show(ctx) {
45
104
  return this.#execute(ctx, async ({ resources, actor }, resource) => {
46
105
  const result = await resources.show(resource.name, this.#id(ctx), actor);
@@ -154,14 +213,33 @@ export function createResourceController(resolveRuntime, renderList, renderForm,
154
213
  .send({ error: { code: error.code, message: error.message } });
155
214
  if (error?.code === '23505')
156
215
  return ctx.response.conflict({
157
- error: { code: 'E_DUPLICATE', message: 'هذه القيمة مستخدمة في سجل آخر' },
216
+ error: { code: 'E_DUPLICATE', message: translate('errors.E_DUPLICATE') },
217
+ });
218
+ // A NOT NULL column the definition lets be empty (see adula:resource:migration).
219
+ if (error?.code === '23502')
220
+ return ctx.response.unprocessableEntity({
221
+ error: { code: 'E_NOT_NULL', message: translate('errors.E_NOT_NULL') },
158
222
  });
159
223
  if (error?.code === '23503')
160
224
  return ctx.response.unprocessableEntity({
161
- error: { code: 'E_RELATION', message: 'تحقق من السجلات المرتبطة' },
225
+ error: { code: 'E_RELATION', message: translate('errors.E_RELATION') },
162
226
  });
163
227
  throw error;
164
228
  }
165
229
  }
166
230
  };
167
231
  }
232
+ /** RFC 5987 ext-value encoding of a UTF-8 file name. */
233
+ const XLSX_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
234
+ /** `?format=csv|xlsx`, or an Accept header naming the spreadsheet type; CSV by default. */
235
+ function exportFormat(ctx) {
236
+ const format = ctx.request.input('format');
237
+ if (format === undefined || format === null || format === '')
238
+ return (ctx.request.header('accept') ?? '').includes('spreadsheetml') ? 'xlsx' : 'csv';
239
+ if (format === 'csv' || format === 'xlsx')
240
+ return format;
241
+ throw new AdulaError(422, 'E_EXPORT_FORMAT', 'صيغة التصدير غير مدعومة');
242
+ }
243
+ function rfc5987(value) {
244
+ return encodeURIComponent(value).replace(/['()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
245
+ }
@@ -1,5 +1,37 @@
1
+ /**
2
+ * A refusal the caller can act on. The message is Arabic text from the catalog
3
+ * (src/languages/ar.ts); inside a request running in another language (see
4
+ * runWithLanguage) it is translated when that language translates the text, so a
5
+ * response, flash or MCP answer built from `message` is already localized.
6
+ */
1
7
  export declare class AdulaError extends Error {
2
8
  status: number;
3
9
  code: string;
10
+ /** The catalog key of the Arabic message, when the catalog defines it. */
11
+ readonly messageKey?: string;
4
12
  constructor(status: number, code: string, message: string);
5
13
  }
14
+ /** 403 E_FORBIDDEN: the actor may not perform the action. */
15
+ export declare function forbiddenAction(): AdulaError;
16
+ /** 404 E_NOT_FOUND: a record (by default) or another target outside the actor's reach. */
17
+ export declare function notFound(message?: string): AdulaError;
18
+ /** 403 E_FIELD_FORBIDDEN: a field the actor may not read, query or write. */
19
+ export declare function forbiddenField(message: string): AdulaError;
20
+ /** 422 E_FILTER: an unsupported or invalid filter. */
21
+ export declare function invalidFilter(message: string): AdulaError;
22
+ /** 403 E_SEARCH: full-text search is not available to the actor. */
23
+ export declare function searchUnavailable(): AdulaError;
24
+ /** 422 E_CURSOR: a malformed or mismatched pagination cursor. */
25
+ export declare function invalidCursor(): AdulaError;
26
+ /** 409 E_DOCUMENT_LOCKED: a submitted or cancelled document cannot change this way. */
27
+ export declare function documentLocked(message?: string): AdulaError;
28
+ /** 409 E_DOCUMENT_STATE: the document is not in a state that allows the transition. */
29
+ export declare function invalidDocumentState(message: string): AdulaError;
30
+ /** 422 E_REQUIRED: a required field has no value. */
31
+ export declare function requiredField(key: string): AdulaError;
32
+ /** 422 E_ACTOR: a system write without the author it needs. */
33
+ export declare function missingActor(message: string): AdulaError;
34
+ /** 422 E_INLINE: malformed inline rows. */
35
+ export declare function invalidInline(message: string): AdulaError;
36
+ /** 422 E_INLINE_SCOPE: inline rows and their parent must share one organization unit. */
37
+ export declare function inlineScope(message: string): AdulaError;
@@ -1,9 +1,71 @@
1
+ import { localizeText, messageKeyOf } from '../languages/catalog.js';
2
+ /**
3
+ * A refusal the caller can act on. The message is Arabic text from the catalog
4
+ * (src/languages/ar.ts); inside a request running in another language (see
5
+ * runWithLanguage) it is translated when that language translates the text, so a
6
+ * response, flash or MCP answer built from `message` is already localized.
7
+ */
1
8
  export class AdulaError extends Error {
2
9
  status;
3
10
  code;
11
+ /** The catalog key of the Arabic message, when the catalog defines it. */
12
+ messageKey;
4
13
  constructor(status, code, message) {
5
- super(message);
14
+ super(localizeText(message));
6
15
  this.status = status;
7
16
  this.code = code;
17
+ this.messageKey = messageKeyOf(message);
8
18
  }
9
19
  }
20
+ /*
21
+ * Named constructors for errors that recur across the resource service. Each keeps the
22
+ * exact status, code and message of the sites it replaced; clients and tests rely on them.
23
+ */
24
+ /** 403 E_FORBIDDEN: the actor may not perform the action. */
25
+ export function forbiddenAction() {
26
+ return new AdulaError(403, 'E_FORBIDDEN', 'ليس لديك صلاحية لهذا الإجراء');
27
+ }
28
+ /** 404 E_NOT_FOUND: a record (by default) or another target outside the actor's reach. */
29
+ export function notFound(message = 'السجل غير موجود') {
30
+ return new AdulaError(404, 'E_NOT_FOUND', message);
31
+ }
32
+ /** 403 E_FIELD_FORBIDDEN: a field the actor may not read, query or write. */
33
+ export function forbiddenField(message) {
34
+ return new AdulaError(403, 'E_FIELD_FORBIDDEN', message);
35
+ }
36
+ /** 422 E_FILTER: an unsupported or invalid filter. */
37
+ export function invalidFilter(message) {
38
+ return new AdulaError(422, 'E_FILTER', message);
39
+ }
40
+ /** 403 E_SEARCH: full-text search is not available to the actor. */
41
+ export function searchUnavailable() {
42
+ return new AdulaError(403, 'E_SEARCH', 'Search is unavailable');
43
+ }
44
+ /** 422 E_CURSOR: a malformed or mismatched pagination cursor. */
45
+ export function invalidCursor() {
46
+ return new AdulaError(422, 'E_CURSOR', 'Invalid cursor');
47
+ }
48
+ /** 409 E_DOCUMENT_LOCKED: a submitted or cancelled document cannot change this way. */
49
+ export function documentLocked(message = 'Only draft documents can be edited') {
50
+ return new AdulaError(409, 'E_DOCUMENT_LOCKED', message);
51
+ }
52
+ /** 409 E_DOCUMENT_STATE: the document is not in a state that allows the transition. */
53
+ export function invalidDocumentState(message) {
54
+ return new AdulaError(409, 'E_DOCUMENT_STATE', message);
55
+ }
56
+ /** 422 E_REQUIRED: a required field has no value. */
57
+ export function requiredField(key) {
58
+ return new AdulaError(422, 'E_REQUIRED', `Required field: ${key}`);
59
+ }
60
+ /** 422 E_ACTOR: a system write without the author it needs. */
61
+ export function missingActor(message) {
62
+ return new AdulaError(422, 'E_ACTOR', message);
63
+ }
64
+ /** 422 E_INLINE: malformed inline rows. */
65
+ export function invalidInline(message) {
66
+ return new AdulaError(422, 'E_INLINE', message);
67
+ }
68
+ /** 422 E_INLINE_SCOPE: inline rows and their parent must share one organization unit. */
69
+ export function inlineScope(message) {
70
+ return new AdulaError(422, 'E_INLINE_SCOPE', message);
71
+ }
@@ -1,8 +1,9 @@
1
- import type { Action, Field } from '../resource/types.js';
1
+ import type { Action, Field, Label } from '../resource/types.js';
2
2
  export type ResourceField = Field & {
3
3
  key: string;
4
4
  };
5
- export type RecordPermissions = Partial<Record<Action, boolean>>;
5
+ /** Per-record permissions; `restore` appears on rows of a trashed list (ADR 046). */
6
+ export type RecordPermissions = Partial<Record<Action | 'restore', boolean>>;
6
7
  export type ResourceDescription = {
7
8
  name: string;
8
9
  label: string;
@@ -17,6 +18,24 @@ export type ResourceDescription = {
17
18
  canCreate: boolean;
18
19
  scoped: boolean;
19
20
  submittable: boolean;
21
+ /**
22
+ * Whether the actor may open «المحذوفات» (the trashed list) and restore records: the
23
+ * resource offers delete and the actor holds it (ADR 046). Optional for compatibility
24
+ * with descriptions built by older code.
25
+ */
26
+ trash?: boolean;
27
+ /** The list can be exported as CSV through GET …/export (ADR 046). */
28
+ exportable?: boolean;
29
+ /** Whether GET …/bulk may offer any action to this actor; the list decides each action. */
30
+ bulk?: boolean;
31
+ /**
32
+ * Print templates declared in code (ADR 048); present only when the resource has some.
33
+ * GET …/print-templates also lists administrator templates.
34
+ */
35
+ printTemplates?: {
36
+ key: string;
37
+ label: Label;
38
+ }[];
20
39
  };
21
40
  export type ResourceNavigation = {
22
41
  name: string;
@@ -0,0 +1,60 @@
1
+ import type { SerializedRecord } from '../../resource/types.js';
2
+ import { type Actor } from '../../auth/ability.js';
3
+ import type { ResourceField } from '../presentation.js';
4
+ import { type ResourceContext } from './shared.js';
5
+ /** Options of relationOptions(). */
6
+ export type RelationOptionsRequest = {
7
+ id?: number;
8
+ search?: string;
9
+ cursor?: string;
10
+ /** User fields: the organization unit chosen in the form. */
11
+ orgUnitId?: number;
12
+ /** User fields: choices for a list filter instead of a form. */
13
+ purpose?: 'form' | 'filter';
14
+ };
15
+ /** The form description for create (no id) or update; see ResourceService.editor. */
16
+ export declare function editor(ctx: ResourceContext, name: string, actor: Actor, id?: number, request?: {
17
+ defaults?: Record<string, unknown>;
18
+ }): Promise<{
19
+ mode: string;
20
+ name: string;
21
+ label: string;
22
+ recordLabel: string | null;
23
+ fields: ResourceField[];
24
+ /** Initial values of a create form, already checked against the actor's access. */
25
+ defaults: SerializedRecord;
26
+ inline: Record<string, {
27
+ rows: SerializedRecord[];
28
+ hasMore: boolean;
29
+ canCreate: boolean;
30
+ permissions: Record<string, {
31
+ update: boolean;
32
+ delete: boolean;
33
+ }>;
34
+ fields: ResourceField[];
35
+ createFields: string[];
36
+ updateFields: Record<string, string[]>;
37
+ }>;
38
+ options: Record<string, {
39
+ value: string;
40
+ label: string;
41
+ avatarUrl?: string | null;
42
+ }[]>;
43
+ relationSearch: Record<string, boolean>;
44
+ orgUnits: {
45
+ value: string;
46
+ label: string;
47
+ }[];
48
+ scoped: boolean;
49
+ /** The belongsTo field whose record decides the unit; the form shows no unit picker. */
50
+ scopeFrom: string | null;
51
+ record: SerializedRecord | null;
52
+ }>;
53
+ /** Choices of a belongsTo or user field in a form or filter; see ResourceService.relationOptions. */
54
+ export declare function relationOptions(ctx: ResourceContext, name: string, key: string, actor: Actor, options?: RelationOptionsRequest): Promise<{
55
+ data: {
56
+ value: string;
57
+ label: string;
58
+ }[];
59
+ nextCursor: string | null;
60
+ }>;