@dxos/echo 0.8.4-main.bc674ce → 0.8.4-main.bd9b33e6c8

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 (536) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/neutral/Annotation.mjs +8 -3
  3. package/dist/lib/neutral/Database.mjs +34 -6
  4. package/dist/lib/neutral/Entity.mjs +18 -10
  5. package/dist/lib/neutral/Err.mjs +3 -1
  6. package/dist/lib/neutral/Extension.mjs +18 -0
  7. package/dist/lib/neutral/Extension.mjs.map +7 -0
  8. package/dist/lib/neutral/Feed.mjs +45 -0
  9. package/dist/lib/neutral/Feed.mjs.map +7 -0
  10. package/dist/lib/neutral/Filter.mjs +17 -10
  11. package/dist/lib/neutral/Format.mjs +3 -3
  12. package/dist/lib/neutral/JsonSchema.mjs +9 -9
  13. package/dist/lib/neutral/Obj.mjs +35 -15
  14. package/dist/lib/neutral/Order.mjs +1 -1
  15. package/dist/lib/neutral/Query.mjs +19 -9
  16. package/dist/lib/neutral/Ref.mjs +9 -7
  17. package/dist/lib/neutral/Relation.mjs +20 -11
  18. package/dist/lib/neutral/SchemaRegistry.mjs +1 -1
  19. package/dist/lib/neutral/Tag.mjs +13 -10
  20. package/dist/lib/neutral/Type.mjs +13 -23
  21. package/dist/lib/neutral/{chunk-HMOXCO27.mjs → chunk-35O3JYTV.mjs} +8 -3
  22. package/dist/lib/neutral/chunk-35O3JYTV.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-4BT7QVIT.mjs +34 -0
  24. package/dist/lib/neutral/chunk-4BT7QVIT.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-4O4AV6CL.mjs +787 -0
  26. package/dist/lib/neutral/chunk-4O4AV6CL.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-62DWJ6CE.mjs → chunk-B5OXLWZL.mjs} +14 -14
  28. package/dist/lib/neutral/chunk-B5OXLWZL.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-NWUO5FKZ.mjs → chunk-B7HTUIZA.mjs} +8 -2
  30. package/dist/lib/neutral/chunk-B7HTUIZA.mjs.map +7 -0
  31. package/dist/lib/neutral/{chunk-4L6DOFXP.mjs → chunk-BNCCGLJN.mjs} +1 -1
  32. package/dist/lib/neutral/{chunk-4L6DOFXP.mjs.map → chunk-BNCCGLJN.mjs.map} +1 -1
  33. package/dist/lib/neutral/{chunk-3ZEAZF7T.mjs → chunk-EIX4KLES.mjs} +8 -4
  34. package/dist/lib/neutral/chunk-EIX4KLES.mjs.map +7 -0
  35. package/dist/lib/neutral/chunk-FLSFS6UB.mjs +117 -0
  36. package/dist/lib/neutral/chunk-FLSFS6UB.mjs.map +7 -0
  37. package/dist/lib/neutral/{chunk-VR4A4WGG.mjs → chunk-FXQ52LDX.mjs} +72 -23
  38. package/dist/lib/neutral/chunk-FXQ52LDX.mjs.map +7 -0
  39. package/dist/lib/neutral/{chunk-4TT624YA.mjs → chunk-FZO7LQO7.mjs} +2 -2
  40. package/dist/lib/neutral/{chunk-4TT624YA.mjs.map → chunk-FZO7LQO7.mjs.map} +1 -1
  41. package/dist/lib/neutral/chunk-HIMJ3MXL.mjs +283 -0
  42. package/dist/lib/neutral/chunk-HIMJ3MXL.mjs.map +7 -0
  43. package/dist/lib/neutral/{chunk-VB5HVDCA.mjs → chunk-HITCYIP2.mjs} +47 -5
  44. package/dist/lib/neutral/chunk-HITCYIP2.mjs.map +7 -0
  45. package/dist/lib/neutral/{chunk-SU2LVM7J.mjs → chunk-JJTRVYRD.mjs} +1596 -2730
  46. package/dist/lib/neutral/chunk-JJTRVYRD.mjs.map +7 -0
  47. package/dist/lib/neutral/{chunk-6QPSGMEF.mjs → chunk-JX5K6AY3.mjs} +32 -8
  48. package/dist/lib/neutral/chunk-JX5K6AY3.mjs.map +7 -0
  49. package/dist/lib/neutral/{chunk-IP2GHXWA.mjs → chunk-PRQVBGFG.mjs} +5 -5
  50. package/dist/lib/neutral/chunk-PRQVBGFG.mjs.map +7 -0
  51. package/dist/lib/neutral/chunk-RUYH5REG.mjs +130 -0
  52. package/dist/lib/neutral/chunk-RUYH5REG.mjs.map +7 -0
  53. package/dist/lib/neutral/{chunk-2MTHJ5UW.mjs → chunk-T74ABBRN.mjs} +134 -24
  54. package/dist/lib/neutral/chunk-T74ABBRN.mjs.map +7 -0
  55. package/dist/lib/neutral/{chunk-XMIDBDE6.mjs → chunk-TJRQTGXR.mjs} +11 -56
  56. package/dist/lib/neutral/chunk-TJRQTGXR.mjs.map +7 -0
  57. package/dist/lib/neutral/{chunk-RPB6V4BE.mjs → chunk-UBEZSGXY.mjs} +14 -1
  58. package/dist/lib/neutral/chunk-UBEZSGXY.mjs.map +7 -0
  59. package/dist/lib/neutral/{chunk-ROKO4RKJ.mjs → chunk-UI6MWK5W.mjs} +2 -2
  60. package/dist/lib/neutral/chunk-UI6MWK5W.mjs.map +7 -0
  61. package/dist/lib/neutral/chunk-VF2IHN6I.mjs +396 -0
  62. package/dist/lib/neutral/chunk-VF2IHN6I.mjs.map +7 -0
  63. package/dist/lib/neutral/{chunk-YQYMWZAD.mjs → chunk-WYOKA6AE.mjs} +4 -4
  64. package/dist/lib/neutral/chunk-WYOKA6AE.mjs.map +7 -0
  65. package/dist/lib/neutral/{chunk-CUDIBUM4.mjs → chunk-XEBKJROJ.mjs} +104 -25
  66. package/dist/lib/neutral/chunk-XEBKJROJ.mjs.map +7 -0
  67. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs +50 -0
  68. package/dist/lib/neutral/chunk-YS6Q3XAD.mjs.map +7 -0
  69. package/dist/lib/neutral/chunk-ZZEIMPNC.mjs +159 -0
  70. package/dist/lib/neutral/chunk-ZZEIMPNC.mjs.map +7 -0
  71. package/dist/lib/neutral/index.mjs +42 -25
  72. package/dist/lib/neutral/internal/index.mjs +52 -38
  73. package/dist/lib/neutral/meta.json +1 -1
  74. package/dist/lib/neutral/testing/index.mjs +42 -34
  75. package/dist/lib/neutral/testing/index.mjs.map +3 -3
  76. package/dist/types/src/Annotation.d.ts +23 -1
  77. package/dist/types/src/Annotation.d.ts.map +1 -1
  78. package/dist/types/src/Collection.d.ts +16 -0
  79. package/dist/types/src/Collection.d.ts.map +1 -0
  80. package/dist/types/src/Database.d.ts +79 -84
  81. package/dist/types/src/Database.d.ts.map +1 -1
  82. package/dist/types/src/Dataset.d.ts +19 -0
  83. package/dist/types/src/Dataset.d.ts.map +1 -0
  84. package/dist/types/src/Entity.d.ts +41 -15
  85. package/dist/types/src/Entity.d.ts.map +1 -1
  86. package/dist/types/src/Err.d.ts +43 -0
  87. package/dist/types/src/Err.d.ts.map +1 -1
  88. package/dist/types/src/Extension.d.ts +80 -0
  89. package/dist/types/src/Extension.d.ts.map +1 -0
  90. package/dist/types/src/Extension.test.d.ts +2 -0
  91. package/dist/types/src/Extension.test.d.ts.map +1 -0
  92. package/dist/types/src/Feed.d.ts +163 -0
  93. package/dist/types/src/Feed.d.ts.map +1 -0
  94. package/dist/types/src/Filter.d.ts +13 -1
  95. package/dist/types/src/Filter.d.ts.map +1 -1
  96. package/dist/types/src/Filter.test.d.ts +2 -0
  97. package/dist/types/src/Filter.test.d.ts.map +1 -0
  98. package/dist/types/src/Format.d.ts +3 -3
  99. package/dist/types/src/Format.d.ts.map +1 -1
  100. package/dist/types/src/Hypergraph.d.ts +8 -3
  101. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  102. package/dist/types/src/JsonSchema.d.ts +11 -4
  103. package/dist/types/src/JsonSchema.d.ts.map +1 -1
  104. package/dist/types/src/Obj.d.ts +158 -43
  105. package/dist/types/src/Obj.d.ts.map +1 -1
  106. package/dist/types/src/Order.d.ts.map +1 -1
  107. package/dist/types/src/Query.d.ts +101 -14
  108. package/dist/types/src/Query.d.ts.map +1 -1
  109. package/dist/types/src/Ref.d.ts +58 -10
  110. package/dist/types/src/Ref.d.ts.map +1 -1
  111. package/dist/types/src/Relation.d.ts +75 -28
  112. package/dist/types/src/Relation.d.ts.map +1 -1
  113. package/dist/types/src/SchemaRegistry.d.ts +4 -4
  114. package/dist/types/src/SchemaRegistry.d.ts.map +1 -1
  115. package/dist/types/src/Tag.d.ts +4 -3
  116. package/dist/types/src/Tag.d.ts.map +1 -1
  117. package/dist/types/src/Type.d.ts +51 -180
  118. package/dist/types/src/Type.d.ts.map +1 -1
  119. package/dist/types/src/View.d.ts +68 -0
  120. package/dist/types/src/View.d.ts.map +1 -0
  121. package/dist/types/src/hierarchy.test.d.ts +2 -0
  122. package/dist/types/src/hierarchy.test.d.ts.map +1 -0
  123. package/dist/types/src/index.d.ts +5 -0
  124. package/dist/types/src/index.d.ts.map +1 -1
  125. package/dist/types/src/internal/{annotations → Annotation}/annotations.d.ts +69 -8
  126. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -0
  127. package/dist/types/src/internal/Annotation/annotations.test.d.ts.map +1 -0
  128. package/dist/types/src/internal/Annotation/index.d.ts +4 -0
  129. package/dist/types/src/internal/Annotation/index.d.ts.map +1 -0
  130. package/dist/types/src/internal/{api → Annotation}/sorting.d.ts +1 -1
  131. package/dist/types/src/internal/Annotation/sorting.d.ts.map +1 -0
  132. package/dist/types/src/internal/{annotations → Annotation}/util.d.ts +13 -1
  133. package/dist/types/src/internal/Annotation/util.d.ts.map +1 -0
  134. package/dist/types/src/internal/{api/entity.d.ts → Entity/api.d.ts} +2 -2
  135. package/dist/types/src/internal/Entity/api.d.ts.map +1 -0
  136. package/dist/types/src/internal/{entities → Entity}/entity.d.ts +3 -3
  137. package/dist/types/src/internal/Entity/entity.d.ts.map +1 -0
  138. package/dist/types/src/internal/{entities → Entity}/index.d.ts +2 -0
  139. package/dist/types/src/internal/Entity/index.d.ts.map +1 -0
  140. package/dist/types/src/internal/{entities → Entity}/model.d.ts +4 -26
  141. package/dist/types/src/internal/Entity/model.d.ts.map +1 -0
  142. package/dist/types/src/internal/{entities → Entity}/object.d.ts +2 -2
  143. package/dist/types/src/internal/Entity/object.d.ts.map +1 -0
  144. package/dist/types/src/internal/{entities → Entity}/relation.d.ts +3 -30
  145. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -0
  146. package/dist/types/src/internal/Entity/util.d.ts.map +1 -0
  147. package/dist/types/src/internal/{api → Entity}/version.d.ts +1 -1
  148. package/dist/types/src/internal/Entity/version.d.ts.map +1 -0
  149. package/dist/types/src/internal/Format/date.d.ts.map +1 -0
  150. package/dist/types/src/internal/Format/date.test.d.ts.map +1 -0
  151. package/dist/types/src/internal/Format/format.d.ts.map +1 -0
  152. package/dist/types/src/internal/Format/format.test.d.ts.map +1 -0
  153. package/dist/types/src/internal/Format/index.d.ts.map +1 -0
  154. package/dist/types/src/internal/Format/number.d.ts.map +1 -0
  155. package/dist/types/src/internal/Format/object.d.ts.map +1 -0
  156. package/dist/types/src/internal/Format/select.d.ts.map +1 -0
  157. package/dist/types/src/internal/Format/string.d.ts.map +1 -0
  158. package/dist/types/src/internal/{formats → Format}/types.d.ts +1 -1
  159. package/dist/types/src/internal/Format/types.d.ts.map +1 -0
  160. package/dist/types/src/internal/{json-schema → JsonSchema}/annotations.d.ts +1 -1
  161. package/dist/types/src/internal/JsonSchema/annotations.d.ts.map +1 -0
  162. package/dist/types/src/internal/JsonSchema/effect-schema.test.d.ts.map +1 -0
  163. package/dist/types/src/internal/JsonSchema/index.d.ts.map +1 -0
  164. package/dist/types/src/internal/JsonSchema/json-schema-normalize.d.ts.map +1 -0
  165. package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-type.d.ts +19 -19
  166. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -0
  167. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -0
  168. package/dist/types/src/internal/JsonSchema/json-schema.test.d.ts.map +1 -0
  169. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -0
  170. package/dist/types/src/internal/Obj/common.d.ts.map +1 -0
  171. package/dist/types/src/internal/{object → Obj}/create-object.d.ts +2 -2
  172. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -0
  173. package/dist/types/src/internal/Obj/create-object.test.d.ts.map +1 -0
  174. package/dist/types/src/internal/{object → Obj}/deleted.d.ts +1 -1
  175. package/dist/types/src/internal/Obj/deleted.d.ts.map +1 -0
  176. package/dist/types/src/internal/Obj/ids.d.ts.map +1 -0
  177. package/dist/types/src/internal/Obj/index.d.ts.map +1 -0
  178. package/dist/types/src/internal/Obj/inspect.d.ts.map +1 -0
  179. package/dist/types/src/internal/{object → Obj}/json-serializer.d.ts +12 -5
  180. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -0
  181. package/dist/types/src/internal/Obj/json-serializer.test.d.ts.map +1 -0
  182. package/dist/types/src/internal/Obj/schema-validator.d.ts +2 -0
  183. package/dist/types/src/internal/Obj/schema-validator.d.ts.map +1 -0
  184. package/dist/types/src/internal/Obj/schema-validator.test.d.ts.map +1 -0
  185. package/dist/types/src/internal/{object → Obj}/set-value.d.ts +1 -1
  186. package/dist/types/src/internal/Obj/set-value.d.ts.map +1 -0
  187. package/dist/types/src/internal/Obj/set-value.test.d.ts.map +1 -0
  188. package/dist/types/src/internal/Obj/snapshot.d.ts.map +1 -0
  189. package/dist/types/src/internal/{object → Obj}/typed-object.d.ts +4 -4
  190. package/dist/types/src/internal/Obj/typed-object.d.ts.map +1 -0
  191. package/dist/types/src/internal/Obj/typed-object.test.d.ts.map +1 -0
  192. package/dist/types/src/internal/Ref/index.d.ts.map +1 -0
  193. package/dist/types/src/internal/{ref → Ref}/ref-array.d.ts +1 -1
  194. package/dist/types/src/internal/Ref/ref-array.d.ts.map +1 -0
  195. package/dist/types/src/internal/{ref → Ref}/ref.d.ts +16 -3
  196. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -0
  197. package/dist/types/src/internal/Ref/ref.test.d.ts.map +1 -0
  198. package/dist/types/src/internal/{schema → Type}/compose.d.ts +1 -1
  199. package/dist/types/src/internal/Type/compose.d.ts.map +1 -0
  200. package/dist/types/src/internal/Type/compose.test.d.ts.map +1 -0
  201. package/dist/types/src/internal/{schema → Type}/echo-schema.d.ts +8 -7
  202. package/dist/types/src/internal/Type/echo-schema.d.ts.map +1 -0
  203. package/dist/types/src/internal/Type/index.d.ts.map +1 -0
  204. package/dist/types/src/internal/Type/manipulation.d.ts.map +1 -0
  205. package/dist/types/src/internal/{schema → Type}/persistent-schema.d.ts +2 -2
  206. package/dist/types/src/internal/Type/persistent-schema.d.ts.map +1 -0
  207. package/dist/types/src/internal/{api → common/api}/index.d.ts +0 -4
  208. package/dist/types/src/internal/common/api/index.d.ts.map +1 -0
  209. package/dist/types/src/internal/common/api/meta.d.ts.map +1 -0
  210. package/dist/types/src/internal/common/index.d.ts +4 -0
  211. package/dist/types/src/internal/common/index.d.ts.map +1 -0
  212. package/dist/types/src/internal/common/proxy/change-context.d.ts.map +1 -0
  213. package/dist/types/src/internal/common/proxy/change.test.d.ts.map +1 -0
  214. package/dist/types/src/internal/common/proxy/define-hidden-property.d.ts.map +1 -0
  215. package/dist/types/src/internal/common/proxy/errors.d.ts.map +1 -0
  216. package/dist/types/src/internal/common/proxy/event-batch.d.ts.map +1 -0
  217. package/dist/types/src/internal/common/proxy/handler.test.d.ts.map +1 -0
  218. package/dist/types/src/internal/common/proxy/index.d.ts.map +1 -0
  219. package/dist/types/src/internal/common/proxy/json-serializer.d.ts.map +1 -0
  220. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -0
  221. package/dist/types/src/internal/common/proxy/ownership.d.ts.map +1 -0
  222. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -0
  223. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -0
  224. package/dist/types/src/internal/common/proxy/reactive-array.d.ts.map +1 -0
  225. package/dist/types/src/internal/{proxy → common/proxy}/reactive.d.ts +1 -1
  226. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -0
  227. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -0
  228. package/dist/types/src/internal/common/proxy/schema.test.d.ts.map +1 -0
  229. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -0
  230. package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.d.ts +2 -1
  231. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -0
  232. package/dist/types/src/internal/common/proxy/typed-handler.test.d.ts.map +1 -0
  233. package/dist/types/src/internal/common/proxy/typed-object.test.d.ts.map +1 -0
  234. package/dist/types/src/internal/{types → common/types}/base.d.ts +1 -0
  235. package/dist/types/src/internal/common/types/base.d.ts.map +1 -0
  236. package/dist/types/src/internal/{types → common/types}/entity.d.ts +2 -2
  237. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -0
  238. package/dist/types/src/internal/{types → common/types}/index.d.ts +1 -0
  239. package/dist/types/src/internal/common/types/index.d.ts.map +1 -0
  240. package/dist/types/src/internal/{types → common/types}/meta.d.ts +2 -1
  241. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -0
  242. package/dist/types/src/internal/common/types/model-symbols.d.ts +54 -0
  243. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -0
  244. package/dist/types/src/internal/{types → common/types}/typename.d.ts +8 -0
  245. package/dist/types/src/internal/common/types/typename.d.ts.map +1 -0
  246. package/dist/types/src/internal/{types → common/types}/version.d.ts +2 -2
  247. package/dist/types/src/internal/common/types/version.d.ts.map +1 -0
  248. package/dist/types/src/internal/index.d.ts +8 -10
  249. package/dist/types/src/internal/index.d.ts.map +1 -1
  250. package/dist/types/src/testing/test-schema.d.ts +19 -18
  251. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  252. package/dist/types/tsconfig.tsbuildinfo +1 -1
  253. package/package.json +24 -14
  254. package/src/Annotation.ts +31 -1
  255. package/src/Collection.ts +37 -0
  256. package/src/Database.ts +154 -173
  257. package/src/Dataset.ts +26 -0
  258. package/src/Entity.ts +73 -54
  259. package/src/Err.ts +22 -0
  260. package/src/Extension.test.ts +235 -0
  261. package/src/Extension.ts +122 -0
  262. package/src/Feed.ts +267 -0
  263. package/src/Filter.test.ts +90 -0
  264. package/src/Filter.ts +47 -4
  265. package/src/Format.ts +3 -3
  266. package/src/Hypergraph.ts +9 -4
  267. package/src/JsonSchema.ts +14 -4
  268. package/src/Obj.test.ts +69 -8
  269. package/src/Obj.ts +285 -140
  270. package/src/Order.ts +3 -1
  271. package/src/Query.test.ts +190 -15
  272. package/src/Query.ts +249 -23
  273. package/src/Ref.ts +64 -11
  274. package/src/Relation.test.ts +8 -2
  275. package/src/Relation.ts +165 -131
  276. package/src/SchemaRegistry.ts +5 -4
  277. package/src/Tag.ts +6 -5
  278. package/src/Type.test.ts +10 -10
  279. package/src/Type.ts +70 -303
  280. package/src/View.ts +107 -0
  281. package/src/hierarchy.test.ts +33 -0
  282. package/src/index.ts +5 -0
  283. package/src/internal/{annotations → Annotation}/annotations.test.ts +56 -6
  284. package/src/internal/{annotations → Annotation}/annotations.ts +128 -10
  285. package/src/internal/{annotations → Annotation}/index.ts +1 -0
  286. package/src/internal/{api → Annotation}/sorting.ts +2 -3
  287. package/src/internal/{annotations → Annotation}/util.ts +14 -1
  288. package/src/internal/{api/entity.ts → Entity/api.ts} +4 -2
  289. package/src/internal/{entities → Entity}/entity.ts +6 -4
  290. package/src/internal/{entities → Entity}/index.ts +2 -0
  291. package/src/internal/{entities → Entity}/model.ts +17 -42
  292. package/src/internal/{entities → Entity}/object.ts +2 -2
  293. package/src/internal/{entities → Entity}/relation.ts +19 -36
  294. package/src/internal/{api → Entity}/version.ts +3 -2
  295. package/src/internal/{formats → Format}/date.test.ts +1 -1
  296. package/src/internal/{formats → Format}/format.test.ts +1 -1
  297. package/src/internal/{formats → Format}/types.ts +3 -3
  298. package/src/internal/{json-schema → JsonSchema}/annotations.ts +3 -3
  299. package/src/internal/{json-schema → JsonSchema}/json-schema-type.ts +4 -4
  300. package/src/internal/{json-schema → JsonSchema}/json-schema.test.ts +48 -48
  301. package/src/internal/{json-schema → JsonSchema}/json-schema.ts +6 -4
  302. package/src/internal/{object → Obj}/clone.ts +3 -3
  303. package/src/internal/{object → Obj}/common.ts +2 -2
  304. package/src/internal/{object → Obj}/create-object.test.ts +4 -4
  305. package/src/internal/{object → Obj}/create-object.ts +5 -5
  306. package/src/internal/{object → Obj}/deleted.ts +2 -2
  307. package/src/internal/{object → Obj}/inspect.ts +2 -2
  308. package/src/internal/{object → Obj}/json-serializer.test.ts +31 -8
  309. package/src/internal/{object → Obj}/json-serializer.ts +42 -15
  310. package/src/internal/{object → Obj}/schema-validator.ts +1 -1
  311. package/src/internal/{object → Obj}/set-value.test.ts +24 -24
  312. package/src/internal/{object → Obj}/set-value.ts +2 -2
  313. package/src/internal/Obj/snapshot.ts +105 -0
  314. package/src/internal/{object → Obj}/typed-object.test.ts +3 -3
  315. package/src/internal/{object → Obj}/typed-object.ts +4 -4
  316. package/src/internal/{ref → Ref}/ref-array.ts +1 -1
  317. package/src/internal/{ref → Ref}/ref.test.ts +4 -4
  318. package/src/internal/{ref → Ref}/ref.ts +27 -4
  319. package/src/internal/{schema → Type}/compose.test.ts +5 -5
  320. package/src/internal/{schema → Type}/compose.ts +1 -1
  321. package/src/internal/{schema → Type}/echo-schema.ts +11 -10
  322. package/src/internal/{schema → Type}/manipulation.ts +1 -1
  323. package/src/internal/{schema → Type}/persistent-schema.ts +10 -4
  324. package/src/internal/{README.md → common/README.md} +1 -1
  325. package/src/internal/{api → common/api}/index.ts +0 -4
  326. package/src/internal/common/index.ts +7 -0
  327. package/src/internal/{proxy → common/proxy}/change.test.ts +58 -58
  328. package/src/internal/{proxy → common/proxy}/handler.test.ts +2 -2
  329. package/src/internal/{proxy → common/proxy}/json-serializer.ts +6 -3
  330. package/src/internal/{proxy → common/proxy}/make-object.ts +13 -3
  331. package/src/internal/{proxy → common/proxy}/reactive.ts +1 -1
  332. package/src/internal/{proxy → common/proxy}/schema.test.ts +10 -10
  333. package/src/internal/{proxy → common/proxy}/typed-handler.test.ts +6 -6
  334. package/src/internal/{proxy → common/proxy}/typed-handler.ts +10 -3
  335. package/src/internal/{proxy → common/proxy}/typed-object.test.ts +4 -4
  336. package/src/internal/{types → common/types}/base.ts +1 -1
  337. package/src/internal/{types → common/types}/entity.ts +2 -2
  338. package/src/internal/{types → common/types}/index.ts +1 -0
  339. package/src/internal/{types → common/types}/meta.ts +4 -1
  340. package/src/internal/common/types/model-symbols.ts +69 -0
  341. package/src/internal/{types → common/types}/typename.ts +10 -0
  342. package/src/internal/{types → common/types}/version.ts +2 -3
  343. package/src/internal/index.ts +8 -31
  344. package/src/testing/api.test.ts +4 -4
  345. package/src/testing/test-schema.ts +20 -18
  346. package/dist/lib/neutral/chunk-2MTHJ5UW.mjs.map +0 -7
  347. package/dist/lib/neutral/chunk-3ZEAZF7T.mjs.map +0 -7
  348. package/dist/lib/neutral/chunk-62DWJ6CE.mjs.map +0 -7
  349. package/dist/lib/neutral/chunk-6QPSGMEF.mjs.map +0 -7
  350. package/dist/lib/neutral/chunk-CUDIBUM4.mjs.map +0 -7
  351. package/dist/lib/neutral/chunk-HMOXCO27.mjs.map +0 -7
  352. package/dist/lib/neutral/chunk-IP2GHXWA.mjs.map +0 -7
  353. package/dist/lib/neutral/chunk-KRHDMXSU.mjs +0 -132
  354. package/dist/lib/neutral/chunk-KRHDMXSU.mjs.map +0 -7
  355. package/dist/lib/neutral/chunk-NWUO5FKZ.mjs.map +0 -7
  356. package/dist/lib/neutral/chunk-ROKO4RKJ.mjs.map +0 -7
  357. package/dist/lib/neutral/chunk-RPB6V4BE.mjs.map +0 -7
  358. package/dist/lib/neutral/chunk-SU2LVM7J.mjs.map +0 -7
  359. package/dist/lib/neutral/chunk-VB5HVDCA.mjs.map +0 -7
  360. package/dist/lib/neutral/chunk-VR4A4WGG.mjs.map +0 -7
  361. package/dist/lib/neutral/chunk-X2MPMYYN.mjs +0 -13
  362. package/dist/lib/neutral/chunk-X2MPMYYN.mjs.map +0 -7
  363. package/dist/lib/neutral/chunk-XK5OUUBY.mjs +0 -157
  364. package/dist/lib/neutral/chunk-XK5OUUBY.mjs.map +0 -7
  365. package/dist/lib/neutral/chunk-XMIDBDE6.mjs.map +0 -7
  366. package/dist/lib/neutral/chunk-YQYMWZAD.mjs.map +0 -7
  367. package/dist/types/src/internal/annotations/annotations.d.ts.map +0 -1
  368. package/dist/types/src/internal/annotations/annotations.test.d.ts.map +0 -1
  369. package/dist/types/src/internal/annotations/index.d.ts +0 -3
  370. package/dist/types/src/internal/annotations/index.d.ts.map +0 -1
  371. package/dist/types/src/internal/annotations/util.d.ts.map +0 -1
  372. package/dist/types/src/internal/api/annotations.d.ts +0 -23
  373. package/dist/types/src/internal/api/annotations.d.ts.map +0 -1
  374. package/dist/types/src/internal/api/entity.d.ts.map +0 -1
  375. package/dist/types/src/internal/api/index.d.ts.map +0 -1
  376. package/dist/types/src/internal/api/meta.d.ts.map +0 -1
  377. package/dist/types/src/internal/api/sorting.d.ts.map +0 -1
  378. package/dist/types/src/internal/api/version.d.ts.map +0 -1
  379. package/dist/types/src/internal/entities/entity.d.ts.map +0 -1
  380. package/dist/types/src/internal/entities/index.d.ts.map +0 -1
  381. package/dist/types/src/internal/entities/model.d.ts.map +0 -1
  382. package/dist/types/src/internal/entities/object.d.ts.map +0 -1
  383. package/dist/types/src/internal/entities/relation.d.ts.map +0 -1
  384. package/dist/types/src/internal/entities/util.d.ts.map +0 -1
  385. package/dist/types/src/internal/formats/date.d.ts.map +0 -1
  386. package/dist/types/src/internal/formats/date.test.d.ts.map +0 -1
  387. package/dist/types/src/internal/formats/format.d.ts.map +0 -1
  388. package/dist/types/src/internal/formats/format.test.d.ts.map +0 -1
  389. package/dist/types/src/internal/formats/index.d.ts.map +0 -1
  390. package/dist/types/src/internal/formats/number.d.ts.map +0 -1
  391. package/dist/types/src/internal/formats/object.d.ts.map +0 -1
  392. package/dist/types/src/internal/formats/select.d.ts.map +0 -1
  393. package/dist/types/src/internal/formats/string.d.ts.map +0 -1
  394. package/dist/types/src/internal/formats/types.d.ts.map +0 -1
  395. package/dist/types/src/internal/json-schema/annotations.d.ts.map +0 -1
  396. package/dist/types/src/internal/json-schema/effect-schema.test.d.ts.map +0 -1
  397. package/dist/types/src/internal/json-schema/index.d.ts.map +0 -1
  398. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +0 -1
  399. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +0 -1
  400. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +0 -1
  401. package/dist/types/src/internal/json-schema/json-schema.test.d.ts.map +0 -1
  402. package/dist/types/src/internal/object/clone.d.ts.map +0 -1
  403. package/dist/types/src/internal/object/common.d.ts.map +0 -1
  404. package/dist/types/src/internal/object/create-object.d.ts.map +0 -1
  405. package/dist/types/src/internal/object/create-object.test.d.ts.map +0 -1
  406. package/dist/types/src/internal/object/deleted.d.ts.map +0 -1
  407. package/dist/types/src/internal/object/ids.d.ts.map +0 -1
  408. package/dist/types/src/internal/object/index.d.ts.map +0 -1
  409. package/dist/types/src/internal/object/inspect.d.ts.map +0 -1
  410. package/dist/types/src/internal/object/json-serializer.d.ts.map +0 -1
  411. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +0 -1
  412. package/dist/types/src/internal/object/schema-validator.d.ts +0 -2
  413. package/dist/types/src/internal/object/schema-validator.d.ts.map +0 -1
  414. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +0 -1
  415. package/dist/types/src/internal/object/set-value.d.ts.map +0 -1
  416. package/dist/types/src/internal/object/set-value.test.d.ts.map +0 -1
  417. package/dist/types/src/internal/object/snapshot.d.ts.map +0 -1
  418. package/dist/types/src/internal/object/typed-object.d.ts.map +0 -1
  419. package/dist/types/src/internal/object/typed-object.test.d.ts.map +0 -1
  420. package/dist/types/src/internal/proxy/change-context.d.ts.map +0 -1
  421. package/dist/types/src/internal/proxy/change.test.d.ts.map +0 -1
  422. package/dist/types/src/internal/proxy/define-hidden-property.d.ts.map +0 -1
  423. package/dist/types/src/internal/proxy/errors.d.ts.map +0 -1
  424. package/dist/types/src/internal/proxy/event-batch.d.ts.map +0 -1
  425. package/dist/types/src/internal/proxy/handler.test.d.ts.map +0 -1
  426. package/dist/types/src/internal/proxy/index.d.ts.map +0 -1
  427. package/dist/types/src/internal/proxy/json-serializer.d.ts.map +0 -1
  428. package/dist/types/src/internal/proxy/make-object.d.ts.map +0 -1
  429. package/dist/types/src/internal/proxy/ownership.d.ts.map +0 -1
  430. package/dist/types/src/internal/proxy/proxy-types.d.ts.map +0 -1
  431. package/dist/types/src/internal/proxy/proxy-utils.d.ts.map +0 -1
  432. package/dist/types/src/internal/proxy/reactive-array.d.ts.map +0 -1
  433. package/dist/types/src/internal/proxy/reactive.d.ts.map +0 -1
  434. package/dist/types/src/internal/proxy/schema-validator.d.ts.map +0 -1
  435. package/dist/types/src/internal/proxy/schema.test.d.ts.map +0 -1
  436. package/dist/types/src/internal/proxy/symbols.d.ts.map +0 -1
  437. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +0 -1
  438. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +0 -1
  439. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +0 -1
  440. package/dist/types/src/internal/ref/index.d.ts.map +0 -1
  441. package/dist/types/src/internal/ref/ref-array.d.ts.map +0 -1
  442. package/dist/types/src/internal/ref/ref.d.ts.map +0 -1
  443. package/dist/types/src/internal/ref/ref.test.d.ts.map +0 -1
  444. package/dist/types/src/internal/schema/compose.d.ts.map +0 -1
  445. package/dist/types/src/internal/schema/compose.test.d.ts.map +0 -1
  446. package/dist/types/src/internal/schema/echo-schema.d.ts.map +0 -1
  447. package/dist/types/src/internal/schema/index.d.ts.map +0 -1
  448. package/dist/types/src/internal/schema/manipulation.d.ts.map +0 -1
  449. package/dist/types/src/internal/schema/persistent-schema.d.ts.map +0 -1
  450. package/dist/types/src/internal/types/base.d.ts.map +0 -1
  451. package/dist/types/src/internal/types/entity.d.ts.map +0 -1
  452. package/dist/types/src/internal/types/index.d.ts.map +0 -1
  453. package/dist/types/src/internal/types/meta.d.ts.map +0 -1
  454. package/dist/types/src/internal/types/typename.d.ts.map +0 -1
  455. package/dist/types/src/internal/types/version.d.ts.map +0 -1
  456. package/src/internal/api/annotations.ts +0 -60
  457. package/src/internal/object/snapshot.ts +0 -70
  458. /package/dist/types/src/internal/{annotations → Annotation}/annotations.test.d.ts +0 -0
  459. /package/dist/types/src/internal/{entities → Entity}/util.d.ts +0 -0
  460. /package/dist/types/src/internal/{formats → Format}/date.d.ts +0 -0
  461. /package/dist/types/src/internal/{formats → Format}/date.test.d.ts +0 -0
  462. /package/dist/types/src/internal/{formats → Format}/format.d.ts +0 -0
  463. /package/dist/types/src/internal/{formats → Format}/format.test.d.ts +0 -0
  464. /package/dist/types/src/internal/{formats → Format}/index.d.ts +0 -0
  465. /package/dist/types/src/internal/{formats → Format}/number.d.ts +0 -0
  466. /package/dist/types/src/internal/{formats → Format}/object.d.ts +0 -0
  467. /package/dist/types/src/internal/{formats → Format}/select.d.ts +0 -0
  468. /package/dist/types/src/internal/{formats → Format}/string.d.ts +0 -0
  469. /package/dist/types/src/internal/{json-schema → JsonSchema}/effect-schema.test.d.ts +0 -0
  470. /package/dist/types/src/internal/{json-schema → JsonSchema}/index.d.ts +0 -0
  471. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema-normalize.d.ts +0 -0
  472. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.d.ts +0 -0
  473. /package/dist/types/src/internal/{json-schema → JsonSchema}/json-schema.test.d.ts +0 -0
  474. /package/dist/types/src/internal/{object → Obj}/clone.d.ts +0 -0
  475. /package/dist/types/src/internal/{object → Obj}/common.d.ts +0 -0
  476. /package/dist/types/src/internal/{object → Obj}/create-object.test.d.ts +0 -0
  477. /package/dist/types/src/internal/{object → Obj}/ids.d.ts +0 -0
  478. /package/dist/types/src/internal/{object → Obj}/index.d.ts +0 -0
  479. /package/dist/types/src/internal/{object → Obj}/inspect.d.ts +0 -0
  480. /package/dist/types/src/internal/{object → Obj}/json-serializer.test.d.ts +0 -0
  481. /package/dist/types/src/internal/{object → Obj}/schema-validator.test.d.ts +0 -0
  482. /package/dist/types/src/internal/{object → Obj}/set-value.test.d.ts +0 -0
  483. /package/dist/types/src/internal/{object → Obj}/snapshot.d.ts +0 -0
  484. /package/dist/types/src/internal/{object → Obj}/typed-object.test.d.ts +0 -0
  485. /package/dist/types/src/internal/{ref → Ref}/index.d.ts +0 -0
  486. /package/dist/types/src/internal/{ref → Ref}/ref.test.d.ts +0 -0
  487. /package/dist/types/src/internal/{schema → Type}/compose.test.d.ts +0 -0
  488. /package/dist/types/src/internal/{schema → Type}/index.d.ts +0 -0
  489. /package/dist/types/src/internal/{schema → Type}/manipulation.d.ts +0 -0
  490. /package/dist/types/src/internal/{api → common/api}/meta.d.ts +0 -0
  491. /package/dist/types/src/internal/{proxy → common/proxy}/change-context.d.ts +0 -0
  492. /package/dist/types/src/internal/{proxy → common/proxy}/change.test.d.ts +0 -0
  493. /package/dist/types/src/internal/{proxy → common/proxy}/define-hidden-property.d.ts +0 -0
  494. /package/dist/types/src/internal/{proxy → common/proxy}/errors.d.ts +0 -0
  495. /package/dist/types/src/internal/{proxy → common/proxy}/event-batch.d.ts +0 -0
  496. /package/dist/types/src/internal/{proxy → common/proxy}/handler.test.d.ts +0 -0
  497. /package/dist/types/src/internal/{proxy → common/proxy}/index.d.ts +0 -0
  498. /package/dist/types/src/internal/{proxy → common/proxy}/json-serializer.d.ts +0 -0
  499. /package/dist/types/src/internal/{proxy → common/proxy}/make-object.d.ts +0 -0
  500. /package/dist/types/src/internal/{proxy → common/proxy}/ownership.d.ts +0 -0
  501. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-types.d.ts +0 -0
  502. /package/dist/types/src/internal/{proxy → common/proxy}/proxy-utils.d.ts +0 -0
  503. /package/dist/types/src/internal/{proxy → common/proxy}/reactive-array.d.ts +0 -0
  504. /package/dist/types/src/internal/{proxy → common/proxy}/schema-validator.d.ts +0 -0
  505. /package/dist/types/src/internal/{proxy → common/proxy}/schema.test.d.ts +0 -0
  506. /package/dist/types/src/internal/{proxy → common/proxy}/symbols.d.ts +0 -0
  507. /package/dist/types/src/internal/{proxy → common/proxy}/typed-handler.test.d.ts +0 -0
  508. /package/dist/types/src/internal/{proxy → common/proxy}/typed-object.test.d.ts +0 -0
  509. /package/src/internal/{entities → Entity}/util.ts +0 -0
  510. /package/src/internal/{formats → Format}/date.ts +0 -0
  511. /package/src/internal/{formats → Format}/format.ts +0 -0
  512. /package/src/internal/{formats → Format}/index.ts +0 -0
  513. /package/src/internal/{formats → Format}/number.ts +0 -0
  514. /package/src/internal/{formats → Format}/object.ts +0 -0
  515. /package/src/internal/{formats → Format}/select.ts +0 -0
  516. /package/src/internal/{formats → Format}/string.ts +0 -0
  517. /package/src/internal/{json-schema → JsonSchema}/effect-schema.test.ts +0 -0
  518. /package/src/internal/{json-schema → JsonSchema}/index.ts +0 -0
  519. /package/src/internal/{json-schema → JsonSchema}/json-schema-normalize.ts +0 -0
  520. /package/src/internal/{object → Obj}/ids.ts +0 -0
  521. /package/src/internal/{object → Obj}/index.ts +0 -0
  522. /package/src/internal/{object → Obj}/schema-validator.test.ts +0 -0
  523. /package/src/internal/{ref → Ref}/index.ts +0 -0
  524. /package/src/internal/{schema → Type}/index.ts +0 -0
  525. /package/src/internal/{api → common/api}/meta.ts +0 -0
  526. /package/src/internal/{proxy → common/proxy}/change-context.ts +0 -0
  527. /package/src/internal/{proxy → common/proxy}/define-hidden-property.ts +0 -0
  528. /package/src/internal/{proxy → common/proxy}/errors.ts +0 -0
  529. /package/src/internal/{proxy → common/proxy}/event-batch.ts +0 -0
  530. /package/src/internal/{proxy → common/proxy}/index.ts +0 -0
  531. /package/src/internal/{proxy → common/proxy}/ownership.ts +0 -0
  532. /package/src/internal/{proxy → common/proxy}/proxy-types.ts +0 -0
  533. /package/src/internal/{proxy → common/proxy}/proxy-utils.ts +0 -0
  534. /package/src/internal/{proxy → common/proxy}/reactive-array.ts +0 -0
  535. /package/src/internal/{proxy → common/proxy}/schema-validator.ts +0 -0
  536. /package/src/internal/{proxy → common/proxy}/symbols.ts +0 -0
@@ -8,6 +8,8 @@ import { ForeignKey } from '@dxos/echo-protocol';
8
8
  import { invariant } from '@dxos/invariant';
9
9
  import { type Comparator, intersection } from '@dxos/util';
10
10
 
11
+ import type * as Entity from '../../../Entity';
12
+
11
13
  import { type AnyProperties } from './base';
12
14
 
13
15
  /**
@@ -18,7 +20,7 @@ export const ATTR_META = '@meta';
18
20
  /**
19
21
  * Metadata section.
20
22
  */
21
- export const MetaId = Symbol.for('@dxos/echo/Meta');
23
+ export const MetaId: Entity.Meta = Symbol.for('@dxos/echo/Meta') as any;
22
24
 
23
25
  //
24
26
  // ObjectMeta
@@ -35,6 +37,7 @@ export const ObjectMetaSchema = Schema.Struct({
35
37
  */
36
38
  // TODO(dmaretskyi): Has to be optional for compatibility with old data.
37
39
  // Defaulting to an empty array is possible but requires a bit more work.
40
+ // TODO(dmaretskyi): In automerge this should be a map of { [tag]: boolean } for uniqueness and conflict resolution.
38
41
  tags: Schema.optional(Schema.Array(Schema.String)),
39
42
  });
40
43
 
@@ -0,0 +1,69 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ /**
6
+ * Internal symbol/string constants for the echo object model.
7
+ * Defined in common/ so proxy/ can use them without importing from Entity/.
8
+ * Entity/ re-exports these for external consumers.
9
+ */
10
+
11
+ /**
12
+ * Property name for self DXN when object is serialized to JSON.
13
+ */
14
+ export const ATTR_SELF_DXN = '@dxn';
15
+
16
+ /**
17
+ * DXN to the object itself.
18
+ */
19
+ export const SelfDXNId = Symbol.for('@dxos/echo/DXN');
20
+
21
+ /**
22
+ * Property name for deleted when object is serialized to JSON.
23
+ */
24
+ export const ATTR_DELETED = '@deleted';
25
+
26
+ /**
27
+ * Deletion marker.
28
+ */
29
+ export const ObjectDeletedId = Symbol.for('@dxos/echo/Deleted');
30
+
31
+ /**
32
+ * Object version accessor symbol.
33
+ */
34
+ export const ObjectVersionId: unique symbol = Symbol.for('@dxos/echo/Version');
35
+
36
+ /**
37
+ * Object database accessor symbol.
38
+ */
39
+ export const ObjectDatabaseId = Symbol.for('@dxos/echo/Database');
40
+
41
+ /**
42
+ * Property name for relation source when object is serialized to JSON.
43
+ */
44
+ export const ATTR_RELATION_SOURCE = '@relationSource';
45
+
46
+ /**
47
+ * Used to access relation source ref on live ECHO objects.
48
+ */
49
+ export const RelationSourceId: unique symbol = Symbol.for('@dxos/echo/RelationSource');
50
+
51
+ /**
52
+ * Used to access relation source DXN on live ECHO objects.
53
+ */
54
+ export const RelationSourceDXNId: unique symbol = Symbol.for('@dxos/echo/RelationSourceDXN');
55
+
56
+ /**
57
+ * Property name for relation target when object is serialized to JSON.
58
+ */
59
+ export const ATTR_RELATION_TARGET = '@relationTarget';
60
+
61
+ /**
62
+ * Used to access relation target ref on live ECHO objects.
63
+ */
64
+ export const RelationTargetId: unique symbol = Symbol.for('@dxos/echo/RelationTarget');
65
+
66
+ /**
67
+ * Used to access relation target DXN on live ECHO objects.
68
+ */
69
+ export const RelationTargetDXNId: unique symbol = Symbol.for('@dxos/echo/RelationTargetDXN');
@@ -19,6 +19,16 @@ export const TypeId = Symbol.for('@dxos/echo/Type');
19
19
  */
20
20
  export const SchemaId = Symbol.for('@dxos/echo/Schema');
21
21
 
22
+ /**
23
+ * Property name for parent when object is serialized to JSON.
24
+ */
25
+ export const ATTR_PARENT = '@parent';
26
+
27
+ /**
28
+ * Reference to the object parent.
29
+ */
30
+ export const ParentId = Symbol.for('@dxos/echo/Parent');
31
+
22
32
  /**
23
33
  * Returns the schema for the given object if one is defined.
24
34
  *
@@ -3,10 +3,9 @@
3
3
  //
4
4
 
5
5
  /**
6
- * Version type symbol.
6
+ * Version type identifier.
7
7
  */
8
- export const VersionTypeId: unique symbol = Symbol.for('@dxos/echo/VersionTypeId');
9
-
8
+ export const VersionTypeId = '~@dxos/echo/VersionTypeId' as const;
10
9
  export type VersionTypeId = typeof VersionTypeId;
11
10
 
12
11
  /**
@@ -5,35 +5,12 @@
5
5
  // TODO(burdon): Import directly (not part of ECHO API).
6
6
  export { JsonPath, JsonProp, getValue, splitJsonPath } from '@dxos/effect';
7
7
 
8
- export * from './annotations';
9
- export * from './api';
10
- export * from './entities';
11
- export * from './formats';
12
- export * from './json-schema';
13
- export * from './ref';
14
- export * from './types';
15
-
8
+ export * from './Annotation';
9
+ export * from './common';
10
+ export * from './Entity';
11
+ export * from './Format';
12
+ export * from './JsonSchema';
16
13
  // TODO(wittjosiah): Required to ensure types are portable (need to export all types required for downstream inference).
17
- export * from './object';
18
- export * from './proxy';
19
- export * from './schema';
20
-
21
- // export {
22
- // createObject,
23
- // createQueueDXN,
24
- // isDeleted,
25
- // objectFromJSON,
26
- // objectToJSON,
27
- // setRefResolverOnData,
28
- // SchemaValidator,
29
- // TypedObject,
30
- // } from './object';
31
- // export { makeObject } from './proxy';
32
- // export {
33
- // type BaseSchema,
34
- // EchoSchema,
35
- // ImmutableSchema,
36
- // RuntimeSchemaRegistry,
37
- // PersistentSchema,
38
- // isMutable,
39
- // } from './schema';
14
+ export * from './Obj';
15
+ export * from './Ref';
16
+ export * from './Type';
@@ -17,11 +17,11 @@ describe('Experimental API review', () => {
17
17
  const schema = Obj.getSchema(contact) ?? raise(new Error('No schema found'));
18
18
 
19
19
  expect(Type.getDXN(schema)?.typename).to.eq(TestSchema.Person.typename);
20
- expect(Type.getTypename(schema)).to.eq('example.com/type/Person');
20
+ expect(Type.getTypename(schema)).to.eq('com.example.type.person');
21
21
  expect(Type.getVersion(schema)).to.eq('0.1.0');
22
22
  expect(Type.getMeta(schema)).to.deep.eq({
23
23
  kind: Entity.Kind.Object,
24
- typename: 'example.com/type/Person',
24
+ typename: 'com.example.type.person',
25
25
  version: '0.1.0',
26
26
  });
27
27
  });
@@ -110,7 +110,7 @@ describe('Experimental API review', () => {
110
110
  expect(expando.content).to.eq('Test');
111
111
 
112
112
  // This should work: assign to Obj.Obj of the schema's instance type
113
- const _typed: Obj.Obj<TestSchema.Expando> = expando;
113
+ const _typed: Obj.OfShape<TestSchema.Expando> = expando;
114
114
  }
115
115
 
116
116
  {
@@ -119,7 +119,7 @@ describe('Experimental API review', () => {
119
119
  expect(person.name).to.eq('Test');
120
120
 
121
121
  // This should work: assign to Obj.Obj of the schema's instance type
122
- const _typed: Obj.Obj<TestSchema.Person> = person;
122
+ const _typed: Obj.OfShape<TestSchema.Person> = person;
123
123
  }
124
124
  });
125
125
  });
@@ -4,6 +4,8 @@
4
4
 
5
5
  import * as Schema from 'effect/Schema';
6
6
 
7
+ import * as Obj from '../Obj';
8
+ import * as Ref from '../Ref';
7
9
  import * as Type from '../Type';
8
10
 
9
11
  export namespace TestSchema {
@@ -17,7 +19,7 @@ export namespace TestSchema {
17
19
  */
18
20
  export const Expando = Schema.Struct({}, { key: Schema.String, value: Schema.Any }).pipe(
19
21
  Type.object({
20
- typename: 'example.com/type/Expando',
22
+ typename: 'com.example.type.expando',
21
23
  version: '0.1.0',
22
24
  }),
23
25
  );
@@ -51,8 +53,8 @@ export namespace TestSchema {
51
53
  nested: Nested,
52
54
  nestedArray: Schema.Array(Nested),
53
55
  nestedNullableArray: Schema.Array(Schema.Union(Nested, Schema.Null)),
54
- reference: Schema.suspend((): Type.Ref<Example> => Type.Ref(Example)),
55
- referenceArray: Schema.Array(Schema.suspend((): Type.Ref<Example> => Type.Ref(Example))),
56
+ reference: Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example)),
57
+ referenceArray: Schema.Array(Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example))),
56
58
  classInstance: Schema.instanceOf(TestClass),
57
59
  other: Schema.Any,
58
60
  }).pipe(Schema.partial);
@@ -63,7 +65,7 @@ export namespace TestSchema {
63
65
  /** @deprecated Use another test schema or create a specific local test schema. */
64
66
  export const Example = ExampleSchema.pipe(
65
67
  Type.object({
66
- typename: 'example.com/type/Example',
68
+ typename: 'com.example.type.example',
67
69
  version: '0.1.0',
68
70
  }),
69
71
  );
@@ -87,7 +89,7 @@ export namespace TestSchema {
87
89
 
88
90
  export const Message = MessageStruct.pipe(
89
91
  Type.object({
90
- typename: 'example.com/type/Message',
92
+ typename: 'com.example.type.message',
91
93
  version: '0.1.0',
92
94
  }),
93
95
  );
@@ -108,7 +110,7 @@ export namespace TestSchema {
108
110
  ),
109
111
  }).pipe(
110
112
  Type.object({
111
- typename: 'example.com/type/Organization',
113
+ typename: 'com.example.type.organization',
112
114
  version: '0.1.0',
113
115
  }),
114
116
  );
@@ -124,8 +126,8 @@ export namespace TestSchema {
124
126
  username: Schema.String,
125
127
  email: Schema.String,
126
128
  age: Schema.Number.pipe(Schema.optional),
127
- tasks: Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))),
128
- employer: Schema.optional(Type.Ref(Organization)),
129
+ tasks: Schema.Array(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task))),
130
+ employer: Schema.optional(Ref.Ref(Organization)),
129
131
  address: Schema.Struct({
130
132
  city: Schema.optional(Schema.String),
131
133
  state: Schema.optional(Schema.String),
@@ -142,7 +144,7 @@ export namespace TestSchema {
142
144
  }).pipe(
143
145
  Schema.partial,
144
146
  Type.object({
145
- typename: 'example.com/type/Person',
147
+ typename: 'com.example.type.person',
146
148
  version: '0.1.0',
147
149
  }),
148
150
  );
@@ -157,14 +159,14 @@ export namespace TestSchema {
157
159
  title: Schema.optional(Schema.String),
158
160
  deadline: Schema.optional(Schema.String),
159
161
  completed: Schema.optional(Schema.Boolean),
160
- assignee: Schema.optional(Type.Ref(Person)),
161
- previous: Schema.optional(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task))),
162
- subTasks: Schema.optional(Schema.Array(Schema.suspend((): Type.Ref<Task> => Type.Ref(Task)))),
162
+ assignee: Schema.optional(Ref.Ref(Person)),
163
+ previous: Schema.optional(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task))),
164
+ subTasks: Schema.optional(Schema.Array(Schema.suspend((): Ref.RefSchema<Task> => Ref.Ref(Task)))),
163
165
  description: Schema.optional(Schema.String),
164
166
  }).pipe(
165
167
  Schema.partial,
166
168
  Type.object({
167
- typename: 'example.com/type/Task',
169
+ typename: 'com.example.type.task',
168
170
  version: '0.1.0',
169
171
  }),
170
172
  );
@@ -177,7 +179,7 @@ export namespace TestSchema {
177
179
 
178
180
  export const HasManager = Schema.Struct({}).pipe(
179
181
  Type.relation({
180
- typename: 'example.com/type/HasManager',
182
+ typename: 'com.example.type.has-manager',
181
183
  version: '0.1.0',
182
184
  source: Person,
183
185
  target: Person,
@@ -195,7 +197,7 @@ export namespace TestSchema {
195
197
  since: Schema.optional(Schema.String),
196
198
  }).pipe(
197
199
  Type.relation({
198
- typename: 'example.com/type/EmployedBy',
200
+ typename: 'com.example.type.employed-by',
199
201
  version: '0.1.0',
200
202
  source: Person,
201
203
  target: Organization,
@@ -215,13 +217,13 @@ export namespace TestSchema {
215
217
  }
216
218
 
217
219
  export const Container = Schema.Struct({
218
- objects: Schema.Array(Type.Ref(Type.Obj)),
220
+ objects: Schema.Array(Ref.Ref(Obj.Unknown)),
219
221
  records: Schema.Array(
220
222
  Schema.partial(
221
223
  Schema.Struct({
222
224
  title: Schema.String,
223
225
  description: Schema.String,
224
- contacts: Schema.Array(Type.Ref(Person)),
226
+ contacts: Schema.Array(Ref.Ref(Person)),
225
227
  type: Schema.Enums(RecordType),
226
228
  }),
227
229
  ),
@@ -229,7 +231,7 @@ export namespace TestSchema {
229
231
  }).pipe(
230
232
  Schema.partial,
231
233
  Type.object({
232
- typename: 'example.com/type/Container',
234
+ typename: 'com.example.type.container',
233
235
  version: '0.1.0',
234
236
  }),
235
237
  );
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Obj.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Function from 'effect/Function';\nimport * as Schema from 'effect/Schema';\n\nimport type { ForeignKey } from '@dxos/echo-protocol';\nimport { createJsonPath, getValue as getValue$ } 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 {\n type ObjectJSON as APIJSON,\n type AnyEntity,\n type AnyProperties,\n type Comparator as ApiComparator,\n type Meta as ApiMeta,\n type ReadonlyMeta as ApiReadonlyMeta,\n type EntityVersion as ApiVersion,\n type ChangeCallback,\n type InternalObjectProps,\n type KindId,\n MetaId,\n type Mutable,\n type ObjectMeta,\n type SnapshotKindId,\n type VersionCompareResult,\n VersionTypeId,\n addTag as addTag$,\n change as change$,\n clone as clone$,\n compareVersions,\n decodeVersion,\n deleteKeys as deleteKeys$,\n encodeVersion,\n getDXN as getDXN$,\n getDatabase as getDatabase$,\n getDescription as getDescription$,\n getKeys as getKeys$,\n getLabel as getLabel$,\n getMetaChecked as getMeta$,\n getSchema as getSchema$,\n getSnapshot as getSnapshot$,\n getTypeAnnotation,\n getTypeDXN as getTypeDXN$,\n getTypename as getTypename$,\n isDeleted as isDeleted$,\n isInstanceOf,\n isVersion,\n makeObject,\n objectFromJSON,\n removeTag as removeTag$,\n setDescription as setDescription$,\n setLabel as setLabel$,\n setValue as setValue$,\n sort as sort$,\n sortByLabel as sortByLabel$,\n sortByTypename as sortByTypename$,\n subscribe as subscribe$,\n objectToJSON as toJSON$,\n version as version$,\n versionValid,\n} 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 AnyEntity, Entity.OfKind<typeof Entity.Kind.Object> {}\n\n/**\n * Object type with specific properties.\n */\nexport type Obj<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 * 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, AnyProperties {}\n\n/**\n * Base type for snapshot objects (has SnapshotKindId instead of KindId).\n */\ninterface BaseSnapshot extends AnyEntity {\n readonly [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, KindId> & BaseSnapshot;\n\nconst defaultMeta: ObjectMeta = {\n keys: [],\n};\n\ntype Props<T = any> = {\n id?: ObjectId;\n [Meta]?: Partial<ObjectMeta>;\n} & Type.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<ObjectMeta>;\n} & NoInfer<Props<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: {\n <S extends Type.Obj.Any>(schema: S, props: MakeProps<S>): Obj<Schema.Schema.Type<S>>;\n /**\n * @deprecated Pass meta as in the example: `Obj.make(Person, { [Obj.Meta]: { keys: [...] }, name: 'John' })`.\n */\n <S extends Type.Obj.Any>(schema: S, props: MakeProps<S>, meta: Partial<ObjectMeta>): Obj<Schema.Schema.Type<S>>;\n} = <S extends Type.Obj.Any>(\n schema: S,\n props: MakeProps<S>,\n meta?: Partial<ObjectMeta>,\n): Obj<Schema.Schema.Type<S>> => {\n assertArgument(getTypeAnnotation(schema)?.kind === Entity.Kind.Object, 'schema', 'Expected an object schema');\n\n // Set default fields on meta on creation.\n if (props[MetaId] != null) {\n meta = { ...structuredClone(defaultMeta), ...props[MetaId] };\n delete props[MetaId];\n }\n\n // Filter undefined values.\n const filterUndefined = Object.fromEntries(Object.entries(props).filter(([_, v]) => v !== undefined));\n\n return 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<InternalObjectProps>(obj);\n return typeof obj === 'object' && obj !== null && obj[Entity.KindId] === 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 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> = getSnapshot$ as any;\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 = 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 };\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: ChangeCallback<T>): void => {\n 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 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 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.Entity.Any>(schema: S): (value: unknown) => value is Schema.Schema.Type<S>;\n <S extends Type.Entity.Any>(schema: S, value: unknown): value is Schema.Schema.Type<S>;\n} = ((...args: [schema: Type.Entity.Any, value: unknown] | [schema: Type.Entity.Any]) => {\n if (args.length === 1) {\n return (entity: unknown) => isInstanceOf(args[0], entity);\n }\n\n return isInstanceOf(args[0], 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 getDXN$(entity);\n};\n\n/**\n * @returns The DXN of the object's type.\n * @example dxn:example.com/type/Person:1.0.0\n */\n// TODO(wittjosiah): Narrow types.\nexport const getTypeDXN: (obj: unknown | undefined) => DXN | undefined = 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.Entity.Any | undefined = getSchema$ as any;\n\n/**\n * @returns The typename of the object's type.\n * Accepts both reactive objects and snapshots.\n * @example `example.com/type/Person`\n */\nexport const getTypename = (entity: Unknown | Snapshot): string | undefined => 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: Unknown | Snapshot): Database.Database | undefined => getDatabase$(entity);\n\n//\n// Meta\n//\n\nexport const Meta: unique symbol = MetaId as any;\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 = ApiReadonlyMeta;\n\n/**\n * Mutable meta type returned by `Obj.getMeta` inside an `Obj.change` callback.\n */\nexport type Meta = ApiMeta;\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 getMeta$(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[] => 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 => 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 => 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 => 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 => 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 => 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 => 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 => 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 setDescription$(entity, description);\n\n//\n// JSON\n//\n\n/**\n * JSON representation of an object.\n */\nexport type JSON = APIJSON;\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 => toJSON$(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 */\nexport const fromJSON: (json: unknown, options?: { refResolver?: Ref.Resolver; dxn?: DXN }) => Promise<Unknown> =\n objectFromJSON as any;\n\n//\n// Sorting\n//\n\n/**\n * Comparator function type for sorting objects.\n * Accepts both reactive objects and snapshots.\n */\nexport type Comparator = ApiComparator<Unknown | Snapshot>;\n\nexport const sortByLabel: Comparator = sortByLabel$ as Comparator;\nexport const sortByTypename: Comparator = sortByTypename$ as Comparator;\nexport const sort = (...comparators: Comparator[]): Comparator => sort$(...comparators) as Comparator;\n\n//\n// Version\n//\n\nexport { VersionTypeId };\nexport type { 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 = ApiVersion;\n\nexport { isVersion, versionValid, compareVersions, encodeVersion, 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 => version$(entity);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;gBAAAA;EAAA,cAAAC;EAAA,aAAAC;EAAA;;oBAAAC;EAAA;;gBAAAC;EAAA,mBAAAC;EAAA,sBAAAC;EAAA,eAAAC;EAAA,gBAAAC;EAAA;mBAAAC;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AACpC,QAA0BqC,gBACvDC,eAAgBtC,QAAQqC,WAAAA;AAiBnB,IAAME,SAAS,CAACvC,WAAqCwC,aAAQxC,MAAAA;AAW7D,IAAMyC,WACXC;AAYK,IAAMC,eAA0BC;AAChC,IAAMC,kBAA6BC;AACnC,IAAMC,QAAO,IAAIC,gBAA0CC,KAAAA,GAASD,WAAAA;AAsBpE,IAAME,WAAU,CAACC,WAAwCC,QAASD,MAAAA;",
6
- "names": ["addTag", "change", "clone", "deleteKeys", "getDXN", "getDatabase", "getDescription", "getKeys", "getLabel", "getSchema", "getSnapshot", "getTypeDXN", "getTypename", "isDeleted", "removeTag", "setDescription", "setLabel", "setValue", "sort", "sortByLabel", "sortByTypename", "subscribe", "version", "Function", "Schema", "createJsonPath", "getValue", "getValue$", "assertArgument", "ObjectId", "assumeType", "defaultMeta", "keys", "make", "schema", "props", "meta", "assertArgument", "getTypeAnnotation", "kind", "Kind", "Object", "MetaId", "structuredClone", "filterUndefined", "fromEntries", "entries", "filter", "_", "v", "undefined", "makeObject", "isObject", "obj", "assumeType", "KindId", "subscribe", "callback", "subscribe$", "getSnapshot", "getSnapshot$", "clone", "clone$", "change", "change$", "getValue", "path", "getValue$", "createJsonPath", "setValue", "setValue$", "ID", "ObjectId", "instanceOf", "args", "length", "entity", "isInstanceOf", "getDXN", "isSchema", "getDXN$", "getTypeDXN", "getTypeDXN$", "getSchema", "getSchema$", "getTypename", "getTypename$", "getDatabase", "getDatabase$", "Meta", "getMeta", "getMeta$", "getKeys", "dual", "source", "getKeys$", "deleteKeys", "deleteKeys$", "addTag", "tag", "addTag$", "removeTag", "removeTag$", "isDeleted", "isDeleted$", "getLabel", "getLabel$", "setLabel", "label", "setLabel$", "getDescription", "getDescription$", "setDescription", "description", "setDescription$", "toJSON", "toJSON$", "fromJSON", "objectFromJSON", "sortByLabel", "sortByLabel$", "sortByTypename", "sortByTypename$", "sort", "comparators", "sort$", "version", "entity", "version$"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/JsonSchema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Schema from 'effect/Schema';\n\nimport { JsonSchemaType } from './internal';\n\nexport { toEffectSchema, toJsonSchema } from './internal';\n\n/**\n * Serializable JsonSchema type definition.\n */\nexport type JsonSchema = JsonSchemaType;\n\nexport const JsonSchema: Schema.Schema<JsonSchemaType> = JsonSchemaType;\n"],
5
- "mappings": ";;;;;;;;;;AAAA;;;;;;AAeO,IAAMA,aAA4CC;",
6
- "names": ["JsonSchema", "JsonSchemaType"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/internal/formats/types.ts", "../../../src/internal/formats/number.ts", "../../../src/internal/formats/object.ts", "../../../src/internal/formats/string.ts", "../../../src/internal/formats/format.ts", "../../../src/internal/formats/date.ts", "../../../src/internal/formats/select.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Function from 'effect/Function';\nimport type * as JSONSchema from 'effect/JSONSchema';\nimport * as Option from 'effect/Option';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { createAnnotationHelper } from '../annotations';\nimport { type JsonSchemaType } from '../json-schema';\n\n// TODO(burdon): Rename PropertyType.\nexport type ScalarType =\n | JSONSchema.JsonSchema7Object\n | JSONSchema.JsonSchema7String\n | JSONSchema.JsonSchema7Number\n | JSONSchema.JsonSchema7Boolean\n | JSONSchema.JsonSchema7Ref;\n\n// TODO(burdon): Rename ValueType and change to disciminated union.\n// export type ValueType = 'array' | 'object' | 'string' | 'number' | 'boolean' | 'ref';\nexport enum TypeEnum {\n Array = 'array', // TODO(burdon): Remove?\n Object = 'object',\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Ref = 'ref',\n}\n\n// TODO(burdon): Ref?\nexport const getTypeEnum = (property: JsonSchemaType): TypeEnum | undefined => {\n switch (property.type) {\n case 'array':\n return TypeEnum.Array;\n case 'object':\n return TypeEnum.Object;\n case 'string':\n return TypeEnum.String;\n case 'number':\n return TypeEnum.Number;\n case 'boolean':\n return TypeEnum.Boolean;\n default:\n return undefined;\n }\n};\n\n/**\n * https://json-schema.org/understanding-json-schema/reference/schema\n * https://json-schema.org/understanding-json-schema/reference/string#built-in-formats\n */\nexport const FormatAnnotationId = Symbol.for('@dxos/schema/annotation/Format');\n\nexport const FormatAnnotation = createAnnotationHelper<TypeFormat>(FormatAnnotationId);\n\n/** @deprecated */\nexport const getFormatAnnotation = (node: SchemaAST.AST): TypeFormat | undefined =>\n Function.pipe(SchemaAST.getAnnotation<TypeFormat>(FormatAnnotationId)(node), Option.getOrUndefined);\n\n// TODO(burdon): Rename Format; Change to discriminated union?\nexport enum TypeFormat {\n None = 'none',\n\n //\n // Scalar\n //\n\n String = 'string',\n Number = 'number',\n Boolean = 'boolean',\n Ref = 'ref',\n\n //\n // { type: 'string' }\n //\n\n DID = 'did', // Users, etc.\n DXN = 'dxn',\n Email = 'email',\n Formula = 'formula', // Spreadsheet formula.\n Hostname = 'hostname',\n JSON = 'json',\n Markdown = 'markdown',\n Regex = 'regex',\n SingleSelect = 'single-select',\n Text = 'text',\n MultiSelect = 'multi-select',\n URL = 'url',\n UUID = 'uuid',\n\n //\n // { type: 'number' }\n //\n\n Currency = 'currency',\n Integer = 'integer',\n Percent = 'percent',\n Timestamp = 'timestamp',\n\n //\n // { type: 'date' }\n //\n\n DateTime = 'date-time',\n Date = 'date',\n Time = 'time',\n Duration = 'duration',\n\n //\n // { type: 'object' }\n //\n\n GeoPoint = 'lnglat',\n}\n\nexport const FormatEnums = Object.values(TypeFormat).sort();\n\nexport const PropertyKind = {\n type: TypeEnum,\n format: TypeFormat,\n};\n\n/**\n * Default formats\n */\nexport const typeToFormat: Partial<Record<TypeEnum, TypeFormat>> = {\n [TypeEnum.String]: TypeFormat.String,\n [TypeEnum.Number]: TypeFormat.Number,\n [TypeEnum.Boolean]: TypeFormat.Boolean,\n};\n\n/**\n * Map of format to type.\n */\nexport const formatToType: Record<TypeFormat, TypeEnum> = {\n [TypeFormat.None]: undefined as any,\n [TypeFormat.String]: TypeEnum.String,\n [TypeFormat.Number]: TypeEnum.Number,\n [TypeFormat.Boolean]: TypeEnum.Boolean,\n [TypeFormat.Ref]: TypeEnum.Ref,\n\n // Strings\n [TypeFormat.DID]: TypeEnum.String,\n [TypeFormat.DXN]: TypeEnum.String,\n [TypeFormat.Email]: TypeEnum.String,\n [TypeFormat.Formula]: TypeEnum.String,\n [TypeFormat.Hostname]: TypeEnum.String,\n [TypeFormat.JSON]: TypeEnum.String,\n [TypeFormat.Markdown]: TypeEnum.String,\n [TypeFormat.Regex]: TypeEnum.String,\n [TypeFormat.URL]: TypeEnum.String,\n [TypeFormat.UUID]: TypeEnum.String,\n [TypeFormat.SingleSelect]: TypeEnum.String,\n [TypeFormat.Text]: TypeEnum.String,\n [TypeFormat.MultiSelect]: TypeEnum.Object,\n\n // Dates\n [TypeFormat.Date]: TypeEnum.String,\n [TypeFormat.DateTime]: TypeEnum.String,\n [TypeFormat.Duration]: TypeEnum.String,\n [TypeFormat.Time]: TypeEnum.String,\n\n // Numbers\n [TypeFormat.Currency]: TypeEnum.Number,\n [TypeFormat.Integer]: TypeEnum.Number,\n [TypeFormat.Percent]: TypeEnum.Number,\n [TypeFormat.Timestamp]: TypeEnum.Number,\n\n // Objects\n [TypeFormat.GeoPoint]: TypeEnum.Array,\n};\n\n/**\n * Allowed value options for select.\n */\nexport const OptionsAnnotationId = Symbol.for('@dxos/schema/annotation/Options');\n\n// TODO(wittjosiah): Reconcile with `SelectOption`.\nexport type Options = string | number;\nexport const OptionsAnnotation = createAnnotationHelper<Options[]>(OptionsAnnotationId);\n\n/** @deprecated */\nexport const getOptionsAnnotation = (node: SchemaAST.AST): Options[] | undefined =>\n Function.pipe(SchemaAST.getAnnotation<Options[]>(OptionsAnnotationId)(node), Option.getOrUndefined);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { FormatAnnotation, TypeFormat } from './types';\n\nconst encodeMultipleOf = (divisor: number) => 1 / Math.pow(10, divisor);\n\nconst encodeMultiple =\n <A extends number>(divisor?: number) =>\n <I, R>(self: Schema.Schema<A, I, R>) =>\n divisor === undefined || divisor === 0 ? self : self.pipe(Schema.multipleOf(encodeMultipleOf(divisor)));\n\n/**\n * Convert number of digits to multipleOf annotation.\n */\nexport const DecimalPrecision = Schema.transform(Schema.Number, Schema.Number, {\n strict: true,\n encode: (value) => encodeMultipleOf(value),\n decode: (value) => Math.log10(1 / value),\n}).annotations({\n title: 'Number of digits',\n});\n\nexport const CurrencyAnnotationId = Symbol.for('@dxos/schema/annotation/Currency');\n\nexport type CurrencyAnnotation = {\n decimals?: number;\n code?: string;\n};\n\n/**\n * ISO 4217 currency code.\n */\nexport const Currency = ({ decimals, code }: CurrencyAnnotation = { decimals: 2 }) =>\n Schema.Number.pipe(\n encodeMultiple(decimals),\n FormatAnnotation.set(TypeFormat.Currency),\n Schema.annotations({\n title: 'Currency',\n description: 'Currency value',\n ...(code ? { [CurrencyAnnotationId]: code.toUpperCase() } : {}),\n }),\n );\n\nexport type PercentAnnotation = {\n decimals?: number;\n};\n\n/**\n * Integer.\n */\nexport const Integer = () =>\n Schema.Number.pipe(\n Schema.int(),\n FormatAnnotation.set(TypeFormat.Integer),\n Schema.annotations({\n title: 'Integer',\n description: 'Integer value',\n }),\n );\n\n/**\n * Percent.\n */\n// TODO(burdon): Define min/max (e.g., 0, 1).\nexport const Percent = ({ decimals }: PercentAnnotation = { decimals: 2 }) =>\n Schema.Number.pipe(\n encodeMultiple(decimals),\n FormatAnnotation.set(TypeFormat.Percent),\n Schema.annotations({\n title: 'Percent',\n description: 'Percentage value',\n }),\n );\n\n/**\n * Unix timestamp.\n * https://en.wikipedia.org/wiki/Unix_time\n */\nexport const Timestamp = Schema.Number.pipe(\n FormatAnnotation.set(TypeFormat.Timestamp),\n Schema.annotations({\n title: 'Timestamp',\n description: 'Unix timestamp',\n }),\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { clamp } from '@dxos/util';\n\nimport { FormatAnnotation, TypeFormat } from './types';\n\n/**\n * GeoJSON Format\n * https://datatracker.ietf.org/doc/html/rfc7946\n * https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1\n * https://en.wikipedia.org/wiki/Geographic_coordinate_system\n * https://geojson.org\n * {\n * \"type\": \"Point\",\n * \"coordinates\": [0, 51.47] // [longitude, latitude]\n * }\n * Note: optional third element for altitude.\n */\nexport const GeoPoint = Schema.Tuple(\n Schema.Number.pipe(Schema.annotations({ title: 'Longitude' }), Schema.clamp(-180, 180), Schema.multipleOf(0.000001)),\n Schema.Number.pipe(Schema.annotations({ title: 'Latitude' }), Schema.clamp(-90, 90), Schema.multipleOf(0.000001)),\n Schema.optionalElement(Schema.Number).annotations({\n title: 'Height ASL (m)',\n }),\n).pipe(\n FormatAnnotation.set(TypeFormat.GeoPoint),\n Schema.annotations({\n title: 'GeoPoint',\n description: 'GeoJSON Position',\n }),\n);\n\nexport type GeoPoint = Schema.Schema.Type<typeof GeoPoint>;\n\nexport type GeoLocation = {\n longitude: number;\n latitude: number;\n height?: number;\n};\n\n/**\n * Geolocation utilities for working with GeoPoint format.\n */\nexport namespace GeoLocation {\n /**\n * Convert latitude and longitude to GeoPoint (GeoJSON format [longitude, latitude, height?]).\n * Clamps values to valid ranges: latitude [-90, 90], longitude [-180, 180].\n */\n export const toGeoPoint = ({ longitude, latitude, height }: GeoLocation): GeoPoint => {\n // TODO(ZaymonFC): Use schema validation instead of doing this manually.\n const clampedLongitude = clamp(longitude, -180, 180);\n const clampedLatitude = clamp(latitude, -90, 90);\n return height !== undefined ? [clampedLongitude, clampedLatitude, height] : [clampedLongitude, clampedLatitude];\n };\n\n /**\n * Extract latitude and longitude from GeoPoint (GeoJSON format [longitude, latitude, height?]).\n */\n export const fromGeoPoint = (geoPoint: GeoPoint | undefined): GeoLocation => {\n if (!geoPoint) {\n return { longitude: 0, latitude: 0 };\n }\n\n const result: GeoLocation = {\n longitude: geoPoint[0],\n latitude: geoPoint[1],\n };\n\n // Add height if defined.\n if (geoPoint[2] !== undefined) {\n result.height = geoPoint[2];\n }\n\n return result;\n };\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { FormatAnnotation, TypeFormat } from './types';\n\n/**\n * Email address (RFC 5321)\n * https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.2\n */\nexport const Email = Schema.String.pipe(\n Schema.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/),\n FormatAnnotation.set(TypeFormat.Email),\n Schema.annotations({\n title: 'Email',\n description: 'Email address',\n }),\n);\n\n/**\n *\n */\n// TODO(burdon): Implement.\nexport const Formula = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Formula));\n\n/**\n *\n */\n// TODO(burdon): Implement.\nexport const Hostname = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Hostname));\n\n/**\n *\n */\n// TODO(burdon): Implement.\nexport const JSON = Schema.String.pipe(FormatAnnotation.set(TypeFormat.JSON));\n\n/**\n *\n */\n// TODO(burdon): Implement.\nexport const Markdown = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Markdown));\n\n/**\n * Regex\n * https://json-schema.org/understanding-json-schema/reference/regular_expressions\n * https://ecma-international.org/publications-and-standards/standards/ecma-262\n */\n// TODO(burdon): Implement.\nexport const Regex = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Regex));\n\n/**\n * Multi-line text.\n */\nexport const Text = Schema.String.pipe(FormatAnnotation.set(TypeFormat.Text));\n\n/**\n * https://datatracker.ietf.org/doc/html/rfc3986#section-1.1.3\n */\nexport const URL = Schema.String.pipe(\n Schema.pattern(/^(\\w+?:\\/\\/)?([\\da-z.-]+)\\.([a-z.]{2,6})([/\\w .-]*)*\\/?$/i),\n FormatAnnotation.set(TypeFormat.URL),\n Schema.annotations({\n title: 'URL',\n description: 'URL',\n }),\n);\n\n/**\n * UUID (RFC 4122)\n * https://datatracker.ietf.org/doc/html/rfc4122\n */\nexport const UUID = Schema.UUID.pipe(\n FormatAnnotation.set(TypeFormat.UUID),\n Schema.annotations({\n [SchemaAST.ExamplesAnnotationId]: ['3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a'],\n }),\n);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport * as Keys from '@dxos/keys';\n\nimport * as DateUtil from './date';\nimport * as NumberUtil from './number';\nimport * as ObjectUtil from './object';\nimport * as StringUtil from './string';\nimport { TypeFormat as TypeFormat$ } from './types';\n\n// TODO(burdon): Media encoding.\n// - https://json-schema.org/understanding-json-schema/reference/non_json_data\n\n/**\n * Formats.\n * https://json-schema.org/understanding-json-schema/reference/string#built-in-formats\n * NOTE: A JSON Schema validator will ignore any format type that it does not understand.\n */\n// TODO(burdon): Add fields for `examples`, `message`, etc.\nexport namespace Format {\n export import TypeFormat = TypeFormat$;\n\n // String\n export const DXN = Keys.DXN.Schema;\n export const Email = StringUtil.Email;\n export const Formula = StringUtil.Formula;\n export const Hostname = StringUtil.Hostname;\n export const JSON = StringUtil.JSON;\n export const Markdown = StringUtil.Markdown;\n export const Regex = StringUtil.Regex;\n export const URL = StringUtil.URL;\n export const UUID = Schema.UUID;\n\n // Numbers\n // TODO(burdon): BigInt.\n export const Currency = NumberUtil.Currency;\n export const Integer = NumberUtil.Integer;\n export const Percent = NumberUtil.Percent;\n export const Timestamp = NumberUtil.Timestamp;\n\n // Dates and times\n export const Date = DateUtil.DateOnly;\n export const DateTime = DateUtil.DateTime;\n export const Duration = DateUtil.Duration;\n export const Time = DateUtil.TimeOnly;\n\n // Objects\n export const GeoPoint = ObjectUtil.GeoPoint;\n export type GeoPoint = ObjectUtil.GeoPoint; // TODO(burdon): Export types.\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { FormatAnnotation, TypeFormat } from './types';\n\n/**\n * Datetime values should be stored as ISO strings or unix numbers (ms) in UTC.\n *\n * NOTE: HyperFormula uses Excel's time format (null date 1900/01/01)\n * It can be configured to use a different parser via `parseDateTime`.\n * https://hyperformula.handsontable.com/guide/date-and-time-handling.html#date-and-time-handling\n * https://github.com/handsontable/hyperformula/blob/master/src/DateTimeHelper.ts\n */\n\n// TODO(burdon): Annotations not present in JSON.\n// TODO(burdon): Timezone.\n// TODO(burdon): Format for timestamp (Unix UTC or ISO 8601)?\n// TODO(burdon): Refs\n// - https://www.npmjs.com/package/numfmt\n// - https://date-fns.org/docs/Getting-Started\n// - https://github.com/date-fns/tz\n\n/**\n * Simple date compatible with HF.\n */\nexport const SimpleDate = Schema.Struct({\n year: Schema.Number.pipe(Schema.between(1900, 9999)),\n month: Schema.Number.pipe(Schema.between(1, 12)),\n day: Schema.Number.pipe(Schema.between(1, 31)),\n});\n\nexport type SimpleDate = Schema.Schema.Type<typeof SimpleDate>;\n\nexport const toSimpleDate = (date: Date): SimpleDate => ({\n year: date.getUTCFullYear(),\n month: date.getUTCMonth() + 1,\n day: date.getUTCDate(),\n});\n\n/**\n * Simple time compatible with HF.\n */\nexport const SimpleTime = Schema.Struct({\n hours: Schema.Number.pipe(Schema.between(0, 23)),\n minutes: Schema.Number.pipe(Schema.between(0, 59)),\n seconds: Schema.Number.pipe(Schema.between(0, 59)),\n});\n\nexport type SimpleTime = Schema.Schema.Type<typeof SimpleTime>;\n\nexport const toSimpleTime = (date: Date): SimpleTime => ({\n hours: date.getUTCHours(),\n minutes: date.getUTCSeconds(),\n seconds: date.getUTCSeconds(),\n});\n\n/**\n * Simple date-time compatible with HF.\n */\nexport const SimpleDateTime = Schema.extend(SimpleDate, SimpleTime);\n\nexport type SimpleDateTime = Schema.Schema.Type<typeof SimpleDateTime>;\n\nexport const toSimpleDateTime = (date: Date): SimpleDateTime => ({\n ...toSimpleDate(date),\n ...toSimpleTime(date),\n});\n\n/**\n * https://effect.website/docs/guides/schema/transformations#date-transformations\n */\n\n// TODO(burdon): Consider if transformations should be supported with Automerge.\n\n/**\n * Format: 2018-11-13\n */\nexport const DateOnly = /* Schema.transformOrFail(Schema.String, SimpleDate, {\n strict: true,\n decode: (str, _, ast) => {\n if (!isValidDateFormat(str)) {\n return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected YYYY-MM-DD format'));\n }\n if (!isValidDate(str)) {\n return ParseResult.fail(new ParseResult.Type(ast, str, 'Invalid date'));\n }\n\n const [year, month, day] = str.split('-').map(Number);\n return ParseResult.succeed({ year, month, day });\n },\n encode: (date) => {\n return ParseResult.succeed(\n [\n date.year.toString().padStart(4, '0'),\n date.month.toString().padStart(2, '0'),\n date.day.toString().padStart(2, '0'),\n ].join('-'),\n );\n },\n}) */ Schema.String.pipe(\n FormatAnnotation.set(TypeFormat.Date),\n Schema.annotations({\n title: 'Date',\n description: 'Valid date in ISO format',\n }),\n);\n\n/**\n * Format: 20:20:39+00:00\n */\nexport const TimeOnly = /* Schema.transformOrFail(Schema.String, SimpleTime, {\n strict: true,\n decode: (str, _, ast) => {\n if (!isValidTimeFormat(str)) {\n return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected HH:mm:ss format'));\n }\n\n const [hours, minutes, seconds] = str.split(':').map(Number);\n return ParseResult.succeed({ hours, minutes, seconds });\n },\n encode: (time) => {\n return ParseResult.succeed(\n [\n time.hours.toString().padStart(2, '0'),\n time.minutes.toString().padStart(2, '0'),\n time.seconds.toString().padStart(2, '0'),\n ].join(':'),\n );\n },\n}) */ Schema.String.pipe(\n FormatAnnotation.set(TypeFormat.Time),\n Schema.annotations({\n title: 'Time',\n description: 'Valid time in ISO format',\n }),\n);\n\n/**\n * Format: 2018-11-13T20:20:39+00:00\n */\nexport const DateTime = /* Schema.transformOrFail(Schema.String, SimpleDateTime, {\n strict: false,\n decode: (str, _, ast) => {\n const [date, time] = str.split('T');\n if (!isValidDateFormat(date)) {\n return ParseResult.fail(new ParseResult.Type(ast, date, 'Expected YYYY-MM-DD format'));\n }\n if (!isValidDate(date)) {\n return ParseResult.fail(new ParseResult.Type(ast, date, 'Invalid date'));\n }\n if (!isValidTimeFormat(time)) {\n return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected HH:mm:ss format'));\n }\n\n const [year, month, day] = date.split('-').map(Number);\n const [hours, minutes, seconds] = time.split(':').map(Number);\n return ParseResult.succeed({ year, month, day, hours, minutes, seconds });\n },\n encode: (datetime) => {\n return ParseResult.succeed(\n [\n [\n datetime.year.toString().padStart(4, '0'),\n datetime.month.toString().padStart(2, '0'),\n datetime.day.toString().padStart(2, '0'),\n ].join('-'),\n [\n datetime.hours.toString().padStart(2, '0'),\n datetime.minutes.toString().padStart(2, '0'),\n datetime.seconds.toString().padStart(2, '0'),\n ].join(':'),\n ].join('T'),\n );\n },\n}) */ Schema.String.pipe(\n FormatAnnotation.set(TypeFormat.DateTime),\n Schema.annotations({\n title: 'DateTime',\n description: 'Valid date and time in ISO format',\n }),\n);\n\n/**\n * https://datatracker.ietf.org/doc/html/rfc3339#appendix-A\n */\n// TODO(burdon): Define duration type.\nexport const Duration = Schema.String.pipe(\n FormatAnnotation.set(TypeFormat.Duration),\n Schema.annotations({\n title: 'Duration',\n description: 'Duration in ISO 8601 format',\n [SchemaAST.ExamplesAnnotationId]: ['1h', '3D'],\n }),\n);\n\n//\n// Utils\n//\n\n// YYYY-MM-DD\nconst DATE_REGEX = /^\\d{4}-\\d{2}-\\d{2}$/;\n\nconst _isValidDateFormat = (str: string) => DATE_REGEX.test(str);\n\nconst _isValidDate = (str: string) => {\n const date = new Date(str);\n return !isNaN(date.getTime()) && date.toISOString().startsWith(str);\n};\n\n// HH:mm:ss\nconst TIME_REGEX = /^([01]\\d|2[0-3]):([0-5]\\d):([0-5]\\d)$/;\n\nconst _isValidTimeFormat = (str: string) => TIME_REGEX.test(str);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * Schema for a single select option. Used to define choices in a {single|multi}-select field.\n */\nexport const SelectOption = Schema.Struct({\n /** Stable identifier for the option. */\n id: Schema.NonEmptyString,\n title: Schema.String,\n /** Color palette used for visual styling. */\n color: Schema.String,\n});\n\nexport type SelectOption = Schema.Schema.Type<typeof SelectOption>;\n"],
5
- "mappings": ";;;;;AAIA,YAAYA,cAAc;AAE1B,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAepB,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;;;SAAAA;;AAUL,IAAMC,cAAc,CAACC,aAAAA;AAC1B,UAAQA,SAASC,MAAI;IACnB,KAAK;AACH,aAAA;IACF,KAAK;AACH,aAAA;IACF,KAAK;AACH,aAAA;IACF,KAAK;AACH,aAAA;IACF,KAAK;AACH,aAAA;IACF;AACE,aAAOC;EACX;AACF;AAMO,IAAMC,qBAAqBC,OAAOC,IAAI,gCAAA;AAEtC,IAAMC,mBAAmBC,uBAAmCJ,kBAAAA;AAG5D,IAAMK,sBAAsB,CAACC,SACzBC,cAAeC,wBAA0BR,kBAAAA,EAAoBM,IAAAA,GAAcG,qBAAc;AAG7F,IAAKC,aAAAA,0BAAAA,aAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAAAA;;AAuDL,IAAMC,cAAcC,OAAOC,OAAOH,UAAAA,EAAYI,KAAI;AAElD,IAAMC,eAAe;EAC1BjB,MAAMH;EACNqB,QAAQN;AACV;AAKO,IAAMO,eAAsD;EACjE,CAAA,QAAA,GAAiB;EACjB,CAAA,QAAA,GAAiB;EACjB,CAAA,SAAA,GAAkB;AACpB;AAKO,IAAMC,eAA6C;EACxD,CAAA,MAAA,GAAmBnB;EACnB,CAAA,QAAA,GAAmB;EACnB,CAAA,QAAA,GAAmB;EACnB,CAAA,SAAA,GAAoB;EACpB,CAAA,KAAA,GAAgB;EAGhB,CAAA,KAAA,GAAgB;EACh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AkBZ,eAAOC,KACpCC,iBAAiBC,IAAIC,WAAWQ,QAAQ,GACjCN,oBAAY;EACjBC,OAAO;EACPC,aAAa;EACb,CAAWK,+BAAoB,GAAG;IAAC;IAAM;;AAC3C,CAAA,CAAA;;;UD7KeC,SAAAA;UACDC,aAAa;UAGdC,MAAWA,SAAIC;UACfC,QAAmBA;UACnBC,UAAqBA;UACrBC,WAAsBA;UACtBC,OAAkBA;UAClBC,WAAsBA;UACtBC,QAAmBA;UACnBC,MAAiBA;UACjBC,OAAcA;UAIdC,WAAsBA;UACtBC,UAAqBA;UACrBC,UAAqBA;UACrBC,YAAuBA;UAGvBC,OAAgBC;UAChBC,WAAoBA;UACpBC,WAAoBA;UACpBC,OAAgBC;UAGhBC,WAAsBA;AAErC,GA9BiBtB,WAAAA,SAAAA,CAAAA,EAAAA;;;;AEnBjB,YAAYuB,aAAY;AAKjB,IAAMC,eAAsBC,eAAO;;EAExCC,IAAWC;EACXC,OAAcC;;EAEdC,OAAcD;AAChB,CAAA;",
6
- "names": ["Function", "Option", "SchemaAST", "TypeEnum", "getTypeEnum", "property", "type", "undefined", "FormatAnnotationId", "Symbol", "for", "FormatAnnotation", "createAnnotationHelper", "getFormatAnnotation", "node", "pipe", "getAnnotation", "getOrUndefined", "TypeFormat", "FormatEnums", "Object", "values", "sort", "PropertyKind", "format", "typeToFormat", "formatToType", "OptionsAnnotationId", "OptionsAnnotation", "getOptionsAnnotation", "Schema", "encodeMultipleOf", "divisor", "Math", "pow", "encodeMultiple", "self", "undefined", "pipe", "multipleOf", "DecimalPrecision", "transform", "Number", "strict", "encode", "value", "decode", "log10", "annotations", "title", "CurrencyAnnotationId", "Symbol", "for", "Currency", "decimals", "code", "FormatAnnotation", "set", "TypeFormat", "description", "toUpperCase", "Integer", "int", "Percent", "Timestamp", "Schema", "clamp", "GeoPoint", "Tuple", "Number", "pipe", "annotations", "title", "clamp", "multipleOf", "optionalElement", "FormatAnnotation", "set", "TypeFormat", "description", "GeoLocation", "toGeoPoint", "longitude", "latitude", "height", "clampedLongitude", "clampedLatitude", "undefined", "fromGeoPoint", "geoPoint", "result", "Schema", "SchemaAST", "Email", "String", "pipe", "pattern", "FormatAnnotation", "set", "TypeFormat", "annotations", "title", "description", "Formula", "Hostname", "JSON", "Markdown", "Regex", "Text", "URL", "UUID", "ExamplesAnnotationId", "Schema", "Keys", "Schema", "SchemaAST", "SimpleDate", "Struct", "year", "Number", "pipe", "between", "month", "day", "SimpleTime", "Struct", "hours", "Number", "pipe", "between", "minutes", "seconds", "SimpleDateTime", "extend", "SimpleDate", "SimpleTime", "DateOnly", "String", "pipe", "FormatAnnotation", "set", "TypeFormat", "Date", "annotations", "title", "description", "TimeOnly", "Time", "DateTime", "Duration", "ExamplesAnnotationId", "Format", "TypeFormat", "DXN", "Schema", "Email", "Formula", "Hostname", "JSON", "Markdown", "Regex", "URL", "UUID", "Currency", "Integer", "Percent", "Timestamp", "Date", "DateOnly", "DateTime", "Duration", "Time", "TimeOnly", "GeoPoint", "Schema", "SelectOption", "Struct", "id", "NonEmptyString", "title", "String", "color"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Entity.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type { ForeignKey } from '@dxos/echo-protocol';\nimport type { DXN, ObjectId } from '@dxos/keys';\n\nimport {\n type ChangeCallback,\n EntityKind,\n EntityKindSchema,\n KindId,\n type Mutable,\n type ObjectJSON,\n type ObjectMeta,\n type ReadonlyMeta,\n SnapshotKindId,\n addTag as addTag$,\n change as change$,\n getDXN as getDXN$,\n getDatabase as getDatabase$,\n getDescription as getDescription$,\n getEntityKind,\n getKeys as getKeys$,\n getLabel as getLabel$,\n getMetaChecked as getMeta$,\n getTypeDXN as getTypeDXN$,\n getTypename as getTypename$,\n isDeleted as isDeleted$,\n removeTag as removeTag$,\n subscribe as subscribe$,\n objectToJSON as toJSON$,\n} from './internal';\n\n// Re-export KindId and SnapshotKindId from internal.\nexport { KindId, SnapshotKindId };\n\n// NOTE: Relation does not extend Obj so that, for example, we can prevent Relations from being used as source and target objects.\n// However, we generally refer to Obj and Relation instances as \"objects\",\n// and many API methods accept both Obj.Unknown and Relation.Unknown (i.e., Entity.Unknown) instances.\n\nexport const Kind = EntityKind;\nexport type Kind = EntityKind;\nexport const KindSchema = EntityKindSchema;\n\n/**\n * Assigns a kind to an Object or Relation instance.\n * NOTE: Needed to make `isRelation` and `isObject` checks work.\n */\nexport interface OfKind<K extends Kind> {\n readonly [KindId]: K;\n readonly id: ObjectId;\n}\n\n/**\n * Assigns a snapshot kind to an Object or Relation snapshot.\n */\nexport interface SnapshotOfKind<K extends Kind> {\n readonly [SnapshotKindId]: K;\n readonly id: ObjectId;\n}\n\n/**\n * Obj or Relation with a specific set of properties.\n */\nexport type Entity<Props> = OfKind<Kind> & Props;\n\n/**\n * Unknown Obj or Relation (reactive).\n */\nexport interface Unknown extends OfKind<Kind> {}\n\n/**\n * Snapshot of an Obj or Relation.\n * Branded with SnapshotKindId instead of KindId.\n */\nexport interface Snapshot extends SnapshotOfKind<Kind> {}\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 * This type is very permissive and allows accessing any property on the object.\n * We should move to Obj.Unknown that is not permissive and requires explicit instanceof checks..\n */\nexport interface Any extends OfKind<Kind> {\n [key: string]: unknown;\n}\n\nexport const getKind = getEntityKind;\n\n//\n// Entity-level functions that work on any entity (object or relation).\n// Use these when you don't know or care about the specific entity kind.\n// For kind-specific functions, use Obj.* or Relation.*.\n//\n\n/**\n * JSON representation of an entity.\n */\nexport type JSON = ObjectJSON;\n\n/**\n * Get the DXN of an entity (object or relation).\n */\nexport const getDXN = (entity: Unknown | Snapshot): DXN => getDXN$(entity);\n\n/**\n * Get the DXN of an entity's type.\n */\nexport const getTypeDXN = getTypeDXN$;\n\n/**\n * Get the typename of an entity's type.\n */\nexport const getTypename = (entity: Unknown | Snapshot): string | undefined => getTypename$(entity);\n\n/**\n * Get the database an entity belongs to.\n */\nexport const getDatabase = (entity: Unknown | Snapshot): any | undefined => getDatabase$(entity);\n\n/**\n * Get the metadata for an entity.\n * Returns mutable meta when passed a mutable entity (inside change callback).\n * Returns read-only meta when passed a regular entity or snapshot.\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>): ObjectMeta;\nexport function getMeta(entity: Unknown | Snapshot): ReadonlyMeta;\nexport function getMeta(entity: Unknown | Snapshot | Mutable<Unknown>): ObjectMeta | ReadonlyMeta {\n return getMeta$(entity);\n}\n\n/**\n * Get foreign keys for an entity from the specified source.\n */\nexport const getKeys = (entity: Unknown | Snapshot, source: string): ForeignKey[] => getKeys$(entity, source);\n\n/**\n * Check if an entity is deleted.\n */\nexport const isDeleted = (entity: Unknown | Snapshot): boolean => isDeleted$(entity);\n\n/**\n * Get the label of an entity.\n */\nexport const getLabel = (entity: Unknown | Snapshot): string | undefined => getLabel$(entity);\n\n/**\n * Get the description of an entity.\n */\nexport const getDescription = (entity: Unknown | Snapshot): string | undefined => getDescription$(entity);\n\n/**\n * Convert an entity to its JSON representation.\n */\nexport const toJSON = (entity: Unknown | Snapshot): JSON => toJSON$(entity);\n\n/**\n * Subscribe to changes on an entity (object or relation).\n * @returns Unsubscribe function.\n */\nexport const subscribe = (entity: Unknown, callback: () => void): (() => void) => {\n return subscribe$(entity, callback);\n};\n\n//\n// Change\n//\n\n/**\n * Used to provide a mutable view of an entity within `Entity.change`.\n */\nexport type { Mutable };\n\n/**\n * Perform mutations on an entity (object or relation) within a change context.\n *\n * Entities are read-only by default. Mutations are batched and notifications fire\n * when the callback completes. Direct mutations outside of `Entity.change` will throw\n * at runtime.\n *\n * @param entity - The echo entity (object or relation) to mutate.\n * @param callback - Receives a mutable view of the entity. All mutations must occur here.\n *\n * @example\n * ```typescript\n * // Mutate within Entity.change\n * Entity.change(entity, (e) => {\n * e.name = 'Updated';\n * e.count = 42;\n * });\n *\n * // Direct mutation throws\n * entity.name = 'Bob'; // Error: Cannot modify outside Entity.change()\n * ```\n *\n * Note: For type-specific operations, prefer `Obj.change` or `Relation.change`.\n */\nexport const change = <T extends Unknown>(entity: T, callback: ChangeCallback<T>): void => {\n change$(entity, callback);\n};\n\n/**\n * Add a tag to an entity.\n * Must be called within an `Entity.change`, `Obj.change`, or `Relation.change` callback.\n */\nexport const addTag = (entity: Mutable<Unknown>, tag: string): void => addTag$(entity, tag);\n\n/**\n * Remove a tag from an entity.\n * Must be called within an `Entity.change`, `Obj.change`, or `Relation.change` callback.\n */\nexport const removeTag = (entity: Mutable<Unknown>, tag: string): void => removeTag$(entity, tag);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;gBAAAA;EAAA,cAAAC;EAAA,cAAAC;EAAA,mBAAAC;EAAA,sBAAAC;EAAA,eAAAC;EAAA;kBAAAC;EAAA;oBAAAC;EAAA,mBAAAC;EAAA,iBAAAC;EAAA,iBAAAC;EAAA,iBAAAC;EAAA;;AAyCO,IAAMC,OAAOC;AAEb,IAAMC,aAAaC;AAgDnB,IAAMC,UAAUC;AAgBhB,IAAMC,UAAS,CAACC,WAAoCC,OAAQD,MAAAA;AAK5D,IAAME,cAAaC;AAKnB,IAAMC,eAAc,CAACJ,WAAmDK,YAAaL,MAAAA;AAKrF,IAAMM,eAAc,CAACN,WAAgDO,YAAaP,MAAAA;AAUlF,SAASQ,QAAQR,QAA6C;AACnE,SAAOS,eAAST,MAAAA;AAClB;AAKO,IAAMU,WAAU,CAACV,QAA4BW,WAAiCC,QAASZ,QAAQW,MAAAA;AAK/F,IAAME,aAAY,CAACb,WAAwCc,UAAWd,MAAAA;AAKtE,IAAMe,YAAW,CAACf,WAAmDgB,SAAUhB,MAAAA;AAK/E,IAAMiB,kBAAiB,CAACjB,WAAmDkB,eAAgBlB,MAAAA;AAK3F,IAAMmB,SAAS,CAACnB,WAAqCoB,aAAQpB,MAAAA;AAM7D,IAAMqB,aAAY,CAACrB,QAAiBsB,aAAAA;AACzC,SAAOC,UAAWvB,QAAQsB,QAAAA;AAC5B;AAmCO,IAAME,UAAS,CAAoBxB,QAAWsB,aAAAA;AACnDG,SAAQzB,QAAQsB,QAAAA;AAClB;AAMO,IAAMI,UAAS,CAAC1B,QAA0B2B,QAAsBC,OAAQ5B,QAAQ2B,GAAAA;AAMhF,IAAME,aAAY,CAAC7B,QAA0B2B,QAAsBG,UAAW9B,QAAQ2B,GAAAA;",
6
- "names": ["addTag", "change", "getDXN", "getDatabase", "getDescription", "getKeys", "getLabel", "getTypeDXN", "getTypename", "isDeleted", "removeTag", "subscribe", "Kind", "EntityKind", "KindSchema", "EntityKindSchema", "getKind", "getEntityKind", "getDXN", "entity", "getDXN$", "getTypeDXN", "getTypeDXN$", "getTypename", "getTypename$", "getDatabase", "getDatabase$", "getMeta", "getMeta$", "getKeys", "source", "getKeys$", "isDeleted", "isDeleted$", "getLabel", "getLabel$", "getDescription", "getDescription$", "toJSON", "toJSON$", "subscribe", "callback", "subscribe$", "change", "change$", "addTag", "tag", "addTag$", "removeTag", "removeTag$"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/internal/types/typename.ts", "../../../src/internal/annotations/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 * 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 AnyProperties, EntityKind, TypeId, getSchema } from '../types';\n\nimport { 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: `dxos.org/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-zA-Z]\\w+\\.[a-zA-Z]\\w{1,}\\/[\\w/_-]+$/)).annotations(\n {\n description: 'Fully qualified globally unique typename',\n example: 'dxos.org/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 \"example.org/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:example.com/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"],
5
- "mappings": ";;;;;;AASO,IAAMA,YAAY;AAKlB,IAAMC,SAASC,OAAOC,IAAI,iBAAA;AAK1B,IAAMC,WAAWF,OAAOC,IAAI,mBAAA;AAS5B,IAAME,YAAY,CAACC,QAAAA;AACxB,MAAIA,KAAK;AACP,WAAQA,IAAYF,QAAAA;EACtB;AACF;AAKO,IAAMG,YAAY,CAACD,KAAUE,WAAAA;AAClCC,SAAOC,eAAeJ,KAAKF,UAAU;IACnCO,OAAOH;IACPI,UAAU;IACVC,YAAY;IACZC,cAAc;EAChB,CAAA;AACF;;;ACxCA,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAE3B,SAASC,aAAa;AACtB,SAAwBC,gBAAgB;AACxC,SAASC,gBAAgBC,iBAAiB;AAC1C,SAASC,WAAW;;AAUb,IAAMC,wBAAwB;AAO9B,IAAMC,YAAY,CAACC,SAAiBC,aAAaH,uBAAuBE,IAAAA;AAUxE,IAAME,6BAA6BC,OAAOC,IAAI,wCAAA;AAE9C,IAAMC,8BAA8B,CAACC,WACjCC,cACGC,wBAAsBN,0BAAAA,GACzBO,iBAAU,MAAMC,MAAAA,CAAAA,EACvBJ,OAAOK,GAAG;AAQP,IAAMC,eAAe,CAACN,WAAAA;AAC3BO,iBAAsBC,gBAASR,MAAAA,GAAS,UAAU,gBAAA;AAClD,QAAMS,KAAKV,4BAA4BC,MAAAA;AACvC,MAAIS,IAAI;AACN,WAAOC,IAAIC,MAAMF,EAAAA;EACnB;AAGA,QAAMG,mBAAmBC,kBAAkB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qF,qBAAqB,CAChCzF,QACA8D,QACA4B,UAAAA;AAEA,QAAMN,aAAaF,gBAAgBG,IAAIrF,MAAAA,EAAQyB,KACtCgD,WAAI,CAACkB,UAAUA,MAAM,CAAA,CAAE,GACvBxF,iBAAU,MAAM,MAAA,CAAA;AAEzB2D,SAAOsB,UAAAA,IAAcM;AACvB;AAMO,IAAME,0BAA0B/F,OAAOC,IAAI,qCAAA;AAC3C,IAAM+F,wBAAwBhB,uBAA+Be,uBAAAA;AAO7D,IAAME,2BAA2B,CACtC9F,QACA8D,WAAAA;AAEA,QAAMwB,WAAWO,sBAAsBR,IAAIrF,MAAAA,EAAQyB,KAAYtB,iBAAU,MAAM,aAAA,CAAA;AAC/EI,iBAAe,OAAO+E,aAAa,UAAU,YAAY,yCAAA;AACzD,QAAM7B,QAAQ8B,SAASzB,QAAQwB,QAAAA;AAC/B,UAAQ,OAAO7B,OAAAA;IACb,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;AACH,aAAOA,MAAM+B,SAAQ;IACvB,KAAK;IACL,KAAK;IACL,KAAK;IACL;AACE,aAAOpF;EACX;AACF;AAMO,IAAM2F,2BAA2B,CACtC/F,QACA8D,QACAlC,gBAAAA;AAEA,QAAM0D,WAAWO,sBAAsBR,IAAIrF,MAAAA,EAAQyB,KAAYtB,iBAAU,MAAM,aAAA,CAAA;AAC/E2D,SAAOwB,QAAAA,IAAY1D;AACrB;AAOO,IAAMoE,wBAAwBnG,OAAOC,IAAI,mCAAA;AACzC,IAAMmG,sBAAsBpB,uBAAgCmB,qBAAAA;AAK5D,IAAME,0BAA0BrG,OAAOC,IAAI,qCAAA;AAK3C,IAAMqG,wBAAwBtG,OAAOC,IAAI,mCAAA;AAUzC,IAAMsG,sBAAsBvB,uBAAiDsB,qBAAAA;",
6
- "names": ["ATTR_TYPE", "TypeId", "Symbol", "for", "SchemaId", "getSchema", "obj", "setSchema", "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"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Ref.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Option from 'effect/Option';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Ref as Ref$, RefArray, type RefResolver } from './internal';\nimport { getSchemaReference } from './internal';\nimport type * as JsonSchema from './JsonSchema';\nimport type * as Obj from './Obj';\n\nexport type Ref<T> = Ref$<T>;\nexport type Unknown = Ref$<Obj.Unknown>;\n\nexport const Array = RefArray;\n\n/**\n * Extract reference target.\n */\nexport type Target<R extends Unknown> = R extends Ref$<infer T> ? T : never;\n\n/**\n * Reference resolver.\n */\nexport type Resolver = RefResolver;\n\nexport const isRef: (value: unknown) => value is Unknown = Ref$.isRef;\n\nexport const make = Ref$.make;\n\n// TODO(dmaretskyi): Consider just allowing `make` to accept DXN.\nexport const fromDXN = Ref$.fromDXN;\n\n// TODO(wittjosiah): Factor out?\nexport const isRefType = (ast: SchemaAST.AST): boolean => {\n return SchemaAST.getAnnotation<JsonSchema.JsonSchema>(ast, SchemaAST.JSONSchemaAnnotationId).pipe(\n Option.flatMap((jsonSchema) => ('$id' in jsonSchema ? Option.some(jsonSchema) : Option.none())),\n Option.flatMap((jsonSchema) => {\n const { typename } = getSchemaReference(jsonSchema) ?? {};\n return typename ? Option.some(true) : Option.some(false);\n }),\n Option.getOrElse(() => false),\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;AAAA;;;;;;;;AAIA,YAAYA,YAAY;AACxB,YAAYC,eAAe;AAUpB,IAAMC,QAAQC;AAYd,IAAMC,QAA8CC,IAAKD;AAEzD,IAAME,OAAOD,IAAKC;AAGlB,IAAMC,UAAUF,IAAKE;AAGrB,IAAMC,YAAY,CAACC,QAAAA;AACxB,SAAiBC,wBAAqCD,KAAeE,gCAAsB,EAAEC,KACpFC,eAAQ,CAACC,eAAgB,SAASA,aAAoBC,YAAKD,UAAAA,IAAqBE,YAAI,CAAA,GACpFH,eAAQ,CAACC,eAAAA;AACd,UAAM,EAAEG,SAAQ,IAAKC,mBAAmBJ,UAAAA,KAAe,CAAC;AACxD,WAAOG,WAAkBF,YAAK,IAAA,IAAeA,YAAK,KAAA;EACpD,CAAA,GACOI,iBAAU,MAAM,KAAA,CAAA;AAE3B;",
6
- "names": ["Option", "SchemaAST", "Array", "RefArray", "isRef", "Ref$", "make", "fromDXN", "isRefType", "ast", "getAnnotation", "JSONSchemaAnnotationId", "pipe", "flatMap", "jsonSchema", "some", "none", "typename", "getSchemaReference", "getOrElse"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/Tag.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { LabelAnnotation, SystemTypeAnnotation } from './internal';\nimport * as Obj from './Obj';\nimport * as Type from './Type';\n\nexport const Tag = Schema.Struct({\n label: Schema.String,\n hue: Schema.optional(Schema.String), // TODO(burdon): Color name?\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Tag',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['label']),\n SystemTypeAnnotation.set(true),\n);\n\nexport type Tag = Schema.Schema.Type<typeof Tag>;\n\nexport const make = (props: Obj.MakeProps<typeof Tag>) => Obj.make(Tag, props);\n\n// TODO(burdon): Rename Map.\nexport type Map = Record<string, Tag>;\n\nexport const sortTags = ({ label: a }: Tag, { label: b }: Tag) => a.localeCompare(b);\n\nexport const createTagList = (tags: Map): Tag[] =>\n Object.entries(tags)\n .map(([id, tag]) => ({ ...tag, id }))\n .sort(sortTags);\n\nexport const findTagByLabel = (tags: Map | undefined, name: string): Tag | undefined => {\n const entry = Object.entries(tags ?? {}).find(([_, tag]) => tag.label.toLowerCase() === name.toLowerCase());\n return entry ? { ...entry[1], id: entry[0] } : undefined;\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;;;;;cAAAA;EAAA;;AAIA,YAAYC,YAAY;AAMjB,IAAMC,MAAaC,cAAO;EAC/BC,OAAcC;EACdC,KAAYC,gBAAgBF,aAAM;AACpC,CAAA,EAAGG,KACIC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBC,IAAI;EAAC;CAAQ,GAC7BC,qBAAqBD,IAAI,IAAA,CAAA;AAKpB,IAAME,QAAO,CAACC,UAAyCD,KAAKb,KAAKc,KAAAA;AAKjE,IAAMC,WAAW,CAAC,EAAEb,OAAOc,EAAC,GAAS,EAAEd,OAAOe,EAAC,MAAYD,EAAEE,cAAcD,CAAAA;AAE3E,IAAME,gBAAgB,CAACC,SAC5BC,OAAOC,QAAQF,IAAAA,EACZG,IAAI,CAAC,CAACC,IAAIC,GAAAA,OAAU;EAAE,GAAGA;EAAKD;AAAG,EAAA,EACjCE,KAAKX,QAAAA;AAEH,IAAMY,iBAAiB,CAACP,MAAuBQ,SAAAA;AACpD,QAAMC,QAAQR,OAAOC,QAAQF,QAAQ,CAAC,CAAA,EAAGU,KAAK,CAAC,CAACC,GAAGN,GAAAA,MAASA,IAAIvB,MAAM8B,YAAW,MAAOJ,KAAKI,YAAW,CAAA;AACxG,SAAOH,QAAQ;IAAE,GAAGA,MAAM,CAAA;IAAIL,IAAIK,MAAM,CAAA;EAAG,IAAII;AACjD;",
6
- "names": ["make", "Schema", "Tag", "Struct", "label", "String", "hue", "optional", "pipe", "object", "typename", "version", "LabelAnnotation", "set", "SystemTypeAnnotation", "make", "props", "sortTags", "a", "b", "localeCompare", "createTagList", "tags", "Object", "entries", "map", "id", "tag", "sort", "findTagByLabel", "name", "entry", "find", "_", "toLowerCase", "undefined"]
7
- }