@dxos/echo 0.9.1-main.c7dcc2e112 → 0.9.1-staging.ee54ba693a

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 (278) hide show
  1. package/dist/lib/neutral/Annotation.mjs +22 -8
  2. package/dist/lib/neutral/Database.mjs +3 -3
  3. package/dist/lib/neutral/Entity.mjs +11 -11
  4. package/dist/lib/neutral/Err.mjs +7 -3
  5. package/dist/lib/neutral/Feed.mjs +15 -19
  6. package/dist/lib/neutral/Filter.mjs +13 -11
  7. package/dist/lib/neutral/Format.mjs +3 -7
  8. package/dist/lib/neutral/JsonSchema.mjs +7 -7
  9. package/dist/lib/neutral/Migration.mjs +11 -11
  10. package/dist/lib/neutral/Obj.mjs +15 -13
  11. package/dist/lib/neutral/Order.mjs +1 -1
  12. package/dist/lib/neutral/Query.mjs +17 -17
  13. package/dist/lib/neutral/QueryResult.mjs +1 -1
  14. package/dist/lib/neutral/Ref.mjs +6 -6
  15. package/dist/lib/neutral/Registry.mjs +1 -1
  16. package/dist/lib/neutral/Relation.mjs +12 -12
  17. package/dist/lib/neutral/Tag.mjs +15 -15
  18. package/dist/lib/neutral/Text.mjs +25 -0
  19. package/dist/lib/neutral/Text.mjs.map +7 -0
  20. package/dist/lib/neutral/Type.mjs +10 -10
  21. package/dist/lib/neutral/chunk-2HKGAQM4.mjs +1394 -0
  22. package/dist/lib/neutral/chunk-2HKGAQM4.mjs.map +7 -0
  23. package/dist/lib/neutral/{chunk-O6BH7EPN.mjs → chunk-2ZHECXUR.mjs} +5 -4
  24. package/dist/lib/neutral/chunk-2ZHECXUR.mjs.map +7 -0
  25. package/dist/lib/neutral/{chunk-AFANXSGV.mjs → chunk-3KTE2Y7Q.mjs} +20 -20
  26. package/dist/lib/neutral/chunk-3KTE2Y7Q.mjs.map +7 -0
  27. package/dist/lib/neutral/{chunk-WZ32BF53.mjs → chunk-3TN2VMI4.mjs} +49 -37
  28. package/dist/lib/neutral/chunk-3TN2VMI4.mjs.map +7 -0
  29. package/dist/lib/neutral/{chunk-E7IOTOZD.mjs → chunk-42L4HJ3Z.mjs} +11 -15
  30. package/dist/lib/neutral/chunk-42L4HJ3Z.mjs.map +7 -0
  31. package/dist/lib/neutral/{chunk-K3S7D5PR.mjs → chunk-4A2NWKRJ.mjs} +5 -5
  32. package/dist/lib/neutral/chunk-ACFAOTKJ.mjs +1531 -0
  33. package/dist/lib/neutral/chunk-ACFAOTKJ.mjs.map +7 -0
  34. package/dist/lib/neutral/{chunk-Z3WMRRAZ.mjs → chunk-BEFR7LEA.mjs} +11 -9
  35. package/dist/lib/neutral/{chunk-Z3WMRRAZ.mjs.map → chunk-BEFR7LEA.mjs.map} +1 -1
  36. package/dist/lib/neutral/{chunk-6M2Z6WBH.mjs → chunk-BXIKXT7Q.mjs} +2 -6
  37. package/dist/lib/neutral/{chunk-6M2Z6WBH.mjs.map → chunk-BXIKXT7Q.mjs.map} +1 -1
  38. package/dist/lib/neutral/{chunk-3JXQUMUI.mjs → chunk-C57XMMBY.mjs} +21 -20
  39. package/dist/lib/neutral/chunk-C57XMMBY.mjs.map +7 -0
  40. package/dist/lib/neutral/{chunk-JZ6LFQU5.mjs → chunk-C62JYFAD.mjs} +82 -8
  41. package/dist/lib/neutral/chunk-C62JYFAD.mjs.map +7 -0
  42. package/dist/lib/neutral/{chunk-TF5BSLF6.mjs → chunk-FSGX2R62.mjs} +3 -3
  43. package/dist/lib/neutral/chunk-FSGX2R62.mjs.map +7 -0
  44. package/dist/lib/neutral/{chunk-6CEISA3V.mjs → chunk-HBXT3GSB.mjs} +29 -15
  45. package/dist/lib/neutral/chunk-HBXT3GSB.mjs.map +7 -0
  46. package/dist/lib/neutral/{chunk-WU3GIANS.mjs → chunk-IQR45HAD.mjs} +1 -1
  47. package/dist/lib/neutral/chunk-IQR45HAD.mjs.map +7 -0
  48. package/dist/lib/neutral/{chunk-TFEWTY5A.mjs → chunk-KCBW4BR6.mjs} +4 -8
  49. package/dist/lib/neutral/chunk-KCBW4BR6.mjs.map +7 -0
  50. package/dist/lib/neutral/{chunk-4TPQZPLY.mjs → chunk-L3E5IXAE.mjs} +198 -30
  51. package/dist/lib/neutral/chunk-L3E5IXAE.mjs.map +7 -0
  52. package/dist/lib/neutral/{chunk-EVK6XBXO.mjs → chunk-PRC4FEKJ.mjs} +2 -2
  53. package/dist/lib/neutral/chunk-PRC4FEKJ.mjs.map +7 -0
  54. package/dist/lib/neutral/{chunk-NOL7O3BL.mjs → chunk-SCT6FFCR.mjs} +9 -4
  55. package/dist/lib/neutral/chunk-SCT6FFCR.mjs.map +7 -0
  56. package/dist/lib/neutral/{chunk-BBFJWWAV.mjs → chunk-TOCVVFK2.mjs} +26 -2
  57. package/dist/lib/neutral/chunk-TOCVVFK2.mjs.map +7 -0
  58. package/dist/lib/neutral/{chunk-A53NTBHE.mjs → chunk-U53LSQQA.mjs} +3 -3
  59. package/dist/lib/neutral/{chunk-A53NTBHE.mjs.map → chunk-U53LSQQA.mjs.map} +1 -1
  60. package/dist/lib/neutral/{chunk-PLDMJJJC.mjs → chunk-UGFFV2FR.mjs} +2 -2
  61. package/dist/lib/neutral/{chunk-35INCYOE.mjs → chunk-UWLP4RFM.mjs} +1 -1
  62. package/dist/lib/neutral/chunk-UWLP4RFM.mjs.map +7 -0
  63. package/dist/lib/neutral/{chunk-SZ5WB6HF.mjs → chunk-UZHCQ6NI.mjs} +13 -11
  64. package/dist/lib/neutral/{chunk-SZ5WB6HF.mjs.map → chunk-UZHCQ6NI.mjs.map} +3 -3
  65. package/dist/lib/neutral/{chunk-L3OBWBV2.mjs → chunk-WKIT2YY5.mjs} +2 -2
  66. package/dist/lib/neutral/{chunk-HGWQR5KH.mjs → chunk-XB6ISRAO.mjs} +27 -15
  67. package/dist/lib/neutral/chunk-XB6ISRAO.mjs.map +7 -0
  68. package/dist/lib/neutral/chunk-XXL42WCB.mjs +84 -0
  69. package/dist/lib/neutral/chunk-XXL42WCB.mjs.map +7 -0
  70. package/dist/lib/neutral/{chunk-5GAIWRQB.mjs → chunk-XXWK4J53.mjs} +27 -42
  71. package/dist/lib/neutral/chunk-XXWK4J53.mjs.map +7 -0
  72. package/dist/lib/neutral/index.mjs +30 -26
  73. package/dist/lib/neutral/internal/index.mjs +91 -69
  74. package/dist/lib/neutral/meta.json +1 -1
  75. package/dist/lib/neutral/testing/index.mjs +79 -60
  76. package/dist/lib/neutral/testing/index.mjs.map +3 -3
  77. package/dist/types/src/Annotation.d.ts +35 -1
  78. package/dist/types/src/Annotation.d.ts.map +1 -1
  79. package/dist/types/src/Collection.d.ts +9 -8
  80. package/dist/types/src/Collection.d.ts.map +1 -1
  81. package/dist/types/src/Database.d.ts +16 -0
  82. package/dist/types/src/Database.d.ts.map +1 -1
  83. package/dist/types/src/Dataset.d.ts +1 -16
  84. package/dist/types/src/Dataset.d.ts.map +1 -1
  85. package/dist/types/src/Err.d.ts +67 -0
  86. package/dist/types/src/Err.d.ts.map +1 -1
  87. package/dist/types/src/Feed.d.ts +56 -80
  88. package/dist/types/src/Feed.d.ts.map +1 -1
  89. package/dist/types/src/Filter.d.ts +9 -1
  90. package/dist/types/src/Filter.d.ts.map +1 -1
  91. package/dist/types/src/Hypergraph.d.ts +2 -9
  92. package/dist/types/src/Hypergraph.d.ts.map +1 -1
  93. package/dist/types/src/Migration.d.ts +1 -1
  94. package/dist/types/src/Migration.d.ts.map +1 -1
  95. package/dist/types/src/Obj.d.ts +31 -6
  96. package/dist/types/src/Obj.d.ts.map +1 -1
  97. package/dist/types/src/Order.d.ts +1 -1
  98. package/dist/types/src/Order.d.ts.map +1 -1
  99. package/dist/types/src/Query.d.ts +1 -1
  100. package/dist/types/src/Query.d.ts.map +1 -1
  101. package/dist/types/src/QueryResult.d.ts +2 -2
  102. package/dist/types/src/QueryResult.d.ts.map +1 -1
  103. package/dist/types/src/Ref.d.ts +8 -4
  104. package/dist/types/src/Ref.d.ts.map +1 -1
  105. package/dist/types/src/Registry.d.ts +1 -1
  106. package/dist/types/src/Relation.d.ts.map +1 -1
  107. package/dist/types/src/Tag.d.ts +11 -13
  108. package/dist/types/src/Tag.d.ts.map +1 -1
  109. package/dist/types/src/Text.d.ts +41 -0
  110. package/dist/types/src/Text.d.ts.map +1 -0
  111. package/dist/types/src/Text.test.d.ts +2 -0
  112. package/dist/types/src/Text.test.d.ts.map +1 -0
  113. package/dist/types/src/Type.d.ts +33 -20
  114. package/dist/types/src/Type.d.ts.map +1 -1
  115. package/dist/types/src/View.d.ts +8 -9
  116. package/dist/types/src/View.d.ts.map +1 -1
  117. package/dist/types/src/index.d.ts +1 -0
  118. package/dist/types/src/index.d.ts.map +1 -1
  119. package/dist/types/src/internal/Annotation/annotations.d.ts +9 -0
  120. package/dist/types/src/internal/Annotation/annotations.d.ts.map +1 -1
  121. package/dist/types/src/internal/Annotation/atoms.d.ts +14 -0
  122. package/dist/types/src/internal/Annotation/atoms.d.ts.map +1 -0
  123. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts +13 -0
  124. package/dist/types/src/internal/Annotation/entity-dictionary.d.ts.map +1 -1
  125. package/dist/types/src/internal/Entity/api.d.ts.map +1 -1
  126. package/dist/types/src/internal/Entity/guard.d.ts.map +1 -1
  127. package/dist/types/src/internal/Entity/model.d.ts +1 -1
  128. package/dist/types/src/internal/Entity/model.d.ts.map +1 -1
  129. package/dist/types/src/internal/Entity/object.d.ts +5 -1
  130. package/dist/types/src/internal/Entity/object.d.ts.map +1 -1
  131. package/dist/types/src/internal/Entity/relation.d.ts +7 -0
  132. package/dist/types/src/internal/Entity/relation.d.ts.map +1 -1
  133. package/dist/types/src/internal/Entity/type-uri.d.ts.map +1 -1
  134. package/dist/types/src/internal/Filter/index.d.ts +2 -0
  135. package/dist/types/src/internal/Filter/index.d.ts.map +1 -0
  136. package/dist/types/src/internal/Filter/match.d.ts +22 -0
  137. package/dist/types/src/internal/Filter/match.d.ts.map +1 -0
  138. package/dist/types/src/internal/Format/format.d.ts +0 -2
  139. package/dist/types/src/internal/Format/format.d.ts.map +1 -1
  140. package/dist/types/src/internal/Format/index.d.ts +2 -2
  141. package/dist/types/src/internal/Format/index.d.ts.map +1 -1
  142. package/dist/types/src/internal/Format/string.d.ts +0 -8
  143. package/dist/types/src/internal/Format/string.d.ts.map +1 -1
  144. package/dist/types/src/internal/Format/types.d.ts +2 -1
  145. package/dist/types/src/internal/Format/types.d.ts.map +1 -1
  146. package/dist/types/src/internal/Obj/atoms.d.ts +7 -3
  147. package/dist/types/src/internal/Obj/atoms.d.ts.map +1 -1
  148. package/dist/types/src/internal/Obj/clone.d.ts +2 -1
  149. package/dist/types/src/internal/Obj/clone.d.ts.map +1 -1
  150. package/dist/types/src/internal/Obj/create-object.d.ts +3 -4
  151. package/dist/types/src/internal/Obj/create-object.d.ts.map +1 -1
  152. package/dist/types/src/internal/Obj/json-serializer.d.ts.map +1 -1
  153. package/dist/types/src/internal/Query/index.d.ts +1 -0
  154. package/dist/types/src/internal/Query/index.d.ts.map +1 -1
  155. package/dist/types/src/internal/Query/query-result-effect.d.ts +9 -0
  156. package/dist/types/src/internal/Query/query-result-effect.d.ts.map +1 -0
  157. package/dist/types/src/internal/Ref/atoms.d.ts +1 -2
  158. package/dist/types/src/internal/Ref/atoms.d.ts.map +1 -1
  159. package/dist/types/src/internal/Ref/ref.d.ts +13 -6
  160. package/dist/types/src/internal/Ref/ref.d.ts.map +1 -1
  161. package/dist/types/src/internal/common/atom-snapshot.d.ts +8 -0
  162. package/dist/types/src/internal/common/atom-snapshot.d.ts.map +1 -0
  163. package/dist/types/src/internal/common/proxy/make-object.d.ts.map +1 -1
  164. package/dist/types/src/internal/common/proxy/proxy-types.d.ts +12 -0
  165. package/dist/types/src/internal/common/proxy/proxy-types.d.ts.map +1 -1
  166. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts +25 -0
  167. package/dist/types/src/internal/common/proxy/proxy-utils.d.ts.map +1 -1
  168. package/dist/types/src/internal/common/proxy/schema-validator.d.ts +5 -0
  169. package/dist/types/src/internal/common/proxy/schema-validator.d.ts.map +1 -1
  170. package/dist/types/src/internal/common/proxy/typed-handler.d.ts +17 -0
  171. package/dist/types/src/internal/common/proxy/typed-handler.d.ts.map +1 -1
  172. package/dist/types/src/internal/common/types/entity.d.ts +4 -4
  173. package/dist/types/src/internal/common/types/entity.d.ts.map +1 -1
  174. package/dist/types/src/internal/common/types/meta.d.ts +2 -4
  175. package/dist/types/src/internal/common/types/meta.d.ts.map +1 -1
  176. package/dist/types/src/internal/index.d.ts +1 -0
  177. package/dist/types/src/internal/index.d.ts.map +1 -1
  178. package/dist/types/src/testing/test-schema.d.ts +42 -171
  179. package/dist/types/src/testing/test-schema.d.ts.map +1 -1
  180. package/dist/types/tsconfig.tsbuildinfo +1 -1
  181. package/package.json +20 -13
  182. package/src/Annotation.test.ts +257 -10
  183. package/src/Annotation.ts +55 -6
  184. package/src/Collection.ts +10 -12
  185. package/src/Database.ts +22 -20
  186. package/src/Err.ts +22 -0
  187. package/src/Feed.ts +114 -141
  188. package/src/Filter.test.ts +38 -0
  189. package/src/Filter.ts +17 -3
  190. package/src/Hypergraph.ts +2 -11
  191. package/src/Migration.ts +1 -1
  192. package/src/Obj.test.ts +92 -12
  193. package/src/Obj.ts +36 -5
  194. package/src/Order.ts +3 -3
  195. package/src/Query.test.ts +2 -2
  196. package/src/Query.ts +16 -16
  197. package/src/QueryResult.ts +2 -2
  198. package/src/Ref.ts +12 -4
  199. package/src/Registry.ts +1 -1
  200. package/src/Relation.ts +1 -1
  201. package/src/Tag.ts +12 -16
  202. package/src/Text.test.ts +186 -0
  203. package/src/Text.ts +116 -0
  204. package/src/Type.test.ts +52 -24
  205. package/src/Type.ts +69 -31
  206. package/src/View.ts +22 -30
  207. package/src/index.ts +1 -1
  208. package/src/internal/Annotation/annotations.ts +15 -2
  209. package/src/internal/Annotation/atoms.ts +107 -0
  210. package/src/internal/Annotation/entity-dictionary.ts +40 -37
  211. package/src/internal/Entity/api.ts +1 -1
  212. package/src/internal/Entity/guard.ts +2 -1
  213. package/src/internal/Entity/model.ts +2 -2
  214. package/src/internal/Entity/object.ts +14 -1
  215. package/src/internal/Entity/relation.ts +19 -0
  216. package/src/internal/Entity/type-uri.ts +3 -1
  217. package/src/internal/Filter/index.ts +5 -0
  218. package/src/internal/Filter/match.ts +284 -0
  219. package/src/internal/Format/format.ts +0 -2
  220. package/src/internal/Format/index.ts +2 -2
  221. package/src/internal/Format/string.ts +0 -12
  222. package/src/internal/Format/types.ts +4 -2
  223. package/src/internal/JsonSchema/json-schema.test.ts +82 -54
  224. package/src/internal/Obj/atoms.ts +31 -18
  225. package/src/internal/Obj/clone.ts +61 -20
  226. package/src/internal/Obj/create-object.test.ts +3 -3
  227. package/src/internal/Obj/create-object.ts +3 -4
  228. package/src/internal/Obj/inspect.ts +1 -1
  229. package/src/internal/Obj/json-serializer.test.ts +7 -5
  230. package/src/internal/Obj/json-serializer.ts +1 -1
  231. package/src/internal/Obj/schema-validator.test.ts +53 -0
  232. package/src/internal/Obj/set-value.test.ts +29 -19
  233. package/src/internal/Query/index.ts +1 -0
  234. package/src/internal/Query/query-result-effect.ts +35 -0
  235. package/src/internal/Ref/atoms.ts +23 -3
  236. package/src/internal/Ref/ref.test.ts +8 -8
  237. package/src/internal/Ref/ref.ts +26 -20
  238. package/src/internal/common/atom-snapshot.ts +19 -0
  239. package/src/internal/common/proxy/make-object.ts +1 -1
  240. package/src/internal/common/proxy/proxy-types.ts +20 -0
  241. package/src/internal/common/proxy/proxy-utils.ts +37 -1
  242. package/src/internal/common/proxy/reactive-array.ts +3 -3
  243. package/src/internal/common/proxy/reactive.test.ts +1 -1
  244. package/src/internal/common/proxy/schema-validator.ts +181 -8
  245. package/src/internal/common/proxy/typed-handler.ts +254 -76
  246. package/src/internal/common/types/entity.ts +15 -7
  247. package/src/internal/index.ts +1 -0
  248. package/src/testing/test-schema.ts +75 -90
  249. package/dist/lib/neutral/chunk-35INCYOE.mjs.map +0 -7
  250. package/dist/lib/neutral/chunk-3JXQUMUI.mjs.map +0 -7
  251. package/dist/lib/neutral/chunk-4TPQZPLY.mjs.map +0 -7
  252. package/dist/lib/neutral/chunk-5GAIWRQB.mjs.map +0 -7
  253. package/dist/lib/neutral/chunk-6CEISA3V.mjs.map +0 -7
  254. package/dist/lib/neutral/chunk-AFANXSGV.mjs.map +0 -7
  255. package/dist/lib/neutral/chunk-BBFJWWAV.mjs.map +0 -7
  256. package/dist/lib/neutral/chunk-E7IOTOZD.mjs.map +0 -7
  257. package/dist/lib/neutral/chunk-EVK6XBXO.mjs.map +0 -7
  258. package/dist/lib/neutral/chunk-HGWQR5KH.mjs.map +0 -7
  259. package/dist/lib/neutral/chunk-JZ6LFQU5.mjs.map +0 -7
  260. package/dist/lib/neutral/chunk-NOL7O3BL.mjs.map +0 -7
  261. package/dist/lib/neutral/chunk-O6BH7EPN.mjs.map +0 -7
  262. package/dist/lib/neutral/chunk-TF5BSLF6.mjs.map +0 -7
  263. package/dist/lib/neutral/chunk-TFEWTY5A.mjs.map +0 -7
  264. package/dist/lib/neutral/chunk-VQYL2OQF.mjs +0 -2353
  265. package/dist/lib/neutral/chunk-VQYL2OQF.mjs.map +0 -7
  266. package/dist/lib/neutral/chunk-WU3GIANS.mjs.map +0 -7
  267. package/dist/lib/neutral/chunk-WZ32BF53.mjs.map +0 -7
  268. package/dist/lib/neutral/chunk-X3NUUON4.mjs +0 -184
  269. package/dist/lib/neutral/chunk-X3NUUON4.mjs.map +0 -7
  270. package/dist/types/src/exemplars.test.d.ts +0 -2
  271. package/dist/types/src/exemplars.test.d.ts.map +0 -1
  272. package/dist/types/src/hierarchy.test.d.ts +0 -2
  273. package/dist/types/src/hierarchy.test.d.ts.map +0 -1
  274. package/src/exemplars.test.ts +0 -21
  275. package/src/hierarchy.test.ts +0 -33
  276. /package/dist/lib/neutral/{chunk-K3S7D5PR.mjs.map → chunk-4A2NWKRJ.mjs.map} +0 -0
  277. /package/dist/lib/neutral/{chunk-PLDMJJJC.mjs.map → chunk-UGFFV2FR.mjs.map} +0 -0
  278. /package/dist/lib/neutral/{chunk-L3OBWBV2.mjs.map → chunk-WKIT2YY5.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Type.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\nimport type * as Types from 'effect/Types';\n\nimport { raise } from '@dxos/debug';\nimport { type EncodedReference } from '@dxos/echo-protocol';\nimport { assertArgument, invariant } from '@dxos/invariant';\nimport { DXN, EID, type EntityId, type URI } from '@dxos/keys';\n\nimport type * as Database from './Database';\nimport type * as EntityModule from './Entity';\nimport * as internal from './internal';\nimport * as typeInternal from './internal/Type';\nimport type * as RelationModule from './Relation';\n\n//\n// Internal types (not exported)\n//\n\n/**\n * Structural base shared by the three sibling type-entity interfaces\n * ({@link Obj}, {@link Relation}, {@link Type}). NOT exported — callers\n * should constrain on {@link AnyEntity} when they want \"any of the three\"\n * and on the specific kind interface otherwise.\n */\ninterface BaseTypeEntity<A> {\n /**\n * Entity-kind brand of the type-entity value itself — always `EntityKind.Type`.\n * The kind of instance the type *describes* lives on `[SchemaKindId]`\n * (Object / Relation / Type). Lets `Obj.isObject` / `Relation.isRelation`\n * reject type entities by a single `[KindId]` check.\n */\n readonly [internal.KindId]: internal.EntityKind.Type;\n\n /**\n * Object id. Like all ECHO entities, type entities always carry an id —\n * stamped at construction for in-memory (static) declarations and assigned by\n * the database once persisted. The id does NOT determine the entity's URI:\n * static types resolve to their typename DXN, persisted types to `echo:/<id>`\n * (see `getTypeURIFromSpecifier`).\n */\n readonly id: EntityId;\n\n readonly name?: string;\n // NOTE: `typename` / `version` are intentionally NOT fields on any type-entity\n // interface. Both static and persisted entities carry them in `EntityMeta`\n // (`key` / `version`); read them via `Type.getTypename(self)` /\n // `Type.getVersion(self)` — never as a direct property.\n readonly jsonSchema: internal.JsonSchemaType;\n readonly [InstancePhantomId]?: A;\n}\n\n//\n// Obj — `Type.Type` value for an ECHO object schema.\n//\n\n/**\n * TypeScript type for an ECHO object type — a `Type.Type<A>` entity.\n *\n * `T` is the instance type produced by `Obj.make(Foo, props)`. `Fields` is\n * retained as a structural hint (the runtime value still carries `.fields`),\n * but consumers should derive instance/encoded types via `Type.InstanceType`.\n *\n * **Not a `Schema.Schema`.** `Foo.ast` / `Schema.Schema.Type<typeof Foo>` /\n * `Schema.extend(Foo)` no longer typecheck — extract the Effect Schema via\n * `Type.getSchema(Foo)` first, or derive instance types via\n * `Type.InstanceType<typeof Foo>`.\n *\n * @example\n * ```ts\n * class Person extends Type.makeObject<Person>(DXN.make('com.example.type.person', '0.1.0'))(\n * Schema.Struct({ name: Schema.String }),\n * ) {}\n * ```\n */\nexport interface Obj<T, Fields extends Schema.Struct.Fields = Schema.Struct.Fields> extends BaseTypeEntity<\n T & EntityModule.OfKind<typeof EntityModule.Kind.Object>\n> {\n /** Schema-kind brand (object). */\n readonly [internal.SchemaKindId]: internal.EntityKind.Object;\n\n /** Source Effect Schema — used internally by `Type.getSchema(self)`. */\n readonly [internal.StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;\n\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Return type for {@link makeObject}.\n *\n * Not to be used directly, but must be exported for typescript to infer the type.\n */\nexport interface ObjClass<Self, T, Fields extends Schema.Struct.Fields> extends Obj<Self, Fields> {\n new (_: never): T & EntityModule.OfKind<typeof EntityModule.Kind.Object>;\n}\n\n/**\n * Type that represents any ECHO object type — a `Type.Type` entity branded\n * with the object entity kind, i.e. what `Type.makeObject(dxn)` produces.\n */\nexport type AnyObj = Obj<unknown>;\n\n/**\n * Factory function to create an ECHO object type.\n *\n * Returns a `Type.Type` entity — a live, in-memory `TypeSchema` instance,\n * NOT a `Schema.Schema`. Use `Type.InstanceType<typeof Foo>` for the instance\n * type and `Type.getSchema(Foo)` to obtain the underlying Effect Schema.\n *\n * The entity's id defaults to `EntityId.deterministic(typename, version)` so\n * constructing a type never reaches `crypto.getRandomValues()` — required for\n * Cloudflare workerd, which forbids RNG calls in global (module-evaluation)\n * scope. Pass `{ id }` to override (e.g. with `EntityId.random()` from a\n * request handler).\n *\n * Giving the type a nominal class name keeps its inferred type portable for\n * declaration emit: structural expansion (which can pull in unnameable union\n * members from referenced schemas) is replaced by a reference to the class.\n *\n * @example\n * ```ts\n * export class Person extends Type.makeObject<Person>(DXN.make('com.example.type.myType', '0.1.0'))(Schema.Struct({\n * name: Schema.String,\n * })) {}\n * ```\n */\n// TODO(burdon): Require { typename, version } in options.\nexport const makeObject: {\n <Self>(\n dxn: DXN.DXN,\n options?: { id?: EntityId },\n ): <_Schema extends Schema.Schema.Any>(schema: _Schema) => ObjClass<Self, Schema.Schema.Type<_Schema>, {}>;\n // Boundary cast: overload implementation bodies cannot access outer generic params (`Self`),\n // so TypeScript cannot verify that makeObjectType's return matches the declared ObjClass<Self,…>.\n} = (dxn, options) => (schema) => internal.makeObjectType(dxn, schema, options) as any;\n\n//\n// Type — the ECHO entity that holds a schema and metadata.\n// Persisted via `db.addType()`; subscribed to via `Filter.type(Type.Type)`.\n//\n\n/**\n * ECHO meta-schema entity — stores `{ name?, typename, version, jsonSchema }`.\n * Type-kind sibling of `Type.makeObject(...)` / `Type.makeRelation(...)` outputs.\n * Stored types live under this entity; filter via `Filter.type(Type.Type)`.\n */\nexport const Type: Type<typeInternal.TypeSchema> = typeInternal.TypeSchema as any;\n\n/**\n * Default version stamped on draft (unnamed) types created via\n * {@link makeObjectFromJsonSchema} / {@link makeRelationFromJsonSchema} when\n * the caller does not supply one. Pure dynamic drafts surface as `'0.0.0'`\n * until they are persisted, at which point automerge-heads suffix the version.\n */\nconst DRAFT_VERSION = '0.0.0';\n\n/**\n * Common props shared by the type-kind factories. Typename and version are\n * optional — drafts omit typename and default version to {@link DRAFT_VERSION}.\n */\ntype MakeTypeProps = {\n jsonSchema: internal.JsonSchemaType;\n typename?: string;\n version?: string;\n name?: string;\n id?: EntityId;\n};\n\n/**\n * Construct a new object-kind type entity from raw metadata — for cases where\n * an Effect Schema isn't available (e.g. JSON-Schema arriving over the network\n * or from a UI editor). Parallel to {@link makeObject} but takes pre-built\n * `jsonSchema` instead of piping through an Effect schema.\n *\n * The returned entity is in-memory; persist it with `db.addType(entity)`.\n */\nexport const makeObjectFromJsonSchema = (props: MakeTypeProps): Type<typeInternal.TypeSchema> => {\n const { typename, version, ...data } = props;\n // `typename` / `version` are routed through `EntityMeta` (`key` / `version`)\n // — the canonical registry-provenance pair — not data fields. Drafts default\n // to `'0.0.0'`; the version is omitted from meta entirely when the caller\n // doesn't supply one so the proxy projection can apply its own default.\n return internal.makeObject(\n internal.getStaticTypeSchema(typeInternal.TypeSchema) as any,\n data as any,\n {\n keys: [],\n key: typename,\n version: version ?? DRAFT_VERSION,\n },\n typeInternal.TypeSchema,\n ) as unknown as Type<typeInternal.TypeSchema>;\n};\n\n/**\n * Construct a new relation-kind type entity from raw metadata. Parallel to\n * {@link makeRelation} but takes pre-built `jsonSchema` instead of piping\n * through an Effect schema. `source` / `target` accept either a static\n * `Type.Obj` entity or the well-known `Obj.Unknown` schema.\n *\n * The returned entity is in-memory; persist it with `db.addType(entity)`.\n */\nexport const makeRelationFromJsonSchema = (\n props: MakeTypeProps & {\n source: AnyObj | internal.UnknownTypeSchema<any, typeof EntityModule.Kind.Object>;\n target: AnyObj | internal.UnknownTypeSchema<any, typeof EntityModule.Kind.Object>;\n },\n): Type<typeInternal.TypeSchema> => {\n const { source, target, jsonSchema, typename, version, ...rest } = props;\n // Embed source/target DXNs + relation entity-kind into the jsonSchema so the\n // entity round-trips correctly through `toEffectSchema` / queries / refs.\n const sourceURI = internal.getTypeURIFromSpecifier(source);\n const targetURI = internal.getTypeURIFromSpecifier(target);\n const enrichedJsonSchema: internal.JsonSchemaType = {\n ...jsonSchema,\n entityKind: internal.EntityKind.Relation,\n relationSource: { $ref: sourceURI },\n relationTarget: { $ref: targetURI },\n };\n // `typename` / `version` route through `EntityMeta` (see\n // {@link makeObjectFromJsonSchema}); drafts default version to `'0.0.0'`.\n return internal.makeObject(\n internal.getStaticTypeSchema(typeInternal.TypeSchema) as any,\n { ...rest, jsonSchema: enrichedJsonSchema } as any,\n {\n keys: [],\n key: typename,\n version: version ?? DRAFT_VERSION,\n },\n typeInternal.TypeSchema,\n ) as unknown as Type<typeInternal.TypeSchema>;\n};\n\n/**\n * TypeScript type for an ECHO relation type — a `Type.Type<A>` entity.\n *\n * `T` is the instance-property type produced by `Relation.make(...)` (excluding\n * source/target endpoints). `Source` and `Target` are the endpoint types.\n *\n * **Not a `Schema.Schema`.** See {@link Obj}'s note.\n */\nexport interface Relation<\n T,\n Source,\n Target,\n Fields extends Schema.Struct.Fields = Schema.Struct.Fields,\n> extends BaseTypeEntity<\n RelationModule.Endpoints<Source, Target> & T & EntityModule.OfKind<typeof EntityModule.Kind.Relation>\n> {\n /** Schema-kind brand (relation). */\n readonly [internal.SchemaKindId]: internal.EntityKind.Relation;\n\n /** Source Effect Schema — used internally by `Type.getSchema(self)`. */\n readonly [internal.StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;\n\n /**\n * The fields defined in the original struct schema.\n * Allows accessing field definitions for introspection.\n */\n readonly fields: Fields;\n}\n\n/**\n * Return type for {@link makeRelation}.\n *\n * Not to be used directly, but must be exported for typescript to infer the type.\n */\nexport interface RelationClass<Self, T, Source, Target, Fields extends Schema.Struct.Fields> extends Relation<\n Self,\n Source,\n Target,\n Fields\n> {\n new (_: never): RelationModule.Endpoints<Source, Target> & T & EntityModule.OfKind<typeof EntityModule.Kind.Relation>;\n}\n\n/**\n * Type that represents any ECHO relation type — a `Type.Type` entity branded\n * with the relation entity kind, i.e. what `Type.makeRelation(...)` produces.\n */\nexport type AnyRelation = Relation<unknown, unknown, unknown>;\n\n/**\n * Factory function to create an ECHO relation schema.\n * Adds relation metadata annotations to an Effect schema.\n *\n * @example\n * ```ts\n * class WorksFor extends Type.makeRelation<WorksFor>(DXN.make('com.example.type.worksFor', '0.1.0'))(\n * { source: Person, target: Company },\n * )(Schema.Struct({ role: Schema.String })) {}\n * ```\n */\nexport const makeRelation: {\n <Self>(dxn: DXN.DXN): <SourceInstance, TargetInstance>(opts: {\n source: Obj<SourceInstance, any> | internal.UnknownTypeSchema<SourceInstance, typeof EntityModule.Kind.Object>;\n target: Obj<TargetInstance, any> | internal.UnknownTypeSchema<TargetInstance, typeof EntityModule.Kind.Object>;\n /**\n * Override the entity id. Defaults to `EntityId.deterministic(typename, version)`;\n * see `Type.makeObject` for the workerd motivation.\n */\n id?: EntityId;\n }) => <_Schema extends Schema.Schema.Any>(\n schema: _Schema,\n ) => RelationClass<\n Self,\n Schema.Schema.Type<_Schema>,\n SourceInstance & EntityModule.OfKind<typeof EntityModule.Kind.Object>,\n TargetInstance & EntityModule.OfKind<typeof EntityModule.Kind.Object>,\n {}\n >;\n} = (dxn) => (opts) => (schema) =>\n // Boundary cast: makeRelationType erases generic params since the constructor/prototype\n // wiring cannot thread them through the type system.\n internal.makeRelationType({\n dxn,\n source: opts.source,\n target: opts.target,\n schema,\n id: opts.id,\n }) as any;\n\n/**\n * Type that represents any ECHO type-kind entity — a `Type.Type` meta-schema\n * value (static `Type.Type` or a persisted draft from `db.addType(...)`).\n * Mirrors {@link AnyObj} / {@link AnyRelation} for the third sibling kind.\n */\nexport type AnyType = Type<unknown>;\n\n/**\n * Any ECHO type-entity — one of the three sibling kinds: object-kind, relation-kind,\n * or type-kind (the meta-schema). APIs that want \"any ECHO type\" use this union;\n * the underlying Effect Schema is retrieved via `Type.getSchema`.\n */\nexport type AnyEntity = AnyObj | AnyRelation | AnyType;\n\n/**\n * Type guard: narrows a `Type.AnyEntity` to an object-kind entity. Checks\n * ENTITIES, not instances — use `Obj.isObject` for instances. Raw\n * `Schema.Schema` values (including the branded `Obj.Unknown` companion)\n * are intentionally not accepted; inspect their `TypeAnnotation` directly.\n */\nexport const isObject = (entity: AnyEntity): entity is AnyObj => {\n return internal.getSchemaKind(entity) === internal.EntityKind.Object;\n};\n\n/**\n * Type guard: narrows a `Type.AnyEntity` to a relation-kind entity. Checks\n * ENTITIES, not instances — use `Relation.isRelation` for instances.\n */\nexport const isRelation = (entity: AnyEntity): entity is AnyRelation => {\n return internal.getSchemaKind(entity) === internal.EntityKind.Relation;\n};\n\n/**\n * Type guard: narrows a `Type.AnyEntity` to the type-kind meta-schema\n * (e.g. `Type.Type`). Mirrors {@link isObject} / {@link isRelation}.\n */\nexport const isTypeKind = (entity: AnyEntity): entity is Type => {\n return internal.getSchemaKind(entity) === internal.EntityKind.Type;\n};\n\n/**\n * Narrow a `Type.AnyEntity` (e.g. one returned from `schemaRegistry.query(...)`)\n * to `AnyObj`, throwing if it describes a relation or the type-kind\n * meta-schema. Use at call sites that need to pass the value to `Obj.make`,\n * `Filter.type`, or other object-only APIs.\n */\nexport const assertObject = (entity: AnyEntity): AnyObj => {\n assertArgument(isObject(entity), 'entity', 'Expected an object-kind Type entity.');\n return entity;\n};\n\n/** Narrow a `Type.AnyEntity` to `AnyRelation`, throwing otherwise. */\nexport const expectRelation = (entity: AnyEntity): AnyRelation => {\n assertArgument(isRelation(entity), 'entity', 'Expected a relation-kind Type entity.');\n return entity;\n};\n\n/** Narrow a `Type.AnyEntity` to the `Type.Type` meta-schema, throwing otherwise. */\nexport const expectTypeKind = (entity: AnyEntity): Type => {\n assertArgument(isTypeKind(entity), 'entity', 'Expected a type-kind Type entity.');\n return entity;\n};\n\n/**\n * Type that represents any Ref schema (with unknown target type).\n * This is a schema type, not an instance type.\n */\nexport type AnyRef = Schema.Schema<internal.Ref<any>, EncodedReference>;\n\n//\n// Schema utility functions\n//\n\n/**\n * Returns the URI identifying a type entity. Always defined.\n *\n * - Static `Type.Obj` / `Type.Relation` → typename DXN (e.g. `dxn:com.example.type.person:0.1.0`).\n * - Persisted `Type.Type` instance (has `id`) → local `EID` (`echo:/<objectId>`).\n * - In-memory `Type.Type` draft (has `id`, no typename) → local `EID`.\n *\n * When `options.prefer === 'named'` the result is forced to a DXN — for\n * persisted type entities the typename + version from meta are used to\n * construct the DXN; static types already return a DXN by default.\n *\n * Only accepts `Type.AnyEntity` entities. Raw `Schema.Schema` values and the\n * branded `Obj.Unknown` / `Relation.Unknown` schemas are intentionally not\n * supported — use `internal.getSchemaURI` or the schema's typename annotation\n * directly when working at the schema level.\n */\nexport const getURI = (input: AnyEntity, options?: internal.GetURIOptions): URI.URI => {\n // For Type entities, route through `getTypeURIFromSpecifier` (id → EID,\n // typename/version → DXN). For Obj/Relation entities, unwrap to the source\n // Effect Schema first and read its annotations.\n if (isType(input)) {\n const uri = internal.getTypeURIFromSpecifier(input);\n if (options?.prefer === 'named' && !DXN.isDXN(uri)) {\n // Persisted type — the auto-detected URI is an EID, but caller wants a\n // DXN. Construct from typename + version (both live in EntityMeta).\n const typename = getTypename(input);\n const version = getMeta(input).version;\n if (typename && version) {\n return DXN.make(typename, version);\n }\n }\n return uri;\n }\n return internal.getSchemaURI(getSchema(input)) ?? raise(new TypeError('Type entity has no URI'));\n};\n\n/**\n * @returns The typename. Example: `com.example.type.person`.\n *\n * Persisted `Type.Type` entities carry typename in `EntityMeta.key` (the\n * canonical registry-provenance field); unnamed drafts fall back to the\n * entity's object id so the helper always returns a string. Any `dxn:` or\n * `echo:/` prefix is stripped — typename is a bare identifier, not a URI.\n */\n// TODO(wittjosiah): For in-database types this should return the object id once the registry\n// has more robust options for shadowing types (so callers can disambiguate db-stored copies).\nexport const getTypename = (input: AnyEntity): string => {\n // Both in-memory and in-database entities carry typename in `EntityMeta.key`\n // — the canonical registry-provenance field. In-memory entities attach meta\n // eagerly (see `makeEchoTypeSchema`), so a single meta-backed read covers\n // both forms.\n const meta = internal.getMetaChecked(input);\n let typename: string | undefined = meta.key as string | undefined;\n // `meta.key` is a denormalized copy of the typename. The authoritative source\n // for a type entity is its `jsonSchema.typename` (`getSchema` rebuilds the\n // Effect Schema from `jsonSchema`). A type loaded from a snapshot can arrive\n // with `meta.key` absent (the meta round-trip dropped the denormalized copy)\n // while `jsonSchema.typename` is always present — consult it before the\n // last-resort id fallback so callers never receive a bare object id where a\n // typename is expected (e.g. `Filter.typename`, which rejects non-typenames).\n if (typename == null) {\n typename = input.jsonSchema?.typename;\n }\n // Unnamed drafts (no meta.key, no jsonSchema typename) fall back to the id.\n typename ??= input.id as string;\n // Typename is a bare identifier — strip URI prefixes if a caller seeded\n // meta.key with one accidentally (or if a static entity carries a DXN-\n // style typename).\n typename = stripTypenamePrefix(typename);\n invariant(typeof typename === 'string' && typename.length > 0, 'Invalid typename');\n return typename;\n};\n\n/**\n * Gets the version.\n * @example 0.1.0\n * @example 0.1.0-<heads> (in-database, versioned by automerge heads)\n *\n * The registry-provenance semver lives in `EntityMeta.version`; unversioned\n * drafts default to {@link DRAFT_VERSION} (`'0.0.0'`). In-database entities are\n * additionally versioned by their automerge heads, which are exposed as the\n * semver pre-release tag (`<semver>-<heads>`). In-memory declarations have no\n * heads and surface the bare semver. Read the registry semver alone via\n * `Type.getMeta(input).version`.\n */\nexport const getVersion = (input: AnyEntity): string => {\n const meta = internal.getMetaChecked(input);\n // As with `getTypename`: `meta.version` is a denormalized copy; the\n // authoritative semver lives in `jsonSchema.version`. Prefer meta, fall back\n // to jsonSchema (always present on persisted types, survives serialization),\n // then to `DRAFT_VERSION` for unversioned drafts.\n const semver = (meta.version as string | undefined) ?? input.jsonSchema?.version ?? DRAFT_VERSION;\n invariant(typeof semver === 'string' && semver.match(/^\\d+\\.\\d+\\.\\d+$/), 'Invalid version');\n // In-database entities are versioned by their automerge heads; expose them as\n // the semver pre-release tag. In-memory drafts carry no heads → bare semver.\n const heads = internal.version(input).automergeHeads;\n if (heads != null && heads.length > 0) {\n return `${semver}-${[...heads].sort().join('.')}`;\n }\n return semver;\n};\n\n/**\n * Strip URI prefixes (`dxn:`, `echo:/`, `echo://`) from a typename string.\n * Typename is a bare identifier — callers reading from meta or from a\n * caller-supplied seed value shouldn't propagate URI prefixes downstream.\n */\nconst stripTypenamePrefix = (value: string): string => {\n if (value.startsWith('dxn:')) {\n return value.slice('dxn:'.length);\n }\n if (value.startsWith('echo://')) {\n return value.slice('echo://'.length);\n }\n if (value.startsWith('echo:/')) {\n return value.slice('echo:/'.length);\n }\n return value;\n};\n\n/**\n * Type predicate: true iff the value is any type-kind ECHO entity — a static\n * `Type.Obj` / `Type.Relation` produced by `Type.makeObject` / `Type.makeRelation`, a\n * static meta `Type.Type`, or a persisted `Type.Type` returned by the database.\n *\n * All three branches stamp `[KindId] = Type`, so this is a single brand check.\n * Use {@link isObject} / {@link isRelation} / {@link isTypeKind}\n * when you need to discriminate further; use {@link getDatabase} when you mean\n * \"is this a db-attached type\" (vs. an in-memory declaration).\n */\nexport const isType = (value: unknown): value is AnyEntity =>\n internal.getEntityKindBrand(value) === internal.EntityKind.Type;\n\n/**\n * Get the database the type entity belongs to, or `undefined` if it is an\n * in-memory declaration (`Type.makeObject` / `Type.makeRelation` result) not\n * yet attached to a database. Mirrors `Obj.getDatabase` / `Relation.getDatabase`.\n *\n * Database attachment is the canonical discriminator between in-memory and\n * in-database type entities — both are live reactive `TypeSchema` instances and\n * are otherwise indistinguishable.\n */\nexport const getDatabase = (input: AnyEntity): Database.Database | undefined => internal.getDatabase(input);\n\n/**\n * Mutable meta type returned by `Type.getMeta` inside a `Type.update` callback.\n * Mirrors `Obj.Meta` / `Relation.Meta` — `Type.Type` is an Entity like its\n * siblings, so its meta is the same `EntityMeta` record:\n * `{ keys, tags?, key?, version? }`.\n *\n * `key` / `version` here are the canonical registry-provenance pair\n * (typename + semver) on persisted Type.Type entities; they are absent on\n * unnamed drafts. Use {@link getTypename} / {@link getVersion} when you want\n * a non-`undefined` value with id / {@link DRAFT_VERSION} fallbacks.\n */\nexport type Meta = internal.Meta;\n\n/**\n * Deeply read-only version of {@link Meta}.\n * Prevents mutation at all nesting levels (e.g., `meta.keys.push()` is a TS error).\n */\nexport type ReadonlyMeta = internal.ReadonlyMeta;\n\n/**\n * Returns the entity's `EntityMeta`. Same semantics as `Obj.getMeta` /\n * `Relation.getMeta` — `Type.Type` is an Entity and carries the canonical\n * `EntityMeta` directly. Returns mutable meta when passed a mutable type\n * (inside a `Type.update` callback), read-only meta otherwise.\n *\n * For persisted Type entities, `meta.key` holds the typename and\n * `meta.version` holds the semver. Use {@link getTypename} / {@link getVersion}\n * if you want the helpers' id / {@link DRAFT_VERSION} fallbacks for drafts.\n *\n * Both persisted and in-memory type entities (`Type.makeObject` /\n * `Type.makeRelation` results) carry their `EntityMeta` via `[MetaId]`, so the\n * lookup is uniform.\n */\nexport function getMeta(entity: internal.Mutable<AnyEntity>): Meta;\nexport function getMeta(entity: Mutable): Meta;\nexport function getMeta(entity: AnyEntity): ReadonlyMeta;\nexport function getMeta(entity: AnyEntity | internal.Mutable<AnyEntity> | Mutable): ReadonlyMeta | Meta {\n // The `Mutable` overload accepts the narrowed view passed to `Type.update`\n // callbacks; at runtime that draft IS the underlying persisted Type entity,\n // so the same `MetaId` lookup works.\n assertArgument(isType(entity), 'entity', 'Expected a Type entity.');\n // Both persisted and in-memory type entities carry runtime `EntityMeta` via\n // `[MetaId]`, so the lookup is uniform.\n return internal.getMetaChecked(entity);\n}\n\n/**\n * Get the display label of a type entity.\n * Reads the field(s) nominated by the type's {@link LabelAnnotation} (e.g. `name` on persisted schemas).\n * Returns `undefined` if no label field is populated.\n */\nexport const getLabel = (entity: AnyEntity, options?: internal.GetLabelOptions): string | undefined =>\n internal.getLabel(entity, options);\n\n/**\n * String key used to phantom-carry the instance type produced by a `Type.Type`.\n * Used by `Type.InstanceType<typeof Foo>` to recover the schema instance type\n * since `Type.makeObject(dxn)` does not return a `Schema.Schema`.\n *\n * Re-exported from the internal types layer so both `Type.ts` and internal\n * helpers (`makeObject`, `createObject`) reference the same phantom key.\n */\nexport const InstancePhantomId = internal.InstancePhantomId;\nexport type InstancePhantomId = internal.InstancePhantomId;\n\n/**\n * Sibling of {@link Obj} / {@link Relation} for the third ECHO entity kind:\n * **type-kind** entities (meta-schemas). The singleton {@link Type} const is\n * the canonical example — it describes stored type definitions themselves.\n *\n * Not a `Schema.Schema`. Use `Type.getSchema(value)` to obtain the underlying\n * Effect Schema and `Type.update(value, draft => ...)` to mutate.\n *\n * `A` is the instance-type phantom — what `Obj.make(value, ...)` would produce.\n * Merged with the `Type` const value via TypeScript declaration merging.\n */\nexport interface Type<A = unknown> extends BaseTypeEntity<A & EntityModule.OfKind<typeof EntityModule.Kind.Type>> {\n /** Schema-kind brand (type — the meta-schema kind). */\n readonly [internal.SchemaKindId]: internal.EntityKind.Type;\n\n /** Source Effect Schema — used internally by `Type.getSchema(self)`. */\n readonly [internal.StaticTypeSchemaSlot]: Schema.Schema.AnyNoContext;\n}\n\n/**\n * Instance type produced by a Type entity.\n *\n * Accepts ONLY {@link AnyEntity} inputs — `Type.Obj`, `Type.Relation`, or\n * `Type.Type`. Raw Effect `Schema.Schema` values are rejected: for those, use\n * `Schema.Schema.Type<typeof Foo>` directly. This separation keeps the type\n * system honest about which values represent ECHO entities versus plain\n * Effect schemas.\n *\n * Dispatches on the entity kind:\n * - `Relation<Props, S, T>` → `Endpoints<S,T> & Props & OfKind<Relation>`\n * - `Obj<A>` → `A & OfKind<Object>`\n * - `Type<A>` → `A & OfKind<Type>`\n */\nexport type InstanceType<T extends AnyEntity> =\n T extends RelationClass<any, infer Props, infer Source, infer Target, any>\n ? RelationModule.Endpoints<Source, Target> & Props & EntityModule.OfKind<typeof EntityModule.Kind.Relation>\n : T extends Relation<infer Props, infer Source, infer Target, any>\n ? RelationModule.Endpoints<Source, Target> & Props & EntityModule.OfKind<typeof EntityModule.Kind.Relation>\n : T extends ObjClass<any, infer A, any>\n ? A & EntityModule.OfKind<typeof EntityModule.Kind.Object>\n : T extends Obj<infer A, any>\n ? A & EntityModule.OfKind<typeof EntityModule.Kind.Object>\n : T extends Type<infer A>\n ? A & EntityModule.OfKind<typeof EntityModule.Kind.Type>\n : never;\n\n/**\n * Returns the Effect Schema for a type entity.\n *\n * - For static `Type.Obj` / `Type.Relation` entities the source Effect Schema is\n * read from a hidden slot — these overloads preserve the instance type.\n * - For `Type.Type` entities (the meta-schema kind) the schema is rebuilt from\n * `type.jsonSchema`; the instance type isn't statically knowable so the wide\n * `AnyEntity` overload widens to `Schema.Schema.AnyNoContext`.\n *\n * Always call this when you need to interact with the Effect Schema API\n * (e.g. before passing to Effect.Schema functions). For ECHO-side APIs\n * (`Obj.make`, `Filter.type`, `Ref`) pass the type entity directly.\n *\n * Only accepts `Type.AnyEntity` — raw `Schema.Schema` values can be used\n * directly without unwrapping.\n */\nexport function getSchema<T extends AnyObj>(type: T): Schema.Schema<InstanceType<T>>;\nexport function getSchema<T extends AnyRelation>(type: T): Schema.Schema<InstanceType<T>>;\nexport function getSchema(type: AnyEntity): Schema.Schema.AnyNoContext;\nexport function getSchema(type: AnyEntity): Schema.Schema.AnyNoContext {\n // Static `Type.Type` entities carry the source Effect Schema on a hidden\n // slot so we can return it without round-tripping through JsonSchema.\n const staticSchema = internal.getStaticTypeSchema(type);\n if (staticSchema != null) {\n return staticSchema;\n }\n assertArgument(isType(type), 'type', 'Expected a Type entity.');\n // Persisted `Type.Type` entity — build the Effect Schema from its stored\n // jsonSchema and re-attach the TypeIdentifierAnnotation so the rebuilt\n // schema's URI (via getSchemaURI) matches the entity's local EID.\n const rebuilt = internal.toEffectSchema(type.jsonSchema);\n if (typeof type.id === 'string') {\n return rebuilt.annotations({\n [internal.TypeIdentifierAnnotationId]: EID.make({ entityId: type.id }),\n });\n }\n return rebuilt;\n}\n\n/**\n * Mutable view of a `Type.Type` — the shape passed to the `Type.update` callback.\n * Outside `Type.update`, `Type.Type` fields are read-only (both at the type level\n * and at runtime — direct assignment throws). Use this to constrain mutation to\n * the change context, analogous to `Obj.update(obj, (draft) => ...)`.\n *\n * NOTE: `typename` and `version` are intentionally absent — they live in\n * `EntityMeta` (`key` / `version` — the canonical registry-provenance pair).\n * Read them via {@link getTypename} / {@link getVersion} / {@link getMeta};\n * `typename` is treated as immutable on persisted entities.\n *\n * Unlike `Obj.update` — whose mutable view is inferred as `Mutable<A>` over the\n * whole instance type because every data field is editable — a `Type.Type`\n * exposes only `name` and `jsonSchema` for mutation. The rest of its shape\n * (`id`, the `[KindId]` / `[SchemaKindId]` brands, and `typename` / `version`\n * in meta) is immutable, so this view is declared explicitly rather than\n * derived from `InstanceType<Type.Type>`.\n */\nexport interface Mutable {\n name?: string;\n // Deep-mutable within the change context — `Type.update`'s purpose is to allow\n // mutation, so the draft exposes `jsonSchema` as writable (the readonly\n // `JsonSchemaType` would force callers to cast).\n jsonSchema: Types.DeepMutable<internal.JsonSchemaType>;\n}\n\n/**\n * Perform mutations on a `Type.Type` within a change context.\n *\n * The callback receives a {@link Mutable} view of the type — direct mutation of\n * a `Type.Type` outside `Type.update` throws at runtime, mirroring `Obj.update`.\n * Delegates to the same automerge-transaction primitive `Obj.update(obj, cb)` uses.\n */\nexport const update = (type: AnyEntity, callback: (mutable: Mutable) => void): void => {\n // `Type.Type` is an ECHO object; the change machinery is the same as `Obj.update`.\n internal.change(type, callback as internal.ChangeCallback<AnyEntity>);\n};\n\n//\n// Field-level helpers for mutating persisted types.\n// These are thin wrappers over `Type.update` plus the JsonSchema manipulation\n// utilities. Callers pass a persisted `Type.Type` (e.g. one returned by\n// `db.addType(schemaEntity)`) and the helper drives the change context.\n//\n\n/**\n * Add fields to a persisted type's schema.\n * @throws if the type is not persisted.\n */\nexport const addFields = (type: AnyEntity, fields: Schema.Struct.Fields): void => {\n const extended = typeInternal.addFieldsToSchema(getSchema(type), fields);\n update(type, (draft) => {\n draft.jsonSchema = internal.toJsonSchema(extended);\n });\n};\n\n/**\n * Replace existing fields on a persisted type's schema.\n * @throws if the type is not persisted.\n */\nexport const updateFields = (type: AnyEntity, fields: Schema.Struct.Fields): void => {\n const updated = typeInternal.updateFieldsInSchema(getSchema(type), fields);\n update(type, (draft) => {\n draft.jsonSchema = internal.toJsonSchema(updated);\n });\n};\n\n/**\n * Rename a field on a persisted type's schema.\n * @throws if the type is not persisted.\n */\nexport const updateFieldPropertyName = (\n type: Type,\n { before, after }: { before: PropertyKey; after: PropertyKey },\n): void => {\n const renamed = typeInternal.updateFieldNameInSchema(getSchema(type), { before, after });\n update(type, (draft) => {\n draft.jsonSchema = internal.toJsonSchema(renamed);\n });\n};\n\n/**\n * Remove fields from a persisted type's schema.\n * @throws if the type is not persisted.\n */\nexport const removeFields = (type: AnyEntity, fieldNames: string[]): void => {\n const removed = typeInternal.removeFieldsFromSchema(getSchema(type), fieldNames);\n update(type, (draft) => {\n draft.jsonSchema = internal.toJsonSchema(removed);\n });\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["InstancePhantomId", "getDatabase", "getLabel", "makeObject", "raise", "assertArgument", "invariant", "DXN", "EID", "makeObject", "version", "typename", "typeInternal", "enrichedJsonSchema", "entityKind", "EntityKind", "relationSource", "sourceURI", "relationTarget", "keys", "internal", "makeRelationType", "source", "target", "schema", "id", "opts", "entity", "options", "prefer", "make", "heads", "join", "semver", "value", "startsWith", "getDatabase", "InstancePhantomId", "staticSchema", "assertArgument", "annotations", "TypeIdentifierAnnotationId", "entityId", "change", "callback", "type", "draft", "extended", "updated", "before", "after", "update", "removed"]
7
+ }
@@ -0,0 +1,84 @@
1
+ import {
2
+ getValue
3
+ } from "./chunk-HBXT3GSB.mjs";
4
+ import {
5
+ getProxyHandler,
6
+ getProxyTarget,
7
+ isProxy
8
+ } from "./chunk-L3E5IXAE.mjs";
9
+ import {
10
+ TextEditNotFoundError,
11
+ TextNotSupportedError
12
+ } from "./chunk-TOCVVFK2.mjs";
13
+ import {
14
+ __export
15
+ } from "./chunk-J5LGTIGS.mjs";
16
+
17
+ // src/Text.ts
18
+ var Text_exports = {};
19
+ __export(Text_exports, {
20
+ apply: () => apply,
21
+ splice: () => splice,
22
+ update: () => update
23
+ });
24
+ var update = (obj, path, newText) => {
25
+ const { handler, target } = resolve(obj, "update");
26
+ if (typeof handler.textUpdate !== "function") {
27
+ throw new TextNotSupportedError("update");
28
+ }
29
+ handler.textUpdate(target, normalizePath(path), newText);
30
+ };
31
+ var splice = (obj, path, start, deleteCount, insert = "") => {
32
+ const { handler, target } = resolve(obj, "splice");
33
+ if (typeof handler.textSplice !== "function") {
34
+ throw new TextNotSupportedError("splice");
35
+ }
36
+ return handler.textSplice(target, normalizePath(path), start, deleteCount, insert);
37
+ };
38
+ var apply = (obj, path, edits) => {
39
+ const keyPath = normalizePath(path);
40
+ for (const edit of edits) {
41
+ const text = getValue(obj, keyPath) ?? "";
42
+ if (edit.oldString == null || edit.oldString.length === 0) {
43
+ splice(obj, keyPath, text.length, 0, edit.newString);
44
+ continue;
45
+ }
46
+ if (edit.replaceAll) {
47
+ let idx = text.indexOf(edit.oldString);
48
+ while (idx !== -1) {
49
+ splice(obj, keyPath, idx, edit.oldString.length, edit.newString);
50
+ const updated = getValue(obj, keyPath) ?? "";
51
+ idx = updated.indexOf(edit.oldString, idx + edit.newString.length);
52
+ }
53
+ } else {
54
+ const idx = text.indexOf(edit.oldString);
55
+ if (idx === -1) {
56
+ throw new TextEditNotFoundError(edit.oldString);
57
+ }
58
+ splice(obj, keyPath, idx, edit.oldString.length, edit.newString);
59
+ }
60
+ }
61
+ return getValue(obj, keyPath) ?? "";
62
+ };
63
+ var normalizePath = (path) => typeof path === "string" || typeof path === "number" ? [
64
+ path
65
+ ] : path;
66
+ var resolve = (obj, operation) => {
67
+ if (!isProxy(obj)) {
68
+ throw new TextNotSupportedError(operation);
69
+ }
70
+ const handler = getProxyHandler(obj);
71
+ const target = getProxyTarget(obj);
72
+ return {
73
+ handler,
74
+ target
75
+ };
76
+ };
77
+
78
+ export {
79
+ update,
80
+ splice,
81
+ apply,
82
+ Text_exports
83
+ };
84
+ //# sourceMappingURL=chunk-XXL42WCB.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Text.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Err from './Err';\nimport * as internal from './internal';\nimport * as Obj from './Obj';\n\n/**\n * A key path addressing a string value within an object, mirroring `Obj.getValue` / `Obj.setValue`.\n */\nexport type KeyPath = readonly (string | number)[];\n\n/**\n * A single find/replace edit applied to a string field. When `oldString` is missing or empty the\n * `newString` is appended to the end of the current value.\n */\nexport type Edit = {\n oldString?: string;\n newString: string;\n replaceAll?: boolean;\n};\n\n/**\n * Replace the string CRDT value at `path` with `newText`.\n *\n * For database-backed objects the change is applied as a minimal Automerge diff (preserving cursors,\n * anchors, and merging cleanly with concurrent edits); for in-memory objects it is a plain assignment.\n *\n * Must be called inside `Obj.update(obj, () => { ... })`.\n */\nexport const update = (obj: Obj.Unknown, path: KeyPath | string | number, newText: string): void => {\n const { handler, target } = resolve(obj, 'update');\n if (typeof handler.textUpdate !== 'function') {\n throw new Err.TextNotSupportedError('update');\n }\n handler.textUpdate(target, normalizePath(path), newText);\n};\n\n/**\n * Splice the string CRDT value at `path` by character index, mirroring `Array.prototype.splice`:\n * remove `deleteCount` characters at `start` and insert `insert`. Returns the removed substring.\n *\n * Must be called inside `Obj.update(obj, () => { ... })`.\n */\nexport const splice = (\n obj: Obj.Unknown,\n path: KeyPath | string | number,\n start: number,\n deleteCount: number,\n insert = '',\n): string => {\n const { handler, target } = resolve(obj, 'splice');\n if (typeof handler.textSplice !== 'function') {\n throw new Err.TextNotSupportedError('splice');\n }\n return handler.textSplice(target, normalizePath(path), start, deleteCount, insert);\n};\n\n/**\n * Apply a sequence of find/replace {@link Edit}s to the string value at `path`, returning the resulting\n * full string. Implemented on top of {@link splice} so it works for both backends.\n *\n * An edit with a missing or empty `oldString` appends its `newString`. A non-`replaceAll` edit whose\n * `oldString` is not found throws {@link Err.TextEditNotFoundError}.\n *\n * Must be called inside `Obj.update(obj, () => { ... })`.\n */\nexport const apply = (obj: Obj.Unknown, path: KeyPath | string | number, edits: readonly Edit[]): string => {\n const keyPath = normalizePath(path);\n for (const edit of edits) {\n const text: string = Obj.getValue(obj, keyPath) ?? '';\n if (edit.oldString == null || edit.oldString.length === 0) {\n // Append: an empty match would loop forever in `replaceAll`, so treat it as an append instead.\n splice(obj, keyPath, text.length, 0, edit.newString);\n continue;\n }\n\n if (edit.replaceAll) {\n let idx = text.indexOf(edit.oldString);\n while (idx !== -1) {\n splice(obj, keyPath, idx, edit.oldString.length, edit.newString);\n const updated: string = Obj.getValue(obj, keyPath) ?? '';\n // Resume past the inserted text so a `newString` that contains `oldString` is not re-matched.\n idx = updated.indexOf(edit.oldString, idx + edit.newString.length);\n }\n } else {\n const idx = text.indexOf(edit.oldString);\n if (idx === -1) {\n throw new Err.TextEditNotFoundError(edit.oldString);\n }\n splice(obj, keyPath, idx, edit.oldString.length, edit.newString);\n }\n }\n\n return Obj.getValue(obj, keyPath) ?? '';\n};\n\nconst normalizePath = (path: KeyPath | string | number): KeyPath =>\n typeof path === 'string' || typeof path === 'number' ? [path] : path;\n\n/**\n * Resolve the reactive handler and raw target for `obj`. The handler is shared between the in-memory\n * and database-backed proxy systems, so this is the single dispatch seam for both backends. Snapshots\n * and non-reactive values are not proxies and cannot be edited.\n */\nconst resolve = (obj: Obj.Unknown, operation: string) => {\n if (!internal.isProxy(obj)) {\n throw new Err.TextNotSupportedError(operation);\n }\n const handler = internal.getProxyHandler(obj);\n const target = internal.getProxyTarget(obj);\n return { handler, target };\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;AAiCO,IAAMA,SAAS,CAACC,KAAkBC,MAAiCC,YAAAA;AACxE,QAAM,EAAEC,SAASC,OAAM,IAAKC,QAAQL,KAAK,QAAA;AACzC,MAAI,OAAOG,QAAQG,eAAe,YAAY;AAC5C,UAAM,IAAQC,sBAAsB,QAAA;EACtC;AACAJ,UAAQG,WAAWF,QAAQI,cAAcP,IAAAA,GAAOC,OAAAA;AAClD;AAQO,IAAMO,SAAS,CACpBT,KACAC,MACAS,OACAC,aACAC,SAAS,OAAE;AAEX,QAAM,EAAET,SAASC,OAAM,IAAKC,QAAQL,KAAK,QAAA;AACzC,MAAI,OAAOG,QAAQU,eAAe,YAAY;AAC5C,UAAM,IAAQN,sBAAsB,QAAA;EACtC;AACA,SAAOJ,QAAQU,WAAWT,QAAQI,cAAcP,IAAAA,GAAOS,OAAOC,aAAaC,MAAAA;AAC7E;AAWO,IAAME,QAAQ,CAACd,KAAkBC,MAAiCc,UAAAA;AACvE,QAAMC,UAAUR,cAAcP,IAAAA;AAC9B,aAAWgB,QAAQF,OAAO;AACxB,UAAMG,OAAmBC,SAASnB,KAAKgB,OAAAA,KAAY;AACnD,QAAIC,KAAKG,aAAa,QAAQH,KAAKG,UAAUC,WAAW,GAAG;AAEzDZ,aAAOT,KAAKgB,SAASE,KAAKG,QAAQ,GAAGJ,KAAKK,SAAS;AACnD;IACF;AAEA,QAAIL,KAAKM,YAAY;AACnB,UAAIC,MAAMN,KAAKO,QAAQR,KAAKG,SAAS;AACrC,aAAOI,QAAQ,IAAI;AACjBf,eAAOT,KAAKgB,SAASQ,KAAKP,KAAKG,UAAUC,QAAQJ,KAAKK,SAAS;AAC/D,cAAMI,UAAsBP,SAASnB,KAAKgB,OAAAA,KAAY;AAEtDQ,cAAME,QAAQD,QAAQR,KAAKG,WAAWI,MAAMP,KAAKK,UAAUD,MAAM;MACnE;IACF,OAAO;AACL,YAAMG,MAAMN,KAAKO,QAAQR,KAAKG,SAAS;AACvC,UAAII,QAAQ,IAAI;AACd,cAAM,IAAQG,sBAAsBV,KAAKG,SAAS;MACpD;AACAX,aAAOT,KAAKgB,SAASQ,KAAKP,KAAKG,UAAUC,QAAQJ,KAAKK,SAAS;IACjE;EACF;AAEA,SAAWH,SAASnB,KAAKgB,OAAAA,KAAY;AACvC;AAEA,IAAMR,gBAAgB,CAACP,SACrB,OAAOA,SAAS,YAAY,OAAOA,SAAS,WAAW;EAACA;IAAQA;AAOlE,IAAMI,UAAU,CAACL,KAAkB4B,cAAAA;AACjC,MAAI,CAAUC,QAAQ7B,GAAAA,GAAM;AAC1B,UAAM,IAAQO,sBAAsBqB,SAAAA;EACtC;AACA,QAAMzB,UAAmB2B,gBAAgB9B,GAAAA;AACzC,QAAMI,SAAkB2B,eAAe/B,GAAAA;AACvC,SAAO;IAAEG;IAASC;EAAO;AAC3B;",
6
+ "names": ["update", "obj", "path", "newText", "handler", "target", "resolve", "textUpdate", "TextNotSupportedError", "normalizePath", "splice", "start", "deleteCount", "insert", "textSplice", "apply", "edits", "keyPath", "edit", "text", "getValue", "oldString", "length", "newString", "replaceAll", "idx", "indexOf", "updated", "TextEditNotFoundError", "operation", "isProxy", "getProxyHandler", "getProxyTarget"]
7
+ }
@@ -1,15 +1,17 @@
1
1
  import {
2
2
  getURI,
3
3
  make
4
- } from "./chunk-6CEISA3V.mjs";
4
+ } from "./chunk-HBXT3GSB.mjs";
5
5
  import {
6
6
  makeObject
7
- } from "./chunk-HGWQR5KH.mjs";
7
+ } from "./chunk-XB6ISRAO.mjs";
8
8
  import {
9
9
  FormInputAnnotation,
10
10
  HiddenAnnotation,
11
- IconAnnotation
12
- } from "./chunk-WZ32BF53.mjs";
11
+ IconAnnotation,
12
+ Service,
13
+ makeQueryResultEffect
14
+ } from "./chunk-3TN2VMI4.mjs";
13
15
  import {
14
16
  __export
15
17
  } from "./chunk-J5LGTIGS.mjs";
@@ -20,7 +22,6 @@ __export(Feed_exports, {
20
22
  ContextFeedService: () => ContextFeedService,
21
23
  Feed: () => Feed,
22
24
  FeedService: () => FeedService,
23
- Service: () => Service,
24
25
  append: () => append,
25
26
  cursor: () => cursor,
26
27
  getQueueUri: () => getQueueUri,
@@ -31,41 +32,39 @@ __export(Feed_exports, {
31
32
  notAvailable: () => notAvailable,
32
33
  query: () => query,
33
34
  remove: () => remove,
34
- runQuery: () => runQuery,
35
35
  setRetention: () => setRetention,
36
36
  sync: () => sync
37
37
  });
38
38
  import * as Context from "effect/Context";
39
39
  import * as Effect from "effect/Effect";
40
+ import * as Function from "effect/Function";
40
41
  import * as Layer from "effect/Layer";
41
42
  import * as Schema from "effect/Schema";
42
43
  import { DXN, EID } from "@dxos/keys";
43
- var Feed = Schema.Struct({
44
+ var Feed = class extends makeObject(DXN.make("org.dxos.type.feed", "0.1.0"))(Schema.Struct({
44
45
  /** User-facing display name. */
45
46
  name: Schema.String.pipe(Schema.optional),
46
47
  /** Identifier for the feed's kind (e.g., plugin id). */
47
48
  kind: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
48
49
  /**
49
- * Feed namespace.
50
- * Controls how feed data is stored and replicated.
51
- * - `data`: Data feed (default).
52
- * - `trace`: Trace feed.
53
- */
50
+ * Feed namespace.
51
+ * Controls how feed data is stored and replicated.
52
+ * - `data`: Data feed (default).
53
+ * - `trace`: Trace feed.
54
+ */
54
55
  namespace: Schema.optional(Schema.Literal("data", "trace"))
55
56
  }).pipe(HiddenAnnotation.set(true), IconAnnotation.set({
56
57
  icon: "ph--rows--regular",
57
58
  hue: "yellow"
58
- }), makeObject(DXN.make("org.dxos.type.feed", "0.1.0")));
59
- var make2 = (props = {}) => make(Feed, props);
60
- var getQueueUri = (feed) => EID.tryParse(getURI(feed));
61
- var FeedService = class extends Context.Tag("@dxos/echo/Feed/FeedService")() {
59
+ }))) {
62
60
  };
63
- var Service = FeedService;
64
61
  var ContextFeedService = class _ContextFeedService extends Context.Tag("@dxos/echo/Feed/ContextFeedService")() {
65
62
  static layer = (feed) => Layer.succeed(_ContextFeedService, {
66
63
  feed
67
64
  });
68
65
  };
66
+ var FeedService = class extends Context.Tag("@dxos/echo/Feed/FeedService")() {
67
+ };
69
68
  var notAvailable = Layer.succeed(FeedService, {
70
69
  append: () => {
71
70
  throw new Error("Feed.FeedService not available");
@@ -83,25 +82,13 @@ var notAvailable = Layer.succeed(FeedService, {
83
82
  throw new Error("Feed.FeedService not available");
84
83
  }
85
84
  });
86
- var append = (feed, items) => Effect.gen(function* () {
87
- const service = yield* FeedService;
88
- yield* Effect.promise(() => service.append(feed, items));
89
- });
90
- var remove = (feed, items) => Effect.gen(function* () {
91
- const service = yield* FeedService;
92
- const ids = items.map((item) => item.id);
93
- yield* Effect.promise(() => service.remove(feed, ids));
94
- });
95
- var query = (feed, queryOrFilter) => FeedService.pipe(Effect.map((service) => service.query(feed, queryOrFilter)));
96
- var runQuery = (feed, queryOrFilter) => query(feed, queryOrFilter).pipe(Effect.flatMap((queryResult) => Effect.promise(() => queryResult.run())));
97
- var sync = (feed, options) => Effect.gen(function* () {
98
- const service = yield* FeedService;
99
- yield* Effect.promise(() => service.sync(feed, options));
100
- });
101
- var getSyncState = (feed) => Effect.gen(function* () {
102
- const service = yield* FeedService;
103
- return yield* Effect.promise(() => service.getSyncState(feed));
104
- });
85
+ var make2 = (props = {}) => make(Feed, props);
86
+ var getQueueUri = (feed) => EID.tryParse(getURI(feed));
87
+ var append = (feed, items) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.appendToFeed(feed, items)))).pipe(Effect.withSpan("Feed.append"));
88
+ var remove = (feed, items) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.removeFeedItemsByIds(feed, items.map((item) => item.id))))).pipe(Effect.withSpan("Feed.remove"));
89
+ var query = Function.dual(2, (feed, queryOrFilter) => Service.pipe(Effect.map(({ db }) => db.queryFeed(feed, queryOrFilter)), Effect.withSpan("Feed.query"), makeQueryResultEffect));
90
+ var sync = (feed, options) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.syncFeed(feed, options)))).pipe(Effect.withSpan("Feed.sync"));
91
+ var getSyncState = (feed) => Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.getFeedSyncState(feed)))).pipe(Effect.withSpan("Feed.getSyncState"));
105
92
  var cursor = (_feed) => Effect.succeed({
106
93
  _tag: "Cursor"
107
94
  });
@@ -111,16 +98,14 @@ var setRetention = (_feed, _options) => Effect.void;
111
98
 
112
99
  export {
113
100
  Feed,
114
- make2 as make,
115
- getQueueUri,
116
- FeedService,
117
- Service,
118
101
  ContextFeedService,
102
+ FeedService,
119
103
  notAvailable,
104
+ make2 as make,
105
+ getQueueUri,
120
106
  append,
121
107
  remove,
122
108
  query,
123
- runQuery,
124
109
  sync,
125
110
  getSyncState,
126
111
  cursor,
@@ -129,4 +114,4 @@ export {
129
114
  setRetention,
130
115
  Feed_exports
131
116
  };
132
- //# sourceMappingURL=chunk-5GAIWRQB.mjs.map
117
+ //# sourceMappingURL=chunk-XXWK4J53.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/Feed.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Layer from 'effect/Layer';\nimport type * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport { DXN, EID } from '@dxos/keys';\n\nimport * as Annotation from './Annotation';\nimport * as Database from './Database';\nimport type * as Entity from './Entity';\nimport type * as Filter from './Filter';\nimport * as internal from './internal';\nimport * as queryInternal from './internal/Query';\nimport * as Obj from './Obj';\nimport type * as Query from './Query';\nimport type * as QueryResult from './QueryResult';\nimport * as Type from './Type';\n\n/**\n * Runtime schema for a Feed object.\n *\n * @example\n * ```ts\n * const feed = Obj.make(Feed.Feed, { name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });\n * ```\n */\nexport class Feed extends Type.makeObject<Feed>(DXN.make('org.dxos.type.feed', '0.1.0'))(\n Schema.Struct({\n /** User-facing display name. */\n name: Schema.String.pipe(Schema.optional),\n /** Identifier for the feed's kind (e.g., plugin id). */\n kind: Schema.String.pipe(internal.FormInputAnnotation.set(false), Schema.optional),\n\n /**\n * Feed namespace.\n * Controls how feed data is stored and replicated.\n * - `data`: Data feed (default).\n * - `trace`: Trace feed.\n */\n namespace: Schema.optional(Schema.Literal('data', 'trace')),\n }).pipe(\n internal.HiddenAnnotation.set(true),\n Annotation.IconAnnotation.set({ icon: 'ph--rows--regular', hue: 'yellow' }),\n ),\n) {}\n\n//\n// Types\n//\n\n/**\n * Opaque cursor for iterating over feed items.\n */\n// TODO(dmaretskyi): T needs to be referenced in the type structure for typescript to respect it during inference and type-checking.\nexport interface Cursor<T = Obj.Snapshot> {\n readonly _tag: 'Cursor';\n}\n\n/**\n * Retention options for a feed.\n */\nexport interface RetentionOptions {\n /** Retain items after this cursor position. */\n // TODO(wittjosiah): Use FeedCursor from @dxos/feed?\n cursor?: string;\n}\n\n/**\n * Sync options for a feed.\n */\nexport interface SyncOptions {\n /** Push local changes to the server. Defaults to true. */\n shouldPush?: boolean;\n /** Pull remote changes from the server. Defaults to true. */\n shouldPull?: boolean;\n}\n\n/**\n * Queue replication backlog for a feed namespace.\n * `0` / `0` means caught up on pull and push.\n */\nexport interface SyncState {\n /** Blocks still to pull from remote. */\n blocksToPull: number;\n /** Unpositioned blocks still to push to remote. */\n blocksToPush: number;\n /** Total blocks stored locally for the feed namespace. */\n totalBlocks: number;\n}\n\n/**\n * Effect service tag for injecting a Feed into effect operations.\n * Used to provide a specific feed to operations that operate on it without threading\n * the feed as an explicit parameter through every call site.\n */\nexport class ContextFeedService extends Context.Tag('@dxos/echo/Feed/ContextFeedService')<\n ContextFeedService,\n {\n readonly feed: Feed;\n }\n>() {\n static layer = (feed: Feed) => Layer.succeed(ContextFeedService, { feed });\n}\n\n//\n// Service\n//\n\n/**\n * Effect service for feed operations.\n * @deprecated Use `Database.Service` instead — feed operations now run directly on the database.\n */\nexport class FeedService extends Context.Tag('@dxos/echo/Feed/FeedService')<\n FeedService,\n {\n append(feed: Feed, items: Entity.Unknown[]): Promise<void>;\n remove(feed: Feed, ids: string[]): Promise<void>;\n query: {\n <Q extends Query.Any>(feed: Feed, query: Q): QueryResult.QueryResult<Query.Type<Q>>;\n <F extends Filter.Any>(feed: Feed, filter: F): QueryResult.QueryResult<Filter.Type<F>>;\n };\n sync(feed: Feed, options?: SyncOptions): Promise<void>;\n getSyncState(feed: Feed): Promise<SyncState>;\n }\n>() {}\n\n/**\n * Layer that provides a `FeedService` that throws when accessed.\n * @deprecated Use `Database.layer(db)` instead.\n */\nexport const notAvailable: Layer.Layer<FeedService> = Layer.succeed(FeedService, {\n append: () => {\n throw new Error('Feed.FeedService not available');\n },\n remove: () => {\n throw new Error('Feed.FeedService not available');\n },\n query: () => {\n throw new Error('Feed.FeedService not available') as never;\n },\n sync: () => {\n throw new Error('Feed.FeedService not available');\n },\n getSyncState: () => {\n throw new Error('Feed.FeedService not available');\n },\n} as Context.Tag.Service<FeedService>);\n\n//\n// Factory\n//\n\n/**\n * Creates a new feed object.\n *\n * @example\n * ```ts\n * const feed = Feed.make({ name: 'notifications', kind: 'org.dxos.plugin.notifications.v1' });\n * ```\n */\n// TODO(wittjosiah): How to control the feed namespace (data/trace)? Why do feeds have namespaces?\nexport const make = (props: Obj.MakeProps<typeof Feed> = {}): Feed => Obj.make(Feed, props);\n\n/**\n * Returns the feed object's EID when the feed is stored in a space.\n *\n * Used internally by the feed service layer.\n */\nexport const getQueueUri = (feed: Feed): EID.EID | undefined => EID.tryParse(Obj.getURI(feed));\n\n//\n// Operations\n//\n\n/**\n * Appends items to a feed.\n *\n * @example\n * ```ts\n * yield* Feed.append(feed, [Obj.make(Notification, { title: 'Hello' })]);\n * ```\n */\nexport const append = (feed: Feed, items: Entity.Unknown[]): Effect.Effect<void, never, Database.Service> =>\n Database.Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.appendToFeed(feed, items)))).pipe(\n Effect.withSpan('Feed.append'),\n );\n\n/**\n * Removes items from a feed.\n *\n * @example\n * ```ts\n * yield* Feed.remove(feed, [item]);\n * ```\n */\n// TODO(dmaretskyi): Should we allow snapshots here? - what does it mean to remove a snapshot?\nexport const remove = (\n feed: Feed,\n items: (Entity.Unknown | Obj.Snapshot)[],\n): Effect.Effect<void, never, Database.Service> =>\n Database.Service.pipe(\n Effect.flatMap(({ db }) =>\n Effect.promise(() =>\n db.removeFeedItemsByIds(\n feed,\n items.map((item) => item.id),\n ),\n ),\n ),\n ).pipe(Effect.withSpan('Feed.remove'));\n\n/**\n * Creates a reactive query over items in a feed.\n *\n * Returns a {@link QueryResult.QueryResultEffect}: yielding it produces a subscribable\n * `QueryResult`, while its `.run` / `.first` shorthands execute the query once. This mirrors\n * `Database.query` so feed and database queries chain identically.\n *\n * Supports both data-first and data-last (curried) forms; the latter composes with `pipe`.\n *\n * In non-Effect code, query a feed directly through the database with a feed scope:\n * `db.query(Query.select(filter).from(Scope.feed(Feed.getQueueUri(feed))))`.\n *\n * @example\n * ```ts\n * const result = yield* Feed.query(feed, Filter.type(Person));\n * result.subscribe(...);\n *\n * const objects = yield* Feed.query(feed, Filter.type(Person)).run;\n * const object = yield* Feed.query(feed, Filter.type(Person)).first;\n *\n * // Data-last (curried) form composes with `pipe`:\n * const objects = yield* pipe(feed, Feed.query(Filter.type(Person))).run;\n * ```\n */\nexport const query: {\n <Q extends Query.Any>(feed: Feed, query: Q): QueryResult.QueryResultEffect<Query.Type<Q>, never, Database.Service>;\n <F extends Filter.Any>(feed: Feed, filter: F): QueryResult.QueryResultEffect<Filter.Type<F>, never, Database.Service>;\n <Q extends Query.Any>(\n query: Q,\n ): (feed: Feed) => QueryResult.QueryResultEffect<Query.Type<Q>, never, Database.Service>;\n <F extends Filter.Any>(\n filter: F,\n ): (feed: Feed) => QueryResult.QueryResultEffect<Filter.Type<F>, never, Database.Service>;\n} = Function.dual(2, (feed: Feed, queryOrFilter: Query.Any | Filter.Any) =>\n Database.Service.pipe(\n Effect.map(({ db }) => db.queryFeed(feed, queryOrFilter)),\n Effect.withSpan('Feed.query'),\n queryInternal.makeQueryResultEffect,\n ),\n);\n\n/**\n * Syncs the feed with the server.\n *\n * @example\n * ```ts\n * yield* Feed.sync(feed);\n * yield* Feed.sync(feed, { shouldPush: false });\n * ```\n */\nexport const sync = (feed: Feed, options?: SyncOptions): Effect.Effect<void, never, Database.Service> =>\n Database.Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.syncFeed(feed, options)))).pipe(\n Effect.withSpan('Feed.sync'),\n );\n\n/**\n * Returns queue replication backlog for the feed's namespace.\n *\n * @example\n * ```ts\n * const { blocksToPull, blocksToPush } = yield* Feed.getSyncState(feed);\n * ```\n */\nexport const getSyncState = (feed: Feed): Effect.Effect<SyncState, never, Database.Service> =>\n Database.Service.pipe(Effect.flatMap(({ db }) => Effect.promise(() => db.getFeedSyncState(feed)))).pipe(\n Effect.withSpan('Feed.getSyncState'),\n );\n\n/**\n * Creates a cursor for iterating over feed items.\n * Currently stubbed — cursor operations are not yet implemented.\n *\n * @example\n * ```ts\n * const cursor = yield* Feed.cursor<Person>(feed);\n * const item = yield* Feed.next(cursor);\n * ```\n */\n// TODO(wittjosiah): Implement cursor operations. Use Effect streams?\nexport const cursor = <T = Obj.Snapshot>(_feed: Feed): Effect.Effect<Cursor<T>, never, Database.Service> =>\n Effect.succeed({ _tag: 'Cursor' } as Cursor<T>);\n\n/**\n * Returns the next item from a feed cursor.\n * Currently stubbed — cursor operations are not yet implemented.\n */\nexport const next = <T = Obj.Snapshot>(_cursor: Cursor<T>): Effect.Effect<T, never, Database.Service> =>\n Effect.die('Feed.next is not yet implemented');\n\n/**\n * Returns the next item from a feed cursor as an Option.\n * Currently stubbed — cursor operations are not yet implemented.\n */\nexport const nextOption = <T = Obj.Snapshot>(\n _cursor: Cursor<T>,\n): Effect.Effect<Option.Option<T>, never, Database.Service> => Effect.die('Feed.nextOption is not yet implemented');\n\n/**\n * Sets the local retention policy for a feed.\n * Currently stubbed — feeds do not yet support retention.\n *\n * @example\n * ```ts\n * yield* Feed.setRetention(feed, { count: 1000 });\n * ```\n */\n// TODO(dmaretskyi): Implement when feed retention is supported.\nexport const setRetention = (_feed: Feed, _options: RetentionOptions): Effect.Effect<void, never, Database.Service> =>\n Effect.void;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;cAAAA;EAAA;;;;;;;;AAMA,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAC1B,YAAYC,WAAW;AAEvB,YAAYC,YAAY;AAExB,SAASC,KAAKC,WAAW;AAqBlB,IAAMC,OAAN,cAAwBC,WAAiBC,IAAIC,KAAK,sBAAsB,OAAA,CAAA,EACtEC,cAAO;;EAEZC,MAAaC,cAAOC,KAAYC,eAAQ;;EAExCC,MAAaH,cAAOC,KAAcG,oBAAoBC,IAAI,KAAA,GAAeH,eAAQ;;;;;;;EAQjFI,WAAkBJ,gBAAgBK,eAAQ,QAAQ,OAAA,CAAA;AACpD,CAAA,EAAGN,KACQO,iBAAiBH,IAAI,IAAA,GACnBI,eAAeJ,IAAI;EAAEK,MAAM;EAAqBC,KAAK;AAAS,CAAA,CAAA,CAAA,EAAA;AAE1E;AAmDI,IAAMC,qBAAN,MAAMA,4BAAmCC,YAAI,oCAAA,EAAA,EAAA;EAMlD,OAAOC,QAAQ,CAACC,SAAqBC,cAAQJ,qBAAoB;IAAEG;EAAK,CAAA;AAC1E;AAUO,IAAME,cAAN,cAAkCJ,YAAI,6BAAA,EAAA,EAAA;AAYxC;AAME,IAAMK,eAA+CF,cAAQC,aAAa;EAC/EE,QAAQ,MAAA;AACN,UAAM,IAAIC,MAAM,gCAAA;EAClB;EACAC,QAAQ,MAAA;AACN,UAAM,IAAID,MAAM,gCAAA;EAClB;EACAE,OAAO,MAAA;AACL,UAAM,IAAIF,MAAM,gCAAA;EAClB;EACAG,MAAM,MAAA;AACJ,UAAM,IAAIH,MAAM,gCAAA;EAClB;EACAI,cAAc,MAAA;AACZ,UAAM,IAAIJ,MAAM,gCAAA;EAClB;AACF,CAAA;AAeO,IAAMvB,QAAO,CAAC4B,QAAoC,CAAC,MAAgB5B,KAAKH,MAAM+B,KAAAA;AAO9E,IAAMC,cAAc,CAACX,SAAoCY,IAAIC,SAAaC,OAAOd,IAAAA,CAAAA;AAcjF,IAAMI,SAAS,CAACJ,MAAYe,UACxBC,QAAQ9B,KAAY+B,eAAQ,CAAC,EAAEC,GAAE,MAAcC,eAAQ,MAAMD,GAAGE,aAAapB,MAAMe,KAAAA,CAAAA,CAAAA,CAAAA,EAAU7B,KAC7FmC,gBAAS,aAAA,CAAA;AAYb,IAAMf,SAAS,CACpBN,MACAe,UAESC,QAAQ9B,KACR+B,eAAQ,CAAC,EAAEC,GAAE,MACXC,eAAQ,MACbD,GAAGI,qBACDtB,MACAe,MAAMQ,IAAI,CAACC,SAASA,KAAKC,EAAE,CAAA,CAAA,CAAA,CAAA,EAIjCvC,KAAYmC,gBAAS,aAAA,CAAA;AA0BlB,IAAMd,QASAmB,cAAK,GAAG,CAAC1B,MAAY2B,kBACvBX,QAAQ9B,KACRqC,WAAI,CAAC,EAAEL,GAAE,MAAOA,GAAGU,UAAU5B,MAAM2B,aAAAA,CAAAA,GACnCN,gBAAS,YAAA,GACFQ,qBAAqB,CAAA;AAahC,IAAMrB,OAAO,CAACR,MAAY8B,YACtBd,QAAQ9B,KAAY+B,eAAQ,CAAC,EAAEC,GAAE,MAAcC,eAAQ,MAAMD,GAAGa,SAAS/B,MAAM8B,OAAAA,CAAAA,CAAAA,CAAAA,EAAY5C,KAC3FmC,gBAAS,WAAA,CAAA;AAWb,IAAMZ,eAAe,CAACT,SAClBgB,QAAQ9B,KAAY+B,eAAQ,CAAC,EAAEC,GAAE,MAAcC,eAAQ,MAAMD,GAAGc,iBAAiBhC,IAAAA,CAAAA,CAAAA,CAAAA,EAASd,KAC1FmC,gBAAS,mBAAA,CAAA;AAcb,IAAMY,SAAS,CAAmBC,UAChCjC,eAAQ;EAAEkC,MAAM;AAAS,CAAA;AAM3B,IAAMC,OAAO,CAAmBC,YAC9BC,WAAI,kCAAA;AAMN,IAAMC,aAAa,CACxBF,YACoEC,WAAI,wCAAA;AAYnE,IAAME,eAAe,CAACN,OAAaO,aACjCC;",
6
+ "names": ["make", "Context", "Effect", "Function", "Layer", "Schema", "DXN", "EID", "Feed", "makeObject", "DXN", "make", "Struct", "name", "String", "pipe", "optional", "kind", "FormInputAnnotation", "set", "namespace", "Literal", "HiddenAnnotation", "IconAnnotation", "icon", "hue", "ContextFeedService", "Tag", "layer", "feed", "succeed", "FeedService", "notAvailable", "append", "Error", "remove", "query", "sync", "getSyncState", "props", "getQueueUri", "EID", "tryParse", "getURI", "items", "Service", "flatMap", "db", "promise", "appendToFeed", "withSpan", "removeFeedItemsByIds", "map", "item", "id", "dual", "queryOrFilter", "queryFeed", "makeQueryResultEffect", "options", "syncFeed", "getFeedSyncState", "cursor", "_feed", "_tag", "next", "_cursor", "die", "nextOption", "setRetention", "_options", "void"]
7
+ }
@@ -8,74 +8,77 @@ import {
8
8
  QueryAST,
9
9
  URI,
10
10
  View_exports
11
- } from "./chunk-3JXQUMUI.mjs";
11
+ } from "./chunk-C57XMMBY.mjs";
12
12
  import {
13
13
  QueryResult_exports
14
- } from "./chunk-35INCYOE.mjs";
14
+ } from "./chunk-UWLP4RFM.mjs";
15
15
  import {
16
16
  Query_exports
17
- } from "./chunk-AFANXSGV.mjs";
17
+ } from "./chunk-3KTE2Y7Q.mjs";
18
18
  import {
19
19
  Tag_exports
20
- } from "./chunk-E7IOTOZD.mjs";
20
+ } from "./chunk-42L4HJ3Z.mjs";
21
+ import {
22
+ Text_exports
23
+ } from "./chunk-XXL42WCB.mjs";
21
24
  import {
22
25
  Order_exports
23
- } from "./chunk-EVK6XBXO.mjs";
26
+ } from "./chunk-PRC4FEKJ.mjs";
24
27
  import {
25
28
  Key_exports
26
29
  } from "./chunk-7LOUAPYZ.mjs";
27
30
  import {
28
31
  Migration_exports
29
- } from "./chunk-A53NTBHE.mjs";
32
+ } from "./chunk-U53LSQQA.mjs";
30
33
  import {
31
34
  Feed_exports
32
- } from "./chunk-5GAIWRQB.mjs";
35
+ } from "./chunk-XXWK4J53.mjs";
33
36
  import {
34
37
  Filter_exports
35
- } from "./chunk-NOL7O3BL.mjs";
38
+ } from "./chunk-SCT6FFCR.mjs";
36
39
  import {
37
40
  Format_exports
38
- } from "./chunk-6M2Z6WBH.mjs";
41
+ } from "./chunk-BXIKXT7Q.mjs";
39
42
  import {
40
43
  Relation_exports
41
- } from "./chunk-SZ5WB6HF.mjs";
44
+ } from "./chunk-UZHCQ6NI.mjs";
42
45
  import {
43
46
  Registry_exports
44
- } from "./chunk-WU3GIANS.mjs";
47
+ } from "./chunk-IQR45HAD.mjs";
45
48
  import {
46
49
  Scope_exports
47
50
  } from "./chunk-WISOH2XH.mjs";
48
51
  import {
49
52
  JsonSchema_exports
50
- } from "./chunk-PLDMJJJC.mjs";
53
+ } from "./chunk-UGFFV2FR.mjs";
51
54
  import {
52
55
  Obj_exports
53
- } from "./chunk-6CEISA3V.mjs";
56
+ } from "./chunk-HBXT3GSB.mjs";
54
57
  import {
55
58
  Ref_exports
56
- } from "./chunk-TF5BSLF6.mjs";
59
+ } from "./chunk-FSGX2R62.mjs";
57
60
  import {
58
61
  Entity_exports
59
- } from "./chunk-Z3WMRRAZ.mjs";
62
+ } from "./chunk-BEFR7LEA.mjs";
60
63
  import {
61
64
  Type_exports
62
- } from "./chunk-HGWQR5KH.mjs";
63
- import "./chunk-VQYL2OQF.mjs";
64
- import "./chunk-L3OBWBV2.mjs";
65
- import "./chunk-K3S7D5PR.mjs";
66
- import "./chunk-TFEWTY5A.mjs";
65
+ } from "./chunk-XB6ISRAO.mjs";
66
+ import "./chunk-ACFAOTKJ.mjs";
67
+ import "./chunk-WKIT2YY5.mjs";
67
68
  import {
68
69
  Annotation_exports
69
- } from "./chunk-JZ6LFQU5.mjs";
70
- import "./chunk-X3NUUON4.mjs";
71
- import "./chunk-4TPQZPLY.mjs";
70
+ } from "./chunk-C62JYFAD.mjs";
71
+ import "./chunk-2HKGAQM4.mjs";
72
+ import "./chunk-4A2NWKRJ.mjs";
73
+ import "./chunk-KCBW4BR6.mjs";
74
+ import "./chunk-L3E5IXAE.mjs";
72
75
  import {
73
76
  Database_exports
74
- } from "./chunk-WZ32BF53.mjs";
75
- import "./chunk-O6BH7EPN.mjs";
77
+ } from "./chunk-3TN2VMI4.mjs";
78
+ import "./chunk-2ZHECXUR.mjs";
76
79
  import {
77
80
  Err_exports
78
- } from "./chunk-BBFJWWAV.mjs";
81
+ } from "./chunk-TOCVVFK2.mjs";
79
82
  import "./chunk-J5LGTIGS.mjs";
80
83
  export {
81
84
  Annotation_exports as Annotation,
@@ -104,6 +107,7 @@ export {
104
107
  Relation_exports as Relation,
105
108
  Scope_exports as Scope,
106
109
  Tag_exports as Tag,
110
+ Text_exports as Text,
107
111
  Type_exports as Type,
108
112
  URI,
109
113
  View_exports as View