@aeolus-fleet/core 0.24.0 → 0.25.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 (158) hide show
  1. package/README.md +5 -5
  2. package/dist/adapters/prisma/generated/browser.d.ts +12 -3
  3. package/dist/adapters/prisma/generated/client.d.ts +12 -3
  4. package/dist/adapters/prisma/generated/commonInputTypes.d.ts +60 -0
  5. package/dist/adapters/prisma/generated/enums.d.ts +15 -1
  6. package/dist/adapters/prisma/generated/enums.js +13 -1
  7. package/dist/adapters/prisma/generated/enums.js.map +1 -1
  8. package/dist/adapters/prisma/generated/internal/class.d.ts +11 -0
  9. package/dist/adapters/prisma/generated/internal/class.js +4 -4
  10. package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
  11. package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +109 -1
  12. package/dist/adapters/prisma/generated/internal/prismaNamespace.js +16 -0
  13. package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
  14. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +17 -0
  15. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +16 -0
  16. package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
  17. package/dist/adapters/prisma/generated/models/Delivery.d.ts +304 -4
  18. package/dist/adapters/prisma/generated/models/Fleet.d.ts +267 -0
  19. package/dist/adapters/prisma/generated/models/Lease.d.ts +332 -1
  20. package/dist/adapters/prisma/generated/models/OverdueDelivery.d.ts +1687 -0
  21. package/dist/adapters/prisma/generated/models/OverdueDelivery.js +2 -0
  22. package/dist/adapters/prisma/generated/models/OverdueDelivery.js.map +1 -0
  23. package/dist/adapters/prisma/generated/models/Ship.d.ts +271 -0
  24. package/dist/adapters/prisma/generated/models.d.ts +1 -0
  25. package/dist/adapters/prisma/history.js +231 -46
  26. package/dist/adapters/prisma/history.js.map +1 -1
  27. package/dist/adapters/prisma/installation.js +30 -1
  28. package/dist/adapters/prisma/installation.js.map +1 -1
  29. package/dist/adapters/prisma/messaging.js +11 -7
  30. package/dist/adapters/prisma/messaging.js.map +1 -1
  31. package/dist/adapters/prisma/overdue.d.ts +4 -0
  32. package/dist/adapters/prisma/overdue.js +63 -0
  33. package/dist/adapters/prisma/overdue.js.map +1 -0
  34. package/dist/adapters/prisma/registry.js +32 -7
  35. package/dist/adapters/prisma/registry.js.map +1 -1
  36. package/dist/adapters/prisma/rows.d.ts +12 -1
  37. package/dist/adapters/prisma/rows.js +46 -1
  38. package/dist/adapters/prisma/rows.js.map +1 -1
  39. package/dist/adapters/prisma/unit-of-work.d.ts +2 -1
  40. package/dist/adapters/prisma/unit-of-work.js +2 -0
  41. package/dist/adapters/prisma/unit-of-work.js.map +1 -1
  42. package/dist/adapters/trpc/context.d.ts +16 -0
  43. package/dist/adapters/trpc/fleet.d.ts +232 -14
  44. package/dist/adapters/trpc/fleet.js +49 -6
  45. package/dist/adapters/trpc/fleet.js.map +1 -1
  46. package/dist/adapters/trpc/installation.d.ts +14 -0
  47. package/dist/adapters/trpc/installation.js +7 -1
  48. package/dist/adapters/trpc/installation.js.map +1 -1
  49. package/dist/adapters/trpc/router.d.ts +301 -9
  50. package/dist/adapters/trpc/ship-protocol.js +2 -2
  51. package/dist/adapters/trpc/ship-protocol.js.map +1 -1
  52. package/dist/adapters/trpc/ship.d.ts +87 -0
  53. package/dist/adapters/trpc/ship.js +96 -1
  54. package/dist/adapters/trpc/ship.js.map +1 -1
  55. package/dist/adapters/trpc/starting-prompt-text.d.ts +1 -1
  56. package/dist/adapters/trpc/starting-prompt-text.js +22 -25
  57. package/dist/adapters/trpc/starting-prompt-text.js.map +1 -1
  58. package/dist/adapters/trpc/trpc.js +3 -0
  59. package/dist/adapters/trpc/trpc.js.map +1 -1
  60. package/dist/app.d.ts +4 -2
  61. package/dist/app.js +21 -9
  62. package/dist/app.js.map +1 -1
  63. package/dist/domain/messaging/delivery.d.ts +88 -28
  64. package/dist/domain/messaging/delivery.js +213 -39
  65. package/dist/domain/messaging/delivery.js.map +1 -1
  66. package/dist/domain/messaging/dismiss-delivery.d.ts +1 -1
  67. package/dist/domain/messaging/dismiss-delivery.js +1 -1
  68. package/dist/domain/messaging/hand-over-delivery.d.ts +38 -0
  69. package/dist/domain/messaging/hand-over-delivery.js +46 -0
  70. package/dist/domain/messaging/hand-over-delivery.js.map +1 -0
  71. package/dist/domain/messaging/message.d.ts +12 -1
  72. package/dist/domain/messaging/message.js +2 -0
  73. package/dist/domain/messaging/message.js.map +1 -1
  74. package/dist/domain/messaging/overdue.d.ts +60 -0
  75. package/dist/domain/messaging/overdue.js +52 -0
  76. package/dist/domain/messaging/overdue.js.map +1 -0
  77. package/dist/domain/messaging/ports.d.ts +20 -0
  78. package/dist/domain/messaging/public.d.ts +1 -0
  79. package/dist/domain/messaging/public.js +2 -0
  80. package/dist/domain/messaging/public.js.map +1 -0
  81. package/dist/domain/messaging/push-receive-deliveries.d.ts +48 -0
  82. package/dist/domain/messaging/push-receive-deliveries.js +70 -0
  83. package/dist/domain/messaging/push-receive-deliveries.js.map +1 -0
  84. package/dist/domain/messaging/receive-deliveries.d.ts +39 -6
  85. package/dist/domain/messaging/receive-deliveries.js +80 -50
  86. package/dist/domain/messaging/receive-deliveries.js.map +1 -1
  87. package/dist/domain/messaging/report-handled.d.ts +22 -0
  88. package/dist/domain/messaging/report-handled.js +13 -0
  89. package/dist/domain/messaging/report-handled.js.map +1 -0
  90. package/dist/domain/messaging/report-not-handled.d.ts +22 -0
  91. package/dist/domain/messaging/report-not-handled.js +13 -0
  92. package/dist/domain/messaging/report-not-handled.js.map +1 -0
  93. package/dist/domain/messaging/report-turn-end.d.ts +29 -0
  94. package/dist/domain/messaging/report-turn-end.js +36 -0
  95. package/dist/domain/messaging/report-turn-end.js.map +1 -0
  96. package/dist/domain/messaging/resend-delivery.d.ts +1 -1
  97. package/dist/domain/messaging/resend-delivery.js +1 -1
  98. package/dist/domain/messaging/tell-overdue-deliveries.d.ts +25 -0
  99. package/dist/domain/messaging/tell-overdue-deliveries.js +30 -0
  100. package/dist/domain/messaging/tell-overdue-deliveries.js.map +1 -0
  101. package/dist/domain/registry/installation-fleet.d.ts +3 -2
  102. package/dist/domain/registry/installation-fleet.js.map +1 -1
  103. package/dist/domain/registry/leases.d.ts +26 -0
  104. package/dist/domain/registry/leases.js +26 -1
  105. package/dist/domain/registry/leases.js.map +1 -1
  106. package/dist/domain/registry/ping-status.d.ts +2 -2
  107. package/dist/domain/registry/ping-status.js +7 -4
  108. package/dist/domain/registry/ping-status.js.map +1 -1
  109. package/dist/domain/registry/ports.d.ts +40 -0
  110. package/dist/domain/registry/public.d.ts +2 -2
  111. package/dist/domain/registry/public.js +1 -1
  112. package/dist/domain/registry/public.js.map +1 -1
  113. package/dist/domain/registry/report-turn.d.ts +28 -0
  114. package/dist/domain/registry/report-turn.js +28 -0
  115. package/dist/domain/registry/report-turn.js.map +1 -0
  116. package/dist/domain/registry/turn.d.ts +25 -0
  117. package/dist/domain/registry/turn.js +30 -0
  118. package/dist/domain/registry/turn.js.map +1 -0
  119. package/dist/domain/shared/delivery-way.d.ts +83 -0
  120. package/dist/domain/shared/delivery-way.js +89 -0
  121. package/dist/domain/shared/delivery-way.js.map +1 -0
  122. package/dist/domain/shared/errors.d.ts +1 -1
  123. package/dist/domain/shared/errors.js.map +1 -1
  124. package/dist/domain/shared/history.d.ts +116 -19
  125. package/dist/domain/shared/history.js +1 -1
  126. package/dist/domain/shared/history.js.map +1 -1
  127. package/dist/domain/shared/read-message.d.ts +7 -3
  128. package/dist/domain/shared/read-message.js +7 -4
  129. package/dist/domain/shared/read-message.js.map +1 -1
  130. package/dist/domain/shared/read-needs-attention.d.ts +5 -5
  131. package/dist/domain/shared/read-needs-attention.js +4 -4
  132. package/dist/domain/shared/read-needs-attention.js.map +1 -1
  133. package/dist/domain/shared/read-no-ship-can-take.d.ts +13 -0
  134. package/dist/domain/shared/read-no-ship-can-take.js +12 -0
  135. package/dist/domain/shared/read-no-ship-can-take.js.map +1 -0
  136. package/dist/domain/shared/read-overdue.d.ts +13 -0
  137. package/dist/domain/shared/read-overdue.js +12 -0
  138. package/dist/domain/shared/read-overdue.js.map +1 -0
  139. package/dist/domain/shared/read-ship-messages.d.ts +4 -1
  140. package/dist/domain/shared/read-ship-messages.js +6 -1
  141. package/dist/domain/shared/read-ship-messages.js.map +1 -1
  142. package/dist/domain/shared/read-ship-way.d.ts +41 -0
  143. package/dist/domain/shared/read-ship-way.js +39 -0
  144. package/dist/domain/shared/read-ship-way.js.map +1 -0
  145. package/dist/repeating-pass.d.ts +15 -0
  146. package/dist/repeating-pass.js +31 -0
  147. package/dist/repeating-pass.js.map +1 -0
  148. package/dist/wiring.d.ts +19 -0
  149. package/dist/wiring.js +25 -0
  150. package/dist/wiring.js.map +1 -1
  151. package/package.json +2 -2
  152. package/src/adapters/prisma/migrations/20261012190000_delivery_handed/migration.sql +11 -0
  153. package/src/adapters/prisma/migrations/20261012210000_push_receive/migration.sql +7 -0
  154. package/src/adapters/prisma/migrations/20261013090000_handled/migration.sql +6 -0
  155. package/src/adapters/prisma/migrations/20261013100000_turn/migration.sql +6 -0
  156. package/src/adapters/prisma/migrations/20261013120000_overdue/migration.sql +28 -0
  157. package/src/adapters/prisma/migrations/20261013140000_delivery_state_index/migration.sql +4 -0
  158. package/src/adapters/prisma/schema.prisma +66 -4
@@ -0,0 +1,89 @@
1
+ import { OVERDUE_CLOCKS, } from '@aeolus-fleet/common';
2
+ import { isDeliveryChangeType } from './history.js';
3
+ /**
4
+ * The part that receives and hands over for a pushed lease's session: its
5
+ * trierarch, or else the plugin watcher of a session crewed by hand. A pull
6
+ * lease has none: its agent receives itself.
7
+ */
8
+ export function computerSideOf(lease) {
9
+ if (!lease.isPushed) {
10
+ return null;
11
+ }
12
+ return lease.trierarch ? { kind: 'trierarch', trierarch: lease.trierarch } : { kind: 'pluginWatcher' };
13
+ }
14
+ function isOverdueClock(value) {
15
+ return OVERDUE_CLOCKS.some((clock) => clock === value);
16
+ }
17
+ /**
18
+ * One step of a delivery's way from its event: the ship it names, where a
19
+ * hand-over's session ran, the computer side that received it or handed it
20
+ * over, and what the event's details say of it. No step for an event that is
21
+ * no delivery change.
22
+ */
23
+ export function deliveryStepOf(event, read) {
24
+ const { type, details } = event;
25
+ if (!isDeliveryChangeType(type)) {
26
+ return [];
27
+ }
28
+ const lease = typeof details.leaseId === 'string' ? read.leases.get(details.leaseId) : undefined;
29
+ const isTakenBySession = type === 'DeliveryReceived' || type === 'DeliveryHanded';
30
+ const { attempts, handOverNumber, clock, minutes } = details;
31
+ return [
32
+ {
33
+ seq: event.seq,
34
+ type,
35
+ occurredAt: event.occurredAt,
36
+ ship: type === 'MessageAccepted' || event.shipId === undefined ? null : read.party(event.shipId),
37
+ location: type === 'DeliveryHanded' && lease ? lease.location : null,
38
+ harness: type === 'DeliveryHanded' && lease ? lease.harness : null,
39
+ attempts: typeof attempts === 'number' ? attempts : null,
40
+ by: isTakenBySession && lease ? computerSideOf(lease) : null,
41
+ handOverNumber: typeof handOverNumber === 'number' ? handOverNumber : null,
42
+ isAgain: details.again === true,
43
+ isOnceMore: details.onceMore === true,
44
+ overdue: type === 'DeliveryOverdue' && isOverdueClock(clock) && typeof minutes === 'number' ? { clock, minutes } : null,
45
+ leaseEnd: type === 'DeliveryReturned' ? (lease?.endReason ?? null) : null,
46
+ },
47
+ ];
48
+ }
49
+ /** Who holds a delivery in its state: the fleet while pending, the computer side while received, the agent once handed. */
50
+ function holderOf(state, lease) {
51
+ switch (state) {
52
+ case 'pending':
53
+ return { kind: 'fleet' };
54
+ case 'received':
55
+ return lease ? computerSideOf(lease) : null;
56
+ case 'handed':
57
+ case 'acknowledged':
58
+ return { kind: 'agent' };
59
+ case 'handled':
60
+ case 'notHandled':
61
+ case 'undeliverable':
62
+ case 'dismissed':
63
+ case 'abandoned':
64
+ return null;
65
+ }
66
+ }
67
+ /** Whether a step changed the delivery's state: an overdue clock, a receive again and a hand-over once more do not. */
68
+ function isStateChange(step) {
69
+ return step.type !== 'DeliveryOverdue' && !step.isAgain && !step.isOnceMore;
70
+ }
71
+ /**
72
+ * Where a delivery stands on its way, from its state, its steps newest first,
73
+ * the lease that holds it or that it waits for, the overdue clock that stands
74
+ * and the crew request of that lease's ship.
75
+ */
76
+ export function deliveryWayOf(read) {
77
+ const { state, history, lease, overdue, crew } = read;
78
+ const entered = history.find(isStateChange);
79
+ const lastHandOver = history.find((step) => step.type === 'DeliveryHanded');
80
+ return {
81
+ holder: holderOf(state, lease),
82
+ since: entered?.occurredAt ?? history.at(-1)?.occurredAt ?? new Date(0),
83
+ isPulled: lastHandOver?.handOverNumber === null && !lastHandOver.isOnceMore,
84
+ overdue,
85
+ lease: lease && { by: computerSideOf(lease), isEnded: lease.isEnded, turn: lease.turn },
86
+ crew: lease?.trierarch ? crew : null,
87
+ };
88
+ }
89
+ //# sourceMappingURL=delivery-way.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delivery-way.js","sourceRoot":"","sources":["../../../src/domain/shared/delivery-way.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GASf,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,oBAAoB,EAA0C,MAAM,cAAc,CAAC;AAmD5F;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,KAA+C;IAC5E,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACzG,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AACzD,CAAC;AAED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AAM,UAAU,aAAa,CAAC,IAM7B;IACC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC;IAC5E,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QAC9B,KAAK,EAAE,OAAO,EAAE,UAAU,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC;QACvE,QAAQ,EAAE,YAAY,EAAE,cAAc,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU;QAC3E,OAAO;QACP,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;QACvF,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;KACrC,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type Err } from './result.js';
2
2
  /** Every reason the domain refuses a request. */
3
- export type DomainErrorKind = 'ASSIGNEE_NOT_ACTIVE' | 'CLEAR_REQUEST_LIMIT_REACHED' | 'CLEAR_REQUEST_NOT_FOUND' | 'CREW_REQUEST_ALREADY_ASSIGNED' | 'CREW_REQUEST_NOT_ASSIGNED_TO_CALLER' | 'CREW_REQUEST_NOT_FOUND' | 'CREW_REQUEST_NOT_RELEASING' | 'CREW_REQUEST_RELEASING' | 'CREW_REQUEST_FINAL' | 'CREW_REQUEST_SETTINGS_CHANGED' | 'CREW_REQUEST_SETTINGS_TOO_LARGE' | 'DELIVERY_HELD_BY_ANOTHER_SHIP' | 'DELIVERY_NOT_FOUND' | 'DELIVERY_NOT_A_PING' | 'DELIVERY_NOT_IN_FLIGHT' | 'DELIVERY_NOT_OPEN' | 'DELIVERY_NOT_UNDELIVERABLE' | 'FLEET_ALREADY_EXISTS' | 'FLEET_LIMIT_REACHED' | 'FLEET_NOT_FOUND' | 'FLEET_HAS_NO_VIEWER' | 'NOTICE_NOT_FOUND' | 'NOTICE_NOT_DISMISSIBLE' | 'GUIDE_NOT_FOUND' | 'GUIDE_STEP_NOT_FOUND' | 'IDEMPOTENCY_KEY_REUSED' | 'IN_REPLY_TO_NOT_FOUND' | 'MESSAGE_LIMIT_REACHED' | 'MODEL_REQUIRED' | 'INVALID_HARNESS' | 'MODEL_FROM_ARGO' | 'INVALID_CONTENT_TYPE' | 'INVALID_EMAIL' | 'INVALID_FLEET_NAME' | 'INVALID_FOLLOW_MAX' | 'INVALID_FOLLOW_WAIT' | 'INVALID_IDEMPOTENCY_KEY' | 'INVALID_INBOX_WAIT' | 'INVALID_LABEL_KEY' | 'INVALID_LABEL_VALUE' | 'INVALID_LABEL_VALUES' | 'INVALID_LIMIT' | 'INVALID_LOCATION' | 'INVALID_NETWORK_RULES' | 'INVALID_PASSWORD' | 'INVALID_RECEIVE_MAX' | 'INVALID_CREW_REQUEST_REASON' | 'INVALID_REPORT_DETAILS' | 'INVALID_REPORT_NOTE' | 'INVALID_REPORT_STATE' | 'INVALID_SHIP_NAME' | 'INVALID_SHIP_NOTE' | 'INVALID_SHIP_TYPE' | 'LABEL_CARRIED' | 'LABEL_KEY_TAKEN' | 'LABEL_NOT_FOUND' | 'LABEL_VALUE_CARRIED' | 'LABEL_VALUE_NOT_FOUND' | 'LEASE_ENDED' | 'MESSAGE_NOT_FOUND' | 'NETWORK_PLUGIN_REGISTERED' | 'NOT_A_TRIERARCH' | 'NOT_THE_LABEL_OWNER' | 'NOT_REACHABLE' | 'NOT_THE_NETWORK_PLUGIN' | 'NOT_THE_OPERATOR_SHIP' | 'OPERATOR_EMAIL_TAKEN' | 'OPERATOR_HAS_NO_PASSWORD' | 'OPERATOR_SHIP_GETS_NO_STARTING_PROMPT' | 'OPERATOR_SHIP_HAS_NO_SECRET' | 'OPERATOR_SHIP_IS_NOT_PINGED' | 'OPERATOR_SHIP_IS_PERMANENT' | 'PAYLOAD_TOO_LARGE' | 'PING_NOT_RESENT' | 'REPORT_DETAILS_TOO_LARGE' | 'RESERVED_CONTENT_TYPE' | 'SHIP_ALREADY_RETIRED' | 'SHIP_NAME_RESERVED' | 'SHIP_NAME_TAKEN' | 'SHIP_NOT_AWAITING_CREW' | 'SHIP_NOT_CREWED' | 'SHIP_LABEL_LIMIT_REACHED' | 'SHIP_LIMIT_REACHED' | 'SHIP_NOT_FOUND' | 'SIGN_IN_TICKET_INVALID' | 'UNKNOWN_CREW_TOKEN' | 'UNRESOLVABLE_SELECTOR' | 'WRONG_EMAIL_OR_PASSWORD' | 'WRONG_SHIP_ID_OR_SECRET';
3
+ export type DomainErrorKind = 'ASSIGNEE_NOT_ACTIVE' | 'CLEAR_REQUEST_LIMIT_REACHED' | 'CLEAR_REQUEST_NOT_FOUND' | 'CREW_REQUEST_ALREADY_ASSIGNED' | 'CREW_REQUEST_NOT_ASSIGNED_TO_CALLER' | 'CREW_REQUEST_NOT_FOUND' | 'CREW_REQUEST_NOT_RELEASING' | 'CREW_REQUEST_RELEASING' | 'CREW_REQUEST_FINAL' | 'CREW_REQUEST_SETTINGS_CHANGED' | 'CREW_REQUEST_SETTINGS_TOO_LARGE' | 'DELIVERY_HANDED_ONCE_MORE' | 'DELIVERY_HELD_BY_ANOTHER_SHIP' | 'DELIVERY_NOT_FOUND' | 'DELIVERY_NOT_A_PING' | 'DELIVERY_NOT_ACKNOWLEDGED' | 'DELIVERY_NOT_HANDED_ONCE_MORE' | 'DELIVERY_NOT_IN_FLIGHT' | 'DELIVERY_NOT_OPEN' | 'DELIVERY_NOT_UNDELIVERABLE' | 'FLEET_ALREADY_EXISTS' | 'FLEET_LIMIT_REACHED' | 'FLEET_NOT_FOUND' | 'FLEET_HAS_NO_VIEWER' | 'NOTICE_NOT_FOUND' | 'NOTICE_NOT_DISMISSIBLE' | 'GUIDE_NOT_FOUND' | 'GUIDE_STEP_NOT_FOUND' | 'IDEMPOTENCY_KEY_REUSED' | 'IN_REPLY_TO_NOT_FOUND' | 'MESSAGE_LIMIT_REACHED' | 'MODEL_REQUIRED' | 'INVALID_HARNESS' | 'MODEL_FROM_ARGO' | 'INVALID_CONTENT_TYPE' | 'INVALID_EMAIL' | 'INVALID_FLEET_NAME' | 'INVALID_FOLLOW_MAX' | 'INVALID_FOLLOW_WAIT' | 'INVALID_IDEMPOTENCY_KEY' | 'INVALID_INBOX_WAIT' | 'INVALID_LABEL_KEY' | 'INVALID_LABEL_VALUE' | 'INVALID_LABEL_VALUES' | 'INVALID_LIMIT' | 'INVALID_LOCATION' | 'INVALID_NETWORK_RULES' | 'INVALID_PASSWORD' | 'INVALID_RECEIVE_MAX' | 'INVALID_CREW_REQUEST_REASON' | 'INVALID_REPORT_DETAILS' | 'INVALID_REPORT_NOTE' | 'INVALID_REPORT_STATE' | 'INVALID_SHIP_NAME' | 'INVALID_SHIP_NOTE' | 'INVALID_SHIP_TYPE' | 'LABEL_CARRIED' | 'LABEL_KEY_TAKEN' | 'LABEL_NOT_FOUND' | 'LABEL_VALUE_CARRIED' | 'LABEL_VALUE_NOT_FOUND' | 'LEASE_ENDED' | 'MESSAGE_NOT_FOUND' | 'NETWORK_PLUGIN_REGISTERED' | 'NOT_A_TRIERARCH' | 'NOT_THE_LABEL_OWNER' | 'NOT_REACHABLE' | 'NOT_THE_NETWORK_PLUGIN' | 'NOT_THE_OPERATOR_SHIP' | 'OPERATOR_EMAIL_TAKEN' | 'OPERATOR_HAS_NO_PASSWORD' | 'OPERATOR_SHIP_GETS_NO_STARTING_PROMPT' | 'OPERATOR_SHIP_HAS_NO_SECRET' | 'OPERATOR_SHIP_IS_NOT_PINGED' | 'OPERATOR_SHIP_IS_PERMANENT' | 'PAYLOAD_TOO_LARGE' | 'PING_NOT_RESENT' | 'REPORT_DETAILS_TOO_LARGE' | 'RESERVED_CONTENT_TYPE' | 'SHIP_ALREADY_RETIRED' | 'SHIP_NAME_RESERVED' | 'SHIP_NAME_TAKEN' | 'SHIP_NOT_AWAITING_CREW' | 'SHIP_NOT_CREWED' | 'SHIP_LABEL_LIMIT_REACHED' | 'SHIP_LIMIT_REACHED' | 'SHIP_NOT_FOUND' | 'SIGN_IN_TICKET_INVALID' | 'UNKNOWN_CREW_TOKEN' | 'UNRESOLVABLE_SELECTOR' | 'WRONG_EMAIL_OR_PASSWORD' | 'WRONG_SHIP_ID_OR_SECRET';
4
4
  /**
5
5
  * Why the domain refused a request. Adapters map the kind to their own error
6
6
  * shape (a tRPC code, an exit code); the message is safe to show a caller.
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domain/shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAY,MAAM,aAAa,CAAC;AAuG5C,qDAAqD;AACrD,MAAM,UAAU,MAAM,CAA4B,IAAO,EAAE,OAAe;IACxE,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domain/shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAY,MAAM,aAAa,CAAC;AA0G5C,qDAAqD;AACrD,MAAM,UAAU,MAAM,CAA4B,IAAO,EAAE,OAAe;IACxE,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAChC,CAAC"}
@@ -1,5 +1,7 @@
1
- import { DELIVERY_HISTORY_TYPES, type InboxFilter, type DeliveryId, type DeliveryState, type EventId, type EventType, type FleetId, type MessageId, type ShipId } from '@aeolus-fleet/common';
1
+ import { DELIVERY_HISTORY_TYPES, type ComputerSide, type LeaseEndReason, type InboxFilter, type DeliveryId, type DeliveryState, type EventId, type EventType, type FleetId, type MessageId, type ShipId } from '@aeolus-fleet/common';
2
+ import type { OverdueClock, WaitingState } from '../messaging/public.js';
2
3
  import type { Location } from '../registry/public.js';
4
+ import type { StandingOverdue, WayCrew, WayLease } from './delivery-way.js';
3
5
  import type { EventDetails } from './events.js';
4
6
  /**
5
7
  * What the console reads: a ship's timeline from the event log, its
@@ -52,9 +54,17 @@ export declare function withPing<T extends {
52
54
  export type ShownTimelineEntry = Omit<TimelineEntry, 'message'> & {
53
55
  message: WithPing<NonNullable<TimelineEntry['message']>> | null;
54
56
  };
55
- /** An undeliverable delivery as Needs attention answers it, its message telling whether it is a ping. */
56
- export type ShownUndeliverableEntry = Omit<UndeliverableEntry, 'message'> & {
57
- message: WithPing<UndeliverableEntry['message']>;
57
+ /** A delivery no ship can take as it is answered, its message telling whether it is a ping. */
58
+ export type ShownNoShipCanTakeEntry = Omit<NoShipCanTakeEntry, 'message'> & {
59
+ message: WithPing<NoShipCanTakeEntry['message']>;
60
+ };
61
+ /** An overdue delivery as it is answered, its message telling whether it is a ping. */
62
+ export type ShownOverdueEntry = Omit<OverdueEntry, 'message'> & {
63
+ message: WithPing<OverdueEntry['message']>;
64
+ };
65
+ /** A delivery in Needs attention as it is answered, its message telling whether it is a ping. */
66
+ export type ShownNeedsAttentionEntry = Omit<NeedsAttentionEntry, 'message'> & {
67
+ message: WithPing<NeedsAttentionEntry['message']>;
58
68
  };
59
69
  /** One message with its delivery as it stands. */
60
70
  export interface HistoryMessage {
@@ -72,33 +82,112 @@ export interface HistoryMessage {
72
82
  state: DeliveryState;
73
83
  attempts: number;
74
84
  claimedBy: HistoryParty | null;
85
+ /** The number of its last hand-over by a pushed crew's computer side; null when a plain receive or a push receive took it last, or before any. */
86
+ handOverNumber: number | null;
75
87
  };
76
88
  }
77
- /** The events that change a delivery: stored, claimed, returned, acknowledged or undeliverable. */
89
+ /** The events of a delivery's way: stored, received, handed, returned, acknowledged, handled or not, overdue, and its dead ends. */
78
90
  export type DeliveryChangeType = (typeof DELIVERY_HISTORY_TYPES)[number];
79
91
  export declare function isDeliveryChangeType(type: EventType): type is DeliveryChangeType;
80
- /** One change to a delivery. */
92
+ /** One step of a delivery's way. */
81
93
  export interface DeliveryChange {
82
94
  seq: number;
83
95
  type: DeliveryChangeType;
84
96
  occurredAt: Date;
85
- /** The ship that claimed, returned or acknowledged it; null when it was stored. */
97
+ /** The ship that received, was handed, returned or acknowledged it; null when it was stored. */
86
98
  ship: HistoryParty | null;
87
- /** Where the claiming session ran, for a claim. */
99
+ /** Where the claiming session ran, for a hand-over. */
88
100
  location: Location | null;
89
- /** The harness the claiming session ran in, for a claim. */
101
+ /** The harness the claiming session ran in, for a hand-over. */
90
102
  harness: string | null;
91
- /** The claims counted by then, where the event records them. */
103
+ /** The attempts counted by then, where the event records them. */
92
104
  attempts: number | null;
105
+ /** The computer side that received it or handed it over, on a pushed lease. */
106
+ by: ComputerSide | null;
107
+ /** The number of a pushed hand-over; none for a plain receive's. */
108
+ handOverNumber: number | null;
109
+ /** A push receive of a delivery its crew already held. */
110
+ isAgain: boolean;
111
+ /** A confirmed message handed once more after its turn died. */
112
+ isOnceMore: boolean;
113
+ /** Which clock ran out and after how long, for DeliveryOverdue. */
114
+ overdue: {
115
+ clock: OverdueClock;
116
+ minutes: number;
117
+ } | null;
118
+ /** Why its lease ended, for DeliveryReturned. */
119
+ leaseEnd: LeaseEndReason | null;
120
+ }
121
+ /** A reply to a message. */
122
+ export interface HistoryReply {
123
+ id: MessageId;
124
+ sender: HistoryParty;
125
+ sentAt: Date;
93
126
  }
94
- /** An undeliverable delivery, for Needs attention: its claims, since when, and its whole message. */
95
- export interface UndeliverableEntry {
127
+ /**
128
+ * One message as the history reads it: its delivery's steps newest first,
129
+ * its replies oldest first, and what its way is read from: the lease that
130
+ * holds it or that a pending delivery to one ship waits for, the overdue
131
+ * clock that stands, and the crew request of that lease's ship.
132
+ */
133
+ export type MessageRead = HistoryMessage & {
134
+ history: DeliveryChange[];
135
+ replies: HistoryReply[];
136
+ lease: WayLease | null;
137
+ overdue: StandingOverdue | null;
138
+ crew: WayCrew | null;
139
+ };
140
+ /**
141
+ * What a ship's side of the way is read from (#756): the open lease of the
142
+ * session crewing it, and the messages whose deliveries wait for it, oldest
143
+ * sent first. A delivery waits for it as the clocks count it: pending for the
144
+ * ship or for a type it may take, or received or handed with its open lease.
145
+ * Nothing waits while no session crews it.
146
+ */
147
+ export interface ShipWayRead {
148
+ lease: WayLease | null;
149
+ waiting: MessageId[];
150
+ }
151
+ /**
152
+ * A delivery in Needs attention: undeliverable, or not handled after its turn
153
+ * died twice (decision 0040). Its claims, since when, and its whole message.
154
+ */
155
+ export interface NeedsAttentionEntry {
96
156
  deliveryId: DeliveryId;
157
+ state: NeedsAttentionState;
97
158
  attempts: number;
98
- /** When it became undeliverable. */
159
+ /** A pushed crew's computer side handed it over, with numbers; false when plain receives handed it. */
160
+ isPushed: boolean;
161
+ /** When it became undeliverable, or was reported not handled. */
99
162
  since: Date;
100
163
  message: Omit<HistoryMessage, 'delivery'>;
101
164
  }
165
+ /** The delivery states Needs attention lists, each waiting for the operator to resend or dismiss it. */
166
+ export type NeedsAttentionState = Extract<DeliveryState, 'undeliverable' | 'notHandled'>;
167
+ /**
168
+ * A delivery argo was told is overdue (decision 0040): the ship whose clock
169
+ * ran out, the state it waits in, which clock, when argo was told, and its
170
+ * whole message. Listed until it clears by itself.
171
+ */
172
+ export interface OverdueEntry {
173
+ deliveryId: DeliveryId;
174
+ ship: HistoryParty;
175
+ state: WaitingState;
176
+ clock: OverdueClock;
177
+ minutes: number;
178
+ toldAt: Date;
179
+ message: Omit<HistoryMessage, 'delivery'>;
180
+ }
181
+ /**
182
+ * A pending delivery to a type no active ship can take (decision 0041): none
183
+ * of the type is left, or none of the ships its sender may reach (decision
184
+ * 0034). Its type and its whole message; listed until a ship can take it.
185
+ */
186
+ export interface NoShipCanTakeEntry {
187
+ deliveryId: DeliveryId;
188
+ type: string;
189
+ message: Omit<HistoryMessage, 'delivery'>;
190
+ }
102
191
  /** A reply the inbox's ship sent to a message in its inbox. */
103
192
  export interface InboxReply {
104
193
  id: MessageId;
@@ -139,12 +228,20 @@ export interface ShipHistory {
139
228
  shipId: ShipId;
140
229
  limit: number;
141
230
  }): Promise<HistoryMessage[] | undefined>;
142
- /** The message, with its delivery's changes newest first. */
143
- message(fleetId: FleetId, messageId: MessageId): Promise<(HistoryMessage & {
144
- history: DeliveryChange[];
145
- }) | undefined>;
146
- /** Every undeliverable delivery, oldest first by when it became undeliverable. */
147
- undeliverable(fleetId: FleetId): Promise<UndeliverableEntry[]>;
231
+ /** The message, with its delivery's steps newest first and what its way is read from. */
232
+ message(fleetId: FleetId, messageId: MessageId): Promise<MessageRead | undefined>;
233
+ /** Every undeliverable or not handled delivery, oldest first by since when. */
234
+ needsAttention(fleetId: FleetId): Promise<NeedsAttentionEntry[]>;
235
+ /**
236
+ * Every delivery argo was told is overdue that still stands, oldest told
237
+ * first: still in the state it was told in, on the lease it was told on,
238
+ * which has not ended.
239
+ */
240
+ overdue(fleetId: FleetId): Promise<OverdueEntry[]>;
241
+ /** Every pending delivery to a type no active ship can take, oldest sent first. */
242
+ noShipCanTake(fleetId: FleetId): Promise<NoShipCanTakeEntry[]>;
243
+ /** What the ship's side of the way is read from: the open lease of the session crewing it and what waits for it. */
244
+ shipWay(fleetId: FleetId, shipId: ShipId): Promise<ShipWayRead | undefined>;
148
245
  /** The messages addressed to the ship itself that the filter keeps, newest first. */
149
246
  inbox(fleetId: FleetId, query: {
150
247
  shipId: ShipId;
@@ -9,7 +9,7 @@ export function isDeliveryChangeType(type) {
9
9
  export function isKeptBy(filter, state) {
10
10
  switch (filter) {
11
11
  case 'open':
12
- return state === 'pending' || state === 'delivered';
12
+ return state === 'pending' || state === 'received' || state === 'handed';
13
13
  case 'done':
14
14
  return state === 'acknowledged';
15
15
  case 'all':
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/domain/shared/history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GASlB,MAAM,sBAAsB,CAAC;AAsC9B,MAAM,UAAU,QAAQ,CAAoC,OAAU;IACpE,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;AACxE,CAAC;AAyBD,MAAM,UAAU,oBAAoB,CAAC,IAAe;IAClD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAClE,CAAC;AAiDD,+FAA+F;AAC/F,MAAM,UAAU,QAAQ,CAAC,MAAmB,EAAE,KAAoB;IAChE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,CAAC;QACtD,KAAK,MAAM;YACT,OAAO,KAAK,KAAK,cAAc,CAAC;QAClC,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/domain/shared/history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAWlB,MAAM,sBAAsB,CAAC;AAwC9B,MAAM,UAAU,QAAQ,CAAoC,OAAU;IACpE,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;AACxE,CAAC;AAsCD,MAAM,UAAU,oBAAoB,CAAC,IAAe;IAClD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAClE,CAAC;AAiID,+FAA+F;AAC/F,MAAM,UAAU,QAAQ,CAAC,MAAmB,EAAE,KAAoB;IAChE,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,QAAQ,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,KAAK,KAAK,cAAc,CAAC;QAClC,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -1,10 +1,13 @@
1
1
  import type { MessageId } from '@aeolus-fleet/common';
2
2
  import type { Caller } from './caller.js';
3
3
  import { type DomainError } from './errors.js';
4
- import type { DeliveryChange, HistoryMessage, ShipHistory } from './history.js';
4
+ import { type DeliveryWay } from './delivery-way.js';
5
+ import type { DeliveryChange, HistoryMessage, HistoryReply, ShipHistory } from './history.js';
5
6
  import { type Result } from './result.js';
6
7
  export type MessageDetail = HistoryMessage & {
8
+ replies: HistoryReply[];
7
9
  delivery: HistoryMessage['delivery'] & {
10
+ way: DeliveryWay;
8
11
  history: DeliveryChange[];
9
12
  };
10
13
  };
@@ -13,8 +16,9 @@ export type ReadMessage = (caller: Caller, input: {
13
16
  }) => Promise<Result<MessageDetail, DomainError<'MESSAGE_NOT_FOUND'>>>;
14
17
  /**
15
18
  * Use case: one message of the caller's fleet: its envelope, its whole
16
- * payload, and its delivery with every change newest first, from the event
17
- * log. The caller's scope (fleet:read) is checked before this runs.
19
+ * payload, its replies, and its delivery's way through: who holds it, since
20
+ * when, the clocks that speak for it and every step newest first, from the
21
+ * event log. The caller's scope (fleet:read) is checked before this runs.
18
22
  */
19
23
  export declare function createReadMessage(deps: {
20
24
  history: ShipHistory;
@@ -1,9 +1,11 @@
1
1
  import { refuse } from './errors.js';
2
+ import { deliveryWayOf } from './delivery-way.js';
2
3
  import { ok } from './result.js';
3
4
  /**
4
5
  * Use case: one message of the caller's fleet: its envelope, its whole
5
- * payload, and its delivery with every change newest first, from the event
6
- * log. The caller's scope (fleet:read) is checked before this runs.
6
+ * payload, its replies, and its delivery's way through: who holds it, since
7
+ * when, the clocks that speak for it and every step newest first, from the
8
+ * event log. The caller's scope (fleet:read) is checked before this runs.
7
9
  */
8
10
  export function createReadMessage(deps) {
9
11
  return async (caller, { messageId }) => {
@@ -11,8 +13,9 @@ export function createReadMessage(deps) {
11
13
  if (!found) {
12
14
  return refuse('MESSAGE_NOT_FOUND', `No message ${messageId} in this fleet`);
13
15
  }
14
- const { history, ...message } = found;
15
- return ok({ ...message, delivery: { ...message.delivery, history } });
16
+ const { history, replies, lease, overdue, crew, ...message } = found;
17
+ const way = deliveryWayOf({ state: message.delivery.state, history, lease, overdue, crew });
18
+ return ok({ ...message, replies, delivery: { ...message.delivery, way, history } });
16
19
  };
17
20
  }
18
21
  //# sourceMappingURL=read-message.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-message.js","sourceRoot":"","sources":["../../../src/domain/shared/read-message.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AAS9C;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA8B;IAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,MAAM,CAAC,mBAAmB,EAAE,cAAc,SAAS,gBAAgB,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC;QACtC,OAAO,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"read-message.js","sourceRoot":"","sources":["../../../src/domain/shared/read-message.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,aAAa,EAAoB,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AAY9C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA8B;IAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACpE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,MAAM,CAAC,mBAAmB,EAAE,cAAc,SAAS,gBAAgB,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC;QACrE,MAAM,GAAG,GAAG,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5F,OAAO,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC;AACJ,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import type { Caller } from './caller.js';
2
- import { type ShipHistory, type ShownUndeliverableEntry } from './history.js';
3
- export type ReadNeedsAttention = (caller: Caller) => Promise<ShownUndeliverableEntry[]>;
2
+ import { type ShipHistory, type ShownNeedsAttentionEntry } from './history.js';
3
+ export type ReadNeedsAttention = (caller: Caller) => Promise<ShownNeedsAttentionEntry[]>;
4
4
  /**
5
- * Use case: Needs attention, every undeliverable delivery of the caller's
6
- * fleet, oldest first, each with its whole message, telling whether it is a
7
- * ping, for the operator to resend or dismiss. Abandoned deliveries are never listed: they stay in the
5
+ * Use case: Needs attention, every undeliverable or not handled delivery of
6
+ * the caller's fleet, oldest first, each with its state and whole message,
7
+ * telling whether it is a ping, for the operator to resend or dismiss. Abandoned deliveries are never listed: they stay in the
8
8
  * timelines only. The caller's scope (fleet:read) is checked before this runs.
9
9
  */
10
10
  export declare function createReadNeedsAttention(deps: {
@@ -1,11 +1,11 @@
1
1
  import { withPing } from './history.js';
2
2
  /**
3
- * Use case: Needs attention, every undeliverable delivery of the caller's
4
- * fleet, oldest first, each with its whole message, telling whether it is a
5
- * ping, for the operator to resend or dismiss. Abandoned deliveries are never listed: they stay in the
3
+ * Use case: Needs attention, every undeliverable or not handled delivery of
4
+ * the caller's fleet, oldest first, each with its state and whole message,
5
+ * telling whether it is a ping, for the operator to resend or dismiss. Abandoned deliveries are never listed: they stay in the
6
6
  * timelines only. The caller's scope (fleet:read) is checked before this runs.
7
7
  */
8
8
  export function createReadNeedsAttention(deps) {
9
- return async (caller) => (await deps.history.undeliverable(caller.fleetId)).map((entry) => ({ ...entry, message: withPing(entry.message) }));
9
+ return async (caller) => (await deps.history.needsAttention(caller.fleetId)).map((entry) => ({ ...entry, message: withPing(entry.message) }));
10
10
  }
11
11
  //# sourceMappingURL=read-needs-attention.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-needs-attention.js","sourceRoot":"","sources":["../../../src/domain/shared/read-needs-attention.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAkD,MAAM,cAAc,CAAC;AAIxF;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAA8B;IACrE,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/I,CAAC"}
1
+ {"version":3,"file":"read-needs-attention.js","sourceRoot":"","sources":["../../../src/domain/shared/read-needs-attention.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmD,MAAM,cAAc,CAAC;AAIzF;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAA8B;IACrE,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAChJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Caller } from './caller.js';
2
+ import { type ShipHistory, type ShownNoShipCanTakeEntry } from './history.js';
3
+ export type ReadNoShipCanTake = (caller: Caller) => Promise<ShownNoShipCanTakeEntry[]>;
4
+ /**
5
+ * Use case: the pending deliveries of the caller's fleet to a type no active
6
+ * ship can take (decision 0041), oldest sent first, for Needs attention. Each
7
+ * clears by itself once a ship of the type can take it; there is nothing to
8
+ * resend or dismiss. The caller's scope (fleet:read) is checked before this
9
+ * runs.
10
+ */
11
+ export declare function createReadNoShipCanTake(deps: {
12
+ history: ShipHistory;
13
+ }): ReadNoShipCanTake;
@@ -0,0 +1,12 @@
1
+ import { withPing } from './history.js';
2
+ /**
3
+ * Use case: the pending deliveries of the caller's fleet to a type no active
4
+ * ship can take (decision 0041), oldest sent first, for Needs attention. Each
5
+ * clears by itself once a ship of the type can take it; there is nothing to
6
+ * resend or dismiss. The caller's scope (fleet:read) is checked before this
7
+ * runs.
8
+ */
9
+ export function createReadNoShipCanTake(deps) {
10
+ return async (caller) => (await deps.history.noShipCanTake(caller.fleetId)).map((entry) => ({ ...entry, message: withPing(entry.message) }));
11
+ }
12
+ //# sourceMappingURL=read-no-ship-can-take.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-no-ship-can-take.js","sourceRoot":"","sources":["../../../src/domain/shared/read-no-ship-can-take.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAkD,MAAM,cAAc,CAAC;AAIxF;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA8B;IACpE,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/I,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Caller } from './caller.js';
2
+ import { type ShipHistory, type ShownOverdueEntry } from './history.js';
3
+ export type ReadOverdue = (caller: Caller) => Promise<ShownOverdueEntry[]>;
4
+ /**
5
+ * Use case: the deliveries of the caller's fleet argo was told are overdue by
6
+ * the 10 and 60 minute clocks (decision 0040), oldest told first, for Needs
7
+ * attention. Each clears by itself once its delivery leaves the state it was
8
+ * told in or its lease ends; there is nothing to resend or dismiss. The
9
+ * caller's scope (fleet:read) is checked before this runs.
10
+ */
11
+ export declare function createReadOverdue(deps: {
12
+ history: ShipHistory;
13
+ }): ReadOverdue;
@@ -0,0 +1,12 @@
1
+ import { withPing } from './history.js';
2
+ /**
3
+ * Use case: the deliveries of the caller's fleet argo was told are overdue by
4
+ * the 10 and 60 minute clocks (decision 0040), oldest told first, for Needs
5
+ * attention. Each clears by itself once its delivery leaves the state it was
6
+ * told in or its lease ends; there is nothing to resend or dismiss. The
7
+ * caller's scope (fleet:read) is checked before this runs.
8
+ */
9
+ export function createReadOverdue(deps) {
10
+ return async (caller) => (await deps.history.overdue(caller.fleetId)).map((entry) => ({ ...entry, message: withPing(entry.message) }));
11
+ }
12
+ //# sourceMappingURL=read-overdue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-overdue.js","sourceRoot":"","sources":["../../../src/domain/shared/read-overdue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAA4C,MAAM,cAAc,CAAC;AAIlF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAA8B;IAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACzI,CAAC"}
@@ -10,7 +10,10 @@ export declare const PREVIEW_LENGTH = 120;
10
10
  /** A message as the ship page lists it: its payload cut to a preview. */
11
11
  export type ListedMessage = Omit<HistoryMessage, 'payload' | 'delivery'> & {
12
12
  preview: string;
13
- delivery: Omit<HistoryMessage['delivery'], 'attempts'>;
13
+ delivery: Omit<HistoryMessage['delivery'], 'attempts' | 'handOverNumber'> & {
14
+ /** Handed by a plain receive, with no hand-over number: it reads handed (pulled). False in every other state. */
15
+ isPulled: boolean;
16
+ };
14
17
  };
15
18
  export type ReadShipMessages = (caller: Caller, input: {
16
19
  shipId: ShipId;
@@ -23,7 +23,12 @@ export function createReadShipMessages(deps) {
23
23
  return ok(messages.map(({ payload, delivery, ...message }) => ({
24
24
  ...message,
25
25
  preview: previewOf(payload),
26
- delivery: { id: delivery.id, state: delivery.state, claimedBy: delivery.claimedBy },
26
+ delivery: {
27
+ id: delivery.id,
28
+ state: delivery.state,
29
+ claimedBy: delivery.claimedBy,
30
+ isPulled: delivery.state === 'handed' && delivery.handOverNumber === null,
31
+ },
27
32
  })));
28
33
  };
29
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"read-ship-messages.js","sourceRoot":"","sources":["../../../src/domain/shared/read-ship-messages.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAoB,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AAE9C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAalC,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AACtE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAA8B;IACnE,OAAO,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;QAChG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,MAAM,CAAC,gBAAgB,EAAE,WAAW,MAAM,gBAAgB,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,EAAE,CACP,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,EA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EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;YACnD,GAAG,OAAO;YACV,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC;YAC3B,QAAQ,EAAE;gBACR,EAAE,EAAE,QAAQ,CAAC,EAAE;gBACf,KAAK,EAAE,QAAQ,CAAC,KAAK;gBACrB,SAAS,EAAE,QAAQ,CAAC,SAAS;gBAC7B,QAAQ,EAAE,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,cAAc,KAAK,IAAI;aAC1E;SACF,CAAC,CAAC,CACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ComputerSide, DeliveryId, DeliveryState, MessageId, ShipId } from '@aeolus-fleet/common';
2
+ import type { Caller } from './caller.js';
3
+ import { type DeliveryWay, type WayLease } from './delivery-way.js';
4
+ import { type DomainError } from './errors.js';
5
+ import type { ShipHistory } from './history.js';
6
+ import { type Result } from './result.js';
7
+ /** The ship's side of the way (#756): which part serves it, its turn, and what waits for it. */
8
+ export interface ShipWay {
9
+ /** The open lease's computer side (none: a pull lease) and its turn; null while no session crews the ship. */
10
+ lease: {
11
+ by: ComputerSide | null;
12
+ turn: WayLease['turn'];
13
+ } | null;
14
+ /** How many deliveries wait for it. */
15
+ waiting: number;
16
+ /** The oldest one waiting, sent first, with its way; null when none waits. */
17
+ oldest: {
18
+ messageId: MessageId;
19
+ sentAt: Date;
20
+ contentType: string;
21
+ delivery: {
22
+ id: DeliveryId;
23
+ state: DeliveryState;
24
+ attempts: number;
25
+ way: DeliveryWay;
26
+ };
27
+ } | null;
28
+ }
29
+ export type ReadShipWay = (caller: Caller, input: {
30
+ shipId: ShipId;
31
+ }) => Promise<Result<ShipWay, DomainError<'SHIP_NOT_FOUND'>>>;
32
+ /**
33
+ * Use case: one ship's side of the way: the trierarch or plugin watcher that
34
+ * receives and hands over for its pushed lease, or none on a pull lease, the
35
+ * turn its hooks reported, and its oldest delivery waiting, with its way, as
36
+ * the clocks count it. The caller's scope (fleet:read) is checked before this
37
+ * runs.
38
+ */
39
+ export declare function createReadShipWay(deps: {
40
+ history: ShipHistory;
41
+ }): ReadShipWay;
@@ -0,0 +1,39 @@
1
+ import { computerSideOf, deliveryWayOf } from './delivery-way.js';
2
+ import { refuse } from './errors.js';
3
+ import { ok } from './result.js';
4
+ /**
5
+ * Use case: one ship's side of the way: the trierarch or plugin watcher that
6
+ * receives and hands over for its pushed lease, or none on a pull lease, the
7
+ * turn its hooks reported, and its oldest delivery waiting, with its way, as
8
+ * the clocks count it. The caller's scope (fleet:read) is checked before this
9
+ * runs.
10
+ */
11
+ export function createReadShipWay(deps) {
12
+ return async (caller, { shipId }) => {
13
+ const found = await deps.history.shipWay(caller.fleetId, shipId);
14
+ if (!found) {
15
+ return refuse('SHIP_NOT_FOUND', `No ship ${shipId} in this fleet`);
16
+ }
17
+ const { lease, waiting } = found;
18
+ const [oldestId] = waiting;
19
+ const oldest = oldestId === undefined ? undefined : await deps.history.message(caller.fleetId, oldestId);
20
+ return ok({
21
+ lease: lease && { by: computerSideOf(lease), turn: lease.turn },
22
+ waiting: waiting.length,
23
+ oldest: oldest
24
+ ? {
25
+ messageId: oldest.id,
26
+ sentAt: oldest.sentAt,
27
+ contentType: oldest.contentType,
28
+ delivery: {
29
+ id: oldest.delivery.id,
30
+ state: oldest.delivery.state,
31
+ attempts: oldest.delivery.attempts,
32
+ way: deliveryWayOf({ state: oldest.delivery.state, history: oldest.history, lease: oldest.lease, overdue: oldest.overdue, crew: oldest.crew }),
33
+ },
34
+ }
35
+ : null,
36
+ });
37
+ };
38
+ }
39
+ //# sourceMappingURL=read-ship-way.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-ship-way.js","sourceRoot":"","sources":["../../../src/domain/shared/read-ship-way.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAmC,MAAM,mBAAmB,CAAC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