@eloxiv/testing 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1006) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Admin.d.ts +20 -0
  4. package/dist/Admin.d.ts.map +1 -0
  5. package/dist/Admin.js +61 -0
  6. package/dist/Admin.js.map +1 -0
  7. package/dist/Agent.d.ts +97 -0
  8. package/dist/Agent.d.ts.map +1 -0
  9. package/dist/Agent.js +210 -0
  10. package/dist/Agent.js.map +1 -0
  11. package/dist/AgentSurface.d.ts +20 -0
  12. package/dist/AgentSurface.d.ts.map +1 -0
  13. package/dist/AgentSurface.js +36 -0
  14. package/dist/AgentSurface.js.map +1 -0
  15. package/dist/Embedder.d.ts +21 -0
  16. package/dist/Embedder.d.ts.map +1 -0
  17. package/dist/Embedder.js +54 -0
  18. package/dist/Embedder.js.map +1 -0
  19. package/dist/EvalMain.d.ts +2 -0
  20. package/dist/EvalMain.d.ts.map +1 -0
  21. package/dist/EvalMain.js +80 -0
  22. package/dist/EvalMain.js.map +1 -0
  23. package/dist/Evals.d.ts +95 -0
  24. package/dist/Evals.d.ts.map +1 -0
  25. package/dist/Evals.js +389 -0
  26. package/dist/Evals.js.map +1 -0
  27. package/dist/Kernel.d.ts +88 -0
  28. package/dist/Kernel.d.ts.map +1 -0
  29. package/dist/Kernel.js +108 -0
  30. package/dist/Kernel.js.map +1 -0
  31. package/dist/Launch.d.ts +86 -0
  32. package/dist/Launch.d.ts.map +1 -0
  33. package/dist/Launch.js +370 -0
  34. package/dist/Launch.js.map +1 -0
  35. package/dist/Locks.d.ts +39 -0
  36. package/dist/Locks.d.ts.map +1 -0
  37. package/dist/Locks.js +94 -0
  38. package/dist/Locks.js.map +1 -0
  39. package/dist/Routes.d.ts +19 -0
  40. package/dist/Routes.d.ts.map +1 -0
  41. package/dist/Routes.js +38 -0
  42. package/dist/Routes.js.map +1 -0
  43. package/dist/ScriptedChatModel.d.ts +51 -0
  44. package/dist/ScriptedChatModel.d.ts.map +1 -0
  45. package/dist/ScriptedChatModel.js +135 -0
  46. package/dist/ScriptedChatModel.js.map +1 -0
  47. package/dist/SmtpSink.d.ts +36 -0
  48. package/dist/SmtpSink.d.ts.map +1 -0
  49. package/dist/SmtpSink.js +185 -0
  50. package/dist/SmtpSink.js.map +1 -0
  51. package/dist/System.d.ts +271 -0
  52. package/dist/System.d.ts.map +1 -0
  53. package/dist/System.js +908 -0
  54. package/dist/System.js.map +1 -0
  55. package/dist/TcpProxy.d.ts +17 -0
  56. package/dist/TcpProxy.d.ts.map +1 -0
  57. package/dist/TcpProxy.js +100 -0
  58. package/dist/TcpProxy.js.map +1 -0
  59. package/dist/auth/TrustedProxyAuth.d.ts +28 -0
  60. package/dist/auth/TrustedProxyAuth.d.ts.map +1 -0
  61. package/dist/auth/TrustedProxyAuth.js +128 -0
  62. package/dist/auth/TrustedProxyAuth.js.map +1 -0
  63. package/dist/conformance/ActionConsent.d.ts +3 -0
  64. package/dist/conformance/ActionConsent.d.ts.map +1 -0
  65. package/dist/conformance/ActionConsent.js +347 -0
  66. package/dist/conformance/ActionConsent.js.map +1 -0
  67. package/dist/conformance/ActionRegistry.d.ts +64 -0
  68. package/dist/conformance/ActionRegistry.d.ts.map +1 -0
  69. package/dist/conformance/ActionRegistry.js +136 -0
  70. package/dist/conformance/ActionRegistry.js.map +1 -0
  71. package/dist/conformance/Actor.d.ts +43 -0
  72. package/dist/conformance/Actor.d.ts.map +1 -0
  73. package/dist/conformance/Actor.js +171 -0
  74. package/dist/conformance/Actor.js.map +1 -0
  75. package/dist/conformance/AgentReference.d.ts +30 -0
  76. package/dist/conformance/AgentReference.d.ts.map +1 -0
  77. package/dist/conformance/AgentReference.js +137 -0
  78. package/dist/conformance/AgentReference.js.map +1 -0
  79. package/dist/conformance/AgentResources.d.ts +3 -0
  80. package/dist/conformance/AgentResources.d.ts.map +1 -0
  81. package/dist/conformance/AgentResources.js +454 -0
  82. package/dist/conformance/AgentResources.js.map +1 -0
  83. package/dist/conformance/AgentRuntime.d.ts +3 -0
  84. package/dist/conformance/AgentRuntime.d.ts.map +1 -0
  85. package/dist/conformance/AgentRuntime.js +302 -0
  86. package/dist/conformance/AgentRuntime.js.map +1 -0
  87. package/dist/conformance/AgentSubject.d.ts +87 -0
  88. package/dist/conformance/AgentSubject.d.ts.map +1 -0
  89. package/dist/conformance/AgentSubject.js +18 -0
  90. package/dist/conformance/AgentSubject.js.map +1 -0
  91. package/dist/conformance/Approvals.d.ts +3 -0
  92. package/dist/conformance/Approvals.d.ts.map +1 -0
  93. package/dist/conformance/Approvals.js +258 -0
  94. package/dist/conformance/Approvals.js.map +1 -0
  95. package/dist/conformance/Audit.d.ts +3 -0
  96. package/dist/conformance/Audit.d.ts.map +1 -0
  97. package/dist/conformance/Audit.js +221 -0
  98. package/dist/conformance/Audit.js.map +1 -0
  99. package/dist/conformance/CalendarProvider.d.ts +4 -0
  100. package/dist/conformance/CalendarProvider.d.ts.map +1 -0
  101. package/dist/conformance/CalendarProvider.js +108 -0
  102. package/dist/conformance/CalendarProvider.js.map +1 -0
  103. package/dist/conformance/CapabilityKit.d.ts +191 -0
  104. package/dist/conformance/CapabilityKit.d.ts.map +1 -0
  105. package/dist/conformance/CapabilityKit.js +375 -0
  106. package/dist/conformance/CapabilityKit.js.map +1 -0
  107. package/dist/conformance/ClientSDK.d.ts +78 -0
  108. package/dist/conformance/ClientSDK.d.ts.map +1 -0
  109. package/dist/conformance/ClientSDK.js +163 -0
  110. package/dist/conformance/ClientSDK.js.map +1 -0
  111. package/dist/conformance/CollabDocument.d.ts +3 -0
  112. package/dist/conformance/CollabDocument.d.ts.map +1 -0
  113. package/dist/conformance/CollabDocument.js +934 -0
  114. package/dist/conformance/CollabDocument.js.map +1 -0
  115. package/dist/conformance/CollabReference.d.ts +8 -0
  116. package/dist/conformance/CollabReference.d.ts.map +1 -0
  117. package/dist/conformance/CollabReference.js +138 -0
  118. package/dist/conformance/CollabReference.js.map +1 -0
  119. package/dist/conformance/CollabSubject.d.ts +68 -0
  120. package/dist/conformance/CollabSubject.d.ts.map +1 -0
  121. package/dist/conformance/CollabSubject.js +2 -0
  122. package/dist/conformance/CollabSubject.js.map +1 -0
  123. package/dist/conformance/Command.d.ts +3 -0
  124. package/dist/conformance/Command.d.ts.map +1 -0
  125. package/dist/conformance/Command.js +73 -0
  126. package/dist/conformance/Command.js.map +1 -0
  127. package/dist/conformance/Connections.d.ts +4 -0
  128. package/dist/conformance/Connections.d.ts.map +1 -0
  129. package/dist/conformance/Connections.js +308 -0
  130. package/dist/conformance/Connections.js.map +1 -0
  131. package/dist/conformance/ConnectionsReference.d.ts +56 -0
  132. package/dist/conformance/ConnectionsReference.d.ts.map +1 -0
  133. package/dist/conformance/ConnectionsReference.js +74 -0
  134. package/dist/conformance/ConnectionsReference.js.map +1 -0
  135. package/dist/conformance/ConnectorReference.d.ts +86 -0
  136. package/dist/conformance/ConnectorReference.d.ts.map +1 -0
  137. package/dist/conformance/ConnectorReference.js +185 -0
  138. package/dist/conformance/ConnectorReference.js.map +1 -0
  139. package/dist/conformance/ContextAccounting.d.ts +8 -0
  140. package/dist/conformance/ContextAccounting.d.ts.map +1 -0
  141. package/dist/conformance/ContextAccounting.js +125 -0
  142. package/dist/conformance/ContextAccounting.js.map +1 -0
  143. package/dist/conformance/Daemon.d.ts +150 -0
  144. package/dist/conformance/Daemon.d.ts.map +1 -0
  145. package/dist/conformance/Daemon.js +718 -0
  146. package/dist/conformance/Daemon.js.map +1 -0
  147. package/dist/conformance/DaemonReference.d.ts +15 -0
  148. package/dist/conformance/DaemonReference.d.ts.map +1 -0
  149. package/dist/conformance/DaemonReference.js +163 -0
  150. package/dist/conformance/DaemonReference.js.map +1 -0
  151. package/dist/conformance/DbTx.d.ts +17 -0
  152. package/dist/conformance/DbTx.d.ts.map +1 -0
  153. package/dist/conformance/DbTx.js +184 -0
  154. package/dist/conformance/DbTx.js.map +1 -0
  155. package/dist/conformance/DecisionTokens.d.ts +3 -0
  156. package/dist/conformance/DecisionTokens.d.ts.map +1 -0
  157. package/dist/conformance/DecisionTokens.js +551 -0
  158. package/dist/conformance/DecisionTokens.js.map +1 -0
  159. package/dist/conformance/Delegation.d.ts +3 -0
  160. package/dist/conformance/Delegation.d.ts.map +1 -0
  161. package/dist/conformance/Delegation.js +149 -0
  162. package/dist/conformance/Delegation.js.map +1 -0
  163. package/dist/conformance/DeskReference.d.ts +21 -0
  164. package/dist/conformance/DeskReference.d.ts.map +1 -0
  165. package/dist/conformance/DeskReference.js +47 -0
  166. package/dist/conformance/DeskReference.js.map +1 -0
  167. package/dist/conformance/DeviceControl.d.ts +3 -0
  168. package/dist/conformance/DeviceControl.d.ts.map +1 -0
  169. package/dist/conformance/DeviceControl.js +579 -0
  170. package/dist/conformance/DeviceControl.js.map +1 -0
  171. package/dist/conformance/Directory.d.ts +36 -0
  172. package/dist/conformance/Directory.d.ts.map +1 -0
  173. package/dist/conformance/Directory.js +253 -0
  174. package/dist/conformance/Directory.js.map +1 -0
  175. package/dist/conformance/DirectoryProvider.d.ts +4 -0
  176. package/dist/conformance/DirectoryProvider.d.ts.map +1 -0
  177. package/dist/conformance/DirectoryProvider.js +58 -0
  178. package/dist/conformance/DirectoryProvider.js.map +1 -0
  179. package/dist/conformance/DocumentSource.d.ts +4 -0
  180. package/dist/conformance/DocumentSource.d.ts.map +1 -0
  181. package/dist/conformance/DocumentSource.js +43 -0
  182. package/dist/conformance/DocumentSource.js.map +1 -0
  183. package/dist/conformance/EndpointReference.d.ts +40 -0
  184. package/dist/conformance/EndpointReference.d.ts.map +1 -0
  185. package/dist/conformance/EndpointReference.js +67 -0
  186. package/dist/conformance/EndpointReference.js.map +1 -0
  187. package/dist/conformance/Files.d.ts +40 -0
  188. package/dist/conformance/Files.d.ts.map +1 -0
  189. package/dist/conformance/Files.js +592 -0
  190. package/dist/conformance/Files.js.map +1 -0
  191. package/dist/conformance/FilesReference.d.ts +31 -0
  192. package/dist/conformance/FilesReference.d.ts.map +1 -0
  193. package/dist/conformance/FilesReference.js +116 -0
  194. package/dist/conformance/FilesReference.js.map +1 -0
  195. package/dist/conformance/FilesSubject.d.ts +46 -0
  196. package/dist/conformance/FilesSubject.d.ts.map +1 -0
  197. package/dist/conformance/FilesSubject.js +3 -0
  198. package/dist/conformance/FilesSubject.js.map +1 -0
  199. package/dist/conformance/Flags.d.ts +3 -0
  200. package/dist/conformance/Flags.d.ts.map +1 -0
  201. package/dist/conformance/Flags.js +183 -0
  202. package/dist/conformance/Flags.js.map +1 -0
  203. package/dist/conformance/Host.d.ts +64 -0
  204. package/dist/conformance/Host.d.ts.map +1 -0
  205. package/dist/conformance/Host.js +152 -0
  206. package/dist/conformance/Host.js.map +1 -0
  207. package/dist/conformance/HttpApi.d.ts +5 -0
  208. package/dist/conformance/HttpApi.d.ts.map +1 -0
  209. package/dist/conformance/HttpApi.js +131 -0
  210. package/dist/conformance/HttpApi.js.map +1 -0
  211. package/dist/conformance/InboxReference.d.ts +28 -0
  212. package/dist/conformance/InboxReference.d.ts.map +1 -0
  213. package/dist/conformance/InboxReference.js +331 -0
  214. package/dist/conformance/InboxReference.js.map +1 -0
  215. package/dist/conformance/InboxSubject.d.ts +92 -0
  216. package/dist/conformance/InboxSubject.d.ts.map +1 -0
  217. package/dist/conformance/InboxSubject.js +16 -0
  218. package/dist/conformance/InboxSubject.js.map +1 -0
  219. package/dist/conformance/Ingestion.d.ts +10 -0
  220. package/dist/conformance/Ingestion.d.ts.map +1 -0
  221. package/dist/conformance/Ingestion.js +335 -0
  222. package/dist/conformance/Ingestion.js.map +1 -0
  223. package/dist/conformance/Ingress.d.ts +62 -0
  224. package/dist/conformance/Ingress.d.ts.map +1 -0
  225. package/dist/conformance/Ingress.js +346 -0
  226. package/dist/conformance/Ingress.js.map +1 -0
  227. package/dist/conformance/Invocation.d.ts +3 -0
  228. package/dist/conformance/Invocation.d.ts.map +1 -0
  229. package/dist/conformance/Invocation.js +665 -0
  230. package/dist/conformance/Invocation.js.map +1 -0
  231. package/dist/conformance/IsolationMatrix.d.ts +60 -0
  232. package/dist/conformance/IsolationMatrix.d.ts.map +1 -0
  233. package/dist/conformance/IsolationMatrix.js +196 -0
  234. package/dist/conformance/IsolationMatrix.js.map +1 -0
  235. package/dist/conformance/LiveConnection.d.ts +72 -0
  236. package/dist/conformance/LiveConnection.d.ts.map +1 -0
  237. package/dist/conformance/LiveConnection.js +125 -0
  238. package/dist/conformance/LiveConnection.js.map +1 -0
  239. package/dist/conformance/LocalClient.d.ts +70 -0
  240. package/dist/conformance/LocalClient.d.ts.map +1 -0
  241. package/dist/conformance/LocalClient.js +576 -0
  242. package/dist/conformance/LocalClient.js.map +1 -0
  243. package/dist/conformance/Locale.d.ts +28 -0
  244. package/dist/conformance/Locale.d.ts.map +1 -0
  245. package/dist/conformance/Locale.js +115 -0
  246. package/dist/conformance/Locale.js.map +1 -0
  247. package/dist/conformance/MachineIdentity.d.ts +39 -0
  248. package/dist/conformance/MachineIdentity.d.ts.map +1 -0
  249. package/dist/conformance/MachineIdentity.js +595 -0
  250. package/dist/conformance/MachineIdentity.js.map +1 -0
  251. package/dist/conformance/MailProvider.d.ts +4 -0
  252. package/dist/conformance/MailProvider.d.ts.map +1 -0
  253. package/dist/conformance/MailProvider.js +167 -0
  254. package/dist/conformance/MailProvider.js.map +1 -0
  255. package/dist/conformance/Memory.d.ts +10 -0
  256. package/dist/conformance/Memory.d.ts.map +1 -0
  257. package/dist/conformance/Memory.js +179 -0
  258. package/dist/conformance/Memory.js.map +1 -0
  259. package/dist/conformance/Messaging.d.ts +49 -0
  260. package/dist/conformance/Messaging.d.ts.map +1 -0
  261. package/dist/conformance/Messaging.js +117 -0
  262. package/dist/conformance/Messaging.js.map +1 -0
  263. package/dist/conformance/Metering.d.ts +26 -0
  264. package/dist/conformance/Metering.d.ts.map +1 -0
  265. package/dist/conformance/Metering.js +236 -0
  266. package/dist/conformance/Metering.js.map +1 -0
  267. package/dist/conformance/ModelProvider.d.ts +32 -0
  268. package/dist/conformance/ModelProvider.d.ts.map +1 -0
  269. package/dist/conformance/ModelProvider.js +100 -0
  270. package/dist/conformance/ModelProvider.js.map +1 -0
  271. package/dist/conformance/ModuleManifest.d.ts +9 -0
  272. package/dist/conformance/ModuleManifest.d.ts.map +1 -0
  273. package/dist/conformance/ModuleManifest.js +542 -0
  274. package/dist/conformance/ModuleManifest.js.map +1 -0
  275. package/dist/conformance/NotebookAgent.d.ts +32 -0
  276. package/dist/conformance/NotebookAgent.d.ts.map +1 -0
  277. package/dist/conformance/NotebookAgent.js +31 -0
  278. package/dist/conformance/NotebookAgent.js.map +1 -0
  279. package/dist/conformance/NotificationChannel.d.ts +40 -0
  280. package/dist/conformance/NotificationChannel.d.ts.map +1 -0
  281. package/dist/conformance/NotificationChannel.js +78 -0
  282. package/dist/conformance/NotificationChannel.js.map +1 -0
  283. package/dist/conformance/Notifications.d.ts +3 -0
  284. package/dist/conformance/Notifications.d.ts.map +1 -0
  285. package/dist/conformance/Notifications.js +240 -0
  286. package/dist/conformance/Notifications.js.map +1 -0
  287. package/dist/conformance/OAuthClient.d.ts +123 -0
  288. package/dist/conformance/OAuthClient.d.ts.map +1 -0
  289. package/dist/conformance/OAuthClient.js +204 -0
  290. package/dist/conformance/OAuthClient.js.map +1 -0
  291. package/dist/conformance/Outbox.d.ts +3 -0
  292. package/dist/conformance/Outbox.d.ts.map +1 -0
  293. package/dist/conformance/Outbox.js +266 -0
  294. package/dist/conformance/Outbox.js.map +1 -0
  295. package/dist/conformance/PlatformReference.d.ts +5 -0
  296. package/dist/conformance/PlatformReference.d.ts.map +1 -0
  297. package/dist/conformance/PlatformReference.js +66 -0
  298. package/dist/conformance/PlatformReference.js.map +1 -0
  299. package/dist/conformance/PlatformSubject.d.ts +45 -0
  300. package/dist/conformance/PlatformSubject.d.ts.map +1 -0
  301. package/dist/conformance/PlatformSubject.js +3 -0
  302. package/dist/conformance/PlatformSubject.js.map +1 -0
  303. package/dist/conformance/Privacy.d.ts +3 -0
  304. package/dist/conformance/Privacy.d.ts.map +1 -0
  305. package/dist/conformance/Privacy.js +437 -0
  306. package/dist/conformance/Privacy.js.map +1 -0
  307. package/dist/conformance/Progress.d.ts +3 -0
  308. package/dist/conformance/Progress.d.ts.map +1 -0
  309. package/dist/conformance/Progress.js +153 -0
  310. package/dist/conformance/Progress.js.map +1 -0
  311. package/dist/conformance/Push.d.ts +38 -0
  312. package/dist/conformance/Push.d.ts.map +1 -0
  313. package/dist/conformance/Push.js +649 -0
  314. package/dist/conformance/Push.js.map +1 -0
  315. package/dist/conformance/PushReference.d.ts +3 -0
  316. package/dist/conformance/PushReference.d.ts.map +1 -0
  317. package/dist/conformance/PushReference.js +97 -0
  318. package/dist/conformance/PushReference.js.map +1 -0
  319. package/dist/conformance/QuerySurface.d.ts +9 -0
  320. package/dist/conformance/QuerySurface.d.ts.map +1 -0
  321. package/dist/conformance/QuerySurface.js +349 -0
  322. package/dist/conformance/QuerySurface.js.map +1 -0
  323. package/dist/conformance/Readiness.d.ts +23 -0
  324. package/dist/conformance/Readiness.d.ts.map +1 -0
  325. package/dist/conformance/Readiness.js +110 -0
  326. package/dist/conformance/Readiness.js.map +1 -0
  327. package/dist/conformance/Reference.d.ts +17 -0
  328. package/dist/conformance/Reference.d.ts.map +1 -0
  329. package/dist/conformance/Reference.js +246 -0
  330. package/dist/conformance/Reference.js.map +1 -0
  331. package/dist/conformance/Release.d.ts +73 -0
  332. package/dist/conformance/Release.d.ts.map +1 -0
  333. package/dist/conformance/Release.js +556 -0
  334. package/dist/conformance/Release.js.map +1 -0
  335. package/dist/conformance/ReleaseReference.d.ts +5 -0
  336. package/dist/conformance/ReleaseReference.d.ts.map +1 -0
  337. package/dist/conformance/ReleaseReference.js +124 -0
  338. package/dist/conformance/ReleaseReference.js.map +1 -0
  339. package/dist/conformance/ResultRendering.d.ts +3 -0
  340. package/dist/conformance/ResultRendering.d.ts.map +1 -0
  341. package/dist/conformance/ResultRendering.js +120 -0
  342. package/dist/conformance/ResultRendering.js.map +1 -0
  343. package/dist/conformance/Sandbox.d.ts +58 -0
  344. package/dist/conformance/Sandbox.d.ts.map +1 -0
  345. package/dist/conformance/Sandbox.js +213 -0
  346. package/dist/conformance/Sandbox.js.map +1 -0
  347. package/dist/conformance/SandboxReference.d.ts +3 -0
  348. package/dist/conformance/SandboxReference.d.ts.map +1 -0
  349. package/dist/conformance/SandboxReference.js +44 -0
  350. package/dist/conformance/SandboxReference.js.map +1 -0
  351. package/dist/conformance/Scheduler.d.ts +106 -0
  352. package/dist/conformance/Scheduler.d.ts.map +1 -0
  353. package/dist/conformance/Scheduler.js +576 -0
  354. package/dist/conformance/Scheduler.js.map +1 -0
  355. package/dist/conformance/ScreenContext.d.ts +84 -0
  356. package/dist/conformance/ScreenContext.d.ts.map +1 -0
  357. package/dist/conformance/ScreenContext.js +290 -0
  358. package/dist/conformance/ScreenContext.js.map +1 -0
  359. package/dist/conformance/Search.d.ts +3 -0
  360. package/dist/conformance/Search.d.ts.map +1 -0
  361. package/dist/conformance/Search.js +333 -0
  362. package/dist/conformance/Search.js.map +1 -0
  363. package/dist/conformance/Secrets.d.ts +8 -0
  364. package/dist/conformance/Secrets.d.ts.map +1 -0
  365. package/dist/conformance/Secrets.js +231 -0
  366. package/dist/conformance/Secrets.js.map +1 -0
  367. package/dist/conformance/SecretsReference.d.ts +44 -0
  368. package/dist/conformance/SecretsReference.d.ts.map +1 -0
  369. package/dist/conformance/SecretsReference.js +73 -0
  370. package/dist/conformance/SecretsReference.js.map +1 -0
  371. package/dist/conformance/ServicesReference.d.ts +8 -0
  372. package/dist/conformance/ServicesReference.d.ts.map +1 -0
  373. package/dist/conformance/ServicesReference.js +273 -0
  374. package/dist/conformance/ServicesReference.js.map +1 -0
  375. package/dist/conformance/ServicesSubject.d.ts +104 -0
  376. package/dist/conformance/ServicesSubject.d.ts.map +1 -0
  377. package/dist/conformance/ServicesSubject.js +2 -0
  378. package/dist/conformance/ServicesSubject.js.map +1 -0
  379. package/dist/conformance/Settings.d.ts +3 -0
  380. package/dist/conformance/Settings.d.ts.map +1 -0
  381. package/dist/conformance/Settings.js +177 -0
  382. package/dist/conformance/Settings.js.map +1 -0
  383. package/dist/conformance/Sharing.d.ts +3 -0
  384. package/dist/conformance/Sharing.d.ts.map +1 -0
  385. package/dist/conformance/Sharing.js +368 -0
  386. package/dist/conformance/Sharing.js.map +1 -0
  387. package/dist/conformance/ShellSubject.d.ts +29 -0
  388. package/dist/conformance/ShellSubject.d.ts.map +1 -0
  389. package/dist/conformance/ShellSubject.js +13 -0
  390. package/dist/conformance/ShellSubject.js.map +1 -0
  391. package/dist/conformance/SignOutRace.d.ts +23 -0
  392. package/dist/conformance/SignOutRace.d.ts.map +1 -0
  393. package/dist/conformance/SignOutRace.js +49 -0
  394. package/dist/conformance/SignOutRace.js.map +1 -0
  395. package/dist/conformance/Slot.d.ts +3 -0
  396. package/dist/conformance/Slot.d.ts.map +1 -0
  397. package/dist/conformance/Slot.js +79 -0
  398. package/dist/conformance/Slot.js.map +1 -0
  399. package/dist/conformance/Space.d.ts +63 -0
  400. package/dist/conformance/Space.d.ts.map +1 -0
  401. package/dist/conformance/Space.js +294 -0
  402. package/dist/conformance/Space.js.map +1 -0
  403. package/dist/conformance/StorageAdapter.d.ts +76 -0
  404. package/dist/conformance/StorageAdapter.d.ts.map +1 -0
  405. package/dist/conformance/StorageAdapter.js +181 -0
  406. package/dist/conformance/StorageAdapter.js.map +1 -0
  407. package/dist/conformance/StorageBackend.d.ts +23 -0
  408. package/dist/conformance/StorageBackend.d.ts.map +1 -0
  409. package/dist/conformance/StorageBackend.js +274 -0
  410. package/dist/conformance/StorageBackend.js.map +1 -0
  411. package/dist/conformance/Subject.d.ts +198 -0
  412. package/dist/conformance/Subject.d.ts.map +1 -0
  413. package/dist/conformance/Subject.js +26 -0
  414. package/dist/conformance/Subject.js.map +1 -0
  415. package/dist/conformance/Sync.d.ts +3 -0
  416. package/dist/conformance/Sync.d.ts.map +1 -0
  417. package/dist/conformance/Sync.js +190 -0
  418. package/dist/conformance/Sync.js.map +1 -0
  419. package/dist/conformance/Telemetry.d.ts +3 -0
  420. package/dist/conformance/Telemetry.d.ts.map +1 -0
  421. package/dist/conformance/Telemetry.js +218 -0
  422. package/dist/conformance/Telemetry.js.map +1 -0
  423. package/dist/conformance/ThemeTokens.d.ts +22 -0
  424. package/dist/conformance/ThemeTokens.d.ts.map +1 -0
  425. package/dist/conformance/ThemeTokens.js +121 -0
  426. package/dist/conformance/ThemeTokens.js.map +1 -0
  427. package/dist/conformance/ToolSource.d.ts +5 -0
  428. package/dist/conformance/ToolSource.d.ts.map +1 -0
  429. package/dist/conformance/ToolSource.js +520 -0
  430. package/dist/conformance/ToolSource.js.map +1 -0
  431. package/dist/conformance/Versioning.d.ts +3 -0
  432. package/dist/conformance/Versioning.d.ts.map +1 -0
  433. package/dist/conformance/Versioning.js +160 -0
  434. package/dist/conformance/Versioning.js.map +1 -0
  435. package/dist/conformance/View.d.ts +3 -0
  436. package/dist/conformance/View.d.ts.map +1 -0
  437. package/dist/conformance/View.js +121 -0
  438. package/dist/conformance/View.js.map +1 -0
  439. package/dist/conformance/WorkItems.d.ts +3 -0
  440. package/dist/conformance/WorkItems.d.ts.map +1 -0
  441. package/dist/conformance/WorkItems.js +152 -0
  442. package/dist/conformance/WorkItems.js.map +1 -0
  443. package/dist/conformance/Workflow.d.ts +63 -0
  444. package/dist/conformance/Workflow.d.ts.map +1 -0
  445. package/dist/conformance/Workflow.js +235 -0
  446. package/dist/conformance/Workflow.js.map +1 -0
  447. package/dist/conformance/acme/chatlog.d.ts +591 -0
  448. package/dist/conformance/acme/chatlog.d.ts.map +1 -0
  449. package/dist/conformance/acme/chatlog.js +101 -0
  450. package/dist/conformance/acme/chatlog.js.map +1 -0
  451. package/dist/conformance/acme/connector.d.ts +12 -0
  452. package/dist/conformance/acme/connector.d.ts.map +1 -0
  453. package/dist/conformance/acme/connector.js +123 -0
  454. package/dist/conformance/acme/connector.js.map +1 -0
  455. package/dist/conformance/acme/migrations/0000_messages.sql +8 -0
  456. package/dist/conformance/archive/app.d.ts +728 -0
  457. package/dist/conformance/archive/app.d.ts.map +1 -0
  458. package/dist/conformance/archive/app.js +30 -0
  459. package/dist/conformance/archive/app.js.map +1 -0
  460. package/dist/conformance/archive/contract.d.ts +467 -0
  461. package/dist/conformance/archive/contract.d.ts.map +1 -0
  462. package/dist/conformance/archive/contract.js +187 -0
  463. package/dist/conformance/archive/contract.js.map +1 -0
  464. package/dist/conformance/archive/memo.sync.gen.d.ts +148 -0
  465. package/dist/conformance/archive/memo.sync.gen.d.ts.map +1 -0
  466. package/dist/conformance/archive/memo.sync.gen.js +23 -0
  467. package/dist/conformance/archive/memo.sync.gen.js.map +1 -0
  468. package/dist/conformance/archive/migrations/archive/0000_archive.sql +9 -0
  469. package/dist/conformance/archive/migrations/memo/0000_memo.sql +6 -0
  470. package/dist/conformance/archive/schema.d.ts +185 -0
  471. package/dist/conformance/archive/schema.d.ts.map +1 -0
  472. package/dist/conformance/archive/schema.js +22 -0
  473. package/dist/conformance/archive/schema.js.map +1 -0
  474. package/dist/conformance/archive/server.d.ts +273 -0
  475. package/dist/conformance/archive/server.d.ts.map +1 -0
  476. package/dist/conformance/archive/server.js +127 -0
  477. package/dist/conformance/archive/server.js.map +1 -0
  478. package/dist/conformance/archive/sync.gen.d.ts +319 -0
  479. package/dist/conformance/archive/sync.gen.d.ts.map +1 -0
  480. package/dist/conformance/archive/sync.gen.js +29 -0
  481. package/dist/conformance/archive/sync.gen.js.map +1 -0
  482. package/dist/conformance/atlas/app.d.ts +3 -0
  483. package/dist/conformance/atlas/app.d.ts.map +1 -0
  484. package/dist/conformance/atlas/app.js +15 -0
  485. package/dist/conformance/atlas/app.js.map +1 -0
  486. package/dist/conformance/atlas/contract.d.ts +489 -0
  487. package/dist/conformance/atlas/contract.d.ts.map +1 -0
  488. package/dist/conformance/atlas/contract.js +114 -0
  489. package/dist/conformance/atlas/contract.js.map +1 -0
  490. package/dist/conformance/crm/app.d.ts +304 -0
  491. package/dist/conformance/crm/app.d.ts.map +1 -0
  492. package/dist/conformance/crm/app.js +95 -0
  493. package/dist/conformance/crm/app.js.map +1 -0
  494. package/dist/conformance/crm/contract.d.ts +586 -0
  495. package/dist/conformance/crm/contract.d.ts.map +1 -0
  496. package/dist/conformance/crm/contract.js +153 -0
  497. package/dist/conformance/crm/contract.js.map +1 -0
  498. package/dist/conformance/crm/migrations/crm/0000_crm.sql +18 -0
  499. package/dist/conformance/crm/migrations/team/0000_team.sql +6 -0
  500. package/dist/conformance/crm/schema.d.ts +261 -0
  501. package/dist/conformance/crm/schema.d.ts.map +1 -0
  502. package/dist/conformance/crm/schema.js +25 -0
  503. package/dist/conformance/crm/schema.js.map +1 -0
  504. package/dist/conformance/crm/sync.gen.d.ts +188 -0
  505. package/dist/conformance/crm/sync.gen.d.ts.map +1 -0
  506. package/dist/conformance/crm/sync.gen.js +25 -0
  507. package/dist/conformance/crm/sync.gen.js.map +1 -0
  508. package/dist/conformance/desk/contract.d.ts +306 -0
  509. package/dist/conformance/desk/contract.d.ts.map +1 -0
  510. package/dist/conformance/desk/contract.js +56 -0
  511. package/dist/conformance/desk/contract.js.map +1 -0
  512. package/dist/conformance/desk/migrations/0000_notes.sql +7 -0
  513. package/dist/conformance/desk/server.d.ts +231 -0
  514. package/dist/conformance/desk/server.d.ts.map +1 -0
  515. package/dist/conformance/desk/server.js +123 -0
  516. package/dist/conformance/desk/server.js.map +1 -0
  517. package/dist/conformance/drafts/migrations/0000_drafts.sql +8 -0
  518. package/dist/conformance/drafts/module.d.ts +571 -0
  519. package/dist/conformance/drafts/module.d.ts.map +1 -0
  520. package/dist/conformance/drafts/module.js +190 -0
  521. package/dist/conformance/drafts/module.js.map +1 -0
  522. package/dist/conformance/fixture/app.d.ts +24 -0
  523. package/dist/conformance/fixture/app.d.ts.map +1 -0
  524. package/dist/conformance/fixture/app.js +26 -0
  525. package/dist/conformance/fixture/app.js.map +1 -0
  526. package/dist/conformance/fixture/docs/bad-sync.d.ts +105 -0
  527. package/dist/conformance/fixture/docs/bad-sync.d.ts.map +1 -0
  528. package/dist/conformance/fixture/docs/bad-sync.js +22 -0
  529. package/dist/conformance/fixture/docs/bad-sync.js.map +1 -0
  530. package/dist/conformance/fixture/docs/contract.d.ts +1091 -0
  531. package/dist/conformance/fixture/docs/contract.d.ts.map +1 -0
  532. package/dist/conformance/fixture/docs/contract.js +277 -0
  533. package/dist/conformance/fixture/docs/contract.js.map +1 -0
  534. package/dist/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
  535. package/dist/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
  536. package/dist/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
  537. package/dist/conformance/fixture/docs/policy.cedar +110 -0
  538. package/dist/conformance/fixture/docs/schema.d.ts +308 -0
  539. package/dist/conformance/fixture/docs/schema.d.ts.map +1 -0
  540. package/dist/conformance/fixture/docs/schema.js +36 -0
  541. package/dist/conformance/fixture/docs/schema.js.map +1 -0
  542. package/dist/conformance/fixture/docs/server.d.ts +552 -0
  543. package/dist/conformance/fixture/docs/server.d.ts.map +1 -0
  544. package/dist/conformance/fixture/docs/server.js +192 -0
  545. package/dist/conformance/fixture/docs/server.js.map +1 -0
  546. package/dist/conformance/fixture/docs/sync.d.ts +402 -0
  547. package/dist/conformance/fixture/docs/sync.d.ts.map +1 -0
  548. package/dist/conformance/fixture/docs/sync.gen.d.ts +574 -0
  549. package/dist/conformance/fixture/docs/sync.gen.d.ts.map +1 -0
  550. package/dist/conformance/fixture/docs/sync.gen.js +48 -0
  551. package/dist/conformance/fixture/docs/sync.gen.js.map +1 -0
  552. package/dist/conformance/fixture/docs/sync.js +23 -0
  553. package/dist/conformance/fixture/docs/sync.js.map +1 -0
  554. package/dist/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
  555. package/dist/conformance/fixture/peer/module.d.ts +306 -0
  556. package/dist/conformance/fixture/peer/module.d.ts.map +1 -0
  557. package/dist/conformance/fixture/peer/module.js +44 -0
  558. package/dist/conformance/fixture/peer/module.js.map +1 -0
  559. package/dist/conformance/fixture/release/blocking/0000_item.sql +3 -0
  560. package/dist/conformance/fixture/release/blocking/0001_wait.sql +2 -0
  561. package/dist/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
  562. package/dist/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
  563. package/dist/conformance/fixture/release/broken/0000_item.sql +3 -0
  564. package/dist/conformance/fixture/release/broken/0001_extra.sql +3 -0
  565. package/dist/conformance/fixture/release/broken/0002_label.sql +3 -0
  566. package/dist/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
  567. package/dist/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
  568. package/dist/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
  569. package/dist/conformance/fixture/release/escape/0000_item.sql +3 -0
  570. package/dist/conformance/fixture/release/escape/0001_escape.sql +5 -0
  571. package/dist/conformance/fixture/release/misnamed/0000_item.sql +3 -0
  572. package/dist/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
  573. package/dist/conformance/fixture/release/module.d.ts +1878 -0
  574. package/dist/conformance/fixture/release/module.d.ts.map +1 -0
  575. package/dist/conformance/fixture/release/module.js +102 -0
  576. package/dist/conformance/fixture/release/module.js.map +1 -0
  577. package/dist/conformance/fixture/release/outside/0000_item.sql +3 -0
  578. package/dist/conformance/fixture/release/outside/0001_extra.sql +3 -0
  579. package/dist/conformance/fixture/release/outside/0002_index.sql +4 -0
  580. package/dist/conformance/fixture/release/outside/0003_later.sql +1 -0
  581. package/dist/conformance/fixture/release/renamed/0000_item.sql +3 -0
  582. package/dist/conformance/fixture/release/renamed/0001_misname.sql +10 -0
  583. package/dist/conformance/fixture/release/renamed/0002_restore.sql +1 -0
  584. package/dist/conformance/fixture/release/rogue/0000_item.sql +3 -0
  585. package/dist/conformance/fixture/release/rogue/0001_extra.sql +3 -0
  586. package/dist/conformance/fixture/release/rogue/0002_definer.sql +1 -0
  587. package/dist/conformance/fixture/release/slow/0000_item.sql +5 -0
  588. package/dist/conformance/fixture/release/undeclared/0000_item.sql +3 -0
  589. package/dist/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
  590. package/dist/conformance/fixture/release/undeclared/0002_index.sql +1 -0
  591. package/dist/conformance/fixture/release/v1/0000_item.sql +3 -0
  592. package/dist/conformance/fixture/release/v2/0000_item.sql +3 -0
  593. package/dist/conformance/fixture/release/v2/0001_extra.sql +3 -0
  594. package/dist/conformance/fixture/release/v2/0002_label.sql +3 -0
  595. package/dist/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
  596. package/dist/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
  597. package/dist/conformance/kit-hash.d.ts +8 -0
  598. package/dist/conformance/kit-hash.d.ts.map +1 -0
  599. package/dist/conformance/kit-hash.js +20 -0
  600. package/dist/conformance/kit-hash.js.map +1 -0
  601. package/dist/conformance/ledger/contract.d.ts +380 -0
  602. package/dist/conformance/ledger/contract.d.ts.map +1 -0
  603. package/dist/conformance/ledger/contract.js +81 -0
  604. package/dist/conformance/ledger/contract.js.map +1 -0
  605. package/dist/conformance/ledger/migrations/0000_entries.sql +8 -0
  606. package/dist/conformance/ledger/server.d.ts +312 -0
  607. package/dist/conformance/ledger/server.d.ts.map +1 -0
  608. package/dist/conformance/ledger/server.js +152 -0
  609. package/dist/conformance/ledger/server.js.map +1 -0
  610. package/dist/conformance/library/app.d.ts +616 -0
  611. package/dist/conformance/library/app.d.ts.map +1 -0
  612. package/dist/conformance/library/app.js +35 -0
  613. package/dist/conformance/library/app.js.map +1 -0
  614. package/dist/conformance/library/contract.d.ts +377 -0
  615. package/dist/conformance/library/contract.d.ts.map +1 -0
  616. package/dist/conformance/library/contract.js +63 -0
  617. package/dist/conformance/library/contract.js.map +1 -0
  618. package/dist/conformance/library/migrations/0000_library.sql +14 -0
  619. package/dist/conformance/library/schema.d.ts +174 -0
  620. package/dist/conformance/library/schema.d.ts.map +1 -0
  621. package/dist/conformance/library/schema.js +24 -0
  622. package/dist/conformance/library/schema.js.map +1 -0
  623. package/dist/conformance/library/server.d.ts +191 -0
  624. package/dist/conformance/library/server.d.ts.map +1 -0
  625. package/dist/conformance/library/server.js +52 -0
  626. package/dist/conformance/library/server.js.map +1 -0
  627. package/dist/conformance/library/sync.gen.d.ts +519 -0
  628. package/dist/conformance/library/sync.gen.d.ts.map +1 -0
  629. package/dist/conformance/library/sync.gen.js +42 -0
  630. package/dist/conformance/library/sync.gen.js.map +1 -0
  631. package/dist/conformance/locale/catalog.d.ts +93 -0
  632. package/dist/conformance/locale/catalog.d.ts.map +1 -0
  633. package/dist/conformance/locale/catalog.js +104 -0
  634. package/dist/conformance/locale/catalog.js.map +1 -0
  635. package/dist/conformance/notebook/app.d.ts +1039 -0
  636. package/dist/conformance/notebook/app.d.ts.map +1 -0
  637. package/dist/conformance/notebook/app.js +88 -0
  638. package/dist/conformance/notebook/app.js.map +1 -0
  639. package/dist/conformance/notebook/evals/pages.evals.json +94 -0
  640. package/dist/conformance/notebook/migrations/0000_notebook.sql +10 -0
  641. package/dist/conformance/notebook/module.d.ts +717 -0
  642. package/dist/conformance/notebook/module.d.ts.map +1 -0
  643. package/dist/conformance/notebook/module.js +188 -0
  644. package/dist/conformance/notebook/module.js.map +1 -0
  645. package/dist/conformance/pad/app.d.ts +9 -0
  646. package/dist/conformance/pad/app.d.ts.map +1 -0
  647. package/dist/conformance/pad/app.js +13 -0
  648. package/dist/conformance/pad/app.js.map +1 -0
  649. package/dist/conformance/pad/contract.d.ts +281 -0
  650. package/dist/conformance/pad/contract.d.ts.map +1 -0
  651. package/dist/conformance/pad/contract.js +66 -0
  652. package/dist/conformance/pad/contract.js.map +1 -0
  653. package/dist/conformance/pad/migrations/pad/0000_pad.sql +8 -0
  654. package/dist/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
  655. package/dist/conformance/pad/schema.d.ts +127 -0
  656. package/dist/conformance/pad/schema.d.ts.map +1 -0
  657. package/dist/conformance/pad/schema.js +17 -0
  658. package/dist/conformance/pad/schema.js.map +1 -0
  659. package/dist/conformance/pad/server.d.ts +149 -0
  660. package/dist/conformance/pad/server.d.ts.map +1 -0
  661. package/dist/conformance/pad/server.js +81 -0
  662. package/dist/conformance/pad/server.js.map +1 -0
  663. package/dist/conformance/purchases/app.d.ts +480 -0
  664. package/dist/conformance/purchases/app.d.ts.map +1 -0
  665. package/dist/conformance/purchases/app.js +32 -0
  666. package/dist/conformance/purchases/app.js.map +1 -0
  667. package/dist/conformance/purchases/contract.d.ts +720 -0
  668. package/dist/conformance/purchases/contract.d.ts.map +1 -0
  669. package/dist/conformance/purchases/contract.js +148 -0
  670. package/dist/conformance/purchases/contract.js.map +1 -0
  671. package/dist/conformance/purchases/migrations/0000_purchases.sql +17 -0
  672. package/dist/conformance/purchases/server.d.ts +250 -0
  673. package/dist/conformance/purchases/server.d.ts.map +1 -0
  674. package/dist/conformance/purchases/server.js +85 -0
  675. package/dist/conformance/purchases/server.js.map +1 -0
  676. package/dist/conformance/studio/app.d.ts +996 -0
  677. package/dist/conformance/studio/app.d.ts.map +1 -0
  678. package/dist/conformance/studio/app.js +251 -0
  679. package/dist/conformance/studio/app.js.map +1 -0
  680. package/dist/conformance/studio/contract.d.ts +1318 -0
  681. package/dist/conformance/studio/contract.d.ts.map +1 -0
  682. package/dist/conformance/studio/contract.js +280 -0
  683. package/dist/conformance/studio/contract.js.map +1 -0
  684. package/dist/conformance/studio/migrations/billing/0000_billing.sql +6 -0
  685. package/dist/conformance/studio/migrations/journal/0000_journal.sql +9 -0
  686. package/dist/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
  687. package/dist/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
  688. package/dist/conformance/workshop/app.d.ts +8 -0
  689. package/dist/conformance/workshop/app.d.ts.map +1 -0
  690. package/dist/conformance/workshop/app.js +13 -0
  691. package/dist/conformance/workshop/app.js.map +1 -0
  692. package/dist/conformance/workshop/migrations/0000_notes.sql +7 -0
  693. package/dist/conformance/workshop/module.d.ts +407 -0
  694. package/dist/conformance/workshop/module.d.ts.map +1 -0
  695. package/dist/conformance/workshop/module.js +71 -0
  696. package/dist/conformance/workshop/module.js.map +1 -0
  697. package/dist/fakes/AcmeFake.d.ts +46 -0
  698. package/dist/fakes/AcmeFake.d.ts.map +1 -0
  699. package/dist/fakes/AcmeFake.js +131 -0
  700. package/dist/fakes/AcmeFake.js.map +1 -0
  701. package/dist/fakes/ApnsFake.d.ts +79 -0
  702. package/dist/fakes/ApnsFake.d.ts.map +1 -0
  703. package/dist/fakes/ApnsFake.js +220 -0
  704. package/dist/fakes/ApnsFake.js.map +1 -0
  705. package/dist/fakes/FcmFake.d.ts +46 -0
  706. package/dist/fakes/FcmFake.d.ts.map +1 -0
  707. package/dist/fakes/FcmFake.js +185 -0
  708. package/dist/fakes/FcmFake.js.map +1 -0
  709. package/dist/fakes/GoogleFake.d.ts +221 -0
  710. package/dist/fakes/GoogleFake.d.ts.map +1 -0
  711. package/dist/fakes/GoogleFake.js +1035 -0
  712. package/dist/fakes/GoogleFake.js.map +1 -0
  713. package/dist/fakes/HttpApiFake.d.ts +22 -0
  714. package/dist/fakes/HttpApiFake.d.ts.map +1 -0
  715. package/dist/fakes/HttpApiFake.js +74 -0
  716. package/dist/fakes/HttpApiFake.js.map +1 -0
  717. package/dist/fakes/McpFake.d.ts +80 -0
  718. package/dist/fakes/McpFake.d.ts.map +1 -0
  719. package/dist/fakes/McpFake.js +312 -0
  720. package/dist/fakes/McpFake.js.map +1 -0
  721. package/dist/fakes/MicrosoftGraphFake.d.ts +254 -0
  722. package/dist/fakes/MicrosoftGraphFake.d.ts.map +1 -0
  723. package/dist/fakes/MicrosoftGraphFake.js +850 -0
  724. package/dist/fakes/MicrosoftGraphFake.js.map +1 -0
  725. package/dist/fakes/S3Fake.d.ts +29 -0
  726. package/dist/fakes/S3Fake.d.ts.map +1 -0
  727. package/dist/fakes/S3Fake.js +347 -0
  728. package/dist/fakes/S3Fake.js.map +1 -0
  729. package/dist/fakes/Server.d.ts +137 -0
  730. package/dist/fakes/Server.d.ts.map +1 -0
  731. package/dist/fakes/Server.js +357 -0
  732. package/dist/fakes/Server.js.map +1 -0
  733. package/dist/fakes/SignInProviderFake.d.ts +21 -0
  734. package/dist/fakes/SignInProviderFake.d.ts.map +1 -0
  735. package/dist/fakes/SignInProviderFake.js +56 -0
  736. package/dist/fakes/SignInProviderFake.js.map +1 -0
  737. package/dist/fakes/SlackFake.d.ts +136 -0
  738. package/dist/fakes/SlackFake.d.ts.map +1 -0
  739. package/dist/fakes/SlackFake.js +787 -0
  740. package/dist/fakes/SlackFake.js.map +1 -0
  741. package/dist/fakes/Store.d.ts +40 -0
  742. package/dist/fakes/Store.d.ts.map +1 -0
  743. package/dist/fakes/Store.js +82 -0
  744. package/dist/fakes/Store.js.map +1 -0
  745. package/dist/fakes/TelemetryFakes.d.ts +77 -0
  746. package/dist/fakes/TelemetryFakes.d.ts.map +1 -0
  747. package/dist/fakes/TelemetryFakes.js +121 -0
  748. package/dist/fakes/TelemetryFakes.js.map +1 -0
  749. package/dist/fakes/TestCa.d.ts +11 -0
  750. package/dist/fakes/TestCa.d.ts.map +1 -0
  751. package/dist/fakes/TestCa.js +115 -0
  752. package/dist/fakes/TestCa.js.map +1 -0
  753. package/dist/fakes/WorkOsFake.d.ts +40 -0
  754. package/dist/fakes/WorkOsFake.d.ts.map +1 -0
  755. package/dist/fakes/WorkOsFake.js +103 -0
  756. package/dist/fakes/WorkOsFake.js.map +1 -0
  757. package/dist/index.d.ts +10 -0
  758. package/dist/index.d.ts.map +1 -0
  759. package/dist/index.js +10 -0
  760. package/dist/index.js.map +1 -0
  761. package/dist/make/reference.d.ts +520 -0
  762. package/dist/make/reference.d.ts.map +1 -0
  763. package/dist/make/reference.js +182 -0
  764. package/dist/make/reference.js.map +1 -0
  765. package/dist/make/sources.d.ts +48 -0
  766. package/dist/make/sources.d.ts.map +1 -0
  767. package/dist/make/sources.js +806 -0
  768. package/dist/make/sources.js.map +1 -0
  769. package/package.json +77 -3
  770. package/src/Admin.ts +82 -0
  771. package/src/Agent.ts +289 -0
  772. package/src/AgentSurface.ts +51 -0
  773. package/src/Embedder.ts +69 -0
  774. package/src/EvalMain.ts +81 -0
  775. package/src/Evals.ts +490 -0
  776. package/src/Kernel.ts +228 -0
  777. package/src/Launch.ts +428 -0
  778. package/src/Locks.ts +123 -0
  779. package/src/Routes.ts +65 -0
  780. package/src/ScriptedChatModel.ts +189 -0
  781. package/src/SmtpSink.ts +205 -0
  782. package/src/System.ts +1075 -0
  783. package/src/TcpProxy.ts +102 -0
  784. package/src/auth/TrustedProxyAuth.ts +173 -0
  785. package/src/conformance/ActionConsent.ts +437 -0
  786. package/src/conformance/ActionRegistry.ts +174 -0
  787. package/src/conformance/Actor.ts +216 -0
  788. package/src/conformance/AgentReference.ts +171 -0
  789. package/src/conformance/AgentResources.ts +548 -0
  790. package/src/conformance/AgentRuntime.ts +388 -0
  791. package/src/conformance/AgentSubject.ts +103 -0
  792. package/src/conformance/Approvals.ts +363 -0
  793. package/src/conformance/Audit.ts +257 -0
  794. package/src/conformance/CalendarProvider.ts +156 -0
  795. package/src/conformance/CapabilityKit.ts +564 -0
  796. package/src/conformance/ClientSDK.ts +233 -0
  797. package/src/conformance/CollabDocument.ts +1203 -0
  798. package/src/conformance/CollabReference.ts +152 -0
  799. package/src/conformance/CollabSubject.ts +64 -0
  800. package/src/conformance/Command.ts +75 -0
  801. package/src/conformance/Connections.ts +357 -0
  802. package/src/conformance/ConnectionsReference.ts +172 -0
  803. package/src/conformance/ConnectorReference.ts +280 -0
  804. package/src/conformance/ContextAccounting.ts +169 -0
  805. package/src/conformance/Daemon.ts +936 -0
  806. package/src/conformance/DaemonReference.ts +189 -0
  807. package/src/conformance/DbTx.ts +253 -0
  808. package/src/conformance/DecisionTokens.ts +652 -0
  809. package/src/conformance/Delegation.ts +177 -0
  810. package/src/conformance/DeskReference.ts +73 -0
  811. package/src/conformance/DeviceControl.ts +700 -0
  812. package/src/conformance/Directory.ts +315 -0
  813. package/src/conformance/DirectoryProvider.ts +72 -0
  814. package/src/conformance/DocumentSource.ts +62 -0
  815. package/src/conformance/EndpointReference.ts +117 -0
  816. package/src/conformance/Files.ts +685 -0
  817. package/src/conformance/FilesReference.ts +154 -0
  818. package/src/conformance/FilesSubject.ts +50 -0
  819. package/src/conformance/Flags.ts +215 -0
  820. package/src/conformance/Host.ts +197 -0
  821. package/src/conformance/HttpApi.ts +169 -0
  822. package/src/conformance/InboxReference.ts +401 -0
  823. package/src/conformance/InboxSubject.ts +101 -0
  824. package/src/conformance/Ingestion.ts +425 -0
  825. package/src/conformance/Ingress.ts +498 -0
  826. package/src/conformance/Invocation.ts +780 -0
  827. package/src/conformance/IsolationMatrix.ts +215 -0
  828. package/src/conformance/LiveConnection.ts +197 -0
  829. package/src/conformance/LocalClient.ts +707 -0
  830. package/src/conformance/Locale.ts +141 -0
  831. package/src/conformance/MachineIdentity.ts +828 -0
  832. package/src/conformance/MailProvider.ts +217 -0
  833. package/src/conformance/Memory.ts +223 -0
  834. package/src/conformance/Messaging.ts +185 -0
  835. package/src/conformance/Metering.ts +293 -0
  836. package/src/conformance/ModelProvider.ts +139 -0
  837. package/src/conformance/ModuleManifest.ts +630 -0
  838. package/src/conformance/NotebookAgent.ts +41 -0
  839. package/src/conformance/NotificationChannel.ts +122 -0
  840. package/src/conformance/Notifications.ts +316 -0
  841. package/src/conformance/OAuthClient.ts +240 -0
  842. package/src/conformance/Outbox.ts +342 -0
  843. package/src/conformance/PlatformReference.ts +73 -0
  844. package/src/conformance/PlatformSubject.ts +50 -0
  845. package/src/conformance/Privacy.ts +577 -0
  846. package/src/conformance/Progress.ts +244 -0
  847. package/src/conformance/Push.ts +820 -0
  848. package/src/conformance/PushReference.ts +101 -0
  849. package/src/conformance/QuerySurface.ts +408 -0
  850. package/src/conformance/Readiness.ts +157 -0
  851. package/src/conformance/Reference.ts +326 -0
  852. package/src/conformance/Release.ts +690 -0
  853. package/src/conformance/ReleaseReference.ts +179 -0
  854. package/src/conformance/ResultRendering.ts +149 -0
  855. package/src/conformance/Sandbox.ts +313 -0
  856. package/src/conformance/SandboxReference.ts +52 -0
  857. package/src/conformance/Scheduler.ts +764 -0
  858. package/src/conformance/ScreenContext.ts +402 -0
  859. package/src/conformance/Search.ts +419 -0
  860. package/src/conformance/Secrets.ts +277 -0
  861. package/src/conformance/SecretsReference.ts +131 -0
  862. package/src/conformance/ServicesReference.ts +330 -0
  863. package/src/conformance/ServicesSubject.ts +105 -0
  864. package/src/conformance/Settings.ts +204 -0
  865. package/src/conformance/Sharing.ts +486 -0
  866. package/src/conformance/ShellSubject.ts +47 -0
  867. package/src/conformance/SignOutRace.ts +77 -0
  868. package/src/conformance/Slot.ts +84 -0
  869. package/src/conformance/Space.ts +432 -0
  870. package/src/conformance/StorageAdapter.ts +253 -0
  871. package/src/conformance/StorageBackend.ts +327 -0
  872. package/src/conformance/Subject.ts +208 -0
  873. package/src/conformance/Sync.ts +215 -0
  874. package/src/conformance/Telemetry.ts +287 -0
  875. package/src/conformance/ThemeTokens.ts +163 -0
  876. package/src/conformance/ToolSource.ts +632 -0
  877. package/src/conformance/Versioning.ts +199 -0
  878. package/src/conformance/View.ts +143 -0
  879. package/src/conformance/WorkItems.ts +186 -0
  880. package/src/conformance/Workflow.ts +304 -0
  881. package/src/conformance/acme/chatlog.ts +115 -0
  882. package/src/conformance/acme/connector.ts +151 -0
  883. package/src/conformance/acme/migrations/0000_messages.sql +8 -0
  884. package/src/conformance/archive/app.ts +33 -0
  885. package/src/conformance/archive/contract.ts +191 -0
  886. package/src/conformance/archive/memo.sync.gen.ts +25 -0
  887. package/src/conformance/archive/migrations/archive/0000_archive.sql +9 -0
  888. package/src/conformance/archive/migrations/memo/0000_memo.sql +6 -0
  889. package/src/conformance/archive/schema.ts +25 -0
  890. package/src/conformance/archive/server.ts +146 -0
  891. package/src/conformance/archive/sync.gen.ts +32 -0
  892. package/src/conformance/atlas/app.ts +16 -0
  893. package/src/conformance/atlas/contract.ts +118 -0
  894. package/src/conformance/crm/app.ts +107 -0
  895. package/src/conformance/crm/contract.ts +163 -0
  896. package/src/conformance/crm/migrations/crm/0000_crm.sql +18 -0
  897. package/src/conformance/crm/migrations/team/0000_team.sql +6 -0
  898. package/src/conformance/crm/schema.ts +28 -0
  899. package/src/conformance/crm/sync.gen.ts +27 -0
  900. package/src/conformance/desk/contract.ts +61 -0
  901. package/src/conformance/desk/migrations/0000_notes.sql +7 -0
  902. package/src/conformance/desk/server.ts +131 -0
  903. package/src/conformance/drafts/migrations/0000_drafts.sql +8 -0
  904. package/src/conformance/drafts/module.ts +211 -0
  905. package/src/conformance/fixture/app.ts +37 -0
  906. package/src/conformance/fixture/docs/bad-sync.ts +34 -0
  907. package/src/conformance/fixture/docs/contract.ts +297 -0
  908. package/src/conformance/fixture/docs/migrations/0000_docs.sql +9 -0
  909. package/src/conformance/fixture/docs/migrations/0001_seen.sql +12 -0
  910. package/src/conformance/fixture/docs/migrations/0002_attachment.sql +6 -0
  911. package/src/conformance/fixture/docs/policy.cedar +110 -0
  912. package/src/conformance/fixture/docs/schema.ts +41 -0
  913. package/src/conformance/fixture/docs/server.ts +292 -0
  914. package/src/conformance/fixture/docs/sync.gen.ts +54 -0
  915. package/src/conformance/fixture/docs/sync.ts +24 -0
  916. package/src/conformance/fixture/peer/migrations/0000_peer.sql +8 -0
  917. package/src/conformance/fixture/peer/module.ts +51 -0
  918. package/src/conformance/fixture/release/blocking/0000_item.sql +3 -0
  919. package/src/conformance/fixture/release/blocking/0001_wait.sql +2 -0
  920. package/src/conformance/fixture/release/blocking-renamed/0000_item.sql +3 -0
  921. package/src/conformance/fixture/release/blocking-renamed/0001_wait.sql +5 -0
  922. package/src/conformance/fixture/release/broken/0000_item.sql +3 -0
  923. package/src/conformance/fixture/release/broken/0001_extra.sql +3 -0
  924. package/src/conformance/fixture/release/broken/0002_label.sql +3 -0
  925. package/src/conformance/fixture/release/drift/escalate/0000_item.sql +5 -0
  926. package/src/conformance/fixture/release/drift/escalate/0001_escalate.sql +8 -0
  927. package/src/conformance/fixture/release/drift/v1/0000_item.sql +5 -0
  928. package/src/conformance/fixture/release/escape/0000_item.sql +3 -0
  929. package/src/conformance/fixture/release/escape/0001_escape.sql +5 -0
  930. package/src/conformance/fixture/release/misnamed/0000_item.sql +3 -0
  931. package/src/conformance/fixture/release/misnamed/0001_misname.sql +10 -0
  932. package/src/conformance/fixture/release/module.ts +119 -0
  933. package/src/conformance/fixture/release/outside/0000_item.sql +3 -0
  934. package/src/conformance/fixture/release/outside/0001_extra.sql +3 -0
  935. package/src/conformance/fixture/release/outside/0002_index.sql +4 -0
  936. package/src/conformance/fixture/release/outside/0003_later.sql +1 -0
  937. package/src/conformance/fixture/release/renamed/0000_item.sql +3 -0
  938. package/src/conformance/fixture/release/renamed/0001_misname.sql +10 -0
  939. package/src/conformance/fixture/release/renamed/0002_restore.sql +1 -0
  940. package/src/conformance/fixture/release/rogue/0000_item.sql +3 -0
  941. package/src/conformance/fixture/release/rogue/0001_extra.sql +3 -0
  942. package/src/conformance/fixture/release/rogue/0002_definer.sql +1 -0
  943. package/src/conformance/fixture/release/slow/0000_item.sql +5 -0
  944. package/src/conformance/fixture/release/undeclared/0000_item.sql +3 -0
  945. package/src/conformance/fixture/release/undeclared/0001_extra.sql +3 -0
  946. package/src/conformance/fixture/release/undeclared/0002_index.sql +1 -0
  947. package/src/conformance/fixture/release/v1/0000_item.sql +3 -0
  948. package/src/conformance/fixture/release/v2/0000_item.sql +3 -0
  949. package/src/conformance/fixture/release/v2/0001_extra.sql +3 -0
  950. package/src/conformance/fixture/release/v2/0002_label.sql +3 -0
  951. package/src/conformance/fixture/release/viewed-retyped/0000_item.sql +3 -0
  952. package/src/conformance/fixture/release/viewed-retyped/0001_retype.sql +1 -0
  953. package/src/conformance/kit-hash.ts +18 -0
  954. package/src/conformance/ledger/contract.ts +92 -0
  955. package/src/conformance/ledger/migrations/0000_entries.sql +8 -0
  956. package/src/conformance/ledger/server.ts +174 -0
  957. package/src/conformance/library/app.ts +38 -0
  958. package/src/conformance/library/contract.ts +66 -0
  959. package/src/conformance/library/migrations/0000_library.sql +14 -0
  960. package/src/conformance/library/schema.ts +27 -0
  961. package/src/conformance/library/server.ts +65 -0
  962. package/src/conformance/library/sync.gen.ts +47 -0
  963. package/src/conformance/locale/catalog.ts +111 -0
  964. package/src/conformance/notebook/app.ts +115 -0
  965. package/src/conformance/notebook/evals/pages.evals.json +94 -0
  966. package/src/conformance/notebook/migrations/0000_notebook.sql +10 -0
  967. package/src/conformance/notebook/module.ts +215 -0
  968. package/src/conformance/notebook/skills/meeting-notes.md +4 -0
  969. package/src/conformance/pad/app.ts +21 -0
  970. package/src/conformance/pad/contract.ts +69 -0
  971. package/src/conformance/pad/migrations/pad/0000_pad.sql +8 -0
  972. package/src/conformance/pad/migrations/pad/0001_live_copy.sql +2 -0
  973. package/src/conformance/pad/schema.ts +18 -0
  974. package/src/conformance/pad/server.ts +102 -0
  975. package/src/conformance/purchases/app.ts +34 -0
  976. package/src/conformance/purchases/contract.ts +161 -0
  977. package/src/conformance/purchases/migrations/0000_purchases.sql +17 -0
  978. package/src/conformance/purchases/server.ts +95 -0
  979. package/src/conformance/replica-search.mjs +22 -0
  980. package/src/conformance/studio/app.ts +298 -0
  981. package/src/conformance/studio/contract.ts +319 -0
  982. package/src/conformance/studio/migrations/billing/0000_billing.sql +6 -0
  983. package/src/conformance/studio/migrations/journal/0000_journal.sql +9 -0
  984. package/src/conformance/studio/migrations/mailbox/0000_mailbox.sql +7 -0
  985. package/src/conformance/studio/migrations/tasks/0000_tasks.sql +7 -0
  986. package/src/conformance/workshop/app.ts +14 -0
  987. package/src/conformance/workshop/migrations/0000_notes.sql +7 -0
  988. package/src/conformance/workshop/module.ts +79 -0
  989. package/src/fakes/AcmeFake.ts +182 -0
  990. package/src/fakes/ApnsFake.ts +245 -0
  991. package/src/fakes/FcmFake.ts +231 -0
  992. package/src/fakes/GoogleFake.ts +1346 -0
  993. package/src/fakes/HttpApiFake.ts +116 -0
  994. package/src/fakes/McpFake.ts +355 -0
  995. package/src/fakes/MicrosoftGraphFake.ts +1191 -0
  996. package/src/fakes/S3Fake.ts +376 -0
  997. package/src/fakes/Server.ts +445 -0
  998. package/src/fakes/SignInProviderFake.ts +70 -0
  999. package/src/fakes/SlackFake.ts +893 -0
  1000. package/src/fakes/Store.ts +96 -0
  1001. package/src/fakes/TelemetryFakes.ts +197 -0
  1002. package/src/fakes/TestCa.ts +166 -0
  1003. package/src/fakes/WorkOsFake.ts +136 -0
  1004. package/src/index.ts +9 -0
  1005. package/src/make/reference.ts +259 -0
  1006. package/src/make/sources.ts +836 -0
@@ -0,0 +1,665 @@
1
+ /**
2
+ * Conformance kit for the Invocation contract (docs/contracts/invocation.md):
3
+ * the stage order and the standard error set, the result envelope, record
4
+ * authorisation before and after the handler, exact and best-effort targets,
5
+ * immutable identities, replay receipts and idempotency scoping.
6
+ *
7
+ * Usage, in a Vitest file: `invocationConformance(() => startMyKernel())`,
8
+ * where the subject serves the conformance fixture app (see `./Subject.ts`).
9
+ */
10
+ import { ActionResult, isReplay } from "@eloxiv/contracts";
11
+ import { Schema } from "effect";
12
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
13
+ import { failureOf, outcome, } from "./Subject.js";
14
+ /** The fixture's users and their organisations (the first is the default organisation). */
15
+ const MEMBERSHIPS = {
16
+ alice: ["acme", "globex"],
17
+ bob: ["acme"],
18
+ carol: ["globex"],
19
+ dave: ["acme"],
20
+ erin: ["acme"],
21
+ frank: ["acme"],
22
+ };
23
+ /** Every key a receipt may have (Receipt.ts): never an output field. */
24
+ const RECEIPT_KEYS = [
25
+ "version",
26
+ "action",
27
+ "invocationId",
28
+ "outcome",
29
+ "targets",
30
+ "created",
31
+ "effects",
32
+ "completion",
33
+ "events",
34
+ "provenance",
35
+ "written",
36
+ ];
37
+ /** The keys every receipt of this version has. */
38
+ const RECEIPT_REQUIRED = [
39
+ "action",
40
+ "completion",
41
+ "created",
42
+ "events",
43
+ "invocationId",
44
+ "outcome",
45
+ "provenance",
46
+ "targets",
47
+ ];
48
+ const PROVENANCE_KEYS = ["causationId", "correlationId", "idempotencyKey", "origin", "runId"];
49
+ export const invocationConformance = (start) => describe("Invocation contract", () => {
50
+ let subject;
51
+ const users = {};
52
+ beforeAll(async () => {
53
+ subject = await start();
54
+ for (const [name, orgs] of Object.entries(MEMBERSHIPS))
55
+ users[name] = await subject.user(name, orgs);
56
+ });
57
+ afterAll(() => subject?.dispose());
58
+ const call = (who, action, input, options = {}) => subject.invoke({ action, input, token: users[who].token, org: options.org, idempotencyKey: options.key });
59
+ const invoke = async (who, action, input, options = {}) => outcome(await call(who, action, input, options));
60
+ const query = (text, params = []) => subject.sql(text, params);
61
+ const create = async (who, title, org) => {
62
+ const result = await invoke(who, "docs.create", { title }, org === undefined ? {} : { org });
63
+ if (!result.ok)
64
+ throw new Error(`create failed: ${result.error}`);
65
+ return result.output.id;
66
+ };
67
+ const row = async (id) => (await query(`SELECT title, owner_id AS "ownerId", locked FROM docs.doc WHERE id = $1`, [id]))[0];
68
+ const audits = async (action) => (await subject.audit({ action })).map((r) => ({ outcome: r.outcome, errorTag: r.errorTag }));
69
+ const lastAudit = async (action) => (await subject.audit({ action })).at(-1);
70
+ const grant = (resourceId, who, permission = "edit") => subject.share({
71
+ resourceType: "Docs::Doc",
72
+ resourceId,
73
+ granteeUserId: users[who].id,
74
+ permission,
75
+ grantedBy: users.alice.id,
76
+ });
77
+ /** A replay's result: the replay envelope holding the receipt, and nothing else (no output fields). */
78
+ const receiptOf = (result) => {
79
+ if (!result.ok || !result.replayed)
80
+ return undefined;
81
+ const envelope = result.output;
82
+ expect(Object.keys(envelope).sort()).toEqual(["kind", "receipt"]);
83
+ expect(envelope.kind).toBe("replay");
84
+ // Exactly the receipt's facts (version 2): those every receipt has, and what applies to the call.
85
+ const keys = Object.keys(envelope.receipt);
86
+ for (const key of RECEIPT_REQUIRED)
87
+ expect(keys, `receipt key ${key}`).toContain(key);
88
+ for (const key of keys)
89
+ expect(RECEIPT_KEYS, `receipt key ${key}`).toContain(key);
90
+ const full = envelope.receipt;
91
+ expect(full["version"]).toBe(2);
92
+ // Event references by CloudEvents identity, never a payload; provenance ids, never a value.
93
+ for (const event of full["events"]) {
94
+ expect(Object.keys(event).sort()).toEqual(["id", "source", "specversion", "type"]);
95
+ expect(event).toMatchObject({ specversion: "1.0", source: expect.stringMatching(/^\/modules\//u) });
96
+ }
97
+ expect(Object.keys(full["provenance"]).sort()).toEqual(PROVENANCE_KEYS);
98
+ if (full["written"] !== undefined)
99
+ expect(Object.keys(full["written"]).sort()).toEqual(["inserted", "updated"]);
100
+ return envelope.receipt;
101
+ };
102
+ /** The record a create wrote: from its output, or from the receipt on a replay. */
103
+ const createdId = (result) => result.ok ? (result.replayed ? receiptOf(result)?.created[0] : result.output.id) : undefined;
104
+ /** Backends of this database waiting on a lock, other than advisory locks (a claim held by another call). */
105
+ const waitingOnClaim = async () => (await query(`SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event_type = 'Lock' AND wait_event <> 'advisory'`)).length > 0;
106
+ const waitingOnBarrier = async () => (await query(`SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event_type = 'Lock' AND wait_event = 'advisory'`)).length > 0;
107
+ const until = async (what, check) => {
108
+ const deadline = Date.now() + 10_000;
109
+ while (!(await check())) {
110
+ if (Date.now() > deadline)
111
+ throw new Error(`Timed out waiting for ${what}`);
112
+ await new Promise((r) => setTimeout(r, 10));
113
+ }
114
+ };
115
+ describe("stages run in order: lookup and decoding, identity, policy, approval, idempotency, execute, audit, outbox", () => {
116
+ it("looks up the action and decodes its input before identity", async () => {
117
+ const anonymous = (action, input) => subject.invoke({ action, input, token: "not-a-session" });
118
+ expect(await anonymous("docs.nope", {})).toMatchObject({ ok: false, error: { _tag: "UnknownAction" } });
119
+ expect(await anonymous("docs.create", { title: 42 })).toMatchObject({
120
+ ok: false,
121
+ error: { _tag: "InvalidInput" },
122
+ });
123
+ });
124
+ it("checks identity before policy and approval: an unauthenticated call fails as Unauthenticated, even where policy would deny", async () => {
125
+ for (const action of ["docs.create", "docs.archive", "docs.signOff"]) {
126
+ expect(await subject.invoke({ action, input: { title: "x", id: "x" }, token: "not-a-session" })).toEqual({
127
+ ok: false,
128
+ error: expect.objectContaining({ _tag: "Unauthenticated" }),
129
+ });
130
+ }
131
+ });
132
+ it("reaches exactly what it would not refuse before reading the input, and still refuses a hidden action", async () => {
133
+ // docs.archive's policy cannot be compiled and docs.emailGated is constant false for anyone but frank.
134
+ const alice = await subject.reach({ token: users.alice.token });
135
+ const frank = await subject.reach({ token: users.frank.token });
136
+ expect(alice.ok && frank.ok).toBe(true);
137
+ if (!alice.ok || !frank.ok)
138
+ return;
139
+ expect(alice.actions).toEqual([...alice.actions].sort());
140
+ expect(alice.actions).toContain("docs.create");
141
+ expect(alice.actions).not.toContain("docs.archive");
142
+ expect(alice.actions).not.toContain("docs.emailGated");
143
+ expect(frank.actions).toContain("docs.emailGated");
144
+ expect(await invoke("alice", "docs.emailGated", { n: 7 })).toEqual({ ok: false, error: "Forbidden" });
145
+ expect(await subject.reach({ token: "not-a-session" })).toEqual({ ok: false, error: "Unauthenticated" });
146
+ expect(await subject.reach({ token: users.bob.token, org: "globex" })).toEqual({
147
+ ok: false,
148
+ error: "Forbidden",
149
+ });
150
+ });
151
+ it("refuses to act in an organisation the caller does not belong to", async () => {
152
+ expect(await invoke("bob", "docs.create", { title: "Elsewhere" }, { org: "globex" })).toEqual({
153
+ ok: false,
154
+ error: "Forbidden",
155
+ });
156
+ expect(await query(`SELECT 1 FROM docs.doc WHERE title = 'Elsewhere'`)).toEqual([]);
157
+ });
158
+ it("checks policy before approval: a denied action never reaches the approval stage", async () => {
159
+ const id = await create("alice", "draft-approval");
160
+ expect(await invoke("alice", "docs.archive", { id })).toEqual({ ok: false, error: "Forbidden" });
161
+ });
162
+ it("blocks at the approval stage before anything is written or emitted", async () => {
163
+ const title = `Needs sign-off ${Date.now()}`;
164
+ expect(await invoke("alice", "docs.signOff", { title })).toEqual({ ok: false, error: "ApprovalRequired" });
165
+ expect(await query(`SELECT 1 FROM docs.doc WHERE title = $1`, [title])).toEqual([]);
166
+ expect((await subject.outbox.events({ type: "docs.created" })).map((e) => e.payload)).not.toContainEqual(expect.objectContaining({ title }));
167
+ expect((await subject.audit({ action: "docs.signOff" })).at(-1)).toMatchObject({
168
+ outcome: "approval-required",
169
+ errorTag: "ApprovalRequired",
170
+ });
171
+ });
172
+ it("runs approval before idempotency: a blocked call claims no key, so a retry is blocked again", async () => {
173
+ const key = `approval-${Date.now()}`;
174
+ expect(await invoke("alice", "docs.signOff", { title: "Again" }, { key })).toEqual({
175
+ ok: false,
176
+ error: "ApprovalRequired",
177
+ });
178
+ expect(await invoke("alice", "docs.signOff", { title: "Again" }, { key })).toEqual({
179
+ ok: false,
180
+ error: "ApprovalRequired",
181
+ });
182
+ expect((await subject.audit({ idempotencyKey: key })).map((r) => r.outcome)).toEqual([
183
+ "approval-required",
184
+ "approval-required",
185
+ ]);
186
+ });
187
+ it("fails with the standard error set: UnknownAction, InvalidInput, ActionFailed", async () => {
188
+ expect(await invoke("alice", "docs.nope", {})).toEqual({ ok: false, error: "UnknownAction" });
189
+ expect(await invoke("alice", "docs.create", { title: 42 })).toEqual({ ok: false, error: "InvalidInput" });
190
+ expect(await invoke("alice", "docs.rename", { title: "No target" })).toEqual({
191
+ ok: false,
192
+ error: "InvalidInput",
193
+ });
194
+ expect(await invoke("alice", "docs.crash", { title: "Crashes" })).toEqual({
195
+ ok: false,
196
+ error: "ActionFailed",
197
+ });
198
+ expect(await query(`SELECT 1 FROM docs.doc WHERE title = 'Crashes'`)).toEqual([]);
199
+ });
200
+ });
201
+ describe("every result is an envelope", () => {
202
+ it("returns { kind: output, output } on first execution and { kind: replay, receipt } on a replay", async () => {
203
+ const first = await call("alice", "docs.create", { title: "Enveloped" }, { key: "envelope-1" });
204
+ const again = await call("alice", "docs.create", { title: "Enveloped" }, { key: "envelope-1" });
205
+ if (!first.ok || !again.ok)
206
+ throw new Error("expected both calls to succeed");
207
+ expect(Schema.is(ActionResult)(first.result)).toBe(true);
208
+ expect(first.result).toEqual({ kind: "output", output: { id: expect.any(String) } });
209
+ expect(isReplay(first.result)).toBe(false);
210
+ expect(isReplay(again.result)).toBe(true);
211
+ const receipt = again.result.receipt;
212
+ expect(again.result).toEqual({
213
+ kind: "replay",
214
+ receipt: {
215
+ version: 2,
216
+ action: "docs.create",
217
+ invocationId: expect.any(String),
218
+ outcome: "succeeded",
219
+ targets: [],
220
+ created: [first.result.output.id],
221
+ completion: null,
222
+ events: expect.any(Array),
223
+ // A person's own call: it correlates with itself and nothing caused it.
224
+ provenance: {
225
+ correlationId: receipt.invocationId,
226
+ causationId: null,
227
+ runId: null,
228
+ idempotencyKey: "envelope-1",
229
+ origin: "person",
230
+ },
231
+ // An untargeted write says what it wrote.
232
+ written: { inserted: 1, updated: 0 },
233
+ },
234
+ });
235
+ });
236
+ });
237
+ describe("record authorisation happens before the handler and covers every affected row", () => {
238
+ it("denies an action that would change ownership of someone else's record", async () => {
239
+ const id = await create("alice", "Alice's plan");
240
+ expect(await invoke("bob", "docs.transfer", { id })).toEqual({ ok: false, error: "Forbidden" });
241
+ expect((await row(id))?.ownerId).toBe(users.alice.id);
242
+ });
243
+ it("denies an action that would clear the lock its forbid checks", async () => {
244
+ const id = await create("alice", "Locked plan");
245
+ await query(`UPDATE docs.doc SET locked = true WHERE id = $1`, [id]);
246
+ expect(await invoke("alice", "docs.edit", { id, title: "Unlocked by stealth" })).toEqual({
247
+ ok: false,
248
+ error: "Forbidden",
249
+ });
250
+ expect(await row(id)).toMatchObject({ title: "Locked plan", locked: true });
251
+ });
252
+ it("fails a targeted action that affects more than its target, and rolls it back", async () => {
253
+ const mine = await create("alice", "Mine");
254
+ const alsoMine = await create("alice", "Also mine");
255
+ const theirs = await create("bob", "Theirs");
256
+ expect(await invoke("alice", "docs.renameAll", { id: mine, title: "Overwritten" })).toEqual({
257
+ ok: false,
258
+ error: "Forbidden",
259
+ });
260
+ expect((await row(theirs))?.title).toBe("Theirs");
261
+ expect((await row(alsoMine))?.title).toBe("Also mine");
262
+ expect(await lastAudit("docs.renameAll")).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
263
+ });
264
+ it("denies deleting rows that were not the authorised target", async () => {
265
+ const mine = await create("alice", "Keep me");
266
+ const theirs = await create("bob", "Do not delete");
267
+ expect(await invoke("alice", "docs.purge", { id: mine })).toEqual({ ok: false, error: "Forbidden" });
268
+ expect(await row(theirs)).toBeDefined();
269
+ });
270
+ it("still allows the legitimate path", async () => {
271
+ const id = await create("alice", "Draft");
272
+ expect(await invoke("alice", "docs.rename", { id, title: "Final" })).toMatchObject({ ok: true });
273
+ expect((await row(id))?.title).toBe("Final");
274
+ });
275
+ it("does not let a side-effect update rewrite another record into a passing shape", async () => {
276
+ const mine = await create("alice", "Alice's own");
277
+ const theirs = await create("bob", "Bob's locked");
278
+ await query(`UPDATE docs.doc SET locked = true WHERE id = $1`, [theirs]);
279
+ expect(await invoke("alice", "docs.hijack", { id: mine, other: theirs })).toEqual({
280
+ ok: false,
281
+ error: "Forbidden",
282
+ });
283
+ expect(await row(theirs)).toMatchObject({ ownerId: users.bob.id, locked: true });
284
+ expect(await lastAudit("docs.hijack")).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
285
+ });
286
+ });
287
+ describe("exact and best-effort targets", () => {
288
+ it.each([
289
+ ["docs.upsertOther", "ON CONFLICT DO UPDATE onto another document"],
290
+ ["docs.joinedRename", "UPDATE ... FROM"],
291
+ ["docs.cteRename", "a data-modifying CTE"],
292
+ ])("%s (%s) fails as Forbidden, rolls back and is audited", async (action) => {
293
+ const mine = await create("alice", "Own target");
294
+ const theirs = await create("bob", "Not hers");
295
+ expect(await invoke("alice", action, { id: mine, other: theirs })).toEqual({ ok: false, error: "Forbidden" });
296
+ expect(await row(theirs)).toMatchObject({ title: "Not hers", ownerId: users.bob.id });
297
+ expect((await row(mine))?.title).toBe("Own target");
298
+ expect(await lastAudit(action)).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
299
+ });
300
+ it("never rewrites another user's child rows through a parent key change (referential actions)", async () => {
301
+ const parent = await create("alice", "Parent");
302
+ await query(`INSERT INTO docs.attachment (id, org_id, owner_id, doc_id) VALUES ($1, 'acme', $2, $3)`, [
303
+ `att-${parent}`,
304
+ users.bob.id,
305
+ parent,
306
+ ]);
307
+ // The outcome must not depend on whether an unreadable child exists (keys are immutable).
308
+ expect(await invoke("alice", "docs.rekey", { id: parent, newId: `${parent}-2` })).toEqual({
309
+ ok: false,
310
+ error: "Forbidden",
311
+ });
312
+ const childless = await create("alice", "No children");
313
+ expect(await invoke("alice", "docs.rekey", { id: childless, newId: `${childless}-2` })).toEqual({
314
+ ok: false,
315
+ error: "Forbidden",
316
+ });
317
+ expect(await row(childless)).toBeDefined();
318
+ const [child] = await query(`SELECT doc_id AS "docId", owner_id AS "ownerId" FROM docs.attachment WHERE id = $1`, [`att-${parent}`]);
319
+ expect(child).toEqual({ docId: parent, ownerId: users.bob.id });
320
+ expect(await lastAudit("docs.rekey")).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
321
+ });
322
+ it("refuses moving an authorised row into a forbidden state", async () => {
323
+ const mine = await create("alice", "Keep ownership");
324
+ expect(await invoke("alice", "docs.giveAway", { id: mine, to: users.bob.id })).toEqual({
325
+ ok: false,
326
+ error: "Forbidden",
327
+ });
328
+ expect((await row(mine))?.ownerId).toBe(users.alice.id);
329
+ expect(await lastAudit("docs.giveAway")).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
330
+ });
331
+ it("fails an exact action that leaves its declared target untouched", async () => {
332
+ const mine = await create("alice", "Untouched");
333
+ expect(await invoke("alice", "docs.skip", { id: mine })).toEqual({ ok: false, error: "Forbidden" });
334
+ expect(await lastAudit("docs.skip")).toMatchObject({ outcome: "denied", errorTag: "Forbidden" });
335
+ });
336
+ it("reports best-effort completion in the result and the audit record, without revealing inaccessible records", async () => {
337
+ const a = await create("alice", "A");
338
+ const b = await create("alice", "B");
339
+ const theirs = await create("bob", "Bob's");
340
+ expect(await invoke("alice", "docs.renameMany", { ids: [a, b, theirs], title: "Bulk" })).toMatchObject({
341
+ ok: true,
342
+ output: { affected: 2, requested: 3, completion: "partial" },
343
+ });
344
+ expect((await row(theirs))?.title).toBe("Bob's");
345
+ expect(await lastAudit("docs.renameMany")).toMatchObject({
346
+ outcome: "succeeded",
347
+ affected: 2,
348
+ requested: 3,
349
+ completion: "partial",
350
+ });
351
+ expect(await invoke("alice", "docs.renameMany", { ids: [a, b], title: "Bulk 2" })).toMatchObject({
352
+ ok: true,
353
+ output: { affected: 2, requested: 2, completion: "complete" },
354
+ });
355
+ });
356
+ });
357
+ describe("identities and constraint outcomes", () => {
358
+ it("does not let an action move another record onto its target's key", async () => {
359
+ const target = await create("alice", "Alice's target");
360
+ const theirs = await create("bob", "Bob's locked");
361
+ await query(`UPDATE docs.doc SET locked = true WHERE id = $1`, [theirs]);
362
+ expect(await invoke("alice", "docs.swap", { id: target, other: theirs })).toEqual({
363
+ ok: false,
364
+ error: "Forbidden",
365
+ });
366
+ expect(await row(target)).toEqual({ title: "Alice's target", ownerId: users.alice.id, locked: false });
367
+ expect(await row(theirs)).toEqual({ title: "Bob's locked", ownerId: users.bob.id, locked: true });
368
+ expect(await audits("docs.swap")).toEqual([{ outcome: "denied", errorTag: "Forbidden" }]);
369
+ });
370
+ it("refuses an undeclared insert the same way whether or not an unreadable record holds the key", async () => {
371
+ const mine = await create("bob", "Bob's target");
372
+ const unreadable = await create("alice", "Alice's globex plan", "globex");
373
+ const absent = `absent-${Date.now()}`;
374
+ const withConflict = failureOf(await call("bob", "docs.claim", { id: mine, other: unreadable }));
375
+ const withoutConflict = failureOf(await call("bob", "docs.claim", { id: mine, other: absent }));
376
+ expect(withConflict).toEqual(withoutConflict);
377
+ expect(withConflict?.tag).toBe("Forbidden");
378
+ expect((await row(mine))?.title).toBe("Bob's target");
379
+ expect(await row(absent)).toBeUndefined();
380
+ expect((await row(unreadable))?.title).toBe("Alice's globex plan");
381
+ });
382
+ it("refuses a reference to a record the caller cannot read the same way as one to a record that does not exist", async () => {
383
+ const unreadable = await create("alice", "Alice's globex parent", "globex");
384
+ const attachments = async () => (await query(`SELECT 1 FROM docs.attachment WHERE owner_id = $1`, [users.erin.id])).length;
385
+ const before = await attachments();
386
+ const toUnreadable = failureOf(await call("erin", "docs.addAttachment", { docId: unreadable }));
387
+ const toMissing = failureOf(await call("erin", "docs.addAttachment", { docId: `missing-${Date.now()}` }));
388
+ expect(toUnreadable).toEqual(toMissing);
389
+ expect(toUnreadable?.tag).toBe("Forbidden");
390
+ expect(await attachments()).toBe(before);
391
+ // A record the caller can read is referenced as before.
392
+ const readable = await create("erin", "Erin's parent");
393
+ expect(await invoke("erin", "docs.addAttachment", { docId: readable })).toMatchObject({ ok: true });
394
+ expect(await attachments()).toBe(before + 1);
395
+ });
396
+ it("refuses deleting a referenced record the same way whether or not the caller can read the reference (the stated limit)", async () => {
397
+ // Deleting a record another references fails while the reference exists; the failure says no more than
398
+ // that, whether or not the caller can read the referencing record (docs/scaffold.md, known gap 11).
399
+ const withUnreadable = await create("dave", "Dave's, with Bob's attachment");
400
+ const withReadable = await create("dave", "Dave's, with his own attachment");
401
+ const attach = (id, owner, doc) => query(`INSERT INTO docs.attachment (id, org_id, owner_id, doc_id) VALUES ($1, 'acme', $2, $3)`, [
402
+ id,
403
+ owner,
404
+ doc,
405
+ ]);
406
+ await attach(`att-${withUnreadable}`, users.bob.id, withUnreadable);
407
+ await attach(`att-${withReadable}`, users.dave.id, withReadable);
408
+ const unreadableChild = failureOf(await call("dave", "docs.remove", { id: withUnreadable }));
409
+ const readableChild = failureOf(await call("dave", "docs.remove", { id: withReadable }));
410
+ expect(unreadableChild).toEqual(readableChild);
411
+ expect(unreadableChild).toEqual({
412
+ tag: "ActionFailed",
413
+ message: "The change conflicts with another record (a unique key, or a record that refers to this one)",
414
+ });
415
+ expect(unreadableChild?.message).not.toContain(withUnreadable);
416
+ expect(unreadableChild?.message).not.toContain("attachment");
417
+ expect(await row(withUnreadable)).toBeDefined();
418
+ });
419
+ });
420
+ describe("an idempotent replay returns a receipt of the call's own effects, never cached output", () => {
421
+ // The facts compared by value; the receipt's other keys and their shapes are checked by `receiptOf`.
422
+ const receipt = (action, extra = {}) => expect.objectContaining({
423
+ version: 2,
424
+ action,
425
+ invocationId: expect.any(String),
426
+ outcome: "succeeded",
427
+ targets: [],
428
+ created: [],
429
+ completion: null,
430
+ ...extra,
431
+ });
432
+ it("returns only the receipt after the sharing grant that allowed the original call is revoked", async () => {
433
+ const id = await create("alice", "Shared");
434
+ const grantId = await grant(id, "bob");
435
+ expect(await invoke("bob", "docs.rename", { id, title: "Bob's edit" }, { key: "replay-grant" })).toMatchObject({
436
+ ok: true,
437
+ replayed: false,
438
+ });
439
+ await subject.unshare(grantId);
440
+ // The revocation took effect: a new call is refused.
441
+ expect(await invoke("bob", "docs.rename", { id, title: "Bob's edit" }, { key: "after-grant" })).toEqual({
442
+ ok: false,
443
+ error: "Forbidden",
444
+ });
445
+ expect(receiptOf(await invoke("bob", "docs.rename", { id, title: "Bob's edit" }, { key: "replay-grant" }))).toEqual(receipt("docs.rename", { targets: [id] }));
446
+ });
447
+ it("returns only the receipt once a forbid applies to the record (the call is not re-run)", async () => {
448
+ const id = await create("alice", "Soon locked");
449
+ expect((await invoke("alice", "docs.rename", { id, title: "Renamed" }, { key: "replay-forbid" })).ok).toBe(true);
450
+ await query(`UPDATE docs.doc SET locked = true WHERE id = $1`, [id]);
451
+ expect(receiptOf(await invoke("alice", "docs.rename", { id, title: "Renamed" }, { key: "replay-forbid" }))).toEqual(receipt("docs.rename", { targets: [id] }));
452
+ });
453
+ it("does not return what a create-or-get read without writing", async () => {
454
+ const id = `private-${Date.now()}`;
455
+ // Private to Alice, in Carol's organisation (a grant counts only in its record's organisation).
456
+ await query(`INSERT INTO docs.doc (id, org_id, owner_id, title) VALUES ($1, 'globex', $2, 'Private plans')`, [
457
+ id,
458
+ users.alice.id,
459
+ ]);
460
+ const grantId = await grant(id, "carol", "read");
461
+ expect(await invoke("carol", "docs.ensure", { id, title: "ignored" }, { key: "ensure-1" })).toMatchObject({
462
+ ok: true,
463
+ output: { title: "Private plans" },
464
+ });
465
+ await subject.unshare(grantId);
466
+ const again = await invoke("carol", "docs.ensure", { id, title: "ignored" }, { key: "ensure-1" });
467
+ expect(receiptOf(again)).toEqual(receipt("docs.ensure"));
468
+ expect(JSON.stringify(again)).not.toContain("Private plans");
469
+ });
470
+ it("replays a successful delete as its receipt", async () => {
471
+ const id = await create("alice", "To delete");
472
+ expect(await invoke("alice", "docs.remove", { id }, { key: "delete-1" })).toMatchObject({
473
+ ok: true,
474
+ replayed: false,
475
+ });
476
+ expect(await row(id)).toBeUndefined();
477
+ expect(receiptOf(await invoke("alice", "docs.remove", { id }, { key: "delete-1" }))).toEqual(receipt("docs.remove", { targets: [id] }));
478
+ // Keys are per actor and organisation: another caller's call with the same key runs (and is refused).
479
+ expect(await invoke("bob", "docs.remove", { id }, { key: "delete-1" })).toEqual({
480
+ ok: false,
481
+ error: "Forbidden",
482
+ });
483
+ });
484
+ it("returns the receipt, with the record the call wrote, while the caller is still authorised", async () => {
485
+ const id = await create("alice", "Stable");
486
+ expect(await invoke("alice", "docs.rename", { id, title: "Once" }, { key: "replay-ok" })).toMatchObject({
487
+ ok: true,
488
+ replayed: false,
489
+ output: { id },
490
+ });
491
+ expect(receiptOf(await invoke("alice", "docs.rename", { id, title: "Once" }, { key: "replay-ok" }))).toEqual(receipt("docs.rename", { targets: [id] }));
492
+ });
493
+ it("rejects reuse of a key with a different input as IdempotencyConflict, without running the call", async () => {
494
+ const id = await create("alice", "Conflicted");
495
+ expect((await invoke("alice", "docs.rename", { id, title: "First" }, { key: "conflict-1" })).ok).toBe(true);
496
+ expect(await invoke("alice", "docs.rename", { id, title: "Second" }, { key: "conflict-1" })).toEqual({
497
+ ok: false,
498
+ error: "IdempotencyConflict",
499
+ });
500
+ expect((await row(id))?.title).toBe("First");
501
+ });
502
+ it.each([
503
+ ["docs.bundle", "nested records"],
504
+ ["docs.mapped", "record ids as map keys"],
505
+ ["docs.counted", "a count of records"],
506
+ ])("returns no output from %s (%s), before or after revocation", async (action) => {
507
+ const mine = await create("bob", "Bob's own");
508
+ const theirs = await create("alice", "Alice's private plans", "globex");
509
+ const grantId = await grant(theirs, "bob", "read");
510
+ const input = { id: mine, others: [theirs] };
511
+ const key = `${action}-${Date.now()}`;
512
+ expect(await invoke("bob", action, input, { key })).toMatchObject({ ok: true, replayed: false });
513
+ for (const step of ["authorised", "revoked"]) {
514
+ if (step === "revoked")
515
+ await subject.unshare(grantId);
516
+ const again = await invoke("bob", action, input, { key });
517
+ expect(receiptOf(again), step).toEqual(receipt(action, { targets: [mine] }));
518
+ expect(JSON.stringify(again)).not.toContain(theirs);
519
+ expect(JSON.stringify(again)).not.toContain("Alice's private plans");
520
+ }
521
+ // The revocation took effect: a new call no longer sees their record.
522
+ const fresh = await invoke("bob", action, input, { key: `${key}-fresh` });
523
+ expect(fresh).toMatchObject({ ok: true, replayed: false });
524
+ expect(JSON.stringify(fresh)).not.toContain(theirs);
525
+ });
526
+ it("returns no record of another entity the output named (joined entity)", async () => {
527
+ const mine = await create("alice", "With attachment");
528
+ const attachment = `att-${mine}`;
529
+ await query(`INSERT INTO docs.attachment (id, org_id, owner_id, doc_id) VALUES ($1, 'acme', $2, $3)`, [
530
+ attachment,
531
+ users.alice.id,
532
+ mine,
533
+ ]);
534
+ expect(await invoke("alice", "docs.withAttachment", { id: mine }, { key: "attach-1" })).toMatchObject({
535
+ ok: true,
536
+ output: { attachment: { id: attachment } },
537
+ });
538
+ await query(`UPDATE docs.attachment SET owner_id = $1 WHERE id = $2`, [users.bob.id, attachment]);
539
+ const again = await invoke("alice", "docs.withAttachment", { id: mine }, { key: "attach-1" });
540
+ expect(receiptOf(again)).toEqual(receipt("docs.withAttachment", { targets: [mine] }));
541
+ expect(JSON.stringify(again)).not.toContain(attachment);
542
+ });
543
+ it("reports only best-effort counts, never which targets were affected", async () => {
544
+ const a = await create("alice", "A");
545
+ const theirs = await create("bob", "Bob's");
546
+ const input = { ids: [a, theirs], title: "Bulk" };
547
+ expect((await invoke("alice", "docs.renameMany", input, { key: "bulk-1" })).ok).toBe(true);
548
+ // The targets are the ids the caller supplied, in the caller's order; nothing marks which were affected.
549
+ expect(receiptOf(await invoke("alice", "docs.renameMany", input, { key: "bulk-1" }))).toEqual(receipt("docs.renameMany", {
550
+ targets: [a, theirs],
551
+ completion: { affected: 1, requested: 2, completion: "partial" },
552
+ }));
553
+ });
554
+ it("does not reveal the ids of records an untargeted call updated", async () => {
555
+ const x = await create("alice", "Bulk X");
556
+ const y = await create("alice", "Bulk Y");
557
+ // The documents of hers she reads acting in acme (it writes those in her other organisations too).
558
+ const [mine] = await query(`SELECT count(*)::int AS n FROM docs.doc WHERE owner_id = $1 AND org_id = 'acme'`, [users.alice.id]);
559
+ const first = await invoke("alice", "docs.touchAll", { title: "Bulk new" }, { key: "touch-1" });
560
+ expect(first).toMatchObject({ ok: true, replayed: false });
561
+ const created = first.ok ? first.output.id : "";
562
+ // Access changes: X now belongs to Bob.
563
+ await query(`UPDATE docs.doc SET owner_id = $1 WHERE id = $2`, [users.bob.id, x]);
564
+ const again = await invoke("alice", "docs.touchAll", { title: "Bulk new" }, { key: "touch-1" });
565
+ expect(receiptOf(again)).toEqual(receipt("docs.touchAll", { created: [created] }));
566
+ // It says how many it wrote that she may read (her documents here, and the one it created), never which.
567
+ expect(receiptOf(again).written).toEqual({ inserted: 1, updated: mine.n });
568
+ expect(JSON.stringify(again)).not.toContain(x);
569
+ expect(JSON.stringify(again)).not.toContain(y);
570
+ });
571
+ it("lists a created record only if the original output named it", async () => {
572
+ const title = `Two of them ${Date.now()}`;
573
+ const first = await invoke("alice", "docs.createTwo", { title }, { key: "two-1" });
574
+ const shown = first.ok ? first.output.id : "";
575
+ const ids = (await query(`SELECT id FROM docs.doc WHERE title = $1`, [title])).map((r) => r.id);
576
+ expect(ids).toHaveLength(2);
577
+ const hidden = ids.find((id) => id !== shown);
578
+ const again = await invoke("alice", "docs.createTwo", { title }, { key: "two-1" });
579
+ expect(receiptOf(again)).toEqual(receipt("docs.createTwo", { created: [shown] }));
580
+ expect(JSON.stringify(again)).not.toContain(hidden);
581
+ });
582
+ it("returns a create's own created id on replay", async () => {
583
+ const first = await invoke("alice", "docs.create", { title: "Mine to keep" }, { key: "create-1" });
584
+ const id = first.ok ? first.output.id : "";
585
+ expect(receiptOf(await invoke("alice", "docs.create", { title: "Mine to keep" }, { key: "create-1" }))).toEqual(receipt("docs.create", { created: [id] }));
586
+ });
587
+ it("never lists a secondary entity's inserted record as created, even when the output names it", async () => {
588
+ const first = await invoke("alice", "docs.withChild", { title: "Parent" }, { key: "child-1" });
589
+ expect(first).toMatchObject({ ok: true, replayed: false });
590
+ const { id, attachmentId } = (first.ok ? first.output : {});
591
+ expect(attachmentId).toEqual(expect.any(String));
592
+ const again = await invoke("alice", "docs.withChild", { title: "Parent" }, { key: "child-1" });
593
+ expect(receiptOf(again)).toEqual(receipt("docs.withChild", { created: [id] }));
594
+ expect(JSON.stringify(again)).not.toContain(attachmentId);
595
+ });
596
+ it("re-checks the action's policy after waiting on the first call's claim, when re-authentication still succeeds", async () => {
597
+ // docs.emailGated waits on advisory lock 4243 and is permitted only to frank@example.com.
598
+ const gate = await subject.barrier(4243);
599
+ const first = call("frank", "docs.emailGated", { n: 1 }, { key: "email-1" });
600
+ await until("the first call to hold its claim and wait on the barrier", waitingOnBarrier);
601
+ const duplicate = call("frank", "docs.emailGated", { n: 1 }, { key: "email-1" });
602
+ await until("the duplicate to wait on the first call's claim", waitingOnClaim);
603
+ // Frank stays the same user in the same organisation, but the attribute the policy reads changes.
604
+ await subject.setEmail(users.frank.id, "frank-moved@example.com");
605
+ await gate.release();
606
+ expect(outcome(await first)).toMatchObject({ ok: true, replayed: false });
607
+ expect(failureOf(await duplicate)).toEqual({ tag: "Forbidden", message: "Policy denies this action" });
608
+ });
609
+ it("makes a member's removal wait for their call and its duplicate waiting on its claim; their next call is refused", async () => {
610
+ const id = await create("erin", "Erin's gated doc");
611
+ // docs.gatedRename waits on advisory lock 4242 before renaming.
612
+ const gate = await subject.barrier(4242);
613
+ const input = { id, title: "Gated" };
614
+ const first = call("erin", "docs.gatedRename", input, { key: "gate-1" });
615
+ await until("the first call to hold its claim and wait on the barrier", waitingOnBarrier);
616
+ const duplicate = call("erin", "docs.gatedRename", input, { key: "gate-1" });
617
+ await until("the duplicate to wait on the first call's claim", waitingOnClaim);
618
+ // Erin leaves the organisation while both calls are in flight: each holds her membership (Authority), so
619
+ // the removal waits for them, and neither sees her half-removed.
620
+ const leaving = subject.leave(users.erin.id, "acme");
621
+ await until("the removal to wait for the calls", async () => (await query(`SELECT 1 FROM pg_stat_activity WHERE datname = current_database() AND wait_event_type = 'Lock'
622
+ AND query LIKE 'DELETE FROM eloxiv.membership%'`)).length > 0);
623
+ await gate.release();
624
+ expect(outcome(await first)).toMatchObject({ ok: true, replayed: false });
625
+ expect(outcome(await duplicate)).toMatchObject({ ok: true, replayed: true });
626
+ await leaving;
627
+ // Once the removal commits, nothing of hers runs.
628
+ expect(await invoke("erin", "docs.gatedRename", { id, title: "After leaving" }, { org: "acme", key: "gate-2" })).toEqual({ ok: false, error: "Forbidden" });
629
+ });
630
+ it("refuses a receipt to a caller who is no longer a member of the organisation", async () => {
631
+ const id = await create("dave", "Dave's draft");
632
+ expect((await invoke("dave", "docs.rename", { id, title: "Dave's final" }, { key: "member-1" })).ok).toBe(true);
633
+ await subject.leave(users.dave.id, "acme");
634
+ expect(await invoke("dave", "docs.rename", { id, title: "Dave's final" }, { org: "acme", key: "member-1" })).toEqual({ ok: false, error: "Forbidden" });
635
+ });
636
+ });
637
+ describe("idempotency keys are scoped by organisation, user and action", () => {
638
+ it("does not conflict or replay across organisations", async () => {
639
+ const acme = await invoke("alice", "docs.create", { title: "Same" }, { org: "acme", key: "org-key" });
640
+ const globex = await invoke("alice", "docs.create", { title: "Same" }, { org: "globex", key: "org-key" });
641
+ expect(acme).toMatchObject({ ok: true, replayed: false });
642
+ expect(globex).toMatchObject({ ok: true, replayed: false });
643
+ expect(acme.ok && globex.ok && acme.output.id !== globex.output.id).toBe(true);
644
+ const different = await invoke("alice", "docs.create", { title: "Different" }, { org: "globex", key: "org-key-2" });
645
+ const otherOrg = await invoke("alice", "docs.create", { title: "Other" }, { org: "acme", key: "org-key-2" });
646
+ expect(different.ok && otherOrg.ok).toBe(true);
647
+ });
648
+ it("executes concurrent calls once per actor and organisation", async () => {
649
+ const before = (await query(`SELECT count(*)::int AS n FROM docs.doc`))[0].n;
650
+ const results = await Promise.all([
651
+ invoke("alice", "docs.create", { title: "Concurrent" }, { org: "acme", key: "race" }),
652
+ invoke("alice", "docs.create", { title: "Concurrent" }, { org: "acme", key: "race" }),
653
+ invoke("bob", "docs.create", { title: "Concurrent" }, { org: "acme", key: "race" }),
654
+ invoke("alice", "docs.create", { title: "Concurrent" }, { org: "globex", key: "race" }),
655
+ ]);
656
+ expect(results.every((r) => r.ok)).toBe(true);
657
+ const ids = results.map((r) => createdId(r) ?? "");
658
+ expect(ids[0]).toBe(ids[1]);
659
+ expect(new Set(ids).size).toBe(3);
660
+ const after = (await query(`SELECT count(*)::int AS n FROM docs.doc`))[0].n;
661
+ expect(after - before).toBe(3);
662
+ });
663
+ });
664
+ });
665
+ //# sourceMappingURL=Invocation.js.map