@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,850 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A protocol fake of the Microsoft identity platform (v2.0 endpoints) and the subset of Microsoft Graph v1.0
|
|
3
|
+
* the `microsoft-graph` connector uses, following Microsoft's documentation:
|
|
4
|
+
*
|
|
5
|
+
* - OAuth 2.0: `/{tenant}/oauth2/v2.0/authorize` and `/token` (authorization code with PKCE S256; refresh
|
|
6
|
+
* tokens rotated on every refresh, the old one refused; AADSTS-style error bodies; the granted scopes listed
|
|
7
|
+
* with the `https://graph.microsoft.com/` prefix, OpenID scopes and `offline_access` not listed)
|
|
8
|
+
* - `/me`; mail folders and messages (list, get, create draft, PATCH, move, DELETE to Deleted Items,
|
|
9
|
+
* `sendMail` answering 202); `mailFolders/{id}/messages/delta`
|
|
10
|
+
* - calendars, `calendarView` and `calendarView/delta` (windowed), events
|
|
11
|
+
* - `users` (list, get, `users/delta`: a changed user carries only its id and changed properties, a deleted one
|
|
12
|
+
* `@removed` with reason `changed`, as it is restorable) and `groups`
|
|
13
|
+
* - OneDrive: `drive/root/children`, `items/{id}`, `/children`, `/content` (302 to a pre-authenticated download
|
|
14
|
+
* URL), `drive/root/delta` (deleted items carry a `deleted` facet)
|
|
15
|
+
* - delta: `@odata.nextLink` with `$skiptoken`, `@odata.deltaLink` with `$deltatoken`, `@removed` entries,
|
|
16
|
+
* `Prefer: odata.maxpagesize`, 410 Gone for an expired token
|
|
17
|
+
* - errors in Graph's shape: 401 `InvalidAuthenticationToken` with `WWW-Authenticate`, 403 `ErrorAccessDenied` /
|
|
18
|
+
* `Authorization_RequestDenied` / `accessDenied`, 404, 429 `TooManyRequests` and 503 with `Retry-After`
|
|
19
|
+
*
|
|
20
|
+
* Proven against a protocol fake, not the real service.
|
|
21
|
+
*/
|
|
22
|
+
import { randomBytes } from "node:crypto";
|
|
23
|
+
import { json, OAuthServer, Router, serve, Throttle } from "./Server.js";
|
|
24
|
+
import { Collection, decodeToken, encodeToken } from "./Store.js";
|
|
25
|
+
const GRAPH = "https://graph.microsoft.com/";
|
|
26
|
+
const stripResource = (scope) => (scope.toLowerCase().startsWith(GRAPH) ? scope.slice(GRAPH.length) : scope);
|
|
27
|
+
const opaque = (prefix) => `${prefix}${randomBytes(12).toString("base64url")}`;
|
|
28
|
+
const now = () => new Date().toISOString().replace(/\.\d{3}Z$/u, "Z");
|
|
29
|
+
const FOLDERS = [
|
|
30
|
+
["inbox", "Inbox"],
|
|
31
|
+
["sentitems", "Sent Items"],
|
|
32
|
+
["drafts", "Drafts"],
|
|
33
|
+
["deleteditems", "Deleted Items"],
|
|
34
|
+
["archive", "Archive"],
|
|
35
|
+
["junkemail", "Junk Email"],
|
|
36
|
+
];
|
|
37
|
+
export const startMicrosoftGraphFake = async (options = {}) => {
|
|
38
|
+
const clientId = options.clientId ?? "graph-fake-client";
|
|
39
|
+
const clientSecret = options.clientSecret ?? "graph-fake-secret";
|
|
40
|
+
const oauth = new OAuthServer({
|
|
41
|
+
clientId,
|
|
42
|
+
clientSecret,
|
|
43
|
+
rotateRefreshTokens: true,
|
|
44
|
+
scopeIn: stripResource,
|
|
45
|
+
scopeOut: (scope) => `${GRAPH}${scope}`,
|
|
46
|
+
unlisted: new Set(["offline_access", "openid", "profile", "email"]),
|
|
47
|
+
tokenError: (error, description) => ({
|
|
48
|
+
error,
|
|
49
|
+
error_description: `AADSTS70000: ${description}`,
|
|
50
|
+
error_codes: [70000],
|
|
51
|
+
timestamp: now(),
|
|
52
|
+
trace_id: crypto.randomUUID(),
|
|
53
|
+
correlation_id: crypto.randomUUID(),
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
const throttle = new Throttle();
|
|
57
|
+
const clock = { seq: 0 };
|
|
58
|
+
/** Delta tokens issued before this log position are expired (410 Gone). */
|
|
59
|
+
let minSeq = 0;
|
|
60
|
+
let apiRequests = 0;
|
|
61
|
+
/** Answers to drop after the request was carried out (the provider acted; the caller hears a 503). */
|
|
62
|
+
let lostResponses = 0;
|
|
63
|
+
/** Whether messages carry a `changeKey` (a provider that gives no version is modelled by turning it off). */
|
|
64
|
+
let messageVersions = true;
|
|
65
|
+
/** Only answers to requests of this method are lost (any, when undefined). */
|
|
66
|
+
let lostMethod;
|
|
67
|
+
const folderIds = new Map(FOLDERS.map(([alias]) => [alias, opaque("AAMkFolder")]));
|
|
68
|
+
const messages = new Collection(clock);
|
|
69
|
+
/** Addresses the account was given send-as permission on (`mail.sendAs`). */
|
|
70
|
+
const sendAs = new Set();
|
|
71
|
+
/** Every message `sendMail` accepted, with when (epoch ms, the fake's clock). */
|
|
72
|
+
const sendLog = [];
|
|
73
|
+
const events = new Collection(clock);
|
|
74
|
+
const users = new Collection(clock);
|
|
75
|
+
const drive = new Collection(clock);
|
|
76
|
+
const calendarId = opaque("AAMkCalendar");
|
|
77
|
+
const rootId = opaque("01ROOT");
|
|
78
|
+
drive.put({
|
|
79
|
+
id: rootId,
|
|
80
|
+
name: "root",
|
|
81
|
+
parentId: null,
|
|
82
|
+
folder: true,
|
|
83
|
+
mimeType: null,
|
|
84
|
+
content: "",
|
|
85
|
+
lastModifiedDateTime: now(),
|
|
86
|
+
});
|
|
87
|
+
const downloads = new Map();
|
|
88
|
+
let base = "";
|
|
89
|
+
const router = new Router();
|
|
90
|
+
// ---- errors in Graph's shape
|
|
91
|
+
const graphError = (status, code, message, headers = {}) => json(status, {
|
|
92
|
+
error: {
|
|
93
|
+
code,
|
|
94
|
+
message,
|
|
95
|
+
innerError: { date: now(), "request-id": crypto.randomUUID(), "client-request-id": crypto.randomUUID() },
|
|
96
|
+
},
|
|
97
|
+
}, headers);
|
|
98
|
+
const unauthorized = () => graphError(401, "InvalidAuthenticationToken", "Access token has expired or is not yet valid.", {
|
|
99
|
+
"www-authenticate": `Bearer realm="", authorization_uri="https://login.microsoftonline.com/common/oauth2/authorize", client_id="00000003-0000-0000-c000-000000000000"`,
|
|
100
|
+
});
|
|
101
|
+
const denied = {
|
|
102
|
+
mail: () => graphError(403, "ErrorAccessDenied", "Access is denied. Check credentials and try again."),
|
|
103
|
+
calendar: () => graphError(403, "ErrorAccessDenied", "Access is denied. Check credentials and try again."),
|
|
104
|
+
directory: () => graphError(403, "Authorization_RequestDenied", "Insufficient privileges to complete the operation."),
|
|
105
|
+
drive: () => graphError(403, "accessDenied", "Access denied"),
|
|
106
|
+
me: () => graphError(403, "Authorization_RequestDenied", "Insufficient privileges to complete the operation."),
|
|
107
|
+
};
|
|
108
|
+
/** Authenticate, throttle, and require one of `anyOf` scopes, before the handler runs. */
|
|
109
|
+
const api = (area, anyOf, handler) => (request) => {
|
|
110
|
+
apiRequests++;
|
|
111
|
+
const injected = throttle.next(request.method);
|
|
112
|
+
if (injected !== undefined) {
|
|
113
|
+
const headers = injected.retryAfter === null ? {} : { "retry-after": injected.retryAfter };
|
|
114
|
+
return injected.status === 429
|
|
115
|
+
? graphError(429, area === "mail" ? "ApplicationThrottled" : "TooManyRequests", "Too many requests", headers)
|
|
116
|
+
: graphError(injected.status, "serviceNotAvailable", "The service is temporarily unavailable.", headers);
|
|
117
|
+
}
|
|
118
|
+
const caller = oauth.authenticate(request);
|
|
119
|
+
if (caller === undefined)
|
|
120
|
+
return unauthorized();
|
|
121
|
+
if (!anyOf.some((scope) => caller.scopes.has(scope)))
|
|
122
|
+
return denied[area]();
|
|
123
|
+
const answer = handler(request, caller.account);
|
|
124
|
+
if (lostResponses > 0 && (lostMethod === undefined || request.method === lostMethod)) {
|
|
125
|
+
lostResponses--;
|
|
126
|
+
return Promise.resolve(answer).then(() => json(503, { error: { code: 503, message: "The answer was lost" } }));
|
|
127
|
+
}
|
|
128
|
+
return answer;
|
|
129
|
+
};
|
|
130
|
+
const maxPage = (request, fallback) => {
|
|
131
|
+
const prefer = String(request.headers["prefer"] ?? "");
|
|
132
|
+
const found = /odata\.maxpagesize=(\d+)/u.exec(prefer);
|
|
133
|
+
const top = request.url.searchParams.get("$top");
|
|
134
|
+
return Math.max(1, Number(found?.[1] ?? top ?? fallback));
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* A Graph delta response over a collection: an initial listing in pages, then the changes since a delta link,
|
|
138
|
+
* each page ending with a nextLink or (last) a deltaLink.
|
|
139
|
+
*/
|
|
140
|
+
const delta = (request, collection, scope, inScope, render, removed, expiredCode,
|
|
141
|
+
/** How a changed (not new) item is represented in a round of changes; default: in full. */
|
|
142
|
+
changed) => {
|
|
143
|
+
const path = `${base}${request.url.pathname}`;
|
|
144
|
+
const keep = new URLSearchParams(request.url.searchParams);
|
|
145
|
+
keep.delete("$skiptoken");
|
|
146
|
+
keep.delete("$deltatoken");
|
|
147
|
+
const link = (param, state) => {
|
|
148
|
+
const params = new URLSearchParams(keep);
|
|
149
|
+
params.set(param, encodeToken(state));
|
|
150
|
+
return `${path}?${params.toString()}`;
|
|
151
|
+
};
|
|
152
|
+
const tokenText = request.url.searchParams.get("$skiptoken") ?? request.url.searchParams.get("$deltatoken");
|
|
153
|
+
let state = { scope, initial: { seq: collection.seq, offset: 0 } };
|
|
154
|
+
if (tokenText !== null) {
|
|
155
|
+
const decoded = decodeToken(tokenText);
|
|
156
|
+
if (decoded === undefined || decoded.scope !== scope) {
|
|
157
|
+
return graphError(400, "badRequest", "The delta token is not valid for this request.");
|
|
158
|
+
}
|
|
159
|
+
const position = decoded.after ?? decoded.initial?.seq ?? decoded.changes?.from ?? 0;
|
|
160
|
+
if (position < minSeq)
|
|
161
|
+
return graphError(410, expiredCode, "The sync state is no longer valid; start a full sync.");
|
|
162
|
+
state =
|
|
163
|
+
decoded.after === undefined
|
|
164
|
+
? decoded
|
|
165
|
+
: { scope, changes: { from: decoded.after, to: collection.seq, offset: 0 } };
|
|
166
|
+
}
|
|
167
|
+
const size = maxPage(request, 100);
|
|
168
|
+
if (state.initial !== undefined) {
|
|
169
|
+
const listing = [...collection.items.values()].filter(inScope).sort((a, b) => (a.id < b.id ? -1 : 1));
|
|
170
|
+
const page = listing.slice(state.initial.offset, state.initial.offset + size);
|
|
171
|
+
const end = state.initial.offset + size >= listing.length;
|
|
172
|
+
return json(200, {
|
|
173
|
+
"@odata.context": `${base}/v1.0/$metadata`,
|
|
174
|
+
value: page.map(render),
|
|
175
|
+
...(end
|
|
176
|
+
? { "@odata.deltaLink": link("$deltatoken", { scope, after: state.initial.seq }) }
|
|
177
|
+
: {
|
|
178
|
+
"@odata.nextLink": link("$skiptoken", {
|
|
179
|
+
scope,
|
|
180
|
+
initial: { seq: state.initial.seq, offset: state.initial.offset + size },
|
|
181
|
+
}),
|
|
182
|
+
}),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const window = state.changes;
|
|
186
|
+
const changes = collection.changesSince(window.from, inScope, window.to);
|
|
187
|
+
const page = changes.slice(window.offset, window.offset + size);
|
|
188
|
+
const end = window.offset + size >= changes.length;
|
|
189
|
+
return json(200, {
|
|
190
|
+
"@odata.context": `${base}/v1.0/$metadata`,
|
|
191
|
+
value: page.map((change) => {
|
|
192
|
+
if (change.item === undefined)
|
|
193
|
+
return removed(change.id);
|
|
194
|
+
// The item as it was when the round began: absent (or out of scope) means it is new to the client.
|
|
195
|
+
const before = collection.log.find((entry) => entry.id === change.id && entry.seq > window.from)?.before;
|
|
196
|
+
return changed === undefined || before === undefined || !inScope(before)
|
|
197
|
+
? render(change.item)
|
|
198
|
+
: changed(change.item, before);
|
|
199
|
+
}),
|
|
200
|
+
...(end
|
|
201
|
+
? { "@odata.deltaLink": link("$deltatoken", { scope, after: window.to }) }
|
|
202
|
+
: { "@odata.nextLink": link("$skiptoken", { scope, changes: { ...window, offset: window.offset + size } }) }),
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
// ---- OAuth (the tenant segment is accepted as given: `common`, `organizations` or a tenant id)
|
|
206
|
+
router.add("GET", "/:tenant/oauth2/v2.0/authorize", oauth.authorize);
|
|
207
|
+
router.add("POST", "/:tenant/oauth2/v2.0/token", oauth.tokenEndpoint);
|
|
208
|
+
router.add("GET", "/v1.0/me", api("me", ["User.Read", "User.ReadBasic.All", "User.Read.All"], (_r, me) => json(200, { id: me.id, displayName: me.name, mail: me.email, userPrincipalName: me.email })));
|
|
209
|
+
// ---- mail
|
|
210
|
+
const MAIL_READ = ["Mail.Read", "Mail.ReadWrite"];
|
|
211
|
+
const MAIL_WRITE = ["Mail.ReadWrite"];
|
|
212
|
+
const folderOf = (idOrAlias) => folderIds.get(idOrAlias.toLowerCase()) ?? idOrAlias;
|
|
213
|
+
const knownFolder = (id) => [...folderIds.values()].includes(id);
|
|
214
|
+
const renderFolder = (alias, name) => {
|
|
215
|
+
const id = folderIds.get(alias);
|
|
216
|
+
const inFolder = [...messages.items.values()].filter((m) => m.parentFolderId === id);
|
|
217
|
+
return {
|
|
218
|
+
id,
|
|
219
|
+
displayName: name,
|
|
220
|
+
parentFolderId: opaque("AAMkRoot"),
|
|
221
|
+
childFolderCount: 0,
|
|
222
|
+
unreadItemCount: inFolder.filter((m) => !m.isRead).length,
|
|
223
|
+
totalItemCount: inFolder.length,
|
|
224
|
+
isHidden: false,
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
const renderMessage = ({ internetMessageHeaders: _h, singleValueExtendedProperties: _p, ...m }) => ({
|
|
228
|
+
"@odata.type": "#microsoft.graph.message",
|
|
229
|
+
"@odata.etag": `W/"${m.lastModifiedDateTime}"`,
|
|
230
|
+
...m,
|
|
231
|
+
// As Graph: changes whenever the message does.
|
|
232
|
+
...(messageVersions ? { changeKey: `CQAAABYAAAA${messages.lastChange(m.id)}` } : {}),
|
|
233
|
+
});
|
|
234
|
+
/**
|
|
235
|
+
* The one `$filter` the fake answers on a folder's messages, as Graph documents it for a string extended
|
|
236
|
+
* property: `singleValueExtendedProperties/Any(ep: ep/id eq '<id>' and ep/value eq '<value>')` (the value
|
|
237
|
+
* compared case-insensitively). Undefined for no filter; null for one it does not know.
|
|
238
|
+
*/
|
|
239
|
+
const extendedFilter = (request) => {
|
|
240
|
+
const filter = request.url.searchParams.get("$filter");
|
|
241
|
+
if (filter === null)
|
|
242
|
+
return undefined;
|
|
243
|
+
const match = /^singleValueExtendedProperties\/Any\(ep: ep\/id eq '([^']*)' and ep\/value eq '([^']*)'\)$/u.exec(filter);
|
|
244
|
+
if (match === null)
|
|
245
|
+
return null;
|
|
246
|
+
const [, id, value] = match;
|
|
247
|
+
return (m) => (m.singleValueExtendedProperties ?? []).some((p) => p.id === id && p.value.toLowerCase() === value.toLowerCase());
|
|
248
|
+
};
|
|
249
|
+
const removedMessage = (id) => ({
|
|
250
|
+
"@odata.type": "#microsoft.graph.message",
|
|
251
|
+
id,
|
|
252
|
+
"@removed": { reason: "deleted" },
|
|
253
|
+
});
|
|
254
|
+
const notFoundMail = () => graphError(404, "ErrorItemNotFound", "The specified object was not found in the store.");
|
|
255
|
+
router.add("GET", "/v1.0/me/mailFolders", api("mail", MAIL_READ, () => json(200, { value: FOLDERS.map(([a, n]) => renderFolder(a, n)) })));
|
|
256
|
+
router.add("GET", "/v1.0/me/mailFolders/:id", api("mail", MAIL_READ, (request) => {
|
|
257
|
+
const id = folderOf(request.params["id"]);
|
|
258
|
+
const found = FOLDERS.find(([alias]) => folderIds.get(alias) === id);
|
|
259
|
+
return found === undefined ? notFoundMail() : json(200, renderFolder(found[0], found[1]));
|
|
260
|
+
}));
|
|
261
|
+
router.add("GET", "/v1.0/me/mailFolders/:id/messages", api("mail", MAIL_READ, (request) => {
|
|
262
|
+
const id = folderOf(request.params["id"]);
|
|
263
|
+
if (!knownFolder(id))
|
|
264
|
+
return notFoundMail();
|
|
265
|
+
const filter = extendedFilter(request);
|
|
266
|
+
if (filter === null)
|
|
267
|
+
return graphError(400, "ErrorInvalidUrlQueryFilter", "The query filter is not supported.");
|
|
268
|
+
const all = [...messages.items.values()]
|
|
269
|
+
.filter((m) => m.parentFolderId === id && (filter === undefined || filter(m)))
|
|
270
|
+
.sort((a, b) => a.receivedDateTime < b.receivedDateTime
|
|
271
|
+
? 1
|
|
272
|
+
: a.receivedDateTime > b.receivedDateTime
|
|
273
|
+
? -1
|
|
274
|
+
: a.id < b.id
|
|
275
|
+
? 1
|
|
276
|
+
: -1);
|
|
277
|
+
const top = Number(request.url.searchParams.get("$top") ?? 10);
|
|
278
|
+
const skip = Number(request.url.searchParams.get("$skip") ?? 0);
|
|
279
|
+
const page = all.slice(skip, skip + top);
|
|
280
|
+
const next = new URLSearchParams(request.url.searchParams);
|
|
281
|
+
next.set("$skip", String(skip + top));
|
|
282
|
+
return json(200, {
|
|
283
|
+
value: page.map(renderMessage),
|
|
284
|
+
...(skip + top < all.length ? { "@odata.nextLink": `${base}${request.url.pathname}?${next.toString()}` } : {}),
|
|
285
|
+
});
|
|
286
|
+
}));
|
|
287
|
+
router.add("GET", "/v1.0/me/mailFolders/:id/messages/delta", api("mail", MAIL_READ, (request) => {
|
|
288
|
+
const id = folderOf(request.params["id"]);
|
|
289
|
+
if (!knownFolder(id))
|
|
290
|
+
return notFoundMail();
|
|
291
|
+
return delta(request, messages, `mail:${id}`, (m) => m.parentFolderId === id, renderMessage, removedMessage, "syncStateNotFound");
|
|
292
|
+
}));
|
|
293
|
+
// Every folder's messages, filtered as a folder's are.
|
|
294
|
+
router.add("GET", "/v1.0/me/messages", api("mail", MAIL_READ, (request) => {
|
|
295
|
+
const filter = extendedFilter(request);
|
|
296
|
+
if (filter === null)
|
|
297
|
+
return graphError(400, "ErrorInvalidUrlQueryFilter", "The query filter is not supported.");
|
|
298
|
+
const all = [...messages.items.values()].filter((m) => filter === undefined || filter(m));
|
|
299
|
+
const top = Number(request.url.searchParams.get("$top") ?? 10);
|
|
300
|
+
return json(200, { value: all.slice(0, top).map(renderMessage) });
|
|
301
|
+
}));
|
|
302
|
+
router.add("GET", "/v1.0/me/messages/:id", api("mail", MAIL_READ, (request) => {
|
|
303
|
+
const found = messages.items.get(request.params["id"]);
|
|
304
|
+
return found === undefined ? notFoundMail() : json(200, renderMessage(found));
|
|
305
|
+
}));
|
|
306
|
+
router.add("PATCH", "/v1.0/me/messages/:id", api("mail", MAIL_WRITE, (request) => {
|
|
307
|
+
const patch = (request.json ?? {});
|
|
308
|
+
const updated = messages.update(request.params["id"], (m) => ({
|
|
309
|
+
...m,
|
|
310
|
+
...(patch.isRead === undefined ? {} : { isRead: patch.isRead }),
|
|
311
|
+
...(patch.subject === undefined ? {} : { subject: patch.subject }),
|
|
312
|
+
lastModifiedDateTime: now(),
|
|
313
|
+
}));
|
|
314
|
+
return updated === undefined ? notFoundMail() : json(200, renderMessage(updated));
|
|
315
|
+
}));
|
|
316
|
+
router.add("POST", "/v1.0/me/messages/:id/move", api("mail", MAIL_WRITE, (request) => {
|
|
317
|
+
const destination = folderOf(request.json?.destinationId ?? "");
|
|
318
|
+
if (!knownFolder(destination))
|
|
319
|
+
return graphError(400, "ErrorInvalidIdMalformed", "Id is malformed.");
|
|
320
|
+
// The connector asks for immutable ids (`Prefer: IdType="ImmutableId"`), so the id survives the move.
|
|
321
|
+
const updated = messages.update(request.params["id"], (m) => ({
|
|
322
|
+
...m,
|
|
323
|
+
parentFolderId: destination,
|
|
324
|
+
lastModifiedDateTime: now(),
|
|
325
|
+
}));
|
|
326
|
+
return updated === undefined ? notFoundMail() : json(201, renderMessage(updated));
|
|
327
|
+
}));
|
|
328
|
+
router.add("DELETE", "/v1.0/me/messages/:id", api("mail", MAIL_WRITE, (request) => {
|
|
329
|
+
const deleted = folderIds.get("deleteditems");
|
|
330
|
+
const found = messages.items.get(request.params["id"]);
|
|
331
|
+
if (found === undefined)
|
|
332
|
+
return notFoundMail();
|
|
333
|
+
if (found.parentFolderId === deleted)
|
|
334
|
+
messages.remove(found.id);
|
|
335
|
+
else
|
|
336
|
+
messages.update(found.id, (m) => ({ ...m, parentFolderId: deleted, lastModifiedDateTime: now() }));
|
|
337
|
+
return { status: 204 };
|
|
338
|
+
}));
|
|
339
|
+
const draftFrom = (body, me, folder, extra = {}) => {
|
|
340
|
+
const content = body["body"] ?? {};
|
|
341
|
+
const text = content.content ?? "";
|
|
342
|
+
const id = opaque("AAMkMsg");
|
|
343
|
+
return {
|
|
344
|
+
id,
|
|
345
|
+
parentFolderId: folderIds.get(folder),
|
|
346
|
+
conversationId: opaque("AAQkConv"),
|
|
347
|
+
subject: typeof body["subject"] === "string" ? body["subject"] : "",
|
|
348
|
+
bodyPreview: text.replaceAll(/<[^>]+>/gu, "").slice(0, 255),
|
|
349
|
+
body: { contentType: content.contentType === "html" ? "html" : "text", content: text },
|
|
350
|
+
from: { emailAddress: { name: me.name, address: me.email } },
|
|
351
|
+
toRecipients: body["toRecipients"] ?? [],
|
|
352
|
+
ccRecipients: body["ccRecipients"] ?? [],
|
|
353
|
+
receivedDateTime: now(),
|
|
354
|
+
lastModifiedDateTime: now(),
|
|
355
|
+
isRead: true,
|
|
356
|
+
isDraft: true,
|
|
357
|
+
hasAttachments: false,
|
|
358
|
+
// Custom headers must be named `x-` (Graph refuses others); extended properties are kept as given.
|
|
359
|
+
...(Array.isArray(body["internetMessageHeaders"])
|
|
360
|
+
? { internetMessageHeaders: body["internetMessageHeaders"] }
|
|
361
|
+
: {}),
|
|
362
|
+
...(Array.isArray(body["singleValueExtendedProperties"])
|
|
363
|
+
? {
|
|
364
|
+
singleValueExtendedProperties: body["singleValueExtendedProperties"],
|
|
365
|
+
}
|
|
366
|
+
: {}),
|
|
367
|
+
...extra,
|
|
368
|
+
};
|
|
369
|
+
};
|
|
370
|
+
router.add("POST", "/v1.0/me/messages", api("mail", MAIL_WRITE, (request, me) => json(201, renderMessage(messages.put(draftFrom((request.json ?? {}), me, "drafts"))))));
|
|
371
|
+
router.add("POST", "/v1.0/me/sendMail", api("mail", ["Mail.Send"], (request, me) => {
|
|
372
|
+
const body = (request.json ?? {}).message;
|
|
373
|
+
if (body === undefined)
|
|
374
|
+
return graphError(400, "ErrorInvalidRequest", "The message is missing.");
|
|
375
|
+
// Only as the account itself, or an address it was given send-as on (`mail.sendAs`).
|
|
376
|
+
const from = body["from"]?.emailAddress?.address;
|
|
377
|
+
if (from !== undefined && from.toLowerCase() !== me.email.toLowerCase() && !sendAs.has(from.toLowerCase())) {
|
|
378
|
+
return graphError(403, "ErrorSendAsDenied", "The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account.");
|
|
379
|
+
}
|
|
380
|
+
const sent = draftFrom(body, me, "sentitems", { isDraft: false });
|
|
381
|
+
messages.put(sent);
|
|
382
|
+
sendLog.push({ subject: sent.subject, at: Date.now() });
|
|
383
|
+
const recipients = [...sent.toRecipients, ...sent.ccRecipients].map((r) => r.emailAddress.address.toLowerCase());
|
|
384
|
+
if (recipients.includes(me.email.toLowerCase())) {
|
|
385
|
+
messages.put({ ...sent, id: opaque("AAMkMsg"), parentFolderId: folderIds.get("inbox"), isRead: false });
|
|
386
|
+
}
|
|
387
|
+
return { status: 202 };
|
|
388
|
+
}));
|
|
389
|
+
// ---- calendar (times are rendered in UTC: the connector sends `Prefer: outlook.timezone="UTC"`)
|
|
390
|
+
const CAL_READ = ["Calendars.Read", "Calendars.ReadWrite"];
|
|
391
|
+
const CAL_WRITE = ["Calendars.ReadWrite"];
|
|
392
|
+
const graphTime = (iso) => ({
|
|
393
|
+
dateTime: iso.replace(/Z$/u, "").replace(/(\.\d+)?$/u, ".0000000"),
|
|
394
|
+
timeZone: "UTC",
|
|
395
|
+
});
|
|
396
|
+
const instant = (time) => Date.parse(`${time.dateTime.replace(/\.\d+$/u, "")}Z`);
|
|
397
|
+
const renderEvent = (e) => {
|
|
398
|
+
const { calendarId: _c, ...rest } = e;
|
|
399
|
+
return {
|
|
400
|
+
"@odata.type": "#microsoft.graph.event",
|
|
401
|
+
...rest,
|
|
402
|
+
bodyPreview: e.body.content.slice(0, 255),
|
|
403
|
+
type: "singleInstance",
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
const removedEvent = (id) => ({
|
|
407
|
+
"@odata.type": "#microsoft.graph.event",
|
|
408
|
+
id,
|
|
409
|
+
"@removed": { reason: "deleted" },
|
|
410
|
+
});
|
|
411
|
+
const notFoundEvent = () => graphError(404, "ErrorItemNotFound", "The specified object was not found in the store.");
|
|
412
|
+
const windowOf = (request) => {
|
|
413
|
+
const start = Date.parse(request.url.searchParams.get("startDateTime") ?? "");
|
|
414
|
+
const end = Date.parse(request.url.searchParams.get("endDateTime") ?? "");
|
|
415
|
+
return Number.isNaN(start) || Number.isNaN(end) ? undefined : { start, end };
|
|
416
|
+
};
|
|
417
|
+
const overlaps = (e, w) => instant(e.start) < w.end && instant(e.end) > w.start;
|
|
418
|
+
router.add("GET", "/v1.0/me/calendars", api("calendar", CAL_READ, (_r, me) => json(200, {
|
|
419
|
+
value: [
|
|
420
|
+
{
|
|
421
|
+
id: calendarId,
|
|
422
|
+
name: "Calendar",
|
|
423
|
+
isDefaultCalendar: true,
|
|
424
|
+
canEdit: true,
|
|
425
|
+
owner: { name: me.name, address: me.email },
|
|
426
|
+
},
|
|
427
|
+
],
|
|
428
|
+
})));
|
|
429
|
+
router.add("GET", "/v1.0/me/calendar", api("calendar", CAL_READ, (_r, me) => json(200, {
|
|
430
|
+
id: calendarId,
|
|
431
|
+
name: "Calendar",
|
|
432
|
+
isDefaultCalendar: true,
|
|
433
|
+
canEdit: true,
|
|
434
|
+
owner: { name: me.name, address: me.email },
|
|
435
|
+
})));
|
|
436
|
+
const calendarView = (request) => {
|
|
437
|
+
const w = windowOf(request);
|
|
438
|
+
if (w === undefined) {
|
|
439
|
+
return graphError(400, "ErrorInvalidParameter", "This request requires a time window specified by the query string parameters StartDateTime and EndDateTime.");
|
|
440
|
+
}
|
|
441
|
+
const all = [...events.items.values()]
|
|
442
|
+
.filter((e) => !e.isCancelled && overlaps(e, w))
|
|
443
|
+
.sort((a, b) => instant(a.start) - instant(b.start));
|
|
444
|
+
const top = Number(request.url.searchParams.get("$top") ?? 10);
|
|
445
|
+
const skip = Number(request.url.searchParams.get("$skip") ?? 0);
|
|
446
|
+
const next = new URLSearchParams(request.url.searchParams);
|
|
447
|
+
next.set("$skip", String(skip + top));
|
|
448
|
+
return json(200, {
|
|
449
|
+
value: all.slice(skip, skip + top).map(renderEvent),
|
|
450
|
+
...(skip + top < all.length ? { "@odata.nextLink": `${base}${request.url.pathname}?${next.toString()}` } : {}),
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
/** Other people's busy time as getSchedule shares it with the account (`calendar.schedule`), by address. */
|
|
454
|
+
const schedules = new Map();
|
|
455
|
+
router.add("POST", "/v1.0/me/calendar/getSchedule", api("calendar", CAL_READ, (request, me) => {
|
|
456
|
+
const body = (request.json ?? {});
|
|
457
|
+
if (body.schedules === undefined || body.startTime === undefined || body.endTime === undefined) {
|
|
458
|
+
return graphError(400, "ErrorInvalidParameter", "schedules, startTime and endTime are required.");
|
|
459
|
+
}
|
|
460
|
+
const w = { start: instant(body.startTime), end: instant(body.endTime) };
|
|
461
|
+
const own = () => [...events.items.values()]
|
|
462
|
+
.filter((e) => !e.isCancelled && overlaps(e, w) && e.responseStatus.response !== "declined")
|
|
463
|
+
.map((e) => ({
|
|
464
|
+
status: ["tentativelyAccepted", "notResponded"].includes(e.responseStatus.response) ? "tentative" : "busy",
|
|
465
|
+
start: e.start,
|
|
466
|
+
end: e.end,
|
|
467
|
+
}));
|
|
468
|
+
return json(200, {
|
|
469
|
+
value: body.schedules.map((scheduleId) => {
|
|
470
|
+
if (scheduleId.toLowerCase() === me.email.toLowerCase())
|
|
471
|
+
return { scheduleId, scheduleItems: own() };
|
|
472
|
+
const known = schedules.get(scheduleId.toLowerCase());
|
|
473
|
+
if (known === undefined) {
|
|
474
|
+
return {
|
|
475
|
+
scheduleId,
|
|
476
|
+
error: { message: "The mailbox was not found.", responseCode: "ErrorMailboxNotFound" },
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
return {
|
|
480
|
+
scheduleId,
|
|
481
|
+
scheduleItems: known
|
|
482
|
+
.filter((b) => Date.parse(b.start) < w.end && Date.parse(b.end) > w.start)
|
|
483
|
+
.map((b) => ({ status: b.status, start: graphTime(b.start), end: graphTime(b.end) })),
|
|
484
|
+
};
|
|
485
|
+
}),
|
|
486
|
+
});
|
|
487
|
+
}));
|
|
488
|
+
router.add("GET", "/v1.0/me/calendarView", api("calendar", CAL_READ, calendarView));
|
|
489
|
+
router.add("GET", "/v1.0/me/calendars/:cid/calendarView", api("calendar", CAL_READ, calendarView));
|
|
490
|
+
const calendarDelta = (request) => {
|
|
491
|
+
const w = windowOf(request);
|
|
492
|
+
if (w === undefined)
|
|
493
|
+
return graphError(400, "ErrorInvalidParameter", "startDateTime and endDateTime are required.");
|
|
494
|
+
return delta(request, events, `calendar:${w.start}:${w.end}`, (e) => !e.isCancelled && overlaps(e, w), renderEvent, removedEvent, "syncStateNotFound");
|
|
495
|
+
};
|
|
496
|
+
router.add("GET", "/v1.0/me/calendarView/delta", api("calendar", CAL_READ, calendarDelta));
|
|
497
|
+
router.add("GET", "/v1.0/me/calendars/:cid/calendarView/delta", api("calendar", CAL_READ, calendarDelta));
|
|
498
|
+
router.add("GET", "/v1.0/me/events/:id", api("calendar", CAL_READ, (request) => {
|
|
499
|
+
const found = events.items.get(request.params["id"]);
|
|
500
|
+
return found === undefined || found.isCancelled ? notFoundEvent() : json(200, renderEvent(found));
|
|
501
|
+
}));
|
|
502
|
+
const createEvent = (request, me) => {
|
|
503
|
+
const body = (request.json ?? {});
|
|
504
|
+
if (body["start"]?.dateTime === undefined || body["end"]?.dateTime === undefined) {
|
|
505
|
+
return graphError(400, "ErrorInvalidRequest", "start and end are required.");
|
|
506
|
+
}
|
|
507
|
+
const event = {
|
|
508
|
+
id: opaque("AAMkEvent"),
|
|
509
|
+
calendarId,
|
|
510
|
+
subject: typeof body["subject"] === "string" ? body["subject"] : "",
|
|
511
|
+
body: {
|
|
512
|
+
contentType: body["body"]?.contentType === "html" ? "html" : "text",
|
|
513
|
+
content: String(body["body"]?.content ?? ""),
|
|
514
|
+
},
|
|
515
|
+
start: graphTime(new Date(instant(body["start"])).toISOString()),
|
|
516
|
+
end: graphTime(new Date(instant(body["end"])).toISOString()),
|
|
517
|
+
isAllDay: body["isAllDay"] === true,
|
|
518
|
+
location: { displayName: String(body["location"]?.displayName ?? "") },
|
|
519
|
+
attendees: (body["attendees"] ?? []).map((a) => ({
|
|
520
|
+
emailAddress: a.emailAddress,
|
|
521
|
+
type: "required",
|
|
522
|
+
status: { response: "none" },
|
|
523
|
+
})),
|
|
524
|
+
organizer: { emailAddress: { name: me.name, address: me.email } },
|
|
525
|
+
responseStatus: { response: "organizer" },
|
|
526
|
+
isCancelled: false,
|
|
527
|
+
seriesMasterId: null,
|
|
528
|
+
lastModifiedDateTime: now(),
|
|
529
|
+
};
|
|
530
|
+
return json(201, renderEvent(events.put(event)));
|
|
531
|
+
};
|
|
532
|
+
router.add("POST", "/v1.0/me/events", api("calendar", CAL_WRITE, createEvent));
|
|
533
|
+
router.add("POST", "/v1.0/me/calendars/:cid/events", api("calendar", CAL_WRITE, createEvent));
|
|
534
|
+
router.add("PATCH", "/v1.0/me/events/:id", api("calendar", CAL_WRITE, (request) => {
|
|
535
|
+
const body = (request.json ?? {});
|
|
536
|
+
const updated = events.update(request.params["id"], (e) => ({
|
|
537
|
+
...e,
|
|
538
|
+
...(body["subject"] === undefined ? {} : { subject: String(body["subject"]) }),
|
|
539
|
+
...(body["body"] === undefined
|
|
540
|
+
? {}
|
|
541
|
+
: { body: { contentType: "text", content: String(body["body"]?.content ?? "") } }),
|
|
542
|
+
...(body["location"] === undefined
|
|
543
|
+
? {}
|
|
544
|
+
: { location: { displayName: String(body["location"]?.displayName ?? "") } }),
|
|
545
|
+
...(body["start"] === undefined ? {} : { start: graphTime(new Date(instant(body["start"])).toISOString()) }),
|
|
546
|
+
...(body["end"] === undefined ? {} : { end: graphTime(new Date(instant(body["end"])).toISOString()) }),
|
|
547
|
+
lastModifiedDateTime: now(),
|
|
548
|
+
}));
|
|
549
|
+
return updated === undefined ? notFoundEvent() : json(200, renderEvent(updated));
|
|
550
|
+
}));
|
|
551
|
+
// Answering an invitation: the owner's own part (`responseStatus`) and their attendee entry, if listed under their
|
|
552
|
+
// address, get the response (202, no body); the organiser cannot answer their own event.
|
|
553
|
+
for (const [verb, response] of [
|
|
554
|
+
["accept", "accepted"],
|
|
555
|
+
["decline", "declined"],
|
|
556
|
+
["tentativelyAccept", "tentativelyAccepted"],
|
|
557
|
+
]) {
|
|
558
|
+
router.add("POST", `/v1.0/me/events/:id/${verb}`, api("calendar", CAL_WRITE, (request, me) => {
|
|
559
|
+
const found = events.items.get(request.params["id"]);
|
|
560
|
+
if (found === undefined || found.isCancelled)
|
|
561
|
+
return notFoundEvent();
|
|
562
|
+
const mine = (a) => a.emailAddress.address.toLowerCase() === me.email.toLowerCase();
|
|
563
|
+
if (found.responseStatus.response === "organizer") {
|
|
564
|
+
return graphError(400, "ErrorInvalidRequest", "Your request can't be completed. You can't respond to this meeting because you're not an attendee.");
|
|
565
|
+
}
|
|
566
|
+
events.update(found.id, (e) => ({
|
|
567
|
+
...e,
|
|
568
|
+
attendees: e.attendees.map((a) => (mine(a) ? { ...a, status: { response } } : a)),
|
|
569
|
+
responseStatus: { response },
|
|
570
|
+
lastModifiedDateTime: now(),
|
|
571
|
+
}));
|
|
572
|
+
return { status: 202 };
|
|
573
|
+
}));
|
|
574
|
+
}
|
|
575
|
+
router.add("DELETE", "/v1.0/me/events/:id", api("calendar", CAL_WRITE, (request) => events.remove(request.params["id"]) === undefined ? notFoundEvent() : { status: 204 }));
|
|
576
|
+
// ---- directory
|
|
577
|
+
const DIR_READ = ["User.Read.All", "User.ReadBasic.All", "Directory.Read.All"];
|
|
578
|
+
const renderUser = (u) => ({ "@odata.type": "#microsoft.graph.user", ...u });
|
|
579
|
+
const notFoundUser = () => graphError(404, "Request_ResourceNotFound", "Resource does not exist or one of its queried reference-property objects are not present.");
|
|
580
|
+
const groups = [
|
|
581
|
+
{ id: opaque("grp-"), displayName: "Everyone", mail: "everyone@contoso.example", description: "All staff" },
|
|
582
|
+
];
|
|
583
|
+
router.add("GET", "/v1.0/users", api("directory", DIR_READ, (request) => {
|
|
584
|
+
const all = [...users.items.values()].sort((a, b) => (a.id < b.id ? -1 : 1));
|
|
585
|
+
const top = Number(request.url.searchParams.get("$top") ?? 100);
|
|
586
|
+
const skip = Number(decodeToken(request.url.searchParams.get("$skiptoken") ?? "") ?? 0);
|
|
587
|
+
const next = new URLSearchParams(request.url.searchParams);
|
|
588
|
+
next.set("$skiptoken", encodeToken(skip + top));
|
|
589
|
+
return json(200, {
|
|
590
|
+
value: all.slice(skip, skip + top).map(renderUser),
|
|
591
|
+
...(skip + top < all.length ? { "@odata.nextLink": `${base}/v1.0/users?${next.toString()}` } : {}),
|
|
592
|
+
});
|
|
593
|
+
}));
|
|
594
|
+
router.add("GET", "/v1.0/users/delta", api("directory", ["User.Read.All", "Directory.Read.All"], (request) => delta(request, users, "users", () => true, renderUser,
|
|
595
|
+
// A deleted user goes to deleted items first, restorable: `@removed` reason `changed`.
|
|
596
|
+
(id) => ({ "@odata.type": "#microsoft.graph.user", id, "@removed": { reason: "changed" } }), "resyncRequired",
|
|
597
|
+
// "Updated instances are represented by their id with at least the updated properties": only those.
|
|
598
|
+
(user, before) => ({
|
|
599
|
+
"@odata.type": "#microsoft.graph.user",
|
|
600
|
+
id: user.id,
|
|
601
|
+
...Object.fromEntries(Object.entries(user).filter(([key, value]) => key !== "id" && before[key] !== value)),
|
|
602
|
+
}))));
|
|
603
|
+
router.add("GET", "/v1.0/users/:id", api("directory", DIR_READ, (request) => {
|
|
604
|
+
const found = users.items.get(request.params["id"]);
|
|
605
|
+
return found === undefined ? notFoundUser() : json(200, renderUser(found));
|
|
606
|
+
}));
|
|
607
|
+
router.add("GET", "/v1.0/groups", api("directory", ["GroupMember.Read.All", "Group.Read.All", "Directory.Read.All"], () => json(200, { value: groups })));
|
|
608
|
+
// ---- OneDrive
|
|
609
|
+
const DRIVE_READ = ["Files.Read", "Files.Read.All", "Files.ReadWrite", "Files.ReadWrite.All"];
|
|
610
|
+
const renderItem = (item) => ({
|
|
611
|
+
id: item.id,
|
|
612
|
+
name: item.name,
|
|
613
|
+
size: item.folder ? 0 : Buffer.byteLength(item.content),
|
|
614
|
+
lastModifiedDateTime: item.lastModifiedDateTime,
|
|
615
|
+
createdDateTime: item.lastModifiedDateTime,
|
|
616
|
+
eTag: `"{${item.id}},${item.lastModifiedDateTime}"`,
|
|
617
|
+
webUrl: `https://contoso-my.sharepoint.example/personal/me/Documents/${encodeURIComponent(item.name)}`,
|
|
618
|
+
parentReference: item.parentId === null ? { driveId: "b!drive" } : { driveId: "b!drive", id: item.parentId },
|
|
619
|
+
...(item.parentId === null ? { root: {} } : {}),
|
|
620
|
+
...(item.folder
|
|
621
|
+
? { folder: { childCount: [...drive.items.values()].filter((c) => c.parentId === item.id).length } }
|
|
622
|
+
: { file: { mimeType: item.mimeType } }),
|
|
623
|
+
});
|
|
624
|
+
const notFoundItem = () => graphError(404, "itemNotFound", "The resource could not be found.");
|
|
625
|
+
const children = (parent, request) => {
|
|
626
|
+
const all = [...drive.items.values()]
|
|
627
|
+
.filter((i) => i.parentId === parent)
|
|
628
|
+
.sort((a, b) => (a.name < b.name ? -1 : 1));
|
|
629
|
+
const top = Number(request.url.searchParams.get("$top") ?? 200);
|
|
630
|
+
const skip = Number(decodeToken(request.url.searchParams.get("$skiptoken") ?? "") ?? 0);
|
|
631
|
+
const next = new URLSearchParams(request.url.searchParams);
|
|
632
|
+
next.set("$skiptoken", encodeToken(skip + top));
|
|
633
|
+
return json(200, {
|
|
634
|
+
value: all.slice(skip, skip + top).map(renderItem),
|
|
635
|
+
...(skip + top < all.length ? { "@odata.nextLink": `${base}${request.url.pathname}?${next.toString()}` } : {}),
|
|
636
|
+
});
|
|
637
|
+
};
|
|
638
|
+
router.add("GET", "/v1.0/me/drive/root/children", api("drive", DRIVE_READ, (request) => children(rootId, request)));
|
|
639
|
+
router.add("GET", "/v1.0/me/drive/items/:id/children", api("drive", DRIVE_READ, (request) => drive.items.has(request.params["id"]) ? children(request.params["id"], request) : notFoundItem()));
|
|
640
|
+
router.add("GET", "/v1.0/me/drive/root/delta", api("drive", DRIVE_READ, (request) => delta(request, drive, "drive", () => true, renderItem, (id) => ({ id, deleted: { state: "deleted" }, parentReference: { driveId: "b!drive" } }), "resyncRequired")));
|
|
641
|
+
router.add("GET", "/v1.0/me/drive/items/:id", api("drive", DRIVE_READ, (request) => {
|
|
642
|
+
const found = drive.items.get(request.params["id"]);
|
|
643
|
+
return found === undefined ? notFoundItem() : json(200, renderItem(found));
|
|
644
|
+
}));
|
|
645
|
+
router.add("GET", "/v1.0/me/drive/items/:id/content", api("drive", DRIVE_READ, (request) => {
|
|
646
|
+
const found = drive.items.get(request.params["id"]);
|
|
647
|
+
if (found === undefined || found.folder)
|
|
648
|
+
return notFoundItem();
|
|
649
|
+
const ticket = opaque("dl");
|
|
650
|
+
downloads.set(ticket, found.id);
|
|
651
|
+
// A pre-authenticated, short-lived download URL (no Authorization needed), as Graph answers.
|
|
652
|
+
return { status: 302, headers: { location: `${base}/download/${ticket}` } };
|
|
653
|
+
}));
|
|
654
|
+
router.add("GET", "/download/:ticket", (request) => {
|
|
655
|
+
const id = downloads.get(request.params["ticket"]);
|
|
656
|
+
const item = id === undefined ? undefined : drive.items.get(id);
|
|
657
|
+
if (item === undefined)
|
|
658
|
+
return { status: 404 };
|
|
659
|
+
return { status: 200, headers: { "content-type": item.mimeType ?? "application/octet-stream" }, body: item.content };
|
|
660
|
+
});
|
|
661
|
+
const running = await serve(router);
|
|
662
|
+
base = running.url;
|
|
663
|
+
// ------------------------------------------------------------------------------------------- test controls
|
|
664
|
+
const self = { id: crypto.randomUUID(), email: "adele@contoso.example", name: "Adele Vance" };
|
|
665
|
+
oauth.addAccount(self);
|
|
666
|
+
const tenant = options.tenant ?? "common";
|
|
667
|
+
return {
|
|
668
|
+
url: base,
|
|
669
|
+
oauth,
|
|
670
|
+
clientId,
|
|
671
|
+
clientSecret,
|
|
672
|
+
self,
|
|
673
|
+
/** The connector's settings for this fake. */
|
|
674
|
+
settings: {
|
|
675
|
+
clientId,
|
|
676
|
+
clientSecret,
|
|
677
|
+
tenant,
|
|
678
|
+
authorityUrl: base,
|
|
679
|
+
graphUrl: base,
|
|
680
|
+
},
|
|
681
|
+
apiRequests: () => apiRequests,
|
|
682
|
+
throttle,
|
|
683
|
+
maxInflight: running.maxInflight,
|
|
684
|
+
resetInflight: running.resetInflight,
|
|
685
|
+
expireCursors: () => {
|
|
686
|
+
minSeq = clock.seq + 1;
|
|
687
|
+
},
|
|
688
|
+
folderId: (alias) => folderIds.get(alias),
|
|
689
|
+
mail: {
|
|
690
|
+
seed: (input) => messages.put({
|
|
691
|
+
...draftFrom({
|
|
692
|
+
subject: input.subject,
|
|
693
|
+
body: { contentType: "text", content: `Body of ${input.subject}` },
|
|
694
|
+
toRecipients: [{ emailAddress: { name: self.name, address: self.email } }],
|
|
695
|
+
}, { email: "sender@fabrikam.example", name: "Sender" }, input.folder ?? "inbox"),
|
|
696
|
+
isDraft: false,
|
|
697
|
+
isRead: input.isRead ?? false,
|
|
698
|
+
}).id,
|
|
699
|
+
update: (id, change) => void messages.update(id, (m) => ({ ...m, ...change, lastModifiedDateTime: now() })),
|
|
700
|
+
/** Delete a message for good (gone from every folder: delta reports it removed, a read is 404). */
|
|
701
|
+
purge: (id) => void messages.remove(id),
|
|
702
|
+
/** Whether messages carry a `changeKey` (off: a provider that gives no version). */
|
|
703
|
+
versions: (on) => void (messageVersions = on),
|
|
704
|
+
remove: (id) => void messages.update(id, (m) => ({
|
|
705
|
+
...m,
|
|
706
|
+
parentFolderId: folderIds.get("deleteditems"),
|
|
707
|
+
lastModifiedDateTime: now(),
|
|
708
|
+
})),
|
|
709
|
+
/** Give the account Exchange's send-as permission on `address`. */
|
|
710
|
+
sendAs: (address) => void sendAs.add(address.toLowerCase()),
|
|
711
|
+
/** Every message sent (`sendMail`), with when the fake accepted it (epoch ms), oldest first. */
|
|
712
|
+
sends: () => [...sendLog],
|
|
713
|
+
inFolder: (alias) => [...messages.items.values()].filter((m) => m.parentFolderId === folderIds.get(alias)),
|
|
714
|
+
get: (id) => messages.items.get(id),
|
|
715
|
+
},
|
|
716
|
+
calendar: {
|
|
717
|
+
id: calendarId,
|
|
718
|
+
/** Someone else's busy time, as getSchedule shares it with the account (ISO instants; status busy, tentative, oof). */
|
|
719
|
+
schedule: (address, blocks) => void schedules.set(address.toLowerCase(), blocks.map((b) => ({ start: b.start, end: b.end, status: b.status ?? "busy" }))),
|
|
720
|
+
/**
|
|
721
|
+
* An event in the calendar; with `organizer` and `attendees`, an invitation from someone else. The owner's own
|
|
722
|
+
* answer (`responseStatus`) is `selfResponse`, else their attendee entry's (by their address), else `none`.
|
|
723
|
+
*/
|
|
724
|
+
seed: (input) => events.put({
|
|
725
|
+
id: opaque("AAMkEvent"),
|
|
726
|
+
calendarId,
|
|
727
|
+
subject: input.subject,
|
|
728
|
+
body: { contentType: "text", content: "" },
|
|
729
|
+
start: graphTime(input.start),
|
|
730
|
+
end: graphTime(input.end),
|
|
731
|
+
isAllDay: false,
|
|
732
|
+
location: { displayName: "" },
|
|
733
|
+
attendees: (input.attendees ?? []).map((a) => ({
|
|
734
|
+
emailAddress: { name: a.name, address: a.address },
|
|
735
|
+
status: { response: a.response ?? "none" },
|
|
736
|
+
})),
|
|
737
|
+
organizer: { emailAddress: input.organizer ?? { name: self.name, address: self.email } },
|
|
738
|
+
responseStatus: {
|
|
739
|
+
response: input.organizer === undefined || input.organizer.address.toLowerCase() === self.email.toLowerCase()
|
|
740
|
+
? "organizer"
|
|
741
|
+
: (input.selfResponse ??
|
|
742
|
+
input.attendees?.find((a) => a.address.toLowerCase() === self.email.toLowerCase())?.response ??
|
|
743
|
+
"none"),
|
|
744
|
+
},
|
|
745
|
+
isCancelled: false,
|
|
746
|
+
seriesMasterId: null,
|
|
747
|
+
lastModifiedDateTime: now(),
|
|
748
|
+
}).id,
|
|
749
|
+
update: (id, change) => void events.update(id, (e) => ({ ...e, ...change, lastModifiedDateTime: now() })),
|
|
750
|
+
remove: (id) => void events.remove(id),
|
|
751
|
+
get: (id) => events.items.get(id),
|
|
752
|
+
},
|
|
753
|
+
directory: {
|
|
754
|
+
seed: (input) => users.put({
|
|
755
|
+
id: crypto.randomUUID(),
|
|
756
|
+
displayName: input.displayName,
|
|
757
|
+
givenName: input.displayName.split(" ")[0] ?? null,
|
|
758
|
+
surname: input.displayName.split(" ")[1] ?? null,
|
|
759
|
+
mail: input.mail,
|
|
760
|
+
userPrincipalName: input.mail,
|
|
761
|
+
jobTitle: input.jobTitle ?? null,
|
|
762
|
+
department: null,
|
|
763
|
+
accountEnabled: true,
|
|
764
|
+
}).id,
|
|
765
|
+
update: (id, change) => void users.update(id, (u) => ({ ...u, ...change })),
|
|
766
|
+
remove: (id) => void users.remove(id),
|
|
767
|
+
get: (id) => users.items.get(id),
|
|
768
|
+
},
|
|
769
|
+
drive: {
|
|
770
|
+
rootId,
|
|
771
|
+
seed: (input) => drive.put({
|
|
772
|
+
id: opaque("01ITEM"),
|
|
773
|
+
name: input.name,
|
|
774
|
+
parentId: input.parentId ?? rootId,
|
|
775
|
+
folder: input.folder ?? false,
|
|
776
|
+
mimeType: input.folder === true ? null : "text/plain",
|
|
777
|
+
content: input.content ?? "",
|
|
778
|
+
lastModifiedDateTime: now(),
|
|
779
|
+
}).id,
|
|
780
|
+
update: (id, change) => void drive.update(id, (i) => ({ ...i, ...change, lastModifiedDateTime: now() })),
|
|
781
|
+
remove: (id) => void drive.remove(id),
|
|
782
|
+
get: (id) => drive.items.get(id),
|
|
783
|
+
},
|
|
784
|
+
/**
|
|
785
|
+
* The next `times` API requests (of `method` only, when given) are carried out, then answered 503 as if the
|
|
786
|
+
* answer were lost on the way.
|
|
787
|
+
*/
|
|
788
|
+
loseResponses: (times, method) => {
|
|
789
|
+
lostResponses = times;
|
|
790
|
+
lostMethod = method;
|
|
791
|
+
},
|
|
792
|
+
close: running.close,
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
/** The fake as a capability kit's provider: settings, the account, its controls and item seeds. */
|
|
796
|
+
export const graphProvider = (fake) => {
|
|
797
|
+
const email = fake.self.email;
|
|
798
|
+
const soon = (hours) => new Date(Date.now() + hours * 3_600_000).toISOString();
|
|
799
|
+
return {
|
|
800
|
+
settings: fake.settings,
|
|
801
|
+
self: fake.self,
|
|
802
|
+
controls: {
|
|
803
|
+
expireAccessTokens: async () => fake.oauth.expireAccessTokens(email),
|
|
804
|
+
revokeRefreshTokens: async () => fake.oauth.revokeRefreshTokens(email),
|
|
805
|
+
revokeScopes: async (scopes) => fake.oauth.revokeScopes(email, scopes),
|
|
806
|
+
restoreScopes: async () => fake.oauth.restoreScopes(email),
|
|
807
|
+
throttle: async (options) => fake.throttle.set(options),
|
|
808
|
+
throttleAfterWrite: async (options) => fake.throttle.afterWrite(options),
|
|
809
|
+
apiRequests: () => fake.apiRequests(),
|
|
810
|
+
refreshes: () => fake.oauth.stats.refreshes,
|
|
811
|
+
expireCursors: async () => {
|
|
812
|
+
fake.expireCursors();
|
|
813
|
+
return true;
|
|
814
|
+
},
|
|
815
|
+
},
|
|
816
|
+
seeds: {
|
|
817
|
+
mail: {
|
|
818
|
+
create: async (label) => fake.mail.seed({ subject: label }),
|
|
819
|
+
update: async (id) => fake.mail.update(id, { isRead: true }),
|
|
820
|
+
remove: async (id) => fake.mail.remove(id),
|
|
821
|
+
},
|
|
822
|
+
calendar: {
|
|
823
|
+
create: async (label) => fake.calendar.seed({ subject: label, start: soon(24), end: soon(25) }),
|
|
824
|
+
update: async (id) => fake.calendar.update(id, { subject: "changed" }),
|
|
825
|
+
remove: async (id) => fake.calendar.remove(id),
|
|
826
|
+
invite: async (label) => fake.calendar.seed({
|
|
827
|
+
subject: label,
|
|
828
|
+
start: soon(48),
|
|
829
|
+
end: soon(49),
|
|
830
|
+
organizer: { name: "Megan Bowen", address: "megan@contoso.example" },
|
|
831
|
+
attendees: [{ name: fake.self.name, address: email }],
|
|
832
|
+
}),
|
|
833
|
+
},
|
|
834
|
+
directory: {
|
|
835
|
+
create: async (label) => fake.directory.seed({
|
|
836
|
+
displayName: `Person ${label}`,
|
|
837
|
+
mail: `${label}-${crypto.randomUUID().slice(0, 8)}@contoso.example`,
|
|
838
|
+
}),
|
|
839
|
+
update: async (id) => fake.directory.update(id, { jobTitle: "Changed" }),
|
|
840
|
+
remove: async (id) => fake.directory.remove(id),
|
|
841
|
+
},
|
|
842
|
+
documents: {
|
|
843
|
+
create: async (label) => fake.drive.seed({ name: `${label}.txt`, content: `content of ${label}` }),
|
|
844
|
+
update: async (id) => fake.drive.update(id, { content: "changed" }),
|
|
845
|
+
remove: async (id) => fake.drive.remove(id),
|
|
846
|
+
},
|
|
847
|
+
},
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
//# sourceMappingURL=MicrosoftGraphFake.js.map
|