@dxos/echo 0.8.4-main.ead640a → 0.8.4-main.effb148878

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 (703) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +10 -11
  3. package/dist/lib/neutral/Annotation.mjs +39 -0
  4. package/dist/lib/neutral/Database.mjs +49 -0
  5. package/dist/lib/neutral/Entity.mjs +68 -0
  6. package/dist/lib/neutral/Err.mjs +12 -0
  7. package/dist/lib/neutral/Extension.mjs +18 -0
  8. package/dist/lib/neutral/Feed.mjs +54 -0
  9. package/dist/lib/neutral/Filter.mjs +74 -0
  10. package/dist/lib/neutral/Filter.mjs.map +7 -0
  11. package/dist/lib/neutral/Format.mjs +86 -0
  12. package/dist/lib/neutral/Format.mjs.map +7 -0
  13. package/dist/lib/neutral/JsonSchema.mjs +19 -0
  14. package/dist/lib/neutral/JsonSchema.mjs.map +7 -0
  15. package/dist/lib/neutral/Key.mjs +16 -0
  16. package/dist/lib/neutral/Key.mjs.map +7 -0
  17. package/dist/lib/neutral/Migration.mjs +18 -0
  18. package/dist/lib/neutral/Migration.mjs.map +7 -0
  19. package/dist/lib/neutral/Obj.mjs +114 -0
  20. package/dist/lib/neutral/Obj.mjs.map +7 -0
  21. package/dist/lib/neutral/Order.mjs +12 -0
  22. package/dist/lib/neutral/Order.mjs.map +7 -0
  23. package/dist/lib/neutral/Query.mjs +38 -0
  24. package/dist/lib/neutral/Query.mjs.map +7 -0
  25. package/dist/lib/neutral/QueryResult.mjs +2 -0
  26. package/dist/lib/neutral/QueryResult.mjs.map +7 -0
  27. package/dist/lib/neutral/Ref.mjs +26 -0
  28. package/dist/lib/neutral/Ref.mjs.map +7 -0
  29. package/dist/lib/neutral/Relation.mjs +95 -0
  30. package/dist/lib/neutral/Relation.mjs.map +7 -0
  31. package/dist/lib/neutral/SchemaRegistry.mjs +2 -0
  32. package/dist/lib/neutral/SchemaRegistry.mjs.map +7 -0
  33. package/dist/lib/neutral/Tag.mjs +29 -0
  34. package/dist/lib/neutral/Tag.mjs.map +7 -0
  35. package/dist/lib/neutral/Type.mjs +63 -0
  36. package/dist/lib/neutral/Type.mjs.map +7 -0
  37. package/dist/lib/neutral/chunk-4SYHDOQA.mjs +48 -0
  38. package/dist/lib/neutral/chunk-4SYHDOQA.mjs.map +7 -0
  39. package/dist/lib/neutral/chunk-4U7OD55H.mjs +47 -0
  40. package/dist/lib/neutral/chunk-4U7OD55H.mjs.map +7 -0
  41. package/dist/lib/neutral/chunk-52NG2XEE.mjs +34 -0
  42. package/dist/lib/neutral/chunk-52NG2XEE.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-A5HDDVKS.mjs +94 -0
  44. package/dist/lib/neutral/chunk-A5HDDVKS.mjs.map +7 -0
  45. package/dist/lib/neutral/chunk-EZ4XJFHJ.mjs +54 -0
  46. package/dist/lib/neutral/chunk-EZ4XJFHJ.mjs.map +7 -0
  47. package/dist/lib/neutral/chunk-F625JEZB.mjs +365 -0
  48. package/dist/lib/neutral/chunk-F625JEZB.mjs.map +7 -0
  49. package/dist/lib/neutral/chunk-FFCN66OF.mjs +420 -0
  50. package/dist/lib/neutral/chunk-FFCN66OF.mjs.map +7 -0
  51. package/dist/lib/neutral/chunk-GOHDOJE3.mjs +51 -0
  52. package/dist/lib/neutral/chunk-GOHDOJE3.mjs.map +7 -0
  53. package/dist/lib/neutral/chunk-GWFFC34K.mjs +50 -0
  54. package/dist/lib/neutral/chunk-GWFFC34K.mjs.map +7 -0
  55. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  56. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  57. package/dist/lib/neutral/chunk-J7QWJQQV.mjs +318 -0
  58. package/dist/lib/neutral/chunk-J7QWJQQV.mjs.map +7 -0
  59. package/dist/lib/neutral/chunk-JTHNDGAR.mjs +27 -0
  60. package/dist/lib/neutral/chunk-JTHNDGAR.mjs.map +7 -0
  61. package/dist/lib/neutral/chunk-K5RH2PBH.mjs +361 -0
  62. package/dist/lib/neutral/chunk-K5RH2PBH.mjs.map +7 -0
  63. package/dist/lib/neutral/chunk-KHRAQDYX.mjs +343 -0
  64. package/dist/lib/neutral/chunk-KHRAQDYX.mjs.map +7 -0
  65. package/dist/lib/neutral/chunk-L65CW5EI.mjs +156 -0
  66. package/dist/lib/neutral/chunk-L65CW5EI.mjs.map +7 -0
  67. package/dist/lib/neutral/chunk-LNZIPZX6.mjs +2186 -0
  68. package/dist/lib/neutral/chunk-LNZIPZX6.mjs.map +7 -0
  69. package/dist/lib/neutral/chunk-MPXUNTME.mjs +41 -0
  70. package/dist/lib/neutral/chunk-MPXUNTME.mjs.map +7 -0
  71. package/dist/lib/neutral/chunk-O2EOH7XQ.mjs +420 -0
  72. package/dist/lib/neutral/chunk-O2EOH7XQ.mjs.map +7 -0
  73. package/dist/lib/neutral/chunk-Q7ID37KF.mjs +278 -0
  74. package/dist/lib/neutral/chunk-Q7ID37KF.mjs.map +7 -0
  75. package/dist/lib/neutral/chunk-QLYEQ5VA.mjs +205 -0
  76. package/dist/lib/neutral/chunk-QLYEQ5VA.mjs.map +7 -0
  77. package/dist/lib/neutral/chunk-SSDGRJ3A.mjs +747 -0
  78. package/dist/lib/neutral/chunk-SSDGRJ3A.mjs.map +7 -0
  79. package/dist/lib/neutral/chunk-TTCSATUD.mjs +42 -0
  80. package/dist/lib/neutral/chunk-TTCSATUD.mjs.map +7 -0
  81. package/dist/lib/neutral/chunk-UEFRFUYC.mjs +25 -0
  82. package/dist/lib/neutral/chunk-UEFRFUYC.mjs.map +7 -0
  83. package/dist/lib/neutral/chunk-UN7K472Q.mjs +132 -0
  84. package/dist/lib/neutral/chunk-UN7K472Q.mjs.map +7 -0
  85. package/dist/lib/neutral/chunk-UQAMAXDU.mjs +243 -0
  86. package/dist/lib/neutral/chunk-UQAMAXDU.mjs.map +7 -0
  87. package/dist/lib/neutral/chunk-V5NE2X7Y.mjs +7 -0
  88. package/dist/lib/neutral/chunk-V5NE2X7Y.mjs.map +7 -0
  89. package/dist/lib/neutral/chunk-V72DY6LU.mjs +7 -0
  90. package/dist/lib/neutral/chunk-V72DY6LU.mjs.map +7 -0
  91. package/dist/lib/neutral/chunk-ZII2BGPM.mjs +269 -0
  92. package/dist/lib/neutral/chunk-ZII2BGPM.mjs.map +7 -0
  93. package/dist/lib/neutral/chunk-ZM7VFIS2.mjs +93 -0
  94. package/dist/lib/neutral/chunk-ZM7VFIS2.mjs.map +7 -0
  95. package/dist/lib/neutral/index.mjs +111 -0
  96. package/dist/lib/neutral/index.mjs.map +7 -0
  97. package/dist/lib/neutral/internal/index.mjs +513 -0
  98. package/dist/lib/neutral/internal/index.mjs.map +7 -0
  99. package/dist/lib/neutral/meta.json +1 -0
  100. package/dist/lib/neutral/testing/index.mjs +418 -0
  101. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  102. package/dist/types/src/Annotation.d.ts +24 -0
  103. package/dist/types/src/Annotation.d.ts.map +1 -0
  104. package/dist/types/src/Collection.d.ts +15 -0
  105. package/dist/types/src/Collection.d.ts.map +1 -0
  106. package/dist/types/src/Database.d.ts +201 -0
  107. package/dist/types/src/Database.d.ts.map +1 -0
  108. package/dist/types/src/Dataset.d.ts +29 -0
  109. package/dist/types/src/Dataset.d.ts.map +1 -0
  110. package/dist/types/src/Entity.d.ts +236 -0
  111. package/dist/types/src/Entity.d.ts.map +1 -0
  112. package/dist/types/src/Entity.test.d.ts +2 -0
  113. package/dist/types/src/Entity.test.d.ts.map +1 -0
  114. package/dist/types/src/Err.d.ts +107 -0
  115. package/dist/types/src/Err.d.ts.map +1 -0
  116. package/dist/types/src/Extension.d.ts +80 -0
  117. package/dist/types/src/Extension.d.ts.map +1 -0
  118. package/dist/types/src/Extension.test.d.ts +2 -0
  119. package/dist/types/src/Extension.test.d.ts.map +1 -0
  120. package/dist/types/src/Feed.d.ts +229 -0
  121. package/dist/types/src/Feed.d.ts.map +1 -0
  122. package/dist/types/src/Filter.d.ts +183 -0
  123. package/dist/types/src/Filter.d.ts.map +1 -0
  124. package/dist/types/src/Filter.test.d.ts +2 -0
  125. package/dist/types/src/Filter.test.d.ts.map +1 -0
  126. package/dist/types/src/Format.d.ts +4 -0
  127. package/dist/types/src/Format.d.ts.map +1 -0
  128. package/dist/types/src/Hypergraph.d.ts +65 -0
  129. package/dist/types/src/Hypergraph.d.ts.map +1 -0
  130. package/dist/types/src/Json.d.ts +33 -0
  131. package/dist/types/src/Json.d.ts.map +1 -0
  132. package/dist/types/src/Json.test.d.ts +2 -0
  133. package/dist/types/src/Json.test.d.ts.map +1 -0
  134. package/dist/types/src/JsonSchema.d.ts +16 -0
  135. package/dist/types/src/JsonSchema.d.ts.map +1 -0
  136. package/dist/types/src/Key.d.ts +2 -1
  137. package/dist/types/src/Key.d.ts.map +1 -1
  138. package/dist/types/src/Migration.d.ts +72 -0
  139. package/dist/types/src/Migration.d.ts.map +1 -0
  140. package/dist/types/src/Obj.d.ts +459 -107
  141. package/dist/types/src/Obj.d.ts.map +1 -1
  142. package/dist/types/src/Obj.test.d.ts +2 -0
  143. package/dist/types/src/Obj.test.d.ts.map +1 -0
  144. package/dist/types/src/Order.d.ts +16 -0
  145. package/dist/types/src/Order.d.ts.map +1 -0
  146. package/dist/types/src/Query.d.ts +225 -0
  147. package/dist/types/src/Query.d.ts.map +1 -0
  148. package/dist/types/src/Query.test.d.ts +2 -0
  149. package/dist/types/src/Query.test.d.ts.map +1 -0
  150. package/dist/types/src/QueryResult.d.ts +80 -0
  151. package/dist/types/src/QueryResult.d.ts.map +1 -0
  152. package/dist/types/src/Ref.d.ts +69 -11
  153. package/dist/types/src/Ref.d.ts.map +1 -1
  154. package/dist/types/src/Relation.d.ts +316 -23
  155. package/dist/types/src/Relation.d.ts.map +1 -1
  156. package/dist/types/src/Relation.test.d.ts +2 -0
  157. package/dist/types/src/Relation.test.d.ts.map +1 -0
  158. package/dist/types/src/SchemaRegistry.d.ts +83 -0
  159. package/dist/types/src/SchemaRegistry.d.ts.map +1 -0
  160. package/dist/types/src/Tag.d.ts +18 -0
  161. package/dist/types/src/Tag.d.ts.map +1 -0
  162. package/dist/types/src/Type.d.ts +378 -106
  163. package/dist/types/src/Type.d.ts.map +1 -1
  164. package/dist/types/src/Type.test.d.ts +2 -0
  165. package/dist/types/src/Type.test.d.ts.map +1 -0
  166. package/dist/types/src/View.d.ts +65 -0
  167. package/dist/types/src/View.d.ts.map +1 -0
  168. package/dist/types/src/exemplars.test.d.ts +2 -0
  169. package/dist/types/src/exemplars.test.d.ts.map +1 -0
  170. package/dist/types/src/hierarchy.test.d.ts +2 -0
  171. package/dist/types/src/hierarchy.test.d.ts.map +1 -0
  172. package/dist/types/src/index.d.ts +22 -5
  173. package/dist/types/src/index.d.ts.map +1 -1
  174. package/dist/types/src/internal/Annotation/annotations.d.ts +251 -0
  175. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
  176. package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
  177. package/dist/types/src/internal/Annotation/index.d.ts +4 -0
  178. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
  179. package/dist/types/src/internal/Annotation/sorting.d.ts +24 -0
  180. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
  181. package/dist/types/src/internal/Annotation/util.d.ts +48 -0
  182. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
  183. package/dist/types/src/internal/Entity/api.d.ts +13 -0
  184. package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
  185. package/dist/types/src/internal/Entity/entity.d.ts +67 -0
  186. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
  187. package/dist/types/src/internal/Entity/index.d.ts +10 -0
  188. package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
  189. package/dist/types/src/internal/Entity/model.d.ts +57 -0
  190. package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
  191. package/dist/types/src/internal/Entity/object.d.ts +18 -0
  192. package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
  193. package/dist/types/src/internal/Entity/relation.d.ts +51 -0
  194. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
  195. package/dist/types/src/internal/Entity/type-kind.d.ts +24 -0
  196. package/dist/types/src/internal/Entity/type-kind.d.ts.map +1 -0
  197. package/dist/types/src/internal/Entity/type-uri.d.ts +25 -0
  198. package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -0
  199. package/dist/types/src/internal/Entity/util.d.ts +2 -0
  200. package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
  201. package/dist/types/src/internal/Entity/version.d.ts +42 -0
  202. package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
  203. package/dist/types/src/internal/Format/date.d.ts.map +1 -0
  204. package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
  205. package/dist/types/src/internal/{formats → Format}/format.d.ts +6 -3
  206. package/dist/types/src/internal/Format/format.d.ts.map +1 -0
  207. package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
  208. package/dist/types/src/internal/{formats → Format}/index.d.ts +2 -2
  209. package/dist/types/src/internal/Format/index.d.ts.map +1 -0
  210. package/dist/types/src/internal/Format/number.d.ts.map +1 -0
  211. package/dist/types/src/internal/Format/object.d.ts.map +1 -0
  212. package/dist/types/src/internal/{formats → Format}/select.d.ts +6 -4
  213. package/dist/types/src/internal/Format/select.d.ts.map +1 -0
  214. package/dist/types/src/internal/{formats → Format}/string.d.ts +4 -0
  215. package/dist/types/src/internal/Format/string.d.ts.map +1 -0
  216. package/dist/types/src/internal/{formats → Format}/types.d.ts +14 -10
  217. package/dist/types/src/internal/Format/types.d.ts.map +1 -0
  218. package/dist/types/src/internal/{json → JsonSchema}/annotations.d.ts +1 -1
  219. package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
  220. package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
  221. package/dist/types/src/internal/JsonSchema/index.d.ts +5 -0
  222. package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
  223. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
  224. package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +131 -30
  225. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
  226. package/dist/types/src/internal/{json → JsonSchema}/json-schema.d.ts +6 -3
  227. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
  228. package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
  229. package/dist/types/src/internal/Obj/clone.d.ts +8 -0
  230. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
  231. package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
  232. package/dist/types/src/internal/{object/create.d.ts → Obj/create-object.d.ts} +13 -16
  233. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
  234. package/dist/types/src/internal/Obj/create-object.test.d.ts +2 -0
  235. package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
  236. package/dist/types/src/internal/Obj/deleted.d.ts +6 -0
  237. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
  238. package/dist/types/src/internal/Obj/index.d.ts +10 -0
  239. package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
  240. package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
  241. package/dist/types/src/internal/Obj/json-serializer.d.ts +45 -0
  242. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
  243. package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
  244. package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
  245. package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
  246. package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
  247. package/dist/types/src/internal/Obj/set-value.d.ts +7 -0
  248. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
  249. package/dist/types/src/internal/Obj/set-value.test.d.ts +2 -0
  250. package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
  251. package/dist/types/src/internal/Obj/snapshot.d.ts +6 -0
  252. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
  253. package/dist/types/src/internal/Obj/typed-object.d.ts +25 -0
  254. package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
  255. package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
  256. package/dist/types/src/internal/Query.d.ts +10 -0
  257. package/dist/types/src/internal/Query.d.ts.map +1 -0
  258. package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
  259. package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +4 -4
  260. package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
  261. package/dist/types/src/internal/{ref → Ref}/ref.d.ts +79 -31
  262. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
  263. package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
  264. package/dist/types/src/internal/Type/compose.d.ts +7 -0
  265. package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
  266. package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
  267. package/dist/types/src/internal/Type/index.d.ts +3 -0
  268. package/dist/types/src/internal/Type/index.d.ts.map +1 -0
  269. package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -1
  270. package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
  271. package/dist/types/src/internal/Type/type-schema.d.ts +52 -0
  272. package/dist/types/src/internal/Type/type-schema.d.ts.map +1 -0
  273. package/dist/types/src/internal/common/api/index.d.ts +11 -0
  274. package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
  275. package/dist/types/src/internal/common/api/meta.d.ts +42 -0
  276. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
  277. package/dist/types/src/internal/common/index.d.ts +4 -0
  278. package/dist/types/src/internal/common/index.d.ts.map +1 -0
  279. package/dist/types/src/internal/common/proxy/change-context.d.ts +55 -0
  280. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
  281. package/dist/types/src/internal/common/proxy/change.test.d.ts +2 -0
  282. package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
  283. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts +5 -0
  284. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
  285. package/dist/types/src/internal/common/proxy/errors.d.ts +19 -0
  286. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
  287. package/dist/types/src/internal/common/proxy/event-batch.d.ts +10 -0
  288. package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
  289. package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
  290. package/dist/types/src/internal/common/proxy/index.d.ts +14 -0
  291. package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
  292. package/dist/types/src/internal/common/proxy/json-serializer.d.ts +6 -0
  293. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
  294. package/dist/types/src/internal/common/proxy/make-object.d.ts +19 -0
  295. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
  296. package/dist/types/src/internal/common/proxy/ownership.d.ts +57 -0
  297. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
  298. package/dist/types/src/internal/common/proxy/proxy-types.d.ts +18 -0
  299. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
  300. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +47 -0
  301. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
  302. package/dist/types/src/internal/common/proxy/reactive-array.d.ts +8 -0
  303. package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
  304. package/dist/types/src/internal/common/proxy/reactive.d.ts +39 -0
  305. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
  306. package/dist/types/src/internal/common/proxy/reactive.test.d.ts +2 -0
  307. package/dist/types/src/internal/common/proxy/reactive.test.d.ts.map +1 -0
  308. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
  309. package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
  310. package/dist/types/src/internal/common/proxy/symbols.d.ts +3 -0
  311. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
  312. package/dist/types/src/internal/common/proxy/typed-handler.d.ts +64 -0
  313. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
  314. package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
  315. package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
  316. package/dist/types/src/internal/common/types/base.d.ts +27 -0
  317. package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
  318. package/dist/types/src/internal/common/types/entity.d.ts +94 -0
  319. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
  320. package/dist/types/src/internal/common/types/index.d.ts +7 -0
  321. package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
  322. package/dist/types/src/internal/common/types/meta.d.ts +43 -0
  323. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
  324. package/dist/types/src/internal/common/types/model-symbols.d.ts +58 -0
  325. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
  326. package/dist/types/src/internal/common/types/typename.d.ts +28 -0
  327. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
  328. package/dist/types/src/internal/common/types/version.d.ts +15 -0
  329. package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
  330. package/dist/types/src/internal/index.d.ts +10 -14
  331. package/dist/types/src/internal/index.d.ts.map +1 -1
  332. package/dist/types/src/{test → testing}/api.test.d.ts.map +1 -1
  333. package/dist/types/src/testing/index.d.ts +3 -3
  334. package/dist/types/src/testing/index.d.ts.map +1 -1
  335. package/dist/types/src/testing/test-data.d.ts +18 -0
  336. package/dist/types/src/testing/test-data.d.ts.map +1 -0
  337. package/dist/types/src/testing/test-schema.d.ts +298 -0
  338. package/dist/types/src/testing/test-schema.d.ts.map +1 -0
  339. package/dist/types/src/testing/util.d.ts +23 -0
  340. package/dist/types/src/testing/util.d.ts.map +1 -0
  341. package/dist/types/tsconfig.tsbuildinfo +1 -1
  342. package/package.json +117 -66
  343. package/src/Annotation.ts +49 -0
  344. package/src/Collection.ts +36 -0
  345. package/src/Database.ts +356 -0
  346. package/src/Dataset.ts +34 -0
  347. package/src/Entity.test.ts +132 -0
  348. package/src/Entity.ts +332 -0
  349. package/src/Err.ts +40 -0
  350. package/src/Extension.test.ts +235 -0
  351. package/src/Extension.ts +122 -0
  352. package/src/Feed.ts +356 -0
  353. package/src/Filter.test.ts +90 -0
  354. package/src/Filter.ts +507 -0
  355. package/src/Format.ts +9 -0
  356. package/src/Hypergraph.ts +79 -0
  357. package/src/Json.test.ts +175 -0
  358. package/src/Json.ts +103 -0
  359. package/src/JsonSchema.ts +26 -0
  360. package/src/Key.ts +4 -1
  361. package/src/Migration.ts +114 -0
  362. package/src/Obj.test.ts +550 -0
  363. package/src/Obj.ts +754 -267
  364. package/src/Order.ts +46 -0
  365. package/src/Query.test.ts +822 -0
  366. package/src/Query.ts +589 -0
  367. package/src/QueryResult.ts +106 -0
  368. package/src/Ref.ts +98 -10
  369. package/src/Relation.test.ts +88 -0
  370. package/src/Relation.ts +491 -67
  371. package/src/SchemaRegistry.ts +101 -0
  372. package/src/{query/tag.ts → Tag.ts} +15 -12
  373. package/src/Type.test.ts +197 -0
  374. package/src/Type.ts +605 -151
  375. package/src/View.ts +101 -0
  376. package/src/exemplars.test.ts +21 -0
  377. package/src/hierarchy.test.ts +33 -0
  378. package/src/index.ts +23 -6
  379. package/src/internal/Annotation/annotations.test.ts +165 -0
  380. package/src/internal/Annotation/annotations.ts +567 -0
  381. package/src/internal/Annotation/index.ts +7 -0
  382. package/src/internal/Annotation/sorting.ts +51 -0
  383. package/src/internal/Annotation/util.ts +93 -0
  384. package/src/internal/Entity/api.ts +30 -0
  385. package/src/internal/Entity/entity.ts +246 -0
  386. package/src/internal/Entity/index.ts +13 -0
  387. package/src/internal/Entity/model.ts +120 -0
  388. package/src/internal/Entity/object.ts +65 -0
  389. package/src/internal/Entity/relation.ts +179 -0
  390. package/src/internal/Entity/type-kind.ts +67 -0
  391. package/src/internal/Entity/type-uri.ts +87 -0
  392. package/src/internal/Entity/util.ts +34 -0
  393. package/src/internal/Entity/version.ts +96 -0
  394. package/src/internal/{formats → Format}/date.test.ts +1 -2
  395. package/src/internal/{formats → Format}/date.ts +5 -9
  396. package/src/internal/{formats → Format}/format.test.ts +6 -7
  397. package/src/internal/{formats → Format}/format.ts +8 -6
  398. package/src/internal/{formats → Format}/index.ts +2 -3
  399. package/src/internal/{formats → Format}/number.ts +5 -5
  400. package/src/internal/{formats → Format}/object.ts +4 -4
  401. package/src/internal/{formats → Format}/select.ts +6 -4
  402. package/src/internal/{formats → Format}/string.ts +14 -9
  403. package/src/internal/{formats → Format}/types.ts +54 -43
  404. package/src/internal/{json → JsonSchema}/annotations.ts +3 -3
  405. package/src/internal/{json-schema → JsonSchema}/index.ts +2 -0
  406. package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +4 -2
  407. package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +36 -36
  408. package/src/internal/{json → JsonSchema}/json-schema.test.ts +92 -175
  409. package/src/internal/{json → JsonSchema}/json-schema.ts +69 -37
  410. package/src/internal/Obj/clone.ts +52 -0
  411. package/src/internal/{object → Obj}/common.ts +3 -4
  412. package/src/internal/{object/create.test.ts → Obj/create-object.test.ts} +34 -37
  413. package/src/internal/Obj/create-object.ts +135 -0
  414. package/src/internal/Obj/deleted.ts +19 -0
  415. package/src/internal/Obj/index.ts +13 -0
  416. package/src/internal/{object → Obj}/inspect.ts +5 -7
  417. package/src/internal/Obj/json-serializer.test.ts +185 -0
  418. package/src/internal/Obj/json-serializer.ts +260 -0
  419. package/src/internal/{object → Obj}/schema-validator.test.ts +3 -7
  420. package/src/internal/Obj/schema-validator.ts +6 -0
  421. package/src/internal/Obj/set-value.test.ts +258 -0
  422. package/src/internal/Obj/set-value.ts +165 -0
  423. package/src/internal/Obj/snapshot.ts +111 -0
  424. package/src/internal/Obj/typed-object.test.ts +32 -0
  425. package/src/internal/Obj/typed-object.ts +30 -0
  426. package/src/internal/Query.ts +156 -0
  427. package/src/internal/{ref → Ref}/ref-array.ts +4 -5
  428. package/src/internal/{ref → Ref}/ref.test.ts +21 -30
  429. package/src/internal/{ref → Ref}/ref.ts +209 -98
  430. package/src/internal/{projection → Type}/compose.test.ts +9 -9
  431. package/src/internal/{projection → Type}/compose.ts +14 -9
  432. package/src/internal/Type/index.ts +6 -0
  433. package/src/internal/{schema → Type}/manipulation.ts +0 -25
  434. package/src/internal/Type/type-schema.ts +60 -0
  435. package/src/internal/common/README.md +102 -0
  436. package/src/internal/common/api/index.ts +15 -0
  437. package/src/internal/common/api/meta.ts +88 -0
  438. package/src/internal/{testing → common}/index.ts +2 -1
  439. package/src/internal/common/proxy/change-context.ts +138 -0
  440. package/src/internal/common/proxy/change.test.ts +519 -0
  441. package/src/internal/common/proxy/define-hidden-property.ts +14 -0
  442. package/src/internal/common/proxy/errors.ts +42 -0
  443. package/src/internal/common/proxy/event-batch.ts +44 -0
  444. package/src/internal/common/proxy/handler.test.ts +121 -0
  445. package/src/internal/common/proxy/index.ts +17 -0
  446. package/src/internal/common/proxy/json-serializer.ts +93 -0
  447. package/src/internal/common/proxy/make-object.ts +128 -0
  448. package/src/internal/common/proxy/ownership.ts +252 -0
  449. package/src/internal/common/proxy/proxy-types.ts +23 -0
  450. package/src/internal/common/proxy/proxy-utils.ts +150 -0
  451. package/src/internal/common/proxy/reactive-array.ts +71 -0
  452. package/src/internal/common/proxy/reactive.test.ts +54 -0
  453. package/src/internal/common/proxy/reactive.ts +77 -0
  454. package/src/internal/{object → common/proxy}/schema-validator.ts +6 -3
  455. package/src/internal/common/proxy/schema.test.ts +107 -0
  456. package/src/internal/common/proxy/symbols.ts +7 -0
  457. package/src/internal/common/proxy/typed-handler.test.ts +314 -0
  458. package/src/internal/common/proxy/typed-handler.ts +507 -0
  459. package/src/internal/common/proxy/typed-object.test.ts +103 -0
  460. package/src/internal/common/types/base.ts +43 -0
  461. package/src/internal/common/types/entity.ts +133 -0
  462. package/src/internal/common/types/index.ts +10 -0
  463. package/src/internal/common/types/meta.ts +79 -0
  464. package/src/internal/common/types/model-symbols.ts +74 -0
  465. package/src/internal/common/types/typename.ts +91 -0
  466. package/src/internal/common/types/version.ts +19 -0
  467. package/src/internal/index.ts +12 -17
  468. package/src/testing/api.test.ts +129 -0
  469. package/src/testing/index.ts +3 -3
  470. package/src/testing/test-data.ts +189 -0
  471. package/src/testing/test-schema.ts +204 -0
  472. package/src/testing/util.ts +88 -0
  473. package/dist/lib/browser/chunk-HKFCK2GL.mjs +0 -175
  474. package/dist/lib/browser/chunk-HKFCK2GL.mjs.map +0 -7
  475. package/dist/lib/browser/chunk-MAAYELT7.mjs +0 -830
  476. package/dist/lib/browser/chunk-MAAYELT7.mjs.map +0 -7
  477. package/dist/lib/browser/chunk-MB6MMNFP.mjs +0 -3857
  478. package/dist/lib/browser/chunk-MB6MMNFP.mjs.map +0 -7
  479. package/dist/lib/browser/index.mjs +0 -35
  480. package/dist/lib/browser/internal/index.mjs +0 -332
  481. package/dist/lib/browser/meta.json +0 -1
  482. package/dist/lib/browser/query/index.mjs +0 -15
  483. package/dist/lib/browser/testing/index.mjs +0 -298
  484. package/dist/lib/browser/testing/index.mjs.map +0 -7
  485. package/dist/lib/node-esm/chunk-5NWDGIBT.mjs +0 -830
  486. package/dist/lib/node-esm/chunk-5NWDGIBT.mjs.map +0 -7
  487. package/dist/lib/node-esm/chunk-AUAH4E2J.mjs +0 -175
  488. package/dist/lib/node-esm/chunk-AUAH4E2J.mjs.map +0 -7
  489. package/dist/lib/node-esm/chunk-BQRA4VLX.mjs +0 -3857
  490. package/dist/lib/node-esm/chunk-BQRA4VLX.mjs.map +0 -7
  491. package/dist/lib/node-esm/index.mjs +0 -35
  492. package/dist/lib/node-esm/internal/index.mjs +0 -332
  493. package/dist/lib/node-esm/meta.json +0 -1
  494. package/dist/lib/node-esm/query/index.mjs +0 -15
  495. package/dist/lib/node-esm/testing/index.mjs +0 -298
  496. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  497. package/dist/types/src/errors.d.ts +0 -72
  498. package/dist/types/src/errors.d.ts.map +0 -1
  499. package/dist/types/src/internal/ast/annotation-helper.d.ts +0 -8
  500. package/dist/types/src/internal/ast/annotation-helper.d.ts.map +0 -1
  501. package/dist/types/src/internal/ast/annotations.d.ts +0 -125
  502. package/dist/types/src/internal/ast/annotations.d.ts.map +0 -1
  503. package/dist/types/src/internal/ast/annotations.test.d.ts.map +0 -1
  504. package/dist/types/src/internal/ast/entity-kind.d.ts +0 -10
  505. package/dist/types/src/internal/ast/entity-kind.d.ts.map +0 -1
  506. package/dist/types/src/internal/ast/index.d.ts +0 -5
  507. package/dist/types/src/internal/ast/index.d.ts.map +0 -1
  508. package/dist/types/src/internal/ast/types.d.ts +0 -6
  509. package/dist/types/src/internal/ast/types.d.ts.map +0 -1
  510. package/dist/types/src/internal/formats/date.d.ts.map +0 -1
  511. package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
  512. package/dist/types/src/internal/formats/format.d.ts.map +0 -1
  513. package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
  514. package/dist/types/src/internal/formats/index.d.ts.map +0 -1
  515. package/dist/types/src/internal/formats/number.d.ts.map +0 -1
  516. package/dist/types/src/internal/formats/object.d.ts.map +0 -1
  517. package/dist/types/src/internal/formats/select.d.ts.map +0 -1
  518. package/dist/types/src/internal/formats/string.d.ts.map +0 -1
  519. package/dist/types/src/internal/formats/types.d.ts.map +0 -1
  520. package/dist/types/src/internal/json/annotations.d.ts.map +0 -1
  521. package/dist/types/src/internal/json/effect-schema.test.d.ts.map +0 -1
  522. package/dist/types/src/internal/json/index.d.ts +0 -2
  523. package/dist/types/src/internal/json/index.d.ts.map +0 -1
  524. package/dist/types/src/internal/json/json-schema.d.ts.map +0 -1
  525. package/dist/types/src/internal/json/json-schema.test.d.ts.map +0 -1
  526. package/dist/types/src/internal/json-schema/index.d.ts +0 -3
  527. package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
  528. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
  529. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
  530. package/dist/types/src/internal/object/accessors.d.ts +0 -37
  531. package/dist/types/src/internal/object/accessors.d.ts.map +0 -1
  532. package/dist/types/src/internal/object/common.d.ts.map +0 -1
  533. package/dist/types/src/internal/object/create.d.ts.map +0 -1
  534. package/dist/types/src/internal/object/create.test.d.ts +0 -2
  535. package/dist/types/src/internal/object/create.test.d.ts.map +0 -1
  536. package/dist/types/src/internal/object/deleted.d.ts +0 -6
  537. package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
  538. package/dist/types/src/internal/object/entity.d.ts +0 -33
  539. package/dist/types/src/internal/object/entity.d.ts.map +0 -1
  540. package/dist/types/src/internal/object/expando.d.ts +0 -14
  541. package/dist/types/src/internal/object/expando.d.ts.map +0 -1
  542. package/dist/types/src/internal/object/ids.d.ts +0 -6
  543. package/dist/types/src/internal/object/ids.d.ts.map +0 -1
  544. package/dist/types/src/internal/object/index.d.ts +0 -16
  545. package/dist/types/src/internal/object/index.d.ts.map +0 -1
  546. package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
  547. package/dist/types/src/internal/object/json-serializer.d.ts +0 -32
  548. package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
  549. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
  550. package/dist/types/src/internal/object/meta.d.ts +0 -31
  551. package/dist/types/src/internal/object/meta.d.ts.map +0 -1
  552. package/dist/types/src/internal/object/model.d.ts +0 -117
  553. package/dist/types/src/internal/object/model.d.ts.map +0 -1
  554. package/dist/types/src/internal/object/relation.d.ts +0 -17
  555. package/dist/types/src/internal/object/relation.d.ts.map +0 -1
  556. package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
  557. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
  558. package/dist/types/src/internal/object/typed-object.d.ts +0 -31
  559. package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
  560. package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
  561. package/dist/types/src/internal/object/typename.d.ts +0 -15
  562. package/dist/types/src/internal/object/typename.d.ts.map +0 -1
  563. package/dist/types/src/internal/object/version.d.ts +0 -14
  564. package/dist/types/src/internal/object/version.d.ts.map +0 -1
  565. package/dist/types/src/internal/projection/compose.d.ts +0 -6
  566. package/dist/types/src/internal/projection/compose.d.ts.map +0 -1
  567. package/dist/types/src/internal/projection/compose.test.d.ts.map +0 -1
  568. package/dist/types/src/internal/projection/index.d.ts +0 -2
  569. package/dist/types/src/internal/projection/index.d.ts.map +0 -1
  570. package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
  571. package/dist/types/src/internal/proxy/reactive-object.d.ts +0 -15
  572. package/dist/types/src/internal/proxy/reactive-object.d.ts.map +0 -1
  573. package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
  574. package/dist/types/src/internal/proxy/typed-handler.d.ts +0 -44
  575. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
  576. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
  577. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
  578. package/dist/types/src/internal/query/index.d.ts +0 -2
  579. package/dist/types/src/internal/query/index.d.ts.map +0 -1
  580. package/dist/types/src/internal/query/query.d.ts +0 -17
  581. package/dist/types/src/internal/query/query.d.ts.map +0 -1
  582. package/dist/types/src/internal/ref/index.d.ts.map +0 -1
  583. package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
  584. package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
  585. package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
  586. package/dist/types/src/internal/schema/echo-schema.d.ts +0 -168
  587. package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
  588. package/dist/types/src/internal/schema/index.d.ts +0 -7
  589. package/dist/types/src/internal/schema/index.d.ts.map +0 -1
  590. package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
  591. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +0 -18
  592. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +0 -1
  593. package/dist/types/src/internal/schema/snapshot.d.ts +0 -6
  594. package/dist/types/src/internal/schema/snapshot.d.ts.map +0 -1
  595. package/dist/types/src/internal/schema/stored-schema.d.ts +0 -13
  596. package/dist/types/src/internal/schema/stored-schema.d.ts.map +0 -1
  597. package/dist/types/src/internal/testing/index.d.ts +0 -3
  598. package/dist/types/src/internal/testing/index.d.ts.map +0 -1
  599. package/dist/types/src/internal/testing/types.d.ts +0 -455
  600. package/dist/types/src/internal/testing/types.d.ts.map +0 -1
  601. package/dist/types/src/internal/testing/utils.d.ts +0 -10
  602. package/dist/types/src/internal/testing/utils.d.ts.map +0 -1
  603. package/dist/types/src/internal/types/index.d.ts +0 -3
  604. package/dist/types/src/internal/types/index.d.ts.map +0 -1
  605. package/dist/types/src/internal/types/types.d.ts +0 -79
  606. package/dist/types/src/internal/types/types.d.ts.map +0 -1
  607. package/dist/types/src/internal/types/types.test.d.ts +0 -2
  608. package/dist/types/src/internal/types/types.test.d.ts.map +0 -1
  609. package/dist/types/src/internal/types/util.d.ts +0 -5
  610. package/dist/types/src/internal/types/util.d.ts.map +0 -1
  611. package/dist/types/src/query/index.d.ts +0 -3
  612. package/dist/types/src/query/index.d.ts.map +0 -1
  613. package/dist/types/src/query/query.d.ts +0 -248
  614. package/dist/types/src/query/query.d.ts.map +0 -1
  615. package/dist/types/src/query/query.test.d.ts +0 -2
  616. package/dist/types/src/query/query.test.d.ts.map +0 -1
  617. package/dist/types/src/query/tag.d.ts +0 -17
  618. package/dist/types/src/query/tag.d.ts.map +0 -1
  619. package/dist/types/src/testing/echo-schema.d.ts +0 -7
  620. package/dist/types/src/testing/echo-schema.d.ts.map +0 -1
  621. package/dist/types/src/testing/types.d.ts +0 -113
  622. package/dist/types/src/testing/types.d.ts.map +0 -1
  623. package/src/errors.ts +0 -18
  624. package/src/internal/ast/annotation-helper.ts +0 -22
  625. package/src/internal/ast/annotations.test.ts +0 -98
  626. package/src/internal/ast/annotations.ts +0 -219
  627. package/src/internal/ast/entity-kind.ts +0 -15
  628. package/src/internal/ast/index.ts +0 -8
  629. package/src/internal/ast/types.ts +0 -17
  630. package/src/internal/json/index.ts +0 -5
  631. package/src/internal/object/accessors.ts +0 -153
  632. package/src/internal/object/create.ts +0 -96
  633. package/src/internal/object/deleted.ts +0 -19
  634. package/src/internal/object/entity.ts +0 -248
  635. package/src/internal/object/expando.ts +0 -21
  636. package/src/internal/object/ids.ts +0 -12
  637. package/src/internal/object/index.ts +0 -19
  638. package/src/internal/object/json-serializer.test.ts +0 -99
  639. package/src/internal/object/json-serializer.ts +0 -225
  640. package/src/internal/object/meta.ts +0 -61
  641. package/src/internal/object/model.ts +0 -170
  642. package/src/internal/object/relation.ts +0 -24
  643. package/src/internal/object/typed-object.test.ts +0 -34
  644. package/src/internal/object/typed-object.ts +0 -88
  645. package/src/internal/object/typename.ts +0 -61
  646. package/src/internal/object/version.ts +0 -22
  647. package/src/internal/projection/index.ts +0 -5
  648. package/src/internal/proxy/handler.test.ts +0 -163
  649. package/src/internal/proxy/reactive-object.ts +0 -108
  650. package/src/internal/proxy/schema.test.ts +0 -136
  651. package/src/internal/proxy/typed-handler.test.ts +0 -102
  652. package/src/internal/proxy/typed-handler.ts +0 -228
  653. package/src/internal/proxy/typed-object.test.ts +0 -100
  654. package/src/internal/query/index.ts +0 -5
  655. package/src/internal/query/query.ts +0 -23
  656. package/src/internal/schema/echo-schema.ts +0 -383
  657. package/src/internal/schema/index.ts +0 -10
  658. package/src/internal/schema/runtime-schema-registry.ts +0 -78
  659. package/src/internal/schema/snapshot.ts +0 -25
  660. package/src/internal/schema/stored-schema.ts +0 -26
  661. package/src/internal/testing/types.ts +0 -211
  662. package/src/internal/testing/utils.ts +0 -54
  663. package/src/internal/types/index.ts +0 -6
  664. package/src/internal/types/types.test.ts +0 -48
  665. package/src/internal/types/types.ts +0 -176
  666. package/src/internal/types/util.ts +0 -9
  667. package/src/query/index.ts +0 -6
  668. package/src/query/query.test.ts +0 -401
  669. package/src/query/query.ts +0 -789
  670. package/src/test/api.test.ts +0 -180
  671. package/src/testing/echo-schema.ts +0 -39
  672. package/src/testing/types.ts +0 -91
  673. /package/dist/lib/{browser/index.mjs.map → neutral/Annotation.mjs.map} +0 -0
  674. /package/dist/lib/{browser/internal/index.mjs.map → neutral/Database.mjs.map} +0 -0
  675. /package/dist/lib/{browser/query/index.mjs.map → neutral/Entity.mjs.map} +0 -0
  676. /package/dist/lib/{node-esm/index.mjs.map → neutral/Err.mjs.map} +0 -0
  677. /package/dist/lib/{node-esm/internal/index.mjs.map → neutral/Extension.mjs.map} +0 -0
  678. /package/dist/lib/{node-esm/query/index.mjs.map → neutral/Feed.mjs.map} +0 -0
  679. /package/dist/types/src/internal/{ast → Annotation}/annotations.test.d.ts +0 -0
  680. /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
  681. /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
  682. /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
  683. /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
  684. /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
  685. /package/dist/types/src/internal/{json → JsonSchema}/effect-schema.test.d.ts +0 -0
  686. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
  687. /package/dist/types/src/internal/{json → JsonSchema}/json-schema.test.d.ts +0 -0
  688. /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
  689. /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
  690. /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
  691. /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
  692. /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
  693. /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
  694. /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
  695. /package/dist/types/src/internal/{projection → Type}/compose.test.d.ts +0 -0
  696. /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
  697. /package/dist/types/src/internal/{object → common/proxy}/schema-validator.d.ts +0 -0
  698. /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
  699. /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
  700. /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
  701. /package/dist/types/src/{test → testing}/api.test.d.ts +0 -0
  702. /package/src/internal/{json → JsonSchema}/effect-schema.test.ts +0 -0
  703. /package/src/internal/{ref → Ref}/index.ts +0 -0
@@ -13,23 +13,33 @@ import type * as Types from 'effect/Types';
13
13
  import { raise } from '@dxos/debug';
14
14
  import { mapAst } from '@dxos/effect';
15
15
  import { assertArgument, invariant } from '@dxos/invariant';
16
- import { DXN, ObjectId } from '@dxos/keys';
16
+ import { DXN, EchoURI, ObjectId } from '@dxos/keys';
17
17
  import { log } from '@dxos/log';
18
18
  import { clearUndefined, orderKeys, removeProperties } from '@dxos/util';
19
19
 
20
- import { type TypeAnnotation, TypeAnnotationId, TypeIdentifierAnnotationId } from '../ast';
21
- import { EntityKind, EntityKindSchema } from '../ast';
20
+ import type * as Type from '../../Type';
21
+ import {
22
+ type TypeAnnotation,
23
+ TypeAnnotationId,
24
+ TypeIdentifierAnnotationId,
25
+ makeTypeJsonSchemaAnnotation,
26
+ } from '../Annotation';
27
+ import {
28
+ ANY_OBJECT_TYPENAME,
29
+ ANY_OBJECT_VERSION,
30
+ EntityKind,
31
+ EntityKindSchema,
32
+ getStaticTypeSchema,
33
+ } from '../common/types';
34
+ import { type JsonSchemaReferenceInfo, createEchoReferenceSchema } from '../Ref';
35
+ import { CustomAnnotations, DecodedAnnotations, EchoAnnotations } from './annotations';
22
36
  import {
23
37
  ECHO_ANNOTATIONS_NS_DEPRECATED_KEY,
24
38
  ECHO_ANNOTATIONS_NS_KEY,
25
39
  type JsonSchemaEchoAnnotations,
26
40
  type JsonSchemaType,
27
41
  getNormalizedEchoAnnotations,
28
- } from '../json-schema';
29
- import { Expando, makeTypeJsonSchemaAnnotation } from '../object';
30
- import { type JsonSchemaReferenceInfo, Ref, createEchoReferenceSchema } from '../ref';
31
-
32
- import { CustomAnnotations, DecodedAnnotations, EchoAnnotations } from './annotations';
42
+ } from './json-schema-type';
33
43
 
34
44
  // TODO(burdon): Are these values stored (can they be changed?)
35
45
  export enum PropType {
@@ -71,11 +81,29 @@ export type JsonSchemaOptions = {
71
81
 
72
82
  /**
73
83
  * Convert effect schema to JSON Schema.
84
+ * NOTE: This handles custom annotations.
74
85
  * @param schema
75
86
  */
76
- export const toJsonSchema = (schema: Schema.Schema.All, options: JsonSchemaOptions = {}): JsonSchemaType => {
87
+ // TODO(burdon): Reconcile with possibly extending @effect/Schema/JSONSchema
88
+ // We add additional propertyOrder (but the object properties ARE ordered); and type "string" for literals.
89
+ // TODO(wittjosiah): This is mutable because its a pojo, perhaps should be left as readonly at type level though?
90
+ export const toJsonSchema = (
91
+ schema: Schema.Schema.All | Type.AnyEntity,
92
+ options: JsonSchemaOptions = {},
93
+ ): Types.DeepMutable<JsonSchemaType> => {
94
+ // Allow passing a `Type.Type` entity — use its hidden source schema (or its
95
+ // already-built jsonSchema as a fallback).
96
+ const slot = getStaticTypeSchema(schema);
97
+ if (slot != null) {
98
+ schema = slot;
99
+ } else if (!Schema.isSchema(schema)) {
100
+ const entityJsonSchema = (schema as { jsonSchema?: JsonSchemaType }).jsonSchema;
101
+ if (entityJsonSchema != null) {
102
+ return entityJsonSchema as Types.DeepMutable<JsonSchemaType>;
103
+ }
104
+ }
77
105
  assertArgument(Schema.isSchema(schema), 'schema');
78
- let jsonSchema = _toJsonSchemaAST(schema.ast);
106
+ let jsonSchema = _toJsonSchemaAST((schema as Schema.Schema.All).ast);
79
107
  if (options.strict) {
80
108
  // TOOD(burdon): Workaround to ensure JSON schema is valid (for agv parsing).
81
109
  jsonSchema = removeProperties(jsonSchema, (key, value) => {
@@ -96,11 +124,11 @@ export const toJsonSchema = (schema: Schema.Schema.All, options: JsonSchemaOptio
96
124
  return jsonSchema;
97
125
  };
98
126
 
99
- const _toJsonSchemaAST = (ast: SchemaAST.AST): JsonSchemaType => {
127
+ const _toJsonSchemaAST = (ast: SchemaAST.AST): Types.DeepMutable<JsonSchemaType> => {
100
128
  const withRefinements = withEchoRefinements(ast, '#');
101
129
  const jsonSchema = JSONSchema.fromAST(withRefinements, {
102
130
  definitions: {},
103
- }) as JsonSchemaType;
131
+ }) as Types.DeepMutable<JsonSchemaType>;
104
132
 
105
133
  return normalizeJsonSchema(jsonSchema);
106
134
  };
@@ -319,7 +347,7 @@ const objectToEffectSchema = (root: JsonSchemaType, defs: JsonSchemaType['$defs'
319
347
  }
320
348
 
321
349
  if (immutableIdField) {
322
- schema = Schema.extend(Schema.mutable(schema), Schema.Struct({ id: immutableIdField }));
350
+ schema = Schema.extend(schema, Schema.Struct({ id: immutableIdField }));
323
351
  }
324
352
 
325
353
  const annotations = jsonSchemaFieldsToAnnotations(root);
@@ -330,9 +358,9 @@ const anyToEffectSchema = (root: JSONSchema.JsonSchema7Any): Schema.Schema.AnyNo
330
358
  const echoRefinement: JsonSchemaEchoAnnotations = (root as any)[ECHO_ANNOTATIONS_NS_DEPRECATED_KEY];
331
359
  // TODO(dmaretskyi): Is this branch still taken?
332
360
  if ((echoRefinement as any)?.reference != null) {
333
- const echoId = root.$id.startsWith('dxn:echo:') ? root.$id : undefined;
361
+ const echoUri = root.$id.startsWith('echo:') || root.$id.startsWith('dxn:echo:') ? root.$id : undefined;
334
362
  return createEchoReferenceSchema(
335
- echoId,
363
+ echoUri,
336
364
  (echoRefinement as any).reference.typename,
337
365
  (echoRefinement as any).reference.version,
338
366
  );
@@ -344,21 +372,20 @@ const anyToEffectSchema = (root: JSONSchema.JsonSchema7Any): Schema.Schema.AnyNo
344
372
  // TODO(dmaretskyi): Types.
345
373
  const refToEffectSchema = (root: any): Schema.Schema.AnyNoContext => {
346
374
  if (!('reference' in root)) {
347
- return Ref(Expando);
375
+ // Fallback to generic object ref when no reference info is provided.
376
+ return createEchoReferenceSchema(undefined, ANY_OBJECT_TYPENAME, ANY_OBJECT_VERSION);
348
377
  }
378
+
349
379
  const reference: JsonSchemaReferenceInfo = root.reference;
350
380
  if (typeof reference !== 'object') {
351
381
  throw new Error('Invalid reference field in ref schema');
352
382
  }
353
383
 
354
- const targetSchemaDXN = DXN.parse(reference.schema.$ref);
355
- invariant(targetSchemaDXN.kind === DXN.kind.TYPE);
384
+ const ref = reference.schema.$ref;
385
+ const targetSchemaDXN = DXN.tryMake(ref);
386
+ invariant(targetSchemaDXN, `Expected a type DXN, got: ${ref}`);
356
387
 
357
- return createEchoReferenceSchema(
358
- targetSchemaDXN.toString(),
359
- targetSchemaDXN.kind === DXN.kind.TYPE ? targetSchemaDXN.parts[0] : undefined,
360
- reference.schemaVersion,
361
- );
388
+ return createEchoReferenceSchema(ref, DXN.getName(targetSchemaDXN), reference.schemaVersion);
362
389
  };
363
390
 
364
391
  //
@@ -368,7 +395,7 @@ const refToEffectSchema = (root: any): Schema.Schema.AnyNoContext => {
368
395
  const annotations_toJsonSchemaFields = (annotations: SchemaAST.Annotations): Record<symbol, any> => {
369
396
  const schemaFields: Record<string, any> = {};
370
397
 
371
- const echoAnnotations: JsonSchemaEchoAnnotations = {};
398
+ const echoAnnotations: Types.Mutable<JsonSchemaEchoAnnotations> = {};
372
399
  for (const [key, annotationId] of Object.entries(EchoAnnotations)) {
373
400
  if (annotations[annotationId] != null) {
374
401
  echoAnnotations[key as keyof JsonSchemaEchoAnnotations] = annotations[annotationId] as any;
@@ -379,10 +406,11 @@ const annotations_toJsonSchemaFields = (annotations: SchemaAST.Annotations): Rec
379
406
  schemaFields[ECHO_ANNOTATIONS_NS_KEY] = echoAnnotations;
380
407
  }
381
408
 
409
+ // For stored schemas the storage URI is the definitive identifier — it overrides
410
+ // the typename `$id` written above.
382
411
  const echoIdentifier = annotations[TypeIdentifierAnnotationId];
383
412
  if (echoIdentifier) {
384
- schemaFields[ECHO_ANNOTATIONS_NS_KEY] ??= {};
385
- schemaFields[ECHO_ANNOTATIONS_NS_KEY].schemaId = echoIdentifier;
413
+ schemaFields.$id = echoIdentifier;
386
414
  }
387
415
 
388
416
  // Custom (at end).
@@ -397,14 +425,14 @@ const annotations_toJsonSchemaFields = (annotations: SchemaAST.Annotations): Rec
397
425
  };
398
426
 
399
427
  const decodeTypeIdentifierAnnotation = (schema: JsonSchemaType): string | undefined => {
400
- // Limit to dxn:echo: URIs.
401
- if (schema.$id && schema.$id.startsWith('dxn:echo:')) {
428
+ // For stored schemas `$id` IS the storage URI (echo:/… or legacy dxn:echo:…).
429
+ if (schema.$id && (schema.$id.startsWith('echo:') || schema.$id.startsWith('dxn:echo:'))) {
402
430
  return schema.$id;
403
- } else if (schema.$id && schema.$id.startsWith('dxn:type:') && schema?.echo?.type?.schemaId) {
404
- const id = schema?.echo?.type?.schemaId;
405
- if (ObjectId.isValid(id)) {
406
- return DXN.fromLocalObjectId(id).toString();
407
- }
431
+ }
432
+ // Legacy: older serializations stored the EchoURI on echo.type.schemaId.
433
+ const legacySchemaId = schema.echo?.type?.schemaId;
434
+ if (legacySchemaId) {
435
+ return ObjectId.isValid(legacySchemaId) ? EchoURI.make({ objectId: legacySchemaId }) : legacySchemaId;
408
436
  }
409
437
  return undefined;
410
438
  };
@@ -421,8 +449,8 @@ const decodeTypeAnnotation = (schema: JsonSchemaType): TypeAnnotation | undefine
421
449
  if (annotation.kind === EntityKind.Relation) {
422
450
  const source = schema.relationSource?.$ref ?? raise(new Error('Relation source not set'));
423
451
  const target = schema.relationTarget?.$ref ?? raise(new Error('Relation target not set'));
424
- annotation.sourceSchema = DXN.parse(source).toString();
425
- annotation.targetSchema = DXN.parse(target).toString();
452
+ annotation.sourceSchema = DXN.tryMake(source) ?? raise(new Error(`Invalid relation source: ${source}`));
453
+ annotation.targetSchema = DXN.tryMake(target) ?? raise(new Error(`Invalid relation target: ${target}`));
426
454
  }
427
455
 
428
456
  return annotation;
@@ -452,11 +480,15 @@ const jsonSchemaFieldsToAnnotations = (schema: JsonSchemaType): SchemaAST.Annota
452
480
  }
453
481
  }
454
482
 
455
- annotations[TypeIdentifierAnnotationId] = decodeTypeIdentifierAnnotation(schema);
483
+ const typeIdentifier = decodeTypeIdentifierAnnotation(schema);
484
+ annotations[TypeIdentifierAnnotationId] = typeIdentifier;
456
485
  const typeAnnotation = decodeTypeAnnotation(schema);
457
486
  if (typeAnnotation) {
458
487
  annotations[TypeAnnotationId] = typeAnnotation;
459
488
  annotations[SchemaAST.JSONSchemaAnnotationId] = makeTypeJsonSchemaAnnotation({
489
+ // $id is the typename DXN — the schema's type identity. The storage EchoURI (if any)
490
+ // is preserved separately on TypeIdentifierAnnotation / echo.schemaId.
491
+ identifier: DXN.make(typeAnnotation.typename, typeAnnotation.version),
460
492
  kind: typeAnnotation.kind,
461
493
  typename: typeAnnotation.typename,
462
494
  version: typeAnnotation.version,
@@ -486,7 +518,7 @@ const addJsonSchemaFields = (ast: SchemaAST.AST, schema: JsonSchemaType): Schema
486
518
  * Fixes field order.
487
519
  * Sets `$schema` prop.
488
520
  */
489
- const normalizeJsonSchema = (jsonSchema: JsonSchemaType): JsonSchemaType => {
521
+ const normalizeJsonSchema = (jsonSchema: Types.DeepMutable<JsonSchemaType>): Types.DeepMutable<JsonSchemaType> => {
490
522
  if (jsonSchema.properties && 'id' in jsonSchema.properties) {
491
523
  jsonSchema.properties = orderKeys(jsonSchema.properties, ['id']); // Put id first.
492
524
  }
@@ -0,0 +1,52 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { invariant } from '@dxos/invariant';
6
+ import { deepMapValues } from '@dxos/util';
7
+
8
+ import type * as Obj from '../../Obj';
9
+ import { makeObject } from '../common/proxy';
10
+ import { getMeta, getSchema, getStaticTypeSchema, getType } from '../common/types';
11
+ import { Ref } from '../Ref';
12
+
13
+ /**
14
+ * Clones an object or relation.
15
+ * This does not clone referenced objects, only the properties in the object.
16
+ * @returns A new object with the same schema and properties.
17
+ */
18
+ export const clone = <T extends Obj.Any>(obj: T, opts?: Obj.CloneOptions): T => {
19
+ const { id, ...data } = obj;
20
+ // Prefer cloning through the type entity so the cloned instance preserves
21
+ // `Obj.getType` identity. Falls back to the raw schema for older instances
22
+ // that don't have a type-entity back-reference set (e.g. deserialized).
23
+ const typeEntity = getType(obj);
24
+ const schema = typeEntity != null ? getStaticTypeSchema(typeEntity) : getSchema(obj);
25
+ invariant(schema != null, 'Object should have a type or schema');
26
+ const props: any = deepMapValues(data, (value, recurse) => {
27
+ if (Ref.isRef(value)) {
28
+ if (opts?.deep) {
29
+ // TODO(dmaretskyi): Will break on circular references.
30
+ return Ref.make(clone(value.target!, opts));
31
+ }
32
+ return value;
33
+ }
34
+ return recurse(value);
35
+ });
36
+
37
+ if (opts?.retainId) {
38
+ props.id = id;
39
+ }
40
+ const meta = deepMapValues(getMeta(obj), (value, recurse) => {
41
+ if (Ref.isRef(value)) {
42
+ if (opts?.deep) {
43
+ // TODO(dmaretskyi): Will break on circular references.
44
+ return Ref.make(clone(value.target!, opts));
45
+ }
46
+ return value;
47
+ }
48
+ return recurse(value);
49
+ });
50
+
51
+ return makeObject(schema, props, meta, typeEntity as object | undefined);
52
+ };
@@ -4,9 +4,8 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
- import { type BaseObject } from '../types';
8
-
9
- import { getTypename } from './typename';
7
+ import { getTypename } from '../Annotation';
8
+ import { type AnyProperties } from '../common/types';
10
9
 
11
10
  // TODO(dmaretskyi): Rename to represent commonality between objects and relations (e.g. `entity`).
12
11
  export type TypedObjectOptions = {
@@ -58,7 +57,7 @@ export const makeTypedEntityClass = (
58
57
  static readonly pipe = baseSchema.pipe.bind(baseSchema);
59
58
 
60
59
  // TODO(burdon): Comment required.
61
- static [Symbol.hasInstance](obj: BaseObject) {
60
+ static [Symbol.hasInstance](obj: AnyProperties) {
62
61
  return obj != null && getTypename(obj) === typename;
63
62
  }
64
63
 
@@ -2,22 +2,20 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { inspect } from 'util';
6
-
7
5
  import * as Schema from 'effect/Schema';
6
+ import { inspect } from 'util';
8
7
  import { describe, expect, test } from 'vitest';
9
8
 
10
- import { DXN } from '@dxos/keys';
9
+ import { DXN, EchoURI } from '@dxos/keys';
11
10
 
12
- import { getSchemaDXN } from '../ast';
13
- import { Testing } from '../testing';
14
- import { isInstanceOf } from '../types';
15
-
16
- import { getSchema } from './accessors';
17
- import { create } from './create';
11
+ import { Relation } from '../../index';
12
+ import { TestSchema } from '../../testing';
13
+ import * as Type from '../../Type';
14
+ import { getTypeURI } from '../Annotation';
15
+ import { ATTR_META, ATTR_TYPE, getSchema } from '../common/types';
16
+ import { ATTR_RELATION_SOURCE, ATTR_RELATION_TARGET, isInstanceOf } from '../Entity';
17
+ import { createObject } from './create-object';
18
18
  import { objectToJSON } from './json-serializer';
19
- import { RelationSourceId, RelationTargetId } from './model';
20
- import { getType } from './typename';
21
19
 
22
20
  describe('create (static version)', () => {
23
21
  test('defaults', ({ expect }) => {
@@ -34,7 +32,7 @@ describe('create (static version)', () => {
34
32
  });
35
33
 
36
34
  test('create static object', () => {
37
- const contact = create(Testing.Contact, {
35
+ const contact = createObject(TestSchema.Person, {
38
36
  name: 'Bot',
39
37
  email: 'bot@example.com',
40
38
  });
@@ -43,12 +41,12 @@ describe('create (static version)', () => {
43
41
  expect(contact.name).toBe('Bot');
44
42
  expect(contact.email).toBe('bot@example.com');
45
43
  expect((contact as any)['@type']).toBeUndefined();
46
- expect(getType(contact)?.toString()).toBe(getSchemaDXN(Testing.Contact)!.toString());
47
- expect(isInstanceOf(Testing.Contact, contact)).toBe(true);
44
+ expect(getTypeURI(contact)?.toString()).toBe(Type.getURI(TestSchema.Person).toString());
45
+ expect(isInstanceOf(TestSchema.Person, contact)).toBe(true);
48
46
  });
49
47
 
50
48
  test('JSON encoding', () => {
51
- const contact = create(Testing.Contact, {
49
+ const contact = createObject(TestSchema.Person, {
52
50
  name: 'Bot',
53
51
  email: 'bot@example.com',
54
52
  });
@@ -56,7 +54,7 @@ describe('create (static version)', () => {
56
54
  const json = JSON.parse(JSON.stringify(contact));
57
55
  expect(json).toEqual({
58
56
  id: contact.id,
59
- '@type': DXN.fromTypenameAndVersion(Testing.Contact.typename, Testing.Contact.version).toString(),
57
+ '@type': DXN.make(Type.getTypename(TestSchema.Person), Type.getVersion(TestSchema.Person)),
60
58
  '@meta': {
61
59
  keys: [],
62
60
  },
@@ -67,52 +65,51 @@ describe('create (static version)', () => {
67
65
  });
68
66
 
69
67
  test('JSON encoding with relation', () => {
70
- const contactA = create(Testing.Contact, {
71
- name: 'Bot',
72
- email: 'bot@example.com',
68
+ const person1 = createObject(TestSchema.Person, {
69
+ name: 'Alice',
70
+ email: 'alice@example.com',
73
71
  });
74
- const contactB = create(Testing.Contact, {
75
- name: 'Bot',
76
- email: 'bot@example.com',
72
+ const person2 = createObject(TestSchema.Person, {
73
+ name: 'Bob',
74
+ email: 'bob@example.com',
77
75
  });
78
- const hasManager = create(Testing.HasManager, {
79
- [RelationSourceId]: contactA,
80
- [RelationTargetId]: contactB,
76
+
77
+ const manager = createObject(TestSchema.HasManager, {
78
+ [Relation.Source]: person1 as any,
79
+ [Relation.Target]: person2 as any,
81
80
  });
82
81
 
83
- const json = JSON.parse(JSON.stringify(hasManager));
82
+ const json = JSON.parse(JSON.stringify(manager));
84
83
  expect(json).toEqual({
85
- id: hasManager.id,
86
- '@type': DXN.fromTypenameAndVersion(Testing.HasManager.typename, Testing.HasManager.version).toString(),
87
- '@relationSource': DXN.fromLocalObjectId(contactA.id).toString(),
88
- '@relationTarget': DXN.fromLocalObjectId(contactB.id).toString(),
89
- '@meta': {
84
+ id: manager.id,
85
+ [ATTR_TYPE]: DXN.make(Type.getTypename(TestSchema.HasManager), Type.getVersion(TestSchema.HasManager)),
86
+ [ATTR_RELATION_SOURCE]: EchoURI.make({ objectId: person1.id }),
87
+ [ATTR_RELATION_TARGET]: EchoURI.make({ objectId: person2.id }),
88
+ [ATTR_META]: {
90
89
  keys: [],
91
90
  },
92
91
  });
93
92
  });
94
93
 
95
94
  test('getSchema', () => {
96
- const contact = create(Testing.Contact, {
95
+ const contact = createObject(TestSchema.Person, {
97
96
  name: 'Bot',
98
97
  email: 'bot@example.com',
99
98
  });
100
99
 
101
- expect(getSchema(contact)).toBe(Testing.Contact);
100
+ expect(getSchema(contact)).toBe(Type.getSchema(TestSchema.Person));
102
101
  });
103
102
 
104
103
  test('inspect', () => {
105
- const contact = create(Testing.Contact, {
104
+ const contact = createObject(TestSchema.Person, {
106
105
  name: 'Bot',
107
106
  email: 'bot@example.com',
108
107
  });
109
108
 
110
- // console.log(contact);
111
-
112
109
  const text = inspect(contact);
113
110
  expect(text).toContain('Bot');
114
111
  expect(text).toContain('bot@example.com');
115
- expect(text).toContain('example.com/type/Contact');
112
+ expect(text).toContain('com.example.type.person');
116
113
  expect(text).toContain('0.1.0');
117
114
  });
118
115
  });
@@ -0,0 +1,135 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { raise } from '@dxos/debug';
6
+ import { assertArgument, failedInvariant } from '@dxos/invariant';
7
+ import { ObjectId } from '@dxos/keys';
8
+
9
+ import type * as Type from '../../Type';
10
+ import { getSchemaURI, getTypeAnnotation, setTypename } from '../Annotation';
11
+ import { defineHiddenProperty } from '../common/proxy';
12
+ import {
13
+ EntityKind,
14
+ KindId,
15
+ MetaId,
16
+ type ObjectMeta,
17
+ SchemaKindId,
18
+ StaticTypeSchemaSlot,
19
+ getStaticTypeSchema,
20
+ setSchema,
21
+ setType,
22
+ } from '../common/types';
23
+ import {
24
+ RelationSourceDXNId,
25
+ RelationSourceId,
26
+ RelationTargetDXNId,
27
+ RelationTargetId,
28
+ assertObjectModel,
29
+ getObjectEchoUri,
30
+ } from '../Entity';
31
+ import { attachedTypedObjectInspector } from './inspect';
32
+ import { attachTypedJsonSerializer } from './json-serializer';
33
+
34
+ // Omits the brand slots — those get stamped on the instance by the entity
35
+ // handler (KindId via setKind, SchemaKindId derived in the proxy `get` trap
36
+ // from kind + jsonSchema.entityKind, StaticTypeSchemaSlot lazily via the
37
+ // proxy), not supplied by the caller. Allows `[Obj.Meta]` (MetaId symbol) for
38
+ // seeding registry-provenance meta at construction (mirrors `Obj.make`).
39
+ export type CreateObjectProps<T> = (T extends { id: string }
40
+ ? Omit<T, 'id' | KindId | SchemaKindId | StaticTypeSchemaSlot> & { id?: string }
41
+ : Omit<T, KindId | SchemaKindId | StaticTypeSchemaSlot>) & {
42
+ readonly [MetaId]?: Partial<ObjectMeta>;
43
+ };
44
+
45
+ /**
46
+ * Creates a new object instance from a schema and data, without signal reactivity.
47
+ * This static version creates plain JavaScript objects that are not reactive/observable.
48
+ * For reactive objects that automatically update UI when changed, use the regular live() function.
49
+ *
50
+ * @param schema - The Effect schema that defines the object's structure and type, piped into EchoObjectSchema
51
+ * @param data - The data to initialize the object with. The id and @type fields are handled automatically.
52
+ * @returns A new non-reactive object instance conforming to the schema
53
+ * @throws {Error} If the schema is not an object schema
54
+ * @throws {TypeError} If data contains an @type field
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const Contact = Schema.Struct({
59
+ * name: Schema.String,
60
+ * email: Schema.String,
61
+ * }).pipe(Type.makeObject(DXN.make('com.example.type.person', '0.1.0')))
62
+ *
63
+ * const contact = createObject(Contact, {
64
+ * name: "John",
65
+ * email: "john@example.com",
66
+ * })
67
+ * ```
68
+ */
69
+ // TODO(burdon): Make internal.
70
+ export const createObject: {
71
+ <T extends Type.AnyEntity>(input: T, props: NoInfer<CreateObjectProps<Type.InstanceType<T>>>): Type.InstanceType<T>;
72
+ } = (input: any, props: any): any => {
73
+ // `Type.Type` entities aren't `Schema.Schema` themselves; read the source
74
+ // schema off the hidden slot (persisted entities synthesize it lazily via
75
+ // the proxy `get` trap).
76
+ const schema = getStaticTypeSchema(input) ?? failedInvariant('Type entity is missing its source schema');
77
+ const annotation = getTypeAnnotation(schema);
78
+ if (!annotation) {
79
+ throw new Error('Schema is not an ECHO schema');
80
+ }
81
+ assertArgument(!('@type' in props), 'data', '@type is not allowed');
82
+ assertArgument(!(RelationSourceDXNId in props), 'data', 'Relation source DXN is not allowed in the constructor');
83
+ assertArgument(!(RelationTargetDXNId in props), 'data', 'Relation target DXN is not allowed in the constructor');
84
+ assertArgument(
85
+ RelationSourceId in props === RelationTargetId in props,
86
+ 'data',
87
+ 'Relation source and target must be provided together',
88
+ );
89
+
90
+ // Pull `[Obj.Meta]` (MetaId-symbol) off props before spreading so it doesn't
91
+ // leak into data. Callers use this to seed registry-provenance meta fields
92
+ // (`key`, `version`) and foreign keys / tags at construction time, mirroring
93
+ // `Obj.make`'s symbol-keyed meta convention.
94
+ const metaOverride = props[MetaId];
95
+ if (metaOverride !== undefined) {
96
+ delete props[MetaId];
97
+ }
98
+
99
+ // Raw object.
100
+ const obj = { ...props, id: props.id ?? ObjectId.random() };
101
+
102
+ // Metadata. Instance-kind is read from the schema's TypeAnnotation (set by
103
+ // EchoObjectSchema / EchoRelationSchema / EchoTypeKindSchema): instances of
104
+ // a type-kind meta-schema are themselves type-kind entities, etc. The
105
+ // RelationSourceId-in-props check covers the legacy path where the schema
106
+ // annotation isn't authoritative.
107
+ const kind =
108
+ annotation.kind === EntityKind.Type
109
+ ? EntityKind.Type
110
+ : annotation.kind === EntityKind.Relation || RelationSourceId in props
111
+ ? EntityKind.Relation
112
+ : EntityKind.Object;
113
+ defineHiddenProperty(obj, KindId, kind);
114
+ defineHiddenProperty(obj, MetaId, { keys: [], ...metaOverride });
115
+ setSchema(obj, schema);
116
+ // If the caller passed a type entity (recognised via the schema slot), keep
117
+ // a reference to it on the instance for `Obj.getType` / `Relation.getType`.
118
+ if (input !== schema) {
119
+ setType(obj, input);
120
+ }
121
+ setTypename(obj, getSchemaURI(schema) ?? failedInvariant('Missing schema URI'));
122
+ attachTypedJsonSerializer(obj);
123
+ attachedTypedObjectInspector(obj);
124
+
125
+ // Relation.
126
+ if (kind === EntityKind.Relation) {
127
+ const sourceDXN = getObjectEchoUri(props[RelationSourceId]) ?? raise(new Error('Unresolved relation source'));
128
+ const targetDXN = getObjectEchoUri(props[RelationTargetId]) ?? raise(new Error('Unresolved relation target'));
129
+ defineHiddenProperty(obj, RelationSourceDXNId, sourceDXN);
130
+ defineHiddenProperty(obj, RelationTargetDXNId, targetDXN);
131
+ }
132
+
133
+ assertObjectModel(obj);
134
+ return obj;
135
+ };
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type AnyProperties } from '../common/types';
6
+ import { ObjectDeletedId } from '../Entity';
7
+
8
+ /**
9
+ * @returns `true` if the object has been marked as deleted.
10
+ */
11
+ export const isDeleted = (obj: AnyProperties): boolean => {
12
+ if ((obj as any)[ObjectDeletedId] === undefined) {
13
+ // TODO(dmaretskyi): Return to prior behavior of throwing.
14
+ // throw new Error('Object does not support deletion marker');
15
+ return false;
16
+ }
17
+
18
+ return (obj as any)[ObjectDeletedId] ?? false;
19
+ };
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './common';
6
+ export * from './create-object';
7
+ export * from './deleted';
8
+ export * from './json-serializer';
9
+ export * from './schema-validator';
10
+ export * from './set-value';
11
+ export * from './snapshot';
12
+ export * from './typed-object';
13
+ export * from './clone';
@@ -6,10 +6,8 @@ import type { InspectOptionsStylized, inspect as inspectFn } from 'node:util';
6
6
 
7
7
  import { type CustomInspectFunction, inspectCustom } from '@dxos/debug';
8
8
 
9
- import { type AnyEchoObject } from '../types';
10
-
11
- import { ATTR_META, ATTR_TYPE, MetaId } from './model';
12
- import { getType } from './typename';
9
+ import { getTypeURI } from '../Annotation';
10
+ import { ATTR_META, ATTR_TYPE, type AnyEntity, MetaId } from '../common/types';
13
11
 
14
12
  /*
15
13
  * @internal
@@ -29,8 +27,8 @@ export const attachedTypedObjectInspector = (obj: any) => {
29
27
  };
30
28
 
31
29
  // NOTE: KEEP as function.
32
- const typedObjectInspectFunction: CustomInspectFunction<AnyEchoObject> = function (
33
- this: AnyEchoObject,
30
+ const typedObjectInspectFunction: CustomInspectFunction<AnyEntity> = function (
31
+ this: AnyEntity,
34
32
  depth: number,
35
33
  options: InspectOptionsStylized,
36
34
  inspect: typeof inspectFn,
@@ -39,7 +37,7 @@ const typedObjectInspectFunction: CustomInspectFunction<AnyEchoObject> = functio
39
37
  return inspect(
40
38
  {
41
39
  id,
42
- [ATTR_TYPE]: getType(this),
40
+ [ATTR_TYPE]: getTypeURI(this),
43
41
  ...props,
44
42
  [ATTR_META]: (this as any)[MetaId], // TODO(dmaretskyi): Couldn't use getMeta since that throw's if the object has no meta.
45
43
  },