@evolu/common 5.4.7 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +30 -34
  2. package/dist/src/Array.d.ts +17 -0
  3. package/dist/src/Array.d.ts.map +1 -0
  4. package/dist/src/Array.js +12 -0
  5. package/dist/src/Assert.d.ts +68 -0
  6. package/dist/src/Assert.d.ts.map +1 -0
  7. package/dist/src/Assert.js +77 -0
  8. package/dist/src/BigInt.d.ts +20 -0
  9. package/dist/src/BigInt.d.ts.map +1 -0
  10. package/dist/src/BigInt.js +18 -0
  11. package/dist/src/Buffer.d.ts +92 -0
  12. package/dist/src/Buffer.d.ts.map +1 -0
  13. package/dist/src/Buffer.js +62 -0
  14. package/dist/src/Callbacks.d.ts +20 -0
  15. package/dist/src/Callbacks.d.ts.map +1 -0
  16. package/dist/src/Callbacks.js +18 -0
  17. package/dist/src/Console.d.ts +78 -0
  18. package/dist/src/Console.d.ts.map +1 -0
  19. package/dist/src/Console.js +103 -0
  20. package/dist/src/Crypto.d.ts +72 -39
  21. package/dist/src/Crypto.d.ts.map +1 -1
  22. package/dist/src/Crypto.js +89 -54
  23. package/dist/src/Eq.d.ts +97 -0
  24. package/dist/src/Eq.d.ts.map +1 -0
  25. package/dist/src/Eq.js +167 -0
  26. package/dist/src/Error.d.ts +14 -10
  27. package/dist/src/Error.d.ts.map +1 -1
  28. package/dist/src/Error.js +43 -11
  29. package/dist/src/Evolu/Config.d.ts +69 -0
  30. package/dist/src/Evolu/Config.d.ts.map +1 -0
  31. package/dist/src/Evolu/Config.js +9 -0
  32. package/dist/src/Evolu/Db.d.ts +126 -0
  33. package/dist/src/Evolu/Db.d.ts.map +1 -0
  34. package/dist/src/Evolu/Db.js +774 -0
  35. package/dist/src/Evolu/Diff.d.ts +43 -0
  36. package/dist/src/Evolu/Diff.d.ts.map +1 -0
  37. package/dist/src/Evolu/Diff.js +95 -0
  38. package/dist/src/Evolu/Evolu.d.ts +334 -0
  39. package/dist/src/Evolu/Evolu.d.ts.map +1 -0
  40. package/dist/src/Evolu/Evolu.js +434 -0
  41. package/dist/src/Evolu/Internal.d.ts +26 -0
  42. package/dist/src/Evolu/Internal.d.ts.map +1 -0
  43. package/dist/src/Evolu/Internal.js +25 -0
  44. package/dist/src/Evolu/Kysely.d.ts +6 -0
  45. package/dist/src/Evolu/Kysely.d.ts.map +1 -0
  46. package/dist/src/Evolu/Kysely.js +21 -0
  47. package/dist/src/Evolu/Owner.d.ts +155 -0
  48. package/dist/src/Evolu/Owner.d.ts.map +1 -0
  49. package/dist/src/Evolu/Owner.js +126 -0
  50. package/dist/src/Evolu/Platform.d.ts +23 -0
  51. package/dist/src/Evolu/Platform.d.ts.map +1 -0
  52. package/dist/src/Evolu/Platform.js +1 -0
  53. package/dist/src/Evolu/Protocol.d.ts +401 -0
  54. package/dist/src/Evolu/Protocol.d.ts.map +1 -0
  55. package/dist/src/Evolu/Protocol.js +1151 -0
  56. package/dist/src/Evolu/Public.d.ts +18 -0
  57. package/dist/src/Evolu/Public.d.ts.map +1 -0
  58. package/dist/src/Evolu/Public.js +11 -0
  59. package/dist/src/Evolu/PublicKysely.d.ts +148 -0
  60. package/dist/src/Evolu/PublicKysely.d.ts.map +1 -0
  61. package/dist/src/Evolu/PublicKysely.js +185 -0
  62. package/dist/src/Evolu/Query.d.ts +63 -0
  63. package/dist/src/Evolu/Query.d.ts.map +1 -0
  64. package/dist/src/Evolu/Query.js +61 -0
  65. package/dist/src/Evolu/Relay.d.ts +13 -0
  66. package/dist/src/Evolu/Relay.d.ts.map +1 -0
  67. package/dist/src/Evolu/Relay.js +109 -0
  68. package/dist/src/Evolu/Schema.d.ts +201 -0
  69. package/dist/src/Evolu/Schema.d.ts.map +1 -0
  70. package/dist/src/Evolu/Schema.js +150 -0
  71. package/dist/src/Evolu/Storage.d.ts +49 -0
  72. package/dist/src/Evolu/Storage.d.ts.map +1 -0
  73. package/dist/src/Evolu/Storage.js +1111 -0
  74. package/dist/src/Evolu/Sync.d.ts +59 -0
  75. package/dist/src/Evolu/Sync.d.ts.map +1 -0
  76. package/dist/src/Evolu/Sync.js +29 -0
  77. package/dist/src/Evolu/Timestamp.d.ts +106 -0
  78. package/dist/src/Evolu/Timestamp.d.ts.map +1 -0
  79. package/dist/src/Evolu/Timestamp.js +179 -0
  80. package/dist/src/Function.d.ts +54 -0
  81. package/dist/src/Function.d.ts.map +1 -0
  82. package/dist/src/Function.js +38 -0
  83. package/dist/src/ManyToManyMap.d.ts +26 -0
  84. package/dist/src/ManyToManyMap.d.ts.map +1 -0
  85. package/dist/src/ManyToManyMap.js +92 -0
  86. package/dist/src/NanoId.d.ts +27 -0
  87. package/dist/src/NanoId.d.ts.map +1 -0
  88. package/dist/src/NanoId.js +6 -0
  89. package/dist/src/Number.d.ts +42 -0
  90. package/dist/src/Number.d.ts.map +1 -0
  91. package/dist/src/Number.js +55 -0
  92. package/dist/src/Object.d.ts +35 -0
  93. package/dist/src/Object.d.ts.map +1 -0
  94. package/dist/src/Object.js +36 -0
  95. package/dist/src/Order.d.ts +90 -0
  96. package/dist/src/Order.d.ts.map +1 -0
  97. package/dist/src/Order.js +85 -0
  98. package/dist/src/Promise.d.ts +180 -0
  99. package/dist/src/Promise.d.ts.map +1 -0
  100. package/dist/src/Promise.js +176 -0
  101. package/dist/src/Random.d.ts +52 -0
  102. package/dist/src/Random.d.ts.map +1 -0
  103. package/dist/src/Random.js +29 -0
  104. package/dist/src/Ref.d.ts +40 -0
  105. package/dist/src/Ref.d.ts.map +1 -0
  106. package/dist/src/Ref.js +13 -0
  107. package/dist/src/Result.d.ts +421 -0
  108. package/dist/src/Result.d.ts.map +1 -0
  109. package/dist/src/Result.js +357 -0
  110. package/dist/src/Skiplist.d.ts +23 -0
  111. package/dist/src/Skiplist.d.ts.map +1 -0
  112. package/dist/src/Skiplist.js +58 -0
  113. package/dist/src/Sqlite.d.ts +116 -52
  114. package/dist/src/Sqlite.d.ts.map +1 -1
  115. package/dist/src/Sqlite.js +183 -67
  116. package/dist/src/Store.d.ts +45 -8
  117. package/dist/src/Store.d.ts.map +1 -1
  118. package/dist/src/Store.js +33 -17
  119. package/dist/src/String.d.ts +2 -0
  120. package/dist/src/String.d.ts.map +1 -0
  121. package/dist/src/String.js +14 -0
  122. package/dist/src/Time.d.ts +20 -0
  123. package/dist/src/Time.d.ts.map +1 -0
  124. package/dist/src/Time.js +25 -0
  125. package/dist/src/Type.d.ts +1937 -0
  126. package/dist/src/Type.d.ts.map +1 -0
  127. package/dist/src/Type.js +2002 -0
  128. package/dist/src/Types.d.ts +188 -0
  129. package/dist/src/Types.d.ts.map +1 -0
  130. package/dist/src/Types.js +6 -0
  131. package/dist/src/WebSocket.d.ts +112 -0
  132. package/dist/src/WebSocket.d.ts.map +1 -0
  133. package/dist/src/WebSocket.js +139 -0
  134. package/dist/src/Worker.d.ts +44 -0
  135. package/dist/src/Worker.d.ts.map +1 -0
  136. package/dist/src/Worker.js +66 -0
  137. package/dist/src/index.d.ts +24 -11
  138. package/dist/src/index.d.ts.map +1 -1
  139. package/dist/src/index.js +24 -11
  140. package/package.json +29 -38
  141. package/src/Array.ts +39 -0
  142. package/src/Assert.ts +116 -0
  143. package/src/BigInt.ts +29 -0
  144. package/src/Buffer.ts +175 -0
  145. package/src/Callbacks.ts +43 -0
  146. package/src/Console.ts +159 -0
  147. package/src/Crypto.ts +169 -115
  148. package/src/Eq.ts +204 -0
  149. package/src/Error.ts +57 -20
  150. package/src/Evolu/Config.ts +83 -0
  151. package/src/Evolu/Db.ts +1275 -0
  152. package/src/Evolu/Diff.ts +142 -0
  153. package/src/Evolu/Evolu.ts +947 -0
  154. package/src/Evolu/Internal.ts +26 -0
  155. package/src/Evolu/Kysely.ts +38 -0
  156. package/src/Evolu/Owner.ts +296 -0
  157. package/src/Evolu/Platform.ts +27 -0
  158. package/src/Evolu/Protocol.ts +1857 -0
  159. package/src/Evolu/Public.ts +43 -0
  160. package/src/Evolu/PublicKysely.ts +240 -0
  161. package/src/Evolu/Query.ts +167 -0
  162. package/src/Evolu/Relay.ts +142 -0
  163. package/src/Evolu/Schema.ts +417 -0
  164. package/src/Evolu/Storage.ts +1281 -0
  165. package/src/Evolu/Sync.ts +105 -0
  166. package/src/Evolu/Timestamp.ts +311 -0
  167. package/src/Function.ts +58 -0
  168. package/src/ManyToManyMap.ts +140 -0
  169. package/src/NanoId.ts +39 -0
  170. package/src/Number.ts +90 -0
  171. package/src/Object.ts +64 -0
  172. package/src/Order.ts +113 -0
  173. package/src/Promise.ts +295 -0
  174. package/src/Random.ts +68 -0
  175. package/src/Ref.ts +63 -0
  176. package/src/Result.ts +453 -0
  177. package/src/Skiplist.ts +102 -0
  178. package/src/Sqlite.ts +366 -153
  179. package/src/Store.ts +79 -36
  180. package/src/String.ts +10 -0
  181. package/src/Time.ts +36 -0
  182. package/src/Type.ts +3978 -0
  183. package/src/Types.ts +209 -0
  184. package/src/WebSocket.ts +273 -0
  185. package/src/Worker.ts +129 -0
  186. package/src/index.ts +24 -11
  187. package/dist/src/Config.d.ts +0 -56
  188. package/dist/src/Config.d.ts.map +0 -1
  189. package/dist/src/Config.js +0 -39
  190. package/dist/src/Crdt.d.ts +0 -89
  191. package/dist/src/Crdt.d.ts.map +0 -1
  192. package/dist/src/Crdt.js +0 -181
  193. package/dist/src/Db.d.ts +0 -107
  194. package/dist/src/Db.d.ts.map +0 -1
  195. package/dist/src/Db.js +0 -443
  196. package/dist/src/Diff.d.ts +0 -27
  197. package/dist/src/Diff.d.ts.map +0 -1
  198. package/dist/src/Diff.js +0 -84
  199. package/dist/src/Evolu.d.ts +0 -426
  200. package/dist/src/Evolu.d.ts.map +0 -1
  201. package/dist/src/Evolu.js +0 -333
  202. package/dist/src/Model.d.ts +0 -141
  203. package/dist/src/Model.d.ts.map +0 -1
  204. package/dist/src/Model.js +0 -125
  205. package/dist/src/Murmurhash.d.ts +0 -2
  206. package/dist/src/Murmurhash.d.ts.map +0 -1
  207. package/dist/src/Murmurhash.js +0 -60
  208. package/dist/src/Owner.d.ts +0 -33
  209. package/dist/src/Owner.d.ts.map +0 -1
  210. package/dist/src/Owner.js +0 -26
  211. package/dist/src/Platform.d.ts +0 -37
  212. package/dist/src/Platform.d.ts.map +0 -1
  213. package/dist/src/Platform.js +0 -11
  214. package/dist/src/Protobuf.d.ts +0 -81
  215. package/dist/src/Protobuf.d.ts.map +0 -1
  216. package/dist/src/Protobuf.js +0 -92
  217. package/dist/src/Public.d.ts +0 -13
  218. package/dist/src/Public.d.ts.map +0 -1
  219. package/dist/src/Public.js +0 -6
  220. package/dist/src/Socket.d.ts +0 -8
  221. package/dist/src/Socket.d.ts.map +0 -1
  222. package/dist/src/Socket.js +0 -51
  223. package/dist/src/Sql.d.ts +0 -12
  224. package/dist/src/Sql.d.ts.map +0 -1
  225. package/dist/src/Sql.js +0 -30
  226. package/dist/src/Sync.d.ts +0 -70
  227. package/dist/src/Sync.d.ts.map +0 -1
  228. package/dist/src/Sync.js +0 -127
  229. package/src/Config.ts +0 -119
  230. package/src/Crdt.ts +0 -361
  231. package/src/Db.ts +0 -955
  232. package/src/Diff.ts +0 -114
  233. package/src/Evolu.ts +0 -1016
  234. package/src/Model.ts +0 -233
  235. package/src/Murmurhash.ts +0 -70
  236. package/src/Owner.ts +0 -69
  237. package/src/Platform.ts +0 -47
  238. package/src/Protobuf.ts +0 -155
  239. package/src/Public.ts +0 -12
  240. package/src/Socket.ts +0 -83
  241. package/src/Sql.ts +0 -41
  242. package/src/Sync.ts +0 -315
@@ -0,0 +1,188 @@
1
+ /**
2
+ * TypeScript utility types
3
+ *
4
+ * @module
5
+ */
6
+ import * as Kysely from "kysely";
7
+ /**
8
+ * Checks a condition on a value and returns a boolean.
9
+ *
10
+ * A predicate starts with an 'is' prefix, e.g., `isEven`.
11
+ *
12
+ * ### Example
13
+ *
14
+ * ```ts
15
+ * const isEven: Predicate<number> = (n) => n % 2 === 0;
16
+ *
17
+ * const numbers = [1, 2, 3, 4];
18
+ * const evenNumbers = numbers.filter(isEven); // [2, 4]
19
+ * ```
20
+ */
21
+ export type Predicate<T> = (value: T) => boolean;
22
+ /**
23
+ * A type guard function that refines type `A` to a narrower type `B`.
24
+ *
25
+ * ### Example
26
+ *
27
+ * ```ts
28
+ * type Animal = { name: string };
29
+ * type Dog = Animal & { breed: string };
30
+ *
31
+ * const isDog: Refinement<Animal, Dog> = (animal): animal is Dog =>
32
+ * "breed" in animal;
33
+ *
34
+ * const animal: Animal = { name: "Dog", breed: "Beagle" };
35
+ * if (isDog(animal)) {
36
+ * console.log(animal.breed); // Safe access to `breed`
37
+ * }
38
+ * ```
39
+ */
40
+ export type Refinement<in A, out B extends A> = (a: A) => a is B;
41
+ /**
42
+ * Makes properties optional if they accept `null` as a value.
43
+ *
44
+ * For each property in `T`, if `null` is a valid value for that property, the
45
+ * property will be made optional in the resulting type.
46
+ *
47
+ * ### Example
48
+ *
49
+ * ```ts
50
+ * type Example = {
51
+ * required: string;
52
+ * optionalWithNull: string | null;
53
+ * };
54
+ *
55
+ * type Result = NullablePartial<Example>;
56
+ * // Result is:
57
+ * // {
58
+ * // required: string;
59
+ * // optionalWithNull?: string | null;
60
+ * // }
61
+ * ```
62
+ */
63
+ export type NullablePartial<T, NK extends keyof T = {
64
+ [K in keyof T]: null extends T[K] ? K : never;
65
+ }[keyof T], NP = Pick<T, Exclude<keyof T, NK>> & Partial<Pick<T, NK>>> = {
66
+ [K in keyof NP]: NP[K];
67
+ };
68
+ /**
69
+ * A type alias for `never` that is used intentionally when casting is not
70
+ * needed and unit tests exist to ensure correctness.
71
+ */
72
+ export type IntentionalNever = never;
73
+ /**
74
+ * A utility interface for creating branded types.
75
+ *
76
+ * Branded types enhance type safety by differentiating otherwise identical base
77
+ * types, such as `number` or `string`, to enforce stricter type checks.
78
+ *
79
+ * Supports multiple brands, allowing types to act like flags.
80
+ *
81
+ * ### Example 1: Single Brand
82
+ *
83
+ * ```ts
84
+ * // A branded type definition
85
+ * type UserId = number & Brand<"UserId">;
86
+ *
87
+ * // A function that creates `UserId` values.
88
+ * // Casting with `as UserId` is unsafe, so `createUserId` must be unit-tested.
89
+ * const createUserId = (): UserId => {
90
+ * return 123 as UserId; // Unsafe casting
91
+ * };
92
+ *
93
+ * const userId = createUserId();
94
+ *
95
+ * // A function that accepts only `UserId`.
96
+ * const getUser = (id: UserId) => {
97
+ * // Implementation
98
+ * };
99
+ *
100
+ * getUser(userId); // ✅ Valid
101
+ * getUser(123); // ❌ TypeScript error
102
+ * getUser("123"); // ❌ TypeScript error
103
+ * ```
104
+ *
105
+ * ### Example 2: Multiple Brands
106
+ *
107
+ * ```ts
108
+ * // Define branded types
109
+ * type Min1 = string & Brand<"Min1">;
110
+ * type Max100 = string & Brand<"Max100">;
111
+ * type Min1Max100 = string & Brand<"Min1" | "Max100">;
112
+ *
113
+ * // Functions requiring specific brands
114
+ * const requiresMin1 = (value: Min1): void => {};
115
+ * const requiresMax100 = (value: Max100): void => {};
116
+ *
117
+ * // Values with single brands
118
+ * const min1Value: Min1 = "hello" as Min1;
119
+ * const max100Value: Max100 = "world" as Max100;
120
+ *
121
+ * // Value with multiple brands
122
+ * const min1Max100Value: Min1Max100 = "typescript" as Min1Max100;
123
+ *
124
+ * // Valid cases
125
+ * requiresMin1(min1Value); // ✅ Valid
126
+ * requiresMax100(max100Value); // ✅ Valid
127
+ * requiresMin1(min1Max100Value); // ✅ Valid: Min1Max100 satisfies Min1
128
+ * requiresMax100(min1Max100Value); // ✅ Valid: Min1Max100 satisfies Max100
129
+ * ```
130
+ */
131
+ export interface Brand<B extends string> {
132
+ readonly [__brand]: Readonly<Record<B, true>>;
133
+ }
134
+ declare const __brand: unique symbol;
135
+ /**
136
+ * Determines whether a type `T` is a branded type.
137
+ *
138
+ * Works with any base type intersected with a `Brand`.
139
+ *
140
+ * ### Examples
141
+ *
142
+ * - `IsBranded<string>` -> false
143
+ * - `IsBranded<string & Brand<"X">>` -> true
144
+ */
145
+ export type IsBranded<T> = T extends Brand<string> ? true : false;
146
+ /**
147
+ * String | number | bigint | boolean | undefined | null
148
+ *
149
+ * https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types
150
+ */
151
+ export type Literal = string | number | bigint | boolean | undefined | null;
152
+ /**
153
+ * Infers a broader type from a specific literal value type.
154
+ *
155
+ * Examples:
156
+ *
157
+ * - "foo" -> string
158
+ * - 42 -> number
159
+ * - 42n -> bigint
160
+ * - True -> boolean
161
+ */
162
+ export type WidenLiteral<T extends Literal> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends bigint ? bigint : T;
163
+ /**
164
+ * Simplify an intersection type into a single mapped type.
165
+ *
166
+ * This utility forces TypeScript to "flatten" an intersection type into a
167
+ * single object type so that tooltips and error messages are easier to read.
168
+ *
169
+ * ### Example
170
+ *
171
+ * ```ts
172
+ * type A = { a: string } & { b: number };
173
+ * // Without Simplify, TypeScript may display A as:
174
+ * // { a: string } & { b: number }
175
+ *
176
+ * type B = Simplify<A>;
177
+ * // B is equivalent to:
178
+ * // { a: string; b: number }
179
+ * ```
180
+ */
181
+ export type Simplify<T> = Kysely.Simplify<T>;
182
+ /**
183
+ * Makes a specific property of an object optional while keeping others
184
+ * unchanged.
185
+ */
186
+ export type PartialProp<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
187
+ export {};
188
+ //# sourceMappingURL=Types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/Types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,EACD,EAAE,SAAS,MAAM,CAAC,GAAG;KAClB,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK;CAC9C,CAAC,MAAM,CAAC,CAAC,EACV,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IACvD;KAAG,CAAC,IAAI,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;CAAE,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM;IACrC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;CAC/C;AAED,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;AAE5E;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,SAAS,MAAM,GAC1D,MAAM,GACN,CAAC,SAAS,MAAM,GACd,MAAM,GACN,CAAC,SAAS,OAAO,GACf,OAAO,GACP,CAAC,SAAS,MAAM,GACd,MAAM,GACN,CAAC,CAAC;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAE7C;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * TypeScript utility types
3
+ *
4
+ * @module
5
+ */
6
+ export {};
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Websocket with auto-reconnect and offline support
3
+ *
4
+ * @module
5
+ */
6
+ import { RetryError, RetryOptions } from "./Promise.js";
7
+ import { Result } from "./Result.js";
8
+ /** WebSocket with auto-reconnect and offline support. */
9
+ export interface WebSocket extends Disposable {
10
+ /**
11
+ * Send data through the WebSocket connection. Returns {@link Result} with an
12
+ * error if the data couldn't be sent.
13
+ */
14
+ send: (data: string | ArrayBufferLike | Blob | ArrayBufferView) => Result<void, WebSocketSendError>;
15
+ readonly getReadyState: () => WebSocketReadyState;
16
+ }
17
+ /**
18
+ * An error that occurs when trying to send data but WebSocket is connecting.
19
+ *
20
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
21
+ */
22
+ export interface WebSocketSendError {
23
+ readonly type: "WebSocketSendError";
24
+ }
25
+ /** WebSocket connection states. */
26
+ export type WebSocketReadyState = "connecting" | "open" | "closing" | "closed";
27
+ export type CreateWebSocket = (url: string, options?: WebSocketOptions) => WebSocket;
28
+ export interface CreateWebSocketDep {
29
+ readonly createWebSocket: CreateWebSocket;
30
+ }
31
+ /** Options for creating {@link WebSocket} */
32
+ export interface WebSocketOptions {
33
+ /** Protocol(s) to use with the WebSocket connection. */
34
+ protocols?: string | Array<string>;
35
+ /** Sets the binary type for the data being received. */
36
+ binaryType?: "blob" | "arraybuffer";
37
+ /** Callback when the connection is established. */
38
+ onOpen?: () => void;
39
+ /** Callback when an error occurs. */
40
+ onError?: (error: WebSocketError) => void;
41
+ /** Callback when the connection is closed. */
42
+ onClose?: (event: CloseEvent) => void;
43
+ /** Callback when message data is received. */
44
+ onMessage?: (data: string | ArrayBuffer | Blob) => void;
45
+ /** Options for retry behavior. */
46
+ retryOptions?: Omit<RetryOptions<WebSocketRetryError>, "signal">;
47
+ /**
48
+ * For custom WebSocket implementations.
49
+ *
50
+ * This suppors blob:
51
+ *
52
+ * https://github.com/callstackincubator/react-native-fast-io
53
+ */
54
+ WebSocketConstructor?: typeof globalThis.WebSocket;
55
+ }
56
+ export type WebSocketError = WebSocketConnectError | WebSocketConnectionError | RetryError<WebSocketRetryError>;
57
+ /**
58
+ * An error that occurs when a connection cannot be established due to a network
59
+ * error.
60
+ */
61
+ export interface WebSocketConnectError {
62
+ readonly type: "WebSocketConnectError";
63
+ readonly event: Event;
64
+ }
65
+ /**
66
+ * An error that occurs when a connection is closed due to an issue (e.g.,
67
+ * failure to send some data).
68
+ *
69
+ * https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event
70
+ */
71
+ export interface WebSocketConnectionError {
72
+ readonly type: "WebSocketConnectionError";
73
+ readonly event: Event;
74
+ }
75
+ export type WebSocketRetryError = WebSocketConnectError | WebSocketConnectionCloseError;
76
+ export interface WebSocketConnectionCloseError {
77
+ readonly type: "WebSocketConnectionCloseError";
78
+ readonly event: CloseEvent;
79
+ }
80
+ /**
81
+ * Create a new {@link WebSocket}.
82
+ *
83
+ * The default behavior is that WebSocket tries to reconnect repeatedly in case
84
+ * the application is offline, because online events (both web and native) are
85
+ * not reliable. Once it connects and the connection is closed, it tries to
86
+ * reconnect again. Retrying the connection can be controlled using the
87
+ * retryOptions retryable predicate.
88
+ *
89
+ * ### How Binary Messages Work in WebSockets
90
+ *
91
+ * The Server Chooses the Message Type:
92
+ *
93
+ * - Text (0x1) → Sent as UTF-8 encoded text (always received as a string in the
94
+ * browser).
95
+ * - Binary (0x2) → Sent as raw binary data (received as a Blob or ArrayBuffer,
96
+ * depending on binaryType).
97
+ *
98
+ * The Client's binaryType Controls How Binary Data is Processed:
99
+ *
100
+ * - If the server sends a text frame (0x1), the browser always delivers
101
+ * event.data as a string, regardless of binaryType.
102
+ * - If the server sends a binary frame (0x2), the browser delivers event.data as:
103
+ *
104
+ * - A Blob (default: "blob")
105
+ * - An ArrayBuffer ("arraybuffer")
106
+ *
107
+ * ### Example
108
+ *
109
+ * TODO:
110
+ */
111
+ export declare const createWebSocket: CreateWebSocket;
112
+ //# sourceMappingURL=WebSocket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSocket.d.ts","sourceRoot":"","sources":["../../src/WebSocket.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAS,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAW,MAAM,EAAE,MAAM,aAAa,CAAC;AAE9C,yDAAyD;AACzD,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C;;;OAGG;IACH,IAAI,EAAE,CACJ,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,GAAG,eAAe,KACpD,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAEtC,QAAQ,CAAC,aAAa,EAAE,MAAM,mBAAmB,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;CACrC;AAED,mCAAmC;AACnC,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,gBAAgB,KACvB,SAAS,CAAC;AAEf,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC3C;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAEnC,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IAEpC,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB,qCAAqC;IACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C,8CAA8C;IAC9C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAEtC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAExD,kCAAkC;IAClC,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEjE;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,OAAO,UAAU,CAAC,SAAS,CAAC;CACpD;AAED,MAAM,MAAM,cAAc,GACtB,qBAAqB,GACrB,wBAAwB,GACxB,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAEpC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAC3B,qBAAqB,GACrB,6BAA6B,CAAC;AAElC,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,+BAA+B,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,eAAe,EAAE,eA0H7B,CAAC"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Websocket with auto-reconnect and offline support
3
+ *
4
+ * @module
5
+ */
6
+ import { assertNoErrorInCatch } from "./Assert.js";
7
+ import { retry } from "./Promise.js";
8
+ import { err, ok } from "./Result.js";
9
+ /**
10
+ * Create a new {@link WebSocket}.
11
+ *
12
+ * The default behavior is that WebSocket tries to reconnect repeatedly in case
13
+ * the application is offline, because online events (both web and native) are
14
+ * not reliable. Once it connects and the connection is closed, it tries to
15
+ * reconnect again. Retrying the connection can be controlled using the
16
+ * retryOptions retryable predicate.
17
+ *
18
+ * ### How Binary Messages Work in WebSockets
19
+ *
20
+ * The Server Chooses the Message Type:
21
+ *
22
+ * - Text (0x1) → Sent as UTF-8 encoded text (always received as a string in the
23
+ * browser).
24
+ * - Binary (0x2) → Sent as raw binary data (received as a Blob or ArrayBuffer,
25
+ * depending on binaryType).
26
+ *
27
+ * The Client's binaryType Controls How Binary Data is Processed:
28
+ *
29
+ * - If the server sends a text frame (0x1), the browser always delivers
30
+ * event.data as a string, regardless of binaryType.
31
+ * - If the server sends a binary frame (0x2), the browser delivers event.data as:
32
+ *
33
+ * - A Blob (default: "blob")
34
+ * - An ArrayBuffer ("arraybuffer")
35
+ *
36
+ * ### Example
37
+ *
38
+ * TODO:
39
+ */
40
+ export const createWebSocket = (url, options = {}) => {
41
+ const { protocols, binaryType, onOpen, onClose, onMessage, onError, retryOptions, WebSocketConstructor = globalThis.WebSocket, } = options;
42
+ let isDisposed = false;
43
+ const reconnectController = new AbortController();
44
+ const defaultRetryOptions = {
45
+ signal: reconnectController.signal,
46
+ maxRetries: Infinity,
47
+ };
48
+ let socket = null;
49
+ const disposeSocket = () => {
50
+ if (!socket)
51
+ return;
52
+ // Remove all listeners before closing
53
+ socket.onopen = null;
54
+ socket.onclose = null;
55
+ socket.onmessage = null;
56
+ socket.onerror = null;
57
+ socket.close();
58
+ socket = null;
59
+ };
60
+ // To prevent a memory leak from pending connection promise.
61
+ let disposePromise = null;
62
+ /**
63
+ * This promise represents continuous connection which:
64
+ *
65
+ * - Is rejected when a connection cannot be established.
66
+ * - Is rejected when a connection is closed.
67
+ * - Is resolved when WebSocket is disposed().
68
+ */
69
+ retry(() => new Promise((resolve) => {
70
+ disposePromise = () => {
71
+ resolve(ok());
72
+ };
73
+ if (isDisposed)
74
+ disposePromise();
75
+ disposeSocket();
76
+ socket = new WebSocketConstructor(url, protocols);
77
+ if (binaryType)
78
+ socket.binaryType = binaryType;
79
+ let isOpen = false;
80
+ socket.onopen = () => {
81
+ isOpen = true;
82
+ onOpen?.();
83
+ };
84
+ socket.onerror = (event) => {
85
+ const error = isOpen
86
+ ? { type: "WebSocketConnectionError", event }
87
+ : { type: "WebSocketConnectError", event };
88
+ onError?.(error);
89
+ // Trigger reconnect only on WebSocketConnectError.
90
+ if (error.type === "WebSocketConnectError") {
91
+ resolve(err(error));
92
+ }
93
+ };
94
+ socket.onclose = (event) => {
95
+ onClose?.(event);
96
+ resolve(err({ type: "WebSocketConnectionCloseError", event }));
97
+ };
98
+ socket.onmessage = (event) => {
99
+ onMessage?.(event.data);
100
+ };
101
+ }), {
102
+ ...defaultRetryOptions,
103
+ ...retryOptions,
104
+ })
105
+ .then((result) => {
106
+ if (result.ok || result.error.type === "RetryAbortError")
107
+ return;
108
+ onError?.(result.error);
109
+ })
110
+ .catch((error) => {
111
+ assertNoErrorInCatch("WebSocket retry", error);
112
+ });
113
+ const webSocket = {
114
+ send: (data) => {
115
+ // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
116
+ if (!socket || socket.readyState === socket.CONNECTING) {
117
+ return err({ type: "WebSocketSendError" });
118
+ }
119
+ socket.send(data);
120
+ return ok();
121
+ },
122
+ getReadyState: () => socket ? nativeToStringState[socket.readyState] : "connecting",
123
+ [Symbol.dispose]() {
124
+ if (isDisposed)
125
+ return;
126
+ isDisposed = true;
127
+ reconnectController.abort();
128
+ disposeSocket();
129
+ disposePromise?.();
130
+ },
131
+ };
132
+ return webSocket;
133
+ };
134
+ const nativeToStringState = {
135
+ [WebSocket.CONNECTING]: "connecting",
136
+ [WebSocket.OPEN]: "open",
137
+ [WebSocket.CLOSING]: "closing",
138
+ [WebSocket.CLOSED]: "closed",
139
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Cross-platform worker abstraction
3
+ *
4
+ * @module
5
+ */
6
+ import { TransferableError } from "./Error.js";
7
+ /** Cross-platform worker abstraction. */
8
+ export interface Worker<Input, Output> {
9
+ /** Sends a message to the worker. */
10
+ readonly postMessage: (message: Input) => void;
11
+ /** Sets a callback for messages from the worker. */
12
+ readonly onMessage: (callback: (message: Output) => void) => void;
13
+ }
14
+ export interface WorkerPostMessageDep<Output> {
15
+ readonly postMessage: (message: Output) => void;
16
+ }
17
+ /**
18
+ * Creates a {@link Worker} that supports initialization with dependencies and
19
+ * safe error handling.
20
+ */
21
+ export declare const createInitializedWorker: <Input extends {
22
+ readonly type: string;
23
+ } & HasInit<Input>, Output extends {
24
+ readonly type: string;
25
+ } & HasWorkerErrorOutput<Output>, Deps>({ init, onMessage, }: {
26
+ readonly init: (initMessage: Extract<Input, {
27
+ type: "init";
28
+ }>, postMessage: (msg: Output) => void, safeHandler: <A extends Array<any>>(handler: (...args: A) => void) => (...args: A) => void) => Promise<Deps | null>;
29
+ readonly onMessage: (deps: Deps) => (message: Exclude<Input, {
30
+ type: "init";
31
+ }>) => void;
32
+ }) => Worker<Input, Output>;
33
+ type HasInit<Input> = Extract<Input, {
34
+ type: "init";
35
+ }> extends never ? ["Input must contain a variant with { type: 'init' }"] : unknown;
36
+ type HasWorkerErrorOutput<T> = Extract<T, {
37
+ type: "onError";
38
+ }> extends infer E ? [E] extends [never] ? [
39
+ "Output must contain { type: 'onError'; error: TransferableError | ... }"
40
+ ] : E extends {
41
+ error: infer Err;
42
+ } ? TransferableError extends Err ? unknown : ["Output.onError.error must include TransferableError"] : ["Output.onError must have an error property"] : never;
43
+ export {};
44
+ //# sourceMappingURL=Worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Worker.d.ts","sourceRoot":"","sources":["../../src/Worker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAA2B,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAExE,yCAAyC;AACzC,MAAM,WAAW,MAAM,CAAC,KAAK,EAAE,MAAM;IACnC,qCAAqC;IACrC,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,IAAI,CAAC;IAE/C,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAAK,IAAI,CAAC;CACnE;AAED,MAAM,WAAW,oBAAoB,CAAC,MAAM;IAC1C,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,EACxD,MAAM,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,oBAAoB,CAAC,MAAM,CAAC,EACvE,IAAI,EACJ,sBAGC;IACD,QAAQ,CAAC,IAAI,EAAE,CACb,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAClC,WAAW,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EAChC,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,KAC1B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,KACtB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,CAClB,IAAI,EAAE,IAAI,KACP,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;CAC1D,KAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAkEvB,CAAC;AAEF,KAAK,OAAO,CAAC,KAAK,IAChB,OAAO,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,SAAS,KAAK,GAC1C,CAAC,oDAAoD,CAAC,GACtD,OAAO,CAAC;AAEd,KAAK,oBAAoB,CAAC,CAAC,IACzB,OAAO,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,SAAS,MAAM,CAAC,GAC3C,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACjB;IACE,yEAAyE;CAC1E,GACD,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,GAAG,CAAA;CAAE,GAC5B,iBAAiB,SAAS,GAAG,GAC3B,OAAO,GACP,CAAC,qDAAqD,CAAC,GACzD,CAAC,4CAA4C,CAAC,GAClD,KAAK,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Cross-platform worker abstraction
3
+ *
4
+ * @module
5
+ */
6
+ import { assert } from "./Assert.js";
7
+ import { createTransferableError } from "./Error.js";
8
+ /**
9
+ * Creates a {@link Worker} that supports initialization with dependencies and
10
+ * safe error handling.
11
+ */
12
+ export const createInitializedWorker = ({ init, onMessage, }) => {
13
+ let onMessageCallback = null;
14
+ let deps = null;
15
+ const pendingMessages = [];
16
+ let initializing = false;
17
+ const postMessage = (msg) => {
18
+ assert(onMessageCallback != null, "The onMessage wasn't set");
19
+ onMessageCallback(msg);
20
+ };
21
+ const postMessageTransferableError = (error) => {
22
+ postMessage({
23
+ type: "onError",
24
+ error: createTransferableError(error),
25
+ });
26
+ };
27
+ const safeHandler = (handler) => (...args) => {
28
+ try {
29
+ handler(...args);
30
+ }
31
+ catch (error) {
32
+ postMessageTransferableError(error);
33
+ }
34
+ };
35
+ const worker = {
36
+ postMessage: (message) => {
37
+ if (message.type !== "init") {
38
+ if (!deps) {
39
+ pendingMessages.push(message);
40
+ }
41
+ else {
42
+ safeHandler(onMessage(deps))(message);
43
+ }
44
+ return;
45
+ }
46
+ if (initializing)
47
+ return;
48
+ initializing = true;
49
+ init(message, postMessage, safeHandler)
50
+ .then((_deps) => {
51
+ if (_deps == null)
52
+ return;
53
+ deps = _deps;
54
+ for (const message of pendingMessages) {
55
+ safeHandler(onMessage(deps))(message);
56
+ }
57
+ pendingMessages.length = 0;
58
+ })
59
+ .catch(postMessageTransferableError);
60
+ },
61
+ onMessage: (callback) => {
62
+ onMessageCallback = callback;
63
+ },
64
+ };
65
+ return worker;
66
+ };
@@ -1,16 +1,29 @@
1
- export * from "./Config.js";
2
- export * from "./Crdt.js";
1
+ export * from "./Array.js";
2
+ export * from "./Assert.js";
3
+ export * from "./BigInt.js";
4
+ export * from "./Buffer.js";
5
+ export * from "./Callbacks.js";
6
+ export * from "./Console.js";
3
7
  export * from "./Crypto.js";
4
- export * from "./Db.js";
5
- export * from "./Diff.js";
8
+ export * from "./Eq.js";
6
9
  export * from "./Error.js";
7
- export * from "./Evolu.js";
8
- export * from "./Model.js";
9
- export * from "./Murmurhash.js";
10
- export * from "./Owner.js";
11
- export * from "./Platform.js";
12
- export * from "./Protobuf.js";
10
+ export * from "./Evolu/Public.js";
11
+ export * from "./Function.js";
12
+ export * from "./ManyToManyMap.js";
13
+ export * from "./NanoId.js";
14
+ export * from "./Number.js";
15
+ export * from "./Object.js";
16
+ export * from "./Order.js";
17
+ export * from "./Promise.js";
18
+ export * from "./Random.js";
19
+ export * from "./Ref.js";
20
+ export * from "./Result.js";
13
21
  export * from "./Sqlite.js";
14
22
  export * from "./Store.js";
15
- export * from "./Sync.js";
23
+ export * from "./String.js";
24
+ export * from "./Time.js";
25
+ export * from "./Type.js";
26
+ export * from "./Types.js";
27
+ export * from "./WebSocket.js";
28
+ export * from "./Worker.js";
16
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,15 +1,28 @@
1
- export * from "./Config.js";
2
- export * from "./Crdt.js";
1
+ export * from "./Array.js";
2
+ export * from "./Assert.js";
3
+ export * from "./BigInt.js";
4
+ export * from "./Buffer.js";
5
+ export * from "./Callbacks.js";
6
+ export * from "./Console.js";
3
7
  export * from "./Crypto.js";
4
- export * from "./Db.js";
5
- export * from "./Diff.js";
8
+ export * from "./Eq.js";
6
9
  export * from "./Error.js";
7
- export * from "./Evolu.js";
8
- export * from "./Model.js";
9
- export * from "./Murmurhash.js";
10
- export * from "./Owner.js";
11
- export * from "./Platform.js";
12
- export * from "./Protobuf.js";
10
+ export * from "./Evolu/Public.js";
11
+ export * from "./Function.js";
12
+ export * from "./ManyToManyMap.js";
13
+ export * from "./NanoId.js";
14
+ export * from "./Number.js";
15
+ export * from "./Object.js";
16
+ export * from "./Order.js";
17
+ export * from "./Promise.js";
18
+ export * from "./Random.js";
19
+ export * from "./Ref.js";
20
+ export * from "./Result.js";
13
21
  export * from "./Sqlite.js";
14
22
  export * from "./Store.js";
15
- export * from "./Sync.js";
23
+ export * from "./String.js";
24
+ export * from "./Time.js";
25
+ export * from "./Type.js";
26
+ export * from "./Types.js";
27
+ export * from "./WebSocket.js";
28
+ export * from "./Worker.js";