@aeolus-fleet/core 0.27.1 → 0.28.1
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/crypto/account-token-signatures.d.ts +12 -0
- package/dist/adapters/crypto/account-token-signatures.js +104 -0
- package/dist/adapters/crypto/account-token-signatures.js.map +1 -0
- package/dist/adapters/http/request-credentials.d.ts +7 -1
- package/dist/adapters/http/request-credentials.js +18 -5
- package/dist/adapters/http/request-credentials.js.map +1 -1
- package/dist/adapters/http/server.js +4 -2
- package/dist/adapters/http/server.js.map +1 -1
- package/dist/adapters/prisma/event-log.js +13 -1
- package/dist/adapters/prisma/event-log.js.map +1 -1
- package/dist/adapters/prisma/generated/browser.d.ts +30 -0
- package/dist/adapters/prisma/generated/client.d.ts +30 -0
- package/dist/adapters/prisma/generated/commonInputTypes.d.ts +120 -0
- package/dist/adapters/prisma/generated/enums.d.ts +25 -0
- package/dist/adapters/prisma/generated/enums.js +22 -1
- package/dist/adapters/prisma/generated/enums.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/class.d.ts +44 -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 +372 -9
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js +38 -11
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +39 -8
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +38 -11
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js.map +1 -1
- package/dist/adapters/prisma/generated/models/AccountCutOff.d.ts +944 -0
- package/dist/adapters/prisma/generated/models/AccountCutOff.js +2 -0
- package/dist/adapters/prisma/generated/models/AccountCutOff.js.map +1 -0
- package/dist/adapters/prisma/generated/models/ConsoleSession.d.ts +59 -1
- package/dist/adapters/prisma/generated/models/Event.d.ts +426 -1
- package/dist/adapters/prisma/generated/models/Fleet.d.ts +871 -0
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.d.ts +1031 -0
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.js +2 -0
- package/dist/adapters/prisma/generated/models/InstallationDeclaredNetworkRules.js.map +1 -0
- package/dist/adapters/prisma/generated/models/Label.d.ts +113 -39
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.d.ts +1133 -0
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.js +2 -0
- package/dist/adapters/prisma/generated/models/NetworkRulesDraft.js.map +1 -0
- package/dist/adapters/prisma/generated/models/NetworkSettings.d.ts +24 -255
- package/dist/adapters/prisma/generated/models/ReachRefusal.d.ts +1 -40
- package/dist/adapters/prisma/generated/models/Ship.d.ts +782 -6
- package/dist/adapters/prisma/generated/models/SignInTicket.d.ts +39 -1
- package/dist/adapters/prisma/generated/models/VerifiedFacts.d.ts +1325 -0
- package/dist/adapters/prisma/generated/models/VerifiedFacts.js +2 -0
- package/dist/adapters/prisma/generated/models/VerifiedFacts.js.map +1 -0
- package/dist/adapters/prisma/generated/models.d.ts +4 -0
- package/dist/adapters/prisma/history.js +1 -0
- package/dist/adapters/prisma/history.js.map +1 -1
- package/dist/adapters/prisma/identity.d.ts +3 -1
- package/dist/adapters/prisma/identity.js +41 -8
- package/dist/adapters/prisma/identity.js.map +1 -1
- package/dist/adapters/prisma/network.d.ts +7 -2
- package/dist/adapters/prisma/network.js +92 -65
- package/dist/adapters/prisma/network.js.map +1 -1
- package/dist/adapters/prisma/registry.js +19 -14
- package/dist/adapters/prisma/registry.js.map +1 -1
- package/dist/adapters/prisma/rows.d.ts +9 -4
- package/dist/adapters/prisma/rows.js +75 -19
- package/dist/adapters/prisma/rows.js.map +1 -1
- package/dist/adapters/prisma/unit-of-work.d.ts +4 -2
- package/dist/adapters/prisma/unit-of-work.js +5 -2
- package/dist/adapters/prisma/unit-of-work.js.map +1 -1
- package/dist/adapters/prisma/verified-facts.d.ts +4 -0
- package/dist/adapters/prisma/verified-facts.js +65 -0
- package/dist/adapters/prisma/verified-facts.js.map +1 -0
- package/dist/adapters/rest/rest-api.js +2 -2
- package/dist/adapters/rest/rest-api.js.map +1 -1
- package/dist/adapters/trpc/console.d.ts +3 -1
- package/dist/adapters/trpc/context.d.ts +22 -8
- package/dist/adapters/trpc/fleet.d.ts +259 -52
- package/dist/adapters/trpc/fleet.js +121 -84
- package/dist/adapters/trpc/fleet.js.map +1 -1
- package/dist/adapters/trpc/installation-token.d.ts +7 -0
- package/dist/adapters/trpc/installation-token.js +10 -0
- package/dist/adapters/trpc/installation-token.js.map +1 -0
- package/dist/adapters/trpc/installation.d.ts +32 -2
- package/dist/adapters/trpc/installation.js +14 -10
- package/dist/adapters/trpc/installation.js.map +1 -1
- package/dist/adapters/trpc/router.d.ts +307 -43
- package/dist/adapters/trpc/ship-contract.js +6 -4
- package/dist/adapters/trpc/ship-contract.js.map +1 -1
- package/dist/adapters/trpc/ship.d.ts +32 -1
- package/dist/adapters/trpc/ship.js +4 -2
- package/dist/adapters/trpc/ship.js.map +1 -1
- package/dist/adapters/trpc/trpc.d.ts +36 -13
- package/dist/adapters/trpc/trpc.js +117 -26
- package/dist/adapters/trpc/trpc.js.map +1 -1
- package/dist/app.d.ts +2 -0
- package/dist/app.js +22 -0
- package/dist/app.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/domain/identity/authenticate-account.d.ts +35 -0
- package/dist/domain/identity/authenticate-account.js +54 -0
- package/dist/domain/identity/authenticate-account.js.map +1 -0
- package/dist/domain/identity/authenticate-installation.d.ts +23 -0
- package/dist/domain/identity/authenticate-installation.js +20 -0
- package/dist/domain/identity/authenticate-installation.js.map +1 -0
- package/dist/domain/identity/authenticate.d.ts +2 -2
- package/dist/domain/identity/console-session.d.ts +6 -3
- package/dist/domain/identity/console-session.js.map +1 -1
- package/dist/domain/identity/cut-off-account.d.ts +29 -0
- package/dist/domain/identity/cut-off-account.js +37 -0
- package/dist/domain/identity/cut-off-account.js.map +1 -0
- package/dist/domain/identity/dismiss-notice.d.ts +2 -2
- package/dist/domain/identity/issue-sign-in-ticket.d.ts +9 -3
- package/dist/domain/identity/issue-sign-in-ticket.js +8 -2
- package/dist/domain/identity/issue-sign-in-ticket.js.map +1 -1
- package/dist/domain/identity/ports.d.ts +52 -5
- package/dist/domain/identity/read-account.d.ts +8 -4
- package/dist/domain/identity/read-account.js +1 -1
- package/dist/domain/identity/read-account.js.map +1 -1
- package/dist/domain/identity/read-guide.d.ts +2 -2
- package/dist/domain/identity/read-notices.d.ts +2 -2
- package/dist/domain/identity/record-guide-progress.d.ts +2 -2
- package/dist/domain/identity/redeem-sign-in-ticket.d.ts +2 -1
- package/dist/domain/identity/redeem-sign-in-ticket.js +3 -2
- package/dist/domain/identity/redeem-sign-in-ticket.js.map +1 -1
- package/dist/domain/identity/set-theme.d.ts +2 -2
- package/dist/domain/identity/sign-in-ticket.d.ts +3 -1
- package/dist/domain/identity/sign-in.d.ts +2 -2
- package/dist/domain/identity/sign-in.js +2 -0
- package/dist/domain/identity/sign-in.js.map +1 -1
- package/dist/domain/identity/sign-out.d.ts +2 -2
- package/dist/domain/identity/sign-out.js +1 -1
- package/dist/domain/identity/sign-out.js.map +1 -1
- package/dist/domain/identity/start-console-session.d.ts +4 -2
- package/dist/domain/identity/start-console-session.js +6 -4
- package/dist/domain/identity/start-console-session.js.map +1 -1
- package/dist/domain/identity/start-viewer-session.js +1 -0
- package/dist/domain/identity/start-viewer-session.js.map +1 -1
- package/dist/domain/messaging/delivery.d.ts +3 -1
- package/dist/domain/messaging/delivery.js +9 -6
- package/dist/domain/messaging/delivery.js.map +1 -1
- package/dist/domain/messaging/dismiss-delivery.d.ts +2 -2
- package/dist/domain/messaging/message.d.ts +3 -1
- package/dist/domain/messaging/message.js +1 -1
- package/dist/domain/messaging/message.js.map +1 -1
- package/dist/domain/messaging/ping-ship.d.ts +2 -2
- package/dist/domain/messaging/ping-ship.js +1 -1
- package/dist/domain/messaging/ping-ship.js.map +1 -1
- package/dist/domain/messaging/resend-delivery.d.ts +2 -2
- package/dist/domain/messaging/resend-delivery.js +1 -0
- package/dist/domain/messaging/resend-delivery.js.map +1 -1
- package/dist/domain/messaging/send-message.d.ts +3 -3
- package/dist/domain/messaging/send-message.js +1 -0
- package/dist/domain/messaging/send-message.js.map +1 -1
- package/dist/domain/registry/apply-network-rules.d.ts +32 -0
- package/dist/domain/registry/apply-network-rules.js +33 -0
- package/dist/domain/registry/apply-network-rules.js.map +1 -0
- package/dist/domain/registry/assign-crew.d.ts +2 -2
- package/dist/domain/registry/assign-crew.js +3 -2
- package/dist/domain/registry/assign-crew.js.map +1 -1
- package/dist/domain/registry/assign-label.d.ts +7 -5
- package/dist/domain/registry/assign-label.js +16 -6
- package/dist/domain/registry/assign-label.js.map +1 -1
- package/dist/domain/registry/change-label-values.d.ts +1 -1
- package/dist/domain/registry/change-label-values.js +4 -3
- package/dist/domain/registry/change-label-values.js.map +1 -1
- package/dist/domain/registry/check-reach.d.ts +45 -24
- package/dist/domain/registry/check-reach.js +76 -42
- package/dist/domain/registry/check-reach.js.map +1 -1
- package/dist/domain/registry/clear-request.d.ts +1 -1
- package/dist/domain/registry/clear-request.js +1 -1
- package/dist/domain/registry/clear-request.js.map +1 -1
- package/dist/domain/registry/commission-ship.d.ts +23 -14
- package/dist/domain/registry/commission-ship.js +167 -21
- package/dist/domain/registry/commission-ship.js.map +1 -1
- package/dist/domain/registry/confirm-crew-release.d.ts +2 -2
- package/dist/domain/registry/confirm-crew-release.js +3 -2
- package/dist/domain/registry/confirm-crew-release.js.map +1 -1
- package/dist/domain/registry/confirm-worktree-cleared.d.ts +2 -2
- package/dist/domain/registry/confirm-worktree-cleared.js +3 -2
- package/dist/domain/registry/confirm-worktree-cleared.js.map +1 -1
- package/dist/domain/registry/connect-plugin.d.ts +5 -4
- package/dist/domain/registry/connect-plugin.js +6 -7
- package/dist/domain/registry/connect-plugin.js.map +1 -1
- package/dist/domain/registry/crew-request.d.ts +2 -2
- package/dist/domain/registry/crew-request.js.map +1 -1
- package/dist/domain/registry/declare-network-rules.d.ts +9 -6
- package/dist/domain/registry/declare-network-rules.js +13 -8
- package/dist/domain/registry/declare-network-rules.js.map +1 -1
- package/dist/domain/registry/declare-scopes.d.ts +2 -2
- package/dist/domain/registry/declared-network-rules.d.ts +30 -21
- package/dist/domain/registry/declared-network-rules.js +46 -22
- package/dist/domain/registry/declared-network-rules.js.map +1 -1
- package/dist/domain/registry/define-label.d.ts +1 -1
- package/dist/domain/registry/define-label.js +5 -5
- package/dist/domain/registry/define-label.js.map +1 -1
- package/dist/domain/registry/delete-label.d.ts +1 -1
- package/dist/domain/registry/delete-label.js +4 -3
- package/dist/domain/registry/delete-label.js.map +1 -1
- package/dist/domain/registry/discard-network-rules-draft.d.ts +23 -0
- package/dist/domain/registry/discard-network-rules-draft.js +24 -0
- package/dist/domain/registry/discard-network-rules-draft.js.map +1 -0
- package/dist/domain/registry/discover.d.ts +11 -10
- package/dist/domain/registry/discover.js +11 -5
- package/dist/domain/registry/discover.js.map +1 -1
- package/dist/domain/registry/explain-crew-request.d.ts +2 -2
- package/dist/domain/registry/explain-crew-request.js +3 -2
- package/dist/domain/registry/explain-crew-request.js.map +1 -1
- package/dist/domain/registry/explain-reach.d.ts +21 -14
- package/dist/domain/registry/explain-reach.js +53 -53
- package/dist/domain/registry/explain-reach.js.map +1 -1
- package/dist/domain/registry/get-ship.d.ts +2 -2
- package/dist/domain/registry/get-starting-prompt.d.ts +4 -2
- package/dist/domain/registry/get-starting-prompt.js +7 -5
- package/dist/domain/registry/get-starting-prompt.js.map +1 -1
- package/dist/domain/registry/give-back-crew-request.d.ts +2 -2
- package/dist/domain/registry/give-back-crew-request.js +3 -2
- package/dist/domain/registry/give-back-crew-request.js.map +1 -1
- package/dist/domain/registry/grant-scopes.d.ts +8 -5
- package/dist/domain/registry/grant-scopes.js +14 -5
- package/dist/domain/registry/grant-scopes.js.map +1 -1
- package/dist/domain/registry/label.d.ts +69 -18
- package/dist/domain/registry/label.js +79 -28
- package/dist/domain/registry/label.js.map +1 -1
- package/dist/domain/registry/lease.d.ts +1 -1
- package/dist/domain/registry/list-fleet.d.ts +2 -0
- package/dist/domain/registry/list-fleet.js +1 -0
- package/dist/domain/registry/list-fleet.js.map +1 -1
- package/dist/domain/registry/list-scopes.d.ts +2 -1
- package/dist/domain/registry/list-scopes.js +2 -1
- package/dist/domain/registry/list-scopes.js.map +1 -1
- package/dist/domain/registry/managed-or-assigned.d.ts +12 -4
- package/dist/domain/registry/managed-or-assigned.js +25 -7
- package/dist/domain/registry/managed-or-assigned.js.map +1 -1
- package/dist/domain/registry/network-rules-draft.d.ts +45 -0
- package/dist/domain/registry/network-rules-draft.js +41 -0
- package/dist/domain/registry/network-rules-draft.js.map +1 -0
- package/dist/domain/registry/network-settings.d.ts +92 -122
- package/dist/domain/registry/network-settings.js +99 -159
- package/dist/domain/registry/network-settings.js.map +1 -1
- package/dist/domain/registry/ports.d.ts +47 -11
- package/dist/domain/registry/reach-refusal.d.ts +18 -4
- package/dist/domain/registry/read-assigned-crew-requests.d.ts +2 -2
- package/dist/domain/registry/read-built-in-rules.d.ts +4 -3
- package/dist/domain/registry/read-built-in-rules.js +7 -6
- package/dist/domain/registry/read-built-in-rules.js.map +1 -1
- package/dist/domain/registry/read-clear-requests.d.ts +2 -2
- package/dist/domain/registry/read-clear-requests.js.map +1 -1
- package/dist/domain/registry/read-declared-network-rules.d.ts +5 -5
- package/dist/domain/registry/read-declared-network-rules.js +4 -4
- package/dist/domain/registry/read-declared-network-rules.js.map +1 -1
- package/dist/domain/registry/read-network-rules-draft-changes.d.ts +22 -0
- package/dist/domain/registry/read-network-rules-draft-changes.js +53 -0
- package/dist/domain/registry/read-network-rules-draft-changes.js.map +1 -0
- package/dist/domain/registry/read-network-rules.d.ts +30 -0
- package/dist/domain/registry/read-network-rules.js +18 -0
- package/dist/domain/registry/read-network-rules.js.map +1 -0
- package/dist/domain/registry/read-on-behalf.d.ts +3 -3
- package/dist/domain/registry/read-on-behalf.js.map +1 -1
- package/dist/domain/registry/read-reach-refusals.d.ts +6 -5
- package/dist/domain/registry/read-reach-refusals.js +13 -8
- package/dist/domain/registry/read-reach-refusals.js.map +1 -1
- package/dist/domain/registry/read-reach.d.ts +6 -8
- package/dist/domain/registry/read-reach.js +21 -16
- package/dist/domain/registry/read-reach.js.map +1 -1
- package/dist/domain/registry/recrew-ship.d.ts +2 -2
- package/dist/domain/registry/recrew-ship.js +3 -3
- package/dist/domain/registry/recrew-ship.js.map +1 -1
- package/dist/domain/registry/release-ship.d.ts +3 -2
- package/dist/domain/registry/release-ship.js +4 -3
- package/dist/domain/registry/release-ship.js.map +1 -1
- package/dist/domain/registry/remove-crew-request.d.ts +2 -2
- package/dist/domain/registry/remove-crew-request.js +4 -3
- package/dist/domain/registry/remove-crew-request.js.map +1 -1
- package/dist/domain/registry/rename-ship.d.ts +1 -1
- package/dist/domain/registry/rename-ship.js +4 -3
- package/dist/domain/registry/rename-ship.js.map +1 -1
- package/dist/domain/registry/report-crew-status.d.ts +2 -2
- package/dist/domain/registry/report-crew-status.js +3 -2
- package/dist/domain/registry/report-crew-status.js.map +1 -1
- package/dist/domain/registry/request-crew.d.ts +3 -3
- package/dist/domain/registry/request-crew.js +4 -3
- package/dist/domain/registry/request-crew.js.map +1 -1
- package/dist/domain/registry/request-worktree-clear.d.ts +2 -2
- package/dist/domain/registry/request-worktree-clear.js +4 -3
- package/dist/domain/registry/request-worktree-clear.js.map +1 -1
- package/dist/domain/registry/retire-ship.d.ts +16 -12
- package/dist/domain/registry/retire-ship.js +28 -21
- package/dist/domain/registry/retire-ship.js.map +1 -1
- package/dist/domain/registry/save-network-rules-draft.d.ts +31 -0
- package/dist/domain/registry/save-network-rules-draft.js +27 -0
- package/dist/domain/registry/save-network-rules-draft.js.map +1 -0
- package/dist/domain/registry/scope-grant.d.ts +19 -19
- package/dist/domain/registry/scope-grant.js +8 -9
- package/dist/domain/registry/scope-grant.js.map +1 -1
- package/dist/domain/registry/set-built-in-rule.d.ts +3 -3
- package/dist/domain/registry/set-built-in-rule.js +5 -9
- package/dist/domain/registry/set-built-in-rule.js.map +1 -1
- package/dist/domain/registry/set-owner.d.ts +9 -6
- package/dist/domain/registry/set-owner.js +14 -8
- package/dist/domain/registry/set-owner.js.map +1 -1
- package/dist/domain/registry/set-verified-facts.d.ts +36 -0
- package/dist/domain/registry/set-verified-facts.js +58 -0
- package/dist/domain/registry/set-verified-facts.js.map +1 -0
- package/dist/domain/registry/ship.d.ts +52 -18
- package/dist/domain/registry/ship.js +76 -18
- package/dist/domain/registry/ship.js.map +1 -1
- package/dist/domain/registry/statement.d.ts +2 -2
- package/dist/domain/registry/statement.js +2 -2
- package/dist/domain/registry/statement.js.map +1 -1
- package/dist/domain/registry/turn.d.ts +2 -2
- package/dist/domain/registry/turn.js +2 -2
- package/dist/domain/registry/turn.js.map +1 -1
- package/dist/domain/registry/unassign-label.d.ts +8 -5
- package/dist/domain/registry/unassign-label.js +17 -6
- package/dist/domain/registry/unassign-label.js.map +1 -1
- package/dist/domain/registry/verified-facts.d.ts +75 -0
- package/dist/domain/registry/verified-facts.js +107 -0
- package/dist/domain/registry/verified-facts.js.map +1 -0
- package/dist/domain/registry/whoami.d.ts +2 -2
- package/dist/domain/shared/caller.d.ts +40 -6
- package/dist/domain/shared/caller.js +20 -0
- package/dist/domain/shared/caller.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/events.d.ts +13 -2
- package/dist/domain/shared/events.js.map +1 -1
- package/dist/domain/shared/history.d.ts +3 -1
- package/dist/domain/shared/history.js.map +1 -1
- package/dist/domain/shared/read-fleet-limits.d.ts +2 -2
- package/dist/domain/shared/read-health.d.ts +2 -2
- package/dist/domain/shared/read-inbox.d.ts +2 -2
- package/dist/domain/shared/read-message.d.ts +2 -2
- package/dist/domain/shared/read-needs-attention.d.ts +2 -2
- package/dist/domain/shared/read-sent-message.d.ts +2 -2
- package/dist/domain/shared/read-ship-messages.d.ts +2 -2
- package/dist/domain/shared/read-ship-timeline.d.ts +2 -2
- package/dist/domain/shared/read-ship-way.d.ts +2 -2
- package/dist/domain/shared/read-ship-way.js +1 -1
- package/dist/domain/shared/read-ship-way.js.map +1 -1
- package/dist/start.js +1 -0
- package/dist/start.js.map +1 -1
- package/dist/testing/account-token-issuer.d.ts +30 -0
- package/dist/testing/account-token-issuer.js +48 -0
- package/dist/testing/account-token-issuer.js.map +1 -0
- package/dist/testing/fleet.d.ts +2 -2
- package/dist/testing/index.d.ts +1 -1
- package/dist/wiring.d.ts +21 -8
- package/dist/wiring.js +32 -13
- package/dist/wiring.js.map +1 -1
- package/package.json +2 -5
- package/src/adapters/prisma/migrations/20261019200000_account_cut_offs/migration.sql +10 -0
- package/src/adapters/prisma/migrations/20261019210000_event_actors/migration.sql +32 -0
- package/src/adapters/prisma/migrations/20261020090000_argos_jobs_as_scopes/migration.sql +65 -0
- package/src/adapters/prisma/migrations/20261020100000_installation_labels/migration.sql +7 -0
- package/src/adapters/prisma/migrations/20261020110000_installation_declared_network_rules/migration.sql +10 -0
- package/src/adapters/prisma/migrations/20261020120000_commissioning_actors/migration.sql +14 -0
- package/src/adapters/prisma/migrations/20261020130000_console_sign_in_accounts/migration.sql +4 -0
- package/src/adapters/prisma/migrations/20261020140000_event_signed_in_accounts/migration.sql +4 -0
- package/src/adapters/prisma/migrations/20261020150000_account_cut_off_ends_console_sessions/migration.sql +2 -0
- package/src/adapters/prisma/migrations/20261020160000_network_in_core/migration.sql +30 -0
- package/src/adapters/prisma/migrations/20261020170000_verify_scope/migration.sql +64 -0
- package/src/adapters/prisma/migrations/20261020180000_verified_facts/migration.sql +21 -0
- package/src/adapters/prisma/migrations/20261020190000_verified_facts_by_writer/migration.sql +3 -0
- package/src/adapters/prisma/schema.prisma +132 -23
- package/dist/domain/registry/read-network-plugin.d.ts +0 -23
- package/dist/domain/registry/read-network-plugin.js +0 -15
- package/dist/domain/registry/read-network-plugin.js.map +0 -1
- package/dist/domain/registry/register-network-plugin.d.ts +0 -28
- package/dist/domain/registry/register-network-plugin.js +0 -26
- package/dist/domain/registry/register-network-plugin.js.map +0 -1
- package/dist/domain/registry/set-network-rules.d.ts +0 -31
- package/dist/domain/registry/set-network-rules.js +0 -27
- package/dist/domain/registry/set-network-rules.js.map +0 -1
- package/dist/domain/registry/unregister-network-plugin.d.ts +0 -27
- package/dist/domain/registry/unregister-network-plugin.js +0 -25
- package/dist/domain/registry/unregister-network-plugin.js.map +0 -1
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* acts on it. Until a crew states one, the commission note stands in.
|
|
6
6
|
*/
|
|
7
7
|
import type { DiscoveredStatement, Statement } from '@aeolus-fleet/common';
|
|
8
|
-
import type
|
|
9
|
-
import {
|
|
8
|
+
import { type Crew } from '../shared/caller.js';
|
|
9
|
+
import type { NewEvent } from '../shared/events.js';
|
|
10
10
|
/** The statement a lease holds, with its version: 1 for the first, one more on every change. */
|
|
11
11
|
export interface StatedStatement {
|
|
12
12
|
statement: Statement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { actorOf } from '../shared/caller.js';
|
|
2
2
|
/**
|
|
3
3
|
* The crew states its statement, whole: at the next version, with
|
|
4
4
|
* StatementSet caused by its ship, holding the lease, the version and how
|
|
@@ -18,7 +18,7 @@ export function stateStatement(current, input) {
|
|
|
18
18
|
fleetId: crew.fleetId,
|
|
19
19
|
type: 'StatementSet',
|
|
20
20
|
occurredAt: at,
|
|
21
|
-
actor:
|
|
21
|
+
actor: actorOf(crew),
|
|
22
22
|
shipId: crew.shipId,
|
|
23
23
|
details: { leaseId: crew.leaseId, version: stated.version, capabilities: statement.capabilities.length },
|
|
24
24
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../../../src/domain/registry/statement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../../../src/domain/registry/statement.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AASzD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA+B,EAC/B,KAAqD;IAErD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IACtC,IAAI,OAAO,KAAK,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;QACtF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IACD,MAAM,MAAM,GAAoB,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACpF,OAAO;QACL,MAAM;QACN,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE,EAAE;gBACd,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;gBACpB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE;aACzG;SACF;KACF,CAAC;AACJ,CAAC;AAED,qHAAqH;AACrH,MAAM,UAAU,qBAAqB,CAAC,IAA6B,EAAE,MAA8B;IACjG,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3E,CAAC;AAED,4GAA4G;AAC5G,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAa,EAAE,EAAE,CACnD,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACvK,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TurnState } from '@aeolus-fleet/common';
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
2
|
+
import { type Crew } from '../shared/caller.js';
|
|
3
|
+
import type { NewEvent } from '../shared/events.js';
|
|
4
4
|
/** The turn a lease holds: idle or busy, since the time the hooks saw it change. */
|
|
5
5
|
export interface Turn {
|
|
6
6
|
state: TurnState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { actorOf } from '../shared/caller.js';
|
|
2
2
|
/**
|
|
3
3
|
* The hooks report the turn with the time they saw it (decision 0040): the
|
|
4
4
|
* lease keeps it at that time, and TurnReported is written then, so a report
|
|
@@ -20,7 +20,7 @@ export function reportTurn(held, report) {
|
|
|
20
20
|
fleetId: crew.fleetId,
|
|
21
21
|
type: 'TurnReported',
|
|
22
22
|
occurredAt: at,
|
|
23
|
-
actor:
|
|
23
|
+
actor: actorOf(crew),
|
|
24
24
|
shipId: crew.shipId,
|
|
25
25
|
details: { leaseId: crew.leaseId, turn },
|
|
26
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../../../src/domain/registry/turn.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../../../src/domain/registry/turn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AASzD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,IAAiB,EACjB,MAA4D;IAE5D,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7C,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACpC,CAAC;IACD,OAAO;QACL,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;QACzB,MAAM,EAAE;YACN;gBACE,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE,EAAE;gBACd,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC;gBACpB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE;aACzC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import type { IdGenerator, LabelValueId, ShipId } from '@aeolus-fleet/common';
|
|
2
|
-
import type
|
|
2
|
+
import { type Caller } from '../shared/caller.js';
|
|
3
3
|
import type { Clock } from '../shared/clock.js';
|
|
4
4
|
import { type DomainError } from '../shared/errors.js';
|
|
5
5
|
import { type EventLog } from '../shared/events.js';
|
|
6
6
|
import { type Result } from '../shared/result.js';
|
|
7
7
|
import type { UnitOfWork } from '../shared/unit-of-work.js';
|
|
8
8
|
import { type UnassignLabelRefusal } from './label.js';
|
|
9
|
+
import { type CheckManageTx, type NotReachable } from './check-reach.js';
|
|
9
10
|
import type { LabelRepository, ShipRepository } from './ports.js';
|
|
10
|
-
export interface UnassignLabelTx {
|
|
11
|
+
export interface UnassignLabelTx extends Omit<CheckManageTx, 'ships' | 'labels'> {
|
|
11
12
|
ships: Pick<ShipRepository, 'find' | 'findForUpdate'>;
|
|
12
|
-
labels: Pick<LabelRepository, 'findByValueForShare' | 'carriedBy' | 'unassign'
|
|
13
|
+
labels: Pick<LabelRepository, 'findByValueForShare' | 'carriedBy' | 'unassign'> & CheckManageTx['labels'];
|
|
13
14
|
events: EventLog;
|
|
14
15
|
}
|
|
15
|
-
export type UnassignLabelFailure = DomainError<'SHIP_NOT_FOUND' | 'LABEL_VALUE_NOT_FOUND'> | UnassignLabelRefusal;
|
|
16
|
+
export type UnassignLabelFailure = DomainError<'SHIP_NOT_FOUND' | 'LABEL_VALUE_NOT_FOUND'> | UnassignLabelRefusal | NotReachable;
|
|
16
17
|
export type UnassignLabel = (caller: Caller, input: {
|
|
17
18
|
shipId: ShipId;
|
|
18
19
|
valueId: LabelValueId;
|
|
19
20
|
}) => Promise<Result<undefined, UnassignLabelFailure>>;
|
|
20
21
|
/**
|
|
21
|
-
* Use case: a label's owner takes one of its values off a ship, by the value's id (decision 0031)
|
|
22
|
+
* Use case: a label's owner takes one of its values off a ship, by the value's id (decision 0031),
|
|
23
|
+
* or an actor holding labels:any any label's value off a ship within its
|
|
24
|
+
* manage reach (decision 0053). Its scope
|
|
22
25
|
* (labels:assign) is checked before this runs. In one unit of work, locking
|
|
23
26
|
* the ship, then holding the label, as an assignment does: the assignment
|
|
24
27
|
* goes, with LabelUnassigned.
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { actorOf, hasScope, isShipCaller } from '../shared/caller.js';
|
|
1
2
|
import { refuse } from '../shared/errors.js';
|
|
2
|
-
import { recordEvent
|
|
3
|
+
import { recordEvent } from '../shared/events.js';
|
|
3
4
|
import { ok } from '../shared/result.js';
|
|
4
|
-
import { unassignLabel } from './label.js';
|
|
5
|
+
import { labelOwnerOf, ownerNameOf, unassignLabel } from './label.js';
|
|
6
|
+
import { checkManage, keepingReachRefusal } from './check-reach.js';
|
|
5
7
|
/**
|
|
6
|
-
* Use case: a label's owner takes one of its values off a ship, by the value's id (decision 0031)
|
|
8
|
+
* Use case: a label's owner takes one of its values off a ship, by the value's id (decision 0031),
|
|
9
|
+
* or an actor holding labels:any any label's value off a ship within its
|
|
10
|
+
* manage reach (decision 0053). Its scope
|
|
7
11
|
* (labels:assign) is checked before this runs. In one unit of work, locking
|
|
8
12
|
* the ship, then holding the label, as an assignment does: the assignment
|
|
9
13
|
* goes, with LabelUnassigned.
|
|
10
14
|
*/
|
|
11
15
|
export function createUnassignLabel(deps) {
|
|
12
|
-
return (caller, input) => deps.uow
|
|
16
|
+
return (caller, input) => keepingReachRefusal(deps.uow, async (tx) => {
|
|
13
17
|
const { fleetId } = caller;
|
|
14
18
|
const ship = await tx.ships.findForUpdate(fleetId, input.shipId);
|
|
15
19
|
if (!ship) {
|
|
@@ -20,8 +24,15 @@ export function createUnassignLabel(deps) {
|
|
|
20
24
|
if (!label?.values.some((value) => value.id === input.valueId)) {
|
|
21
25
|
return refuse('LABEL_VALUE_NOT_FOUND', `The fleet has no label value ${input.valueId}`);
|
|
22
26
|
}
|
|
23
|
-
const
|
|
24
|
-
const
|
|
27
|
+
const at = deps.clock.now();
|
|
28
|
+
const labeller = { owner: labelOwnerOf(caller), shipId: isShipCaller(caller) ? caller.shipId : null, canLabelAnyShip: hasScope(caller, 'labels:any') };
|
|
29
|
+
if (labeller.canLabelAnyShip) {
|
|
30
|
+
const managed = await checkManage({ tx, ids: deps.ids }, { manager: caller, shipId: ship.id, at });
|
|
31
|
+
if (!managed.isOk) {
|
|
32
|
+
return managed;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const unassigned = unassignLabel({ label, ownerName: await ownerNameOf(label.owner, async (shipId) => (await tx.ships.find(fleetId, shipId))?.name), ship, carried: await tx.labels.carriedBy(fleetId, ship.id) }, { caller: labeller, valueId: input.valueId, at, actor: actorOf(caller) });
|
|
25
36
|
if (!unassigned.isOk) {
|
|
26
37
|
return unassigned;
|
|
27
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unassign-label.js","sourceRoot":"","sources":["../../../src/domain/registry/unassign-label.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unassign-label.js","sourceRoot":"","sources":["../../../src/domain/registry/unassign-label.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAe,MAAM,qBAAqB,CAAC;AAEnF,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,YAAY,EAAE,WAAW,EAAE,aAAa,EAA6B,MAAM,YAAY,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAyC,MAAM,kBAAkB,CAAC;AAa3G;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAA0E;IAC5G,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACvB,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE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set whole. Like a statement, a
|
|
4
|
+
* claim by its writer: its shape is common's, checked at the edge, and
|
|
5
|
+
* nothing here acts on it.
|
|
6
|
+
*/
|
|
7
|
+
import type { AccountId, DiscoveredVerifiedFact, FleetId, ShipId, VerifiedFact } from '@aeolus-fleet/common';
|
|
8
|
+
import type { Caller } from '../shared/caller.js';
|
|
9
|
+
import { type DomainError } from '../shared/errors.js';
|
|
10
|
+
import type { Actor, NewEvent } from '../shared/events.js';
|
|
11
|
+
import { type Result } from '../shared/result.js';
|
|
12
|
+
import type { Ship } from './ship.js';
|
|
13
|
+
/** Who wrote a fact, as decision 0057 names an actor: an account by its id only. */
|
|
14
|
+
export type FactWriter = {
|
|
15
|
+
kind: 'ship';
|
|
16
|
+
shipId: ShipId;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'account';
|
|
19
|
+
accountId: AccountId;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'installation';
|
|
22
|
+
};
|
|
23
|
+
/** One writer's facts about one ship, written at one time. */
|
|
24
|
+
export interface WrittenFacts {
|
|
25
|
+
fleetId: FleetId;
|
|
26
|
+
shipId: ShipId;
|
|
27
|
+
writer: FactWriter;
|
|
28
|
+
facts: readonly VerifiedFact[];
|
|
29
|
+
at: Date;
|
|
30
|
+
}
|
|
31
|
+
export type SetVerifiedFactsRefusal = DomainError<'SHIP_ALREADY_RETIRED'>;
|
|
32
|
+
/** Why facts went without their writer withdrawing them: the ship they are about retired, or their writer did. */
|
|
33
|
+
export type FactsRemovedWhy = 'shipRetired' | 'writerRetired';
|
|
34
|
+
/** The writer a caller writes as. */
|
|
35
|
+
export declare function writerOf(caller: Caller): FactWriter;
|
|
36
|
+
/** Whether two writers are the same actor. */
|
|
37
|
+
export declare function isSameWriter(writer: FactWriter, other: FactWriter): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A ship retires (decision 0059): every writer's facts about it go, as the
|
|
40
|
+
* ship retired, and its own facts as a writer about every other ship, as
|
|
41
|
+
* their writer retired. One VerifiedFactsRemoved per set removed, on the ship
|
|
42
|
+
* it was about, naming the writer and how many facts, never their values.
|
|
43
|
+
*/
|
|
44
|
+
export declare function removeWithRetiredShip(facts: {
|
|
45
|
+
about: readonly WrittenFacts[];
|
|
46
|
+
by: readonly WrittenFacts[];
|
|
47
|
+
}, retire: {
|
|
48
|
+
at: Date;
|
|
49
|
+
actor: Actor;
|
|
50
|
+
}): {
|
|
51
|
+
removed: WrittenFacts[];
|
|
52
|
+
events: NewEvent[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* A writer sets its facts about a ship, whole: none withdraws them. Refused
|
|
56
|
+
* on a retired ship. The same facts again, in the same order, change nothing
|
|
57
|
+
* and write no event; a change writes VerifiedFactsSet on the ship, caused by
|
|
58
|
+
* the writer, with how many facts and never their values.
|
|
59
|
+
*/
|
|
60
|
+
export declare function setVerifiedFacts(ship: Ship, input: {
|
|
61
|
+
current: WrittenFacts | undefined;
|
|
62
|
+
writer: FactWriter;
|
|
63
|
+
facts: readonly VerifiedFact[];
|
|
64
|
+
at: Date;
|
|
65
|
+
actor: Actor;
|
|
66
|
+
}): Result<{
|
|
67
|
+
written: WrittenFacts | null;
|
|
68
|
+
events: NewEvent[];
|
|
69
|
+
}, SetVerifiedFactsRefusal>;
|
|
70
|
+
/**
|
|
71
|
+
* A ship's facts as discovery shows them (decision 0059): every writer's,
|
|
72
|
+
* oldest first, each with its writer, a ship by the name it has now, and
|
|
73
|
+
* when it was written.
|
|
74
|
+
*/
|
|
75
|
+
export declare function discoveredVerifiedOf(written: readonly WrittenFacts[], shipNames: ReadonlyMap<ShipId, string>): DiscoveredVerifiedFact[];
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { refuse } from '../shared/errors.js';
|
|
2
|
+
import { ok } from '../shared/result.js';
|
|
3
|
+
/** The writer a caller writes as. */
|
|
4
|
+
export function writerOf(caller) {
|
|
5
|
+
switch (caller.kind) {
|
|
6
|
+
case 'account':
|
|
7
|
+
return { kind: 'account', accountId: caller.accountId };
|
|
8
|
+
case 'installation':
|
|
9
|
+
return { kind: 'installation' };
|
|
10
|
+
case 'operator':
|
|
11
|
+
case 'viewer':
|
|
12
|
+
case 'agent':
|
|
13
|
+
case 'person':
|
|
14
|
+
case 'app':
|
|
15
|
+
return { kind: 'ship', shipId: caller.shipId };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** The writer as an event's details name it: its kind, and the ship's or account's id, or `installation`. */
|
|
19
|
+
function writerDetails(writer) {
|
|
20
|
+
switch (writer.kind) {
|
|
21
|
+
case 'ship':
|
|
22
|
+
return { writerKind: writer.kind, writer: writer.shipId };
|
|
23
|
+
case 'account':
|
|
24
|
+
return { writerKind: writer.kind, writer: writer.accountId };
|
|
25
|
+
case 'installation':
|
|
26
|
+
return { writerKind: writer.kind, writer: 'installation' };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Whether two writers are the same actor. */
|
|
30
|
+
export function isSameWriter(writer, other) {
|
|
31
|
+
switch (writer.kind) {
|
|
32
|
+
case 'ship':
|
|
33
|
+
return other.kind === 'ship' && other.shipId === writer.shipId;
|
|
34
|
+
case 'account':
|
|
35
|
+
return other.kind === 'account' && other.accountId === writer.accountId;
|
|
36
|
+
case 'installation':
|
|
37
|
+
return other.kind === 'installation';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A ship retires (decision 0059): every writer's facts about it go, as the
|
|
42
|
+
* ship retired, and its own facts as a writer about every other ship, as
|
|
43
|
+
* their writer retired. One VerifiedFactsRemoved per set removed, on the ship
|
|
44
|
+
* it was about, naming the writer and how many facts, never their values.
|
|
45
|
+
*/
|
|
46
|
+
export function removeWithRetiredShip(facts, retire) {
|
|
47
|
+
const removed = [
|
|
48
|
+
...facts.about.map((written) => ({ written, why: 'shipRetired' })),
|
|
49
|
+
...facts.by.filter((written) => !facts.about.some((about) => about.shipId === written.shipId && isSameWriter(about.writer, written.writer))).map((written) => ({ written, why: 'writerRetired' })),
|
|
50
|
+
];
|
|
51
|
+
return {
|
|
52
|
+
removed: removed.map(({ written }) => written),
|
|
53
|
+
events: removed.map(({ written, why }) => ({
|
|
54
|
+
fleetId: written.fleetId,
|
|
55
|
+
type: 'VerifiedFactsRemoved',
|
|
56
|
+
occurredAt: retire.at,
|
|
57
|
+
actor: retire.actor,
|
|
58
|
+
shipId: written.shipId,
|
|
59
|
+
details: { ...writerDetails(written.writer), facts: written.facts.length, why },
|
|
60
|
+
})),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A writer sets its facts about a ship, whole: none withdraws them. Refused
|
|
65
|
+
* on a retired ship. The same facts again, in the same order, change nothing
|
|
66
|
+
* and write no event; a change writes VerifiedFactsSet on the ship, caused by
|
|
67
|
+
* the writer, with how many facts and never their values.
|
|
68
|
+
*/
|
|
69
|
+
export function setVerifiedFacts(ship, input) {
|
|
70
|
+
const { current, writer, facts, at, actor } = input;
|
|
71
|
+
if (ship.retiredAt !== null) {
|
|
72
|
+
return refuse('SHIP_ALREADY_RETIRED', `${ship.name} is retired: no fact is written about it`);
|
|
73
|
+
}
|
|
74
|
+
const before = current?.facts ?? [];
|
|
75
|
+
if (factsKey(before) === factsKey(facts)) {
|
|
76
|
+
return ok({ written: current ?? null, events: [] });
|
|
77
|
+
}
|
|
78
|
+
return ok({
|
|
79
|
+
written: facts.length === 0 ? null : { fleetId: ship.fleetId, shipId: ship.id, writer, facts, at },
|
|
80
|
+
events: [{ fleetId: ship.fleetId, type: 'VerifiedFactsSet', occurredAt: at, actor, shipId: ship.id, details: { facts: facts.length } }],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** The facts in order, each as its check, issuer and value, whatever order its keys came in. */
|
|
84
|
+
function factsKey(facts) {
|
|
85
|
+
return JSON.stringify(facts.map((fact) => [fact.checked, 'issuer' in fact ? fact.issuer : null, fact.value]));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A ship's facts as discovery shows them (decision 0059): every writer's,
|
|
89
|
+
* oldest first, each with its writer, a ship by the name it has now, and
|
|
90
|
+
* when it was written.
|
|
91
|
+
*/
|
|
92
|
+
export function discoveredVerifiedOf(written, shipNames) {
|
|
93
|
+
return written
|
|
94
|
+
.toSorted((first, second) => first.at.getTime() - second.at.getTime())
|
|
95
|
+
.flatMap(({ writer, facts, at }) => facts.map((fact) => ({ ...fact, by: discoveredWriterOf(writer, shipNames), at: at.toISOString() })));
|
|
96
|
+
}
|
|
97
|
+
function discoveredWriterOf(writer, shipNames) {
|
|
98
|
+
switch (writer.kind) {
|
|
99
|
+
case 'ship':
|
|
100
|
+
return { kind: 'ship', id: writer.shipId, name: shipNames.get(writer.shipId) ?? writer.shipId };
|
|
101
|
+
case 'account':
|
|
102
|
+
return { kind: 'account', id: writer.accountId };
|
|
103
|
+
case 'installation':
|
|
104
|
+
return { kind: 'installation' };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=verified-facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verified-facts.js","sourceRoot":"","sources":["../../../src/domain/registry/verified-facts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAoBtD,qCAAqC;AACrC,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QAC1D,KAAK,cAAc;YACjB,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QAClC,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK;YACR,OAAO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AAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC;SACrE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,kBAAkB,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7I,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAkB,EAAE,SAAsC;IACpF,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACT,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClG,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;QACnD,KAAK,cAAc;YACjB,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IACpC,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FleetId, ShipId } from '@aeolus-fleet/common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ShipCaller } from '../shared/caller.js';
|
|
3
3
|
import { type DomainError } from '../shared/errors.js';
|
|
4
4
|
import { type Result } from '../shared/result.js';
|
|
5
5
|
import type { ShipRepository } from './ports.js';
|
|
@@ -13,7 +13,7 @@ export interface ShipIdentity {
|
|
|
13
13
|
ownerShipId: ShipId | null;
|
|
14
14
|
ownerName: string | null;
|
|
15
15
|
}
|
|
16
|
-
export type Whoami = (caller:
|
|
16
|
+
export type Whoami = (caller: ShipCaller) => Promise<Result<ShipIdentity, DomainError<'SHIP_NOT_FOUND'>>>;
|
|
17
17
|
/**
|
|
18
18
|
* Use case: tells the caller which ship it crews: id, fleet, name, type and
|
|
19
19
|
* owner.
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { ConsoleSessionId, FleetId, LeaseId, Scope, ScopeName, ShipId, ShipKind } from '@aeolus-fleet/common';
|
|
1
|
+
import type { AccountId, ConsoleSessionId, FleetId, LeaseId, Scope, ScopeName, ShipId, ShipKind } from '@aeolus-fleet/common';
|
|
2
|
+
import type { Actor } from './events.js';
|
|
2
3
|
/**
|
|
3
|
-
* Who
|
|
4
|
-
* token or
|
|
5
|
-
*
|
|
4
|
+
* Who a call is authorised for: its actor (decision 0057). A ship, by its
|
|
5
|
+
* crew token or a console sign-in; an account, by the account token pagasae
|
|
6
|
+
* signed for this fleet; or the installation, by the installation token.
|
|
7
|
+
* Scopes and reach come from the server or the checked token, never from
|
|
8
|
+
* the request, and are checked the same way for each.
|
|
6
9
|
*/
|
|
7
|
-
export
|
|
10
|
+
export type Caller = ShipCaller | AccountCaller | InstallationCaller;
|
|
11
|
+
/** A ship as the actor of a call, resolved from its crew token or from a console session. */
|
|
12
|
+
export interface ShipCaller {
|
|
8
13
|
shipId: ShipId;
|
|
9
14
|
fleetId: FleetId;
|
|
10
15
|
kind: ShipKind;
|
|
@@ -12,17 +17,46 @@ export interface Caller {
|
|
|
12
17
|
scopes: readonly ScopeName[];
|
|
13
18
|
/** Set when the caller signed in through the console rather than calling with a crew token. */
|
|
14
19
|
consoleSessionId?: ConsoleSessionId;
|
|
20
|
+
/** The account that signed in to the console as argo, by its id, for a console session it started (decision 0054). */
|
|
21
|
+
signedInAccountId?: AccountId;
|
|
15
22
|
/** The plugin ship that reads on behalf of this ship, with this ship's read reach (decision 0034); absent for a ship's own call. */
|
|
16
23
|
askedBy?: ShipId;
|
|
17
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* An account as the actor of a call, as its account token says (decision
|
|
27
|
+
* 0058): core stores no account. It reaches by the values of the label
|
|
28
|
+
* `group` its token carries, and as the owner of what its person ship owns.
|
|
29
|
+
*/
|
|
30
|
+
export interface AccountCaller {
|
|
31
|
+
kind: 'account';
|
|
32
|
+
accountId: AccountId;
|
|
33
|
+
fleetId: FleetId;
|
|
34
|
+
scopes: readonly ScopeName[];
|
|
35
|
+
/** The values of the label `group` its groups give it in this fleet, by their texts. */
|
|
36
|
+
groupValues: readonly string[];
|
|
37
|
+
/** Its person ship in this fleet, if it has one: a ship owned by it is one the account owns (decision 0057). */
|
|
38
|
+
personShipId: ShipId | null;
|
|
39
|
+
/** The ship that presented the account token, a plugin's page or the gateway, if one did. */
|
|
40
|
+
throughShipId: ShipId | null;
|
|
41
|
+
}
|
|
42
|
+
/** The installation as the actor of a call in one fleet, with the scopes it holds there (decision 0020). */
|
|
43
|
+
export interface InstallationCaller {
|
|
44
|
+
kind: 'installation';
|
|
45
|
+
fleetId: FleetId;
|
|
46
|
+
scopes: readonly ScopeName[];
|
|
47
|
+
}
|
|
18
48
|
/**
|
|
19
49
|
* A caller that came with the crew token `register` gave it: one session
|
|
20
50
|
* crewing one ship under one lease (ADR 0015). A receive claims deliveries
|
|
21
51
|
* for that lease, so they are the crew's, not merely the ship's.
|
|
22
52
|
*/
|
|
23
|
-
export interface Crew extends
|
|
53
|
+
export interface Crew extends ShipCaller {
|
|
24
54
|
leaseId: LeaseId;
|
|
25
55
|
}
|
|
26
56
|
export declare function hasScope(caller: Caller, scope: Scope): boolean;
|
|
57
|
+
/** Whether the actor is a ship: what sends, receives, owns, defines labels and declares (decision 0057). */
|
|
58
|
+
export declare function isShipCaller(caller: Caller): caller is ShipCaller;
|
|
27
59
|
/** Whether the caller crews its ship under a lease: a crew token's crew, or argo's console session. */
|
|
28
60
|
export declare function isCrew(caller: Caller): caller is Crew;
|
|
61
|
+
/** The actor an event names for the caller (decision 0057): an account by its id only, with the ship that presented its token. */
|
|
62
|
+
export declare function actorOf(caller: Caller): Actor;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
export function hasScope(caller, scope) {
|
|
2
2
|
return caller.scopes.includes(scope);
|
|
3
3
|
}
|
|
4
|
+
/** Whether the actor is a ship: what sends, receives, owns, defines labels and declares (decision 0057). */
|
|
5
|
+
export function isShipCaller(caller) {
|
|
6
|
+
return caller.kind !== 'account' && caller.kind !== 'installation';
|
|
7
|
+
}
|
|
4
8
|
/** Whether the caller crews its ship under a lease: a crew token's crew, or argo's console session. */
|
|
5
9
|
export function isCrew(caller) {
|
|
6
10
|
return 'leaseId' in caller;
|
|
7
11
|
}
|
|
12
|
+
/** The actor an event names for the caller (decision 0057): an account by its id only, with the ship that presented its token. */
|
|
13
|
+
export function actorOf(caller) {
|
|
14
|
+
switch (caller.kind) {
|
|
15
|
+
case 'account':
|
|
16
|
+
return { kind: 'account', accountId: caller.accountId, throughShipId: caller.throughShipId };
|
|
17
|
+
case 'installation':
|
|
18
|
+
return { kind: 'installation' };
|
|
19
|
+
case 'operator':
|
|
20
|
+
case 'viewer':
|
|
21
|
+
case 'agent':
|
|
22
|
+
case 'person':
|
|
23
|
+
case 'app':
|
|
24
|
+
// argo, signed in to the console by an account, names that account on every event it writes (decision 0054).
|
|
25
|
+
return caller.signedInAccountId === undefined ? { kind: 'ship', shipId: caller.shipId } : { kind: 'ship', shipId: caller.shipId, signedInAccountId: caller.signedInAccountId };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
8
28
|
//# sourceMappingURL=caller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caller.js","sourceRoot":"","sources":["../../../src/domain/shared/caller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"caller.js","sourceRoot":"","sources":["../../../src/domain/shared/caller.ts"],"names":[],"mappings":"AA6DA,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,KAAY;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC;AAED,4GAA4G;AAC5G,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC;AACrE,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,MAAM,CAAC,MAAc;IACnC,OAAO,SAAS,IAAI,MAAM,CAAC;AAC7B,CAAC;AAED,kIAAkI;AAClI,MAAM,UAAU,OAAO,CAAC,MAAc;IACpC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;QAC/F,KAAK,cAAc;YACjB,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;QAClC,KAAK,UAAU,CAAC;QAChB,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,QAAQ,CAAC;QACd,KAAK,KAAK;YACR,6GAA6G;YAC7G,OAAO,MAAM,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE,CAAC;IACnL,CAAC;AACH,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' | 'BASE_SCOPE' | 'CLEAR_REQUEST_LIMIT_REACHED' | 'CLEAR_REQUEST_NOT_FOUND' | 'CORE_NAMESPACE' | '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_INVALID' | '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' | 'FORCE_NOT_ALLOWED' | 'FLEET_NOT_FOUND' | 'FLEET_HAS_NO_VIEWER' | 'INVALID_SCOPE' | 'INVALID_SCOPE_DESCRIPTION' | 'NAMESPACE_TAKEN' | 'NOTICE_NOT_FOUND' | 'NOTICE_NOT_DISMISSIBLE' | 'GUIDE_NOT_FOUND' | 'GUIDE_STEP_NOT_FOUND' | 'IDEMPOTENCY_KEY_REUSED' | 'OWN_SHIP_SCOPES' | '
|
|
3
|
+
export type DomainErrorKind = 'ACCOUNT_TOKEN_ENDED' | 'ACCOUNT_TOKEN_INVALID' | 'ASSIGNEE_NOT_ACTIVE' | 'BASE_SCOPE' | 'CLEAR_REQUEST_LIMIT_REACHED' | 'CLEAR_REQUEST_NOT_FOUND' | 'CORE_NAMESPACE' | '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_INVALID' | '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' | 'FORCE_NOT_ALLOWED' | 'FLEET_NOT_FOUND' | 'FLEET_HAS_NO_VIEWER' | 'VIEWER_TICKET_NAMES_NO_ACCOUNT' | 'INVALID_SCOPE' | 'INVALID_SCOPE_DESCRIPTION' | 'NAMESPACE_TAKEN' | 'NOTICE_NOT_FOUND' | 'NOTICE_NOT_DISMISSIBLE' | 'GUIDE_NOT_FOUND' | 'GUIDE_STEP_NOT_FOUND' | 'IDEMPOTENCY_KEY_REUSED' | 'OWN_SHIP_SCOPES' | 'SCOPE_HELD' | 'SCOPE_NOT_DECLARED' | 'SCOPE_NOT_HELD' | 'SECOND_NAMESPACE' | 'SHIP_HAS_NO_OWNER' | 'IN_REPLY_TO_NOT_FOUND' | 'MESSAGE_LIMIT_REACHED' | 'MODEL_REQUIRED' | 'INVALID_HARNESS' | 'MODEL_FROM_ARGO' | 'MODEL_FROM_PERSON_OR_APP' | '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_OWNER' | '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' | 'ACCOUNT_OWNS_NO_LABEL' | 'LABEL_NOT_FOUND' | 'LABEL_VALUE_CARRIED' | 'LABEL_VALUE_NOT_FOUND' | 'LEASE_ENDED' | 'MESSAGE_NOT_FOUND' | 'NETWORK_SETTINGS_CHANGED' | 'NO_NETWORK_RULES_DRAFT' | 'NOT_A_TRIERARCH' | 'NOT_AN_AGENT_SHIP' | 'NOT_THE_LABEL_OWNER' | 'NOT_YOUR_SHIP_TO_LABEL' | 'NOT_REACHABLE' | 'BUILT_IN_RULE_FIXED' | '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' | 'SHIP_NOT_READ_ON_BEHALF' | 'SHIP_SCOPES_FIXED' | 'SIGN_IN_TICKET_INVALID' | 'TOO_MANY_SCOPES' | '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;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/domain/shared/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAY,MAAM,aAAa,CAAC;AAmI5C,qDAAqD;AACrD,MAAM,UAAU,MAAM,CAA4B,IAAO,EAAE,OAAe;IACxE,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import type { DeliveryId, EventId, EventType, FleetId, IdGenerator, MessageId, ShipId } from '@aeolus-fleet/common';
|
|
2
|
-
/**
|
|
1
|
+
import type { AccountId, DeliveryId, EventId, EventType, FleetId, IdGenerator, MessageId, ShipId } from '@aeolus-fleet/common';
|
|
2
|
+
/**
|
|
3
|
+
* Who caused a state change (decision 0057): a ship (`argo` included); an
|
|
4
|
+
* account, by its id only, with the ship that presented its token when one
|
|
5
|
+
* did; the installation; or the system, such as a server command.
|
|
6
|
+
*/
|
|
3
7
|
export type Actor = {
|
|
4
8
|
kind: 'ship';
|
|
5
9
|
shipId: ShipId;
|
|
10
|
+
signedInAccountId?: AccountId;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'account';
|
|
13
|
+
accountId: AccountId;
|
|
14
|
+
throughShipId: ShipId | null;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'installation';
|
|
6
17
|
} | {
|
|
7
18
|
kind: 'system';
|
|
8
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/domain/shared/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/domain/shared/events.ts"],"names":[],"mappings":"AAsBA,MAAM,CAAC,MAAM,MAAM,GAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAEhD,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AA6BD,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAA4C,EAAE,KAAe;IAC7F,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
1
|
+
import { DELIVERY_HISTORY_TYPES, type AccountId, 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
2
|
import type { OverdueClock } from '../messaging/public.js';
|
|
3
3
|
import type { Location, MessageParties } from '../registry/public.js';
|
|
4
4
|
import type { StandingOverdue, WayCrew, WayLease } from './delivery-way.js';
|
|
@@ -30,6 +30,8 @@ export interface TimelineEntry {
|
|
|
30
30
|
occurredAt: Date;
|
|
31
31
|
/** The ship that caused it; null for the system. */
|
|
32
32
|
actor: HistoryParty | null;
|
|
33
|
+
/** The account signed in to the console as argo when argo caused it, by its id only (decision 0054). */
|
|
34
|
+
signedInAccountId: AccountId | null;
|
|
33
35
|
ship: HistoryParty | null;
|
|
34
36
|
/** The message it concerns, with its parties and its content type, by which a ping is told. */
|
|
35
37
|
message: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/domain/shared/history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../../src/domain/shared/history.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAYlB,MAAM,sBAAsB,CAAC;AAuC9B,oHAAoH;AACpH,MAAM,UAAU,SAAS,CAAC,OAA8D,EAAE,SAA8B;IACtH,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACtC,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,EAAE;QACnB,SAAS,EAAE,SAAS,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS;QAC9F,SAAS,EAAE,SAAS,EAAE,EAAE,IAAI,IAAI;KACjC,CAAC;AACJ,CAAC;AAKD,MAAM,UAAU,QAAQ,CAAoC,OAAU;IACpE,OAAO,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;AACxE,CAAC;AAgCD,MAAM,UAAU,oBAAoB,CAAC,IAAe;IAClD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AAClE,CAAC;AA6GD,+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,5 +1,5 @@
|
|
|
1
1
|
import type { FleetId } from '@aeolus-fleet/common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ShipCaller } from './caller.js';
|
|
3
3
|
import type { Clock } from './clock.js';
|
|
4
4
|
/** Outbound port: what a fleet's limits apply to, read outside a unit of work. */
|
|
5
5
|
export interface FleetLimitReads {
|
|
@@ -24,7 +24,7 @@ export interface FleetLimitsRead {
|
|
|
24
24
|
resetsAt: Date;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
export type ReadFleetLimits = (caller:
|
|
27
|
+
export type ReadFleetLimits = (caller: ShipCaller) => Promise<FleetLimitsRead>;
|
|
28
28
|
/**
|
|
29
29
|
* Use case: the caller's fleet's ship and daily message limits, with what
|
|
30
30
|
* each counts by the same measures the limits are enforced by: its ships that
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReadReachOf } from '../registry/public.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ShipCaller } from './caller.js';
|
|
3
3
|
import type { Clock } from './clock.js';
|
|
4
4
|
import { type Health, type HealthRecords } from './health.js';
|
|
5
|
-
export type ReadHealth = (caller:
|
|
5
|
+
export type ReadHealth = (caller: ShipCaller) => Promise<Health>;
|
|
6
6
|
/**
|
|
7
7
|
* Use case: the health of the caller's fleet (decision 0042), for the
|
|
8
8
|
* console's Health: its stuck deliveries by cause and place, the trend over
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { InboxFilter } from '@aeolus-fleet/common';
|
|
2
2
|
import { type ReadReachOf, type ShipRepository } from '../registry/public.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ShipCaller } from './caller.js';
|
|
4
4
|
import type { InboxEntry, ShipHistory } from './history.js';
|
|
5
|
-
export type ReadInbox = (caller:
|
|
5
|
+
export type ReadInbox = (caller: ShipCaller, input: {
|
|
6
6
|
filter: InboxFilter;
|
|
7
7
|
}) => Promise<InboxEntry[]>;
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MessageId } from '@aeolus-fleet/common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ShipCaller } from './caller.js';
|
|
3
3
|
import { type DomainError } from './errors.js';
|
|
4
4
|
import { type DeliveryWay } from './delivery-way.js';
|
|
5
5
|
import { type ReadReachOf } from '../registry/public.js';
|
|
@@ -12,7 +12,7 @@ export type MessageDetail = HistoryMessage & {
|
|
|
12
12
|
history: DeliveryChange[];
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export type ReadMessage = (caller:
|
|
15
|
+
export type ReadMessage = (caller: ShipCaller, input: {
|
|
16
16
|
messageId: MessageId;
|
|
17
17
|
}) => Promise<Result<MessageDetail, DomainError<'MESSAGE_NOT_FOUND'>>>;
|
|
18
18
|
/**
|