@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
-- The jobs that were argo's alone become scopes any actor can be granted (decision 0053): fleet:person,
|
|
2
|
+
-- fleet:owner, fleet:explain, fleet:connect and labels:any join the core scopes (decision 0046).
|
|
3
|
+
CREATE OR REPLACE FUNCTION "ships_scopes_are_known"("scopes" TEXT[]) RETURNS BOOLEAN IMMUTABLE LANGUAGE SQL AS $$
|
|
4
|
+
SELECT "scopes" IS NOT NULL AND NOT EXISTS (
|
|
5
|
+
SELECT 1 FROM unnest("scopes") AS "scope"
|
|
6
|
+
WHERE NOT (
|
|
7
|
+
"scope" = ANY(ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'scopes:declare', 'scopes:grant']::TEXT[])
|
|
8
|
+
OR ("scope" ~ '^[a-z][a-z0-9-]{0,31}:[a-z][a-z0-9-]{0,31}$' AND split_part("scope", ':', 1) <> ALL(ARRAY['messages', 'fleet', 'crew', 'labels', 'scopes']::TEXT[]))
|
|
9
|
+
)
|
|
10
|
+
)
|
|
11
|
+
$$;
|
|
12
|
+
|
|
13
|
+
-- argo holds every scope: every argo gets the five, its scopes kept in catalogue order, a plugin's own after
|
|
14
|
+
-- them. Every state change writes its event: each argo it changes gets ScopesChanged, by the system, taking
|
|
15
|
+
-- the next number of its fleet's stream. Its id is an evt_ id as common/src/ids makes them: the time in
|
|
16
|
+
-- milliseconds, then 80 random bits, in lowercase Crockford base32.
|
|
17
|
+
DO $$
|
|
18
|
+
DECLARE
|
|
19
|
+
alphabet CONSTANT text := '0123456789abcdefghjkmnpqrstvwxyz';
|
|
20
|
+
catalogue CONSTANT text[] := ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'scopes:declare', 'scopes:grant'];
|
|
21
|
+
jobs CONSTANT text[] := ARRAY['fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any'];
|
|
22
|
+
changed record;
|
|
23
|
+
at timestamptz;
|
|
24
|
+
millis bigint;
|
|
25
|
+
body text;
|
|
26
|
+
next_seq bigint;
|
|
27
|
+
BEGIN
|
|
28
|
+
FOR changed IN
|
|
29
|
+
WITH "before" AS (
|
|
30
|
+
SELECT "id", "scopes" FROM "ships" WHERE "kind" = 'operator' AND NOT ("scopes" @> jobs) FOR UPDATE
|
|
31
|
+
)
|
|
32
|
+
UPDATE "ships" SET "scopes" = (
|
|
33
|
+
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "place")
|
|
34
|
+
FROM unnest("ships"."scopes" || ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("ships"."scopes")))) WITH ORDINALITY AS u("scope", "place")
|
|
35
|
+
)
|
|
36
|
+
FROM "before"
|
|
37
|
+
WHERE "ships"."id" = "before"."id"
|
|
38
|
+
RETURNING "ships"."fleet_id", "ships"."id",
|
|
39
|
+
array_to_string(ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("before"."scopes"))), ' ') AS "added"
|
|
40
|
+
LOOP
|
|
41
|
+
at := clock_timestamp();
|
|
42
|
+
millis := floor(extract(epoch FROM at) * 1000)::bigint;
|
|
43
|
+
body := '';
|
|
44
|
+
FOR position IN REVERSE 9..0 LOOP
|
|
45
|
+
body := body || substr(alphabet, ((millis >> (position * 5)) & 31)::integer + 1, 1);
|
|
46
|
+
END LOOP;
|
|
47
|
+
FOR position IN 1..16 LOOP
|
|
48
|
+
body := body || substr(alphabet, floor(random() * 32)::integer + 1, 1);
|
|
49
|
+
END LOOP;
|
|
50
|
+
|
|
51
|
+
UPDATE "fleets" SET "last_event_seq" = "last_event_seq" + 1 WHERE "id" = changed."fleet_id"
|
|
52
|
+
RETURNING "last_event_seq" INTO next_seq;
|
|
53
|
+
INSERT INTO "events" ("id", "fleet_id", "type", "occurred_at", "ship_id", "details", "seq")
|
|
54
|
+
VALUES (
|
|
55
|
+
'evt_' || body,
|
|
56
|
+
changed."fleet_id",
|
|
57
|
+
'ScopesChanged',
|
|
58
|
+
at,
|
|
59
|
+
changed."id",
|
|
60
|
+
jsonb_build_object('added', changed."added", 'removed', ''),
|
|
61
|
+
next_seq
|
|
62
|
+
);
|
|
63
|
+
END LOOP;
|
|
64
|
+
END;
|
|
65
|
+
$$;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- A label belongs to the actor that defined it: a ship, or the installation (decision 0031), which defines
|
|
2
|
+
-- the label group in each fleet (decision 0052). An installation's label names no owner ship.
|
|
3
|
+
CREATE TYPE "label_owner_kind" AS ENUM ('ship', 'installation');
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "labels" ADD COLUMN "owner_kind" "label_owner_kind" NOT NULL DEFAULT 'ship';
|
|
6
|
+
ALTER TABLE "labels" ALTER COLUMN "owner_ship_id" DROP NOT NULL;
|
|
7
|
+
ALTER TABLE "labels" ADD CONSTRAINT "labels_owner_named" CHECK (("owner_ship_id" IS NOT NULL) = ("owner_kind" = 'ship'));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- The network rules the installation declares on the labels it owns, such as group=# to group=# (decisions 0037, 0052):
|
|
2
|
+
-- one row per fleet while it declares any, apart from the ships' declared rules, as it is no ship.
|
|
3
|
+
CREATE TABLE "installation_declared_network_rules" (
|
|
4
|
+
"fleet_id" TEXT NOT NULL,
|
|
5
|
+
"rules" JSONB NOT NULL,
|
|
6
|
+
|
|
7
|
+
CONSTRAINT "installation_declared_network_rules_pkey" PRIMARY KEY ("fleet_id")
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
ALTER TABLE "installation_declared_network_rules" ADD CONSTRAINT "installation_declared_network_rules_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- A ship is commissioned by an actor (decisions 0053, 0057): a ship, an account by its id only, or the installation,
|
|
2
|
+
-- which commissions person ships. commissioned_by names it: the ship's id, the account's id, or 'installation'.
|
|
3
|
+
-- Every commission so far was a ship's. An idempotency key is used once per commissioning actor.
|
|
4
|
+
CREATE TYPE "commissioner_kind" AS ENUM ('ship', 'account', 'installation');
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "ships" ADD COLUMN "commissioned_by_kind" "commissioner_kind";
|
|
7
|
+
UPDATE "ships" SET "commissioned_by_kind" = 'ship' WHERE "commissioned_by" IS NOT NULL;
|
|
8
|
+
ALTER TABLE "ships" ADD CONSTRAINT "ships_commissioner_named" CHECK (
|
|
9
|
+
("commissioned_by" IS NULL) = ("commissioned_by_kind" IS NULL)
|
|
10
|
+
AND ("commissioned_by_kind" <> 'installation' OR "commissioned_by" = 'installation')
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
DROP INDEX "ships_fleet_id_commissioned_by_commission_key_key";
|
|
14
|
+
CREATE UNIQUE INDEX "ships_commission_key_key" ON "ships"("fleet_id", "commissioned_by_kind", "commissioned_by", "commission_key");
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- A sign-in ticket from pagasae may name the account it signs in as argo, by its id only, never its email
|
|
2
|
+
-- (decisions 0054, 0058); the console session it starts keeps that id. Null for argo's own sign-in and a viewer.
|
|
3
|
+
ALTER TABLE "sign_in_tickets" ADD COLUMN "account_id" TEXT;
|
|
4
|
+
ALTER TABLE "console_sessions" ADD COLUMN "account_id" TEXT;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- An event argo writes names the account signed in to the console as it, by its id only (decision 0054).
|
|
2
|
+
-- Earlier events name none.
|
|
3
|
+
ALTER TABLE "events" ADD COLUMN "actor_signed_in_account_id" TEXT;
|
|
4
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_signed_in_account_by_a_ship" CHECK ("actor_signed_in_account_id" IS NULL OR "actor_kind" = 'ship');
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
-- Network rules live in core (decision 0034): the networking plugin goes.
|
|
2
|
+
-- A fleet's own rules are a list, or NULL while none are applied: all-to-all,
|
|
3
|
+
-- open on. A fleet whose open was on for send had no rules in force beside
|
|
4
|
+
-- the built-in ones, so it keeps none; any other keeps its list.
|
|
5
|
+
UPDATE "network_settings" SET "rules" = NULL WHERE "built_in_open_send";
|
|
6
|
+
ALTER TABLE "network_settings" ALTER COLUMN "rules" DROP NOT NULL, ALTER COLUMN "rules" DROP DEFAULT;
|
|
7
|
+
|
|
8
|
+
ALTER TABLE "network_settings"
|
|
9
|
+
DROP CONSTRAINT IF EXISTS "network_settings_plugin_whole",
|
|
10
|
+
DROP COLUMN "built_in_open_send",
|
|
11
|
+
DROP COLUMN "built_in_open_read",
|
|
12
|
+
DROP COLUMN "built_in_open_manage",
|
|
13
|
+
DROP COLUMN "plugin_ship_id",
|
|
14
|
+
DROP COLUMN "plugin_while_unavailable",
|
|
15
|
+
DROP COLUMN "plugin_not_responding_after_seconds",
|
|
16
|
+
DROP COLUMN "plugin_registered_at";
|
|
17
|
+
|
|
18
|
+
ALTER TABLE "reach_refusals" DROP COLUMN "while_plugin_unavailable";
|
|
19
|
+
|
|
20
|
+
-- The draft of a fleet's own rules: one a fleet at most, never in force.
|
|
21
|
+
CREATE TABLE "network_rules_drafts" (
|
|
22
|
+
"fleet_id" TEXT NOT NULL,
|
|
23
|
+
"rules" JSONB,
|
|
24
|
+
"saved_at" TIMESTAMPTZ(3) NOT NULL,
|
|
25
|
+
"saved_against_version" INTEGER NOT NULL,
|
|
26
|
+
|
|
27
|
+
CONSTRAINT "network_rules_drafts_pkey" PRIMARY KEY ("fleet_id")
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
ALTER TABLE "network_rules_drafts" ADD CONSTRAINT "network_rules_drafts_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
-- fleet:verify, writing verified facts about the ships an actor manages, joins the core scopes (decisions 0046, 0059).
|
|
2
|
+
CREATE OR REPLACE FUNCTION "ships_scopes_are_known"("scopes" TEXT[]) RETURNS BOOLEAN IMMUTABLE LANGUAGE SQL AS $$
|
|
3
|
+
SELECT "scopes" IS NOT NULL AND NOT EXISTS (
|
|
4
|
+
SELECT 1 FROM unnest("scopes") AS "scope"
|
|
5
|
+
WHERE NOT (
|
|
6
|
+
"scope" = ANY(ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'fleet:verify', 'scopes:declare', 'scopes:grant']::TEXT[])
|
|
7
|
+
OR ("scope" ~ '^[a-z][a-z0-9-]{0,31}:[a-z][a-z0-9-]{0,31}$' AND split_part("scope", ':', 1) <> ALL(ARRAY['messages', 'fleet', 'crew', 'labels', 'scopes']::TEXT[]))
|
|
8
|
+
)
|
|
9
|
+
)
|
|
10
|
+
$$;
|
|
11
|
+
|
|
12
|
+
-- argo holds every scope: every argo gets fleet:verify, its scopes kept in catalogue order, a plugin's own after
|
|
13
|
+
-- them. Every state change writes its event: each argo it changes gets ScopesChanged, by the system, taking
|
|
14
|
+
-- the next number of its fleet's stream. Its id is an evt_ id as common/src/ids makes them: the time in
|
|
15
|
+
-- milliseconds, then 80 random bits, in lowercase Crockford base32.
|
|
16
|
+
DO $$
|
|
17
|
+
DECLARE
|
|
18
|
+
alphabet CONSTANT text := '0123456789abcdefghjkmnpqrstvwxyz';
|
|
19
|
+
catalogue CONSTANT text[] := ARRAY['messages:send', 'messages:receive', 'messages:force', 'messages:resend', 'fleet:read', 'fleet:commission', 'fleet:manage', 'crew:assign', 'crew:run', 'labels:define', 'labels:assign', 'fleet:network', 'fleet:on-behalf', 'fleet:person', 'fleet:owner', 'fleet:explain', 'fleet:connect', 'labels:any', 'fleet:verify', 'scopes:declare', 'scopes:grant'];
|
|
20
|
+
jobs CONSTANT text[] := ARRAY['fleet:verify'];
|
|
21
|
+
changed record;
|
|
22
|
+
at timestamptz;
|
|
23
|
+
millis bigint;
|
|
24
|
+
body text;
|
|
25
|
+
next_seq bigint;
|
|
26
|
+
BEGIN
|
|
27
|
+
FOR changed IN
|
|
28
|
+
WITH "before" AS (
|
|
29
|
+
SELECT "id", "scopes" FROM "ships" WHERE "kind" = 'operator' AND NOT ("scopes" @> jobs) FOR UPDATE
|
|
30
|
+
)
|
|
31
|
+
UPDATE "ships" SET "scopes" = (
|
|
32
|
+
SELECT array_agg("scope" ORDER BY coalesce(array_position(catalogue, "scope"), cardinality(catalogue) + 1), "place")
|
|
33
|
+
FROM unnest("ships"."scopes" || ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("ships"."scopes")))) WITH ORDINALITY AS u("scope", "place")
|
|
34
|
+
)
|
|
35
|
+
FROM "before"
|
|
36
|
+
WHERE "ships"."id" = "before"."id"
|
|
37
|
+
RETURNING "ships"."fleet_id", "ships"."id",
|
|
38
|
+
array_to_string(ARRAY(SELECT "job" FROM unnest(jobs) AS "job" WHERE NOT ("job" = ANY("before"."scopes"))), ' ') AS "added"
|
|
39
|
+
LOOP
|
|
40
|
+
at := clock_timestamp();
|
|
41
|
+
millis := floor(extract(epoch FROM at) * 1000)::bigint;
|
|
42
|
+
body := '';
|
|
43
|
+
FOR position IN REVERSE 9..0 LOOP
|
|
44
|
+
body := body || substr(alphabet, ((millis >> (position * 5)) & 31)::integer + 1, 1);
|
|
45
|
+
END LOOP;
|
|
46
|
+
FOR position IN 1..16 LOOP
|
|
47
|
+
body := body || substr(alphabet, floor(random() * 32)::integer + 1, 1);
|
|
48
|
+
END LOOP;
|
|
49
|
+
|
|
50
|
+
UPDATE "fleets" SET "last_event_seq" = "last_event_seq" + 1 WHERE "id" = changed."fleet_id"
|
|
51
|
+
RETURNING "last_event_seq" INTO next_seq;
|
|
52
|
+
INSERT INTO "events" ("id", "fleet_id", "type", "occurred_at", "ship_id", "details", "seq")
|
|
53
|
+
VALUES (
|
|
54
|
+
'evt_' || body,
|
|
55
|
+
changed."fleet_id",
|
|
56
|
+
'ScopesChanged',
|
|
57
|
+
at,
|
|
58
|
+
changed."id",
|
|
59
|
+
jsonb_build_object('added', changed."added", 'removed', ''),
|
|
60
|
+
next_seq
|
|
61
|
+
);
|
|
62
|
+
END LOOP;
|
|
63
|
+
END;
|
|
64
|
+
$$;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- One writer's verified facts about a ship (decision 0059): what it checked, set whole and kept with the ship.
|
|
2
|
+
-- CreateEnum
|
|
3
|
+
CREATE TYPE "fact_writer_kind" AS ENUM ('ship', 'account', 'installation');
|
|
4
|
+
|
|
5
|
+
-- CreateTable
|
|
6
|
+
CREATE TABLE "verified_facts" (
|
|
7
|
+
"fleet_id" TEXT NOT NULL,
|
|
8
|
+
"ship_id" TEXT NOT NULL,
|
|
9
|
+
"writer_kind" "fact_writer_kind" NOT NULL,
|
|
10
|
+
"writer" TEXT NOT NULL,
|
|
11
|
+
"facts" JSONB NOT NULL,
|
|
12
|
+
"written_at" TIMESTAMPTZ(3) NOT NULL,
|
|
13
|
+
|
|
14
|
+
CONSTRAINT "verified_facts_pkey" PRIMARY KEY ("fleet_id","ship_id","writer_kind","writer")
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "verified_facts" ADD CONSTRAINT "verified_facts_fleet_id_fkey" FOREIGN KEY ("fleet_id") REFERENCES "fleets"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- AddForeignKey
|
|
21
|
+
ALTER TABLE "verified_facts" ADD CONSTRAINT "verified_facts_fleet_id_ship_id_fkey" FOREIGN KEY ("fleet_id", "ship_id") REFERENCES "ships"("fleet_id", "id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -52,9 +52,12 @@ model Fleet {
|
|
|
52
52
|
labelValues LabelValue[]
|
|
53
53
|
shipLabels ShipLabel[]
|
|
54
54
|
networkSettings NetworkSettings?
|
|
55
|
+
networkRulesDraft NetworkRulesDraft?
|
|
55
56
|
declaredNetworkRules DeclaredNetworkRules[]
|
|
57
|
+
installationDeclaredNetworkRules InstallationDeclaredNetworkRules?
|
|
56
58
|
scopeNamespaces ScopeNamespace[]
|
|
57
59
|
pluginConnections PluginConnection[]
|
|
60
|
+
verifiedFacts VerifiedFacts[]
|
|
58
61
|
reachRefusals ReachRefusal[]
|
|
59
62
|
credentials Credential[]
|
|
60
63
|
messages Message[]
|
|
@@ -93,7 +96,9 @@ model Ship {
|
|
|
93
96
|
note String?
|
|
94
97
|
createdAt DateTime @map("created_at") @db.Timestamptz(3)
|
|
95
98
|
retiredAt DateTime? @map("retired_at") @db.Timestamptz(3)
|
|
96
|
-
/// The
|
|
99
|
+
/// The actor that commissioned it, its idempotency key and the request's hash; null for argo.
|
|
100
|
+
/// commissioned_by names the actor: a ship's id, an account's id, or `installation`.
|
|
101
|
+
commissionedByKind CommissionerKind? @map("commissioned_by_kind")
|
|
97
102
|
commissionedBy String? @map("commissioned_by")
|
|
98
103
|
commissionKey String? @map("commission_key")
|
|
99
104
|
commissionRequestHash String? @map("commission_request_hash")
|
|
@@ -112,6 +117,7 @@ model Ship {
|
|
|
112
117
|
overdueDeliveries OverdueDelivery[]
|
|
113
118
|
consoleSessions ConsoleSession[]
|
|
114
119
|
actorOfEvents Event[] @relation("EventActorShip")
|
|
120
|
+
actorThroughOfEvents Event[] @relation("EventActorThroughShip")
|
|
115
121
|
events Event[] @relation("EventShip")
|
|
116
122
|
crewRequest CrewRequest? @relation("CrewRequestShip")
|
|
117
123
|
assignedCrews CrewRequest[] @relation("CrewRequestAssignee")
|
|
@@ -124,10 +130,11 @@ model Ship {
|
|
|
124
130
|
declaredNetworkRules DeclaredNetworkRules[]
|
|
125
131
|
declaredNamespace ScopeNamespace?
|
|
126
132
|
pluginConnection PluginConnection?
|
|
133
|
+
verifiedFacts VerifiedFacts[]
|
|
127
134
|
|
|
128
135
|
@@unique([fleetId, id])
|
|
129
|
-
/// An idempotency key is used once per commissioning
|
|
130
|
-
@@unique([fleetId, commissionedBy, commissionKey])
|
|
136
|
+
/// An idempotency key is used once per commissioning actor.
|
|
137
|
+
@@unique([fleetId, commissionedByKind, commissionedBy, commissionKey], map: "ships_commission_key_key")
|
|
131
138
|
/// A name is unique among ships that are not retired, and reusable after retirement.
|
|
132
139
|
@@unique([fleetId, name], map: "ships_fleet_id_name_active_key", where: { retiredAt: null })
|
|
133
140
|
/// Exactly one operator ship per fleet.
|
|
@@ -318,10 +325,12 @@ model Label {
|
|
|
318
325
|
id String @id
|
|
319
326
|
fleetId String @map("fleet_id")
|
|
320
327
|
key String
|
|
321
|
-
|
|
328
|
+
/// A ship or the installation (decision 0031); the installation's label names no owner ship.
|
|
329
|
+
ownerKind LabelOwnerKind @default(ship) @map("owner_kind")
|
|
330
|
+
ownerShipId String? @map("owner_ship_id")
|
|
322
331
|
|
|
323
332
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
324
|
-
owner Ship
|
|
333
|
+
owner Ship? @relation("LabelOwner", fields: [fleetId, ownerShipId], references: [fleetId, id])
|
|
325
334
|
values LabelValue[]
|
|
326
335
|
carriers ShipLabel[]
|
|
327
336
|
|
|
@@ -376,27 +385,33 @@ model ShipLabel {
|
|
|
376
385
|
/// rules as JSON, none (null) for all-to-all, and their version. A send and a
|
|
377
386
|
/// set take turns on an advisory lock on them (network.ts).
|
|
378
387
|
model NetworkSettings {
|
|
379
|
-
fleetId
|
|
380
|
-
rules
|
|
381
|
-
///
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
builtInOpenManage Boolean @default(true) @map("built_in_open_manage")
|
|
387
|
-
version Int
|
|
388
|
-
/// The fleet's networking plugin (decision 0035): its ship, what it
|
|
389
|
-
/// declared and when it first registered, all four set or none.
|
|
390
|
-
pluginShipId String? @map("plugin_ship_id")
|
|
391
|
-
pluginWhileUnavailable String? @map("plugin_while_unavailable")
|
|
392
|
-
pluginNotRespondingAfterSeconds Int? @map("plugin_not_responding_after_seconds")
|
|
393
|
-
pluginRegisteredAt DateTime? @map("plugin_registered_at") @db.Timestamptz(3)
|
|
388
|
+
fleetId String @id @map("fleet_id")
|
|
389
|
+
/// The fleet's own rules as last applied (decision 0034); NULL while none
|
|
390
|
+
/// are, all-to-all with open on.
|
|
391
|
+
rules Json?
|
|
392
|
+
/// The viewer reading every ship, the built-in rule an actor turns (decision 0034). On at fleet create.
|
|
393
|
+
builtInViewerRead Boolean @default(true) @map("built_in_viewer_read")
|
|
394
|
+
version Int
|
|
394
395
|
|
|
395
396
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
396
397
|
|
|
397
398
|
@@map("network_settings")
|
|
398
399
|
}
|
|
399
400
|
|
|
401
|
+
/// The draft of a fleet's own rules (decision 0034): one a fleet at most, the
|
|
402
|
+
/// rules as JSON or NULL for all-to-all. Nothing in force reads it; an apply
|
|
403
|
+
/// moves it into network_settings and removes it.
|
|
404
|
+
model NetworkRulesDraft {
|
|
405
|
+
fleetId String @id @map("fleet_id")
|
|
406
|
+
rules Json?
|
|
407
|
+
savedAt DateTime @map("saved_at") @db.Timestamptz(3)
|
|
408
|
+
savedAgainstVersion Int @map("saved_against_version")
|
|
409
|
+
|
|
410
|
+
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
411
|
+
|
|
412
|
+
@@map("network_rules_drafts")
|
|
413
|
+
}
|
|
414
|
+
|
|
400
415
|
/// The network rules a ship declared on the labels it owns (decision 0037),
|
|
401
416
|
/// its whole list as JSON, at most 20. No row while it declares none; a retire
|
|
402
417
|
/// removes its row.
|
|
@@ -412,6 +427,18 @@ model DeclaredNetworkRules {
|
|
|
412
427
|
@@map("declared_network_rules")
|
|
413
428
|
}
|
|
414
429
|
|
|
430
|
+
/// The network rules the installation declares on the labels it owns in one
|
|
431
|
+
/// fleet (decisions 0037, 0052), its whole list as JSON; no row while it
|
|
432
|
+
/// declares none.
|
|
433
|
+
model InstallationDeclaredNetworkRules {
|
|
434
|
+
fleetId String @id @map("fleet_id")
|
|
435
|
+
rules Json
|
|
436
|
+
|
|
437
|
+
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
438
|
+
|
|
439
|
+
@@map("installation_declared_network_rules")
|
|
440
|
+
}
|
|
441
|
+
|
|
415
442
|
/// A plugin's namespace (decision 0046): taken up for good by the ship that
|
|
416
443
|
/// declared it, one per ship and unique in the fleet, with its whole list of
|
|
417
444
|
/// scopes and their descriptions as JSON, in order. It goes when its declarer
|
|
@@ -444,6 +471,27 @@ model PluginConnection {
|
|
|
444
471
|
@@map("plugin_connections")
|
|
445
472
|
}
|
|
446
473
|
|
|
474
|
+
/// One writer's verified facts about a ship (decision 0059): what it checked,
|
|
475
|
+
/// as JSON in the shape common gives, set whole and kept with the ship. The
|
|
476
|
+
/// writer is an actor: a ship or an account by its id, or the installation
|
|
477
|
+
/// by its name, as a commissioning actor is.
|
|
478
|
+
model VerifiedFacts {
|
|
479
|
+
fleetId String @map("fleet_id")
|
|
480
|
+
shipId String @map("ship_id")
|
|
481
|
+
writerKind FactWriterKind @map("writer_kind")
|
|
482
|
+
writer String
|
|
483
|
+
facts Json
|
|
484
|
+
writtenAt DateTime @map("written_at") @db.Timestamptz(3)
|
|
485
|
+
|
|
486
|
+
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
487
|
+
ship Ship @relation(fields: [fleetId, shipId], references: [fleetId, id])
|
|
488
|
+
|
|
489
|
+
@@id([fleetId, shipId, writerKind, writer])
|
|
490
|
+
/// A retiring writer finds its facts about every ship.
|
|
491
|
+
@@index([fleetId, writerKind, writer])
|
|
492
|
+
@@map("verified_facts")
|
|
493
|
+
}
|
|
494
|
+
|
|
447
495
|
/// A send the network rules refused (decision 0034), recorded in the
|
|
448
496
|
/// transaction that refused it. Ids start with rfs_. Sender and recipient are
|
|
449
497
|
/// as they were then: ids, names and the label values they carried, as JSON,
|
|
@@ -459,9 +507,6 @@ model ReachRefusal {
|
|
|
459
507
|
/// What the sender tried to do: send, read or manage (decision 0034).
|
|
460
508
|
verb String
|
|
461
509
|
settingsVersion Int @map("settings_version")
|
|
462
|
-
/// What the networking plugin declared, when it refused while the plugin
|
|
463
|
-
/// was not responding (decision 0035): block-all or keep-latest.
|
|
464
|
-
whilePluginUnavailable String? @map("while_plugin_unavailable")
|
|
465
510
|
|
|
466
511
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
467
512
|
|
|
@@ -658,7 +703,15 @@ model Event {
|
|
|
658
703
|
fleetId String @map("fleet_id")
|
|
659
704
|
type String
|
|
660
705
|
occurredAt DateTime @map("occurred_at") @db.Timestamptz(3)
|
|
706
|
+
/// Who caused it (decision 0057): a ship, an account, the installation or the system.
|
|
707
|
+
actorKind EventActorKind @default(system) @map("actor_kind")
|
|
661
708
|
actorShipId String? @map("actor_ship_id")
|
|
709
|
+
/// The account that caused it, by pagasae's id only: never an email.
|
|
710
|
+
actorAccountId String? @map("actor_account_id")
|
|
711
|
+
/// The ship that presented the account's token, a plugin's page or the gateway, if one did.
|
|
712
|
+
actorThroughShipId String? @map("actor_through_ship_id")
|
|
713
|
+
/// The account signed in to the console as argo when argo caused it, by its id only (decision 0054).
|
|
714
|
+
actorSignedInAccountId String? @map("actor_signed_in_account_id")
|
|
662
715
|
shipId String? @map("ship_id")
|
|
663
716
|
messageId String? @map("message_id")
|
|
664
717
|
deliveryId String? @map("delivery_id")
|
|
@@ -670,6 +723,7 @@ model Event {
|
|
|
670
723
|
|
|
671
724
|
fleet Fleet @relation(fields: [fleetId], references: [id])
|
|
672
725
|
actorShip Ship? @relation("EventActorShip", fields: [fleetId, actorShipId], references: [fleetId, id], onDelete: Restrict)
|
|
726
|
+
actorThroughShip Ship? @relation("EventActorThroughShip", fields: [fleetId, actorThroughShipId], references: [fleetId, id], onDelete: Restrict)
|
|
673
727
|
ship Ship? @relation("EventShip", fields: [fleetId, shipId], references: [fleetId, id], onDelete: Restrict)
|
|
674
728
|
message Message? @relation(fields: [fleetId, messageId], references: [fleetId, id], onDelete: Restrict)
|
|
675
729
|
delivery Delivery? @relation(fields: [fleetId, deliveryId], references: [fleetId, id], onDelete: Restrict)
|
|
@@ -678,6 +732,7 @@ model Event {
|
|
|
678
732
|
/// Every foreign key has an index leading with its columns, so deleting a
|
|
679
733
|
/// referenced row checks it with an index, not a scan (#331).
|
|
680
734
|
@@index([fleetId, actorShipId])
|
|
735
|
+
@@index([actorThroughShipId, fleetId])
|
|
681
736
|
@@index([fleetId, shipId])
|
|
682
737
|
@@index([fleetId, messageId])
|
|
683
738
|
@@index([fleetId, deliveryId])
|
|
@@ -692,6 +747,7 @@ enum ConsoleSessionEndReason {
|
|
|
692
747
|
takenOver
|
|
693
748
|
signedOut
|
|
694
749
|
passwordReset
|
|
750
|
+
accountCutOff
|
|
695
751
|
|
|
696
752
|
@@map("console_session_end_reason")
|
|
697
753
|
}
|
|
@@ -738,6 +794,8 @@ model ConsoleSession {
|
|
|
738
794
|
endsBy DateTime? @map("ends_by") @db.Timestamptz(3)
|
|
739
795
|
/// The device it signed in from, as the browser told: "Mac · Chrome".
|
|
740
796
|
device String @default("Unknown device")
|
|
797
|
+
/// The account that signed in as argo, by its id only; null for argo's own sign-in and a viewer (decision 0054).
|
|
798
|
+
accountId String? @map("account_id")
|
|
741
799
|
tokenHash String @unique @map("token_hash")
|
|
742
800
|
createdAt DateTime @map("created_at") @db.Timestamptz(3)
|
|
743
801
|
lastUsedAt DateTime @map("last_used_at") @db.Timestamptz(3)
|
|
@@ -770,6 +828,8 @@ model SignInTicket {
|
|
|
770
828
|
fleetId String @map("fleet_id")
|
|
771
829
|
/// Whom it signs in as: the operator or a viewer (decision 0022).
|
|
772
830
|
signInAs SignInAs @map("sign_in_as")
|
|
831
|
+
/// The account it signs in as argo, by its id only; null for argo's own or a viewer's ticket (decision 0054).
|
|
832
|
+
accountId String? @map("account_id")
|
|
773
833
|
issuedAt DateTime @map("issued_at") @db.Timestamptz(3)
|
|
774
834
|
expiresAt DateTime @map("expires_at") @db.Timestamptz(3)
|
|
775
835
|
/// When it signed in; null while unused.
|
|
@@ -899,3 +959,52 @@ model GuideProgress {
|
|
|
899
959
|
@@index([fleetId])
|
|
900
960
|
@@map("guide_progress")
|
|
901
961
|
}
|
|
962
|
+
|
|
963
|
+
/// An account pagasae cut off (decision 0058): its tokens issued before
|
|
964
|
+
/// cut_off_at are refused in every fleet until forget_at, when the longest of
|
|
965
|
+
/// them has ended. The installation's, not a fleet's: no fleet_id (ADR 0007).
|
|
966
|
+
/// Never an email: the account by pagasae's id only.
|
|
967
|
+
model AccountCutOff {
|
|
968
|
+
accountId String @id @map("account_id")
|
|
969
|
+
cutOffAt DateTime @map("cut_off_at") @db.Timestamptz(3)
|
|
970
|
+
forgetAt DateTime @map("forget_at") @db.Timestamptz(3)
|
|
971
|
+
|
|
972
|
+
/// Forgetting finds the cut-offs that ended.
|
|
973
|
+
@@index([forgetAt])
|
|
974
|
+
@@map("account_cut_offs")
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/// Who caused an event (decision 0057).
|
|
978
|
+
enum EventActorKind {
|
|
979
|
+
ship
|
|
980
|
+
account
|
|
981
|
+
installation
|
|
982
|
+
system
|
|
983
|
+
|
|
984
|
+
@@map("event_actor_kind")
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/// Who commissioned a ship (decision 0057).
|
|
988
|
+
/// Who wrote a verified fact (decision 0059).
|
|
989
|
+
enum FactWriterKind {
|
|
990
|
+
ship
|
|
991
|
+
account
|
|
992
|
+
installation
|
|
993
|
+
|
|
994
|
+
@@map("fact_writer_kind")
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
enum CommissionerKind {
|
|
998
|
+
ship
|
|
999
|
+
account
|
|
1000
|
+
installation
|
|
1001
|
+
|
|
1002
|
+
@@map("commissioner_kind")
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
enum LabelOwnerKind {
|
|
1006
|
+
ship
|
|
1007
|
+
installation
|
|
1008
|
+
|
|
1009
|
+
@@map("label_owner_kind")
|
|
1010
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ShipId } from '@aeolus-fleet/common';
|
|
2
|
-
import type { Caller } from '../shared/caller.js';
|
|
3
|
-
import { type Result } from '../shared/result.js';
|
|
4
|
-
import type { UnitOfWork } from '../shared/unit-of-work.js';
|
|
5
|
-
import type { NetworkSettingsRepository } from './ports.js';
|
|
6
|
-
export interface ReadNetworkPluginTx {
|
|
7
|
-
networkSettings: Pick<NetworkSettingsRepository, 'findForShare'>;
|
|
8
|
-
}
|
|
9
|
-
export interface RegisteredNetworkPlugin {
|
|
10
|
-
shipId: ShipId;
|
|
11
|
-
registeredAt: Date;
|
|
12
|
-
}
|
|
13
|
-
export type ReadNetworkPlugin = (caller: Caller) => Promise<Result<RegisteredNetworkPlugin | null, never>>;
|
|
14
|
-
/**
|
|
15
|
-
* Use case: the caller's fleet's networking plugin, its ship and when it
|
|
16
|
-
* registered, or none (decision 0035): the gateway switches on for a fleet
|
|
17
|
-
* only while it has one (interop I-3). Its scope (fleet:read) is checked
|
|
18
|
-
* before this runs. Read under the shared settings lock, so it answers one
|
|
19
|
-
* version.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createReadNetworkPlugin(deps: {
|
|
22
|
-
uow: UnitOfWork<ReadNetworkPluginTx>;
|
|
23
|
-
}): ReadNetworkPlugin;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ok } from '../shared/result.js';
|
|
2
|
-
/**
|
|
3
|
-
* Use case: the caller's fleet's networking plugin, its ship and when it
|
|
4
|
-
* registered, or none (decision 0035): the gateway switches on for a fleet
|
|
5
|
-
* only while it has one (interop I-3). Its scope (fleet:read) is checked
|
|
6
|
-
* before this runs. Read under the shared settings lock, so it answers one
|
|
7
|
-
* version.
|
|
8
|
-
*/
|
|
9
|
-
export function createReadNetworkPlugin(deps) {
|
|
10
|
-
return (caller) => deps.uow.run(async (tx) => {
|
|
11
|
-
const { plugin } = await tx.networkSettings.findForShare(caller.fleetId);
|
|
12
|
-
return ok(plugin === null ? null : { shipId: plugin.shipId, registeredAt: plugin.registeredAt });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=read-network-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-network-plugin.js","sourceRoot":"","sources":["../../../src/domain/registry/read-network-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAetD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA8C;IACpF,OAAO,CAAC,MAAM,EAAE,EAAE,CAChB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAA0D,EAAE;QAChF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { IdGenerator, NetworkPluginDeclaration } from '@aeolus-fleet/common';
|
|
2
|
-
import type { Caller } from '../shared/caller.js';
|
|
3
|
-
import type { Clock } from '../shared/clock.js';
|
|
4
|
-
import { type EventLog } from '../shared/events.js';
|
|
5
|
-
import { type Result } from '../shared/result.js';
|
|
6
|
-
import type { UnitOfWork } from '../shared/unit-of-work.js';
|
|
7
|
-
import { type RegisterNetworkPluginRefusal } from './network-settings.js';
|
|
8
|
-
import type { NetworkSettingsRepository } from './ports.js';
|
|
9
|
-
export interface RegisterNetworkPluginTx {
|
|
10
|
-
networkSettings: Pick<NetworkSettingsRepository, 'findForUpdate' | 'save'>;
|
|
11
|
-
events: EventLog;
|
|
12
|
-
}
|
|
13
|
-
export type RegisterNetworkPlugin = (caller: Caller, input: NetworkPluginDeclaration) => Promise<Result<{
|
|
14
|
-
version: number;
|
|
15
|
-
}, RegisterNetworkPluginRefusal>>;
|
|
16
|
-
/**
|
|
17
|
-
* Use case: the caller's ship becomes the fleet's networking plugin, saying
|
|
18
|
-
* what happens to sends while it is unavailable and after how long without a
|
|
19
|
-
* call it is not responding (decision 0035). Its scope (fleet:network) is
|
|
20
|
-
* checked before this runs. In one unit of work, holding the settings
|
|
21
|
-
* exclusively as a set of rules does: the settings at their next version,
|
|
22
|
-
* and NetworkPluginRegistered.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createRegisterNetworkPlugin(deps: {
|
|
25
|
-
uow: UnitOfWork<RegisterNetworkPluginTx>;
|
|
26
|
-
clock: Clock;
|
|
27
|
-
ids: IdGenerator;
|
|
28
|
-
}): RegisterNetworkPlugin;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { recordEvent, shipActor } from '../shared/events.js';
|
|
2
|
-
import { ok } from '../shared/result.js';
|
|
3
|
-
import { registerNetworkPlugin } from './network-settings.js';
|
|
4
|
-
/**
|
|
5
|
-
* Use case: the caller's ship becomes the fleet's networking plugin, saying
|
|
6
|
-
* what happens to sends while it is unavailable and after how long without a
|
|
7
|
-
* call it is not responding (decision 0035). Its scope (fleet:network) is
|
|
8
|
-
* checked before this runs. In one unit of work, holding the settings
|
|
9
|
-
* exclusively as a set of rules does: the settings at their next version,
|
|
10
|
-
* and NetworkPluginRegistered.
|
|
11
|
-
*/
|
|
12
|
-
export function createRegisterNetworkPlugin(deps) {
|
|
13
|
-
return (caller, declaration) => deps.uow.run(async (tx) => {
|
|
14
|
-
const current = await tx.networkSettings.findForUpdate(caller.fleetId);
|
|
15
|
-
const registered = registerNetworkPlugin(current, { shipId: caller.shipId, declaration, at: deps.clock.now(), actor: shipActor(caller.shipId) });
|
|
16
|
-
if (!registered.isOk) {
|
|
17
|
-
return registered;
|
|
18
|
-
}
|
|
19
|
-
await tx.networkSettings.save(registered.value.settings);
|
|
20
|
-
for (const event of registered.value.events) {
|
|
21
|
-
await recordEvent({ events: tx.events, ids: deps.ids }, event);
|
|
22
|
-
}
|
|
23
|
-
return ok({ version: registered.value.settings.version });
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=register-network-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register-network-plugin.js","sourceRoot":"","sources":["../../../src/domain/registry/register-network-plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAiB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,EAAE,EAAe,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAqC,MAAM,uBAAuB,CAAC;AAUjG;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAkF;IAC5H,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAC7B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAsE,EAAE;QAC5F,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACvE,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjJ,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACrB,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACzD,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5C,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,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC"}
|