@dxos/echo 0.8.4-main.937b3ca → 0.8.4-main.9735255

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 (225) hide show
  1. package/dist/lib/{browser → neutral}/Annotation.mjs +4 -5
  2. package/dist/lib/neutral/Database.mjs +17 -0
  3. package/dist/lib/{browser → neutral}/Entity.mjs +8 -9
  4. package/dist/lib/{browser → neutral}/Err.mjs +2 -3
  5. package/dist/lib/{browser → neutral}/Filter.mjs +9 -10
  6. package/dist/lib/{browser → neutral}/Format.mjs +4 -5
  7. package/dist/lib/neutral/JsonSchema.mjs +19 -0
  8. package/dist/lib/{browser → neutral}/Key.mjs +2 -3
  9. package/dist/lib/{browser → neutral}/Obj.mjs +9 -10
  10. package/dist/lib/{browser → neutral}/Order.mjs +2 -3
  11. package/dist/lib/neutral/Query.mjs +26 -0
  12. package/dist/lib/neutral/QueryResult.mjs +2 -0
  13. package/dist/lib/neutral/Ref.mjs +22 -0
  14. package/dist/lib/{browser → neutral}/Relation.mjs +9 -10
  15. package/dist/lib/neutral/SchemaRegistry.mjs +2 -0
  16. package/dist/lib/neutral/Tag.mjs +25 -0
  17. package/dist/lib/{browser → neutral}/Type.mjs +8 -9
  18. package/dist/lib/{browser/chunk-NOPVNWPT.mjs → neutral/chunk-2MTHJ5UW.mjs} +6 -7
  19. package/dist/lib/{node-esm/chunk-ILMLLM4R.mjs.map → neutral/chunk-2MTHJ5UW.mjs.map} +2 -2
  20. package/dist/lib/{browser/chunk-22JMFST2.mjs → neutral/chunk-3ZEAZF7T.mjs} +3 -4
  21. package/dist/lib/{browser/chunk-22JMFST2.mjs.map → neutral/chunk-3ZEAZF7T.mjs.map} +1 -1
  22. package/dist/lib/{browser/chunk-ZHXZGIXD.mjs → neutral/chunk-4L6DOFXP.mjs} +1 -3
  23. package/dist/lib/{browser/chunk-ZHXZGIXD.mjs.map → neutral/chunk-4L6DOFXP.mjs.map} +1 -1
  24. package/dist/lib/{browser/chunk-PQZW3S6L.mjs → neutral/chunk-4TT624YA.mjs} +3 -4
  25. package/dist/lib/{node-esm/chunk-Y75VU7LB.mjs.map → neutral/chunk-4TT624YA.mjs.map} +1 -1
  26. package/dist/lib/{browser/chunk-FRDT7RA4.mjs → neutral/chunk-62DWJ6CE.mjs} +3 -4
  27. package/dist/lib/{node-esm/chunk-W6QIEBTQ.mjs.map → neutral/chunk-62DWJ6CE.mjs.map} +3 -3
  28. package/dist/lib/{browser/chunk-W5D2GWAW.mjs → neutral/chunk-6QPSGMEF.mjs} +5 -6
  29. package/dist/lib/{browser/chunk-W5D2GWAW.mjs.map → neutral/chunk-6QPSGMEF.mjs.map} +1 -1
  30. package/dist/lib/{browser/chunk-INHXFXY5.mjs → neutral/chunk-ANHVGJI4.mjs} +2 -3
  31. package/dist/lib/{node-esm/chunk-AJEMYSIR.mjs.map → neutral/chunk-ANHVGJI4.mjs.map} +1 -1
  32. package/dist/lib/{browser/chunk-RK4Z4JUZ.mjs → neutral/chunk-CUDIBUM4.mjs} +2 -3
  33. package/dist/lib/{node-esm/chunk-YOLH5KS4.mjs.map → neutral/chunk-CUDIBUM4.mjs.map} +1 -1
  34. package/dist/lib/{browser/chunk-XDIUHAAX.mjs → neutral/chunk-HMOXCO27.mjs} +3 -4
  35. package/dist/lib/{node-esm/chunk-QLI2EIJ2.mjs.map → neutral/chunk-HMOXCO27.mjs.map} +1 -1
  36. package/dist/lib/{browser/chunk-U2J7TA7K.mjs → neutral/chunk-IP2GHXWA.mjs} +5 -6
  37. package/dist/lib/{node-esm/chunk-DMR7OAFK.mjs.map → neutral/chunk-IP2GHXWA.mjs.map} +1 -1
  38. package/dist/lib/{browser/chunk-CGS2ULMK.mjs → neutral/chunk-J5LGTIGS.mjs} +1 -2
  39. package/dist/lib/{browser/chunk-7STIBCP7.mjs → neutral/chunk-KRHDMXSU.mjs} +4 -5
  40. package/dist/lib/{browser/chunk-7STIBCP7.mjs.map → neutral/chunk-KRHDMXSU.mjs.map} +1 -1
  41. package/dist/lib/{browser/chunk-FPOISFQK.mjs → neutral/chunk-NWUO5FKZ.mjs} +3 -4
  42. package/dist/lib/{node-esm/chunk-NBWL7UCZ.mjs.map → neutral/chunk-NWUO5FKZ.mjs.map} +1 -1
  43. package/dist/lib/{browser/chunk-IXVWLTG7.mjs → neutral/chunk-OMUPQMLR.mjs} +1 -3
  44. package/dist/lib/{browser/chunk-IXVWLTG7.mjs.map → neutral/chunk-OMUPQMLR.mjs.map} +1 -1
  45. package/dist/lib/{browser/chunk-JMKVF2YQ.mjs → neutral/chunk-ROKO4RKJ.mjs} +2 -3
  46. package/dist/lib/{node-esm/chunk-K37NA7PO.mjs.map → neutral/chunk-ROKO4RKJ.mjs.map} +1 -1
  47. package/dist/lib/{browser/chunk-CJ5YELTO.mjs → neutral/chunk-RPB6V4BE.mjs} +2 -3
  48. package/dist/lib/{browser/chunk-CJ5YELTO.mjs.map → neutral/chunk-RPB6V4BE.mjs.map} +1 -1
  49. package/dist/lib/{browser/chunk-BJPE6CIC.mjs → neutral/chunk-SU2LVM7J.mjs} +47 -48
  50. package/dist/lib/neutral/chunk-SU2LVM7J.mjs.map +7 -0
  51. package/dist/lib/{browser/chunk-ZAGAOZVY.mjs → neutral/chunk-VB5HVDCA.mjs} +4 -5
  52. package/dist/lib/{node-esm/chunk-QYR67VBV.mjs.map → neutral/chunk-VB5HVDCA.mjs.map} +1 -1
  53. package/dist/lib/{browser/chunk-2SBB7OWV.mjs → neutral/chunk-VR4A4WGG.mjs} +5 -6
  54. package/dist/lib/{browser/chunk-2SBB7OWV.mjs.map → neutral/chunk-VR4A4WGG.mjs.map} +2 -2
  55. package/dist/lib/{browser/chunk-MYCCGG2T.mjs → neutral/chunk-X2MPMYYN.mjs} +1 -3
  56. package/dist/lib/{node-esm/chunk-MOWUEW5P.mjs.map → neutral/chunk-X2MPMYYN.mjs.map} +1 -1
  57. package/dist/lib/{browser/chunk-6L5HHUVU.mjs → neutral/chunk-XK5OUUBY.mjs} +4 -5
  58. package/dist/lib/{node-esm/chunk-5OBN7GZW.mjs.map → neutral/chunk-XK5OUUBY.mjs.map} +1 -1
  59. package/dist/lib/{browser/chunk-KQQGVHFN.mjs → neutral/chunk-XMIDBDE6.mjs} +5 -6
  60. package/dist/lib/{node-esm/chunk-NRN3ZW2T.mjs.map → neutral/chunk-XMIDBDE6.mjs.map} +1 -1
  61. package/dist/lib/{browser/chunk-YKTSSMDS.mjs → neutral/chunk-YQYMWZAD.mjs} +1 -3
  62. package/dist/lib/{node-esm/chunk-XHJRMQZD.mjs.map → neutral/chunk-YQYMWZAD.mjs.map} +1 -1
  63. package/dist/lib/{browser → neutral}/index.mjs +23 -24
  64. package/dist/lib/{browser → neutral}/internal/index.mjs +7 -8
  65. package/dist/lib/neutral/meta.json +1 -0
  66. package/dist/lib/{browser → neutral}/testing/index.mjs +23 -24
  67. package/dist/lib/{node-esm → neutral}/testing/index.mjs.map +1 -1
  68. package/dist/types/src/Obj.d.ts +2 -2
  69. package/dist/types/src/Obj.d.ts.map +1 -1
  70. package/dist/types/src/Relation.d.ts +1 -1
  71. package/dist/types/src/Relation.d.ts.map +1 -1
  72. package/dist/types/src/internal/api/meta.d.ts +2 -2
  73. package/dist/types/src/internal/api/meta.d.ts.map +1 -1
  74. package/dist/types/src/internal/entities/object.d.ts.map +1 -1
  75. package/dist/types/src/internal/entities/relation.d.ts.map +1 -1
  76. package/dist/types/src/internal/formats/select.d.ts +2 -2
  77. package/dist/types/src/internal/formats/select.d.ts.map +1 -1
  78. package/dist/types/src/internal/json-schema/json-schema-normalize.d.ts.map +1 -1
  79. package/dist/types/src/internal/json-schema/json-schema-type.d.ts +130 -29
  80. package/dist/types/src/internal/json-schema/json-schema-type.d.ts.map +1 -1
  81. package/dist/types/src/internal/json-schema/json-schema.d.ts +2 -1
  82. package/dist/types/src/internal/json-schema/json-schema.d.ts.map +1 -1
  83. package/dist/types/src/internal/ref/ref.d.ts +2 -1
  84. package/dist/types/src/internal/ref/ref.d.ts.map +1 -1
  85. package/dist/types/src/internal/schema/compose.d.ts +2 -1
  86. package/dist/types/src/internal/schema/compose.d.ts.map +1 -1
  87. package/dist/types/src/internal/types/meta.d.ts +5 -5
  88. package/dist/types/src/internal/types/meta.d.ts.map +1 -1
  89. package/dist/types/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +33 -112
  91. package/src/Obj.ts +3 -3
  92. package/src/Relation.ts +2 -2
  93. package/src/internal/api/meta.ts +3 -3
  94. package/src/internal/entities/object.ts +1 -3
  95. package/src/internal/entities/relation.ts +1 -3
  96. package/src/internal/formats/format.test.ts +1 -1
  97. package/src/internal/formats/select.ts +1 -1
  98. package/src/internal/json-schema/json-schema-normalize.ts +4 -2
  99. package/src/internal/json-schema/json-schema-type.ts +30 -31
  100. package/src/internal/json-schema/json-schema.ts +10 -6
  101. package/src/internal/object/json-serializer.test.ts +3 -2
  102. package/src/internal/object/schema-validator.test.ts +3 -7
  103. package/src/internal/object/set-value.test.ts +9 -9
  104. package/src/internal/proxy/typed-handler.test.ts +8 -12
  105. package/src/internal/proxy/typed-object.test.ts +11 -11
  106. package/src/internal/ref/ref.test.ts +1 -1
  107. package/src/internal/ref/ref.ts +2 -1
  108. package/src/internal/schema/compose.ts +13 -8
  109. package/src/internal/types/meta.ts +12 -13
  110. package/dist/lib/browser/Database.mjs +0 -18
  111. package/dist/lib/browser/JsonSchema.mjs +0 -20
  112. package/dist/lib/browser/Query.mjs +0 -27
  113. package/dist/lib/browser/QueryResult.mjs +0 -3
  114. package/dist/lib/browser/Ref.mjs +0 -23
  115. package/dist/lib/browser/SchemaRegistry.mjs +0 -3
  116. package/dist/lib/browser/Tag.mjs +0 -26
  117. package/dist/lib/browser/chunk-6L5HHUVU.mjs.map +0 -7
  118. package/dist/lib/browser/chunk-BJPE6CIC.mjs.map +0 -7
  119. package/dist/lib/browser/chunk-FPOISFQK.mjs.map +0 -7
  120. package/dist/lib/browser/chunk-FRDT7RA4.mjs.map +0 -7
  121. package/dist/lib/browser/chunk-INHXFXY5.mjs.map +0 -7
  122. package/dist/lib/browser/chunk-JMKVF2YQ.mjs.map +0 -7
  123. package/dist/lib/browser/chunk-KQQGVHFN.mjs.map +0 -7
  124. package/dist/lib/browser/chunk-MYCCGG2T.mjs.map +0 -7
  125. package/dist/lib/browser/chunk-NOPVNWPT.mjs.map +0 -7
  126. package/dist/lib/browser/chunk-PQZW3S6L.mjs.map +0 -7
  127. package/dist/lib/browser/chunk-RK4Z4JUZ.mjs.map +0 -7
  128. package/dist/lib/browser/chunk-U2J7TA7K.mjs.map +0 -7
  129. package/dist/lib/browser/chunk-XDIUHAAX.mjs.map +0 -7
  130. package/dist/lib/browser/chunk-YKTSSMDS.mjs.map +0 -7
  131. package/dist/lib/browser/chunk-ZAGAOZVY.mjs.map +0 -7
  132. package/dist/lib/browser/meta.json +0 -1
  133. package/dist/lib/browser/testing/index.mjs.map +0 -7
  134. package/dist/lib/node-esm/Annotation.mjs +0 -33
  135. package/dist/lib/node-esm/Annotation.mjs.map +0 -7
  136. package/dist/lib/node-esm/Database.mjs +0 -18
  137. package/dist/lib/node-esm/Database.mjs.map +0 -7
  138. package/dist/lib/node-esm/Entity.mjs +0 -52
  139. package/dist/lib/node-esm/Entity.mjs.map +0 -7
  140. package/dist/lib/node-esm/Err.mjs +0 -11
  141. package/dist/lib/node-esm/Err.mjs.map +0 -7
  142. package/dist/lib/node-esm/Filter.mjs +0 -62
  143. package/dist/lib/node-esm/Filter.mjs.map +0 -7
  144. package/dist/lib/node-esm/Format.mjs +0 -67
  145. package/dist/lib/node-esm/Format.mjs.map +0 -7
  146. package/dist/lib/node-esm/JsonSchema.mjs +0 -20
  147. package/dist/lib/node-esm/JsonSchema.mjs.map +0 -7
  148. package/dist/lib/node-esm/Key.mjs +0 -13
  149. package/dist/lib/node-esm/Key.mjs.map +0 -7
  150. package/dist/lib/node-esm/Obj.mjs +0 -91
  151. package/dist/lib/node-esm/Obj.mjs.map +0 -7
  152. package/dist/lib/node-esm/Order.mjs +0 -13
  153. package/dist/lib/node-esm/Order.mjs.map +0 -7
  154. package/dist/lib/node-esm/Query.mjs +0 -27
  155. package/dist/lib/node-esm/Query.mjs.map +0 -7
  156. package/dist/lib/node-esm/QueryResult.mjs +0 -3
  157. package/dist/lib/node-esm/QueryResult.mjs.map +0 -7
  158. package/dist/lib/node-esm/Ref.mjs +0 -23
  159. package/dist/lib/node-esm/Ref.mjs.map +0 -7
  160. package/dist/lib/node-esm/Relation.mjs +0 -85
  161. package/dist/lib/node-esm/Relation.mjs.map +0 -7
  162. package/dist/lib/node-esm/SchemaRegistry.mjs +0 -3
  163. package/dist/lib/node-esm/SchemaRegistry.mjs.map +0 -7
  164. package/dist/lib/node-esm/Tag.mjs +0 -26
  165. package/dist/lib/node-esm/Tag.mjs.map +0 -7
  166. package/dist/lib/node-esm/Type.mjs +0 -48
  167. package/dist/lib/node-esm/Type.mjs.map +0 -7
  168. package/dist/lib/node-esm/chunk-4PNXQA64.mjs +0 -250
  169. package/dist/lib/node-esm/chunk-4PNXQA64.mjs.map +0 -7
  170. package/dist/lib/node-esm/chunk-5OBN7GZW.mjs +0 -158
  171. package/dist/lib/node-esm/chunk-AJEMYSIR.mjs +0 -22
  172. package/dist/lib/node-esm/chunk-ANLVLWME.mjs +0 -98
  173. package/dist/lib/node-esm/chunk-ANLVLWME.mjs.map +0 -7
  174. package/dist/lib/node-esm/chunk-DMR7OAFK.mjs +0 -57
  175. package/dist/lib/node-esm/chunk-FWTSPIFF.mjs +0 -133
  176. package/dist/lib/node-esm/chunk-FWTSPIFF.mjs.map +0 -7
  177. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  178. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  179. package/dist/lib/node-esm/chunk-ILMLLM4R.mjs +0 -204
  180. package/dist/lib/node-esm/chunk-K37NA7PO.mjs +0 -43
  181. package/dist/lib/node-esm/chunk-LT3H4JOX.mjs +0 -3847
  182. package/dist/lib/node-esm/chunk-LT3H4JOX.mjs.map +0 -7
  183. package/dist/lib/node-esm/chunk-MOLNWFNL.mjs +0 -9
  184. package/dist/lib/node-esm/chunk-MOLNWFNL.mjs.map +0 -7
  185. package/dist/lib/node-esm/chunk-MOWUEW5P.mjs +0 -15
  186. package/dist/lib/node-esm/chunk-NBWL7UCZ.mjs +0 -40
  187. package/dist/lib/node-esm/chunk-NRN3ZW2T.mjs +0 -143
  188. package/dist/lib/node-esm/chunk-QLI2EIJ2.mjs +0 -41
  189. package/dist/lib/node-esm/chunk-QYR67VBV.mjs +0 -288
  190. package/dist/lib/node-esm/chunk-UKGVOINP.mjs +0 -9
  191. package/dist/lib/node-esm/chunk-UKGVOINP.mjs.map +0 -7
  192. package/dist/lib/node-esm/chunk-W6QIEBTQ.mjs +0 -403
  193. package/dist/lib/node-esm/chunk-XHJRMQZD.mjs +0 -69
  194. package/dist/lib/node-esm/chunk-Y75VU7LB.mjs +0 -74
  195. package/dist/lib/node-esm/chunk-YOLH5KS4.mjs +0 -283
  196. package/dist/lib/node-esm/chunk-YQ2NWGL5.mjs +0 -39
  197. package/dist/lib/node-esm/chunk-YQ2NWGL5.mjs.map +0 -7
  198. package/dist/lib/node-esm/chunk-ZBB67AKD.mjs +0 -24
  199. package/dist/lib/node-esm/chunk-ZBB67AKD.mjs.map +0 -7
  200. package/dist/lib/node-esm/index.mjs +0 -85
  201. package/dist/lib/node-esm/index.mjs.map +0 -7
  202. package/dist/lib/node-esm/internal/index.mjs +0 -457
  203. package/dist/lib/node-esm/internal/index.mjs.map +0 -7
  204. package/dist/lib/node-esm/meta.json +0 -1
  205. package/dist/lib/node-esm/testing/index.mjs +0 -367
  206. /package/dist/lib/{browser → neutral}/Annotation.mjs.map +0 -0
  207. /package/dist/lib/{browser → neutral}/Database.mjs.map +0 -0
  208. /package/dist/lib/{browser → neutral}/Entity.mjs.map +0 -0
  209. /package/dist/lib/{browser → neutral}/Err.mjs.map +0 -0
  210. /package/dist/lib/{browser → neutral}/Filter.mjs.map +0 -0
  211. /package/dist/lib/{browser → neutral}/Format.mjs.map +0 -0
  212. /package/dist/lib/{browser → neutral}/JsonSchema.mjs.map +0 -0
  213. /package/dist/lib/{browser → neutral}/Key.mjs.map +0 -0
  214. /package/dist/lib/{browser → neutral}/Obj.mjs.map +0 -0
  215. /package/dist/lib/{browser → neutral}/Order.mjs.map +0 -0
  216. /package/dist/lib/{browser → neutral}/Query.mjs.map +0 -0
  217. /package/dist/lib/{browser → neutral}/QueryResult.mjs.map +0 -0
  218. /package/dist/lib/{browser → neutral}/Ref.mjs.map +0 -0
  219. /package/dist/lib/{browser → neutral}/Relation.mjs.map +0 -0
  220. /package/dist/lib/{browser → neutral}/SchemaRegistry.mjs.map +0 -0
  221. /package/dist/lib/{browser → neutral}/Tag.mjs.map +0 -0
  222. /package/dist/lib/{browser → neutral}/Type.mjs.map +0 -0
  223. /package/dist/lib/{browser/chunk-CGS2ULMK.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  224. /package/dist/lib/{browser → neutral}/index.mjs.map +0 -0
  225. /package/dist/lib/{browser → neutral}/internal/index.mjs.map +0 -0
@@ -1,403 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- createAnnotationHelper
4
- } from "./chunk-XHJRMQZD.mjs";
5
-
6
- // src/internal/formats/types.ts
7
- import * as Function from "effect/Function";
8
- import * as Option from "effect/Option";
9
- import * as SchemaAST from "effect/SchemaAST";
10
- var TypeEnum = /* @__PURE__ */ (function(TypeEnum2) {
11
- TypeEnum2["Array"] = "array";
12
- TypeEnum2["Object"] = "object";
13
- TypeEnum2["String"] = "string";
14
- TypeEnum2["Number"] = "number";
15
- TypeEnum2["Boolean"] = "boolean";
16
- TypeEnum2["Ref"] = "ref";
17
- return TypeEnum2;
18
- })({});
19
- var getTypeEnum = (property) => {
20
- switch (property.type) {
21
- case "array":
22
- return "array";
23
- case "object":
24
- return "object";
25
- case "string":
26
- return "string";
27
- case "number":
28
- return "number";
29
- case "boolean":
30
- return "boolean";
31
- default:
32
- return void 0;
33
- }
34
- };
35
- var FormatAnnotationId = Symbol.for("@dxos/schema/annotation/Format");
36
- var FormatAnnotation = createAnnotationHelper(FormatAnnotationId);
37
- var getFormatAnnotation = (node) => Function.pipe(SchemaAST.getAnnotation(FormatAnnotationId)(node), Option.getOrUndefined);
38
- var TypeFormat = /* @__PURE__ */ (function(TypeFormat2) {
39
- TypeFormat2["None"] = "none";
40
- TypeFormat2["String"] = "string";
41
- TypeFormat2["Number"] = "number";
42
- TypeFormat2["Boolean"] = "boolean";
43
- TypeFormat2["Ref"] = "ref";
44
- TypeFormat2["DID"] = "did";
45
- TypeFormat2["DXN"] = "dxn";
46
- TypeFormat2["Email"] = "email";
47
- TypeFormat2["Formula"] = "formula";
48
- TypeFormat2["Hostname"] = "hostname";
49
- TypeFormat2["JSON"] = "json";
50
- TypeFormat2["Markdown"] = "markdown";
51
- TypeFormat2["Regex"] = "regex";
52
- TypeFormat2["SingleSelect"] = "single-select";
53
- TypeFormat2["Text"] = "text";
54
- TypeFormat2["MultiSelect"] = "multi-select";
55
- TypeFormat2["URL"] = "url";
56
- TypeFormat2["UUID"] = "uuid";
57
- TypeFormat2["Currency"] = "currency";
58
- TypeFormat2["Integer"] = "integer";
59
- TypeFormat2["Percent"] = "percent";
60
- TypeFormat2["Timestamp"] = "timestamp";
61
- TypeFormat2["DateTime"] = "date-time";
62
- TypeFormat2["Date"] = "date";
63
- TypeFormat2["Time"] = "time";
64
- TypeFormat2["Duration"] = "duration";
65
- TypeFormat2["GeoPoint"] = "lnglat";
66
- return TypeFormat2;
67
- })({});
68
- var FormatEnums = Object.values(TypeFormat).sort();
69
- var PropertyKind = {
70
- type: TypeEnum,
71
- format: TypeFormat
72
- };
73
- var typeToFormat = {
74
- ["string"]: "string",
75
- ["number"]: "number",
76
- ["boolean"]: "boolean"
77
- };
78
- var formatToType = {
79
- ["none"]: void 0,
80
- ["string"]: "string",
81
- ["number"]: "number",
82
- ["boolean"]: "boolean",
83
- ["ref"]: "ref",
84
- ["did"]: "string",
85
- ["dxn"]: "string",
86
- ["email"]: "string",
87
- ["formula"]: "string",
88
- ["hostname"]: "string",
89
- ["json"]: "string",
90
- ["markdown"]: "string",
91
- ["regex"]: "string",
92
- ["url"]: "string",
93
- ["uuid"]: "string",
94
- ["single-select"]: "string",
95
- ["text"]: "string",
96
- ["multi-select"]: "object",
97
- ["date"]: "string",
98
- ["date-time"]: "string",
99
- ["duration"]: "string",
100
- ["time"]: "string",
101
- ["currency"]: "number",
102
- ["integer"]: "number",
103
- ["percent"]: "number",
104
- ["timestamp"]: "number",
105
- ["lnglat"]: "array"
106
- };
107
- var OptionsAnnotationId = Symbol.for("@dxos/schema/annotation/Options");
108
- var OptionsAnnotation = createAnnotationHelper(OptionsAnnotationId);
109
- var getOptionsAnnotation = (node) => Function.pipe(SchemaAST.getAnnotation(OptionsAnnotationId)(node), Option.getOrUndefined);
110
-
111
- // src/internal/formats/number.ts
112
- import * as Schema from "effect/Schema";
113
- var encodeMultipleOf = (divisor) => 1 / Math.pow(10, divisor);
114
- var encodeMultiple = (divisor) => (self) => divisor === void 0 || divisor === 0 ? self : self.pipe(Schema.multipleOf(encodeMultipleOf(divisor)));
115
- var DecimalPrecision = Schema.transform(Schema.Number, Schema.Number, {
116
- strict: true,
117
- encode: (value) => encodeMultipleOf(value),
118
- decode: (value) => Math.log10(1 / value)
119
- }).annotations({
120
- title: "Number of digits"
121
- });
122
- var CurrencyAnnotationId = Symbol.for("@dxos/schema/annotation/Currency");
123
- var Currency = ({ decimals, code } = {
124
- decimals: 2
125
- }) => Schema.Number.pipe(encodeMultiple(decimals), FormatAnnotation.set(TypeFormat.Currency), Schema.annotations({
126
- title: "Currency",
127
- description: "Currency value",
128
- ...code ? {
129
- [CurrencyAnnotationId]: code.toUpperCase()
130
- } : {}
131
- }));
132
- var Integer = () => Schema.Number.pipe(Schema.int(), FormatAnnotation.set(TypeFormat.Integer), Schema.annotations({
133
- title: "Integer",
134
- description: "Integer value"
135
- }));
136
- var Percent = ({ decimals } = {
137
- decimals: 2
138
- }) => Schema.Number.pipe(encodeMultiple(decimals), FormatAnnotation.set(TypeFormat.Percent), Schema.annotations({
139
- title: "Percent",
140
- description: "Percentage value"
141
- }));
142
- var Timestamp = Schema.Number.pipe(FormatAnnotation.set(TypeFormat.Timestamp), Schema.annotations({
143
- title: "Timestamp",
144
- description: "Unix timestamp"
145
- }));
146
-
147
- // src/internal/formats/object.ts
148
- import * as Schema2 from "effect/Schema";
149
- import { clamp as clamp2 } from "@dxos/util";
150
- var GeoPoint = Schema2.Tuple(Schema2.Number.pipe(Schema2.annotations({
151
- title: "Longitude"
152
- }), Schema2.clamp(-180, 180), Schema2.multipleOf(1e-6)), Schema2.Number.pipe(Schema2.annotations({
153
- title: "Latitude"
154
- }), Schema2.clamp(-90, 90), Schema2.multipleOf(1e-6)), Schema2.optionalElement(Schema2.Number).annotations({
155
- title: "Height ASL (m)"
156
- })).pipe(FormatAnnotation.set(TypeFormat.GeoPoint), Schema2.annotations({
157
- title: "GeoPoint",
158
- description: "GeoJSON Position"
159
- }));
160
- (function(GeoLocation2) {
161
- GeoLocation2.toGeoPoint = ({ longitude, latitude, height }) => {
162
- const clampedLongitude = clamp2(longitude, -180, 180);
163
- const clampedLatitude = clamp2(latitude, -90, 90);
164
- return height !== void 0 ? [
165
- clampedLongitude,
166
- clampedLatitude,
167
- height
168
- ] : [
169
- clampedLongitude,
170
- clampedLatitude
171
- ];
172
- };
173
- GeoLocation2.fromGeoPoint = (geoPoint) => {
174
- if (!geoPoint) {
175
- return {
176
- longitude: 0,
177
- latitude: 0
178
- };
179
- }
180
- const result = {
181
- longitude: geoPoint[0],
182
- latitude: geoPoint[1]
183
- };
184
- if (geoPoint[2] !== void 0) {
185
- result.height = geoPoint[2];
186
- }
187
- return result;
188
- };
189
- })(GeoLocation || (GeoLocation = {}));
190
- var GeoLocation;
191
-
192
- // src/internal/formats/string.ts
193
- import * as Schema3 from "effect/Schema";
194
- import * as SchemaAST2 from "effect/SchemaAST";
195
- var Email = Schema3.String.pipe(Schema3.pattern(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/), FormatAnnotation.set(TypeFormat.Email), Schema3.annotations({
196
- title: "Email",
197
- description: "Email address"
198
- }));
199
- var Formula = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.Formula));
200
- var Hostname = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.Hostname));
201
- var JSON = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.JSON));
202
- var Markdown = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.Markdown));
203
- var Regex = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.Regex));
204
- var Text = Schema3.String.pipe(FormatAnnotation.set(TypeFormat.Text));
205
- var URL = Schema3.String.pipe(Schema3.pattern(/^(\w+?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i), FormatAnnotation.set(TypeFormat.URL), Schema3.annotations({
206
- title: "URL",
207
- description: "URL"
208
- }));
209
- var UUID2 = Schema3.UUID.pipe(FormatAnnotation.set(TypeFormat.UUID), Schema3.annotations({
210
- [SchemaAST2.ExamplesAnnotationId]: [
211
- "3e4666bf-d5e5-4aa7-b8ce-cefe41c7568a"
212
- ]
213
- }));
214
-
215
- // src/internal/formats/format.ts
216
- import * as Schema5 from "effect/Schema";
217
- import * as Keys from "@dxos/keys";
218
-
219
- // src/internal/formats/date.ts
220
- import * as Schema4 from "effect/Schema";
221
- import * as SchemaAST3 from "effect/SchemaAST";
222
- var SimpleDate = Schema4.Struct({
223
- year: Schema4.Number.pipe(Schema4.between(1900, 9999)),
224
- month: Schema4.Number.pipe(Schema4.between(1, 12)),
225
- day: Schema4.Number.pipe(Schema4.between(1, 31))
226
- });
227
- var SimpleTime = Schema4.Struct({
228
- hours: Schema4.Number.pipe(Schema4.between(0, 23)),
229
- minutes: Schema4.Number.pipe(Schema4.between(0, 59)),
230
- seconds: Schema4.Number.pipe(Schema4.between(0, 59))
231
- });
232
- var SimpleDateTime = Schema4.extend(SimpleDate, SimpleTime);
233
- var DateOnly = (
234
- /* Schema.transformOrFail(Schema.String, SimpleDate, {
235
- strict: true,
236
- decode: (str, _, ast) => {
237
- if (!isValidDateFormat(str)) {
238
- return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected YYYY-MM-DD format'));
239
- }
240
- if (!isValidDate(str)) {
241
- return ParseResult.fail(new ParseResult.Type(ast, str, 'Invalid date'));
242
- }
243
-
244
- const [year, month, day] = str.split('-').map(Number);
245
- return ParseResult.succeed({ year, month, day });
246
- },
247
- encode: (date) => {
248
- return ParseResult.succeed(
249
- [
250
- date.year.toString().padStart(4, '0'),
251
- date.month.toString().padStart(2, '0'),
252
- date.day.toString().padStart(2, '0'),
253
- ].join('-'),
254
- );
255
- },
256
- }) */
257
- Schema4.String.pipe(FormatAnnotation.set(TypeFormat.Date), Schema4.annotations({
258
- title: "Date",
259
- description: "Valid date in ISO format"
260
- }))
261
- );
262
- var TimeOnly = (
263
- /* Schema.transformOrFail(Schema.String, SimpleTime, {
264
- strict: true,
265
- decode: (str, _, ast) => {
266
- if (!isValidTimeFormat(str)) {
267
- return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected HH:mm:ss format'));
268
- }
269
-
270
- const [hours, minutes, seconds] = str.split(':').map(Number);
271
- return ParseResult.succeed({ hours, minutes, seconds });
272
- },
273
- encode: (time) => {
274
- return ParseResult.succeed(
275
- [
276
- time.hours.toString().padStart(2, '0'),
277
- time.minutes.toString().padStart(2, '0'),
278
- time.seconds.toString().padStart(2, '0'),
279
- ].join(':'),
280
- );
281
- },
282
- }) */
283
- Schema4.String.pipe(FormatAnnotation.set(TypeFormat.Time), Schema4.annotations({
284
- title: "Time",
285
- description: "Valid time in ISO format"
286
- }))
287
- );
288
- var DateTime = (
289
- /* Schema.transformOrFail(Schema.String, SimpleDateTime, {
290
- strict: false,
291
- decode: (str, _, ast) => {
292
- const [date, time] = str.split('T');
293
- if (!isValidDateFormat(date)) {
294
- return ParseResult.fail(new ParseResult.Type(ast, date, 'Expected YYYY-MM-DD format'));
295
- }
296
- if (!isValidDate(date)) {
297
- return ParseResult.fail(new ParseResult.Type(ast, date, 'Invalid date'));
298
- }
299
- if (!isValidTimeFormat(time)) {
300
- return ParseResult.fail(new ParseResult.Type(ast, str, 'Expected HH:mm:ss format'));
301
- }
302
-
303
- const [year, month, day] = date.split('-').map(Number);
304
- const [hours, minutes, seconds] = time.split(':').map(Number);
305
- return ParseResult.succeed({ year, month, day, hours, minutes, seconds });
306
- },
307
- encode: (datetime) => {
308
- return ParseResult.succeed(
309
- [
310
- [
311
- datetime.year.toString().padStart(4, '0'),
312
- datetime.month.toString().padStart(2, '0'),
313
- datetime.day.toString().padStart(2, '0'),
314
- ].join('-'),
315
- [
316
- datetime.hours.toString().padStart(2, '0'),
317
- datetime.minutes.toString().padStart(2, '0'),
318
- datetime.seconds.toString().padStart(2, '0'),
319
- ].join(':'),
320
- ].join('T'),
321
- );
322
- },
323
- }) */
324
- Schema4.String.pipe(FormatAnnotation.set(TypeFormat.DateTime), Schema4.annotations({
325
- title: "DateTime",
326
- description: "Valid date and time in ISO format"
327
- }))
328
- );
329
- var Duration = Schema4.String.pipe(FormatAnnotation.set(TypeFormat.Duration), Schema4.annotations({
330
- title: "Duration",
331
- description: "Duration in ISO 8601 format",
332
- [SchemaAST3.ExamplesAnnotationId]: [
333
- "1h",
334
- "3D"
335
- ]
336
- }));
337
-
338
- // src/internal/formats/format.ts
339
- (function(Format2) {
340
- Format2.TypeFormat = TypeFormat;
341
- Format2.DXN = Keys.DXN.Schema;
342
- Format2.Email = Email;
343
- Format2.Formula = Formula;
344
- Format2.Hostname = Hostname;
345
- Format2.JSON = JSON;
346
- Format2.Markdown = Markdown;
347
- Format2.Regex = Regex;
348
- Format2.URL = URL;
349
- Format2.UUID = Schema5.UUID;
350
- Format2.Currency = Currency;
351
- Format2.Integer = Integer;
352
- Format2.Percent = Percent;
353
- Format2.Timestamp = Timestamp;
354
- Format2.Date = DateOnly;
355
- Format2.DateTime = DateTime;
356
- Format2.Duration = Duration;
357
- Format2.Time = TimeOnly;
358
- Format2.GeoPoint = GeoPoint;
359
- })(Format || (Format = {}));
360
- var Format;
361
-
362
- // src/internal/formats/select.ts
363
- import * as Schema6 from "effect/Schema";
364
- var SelectOption = Schema6.Struct({
365
- /** Stable identifier for the option. */
366
- id: Schema6.NonEmptyString,
367
- title: Schema6.String,
368
- /** Color palette used for visual styling. */
369
- color: Schema6.String
370
- }).pipe(Schema6.mutable);
371
-
372
- export {
373
- TypeEnum,
374
- getTypeEnum,
375
- FormatAnnotationId,
376
- FormatAnnotation,
377
- getFormatAnnotation,
378
- TypeFormat,
379
- FormatEnums,
380
- PropertyKind,
381
- typeToFormat,
382
- formatToType,
383
- OptionsAnnotationId,
384
- OptionsAnnotation,
385
- getOptionsAnnotation,
386
- DecimalPrecision,
387
- CurrencyAnnotationId,
388
- Currency,
389
- GeoPoint,
390
- GeoLocation,
391
- Email,
392
- Formula,
393
- Hostname,
394
- JSON,
395
- Markdown,
396
- Regex,
397
- Text,
398
- URL,
399
- UUID2 as UUID,
400
- Format,
401
- SelectOption
402
- };
403
- //# sourceMappingURL=chunk-W6QIEBTQ.mjs.map
@@ -1,69 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/internal/types/entity.ts
4
- import * as Schema from "effect/Schema";
5
- var KindId = "~@dxos/echo/Kind";
6
- var SchemaKindId = "~@dxos/echo/SchemaKind";
7
- var SnapshotKindId = "~@dxos/echo/SnapshotKind";
8
- var EntityKind = /* @__PURE__ */ (function(EntityKind2) {
9
- EntityKind2["Object"] = "object";
10
- EntityKind2["Relation"] = "relation";
11
- return EntityKind2;
12
- })({});
13
- var EntityKindSchema = Schema.Enums(EntityKind);
14
- var ANY_OBJECT_TYPENAME = "dxos.org/schema/AnyObject";
15
- var ANY_OBJECT_VERSION = "0.0.0";
16
-
17
- // src/internal/annotations/util.ts
18
- import * as SchemaAST from "effect/SchemaAST";
19
- import { assertArgument } from "@dxos/invariant";
20
- import { DXN } from "@dxos/keys";
21
- var createAnnotationHelper = (id) => {
22
- return {
23
- get: (schema) => SchemaAST.getAnnotation(schema.ast, id),
24
- getFromAst: (ast) => SchemaAST.getAnnotation(ast, id),
25
- set: (value) => (schema) => schema.annotations({
26
- [id]: value
27
- })
28
- };
29
- };
30
- var unwrapOptional = (property) => {
31
- if (!property.isOptional || !SchemaAST.isUnion(property.type)) {
32
- return property;
33
- }
34
- return property.type.types[0];
35
- };
36
- var makeTypeJsonSchemaAnnotation = (options) => {
37
- assertArgument(!!options.relationSource === (options.kind === EntityKind.Relation), "relationSource");
38
- assertArgument(!!options.relationTarget === (options.kind === EntityKind.Relation), "relationTarget");
39
- const obj = {
40
- // TODO(dmaretskyi): Should this include the version?
41
- $id: options.identifier ?? DXN.fromTypename(options.typename).toString(),
42
- entityKind: options.kind,
43
- version: options.version,
44
- typename: options.typename
45
- };
46
- if (options.kind === EntityKind.Relation) {
47
- obj.relationSource = {
48
- $ref: options.relationSource
49
- };
50
- obj.relationTarget = {
51
- $ref: options.relationTarget
52
- };
53
- }
54
- return obj;
55
- };
56
-
57
- export {
58
- KindId,
59
- SchemaKindId,
60
- SnapshotKindId,
61
- EntityKind,
62
- EntityKindSchema,
63
- ANY_OBJECT_TYPENAME,
64
- ANY_OBJECT_VERSION,
65
- createAnnotationHelper,
66
- unwrapOptional,
67
- makeTypeJsonSchemaAnnotation
68
- };
69
- //# sourceMappingURL=chunk-XHJRMQZD.mjs.map
@@ -1,74 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- Currency,
4
- CurrencyAnnotationId,
5
- DecimalPrecision,
6
- Email,
7
- Format,
8
- FormatAnnotation,
9
- FormatAnnotationId,
10
- FormatEnums,
11
- Formula,
12
- GeoLocation,
13
- GeoPoint,
14
- Hostname,
15
- JSON,
16
- Markdown,
17
- OptionsAnnotation,
18
- OptionsAnnotationId,
19
- PropertyKind,
20
- Regex,
21
- SelectOption,
22
- Text,
23
- TypeEnum,
24
- TypeFormat,
25
- URL,
26
- UUID,
27
- formatToType,
28
- getFormatAnnotation,
29
- getOptionsAnnotation,
30
- getTypeEnum,
31
- typeToFormat
32
- } from "./chunk-W6QIEBTQ.mjs";
33
- import {
34
- __export
35
- } from "./chunk-HSLMI22Q.mjs";
36
-
37
- // src/Format.ts
38
- var Format_exports = {};
39
- __export(Format_exports, {
40
- Currency: () => Currency,
41
- CurrencyAnnotationId: () => CurrencyAnnotationId,
42
- DecimalPrecision: () => DecimalPrecision,
43
- Email: () => Email,
44
- Format: () => Format,
45
- FormatAnnotation: () => FormatAnnotation,
46
- FormatAnnotationId: () => FormatAnnotationId,
47
- FormatEnums: () => FormatEnums,
48
- Formula: () => Formula,
49
- GeoLocation: () => GeoLocation,
50
- GeoPoint: () => GeoPoint,
51
- Hostname: () => Hostname,
52
- JSON: () => JSON,
53
- Markdown: () => Markdown,
54
- OptionsAnnotation: () => OptionsAnnotation,
55
- OptionsAnnotationId: () => OptionsAnnotationId,
56
- PropertyKind: () => PropertyKind,
57
- Regex: () => Regex,
58
- SelectOption: () => SelectOption,
59
- Text: () => Text,
60
- TypeEnum: () => TypeEnum,
61
- TypeFormat: () => TypeFormat,
62
- URL: () => URL,
63
- UUID: () => UUID,
64
- formatToType: () => formatToType,
65
- getFormatAnnotation: () => getFormatAnnotation,
66
- getOptionsAnnotation: () => getOptionsAnnotation,
67
- getTypeEnum: () => getTypeEnum,
68
- typeToFormat: () => typeToFormat
69
- });
70
-
71
- export {
72
- Format_exports
73
- };
74
- //# sourceMappingURL=chunk-Y75VU7LB.mjs.map