@dxos/echo 0.8.4-main.5ad4a44 → 0.8.4-main.66e292d

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 (343) hide show
  1. package/dist/lib/browser/{chunk-MWLA34S5.mjs → chunk-7GH6RXJ3.mjs} +2513 -2673
  2. package/dist/lib/browser/chunk-7GH6RXJ3.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-E4UTVJNF.mjs +1111 -0
  4. package/dist/lib/browser/chunk-E4UTVJNF.mjs.map +7 -0
  5. package/dist/lib/browser/index.mjs +21 -19
  6. package/dist/lib/browser/internal/index.mjs +55 -45
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/testing/index.mjs +247 -217
  9. package/dist/lib/browser/testing/index.mjs.map +4 -4
  10. package/dist/lib/node-esm/chunk-JE5RXM2I.mjs +1111 -0
  11. package/dist/lib/node-esm/chunk-JE5RXM2I.mjs.map +7 -0
  12. package/dist/lib/node-esm/{chunk-YTNLFBIK.mjs → chunk-M4B6BMD2.mjs} +2513 -2673
  13. package/dist/lib/node-esm/chunk-M4B6BMD2.mjs.map +7 -0
  14. package/dist/lib/node-esm/index.mjs +21 -19
  15. package/dist/lib/node-esm/internal/index.mjs +55 -45
  16. package/dist/lib/node-esm/meta.json +1 -1
  17. package/dist/lib/node-esm/testing/index.mjs +247 -217
  18. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  19. package/dist/types/src/Annotation.d.ts +2 -0
  20. package/dist/types/src/Annotation.d.ts.map +1 -0
  21. package/dist/types/src/Database.d.ts +137 -0
  22. package/dist/types/src/Database.d.ts.map +1 -0
  23. package/dist/types/src/Entity.d.ts +36 -0
  24. package/dist/types/src/Entity.d.ts.map +1 -0
  25. package/dist/types/src/Format.d.ts +4 -0
  26. package/dist/types/src/Format.d.ts.map +1 -0
  27. package/dist/types/src/JsonSchema.d.ts +9 -0
  28. package/dist/types/src/JsonSchema.d.ts.map +1 -0
  29. package/dist/types/src/Key.d.ts +1 -0
  30. package/dist/types/src/Key.d.ts.map +1 -1
  31. package/dist/types/src/Obj.d.ts +85 -62
  32. package/dist/types/src/Obj.d.ts.map +1 -1
  33. package/dist/types/src/Ref.d.ts +10 -10
  34. package/dist/types/src/Ref.d.ts.map +1 -1
  35. package/dist/types/src/Relation.d.ts +14 -11
  36. package/dist/types/src/Relation.d.ts.map +1 -1
  37. package/dist/types/src/Tag.d.ts +17 -0
  38. package/dist/types/src/Tag.d.ts.map +1 -0
  39. package/dist/types/src/Type.d.ts +39 -49
  40. package/dist/types/src/Type.d.ts.map +1 -1
  41. package/dist/types/src/errors.d.ts +14 -18
  42. package/dist/types/src/errors.d.ts.map +1 -1
  43. package/dist/types/src/index.d.ts +7 -3
  44. package/dist/types/src/index.d.ts.map +1 -1
  45. package/dist/types/src/internal/annotations/annotations.d.ts +174 -0
  46. package/dist/types/src/internal/annotations/annotations.d.ts.map +1 -0
  47. package/dist/types/src/internal/annotations/annotations.test.d.ts.map +1 -0
  48. package/dist/types/src/internal/annotations/index.d.ts +3 -0
  49. package/dist/types/src/internal/annotations/index.d.ts.map +1 -0
  50. package/dist/types/src/internal/annotations/util.d.ts +26 -0
  51. package/dist/types/src/internal/annotations/util.d.ts.map +1 -0
  52. package/dist/types/src/internal/entities/entity.d.ts +10 -0
  53. package/dist/types/src/internal/entities/entity.d.ts.map +1 -0
  54. package/dist/types/src/internal/{object → entities}/expando.d.ts +3 -1
  55. package/dist/types/src/internal/entities/expando.d.ts.map +1 -0
  56. package/dist/types/src/internal/entities/index.d.ts +6 -0
  57. package/dist/types/src/internal/entities/index.d.ts.map +1 -0
  58. package/dist/types/src/internal/entities/model.d.ts +70 -0
  59. package/dist/types/src/internal/entities/model.d.ts.map +1 -0
  60. package/dist/types/src/internal/entities/object.d.ts +11 -0
  61. package/dist/types/src/internal/entities/object.d.ts.map +1 -0
  62. package/dist/types/src/internal/entities/relation.d.ts +55 -0
  63. package/dist/types/src/internal/entities/relation.d.ts.map +1 -0
  64. package/dist/types/src/internal/entities/util.d.ts +2 -0
  65. package/dist/types/src/internal/entities/util.d.ts.map +1 -0
  66. package/dist/types/src/internal/formats/format.d.ts +2 -0
  67. package/dist/types/src/internal/formats/format.d.ts.map +1 -1
  68. package/dist/types/src/internal/formats/types.d.ts +7 -7
  69. package/dist/types/src/internal/formats/types.d.ts.map +1 -1
  70. package/dist/types/src/internal/index.d.ts +6 -10
  71. package/dist/types/src/internal/index.d.ts.map +1 -1
  72. package/dist/types/src/internal/json-schema/annotations.d.ts.map +1 -0
  73. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +1 -0
  74. package/dist/types/src/internal/json-schema/index.d.ts +2 -0
  75. package/dist/types/src/internal/json-schema/index.d.ts.map +1 -1
  76. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -1
  77. package/dist/types/src/internal/{json → json-schema}/json-schema.d.ts +2 -5
  78. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +1 -0
  79. package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +1 -0
  80. package/dist/types/src/internal/object/common.d.ts.map +1 -1
  81. package/dist/types/src/internal/object/{create.d.ts → create-object.d.ts} +9 -10
  82. package/dist/types/src/internal/object/create-object.d.ts.map +1 -0
  83. package/dist/types/src/internal/object/create-object.test.d.ts +2 -0
  84. package/dist/types/src/internal/object/create-object.test.d.ts.map +1 -0
  85. package/dist/types/src/internal/object/deleted.d.ts +2 -2
  86. package/dist/types/src/internal/object/deleted.d.ts.map +1 -1
  87. package/dist/types/src/internal/object/ids.d.ts.map +1 -1
  88. package/dist/types/src/internal/object/index.d.ts +3 -12
  89. package/dist/types/src/internal/object/index.d.ts.map +1 -1
  90. package/dist/types/src/internal/object/json-serializer.d.ts +1 -2
  91. package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -1
  92. package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -1
  93. package/dist/types/src/internal/object/typed-object.d.ts +1 -1
  94. package/dist/types/src/internal/object/typed-object.d.ts.map +1 -1
  95. package/dist/types/src/internal/proxy/index.d.ts +3 -0
  96. package/dist/types/src/internal/proxy/index.d.ts.map +1 -0
  97. package/dist/types/src/internal/proxy/make-object.d.ts +16 -0
  98. package/dist/types/src/internal/proxy/make-object.d.ts.map +1 -0
  99. package/dist/types/src/internal/proxy/typed-handler.d.ts +1 -1
  100. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -1
  101. package/dist/types/src/internal/ref/ref.d.ts +15 -12
  102. package/dist/types/src/internal/ref/ref.d.ts.map +1 -1
  103. package/dist/types/src/internal/schema/compose.d.ts.map +1 -0
  104. package/dist/types/src/internal/schema/compose.test.d.ts.map +1 -0
  105. package/dist/types/src/internal/schema/echo-schema.d.ts +9 -9
  106. package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -1
  107. package/dist/types/src/internal/schema/index.d.ts +3 -4
  108. package/dist/types/src/internal/schema/index.d.ts.map +1 -1
  109. package/dist/types/src/internal/schema/manipulation.d.ts.map +1 -1
  110. package/dist/types/src/internal/schema/persistent-schema.d.ts +18 -0
  111. package/dist/types/src/internal/schema/persistent-schema.d.ts.map +1 -0
  112. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +1 -1
  113. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +1 -1
  114. package/dist/types/src/internal/types/base.d.ts +37 -0
  115. package/dist/types/src/internal/types/base.d.ts.map +1 -0
  116. package/dist/types/src/internal/{ast/entity-kind.d.ts → types/entity.d.ts} +3 -1
  117. package/dist/types/src/internal/types/entity.d.ts.map +1 -0
  118. package/dist/types/src/internal/types/index.d.ts +5 -2
  119. package/dist/types/src/internal/types/index.d.ts.map +1 -1
  120. package/dist/types/src/internal/{object → types}/meta.d.ts +20 -11
  121. package/dist/types/src/internal/types/meta.d.ts.map +1 -0
  122. package/dist/types/src/internal/types/typename.d.ts +13 -0
  123. package/dist/types/src/internal/types/typename.d.ts.map +1 -0
  124. package/dist/types/src/internal/{object → types}/version.d.ts +3 -2
  125. package/dist/types/src/internal/types/version.d.ts.map +1 -0
  126. package/dist/types/src/query/filter.d.ts +167 -0
  127. package/dist/types/src/query/filter.d.ts.map +1 -0
  128. package/dist/types/src/query/index.d.ts +3 -1
  129. package/dist/types/src/query/index.d.ts.map +1 -1
  130. package/dist/types/src/query/order.d.ts +12 -0
  131. package/dist/types/src/query/order.d.ts.map +1 -0
  132. package/dist/types/src/query/query.d.ts +9 -144
  133. package/dist/types/src/query/query.d.ts.map +1 -1
  134. package/dist/types/src/query/testing.d.ts +51 -0
  135. package/dist/types/src/query/testing.d.ts.map +1 -0
  136. package/dist/types/src/{internal/query/query.d.ts → query/types.d.ts} +1 -1
  137. package/dist/types/src/query/types.d.ts.map +1 -0
  138. package/dist/types/src/query/util.d.ts +8 -0
  139. package/dist/types/src/query/util.d.ts.map +1 -0
  140. package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
  141. package/dist/types/src/testing/index.d.ts +3 -3
  142. package/dist/types/src/testing/index.d.ts.map +1 -1
  143. package/dist/types/src/testing/test-data.d.ts +18 -0
  144. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  145. package/dist/types/src/testing/test-schema.d.ts +337 -0
  146. package/dist/types/src/testing/test-schema.d.ts.map +1 -0
  147. package/dist/types/src/{internal/testing/utils.d.ts → testing/util.d.ts} +11 -5
  148. package/dist/types/src/testing/util.d.ts.map +1 -0
  149. package/dist/types/tsconfig.tsbuildinfo +1 -1
  150. package/package.json +46 -38
  151. package/src/Annotation.ts +17 -0
  152. package/src/Database.ts +189 -0
  153. package/src/Entity.ts +51 -0
  154. package/src/Format.ts +11 -0
  155. package/src/JsonSchema.ts +16 -0
  156. package/src/Key.ts +3 -0
  157. package/src/Obj.ts +260 -147
  158. package/src/Ref.ts +9 -9
  159. package/src/Relation.ts +58 -44
  160. package/src/Tag.ts +40 -0
  161. package/src/Type.ts +96 -83
  162. package/src/index.ts +10 -4
  163. package/src/internal/README.md +83 -0
  164. package/src/internal/{ast → annotations}/annotations.test.ts +13 -15
  165. package/src/internal/annotations/annotations.ts +463 -0
  166. package/src/internal/annotations/index.ts +6 -0
  167. package/src/internal/annotations/util.ts +70 -0
  168. package/src/internal/entities/entity.ts +109 -0
  169. package/src/internal/{object → entities}/expando.ts +7 -5
  170. package/src/internal/entities/index.ts +9 -0
  171. package/src/internal/entities/model.ts +129 -0
  172. package/src/internal/entities/object.ts +45 -0
  173. package/src/internal/entities/relation.ts +155 -0
  174. package/src/internal/entities/util.ts +33 -0
  175. package/src/internal/formats/date.test.ts +1 -1
  176. package/src/internal/formats/date.ts +5 -5
  177. package/src/internal/formats/format.test.ts +5 -5
  178. package/src/internal/formats/format.ts +3 -0
  179. package/src/internal/formats/number.ts +5 -5
  180. package/src/internal/formats/object.ts +2 -2
  181. package/src/internal/formats/string.ts +9 -9
  182. package/src/internal/formats/types.ts +44 -39
  183. package/src/internal/index.ts +29 -13
  184. package/src/internal/{json → json-schema}/annotations.ts +1 -1
  185. package/src/internal/json-schema/index.ts +2 -0
  186. package/src/internal/json-schema/json-schema-type.ts +4 -3
  187. package/src/internal/{json → json-schema}/json-schema.test.ts +230 -97
  188. package/src/internal/{json → json-schema}/json-schema.ts +67 -87
  189. package/src/internal/object/common.ts +3 -4
  190. package/src/internal/object/{create.test.ts → create-object.test.ts} +31 -33
  191. package/src/internal/object/{create.ts → create-object.ts} +34 -35
  192. package/src/internal/object/deleted.ts +6 -6
  193. package/src/internal/object/ids.ts +1 -1
  194. package/src/internal/object/index.ts +3 -12
  195. package/src/internal/object/inspect.ts +3 -5
  196. package/src/internal/object/json-serializer.test.ts +33 -38
  197. package/src/internal/object/json-serializer.ts +43 -38
  198. package/src/internal/object/schema-validator.ts +3 -2
  199. package/src/internal/object/typed-object.test.ts +1 -1
  200. package/src/internal/object/typed-object.ts +17 -4
  201. package/src/internal/proxy/handler.test.ts +30 -20
  202. package/src/internal/proxy/index.ts +6 -0
  203. package/src/internal/proxy/{reactive-object.ts → make-object.ts} +19 -14
  204. package/src/internal/proxy/schema.test.ts +5 -4
  205. package/src/internal/proxy/typed-handler.test.ts +28 -28
  206. package/src/internal/proxy/typed-handler.ts +11 -6
  207. package/src/internal/proxy/typed-object.test.ts +17 -12
  208. package/src/internal/ref/ref.test.ts +9 -8
  209. package/src/internal/ref/ref.ts +24 -20
  210. package/src/internal/{projection → schema}/compose.test.ts +5 -6
  211. package/src/internal/{projection → schema}/compose.ts +2 -1
  212. package/src/internal/schema/echo-schema.ts +30 -28
  213. package/src/internal/schema/index.ts +3 -4
  214. package/src/internal/schema/manipulation.ts +7 -1
  215. package/src/internal/schema/persistent-schema.ts +28 -0
  216. package/src/internal/schema/runtime-schema-registry.ts +4 -4
  217. package/src/internal/types/base.ts +58 -0
  218. package/src/internal/{ast/entity-kind.ts → types/entity.ts} +8 -0
  219. package/src/internal/types/index.ts +5 -2
  220. package/src/internal/{object → types}/meta.ts +32 -18
  221. package/src/internal/types/typename.ts +45 -0
  222. package/src/internal/types/version.ts +20 -0
  223. package/src/query/filter.ts +455 -0
  224. package/src/query/index.ts +4 -1
  225. package/src/query/order.ts +34 -0
  226. package/src/query/query.test.ts +188 -216
  227. package/src/query/query.ts +24 -505
  228. package/src/query/testing.ts +64 -0
  229. package/src/query/util.ts +25 -0
  230. package/src/testing/api.test.ts +100 -0
  231. package/src/testing/index.ts +3 -3
  232. package/src/testing/test-data.ts +130 -0
  233. package/src/testing/test-schema.ts +213 -0
  234. package/src/{internal/testing/utils.ts → testing/util.ts} +38 -14
  235. package/dist/lib/browser/chunk-MWLA34S5.mjs.map +0 -7
  236. package/dist/lib/browser/chunk-OAZJQHVO.mjs +0 -453
  237. package/dist/lib/browser/chunk-OAZJQHVO.mjs.map +0 -7
  238. package/dist/lib/browser/chunk-ORIE2FMS.mjs +0 -514
  239. package/dist/lib/browser/chunk-ORIE2FMS.mjs.map +0 -7
  240. package/dist/lib/browser/query/index.mjs +0 -23
  241. package/dist/lib/browser/query/index.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-AXWVDOP7.mjs +0 -453
  243. package/dist/lib/node-esm/chunk-AXWVDOP7.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-L4PBAJDP.mjs +0 -514
  245. package/dist/lib/node-esm/chunk-L4PBAJDP.mjs.map +0 -7
  246. package/dist/lib/node-esm/chunk-YTNLFBIK.mjs.map +0 -7
  247. package/dist/lib/node-esm/query/index.mjs +0 -23
  248. package/dist/lib/node-esm/query/index.mjs.map +0 -7
  249. package/dist/types/src/internal/ast/annotation-helper.d.ts +0 -8
  250. package/dist/types/src/internal/ast/annotation-helper.d.ts.map +0 -1
  251. package/dist/types/src/internal/ast/annotations.d.ts +0 -119
  252. package/dist/types/src/internal/ast/annotations.d.ts.map +0 -1
  253. package/dist/types/src/internal/ast/annotations.test.d.ts.map +0 -1
  254. package/dist/types/src/internal/ast/entity-kind.d.ts.map +0 -1
  255. package/dist/types/src/internal/ast/index.d.ts +0 -5
  256. package/dist/types/src/internal/ast/index.d.ts.map +0 -1
  257. package/dist/types/src/internal/ast/types.d.ts +0 -6
  258. package/dist/types/src/internal/ast/types.d.ts.map +0 -1
  259. package/dist/types/src/internal/json/annotations.d.ts.map +0 -1
  260. package/dist/types/src/internal/json/effect-schema.test.d.ts.map +0 -1
  261. package/dist/types/src/internal/json/index.d.ts +0 -2
  262. package/dist/types/src/internal/json/index.d.ts.map +0 -1
  263. package/dist/types/src/internal/json/json-schema.d.ts.map +0 -1
  264. package/dist/types/src/internal/json/json-schema.test.d.ts.map +0 -1
  265. package/dist/types/src/internal/object/accessors.d.ts +0 -29
  266. package/dist/types/src/internal/object/accessors.d.ts.map +0 -1
  267. package/dist/types/src/internal/object/create.d.ts.map +0 -1
  268. package/dist/types/src/internal/object/create.test.d.ts +0 -2
  269. package/dist/types/src/internal/object/create.test.d.ts.map +0 -1
  270. package/dist/types/src/internal/object/entity.d.ts +0 -22
  271. package/dist/types/src/internal/object/entity.d.ts.map +0 -1
  272. package/dist/types/src/internal/object/expando.d.ts.map +0 -1
  273. package/dist/types/src/internal/object/meta.d.ts.map +0 -1
  274. package/dist/types/src/internal/object/model.d.ts +0 -117
  275. package/dist/types/src/internal/object/model.d.ts.map +0 -1
  276. package/dist/types/src/internal/object/relation.d.ts +0 -17
  277. package/dist/types/src/internal/object/relation.d.ts.map +0 -1
  278. package/dist/types/src/internal/object/typed-relation.d.ts +0 -32
  279. package/dist/types/src/internal/object/typed-relation.d.ts.map +0 -1
  280. package/dist/types/src/internal/object/typename.d.ts +0 -15
  281. package/dist/types/src/internal/object/typename.d.ts.map +0 -1
  282. package/dist/types/src/internal/object/version.d.ts.map +0 -1
  283. package/dist/types/src/internal/projection/compose.d.ts.map +0 -1
  284. package/dist/types/src/internal/projection/compose.test.d.ts.map +0 -1
  285. package/dist/types/src/internal/projection/index.d.ts +0 -2
  286. package/dist/types/src/internal/projection/index.d.ts.map +0 -1
  287. package/dist/types/src/internal/proxy/reactive-object.d.ts +0 -15
  288. package/dist/types/src/internal/proxy/reactive-object.d.ts.map +0 -1
  289. package/dist/types/src/internal/query/index.d.ts +0 -2
  290. package/dist/types/src/internal/query/index.d.ts.map +0 -1
  291. package/dist/types/src/internal/query/query.d.ts.map +0 -1
  292. package/dist/types/src/internal/schema/stored-schema.d.ts +0 -13
  293. package/dist/types/src/internal/schema/stored-schema.d.ts.map +0 -1
  294. package/dist/types/src/internal/testing/index.d.ts +0 -3
  295. package/dist/types/src/internal/testing/index.d.ts.map +0 -1
  296. package/dist/types/src/internal/testing/types.d.ts +0 -455
  297. package/dist/types/src/internal/testing/types.d.ts.map +0 -1
  298. package/dist/types/src/internal/testing/utils.d.ts.map +0 -1
  299. package/dist/types/src/internal/types/types.d.ts +0 -79
  300. package/dist/types/src/internal/types/types.d.ts.map +0 -1
  301. package/dist/types/src/internal/types/types.test.d.ts +0 -2
  302. package/dist/types/src/internal/types/types.test.d.ts.map +0 -1
  303. package/dist/types/src/internal/types/util.d.ts +0 -5
  304. package/dist/types/src/internal/types/util.d.ts.map +0 -1
  305. package/dist/types/src/query/tag.d.ts +0 -18
  306. package/dist/types/src/query/tag.d.ts.map +0 -1
  307. package/dist/types/src/testing/echo-schema.d.ts +0 -7
  308. package/dist/types/src/testing/echo-schema.d.ts.map +0 -1
  309. package/dist/types/src/testing/types.d.ts +0 -113
  310. package/dist/types/src/testing/types.d.ts.map +0 -1
  311. package/src/internal/ast/annotation-helper.ts +0 -22
  312. package/src/internal/ast/annotations.ts +0 -212
  313. package/src/internal/ast/index.ts +0 -8
  314. package/src/internal/ast/types.ts +0 -17
  315. package/src/internal/json/index.ts +0 -5
  316. package/src/internal/object/accessors.ts +0 -115
  317. package/src/internal/object/entity.ts +0 -204
  318. package/src/internal/object/model.ts +0 -170
  319. package/src/internal/object/relation.ts +0 -24
  320. package/src/internal/object/typed-relation.ts +0 -85
  321. package/src/internal/object/typename.ts +0 -61
  322. package/src/internal/object/version.ts +0 -22
  323. package/src/internal/projection/index.ts +0 -5
  324. package/src/internal/query/index.ts +0 -5
  325. package/src/internal/schema/stored-schema.ts +0 -26
  326. package/src/internal/testing/index.ts +0 -6
  327. package/src/internal/testing/types.ts +0 -211
  328. package/src/internal/types/types.test.ts +0 -48
  329. package/src/internal/types/types.ts +0 -176
  330. package/src/internal/types/util.ts +0 -9
  331. package/src/query/tag.ts +0 -35
  332. package/src/test/api.test.ts +0 -180
  333. package/src/testing/echo-schema.ts +0 -39
  334. package/src/testing/types.ts +0 -91
  335. /package/dist/types/src/internal/{ast → annotations}/annotations.test.d.ts +0 -0
  336. /package/dist/types/src/internal/{json → json-schema}/annotations.d.ts +0 -0
  337. /package/dist/types/src/internal/{json → json-schema}/effect-schema.test.d.ts +0 -0
  338. /package/dist/types/src/internal/{json → json-schema}/json-schema.test.d.ts +0 -0
  339. /package/dist/types/src/internal/{projection → schema}/compose.d.ts +0 -0
  340. /package/dist/types/src/internal/{projection → schema}/compose.test.d.ts +0 -0
  341. /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
  342. /package/src/internal/{json → json-schema}/effect-schema.test.ts +0 -0
  343. /package/src/{internal/query/query.ts → query/types.ts} +0 -0
package/src/Obj.ts CHANGED
@@ -5,53 +5,89 @@
5
5
  import * as Function from 'effect/Function';
6
6
  import * as Schema from 'effect/Schema';
7
7
 
8
+ import { type ForeignKey } from '@dxos/echo-protocol';
8
9
  import { assertArgument, invariant } from '@dxos/invariant';
9
- import { type DXN } from '@dxos/keys';
10
- import * as LiveObject from '@dxos/live-object';
10
+ import { type DXN, ObjectId } from '@dxos/keys';
11
+ import { getSnapshot as getSnapshot$ } from '@dxos/live-object';
11
12
  import { assumeType, deepMapValues } from '@dxos/util';
12
13
 
13
- import { live } from './internal';
14
- import * as EchoSchema from './internal';
15
- import type * as Ref from './Ref';
16
- import type * as Relation from './Relation';
14
+ import * as Entity from './Entity';
15
+ import {
16
+ type AnyEchoObject,
17
+ type AnyProperties,
18
+ type InternalObjectProps,
19
+ MetaId,
20
+ type ObjectJSON,
21
+ type ObjectMeta,
22
+ ObjectVersionId,
23
+ VersionTypeId,
24
+ getDescription as getDescription$,
25
+ getLabel as getLabel$,
26
+ getMeta as getMeta$,
27
+ getObjectDXN,
28
+ getSchema as getSchema$,
29
+ getSchemaTypename,
30
+ getTypeAnnotation,
31
+ getTypeDXN as getTypeDXN$,
32
+ isDeleted as isDeleted$,
33
+ isInstanceOf,
34
+ makeObject,
35
+ objectFromJSON,
36
+ objectToJSON,
37
+ setDescription as setDescription$,
38
+ setLabel as setLabel$,
39
+ } from './internal';
40
+ import * as Ref from './Ref';
17
41
  import * as Type from './Type';
18
42
 
19
43
  /**
20
- * NOTE: Don't export: Obj.Any and Obj.Obj form the public API.
44
+ * Base type for all ECHO objects.
45
+ * @private
21
46
  */
22
- interface BaseObj extends EchoSchema.HasId, Type.OfKind<EchoSchema.EntityKind.Object> {}
47
+ interface BaseObj extends AnyEchoObject, Entity.OfKind<typeof Entity.Kind.Object> {}
23
48
 
24
49
  /**
25
- * Object type with specific properties.
26
- */
27
- export type Obj<Props> = BaseObj & Props;
28
-
29
- /**
30
- * Base type for all ECHO objects.
50
+ * Base type for all Obj objects.
31
51
  */
32
52
  export interface Any extends BaseObj {}
33
53
 
34
54
  export const Any = Schema.Struct({}).pipe(
35
55
  Type.Obj({
36
- typename: 'dxos.org/types/Any',
56
+ typename: 'dxos.org/type/Any',
37
57
  version: '0.1.0',
38
58
  }),
39
59
  );
40
60
 
41
- type Props<T = any> = { id?: EchoSchema.ObjectId } & Type.Properties<T>;
42
-
43
- export type MakeProps<T extends Type.Obj.Any> = NoInfer<Props<Schema.Schema.Type<T>>> & {
44
- [Meta]?: Partial<EchoSchema.ObjectMeta>;
45
- };
61
+ /**
62
+ * Object type with specific properties.
63
+ */
64
+ export type Obj<Props> = BaseObj & Props;
46
65
 
47
- export const Meta: unique symbol = EchoSchema.MetaId as any;
66
+ /**
67
+ * Object with arbitrary properties.
68
+ *
69
+ * NOTE: Due to how typescript works, this type is not assignable to a specific schema type.
70
+ * In that case, use `Obj.instanceOf` to check if an object is of a specific type.
71
+ */
72
+ export interface AnyProps extends BaseObj, AnyProperties {}
48
73
 
49
- const DEFAULT_META: EchoSchema.ObjectMeta = {
74
+ const defaultMeta: ObjectMeta = {
50
75
  keys: [],
51
76
  };
52
77
 
78
+ type Props<T = any> = {
79
+ id?: ObjectId;
80
+ [Meta]?: Partial<ObjectMeta>;
81
+ } & Type.Properties<T>;
82
+
83
+ // TODO(burdon): Should we allow the caller to set the id?
84
+ export type MakeProps<T extends Schema.Schema.AnyNoContext> = {
85
+ id?: ObjectId;
86
+ [Meta]?: Partial<ObjectMeta>;
87
+ } & NoInfer<Props<Schema.Schema.Type<T>>>;
88
+
53
89
  /**
54
- * Creates new object.
90
+ * Creates a new object of the given types.
55
91
  * @param schema - Object schema.
56
92
  * @param props - Object properties.
57
93
  * @param meta - Object metadata (deprecated) -- pass with Obj.Meta.
@@ -63,38 +99,96 @@ const DEFAULT_META: EchoSchema.ObjectMeta = {
63
99
  * const obj = Obj.make(Person, { [Obj.Meta]: { keys: [...] }, name: 'John' });
64
100
  * ```
65
101
  */
66
- export const make = <S extends Type.Obj.Any>(
102
+ export const make = <S extends Schema.Schema.AnyNoContext>(
67
103
  schema: S,
68
104
  props: MakeProps<S>,
69
- meta?: Partial<EchoSchema.ObjectMeta>,
70
- ): LiveObject.Live<Schema.Schema.Type<S>> => {
71
- assertArgument(
72
- EchoSchema.getTypeAnnotation(schema)?.kind === EchoSchema.EntityKind.Object,
73
- 'schema',
74
- 'Expected an object schema',
75
- );
76
-
77
- if (props[EchoSchema.MetaId] != null) {
78
- // Set default fields on meta on creation.
79
- meta = { ...structuredClone(DEFAULT_META), ...props[EchoSchema.MetaId] };
80
- delete props[EchoSchema.MetaId];
105
+ meta?: Partial<ObjectMeta>,
106
+ ): Obj<Schema.Schema.Type<S>> => {
107
+ assertArgument(getTypeAnnotation(schema)?.kind === Entity.Kind.Object, 'schema', 'Expected an object schema');
108
+
109
+ // Set default fields on meta on creation.
110
+ if (props[MetaId] != null) {
111
+ meta = { ...structuredClone(defaultMeta), ...props[MetaId] };
112
+ delete props[MetaId];
81
113
  }
82
114
 
83
- return live<Schema.Schema.Type<S>>(schema, props as any, { keys: [], ...meta });
115
+ // Filter undefined values.
116
+ const filterUndefined = Object.fromEntries(Object.entries(props).filter(([_, v]) => v !== undefined));
117
+
118
+ return makeObject<Schema.Schema.Type<S>>(schema, filterUndefined as any, {
119
+ ...defaultMeta,
120
+ ...meta,
121
+ });
84
122
  };
85
123
 
124
+ /**
125
+ * Determine if object is an ECHO object.
126
+ */
86
127
  export const isObject = (obj: unknown): obj is Any => {
87
- assumeType<EchoSchema.InternalObjectProps>(obj);
88
- return typeof obj === 'object' && obj !== null && obj[EchoSchema.EntityKindId] === EchoSchema.EntityKind.Object;
128
+ assumeType<InternalObjectProps>(obj);
129
+ return typeof obj === 'object' && obj !== null && obj[Entity.KindId] === Entity.Kind.Object;
89
130
  };
90
131
 
132
+ //
133
+ // Snapshot
134
+ //
135
+
136
+ /**
137
+ * Returns an immutable snapshot of an object.
138
+ */
139
+ export const getSnapshot: <T extends Any>(obj: Obj<T>) => T = getSnapshot$;
140
+
141
+ export type CloneOptions = {
142
+ /**
143
+ * Retain the original object's ID.
144
+ * @default false
145
+ */
146
+ retainId?: boolean;
147
+ };
148
+
149
+ /**
150
+ * Clones an object or relation.
151
+ * This does not clone referenced objects, only the properties in the object.
152
+ * @returns A new object with the same schema and properties.
153
+ */
154
+ export const clone = <T extends Any>(obj: T, opts?: CloneOptions): T => {
155
+ const { id, ...data } = obj;
156
+ const schema = getSchema$(obj);
157
+ invariant(schema != null, 'Object should have a schema');
158
+ const props: any = deepMapValues(data, (value, recurse) => {
159
+ if (Ref.isRef(value)) {
160
+ return value;
161
+ }
162
+ return recurse(value);
163
+ });
164
+
165
+ if (opts?.retainId) {
166
+ props.id = id;
167
+ }
168
+ const meta = getMeta(obj);
169
+ props[MetaId] = deepMapValues(meta, (value, recurse) => {
170
+ if (Ref.isRef(value)) {
171
+ return value;
172
+ }
173
+ return recurse(value);
174
+ });
175
+
176
+ return make(schema as Type.Obj.Any, props);
177
+ };
178
+
179
+ //
180
+ // Type
181
+ //
182
+
183
+ // TODO(burdon): To discuss: prefer over ObjectId or Key.ObjectId or Type.ID?
184
+ export const ID = ObjectId;
185
+ export type ID = ObjectId;
186
+
91
187
  /**
92
188
  * Test if object or relation is an instance of a schema.
93
189
  * @example
94
190
  * ```ts
95
191
  * const john = Obj.make(Person, { name: 'John' });
96
- * const johnIsPerson = Obj.instanceOf(Person)(john);
97
- *
98
192
  * const isPerson = Obj.instanceOf(Person);
99
193
  * if (isPerson(john)) {
100
194
  * // john is Person
@@ -102,52 +196,60 @@ export const isObject = (obj: unknown): obj is Any => {
102
196
  * ```
103
197
  */
104
198
  export const instanceOf: {
105
- <S extends Type.Relation.Any | Type.Obj.Any>(schema: S): (value: unknown) => value is Schema.Schema.Type<S>;
106
- <S extends Type.Relation.Any | Type.Obj.Any>(schema: S, value: unknown): value is Schema.Schema.Type<S>;
107
- } = ((
108
- ...args: [schema: Type.Relation.Any | Type.Obj.Any, value: unknown] | [schema: Type.Relation.Any | Type.Obj.Any]
109
- ) => {
199
+ <S extends Type.Entity.Any>(schema: S): (value: unknown) => value is Schema.Schema.Type<S>;
200
+ <S extends Type.Entity.Any>(schema: S, value: unknown): value is Schema.Schema.Type<S>;
201
+ } = ((...args: [schema: Type.Entity.Any, value: unknown] | [schema: Type.Entity.Any]) => {
110
202
  if (args.length === 1) {
111
- return (obj: unknown) => EchoSchema.isInstanceOf(args[0], obj);
203
+ return (entity: unknown) => isInstanceOf(args[0], entity);
112
204
  }
113
205
 
114
- return EchoSchema.isInstanceOf(args[0], args[1]);
206
+ return isInstanceOf(args[0], args[1]);
115
207
  }) as any;
116
208
 
117
- export const getSchema = EchoSchema.getSchema;
118
-
119
209
  // TODO(dmaretskyi): Allow returning undefined.
120
- export const getDXN = (obj: Any | Relation.Any): DXN => {
121
- assertArgument(!Schema.isSchema(obj), 'obj', 'Object should not be a schema.');
122
- const dxn = EchoSchema.getObjectDXN(obj);
210
+ export const getDXN = (entity: Entity.Unknown): DXN => {
211
+ assertArgument(!Schema.isSchema(entity), 'obj', 'Object should not be a schema.');
212
+ const dxn = getObjectDXN(entity);
123
213
  invariant(dxn != null, 'Invalid object.');
124
214
  return dxn;
125
215
  };
126
216
 
127
217
  /**
128
218
  * @returns The DXN of the object's type.
129
- * @example dxn:example.com/type/Contact:1.0.0
219
+ * @example dxn:example.com/type/Person:1.0.0
220
+ */
221
+ // TODO(burdon): Must define and return type for expando.
222
+ export const getTypeDXN = getTypeDXN$;
223
+
224
+ /**
225
+ * Get the schema of the object.
130
226
  */
131
- // TODO(burdon): Expando does not have a type.
132
- export const getTypeDXN = EchoSchema.getType;
227
+ export const getSchema = getSchema$;
133
228
 
134
229
  /**
135
230
  * @returns The typename of the object's type.
136
- * @example `example.com/type/Contact`
231
+ * @example `example.com/type/Person`
137
232
  */
138
- export const getTypename = (obj: Any | Relation.Any): string | undefined => {
139
- const schema = getSchema(obj);
233
+ export const getTypename = (entity: Entity.Unknown): string | undefined => {
234
+ const schema = getSchema$(entity);
140
235
  if (schema == null) {
141
236
  // Try to extract typename from DXN.
142
- return EchoSchema.getType(obj)?.asTypeDXN()?.type;
237
+ return getTypeDXN$(entity)?.asTypeDXN()?.type;
143
238
  }
144
239
 
145
- return EchoSchema.getSchemaTypename(schema);
240
+ return getSchemaTypename(schema);
146
241
  };
147
242
 
243
+ //
244
+ // Meta
245
+ //
246
+
247
+ export const Meta: unique symbol = MetaId as any;
248
+
249
+ // TODO(burdon): Narrow type.
148
250
  // TODO(dmaretskyi): Allow returning undefined.
149
- export const getMeta = (obj: Any | Relation.Any): EchoSchema.ObjectMeta => {
150
- const meta = EchoSchema.getMeta(obj);
251
+ export const getMeta = (entity: AnyProperties): ObjectMeta => {
252
+ const meta = getMeta$(entity);
151
253
  invariant(meta != null, 'Invalid object.');
152
254
  return meta;
153
255
  };
@@ -156,21 +258,21 @@ export const getMeta = (obj: Any | Relation.Any): EchoSchema.ObjectMeta => {
156
258
  * @returns Foreign keys for the object from the specified source.
157
259
  */
158
260
  export const getKeys: {
159
- (obj: Any | Relation.Any, source: string): EchoSchema.ForeignKey[];
160
- (source: string): (obj: Any | Relation.Any) => EchoSchema.ForeignKey[];
161
- } = Function.dual(2, (obj: Any | Relation.Any, source?: string): EchoSchema.ForeignKey[] => {
162
- const meta = EchoSchema.getMeta(obj);
261
+ (entity: Entity.Unknown, source: string): ForeignKey[];
262
+ (source: string): (entity: Entity.Unknown) => ForeignKey[];
263
+ } = Function.dual(2, (entity: Entity.Unknown, source?: string): ForeignKey[] => {
264
+ const meta = getMeta(entity);
163
265
  invariant(meta != null, 'Invalid object.');
164
266
  return meta.keys.filter((key) => key.source === source);
165
267
  });
166
268
 
167
269
  /**
168
270
  * Delete all keys from the object for the specified source.
169
- * @param obj
271
+ * @param entity
170
272
  * @param source
171
273
  */
172
- export const deleteKeys = (obj: Any | Relation.Any, source: string) => {
173
- const meta = EchoSchema.getMeta(obj);
274
+ export const deleteKeys = (entity: Entity.Unknown, source: string) => {
275
+ const meta = getMeta(entity);
174
276
  for (let i = 0; i < meta.keys.length; i++) {
175
277
  if (meta.keys[i].source === source) {
176
278
  meta.keys.splice(i, 1);
@@ -179,124 +281,134 @@ export const deleteKeys = (obj: Any | Relation.Any, source: string) => {
179
281
  }
180
282
  };
181
283
 
284
+ export const addTag = (entity: Entity.Unknown, tag: string) => {
285
+ const meta = getMeta(entity);
286
+ meta.tags ??= [];
287
+ meta.tags.push(tag);
288
+ };
289
+
290
+ export const removeTag = (entity: Entity.Unknown, tag: string) => {
291
+ const meta = getMeta(entity);
292
+ if (!meta.tags) {
293
+ return;
294
+ }
295
+ for (let i = 0; i < meta.tags.length; i++) {
296
+ if (meta.tags[i] === tag) {
297
+ meta.tags.splice(i, 1);
298
+ i--;
299
+ }
300
+ }
301
+ };
302
+
182
303
  // TODO(dmaretskyi): Default to `false`.
183
- export const isDeleted = (obj: Any | Relation.Any): boolean => {
184
- const deleted = EchoSchema.isDeleted(obj);
304
+ export const isDeleted = (entity: Entity.Unknown): boolean => {
305
+ const deleted = isDeleted$(entity);
185
306
  invariant(typeof deleted === 'boolean', 'Invalid object.');
186
307
  return deleted;
187
308
  };
188
309
 
189
- export const getLabel = (obj: Any | Relation.Any): string | undefined => {
190
- const schema = getSchema(obj);
310
+ //
311
+ // Annotations
312
+ //
313
+
314
+ export const getLabel = (entity: Entity.Unknown): string | undefined => {
315
+ const schema = getSchema$(entity);
191
316
  if (schema != null) {
192
- return EchoSchema.getLabel(schema, obj);
317
+ return getLabel$(schema, entity);
193
318
  }
194
319
  };
195
320
 
196
- export const setLabel = (obj: Any | Relation.Any, label: string) => {
197
- const schema = getSchema(obj);
321
+ export const setLabel = (entity: Entity.Unknown, label: string) => {
322
+ const schema = getSchema$(entity);
198
323
  if (schema != null) {
199
- EchoSchema.setLabel(schema, obj, label);
324
+ setLabel$(schema, entity, label);
200
325
  }
201
326
  };
202
327
 
203
- const compare = (a?: string, b?: string) => {
204
- if (a == null) {
205
- return b == null ? 0 : 1;
328
+ export const getDescription = (entity: Entity.Unknown): string | undefined => {
329
+ const schema = getSchema$(entity);
330
+ if (schema != null) {
331
+ return getDescription$(schema, entity);
206
332
  }
333
+ };
207
334
 
208
- if (b == null) {
209
- return -1;
335
+ export const setDescription = (entity: Entity.Unknown, description: string) => {
336
+ const schema = getSchema$(entity);
337
+ if (schema != null) {
338
+ setDescription$(schema, entity, description);
210
339
  }
211
-
212
- return a.localeCompare(b);
213
340
  };
214
341
 
215
- export type Comparator = (a: Any, b: Any) => number;
216
-
217
- export const sortByLabel: Comparator = (a: Any, b: Any) => compare(getLabel(a), getLabel(b));
218
- export const sortByTypename: Comparator = (a: Any, b: Any) => compare(getTypename(a), getTypename(b));
219
- export const sort = (...comparators: Comparator[]): Comparator => {
220
- return (a: Any, b: Any) => {
221
- for (const comparator of comparators) {
222
- const result = comparator(a, b);
223
- if (result !== 0) {
224
- return result;
225
- }
226
- }
227
-
228
- return 0;
229
- };
230
- };
342
+ //
343
+ // JSON
344
+ //
231
345
 
232
346
  /**
233
347
  * JSON representation of an object.
234
348
  */
235
- export type JSON = EchoSchema.ObjectJSON;
349
+ export type JSON = ObjectJSON;
236
350
 
237
351
  /**
238
352
  * Converts object to its JSON representation.
239
353
  *
240
354
  * The same algorithm is used when calling the standard `JSON.stringify(obj)` function.
241
355
  */
242
- // TODO(burdon): Base util type for Obj/Relation?
243
- export const toJSON = (obj: Any | Relation.Any): JSON => EchoSchema.objectToJSON(obj);
356
+ export const toJSON = (entity: Entity.Unknown): JSON => objectToJSON(entity);
244
357
 
245
358
  /**
246
359
  * Creates an object from its json representation, performing schema validation.
247
360
  * References and schemas will be resolvable if the `refResolver` is provided.
248
361
  *
249
- * The function need to be async to support resolving the schema as well as the relation endpoints.
362
+ * The function must be async to support resolving the schema as well as the relation endpoints.
250
363
  *
251
364
  * @param options.refResolver - Resolver for references. Produces hydrated references that can be resolved.
252
365
  * @param options.dxn - Override object DXN. Changes the result of `Obj.getDXN`.
253
366
  */
254
367
  export const fromJSON: (json: unknown, options?: { refResolver?: Ref.Resolver; dxn?: DXN }) => Promise<Any> =
255
- EchoSchema.objectFromJSON as any;
368
+ objectFromJSON as any;
256
369
 
257
- /**
258
- * Returns an immutable snapshot of an object.
259
- */
260
- export const getSnapshot: <T extends Any>(obj: Obj<T>) => T = LiveObject.getSnapshot;
370
+ //
371
+ // Sorting
372
+ //
261
373
 
262
- export type CloneOptions = {
263
- /**
264
- * Retain the original object's ID.
265
- * @default false
266
- */
267
- retainId?: boolean;
268
- };
374
+ const compare = (a?: string, b?: string) => {
375
+ if (a == null) {
376
+ return b == null ? 0 : 1;
377
+ }
269
378
 
270
- /**
271
- * Clones an object or relation.
272
- * This does not clone referenced objects, only the properties in the object.
273
- * @returns A new object with the same schema and properties.
274
- */
275
- export const clone = <T extends Any | Relation.Any>(obj: T, opts?: CloneOptions): T => {
276
- const { id, ...data } = obj;
277
- const schema = getSchema(obj);
278
- invariant(schema != null, 'Object should have a schema');
279
- const props: any = deepMapValues(data, (value, recurse) => {
280
- if (EchoSchema.Ref.isRef(value)) {
281
- return value;
282
- }
283
- return recurse(value);
284
- });
285
- if (opts?.retainId) {
286
- props.id = id;
379
+ if (b == null) {
380
+ return -1;
287
381
  }
288
- const meta = getMeta(obj);
289
- props[EchoSchema.MetaId] = deepMapValues(meta, (value, recurse) => {
290
- if (EchoSchema.Ref.isRef(value)) {
291
- return value;
382
+
383
+ return a.localeCompare(b);
384
+ };
385
+
386
+ export type Comparator = (a: Entity.Unknown, b: Entity.Unknown) => number;
387
+
388
+ export const sortByLabel: Comparator = (a: Entity.Unknown, b: Entity.Unknown) => compare(getLabel(a), getLabel(b));
389
+ export const sortByTypename: Comparator = (a: Entity.Unknown, b: Entity.Unknown) =>
390
+ compare(getTypename(a), getTypename(b));
391
+ export const sort = (...comparators: Comparator[]): Comparator => {
392
+ return (a: Entity.Unknown, b: Entity.Unknown) => {
393
+ for (const comparator of comparators) {
394
+ const result = comparator(a, b);
395
+ if (result !== 0) {
396
+ return result;
397
+ }
292
398
  }
293
- return recurse(value);
294
- });
295
- return make(schema, props);
399
+
400
+ return 0;
401
+ };
296
402
  };
297
403
 
298
- export const VersionTypeId = EchoSchema.VersionTypeId;
299
- export type VersionType = typeof VersionTypeId;
404
+ //
405
+ // Version
406
+ //
407
+
408
+ /**
409
+ * Unique symbol for version type identification.
410
+ */
411
+ export { VersionTypeId };
300
412
 
301
413
  /**
302
414
  * Represent object version.
@@ -325,18 +437,19 @@ const unversioned: Version = {
325
437
  /**
326
438
  * Checks that `obj` is a version object.
327
439
  */
328
- export const isVersion = (obj: unknown): obj is Version => {
329
- return obj != null && typeof obj === 'object' && VersionTypeId in obj;
440
+ export const isVersion = (entity: unknown): entity is Version => {
441
+ return entity != null && typeof entity === 'object' && VersionTypeId in entity;
330
442
  };
331
443
 
332
444
  /**
333
445
  * Returns the version of the object.
334
446
  */
335
- export const version = (obj: Any | Relation.Any): Version => {
336
- const version = (obj as any)[EchoSchema.ObjectVersionId];
447
+ export const version = (entity: Entity.Unknown): Version => {
448
+ const version = (entity as any)[ObjectVersionId];
337
449
  if (version === undefined) {
338
450
  return unversioned;
339
451
  }
452
+
340
453
  return version;
341
454
  };
342
455
 
package/src/Ref.ts CHANGED
@@ -2,27 +2,27 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import * as EchoSchema from './internal';
5
+ import { Ref as Ref$, RefArray, type RefResolver } from './internal';
6
6
  import type * as Obj from './Obj';
7
7
 
8
- export type Ref<T> = EchoSchema.Ref<T>;
9
- export type Any = EchoSchema.Ref<Obj.Any>;
8
+ export type Ref<T> = Ref$<T>;
9
+ export type Any = Ref$<Obj.Any>;
10
10
 
11
- export const Array = EchoSchema.RefArray;
11
+ export const Array = RefArray;
12
12
 
13
13
  /**
14
14
  * Extract reference target.
15
15
  */
16
- export type Target<R extends Any> = R extends EchoSchema.Ref<infer T> ? T : never;
16
+ export type Target<R extends Any> = R extends Ref$<infer T> ? T : never;
17
17
 
18
18
  /**
19
19
  * Reference resolver.
20
20
  */
21
- export type Resolver = EchoSchema.RefResolver;
21
+ export type Resolver = RefResolver;
22
22
 
23
- export const isRef: (value: unknown) => value is Any = EchoSchema.Ref.isRef;
23
+ export const isRef: (value: unknown) => value is Any = Ref$.isRef;
24
24
 
25
- export const make = EchoSchema.Ref.make;
25
+ export const make = Ref$.make;
26
26
 
27
27
  // TODO(dmaretskyi): Consider just allowing `make` to accept DXN.
28
- export const fromDXN = EchoSchema.Ref.fromDXN;
28
+ export const fromDXN = Ref$.fromDXN;