@dxos/echo 0.12.0-next-73daef452f1464b62efdbca75fb0067c1066f264 → 0.13.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 (443) hide show
  1. package/dist/lib/Aggregate.mjs +67 -2
  2. package/dist/lib/Aggregate.mjs.map +1 -1
  3. package/dist/lib/Annotation.mjs +2 -2
  4. package/dist/lib/Blob.mjs +41 -4
  5. package/dist/lib/Blob.mjs.map +1 -1
  6. package/dist/lib/Change.mjs +30 -0
  7. package/dist/lib/Change.mjs.map +1 -0
  8. package/dist/lib/Collection.mjs +21 -4
  9. package/dist/lib/Collection.mjs.map +1 -1
  10. package/dist/lib/Database.mjs +2 -2
  11. package/dist/lib/Dataset.mjs +5 -0
  12. package/dist/lib/Dataset.mjs.map +1 -1
  13. package/dist/lib/Entity.mjs +63 -3
  14. package/dist/lib/Entity.mjs.map +1 -1
  15. package/dist/lib/Feed.mjs +46 -15
  16. package/dist/lib/Feed.mjs.map +1 -1
  17. package/dist/lib/Filter.mjs +143 -5
  18. package/dist/lib/Filter.mjs.map +1 -1
  19. package/dist/lib/Format.mjs.map +1 -1
  20. package/dist/lib/Hypergraph.mjs +64 -2
  21. package/dist/lib/Hypergraph.mjs.map +1 -1
  22. package/dist/lib/Json.mjs +3 -0
  23. package/dist/lib/Json.mjs.map +1 -1
  24. package/dist/lib/JsonSchema.mjs +13 -2
  25. package/dist/lib/JsonSchema.mjs.map +1 -1
  26. package/dist/lib/Migration.mjs +11 -1
  27. package/dist/lib/Migration.mjs.map +1 -1
  28. package/dist/lib/Obj.mjs +193 -9
  29. package/dist/lib/Obj.mjs.map +1 -1
  30. package/dist/lib/Order.mjs +13 -0
  31. package/dist/lib/Order.mjs.map +1 -1
  32. package/dist/lib/Query.mjs +26 -3
  33. package/dist/lib/Query.mjs.map +1 -1
  34. package/dist/lib/QueryResult.mjs.map +1 -1
  35. package/dist/lib/Ref.mjs +57 -5
  36. package/dist/lib/Ref.mjs.map +1 -1
  37. package/dist/lib/Relation.mjs +98 -6
  38. package/dist/lib/Relation.mjs.map +1 -1
  39. package/dist/lib/Scope.mjs +6 -0
  40. package/dist/lib/Scope.mjs.map +1 -1
  41. package/dist/lib/Tag.mjs +35 -4
  42. package/dist/lib/Tag.mjs.map +1 -1
  43. package/dist/lib/Text.mjs +8 -1
  44. package/dist/lib/Text.mjs.map +1 -1
  45. package/dist/lib/Type.mjs +58 -9
  46. package/dist/lib/Type.mjs.map +1 -1
  47. package/dist/lib/View.mjs +14 -4
  48. package/dist/lib/View.mjs.map +1 -1
  49. package/dist/lib/chunk-Annotation.mjs +34 -10
  50. package/dist/lib/chunk-Annotation.mjs.map +1 -1
  51. package/dist/lib/chunk-Database.mjs +200 -36
  52. package/dist/lib/chunk-Database.mjs.map +1 -1
  53. package/dist/lib/chunk-Registry.mjs +7 -1
  54. package/dist/lib/chunk-Registry.mjs.map +1 -1
  55. package/dist/lib/chunk-atom-snapshot.mjs +48 -13
  56. package/dist/lib/chunk-atom-snapshot.mjs.map +1 -1
  57. package/dist/lib/chunk-internal.mjs +410 -310
  58. package/dist/lib/chunk-internal.mjs.map +1 -1
  59. package/dist/lib/chunk-json-schema.mjs +119 -48
  60. package/dist/lib/chunk-json-schema.mjs.map +1 -1
  61. package/dist/lib/chunk-number.mjs +4 -1
  62. package/dist/lib/chunk-number.mjs.map +1 -1
  63. package/dist/lib/chunk-ref-array.mjs +6 -7
  64. package/dist/lib/chunk-ref-array.mjs.map +1 -1
  65. package/dist/lib/chunk-ref.mjs +289 -130
  66. package/dist/lib/chunk-ref.mjs.map +1 -1
  67. package/dist/lib/chunk-select.mjs +6 -4
  68. package/dist/lib/chunk-select.mjs.map +1 -1
  69. package/dist/lib/chunk-util.mjs +1 -1
  70. package/dist/lib/chunk-util.mjs.map +1 -1
  71. package/dist/lib/index.mjs +2 -1
  72. package/dist/lib/internal.mjs +7 -7
  73. package/dist/lib/testing.mjs +12 -12
  74. package/dist/lib/testing.mjs.map +1 -1
  75. package/dist/types/src/Aggregate.d.ts +70 -3
  76. package/dist/types/src/Aggregate.d.ts.map +1 -1
  77. package/dist/types/src/Annotation.d.ts +33 -4
  78. package/dist/types/src/Annotation.d.ts.map +1 -1
  79. package/dist/types/src/Blob.d.ts +40 -5
  80. package/dist/types/src/Blob.d.ts.map +1 -1
  81. package/dist/types/src/Change.d.ts +50 -0
  82. package/dist/types/src/Change.d.ts.map +1 -0
  83. package/dist/types/src/Collection.d.ts +18 -3
  84. package/dist/types/src/Collection.d.ts.map +1 -1
  85. package/dist/types/src/Database.d.ts +244 -23
  86. package/dist/types/src/Database.d.ts.map +1 -1
  87. package/dist/types/src/Database.test.d.ts +2 -0
  88. package/dist/types/src/Database.test.d.ts.map +1 -0
  89. package/dist/types/src/Dataset.d.ts +9 -4
  90. package/dist/types/src/Dataset.d.ts.map +1 -1
  91. package/dist/types/src/Entity.d.ts +68 -6
  92. package/dist/types/src/Entity.d.ts.map +1 -1
  93. package/dist/types/src/Feed.d.ts +40 -9
  94. package/dist/types/src/Feed.d.ts.map +1 -1
  95. package/dist/types/src/Filter.d.ts +132 -7
  96. package/dist/types/src/Filter.d.ts.map +1 -1
  97. package/dist/types/src/Format.d.ts +1 -1
  98. package/dist/types/src/Format.d.ts.map +1 -1
  99. package/dist/types/src/Hypergraph.d.ts +94 -6
  100. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  101. package/dist/types/src/Json.d.ts +4 -1
  102. package/dist/types/src/Json.d.ts.map +1 -1
  103. package/dist/types/src/JsonSchema.d.ts +11 -1
  104. package/dist/types/src/JsonSchema.d.ts.map +1 -1
  105. package/dist/types/src/Migration.d.ts +14 -4
  106. package/dist/types/src/Migration.d.ts.map +1 -1
  107. package/dist/types/src/Obj.d.ts +222 -15
  108. package/dist/types/src/Obj.d.ts.map +1 -1
  109. package/dist/types/src/Order.d.ts +13 -0
  110. package/dist/types/src/Order.d.ts.map +1 -1
  111. package/dist/types/src/Query.d.ts +84 -22
  112. package/dist/types/src/Query.d.ts.map +1 -1
  113. package/dist/types/src/QueryResult.d.ts +42 -3
  114. package/dist/types/src/QueryResult.d.ts.map +1 -1
  115. package/dist/types/src/Ref.d.ts +61 -8
  116. package/dist/types/src/Ref.d.ts.map +1 -1
  117. package/dist/types/src/Registry.d.ts +27 -5
  118. package/dist/types/src/Registry.d.ts.map +1 -1
  119. package/dist/types/src/Relation.d.ts +103 -8
  120. package/dist/types/src/Relation.d.ts.map +1 -1
  121. package/dist/types/src/Scope.d.ts +6 -0
  122. package/dist/types/src/Scope.d.ts.map +1 -1
  123. package/dist/types/src/Tag.d.ts +37 -6
  124. package/dist/types/src/Tag.d.ts.map +1 -1
  125. package/dist/types/src/Text.d.ts +8 -1
  126. package/dist/types/src/Text.d.ts.map +1 -1
  127. package/dist/types/src/Type.d.ts +63 -9
  128. package/dist/types/src/Type.d.ts.map +1 -1
  129. package/dist/types/src/View.d.ts +14 -4
  130. package/dist/types/src/View.d.ts.map +1 -1
  131. package/dist/types/src/index.d.ts +29 -28
  132. package/dist/types/src/index.d.ts.map +1 -1
  133. package/dist/types/src/internal/Annotation/annotations.d.ts +70 -34
  134. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -1
  135. package/dist/types/src/internal/Annotation/atoms.d.ts +3 -3
  136. package/dist/types/src/internal/Annotation/atoms.d.ts.map +1 -1
  137. package/dist/types/src/internal/Annotation/dictionary.d.ts +1 -1
  138. package/dist/types/src/internal/Annotation/dictionary.d.ts.map +1 -1
  139. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts +3 -3
  140. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts.map +1 -1
  141. package/dist/types/src/internal/Annotation/index.d.ts +5 -5
  142. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -1
  143. package/dist/types/src/internal/Annotation/sorting.d.ts +1 -1
  144. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -1
  145. package/dist/types/src/internal/Annotation/util.d.ts +2 -2
  146. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -1
  147. package/dist/types/src/internal/Entity/api.d.ts +1 -1
  148. package/dist/types/src/internal/Entity/api.d.ts.map +1 -1
  149. package/dist/types/src/internal/Entity/entity.d.ts +4 -4
  150. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -1
  151. package/dist/types/src/internal/Entity/guard.d.ts +1 -1
  152. package/dist/types/src/internal/Entity/guard.d.ts.map +1 -1
  153. package/dist/types/src/internal/Entity/index.d.ts +9 -9
  154. package/dist/types/src/internal/Entity/index.d.ts.map +1 -1
  155. package/dist/types/src/internal/Entity/model.d.ts +4 -4
  156. package/dist/types/src/internal/Entity/model.d.ts.map +1 -1
  157. package/dist/types/src/internal/Entity/object.d.ts +3 -3
  158. package/dist/types/src/internal/Entity/object.d.ts.map +1 -1
  159. package/dist/types/src/internal/Entity/relation.d.ts +4 -4
  160. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -1
  161. package/dist/types/src/internal/Entity/type-kind.d.ts +2 -2
  162. package/dist/types/src/internal/Entity/type-kind.d.ts.map +1 -1
  163. package/dist/types/src/internal/Entity/type-uri.d.ts +2 -2
  164. package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -1
  165. package/dist/types/src/internal/Entity/version.d.ts +1 -1
  166. package/dist/types/src/internal/Entity/version.d.ts.map +1 -1
  167. package/dist/types/src/internal/Filter/index.d.ts +1 -1
  168. package/dist/types/src/internal/Filter/index.d.ts.map +1 -1
  169. package/dist/types/src/internal/Filter/match.d.ts +43 -1
  170. package/dist/types/src/internal/Filter/match.d.ts.map +1 -1
  171. package/dist/types/src/internal/Format/format.d.ts +4 -3
  172. package/dist/types/src/internal/Format/format.d.ts.map +1 -1
  173. package/dist/types/src/internal/Format/index.d.ts +7 -7
  174. package/dist/types/src/internal/Format/index.d.ts.map +1 -1
  175. package/dist/types/src/internal/Format/string.d.ts.map +1 -1
  176. package/dist/types/src/internal/Format/types.d.ts +6 -4
  177. package/dist/types/src/internal/Format/types.d.ts.map +1 -1
  178. package/dist/types/src/internal/JsonSchema/annotations.d.ts +1 -1
  179. package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -1
  180. package/dist/types/src/internal/JsonSchema/index.d.ts +4 -4
  181. package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -1
  182. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts +1 -1
  183. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -1
  184. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts +21 -4
  185. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -1
  186. package/dist/types/src/internal/JsonSchema/json-schema.d.ts +4 -2
  187. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -1
  188. package/dist/types/src/internal/Obj/atoms.d.ts +13 -6
  189. package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -1
  190. package/dist/types/src/internal/Obj/clone.d.ts +1 -1
  191. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -1
  192. package/dist/types/src/internal/Obj/create-object.d.ts +4 -4
  193. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -1
  194. package/dist/types/src/internal/Obj/deleted.d.ts +1 -1
  195. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -1
  196. package/dist/types/src/internal/Obj/index.d.ts +10 -10
  197. package/dist/types/src/internal/Obj/index.d.ts.map +1 -1
  198. package/dist/types/src/internal/Obj/json-serializer.d.ts +5 -5
  199. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -1
  200. package/dist/types/src/internal/Obj/parent-annotation.d.ts.map +1 -1
  201. package/dist/types/src/internal/Obj/set-value.d.ts +1 -1
  202. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -1
  203. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -1
  204. package/dist/types/src/internal/Obj/typed-object.d.ts +2 -2
  205. package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -1
  206. package/dist/types/src/internal/Query/index.d.ts +2 -2
  207. package/dist/types/src/internal/Query/index.d.ts.map +1 -1
  208. package/dist/types/src/internal/Query/pretty.d.ts.map +1 -1
  209. package/dist/types/src/internal/Query/query-result-effect.d.ts +1 -1
  210. package/dist/types/src/internal/Query/query-result-effect.d.ts.map +1 -1
  211. package/dist/types/src/internal/Ref/atoms.d.ts +10 -6
  212. package/dist/types/src/internal/Ref/atoms.d.ts.map +1 -1
  213. package/dist/types/src/internal/Ref/index.d.ts +3 -3
  214. package/dist/types/src/internal/Ref/index.d.ts.map +1 -1
  215. package/dist/types/src/internal/Ref/ref-array.d.ts +7 -6
  216. package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -1
  217. package/dist/types/src/internal/Ref/ref.d.ts +60 -12
  218. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -1
  219. package/dist/types/src/internal/Ref/strong-deps.d.ts +1 -1
  220. package/dist/types/src/internal/Ref/strong-deps.d.ts.map +1 -1
  221. package/dist/types/src/internal/Ref/utils.d.ts +5 -3
  222. package/dist/types/src/internal/Ref/utils.d.ts.map +1 -1
  223. package/dist/types/src/internal/Registry/atoms.d.ts +3 -3
  224. package/dist/types/src/internal/Registry/atoms.d.ts.map +1 -1
  225. package/dist/types/src/internal/Type/compose.d.ts +1 -1
  226. package/dist/types/src/internal/Type/compose.d.ts.map +1 -1
  227. package/dist/types/src/internal/Type/index.d.ts +2 -2
  228. package/dist/types/src/internal/Type/index.d.ts.map +1 -1
  229. package/dist/types/src/internal/Type/type-schema.d.ts +3 -3
  230. package/dist/types/src/internal/Type/type-schema.d.ts.map +1 -1
  231. package/dist/types/src/internal/common/api/index.d.ts +1 -1
  232. package/dist/types/src/internal/common/api/index.d.ts.map +1 -1
  233. package/dist/types/src/internal/common/api/meta.d.ts +5 -5
  234. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -1
  235. package/dist/types/src/internal/common/atom-snapshot.d.ts +3 -2
  236. package/dist/types/src/internal/common/atom-snapshot.d.ts.map +1 -1
  237. package/dist/types/src/internal/common/index.d.ts +4 -3
  238. package/dist/types/src/internal/common/index.d.ts.map +1 -1
  239. package/dist/types/src/internal/common/merge.d.ts +20 -0
  240. package/dist/types/src/internal/common/merge.d.ts.map +1 -0
  241. package/dist/types/src/internal/common/merge.test.d.ts +2 -0
  242. package/dist/types/src/internal/common/merge.test.d.ts.map +1 -0
  243. package/dist/types/src/internal/common/proxy/change-context.d.ts +14 -0
  244. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -1
  245. package/dist/types/src/internal/common/proxy/errors.d.ts +4 -0
  246. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -1
  247. package/dist/types/src/internal/common/proxy/index.d.ts +13 -13
  248. package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -1
  249. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -1
  250. package/dist/types/src/internal/common/proxy/make-object.d.ts +3 -3
  251. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -1
  252. package/dist/types/src/internal/common/proxy/nested-array-gate.test.d.ts +2 -0
  253. package/dist/types/src/internal/common/proxy/nested-array-gate.test.d.ts.map +1 -0
  254. package/dist/types/src/internal/common/proxy/ownership.d.ts +9 -0
  255. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -1
  256. package/dist/types/src/internal/common/proxy/proxy-types.d.ts +0 -5
  257. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -1
  258. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +18 -29
  259. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -1
  260. package/dist/types/src/internal/common/proxy/reactive-array.d.ts +7 -0
  261. package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -1
  262. package/dist/types/src/internal/common/proxy/reactive.d.ts +1 -1
  263. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -1
  264. package/dist/types/src/internal/common/proxy/schema-validator.d.ts +5 -3
  265. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -1
  266. package/dist/types/src/internal/common/proxy/symbols.d.ts +7 -0
  267. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -1
  268. package/dist/types/src/internal/common/proxy/typed-handler.d.ts +18 -14
  269. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -1
  270. package/dist/types/src/internal/common/types/base.d.ts +1 -1
  271. package/dist/types/src/internal/common/types/base.d.ts.map +1 -1
  272. package/dist/types/src/internal/common/types/index.d.ts +7 -7
  273. package/dist/types/src/internal/common/types/index.d.ts.map +1 -1
  274. package/dist/types/src/internal/common/types/meta.d.ts +29 -3
  275. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -1
  276. package/dist/types/src/internal/common/types/projection.d.ts +2 -4
  277. package/dist/types/src/internal/common/types/projection.d.ts.map +1 -1
  278. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -1
  279. package/dist/types/src/internal/index.d.ts +11 -11
  280. package/dist/types/src/internal/index.d.ts.map +1 -1
  281. package/dist/types/src/testing/index.d.ts +4 -4
  282. package/dist/types/src/testing/index.d.ts.map +1 -1
  283. package/dist/types/src/testing/registry.d.ts +1 -1
  284. package/dist/types/src/testing/registry.d.ts.map +1 -1
  285. package/dist/types/src/testing/test-schema.d.ts +14 -14
  286. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  287. package/dist/types/src/testing/util.d.ts +2 -2
  288. package/dist/types/src/testing/util.d.ts.map +1 -1
  289. package/dist/types/tsconfig.tsbuildinfo +1 -1
  290. package/package.json +18 -12
  291. package/src/Aggregate.ts +72 -4
  292. package/src/Annotation.test.ts +76 -9
  293. package/src/Annotation.ts +39 -6
  294. package/src/Blob.test.ts +1 -1
  295. package/src/Blob.ts +55 -11
  296. package/src/Change.ts +60 -0
  297. package/src/Collection.ts +30 -7
  298. package/src/Database.test.ts +29 -0
  299. package/src/Database.ts +296 -41
  300. package/src/Dataset.ts +10 -5
  301. package/src/Entity.test.ts +57 -5
  302. package/src/Entity.ts +70 -8
  303. package/src/Feed.test.ts +68 -39
  304. package/src/Feed.ts +57 -25
  305. package/src/Filter.test.ts +25 -3
  306. package/src/Filter.ts +164 -9
  307. package/src/Format.ts +1 -1
  308. package/src/Hypergraph.ts +93 -6
  309. package/src/Json.test.ts +14 -17
  310. package/src/Json.ts +5 -2
  311. package/src/JsonSchema.ts +12 -1
  312. package/src/Migration.ts +14 -4
  313. package/src/Obj.test.ts +130 -10
  314. package/src/Obj.ts +229 -12
  315. package/src/Order.ts +13 -0
  316. package/src/Query.test.ts +28 -12
  317. package/src/Query.ts +89 -28
  318. package/src/QueryResult.ts +43 -3
  319. package/src/Ref.ts +66 -9
  320. package/src/Registry.ts +27 -5
  321. package/src/Relation.test.ts +5 -5
  322. package/src/Relation.ts +104 -10
  323. package/src/Scope.ts +6 -0
  324. package/src/Tag.ts +38 -7
  325. package/src/Text.test.ts +19 -19
  326. package/src/Text.ts +10 -3
  327. package/src/Type.test.ts +8 -8
  328. package/src/Type.ts +64 -10
  329. package/src/View.ts +18 -11
  330. package/src/index.ts +29 -28
  331. package/src/internal/Annotation/annotations.test.ts +26 -5
  332. package/src/internal/Annotation/annotations.ts +126 -23
  333. package/src/internal/Annotation/atoms.ts +15 -15
  334. package/src/internal/Annotation/dictionary.ts +1 -1
  335. package/src/internal/Annotation/entity-dictionary.ts +5 -5
  336. package/src/internal/Annotation/index.ts +5 -5
  337. package/src/internal/Annotation/sorting.ts +2 -2
  338. package/src/internal/Annotation/util.ts +2 -2
  339. package/src/internal/Entity/api.ts +4 -4
  340. package/src/internal/Entity/entity.ts +12 -43
  341. package/src/internal/Entity/guard.ts +2 -2
  342. package/src/internal/Entity/index.ts +9 -9
  343. package/src/internal/Entity/model.ts +4 -4
  344. package/src/internal/Entity/object.ts +7 -7
  345. package/src/internal/Entity/relation.ts +8 -8
  346. package/src/internal/Entity/type-kind.ts +6 -6
  347. package/src/internal/Entity/type-uri.ts +5 -5
  348. package/src/internal/Entity/util.ts +1 -1
  349. package/src/internal/Entity/version.ts +2 -2
  350. package/src/internal/Filter/index.ts +1 -1
  351. package/src/internal/Filter/match.ts +174 -75
  352. package/src/internal/Format/date.test.ts +2 -2
  353. package/src/internal/Format/date.ts +2 -2
  354. package/src/internal/Format/format.test.ts +3 -3
  355. package/src/internal/Format/format.ts +6 -5
  356. package/src/internal/Format/index.ts +7 -7
  357. package/src/internal/Format/number.ts +1 -1
  358. package/src/internal/Format/object.ts +1 -1
  359. package/src/internal/Format/string.ts +11 -4
  360. package/src/internal/Format/types.ts +6 -3
  361. package/src/internal/JsonSchema/annotations.ts +11 -4
  362. package/src/internal/JsonSchema/effect-schema.test.ts +13 -5
  363. package/src/internal/JsonSchema/index.ts +4 -4
  364. package/src/internal/JsonSchema/json-schema-normalize.ts +1 -1
  365. package/src/internal/JsonSchema/json-schema-shape.test.ts +3 -3
  366. package/src/internal/JsonSchema/json-schema-type.ts +10 -4
  367. package/src/internal/JsonSchema/json-schema-v3.test.ts +4 -4
  368. package/src/internal/JsonSchema/json-schema.test.ts +82 -11
  369. package/src/internal/JsonSchema/json-schema.ts +187 -60
  370. package/src/internal/Obj/atoms.ts +114 -77
  371. package/src/internal/Obj/clone.ts +6 -6
  372. package/src/internal/Obj/common.ts +2 -2
  373. package/src/internal/Obj/create-object.test.ts +9 -9
  374. package/src/internal/Obj/create-object.ts +8 -8
  375. package/src/internal/Obj/deleted.ts +2 -2
  376. package/src/internal/Obj/index.ts +10 -10
  377. package/src/internal/Obj/inspect.ts +4 -4
  378. package/src/internal/Obj/json-serializer.test.ts +38 -14
  379. package/src/internal/Obj/json-serializer.ts +19 -9
  380. package/src/internal/Obj/parent-annotation.ts +32 -22
  381. package/src/internal/Obj/set-value.test.ts +3 -3
  382. package/src/internal/Obj/set-value.ts +4 -3
  383. package/src/internal/Obj/snapshot.ts +26 -14
  384. package/src/internal/Obj/typed-object.test.ts +3 -3
  385. package/src/internal/Obj/typed-object.ts +2 -2
  386. package/src/internal/Query/index.ts +2 -2
  387. package/src/internal/Query/pretty.ts +21 -1
  388. package/src/internal/Query/query-result-effect.ts +1 -1
  389. package/src/internal/Ref/atoms.ts +40 -30
  390. package/src/internal/Ref/index.ts +3 -3
  391. package/src/internal/Ref/ref-array.ts +9 -9
  392. package/src/internal/Ref/ref.test.ts +37 -4
  393. package/src/internal/Ref/ref.ts +106 -26
  394. package/src/internal/Ref/strong-deps.ts +4 -4
  395. package/src/internal/Ref/utils.ts +11 -4
  396. package/src/internal/Registry/atoms.ts +3 -3
  397. package/src/internal/Type/compose.test.ts +5 -5
  398. package/src/internal/Type/compose.ts +1 -1
  399. package/src/internal/Type/index.ts +2 -2
  400. package/src/internal/Type/manipulation.ts +1 -1
  401. package/src/internal/Type/type-schema.ts +4 -4
  402. package/src/internal/common/api/index.ts +1 -1
  403. package/src/internal/common/api/meta.ts +5 -5
  404. package/src/internal/common/atom-snapshot.test.ts +32 -1
  405. package/src/internal/common/atom-snapshot.ts +38 -18
  406. package/src/internal/common/index.ts +4 -3
  407. package/src/internal/common/merge.test.ts +45 -0
  408. package/src/internal/common/merge.ts +33 -0
  409. package/src/internal/common/proxy/change-context.ts +34 -3
  410. package/src/internal/common/proxy/change.test.ts +4 -4
  411. package/src/internal/common/proxy/entity-hash.test.ts +23 -20
  412. package/src/internal/common/proxy/errors.ts +7 -0
  413. package/src/internal/common/proxy/event-batch.ts +1 -1
  414. package/src/internal/common/proxy/handler.test.ts +5 -15
  415. package/src/internal/common/proxy/index.ts +13 -13
  416. package/src/internal/common/proxy/json-serializer.ts +10 -4
  417. package/src/internal/common/proxy/make-object.ts +8 -8
  418. package/src/internal/common/proxy/nested-array-gate.test.ts +136 -0
  419. package/src/internal/common/proxy/ownership.ts +18 -5
  420. package/src/internal/common/proxy/proxy-types.ts +0 -6
  421. package/src/internal/common/proxy/proxy-utils.ts +226 -93
  422. package/src/internal/common/proxy/reactive-array.ts +20 -32
  423. package/src/internal/common/proxy/reactive.test.ts +2 -2
  424. package/src/internal/common/proxy/reactive.ts +4 -4
  425. package/src/internal/common/proxy/schema-validator.test.ts +7 -7
  426. package/src/internal/common/proxy/schema-validator.ts +66 -60
  427. package/src/internal/common/proxy/schema.test.ts +15 -5
  428. package/src/internal/common/proxy/symbols.ts +8 -0
  429. package/src/internal/common/proxy/typed-handler.test.ts +22 -8
  430. package/src/internal/common/proxy/typed-handler.ts +144 -147
  431. package/src/internal/common/proxy/typed-object.test.ts +6 -6
  432. package/src/internal/common/types/base.ts +2 -2
  433. package/src/internal/common/types/index.ts +7 -7
  434. package/src/internal/common/types/meta.ts +42 -6
  435. package/src/internal/common/types/projection.ts +2 -4
  436. package/src/internal/common/types/typename.ts +11 -2
  437. package/src/internal/index.ts +11 -11
  438. package/src/testing/api.test.ts +2 -2
  439. package/src/testing/index.ts +4 -4
  440. package/src/testing/registry.ts +2 -2
  441. package/src/testing/test-data.ts +2 -2
  442. package/src/testing/test-schema.ts +23 -10
  443. package/src/testing/util.ts +10 -3
@@ -3,10 +3,15 @@ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
3
3
  var Aggregate_exports = /* @__PURE__ */ __exportAll({
4
4
  AggregateTypeId: () => AggregateTypeId,
5
5
  count: () => count,
6
+ created: () => created,
6
7
  group: () => group,
7
8
  items: () => items,
8
9
  max: () => max,
9
- min: () => min
10
+ min: () => min,
11
+ sum: () => sum,
12
+ time: () => time,
13
+ type: () => type,
14
+ updated: () => updated
10
15
  });
11
16
  var AggregateTypeId = "~@dxos/echo/Aggregate";
12
17
  var AggregateClass = class AggregateClass {
@@ -31,6 +36,8 @@ var AggregateClass = class AggregateClass {
31
36
  * member lacking the leading property its own singleton group instead of pooling them under `null`,
32
37
  * where an {@link items} `limit` would truncate unrelated members. `id` qualifies: it resolves to
33
38
  * the object's entity id even though documents don't store it as data.
39
+ *
40
+ * @performance O(1); builds an aggregate spec without evaluating anything.
34
41
  */
35
42
  var group = (key) => new AggregateClass({
36
43
  kind: "group",
@@ -40,6 +47,8 @@ var group = (key) => new AggregateClass({
40
47
  * Aggregate the maximum of a scalar property across the group's members.
41
48
  * `T` is inferred from the `Query.aggregate` context, so `property` is checked against the query's
42
49
  * element type (like {@link Order.property}).
50
+ *
51
+ * @performance O(1); builds an aggregate spec without evaluating anything.
43
52
  */
44
53
  var max = (property) => new AggregateClass({
45
54
  kind: "max",
@@ -47,6 +56,8 @@ var max = (property) => new AggregateClass({
47
56
  });
48
57
  /**
49
58
  * Aggregate the minimum of a scalar property across the group's members.
59
+ *
60
+ * @performance O(1); builds an aggregate spec without evaluating anything.
50
61
  */
51
62
  var min = (property) => new AggregateClass({
52
63
  kind: "min",
@@ -62,6 +73,8 @@ var min = (property) => new AggregateClass({
62
73
  * they arrived in from a preceding `orderBy` (unspecified if there is none), so a per-group
63
74
  * top-`limit` moved position in the chain would silently change; declaring `order` here makes the
64
75
  * ordering explicit and local to this aggregate regardless of where it sits.
76
+ *
77
+ * @performance O(k) in the number of orders; builds an aggregate spec without evaluating anything.
65
78
  */
66
79
  var items = (options) => new AggregateClass({
67
80
  kind: "items",
@@ -69,10 +82,62 @@ var items = (options) => new AggregateClass({
69
82
  order: options?.order?.map((order) => order.ast)
70
83
  });
71
84
  /**
85
+ * Sum a numeric property across the group's members; values that are not numbers count as 0, so
86
+ * a group always sums to a number.
87
+ *
88
+ * @performance O(1); builds an aggregate spec without evaluating anything.
89
+ */
90
+ var sum = (property) => new AggregateClass({
91
+ kind: "sum",
92
+ property
93
+ });
94
+ /**
72
95
  * Count the group's members. Opt-in — groups carry no count unless this aggregate is declared.
96
+ *
97
+ * @performance O(1); builds an aggregate spec without evaluating anything.
73
98
  */
74
99
  var count = () => new AggregateClass({ kind: "count" });
100
+ /**
101
+ * Group members by their stored type URI. The field carries the URI string as written, so two
102
+ * schema versions are two groups.
103
+ *
104
+ * @performance O(1); builds an aggregate spec without evaluating anything.
105
+ */
106
+ var type = () => new AggregateClass({ kind: "type" });
107
+ /**
108
+ * Group members by the UTC hour or day their system `updatedAt` falls in. The field carries the start
109
+ * of that interval in unix ms, or `null` when the timestamp is unknown.
110
+ *
111
+ * @performance O(1); builds an aggregate spec without evaluating anything.
112
+ */
113
+ var updated = (unit) => new AggregateClass({
114
+ kind: "timestamp",
115
+ field: "updatedAt",
116
+ unit
117
+ });
118
+ /**
119
+ * Like {@link updated}, over the system `createdAt` timestamp.
120
+ *
121
+ * @performance O(1); builds an aggregate spec without evaluating anything.
122
+ */
123
+ var created = (unit) => new AggregateClass({
124
+ kind: "timestamp",
125
+ field: "createdAt",
126
+ unit
127
+ });
128
+ /**
129
+ * Group members by the UTC hour or day a unix-ms property falls in, like {@link updated} over a
130
+ * property instead of a system timestamp. The field carries the start of that interval in unix ms,
131
+ * or `null` when the property is not a number.
132
+ *
133
+ * @performance O(1); builds an aggregate spec without evaluating anything.
134
+ */
135
+ var time = (property, unit) => new AggregateClass({
136
+ kind: "time",
137
+ property,
138
+ unit
139
+ });
75
140
  //#endregion
76
- export { AggregateTypeId, count, group, items, max, min, Aggregate_exports as t };
141
+ export { AggregateTypeId, count, created, group, items, max, min, sum, Aggregate_exports as t, time, type, updated };
77
142
 
78
143
  //# sourceMappingURL=Aggregate.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Aggregate.mjs","names":[],"sources":["../../src/Aggregate.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as EffectTypes from 'effect/Types';\n\nimport type { QueryAST } from '@dxos/echo-protocol';\n\nimport type * as Order from './Order';\nimport type * as Query from './Query';\n\n/**\n * The aggregate spec sans name; the name is supplied by the `Query.aggregate` record key. A tagged\n * union per kind so `property`/`limit`/`order` are present exactly when the kind uses them (no\n * unused optional fields to guard against at read sites).\n */\nexport type Spec =\n | { kind: 'group'; properties: readonly [string, ...string[]] }\n | { kind: 'max'; property: string }\n | { kind: 'min'; property: string }\n | { kind: 'items'; limit?: number; order?: readonly QueryAST.Order[] }\n | { kind: 'count' };\n\nexport const AggregateTypeId = '~@dxos/echo/Aggregate' as const;\nexport type AggregateTypeId = typeof AggregateTypeId;\n\n/**\n * A per-group aggregate declaration, materialised as a top-level field on the flat result record\n * `Query.aggregate` produces and orderable via a following `orderBy(Order.property(name))`. Name it\n * via the record passed to `Query.aggregate({ name: Aggregate.max('created') })`.\n *\n * `T` is the query's element type (so a reduced/grouped property is checked against it); `V` is the\n * value the aggregate produces. {@link group} entries define the grouping keys; a record with no\n * `group` entries aggregates the entire input into a single row.\n */\nexport interface Aggregate<T, V> {\n readonly [AggregateTypeId]: { element: T; value: V };\n\n spec: Spec;\n}\n\nexport type Any = Aggregate<any, any>;\n\n/** Extracts the value type a {@link Aggregate} produces. */\nexport type ValueOf<A> = A extends Aggregate<any, infer V> ? V : never;\n\n/** Computes the flat result type of `Query.aggregate(aggregates)` for a given aggregate record `A`. */\nexport type AggregationResult<A extends Record<string, Any>> = EffectTypes.Simplify<\n Query.AggregateResult & { readonly [N in keyof A]: ValueOf<A[N]> }\n>;\n\nclass AggregateClass<T, V> implements Aggregate<T, V> {\n private static 'variance': Aggregate<any, any>[AggregateTypeId] = {} as Aggregate<any, any>[AggregateTypeId];\n\n static is(value: unknown): value is Any {\n return typeof value === 'object' && value !== null && AggregateTypeId in value;\n }\n\n constructor(public readonly spec: Spec) {}\n\n [AggregateTypeId] = AggregateClass.variance as Aggregate<T, V>[AggregateTypeId];\n}\n\n/**\n * Group members by a scalar property, or by the first property of a `coalesce` chain holding a\n * scalar value (`threadId ?? id`). The record key names the result field carrying the coerced\n * group-key value; multiple `group` entries form a composite key (a `coalesce` chain is one\n * component, not several). Members whose key is missing, `null`, `undefined`, or non-scalar group\n * under the `null` key, so the field value includes `null`.\n *\n * A chain ending in an always-present property (e.g. `{ coalesce: ['threadId', 'id'] }`) gives each\n * member lacking the leading property its own singleton group instead of pooling them under `null`,\n * where an {@link items} `limit` would truncate unrelated members. `id` qualifies: it resolves to\n * the object's entity id even though documents don't store it as data.\n */\nexport const group: {\n <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null>;\n <T, const K extends readonly [keyof T & string, ...(keyof T & string)[]]>(key: {\n coalesce: K;\n }): Aggregate<T, T[K[number]] | null>;\n} = (key: string | { coalesce: readonly [string, ...string[]] }): Any =>\n new AggregateClass({ kind: 'group', properties: typeof key === 'string' ? [key] : key.coalesce });\n\n/**\n * Aggregate the maximum of a scalar property across the group's members.\n * `T` is inferred from the `Query.aggregate` context, so `property` is checked against the query's\n * element type (like {@link Order.property}).\n */\nexport const max = <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null> =>\n new AggregateClass({ kind: 'max', property });\n\n/**\n * Aggregate the minimum of a scalar property across the group's members.\n */\nexport const min = <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null> =>\n new AggregateClass({ kind: 'min', property });\n\n/**\n * Collect the group's members, optionally ordered by `order` and capped to `limit` per group.\n * Opt-in — groups carry no members unless this aggregate is declared.\n *\n * `order` is this aggregate's own per-group ordering — independent of any `orderBy` elsewhere in\n * the query, which orders the whole input stream (and, following `aggregate`, the resulting\n * groups), not this aggregate's member selection. Without `order`, members keep whatever order\n * they arrived in from a preceding `orderBy` (unspecified if there is none), so a per-group\n * top-`limit` moved position in the chain would silently change; declaring `order` here makes the\n * ordering explicit and local to this aggregate regardless of where it sits.\n */\nexport const items = <T>(options?: { limit?: number; order?: Order.Any[] }): Aggregate<T, T[]> =>\n new AggregateClass({ kind: 'items', limit: options?.limit, order: options?.order?.map((order) => order.ast) });\n\n/**\n * Count the group's members. Opt-in — groups carry no count unless this aggregate is declared.\n */\nexport const count = <T>(): Aggregate<T, number> => new AggregateClass({ kind: 'count' });\n"],"mappings":";;;;;;;;;;AAyBA,IAAa,kBAAkB;AA4B/B,IAAM,iBAAN,MAAM,eAAgD;CAOxB;CAN5B,OAAe,aAAmD,CAAC;CAEnE,OAAO,GAAG,OAA8B;EACtC,OAAO,OAAO,UAAU,YAAY,UAAU,QAAA,2BAA2B;CAC3E;CAEA,YAAY,MAA4B;EAAZ,KAAA,OAAA;CAAa;CAEzC,CAAC,mBAAmB,eAAe;AACrC;;;;;;;;;;;;;AAcA,IAAa,SAKR,QACH,IAAI,eAAe;CAAE,MAAM;CAAS,YAAY,OAAO,QAAQ,WAAW,CAAC,GAAG,IAAI,IAAI;AAAS,CAAC;;;;;;AAOlG,IAAa,OAAsC,aACjD,IAAI,eAAe;CAAE,MAAM;CAAO;AAAS,CAAC;;;;AAK9C,IAAa,OAAsC,aACjD,IAAI,eAAe;CAAE,MAAM;CAAO;AAAS,CAAC;;;;;;;;;;;;AAa9C,IAAa,SAAY,YACvB,IAAI,eAAe;CAAE,MAAM;CAAS,OAAO,SAAS;CAAO,OAAO,SAAS,OAAO,KAAK,UAAU,MAAM,GAAG;AAAE,CAAC;;;;AAK/G,IAAa,cAAuC,IAAI,eAAe,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"Aggregate.mjs","names":[],"sources":["../../src/Aggregate.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as EffectTypes from 'effect/Types';\n\nimport type { QueryAST } from '@dxos/echo-protocol';\n\nimport type * as Order from './Order.ts';\nimport type * as Query from './Query.ts';\n\n/**\n * The aggregate spec sans name; the name is supplied by the `Query.aggregate` record key. A tagged\n * union per kind so `property`/`limit`/`order` are present exactly when the kind uses them (no\n * unused optional fields to guard against at read sites).\n */\nexport type Spec =\n | { kind: 'group'; properties: readonly [string, ...string[]] }\n | { kind: 'max'; property: string }\n | { kind: 'min'; property: string }\n | { kind: 'items'; limit?: number; order?: readonly QueryAST.Order[] }\n | { kind: 'count' }\n | { kind: 'type' }\n | { kind: 'timestamp'; field: 'createdAt' | 'updatedAt'; unit: TimeUnit }\n | { kind: 'time'; property: string; unit: TimeUnit }\n | { kind: 'sum'; property: string };\n\nexport const AggregateTypeId = '~@dxos/echo/Aggregate' as const;\nexport type AggregateTypeId = typeof AggregateTypeId;\n\n/**\n * A per-group aggregate declaration, materialised as a top-level field on the flat result record\n * `Query.aggregate` produces and orderable via a following `orderBy(Order.property(name))`. Name it\n * via the record passed to `Query.aggregate({ name: Aggregate.max('created') })`.\n *\n * `T` is the query's element type (so a reduced/grouped property is checked against it); `V` is the\n * value the aggregate produces. {@link group} entries define the grouping keys; a record with no\n * `group` entries aggregates the entire input into a single row.\n */\nexport interface Aggregate<T, V> {\n readonly [AggregateTypeId]: { element: T; value: V };\n\n spec: Spec;\n}\n\nexport type Any = Aggregate<any, any>;\n\n/** Extracts the value type a {@link Aggregate} produces. */\nexport type ValueOf<A> = A extends Aggregate<any, infer V> ? V : never;\n\n/** Computes the flat result type of `Query.aggregate(aggregates)` for a given aggregate record `A`. */\nexport type AggregationResult<A extends Record<string, Any>> = EffectTypes.Simplify<\n Query.RecordResult & { readonly [N in keyof A]: ValueOf<A[N]> }\n>;\n\nclass AggregateClass<T, V> implements Aggregate<T, V> {\n private static 'variance': Aggregate<any, any>[AggregateTypeId] = {} as Aggregate<any, any>[AggregateTypeId];\n\n static is(value: unknown): value is Any {\n return typeof value === 'object' && value !== null && AggregateTypeId in value;\n }\n\n constructor(public readonly spec: Spec) {}\n\n [AggregateTypeId] = AggregateClass.variance as Aggregate<T, V>[AggregateTypeId];\n}\n\n/**\n * Group members by a scalar property, or by the first property of a `coalesce` chain holding a\n * scalar value (`threadId ?? id`). The record key names the result field carrying the coerced\n * group-key value; multiple `group` entries form a composite key (a `coalesce` chain is one\n * component, not several). Members whose key is missing, `null`, `undefined`, or non-scalar group\n * under the `null` key, so the field value includes `null`.\n *\n * A chain ending in an always-present property (e.g. `{ coalesce: ['threadId', 'id'] }`) gives each\n * member lacking the leading property its own singleton group instead of pooling them under `null`,\n * where an {@link items} `limit` would truncate unrelated members. `id` qualifies: it resolves to\n * the object's entity id even though documents don't store it as data.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const group: {\n <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null>;\n <T, const K extends readonly [keyof T & string, ...(keyof T & string)[]]>(key: {\n coalesce: K;\n }): Aggregate<T, T[K[number]] | null>;\n} = (key: string | { coalesce: readonly [string, ...string[]] }): Any =>\n new AggregateClass({ kind: 'group', properties: typeof key === 'string' ? [key] : key.coalesce });\n\n/**\n * Aggregate the maximum of a scalar property across the group's members.\n * `T` is inferred from the `Query.aggregate` context, so `property` is checked against the query's\n * element type (like {@link Order.property}).\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const max = <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null> =>\n new AggregateClass({ kind: 'max', property });\n\n/**\n * Aggregate the minimum of a scalar property across the group's members.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const min = <T, K extends keyof T & string>(property: K): Aggregate<T, T[K] | null> =>\n new AggregateClass({ kind: 'min', property });\n\n/**\n * Collect the group's members, optionally ordered by `order` and capped to `limit` per group.\n * Opt-in — groups carry no members unless this aggregate is declared.\n *\n * `order` is this aggregate's own per-group ordering — independent of any `orderBy` elsewhere in\n * the query, which orders the whole input stream (and, following `aggregate`, the resulting\n * groups), not this aggregate's member selection. Without `order`, members keep whatever order\n * they arrived in from a preceding `orderBy` (unspecified if there is none), so a per-group\n * top-`limit` moved position in the chain would silently change; declaring `order` here makes the\n * ordering explicit and local to this aggregate regardless of where it sits.\n *\n * @performance O(k) in the number of orders; builds an aggregate spec without evaluating anything.\n */\nexport const items = <T>(options?: { limit?: number; order?: Order.Any[] }): Aggregate<T, T[]> =>\n new AggregateClass({ kind: 'items', limit: options?.limit, order: options?.order?.map((order) => order.ast) });\n\nexport type NumericKeys<T> = { [K in keyof T & string]: T[K] extends number | null | undefined ? K : never }[keyof T &\n string];\n\n/**\n * Sum a numeric property across the group's members; values that are not numbers count as 0, so\n * a group always sums to a number.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const sum = <T, K extends NumericKeys<T>>(property: K): Aggregate<T, number> =>\n new AggregateClass({ kind: 'sum', property });\n\n/**\n * Count the group's members. Opt-in — groups carry no count unless this aggregate is declared.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const count = <T>(): Aggregate<T, number> => new AggregateClass({ kind: 'count' });\n\n/**\n * Group members by their stored type URI. The field carries the URI string as written, so two\n * schema versions are two groups.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const type = <T>(): Aggregate<T, string | null> => new AggregateClass({ kind: 'type' });\n\n/**\n * Time units a timestamp aggregate can group by, both in UTC. To show local days, group by `hour` and\n * roll the hours into the viewer's days; an hour straddles local midnight in a zone offset by a\n * fraction of an hour (India, Newfoundland), so its members land on one side of it.\n */\nexport type TimeUnit = 'hour' | 'day';\n\n/**\n * Group members by the UTC hour or day their system `updatedAt` falls in. The field carries the start\n * of that interval in unix ms, or `null` when the timestamp is unknown.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const updated = <T>(unit: TimeUnit): Aggregate<T, number | null> =>\n new AggregateClass({ kind: 'timestamp', field: 'updatedAt', unit });\n\n/**\n * Like {@link updated}, over the system `createdAt` timestamp.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const created = <T>(unit: TimeUnit): Aggregate<T, number | null> =>\n new AggregateClass({ kind: 'timestamp', field: 'createdAt', unit });\n\n/**\n * Group members by the UTC hour or day a unix-ms property falls in, like {@link updated} over a\n * property instead of a system timestamp. The field carries the start of that interval in unix ms,\n * or `null` when the property is not a number.\n *\n * @performance O(1); builds an aggregate spec without evaluating anything.\n */\nexport const time = <T, K extends NumericKeys<T>>(property: K, unit: TimeUnit): Aggregate<T, number | null> =>\n new AggregateClass({ kind: 'time', property, unit });\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,IAAa,kBAAkB;AA4B/B,IAAM,iBAAN,MAAM,eAAgD;CAOxB;CAN5B,OAAe,aAAmD,CAAC;CAEnE,OAAO,GAAG,OAA8B;EACtC,OAAO,OAAO,UAAU,YAAY,UAAU,QAAA,2BAA2B;CAC3E;CAEA,YAAY,MAA4B;EAAZ,KAAA,OAAA;CAAa;CAEzC,CAAC,mBAAmB,eAAe;AACrC;;;;;;;;;;;;;;;AAgBA,IAAa,SAKR,QACH,IAAI,eAAe;CAAE,MAAM;CAAS,YAAY,OAAO,QAAQ,WAAW,CAAC,GAAG,IAAI,IAAI;AAAS,CAAC;;;;;;;;AASlG,IAAa,OAAsC,aACjD,IAAI,eAAe;CAAE,MAAM;CAAO;AAAS,CAAC;;;;;;AAO9C,IAAa,OAAsC,aACjD,IAAI,eAAe;CAAE,MAAM;CAAO;AAAS,CAAC;;;;;;;;;;;;;;AAe9C,IAAa,SAAY,YACvB,IAAI,eAAe;CAAE,MAAM;CAAS,OAAO,SAAS;CAAO,OAAO,SAAS,OAAO,KAAK,UAAU,MAAM,GAAG;AAAE,CAAC;;;;;;;AAW/G,IAAa,OAAoC,aAC/C,IAAI,eAAe;CAAE,MAAM;CAAO;AAAS,CAAC;;;;;;AAO9C,IAAa,cAAuC,IAAI,eAAe,EAAE,MAAM,QAAQ,CAAC;;;;;;;AAQxF,IAAa,aAA6C,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;;;;;;;AAe7F,IAAa,WAAc,SACzB,IAAI,eAAe;CAAE,MAAM;CAAa,OAAO;CAAa;AAAK,CAAC;;;;;;AAOpE,IAAa,WAAc,SACzB,IAAI,eAAe;CAAE,MAAM;CAAa,OAAO;CAAa;AAAK,CAAC;;;;;;;;AASpE,IAAa,QAAqC,UAAa,SAC7D,IAAI,eAAe;CAAE,MAAM;CAAQ;CAAU;AAAK,CAAC"}
@@ -1,3 +1,3 @@
1
- import { A as DEFAULT_LAYOUT_NAME, At as setDescriptionWithSchema, B as FormInputAnnotation, H as FormLayoutAnnotation, I as FormCreateAnnotation, J as HiddenAnnotation, K as GeneratorAnnotation, L as FormCreateAnnotationId, Mt as setLabelWithSchema, P as FieldLookupAnnotationId, Q as LabelAnnotation, R as FormInlineAnnotation, Tt as getTypeIdentifierAnnotation, U as FormLayoutAnnotationId, W as FormOrderedAnnotation, X as IconAnnotation, Z as IconFromRefAnnotation, at as SetParentAnnotation, j as DescriptionAnnotation, nt as ReferenceAnnotation, ot as TypeAnnotation, pt as getDescriptionWithSchema, q as GeneratorAnnotationId, rt as ReferenceAnnotationId, wt as getTypeAnnotation, yt as getLabelWithSchema } from "./chunk-Database.mjs";
1
+ import { $ as GeneratorAnnotation, At as getTypeAnnotation, F as ArrayPresentationAnnotation, G as FormInlineAnnotation, It as setDescriptionWithSchema, L as DEFAULT_LAYOUT_NAME, R as DescriptionAnnotation, Rt as setLabelWithSchema, Tt as getLabelWithSchema, U as FormCreateAnnotation, V as FieldLookupAnnotationId, W as FormCreateAnnotationId, X as FormLayoutAnnotationId, Y as FormLayoutAnnotation, Z as FormOrderedAnnotation, ct as ReferenceAnnotationId, dt as TypeAnnotation, et as GeneratorAnnotationId, gt as UserTypeAnnotation, jt as getTypeIdentifierAnnotation, nt as IconFromRefAnnotation, q as FormInputAnnotation, rt as LabelAnnotation, st as ReferenceAnnotation, tt as IconAnnotation, ut as SetParentAnnotation, yt as getDescriptionWithSchema } from "./chunk-Database.mjs";
2
2
  import { a as atom, c as get, d as make, f as set, i as TypeId, l as getDictionary, m as update, n as Dictionary, o as atomProperty, p as setDictionary, r as Key, s as buildDictionary, u as getFromAst } from "./chunk-Annotation.mjs";
3
- export { DEFAULT_LAYOUT_NAME, DescriptionAnnotation, Dictionary, FieldLookupAnnotationId, FormCreateAnnotation, FormCreateAnnotationId, FormInlineAnnotation, FormInputAnnotation, FormLayoutAnnotation, FormLayoutAnnotationId, FormOrderedAnnotation, GeneratorAnnotation, GeneratorAnnotationId, HiddenAnnotation, IconAnnotation, IconFromRefAnnotation, Key, LabelAnnotation, ReferenceAnnotation, ReferenceAnnotationId, SetParentAnnotation as SetParent, TypeAnnotation, TypeId, atom, atomProperty, buildDictionary, get, getDescriptionWithSchema, getDictionary, getFromAst, getLabelWithSchema, getTypeAnnotation, getTypeIdentifierAnnotation, make, set, setDescriptionWithSchema, setDictionary, setLabelWithSchema, update };
3
+ export { ArrayPresentationAnnotation, DEFAULT_LAYOUT_NAME, DescriptionAnnotation, Dictionary, FieldLookupAnnotationId, FormCreateAnnotation, FormCreateAnnotationId, FormInlineAnnotation, FormInputAnnotation, FormLayoutAnnotation, FormLayoutAnnotationId, FormOrderedAnnotation, GeneratorAnnotation, GeneratorAnnotationId, IconAnnotation, IconFromRefAnnotation, Key, LabelAnnotation, ReferenceAnnotation, ReferenceAnnotationId, SetParentAnnotation as SetParent, TypeAnnotation, TypeId, UserTypeAnnotation as UserType, atom, atomProperty, buildDictionary, get, getDescriptionWithSchema, getDictionary, getFromAst, getLabelWithSchema, getTypeAnnotation, getTypeIdentifierAnnotation, make, set, setDescriptionWithSchema, setDictionary, setLabelWithSchema, update };
package/dist/lib/Blob.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { J as HiddenAnnotation, X as IconAnnotation, r as Service } from "./chunk-Database.mjs";
2
+ import { i as Service, tt as IconAnnotation } from "./chunk-Database.mjs";
3
3
  import { BlobNotAvailableError, BlobTooLargeError, BlobWriteError } from "./Error.mjs";
4
4
  import { makeObject } from "./Type.mjs";
5
5
  import { make as make$1 } from "./Obj.mjs";
@@ -19,6 +19,7 @@ var Blob_exports = /* @__PURE__ */ __exportAll({
19
19
  exists: () => exists,
20
20
  externalData: () => externalData,
21
21
  fromBytes: () => fromBytes,
22
+ fromUpload: () => fromUpload,
22
23
  inlineData: () => inlineData,
23
24
  make: () => make,
24
25
  read: () => read,
@@ -61,7 +62,7 @@ var Blob = class extends makeObject(DXN.make("org.dxos.type.blob", "0.1.0"))(Sch
61
62
  type: Schema.optional(Schema.String),
62
63
  size: Schema.Number,
63
64
  data: BlobData
64
- }).pipe(HiddenAnnotation.set(true), IconAnnotation.set({
65
+ }).pipe(IconAnnotation.set({
65
66
  icon: "ph--file--regular",
66
67
  hue: "teal"
67
68
  }))) {};
@@ -81,7 +82,7 @@ var Storage = {
81
82
  edge: "edge"
82
83
  };
83
84
  /**
84
- * URI schemes claimed by core backends (see `BlobBackend.schemes` in `@dxos/echo-protocol`).
85
+ * URI schemes claimed by core backends (see `BlobBackend.schemes` in `@dxos/blob`).
85
86
  *
86
87
  * `ni` marks an {@link https://www.rfc-editor.org/rfc/rfc6920 RFC 6920} Named Information URI whose
87
88
  * authority is empty and whose path carries a registered hash-algorithm name plus a base64url-encoded
@@ -97,10 +98,14 @@ var Scheme = { ni: "ni" };
97
98
  var MAX_INLINE_SIZE = 4194304;
98
99
  /**
99
100
  * Creates a new blob object. Does not add it to the database — see {@link fromBytes}.
101
+ *
102
+ * @performance O(1); allocates an in-memory blob object.
100
103
  */
101
104
  var make = (props) => make$1(Blob, props);
102
105
  /**
103
106
  * Creates an inline {@link BlobData} variant that embeds raw bytes on the ECHO object.
107
+ *
108
+ * @performance O(1); wraps the bytes without copying.
104
109
  */
105
110
  var inlineData = (bytes) => ({
106
111
  _tag: "inline",
@@ -109,6 +114,8 @@ var inlineData = (bytes) => ({
109
114
  /**
110
115
  * Creates an external {@link BlobData} variant that references bytes held by a registered backend.
111
116
  * @param uri - Backend-scoped URI, e.g. as returned by a `BlobBackend.put` call.
117
+ *
118
+ * @performance O(1).
112
119
  */
113
120
  var externalData = (uri) => ({
114
121
  _tag: "external",
@@ -123,12 +130,35 @@ var externalData = (uri) => ({
123
130
  * const blob = yield* Blob.fromBytes(bytes, { type: 'image/png' });
124
131
  * yield* Database.add(blob);
125
132
  * ```
133
+ *
134
+ * @performance Async; O(size) to hash, plus the backend upload (a no-op for inline storage).
126
135
  */
127
136
  var fromBytes = (bytes, options) => Service.pipe(Effect.flatMap(({ db }) => Effect.tryPromise({
128
137
  try: () => db.createBlob(bytes, options),
129
138
  catch: (error) => error instanceof BlobTooLargeError || error instanceof BlobWriteError ? error : new BlobWriteError({ backend: options?.storage ?? "unknown" }, { cause: error })
130
139
  }))).pipe(Effect.withSpan("Blob.fromBytes"));
131
140
  /**
141
+ * Adopts bytes already staged by a direct upload, returning an un-added Blob object. The caller is
142
+ * responsible for adding it to the database.
143
+ *
144
+ * The counterpart to {@link fromBytes} for content this process never holds: an agent uploaded the
145
+ * file straight to the store over a signed URL, because passing it through a tool call would mean
146
+ * a model emitting it byte by byte. Size and type are reported by the store, which is the only
147
+ * party that saw what arrived.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const blob = yield* Blob.fromUpload(uploadId);
152
+ * yield* Database.add(blob);
153
+ * ```
154
+ *
155
+ * @performance Async; one backend round trip, and the bytes never pass through this process.
156
+ */
157
+ var fromUpload = (uploadId, options) => Service.pipe(Effect.flatMap(({ db }) => Effect.tryPromise({
158
+ try: () => db.createBlobFromUpload(uploadId, options),
159
+ catch: (error) => error instanceof BlobNotAvailableError || error instanceof BlobWriteError ? error : new BlobWriteError({ backend: options?.storage ?? "unknown" }, { cause: error })
160
+ }))).pipe(Effect.withSpan("Blob.fromUpload"));
161
+ /**
132
162
  * Loads a blob's bytes. Inline: read directly off the object. External: dispatched to the
133
163
  * registered backend for the URI's scheme.
134
164
  *
@@ -136,6 +166,8 @@ var fromBytes = (bytes, options) => Service.pipe(Effect.flatMap(({ db }) => Effe
136
166
  * ```ts
137
167
  * const bytes = yield* Blob.read(blob);
138
168
  * ```
169
+ *
170
+ * @performance Async; O(size), read inline or fetched from the backend.
139
171
  */
140
172
  var read = (blob) => Service.pipe(Effect.flatMap(({ db }) => Effect.tryPromise({
141
173
  try: () => db.readBlob(blob),
@@ -147,14 +179,19 @@ var read = (blob) => Service.pipe(Effect.flatMap(({ db }) => Effect.tryPromise({
147
179
  }))).pipe(Effect.withSpan("Blob.read"));
148
180
  /**
149
181
  * Checks whether a blob's bytes are currently available.
182
+ *
183
+ * @performance Async; one backend check, with no byte transfer.
150
184
  */
151
185
  var exists = (blob) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.blobExists(blob)))).pipe(Effect.withSpan("Blob.exists"));
152
186
  /**
153
187
  * Returns a renderable URL for the blob: inline blobs resolve to a `data:` URL; external blobs
154
188
  * are resolved by the registered backend's `getUrl`, if it implements one.
189
+ *
190
+ * @performance Async; an inline blob encodes all of its bytes into a `data:` URL (O(size)), an external one asks the
191
+ * backend.
155
192
  */
156
193
  var url = (blob) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.getBlobUrl(blob))), Effect.map(Option.fromNullishOr)).pipe(Effect.withSpan("Blob.url"));
157
194
  //#endregion
158
- export { Blob, BlobData, ExternalData, InlineData, MAX_INLINE_SIZE, Scheme, Storage, exists, externalData, fromBytes, inlineData, make, read, Blob_exports as t, url };
195
+ export { Blob, BlobData, ExternalData, InlineData, MAX_INLINE_SIZE, Scheme, Storage, exists, externalData, fromBytes, fromUpload, inlineData, make, read, Blob_exports as t, url };
159
196
 
160
197
  //# sourceMappingURL=Blob.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blob.mjs","names":[],"sources":["../../src/Blob.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport { DXN } from '@dxos/keys';\n\nimport * as Annotation from './Annotation';\nimport * as Database from './Database';\nimport * as Error from './Error';\nimport * as internal from './internal';\nimport * as Obj from './Obj';\nimport * as Type from './Type';\n\n/**\n * Inline blob data: bytes stored directly on the ECHO object.\n */\nexport const InlineData = Schema.TaggedStruct('inline', {\n bytes: Schema.Uint8Array.annotate({ jsonSchema: { type: 'string', contentEncoding: 'base64' } }),\n});\n\n/**\n * External blob data: bytes stored by a registered blob backend, addressed by `uri`.\n */\nexport const ExternalData = Schema.TaggedStruct('external', {\n /**\n * URI locating the bytes. The scheme selects the backend at read time (e.g. `ni:///sha-256;…` for\n * the edge backend — an RFC 6920 content digest, not a backend name — or `wnfs://…` for the\n * plugin-wnfs extension), resolved via the scheme→backend map built from `registerBlobBackend`\n * calls. Core code never parses or constructs backend-specific URIs beyond reading the scheme.\n *\n * @see {@link https://www.rfc-editor.org/rfc/rfc6920 RFC 6920} for the `ni:` URI format.\n */\n uri: Schema.String,\n});\n\nexport const BlobData = Schema.Union([InlineData, ExternalData]);\nexport type BlobData = Schema.Schema.Type<typeof BlobData>;\n\n/**\n * Runtime schema for a Blob object.\n *\n * NOTE: This export shadows the DOM `Blob` global within modules that import it as a namespace.\n * Code that needs the DOM class should use `globalThis.Blob` explicitly.\n *\n * @example\n * ```ts\n * const blob = yield* Blob.fromBytes(bytes, { type: 'image/png' });\n * ```\n */\nexport class Blob extends Type.makeObject<Blob>(DXN.make('org.dxos.type.blob', '0.1.0'))(\n Schema.Struct({\n /** MIME type. */\n type: Schema.optional(Schema.String),\n size: Schema.Number,\n data: BlobData,\n }).pipe(\n internal.HiddenAnnotation.set(true),\n Annotation.IconAnnotation.set({ icon: 'ph--file--regular', hue: 'teal' }),\n ),\n) {}\n\n//\n// Storage constants\n//\n\n/**\n * Storage backend names, selected at write time via {@link FromBytesOptions.storage}. Call sites\n * always use these constants, never raw string literals. Extensions (e.g. plugin-wnfs) define\n * their own storage names in their own package — core code knows nothing of them.\n *\n * Distinct from {@link Scheme}: a storage name picks *where* to write, a URI scheme describes\n * *what the identifier is* at read time. They coincide for backends with no content-addressing\n * (e.g. wnfs uses `'wnfs'` for both), but the edge backend's storage name (`'edge'`) differs from\n * its URI scheme (`Scheme.ni`) because the identifier it produces is a content hash, not an\n * edge-specific address.\n */\nexport const Storage = { inline: 'inline', edge: 'edge' } as const;\nexport type Storage = (typeof Storage)[keyof typeof Storage];\n\n/**\n * URI schemes claimed by core backends (see `BlobBackend.schemes` in `@dxos/echo-protocol`).\n *\n * `ni` marks an {@link https://www.rfc-editor.org/rfc/rfc6920 RFC 6920} Named Information URI whose\n * authority is empty and whose path carries a registered hash-algorithm name plus a base64url-encoded\n * digest (e.g. `ni:///sha-256;UyaQNQIUxQKgg1jVMKMbg1Yr8Rrb2Y3RaOx2N0mVJhc`, produced by the edge\n * backend). The scheme names *what the identifier is* — a content digest over the complete blob —\n * not which backend wrote it, so any backend or cache that can resolve that digest may claim it.\n * The URI is an identity claim, not a retrievability promise; transport is selected by the registered\n * backend at read time.\n *\n * Extensions (e.g. plugin-wnfs) define their own schemes in their own package.\n */\nexport const Scheme = { ni: 'ni' } as const;\nexport type Scheme = (typeof Scheme)[keyof typeof Scheme];\n\n//\n// Factory\n//\n\nexport const MAX_INLINE_SIZE = 4 * 1024 * 1024;\n\n/**\n * Creates a new blob object. Does not add it to the database — see {@link fromBytes}.\n */\nexport const make = (props: Obj.MakeProps<typeof Blob>): Blob => Obj.make(Blob, props);\n\n/**\n * Creates an inline {@link BlobData} variant that embeds raw bytes on the ECHO object.\n */\nexport const inlineData = (bytes: Uint8Array): BlobData => ({ _tag: 'inline', bytes });\n\n/**\n * Creates an external {@link BlobData} variant that references bytes held by a registered backend.\n * @param uri - Backend-scoped URI, e.g. as returned by a `BlobBackend.put` call.\n */\nexport const externalData = (uri: string): BlobData => ({ _tag: 'external', uri });\n\nexport interface FromBytesOptions {\n /** MIME type. */\n type?: string;\n /**\n * Storage backend name. Defaults to the registry's configured default (initially `'inline'`;\n * `@dxos/client` marks `'edge'` as the default when configured).\n */\n storage?: Storage | (string & {});\n}\n\n//\n// Operations\n//\n\n/**\n * Hashes and uploads `bytes` via the chosen storage backend (a no-op for `inline`), returning an\n * un-added Blob object. The caller is responsible for adding it to the database.\n *\n * @example\n * ```ts\n * const blob = yield* Blob.fromBytes(bytes, { type: 'image/png' });\n * yield* Database.add(blob);\n * ```\n */\nexport const fromBytes = (\n bytes: Uint8Array,\n options?: FromBytesOptions,\n): Effect.Effect<Blob, Error.BlobTooLargeError | Error.BlobWriteError, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.tryPromise({\n try: () => db.createBlob(bytes, options),\n catch: (error) =>\n error instanceof Error.BlobTooLargeError || error instanceof Error.BlobWriteError\n ? error\n : new Error.BlobWriteError({ backend: options?.storage ?? 'unknown' }, { cause: error }),\n }),\n ),\n ).pipe(Effect.withSpan('Blob.fromBytes'));\n\n/**\n * Loads a blob's bytes. Inline: read directly off the object. External: dispatched to the\n * registered backend for the URI's scheme.\n *\n * @example\n * ```ts\n * const bytes = yield* Blob.read(blob);\n * ```\n */\nexport const read = (blob: Blob): Effect.Effect<Uint8Array, Error.BlobNotAvailableError, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.tryPromise({\n try: () => db.readBlob(blob),\n catch: (error) =>\n error instanceof Error.BlobNotAvailableError\n ? error\n : new Error.BlobNotAvailableError(\n { backend: 'unknown', key: blob.id, reason: 'not-found' },\n { cause: error },\n ),\n }),\n ),\n ).pipe(Effect.withSpan('Blob.read'));\n\n/**\n * Checks whether a blob's bytes are currently available.\n */\nexport const exists = (blob: Blob): Effect.Effect<boolean, never, Database.Service> =>\n Database.Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.blobExists(blob)))).pipe(\n Effect.withSpan('Blob.exists'),\n );\n\n/**\n * Returns a renderable URL for the blob: inline blobs resolve to a `data:` URL; external blobs\n * are resolved by the registered backend's `getUrl`, if it implements one.\n */\nexport const url = (blob: Blob): Effect.Effect<Option.Option<string>, never, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) => Effect.promise(() => db.getBlobUrl(blob))),\n Effect.map(Option.fromNullishOr),\n ).pipe(Effect.withSpan('Blob.url'));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,aAAa,OAAO,aAAa,UAAU,EACtD,OAAO,OAAO,WAAW,SAAS,EAAE,YAAY;CAAE,MAAM;CAAU,iBAAiB;AAAS,EAAE,CAAC,EACjG,CAAC;;;;AAKD,IAAa,eAAe,OAAO,aAAa,YAAY;;;;;;;;;AAS1D,KAAK,OAAO,OACd,CAAC;AAED,IAAa,WAAW,OAAO,MAAM,CAAC,YAAY,YAAY,CAAC;;;;;;;;;;;;AAc/D,IAAa,OAAb,cAA0B,WAAsB,IAAI,KAAK,sBAAsB,OAAO,CAAC,CAAC,CACtF,OAAO,OAAO;;CAEZ,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC,MAAM,OAAO;CACb,MAAM;AACR,CAAC,CAAC,CAAC,KAAA,iBACyB,IAAI,IAAI,GAAA,eACR,IAAI;CAAE,MAAM;CAAqB,KAAK;AAAO,CAAC,CAC1E,CACF,CAAC,CAAC,CAAC;;;;;;;;;;;;AAiBH,IAAa,UAAU;CAAE,QAAQ;CAAU,MAAM;AAAO;;;;;;;;;;;;;;AAgBxD,IAAa,SAAS,EAAE,IAAI,KAAK;AAOjC,IAAa,kBAAkB;;;;AAK/B,IAAa,QAAQ,UAA4C,OAAS,MAAM,KAAK;;;;AAKrF,IAAa,cAAc,WAAiC;CAAE,MAAM;CAAU;AAAM;;;;;AAMpF,IAAa,gBAAgB,SAA2B;CAAE,MAAM;CAAY;AAAI;;;;;;;;;;;AA0BhF,IAAa,aACX,OACA,YAAA,QAEiB,KACf,OAAO,SAAS,EAAE,SAChB,OAAO,WAAW;CAChB,WAAW,GAAG,WAAW,OAAO,OAAO;CACvC,QAAQ,UACN,iBAAiB,qBAA2B,iBAAiB,iBACzD,QACA,IAAI,eAAqB,EAAE,SAAS,SAAS,WAAW,UAAU,GAAG,EAAE,OAAO,MAAM,CAAC;AAC7F,CAAC,CACH,CACF,CAAC,CAAC,KAAK,OAAO,SAAS,gBAAgB,CAAC;;;;;;;;;;AAW1C,IAAa,QAAQ,SAAA,QACF,KACf,OAAO,SAAS,EAAE,SAChB,OAAO,WAAW;CAChB,WAAW,GAAG,SAAS,IAAI;CAC3B,QAAQ,UACN,iBAAiB,wBACb,QACA,IAAI,sBACF;EAAE,SAAS;EAAW,KAAK,KAAK;EAAI,QAAQ;CAAY,GACxD,EAAE,OAAO,MAAM,CACjB;AACR,CAAC,CACH,CACF,CAAC,CAAC,KAAK,OAAO,SAAS,WAAW,CAAC;;;;AAKrC,IAAa,UAAU,SAAA,QACJ,KAAK,OAAO,SAAS,EAAE,SAAS,OAAO,cAAc,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAC3F,OAAO,SAAS,aAAa,CAC/B;;;;;AAMF,IAAa,OAAO,SAAA,QACD,KACf,OAAO,SAAS,EAAE,SAAS,OAAO,cAAc,GAAG,WAAW,IAAI,CAAC,CAAC,GACpE,OAAO,IAAI,OAAO,aAAa,CACjC,CAAC,CAAC,KAAK,OAAO,SAAS,UAAU,CAAC"}
1
+ {"version":3,"file":"Blob.mjs","names":[],"sources":["../../src/Blob.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport { DXN } from '@dxos/keys';\n\nimport * as Annotation from './Annotation.ts';\nimport * as Database from './Database.ts';\nimport * as Error from './Error.ts';\nimport * as Obj from './Obj.ts';\nimport * as Type from './Type.ts';\n\n/**\n * Inline blob data: bytes stored directly on the ECHO object.\n */\nexport const InlineData = Schema.TaggedStruct('inline', {\n bytes: Schema.Uint8Array.annotate({ jsonSchema: { type: 'string', contentEncoding: 'base64' } }),\n});\n\n/**\n * External blob data: bytes stored by a registered blob backend, addressed by `uri`.\n */\nexport const ExternalData = Schema.TaggedStruct('external', {\n /**\n * URI locating the bytes. The scheme selects the backend at read time (e.g. `ni:///sha-256;…` for\n * the edge backend — an RFC 6920 content digest, not a backend name — or `wnfs://…` for the\n * plugin-wnfs extension), resolved via the scheme→backend map built from `registerBlobBackend`\n * calls. Core code never parses or constructs backend-specific URIs beyond reading the scheme.\n *\n * @see {@link https://www.rfc-editor.org/rfc/rfc6920 RFC 6920} for the `ni:` URI format.\n */\n uri: Schema.String,\n});\n\nexport const BlobData = Schema.Union([InlineData, ExternalData]);\nexport type BlobData = Schema.Schema.Type<typeof BlobData>;\n\n/**\n * Runtime schema for a Blob object.\n *\n * NOTE: This export shadows the DOM `Blob` global within modules that import it as a namespace.\n * Code that needs the DOM class should use `globalThis.Blob` explicitly.\n *\n * @example\n * ```ts\n * const blob = yield* Blob.fromBytes(bytes, { type: 'image/png' });\n * ```\n */\nexport class Blob extends Type.makeObject<Blob>(DXN.make('org.dxos.type.blob', '0.1.0'))(\n Schema.Struct({\n /** MIME type. */\n type: Schema.optional(Schema.String),\n size: Schema.Number,\n data: BlobData,\n }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--file--regular', hue: 'teal' })),\n) {}\n\n//\n// Storage constants\n//\n\n/**\n * Storage backend names, selected at write time via {@link FromBytesOptions.storage}. Call sites\n * always use these constants, never raw string literals. Extensions (e.g. plugin-wnfs) define\n * their own storage names in their own package — core code knows nothing of them.\n *\n * Distinct from {@link Scheme}: a storage name picks *where* to write, a URI scheme describes\n * *what the identifier is* at read time. They coincide for backends with no content-addressing\n * (e.g. wnfs uses `'wnfs'` for both), but the edge backend's storage name (`'edge'`) differs from\n * its URI scheme (`Scheme.ni`) because the identifier it produces is a content hash, not an\n * edge-specific address.\n */\nexport const Storage = { inline: 'inline', edge: 'edge' } as const;\nexport type Storage = (typeof Storage)[keyof typeof Storage];\n\n/**\n * URI schemes claimed by core backends (see `BlobBackend.schemes` in `@dxos/blob`).\n *\n * `ni` marks an {@link https://www.rfc-editor.org/rfc/rfc6920 RFC 6920} Named Information URI whose\n * authority is empty and whose path carries a registered hash-algorithm name plus a base64url-encoded\n * digest (e.g. `ni:///sha-256;UyaQNQIUxQKgg1jVMKMbg1Yr8Rrb2Y3RaOx2N0mVJhc`, produced by the edge\n * backend). The scheme names *what the identifier is* — a content digest over the complete blob —\n * not which backend wrote it, so any backend or cache that can resolve that digest may claim it.\n * The URI is an identity claim, not a retrievability promise; transport is selected by the registered\n * backend at read time.\n *\n * Extensions (e.g. plugin-wnfs) define their own schemes in their own package.\n */\nexport const Scheme = { ni: 'ni' } as const;\nexport type Scheme = (typeof Scheme)[keyof typeof Scheme];\n\n//\n// Factory\n//\n\nexport const MAX_INLINE_SIZE = 4 * 1024 * 1024;\n\n/**\n * Creates a new blob object. Does not add it to the database — see {@link fromBytes}.\n *\n * @performance O(1); allocates an in-memory blob object.\n */\nexport const make = (props: Obj.MakeProps<typeof Blob>): Blob => Obj.make(Blob, props);\n\n/**\n * Creates an inline {@link BlobData} variant that embeds raw bytes on the ECHO object.\n *\n * @performance O(1); wraps the bytes without copying.\n */\nexport const inlineData = (bytes: Uint8Array): BlobData => ({ _tag: 'inline', bytes });\n\n/**\n * Creates an external {@link BlobData} variant that references bytes held by a registered backend.\n * @param uri - Backend-scoped URI, e.g. as returned by a `BlobBackend.put` call.\n *\n * @performance O(1).\n */\nexport const externalData = (uri: string): BlobData => ({ _tag: 'external', uri });\n\nexport interface FromBytesOptions {\n /** MIME type. */\n type?: string;\n /**\n * Storage backend name. Defaults to the registry's configured default (initially `'inline'`;\n * `@dxos/client` marks `'edge'` as the default when configured).\n */\n storage?: Storage | (string & {});\n}\n\n//\n// Operations\n//\n\n/**\n * Hashes and uploads `bytes` via the chosen storage backend (a no-op for `inline`), returning an\n * un-added Blob object. The caller is responsible for adding it to the database.\n *\n * @example\n * ```ts\n * const blob = yield* Blob.fromBytes(bytes, { type: 'image/png' });\n * yield* Database.add(blob);\n * ```\n *\n * @performance Async; O(size) to hash, plus the backend upload (a no-op for inline storage).\n */\nexport const fromBytes = (\n bytes: Uint8Array,\n options?: FromBytesOptions,\n): Effect.Effect<Blob, Error.BlobTooLargeError | Error.BlobWriteError, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.tryPromise({\n try: () => db.createBlob(bytes, options),\n catch: (error) =>\n error instanceof Error.BlobTooLargeError || error instanceof Error.BlobWriteError\n ? error\n : new Error.BlobWriteError({ backend: options?.storage ?? 'unknown' }, { cause: error }),\n }),\n ),\n ).pipe(Effect.withSpan('Blob.fromBytes'));\n\n/**\n * Adopts bytes already staged by a direct upload, returning an un-added Blob object. The caller is\n * responsible for adding it to the database.\n *\n * The counterpart to {@link fromBytes} for content this process never holds: an agent uploaded the\n * file straight to the store over a signed URL, because passing it through a tool call would mean\n * a model emitting it byte by byte. Size and type are reported by the store, which is the only\n * party that saw what arrived.\n *\n * @example\n * ```ts\n * const blob = yield* Blob.fromUpload(uploadId);\n * yield* Database.add(blob);\n * ```\n *\n * @performance Async; one backend round trip, and the bytes never pass through this process.\n */\nexport const fromUpload = (\n uploadId: string,\n options?: { storage?: Storage | (string & {}) },\n): Effect.Effect<Blob, Error.BlobNotAvailableError | Error.BlobWriteError, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.tryPromise({\n try: () => db.createBlobFromUpload(uploadId, options),\n catch: (error) =>\n error instanceof Error.BlobNotAvailableError || error instanceof Error.BlobWriteError\n ? error\n : new Error.BlobWriteError({ backend: options?.storage ?? 'unknown' }, { cause: error }),\n }),\n ),\n ).pipe(Effect.withSpan('Blob.fromUpload'));\n\n/**\n * Loads a blob's bytes. Inline: read directly off the object. External: dispatched to the\n * registered backend for the URI's scheme.\n *\n * @example\n * ```ts\n * const bytes = yield* Blob.read(blob);\n * ```\n *\n * @performance Async; O(size), read inline or fetched from the backend.\n */\nexport const read = (blob: Blob): Effect.Effect<Uint8Array, Error.BlobNotAvailableError, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.tryPromise({\n try: () => db.readBlob(blob),\n catch: (error) =>\n error instanceof Error.BlobNotAvailableError\n ? error\n : new Error.BlobNotAvailableError(\n { backend: 'unknown', key: blob.id, reason: 'not-found' },\n { cause: error },\n ),\n }),\n ),\n ).pipe(Effect.withSpan('Blob.read'));\n\n/**\n * Checks whether a blob's bytes are currently available.\n *\n * @performance Async; one backend check, with no byte transfer.\n */\nexport const exists = (blob: Blob): Effect.Effect<boolean, never, Database.Service> =>\n Database.Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.blobExists(blob)))).pipe(\n Effect.withSpan('Blob.exists'),\n );\n\n/**\n * Returns a renderable URL for the blob: inline blobs resolve to a `data:` URL; external blobs\n * are resolved by the registered backend's `getUrl`, if it implements one.\n *\n * @performance Async; an inline blob encodes all of its bytes into a `data:` URL (O(size)), an external one asks the\n * backend.\n */\nexport const url = (blob: Blob): Effect.Effect<Option.Option<string>, never, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) => Effect.promise(() => db.getBlobUrl(blob))),\n Effect.map(Option.fromNullishOr),\n ).pipe(Effect.withSpan('Blob.url'));\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,aAAa,OAAO,aAAa,UAAU,EACtD,OAAO,OAAO,WAAW,SAAS,EAAE,YAAY;CAAE,MAAM;CAAU,iBAAiB;AAAS,EAAE,CAAC,EACjG,CAAC;;;;AAKD,IAAa,eAAe,OAAO,aAAa,YAAY;;;;;;;;;AAS1D,KAAK,OAAO,OACd,CAAC;AAED,IAAa,WAAW,OAAO,MAAM,CAAC,YAAY,YAAY,CAAC;;;;;;;;;;;;AAc/D,IAAa,OAAb,cAA0B,WAAsB,IAAI,KAAK,sBAAsB,OAAO,CAAC,CAAC,CACtF,OAAO,OAAO;;CAEZ,MAAM,OAAO,SAAS,OAAO,MAAM;CACnC,MAAM,OAAO;CACb,MAAM;AACR,CAAC,CAAC,CAAC,KAAA,eAA+B,IAAI;CAAE,MAAM;CAAqB,KAAK;AAAO,CAAC,CAAC,CACnF,CAAC,CAAC,CAAC;;;;;;;;;;;;AAiBH,IAAa,UAAU;CAAE,QAAQ;CAAU,MAAM;AAAO;;;;;;;;;;;;;;AAgBxD,IAAa,SAAS,EAAE,IAAI,KAAK;AAOjC,IAAa,kBAAkB;;;;;;AAO/B,IAAa,QAAQ,UAA4C,OAAS,MAAM,KAAK;;;;;;AAOrF,IAAa,cAAc,WAAiC;CAAE,MAAM;CAAU;AAAM;;;;;;;AAQpF,IAAa,gBAAgB,SAA2B;CAAE,MAAM;CAAY;AAAI;;;;;;;;;;;;;AA4BhF,IAAa,aACX,OACA,YAAA,QAEiB,KACf,OAAO,SAAS,EAAE,SAChB,OAAO,WAAW;CAChB,WAAW,GAAG,WAAW,OAAO,OAAO;CACvC,QAAQ,UACN,iBAAiB,qBAA2B,iBAAiB,iBACzD,QACA,IAAI,eAAqB,EAAE,SAAS,SAAS,WAAW,UAAU,GAAG,EAAE,OAAO,MAAM,CAAC;AAC7F,CAAC,CACH,CACF,CAAC,CAAC,KAAK,OAAO,SAAS,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;AAmB1C,IAAa,cACX,UACA,YAAA,QAEiB,KACf,OAAO,SAAS,EAAE,SAChB,OAAO,WAAW;CAChB,WAAW,GAAG,qBAAqB,UAAU,OAAO;CACpD,QAAQ,UACN,iBAAiB,yBAA+B,iBAAiB,iBAC7D,QACA,IAAI,eAAqB,EAAE,SAAS,SAAS,WAAW,UAAU,GAAG,EAAE,OAAO,MAAM,CAAC;AAC7F,CAAC,CACH,CACF,CAAC,CAAC,KAAK,OAAO,SAAS,iBAAiB,CAAC;;;;;;;;;;;;AAa3C,IAAa,QAAQ,SAAA,QACF,KACf,OAAO,SAAS,EAAE,SAChB,OAAO,WAAW;CAChB,WAAW,GAAG,SAAS,IAAI;CAC3B,QAAQ,UACN,iBAAiB,wBACb,QACA,IAAI,sBACF;EAAE,SAAS;EAAW,KAAK,KAAK;EAAI,QAAQ;CAAY,GACxD,EAAE,OAAO,MAAM,CACjB;AACR,CAAC,CACH,CACF,CAAC,CAAC,KAAK,OAAO,SAAS,WAAW,CAAC;;;;;;AAOrC,IAAa,UAAU,SAAA,QACJ,KAAK,OAAO,SAAS,EAAE,SAAS,OAAO,cAAc,GAAG,WAAW,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAC3F,OAAO,SAAS,aAAa,CAC/B;;;;;;;;AASF,IAAa,OAAO,SAAA,QACD,KACf,OAAO,SAAS,EAAE,SAAS,OAAO,cAAc,GAAG,WAAW,IAAI,CAAC,CAAC,GACpE,OAAO,IAAI,OAAO,aAAa,CACjC,CAAC,CAAC,KAAK,OAAO,SAAS,UAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import * as Schema from "effect/Schema";
3
+ //#region src/Change.ts
4
+ var Change_exports = /* @__PURE__ */ __exportAll({ Change: () => Change });
5
+ /**
6
+ * One change to a document, as {@link Filter.changes} returns it: a plain, frozen record, not an
7
+ * entity. It cannot be added to a database, referenced or mutated.
8
+ */
9
+ var Change = Schema.Struct({
10
+ /** Unique among a query's results: the Automerge change hash for a document change. */
11
+ key: Schema.String,
12
+ /** Where the change is stored; only documents report changes today. */
13
+ source: Schema.Literals(["document", "feed"]),
14
+ /** The author's clock when the change was made, unix ms. */
15
+ time: Schema.Number,
16
+ /** Writer that made the change; for a document change, an Automerge actor, which is a device, not a member. */
17
+ actor: Schema.String,
18
+ /** The actor's sequence number for this change. */
19
+ seq: Schema.Number,
20
+ /**
21
+ * Primitive writes in the change, at the storage's granularity: Automerge ops (a field set, a
22
+ * character inserted) for a document change; 1 for a feed block, which writes one whole object.
23
+ * Compare sums within one `source`.
24
+ */
25
+ ops: Schema.Number
26
+ });
27
+ //#endregion
28
+ export { Change, Change_exports as t };
29
+
30
+ //# sourceMappingURL=Change.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Change.mjs","names":[],"sources":["../../src/Change.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport type * as Query from './Query.ts';\n\n/**\n * One change to a document, as {@link Filter.changes} returns it: a plain, frozen record, not an\n * entity. It cannot be added to a database, referenced or mutated.\n */\nexport const Change = Schema.Struct({\n /** Unique among a query's results: the Automerge change hash for a document change. */\n key: Schema.String,\n /** Where the change is stored; only documents report changes today. */\n source: Schema.Literals(['document', 'feed']),\n /** The author's clock when the change was made, unix ms. */\n time: Schema.Number,\n /** Writer that made the change; for a document change, an Automerge actor, which is a device, not a member. */\n actor: Schema.String,\n /** The actor's sequence number for this change. */\n seq: Schema.Number,\n /**\n * Primitive writes in the change, at the storage's granularity: Automerge ops (a field set, a\n * character inserted) for a document change; 1 for a feed block, which writes one whole object.\n * Compare sums within one `source`.\n */\n ops: Schema.Number,\n});\n\n/** The metadata every change carries, whether it is a query row or an object's history entry. */\nexport type Metadata = Schema.Schema.Type<typeof Change>;\n\n/**\n * One change to an object, as {@link Obj.getChanges} returns it: the document change's metadata plus\n * the value the change touched, as it read before and after. A plain, frozen record, not an entity.\n */\nexport interface ValueChange<T> extends Metadata {\n /** Id of the object the change touched. */\n readonly object: string;\n /** The property the history was filtered to, when {@link Obj.getChanges} was given one. */\n readonly property?: string;\n /** The document's frontier once the change applied; `Obj.getVersion(obj, heads)` reads the object as it left it. */\n readonly heads: readonly string[];\n /** The writer's commit message, if it gave one. */\n readonly message?: string;\n /** The value before the change; `undefined` where the object (or property) did not exist yet. */\n readonly before: T | undefined;\n /** The value after the change; `undefined` where the change removed the property. */\n readonly after: T | undefined;\n}\n\n/**\n * A change: with no type argument, one row of a {@link Filter.changes} query; with a type argument,\n * one entry of an object's history ({@link ValueChange}) whose `before`/`after` hold that type.\n */\nexport type Change<T = never> = [T] extends [never] ? Metadata & Query.RecordResult : ValueChange<T>;\n"],"mappings":";;;;;;;;AAcA,IAAa,SAAS,OAAO,OAAO;;CAElC,KAAK,OAAO;;CAEZ,QAAQ,OAAO,SAAS,CAAC,YAAY,MAAM,CAAC;;CAE5C,MAAM,OAAO;;CAEb,OAAO,OAAO;;CAEd,KAAK,OAAO;;;;;;CAMZ,KAAK,OAAO;AACd,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
- import { B as FormInputAnnotation, X as IconAnnotation } from "./chunk-Database.mjs";
2
+ import { gt as UserTypeAnnotation, q as FormInputAnnotation, tt as IconAnnotation, ut as SetParentAnnotation } from "./chunk-Database.mjs";
3
3
  import { makeObject } from "./Type.mjs";
4
4
  import { Ref } from "./Ref.mjs";
5
5
  import { Unknown, instanceOf, make as make$1 } from "./Obj.mjs";
@@ -8,25 +8,42 @@ import * as Schema from "effect/Schema";
8
8
  //#region src/Collection.ts
9
9
  var Collection_exports = /* @__PURE__ */ __exportAll({
10
10
  Collection: () => Collection,
11
+ ItemTag: () => ItemTag,
11
12
  isCollection: () => isCollection,
12
13
  make: () => make
13
14
  });
14
15
  /**
16
+ * {@link Annotation.UserType} tag for types made to live in a collection, which creating into a collection
17
+ * offers. Any user type can join a collection; untagged ones do so from the object itself.
18
+ */
19
+ var ItemTag = "org.dxos.tag.collectionItem";
20
+ /**
15
21
  * A an ordered set of objects.
16
22
  */
17
23
  var Collection = class extends makeObject(DXN.make("org.dxos.type.collection", "0.1.0"))(Schema.Struct({
18
24
  name: Schema.String.pipe(Schema.optional),
19
- objects: Schema.Array(Ref(Unknown)).pipe(FormInputAnnotation.set(false))
25
+ /** Members, in order. */
26
+ objects: Schema.Array(Ref(Unknown)).pipe(SetParentAnnotation.set({ override: false }), FormInputAnnotation.set(false))
20
27
  }).pipe(IconAnnotation.set({
21
28
  icon: "ph--folder--regular",
22
29
  hue: "indigo"
23
- }))) {};
30
+ }), UserTypeAnnotation.set({ tags: [ItemTag] }))) {};
31
+ /**
32
+ * Creates a new collection object.
33
+ *
34
+ * @performance O(n) in initial members; allocates an in-memory collection object.
35
+ */
24
36
  var make = (props = {}) => make$1(Collection, {
25
37
  objects: [],
26
38
  ...props
27
39
  });
40
+ /**
41
+ * Type guard for collections.
42
+ *
43
+ * @performance O(1) type-URI comparison with a typename fallback; no schema validation.
44
+ */
28
45
  var isCollection = instanceOf(Collection);
29
46
  //#endregion
30
- export { Collection, isCollection, make, Collection_exports as t };
47
+ export { Collection, ItemTag, isCollection, make, Collection_exports as t };
31
48
 
32
49
  //# sourceMappingURL=Collection.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Collection.mjs","names":[],"sources":["../../src/Collection.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN } from '@dxos/keys';\n\nimport * as Annotation from './Annotation';\nimport * as internal from './internal';\nimport * as Obj from './Obj';\nimport * as Ref from './Ref';\nimport * as Type from './Type';\n\n/**\n * A an ordered set of objects.\n */\nexport class Collection extends Type.makeObject<Collection>(DXN.make('org.dxos.type.collection', '0.1.0'))(\n Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n objects: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(internal.FormInputAnnotation.set(false)),\n }).pipe(Annotation.IconAnnotation.set({ icon: 'ph--folder--regular', hue: 'indigo' })),\n) {}\n\nexport const make = (props: Partial<Obj.MakeProps<typeof Collection>> = {}): Type.InstanceType<typeof Collection> =>\n Obj.make(Collection, { objects: [], ...props });\n\nexport const isCollection: (value: unknown) => value is Type.InstanceType<typeof Collection> =\n Obj.instanceOf(Collection);\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAa,aAAb,cAAgC,WAA4B,IAAI,KAAK,4BAA4B,OAAO,CAAC,CAAC,CACxG,OAAO,OAAO;CACZ,MAAM,OAAO,OAAO,KAAK,OAAO,QAAQ;CACxC,SAAS,OAAO,MAAM,IAAQ,OAAW,CAAC,CAAC,CAAC,KAAA,oBAAkC,IAAI,KAAK,CAAC;AAC1F,CAAC,CAAC,CAAC,KAAA,eAA+B,IAAI;CAAE,MAAM;CAAuB,KAAK;AAAS,CAAC,CAAC,CACvF,CAAC,CAAC,CAAC;AAEH,IAAa,QAAQ,QAAmD,CAAC,MACvE,OAAS,YAAY;CAAE,SAAS,CAAC;CAAG,GAAG;AAAM,CAAC;AAEhD,IAAa,eACX,WAAe,UAAU"}
1
+ {"version":3,"file":"Collection.mjs","names":[],"sources":["../../src/Collection.ts"],"sourcesContent":["//\n// Copyright 2024 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { DXN } from '@dxos/keys';\n\nimport * as Annotation from './Annotation.ts';\nimport * as internal from './internal/index.ts';\nimport * as Obj from './Obj.ts';\nimport * as Ref from './Ref.ts';\nimport * as Type from './Type.ts';\n\n/**\n * {@link Annotation.UserType} tag for types made to live in a collection, which creating into a collection\n * offers. Any user type can join a collection; untagged ones do so from the object itself.\n */\nexport const ItemTag = 'org.dxos.tag.collectionItem';\n\n/**\n * A an ordered set of objects.\n */\nexport class Collection extends Type.makeObject<Collection>(DXN.make('org.dxos.type.collection', '0.1.0'))(\n Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n /** Members, in order. */\n objects: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(\n Annotation.SetParent.set({ override: false }),\n internal.FormInputAnnotation.set(false),\n ),\n }).pipe(\n Annotation.IconAnnotation.set({ icon: 'ph--folder--regular', hue: 'indigo' }),\n Annotation.UserType.set({ tags: [ItemTag] }),\n ),\n) {}\n\n/**\n * Creates a new collection object.\n *\n * @performance O(n) in initial members; allocates an in-memory collection object.\n */\nexport const make = (props: Partial<Obj.MakeProps<typeof Collection>> = {}): Type.InstanceType<typeof Collection> =>\n Obj.make(Collection, { objects: [], ...props });\n\n/**\n * Type guard for collections.\n *\n * @performance O(1) type-URI comparison with a typename fallback; no schema validation.\n */\nexport const isCollection: (value: unknown) => value is Type.InstanceType<typeof Collection> =\n Obj.instanceOf(Collection);\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoBA,IAAa,UAAU;;;;AAKvB,IAAa,aAAb,cAAgC,WAA4B,IAAI,KAAK,4BAA4B,OAAO,CAAC,CAAC,CACxG,OAAO,OAAO;CACZ,MAAM,OAAO,OAAO,KAAK,OAAO,QAAQ;;CAExC,SAAS,OAAO,MAAM,IAAQ,OAAW,CAAC,CAAC,CAAC,KAAA,oBACrB,IAAI,EAAE,UAAU,MAAM,CAAC,GAAA,oBACf,IAAI,KAAK,CACxC;AACF,CAAC,CAAC,CAAC,KAAA,eACyB,IAAI;CAAE,MAAM;CAAuB,KAAK;AAAS,CAAC,GAAA,mBACxD,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAC7C,CACF,CAAC,CAAC,CAAC;;;;;;AAOH,IAAa,QAAQ,QAAmD,CAAC,MACvE,OAAS,YAAY;CAAE,SAAS,CAAC;CAAG,GAAG;AAAM,CAAC;;;;;;AAOhD,IAAa,eACX,WAAe,UAAU"}
@@ -1,2 +1,2 @@
1
- import { C as subscribeToSyncState, S as stats, _ as remove, a as add, b as runGarbageCollection, c as deleteFromFeed, d as isDatabase, f as layer, g as query, h as notAvailable, i as TypeId, l as flush, m as makeService, o as addType, p as load, r as Service, s as appendToFeed, t as Database, u as getSyncState, v as resolve, x as spaceId, y as retainObjects } from "./chunk-Database.mjs";
2
- export { Database, Service, TypeId, add, addType, appendToFeed, deleteFromFeed, flush, getSyncState, isDatabase, layer, load, makeService, notAvailable, query, remove, resolve, retainObjects, runGarbageCollection, spaceId, stats, subscribeToSyncState };
1
+ import { C as retainObjects, D as subscribeToSyncState, E as stats, O as withSpaceId, S as resolve, T as spaceId, _ as makeService, a as TraceEvents, b as query, c as addType, d as flush, f as getSyncState, g as makeRef, h as load, i as Service, l as appendToFeed, m as layer, o as TypeId, p as isDatabase, r as Origin, s as add, t as Database, u as deleteFromFeed, v as notAvailable, w as runGarbageCollection, x as remove, y as peek } from "./chunk-Database.mjs";
2
+ export { Database, Origin, Service, TraceEvents, TypeId, add, addType, appendToFeed, deleteFromFeed, flush, getSyncState, isDatabase, layer, load, makeRef, makeService, notAvailable, peek, query, remove, resolve, retainObjects, runGarbageCollection, spaceId, stats, subscribeToSyncState, withSpaceId };
@@ -17,6 +17,11 @@ var Dataset = Schema.Union([
17
17
  getSchema(Collection),
18
18
  getSchema(View)
19
19
  ]);
20
+ /**
21
+ * Type guard for datasets.
22
+ *
23
+ * @performance O(1); at most three type-URI comparisons.
24
+ */
20
25
  var isDataset = pipe(instanceOf(Feed), Predicate.or(instanceOf(Collection)), Predicate.or(instanceOf(View)));
21
26
  //#endregion
22
27
  export { Dataset, isDataset, Dataset_exports as t };
@@ -1 +1 @@
1
- {"version":3,"file":"Dataset.mjs","names":[],"sources":["../../src/Dataset.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { pipe } from 'effect/Function';\nimport * as Predicate from 'effect/Predicate';\nimport * as Schema from 'effect/Schema';\n\nimport * as Collection from './Collection';\nimport * as Feed from './Feed';\nimport * as Obj from './Obj';\nimport * as Type from './Type';\nimport * as View from './View';\n\n/**\n * Abstract set of objects, represented by a view, feed, or collection.\n * Schema-level union of the underlying type entities (rebuilt via\n * `Type.getSchema`) so this can still be consumed by Schema-side APIs such\n * as `Filter.type(...)` on a union.\n */\nexport type Dataset = Feed.Feed | Collection.Collection | View.View;\nexport const Dataset = Schema.Union([\n Type.getSchema(Feed.Feed),\n Type.getSchema(Collection.Collection),\n Type.getSchema(View.View),\n]);\n\nexport const isDataset: (value: unknown) => value is Dataset = pipe(\n Obj.instanceOf(Feed.Feed),\n Predicate.or(Obj.instanceOf(Collection.Collection)),\n Predicate.or(Obj.instanceOf(View.View)),\n);\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAa,UAAU,OAAO,MAAM;CAClC,UAAe,IAAS;CACxB,UAAe,UAAqB;CACpC,UAAe,IAAS;AAC1B,CAAC;AAED,IAAa,YAAkD,KAC7D,WAAe,IAAS,GACxB,UAAU,GAAG,WAAe,UAAqB,CAAC,GAClD,UAAU,GAAG,WAAe,IAAS,CAAC,CACxC"}
1
+ {"version":3,"file":"Dataset.mjs","names":[],"sources":["../../src/Dataset.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { pipe } from 'effect/Function';\nimport * as Predicate from 'effect/Predicate';\nimport * as Schema from 'effect/Schema';\n\nimport * as Collection from './Collection.ts';\nimport * as Feed from './Feed.ts';\nimport * as Obj from './Obj.ts';\nimport * as Type from './Type.ts';\nimport * as View from './View.ts';\n\n/**\n * Abstract set of objects, represented by a view, feed, or collection.\n * Schema-level union of the underlying type entities (rebuilt via\n * `Type.getSchema`) so this can still be consumed by Schema-side APIs such\n * as `Filter.type(...)` on a union.\n */\nexport type Dataset = Feed.Feed | Collection.Collection | View.View;\nexport const Dataset = Schema.Union([\n Type.getSchema(Feed.Feed),\n Type.getSchema(Collection.Collection),\n Type.getSchema(View.View),\n]);\n\n/**\n * Type guard for datasets.\n *\n * @performance O(1); at most three type-URI comparisons.\n */\nexport const isDataset: (value: unknown) => value is Dataset = pipe(\n Obj.instanceOf(Feed.Feed),\n Predicate.or(Obj.instanceOf(Collection.Collection)),\n Predicate.or(Obj.instanceOf(View.View)),\n);\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAa,UAAU,OAAO,MAAM;CAClC,UAAe,IAAS;CACxB,UAAe,UAAqB;CACpC,UAAe,IAAS;AAC1B,CAAC;;;;;;AAOD,IAAa,YAAkD,KAC7D,WAAe,IAAS,GACxB,UAAU,GAAG,WAAe,UAAqB,CAAC,GAClD,UAAU,GAAG,WAAe,IAAS,CAAC,CACxC"}