@aeolus-fleet/core 0.34.0 → 0.36.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.
- package/README.md +5 -4
- package/dist/adapters/prisma/alerts.d.ts +21 -0
- package/dist/adapters/prisma/alerts.js +61 -0
- package/dist/adapters/prisma/alerts.js.map +1 -0
- package/dist/adapters/prisma/expectations.d.ts +19 -0
- package/dist/adapters/prisma/expectations.js +46 -0
- package/dist/adapters/prisma/expectations.js.map +1 -0
- package/dist/adapters/prisma/generated/browser.d.ts +18 -1
- package/dist/adapters/prisma/generated/client.d.ts +18 -1
- package/dist/adapters/prisma/generated/commonInputTypes.d.ts +30 -0
- package/dist/adapters/prisma/generated/enums.d.ts +7 -0
- package/dist/adapters/prisma/generated/enums.js +6 -0
- package/dist/adapters/prisma/generated/enums.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/class.d.ts +22 -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 +197 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js +36 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +38 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +36 -0
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
- package/dist/adapters/prisma/generated/models/Alert.d.ts +1527 -0
- package/dist/adapters/prisma/generated/models/Alert.js +2 -0
- package/dist/adapters/prisma/generated/models/Alert.js.map +1 -0
- package/dist/adapters/prisma/generated/models/Fleet.d.ts +1068 -118
- package/dist/adapters/prisma/generated/models/Lease.d.ts +509 -2
- package/dist/adapters/prisma/generated/models/Message.d.ts +1 -1
- package/dist/adapters/prisma/generated/models/Ship.d.ts +939 -1
- package/dist/adapters/prisma/generated/models/ShipExpectations.d.ts +1468 -0
- package/dist/adapters/prisma/generated/models/ShipExpectations.js +2 -0
- package/dist/adapters/prisma/generated/models/ShipExpectations.js.map +1 -0
- package/dist/adapters/prisma/generated/models.d.ts +2 -0
- package/dist/adapters/prisma/history-pruner.js +24 -2
- package/dist/adapters/prisma/history-pruner.js.map +1 -1
- package/dist/adapters/prisma/history.js +9 -2
- package/dist/adapters/prisma/history.js.map +1 -1
- package/dist/adapters/prisma/messaging.js +39 -0
- package/dist/adapters/prisma/messaging.js.map +1 -1
- package/dist/adapters/prisma/overdue.js +1 -1
- package/dist/adapters/prisma/registry.d.ts +2 -1
- package/dist/adapters/prisma/registry.js +66 -14
- package/dist/adapters/prisma/registry.js.map +1 -1
- package/dist/adapters/prisma/rows.d.ts +3 -0
- package/dist/adapters/prisma/rows.js +40 -4
- package/dist/adapters/prisma/rows.js.map +1 -1
- package/dist/adapters/prisma/unit-of-work.d.ts +3 -1
- package/dist/adapters/prisma/unit-of-work.js +4 -0
- package/dist/adapters/prisma/unit-of-work.js.map +1 -1
- package/dist/adapters/trpc/alert-output.d.ts +4 -0
- package/dist/adapters/trpc/alert-output.js +15 -0
- package/dist/adapters/trpc/alert-output.js.map +1 -0
- package/dist/adapters/trpc/context.d.ts +14 -0
- package/dist/adapters/trpc/fleet.d.ts +479 -5
- package/dist/adapters/trpc/fleet.js +123 -10
- package/dist/adapters/trpc/fleet.js.map +1 -1
- package/dist/adapters/trpc/router.d.ts +542 -4
- package/dist/adapters/trpc/ship-contract.js +5 -0
- package/dist/adapters/trpc/ship-contract.js.map +1 -1
- package/dist/adapters/trpc/ship-protocol.js +4 -2
- package/dist/adapters/trpc/ship-protocol.js.map +1 -1
- package/dist/adapters/trpc/ship.d.ts +80 -3
- package/dist/adapters/trpc/ship.js +42 -8
- package/dist/adapters/trpc/ship.js.map +1 -1
- package/dist/adapters/trpc/trpc.js +4 -0
- package/dist/adapters/trpc/trpc.js.map +1 -1
- package/dist/domain/messaging/delivery.d.ts +8 -3
- package/dist/domain/messaging/delivery.js +15 -2
- package/dist/domain/messaging/delivery.js.map +1 -1
- package/dist/domain/messaging/message.d.ts +5 -1
- package/dist/domain/messaging/message.js.map +1 -1
- package/dist/domain/messaging/overdue.d.ts +4 -1
- package/dist/domain/messaging/overdue.js +3 -3
- package/dist/domain/messaging/overdue.js.map +1 -1
- package/dist/domain/messaging/payload.d.ts +1 -1
- package/dist/domain/messaging/payload.js +2 -2
- package/dist/domain/messaging/payload.js.map +1 -1
- package/dist/domain/messaging/ports.d.ts +15 -0
- package/dist/domain/messaging/read-record.d.ts +38 -0
- package/dist/domain/messaging/read-record.js +59 -0
- package/dist/domain/messaging/read-record.js.map +1 -0
- package/dist/domain/messaging/sealed-payload.js +1 -1
- package/dist/domain/messaging/send-message.d.ts +1 -1
- package/dist/domain/messaging/send-message.js +1 -1
- package/dist/domain/registry/alert.d.ts +75 -0
- package/dist/domain/registry/alert.js +71 -0
- package/dist/domain/registry/alert.js.map +1 -0
- package/dist/domain/registry/claim-ship.d.ts +2 -1
- package/dist/domain/registry/claim-ship.js +1 -1
- package/dist/domain/registry/claim-ship.js.map +1 -1
- package/dist/domain/registry/clear-alert.d.ts +32 -0
- package/dist/domain/registry/clear-alert.js +40 -0
- package/dist/domain/registry/clear-alert.js.map +1 -0
- package/dist/domain/registry/crew-request.d.ts +9 -0
- package/dist/domain/registry/crew-request.js +7 -0
- package/dist/domain/registry/crew-request.js.map +1 -1
- package/dist/domain/registry/expectations.d.ts +68 -0
- package/dist/domain/registry/expectations.js +84 -0
- package/dist/domain/registry/expectations.js.map +1 -0
- package/dist/domain/registry/get-ship.d.ts +9 -1
- package/dist/domain/registry/get-ship.js +10 -2
- package/dist/domain/registry/get-ship.js.map +1 -1
- package/dist/domain/registry/lease-activity.d.ts +15 -0
- package/dist/domain/registry/lease-activity.js +2 -0
- package/dist/domain/registry/lease-activity.js.map +1 -0
- package/dist/domain/registry/lease.d.ts +1 -1
- package/dist/domain/registry/list-fleet.d.ts +6 -1
- package/dist/domain/registry/list-fleet.js +5 -3
- package/dist/domain/registry/list-fleet.js.map +1 -1
- package/dist/domain/registry/ports.d.ts +61 -1
- package/dist/domain/registry/public.d.ts +2 -0
- package/dist/domain/registry/public.js +1 -0
- package/dist/domain/registry/public.js.map +1 -1
- package/dist/domain/registry/raise-alert.d.ts +31 -0
- package/dist/domain/registry/raise-alert.js +43 -0
- package/dist/domain/registry/raise-alert.js.map +1 -0
- package/dist/domain/registry/read-open-alerts.d.ts +23 -0
- package/dist/domain/registry/read-open-alerts.js +21 -0
- package/dist/domain/registry/read-open-alerts.js.map +1 -0
- package/dist/domain/registry/report-activity.d.ts +41 -0
- package/dist/domain/registry/report-activity.js +43 -0
- package/dist/domain/registry/report-activity.js.map +1 -0
- package/dist/domain/registry/report-step.d.ts +8 -0
- package/dist/domain/registry/report-step.js +16 -0
- package/dist/domain/registry/report-step.js.map +1 -0
- package/dist/domain/registry/report-task.d.ts +14 -0
- package/dist/domain/registry/report-task.js +39 -0
- package/dist/domain/registry/report-task.js.map +1 -0
- package/dist/domain/registry/report.d.ts +2 -2
- package/dist/domain/registry/report.js.map +1 -1
- package/dist/domain/registry/retire-ship.d.ts +6 -2
- package/dist/domain/registry/retire-ship.js +12 -1
- package/dist/domain/registry/retire-ship.js.map +1 -1
- package/dist/domain/registry/set-expectations.d.ts +33 -0
- package/dist/domain/registry/set-expectations.js +47 -0
- package/dist/domain/registry/set-expectations.js.map +1 -0
- package/dist/domain/registry/ship-report.d.ts +24 -7
- package/dist/domain/registry/ship-report.js +41 -5
- package/dist/domain/registry/ship-report.js.map +1 -1
- package/dist/domain/registry/ship.d.ts +7 -1
- package/dist/domain/registry/ship.js +3 -0
- package/dist/domain/registry/ship.js.map +1 -1
- package/dist/domain/shared/errors.d.ts +1 -1
- package/dist/domain/shared/errors.js.map +1 -1
- package/dist/domain/shared/history-pruning.d.ts +19 -2
- package/dist/domain/shared/history-pruning.js +1 -1
- package/dist/domain/shared/history-pruning.js.map +1 -1
- package/dist/domain/shared/history.d.ts +2 -1
- package/dist/domain/shared/history.js.map +1 -1
- package/dist/domain/shared/prune-history.d.ts +2 -1
- package/dist/domain/shared/prune-history.js +8 -6
- package/dist/domain/shared/prune-history.js.map +1 -1
- package/dist/domain/shared/read-message-deliveries.d.ts +2 -1
- package/dist/domain/shared/read-message-deliveries.js +4 -3
- package/dist/domain/shared/read-message-deliveries.js.map +1 -1
- package/dist/domain/shared/read-message.d.ts +2 -1
- package/dist/domain/shared/read-message.js +6 -3
- package/dist/domain/shared/read-message.js.map +1 -1
- package/dist/domain/shared/read-report-tasks.d.ts +10 -0
- package/dist/domain/shared/read-report-tasks.js +24 -0
- package/dist/domain/shared/read-report-tasks.js.map +1 -0
- package/dist/wiring.d.ts +14 -0
- package/dist/wiring.js +14 -0
- package/dist/wiring.js.map +1 -1
- package/package.json +2 -2
- package/src/adapters/prisma/migrations/20261103090000_removed_ships/migration.sql +21 -0
- package/src/adapters/prisma/migrations/20261104090000_report_task_step/migration.sql +10 -0
- package/src/adapters/prisma/migrations/20261105090000_payload_limit_256kb/migration.sql +15 -0
- package/src/adapters/prisma/migrations/20261106090000_lease_activity/migration.sql +11 -0
- package/src/adapters/prisma/migrations/20261107090000_alert_scope/migration.sql +64 -0
- package/src/adapters/prisma/migrations/20261107100000_alerts/migration.sql +33 -0
- package/src/adapters/prisma/migrations/20261108090000_ship_expectations/migration.sql +22 -0
- package/src/adapters/prisma/migrations/20261108100000_delivery_record_index/migration.sql +4 -0
- package/src/adapters/prisma/schema.prisma +108 -23
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- The expectations on ships (decision 0071): one row per ship while any holds, removed when the ship retires.
|
|
2
|
+
-- CreateTable
|
|
3
|
+
CREATE TABLE "ship_expectations" (
|
|
4
|
+
"fleet_id" TEXT NOT NULL,
|
|
5
|
+
"ship_id" TEXT NOT NULL,
|
|
6
|
+
"report_changes_within_minutes" INTEGER,
|
|
7
|
+
"report_changes_within_set_by" JSONB,
|
|
8
|
+
"report_changes_within_set_at" TIMESTAMPTZ(3),
|
|
9
|
+
"task_done_by_task" JSONB,
|
|
10
|
+
"task_done_by" TIMESTAMPTZ(3),
|
|
11
|
+
"task_done_by_set_by" JSONB,
|
|
12
|
+
"task_done_by_set_at" TIMESTAMPTZ(3),
|
|
13
|
+
|
|
14
|
+
CONSTRAINT "ship_expectations_pkey" PRIMARY KEY ("fleet_id","ship_id")
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "ship_expectations" ADD CONSTRAINT "ship_expectations_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "ship_expectations" ADD CONSTRAINT "ship_expectations_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
22
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- A ship's record reads the deliveries of its type it claimed newest first by id (Bridge, CC12).
|
|
2
|
+
-- Partial: a foreign key check on deliveries never matches its predicate, so a bulk delete never picks it.
|
|
3
|
+
CREATE INDEX "deliveries_record_fleet_id_claimed_by_ship_id_id_idx" ON "deliveries"("fleet_id", "claimed_by_ship_id", "id")
|
|
4
|
+
WHERE recipient_type IS NOT NULL;
|
|
@@ -87,6 +87,8 @@ model Fleet {
|
|
|
87
87
|
scopeNamespaces ScopeNamespace[]
|
|
88
88
|
definedScopes DefinedScope[]
|
|
89
89
|
verifiedFacts VerifiedFacts[]
|
|
90
|
+
alerts Alert[]
|
|
91
|
+
shipExpectations ShipExpectations[]
|
|
90
92
|
reachRefusals ReachRefusal[]
|
|
91
93
|
credentials Credential[]
|
|
92
94
|
messages Message[]
|
|
@@ -143,6 +145,8 @@ model Ship {
|
|
|
143
145
|
note String?
|
|
144
146
|
createdAt DateTime @map("created_at") @db.Timestamptz(3)
|
|
145
147
|
retiredAt DateTime? @map("retired_at") @db.Timestamptz(3)
|
|
148
|
+
/// When the pruning pass removed it, past the fleet's retention (decision 0070): the row stays a remnant its kept history names.
|
|
149
|
+
removedAt DateTime? @map("removed_at") @db.Timestamptz(3)
|
|
146
150
|
/// The actor that commissioned it, its idempotency key and the request's hash; null for argo.
|
|
147
151
|
/// commissioned_by names the actor: a ship's id, an account's id, or `installation`.
|
|
148
152
|
commissionedByKind CommissionerKind? @map("commissioned_by_kind")
|
|
@@ -177,6 +181,8 @@ model Ship {
|
|
|
177
181
|
declaredNetworkRules DeclaredNetworkRules[]
|
|
178
182
|
declaredNamespace ScopeNamespace?
|
|
179
183
|
verifiedFacts VerifiedFacts[]
|
|
184
|
+
alerts Alert[]
|
|
185
|
+
shipExpectations ShipExpectations[]
|
|
180
186
|
ownedMeetings Meeting[] @relation("MeetingOwner")
|
|
181
187
|
moderatedMeetings Meeting[] @relation("MeetingModerator")
|
|
182
188
|
openedMeetings Meeting[] @relation("MeetingOpener")
|
|
@@ -197,6 +203,8 @@ model Ship {
|
|
|
197
203
|
@@index([fleetId, ownerShipId])
|
|
198
204
|
@@index([fleetId, type], map: "ships_type_listing_idx", where: { retiredAt: null })
|
|
199
205
|
@@index([fleetId, kind], map: "ships_kind_listing_idx", where: { retiredAt: null })
|
|
206
|
+
/// The pruning pass picks the oldest retired ships not removed yet (decision 0070).
|
|
207
|
+
@@index([fleetId, retiredAt, id], map: "ships_removal_idx", where: raw("((retired_at IS NOT NULL) AND (removed_at IS NULL))"))
|
|
200
208
|
@@map("ships")
|
|
201
209
|
}
|
|
202
210
|
|
|
@@ -227,6 +235,16 @@ enum TurnState {
|
|
|
227
235
|
@@map("turn_state")
|
|
228
236
|
}
|
|
229
237
|
|
|
238
|
+
/// The kind of a session's latest event as its trierarch observes it (headless design, H14).
|
|
239
|
+
enum ActivityKind {
|
|
240
|
+
text
|
|
241
|
+
tool
|
|
242
|
+
result
|
|
243
|
+
error
|
|
244
|
+
|
|
245
|
+
@@map("activity_kind")
|
|
246
|
+
}
|
|
247
|
+
|
|
230
248
|
enum LocationKind {
|
|
231
249
|
DEVICE
|
|
232
250
|
CLOUD
|
|
@@ -242,37 +260,51 @@ enum LocationKind {
|
|
|
242
260
|
/// finding a ship by its crew token is a lookup not scoped by fleet (ADR 0007). A
|
|
243
261
|
/// console session's lease on argo has none; the console session holds its token.
|
|
244
262
|
model Lease {
|
|
245
|
-
id
|
|
246
|
-
fleetId
|
|
247
|
-
shipId
|
|
248
|
-
location
|
|
249
|
-
locationDescription
|
|
263
|
+
id String @id
|
|
264
|
+
fleetId String @map("fleet_id")
|
|
265
|
+
shipId String @map("ship_id")
|
|
266
|
+
location LocationKind
|
|
267
|
+
locationDescription String? @map("location_description")
|
|
250
268
|
/// The harness the session stated when it claimed the ship; none for argo's console lease and for leases from before harnesses were stated.
|
|
251
|
-
harness
|
|
252
|
-
crewTokenHash
|
|
253
|
-
startedAt
|
|
269
|
+
harness String?
|
|
270
|
+
crewTokenHash String? @unique @map("crew_token_hash")
|
|
271
|
+
startedAt DateTime @map("started_at") @db.Timestamptz(3)
|
|
254
272
|
/// The last call by its crew: observation only, nothing acts on it (ADR 0016).
|
|
255
|
-
lastSeenAt
|
|
273
|
+
lastSeenAt DateTime? @map("last_seen_at") @db.Timestamptz(3)
|
|
256
274
|
/// The crew's last report: plain data, nothing acts on it. Null until it reports.
|
|
257
|
-
reportState
|
|
258
|
-
reportNote
|
|
259
|
-
reportedAt
|
|
275
|
+
reportState ReportState? @map("report_state")
|
|
276
|
+
reportNote String? @map("report_note")
|
|
277
|
+
reportedAt DateTime? @map("reported_at") @db.Timestamptz(3)
|
|
278
|
+
/// When the state, note, task or step last changed; details alone do not move it (decision 0028). Null until it reports.
|
|
279
|
+
reportChangedAt DateTime? @map("report_changed_at") @db.Timestamptz(3)
|
|
280
|
+
/// What the crew works on: a typed reference, a kind and its fields (decision 0028). Null when it names none.
|
|
281
|
+
reportTask Json? @map("report_task")
|
|
282
|
+
/// Where the crew is in its task, step at of of; both null when it gives none.
|
|
283
|
+
reportStepAt Int? @map("report_step_at")
|
|
284
|
+
reportStepOf Int? @map("report_step_of")
|
|
260
285
|
/// The report's details: one JSON object stored without meaning, at most 16 KB (decision 0028). Null when there are none.
|
|
261
|
-
reportDetails
|
|
286
|
+
reportDetails Json? @map("report_details")
|
|
262
287
|
/// Moves by one each time the details change; 0 before any.
|
|
263
|
-
reportDetailsVersion
|
|
264
|
-
/// The crew's statement: what its ship is and offers, at most
|
|
265
|
-
statement
|
|
288
|
+
reportDetailsVersion Int @default(0) @map("report_details_version")
|
|
289
|
+
/// The crew's statement: what its ship is and offers, at most 256 KB, its shape common's; null until it states one (decision 0047).
|
|
290
|
+
statement Json?
|
|
266
291
|
/// Moves by one each time the statement changes; 0 before any.
|
|
267
|
-
statementVersion
|
|
292
|
+
statementVersion Int @default(0) @map("statement_version")
|
|
268
293
|
/// From the lease's first push receive: the computer side takes its deliveries, and the agent's plain receive answers nothing (decision 0040).
|
|
269
|
-
pushedAt
|
|
294
|
+
pushedAt DateTime? @map("pushed_at") @db.Timestamptz(3)
|
|
270
295
|
/// What wakes the ship, as its first push receive stated it; null when it stated none (interop 5.1).
|
|
271
|
-
waker
|
|
296
|
+
waker LeaseWaker?
|
|
272
297
|
/// The session's turn as its hooks last reported it, and when they saw it change; null until they report (decision 0040).
|
|
273
|
-
turn
|
|
274
|
-
turnAt
|
|
275
|
-
|
|
298
|
+
turn TurnState?
|
|
299
|
+
turnAt DateTime? @map("turn_at") @db.Timestamptz(3)
|
|
300
|
+
/// What its assigned trierarch last observed of the session: the latest event's time, kind and tool, never content; null until it writes (docs/design/monitoring, 4.3).
|
|
301
|
+
activityAt DateTime? @map("activity_at") @db.Timestamptz(3)
|
|
302
|
+
activityKind ActivityKind? @map("activity_kind")
|
|
303
|
+
activityTool String? @map("activity_tool")
|
|
304
|
+
/// When the trierarch wrote it, and the report interval it stated: past twice that interval it reads unknown.
|
|
305
|
+
activityReportedAt DateTime? @map("activity_reported_at") @db.Timestamptz(3)
|
|
306
|
+
activityIntervalSeconds Int? @map("activity_interval_seconds")
|
|
307
|
+
endedAt DateTime? @map("ended_at") @db.Timestamptz(3)
|
|
276
308
|
|
|
277
309
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
278
310
|
ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
|
|
@@ -545,6 +577,57 @@ model VerifiedFacts {
|
|
|
545
577
|
@@map("verified_facts")
|
|
546
578
|
}
|
|
547
579
|
|
|
580
|
+
/// An alert on a ship (decision 0071): what the watch raised when a fact and
|
|
581
|
+
/// its signal parted, open until the watch clears it or the ship retires.
|
|
582
|
+
/// Ids start with alt_. One per ship, signal and occurrence, open or cleared,
|
|
583
|
+
/// so an occurrence is raised once. facts holds the signal's facts at raise,
|
|
584
|
+
/// as common's schema gives them.
|
|
585
|
+
model Alert {
|
|
586
|
+
id String @id
|
|
587
|
+
fleetId String @map("fleet_id")
|
|
588
|
+
shipId String @map("ship_id")
|
|
589
|
+
signal String
|
|
590
|
+
occurrenceKey String @map("occurrence_key")
|
|
591
|
+
facts Json
|
|
592
|
+
ownerShipId String? @map("owner_ship_id")
|
|
593
|
+
since DateTime @db.Timestamptz(3)
|
|
594
|
+
raisedAt DateTime @map("raised_at") @db.Timestamptz(3)
|
|
595
|
+
clearedAt DateTime? @map("cleared_at") @db.Timestamptz(3)
|
|
596
|
+
clearedWhy String? @map("cleared_why")
|
|
597
|
+
|
|
598
|
+
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
599
|
+
ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
|
|
600
|
+
|
|
601
|
+
@@unique([fleetId, shipId, signal, occurrenceKey])
|
|
602
|
+
/// The fleet's open alerts, newest first, a page at a time.
|
|
603
|
+
@@index([fleetId, id(sort: Desc)], map: "alerts_open_idx", where: { clearedAt: null })
|
|
604
|
+
/// A ship's open alerts, and how many it has.
|
|
605
|
+
@@index([fleetId, shipId], map: "alerts_open_on_ship_idx", where: { clearedAt: null })
|
|
606
|
+
@@map("alerts")
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/// The expectations on a ship (decision 0071): what its owner, or a ship
|
|
610
|
+
/// that manages it, expects of it, standing, at most one of each. Each keeps
|
|
611
|
+
/// who set it (JSON, as common's expectation setter) and when; its columns
|
|
612
|
+
/// are null while it is not set. No row while none holds; a retire removes it.
|
|
613
|
+
model ShipExpectations {
|
|
614
|
+
fleetId String @map("fleet_id")
|
|
615
|
+
shipId String @map("ship_id")
|
|
616
|
+
reportChangesWithinMinutes Int? @map("report_changes_within_minutes")
|
|
617
|
+
reportChangesWithinSetBy Json? @map("report_changes_within_set_by")
|
|
618
|
+
reportChangesWithinSetAt DateTime? @map("report_changes_within_set_at") @db.Timestamptz(3)
|
|
619
|
+
taskDoneByTask Json? @map("task_done_by_task")
|
|
620
|
+
taskDoneBy DateTime? @map("task_done_by") @db.Timestamptz(3)
|
|
621
|
+
taskDoneBySetBy Json? @map("task_done_by_set_by")
|
|
622
|
+
taskDoneBySetAt DateTime? @map("task_done_by_set_at") @db.Timestamptz(3)
|
|
623
|
+
|
|
624
|
+
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
625
|
+
ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
|
|
626
|
+
|
|
627
|
+
@@id([fleetId, shipId])
|
|
628
|
+
@@map("ship_expectations")
|
|
629
|
+
}
|
|
630
|
+
|
|
548
631
|
/// A send the network rules refused (decision 0034), recorded in the
|
|
549
632
|
/// transaction that refused it. Ids start with rfs_. Sender and recipient are
|
|
550
633
|
/// as they were then: ids, names and the label values they carried, as JSON,
|
|
@@ -632,7 +715,7 @@ model MessageDay {
|
|
|
632
715
|
@@map("message_days")
|
|
633
716
|
}
|
|
634
717
|
|
|
635
|
-
/// An immutable envelope plus an opaque payload of at most
|
|
718
|
+
/// An immutable envelope plus an opaque payload of at most 256 KB, sent by one ship.
|
|
636
719
|
/// Ids start with msg_. The selector is stored as resolved at send time: a ship's
|
|
637
720
|
/// id, never its name, or a type. It can name the message it replies to, and a
|
|
638
721
|
/// resend names the message it resends (nothing sets that yet).
|
|
@@ -970,6 +1053,8 @@ model Delivery {
|
|
|
970
1053
|
@@index([fleetId, state, createdAt], map: "deliveries_open_fleet_id_state_created_at_idx", where: raw("(state = ANY (ARRAY['pending'::delivery_state, 'received'::delivery_state, 'handed'::delivery_state, 'undeliverable'::delivery_state, 'notHandled'::delivery_state]))"))
|
|
971
1054
|
/// A crew's own deliveries in flight, which its next receive returns first.
|
|
972
1055
|
@@index([fleetId, claimedByLeaseId, state])
|
|
1056
|
+
/// A ship's record pages the deliveries of its type it claimed newest first by id (Bridge, CC12). Partial, so a foreign key check never picks it.
|
|
1057
|
+
@@index([fleetId, claimedByShipId, id], map: "deliveries_record_fleet_id_claimed_by_ship_id_id_idx", where: raw("(recipient_type IS NOT NULL)"))
|
|
973
1058
|
/// Every foreign key has an index leading with its columns, so deleting a
|
|
974
1059
|
/// referenced row checks it with an index, not a scan (#331).
|
|
975
1060
|
@@index([fleetId, messageId, id])
|