@dxos/echo 0.8.4-staging.ac66bdf99f → 0.9.1-main.c7dcc2e112

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 (444) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +7 -7
  3. package/dist/lib/neutral/Annotation.mjs +45 -6
  4. package/dist/lib/neutral/Database.mjs +10 -17
  5. package/dist/lib/neutral/Entity.mjs +35 -20
  6. package/dist/lib/neutral/Err.mjs +3 -3
  7. package/dist/lib/neutral/Feed.mjs +23 -19
  8. package/dist/lib/neutral/Filter.mjs +13 -15
  9. package/dist/lib/neutral/Format.mjs +23 -3
  10. package/dist/lib/neutral/JsonSchema.mjs +7 -8
  11. package/dist/lib/neutral/Key.mjs +9 -5
  12. package/dist/lib/neutral/Migration.mjs +11 -10
  13. package/dist/lib/neutral/Obj.mjs +33 -20
  14. package/dist/lib/neutral/Order.mjs +7 -3
  15. package/dist/lib/neutral/Query.mjs +17 -17
  16. package/dist/lib/neutral/QueryResult.mjs +1 -1
  17. package/dist/lib/neutral/Ref.mjs +10 -9
  18. package/dist/lib/neutral/Registry.mjs +14 -0
  19. package/dist/lib/neutral/Relation.mjs +28 -25
  20. package/dist/lib/neutral/Scope.mjs +12 -0
  21. package/dist/lib/neutral/Tag.mjs +17 -14
  22. package/dist/lib/neutral/Type.mjs +54 -26
  23. package/dist/lib/neutral/{chunk-OMUPQMLR.mjs → chunk-35INCYOE.mjs} +1 -1
  24. package/dist/lib/neutral/chunk-35INCYOE.mjs.map +7 -0
  25. package/dist/lib/neutral/{chunk-4OIBYSXE.mjs → chunk-3JXQUMUI.mjs} +78 -32
  26. package/dist/lib/neutral/chunk-3JXQUMUI.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-G3IQMKF7.mjs → chunk-4TPQZPLY.mjs} +130 -119
  28. package/dist/lib/neutral/chunk-4TPQZPLY.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-TU3GW67D.mjs → chunk-5GAIWRQB.mjs} +40 -40
  30. package/dist/lib/neutral/chunk-5GAIWRQB.mjs.map +7 -0
  31. package/dist/lib/neutral/{chunk-B4BASU6W.mjs → chunk-6CEISA3V.mjs} +93 -76
  32. package/dist/lib/neutral/chunk-6CEISA3V.mjs.map +7 -0
  33. package/dist/lib/neutral/{chunk-GZQTCRJB.mjs → chunk-6M2Z6WBH.mjs} +22 -2
  34. package/dist/lib/neutral/chunk-6M2Z6WBH.mjs.map +7 -0
  35. package/dist/lib/neutral/{chunk-ANHVGJI4.mjs → chunk-7LOUAPYZ.mjs} +9 -5
  36. package/dist/lib/neutral/chunk-7LOUAPYZ.mjs.map +7 -0
  37. package/dist/lib/neutral/{chunk-WAK4DMFV.mjs → chunk-A53NTBHE.mjs} +12 -7
  38. package/dist/lib/neutral/chunk-A53NTBHE.mjs.map +7 -0
  39. package/dist/lib/neutral/{chunk-EAMSSLZC.mjs → chunk-AFANXSGV.mjs} +83 -46
  40. package/dist/lib/neutral/chunk-AFANXSGV.mjs.map +7 -0
  41. package/dist/lib/neutral/{chunk-UBEZSGXY.mjs → chunk-BBFJWWAV.mjs} +6 -6
  42. package/dist/lib/neutral/chunk-BBFJWWAV.mjs.map +7 -0
  43. package/dist/lib/neutral/chunk-E7IOTOZD.mjs +108 -0
  44. package/dist/lib/neutral/chunk-E7IOTOZD.mjs.map +7 -0
  45. package/dist/lib/neutral/{chunk-UI6MWK5W.mjs → chunk-EVK6XBXO.mjs} +16 -2
  46. package/dist/lib/neutral/chunk-EVK6XBXO.mjs.map +7 -0
  47. package/dist/lib/neutral/chunk-HGWQR5KH.mjs +259 -0
  48. package/dist/lib/neutral/chunk-HGWQR5KH.mjs.map +7 -0
  49. package/dist/lib/neutral/chunk-JZ6LFQU5.mjs +109 -0
  50. package/dist/lib/neutral/chunk-JZ6LFQU5.mjs.map +7 -0
  51. package/dist/lib/neutral/{chunk-JUXPFOEI.mjs → chunk-K3S7D5PR.mjs} +48 -88
  52. package/dist/lib/neutral/chunk-K3S7D5PR.mjs.map +7 -0
  53. package/dist/lib/neutral/{chunk-OS35K56T.mjs → chunk-L3OBWBV2.mjs} +3 -3
  54. package/dist/lib/neutral/{chunk-OS35K56T.mjs.map → chunk-L3OBWBV2.mjs.map} +2 -2
  55. package/dist/lib/neutral/{chunk-V36VO5SS.mjs → chunk-NOL7O3BL.mjs} +32 -40
  56. package/dist/lib/neutral/chunk-NOL7O3BL.mjs.map +7 -0
  57. package/dist/lib/neutral/{chunk-TBKX6JQO.mjs → chunk-O6BH7EPN.mjs} +30 -3
  58. package/dist/lib/neutral/chunk-O6BH7EPN.mjs.map +7 -0
  59. package/dist/lib/neutral/{chunk-7RO7CPBZ.mjs → chunk-PLDMJJJC.mjs} +2 -2
  60. package/dist/lib/neutral/{chunk-HBUZJNZO.mjs → chunk-SZ5WB6HF.mjs} +94 -99
  61. package/dist/lib/neutral/chunk-SZ5WB6HF.mjs.map +7 -0
  62. package/dist/lib/neutral/{chunk-BVOFLCVF.mjs → chunk-TF5BSLF6.mjs} +9 -6
  63. package/dist/lib/neutral/chunk-TF5BSLF6.mjs.map +7 -0
  64. package/dist/lib/neutral/{chunk-DQYLD2RB.mjs → chunk-TFEWTY5A.mjs} +155 -129
  65. package/dist/lib/neutral/chunk-TFEWTY5A.mjs.map +7 -0
  66. package/dist/lib/neutral/{chunk-MOR5ERFM.mjs → chunk-VQYL2OQF.mjs} +771 -1252
  67. package/dist/lib/neutral/chunk-VQYL2OQF.mjs.map +7 -0
  68. package/dist/lib/neutral/chunk-WISOH2XH.mjs +36 -0
  69. package/dist/lib/neutral/chunk-WISOH2XH.mjs.map +7 -0
  70. package/dist/lib/neutral/chunk-WU3GIANS.mjs +31 -0
  71. package/dist/lib/neutral/chunk-WU3GIANS.mjs.map +7 -0
  72. package/dist/lib/neutral/chunk-WZ32BF53.mjs +702 -0
  73. package/dist/lib/neutral/chunk-WZ32BF53.mjs.map +7 -0
  74. package/dist/lib/neutral/chunk-X3NUUON4.mjs +184 -0
  75. package/dist/lib/neutral/chunk-X3NUUON4.mjs.map +7 -0
  76. package/dist/lib/neutral/chunk-Z3WMRRAZ.mjs +168 -0
  77. package/dist/lib/neutral/chunk-Z3WMRRAZ.mjs.map +7 -0
  78. package/dist/lib/neutral/index.mjs +47 -41
  79. package/dist/lib/neutral/internal/index.mjs +157 -72
  80. package/dist/lib/neutral/meta.json +1 -1
  81. package/dist/lib/neutral/testing/index.mjs +261 -178
  82. package/dist/lib/neutral/testing/index.mjs.map +4 -4
  83. package/dist/types/src/Annotation.d.ts +108 -4
  84. package/dist/types/src/Annotation.d.ts.map +1 -1
  85. package/dist/types/src/Annotation.test.d.ts +2 -0
  86. package/dist/types/src/Annotation.test.d.ts.map +1 -0
  87. package/dist/types/src/Collection.d.ts +2 -3
  88. package/dist/types/src/Collection.d.ts.map +1 -1
  89. package/dist/types/src/Database.d.ts +78 -49
  90. package/dist/types/src/Database.d.ts.map +1 -1
  91. package/dist/types/src/Dataset.d.ts +16 -6
  92. package/dist/types/src/Dataset.d.ts.map +1 -1
  93. package/dist/types/src/Entity.d.ts +103 -28
  94. package/dist/types/src/Entity.d.ts.map +1 -1
  95. package/dist/types/src/Err.d.ts +27 -27
  96. package/dist/types/src/Err.d.ts.map +1 -1
  97. package/dist/types/src/Feed.d.ts +69 -19
  98. package/dist/types/src/Feed.d.ts.map +1 -1
  99. package/dist/types/src/Filter.d.ts +38 -12
  100. package/dist/types/src/Filter.d.ts.map +1 -1
  101. package/dist/types/src/Format.d.ts +0 -2
  102. package/dist/types/src/Format.d.ts.map +1 -1
  103. package/dist/types/src/Hypergraph.d.ts +14 -9
  104. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  105. package/dist/types/src/Json.d.ts +33 -0
  106. package/dist/types/src/Json.d.ts.map +1 -0
  107. package/dist/types/src/Json.test.d.ts +2 -0
  108. package/dist/types/src/Json.test.d.ts.map +1 -0
  109. package/dist/types/src/JsonSchema.d.ts +2 -2
  110. package/dist/types/src/JsonSchema.d.ts.map +1 -1
  111. package/dist/types/src/Key.d.ts +1 -1
  112. package/dist/types/src/Key.d.ts.map +1 -1
  113. package/dist/types/src/Migration.d.ts +26 -11
  114. package/dist/types/src/Migration.d.ts.map +1 -1
  115. package/dist/types/src/Obj.d.ts +106 -61
  116. package/dist/types/src/Obj.d.ts.map +1 -1
  117. package/dist/types/src/Order.d.ts +10 -0
  118. package/dist/types/src/Order.d.ts.map +1 -1
  119. package/dist/types/src/Query.d.ts +34 -12
  120. package/dist/types/src/Query.d.ts.map +1 -1
  121. package/dist/types/src/QueryResult.d.ts +21 -0
  122. package/dist/types/src/QueryResult.d.ts.map +1 -1
  123. package/dist/types/src/Ref.d.ts +15 -7
  124. package/dist/types/src/Ref.d.ts.map +1 -1
  125. package/dist/types/src/Registry.d.ts +131 -0
  126. package/dist/types/src/Registry.d.ts.map +1 -0
  127. package/dist/types/src/Relation.d.ts +73 -41
  128. package/dist/types/src/Relation.d.ts.map +1 -1
  129. package/dist/types/src/Scope.d.ts +35 -0
  130. package/dist/types/src/Scope.d.ts.map +1 -0
  131. package/dist/types/src/Tag.d.ts +21 -5
  132. package/dist/types/src/Tag.d.ts.map +1 -1
  133. package/dist/types/src/Type.d.ts +366 -95
  134. package/dist/types/src/Type.d.ts.map +1 -1
  135. package/dist/types/src/View.d.ts +9 -12
  136. package/dist/types/src/View.d.ts.map +1 -1
  137. package/dist/types/src/exemplars.test.d.ts +2 -0
  138. package/dist/types/src/exemplars.test.d.ts.map +1 -0
  139. package/dist/types/src/index.d.ts +4 -3
  140. package/dist/types/src/index.d.ts.map +1 -1
  141. package/dist/types/src/internal/Annotation/annotations.d.ts +120 -38
  142. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -1
  143. package/dist/types/src/internal/Annotation/dictionary.d.ts +24 -0
  144. package/dist/types/src/internal/Annotation/dictionary.d.ts.map +1 -0
  145. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts +14 -0
  146. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts.map +1 -0
  147. package/dist/types/src/internal/Annotation/index.d.ts +4 -2
  148. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -1
  149. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -1
  150. package/dist/types/src/internal/Annotation/util.d.ts +14 -5
  151. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -1
  152. package/dist/types/src/internal/Entity/api.d.ts +17 -3
  153. package/dist/types/src/internal/Entity/api.d.ts.map +1 -1
  154. package/dist/types/src/internal/Entity/entity.d.ts +72 -8
  155. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -1
  156. package/dist/types/src/internal/Entity/guard.d.ts +10 -0
  157. package/dist/types/src/internal/Entity/guard.d.ts.map +1 -0
  158. package/dist/types/src/internal/Entity/index.d.ts +2 -0
  159. package/dist/types/src/internal/Entity/index.d.ts.map +1 -1
  160. package/dist/types/src/internal/Entity/model.d.ts +21 -17
  161. package/dist/types/src/internal/Entity/model.d.ts.map +1 -1
  162. package/dist/types/src/internal/Entity/object.d.ts +3 -3
  163. package/dist/types/src/internal/Entity/object.d.ts.map +1 -1
  164. package/dist/types/src/internal/Entity/relation.d.ts +30 -7
  165. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -1
  166. package/dist/types/src/internal/Entity/type-kind.d.ts +24 -0
  167. package/dist/types/src/internal/Entity/type-kind.d.ts.map +1 -0
  168. package/dist/types/src/internal/Entity/type-uri.d.ts +24 -0
  169. package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -0
  170. package/dist/types/src/internal/Entity/version.d.ts.map +1 -1
  171. package/dist/types/src/internal/Format/date.d.ts.map +1 -1
  172. package/dist/types/src/internal/Format/format.d.ts +3 -2
  173. package/dist/types/src/internal/Format/format.d.ts.map +1 -1
  174. package/dist/types/src/internal/Format/index.d.ts +2 -2
  175. package/dist/types/src/internal/Format/index.d.ts.map +1 -1
  176. package/dist/types/src/internal/Format/number.d.ts.map +1 -1
  177. package/dist/types/src/internal/Format/object.d.ts +3 -1
  178. package/dist/types/src/internal/Format/object.d.ts.map +1 -1
  179. package/dist/types/src/internal/Format/types.d.ts.map +1 -1
  180. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -1
  181. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts +34 -34
  182. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -1
  183. package/dist/types/src/internal/JsonSchema/json-schema.d.ts +3 -2
  184. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -1
  185. package/dist/types/src/internal/Obj/atoms.d.ts +43 -0
  186. package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -0
  187. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -1
  188. package/dist/types/src/internal/Obj/common.d.ts.map +1 -1
  189. package/dist/types/src/internal/Obj/create-object.d.ts +12 -12
  190. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -1
  191. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -1
  192. package/dist/types/src/internal/Obj/index.d.ts +1 -1
  193. package/dist/types/src/internal/Obj/index.d.ts.map +1 -1
  194. package/dist/types/src/internal/Obj/json-serializer.d.ts +8 -8
  195. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -1
  196. package/dist/types/src/internal/Obj/set-value.d.ts +1 -1
  197. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -1
  198. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -1
  199. package/dist/types/src/internal/Obj/typed-object.d.ts +1 -1
  200. package/dist/types/src/internal/Query/index.d.ts +2 -0
  201. package/dist/types/src/internal/Query/index.d.ts.map +1 -0
  202. package/dist/types/src/internal/{Query.d.ts → Query/pretty.d.ts} +1 -1
  203. package/dist/types/src/internal/Query/pretty.d.ts.map +1 -0
  204. package/dist/types/src/internal/Ref/atoms.d.ts +10 -0
  205. package/dist/types/src/internal/Ref/atoms.d.ts.map +1 -0
  206. package/dist/types/src/internal/Ref/index.d.ts +1 -0
  207. package/dist/types/src/internal/Ref/index.d.ts.map +1 -1
  208. package/dist/types/src/internal/Ref/ref-array.d.ts +2 -2
  209. package/dist/types/src/internal/Ref/ref.d.ts +114 -19
  210. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -1
  211. package/dist/types/src/internal/Ref/strong-deps.d.ts +35 -0
  212. package/dist/types/src/internal/Ref/strong-deps.d.ts.map +1 -0
  213. package/dist/types/src/internal/Ref/utils.d.ts +8 -0
  214. package/dist/types/src/internal/Ref/utils.d.ts.map +1 -0
  215. package/dist/types/src/internal/Type/compose.d.ts.map +1 -1
  216. package/dist/types/src/internal/Type/index.d.ts +1 -2
  217. package/dist/types/src/internal/Type/index.d.ts.map +1 -1
  218. package/dist/types/src/internal/Type/manipulation.d.ts +0 -1
  219. package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -1
  220. package/dist/types/src/internal/Type/type-schema.d.ts +52 -0
  221. package/dist/types/src/internal/Type/type-schema.d.ts.map +1 -0
  222. package/dist/types/src/internal/common/api/meta.d.ts +14 -11
  223. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -1
  224. package/dist/types/src/internal/common/proxy/change-context.d.ts +1 -1
  225. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -1
  226. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -1
  227. package/dist/types/src/internal/common/proxy/errors.d.ts +1 -1
  228. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -1
  229. package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -1
  230. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -1
  231. package/dist/types/src/internal/common/proxy/make-object.d.ts +11 -5
  232. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -1
  233. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -1
  234. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -1
  235. package/dist/types/src/internal/common/proxy/reactive-array.d.ts +1 -1
  236. package/dist/types/src/internal/common/proxy/reactive.d.ts +1 -1
  237. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -1
  238. package/dist/types/src/internal/common/proxy/reactive.test.d.ts +2 -0
  239. package/dist/types/src/internal/common/proxy/reactive.test.d.ts.map +1 -0
  240. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -1
  241. package/dist/types/src/internal/common/proxy/typed-handler.d.ts +18 -2
  242. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -1
  243. package/dist/types/src/internal/common/types/base.d.ts +4 -4
  244. package/dist/types/src/internal/common/types/base.d.ts.map +1 -1
  245. package/dist/types/src/internal/common/types/entity.d.ts +62 -5
  246. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -1
  247. package/dist/types/src/internal/common/types/index.d.ts +1 -1
  248. package/dist/types/src/internal/common/types/index.d.ts.map +1 -1
  249. package/dist/types/src/internal/common/types/meta.d.ts +33 -12
  250. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -1
  251. package/dist/types/src/internal/common/types/model-symbols.d.ts +15 -4
  252. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -1
  253. package/dist/types/src/internal/common/types/typename.d.ts +7 -0
  254. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -1
  255. package/dist/types/src/internal/common/types/version.d.ts +1 -1
  256. package/dist/types/src/internal/common/types/well-known-types.d.ts +11 -0
  257. package/dist/types/src/internal/common/types/well-known-types.d.ts.map +1 -0
  258. package/dist/types/src/internal/index.d.ts +2 -2
  259. package/dist/types/src/internal/index.d.ts.map +1 -1
  260. package/dist/types/src/testing/index.d.ts +1 -0
  261. package/dist/types/src/testing/index.d.ts.map +1 -1
  262. package/dist/types/src/testing/registry.d.ts +9 -0
  263. package/dist/types/src/testing/registry.d.ts.map +1 -0
  264. package/dist/types/src/testing/test-data.d.ts +8 -8
  265. package/dist/types/src/testing/test-data.d.ts.map +1 -1
  266. package/dist/types/src/testing/test-schema.d.ts +83 -89
  267. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  268. package/dist/types/src/testing/util.d.ts +5 -3
  269. package/dist/types/src/testing/util.d.ts.map +1 -1
  270. package/dist/types/tsconfig.tsbuildinfo +1 -1
  271. package/package.json +26 -24
  272. package/src/Annotation.test.ts +439 -0
  273. package/src/Annotation.ts +163 -4
  274. package/src/Collection.ts +5 -9
  275. package/src/Database.ts +126 -101
  276. package/src/Dataset.ts +10 -2
  277. package/src/Entity.test.ts +116 -6
  278. package/src/Entity.ts +136 -32
  279. package/src/Err.ts +4 -4
  280. package/src/Feed.ts +95 -44
  281. package/src/Filter.ts +70 -40
  282. package/src/Format.ts +0 -4
  283. package/src/Hypergraph.ts +14 -9
  284. package/src/Json.test.ts +175 -0
  285. package/src/Json.ts +103 -0
  286. package/src/Key.ts +1 -1
  287. package/src/Migration.ts +39 -19
  288. package/src/Obj.test.ts +122 -20
  289. package/src/Obj.ts +170 -91
  290. package/src/Order.ts +22 -0
  291. package/src/Query.test.ts +183 -154
  292. package/src/Query.ts +172 -85
  293. package/src/QueryResult.ts +26 -0
  294. package/src/Ref.ts +22 -4
  295. package/src/Registry.ts +155 -0
  296. package/src/Relation.test.ts +10 -10
  297. package/src/Relation.ts +116 -69
  298. package/src/Scope.ts +50 -0
  299. package/src/Tag.md +88 -0
  300. package/src/Tag.ts +50 -6
  301. package/src/Type.test.ts +223 -18
  302. package/src/Type.ts +623 -131
  303. package/src/View.ts +14 -23
  304. package/src/exemplars.test.ts +21 -0
  305. package/src/index.ts +4 -4
  306. package/src/internal/Annotation/annotations.test.ts +31 -11
  307. package/src/internal/Annotation/annotations.ts +199 -111
  308. package/src/internal/Annotation/dictionary.ts +47 -0
  309. package/src/internal/Annotation/entity-dictionary.ts +74 -0
  310. package/src/internal/Annotation/index.ts +4 -2
  311. package/src/internal/Annotation/util.ts +17 -8
  312. package/src/internal/Entity/api.ts +54 -7
  313. package/src/internal/Entity/entity.ts +196 -47
  314. package/src/internal/Entity/guard.ts +26 -0
  315. package/src/internal/Entity/index.ts +2 -0
  316. package/src/internal/Entity/model.ts +38 -28
  317. package/src/internal/Entity/object.ts +21 -5
  318. package/src/internal/Entity/relation.ts +68 -34
  319. package/src/internal/Entity/type-kind.ts +75 -0
  320. package/src/internal/Entity/type-uri.ts +92 -0
  321. package/src/internal/Entity/util.ts +9 -9
  322. package/src/internal/Format/date.ts +0 -4
  323. package/src/internal/Format/format.test.ts +21 -0
  324. package/src/internal/Format/index.ts +2 -3
  325. package/src/internal/Format/object.ts +21 -4
  326. package/src/internal/Format/types.ts +1 -1
  327. package/src/internal/JsonSchema/annotations.ts +1 -1
  328. package/src/internal/JsonSchema/json-schema-type.ts +4 -4
  329. package/src/internal/JsonSchema/json-schema.test.ts +71 -145
  330. package/src/internal/JsonSchema/json-schema.ts +49 -35
  331. package/src/internal/Obj/atoms.ts +275 -0
  332. package/src/internal/Obj/clone.ts +9 -4
  333. package/src/internal/Obj/create-object.test.ts +12 -10
  334. package/src/internal/Obj/create-object.ts +68 -22
  335. package/src/internal/Obj/index.ts +1 -1
  336. package/src/internal/Obj/inspect.ts +5 -3
  337. package/src/internal/Obj/json-serializer.test.ts +101 -22
  338. package/src/internal/Obj/json-serializer.ts +92 -36
  339. package/src/internal/Obj/set-value.test.ts +22 -45
  340. package/src/internal/Obj/set-value.ts +12 -19
  341. package/src/internal/Obj/snapshot.ts +13 -4
  342. package/src/internal/Obj/typed-object.test.ts +9 -11
  343. package/src/internal/Obj/typed-object.ts +1 -1
  344. package/src/internal/Query/index.ts +5 -0
  345. package/src/internal/{Query.ts → Query/pretty.ts} +40 -12
  346. package/src/internal/Ref/atoms.ts +20 -0
  347. package/src/internal/Ref/index.ts +1 -0
  348. package/src/internal/Ref/ref-array.ts +3 -3
  349. package/src/internal/Ref/ref.test.ts +18 -27
  350. package/src/internal/Ref/ref.ts +224 -69
  351. package/src/internal/Ref/strong-deps.ts +107 -0
  352. package/src/internal/Ref/utils.ts +45 -0
  353. package/src/internal/Type/compose.test.ts +3 -1
  354. package/src/internal/Type/index.ts +1 -2
  355. package/src/internal/Type/manipulation.ts +0 -25
  356. package/src/internal/Type/type-schema.ts +60 -0
  357. package/src/internal/common/README.md +2 -2
  358. package/src/internal/common/api/meta.ts +19 -17
  359. package/src/internal/common/proxy/change-context.ts +1 -1
  360. package/src/internal/common/proxy/change.test.ts +91 -83
  361. package/src/internal/common/proxy/errors.ts +2 -2
  362. package/src/internal/common/proxy/handler.test.ts +1 -1
  363. package/src/internal/common/proxy/json-serializer.ts +27 -16
  364. package/src/internal/common/proxy/make-object.ts +44 -20
  365. package/src/internal/common/proxy/ownership.ts +2 -2
  366. package/src/internal/common/proxy/reactive-array.ts +1 -1
  367. package/src/internal/common/proxy/reactive.test.ts +54 -0
  368. package/src/internal/common/proxy/reactive.ts +11 -2
  369. package/src/internal/common/proxy/schema.test.ts +48 -86
  370. package/src/internal/common/proxy/typed-handler.test.ts +12 -11
  371. package/src/internal/common/proxy/typed-handler.ts +78 -16
  372. package/src/internal/common/proxy/typed-object.test.ts +16 -28
  373. package/src/internal/common/types/base.ts +4 -4
  374. package/src/internal/common/types/entity.ts +80 -1
  375. package/src/internal/common/types/index.ts +6 -1
  376. package/src/internal/common/types/meta.ts +62 -20
  377. package/src/internal/common/types/model-symbols.ts +24 -4
  378. package/src/internal/common/types/typename.ts +39 -3
  379. package/src/internal/common/types/well-known-types.ts +15 -0
  380. package/src/internal/index.ts +6 -4
  381. package/src/testing/api.test.ts +15 -9
  382. package/src/testing/index.ts +1 -0
  383. package/src/testing/registry.ts +44 -0
  384. package/src/testing/test-data.ts +159 -99
  385. package/src/testing/test-schema.ts +22 -58
  386. package/src/testing/util.ts +14 -11
  387. package/dist/lib/neutral/Extension.mjs +0 -18
  388. package/dist/lib/neutral/SchemaRegistry.mjs +0 -2
  389. package/dist/lib/neutral/chunk-2KHZ36F5.mjs +0 -361
  390. package/dist/lib/neutral/chunk-2KHZ36F5.mjs.map +0 -7
  391. package/dist/lib/neutral/chunk-4OIBYSXE.mjs.map +0 -7
  392. package/dist/lib/neutral/chunk-4P3IXBLT.mjs +0 -45
  393. package/dist/lib/neutral/chunk-4P3IXBLT.mjs.map +0 -7
  394. package/dist/lib/neutral/chunk-ANHVGJI4.mjs.map +0 -7
  395. package/dist/lib/neutral/chunk-B4BASU6W.mjs.map +0 -7
  396. package/dist/lib/neutral/chunk-BNCCGLJN.mjs +0 -7
  397. package/dist/lib/neutral/chunk-BNCCGLJN.mjs.map +0 -7
  398. package/dist/lib/neutral/chunk-BVOFLCVF.mjs.map +0 -7
  399. package/dist/lib/neutral/chunk-DQYLD2RB.mjs.map +0 -7
  400. package/dist/lib/neutral/chunk-EAMSSLZC.mjs.map +0 -7
  401. package/dist/lib/neutral/chunk-G3IQMKF7.mjs.map +0 -7
  402. package/dist/lib/neutral/chunk-GZQTCRJB.mjs.map +0 -7
  403. package/dist/lib/neutral/chunk-HBUZJNZO.mjs.map +0 -7
  404. package/dist/lib/neutral/chunk-JUXPFOEI.mjs.map +0 -7
  405. package/dist/lib/neutral/chunk-MOR5ERFM.mjs.map +0 -7
  406. package/dist/lib/neutral/chunk-OMUPQMLR.mjs.map +0 -7
  407. package/dist/lib/neutral/chunk-PHU22NLC.mjs +0 -136
  408. package/dist/lib/neutral/chunk-PHU22NLC.mjs.map +0 -7
  409. package/dist/lib/neutral/chunk-ROG4RXXL.mjs +0 -97
  410. package/dist/lib/neutral/chunk-ROG4RXXL.mjs.map +0 -7
  411. package/dist/lib/neutral/chunk-T6W2LEZU.mjs +0 -125
  412. package/dist/lib/neutral/chunk-T6W2LEZU.mjs.map +0 -7
  413. package/dist/lib/neutral/chunk-TBKX6JQO.mjs.map +0 -7
  414. package/dist/lib/neutral/chunk-TU3GW67D.mjs.map +0 -7
  415. package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +0 -7
  416. package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +0 -7
  417. package/dist/lib/neutral/chunk-V36VO5SS.mjs.map +0 -7
  418. package/dist/lib/neutral/chunk-WAK4DMFV.mjs.map +0 -7
  419. package/dist/lib/neutral/chunk-YAHXAYOW.mjs +0 -56
  420. package/dist/lib/neutral/chunk-YAHXAYOW.mjs.map +0 -7
  421. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs +0 -50
  422. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs.map +0 -7
  423. package/dist/types/src/Extension.d.ts +0 -80
  424. package/dist/types/src/Extension.d.ts.map +0 -1
  425. package/dist/types/src/Extension.test.d.ts +0 -2
  426. package/dist/types/src/Extension.test.d.ts.map +0 -1
  427. package/dist/types/src/SchemaRegistry.d.ts +0 -84
  428. package/dist/types/src/SchemaRegistry.d.ts.map +0 -1
  429. package/dist/types/src/internal/Obj/ids.d.ts +0 -6
  430. package/dist/types/src/internal/Obj/ids.d.ts.map +0 -1
  431. package/dist/types/src/internal/Query.d.ts.map +0 -1
  432. package/dist/types/src/internal/Type/echo-schema.d.ts +0 -181
  433. package/dist/types/src/internal/Type/echo-schema.d.ts.map +0 -1
  434. package/dist/types/src/internal/Type/persistent-schema.d.ts +0 -20
  435. package/dist/types/src/internal/Type/persistent-schema.d.ts.map +0 -1
  436. package/src/Extension.test.ts +0 -235
  437. package/src/Extension.ts +0 -122
  438. package/src/SchemaRegistry.ts +0 -106
  439. package/src/internal/Obj/ids.ts +0 -12
  440. package/src/internal/Type/echo-schema.ts +0 -423
  441. package/src/internal/Type/persistent-schema.ts +0 -33
  442. /package/dist/lib/neutral/{Extension.mjs.map → Registry.mjs.map} +0 -0
  443. /package/dist/lib/neutral/{SchemaRegistry.mjs.map → Scope.mjs.map} +0 -0
  444. /package/dist/lib/neutral/{chunk-7RO7CPBZ.mjs.map → chunk-PLDMJJJC.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"View.d.ts","sourceRoot":"","sources":["../../../src/View.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO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CAAC;AAE7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;EAOtB,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,yDAA2D,CAAC;AAEtF,eAAO,MAAM,aAAa,cAAsC,CAAC;AAEjE,eAAO,MAAM,UAAU;IACrB;;OAEG;;IAGH;;OAEG;;;;;;;IAIH;;;OAGG;;EAEH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D;;;GAGG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;wBAkBf,CAAC;AAOF,MAAM,WAAW,IAAK,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC;CAAG;AAErE,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,CAAC;AAEtD,eAAO,MAAM,IAAI,UAAW,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,IAAI,CAAC,CAAC,KAAG,IAMjE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=exemplars.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exemplars.test.d.ts","sourceRoot":"","sources":["../../../src/exemplars.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  export { QueryAST } from '@dxos/echo-protocol';
2
- export { DXN } from '@dxos/keys';
2
+ export { DXN, EID, URI } from '@dxos/keys';
3
3
  export * as Annotation from './Annotation';
4
4
  export * as Database from './Database';
5
5
  export * as Entity from './Entity';
@@ -8,6 +8,7 @@ export * as Feed from './Feed';
8
8
  export * as Filter from './Filter';
9
9
  export * as Format from './Format';
10
10
  export * as Hypergraph from './Hypergraph';
11
+ export * as Json from './Json';
11
12
  export * as JsonSchema from './JsonSchema';
12
13
  export * as Key from './Key';
13
14
  export * as Migration from './Migration';
@@ -16,12 +17,12 @@ export * as Order from './Order';
16
17
  export * as Query from './Query';
17
18
  export * as QueryResult from './QueryResult';
18
19
  export * as Ref from './Ref';
20
+ export * as Registry from './Registry';
19
21
  export * as Relation from './Relation';
20
- export * as SchemaRegistry from './SchemaRegistry';
22
+ export * as Scope from './Scope';
21
23
  export * as Tag from './Tag';
22
24
  export * as Type from './Type';
23
25
  export * as Collection from './Collection';
24
26
  export * as View from './View';
25
27
  export * as Dataset from './Dataset';
26
- export * as Extension from './Extension';
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAA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AAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC"}
@@ -1,10 +1,11 @@
1
+ import * as Option from 'effect/Option';
1
2
  import * as Schema from 'effect/Schema';
2
3
  import * as SchemaAST from 'effect/SchemaAST';
3
- import { DXN } from '@dxos/keys';
4
+ import { DXN, URI } from '@dxos/keys';
4
5
  import { type Primitive } from '@dxos/util';
6
+ import type * as Annotation from '../../Annotation';
5
7
  import { type Mutable } from '../common/proxy';
6
8
  import { type AnyProperties, EntityKind } from '../common/types';
7
- import { type AnnotationHelper } from './util';
8
9
  /**
9
10
  * Sets the path for the field.
10
11
  * @param path Data source path in the json path format. This is the field path in the source object.
@@ -12,22 +13,22 @@ import { type AnnotationHelper } from './util';
12
13
  export declare const FieldPath: (path: string) => <A, I, R>(self: Schema.Schema<A, I, R>) => Schema.Schema<A, I, R>;
13
14
  /**
14
15
  * ECHO identifier (for a stored schema).
15
- * Must be a `dxn:echo:` URI.
16
+ * Must be an `echo:` URI.
16
17
  */
17
18
  export declare const TypeIdentifierAnnotationId: unique symbol;
18
19
  export declare const getTypeIdentifierAnnotation: (schema: Schema.Schema.All) => string | undefined;
19
20
  /**
20
- * @returns DXN of the schema.
21
+ * @returns The schema's type identifier URI — whichever URI fits.
21
22
  *
22
- * For non-stored schema returns `dxn:type:`.
23
- * For stored schema returns `dxn:echo:`.
24
- */
25
- export declare const getSchemaDXN: (schema: Schema.Schema.All) => DXN | undefined;
26
- /**
27
- * @param input schema or a typename string.
28
- * @return type DXN.
23
+ * - Stored (dynamic) schemas: the schema-as-object's EID, so loaded objects ride
24
+ * along with their schema as a strong dependency.
25
+ * - Non-stored (static) schemas: the typename DXN built from `TypeAnnotation`.
26
+ *
27
+ * This URI is what gets written to an object's `system.type`; queries that filter by
28
+ * type also use it (see `Filter.type` / `getTypeURIFromSpecifier`), so both sides
29
+ * stay symmetric without per-schema branching.
29
30
  */
30
- export declare const getTypeDXNFromSpecifier: (input: Schema.Schema.All | string) => DXN;
31
+ export declare const getSchemaURI: (schema: Schema.Schema.All) => URI.URI | undefined;
31
32
  /**
32
33
  * Fully qualified globally unique typename.
33
34
  * Example: `org.dxos.type.message`
@@ -60,12 +61,12 @@ export declare const TypeAnnotation: Schema.extend<Schema.Struct<{
60
61
  * If this is a relation, the schema of the source object.
61
62
  * Must be present if entity kind is {@link EntityKind.Relation}.
62
63
  */
63
- sourceSchema: Schema.optional<Schema.refine<string, typeof Schema.NonEmptyString>>;
64
+ sourceSchema: Schema.optional<Schema.Schema<DXN.DXN, DXN.DXN, never>>;
64
65
  /**
65
66
  * If this is a relation, the schema of the target object.
66
67
  * Must be present if entity kind is {@link EntityKind.Relation}.
67
68
  */
68
- targetSchema: Schema.optional<Schema.refine<string, typeof Schema.NonEmptyString>>;
69
+ targetSchema: Schema.optional<Schema.Schema<DXN.DXN, DXN.DXN, never>>;
69
70
  }>>;
70
71
  export interface TypeAnnotation extends Schema.Schema.Type<typeof TypeAnnotation> {
71
72
  }
@@ -78,16 +79,6 @@ export declare const getTypeAnnotation: (schema: Schema.Schema.All) => TypeAnnot
78
79
  * @returns {@link EntityKind} from a schema.
79
80
  */
80
81
  export declare const getEntityKind: (schema: Schema.Schema.All) => EntityKind | undefined;
81
- /**
82
- * Checks if the object is an instance of the schema.
83
- * Only typename is compared, the schema version is ignored.
84
- *
85
- * The following cases are considered to mean that the object is an instance of the schema:
86
- * - Object was created with this exact schema.
87
- * - Object was created with a different version of this schema.
88
- * - Object was created with a different schema (maybe dynamic) that has the same typename.
89
- */
90
- export declare const isInstanceOf: <Schema extends Schema.Schema.AnyNoContext>(schema: Schema, object: any) => object is Schema.Schema.Type<Schema>;
91
82
  /**
92
83
  * PropertyMeta (metadata for dynamic schema properties).
93
84
  * For user-defined annotations.
@@ -97,6 +88,12 @@ export type PropertyMetaValue = Primitive | Record<string, Primitive> | Primitiv
97
88
  export type PropertyMetaAnnotation = {
98
89
  [name: string]: PropertyMetaValue;
99
90
  };
91
+ /**
92
+ * Apply property-level metadata to an Effect schema. Only accepts
93
+ * `Schema.Schema.Any` — apply BEFORE wrapping the schema with
94
+ * `Type.makeObject` / `Type.makeRelation`. To read property meta off a
95
+ * `Type.Type` entity, unwrap it first with `Type.getSchema(entity)`.
96
+ */
100
97
  export declare const PropertyMeta: (name: string, value: PropertyMetaValue) => <A, I, R>(self: Schema.Schema<A, I, R>) => Schema.Schema<A, I, R>;
101
98
  export declare const getPropertyMetaAnnotation: <T>(prop: SchemaAST.PropertySignature, name: string) => T | undefined;
102
99
  /**
@@ -104,7 +101,7 @@ export declare const getPropertyMetaAnnotation: <T>(prop: SchemaAST.PropertySign
104
101
  */
105
102
  export declare const ReferenceAnnotationId: unique symbol;
106
103
  export type ReferenceAnnotationValue = TypeAnnotation;
107
- export declare const ReferenceAnnotation: AnnotationHelper<TypeAnnotation>;
104
+ export declare const ReferenceAnnotation: import("./util").AnnotationHelper<TypeAnnotation>;
108
105
  /**
109
106
  * SchemaMeta.
110
107
  */
@@ -113,16 +110,16 @@ export type SchemaMeta = TypeMeta & {
113
110
  id: string;
114
111
  };
115
112
  /**
116
- * Identifies a schema as a schema for a hidden system type.
113
+ * Identifies a schema as hidden from user-facing surfaces (like dotfiles — visible only via an advanced setting).
117
114
  */
118
- export declare const SystemTypeAnnotationId: unique symbol;
119
- export declare const SystemTypeAnnotation: AnnotationHelper<boolean>;
115
+ export declare const HiddenAnnotationId: unique symbol;
116
+ export declare const HiddenAnnotation: import("./util").AnnotationHelper<boolean>;
120
117
  /**
121
118
  * Identifies label property or JSON path expression.
122
119
  * Either a string or an array of strings representing field accessors each matched in priority order.
123
120
  */
124
121
  export declare const LabelAnnotationId: unique symbol;
125
- export declare const LabelAnnotation: AnnotationHelper<string[]>;
122
+ export declare const LabelAnnotation: import("./util").AnnotationHelper<string[]>;
126
123
  /**
127
124
  * Returns the label for a given object based on {@link LabelAnnotationId}.
128
125
  * Lower-level version that requires explicit schema parameter.
@@ -139,7 +136,7 @@ export declare const setLabelWithSchema: <S extends Schema.Schema.Any>(schema: S
139
136
  * A string representing field accessor.
140
137
  */
141
138
  export declare const DescriptionAnnotationId: unique symbol;
142
- export declare const DescriptionAnnotation: AnnotationHelper<string>;
139
+ export declare const DescriptionAnnotation: import("./util").AnnotationHelper<string>;
143
140
  /**
144
141
  * Returns the description for a given object based on {@link DescriptionAnnotationId}.
145
142
  * Lower-level version that requires explicit schema parameter.
@@ -155,7 +152,49 @@ export declare const setDescriptionWithSchema: <S extends Schema.Schema.Any>(sch
155
152
  * By default, all properties are included in forms, so this is opt-out.
156
153
  */
157
154
  export declare const FormInputAnnotationId: unique symbol;
158
- export declare const FormInputAnnotation: AnnotationHelper<boolean>;
155
+ export declare const FormInputAnnotation: import("./util").AnnotationHelper<boolean>;
156
+ /**
157
+ * When set on a `Ref` property, the form renders the referenced object's own
158
+ * fields inline (a nested form bound to the target) instead of a picker.
159
+ */
160
+ export declare const FormInlineAnnotationId: unique symbol;
161
+ export declare const FormInlineAnnotation: import("./util").AnnotationHelper<boolean>;
162
+ /**
163
+ * When set on an array property, the form renders it as an ordered,
164
+ * drag-to-reorder list (drag handles per row). Element order is meaningful and
165
+ * user-controllable; reordering rewrites the array.
166
+ */
167
+ export declare const FormOrderedAnnotationId: unique symbol;
168
+ export declare const FormOrderedAnnotation: import("./util").AnnotationHelper<boolean>;
169
+ /**
170
+ * Annotation carrying one or more named layout DSL templates that control how a
171
+ * form arranges a schema's fields (consumed by `@dxos/react-ui-form`'s
172
+ * `Form.Layout` / `Form.FieldSet`). Callers select a variant by name; the
173
+ * implicit name is `DEFAULT_LAYOUT_NAME` (`'default'`).
174
+ *
175
+ * Templates use a minimal XML grammar. Example:
176
+ *
177
+ * FormLayoutAnnotation.set({
178
+ * default: `
179
+ * <grid cols="2">
180
+ * <field name="origin"/>
181
+ * <field name="destination"/>
182
+ * <field name="provider" span="2"/>
183
+ * </grid>
184
+ * `,
185
+ * card: `
186
+ * <grid cols="1">
187
+ * <field name="provider"/>
188
+ * <field name="number"/>
189
+ * </grid>
190
+ * `,
191
+ * })
192
+ */
193
+ export declare const FormLayoutAnnotationId: unique symbol;
194
+ export type FormLayoutMap = Record<string, string>;
195
+ export declare const FormLayoutAnnotation: import("./util").AnnotationHelper<FormLayoutMap>;
196
+ /** Name used when no explicit form-layout variant is requested. */
197
+ export declare const DEFAULT_LAYOUT_NAME = "default";
159
198
  /**
160
199
  * Default field to be used on referenced schema to lookup the value.
161
200
  */
@@ -169,12 +208,12 @@ export type GeneratorAnnotationValue = string | {
169
208
  args?: any[];
170
209
  probability?: number;
171
210
  };
172
- export declare const GeneratorAnnotation: AnnotationHelper<GeneratorAnnotationValue>;
211
+ export declare const GeneratorAnnotation: import("./util").AnnotationHelper<GeneratorAnnotationValue>;
173
212
  interface MakeAnnoationsProps<T> {
174
213
  id: string;
175
214
  schema: Schema.Schema<T, any, never>;
176
215
  }
177
- export declare const makeUserAnnotation: <T>(props: MakeAnnoationsProps<T>) => AnnotationHelper<T>;
216
+ export declare const makeUserAnnotation: <T>(props: MakeAnnoationsProps<T>) => Annotation.Annotation<T>;
178
217
  declare const IconAnnotationSchema: Schema.Struct<{
179
218
  /**
180
219
  * Phosphor icon name (e.g., 'ph--user--regular', 'ph--cube--regular', 'ph--link--regular ', etc.)
@@ -206,26 +245,69 @@ export interface IconAnnotation extends Schema.Schema.Type<typeof IconAnnotation
206
245
  /**
207
246
  * Icon to render in the UI.
208
247
  */
209
- export declare const IconAnnotation: AnnotationHelper<IconAnnotation>;
248
+ export declare const IconAnnotation: Annotation.Annotation<IconAnnotation>;
249
+ /**
250
+ * Indicates that this entity's icon should be resolved from a property whose value is a `Ref`
251
+ * to another entity. Consumers (e.g. graph node builders) resolve the ref target and use that
252
+ * target's schema `IconAnnotation` in place of the static one declared on this schema.
253
+ *
254
+ * Useful for wrapper schemas that delegate their visual identity to a referenced sub-entity
255
+ * (e.g. a generic `Game` whose icon should come from its `variant` ref's typed state).
256
+ */
257
+ export declare const IconFromRefAnnotation: Annotation.Annotation<string>;
258
+ /**
259
+ * Options for {@link getLabel}.
260
+ */
261
+ export type GetLabelOptions = {
262
+ /**
263
+ * Strategy for deriving a label when the entity has no `LabelAnnotation` value.
264
+ * - `'typename'`: use the entity's typename (e.g. `org.dxos.type.table`).
265
+ * Useful for Card.Title chrome that must always display something, even
266
+ * for unlabeled objects.
267
+ */
268
+ fallback?: 'typename';
269
+ };
210
270
  /**
211
271
  * Get the label of an entity.
212
272
  * Accepts both reactive entities and snapshots.
273
+ *
274
+ * If `options.fallback === 'typename'` and no label is set, returns the
275
+ * entity's typename instead.
213
276
  */
214
- export declare const getLabel: (entity: AnyProperties) => string | undefined;
277
+ export declare const getLabel: (entity: AnyProperties, options?: GetLabelOptions) => string | undefined;
215
278
  /**
216
279
  * Set the label of an entity.
217
- * Must be called within an Obj.change or Relation.change callback.
280
+ * Must be called within an Obj.update or Relation.update callback.
218
281
  */
219
282
  export declare const setLabel: (entity: Mutable<AnyProperties>, label: string) => void;
283
+ /**
284
+ * Returns the primary label property key for an entity.
285
+ * Reads the first accessor from {@link LabelAnnotation}, defaulting to 'name'.
286
+ */
287
+ export declare const getLabelProperty: (entity: AnyProperties) => string;
220
288
  /**
221
289
  * Get the description of an entity.
222
290
  * Accepts both reactive entities and snapshots.
223
291
  */
224
292
  export declare const getDescription: (entity: AnyProperties) => string | undefined;
293
+ /**
294
+ * Get the icon annotation for an entity, resolved via its type-level `IconAnnotation`.
295
+ * Accepts both reactive entities and snapshots.
296
+ *
297
+ * Returns the full `{ icon, hue }` annotation so callers can use both the phosphor icon
298
+ * name and the suggested colour. Callers wanting just the icon name typically write
299
+ * `Obj.getIcon(obj)?.icon ?? 'ph--cube--regular'`.
300
+ *
301
+ * Note: this is the "static" icon from the object's own schema. It does not follow
302
+ * `IconFromRefAnnotation` delegation — call sites needing that (e.g. app-graph node
303
+ * builders) should resolve the ref themselves.
304
+ */
305
+ export declare const getIcon: (entity: AnyProperties) => IconAnnotation | undefined;
225
306
  /**
226
307
  * Set the description of an entity.
227
- * Must be called within an Obj.change or Relation.change callback.
308
+ * Must be called within an Obj.update or Relation.update callback.
228
309
  */
229
310
  export declare const setDescription: (entity: Mutable<AnyProperties>, description: string) => void;
230
- export {};
311
+ export { Dictionary, Key, getDictionary, setDictionary } from './dictionary';
312
+ export declare const getFromAst: <T>(ast: SchemaAST.AST, annotation: Annotation.Annotation<T>) => Option.Option<T>;
231
313
  //# sourceMappingURL=annotations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/annotations.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,aAAa,EAAE,UAAU,EAAqB,MAAM,iBAAiB,CAAC;AACpF,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,QAAQ,CAAC;AAOvE;;;GAGG;AAEH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,MAoQ5B,CAAC,EAAE,CAAC,EAAE,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AUpF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,WAAY,OAAO,CAAC,aAAa,CAAC,SAAS,MAAM,SAKrE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAY,aAAa,KAAG,MASxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,WAAY,aAAa,KAAG,MAAM,GAAG,SAK/D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,WAAY,aAAa,KAAG,cAAc,GAAG,SAMhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,WAAY,OAAO,CAAC,aAAa,CAAC,eAAe,MAAM,SAKjF,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7E,eAAO,MAAM,UAAU,GAAI,CAAC,OAAO,SAAS,CAAC,GAAG,cAAc,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAKvG,CAAC"}
@@ -0,0 +1,24 @@
1
+ import * as Option from 'effect/Option';
2
+ import * as Schema from 'effect/Schema';
3
+ import * as Types from 'effect/Types';
4
+ import type * as Annotation from '../../Annotation';
5
+ /**
6
+ * Unique identifier for an annotation.
7
+ */
8
+ export declare const Key: Schema.brand<typeof Schema.String, "~@dxos/echo/AnnotationKey">;
9
+ export type Key = Schema.Schema.Type<typeof Key>;
10
+ /**
11
+ * Set of annotation values stored on entity meta or nested in schemas.
12
+ */
13
+ export declare const Dictionary: Schema.Record$<Schema.brand<typeof Schema.String, "~@dxos/echo/AnnotationKey">, typeof Schema.Unknown>;
14
+ export interface Dictionary extends Schema.Schema.Type<typeof Dictionary> {
15
+ }
16
+ /**
17
+ * Get the value of an annotation from a dictionary.
18
+ */
19
+ export declare const getDictionary: <T>(values: Annotation.Dictionary, annotation: Annotation.Annotation<T>) => Option.Option<T>;
20
+ /**
21
+ * Set the value of an annotation in a dictionary.
22
+ */
23
+ export declare const setDictionary: <T>(values: Types.Mutable<Annotation.Dictionary>, annotation: Annotation.Annotation<T>, value: T) => void;
24
+ //# sourceMappingURL=dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/dictionary.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,GAAG,iEAAgE,CAAC;AACjF,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,UAAU,wGAAqD,CAAC;AAC7E,MAAM,WAAW,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC;CAAG;AAE5E;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,UACrB,UAAU,CAAC,UAAU,cACjB,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,KACnC,MAAM,CAAC,MAAM,CAAC,CAAC,CAMjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,UACrB,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,cAChC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,SAC7B,CAAC,KACP,IAEF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as Option from 'effect/Option';
2
+ import type * as Annotation from '../../Annotation';
3
+ import type * as Entity from '../../Entity';
4
+ import { type Mutable } from '../common/proxy/reactive';
5
+ /**
6
+ * Get the value of an annotation from an entity instance or snapshot.
7
+ */
8
+ export declare const get: <T>(target: Entity.Unknown | Entity.Snapshot, annotation: Annotation.Annotation<T>) => Option.Option<T>;
9
+ /**
10
+ * Set the value of an annotation on an entity instance.
11
+ * Must be called with a mutable entity — i.e. inside an `Obj.update` callback.
12
+ */
13
+ export declare const set: <T>(target: Mutable<Entity.Unknown>, annotation: Annotation.Annotation<T>, value: T) => void;
14
+ //# sourceMappingURL=entity-dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-dictionary.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/entity-dictionary.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAMxD;;GAEG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,UACX,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,cAC5B,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,KACnC,MAAM,CAAC,MAAM,CAAC,CAAC,CAOjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,GAAG,GAAI,CAAC,UAAU,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,KAAG,IAcxG,CAAC"}
@@ -1,4 +1,6 @@
1
- export * from './annotations';
2
- export * from './sorting';
1
+ export * from './dictionary';
3
2
  export * from './util';
3
+ export * from './sorting';
4
+ export * from './annotations';
5
+ export * from './entity-dictionary';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/sorting.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,EAAE,IAAI,MAAM,KAAG,MAQhD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,UAA8E,CAAC;AAEzG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAAoF,CAAC;AAElH;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,SAAS,EAAE,GAAG,aAAa,UAAU,CAAC,CAAC,CAAC,EAAE,KAAG,UAAU,CAAC,CAAC,CAUvF,CAAC"}
1
+ {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/sorting.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,OAAO,OAAQ,MAAM,MAAM,MAAM,KAAG,MAQhD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,UAA8E,CAAC;AAEzG;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,UAAoF,CAAC;AAElH;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,SAAS,kBAAkB,UAAU,CAAC,CAAC,CAAC,EAAE,KAAG,UAAU,CAAC,CAAC,CAUvF,CAAC"}
@@ -1,10 +1,15 @@
1
- import type * as Option from 'effect/Option';
1
+ import * as Option from 'effect/Option';
2
2
  import type * as Schema from 'effect/Schema';
3
3
  import * as SchemaAST from 'effect/SchemaAST';
4
4
  import { EntityKind } from '../common/types';
5
5
  export interface AnnotationHelper<T> {
6
6
  /**
7
- * Get the annotation value from the schema.
7
+ * Get the annotation value from an Effect schema.
8
+ *
9
+ * Only accepts `Schema.Schema.Any` — to read an annotation off a `Type.Type`
10
+ * entity, unwrap it first with `Type.getSchema(entity)`. This keeps the
11
+ * annotation pipeline single-shaped and forces annotations to live on the
12
+ * source schema, not on the post-construction Type entity.
8
13
  */
9
14
  get: (schema: Schema.Schema.Any) => Option.Option<T>;
10
15
  /**
@@ -12,7 +17,11 @@ export interface AnnotationHelper<T> {
12
17
  */
13
18
  getFromAst: (ast: SchemaAST.AST) => Option.Option<T>;
14
19
  /**
15
- * Set the annotation value on the schema.
20
+ * Set the annotation on an Effect schema.
21
+ *
22
+ * Only accepts `Schema.Schema.Any` — annotations must be applied to the
23
+ * source schema BEFORE wrapping it with `Type.makeObject` / `Type.makeRelation`.
24
+ * In a pipe, place every `Annotation.X.set(...)` before the `Type.make...` step.
16
25
  */
17
26
  set: (value: T) => <S extends Schema.Schema.Any>(schema: S) => S;
18
27
  }
@@ -23,7 +32,7 @@ export declare const createAnnotationHelper: <T>(id: symbol) => AnnotationHelper
23
32
  /**
24
33
  * If property is optional returns the nested property, otherwise returns the property.
25
34
  */
26
- export declare const unwrapOptional: (property: SchemaAST.PropertySignature) => SchemaAST.AST | SchemaAST.PropertySignature;
35
+ export declare const unwrapOptional: (property: SchemaAST.PropertySignature) => SchemaAST.PropertySignature | SchemaAST.AST;
27
36
  /**
28
37
  * @see JSONSchemaAnnotationId
29
38
  * @returns JSON-schema annotation so that the schema can be serialized with correct parameters.
@@ -35,5 +44,5 @@ export declare const makeTypeJsonSchemaAnnotation: (options: {
35
44
  version: string;
36
45
  relationSource?: string;
37
46
  relationTarget?: string;
38
- }) => any;
47
+ }) => Record<string, unknown>;
39
48
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Annotation/util.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAK9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC;;OAEG;IACH,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrD;;OAEG;IACH,UAAU,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrD;;OAEG;IACH,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;CAClE;AAED;;GAEG;AAEH,eAAO,MAAM,sBAAsB,GAAI,CAAC,EAAE,IAAI,MAAM,KAAG,gBAAgB,CAAC,CAAC,CASxE,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,GAAI,UAAU,SAAS,CAAC,iBAAiB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ACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,4BAgBA,CAAC"}
@@ -1,10 +1,24 @@
1
- import { type DXN } from '@dxos/keys';
1
+ import { URI } from '@dxos/keys';
2
2
  import type { AnyEntity } from '../common/types';
3
3
  /**
4
- * Get the DXN of an entity.
4
+ * Controls the URI form returned by `getUri` and the public `*.getURI` helpers.
5
+ *
6
+ * - `'named'` — Registry key URI (`dxn:<meta.key>`) when the entity has a key in its meta;
7
+ * falls back to the default EID.
8
+ * - `'absolute'` — Fully-qualified EID with space id (`echo://<spaceId>/<entityId>`);
9
+ * falls back when no space is available.
10
+ * - `'relative'` — Local EID without space id (`echo:/<entityId>`).
11
+ *
12
+ * Omitting `prefer` preserves the existing behaviour.
13
+ */
14
+ export type GetURIOptions = {
15
+ prefer?: 'named' | 'absolute' | 'relative';
16
+ };
17
+ /**
18
+ * Get the URI of an entity.
5
19
  * Accepts both reactive entities and snapshots.
6
20
  */
7
- export declare const getDXN: (entity: AnyEntity) => DXN;
21
+ export declare const getUri: (entity: AnyEntity, options?: GetURIOptions) => URI.URI;
8
22
  /**
9
23
  * Get the database the entity belongs to.
10
24
  * Accepts both reactive entities and snapshots.
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Entity/api.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,QAAQ,SAAS,KAAG,GAI1C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,SAAS,KAAG,GAAG,GAAG,SAGrD,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/internal/Entity/api.ts"],"names":[],"mappings":"AAKA,OAAO,EAAY,GAAG,EAAgB,MAAM,YAAY,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;CAC5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,WAAY,SAAS,YAAY,aAAa,KAAG,GAAG,CAAC,GAmCvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAY,SAAS,KAAG,GAAG,GAAG,SAGrD,CAAC"}
@@ -1,20 +1,84 @@
1
1
  import * as Schema from 'effect/Schema';
2
2
  import type * as Types from 'effect/Types';
3
+ import { DXN, EntityId } from '@dxos/keys';
3
4
  import { type ToMutable } from '@dxos/util';
4
- import { type TypeMeta } from '../Annotation';
5
- import { type AnyEntity, type EntityKind, SchemaKindId } from '../common/types';
5
+ import { type AnyEntity, EntityKind, InstancePhantomId, KindId, SchemaKindId, StaticTypeSchemaSlot } from '../common/types';
6
+ import { JsonSchemaType } from '../JsonSchema/json-schema-type';
6
7
  export type EchoTypeSchemaProps<T, ExtraFields = {}> = Types.Simplify<AnyEntity & ToMutable<T> & ExtraFields>;
7
- export interface EchoTypeSchema<Self extends Schema.Schema.Any, ExtraFields = {}, K extends EntityKind = EntityKind, Fields extends Schema.Struct.Fields = Schema.Struct.Fields> extends TypeMeta, Schema.AnnotableClass<EchoTypeSchema<Self, ExtraFields, K, Fields>, EchoTypeSchemaProps<Schema.Schema.Type<Self>, ExtraFields>, EchoTypeSchemaProps<Schema.Schema.Encoded<Self>, ExtraFields>, Schema.Schema.Context<Self>> {
8
+ /**
9
+ * Options accepted by every `Type.makeObject` / `Type.makeRelation` / type-kind
10
+ * factory. Defaults are derived from `(typename, version)` so callers normally
11
+ * pass nothing.
12
+ */
13
+ export type EchoTypeOptions = {
8
14
  /**
9
- * Schema kind key that marks this as an ECHO schema and indicates its kind.
10
- * Makes EchoTypeSchema satisfy the Type.AnyObj or Type.Relation.Any type.
15
+ * Override the entity id stamped on the in-memory `Type.Type` value.
16
+ *
17
+ * Defaults to `EntityId.deterministic(typename, version)` — stable across processes
18
+ * and workerd-safe (no `crypto.getRandomValues()` at module-evaluation time).
19
+ * Pass an explicit id (typically `EntityId.random()`) to opt out of the
20
+ * deterministic default.
11
21
  */
22
+ id?: EntityId;
23
+ };
24
+ /**
25
+ * In-memory `Type.Type` entity shape produced by `Type.makeObject(dxn)` /
26
+ * `Type.makeRelation({...})`. A live reactive `TypeSchema` instance —
27
+ * identical to a persisted `Type.Type` except for database attachment.
28
+ *
29
+ * NOT a `Schema.Schema`. The underlying Effect Schema is cached on the hidden
30
+ * `StaticTypeSchemaSlot` slot — retrieve it via `Type.getSchema(...)`.
31
+ */
32
+ export interface EchoTypeSchema<Self extends Schema.Schema.Any, ExtraFields = {}, K extends EntityKind = EntityKind, Fields extends Schema.Struct.Fields = Schema.Struct.Fields> {
33
+ /**
34
+ * Entity-kind brand. Type entities are their own kind (`Type`) regardless of
35
+ * the kind of instance they describe — `[SchemaKindId]` carries the latter.
36
+ * This lets predicates like `Obj.isObject` / `Relation.isRelation` cleanly
37
+ * reject type entities without also having to inspect `[SchemaKindId]`.
38
+ */
39
+ readonly [KindId]: EntityKind.Type;
40
+ /** Schema-kind brand indicating what kind of instance this type describes. */
12
41
  readonly [SchemaKindId]: K;
13
42
  /**
14
- * The fields defined in the original struct schema.
15
- * Allows accessing field definitions for introspection.
43
+ * Entity id. Always present stamped at construction — but NOT the type's
44
+ * identity while in-memory: an unattached type resolves its URI to the typename
45
+ * DXN, switching to `echo:/<id>` only once attached to a database (see
46
+ * `getTypeURIFromSpecifier`, which discriminates by database attachment).
16
47
  */
48
+ readonly id: EntityId;
49
+ /** Source Effect Schema (kept on a hidden slot for `Type.getSchema`). */
50
+ readonly [StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;
51
+ readonly jsonSchema: JsonSchemaType;
52
+ /** Struct fields for introspection. */
17
53
  readonly fields: Fields;
18
- instanceOf(value: unknown): boolean;
54
+ /** Phantom — instance type produced by `Obj.make(self, ...)`. */
55
+ readonly _instance?: EchoTypeSchemaProps<Schema.Schema.Type<Self>, ExtraFields>;
56
+ /**
57
+ * Phantom slot mirroring `Type<A>` so internal helpers (`makeObject`,
58
+ * `createObject`, `Ref.make`) infer the instance type uniformly whether
59
+ * the caller passes an `EchoTypeSchema` or a top-level `Type.Type` entity.
60
+ *
61
+ * Includes the instance-kind brand (`[KindId]`) so the phantom is assignable
62
+ * to the matching public-side interface in `Type.ts` (`Type.Obj` /
63
+ * `Type.Relation` / `Type.Type`). Each kind projects identity: instances of
64
+ * an object-kind schema are object-kind entities, type-kind schemas produce
65
+ * type-kind (persisted Type.Type) entities — the latter additionally carry
66
+ * the `[SchemaKindId]` / `[StaticTypeSchemaSlot]` brands the echo-handler
67
+ * proxy exposes on persisted Type entities.
68
+ */
69
+ readonly [InstancePhantomId]?: EchoTypeSchemaProps<Schema.Schema.Type<Self>, ExtraFields> & {
70
+ readonly [KindId]: K;
71
+ } & (K extends EntityKind.Type ? {
72
+ readonly [SchemaKindId]: EntityKind.Type;
73
+ readonly [StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;
74
+ } : {});
19
75
  }
76
+ /**
77
+ * Identity (typename + version) of the type meta-schema — the `Type.Type` that
78
+ * every ECHO type entity is itself an instance of. Shared by the materialisation
79
+ * vehicle ({@link persistentEntitySchema}) and `TypeSchema` so the two cannot
80
+ * drift on identity.
81
+ */
82
+ export declare const TypeMetaSchemaDXN: DXN.DXN;
83
+ export { isEntity } from './guard';
20
84
  //# sourceMappingURL=entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":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