@aeolus-fleet/core 0.38.3 → 0.38.5
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.
- package/dist/adapters/prisma/generated/browser.d.ts +8 -0
- package/dist/adapters/prisma/generated/client.d.ts +8 -0
- package/dist/adapters/prisma/generated/internal/class.d.ts +11 -0
- package/dist/adapters/prisma/generated/internal/class.js +4 -4
- package/dist/adapters/prisma/generated/internal/class.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespace.d.ts +85 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js +8 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +9 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +8 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
- package/dist/adapters/prisma/generated/models/CrewRequest.d.ts +218 -1
- package/dist/adapters/prisma/generated/models/Fleet.d.ts +495 -0
- package/dist/adapters/prisma/generated/models/PrunedExchange.d.ts +1339 -0
- package/dist/adapters/prisma/generated/models/PrunedExchange.js +2 -0
- package/dist/adapters/prisma/generated/models/PrunedExchange.js.map +1 -0
- package/dist/adapters/prisma/generated/models/Ship.d.ts +1421 -150
- package/dist/adapters/prisma/generated/models.d.ts +1 -0
- package/dist/adapters/prisma/history-pruner.js +14 -1
- package/dist/adapters/prisma/history-pruner.js.map +1 -1
- package/dist/adapters/prisma/pruned-exchanges.d.ts +16 -0
- package/dist/adapters/prisma/pruned-exchanges.js +18 -0
- package/dist/adapters/prisma/pruned-exchanges.js.map +1 -0
- package/dist/adapters/prisma/registry.d.ts +10 -1
- package/dist/adapters/prisma/registry.js +26 -5
- package/dist/adapters/prisma/registry.js.map +1 -1
- package/dist/adapters/prisma/rows.js +6 -1
- package/dist/adapters/prisma/rows.js.map +1 -1
- package/dist/adapters/prisma/unit-of-work.d.ts +2 -1
- package/dist/adapters/prisma/unit-of-work.js +2 -0
- package/dist/adapters/prisma/unit-of-work.js.map +1 -1
- package/dist/adapters/trpc/fleet.d.ts +23 -11
- package/dist/adapters/trpc/fleet.js +1 -1
- package/dist/adapters/trpc/fleet.js.map +1 -1
- package/dist/adapters/trpc/router.d.ts +29 -11
- package/dist/adapters/trpc/ship-protocol.js +1 -1
- package/dist/adapters/trpc/ship-protocol.js.map +1 -1
- package/dist/adapters/trpc/ship.d.ts +6 -0
- package/dist/adapters/trpc/ship.js +13 -5
- package/dist/adapters/trpc/ship.js.map +1 -1
- package/dist/domain/messaging/ports.d.ts +12 -0
- package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -3
- package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
- package/dist/domain/messaging/read-delivery.d.ts +4 -2
- package/dist/domain/messaging/read-delivery.js.map +1 -1
- package/dist/domain/messaging/read-exchange.d.ts +12 -3
- package/dist/domain/messaging/read-exchange.js +6 -2
- package/dist/domain/messaging/read-exchange.js.map +1 -1
- package/dist/domain/messaging/read-record.d.ts +5 -3
- package/dist/domain/messaging/read-record.js +7 -6
- package/dist/domain/messaging/read-record.js.map +1 -1
- package/dist/domain/messaging/receive-deliveries.d.ts +10 -7
- package/dist/domain/messaging/receive-deliveries.js +7 -6
- package/dist/domain/messaging/receive-deliveries.js.map +1 -1
- package/dist/domain/registry/crew-request.d.ts +4 -1
- package/dist/domain/registry/crew-request.js +2 -1
- package/dist/domain/registry/crew-request.js.map +1 -1
- package/dist/domain/registry/list-fleet.d.ts +6 -1
- package/dist/domain/registry/list-fleet.js +2 -1
- package/dist/domain/registry/list-fleet.js.map +1 -1
- package/dist/domain/registry/network-settings.d.ts +5 -3
- package/dist/domain/registry/network-settings.js +11 -3
- package/dist/domain/registry/network-settings.js.map +1 -1
- package/dist/domain/registry/ports.d.ts +7 -0
- package/dist/domain/registry/public.d.ts +1 -0
- package/dist/domain/registry/public.js +1 -0
- package/dist/domain/registry/public.js.map +1 -1
- package/dist/domain/registry/read-built-in-rules.js +2 -0
- package/dist/domain/registry/read-built-in-rules.js.map +1 -1
- package/dist/domain/registry/request-crew.d.ts +5 -4
- package/dist/domain/registry/request-crew.js +9 -4
- package/dist/domain/registry/request-crew.js.map +1 -1
- package/dist/domain/registry/senders.d.ts +42 -0
- package/dist/domain/registry/senders.js +28 -0
- package/dist/domain/registry/senders.js.map +1 -0
- package/dist/domain/registry/ships.d.ts +1 -2
- package/dist/domain/registry/ships.js +1 -2
- package/dist/domain/registry/ships.js.map +1 -1
- package/dist/domain/shared/history-pruning.d.ts +3 -1
- package/package.json +2 -2
- package/src/adapters/prisma/migrations/20261110090000_crew_request_requested_by/migration.sql +7 -0
- package/src/adapters/prisma/migrations/20261110100000_pruned_exchanges/migration.sql +18 -0
- package/src/adapters/prisma/schema.prisma +29 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actorOf } from '../shared/caller.js';
|
|
1
|
+
import { actorOf, isShipCaller } from '../shared/caller.js';
|
|
2
2
|
import { refuse } from '../shared/errors.js';
|
|
3
3
|
import { recordEvent } from '../shared/events.js';
|
|
4
4
|
import { ok } from '../shared/result.js';
|
|
@@ -10,8 +10,9 @@ import { checkManage, keepingReachRefusal } from './check-reach.js';
|
|
|
10
10
|
* before this runs. In one unit of work, locking the ship first, as a retire
|
|
11
11
|
* does, so a retire and a request never cross; then holding the label of
|
|
12
12
|
* each machine label, as an assignment does, so a change of its values waits
|
|
13
|
-
* and the request never names a value it removed: the request
|
|
14
|
-
*
|
|
13
|
+
* and the request never names a value it removed: the request, its
|
|
14
|
+
* requester the caller's ship (an account and the installation request as
|
|
15
|
+
* argo, the ship that holds what they request), and CrewRequested.
|
|
15
16
|
*/
|
|
16
17
|
export function createRequestCrew(deps) {
|
|
17
18
|
return (caller, input) => keepingReachRefusal(deps.uow, async (tx) => {
|
|
@@ -32,7 +33,11 @@ export function createRequestCrew(deps) {
|
|
|
32
33
|
labelValues.add(valueId);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
+
const requestedBy = isShipCaller(caller) ? caller.shipId : (await tx.ships.findOperatorShip(caller.fleetId))?.id;
|
|
37
|
+
if (requestedBy === undefined) {
|
|
38
|
+
return refuse('FLEET_NOT_FOUND', `Fleet ${caller.fleetId} does not exist`);
|
|
39
|
+
}
|
|
40
|
+
const requested = requestCrew({ ship, current, labelValues }, { settings: input.settings, requestedBy, at: deps.clock.now(), actor: actorOf(caller) });
|
|
36
41
|
if (!requested.isOk) {
|
|
37
42
|
return requested;
|
|
38
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-crew.js","sourceRoot":"","sources":["../../../src/domain/registry/request-crew.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAe,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"request-crew.js","sourceRoot":"","sources":["../../../src/domain/registry/request-crew.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAe,MAAM,qBAAqB,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAiB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAyC,MAAM,kBAAkB,CAAC;AAgB3G;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAwE;IACxG,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACvB,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAuI,EAAE;QAC9K,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,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AC,EAAE,EAAE,CAAC;QACjH,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,MAAM,CAAC,iBAAiB,EAAE,SAAS,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,SAAS,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvJ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;YACpB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,EAAE,CAAC,EAAE,eAAe,EAAE,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { FleetId, ShipId, ShipStatus } from '@aeolus-fleet/common';
|
|
2
|
+
import { type DomainError } from '../shared/errors.js';
|
|
3
|
+
import { type Result } from '../shared/result.js';
|
|
4
|
+
import type { LeaseRepository, ShipRepository } from './ports.js';
|
|
5
|
+
import { type Ship } from './ship.js';
|
|
6
|
+
/**
|
|
7
|
+
* A message's sender as Registry holds it now, retired or not: Messaging's
|
|
8
|
+
* question when it hands a crew a delivery, so the crew can answer the sender
|
|
9
|
+
* by name and tell from its status whether it still could.
|
|
10
|
+
*/
|
|
11
|
+
export interface Sender {
|
|
12
|
+
ship: Ship;
|
|
13
|
+
status: ShipStatus;
|
|
14
|
+
}
|
|
15
|
+
/** The ports reading a sender takes, inside the caller's unit of work. */
|
|
16
|
+
export interface FindSenderTx {
|
|
17
|
+
ships: Pick<ShipRepository, 'find'>;
|
|
18
|
+
leases: Pick<LeaseRepository, 'findCrewed'>;
|
|
19
|
+
}
|
|
20
|
+
/** The ports reading a page's senders takes, inside the caller's unit of work. */
|
|
21
|
+
export interface FindSendersTx {
|
|
22
|
+
ships: Pick<ShipRepository, 'findMany'>;
|
|
23
|
+
leases: Pick<LeaseRepository, 'findCrewed'>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One sender, by its id: its current name and type, and its status derived as
|
|
27
|
+
* the fleet read derives it. Read without a lock: a retire or a release that
|
|
28
|
+
* commits meanwhile shows at the next read.
|
|
29
|
+
*/
|
|
30
|
+
export declare function findSender(tx: FindSenderTx, input: {
|
|
31
|
+
fleetId: FleetId;
|
|
32
|
+
shipId: ShipId;
|
|
33
|
+
}): Promise<Result<Sender, DomainError<'SHIP_NOT_FOUND'>>>;
|
|
34
|
+
/**
|
|
35
|
+
* The senders of a page of deliveries, by id, in two batched reads however
|
|
36
|
+
* many deliveries each one sent: the ships, then which of them a session
|
|
37
|
+
* crews. Read without a lock, as {@link findSender} reads one.
|
|
38
|
+
*/
|
|
39
|
+
export declare function findSenders(tx: FindSendersTx, input: {
|
|
40
|
+
fleetId: FleetId;
|
|
41
|
+
shipIds: readonly ShipId[];
|
|
42
|
+
}): Promise<Map<ShipId, Sender>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { refuse } from '../shared/errors.js';
|
|
2
|
+
import { ok } from '../shared/result.js';
|
|
3
|
+
import { shipStatus } from './ship.js';
|
|
4
|
+
/**
|
|
5
|
+
* One sender, by its id: its current name and type, and its status derived as
|
|
6
|
+
* the fleet read derives it. Read without a lock: a retire or a release that
|
|
7
|
+
* commits meanwhile shows at the next read.
|
|
8
|
+
*/
|
|
9
|
+
export async function findSender(tx, input) {
|
|
10
|
+
const ship = await tx.ships.find(input.fleetId, input.shipId);
|
|
11
|
+
if (!ship) {
|
|
12
|
+
return refuse('SHIP_NOT_FOUND', `Ship ${input.shipId} does not exist`);
|
|
13
|
+
}
|
|
14
|
+
const crewed = await tx.leases.findCrewed(input.fleetId, [ship.id]);
|
|
15
|
+
return ok({ ship, status: shipStatus(ship, { isCrewed: crewed.includes(ship.id) }) });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The senders of a page of deliveries, by id, in two batched reads however
|
|
19
|
+
* many deliveries each one sent: the ships, then which of them a session
|
|
20
|
+
* crews. Read without a lock, as {@link findSender} reads one.
|
|
21
|
+
*/
|
|
22
|
+
export async function findSenders(tx, input) {
|
|
23
|
+
const shipIds = [...new Set(input.shipIds)];
|
|
24
|
+
const ships = await tx.ships.findMany(input.fleetId, shipIds);
|
|
25
|
+
const crewed = new Set(await tx.leases.findCrewed(input.fleetId, ships.map((ship) => ship.id)));
|
|
26
|
+
return new Map(ships.map((ship) => [ship.id, { ship, status: shipStatus(ship, { isCrewed: crewed.has(ship.id) }) }]));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=senders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"senders.js","sourceRoot":"","sources":["../../../src/domain/registry/senders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAa,MAAM,WAAW,CAAC;AAwBlD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,EAAgB,EAChB,KAA2C;IAE3C,MAAM,IAAI,GAAG,MAAM,EAAE,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IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxH,CAAC"}
|
|
@@ -16,8 +16,7 @@ export interface FindShipTx {
|
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* A ship of the fleet as it is now, retired or not: its current name and
|
|
19
|
-
* type.
|
|
20
|
-
* answer the sender by name. Read without a lock.
|
|
19
|
+
* type. Read without a lock.
|
|
21
20
|
*/
|
|
22
21
|
export declare function findShip(tx: FindShipTx, input: {
|
|
23
22
|
fleetId: FleetId;
|
|
@@ -12,8 +12,7 @@ export async function findViewerShip(tx, fleetId) {
|
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* A ship of the fleet as it is now, retired or not: its current name and
|
|
15
|
-
* type.
|
|
16
|
-
* answer the sender by name. Read without a lock.
|
|
15
|
+
* type. Read without a lock.
|
|
17
16
|
*/
|
|
18
17
|
export async function findShip(tx, input) {
|
|
19
18
|
const ship = await tx.ships.find(input.fleetId, input.shipId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ships.js","sourceRoot":"","sources":["../../../src/domain/registry/ships.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAQtD,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,EAAU,EACV,OAAgB;IAEhB,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,OAAO,iBAAiB,CAAC,CAAC;AACxF,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,EAAU,EAAE,OAAgB;IAC/D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AAC,CAAC;IAC9D,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,CAAC;AAC3F,CAAC"}
|
|
@@ -146,7 +146,9 @@ export interface HistoryPruner {
|
|
|
146
146
|
* name, type, kind and dates kept, `removedAt` set, its scopes emptied,
|
|
147
147
|
* its note, owner and commission cleared, and its schedules gone, a kept
|
|
148
148
|
* message one of them sent naming no schedule; every other row naming it
|
|
149
|
-
* stays (decision 0070, D2 and D3).
|
|
149
|
+
* stays (decision 0070, D2 and D3). Before its messages go, it marks each
|
|
150
|
+
* exchange they reached with the newest send time among them, never moving
|
|
151
|
+
* a mark back (docs/design/exchange-history).
|
|
150
152
|
*/
|
|
151
153
|
go(fleetId: FleetId, set: PruneSet): Promise<PrunedCounts>;
|
|
152
154
|
/** Records where the fleet's finished history begins (R9). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeolus-fleet/core",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.5",
|
|
4
4
|
"description": "The Aeolus fleet server: ships, guaranteed delivery and the API for Claude Code, Codex and any agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"postpack": "rm LICENSE"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@aeolus-fleet/common": "0.38.
|
|
62
|
+
"@aeolus-fleet/common": "0.38.5",
|
|
63
63
|
"@aws-sdk/client-kms": "^3.1159.0",
|
|
64
64
|
"@fastify/websocket": "^11.3.1",
|
|
65
65
|
"@modelcontextprotocol/server": "^2.3.0",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- The ship that made a crew request last (docs/design enabled models, R2): where the trierarch plugin tells why it waits.
|
|
2
|
+
-- Null for a request made before it was recorded.
|
|
3
|
+
ALTER TABLE "crew_requests" ADD COLUMN "requested_by_ship_id" TEXT;
|
|
4
|
+
|
|
5
|
+
CREATE INDEX "crew_requests_fleet_id_requested_by_ship_id_idx" ON "crew_requests"("fleet_id", "requested_by_ship_id");
|
|
6
|
+
|
|
7
|
+
ALTER TABLE "crew_requests" ADD CONSTRAINT "crew_requests_fleet_id_requested_by_ship_id_fkey" FOREIGN KEY ("fleet_id", "requested_by_ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- How far pruning went in each exchange (docs/design/exchange-history): per pair of ships, the lower id
|
|
2
|
+
-- first, the send time of the newest message of their exchange that pruning removed. Written only by the
|
|
3
|
+
-- pruning batch. Nothing is marked here: what was pruned before it is not known per exchange (H4).
|
|
4
|
+
CREATE TABLE "pruned_exchanges" (
|
|
5
|
+
"fleet_id" TEXT NOT NULL,
|
|
6
|
+
"ship_id" TEXT NOT NULL,
|
|
7
|
+
"other_ship_id" TEXT NOT NULL,
|
|
8
|
+
"pruned_up_to" TIMESTAMPTZ(3) NOT NULL,
|
|
9
|
+
|
|
10
|
+
CONSTRAINT "pruned_exchanges_pkey" PRIMARY KEY ("fleet_id", "ship_id", "other_ship_id")
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- Backs the foreign key to the other ship, as every foreign key is backed; the read uses the primary key alone.
|
|
14
|
+
CREATE INDEX "pruned_exchanges_fleet_id_other_ship_id_idx" ON "pruned_exchanges"("fleet_id", "other_ship_id");
|
|
15
|
+
|
|
16
|
+
ALTER TABLE "pruned_exchanges" ADD CONSTRAINT "pruned_exchanges_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
17
|
+
ALTER TABLE "pruned_exchanges" ADD CONSTRAINT "pruned_exchanges_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
18
|
+
ALTER TABLE "pruned_exchanges" ADD CONSTRAINT "pruned_exchanges_fleet_id_other_ship_id_fkey" FOREIGN KEY ("fleet_id", "other_ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -94,6 +94,7 @@ model Fleet {
|
|
|
94
94
|
messages Message[]
|
|
95
95
|
messageDays MessageDay[]
|
|
96
96
|
exchanges Exchange[]
|
|
97
|
+
prunedExchanges PrunedExchange[]
|
|
97
98
|
deliveries Delivery[]
|
|
98
99
|
overdueDeliveries OverdueDelivery[]
|
|
99
100
|
events Event[]
|
|
@@ -173,6 +174,7 @@ model Ship {
|
|
|
173
174
|
events Event[] @relation("EventShip")
|
|
174
175
|
crewRequest CrewRequest? @relation("CrewRequestShip")
|
|
175
176
|
assignedCrews CrewRequest[] @relation("CrewRequestAssignee")
|
|
177
|
+
requestedCrews CrewRequest[] @relation("CrewRequestRequester")
|
|
176
178
|
givenBackCrews CrewRequestGiveBack[] @relation("CrewRequestGiveBackTrierarch")
|
|
177
179
|
clearRequests WorktreeClearRequest[] @relation("WorktreeClearRequestTrierarch")
|
|
178
180
|
clearedWorktrees WorktreeClearRequest[] @relation("WorktreeClearRequestShip")
|
|
@@ -193,6 +195,8 @@ model Ship {
|
|
|
193
195
|
scheduledTo Schedule[] @relation("ScheduleSelectorShip")
|
|
194
196
|
exchanges Exchange[] @relation("ExchangeShip")
|
|
195
197
|
exchangedWith Exchange[] @relation("ExchangeOtherShip")
|
|
198
|
+
prunedExchanges PrunedExchange[] @relation("PrunedExchangeShip")
|
|
199
|
+
prunedExchangesWith PrunedExchange[] @relation("PrunedExchangeOtherShip")
|
|
196
200
|
|
|
197
201
|
@@unique([fleetId, id])
|
|
198
202
|
/// An idempotency key is used once per commissioning actor.
|
|
@@ -345,6 +349,8 @@ model CrewRequest {
|
|
|
345
349
|
settings Json
|
|
346
350
|
settingsVersion Int @map("settings_version")
|
|
347
351
|
requestedAt DateTime @map("requested_at") @db.Timestamptz(3)
|
|
352
|
+
/// The ship that made it last; null for a request made before it was recorded.
|
|
353
|
+
requestedBy String? @map("requested_by_ship_id")
|
|
348
354
|
/// The trierarch ship it is assigned to; null while unassigned.
|
|
349
355
|
assignedTo String? @map("assigned_to_ship_id")
|
|
350
356
|
/// How its trierarch says the crew stands; null until it says.
|
|
@@ -361,11 +367,14 @@ model CrewRequest {
|
|
|
361
367
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
362
368
|
ship Ship @relation("CrewRequestShip", fields: [fleetId, shipId], references: [fleetId, id])
|
|
363
369
|
assignee Ship? @relation("CrewRequestAssignee", fields: [fleetId, assignedTo], references: [fleetId, id])
|
|
370
|
+
requester Ship? @relation("CrewRequestRequester", fields: [fleetId, requestedBy], references: [fleetId, id])
|
|
364
371
|
givenBack CrewRequestGiveBack[]
|
|
365
372
|
|
|
366
373
|
@@unique([fleetId, shipId])
|
|
367
374
|
/// A trierarch reads the requests assigned to it.
|
|
368
375
|
@@index([fleetId, assignedTo])
|
|
376
|
+
/// A delete of a ship checks the requests it made with an index.
|
|
377
|
+
@@index([fleetId, requestedBy])
|
|
369
378
|
@@map("crew_requests")
|
|
370
379
|
}
|
|
371
380
|
|
|
@@ -741,6 +750,26 @@ model Exchange {
|
|
|
741
750
|
@@map("exchanges")
|
|
742
751
|
}
|
|
743
752
|
|
|
753
|
+
/// How far pruning went in one exchange (docs/design/exchange-history): the send time of the newest
|
|
754
|
+
/// message of the two ships' exchange that pruning removed, only ever moved forward. One row per pair,
|
|
755
|
+
/// the lower ship id first; a ship's exchange with itself names it twice. Written only by the pruning
|
|
756
|
+
/// batch, in its transaction. No foreign key to a message: what it points at is gone.
|
|
757
|
+
model PrunedExchange {
|
|
758
|
+
fleetId String @map("fleet_id")
|
|
759
|
+
shipId String @map("ship_id")
|
|
760
|
+
otherShipId String @map("other_ship_id")
|
|
761
|
+
prunedUpTo DateTime @map("pruned_up_to") @db.Timestamptz(3)
|
|
762
|
+
|
|
763
|
+
fleet Fleet @relation(fields: [fleetId], references: [id], onDelete: Restrict)
|
|
764
|
+
ship Ship @relation("PrunedExchangeShip", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
|
|
765
|
+
otherShip Ship @relation("PrunedExchangeOtherShip", fields: [fleetId, otherShipId], references: [fleetId, id], onDelete: Restrict)
|
|
766
|
+
|
|
767
|
+
@@id([fleetId, shipId, otherShipId])
|
|
768
|
+
/// Backs the foreign key to the other ship; the read uses the primary key alone.
|
|
769
|
+
@@index([fleetId, otherShipId])
|
|
770
|
+
@@map("pruned_exchanges")
|
|
771
|
+
}
|
|
772
|
+
|
|
744
773
|
/// An immutable envelope plus an opaque payload of at most 256 KB, sent by one ship.
|
|
745
774
|
/// Ids start with msg_. The selector is stored as resolved at send time: a ship's
|
|
746
775
|
/// id, never its name, or a type. It can name the message it replies to, and a
|