@dxos/echo 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea

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 (307) hide show
  1. package/dist/lib/browser/chunk-JUTFUT73.mjs +175 -0
  2. package/dist/lib/browser/chunk-JUTFUT73.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-KEBVBR65.mjs +3727 -0
  4. package/dist/lib/browser/chunk-KEBVBR65.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-I4YEWYJA.mjs → chunk-WO76TDT6.mjs} +572 -640
  6. package/dist/lib/browser/chunk-WO76TDT6.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +12 -7
  8. package/dist/lib/browser/internal/index.mjs +336 -0
  9. package/dist/lib/browser/internal/index.mjs.map +7 -0
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/query/index.mjs +15 -0
  12. package/dist/lib/browser/query/index.mjs.map +7 -0
  13. package/dist/lib/browser/testing/index.mjs +245 -32
  14. package/dist/lib/browser/testing/index.mjs.map +4 -4
  15. package/dist/lib/node-esm/chunk-DWZYQ2UR.mjs +3727 -0
  16. package/dist/lib/node-esm/chunk-DWZYQ2UR.mjs.map +7 -0
  17. package/dist/lib/node-esm/chunk-KBD3A2I6.mjs +175 -0
  18. package/dist/lib/node-esm/chunk-KBD3A2I6.mjs.map +7 -0
  19. package/dist/lib/node-esm/{chunk-AWWFAF75.mjs → chunk-ZSSII3JW.mjs} +572 -640
  20. package/dist/lib/node-esm/chunk-ZSSII3JW.mjs.map +7 -0
  21. package/dist/lib/node-esm/index.mjs +12 -7
  22. package/dist/lib/node-esm/internal/index.mjs +336 -0
  23. package/dist/lib/node-esm/internal/index.mjs.map +7 -0
  24. package/dist/lib/node-esm/meta.json +1 -1
  25. package/dist/lib/node-esm/query/index.mjs +15 -0
  26. package/dist/lib/node-esm/query/index.mjs.map +7 -0
  27. package/dist/lib/node-esm/testing/index.mjs +245 -32
  28. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  29. package/dist/types/src/Obj.d.ts +16 -4
  30. package/dist/types/src/Obj.d.ts.map +1 -1
  31. package/dist/types/src/Ref.d.ts +1 -1
  32. package/dist/types/src/Ref.d.ts.map +1 -1
  33. package/dist/types/src/Relation.d.ts +2 -2
  34. package/dist/types/src/Relation.d.ts.map +1 -1
  35. package/dist/types/src/Type.d.ts +16 -17
  36. package/dist/types/src/Type.d.ts.map +1 -1
  37. package/dist/types/src/index.d.ts +2 -2
  38. package/dist/types/src/index.d.ts.map +1 -1
  39. package/dist/types/src/internal/ast/annotation-helper.d.ts +8 -0
  40. package/dist/types/src/internal/ast/annotation-helper.d.ts.map +1 -0
  41. package/dist/types/src/internal/ast/annotations.d.ts +131 -0
  42. package/dist/types/src/internal/ast/annotations.d.ts.map +1 -0
  43. package/dist/types/src/internal/ast/annotations.test.d.ts +2 -0
  44. package/dist/types/src/internal/ast/annotations.test.d.ts.map +1 -0
  45. package/dist/types/src/internal/ast/entity-kind.d.ts +10 -0
  46. package/dist/types/src/internal/ast/entity-kind.d.ts.map +1 -0
  47. package/dist/types/src/internal/ast/index.d.ts +5 -0
  48. package/dist/types/src/internal/ast/index.d.ts.map +1 -0
  49. package/dist/types/src/internal/ast/types.d.ts +6 -0
  50. package/dist/types/src/internal/ast/types.d.ts.map +1 -0
  51. package/dist/types/src/internal/formats/date.d.ts +63 -0
  52. package/dist/types/src/internal/formats/date.d.ts.map +1 -0
  53. package/dist/types/src/internal/formats/date.test.d.ts +2 -0
  54. package/dist/types/src/internal/formats/date.test.d.ts.map +1 -0
  55. package/dist/types/src/internal/formats/format.d.ts +30 -0
  56. package/dist/types/src/internal/formats/format.d.ts.map +1 -0
  57. package/dist/types/src/internal/formats/format.test.d.ts +2 -0
  58. package/dist/types/src/internal/formats/format.test.d.ts.map +1 -0
  59. package/dist/types/src/internal/formats/index.d.ts +8 -0
  60. package/dist/types/src/internal/formats/index.d.ts.map +1 -0
  61. package/dist/types/src/internal/formats/number.d.ts +31 -0
  62. package/dist/types/src/internal/formats/number.d.ts.map +1 -0
  63. package/dist/types/src/internal/formats/object.d.ts +35 -0
  64. package/dist/types/src/internal/formats/object.d.ts.map +1 -0
  65. package/dist/types/src/internal/formats/select.d.ts +11 -0
  66. package/dist/types/src/internal/formats/select.d.ts.map +1 -0
  67. package/dist/types/src/internal/formats/string.d.ts +38 -0
  68. package/dist/types/src/internal/formats/string.d.ts.map +1 -0
  69. package/dist/types/src/internal/formats/types.d.ts +68 -0
  70. package/dist/types/src/internal/formats/types.d.ts.map +1 -0
  71. package/dist/types/src/internal/index.d.ts +15 -0
  72. package/dist/types/src/internal/index.d.ts.map +1 -0
  73. package/dist/types/src/internal/json/annotations.d.ts +19 -0
  74. package/dist/types/src/internal/json/annotations.d.ts.map +1 -0
  75. package/dist/types/src/internal/json/effect-schema.test.d.ts +2 -0
  76. package/dist/types/src/internal/json/effect-schema.test.d.ts.map +1 -0
  77. package/dist/types/src/internal/json/index.d.ts +2 -0
  78. package/dist/types/src/internal/json/index.d.ts.map +1 -0
  79. package/dist/types/src/internal/json/json-schema.d.ts +28 -0
  80. package/dist/types/src/internal/json/json-schema.d.ts.map +1 -0
  81. package/dist/types/src/internal/json/json-schema.test.d.ts +2 -0
  82. package/dist/types/src/internal/json/json-schema.test.d.ts.map +1 -0
  83. package/dist/types/src/internal/json-schema/index.d.ts +3 -0
  84. package/dist/types/src/internal/json-schema/index.d.ts.map +1 -0
  85. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts +7 -0
  86. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -0
  87. package/dist/types/src/internal/json-schema/json-schema-type.d.ts +250 -0
  88. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -0
  89. package/dist/types/src/internal/object/accessors.d.ts +37 -0
  90. package/dist/types/src/internal/object/accessors.d.ts.map +1 -0
  91. package/dist/types/src/internal/object/common.d.ts +18 -0
  92. package/dist/types/src/internal/object/common.d.ts.map +1 -0
  93. package/dist/types/src/internal/object/create.d.ts +40 -0
  94. package/dist/types/src/internal/object/create.d.ts.map +1 -0
  95. package/dist/types/src/internal/object/create.test.d.ts +2 -0
  96. package/dist/types/src/internal/object/create.test.d.ts.map +1 -0
  97. package/dist/types/src/internal/object/deleted.d.ts +6 -0
  98. package/dist/types/src/internal/object/deleted.d.ts.map +1 -0
  99. package/dist/types/src/internal/object/entity.d.ts +33 -0
  100. package/dist/types/src/internal/object/entity.d.ts.map +1 -0
  101. package/dist/types/src/internal/object/expando.d.ts +14 -0
  102. package/dist/types/src/internal/object/expando.d.ts.map +1 -0
  103. package/dist/types/src/internal/object/ids.d.ts +6 -0
  104. package/dist/types/src/internal/object/ids.d.ts.map +1 -0
  105. package/dist/types/src/internal/object/index.d.ts +16 -0
  106. package/dist/types/src/internal/object/index.d.ts.map +1 -0
  107. package/dist/types/src/internal/object/inspect.d.ts +2 -0
  108. package/dist/types/src/internal/object/inspect.d.ts.map +1 -0
  109. package/dist/types/src/internal/object/json-serializer.d.ts +32 -0
  110. package/dist/types/src/internal/object/json-serializer.d.ts.map +1 -0
  111. package/dist/types/src/internal/object/json-serializer.test.d.ts +2 -0
  112. package/dist/types/src/internal/object/json-serializer.test.d.ts.map +1 -0
  113. package/dist/types/src/internal/object/meta.d.ts +31 -0
  114. package/dist/types/src/internal/object/meta.d.ts.map +1 -0
  115. package/dist/types/src/internal/object/model.d.ts +117 -0
  116. package/dist/types/src/internal/object/model.d.ts.map +1 -0
  117. package/dist/types/src/internal/object/relation.d.ts +17 -0
  118. package/dist/types/src/internal/object/relation.d.ts.map +1 -0
  119. package/dist/types/src/internal/object/schema-validator.d.ts +15 -0
  120. package/dist/types/src/internal/object/schema-validator.d.ts.map +1 -0
  121. package/dist/types/src/internal/object/schema-validator.test.d.ts +2 -0
  122. package/dist/types/src/internal/object/schema-validator.test.d.ts.map +1 -0
  123. package/dist/types/src/internal/object/typed-object.d.ts +31 -0
  124. package/dist/types/src/internal/object/typed-object.d.ts.map +1 -0
  125. package/dist/types/src/internal/object/typed-object.test.d.ts +2 -0
  126. package/dist/types/src/internal/object/typed-object.test.d.ts.map +1 -0
  127. package/dist/types/src/internal/object/typename.d.ts +15 -0
  128. package/dist/types/src/internal/object/typename.d.ts.map +1 -0
  129. package/dist/types/src/internal/object/version.d.ts +14 -0
  130. package/dist/types/src/internal/object/version.d.ts.map +1 -0
  131. package/dist/types/src/internal/projection/compose.d.ts +6 -0
  132. package/dist/types/src/internal/projection/compose.d.ts.map +1 -0
  133. package/dist/types/src/internal/projection/compose.test.d.ts +2 -0
  134. package/dist/types/src/internal/projection/compose.test.d.ts.map +1 -0
  135. package/dist/types/src/internal/projection/index.d.ts +2 -0
  136. package/dist/types/src/internal/projection/index.d.ts.map +1 -0
  137. package/dist/types/src/internal/proxy/handler.test.d.ts +2 -0
  138. package/dist/types/src/internal/proxy/handler.test.d.ts.map +1 -0
  139. package/dist/types/src/internal/proxy/reactive-object.d.ts +15 -0
  140. package/dist/types/src/internal/proxy/reactive-object.d.ts.map +1 -0
  141. package/dist/types/src/internal/proxy/schema.test.d.ts +2 -0
  142. package/dist/types/src/internal/proxy/schema.test.d.ts.map +1 -0
  143. package/dist/types/src/internal/proxy/typed-handler.d.ts +44 -0
  144. package/dist/types/src/internal/proxy/typed-handler.d.ts.map +1 -0
  145. package/dist/types/src/internal/proxy/typed-handler.test.d.ts +2 -0
  146. package/dist/types/src/internal/proxy/typed-handler.test.d.ts.map +1 -0
  147. package/dist/types/src/internal/proxy/typed-object.test.d.ts +2 -0
  148. package/dist/types/src/internal/proxy/typed-object.test.d.ts.map +1 -0
  149. package/dist/types/src/internal/query/index.d.ts +2 -0
  150. package/dist/types/src/internal/query/index.d.ts.map +1 -0
  151. package/dist/types/src/internal/query/query.d.ts +17 -0
  152. package/dist/types/src/internal/query/query.d.ts.map +1 -0
  153. package/dist/types/src/internal/ref/index.d.ts +3 -0
  154. package/dist/types/src/internal/ref/index.d.ts.map +1 -0
  155. package/dist/types/src/internal/ref/ref-array.d.ts +21 -0
  156. package/dist/types/src/internal/ref/ref-array.d.ts.map +1 -0
  157. package/dist/types/src/internal/ref/ref.d.ts +206 -0
  158. package/dist/types/src/internal/ref/ref.d.ts.map +1 -0
  159. package/dist/types/src/internal/ref/ref.test.d.ts +2 -0
  160. package/dist/types/src/internal/ref/ref.test.d.ts.map +1 -0
  161. package/dist/types/src/internal/schema/echo-schema.d.ts +168 -0
  162. package/dist/types/src/internal/schema/echo-schema.d.ts.map +1 -0
  163. package/dist/types/src/internal/schema/index.d.ts +7 -0
  164. package/dist/types/src/internal/schema/index.d.ts.map +1 -0
  165. package/dist/types/src/internal/schema/manipulation.d.ts +10 -0
  166. package/dist/types/src/internal/schema/manipulation.d.ts.map +1 -0
  167. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts +18 -0
  168. package/dist/types/src/internal/schema/runtime-schema-registry.d.ts.map +1 -0
  169. package/dist/types/src/internal/schema/snapshot.d.ts +6 -0
  170. package/dist/types/src/internal/schema/snapshot.d.ts.map +1 -0
  171. package/dist/types/src/internal/schema/stored-schema.d.ts +13 -0
  172. package/dist/types/src/internal/schema/stored-schema.d.ts.map +1 -0
  173. package/dist/types/src/internal/testing/index.d.ts +3 -0
  174. package/dist/types/src/internal/testing/index.d.ts.map +1 -0
  175. package/dist/types/src/internal/testing/types.d.ts +455 -0
  176. package/dist/types/src/internal/testing/types.d.ts.map +1 -0
  177. package/dist/types/src/internal/testing/utils.d.ts +10 -0
  178. package/dist/types/src/internal/testing/utils.d.ts.map +1 -0
  179. package/dist/types/src/internal/types/index.d.ts +3 -0
  180. package/dist/types/src/internal/types/index.d.ts.map +1 -0
  181. package/dist/types/src/internal/types/types.d.ts +79 -0
  182. package/dist/types/src/internal/types/types.d.ts.map +1 -0
  183. package/dist/types/src/internal/types/types.test.d.ts +2 -0
  184. package/dist/types/src/internal/types/types.test.d.ts.map +1 -0
  185. package/dist/types/src/internal/types/util.d.ts +5 -0
  186. package/dist/types/src/internal/types/util.d.ts.map +1 -0
  187. package/dist/types/src/query/index.d.ts +2 -1
  188. package/dist/types/src/query/index.d.ts.map +1 -1
  189. package/dist/types/src/query/{dsl.d.ts → query.d.ts} +24 -21
  190. package/dist/types/src/query/query.d.ts.map +1 -0
  191. package/dist/types/src/query/query.test.d.ts +2 -0
  192. package/dist/types/src/query/query.test.d.ts.map +1 -0
  193. package/dist/types/src/query/tag.d.ts +17 -0
  194. package/dist/types/src/query/tag.d.ts.map +1 -0
  195. package/dist/types/src/testing/echo-schema.d.ts +7 -0
  196. package/dist/types/src/testing/echo-schema.d.ts.map +1 -0
  197. package/dist/types/src/testing/index.d.ts +2 -0
  198. package/dist/types/src/testing/index.d.ts.map +1 -1
  199. package/dist/types/src/testing/types.d.ts +18 -18
  200. package/dist/types/src/testing/types.d.ts.map +1 -1
  201. package/dist/types/tsconfig.tsbuildinfo +1 -1
  202. package/package.json +27 -16
  203. package/src/Obj.ts +40 -10
  204. package/src/Ref.ts +1 -2
  205. package/src/Relation.ts +4 -3
  206. package/src/Type.ts +28 -29
  207. package/src/index.ts +2 -2
  208. package/src/internal/ast/annotation-helper.ts +22 -0
  209. package/src/internal/ast/annotations.test.ts +98 -0
  210. package/src/internal/ast/annotations.ts +226 -0
  211. package/src/internal/ast/entity-kind.ts +15 -0
  212. package/src/internal/ast/index.ts +8 -0
  213. package/src/internal/ast/types.ts +17 -0
  214. package/src/internal/formats/date.test.ts +56 -0
  215. package/src/internal/formats/date.ts +217 -0
  216. package/src/internal/formats/format.test.ts +77 -0
  217. package/src/internal/formats/format.ts +52 -0
  218. package/src/internal/formats/index.ts +12 -0
  219. package/src/internal/formats/number.ts +89 -0
  220. package/src/internal/formats/object.ts +80 -0
  221. package/src/internal/formats/select.ts +16 -0
  222. package/src/internal/formats/string.ts +76 -0
  223. package/src/internal/formats/types.ts +175 -0
  224. package/src/internal/index.ts +22 -0
  225. package/src/internal/json/annotations.ts +50 -0
  226. package/src/internal/json/effect-schema.test.ts +143 -0
  227. package/src/internal/json/index.ts +5 -0
  228. package/src/internal/json/json-schema.test.ts +857 -0
  229. package/src/internal/json/json-schema.ts +519 -0
  230. package/src/internal/json-schema/index.ts +6 -0
  231. package/src/internal/json-schema/json-schema-normalize.ts +109 -0
  232. package/src/internal/json-schema/json-schema-type.ts +403 -0
  233. package/src/internal/object/accessors.ts +153 -0
  234. package/src/internal/object/common.ts +76 -0
  235. package/src/internal/object/create.test.ts +118 -0
  236. package/src/internal/object/create.ts +96 -0
  237. package/src/internal/object/deleted.ts +19 -0
  238. package/src/internal/object/entity.ts +248 -0
  239. package/src/internal/object/expando.ts +21 -0
  240. package/src/internal/object/ids.ts +12 -0
  241. package/src/internal/object/index.ts +19 -0
  242. package/src/internal/object/inspect.ts +48 -0
  243. package/src/internal/object/json-serializer.test.ts +99 -0
  244. package/src/internal/object/json-serializer.ts +225 -0
  245. package/src/internal/object/meta.ts +61 -0
  246. package/src/internal/object/model.ts +170 -0
  247. package/src/internal/object/relation.ts +24 -0
  248. package/src/internal/object/schema-validator.test.ts +186 -0
  249. package/src/internal/object/schema-validator.ts +241 -0
  250. package/src/internal/object/typed-object.test.ts +34 -0
  251. package/src/internal/object/typed-object.ts +88 -0
  252. package/src/internal/object/typename.ts +61 -0
  253. package/src/internal/object/version.ts +22 -0
  254. package/src/internal/projection/compose.test.ts +43 -0
  255. package/src/internal/projection/compose.ts +36 -0
  256. package/src/internal/projection/index.ts +5 -0
  257. package/src/internal/proxy/handler.test.ts +163 -0
  258. package/src/internal/proxy/reactive-object.ts +108 -0
  259. package/src/internal/proxy/schema.test.ts +136 -0
  260. package/src/internal/proxy/typed-handler.test.ts +102 -0
  261. package/src/internal/proxy/typed-handler.ts +228 -0
  262. package/src/internal/proxy/typed-object.test.ts +100 -0
  263. package/src/internal/query/index.ts +5 -0
  264. package/src/internal/query/query.ts +23 -0
  265. package/src/internal/ref/index.ts +6 -0
  266. package/src/internal/ref/ref-array.ts +39 -0
  267. package/src/internal/ref/ref.test.ts +100 -0
  268. package/src/internal/ref/ref.ts +521 -0
  269. package/src/internal/schema/echo-schema.ts +383 -0
  270. package/src/internal/schema/index.ts +10 -0
  271. package/src/internal/schema/manipulation.ts +92 -0
  272. package/src/internal/schema/runtime-schema-registry.ts +78 -0
  273. package/src/internal/schema/snapshot.ts +25 -0
  274. package/src/internal/schema/stored-schema.ts +26 -0
  275. package/src/internal/testing/index.ts +6 -0
  276. package/src/internal/testing/types.ts +211 -0
  277. package/src/internal/testing/utils.ts +54 -0
  278. package/src/internal/types/index.ts +6 -0
  279. package/src/internal/types/types.test.ts +48 -0
  280. package/src/internal/types/types.ts +176 -0
  281. package/src/internal/types/util.ts +9 -0
  282. package/src/query/index.ts +2 -1
  283. package/src/query/query.test.ts +401 -0
  284. package/src/query/{dsl.ts → query.ts} +68 -38
  285. package/src/query/tag.ts +37 -0
  286. package/src/test/api.test.ts +2 -2
  287. package/src/testing/echo-schema.ts +39 -0
  288. package/src/testing/index.ts +2 -0
  289. package/src/testing/types.ts +1 -1
  290. package/dist/lib/browser/chunk-I4YEWYJA.mjs.map +0 -7
  291. package/dist/lib/node-esm/chunk-AWWFAF75.mjs.map +0 -7
  292. package/dist/types/src/experimental/database.d.ts +0 -8
  293. package/dist/types/src/experimental/database.d.ts.map +0 -1
  294. package/dist/types/src/experimental/index.d.ts +0 -1
  295. package/dist/types/src/experimental/index.d.ts.map +0 -1
  296. package/dist/types/src/experimental/queue.d.ts +0 -8
  297. package/dist/types/src/experimental/queue.d.ts.map +0 -1
  298. package/dist/types/src/experimental/space.d.ts +0 -8
  299. package/dist/types/src/experimental/space.d.ts.map +0 -1
  300. package/dist/types/src/query/dsl.d.ts.map +0 -1
  301. package/dist/types/src/query/dsl.test.d.ts +0 -2
  302. package/dist/types/src/query/dsl.test.d.ts.map +0 -1
  303. package/src/experimental/database.ts +0 -11
  304. package/src/experimental/index.ts +0 -7
  305. package/src/experimental/queue.ts +0 -11
  306. package/src/experimental/space.ts +0 -11
  307. package/src/query/dsl.test.ts +0 -362
@@ -0,0 +1,250 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { JsonPath, type JsonProp } from '@dxos/effect';
3
+ /**
4
+ * Go under the `annotations` property.
5
+ */
6
+ export declare const JsonSchemaEchoAnnotations: Schema.mutable<Schema.Struct<{
7
+ /**
8
+ * Label for this schema.
9
+ * Mapped from {@link LabelAnnotationId}.
10
+ */
11
+ labelProp: Schema.optional<Schema.Union<[Schema.Schema<JsonPath, JsonPath, never>, Schema.Array$<Schema.Schema<JsonPath, JsonPath, never>>]>>;
12
+ /**
13
+ * Generator function for this schema.
14
+ * Mapped from {@link GeneratorAnnotationId}.
15
+ */
16
+ generator: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Tuple2<typeof Schema.String, typeof Schema.Number>]>>;
17
+ /**
18
+ * {@link PropertyMeta} annotations get serialized here.
19
+ */
20
+ meta: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
21
+ /**
22
+ * @deprecated
23
+ */
24
+ type: Schema.optional<Schema.mutable<Schema.Struct<{
25
+ typename: typeof Schema.String;
26
+ version: typeof Schema.String;
27
+ schemaId: Schema.optional<typeof Schema.String>;
28
+ }>>>;
29
+ /**
30
+ * @deprecated Superseded by `meta`.
31
+ */
32
+ annotations: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
33
+ }>>;
34
+ export type JsonSchemaEchoAnnotations = Schema.Schema.Type<typeof JsonSchemaEchoAnnotations>;
35
+ /**
36
+ * Describes a schema for the JSON-schema objects stored in ECHO.
37
+ * Contains extensions for ECHO (e.g., references).
38
+ * Ref: https://json-schema.org/draft-07/schema
39
+ */
40
+ declare const _JsonSchemaType: Schema.Struct<{
41
+ /**
42
+ * Identifier for this schema.
43
+ * This schema might be referenced by $ref clause in other schemas.
44
+ */
45
+ $id: Schema.optional<typeof Schema.String>;
46
+ /**
47
+ * Schema of this schema.
48
+ * Set to "https://json-schema.org/draft-07/schema".
49
+ */
50
+ $schema: Schema.optional<typeof Schema.String>;
51
+ /**
52
+ * Reference to another schema.
53
+ */
54
+ $ref: Schema.optional<typeof Schema.String>;
55
+ /**
56
+ * Comments are ignored when interpreting the schema.
57
+ */
58
+ $comment: Schema.optional<typeof Schema.String>;
59
+ /**
60
+ * Defines whether this schema is an object schema or a relation schema.
61
+ */
62
+ entityKind: Schema.optional<Schema.Enums<typeof import("..").EntityKind>>;
63
+ /**
64
+ * Typename of this schema.
65
+ * Only on schema representing an ECHO object.
66
+ *
67
+ * @example 'example.com/type/MyType'
68
+ */
69
+ typename: Schema.optional<typeof Schema.String>;
70
+ /**
71
+ * Version of this schema.
72
+ * Custom dialect for ECHO.
73
+ */
74
+ version: Schema.optional<typeof Schema.String>;
75
+ /**
76
+ * Target of this relation.
77
+ * Only for relation schemas.
78
+ * The referenced schema must be an object schema.
79
+ */
80
+ relationTarget: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
81
+ /**
82
+ * Source of this relation.
83
+ * Only for relation schemas.
84
+ * The referenced schema must be an object schema.
85
+ */
86
+ relationSource: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
87
+ /**
88
+ * Title of this schema.
89
+ */
90
+ title: Schema.optional<typeof Schema.String>;
91
+ /**
92
+ * Description of this schema.
93
+ */
94
+ description: Schema.optional<typeof Schema.String>;
95
+ /**
96
+ * Whether this schema is read-only.
97
+ */
98
+ readOnly: Schema.optional<typeof Schema.Boolean>;
99
+ /**
100
+ * Whether this schema is write-only.
101
+ */
102
+ writeOnly: Schema.optional<typeof Schema.Boolean>;
103
+ /**
104
+ * Examples of instances of this schema.
105
+ */
106
+ examples: Schema.optional<Schema.Array$<typeof Schema.Any>>;
107
+ /**
108
+ * Default value for this schema.
109
+ */
110
+ default: Schema.optional<typeof Schema.Any>;
111
+ /**
112
+ * This schema only matches values that are equal to this value.
113
+ */
114
+ const: Schema.optional<typeof Schema.Any>;
115
+ /**
116
+ * This schema only matches one of the values in this array.
117
+ */
118
+ enum: Schema.optional<Schema.Array$<typeof Schema.Any>>;
119
+ /**
120
+ * Base type of the schema.
121
+ */
122
+ type: Schema.optional<Schema.Union<[Schema.Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>, Schema.Array$<Schema.Literal<["array", "boolean", "integer", "null", "number", "object", "string"]>>]>>;
123
+ multipleOf: Schema.optional<Schema.filter<typeof Schema.Number>>;
124
+ maximum: Schema.optional<typeof Schema.Number>;
125
+ exclusiveMaximum: Schema.optional<typeof Schema.Number>;
126
+ minimum: Schema.optional<typeof Schema.Number>;
127
+ exclusiveMinimum: Schema.optional<typeof Schema.Number>;
128
+ maxLength: Schema.optional<Schema.filter<typeof Schema.Number>>;
129
+ /**
130
+ * Regex pattern for strings.
131
+ */
132
+ pattern: Schema.optional<typeof Schema.String>;
133
+ /**
134
+ * Serialized from {@link FormatAnnotationId}.
135
+ */
136
+ format: Schema.optional<typeof Schema.String>;
137
+ minLength: Schema.optional<Schema.filter<typeof Schema.Number>>;
138
+ items: Schema.optional<Schema.Union<[Schema.suspend<JsonSchemaType, JsonSchemaType, never>, Schema.Array$<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>]>>;
139
+ additionalItems: Schema.optional<Schema.Union<[Schema.suspend<JsonSchemaType, JsonSchemaType, never>, typeof Schema.Boolean]>>;
140
+ maxItems: Schema.optional<Schema.filter<typeof Schema.Number>>;
141
+ minItems: Schema.optional<Schema.filter<typeof Schema.Number>>;
142
+ uniqueItems: Schema.optional<typeof Schema.Boolean>;
143
+ contains: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
144
+ maxProperties: Schema.optional<Schema.filter<typeof Schema.Number>>;
145
+ minProperties: Schema.optional<Schema.filter<typeof Schema.Number>>;
146
+ required: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
147
+ /**
148
+ * Non-standard JSON Schema extension.
149
+ * Defines the order of properties in the object.
150
+ * The unmentioned properties are placed at the end.
151
+ *
152
+ * Related: https://github.com/json-schema/json-schema/issues/119
153
+ */
154
+ propertyOrder: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
155
+ additionalProperties: Schema.optional<Schema.Union<[Schema.suspend<JsonSchemaType, JsonSchemaType, never>, typeof Schema.Boolean]>>;
156
+ properties: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>>;
157
+ patternProperties: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>>;
158
+ propertyNames: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
159
+ definitions: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>>;
160
+ dependencies: Schema.optional<Schema.Record$<typeof Schema.String, Schema.suspend<string | string[] | JsonSchemaType, string | string[] | JsonSchemaType, never>>>;
161
+ contentMediaType: Schema.optional<typeof Schema.String>;
162
+ contentEncoding: Schema.optional<typeof Schema.String>;
163
+ if: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
164
+ then: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
165
+ else: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
166
+ allOf: Schema.optional<Schema.Array$<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>;
167
+ anyOf: Schema.optional<Schema.Array$<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>;
168
+ oneOf: Schema.optional<Schema.Array$<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>;
169
+ not: Schema.optional<Schema.suspend<JsonSchemaType, JsonSchemaType, never>>;
170
+ $defs: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, Schema.suspend<JsonSchemaType, JsonSchemaType, never>>>>;
171
+ currency: Schema.optional<typeof Schema.String>;
172
+ reference: Schema.optional<Schema.mutable<Schema.Struct<{
173
+ schema: Schema.suspend<JsonSchemaType, JsonSchemaType, never>;
174
+ schemaVersion: Schema.optional<typeof Schema.String>;
175
+ schemaObject: Schema.optional<typeof Schema.String>;
176
+ }>>>;
177
+ /**
178
+ * ECHO-specific annotations.
179
+ */
180
+ annotations: Schema.optional<Schema.mutable<Schema.mutable<Schema.Struct<{
181
+ /**
182
+ * Label for this schema.
183
+ * Mapped from {@link LabelAnnotationId}.
184
+ */
185
+ labelProp: Schema.optional<Schema.Union<[Schema.Schema<JsonPath, JsonPath, never>, Schema.Array$<Schema.Schema<JsonPath, JsonPath, never>>]>>;
186
+ /**
187
+ * Generator function for this schema.
188
+ * Mapped from {@link GeneratorAnnotationId}.
189
+ */
190
+ generator: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Tuple2<typeof Schema.String, typeof Schema.Number>]>>;
191
+ /**
192
+ * {@link PropertyMeta} annotations get serialized here.
193
+ */
194
+ meta: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
195
+ /**
196
+ * @deprecated
197
+ */
198
+ type: Schema.optional<Schema.mutable<Schema.Struct<{
199
+ typename: typeof Schema.String;
200
+ version: typeof Schema.String;
201
+ schemaId: Schema.optional<typeof Schema.String>;
202
+ }>>>;
203
+ /**
204
+ * @deprecated Superseded by `meta`.
205
+ */
206
+ annotations: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
207
+ }>>>>;
208
+ /**
209
+ * @deprecated Use `annotations` instead.
210
+ */
211
+ echo: Schema.optional<Schema.mutable<Schema.mutable<Schema.Struct<{
212
+ /**
213
+ * Label for this schema.
214
+ * Mapped from {@link LabelAnnotationId}.
215
+ */
216
+ labelProp: Schema.optional<Schema.Union<[Schema.Schema<JsonPath, JsonPath, never>, Schema.Array$<Schema.Schema<JsonPath, JsonPath, never>>]>>;
217
+ /**
218
+ * Generator function for this schema.
219
+ * Mapped from {@link GeneratorAnnotationId}.
220
+ */
221
+ generator: Schema.optional<Schema.Union<[typeof Schema.String, Schema.Tuple2<typeof Schema.String, typeof Schema.Number>]>>;
222
+ /**
223
+ * {@link PropertyMeta} annotations get serialized here.
224
+ */
225
+ meta: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
226
+ /**
227
+ * @deprecated
228
+ */
229
+ type: Schema.optional<Schema.mutable<Schema.Struct<{
230
+ typename: typeof Schema.String;
231
+ version: typeof Schema.String;
232
+ schemaId: Schema.optional<typeof Schema.String>;
233
+ }>>>;
234
+ /**
235
+ * @deprecated Superseded by `meta`.
236
+ */
237
+ annotations: Schema.optional<Schema.mutable<Schema.Record$<typeof Schema.String, typeof Schema.Any>>>;
238
+ }>>>>;
239
+ }>;
240
+ export declare const JsonSchemaFields: string[];
241
+ /**
242
+ * https://json-schema.org/draft-07/schema
243
+ */
244
+ export interface JsonSchemaType extends Schema.Schema.Type<Schema.mutable<typeof _JsonSchemaType>> {
245
+ }
246
+ export declare const JsonSchemaType: Schema.Schema<JsonSchemaType>;
247
+ export declare const getSchemaProperty: (schema: JsonSchemaType, property: JsonProp) => JsonSchemaType | undefined;
248
+ export declare const setSchemaProperty: (schema: JsonSchemaType, property: JsonProp, value: JsonSchemaType) => JsonSchemaType;
249
+ export {};
250
+ //# sourceMappingURL=json-schema-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-schema-type.d.ts","sourceRoot":"","sources":["../../../../../src/internal/json-schema/json-schema-type.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAqBvD;;GAEG;AACH,eAAO,MAAM,yBAAyB;IACpC;;;OAGG;;IAGH;;;OAGG;;IAGH;;OAEG;;IAQH;;OAEG;;;;;;IAYH;;OAEG;;GAOkB,CAAC;AACxB,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE7F;;;;GAIG;AAGH,QAAA,MAAM,eAAe;IACnB;;;OAGG;;IAKH;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;;;;IAmBH;;OAEG;;IAGH;;OAEG;;;;;;;;;;;;IAiCH;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;IAuEH;;OAEG;;QArSH;;;WAGG;;QAGH;;;WAGG;;QAGH;;WAEG;;QAQH;;WAEG;;;;;;QAYH;;WAEG;;;IAmQH;;OAEG;;QA3SH;;;WAGG;;QAGH;;;WAGG;;QAGH;;WAEG;;QAQH;;WAEG;;;;;;QAYH;;WAEG;;;EAuQmE,CAAC;AAEzE,eAAO,MAAM,gBAAgB,UAAsC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,eAAe,CAAC,CAAC;CAAG;AAErG,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAwC,CAAC;AAIlG,eAAO,MAAM,iBAAiB,GAAI,QAAQ,cAAc,EAAE,UAAU,QAAQ,KAAG,cAAc,GAAG,SAE/F,CAAC;AAGF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,cAAc,EAAE,UAAU,QAAQ,EAAE,OAAO,cAAc,mBAIlG,CAAC"}
@@ -0,0 +1,37 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { DXN } from '@dxos/keys';
3
+ /**
4
+ * Returns a DXN for an object or schema.
5
+ * @deprecated Use `Obj.getDXN`.
6
+ */
7
+ export declare const getObjectDXN: (object: any) => DXN | undefined;
8
+ /**
9
+ * Returns the schema for the given object if one is defined.
10
+ */
11
+ export declare const getSchema: (obj: unknown | undefined) => Schema.Schema.AnyNoContext | undefined;
12
+ /**
13
+ * Internal use only.
14
+ */
15
+ export declare const setSchema: (obj: any, schema: Schema.Schema.AnyNoContext) => void;
16
+ /**
17
+ * @deprecated Use {@link Obj.getLabel} instead.
18
+ * Returns the label for a given object based on {@link LabelAnnotationId}.
19
+ */
20
+ export declare const getLabelForObject: (obj: unknown | undefined) => string | undefined;
21
+ /**
22
+ * Returns the label for a given object based on {@link LabelAnnotationId}.
23
+ */
24
+ export declare const getLabel: <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>) => string | undefined;
25
+ /**
26
+ * Sets the label for a given object based on {@link LabelAnnotationId}.
27
+ */
28
+ export declare const setLabel: <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>, label: string) => void;
29
+ /**
30
+ * Returns the label for a given object based on {@link LabelAnnotationId}.
31
+ */
32
+ export declare const getDescription: <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>) => string | undefined;
33
+ /**
34
+ * Sets the description for a given object based on {@link DescriptionAnnotationId}.
35
+ */
36
+ export declare const setDescription: <S extends Schema.Schema.Any>(schema: S, object: Schema.Schema.Type<S>, description: string) => void;
37
+ //# sourceMappingURL=accessors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessors.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/accessors.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,GAAG,EAAY,MAAM,YAAY,CAAC;AAW3C;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,GAAG,KAAG,GAAG,GAAG,SAehD,CAAC;AAEF;;GAEG;AAGH,eAAO,MAAM,SAAS,GAAI,KAAK,OAAO,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG,SAIjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,GAAG,EAAE,QAAQ,MAAM,CAAC,MAAM,CAAC,YAAY,SAOrE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,OAAO,GAAG,SAAS,KAAG,MAAM,GAAG,SAKrE,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAG,MAAM,GAAG,SAwBzG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM,SAM5G,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EACxD,QAAQ,CAAC,EACT,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAC5B,MAAM,GAAG,SAiBX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EACxD,QAAQ,CAAC,EACT,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAC7B,aAAa,MAAM,SAIpB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import * as Schema from 'effect/Schema';
2
+ export type TypedObjectOptions = {
3
+ partial?: true;
4
+ record?: true;
5
+ };
6
+ /**
7
+ *
8
+ */
9
+ type SimplifiedSchemaFields<SchemaFields extends Schema.Struct.Fields, Options extends TypedObjectOptions> = Options['partial'] extends boolean ? Schema.SimplifyMutable<Partial<Schema.Struct.Type<SchemaFields>>> : Schema.SimplifyMutable<Schema.Struct.Type<SchemaFields>>;
10
+ /**
11
+ *
12
+ */
13
+ export type TypedObjectFields<SchemaFields extends Schema.Struct.Fields, Options extends TypedObjectOptions> = SimplifiedSchemaFields<SchemaFields, Options> & {
14
+ id: string;
15
+ } & (Options['record'] extends boolean ? Schema.SimplifyMutable<Schema.IndexSignature.Type<Schema.IndexSignature.Records>> : {});
16
+ export declare const makeTypedEntityClass: (typename: string, version: string, baseSchema: Schema.Schema.AnyNoContext) => Schema.SchemaClass<any>;
17
+ export {};
18
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/common.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAOxC,MAAM,MAAM,kBAAkB,GAAG;IAE/B,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,MAAM,CAAC,EAAE,IAAI,CAAC;CACf,CAAC;AAEF;;GAEG;AAGH,KAAK,sBAAsB,CACzB,YAAY,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,EACzC,OAAO,SAAS,kBAAkB,IAChC,OAAO,CAAC,SAAS,CAAC,SAAS,OAAO,GAClC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GACjE,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;AAE7D;;GAEG;AAGH,MAAM,MAAM,iBAAiB,CAC3B,YAAY,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,EACzC,OAAO,SAAS,kBAAkB,IAChC,sBAAsB,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,OAAO,GACjG,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACjF,EAAE,CAAC,CAAC;AAEV,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,EAChB,SAAS,MAAM,EACf,YAAY,MAAM,CAAC,MAAM,CAAC,YAAY,KACrC,MAAM,CAAC,WAAW,CAAC,GAAG,CAuBxB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type * as Schema from 'effect/Schema';
2
+ import { EntityKindId } from './model';
3
+ type CreateData<T> = T extends {
4
+ id: string;
5
+ } ? Omit<T, 'id' | typeof EntityKindId> & {
6
+ id?: string;
7
+ } : T;
8
+ /**
9
+ * Creates a new object instance from a schema and data, without signal reactivity.
10
+ * This static version creates plain JavaScript objects that are not reactive/observable.
11
+ * For reactive objects that automatically update UI when changed, use the regular live() function.
12
+ *
13
+ * @param schema - The Effect schema that defines the object's structure and type, piped into EchoObject
14
+ * @param data - The data to initialize the object with. The id and @type fields are handled automatically.
15
+ * @returns A new non-reactive object instance conforming to the schema
16
+ * @throws {Error} If the schema is not an object schema
17
+ * @throws {TypeError} If data contains an @type field
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const Contact = Schema.Struct({
22
+ * name: Schema.String,
23
+ * email: Schema.String,
24
+ * }).pipe(Type.Obj({
25
+ * typename: 'example.com/type/Contact',
26
+ * version: '0.1.0',
27
+ * }))
28
+ *
29
+ * // Creates a non-reactive contact object
30
+ * const contact = create(Contact, {
31
+ * name: "John",
32
+ * email: "john@example.com",
33
+ * })
34
+ * ```
35
+ */
36
+ export declare const create: <S extends Schema.Schema.AnyNoContext>(schema: S, data: CreateData<Schema.Schema.Type<S>>) => CreateData<Schema.Schema.Type<S>> & {
37
+ id: string;
38
+ };
39
+ export {};
40
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/create.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAY7C,OAAO,EACL,YAAY,EAOb,MAAM,SAAS,CAAC;AAIjB,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO,YAAY,CAAC,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,CAAC,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EACzD,QAAQ,CAAC,EACT,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KACtC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CA+BlD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=create.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/create.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { BaseObject } from '../types';
2
+ /**
3
+ * @returns `true` if the object has been marked as deleted.
4
+ */
5
+ export declare const isDeleted: (obj: BaseObject) => boolean;
6
+ //# sourceMappingURL=deleted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleted.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/deleted.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,UAAU,KAAG,OAO3C,CAAC"}
@@ -0,0 +1,33 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import type * as Types from 'effect/Types';
3
+ import { EntityKind, type TypeMeta } from '../ast';
4
+ import { type HasId, type ToMutable } from '../types';
5
+ import { type RelationSourceTargetRefs } from './relation';
6
+ type EchoTypeSchemaProps<T, ExtraFields = {}> = Types.Simplify<HasId & ToMutable<T> & ExtraFields>;
7
+ export interface EchoTypeSchema<Self extends Schema.Schema.Any, ExtraFields = {}> extends TypeMeta, Schema.AnnotableClass<EchoTypeSchema<Self, ExtraFields>, EchoTypeSchemaProps<Schema.Schema.Type<Self>, ExtraFields>, EchoTypeSchemaProps<Schema.Schema.Encoded<Self>, ExtraFields>, Schema.Schema.Context<Self>> {
8
+ instanceOf(value: unknown): boolean;
9
+ }
10
+ /**
11
+ * Pipeable function to add ECHO object annotations to a schema.
12
+ */
13
+ export declare const EchoObject: {
14
+ (meta: TypeMeta): <Self extends Schema.Schema.Any>(self: Self) => EchoTypeSchema<Self>;
15
+ };
16
+ export type EchoRelationOptions<TSource extends Schema.Schema.AnyNoContext, TTarget extends Schema.Schema.AnyNoContext> = TypeMeta & {
17
+ source: TSource;
18
+ target: TTarget;
19
+ };
20
+ export declare const EchoRelation: <Source extends Schema.Schema.AnyNoContext, Target extends Schema.Schema.AnyNoContext>(options: EchoRelationOptions<Source, Target>) => <Self extends Schema.Schema.Any>(self: Self) => EchoTypeSchema<Self, RelationSourceTargetRefs<Schema.Schema.Type<Source>, Schema.Schema.Type<Target>>>;
21
+ /**
22
+ * @returns JSON-schema annotation so that the schema can be serialized with correct parameters.
23
+ */
24
+ export declare const makeTypeJsonSchemaAnnotation: (options: {
25
+ identifier?: string;
26
+ kind: EntityKind;
27
+ typename: string;
28
+ version: string;
29
+ relationSource?: string;
30
+ relationTarget?: string;
31
+ }) => any;
32
+ export {};
33
+ //# sourceMappingURL=entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/entity.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAC;AAM3C,OAAO,EACL,UAAU,EAGV,KAAK,QAAQ,EAId,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAK3D,KAAK,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC;AAEnG,MAAM,WAAW,cAAc,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,EAAE,CAC9E,SAAQ,QAAQ,EACd,MAAM,CAAC,cAAc,CACnB,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,EACjC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,EAC1D,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,EAC7D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAC5B;IAQH,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;CACrC;AAED;;GAEG;AAEH,eAAO,MAAM,UAAU,EAAE;IAGvB,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC,IAAI,CAAC,CAAC;CAuBxF,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAC7B,OAAO,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAC1C,OAAO,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,IACxC,QAAQ,GAAG;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,CAAC,YAAY,EAC/G,SAAS,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAapC,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,EACpC,MAAM,IAAI,KACT,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CA6BzG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,SAAS;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAgBA,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as Schema from 'effect/Schema';
2
+ export declare const EXPANDO_TYPENAME = "dxos.org/type/Expando";
3
+ declare const ExpandoSchema: import("./entity").EchoTypeSchema<Schema.TypeLiteral<{}, readonly [{
4
+ readonly key: typeof Schema.String;
5
+ readonly value: typeof Schema.Any;
6
+ }]>, {}>;
7
+ /**
8
+ * Expando object is an object with an arbitrary set of properties.
9
+ */
10
+ export interface Expando extends Schema.Schema.Type<typeof ExpandoSchema> {
11
+ }
12
+ export declare const Expando: Schema.Schema<Expando>;
13
+ export {};
14
+ //# sourceMappingURL=expando.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expando.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/expando.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,QAAA,MAAM,aAAa;;;QAElB,CAAC;AAEF;;GAEG;AAEH,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,aAAa,CAAC;CAAG;AAE5E,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { DXN, SpaceId } from '@dxos/keys';
2
+ /**
3
+ * @deprecated Use `db.queues.create()`
4
+ */
5
+ export declare const createQueueDXN: (spaceId?: SpaceId, queueId?: string) => DXN;
6
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/ids.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,GAAG,EAA+B,OAAO,EAAE,MAAM,YAAY,CAAC;AAGvE;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,iBAA0B,EAAE,gBAA2B,QACjB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export * from './common';
2
+ export * from './create';
3
+ export * from './entity';
4
+ export * from './expando';
5
+ export * from './ids';
6
+ export * from './json-serializer';
7
+ export * from './meta';
8
+ export type * from './relation';
9
+ export * from './typed-object';
10
+ export * from './typename';
11
+ export * from './deleted';
12
+ export * from './model';
13
+ export * from './accessors';
14
+ export * from './schema-validator';
15
+ export * from './version';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,mBAAmB,YAAY,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=inspect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/inspect.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import { type EncodedReference } from '@dxos/echo-protocol';
2
+ import { DXN } from '@dxos/keys';
3
+ import { Ref, type RefResolver } from '../ref';
4
+ import { type AnyEchoObject } from '../types';
5
+ import { type ObjectJSON } from './model';
6
+ type DeepReplaceRef<T> = T extends Ref<any> ? EncodedReference : T extends object ? {
7
+ [K in keyof T]: DeepReplaceRef<T[K]>;
8
+ } : T;
9
+ type SerializedObject<T extends {
10
+ id: string;
11
+ }> = {
12
+ [K in keyof T]: DeepReplaceRef<T[K]>;
13
+ } & ObjectJSON;
14
+ /**
15
+ * Converts object to it's JSON representation.
16
+ */
17
+ export declare const objectToJSON: <T extends AnyEchoObject>(obj: T) => SerializedObject<T>;
18
+ /**
19
+ * Creates an object from it's json representation.
20
+ * Performs schema validation.
21
+ * References and schema will be resolvable if the `refResolver` is provided.
22
+ *
23
+ * The function need to be async to support resolving the schema as well as the relation endpoints.
24
+ */
25
+ export declare const objectFromJSON: (jsonData: unknown, { refResolver, dxn }?: {
26
+ refResolver?: RefResolver;
27
+ dxn?: DXN;
28
+ }) => Promise<AnyEchoObject>;
29
+ export declare const setRefResolverOnData: (obj: AnyEchoObject, refResolver: RefResolver) => void;
30
+ export declare const attachTypedJsonSerializer: (obj: any) => void;
31
+ export {};
32
+ //# sourceMappingURL=json-serializer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-serializer.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/json-serializer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAuC,MAAM,qBAAqB,CAAC;AAEjG,OAAO,EAAE,GAAG,EAAY,MAAM,YAAY,CAAC;AAK3C,OAAO,EAAE,GAAG,EAAE,KAAK,WAAW,EAA2C,MAAM,QAAQ,CAAC;AACxF,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9C,OAAO,EASL,KAAK,UAAU,EAQhB,MAAM,SAAS,CAAC;AAGjB,KAAK,cAAc,CAAC,CAAC,IACnB,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,GAAG,gBAAgB,GAAG,CAAC,SAAS,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AAE1G,KAAK,gBAAgB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,UAAU,CAAC;AAExG;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,aAAa,EAAE,KAAK,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAIhF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,OAAO,EACjB,uBAAsB;IAAE,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,GAAG,CAAC,EAAE,GAAG,CAAA;CAAO,KAClE,OAAO,CAAC,aAAa,CAmEvB,CAAC;AAqBF,eAAO,MAAM,oBAAoB,GAAI,KAAK,aAAa,EAAE,aAAa,WAAW,SAUhF,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,KAAK,GAAG,SAajD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=json-serializer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-serializer.test.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/json-serializer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { ForeignKey } from '@dxos/echo-protocol';
3
+ import { type Comparator } from '@dxos/util';
4
+ import { type BaseObject } from '../types';
5
+ export declare const ObjectMetaSchema: Schema.mutable<Schema.Struct<{
6
+ keys: Schema.mutable<Schema.Array$<Schema.Schema<{
7
+ readonly id: string;
8
+ readonly source: string;
9
+ }, {
10
+ readonly id: string;
11
+ readonly source: string;
12
+ }, never>>>;
13
+ /**
14
+ * A set of tags.
15
+ * Tags are arbitrary application-defined strings.
16
+ * ECHO makes no assumptions about the tag structure.
17
+ */
18
+ tags: Schema.optional<Schema.mutable<Schema.Array$<typeof Schema.String>>>;
19
+ }>>;
20
+ export type ObjectMeta = Schema.Schema.Type<typeof ObjectMetaSchema>;
21
+ export declare const foreignKey: (source: string, id: string) => ForeignKey;
22
+ export declare const foreignKeyEquals: (a: ForeignKey, b: ForeignKey) => boolean;
23
+ /**
24
+ * Get metadata from object.
25
+ * Only callable on the object root.
26
+ * @deprecated Use {@link getMeta}.
27
+ */
28
+ export declare const getObjectMeta: (obj: any) => ObjectMeta;
29
+ export declare const getMeta: (obj: BaseObject) => ObjectMeta;
30
+ export declare const compareForeignKeys: Comparator<BaseObject>;
31
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../../src/internal/object/meta.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,YAAY,CAAC;AAE3D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,eAAO,MAAM,gBAAgB;;;;;;;;IAIzB;;;;OAIG;;GAKN,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAErE,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,IAAI,MAAM,KAAG,UAA8B,CAAC;AACvF,eAAO,MAAM,gBAAgB,GAAI,GAAG,UAAU,EAAE,GAAG,UAAU,YAA2C,CAAC;AAEzG;;;;GAIG;AAEH,eAAO,MAAM,aAAa,GAAI,KAAK,GAAG,KAAG,UAExC,CAAC;AAMF,eAAO,MAAM,OAAO,GAAI,KAAK,UAAU,KAAG,UAIzC,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,UAAU,CACuB,CAAC"}