@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
@@ -11,21 +11,22 @@ import { type JsonProp, findAnnotation } from '@dxos/effect';
11
11
  import { ObjectId } from '@dxos/keys';
12
12
  import { log } from '@dxos/log';
13
13
 
14
+ import { TestSchema, prepareAstForCompare } from '../../testing';
15
+ import * as Type from '../../Type';
14
16
  import {
15
- EntityKind,
16
17
  FieldLookupAnnotationId,
17
18
  GeneratorAnnotation,
18
19
  LabelAnnotation,
19
20
  PropertyMeta,
20
21
  getTypeAnnotation,
21
22
  getTypeIdentifierAnnotation,
22
- } from '../ast';
23
- import { Email, FormatAnnotation, FormatEnum } from '../formats';
23
+ } from '../annotations';
24
+ import { EchoObjectSchema } from '../entities';
25
+ import { Email, FormatAnnotation, TypeFormat } from '../formats';
24
26
  import { JsonSchemaType, getNormalizedEchoAnnotations, getSchemaProperty, setSchemaProperty } from '../json-schema';
25
- import { EchoObject, TypedObject } from '../object';
26
27
  import { Ref, createSchemaReference, getReferenceAst, getSchemaReference } from '../ref';
27
- import { StoredSchema } from '../schema';
28
- import { Testing, prepareAstForCompare } from '../testing';
28
+ import { PersistentSchema } from '../schema';
29
+ import { EntityKind } from '../types';
29
30
 
30
31
  import { toEffectSchema, toJsonSchema } from './json-schema';
31
32
 
@@ -33,10 +34,12 @@ const EXAMPLE_NAMESPACE = '@example';
33
34
 
34
35
  describe('effect-to-json', () => {
35
36
  test('type annotation', () => {
36
- class Test extends TypedObject({
37
- typename: 'example.com/type/Test',
38
- version: '0.1.0',
39
- })({ name: Schema.String }) {}
37
+ const Test = Schema.Struct({ name: Schema.String }).pipe(
38
+ Type.Obj({
39
+ typename: 'example.com/type/Test',
40
+ version: '0.1.0',
41
+ }),
42
+ );
40
43
  const jsonSchema = toJsonSchema(Test);
41
44
  expect((jsonSchema as any).$id).toEqual('dxn:type:example.com/type/Test');
42
45
  expect((jsonSchema as any).version).toEqual('0.1.0');
@@ -44,23 +47,35 @@ describe('effect-to-json', () => {
44
47
 
45
48
  test('property meta annotation', () => {
46
49
  const meta = { maxLength: 0 };
47
- class Test extends TypedObject({
48
- typename: 'example.com/type/Test',
49
- version: '0.1.0',
50
- })({
50
+ const Test = Schema.Struct({
51
51
  name: Schema.String.pipe(PropertyMeta(EXAMPLE_NAMESPACE, meta)),
52
- }) {}
52
+ }).pipe(
53
+ Type.Obj({
54
+ typename: 'example.com/type/Test',
55
+ version: '0.1.0',
56
+ }),
57
+ );
53
58
  const jsonSchema = toJsonSchema(Test);
54
59
  expect(getNormalizedEchoAnnotations(jsonSchema.properties!.name!)!.meta![EXAMPLE_NAMESPACE]).to.deep.eq(meta);
55
60
  });
56
61
 
57
62
  test('reference annotation', () => {
58
- class Nested extends TypedObject({ typename: 'example.com/type/TestNested', version: '0.1.0' })({
63
+ const Nested = Schema.Struct({
59
64
  name: Schema.String,
60
- }) {}
61
- class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
65
+ }).pipe(
66
+ Type.Obj({
67
+ typename: 'example.com/type/TestNested',
68
+ version: '0.1.0',
69
+ }),
70
+ );
71
+ const Test = Schema.Struct({
62
72
  name: Ref(Nested),
63
- }) {}
73
+ }).pipe(
74
+ Type.Obj({
75
+ typename: 'example.com/type/Test',
76
+ version: '0.1.0',
77
+ }),
78
+ );
64
79
  const jsonSchema = toJsonSchema(Test);
65
80
  // log.info('schema', { jsonSchema });
66
81
  const nested = jsonSchema.properties!.name;
@@ -70,12 +85,22 @@ describe('effect-to-json', () => {
70
85
  // TODO(ZaymonFC): @dmaretskyi we still need to fix this.
71
86
  // TODO(dmaretskyi): Remove FieldLookupAnnotationId.
72
87
  test.skip('reference annotation with lookup property', () => {
73
- class Nested extends TypedObject({ typename: 'example.com/type/TestNested', version: '0.1.0' })({
88
+ const Nested = Schema.Struct({
74
89
  name: Schema.String,
75
- }) {}
76
- class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
90
+ }).pipe(
91
+ Type.Obj({
92
+ typename: 'example.com/type/TestNested',
93
+ version: '0.1.0',
94
+ }),
95
+ );
96
+ const Test = Schema.Struct({
77
97
  name: Ref(Nested).annotations({ [FieldLookupAnnotationId]: 'name' }),
78
- }) {}
98
+ }).pipe(
99
+ Type.Obj({
100
+ typename: 'example.com/type/Test',
101
+ version: '0.1.0',
102
+ }),
103
+ );
79
104
  const jsonSchema = toJsonSchema(Test);
80
105
  const effectSchema = toEffectSchema(jsonSchema);
81
106
 
@@ -84,24 +109,44 @@ describe('effect-to-json', () => {
84
109
  });
85
110
 
86
111
  test('array of references', () => {
87
- class Nested extends TypedObject({ typename: 'example.com/type/TestNested', version: '0.1.0' })({
112
+ const Nested = Schema.Struct({
88
113
  name: Schema.String,
89
- }) {}
90
- class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
114
+ }).pipe(
115
+ Type.Obj({
116
+ typename: 'example.com/type/TestNested',
117
+ version: '0.1.0',
118
+ }),
119
+ );
120
+ const Test = Schema.Struct({
91
121
  name: Schema.Array(Ref(Nested)),
92
- }) {}
122
+ }).pipe(
123
+ Type.Obj({
124
+ typename: 'example.com/type/Test',
125
+ version: '0.1.0',
126
+ }),
127
+ );
93
128
 
94
129
  const jsonSchema = toJsonSchema(Test);
95
130
  expectReferenceAnnotation((jsonSchema.properties!.name as any).items);
96
131
  });
97
132
 
98
133
  test('optional references', () => {
99
- class Nested extends TypedObject({ typename: 'example.com/type/TestNested', version: '0.1.0' })({
134
+ const Nested = Schema.Struct({
100
135
  name: Schema.String,
101
- }) {}
102
- class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })({
136
+ }).pipe(
137
+ Type.Obj({
138
+ typename: 'example.com/type/TestNested',
139
+ version: '0.1.0',
140
+ }),
141
+ );
142
+ const Test = Schema.Struct({
103
143
  name: Schema.optional(Ref(Nested)),
104
- }) {}
144
+ }).pipe(
145
+ Type.Obj({
146
+ typename: 'example.com/type/Test',
147
+ version: '0.1.0',
148
+ }),
149
+ );
105
150
  const jsonSchema = toJsonSchema(Test);
106
151
  expectReferenceAnnotation(jsonSchema.properties!.name);
107
152
  });
@@ -114,19 +159,25 @@ describe('effect-to-json', () => {
114
159
  });
115
160
 
116
161
  test('annotations', () => {
117
- class TestSchema extends TypedObject({ typename: 'example.com/type/Contact', version: '0.1.0' })({
162
+ const TempSchema = Schema.Struct({
118
163
  name: Schema.String.annotations({ description: 'Person name', title: 'Name' }),
119
- email: Schema.String.pipe(FormatAnnotation.set(FormatEnum.Email)).annotations({
164
+ email: Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email)).annotations({
120
165
  description: 'Email address',
121
166
  }),
122
- }) {}
123
- const jsonSchema = toJsonSchema(TestSchema);
167
+ }).pipe(
168
+ Type.Obj({
169
+ typename: 'example.com/type/Person',
170
+ version: '0.1.0',
171
+ }),
172
+ );
173
+
174
+ const jsonSchema = toJsonSchema(TempSchema);
124
175
  expect(jsonSchema).to.deep.eq({
125
176
  $schema: 'http://json-schema.org/draft-07/schema#',
126
- $id: 'dxn:type:example.com/type/Contact',
177
+ $id: 'dxn:type:example.com/type/Person',
127
178
 
128
179
  entityKind: EntityKind.Object,
129
- typename: 'example.com/type/Contact',
180
+ typename: 'example.com/type/Person',
130
181
  version: '0.1.0',
131
182
 
132
183
  type: 'object',
@@ -147,37 +198,47 @@ describe('effect-to-json', () => {
147
198
  });
148
199
 
149
200
  test('handles suspend -- Contact schema serialization', () => {
150
- const schema = toJsonSchema(Testing.Contact);
201
+ const schema = toJsonSchema(TestSchema.Person);
151
202
  expect(Object.keys(schema.properties!)).toEqual([
152
203
  'id',
153
204
  'name',
154
205
  'username',
155
206
  'email',
156
- 'phoneNumbers',
157
207
  'tasks',
208
+ 'employer',
158
209
  'address',
159
210
  ]);
160
211
  });
161
212
 
162
213
  test('reference property by ref', () => {
163
- class Organization extends TypedObject({ typename: 'example.com/type/Organization', version: '0.1.0' })({
214
+ const Organization = Schema.Struct({
164
215
  field: Schema.String,
165
- }) {}
216
+ }).pipe(
217
+ Type.Obj({
218
+ typename: 'example.com/type/Organization',
219
+ version: '0.1.0',
220
+ }),
221
+ );
166
222
 
167
- class Contact extends TypedObject({ typename: 'example.com/type/Contact', version: '0.1.0' })({
223
+ const Contact = Schema.Struct({
168
224
  name: Schema.String,
169
225
  organization: Ref(Organization).annotations({ description: 'Contact organization' }),
170
- }) {}
226
+ }).pipe(
227
+ Type.Obj({
228
+ typename: 'example.com/type/Person',
229
+ version: '0.1.0',
230
+ }),
231
+ );
171
232
 
172
233
  // log.info('Contact', { ast: Contact.ast });
173
234
 
174
235
  const jsonSchema = toJsonSchema(Contact);
175
236
  expect(jsonSchema).toEqual({
176
237
  $schema: 'http://json-schema.org/draft-07/schema#',
177
- $id: 'dxn:type:example.com/type/Contact',
238
+ $id: 'dxn:type:example.com/type/Person',
178
239
 
179
240
  entityKind: EntityKind.Object,
180
- typename: 'example.com/type/Contact',
241
+ typename: 'example.com/type/Person',
181
242
  version: '0.1.0',
182
243
 
183
244
  type: 'object',
@@ -212,14 +273,24 @@ describe('effect-to-json', () => {
212
273
  });
213
274
 
214
275
  test('add reference property', () => {
215
- class Organization extends TypedObject({ typename: 'example.com/type/Organization', version: '0.1.0' })({
276
+ const Organization = Schema.Struct({
216
277
  field: Schema.String,
217
- }) {}
278
+ }).pipe(
279
+ Type.Obj({
280
+ typename: 'example.com/type/Organization',
281
+ version: '0.1.0',
282
+ }),
283
+ );
218
284
 
219
- class Contact extends TypedObject({ typename: 'example.com/type/Contact', version: '0.1.0' })({
285
+ const Contact = Schema.Struct({
220
286
  name: Schema.String,
221
287
  organization: Ref(Organization).annotations({ description: 'Contact organization' }),
222
- }) {}
288
+ }).pipe(
289
+ Type.Obj({
290
+ typename: 'example.com/type/Person',
291
+ version: '0.1.0',
292
+ }),
293
+ );
223
294
 
224
295
  const jsonSchema = toJsonSchema(Contact);
225
296
  setSchemaProperty(jsonSchema, 'organization' as JsonProp, createSchemaReference(Organization.typename));
@@ -227,8 +298,8 @@ describe('effect-to-json', () => {
227
298
  expect(typename).to.eq(Organization.typename);
228
299
  });
229
300
 
230
- test('serialize circular schema (StoredSchema)', () => {
231
- const jsonSchema = toJsonSchema(StoredSchema);
301
+ test('serialize circular schema (PersistentSchema)', () => {
302
+ const jsonSchema = toJsonSchema(PersistentSchema);
232
303
  expect(Object.keys(jsonSchema.properties!).length).toBeGreaterThan(0);
233
304
 
234
305
  // TODO(dmaretskyi): Currently unable to deserialize.
@@ -251,7 +322,7 @@ describe('effect-to-json', () => {
251
322
 
252
323
  test('reference with title annotation', () => {
253
324
  const schema = Schema.Struct({
254
- contact: Ref(Testing.Contact).annotations({ title: 'Custom Title' }),
325
+ contact: Ref(TestSchema.Person).annotations({ title: 'Custom Title' }),
255
326
  });
256
327
 
257
328
  // log.info('schema before', { ast: schema.ast });
@@ -274,33 +345,36 @@ describe('effect-to-json', () => {
274
345
  });
275
346
 
276
347
  test('relation schema', () => {
277
- const schema = Testing.HasManager;
348
+ const schema = TestSchema.EmployedBy;
278
349
  const jsonSchema = toJsonSchema(schema);
279
350
  expect(jsonSchema).toEqual({
280
- $id: 'dxn:type:example.com/type/HasManager',
351
+ $id: 'dxn:type:example.com/type/EmployedBy',
281
352
  $schema: 'http://json-schema.org/draft-07/schema#',
282
353
  entityKind: 'relation',
283
- typename: 'example.com/type/HasManager',
354
+ typename: 'example.com/type/EmployedBy',
284
355
  version: '0.1.0',
285
356
  relationSource: {
286
357
  // TODO(dmaretskyi): Should those point to specific schema version?
287
- $ref: 'dxn:type:example.com/type/Contact',
358
+ $ref: 'dxn:type:example.com/type/Person',
288
359
  },
289
360
  relationTarget: {
290
361
  // TODO(dmaretskyi): Should those point to specific schema version?
291
- $ref: 'dxn:type:example.com/type/Contact',
362
+ $ref: 'dxn:type:example.com/type/Organization',
292
363
  },
293
364
  type: 'object',
294
365
  properties: {
295
366
  id: {
296
367
  type: 'string',
297
368
  },
369
+ role: {
370
+ type: 'string',
371
+ },
298
372
  since: {
299
373
  type: 'string',
300
374
  },
301
375
  },
302
- propertyOrder: ['since', 'id'],
303
- required: ['id'],
376
+ propertyOrder: ['role', 'since', 'id'],
377
+ required: ['role', 'id'],
304
378
  additionalProperties: false,
305
379
  });
306
380
  });
@@ -310,7 +384,7 @@ describe('effect-to-json', () => {
310
384
  id: ObjectId,
311
385
  name: Schema.String,
312
386
  }).pipe(
313
- EchoObject({
387
+ EchoObjectSchema({
314
388
  typename: 'example.com/type/Organization',
315
389
  version: '0.1.0',
316
390
  }),
@@ -417,26 +491,35 @@ describe('json-to-effect', () => {
417
491
 
418
492
  for (const partial of [false, true]) {
419
493
  test(`deserialized equals original ${partial ? 'with partial' : ''}`, () => {
420
- class Organization extends TypedObject({ typename: 'example.com/type/Organization', version: '0.1.0' })({
494
+ const Organization = Schema.Struct({
421
495
  field: Schema.String,
422
- }) {}
423
-
424
- class Test extends TypedObject({ typename: 'example.com/type/Test', version: '0.1.0' })(
425
- {
426
- string: Schema.String,
427
- number: Schema.Number.pipe(PropertyMeta(EXAMPLE_NAMESPACE, { is_date: true })),
428
- boolean: Schema.Boolean,
429
- array: Schema.Array(Schema.String),
430
- twoDArray: Schema.Array(Schema.Array(Schema.String)),
431
- record: Schema.Record({ key: Schema.String, value: Schema.Number }),
432
- object: Schema.Struct({ id: Schema.String, field: Ref(Organization) }),
433
- echoObject: Ref(Organization),
434
- echoObjectArray: Schema.Array(Ref(Organization)),
435
- email: Schema.String.pipe(FormatAnnotation.set(FormatEnum.Email)),
436
- null: Schema.Null,
437
- },
438
- partial ? { partial } : {},
439
- ) {}
496
+ }).pipe(
497
+ Type.Obj({
498
+ typename: 'example.com/type/Organization',
499
+ version: '0.1.0',
500
+ }),
501
+ );
502
+
503
+ const fields = {
504
+ string: Schema.String,
505
+ number: Schema.Number.pipe(PropertyMeta(EXAMPLE_NAMESPACE, { is_date: true })),
506
+ boolean: Schema.Boolean,
507
+ array: Schema.Array(Schema.String),
508
+ twoDArray: Schema.Array(Schema.Array(Schema.String)),
509
+ record: Schema.Record({ key: Schema.String, value: Schema.Number }),
510
+ object: Schema.Struct({ id: Schema.String, field: Ref(Organization) }),
511
+ echoObject: Ref(Organization),
512
+ echoObjectArray: Schema.Array(Ref(Organization)),
513
+ email: Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email)),
514
+ null: Schema.Null,
515
+ } as const;
516
+
517
+ const Test = (partial ? Schema.partial(Schema.Struct(fields)) : Schema.Struct(fields)).pipe(
518
+ Type.Obj({
519
+ typename: 'example.com/type/Test',
520
+ version: '0.1.0',
521
+ }),
522
+ );
440
523
 
441
524
  const jsonSchema = toJsonSchema(Test);
442
525
  // log.info('schema', { jsonSchema });
@@ -499,8 +582,8 @@ describe('json-to-effect', () => {
499
582
  });
500
583
 
501
584
  test('symbol annotations get compared', () => {
502
- const schema1 = Schema.String.pipe(FormatAnnotation.set(FormatEnum.Email));
503
- const schema2 = Schema.String.pipe(FormatAnnotation.set(FormatEnum.Currency));
585
+ const schema1 = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Email));
586
+ const schema2 = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Currency));
504
587
  expect(prepareAstForCompare(schema1.ast)).not.to.deep.eq(prepareAstForCompare(schema2.ast));
505
588
  });
506
589
 
@@ -515,7 +598,7 @@ describe('json-to-effect', () => {
515
598
  });
516
599
 
517
600
  test('relation schema roundtrip', () => {
518
- const schema = Testing.HasManager;
601
+ const schema = TestSchema.HasManager;
519
602
  const jsonSchema = toJsonSchema(schema);
520
603
  const effectSchema = toEffectSchema(jsonSchema);
521
604
  expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(schema.ast));
@@ -618,10 +701,8 @@ describe('json-to-effect', () => {
618
701
  });
619
702
 
620
703
  test('schema with optional referece', () => {
621
- const TestSchema = Schema.Struct({
622
- contact: Schema.optional(Ref(Testing.Contact)),
623
- });
624
- const jsonSchema = toJsonSchema(TestSchema);
704
+ const TempSchema = Schema.Struct({ contact: Schema.optional(Ref(TestSchema.Person)) });
705
+ const jsonSchema = toJsonSchema(TempSchema);
625
706
  expect(jsonSchema).toMatchInlineSnapshot(`
626
707
  {
627
708
  "$schema": "http://json-schema.org/draft-07/schema#",
@@ -632,7 +713,7 @@ describe('json-to-effect', () => {
632
713
  "$ref": "/schemas/echo/ref",
633
714
  "reference": {
634
715
  "schema": {
635
- "$ref": "dxn:type:example.com/type/Contact",
716
+ "$ref": "dxn:type:example.com/type/Person",
636
717
  },
637
718
  "schemaVersion": "0.1.0",
638
719
  },
@@ -647,13 +728,65 @@ describe('json-to-effect', () => {
647
728
  `);
648
729
 
649
730
  const effectSchema = toEffectSchema(jsonSchema);
650
- expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(TestSchema.ast));
731
+ expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(TempSchema.ast));
732
+ });
733
+
734
+ test('object nested inside another struct', () => {
735
+ const Contact = Schema.Struct({
736
+ name: Schema.String,
737
+ }).pipe(EchoObjectSchema({ typename: 'example.com/type/Person', version: '0.1.0' }));
738
+ const input = Schema.Struct({
739
+ contact: Contact,
740
+ });
741
+ const jsonSchema = toJsonSchema(input);
742
+ expect(jsonSchema).toMatchInlineSnapshot(`
743
+ {
744
+ "$schema": "http://json-schema.org/draft-07/schema#",
745
+ "additionalProperties": false,
746
+ "properties": {
747
+ "contact": {
748
+ "$id": "dxn:type:example.com/type/Person",
749
+ "additionalProperties": false,
750
+ "entityKind": "object",
751
+ "properties": {
752
+ "id": {
753
+ "type": "string",
754
+ },
755
+ "name": {
756
+ "type": "string",
757
+ },
758
+ },
759
+ "propertyOrder": [
760
+ "name",
761
+ "id",
762
+ ],
763
+ "required": [
764
+ "name",
765
+ "id",
766
+ ],
767
+ "type": "object",
768
+ "typename": "example.com/type/Person",
769
+ "version": "0.1.0",
770
+ },
771
+ },
772
+ "propertyOrder": [
773
+ "contact",
774
+ ],
775
+ "required": [
776
+ "contact",
777
+ ],
778
+ "type": "object",
779
+ }
780
+ `);
781
+
782
+ const effectSchema = toEffectSchema(jsonSchema);
783
+ expect(prepareAstForCompare(effectSchema.ast)).to.deep.eq(prepareAstForCompare(input.ast));
651
784
  });
652
785
  });
653
786
 
654
787
  describe('reference', () => {
655
788
  test('reference annotation', () => {
656
- const schema = Ref(Testing.Contact);
789
+ const schema = Ref(TestSchema.Person);
657
790
  const jsonSchema = toJsonSchema(schema);
658
791
  expect(jsonSchema).toEqual({
659
792
  $id: '/schemas/echo/ref',
@@ -661,7 +794,7 @@ describe('reference', () => {
661
794
  $schema: 'http://json-schema.org/draft-07/schema#',
662
795
  reference: {
663
796
  schema: {
664
- $ref: 'dxn:type:example.com/type/Contact',
797
+ $ref: 'dxn:type:example.com/type/Person',
665
798
  },
666
799
  schemaVersion: '0.1.0',
667
800
  },
@@ -669,7 +802,7 @@ describe('reference', () => {
669
802
  });
670
803
 
671
804
  test('title annotation', () => {
672
- const schema = Ref(Testing.Contact).annotations({ title: 'My custom title' });
805
+ const schema = Ref(TestSchema.Person).annotations({ title: 'My custom title' });
673
806
  const jsonSchema = toJsonSchema(schema);
674
807
  expect(jsonSchema).toEqual({
675
808
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -679,7 +812,7 @@ describe('reference', () => {
679
812
  $ref: '/schemas/echo/ref',
680
813
  reference: {
681
814
  schema: {
682
- $ref: 'dxn:type:example.com/type/Contact',
815
+ $ref: 'dxn:type:example.com/type/Person',
683
816
  },
684
817
  schemaVersion: '0.1.0',
685
818
  },
@@ -690,7 +823,7 @@ describe('reference', () => {
690
823
  });
691
824
 
692
825
  test('description annotation', () => {
693
- const schema = Ref(Testing.Contact).annotations({ description: 'My custom description' });
826
+ const schema = Ref(TestSchema.Person).annotations({ description: 'My custom description' });
694
827
  const jsonSchema = toJsonSchema(schema);
695
828
  expect(jsonSchema).toEqual({
696
829
  $schema: 'http://json-schema.org/draft-07/schema#',
@@ -700,7 +833,7 @@ describe('reference', () => {
700
833
  $ref: '/schemas/echo/ref',
701
834
  reference: {
702
835
  schema: {
703
- $ref: 'dxn:type:example.com/type/Contact',
836
+ $ref: 'dxn:type:example.com/type/Person',
704
837
  },
705
838
  schemaVersion: '0.1.0',
706
839
  },
@@ -714,13 +847,13 @@ describe('reference', () => {
714
847
  });
715
848
 
716
849
  test('serialize and deserialize', () => {
717
- const schema = Ref(Testing.Contact);
850
+ const schema = Ref(TestSchema.Person);
718
851
  const jsonSchema = toJsonSchema(schema);
719
852
  const deserializedSchema = toEffectSchema(jsonSchema);
720
853
  const refAst = getReferenceAst(deserializedSchema.ast);
721
854
  expect(refAst).toEqual({
722
- typename: Testing.Contact.typename,
723
- version: Testing.Contact.version,
855
+ typename: TestSchema.Person.typename,
856
+ version: TestSchema.Person.version,
724
857
  });
725
858
  });
726
859
  });