@eloxiv/contracts 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 (537) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Agent.d.ts +792 -0
  4. package/dist/Agent.d.ts.map +1 -0
  5. package/dist/Agent.js +610 -0
  6. package/dist/Agent.js.map +1 -0
  7. package/dist/Analytics.d.ts +46 -0
  8. package/dist/Analytics.d.ts.map +1 -0
  9. package/dist/Analytics.js +89 -0
  10. package/dist/Analytics.js.map +1 -0
  11. package/dist/Approval.d.ts +70 -0
  12. package/dist/Approval.d.ts.map +1 -0
  13. package/dist/Approval.js +127 -0
  14. package/dist/Approval.js.map +1 -0
  15. package/dist/Catalog.d.ts +238 -0
  16. package/dist/Catalog.d.ts.map +1 -0
  17. package/dist/Catalog.js +169 -0
  18. package/dist/Catalog.js.map +1 -0
  19. package/dist/Checklist.d.ts +99 -0
  20. package/dist/Checklist.d.ts.map +1 -0
  21. package/dist/Checklist.js +105 -0
  22. package/dist/Checklist.js.map +1 -0
  23. package/dist/Data.d.ts +107 -0
  24. package/dist/Data.d.ts.map +1 -0
  25. package/dist/Data.js +93 -0
  26. package/dist/Data.js.map +1 -0
  27. package/dist/Devices.d.ts +857 -0
  28. package/dist/Devices.d.ts.map +1 -0
  29. package/dist/Devices.js +590 -0
  30. package/dist/Devices.js.map +1 -0
  31. package/dist/Durable.d.ts +406 -0
  32. package/dist/Durable.d.ts.map +1 -0
  33. package/dist/Durable.js +203 -0
  34. package/dist/Durable.js.map +1 -0
  35. package/dist/Errors.d.ts +95 -0
  36. package/dist/Errors.d.ts.map +1 -0
  37. package/dist/Errors.js +72 -0
  38. package/dist/Errors.js.map +1 -0
  39. package/dist/JsonSchema.d.ts +355 -0
  40. package/dist/JsonSchema.d.ts.map +1 -0
  41. package/dist/JsonSchema.js +151 -0
  42. package/dist/JsonSchema.js.map +1 -0
  43. package/dist/Manifest.d.ts +353 -0
  44. package/dist/Manifest.d.ts.map +1 -0
  45. package/dist/Manifest.js +894 -0
  46. package/dist/Manifest.js.map +1 -0
  47. package/dist/Module.d.ts +447 -0
  48. package/dist/Module.d.ts.map +1 -0
  49. package/dist/Module.js +221 -0
  50. package/dist/Module.js.map +1 -0
  51. package/dist/Optimistic.d.ts +192 -0
  52. package/dist/Optimistic.d.ts.map +1 -0
  53. package/dist/Optimistic.js +319 -0
  54. package/dist/Optimistic.js.map +1 -0
  55. package/dist/Projection.d.ts +163 -0
  56. package/dist/Projection.d.ts.map +1 -0
  57. package/dist/Projection.js +158 -0
  58. package/dist/Projection.js.map +1 -0
  59. package/dist/Proposals.d.ts +103 -0
  60. package/dist/Proposals.d.ts.map +1 -0
  61. package/dist/Proposals.js +72 -0
  62. package/dist/Proposals.js.map +1 -0
  63. package/dist/Receipt.d.ts +243 -0
  64. package/dist/Receipt.d.ts.map +1 -0
  65. package/dist/Receipt.js +108 -0
  66. package/dist/Receipt.js.map +1 -0
  67. package/dist/Records.d.ts +297 -0
  68. package/dist/Records.d.ts.map +1 -0
  69. package/dist/Records.js +171 -0
  70. package/dist/Records.js.map +1 -0
  71. package/dist/Render.d.ts +207 -0
  72. package/dist/Render.d.ts.map +1 -0
  73. package/dist/Render.js +502 -0
  74. package/dist/Render.js.map +1 -0
  75. package/dist/Rpc.d.ts +115 -0
  76. package/dist/Rpc.d.ts.map +1 -0
  77. package/dist/Rpc.js +68 -0
  78. package/dist/Rpc.js.map +1 -0
  79. package/dist/SearchLanguages.d.ts +4 -0
  80. package/dist/SearchLanguages.d.ts.map +1 -0
  81. package/dist/SearchLanguages.js +33 -0
  82. package/dist/SearchLanguages.js.map +1 -0
  83. package/dist/Service.d.ts +59 -0
  84. package/dist/Service.d.ts.map +1 -0
  85. package/dist/Service.js +38 -0
  86. package/dist/Service.js.map +1 -0
  87. package/dist/Versions.d.ts +9 -0
  88. package/dist/Versions.d.ts.map +1 -0
  89. package/dist/Versions.js +78 -0
  90. package/dist/Versions.js.map +1 -0
  91. package/dist/contracts/ActionConsent.d.ts +189 -0
  92. package/dist/contracts/ActionConsent.d.ts.map +1 -0
  93. package/dist/contracts/ActionConsent.js +129 -0
  94. package/dist/contracts/ActionConsent.js.map +1 -0
  95. package/dist/contracts/ActionRegistry.d.ts +149 -0
  96. package/dist/contracts/ActionRegistry.d.ts.map +1 -0
  97. package/dist/contracts/ActionRegistry.js +37 -0
  98. package/dist/contracts/ActionRegistry.js.map +1 -0
  99. package/dist/contracts/Actor.d.ts +129 -0
  100. package/dist/contracts/Actor.d.ts.map +1 -0
  101. package/dist/contracts/Actor.js +47 -0
  102. package/dist/contracts/Actor.js.map +1 -0
  103. package/dist/contracts/AgentResources.d.ts +248 -0
  104. package/dist/contracts/AgentResources.d.ts.map +1 -0
  105. package/dist/contracts/AgentResources.js +158 -0
  106. package/dist/contracts/AgentResources.js.map +1 -0
  107. package/dist/contracts/AgentRuntime.d.ts +453 -0
  108. package/dist/contracts/AgentRuntime.d.ts.map +1 -0
  109. package/dist/contracts/AgentRuntime.js +117 -0
  110. package/dist/contracts/AgentRuntime.js.map +1 -0
  111. package/dist/contracts/Approvals.d.ts +303 -0
  112. package/dist/contracts/Approvals.d.ts.map +1 -0
  113. package/dist/contracts/Approvals.js +117 -0
  114. package/dist/contracts/Approvals.js.map +1 -0
  115. package/dist/contracts/Audit.d.ts +510 -0
  116. package/dist/contracts/Audit.d.ts.map +1 -0
  117. package/dist/contracts/Audit.js +139 -0
  118. package/dist/contracts/Audit.js.map +1 -0
  119. package/dist/contracts/CalendarProvider.d.ts +572 -0
  120. package/dist/contracts/CalendarProvider.d.ts.map +1 -0
  121. package/dist/contracts/CalendarProvider.js +203 -0
  122. package/dist/contracts/CalendarProvider.js.map +1 -0
  123. package/dist/contracts/Capability.d.ts +197 -0
  124. package/dist/contracts/Capability.d.ts.map +1 -0
  125. package/dist/contracts/Capability.js +189 -0
  126. package/dist/contracts/Capability.js.map +1 -0
  127. package/dist/contracts/ClientSDK.d.ts +250 -0
  128. package/dist/contracts/ClientSDK.d.ts.map +1 -0
  129. package/dist/contracts/ClientSDK.js +184 -0
  130. package/dist/contracts/ClientSDK.js.map +1 -0
  131. package/dist/contracts/CollabDocument.d.ts +781 -0
  132. package/dist/contracts/CollabDocument.d.ts.map +1 -0
  133. package/dist/contracts/CollabDocument.js +364 -0
  134. package/dist/contracts/CollabDocument.js.map +1 -0
  135. package/dist/contracts/Command.d.ts +183 -0
  136. package/dist/contracts/Command.d.ts.map +1 -0
  137. package/dist/contracts/Command.js +66 -0
  138. package/dist/contracts/Command.js.map +1 -0
  139. package/dist/contracts/Connections.d.ts +612 -0
  140. package/dist/contracts/Connections.d.ts.map +1 -0
  141. package/dist/contracts/Connections.js +323 -0
  142. package/dist/contracts/Connections.js.map +1 -0
  143. package/dist/contracts/ContextAccounting.d.ts +79 -0
  144. package/dist/contracts/ContextAccounting.d.ts.map +1 -0
  145. package/dist/contracts/ContextAccounting.js +32 -0
  146. package/dist/contracts/ContextAccounting.js.map +1 -0
  147. package/dist/contracts/Daemon.d.ts +486 -0
  148. package/dist/contracts/Daemon.d.ts.map +1 -0
  149. package/dist/contracts/Daemon.js +192 -0
  150. package/dist/contracts/Daemon.js.map +1 -0
  151. package/dist/contracts/DbTx.d.ts +149 -0
  152. package/dist/contracts/DbTx.d.ts.map +1 -0
  153. package/dist/contracts/DbTx.js +94 -0
  154. package/dist/contracts/DbTx.js.map +1 -0
  155. package/dist/contracts/Delegation.d.ts +121 -0
  156. package/dist/contracts/Delegation.d.ts.map +1 -0
  157. package/dist/contracts/Delegation.js +76 -0
  158. package/dist/contracts/Delegation.js.map +1 -0
  159. package/dist/contracts/DeviceControl.d.ts +293 -0
  160. package/dist/contracts/DeviceControl.d.ts.map +1 -0
  161. package/dist/contracts/DeviceControl.js +107 -0
  162. package/dist/contracts/DeviceControl.js.map +1 -0
  163. package/dist/contracts/Directory.d.ts +492 -0
  164. package/dist/contracts/Directory.d.ts.map +1 -0
  165. package/dist/contracts/Directory.js +225 -0
  166. package/dist/contracts/Directory.js.map +1 -0
  167. package/dist/contracts/DirectoryProvider.d.ts +214 -0
  168. package/dist/contracts/DirectoryProvider.d.ts.map +1 -0
  169. package/dist/contracts/DirectoryProvider.js +73 -0
  170. package/dist/contracts/DirectoryProvider.js.map +1 -0
  171. package/dist/contracts/DocumentSource.d.ts +190 -0
  172. package/dist/contracts/DocumentSource.d.ts.map +1 -0
  173. package/dist/contracts/DocumentSource.js +64 -0
  174. package/dist/contracts/DocumentSource.js.map +1 -0
  175. package/dist/contracts/Files.d.ts +762 -0
  176. package/dist/contracts/Files.d.ts.map +1 -0
  177. package/dist/contracts/Files.js +339 -0
  178. package/dist/contracts/Files.js.map +1 -0
  179. package/dist/contracts/Flags.d.ts +265 -0
  180. package/dist/contracts/Flags.d.ts.map +1 -0
  181. package/dist/contracts/Flags.js +197 -0
  182. package/dist/contracts/Flags.js.map +1 -0
  183. package/dist/contracts/Host.d.ts +320 -0
  184. package/dist/contracts/Host.d.ts.map +1 -0
  185. package/dist/contracts/Host.js +224 -0
  186. package/dist/contracts/Host.js.map +1 -0
  187. package/dist/contracts/HttpApi.d.ts +102 -0
  188. package/dist/contracts/HttpApi.d.ts.map +1 -0
  189. package/dist/contracts/HttpApi.js +89 -0
  190. package/dist/contracts/HttpApi.js.map +1 -0
  191. package/dist/contracts/Ingestion.d.ts +522 -0
  192. package/dist/contracts/Ingestion.d.ts.map +1 -0
  193. package/dist/contracts/Ingestion.js +275 -0
  194. package/dist/contracts/Ingestion.js.map +1 -0
  195. package/dist/contracts/Ingress.d.ts +132 -0
  196. package/dist/contracts/Ingress.d.ts.map +1 -0
  197. package/dist/contracts/Ingress.js +102 -0
  198. package/dist/contracts/Ingress.js.map +1 -0
  199. package/dist/contracts/Invocation.d.ts +361 -0
  200. package/dist/contracts/Invocation.d.ts.map +1 -0
  201. package/dist/contracts/Invocation.js +104 -0
  202. package/dist/contracts/Invocation.js.map +1 -0
  203. package/dist/contracts/LocalClient.d.ts +878 -0
  204. package/dist/contracts/LocalClient.d.ts.map +1 -0
  205. package/dist/contracts/LocalClient.js +423 -0
  206. package/dist/contracts/LocalClient.js.map +1 -0
  207. package/dist/contracts/Locale.d.ts +162 -0
  208. package/dist/contracts/Locale.d.ts.map +1 -0
  209. package/dist/contracts/Locale.js +123 -0
  210. package/dist/contracts/Locale.js.map +1 -0
  211. package/dist/contracts/MachineIdentity.d.ts +434 -0
  212. package/dist/contracts/MachineIdentity.d.ts.map +1 -0
  213. package/dist/contracts/MachineIdentity.js +223 -0
  214. package/dist/contracts/MachineIdentity.js.map +1 -0
  215. package/dist/contracts/MailProvider.d.ts +791 -0
  216. package/dist/contracts/MailProvider.d.ts.map +1 -0
  217. package/dist/contracts/MailProvider.js +237 -0
  218. package/dist/contracts/MailProvider.js.map +1 -0
  219. package/dist/contracts/Memory.d.ts +62 -0
  220. package/dist/contracts/Memory.d.ts.map +1 -0
  221. package/dist/contracts/Memory.js +43 -0
  222. package/dist/contracts/Memory.js.map +1 -0
  223. package/dist/contracts/Messaging.d.ts +154 -0
  224. package/dist/contracts/Messaging.d.ts.map +1 -0
  225. package/dist/contracts/Messaging.js +97 -0
  226. package/dist/contracts/Messaging.js.map +1 -0
  227. package/dist/contracts/Metering.d.ts +334 -0
  228. package/dist/contracts/Metering.d.ts.map +1 -0
  229. package/dist/contracts/Metering.js +202 -0
  230. package/dist/contracts/Metering.js.map +1 -0
  231. package/dist/contracts/ModelProvider.d.ts +142 -0
  232. package/dist/contracts/ModelProvider.d.ts.map +1 -0
  233. package/dist/contracts/ModelProvider.js +72 -0
  234. package/dist/contracts/ModelProvider.js.map +1 -0
  235. package/dist/contracts/ModuleManifest.d.ts +2519 -0
  236. package/dist/contracts/ModuleManifest.d.ts.map +1 -0
  237. package/dist/contracts/ModuleManifest.js +272 -0
  238. package/dist/contracts/ModuleManifest.js.map +1 -0
  239. package/dist/contracts/NotificationChannel.d.ts +378 -0
  240. package/dist/contracts/NotificationChannel.d.ts.map +1 -0
  241. package/dist/contracts/NotificationChannel.js +136 -0
  242. package/dist/contracts/NotificationChannel.js.map +1 -0
  243. package/dist/contracts/Notifications.d.ts +417 -0
  244. package/dist/contracts/Notifications.d.ts.map +1 -0
  245. package/dist/contracts/Notifications.js +267 -0
  246. package/dist/contracts/Notifications.js.map +1 -0
  247. package/dist/contracts/Outbox.d.ts +469 -0
  248. package/dist/contracts/Outbox.d.ts.map +1 -0
  249. package/dist/contracts/Outbox.js +215 -0
  250. package/dist/contracts/Outbox.js.map +1 -0
  251. package/dist/contracts/Privacy.d.ts +1029 -0
  252. package/dist/contracts/Privacy.d.ts.map +1 -0
  253. package/dist/contracts/Privacy.js +437 -0
  254. package/dist/contracts/Privacy.js.map +1 -0
  255. package/dist/contracts/Progress.d.ts +305 -0
  256. package/dist/contracts/Progress.d.ts.map +1 -0
  257. package/dist/contracts/Progress.js +174 -0
  258. package/dist/contracts/Progress.js.map +1 -0
  259. package/dist/contracts/QuerySurface.d.ts +231 -0
  260. package/dist/contracts/QuerySurface.d.ts.map +1 -0
  261. package/dist/contracts/QuerySurface.js +113 -0
  262. package/dist/contracts/QuerySurface.js.map +1 -0
  263. package/dist/contracts/Readiness.d.ts +105 -0
  264. package/dist/contracts/Readiness.d.ts.map +1 -0
  265. package/dist/contracts/Readiness.js +57 -0
  266. package/dist/contracts/Readiness.js.map +1 -0
  267. package/dist/contracts/Release.d.ts +295 -0
  268. package/dist/contracts/Release.d.ts.map +1 -0
  269. package/dist/contracts/Release.js +175 -0
  270. package/dist/contracts/Release.js.map +1 -0
  271. package/dist/contracts/ResultRendering.d.ts +533 -0
  272. package/dist/contracts/ResultRendering.d.ts.map +1 -0
  273. package/dist/contracts/ResultRendering.js +59 -0
  274. package/dist/contracts/ResultRendering.js.map +1 -0
  275. package/dist/contracts/Sandbox.d.ts +1164 -0
  276. package/dist/contracts/Sandbox.d.ts.map +1 -0
  277. package/dist/contracts/Sandbox.js +550 -0
  278. package/dist/contracts/Sandbox.js.map +1 -0
  279. package/dist/contracts/Scheduler.d.ts +814 -0
  280. package/dist/contracts/Scheduler.d.ts.map +1 -0
  281. package/dist/contracts/Scheduler.js +202 -0
  282. package/dist/contracts/Scheduler.js.map +1 -0
  283. package/dist/contracts/ScreenContext.d.ts +514 -0
  284. package/dist/contracts/ScreenContext.d.ts.map +1 -0
  285. package/dist/contracts/ScreenContext.js +272 -0
  286. package/dist/contracts/ScreenContext.js.map +1 -0
  287. package/dist/contracts/Search.d.ts +308 -0
  288. package/dist/contracts/Search.d.ts.map +1 -0
  289. package/dist/contracts/Search.js +107 -0
  290. package/dist/contracts/Search.js.map +1 -0
  291. package/dist/contracts/Secrets.d.ts +483 -0
  292. package/dist/contracts/Secrets.d.ts.map +1 -0
  293. package/dist/contracts/Secrets.js +136 -0
  294. package/dist/contracts/Secrets.js.map +1 -0
  295. package/dist/contracts/Settings.d.ts +221 -0
  296. package/dist/contracts/Settings.d.ts.map +1 -0
  297. package/dist/contracts/Settings.js +163 -0
  298. package/dist/contracts/Settings.js.map +1 -0
  299. package/dist/contracts/Sharing.d.ts +319 -0
  300. package/dist/contracts/Sharing.d.ts.map +1 -0
  301. package/dist/contracts/Sharing.js +172 -0
  302. package/dist/contracts/Sharing.js.map +1 -0
  303. package/dist/contracts/Slot.d.ts +162 -0
  304. package/dist/contracts/Slot.d.ts.map +1 -0
  305. package/dist/contracts/Slot.js +56 -0
  306. package/dist/contracts/Slot.js.map +1 -0
  307. package/dist/contracts/Space.d.ts +256 -0
  308. package/dist/contracts/Space.d.ts.map +1 -0
  309. package/dist/contracts/Space.js +133 -0
  310. package/dist/contracts/Space.js.map +1 -0
  311. package/dist/contracts/StorageAdapter.d.ts +124 -0
  312. package/dist/contracts/StorageAdapter.d.ts.map +1 -0
  313. package/dist/contracts/StorageAdapter.js +96 -0
  314. package/dist/contracts/StorageAdapter.js.map +1 -0
  315. package/dist/contracts/StorageBackend.d.ts +310 -0
  316. package/dist/contracts/StorageBackend.d.ts.map +1 -0
  317. package/dist/contracts/StorageBackend.js +196 -0
  318. package/dist/contracts/StorageBackend.js.map +1 -0
  319. package/dist/contracts/Sync.d.ts +286 -0
  320. package/dist/contracts/Sync.d.ts.map +1 -0
  321. package/dist/contracts/Sync.js +157 -0
  322. package/dist/contracts/Sync.js.map +1 -0
  323. package/dist/contracts/Telemetry.d.ts +183 -0
  324. package/dist/contracts/Telemetry.d.ts.map +1 -0
  325. package/dist/contracts/Telemetry.js +153 -0
  326. package/dist/contracts/Telemetry.js.map +1 -0
  327. package/dist/contracts/ThemeTokens.d.ts +212 -0
  328. package/dist/contracts/ThemeTokens.d.ts.map +1 -0
  329. package/dist/contracts/ThemeTokens.js +111 -0
  330. package/dist/contracts/ThemeTokens.js.map +1 -0
  331. package/dist/contracts/ToolSource.d.ts +135 -0
  332. package/dist/contracts/ToolSource.d.ts.map +1 -0
  333. package/dist/contracts/ToolSource.js +81 -0
  334. package/dist/contracts/ToolSource.js.map +1 -0
  335. package/dist/contracts/Versioning.d.ts +363 -0
  336. package/dist/contracts/Versioning.d.ts.map +1 -0
  337. package/dist/contracts/Versioning.js +201 -0
  338. package/dist/contracts/Versioning.js.map +1 -0
  339. package/dist/contracts/View.d.ts +232 -0
  340. package/dist/contracts/View.d.ts.map +1 -0
  341. package/dist/contracts/View.js +102 -0
  342. package/dist/contracts/View.js.map +1 -0
  343. package/dist/contracts/WorkItems.d.ts +242 -0
  344. package/dist/contracts/WorkItems.d.ts.map +1 -0
  345. package/dist/contracts/WorkItems.js +126 -0
  346. package/dist/contracts/WorkItems.js.map +1 -0
  347. package/dist/contracts/Workflow.d.ts +191 -0
  348. package/dist/contracts/Workflow.d.ts.map +1 -0
  349. package/dist/contracts/Workflow.js +63 -0
  350. package/dist/contracts/Workflow.js.map +1 -0
  351. package/dist/contracts/index.d.ts +75 -0
  352. package/dist/contracts/index.d.ts.map +1 -0
  353. package/dist/contracts/index.js +196 -0
  354. package/dist/contracts/index.js.map +1 -0
  355. package/dist/devices/module.d.ts +3777 -0
  356. package/dist/devices/module.d.ts.map +1 -0
  357. package/dist/devices/module.js +179 -0
  358. package/dist/devices/module.js.map +1 -0
  359. package/dist/drizzle/Entity.d.ts +148 -0
  360. package/dist/drizzle/Entity.d.ts.map +1 -0
  361. package/dist/drizzle/Entity.js +396 -0
  362. package/dist/drizzle/Entity.js.map +1 -0
  363. package/dist/index.d.ts +20 -0
  364. package/dist/index.d.ts.map +1 -0
  365. package/dist/index.js +20 -0
  366. package/dist/index.js.map +1 -0
  367. package/package.json +48 -3
  368. package/schema/Actor.json +46 -0
  369. package/schema/AuditRecord.json +403 -0
  370. package/schema/DaemonHealth.json +29 -0
  371. package/schema/InvocationError.json +257 -0
  372. package/schema/InvocationReceipt.json +253 -0
  373. package/schema/Lockfile.json +129 -0
  374. package/schema/OutboxEvent.json +36 -0
  375. package/schema/PairingConfirm.json +33 -0
  376. package/schema/PairingResult.json +18 -0
  377. package/schema/PairingStart.json +18 -0
  378. package/schema/ProvenanceEntry.json +110 -0
  379. package/schema/ReplayEnvelope.json +269 -0
  380. package/schema/Surface.json +17 -0
  381. package/schema/codegen/LocalClient.json +1295 -0
  382. package/schema/codegen/Sandbox.json +320 -0
  383. package/schema/contracts/ActionConsent.json +1930 -0
  384. package/schema/contracts/ActionRegistry.json +722 -0
  385. package/schema/contracts/Actor.json +451 -0
  386. package/schema/contracts/AgentResources.json +1400 -0
  387. package/schema/contracts/AgentRuntime.json +4017 -0
  388. package/schema/contracts/Approvals.json +2916 -0
  389. package/schema/contracts/Audit.json +3268 -0
  390. package/schema/contracts/CalendarProvider.json +5557 -0
  391. package/schema/contracts/ClientSDK.json +1400 -0
  392. package/schema/contracts/CollabDocument.json +4012 -0
  393. package/schema/contracts/Command.json +616 -0
  394. package/schema/contracts/Connections.json +6687 -0
  395. package/schema/contracts/ContextAccounting.json +685 -0
  396. package/schema/contracts/Daemon.json +4555 -0
  397. package/schema/contracts/DbTx.json +321 -0
  398. package/schema/contracts/Delegation.json +949 -0
  399. package/schema/contracts/DeviceControl.json +2626 -0
  400. package/schema/contracts/Directory.json +5168 -0
  401. package/schema/contracts/DirectoryProvider.json +2090 -0
  402. package/schema/contracts/DocumentSource.json +2044 -0
  403. package/schema/contracts/Files.json +4122 -0
  404. package/schema/contracts/Flags.json +1202 -0
  405. package/schema/contracts/Host.json +1769 -0
  406. package/schema/contracts/HttpApi.json +1615 -0
  407. package/schema/contracts/Ingestion.json +3211 -0
  408. package/schema/contracts/Ingress.json +819 -0
  409. package/schema/contracts/Invocation.json +2044 -0
  410. package/schema/contracts/LocalClient.json +6642 -0
  411. package/schema/contracts/Locale.json +654 -0
  412. package/schema/contracts/MachineIdentity.json +2303 -0
  413. package/schema/contracts/MailProvider.json +6663 -0
  414. package/schema/contracts/Memory.json +579 -0
  415. package/schema/contracts/Messaging.json +1764 -0
  416. package/schema/contracts/Metering.json +3060 -0
  417. package/schema/contracts/ModelProvider.json +1127 -0
  418. package/schema/contracts/ModuleManifest.json +9449 -0
  419. package/schema/contracts/NotificationChannel.json +986 -0
  420. package/schema/contracts/Notifications.json +4280 -0
  421. package/schema/contracts/Outbox.json +1451 -0
  422. package/schema/contracts/Privacy.json +4354 -0
  423. package/schema/contracts/Progress.json +1524 -0
  424. package/schema/contracts/QuerySurface.json +661 -0
  425. package/schema/contracts/Readiness.json +209 -0
  426. package/schema/contracts/Release.json +805 -0
  427. package/schema/contracts/ResultRendering.json +2859 -0
  428. package/schema/contracts/Sandbox.json +2286 -0
  429. package/schema/contracts/Scheduler.json +6138 -0
  430. package/schema/contracts/ScreenContext.json +1238 -0
  431. package/schema/contracts/Search.json +1058 -0
  432. package/schema/contracts/Secrets.json +2444 -0
  433. package/schema/contracts/Settings.json +654 -0
  434. package/schema/contracts/Sharing.json +2854 -0
  435. package/schema/contracts/Slot.json +537 -0
  436. package/schema/contracts/Space.json +892 -0
  437. package/schema/contracts/StorageAdapter.json +623 -0
  438. package/schema/contracts/StorageBackend.json +2421 -0
  439. package/schema/contracts/Sync.json +894 -0
  440. package/schema/contracts/Telemetry.json +696 -0
  441. package/schema/contracts/ThemeTokens.json +547 -0
  442. package/schema/contracts/ToolSource.json +1333 -0
  443. package/schema/contracts/Versioning.json +1481 -0
  444. package/schema/contracts/View.json +750 -0
  445. package/schema/contracts/WorkItems.json +1731 -0
  446. package/schema/contracts/Workflow.json +1242 -0
  447. package/src/Agent.ts +758 -0
  448. package/src/Analytics.ts +110 -0
  449. package/src/Approval.ts +131 -0
  450. package/src/Catalog.ts +192 -0
  451. package/src/Checklist.ts +162 -0
  452. package/src/Data.ts +109 -0
  453. package/src/Devices.ts +721 -0
  454. package/src/Durable.ts +240 -0
  455. package/src/Errors.ts +111 -0
  456. package/src/JsonSchema.ts +166 -0
  457. package/src/Manifest.ts +1147 -0
  458. package/src/Module.ts +640 -0
  459. package/src/Optimistic.ts +332 -0
  460. package/src/Projection.ts +207 -0
  461. package/src/Proposals.ts +89 -0
  462. package/src/Receipt.ts +125 -0
  463. package/src/Records.ts +197 -0
  464. package/src/Render.ts +515 -0
  465. package/src/Rpc.ts +113 -0
  466. package/src/SearchLanguages.ts +33 -0
  467. package/src/Service.ts +102 -0
  468. package/src/Versions.ts +69 -0
  469. package/src/contracts/ActionConsent.ts +150 -0
  470. package/src/contracts/ActionRegistry.ts +39 -0
  471. package/src/contracts/Actor.ts +53 -0
  472. package/src/contracts/AgentResources.ts +167 -0
  473. package/src/contracts/AgentRuntime.ts +154 -0
  474. package/src/contracts/Approvals.ts +133 -0
  475. package/src/contracts/Audit.ts +160 -0
  476. package/src/contracts/CalendarProvider.ts +241 -0
  477. package/src/contracts/Capability.ts +246 -0
  478. package/src/contracts/ClientSDK.ts +199 -0
  479. package/src/contracts/CollabDocument.ts +420 -0
  480. package/src/contracts/Command.ts +74 -0
  481. package/src/contracts/Connections.ts +360 -0
  482. package/src/contracts/ContextAccounting.ts +35 -0
  483. package/src/contracts/Daemon.ts +247 -0
  484. package/src/contracts/DbTx.ts +110 -0
  485. package/src/contracts/Delegation.ts +91 -0
  486. package/src/contracts/DeviceControl.ts +143 -0
  487. package/src/contracts/Directory.ts +384 -0
  488. package/src/contracts/DirectoryProvider.ts +82 -0
  489. package/src/contracts/DocumentSource.ts +71 -0
  490. package/src/contracts/Files.ts +395 -0
  491. package/src/contracts/Flags.ts +241 -0
  492. package/src/contracts/Host.ts +245 -0
  493. package/src/contracts/HttpApi.ts +100 -0
  494. package/src/contracts/Ingestion.ts +315 -0
  495. package/src/contracts/Ingress.ts +132 -0
  496. package/src/contracts/Invocation.ts +122 -0
  497. package/src/contracts/LocalClient.ts +614 -0
  498. package/src/contracts/Locale.ts +133 -0
  499. package/src/contracts/MachineIdentity.ts +305 -0
  500. package/src/contracts/MailProvider.ts +272 -0
  501. package/src/contracts/Memory.ts +47 -0
  502. package/src/contracts/Messaging.ts +108 -0
  503. package/src/contracts/Metering.ts +231 -0
  504. package/src/contracts/ModelProvider.ts +87 -0
  505. package/src/contracts/ModuleManifest.ts +310 -0
  506. package/src/contracts/NotificationChannel.ts +158 -0
  507. package/src/contracts/Notifications.ts +309 -0
  508. package/src/contracts/Outbox.ts +246 -0
  509. package/src/contracts/Privacy.ts +502 -0
  510. package/src/contracts/Progress.ts +196 -0
  511. package/src/contracts/QuerySurface.ts +134 -0
  512. package/src/contracts/Readiness.ts +67 -0
  513. package/src/contracts/Release.ts +199 -0
  514. package/src/contracts/ResultRendering.ts +65 -0
  515. package/src/contracts/Sandbox.ts +648 -0
  516. package/src/contracts/Scheduler.ts +237 -0
  517. package/src/contracts/ScreenContext.ts +316 -0
  518. package/src/contracts/Search.ts +126 -0
  519. package/src/contracts/Secrets.ts +162 -0
  520. package/src/contracts/Settings.ts +207 -0
  521. package/src/contracts/Sharing.ts +205 -0
  522. package/src/contracts/Slot.ts +61 -0
  523. package/src/contracts/Space.ts +157 -0
  524. package/src/contracts/StorageAdapter.ts +104 -0
  525. package/src/contracts/StorageBackend.ts +220 -0
  526. package/src/contracts/Sync.ts +180 -0
  527. package/src/contracts/Telemetry.ts +177 -0
  528. package/src/contracts/ThemeTokens.ts +136 -0
  529. package/src/contracts/ToolSource.ts +94 -0
  530. package/src/contracts/Versioning.ts +237 -0
  531. package/src/contracts/View.ts +116 -0
  532. package/src/contracts/WorkItems.ts +144 -0
  533. package/src/contracts/Workflow.ts +67 -0
  534. package/src/contracts/index.ts +205 -0
  535. package/src/devices/module.ts +201 -0
  536. package/src/drizzle/Entity.ts +524 -0
  537. package/src/index.ts +19 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Files.d.ts","sourceRoot":"","sources":["../../src/contracts/Files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvE,+FAA+F;AAC/F,eAAO,MAAM,YAAY,wBAAwB,CAAA;AAEjD,qHAAqH;AACrH,eAAO,MAAM,aAAa,WAAW,CAAA;AAErC,kDAAkD;AAClD,eAAO,MAAM,aAAa;aACxB,WAAW,EAAE,mBAAmB;aAChC,YAAY,EAAE,oBAAoB;aAClC,cAAc,EAAE,sBAAsB;aACtC,WAAW,EAAE,mBAAmB;aAChC,MAAM,EAAE,gBAAgB;aACxB,GAAG,EAAE,WAAW;aAChB,IAAI,EAAE,YAAY;aAClB,QAAQ,EAAE,gBAAgB;aAC1B,IAAI,EAAE,gBAAgB;aACtB,MAAM,EAAE,cAAc;aACtB,MAAM,EAAE,cAAc;aACtB,KAAK,EAAE,aAAa;aACpB,QAAQ,EAAE,gBAAgB;aAC1B,UAAU,EAAE,kBAAkB;aAC9B,YAAY,EAAE,oBAAoB;aAClC,OAAO,EAAE,eAAe;CAChB,CAAA;AAEV;;;;;GAKG;AACH,eAAO,MAAM,SAAS,0GAAkG,CAAA;AACxH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C,8EAA8E;AAC9E,eAAO,MAAM,WAAW,q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CAA0C;;;;;;QAtG1C,sCAAsC;;QAEtC,wFAAwF;;;QAGxF,wDAAwD;;;QAGxD,8CAA8C;;;QAG9C,yFAAyF;;;;;;QAGzF,qBAAqB;;;;QAIrB,kEAAkE;;;;;QA0FlE,0GAA0G;;QAE1G,kDAAkD;;;;QAMlD,sDAAsD;;;;QARtD,0GAA0G;;QAE1G,kDAAkD;;;;;QAoBlD,2EAA2E;;;;QAI3E,6EAA6E;;;;QAI7E;;;;WAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoBH,iCAAiC;;;;;;;;;;;;;;;;;;;;QAAjC,iCAAiC;;;;;;;;;QAkBjC,8CAA8C;;;;;;;;QApL9C,sCAAsC;;QAEtC,wFAAwF;;;QAGxF,wDAAwD;;;QAGxD,8CAA8C;;;QAG9C,yFAAyF;;;;;;QAGzF,qBAAqB;;;;QAIrB,kEAAkE;;;;;;;;;;;;QA4BlE,2EAA2E;;;;;;;QAE3E,yCAAyC;;QAEzC,2GAA2G;;QAE3G,oFAAoF;;;;;;;;;;;QAiBpF,4FAA4F;;;;;;;QAiB5F,wCAAwC;;;QAGxC,0CAA0C;;QAE1C,uDAAuD;;QAEvD,sGAAsG;;QAEtG,iEAAiE;;;;;QAajE,0GAA0G;;QAE1G,kDAAkD;;;;;;;;;;QAsElD,8CAA8C;;;;;;;;;;;EAwJ9C,CAAA"}
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Files: file records owned by modules and attached to their records by reference (docs/contracts/files.md).
3
+ * The bytes live in the deployment's StorageBackend; the metadata, the attachment and every authorisation are the
4
+ * kernel's. A file attached to a record is readable exactly when its record is (the record's entity's `read`
5
+ * policy, at the moment of every read), and attached, replaced or deleted by whoever the entity's `attach` policy
6
+ * allows. An entity accepts files only if it declares `files` (size and type limits, whether to ingest them).
7
+ *
8
+ * The kernel module `files` serves the actions; the upload and download bytes travel over short-lived signed URLs
9
+ * the actions issue, on the kernel's own routes: each part URL once, each download URL only while its holder may\n * still read the file.
10
+ */
11
+ import { Schema } from "effect";
12
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.js";
13
+ import { defineOperation, defineServiceContract } from "../Service.js";
14
+ /** Organisation administrators with this permission set storage quotas and retention holds. */
15
+ export const FILES_MANAGE = "eloxiv.files.manage";
16
+ /** The kernel's Cedar action on every entity that declares `files`: who may attach, replace and delete its files. */
17
+ export const ATTACH_ACTION = "attach";
18
+ /** The actions of the kernel's `files` module. */
19
+ export const FILES_ACTIONS = {
20
+ beginUpload: "files.beginUpload",
21
+ resumeUpload: "files.resumeUpload",
22
+ completeUpload: "files.completeUpload",
23
+ abortUpload: "files.abortUpload",
24
+ attach: "files.attachTo",
25
+ get: "files.get",
26
+ list: "files.list",
27
+ download: "files.download",
28
+ read: "files.readText",
29
+ delete: "files.delete",
30
+ retain: "files.retain",
31
+ usage: "files.usage",
32
+ setQuota: "files.setQuota",
33
+ setStorage: "files.setStorage",
34
+ clearStorage: "files.clearStorage",
35
+ storage: "files.storage",
36
+ };
37
+ /**
38
+ * A file's lifecycle. `uploading`: parts are arriving. `processing`: complete, being inspected (size, content
39
+ * type, hash) and scanned. `available`: readable. `quarantined`: the scanner found something; the bytes are
40
+ * deleted. `rejected`: the bytes broke a limit (size, sniffed type); the bytes are deleted. `deleted`: deleted,
41
+ * or its record was; the bytes are purged once retention allows.
42
+ */
43
+ export const FileState = Schema.Literals(["uploading", "processing", "available", "quarantined", "rejected", "deleted"]);
44
+ /** The virus scan's verdict: `skipped` when the deployment has no scanner. */
45
+ export const ScanVerdict = Schema.Literals(["clean", "infected", "skipped", "error"]);
46
+ /** A record a file is attached to: its entity's Cedar type (`Archive::Doc`) and primary key. */
47
+ export const RecordRef = Schema.Struct({ entity: Schema.String, id: Schema.String });
48
+ /** A file's metadata, as `files.get` returns it and the replica holds it. Never its bytes or storage key. */
49
+ export const FileRecord = Schema.Struct({
50
+ id: Schema.String,
51
+ orgId: Schema.String,
52
+ name: Schema.String,
53
+ /** The type the uploader declared. */
54
+ declaredType: Schema.String,
55
+ /** The type the kernel serves it as: sniffed from the content; null until processed. */
56
+ contentType: Schema.NullOr(Schema.String),
57
+ size: Schema.Number,
58
+ /** Hex SHA-256 of the content; null until processed. */
59
+ sha256: Schema.NullOr(Schema.String),
60
+ state: FileState,
61
+ /** Why a file was rejected or quarantined. */
62
+ stateReason: Schema.NullOr(Schema.String),
63
+ scan: Schema.NullOr(ScanVerdict),
64
+ /** The record it is attached to; null while it is staged (uploaded but not attached). */
65
+ attachedTo: Schema.NullOr(RecordRef),
66
+ uploadedBy: Schema.String,
67
+ /** ISO 8601, UTC. */
68
+ createdAt: Schema.String,
69
+ completedAt: Schema.NullOr(Schema.String),
70
+ deletedAt: Schema.NullOr(Schema.String),
71
+ /** Deletion is refused before this instant (a retention hold). */
72
+ retainUntil: Schema.NullOr(Schema.String),
73
+ });
74
+ /** Where to PUT one part: a signed URL, with the headers to send and the exact length it accepts. */
75
+ export const PartUrl = Schema.Struct({
76
+ partNumber: Schema.Int,
77
+ size: Schema.Number,
78
+ url: Schema.String,
79
+ headers: Schema.Record(Schema.String, Schema.String),
80
+ });
81
+ export const BeginUpload = Schema.Struct({
82
+ name: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(255)),
83
+ /** The declared media type (`type/subtype`). */
84
+ contentType: Schema.String.check(Schema.isMaxLength(255)),
85
+ /** The exact size in bytes. */
86
+ size: Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0)),
87
+ /** Attach it to this record when it completes (the entity's `attach` policy); otherwise it stays staged. */
88
+ attachTo: Schema.optionalKey(RecordRef),
89
+ });
90
+ export const UploadPlan = Schema.Struct({
91
+ fileId: Schema.String,
92
+ partSize: Schema.Number,
93
+ /** The parts still to upload, each with its URL (all of them at first). */
94
+ parts: Schema.Array(PartUrl),
95
+ /** Parts already received (resuming). */
96
+ received: Schema.Array(Schema.Int),
97
+ /** ISO 8601: the URLs stop working then; `files.resumeUpload` issues new ones until the upload expires. */
98
+ urlsExpireAt: Schema.String,
99
+ /** ISO 8601: an upload not completed by then is abandoned and its parts deleted. */
100
+ uploadExpiresAt: Schema.String,
101
+ });
102
+ export const FileId = Schema.Struct({ fileId: Schema.String });
103
+ export const Attach = Schema.Struct({ fileId: Schema.String, to: RecordRef });
104
+ export const Download = Schema.Struct({
105
+ fileId: Schema.String,
106
+ /** `attachment` (the default) or `inline` (only for types safe to render: images but SVG, PDF, plain text). */
107
+ disposition: Schema.optionalKey(Schema.Literals(["attachment", "inline"])),
108
+ });
109
+ export const DownloadUrl = Schema.Struct({
110
+ url: Schema.String,
111
+ /** ISO 8601: the URL stops working then (it cannot be revoked before; it is kept short). */
112
+ expiresAt: Schema.String,
113
+ contentType: Schema.String,
114
+ size: Schema.Number,
115
+ });
116
+ export const ReadText = Schema.Struct({
117
+ fileId: Schema.String,
118
+ /** Character offset to start at (default 0). */
119
+ offset: Schema.optionalKey(Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))),
120
+ /** At most this many characters (default and maximum 20000). */
121
+ limit: Schema.optionalKey(Schema.Number.check(Schema.isInt(), Schema.isBetween({ minimum: 1, maximum: 20_000 }))),
122
+ });
123
+ export const TextPage = Schema.Struct({
124
+ fileId: Schema.String,
125
+ /** The extracted text from `offset`. */
126
+ text: Schema.String,
127
+ offset: Schema.Number,
128
+ /** Total characters of extracted text. */
129
+ total: Schema.Number,
130
+ /** The offset of the next page, or null at the end. */
131
+ nextOffset: Schema.NullOr(Schema.Number),
132
+ /** `done` once extracted; otherwise the ingestion's state (`queued`, `extracting`, ...) or `none`. */
133
+ extraction: Schema.String,
134
+ /** The extraction stopped at the ingestion's character limit. */
135
+ truncated: Schema.Boolean,
136
+ });
137
+ export const Retain = Schema.Struct({
138
+ fileId: Schema.String,
139
+ /** ISO 8601, or null to lift the hold. */
140
+ until: Schema.NullOr(Schema.String),
141
+ });
142
+ export const StorageUsage = Schema.Struct({
143
+ orgId: Schema.String,
144
+ /** Bytes of every file not deleted, including uploads in progress (they are reserved when they begin). */
145
+ usedBytes: Schema.Number,
146
+ /** The organisation's quota, or null for none. */
147
+ limitBytes: Schema.NullOr(Schema.Number),
148
+ });
149
+ export const SetQuota = Schema.Struct({
150
+ /** Bytes, or null to use the deployment's default. */
151
+ limitBytes: Schema.NullOr(Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0))),
152
+ });
153
+ /**
154
+ * Whose storage provider: the organisation's (its administrators set it; every member's new files go there) or the
155
+ * caller's own (their new files go there, over the organisation's).
156
+ */
157
+ export const StorageScope = Schema.Literals(["org", "personal"]);
158
+ /** An S3-compatible store an organisation or a person keeps their files in (`files.setStorage`). */
159
+ export const SetStorage = Schema.Struct({
160
+ scope: StorageScope,
161
+ /** `https://...` (or `http://` on a loopback address, for development). */
162
+ endpoint: Schema.String.check(Schema.isMaxLength(500)),
163
+ region: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(100)),
164
+ bucket: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(255)),
165
+ /** Keys are stored under it (`eloxiv/`), so one bucket can serve several. */
166
+ prefix: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(200))),
167
+ forcePathStyle: Schema.optionalKey(Schema.Boolean),
168
+ accessKeyId: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(200)),
169
+ /**
170
+ * The name of the Secret that holds the secret access key: the caller's own (`personal`) or the organisation's
171
+ * (`org`), stored first through the Secrets contract. No action input carries the key itself, so neither a proposal
172
+ * nor an approval request of this call, nor its audit, ever holds it.
173
+ */
174
+ secret: Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(200)),
175
+ });
176
+ /** A storage provider as anyone may see it: never its secret. */
177
+ export const StorageProvider = Schema.Struct({
178
+ id: Schema.String,
179
+ scope: StorageScope,
180
+ endpoint: Schema.String,
181
+ region: Schema.String,
182
+ bucket: Schema.String,
183
+ prefix: Schema.String,
184
+ });
185
+ /** Where the caller's new files go: their own provider, else their organisation's, else the deployment's (null). */
186
+ export const StorageChoice = Schema.Struct({
187
+ org: Schema.NullOr(StorageProvider),
188
+ personal: Schema.NullOr(StorageProvider),
189
+ /** The one new files use now. */
190
+ current: Schema.Literals(["personal", "org", "deployment"]),
191
+ });
192
+ /**
193
+ * What an entity declares to accept files (`EntityContract.files`): the largest file (bytes, default the
194
+ * deployment's limit, never above it), the media types it accepts (`image/*`, `application/pdf`; default any but
195
+ * executables), and whether attached files are ingested into search (the Ingestion contract).
196
+ */
197
+ export const EntityFilesDeclaration = Schema.Struct({
198
+ maxBytes: Schema.optionalKey(Schema.Number),
199
+ types: Schema.optionalKey(Schema.Array(Schema.String)),
200
+ ingest: Schema.optionalKey(Schema.Boolean),
201
+ });
202
+ /** A virus scanner's answer for one file (the in-process `FileScanner` hook). */
203
+ export const ScanResult = Schema.Struct({
204
+ verdict: Schema.Literals(["clean", "infected", "error"]),
205
+ /** What was found, or why the scan failed. */
206
+ detail: Schema.NullOr(Schema.String),
207
+ });
208
+ /** The outbox events of the kernel's `files` module, for modules to react to. */
209
+ export const FileEventPayload = Schema.Struct({
210
+ fileId: Schema.String,
211
+ attachedTo: Schema.NullOr(RecordRef),
212
+ state: FileState,
213
+ });
214
+ const errors = Schema.Union([Unauthenticated, Forbidden, InvalidInput]);
215
+ export const FilesContract = defineServiceContract({
216
+ name: "Files",
217
+ kind: "kernel",
218
+ version: "1.1.0",
219
+ description: "File records owned by modules and attached to their records by reference; the bytes in the deployment's StorageBackend. Uploads are multipart and resumable over single-use signed part URLs that never write the file's object, checked against the deployment's and the entity's size and type limits and the organisation's storage quota (Metering) before anything is stored, then inspected (exact size, content type sniffed from the bytes, SHA-256) and passed through the virus-scan hook in a durable workflow before they are readable. A file is readable only when its record is (the entity's read policy, checked at every read), downloads are short-lived signed URLs issued after that check and checked again when used (only the object verified is served, markup only as an attachment of application/octet-stream), and deletion respects retention holds. Every operation is an audited action on every surface; file metadata syncs to each replica through the same rule.",
220
+ operations: {
221
+ beginUpload: defineOperation({
222
+ description: "Start an upload: checks the size and declared type against the limits (the entity's when `attachTo` names a record, which the caller must be allowed to `attach` to), reserves its size in the organisation's quota, and returns a URL per part.",
223
+ input: BeginUpload,
224
+ output: UploadPlan,
225
+ errors,
226
+ }),
227
+ resumeUpload: defineOperation({
228
+ description: "Fresh URLs for the parts not yet received, and the parts already received: how an interrupted upload resumes. The uploader only.",
229
+ input: FileId,
230
+ output: UploadPlan,
231
+ errors,
232
+ }),
233
+ completeUpload: defineOperation({
234
+ description: "Finish an upload once every part arrived: the file moves to `processing`, and a durable workflow inspects it (exact size, sniffed content type checked against the limits, SHA-256), scans it, and makes it `available` (attached, when the upload named a record) or rejects or quarantines it, deleting the bytes. The uploader only.",
235
+ input: FileId,
236
+ output: FileRecord,
237
+ errors,
238
+ }),
239
+ abortUpload: defineOperation({
240
+ description: "Abandon an upload: its parts are deleted and its quota reservation released. The uploader only.",
241
+ input: FileId,
242
+ output: FileRecord,
243
+ errors,
244
+ }),
245
+ attach: defineOperation({
246
+ description: "Attach a staged file (uploaded by the caller, not yet attached) to a record the caller may `attach` to, within that entity's limits. A file is attached once; it is never moved.",
247
+ input: Attach,
248
+ output: FileRecord,
249
+ errors,
250
+ }),
251
+ get: defineOperation({
252
+ description: "A file's metadata, if the caller may read it: its record's read policy, or for a staged file its uploader. A file the caller may not read and one that does not exist get the same answer.",
253
+ input: FileId,
254
+ output: FileRecord,
255
+ errors,
256
+ }),
257
+ list: defineOperation({
258
+ description: "The files attached to a record the caller may read (not deleted), oldest first.",
259
+ input: RecordRef,
260
+ output: Schema.Struct({ files: Schema.Array(FileRecord) }),
261
+ errors,
262
+ }),
263
+ download: defineOperation({
264
+ description: "A short-lived signed URL for an available file the caller may read, served with the sniffed content type, `nosniff`, and as an attachment unless `inline` is asked for a type safe to render. Audited.",
265
+ input: Download,
266
+ output: DownloadUrl,
267
+ errors,
268
+ }),
269
+ read: defineOperation({
270
+ description: "A page of a readable file's extracted text (the Ingestion contract), for agents: up to `limit` characters from `offset`, with the next offset.",
271
+ input: ReadText,
272
+ output: TextPage,
273
+ errors,
274
+ }),
275
+ delete: defineOperation({
276
+ description: "Delete a file: a staged file by its uploader, an attached one by whoever may `attach` to its record. Refused while a retention hold lasts. Its quota is released at once and its bytes purged after the deployment's retention period. Deleting a record deletes its files the same way.",
277
+ input: FileId,
278
+ output: FileRecord,
279
+ errors,
280
+ }),
281
+ retain: defineOperation({
282
+ description: "Set or lift a retention hold: deletion is refused until `until` (administrators with eloxiv.files.manage).",
283
+ input: Retain,
284
+ output: FileRecord,
285
+ errors,
286
+ }),
287
+ usage: defineOperation({
288
+ description: "The organisation's stored bytes and its quota.",
289
+ input: Schema.Struct({}),
290
+ output: StorageUsage,
291
+ errors,
292
+ }),
293
+ setQuota: defineOperation({
294
+ description: "Set the organisation's storage quota in bytes, or null for the deployment's default (administrators with eloxiv.files.manage). Uploads that would pass it are refused when they begin.",
295
+ input: SetQuota,
296
+ output: StorageUsage,
297
+ errors,
298
+ }),
299
+ setStorage: defineOperation({
300
+ description: "Keep new files in an S3-compatible store of the organisation's (administrators with eloxiv.files.manage) or the caller's own: checked to answer before it is saved, its secret kept as a secret, never returned. Files already stored stay where they are, read from there.",
301
+ input: SetStorage,
302
+ output: StorageProvider,
303
+ errors,
304
+ }),
305
+ clearStorage: defineOperation({
306
+ description: "Stop using the organisation's (administrators) or the caller's own store for new files: they go to the next one (the organisation's, then the deployment's). Files already there are still read from it.",
307
+ input: Schema.Struct({ scope: StorageScope }),
308
+ output: StorageChoice,
309
+ errors,
310
+ }),
311
+ storage: defineOperation({
312
+ description: "Where the caller's new files go: their own store, their organisation's, or the deployment's.",
313
+ input: Schema.Struct({}),
314
+ output: StorageChoice,
315
+ errors,
316
+ }),
317
+ scan: defineOperation({
318
+ description: "The virus-scan hook (in process, `FileScanner`): given a file's metadata and a way to read its bytes, answer clean, infected or error. A deployment that requires scanning refuses to start without one; `error` leaves the file unavailable.",
319
+ input: Schema.Struct({ fileId: Schema.String, contentType: Schema.String, size: Schema.Number }),
320
+ output: ScanResult,
321
+ errors: Schema.Never,
322
+ }),
323
+ },
324
+ types: {
325
+ FileRecord,
326
+ FileState,
327
+ ScanVerdict,
328
+ RecordRef,
329
+ UploadPlan,
330
+ PartUrl,
331
+ DownloadUrl,
332
+ TextPage,
333
+ StorageUsage,
334
+ EntityFilesDeclaration,
335
+ ScanResult,
336
+ FileEventPayload,
337
+ },
338
+ });
339
+ //# sourceMappingURL=Files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Files.js","sourceRoot":"","sources":["../../src/contracts/Files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAEtE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAA;AAEjD,qHAAqH;AACrH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAA;AAErC,kDAAkD;AAClD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,mBAAmB;IAChC,YAAY,EAAE,oBAAoB;IAClC,cAAc,EAAE,sBAAsB;IACtC,WAAW,EAAE,mBAAmB;IAChC,MAAM,EAAE,gBAAgB;IACxB,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,gBAAgB;IACtB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,gBAAgB;IAC1B,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,oBAAoB;IAClC,OAAO,EAAE,eAAe;CAChB,CAAA;AAEV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CA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AAW,EAAE,8FAA8F;YAC3G,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,MAAM,EAAE,aAAa;YACrB,MAAM;SACP,CAAC;QACF,IAAI,EAAE,eAAe,CAAC;YACpB,WAAW,EACT,+OAA+O;YACjP,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;YAChG,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,MAAM,CAAC,KAAK;SACrB,CAAC;KACH;IACD,KAAK,EAAE;QACL,UAAU;QACV,SAAS;QACT,WAAW;QACX,SAAS;QACT,UAAU;QACV,OAAO;QACP,WAAW;QACX,QAAQ;QACR,YAAY;QACZ,sBAAsB;QACtB,UAAU;QACV,gBAAgB;KACjB;CACF,CAAC,CAAA"}
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Flags: feature flags declared in module manifests (`flags`), each with a default, targeted per
3
+ * organisation by its administrators, evaluated in handlers (`ctx.flags.isEnabled`) and on clients from their
4
+ * replica with the same function (`evaluateFlag`). Documented in docs/contracts/flags.md; conformance kit
5
+ * `@eloxiv/testing/conformance/Flags`.
6
+ *
7
+ * Targeting is a set of rules per organisation and flag. Precedence, most specific first: a rule for the
8
+ * person (`user`), for one of their groups (`group`), for one of their roles (`role`), for the whole
9
+ * organisation (`org`), then a percentage rollout (`rollout`), then the declared default. Within one level an
10
+ * `off` rule wins over an `on` rule, so a conflict fails closed.
11
+ */
12
+ import { Schema } from "effect";
13
+ import { Forbidden, InvalidInput, Unauthenticated } from "../Errors.ts";
14
+ /** The permission organisation administrators need to change their organisation's targeting. */
15
+ export declare const FLAGS_MANAGE = "eloxiv.flags.manage";
16
+ /** Rule kinds, in precedence order. */
17
+ export declare const FLAG_RULE_KINDS: readonly ["user", "group", "role", "org", "rollout"];
18
+ export declare const FlagRuleKind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
19
+ export type FlagRuleKind = typeof FlagRuleKind.Type;
20
+ /** One targeting rule, as the replica holds it (table `eloxiv_flags.rule`). */
21
+ export declare const FlagRule: Schema.Struct<{
22
+ readonly id: Schema.String;
23
+ readonly orgId: Schema.String;
24
+ readonly flag: Schema.String;
25
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
26
+ /** The person, group or role the rule targets (`user`, `group`, `role`); `null` for `org` and `rollout`. */
27
+ readonly subject: Schema.NullOr<Schema.String>;
28
+ /** On or off for whoever the rule targets (a rollout's `enabled` applies inside its percentage). */
29
+ readonly enabled: Schema.Boolean;
30
+ /** A rollout's share of people, 0 to 100 (two decimals); `null` for other kinds. */
31
+ readonly percentage: Schema.NullOr<Schema.Number>;
32
+ readonly updatedBy: Schema.String;
33
+ readonly updatedAt: Schema.Number;
34
+ }>;
35
+ export type FlagRule = typeof FlagRule.Type;
36
+ /** The id of a rule: one per organisation, flag, kind and subject. */
37
+ export declare const flagRuleId: (orgId: string, flag: string, kind: FlagRuleKind, subject: string | null) => string;
38
+ /** How many buckets a rollout divides people into (a percentage has two decimals). */
39
+ export declare const FLAG_BUCKETS = 10000;
40
+ /**
41
+ * A person's bucket for a flag, 0 to 9999: FNV-1a (32-bit) of `<flag>:<userId>`, modulo the bucket count.
42
+ * Deterministic, the same on every runtime and client, independent per flag; a rollout of p percent enables
43
+ * buckets below p × 100, so raising the percentage only ever adds people.
44
+ */
45
+ export declare const flagBucket: (flag: string, userId: string) => number;
46
+ /**
47
+ * The level that decided a flag: a rule's kind, the declared default, or an external provider the app scoped the flag
48
+ * to (`provider`), which could not be asked (`provider-unavailable`: the flag is off, failing closed).
49
+ */
50
+ export declare const FlagReason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
51
+ export type FlagReason = typeof FlagReason.Type;
52
+ export interface FlagSubject {
53
+ readonly userId: string;
54
+ /** The person's groups in the organisation, or `"given"` when the rules were already filtered to theirs (a replica). */
55
+ readonly groups: ReadonlyArray<string> | "given";
56
+ readonly roles: ReadonlyArray<string>;
57
+ }
58
+ /**
59
+ * Evaluate a flag for one person from their organisation's rules for it. The kernel and clients use this one
60
+ * function: the kernel with the person's groups and roles, a client with the rules its replica holds (the
61
+ * kernel syncs a person only the user rules about them and the group rules of their own groups, so
62
+ * `groups: "given"`) and the roles it was told.
63
+ */
64
+ export declare const evaluateFlag: (flag: string, declaration: {
65
+ readonly default: boolean;
66
+ }, rules: ReadonlyArray<Pick<FlagRule, "flag" | "kind" | "subject" | "enabled" | "percentage">>, subject: FlagSubject) => {
67
+ readonly enabled: boolean;
68
+ readonly reason: FlagReason;
69
+ };
70
+ export declare const FlagKey: Schema.Struct<{
71
+ readonly flag: Schema.String;
72
+ }>;
73
+ export declare const FlagEvaluation: Schema.Struct<{
74
+ readonly flag: Schema.String;
75
+ readonly enabled: Schema.Boolean;
76
+ /** The level that decided it. */
77
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
78
+ }>;
79
+ export type FlagEvaluation = typeof FlagEvaluation.Type;
80
+ export declare const FlagRuleWrite: Schema.Struct<{
81
+ readonly flag: Schema.String;
82
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
83
+ /** The person's user id, the group's or the role's id; omitted for `org` and `rollout`. */
84
+ readonly subject: Schema.optionalKey<Schema.String>;
85
+ readonly enabled: Schema.Boolean;
86
+ /** Required for `rollout`, refused for the other kinds. */
87
+ readonly percentage: Schema.optionalKey<Schema.Number>;
88
+ }>;
89
+ export type FlagRuleWrite = typeof FlagRuleWrite.Type;
90
+ export declare const FlagRuleRef: Schema.Struct<{
91
+ readonly id: Schema.String;
92
+ }>;
93
+ export declare const FlagRules: Schema.Struct<{
94
+ readonly rules: Schema.$Array<Schema.Struct<{
95
+ readonly id: Schema.String;
96
+ readonly orgId: Schema.String;
97
+ readonly flag: Schema.String;
98
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
99
+ /** The person, group or role the rule targets (`user`, `group`, `role`); `null` for `org` and `rollout`. */
100
+ readonly subject: Schema.NullOr<Schema.String>;
101
+ /** On or off for whoever the rule targets (a rollout's `enabled` applies inside its percentage). */
102
+ readonly enabled: Schema.Boolean;
103
+ /** A rollout's share of people, 0 to 100 (two decimals); `null` for other kinds. */
104
+ readonly percentage: Schema.NullOr<Schema.Number>;
105
+ readonly updatedBy: Schema.String;
106
+ readonly updatedAt: Schema.Number;
107
+ }>>;
108
+ }>;
109
+ /** A person's own choice for a lab flag (`lab: true` in its declaration). */
110
+ export declare const LabOptIn: Schema.Struct<{
111
+ readonly flag: Schema.String;
112
+ readonly enabled: Schema.Boolean;
113
+ }>;
114
+ /** One lab flag as a person sees it: what it is, what they get now and why, and their own choice if they made one. */
115
+ export declare const Lab: Schema.Struct<{
116
+ readonly flag: Schema.String;
117
+ readonly description: Schema.String;
118
+ readonly default: Schema.Boolean;
119
+ readonly enabled: Schema.Boolean;
120
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
121
+ /** Their own choice (a user rule about them), or null: they get what their organisation decided. */
122
+ readonly mine: Schema.NullOr<Schema.Struct<{
123
+ readonly id: Schema.String;
124
+ readonly enabled: Schema.Boolean;
125
+ }>>;
126
+ }>;
127
+ export type Lab = typeof Lab.Type;
128
+ export declare const Labs: Schema.Struct<{
129
+ readonly labs: Schema.$Array<Schema.Struct<{
130
+ readonly flag: Schema.String;
131
+ readonly description: Schema.String;
132
+ readonly default: Schema.Boolean;
133
+ readonly enabled: Schema.Boolean;
134
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
135
+ /** Their own choice (a user rule about them), or null: they get what their organisation decided. */
136
+ readonly mine: Schema.NullOr<Schema.Struct<{
137
+ readonly id: Schema.String;
138
+ readonly enabled: Schema.Boolean;
139
+ }>>;
140
+ }>>;
141
+ }>;
142
+ /** The kernel actions (module `flags`). */
143
+ export declare const FLAGS_ACTIONS: {
144
+ readonly evaluate: "flags.evaluate";
145
+ readonly set: "flags.set";
146
+ readonly remove: "flags.remove";
147
+ readonly rules: "flags.rules";
148
+ readonly optIn: "flags.optIn";
149
+ readonly clearOptIn: "flags.clearOptIn";
150
+ readonly labs: "flags.labs";
151
+ };
152
+ export declare const FlagsContract: import("../Service.ts").ServiceContract<"Flags", {
153
+ readonly evaluate: import("../Service.ts").OperationContract<Schema.Struct<{
154
+ readonly flag: Schema.String;
155
+ }>, Schema.Struct<{
156
+ readonly flag: Schema.String;
157
+ readonly enabled: Schema.Boolean;
158
+ /** The level that decided it. */
159
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
160
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
161
+ readonly set: import("../Service.ts").OperationContract<Schema.Struct<{
162
+ readonly flag: Schema.String;
163
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
164
+ /** The person's user id, the group's or the role's id; omitted for `org` and `rollout`. */
165
+ readonly subject: Schema.optionalKey<Schema.String>;
166
+ readonly enabled: Schema.Boolean;
167
+ /** Required for `rollout`, refused for the other kinds. */
168
+ readonly percentage: Schema.optionalKey<Schema.Number>;
169
+ }>, Schema.Struct<{
170
+ readonly id: Schema.String;
171
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
172
+ readonly remove: import("../Service.ts").OperationContract<Schema.Struct<{
173
+ readonly id: Schema.String;
174
+ }>, Schema.Struct<{
175
+ readonly id: Schema.String;
176
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
177
+ readonly rules: import("../Service.ts").OperationContract<Schema.Struct<{
178
+ readonly flag: Schema.String;
179
+ }>, Schema.Struct<{
180
+ readonly rules: Schema.$Array<Schema.Struct<{
181
+ readonly id: Schema.String;
182
+ readonly orgId: Schema.String;
183
+ readonly flag: Schema.String;
184
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
185
+ /** The person, group or role the rule targets (`user`, `group`, `role`); `null` for `org` and `rollout`. */
186
+ readonly subject: Schema.NullOr<Schema.String>;
187
+ /** On or off for whoever the rule targets (a rollout's `enabled` applies inside its percentage). */
188
+ readonly enabled: Schema.Boolean;
189
+ /** A rollout's share of people, 0 to 100 (two decimals); `null` for other kinds. */
190
+ readonly percentage: Schema.NullOr<Schema.Number>;
191
+ readonly updatedBy: Schema.String;
192
+ readonly updatedAt: Schema.Number;
193
+ }>>;
194
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
195
+ readonly optIn: import("../Service.ts").OperationContract<Schema.Struct<{
196
+ readonly flag: Schema.String;
197
+ readonly enabled: Schema.Boolean;
198
+ }>, Schema.Struct<{
199
+ readonly id: Schema.String;
200
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
201
+ readonly clearOptIn: import("../Service.ts").OperationContract<Schema.Struct<{
202
+ readonly id: Schema.String;
203
+ }>, Schema.Struct<{
204
+ readonly id: Schema.String;
205
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
206
+ readonly labs: import("../Service.ts").OperationContract<Schema.Struct<{}>, Schema.Struct<{
207
+ readonly labs: Schema.$Array<Schema.Struct<{
208
+ readonly flag: Schema.String;
209
+ readonly description: Schema.String;
210
+ readonly default: Schema.Boolean;
211
+ readonly enabled: Schema.Boolean;
212
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
213
+ /** Their own choice (a user rule about them), or null: they get what their organisation decided. */
214
+ readonly mine: Schema.NullOr<Schema.Struct<{
215
+ readonly id: Schema.String;
216
+ readonly enabled: Schema.Boolean;
217
+ }>>;
218
+ }>>;
219
+ }>, Schema.Union<readonly [typeof Unauthenticated, typeof Forbidden, typeof InvalidInput]>>;
220
+ }, {
221
+ readonly FlagRule: Schema.Struct<{
222
+ readonly id: Schema.String;
223
+ readonly orgId: Schema.String;
224
+ readonly flag: Schema.String;
225
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
226
+ /** The person, group or role the rule targets (`user`, `group`, `role`); `null` for `org` and `rollout`. */
227
+ readonly subject: Schema.NullOr<Schema.String>;
228
+ /** On or off for whoever the rule targets (a rollout's `enabled` applies inside its percentage). */
229
+ readonly enabled: Schema.Boolean;
230
+ /** A rollout's share of people, 0 to 100 (two decimals); `null` for other kinds. */
231
+ readonly percentage: Schema.NullOr<Schema.Number>;
232
+ readonly updatedBy: Schema.String;
233
+ readonly updatedAt: Schema.Number;
234
+ }>;
235
+ readonly FlagRuleWrite: Schema.Struct<{
236
+ readonly flag: Schema.String;
237
+ readonly kind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
238
+ /** The person's user id, the group's or the role's id; omitted for `org` and `rollout`. */
239
+ readonly subject: Schema.optionalKey<Schema.String>;
240
+ readonly enabled: Schema.Boolean;
241
+ /** Required for `rollout`, refused for the other kinds. */
242
+ readonly percentage: Schema.optionalKey<Schema.Number>;
243
+ }>;
244
+ readonly FlagEvaluation: Schema.Struct<{
245
+ readonly flag: Schema.String;
246
+ readonly enabled: Schema.Boolean;
247
+ /** The level that decided it. */
248
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
249
+ }>;
250
+ readonly FlagRuleKind: Schema.Literals<readonly ["user", "group", "role", "org", "rollout"]>;
251
+ readonly FlagReason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
252
+ readonly Lab: Schema.Struct<{
253
+ readonly flag: Schema.String;
254
+ readonly description: Schema.String;
255
+ readonly default: Schema.Boolean;
256
+ readonly enabled: Schema.Boolean;
257
+ readonly reason: Schema.Literals<readonly ["user", "group", "role", "org", "rollout", "default", "provider", "provider-unavailable"]>;
258
+ /** Their own choice (a user rule about them), or null: they get what their organisation decided. */
259
+ readonly mine: Schema.NullOr<Schema.Struct<{
260
+ readonly id: Schema.String;
261
+ readonly enabled: Schema.Boolean;
262
+ }>>;
263
+ }>;
264
+ }>;
265
+ //# sourceMappingURL=Flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Flags.d.ts","sourceRoot":"","sources":["../../src/contracts/Flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvE,gGAAgG;AAChG,eAAO,MAAM,YAAY,wBAAwB,CAAA;AAEjD,uCAAuC;AACvC,eAAO,MAAM,eAAe,YAAI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAU,CAAA;AACnF,eAAO,MAAM,YAAY,uEAAmC,CAAA;AAC5D,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,QAAQ;;;;;IAKnB,4GAA4G;;IAE5G,oGAAoG;;IAEpG,oFAAoF;;;;EAIpF,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAE3C,sEAAsE;AACtE,eAAO,MAAM,UAAU,UAAW,MAAM,QAAQ,MAAM,QAAQ,YAAY,WAAW,MAAM,GAAG,IAAI,WACrD,CAAA;AAE7C,sFAAsF;AACtF,eAAO,MAAM,YAAY,QAAS,CAAA;AAElC;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,UAAU,MAAM,KAAG,MAYzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,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