@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,893 @@
1
+ /**
2
+ * A protocol fake of Slack: the OAuth v2 install flow, the Web API methods the `slack` connector uses, and the
3
+ * Events API's signed deliveries to a Request URL, following Slack's documentation (docs.slack.dev, read
4
+ * 2026-11-04):
5
+ *
6
+ * - OAuth v2: `GET /oauth/v2/authorize` (bot scopes in `scope`, comma-separated; `redirect_uri` must be HTTPS or
7
+ * localhost; the install is per workspace, and each consent adds its scopes to the workspace's grant) and
8
+ * `POST /api/oauth.v2.access` (client credentials by HTTP Basic or in the form; `grant_type=authorization_code`
9
+ * or `refresh_token`; the answer names the workspace in `team`, the bot in `bot_user_id` and the installing
10
+ * person in `authed_user`, and lists the scopes comma-separated in `scope`; PKCE arguments from an app that is
11
+ * not a public client are `pkce_not_allowed`). Without token rotation the bot token never expires and no
12
+ * refresh token is issued; with it (`tokenRotation`), access tokens expire after `expires_in` (43,200 s by
13
+ * default) and every refresh token works once.
14
+ * - Web API: every answer is HTTP 200 with `ok`, errors as `{ ok: false, error }` (`not_authed`, `invalid_auth`,
15
+ * `token_expired`, `token_revoked`, `missing_scope` with `needed` and `provided`, `channel_not_found`,
16
+ * `not_in_channel`, `thread_not_found`, `invalid_cursor`, `no_text`, `invalid_arguments`), except rate limits:
17
+ * HTTP 429 with `Retry-After` (seconds) and `{ ok: false, error: "ratelimited" }`. Responses carry
18
+ * `x-oauth-scopes`. Methods take a query string or a form or JSON body.
19
+ * - `auth.test`; `conversations.list` (`types`, the scope each type needs, `exclude_archived`, `limit`,
20
+ * cursors in `response_metadata.next_cursor`, empty at the end); `conversations.history` (newest first,
21
+ * thread replies left out, `latest`, `oldest`, `inclusive`, `limit`, `has_more` and cursors);
22
+ * `conversations.replies` (the parent first, then its replies oldest first, `limit` a page by cursor); `chat.postMessage` (`thread_ts`
23
+ * replies into the parent's thread; a bot must be in the channel unless it has `chat:write.public`).
24
+ * - Events API: a Request URL is verified with a signed `url_verification` whose `challenge` must come back
25
+ * (plain text, form or JSON) before it is used. Every message in a conversation the bot is in, for the bot
26
+ * events subscribed (`message.channels`, `message.groups`, `message.im`, `message.mpim`), is POSTed as an
27
+ * `event_callback` envelope (`event_id`, `team_id`, `api_app_id`, `authorizations`, `event_time`) signed with
28
+ * the signing secret (`x-slack-signature: v0=<hex>` over `v0:<timestamp>:<body>`). A delivery that is not
29
+ * answered 2xx within three seconds is retried three times with `x-slack-retry-num` and
30
+ * `x-slack-retry-reason`, each attempt signed afresh; `x-slack-no-retry: 1` on a failed answer stops the
31
+ * retries. The bot's own posts are delivered too, with `bot_id`.
32
+ *
33
+ * Not modelled: Slack's own per-method rate tiers (rate limits are injected), Enterprise Grid, Slack Connect,
34
+ * user tokens, edits, deletions, reactions, files, blocks, and the retry schedule's real delays (one minute and
35
+ * five minutes, shortened here to `retryDelaysMs`).
36
+ *
37
+ * Proven against a protocol fake, not the real service.
38
+ */
39
+ import { createHmac, randomBytes } from "node:crypto"
40
+ import { json, Router, serve, token, type FakeRequest, type FakeResponse } from "./Server.ts"
41
+
42
+ export type SlackChannelType = "public_channel" | "private_channel" | "im" | "mpim"
43
+
44
+ export interface SlackChannel {
45
+ readonly id: string
46
+ readonly name: string
47
+ readonly type: SlackChannelType
48
+ readonly members: Set<string>
49
+ readonly archived: boolean
50
+ }
51
+
52
+ export interface SlackMessage {
53
+ readonly ts: string
54
+ readonly channel: string
55
+ readonly user: string
56
+ readonly team: string
57
+ readonly text: string
58
+ readonly thread_ts: string | undefined
59
+ readonly bot_id: string | undefined
60
+ }
61
+
62
+ interface Team {
63
+ readonly id: string
64
+ readonly name: string
65
+ readonly domain: string
66
+ readonly users: Map<string, { readonly id: string; readonly name: string }>
67
+ readonly channels: Map<string, SlackChannel>
68
+ readonly messages: Array<SlackMessage>
69
+ /** The bot scopes granted to the app in this workspace (each consent adds to it). */
70
+ readonly scopes: Set<string>
71
+ installed: boolean
72
+ }
73
+
74
+ interface BotToken {
75
+ readonly team: string
76
+ expiresAt: number | null
77
+ valid: boolean
78
+ }
79
+
80
+ interface Code {
81
+ readonly team: string
82
+ readonly user: string
83
+ readonly redirectUri: string | undefined
84
+ readonly pkce: boolean
85
+ readonly expiresAt: number
86
+ used: boolean
87
+ }
88
+
89
+ const BOT_USER = "U0BOT0001"
90
+ const BOT_ID = "B0BOT0001"
91
+ const APP_ID = "A0FAKE0001"
92
+ /** A bot token's posts carry the app's bot profile, naming its bot user (as a real workspace delivers them). */
93
+ const botProfile = { id: "B0BOT0001", app_id: "A0FAKE0001", name: "eloxiv", deleted: false, user_id: "U0BOT0001" }
94
+
95
+ /** Where the scopes a conversation type needs (to list it, to read its history) come from. */
96
+ const READ_SCOPE: Record<SlackChannelType, string> = {
97
+ public_channel: "channels:read",
98
+ private_channel: "groups:read",
99
+ im: "im:read",
100
+ mpim: "mpim:read",
101
+ }
102
+ const HISTORY_SCOPE: Record<SlackChannelType, string> = {
103
+ public_channel: "channels:history",
104
+ private_channel: "groups:history",
105
+ im: "im:history",
106
+ mpim: "mpim:history",
107
+ }
108
+ const EVENT: Record<SlackChannelType, string> = {
109
+ public_channel: "message.channels",
110
+ private_channel: "message.groups",
111
+ im: "message.im",
112
+ mpim: "message.mpim",
113
+ }
114
+ const CHANNEL_TYPE: Record<SlackChannelType, string> = {
115
+ public_channel: "channel",
116
+ private_channel: "group",
117
+ im: "im",
118
+ mpim: "mpim",
119
+ }
120
+
121
+ const cursorOf = (value: string) => Buffer.from(value, "utf8").toString("base64")
122
+ const readCursor = (cursor: string, prefix: string) => {
123
+ const decoded = Buffer.from(cursor, "base64").toString("utf8")
124
+ return decoded.startsWith(prefix) ? decoded.slice(prefix.length) : undefined
125
+ }
126
+
127
+ /** Message timestamps: seconds and microseconds, unique and increasing in the workspace. */
128
+ let lastMicros = 0
129
+ const nextTs = () => {
130
+ lastMicros = Math.max(lastMicros + 1, Date.now() * 1000)
131
+ return `${Math.floor(lastMicros / 1_000_000)}.${String(lastMicros % 1_000_000).padStart(6, "0")}`
132
+ }
133
+ const compareTs = (a: string, b: string) => {
134
+ const [as, au] = a.split(".").map(Number)
135
+ const [bs, bu] = b.split(".").map(Number)
136
+ return as! - bs! || au! - bu!
137
+ }
138
+
139
+ export interface SlackFakeOptions {
140
+ /** Token rotation on (access tokens expire, refresh tokens rotate). Default false, Slack's default. */
141
+ readonly tokenRotation?: boolean | undefined
142
+ /** The access tokens' lifetime with rotation (Slack: 43,200 s). */
143
+ readonly accessTtlS?: number | undefined
144
+ /** The waits before the second and third retries of a failed delivery (Slack: one and five minutes). */
145
+ readonly retryDelaysMs?: readonly [number, number, number] | undefined
146
+ }
147
+
148
+ export const startSlackFake = async (options: SlackFakeOptions = {}) => {
149
+ const clientId = "1111111111.2222222222"
150
+ const clientSecret = randomBytes(16).toString("hex")
151
+ const signingSecret = randomBytes(16).toString("hex")
152
+ const rotation = options.tokenRotation ?? false
153
+ const accessTtlS = options.accessTtlS ?? 43_200
154
+ const retryDelaysMs = options.retryDelaysMs ?? [0, 200, 400]
155
+
156
+ const teams = new Map<string, Team>()
157
+ const addTeam = (id: string, name: string) => {
158
+ const team: Team = {
159
+ id,
160
+ name,
161
+ domain: name.toLowerCase().replaceAll(/[^a-z0-9]+/gu, "-"),
162
+ users: new Map(),
163
+ channels: new Map(),
164
+ messages: [],
165
+ scopes: new Set(),
166
+ installed: false,
167
+ }
168
+ teams.set(id, team)
169
+ return team
170
+ }
171
+ const channel = (team: Team, id: string, name: string, type: SlackChannelType, members: ReadonlyArray<string>) =>
172
+ team.channels.set(id, { id, name, type, members: new Set(members), archived: false })
173
+
174
+ // The main workspace: two people, the bot in #general, the private #ops and a DM with Ada; not in #random.
175
+ const main = addTeam("T0ELOXIV1", "Eloxiv Test")
176
+ for (const [id, name] of [
177
+ ["U0ADA0001", "ada"],
178
+ ["U0BEN0001", "ben"],
179
+ ] as const) {
180
+ main.users.set(id, { id, name })
181
+ }
182
+ channel(main, "C0GENERAL1", "general", "public_channel", ["U0ADA0001", "U0BEN0001", BOT_USER])
183
+ channel(main, "C0RANDOM01", "random", "public_channel", ["U0ADA0001"])
184
+ channel(main, "G0OPS00001", "ops", "private_channel", ["U0ADA0001", BOT_USER])
185
+ channel(main, "G0SECRET01", "secret", "private_channel", ["U0BEN0001"])
186
+ channel(main, "D0ADA00001", "", "im", ["U0ADA0001", BOT_USER])
187
+ for (let i = 1; i <= 5; i++) channel(main, `C0MORE0000${i}`, `more-${i}`, "public_channel", [BOT_USER])
188
+ channel(main, "C0OLD00001", "old", "public_channel", [BOT_USER])
189
+ ;(main.channels.get("C0OLD00001") as { archived: boolean }).archived = true
190
+ // A second workspace, for one Connection per workspace.
191
+ const other = addTeam("T0OTHER01", "Other Test")
192
+ other.users.set("U0ADA0002", { id: "U0ADA0002", name: "ada" })
193
+ channel(other, "C0OTHERGEN", "general", "public_channel", ["U0ADA0002", BOT_USER])
194
+ // A partner workspace sharing a Slack Connect channel with the main one: its people post as members of their own
195
+ // team (`user_team`), while the delivery names the workspace that received it.
196
+ const partner = addTeam("T0PARTNER1", "Partner Test")
197
+ partner.users.set("U0PAT00001", { id: "U0PAT00001", name: "pat" })
198
+ channel(partner, "C0SHARED01", "shared", "public_channel", ["U0PAT00001", "U0ADA0001", BOT_USER])
199
+
200
+ /** Who approves the next install: the person signed in to Slack, in the workspace they picked. */
201
+ const signedIn = { team: main.id, user: "U0ADA0001" }
202
+ let denyNext = false
203
+ let pkceEnabled = false
204
+
205
+ const codes = new Map<string, Code>()
206
+ const bots = new Map<string, BotToken>()
207
+ const refreshTokens = new Map<string, { team: string; valid: boolean }>()
208
+ /** Without rotation, one bot token per workspace for the life of the install. */
209
+ const standing = new Map<string, string>()
210
+ const authorizations: Array<Readonly<Record<string, string>>> = []
211
+ const stats = { codeExchanges: 0, refreshes: 0, refreshFailures: 0, apiRequests: 0 }
212
+ const issued: Array<string> = []
213
+ /** Injected rate limits: the next requests to a method (or any, `*`) answered 429 with Retry-After. */
214
+ const limits: Array<{ method: string; retryAfter: string }> = []
215
+ /** Injected answers: the next requests to a method answered with this raw body (malformed answers, for tests). */
216
+ const scripted: Array<{ method: string; status: number; body: string }> = []
217
+
218
+ // Events API ------------------------------------------------------------------------------------------------
219
+
220
+ let requestUrl: string | undefined
221
+ const botEvents = new Set(["message.channels", "message.groups", "message.im", "message.mpim"])
222
+ /** Deliveries whose first attempts are treated as failed (Slack timed out or lost the answer). */
223
+ let failAttempts = 0
224
+ const deliveries: Array<{
225
+ readonly eventId: string
226
+ readonly attempt: number
227
+ readonly status: number | "timeout" | "error"
228
+ readonly retryNum: string | null
229
+ }> = []
230
+ const pending = new Set<Promise<void>>()
231
+
232
+ const sign = (body: string, at = Math.floor(Date.now() / 1000)) => ({
233
+ "content-type": "application/json",
234
+ "x-slack-request-timestamp": String(at),
235
+ "x-slack-signature": `v0=${createHmac("sha256", signingSecret).update(`v0:${at}:${body}`).digest("hex")}`,
236
+ })
237
+
238
+ const post = async (url: string, body: string, headers: Record<string, string>) => {
239
+ const controller = new AbortController()
240
+ const timer = setTimeout(() => controller.abort(), 3_000)
241
+ try {
242
+ const response = await fetch(url, {
243
+ method: "POST",
244
+ body,
245
+ headers: { ...sign(body), ...headers },
246
+ signal: controller.signal,
247
+ })
248
+ return { status: response.status, text: await response.text(), headers: response.headers }
249
+ } catch (e) {
250
+ return {
251
+ status: controller.signal.aborted ? ("timeout" as const) : ("error" as const),
252
+ text: String(e),
253
+ headers: new Headers(),
254
+ }
255
+ } finally {
256
+ clearTimeout(timer)
257
+ }
258
+ }
259
+
260
+ /** POST an event envelope, retrying a failed attempt three times as Slack does. */
261
+ const deliver = (body: string, eventId: string) => {
262
+ const run = (async () => {
263
+ let previous: number | "timeout" | "error" = 200
264
+ for (let attempt = 0; attempt <= 3; attempt++) {
265
+ const url = requestUrl
266
+ if (url === undefined) return
267
+ if (attempt > 0) await new Promise((r) => setTimeout(r, retryDelaysMs[attempt - 1]))
268
+ const reason = previous === "timeout" ? "http_timeout" : "http_error"
269
+ const answer = await post(
270
+ url,
271
+ body,
272
+ attempt === 0 ? {} : { "x-slack-retry-num": String(attempt), "x-slack-retry-reason": reason },
273
+ )
274
+ const forced = failAttempts > 0
275
+ if (forced) failAttempts--
276
+ previous = forced ? "timeout" : answer.status
277
+ deliveries.push({ eventId, attempt, status: previous, retryNum: attempt === 0 ? null : String(attempt) })
278
+ if (!forced && typeof answer.status === "number" && answer.status >= 200 && answer.status < 300) return
279
+ if (answer.headers.get("x-slack-no-retry") === "1") return
280
+ }
281
+ })()
282
+ pending.add(run)
283
+ void run.finally(() => pending.delete(run))
284
+ return run
285
+ }
286
+
287
+ const envelope = (team: Team, message: SlackMessage, channelType: SlackChannelType) => {
288
+ const eventId = `Ev${randomBytes(5).toString("hex").toUpperCase()}`
289
+ const event: Record<string, unknown> = {
290
+ type: "message",
291
+ channel: message.channel,
292
+ user: message.user,
293
+ text: message.text,
294
+ ts: message.ts,
295
+ event_ts: message.ts,
296
+ channel_type: CHANNEL_TYPE[channelType],
297
+ team: message.team,
298
+ user_team: message.team,
299
+ ...(message.team === team.id ? {} : { source_team: message.team }),
300
+ ...(message.thread_ts === undefined ? {} : { thread_ts: message.thread_ts }),
301
+ ...(message.bot_id === undefined ? {} : { bot_id: message.bot_id, app_id: APP_ID, bot_profile: botProfile }),
302
+ }
303
+ const body = JSON.stringify({
304
+ token: "deprecated-verification-token",
305
+ team_id: team.id,
306
+ context_team_id: team.id,
307
+ context_enterprise_id: null,
308
+ api_app_id: APP_ID,
309
+ event,
310
+ type: "event_callback",
311
+ event_id: eventId,
312
+ event_time: Math.floor(Date.now() / 1000),
313
+ authorizations: [
314
+ { enterprise_id: null, team_id: team.id, user_id: BOT_USER, is_bot: true, is_enterprise_install: false },
315
+ ],
316
+ is_ext_shared_channel: message.team !== team.id,
317
+ event_context: `EC${randomBytes(6).toString("hex")}`,
318
+ })
319
+ return { body, eventId }
320
+ }
321
+
322
+ /** A new message: stored, and delivered to the Request URL if the bot sees the conversation and subscribed. */
323
+ const record = (team: Team, message: SlackMessage) => {
324
+ team.messages.push(message)
325
+ const where = team.channels.get(message.channel)!
326
+ if (!team.installed || !where.members.has(BOT_USER) || !botEvents.has(EVENT[where.type])) return undefined
327
+ const { body, eventId } = envelope(team, message, where.type)
328
+ return { eventId, delivered: deliver(body, eventId) }
329
+ }
330
+
331
+ // OAuth v2 ----------------------------------------------------------------------------------------------------
332
+
333
+ const slackError = (error: string, extra: Record<string, unknown> = {}, headers: Record<string, string> = {}) =>
334
+ json(200, { ok: false, error, ...extra }, headers)
335
+
336
+ const authorize = (request: FakeRequest): FakeResponse => {
337
+ const q = Object.fromEntries(request.url.searchParams)
338
+ authorizations.push(q)
339
+ if (q["client_id"] !== clientId)
340
+ return { status: 400, headers: { "content-type": "text/html" }, body: "invalid_client_id" }
341
+ const redirect = q["redirect_uri"]
342
+ if (redirect === undefined)
343
+ return { status: 400, headers: { "content-type": "text/html" }, body: "bad_redirect_uri" }
344
+ const back = new URL(redirect)
345
+ const local = back.hostname === "localhost" || back.hostname === "127.0.0.1"
346
+ if (back.protocol !== "https:" && !local) {
347
+ return { status: 400, headers: { "content-type": "text/html" }, body: "bad_redirect_uri: must use HTTPS" }
348
+ }
349
+ if (q["state"] !== undefined) back.searchParams.set("state", q["state"])
350
+ const fail = (error: string) => {
351
+ back.searchParams.set("error", error)
352
+ return { status: 302, headers: { location: back.toString() } }
353
+ }
354
+ const requested = (q["scope"] ?? "")
355
+ .split(",")
356
+ .map((s) => s.trim())
357
+ .filter((s) => s.length > 0)
358
+ if (requested.length === 0 && (q["user_scope"] ?? "") === "") return fail("invalid_scope")
359
+ if (requested.some((s) => !/^[a-z][a-z0-9_.-]*(:[a-z0-9_.-]+)*$/u.test(s))) return fail("invalid_scope")
360
+ if (denyNext) {
361
+ denyNext = false
362
+ return fail("access_denied")
363
+ }
364
+ const team = teams.get(signedIn.team)!
365
+ for (const scope of requested) team.scopes.add(scope)
366
+ team.installed = true
367
+ const code = `${Date.now()}.${randomBytes(12).toString("hex")}`
368
+ codes.set(code, {
369
+ team: team.id,
370
+ user: signedIn.user,
371
+ redirectUri: redirect,
372
+ pkce: q["code_challenge"] !== undefined,
373
+ expiresAt: Date.now() + 600_000,
374
+ used: false,
375
+ })
376
+ back.searchParams.set("code", code)
377
+ return { status: 302, headers: { location: back.toString() } }
378
+ }
379
+
380
+ const grant = (team: Team, user: string | undefined) => {
381
+ let access: string
382
+ let refresh: string | undefined
383
+ if (rotation) {
384
+ access = token("xoxe.xoxb-1-")
385
+ refresh = token("xoxe-1-")
386
+ bots.set(access, { team: team.id, expiresAt: Date.now() + accessTtlS * 1000, valid: true })
387
+ refreshTokens.set(refresh, { team: team.id, valid: true })
388
+ issued.push(access, refresh)
389
+ } else {
390
+ access = standing.get(team.id) ?? token(`xoxb-${team.id}-`)
391
+ if (!standing.has(team.id)) {
392
+ standing.set(team.id, access)
393
+ bots.set(access, { team: team.id, expiresAt: null, valid: true })
394
+ issued.push(access)
395
+ }
396
+ }
397
+ return json(200, {
398
+ ok: true,
399
+ access_token: access,
400
+ token_type: "bot",
401
+ scope: [...team.scopes].join(","),
402
+ bot_user_id: BOT_USER,
403
+ app_id: APP_ID,
404
+ team: { name: team.name, id: team.id },
405
+ enterprise: null,
406
+ is_enterprise_install: false,
407
+ ...(user === undefined ? {} : { authed_user: { id: user } }),
408
+ ...(refresh === undefined ? {} : { expires_in: accessTtlS, refresh_token: refresh }),
409
+ })
410
+ }
411
+
412
+ const access = (request: FakeRequest): FakeResponse => {
413
+ const form = new URLSearchParams(request.body)
414
+ let id = form.get("client_id")
415
+ let secret = form.get("client_secret")
416
+ const basic = request.headers["authorization"] ?? ""
417
+ if (basic.startsWith("Basic ")) {
418
+ const [user, pass] = Buffer.from(basic.slice(6), "base64").toString("utf8").split(":")
419
+ id = decodeURIComponent(user ?? "")
420
+ secret = decodeURIComponent(pass ?? "")
421
+ }
422
+ if (id !== clientId) return slackError("invalid_client_id")
423
+ if (secret !== clientSecret) return slackError("bad_client_secret")
424
+ const grantType = form.get("grant_type") ?? "authorization_code"
425
+ if (grantType === "refresh_token") {
426
+ stats.refreshes++
427
+ const presented = refreshTokens.get(form.get("refresh_token") ?? "")
428
+ if (!rotation || presented === undefined || !presented.valid) {
429
+ stats.refreshFailures++
430
+ return slackError("invalid_refresh_token")
431
+ }
432
+ // Refresh tokens are designed to be used once.
433
+ presented.valid = false
434
+ const team = teams.get(presented.team)!
435
+ if (!team.installed) {
436
+ stats.refreshFailures++
437
+ return slackError("invalid_refresh_token")
438
+ }
439
+ return grant(team, undefined)
440
+ }
441
+ if (grantType !== "authorization_code") return slackError("invalid_grant_type")
442
+ stats.codeExchanges++
443
+ const code = codes.get(form.get("code") ?? "")
444
+ if (code === undefined || code.used || code.expiresAt < Date.now()) return slackError("invalid_code")
445
+ code.used = true
446
+ if ((code.pkce || form.has("code_verifier")) && !pkceEnabled) return slackError("pkce_not_allowed")
447
+ if (code.redirectUri !== undefined && form.get("redirect_uri") !== code.redirectUri) {
448
+ return slackError("bad_redirect_uri")
449
+ }
450
+ return grant(teams.get(code.team)!, code.user)
451
+ }
452
+
453
+ // Web API -----------------------------------------------------------------------------------------------------
454
+
455
+ type Caller = { readonly team: Team }
456
+ const params = (request: FakeRequest): Record<string, string> => {
457
+ const out: Record<string, string> = Object.fromEntries(request.url.searchParams)
458
+ const type = request.headers["content-type"] ?? ""
459
+ if (type.startsWith("application/json") && request.json !== null && typeof request.json === "object") {
460
+ for (const [k, v] of Object.entries(request.json as Record<string, unknown>)) {
461
+ if (v !== undefined && v !== null) out[k] = typeof v === "string" ? v : JSON.stringify(v)
462
+ }
463
+ } else if (type.startsWith("application/x-www-form-urlencoded")) {
464
+ for (const [k, v] of new URLSearchParams(request.body)) out[k] = v
465
+ }
466
+ return out
467
+ }
468
+
469
+ const method =
470
+ (
471
+ name: string,
472
+ needs: ((p: Record<string, string>, caller: Caller) => string | undefined) | undefined,
473
+ handler: (p: Record<string, string>, caller: Caller) => FakeResponse,
474
+ ) =>
475
+ (request: FakeRequest): FakeResponse => {
476
+ stats.apiRequests++
477
+ const limited = limits.findIndex((l) => l.method === name || l.method === "*")
478
+ if (limited >= 0) {
479
+ const [hit] = limits.splice(limited, 1)
480
+ return json(429, { ok: false, error: "ratelimited" }, { "retry-after": hit!.retryAfter })
481
+ }
482
+ const injected = scripted.findIndex((s) => s.method === name)
483
+ if (injected >= 0) {
484
+ const [hit] = scripted.splice(injected, 1)
485
+ return { status: hit!.status, headers: { "content-type": "application/json; charset=utf-8" }, body: hit!.body }
486
+ }
487
+ const header = request.headers["authorization"] ?? ""
488
+ const p = params(request)
489
+ const presented = header.startsWith("Bearer ") ? header.slice(7) : p["token"]
490
+ if (presented === undefined || presented === "") return slackError("not_authed")
491
+ const bot = bots.get(presented)
492
+ if (bot === undefined) return slackError("invalid_auth")
493
+ if (!bot.valid) return slackError("token_revoked")
494
+ if (bot.expiresAt !== null && bot.expiresAt < Date.now()) return slackError("token_expired")
495
+ const team = teams.get(bot.team)!
496
+ const scopes = { "x-oauth-scopes": [...team.scopes].join(",") }
497
+ const caller = { team }
498
+ const needed = needs?.(p, caller)
499
+ if (needed !== undefined && !team.scopes.has(needed)) {
500
+ return slackError("missing_scope", { needed, provided: [...team.scopes].join(",") }, scopes)
501
+ }
502
+ const answer = handler(p, caller)
503
+ return { ...answer, headers: { ...answer.headers, ...scopes, "x-accepted-oauth-scopes": needed ?? "" } }
504
+ }
505
+
506
+ /** The conversations the bot can see: every public channel, and the others it is a member of. */
507
+ const visible = (team: Team, id: string | undefined) => {
508
+ const found = id === undefined ? undefined : team.channels.get(id)
509
+ if (found === undefined) return undefined
510
+ return found.type === "public_channel" || found.members.has(BOT_USER) ? found : undefined
511
+ }
512
+
513
+ const toApi = (team: Team, m: SlackMessage) => {
514
+ const replies = team.messages.filter((r) => r.channel === m.channel && r.thread_ts === m.ts && r.ts !== m.ts)
515
+ return {
516
+ type: "message",
517
+ user: m.user,
518
+ text: m.text,
519
+ ts: m.ts,
520
+ team: m.team,
521
+ ...(m.bot_id === undefined ? {} : { bot_id: m.bot_id, app_id: APP_ID, bot_profile: botProfile }),
522
+ ...(m.thread_ts === undefined ? {} : { thread_ts: m.thread_ts }),
523
+ ...(m.thread_ts !== undefined && m.thread_ts !== m.ts
524
+ ? { parent_user_id: team.messages.find((p) => p.ts === m.thread_ts)?.user }
525
+ : {}),
526
+ ...(replies.length === 0
527
+ ? {}
528
+ : {
529
+ reply_count: replies.length,
530
+ latest_reply: replies.at(-1)!.ts,
531
+ reply_users: [...new Set(replies.map((r) => r.user))],
532
+ }),
533
+ }
534
+ }
535
+
536
+ const limitOf = (p: Record<string, string>, fallback: number, max: number) => {
537
+ const n = p["limit"] === undefined ? fallback : Number(p["limit"])
538
+ return Number.isInteger(n) && n > 0 ? Math.min(n, max) : fallback
539
+ }
540
+
541
+ const router = new Router()
542
+ router.add("GET", "/oauth/v2/authorize", authorize)
543
+ router.add("POST", "/api/oauth.v2.access", access)
544
+ const both = (name: string, handler: (request: FakeRequest) => FakeResponse) => {
545
+ router.add("GET", `/api/${name}`, handler)
546
+ router.add("POST", `/api/${name}`, handler)
547
+ }
548
+
549
+ both(
550
+ "auth.test",
551
+ method("auth.test", undefined, (_p, { team }) =>
552
+ json(200, {
553
+ ok: true,
554
+ url: `https://${team.domain}.slack.com/`,
555
+ team: team.name,
556
+ user: "eloxiv",
557
+ team_id: team.id,
558
+ user_id: BOT_USER,
559
+ bot_id: BOT_ID,
560
+ is_enterprise_install: false,
561
+ }),
562
+ ),
563
+ )
564
+
565
+ const typesOf = (p: Record<string, string>) =>
566
+ (p["types"] ?? "public_channel").split(",").map((t) => t.trim()) as Array<SlackChannelType>
567
+ both(
568
+ "conversations.list",
569
+ method(
570
+ "conversations.list",
571
+ (p, { team }) =>
572
+ typesOf(p)
573
+ .map((t) => READ_SCOPE[t])
574
+ .find((s) => s !== undefined && !team.scopes.has(s)),
575
+ (p, { team }) => {
576
+ const types = typesOf(p)
577
+ if (types.some((t) => READ_SCOPE[t] === undefined)) return slackError("invalid_types")
578
+ const all = [...team.channels.values()]
579
+ .filter((c) => types.includes(c.type) && visible(team, c.id) !== undefined)
580
+ .filter((c) => !(p["exclude_archived"] === "true" && c.archived))
581
+ .sort((a, b) => (a.id < b.id ? -1 : 1))
582
+ let start = 0
583
+ if (p["cursor"] !== undefined && p["cursor"] !== "") {
584
+ const after = readCursor(p["cursor"], "team:")
585
+ const at = after === undefined ? -1 : all.findIndex((c) => c.id === after)
586
+ if (at < 0) return slackError("invalid_cursor")
587
+ start = at
588
+ }
589
+ const limit = limitOf(p, 100, 1000)
590
+ const page = all.slice(start, start + limit)
591
+ const next = all[start + limit]
592
+ return json(200, {
593
+ ok: true,
594
+ channels: page.map((c) => ({
595
+ id: c.id,
596
+ name: c.type === "im" ? undefined : c.name,
597
+ is_channel: c.type === "public_channel",
598
+ is_group: c.type === "private_channel",
599
+ is_im: c.type === "im",
600
+ is_mpim: c.type === "mpim",
601
+ is_private: c.type !== "public_channel",
602
+ is_archived: c.archived,
603
+ is_member: c.members.has(BOT_USER),
604
+ user: c.type === "im" ? [...c.members].find((m) => m !== BOT_USER) : undefined,
605
+ })),
606
+ response_metadata: { next_cursor: next === undefined ? "" : cursorOf(`team:${next.id}`) },
607
+ })
608
+ },
609
+ ),
610
+ )
611
+
612
+ const readable = (p: Record<string, string>, team: Team): FakeResponse | SlackChannel => {
613
+ const where = visible(team, p["channel"])
614
+ if (where === undefined) return slackError("channel_not_found")
615
+ if (!where.members.has(BOT_USER)) return slackError("not_in_channel")
616
+ return where
617
+ }
618
+ const historyScope = (p: Record<string, string>, { team }: Caller) => {
619
+ const where = team.channels.get(p["channel"] ?? "")
620
+ return where === undefined ? "channels:history" : HISTORY_SCOPE[where.type]
621
+ }
622
+
623
+ both(
624
+ "conversations.history",
625
+ method("conversations.history", historyScope, (p, { team }) => {
626
+ const where = readable(p, team)
627
+ if (!("members" in where)) return where
628
+ const inclusive = p["inclusive"] === "true" || p["inclusive"] === "1"
629
+ const after = (ts: string, bound: string | undefined) =>
630
+ bound === undefined || (inclusive ? compareTs(ts, bound) >= 0 : compareTs(ts, bound) > 0)
631
+ const before = (ts: string, bound: string | undefined) =>
632
+ bound === undefined || (inclusive ? compareTs(ts, bound) <= 0 : compareTs(ts, bound) < 0)
633
+ // Thread replies stay in their thread; the most recent messages come first.
634
+ const all = team.messages
635
+ .filter((m) => m.channel === where.id && (m.thread_ts === undefined || m.thread_ts === m.ts))
636
+ .filter((m) => after(m.ts, p["oldest"]) && before(m.ts, p["latest"]))
637
+ .sort((a, b) => compareTs(b.ts, a.ts))
638
+ let start = 0
639
+ if (p["cursor"] !== undefined && p["cursor"] !== "") {
640
+ const from = readCursor(p["cursor"], "next_ts:")
641
+ const at = from === undefined ? -1 : all.findIndex((m) => m.ts === from)
642
+ if (at < 0) return slackError("invalid_cursor")
643
+ start = at
644
+ }
645
+ const limit = limitOf(p, 100, 999)
646
+ const page = all.slice(start, start + limit)
647
+ const next = all[start + limit]
648
+ return json(200, {
649
+ ok: true,
650
+ messages: page.map((m) => toApi(team, m)),
651
+ has_more: next !== undefined,
652
+ pin_count: 0,
653
+ ...(next === undefined ? {} : { response_metadata: { next_cursor: cursorOf(`next_ts:${next.ts}`) } }),
654
+ })
655
+ }),
656
+ )
657
+
658
+ both(
659
+ "conversations.replies",
660
+ method("conversations.replies", historyScope, (p, { team }) => {
661
+ const where = readable(p, team)
662
+ if (!("members" in where)) return where
663
+ const found = team.messages.find((m) => m.channel === where.id && m.ts === p["ts"])
664
+ if (found === undefined) return slackError("thread_not_found")
665
+ const root = found.thread_ts ?? found.ts
666
+ const all = team.messages
667
+ .filter((m) => m.channel === where.id && (m.ts === root || m.thread_ts === root))
668
+ .sort((a, b) => compareTs(a.ts, b.ts))
669
+ let start = 0
670
+ if (p["cursor"] !== undefined && p["cursor"] !== "") {
671
+ const from = readCursor(p["cursor"], "replies_ts:")
672
+ const at = from === undefined ? -1 : all.findIndex((m) => m.ts === from)
673
+ if (at < 0) return slackError("invalid_cursor")
674
+ start = at
675
+ }
676
+ // Cursor pagination as documented: `limit` messages a page, earliest first, the parent only on the first.
677
+ const limit = limitOf(p, 1000, 1000)
678
+ const page = all.slice(start, start + limit)
679
+ const next = all[start + limit]
680
+ return json(200, {
681
+ ok: true,
682
+ messages: page.map((m) => toApi(team, m)),
683
+ has_more: next !== undefined,
684
+ ...(next === undefined ? {} : { response_metadata: { next_cursor: cursorOf(`replies_ts:${next.ts}`) } }),
685
+ })
686
+ }),
687
+ )
688
+
689
+ let lastPosted: { eventId: string; delivered: Promise<void> } | undefined
690
+ both(
691
+ "chat.postMessage",
692
+ method(
693
+ "chat.postMessage",
694
+ () => "chat:write",
695
+ (p, { team }) => {
696
+ const found = team.channels.get(p["channel"] ?? "")
697
+ const where = visible(team, p["channel"])
698
+ if (found === undefined || where === undefined) return slackError("channel_not_found")
699
+ if (where.archived) return slackError("is_archived")
700
+ if (
701
+ !where.members.has(BOT_USER) &&
702
+ !(where.type === "public_channel" && team.scopes.has("chat:write.public"))
703
+ ) {
704
+ return slackError("not_in_channel")
705
+ }
706
+ const text = p["text"] ?? ""
707
+ if (text.length === 0 && p["blocks"] === undefined && p["attachments"] === undefined)
708
+ return slackError("no_text")
709
+ if (text.length > 40_000) return slackError("msg_too_long")
710
+ let thread: string | undefined
711
+ if (p["thread_ts"] !== undefined && p["thread_ts"] !== "") {
712
+ const parent = team.messages.find((m) => m.channel === where.id && m.ts === p["thread_ts"])
713
+ if (parent === undefined) return slackError("thread_not_found")
714
+ thread = parent.thread_ts ?? parent.ts
715
+ }
716
+ const ts = nextTs()
717
+ const message: SlackMessage = {
718
+ ts,
719
+ channel: where.id,
720
+ user: BOT_USER,
721
+ team: team.id,
722
+ text,
723
+ thread_ts: thread,
724
+ bot_id: BOT_ID,
725
+ }
726
+ lastPosted = record(team, message)
727
+ return json(200, { ok: true, channel: where.id, ts, message: { ...toApi(team, message), type: "message" } })
728
+ },
729
+ ),
730
+ )
731
+
732
+ const running = await serve(router)
733
+
734
+ return {
735
+ url: running.url,
736
+ clientId,
737
+ clientSecret,
738
+ signingSecret,
739
+ appId: APP_ID,
740
+ botUserId: BOT_USER,
741
+ botId: BOT_ID,
742
+ team: main.id,
743
+ otherTeam: other.id,
744
+ partnerTeam: partner.id,
745
+ /** The connector's settings pointing here. */
746
+ settings: {
747
+ clientId,
748
+ clientSecret,
749
+ authorizeUrl: `${running.url}/oauth/v2/authorize`,
750
+ tokenUrl: `${running.url}/api/oauth.v2.access`,
751
+ apiUrl: `${running.url}/api`,
752
+ } as Record<string, string>,
753
+ authorizations,
754
+ stats,
755
+ issued,
756
+ deliveries,
757
+ channels: (team = main.id) => teams.get(team)!.channels,
758
+ messages: (team = main.id) => teams.get(team)!.messages,
759
+ scopes: (team = main.id) => teams.get(team)!.scopes,
760
+ lastPosted: () => lastPosted,
761
+
762
+ // Controls --------------------------------------------------------------------------------------------------
763
+ /** Who installs next: a person in a workspace. */
764
+ signIn: (team: string, user: string) => {
765
+ signedIn.team = team
766
+ signedIn.user = user
767
+ },
768
+ denyNext: () => {
769
+ denyNext = true
770
+ },
771
+ enablePkce: () => {
772
+ pkceEnabled = true
773
+ },
774
+ /** The next requests to `method` (`*` for any) are answered 429 with this Retry-After. */
775
+ rateLimit: (options: { readonly method: string; readonly retryAfter: string; readonly times: number }) => {
776
+ for (let i = 0; i < options.times; i++) limits.push({ method: options.method, retryAfter: options.retryAfter })
777
+ },
778
+ clearRateLimits: () => {
779
+ limits.length = 0
780
+ scripted.length = 0
781
+ },
782
+ /** The next request to `method` is answered with this raw body (an answer Slack does not document). */
783
+ answerNext: (options: { readonly method: string; readonly body: string; readonly status?: number }) => {
784
+ scripted.push({ method: options.method, status: options.status ?? 200, body: options.body })
785
+ },
786
+ /** Every access token of the workspace stops working (expired: `token_expired`). */
787
+ expireAccessTokens: (team = main.id) => {
788
+ for (const bot of bots.values()) if (bot.team === team && bot.expiresAt !== null) bot.expiresAt = 0
789
+ },
790
+ /** The app is uninstalled from the workspace: its tokens are revoked, its refresh tokens refused. */
791
+ uninstall: (team = main.id) => {
792
+ const found = teams.get(team)!
793
+ found.installed = false
794
+ found.scopes.clear()
795
+ standing.delete(team)
796
+ for (const bot of bots.values()) if (bot.team === team) bot.valid = false
797
+ for (const refresh of refreshTokens.values()) if (refresh.team === team) refresh.valid = false
798
+ },
799
+ /** An administrator removes scopes from the workspace's grant. */
800
+ revokeScopes: (scopes: ReadonlyArray<string>, team = main.id) => {
801
+ for (const scope of scopes) teams.get(team)!.scopes.delete(scope)
802
+ },
803
+ /** A person posts a message (delivered as an event if the bot is in the conversation). */
804
+ userPosts: (message: {
805
+ readonly user: string
806
+ readonly channel: string
807
+ readonly text: string
808
+ readonly thread?: string | null | undefined
809
+ readonly team?: string | undefined
810
+ }) => {
811
+ const team = teams.get(message.team ?? main.id)!
812
+ if (!team.users.has(message.user)) team.users.set(message.user, { id: message.user, name: message.user })
813
+ const posted: SlackMessage = {
814
+ ts: nextTs(),
815
+ channel: message.channel,
816
+ user: message.user,
817
+ team: team.id,
818
+ text: message.text,
819
+ thread_ts: message.thread ?? undefined,
820
+ bot_id: undefined,
821
+ }
822
+ const delivery = record(team, posted)
823
+ return { ts: posted.ts, eventId: delivery?.eventId, delivered: delivery?.delivered ?? Promise.resolve() }
824
+ },
825
+ /** Set the Events API Request URL: Slack sends a signed url_verification and keeps the URL only if answered. */
826
+ setRequestUrl: async (url: string) => {
827
+ const challenge = randomBytes(24).toString("base64url")
828
+ const body = JSON.stringify({ token: "deprecated-verification-token", challenge, type: "url_verification" })
829
+ const answer = await post(url, body, {})
830
+ const type = answer.headers.get("content-type") ?? ""
831
+ let echoed: string | undefined
832
+ if (type.startsWith("application/json")) {
833
+ try {
834
+ echoed = (JSON.parse(answer.text) as { challenge?: string }).challenge
835
+ } catch {
836
+ echoed = undefined
837
+ }
838
+ } else if (type.startsWith("application/x-www-form-urlencoded")) {
839
+ echoed = new URLSearchParams(answer.text).get("challenge") ?? undefined
840
+ } else {
841
+ echoed = answer.text
842
+ }
843
+ const verified = answer.status === 200 && echoed === challenge
844
+ if (verified) requestUrl = url
845
+ return { verified, status: answer.status, body: answer.text }
846
+ },
847
+ /** Treat the next `n` delivery attempts as failed (Slack timed out), so they are retried. */
848
+ failNextAttempts: (n: number) => {
849
+ failAttempts = n
850
+ },
851
+ /** Wait until every delivery in flight (with its retries) has finished. */
852
+ settled: async () => {
853
+ while (pending.size > 0) await Promise.all(pending)
854
+ },
855
+ /** A signed event delivery for a message, as Slack would POST it (without storing the message). */
856
+ event: (event: {
857
+ readonly user: string
858
+ readonly channel: string
859
+ readonly text: string
860
+ readonly thread?: string | null
861
+ /** The workspace that receives the delivery (default the main one). */
862
+ readonly team?: string
863
+ /** The sender's own workspace, for a Slack Connect channel (default the receiving one). */
864
+ readonly userTeam?: string
865
+ /** Also keep the message in its channel (so the app can reply in its thread), without delivering it. */
866
+ readonly store?: boolean
867
+ }) => {
868
+ // A workspace the fake does not know yet is one where the app is not installed.
869
+ const team = teams.get(event.team ?? main.id) ?? addTeam(event.team!, event.team!)
870
+ const where = team.channels.get(event.channel)
871
+ const message: SlackMessage = {
872
+ ts: nextTs(),
873
+ channel: event.channel,
874
+ user: event.user,
875
+ team: event.userTeam ?? team.id,
876
+ text: event.text,
877
+ thread_ts: event.thread ?? undefined,
878
+ bot_id: undefined,
879
+ }
880
+ if (event.store === true) team.messages.push(message)
881
+ const { body, eventId } = envelope(team, message, where?.type ?? "public_channel")
882
+ return { body, eventId, ts: message.ts, headers: sign(body) }
883
+ },
884
+ /** Sign a body as Slack does (for hand-made deliveries), at `at` (unix seconds). */
885
+ sign,
886
+ close: async () => {
887
+ await Promise.allSettled(pending)
888
+ await running.close()
889
+ },
890
+ }
891
+ }
892
+
893
+ export type SlackFake = Awaited<ReturnType<typeof startSlackFake>>