@dxos/echo 0.10.0 → 0.11.0

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 (274) hide show
  1. package/dist/lib/Annotation.mjs +3 -0
  2. package/dist/lib/Blob.mjs +160 -0
  3. package/dist/lib/Blob.mjs.map +1 -0
  4. package/dist/lib/Database.mjs +2 -0
  5. package/dist/lib/Entity.mjs +231 -0
  6. package/dist/lib/Entity.mjs.map +1 -0
  7. package/dist/lib/Err.mjs +105 -0
  8. package/dist/lib/Err.mjs.map +1 -0
  9. package/dist/lib/Feed.mjs +338 -0
  10. package/dist/lib/Feed.mjs.map +1 -0
  11. package/dist/lib/Filter.mjs +380 -0
  12. package/dist/lib/Filter.mjs.map +1 -0
  13. package/dist/lib/Format.mjs +47 -0
  14. package/dist/lib/Format.mjs.map +1 -0
  15. package/dist/lib/JsonSchema.mjs +21 -0
  16. package/dist/lib/JsonSchema.mjs.map +1 -0
  17. package/dist/lib/Key.mjs +15 -0
  18. package/dist/lib/Key.mjs.map +1 -0
  19. package/dist/lib/Migration.mjs +38 -0
  20. package/dist/lib/Migration.mjs.map +1 -0
  21. package/dist/lib/Obj.mjs +660 -0
  22. package/dist/lib/Obj.mjs.map +1 -0
  23. package/dist/lib/Order.mjs +65 -0
  24. package/dist/lib/Order.mjs.map +1 -0
  25. package/dist/lib/Query.mjs +336 -0
  26. package/dist/lib/Query.mjs.map +1 -0
  27. package/dist/lib/QueryResult.mjs +7 -0
  28. package/dist/lib/QueryResult.mjs.map +1 -0
  29. package/dist/lib/Ref.mjs +44 -0
  30. package/dist/lib/Ref.mjs.map +1 -0
  31. package/dist/lib/Registry.mjs +35 -0
  32. package/dist/lib/Registry.mjs.map +1 -0
  33. package/dist/lib/Relation.mjs +397 -0
  34. package/dist/lib/Relation.mjs.map +1 -0
  35. package/dist/lib/Scope.mjs +51 -0
  36. package/dist/lib/Scope.mjs.map +1 -0
  37. package/dist/lib/Tag.mjs +70 -0
  38. package/dist/lib/Tag.mjs.map +1 -0
  39. package/dist/lib/Text.mjs +82 -0
  40. package/dist/lib/Text.mjs.map +1 -0
  41. package/dist/lib/Type.mjs +371 -0
  42. package/dist/lib/Type.mjs.map +1 -0
  43. package/dist/lib/chunk-Annotation.mjs +221 -0
  44. package/dist/lib/chunk-Annotation.mjs.map +1 -0
  45. package/dist/lib/chunk-Database.mjs +918 -0
  46. package/dist/lib/chunk-Database.mjs.map +1 -0
  47. package/dist/lib/chunk-atom-snapshot.mjs +249 -0
  48. package/dist/lib/chunk-atom-snapshot.mjs.map +1 -0
  49. package/dist/lib/chunk-internal.mjs +2775 -0
  50. package/dist/lib/chunk-internal.mjs.map +1 -0
  51. package/dist/lib/chunk-json-schema.mjs +660 -0
  52. package/dist/lib/chunk-json-schema.mjs.map +1 -0
  53. package/dist/lib/chunk-number.mjs +164 -0
  54. package/dist/lib/chunk-number.mjs.map +1 -0
  55. package/dist/lib/chunk-ref-array.mjs +31 -0
  56. package/dist/lib/chunk-ref-array.mjs.map +1 -0
  57. package/dist/lib/chunk-ref.mjs +590 -0
  58. package/dist/lib/chunk-ref.mjs.map +1 -0
  59. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  60. package/dist/lib/chunk-select.mjs +186 -0
  61. package/dist/lib/chunk-select.mjs.map +1 -0
  62. package/dist/lib/chunk-src.mjs +234 -0
  63. package/dist/lib/chunk-src.mjs.map +1 -0
  64. package/dist/lib/chunk-util.mjs +140 -0
  65. package/dist/lib/chunk-util.mjs.map +1 -0
  66. package/dist/lib/index.mjs +24 -0
  67. package/dist/lib/internal.mjs +10 -0
  68. package/dist/lib/testing.mjs +346 -0
  69. package/dist/lib/testing.mjs.map +1 -0
  70. package/dist/types/src/Aggregate.d.ts +86 -0
  71. package/dist/types/src/Aggregate.d.ts.map +1 -0
  72. package/dist/types/src/Blob.d.ts +153 -0
  73. package/dist/types/src/Blob.d.ts.map +1 -0
  74. package/dist/types/src/Blob.test.d.ts +2 -0
  75. package/dist/types/src/Blob.test.d.ts.map +1 -0
  76. package/dist/types/src/Database.d.ts +153 -4
  77. package/dist/types/src/Database.d.ts.map +1 -1
  78. package/dist/types/src/Err.d.ts +116 -0
  79. package/dist/types/src/Err.d.ts.map +1 -1
  80. package/dist/types/src/Feed.d.ts +116 -28
  81. package/dist/types/src/Feed.d.ts.map +1 -1
  82. package/dist/types/src/Feed.test.d.ts +2 -0
  83. package/dist/types/src/Feed.test.d.ts.map +1 -0
  84. package/dist/types/src/Filter.d.ts +14 -6
  85. package/dist/types/src/Filter.d.ts.map +1 -1
  86. package/dist/types/src/Hypergraph.d.ts +18 -0
  87. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  88. package/dist/types/src/Json.d.ts.map +1 -1
  89. package/dist/types/src/Obj.d.ts +14 -1
  90. package/dist/types/src/Obj.d.ts.map +1 -1
  91. package/dist/types/src/Order.d.ts +9 -3
  92. package/dist/types/src/Order.d.ts.map +1 -1
  93. package/dist/types/src/Query.d.ts +107 -26
  94. package/dist/types/src/Query.d.ts.map +1 -1
  95. package/dist/types/src/Relation.d.ts +6 -0
  96. package/dist/types/src/Relation.d.ts.map +1 -1
  97. package/dist/types/src/Type.d.ts.map +1 -1
  98. package/dist/types/src/View.d.ts +1 -1
  99. package/dist/types/src/index.d.ts +2 -0
  100. package/dist/types/src/index.d.ts.map +1 -1
  101. package/dist/types/src/internal/Entity/api.d.ts +6 -0
  102. package/dist/types/src/internal/Entity/api.d.ts.map +1 -1
  103. package/dist/types/src/internal/Entity/model.d.ts +3 -2
  104. package/dist/types/src/internal/Entity/model.d.ts.map +1 -1
  105. package/dist/types/src/internal/Filter/match.d.ts.map +1 -1
  106. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts +34 -8
  107. package/dist/types/src/internal/JsonSchema/json-schema-type.d.ts.map +1 -1
  108. package/dist/types/src/internal/JsonSchema/json-schema.d.ts.map +1 -1
  109. package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -1
  110. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -1
  111. package/dist/types/src/internal/Query/pretty.d.ts.map +1 -1
  112. package/dist/types/src/internal/Query/query-result-effect.d.ts.map +1 -1
  113. package/dist/types/src/internal/common/proxy/make-object.d.ts +13 -0
  114. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -1
  115. package/dist/types/src/internal/common/proxy/reactive.d.ts.map +1 -1
  116. package/dist/types/src/internal/common/proxy/symbols.d.ts.map +1 -1
  117. package/dist/types/src/internal/common/proxy/typed-handler.d.ts +12 -0
  118. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -1
  119. package/dist/types/src/internal/common/types/index.d.ts +1 -0
  120. package/dist/types/src/internal/common/types/index.d.ts.map +1 -1
  121. package/dist/types/src/internal/common/types/model-symbols.d.ts +5 -0
  122. package/dist/types/src/internal/common/types/model-symbols.d.ts.map +1 -1
  123. package/dist/types/src/internal/common/types/projection.d.ts +32 -0
  124. package/dist/types/src/internal/common/types/projection.d.ts.map +1 -0
  125. package/dist/types/tsconfig.tsbuildinfo +1 -1
  126. package/package.json +40 -35
  127. package/src/Aggregate.ts +105 -0
  128. package/src/Blob.test.ts +45 -0
  129. package/src/Blob.ts +205 -0
  130. package/src/Database.ts +207 -17
  131. package/src/Err.ts +36 -0
  132. package/src/Feed.test.ts +188 -0
  133. package/src/Feed.ts +238 -62
  134. package/src/Filter.ts +28 -10
  135. package/src/Hypergraph.ts +18 -0
  136. package/src/Json.ts +1 -0
  137. package/src/Obj.test.ts +2 -2
  138. package/src/Obj.ts +21 -1
  139. package/src/Order.ts +16 -9
  140. package/src/Query.test.ts +319 -2
  141. package/src/Query.ts +165 -51
  142. package/src/Relation.ts +14 -0
  143. package/src/Type.ts +5 -6
  144. package/src/index.ts +2 -0
  145. package/src/internal/Entity/api.ts +11 -1
  146. package/src/internal/Entity/model.ts +3 -0
  147. package/src/internal/Filter/match.ts +30 -1
  148. package/src/internal/JsonSchema/json-schema-type.ts +14 -2
  149. package/src/internal/JsonSchema/json-schema.test.ts +28 -1
  150. package/src/internal/JsonSchema/json-schema.ts +33 -6
  151. package/src/internal/Obj/atoms.ts +4 -2
  152. package/src/internal/Obj/json-serializer.test.ts +162 -2
  153. package/src/internal/Obj/json-serializer.ts +6 -0
  154. package/src/internal/Query/pretty.ts +19 -1
  155. package/src/internal/Query/query-result-effect.ts +2 -4
  156. package/src/internal/Ref/atoms.ts +1 -1
  157. package/src/internal/common/proxy/change-context.ts +1 -1
  158. package/src/internal/common/proxy/make-object.ts +42 -3
  159. package/src/internal/common/proxy/reactive.ts +5 -0
  160. package/src/internal/common/proxy/symbols.ts +1 -0
  161. package/src/internal/common/proxy/typed-handler.ts +71 -29
  162. package/src/internal/common/types/index.ts +1 -0
  163. package/src/internal/common/types/model-symbols.ts +6 -0
  164. package/src/internal/common/types/projection.ts +45 -0
  165. package/src/testing/test-data.ts +14 -14
  166. package/dist/lib/neutral/Annotation.mjs +0 -90
  167. package/dist/lib/neutral/Annotation.mjs.map +0 -7
  168. package/dist/lib/neutral/Database.mjs +0 -42
  169. package/dist/lib/neutral/Database.mjs.map +0 -7
  170. package/dist/lib/neutral/Entity.mjs +0 -76
  171. package/dist/lib/neutral/Entity.mjs.map +0 -7
  172. package/dist/lib/neutral/Err.mjs +0 -16
  173. package/dist/lib/neutral/Err.mjs.map +0 -7
  174. package/dist/lib/neutral/Feed.mjs +0 -50
  175. package/dist/lib/neutral/Feed.mjs.map +0 -7
  176. package/dist/lib/neutral/Filter.mjs +0 -72
  177. package/dist/lib/neutral/Filter.mjs.map +0 -7
  178. package/dist/lib/neutral/Format.mjs +0 -82
  179. package/dist/lib/neutral/Format.mjs.map +0 -7
  180. package/dist/lib/neutral/JsonSchema.mjs +0 -18
  181. package/dist/lib/neutral/JsonSchema.mjs.map +0 -7
  182. package/dist/lib/neutral/Key.mjs +0 -16
  183. package/dist/lib/neutral/Key.mjs.map +0 -7
  184. package/dist/lib/neutral/Migration.mjs +0 -18
  185. package/dist/lib/neutral/Migration.mjs.map +0 -7
  186. package/dist/lib/neutral/Obj.mjs +0 -128
  187. package/dist/lib/neutral/Obj.mjs.map +0 -7
  188. package/dist/lib/neutral/Order.mjs +0 -16
  189. package/dist/lib/neutral/Order.mjs.map +0 -7
  190. package/dist/lib/neutral/Query.mjs +0 -38
  191. package/dist/lib/neutral/Query.mjs.map +0 -7
  192. package/dist/lib/neutral/QueryResult.mjs +0 -2
  193. package/dist/lib/neutral/QueryResult.mjs.map +0 -7
  194. package/dist/lib/neutral/Ref.mjs +0 -25
  195. package/dist/lib/neutral/Ref.mjs.map +0 -7
  196. package/dist/lib/neutral/Registry.mjs +0 -14
  197. package/dist/lib/neutral/Registry.mjs.map +0 -7
  198. package/dist/lib/neutral/Relation.mjs +0 -97
  199. package/dist/lib/neutral/Relation.mjs.map +0 -7
  200. package/dist/lib/neutral/Scope.mjs +0 -12
  201. package/dist/lib/neutral/Scope.mjs.map +0 -7
  202. package/dist/lib/neutral/Tag.mjs +0 -32
  203. package/dist/lib/neutral/Tag.mjs.map +0 -7
  204. package/dist/lib/neutral/Text.mjs +0 -25
  205. package/dist/lib/neutral/Text.mjs.map +0 -7
  206. package/dist/lib/neutral/Type.mjs +0 -65
  207. package/dist/lib/neutral/Type.mjs.map +0 -7
  208. package/dist/lib/neutral/chunk-2HKGAQM4.mjs +0 -1394
  209. package/dist/lib/neutral/chunk-2HKGAQM4.mjs.map +0 -7
  210. package/dist/lib/neutral/chunk-2ZHECXUR.mjs +0 -95
  211. package/dist/lib/neutral/chunk-2ZHECXUR.mjs.map +0 -7
  212. package/dist/lib/neutral/chunk-3KTE2Y7Q.mjs +0 -336
  213. package/dist/lib/neutral/chunk-3KTE2Y7Q.mjs.map +0 -7
  214. package/dist/lib/neutral/chunk-3TN2VMI4.mjs +0 -714
  215. package/dist/lib/neutral/chunk-3TN2VMI4.mjs.map +0 -7
  216. package/dist/lib/neutral/chunk-42L4HJ3Z.mjs +0 -104
  217. package/dist/lib/neutral/chunk-42L4HJ3Z.mjs.map +0 -7
  218. package/dist/lib/neutral/chunk-4A2NWKRJ.mjs +0 -747
  219. package/dist/lib/neutral/chunk-4A2NWKRJ.mjs.map +0 -7
  220. package/dist/lib/neutral/chunk-7LOUAPYZ.mjs +0 -25
  221. package/dist/lib/neutral/chunk-7LOUAPYZ.mjs.map +0 -7
  222. package/dist/lib/neutral/chunk-ACFAOTKJ.mjs +0 -1531
  223. package/dist/lib/neutral/chunk-ACFAOTKJ.mjs.map +0 -7
  224. package/dist/lib/neutral/chunk-BEFR7LEA.mjs +0 -170
  225. package/dist/lib/neutral/chunk-BEFR7LEA.mjs.map +0 -7
  226. package/dist/lib/neutral/chunk-BXIKXT7Q.mjs +0 -89
  227. package/dist/lib/neutral/chunk-BXIKXT7Q.mjs.map +0 -7
  228. package/dist/lib/neutral/chunk-C57XMMBY.mjs +0 -206
  229. package/dist/lib/neutral/chunk-C57XMMBY.mjs.map +0 -7
  230. package/dist/lib/neutral/chunk-C62JYFAD.mjs +0 -183
  231. package/dist/lib/neutral/chunk-C62JYFAD.mjs.map +0 -7
  232. package/dist/lib/neutral/chunk-FSGX2R62.mjs +0 -48
  233. package/dist/lib/neutral/chunk-FSGX2R62.mjs.map +0 -7
  234. package/dist/lib/neutral/chunk-HBXT3GSB.mjs +0 -459
  235. package/dist/lib/neutral/chunk-HBXT3GSB.mjs.map +0 -7
  236. package/dist/lib/neutral/chunk-IQR45HAD.mjs +0 -31
  237. package/dist/lib/neutral/chunk-IQR45HAD.mjs.map +0 -7
  238. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  239. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  240. package/dist/lib/neutral/chunk-KCBW4BR6.mjs +0 -424
  241. package/dist/lib/neutral/chunk-KCBW4BR6.mjs.map +0 -7
  242. package/dist/lib/neutral/chunk-L3E5IXAE.mjs +0 -575
  243. package/dist/lib/neutral/chunk-L3E5IXAE.mjs.map +0 -7
  244. package/dist/lib/neutral/chunk-PRC4FEKJ.mjs +0 -56
  245. package/dist/lib/neutral/chunk-PRC4FEKJ.mjs.map +0 -7
  246. package/dist/lib/neutral/chunk-SCT6FFCR.mjs +0 -351
  247. package/dist/lib/neutral/chunk-SCT6FFCR.mjs.map +0 -7
  248. package/dist/lib/neutral/chunk-TOCVVFK2.mjs +0 -75
  249. package/dist/lib/neutral/chunk-TOCVVFK2.mjs.map +0 -7
  250. package/dist/lib/neutral/chunk-U53LSQQA.mjs +0 -41
  251. package/dist/lib/neutral/chunk-U53LSQQA.mjs.map +0 -7
  252. package/dist/lib/neutral/chunk-UGFFV2FR.mjs +0 -27
  253. package/dist/lib/neutral/chunk-UGFFV2FR.mjs.map +0 -7
  254. package/dist/lib/neutral/chunk-UWLP4RFM.mjs +0 -7
  255. package/dist/lib/neutral/chunk-UWLP4RFM.mjs.map +0 -7
  256. package/dist/lib/neutral/chunk-UZHCQ6NI.mjs +0 -283
  257. package/dist/lib/neutral/chunk-UZHCQ6NI.mjs.map +0 -7
  258. package/dist/lib/neutral/chunk-WISOH2XH.mjs +0 -36
  259. package/dist/lib/neutral/chunk-WISOH2XH.mjs.map +0 -7
  260. package/dist/lib/neutral/chunk-WKIT2YY5.mjs +0 -34
  261. package/dist/lib/neutral/chunk-WKIT2YY5.mjs.map +0 -7
  262. package/dist/lib/neutral/chunk-XB6ISRAO.mjs +0 -271
  263. package/dist/lib/neutral/chunk-XB6ISRAO.mjs.map +0 -7
  264. package/dist/lib/neutral/chunk-XXL42WCB.mjs +0 -84
  265. package/dist/lib/neutral/chunk-XXL42WCB.mjs.map +0 -7
  266. package/dist/lib/neutral/chunk-XXWK4J53.mjs +0 -117
  267. package/dist/lib/neutral/chunk-XXWK4J53.mjs.map +0 -7
  268. package/dist/lib/neutral/index.mjs +0 -115
  269. package/dist/lib/neutral/index.mjs.map +0 -7
  270. package/dist/lib/neutral/internal/index.mjs +0 -581
  271. package/dist/lib/neutral/internal/index.mjs.map +0 -7
  272. package/dist/lib/neutral/meta.json +0 -1
  273. package/dist/lib/neutral/testing/index.mjs +0 -477
  274. package/dist/lib/neutral/testing/index.mjs.map +0 -7
@@ -0,0 +1,660 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { c as getKeys$1, l as getMetaChecked, o as addTag$1, s as deleteKeys$1, u as removeTag$1 } from "./chunk-atom-snapshot.mjs";
3
+ import { A as isVersion$1, C as objectFromJSON, Ct as sortByLabel$1, D as compareVersions$1, M as versionValid$1, O as decodeVersion$1, St as sort$1, T as objectToJSON, Tt as VersionTypeId$1, U as makeObject, f as makeWithReactive, h as isDeleted$1, j as version$1, k as encodeVersion$1, l as makeLabelAtom, m as setValue$1, o as clone$1, p as getSnapshot$1, s as makeAtom, u as makeProperty, wt as sortByTypename$1 } from "./chunk-internal.mjs";
4
+ import { a as ANY_OBJECT_VERSION, i as ANY_OBJECT_TYPENAME } from "./chunk-util.mjs";
5
+ import { C as getBranch$1, Ct as getTypename$1, Dt as setLabel$1, Gt as MetaId, Lt as getType$1, Mt as ParentId, S as isInstanceOf, St as getTypeURI$1, T as getUri, Tt as setDescription$1, bt as getTypeAnnotation, ct as getDescription$1, ft as getIcon$1, mt as getLabelProperty, pt as getLabel$1, rt as TypeAnnotationId, w as getDatabase$1 } from "./chunk-Database.mjs";
6
+ import { GetReactiveError } from "./Err.mjs";
7
+ import { C as getProxyTarget, g as subscribe$1, h as change, w as isProxy } from "./chunk-ref.mjs";
8
+ import { getSchema } from "./Type.mjs";
9
+ import { Kind, KindId, SnapshotKindId } from "./Entity.mjs";
10
+ import { isRef } from "./Ref.mjs";
11
+ import { EntityId } from "@dxos/keys";
12
+ import * as Function from "effect/Function";
13
+ import * as Option from "effect/Option";
14
+ import * as Schema from "effect/Schema";
15
+ import { assertArgument, invariant } from "@dxos/invariant";
16
+ import { SchemaEx } from "@dxos/effect";
17
+ import { assumeType, deepMapValues } from "@dxos/util";
18
+ import * as Effect from "effect/Effect";
19
+ import * as Equal from "effect/Equal";
20
+ import * as Exit from "effect/Exit";
21
+ import * as Utils from "effect/Utils";
22
+ //#region src/Obj.ts
23
+ var Obj_exports = /* @__PURE__ */ __exportAll({
24
+ ID: () => ID,
25
+ Meta: () => Meta,
26
+ Parent: () => Parent,
27
+ Unknown: () => Unknown,
28
+ VersionTypeId: () => VersionTypeId,
29
+ addTag: () => addTag,
30
+ atom: () => atom,
31
+ atomProperty: () => atomProperty,
32
+ atomReactive: () => atomReactive,
33
+ clone: () => clone,
34
+ compareVersions: () => compareVersions,
35
+ decodeVersion: () => decodeVersion,
36
+ deleteKeys: () => deleteKeys,
37
+ encodeVersion: () => encodeVersion,
38
+ fromJSON: () => fromJSON,
39
+ getBranch: () => getBranch,
40
+ getDatabase: () => getDatabase,
41
+ getDescription: () => getDescription,
42
+ getIcon: () => getIcon,
43
+ getKeys: () => getKeys,
44
+ getLabel: () => getLabel,
45
+ getMeta: () => getMeta,
46
+ getParent: () => getParent,
47
+ getReactive: () => getReactive,
48
+ getReactiveOption: () => getReactiveOption,
49
+ getReactiveOrThrow: () => getReactiveOrThrow,
50
+ getReactiveOrUndefined: () => getReactiveOrUndefined,
51
+ getSnapshot: () => getSnapshot,
52
+ getType: () => getType,
53
+ getTypeURI: () => getTypeURI,
54
+ getTypename: () => getTypename,
55
+ getURI: () => getURI,
56
+ getValue: () => getValue,
57
+ getVersion: () => getVersion,
58
+ instanceOf: () => instanceOf,
59
+ isDeleted: () => isDeleted,
60
+ isObject: () => isObject,
61
+ isSnapshot: () => isSnapshot,
62
+ isVersion: () => isVersion,
63
+ labelAtom: () => labelAtom,
64
+ labelProperty: () => labelProperty,
65
+ make: () => make,
66
+ removeTag: () => removeTag,
67
+ setDescription: () => setDescription,
68
+ setLabel: () => setLabel,
69
+ setParent: () => setParent,
70
+ setValue: () => setValue,
71
+ snapshotOf: () => snapshotOf,
72
+ sort: () => sort,
73
+ sortByLabel: () => sortByLabel,
74
+ sortByTypename: () => sortByTypename,
75
+ subscribe: () => subscribe,
76
+ toJSON: () => toJSON,
77
+ update: () => update,
78
+ updateFrom: () => updateFrom,
79
+ version: () => version,
80
+ versionValid: () => versionValid
81
+ });
82
+ var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo/src/Obj.ts";
83
+ /**
84
+ * Runtime Effect schema for any ECHO object.
85
+ * Use for validation, parsing, or as a reference target for collections.
86
+ *
87
+ * NOTE: `Schema.is(Type.Obj)` does STRUCTURAL validation only (checks for `id` field).
88
+ * Use `Obj.isObject()` for proper ECHO instance type guards that check the KindId brand.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * // Structural type guard (accepts any object with id field)
93
+ * if (Schema.is(Type.Obj)(unknownValue)) { ... }
94
+ *
95
+ * // ECHO instance type guard (checks KindId brand)
96
+ * if (Obj.isObject(unknownValue)) { ... }
97
+ *
98
+ * // Reference to any object type
99
+ * class Collection extends Type.makeObject<Collection>(DXN.make('com.example.type.collection', '0.1.0'))(
100
+ * Schema.Struct({ objects: Schema.Array(Ref.Ref(Obj.Unknown)) }),
101
+ * ) {}
102
+ * ```
103
+ */
104
+ var Unknown = Schema.Struct({ id: Schema.String }).pipe(Schema.extend(Schema.Record({
105
+ key: Schema.String,
106
+ value: Schema.Unknown
107
+ })), Schema.annotations({ [TypeAnnotationId]: {
108
+ kind: Kind.Object,
109
+ typename: ANY_OBJECT_TYPENAME,
110
+ version: ANY_OBJECT_VERSION
111
+ } }));
112
+ var defaultMeta = () => ({
113
+ keys: [],
114
+ tags: [],
115
+ annotations: {}
116
+ });
117
+ function make(input, props) {
118
+ const schema = getSchema(input);
119
+ assertArgument(getTypeAnnotation(schema)?.kind === Kind.Object, "schema", "Expected an object schema");
120
+ let meta = void 0;
121
+ if (props[MetaId] != null) {
122
+ meta = {
123
+ ...defaultMeta(),
124
+ ...props[MetaId]
125
+ };
126
+ delete props[MetaId];
127
+ }
128
+ const filterUndefined = Object.fromEntries(Object.entries(props).filter(([_, v]) => v !== void 0));
129
+ for (const sym of Object.getOwnPropertySymbols(props)) {
130
+ const value = props[sym];
131
+ if (value !== void 0) filterUndefined[sym] = value;
132
+ }
133
+ return makeObject(schema, filterUndefined, {
134
+ ...defaultMeta(),
135
+ ...meta
136
+ }, input);
137
+ }
138
+ /**
139
+ * Determine if object is an ECHO object.
140
+ */
141
+ var isObject = (obj) => {
142
+ assumeType(obj);
143
+ return typeof obj === "object" && obj !== null && obj[KindId] === Kind.Object;
144
+ };
145
+ var isSnapshot = (obj) => {
146
+ assumeType(obj);
147
+ return typeof obj === "object" && obj !== null && obj[SnapshotKindId] === Kind.Object;
148
+ };
149
+ /**
150
+ * Subscribe to object updates.
151
+ * The callback is called synchronously when the object is modified.
152
+ * Only accepts reactive objects (not snapshots).
153
+ * @returns Unsubscribe function.
154
+ */
155
+ var subscribe = (obj, callback) => {
156
+ return subscribe$1(obj, callback);
157
+ };
158
+ /**
159
+ * Returns an immutable snapshot of an object.
160
+ * The snapshot is branded with SnapshotKindId instead of KindId,
161
+ * making it distinguishable from the reactive object at the type level.
162
+ */
163
+ var getSnapshot = getSnapshot$1;
164
+ /**
165
+ * Returns the reactive version of an object from the database, given its snapshot.
166
+ * Inverse of `Obj.getSnapshot`.
167
+ *
168
+ * Uses `Obj.getDatabase` internally to get the database from the snapshot,
169
+ * then resolves the reactive object by ID.
170
+ *
171
+ * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).
172
+ * @returns Effect that succeeds with the reactive object, or fails with `GetReactiveError`.
173
+ * @example
174
+ * ```ts
175
+ * const snapshot = Obj.getSnapshot(obj);
176
+ * const reactive = Obj.getReactive(snapshot).pipe(
177
+ * Effect.runSync
178
+ * );
179
+ * ```
180
+ */
181
+ var getReactive = (snapshot) => Effect.gen(function* () {
182
+ const db = getDatabase$1(snapshot);
183
+ if (!db) return yield* Effect.fail(new GetReactiveError({
184
+ reason: "no-database",
185
+ snapshotId: snapshot.id
186
+ }));
187
+ const obj = db.getObjectById(snapshot.id);
188
+ if (!obj) return yield* Effect.fail(new GetReactiveError({
189
+ reason: "object-not-found",
190
+ snapshotId: snapshot.id
191
+ }));
192
+ return obj;
193
+ });
194
+ /**
195
+ * Like `Obj.getReactive` but returns `Option.none()` instead of failing when the object
196
+ * cannot be resolved (no database, object not found).
197
+ *
198
+ * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).
199
+ * @returns Effect that succeeds with `Option.some(reactive)` or `Option.none()`.
200
+ */
201
+ var getReactiveOption = (snapshot) => getReactive(snapshot).pipe(Effect.map(Option.some), Effect.catchAll(() => Effect.succeed(Option.none())));
202
+ /**
203
+ * Synchronous version of `Obj.getReactive`. Returns the reactive object or throws
204
+ * `GetReactiveError` when the object cannot be resolved (no database, object not found).
205
+ *
206
+ * @param snapshot - A snapshot of the object (from `Obj.getSnapshot`).
207
+ * @returns The reactive object.
208
+ * @throws {Err.GetReactiveError} When the object cannot be resolved.
209
+ */
210
+ var getReactiveOrThrow = (snapshot) => Effect.runSync(getReactive(snapshot));
211
+ /**
212
+ * Synchronous version of `Obj.getReactive` that returns `undefined` instead of throwing.
213
+ * Accepts `undefined` input so callers can pass the result of `useObject` directly.
214
+ *
215
+ * @param snapshot - A snapshot of the object (from `Obj.getSnapshot` or `useObject`), or `undefined`.
216
+ * @returns The reactive object, or `undefined` if the snapshot is `undefined` or unresolvable.
217
+ */
218
+ var getReactiveOrUndefined = (snapshot) => {
219
+ if (snapshot === void 0) return;
220
+ return Effect.runSyncExit(getReactive(snapshot)).pipe(Exit.match({
221
+ onSuccess: (value) => value,
222
+ onFailure: () => void 0
223
+ }));
224
+ };
225
+ /**
226
+ * Clones an object or relation.
227
+ * This does not clone referenced objects, only the properties in the object.
228
+ * @returns A new object with the same schema and properties.
229
+ */
230
+ var clone = clone$1;
231
+ /**
232
+ * Perform mutations on an echo object within a controlled context.
233
+ *
234
+ * All mutations within the callback are batched and trigger a single notification
235
+ * when the callback completes. Direct mutations outside of `Obj.update` will throw
236
+ * an error for echo objects.
237
+ *
238
+ * This function also works with nested objects within echo objects (e.g., Template structs)
239
+ * that are reactive at runtime.
240
+ *
241
+ * @param obj - The echo object to mutate. Use `Relation.update` for relations.
242
+ * @param callback - The callback that performs mutations on the object.
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * const person = Obj.make(Person, { name: 'John', age: 25 });
247
+ *
248
+ * // Mutate within Obj.update
249
+ * Obj.update(person, (obj) => {
250
+ * obj.name = 'Jane';
251
+ * obj.age = 30;
252
+ * });
253
+ * // ONE notification fires here
254
+ *
255
+ * // Direct mutation throws
256
+ * person.name = 'Bob'; // Error: Cannot modify outside Obj.update()
257
+ * ```
258
+ *
259
+ * Note: Only accepts objects. Use `Relation.update` for relations.
260
+ */
261
+ var update = (obj, callback) => {
262
+ change(obj, callback);
263
+ return obj;
264
+ };
265
+ /**
266
+ * Get a deeply nested property from an object.
267
+ *
268
+ * Similar to lodash.get and getDeep from @dxos/util.
269
+ * This is the complementary function to setValue.
270
+ * Accepts both reactive objects and snapshots.
271
+ *
272
+ * @param obj - The ECHO object to get the property from.
273
+ * @param path - Path to the property (array of keys).
274
+ * @returns The value at the path, or undefined if not found.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * const person = Obj.make(Person, {
279
+ * name: 'John',
280
+ * addresses: [{ street: '123 Main St' }]
281
+ * });
282
+ *
283
+ * Obj.getValue(person, ['addresses', 0, 'street']); // '123 Main St'
284
+ * Obj.getValue(person, ['addresses', 1, 'street']); // undefined
285
+ * ```
286
+ */
287
+ var getValue = (obj, path) => {
288
+ return SchemaEx.getValue(obj, SchemaEx.createJsonPath(path));
289
+ };
290
+ /**
291
+ * Set a deeply nested property on an object, using the object's schema to determine
292
+ * whether to initialize nested data as an empty object or array.
293
+ *
294
+ * Similar to lodash.set and setDeep from @dxos/util, but schema-aware.
295
+ * Must be called within an `Obj.update` callback.
296
+ *
297
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
298
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
299
+ *
300
+ * @param obj - The mutable ECHO object to set the property on.
301
+ * @param path - Path to the property (array of keys).
302
+ * @param value - Value to set.
303
+ * @returns The value that was set.
304
+ *
305
+ * @example
306
+ * ```ts
307
+ * const person = Obj.make(Person, { name: 'John' });
308
+ * // Person schema has: addresses: Schema.Array(Address)
309
+ * Obj.update(person, (obj) => {
310
+ * Obj.setValue(obj, ['addresses', 0, 'street'], '123 Main St');
311
+ * });
312
+ * // Creates: person.addresses = [{ street: '123 Main St' }]
313
+ * ```
314
+ */
315
+ var setValue = setValue$1;
316
+ var ID = EntityId;
317
+ /**
318
+ * Test if an object is an instance of a given object type.
319
+ *
320
+ * @example
321
+ * ```ts
322
+ * const john = Obj.make(Person, { name: 'John' });
323
+ * const isPerson = Obj.instanceOf(Person);
324
+ * if (isPerson(john)) {
325
+ * // john is Person
326
+ * }
327
+ * ```
328
+ *
329
+ * Only accepts `Type.AnyObj` — use `Relation.instanceOf` for relations and
330
+ * `Type.isType(value)` to test for `Type.Type` meta-schema entities.
331
+ */
332
+ var instanceOf = ((...args) => {
333
+ if (args.length === 1) return (entity) => isInstanceOf(args[0], entity);
334
+ return isInstanceOf(args[0], args[1]);
335
+ });
336
+ /**
337
+ * Test if a snapshot is an instance of a schema.
338
+ * Mirrors `instanceOf` but only accepts values branded with SnapshotKindId.
339
+ * Use when the value is known to be a snapshot (e.g. from `getSnapshot` or `useObject`).
340
+ *
341
+ * @example
342
+ * ```ts
343
+ * const snapshot = Obj.getSnapshot(person);
344
+ * if (Obj.snapshotOf(Person, snapshot)) {
345
+ * // snapshot is Obj.Snapshot<Person>
346
+ * }
347
+ * ```
348
+ */
349
+ var snapshotOf = ((...args) => {
350
+ const check = (entity) => entity != null && typeof entity === "object" && SnapshotKindId in entity && isInstanceOf(args[0], entity);
351
+ if (args.length === 1) return (entity) => check(entity);
352
+ return check(args[1]);
353
+ });
354
+ /**
355
+ * Get the URI of the object.
356
+ * Accepts both reactive objects and snapshots.
357
+ *
358
+ * @param options.prefer - Controls the URI form (see {@link GetURIOptions}).
359
+ */
360
+ var getURI = (entity, options) => {
361
+ assertArgument(!Schema.isSchema(entity), "obj", "Object should not be a schema.");
362
+ return getUri(entity, options);
363
+ };
364
+ /**
365
+ * @returns The DXN of the object's type.
366
+ * @example dxn:com.example.type.person:1.0.0
367
+ * @throws If the object is missing its type (corrupted object).
368
+ */
369
+ var getTypeURI = (obj) => {
370
+ const type = getTypeURI$1(obj);
371
+ invariant(type != null, "Corrupted object: missing type.", {
372
+ "~LogMeta": "~LogMeta",
373
+ F: __dxlog_file,
374
+ L: 542,
375
+ S: void 0,
376
+ A: ["type != null", "'Corrupted object: missing type.'"]
377
+ });
378
+ return type;
379
+ };
380
+ /**
381
+ * Get the type entity (`Type.AnyObj`) the object was created from.
382
+ *
383
+ * Returns `undefined` when the object's type isn't registered in this runtime
384
+ * (e.g. a freshly deserialized snapshot whose type entity hasn't been wired
385
+ * up yet, or an object loaded from storage before its schema is known). To
386
+ * get the Effect Schema from the returned entity, use `Type.getSchema(...)`.
387
+ */
388
+ var getType = (obj) => getType$1(obj);
389
+ /**
390
+ * @returns The typename of the object's type.
391
+ * Accepts both reactive objects and snapshots.
392
+ * @example `com.example.type.person`
393
+ */
394
+ var getTypename = (entity) => getTypename$1(entity);
395
+ /**
396
+ * Get the database the object belongs to.
397
+ * Accepts both reactive objects and snapshots.
398
+ *
399
+ * @idiom org.dxos.echo.objGetDatabase
400
+ * applies: Reaching an object's database — to query, add, or remove — when the surrounding Space is not otherwise needed
401
+ * instead-of: `getSpace(obj)?.db` (resolving the whole Space just to read its `.db`)
402
+ * uses: {@link getDatabase}
403
+ */
404
+ var getDatabase = (entity) => getDatabase$1(entity);
405
+ /**
406
+ * Get the branch this object instance is bound to: `'main'` for the canonical object, or the branch of
407
+ * a `db.branch()` independent instance. The branch is a property of the instance — two instances of the
408
+ * same object id on different branches each report their own branch.
409
+ */
410
+ var getBranch = (obj) => getBranch$1(obj);
411
+ /**
412
+ * Get an immutable snapshot of the object at the given historical heads — a detached instance, not a
413
+ * pin on the live object. Only the surface that asks for it sees the historical value; the live
414
+ * object and every other surface are unaffected. The functional alternative to a read-time-travel pin.
415
+ */
416
+ var getVersion = (obj, heads) => {
417
+ const db = getDatabase(obj);
418
+ invariant(db, "object is not bound to a database", {
419
+ "~LogMeta": "~LogMeta",
420
+ F: __dxlog_file,
421
+ L: 594,
422
+ S: void 0,
423
+ A: ["db", "'object is not bound to a database'"]
424
+ });
425
+ return db.getVersion(obj, heads);
426
+ };
427
+ /**
428
+ * Property that accesses metadata for an entity.
429
+ *
430
+ * Alias for `Entity.Meta`.
431
+ */
432
+ var Meta = MetaId;
433
+ function getMeta(entity) {
434
+ return getMetaChecked(entity);
435
+ }
436
+ /**
437
+ * @returns Foreign keys for the object from the specified source.
438
+ * Accepts both reactive objects and snapshots.
439
+ */
440
+ var getKeys = Function.dual(2, (entity, source) => getKeys$1(entity, source));
441
+ /**
442
+ * Delete all keys from the object for the specified source.
443
+ * Must be called within an `Obj.update` callback.
444
+ *
445
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
446
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
447
+ */
448
+ var deleteKeys = (entity, source) => deleteKeys$1(entity, source);
449
+ /**
450
+ * Add a tag to the object.
451
+ * Must be called within an `Obj.update` callback.
452
+ *
453
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
454
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
455
+ */
456
+ var addTag = (entity, tag) => addTag$1(entity, tag);
457
+ /**
458
+ * Remove a tag from the object.
459
+ * Must be called within an `Obj.update` callback.
460
+ *
461
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
462
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
463
+ */
464
+ var removeTag = (entity, tag) => removeTag$1(entity, tag);
465
+ /**
466
+ * Check if the object is deleted.
467
+ * Accepts both reactive objects and snapshots.
468
+ */
469
+ var isDeleted = (entity) => isDeleted$1(entity);
470
+ /**
471
+ * Get the label of the object.
472
+ * Accepts both reactive objects and snapshots.
473
+ *
474
+ * @param options.fallback `'typename'` returns the object's typename when no
475
+ * label is set (e.g. `org.dxos.type.table`).
476
+ */
477
+ var getLabel = (entity, options) => getLabel$1(entity, options);
478
+ /**
479
+ * Set the label of the object.
480
+ * Must be called within an `Obj.update` callback.
481
+ *
482
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
483
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
484
+ */
485
+ var setLabel = (entity, label) => setLabel$1(entity, label);
486
+ /**
487
+ * Get the description of the object.
488
+ * Accepts both reactive objects and snapshots.
489
+ */
490
+ var getDescription = (entity) => getDescription$1(entity);
491
+ /**
492
+ * Get the icon annotation for the object (or any entity), resolved via its type-level
493
+ * `IconAnnotation`. Accepts both reactive entities and snapshots, and either Objects or
494
+ * Relations — the underlying schema-based lookup works for both.
495
+ *
496
+ * Returns the full `{ icon, hue }` annotation; callers wanting just the icon name typically
497
+ * write `Obj.getIcon(obj)?.icon ?? 'ph--cube--regular'`.
498
+ */
499
+ var getIcon = (entity) => getIcon$1(entity);
500
+ /**
501
+ * Set the description of the object.
502
+ * Must be called within an `Obj.update` callback.
503
+ *
504
+ * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`
505
+ * parameters, so there is no compile-time error. Enforcement is runtime-only.
506
+ */
507
+ var setDescription = (entity, description) => setDescription$1(entity, description);
508
+ /**
509
+ * Symbol to set parent when creating objects with `Obj.make`.
510
+ * @example
511
+ * ```ts
512
+ * Obj.make(TestSchema.Person, {
513
+ * [Obj.Parent]: parentObject,
514
+ * name: 'John',
515
+ * })
516
+ * ```
517
+ */
518
+ var Parent = ParentId;
519
+ /**
520
+ * Get the parent of an object.
521
+ * The parent is always loaded together with the object.
522
+ * Only objects are allowed to have a parent
523
+ * @returns The parent object, or undefined if the object has no parent.
524
+ */
525
+ var getParent = (entity) => {
526
+ assertArgument(isObject(entity) || isSnapshot(entity), "Expected an object");
527
+ assumeType(entity);
528
+ return entity[ParentId];
529
+ };
530
+ /**
531
+ * Sets the parent of an object.
532
+ * If a parent (or any transitive parent) is deleted, the object will be deleted.
533
+ * Only objects are allowed to have a parent.
534
+ */
535
+ var setParent = (entity, parent) => {
536
+ assertArgument(isObject(entity), "Expected an object");
537
+ assertArgument(parent === void 0 || isObject(parent), "Expected an object");
538
+ assumeType(entity);
539
+ assumeType(parent);
540
+ entity[ParentId] = parent;
541
+ return entity;
542
+ };
543
+ var valuesEqual = (left, right) => {
544
+ if (left === right) return true;
545
+ if (left === null || right === null) return left === right;
546
+ if (typeof left !== "object" || typeof right !== "object") return Utils.structuralRegion(() => Equal.equals(left, right));
547
+ if (isRef(left) && isRef(right)) return left.uri === right.uri;
548
+ if (isRef(left) || isRef(right)) return false;
549
+ if (Array.isArray(left) && Array.isArray(right)) {
550
+ if (left.length !== right.length) return false;
551
+ for (let index = 0; index < left.length; index++) if (!valuesEqual(left[index], right[index])) return false;
552
+ return true;
553
+ }
554
+ if (Array.isArray(left) || Array.isArray(right)) return false;
555
+ const leftRecord = left;
556
+ const rightRecord = right;
557
+ const keys = /* @__PURE__ */ new Set([...Object.keys(leftRecord).filter((key) => key !== "id"), ...Object.keys(rightRecord).filter((key) => key !== "id")]);
558
+ for (const key of keys) {
559
+ const leftHas = Object.hasOwn(leftRecord, key);
560
+ const rightHas = Object.hasOwn(rightRecord, key);
561
+ if (!valuesEqual(leftHas ? leftRecord[key] : void 0, rightHas ? rightRecord[key] : void 0)) return false;
562
+ }
563
+ return true;
564
+ };
565
+ /**
566
+ * Breaks reactive proxies on assigned values so echo-db assignment accepts nested structs (same idea as link assignment).
567
+ */
568
+ var prepareAssignValue = (value) => deepMapValues(value, (nested, recurse) => {
569
+ if (nested === null || typeof nested !== "object") return nested;
570
+ if (isRef(nested)) return nested;
571
+ if (Array.isArray(nested)) return recurse(nested);
572
+ if (isProxy(nested)) return recurse({ ...getProxyTarget(nested) });
573
+ return recurse(nested);
574
+ });
575
+ /**
576
+ * For each key present on `source` (except `id`), assigns `target[key]` when the current value differs.
577
+ * References are compared by target DXN; other values use Effect `Equal.equals` inside a structural region,
578
+ * with recursive comparison for arrays and plain object-shaped property bags (excluding `id`).
579
+ *
580
+ * Must be called within an `Obj.update` callback.
581
+ *
582
+ * @returns Whether any property was updated.
583
+ */
584
+ var updateFrom = (target, source, options) => {
585
+ assertArgument(isObject(target), "Expected an echo object target.");
586
+ assertArgument(isObject(source), "Expected an echo object source.");
587
+ let keys = Object.keys(source).filter((key) => key !== "id");
588
+ if (options?.include !== void 0) {
589
+ const include = new Set(options.include.map((key) => String(key)));
590
+ keys = keys.filter((key) => include.has(key));
591
+ }
592
+ if (options?.exclude !== void 0) {
593
+ const exclude = new Set(options.exclude.map((key) => String(key)));
594
+ keys = keys.filter((key) => !exclude.has(key));
595
+ }
596
+ let updated = false;
597
+ const sourceRecord = source;
598
+ const targetRecord = target;
599
+ for (const key of keys) {
600
+ if (!Object.hasOwn(sourceRecord, key)) continue;
601
+ const nextValue = sourceRecord[key];
602
+ if (valuesEqual(Object.hasOwn(targetRecord, key) ? targetRecord[key] : void 0, nextValue)) continue;
603
+ targetRecord[key] = prepareAssignValue(nextValue);
604
+ updated = true;
605
+ }
606
+ return updated;
607
+ };
608
+ /**
609
+ * Converts object to its JSON representation.
610
+ * Accepts both reactive objects and snapshots.
611
+ *
612
+ * The same algorithm is used when calling the standard `JSON.stringify(obj)` function.
613
+ */
614
+ var toJSON = (entity) => objectToJSON(entity);
615
+ /**
616
+ * Creates an object from its json representation, performing schema validation.
617
+ * References and schemas will be resolvable if the `refResolver` is provided.
618
+ *
619
+ * The function must be async to support resolving the schema as well as the relation endpoints.
620
+ *
621
+ * @param options.refResolver - Resolver for references. Produces hydrated references that can be resolved.
622
+ * @param options.uri - Override object URI. Changes the result of `Obj.getURI`.
623
+ * @param options.database - Database to associate with the object.
624
+ * @param options.parent - Parent entity to associate with the object (used when the JSON has no `@parent`). Changes the result of `Obj.getParent`.
625
+ */
626
+ var fromJSON = objectFromJSON;
627
+ var sortByLabel = sortByLabel$1;
628
+ var sortByTypename = sortByTypename$1;
629
+ var sort = (...comparators) => sort$1(...comparators);
630
+ var VersionTypeId = VersionTypeId$1;
631
+ var isVersion = isVersion$1;
632
+ var versionValid = versionValid$1;
633
+ var compareVersions = compareVersions$1;
634
+ var encodeVersion = encodeVersion$1;
635
+ var decodeVersion = decodeVersion$1;
636
+ /**
637
+ * Returns the version of the object.
638
+ * Accepts both reactive objects and snapshots.
639
+ */
640
+ var version = (entity) => version$1(entity);
641
+ /**
642
+ * Create a reactive snapshot atom for an ECHO object or ref.
643
+ * Use inside atom computations (e.g. `Atom.make((get) => get(Obj.atom(ref)))`) to subscribe
644
+ * to a ref's target — the atom re-fires when the target loads or changes.
645
+ *
646
+ * @idiom org.dxos.echo.objAtomReactive
647
+ * applies: Subscribing to a ref's target inside an atom computation or a non-React reactive context
648
+ * instead-of: `ref.target` — synchronous and not reactive; returns `undefined` when the target isn't loaded yet and never notifies when it becomes available
649
+ * uses: {@link atom}
650
+ * related: org.dxos.echo-react.useObjectReactive
651
+ */
652
+ var atom = makeAtom;
653
+ var atomReactive = makeWithReactive;
654
+ var atomProperty = makeProperty;
655
+ var labelAtom = makeLabelAtom;
656
+ var labelProperty = getLabelProperty;
657
+ //#endregion
658
+ export { ID, Meta, Parent, Unknown, VersionTypeId, addTag, atom, atomProperty, atomReactive, clone, compareVersions, decodeVersion, deleteKeys, encodeVersion, fromJSON, getBranch, getDatabase, getDescription, getIcon, getKeys, getLabel, getMeta, getParent, getReactive, getReactiveOption, getReactiveOrThrow, getReactiveOrUndefined, getSnapshot, getType, getTypeURI, getTypename, getURI, getValue, getVersion, instanceOf, isDeleted, isObject, isSnapshot, isVersion, labelAtom, labelProperty, make, removeTag, setDescription, setLabel, setParent, setValue, snapshotOf, sort, sortByLabel, sortByTypename, subscribe, Obj_exports as t, toJSON, update, updateFrom, version, versionValid };
659
+
660
+ //# sourceMappingURL=Obj.mjs.map