@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
@@ -28,51 +28,69 @@ datasource db {
28
28
 
29
29
  /// The tenant: one operator's ships, messages and history. Ids start with flt_.
30
30
  model Fleet {
31
- id String @id
32
- name String
33
- createdAt DateTime @map("created_at") @db.Timestamptz(3)
31
+ id String @id
32
+ name String
33
+ createdAt DateTime @map("created_at") @db.Timestamptz(3)
34
34
  /// The sequence number of the fleet's last committed event. A unit of work
35
35
  /// takes its numbers from it as its last statements, so the row lock orders
36
36
  /// the numbers as the transactions commit.
37
- lastEventSeq BigInt @default(0) @map("last_event_seq")
37
+ lastEventSeq BigInt @default(0) @map("last_event_seq")
38
38
  /// Whether the fleet sets its own ship limit (else it follows the installation
39
39
  /// default), and that limit: null for no limit.
40
- shipLimitSet Boolean @default(false) @map("ship_limit_set")
41
- shipLimit Int? @map("ship_limit")
40
+ shipLimitSet Boolean @default(false) @map("ship_limit_set")
41
+ shipLimit Int? @map("ship_limit")
42
42
  /// The same for its daily message limit.
43
- dailyMessageLimitSet Boolean @default(false) @map("daily_message_limit_set")
44
- dailyMessageLimit Int? @map("daily_message_limit")
45
-
46
- ships Ship[]
47
- leases Lease[]
48
- crewRequests CrewRequest[]
49
- crewRequestGiveBacks CrewRequestGiveBack[]
50
- clearRequests WorktreeClearRequest[]
51
- labels Label[]
52
- labelValues LabelValue[]
53
- shipLabels ShipLabel[]
54
- networkSettings NetworkSettings?
55
- networkRulesDraft NetworkRulesDraft?
56
- declaredNetworkRules DeclaredNetworkRules[]
43
+ dailyMessageLimitSet Boolean @default(false) @map("daily_message_limit_set")
44
+ dailyMessageLimit Int? @map("daily_message_limit")
45
+ /// The same for the schedules each of its ships may hold, and for the
46
+ /// minimum interval of a repeating schedule, in seconds (decision 0062).
47
+ schedulesPerShipLimitSet Boolean @default(false) @map("schedules_per_ship_limit_set")
48
+ schedulesPerShipLimit Int? @map("schedules_per_ship_limit")
49
+ minimumScheduleIntervalSet Boolean @default(false) @map("minimum_schedule_interval_set")
50
+ minimumScheduleInterval Int? @map("minimum_schedule_interval")
51
+ /// The same for its retention in days (decision 0066): null for kept for good.
52
+ retentionSet Boolean @default(false) @map("retention_set")
53
+ retentionDays Int? @map("retention_days")
54
+ /// When its last pruning pass ran, and from when it keeps its finished
55
+ /// history, as its last finished pass left it (decision 0066); null before any.
56
+ prunedAt DateTime? @map("pruned_at") @db.Timestamptz(3)
57
+ keptFrom DateTime? @map("kept_from") @db.Timestamptz(3)
58
+
59
+ ships Ship[]
60
+ leases Lease[]
61
+ crewRequests CrewRequest[]
62
+ crewRequestGiveBacks CrewRequestGiveBack[]
63
+ clearRequests WorktreeClearRequest[]
64
+ labels Label[]
65
+ labelValues LabelValue[]
66
+ shipLabels ShipLabel[]
67
+ networkSettings NetworkSettings?
68
+ networkRulesDraft NetworkRulesDraft?
69
+ declaredNetworkRules DeclaredNetworkRules[]
57
70
  installationDeclaredNetworkRules InstallationDeclaredNetworkRules?
58
- scopeNamespaces ScopeNamespace[]
59
- verifiedFacts VerifiedFacts[]
60
- reachRefusals ReachRefusal[]
61
- credentials Credential[]
62
- messages Message[]
63
- messageDays MessageDay[]
64
- deliveries Delivery[]
65
- overdueDeliveries OverdueDelivery[]
66
- events Event[]
67
- consoleSessions ConsoleSession[]
68
- signInTickets SignInTicket[]
69
- noticeDismissals NoticeDismissal[]
70
- guideProgress GuideProgress[]
71
- accountNoticeDismissals AccountNoticeDismissal[]
72
- accountGuideProgress AccountGuideProgress[]
73
- operator Operator?
74
- healthSnapshots HealthSnapshot[]
75
- healthSnapshotDeliveries HealthSnapshotDelivery[]
71
+ scopeNamespaces ScopeNamespace[]
72
+ definedScopes DefinedScope[]
73
+ verifiedFacts VerifiedFacts[]
74
+ reachRefusals ReachRefusal[]
75
+ credentials Credential[]
76
+ messages Message[]
77
+ messageDays MessageDay[]
78
+ deliveries Delivery[]
79
+ overdueDeliveries OverdueDelivery[]
80
+ events Event[]
81
+ consoleSessions ConsoleSession[]
82
+ signInTickets SignInTicket[]
83
+ noticeDismissals NoticeDismissal[]
84
+ guideProgress GuideProgress[]
85
+ accountNoticeDismissals AccountNoticeDismissal[]
86
+ accountGuideProgress AccountGuideProgress[]
87
+ operator Operator?
88
+ healthSnapshots HealthSnapshot[]
89
+ healthSnapshotDeliveries HealthSnapshotDelivery[]
90
+ meetings Meeting[]
91
+ meetingParticipants MeetingParticipant[]
92
+ meetingMicRequests MeetingMicRequest[]
93
+ schedules Schedule[]
76
94
 
77
95
  @@map("fleets")
78
96
  }
@@ -92,49 +110,56 @@ enum ShipKind {
92
110
  /// A durable, addressable identity with an inbox. Ids start with shp_.
93
111
  /// Scopes are set when the ship is created and checked before every call.
94
112
  model Ship {
95
- id String @id
96
- fleetId String @map("fleet_id")
113
+ id String @id
114
+ fleetId String @map("fleet_id")
97
115
  name String
98
116
  type String
99
117
  kind ShipKind
100
118
  scopes String[]
101
119
  note String?
102
- createdAt DateTime @map("created_at") @db.Timestamptz(3)
103
- retiredAt DateTime? @map("retired_at") @db.Timestamptz(3)
120
+ createdAt DateTime @map("created_at") @db.Timestamptz(3)
121
+ retiredAt DateTime? @map("retired_at") @db.Timestamptz(3)
104
122
  /// The actor that commissioned it, its idempotency key and the request's hash; null for argo.
105
123
  /// commissioned_by names the actor: a ship's id, an account's id, or `installation`.
106
124
  commissionedByKind CommissionerKind? @map("commissioned_by_kind")
107
- commissionedBy String? @map("commissioned_by")
108
- commissionKey String? @map("commission_key")
109
- commissionRequestHash String? @map("commission_request_hash")
125
+ commissionedBy String? @map("commissioned_by")
126
+ commissionKey String? @map("commission_key")
127
+ commissionRequestHash String? @map("commission_request_hash")
110
128
  /// The ship that answers for it, a person's ship or argo (decision 0045); null for argo and the viewer.
111
- ownerShipId String? @map("owner_ship_id")
112
-
113
- fleet Fleet @relation(fields: [fleetId], references: [id])
114
- owner Ship? @relation("ShipOwner", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)
115
- ownedShips Ship[] @relation("ShipOwner")
116
- leases Lease[]
117
- credentials Credential[]
118
- sentMessages Message[] @relation("MessageSender")
119
- addressedMessages Message[] @relation("MessageSelectorShip")
120
- deliveries Delivery[] @relation("DeliveryRecipientShip")
121
- claimedDeliveries Delivery[] @relation("DeliveryClaimedByShip")
122
- overdueDeliveries OverdueDelivery[]
123
- consoleSessions ConsoleSession[]
124
- actorOfEvents Event[] @relation("EventActorShip")
125
- actorThroughOfEvents Event[] @relation("EventActorThroughShip")
126
- events Event[] @relation("EventShip")
127
- crewRequest CrewRequest? @relation("CrewRequestShip")
128
- assignedCrews CrewRequest[] @relation("CrewRequestAssignee")
129
- givenBackCrews CrewRequestGiveBack[] @relation("CrewRequestGiveBackTrierarch")
130
- clearRequests WorktreeClearRequest[] @relation("WorktreeClearRequestTrierarch")
131
- clearedWorktrees WorktreeClearRequest[] @relation("WorktreeClearRequestShip")
132
- requestedClears WorktreeClearRequest[] @relation("WorktreeClearRequestRequester")
133
- ownedLabels Label[] @relation("LabelOwner")
134
- labels ShipLabel[] @relation("ShipLabelShip")
129
+ ownerShipId String? @map("owner_ship_id")
130
+
131
+ fleet Fleet @relation(fields: [fleetId], references: [id])
132
+ owner Ship? @relation("ShipOwner", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)
133
+ ownedShips Ship[] @relation("ShipOwner")
134
+ leases Lease[]
135
+ credentials Credential[]
136
+ sentMessages Message[] @relation("MessageSender")
137
+ addressedMessages Message[] @relation("MessageSelectorShip")
138
+ deliveries Delivery[] @relation("DeliveryRecipientShip")
139
+ claimedDeliveries Delivery[] @relation("DeliveryClaimedByShip")
140
+ overdueDeliveries OverdueDelivery[]
141
+ consoleSessions ConsoleSession[]
142
+ actorOfEvents Event[] @relation("EventActorShip")
143
+ actorThroughOfEvents Event[] @relation("EventActorThroughShip")
144
+ events Event[] @relation("EventShip")
145
+ crewRequest CrewRequest? @relation("CrewRequestShip")
146
+ assignedCrews CrewRequest[] @relation("CrewRequestAssignee")
147
+ givenBackCrews CrewRequestGiveBack[] @relation("CrewRequestGiveBackTrierarch")
148
+ clearRequests WorktreeClearRequest[] @relation("WorktreeClearRequestTrierarch")
149
+ clearedWorktrees WorktreeClearRequest[] @relation("WorktreeClearRequestShip")
150
+ requestedClears WorktreeClearRequest[] @relation("WorktreeClearRequestRequester")
151
+ ownedLabels Label[] @relation("LabelOwner")
152
+ labels ShipLabel[] @relation("ShipLabelShip")
135
153
  declaredNetworkRules DeclaredNetworkRules[]
136
- declaredNamespace ScopeNamespace?
137
- verifiedFacts VerifiedFacts[]
154
+ declaredNamespace ScopeNamespace?
155
+ verifiedFacts VerifiedFacts[]
156
+ ownedMeetings Meeting[] @relation("MeetingOwner")
157
+ moderatedMeetings Meeting[] @relation("MeetingModerator")
158
+ openedMeetings Meeting[] @relation("MeetingOpener")
159
+ micHeldMeetings Meeting[] @relation("MeetingMicHolder")
160
+ meetings MeetingParticipant[]
161
+ schedules Schedule[] @relation("ScheduleShip")
162
+ scheduledTo Schedule[] @relation("ScheduleSelectorShip")
138
163
 
139
164
  @@unique([fleetId, id])
140
165
  /// An idempotency key is used once per commissioning actor.
@@ -225,8 +250,8 @@ model Lease {
225
250
  turnAt DateTime? @map("turn_at") @db.Timestamptz(3)
226
251
  endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
227
252
 
228
- fleet Fleet @relation(fields: [fleetId], references: [id])
229
- ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
253
+ fleet Fleet @relation(fields: [fleetId], references: [id])
254
+ ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
230
255
  consoleSessions ConsoleSession[]
231
256
  claimedDeliveries Delivery[]
232
257
  overdueDeliveries OverdueDelivery[]
@@ -256,27 +281,27 @@ enum CrewStatus {
256
281
  /// 16 KB, checked but never acted on; each request replaces them and moves their
257
282
  /// version by one.
258
283
  model CrewRequest {
259
- shipId String @id @map("ship_id")
260
- fleetId String @map("fleet_id")
261
- settings Json
262
- settingsVersion Int @map("settings_version")
263
- requestedAt DateTime @map("requested_at") @db.Timestamptz(3)
284
+ shipId String @id @map("ship_id")
285
+ fleetId String @map("fleet_id")
286
+ settings Json
287
+ settingsVersion Int @map("settings_version")
288
+ requestedAt DateTime @map("requested_at") @db.Timestamptz(3)
264
289
  /// The trierarch ship it is assigned to; null while unassigned.
265
- assignedTo String? @map("assigned_to_ship_id")
290
+ assignedTo String? @map("assigned_to_ship_id")
266
291
  /// How its trierarch says the crew stands; null until it says.
267
- status CrewStatus?
292
+ status CrewStatus?
268
293
  /// Why no trierarch can take it, written by the assigner while unassigned; null when none.
269
- reason String?
294
+ reason String?
270
295
  /// How many times its trierarch restarted the session within its restart window, with the status: 0 on its first start.
271
- attempt Int @default(0)
296
+ attempt Int @default(0)
272
297
  /// When the session its trierarch runs now started, with the status; null while none runs.
273
- sessionStartedAt DateTime? @map("session_started_at") @db.Timestamptz(3)
298
+ sessionStartedAt DateTime? @map("session_started_at") @db.Timestamptz(3)
274
299
  /// Whether its crew is final: set by its trierarch's first running, restarting or crashed, kept whatever status follows, cleared on every new settings version.
275
- isFinal Boolean @default(false) @map("is_final")
300
+ isFinal Boolean @default(false) @map("is_final")
276
301
 
277
- fleet Fleet @relation(fields: [fleetId], references: [id])
278
- ship Ship @relation("CrewRequestShip", fields: [fleetId, shipId], references: [fleetId, id])
279
- assignee Ship? @relation("CrewRequestAssignee", fields: [fleetId, assignedTo], references: [fleetId, id])
302
+ fleet Fleet @relation(fields: [fleetId], references: [id])
303
+ ship Ship @relation("CrewRequestShip", fields: [fleetId, shipId], references: [fleetId, id])
304
+ assignee Ship? @relation("CrewRequestAssignee", fields: [fleetId, assignedTo], references: [fleetId, id])
280
305
  givenBack CrewRequestGiveBack[]
281
306
 
282
307
  @@unique([fleetId, shipId])
@@ -328,8 +353,8 @@ model WorktreeClearRequest {
328
353
  /// owned by the ship that defined it. Ids start with lbl_. A retired or deleted
329
354
  /// label is deleted with its values; its events stay.
330
355
  model Label {
331
- id String @id
332
- fleetId String @map("fleet_id")
356
+ id String @id
357
+ fleetId String @map("fleet_id")
333
358
  key String
334
359
  /// A ship or the installation (decision 0031); the installation's label names no owner ship.
335
360
  ownerKind LabelOwnerKind @default(ship) @map("owner_kind")
@@ -463,6 +488,18 @@ model ScopeNamespace {
463
488
  @@map("scope_namespaces")
464
489
  }
465
490
 
491
+ /// One of the fleet's own scopes (design gateway-scopes, 4.1), with its one-line description.
492
+ model DefinedScope {
493
+ fleetId String @map("fleet_id")
494
+ scope String
495
+ description String
496
+
497
+ fleet Fleet @relation(fields: [fleetId], references: [id])
498
+
499
+ @@id([fleetId, scope])
500
+ @@map("defined_scopes")
501
+ }
502
+
466
503
  /// One writer's verified facts about a ship (decision 0059): what it checked,
467
504
  /// as JSON in the shape common gives, set whole and kept with the ship. The
468
505
  /// writer is an actor: a ship or an account by its id, or the installation
@@ -534,6 +571,8 @@ model Credential {
534
571
  enum SelectorKind {
535
572
  ship
536
573
  type
574
+ meeting
575
+ label
537
576
 
538
577
  @@map("selector_kind")
539
578
  }
@@ -566,25 +605,34 @@ model Message {
566
605
  selectorKind SelectorKind @map("selector_kind")
567
606
  selectorShipId String? @map("selector_ship_id")
568
607
  selectorType String? @map("selector_type")
608
+ /// The label selection a send to a label was sent to, its value ids as sent (decision 0065); none for any other selector.
609
+ selectorValueIds String[] @default([]) @map("selector_value_ids")
569
610
  payload String
570
611
  contentType String @map("content_type")
571
612
  /// The model the sender's session stated; none from argo and on messages from before models were stated.
572
613
  model String?
573
614
  idempotencyKey String @map("idempotency_key")
574
615
  requestHash String @map("request_hash")
616
+ /// The message it replies to and the one it resends, as written: no foreign
617
+ /// key, so a kept message may name one that is no longer kept (decision 0066).
575
618
  inReplyToMessageId String? @map("in_reply_to_message_id")
576
619
  resendOfMessageId String? @map("resend_of_message_id")
620
+ /// The meeting it was sent to, or the meeting whose added notice it is (decision 0061).
621
+ meetingId String? @map("meeting_id")
622
+ /// The schedule it was sent for, and that send time; none on a live send (decision 0062).
623
+ scheduleId String? @map("schedule_id")
624
+ sendTime DateTime? @map("send_time") @db.Timestamptz(3)
577
625
  createdAt DateTime @map("created_at") @db.Timestamptz(3)
578
626
 
579
- fleet Fleet @relation(fields: [fleetId], references: [id])
580
- senderShip Ship @relation("MessageSender", fields: [fleetId, senderShipId], references: [fleetId, id], onDelete: Restrict)
581
- selectorShip Ship? @relation("MessageSelectorShip", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)
582
- inReplyTo Message? @relation("MessageInReplyTo", fields: [fleetId, inReplyToMessageId], references: [fleetId, id], onDelete: Restrict)
583
- replies Message[] @relation("MessageInReplyTo")
584
- resendOf Message? @relation("MessageResendOf", fields: [fleetId, resendOfMessageId], references: [fleetId, id], onDelete: Restrict)
585
- resends Message[] @relation("MessageResendOf")
586
- deliveries Delivery[]
587
- events Event[]
627
+ fleet Fleet @relation(fields: [fleetId], references: [id])
628
+ senderShip Ship @relation("MessageSender", fields: [fleetId, senderShipId], references: [fleetId, id], onDelete: Restrict)
629
+ selectorShip Ship? @relation("MessageSelectorShip", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)
630
+ meeting Meeting? @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)
631
+ schedule Schedule? @relation("MessageSchedule", fields: [fleetId, scheduleId], references: [fleetId, id], onDelete: Restrict)
632
+ repliedToBySchedules Schedule[] @relation("ScheduleInReplyTo")
633
+ lastSentBySchedules Schedule[] @relation("ScheduleLastMessage")
634
+ deliveries Delivery[]
635
+ events Event[]
588
636
 
589
637
  @@unique([fleetId, id])
590
638
  /// A sender uses an idempotency key once: a repeat of the same request, told by its
@@ -601,6 +649,10 @@ model Message {
601
649
  @@index([fleetId, selectorShipId, id])
602
650
  @@index([fleetId, inReplyToMessageId])
603
651
  @@index([fleetId, resendOfMessageId])
652
+ /// The messages a schedule sent (decision 0062): the foreign key's index (#331).
653
+ @@index([fleetId, scheduleId])
654
+ /// A meeting's contributions page newest first by id (decision 0061).
655
+ @@index([fleetId, meetingId, id])
604
656
  @@index([fleetId, selectorShipId, createdAt, id], map: "messages_pings_idx", where: raw("(content_type = 'application/vnd.aeolus.ping'::text)"))
605
657
  @@map("messages")
606
658
  }
@@ -629,6 +681,197 @@ enum DeliveryState {
629
681
  /// For a type under network rules, the ships of the type its sender may reach,
630
682
  /// fixed at send time: only they claim it (decision 0034). Empty: any ship of
631
683
  /// the type, as a send no ship of the type may take is refused.
684
+ /// A meeting of ships (decision 0061), id mtg_: one owner and one moderator,
685
+ /// both participants, the opener at first.
686
+ model Meeting {
687
+ id String @id
688
+ fleetId String @map("fleet_id")
689
+ title String?
690
+ ownerShipId String @map("owner_ship_id")
691
+ moderatorShipId String @map("moderator_ship_id")
692
+ openedByShipId String @map("opened_by_ship_id")
693
+ idempotencyKey String @map("idempotency_key")
694
+ requestHash String @map("request_hash")
695
+ openedAt DateTime @map("opened_at") @db.Timestamptz(3)
696
+ endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
697
+ /// The participant that holds the mic; none while it is free.
698
+ micHolderShipId String? @map("mic_holder_ship_id")
699
+ micPattern MicPattern @default(moderator) @map("mic_pattern")
700
+
701
+ fleet Fleet @relation(fields: [fleetId], references: [id])
702
+ micHolder Ship? @relation("MeetingMicHolder", fields: [fleetId, micHolderShipId], references: [fleetId, id], onDelete: Restrict)
703
+ micRequests MeetingMicRequest[]
704
+ owner Ship @relation("MeetingOwner", fields: [fleetId, ownerShipId], references: [fleetId, id], onDelete: Restrict)
705
+ moderator Ship @relation("MeetingModerator", fields: [fleetId, moderatorShipId], references: [fleetId, id], onDelete: Restrict)
706
+ openedBy Ship @relation("MeetingOpener", fields: [fleetId, openedByShipId], references: [fleetId, id], onDelete: Restrict)
707
+ participants MeetingParticipant[]
708
+ messages Message[]
709
+
710
+ @@unique([fleetId, id])
711
+ /// An opener uses an idempotency key once.
712
+ @@unique([fleetId, openedByShipId, idempotencyKey])
713
+ /// Every foreign key has an index leading with its columns (#331).
714
+ @@index([fleetId, ownerShipId])
715
+ @@index([fleetId, moderatorShipId])
716
+ @@index([fleetId, micHolderShipId])
717
+ @@map("meetings")
718
+ }
719
+
720
+ /// How a meeting's free mic passes (decision 0061, M9): the moderator's pick, or the oldest request.
721
+ /// A ship's scheduled message (decision 0062): its send input as given, its timing and
722
+ /// refusal strategy, its state, next send time and attempt, and its last outcome.
723
+ model Schedule {
724
+ id String @id
725
+ fleetId String @map("fleet_id")
726
+ shipId String @map("ship_id")
727
+ /// The selector as the creator gave it: a ship by id or by name, a type, or a label selection by value ids; never a meeting.
728
+ selectorKind SelectorKind @map("selector_kind")
729
+ selectorShipId String? @map("selector_ship_id")
730
+ selectorShipName String? @map("selector_ship_name")
731
+ selectorType String? @map("selector_type")
732
+ selectorValueIds String[] @default([]) @map("selector_value_ids")
733
+ payload String
734
+ contentType String @map("content_type")
735
+ model String?
736
+ inReplyToMessageId String? @map("in_reply_to_message_id")
737
+ isForced Boolean @map("is_forced")
738
+ timingKind ScheduleTimingKind @map("timing_kind")
739
+ /// The timing: once an instant; every a duration, or a cron and its zone, each from a start to an end or a count of sends.
740
+ onceAt DateTime? @map("once_at") @db.Timestamptz(3)
741
+ every String?
742
+ cron String?
743
+ timeZone String? @map("time_zone")
744
+ start DateTime? @db.Timestamptz(3)
745
+ end DateTime? @db.Timestamptz(3)
746
+ count Int?
747
+ onRefused RefusalStrategy @map("on_refused")
748
+ retryWindow String @map("retry_window")
749
+ onMissed MissedStrategy @map("on_missed")
750
+ grace String
751
+ idempotencyKey String @map("idempotency_key")
752
+ requestHash String @map("request_hash")
753
+ state ScheduleState
754
+ nextSendTime DateTime? @map("next_send_time") @db.Timestamptz(3)
755
+ nextAttemptAt DateTime? @map("next_attempt_at") @db.Timestamptz(3)
756
+ lastOutcomeKind ScheduleOutcomeKind? @map("last_outcome_kind")
757
+ lastMessageId String? @map("last_message_id")
758
+ lastRefusalCode String? @map("last_refusal_code")
759
+ lastSendTime DateTime? @map("last_send_time") @db.Timestamptz(3)
760
+ lastOutcomeAt DateTime? @map("last_outcome_at") @db.Timestamptz(3)
761
+ createdAt DateTime @map("created_at") @db.Timestamptz(3)
762
+ endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
763
+ cancelledAt DateTime? @map("cancelled_at") @db.Timestamptz(3)
764
+
765
+ fleet Fleet @relation(fields: [fleetId], references: [id])
766
+ ship Ship @relation("ScheduleShip", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
767
+ selectorShip Ship? @relation("ScheduleSelectorShip", fields: [fleetId, selectorShipId], references: [fleetId, id], onDelete: Restrict)
768
+ inReplyTo Message? @relation("ScheduleInReplyTo", fields: [fleetId, inReplyToMessageId], references: [fleetId, id], onDelete: Restrict)
769
+ lastMessage Message? @relation("ScheduleLastMessage", fields: [fleetId, lastMessageId], references: [fleetId, id], onDelete: Restrict)
770
+ messages Message[] @relation("MessageSchedule")
771
+
772
+ @@unique([fleetId, id])
773
+ /// A ship uses an idempotency key once for its schedules.
774
+ @@unique([fleetId, shipId, idempotencyKey])
775
+ /// A ship's schedules page newest first by id.
776
+ @@index([fleetId, shipId, id])
777
+ /// The claim of the active schedules that are due, earliest attempt first.
778
+ @@index([fleetId, nextAttemptAt, id], map: "schedules_due_idx", where: raw("(state = 'active'::schedule_state)"))
779
+ /// Every foreign key has an index leading with its columns (#331).
780
+ @@index([fleetId, selectorShipId])
781
+ @@index([fleetId, inReplyToMessageId])
782
+ @@index([fleetId, lastMessageId])
783
+ @@map("schedules")
784
+ }
785
+
786
+ enum ScheduleState {
787
+ active
788
+ paused
789
+ ended
790
+ cancelled
791
+
792
+ @@map("schedule_state")
793
+ }
794
+
795
+ enum ScheduleTimingKind {
796
+ once
797
+ every
798
+ cron
799
+
800
+ @@map("schedule_timing_kind")
801
+ }
802
+
803
+ enum RefusalStrategy {
804
+ skip
805
+ retry
806
+ pause
807
+
808
+ @@map("refusal_strategy")
809
+ }
810
+
811
+ enum MissedStrategy {
812
+ each
813
+ once
814
+ skip
815
+
816
+ @@map("missed_strategy")
817
+ }
818
+
819
+ enum ScheduleOutcomeKind {
820
+ sent
821
+ refused
822
+ missed
823
+
824
+ @@map("schedule_outcome_kind")
825
+ }
826
+
827
+ enum MicPattern {
828
+ moderator
829
+ fifo
830
+
831
+ @@map("mic_pattern")
832
+ }
833
+
834
+ /// A participant waiting for the mic of its meeting, since its time (decision 0061, M8): once per meeting.
835
+ model MeetingMicRequest {
836
+ fleetId String @map("fleet_id")
837
+ meetingId String @map("meeting_id")
838
+ shipId String @map("ship_id")
839
+ requestedAt DateTime @map("requested_at") @db.Timestamptz(3)
840
+ /// Its place on the list, the oldest request's 0.
841
+ place Int
842
+
843
+ fleet Fleet @relation(fields: [fleetId], references: [id])
844
+ meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)
845
+ participant MeetingParticipant @relation(fields: [fleetId, meetingId, shipId], references: [fleetId, meetingId, shipId], onDelete: Restrict)
846
+
847
+ @@id([fleetId, meetingId, shipId])
848
+ @@map("meeting_mic_requests")
849
+ }
850
+
851
+ /// A ship in a meeting and when it joined (decision 0061): once per meeting.
852
+ model MeetingParticipant {
853
+ fleetId String @map("fleet_id")
854
+ meetingId String @map("meeting_id")
855
+ shipId String @map("ship_id")
856
+ joinedAt DateTime @map("joined_at") @db.Timestamptz(3)
857
+ /// Its place in the order the meeting's ships joined, the opener's 0.
858
+ place Int
859
+ /// When it left or was revoked; none while it is present (decision 0061, M13).
860
+ leftAt DateTime? @map("left_at") @db.Timestamptz(3)
861
+ /// Whether the owner revoked its right to rejoin.
862
+ isRevoked Boolean @default(false) @map("is_revoked")
863
+
864
+ fleet Fleet @relation(fields: [fleetId], references: [id])
865
+ meeting Meeting @relation(fields: [fleetId, meetingId], references: [fleetId, id], onDelete: Restrict)
866
+ ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
867
+ micRequest MeetingMicRequest?
868
+
869
+ @@id([fleetId, meetingId, shipId])
870
+ /// A ship's meetings, and a retire checking them.
871
+ @@index([fleetId, shipId])
872
+ @@map("meeting_participants")
873
+ }
874
+
632
875
  model Delivery {
633
876
  id String @id
634
877
  fleetId String @map("fleet_id")
@@ -648,11 +891,11 @@ model Delivery {
648
891
  readAt DateTime? @map("read_at") @db.Timestamptz(3)
649
892
  createdAt DateTime @map("created_at") @db.Timestamptz(3)
650
893
 
651
- fleet Fleet @relation(fields: [fleetId], references: [id])
652
- message Message @relation(fields: [fleetId, messageId], references: [fleetId, id])
653
- recipientShip Ship? @relation("DeliveryRecipientShip", fields: [fleetId, recipientShipId], references: [fleetId, id], onDelete: Restrict)
654
- claimedByShip Ship? @relation("DeliveryClaimedByShip", fields: [fleetId, claimedByShipId], references: [fleetId, id], onDelete: Restrict)
655
- claimedByLease Lease? @relation(fields: [fleetId, claimedByLeaseId], references: [fleetId, id], onDelete: Restrict)
894
+ fleet Fleet @relation(fields: [fleetId], references: [id])
895
+ message Message @relation(fields: [fleetId, messageId], references: [fleetId, id])
896
+ recipientShip Ship? @relation("DeliveryRecipientShip", fields: [fleetId, recipientShipId], references: [fleetId, id], onDelete: Restrict)
897
+ claimedByShip Ship? @relation("DeliveryClaimedByShip", fields: [fleetId, claimedByShipId], references: [fleetId, id], onDelete: Restrict)
898
+ claimedByLease Lease? @relation(fields: [fleetId, claimedByLeaseId], references: [fleetId, id], onDelete: Restrict)
656
899
  events Event[]
657
900
  overdue OverdueDelivery[]
658
901
 
@@ -670,7 +913,7 @@ model Delivery {
670
913
  @@index([fleetId, claimedByLeaseId, state])
671
914
  /// Every foreign key has an index leading with its columns, so deleting a
672
915
  /// referenced row checks it with an index, not a scan (#331).
673
- @@index([fleetId, messageId])
916
+ @@index([fleetId, messageId, id])
674
917
  @@index([fleetId, claimedByShipId])
675
918
  @@map("deliveries")
676
919
  }
@@ -764,34 +1007,34 @@ model HealthSnapshotDelivery {
764
1007
  /// actor_ship_id is null), the ship, message and delivery it concerns, and a few
765
1008
  /// details as a flat JSON object.
766
1009
  model Event {
767
- id String @id
768
- fleetId String @map("fleet_id")
769
- type String
770
- occurredAt DateTime @map("occurred_at") @db.Timestamptz(3)
1010
+ id String @id
1011
+ fleetId String @map("fleet_id")
1012
+ type String
1013
+ occurredAt DateTime @map("occurred_at") @db.Timestamptz(3)
771
1014
  /// Who caused it (decision 0057): a ship, an account, the installation or the system.
772
- actorKind EventActorKind @default(system) @map("actor_kind")
773
- actorShipId String? @map("actor_ship_id")
1015
+ actorKind EventActorKind @default(system) @map("actor_kind")
1016
+ actorShipId String? @map("actor_ship_id")
774
1017
  /// The account that caused it, by pagasae's id only: never an email.
775
- actorAccountId String? @map("actor_account_id")
1018
+ actorAccountId String? @map("actor_account_id")
776
1019
  /// The ship that presented the account's token, a plugin's page or the gateway, if one did.
777
- actorThroughShipId String? @map("actor_through_ship_id")
1020
+ actorThroughShipId String? @map("actor_through_ship_id")
778
1021
  /// The account signed in to the console as argo when argo caused it, by its id only (decision 0054).
779
- actorSignedInAccountId String? @map("actor_signed_in_account_id")
780
- shipId String? @map("ship_id")
781
- messageId String? @map("message_id")
782
- deliveryId String? @map("delivery_id")
783
- details Json
1022
+ actorSignedInAccountId String? @map("actor_signed_in_account_id")
1023
+ shipId String? @map("ship_id")
1024
+ messageId String? @map("message_id")
1025
+ deliveryId String? @map("delivery_id")
1026
+ details Json
784
1027
  /// The event's place in its fleet's stream, in commit order and without
785
1028
  /// gaps: where a live subscription resumes. The id is not, since ids are
786
1029
  /// taken before their transaction commits.
787
- seq BigInt
1030
+ seq BigInt
788
1031
 
789
- fleet Fleet @relation(fields: [fleetId], references: [id])
790
- actorShip Ship? @relation("EventActorShip", fields: [fleetId, actorShipId], references: [fleetId, id], onDelete: Restrict)
791
- actorThroughShip Ship? @relation("EventActorThroughShip", fields: [fleetId, actorThroughShipId], references: [fleetId, id], onDelete: Restrict)
792
- ship Ship? @relation("EventShip", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
793
- message Message? @relation(fields: [fleetId, messageId], references: [fleetId, id], onDelete: Restrict)
794
- delivery Delivery? @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)
1032
+ fleet Fleet @relation(fields: [fleetId], references: [id])
1033
+ actorShip Ship? @relation("EventActorShip", fields: [fleetId, actorShipId], references: [fleetId, id], onDelete: Restrict)
1034
+ actorThroughShip Ship? @relation("EventActorThroughShip", fields: [fleetId, actorThroughShipId], references: [fleetId, id], onDelete: Restrict)
1035
+ ship Ship? @relation("EventShip", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
1036
+ message Message? @relation(fields: [fleetId, messageId], references: [fleetId, id], onDelete: Restrict)
1037
+ delivery Delivery? @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)
795
1038
 
796
1039
  @@unique([fleetId, seq])
797
1040
  /// Every foreign key has an index leading with its columns, so deleting a
@@ -810,6 +1053,10 @@ model Event {
810
1053
  @@index([fleetId, shipId, messageId], map: "events_delivery_handed_idx", where: raw("(type = 'DeliveryHanded'::text)"))
811
1054
  /// A first stuck snapshot reads each lease's turn at its oldest hour from the turn reports alone.
812
1055
  @@index([fleetId, occurredAt], map: "events_turn_reported_idx", where: raw("(type = 'TurnReported'::text)"))
1056
+ /// The pruning pass finds the mic and participant events of ended meetings (decision 0066).
1057
+ @@index([fleetId, seq], map: "events_meeting_parts_idx", where: raw("(type = ANY (ARRAY['ParticipantAdded'::text, 'ParticipantLeft'::text, 'ParticipantRejoined'::text, 'ParticipantRevoked'::text, 'MicRequested'::text, 'MicRequestWithdrawn'::text, 'MicGiven'::text, 'MicReleased'::text, 'MicTaken'::text, 'MicPatternSet'::text]))"))
1058
+ /// The pruning pass finds a crew's session and secret events past the cutoff (decision 0066).
1059
+ @@index([fleetId, occurredAt], map: "events_crew_idx", where: raw("(type = ANY (ARRAY['ShipClaimed'::text, 'LeaseRevoked'::text, 'LeasePushed'::text, 'ShipReported'::text, 'TurnReported'::text, 'StatementSet'::text, 'CrewStatusChanged'::text, 'SignInTicketIssued'::text, 'ViewerSessionStarted'::text, 'StartingPromptIssued'::text, 'CredentialRevoked'::text]))"))
813
1060
  @@map("events")
814
1061
  }
815
1062
 
@@ -921,14 +1168,19 @@ enum SignInAs {
921
1168
  @@map("sign_in_as")
922
1169
  }
923
1170
 
924
- /// The installation's settings (decision 0020): the default ship and daily message
925
- /// limits for fleets and the cap on fleets, each null for no limit. One row at most,
926
- /// and none until the installation sets them. Belongs to no fleet.
1171
+ /// The installation's settings (decision 0020): the default ship, daily message,
1172
+ /// schedules per ship and minimum schedule interval (seconds) limits and the
1173
+ /// default retention in days (decision 0066) for fleets, and the cap on fleets,
1174
+ /// each null for none. One row at most, and none until the installation sets
1175
+ /// them. Belongs to no fleet.
927
1176
  model InstallationSettings {
928
- id Int @id @default(1)
929
- defaultShipLimit Int? @map("default_ship_limit")
930
- defaultDailyMessageLimit Int? @map("default_daily_message_limit")
931
- fleetCap Int? @map("fleet_cap")
1177
+ id Int @id @default(1)
1178
+ defaultShipLimit Int? @map("default_ship_limit")
1179
+ defaultDailyMessageLimit Int? @map("default_daily_message_limit")
1180
+ defaultSchedulesPerShipLimit Int? @map("default_schedules_per_ship_limit")
1181
+ defaultMinimumScheduleInterval Int? @map("default_minimum_schedule_interval")
1182
+ defaultRetentionDays Int? @map("default_retention_days")
1183
+ fleetCap Int? @map("fleet_cap")
932
1184
 
933
1185
  @@map("installation_settings")
934
1186
  }