@dxos/echo 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (539) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/neutral/Annotation.mjs +8 -3
  3. package/dist/lib/neutral/Database.mjs +36 -6
  4. package/dist/lib/neutral/Entity.mjs +18 -10
  5. package/dist/lib/neutral/Err.mjs +3 -1
  6. package/dist/lib/neutral/Extension.mjs +18 -0
  7. package/dist/lib/neutral/Extension.mjs.map +7 -0
  8. package/dist/lib/neutral/Feed.mjs +45 -0
  9. package/dist/lib/neutral/Feed.mjs.map +7 -0
  10. package/dist/lib/neutral/Filter.mjs +19 -10
  11. package/dist/lib/neutral/Format.mjs +3 -3
  12. package/dist/lib/neutral/JsonSchema.mjs +9 -9
  13. package/dist/lib/neutral/Obj.mjs +35 -15
  14. package/dist/lib/neutral/Order.mjs +1 -1
  15. package/dist/lib/neutral/Query.mjs +21 -9
  16. package/dist/lib/neutral/Ref.mjs +9 -7
  17. package/dist/lib/neutral/Relation.mjs +20 -11
  18. package/dist/lib/neutral/SchemaRegistry.mjs +1 -1
  19. package/dist/lib/neutral/Tag.mjs +13 -10
  20. package/dist/lib/neutral/Type.mjs +13 -23
  21. package/dist/lib/neutral/chunk-24XI6DOL.mjs +34 -0
  22. package/dist/lib/neutral/chunk-24XI6DOL.mjs.map +7 -0
  23. package/dist/lib/neutral/{chunk-VB5HVDCA.mjs → chunk-4YAAHG3E.mjs} +53 -5
  24. package/dist/lib/neutral/chunk-4YAAHG3E.mjs.map +7 -0
  25. package/dist/lib/neutral/{chunk-CUDIBUM4.mjs → chunk-4ZRIO2QF.mjs} +104 -25
  26. package/dist/lib/neutral/chunk-4ZRIO2QF.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-SU2LVM7J.mjs → chunk-7C2A2RP6.mjs} +1731 -2747
  28. package/dist/lib/neutral/chunk-7C2A2RP6.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-4L6DOFXP.mjs → chunk-BNCCGLJN.mjs} +1 -1
  30. package/dist/lib/neutral/{chunk-4L6DOFXP.mjs.map → chunk-BNCCGLJN.mjs.map} +1 -1
  31. package/dist/lib/neutral/{chunk-2MTHJ5UW.mjs → chunk-CAB5PWUF.mjs} +134 -24
  32. package/dist/lib/neutral/chunk-CAB5PWUF.mjs.map +7 -0
  33. package/dist/lib/neutral/{chunk-62DWJ6CE.mjs → chunk-DQYLD2RB.mjs} +14 -14
  34. package/dist/lib/neutral/chunk-DQYLD2RB.mjs.map +7 -0
  35. package/dist/lib/neutral/{chunk-XMIDBDE6.mjs → chunk-DUTD5HFU.mjs} +11 -56
  36. package/dist/lib/neutral/chunk-DUTD5HFU.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-EKQJGGA3.mjs +396 -0
  38. package/dist/lib/neutral/chunk-EKQJGGA3.mjs.map +7 -0
  39. package/dist/lib/neutral/{chunk-VR4A4WGG.mjs → chunk-EOIR5O5I.mjs} +72 -23
  40. package/dist/lib/neutral/chunk-EOIR5O5I.mjs.map +7 -0
  41. package/dist/lib/neutral/{chunk-HMOXCO27.mjs → chunk-GVY6O76A.mjs} +8 -3
  42. package/dist/lib/neutral/chunk-GVY6O76A.mjs.map +7 -0
  43. package/dist/lib/neutral/{chunk-4TT624YA.mjs → chunk-GZQTCRJB.mjs} +2 -2
  44. package/dist/lib/neutral/{chunk-4TT624YA.mjs.map → chunk-GZQTCRJB.mjs.map} +1 -1
  45. package/dist/lib/neutral/chunk-HGHJ36DH.mjs +117 -0
  46. package/dist/lib/neutral/chunk-HGHJ36DH.mjs.map +7 -0
  47. package/dist/lib/neutral/{chunk-3ZEAZF7T.mjs → chunk-IICPQK3M.mjs} +8 -4
  48. package/dist/lib/neutral/chunk-IICPQK3M.mjs.map +7 -0
  49. package/dist/lib/neutral/{chunk-IP2GHXWA.mjs → chunk-NKPWM67P.mjs} +5 -5
  50. package/dist/lib/neutral/chunk-NKPWM67P.mjs.map +7 -0
  51. package/dist/lib/neutral/{chunk-6QPSGMEF.mjs → chunk-OPMZTWI3.mjs} +32 -8
  52. package/dist/lib/neutral/chunk-OPMZTWI3.mjs.map +7 -0
  53. package/dist/lib/neutral/{chunk-NWUO5FKZ.mjs → chunk-OPQEHU36.mjs} +8 -2
  54. package/dist/lib/neutral/chunk-OPQEHU36.mjs.map +7 -0
  55. package/dist/lib/neutral/chunk-QDV7C7VM.mjs +299 -0
  56. package/dist/lib/neutral/chunk-QDV7C7VM.mjs.map +7 -0
  57. package/dist/lib/neutral/{chunk-YQYMWZAD.mjs → chunk-TBKX6JQO.mjs} +4 -4
  58. package/dist/lib/neutral/chunk-TBKX6JQO.mjs.map +7 -0
  59. package/dist/lib/neutral/{chunk-RPB6V4BE.mjs → chunk-UBEZSGXY.mjs} +14 -1
  60. package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
  61. package/dist/lib/neutral/{chunk-ROKO4RKJ.mjs → chunk-UI6MWK5W.mjs} +2 -2
  62. package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
  63. package/dist/lib/neutral/chunk-XV5R2XZH.mjs +133 -0
  64. package/dist/lib/neutral/chunk-XV5R2XZH.mjs.map +7 -0
  65. package/dist/lib/neutral/chunk-YPGDBRPH.mjs +159 -0
  66. package/dist/lib/neutral/chunk-YPGDBRPH.mjs.map +7 -0
  67. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs +50 -0
  68. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs.map +7 -0
  69. package/dist/lib/neutral/chunk-ZCBOJ6I7.mjs +787 -0
  70. package/dist/lib/neutral/chunk-ZCBOJ6I7.mjs.map +7 -0
  71. package/dist/lib/neutral/index.mjs +42 -25
  72. package/dist/lib/neutral/internal/index.mjs +56 -38
  73. package/dist/lib/neutral/meta.json +1 -1
  74. package/dist/lib/neutral/testing/index.mjs +42 -34
  75. package/dist/lib/neutral/testing/index.mjs.map +3 -3
  76. package/dist/types/src/Annotation.d.ts +23 -1
  77. package/dist/types/src/Annotation.d.ts.map +1 -1
  78. package/dist/types/src/Collection.d.ts +16 -0
  79. package/dist/types/src/Collection.d.ts.map +1 -0
  80. package/dist/types/src/Database.d.ts +86 -84
  81. package/dist/types/src/Database.d.ts.map +1 -1
  82. package/dist/types/src/Dataset.d.ts +19 -0
  83. package/dist/types/src/Dataset.d.ts.map +1 -0
  84. package/dist/types/src/Entity.d.ts +41 -15
  85. package/dist/types/src/Entity.d.ts.map +1 -1
  86. package/dist/types/src/Err.d.ts +43 -0
  87. package/dist/types/src/Err.d.ts.map +1 -1
  88. package/dist/types/src/Extension.d.ts +80 -0
  89. package/dist/types/src/Extension.d.ts.map +1 -0
  90. package/dist/types/src/Extension.test.d.ts +2 -0
  91. package/dist/types/src/Extension.test.d.ts.map +1 -0
  92. package/dist/types/src/Feed.d.ts +163 -0
  93. package/dist/types/src/Feed.d.ts.map +1 -0
  94. package/dist/types/src/Filter.d.ts +21 -5
  95. package/dist/types/src/Filter.d.ts.map +1 -1
  96. package/dist/types/src/Filter.test.d.ts +2 -0
  97. package/dist/types/src/Filter.test.d.ts.map +1 -0
  98. package/dist/types/src/Format.d.ts +3 -3
  99. package/dist/types/src/Format.d.ts.map +1 -1
  100. package/dist/types/src/Hypergraph.d.ts +8 -3
  101. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  102. package/dist/types/src/JsonSchema.d.ts +11 -4
  103. package/dist/types/src/JsonSchema.d.ts.map +1 -1
  104. package/dist/types/src/Obj.d.ts +158 -43
  105. package/dist/types/src/Obj.d.ts.map +1 -1
  106. package/dist/types/src/Order.d.ts.map +1 -1
  107. package/dist/types/src/Query.d.ts +109 -15
  108. package/dist/types/src/Query.d.ts.map +1 -1
  109. package/dist/types/src/Ref.d.ts +58 -10
  110. package/dist/types/src/Ref.d.ts.map +1 -1
  111. package/dist/types/src/Relation.d.ts +75 -28
  112. package/dist/types/src/Relation.d.ts.map +1 -1
  113. package/dist/types/src/SchemaRegistry.d.ts +4 -4
  114. package/dist/types/src/SchemaRegistry.d.ts.map +1 -1
  115. package/dist/types/src/Tag.d.ts +4 -3
  116. package/dist/types/src/Tag.d.ts.map +1 -1
  117. package/dist/types/src/Type.d.ts +51 -180
  118. package/dist/types/src/Type.d.ts.map +1 -1
  119. package/dist/types/src/View.d.ts +68 -0
  120. package/dist/types/src/View.d.ts.map +1 -0
  121. package/dist/types/src/hierarchy.test.d.ts +2 -0
  122. package/dist/types/src/hierarchy.test.d.ts.map +1 -0
  123. package/dist/types/src/index.d.ts +5 -0
  124. package/dist/types/src/index.d.ts.map +1 -1
  125. package/dist/types/src/internal/{annotations → Annotation}/annotations.d.ts +69 -8
  126. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
  127. package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
  128. package/dist/types/src/internal/Annotation/index.d.ts +4 -0
  129. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
  130. package/dist/types/src/internal/{api → Annotation}/sorting.d.ts +1 -1
  131. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
  132. package/dist/types/src/internal/{annotations → Annotation}/util.d.ts +13 -1
  133. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
  134. package/dist/types/src/internal/{api/entity.d.ts → Entity/api.d.ts} +2 -2
  135. package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
  136. package/dist/types/src/internal/{entities → Entity}/entity.d.ts +3 -3
  137. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
  138. package/dist/types/src/internal/{entities → Entity}/index.d.ts +2 -0
  139. package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
  140. package/dist/types/src/internal/{entities → Entity}/model.d.ts +4 -26
  141. package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
  142. package/dist/types/src/internal/{entities → Entity}/object.d.ts +2 -2
  143. package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
  144. package/dist/types/src/internal/{entities → Entity}/relation.d.ts +3 -30
  145. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
  146. package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
  147. package/dist/types/src/internal/{api → Entity}/version.d.ts +1 -1
  148. package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
  149. package/dist/types/src/internal/Format/date.d.ts.map +1 -0
  150. package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
  151. package/dist/types/src/internal/Format/format.d.ts.map +1 -0
  152. package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
  153. package/dist/types/src/internal/Format/index.d.ts.map +1 -0
  154. package/dist/types/src/internal/Format/number.d.ts.map +1 -0
  155. package/dist/types/src/internal/Format/object.d.ts.map +1 -0
  156. package/dist/types/src/internal/Format/select.d.ts.map +1 -0
  157. package/dist/types/src/internal/Format/string.d.ts.map +1 -0
  158. package/dist/types/src/internal/{formats → Format}/types.d.ts +1 -1
  159. package/dist/types/src/internal/Format/types.d.ts.map +1 -0
  160. package/dist/types/src/internal/{json-schema → JsonSchema}/annotations.d.ts +1 -1
  161. package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
  162. package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
  163. package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
  164. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
  165. package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +19 -19
  166. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
  167. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
  168. package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
  169. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
  170. package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
  171. package/dist/types/src/internal/{object → Obj}/create-object.d.ts +2 -2
  172. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
  173. package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
  174. package/dist/types/src/internal/{object → Obj}/deleted.d.ts +1 -1
  175. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
  176. package/dist/types/src/internal/Obj/ids.d.ts.map +1 -0
  177. package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
  178. package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
  179. package/dist/types/src/internal/{object → Obj}/json-serializer.d.ts +12 -5
  180. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
  181. package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
  182. package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
  183. package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
  184. package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
  185. package/dist/types/src/internal/{object → Obj}/set-value.d.ts +1 -1
  186. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
  187. package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
  188. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
  189. package/dist/types/src/internal/{object → Obj}/typed-object.d.ts +4 -4
  190. package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
  191. package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
  192. package/dist/types/src/internal/Query.d.ts +10 -0
  193. package/dist/types/src/internal/Query.d.ts.map +1 -0
  194. package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
  195. package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +1 -1
  196. package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
  197. package/dist/types/src/internal/{ref → Ref}/ref.d.ts +16 -3
  198. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
  199. package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
  200. package/dist/types/src/internal/{schema → Type}/compose.d.ts +1 -1
  201. package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
  202. package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
  203. package/dist/types/src/internal/{schema → Type}/echo-schema.d.ts +8 -7
  204. package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -0
  205. package/dist/types/src/internal/Type/index.d.ts.map +1 -0
  206. package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
  207. package/dist/types/src/internal/{schema → Type}/persistent-schema.d.ts +2 -2
  208. package/dist/types/src/internal/Type/persistent-schema.d.ts.map +1 -0
  209. package/dist/types/src/internal/{api → common/api}/index.d.ts +0 -4
  210. package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
  211. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
  212. package/dist/types/src/internal/common/index.d.ts +4 -0
  213. package/dist/types/src/internal/common/index.d.ts.map +1 -0
  214. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
  215. package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
  216. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
  217. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
  218. package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
  219. package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
  220. package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
  221. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
  222. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
  223. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
  224. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
  225. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
  226. package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
  227. package/dist/types/src/internal/{proxy → common/proxy}/reactive.d.ts +1 -1
  228. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
  229. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
  230. package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
  231. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
  232. package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.d.ts +2 -1
  233. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
  234. package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
  235. package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
  236. package/dist/types/src/internal/{types → common/types}/base.d.ts +1 -0
  237. package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
  238. package/dist/types/src/internal/{types → common/types}/entity.d.ts +2 -2
  239. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
  240. package/dist/types/src/internal/{types → common/types}/index.d.ts +1 -0
  241. package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
  242. package/dist/types/src/internal/{types → common/types}/meta.d.ts +2 -1
  243. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
  244. package/dist/types/src/internal/common/types/model-symbols.d.ts +54 -0
  245. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
  246. package/dist/types/src/internal/{types → common/types}/typename.d.ts +8 -0
  247. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
  248. package/dist/types/src/internal/{types → common/types}/version.d.ts +2 -2
  249. package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
  250. package/dist/types/src/internal/index.d.ts +9 -10
  251. package/dist/types/src/internal/index.d.ts.map +1 -1
  252. package/dist/types/src/testing/test-schema.d.ts +19 -18
  253. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  254. package/dist/types/tsconfig.tsbuildinfo +1 -1
  255. package/package.json +24 -14
  256. package/src/Annotation.ts +31 -1
  257. package/src/Collection.ts +37 -0
  258. package/src/Database.ts +167 -173
  259. package/src/Dataset.ts +26 -0
  260. package/src/Entity.ts +73 -54
  261. package/src/Err.ts +22 -0
  262. package/src/Extension.test.ts +235 -0
  263. package/src/Extension.ts +122 -0
  264. package/src/Feed.ts +268 -0
  265. package/src/Filter.test.ts +90 -0
  266. package/src/Filter.ts +55 -7
  267. package/src/Format.ts +3 -3
  268. package/src/Hypergraph.ts +9 -4
  269. package/src/JsonSchema.ts +14 -4
  270. package/src/Obj.test.ts +69 -8
  271. package/src/Obj.ts +285 -140
  272. package/src/Order.ts +3 -1
  273. package/src/Query.test.ts +248 -15
  274. package/src/Query.ts +275 -24
  275. package/src/Ref.ts +64 -11
  276. package/src/Relation.test.ts +8 -2
  277. package/src/Relation.ts +165 -131
  278. package/src/SchemaRegistry.ts +5 -4
  279. package/src/Tag.ts +6 -5
  280. package/src/Type.test.ts +10 -10
  281. package/src/Type.ts +70 -303
  282. package/src/View.ts +107 -0
  283. package/src/hierarchy.test.ts +33 -0
  284. package/src/index.ts +5 -0
  285. package/src/internal/{annotations → Annotation}/annotations.test.ts +56 -6
  286. package/src/internal/{annotations → Annotation}/annotations.ts +134 -15
  287. package/src/internal/{annotations → Annotation}/index.ts +1 -0
  288. package/src/internal/{api → Annotation}/sorting.ts +2 -3
  289. package/src/internal/{annotations → Annotation}/util.ts +14 -1
  290. package/src/internal/{api/entity.ts → Entity/api.ts} +4 -2
  291. package/src/internal/{entities → Entity}/entity.ts +6 -4
  292. package/src/internal/{entities → Entity}/index.ts +2 -0
  293. package/src/internal/{entities → Entity}/model.ts +17 -42
  294. package/src/internal/{entities → Entity}/object.ts +2 -2
  295. package/src/internal/{entities → Entity}/relation.ts +19 -36
  296. package/src/internal/{api → Entity}/version.ts +3 -2
  297. package/src/internal/{formats → Format}/date.test.ts +1 -1
  298. package/src/internal/{formats → Format}/format.test.ts +1 -1
  299. package/src/internal/{formats → Format}/types.ts +3 -3
  300. package/src/internal/{json-schema → JsonSchema}/annotations.ts +3 -3
  301. package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +4 -4
  302. package/src/internal/{json-schema → JsonSchema}/json-schema.test.ts +48 -48
  303. package/src/internal/{json-schema → JsonSchema}/json-schema.ts +6 -4
  304. package/src/internal/{object → Obj}/clone.ts +3 -3
  305. package/src/internal/{object → Obj}/common.ts +2 -2
  306. package/src/internal/{object → Obj}/create-object.test.ts +4 -4
  307. package/src/internal/{object → Obj}/create-object.ts +5 -5
  308. package/src/internal/{object → Obj}/deleted.ts +2 -2
  309. package/src/internal/{object → Obj}/inspect.ts +2 -2
  310. package/src/internal/{object → Obj}/json-serializer.test.ts +31 -8
  311. package/src/internal/{object → Obj}/json-serializer.ts +42 -15
  312. package/src/internal/{object → Obj}/schema-validator.ts +1 -1
  313. package/src/internal/{object → Obj}/set-value.test.ts +24 -24
  314. package/src/internal/{object → Obj}/set-value.ts +2 -2
  315. package/src/internal/Obj/snapshot.ts +105 -0
  316. package/src/internal/{object → Obj}/typed-object.test.ts +3 -3
  317. package/src/internal/{object → Obj}/typed-object.ts +4 -4
  318. package/src/internal/Query.ts +132 -0
  319. package/src/internal/{ref → Ref}/ref-array.ts +1 -1
  320. package/src/internal/{ref → Ref}/ref.test.ts +4 -4
  321. package/src/internal/{ref → Ref}/ref.ts +27 -4
  322. package/src/internal/{schema → Type}/compose.test.ts +5 -5
  323. package/src/internal/{schema → Type}/compose.ts +1 -1
  324. package/src/internal/{schema → Type}/echo-schema.ts +11 -10
  325. package/src/internal/{schema → Type}/manipulation.ts +1 -1
  326. package/src/internal/{schema → Type}/persistent-schema.ts +10 -4
  327. package/src/internal/{README.md → common/README.md} +1 -1
  328. package/src/internal/{api → common/api}/index.ts +0 -4
  329. package/src/internal/common/index.ts +7 -0
  330. package/src/internal/{proxy → common/proxy}/change.test.ts +58 -58
  331. package/src/internal/{proxy → common/proxy}/handler.test.ts +2 -2
  332. package/src/internal/{proxy → common/proxy}/json-serializer.ts +6 -3
  333. package/src/internal/{proxy → common/proxy}/make-object.ts +13 -3
  334. package/src/internal/{proxy → common/proxy}/reactive.ts +1 -1
  335. package/src/internal/{proxy → common/proxy}/schema.test.ts +10 -10
  336. package/src/internal/{proxy → common/proxy}/typed-handler.test.ts +6 -6
  337. package/src/internal/{proxy → common/proxy}/typed-handler.ts +10 -3
  338. package/src/internal/{proxy → common/proxy}/typed-object.test.ts +4 -4
  339. package/src/internal/{types → common/types}/base.ts +1 -1
  340. package/src/internal/{types → common/types}/entity.ts +2 -2
  341. package/src/internal/{types → common/types}/index.ts +1 -0
  342. package/src/internal/{types → common/types}/meta.ts +4 -1
  343. package/src/internal/common/types/model-symbols.ts +69 -0
  344. package/src/internal/{types → common/types}/typename.ts +10 -0
  345. package/src/internal/{types → common/types}/version.ts +2 -3
  346. package/src/internal/index.ts +9 -31
  347. package/src/testing/api.test.ts +4 -4
  348. package/src/testing/test-schema.ts +20 -18
  349. package/dist/lib/neutral/chunk-2MTHJ5UW.mjs.map +0 -7
  350. package/dist/lib/neutral/chunk-3ZEAZF7T.mjs.map +0 -7
  351. package/dist/lib/neutral/chunk-62DWJ6CE.mjs.map +0 -7
  352. package/dist/lib/neutral/chunk-6QPSGMEF.mjs.map +0 -7
  353. package/dist/lib/neutral/chunk-CUDIBUM4.mjs.map +0 -7
  354. package/dist/lib/neutral/chunk-HMOXCO27.mjs.map +0 -7
  355. package/dist/lib/neutral/chunk-IP2GHXWA.mjs.map +0 -7
  356. package/dist/lib/neutral/chunk-KRHDMXSU.mjs +0 -132
  357. package/dist/lib/neutral/chunk-KRHDMXSU.mjs.map +0 -7
  358. package/dist/lib/neutral/chunk-NWUO5FKZ.mjs.map +0 -7
  359. package/dist/lib/neutral/chunk-ROKO4RKJ.mjs.map +0 -7
  360. package/dist/lib/neutral/chunk-RPB6V4BE.mjs.map +0 -7
  361. package/dist/lib/neutral/chunk-SU2LVM7J.mjs.map +0 -7
  362. package/dist/lib/neutral/chunk-VB5HVDCA.mjs.map +0 -7
  363. package/dist/lib/neutral/chunk-VR4A4WGG.mjs.map +0 -7
  364. package/dist/lib/neutral/chunk-X2MPMYYN.mjs +0 -13
  365. package/dist/lib/neutral/chunk-X2MPMYYN.mjs.map +0 -7
  366. package/dist/lib/neutral/chunk-XK5OUUBY.mjs +0 -157
  367. package/dist/lib/neutral/chunk-XK5OUUBY.mjs.map +0 -7
  368. package/dist/lib/neutral/chunk-XMIDBDE6.mjs.map +0 -7
  369. package/dist/lib/neutral/chunk-YQYMWZAD.mjs.map +0 -7
  370. package/dist/types/src/internal/annotations/annotations.d.ts.map +0 -1
  371. package/dist/types/src/internal/annotations/annotations.test.d.ts.map +0 -1
  372. package/dist/types/src/internal/annotations/index.d.ts +0 -3
  373. package/dist/types/src/internal/annotations/index.d.ts.map +0 -1
  374. package/dist/types/src/internal/annotations/util.d.ts.map +0 -1
  375. package/dist/types/src/internal/api/annotations.d.ts +0 -23
  376. package/dist/types/src/internal/api/annotations.d.ts.map +0 -1
  377. package/dist/types/src/internal/api/entity.d.ts.map +0 -1
  378. package/dist/types/src/internal/api/index.d.ts.map +0 -1
  379. package/dist/types/src/internal/api/meta.d.ts.map +0 -1
  380. package/dist/types/src/internal/api/sorting.d.ts.map +0 -1
  381. package/dist/types/src/internal/api/version.d.ts.map +0 -1
  382. package/dist/types/src/internal/entities/entity.d.ts.map +0 -1
  383. package/dist/types/src/internal/entities/index.d.ts.map +0 -1
  384. package/dist/types/src/internal/entities/model.d.ts.map +0 -1
  385. package/dist/types/src/internal/entities/object.d.ts.map +0 -1
  386. package/dist/types/src/internal/entities/relation.d.ts.map +0 -1
  387. package/dist/types/src/internal/entities/util.d.ts.map +0 -1
  388. package/dist/types/src/internal/formats/date.d.ts.map +0 -1
  389. package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
  390. package/dist/types/src/internal/formats/format.d.ts.map +0 -1
  391. package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
  392. package/dist/types/src/internal/formats/index.d.ts.map +0 -1
  393. package/dist/types/src/internal/formats/number.d.ts.map +0 -1
  394. package/dist/types/src/internal/formats/object.d.ts.map +0 -1
  395. package/dist/types/src/internal/formats/select.d.ts.map +0 -1
  396. package/dist/types/src/internal/formats/string.d.ts.map +0 -1
  397. package/dist/types/src/internal/formats/types.d.ts.map +0 -1
  398. package/dist/types/src/internal/json-schema/annotations.d.ts.map +0 -1
  399. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +0 -1
  400. package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
  401. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
  402. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
  403. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +0 -1
  404. package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +0 -1
  405. package/dist/types/src/internal/object/clone.d.ts.map +0 -1
  406. package/dist/types/src/internal/object/common.d.ts.map +0 -1
  407. package/dist/types/src/internal/object/create-object.d.ts.map +0 -1
  408. package/dist/types/src/internal/object/create-object.test.d.ts.map +0 -1
  409. package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
  410. package/dist/types/src/internal/object/ids.d.ts.map +0 -1
  411. package/dist/types/src/internal/object/index.d.ts.map +0 -1
  412. package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
  413. package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
  414. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
  415. package/dist/types/src/internal/object/schema-validator.d.ts +0 -2
  416. package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
  417. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
  418. package/dist/types/src/internal/object/set-value.d.ts.map +0 -1
  419. package/dist/types/src/internal/object/set-value.test.d.ts.map +0 -1
  420. package/dist/types/src/internal/object/snapshot.d.ts.map +0 -1
  421. package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
  422. package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
  423. package/dist/types/src/internal/proxy/change-context.d.ts.map +0 -1
  424. package/dist/types/src/internal/proxy/change.test.d.ts.map +0 -1
  425. package/dist/types/src/internal/proxy/define-hidden-property.d.ts.map +0 -1
  426. package/dist/types/src/internal/proxy/errors.d.ts.map +0 -1
  427. package/dist/types/src/internal/proxy/event-batch.d.ts.map +0 -1
  428. package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
  429. package/dist/types/src/internal/proxy/index.d.ts.map +0 -1
  430. package/dist/types/src/internal/proxy/json-serializer.d.ts.map +0 -1
  431. package/dist/types/src/internal/proxy/make-object.d.ts.map +0 -1
  432. package/dist/types/src/internal/proxy/ownership.d.ts.map +0 -1
  433. package/dist/types/src/internal/proxy/proxy-types.d.ts.map +0 -1
  434. package/dist/types/src/internal/proxy/proxy-utils.d.ts.map +0 -1
  435. package/dist/types/src/internal/proxy/reactive-array.d.ts.map +0 -1
  436. package/dist/types/src/internal/proxy/reactive.d.ts.map +0 -1
  437. package/dist/types/src/internal/proxy/schema-validator.d.ts.map +0 -1
  438. package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
  439. package/dist/types/src/internal/proxy/symbols.d.ts.map +0 -1
  440. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
  441. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
  442. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
  443. package/dist/types/src/internal/ref/index.d.ts.map +0 -1
  444. package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
  445. package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
  446. package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
  447. package/dist/types/src/internal/schema/compose.d.ts.map +0 -1
  448. package/dist/types/src/internal/schema/compose.test.d.ts.map +0 -1
  449. package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
  450. package/dist/types/src/internal/schema/index.d.ts.map +0 -1
  451. package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
  452. package/dist/types/src/internal/schema/persistent-schema.d.ts.map +0 -1
  453. package/dist/types/src/internal/types/base.d.ts.map +0 -1
  454. package/dist/types/src/internal/types/entity.d.ts.map +0 -1
  455. package/dist/types/src/internal/types/index.d.ts.map +0 -1
  456. package/dist/types/src/internal/types/meta.d.ts.map +0 -1
  457. package/dist/types/src/internal/types/typename.d.ts.map +0 -1
  458. package/dist/types/src/internal/types/version.d.ts.map +0 -1
  459. package/src/internal/api/annotations.ts +0 -60
  460. package/src/internal/object/snapshot.ts +0 -70
  461. /package/dist/types/src/internal/{annotations → Annotation}/annotations.test.d.ts +0 -0
  462. /package/dist/types/src/internal/{entities → Entity}/util.d.ts +0 -0
  463. /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
  464. /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
  465. /package/dist/types/src/internal/{formats → Format}/format.d.ts +0 -0
  466. /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
  467. /package/dist/types/src/internal/{formats → Format}/index.d.ts +0 -0
  468. /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
  469. /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
  470. /package/dist/types/src/internal/{formats → Format}/select.d.ts +0 -0
  471. /package/dist/types/src/internal/{formats → Format}/string.d.ts +0 -0
  472. /package/dist/types/src/internal/{json-schema → JsonSchema}/effect-schema.test.d.ts +0 -0
  473. /package/dist/types/src/internal/{json-schema → JsonSchema}/index.d.ts +0 -0
  474. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
  475. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.d.ts +0 -0
  476. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.test.d.ts +0 -0
  477. /package/dist/types/src/internal/{object → Obj}/clone.d.ts +0 -0
  478. /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
  479. /package/dist/types/src/internal/{object → Obj}/create-object.test.d.ts +0 -0
  480. /package/dist/types/src/internal/{object → Obj}/ids.d.ts +0 -0
  481. /package/dist/types/src/internal/{object → Obj}/index.d.ts +0 -0
  482. /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
  483. /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
  484. /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
  485. /package/dist/types/src/internal/{object → Obj}/set-value.test.d.ts +0 -0
  486. /package/dist/types/src/internal/{object → Obj}/snapshot.d.ts +0 -0
  487. /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
  488. /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
  489. /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
  490. /package/dist/types/src/internal/{schema → Type}/compose.test.d.ts +0 -0
  491. /package/dist/types/src/internal/{schema → Type}/index.d.ts +0 -0
  492. /package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -0
  493. /package/dist/types/src/internal/{api → common/api}/meta.d.ts +0 -0
  494. /package/dist/types/src/internal/{proxy → common/proxy}/change-context.d.ts +0 -0
  495. /package/dist/types/src/internal/{proxy → common/proxy}/change.test.d.ts +0 -0
  496. /package/dist/types/src/internal/{proxy → common/proxy}/define-hidden-property.d.ts +0 -0
  497. /package/dist/types/src/internal/{proxy → common/proxy}/errors.d.ts +0 -0
  498. /package/dist/types/src/internal/{proxy → common/proxy}/event-batch.d.ts +0 -0
  499. /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
  500. /package/dist/types/src/internal/{proxy → common/proxy}/index.d.ts +0 -0
  501. /package/dist/types/src/internal/{proxy → common/proxy}/json-serializer.d.ts +0 -0
  502. /package/dist/types/src/internal/{proxy → common/proxy}/make-object.d.ts +0 -0
  503. /package/dist/types/src/internal/{proxy → common/proxy}/ownership.d.ts +0 -0
  504. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-types.d.ts +0 -0
  505. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-utils.d.ts +0 -0
  506. /package/dist/types/src/internal/{proxy → common/proxy}/reactive-array.d.ts +0 -0
  507. /package/dist/types/src/internal/{proxy → common/proxy}/schema-validator.d.ts +0 -0
  508. /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
  509. /package/dist/types/src/internal/{proxy → common/proxy}/symbols.d.ts +0 -0
  510. /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
  511. /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
  512. /package/src/internal/{entities → Entity}/util.ts +0 -0
  513. /package/src/internal/{formats → Format}/date.ts +0 -0
  514. /package/src/internal/{formats → Format}/format.ts +0 -0
  515. /package/src/internal/{formats → Format}/index.ts +0 -0
  516. /package/src/internal/{formats → Format}/number.ts +0 -0
  517. /package/src/internal/{formats → Format}/object.ts +0 -0
  518. /package/src/internal/{formats → Format}/select.ts +0 -0
  519. /package/src/internal/{formats → Format}/string.ts +0 -0
  520. /package/src/internal/{json-schema → JsonSchema}/effect-schema.test.ts +0 -0
  521. /package/src/internal/{json-schema → JsonSchema}/index.ts +0 -0
  522. /package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +0 -0
  523. /package/src/internal/{object → Obj}/ids.ts +0 -0
  524. /package/src/internal/{object → Obj}/index.ts +0 -0
  525. /package/src/internal/{object → Obj}/schema-validator.test.ts +0 -0
  526. /package/src/internal/{ref → Ref}/index.ts +0 -0
  527. /package/src/internal/{schema → Type}/index.ts +0 -0
  528. /package/src/internal/{api → common/api}/meta.ts +0 -0
  529. /package/src/internal/{proxy → common/proxy}/change-context.ts +0 -0
  530. /package/src/internal/{proxy → common/proxy}/define-hidden-property.ts +0 -0
  531. /package/src/internal/{proxy → common/proxy}/errors.ts +0 -0
  532. /package/src/internal/{proxy → common/proxy}/event-batch.ts +0 -0
  533. /package/src/internal/{proxy → common/proxy}/index.ts +0 -0
  534. /package/src/internal/{proxy → common/proxy}/ownership.ts +0 -0
  535. /package/src/internal/{proxy → common/proxy}/proxy-types.ts +0 -0
  536. /package/src/internal/{proxy → common/proxy}/proxy-utils.ts +0 -0
  537. /package/src/internal/{proxy → common/proxy}/reactive-array.ts +0 -0
  538. /package/src/internal/{proxy → common/proxy}/schema-validator.ts +0 -0
  539. /package/src/internal/{proxy → common/proxy}/symbols.ts +0 -0
package/src/Type.test.ts CHANGED
@@ -11,42 +11,42 @@ import { TestSchema } from './testing';
11
11
  import * as Type from './Type';
12
12
 
13
13
  describe('Type', () => {
14
- describe('Type.Obj', () => {
14
+ describe('Obj.Unknown schema', () => {
15
15
  test('has SchemaKindId for schema type checking', ({ expect }) => {
16
16
  // Type.isObjectSchema uses SchemaKindId to check if a schema is an object schema.
17
- expect(Type.isObjectSchema(Type.Obj)).toBe(true);
17
+ expect(Type.isObjectSchema(Obj.Unknown)).toBe(true);
18
18
  expect(Type.isObjectSchema(TestSchema.Person)).toBe(true);
19
- expect(Type.isObjectSchema(Type.Relation)).toBe(false);
19
+ expect(Type.isObjectSchema(Relation.Unknown)).toBe(false);
20
20
  });
21
21
 
22
22
  test('Schema.is validates structural compatibility only', ({ expect }) => {
23
23
  // Schema.is does structural validation (has id field).
24
24
  // It accepts both ECHO objects and plain objects with compatible structure.
25
- expect(Schema.is(Type.Obj)({ id: 'plain-object' })).toBe(true);
25
+ expect(Schema.is(Obj.Unknown)({ id: 'plain-object' })).toBe(true);
26
26
  const obj = Obj.make(TestSchema.Person, { name: 'Test' });
27
- expect(Schema.is(Type.Obj)(obj)).toBe(true);
27
+ expect(Schema.is(Obj.Unknown)(obj)).toBe(true);
28
28
  });
29
29
  });
30
30
 
31
- describe('Type.Relation', () => {
31
+ describe('Relation.Unknown schema', () => {
32
32
  test('has SchemaKindId for schema type checking', ({ expect }) => {
33
33
  // Type.isRelationSchema uses SchemaKindId to check if a schema is a relation schema.
34
- expect(Type.isRelationSchema(Type.Relation)).toBe(true);
34
+ expect(Type.isRelationSchema(Relation.Unknown)).toBe(true);
35
35
  expect(Type.isRelationSchema(TestSchema.HasManager)).toBe(true);
36
- expect(Type.isRelationSchema(Type.Obj)).toBe(false);
36
+ expect(Type.isRelationSchema(Obj.Unknown)).toBe(false);
37
37
  });
38
38
 
39
39
  test('Schema.is validates structural compatibility only', ({ expect }) => {
40
40
  // Schema.is does structural validation (has id field).
41
41
  // It accepts both ECHO relations and plain objects with compatible structure.
42
- expect(Schema.is(Type.Relation)({ id: 'plain-object' })).toBe(true);
42
+ expect(Schema.is(Relation.Unknown)({ id: 'plain-object' })).toBe(true);
43
43
  const obj1 = Obj.make(TestSchema.Person, { name: 'Alice' });
44
44
  const obj2 = Obj.make(TestSchema.Person, { name: 'Bob' });
45
45
  const rel = Relation.make(TestSchema.HasManager, {
46
46
  [Relation.Source]: obj1,
47
47
  [Relation.Target]: obj2,
48
48
  });
49
- expect(Schema.is(Type.Relation)(rel)).toBe(true);
49
+ expect(Schema.is(Relation.Unknown)(rel)).toBe(true);
50
50
  });
51
51
  });
52
52
  });
package/src/Type.ts CHANGED
@@ -2,50 +2,30 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as Schema from 'effect/Schema';
5
+ // @import-as-namespace
6
+
7
+ import type * as Schema from 'effect/Schema';
6
8
 
7
9
  import { type EncodedReference } from '@dxos/echo-protocol';
8
10
  import { invariant } from '@dxos/invariant';
9
- import { type DXN, type ObjectId } from '@dxos/keys';
11
+ import { type DXN } from '@dxos/keys';
10
12
  import { type ToMutable } from '@dxos/util';
11
13
 
12
- import type * as Entity$ from './Entity';
13
- import {
14
- ANY_OBJECT_TYPENAME,
15
- ANY_OBJECT_VERSION,
16
- type ATTR_RELATION_SOURCE,
17
- type ATTR_RELATION_TARGET,
18
- type AnyEntity,
19
- type AnyProperties,
20
- EchoObjectSchema,
21
- EchoRelationSchema,
22
- type EchoRelationSchemaOptions,
23
- EchoSchema,
24
- EntityKind,
25
- PersistentSchema,
26
- Ref as Ref$,
27
- type RefFn,
28
- type RefSchema,
29
- SchemaKindId,
30
- type TypeAnnotation,
31
- type TypeMeta,
32
- getSchemaDXN,
33
- getSchemaTypename,
34
- getSchemaVersion,
35
- getTypeAnnotation,
36
- isMutable as isMutable$,
37
- toEffectSchema,
38
- toJsonSchema,
39
- } from './internal';
40
- import type * as Relation$ from './Relation';
14
+ import type * as Entity from './Entity';
15
+ import * as typeInternal from './internal/Type';
16
+ import * as internal from './internal';
17
+ import type * as ObjModule from './Obj';
18
+ import type * as RelationModule from './Relation';
41
19
 
42
- // TODO(burdon): Remove toEffectSchema, toJsonSchema (moved to JsonSchema export).
43
- export { toEffectSchema, toJsonSchema };
20
+ /**
21
+ * Dynamic type that can be constructed, mutated, and persisted in the ECHO database.
22
+ */
23
+ export const RuntimeType = typeInternal.EchoSchema;
44
24
 
45
25
  /**
46
- * Returns all properties of an object or relation except for the id and kind.
26
+ * Dynamic type that can be constructed, mutated, and persisted in the ECHO database.
47
27
  */
48
- export type Properties<T = any> = Omit<T, 'id' | Entity$.KindId | Relation$.Source | Relation$.Target>;
28
+ export type RuntimeType = typeInternal.EchoSchema;
49
29
 
50
30
  //
51
31
  // Internal types (not exported)
@@ -55,83 +35,14 @@ export type Properties<T = any> = Omit<T, 'id' | Entity$.KindId | Relation$.Sour
55
35
  * Type that marks a schema as an ECHO schema.
56
36
  * The value indicates the entity kind (Object or Relation).
57
37
  */
58
- type EchoSchemaKind<K extends EntityKind = EntityKind> = {
59
- readonly [SchemaKindId]: K;
38
+ type EchoSchemaKind<K extends internal.EntityKind = internal.EntityKind> = {
39
+ readonly [internal.SchemaKindId]: K;
60
40
  };
61
41
 
62
- /**
63
- * JSON-encoded properties for objects.
64
- */
65
- interface ObjJsonProps {
66
- id: string;
67
- }
68
-
69
- /**
70
- * JSON-encoded properties for relations.
71
- */
72
- interface RelationJsonProps {
73
- id: string;
74
- [ATTR_RELATION_SOURCE]: string;
75
- [ATTR_RELATION_TARGET]: string;
76
- }
77
-
78
42
  //
79
43
  // Obj - Runtime schema for any ECHO object
80
44
  //
81
45
 
82
- // Internal type for the Obj schema constant.
83
- // NOTE: The `any` in the type intersection is intentional - it makes this type bidirectionally
84
- // assignable with specific object types (e.g., Type.Obj can be assigned to/from Meeting.Meeting).
85
- // This is needed because operation schemas erase type information.
86
- // TODO(wittjosiah): Consider alternatives to the `any` intersection hack:
87
- // - Generic operation schemas that preserve input type in output
88
- // - Branded types that specific schemas also carry
89
- // - Accept the limitation and require explicit type narrowing at call sites
90
- type ObjSchemaType = Schema.Schema<
91
- any & AnyEntity & Entity$.OfKind<typeof Entity$.Kind.Object> & AnyProperties,
92
- { id: string } & AnyProperties
93
- > &
94
- EchoSchemaKind<EntityKind.Object> &
95
- TypeMeta;
96
-
97
- // Internal schema definition.
98
- // NOTE: The EchoObjectSchema annotation is required for Type.Ref(Type.Obj) to work.
99
- // The typename/version only satisfy ECHO schema machinery for reference targets.
100
- const ObjSchema = Schema.Struct({
101
- id: Schema.String,
102
- }).pipe(
103
- Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),
104
- EchoObjectSchema({ typename: ANY_OBJECT_TYPENAME, version: ANY_OBJECT_VERSION }),
105
- );
106
-
107
- /**
108
- * Runtime Effect schema for any ECHO object.
109
- * Use for validation, parsing, or as a reference target for collections.
110
- *
111
- * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).
112
- * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.
113
- *
114
- * @example
115
- * ```ts
116
- * // Structural type guard (accepts any object with id field)
117
- * if (Schema.is(Type.Obj)(unknownValue)) { ... }
118
- *
119
- * // ECHO instance type guard (checks KindId brand)
120
- * if (Obj.isObject(unknownValue)) { ... }
121
- *
122
- * // Reference to any object type
123
- * const Collection = Schema.Struct({
124
- * objects: Schema.Array(Type.Ref(Type.Obj)),
125
- * }).pipe(Type.object({ typename: 'Collection', version: '0.1.0' }));
126
- * ```
127
- */
128
- // TODO(wittjosiah): Investigate if Schema.filter can validate KindId on ECHO instances.
129
- // Effect Schema normalizes proxy objects to plain objects before calling filter predicates.
130
- // Possible approaches: custom Schema.declare, AST manipulation, or upstream contribution.
131
- export const Obj: ObjSchemaType = Object.assign(ObjSchema, {
132
- [SchemaKindId]: (ObjSchema as any)[SchemaKindId],
133
- }) as unknown as ObjSchemaType;
134
-
135
46
  /**
136
47
  * TypeScript type for an ECHO object schema.
137
48
  * `T` is the instance type produced by the schema.
@@ -147,13 +58,14 @@ export const Obj: ObjSchemaType = Object.assign(ObjSchema, {
147
58
  * Object.keys(PersonSchema.fields); // ['name']
148
59
  * ```
149
60
  */
150
- export interface Obj<T = any, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>
151
- extends TypeMeta,
152
- EchoSchemaKind<EntityKind.Object>,
61
+ export interface Obj<T, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>
62
+ extends
63
+ internal.TypeMeta,
64
+ EchoSchemaKind<internal.EntityKind.Object>,
153
65
  Schema.AnnotableClass<
154
66
  Obj<T, Fields>,
155
- Entity$.OfKind<typeof Entity$.Kind.Object> & T,
156
- Schema.Simplify<ObjJsonProps & ToMutable<T>>,
67
+ Entity.OfKind<typeof Entity.Kind.Object> & T,
68
+ Schema.Simplify<ObjModule.BaseObjJson & ToMutable<T>>,
157
69
  never
158
70
  > {
159
71
  /**
@@ -174,13 +86,11 @@ type ObjectSchemaBase = Schema.Schema.AnyNoContext & {
174
86
  readonly version: string;
175
87
  };
176
88
 
177
- export namespace Obj {
178
- /**
179
- * Type that represents any ECHO object schema.
180
- * Accepts both static schemas (Type.object()) and mutable schemas (EchoSchema).
181
- */
182
- export type Any = ObjectSchemaBase;
183
- }
89
+ /**
90
+ * Type that represents any ECHO object schema.
91
+ * Accepts both static schemas (Type.object()) and mutable schemas (EchoSchema).
92
+ */
93
+ export type AnyObj = ObjectSchemaBase;
184
94
 
185
95
  /**
186
96
  * Factory function to create an ECHO object schema.
@@ -190,88 +100,35 @@ export namespace Obj {
190
100
  * ```ts
191
101
  * const Person = Schema.Struct({
192
102
  * name: Schema.String,
193
- * }).pipe(Type.object({ typename: 'example.com/type/Person', version: '0.1.0' }));
103
+ * }).pipe(Type.object({ typename: 'com.example.type.person', version: '0.1.0' }));
194
104
  * ```
195
105
  */
196
106
  export const object: {
197
- (opts: TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => Obj<Schema.Schema.Type<Self>>;
198
- } = EchoObjectSchema as any;
107
+ (opts: internal.TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => Obj<Schema.Schema.Type<Self>>;
108
+ } = internal.EchoObjectSchema as any;
199
109
 
200
110
  //
201
111
  // PersistentType (Schema stored in database)
202
112
  //
203
113
 
204
- export const PersistentType: Obj<PersistentSchema> = PersistentSchema as any;
114
+ export const PersistentType: Obj<typeInternal.PersistentSchema> = typeInternal.PersistentSchema as any;
205
115
 
206
116
  export interface PersistentType extends Schema.Schema.Type<typeof PersistentType> {}
207
117
 
208
- export { EchoSchema as RuntimeType };
209
-
210
- //
211
- // Relation - Runtime schema for any ECHO relation
212
- //
213
-
214
- // Internal type for the Relation schema constant.
215
- type RelationSchemaType = Schema.Schema<
216
- { id: ObjectId } & Record<string, unknown>,
217
- { id: string } & Record<string, unknown>
218
- > &
219
- EchoSchemaKind<EntityKind.Relation> &
220
- TypeMeta;
221
-
222
- // Internal schema definition.
223
- // NOTE: The EchoRelationSchema annotation is required for Type.Ref(Type.Relation) to work.
224
- // The typename/version/source/target only satisfy ECHO schema machinery for reference targets.
225
- const RelationSchema = Schema.Struct({
226
- id: Schema.String,
227
- }).pipe(
228
- Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),
229
- EchoRelationSchema({
230
- typename: 'dxos.org/schema/AnyRelation',
231
- version: '0.0.0',
232
- source: ObjSchema,
233
- target: ObjSchema,
234
- }),
235
- );
236
-
237
- /**
238
- * Runtime Effect schema for any ECHO relation.
239
- * Use for validation, parsing, or as a reference target for collections.
240
- * A relation has `id`, source, and target fields plus any additional properties.
241
- *
242
- * NOTE: `Schema.is(Type.Relation)` does STRUCTURAL validation only (checks for `id` field).
243
- * Use `Relation.isRelation()` for proper ECHO instance type guards that check the KindId brand.
244
- *
245
- * @example
246
- * ```ts
247
- * // Structural type guard (accepts any object with id field)
248
- * if (Schema.is(Type.Relation)(unknownValue)) { ... }
249
- *
250
- * // ECHO instance type guard (checks KindId brand)
251
- * if (Relation.isRelation(unknownValue)) { ... }
252
- * ```
253
- */
254
- export const Relation: RelationSchemaType = Object.assign(RelationSchema, {
255
- [SchemaKindId]: (RelationSchema as any)[SchemaKindId],
256
- }) as unknown as RelationSchemaType;
257
-
258
118
  /**
259
119
  * TypeScript type for an ECHO relation schema.
260
120
  * `T` is the instance type produced by the schema (excluding source/target).
261
121
  * `Source` and `Target` are the endpoint types.
262
122
  * `Fields` is the optional struct fields type for introspection.
263
123
  */
264
- export interface Relation<
265
- T = any,
266
- Source = any,
267
- Target = any,
268
- Fields extends Schema.Struct.Fields = Schema.Struct.Fields,
269
- > extends TypeMeta,
270
- EchoSchemaKind<EntityKind.Relation>,
124
+ export interface Relation<T, Source, Target, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>
125
+ extends
126
+ internal.TypeMeta,
127
+ EchoSchemaKind<internal.EntityKind.Relation>,
271
128
  Schema.AnnotableClass<
272
129
  Relation<T, Source, Target, Fields>,
273
- Entity$.OfKind<typeof Entity$.Kind.Relation> & Relation.Endpoints<Source, Target> & T,
274
- Schema.Simplify<RelationJsonProps & ToMutable<T>>,
130
+ Entity.OfKind<typeof Entity.Kind.Relation> & RelationModule.Endpoints<Source, Target> & T,
131
+ Schema.Simplify<RelationModule.BaseRelationJson & ToMutable<T>>,
275
132
  never
276
133
  > {
277
134
  /**
@@ -292,28 +149,11 @@ type RelationSchemaBase = Schema.Schema.AnyNoContext & {
292
149
  readonly version: string;
293
150
  };
294
151
 
295
- export namespace Relation {
296
- /**
297
- * Type that represents any ECHO relation schema.
298
- * Accepts static schemas (Type.relation()).
299
- */
300
- export type Any = RelationSchemaBase;
301
-
302
- /**
303
- * Get relation source type.
304
- */
305
- export type Source<A> = A extends Relation.Endpoints<infer S, infer _T> ? S : never;
306
-
307
- /**
308
- * Get relation target type.
309
- */
310
- export type Target<A> = A extends Relation.Endpoints<infer _S, infer T> ? T : never;
311
-
312
- export type Endpoints<Source, Target> = {
313
- [Relation$.Source]: Source;
314
- [Relation$.Target]: Target;
315
- };
316
- }
152
+ /**
153
+ * Type that represents any ECHO relation schema.
154
+ * Accepts static schemas (Type.relation()).
155
+ */
156
+ export type AnyRelation = RelationSchemaBase;
317
157
 
318
158
  /**
319
159
  * Factory function to create an ECHO relation schema.
@@ -324,7 +164,7 @@ export namespace Relation {
324
164
  * const WorksFor = Schema.Struct({
325
165
  * role: Schema.String,
326
166
  * }).pipe(Type.relation({
327
- * typename: 'example.com/type/WorksFor',
167
+ * typename: 'com.example.type.works-for',
328
168
  * version: '0.1.0',
329
169
  * source: Person,
330
170
  * target: Company,
@@ -333,112 +173,39 @@ export namespace Relation {
333
173
  */
334
174
  export const relation: {
335
175
  <SourceSchema extends Schema.Schema.AnyNoContext, TargetSchema extends Schema.Schema.AnyNoContext>(
336
- opts: EchoRelationSchemaOptions<SourceSchema, TargetSchema>,
176
+ opts: internal.EchoRelationSchemaOptions<SourceSchema, TargetSchema>,
337
177
  ): <Self extends Schema.Schema.Any>(
338
178
  self: Self,
339
179
  ) => Relation<Schema.Schema.Type<Self>, Schema.Schema.Type<SourceSchema>, Schema.Schema.Type<TargetSchema>>;
340
- } = EchoRelationSchema as any;
341
-
342
- //
343
- // Entity - Entity schema types (union of Object | Relation)
344
- //
180
+ } = internal.EchoRelationSchema as any;
345
181
 
346
- export namespace Entity {
347
- /**
348
- * Runtime Effect schema for any ECHO entity (object or relation).
349
- * Use for validation, parsing, or type guards on unknown values.
350
- *
351
- * @example
352
- * ```ts
353
- * if (Schema.is(Type.Entity.Any)(unknownValue)) {
354
- * // unknownValue is an ECHO entity
355
- * }
356
- * ```
357
- */
358
- export const Any: Schema.Schema<
359
- { id: ObjectId } & Record<string, unknown>,
360
- { id: string } & Record<string, unknown>
361
- > = Schema.Union(Obj, Relation);
362
-
363
- /**
364
- * Type alias for any ECHO entity schema (object or relation).
365
- * Use this in type annotations for schema parameters.
366
- */
367
- export type Any = Obj.Any | Relation.Any;
368
- }
182
+ /**
183
+ * Type alias for any ECHO entity schema (object or relation).
184
+ * Use this in type annotations for schema parameters.
185
+ */
186
+ export type AnyEntity = AnyObj | AnyRelation;
369
187
 
370
188
  /**
371
189
  * Type guard to check if a schema is an object schema.
372
190
  * NOTE: This checks SCHEMAS, not instances. Use Obj.isObject for instances.
373
191
  */
374
- export const isObjectSchema = (schema: Entity.Any): schema is Obj.Any => {
375
- return (schema as any)[SchemaKindId] === EntityKind.Object;
192
+ export const isObjectSchema = (schema: AnyEntity): schema is AnyObj => {
193
+ return (schema as any)[internal.SchemaKindId] === internal.EntityKind.Object;
376
194
  };
377
195
 
378
196
  /**
379
197
  * Type guard to check if a schema is a relation schema.
380
198
  * NOTE: This checks SCHEMAS, not instances. Use Relation.isRelation for instances.
381
199
  */
382
- export const isRelationSchema = (schema: Entity.Any): schema is Relation.Any => {
383
- return (schema as any)[SchemaKindId] === EntityKind.Relation;
200
+ export const isRelationSchema = (schema: AnyEntity): schema is AnyRelation => {
201
+ return (schema as any)[internal.SchemaKindId] === internal.EntityKind.Relation;
384
202
  };
385
203
 
386
- //
387
- // Ref
388
- //
389
- // NOTE: `Type.Ref` vs `Ref.Ref`:
390
- // - `Type.Ref<T>` is the SCHEMA type - a schema that produces `Ref.Ref<T>` instances.
391
- // - `Ref.Ref<T>` is the INSTANCE type - the actual runtime ref object.
392
- //
393
- // Example:
394
- // const taskRef: Ref.Ref<Task> = Ref.make(task); // Instance
395
- // const schema: Type.Ref<Task> = Type.Ref(Task); // Schema
396
- //
397
-
398
- /**
399
- * Return type of the `Ref` schema constructor.
400
- *
401
- * This typedef avoids `TS4023` error (name from external module cannot be used named).
402
- * See Effect's note on interface types.
403
- */
404
- export interface ref<TargetSchema extends Schema.Schema.Any> extends RefSchema<Schema.Schema.Type<TargetSchema>> {}
405
-
406
- /**
407
- * Factory function to create a Ref schema for the given target schema.
408
- * Use this in schema definitions to declare reference fields.
409
- *
410
- * @example
411
- * ```ts
412
- * const Task = Schema.Struct({
413
- * assignee: Type.Ref(Person), // Creates a Ref schema
414
- * }).pipe(Type.object({ typename: 'Task', version: '0.1.0' }));
415
- * ```
416
- */
417
- export const Ref: RefFn = Ref$;
418
-
419
204
  /**
420
- * TypeScript type for a Ref schema.
421
- * This is the type of the SCHEMA itself, not the runtime ref instance.
422
- * For the instance type, use `Ref.Ref<T>` from the Ref module.
423
- *
424
- * @example
425
- * ```ts
426
- * // Schema type annotation (rarely needed, usually inferred):
427
- * const refSchema: Type.Ref<Task> = Type.Ref(Task);
428
- *
429
- * // Instance type annotation (use Ref.Ref instead):
430
- * const refInstance: Ref.Ref<Task> = Ref.make(task);
431
- * ```
205
+ * Type that represents any Ref schema (with unknown target type).
206
+ * This is a schema type, not an instance type.
432
207
  */
433
- export interface Ref<T> extends Schema.SchemaClass<Ref$<T>, EncodedReference> {}
434
-
435
- export namespace Ref {
436
- /**
437
- * Type that represents any Ref schema (with unknown target type).
438
- * This is a schema type, not an instance type.
439
- */
440
- export type Any = Schema.Schema<Ref$<any>, EncodedReference>;
441
- }
208
+ export type AnyRef = Schema.Schema<internal.Ref<any>, EncodedReference>;
442
209
 
443
210
  //
444
211
  // Schema utility functions
@@ -447,19 +214,19 @@ export namespace Ref {
447
214
  /**
448
215
  * Gets the full DXN of the schema.
449
216
  * Will include the version if it's a `type` DXN.
450
- * @example "dxn:example.com/type/Person:0.1.0"
217
+ * @example "dxn:com.example.type.person:0.1.0"
451
218
  * @example "dxn:echo:SSSSSSSSSS:XXXXXXXXXXXXX"
452
219
  */
453
- export const getDXN = (schema: Entity.Any): DXN | undefined => {
454
- return getSchemaDXN(schema);
220
+ export const getDXN = (schema: AnyEntity): DXN | undefined => {
221
+ return internal.getSchemaDXN(schema);
455
222
  };
456
223
 
457
224
  /**
458
225
  * @param schema - Schema to get the typename from.
459
- * @returns The typename of the schema. Example: `example.com/type/Person`.
226
+ * @returns The typename of the schema. Example: `com.example.type.person`.
460
227
  */
461
- export const getTypename = (schema: Entity.Any): string => {
462
- const typename = getSchemaTypename(schema);
228
+ export const getTypename = (schema: AnyEntity): string => {
229
+ const typename = internal.getSchemaTypename(schema);
463
230
  invariant(typeof typename === 'string' && !typename.startsWith('dxn:'), 'Invalid typename');
464
231
  return typename;
465
232
  };
@@ -468,8 +235,8 @@ export const getTypename = (schema: Entity.Any): string => {
468
235
  * Gets the version of the schema.
469
236
  * @example 0.1.0
470
237
  */
471
- export const getVersion = (schema: Entity.Any): string => {
472
- const version = getSchemaVersion(schema);
238
+ export const getVersion = (schema: AnyEntity): string => {
239
+ const version = internal.getSchemaVersion(schema);
473
240
  invariant(typeof version === 'string' && version.match(/^\d+\.\d+\.\d+$/), 'Invalid version');
474
241
  return version;
475
242
  };
@@ -477,16 +244,16 @@ export const getVersion = (schema: Entity.Any): string => {
477
244
  /**
478
245
  * @returns True if the schema is mutable.
479
246
  */
480
- export const isMutable = isMutable$;
247
+ export const isMutable = typeInternal.isMutable;
481
248
 
482
249
  /**
483
250
  * ECHO type metadata.
484
251
  */
485
- export type Meta = TypeAnnotation;
252
+ export type Meta = internal.TypeAnnotation;
486
253
 
487
254
  /**
488
255
  * Gets the meta data of the schema.
489
256
  */
490
- export const getMeta = (schema: Entity.Any): Meta | undefined => {
491
- return getTypeAnnotation(schema);
257
+ export const getMeta = (schema: AnyEntity): Meta | undefined => {
258
+ return internal.getTypeAnnotation(schema);
492
259
  };
package/src/View.ts ADDED
@@ -0,0 +1,107 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // @import-as-namespace
6
+
7
+ import * as Schema from 'effect/Schema';
8
+
9
+ import { QueryAST } from '@dxos/echo-protocol';
10
+ import { JsonPath } from '@dxos/effect';
11
+ import { PublicKey } from '@dxos/keys';
12
+
13
+ import * as Filter from './Filter';
14
+ import * as internal from './internal';
15
+ import * as Obj from './Obj';
16
+ import * as Query from './Query';
17
+ import * as Type from './Type';
18
+ import * as Annotation from './Annotation';
19
+
20
+ /**
21
+ * Stored field metadata (e.g., for UX).
22
+ */
23
+ export const FieldSchema = Schema.Struct({
24
+ id: Schema.String,
25
+ path: JsonPath,
26
+ visible: Schema.optional(Schema.Boolean),
27
+
28
+ // TODO(wittjosiah): Presentation-specific?
29
+ referencePath: Schema.optional(JsonPath),
30
+ });
31
+
32
+ export type FieldType = Schema.Schema.Type<typeof FieldSchema>;
33
+
34
+ export const KeyValueProps = Schema.Record({ key: Schema.String, value: Schema.Any });
35
+
36
+ export const createFieldId = () => PublicKey.random().truncate();
37
+
38
+ export const Projection = Schema.Struct({
39
+ /**
40
+ * Optional schema override used to customize the underlying schema.
41
+ */
42
+ schema: internal.JsonSchemaType.pipe(Schema.optional),
43
+
44
+ /**
45
+ * UX metadata associated with displayed fields (in table, form, etc.)
46
+ */
47
+ // TODO(wittjosiah): Should this just be an array of JsonPath?
48
+ fields: Schema.Array(FieldSchema),
49
+
50
+ /**
51
+ * The id for the field used to pivot the view.
52
+ * E.g., the field to use for kanban columns or the field to use for map coordinates.
53
+ */
54
+ pivotFieldId: Schema.String.pipe(Schema.optional),
55
+ });
56
+
57
+ export type Projection = Schema.Schema.Type<typeof Projection>;
58
+
59
+ /**
60
+ * Views are generated or user-defined projections of a schema's properties.
61
+ * They are used to configure the visual representation of the data.
62
+ */
63
+ const ViewSchema = Schema.Struct({
64
+ /**
65
+ * Query used to retrieve data.
66
+ * Can be a user-provided query grammar string or a query AST.
67
+ */
68
+ query: Schema.Struct({
69
+ raw: Schema.optional(Schema.String),
70
+ ast: QueryAST.Query,
71
+ }),
72
+
73
+ /**
74
+ * Projection of the data returned from the query.
75
+ */
76
+ projection: Projection,
77
+ }).pipe(
78
+ Type.object({
79
+ typename: 'org.dxos.type.view',
80
+ version: '0.1.0',
81
+ }),
82
+ internal.SystemTypeAnnotation.set(true),
83
+ Annotation.IconAnnotation.set({
84
+ icon: 'ph--funnel--regular',
85
+ hue: 'green',
86
+ }),
87
+ );
88
+
89
+ export interface View extends Schema.Schema.Type<typeof ViewSchema> {}
90
+
91
+ /**
92
+ * View instance type.
93
+ */
94
+ // NOTE: This interface is explicitly defined rather than derived from the schema to avoid
95
+ // TypeScript "cannot be named" portability errors. The schema contains QueryAST.Query which
96
+ // references internal @dxos/echo-protocol module paths. Without this explicit interface,
97
+ // any schema using Ref.Ref(View) would inherit the non-portable type and fail to compile.
98
+ // TODO(wittjosiah): Find a better solution that doesn't require manually keeping the interface in sync.
99
+ export const View: Type.Obj<View> = ViewSchema as any;
100
+
101
+ export const make = (props: Partial<Obj.MakeProps<typeof View>>): View => {
102
+ return Obj.make(View, {
103
+ query: { ast: Query.select(Filter.nothing()).ast },
104
+ projection: { fields: [] },
105
+ ...props,
106
+ });
107
+ };