@dxos/echo 0.8.4-main.3a94e84 → 0.8.4-main.3c1ae3b

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 (478) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/browser/Annotation.mjs +31 -0
  3. package/dist/lib/browser/Annotation.mjs.map +7 -0
  4. package/dist/lib/browser/Database.mjs +14 -0
  5. package/dist/lib/browser/Database.mjs.map +7 -0
  6. package/dist/lib/browser/Entity.mjs +20 -0
  7. package/dist/lib/browser/Entity.mjs.map +7 -0
  8. package/dist/lib/browser/Err.mjs +11 -0
  9. package/dist/lib/browser/Err.mjs.map +7 -0
  10. package/dist/lib/browser/Filter.mjs +60 -0
  11. package/dist/lib/browser/Filter.mjs.map +7 -0
  12. package/dist/lib/browser/Format.mjs +67 -0
  13. package/dist/lib/browser/Format.mjs.map +7 -0
  14. package/dist/lib/browser/JsonSchema.mjs +18 -0
  15. package/dist/lib/browser/JsonSchema.mjs.map +7 -0
  16. package/dist/lib/browser/Key.mjs +13 -0
  17. package/dist/lib/browser/Key.mjs.map +7 -0
  18. package/dist/lib/browser/Obj.mjs +83 -0
  19. package/dist/lib/browser/Obj.mjs.map +7 -0
  20. package/dist/lib/browser/Order.mjs +11 -0
  21. package/dist/lib/browser/Order.mjs.map +7 -0
  22. package/dist/lib/browser/Query.mjs +25 -0
  23. package/dist/lib/browser/Query.mjs.map +7 -0
  24. package/dist/lib/browser/QueryResult.mjs +3 -0
  25. package/dist/lib/browser/QueryResult.mjs.map +7 -0
  26. package/dist/lib/browser/Ref.mjs +21 -0
  27. package/dist/lib/browser/Ref.mjs.map +7 -0
  28. package/dist/lib/browser/Relation.mjs +33 -0
  29. package/dist/lib/browser/Relation.mjs.map +7 -0
  30. package/dist/lib/browser/SchemaRegistry.mjs +3 -0
  31. package/dist/lib/browser/SchemaRegistry.mjs.map +7 -0
  32. package/dist/lib/browser/Tag.mjs +25 -0
  33. package/dist/lib/browser/Tag.mjs.map +7 -0
  34. package/dist/lib/browser/Type.mjs +38 -0
  35. package/dist/lib/browser/Type.mjs.map +7 -0
  36. package/dist/lib/browser/chunk-3B2G6BW4.mjs +74 -0
  37. package/dist/lib/browser/chunk-3B2G6BW4.mjs.map +7 -0
  38. package/dist/lib/browser/chunk-5IN7XBIQ.mjs +24 -0
  39. package/dist/lib/browser/chunk-5IN7XBIQ.mjs.map +7 -0
  40. package/dist/lib/browser/chunk-6XVZF5VJ.mjs +2924 -0
  41. package/dist/lib/browser/chunk-6XVZF5VJ.mjs.map +7 -0
  42. package/dist/lib/browser/chunk-AGOWBKY6.mjs +94 -0
  43. package/dist/lib/browser/chunk-AGOWBKY6.mjs.map +7 -0
  44. package/dist/lib/browser/chunk-BD6MRI4M.mjs +113 -0
  45. package/dist/lib/browser/chunk-BD6MRI4M.mjs.map +7 -0
  46. package/dist/lib/browser/chunk-CGS2ULMK.mjs +11 -0
  47. package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +7 -0
  48. package/dist/lib/browser/chunk-DOPKE2FQ.mjs +32 -0
  49. package/dist/lib/browser/chunk-DOPKE2FQ.mjs.map +7 -0
  50. package/dist/lib/browser/chunk-ESLW4N7S.mjs +41 -0
  51. package/dist/lib/browser/chunk-ESLW4N7S.mjs.map +7 -0
  52. package/dist/lib/browser/chunk-F4YF6C3O.mjs +363 -0
  53. package/dist/lib/browser/chunk-F4YF6C3O.mjs.map +7 -0
  54. package/dist/lib/browser/chunk-FGFQWIZE.mjs +9 -0
  55. package/dist/lib/browser/chunk-FGFQWIZE.mjs.map +7 -0
  56. package/dist/lib/browser/chunk-INHXFXY5.mjs +22 -0
  57. package/dist/lib/browser/chunk-INHXFXY5.mjs.map +7 -0
  58. package/dist/lib/browser/chunk-JG4GH6LN.mjs +9 -0
  59. package/dist/lib/browser/chunk-JG4GH6LN.mjs.map +7 -0
  60. package/dist/lib/browser/chunk-MYCCGG2T.mjs +15 -0
  61. package/dist/lib/browser/chunk-MYCCGG2T.mjs.map +7 -0
  62. package/dist/lib/browser/chunk-NFH3POTD.mjs +37 -0
  63. package/dist/lib/browser/chunk-NFH3POTD.mjs.map +7 -0
  64. package/dist/lib/browser/chunk-O6FOICWT.mjs +57 -0
  65. package/dist/lib/browser/chunk-O6FOICWT.mjs.map +7 -0
  66. package/dist/lib/browser/chunk-P2B4BASR.mjs +288 -0
  67. package/dist/lib/browser/chunk-P2B4BASR.mjs.map +7 -0
  68. package/dist/lib/browser/chunk-QHC3ZYNC.mjs +152 -0
  69. package/dist/lib/browser/chunk-QHC3ZYNC.mjs.map +7 -0
  70. package/dist/lib/browser/chunk-QU7PWSZD.mjs +62 -0
  71. package/dist/lib/browser/chunk-QU7PWSZD.mjs.map +7 -0
  72. package/dist/lib/browser/chunk-RP4JV7FD.mjs +403 -0
  73. package/dist/lib/browser/chunk-RP4JV7FD.mjs.map +7 -0
  74. package/dist/lib/browser/chunk-V7TON6BX.mjs +151 -0
  75. package/dist/lib/browser/chunk-V7TON6BX.mjs.map +7 -0
  76. package/dist/lib/browser/chunk-WABSVOOX.mjs +303 -0
  77. package/dist/lib/browser/chunk-WABSVOOX.mjs.map +7 -0
  78. package/dist/lib/browser/chunk-XRHHSMHJ.mjs +39 -0
  79. package/dist/lib/browser/chunk-XRHHSMHJ.mjs.map +7 -0
  80. package/dist/lib/browser/chunk-ZIM3Y4ZK.mjs +38 -0
  81. package/dist/lib/browser/chunk-ZIM3Y4ZK.mjs.map +7 -0
  82. package/dist/lib/browser/index.mjs +72 -9
  83. package/dist/lib/browser/internal/index.mjs +347 -0
  84. package/dist/lib/browser/internal/index.mjs.map +7 -0
  85. package/dist/lib/browser/meta.json +1 -1
  86. package/dist/lib/browser/testing/index.mjs +322 -32
  87. package/dist/lib/browser/testing/index.mjs.map +4 -4
  88. package/dist/lib/node-esm/Annotation.mjs +31 -0
  89. package/dist/lib/node-esm/Annotation.mjs.map +7 -0
  90. package/dist/lib/node-esm/Database.mjs +14 -0
  91. package/dist/lib/node-esm/Database.mjs.map +7 -0
  92. package/dist/lib/node-esm/Entity.mjs +20 -0
  93. package/dist/lib/node-esm/Entity.mjs.map +7 -0
  94. package/dist/lib/node-esm/Err.mjs +11 -0
  95. package/dist/lib/node-esm/Err.mjs.map +7 -0
  96. package/dist/lib/node-esm/Filter.mjs +60 -0
  97. package/dist/lib/node-esm/Filter.mjs.map +7 -0
  98. package/dist/lib/node-esm/Format.mjs +67 -0
  99. package/dist/lib/node-esm/Format.mjs.map +7 -0
  100. package/dist/lib/node-esm/JsonSchema.mjs +18 -0
  101. package/dist/lib/node-esm/JsonSchema.mjs.map +7 -0
  102. package/dist/lib/node-esm/Key.mjs +13 -0
  103. package/dist/lib/node-esm/Key.mjs.map +7 -0
  104. package/dist/lib/node-esm/Obj.mjs +83 -0
  105. package/dist/lib/node-esm/Obj.mjs.map +7 -0
  106. package/dist/lib/node-esm/Order.mjs +11 -0
  107. package/dist/lib/node-esm/Order.mjs.map +7 -0
  108. package/dist/lib/node-esm/Query.mjs +25 -0
  109. package/dist/lib/node-esm/Query.mjs.map +7 -0
  110. package/dist/lib/node-esm/QueryResult.mjs +3 -0
  111. package/dist/lib/node-esm/QueryResult.mjs.map +7 -0
  112. package/dist/lib/node-esm/Ref.mjs +21 -0
  113. package/dist/lib/node-esm/Ref.mjs.map +7 -0
  114. package/dist/lib/node-esm/Relation.mjs +33 -0
  115. package/dist/lib/node-esm/Relation.mjs.map +7 -0
  116. package/dist/lib/node-esm/SchemaRegistry.mjs +3 -0
  117. package/dist/lib/node-esm/SchemaRegistry.mjs.map +7 -0
  118. package/dist/lib/node-esm/Tag.mjs +25 -0
  119. package/dist/lib/node-esm/Tag.mjs.map +7 -0
  120. package/dist/lib/node-esm/Type.mjs +38 -0
  121. package/dist/lib/node-esm/Type.mjs.map +7 -0
  122. package/dist/lib/node-esm/chunk-5M5P2DCR.mjs +32 -0
  123. package/dist/lib/node-esm/chunk-5M5P2DCR.mjs.map +7 -0
  124. package/dist/lib/node-esm/chunk-6OTQZKHX.mjs +303 -0
  125. package/dist/lib/node-esm/chunk-6OTQZKHX.mjs.map +7 -0
  126. package/dist/lib/node-esm/chunk-76LEDWHO.mjs +152 -0
  127. package/dist/lib/node-esm/chunk-76LEDWHO.mjs.map +7 -0
  128. package/dist/lib/node-esm/chunk-AGHZH33D.mjs +9 -0
  129. package/dist/lib/node-esm/chunk-AGHZH33D.mjs.map +7 -0
  130. package/dist/lib/node-esm/chunk-AJEMYSIR.mjs +22 -0
  131. package/dist/lib/node-esm/chunk-AJEMYSIR.mjs.map +7 -0
  132. package/dist/lib/node-esm/chunk-BJACR7QG.mjs +363 -0
  133. package/dist/lib/node-esm/chunk-BJACR7QG.mjs.map +7 -0
  134. package/dist/lib/node-esm/chunk-BYL2NPEA.mjs +37 -0
  135. package/dist/lib/node-esm/chunk-BYL2NPEA.mjs.map +7 -0
  136. package/dist/lib/node-esm/chunk-CCMFPJUT.mjs +74 -0
  137. package/dist/lib/node-esm/chunk-CCMFPJUT.mjs.map +7 -0
  138. package/dist/lib/node-esm/chunk-D5BW7KHR.mjs +39 -0
  139. package/dist/lib/node-esm/chunk-D5BW7KHR.mjs.map +7 -0
  140. package/dist/lib/node-esm/chunk-DJX53IQ3.mjs +2924 -0
  141. package/dist/lib/node-esm/chunk-DJX53IQ3.mjs.map +7 -0
  142. package/dist/lib/node-esm/chunk-FWTPV5QD.mjs +94 -0
  143. package/dist/lib/node-esm/chunk-FWTPV5QD.mjs.map +7 -0
  144. package/dist/lib/node-esm/chunk-HLUDHPFO.mjs +403 -0
  145. package/dist/lib/node-esm/chunk-HLUDHPFO.mjs.map +7 -0
  146. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  147. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  148. package/dist/lib/node-esm/chunk-JYZSF62S.mjs +113 -0
  149. package/dist/lib/node-esm/chunk-JYZSF62S.mjs.map +7 -0
  150. package/dist/lib/node-esm/chunk-KUX5JEL2.mjs +57 -0
  151. package/dist/lib/node-esm/chunk-KUX5JEL2.mjs.map +7 -0
  152. package/dist/lib/node-esm/chunk-LDXRA5TC.mjs +288 -0
  153. package/dist/lib/node-esm/chunk-LDXRA5TC.mjs.map +7 -0
  154. package/dist/lib/node-esm/chunk-MOWUEW5P.mjs +15 -0
  155. package/dist/lib/node-esm/chunk-MOWUEW5P.mjs.map +7 -0
  156. package/dist/lib/node-esm/chunk-NHYOREKX.mjs +62 -0
  157. package/dist/lib/node-esm/chunk-NHYOREKX.mjs.map +7 -0
  158. package/dist/lib/node-esm/chunk-QVZZHCDS.mjs +9 -0
  159. package/dist/lib/node-esm/chunk-QVZZHCDS.mjs.map +7 -0
  160. package/dist/lib/node-esm/chunk-W3OLV7MG.mjs +41 -0
  161. package/dist/lib/node-esm/chunk-W3OLV7MG.mjs.map +7 -0
  162. package/dist/lib/node-esm/chunk-W5AQXKVF.mjs +38 -0
  163. package/dist/lib/node-esm/chunk-W5AQXKVF.mjs.map +7 -0
  164. package/dist/lib/node-esm/chunk-YNBFXTDG.mjs +24 -0
  165. package/dist/lib/node-esm/chunk-YNBFXTDG.mjs.map +7 -0
  166. package/dist/lib/node-esm/chunk-Z53QIBP2.mjs +151 -0
  167. package/dist/lib/node-esm/chunk-Z53QIBP2.mjs.map +7 -0
  168. package/dist/lib/node-esm/index.mjs +72 -9
  169. package/dist/lib/node-esm/internal/index.mjs +347 -0
  170. package/dist/lib/node-esm/internal/index.mjs.map +7 -0
  171. package/dist/lib/node-esm/meta.json +1 -1
  172. package/dist/lib/node-esm/testing/index.mjs +322 -32
  173. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  174. package/dist/types/src/Annotation.d.ts +2 -0
  175. package/dist/types/src/Annotation.d.ts.map +1 -0
  176. package/dist/types/src/Database.d.ts +179 -0
  177. package/dist/types/src/Database.d.ts.map +1 -0
  178. package/dist/types/src/Entity.d.ts +36 -0
  179. package/dist/types/src/Entity.d.ts.map +1 -0
  180. package/dist/types/src/Err.d.ts +68 -0
  181. package/dist/types/src/Err.d.ts.map +1 -0
  182. package/dist/types/src/Filter.d.ts +120 -0
  183. package/dist/types/src/Filter.d.ts.map +1 -0
  184. package/dist/types/src/Format.d.ts +4 -0
  185. package/dist/types/src/Format.d.ts.map +1 -0
  186. package/dist/types/src/Hypergraph.d.ts +60 -0
  187. package/dist/types/src/Hypergraph.d.ts.map +1 -0
  188. package/dist/types/src/JsonSchema.d.ts +9 -0
  189. package/dist/types/src/JsonSchema.d.ts.map +1 -0
  190. package/dist/types/src/Key.d.ts +1 -0
  191. package/dist/types/src/Key.d.ts.map +1 -1
  192. package/dist/types/src/Obj.d.ts +152 -35
  193. package/dist/types/src/Obj.d.ts.map +1 -1
  194. package/dist/types/src/Order.d.ts +11 -0
  195. package/dist/types/src/Order.d.ts.map +1 -0
  196. package/dist/types/src/Query.d.ts +107 -0
  197. package/dist/types/src/Query.d.ts.map +1 -0
  198. package/dist/types/src/Query.test.d.ts +2 -0
  199. package/dist/types/src/Query.test.d.ts.map +1 -0
  200. package/dist/types/src/QueryResult.d.ts +84 -0
  201. package/dist/types/src/QueryResult.d.ts.map +1 -0
  202. package/dist/types/src/Ref.d.ts +12 -10
  203. package/dist/types/src/Ref.d.ts.map +1 -1
  204. package/dist/types/src/Relation.d.ts +20 -14
  205. package/dist/types/src/Relation.d.ts.map +1 -1
  206. package/dist/types/src/SchemaRegistry.d.ts +73 -0
  207. package/dist/types/src/SchemaRegistry.d.ts.map +1 -0
  208. package/dist/types/src/Tag.d.ts +17 -0
  209. package/dist/types/src/Tag.d.ts.map +1 -0
  210. package/dist/types/src/Type.d.ts +39 -50
  211. package/dist/types/src/Type.d.ts.map +1 -1
  212. package/dist/types/src/index.d.ts +15 -3
  213. package/dist/types/src/index.d.ts.map +1 -1
  214. package/dist/types/src/internal/annotations/annotations.d.ts +179 -0
  215. package/dist/types/src/internal/annotations/annotations.d.ts.map +1 -0
  216. package/dist/types/src/internal/annotations/annotations.test.d.ts +2 -0
  217. package/dist/types/src/internal/annotations/annotations.test.d.ts.map +1 -0
  218. package/dist/types/src/internal/annotations/index.d.ts +3 -0
  219. package/dist/types/src/internal/annotations/index.d.ts.map +1 -0
  220. package/dist/types/src/internal/annotations/util.d.ts +27 -0
  221. package/dist/types/src/internal/annotations/util.d.ts.map +1 -0
  222. package/dist/types/src/internal/entities/entity.d.ts +10 -0
  223. package/dist/types/src/internal/entities/entity.d.ts.map +1 -0
  224. package/dist/types/src/internal/entities/expando.d.ts +16 -0
  225. package/dist/types/src/internal/entities/expando.d.ts.map +1 -0
  226. package/dist/types/src/internal/entities/index.d.ts +6 -0
  227. package/dist/types/src/internal/entities/index.d.ts.map +1 -0
  228. package/dist/types/src/internal/entities/model.d.ts +70 -0
  229. package/dist/types/src/internal/entities/model.d.ts.map +1 -0
  230. package/dist/types/src/internal/entities/object.d.ts +11 -0
  231. package/dist/types/src/internal/entities/object.d.ts.map +1 -0
  232. package/dist/types/src/internal/entities/relation.d.ts +55 -0
  233. package/dist/types/src/internal/entities/relation.d.ts.map +1 -0
  234. package/dist/types/src/internal/entities/util.d.ts +2 -0
  235. package/dist/types/src/internal/entities/util.d.ts.map +1 -0
  236. package/dist/types/src/internal/formats/date.d.ts +63 -0
  237. package/dist/types/src/internal/formats/date.d.ts.map +1 -0
  238. package/dist/types/src/internal/formats/date.test.d.ts +2 -0
  239. package/dist/types/src/internal/formats/date.test.d.ts.map +1 -0
  240. package/dist/types/src/internal/formats/format.d.ts +32 -0
  241. package/dist/types/src/internal/formats/format.d.ts.map +1 -0
  242. package/dist/types/src/internal/formats/format.test.d.ts +2 -0
  243. package/dist/types/src/internal/formats/format.test.d.ts.map +1 -0
  244. package/dist/types/src/internal/formats/index.d.ts +8 -0
  245. package/dist/types/src/internal/formats/index.d.ts.map +1 -0
  246. package/dist/types/src/internal/formats/number.d.ts +31 -0
  247. package/dist/types/src/internal/formats/number.d.ts.map +1 -0
  248. package/dist/types/src/internal/formats/object.d.ts +35 -0
  249. package/dist/types/src/internal/formats/object.d.ts.map +1 -0
  250. package/dist/types/src/internal/formats/select.d.ts +13 -0
  251. package/dist/types/src/internal/formats/select.d.ts.map +1 -0
  252. package/dist/types/src/internal/formats/string.d.ts +42 -0
  253. package/dist/types/src/internal/formats/string.d.ts.map +1 -0
  254. package/dist/types/src/internal/formats/types.d.ts +72 -0
  255. package/dist/types/src/internal/formats/types.d.ts.map +1 -0
  256. package/dist/types/src/internal/index.d.ts +11 -0
  257. package/dist/types/src/internal/index.d.ts.map +1 -0
  258. package/dist/types/src/internal/json-schema/annotations.d.ts +19 -0
  259. package/dist/types/src/internal/json-schema/annotations.d.ts.map +1 -0
  260. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts +2 -0
  261. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +1 -0
  262. package/dist/types/src/internal/json-schema/index.d.ts +5 -0
  263. package/dist/types/src/internal/json-schema/index.d.ts.map +1 -0
  264. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts +7 -0
  265. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -0
  266. package/dist/types/src/internal/json-schema/json-schema-type.d.ts +250 -0
  267. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -0
  268. package/dist/types/src/internal/json-schema/json-schema.d.ts +29 -0
  269. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +1 -0
  270. package/dist/types/src/internal/json-schema/json-schema.test.d.ts +2 -0
  271. package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +1 -0
  272. package/dist/types/src/internal/object/common.d.ts +18 -0
  273. package/dist/types/src/internal/object/common.d.ts.map +1 -0
  274. package/dist/types/src/internal/object/create-object.d.ts +39 -0
  275. package/dist/types/src/internal/object/create-object.d.ts.map +1 -0
  276. package/dist/types/src/internal/object/create-object.test.d.ts +2 -0
  277. package/dist/types/src/internal/object/create-object.test.d.ts.map +1 -0
  278. package/dist/types/src/internal/object/deleted.d.ts +6 -0
  279. package/dist/types/src/internal/object/deleted.d.ts.map +1 -0
  280. package/dist/types/src/internal/object/ids.d.ts +6 -0
  281. package/dist/types/src/internal/object/ids.d.ts.map +1 -0
  282. package/dist/types/src/internal/object/index.d.ts +8 -0
  283. package/dist/types/src/internal/object/index.d.ts.map +1 -0
  284. package/dist/types/src/internal/object/inspect.d.ts +2 -0
  285. package/dist/types/src/internal/object/inspect.d.ts.map +1 -0
  286. package/dist/types/src/internal/object/json-serializer.d.ts +31 -0
  287. package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -0
  288. package/dist/types/src/internal/object/json-serializer.test.d.ts +2 -0
  289. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +1 -0
  290. package/dist/types/src/internal/object/schema-validator.d.ts +15 -0
  291. package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -0
  292. package/dist/types/src/internal/object/schema-validator.test.d.ts +2 -0
  293. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +1 -0
  294. package/dist/types/src/internal/object/typed-object.d.ts +31 -0
  295. package/dist/types/src/internal/object/typed-object.d.ts.map +1 -0
  296. package/dist/types/src/internal/object/typed-object.test.d.ts +2 -0
  297. package/dist/types/src/internal/object/typed-object.test.d.ts.map +1 -0
  298. package/dist/types/src/internal/proxy/handler.test.d.ts +2 -0
  299. package/dist/types/src/internal/proxy/handler.test.d.ts.map +1 -0
  300. package/dist/types/src/internal/proxy/index.d.ts +3 -0
  301. package/dist/types/src/internal/proxy/index.d.ts.map +1 -0
  302. package/dist/types/src/internal/proxy/make-object.d.ts +16 -0
  303. package/dist/types/src/internal/proxy/make-object.d.ts.map +1 -0
  304. package/dist/types/src/internal/proxy/schema.test.d.ts +2 -0
  305. package/dist/types/src/internal/proxy/schema.test.d.ts.map +1 -0
  306. package/dist/types/src/internal/proxy/typed-handler.d.ts +44 -0
  307. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -0
  308. package/dist/types/src/internal/proxy/typed-handler.test.d.ts +2 -0
  309. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +1 -0
  310. package/dist/types/src/internal/proxy/typed-object.test.d.ts +2 -0
  311. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +1 -0
  312. package/dist/types/src/internal/ref/index.d.ts +3 -0
  313. package/dist/types/src/internal/ref/index.d.ts.map +1 -0
  314. package/dist/types/src/internal/ref/ref-array.d.ts +21 -0
  315. package/dist/types/src/internal/ref/ref-array.d.ts.map +1 -0
  316. package/dist/types/src/internal/ref/ref.d.ts +209 -0
  317. package/dist/types/src/internal/ref/ref.d.ts.map +1 -0
  318. package/dist/types/src/internal/ref/ref.test.d.ts +2 -0
  319. package/dist/types/src/internal/ref/ref.test.d.ts.map +1 -0
  320. package/dist/types/src/internal/schema/compose.d.ts +6 -0
  321. package/dist/types/src/internal/schema/compose.d.ts.map +1 -0
  322. package/dist/types/src/internal/schema/compose.test.d.ts +2 -0
  323. package/dist/types/src/internal/schema/compose.test.d.ts.map +1 -0
  324. package/dist/types/src/internal/schema/echo-schema.d.ts +168 -0
  325. package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -0
  326. package/dist/types/src/internal/schema/index.d.ts +5 -0
  327. package/dist/types/src/internal/schema/index.d.ts.map +1 -0
  328. package/dist/types/src/internal/schema/manipulation.d.ts +10 -0
  329. package/dist/types/src/internal/schema/manipulation.d.ts.map +1 -0
  330. package/dist/types/src/internal/schema/persistent-schema.d.ts +18 -0
  331. package/dist/types/src/internal/schema/persistent-schema.d.ts.map +1 -0
  332. package/dist/types/src/internal/schema/snapshot.d.ts +6 -0
  333. package/dist/types/src/internal/schema/snapshot.d.ts.map +1 -0
  334. package/dist/types/src/internal/types/base.d.ts +37 -0
  335. package/dist/types/src/internal/types/base.d.ts.map +1 -0
  336. package/dist/types/src/internal/types/entity.d.ts +12 -0
  337. package/dist/types/src/internal/types/entity.d.ts.map +1 -0
  338. package/dist/types/src/internal/types/index.d.ts +6 -0
  339. package/dist/types/src/internal/types/index.d.ts.map +1 -0
  340. package/dist/types/src/internal/types/meta.d.ts +40 -0
  341. package/dist/types/src/internal/types/meta.d.ts.map +1 -0
  342. package/dist/types/src/internal/types/typename.d.ts +13 -0
  343. package/dist/types/src/internal/types/typename.d.ts.map +1 -0
  344. package/dist/types/src/internal/types/version.d.ts +15 -0
  345. package/dist/types/src/internal/types/version.d.ts.map +1 -0
  346. package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
  347. package/dist/types/src/testing/index.d.ts +3 -1
  348. package/dist/types/src/testing/index.d.ts.map +1 -1
  349. package/dist/types/src/testing/test-data.d.ts +18 -0
  350. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  351. package/dist/types/src/testing/test-schema.d.ts +407 -0
  352. package/dist/types/src/testing/test-schema.d.ts.map +1 -0
  353. package/dist/types/src/testing/util.d.ts +16 -0
  354. package/dist/types/src/testing/util.d.ts.map +1 -0
  355. package/dist/types/tsconfig.tsbuildinfo +1 -1
  356. package/package.json +164 -33
  357. package/src/Annotation.ts +17 -0
  358. package/src/Database.ts +308 -0
  359. package/src/Entity.ts +51 -0
  360. package/src/Err.ts +18 -0
  361. package/src/Filter.ts +376 -0
  362. package/src/Format.ts +9 -0
  363. package/src/Hypergraph.ts +74 -0
  364. package/src/JsonSchema.ts +16 -0
  365. package/src/Key.ts +3 -0
  366. package/src/Obj.ts +407 -71
  367. package/src/Order.ts +34 -0
  368. package/src/Query.test.ts +346 -0
  369. package/src/Query.ts +279 -0
  370. package/src/QueryResult.ts +109 -0
  371. package/src/Ref.ts +25 -9
  372. package/src/Relation.ts +72 -46
  373. package/src/SchemaRegistry.ts +92 -0
  374. package/src/Tag.ts +40 -0
  375. package/src/Type.ts +98 -84
  376. package/src/index.ts +17 -4
  377. package/src/internal/README.md +87 -0
  378. package/src/internal/annotations/annotations.test.ts +96 -0
  379. package/src/internal/annotations/annotations.ts +488 -0
  380. package/src/internal/annotations/index.ts +6 -0
  381. package/src/internal/annotations/util.ts +72 -0
  382. package/src/internal/entities/entity.ts +109 -0
  383. package/src/internal/entities/expando.ts +23 -0
  384. package/src/internal/entities/index.ts +9 -0
  385. package/src/internal/entities/model.ts +129 -0
  386. package/src/internal/entities/object.ts +45 -0
  387. package/src/internal/entities/relation.ts +155 -0
  388. package/src/internal/entities/util.ts +33 -0
  389. package/src/internal/formats/date.test.ts +56 -0
  390. package/src/internal/formats/date.ts +217 -0
  391. package/src/internal/formats/format.test.ts +77 -0
  392. package/src/internal/formats/format.ts +54 -0
  393. package/src/internal/formats/index.ts +12 -0
  394. package/src/internal/formats/number.ts +89 -0
  395. package/src/internal/formats/object.ts +80 -0
  396. package/src/internal/formats/select.ts +18 -0
  397. package/src/internal/formats/string.ts +81 -0
  398. package/src/internal/formats/types.ts +186 -0
  399. package/src/internal/index.ts +38 -0
  400. package/src/internal/json-schema/annotations.ts +50 -0
  401. package/src/internal/json-schema/effect-schema.test.ts +143 -0
  402. package/src/internal/json-schema/index.ts +8 -0
  403. package/src/internal/json-schema/json-schema-normalize.ts +109 -0
  404. package/src/internal/json-schema/json-schema-type.ts +404 -0
  405. package/src/internal/json-schema/json-schema.test.ts +861 -0
  406. package/src/internal/json-schema/json-schema.ts +528 -0
  407. package/src/internal/object/common.ts +75 -0
  408. package/src/internal/object/create-object.test.ts +116 -0
  409. package/src/internal/object/create-object.ts +95 -0
  410. package/src/internal/object/deleted.ts +19 -0
  411. package/src/internal/object/ids.ts +12 -0
  412. package/src/internal/object/index.ts +11 -0
  413. package/src/internal/object/inspect.ts +46 -0
  414. package/src/internal/object/json-serializer.test.ts +94 -0
  415. package/src/internal/object/json-serializer.ts +230 -0
  416. package/src/internal/object/schema-validator.test.ts +186 -0
  417. package/src/internal/object/schema-validator.ts +244 -0
  418. package/src/internal/object/typed-object.test.ts +34 -0
  419. package/src/internal/object/typed-object.ts +94 -0
  420. package/src/internal/proxy/handler.test.ts +173 -0
  421. package/src/internal/proxy/index.ts +6 -0
  422. package/src/internal/proxy/make-object.ts +113 -0
  423. package/src/internal/proxy/schema.test.ts +137 -0
  424. package/src/internal/proxy/typed-handler.test.ts +102 -0
  425. package/src/internal/proxy/typed-handler.ts +233 -0
  426. package/src/internal/proxy/typed-object.test.ts +105 -0
  427. package/src/internal/ref/index.ts +6 -0
  428. package/src/internal/ref/ref-array.ts +39 -0
  429. package/src/internal/ref/ref.test.ts +101 -0
  430. package/src/internal/ref/ref.ts +525 -0
  431. package/src/internal/schema/compose.test.ts +42 -0
  432. package/src/internal/schema/compose.ts +37 -0
  433. package/src/internal/schema/echo-schema.ts +385 -0
  434. package/src/internal/schema/index.ts +8 -0
  435. package/src/internal/schema/manipulation.ts +92 -0
  436. package/src/internal/schema/persistent-schema.ts +28 -0
  437. package/src/internal/schema/snapshot.ts +25 -0
  438. package/src/internal/types/base.ts +57 -0
  439. package/src/internal/types/entity.ts +23 -0
  440. package/src/internal/types/index.ts +9 -0
  441. package/src/internal/types/meta.ts +76 -0
  442. package/src/internal/types/typename.ts +45 -0
  443. package/src/internal/types/version.ts +20 -0
  444. package/src/testing/api.test.ts +100 -0
  445. package/src/testing/index.ts +3 -1
  446. package/src/testing/test-data.ts +130 -0
  447. package/src/testing/test-schema.ts +224 -0
  448. package/src/testing/util.ts +78 -0
  449. package/dist/lib/browser/chunk-EUA7CM23.mjs +0 -619
  450. package/dist/lib/browser/chunk-EUA7CM23.mjs.map +0 -7
  451. package/dist/lib/node-esm/chunk-IV6BWGHK.mjs +0 -619
  452. package/dist/lib/node-esm/chunk-IV6BWGHK.mjs.map +0 -7
  453. package/dist/types/src/experimental/database.d.ts +0 -8
  454. package/dist/types/src/experimental/database.d.ts.map +0 -1
  455. package/dist/types/src/experimental/index.d.ts +0 -1
  456. package/dist/types/src/experimental/index.d.ts.map +0 -1
  457. package/dist/types/src/experimental/queue.d.ts +0 -8
  458. package/dist/types/src/experimental/queue.d.ts.map +0 -1
  459. package/dist/types/src/experimental/space.d.ts +0 -8
  460. package/dist/types/src/experimental/space.d.ts.map +0 -1
  461. package/dist/types/src/query/dsl.d.ts +0 -218
  462. package/dist/types/src/query/dsl.d.ts.map +0 -1
  463. package/dist/types/src/query/dsl.test.d.ts +0 -2
  464. package/dist/types/src/query/dsl.test.d.ts.map +0 -1
  465. package/dist/types/src/query/index.d.ts +0 -2
  466. package/dist/types/src/query/index.d.ts.map +0 -1
  467. package/dist/types/src/testing/types.d.ts +0 -113
  468. package/dist/types/src/testing/types.d.ts.map +0 -1
  469. package/src/experimental/database.ts +0 -11
  470. package/src/experimental/index.ts +0 -7
  471. package/src/experimental/queue.ts +0 -11
  472. package/src/experimental/space.ts +0 -11
  473. package/src/query/dsl.test.ts +0 -323
  474. package/src/query/dsl.ts +0 -646
  475. package/src/query/index.ts +0 -5
  476. package/src/test/api.test.ts +0 -173
  477. package/src/testing/types.ts +0 -91
  478. /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
package/src/Type.ts CHANGED
@@ -2,45 +2,59 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { type Schema } from 'effect';
6
- import { type Simplify } from 'effect/Schema';
5
+ import type * as Schema$ from 'effect/Schema';
7
6
 
8
7
  import { type EncodedReference } from '@dxos/echo-protocol';
9
- import * as EchoSchema from '@dxos/echo-schema';
10
- import { type ToMutable } from '@dxos/echo-schema';
11
8
  import { invariant } from '@dxos/invariant';
12
- import type * as Keys from '@dxos/keys';
9
+ import { type DXN } from '@dxos/keys';
10
+ import { type ToMutable } from '@dxos/util';
11
+
12
+ import type * as Entity$ from './Entity';
13
+ import {
14
+ type ATTR_RELATION_SOURCE,
15
+ type ATTR_RELATION_TARGET,
16
+ EchoObjectSchema,
17
+ EchoRelationSchema,
18
+ type EchoRelationSchemaOptions,
19
+ EchoSchema,
20
+ Expando as Expando$,
21
+ type ExpandoEncoded,
22
+ PersistentSchema,
23
+ type PersistentSchemaEncoded,
24
+ Ref as Ref$,
25
+ type RefFn,
26
+ type RefSchema,
27
+ type TypeAnnotation,
28
+ type TypeMeta,
29
+ getSchemaDXN,
30
+ getSchemaTypename,
31
+ getSchemaVersion,
32
+ getTypeAnnotation,
33
+ isMutable as isMutable$,
34
+ toEffectSchema,
35
+ toJsonSchema,
36
+ } from './internal';
37
+ import type * as Relation$ from './Relation';
38
+
39
+ // TODO(burdon): Remove toEffectSchema, toJsonSchema (moved to JsonSchema export).
40
+ export { toEffectSchema, toJsonSchema };
13
41
 
14
- import type * as RelationModule from './Relation';
42
+ /**
43
+ * Returns all properties of an object or relation except for the id and kind.
44
+ */
45
+ export type Properties<T = any> = Omit<T, 'id' | Entity$.KindId | Relation$.Source | Relation$.Target>;
15
46
 
16
47
  //
17
- // Kind
48
+ // Entity
18
49
  //
19
50
 
20
- export const KindId: unique symbol = EchoSchema.EntityKindId as any;
21
- export type KindId = typeof KindId;
22
-
23
- export const Kind = EchoSchema.EntityKind;
24
-
25
- /**
26
- * Assigns a kind to an Object or Relation instance.
27
- */
28
- // NOTE: Needed to make `isRelation` and `isObject` checks work.
29
- export interface OfKind<Kind extends EchoSchema.EntityKind> {
30
- readonly id: Keys.ObjectId;
31
- readonly [KindId]: Kind;
51
+ export namespace Entity {
52
+ /**
53
+ * Type.Obj.Any | Type.Relation.Any.
54
+ */
55
+ export type Any = Obj.Any | Relation.Any;
32
56
  }
33
57
 
34
- /**
35
- * Base ECHO schema type.
36
- */
37
- export type Schema = EchoSchema.EchoSchema;
38
-
39
- /**
40
- * Returns all properties of an object or relation except for the id and kind.
41
- */
42
- export type Properties<T> = Omit<T, 'id' | KindId | RelationModule.Source | RelationModule.Target>;
43
-
44
58
  //
45
59
  // Obj
46
60
  //
@@ -55,45 +69,50 @@ interface ObjJsonProps {
55
69
  * This typedef avoids `TS4023` error (name from external module cannot be used named).
56
70
  * See Effect's note on interface types.
57
71
  */
58
- export interface obj<Self extends Schema.Schema.Any>
59
- extends EchoSchema.TypeMeta,
60
- Schema.AnnotableClass<
72
+ export interface obj<Self extends Schema$.Schema.Any>
73
+ extends TypeMeta,
74
+ Schema$.AnnotableClass<
61
75
  obj<Self>,
62
- OfKind<EchoSchema.EntityKind.Object> & ToMutable<Schema.Schema.Type<Self>>,
63
- Simplify<ObjJsonProps & ToMutable<Schema.Schema.Encoded<Self>>>,
64
- Schema.Schema.Context<Self>
76
+ Entity$.OfKind<typeof Entity$.Kind.Object> & ToMutable<Schema$.Schema.Type<Self>>,
77
+ Schema$.Simplify<ObjJsonProps & ToMutable<Schema$.Schema.Encoded<Self>>>,
78
+ Schema$.Schema.Context<Self>
65
79
  > {}
66
80
 
67
81
  /**
68
82
  * Object schema.
69
83
  */
70
84
  export const Obj: {
71
- (opts: EchoSchema.TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => obj<Self>;
72
- } = EchoSchema.EchoObject as any;
85
+ (opts: TypeMeta): <Self extends Schema$.Schema.Any>(self: Self) => obj<Self>;
86
+ } = EchoObjectSchema as any;
73
87
 
74
88
  /**
75
89
  * Object schema type definitions.
76
90
  */
77
- export namespace Obj {
91
+ export declare namespace Obj {
78
92
  /**
79
93
  * Type that represents an arbitrary schema type of an object.
80
94
  * NOTE: This is not an instance type.
81
95
  */
82
96
  // TODO(dmaretskyi): If schema was covariant, we could specify props in here, like `id: ObjectId`.
83
- export type Any = Schema.Schema.AnyNoContext;
97
+ // TODO(burdon): This erases the ECHO type info (e.g., id, typename).
98
+ export type Any = obj<Schema$.Schema.AnyNoContext>;
84
99
  }
85
100
 
86
101
  //
87
102
  // Expando
88
103
  //
89
104
 
90
- export interface Expando extends OfKind<EchoSchema.EntityKind.Object> {
91
- [key: string]: any;
92
- }
105
+ export const Expando: obj<Schema$.Schema<Expando$, ExpandoEncoded>> = Expando$ as any;
106
+ export type Expando = obj<Schema$.Schema<Expando$, ExpandoEncoded>>;
93
107
 
94
- type ExpandoEncoded = Simplify<ObjJsonProps & { [key: string]: any }>;
108
+ //
109
+ // Schema
110
+ //
111
+
112
+ export const PersistentType: obj<Schema$.Schema<PersistentSchema, PersistentSchemaEncoded>> = PersistentSchema as any;
113
+ export type PersistentType = obj<Schema$.Schema<PersistentSchema, PersistentSchemaEncoded>>;
95
114
 
96
- export const Expando: Schema.Schema<Expando, ExpandoEncoded, never> = EchoSchema.Expando as any;
115
+ export { EchoSchema as RuntimeType };
97
116
 
98
117
  //
99
118
  // Relation
@@ -101,8 +120,8 @@ export const Expando: Schema.Schema<Expando, ExpandoEncoded, never> = EchoSchema
101
120
 
102
121
  interface RelationJsonProps {
103
122
  id: string;
104
- [EchoSchema.ATTR_RELATION_SOURCE]: string;
105
- [EchoSchema.ATTR_RELATION_TARGET]: string;
123
+ [ATTR_RELATION_SOURCE]: string;
124
+ [ATTR_RELATION_TARGET]: string;
106
125
  }
107
126
 
108
127
  /**
@@ -112,28 +131,29 @@ interface RelationJsonProps {
112
131
  * See Effect's note on interface types.
113
132
  */
114
133
  export interface relation<
115
- Self extends Schema.Schema.Any,
116
- SourceSchema extends Schema.Schema.Any,
117
- TargetSchema extends Schema.Schema.Any,
118
- > extends EchoSchema.TypeMeta,
119
- Schema.AnnotableClass<
134
+ Self extends Schema$.Schema.Any,
135
+ SourceSchema extends Schema$.Schema.Any,
136
+ TargetSchema extends Schema$.Schema.Any,
137
+ > extends TypeMeta,
138
+ Schema$.AnnotableClass<
120
139
  relation<Self, SourceSchema, TargetSchema>,
121
- OfKind<EchoSchema.EntityKind.Relation> &
122
- Relation.Endpoints<Schema.Schema.Type<SourceSchema>, Schema.Schema.Type<TargetSchema>> &
123
- ToMutable<Schema.Schema.Type<Self>>,
124
- Simplify<RelationJsonProps & ToMutable<Schema.Schema.Encoded<Self>>>,
125
- Schema.Schema.Context<Self>
140
+ Entity$.OfKind<typeof Entity$.Kind.Relation> &
141
+ Relation.Endpoints<Schema$.Schema.Type<SourceSchema>, Schema$.Schema.Type<TargetSchema>> &
142
+ ToMutable<Schema$.Schema.Type<Self>>,
143
+ Schema$.Simplify<RelationJsonProps & ToMutable<Schema$.Schema.Encoded<Self>>>,
144
+ Schema$.Schema.Context<Self>
126
145
  > {}
127
146
 
128
147
  /**
129
148
  * Relation schema.
130
149
  */
131
150
  // TODO(dmaretskyi): I have to redefine the type here so that the definition uses symbols from @dxos/echo/Relation.
151
+ // TODO(burdon): Remove?
132
152
  export const Relation: {
133
- <Source extends Schema.Schema.AnyNoContext, Target extends Schema.Schema.AnyNoContext>(
134
- opts: EchoSchema.EchoRelationOptions<Source, Target>,
135
- ): <Self extends Schema.Schema.Any>(self: Self) => relation<Self, Source, Target>;
136
- } = EchoSchema.EchoRelation as any;
153
+ <Source extends Schema$.Schema.AnyNoContext, Target extends Schema$.Schema.AnyNoContext>(
154
+ opts: EchoRelationSchemaOptions<Source, Target>,
155
+ ): <Self extends Schema$.Schema.Any>(self: Self) => relation<Self, Source, Target>;
156
+ } = EchoRelationSchema as any;
137
157
 
138
158
  /**
139
159
  * Relation schema type definitions.
@@ -144,7 +164,7 @@ export namespace Relation {
144
164
  * NOTE: This is not an instance type.
145
165
  */
146
166
  // TODO(dmaretskyi): If schema was covariant, we could specify props in here, like `id: ObjectId`.
147
- export type Any = Schema.Schema.AnyNoContext;
167
+ export type Any = Schema$.Schema.AnyNoContext;
148
168
 
149
169
  /**
150
170
  * Get relation source type.
@@ -157,13 +177,14 @@ export namespace Relation {
157
177
  export type Target<A> = A extends Relation.Endpoints<infer _S, infer T> ? T : never;
158
178
 
159
179
  export type Endpoints<Source, Target> = {
160
- [RelationModule.Source]: Source;
161
- [RelationModule.Target]: Target;
180
+ [Relation$.Source]: Source;
181
+ [Relation$.Target]: Target;
162
182
  };
163
183
  }
164
184
 
165
185
  //
166
186
  // Ref
187
+ // TODO(burdon): Reconcile Type.Ref with Ref.Ref.
167
188
  //
168
189
 
169
190
  /**
@@ -172,23 +193,21 @@ export namespace Relation {
172
193
  * This typedef avoids `TS4023` error (name from external module cannot be used named).
173
194
  * See Effect's note on interface types.
174
195
  */
175
- export interface ref<TargetSchema extends Schema.Schema.Any>
176
- extends EchoSchema.Ref$<Schema.Schema.Type<TargetSchema>> {}
196
+ export interface ref<TargetSchema extends Schema$.Schema.Any> extends RefSchema<Schema$.Schema.Type<TargetSchema>> {}
177
197
 
178
198
  /**
179
199
  * Ref schema.
180
200
  */
181
- export const Ref: <S extends Obj.Any>(schema: S) => ref<S> = EchoSchema.Ref;
201
+ export const Ref: RefFn = Ref$;
182
202
 
183
- export interface Ref<T> extends Schema.SchemaClass<EchoSchema.Ref<T>, EncodedReference> {}
203
+ export interface Ref<T> extends Schema$.SchemaClass<Ref$<T>, EncodedReference> {}
184
204
 
185
- // TODO(buurdon): Move to Ref?
186
205
  export namespace Ref {
187
206
  /**
188
207
  * Type that represents an arbitrary schema type of a reference.
189
208
  * NOTE: This is not an instance type.
190
209
  */
191
- export type Any = Schema.Schema<EchoSchema.Ref<any>, EncodedReference>;
210
+ export type Any = Schema$.Schema<Ref$<any>, EncodedReference>;
192
211
  }
193
212
 
194
213
  /**
@@ -197,16 +216,16 @@ export namespace Ref {
197
216
  * @example "dxn:example.com/type/Person:0.1.0"
198
217
  * @example "dxn:echo:SSSSSSSSSS:XXXXXXXXXXXXX"
199
218
  */
200
- export const getDXN = (schema: Obj.Any | Relation.Any): Keys.DXN | undefined => {
201
- return EchoSchema.getSchemaDXN(schema);
219
+ export const getDXN = (schema: Entity.Any): DXN | undefined => {
220
+ return getSchemaDXN(schema);
202
221
  };
203
222
 
204
223
  /**
205
224
  * @param schema - Schema to get the typename from.
206
225
  * @returns The typename of the schema. Example: `example.com/type/Person`.
207
226
  */
208
- export const getTypename = (schema: Obj.Any | Relation.Any): string => {
209
- const typename = EchoSchema.getSchemaTypename(schema);
227
+ export const getTypename = (schema: Entity.Any): string => {
228
+ const typename = getSchemaTypename(schema);
210
229
  invariant(typeof typename === 'string' && !typename.startsWith('dxn:'), 'Invalid typename');
211
230
  return typename;
212
231
  };
@@ -215,8 +234,8 @@ export const getTypename = (schema: Obj.Any | Relation.Any): string => {
215
234
  * Gets the version of the schema.
216
235
  * @example 0.1.0
217
236
  */
218
- export const getVersion = (schema: Obj.Any | Relation.Any): string => {
219
- const version = EchoSchema.getSchemaVersion(schema);
237
+ export const getVersion = (schema: Entity.Any): string => {
238
+ const version = getSchemaVersion(schema);
220
239
  invariant(typeof version === 'string' && version.match(/^\d+\.\d+\.\d+$/), 'Invalid version');
221
240
  return version;
222
241
  };
@@ -224,21 +243,16 @@ export const getVersion = (schema: Obj.Any | Relation.Any): string => {
224
243
  /**
225
244
  * @returns True if the schema is mutable.
226
245
  */
227
- export const isMutable = EchoSchema.isMutable;
246
+ export const isMutable = isMutable$;
228
247
 
229
248
  /**
230
249
  * ECHO type metadata.
231
250
  */
232
- export type Meta = EchoSchema.TypeAnnotation;
251
+ export type Meta = TypeAnnotation;
233
252
 
234
253
  /**
235
254
  * Gets the meta data of the schema.
236
255
  */
237
- export const getMeta = (schema: Obj.Any | Relation.Any): Meta | undefined => {
238
- return EchoSchema.getTypeAnnotation(schema);
256
+ export const getMeta = (schema: Entity.Any): Meta | undefined => {
257
+ return getTypeAnnotation(schema);
239
258
  };
240
-
241
- // TODO(dmaretskyi): Remove re-exports.
242
- export { SpaceId, ObjectId, DXN } from '@dxos/keys';
243
-
244
- export { Format, JsonSchemaType as JsonSchema, toEffectSchema, toJsonSchema } from '@dxos/echo-schema';
package/src/index.ts CHANGED
@@ -2,12 +2,25 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ export { QueryAST } from '@dxos/echo-protocol';
6
+ // TODO(wittjosiah): Refactor DXN to not use statics similar to Query.
7
+ export { DXN } from '@dxos/keys';
8
+
9
+ export * as Annotation from './Annotation';
10
+ export * as Database from './Database';
11
+ export * as Entity from './Entity';
12
+ export * as Err from './Err';
13
+ export * as Filter from './Filter';
14
+ export * as Format from './Format';
15
+ export * as Hypergraph from './Hypergraph';
16
+ export * as JsonSchema from './JsonSchema';
5
17
  export * as Key from './Key';
6
18
  export * as Obj from './Obj';
19
+ export * as Order from './Order';
20
+ export * as Query from './Query';
21
+ export * as QueryResult from './QueryResult';
7
22
  export * as Ref from './Ref';
8
23
  export * as Relation from './Relation';
24
+ export * as SchemaRegistry from './SchemaRegistry';
25
+ export * as Tag from './Tag';
9
26
  export * as Type from './Type';
10
-
11
- export { DXN } from '@dxos/keys';
12
- export { Filter, Query } from './query';
13
- export { type Live } from '@dxos/live-object';
@@ -0,0 +1,87 @@
1
+ ## Refactor
2
+
3
+ 1. Remove access from outisde of @dxos/echo-db
4
+
5
+ - [x] completely restructure @dxos/echo src/internal
6
+ - [x] Remove import "." and ".."! (create lint rule).
7
+ - [x] Unify FOUR different nests of test schema.
8
+ - [x] Remove @deprecated from internal methods and mark @internal (e.g., getSchemaDXN).
9
+ - NOTE: Internal methods should not use the import \* from Obj/Type APIs.
10
+ - [x] import ObjectId => @dxos/keys
11
+ - [x] Entity.Any = Obj.Any | Relation.Any
12
+ - NOTE: Relation does not extend (in not polymorphic with) Obj.
13
+ - [x] import LabelAnnotation => Annotation.LabelAnnotation
14
+ - [x] import Expando => Type.Expando
15
+ - [x] live => Obj.make
16
+ - [x] Rename live => makeObject
17
+ - [x] Rename {EchoObject, EchoRelation} => {EchoObjecSchema, EchoRelationSchema}
18
+ - [x] Rename AnyProperties => AnyProperties
19
+ - [x] Created Entity.Any (=> AnyEchoObject).
20
+ - [x] TypeFormat => TypeFormat
21
+ - [x] JsonSchemaType defs
22
+ - [x] Fix database.add() input/output types and search for "Obj.Any = db.add" (also QueryResult types).
23
+ - [x] TODO(burdon): FIX!!!
24
+ - [x] Fix failing tests.
25
+ - [x] Reconcile types/version with entities/model/version
26
+ - [x] Type.Expando => Obj.Any
27
+ - [x] Narrow QueryResult and match Schema and Object generics.
28
+
29
+ 2. Clean-up
30
+
31
+ - [x] QueryResult namespace
32
+ - [x] SchemaRegistry interface
33
+ - [x] Schema registry should return Type.Entity.Any instead of Schema.Schema.AnyNoContext.
34
+ - [x] Hypergraph interface
35
+ - [ ] Schema registry should use Query.Query.
36
+ - [ ] TODO(wittjosiah): Find a simpler way to define this type.
37
+ - [ ] TODO(wittjosiah): Should be Type.obj<...> or equivalent.
38
+ - [ ] Fix Obj.instanceOf(Type.Expando...
39
+ - [ ] Add Obj.Unknown and Relation.Unknown to match Entity.Unknown.
40
+ - [ ] Ref.Array.targets doesn't satisfy Obj.Any because it uses AnyEchoObject.
41
+ - [ ] Add Relation.MakeProps
42
+ - [ ] Remove echo-db/AnyLiveObject<T> => Obj.Obj<T>
43
+ - [ ] Narrow QueryResult and match Schema and Object generics.
44
+ - [ ] Directly import JSONPath, etc. from @dxos/effect.
45
+ - [ ] DISCUSS: Standradize $ suffix to disambuguate imports (GPT recommended).
46
+ - [ ] Reconcile Type.Ref with Ref.Ref
47
+ - [ ] Promote parts of src/internal/ref to Ref.ts
48
+ - [ ] Rename AnyEchoObject => AnyEntity? (or accept that Object != Obj from naming perspective.)
49
+ - [ ] Remove WithId => AnyEchoObject
50
+ - [ ] Remove WithMeta => AnyEchoObject
51
+ - [ ] BaseSchema
52
+ - [ ] JsonPath, JsonProp, getValue, setValue => Json.Path?
53
+ - [ ] Move EchoSchemaRegistry into hypergraph
54
+
55
+ 3. Audit usage from @dxos/echo-db
56
+
57
+ - [ ] Ability to extract Struct from Type.Obj
58
+ - [ ] created/updated system props (const { created } = Obj.getTimestamps)?
59
+ - [ ] QueryFn, QueryOptions => Database
60
+ - [ ] Datatbase.query() options?
61
+ - [ ] Expando type is used as a fallback in many plance.
62
+ - [ ] Standardize '@automerge/automerge' imports (A vs. next).
63
+
64
+ ## NOTES
65
+
66
+ - Marking types as @internal (even for unexported types) erases type information.
67
+
68
+ ## 0.9.0
69
+
70
+ - [ ] Database, Queue, Space, Type, namespaces.
71
+ - [ ] Support class variant for types.
72
+ - [ ] Support defaults.
73
+ - [ ] Support effect Date, Timestamp formats.
74
+ - [ ] Metadata for created, updated timestamps.
75
+ - [ ] Effect team design review.
76
+ - [ ] @category annotations to group types in the API.
77
+ - [ ] TSdoc and LLM training for function generation.
78
+ - [ ] Rename TypeFormat => Primitive?
79
+ - [ ] Don't re-export effect?
80
+
81
+ ## Issues
82
+
83
+ - [ ] Build error when changing from TypedObject using Ref$: Type 'Task' does not satisfy the constraint 'WithId' (see echo-schema/testing/schema.ts)
84
+ - [ ] Reconcile all schema variants (Base, Immutable, TypedObject, EchoObject, etc.)
85
+ - [ ] Consolidate getters (getType, getSchema, getTypename, getSchemaTypename, etc.)
86
+ - [ ] ReactiveObject should specify id property? Reconcile AnyProperties, ReactiveObject, HasId, WithId, etc.
87
+ - [ ] Can we us S.is(MyType) to detect objects with our types system? (Branding?)
@@ -0,0 +1,96 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+ import { describe, test } from 'vitest';
7
+
8
+ import { EchoObjectSchema } from '../entities';
9
+
10
+ import { LabelAnnotation, TypenameSchema, VersionSchema, getLabel } from './annotations';
11
+
12
+ // TODO(dmaretskyi): Use one of the testing schemas.
13
+ const TestObject = Schema.Struct({
14
+ name: Schema.optional(Schema.String),
15
+ fallbackName: Schema.optional(Schema.String),
16
+ other: Schema.String,
17
+ }).pipe(LabelAnnotation.set(['name', 'fallbackName']));
18
+
19
+ type TestObject = Schema.Schema.Type<typeof TestObject>;
20
+
21
+ const TestEchoSchema = TestObject.pipe(
22
+ EchoObjectSchema({
23
+ typename: 'dxos.org/type/Test',
24
+ version: '0.1.0',
25
+ }),
26
+ );
27
+
28
+ type TestEchoSchema = Schema.Schema.Type<typeof TestEchoSchema>;
29
+
30
+ describe('annotations', () => {
31
+ describe('Typename', () => {
32
+ test('should validate typename', ({ expect }) => {
33
+ // Valid.
34
+ expect(TypenameSchema.make('dxos.org/type/foo')).to.exist;
35
+ expect(TypenameSchema.make('dxos.org/type/foo-bar')).to.exist;
36
+ expect(TypenameSchema.make('dxos.org/type/foo_bar')).to.exist;
37
+
38
+ // Invalid.
39
+ expect(() => TypenameSchema.make('dxn:dxos.org')).to.throw();
40
+ expect(() => TypenameSchema.make('2dxos.org')).to.throw();
41
+ expect(() => TypenameSchema.make('dxos org')).to.throw();
42
+ });
43
+
44
+ test('should validate version', ({ expect }) => {
45
+ // Valid.
46
+ expect(VersionSchema.make('0.1.0')).to.exist;
47
+
48
+ // Invalid.
49
+ expect(() => VersionSchema.make('0.1.x')).to.throw();
50
+ expect(() => VersionSchema.make('0.1.0-alpha')).to.throw();
51
+ });
52
+ });
53
+
54
+ describe('getLabel', () => {
55
+ test('should return first available label value', ({ expect }) => {
56
+ const obj: TestObject = {
57
+ name: 'Primary Name',
58
+ fallbackName: 'Fallback Name',
59
+ other: 'Other',
60
+ };
61
+
62
+ expect(getLabel(TestObject, obj)).toEqual('Primary Name');
63
+ });
64
+
65
+ test('should fallback to second path if first is undefined', ({ expect }) => {
66
+ const obj: TestObject = {
67
+ name: undefined,
68
+ fallbackName: 'Fallback Name',
69
+ other: 'Other',
70
+ };
71
+
72
+ expect(getLabel(TestObject, obj)).toEqual('Fallback Name');
73
+ });
74
+
75
+ test('should return undefined if no label paths resolve', ({ expect }) => {
76
+ const obj: TestObject = {
77
+ name: undefined,
78
+ fallbackName: undefined,
79
+ other: 'Other',
80
+ };
81
+
82
+ expect(getLabel(TestObject, obj)).toBeUndefined();
83
+ });
84
+
85
+ test('should return label from echo object', ({ expect }) => {
86
+ const obj: TestEchoSchema = {
87
+ id: 'test',
88
+ name: 'Primary Name',
89
+ fallbackName: 'Fallback Name',
90
+ other: 'Other',
91
+ };
92
+
93
+ expect(getLabel(TestEchoSchema, obj)).toEqual('Primary Name');
94
+ });
95
+ });
96
+ });