@aeolus-fleet/core 0.30.1 → 0.32.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 (323) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/prisma/defined-scopes.d.ts +4 -0
  3. package/dist/adapters/prisma/defined-scopes.js +23 -0
  4. package/dist/adapters/prisma/defined-scopes.js.map +1 -0
  5. package/dist/adapters/prisma/delivery-notices.d.ts +3 -0
  6. package/dist/adapters/prisma/delivery-notices.js +7 -2
  7. package/dist/adapters/prisma/delivery-notices.js.map +1 -1
  8. package/dist/adapters/prisma/fleet-limit-settings.d.ts +6 -0
  9. package/dist/adapters/prisma/fleet-limit-settings.js +17 -0
  10. package/dist/adapters/prisma/fleet-limit-settings.js.map +1 -0
  11. package/dist/adapters/prisma/generated/browser.d.ts +35 -4
  12. package/dist/adapters/prisma/generated/client.d.ts +35 -4
  13. package/dist/adapters/prisma/generated/commonInputTypes.d.ts +226 -46
  14. package/dist/adapters/prisma/generated/enums.d.ts +38 -0
  15. package/dist/adapters/prisma/generated/enums.js +33 -1
  16. package/dist/adapters/prisma/generated/enums.js.map +1 -1
  17. package/dist/adapters/prisma/generated/internal/class.d.ts +55 -0
  18. package/dist/adapters/prisma/generated/internal/class.js +4 -4
  19. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  20. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +524 -1
  21. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +96 -1
  22. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
  23. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +100 -0
  24. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +96 -1
  25. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
  26. package/dist/adapters/prisma/generated/models/DefinedScope.d.ts +1110 -0
  27. package/dist/adapters/prisma/generated/models/DefinedScope.js +2 -0
  28. package/dist/adapters/prisma/generated/models/DefinedScope.js.map +1 -0
  29. package/dist/adapters/prisma/generated/models/Delivery.d.ts +1 -10
  30. package/dist/adapters/prisma/generated/models/Fleet.d.ts +3291 -100
  31. package/dist/adapters/prisma/generated/models/InstallationSettings.d.ts +108 -4
  32. package/dist/adapters/prisma/generated/models/Meeting.d.ts +2520 -0
  33. package/dist/adapters/prisma/generated/models/Meeting.js +2 -0
  34. package/dist/adapters/prisma/generated/models/Meeting.js.map +1 -0
  35. package/dist/adapters/prisma/generated/models/MeetingMicRequest.d.ts +1398 -0
  36. package/dist/adapters/prisma/generated/models/MeetingMicRequest.js +2 -0
  37. package/dist/adapters/prisma/generated/models/MeetingMicRequest.js.map +1 -0
  38. package/dist/adapters/prisma/generated/models/MeetingParticipant.d.ts +1630 -0
  39. package/dist/adapters/prisma/generated/models/MeetingParticipant.js +2 -0
  40. package/dist/adapters/prisma/generated/models/MeetingParticipant.js.map +1 -0
  41. package/dist/adapters/prisma/generated/models/Message.d.ts +664 -350
  42. package/dist/adapters/prisma/generated/models/Schedule.d.ts +3925 -0
  43. package/dist/adapters/prisma/generated/models/Schedule.js +2 -0
  44. package/dist/adapters/prisma/generated/models/Schedule.js.map +1 -0
  45. package/dist/adapters/prisma/generated/models/Ship.d.ts +2497 -67
  46. package/dist/adapters/prisma/generated/models.d.ts +5 -0
  47. package/dist/adapters/prisma/history-pruner.d.ts +3 -0
  48. package/dist/adapters/prisma/history-pruner.js +232 -0
  49. package/dist/adapters/prisma/history-pruner.js.map +1 -0
  50. package/dist/adapters/prisma/history.js +72 -17
  51. package/dist/adapters/prisma/history.js.map +1 -1
  52. package/dist/adapters/prisma/installation.js +27 -8
  53. package/dist/adapters/prisma/installation.js.map +1 -1
  54. package/dist/adapters/prisma/meetings.d.ts +4 -0
  55. package/dist/adapters/prisma/meetings.js +103 -0
  56. package/dist/adapters/prisma/meetings.js.map +1 -0
  57. package/dist/adapters/prisma/messaging.js +8 -3
  58. package/dist/adapters/prisma/messaging.js.map +1 -1
  59. package/dist/adapters/prisma/registry.js +35 -9
  60. package/dist/adapters/prisma/registry.js.map +1 -1
  61. package/dist/adapters/prisma/rows.js +14 -1
  62. package/dist/adapters/prisma/rows.js.map +1 -1
  63. package/dist/adapters/prisma/schedules.d.ts +12 -0
  64. package/dist/adapters/prisma/schedules.js +255 -0
  65. package/dist/adapters/prisma/schedules.js.map +1 -0
  66. package/dist/adapters/prisma/unit-of-work.d.ts +8 -2
  67. package/dist/adapters/prisma/unit-of-work.js +9 -0
  68. package/dist/adapters/prisma/unit-of-work.js.map +1 -1
  69. package/dist/adapters/trpc/console.d.ts +1 -1
  70. package/dist/adapters/trpc/console.js +3 -6
  71. package/dist/adapters/trpc/console.js.map +1 -1
  72. package/dist/adapters/trpc/context.d.ts +30 -0
  73. package/dist/adapters/trpc/fleet.d.ts +233 -19
  74. package/dist/adapters/trpc/fleet.js +111 -11
  75. package/dist/adapters/trpc/fleet.js.map +1 -1
  76. package/dist/adapters/trpc/installation.d.ts +139 -4
  77. package/dist/adapters/trpc/installation.js +4 -4
  78. package/dist/adapters/trpc/installation.js.map +1 -1
  79. package/dist/adapters/trpc/router.d.ts +718 -19
  80. package/dist/adapters/trpc/schedule-output.d.ts +74 -0
  81. package/dist/adapters/trpc/schedule-output.js +71 -0
  82. package/dist/adapters/trpc/schedule-output.js.map +1 -0
  83. package/dist/adapters/trpc/ship-contract.js +7 -0
  84. package/dist/adapters/trpc/ship-contract.js.map +1 -1
  85. package/dist/adapters/trpc/ship-protocol.js +2 -1
  86. package/dist/adapters/trpc/ship-protocol.js.map +1 -1
  87. package/dist/adapters/trpc/ship.d.ts +397 -3
  88. package/dist/adapters/trpc/ship.js +323 -11
  89. package/dist/adapters/trpc/ship.js.map +1 -1
  90. package/dist/adapters/trpc/starting-prompt-text.js +5 -5
  91. package/dist/adapters/trpc/starting-prompt-text.js.map +1 -1
  92. package/dist/adapters/trpc/trpc.d.ts +8 -0
  93. package/dist/adapters/trpc/trpc.js +38 -2
  94. package/dist/adapters/trpc/trpc.js.map +1 -1
  95. package/dist/app.d.ts +5 -3
  96. package/dist/app.js +33 -5
  97. package/dist/app.js.map +1 -1
  98. package/dist/domain/messaging/add-to-meeting.d.ts +41 -0
  99. package/dist/domain/messaging/add-to-meeting.js +76 -0
  100. package/dist/domain/messaging/add-to-meeting.js.map +1 -0
  101. package/dist/domain/messaging/answer.d.ts +2 -1
  102. package/dist/domain/messaging/answer.js +3 -2
  103. package/dist/domain/messaging/answer.js.map +1 -1
  104. package/dist/domain/messaging/cancel-schedule.d.ts +35 -0
  105. package/dist/domain/messaging/cancel-schedule.js +45 -0
  106. package/dist/domain/messaging/cancel-schedule.js.map +1 -0
  107. package/dist/domain/messaging/change-meeting.d.ts +32 -0
  108. package/dist/domain/messaging/change-meeting.js +35 -0
  109. package/dist/domain/messaging/change-meeting.js.map +1 -0
  110. package/dist/domain/messaging/change-mic.d.ts +30 -0
  111. package/dist/domain/messaging/change-mic.js +27 -0
  112. package/dist/domain/messaging/change-mic.js.map +1 -0
  113. package/dist/domain/messaging/check-reach-to-each.d.ts +25 -0
  114. package/dist/domain/messaging/check-reach-to-each.js +21 -0
  115. package/dist/domain/messaging/check-reach-to-each.js.map +1 -0
  116. package/dist/domain/messaging/cron.d.ts +46 -0
  117. package/dist/domain/messaging/cron.js +164 -0
  118. package/dist/domain/messaging/cron.js.map +1 -0
  119. package/dist/domain/messaging/daily-message-limit.d.ts +7 -5
  120. package/dist/domain/messaging/daily-message-limit.js +8 -7
  121. package/dist/domain/messaging/daily-message-limit.js.map +1 -1
  122. package/dist/domain/messaging/dismiss-delivery.js +2 -1
  123. package/dist/domain/messaging/dismiss-delivery.js.map +1 -1
  124. package/dist/domain/messaging/list-schedules.d.ts +38 -0
  125. package/dist/domain/messaging/list-schedules.js +33 -0
  126. package/dist/domain/messaging/list-schedules.js.map +1 -0
  127. package/dist/domain/messaging/meeting-life.d.ts +76 -0
  128. package/dist/domain/messaging/meeting-life.js +136 -0
  129. package/dist/domain/messaging/meeting-life.js.map +1 -0
  130. package/dist/domain/messaging/meeting-notice.d.ts +58 -0
  131. package/dist/domain/messaging/meeting-notice.js +87 -0
  132. package/dist/domain/messaging/meeting-notice.js.map +1 -0
  133. package/dist/domain/messaging/meeting.d.ts +103 -0
  134. package/dist/domain/messaging/meeting.js +106 -0
  135. package/dist/domain/messaging/meeting.js.map +1 -0
  136. package/dist/domain/messaging/message.d.ts +68 -4
  137. package/dist/domain/messaging/message.js +163 -10
  138. package/dist/domain/messaging/message.js.map +1 -1
  139. package/dist/domain/messaging/mic.d.ts +64 -0
  140. package/dist/domain/messaging/mic.js +130 -0
  141. package/dist/domain/messaging/mic.js.map +1 -0
  142. package/dist/domain/messaging/open-meeting.d.ts +61 -0
  143. package/dist/domain/messaging/open-meeting.js +98 -0
  144. package/dist/domain/messaging/open-meeting.js.map +1 -0
  145. package/dist/domain/messaging/pause-schedule.d.ts +34 -0
  146. package/dist/domain/messaging/pause-schedule.js +44 -0
  147. package/dist/domain/messaging/pause-schedule.js.map +1 -0
  148. package/dist/domain/messaging/ports.d.ts +121 -3
  149. package/dist/domain/messaging/public.d.ts +4 -0
  150. package/dist/domain/messaging/public.js +2 -0
  151. package/dist/domain/messaging/public.js.map +1 -1
  152. package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -1
  153. package/dist/domain/messaging/push-receive-deliveries.js +5 -2
  154. package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
  155. package/dist/domain/messaging/read-meeting.d.ts +67 -0
  156. package/dist/domain/messaging/read-meeting.js +61 -0
  157. package/dist/domain/messaging/read-meeting.js.map +1 -0
  158. package/dist/domain/messaging/receive-deliveries.d.ts +6 -1
  159. package/dist/domain/messaging/receive-deliveries.js +3 -0
  160. package/dist/domain/messaging/receive-deliveries.js.map +1 -1
  161. package/dist/domain/messaging/resend-delivery.js +5 -4
  162. package/dist/domain/messaging/resend-delivery.js.map +1 -1
  163. package/dist/domain/messaging/resume-schedule.d.ts +34 -0
  164. package/dist/domain/messaging/resume-schedule.js +37 -0
  165. package/dist/domain/messaging/resume-schedule.js.map +1 -0
  166. package/dist/domain/messaging/retired-participant.d.ts +36 -0
  167. package/dist/domain/messaging/retired-participant.js +38 -0
  168. package/dist/domain/messaging/retired-participant.js.map +1 -0
  169. package/dist/domain/messaging/retired-scheduler.d.ts +31 -0
  170. package/dist/domain/messaging/retired-scheduler.js +30 -0
  171. package/dist/domain/messaging/retired-scheduler.js.map +1 -0
  172. package/dist/domain/messaging/schedule-access.d.ts +20 -0
  173. package/dist/domain/messaging/schedule-access.js +21 -0
  174. package/dist/domain/messaging/schedule-access.js.map +1 -0
  175. package/dist/domain/messaging/schedule-limits.d.ts +25 -0
  176. package/dist/domain/messaging/schedule-limits.js +51 -0
  177. package/dist/domain/messaging/schedule-limits.js.map +1 -0
  178. package/dist/domain/messaging/schedule-message.d.ts +65 -0
  179. package/dist/domain/messaging/schedule-message.js +151 -0
  180. package/dist/domain/messaging/schedule-message.js.map +1 -0
  181. package/dist/domain/messaging/schedule.d.ts +238 -0
  182. package/dist/domain/messaging/schedule.js +316 -0
  183. package/dist/domain/messaging/schedule.js.map +1 -0
  184. package/dist/domain/messaging/send-due-schedules.d.ts +40 -0
  185. package/dist/domain/messaging/send-due-schedules.js +141 -0
  186. package/dist/domain/messaging/send-due-schedules.js.map +1 -0
  187. package/dist/domain/messaging/send-message.d.ts +18 -5
  188. package/dist/domain/messaging/send-message.js +149 -4
  189. package/dist/domain/messaging/send-message.js.map +1 -1
  190. package/dist/domain/messaging/send-request.d.ts +3 -2
  191. package/dist/domain/messaging/send-request.js +7 -2
  192. package/dist/domain/messaging/send-request.js.map +1 -1
  193. package/dist/domain/registry/applied-limits.d.ts +5 -7
  194. package/dist/domain/registry/applied-limits.js +5 -9
  195. package/dist/domain/registry/applied-limits.js.map +1 -1
  196. package/dist/domain/registry/check-manage.d.ts +23 -0
  197. package/dist/domain/registry/check-manage.js +19 -0
  198. package/dist/domain/registry/check-manage.js.map +1 -0
  199. package/dist/domain/registry/commission-ship.js +3 -3
  200. package/dist/domain/registry/commission-ship.js.map +1 -1
  201. package/dist/domain/registry/declare-scopes.d.ts +5 -3
  202. package/dist/domain/registry/declare-scopes.js +4 -2
  203. package/dist/domain/registry/declare-scopes.js.map +1 -1
  204. package/dist/domain/registry/define-scope.d.ts +33 -0
  205. package/dist/domain/registry/define-scope.js +30 -0
  206. package/dist/domain/registry/define-scope.js.map +1 -0
  207. package/dist/domain/registry/defined-scope.d.ts +68 -0
  208. package/dist/domain/registry/defined-scope.js +83 -0
  209. package/dist/domain/registry/defined-scope.js.map +1 -0
  210. package/dist/domain/registry/describe-scope.d.ts +31 -0
  211. package/dist/domain/registry/describe-scope.js +28 -0
  212. package/dist/domain/registry/describe-scope.js.map +1 -0
  213. package/dist/domain/registry/get-fleet-limits.d.ts +1 -1
  214. package/dist/domain/registry/get-fleet-limits.js +1 -1
  215. package/dist/domain/registry/get-fleet-limits.js.map +1 -1
  216. package/dist/domain/registry/grant-scopes.d.ts +4 -3
  217. package/dist/domain/registry/grant-scopes.js +4 -4
  218. package/dist/domain/registry/grant-scopes.js.map +1 -1
  219. package/dist/domain/registry/installation-fleet.d.ts +4 -1
  220. package/dist/domain/registry/installation-fleet.js +9 -2
  221. package/dist/domain/registry/installation-fleet.js.map +1 -1
  222. package/dist/domain/registry/label-value-texts.d.ts +16 -0
  223. package/dist/domain/registry/label-value-texts.js +15 -0
  224. package/dist/domain/registry/label-value-texts.js.map +1 -0
  225. package/dist/domain/registry/limits.d.ts +42 -7
  226. package/dist/domain/registry/limits.js +41 -6
  227. package/dist/domain/registry/limits.js.map +1 -1
  228. package/dist/domain/registry/list-scopes.d.ts +13 -6
  229. package/dist/domain/registry/list-scopes.js +15 -6
  230. package/dist/domain/registry/list-scopes.js.map +1 -1
  231. package/dist/domain/registry/named-namespaces.d.ts +18 -8
  232. package/dist/domain/registry/named-namespaces.js +11 -3
  233. package/dist/domain/registry/named-namespaces.js.map +1 -1
  234. package/dist/domain/registry/ports.d.ts +22 -0
  235. package/dist/domain/registry/public.d.ts +4 -1
  236. package/dist/domain/registry/public.js +4 -1
  237. package/dist/domain/registry/public.js.map +1 -1
  238. package/dist/domain/registry/read-built-in-rules.d.ts +2 -1
  239. package/dist/domain/registry/read-built-in-rules.js +3 -1
  240. package/dist/domain/registry/read-built-in-rules.js.map +1 -1
  241. package/dist/domain/registry/remove-scope.d.ts +29 -0
  242. package/dist/domain/registry/remove-scope.js +32 -0
  243. package/dist/domain/registry/remove-scope.js.map +1 -0
  244. package/dist/domain/registry/resolve-invitees.d.ts +27 -0
  245. package/dist/domain/registry/resolve-invitees.js +27 -0
  246. package/dist/domain/registry/resolve-invitees.js.map +1 -0
  247. package/dist/domain/registry/resolve-label-selection.d.ts +20 -0
  248. package/dist/domain/registry/resolve-label-selection.js +26 -0
  249. package/dist/domain/registry/resolve-label-selection.js.map +1 -0
  250. package/dist/domain/registry/resolve-selector.d.ts +2 -2
  251. package/dist/domain/registry/resolve-selector.js.map +1 -1
  252. package/dist/domain/registry/retire-ship.d.ts +11 -3
  253. package/dist/domain/registry/retire-ship.js +15 -1
  254. package/dist/domain/registry/retire-ship.js.map +1 -1
  255. package/dist/domain/registry/scope-grant.d.ts +6 -2
  256. package/dist/domain/registry/scope-grant.js +9 -5
  257. package/dist/domain/registry/scope-grant.js.map +1 -1
  258. package/dist/domain/registry/scope-namespace.d.ts +5 -1
  259. package/dist/domain/registry/scope-namespace.js +9 -2
  260. package/dist/domain/registry/scope-namespace.js.map +1 -1
  261. package/dist/domain/registry/set-fleet-limits.d.ts +8 -5
  262. package/dist/domain/registry/set-fleet-limits.js +38 -6
  263. package/dist/domain/registry/set-fleet-limits.js.map +1 -1
  264. package/dist/domain/registry/set-installation-settings.d.ts +4 -4
  265. package/dist/domain/registry/set-installation-settings.js +21 -15
  266. package/dist/domain/registry/set-installation-settings.js.map +1 -1
  267. package/dist/domain/registry/ship.d.ts +2 -0
  268. package/dist/domain/registry/ship.js +1 -1
  269. package/dist/domain/registry/ship.js.map +1 -1
  270. package/dist/domain/shared/close-health-snapshots.d.ts +5 -2
  271. package/dist/domain/shared/close-health-snapshots.js +12 -6
  272. package/dist/domain/shared/close-health-snapshots.js.map +1 -1
  273. package/dist/domain/shared/delivery-way.d.ts +4 -0
  274. package/dist/domain/shared/delivery-way.js +5 -2
  275. package/dist/domain/shared/delivery-way.js.map +1 -1
  276. package/dist/domain/shared/errors.d.ts +1 -1
  277. package/dist/domain/shared/errors.js.map +1 -1
  278. package/dist/domain/shared/history-pruning.d.ts +130 -0
  279. package/dist/domain/shared/history-pruning.js +74 -0
  280. package/dist/domain/shared/history-pruning.js.map +1 -0
  281. package/dist/domain/shared/history.d.ts +41 -5
  282. package/dist/domain/shared/history.js +19 -2
  283. package/dist/domain/shared/history.js.map +1 -1
  284. package/dist/domain/shared/prune-history.d.ts +39 -0
  285. package/dist/domain/shared/prune-history.js +98 -0
  286. package/dist/domain/shared/prune-history.js.map +1 -0
  287. package/dist/domain/shared/read-fleet-limits.d.ts +14 -4
  288. package/dist/domain/shared/read-fleet-limits.js +8 -4
  289. package/dist/domain/shared/read-fleet-limits.js.map +1 -1
  290. package/dist/domain/shared/read-message-deliveries.d.ts +30 -0
  291. package/dist/domain/shared/read-message-deliveries.js +24 -0
  292. package/dist/domain/shared/read-message-deliveries.js.map +1 -0
  293. package/dist/domain/shared/read-message.d.ts +4 -1
  294. package/dist/domain/shared/read-message.js +3 -2
  295. package/dist/domain/shared/read-message.js.map +1 -1
  296. package/dist/domain/shared/read-sent-message.d.ts +21 -7
  297. package/dist/domain/shared/read-sent-message.js +19 -6
  298. package/dist/domain/shared/read-sent-message.js.map +1 -1
  299. package/dist/domain/shared/selector.d.ts +32 -11
  300. package/dist/schedule-timer.d.ts +22 -0
  301. package/dist/schedule-timer.js +78 -0
  302. package/dist/schedule-timer.js.map +1 -0
  303. package/dist/wiring.d.ts +36 -0
  304. package/dist/wiring.js +38 -2
  305. package/dist/wiring.js.map +1 -1
  306. package/package.json +2 -2
  307. package/src/adapters/prisma/migrations/20261024160000_meetings/migration.sql +86 -0
  308. package/src/adapters/prisma/migrations/20261024160100_meetings_open_scope/migration.sql +64 -0
  309. package/src/adapters/prisma/migrations/20261024160200_meetings_mic/migration.sql +35 -0
  310. package/src/adapters/prisma/migrations/20261024160300_meetings_life/migration.sql +6 -0
  311. package/src/adapters/prisma/migrations/20261025090000_scheduled_messages_envelope/migration.sql +5 -0
  312. package/src/adapters/prisma/migrations/20261025090100_schedules/migration.sql +109 -0
  313. package/src/adapters/prisma/migrations/20261025120000_repeating_schedules/migration.sql +40 -0
  314. package/src/adapters/prisma/migrations/20261025130000_schedule_limits/migration.sql +11 -0
  315. package/src/adapters/prisma/migrations/20261025140000_send_to_a_label/migration.sql +16 -0
  316. package/src/adapters/prisma/migrations/20261025150000_define_scope/migration.sql +64 -0
  317. package/src/adapters/prisma/migrations/20261025150100_defined_scopes/migration.sql +15 -0
  318. package/src/adapters/prisma/migrations/20261025160000_retention/migration.sql +7 -0
  319. package/src/adapters/prisma/migrations/20261025170000_message_deliveries_page/migration.sql +7 -0
  320. package/src/adapters/prisma/migrations/20261025180000_history_pruning/migration.sql +25 -0
  321. package/src/adapters/prisma/migrations/20261025190000_history_pruning_crew_events/migration.sql +2 -0
  322. package/src/adapters/prisma/migrations/20261025200000_schedule_to_a_label/migration.sql +12 -0
  323. package/src/adapters/prisma/schema.prisma +383 -131
@@ -2,17 +2,24 @@ import type { FleetId } from '@aeolus-fleet/common';
2
2
  import { type DomainError } from '../shared/errors.js';
3
3
  import { type Result } from '../shared/result.js';
4
4
  /**
5
- * The installation's settings (docs/blueprint.md, "Installation"): the ship
6
- * and daily message limits a fleet follows unless set for it, and the cap on
7
- * the number of fleets. Null is no limit. Aeolus sets none of its own: these
8
- * are whoever runs the installation's (decision 0016).
5
+ * The installation's settings (docs/blueprint.md, "Installation"): the ship,
6
+ * daily message and schedule limits and the retention a fleet follows unless
7
+ * set for it, and the cap on the number of fleets. Null is no limit, and for
8
+ * the retention kept for good. Aeolus sets none of its own: these are
9
+ * whoever runs the installation's (decisions 0016, 0066).
9
10
  */
10
11
  export interface InstallationSettings {
11
12
  defaultShipLimit: number | null;
12
13
  defaultDailyMessageLimit: number | null;
14
+ /** The schedules a ship may hold active or paused (decision 0062, S12). */
15
+ defaultSchedulesPerShipLimit: number | null;
16
+ /** The shortest time between two send times of a repeating schedule, in seconds (decision 0062, S12). */
17
+ defaultMinimumScheduleInterval: number | null;
18
+ /** The days a fleet keeps its finished history (decision 0066). */
19
+ defaultRetentionDays: number | null;
13
20
  fleetCap: number | null;
14
21
  }
15
- /** An installation that has set nothing: no limit anywhere, as a self-hosted server runs. */
22
+ /** An installation that has set nothing: no limit anywhere and everything kept, as a self-hosted server runs. */
16
23
  export declare const NO_INSTALLATION_SETTINGS: InstallationSettings;
17
24
  /** How one of a fleet's limits is set: it follows the installation default, or is set for the fleet to a number or to no limit. */
18
25
  export type FleetLimitSetting = {
@@ -21,25 +28,53 @@ export type FleetLimitSetting = {
21
28
  kind: 'fleet';
22
29
  limit: number | null;
23
30
  };
24
- /** How a fleet's ship and daily message limits are set. */
31
+ /** How a fleet's retention is set: it follows the installation default, or is set for the fleet to a number of days or to none (kept for good). */
32
+ export type RetentionSetting = {
33
+ kind: 'default';
34
+ } | {
35
+ kind: 'fleet';
36
+ days: number | null;
37
+ };
38
+ /** How a fleet's limits and its retention are set. */
25
39
  export interface FleetLimitSettings {
26
40
  ships: FleetLimitSetting;
27
41
  dailyMessages: FleetLimitSetting;
42
+ schedulesPerShip: FleetLimitSetting;
43
+ minimumScheduleInterval: FleetLimitSetting;
44
+ retention: RetentionSetting;
28
45
  }
29
- /** A fleet that has set nothing for itself: both limits follow the installation defaults. */
46
+ /** A fleet that has set nothing for itself: every limit and the retention follow the installation default. */
30
47
  export declare const FOLLOWING_DEFAULTS: FleetLimitSettings;
31
48
  /** One of a fleet's limits: how it is set, and the limit that applies (null: none). */
32
49
  export interface FleetLimit {
33
50
  setting: FleetLimitSetting;
34
51
  applies: number | null;
35
52
  }
53
+ /** A fleet's retention: how it is set, and the days that apply (null: kept for good). */
54
+ export interface FleetRetention {
55
+ setting: RetentionSetting;
56
+ applies: number | null;
57
+ }
36
58
  export interface FleetLimits {
37
59
  fleetId: FleetId;
38
60
  ships: FleetLimit;
39
61
  dailyMessages: FleetLimit;
62
+ schedulesPerShip: FleetLimit;
63
+ minimumScheduleInterval: FleetLimit;
64
+ retention: FleetRetention;
40
65
  }
66
+ /** The limit that applies to the fleet now for each of its limits, and the retention in days; null where none applies. */
67
+ export type AppliedLimits = {
68
+ [Name in keyof FleetLimitSettings]: number | null;
69
+ };
70
+ /** The limits a fleet applies from how it set them and the installation's defaults. */
71
+ export declare function appliedLimitsOf(settings: FleetLimitSettings, installation: InstallationSettings): AppliedLimits;
41
72
  /** A limit as configured: a whole number of at least 0, or null for no limit. */
42
73
  export declare function limit(raw: number | null): Result<number | null, DomainError<'INVALID_LIMIT'>>;
74
+ /** A retention as configured: a whole number of days of at least 1, or null for kept for good; no other minimum or maximum (decision 0066). */
75
+ export declare function retentionDays(raw: number | null): Result<number | null, DomainError<'INVALID_RETENTION'>>;
76
+ /** The days a retention setting gives: its own when set for the fleet, else the installation default. */
77
+ export declare function appliedRetention(setting: RetentionSetting, defaultDays: number | null): number | null;
43
78
  /** The limit a setting gives: its own when set for the fleet, else the installation default. */
44
79
  export declare function appliedLimit(setting: FleetLimitSetting, defaultLimit: number | null): number | null;
45
80
  /** A fleet's limits from how it set them and the installation's defaults. */
@@ -1,13 +1,44 @@
1
1
  import { refuse } from '../shared/errors.js';
2
2
  import { ok } from '../shared/result.js';
3
- /** An installation that has set nothing: no limit anywhere, as a self-hosted server runs. */
4
- export const NO_INSTALLATION_SETTINGS = { defaultShipLimit: null, defaultDailyMessageLimit: null, fleetCap: null };
5
- /** A fleet that has set nothing for itself: both limits follow the installation defaults. */
6
- export const FOLLOWING_DEFAULTS = { ships: { kind: 'default' }, dailyMessages: { kind: 'default' } };
3
+ /** An installation that has set nothing: no limit anywhere and everything kept, as a self-hosted server runs. */
4
+ export const NO_INSTALLATION_SETTINGS = {
5
+ defaultShipLimit: null,
6
+ defaultDailyMessageLimit: null,
7
+ defaultSchedulesPerShipLimit: null,
8
+ defaultMinimumScheduleInterval: null,
9
+ defaultRetentionDays: null,
10
+ fleetCap: null,
11
+ };
12
+ /** A fleet that has set nothing for itself: every limit and the retention follow the installation default. */
13
+ export const FOLLOWING_DEFAULTS = {
14
+ ships: { kind: 'default' },
15
+ dailyMessages: { kind: 'default' },
16
+ schedulesPerShip: { kind: 'default' },
17
+ minimumScheduleInterval: { kind: 'default' },
18
+ retention: { kind: 'default' },
19
+ };
20
+ /** The limits a fleet applies from how it set them and the installation's defaults. */
21
+ export function appliedLimitsOf(settings, installation) {
22
+ return {
23
+ ships: appliedLimit(settings.ships, installation.defaultShipLimit),
24
+ dailyMessages: appliedLimit(settings.dailyMessages, installation.defaultDailyMessageLimit),
25
+ schedulesPerShip: appliedLimit(settings.schedulesPerShip, installation.defaultSchedulesPerShipLimit),
26
+ minimumScheduleInterval: appliedLimit(settings.minimumScheduleInterval, installation.defaultMinimumScheduleInterval),
27
+ retention: appliedRetention(settings.retention, installation.defaultRetentionDays),
28
+ };
29
+ }
7
30
  /** A limit as configured: a whole number of at least 0, or null for no limit. */
8
31
  export function limit(raw) {
9
32
  return raw === null || (Number.isInteger(raw) && raw >= 0) ? ok(raw) : refuse('INVALID_LIMIT', 'A limit is a whole number of at least 0, or none');
10
33
  }
34
+ /** A retention as configured: a whole number of days of at least 1, or null for kept for good; no other minimum or maximum (decision 0066). */
35
+ export function retentionDays(raw) {
36
+ return raw === null || (Number.isInteger(raw) && raw >= 1) ? ok(raw) : refuse('INVALID_RETENTION', 'A retention is a whole number of days of at least 1, or none');
37
+ }
38
+ /** The days a retention setting gives: its own when set for the fleet, else the installation default. */
39
+ export function appliedRetention(setting, defaultDays) {
40
+ return setting.kind === 'fleet' ? setting.days : defaultDays;
41
+ }
11
42
  /** The limit a setting gives: its own when set for the fleet, else the installation default. */
12
43
  export function appliedLimit(setting, defaultLimit) {
13
44
  return setting.kind === 'fleet' ? setting.limit : defaultLimit;
@@ -15,10 +46,14 @@ export function appliedLimit(setting, defaultLimit) {
15
46
  /** A fleet's limits from how it set them and the installation's defaults. */
16
47
  export function fleetLimitsOf(of) {
17
48
  const { fleetId, settings, installation } = of;
49
+ const applies = appliedLimitsOf(settings, installation);
18
50
  return {
19
51
  fleetId,
20
- ships: { setting: settings.ships, applies: appliedLimit(settings.ships, installation.defaultShipLimit) },
21
- dailyMessages: { setting: settings.dailyMessages, applies: appliedLimit(settings.dailyMessages, installation.defaultDailyMessageLimit) },
52
+ ships: { setting: settings.ships, applies: applies.ships },
53
+ dailyMessages: { setting: settings.dailyMessages, applies: applies.dailyMessages },
54
+ schedulesPerShip: { setting: settings.schedulesPerShip, applies: applies.schedulesPerShip },
55
+ minimumScheduleInterval: { setting: settings.minimumScheduleInterval, applies: applies.minimumScheduleInterval },
56
+ retention: { setting: settings.retention, applies: applies.retention },
22
57
  };
23
58
  }
24
59
  //# sourceMappingURL=limits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"limits.js","sourceRoot":"","sources":["../../../src/domain/registry/limits.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AActD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,wBAAwB,GAAyB,EAAE,gBAAgB,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAWzI,6FAA6F;AAC7F,MAAM,CAAC,MAAM,kBAAkB,GAAuB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;AAczH,iFAAiF;AACjF,MAAM,UAAU,KAAK,CA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E,EAAE,OAAO,EAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,SAAS,EAAE;KACvE,CAAC;AACJ,CAAC"}
@@ -1,10 +1,15 @@
1
1
  import { type ShipId } from '@aeolus-fleet/common';
2
2
  import type { Caller } from '../shared/caller.js';
3
- import type { ScopeNamespaceRepository, ShipRepository } from './ports.js';
3
+ import type { DefinedScopeRepository, ScopeNamespaceRepository, ShipRepository } from './ports.js';
4
4
  import type { DeclaredScope } from './scope-namespace.js';
5
- /** A namespace as the fleet lists it: a core one, declared by no ship, or a plugin's, with its declarer by id and name. */
5
+ /**
6
+ * A namespace as the fleet lists it, saying whose it is: core's, declared by
7
+ * no ship; a plugin's, with its declarer by id and name; or the fleet's own
8
+ * scopes, declared by no ship (design gateway-scopes, 4.1).
9
+ */
6
10
  export interface ListedNamespace {
7
11
  namespace: string;
12
+ kind: 'core' | 'plugin' | 'fleet';
8
13
  declaredBy: {
9
14
  id: ShipId;
10
15
  name: string;
@@ -14,12 +19,14 @@ export interface ListedNamespace {
14
19
  export type ListScopes = (caller: Caller) => Promise<ListedNamespace[]>;
15
20
  /**
16
21
  * Use case: every namespace of the caller's fleet (decision 0046), for any
17
- * actor, so pagasae offers each plugin's scopes to its groups (0053): the core
18
- * namespaces first, each with its scopes in catalogue order, then each
19
- * plugin's by namespace, with its scopes as declared. The caller's scope
20
- * (fleet:read) is checked before this runs.
22
+ * actor, so pagasae offers each plugin's scopes and the fleet's own to its
23
+ * groups (0053): the core namespaces first, each with its scopes in catalogue
24
+ * order, then the plugins' and the fleet's by namespace, a plugin's scopes as
25
+ * declared and the fleet's by name. The caller's scope (fleet:read) is
26
+ * checked before this runs.
21
27
  */
22
28
  export declare function createListScopes(deps: {
23
29
  scopeNamespaces: Pick<ScopeNamespaceRepository, 'list'>;
30
+ definedScopes: Pick<DefinedScopeRepository, 'list'>;
24
31
  ships: Pick<ShipRepository, 'find'>;
25
32
  }): ListScopes;
@@ -1,23 +1,32 @@
1
1
  import { CORE_NAMESPACES, CORE_SCOPE_DESCRIPTIONS, SCOPES } from '@aeolus-fleet/common';
2
+ import { namespaceOf } from './defined-scope.js';
2
3
  /**
3
4
  * Use case: every namespace of the caller's fleet (decision 0046), for any
4
- * actor, so pagasae offers each plugin's scopes to its groups (0053): the core
5
- * namespaces first, each with its scopes in catalogue order, then each
6
- * plugin's by namespace, with its scopes as declared. The caller's scope
7
- * (fleet:read) is checked before this runs.
5
+ * actor, so pagasae offers each plugin's scopes and the fleet's own to its
6
+ * groups (0053): the core namespaces first, each with its scopes in catalogue
7
+ * order, then the plugins' and the fleet's by namespace, a plugin's scopes as
8
+ * declared and the fleet's by name. The caller's scope (fleet:read) is
9
+ * checked before this runs.
8
10
  */
9
11
  export function createListScopes(deps) {
10
12
  return async (caller) => {
11
13
  const core = CORE_NAMESPACES.map((namespace) => ({
12
14
  namespace,
15
+ kind: 'core',
13
16
  declaredBy: null,
14
17
  scopes: SCOPES.filter((scope) => scope.startsWith(`${namespace}:`)).map((scope) => ({ scope, description: CORE_SCOPE_DESCRIPTIONS[scope] })),
15
18
  }));
16
19
  const plugins = await Promise.all((await deps.scopeNamespaces.list(caller.fleetId)).map(async ({ namespace, declaredBy, scopes }) => {
17
20
  const declarer = await deps.ships.find(caller.fleetId, declaredBy);
18
- return { namespace, declaredBy: { id: declaredBy, name: declarer?.name ?? declaredBy }, scopes };
21
+ return { namespace, kind: 'plugin', declaredBy: { id: declaredBy, name: declarer?.name ?? declaredBy }, scopes };
19
22
  }));
20
- return [...core, ...plugins];
23
+ const fleet = new Map();
24
+ for (const { scope, description } of await deps.definedScopes.list(caller.fleetId)) {
25
+ const namespace = namespaceOf(scope);
26
+ fleet.set(namespace, [...(fleet.get(namespace) ?? []), { scope, description }]);
27
+ }
28
+ const others = [...plugins, ...[...fleet].map(([namespace, scopes]) => ({ namespace, kind: 'fleet', declaredBy: null, scopes }))];
29
+ return [...core, ...others.toSorted((first, second) => (first.namespace < second.namespace ? -1 : 1))];
21
30
  };
22
31
  }
23
32
  //# sourceMappingURL=list-scopes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-scopes.js","sourceRoot":"","sources":["../../../src/domain/registry/list-scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,EAAe,MAAM,sBAAsB,CAAC;AAerG;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAsG;IACrI,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAC/C,SAAS;YACT,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;SAC7I,CAAC,CAAC,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE;YAChG,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;YACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,IAAI,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC;QACnG,CAAC,CAAC,CACH,CAAC;QACF,OAAO,CA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,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,IAAI,UAAU,EAAE,EAAE,MAAM,EAAE,CAAC;QAC5H,CAAC,CAAC,CACH,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QACjD,KAAK,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YACnF,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;YACrC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,MAAM,GAAsB,CAAC,GAAG,OAAO,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9J,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzG,CAAC,CAAC;AACJ,CAAC"}
@@ -1,19 +1,29 @@
1
- import type { FleetId } from '@aeolus-fleet/common';
2
- import type { ScopeNamespaceRepository, ShipRepository } from './ports.js';
1
+ import type { FleetId, ScopeName } from '@aeolus-fleet/common';
2
+ import type { DefinedScopeRepository, ScopeNamespaceRepository, ShipRepository } from './ports.js';
3
3
  import type { ScopeNamespace } from './scope-namespace.js';
4
4
  export interface NamedNamespacesTx {
5
5
  ships: Pick<ShipRepository, 'find'>;
6
6
  scopeNamespaces: Pick<ScopeNamespaceRepository, 'lockNamespace' | 'find'>;
7
+ definedScopes: Pick<DefinedScopeRepository, 'find'>;
8
+ }
9
+ /** What the fleet holds of the namespaces some scopes name: the plugins' namespaces, and which of the scopes are the fleet's own. */
10
+ export interface NamedNamespaces {
11
+ /** The plugin namespaces the scopes name, with their declarers' names, by namespace. */
12
+ namespaces: Map<string, {
13
+ namespace: ScopeNamespace;
14
+ declarerName: string;
15
+ }>;
16
+ /** The scopes the fleet defined as its own (design gateway-scopes, 4.1). */
17
+ defined: Set<ScopeName>;
7
18
  }
8
19
  /**
9
20
  * The plugin namespaces the scopes name, with their declarers' names, by
10
- * namespace, each locked in name order: a declaration that removes one of
11
- * the scopes waits until the unit of work ends (decision 0046).
21
+ * namespace, and which of the scopes the fleet defined, each namespace
22
+ * locked in name order: a declaration that removes one of the scopes, or a
23
+ * removal of one of the fleet's, waits until the unit of work ends
24
+ * (decision 0046).
12
25
  */
13
26
  export declare function lockNamedNamespaces(tx: NamedNamespacesTx, at: {
14
27
  fleetId: FleetId;
15
28
  scopes: readonly string[];
16
- }): Promise<Map<string, {
17
- namespace: ScopeNamespace;
18
- declarerName: string;
19
- }>>;
29
+ }): Promise<NamedNamespaces>;
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * The plugin namespaces the scopes name, with their declarers' names, by
3
- * namespace, each locked in name order: a declaration that removes one of
4
- * the scopes waits until the unit of work ends (decision 0046).
3
+ * namespace, and which of the scopes the fleet defined, each namespace
4
+ * locked in name order: a declaration that removes one of the scopes, or a
5
+ * removal of one of the fleet's, waits until the unit of work ends
6
+ * (decision 0046).
5
7
  */
6
8
  export async function lockNamedNamespaces(tx, at) {
7
9
  const namespaces = new Map();
10
+ const defined = new Set();
8
11
  const named = [...new Set(at.scopes.filter((scope) => scope.includes(':')).map((scope) => scope.slice(0, scope.indexOf(':'))))].toSorted();
9
12
  for (const name of named) {
10
13
  await tx.scopeNamespaces.lockNamespace(at.fleetId, name);
@@ -14,6 +17,11 @@ export async function lockNamedNamespaces(tx, at) {
14
17
  namespaces.set(name, { namespace, declarerName: declarer?.name ?? namespace.declaredBy });
15
18
  }
16
19
  }
17
- return namespaces;
20
+ for (const scope of new Set(at.scopes.filter((each) => named.some((name) => each.startsWith(`${name}:`))))) {
21
+ if ((await tx.definedScopes.find(at.fleetId, scope)) !== undefined) {
22
+ defined.add(scope);
23
+ }
24
+ }
25
+ return { namespaces, defined };
18
26
  }
19
27
  //# sourceMappingURL=named-namespaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"named-namespaces.js","sourceRoot":"","sources":["../../../src/domain/registry/named-namespaces.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,EAAqB,EACrB,EAAmD;IAEnD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+D,CAAC;IAC1F,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3I,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzD,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClE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,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;YACvE,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,IAAI,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3G,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACjC,CAAC"}
@@ -15,6 +15,7 @@ import type { DeclaredNetworkRules } from './declared-network-rules.js';
15
15
  import type { NetworkSettings } from './network-settings.js';
16
16
  import type { NetworkRulesDraft } from './network-rules-draft.js';
17
17
  import type { ReachRefusal } from './reach-refusal.js';
18
+ import type { DefinedScope } from './defined-scope.js';
18
19
  import type { ScopeNamespace } from './scope-namespace.js';
19
20
  import type { Commissioner, Ship } from './ship.js';
20
21
  import type { ShipCounts } from './ship-counts.js';
@@ -127,6 +128,8 @@ export interface ShipRepository {
127
128
  list(fleetId: FleetId): Promise<Ship[]>;
128
129
  /** The fleet's ships that are not retired and receive, argo included, never the viewer ship (decision 0022). By id. */
129
130
  listActive(fleetId: FleetId): Promise<Ship[]>;
131
+ /** The fleet's ships that are not retired and receive, carrying every one of the label values (exact and AND, decision 0031). By id. */
132
+ listActiveCarryingEvery(fleetId: FleetId, valueIds: readonly LabelValueId[]): Promise<Ship[]>;
130
133
  /** The fleet's ships of the type that may take a type delivery: not retired, never the viewer ship. By id. */
131
134
  listActiveOfType(fleetId: FleetId, type: string): Promise<Ship[]>;
132
135
  /** Gives the ship a new name. */
@@ -159,6 +162,8 @@ export interface ShipRepository {
159
162
  listActiveHoldingInForUpdate(fleetId: FleetId, namespace: string): Promise<Ship[]>;
160
163
  /** The scopes of this plugin namespace that a ship not retired holds, each once, by name (decision 0046). */
161
164
  scopesHeldIn(fleetId: FleetId, namespace: string): Promise<ScopeName[]>;
165
+ /** How many active ships hold the scope. */
166
+ countHolding(fleetId: FleetId, scope: ScopeName): Promise<number>;
162
167
  }
163
168
  /**
164
169
  * Outbound port: the plugin namespaces of a fleet (decision 0046), one per
@@ -179,6 +184,23 @@ export interface ScopeNamespaceRepository {
179
184
  /** The namespace goes, freed for another ship. */
180
185
  remove(fleetId: FleetId, namespace: string): Promise<void>;
181
186
  }
187
+ /**
188
+ * The fleet's own scopes (design gateway-scopes, 4.1). A change holds the
189
+ * lock on the scope's namespace (ScopeNamespaceRepository.lockNamespace), so
190
+ * a definition and a plugin's declaration of one namespace wait for each other.
191
+ */
192
+ export interface DefinedScopeRepository {
193
+ /** The scope, if the fleet has it. */
194
+ find(fleetId: FleetId, scope: ScopeName): Promise<DefinedScope | undefined>;
195
+ /** Stores the scope, or its new description. */
196
+ save(defined: DefinedScope): Promise<void>;
197
+ /** The scope goes. */
198
+ remove(fleetId: FleetId, scope: ScopeName): Promise<void>;
199
+ /** Every scope of the fleet's own, by name. */
200
+ list(fleetId: FleetId): Promise<DefinedScope[]>;
201
+ /** Whether the fleet has a scope of its own in this namespace. */
202
+ usesNamespace(fleetId: FleetId, namespace: string): Promise<boolean>;
203
+ }
182
204
  /** Outbound port: leases, always within one fleet. */
183
205
  export interface LeaseRepository {
184
206
  /** The ship's open lease, locked until the unit of work ends. */
@@ -4,7 +4,10 @@ export type { FleetRepository, InFlightDeliveries, LeaseRepository, ShipReposito
4
4
  export { findPingableShip, type PingableShipTx, type UnpingableShip } from './pingable-ship.js';
5
5
  export { checkManage, checkRead, checkReach, keepingReachRefusal, type CheckManageTx, type CheckReachTx, type CheckReadTx, type NotReachable } from './check-reach.js';
6
6
  export { resolveSelector, type ResolveSelectorTx, type UnresolvableSelector } from './resolve-selector.js';
7
+ export { resolveInvitees, type Invitee, type ResolveInviteesTx } from './resolve-invitees.js';
8
+ export { resolveLabelSelection, type ResolveLabelSelectionTx } from './resolve-label-selection.js';
9
+ export { labelValueTexts, type LabelValueTextsTx } from './label-value-texts.js';
7
10
  export { findOperatorShip, findShip, findViewerShip, type FindShipTx, type ShipTx } from './ships.js';
8
- export { isConsoleShip, OPERATOR_SHIP_NAME, type Ship } from './ship.js';
11
+ export { isConsoleShip, OPERATOR_SHIP_NAME, shipStatus, type Ship } from './ship.js';
9
12
  export { appliedLimits, type AppliedLimitsTx } from './applied-limits.js';
10
13
  export { readsEvent, readsMessage, readsShip, type MessageParties, type ReadReach, type ReadReachOf } from './read-reach.js';
@@ -5,8 +5,11 @@ export { endLease, holdLease, isLeasePushed, markLeasePushed, takeOverOperatorLe
5
5
  export { findPingableShip } from './pingable-ship.js';
6
6
  export { checkManage, checkRead, checkReach, keepingReachRefusal } from './check-reach.js';
7
7
  export { resolveSelector } from './resolve-selector.js';
8
+ export { resolveInvitees } from './resolve-invitees.js';
9
+ export { resolveLabelSelection } from './resolve-label-selection.js';
10
+ export { labelValueTexts } from './label-value-texts.js';
8
11
  export { findOperatorShip, findShip, findViewerShip } from './ships.js';
9
- export { isConsoleShip, OPERATOR_SHIP_NAME } from './ship.js';
12
+ export { isConsoleShip, OPERATOR_SHIP_NAME, shipStatus } from './ship.js';
10
13
  export { appliedLimits } from './applied-limits.js';
11
14
  export { readsEvent, readsMessage, readsShip } from './read-reach.js';
12
15
  //# sourceMappingURL=public.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/domain/registry/public.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2DAA2D;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAmE,MAAM,YAAY,CAAC;AACzH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAkC,MAAM,aAAa,CAAC;AAEzI,OAAO,EAAE,gBAAgB,EAA4C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAA8E,MAAM,kBAAkB,CAAC;AACvK,OAAO,EAAE,eAAe,EAAqD,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAgC,MAAM,YAAY,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAa,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAyD,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/domain/registry/public.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2DAA2D;AAC3D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAmE,MAAM,YAAY,CAAC;AACzH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,qBAAqB,EAAkC,MAAM,aAAa,CAAC;AAEzI,OAAO,EAAE,gBAAgB,EAA4C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAA8E,MAAM,kBAAkB,CAAC;AACvK,OAAO,EAAE,eAAe,EAAqD,MAAM,uBAAuB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAwC,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAgC,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,eAAe,EAA0B,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAgC,MAAM,YAAY,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAa,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAyD,MAAM,iBAAiB,CAAC"}
@@ -10,7 +10,8 @@ export type ReadBuiltInRules = (caller: Caller) => Promise<Result<BuiltInRuleSta
10
10
  /**
11
11
  * Use case: every built-in rule of the caller's fleet as it is now (decision
12
12
  * 0034), in the order the rule list shows them, first: argo, the owner, the
13
- * answer and a connected plugin's reading, always on; the viewer reading as it
13
+ * answer, a connected plugin's reading and a meeting's participants reaching
14
+ * each other (decision 0061), always on; the viewer reading as it
14
15
  * was turned; the installation managing person ships and what they own, always
15
16
  * on; open, on exactly while the fleet has no rules applied. Its scope (fleet:network, which argo
16
17
  * holds) is checked before this runs. Read under the shared settings lock,
@@ -2,7 +2,8 @@ import { ok } from '../shared/result.js';
2
2
  /**
3
3
  * Use case: every built-in rule of the caller's fleet as it is now (decision
4
4
  * 0034), in the order the rule list shows them, first: argo, the owner, the
5
- * answer and a connected plugin's reading, always on; the viewer reading as it
5
+ * answer, a connected plugin's reading and a meeting's participants reaching
6
+ * each other (decision 0061), always on; the viewer reading as it
6
7
  * was turned; the installation managing person ships and what they own, always
7
8
  * on; open, on exactly while the fleet has no rules applied. Its scope (fleet:network, which argo
8
9
  * holds) is checked before this runs. Read under the shared settings lock,
@@ -16,6 +17,7 @@ export function createReadBuiltInRules(deps) {
16
17
  { rule: 'owner', isOn: true },
17
18
  { rule: 'answer', isOn: true },
18
19
  { rule: 'pluginRead', isOn: true },
20
+ { rule: 'meeting', isOn: true },
19
21
  { rule: 'viewerRead', isOn: isViewerReadOn },
20
22
  { rule: 'installation', isOn: true },
21
23
  { rule: 'open', isOn: rules === null },
@@ -1 +1 @@
1
- {"version":3,"file":"read-built-in-rules.js","sourceRoot":"","sources":["../../../src/domain/registry/read-built-in-rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAUtD;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAA6C;IAClF,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAA8C,EAAE;QACpE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;YAC5B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;YAC7B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;YAC9B,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;YAClC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE;YAC5C,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;YACpC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE;SACvC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"read-built-in-rules.js","sourceRoot":"","sources":["../../../src/domain/registry/read-built-in-rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAUtD;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAA6C;IAClF,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAA8C,EAAE;QACpE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxF,OAAO,EAAE,CAAC;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE;YAC5B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;YAC7B,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;YAC9B,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE;YAClC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;YAC/B,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE;YAC5C,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE;YACpC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE;SACvC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { IdGenerator } from '@aeolus-fleet/common';
2
+ import { type Caller } from '../shared/caller.js';
3
+ import type { Clock } from '../shared/clock.js';
4
+ import type { DomainError } from '../shared/errors.js';
5
+ import { type EventLog } from '../shared/events.js';
6
+ import { type Result } from '../shared/result.js';
7
+ import type { UnitOfWork } from '../shared/unit-of-work.js';
8
+ import type { DefinedScopeRepository, ScopeNamespaceRepository, ShipRepository } from './ports.js';
9
+ export interface RemoveScopeTx {
10
+ ships: Pick<ShipRepository, 'countHolding'>;
11
+ scopeNamespaces: Pick<ScopeNamespaceRepository, 'lockNamespace'>;
12
+ definedScopes: Pick<DefinedScopeRepository, 'find' | 'remove'>;
13
+ events: EventLog;
14
+ }
15
+ export type RemoveScope = (caller: Caller, input: {
16
+ scope: string;
17
+ }) => Promise<Result<null, DomainError<'SCOPE_NOT_DEFINED' | 'SCOPE_HELD'>>>;
18
+ /**
19
+ * Use case: any actor removes one of the fleet's scopes, refused while an
20
+ * active ship holds it (design gateway-scopes, 4.1). Its scope
21
+ * (scopes:define) is checked before this runs. In one unit of work, holding
22
+ * the scope's namespace, so a grant of it waits and then finds it gone: the
23
+ * removal and ScopeRemoved.
24
+ */
25
+ export declare function createRemoveScope(deps: {
26
+ uow: UnitOfWork<RemoveScopeTx>;
27
+ clock: Clock;
28
+ ids: IdGenerator;
29
+ }): RemoveScope;
@@ -0,0 +1,32 @@
1
+ import { actorOf } from '../shared/caller.js';
2
+ import { recordEvent } from '../shared/events.js';
3
+ import { ok } from '../shared/result.js';
4
+ import { namespaceOf, removeScope } from './defined-scope.js';
5
+ /**
6
+ * Use case: any actor removes one of the fleet's scopes, refused while an
7
+ * active ship holds it (design gateway-scopes, 4.1). Its scope
8
+ * (scopes:define) is checked before this runs. In one unit of work, holding
9
+ * the scope's namespace, so a grant of it waits and then finds it gone: the
10
+ * removal and ScopeRemoved.
11
+ */
12
+ export function createRemoveScope(deps) {
13
+ return (caller, input) => deps.uow.run(async (tx) => {
14
+ const { fleetId } = caller;
15
+ await tx.scopeNamespaces.lockNamespace(fleetId, namespaceOf(input.scope));
16
+ const removed = removeScope(await tx.definedScopes.find(fleetId, input.scope), {
17
+ scope: input.scope,
18
+ holders: await tx.ships.countHolding(fleetId, input.scope),
19
+ at: deps.clock.now(),
20
+ actor: actorOf(caller),
21
+ });
22
+ if (!removed.isOk) {
23
+ return removed;
24
+ }
25
+ await tx.definedScopes.remove(fleetId, input.scope);
26
+ for (const event of removed.value.events) {
27
+ await recordEvent({ events: tx.events, ids: deps.ids }, event);
28
+ }
29
+ return ok(null);
30
+ });
31
+ }
32
+ //# sourceMappingURL=remove-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-scope.js","sourceRoot":"","sources":["../../../src/domain/registry/remove-scope.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAiB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAY9D;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAwE;IACxG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACvB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAA0E,EAAE;QAChG,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAC3B,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1E,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE;YAC7E,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC;YAC1D,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;YACpB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC;SACvB,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QACpD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACzC,MAAM,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { FleetId, LabelValueId, ShipId } from '@aeolus-fleet/common';
2
+ import { type Result } from '../shared/result.js';
3
+ import type { ShipRepository } from './ports.js';
4
+ import { type ResolveSelectorTx, type UnresolvableSelector } from './resolve-selector.js';
5
+ /** The ports resolving a meeting's invitees reads, inside the caller's unit of work. */
6
+ export interface ResolveInviteesTx {
7
+ ships: ResolveSelectorTx['ships'] & Pick<ShipRepository, 'listActiveCarryingEvery'>;
8
+ }
9
+ /** One ship invited by its id or by its name; never a type (decision 0061). */
10
+ export type Invitee = {
11
+ shipId: ShipId;
12
+ } | {
13
+ name: string;
14
+ };
15
+ /**
16
+ * The ships a meeting's invitees name (decision 0061): each ship by id or by
17
+ * name, resolved as a send's ship selector is, then the ships a label
18
+ * selection resolves to, carrying every value, never the viewer ship. Each is
19
+ * held as a send holds the ship it addresses, so a retire waits for the open.
20
+ * A ship named twice comes once, where it first came; an unknown, retired or
21
+ * viewer ship named in the list refuses all of it.
22
+ */
23
+ export declare function resolveInvitees(tx: ResolveInviteesTx, input: {
24
+ fleetId: FleetId;
25
+ ships: readonly Invitee[];
26
+ valueIds: readonly LabelValueId[];
27
+ }): Promise<Result<ShipId[], UnresolvableSelector>>;
@@ -0,0 +1,27 @@
1
+ import { ok } from '../shared/result.js';
2
+ import { resolveSelector } from './resolve-selector.js';
3
+ /**
4
+ * The ships a meeting's invitees name (decision 0061): each ship by id or by
5
+ * name, resolved as a send's ship selector is, then the ships a label
6
+ * selection resolves to, carrying every value, never the viewer ship. Each is
7
+ * held as a send holds the ship it addresses, so a retire waits for the open.
8
+ * A ship named twice comes once, where it first came; an unknown, retired or
9
+ * viewer ship named in the list refuses all of it.
10
+ */
11
+ export async function resolveInvitees(tx, input) {
12
+ const { fleetId } = input;
13
+ const selected = input.valueIds.length === 0 ? [] : await tx.ships.listActiveCarryingEvery(fleetId, input.valueIds);
14
+ const invitees = [...input.ships, ...selected.map((ship) => ({ shipId: ship.id }))];
15
+ const resolved = [];
16
+ for (const invitee of invitees) {
17
+ const recipient = await resolveSelector(tx, { fleetId, selector: { kind: 'ship', ...invitee } });
18
+ if (!recipient.isOk) {
19
+ return recipient;
20
+ }
21
+ if (recipient.value.kind === 'ship' && !resolved.includes(recipient.value.shipId)) {
22
+ resolved.push(recipient.value.shipId);
23
+ }
24
+ }
25
+ return ok(resolved);
26
+ }
27
+ //# sourceMappingURL=resolve-invitees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-invitees.js","sourceRoot":"","sources":["../../../src/domain/registry/resolve-invitees.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAqD,MAAM,uBAAuB,CAAC;AAU3G;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,EAAqB,EACrB,KAAyF;IAEzF,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACpH,MAAM,QAAQ,GAAc,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/F,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAC;QACjG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClF,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { FleetId, LabelValueId, ShipId } from '@aeolus-fleet/common';
2
+ import { type Result } from '../shared/result.js';
3
+ import type { ShipRepository } from './ports.js';
4
+ import type { UnresolvableSelector } from './resolve-selector.js';
5
+ /** The ports resolving a label selection reads, inside the caller's unit of work. */
6
+ export interface ResolveLabelSelectionTx {
7
+ ships: Pick<ShipRepository, 'listActiveCarryingEvery' | 'findForShare'>;
8
+ }
9
+ /**
10
+ * The ships a send to a label selection goes to, at send time (decision
11
+ * 0065): every ship carrying each value that is not retired, awaiting crew or
12
+ * crewed, never the viewer and never the sender. Each is held in id order as
13
+ * a send holds the ship it addresses, so a retire waits for the send and a
14
+ * ship retired before its hold is left out. No ship refuses the send.
15
+ */
16
+ export declare function resolveLabelSelection(tx: ResolveLabelSelectionTx, input: {
17
+ fleetId: FleetId;
18
+ valueIds: readonly LabelValueId[];
19
+ senderShipId: ShipId;
20
+ }): Promise<Result<ShipId[], UnresolvableSelector>>;