@aeolus-fleet/core 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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 +36 -0
- package/dist/adapters/prisma/generated/client.d.ts +36 -0
- package/dist/adapters/prisma/generated/commonInputTypes.d.ts +150 -0
- package/dist/adapters/prisma/generated/enums.d.ts +33 -0
- package/dist/adapters/prisma/generated/enums.js +29 -1
- package/dist/adapters/prisma/generated/enums.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/class.d.ts +55 -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 +463 -8
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js +45 -10
- package/dist/adapters/prisma/generated/internal/prismaNamespace.js.map +1 -1
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.d.ts +47 -7
- package/dist/adapters/prisma/generated/internal/prismaNamespaceBrowser.js +45 -10
- 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 +1270 -116
- 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/Lease.d.ts +60 -1
- 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 -223
- package/dist/adapters/prisma/generated/models/PluginConnection.d.ts +1180 -0
- package/dist/adapters/prisma/generated/models/PluginConnection.js +2 -0
- package/dist/adapters/prisma/generated/models/PluginConnection.js.map +1 -0
- package/dist/adapters/prisma/generated/models/ReachRefusal.d.ts +1 -40
- package/dist/adapters/prisma/generated/models/Ship.d.ts +1072 -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 +5 -0
- package/dist/adapters/prisma/history.js +5 -2
- 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/messaging.js +5 -2
- package/dist/adapters/prisma/messaging.js.map +1 -1
- package/dist/adapters/prisma/network.d.ts +7 -2
- package/dist/adapters/prisma/network.js +92 -62
- package/dist/adapters/prisma/network.js.map +1 -1
- package/dist/adapters/prisma/overdue.js +4 -3
- package/dist/adapters/prisma/overdue.js.map +1 -1
- package/dist/adapters/prisma/plugin-connections.d.ts +4 -0
- package/dist/adapters/prisma/plugin-connections.js +20 -0
- package/dist/adapters/prisma/plugin-connections.js.map +1 -0
- package/dist/adapters/prisma/registry.js +22 -16
- package/dist/adapters/prisma/registry.js.map +1 -1
- package/dist/adapters/prisma/rows.d.ts +9 -4
- package/dist/adapters/prisma/rows.js +77 -19
- package/dist/adapters/prisma/rows.js.map +1 -1
- package/dist/adapters/prisma/unit-of-work.d.ts +5 -2
- package/dist/adapters/prisma/unit-of-work.js +7 -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 +28 -6
- package/dist/adapters/trpc/fleet.d.ts +314 -51
- package/dist/adapters/trpc/fleet.js +137 -75
- 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 +435 -42
- package/dist/adapters/trpc/ship-contract.js +6 -3
- package/dist/adapters/trpc/ship-contract.js.map +1 -1
- package/dist/adapters/trpc/ship-protocol.js +1 -1
- package/dist/adapters/trpc/ship-protocol.js.map +1 -1
- package/dist/adapters/trpc/ship.d.ts +117 -1
- package/dist/adapters/trpc/ship.js +52 -6
- package/dist/adapters/trpc/ship.js.map +1 -1
- package/dist/adapters/trpc/trpc.d.ts +43 -17
- package/dist/adapters/trpc/trpc.js +131 -31
- 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 +11 -3
- package/dist/domain/messaging/delivery.js +23 -15
- package/dist/domain/messaging/delivery.js.map +1 -1
- package/dist/domain/messaging/dismiss-delivery.d.ts +2 -2
- package/dist/domain/messaging/hand-over-delivery.d.ts +1 -0
- package/dist/domain/messaging/hand-over-delivery.js +1 -0
- package/dist/domain/messaging/hand-over-delivery.js.map +1 -1
- 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/overdue.d.ts +2 -0
- package/dist/domain/messaging/overdue.js +3 -0
- package/dist/domain/messaging/overdue.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/ports.d.ts +2 -0
- package/dist/domain/messaging/push-receive-deliveries.d.ts +4 -1
- package/dist/domain/messaging/push-receive-deliveries.js +5 -3
- package/dist/domain/messaging/push-receive-deliveries.js.map +1 -1
- package/dist/domain/messaging/receive-deliveries.d.ts +21 -0
- package/dist/domain/messaging/receive-deliveries.js +5 -3
- package/dist/domain/messaging/receive-deliveries.js.map +1 -1
- package/dist/domain/messaging/receive-reply.d.ts +32 -0
- package/dist/domain/messaging/receive-reply.js +25 -0
- package/dist/domain/messaging/receive-reply.js.map +1 -0
- 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 +49 -24
- package/dist/domain/registry/check-reach.js +77 -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 +26 -13
- package/dist/domain/registry/commission-ship.js +199 -22
- 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 +31 -0
- package/dist/domain/registry/connect-plugin.js +34 -0
- package/dist/domain/registry/connect-plugin.js.map +1 -0
- 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 +12 -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 +22 -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/leases.d.ts +6 -3
- package/dist/domain/registry/leases.js +7 -5
- package/dist/domain/registry/leases.js.map +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 +96 -115
- package/dist/domain/registry/network-settings.js +101 -150
- package/dist/domain/registry/network-settings.js.map +1 -1
- package/dist/domain/registry/plugin-connection.d.ts +48 -0
- package/dist/domain/registry/plugin-connection.js +35 -0
- package/dist/domain/registry/plugin-connection.js.map +1 -0
- package/dist/domain/registry/ports.d.ts +60 -12
- 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 +5 -4
- package/dist/domain/registry/read-built-in-rules.js +9 -7
- 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 +10 -10
- package/dist/domain/registry/read-reach.js +26 -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 +5 -3
- package/dist/domain/registry/recrew-ship.js.map +1 -1
- package/dist/domain/registry/release-ship.d.ts +7 -4
- package/dist/domain/registry/release-ship.js +8 -4
- 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 +17 -12
- package/dist/domain/registry/retire-ship.js +30 -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 +55 -17
- package/dist/domain/registry/ship.js +107 -16
- 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/delivery-way.d.ts +9 -5
- package/dist/domain/shared/delivery-way.js +17 -5
- package/dist/domain/shared/delivery-way.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/health.d.ts +3 -1
- package/dist/domain/shared/health.js +5 -3
- package/dist/domain/shared/health.js.map +1 -1
- package/dist/domain/shared/history.d.ts +5 -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 +4 -3
- package/dist/domain/shared/read-health.js +9 -3
- package/dist/domain/shared/read-health.js.map +1 -1
- 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 +31 -0
- package/dist/domain/shared/read-sent-message.js +28 -0
- package/dist/domain/shared/read-sent-message.js.map +1 -0
- 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/domain/shared/stuck.js +4 -2
- package/dist/domain/shared/stuck.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/container-images.d.ts +14 -0
- package/dist/testing/container-images.js +18 -0
- package/dist/testing/container-images.js.map +1 -0
- package/dist/testing/database.d.ts +14 -0
- package/dist/testing/database.js +48 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/fleet.d.ts +13 -0
- package/dist/testing/fleet.js +17 -0
- package/dist/testing/fleet.js.map +1 -0
- package/dist/testing/index.d.ts +12 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/keys.d.ts +1 -0
- package/dist/testing/keys.js +7 -0
- package/dist/testing/keys.js.map +1 -0
- package/dist/testing/migrate-lock.d.ts +12 -0
- package/dist/testing/migrate-lock.js +51 -0
- package/dist/testing/migrate-lock.js.map +1 -0
- package/dist/testing/migrated-template.d.ts +12 -0
- package/dist/testing/migrated-template.js +29 -0
- package/dist/testing/migrated-template.js.map +1 -0
- package/dist/testing/postgres-container.d.ts +16 -0
- package/dist/testing/postgres-container.js +30 -0
- package/dist/testing/postgres-container.js.map +1 -0
- package/dist/testing/postgres-global-setup.d.ts +15 -0
- package/dist/testing/postgres-global-setup.js +20 -0
- package/dist/testing/postgres-global-setup.js.map +1 -0
- package/dist/testing/prisma-cli.d.ts +5 -0
- package/dist/testing/prisma-cli.js +15 -0
- package/dist/testing/prisma-cli.js.map +1 -0
- package/dist/testing/result.d.ts +5 -0
- package/dist/testing/result.js +15 -0
- package/dist/testing/result.js.map +1 -0
- package/dist/wiring.d.ts +27 -6
- package/dist/wiring.js +44 -11
- package/dist/wiring.js.map +1 -1
- package/package.json +26 -3
- package/src/adapters/prisma/migrations/20261018250000_scope_catalogue/migration.sql +8 -7
- package/src/adapters/prisma/migrations/20261019100000_on_behalf_scope/migration.sql +3 -1
- package/src/adapters/prisma/migrations/20261019130000_plugin_connections/migration.sql +54 -0
- package/src/adapters/prisma/migrations/20261019150000_network_plugin_registered_at/migration.sql +23 -0
- package/src/adapters/prisma/migrations/20261019160000_lease_waker/migration.sql +4 -0
- 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 +160 -22
- 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
|
@@ -2,118 +2,74 @@
|
|
|
2
2
|
* The fleet's network settings (decision 0034): which ships may send to,
|
|
3
3
|
* read or manage which. A rule names its verb and says that the ships
|
|
4
4
|
* matching one selector may do it to the ships matching another; allow-only,
|
|
5
|
-
* no deny rules, no precedence.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* no deny rules, no precedence. The fleet holds its own rules, set whole by
|
|
6
|
+
* applying a draft, or none for all-to-all, beside the switch of the viewer
|
|
7
|
+
* reading, with a version that moves on every change of what is in force, so
|
|
8
|
+
* a refusal names the settings that refused it.
|
|
8
9
|
*/
|
|
9
|
-
import { type FleetId, type LabelId, type LabelValueId, type BuiltInRule, type
|
|
10
|
+
import { type FleetId, type LabelId, type LabelValueId, type BuiltInRule, type NetworkVerb, type SelectorTerm, type SetBuiltInRuleInput, type ShipId, type ShipKind } from '@aeolus-fleet/common';
|
|
10
11
|
import { type DomainError } from '../shared/errors.js';
|
|
11
12
|
import type { Actor, NewEvent } from '../shared/events.js';
|
|
12
13
|
import { type Result } from '../shared/result.js';
|
|
14
|
+
import type { DeclaredNetworkRules } from './declared-network-rules.js';
|
|
15
|
+
import type { LabelOwner } from './label.js';
|
|
13
16
|
/** The ships for which every term of `from` holds may do its verb to the ships for which every term of `to` holds. */
|
|
14
17
|
export interface NetworkRule {
|
|
15
18
|
verb: NetworkVerb;
|
|
16
19
|
from: readonly SelectorTerm[];
|
|
17
20
|
to: readonly SelectorTerm[];
|
|
18
21
|
}
|
|
19
|
-
/**
|
|
20
|
-
* The fleet's networking plugin (decision 0035): the ship that alone sets the
|
|
21
|
-
* rules while registered, with what it declared for while it is unavailable.
|
|
22
|
-
*/
|
|
23
|
-
export interface NetworkPlugin extends NetworkPluginDeclaration {
|
|
24
|
-
shipId: ShipId;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* The built-in rules that can be off (decision 0034): the viewer reading
|
|
28
|
-
* every ship, argo's to switch, and open, every ship to every ship, one per
|
|
29
|
-
* verb, the networking plugin's to switch. A fleet starts with all on.
|
|
30
|
-
*/
|
|
31
|
-
export interface BuiltInSwitches {
|
|
32
|
-
isViewerReadOn: boolean;
|
|
33
|
-
open: Readonly<Record<NetworkVerb, boolean>>;
|
|
34
|
-
}
|
|
35
22
|
export interface NetworkSettings {
|
|
36
23
|
fleetId: FleetId;
|
|
37
|
-
/** The rules beside the built-in
|
|
38
|
-
rules: readonly NetworkRule[];
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
/** The fleet's own rules beside the built-in and the declared ones, as last applied; none while none are, all-to-all with open on. */
|
|
25
|
+
rules: readonly NetworkRule[] | null;
|
|
26
|
+
/** The viewer reading every ship, the one built-in rule an actor turns (decision 0034); on at fleet create. */
|
|
27
|
+
isViewerReadOn: boolean;
|
|
28
|
+
/** 0 until the fleet first changes its settings; one more on every change of what is in force. */
|
|
41
29
|
version: number;
|
|
42
|
-
/** The fleet's networking plugin, or none: then the fleet has no rules, and nobody sets them. */
|
|
43
|
-
plugin: NetworkPlugin | null;
|
|
44
30
|
}
|
|
45
|
-
/**
|
|
46
|
-
export declare const BUILT_INS_ON: BuiltInSwitches;
|
|
47
|
-
/** A fleet that never set rules: none, every built-in rule on, at version 0, without a plugin. */
|
|
31
|
+
/** A fleet that never set rules: none applied, the viewer reading on, at version 0. */
|
|
48
32
|
export declare function noNetworkSettings(fleetId: FleetId): NetworkSettings;
|
|
49
|
-
export type
|
|
50
|
-
export type SetNetworkRulesRefusal = DomainError<'INVALID_NETWORK_RULES'> | NotTheNetworkPlugin;
|
|
51
|
-
export type RegisterNetworkPluginRefusal = DomainError<'NETWORK_PLUGIN_REGISTERED'>;
|
|
33
|
+
export type InvalidNetworkRules = DomainError<'INVALID_NETWORK_RULES'>;
|
|
52
34
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
35
|
+
* What breaks the decisions' limits on the fleet's own rules, said for the
|
|
36
|
+
* caller with its decision, or undefined when they keep them: at most 200,
|
|
37
|
+
* counted alone, beside the declared ones (decision 0037); each selector at
|
|
38
|
+
* most 20 terms, as a ship carries no more label values, each term once, and
|
|
39
|
+
* a term of the same value on a label on both sides of its rule, as it binds
|
|
40
|
+
* that label there. An id need not exist: an unknown one matches no ship, as
|
|
41
|
+
* in label selection. None, all-to-all, keeps them.
|
|
58
42
|
*/
|
|
59
|
-
export declare function
|
|
60
|
-
shipId: ShipId;
|
|
61
|
-
declaration: NetworkPluginDeclaration;
|
|
62
|
-
at: Date;
|
|
63
|
-
actor: Actor;
|
|
64
|
-
}): Result<{
|
|
65
|
-
settings: NetworkSettings;
|
|
66
|
-
events: NewEvent[];
|
|
67
|
-
}, RegisterNetworkPluginRefusal>;
|
|
68
|
-
/**
|
|
69
|
-
* The fleet's plugin goes, and its rules with it, and the open rules are on
|
|
70
|
-
* again: no plugin is all-to-all (decision 0035), at the next version, with
|
|
71
|
-
* NetworkPluginUnregistered. The viewer reading stays as argo set it. Only
|
|
72
|
-
* the plugin's own ship unregisters it; its retirement does too.
|
|
73
|
-
*/
|
|
74
|
-
export declare function unregisterNetworkPlugin(current: NetworkSettings, change: {
|
|
75
|
-
shipId: ShipId;
|
|
76
|
-
at: Date;
|
|
77
|
-
actor: Actor;
|
|
78
|
-
}): Result<{
|
|
79
|
-
settings: NetworkSettings;
|
|
80
|
-
events: NewEvent[];
|
|
81
|
-
}, NotTheNetworkPlugin>;
|
|
43
|
+
export declare function invalidRules(rules: readonly NetworkRule[] | null): string | undefined;
|
|
82
44
|
/**
|
|
83
|
-
* The fleet's rules from now on, replacing the ones it had, at
|
|
84
|
-
* version, with NetworkRulesSet
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* both sides of its rule, as it binds that label there. An id need not
|
|
89
|
-
* exist: an unknown one matches no ship, as in label selection. Only the
|
|
90
|
-
* fleet's registered networking plugin sets them, argo included: rules exist
|
|
91
|
-
* only through a plugin (decision 0035).
|
|
45
|
+
* The fleet's rules from now on, the draft's, replacing the ones it had, at
|
|
46
|
+
* the next version, with NetworkRulesSet naming how many, none for
|
|
47
|
+
* all-to-all. The caller saw the settings at `version`: once they moved, the
|
|
48
|
+
* draft's reach may differ from what the caller looked at, so the apply is
|
|
49
|
+
* refused and the draft kept.
|
|
92
50
|
*/
|
|
93
|
-
export declare function
|
|
94
|
-
rules: readonly NetworkRule[];
|
|
95
|
-
|
|
96
|
-
shipId: ShipId;
|
|
51
|
+
export declare function applyNetworkRules(current: NetworkSettings, change: {
|
|
52
|
+
rules: readonly NetworkRule[] | null;
|
|
53
|
+
version: number;
|
|
97
54
|
at: Date;
|
|
98
55
|
actor: Actor;
|
|
99
56
|
}): Result<{
|
|
100
57
|
settings: NetworkSettings;
|
|
101
58
|
events: NewEvent[];
|
|
102
|
-
},
|
|
103
|
-
|
|
59
|
+
}, DomainError<'NETWORK_SETTINGS_CHANGED'>>;
|
|
60
|
+
/** The settings at the next version, as the declared rules in force changed with them (decision 0037). */
|
|
61
|
+
export declare function withDeclaredRulesChanged(current: NetworkSettings): NetworkSettings;
|
|
62
|
+
export type SetBuiltInRuleRefusal = DomainError<'BUILT_IN_RULE_FIXED'>;
|
|
104
63
|
/**
|
|
105
64
|
* A built-in rule turned on or off, as its own action (decision 0034): the
|
|
106
|
-
* viewer reading by
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
65
|
+
* viewer reading, by any actor holding fleet:network (decision 0053). argo,
|
|
66
|
+
* the owner, the answer, a connected plugin's reading and the installation's
|
|
67
|
+
* managing are never off, and open follows the applied rules, so turning them
|
|
68
|
+
* is refused. A change moves the version and writes BuiltInRuleChanged; a
|
|
69
|
+
* rule already as asked changes nothing.
|
|
110
70
|
*/
|
|
111
71
|
export declare function setBuiltInRule(current: NetworkSettings, change: {
|
|
112
72
|
input: SetBuiltInRuleInput;
|
|
113
|
-
caller: {
|
|
114
|
-
shipId: ShipId;
|
|
115
|
-
isOperator: boolean;
|
|
116
|
-
};
|
|
117
73
|
at: Date;
|
|
118
74
|
actor: Actor;
|
|
119
75
|
}): Result<{
|
|
@@ -127,69 +83,94 @@ export declare function termText(term: SelectorTerm): string;
|
|
|
127
83
|
/** A copy of the rule, so what is kept never changes with what was given. */
|
|
128
84
|
export declare function copyOfRule(rule: NetworkRule): NetworkRule;
|
|
129
85
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
86
|
+
* What a check is made against (decisions 0034, 0037): open while the
|
|
87
|
+
* fleet's own rules are none, all-to-all; the viewer reading as it was
|
|
88
|
+
* turned; otherwise the fleet's own rules, then every declarer's, merged at
|
|
89
|
+
* check time, each named by its place in its own list.
|
|
134
90
|
*/
|
|
135
|
-
export declare function isNetworkPluginResponding(plugin: NetworkPlugin, crew: {
|
|
136
|
-
lastSeenAt: Date | undefined;
|
|
137
|
-
now: Date;
|
|
138
|
-
}): boolean;
|
|
139
|
-
/** The rules and built-in switches a send is checked against, and what the plugin declared when it is the reason. */
|
|
140
91
|
export interface RulesInForce {
|
|
92
|
+
isOpen: boolean;
|
|
93
|
+
isViewerReadOn: boolean;
|
|
141
94
|
rules: readonly NetworkRule[];
|
|
142
|
-
|
|
143
|
-
whilePluginUnavailable: Exclude<WhileUnavailable, 'open-all'> | null;
|
|
95
|
+
declared: readonly DeclaredNetworkRules[];
|
|
144
96
|
}
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* left last.
|
|
151
|
-
*/
|
|
152
|
-
export declare function rulesInForce(settings: NetworkSettings, isPluginResponding: boolean): RulesInForce;
|
|
97
|
+
/** The rules in force for the fleet's own rules, applied or a draft's, beside the declared ones. */
|
|
98
|
+
export declare function rulesInForce(own: {
|
|
99
|
+
rules: readonly NetworkRule[] | null;
|
|
100
|
+
isViewerReadOn: boolean;
|
|
101
|
+
}, declared: readonly DeclaredNetworkRules[]): RulesInForce;
|
|
153
102
|
/** A label value a ship carries, with the label it is of, so a term of any or the same value finds it. */
|
|
154
103
|
export interface ReachingLabel {
|
|
155
104
|
labelId: LabelId;
|
|
156
105
|
valueId: LabelValueId;
|
|
157
106
|
}
|
|
158
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* A ship as a send's check sees it: its id and owner, for the owner exception,
|
|
109
|
+
* its kind, for the argo exception, whether argo connected it as a plugin,
|
|
110
|
+
* whether its owner is a person ship, for the installation's rule, and the
|
|
111
|
+
* label values it carries.
|
|
112
|
+
*/
|
|
159
113
|
export interface ReachingShip {
|
|
160
114
|
id: ShipId;
|
|
161
115
|
owner: ShipId | null;
|
|
162
116
|
kind: ShipKind;
|
|
117
|
+
isConnectedPlugin: boolean;
|
|
118
|
+
/** Whether it is owned by a person ship, a person ship owning itself (decision 0045). */
|
|
119
|
+
isOwnedByPerson: boolean;
|
|
163
120
|
labels: readonly ReachingLabel[];
|
|
164
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* An account as a check sees it (decision 0057): the label values of `group`
|
|
124
|
+
* its token carries, and its person ship, which owns itself and through
|
|
125
|
+
* which the account owns: a selector's owner terms see the person ship as
|
|
126
|
+
* the account's owner.
|
|
127
|
+
*/
|
|
128
|
+
export interface ReachingAccount {
|
|
129
|
+
kind: 'account';
|
|
130
|
+
personShipId: ShipId | null;
|
|
131
|
+
labels: readonly ReachingLabel[];
|
|
132
|
+
}
|
|
133
|
+
/** The installation as a check sees it: no labels, no owner; it manages person ships and what they own by its built-in rule. */
|
|
134
|
+
export interface ReachingInstallation {
|
|
135
|
+
kind: 'installation';
|
|
136
|
+
}
|
|
137
|
+
/** Whoever does the verb: a ship, an account or the installation (decision 0057). */
|
|
138
|
+
export type ReachingActor = ReachingShip | ReachingAccount | ReachingInstallation;
|
|
165
139
|
/**
|
|
166
140
|
* The rule that lets the sender do the verb to the recipient, or undefined
|
|
167
141
|
* when none does. The built-in rules that are never off hold whatever the
|
|
168
142
|
* rules: argo reaches every ship and every ship reaches argo, but reads argo
|
|
169
143
|
* only by a rule, so argo's messages are not every ship's to read; an owner's
|
|
170
|
-
* ship reaches the ships it owns (decision 0045), and
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
144
|
+
* ship reaches the ships it owns (decision 0045), and an account the ships
|
|
145
|
+
* its person ship owns; a ship answers the sender of a message it received;
|
|
146
|
+
* a plugin argo connected reads every ship; and the installation manages
|
|
147
|
+
* person ships and the ships they own (decision 0020). The viewer reads
|
|
148
|
+
* every ship while that is on, and every actor reaches every ship by every
|
|
149
|
+
* verb while open is. Otherwise a rule of the verb must match the sender
|
|
150
|
+
* with its `from` and the recipient with its `to`: one of the fleet's own,
|
|
151
|
+
* named by its place in that list, or a declared one, named by its declarer
|
|
152
|
+
* and its place in the declarer's list. The built-in rules come first, in
|
|
153
|
+
* that order, as the rule list shows them.
|
|
176
154
|
*/
|
|
177
|
-
export declare function reachRuleOf(
|
|
155
|
+
export declare function reachRuleOf(inForce: RulesInForce, send: {
|
|
178
156
|
verb: NetworkVerb;
|
|
179
|
-
sender:
|
|
157
|
+
sender: ReachingActor;
|
|
180
158
|
recipient: ReachingShip;
|
|
181
159
|
isAnswerToSender: boolean;
|
|
182
160
|
}): ReachRule | undefined;
|
|
183
|
-
/** A built-in rule,
|
|
161
|
+
/** A built-in rule, one of the fleet's own rules by its place in that list, or a declared rule by its declarer and its place in the declarer's list. */
|
|
184
162
|
export type ReachRule = {
|
|
185
163
|
builtIn: BuiltInRule;
|
|
186
164
|
} | {
|
|
165
|
+
rule: number;
|
|
166
|
+
} | {
|
|
167
|
+
declared: LabelOwner;
|
|
187
168
|
index: number;
|
|
188
169
|
};
|
|
189
|
-
/** Whether the
|
|
190
|
-
export declare function allowsReach(
|
|
170
|
+
/** Whether the rules in force let the sender do the verb to the recipient: some rule does (see reachRuleOf). */
|
|
171
|
+
export declare function allowsReach(inForce: RulesInForce, send: {
|
|
191
172
|
verb: NetworkVerb;
|
|
192
|
-
sender:
|
|
173
|
+
sender: ReachingActor;
|
|
193
174
|
recipient: ReachingShip;
|
|
194
175
|
isAnswerToSender: boolean;
|
|
195
176
|
}): boolean;
|
|
@@ -2,102 +2,50 @@
|
|
|
2
2
|
* The fleet's network settings (decision 0034): which ships may send to,
|
|
3
3
|
* read or manage which. A rule names its verb and says that the ships
|
|
4
4
|
* matching one selector may do it to the ships matching another; allow-only,
|
|
5
|
-
* no deny rules, no precedence.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* no deny rules, no precedence. The fleet holds its own rules, set whole by
|
|
6
|
+
* applying a draft, or none for all-to-all, beside the switch of the viewer
|
|
7
|
+
* reading, with a version that moves on every change of what is in force, so
|
|
8
|
+
* a refusal names the settings that refused it.
|
|
8
9
|
*/
|
|
9
|
-
import { ANY_LABEL_VALUE, NETWORK_RULES_MAX,
|
|
10
|
+
import { ANY_LABEL_VALUE, NETWORK_RULES_MAX, SAME_LABEL_VALUE, SHIP_LABELS_MAX, isOwnerTerm, } from '@aeolus-fleet/common';
|
|
10
11
|
import { refuse } from '../shared/errors.js';
|
|
11
12
|
import { ok } from '../shared/result.js';
|
|
12
|
-
/**
|
|
13
|
-
export const BUILT_INS_ON = { isViewerReadOn: true, open: { send: true, read: true, manage: true } };
|
|
14
|
-
/** A fleet that never set rules: none, every built-in rule on, at version 0, without a plugin. */
|
|
13
|
+
/** A fleet that never set rules: none applied, the viewer reading on, at version 0. */
|
|
15
14
|
export function noNetworkSettings(fleetId) {
|
|
16
|
-
return { fleetId, rules:
|
|
17
|
-
}
|
|
18
|
-
function refuseNotThePlugin() {
|
|
19
|
-
return refuse('NOT_THE_NETWORK_PLUGIN', "Only the fleet's networking plugin does this (decision 0035)");
|
|
15
|
+
return { fleetId, rules: null, isViewerReadOn: true, version: 0 };
|
|
20
16
|
}
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
18
|
+
* What breaks the decisions' limits on the fleet's own rules, said for the
|
|
19
|
+
* caller with its decision, or undefined when they keep them: at most 200,
|
|
20
|
+
* counted alone, beside the declared ones (decision 0037); each selector at
|
|
21
|
+
* most 20 terms, as a ship carries no more label values, each term once, and
|
|
22
|
+
* a term of the same value on a label on both sides of its rule, as it binds
|
|
23
|
+
* that label there. An id need not exist: an unknown one matches no ship, as
|
|
24
|
+
* in label selection. None, all-to-all, keeps them.
|
|
27
25
|
*/
|
|
28
|
-
export function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return refuse('NETWORK_PLUGIN_REGISTERED', 'The fleet already has a networking plugin; it unregisters first (decision 0035)');
|
|
26
|
+
export function invalidRules(rules) {
|
|
27
|
+
if (rules === null) {
|
|
28
|
+
return undefined;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
version: current.version + 1,
|
|
36
|
-
plugin: { shipId, whileUnavailable: declaration.whileUnavailable, notRespondingAfterSeconds: declaration.notRespondingAfterSeconds },
|
|
37
|
-
};
|
|
38
|
-
return ok({
|
|
39
|
-
settings,
|
|
40
|
-
events: [
|
|
41
|
-
{
|
|
42
|
-
type: 'NetworkPluginRegistered',
|
|
43
|
-
fleetId: current.fleetId,
|
|
44
|
-
occurredAt: change.at,
|
|
45
|
-
actor: change.actor,
|
|
46
|
-
shipId,
|
|
47
|
-
details: { version: settings.version, whileUnavailable: declaration.whileUnavailable, notRespondingAfterSeconds: declaration.notRespondingAfterSeconds },
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* The fleet's plugin goes, and its rules with it, and the open rules are on
|
|
54
|
-
* again: no plugin is all-to-all (decision 0035), at the next version, with
|
|
55
|
-
* NetworkPluginUnregistered. The viewer reading stays as argo set it. Only
|
|
56
|
-
* the plugin's own ship unregisters it; its retirement does too.
|
|
57
|
-
*/
|
|
58
|
-
export function unregisterNetworkPlugin(current, change) {
|
|
59
|
-
if (current.plugin?.shipId !== change.shipId) {
|
|
60
|
-
return refuseNotThePlugin();
|
|
30
|
+
if (rules.length > NETWORK_RULES_MAX) {
|
|
31
|
+
return `A fleet holds at most ${String(NETWORK_RULES_MAX)} network rules of its own, beside the ones its ships declared (decision 0037)`;
|
|
61
32
|
}
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
settings,
|
|
65
|
-
events: [
|
|
66
|
-
{
|
|
67
|
-
type: 'NetworkPluginUnregistered',
|
|
68
|
-
fleetId: current.fleetId,
|
|
69
|
-
occurredAt: change.at,
|
|
70
|
-
actor: change.actor,
|
|
71
|
-
shipId: change.shipId,
|
|
72
|
-
details: { version: settings.version },
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
});
|
|
33
|
+
const invalid = rules.map(invalidRule).find((broken) => broken !== undefined);
|
|
34
|
+
return invalid === undefined ? undefined : `${invalid} (decision 0034)`;
|
|
76
35
|
}
|
|
77
36
|
/**
|
|
78
|
-
* The fleet's rules from now on, replacing the ones it had, at
|
|
79
|
-
* version, with NetworkRulesSet
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* both sides of its rule, as it binds that label there. An id need not
|
|
84
|
-
* exist: an unknown one matches no ship, as in label selection. Only the
|
|
85
|
-
* fleet's registered networking plugin sets them, argo included: rules exist
|
|
86
|
-
* only through a plugin (decision 0035).
|
|
37
|
+
* The fleet's rules from now on, the draft's, replacing the ones it had, at
|
|
38
|
+
* the next version, with NetworkRulesSet naming how many, none for
|
|
39
|
+
* all-to-all. The caller saw the settings at `version`: once they moved, the
|
|
40
|
+
* draft's reach may differ from what the caller looked at, so the apply is
|
|
41
|
+
* refused and the draft kept.
|
|
87
42
|
*/
|
|
88
|
-
export function
|
|
89
|
-
const { rules
|
|
90
|
-
if (
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
if (rules.length > NETWORK_RULES_MAX + declaredRules) {
|
|
94
|
-
return refuse('INVALID_NETWORK_RULES', `A fleet holds at most ${String(NETWORK_RULES_MAX)} network rules of argo's plus the ${String(declaredRules)} its ships declared (decision 0037)`);
|
|
43
|
+
export function applyNetworkRules(current, change) {
|
|
44
|
+
const { rules } = change;
|
|
45
|
+
if (change.version !== current.version) {
|
|
46
|
+
return refuse('NETWORK_SETTINGS_CHANGED', `The network settings are at version ${String(current.version)} now, not ${String(change.version)}: look at the draft again before applying it`);
|
|
95
47
|
}
|
|
96
|
-
const
|
|
97
|
-
if (invalid !== undefined) {
|
|
98
|
-
return refuse('INVALID_NETWORK_RULES', `${invalid} (decision 0034)`);
|
|
99
|
-
}
|
|
100
|
-
const settings = { ...current, rules: rules.map(copyOfRule), version: current.version + 1 };
|
|
48
|
+
const settings = { ...current, rules: rules === null ? null : rules.map(copyOfRule), version: current.version + 1 };
|
|
101
49
|
return ok({
|
|
102
50
|
settings,
|
|
103
51
|
events: [
|
|
@@ -106,38 +54,35 @@ export function setNetworkRules(current, change) {
|
|
|
106
54
|
fleetId: current.fleetId,
|
|
107
55
|
occurredAt: change.at,
|
|
108
56
|
actor: change.actor,
|
|
109
|
-
details: { version: settings.version, rules: rules.length },
|
|
57
|
+
details: { version: settings.version, rules: rules === null ? null : rules.length },
|
|
110
58
|
},
|
|
111
59
|
],
|
|
112
60
|
});
|
|
113
61
|
}
|
|
62
|
+
/** The settings at the next version, as the declared rules in force changed with them (decision 0037). */
|
|
63
|
+
export function withDeclaredRulesChanged(current) {
|
|
64
|
+
return { ...current, version: current.version + 1 };
|
|
65
|
+
}
|
|
114
66
|
/**
|
|
115
67
|
* A built-in rule turned on or off, as its own action (decision 0034): the
|
|
116
|
-
* viewer reading by
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
68
|
+
* viewer reading, by any actor holding fleet:network (decision 0053). argo,
|
|
69
|
+
* the owner, the answer, a connected plugin's reading and the installation's
|
|
70
|
+
* managing are never off, and open follows the applied rules, so turning them
|
|
71
|
+
* is refused. A change moves the version and writes BuiltInRuleChanged; a
|
|
72
|
+
* rule already as asked changes nothing.
|
|
120
73
|
*/
|
|
121
74
|
export function setBuiltInRule(current, change) {
|
|
122
|
-
const { input
|
|
123
|
-
if (input.rule === '
|
|
124
|
-
return refuse('BUILT_IN_RULE_FIXED',
|
|
75
|
+
const { input } = change;
|
|
76
|
+
if (input.rule === 'open') {
|
|
77
|
+
return refuse('BUILT_IN_RULE_FIXED', 'The built-in rule open is on exactly while the fleet has no rules applied (decision 0034)');
|
|
125
78
|
}
|
|
126
|
-
if (input.rule
|
|
127
|
-
return refuse('
|
|
128
|
-
}
|
|
129
|
-
if (input.rule === 'open' && current.plugin?.shipId !== caller.shipId) {
|
|
130
|
-
return refuseNotThePlugin();
|
|
79
|
+
if (input.rule !== 'viewerRead') {
|
|
80
|
+
return refuse('BUILT_IN_RULE_FIXED', `The built-in rule ${input.rule} is never off (decision 0034)`);
|
|
131
81
|
}
|
|
132
|
-
|
|
133
|
-
const { verb } = input;
|
|
134
|
-
const builtIns = input.rule === 'viewerRead' || verb === undefined
|
|
135
|
-
? { ...current.builtIns, isViewerReadOn: input.rule === 'viewerRead' ? input.isOn : current.builtIns.isViewerReadOn }
|
|
136
|
-
: { ...current.builtIns, open: { ...current.builtIns.open, [verb]: input.isOn } };
|
|
137
|
-
if (builtIns.isViewerReadOn === current.builtIns.isViewerReadOn && NETWORK_VERBS.every((verb) => builtIns.open[verb] === current.builtIns.open[verb])) {
|
|
82
|
+
if (input.isOn === current.isViewerReadOn) {
|
|
138
83
|
return ok({ settings: current, events: [] });
|
|
139
84
|
}
|
|
140
|
-
const settings = { ...current,
|
|
85
|
+
const settings = { ...current, isViewerReadOn: input.isOn, version: current.version + 1 };
|
|
141
86
|
return ok({
|
|
142
87
|
settings,
|
|
143
88
|
events: [
|
|
@@ -146,7 +91,7 @@ export function setBuiltInRule(current, change) {
|
|
|
146
91
|
fleetId: current.fleetId,
|
|
147
92
|
occurredAt: change.at,
|
|
148
93
|
actor: change.actor,
|
|
149
|
-
details: { rule: input.rule,
|
|
94
|
+
details: { rule: input.rule, isOn: input.isOn, version: settings.version },
|
|
150
95
|
},
|
|
151
96
|
],
|
|
152
97
|
});
|
|
@@ -193,76 +138,82 @@ export function copyOfRule(rule) {
|
|
|
193
138
|
function copyOfTerm(term) {
|
|
194
139
|
return typeof term === 'string' ? term : { ...term };
|
|
195
140
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
* lease whose crew called the fleet no longer ago than it declared. Its last
|
|
200
|
-
* call is the lease's last seen; nothing else acts on it, and nothing here
|
|
201
|
-
* ends the lease.
|
|
202
|
-
*/
|
|
203
|
-
export function isNetworkPluginResponding(plugin, crew) {
|
|
204
|
-
const { lastSeenAt, now } = crew;
|
|
205
|
-
return lastSeenAt !== undefined && now.getTime() - lastSeenAt.getTime() <= plugin.notRespondingAfterSeconds * MILLISECONDS_PER_SECOND;
|
|
141
|
+
/** The rules in force for the fleet's own rules, applied or a draft's, beside the declared ones. */
|
|
142
|
+
export function rulesInForce(own, declared) {
|
|
143
|
+
return { isOpen: own.rules === null, isViewerReadOn: own.isViewerReadOn, rules: own.rules ?? [], declared };
|
|
206
144
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
* the built-in rules that are never off and the viewer reading, open-all
|
|
211
|
-
* open on for every verb (all-to-all), keep-latest the rules and switches it
|
|
212
|
-
* left last.
|
|
213
|
-
*/
|
|
214
|
-
export function rulesInForce(settings, isPluginResponding) {
|
|
215
|
-
const { plugin, rules, builtIns } = settings;
|
|
216
|
-
if (plugin === null || isPluginResponding) {
|
|
217
|
-
return { rules, builtIns, whilePluginUnavailable: null };
|
|
145
|
+
function selectedOf(actor) {
|
|
146
|
+
if (actor.kind === 'account') {
|
|
147
|
+
return { owner: actor.personShipId, labels: actor.labels };
|
|
218
148
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return { rules, builtIns, whilePluginUnavailable: 'keep-latest' };
|
|
149
|
+
return actor.kind === 'installation' ? { owner: null, labels: [] } : { owner: actor.owner, labels: actor.labels };
|
|
150
|
+
}
|
|
151
|
+
/** The ship the actor owns ships as: a ship itself, an account its person ship; the installation none. */
|
|
152
|
+
function owningShipOf(actor) {
|
|
153
|
+
if (actor.kind === 'account') {
|
|
154
|
+
return actor.personShipId;
|
|
226
155
|
}
|
|
156
|
+
return actor.kind === 'installation' ? null : actor.id;
|
|
227
157
|
}
|
|
228
158
|
/**
|
|
229
159
|
* The rule that lets the sender do the verb to the recipient, or undefined
|
|
230
160
|
* when none does. The built-in rules that are never off hold whatever the
|
|
231
161
|
* rules: argo reaches every ship and every ship reaches argo, but reads argo
|
|
232
162
|
* only by a rule, so argo's messages are not every ship's to read; an owner's
|
|
233
|
-
* ship reaches the ships it owns (decision 0045), and
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
163
|
+
* ship reaches the ships it owns (decision 0045), and an account the ships
|
|
164
|
+
* its person ship owns; a ship answers the sender of a message it received;
|
|
165
|
+
* a plugin argo connected reads every ship; and the installation manages
|
|
166
|
+
* person ships and the ships they own (decision 0020). The viewer reads
|
|
167
|
+
* every ship while that is on, and every actor reaches every ship by every
|
|
168
|
+
* verb while open is. Otherwise a rule of the verb must match the sender
|
|
169
|
+
* with its `from` and the recipient with its `to`: one of the fleet's own,
|
|
170
|
+
* named by its place in that list, or a declared one, named by its declarer
|
|
171
|
+
* and its place in the declarer's list. The built-in rules come first, in
|
|
172
|
+
* that order, as the rule list shows them.
|
|
239
173
|
*/
|
|
240
|
-
export function reachRuleOf(
|
|
174
|
+
export function reachRuleOf(inForce, send) {
|
|
241
175
|
const { verb, sender, recipient, isAnswerToSender } = send;
|
|
242
|
-
const { rules, builtIns } = settings;
|
|
243
176
|
if (sender.kind === 'operator' || (recipient.kind === 'operator' && verb !== 'read')) {
|
|
244
177
|
return { builtIn: 'argo' };
|
|
245
178
|
}
|
|
246
|
-
|
|
179
|
+
const owningShip = owningShipOf(sender);
|
|
180
|
+
if (owningShip !== null && recipient.owner === owningShip) {
|
|
247
181
|
return { builtIn: 'owner' };
|
|
248
182
|
}
|
|
249
183
|
if (verb === 'send' && isAnswerToSender) {
|
|
250
184
|
return { builtIn: 'answer' };
|
|
251
185
|
}
|
|
252
|
-
if (verb === 'read' && sender.kind
|
|
186
|
+
if (verb === 'read' && sender.kind !== 'account' && sender.kind !== 'installation' && sender.isConnectedPlugin) {
|
|
187
|
+
return { builtIn: 'pluginRead' };
|
|
188
|
+
}
|
|
189
|
+
if (verb === 'read' && sender.kind === 'viewer' && inForce.isViewerReadOn) {
|
|
253
190
|
return { builtIn: 'viewerRead' };
|
|
254
191
|
}
|
|
255
|
-
if (
|
|
192
|
+
if (verb === 'manage' && sender.kind === 'installation' && (recipient.kind === 'person' || recipient.isOwnedByPerson)) {
|
|
193
|
+
return { builtIn: 'installation' };
|
|
194
|
+
}
|
|
195
|
+
if (inForce.isOpen) {
|
|
256
196
|
return { builtIn: 'open' };
|
|
257
197
|
}
|
|
258
|
-
const
|
|
259
|
-
|
|
198
|
+
const [from, to] = [selectedOf(sender), selectedOf(recipient)];
|
|
199
|
+
const allows = (rule) => rule.verb === verb && matches(rule.from, { actor: from, otherSide: to }) && matches(rule.to, { actor: to, otherSide: from });
|
|
200
|
+
const index = inForce.rules.findIndex(allows);
|
|
201
|
+
if (index !== -1) {
|
|
202
|
+
return { rule: index };
|
|
203
|
+
}
|
|
204
|
+
for (const { declarer, rules } of inForce.declared) {
|
|
205
|
+
const declaredIndex = rules.findIndex(allows);
|
|
206
|
+
if (declaredIndex !== -1) {
|
|
207
|
+
return { declared: declarer, index: declaredIndex };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
260
211
|
}
|
|
261
|
-
/** Whether the
|
|
262
|
-
export function allowsReach(
|
|
263
|
-
return reachRuleOf(
|
|
212
|
+
/** Whether the rules in force let the sender do the verb to the recipient: some rule does (see reachRuleOf). */
|
|
213
|
+
export function allowsReach(inForce, send) {
|
|
214
|
+
return reachRuleOf(inForce, send) !== undefined;
|
|
264
215
|
}
|
|
265
|
-
/**
|
|
216
|
+
/** An actor matches a selector when every term of it holds, combined with AND. */
|
|
266
217
|
function matches(selector, sides) {
|
|
267
218
|
return selector.every((term) => holds(term, sides));
|
|
268
219
|
}
|
|
@@ -275,7 +226,7 @@ function matches(selector, sides) {
|
|
|
275
226
|
* same owner as the other side.
|
|
276
227
|
*/
|
|
277
228
|
function holds(term, sides) {
|
|
278
|
-
const { ship, otherSide } = sides;
|
|
229
|
+
const { actor: ship, otherSide } = sides;
|
|
279
230
|
if (typeof term === 'string') {
|
|
280
231
|
return ship.labels.some((label) => label.valueId === term);
|
|
281
232
|
}
|