@eloxiv/testing 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +905 -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 +62 -0
  240. package/dist/conformance/LocalClient.d.ts.map +1 -0
  241. package/dist/conformance/LocalClient.js +526 -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 +1072 -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 +651 -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,1035 @@
1
+ /**
2
+ * A protocol fake of Google's OAuth 2.0 endpoints and the subset of Google Workspace APIs the `google` connector
3
+ * uses, following Google's documentation:
4
+ *
5
+ * - OAuth 2.0: `/o/oauth2/v2/auth` (PKCE S256; a refresh token only with `access_type=offline`; incremental
6
+ * consent with `include_granted_scopes`) and `/token` (refresh tokens not rotated; `invalid_grant` errors),
7
+ * OpenID Connect `/v1/userinfo`
8
+ * - Gmail v1: labels, `messages` (list by label, get with `format` (`metadata` keeps only the `metadataHeaders`
9
+ * asked for, and no body), `modify`, `trash`, `send` with a raw RFC 2822 message), `drafts`, `profile` and
10
+ * `history` (records of `messagesAdded`, `messagesDeleted`, `labelsAdded`, `labelsRemoved`, whose messages
11
+ * carry only `id` and `threadId`; `historyTypes` and `labelId` filters; paged; a `startHistoryId` older than
12
+ * the retained history, or newer than the mailbox, is 404 Not Found); an id that is not hexadecimal is 400
13
+ * `Invalid id value`. As the real API (live-verified 2026-11-10): `send` replaces the sender's `Message-ID` with
14
+ * Gmail's own and keeps custom (`X-`) headers as written; search (`q`) knows only `rfc822msgid:` here, matches
15
+ * Gmail's `Message-ID` and never a custom header, and finds a message only once it is indexed
16
+ * (`searchIndexDelayMs`, 2 s by default), while a list by label has it at once; any other `q` is refused, so a
17
+ * connector relying on a search this fake cannot answer as Gmail would fails here
18
+ * - Gmail filters (`settings/filters`: list, get, create, delete; listing needs a read scope, writing
19
+ * `gmail.settings.basic`; a filter without a criterion or an action is 400 `FAILED_PRECONDITION`)
20
+ * - Calendar v3: `calendarList`, events `list` (time range, `singleEvents`, paging, `nextSyncToken`; with a
21
+ * `syncToken` only the changes, cancelled events included; a token never issued is 400 `invalid`, an expired
22
+ * one 410 Gone `fullSyncRequired`), `get`, `insert`, `patch`, `delete` (the event becomes `cancelled`)
23
+ * - Admin SDK Directory v1: `users` (list with `customer=my_customer`, get) and `groups`, with etags; no delta
24
+ * - Drive v3: `files` (list by parent, get, `alt=media`), `changes/startPageToken` and `changes` (removals and
25
+ * trashed files; an unknown page token is 400 Invalid Value on `pageToken`); only the `fields` asked for (by
26
+ * default a file's `kind`, `id`, `name` and `mimeType`); an upload's processing change shortly after it
27
+ * - Calendar's cancelled events on an incremental sync carry only `id` and `status`; the Admin SDK omits
28
+ * `users` from an empty page
29
+ * - errors in Google's JSON error formats: Gmail's and the scope errors with `status` (401 `UNAUTHENTICATED` with
30
+ * `WWW-Authenticate`, 403 `PERMISSION_DENIED` with `insufficientPermissions` and
31
+ * `ACCESS_TOKEN_SCOPE_INSUFFICIENT` and `WWW-Authenticate: ... error="insufficient_scope"`, 403
32
+ * `userRateLimitExceeded`, 429 `RESOURCE_EXHAUSTED` and 503 `UNAVAILABLE` with `Retry-After`, 404 `NOT_FOUND`);
33
+ * Calendar's, the Admin SDK's (403 `forbidden` for an account whose role lacks the privilege) and Drive's
34
+ * without it
35
+ *
36
+ * The error bodies, Gmail's invalid ids and future history ids, Calendar's unissued sync tokens and Drive's
37
+ * processing changes follow what the real services answered to the live kits (docs/connectors/google.md).
38
+ */
39
+ import { randomBytes } from "node:crypto";
40
+ import { json, OAuthServer, Router, serve, Throttle } from "./Server.js";
41
+ import { Collection, decodeToken, encodeToken } from "./Store.js";
42
+ const SCOPE = "https://www.googleapis.com/auth/";
43
+ const id = (prefix = "") => `${prefix}${randomBytes(8).toString("hex")}`;
44
+ const now = () => new Date().toISOString().replace(/\.\d{3}Z$/u, ".000Z");
45
+ const SYSTEM_LABELS = ["INBOX", "SENT", "DRAFT", "TRASH", "SPAM", "UNREAD", "STARRED", "IMPORTANT"];
46
+ export const startGoogleFake = async (options = {}) => {
47
+ const clientId = options.clientId ?? "google-fake-client.apps.googleusercontent.com";
48
+ const clientSecret = options.clientSecret ?? "google-fake-secret";
49
+ const searchIndexDelayMs = options.searchIndexDelayMs ?? 2000;
50
+ const oauth = new OAuthServer({
51
+ clientId,
52
+ clientSecret,
53
+ rotateRefreshTokens: false,
54
+ offlineParam: true,
55
+ // Google lists `email` as the userinfo scope.
56
+ scopeOut: (scope) => (scope === "email" ? `${SCOPE}userinfo.email` : scope),
57
+ tokenError: (error, description) => ({ error, error_description: description }),
58
+ });
59
+ const throttle = new Throttle();
60
+ /** Messages whose full read fails (500) while listed here: a provider that cannot answer for one message. */
61
+ const failingReads = new Set();
62
+ /** Injected Drive/Gmail-style 403 `userRateLimitExceeded` answers. */
63
+ let userRateLimited = 0;
64
+ const clock = { seq: 0 };
65
+ const minSeq = { mail: 0, calendar: 0, drive: 0 };
66
+ let apiRequests = 0;
67
+ /** The API requests received (the newest 10 000): what a connector asked for, and how often. */
68
+ const requestLog = [];
69
+ /** Answers to drop after the request was carried out (the provider acted; the caller hears a 503). */
70
+ let lostResponses = 0;
71
+ const messages = new Collection(clock);
72
+ const events = new Collection(clock);
73
+ const users = new Collection(clock);
74
+ const files = new Collection(clock);
75
+ const self = {
76
+ id: "1144" + randomBytes(8).toString("hex").replaceAll(/\D/gu, "7"),
77
+ email: "adele@workspace.example",
78
+ name: "Adele Vance",
79
+ };
80
+ const PRIMARY = self.email;
81
+ const router = new Router();
82
+ let base = "";
83
+ // ---- errors in Google's JSON error format
84
+ const googleError = (code, status, message, errors = [], headers = {}, details) => json(code, { error: { code, message, errors, status, ...(details === undefined ? {} : { details }) } }, headers);
85
+ const unauthorized = () => googleError(401, "UNAUTHENTICATED", "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", [
86
+ {
87
+ message: "Invalid Credentials",
88
+ domain: "global",
89
+ reason: "authError",
90
+ location: "Authorization",
91
+ locationType: "header",
92
+ },
93
+ ], { "www-authenticate": `Bearer realm="https://accounts.google.com/"` });
94
+ const insufficient = (service, required) => googleError(403, "PERMISSION_DENIED", "Request had insufficient authentication scopes.", [{ message: "Insufficient Permission", domain: "global", reason: "insufficientPermissions" }], {
95
+ "www-authenticate": `Bearer realm="https://accounts.google.com/", error="insufficient_scope", scope="${required.join(" ")}"`,
96
+ }, [
97
+ {
98
+ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
99
+ reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
100
+ domain: "googleapis.com",
101
+ metadata: { service },
102
+ },
103
+ ]);
104
+ const notFound = () => googleError(404, "NOT_FOUND", "Requested entity was not found.", [
105
+ { message: "Requested entity was not found.", domain: "global", reason: "notFound" },
106
+ ]);
107
+ /**
108
+ * Calendar, the Admin SDK and Drive answer in the older JSON error format: `errors`, `code` and `message`, no
109
+ * `status` (seen from the real APIs; Gmail and the scope errors carry `status`).
110
+ */
111
+ const legacyError = (code, message, error) => json(code, { error: { errors: [{ message, domain: "global", ...error }], code, message } });
112
+ const calendarNotFound = () => legacyError(404, "Not Found", { reason: "notFound" });
113
+ const api = (service, anyOf, handler) => (request) => {
114
+ apiRequests++;
115
+ requestLog.push({ method: request.method, url: request.url });
116
+ if (requestLog.length > 10_000)
117
+ requestLog.shift();
118
+ const injected = throttle.next(request.method);
119
+ if (injected !== undefined) {
120
+ const headers = injected.retryAfter === null ? {} : { "retry-after": injected.retryAfter };
121
+ return injected.status === 429
122
+ ? googleError(429, "RESOURCE_EXHAUSTED", "Quota exceeded for quota metric 'Queries' and limit 'Queries per minute per user'.", [{ message: "Rate Limit Exceeded", domain: "usageLimits", reason: "rateLimitExceeded" }], headers)
123
+ : googleError(injected.status, "UNAVAILABLE", "The service is currently unavailable.", [], headers);
124
+ }
125
+ if (userRateLimited > 0) {
126
+ userRateLimited--;
127
+ return googleError(403, "PERMISSION_DENIED", "User Rate Limit Exceeded", [
128
+ { message: "User Rate Limit Exceeded", domain: "usageLimits", reason: "userRateLimitExceeded" },
129
+ ]);
130
+ }
131
+ const caller = oauth.authenticate(request);
132
+ if (caller === undefined)
133
+ return unauthorized();
134
+ const required = anyOf.map((s) => (s.startsWith("https://") ? s : `${SCOPE}${s}`));
135
+ if (!required.some((scope) => caller.scopes.has(scope)))
136
+ return insufficient(service, required);
137
+ const answer = handler(request, caller.account);
138
+ if (lostResponses > 0) {
139
+ lostResponses--;
140
+ return Promise.resolve(answer).then(() => json(503, { error: { code: 503, message: "The answer was lost" } }));
141
+ }
142
+ return answer;
143
+ };
144
+ // ---- OAuth and OpenID Connect
145
+ router.add("GET", "/o/oauth2/v2/auth", oauth.authorize);
146
+ router.add("POST", "/token", oauth.tokenEndpoint);
147
+ router.add("GET", "/v1/userinfo", api("openidconnect.googleapis.com", ["openid", "email", "userinfo.email"], (_r, me) => json(200, { sub: me.id, email: me.email, email_verified: true, name: me.name })));
148
+ // ---- Gmail v1
149
+ const GMAIL_READ = ["gmail.readonly", "gmail.modify", "https://mail.google.com/"];
150
+ const GMAIL_MODIFY = ["gmail.modify", "https://mail.google.com/"];
151
+ const GMAIL_SEND = ["gmail.send", "gmail.compose", "gmail.modify", "https://mail.google.com/"];
152
+ const GMAIL_COMPOSE = ["gmail.compose", "gmail.modify", "https://mail.google.com/"];
153
+ const historyFloor = () => minSeq.mail;
154
+ const b64 = (text) => Buffer.from(text, "utf8").toString("base64url");
155
+ const renderMessage = (m, format, metadataHeaders = []) => {
156
+ const all = [
157
+ { name: "From", value: m.from },
158
+ { name: "To", value: m.to },
159
+ ...(m.cc ? [{ name: "Cc", value: m.cc }] : []),
160
+ { name: "Subject", value: m.subject },
161
+ { name: "Date", value: new Date(m.internalDate).toUTCString() },
162
+ ...(m.messageId ? [{ name: "Message-Id", value: m.messageId }] : []),
163
+ ...(m.extraHeaders ?? []),
164
+ ];
165
+ const wanted = new Set(metadataHeaders.map((h) => h.toLowerCase()));
166
+ const headers = format === "metadata" && wanted.size > 0 ? all.filter((h) => wanted.has(h.name.toLowerCase())) : all;
167
+ return {
168
+ id: m.id,
169
+ threadId: m.threadId,
170
+ labelIds: m.labelIds,
171
+ snippet: m.body.slice(0, 100),
172
+ // As Gmail: the last history record that changed this message.
173
+ historyId: String(messages.lastChange(m.id)),
174
+ internalDate: String(m.internalDate),
175
+ sizeEstimate: m.body.length + 200,
176
+ ...(format === "minimal"
177
+ ? {}
178
+ : {
179
+ payload: {
180
+ partId: "",
181
+ mimeType: "text/plain",
182
+ filename: "",
183
+ headers,
184
+ ...(format === "metadata" ? {} : { body: { size: m.body.length, data: b64(m.body) } }),
185
+ },
186
+ }),
187
+ };
188
+ };
189
+ /**
190
+ * Gmail's ids are hexadecimal. One that is not cannot name a message: the real API answers 400 `Invalid id
191
+ * value` before looking (a well-formed id of no message is 404).
192
+ */
193
+ const invalidId = (value) => /^[0-9a-f]+$/u.test(value)
194
+ ? undefined
195
+ : googleError(400, "INVALID_ARGUMENT", "Invalid id value", [
196
+ { message: "Invalid id value", domain: "global", reason: "invalidArgument" },
197
+ ]);
198
+ const parseRaw = (raw) => {
199
+ const text = Buffer.from(raw.replaceAll("-", "+").replaceAll("_", "/"), "base64").toString("utf8");
200
+ const split = text.indexOf("\r\n\r\n") >= 0 ? text.indexOf("\r\n\r\n") : text.indexOf("\n\n");
201
+ const head = split >= 0 ? text.slice(0, split) : text;
202
+ const body = split >= 0 ? text.slice(split).trim() : "";
203
+ const header = (name) => head
204
+ .split(/\r?\n/u)
205
+ .find((line) => line.toLowerCase().startsWith(`${name.toLowerCase()}:`))
206
+ ?.slice(name.length + 1)
207
+ .trim() ?? "";
208
+ const extraHeaders = head
209
+ .split(/\r?\n/u)
210
+ .filter((line) => /^x-[^:]*:/iu.test(line))
211
+ .map((line) => ({ name: line.slice(0, line.indexOf(":")), value: line.slice(line.indexOf(":") + 1).trim() }));
212
+ return { from: header("From"), to: header("To"), cc: header("Cc"), subject: header("Subject"), body, extraHeaders };
213
+ };
214
+ /** The account's verified send-as aliases besides its primary address (`mail.sendAs`). */
215
+ const sendAs = [];
216
+ /** How many reads of the send-as addresses fail next (500), as Gmail's backend can (`mail.failSendAs`). */
217
+ let failingSendAs = 0;
218
+ router.add("GET", "/gmail/v1/users/me/settings/sendAs", api("gmail.googleapis.com", GMAIL_READ, (_request, me) => failingSendAs-- > 0
219
+ ? googleError(500, "INTERNAL", "Internal error encountered.", [{ domain: "global", reason: "backendError" }])
220
+ : json(200, {
221
+ sendAs: [
222
+ { sendAsEmail: me.email, displayName: me.name, isPrimary: true, isDefault: true },
223
+ ...sendAs.map((a) => ({ ...a, isPrimary: false, isDefault: false, verificationStatus: "accepted" })),
224
+ // One still waiting for its verification: never offered.
225
+ { sendAsEmail: `pending-${me.email}`, displayName: "", isPrimary: false, verificationStatus: "pending" },
226
+ ],
227
+ })));
228
+ // Filters (users.settings.filters): listed with any read scope, made and deleted with gmail.settings.basic (as the
229
+ // real API). A filter needs a criterion and an action; one that forwards needs gmail.settings.sharing.
230
+ const GMAIL_SETTINGS = ["gmail.settings.basic", "https://mail.google.com/"];
231
+ const filters = new Map();
232
+ const filterNotFound = () => googleError(404, "NOT_FOUND", "Filter not found", [
233
+ { message: "Filter not found", domain: "global", reason: "notFound" },
234
+ ]);
235
+ router.add("GET", "/gmail/v1/users/me/settings/filters", api("gmail.googleapis.com", [...GMAIL_READ, ...GMAIL_SETTINGS], () =>
236
+ // An account with no filters answers `{}` (as the real API).
237
+ json(200, filters.size === 0 ? {} : { filter: [...filters.values()] })));
238
+ router.add("GET", "/gmail/v1/users/me/settings/filters/:id", api("gmail.googleapis.com", [...GMAIL_READ, ...GMAIL_SETTINGS], (request) => {
239
+ const found = filters.get(request.params["id"]);
240
+ return found === undefined ? filterNotFound() : json(200, found);
241
+ }));
242
+ router.add("POST", "/gmail/v1/users/me/settings/filters", api("gmail.googleapis.com", GMAIL_SETTINGS, (request) => {
243
+ const body = (request.json ?? {});
244
+ const criteria = body.criteria ?? {};
245
+ const action = body.action ?? {};
246
+ if (Object.keys(criteria).length === 0) {
247
+ return googleError(400, "FAILED_PRECONDITION", "Filter doesn't have any criteria", [
248
+ { message: "Filter doesn't have any criteria", domain: "global", reason: "failedPrecondition" },
249
+ ]);
250
+ }
251
+ if (Object.keys(action).length === 0) {
252
+ return googleError(400, "FAILED_PRECONDITION", "Filter doesn't have any actions", [
253
+ { message: "Filter doesn't have any actions", domain: "global", reason: "failedPrecondition" },
254
+ ]);
255
+ }
256
+ const made = { id: `ANe1Bm${randomBytes(12).toString("hex")}`, criteria, action };
257
+ filters.set(made.id, made);
258
+ return json(200, made);
259
+ }));
260
+ router.add("DELETE", "/gmail/v1/users/me/settings/filters/:id", api("gmail.googleapis.com", GMAIL_SETTINGS, (request) => filters.delete(request.params["id"]) ? { status: 204 } : filterNotFound()));
261
+ router.add("GET", "/gmail/v1/users/me/labels", api("gmail.googleapis.com", GMAIL_READ, () => json(200, { labels: SYSTEM_LABELS.map((label) => ({ id: label, name: label, type: "system" })) })));
262
+ router.add("GET", "/gmail/v1/users/me/profile", api("gmail.googleapis.com", GMAIL_READ, (_r, me) => json(200, {
263
+ emailAddress: me.email,
264
+ messagesTotal: messages.items.size,
265
+ threadsTotal: messages.items.size,
266
+ historyId: String(clock.seq),
267
+ })));
268
+ router.add("GET", "/gmail/v1/users/me/messages", api("gmail.googleapis.com", GMAIL_READ, (request) => {
269
+ const labels = request.url.searchParams.getAll("labelIds");
270
+ const includeSpamTrash = request.url.searchParams.get("includeSpamTrash") === "true";
271
+ // Search: only `rfc822msgid:<id>` (Gmail's own Message-ID, never one the sender set), and only once the
272
+ // message is indexed. Any other query is refused rather than answered differently from Gmail.
273
+ const q = request.url.searchParams.get("q");
274
+ const byMessageId = q === null ? undefined : /^rfc822msgid:(\S+)$/u.exec(q)?.[1];
275
+ if (q !== null && byMessageId === undefined)
276
+ return googleError(400, "INVALID_ARGUMENT", `The fake does not implement the search ${JSON.stringify(q)}`, [
277
+ { domain: "global", reason: "invalidArgument" },
278
+ ]);
279
+ const indexedBefore = Date.now() - searchIndexDelayMs;
280
+ const all = [...messages.items.values()]
281
+ .filter((m) => byMessageId === undefined || (m.messageId === byMessageId && m.internalDate <= indexedBefore))
282
+ .filter((m) => labels.every((l) => m.labelIds.includes(l)))
283
+ .filter((m) => includeSpamTrash || (!m.labelIds.includes("TRASH") && !m.labelIds.includes("SPAM")))
284
+ .sort((a, b) => b.internalDate - a.internalDate || (a.id < b.id ? 1 : -1));
285
+ const max = Math.min(500, Number(request.url.searchParams.get("maxResults") ?? 100));
286
+ const offset = Number(decodeToken(request.url.searchParams.get("pageToken") ?? "") ?? 0);
287
+ const page = all.slice(offset, offset + max);
288
+ return json(200, {
289
+ ...(page.length === 0 ? {} : { messages: page.map((m) => ({ id: m.id, threadId: m.threadId })) }),
290
+ ...(offset + max < all.length ? { nextPageToken: encodeToken(offset + max) } : {}),
291
+ resultSizeEstimate: all.length,
292
+ });
293
+ }));
294
+ router.add("GET", "/gmail/v1/users/me/messages/:id", api("gmail.googleapis.com", GMAIL_READ, (request) => {
295
+ const invalid = invalidId(request.params["id"]);
296
+ if (invalid !== undefined)
297
+ return invalid;
298
+ if (failingReads.has(request.params["id"])) {
299
+ return googleError(500, "INTERNAL", "Internal error encountered.", [
300
+ { domain: "global", reason: "backendError" },
301
+ ]);
302
+ }
303
+ const found = messages.items.get(request.params["id"]);
304
+ return found === undefined
305
+ ? notFound()
306
+ : json(200, renderMessage(found, request.url.searchParams.get("format") ?? "full", request.url.searchParams.getAll("metadataHeaders")));
307
+ }));
308
+ router.add("POST", "/gmail/v1/users/me/messages/:id/modify", api("gmail.googleapis.com", GMAIL_MODIFY, (request) => {
309
+ const invalid = invalidId(request.params["id"]);
310
+ if (invalid !== undefined)
311
+ return invalid;
312
+ const body = (request.json ?? {});
313
+ const updated = messages.update(request.params["id"], (m) => ({
314
+ ...m,
315
+ labelIds: [
316
+ ...new Set([
317
+ ...m.labelIds.filter((l) => !(body.removeLabelIds ?? []).includes(l)),
318
+ ...(body.addLabelIds ?? []),
319
+ ]),
320
+ ],
321
+ }));
322
+ return updated === undefined
323
+ ? notFound()
324
+ : json(200, { id: updated.id, threadId: updated.threadId, labelIds: updated.labelIds });
325
+ }));
326
+ router.add("POST", "/gmail/v1/users/me/messages/:id/trash", api("gmail.googleapis.com", GMAIL_MODIFY, (request) => {
327
+ const invalid = invalidId(request.params["id"]);
328
+ if (invalid !== undefined)
329
+ return invalid;
330
+ const updated = messages.update(request.params["id"], (m) => ({
331
+ ...m,
332
+ labelIds: [...new Set([...m.labelIds, "TRASH"])],
333
+ }));
334
+ return updated === undefined
335
+ ? notFound()
336
+ : json(200, { id: updated.id, threadId: updated.threadId, labelIds: updated.labelIds });
337
+ }));
338
+ router.add("POST", "/gmail/v1/users/me/messages/send", api("gmail.googleapis.com", GMAIL_SEND, (request, me) => {
339
+ const raw = request.json?.raw;
340
+ if (raw === undefined)
341
+ return googleError(400, "INVALID_ARGUMENT", "'raw' RFC822 payload message string or uploading message via /upload/* URL required", [{ domain: "global", reason: "invalidArgument" }]);
342
+ const { from: asked, ...parsed } = parseRaw(raw);
343
+ const toSelf = `${parsed.to},${parsed.cc}`.toLowerCase().includes(me.email.toLowerCase());
344
+ // As Gmail does: a From that is not one of the account's verified send-as addresses becomes the primary one.
345
+ const askedAddress = /<([^>]+)>/u.exec(asked)?.[1] ?? asked;
346
+ const allowed = sendAs.some((a) => a.sendAsEmail.toLowerCase() === askedAddress.toLowerCase());
347
+ const sent = messages.put({
348
+ id: id(),
349
+ threadId: id(),
350
+ labelIds: toSelf ? ["SENT", "INBOX", "UNREAD"] : ["SENT"],
351
+ from: asked !== "" && allowed ? asked : `${me.name} <${me.email}>`,
352
+ ...parsed,
353
+ // Gmail's own, whatever the sender set.
354
+ messageId: `<${id()}@mail.gmail.com>`,
355
+ internalDate: Date.now(),
356
+ });
357
+ return json(200, { id: sent.id, threadId: sent.threadId, labelIds: sent.labelIds });
358
+ }));
359
+ router.add("POST", "/gmail/v1/users/me/drafts", api("gmail.googleapis.com", GMAIL_COMPOSE, (request, me) => {
360
+ const raw = request.json?.message?.raw;
361
+ if (raw === undefined)
362
+ return googleError(400, "INVALID_ARGUMENT", "Missing draft message", [
363
+ { domain: "global", reason: "invalidArgument" },
364
+ ]);
365
+ const draft = messages.put({
366
+ id: id(),
367
+ threadId: id(),
368
+ labelIds: ["DRAFT"],
369
+ ...parseRaw(raw),
370
+ from: me.email,
371
+ internalDate: Date.now(),
372
+ });
373
+ return json(200, { id: id("r-"), message: { id: draft.id, threadId: draft.threadId, labelIds: draft.labelIds } });
374
+ }));
375
+ router.add("GET", "/gmail/v1/users/me/history", api("gmail.googleapis.com", GMAIL_READ, (request) => {
376
+ const start = Number(request.url.searchParams.get("startHistoryId") ?? "NaN");
377
+ if (!Number.isInteger(start))
378
+ return googleError(400, "INVALID_ARGUMENT", "Invalid startHistoryId", [
379
+ { domain: "global", reason: "invalidArgument" },
380
+ ]);
381
+ // Older than the retained history, or newer than the mailbox: both 404 (seen from the real API).
382
+ if (start < historyFloor() || start > clock.seq)
383
+ return notFound();
384
+ const max = Math.min(500, Number(request.url.searchParams.get("maxResults") ?? 100));
385
+ const offset = Number(decodeToken(request.url.searchParams.get("pageToken") ?? "") ?? 0);
386
+ // `historyTypes` (repeated): only those change types; all four when absent.
387
+ const types = request.url.searchParams.getAll("historyTypes");
388
+ const wanted = (type) => types.length === 0 || types.includes(type);
389
+ // `labelId`: only messages with that label (as they are after the change; before it for a deletion).
390
+ const labelId = request.url.searchParams.get("labelId");
391
+ // As documented: "Any messages contained in the response will typically only have id and threadId fields
392
+ // populated." Labels a record adds or removes are reported beside the message, never on it.
393
+ const ref = (m) => ({ id: m.id, threadId: m.threadId });
394
+ const records = messages.log
395
+ .filter((entry) => entry.seq > start)
396
+ .filter((entry) => labelId === null || (entry.after ?? entry.before).labelIds.includes(labelId))
397
+ .flatMap((entry) => {
398
+ const record = {
399
+ id: String(entry.seq),
400
+ messages: [ref((entry.after ?? entry.before))],
401
+ };
402
+ if (entry.before === undefined) {
403
+ if (wanted("messageAdded"))
404
+ record["messagesAdded"] = [{ message: ref(entry.after) }];
405
+ }
406
+ else if (entry.after === undefined) {
407
+ if (wanted("messageDeleted"))
408
+ record["messagesDeleted"] = [{ message: ref(entry.before) }];
409
+ }
410
+ else {
411
+ const added = entry.after.labelIds.filter((l) => !entry.before.labelIds.includes(l));
412
+ const removed = entry.before.labelIds.filter((l) => !entry.after.labelIds.includes(l));
413
+ if (added.length > 0 && wanted("labelAdded"))
414
+ record["labelsAdded"] = [{ message: ref(entry.after), labelIds: added }];
415
+ if (removed.length > 0 && wanted("labelRemoved"))
416
+ record["labelsRemoved"] = [{ message: ref(entry.after), labelIds: removed }];
417
+ }
418
+ return Object.keys(record).length > 2 ? [record] : [];
419
+ });
420
+ const page = records.slice(offset, offset + max);
421
+ return json(200, {
422
+ ...(page.length === 0 ? {} : { history: page }),
423
+ ...(offset + max < records.length ? { nextPageToken: encodeToken(offset + max) } : {}),
424
+ historyId: String(clock.seq),
425
+ });
426
+ }));
427
+ // ---- Calendar v3
428
+ const CAL_READ = ["calendar.readonly", "calendar", "calendar.events", "calendar.events.readonly"];
429
+ const CAL_WRITE = ["calendar", "calendar.events"];
430
+ const eventTime = (value) => /^\d{4}-\d{2}-\d{2}$/u.test(value) ? { date: value } : { dateTime: value, timeZone: "UTC" };
431
+ const renderEvent = (e) => ({
432
+ kind: "calendar#event",
433
+ etag: `"${Date.parse(e.updated)}"`,
434
+ id: e.id,
435
+ status: e.status,
436
+ htmlLink: `https://www.google.com/calendar/event?eid=${e.id}`,
437
+ updated: e.updated,
438
+ summary: e.summary,
439
+ ...(e.description === null ? {} : { description: e.description }),
440
+ ...(e.location === null ? {} : { location: e.location }),
441
+ creator: { email: e.organizer, ...(e.organizer === e.calendarId ? { self: true } : {}) },
442
+ organizer: { email: e.organizer, ...(e.organizer === e.calendarId ? { self: true } : {}) },
443
+ start: eventTime(e.start),
444
+ end: eventTime(e.end),
445
+ // The calendar owner's own entry says so (`self`), as Google marks it.
446
+ ...(e.attendees.length === 0
447
+ ? {}
448
+ : {
449
+ attendees: e.attendees.map(({ self: own, ...a }) => own === true || (own === undefined && a.email === e.calendarId) ? { ...a, self: true } : a),
450
+ }),
451
+ });
452
+ const instant = (value) => Date.parse(value);
453
+ router.add("GET", "/calendar/v3/users/me/calendarList", api("calendar-json.googleapis.com", CAL_READ, (_r, me) => json(200, {
454
+ kind: "calendar#calendarList",
455
+ items: [
456
+ {
457
+ kind: "calendar#calendarListEntry",
458
+ id: me.email,
459
+ summary: me.email,
460
+ primary: true,
461
+ accessRole: "owner",
462
+ timeZone: "UTC",
463
+ },
464
+ ],
465
+ })));
466
+ const calendarOf = (requested, me) => (requested === "primary" ? me.email : requested);
467
+ /** Other people's busy time as freeBusy shares it with the account (`calendar.schedule`), by address. */
468
+ const busyOf = new Map();
469
+ router.add("POST", "/calendar/v3/freeBusy", api("calendar-json.googleapis.com", CAL_READ, (request, me) => {
470
+ const body = (request.json ?? {});
471
+ const min = Date.parse(body.timeMin ?? "");
472
+ const max = Date.parse(body.timeMax ?? "");
473
+ if (Number.isNaN(min) || Number.isNaN(max)) {
474
+ return googleError(400, "INVALID_ARGUMENT", "Missing timeMin or timeMax.", [
475
+ { domain: "global", reason: "required" },
476
+ ]);
477
+ }
478
+ const within = (b) => Date.parse(b.start) < max && Date.parse(b.end) > min;
479
+ const own = () => [...events.items.values()]
480
+ .filter((e) => e.status !== "cancelled" && within(e))
481
+ .filter((e) => {
482
+ const mine = e.attendees.find((a) => a.self === true || a.email === me.email);
483
+ return mine?.responseStatus !== "declined";
484
+ })
485
+ .map((e) => ({ start: e.start, end: e.end }));
486
+ return json(200, {
487
+ kind: "calendar#freeBusy",
488
+ timeMin: new Date(min).toISOString(),
489
+ timeMax: new Date(max).toISOString(),
490
+ calendars: Object.fromEntries((body.items ?? []).map(({ id }) => {
491
+ if (id === me.email)
492
+ return [id, { busy: own() }];
493
+ const known = busyOf.get(id.toLowerCase());
494
+ return [
495
+ id,
496
+ known === undefined
497
+ ? { errors: [{ domain: "global", reason: "notFound" }], busy: [] }
498
+ : { busy: known.filter(within) },
499
+ ];
500
+ })),
501
+ });
502
+ }));
503
+ router.add("GET", "/calendar/v3/calendars/:cid/events", api("calendar-json.googleapis.com", CAL_READ, (request, me) => {
504
+ const calendar = calendarOf(request.params["cid"], me);
505
+ if (calendar !== PRIMARY)
506
+ return calendarNotFound();
507
+ const q = request.url.searchParams;
508
+ const max = Math.min(2500, Number(q.get("maxResults") ?? 250));
509
+ const syncText = q.get("syncToken");
510
+ const page = decodeToken(q.get("pageToken") ?? "");
511
+ let state = page;
512
+ if (syncText !== null) {
513
+ if (q.get("timeMin") !== null || q.get("timeMax") !== null) {
514
+ return legacyError(400, "Sync token cannot be used with other query parameters", { reason: "invalid" });
515
+ }
516
+ const token = decodeToken(syncText);
517
+ // A token Calendar never issued is 400 `invalid` (seen from the real API); one it issued and no longer
518
+ // honours is 410 `fullSyncRequired`.
519
+ if (token === undefined || typeof token.seq !== "number") {
520
+ return legacyError(400, "Invalid sync token value.", { reason: "invalid" });
521
+ }
522
+ if (token.seq < minSeq.calendar) {
523
+ return legacyError(410, "Sync token is no longer valid, a full sync is required.", {
524
+ reason: "fullSyncRequired",
525
+ });
526
+ }
527
+ state ??= { seq: token.seq, offset: 0, sync: true };
528
+ }
529
+ const until = clock.seq;
530
+ if (state?.sync === true) {
531
+ const changes = events.changesSince(state.seq, () => true, Number.POSITIVE_INFINITY);
532
+ const slice = changes.slice(state.offset, state.offset + max);
533
+ const more = state.offset + max < changes.length;
534
+ return json(200, {
535
+ kind: "calendar#events",
536
+ // A cancelled (deleted) event is "only guaranteed to have the id field populated": render no more.
537
+ items: slice.map((c) => c.item === undefined || c.item.status === "cancelled"
538
+ ? { kind: "calendar#event", etag: `"${clock.seq}"`, id: c.id, status: "cancelled" }
539
+ : renderEvent(c.item)),
540
+ ...(more
541
+ ? { nextPageToken: encodeToken({ ...state, offset: state.offset + max }) }
542
+ : { nextSyncToken: encodeToken({ seq: until }) }),
543
+ });
544
+ }
545
+ const min = q.get("timeMin") === null ? undefined : instant(q.get("timeMin"));
546
+ const maxTime = q.get("timeMax") === null ? undefined : instant(q.get("timeMax"));
547
+ const showDeleted = q.get("showDeleted") === "true";
548
+ const all = [...events.items.values()]
549
+ .filter((e) => showDeleted || e.status !== "cancelled")
550
+ .filter((e) => (min === undefined || instant(e.end) > min) && (maxTime === undefined || instant(e.start) < maxTime))
551
+ .sort((a, b) => instant(a.start) - instant(b.start) || (a.id < b.id ? -1 : 1));
552
+ const offset = state?.offset ?? 0;
553
+ const startSeq = state?.seq ?? until;
554
+ const slice = all.slice(offset, offset + max);
555
+ return json(200, {
556
+ kind: "calendar#events",
557
+ items: slice.map(renderEvent),
558
+ ...(offset + max < all.length
559
+ ? { nextPageToken: encodeToken({ seq: startSeq, offset: offset + max, sync: false }) }
560
+ : { nextSyncToken: encodeToken({ seq: startSeq }) }),
561
+ });
562
+ }));
563
+ router.add("GET", "/calendar/v3/calendars/:cid/events/:id", api("calendar-json.googleapis.com", CAL_READ, (request) => {
564
+ const found = events.items.get(request.params["id"]);
565
+ return found === undefined ? calendarNotFound() : json(200, renderEvent(found));
566
+ }));
567
+ const timeOf = (value) => String(value?.dateTime ?? value?.date ?? "");
568
+ router.add("POST", "/calendar/v3/calendars/:cid/events", api("calendar-json.googleapis.com", CAL_WRITE, (request, me) => {
569
+ const body = (request.json ?? {});
570
+ if (timeOf(body["start"]) === "" || timeOf(body["end"]) === "") {
571
+ return googleError(400, "INVALID_ARGUMENT", "Missing end time.", [{ domain: "global", reason: "required" }]);
572
+ }
573
+ const event = events.put({
574
+ id: id("evt"),
575
+ calendarId: calendarOf(request.params["cid"], me),
576
+ status: "confirmed",
577
+ summary: String(body["summary"] ?? ""),
578
+ description: body["description"] ?? null,
579
+ location: body["location"] ?? null,
580
+ start: body["start"]?.dateTime ? new Date(body["start"].dateTime).toISOString() : timeOf(body["start"]),
581
+ end: body["end"]?.dateTime ? new Date(body["end"].dateTime).toISOString() : timeOf(body["end"]),
582
+ attendees: (body["attendees"] ?? []).map((a) => ({
583
+ email: a.email,
584
+ responseStatus: "needsAction",
585
+ })),
586
+ organizer: me.email,
587
+ updated: now(),
588
+ });
589
+ return json(200, renderEvent(event));
590
+ }));
591
+ router.add("PATCH", "/calendar/v3/calendars/:cid/events/:id", api("calendar-json.googleapis.com", CAL_WRITE, (request) => {
592
+ const body = (request.json ?? {});
593
+ const current = events.items.get(request.params["id"]);
594
+ if (current === undefined || current.status === "cancelled")
595
+ return calendarNotFound();
596
+ const updated = events.put({
597
+ ...current,
598
+ ...(body["summary"] === undefined ? {} : { summary: String(body["summary"]) }),
599
+ ...(body["description"] === undefined ? {} : { description: body["description"] }),
600
+ ...(body["location"] === undefined ? {} : { location: body["location"] }),
601
+ ...(body["start"] === undefined ? {} : { start: new Date(timeOf(body["start"])).toISOString() }),
602
+ ...(body["end"] === undefined ? {} : { end: new Date(timeOf(body["end"])).toISOString() }),
603
+ ...(body["attendees"] === undefined
604
+ ? {}
605
+ : {
606
+ // `self` is Google's to say (read-only): kept from the entry under the same address.
607
+ attendees: body["attendees"].map((a) => {
608
+ const own = current.attendees.find((c) => c.email === a.email)?.self;
609
+ const entry = {
610
+ email: a.email,
611
+ responseStatus: a.responseStatus ?? "needsAction",
612
+ };
613
+ if (own !== undefined)
614
+ entry.self = own;
615
+ return entry;
616
+ }),
617
+ }),
618
+ updated: now(),
619
+ });
620
+ return json(200, renderEvent(updated));
621
+ }));
622
+ router.add("DELETE", "/calendar/v3/calendars/:cid/events/:id", api("calendar-json.googleapis.com", CAL_WRITE, (request) => {
623
+ const current = events.items.get(request.params["id"]);
624
+ if (current === undefined || current.status === "cancelled") {
625
+ return legacyError(410, "Resource has been deleted", { reason: "deleted" });
626
+ }
627
+ events.put({ ...current, status: "cancelled", updated: now() });
628
+ return { status: 204 };
629
+ }));
630
+ // ---- Admin SDK Directory v1
631
+ const DIR_USERS = ["admin.directory.user.readonly", "admin.directory.user"];
632
+ const DIR_GROUPS = ["admin.directory.group.readonly", "admin.directory.group"];
633
+ /** The signed-in account is an administrator unless a test says otherwise. */
634
+ let administrator = true;
635
+ const notAuthorized = () => legacyError(403, "Not Authorized to access this resource/api", { reason: "forbidden" });
636
+ const renderUser = (u) => ({
637
+ kind: "admin#directory#user",
638
+ id: u.id,
639
+ etag: u.etag,
640
+ primaryEmail: u.primaryEmail,
641
+ name: { givenName: u.givenName, familyName: u.familyName, fullName: `${u.givenName} ${u.familyName}` },
642
+ isAdmin: false,
643
+ suspended: u.suspended,
644
+ orgUnitPath: "/",
645
+ ...(u.title === null && u.department === null
646
+ ? {}
647
+ : { organizations: [{ title: u.title, department: u.department, primary: true }] }),
648
+ });
649
+ router.add("GET", "/admin/directory/v1/users", api("admin.googleapis.com", DIR_USERS, (request) => {
650
+ if (!administrator)
651
+ return notAuthorized();
652
+ if (request.url.searchParams.get("customer") !== "my_customer" &&
653
+ request.url.searchParams.get("domain") === null) {
654
+ return legacyError(400, "Bad Request", { reason: "badRequest" });
655
+ }
656
+ const all = [...users.items.values()].sort((a, b) => (a.primaryEmail < b.primaryEmail ? -1 : 1));
657
+ const max = Math.min(500, Number(request.url.searchParams.get("maxResults") ?? 100));
658
+ const offset = Number(decodeToken(request.url.searchParams.get("pageToken") ?? "") ?? 0);
659
+ const page = all.slice(offset, offset + max);
660
+ return json(200, {
661
+ kind: "admin#directory#users",
662
+ // Absent, not empty, when there are none.
663
+ ...(page.length === 0 ? {} : { users: page.map(renderUser) }),
664
+ ...(offset + max < all.length ? { nextPageToken: encodeToken(offset + max) } : {}),
665
+ });
666
+ }));
667
+ router.add("GET", "/admin/directory/v1/users/:key", api("admin.googleapis.com", DIR_USERS, (request) => {
668
+ if (!administrator)
669
+ return notAuthorized();
670
+ const key = request.params["key"];
671
+ const found = users.items.get(key) ?? [...users.items.values()].find((u) => u.primaryEmail === key);
672
+ return found === undefined
673
+ ? legacyError(404, "Resource Not Found: userKey", { reason: "notFound" })
674
+ : json(200, renderUser(found));
675
+ }));
676
+ router.add("GET", "/admin/directory/v1/groups", api("admin.googleapis.com", DIR_GROUPS, () => administrator
677
+ ? json(200, {
678
+ kind: "admin#directory#groups",
679
+ groups: [{ id: "grp1", email: "everyone@workspace.example", name: "Everyone", description: "All staff" }],
680
+ })
681
+ : notAuthorized()));
682
+ const parseFields = (text) => {
683
+ let i = 0;
684
+ // A list of selectors up to `)` or the end: `name`, `name(list)` or `name/selector`.
685
+ const list = () => {
686
+ const out = new Map();
687
+ while (i < text.length && text[i] !== ")") {
688
+ const [name, sub] = selector();
689
+ const existing = out.get(name);
690
+ out.set(name, existing === undefined || existing === true || sub === true ? sub : new Map([...existing, ...sub]));
691
+ if (text[i] === ",")
692
+ i++;
693
+ }
694
+ return out;
695
+ };
696
+ const selector = () => {
697
+ let name = "";
698
+ while (i < text.length && !",()/".includes(text[i]))
699
+ name += text[i++];
700
+ if (text[i] === "(") {
701
+ i++;
702
+ const sub = list();
703
+ i++;
704
+ return [name.trim(), sub];
705
+ }
706
+ if (text[i] === "/") {
707
+ i++;
708
+ const [child, sub] = selector();
709
+ return [name.trim(), new Map([[child, sub]])];
710
+ }
711
+ return [name.trim(), true];
712
+ };
713
+ return list();
714
+ };
715
+ const project = (value, mask) => {
716
+ if (Array.isArray(value))
717
+ return value.map((v) => project(v, mask));
718
+ if (value === null || typeof value !== "object")
719
+ return value;
720
+ const out = {};
721
+ for (const [key, sub] of mask) {
722
+ if (key === "*")
723
+ return value;
724
+ if (!(key in value))
725
+ continue;
726
+ out[key] = sub === true ? value[key] : project(value[key], sub);
727
+ }
728
+ return out;
729
+ };
730
+ const DEFAULT_FILE = "kind,id,name,mimeType";
731
+ const partial = (request, body, defaults) => json(200, project(body, parseFields(request.url.searchParams.get("fields") ?? defaults)));
732
+ const DRIVE_READ = ["drive.readonly", "drive", "drive.file", "drive.metadata.readonly"];
733
+ const ROOT = "0AROOT";
734
+ /**
735
+ * Drive's processing after an upload. The real Drive reports one or two more changes of an uploaded file
736
+ * seconds later, with nothing a client changed (its `version` and thumbnail move on), so a delta's cursor taken
737
+ * right after an upload is followed by them. Here, deterministically: an upload's processing change is made
738
+ * just after Drive answers its next request (or when a test settles the fake).
739
+ */
740
+ const processing = new Set();
741
+ const processPending = () => {
742
+ for (const fileId of processing)
743
+ files.update(fileId, (f) => ({ ...f, version: f.version + 1 }));
744
+ processing.clear();
745
+ };
746
+ const drive = (handler) => (request) => {
747
+ const response = handler(request);
748
+ processPending();
749
+ return response;
750
+ };
751
+ const renderFile = (f) => ({
752
+ kind: "drive#file",
753
+ id: f.id,
754
+ name: f.name,
755
+ mimeType: f.mimeType,
756
+ parents: [f.parent],
757
+ trashed: f.trashed,
758
+ modifiedTime: f.modifiedTime,
759
+ version: String(f.version),
760
+ webViewLink: `https://drive.google.com/file/d/${f.id}/view`,
761
+ ...(f.mimeType === "application/vnd.google-apps.folder" ? {} : { size: String(Buffer.byteLength(f.content)) }),
762
+ });
763
+ router.add("GET", "/drive/v3/files", api("drive.googleapis.com", DRIVE_READ, drive((request) => {
764
+ const q = request.url.searchParams.get("q") ?? "";
765
+ const parent = /'([^']+)' in parents/u.exec(q)?.[1];
766
+ const parentId = parent === "root" ? ROOT : parent;
767
+ const excludeTrashed = /trashed\s*=\s*false/u.test(q);
768
+ const all = [...files.items.values()]
769
+ .filter((f) => parentId === undefined || f.parent === parentId)
770
+ .filter((f) => !excludeTrashed || !f.trashed)
771
+ .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : a.id < b.id ? -1 : 1));
772
+ const size = Math.min(1000, Number(request.url.searchParams.get("pageSize") ?? 100));
773
+ const offset = Number(decodeToken(request.url.searchParams.get("pageToken") ?? "") ?? 0);
774
+ return partial(request, {
775
+ kind: "drive#fileList",
776
+ files: all.slice(offset, offset + size).map(renderFile),
777
+ incompleteSearch: false,
778
+ ...(offset + size < all.length ? { nextPageToken: encodeToken(offset + size) } : {}),
779
+ }, `kind,nextPageToken,incompleteSearch,files(${DEFAULT_FILE})`);
780
+ })));
781
+ router.add("GET", "/drive/v3/files/:id", api("drive.googleapis.com", DRIVE_READ, drive((request) => {
782
+ const found = files.items.get(request.params["id"]);
783
+ if (found === undefined) {
784
+ return legacyError(404, `File not found: ${request.params["id"]}.`, {
785
+ reason: "notFound",
786
+ location: "fileId",
787
+ locationType: "parameter",
788
+ });
789
+ }
790
+ if (request.url.searchParams.get("alt") === "media") {
791
+ return { status: 200, headers: { "content-type": found.mimeType }, body: found.content };
792
+ }
793
+ return partial(request, renderFile(found), DEFAULT_FILE);
794
+ })));
795
+ router.add("GET", "/drive/v3/changes/startPageToken", api("drive.googleapis.com", DRIVE_READ, drive(() => json(200, { kind: "drive#startPageToken", startPageToken: String(clock.seq) }))));
796
+ router.add("GET", "/drive/v3/changes", api("drive.googleapis.com", DRIVE_READ, drive((request) => {
797
+ const token = request.url.searchParams.get("pageToken") ?? "";
798
+ const parsed = /^(\d+)(?::(\d+):(\d+))?$/u.exec(token);
799
+ const from = parsed === null ? Number.NaN : Number(parsed[1]);
800
+ if (parsed === null || from < minSeq.drive) {
801
+ return legacyError(400, "Invalid Value", {
802
+ reason: "invalid",
803
+ location: "pageToken",
804
+ locationType: "parameter",
805
+ });
806
+ }
807
+ const until = parsed[2] === undefined ? clock.seq : Number(parsed[2]);
808
+ const offset = parsed[3] === undefined ? 0 : Number(parsed[3]);
809
+ const size = Math.min(1000, Number(request.url.searchParams.get("pageSize") ?? 100));
810
+ const changes = files.changesSince(from, () => true, until);
811
+ const slice = changes.slice(offset, offset + size);
812
+ return partial(request, {
813
+ kind: "drive#changeList",
814
+ changes: slice.map((c) => c.item === undefined
815
+ ? { kind: "drive#change", changeType: "file", fileId: c.id, removed: true, time: now() }
816
+ : {
817
+ kind: "drive#change",
818
+ changeType: "file",
819
+ fileId: c.id,
820
+ removed: false,
821
+ file: renderFile(c.item),
822
+ time: now(),
823
+ }),
824
+ ...(offset + size < changes.length
825
+ ? { nextPageToken: `${from}:${until}:${offset + size}` }
826
+ : { newStartPageToken: String(until) }),
827
+ }, `kind,nextPageToken,newStartPageToken,changes(kind,changeType,time,removed,fileId,file(${DEFAULT_FILE}))`);
828
+ })));
829
+ const running = await serve(router);
830
+ base = running.url;
831
+ oauth.addAccount(self);
832
+ const rfcDate = () => Date.now();
833
+ return {
834
+ url: base,
835
+ oauth,
836
+ self,
837
+ clientId,
838
+ clientSecret,
839
+ settings: {
840
+ clientId,
841
+ clientSecret,
842
+ authorizeUrl: `${base}/o/oauth2/v2/auth`,
843
+ tokenUrl: `${base}/token`,
844
+ userinfoUrl: `${base}/v1/userinfo`,
845
+ gmailUrl: base,
846
+ calendarUrl: base,
847
+ adminUrl: base,
848
+ driveUrl: base,
849
+ },
850
+ apiRequests: () => apiRequests,
851
+ /** The API requests received so far (the newest 10 000), oldest first. */
852
+ requests: () => [...requestLog],
853
+ throttle,
854
+ rateLimitUser: (times) => {
855
+ userRateLimited = times;
856
+ },
857
+ setAdministrator: (value) => {
858
+ administrator = value;
859
+ },
860
+ expireCursors: (area) => {
861
+ minSeq[area] = clock.seq + 1;
862
+ },
863
+ mail: {
864
+ /**
865
+ * A message, by default received in the inbox now; `internalDate` (epoch ms) when Gmail took it in, and
866
+ * `headers` custom (`X-`) headers it carries (a sent copy's client id).
867
+ */
868
+ seed: (input) => messages.put({
869
+ id: id(),
870
+ threadId: id(),
871
+ labelIds: [...(input.labels ?? ["INBOX", "UNREAD"])],
872
+ from: "Sender <sender@fabrikam.example>",
873
+ to: self.email,
874
+ cc: "",
875
+ subject: input.subject,
876
+ body: `Body of ${input.subject}`,
877
+ internalDate: input.internalDate ?? rfcDate(),
878
+ ...(input.headers === undefined ? {} : { extraHeaders: input.headers }),
879
+ }).id,
880
+ modify: (id, add, remove) => void messages.update(id, (m) => ({
881
+ ...m,
882
+ labelIds: [...new Set([...m.labelIds.filter((l) => !remove.includes(l)), ...add])],
883
+ })),
884
+ get: (id) => messages.items.get(id),
885
+ /** The messages that carry `label` (drafts: `DRAFT`). */
886
+ labelled: (label) => [...messages.items.values()].filter((m) => m.labelIds.includes(label)),
887
+ /** Delete a message for good (not to TRASH): history reports it in `messagesDeleted`. */
888
+ remove: (id) => void messages.remove(id),
889
+ /** Make the next `n` reads of the send-as addresses fail with a 500. */
890
+ failSendAs: (n) => void (failingSendAs = n),
891
+ /** A verified send-as alias of the account. */
892
+ sendAs: (address, name = "") => void sendAs.push({ sendAsEmail: address, displayName: name }),
893
+ /** Make reading this message fail (500), or (`false`) answer again. */
894
+ failReads: (id, failing) => void (failing ? failingReads.add(id) : failingReads.delete(id)),
895
+ /** The account's filters as Gmail holds them (users.settings.filters). */
896
+ filters: () => [...filters.values()],
897
+ },
898
+ calendar: {
899
+ /** Someone else's busy time, as freeBusy shares it with the account (ISO instants). */
900
+ schedule: (address, blocks) => void busyOf.set(address.toLowerCase(), [...blocks]),
901
+ /** An event in the primary calendar; with `organizer` and `attendees`, an invitation from someone else. */
902
+ seed: (input) => events.put({
903
+ id: id("evt"),
904
+ calendarId: PRIMARY,
905
+ status: "confirmed",
906
+ summary: input.summary,
907
+ description: null,
908
+ location: null,
909
+ start: input.start,
910
+ end: input.end,
911
+ attendees: (input.attendees ?? []).map((a) => {
912
+ const entry = {
913
+ email: a.email,
914
+ responseStatus: a.responseStatus ?? "needsAction",
915
+ };
916
+ if (a.self !== undefined)
917
+ entry.self = a.self;
918
+ return entry;
919
+ }),
920
+ organizer: input.organizer ?? self.email,
921
+ updated: now(),
922
+ }).id,
923
+ update: (id, change) => void events.update(id, (e) => ({ ...e, ...change, updated: now() })),
924
+ cancel: (id) => void events.update(id, (e) => ({ ...e, status: "cancelled", updated: now() })),
925
+ get: (id) => events.items.get(id),
926
+ },
927
+ directory: {
928
+ seed: (input) => users.put({
929
+ id: String(100000000000 + Math.floor(Math.random() * 1e9)),
930
+ primaryEmail: input.email,
931
+ givenName: input.givenName,
932
+ familyName: input.familyName,
933
+ suspended: false,
934
+ title: null,
935
+ department: null,
936
+ etag: `"${id()}"`,
937
+ }).id,
938
+ update: (id, change) => void users.update(id, (u) => ({ ...u, ...change, etag: `"${randomBytes(8).toString("hex")}"` })),
939
+ remove: (id) => void users.remove(id),
940
+ },
941
+ drive: {
942
+ root: ROOT,
943
+ /** Upload a file (its processing change follows). */
944
+ seed: (input) => {
945
+ const file = files.put({
946
+ id: id("1F"),
947
+ name: input.name,
948
+ mimeType: "text/plain",
949
+ parent: input.parent ?? ROOT,
950
+ content: input.content ?? "",
951
+ trashed: false,
952
+ modifiedTime: now(),
953
+ version: 1,
954
+ });
955
+ processing.add(file.id);
956
+ return file.id;
957
+ },
958
+ /** Change a file; new content is an upload, and its processing change follows. */
959
+ update: (id, change) => {
960
+ files.update(id, (f) => ({ ...f, ...change, modifiedTime: now(), version: f.version + 1 }));
961
+ if (change.content !== undefined)
962
+ processing.add(id);
963
+ },
964
+ trash: (id) => void files.update(id, (f) => ({ ...f, trashed: true, modifiedTime: now(), version: f.version + 1 })),
965
+ remove: (id) => void files.remove(id),
966
+ /** Every pending processing change is made now: the change feed is settled. */
967
+ settled: async () => processPending(),
968
+ },
969
+ /** The next `times` API requests are carried out, then answered 503 as if the answer were lost on the way. */
970
+ loseResponses: (times) => void (lostResponses = times),
971
+ close: running.close,
972
+ };
973
+ };
974
+ /** The fake as a capability kit's provider: settings, the account, its controls and item seeds. */
975
+ export const googleProvider = (fake) => {
976
+ const email = fake.self.email;
977
+ const soon = (hours) => new Date(Math.floor(Date.now() / 1000) * 1000 + hours * 3_600_000).toISOString();
978
+ return {
979
+ settings: fake.settings,
980
+ self: fake.self,
981
+ controls: {
982
+ expireAccessTokens: async () => fake.oauth.expireAccessTokens(email),
983
+ revokeRefreshTokens: async () => fake.oauth.revokeRefreshTokens(email),
984
+ revokeScopes: async (scopes) => fake.oauth.revokeScopes(email, scopes),
985
+ restoreScopes: async () => fake.oauth.restoreScopes(email),
986
+ throttle: async (options) => fake.throttle.set(options),
987
+ throttleAfterWrite: async (options) => fake.throttle.afterWrite(options),
988
+ apiRequests: () => fake.apiRequests(),
989
+ refreshes: () => fake.oauth.stats.refreshes,
990
+ expireCursors: async (capability) => {
991
+ const area = { mail: "mail", calendar: "calendar", documents: "drive" }[capability];
992
+ if (area === undefined)
993
+ return false; // the Admin SDK has no delta: the connector's cursor is a snapshot
994
+ fake.expireCursors(area);
995
+ return true;
996
+ },
997
+ },
998
+ seeds: {
999
+ mail: {
1000
+ create: async (label) => fake.mail.seed({ subject: label }),
1001
+ update: async (id) => fake.mail.modify(id, [], ["UNREAD"]),
1002
+ remove: async (id) => fake.mail.modify(id, ["TRASH"], []),
1003
+ },
1004
+ calendar: {
1005
+ create: async (label) => fake.calendar.seed({ summary: label, start: soon(24), end: soon(25) }),
1006
+ update: async (id) => fake.calendar.update(id, { summary: "changed" }),
1007
+ remove: async (id) => fake.calendar.cancel(id),
1008
+ invite: async (label) => fake.calendar.seed({
1009
+ summary: label,
1010
+ start: soon(48),
1011
+ end: soon(49),
1012
+ organizer: "megan@workspace.example",
1013
+ attendees: [{ email: fake.self.email }],
1014
+ }),
1015
+ },
1016
+ directory: {
1017
+ create: async (label) => fake.directory.seed({
1018
+ givenName: "Person",
1019
+ familyName: label,
1020
+ email: `${label}-${crypto.randomUUID().slice(0, 8)}@workspace.example`,
1021
+ }),
1022
+ update: async (id) => fake.directory.update(id, { title: "Changed" }),
1023
+ remove: async (id) => fake.directory.remove(id),
1024
+ },
1025
+ documents: {
1026
+ create: async (label) => fake.drive.seed({ name: `${label}.txt`, content: `content of ${label}` }),
1027
+ update: async (id) => fake.drive.update(id, { content: "changed" }),
1028
+ remove: async (id) => fake.drive.trash(id),
1029
+ // Drive's change feed settles after an upload's processing (see `processing`).
1030
+ settle: () => fake.drive.settled(),
1031
+ },
1032
+ },
1033
+ };
1034
+ };
1035
+ //# sourceMappingURL=GoogleFake.js.map