@eloxiv/testing 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/Admin.d.ts +20 -0
- package/dist/Admin.d.ts.map +1 -0
- package/dist/Admin.js +61 -0
- package/dist/Admin.js.map +1 -0
- package/dist/Agent.d.ts +97 -0
- package/dist/Agent.d.ts.map +1 -0
- package/dist/Agent.js +210 -0
- package/dist/Agent.js.map +1 -0
- package/dist/AgentSurface.d.ts +20 -0
- package/dist/AgentSurface.d.ts.map +1 -0
- package/dist/AgentSurface.js +36 -0
- package/dist/AgentSurface.js.map +1 -0
- package/dist/Embedder.d.ts +21 -0
- package/dist/Embedder.d.ts.map +1 -0
- package/dist/Embedder.js +54 -0
- package/dist/Embedder.js.map +1 -0
- package/dist/EvalMain.d.ts +2 -0
- package/dist/EvalMain.d.ts.map +1 -0
- package/dist/EvalMain.js +80 -0
- package/dist/EvalMain.js.map +1 -0
- package/dist/Evals.d.ts +95 -0
- package/dist/Evals.d.ts.map +1 -0
- package/dist/Evals.js +389 -0
- package/dist/Evals.js.map +1 -0
- package/dist/Kernel.d.ts +88 -0
- package/dist/Kernel.d.ts.map +1 -0
- package/dist/Kernel.js +108 -0
- package/dist/Kernel.js.map +1 -0
- package/dist/Launch.d.ts +86 -0
- package/dist/Launch.d.ts.map +1 -0
- package/dist/Launch.js +370 -0
- package/dist/Launch.js.map +1 -0
- package/dist/Locks.d.ts +39 -0
- package/dist/Locks.d.ts.map +1 -0
- package/dist/Locks.js +94 -0
- package/dist/Locks.js.map +1 -0
- package/dist/Routes.d.ts +19 -0
- package/dist/Routes.d.ts.map +1 -0
- package/dist/Routes.js +38 -0
- package/dist/Routes.js.map +1 -0
- package/dist/ScriptedChatModel.d.ts +51 -0
- package/dist/ScriptedChatModel.d.ts.map +1 -0
- package/dist/ScriptedChatModel.js +135 -0
- package/dist/ScriptedChatModel.js.map +1 -0
- package/dist/SmtpSink.d.ts +36 -0
- package/dist/SmtpSink.d.ts.map +1 -0
- package/dist/SmtpSink.js +185 -0
- package/dist/SmtpSink.js.map +1 -0
- package/dist/System.d.ts +271 -0
- package/dist/System.d.ts.map +1 -0
- package/dist/System.js +905 -0
- package/dist/System.js.map +1 -0
- package/dist/TcpProxy.d.ts +17 -0
- package/dist/TcpProxy.d.ts.map +1 -0
- package/dist/TcpProxy.js +100 -0
- package/dist/TcpProxy.js.map +1 -0
- package/dist/auth/TrustedProxyAuth.d.ts +28 -0
- package/dist/auth/TrustedProxyAuth.d.ts.map +1 -0
- package/dist/auth/TrustedProxyAuth.js +128 -0
- package/dist/auth/TrustedProxyAuth.js.map +1 -0
- package/dist/conformance/ActionConsent.d.ts +3 -0
- package/dist/conformance/ActionConsent.d.ts.map +1 -0
- package/dist/conformance/ActionConsent.js +347 -0
- package/dist/conformance/ActionConsent.js.map +1 -0
- package/dist/conformance/ActionRegistry.d.ts +64 -0
- package/dist/conformance/ActionRegistry.d.ts.map +1 -0
- package/dist/conformance/ActionRegistry.js +136 -0
- package/dist/conformance/ActionRegistry.js.map +1 -0
- package/dist/conformance/Actor.d.ts +43 -0
- package/dist/conformance/Actor.d.ts.map +1 -0
- package/dist/conformance/Actor.js +171 -0
- package/dist/conformance/Actor.js.map +1 -0
- package/dist/conformance/AgentReference.d.ts +30 -0
- package/dist/conformance/AgentReference.d.ts.map +1 -0
- package/dist/conformance/AgentReference.js +137 -0
- package/dist/conformance/AgentReference.js.map +1 -0
- package/dist/conformance/AgentResources.d.ts +3 -0
- package/dist/conformance/AgentResources.d.ts.map +1 -0
- package/dist/conformance/AgentResources.js +454 -0
- package/dist/conformance/AgentResources.js.map +1 -0
- package/dist/conformance/AgentRuntime.d.ts +3 -0
- package/dist/conformance/AgentRuntime.d.ts.map +1 -0
- package/dist/conformance/AgentRuntime.js +302 -0
- package/dist/conformance/AgentRuntime.js.map +1 -0
- package/dist/conformance/AgentSubject.d.ts +87 -0
- package/dist/conformance/AgentSubject.d.ts.map +1 -0
- package/dist/conformance/AgentSubject.js +18 -0
- package/dist/conformance/AgentSubject.js.map +1 -0
- package/dist/conformance/Approvals.d.ts +3 -0
- package/dist/conformance/Approvals.d.ts.map +1 -0
- package/dist/conformance/Approvals.js +258 -0
- package/dist/conformance/Approvals.js.map +1 -0
- package/dist/conformance/Audit.d.ts +3 -0
- package/dist/conformance/Audit.d.ts.map +1 -0
- package/dist/conformance/Audit.js +221 -0
- package/dist/conformance/Audit.js.map +1 -0
- package/dist/conformance/CalendarProvider.d.ts +4 -0
- package/dist/conformance/CalendarProvider.d.ts.map +1 -0
- package/dist/conformance/CalendarProvider.js +108 -0
- package/dist/conformance/CalendarProvider.js.map +1 -0
- package/dist/conformance/CapabilityKit.d.ts +191 -0
- package/dist/conformance/CapabilityKit.d.ts.map +1 -0
- package/dist/conformance/CapabilityKit.js +375 -0
- package/dist/conformance/CapabilityKit.js.map +1 -0
- package/dist/conformance/ClientSDK.d.ts +78 -0
- package/dist/conformance/ClientSDK.d.ts.map +1 -0
- package/dist/conformance/ClientSDK.js +163 -0
- package/dist/conformance/ClientSDK.js.map +1 -0
- package/dist/conformance/CollabDocument.d.ts +3 -0
- package/dist/conformance/CollabDocument.d.ts.map +1 -0
- package/dist/conformance/CollabDocument.js +934 -0
- package/dist/conformance/CollabDocument.js.map +1 -0
- package/dist/conformance/CollabReference.d.ts +8 -0
- package/dist/conformance/CollabReference.d.ts.map +1 -0
- package/dist/conformance/CollabReference.js +138 -0
- package/dist/conformance/CollabReference.js.map +1 -0
- package/dist/conformance/CollabSubject.d.ts +68 -0
- package/dist/conformance/CollabSubject.d.ts.map +1 -0
- package/dist/conformance/CollabSubject.js +2 -0
- package/dist/conformance/CollabSubject.js.map +1 -0
- package/dist/conformance/Command.d.ts +3 -0
- package/dist/conformance/Command.d.ts.map +1 -0
- package/dist/conformance/Command.js +73 -0
- package/dist/conformance/Command.js.map +1 -0
- package/dist/conformance/Connections.d.ts +4 -0
- package/dist/conformance/Connections.d.ts.map +1 -0
- package/dist/conformance/Connections.js +308 -0
- package/dist/conformance/Connections.js.map +1 -0
- package/dist/conformance/ConnectionsReference.d.ts +56 -0
- package/dist/conformance/ConnectionsReference.d.ts.map +1 -0
- package/dist/conformance/ConnectionsReference.js +74 -0
- package/dist/conformance/ConnectionsReference.js.map +1 -0
- package/dist/conformance/ConnectorReference.d.ts +86 -0
- package/dist/conformance/ConnectorReference.d.ts.map +1 -0
- package/dist/conformance/ConnectorReference.js +185 -0
- package/dist/conformance/ConnectorReference.js.map +1 -0
- package/dist/conformance/ContextAccounting.d.ts +8 -0
- package/dist/conformance/ContextAccounting.d.ts.map +1 -0
- package/dist/conformance/ContextAccounting.js +125 -0
- package/dist/conformance/ContextAccounting.js.map +1 -0
- package/dist/conformance/Daemon.d.ts +150 -0
- package/dist/conformance/Daemon.d.ts.map +1 -0
- package/dist/conformance/Daemon.js +718 -0
- package/dist/conformance/Daemon.js.map +1 -0
- package/dist/conformance/DaemonReference.d.ts +15 -0
- package/dist/conformance/DaemonReference.d.ts.map +1 -0
- package/dist/conformance/DaemonReference.js +163 -0
- package/dist/conformance/DaemonReference.js.map +1 -0
- package/dist/conformance/DbTx.d.ts +17 -0
- package/dist/conformance/DbTx.d.ts.map +1 -0
- package/dist/conformance/DbTx.js +184 -0
- package/dist/conformance/DbTx.js.map +1 -0
- package/dist/conformance/DecisionTokens.d.ts +3 -0
- package/dist/conformance/DecisionTokens.d.ts.map +1 -0
- package/dist/conformance/DecisionTokens.js +551 -0
- package/dist/conformance/DecisionTokens.js.map +1 -0
- package/dist/conformance/Delegation.d.ts +3 -0
- package/dist/conformance/Delegation.d.ts.map +1 -0
- package/dist/conformance/Delegation.js +149 -0
- package/dist/conformance/Delegation.js.map +1 -0
- package/dist/conformance/DeskReference.d.ts +21 -0
- package/dist/conformance/DeskReference.d.ts.map +1 -0
- package/dist/conformance/DeskReference.js +47 -0
- package/dist/conformance/DeskReference.js.map +1 -0
- package/dist/conformance/DeviceControl.d.ts +3 -0
- package/dist/conformance/DeviceControl.d.ts.map +1 -0
- package/dist/conformance/DeviceControl.js +579 -0
- package/dist/conformance/DeviceControl.js.map +1 -0
- package/dist/conformance/Directory.d.ts +36 -0
- package/dist/conformance/Directory.d.ts.map +1 -0
- package/dist/conformance/Directory.js +253 -0
- package/dist/conformance/Directory.js.map +1 -0
- package/dist/conformance/DirectoryProvider.d.ts +4 -0
- package/dist/conformance/DirectoryProvider.d.ts.map +1 -0
- package/dist/conformance/DirectoryProvider.js +58 -0
- package/dist/conformance/DirectoryProvider.js.map +1 -0
- package/dist/conformance/DocumentSource.d.ts +4 -0
- package/dist/conformance/DocumentSource.d.ts.map +1 -0
- package/dist/conformance/DocumentSource.js +43 -0
- package/dist/conformance/DocumentSource.js.map +1 -0
- package/dist/conformance/EndpointReference.d.ts +40 -0
- package/dist/conformance/EndpointReference.d.ts.map +1 -0
- package/dist/conformance/EndpointReference.js +67 -0
- package/dist/conformance/EndpointReference.js.map +1 -0
- package/dist/conformance/Files.d.ts +40 -0
- package/dist/conformance/Files.d.ts.map +1 -0
- package/dist/conformance/Files.js +592 -0
- package/dist/conformance/Files.js.map +1 -0
- package/dist/conformance/FilesReference.d.ts +31 -0
- package/dist/conformance/FilesReference.d.ts.map +1 -0
- package/dist/conformance/FilesReference.js +116 -0
- package/dist/conformance/FilesReference.js.map +1 -0
- package/dist/conformance/FilesSubject.d.ts +46 -0
- package/dist/conformance/FilesSubject.d.ts.map +1 -0
- package/dist/conformance/FilesSubject.js +3 -0
- package/dist/conformance/FilesSubject.js.map +1 -0
- package/dist/conformance/Flags.d.ts +3 -0
- package/dist/conformance/Flags.d.ts.map +1 -0
- package/dist/conformance/Flags.js +183 -0
- package/dist/conformance/Flags.js.map +1 -0
- package/dist/conformance/Host.d.ts +64 -0
- package/dist/conformance/Host.d.ts.map +1 -0
- package/dist/conformance/Host.js +152 -0
- package/dist/conformance/Host.js.map +1 -0
- package/dist/conformance/HttpApi.d.ts +5 -0
- package/dist/conformance/HttpApi.d.ts.map +1 -0
- package/dist/conformance/HttpApi.js +131 -0
- package/dist/conformance/HttpApi.js.map +1 -0
- package/dist/conformance/InboxReference.d.ts +28 -0
- package/dist/conformance/InboxReference.d.ts.map +1 -0
- package/dist/conformance/InboxReference.js +331 -0
- package/dist/conformance/InboxReference.js.map +1 -0
- package/dist/conformance/InboxSubject.d.ts +92 -0
- package/dist/conformance/InboxSubject.d.ts.map +1 -0
- package/dist/conformance/InboxSubject.js +16 -0
- package/dist/conformance/InboxSubject.js.map +1 -0
- package/dist/conformance/Ingestion.d.ts +10 -0
- package/dist/conformance/Ingestion.d.ts.map +1 -0
- package/dist/conformance/Ingestion.js +335 -0
- package/dist/conformance/Ingestion.js.map +1 -0
- package/dist/conformance/Ingress.d.ts +62 -0
- package/dist/conformance/Ingress.d.ts.map +1 -0
- package/dist/conformance/Ingress.js +346 -0
- package/dist/conformance/Ingress.js.map +1 -0
- package/dist/conformance/Invocation.d.ts +3 -0
- package/dist/conformance/Invocation.d.ts.map +1 -0
- package/dist/conformance/Invocation.js +665 -0
- package/dist/conformance/Invocation.js.map +1 -0
- package/dist/conformance/IsolationMatrix.d.ts +60 -0
- package/dist/conformance/IsolationMatrix.d.ts.map +1 -0
- package/dist/conformance/IsolationMatrix.js +196 -0
- package/dist/conformance/IsolationMatrix.js.map +1 -0
- package/dist/conformance/LiveConnection.d.ts +72 -0
- package/dist/conformance/LiveConnection.d.ts.map +1 -0
- package/dist/conformance/LiveConnection.js +125 -0
- package/dist/conformance/LiveConnection.js.map +1 -0
- package/dist/conformance/LocalClient.d.ts +62 -0
- package/dist/conformance/LocalClient.d.ts.map +1 -0
- package/dist/conformance/LocalClient.js +526 -0
- package/dist/conformance/LocalClient.js.map +1 -0
- package/dist/conformance/Locale.d.ts +28 -0
- package/dist/conformance/Locale.d.ts.map +1 -0
- package/dist/conformance/Locale.js +115 -0
- package/dist/conformance/Locale.js.map +1 -0
- package/dist/conformance/MachineIdentity.d.ts +39 -0
- package/dist/conformance/MachineIdentity.d.ts.map +1 -0
- package/dist/conformance/MachineIdentity.js +595 -0
- package/dist/conformance/MachineIdentity.js.map +1 -0
- package/dist/conformance/MailProvider.d.ts +4 -0
- package/dist/conformance/MailProvider.d.ts.map +1 -0
- package/dist/conformance/MailProvider.js +167 -0
- package/dist/conformance/MailProvider.js.map +1 -0
- package/dist/conformance/Memory.d.ts +10 -0
- package/dist/conformance/Memory.d.ts.map +1 -0
- package/dist/conformance/Memory.js +179 -0
- package/dist/conformance/Memory.js.map +1 -0
- package/dist/conformance/Messaging.d.ts +49 -0
- package/dist/conformance/Messaging.d.ts.map +1 -0
- package/dist/conformance/Messaging.js +117 -0
- package/dist/conformance/Messaging.js.map +1 -0
- package/dist/conformance/Metering.d.ts +26 -0
- package/dist/conformance/Metering.d.ts.map +1 -0
- package/dist/conformance/Metering.js +236 -0
- package/dist/conformance/Metering.js.map +1 -0
- package/dist/conformance/ModelProvider.d.ts +32 -0
- package/dist/conformance/ModelProvider.d.ts.map +1 -0
- package/dist/conformance/ModelProvider.js +100 -0
- package/dist/conformance/ModelProvider.js.map +1 -0
- package/dist/conformance/ModuleManifest.d.ts +9 -0
- package/dist/conformance/ModuleManifest.d.ts.map +1 -0
- package/dist/conformance/ModuleManifest.js +542 -0
- package/dist/conformance/ModuleManifest.js.map +1 -0
- package/dist/conformance/NotebookAgent.d.ts +32 -0
- package/dist/conformance/NotebookAgent.d.ts.map +1 -0
- package/dist/conformance/NotebookAgent.js +31 -0
- package/dist/conformance/NotebookAgent.js.map +1 -0
- package/dist/conformance/NotificationChannel.d.ts +40 -0
- package/dist/conformance/NotificationChannel.d.ts.map +1 -0
- package/dist/conformance/NotificationChannel.js +78 -0
- package/dist/conformance/NotificationChannel.js.map +1 -0
- package/dist/conformance/Notifications.d.ts +3 -0
- package/dist/conformance/Notifications.d.ts.map +1 -0
- package/dist/conformance/Notifications.js +240 -0
- package/dist/conformance/Notifications.js.map +1 -0
- package/dist/conformance/OAuthClient.d.ts +123 -0
- package/dist/conformance/OAuthClient.d.ts.map +1 -0
- package/dist/conformance/OAuthClient.js +204 -0
- package/dist/conformance/OAuthClient.js.map +1 -0
- package/dist/conformance/Outbox.d.ts +3 -0
- package/dist/conformance/Outbox.d.ts.map +1 -0
- package/dist/conformance/Outbox.js +266 -0
- package/dist/conformance/Outbox.js.map +1 -0
- package/dist/conformance/PlatformReference.d.ts +5 -0
- package/dist/conformance/PlatformReference.d.ts.map +1 -0
- package/dist/conformance/PlatformReference.js +66 -0
- package/dist/conformance/PlatformReference.js.map +1 -0
- package/dist/conformance/PlatformSubject.d.ts +45 -0
- package/dist/conformance/PlatformSubject.d.ts.map +1 -0
- package/dist/conformance/PlatformSubject.js +3 -0
- package/dist/conformance/PlatformSubject.js.map +1 -0
- package/dist/conformance/Privacy.d.ts +3 -0
- package/dist/conformance/Privacy.d.ts.map +1 -0
- package/dist/conformance/Privacy.js +437 -0
- package/dist/conformance/Privacy.js.map +1 -0
- package/dist/conformance/Progress.d.ts +3 -0
- package/dist/conformance/Progress.d.ts.map +1 -0
- package/dist/conformance/Progress.js +153 -0
- package/dist/conformance/Progress.js.map +1 -0
- package/dist/conformance/Push.d.ts +38 -0
- package/dist/conformance/Push.d.ts.map +1 -0
- package/dist/conformance/Push.js +649 -0
- package/dist/conformance/Push.js.map +1 -0
- package/dist/conformance/PushReference.d.ts +3 -0
- package/dist/conformance/PushReference.d.ts.map +1 -0
- package/dist/conformance/PushReference.js +97 -0
- package/dist/conformance/PushReference.js.map +1 -0
- package/dist/conformance/QuerySurface.d.ts +9 -0
- package/dist/conformance/QuerySurface.d.ts.map +1 -0
- package/dist/conformance/QuerySurface.js +349 -0
- package/dist/conformance/QuerySurface.js.map +1 -0
- package/dist/conformance/Readiness.d.ts +23 -0
- package/dist/conformance/Readiness.d.ts.map +1 -0
- package/dist/conformance/Readiness.js +110 -0
- package/dist/conformance/Readiness.js.map +1 -0
- package/dist/conformance/Reference.d.ts +17 -0
- package/dist/conformance/Reference.d.ts.map +1 -0
- package/dist/conformance/Reference.js +246 -0
- package/dist/conformance/Reference.js.map +1 -0
- package/dist/conformance/Release.d.ts +73 -0
- package/dist/conformance/Release.d.ts.map +1 -0
- package/dist/conformance/Release.js +556 -0
- package/dist/conformance/Release.js.map +1 -0
- package/dist/conformance/ReleaseReference.d.ts +5 -0
- package/dist/conformance/ReleaseReference.d.ts.map +1 -0
- package/dist/conformance/ReleaseReference.js +124 -0
- package/dist/conformance/ReleaseReference.js.map +1 -0
- package/dist/conformance/ResultRendering.d.ts +3 -0
- package/dist/conformance/ResultRendering.d.ts.map +1 -0
- package/dist/conformance/ResultRendering.js +120 -0
- package/dist/conformance/ResultRendering.js.map +1 -0
- package/dist/conformance/Sandbox.d.ts +58 -0
- package/dist/conformance/Sandbox.d.ts.map +1 -0
- package/dist/conformance/Sandbox.js +213 -0
- package/dist/conformance/Sandbox.js.map +1 -0
- package/dist/conformance/SandboxReference.d.ts +3 -0
- package/dist/conformance/SandboxReference.d.ts.map +1 -0
- package/dist/conformance/SandboxReference.js +44 -0
- package/dist/conformance/SandboxReference.js.map +1 -0
- package/dist/conformance/Scheduler.d.ts +106 -0
- package/dist/conformance/Scheduler.d.ts.map +1 -0
- package/dist/conformance/Scheduler.js +576 -0
- package/dist/conformance/Scheduler.js.map +1 -0
- package/dist/conformance/ScreenContext.d.ts +84 -0
- package/dist/conformance/ScreenContext.d.ts.map +1 -0
- package/dist/conformance/ScreenContext.js +290 -0
- package/dist/conformance/ScreenContext.js.map +1 -0
- package/dist/conformance/Search.d.ts +3 -0
- package/dist/conformance/Search.d.ts.map +1 -0
- package/dist/conformance/Search.js +333 -0
- package/dist/conformance/Search.js.map +1 -0
- package/dist/conformance/Secrets.d.ts +8 -0
- package/dist/conformance/Secrets.d.ts.map +1 -0
- package/dist/conformance/Secrets.js +231 -0
- package/dist/conformance/Secrets.js.map +1 -0
- package/dist/conformance/SecretsReference.d.ts +44 -0
- package/dist/conformance/SecretsReference.d.ts.map +1 -0
- package/dist/conformance/SecretsReference.js +73 -0
- package/dist/conformance/SecretsReference.js.map +1 -0
- package/dist/conformance/ServicesReference.d.ts +8 -0
- package/dist/conformance/ServicesReference.d.ts.map +1 -0
- package/dist/conformance/ServicesReference.js +273 -0
- package/dist/conformance/ServicesReference.js.map +1 -0
- package/dist/conformance/ServicesSubject.d.ts +104 -0
- package/dist/conformance/ServicesSubject.d.ts.map +1 -0
- package/dist/conformance/ServicesSubject.js +2 -0
- package/dist/conformance/ServicesSubject.js.map +1 -0
- package/dist/conformance/Settings.d.ts +3 -0
- package/dist/conformance/Settings.d.ts.map +1 -0
- package/dist/conformance/Settings.js +177 -0
- package/dist/conformance/Settings.js.map +1 -0
- package/dist/conformance/Sharing.d.ts +3 -0
- package/dist/conformance/Sharing.d.ts.map +1 -0
- package/dist/conformance/Sharing.js +368 -0
- package/dist/conformance/Sharing.js.map +1 -0
- package/dist/conformance/ShellSubject.d.ts +29 -0
- package/dist/conformance/ShellSubject.d.ts.map +1 -0
- package/dist/conformance/ShellSubject.js +13 -0
- package/dist/conformance/ShellSubject.js.map +1 -0
- package/dist/conformance/SignOutRace.d.ts +23 -0
- package/dist/conformance/SignOutRace.d.ts.map +1 -0
- package/dist/conformance/SignOutRace.js +49 -0
- package/dist/conformance/SignOutRace.js.map +1 -0
- package/dist/conformance/Slot.d.ts +3 -0
- package/dist/conformance/Slot.d.ts.map +1 -0
- package/dist/conformance/Slot.js +79 -0
- package/dist/conformance/Slot.js.map +1 -0
- package/dist/conformance/Space.d.ts +63 -0
- package/dist/conformance/Space.d.ts.map +1 -0
- package/dist/conformance/Space.js +294 -0
- package/dist/conformance/Space.js.map +1 -0
- package/dist/conformance/StorageAdapter.d.ts +76 -0
- package/dist/conformance/StorageAdapter.d.ts.map +1 -0
- package/dist/conformance/StorageAdapter.js +181 -0
- package/dist/conformance/StorageAdapter.js.map +1 -0
- package/dist/conformance/StorageBackend.d.ts +23 -0
- package/dist/conformance/StorageBackend.d.ts.map +1 -0
- package/dist/conformance/StorageBackend.js +274 -0
- package/dist/conformance/StorageBackend.js.map +1 -0
- package/dist/conformance/Subject.d.ts +198 -0
- package/dist/conformance/Subject.d.ts.map +1 -0
- package/dist/conformance/Subject.js +26 -0
- package/dist/conformance/Subject.js.map +1 -0
- package/dist/conformance/Sync.d.ts +3 -0
- package/dist/conformance/Sync.d.ts.map +1 -0
- package/dist/conformance/Sync.js +190 -0
- package/dist/conformance/Sync.js.map +1 -0
- package/dist/conformance/Telemetry.d.ts +3 -0
- package/dist/conformance/Telemetry.d.ts.map +1 -0
- package/dist/conformance/Telemetry.js +218 -0
- package/dist/conformance/Telemetry.js.map +1 -0
- package/dist/conformance/ThemeTokens.d.ts +22 -0
- package/dist/conformance/ThemeTokens.d.ts.map +1 -0
- package/dist/conformance/ThemeTokens.js +121 -0
- package/dist/conformance/ThemeTokens.js.map +1 -0
- package/dist/conformance/ToolSource.d.ts +5 -0
- package/dist/conformance/ToolSource.d.ts.map +1 -0
- package/dist/conformance/ToolSource.js +520 -0
- package/dist/conformance/ToolSource.js.map +1 -0
- package/dist/conformance/Versioning.d.ts +3 -0
- package/dist/conformance/Versioning.d.ts.map +1 -0
- package/dist/conformance/Versioning.js +160 -0
- package/dist/conformance/Versioning.js.map +1 -0
- package/dist/conformance/View.d.ts +3 -0
- package/dist/conformance/View.d.ts.map +1 -0
- package/dist/conformance/View.js +121 -0
- package/dist/conformance/View.js.map +1 -0
- package/dist/conformance/WorkItems.d.ts +3 -0
- package/dist/conformance/WorkItems.d.ts.map +1 -0
- package/dist/conformance/WorkItems.js +152 -0
- package/dist/conformance/WorkItems.js.map +1 -0
- package/dist/conformance/Workflow.d.ts +63 -0
- package/dist/conformance/Workflow.d.ts.map +1 -0
- package/dist/conformance/Workflow.js +235 -0
- package/dist/conformance/Workflow.js.map +1 -0
- package/dist/conformance/acme/chatlog.d.ts +591 -0
- package/dist/conformance/acme/chatlog.d.ts.map +1 -0
- package/dist/conformance/acme/chatlog.js +101 -0
- package/dist/conformance/acme/chatlog.js.map +1 -0
- package/dist/conformance/acme/connector.d.ts +12 -0
- package/dist/conformance/acme/connector.d.ts.map +1 -0
- package/dist/conformance/acme/connector.js +123 -0
- package/dist/conformance/acme/connector.js.map +1 -0
- package/dist/conformance/acme/migrations/0000_messages.sql +8 -0
- package/dist/conformance/archive/app.d.ts +728 -0
- package/dist/conformance/archive/app.d.ts.map +1 -0
- package/dist/conformance/archive/app.js +30 -0
- package/dist/conformance/archive/app.js.map +1 -0
- package/dist/conformance/archive/contract.d.ts +467 -0
- package/dist/conformance/archive/contract.d.ts.map +1 -0
- package/dist/conformance/archive/contract.js +187 -0
- package/dist/conformance/archive/contract.js.map +1 -0
- package/dist/conformance/archive/memo.sync.gen.d.ts +148 -0
- package/dist/conformance/archive/memo.sync.gen.d.ts.map +1 -0
- package/dist/conformance/archive/memo.sync.gen.js +23 -0
- package/dist/conformance/archive/memo.sync.gen.js.map +1 -0
- package/dist/conformance/archive/migrations/archive/0000_archive.sql +9 -0
- package/dist/conformance/archive/migrations/memo/0000_memo.sql +6 -0
- package/dist/conformance/archive/schema.d.ts +185 -0
- package/dist/conformance/archive/schema.d.ts.map +1 -0
- package/dist/conformance/archive/schema.js +22 -0
- package/dist/conformance/archive/schema.js.map +1 -0
- package/dist/conformance/archive/server.d.ts +273 -0
- package/dist/conformance/archive/server.d.ts.map +1 -0
- package/dist/conformance/archive/server.js +127 -0
- package/dist/conformance/archive/server.js.map +1 -0
- package/dist/conformance/archive/sync.gen.d.ts +319 -0
- package/dist/conformance/archive/sync.gen.d.ts.map +1 -0
- package/dist/conformance/archive/sync.gen.js +29 -0
- package/dist/conformance/archive/sync.gen.js.map +1 -0
- package/dist/conformance/atlas/app.d.ts +3 -0
- package/dist/conformance/atlas/app.d.ts.map +1 -0
- package/dist/conformance/atlas/app.js +15 -0
- package/dist/conformance/atlas/app.js.map +1 -0
- package/dist/conformance/atlas/contract.d.ts +489 -0
- package/dist/conformance/atlas/contract.d.ts.map +1 -0
- package/dist/conformance/atlas/contract.js +114 -0
- package/dist/conformance/atlas/contract.js.map +1 -0
- package/dist/conformance/crm/app.d.ts +304 -0
- package/dist/conformance/crm/app.d.ts.map +1 -0
- package/dist/conformance/crm/app.js +95 -0
- package/dist/conformance/crm/app.js.map +1 -0
- package/dist/conformance/crm/contract.d.ts +586 -0
- package/dist/conformance/crm/contract.d.ts.map +1 -0
- package/dist/conformance/crm/contract.js +153 -0
- package/dist/conformance/crm/contract.js.map +1 -0
- package/dist/conformance/crm/migrations/crm/0000_crm.sql +18 -0
- package/dist/conformance/crm/migrations/team/0000_team.sql +6 -0
- package/dist/conformance/crm/schema.d.ts +261 -0
- package/dist/conformance/crm/schema.d.ts.map +1 -0
- package/dist/conformance/crm/schema.js +25 -0
- package/dist/conformance/crm/schema.js.map +1 -0
- package/dist/conformance/crm/sync.gen.d.ts +188 -0
- package/dist/conformance/crm/sync.gen.d.ts.map +1 -0
- package/dist/conformance/crm/sync.gen.js +25 -0
- package/dist/conformance/crm/sync.gen.js.map +1 -0
- package/dist/conformance/desk/contract.d.ts +306 -0
- package/dist/conformance/desk/contract.d.ts.map +1 -0
- package/dist/conformance/desk/contract.js +56 -0
- package/dist/conformance/desk/contract.js.map +1 -0
- package/dist/conformance/desk/migrations/0000_notes.sql +7 -0
- package/dist/conformance/desk/server.d.ts +231 -0
- package/dist/conformance/desk/server.d.ts.map +1 -0
- package/dist/conformance/desk/server.js +123 -0
- package/dist/conformance/desk/server.js.map +1 -0
- package/dist/conformance/drafts/migrations/0000_drafts.sql +8 -0
- package/dist/conformance/drafts/module.d.ts +571 -0
- package/dist/conformance/drafts/module.d.ts.map +1 -0
- package/dist/conformance/drafts/module.js +190 -0
- package/dist/conformance/drafts/module.js.map +1 -0
- package/dist/conformance/fixture/app.d.ts +24 -0
- package/dist/conformance/fixture/app.d.ts.map +1 -0
- package/dist/conformance/fixture/app.js +26 -0
- package/dist/conformance/fixture/app.js.map +1 -0
- package/dist/conformance/fixture/docs/bad-sync.d.ts +105 -0
- package/dist/conformance/fixture/docs/bad-sync.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/bad-sync.js +22 -0
- package/dist/conformance/fixture/docs/bad-sync.js.map +1 -0
- package/dist/conformance/fixture/docs/contract.d.ts +1091 -0
- package/dist/conformance/fixture/docs/contract.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/contract.js +277 -0
- package/dist/conformance/fixture/docs/contract.js.map +1 -0
- package/dist/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
- package/dist/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
- package/dist/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
- package/dist/conformance/fixture/docs/policy.cedar +110 -0
- package/dist/conformance/fixture/docs/schema.d.ts +308 -0
- package/dist/conformance/fixture/docs/schema.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/schema.js +36 -0
- package/dist/conformance/fixture/docs/schema.js.map +1 -0
- package/dist/conformance/fixture/docs/server.d.ts +552 -0
- package/dist/conformance/fixture/docs/server.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/server.js +192 -0
- package/dist/conformance/fixture/docs/server.js.map +1 -0
- package/dist/conformance/fixture/docs/sync.d.ts +402 -0
- package/dist/conformance/fixture/docs/sync.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/sync.gen.d.ts +574 -0
- package/dist/conformance/fixture/docs/sync.gen.d.ts.map +1 -0
- package/dist/conformance/fixture/docs/sync.gen.js +48 -0
- package/dist/conformance/fixture/docs/sync.gen.js.map +1 -0
- package/dist/conformance/fixture/docs/sync.js +23 -0
- package/dist/conformance/fixture/docs/sync.js.map +1 -0
- package/dist/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
- package/dist/conformance/fixture/peer/module.d.ts +306 -0
- package/dist/conformance/fixture/peer/module.d.ts.map +1 -0
- package/dist/conformance/fixture/peer/module.js +44 -0
- package/dist/conformance/fixture/peer/module.js.map +1 -0
- package/dist/conformance/fixture/release/blocking/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/blocking/0001_wait.sql +2 -0
- package/dist/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
- package/dist/conformance/fixture/release/broken/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/broken/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/broken/0002_label.sql +3 -0
- package/dist/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
- package/dist/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/escape/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/escape/0001_escape.sql +5 -0
- package/dist/conformance/fixture/release/misnamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
- package/dist/conformance/fixture/release/module.d.ts +1878 -0
- package/dist/conformance/fixture/release/module.d.ts.map +1 -0
- package/dist/conformance/fixture/release/module.js +102 -0
- package/dist/conformance/fixture/release/module.js.map +1 -0
- package/dist/conformance/fixture/release/outside/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/outside/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/outside/0002_index.sql +4 -0
- package/dist/conformance/fixture/release/outside/0003_later.sql +1 -0
- package/dist/conformance/fixture/release/renamed/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/renamed/0001_misname.sql +10 -0
- package/dist/conformance/fixture/release/renamed/0002_restore.sql +1 -0
- package/dist/conformance/fixture/release/rogue/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/rogue/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/rogue/0002_definer.sql +1 -0
- package/dist/conformance/fixture/release/slow/0000_item.sql +5 -0
- package/dist/conformance/fixture/release/undeclared/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/undeclared/0002_index.sql +1 -0
- package/dist/conformance/fixture/release/v1/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/v2/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/v2/0001_extra.sql +3 -0
- package/dist/conformance/fixture/release/v2/0002_label.sql +3 -0
- package/dist/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
- package/dist/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
- package/dist/conformance/kit-hash.d.ts +8 -0
- package/dist/conformance/kit-hash.d.ts.map +1 -0
- package/dist/conformance/kit-hash.js +20 -0
- package/dist/conformance/kit-hash.js.map +1 -0
- package/dist/conformance/ledger/contract.d.ts +380 -0
- package/dist/conformance/ledger/contract.d.ts.map +1 -0
- package/dist/conformance/ledger/contract.js +81 -0
- package/dist/conformance/ledger/contract.js.map +1 -0
- package/dist/conformance/ledger/migrations/0000_entries.sql +8 -0
- package/dist/conformance/ledger/server.d.ts +312 -0
- package/dist/conformance/ledger/server.d.ts.map +1 -0
- package/dist/conformance/ledger/server.js +152 -0
- package/dist/conformance/ledger/server.js.map +1 -0
- package/dist/conformance/library/app.d.ts +616 -0
- package/dist/conformance/library/app.d.ts.map +1 -0
- package/dist/conformance/library/app.js +35 -0
- package/dist/conformance/library/app.js.map +1 -0
- package/dist/conformance/library/contract.d.ts +377 -0
- package/dist/conformance/library/contract.d.ts.map +1 -0
- package/dist/conformance/library/contract.js +63 -0
- package/dist/conformance/library/contract.js.map +1 -0
- package/dist/conformance/library/migrations/0000_library.sql +14 -0
- package/dist/conformance/library/schema.d.ts +174 -0
- package/dist/conformance/library/schema.d.ts.map +1 -0
- package/dist/conformance/library/schema.js +24 -0
- package/dist/conformance/library/schema.js.map +1 -0
- package/dist/conformance/library/server.d.ts +191 -0
- package/dist/conformance/library/server.d.ts.map +1 -0
- package/dist/conformance/library/server.js +52 -0
- package/dist/conformance/library/server.js.map +1 -0
- package/dist/conformance/library/sync.gen.d.ts +519 -0
- package/dist/conformance/library/sync.gen.d.ts.map +1 -0
- package/dist/conformance/library/sync.gen.js +42 -0
- package/dist/conformance/library/sync.gen.js.map +1 -0
- package/dist/conformance/locale/catalog.d.ts +93 -0
- package/dist/conformance/locale/catalog.d.ts.map +1 -0
- package/dist/conformance/locale/catalog.js +104 -0
- package/dist/conformance/locale/catalog.js.map +1 -0
- package/dist/conformance/notebook/app.d.ts +1039 -0
- package/dist/conformance/notebook/app.d.ts.map +1 -0
- package/dist/conformance/notebook/app.js +88 -0
- package/dist/conformance/notebook/app.js.map +1 -0
- package/dist/conformance/notebook/evals/pages.evals.json +94 -0
- package/dist/conformance/notebook/migrations/0000_notebook.sql +10 -0
- package/dist/conformance/notebook/module.d.ts +717 -0
- package/dist/conformance/notebook/module.d.ts.map +1 -0
- package/dist/conformance/notebook/module.js +188 -0
- package/dist/conformance/notebook/module.js.map +1 -0
- package/dist/conformance/pad/app.d.ts +9 -0
- package/dist/conformance/pad/app.d.ts.map +1 -0
- package/dist/conformance/pad/app.js +13 -0
- package/dist/conformance/pad/app.js.map +1 -0
- package/dist/conformance/pad/contract.d.ts +281 -0
- package/dist/conformance/pad/contract.d.ts.map +1 -0
- package/dist/conformance/pad/contract.js +66 -0
- package/dist/conformance/pad/contract.js.map +1 -0
- package/dist/conformance/pad/migrations/pad/0000_pad.sql +8 -0
- package/dist/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
- package/dist/conformance/pad/schema.d.ts +127 -0
- package/dist/conformance/pad/schema.d.ts.map +1 -0
- package/dist/conformance/pad/schema.js +17 -0
- package/dist/conformance/pad/schema.js.map +1 -0
- package/dist/conformance/pad/server.d.ts +149 -0
- package/dist/conformance/pad/server.d.ts.map +1 -0
- package/dist/conformance/pad/server.js +81 -0
- package/dist/conformance/pad/server.js.map +1 -0
- package/dist/conformance/purchases/app.d.ts +480 -0
- package/dist/conformance/purchases/app.d.ts.map +1 -0
- package/dist/conformance/purchases/app.js +32 -0
- package/dist/conformance/purchases/app.js.map +1 -0
- package/dist/conformance/purchases/contract.d.ts +720 -0
- package/dist/conformance/purchases/contract.d.ts.map +1 -0
- package/dist/conformance/purchases/contract.js +148 -0
- package/dist/conformance/purchases/contract.js.map +1 -0
- package/dist/conformance/purchases/migrations/0000_purchases.sql +17 -0
- package/dist/conformance/purchases/server.d.ts +250 -0
- package/dist/conformance/purchases/server.d.ts.map +1 -0
- package/dist/conformance/purchases/server.js +85 -0
- package/dist/conformance/purchases/server.js.map +1 -0
- package/dist/conformance/studio/app.d.ts +996 -0
- package/dist/conformance/studio/app.d.ts.map +1 -0
- package/dist/conformance/studio/app.js +251 -0
- package/dist/conformance/studio/app.js.map +1 -0
- package/dist/conformance/studio/contract.d.ts +1318 -0
- package/dist/conformance/studio/contract.d.ts.map +1 -0
- package/dist/conformance/studio/contract.js +280 -0
- package/dist/conformance/studio/contract.js.map +1 -0
- package/dist/conformance/studio/migrations/billing/0000_billing.sql +6 -0
- package/dist/conformance/studio/migrations/journal/0000_journal.sql +9 -0
- package/dist/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
- package/dist/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
- package/dist/conformance/workshop/app.d.ts +8 -0
- package/dist/conformance/workshop/app.d.ts.map +1 -0
- package/dist/conformance/workshop/app.js +13 -0
- package/dist/conformance/workshop/app.js.map +1 -0
- package/dist/conformance/workshop/migrations/0000_notes.sql +7 -0
- package/dist/conformance/workshop/module.d.ts +407 -0
- package/dist/conformance/workshop/module.d.ts.map +1 -0
- package/dist/conformance/workshop/module.js +71 -0
- package/dist/conformance/workshop/module.js.map +1 -0
- package/dist/fakes/AcmeFake.d.ts +46 -0
- package/dist/fakes/AcmeFake.d.ts.map +1 -0
- package/dist/fakes/AcmeFake.js +131 -0
- package/dist/fakes/AcmeFake.js.map +1 -0
- package/dist/fakes/ApnsFake.d.ts +79 -0
- package/dist/fakes/ApnsFake.d.ts.map +1 -0
- package/dist/fakes/ApnsFake.js +220 -0
- package/dist/fakes/ApnsFake.js.map +1 -0
- package/dist/fakes/FcmFake.d.ts +46 -0
- package/dist/fakes/FcmFake.d.ts.map +1 -0
- package/dist/fakes/FcmFake.js +185 -0
- package/dist/fakes/FcmFake.js.map +1 -0
- package/dist/fakes/GoogleFake.d.ts +221 -0
- package/dist/fakes/GoogleFake.d.ts.map +1 -0
- package/dist/fakes/GoogleFake.js +1035 -0
- package/dist/fakes/GoogleFake.js.map +1 -0
- package/dist/fakes/HttpApiFake.d.ts +22 -0
- package/dist/fakes/HttpApiFake.d.ts.map +1 -0
- package/dist/fakes/HttpApiFake.js +74 -0
- package/dist/fakes/HttpApiFake.js.map +1 -0
- package/dist/fakes/McpFake.d.ts +80 -0
- package/dist/fakes/McpFake.d.ts.map +1 -0
- package/dist/fakes/McpFake.js +312 -0
- package/dist/fakes/McpFake.js.map +1 -0
- package/dist/fakes/MicrosoftGraphFake.d.ts +254 -0
- package/dist/fakes/MicrosoftGraphFake.d.ts.map +1 -0
- package/dist/fakes/MicrosoftGraphFake.js +850 -0
- package/dist/fakes/MicrosoftGraphFake.js.map +1 -0
- package/dist/fakes/S3Fake.d.ts +29 -0
- package/dist/fakes/S3Fake.d.ts.map +1 -0
- package/dist/fakes/S3Fake.js +347 -0
- package/dist/fakes/S3Fake.js.map +1 -0
- package/dist/fakes/Server.d.ts +137 -0
- package/dist/fakes/Server.d.ts.map +1 -0
- package/dist/fakes/Server.js +357 -0
- package/dist/fakes/Server.js.map +1 -0
- package/dist/fakes/SignInProviderFake.d.ts +21 -0
- package/dist/fakes/SignInProviderFake.d.ts.map +1 -0
- package/dist/fakes/SignInProviderFake.js +56 -0
- package/dist/fakes/SignInProviderFake.js.map +1 -0
- package/dist/fakes/SlackFake.d.ts +136 -0
- package/dist/fakes/SlackFake.d.ts.map +1 -0
- package/dist/fakes/SlackFake.js +787 -0
- package/dist/fakes/SlackFake.js.map +1 -0
- package/dist/fakes/Store.d.ts +40 -0
- package/dist/fakes/Store.d.ts.map +1 -0
- package/dist/fakes/Store.js +82 -0
- package/dist/fakes/Store.js.map +1 -0
- package/dist/fakes/TelemetryFakes.d.ts +77 -0
- package/dist/fakes/TelemetryFakes.d.ts.map +1 -0
- package/dist/fakes/TelemetryFakes.js +121 -0
- package/dist/fakes/TelemetryFakes.js.map +1 -0
- package/dist/fakes/TestCa.d.ts +11 -0
- package/dist/fakes/TestCa.d.ts.map +1 -0
- package/dist/fakes/TestCa.js +115 -0
- package/dist/fakes/TestCa.js.map +1 -0
- package/dist/fakes/WorkOsFake.d.ts +40 -0
- package/dist/fakes/WorkOsFake.d.ts.map +1 -0
- package/dist/fakes/WorkOsFake.js +103 -0
- package/dist/fakes/WorkOsFake.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/make/reference.d.ts +520 -0
- package/dist/make/reference.d.ts.map +1 -0
- package/dist/make/reference.js +182 -0
- package/dist/make/reference.js.map +1 -0
- package/dist/make/sources.d.ts +48 -0
- package/dist/make/sources.d.ts.map +1 -0
- package/dist/make/sources.js +806 -0
- package/dist/make/sources.js.map +1 -0
- package/package.json +77 -3
- package/src/Admin.ts +82 -0
- package/src/Agent.ts +289 -0
- package/src/AgentSurface.ts +51 -0
- package/src/Embedder.ts +69 -0
- package/src/EvalMain.ts +81 -0
- package/src/Evals.ts +490 -0
- package/src/Kernel.ts +228 -0
- package/src/Launch.ts +428 -0
- package/src/Locks.ts +123 -0
- package/src/Routes.ts +65 -0
- package/src/ScriptedChatModel.ts +189 -0
- package/src/SmtpSink.ts +205 -0
- package/src/System.ts +1072 -0
- package/src/TcpProxy.ts +102 -0
- package/src/auth/TrustedProxyAuth.ts +173 -0
- package/src/conformance/ActionConsent.ts +437 -0
- package/src/conformance/ActionRegistry.ts +174 -0
- package/src/conformance/Actor.ts +216 -0
- package/src/conformance/AgentReference.ts +171 -0
- package/src/conformance/AgentResources.ts +548 -0
- package/src/conformance/AgentRuntime.ts +388 -0
- package/src/conformance/AgentSubject.ts +103 -0
- package/src/conformance/Approvals.ts +363 -0
- package/src/conformance/Audit.ts +257 -0
- package/src/conformance/CalendarProvider.ts +156 -0
- package/src/conformance/CapabilityKit.ts +564 -0
- package/src/conformance/ClientSDK.ts +233 -0
- package/src/conformance/CollabDocument.ts +1203 -0
- package/src/conformance/CollabReference.ts +152 -0
- package/src/conformance/CollabSubject.ts +64 -0
- package/src/conformance/Command.ts +75 -0
- package/src/conformance/Connections.ts +357 -0
- package/src/conformance/ConnectionsReference.ts +172 -0
- package/src/conformance/ConnectorReference.ts +280 -0
- package/src/conformance/ContextAccounting.ts +169 -0
- package/src/conformance/Daemon.ts +936 -0
- package/src/conformance/DaemonReference.ts +189 -0
- package/src/conformance/DbTx.ts +253 -0
- package/src/conformance/DecisionTokens.ts +652 -0
- package/src/conformance/Delegation.ts +177 -0
- package/src/conformance/DeskReference.ts +73 -0
- package/src/conformance/DeviceControl.ts +700 -0
- package/src/conformance/Directory.ts +315 -0
- package/src/conformance/DirectoryProvider.ts +72 -0
- package/src/conformance/DocumentSource.ts +62 -0
- package/src/conformance/EndpointReference.ts +117 -0
- package/src/conformance/Files.ts +685 -0
- package/src/conformance/FilesReference.ts +154 -0
- package/src/conformance/FilesSubject.ts +50 -0
- package/src/conformance/Flags.ts +215 -0
- package/src/conformance/Host.ts +197 -0
- package/src/conformance/HttpApi.ts +169 -0
- package/src/conformance/InboxReference.ts +401 -0
- package/src/conformance/InboxSubject.ts +101 -0
- package/src/conformance/Ingestion.ts +425 -0
- package/src/conformance/Ingress.ts +498 -0
- package/src/conformance/Invocation.ts +780 -0
- package/src/conformance/IsolationMatrix.ts +215 -0
- package/src/conformance/LiveConnection.ts +197 -0
- package/src/conformance/LocalClient.ts +651 -0
- package/src/conformance/Locale.ts +141 -0
- package/src/conformance/MachineIdentity.ts +828 -0
- package/src/conformance/MailProvider.ts +217 -0
- package/src/conformance/Memory.ts +223 -0
- package/src/conformance/Messaging.ts +185 -0
- package/src/conformance/Metering.ts +293 -0
- package/src/conformance/ModelProvider.ts +139 -0
- package/src/conformance/ModuleManifest.ts +630 -0
- package/src/conformance/NotebookAgent.ts +41 -0
- package/src/conformance/NotificationChannel.ts +122 -0
- package/src/conformance/Notifications.ts +316 -0
- package/src/conformance/OAuthClient.ts +240 -0
- package/src/conformance/Outbox.ts +342 -0
- package/src/conformance/PlatformReference.ts +73 -0
- package/src/conformance/PlatformSubject.ts +50 -0
- package/src/conformance/Privacy.ts +577 -0
- package/src/conformance/Progress.ts +244 -0
- package/src/conformance/Push.ts +820 -0
- package/src/conformance/PushReference.ts +101 -0
- package/src/conformance/QuerySurface.ts +408 -0
- package/src/conformance/Readiness.ts +157 -0
- package/src/conformance/Reference.ts +326 -0
- package/src/conformance/Release.ts +690 -0
- package/src/conformance/ReleaseReference.ts +179 -0
- package/src/conformance/ResultRendering.ts +149 -0
- package/src/conformance/Sandbox.ts +313 -0
- package/src/conformance/SandboxReference.ts +52 -0
- package/src/conformance/Scheduler.ts +764 -0
- package/src/conformance/ScreenContext.ts +402 -0
- package/src/conformance/Search.ts +419 -0
- package/src/conformance/Secrets.ts +277 -0
- package/src/conformance/SecretsReference.ts +131 -0
- package/src/conformance/ServicesReference.ts +330 -0
- package/src/conformance/ServicesSubject.ts +105 -0
- package/src/conformance/Settings.ts +204 -0
- package/src/conformance/Sharing.ts +486 -0
- package/src/conformance/ShellSubject.ts +47 -0
- package/src/conformance/SignOutRace.ts +77 -0
- package/src/conformance/Slot.ts +84 -0
- package/src/conformance/Space.ts +432 -0
- package/src/conformance/StorageAdapter.ts +253 -0
- package/src/conformance/StorageBackend.ts +327 -0
- package/src/conformance/Subject.ts +208 -0
- package/src/conformance/Sync.ts +215 -0
- package/src/conformance/Telemetry.ts +287 -0
- package/src/conformance/ThemeTokens.ts +163 -0
- package/src/conformance/ToolSource.ts +632 -0
- package/src/conformance/Versioning.ts +199 -0
- package/src/conformance/View.ts +143 -0
- package/src/conformance/WorkItems.ts +186 -0
- package/src/conformance/Workflow.ts +304 -0
- package/src/conformance/acme/chatlog.ts +115 -0
- package/src/conformance/acme/connector.ts +151 -0
- package/src/conformance/acme/migrations/0000_messages.sql +8 -0
- package/src/conformance/archive/app.ts +33 -0
- package/src/conformance/archive/contract.ts +191 -0
- package/src/conformance/archive/memo.sync.gen.ts +25 -0
- package/src/conformance/archive/migrations/archive/0000_archive.sql +9 -0
- package/src/conformance/archive/migrations/memo/0000_memo.sql +6 -0
- package/src/conformance/archive/schema.ts +25 -0
- package/src/conformance/archive/server.ts +146 -0
- package/src/conformance/archive/sync.gen.ts +32 -0
- package/src/conformance/atlas/app.ts +16 -0
- package/src/conformance/atlas/contract.ts +118 -0
- package/src/conformance/crm/app.ts +107 -0
- package/src/conformance/crm/contract.ts +163 -0
- package/src/conformance/crm/migrations/crm/0000_crm.sql +18 -0
- package/src/conformance/crm/migrations/team/0000_team.sql +6 -0
- package/src/conformance/crm/schema.ts +28 -0
- package/src/conformance/crm/sync.gen.ts +27 -0
- package/src/conformance/desk/contract.ts +61 -0
- package/src/conformance/desk/migrations/0000_notes.sql +7 -0
- package/src/conformance/desk/server.ts +131 -0
- package/src/conformance/drafts/migrations/0000_drafts.sql +8 -0
- package/src/conformance/drafts/module.ts +211 -0
- package/src/conformance/fixture/app.ts +37 -0
- package/src/conformance/fixture/docs/bad-sync.ts +34 -0
- package/src/conformance/fixture/docs/contract.ts +297 -0
- package/src/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
- package/src/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
- package/src/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
- package/src/conformance/fixture/docs/policy.cedar +110 -0
- package/src/conformance/fixture/docs/schema.ts +41 -0
- package/src/conformance/fixture/docs/server.ts +292 -0
- package/src/conformance/fixture/docs/sync.gen.ts +54 -0
- package/src/conformance/fixture/docs/sync.ts +24 -0
- package/src/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
- package/src/conformance/fixture/peer/module.ts +51 -0
- package/src/conformance/fixture/release/blocking/0000_item.sql +3 -0
- package/src/conformance/fixture/release/blocking/0001_wait.sql +2 -0
- package/src/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
- package/src/conformance/fixture/release/broken/0000_item.sql +3 -0
- package/src/conformance/fixture/release/broken/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/broken/0002_label.sql +3 -0
- package/src/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
- package/src/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
- package/src/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
- package/src/conformance/fixture/release/escape/0000_item.sql +3 -0
- package/src/conformance/fixture/release/escape/0001_escape.sql +5 -0
- package/src/conformance/fixture/release/misnamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
- package/src/conformance/fixture/release/module.ts +119 -0
- package/src/conformance/fixture/release/outside/0000_item.sql +3 -0
- package/src/conformance/fixture/release/outside/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/outside/0002_index.sql +4 -0
- package/src/conformance/fixture/release/outside/0003_later.sql +1 -0
- package/src/conformance/fixture/release/renamed/0000_item.sql +3 -0
- package/src/conformance/fixture/release/renamed/0001_misname.sql +10 -0
- package/src/conformance/fixture/release/renamed/0002_restore.sql +1 -0
- package/src/conformance/fixture/release/rogue/0000_item.sql +3 -0
- package/src/conformance/fixture/release/rogue/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/rogue/0002_definer.sql +1 -0
- package/src/conformance/fixture/release/slow/0000_item.sql +5 -0
- package/src/conformance/fixture/release/undeclared/0000_item.sql +3 -0
- package/src/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/undeclared/0002_index.sql +1 -0
- package/src/conformance/fixture/release/v1/0000_item.sql +3 -0
- package/src/conformance/fixture/release/v2/0000_item.sql +3 -0
- package/src/conformance/fixture/release/v2/0001_extra.sql +3 -0
- package/src/conformance/fixture/release/v2/0002_label.sql +3 -0
- package/src/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
- package/src/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
- package/src/conformance/kit-hash.ts +18 -0
- package/src/conformance/ledger/contract.ts +92 -0
- package/src/conformance/ledger/migrations/0000_entries.sql +8 -0
- package/src/conformance/ledger/server.ts +174 -0
- package/src/conformance/library/app.ts +38 -0
- package/src/conformance/library/contract.ts +66 -0
- package/src/conformance/library/migrations/0000_library.sql +14 -0
- package/src/conformance/library/schema.ts +27 -0
- package/src/conformance/library/server.ts +65 -0
- package/src/conformance/library/sync.gen.ts +47 -0
- package/src/conformance/locale/catalog.ts +111 -0
- package/src/conformance/notebook/app.ts +115 -0
- package/src/conformance/notebook/evals/pages.evals.json +94 -0
- package/src/conformance/notebook/migrations/0000_notebook.sql +10 -0
- package/src/conformance/notebook/module.ts +215 -0
- package/src/conformance/notebook/skills/meeting-notes.md +4 -0
- package/src/conformance/pad/app.ts +21 -0
- package/src/conformance/pad/contract.ts +69 -0
- package/src/conformance/pad/migrations/pad/0000_pad.sql +8 -0
- package/src/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
- package/src/conformance/pad/schema.ts +18 -0
- package/src/conformance/pad/server.ts +102 -0
- package/src/conformance/purchases/app.ts +34 -0
- package/src/conformance/purchases/contract.ts +161 -0
- package/src/conformance/purchases/migrations/0000_purchases.sql +17 -0
- package/src/conformance/purchases/server.ts +95 -0
- package/src/conformance/replica-search.mjs +22 -0
- package/src/conformance/studio/app.ts +298 -0
- package/src/conformance/studio/contract.ts +319 -0
- package/src/conformance/studio/migrations/billing/0000_billing.sql +6 -0
- package/src/conformance/studio/migrations/journal/0000_journal.sql +9 -0
- package/src/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
- package/src/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
- package/src/conformance/workshop/app.ts +14 -0
- package/src/conformance/workshop/migrations/0000_notes.sql +7 -0
- package/src/conformance/workshop/module.ts +79 -0
- package/src/fakes/AcmeFake.ts +182 -0
- package/src/fakes/ApnsFake.ts +245 -0
- package/src/fakes/FcmFake.ts +231 -0
- package/src/fakes/GoogleFake.ts +1346 -0
- package/src/fakes/HttpApiFake.ts +116 -0
- package/src/fakes/McpFake.ts +355 -0
- package/src/fakes/MicrosoftGraphFake.ts +1191 -0
- package/src/fakes/S3Fake.ts +376 -0
- package/src/fakes/Server.ts +445 -0
- package/src/fakes/SignInProviderFake.ts +70 -0
- package/src/fakes/SlackFake.ts +893 -0
- package/src/fakes/Store.ts +96 -0
- package/src/fakes/TelemetryFakes.ts +197 -0
- package/src/fakes/TestCa.ts +166 -0
- package/src/fakes/WorkOsFake.ts +136 -0
- package/src/index.ts +9 -0
- package/src/make/reference.ts +259 -0
- package/src/make/sources.ts +836 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conformance kit for the Release contract (docs/contracts/release.md): setup under a lease (concurrent
|
|
3
|
+
* setups serialise; a held lease is waited for and then reported with its holder; a stuck holder is reported
|
|
4
|
+
* at once), migrations and hardening in one transaction (a failure halfway, or one hardening refuses, leaves
|
|
5
|
+
* the database exactly as before), declared and undeclared non-transactional migrations, schema snapshots
|
|
6
|
+
* (from scratch equals step by step; drift is reported), and client/server version skew (a stale client's
|
|
7
|
+
* writes are refused on every surface while its reads keep working).
|
|
8
|
+
*
|
|
9
|
+
* Usage: `releaseConformance(() => startMyRelease())`, with a `ReleaseSubject` (below). The fixture module is
|
|
10
|
+
* `./fixture/release/module.ts` (`stage`, in several versions); version skew uses the conformance fixture app.
|
|
11
|
+
*/
|
|
12
|
+
import type { AnyKernelModule } from "@eloxiv/kernel"
|
|
13
|
+
import { makeClient } from "@eloxiv/client"
|
|
14
|
+
import {
|
|
15
|
+
CLIENT_VERSION_HEADER,
|
|
16
|
+
ReleaseInfo,
|
|
17
|
+
RELEASE_PATH,
|
|
18
|
+
type AuditRecord,
|
|
19
|
+
type ReleaseRecord,
|
|
20
|
+
type ReleaseStatus,
|
|
21
|
+
type SchemaSnapshotRecord,
|
|
22
|
+
type SetupReport,
|
|
23
|
+
} from "@eloxiv/contracts"
|
|
24
|
+
import { Schema } from "effect"
|
|
25
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest"
|
|
26
|
+
import { docs } from "./fixture/docs/contract.ts"
|
|
27
|
+
import { drift, stage } from "./fixture/release/module.ts"
|
|
28
|
+
import { managedHostProfile } from "../System.ts"
|
|
29
|
+
|
|
30
|
+
/** A setup's outcome: its report, or its failure's tag and fields. */
|
|
31
|
+
export type SetupOutcome =
|
|
32
|
+
| { readonly ok: true; readonly report: SetupReport }
|
|
33
|
+
| {
|
|
34
|
+
readonly ok: false
|
|
35
|
+
readonly error: {
|
|
36
|
+
readonly _tag: string
|
|
37
|
+
readonly message: string
|
|
38
|
+
readonly module?: string | undefined
|
|
39
|
+
readonly migration?: string | null | undefined
|
|
40
|
+
readonly owner?: string | null | undefined
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** One database the kit sets up, as an implementation runs setup against it. */
|
|
45
|
+
export interface ReleaseDatabase {
|
|
46
|
+
/** Release.setup for an app with exactly these modules. */
|
|
47
|
+
readonly setup: (
|
|
48
|
+
modules: ReadonlyArray<AnyKernelModule>,
|
|
49
|
+
options?: { readonly owner?: string; readonly waitMs?: number },
|
|
50
|
+
) => Promise<SetupOutcome>
|
|
51
|
+
/** Superuser SQL on the database (the catalogue and the modules' tables). */
|
|
52
|
+
readonly sql: <A extends object = Record<string, unknown>>(
|
|
53
|
+
text: string,
|
|
54
|
+
params?: ReadonlyArray<unknown>,
|
|
55
|
+
) => Promise<ReadonlyArray<A>>
|
|
56
|
+
/** Release.status for a build installing these modules. */
|
|
57
|
+
readonly status: (modules: ReadonlyArray<AnyKernelModule>) => Promise<ReleaseStatus>
|
|
58
|
+
/** Release.snapshots. */
|
|
59
|
+
readonly snapshots: () => Promise<ReadonlyArray<SchemaSnapshotRecord>>
|
|
60
|
+
/** Release.history. */
|
|
61
|
+
readonly history: () => Promise<ReadonlyArray<ReleaseRecord>>
|
|
62
|
+
/**
|
|
63
|
+
* Hold the migration lease as another setup would, recorded under `owner`, until `release`. `expired`
|
|
64
|
+
* records a lease that ran out while its holder still holds it (a stuck setup).
|
|
65
|
+
*/
|
|
66
|
+
readonly holdLease: (
|
|
67
|
+
owner: string,
|
|
68
|
+
options?: { readonly expired?: boolean },
|
|
69
|
+
) => Promise<{ readonly release: () => Promise<void> }>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A running kernel serving the conformance fixture app, with a minimum client version. */
|
|
73
|
+
export interface VersionedKernel {
|
|
74
|
+
readonly url: string
|
|
75
|
+
/** A signed-in member of organisation `acme`: their bearer token and id. */
|
|
76
|
+
readonly member: { readonly token: string; readonly id: string }
|
|
77
|
+
/** Audit.list by action. */
|
|
78
|
+
readonly audit: (action: string) => Promise<ReadonlyArray<AuditRecord>>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ReleaseSubject {
|
|
82
|
+
/** A fresh, empty database (created by its first setup), dropped when the subject is disposed. */
|
|
83
|
+
readonly database: (name: string) => Promise<ReleaseDatabase>
|
|
84
|
+
/** A kernel serving the conformance fixture app that accepts writes only from clients at `minClientVersion` or later. */
|
|
85
|
+
readonly serve: (minClientVersion: string) => Promise<VersionedKernel>
|
|
86
|
+
readonly dispose: () => Promise<void>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type StartRelease = () => Promise<ReleaseSubject>
|
|
90
|
+
|
|
91
|
+
/** What a setup could change in schema `stage`, from the catalogue: relations, columns, privileges, policies, ... */
|
|
92
|
+
const describeStage = async (db: ReleaseDatabase) => {
|
|
93
|
+
const [row] = await db.sql<{ state: unknown }>(
|
|
94
|
+
`SELECT jsonb_build_object(
|
|
95
|
+
'schema', (SELECT count(*)::int FROM pg_namespace WHERE nspname = 'stage'),
|
|
96
|
+
'relations', (SELECT coalesce(jsonb_agg(jsonb_build_object('name', c.relname, 'kind', c.relkind,
|
|
97
|
+
'rls', c.relrowsecurity, 'forced', c.relforcerowsecurity,
|
|
98
|
+
'acl', (SELECT coalesce(jsonb_agg(a ORDER BY a), '[]') FROM unnest(c.relacl::text[]) a),
|
|
99
|
+
'columns', (SELECT coalesce(jsonb_agg(a.attname || ' ' || format_type(a.atttypid, a.atttypmod) ORDER BY a.attnum), '[]')
|
|
100
|
+
FROM pg_attribute a WHERE a.attrelid = c.oid AND a.attnum > 0 AND NOT a.attisdropped)) ORDER BY c.relname), '[]')
|
|
101
|
+
FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = 'stage'),
|
|
102
|
+
'policies', (SELECT coalesce(jsonb_agg(x ORDER BY x), '[]') FROM (SELECT tablename || '.' || policyname || ' ' || cmd || ' ' || array_to_string(roles, ',')
|
|
103
|
+
|| ' ' || coalesce(qual, '') || ' ' || coalesce(with_check, '') AS x
|
|
104
|
+
FROM pg_policies WHERE schemaname = 'stage') s),
|
|
105
|
+
'triggers', (SELECT coalesce(jsonb_agg(pg_get_triggerdef(t.oid) ORDER BY pg_get_triggerdef(t.oid)), '[]')
|
|
106
|
+
FROM pg_trigger t JOIN pg_class c ON c.oid = t.tgrelid JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
107
|
+
WHERE n.nspname = 'stage' AND NOT t.tgisinternal),
|
|
108
|
+
'functions', (SELECT coalesce(jsonb_agg(p.proname ORDER BY p.proname), '[]')
|
|
109
|
+
FROM pg_proc p JOIN pg_namespace n ON n.oid = p.pronamespace WHERE n.nspname = 'stage')
|
|
110
|
+
) AS state`,
|
|
111
|
+
)
|
|
112
|
+
return row!.state
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Everything setup is responsible for: the module's schema, what is pending, and the recorded snapshots. */
|
|
116
|
+
const stateOf = async (db: ReleaseDatabase) => ({
|
|
117
|
+
stage: await describeStage(db),
|
|
118
|
+
pending: (await db.status([stage.v2])).pending,
|
|
119
|
+
snapshots: (await db.snapshots()).map(({ module, fingerprint, migrations }) => ({ module, fingerprint, migrations })),
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
const fingerprintOf = async (db: ReleaseDatabase, module: string) =>
|
|
123
|
+
(await db.snapshots()).find((s) => s.module === module)?.fingerprint
|
|
124
|
+
|
|
125
|
+
const expectOk = (outcome: SetupOutcome): SetupReport => {
|
|
126
|
+
if (!outcome.ok) throw new Error(`setup failed: ${outcome.error._tag}: ${outcome.error.message}`)
|
|
127
|
+
return outcome.report
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const releaseConformance = (start: StartRelease) =>
|
|
131
|
+
describe("Release contract", () => {
|
|
132
|
+
let subject: ReleaseSubject
|
|
133
|
+
|
|
134
|
+
beforeAll(async () => {
|
|
135
|
+
subject = await start()
|
|
136
|
+
})
|
|
137
|
+
afterAll(() => subject?.dispose())
|
|
138
|
+
|
|
139
|
+
describe("migrations and hardening in one transaction", () => {
|
|
140
|
+
it("applies every pending migration with its hardening and records the schema snapshot", async () => {
|
|
141
|
+
const db = await subject.database("apply")
|
|
142
|
+
const first = expectOk(await db.setup([stage.v1]))
|
|
143
|
+
expect(first.applied["stage"]).toEqual(["0000_item"])
|
|
144
|
+
expect(first.snapshots["stage"]).toEqual(expect.any(String))
|
|
145
|
+
const report = expectOk(await db.setup([stage.v2]))
|
|
146
|
+
expect(report.applied).toEqual({ stage: ["0001_extra", "0002_label"] })
|
|
147
|
+
expect(report.outsideTransaction).toEqual([])
|
|
148
|
+
// The table the upgrade added is hardened as it commits: forced row-level security, policies, privileges.
|
|
149
|
+
const [extra] = await db.sql<{ forced: boolean; policies: number; select: boolean }>(
|
|
150
|
+
`SELECT c.relforcerowsecurity AS forced,
|
|
151
|
+
(SELECT count(*)::int FROM pg_policies WHERE schemaname = 'stage' AND tablename = 'extra') AS policies,
|
|
152
|
+
has_table_privilege('eloxiv_mod_stage', 'stage.extra', 'SELECT') AS select
|
|
153
|
+
FROM pg_class c WHERE c.oid = 'stage.extra'::regclass`,
|
|
154
|
+
)
|
|
155
|
+
expect(extra).toMatchObject({ forced: true, select: true })
|
|
156
|
+
expect(extra!.policies).toBeGreaterThan(0)
|
|
157
|
+
const recorded = (await db.snapshots()).find((s) => s.module === "stage")
|
|
158
|
+
expect(recorded).toMatchObject({
|
|
159
|
+
fingerprint: report.snapshots["stage"],
|
|
160
|
+
migrations: ["0000_item", "0001_extra", "0002_label"],
|
|
161
|
+
})
|
|
162
|
+
expect(await db.status([stage.v2])).toEqual({ pending: [], drifted: [], unrecorded: [], insecure: [] })
|
|
163
|
+
// Nothing pending: setup again changes nothing.
|
|
164
|
+
const again = expectOk(await db.setup([stage.v2]))
|
|
165
|
+
expect(again.applied).toEqual({})
|
|
166
|
+
expect(again.snapshots["stage"]).toBe(report.snapshots["stage"])
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
it("leaves the database exactly as before when a migration fails halfway", async () => {
|
|
170
|
+
const db = await subject.database("broken")
|
|
171
|
+
expectOk(await db.setup([stage.v1]))
|
|
172
|
+
const before = await stateOf(db)
|
|
173
|
+
// 0001_extra succeeds; 0002_label's first statement succeeds and its second fails.
|
|
174
|
+
const outcome = await db.setup([stage.broken])
|
|
175
|
+
expect(outcome).toMatchObject({
|
|
176
|
+
ok: false,
|
|
177
|
+
error: { _tag: "MigrationFailed", module: "stage", migration: "0002_label" },
|
|
178
|
+
})
|
|
179
|
+
expect(await stateOf(db)).toEqual(before)
|
|
180
|
+
const last = (await db.history()).at(-1)
|
|
181
|
+
expect(last).toMatchObject({ outcome: "failed", applied: {} })
|
|
182
|
+
expect(last!.error).toContain("missing")
|
|
183
|
+
// The database still upgrades.
|
|
184
|
+
expect(expectOk(await db.setup([stage.v2])).applied).toEqual({ stage: ["0001_extra", "0002_label"] })
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
it("leaves the database exactly as before when hardening refuses what a migration left", async () => {
|
|
188
|
+
const db = await subject.database("rogue")
|
|
189
|
+
expectOk(await db.setup([stage.v1]))
|
|
190
|
+
const before = await stateOf(db)
|
|
191
|
+
const outcome = await db.setup([stage.rogue])
|
|
192
|
+
expect(outcome).toMatchObject({
|
|
193
|
+
ok: false,
|
|
194
|
+
error: { _tag: "MigrationFailed", module: "stage", migration: null },
|
|
195
|
+
})
|
|
196
|
+
expect((outcome as { error: { message: string } }).error.message).toMatch(/SECURITY DEFINER/i)
|
|
197
|
+
expect(await stateOf(db)).toEqual(before)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
it("refuses a migration PostgreSQL cannot run in a transaction unless it is declared, before running anything", async () => {
|
|
201
|
+
const db = await subject.database("undeclared")
|
|
202
|
+
expectOk(await db.setup([stage.v1]))
|
|
203
|
+
const before = await stateOf(db)
|
|
204
|
+
const outcome = await db.setup([stage.undeclared])
|
|
205
|
+
expect(outcome).toMatchObject({
|
|
206
|
+
ok: false,
|
|
207
|
+
error: { _tag: "MigrationFailed", module: "stage", migration: "0002_index" },
|
|
208
|
+
})
|
|
209
|
+
expect((outcome as { error: { message: string } }).error.message).toContain("eloxiv:no-transaction")
|
|
210
|
+
// Not even 0001_extra, which is fine on its own, ran.
|
|
211
|
+
expect(await stateOf(db)).toEqual(before)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it("refuses a migration that would end the setup's transaction (COMMIT), before running anything", async () => {
|
|
215
|
+
const db = await subject.database("escape")
|
|
216
|
+
expectOk(await db.setup([stage.v1]))
|
|
217
|
+
const before = await stateOf(db)
|
|
218
|
+
// 0001_escape: CREATE TABLE, then COMMIT, then a statement that fails.
|
|
219
|
+
const outcome = await db.setup([stage.escape])
|
|
220
|
+
expect(outcome).toMatchObject({
|
|
221
|
+
ok: false,
|
|
222
|
+
error: { _tag: "MigrationFailed", module: "stage", migration: "0001_escape" },
|
|
223
|
+
})
|
|
224
|
+
expect((outcome as { error: { message: string } }).error.message).toMatch(/transaction control/i)
|
|
225
|
+
// Nothing committed: no unhardened table, nothing else changed.
|
|
226
|
+
expect(await db.sql(`SELECT to_regclass('stage.exposed') AS t`)).toEqual([{ t: null }])
|
|
227
|
+
expect(await stateOf(db)).toEqual(before)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
it("leaves a module closed when the hardening after its committed migrations fails, until a setup succeeds", async () => {
|
|
231
|
+
const db = await subject.database("closed")
|
|
232
|
+
expectOk(await db.setup([stage.v1]))
|
|
233
|
+
await db.sql(`INSERT INTO stage.item (id, org_id) VALUES ('i1', 'acme')`)
|
|
234
|
+
// What the runtime role reaches: a row count, or "denied". As the superuser, in a function, the role is set
|
|
235
|
+
// for the dynamic statement only.
|
|
236
|
+
await db.sql(`CREATE FUNCTION public.reach_as(r text, q text) RETURNS text LANGUAGE plpgsql AS $$
|
|
237
|
+
DECLARE n bigint;
|
|
238
|
+
BEGIN
|
|
239
|
+
PERFORM set_config('role', r, true);
|
|
240
|
+
EXECUTE q INTO n;
|
|
241
|
+
PERFORM set_config('role', 'none', true);
|
|
242
|
+
RETURN n::text;
|
|
243
|
+
EXCEPTION WHEN insufficient_privilege THEN RETURN 'denied';
|
|
244
|
+
END $$`)
|
|
245
|
+
const reach = async () => {
|
|
246
|
+
const [row] = await db.sql<{ select: string; insert: string; update: string }>(
|
|
247
|
+
`SELECT public.reach_as('eloxiv_mod_stage', 'SELECT count(*) FROM stage.item') AS "select",
|
|
248
|
+
public.reach_as('eloxiv_mod_stage', 'WITH w AS (INSERT INTO stage.item VALUES (''i2'', ''acme'') RETURNING 1) SELECT count(*) FROM w') AS "insert",
|
|
249
|
+
public.reach_as('eloxiv_mod_stage', 'WITH w AS (UPDATE stage.item SET id = id RETURNING 1) SELECT count(*) FROM w') AS "update"`,
|
|
250
|
+
)
|
|
251
|
+
return row
|
|
252
|
+
}
|
|
253
|
+
const closedState = async () => {
|
|
254
|
+
const [row] = await db.sql<{ state: unknown }>(
|
|
255
|
+
`SELECT jsonb_build_object(
|
|
256
|
+
'forced', (SELECT bool_and(c.relrowsecurity AND c.relforcerowsecurity) FROM pg_class c
|
|
257
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = 'stage' AND c.relkind = 'r'),
|
|
258
|
+
'policies', (SELECT count(*)::int FROM pg_policies WHERE schemaname = 'stage'),
|
|
259
|
+
'grantees', (SELECT coalesce(jsonb_agg(DISTINCT pg_get_userbyid(a.grantee)), '[]') FROM pg_class c
|
|
260
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace, aclexplode(c.relacl) a
|
|
261
|
+
WHERE n.nspname = 'stage' AND a.grantee <> c.relowner),
|
|
262
|
+
'views', (SELECT count(*)::int FROM pg_views WHERE schemaname = 'stage')
|
|
263
|
+
) AS state`,
|
|
264
|
+
)
|
|
265
|
+
return row!.state
|
|
266
|
+
}
|
|
267
|
+
/** Everything the runtime role (and PUBLIC) may use in schema stage: it, its relations and its routines. */
|
|
268
|
+
const runtimeReach = async () => {
|
|
269
|
+
const [row] = await db.sql<{ reach: unknown }>(
|
|
270
|
+
`SELECT jsonb_build_object(
|
|
271
|
+
'schema', jsonb_build_object(
|
|
272
|
+
'usage', has_schema_privilege('eloxiv_mod_stage', 'stage', 'USAGE'),
|
|
273
|
+
'create', has_schema_privilege('eloxiv_mod_stage', 'stage', 'CREATE'),
|
|
274
|
+
'publicCreate', (SELECT coalesce(bool_or(a.grantee = 0), false) FROM pg_namespace n, aclexplode(n.nspacl) a
|
|
275
|
+
WHERE n.nspname = 'stage')),
|
|
276
|
+
'relations', (SELECT coalesce(jsonb_agg(c.relname ORDER BY c.relname), '[]') FROM pg_class c
|
|
277
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = 'stage'
|
|
278
|
+
AND (has_table_privilege('eloxiv_mod_stage', c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER')
|
|
279
|
+
OR (c.relkind = 'S' AND has_sequence_privilege('eloxiv_mod_stage', c.oid, 'USAGE, SELECT, UPDATE')))),
|
|
280
|
+
'routines', (SELECT coalesce(jsonb_agg(p.proname ORDER BY p.proname), '[]') FROM pg_proc p
|
|
281
|
+
JOIN pg_namespace n ON n.oid = p.pronamespace WHERE n.nspname = 'stage'
|
|
282
|
+
AND has_function_privilege('eloxiv_mod_stage', p.oid, 'EXECUTE'))
|
|
283
|
+
) AS reach`,
|
|
284
|
+
)
|
|
285
|
+
return row!.reach
|
|
286
|
+
}
|
|
287
|
+
expect((await reach())?.select).toBe("0")
|
|
288
|
+
|
|
289
|
+
// 0001_misname commits on the owner session; the hardening after it cannot create the policies.
|
|
290
|
+
const failed = await db.setup([stage.misnamed])
|
|
291
|
+
expect(failed).toMatchObject({ ok: false, error: { _tag: "MigrationFailed" } })
|
|
292
|
+
expect(
|
|
293
|
+
(await db.sql(`SELECT name FROM eloxiv.module_migration WHERE module = 'stage' ORDER BY name`)).map(
|
|
294
|
+
(r) => r["name"],
|
|
295
|
+
),
|
|
296
|
+
).toEqual(["0000_item", "0001_misname"])
|
|
297
|
+
// Closed: forced row-level security, no policy, no privilege for anyone but the owner, no published view.
|
|
298
|
+
expect(await closedState()).toEqual({ forced: true, policies: 0, grantees: [], views: 0 })
|
|
299
|
+
expect(await reach()).toEqual({ select: "denied", insert: "denied", update: "denied" })
|
|
300
|
+
// Nothing at all: not the schema (what the migration granted on it is gone), no relation, no routine.
|
|
301
|
+
expect(await runtimeReach()).toEqual({
|
|
302
|
+
schema: { usage: false, create: false, publicCreate: false },
|
|
303
|
+
relations: [],
|
|
304
|
+
routines: [],
|
|
305
|
+
})
|
|
306
|
+
expect((await db.status([stage.misnamed])).insecure).toEqual(["stage"])
|
|
307
|
+
|
|
308
|
+
// A setup that succeeds hardens it again: the runtime role reaches its rows through its policies.
|
|
309
|
+
expectOk(await db.setup([stage.renamed]))
|
|
310
|
+
expect(await reach()).toEqual({ select: "0", insert: "denied", update: "0" })
|
|
311
|
+
expect((await closedState()) as { policies: number }).toMatchObject({ forced: true })
|
|
312
|
+
expect(((await closedState()) as { policies: number }).policies).toBeGreaterThan(0)
|
|
313
|
+
expect(((await closedState()) as { grantees: ReadonlyArray<string> }).grantees).toEqual(["eloxiv_mod_stage"])
|
|
314
|
+
expect(await db.status([stage.renamed])).toEqual({ pending: [], drifted: [], unrecorded: [], insecure: [] })
|
|
315
|
+
// Reopened as hardening opens a module: the schema and its tables, never CREATE, nor the procedure.
|
|
316
|
+
expect(await runtimeReach()).toEqual({
|
|
317
|
+
schema: { usage: true, create: false, publicCreate: false },
|
|
318
|
+
relations: ["item"],
|
|
319
|
+
routines: [],
|
|
320
|
+
})
|
|
321
|
+
await db.sql(`DROP FUNCTION public.reach_as(text, text)`)
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
it("runs a declared non-transactional migration on its own, between the transactions around it", async () => {
|
|
325
|
+
const db = await subject.database("outside")
|
|
326
|
+
const report = expectOk(await db.setup([stage.outside]))
|
|
327
|
+
expect(report.applied["stage"]).toEqual(["0000_item", "0001_extra", "0002_index", "0003_later"])
|
|
328
|
+
expect(report.outsideTransaction).toEqual(["stage/0002_index"])
|
|
329
|
+
const [index] = await db.sql<{ valid: boolean }>(
|
|
330
|
+
`SELECT i.indisvalid AS valid FROM pg_index i WHERE i.indexrelid = 'stage.item_org_idx'::regclass`,
|
|
331
|
+
)
|
|
332
|
+
expect(index).toEqual({ valid: true })
|
|
333
|
+
const [later] = await db.sql<{ n: number }>(
|
|
334
|
+
`SELECT count(*)::int AS n FROM pg_attribute WHERE attrelid = 'stage.extra'::regclass AND attname = 'later'`,
|
|
335
|
+
)
|
|
336
|
+
expect(later!.n).toBe(1)
|
|
337
|
+
expect(await db.status([stage.outside])).toEqual({ pending: [], drifted: [], unrecorded: [], insecure: [] })
|
|
338
|
+
})
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
describe("the migration lease", () => {
|
|
342
|
+
it("serialises concurrent setups: one migrates while the other waits, then finds nothing to do", async () => {
|
|
343
|
+
const db = await subject.database("concurrent")
|
|
344
|
+
// `slow` holds its transaction for half a second.
|
|
345
|
+
const [a, b] = await Promise.all([
|
|
346
|
+
db.setup([stage.slow], { owner: "setup-a" }),
|
|
347
|
+
db.setup([stage.slow], { owner: "setup-b" }),
|
|
348
|
+
])
|
|
349
|
+
const reports = [expectOk(a), expectOk(b)]
|
|
350
|
+
expect(reports.map((r) => (r.applied["stage"] ?? []).join(",")).sort((x, y) => x.localeCompare(y))).toEqual([
|
|
351
|
+
"",
|
|
352
|
+
"0000_item",
|
|
353
|
+
])
|
|
354
|
+
const history = (await db.history()).filter((h) => h.owner === "setup-a" || h.owner === "setup-b")
|
|
355
|
+
expect(history.map((h) => h.outcome)).toEqual(["succeeded", "succeeded"])
|
|
356
|
+
// The second started only after the first had finished.
|
|
357
|
+
expect(Date.parse(history[1]!.startedAt)).toBeGreaterThanOrEqual(Date.parse(history[0]!.finishedAt))
|
|
358
|
+
})
|
|
359
|
+
|
|
360
|
+
it("waits for a held lease, then fails clearly, naming the holder, if it is not released in time", async () => {
|
|
361
|
+
const db = await subject.database("held")
|
|
362
|
+
expectOk(await db.setup([stage.v1]))
|
|
363
|
+
const held = await db.holdLease("deploy-42")
|
|
364
|
+
const started = Date.now()
|
|
365
|
+
const outcome = await db.setup([stage.v2], { waitMs: 600 })
|
|
366
|
+
expect(Date.now() - started).toBeGreaterThanOrEqual(500)
|
|
367
|
+
expect(outcome).toMatchObject({ ok: false, error: { _tag: "ReleaseLeaseHeld", owner: "deploy-42" } })
|
|
368
|
+
expect((outcome as { error: { message: string } }).error.message).toContain("deploy-42")
|
|
369
|
+
expect((await db.status([stage.v2])).pending).toEqual(["stage/0001_extra", "stage/0002_label"])
|
|
370
|
+
// Released while another setup waits: it proceeds.
|
|
371
|
+
const waiting = db.setup([stage.v2], { waitMs: 10_000 })
|
|
372
|
+
await new Promise((r) => setTimeout(r, 300))
|
|
373
|
+
await held.release()
|
|
374
|
+
expect(expectOk(await waiting).applied).toEqual({ stage: ["0001_extra", "0002_label"] })
|
|
375
|
+
})
|
|
376
|
+
|
|
377
|
+
it("reports a stuck holder (its lease expired while it still holds the lock) at once", async () => {
|
|
378
|
+
const db = await subject.database("stuck")
|
|
379
|
+
expectOk(await db.setup([stage.v1]))
|
|
380
|
+
const held = await db.holdLease("hung-deploy", { expired: true })
|
|
381
|
+
try {
|
|
382
|
+
const started = Date.now()
|
|
383
|
+
const outcome = await db.setup([stage.v2], { waitMs: 10_000 })
|
|
384
|
+
expect(Date.now() - started).toBeLessThan(5_000)
|
|
385
|
+
expect(outcome).toMatchObject({ ok: false, error: { _tag: "ReleaseLeaseHeld", owner: "hung-deploy" } })
|
|
386
|
+
expect((outcome as { error: { message: string } }).error.message).toMatch(/stuck/)
|
|
387
|
+
} finally {
|
|
388
|
+
await held.release()
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
})
|
|
392
|
+
|
|
393
|
+
describe("schema snapshots", () => {
|
|
394
|
+
it("records the same snapshot for a database built from scratch as for one upgraded step by step", async () => {
|
|
395
|
+
const stepwise = await subject.database("stepwise")
|
|
396
|
+
expectOk(await stepwise.setup([stage.v1]))
|
|
397
|
+
expectOk(await stepwise.setup([stage.v2]))
|
|
398
|
+
const scratch = await subject.database("scratch")
|
|
399
|
+
expectOk(await scratch.setup([stage.v2]))
|
|
400
|
+
for (const module of ["stage", "eloxiv"]) {
|
|
401
|
+
const fingerprint = await fingerprintOf(scratch, module)
|
|
402
|
+
expect(fingerprint, module).toEqual(expect.any(String))
|
|
403
|
+
expect(await fingerprintOf(stepwise, module), module).toBe(fingerprint)
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
it("reports a schema changed outside setup as drifted, and a module never set up as unrecorded", async () => {
|
|
408
|
+
const db = await subject.database("drift")
|
|
409
|
+
expectOk(await db.setup([stage.v1]))
|
|
410
|
+
expect(await db.status([stage.v1])).toEqual({ pending: [], drifted: [], unrecorded: [], insecure: [] })
|
|
411
|
+
await db.sql(`ALTER TABLE stage.item ADD COLUMN sneaky text`)
|
|
412
|
+
expect((await db.status([stage.v1])).drifted).toEqual(["stage"])
|
|
413
|
+
expect((await db.status([stage.v1, stage.v2])).pending).toContain("stage/0001_extra")
|
|
414
|
+
})
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
describe("security drift", () => {
|
|
418
|
+
/** Out-of-band changes that weaken what hardening installed on `stage.item`. */
|
|
419
|
+
const weakenings: ReadonlyArray<readonly [string, string]> = [
|
|
420
|
+
["row-level security disabled", `ALTER TABLE stage.item DISABLE ROW LEVEL SECURITY`],
|
|
421
|
+
["row-level security no longer forced", `ALTER TABLE stage.item NO FORCE ROW LEVEL SECURITY`],
|
|
422
|
+
[
|
|
423
|
+
"a policy dropped",
|
|
424
|
+
`DO $$ DECLARE p text; BEGIN
|
|
425
|
+
SELECT policyname INTO p FROM pg_policies WHERE schemaname = 'stage' AND tablename = 'item'
|
|
426
|
+
AND policyname <> 'eloxiv_migrate' LIMIT 1;
|
|
427
|
+
EXECUTE format('DROP POLICY %I ON stage.item', p);
|
|
428
|
+
END $$`,
|
|
429
|
+
],
|
|
430
|
+
[
|
|
431
|
+
"a permissive policy added",
|
|
432
|
+
`CREATE POLICY open_door ON stage.item FOR SELECT TO eloxiv_mod_stage USING (true)`,
|
|
433
|
+
],
|
|
434
|
+
["a privilege granted", `GRANT TRUNCATE ON stage.item TO eloxiv_mod_stage`],
|
|
435
|
+
["the write-log trigger disabled", `ALTER TABLE stage.item DISABLE TRIGGER eloxiv_track_write`],
|
|
436
|
+
]
|
|
437
|
+
|
|
438
|
+
for (const [what, statement] of weakenings) {
|
|
439
|
+
it(`reports ${what} as insecure, and the next setup repairs it instead of recording it`, async () => {
|
|
440
|
+
const db = await subject.database(`insecure_${weakenings.findIndex(([w]) => w === what)}`)
|
|
441
|
+
expectOk(await db.setup([stage.v1]))
|
|
442
|
+
const hardened = await describeStage(db)
|
|
443
|
+
const snapshot = await fingerprintOf(db, "stage")
|
|
444
|
+
await db.sql(statement)
|
|
445
|
+
const status = await db.status([stage.v1])
|
|
446
|
+
// Nothing pending, nothing changed by a migration: setup still repairs the hardening.
|
|
447
|
+
const report = expectOk(await db.setup([stage.v1]))
|
|
448
|
+
expect(await describeStage(db)).toEqual(hardened)
|
|
449
|
+
expect(report.applied).toEqual({})
|
|
450
|
+
expect(report.repaired).toEqual(["stage"])
|
|
451
|
+
expect(status.insecure).toEqual(["stage"])
|
|
452
|
+
expect(status.drifted).toEqual(["stage"])
|
|
453
|
+
expect(await db.status([stage.v1])).toEqual({ pending: [], drifted: [], unrecorded: [], insecure: [] })
|
|
454
|
+
// The recorded snapshot is the hardened schema's, not the weakened one's.
|
|
455
|
+
expect(await fingerprintOf(db, "stage")).toBe(snapshot)
|
|
456
|
+
})
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** The module `drift`'s roles as the cluster has them: attributes and memberships in both directions. */
|
|
460
|
+
const roleState = (db: ReleaseDatabase) =>
|
|
461
|
+
db.sql(
|
|
462
|
+
`SELECT jsonb_build_object(
|
|
463
|
+
'roles', (SELECT jsonb_agg(jsonb_build_object('name', rolname, 'super', rolsuper, 'bypassrls', rolbypassrls,
|
|
464
|
+
'createrole', rolcreaterole, 'createdb', rolcreatedb, 'replication', rolreplication, 'login', rolcanlogin)
|
|
465
|
+
ORDER BY rolname) FROM pg_roles WHERE rolname IN ('eloxiv_mod_drift', 'eloxiv_own_drift')),
|
|
466
|
+
'memberships', (SELECT coalesce(jsonb_agg(r.rolname || ' > ' || m.rolname || ' ' || a.inherit_option || a.set_option || a.admin_option
|
|
467
|
+
ORDER BY r.rolname || ' > ' || m.rolname || ' ' || a.inherit_option || a.set_option || a.admin_option), '[]') FROM pg_auth_members a JOIN pg_roles r ON r.oid = a.roleid JOIN pg_roles m ON m.oid = a.member
|
|
468
|
+
WHERE r.rolname IN ('eloxiv_mod_drift', 'eloxiv_own_drift') OR m.rolname IN ('eloxiv_mod_drift', 'eloxiv_own_drift'))
|
|
469
|
+
) AS state`,
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
const roleWeakenings: ReadonlyArray<readonly [string, ReadonlyArray<string>]> = [
|
|
473
|
+
["the runtime role given BYPASSRLS", [`ALTER ROLE eloxiv_mod_drift BYPASSRLS`]],
|
|
474
|
+
["the owner role given CREATEROLE and CREATEDB", [`ALTER ROLE eloxiv_own_drift CREATEROLE CREATEDB`]],
|
|
475
|
+
["the runtime role allowed to log in", [`ALTER ROLE eloxiv_mod_drift LOGIN`]],
|
|
476
|
+
["the runtime role made a member of the owner role", [`GRANT eloxiv_own_drift TO eloxiv_mod_drift`]],
|
|
477
|
+
["the runtime role made a member of pg_read_all_data", [`GRANT pg_read_all_data TO eloxiv_mod_drift`]],
|
|
478
|
+
["the owner role made a member of the runtime role", [`GRANT eloxiv_mod_drift TO eloxiv_own_drift`]],
|
|
479
|
+
["a kernel table granted to the runtime role", [`GRANT SELECT ON eloxiv.membership TO eloxiv_mod_drift`]],
|
|
480
|
+
[
|
|
481
|
+
"a kernel function granted to the owner role",
|
|
482
|
+
[`GRANT EXECUTE ON FUNCTION eloxiv.lock_directory(text) TO eloxiv_own_drift`],
|
|
483
|
+
],
|
|
484
|
+
["a Better Auth table granted to the owner role", [`GRANT SELECT, UPDATE ON auth."user" TO eloxiv_own_drift`]],
|
|
485
|
+
[
|
|
486
|
+
"TEMPORARY on the database granted to the owner role",
|
|
487
|
+
[
|
|
488
|
+
`DO $$ BEGIN EXECUTE format('GRANT TEMPORARY, CREATE ON DATABASE %I TO eloxiv_own_drift', current_database()); END $$`,
|
|
489
|
+
],
|
|
490
|
+
],
|
|
491
|
+
["a setting on the owner role", [`ALTER ROLE eloxiv_own_drift SET search_path = drift, pg_catalog`]],
|
|
492
|
+
[
|
|
493
|
+
"a setting on the runtime role in this database",
|
|
494
|
+
[
|
|
495
|
+
`DO $$ BEGIN EXECUTE format('ALTER ROLE eloxiv_mod_drift IN DATABASE %I SET work_mem = %L', current_database(), '64kB'); END $$`,
|
|
496
|
+
],
|
|
497
|
+
],
|
|
498
|
+
[
|
|
499
|
+
"the owner role left able to log in, with a password",
|
|
500
|
+
[`ALTER ROLE eloxiv_own_drift LOGIN PASSWORD 'left-behind'`],
|
|
501
|
+
],
|
|
502
|
+
]
|
|
503
|
+
for (const [what, statements] of roleWeakenings) {
|
|
504
|
+
it(`reports ${what} as insecure, and the next setup repairs it`, async () => {
|
|
505
|
+
const db = await subject.database(`role_${roleWeakenings.findIndex(([w]) => w === what)}`)
|
|
506
|
+
expectOk(await db.setup([drift.v1]))
|
|
507
|
+
const hardened = await roleState(db)
|
|
508
|
+
for (const statement of statements) await db.sql(statement)
|
|
509
|
+
const status = await db.status([drift.v1])
|
|
510
|
+
const report = expectOk(await db.setup([drift.v1]))
|
|
511
|
+
expect(await roleState(db)).toEqual(hardened)
|
|
512
|
+
expect(report.repaired).toEqual(["drift"])
|
|
513
|
+
expect(status.insecure).toEqual(["drift"])
|
|
514
|
+
expect((await db.status([drift.v1])).insecure).toEqual([])
|
|
515
|
+
})
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
const refusals: ReadonlyArray<readonly [string, ReadonlyArray<string>]> = [
|
|
519
|
+
[
|
|
520
|
+
"a module function's body replaced",
|
|
521
|
+
[`CREATE OR REPLACE FUNCTION drift.answer() RETURNS integer LANGUAGE sql IMMUTABLE AS $$ SELECT 41 $$`],
|
|
522
|
+
],
|
|
523
|
+
["a module function's settings changed", [`ALTER FUNCTION drift.answer() SET search_path = public`]],
|
|
524
|
+
[
|
|
525
|
+
"an event trigger calling a function owned by a module role",
|
|
526
|
+
[
|
|
527
|
+
`CREATE FUNCTION public.drift_on_ddl() RETURNS event_trigger LANGUAGE plpgsql AS $$ BEGIN END $$`,
|
|
528
|
+
`ALTER FUNCTION public.drift_on_ddl() OWNER TO eloxiv_own_drift`,
|
|
529
|
+
`CREATE EVENT TRIGGER drift_on_ddl ON ddl_command_end EXECUTE FUNCTION public.drift_on_ddl()`,
|
|
530
|
+
],
|
|
531
|
+
],
|
|
532
|
+
[
|
|
533
|
+
"default privileges for the owner role",
|
|
534
|
+
[`ALTER DEFAULT PRIVILEGES FOR ROLE eloxiv_own_drift IN SCHEMA drift GRANT SELECT ON TABLES TO PUBLIC`],
|
|
535
|
+
],
|
|
536
|
+
]
|
|
537
|
+
for (const [what, statements] of refusals) {
|
|
538
|
+
// Staging an event trigger takes a superuser on vanilla PostgreSQL: not on the managed-host profile.
|
|
539
|
+
it.skipIf(managedHostProfile() && what.includes("event trigger"))(
|
|
540
|
+
`reports ${what} as insecure, and setup refuses it`,
|
|
541
|
+
async () => {
|
|
542
|
+
const db = await subject.database(`refuse_${refusals.findIndex(([w]) => w === what)}`)
|
|
543
|
+
expectOk(await db.setup([drift.v1]))
|
|
544
|
+
for (const statement of statements) await db.sql(statement)
|
|
545
|
+
const status = await db.status([drift.v1])
|
|
546
|
+
const outcome = await db.setup([drift.v1])
|
|
547
|
+
expect(outcome).toMatchObject({ ok: false, error: { _tag: "MigrationFailed", module: "drift" } })
|
|
548
|
+
expect(status.insecure).toEqual(["drift"])
|
|
549
|
+
},
|
|
550
|
+
)
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
it("reports a kernel function changed outside setup as insecure, and setup refuses it", async () => {
|
|
554
|
+
const db = await subject.database("kernel_body")
|
|
555
|
+
expectOk(await db.setup([drift.v1]))
|
|
556
|
+
await db.sql(`CREATE OR REPLACE FUNCTION eloxiv_ctx.has_role(p_role text) RETURNS boolean
|
|
557
|
+
LANGUAGE sql STABLE SECURITY DEFINER SET search_path = pg_catalog AS $$ SELECT true $$`)
|
|
558
|
+
expect((await db.status([drift.v1])).insecure).toEqual(["eloxiv"])
|
|
559
|
+
const outcome = await db.setup([drift.v1])
|
|
560
|
+
expect(outcome).toMatchObject({ ok: false, error: { _tag: "MigrationFailed", module: "eloxiv" } })
|
|
561
|
+
expect((outcome as { error: { message: string } }).error.message).toMatch(/eloxiv_ctx\.has_role/)
|
|
562
|
+
// Still reported: setup did not record it as the expected state.
|
|
563
|
+
expect((await db.status([drift.v1])).insecure).toEqual(["eloxiv"])
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
it("records a module's state with its published views, so nothing drifted is repaired", async () => {
|
|
567
|
+
const db = await subject.database("viewed")
|
|
568
|
+
expectOk(await db.setup([stage.viewed]))
|
|
569
|
+
expect((await db.status([stage.viewed])).insecure).toEqual([])
|
|
570
|
+
expect(expectOk(await db.setup([stage.viewed])).repaired).toEqual([])
|
|
571
|
+
expect((await db.status([stage.viewed])).insecure).toEqual([])
|
|
572
|
+
})
|
|
573
|
+
|
|
574
|
+
it("leaves no escalation behind when a migration becomes the superuser and returns to its role", async () => {
|
|
575
|
+
const db = await subject.database("escalate")
|
|
576
|
+
expectOk(await db.setup([drift.v1]))
|
|
577
|
+
const hardened = await roleState(db)
|
|
578
|
+
// 0001_escalate: SET ROLE postgres in a DO block, BYPASSRLS and owner membership for the runtime role.
|
|
579
|
+
const outcome = await db.setup([drift.escalate])
|
|
580
|
+
expect(await roleState(db)).toEqual(hardened)
|
|
581
|
+
// Whether setup repaired it or refused, nothing insecure remains once it succeeded.
|
|
582
|
+
const insecure = outcome.ok ? (await db.status([drift.escalate])).insecure : []
|
|
583
|
+
expect(insecure).toEqual([])
|
|
584
|
+
})
|
|
585
|
+
|
|
586
|
+
it("repairs nothing, and reports nothing repaired, when nothing drifted", async () => {
|
|
587
|
+
const db = await subject.database("secure")
|
|
588
|
+
expectOk(await db.setup([stage.v1]))
|
|
589
|
+
expect(expectOk(await db.setup([stage.v1])).repaired).toEqual([])
|
|
590
|
+
})
|
|
591
|
+
})
|
|
592
|
+
|
|
593
|
+
describe("client/server version skew", () => {
|
|
594
|
+
let kernel: VersionedKernel
|
|
595
|
+
beforeAll(async () => {
|
|
596
|
+
kernel = await subject.serve("2.0.0")
|
|
597
|
+
})
|
|
598
|
+
|
|
599
|
+
it("advertises its release", async () => {
|
|
600
|
+
const response = await fetch(`${kernel.url}${RELEASE_PATH}`)
|
|
601
|
+
expect(response.status).toBe(200)
|
|
602
|
+
const info: unknown = await response.json()
|
|
603
|
+
expect(Schema.is(ReleaseInfo)(info), JSON.stringify(info)).toBe(true)
|
|
604
|
+
expect(info).toMatchObject({ minClientVersion: "2.0.0" })
|
|
605
|
+
expect((info as ReleaseInfo).modules.map((m) => m.name)).toContain("docs")
|
|
606
|
+
})
|
|
607
|
+
|
|
608
|
+
it("refuses a stale client's writes on every surface, while its reads keep working", async () => {
|
|
609
|
+
const title = `stale ${crypto.randomUUID()}`
|
|
610
|
+
const stale = makeClient({
|
|
611
|
+
baseUrl: kernel.url,
|
|
612
|
+
modules: [docs],
|
|
613
|
+
token: () => kernel.member.token,
|
|
614
|
+
clientVersion: "1.9.3",
|
|
615
|
+
})
|
|
616
|
+
try {
|
|
617
|
+
// The typed client (RPC).
|
|
618
|
+
await expect(stale.call("docs.create", { title })).rejects.toMatchObject({
|
|
619
|
+
_tag: "ClientOutdated",
|
|
620
|
+
clientVersion: "1.9.3",
|
|
621
|
+
minClientVersion: "2.0.0",
|
|
622
|
+
})
|
|
623
|
+
} finally {
|
|
624
|
+
await stale.dispose()
|
|
625
|
+
}
|
|
626
|
+
// HTTP.
|
|
627
|
+
const http = await fetch(`${kernel.url}/api/actions/docs.create`, {
|
|
628
|
+
method: "POST",
|
|
629
|
+
headers: {
|
|
630
|
+
authorization: `Bearer ${kernel.member.token}`,
|
|
631
|
+
"content-type": "application/json",
|
|
632
|
+
[CLIENT_VERSION_HEADER]: "1.9.3",
|
|
633
|
+
},
|
|
634
|
+
body: JSON.stringify({ title }),
|
|
635
|
+
})
|
|
636
|
+
expect(http.status).toBe(426)
|
|
637
|
+
expect(await http.json()).toMatchObject({ _tag: "ClientOutdated" })
|
|
638
|
+
// Nothing was written, and each refusal was audited as denied.
|
|
639
|
+
const refused = (await kernel.audit("docs.create")).filter((r) => r.errorTag === "ClientOutdated")
|
|
640
|
+
expect(refused.length).toBe(2)
|
|
641
|
+
expect(refused.every((r) => r.outcome === "denied")).toBe(true)
|
|
642
|
+
// Reads keep working for the same stale client: its sync queries are answered.
|
|
643
|
+
const read = await fetch(`${kernel.url}/zero/query`, {
|
|
644
|
+
method: "POST",
|
|
645
|
+
headers: {
|
|
646
|
+
authorization: `Bearer ${kernel.member.token}`,
|
|
647
|
+
"content-type": "application/json",
|
|
648
|
+
[CLIENT_VERSION_HEADER]: "1.9.3",
|
|
649
|
+
},
|
|
650
|
+
body: JSON.stringify(["transform", [{ id: "q1", name: "docs.all", args: [] }]]),
|
|
651
|
+
})
|
|
652
|
+
expect(read.status).toBe(200)
|
|
653
|
+
const body = (await read.json()) as { queries: Array<Record<string, unknown>> }
|
|
654
|
+
expect(body.queries[0]).not.toHaveProperty("error")
|
|
655
|
+
})
|
|
656
|
+
|
|
657
|
+
it("accepts writes from current, newer and unversioned clients", async () => {
|
|
658
|
+
for (const clientVersion of ["2.0.0", "2.3.1", undefined]) {
|
|
659
|
+
const client = makeClient({
|
|
660
|
+
baseUrl: kernel.url,
|
|
661
|
+
modules: [docs],
|
|
662
|
+
token: () => kernel.member.token,
|
|
663
|
+
...(clientVersion === undefined ? {} : { clientVersion }),
|
|
664
|
+
})
|
|
665
|
+
try {
|
|
666
|
+
const result = await client.call("docs.create", { title: `current ${clientVersion ?? "none"}` })
|
|
667
|
+
expect(result).toMatchObject({ kind: "output" })
|
|
668
|
+
} finally {
|
|
669
|
+
await client.dispose()
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
})
|
|
673
|
+
|
|
674
|
+
it("refuses a client version that is not a version", async () => {
|
|
675
|
+
const client = makeClient({
|
|
676
|
+
baseUrl: kernel.url,
|
|
677
|
+
modules: [docs],
|
|
678
|
+
token: () => kernel.member.token,
|
|
679
|
+
clientVersion: "yesterday",
|
|
680
|
+
})
|
|
681
|
+
try {
|
|
682
|
+
await expect(client.call("docs.create", { title: "garbled" })).rejects.toMatchObject({
|
|
683
|
+
_tag: "ClientOutdated",
|
|
684
|
+
})
|
|
685
|
+
} finally {
|
|
686
|
+
await client.dispose()
|
|
687
|
+
}
|
|
688
|
+
})
|
|
689
|
+
})
|
|
690
|
+
})
|