@dxos/echo 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65

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 (499) hide show
  1. package/dist/lib/neutral/Annotation.mjs +3 -3
  2. package/dist/lib/neutral/Database.mjs +4 -4
  3. package/dist/lib/neutral/Entity.mjs +10 -7
  4. package/dist/lib/neutral/Err.mjs +1 -1
  5. package/dist/lib/neutral/Feed.mjs +13 -10
  6. package/dist/lib/neutral/Filter.mjs +11 -8
  7. package/dist/lib/neutral/Format.mjs +3 -3
  8. package/dist/lib/neutral/JsonSchema.mjs +8 -7
  9. package/dist/lib/neutral/Obj.mjs +11 -8
  10. package/dist/lib/neutral/Order.mjs +1 -1
  11. package/dist/lib/neutral/Query.mjs +16 -13
  12. package/dist/lib/neutral/Ref.mjs +7 -7
  13. package/dist/lib/neutral/Relation.mjs +12 -9
  14. package/dist/lib/neutral/SchemaRegistry.mjs +1 -1
  15. package/dist/lib/neutral/Tag.mjs +13 -10
  16. package/dist/lib/neutral/Type.mjs +10 -7
  17. package/dist/lib/neutral/chunk-43Y5DOS6.mjs +396 -0
  18. package/dist/lib/neutral/chunk-43Y5DOS6.mjs.map +7 -0
  19. package/dist/lib/neutral/{chunk-GAWKQ5DZ.mjs → chunk-724GQYEN.mjs} +5 -5
  20. package/dist/lib/neutral/chunk-724GQYEN.mjs.map +7 -0
  21. package/dist/lib/neutral/{chunk-M2KVTHZM.mjs → chunk-B5OXLWZL.mjs} +10 -10
  22. package/dist/lib/neutral/chunk-B5OXLWZL.mjs.map +7 -0
  23. package/dist/lib/neutral/{chunk-T6JEFNP6.mjs → chunk-BNCCGLJN.mjs} +1 -1
  24. package/dist/lib/neutral/{chunk-T6JEFNP6.mjs.map → chunk-BNCCGLJN.mjs.map} +1 -1
  25. package/dist/lib/neutral/chunk-BOZZPUXE.mjs +787 -0
  26. package/dist/lib/neutral/chunk-BOZZPUXE.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-ZWKJ4LZJ.mjs → chunk-CIRHIEMW.mjs} +16 -16
  28. package/dist/lib/neutral/chunk-CIRHIEMW.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-GFNCSK7F.mjs → chunk-DYDJBZEG.mjs} +10 -9
  30. package/dist/lib/neutral/chunk-DYDJBZEG.mjs.map +7 -0
  31. package/dist/lib/neutral/{chunk-QXF3LGN2.mjs → chunk-FXEG7EOK.mjs} +5 -3
  32. package/dist/lib/neutral/chunk-FXEG7EOK.mjs.map +7 -0
  33. package/dist/lib/neutral/{chunk-DZQSL6RW.mjs → chunk-FZO7LQO7.mjs} +2 -2
  34. package/dist/lib/neutral/{chunk-DZQSL6RW.mjs.map → chunk-FZO7LQO7.mjs.map} +1 -1
  35. package/dist/lib/neutral/{chunk-AQP4QKYP.mjs → chunk-KTAWP7GI.mjs} +8 -8
  36. package/dist/lib/neutral/chunk-KTAWP7GI.mjs.map +7 -0
  37. package/dist/lib/neutral/{chunk-5ELDDYWE.mjs → chunk-NEGC54NE.mjs} +4 -4
  38. package/dist/lib/neutral/chunk-NEGC54NE.mjs.map +7 -0
  39. package/dist/lib/neutral/{chunk-KGV3QIRX.mjs → chunk-NQRLRYJM.mjs} +11 -11
  40. package/dist/lib/neutral/chunk-NQRLRYJM.mjs.map +7 -0
  41. package/dist/lib/neutral/{chunk-ALOGSVBP.mjs → chunk-NXMFBIT5.mjs} +3 -3
  42. package/dist/lib/neutral/chunk-NXMFBIT5.mjs.map +7 -0
  43. package/dist/lib/neutral/{chunk-OVUBTQLT.mjs → chunk-OENWMTE6.mjs} +2 -2
  44. package/dist/lib/neutral/chunk-OENWMTE6.mjs.map +7 -0
  45. package/dist/lib/neutral/{chunk-T4MPQJ7X.mjs → chunk-RMLF7JOZ.mjs} +6 -6
  46. package/dist/lib/neutral/chunk-RMLF7JOZ.mjs.map +7 -0
  47. package/dist/lib/neutral/{chunk-F7KMHDPJ.mjs → chunk-SEMVAGBM.mjs} +41 -13
  48. package/dist/lib/neutral/chunk-SEMVAGBM.mjs.map +7 -0
  49. package/dist/lib/neutral/{chunk-PP4DNUZU.mjs → chunk-TQQZLKB7.mjs} +1541 -2748
  50. package/dist/lib/neutral/chunk-TQQZLKB7.mjs.map +7 -0
  51. package/dist/lib/neutral/{chunk-MXQJZCPY.mjs → chunk-UBEZSGXY.mjs} +1 -1
  52. package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
  53. package/dist/lib/neutral/{chunk-W7OP5HGZ.mjs → chunk-UFDK26FO.mjs} +6 -6
  54. package/dist/lib/neutral/chunk-UFDK26FO.mjs.map +7 -0
  55. package/dist/lib/neutral/{chunk-ZTUBYOGB.mjs → chunk-UI6MWK5W.mjs} +1 -1
  56. package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
  57. package/dist/lib/neutral/{chunk-O3TZFQCT.mjs → chunk-UTBRYVQC.mjs} +2 -2
  58. package/dist/lib/neutral/chunk-UTBRYVQC.mjs.map +7 -0
  59. package/dist/lib/neutral/{chunk-BRJSLACP.mjs → chunk-VA2F47ZC.mjs} +12 -12
  60. package/dist/lib/neutral/chunk-VA2F47ZC.mjs.map +7 -0
  61. package/dist/lib/neutral/{chunk-4KG6IGL4.mjs → chunk-WYOKA6AE.mjs} +4 -4
  62. package/dist/lib/neutral/{chunk-4KG6IGL4.mjs.map → chunk-WYOKA6AE.mjs.map} +2 -2
  63. package/dist/lib/neutral/chunk-YWXWXIE5.mjs +34 -0
  64. package/dist/lib/neutral/chunk-YWXWXIE5.mjs.map +7 -0
  65. package/dist/lib/neutral/index.mjs +24 -21
  66. package/dist/lib/neutral/internal/index.mjs +44 -38
  67. package/dist/lib/neutral/meta.json +1 -1
  68. package/dist/lib/neutral/testing/index.mjs +35 -31
  69. package/dist/lib/neutral/testing/index.mjs.map +2 -2
  70. package/dist/types/src/Annotation.d.ts +3 -3
  71. package/dist/types/src/Annotation.d.ts.map +1 -1
  72. package/dist/types/src/Collection.d.ts.map +1 -1
  73. package/dist/types/src/Database.d.ts +3 -3
  74. package/dist/types/src/Database.d.ts.map +1 -1
  75. package/dist/types/src/Dataset.d.ts.map +1 -1
  76. package/dist/types/src/Entity.d.ts.map +1 -1
  77. package/dist/types/src/Err.d.ts.map +1 -1
  78. package/dist/types/src/Feed.d.ts +4 -4
  79. package/dist/types/src/Feed.d.ts.map +1 -1
  80. package/dist/types/src/Filter.d.ts.map +1 -1
  81. package/dist/types/src/Format.d.ts +1 -1
  82. package/dist/types/src/Format.d.ts.map +1 -1
  83. package/dist/types/src/Hypergraph.d.ts +6 -1
  84. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  85. package/dist/types/src/JsonSchema.d.ts +5 -5
  86. package/dist/types/src/JsonSchema.d.ts.map +1 -1
  87. package/dist/types/src/Obj.d.ts +4 -2
  88. package/dist/types/src/Obj.d.ts.map +1 -1
  89. package/dist/types/src/Order.d.ts.map +1 -1
  90. package/dist/types/src/Query.d.ts.map +1 -1
  91. package/dist/types/src/Ref.d.ts +11 -11
  92. package/dist/types/src/Ref.d.ts.map +1 -1
  93. package/dist/types/src/Relation.d.ts +2 -1
  94. package/dist/types/src/Relation.d.ts.map +1 -1
  95. package/dist/types/src/SchemaRegistry.d.ts +1 -1
  96. package/dist/types/src/Tag.d.ts.map +1 -1
  97. package/dist/types/src/Type.d.ts +12 -11
  98. package/dist/types/src/Type.d.ts.map +1 -1
  99. package/dist/types/src/View.d.ts.map +1 -1
  100. package/dist/types/src/internal/{annotations → Annotation}/annotations.d.ts +23 -2
  101. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
  102. package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
  103. package/dist/types/src/internal/Annotation/index.d.ts +4 -0
  104. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
  105. package/dist/types/src/internal/{api → Annotation}/sorting.d.ts +1 -1
  106. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
  107. package/dist/types/src/internal/{annotations → Annotation}/util.d.ts +1 -1
  108. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
  109. package/dist/types/src/internal/{api/entity.d.ts → Entity/api.d.ts} +2 -2
  110. package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
  111. package/dist/types/src/internal/{entities → Entity}/entity.d.ts +2 -2
  112. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
  113. package/dist/types/src/internal/{entities → Entity}/index.d.ts +2 -0
  114. package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
  115. package/dist/types/src/internal/{entities → Entity}/model.d.ts +2 -26
  116. package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
  117. package/dist/types/src/internal/{entities → Entity}/object.d.ts +2 -2
  118. package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
  119. package/dist/types/src/internal/{entities → Entity}/relation.d.ts +3 -30
  120. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
  121. package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
  122. package/dist/types/src/internal/{api → Entity}/version.d.ts +1 -1
  123. package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
  124. package/dist/types/src/internal/Format/date.d.ts.map +1 -0
  125. package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
  126. package/dist/types/src/internal/Format/format.d.ts.map +1 -0
  127. package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
  128. package/dist/types/src/internal/Format/index.d.ts.map +1 -0
  129. package/dist/types/src/internal/Format/number.d.ts.map +1 -0
  130. package/dist/types/src/internal/Format/object.d.ts.map +1 -0
  131. package/dist/types/src/internal/Format/select.d.ts.map +1 -0
  132. package/dist/types/src/internal/Format/string.d.ts.map +1 -0
  133. package/dist/types/src/internal/{formats → Format}/types.d.ts +1 -1
  134. package/dist/types/src/internal/Format/types.d.ts.map +1 -0
  135. package/dist/types/src/internal/{json-schema → JsonSchema}/annotations.d.ts +1 -1
  136. package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
  137. package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
  138. package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
  139. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
  140. package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +23 -23
  141. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
  142. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
  143. package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
  144. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
  145. package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
  146. package/dist/types/src/internal/{object → Obj}/create-object.d.ts +2 -2
  147. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
  148. package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
  149. package/dist/types/src/internal/{object → Obj}/deleted.d.ts +1 -1
  150. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
  151. package/dist/types/src/internal/Obj/ids.d.ts.map +1 -0
  152. package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
  153. package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
  154. package/dist/types/src/internal/{object → Obj}/json-serializer.d.ts +12 -5
  155. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
  156. package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
  157. package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
  158. package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
  159. package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
  160. package/dist/types/src/internal/{object → Obj}/set-value.d.ts +1 -1
  161. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
  162. package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
  163. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
  164. package/dist/types/src/internal/{object → Obj}/typed-object.d.ts +2 -2
  165. package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
  166. package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
  167. package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
  168. package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +1 -1
  169. package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
  170. package/dist/types/src/internal/{ref → Ref}/ref.d.ts +2 -2
  171. package/dist/types/src/internal/{ref → Ref}/ref.d.ts.map +1 -1
  172. package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
  173. package/dist/types/src/internal/{schema → Type}/compose.d.ts +1 -1
  174. package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
  175. package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
  176. package/dist/types/src/internal/{schema → Type}/echo-schema.d.ts +5 -5
  177. package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -0
  178. package/dist/types/src/internal/Type/index.d.ts.map +1 -0
  179. package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
  180. package/dist/types/src/internal/{schema → Type}/persistent-schema.d.ts +2 -2
  181. package/dist/types/src/internal/Type/persistent-schema.d.ts.map +1 -0
  182. package/dist/types/src/internal/{api → common/api}/index.d.ts +0 -4
  183. package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
  184. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
  185. package/dist/types/src/internal/common/index.d.ts +4 -0
  186. package/dist/types/src/internal/common/index.d.ts.map +1 -0
  187. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
  188. package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
  189. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
  190. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
  191. package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
  192. package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
  193. package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
  194. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
  195. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
  196. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
  197. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
  198. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
  199. package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
  200. package/dist/types/src/internal/{proxy → common/proxy}/reactive.d.ts +1 -1
  201. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
  202. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
  203. package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
  204. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
  205. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
  206. package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
  207. package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
  208. package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
  209. package/dist/types/src/internal/{types → common/types}/entity.d.ts +1 -1
  210. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
  211. package/dist/types/src/internal/{types → common/types}/index.d.ts +1 -0
  212. package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
  213. package/dist/types/src/internal/{types → common/types}/meta.d.ts +3 -3
  214. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
  215. package/dist/types/src/internal/common/types/model-symbols.d.ts +54 -0
  216. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
  217. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
  218. package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
  219. package/dist/types/src/internal/index.d.ts +8 -10
  220. package/dist/types/src/internal/index.d.ts.map +1 -1
  221. package/dist/types/src/testing/test-schema.d.ts +7 -7
  222. package/dist/types/tsconfig.tsbuildinfo +1 -1
  223. package/package.json +13 -13
  224. package/src/Annotation.ts +5 -3
  225. package/src/Collection.ts +3 -1
  226. package/src/Database.ts +6 -4
  227. package/src/Dataset.ts +2 -0
  228. package/src/Entity.ts +3 -0
  229. package/src/Err.ts +2 -0
  230. package/src/Feed.ts +8 -5
  231. package/src/Filter.ts +2 -0
  232. package/src/Format.ts +1 -1
  233. package/src/Hypergraph.ts +7 -2
  234. package/src/JsonSchema.ts +7 -5
  235. package/src/Obj.test.ts +2 -2
  236. package/src/Obj.ts +15 -9
  237. package/src/Order.ts +2 -0
  238. package/src/Query.test.ts +23 -23
  239. package/src/Query.ts +4 -2
  240. package/src/Ref.ts +14 -12
  241. package/src/Relation.test.ts +2 -2
  242. package/src/Relation.ts +6 -3
  243. package/src/SchemaRegistry.ts +1 -1
  244. package/src/Tag.ts +3 -1
  245. package/src/Type.ts +14 -11
  246. package/src/View.ts +4 -2
  247. package/src/internal/{annotations → Annotation}/annotations.test.ts +6 -6
  248. package/src/internal/{annotations → Annotation}/annotations.ts +56 -11
  249. package/src/internal/{annotations → Annotation}/index.ts +1 -0
  250. package/src/internal/{api → Annotation}/sorting.ts +2 -3
  251. package/src/internal/{annotations → Annotation}/util.ts +1 -1
  252. package/src/internal/{api/entity.ts → Entity/api.ts} +4 -2
  253. package/src/internal/{entities → Entity}/entity.ts +2 -2
  254. package/src/internal/{entities → Entity}/index.ts +2 -0
  255. package/src/internal/{entities → Entity}/model.ts +13 -42
  256. package/src/internal/{entities → Entity}/object.ts +2 -2
  257. package/src/internal/{entities → Entity}/relation.ts +19 -36
  258. package/src/internal/{api → Entity}/version.ts +3 -2
  259. package/src/internal/{formats → Format}/date.test.ts +1 -1
  260. package/src/internal/{formats → Format}/format.test.ts +1 -1
  261. package/src/internal/{formats → Format}/types.ts +2 -2
  262. package/src/internal/{json-schema → JsonSchema}/annotations.ts +3 -3
  263. package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +4 -4
  264. package/src/internal/{json-schema → JsonSchema}/json-schema.test.ts +48 -48
  265. package/src/internal/{json-schema → JsonSchema}/json-schema.ts +3 -3
  266. package/src/internal/{object → Obj}/clone.ts +3 -3
  267. package/src/internal/{object → Obj}/common.ts +2 -2
  268. package/src/internal/{object → Obj}/create-object.test.ts +4 -4
  269. package/src/internal/{object → Obj}/create-object.ts +5 -5
  270. package/src/internal/{object → Obj}/deleted.ts +2 -2
  271. package/src/internal/{object → Obj}/inspect.ts +2 -2
  272. package/src/internal/{object → Obj}/json-serializer.test.ts +6 -6
  273. package/src/internal/{object → Obj}/json-serializer.ts +17 -6
  274. package/src/internal/{object → Obj}/schema-validator.ts +1 -1
  275. package/src/internal/{object → Obj}/set-value.ts +2 -2
  276. package/src/internal/{object → Obj}/snapshot.ts +14 -5
  277. package/src/internal/{object → Obj}/typed-object.test.ts +3 -3
  278. package/src/internal/{object → Obj}/typed-object.ts +2 -2
  279. package/src/internal/{ref → Ref}/ref-array.ts +1 -1
  280. package/src/internal/{ref → Ref}/ref.test.ts +4 -4
  281. package/src/internal/{ref → Ref}/ref.ts +3 -3
  282. package/src/internal/{schema → Type}/compose.test.ts +5 -5
  283. package/src/internal/{schema → Type}/compose.ts +1 -1
  284. package/src/internal/{schema → Type}/echo-schema.ts +6 -6
  285. package/src/internal/{schema → Type}/manipulation.ts +1 -1
  286. package/src/internal/{schema → Type}/persistent-schema.ts +5 -5
  287. package/src/internal/{api → common/api}/index.ts +0 -4
  288. package/src/internal/common/index.ts +7 -0
  289. package/src/internal/{proxy → common/proxy}/change.test.ts +3 -3
  290. package/src/internal/{proxy → common/proxy}/handler.test.ts +2 -2
  291. package/src/internal/{proxy → common/proxy}/json-serializer.ts +6 -3
  292. package/src/internal/{proxy → common/proxy}/make-object.ts +1 -1
  293. package/src/internal/{proxy → common/proxy}/reactive.ts +1 -1
  294. package/src/internal/{proxy → common/proxy}/schema.test.ts +10 -10
  295. package/src/internal/{proxy → common/proxy}/typed-handler.test.ts +6 -6
  296. package/src/internal/{proxy → common/proxy}/typed-handler.ts +2 -3
  297. package/src/internal/{proxy → common/proxy}/typed-object.test.ts +4 -4
  298. package/src/internal/{types → common/types}/entity.ts +1 -1
  299. package/src/internal/{types → common/types}/index.ts +1 -0
  300. package/src/internal/{types → common/types}/meta.ts +1 -1
  301. package/src/internal/common/types/model-symbols.ts +69 -0
  302. package/src/internal/index.ts +8 -31
  303. package/src/testing/api.test.ts +2 -2
  304. package/src/testing/test-schema.ts +9 -9
  305. package/dist/lib/neutral/chunk-5ELDDYWE.mjs.map +0 -7
  306. package/dist/lib/neutral/chunk-ALOGSVBP.mjs.map +0 -7
  307. package/dist/lib/neutral/chunk-AQP4QKYP.mjs.map +0 -7
  308. package/dist/lib/neutral/chunk-BRJSLACP.mjs.map +0 -7
  309. package/dist/lib/neutral/chunk-F7KMHDPJ.mjs.map +0 -7
  310. package/dist/lib/neutral/chunk-GAWKQ5DZ.mjs.map +0 -7
  311. package/dist/lib/neutral/chunk-GFNCSK7F.mjs.map +0 -7
  312. package/dist/lib/neutral/chunk-KGV3QIRX.mjs.map +0 -7
  313. package/dist/lib/neutral/chunk-M2KVTHZM.mjs.map +0 -7
  314. package/dist/lib/neutral/chunk-MXQJZCPY.mjs.map +0 -7
  315. package/dist/lib/neutral/chunk-O3TZFQCT.mjs.map +0 -7
  316. package/dist/lib/neutral/chunk-OVUBTQLT.mjs.map +0 -7
  317. package/dist/lib/neutral/chunk-PP4DNUZU.mjs.map +0 -7
  318. package/dist/lib/neutral/chunk-QXF3LGN2.mjs.map +0 -7
  319. package/dist/lib/neutral/chunk-T4MPQJ7X.mjs.map +0 -7
  320. package/dist/lib/neutral/chunk-W7OP5HGZ.mjs.map +0 -7
  321. package/dist/lib/neutral/chunk-ZTUBYOGB.mjs.map +0 -7
  322. package/dist/lib/neutral/chunk-ZWKJ4LZJ.mjs.map +0 -7
  323. package/dist/types/src/internal/annotations/annotations.d.ts.map +0 -1
  324. package/dist/types/src/internal/annotations/annotations.test.d.ts.map +0 -1
  325. package/dist/types/src/internal/annotations/index.d.ts +0 -3
  326. package/dist/types/src/internal/annotations/index.d.ts.map +0 -1
  327. package/dist/types/src/internal/annotations/util.d.ts.map +0 -1
  328. package/dist/types/src/internal/api/annotations.d.ts +0 -23
  329. package/dist/types/src/internal/api/annotations.d.ts.map +0 -1
  330. package/dist/types/src/internal/api/entity.d.ts.map +0 -1
  331. package/dist/types/src/internal/api/index.d.ts.map +0 -1
  332. package/dist/types/src/internal/api/meta.d.ts.map +0 -1
  333. package/dist/types/src/internal/api/sorting.d.ts.map +0 -1
  334. package/dist/types/src/internal/api/version.d.ts.map +0 -1
  335. package/dist/types/src/internal/entities/entity.d.ts.map +0 -1
  336. package/dist/types/src/internal/entities/index.d.ts.map +0 -1
  337. package/dist/types/src/internal/entities/model.d.ts.map +0 -1
  338. package/dist/types/src/internal/entities/object.d.ts.map +0 -1
  339. package/dist/types/src/internal/entities/relation.d.ts.map +0 -1
  340. package/dist/types/src/internal/entities/util.d.ts.map +0 -1
  341. package/dist/types/src/internal/formats/date.d.ts.map +0 -1
  342. package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
  343. package/dist/types/src/internal/formats/format.d.ts.map +0 -1
  344. package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
  345. package/dist/types/src/internal/formats/index.d.ts.map +0 -1
  346. package/dist/types/src/internal/formats/number.d.ts.map +0 -1
  347. package/dist/types/src/internal/formats/object.d.ts.map +0 -1
  348. package/dist/types/src/internal/formats/select.d.ts.map +0 -1
  349. package/dist/types/src/internal/formats/string.d.ts.map +0 -1
  350. package/dist/types/src/internal/formats/types.d.ts.map +0 -1
  351. package/dist/types/src/internal/json-schema/annotations.d.ts.map +0 -1
  352. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +0 -1
  353. package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
  354. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
  355. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
  356. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +0 -1
  357. package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +0 -1
  358. package/dist/types/src/internal/object/clone.d.ts.map +0 -1
  359. package/dist/types/src/internal/object/common.d.ts.map +0 -1
  360. package/dist/types/src/internal/object/create-object.d.ts.map +0 -1
  361. package/dist/types/src/internal/object/create-object.test.d.ts.map +0 -1
  362. package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
  363. package/dist/types/src/internal/object/ids.d.ts.map +0 -1
  364. package/dist/types/src/internal/object/index.d.ts.map +0 -1
  365. package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
  366. package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
  367. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
  368. package/dist/types/src/internal/object/schema-validator.d.ts +0 -2
  369. package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
  370. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
  371. package/dist/types/src/internal/object/set-value.d.ts.map +0 -1
  372. package/dist/types/src/internal/object/set-value.test.d.ts.map +0 -1
  373. package/dist/types/src/internal/object/snapshot.d.ts.map +0 -1
  374. package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
  375. package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
  376. package/dist/types/src/internal/proxy/change-context.d.ts.map +0 -1
  377. package/dist/types/src/internal/proxy/change.test.d.ts.map +0 -1
  378. package/dist/types/src/internal/proxy/define-hidden-property.d.ts.map +0 -1
  379. package/dist/types/src/internal/proxy/errors.d.ts.map +0 -1
  380. package/dist/types/src/internal/proxy/event-batch.d.ts.map +0 -1
  381. package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
  382. package/dist/types/src/internal/proxy/index.d.ts.map +0 -1
  383. package/dist/types/src/internal/proxy/json-serializer.d.ts.map +0 -1
  384. package/dist/types/src/internal/proxy/make-object.d.ts.map +0 -1
  385. package/dist/types/src/internal/proxy/ownership.d.ts.map +0 -1
  386. package/dist/types/src/internal/proxy/proxy-types.d.ts.map +0 -1
  387. package/dist/types/src/internal/proxy/proxy-utils.d.ts.map +0 -1
  388. package/dist/types/src/internal/proxy/reactive-array.d.ts.map +0 -1
  389. package/dist/types/src/internal/proxy/reactive.d.ts.map +0 -1
  390. package/dist/types/src/internal/proxy/schema-validator.d.ts.map +0 -1
  391. package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
  392. package/dist/types/src/internal/proxy/symbols.d.ts.map +0 -1
  393. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
  394. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
  395. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
  396. package/dist/types/src/internal/ref/index.d.ts.map +0 -1
  397. package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
  398. package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
  399. package/dist/types/src/internal/schema/compose.d.ts.map +0 -1
  400. package/dist/types/src/internal/schema/compose.test.d.ts.map +0 -1
  401. package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
  402. package/dist/types/src/internal/schema/index.d.ts.map +0 -1
  403. package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
  404. package/dist/types/src/internal/schema/persistent-schema.d.ts.map +0 -1
  405. package/dist/types/src/internal/types/base.d.ts.map +0 -1
  406. package/dist/types/src/internal/types/entity.d.ts.map +0 -1
  407. package/dist/types/src/internal/types/index.d.ts.map +0 -1
  408. package/dist/types/src/internal/types/meta.d.ts.map +0 -1
  409. package/dist/types/src/internal/types/typename.d.ts.map +0 -1
  410. package/dist/types/src/internal/types/version.d.ts.map +0 -1
  411. package/src/internal/api/annotations.ts +0 -60
  412. /package/dist/types/src/internal/{annotations → Annotation}/annotations.test.d.ts +0 -0
  413. /package/dist/types/src/internal/{entities → Entity}/util.d.ts +0 -0
  414. /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
  415. /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
  416. /package/dist/types/src/internal/{formats → Format}/format.d.ts +0 -0
  417. /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
  418. /package/dist/types/src/internal/{formats → Format}/index.d.ts +0 -0
  419. /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
  420. /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
  421. /package/dist/types/src/internal/{formats → Format}/select.d.ts +0 -0
  422. /package/dist/types/src/internal/{formats → Format}/string.d.ts +0 -0
  423. /package/dist/types/src/internal/{json-schema → JsonSchema}/effect-schema.test.d.ts +0 -0
  424. /package/dist/types/src/internal/{json-schema → JsonSchema}/index.d.ts +0 -0
  425. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
  426. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.d.ts +0 -0
  427. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.test.d.ts +0 -0
  428. /package/dist/types/src/internal/{object → Obj}/clone.d.ts +0 -0
  429. /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
  430. /package/dist/types/src/internal/{object → Obj}/create-object.test.d.ts +0 -0
  431. /package/dist/types/src/internal/{object → Obj}/ids.d.ts +0 -0
  432. /package/dist/types/src/internal/{object → Obj}/index.d.ts +0 -0
  433. /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
  434. /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
  435. /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
  436. /package/dist/types/src/internal/{object → Obj}/set-value.test.d.ts +0 -0
  437. /package/dist/types/src/internal/{object → Obj}/snapshot.d.ts +0 -0
  438. /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
  439. /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
  440. /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
  441. /package/dist/types/src/internal/{schema → Type}/compose.test.d.ts +0 -0
  442. /package/dist/types/src/internal/{schema → Type}/index.d.ts +0 -0
  443. /package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -0
  444. /package/dist/types/src/internal/{api → common/api}/meta.d.ts +0 -0
  445. /package/dist/types/src/internal/{proxy → common/proxy}/change-context.d.ts +0 -0
  446. /package/dist/types/src/internal/{proxy → common/proxy}/change.test.d.ts +0 -0
  447. /package/dist/types/src/internal/{proxy → common/proxy}/define-hidden-property.d.ts +0 -0
  448. /package/dist/types/src/internal/{proxy → common/proxy}/errors.d.ts +0 -0
  449. /package/dist/types/src/internal/{proxy → common/proxy}/event-batch.d.ts +0 -0
  450. /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
  451. /package/dist/types/src/internal/{proxy → common/proxy}/index.d.ts +0 -0
  452. /package/dist/types/src/internal/{proxy → common/proxy}/json-serializer.d.ts +0 -0
  453. /package/dist/types/src/internal/{proxy → common/proxy}/make-object.d.ts +0 -0
  454. /package/dist/types/src/internal/{proxy → common/proxy}/ownership.d.ts +0 -0
  455. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-types.d.ts +0 -0
  456. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-utils.d.ts +0 -0
  457. /package/dist/types/src/internal/{proxy → common/proxy}/reactive-array.d.ts +0 -0
  458. /package/dist/types/src/internal/{proxy → common/proxy}/schema-validator.d.ts +0 -0
  459. /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
  460. /package/dist/types/src/internal/{proxy → common/proxy}/symbols.d.ts +0 -0
  461. /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.d.ts +0 -0
  462. /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
  463. /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
  464. /package/dist/types/src/internal/{types → common/types}/base.d.ts +0 -0
  465. /package/dist/types/src/internal/{types → common/types}/typename.d.ts +0 -0
  466. /package/dist/types/src/internal/{types → common/types}/version.d.ts +0 -0
  467. /package/src/internal/{entities → Entity}/util.ts +0 -0
  468. /package/src/internal/{formats → Format}/date.ts +0 -0
  469. /package/src/internal/{formats → Format}/format.ts +0 -0
  470. /package/src/internal/{formats → Format}/index.ts +0 -0
  471. /package/src/internal/{formats → Format}/number.ts +0 -0
  472. /package/src/internal/{formats → Format}/object.ts +0 -0
  473. /package/src/internal/{formats → Format}/select.ts +0 -0
  474. /package/src/internal/{formats → Format}/string.ts +0 -0
  475. /package/src/internal/{json-schema → JsonSchema}/effect-schema.test.ts +0 -0
  476. /package/src/internal/{json-schema → JsonSchema}/index.ts +0 -0
  477. /package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +0 -0
  478. /package/src/internal/{object → Obj}/ids.ts +0 -0
  479. /package/src/internal/{object → Obj}/index.ts +0 -0
  480. /package/src/internal/{object → Obj}/schema-validator.test.ts +0 -0
  481. /package/src/internal/{object → Obj}/set-value.test.ts +0 -0
  482. /package/src/internal/{ref → Ref}/index.ts +0 -0
  483. /package/src/internal/{schema → Type}/index.ts +0 -0
  484. /package/src/internal/{README.md → common/README.md} +0 -0
  485. /package/src/internal/{api → common/api}/meta.ts +0 -0
  486. /package/src/internal/{proxy → common/proxy}/change-context.ts +0 -0
  487. /package/src/internal/{proxy → common/proxy}/define-hidden-property.ts +0 -0
  488. /package/src/internal/{proxy → common/proxy}/errors.ts +0 -0
  489. /package/src/internal/{proxy → common/proxy}/event-batch.ts +0 -0
  490. /package/src/internal/{proxy → common/proxy}/index.ts +0 -0
  491. /package/src/internal/{proxy → common/proxy}/ownership.ts +0 -0
  492. /package/src/internal/{proxy → common/proxy}/proxy-types.ts +0 -0
  493. /package/src/internal/{proxy → common/proxy}/proxy-utils.ts +0 -0
  494. /package/src/internal/{proxy → common/proxy}/reactive-array.ts +0 -0
  495. /package/src/internal/{proxy → common/proxy}/schema-validator.ts +0 -0
  496. /package/src/internal/{proxy → common/proxy}/symbols.ts +0 -0
  497. /package/src/internal/{types → common/types}/base.ts +0 -0
  498. /package/src/internal/{types → common/types}/typename.ts +0 -0
  499. /package/src/internal/{types → common/types}/version.ts +0 -0
@@ -2,7 +2,7 @@ import {
2
2
  Kind,
3
3
  KindId,
4
4
  SnapshotKindId
5
- } from "./chunk-W7OP5HGZ.mjs";
5
+ } from "./chunk-UFDK26FO.mjs";
6
6
  import {
7
7
  EchoObjectSchema,
8
8
  MetaId,
@@ -16,9 +16,7 @@ import {
16
16
  encodeVersion,
17
17
  getDXN,
18
18
  getDatabase,
19
- getDescription,
20
19
  getKeys,
21
- getLabel,
22
20
  getMetaChecked,
23
21
  getSnapshot,
24
22
  getValue,
@@ -28,8 +26,6 @@ import {
28
26
  objectFromJSON,
29
27
  objectToJSON,
30
28
  removeTag,
31
- setDescription,
32
- setLabel,
33
29
  setValue,
34
30
  sort,
35
31
  sortByLabel,
@@ -37,23 +33,27 @@ import {
37
33
  subscribe,
38
34
  version,
39
35
  versionValid
40
- } from "./chunk-PP4DNUZU.mjs";
36
+ } from "./chunk-TQQZLKB7.mjs";
41
37
  import {
42
38
  ParentId,
39
+ getDescription,
40
+ getLabel,
43
41
  getSchema,
44
42
  getTypeAnnotation,
45
43
  getTypeDXN,
46
44
  getTypename,
47
- isInstanceOf
48
- } from "./chunk-F7KMHDPJ.mjs";
45
+ isInstanceOf,
46
+ setDescription,
47
+ setLabel
48
+ } from "./chunk-SEMVAGBM.mjs";
49
49
  import {
50
50
  ANY_OBJECT_TYPENAME,
51
51
  ANY_OBJECT_VERSION,
52
52
  SchemaKindId
53
- } from "./chunk-4KG6IGL4.mjs";
53
+ } from "./chunk-WYOKA6AE.mjs";
54
54
  import {
55
55
  GetReactiveError
56
- } from "./chunk-MXQJZCPY.mjs";
56
+ } from "./chunk-UBEZSGXY.mjs";
57
57
  import {
58
58
  __export
59
59
  } from "./chunk-J5LGTIGS.mjs";
@@ -310,4 +310,4 @@ export {
310
310
  version2 as version,
311
311
  Obj_exports
312
312
  };
313
- //# sourceMappingURL=chunk-KGV3QIRX.mjs.map
313
+ //# sourceMappingURL=chunk-NQRLRYJM.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Obj.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport type { ForeignKey } from '@dxos/echo-protocol';\nimport { createJsonPath } from '@dxos/effect';\nimport { assertArgument } from '@dxos/invariant';\nimport { type DXN, ObjectId } from '@dxos/keys';\nimport { assumeType } from '@dxos/util';\n\nimport type * as Database from './Database';\nimport * as Entity from './Entity';\nimport * as Err from './Err';\nimport * as objInternal from './internal/Obj';\nimport * as internal from './internal';\nimport type * as Ref from './Ref';\nimport type * as Type from './Type';\n\n/**\n * Base type for all ECHO objects.\n */\ninterface BaseObj extends internal.AnyEntity, Entity.OfKind<typeof Entity.Kind.Object> {}\n\n/**\n * Object type with specific properties.\n */\nexport type OfShape<Props> = BaseObj & Props;\n\n/**\n * Object with no known properties beyond id and kind.\n * Use this when the object's schema/properties are not known.\n * For objects with arbitrary properties, use `Obj.AnyProps`.\n *\n * NOTE: This is a TypeScript type only, not a schema.\n * To validate that a value is an ECHO object, use `Schema.is(Type.Obj)`.\n */\nexport interface Unknown extends BaseObj {}\n\n/**\n * Runtime Effect schema for any ECHO object.\n * Use for validation, parsing, or as a reference target for collections.\n *\n * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).\n * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.\n *\n * @example\n * ```ts\n * // Structural type guard (accepts any object with id field)\n * if (Schema.is(Type.Obj)(unknownValue)) { ... }\n *\n * // ECHO instance type guard (checks KindId brand)\n * if (Obj.isObject(unknownValue)) { ... }\n *\n * // Reference to any object type\n * const Collection = Schema.Struct({\n * objects: Schema.Array(Ref.Ref(Obj.Unknown)),\n * }).pipe(Type.object({ typename: 'Collection', version: '0.1.0' }));\n * ```\n */\n// TODO(wittjosiah): Investigate if Schema.filter can validate KindId on ECHO instances.\n// Effect Schema normalizes proxy objects to plain objects before calling filter predicates.\n// Possible approaches: custom Schema.declare, AST manipulation, or upstream contribution.\nexport const Unknown: Type.Obj<Unknown> = Schema.Struct({\n id: Schema.String,\n}).pipe(\n Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n // TODO(dmaretskyi): Clean this up.\n // NOTE: The EchoObjectSchema annotation is required for Ref.Ref(Obj.Unknown) to work.\n // The typename/version only satisfy ECHO schema machinery for reference targets.\n internal.EchoObjectSchema({ typename: internal.ANY_OBJECT_TYPENAME, version: internal.ANY_OBJECT_VERSION }),\n (schema) =>\n Object.assign(schema, {\n [internal.SchemaKindId]: (schema as any)[internal.SchemaKindId],\n }) as unknown as Type.Obj<Unknown>,\n);\n\n/**\n\n/**\n * Object with arbitrary properties.\n *\n * NOTE: Due to how TypeScript works, this type is not assignable to a specific schema type.\n * In that case, use `Obj.instanceOf` to check if an object is of a specific type.\n *\n * Prefer using `Obj.Unknown` when you don't need to access arbitrary properties.\n */\nexport interface Any extends BaseObj, internal.AnyProperties {}\n\n/**\n * Base type for snapshot objects (has SnapshotKindId instead of KindId).\n */\ninterface BaseSnapshot extends internal.AnyEntity {\n readonly [Entity.SnapshotKindId]: typeof Entity.Kind.Object;\n readonly id: ObjectId;\n}\n\n/**\n * Immutable snapshot of an ECHO object.\n * Branded with SnapshotKindId (not KindId).\n * Property values are frozen at the time the snapshot was created.\n * Returned by getSnapshot() and hooks like useObject().\n *\n * Snapshots are structurally identical to reactive objects but have a different brand,\n * making them distinguishable at the TypeScript level. Neither is assignable to the other.\n */\nexport type Snapshot<T extends Unknown = Unknown> = Omit<T, Entity.KindId> & BaseSnapshot;\n\n/**\n * JSON-encoded properties for objects.\n */\nexport interface BaseObjJson {\n id: string;\n}\n\nconst defaultMeta: internal.ObjectMeta = {\n keys: [],\n};\n\ntype MakePropsInternal<T extends Unknown> = {\n id?: ObjectId;\n [Meta]?: Partial<internal.ObjectMeta>;\n} & Entity.Properties<T>;\n\n// TODO(burdon): Should we allow the caller to set the id?\n/**\n * Props type for object creation with a given schema.\n */\nexport type MakeProps<S extends Schema.Schema.AnyNoContext> = {\n id?: ObjectId;\n [Meta]?: Partial<internal.ObjectMeta>;\n [Parent]?: Unknown;\n} & MakePropsInternal<Schema.Schema.Type<S>>;\n\n/**\n * Creates a new echo object of the given schema.\n * @param schema - Object schema.\n * @param props - Object properties.\n * @param meta - Object metadata (deprecated) -- pass with Obj.Meta.\n *\n * Meta can be passed as a symbol in `props`.\n *\n * Example:\n * ```ts\n * const obj = Obj.make(Person, { [Obj.Meta]: { keys: [...] }, name: 'John' });\n * ```\n *\n * Note: Only accepts object schemas, not relation schemas. Use `Relation.make` for relations.\n */\nexport const make = <S extends Type.AnyObj>(\n schema: S,\n props: NoInfer<MakeProps<S>>,\n): OfShape<Schema.Schema.Type<S>> => {\n assertArgument(\n internal.getTypeAnnotation(schema)?.kind === Entity.Kind.Object,\n 'schema',\n 'Expected an object schema',\n );\n\n let meta: internal.ObjectMeta | undefined = undefined;\n\n // Set default fields on meta on creation.\n if (props[internal.MetaId] != null) {\n meta = { ...structuredClone(defaultMeta), ...props[internal.MetaId] };\n delete props[internal.MetaId];\n }\n\n // Filter undefined values (Object.entries only returns string-keyed properties).\n const filterUndefined: any = Object.fromEntries(Object.entries(props).filter(([_, v]) => v !== undefined));\n\n // Copy symbol properties (like ParentId) that Object.entries doesn't include.\n for (const sym of Object.getOwnPropertySymbols(props)) {\n const value = (props as any)[sym];\n if (value !== undefined) {\n filterUndefined[sym] = value;\n }\n }\n\n return internal.makeObject<Schema.Schema.Type<S>>(schema, filterUndefined as any, {\n ...defaultMeta,\n ...meta,\n });\n};\n\n/**\n * Determine if object is an ECHO object.\n */\nexport const isObject = (obj: unknown): obj is Unknown => {\n assumeType<internal.InternalObjectProps>(obj);\n return typeof obj === 'object' && obj !== null && obj[Entity.KindId] === Entity.Kind.Object;\n};\n\nexport const isSnapshot = (obj: unknown): obj is Snapshot => {\n assumeType<internal.InternalObjectProps>(obj);\n return typeof obj === 'object' && obj !== null && (obj as any)[Entity.SnapshotKindId] === Entity.Kind.Object;\n};\n\n/**\n * Subscribe to object updates.\n * The callback is called synchronously when the object is modified.\n * Only accepts reactive objects (not snapshots).\n * @returns Unsubscribe function.\n */\nexport const subscribe = (obj: Unknown, callback: () => void): (() => void) => {\n return internal.subscribe(obj, callback);\n};\n\n//\n// Snapshot\n//\n\n/**\n * Returns an immutable snapshot of an object.\n * The snapshot is branded with SnapshotKindId instead of KindId,\n * making it distinguishable from the reactive object at the type level.\n */\nexport const getSnapshot: <T extends Unknown>(obj: T) => Snapshot<T> = objInternal.getSnapshot as any;\n\n/**\n * Returns the reactive version of an object from the database, given its snapshot.\n * Inverse of `Obj.getSnapshot`.\n *\n * Uses `Obj.getDatabase` internally to get the database from the snapshot,\n * then resolves the reactive object by ID.\n *\n * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).\n * @returns Effect that succeeds with the reactive object, or fails with `GetReactiveError`.\n * @example\n * ```ts\n * const snapshot = Obj.getSnapshot(obj);\n * const reactive = Obj.getReactive(snapshot).pipe(\n * Effect.runSync\n * );\n * ```\n */\nexport const getReactive = <T extends Unknown>(snapshot: Snapshot<T>): Effect.Effect<T, Err.GetReactiveError> =>\n Effect.gen(function* () {\n const db = internal.getDatabase(snapshot);\n if (!db) {\n return yield* Effect.fail(new Err.GetReactiveError({ reason: 'no-database', snapshotId: snapshot.id }));\n }\n const obj = db.getObjectById(snapshot.id);\n if (!obj) {\n return yield* Effect.fail(new Err.GetReactiveError({ reason: 'object-not-found', snapshotId: snapshot.id }));\n }\n return obj as T;\n });\n\n/**\n * Like `Obj.getReactive` but returns `Option.none()` instead of failing when the object\n * cannot be resolved (no database, object not found).\n *\n * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).\n * @returns Effect that succeeds with `Option.some(reactive)` or `Option.none()`.\n */\nexport const getReactiveOption = <T extends Unknown>(snapshot: Snapshot<T>): Effect.Effect<Option.Option<T>, never> =>\n getReactive(snapshot).pipe(\n Effect.map(Option.some),\n Effect.catchAll(() => Effect.succeed(Option.none())),\n );\n\n/**\n * Synchronous version of `Obj.getReactive`. Returns the reactive object or throws\n * `GetReactiveError` when the object cannot be resolved (no database, object not found).\n *\n * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).\n * @returns The reactive object.\n * @throws {Err.GetReactiveError} When the object cannot be resolved.\n */\nexport const getReactiveOrThrow = <T extends Unknown>(snapshot: Snapshot<T>): T =>\n Effect.runSync(getReactive(snapshot));\n\nexport type CloneOptions = {\n /**\n * Retain the original object's ID.\n * @default false\n */\n retainId?: boolean;\n\n /**\n * Recursively clone referenced objects.\n * @default false\n */\n deep?: boolean;\n};\n\n/**\n * Clones an object or relation.\n * This does not clone referenced objects, only the properties in the object.\n * @returns A new object with the same schema and properties.\n */\nexport const clone: <T extends Unknown>(obj: T, opts?: CloneOptions) => T = objInternal.clone;\n\n//\n// Change\n//\n\n/**\n * Makes all properties mutable recursively.\n * Used to provide a mutable view of an object within `Obj.change`.\n */\nexport type Mutable<T> = internal.Mutable<T>;\n\n/**\n * Perform mutations on an echo object within a controlled context.\n *\n * All mutations within the callback are batched and trigger a single notification\n * when the callback completes. Direct mutations outside of `Obj.change` will throw\n * an error for echo objects.\n *\n * This function also works with nested objects within echo objects (e.g., Template structs)\n * that are reactive at runtime.\n *\n * @param obj - The echo object to mutate. Use `Relation.change` for relations.\n * @param callback - The callback that performs mutations on the object.\n *\n * @example\n * ```ts\n * const person = Obj.make(Person, { name: 'John', age: 25 });\n *\n * // Mutate within Obj.change\n * Obj.change(person, (p) => {\n * p.name = 'Jane';\n * p.age = 30;\n * });\n * // ONE notification fires here\n *\n * // Direct mutation throws\n * person.name = 'Bob'; // Error: Cannot modify outside Obj.change()\n * ```\n *\n * Note: Only accepts objects. Use `Relation.change` for relations.\n */\nexport const change = <T extends Unknown>(obj: T, callback: internal.ChangeCallback<T>): void => {\n internal.change(obj, callback);\n};\n\n/**\n * Get a deeply nested property from an object.\n *\n * Similar to lodash.get and getDeep from @dxos/util.\n * This is the complementary function to setValue.\n * Accepts both reactive objects and snapshots.\n *\n * @param obj - The ECHO object to get the property from.\n * @param path - Path to the property (array of keys).\n * @returns The value at the path, or undefined if not found.\n *\n * @example\n * ```ts\n * const person = Obj.make(Person, {\n * name: 'John',\n * addresses: [{ street: '123 Main St' }]\n * });\n *\n * Obj.getValue(person, ['addresses', 0, 'street']); // '123 Main St'\n * Obj.getValue(person, ['addresses', 1, 'street']); // undefined\n * ```\n */\nexport const getValue = (obj: Unknown | Snapshot, path: readonly (string | number)[]): any => {\n return internal.getValue(obj, createJsonPath(path));\n};\n\n/**\n * Set a deeply nested property on an object, using the object's schema to determine\n * whether to initialize nested data as an empty object or array.\n *\n * Similar to lodash.set and setDeep from @dxos/util, but schema-aware.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n *\n * @param obj - The mutable ECHO object to set the property on.\n * @param path - Path to the property (array of keys).\n * @param value - Value to set.\n * @returns The value that was set.\n *\n * @example\n * ```ts\n * const person = Obj.make(Person, { name: 'John' });\n * // Person schema has: addresses: Schema.Array(Address)\n * Obj.change(person, (p) => {\n * Obj.setValue(p, ['addresses', 0, 'street'], '123 Main St');\n * });\n * // Creates: person.addresses = [{ street: '123 Main St' }]\n * ```\n */\n// TODO(wittjosiah): Compute possible path values + type value based on generic object type.\nexport const setValue: (obj: Mutable<Unknown>, path: readonly (string | number)[], value: any) => void =\n objInternal.setValue as any;\n\n//\n// Type\n//\n\n// TODO(burdon): To discuss: prefer over ObjectId or Key.ObjectId or Type.ID?\nexport const ID = ObjectId;\nexport type ID = ObjectId;\n\n/**\n * Test if object or relation is an instance of a schema.\n * @example\n * ```ts\n * const john = Obj.make(Person, { name: 'John' });\n * const isPerson = Obj.instanceOf(Person);\n * if (isPerson(john)) {\n * // john is Person\n * }\n * ```\n */\nexport const instanceOf: {\n <S extends Type.AnyEntity>(schema: S): (value: unknown) => value is Schema.Schema.Type<S>;\n <S extends Type.AnyEntity>(schema: S, value: unknown): value is Schema.Schema.Type<S>;\n} = ((...args: [schema: Type.AnyEntity, value: unknown] | [schema: Type.AnyEntity]) => {\n if (args.length === 1) {\n return (entity: unknown) => internal.isInstanceOf(args[0], entity);\n }\n\n return internal.isInstanceOf(args[0], args[1]);\n}) as any;\n\n/**\n * Test if a snapshot is an instance of a schema.\n * Mirrors `instanceOf` but only accepts values branded with SnapshotKindId.\n * Use when the value is known to be a snapshot (e.g. from `getSnapshot` or `useObject`).\n *\n * @example\n * ```ts\n * const snapshot = Obj.getSnapshot(person);\n * if (Obj.snapshotOf(Person, snapshot)) {\n * // snapshot is Obj.Snapshot<Person>\n * }\n * ```\n */\nexport const snapshotOf: {\n <S extends Type.AnyEntity>(schema: S): (value: unknown) => value is Snapshot<Schema.Schema.Type<S>>;\n <S extends Type.AnyEntity>(schema: S, value: unknown): value is Snapshot<Schema.Schema.Type<S>>;\n} = ((...args: [schema: Type.AnyEntity, value: unknown] | [schema: Type.AnyEntity]) => {\n const check = (entity: unknown) =>\n entity != null &&\n typeof entity === 'object' &&\n Entity.SnapshotKindId in entity &&\n internal.isInstanceOf(args[0], entity);\n\n if (args.length === 1) {\n return (entity: unknown) => check(entity);\n }\n\n return check(args[1]);\n}) as any;\n\n// TODO(dmaretskyi): Allow returning undefined.\n/**\n * Get the DXN of the object.\n * Accepts both reactive objects and snapshots.\n */\nexport const getDXN = (entity: Unknown | Snapshot): DXN => {\n assertArgument(!Schema.isSchema(entity), 'obj', 'Object should not be a schema.');\n return internal.getDXN(entity);\n};\n\n/**\n * @returns The DXN of the object's type.\n * @example dxn:com.example.type.person:1.0.0\n */\n// TODO(wittjosiah): Narrow types.\nexport const getTypeDXN: (obj: unknown | undefined) => DXN | undefined = internal.getTypeDXN as any;\n\n/**\n * Get the schema of the object.\n * Returns the branded ECHO schema used to create the object.\n */\n// TODO(wittjosiah): Narrow types.\nexport const getSchema: (obj: unknown | undefined) => Type.AnyEntity | undefined = internal.getSchema as any;\n\n/**\n * @returns The typename of the object's type.\n * Accepts both reactive objects and snapshots.\n * @example `com.example.type.person`\n */\nexport const getTypename = (entity: Unknown | Snapshot): string | undefined => internal.getTypename(entity);\n\n//\n// Database\n//\n\n/**\n * Get the database the object belongs to.\n * Accepts both reactive objects and snapshots.\n */\nexport const getDatabase = (entity: Entity.Unknown | Entity.Snapshot): Database.Database | undefined =>\n internal.getDatabase(entity);\n\n//\n// Meta\n//\n\n/**\n * Property that accesses metadata for an entity.\n *\n * Alias for `Entity.Meta`.\n */\nexport const Meta = internal.MetaId;\n\n/**\n * Deeply read-only version of ObjectMeta.\n * Prevents mutation at all nesting levels (e.g., `meta.keys.push()` is a TypeScript error).\n */\nexport type ReadonlyMeta = internal.ReadonlyMeta;\n\n/**\n * Mutable meta type returned by `Obj.getMeta` inside an `Obj.change` callback.\n */\nexport type Meta = internal.Meta;\n\n// TODO(burdon): Narrow type.\n// TODO(dmaretskyi): Allow returning undefined.\n/**\n * Get the metadata for an object.\n * Returns mutable meta when passed a mutable object (inside `Obj.change` callback).\n * Returns read-only meta when passed a regular object or snapshot.\n *\n * @example\n * ```ts\n * // Read-only access outside change callback\n * const meta = Obj.getMeta(person); // ReadonlyMeta\n *\n * // Mutable access inside change callback\n * Obj.change(person, (p) => {\n * const meta = Obj.getMeta(p); // ObjectMeta (mutable)\n * meta.tags ??= [];\n * meta.tags.push('important');\n * });\n * ```\n */\n// TODO(wittjosiah): When passed a Snapshot, should return a snapshot of meta, not the live meta proxy.\nexport function getMeta(entity: Mutable<Unknown>): Meta;\nexport function getMeta(entity: Unknown | Snapshot): ReadonlyMeta;\nexport function getMeta(entity: Unknown | Snapshot | Mutable<Unknown>): Meta | ReadonlyMeta {\n return internal.getMetaChecked(entity);\n}\n\n/**\n * @returns Foreign keys for the object from the specified source.\n * Accepts both reactive objects and snapshots.\n */\nexport const getKeys: {\n (entity: Unknown | Snapshot, source: string): ForeignKey[];\n (source: string): (entity: Unknown | Snapshot) => ForeignKey[];\n} = Function.dual(2, (entity: Unknown | Snapshot, source?: string): ForeignKey[] => internal.getKeys(entity, source!));\n\n/**\n * Delete all keys from the object for the specified source.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const deleteKeys = (entity: Mutable<Unknown>, source: string): void => internal.deleteKeys(entity, source);\n\n/**\n * Add a tag to the object.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const addTag = (entity: Mutable<Unknown>, tag: string): void => internal.addTag(entity, tag);\n\n/**\n * Remove a tag from the object.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const removeTag = (entity: Mutable<Unknown>, tag: string): void => internal.removeTag(entity, tag);\n\n/**\n * Check if the object is deleted.\n * Accepts both reactive objects and snapshots.\n */\n// TODO(dmaretskyi): Default to `false`.\nexport const isDeleted = (entity: Unknown | Snapshot): boolean => objInternal.isDeleted(entity);\n\n//\n// Annotations\n//\n\n/**\n * Get the label of the object.\n * Accepts both reactive objects and snapshots.\n */\nexport const getLabel = (entity: Unknown | Snapshot): string | undefined => internal.getLabel(entity);\n\n/**\n * Set the label of the object.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const setLabel = (entity: Mutable<Unknown>, label: string): void => internal.setLabel(entity, label);\n\n/**\n * Get the description of the object.\n * Accepts both reactive objects and snapshots.\n */\nexport const getDescription = (entity: Unknown | Snapshot): string | undefined => internal.getDescription(entity);\n\n/**\n * Set the description of the object.\n * Must be called within an `Obj.change` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const setDescription = (entity: Mutable<Unknown>, description: string): void =>\n internal.setDescription(entity, description);\n\n/**\n * Symbol to set parent when creating objects with `Obj.make`.\n * @example\n * ```ts\n * Obj.make(TestSchema.Person, {\n * [Obj.Parent]: parentObject,\n * name: 'John',\n * })\n * ```\n */\nexport const Parent: unique symbol = internal.ParentId as any;\n\n/**\n * Get the parent of an object.\n * The parent is always loaded together with the object.\n * Only objects are allowed to have a parent\n * @returns The parent object, or undefined if the object has no parent.\n */\nexport const getParent = (entity: Unknown | Snapshot): Unknown | undefined => {\n assertArgument(isObject(entity), 'Expected an object');\n assumeType<internal.InternalObjectProps>(entity);\n return entity[internal.ParentId] as Unknown | undefined;\n};\n\n/**\n * Sets the parent of an object.\n * If a parent (or any transitive parent) is deleted, the object will be deleted.\n * Only objects are allowed to have a parent.\n */\nexport const setParent = (entity: Unknown, parent: Any | undefined) => {\n assertArgument(isObject(entity), 'Expected an object');\n assertArgument(parent === undefined || isObject(parent), 'Expected an object');\n assumeType<internal.InternalObjectProps>(entity);\n assumeType<internal.InternalObjectProps | undefined>(parent);\n entity[internal.ParentId] = parent;\n};\n\n//\n// JSON\n//\n\n/**\n * JSON representation of an object.\n */\nexport type JSON = internal.ObjectJSON;\n\n/**\n * Converts object to its JSON representation.\n * Accepts both reactive objects and snapshots.\n *\n * The same algorithm is used when calling the standard `JSON.stringify(obj)` function.\n */\nexport const toJSON = (entity: Unknown | Snapshot): JSON => objInternal.objectToJSON(entity);\n\n/**\n * Creates an object from its json representation, performing schema validation.\n * References and schemas will be resolvable if the `refResolver` is provided.\n *\n * The function must be async to support resolving the schema as well as the relation endpoints.\n *\n * @param options.refResolver - Resolver for references. Produces hydrated references that can be resolved.\n * @param options.dxn - Override object DXN. Changes the result of `Obj.getDXN`.\n * @param options.database - Database to associate with the object.\n */\nexport const fromJSON: (\n json: unknown,\n options?: { refResolver?: Ref.Resolver; dxn?: DXN; database?: Database.Database },\n) => Promise<Unknown> = objInternal.objectFromJSON as any;\n\n/**\n * Comparator function type for sorting objects.\n * Accepts both reactive objects and snapshots.\n */\nexport type Comparator = internal.Comparator<Unknown | Snapshot>;\n\nexport const sortByLabel: Comparator = internal.sortByLabel as Comparator;\nexport const sortByTypename: Comparator = internal.sortByTypename as Comparator;\nexport const sort = (...comparators: Comparator[]): Comparator => internal.sort(...comparators) as Comparator;\n\n//\n// Version\n//\n\nexport const VersionTypeId = internal.VersionTypeId;\nexport type VersionCompareResult = internal.VersionCompareResult;\n\n/**\n * Represent object version.\n * May be backed by Automerge.\n * Objects with no history are not versioned.\n */\nexport type Version = internal.EntityVersion;\n\nexport const isVersion = internal.isVersion;\nexport const versionValid = internal.versionValid;\nexport const compareVersions = internal.compareVersions;\nexport const encodeVersion = internal.encodeVersion;\nexport const decodeVersion = internal.decodeVersion;\n\n/**\n * Returns the version of the object.\n * Accepts both reactive objects and snapshots.\n */\nexport const version = (entity: Unknown | Snapshot): Version => internal.version(entity);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;iBAAAA;EAAA,qBAAAC;EAAA,cAAAC;EAAA,cAAAC;EAAA,aAAAC;EAAA,uBAAAC;EAAA,qBAAAC;EAAA,kBAAAC;EAAA,qBAAAC;EAAA;gBAAAC;EAAA,mBAAAC;EAAA,sBAAAC;EAAA,eAAAC;EAAA,gBAAAC;EAAA;;;;;mBAAAC;EAAA,mBAAAC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eVersion", "getDXN", "getDatabase", "getDescription", "getKeys", "getLabel", "getSchema", "getSnapshot", "getTypeDXN", "getTypename", "getValue", "isDeleted", "isVersion", "removeTag", "setDescription", "setLabel", "setValue", "sort", "sortByLabel", "sortByTypename", "subscribe", "version", "versionValid", "Effect", "Function", "Option", "Schema", "createJsonPath", "assertArgument", "ObjectId", "assumeType", "Unknown", "Struct", "id", "String", "pipe", "extend", "Record", "key", "value", "EchoObjectSchema", "typename", "ANY_OBJECT_TYPENAME", "version", "ANY_OBJECT_VERSION", "schema", "Object", "assign", "SchemaKindId", "defaultMeta", "keys", "make", "props", "assertArgument", "getTypeAnnotation", "kind", "Kind", "meta", "undefined", "MetaId", "structuredClone", "filterUndefined", "fromEntries", "entries", "filter", "_", "v", "sym", "getOwnPropertySymbols", "makeObject", "isObject", "obj", "assumeType", "KindId", "isSnapshot", "SnapshotKindId", "subscribe", "callback", "getSnapshot", "getReactive", "snapshot", "gen", "db", "getDatabase", "fail", "GetReactiveError", "reason", "snapshotId", "getObjectById", "getReactiveOption", "map", "some", "catchAll", "succeed", "none", "getReactiveOrThrow", "runSync", "clone", "change", "internal", "getValue", "path", "createJsonPath", "setValue", "ID", "ObjectId", "instanceOf", "args", "length", "entity", "isInstanceOf", "snapshotOf", "check", "getDXN", "isSchema", "getTypeDXN", "getSchema", "getTypename", "Meta", "getMeta", "getMetaChecked", "getKeys", "dual", "source", "deleteKeys", "addTag", "tag", "removeTag", "isDeleted", "getLabel", "setLabel", "label", "getDescription", "setDescription", "description", "Parent", "ParentId", "getParent", "setParent", "parent", "toJSON", "objectToJSON", "fromJSON", "objectFromJSON", "sortByLabel", "sortByTypename", "sort", "comparators", "VersionTypeId", "isVersion", "versionValid", "compareVersions", "encodeVersion", "decodeVersion"]
7
+ }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isRef
3
- } from "./chunk-QXF3LGN2.mjs";
3
+ } from "./chunk-FXEG7EOK.mjs";
4
4
  import {
5
5
  getTypeDXNFromSpecifier
6
- } from "./chunk-F7KMHDPJ.mjs";
6
+ } from "./chunk-SEMVAGBM.mjs";
7
7
  import {
8
8
  __export
9
9
  } from "./chunk-J5LGTIGS.mjs";
@@ -296,4 +296,4 @@ export {
296
296
  or,
297
297
  Filter_exports
298
298
  };
299
- //# sourceMappingURL=chunk-ALOGSVBP.mjs.map
299
+ //# sourceMappingURL=chunk-NXMFBIT5.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Filter.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\nimport type * as Types from 'effect/Types';\n\nimport { type ForeignKey, type QueryAST } from '@dxos/echo-protocol';\nimport { assertArgument } from '@dxos/invariant';\nimport { DXN, ObjectId } from '@dxos/keys';\n\nimport * as internal from './internal';\nimport * as Ref from './Ref';\n\nexport interface Filter<T> {\n // TODO(dmaretskyi): See new effect-schema approach to variance.\n '~Filter': { value: Types.Contravariant<T> };\n\n ast: QueryAST.Filter;\n}\n\nexport type Props<T> = {\n // Predicate or a value as a shorthand for `eq`.\n [K in keyof T & string]?: Filter<T[K]> | T[K];\n};\n\nexport type Any = Filter<any>;\n\nexport type Type<F extends Any> = F extends Filter<infer T> ? T : never;\n\nclass FilterClass implements Any {\n private static 'variance': Any['~Filter'] = {} as Any['~Filter'];\n\n constructor(public readonly ast: QueryAST.Filter) {}\n\n '~Filter' = FilterClass.variance;\n}\n\nexport const is = (value: unknown): value is Any => {\n return typeof value === 'object' && value !== null && '~Filter' in value;\n};\n\n/** Construct a filter from an ast. */\nexport const fromAst = (ast: QueryAST.Filter): Any => {\n return new FilterClass(ast);\n};\n\n/**\n * Filter that matches all objects.\n */\n// TODO(dmaretskyi): `Entity.Any` would be more type-safe, but causes annoying errors in existing code\nexport const everything = (): FilterClass => {\n return new FilterClass({\n type: 'object',\n typename: null,\n props: {},\n });\n};\n\n/**\n * Filter that matches no objects.\n */\nexport const nothing = (): FilterClass => {\n return new FilterClass({\n type: 'not',\n filter: {\n type: 'object',\n typename: null,\n props: {},\n },\n });\n};\n\n/*\n * Filter by ObjectId.\n */\nexport const id = (...ids: ObjectId[]): Any => {\n assertArgument(\n ids.every((id) => ObjectId.isValid(id)),\n 'ids',\n 'ids must be valid',\n );\n\n if (ids.length === 0) {\n return nothing();\n }\n\n return new FilterClass({\n type: 'object',\n typename: null,\n id: ids,\n props: {},\n });\n};\n\n/**\n * Filter by type.\n */\nexport const type = <S extends Schema.Schema.All>(\n schema: S | string,\n props?: Props<Schema.Schema.Type<S>>,\n): Filter<Schema.Schema.Type<S>> => {\n if (Schema.isSchema(schema) && SchemaAST.isUnion(schema.ast)) {\n const typenames = schema.ast.types.map((type) => internal.getTypeDXNFromSpecifier(Schema.make(type)));\n return new FilterClass({\n type: 'or',\n filters: typenames.map((typename) => ({\n type: 'object',\n typename: typename.toString(),\n props: {},\n })),\n });\n }\n\n const dxn = internal.getTypeDXNFromSpecifier(schema);\n return new FilterClass({\n type: 'object',\n typename: dxn.toString(),\n ...propsFilterToAst(props ?? {}),\n });\n};\n\n/**\n * Filter by non-qualified typename.\n */\nexport const typename = (typename: string): Any => {\n assertArgument(!typename.startsWith('dxn:'), 'typename', 'Typename must no be qualified');\n return new FilterClass({\n type: 'object',\n typename: DXN.fromTypename(typename).toString(),\n props: {},\n });\n};\n\n/**\n * Filter by fully qualified type DXN.\n */\nexport const typeDXN = (dxn: DXN): Any => {\n return new FilterClass({\n type: 'object',\n typename: dxn.toString(),\n props: {},\n });\n};\n\n/**\n * Filter by tag.\n */\nexport const tag = (tag: string): Any => {\n return new FilterClass({\n type: 'tag',\n tag,\n });\n};\n\n/**\n * Filter by properties.\n */\nexport const props = <T>(props: Props<T>): Filter<T> => {\n return new FilterClass({\n type: 'object',\n typename: null,\n ...propsFilterToAst(props),\n });\n};\n\nexport type TextSearchOptions = {\n // TODO(dmaretskyi): Hybrid search.\n type?: 'full-text' | 'vector';\n};\n\n/**\n * Full-text or vector search.\n */\nexport const text = (\n // TODO(dmaretskyi): Consider passing a vector here, but really the embedding should be done on the query-executor side.\n text: string,\n options?: TextSearchOptions,\n): Any => {\n return new FilterClass({\n type: 'text-search',\n text,\n searchKind: options?.type,\n });\n};\n\n/**\n * Filter by foreign keys.\n */\nexport const foreignKeys = <S extends Schema.Schema.All>(\n schema: S | string,\n keys: ForeignKey[],\n): Filter<Schema.Schema.Type<S>> => {\n const dxn = internal.getTypeDXNFromSpecifier(schema);\n return new FilterClass({\n type: 'object',\n typename: dxn.toString(),\n props: {},\n foreignKeys: keys,\n });\n};\n\n/**\n * Predicate for property to be equal to the provided value.\n */\nexport const eq = <T>(value: T): Filter<T | undefined> => {\n if (!Ref.isRef(value) && typeof value === 'object' && value !== null) {\n throw new TypeError('Cannot use object as a value for eq filter');\n }\n\n return new FilterClass({\n type: 'compare',\n operator: 'eq',\n value: Ref.isRef(value) ? value.noInline().encode() : value,\n });\n};\n\n/**\n * Predicate for property to be not equal to the provided value.\n */\nexport const neq = <T>(value: T): Filter<T | undefined> => {\n return new FilterClass({\n type: 'compare',\n operator: 'neq',\n value,\n });\n};\n\n/**\n * Predicate for property to be greater than the provided value.\n */\nexport const gt = <T>(value: T): Filter<T | undefined> => {\n return new FilterClass({\n type: 'compare',\n operator: 'gt',\n value,\n });\n};\n\n/**\n * Predicate for property to be greater than or equal to the provided value.\n */\nexport const gte = <T>(value: T): Filter<T | undefined> => {\n return new FilterClass({\n type: 'compare',\n operator: 'gte',\n value,\n });\n};\n\n/**\n * Predicate for property to be less than the provided value.\n */\nexport const lt = <T>(value: T): Filter<T | undefined> => {\n return new FilterClass({\n type: 'compare',\n operator: 'lt',\n value,\n });\n};\n\n/**\n * Predicate for property to be less than or equal to the provided value.\n */\nexport const lte = <T>(value: T): Filter<T | undefined> => {\n return new FilterClass({\n type: 'compare',\n operator: 'lte',\n value,\n });\n};\n\n/**\n * Predicate for property to be in the provided array.\n * @param values - Values to check against.\n */\nconst in$ = <T>(...values: T[]): Filter<T | undefined> => {\n return new FilterClass({\n type: 'in',\n values,\n });\n};\nexport { in$ as in };\n\n/**\n * Predicate for an array property to contain the provided value.\n * @param value - Value to check against.\n */\nexport const contains = <T>(value: T): Filter<readonly T[] | undefined> => {\n return new FilterClass({\n type: 'contains',\n value,\n });\n};\n\n/**\n * Predicate for property to be in the provided range.\n * @param from - Start of the range (inclusive).\n * @param to - End of the range (exclusive).\n */\nexport const between = <T>(from: T, to: T): Filter<unknown> => {\n return new FilterClass({\n type: 'range',\n from,\n to,\n });\n};\n\n/**\n * Negate the filter.\n */\nexport const not = <F extends Any>(filter: F): Filter<Type<F>> => {\n return new FilterClass({\n type: 'not',\n filter: filter.ast,\n });\n};\n\n/**\n * Combine filters with a logical AND.\n */\nexport const and = <Filters extends readonly Any[]>(...filters: Filters): Filter<Type<Filters[number]>> => {\n return new FilterClass({\n type: 'and',\n filters: filters.map((f) => f.ast),\n });\n};\n\n/**\n * Combine filters with a logical OR.\n */\nexport const or = <Filters extends readonly Any[]>(...filters: Filters): Filter<Type<Filters[number]>> => {\n return new FilterClass({\n type: 'or',\n filters: filters.map((f) => f.ast),\n });\n};\n\n// TODO(dmaretskyi): Add `Filter.match` to support pattern matching on string props.\n\nconst propsFilterToAst = (predicates: Props<any>): Pick<QueryAST.FilterObject, 'id' | 'props'> => {\n let idFilter: readonly ObjectId[] | undefined;\n if ('id' in predicates) {\n assertArgument(\n typeof predicates.id === 'string' || Array.isArray(predicates.id),\n 'predicates.id',\n 'invalid id filter',\n );\n idFilter = typeof predicates.id === 'string' ? [predicates.id] : predicates.id;\n Schema.Array(ObjectId).pipe(Schema.validateSync)(idFilter);\n }\n\n return {\n id: idFilter,\n props: Object.fromEntries(\n Object.entries(predicates)\n .filter(([prop, _value]) => prop !== 'id')\n .map(([prop, predicate]) => [prop, processPredicate(predicate)]),\n ) as Record<string, QueryAST.Filter>,\n };\n};\n\nconst processPredicate = (predicate: any): QueryAST.Filter => {\n return Match.value(predicate).pipe(\n Match.withReturnType<QueryAST.Filter>(),\n Match.when(is, (predicate) => predicate.ast),\n // TODO(wittjosiah): Add support for array predicates.\n Match.when(Array.isArray, (_predicate) => {\n throw new Error('Array predicates are not yet supported.');\n }),\n Match.when(\n (predicate: any) => !Ref.isRef(predicate) && typeof predicate === 'object' && predicate !== null,\n (predicate) => {\n const nestedProps = Object.fromEntries(\n Object.entries(predicate).map(([key, value]) => [key, processPredicate(value)]),\n );\n\n return {\n type: 'object',\n typename: null,\n props: nestedProps,\n };\n },\n ),\n Match.orElse((value) => eq(value).ast),\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAI3B,SAASC,sBAAsB;AAC/B,SAASC,KAAKC,gBAAgB;AAqB9B,IAAMC,cAAN,MAAMA,aAAAA;;EACJ,OAAe,aAA6B,CAAC;EAE7C,YAA4BC,KAAsB;SAAtBA,MAAAA;EAAuB;EAEnD,YAAYD,aAAYE;AAC1B;AAEO,IAAMC,KAAK,CAACC,WAAAA;AACjB,SAAO,OAAOA,WAAU,YAAYA,WAAU,QAAQ,aAAaA;AACrE;AAGO,IAAMC,UAAU,CAACJ,QAAAA;AACtB,SAAO,IAAID,YAAYC,GAAAA;AACzB;AAMO,IAAMK,aAAa,MAAA;AACxB,SAAO,IAAIN,YAAY;IACrBO,MAAM;IACNC,UAAU;IACVC,OAAO,CAAC;EACV,CAAA;AACF;AAKO,IAAMC,UAAU,MAAA;AACrB,SAAO,IAAIV,YAAY;IACrBO,MAAM;IACNI,QAAQ;MACNJ,MAAM;MACNC,UAAU;MACVC,OAAO,CAAC;IACV;EACF,CAAA;AACF;AAKO,IAAMG,KAAK,IAAIC,QAAAA;AACpBC,iBACED,IAAIE,MAAM,CAACH,QAAOI,SAASC,QAAQL,GAAAA,C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,CAAC,CAACkB,MAAME,SAAAA,MAAe;MAACF;MAAMG,iBAAiBD,SAAAA;KAAW,CAAA;EAErE;AACF;AAEA,IAAMC,mBAAmB,CAACD,cAAAA;AACxB,SAAa/B,YAAM+B,SAAAA,EAAWR;IACtBU,qBAAc;IACdC,WAAKC,IAAI,CAACJ,eAAcA,WAAUvB,GAAG;;IAErC0B,WAAKf,MAAMC,SAAS,CAACgB,eAAAA;AACzB,YAAM,IAAIC,MAAM,yCAAA;IAClB,CAAA;IACMH,WACJ,CAACH,eAAmB,CAAKO,MAAMP,UAAAA,KAAc,OAAOA,eAAc,YAAYA,eAAc,MAC5F,CAACA,eAAAA;AACC,YAAMQ,cAAcb,OAAOC,YACzBD,OAAOE,QAAQG,UAAAA,EAAWpB,IAAI,CAAC,CAAC6B,KAAKxC,MAAAA,MAAW;QAACwC;QAAKR,iBAAiBhC,MAAAA;OAAO,CAAA;AAGhF,aAAO;QACLE,MAAM;QACNuC,UAAU;QACVhB,OAAOc;MACT;IACF,CAAA;IAEIG,aAAO,CAAC1C,WAAU2C,GAAG3C,MAAAA,EAAOQ,GAAG;EAAA;AAEzC;",
6
+ "names": ["Match", "Schema", "SchemaAST", "assertArgument", "DXN", "ObjectId", "FilterClass", "ast", "variance", "is", "value", "fromAst", "everything", "type", "typename", "props", "nothing", "filter", "id", "ids", "assertArgument", "every", "ObjectId", "isValid", "length", "schema", "isSchema", "isUnion", "typenames", "types", "map", "getTypeDXNFromSpecifier", "make", "filters", "toString", "dxn", "propsFilterToAst", "startsWith", "DXN", "fromTypename", "typeDXN", "tag", "text", "options", "searchKind", "foreignKeys", "keys", "eq", "isRef", "TypeError", "operator", "noInline", "encode", "neq", "gt", "gte", "lt", "lte", "in$", "values", "contains", "value", "FilterClass", "type", "between", "from", "to", "not", "filter", "ast", "and", "filters", "map", "f", "or", "propsFilterToAst", "predicates", "idFilter", "assertArgument", "id", "Array", "isArray", "Schema", "ObjectId", "pipe", "validateSync", "props", "Object", "fromEntries", "entries", "prop", "_value", "predicate", "processPredicate", "withReturnType", "when", "is", "_predicate", "Error", "isRef", "nestedProps", "key", "typename", "orElse", "eq"]
7
+ }
@@ -13,7 +13,7 @@ import {
13
13
  makeUserAnnotation,
14
14
  setDescriptionWithSchema,
15
15
  setLabelWithSchema
16
- } from "./chunk-F7KMHDPJ.mjs";
16
+ } from "./chunk-SEMVAGBM.mjs";
17
17
  import {
18
18
  __export
19
19
  } from "./chunk-J5LGTIGS.mjs";
@@ -42,4 +42,4 @@ export {
42
42
  make,
43
43
  Annotation_exports
44
44
  };
45
- //# sourceMappingURL=chunk-OVUBTQLT.mjs.map
45
+ //# sourceMappingURL=chunk-OENWMTE6.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Annotation.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nexport {\n DescriptionAnnotation,\n FormInputAnnotation,\n GeneratorAnnotation,\n LabelAnnotation,\n ReferenceAnnotation,\n SystemTypeAnnotation,\n TypeAnnotation,\n getDescriptionWithSchema,\n getLabelWithSchema,\n getTypeAnnotation,\n setDescriptionWithSchema,\n setLabelWithSchema,\n IconAnnotation,\n} from './internal/Annotation';\n\nimport type * as Schema from 'effect/Schema';\n\nimport * as internalAnnotations from './internal/Annotation';\n\ninterface MakeProps<T> {\n id: string;\n schema: Schema.Schema<T, any, never>;\n}\n\n/**\n * Create a new schema annotation.\n * Annotation can be assigned both to fields and to the schema itself.\n * Annotation is serialized with the schema.\n *\n * @example\n * ```ts\n * const ColorAnnotation = Annotation.make({\n * id: 'org.dxos.annotation.color',\n * schema: Schema.String,\n * });\n *\n * const schema = Schema.String.annotations(ColorAnnotation.set('red'));\n * ```\n */\nexport const make: <T>(props: MakeProps<T>) => internalAnnotations.AnnotationHelper<T> =\n internalAnnotations.makeUserAnnotation;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;AA8CO,IAAMA,OACSC;",
6
+ "names": ["make", "makeUserAnnotation"]
7
+ }
@@ -4,17 +4,17 @@ import {
4
4
  EchoSchema,
5
5
  PersistentSchema,
6
6
  isMutable
7
- } from "./chunk-PP4DNUZU.mjs";
7
+ } from "./chunk-TQQZLKB7.mjs";
8
8
  import {
9
9
  getSchemaDXN,
10
10
  getSchemaTypename,
11
11
  getSchemaVersion,
12
12
  getTypeAnnotation
13
- } from "./chunk-F7KMHDPJ.mjs";
13
+ } from "./chunk-SEMVAGBM.mjs";
14
14
  import {
15
15
  EntityKind,
16
16
  SchemaKindId
17
- } from "./chunk-4KG6IGL4.mjs";
17
+ } from "./chunk-WYOKA6AE.mjs";
18
18
  import {
19
19
  __export
20
20
  } from "./chunk-J5LGTIGS.mjs";
@@ -53,7 +53,7 @@ var getTypename = (schema) => {
53
53
  const typename = getSchemaTypename(schema);
54
54
  invariant(typeof typename === "string" && !typename.startsWith("dxn:"), "Invalid typename", {
55
55
  F: __dxlog_file,
56
- L: 227,
56
+ L: 230,
57
57
  S: void 0,
58
58
  A: [
59
59
  "typeof typename === 'string' && !typename.startsWith('dxn:')",
@@ -66,7 +66,7 @@ var getVersion = (schema) => {
66
66
  const version = getSchemaVersion(schema);
67
67
  invariant(typeof version === "string" && version.match(/^\d+\.\d+\.\d+$/), "Invalid version", {
68
68
  F: __dxlog_file,
69
- L: 237,
69
+ L: 240,
70
70
  S: void 0,
71
71
  A: [
72
72
  "typeof version === 'string' && version.match(/^\\d+\\.\\d+\\.\\d+$/)",
@@ -94,4 +94,4 @@ export {
94
94
  getMeta,
95
95
  Type_exports
96
96
  };
97
- //# sourceMappingURL=chunk-T4MPQJ7X.mjs.map
97
+ //# sourceMappingURL=chunk-RMLF7JOZ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Type.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type * as Schema from 'effect/Schema';\n\nimport { type EncodedReference } from '@dxos/echo-protocol';\nimport { invariant } from '@dxos/invariant';\nimport { type DXN } from '@dxos/keys';\nimport { type ToMutable } from '@dxos/util';\n\nimport type * as Entity from './Entity';\nimport * as typeInternal from './internal/Type';\nimport * as internal from './internal';\nimport type * as ObjModule from './Obj';\nimport type * as RelationModule from './Relation';\n\n/**\n * Dynamic type that can be constructed, mutated, and persisted in the ECHO database.\n */\nexport const RuntimeType = typeInternal.EchoSchema;\n\n/**\n * Dynamic type that can be constructed, mutated, and persisted in the ECHO database.\n */\nexport type RuntimeType = typeInternal.EchoSchema;\n\n//\n// Internal types (not exported)\n//\n\n/**\n * Type that marks a schema as an ECHO schema.\n * The value indicates the entity kind (Object or Relation).\n */\ntype EchoSchemaKind<K extends internal.EntityKind = internal.EntityKind> = {\n readonly [internal.SchemaKindId]: K;\n};\n\n//\n// Obj - Runtime schema for any ECHO object\n//\n\n/**\n * TypeScript type for an ECHO object schema.\n * `T` is the instance type produced by the schema.\n * `Fields` is the optional struct fields type for introspection.\n *\n * @example\n * ```ts\n * const PersonSchema: Type.Obj<Person> = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.object({ typename: 'Person', version: '0.1.0' }));\n *\n * // Access fields for introspection:\n * Object.keys(PersonSchema.fields); // ['name']\n * ```\n */\nexport interface Obj<T, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>\n extends\n internal.TypeMeta,\n EchoSchemaKind<internal.EntityKind.Object>,\n Schema.AnnotableClass<\n Obj<T, Fields>,\n Entity.OfKind<typeof Entity.Kind.Object> & T,\n Schema.Simplify<ObjModule.BaseObjJson & ToMutable<T>>,\n never\n > {\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Structural base type for any ECHO object schema.\n * Accepts both static schemas (created with Type.object()) and EchoSchema.\n * NOTE: Does not include the brand symbol to avoid TS4053 declaration portability issues.\n * Use Type.isObjectSchema() for runtime type guards.\n */\ntype ObjectSchemaBase = Schema.Schema.AnyNoContext & {\n readonly typename: string;\n readonly version: string;\n};\n\n/**\n * Type that represents any ECHO object schema.\n * Accepts both static schemas (Type.object()) and mutable schemas (EchoSchema).\n */\nexport type AnyObj = ObjectSchemaBase;\n\n/**\n * Factory function to create an ECHO object schema.\n * Adds object metadata annotations to an Effect schema.\n *\n * @example\n * ```ts\n * const Person = Schema.Struct({\n * name: Schema.String,\n * }).pipe(Type.object({ typename: 'com.example.type.person', version: '0.1.0' }));\n * ```\n */\nexport const object: {\n (opts: internal.TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => Obj<Schema.Schema.Type<Self>>;\n} = internal.EchoObjectSchema as any;\n\n//\n// PersistentType (Schema stored in database)\n//\n\nexport const PersistentType: Obj<typeInternal.PersistentSchema> = typeInternal.PersistentSchema as any;\n\nexport interface PersistentType extends Schema.Schema.Type<typeof PersistentType> {}\n\n/**\n * TypeScript type for an ECHO relation schema.\n * `T` is the instance type produced by the schema (excluding source/target).\n * `Source` and `Target` are the endpoint types.\n * `Fields` is the optional struct fields type for introspection.\n */\nexport interface Relation<T, Source, Target, Fields extends Schema.Struct.Fields = Schema.Struct.Fields>\n extends\n internal.TypeMeta,\n EchoSchemaKind<internal.EntityKind.Relation>,\n Schema.AnnotableClass<\n Relation<T, Source, Target, Fields>,\n Entity.OfKind<typeof Entity.Kind.Relation> & RelationModule.Endpoints<Source, Target> & T,\n Schema.Simplify<RelationModule.BaseRelationJson & ToMutable<T>>,\n never\n > {\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Structural base type for any ECHO relation schema.\n * Accepts static schemas (created with Type.relation()).\n * NOTE: Does not include the brand symbol to avoid TS4053 declaration portability issues.\n * Use Type.isRelationSchema() for runtime type guards.\n */\ntype RelationSchemaBase = Schema.Schema.AnyNoContext & {\n readonly typename: string;\n readonly version: string;\n};\n\n/**\n * Type that represents any ECHO relation schema.\n * Accepts static schemas (Type.relation()).\n */\nexport type AnyRelation = RelationSchemaBase;\n\n/**\n * Factory function to create an ECHO relation schema.\n * Adds relation metadata annotations to an Effect schema.\n *\n * @example\n * ```ts\n * const WorksFor = Schema.Struct({\n * role: Schema.String,\n * }).pipe(Type.relation({\n * typename: 'com.example.type.works-for',\n * version: '0.1.0',\n * source: Person,\n * target: Company,\n * }));\n * ```\n */\nexport const relation: {\n <SourceSchema extends Schema.Schema.AnyNoContext, TargetSchema extends Schema.Schema.AnyNoContext>(\n opts: internal.EchoRelationSchemaOptions<SourceSchema, TargetSchema>,\n ): <Self extends Schema.Schema.Any>(\n self: Self,\n ) => Relation<Schema.Schema.Type<Self>, Schema.Schema.Type<SourceSchema>, Schema.Schema.Type<TargetSchema>>;\n} = internal.EchoRelationSchema as any;\n\n/**\n * Type alias for any ECHO entity schema (object or relation).\n * Use this in type annotations for schema parameters.\n */\nexport type AnyEntity = AnyObj | AnyRelation;\n\n/**\n * Type guard to check if a schema is an object schema.\n * NOTE: This checks SCHEMAS, not instances. Use Obj.isObject for instances.\n */\nexport const isObjectSchema = (schema: AnyEntity): schema is AnyObj => {\n return (schema as any)[internal.SchemaKindId] === internal.EntityKind.Object;\n};\n\n/**\n * Type guard to check if a schema is a relation schema.\n * NOTE: This checks SCHEMAS, not instances. Use Relation.isRelation for instances.\n */\nexport const isRelationSchema = (schema: AnyEntity): schema is AnyRelation => {\n return (schema as any)[internal.SchemaKindId] === internal.EntityKind.Relation;\n};\n\n/**\n * Type that represents any Ref schema (with unknown target type).\n * This is a schema type, not an instance type.\n */\nexport type AnyRef = Schema.Schema<internal.Ref<any>, EncodedReference>;\n\n//\n// Schema utility functions\n//\n\n/**\n * Gets the full DXN of the schema.\n * Will include the version if it's a `type` DXN.\n * @example \"dxn:com.example.type.person:0.1.0\"\n * @example \"dxn:echo:SSSSSSSSSS:XXXXXXXXXXXXX\"\n */\nexport const getDXN = (schema: AnyEntity): DXN | undefined => {\n return internal.getSchemaDXN(schema);\n};\n\n/**\n * @param schema - Schema to get the typename from.\n * @returns The typename of the schema. Example: `com.example.type.person`.\n */\nexport const getTypename = (schema: AnyEntity): string => {\n const typename = internal.getSchemaTypename(schema);\n invariant(typeof typename === 'string' && !typename.startsWith('dxn:'), 'Invalid typename');\n return typename;\n};\n\n/**\n * Gets the version of the schema.\n * @example 0.1.0\n */\nexport const getVersion = (schema: AnyEntity): string => {\n const version = internal.getSchemaVersion(schema);\n invariant(typeof version === 'string' && version.match(/^\\d+\\.\\d+\\.\\d+$/), 'Invalid version');\n return version;\n};\n\n/**\n * @returns True if the schema is mutable.\n */\nexport const isMutable = typeInternal.isMutable;\n\n/**\n * ECHO type metadata.\n */\nexport type Meta = internal.TypeAnnotation;\n\n/**\n * Gets the meta data of the schema.\n */\nexport const getMeta = (schema: AnyEntity): Meta | undefined => {\n return internal.getTypeAnnotation(schema);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;mBAAAA;EAAA;;;;;AASA,SAASC,iBAAiB;;AAanB,IAAMC,cAA2BC;AAmFjC,IAAMC,SAEAC;AAMN,IAAMC,iBAAkEC;AA4DxE,IAAMC,WAMAC;AAYN,IAAMC,iBAAiB,CAACC,WAAAA;AAC7B,SAAQA,OAAwBC,YAAY,MAAeC,WAAWC;AACxE;AAMO,IAAMC,mBAAmB,CAACJ,WAAAA;AAC/B,SAAQA,OAAwBC,YAAY,MAAeC,WAAWG;AACxE;AAkBO,IAAMC,SAAS,CAACN,WAAAA;AACrB,SAAgBO,aAAaP,MAAAA;AAC/B;AAMO,IAAMQ,cAAc,CAACR,WAAAA;AAC1B,QAAMS,WAAoBC,kBAAkBV,MAAAA;AAC5CW,YAAU,OAAOF,aAAa,YAAY,CAACA,SAASG,WAAW,MAAA,GAAS,oBAAA;;;;;;;;;AACxE,SAAOH;AACT;AAMO,IAAMI,aAAa,CAACb,WAAAA;AACzB,QAAMc,UAAmBC,iBAAiBf,MAAAA;AAC1CW,YAAU,OAAOG,YAAY,YAAYA,QAAQE,MAAM,iBAAA,GAAoB,mBAAA;;;;;;;;;AAC3E,SAAOF;AACT;AAKO,IAAMG,aAAyBA;AAU/B,IAAMC,UAAU,CAAClB,WAAAA;AACtB,SAAgBmB,kBAAkBnB,MAAAA;AACpC;",
6
+ "names": ["isMutable", "invariant", "RuntimeType", "EchoSchema", "object", "EchoObjectSchema", "PersistentType", "PersistentSchema", "relation", "EchoRelationSchema", "isObjectSchema", "schema", "SchemaKindId", "EntityKind", "Object", "isRelationSchema", "Relation", "getDXN", "getSchemaDXN", "getTypename", "typename", "getSchemaTypename", "invariant", "startsWith", "getVersion", "version", "getSchemaVersion", "match", "isMutable", "getMeta", "getTypeAnnotation"]
7
+ }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  EntityKind,
3
3
  createAnnotationHelper
4
- } from "./chunk-4KG6IGL4.mjs";
4
+ } from "./chunk-WYOKA6AE.mjs";
5
5
 
6
- // src/internal/types/typename.ts
6
+ // src/internal/common/types/typename.ts
7
7
  var ATTR_TYPE = "@type";
8
8
  var TypeId = /* @__PURE__ */ Symbol.for("@dxos/echo/Type");
9
9
  var SchemaId = /* @__PURE__ */ Symbol.for("@dxos/echo/Schema");
@@ -23,7 +23,7 @@ var setSchema = (obj, schema) => {
23
23
  });
24
24
  };
25
25
 
26
- // src/internal/annotations/annotations.ts
26
+ // src/internal/Annotation/annotations.ts
27
27
  import * as Function from "effect/Function";
28
28
  import * as Option from "effect/Option";
29
29
  import * as Schema from "effect/Schema";
@@ -32,7 +32,7 @@ import { raise } from "@dxos/debug";
32
32
  import { getField } from "@dxos/effect";
33
33
  import { assertArgument, invariant } from "@dxos/invariant";
34
34
  import { DXN } from "@dxos/keys";
35
- var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo/src/internal/annotations/annotations.ts";
35
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo/src/internal/Annotation/annotations.ts";
36
36
  var FIELD_PATH_ANNOTATION = "path";
37
37
  var FieldPath = (path) => PropertyMeta(FIELD_PATH_ANNOTATION, path);
38
38
  var TypeIdentifierAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/TypeIdentifier");
@@ -58,9 +58,9 @@ var getTypeDXNFromSpecifier = (input) => {
58
58
  return DXN.fromTypename(input);
59
59
  }
60
60
  };
61
- var TypenameSchema = Schema.String.pipe(Schema.pattern(/^[a-zA-Z]\w+\.[a-zA-Z]\w{1,}\/[\w/_-]+$/)).annotations({
62
- description: "Fully qualified globally unique typename",
63
- example: "dxos.org/type/Message"
61
+ var TypenameSchema = Schema.String.pipe(Schema.pattern(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9-]*){2,}$/)).annotations({
62
+ description: "Fully qualified globally unique typename in lowercase reverse-DNS form.",
63
+ example: "org.dxos.type.message"
64
64
  });
65
65
  var VersionSchema = Schema.String.pipe(Schema.pattern(/^\d+.\d+.\d+$/)).annotations({
66
66
  description: "Semantic version format: `major.minor.patch`",
@@ -103,7 +103,7 @@ var getTypename = (obj) => {
103
103
  var setTypename = (obj, typename) => {
104
104
  invariant(typename instanceof DXN, "Invalid type.", {
105
105
  F: __dxlog_file,
106
- L: 198,
106
+ L: 199,
107
107
  S: void 0,
108
108
  A: [
109
109
  "typename instanceof DXN",
@@ -127,7 +127,7 @@ var getTypeDXN = (obj) => {
127
127
  }
128
128
  invariant(type instanceof DXN, "Invalid object.", {
129
129
  F: __dxlog_file,
130
- L: 225,
130
+ L: 226,
131
131
  S: void 0,
132
132
  A: [
133
133
  "type instanceof DXN",
@@ -234,7 +234,7 @@ var FieldLookupAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotatio
234
234
  var GeneratorAnnotationId = /* @__PURE__ */ Symbol.for("@dxos/schema/annotation/Generator");
235
235
  var GeneratorAnnotation = createAnnotationHelper(GeneratorAnnotationId);
236
236
  var makeUserAnnotation = (props) => {
237
- assertArgument(/[a-zA-Z0-9]+\.[a-zA-Z.]+\/[a-zA-Z/]+/.test(props.id), "id", "Annotation id must be in the FQN format (dxos.org/annotation/Example).");
237
+ assertArgument(/^[a-z][a-z0-9]*(\.[a-z][a-z0-9-]*){2,}$/.test(props.id), "id", "Annotation id must be in the FQN format (org.dxos.annotation.example).");
238
238
  const getFromAst = (ast) => SchemaAST.getAnnotation(PropertyMetaAnnotationId)(ast).pipe(Option.map((meta) => meta[props.id]), Option.map(Schema.decodeUnknownSync(props.schema)));
239
239
  return {
240
240
  get: (schema) => getFromAst(schema.ast),
@@ -269,9 +269,33 @@ var IconAnnotationSchema = Schema.Struct({
269
269
  hue: Schema.optional(Schema.String)
270
270
  });
271
271
  var IconAnnotation = makeUserAnnotation({
272
- id: "dxos.org/annotation/Icon",
272
+ id: "org.dxos.annotation.icon",
273
273
  schema: IconAnnotationSchema
274
274
  });
275
+ var getLabel = (entity) => {
276
+ const schema = getSchema(entity);
277
+ if (schema != null) {
278
+ return getLabelWithSchema(schema, entity);
279
+ }
280
+ };
281
+ var setLabel = (entity, label) => {
282
+ const schema = getSchema(entity);
283
+ if (schema != null) {
284
+ setLabelWithSchema(schema, entity, label);
285
+ }
286
+ };
287
+ var getDescription = (entity) => {
288
+ const schema = getSchema(entity);
289
+ if (schema != null) {
290
+ return getDescriptionWithSchema(schema, entity);
291
+ }
292
+ };
293
+ var setDescription = (entity, description) => {
294
+ const schema = getSchema(entity);
295
+ if (schema != null) {
296
+ setDescriptionWithSchema(schema, entity, description);
297
+ }
298
+ };
275
299
 
276
300
  export {
277
301
  ATTR_TYPE,
@@ -322,6 +346,10 @@ export {
322
346
  GeneratorAnnotationId,
323
347
  GeneratorAnnotation,
324
348
  makeUserAnnotation,
325
- IconAnnotation
349
+ IconAnnotation,
350
+ getLabel,
351
+ setLabel,
352
+ getDescription,
353
+ setDescription
326
354
  };
327
- //# sourceMappingURL=chunk-F7KMHDPJ.mjs.map
355
+ //# sourceMappingURL=chunk-SEMVAGBM.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/internal/common/types/typename.ts", "../../../src/internal/Annotation/annotations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\n\n/**\n * Property name for typename when object is serialized to JSON.\n */\nexport const ATTR_TYPE = '@type';\n\n/**\n * DXN to the object type.\n */\nexport const TypeId = Symbol.for('@dxos/echo/Type');\n\n/**\n * Reference to the object schema.\n */\nexport const SchemaId = Symbol.for('@dxos/echo/Schema');\n\n/**\n * Property name for parent when object is serialized to JSON.\n */\nexport const ATTR_PARENT = '@parent';\n\n/**\n * Reference to the object parent.\n */\nexport const ParentId = Symbol.for('@dxos/echo/Parent');\n\n/**\n * Returns the schema for the given object if one is defined.\n *\n * @internal (Use Obj.getSchema)\n */\n// TODO(burdon): Narrow type.\n// TODO(dmaretskyi): For echo objects, this always returns the root schema.\nexport const getSchema = (obj: unknown | undefined): Schema.Schema.AnyNoContext | undefined => {\n if (obj) {\n return (obj as any)[SchemaId];\n }\n};\n\n/**\n * @internal\n */\nexport const setSchema = (obj: any, schema: Schema.Schema.AnyNoContext): void => {\n Object.defineProperty(obj, SchemaId, {\n value: schema,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { raise } from '@dxos/debug';\nimport { type JsonPath, getField } from '@dxos/effect';\nimport { assertArgument, invariant } from '@dxos/invariant';\nimport { DXN } from '@dxos/keys';\nimport { type Primitive } from '@dxos/util';\n\nimport { type Mutable } from '../common/proxy';\nimport { type AnyProperties, EntityKind, TypeId, getSchema } from '../common/types';\n\nimport { type AnnotationHelper, createAnnotationHelper } from './util';\n\n/**\n * @internal\n */\nexport const FIELD_PATH_ANNOTATION = 'path';\n\n/**\n * Sets the path for the field.\n * @param path Data source path in the json path format. This is the field path in the source object.\n */\n// TODO(burdon): Field, vs. path vs. property.\nexport const FieldPath = (path: string) => PropertyMeta(FIELD_PATH_ANNOTATION, path);\n\n//\n// Type\n//\n\n/**\n * ECHO identifier (for a stored schema).\n * Must be a `dxn:echo:` URI.\n */\nexport const TypeIdentifierAnnotationId = Symbol.for('@dxos/schema/annotation/TypeIdentifier');\n\nexport const getTypeIdentifierAnnotation = (schema: Schema.Schema.All) =>\n Function.flow(\n SchemaAST.getAnnotation<string>(TypeIdentifierAnnotationId),\n Option.getOrElse(() => undefined),\n )(schema.ast);\n\n/**\n * @returns DXN of the schema.\n *\n * For non-stored schema returns `dxn:type:`.\n * For stored schema returns `dxn:echo:`.\n */\nexport const getSchemaDXN = (schema: Schema.Schema.All): DXN | undefined => {\n assertArgument(Schema.isSchema(schema), 'schema', 'invalid schema');\n const id = getTypeIdentifierAnnotation(schema);\n if (id) {\n return DXN.parse(id);\n }\n\n // TODO(dmaretskyi): Add support for dynamic schema.\n const objectAnnotation = getTypeAnnotation(schema);\n if (!objectAnnotation) {\n return undefined;\n }\n\n return DXN.fromTypenameAndVersion(objectAnnotation.typename, objectAnnotation.version);\n};\n\n/**\n * @param input schema or a typename string.\n * @return type DXN.\n */\nexport const getTypeDXNFromSpecifier = (input: Schema.Schema.All | string): DXN => {\n if (Schema.isSchema(input)) {\n return getSchemaDXN(input) ?? raise(new TypeError('Schema has no DXN'));\n } else {\n assertArgument(typeof input === 'string', 'input');\n assertArgument(!input.startsWith('dxn:'), 'input');\n return DXN.fromTypename(input);\n }\n};\n\n//\n// TypeAnnotation\n//\n\n/**\n * Fully qualified globally unique typename.\n * Example: `org.dxos.type.message`\n */\n// TODO(burdon): Reconcile with short DXN format.\n// TODO(burdon): Change \"type\" => \"schema\" throughout.\nexport const TypenameSchema = Schema.String.pipe(Schema.pattern(/^[a-z][a-z0-9]*(\\.[a-z][a-z0-9-]*){2,}$/)).annotations(\n {\n description: 'Fully qualified globally unique typename in lowercase reverse-DNS form.',\n example: 'org.dxos.type.message',\n },\n);\n\n/**\n * Semantic version format: `major.minor.patch`\n * Example: `1.0.0`\n */\nexport const VersionSchema = Schema.String.pipe(Schema.pattern(/^\\d+.\\d+.\\d+$/)).annotations({\n description: 'Semantic version format: `major.minor.patch`',\n example: '1.0.0',\n});\n\nexport const TypeMeta = Schema.Struct({\n typename: TypenameSchema,\n version: VersionSchema,\n});\n\nexport interface TypeMeta extends Schema.Schema.Type<typeof TypeMeta> {}\n\n/**\n * Entity type.\n */\nexport const TypeAnnotationId = Symbol.for('@dxos/schema/annotation/Type');\n\n/**\n * Payload stored under {@link TypeAnnotationId}.\n */\nexport const TypeAnnotation = Schema.extend(\n TypeMeta,\n Schema.Struct({\n kind: Schema.Enums(EntityKind),\n\n /**\n * If this is a relation, the schema of the source object.\n * Must be present if entity kind is {@link EntityKind.Relation}.\n */\n sourceSchema: Schema.optional(DXN.Schema),\n\n /**\n * If this is a relation, the schema of the target object.\n * Must be present if entity kind is {@link EntityKind.Relation}.\n */\n targetSchema: Schema.optional(DXN.Schema),\n }),\n);\n\nexport interface TypeAnnotation extends Schema.Schema.Type<typeof TypeAnnotation> {}\n\n/**\n * @returns {@link TypeAnnotation} from a schema.\n * Schema must have been created with {@link TypedObject} or {@link TypedLink} or manually assigned an appropriate annotation.\n */\nexport const getTypeAnnotation = (schema: Schema.Schema.All): TypeAnnotation | undefined => {\n assertArgument(schema != null && schema.ast != null, 'schema', 'invalid schema');\n return Function.flow(\n SchemaAST.getAnnotation<TypeAnnotation>(TypeAnnotationId),\n Option.getOrElse(() => undefined),\n )(schema.ast);\n};\n\n/**\n * @returns {@link EntityKind} from a schema.\n */\nexport const getEntityKind = (schema: Schema.Schema.All): EntityKind | undefined => getTypeAnnotation(schema)?.kind;\n\n/**\n * @internal\n * @returns Schema typename (without dxn: prefix or version number).\n */\nexport const getSchemaTypename = (schema: Schema.Schema.All): string | undefined => getTypeAnnotation(schema)?.typename;\n\n/**\n * @internal\n * @returns Schema version in semver format.\n */\nexport const getSchemaVersion = (schema: Schema.Schema.All): string | undefined => getTypeAnnotation(schema)?.version;\n\n/**\n * Gets the typename of the object without the version.\n * Returns only the name portion, not the DXN.\n * @example \"org.example.type.contact\"\n *\n * @internal (use Obj.getTypename)\n */\nexport const getTypename = (obj: AnyProperties): string | undefined => {\n const schema = getSchema(obj);\n if (schema != null) {\n // Try to extract typename from DXN.\n return getSchemaTypename(schema);\n } else {\n const type = getTypeDXN(obj);\n return type?.asTypeDXN()?.type;\n }\n};\n\n/**\n * @internal (use Type.setTypename)\n */\n// TODO(dmaretskyi): Rename setTypeDXN.\nexport const setTypename = (obj: any, typename: DXN): void => {\n invariant(typename instanceof DXN, 'Invalid type.');\n Object.defineProperty(obj, TypeId, {\n value: typename,\n writable: false,\n enumerable: false,\n configurable: false,\n });\n};\n\n/**\n * @returns Object type as {@link DXN}.\n * @returns undefined if the object doesn't have a type.\n * @example `dxn:com.example.type.person:1.0.0`\n *\n * @internal (use Obj.getTypeDXN)\n */\n// TODO(burdon): Narrow type.\nexport const getTypeDXN = (obj: AnyProperties): DXN | undefined => {\n if (!obj) {\n return undefined;\n }\n\n const type = (obj as any)[TypeId];\n if (!type) {\n return undefined;\n }\n\n invariant(type instanceof DXN, 'Invalid object.');\n return type;\n};\n\n/**\n * Checks if the object is an instance of the schema.\n * Only typename is compared, the schema version is ignored.\n *\n * The following cases are considered to mean that the object is an instance of the schema:\n * - Object was created with this exact schema.\n * - Object was created with a different version of this schema.\n * - Object was created with a different schema (maybe dynamic) that has the same typename.\n */\n// TODO(burdon): Can we use `Schema.is`?\nexport const isInstanceOf = <Schema extends Schema.Schema.AnyNoContext>(\n schema: Schema,\n object: any,\n): object is Schema.Schema.Type<Schema> => {\n if (object == null) {\n return false;\n }\n\n const schemaDXN = getSchemaDXN(schema);\n if (!schemaDXN) {\n throw new Error('Schema must have an object annotation.');\n }\n\n const type = getTypeDXN(object);\n if (type && DXN.equals(type, schemaDXN)) {\n return true;\n }\n\n const typename = getTypename(object);\n if (!typename) {\n return false;\n }\n\n const typeDXN = schemaDXN.asTypeDXN();\n if (!typeDXN) {\n return false;\n }\n\n return typeDXN.type === typename;\n};\n\n//\n// PropertyMeta\n//\n\n/**\n * PropertyMeta (metadata for dynamic schema properties).\n * For user-defined annotations.\n */\nexport const PropertyMetaAnnotationId = Symbol.for('@dxos/schema/annotation/PropertyMeta');\n\nexport type PropertyMetaValue = Primitive | Record<string, Primitive> | Primitive[];\n\nexport type PropertyMetaAnnotation = {\n [name: string]: PropertyMetaValue;\n};\n\n// TODO(wittjosiah): Align with other annotations.\n// TODO(wittjosiah): Why is this separate from FormatAnnotation?\nexport const PropertyMeta = (name: string, value: PropertyMetaValue) => {\n return <A, I, R>(self: Schema.Schema<A, I, R>): Schema.Schema<A, I, R> => {\n const existingMeta = self.ast.annotations[PropertyMetaAnnotationId] as PropertyMetaAnnotation;\n return self.annotations({\n [PropertyMetaAnnotationId]: {\n ...existingMeta,\n [name]: value,\n },\n });\n };\n};\n\nexport const getPropertyMetaAnnotation = <T>(prop: SchemaAST.PropertySignature, name: string) =>\n Function.pipe(\n SchemaAST.getAnnotation<PropertyMetaAnnotation>(PropertyMetaAnnotationId)(prop.type),\n Option.map((meta) => meta[name] as T),\n Option.getOrElse(() => undefined),\n );\n\n//\n// Reference\n//\n\n/**\n * Schema reference.\n */\nexport const ReferenceAnnotationId = Symbol.for('@dxos/schema/annotation/Reference');\nexport type ReferenceAnnotationValue = TypeAnnotation;\nexport const ReferenceAnnotation = createAnnotationHelper<ReferenceAnnotationValue>(ReferenceAnnotationId);\n\n/**\n * SchemaMeta.\n */\nexport const SchemaMetaSymbol = Symbol.for('@dxos/schema/SchemaMeta');\nexport type SchemaMeta = TypeMeta & { id: string };\n\n/**\n * Identifies a schema as a schema for a hidden system type.\n */\nexport const SystemTypeAnnotationId = Symbol.for('@dxos/schema/annotation/SystemType');\nexport const SystemTypeAnnotation = createAnnotationHelper<boolean>(SystemTypeAnnotationId);\n\n/**\n * Identifies label property or JSON path expression.\n * Either a string or an array of strings representing field accessors each matched in priority order.\n */\nexport const LabelAnnotationId = Symbol.for('@dxos/schema/annotation/Label');\nexport const LabelAnnotation = createAnnotationHelper<string[]>(LabelAnnotationId);\n\n/**\n * Returns the label for a given object based on {@link LabelAnnotationId}.\n * Lower-level version that requires explicit schema parameter.\n */\n// TODO(burdon): Convert to JsonPath?\nexport const getLabelWithSchema = <S extends Schema.Schema.Any>(\n schema: S,\n object: Schema.Schema.Type<S>,\n): string | undefined => {\n const annotation = LabelAnnotation.get(schema).pipe(Option.getOrElse(() => ['name']));\n for (const accessor of annotation) {\n assertArgument(\n typeof accessor === 'string',\n 'accessor',\n 'Label annotation must be a string or an array of strings',\n );\n const value = getField(object, accessor as JsonPath);\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'bigint':\n case 'symbol':\n return value.toString();\n case 'undefined':\n case 'object':\n case 'function':\n continue;\n }\n }\n\n return undefined;\n};\n\n/**\n * Sets the label for a given object based on {@link LabelAnnotationId}.\n * Lower-level version that requires explicit schema parameter.\n */\nexport const setLabelWithSchema = <S extends Schema.Schema.Any>(\n schema: S,\n object: Schema.Schema.Type<S>,\n label: string,\n) => {\n const annotation = LabelAnnotation.get(schema).pipe(\n Option.map((field) => field[0]),\n Option.getOrElse(() => 'name'),\n );\n object[annotation] = label;\n};\n\n/**\n * Identifies description property or JSON path expression.\n * A string representing field accessor.\n */\nexport const DescriptionAnnotationId = Symbol.for('@dxos/schema/annotation/Description');\nexport const DescriptionAnnotation = createAnnotationHelper<string>(DescriptionAnnotationId);\n\n/**\n * Returns the description for a given object based on {@link DescriptionAnnotationId}.\n * Lower-level version that requires explicit schema parameter.\n */\n// TODO(burdon): Convert to JsonPath?\nexport const getDescriptionWithSchema = <S extends Schema.Schema.Any>(\n schema: S,\n object: Schema.Schema.Type<S>,\n): string | undefined => {\n const accessor = DescriptionAnnotation.get(schema).pipe(Option.getOrElse(() => 'description'));\n assertArgument(typeof accessor === 'string', 'accessor', 'Description annotation must be a string');\n const value = getField(object, accessor as JsonPath);\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'bigint':\n case 'symbol':\n return value.toString();\n case 'undefined':\n case 'object':\n case 'function':\n default:\n return undefined;\n }\n};\n\n/**\n * Sets the description for a given object based on {@link DescriptionAnnotationId}.\n * Lower-level version that requires explicit schema parameter.\n */\nexport const setDescriptionWithSchema = <S extends Schema.Schema.Any>(\n schema: S,\n object: Schema.Schema.Type<S>,\n description: string,\n) => {\n const accessor = DescriptionAnnotation.get(schema).pipe(Option.getOrElse(() => 'description'));\n object[accessor] = description;\n};\n\n/**\n * Identifies if a property should be included in a form or not.\n * By default, all properties are included in forms, so this is opt-out.\n */\n// TODO(burdon): UI concern.\nexport const FormInputAnnotationId = Symbol.for('@dxos/schema/annotation/FormInput');\nexport const FormInputAnnotation = createAnnotationHelper<boolean>(FormInputAnnotationId);\n\n/**\n * Default field to be used on referenced schema to lookup the value.\n */\nexport const FieldLookupAnnotationId = Symbol.for('@dxos/schema/annotation/FieldLookup');\n\n/**\n * Generate test data.\n */\nexport const GeneratorAnnotationId = Symbol.for('@dxos/schema/annotation/Generator');\n\nexport type GeneratorAnnotationValue =\n | string\n | {\n generator: string;\n args?: any[];\n probability?: number;\n };\n\nexport const GeneratorAnnotation = createAnnotationHelper<GeneratorAnnotationValue>(GeneratorAnnotationId);\n\ninterface MakeAnnoationsProps<T> {\n id: string;\n schema: Schema.Schema<T, any, never>;\n}\n\n// TODO(wittjosiah): Comment.\nexport const makeUserAnnotation = <T>(props: MakeAnnoationsProps<T>): AnnotationHelper<T> => {\n assertArgument(\n /^[a-z][a-z0-9]*(\\.[a-z][a-z0-9-]*){2,}$/.test(props.id),\n 'id',\n 'Annotation id must be in the FQN format (org.dxos.annotation.example).',\n );\n\n const getFromAst = (ast: SchemaAST.AST) =>\n SchemaAST.getAnnotation<PropertyMetaAnnotation>(PropertyMetaAnnotationId)(ast).pipe(\n Option.map((meta) => meta[props.id] as unknown),\n Option.map(Schema.decodeUnknownSync(props.schema)),\n );\n\n return {\n get: (schema) => getFromAst(schema.ast),\n getFromAst: (ast) => getFromAst(ast),\n set: (value) =>\n PropertyMeta(props.id, Schema.encodeSync(props.schema)(value)) as <S extends Schema.Schema.Any>(schema: S) => S,\n };\n};\n\nconst IconAnnotationSchema = Schema.Struct({\n /**\n * Phosphor icon name (e.g., 'ph--user--regular', 'ph--cube--regular', 'ph--link--regular ', etc.)\n */\n icon: Schema.String.pipe(Schema.pattern(/^ph--[a-z-]+--[a-z]+$/)),\n\n /**\n * Color name.\n *\n * List of colors:\n * - 'red'\n * - 'orange'\n * - 'amber'\n * - 'yellow'\n * - 'lime'\n * - 'green'\n * - 'emerald'\n * - 'teal'\n * - 'cyan'\n * - 'violet'\n * - 'purple'\n * - 'fuchsia'\n * - 'pink'\n * - 'rose'\n */\n\n hue: Schema.optional(Schema.String),\n});\n\nexport interface IconAnnotation extends Schema.Schema.Type<typeof IconAnnotationSchema> {}\n\n/**\n * Icon to render in the UI.\n */\nexport const IconAnnotation = makeUserAnnotation<IconAnnotation>({\n id: 'org.dxos.annotation.icon',\n schema: IconAnnotationSchema,\n});\n\n/**\n * Get the label of an entity.\n * Accepts both reactive entities and snapshots.\n */\nexport const getLabel = (entity: AnyProperties): string | undefined => {\n const schema = getSchema(entity);\n if (schema != null) {\n return getLabelWithSchema(schema, entity);\n }\n};\n\n/**\n * Set the label of an entity.\n * Must be called within an Obj.change or Relation.change callback.\n */\nexport const setLabel = (entity: Mutable<AnyProperties>, label: string) => {\n const schema = getSchema(entity);\n if (schema != null) {\n setLabelWithSchema(schema, entity, label);\n }\n};\n\n/**\n * Get the description of an entity.\n * Accepts both reactive entities and snapshots.\n */\nexport const getDescription = (entity: AnyProperties): string | undefined => {\n const schema = getSchema(entity);\n if (schema != null) {\n return getDescriptionWithSchema(schema, entity);\n }\n};\n\n/**\n * Set the description of an entity.\n * Must be called within an Obj.change or Relation.change callback.\n */\nexport const setDescription = (entity: Mutable<AnyProperties>, description: string) => {\n const schema = getSchema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", "schema", "Object", "defineProperty", "value", "writable", "enumerable", "configurable", "Function", "Option", "Schema", "SchemaAST", "raise", "getField", "assertArgument", "invariant", "DXN", "FIELD_PATH_ANNOTATION", "FieldPath", "path", "PropertyMeta", "TypeIdentifierAnnotationId", "Symbol", "for", "getTypeIdentifierAnnotation", "schema", "flow", "getAnnotation", "getOrElse", "undefined", "ast", "getSchemaDXN", "assertArgument", "isSchema", "id", "DXN", "parse", "objectAnnotation", "getTypeAnnotation", "fromTypenameAndVersion", "typename", "version", "getTypeDXNFromSpecifier", "input", "raise", "TypeError", "startsWith", "fromTypename", "TypenameSchema", "String", "pipe", "pattern", "annotations", "description", "example", "VersionSchema", "TypeMeta", "Struct", "TypeAnnotationId", "TypeAnnotation", "extend", "kind", "Enums", "EntityKind", "sourceSchema", "optional", "Schema", "targetSchema", "getEntityKind", "getSchemaTypename", "getSchemaVersion", "getTypename", "obj", "getSchema", "type", "getTypeDXN", "asTypeDXN", "setTypename", "invariant", "Object", "defineProperty", "TypeId", "value", "writable", "enumerable", "configurable", "isInstanceOf", "object", "schemaDXN", "Error", "equals", "typeDXN", "PropertyMetaAnnotationId", "name", "self", "existingMeta", "getPropertyMetaAnnotation", "prop", "map", "meta", "ReferenceAnnotationId", "ReferenceAnnotation", "createAnnotationHelper", "SchemaMetaSymbol", "SystemTypeAnnotationId", "SystemTypeAnnotation", "LabelAnnotationId", "LabelAnnotation", "getLabelWithSchema", "annotation", "get", "accessor", "getField", "toString", "setLabelWithSchema", "label", "field", "DescriptionAnnotationId", "DescriptionAnnotation", "getDescriptionWithSchema", "setDescriptionWithSchema", "FormInputAnnotationId", "FormInputAnnotation", "FieldLookupAnnotationId", "GeneratorAnnotationId", "GeneratorAnnotation", "makeUserAnnotation", "props", "test", "getFromAst", "decodeUnknownSync", "set", "encodeSync", "IconAnnotationSchema", "icon", "hue", "IconAnnotation", "getLabel", "entity", "setLabel", "getDescription", "setDescription"]
7
+ }