@evolu/common 8.9.0 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/Bytes.d.ts +647 -0
- package/dist/src/Bytes.d.ts.map +1 -0
- package/dist/src/{Binary.js → Bytes.js} +266 -16
- package/dist/src/Config.d.ts +142 -0
- package/dist/src/Config.d.ts.map +1 -0
- package/dist/src/Config.js +181 -0
- package/dist/src/Console.d.ts +62 -7
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +20 -4
- package/dist/src/Crypto.d.ts +76 -4
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +55 -4
- package/dist/src/Error.d.ts +45 -0
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +69 -0
- package/dist/src/Fs.d.ts +376 -0
- package/dist/src/Fs.d.ts.map +1 -0
- package/dist/src/Fs.js +113 -0
- package/dist/src/Identicon.d.ts +2 -2
- package/dist/src/Identicon.js +2 -2
- package/dist/src/LeakDetector.d.ts +22 -3
- package/dist/src/LeakDetector.d.ts.map +1 -1
- package/dist/src/LeakDetector.js +12 -2
- package/dist/src/LockManager.d.ts +8 -0
- package/dist/src/LockManager.d.ts.map +1 -1
- package/dist/src/LockManager.js +6 -0
- package/dist/src/Number.d.ts +50 -7
- package/dist/src/Number.d.ts.map +1 -1
- package/dist/src/Number.js +47 -8
- package/dist/src/Object.d.ts +32 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +46 -0
- package/dist/src/Platform.d.ts +47 -7
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +24 -5
- package/dist/src/Random.d.ts +25 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/Random.js +14 -2
- package/dist/src/Resource.d.ts +156 -1
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +201 -72
- package/dist/src/Schedule.d.ts +11 -10
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/Schedule.js +1 -1
- package/dist/src/Sqlite.d.ts +132 -16
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +64 -10
- package/dist/src/Task.d.ts +15 -4
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +41 -15
- package/dist/src/Test.d.ts +9 -0
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +4 -0
- package/dist/src/Time.d.ts +179 -20
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +95 -6
- package/dist/src/Type.d.ts +3056 -1539
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +2548 -584
- package/dist/src/WebSocket.d.ts +164 -13
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +133 -24
- package/dist/src/Worker.d.ts +90 -8
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +28 -2
- package/dist/src/index.d.ts +9 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -4
- package/dist/src/intl/_en.d.ts +24 -1
- package/dist/src/intl/_en.d.ts.map +1 -1
- package/dist/src/intl/_en.js +20 -0
- package/dist/src/intl/ar.d.ts +24 -1
- package/dist/src/intl/ar.d.ts.map +1 -1
- package/dist/src/intl/ar.js +20 -0
- package/dist/src/intl/bn.d.ts +24 -1
- package/dist/src/intl/bn.d.ts.map +1 -1
- package/dist/src/intl/bn.js +20 -0
- package/dist/src/intl/ca.d.ts +24 -1
- package/dist/src/intl/ca.d.ts.map +1 -1
- package/dist/src/intl/ca.js +20 -0
- package/dist/src/intl/cs.d.ts +24 -1
- package/dist/src/intl/cs.d.ts.map +1 -1
- package/dist/src/intl/cs.js +20 -0
- package/dist/src/intl/da.d.ts +24 -1
- package/dist/src/intl/da.d.ts.map +1 -1
- package/dist/src/intl/da.js +20 -0
- package/dist/src/intl/de.d.ts +24 -1
- package/dist/src/intl/de.d.ts.map +1 -1
- package/dist/src/intl/de.js +20 -0
- package/dist/src/intl/el.d.ts +24 -1
- package/dist/src/intl/el.d.ts.map +1 -1
- package/dist/src/intl/el.js +20 -0
- package/dist/src/intl/es.d.ts +24 -1
- package/dist/src/intl/es.d.ts.map +1 -1
- package/dist/src/intl/es.js +20 -0
- package/dist/src/intl/fa.d.ts +24 -1
- package/dist/src/intl/fa.d.ts.map +1 -1
- package/dist/src/intl/fa.js +20 -0
- package/dist/src/intl/fi.d.ts +24 -1
- package/dist/src/intl/fi.d.ts.map +1 -1
- package/dist/src/intl/fi.js +20 -0
- package/dist/src/intl/fil.d.ts +24 -1
- package/dist/src/intl/fil.d.ts.map +1 -1
- package/dist/src/intl/fil.js +20 -0
- package/dist/src/intl/fr.d.ts +24 -1
- package/dist/src/intl/fr.d.ts.map +1 -1
- package/dist/src/intl/fr.js +20 -0
- package/dist/src/intl/he.d.ts +24 -1
- package/dist/src/intl/he.d.ts.map +1 -1
- package/dist/src/intl/he.js +20 -0
- package/dist/src/intl/hi.d.ts +24 -1
- package/dist/src/intl/hi.d.ts.map +1 -1
- package/dist/src/intl/hi.js +20 -0
- package/dist/src/intl/hr.d.ts +24 -1
- package/dist/src/intl/hr.d.ts.map +1 -1
- package/dist/src/intl/hr.js +20 -0
- package/dist/src/intl/hu.d.ts +22 -1
- package/dist/src/intl/hu.d.ts.map +1 -1
- package/dist/src/intl/hu.js +18 -0
- package/dist/src/intl/id.d.ts +24 -1
- package/dist/src/intl/id.d.ts.map +1 -1
- package/dist/src/intl/id.js +20 -0
- package/dist/src/intl/it.d.ts +24 -1
- package/dist/src/intl/it.d.ts.map +1 -1
- package/dist/src/intl/it.js +20 -0
- package/dist/src/intl/ja.d.ts +24 -1
- package/dist/src/intl/ja.d.ts.map +1 -1
- package/dist/src/intl/ja.js +20 -0
- package/dist/src/intl/ko.d.ts +24 -1
- package/dist/src/intl/ko.d.ts.map +1 -1
- package/dist/src/intl/ko.js +20 -0
- package/dist/src/intl/ml.d.ts +24 -1
- package/dist/src/intl/ml.d.ts.map +1 -1
- package/dist/src/intl/ml.js +20 -0
- package/dist/src/intl/mr.d.ts +24 -1
- package/dist/src/intl/mr.d.ts.map +1 -1
- package/dist/src/intl/mr.js +20 -0
- package/dist/src/intl/ms.d.ts +24 -1
- package/dist/src/intl/ms.d.ts.map +1 -1
- package/dist/src/intl/ms.js +20 -0
- package/dist/src/intl/nb.d.ts +22 -1
- package/dist/src/intl/nb.d.ts.map +1 -1
- package/dist/src/intl/nb.js +18 -0
- package/dist/src/intl/nl.d.ts +24 -1
- package/dist/src/intl/nl.d.ts.map +1 -1
- package/dist/src/intl/nl.js +20 -0
- package/dist/src/intl/pa.d.ts +24 -1
- package/dist/src/intl/pa.d.ts.map +1 -1
- package/dist/src/intl/pa.js +20 -0
- package/dist/src/intl/pl.d.ts +23 -0
- package/dist/src/intl/pl.d.ts.map +1 -1
- package/dist/src/intl/pl.js +20 -0
- package/dist/src/intl/pt-BR.d.ts +24 -1
- package/dist/src/intl/pt-BR.d.ts.map +1 -1
- package/dist/src/intl/pt-BR.js +20 -0
- package/dist/src/intl/pt.d.ts +24 -1
- package/dist/src/intl/pt.d.ts.map +1 -1
- package/dist/src/intl/pt.js +20 -0
- package/dist/src/intl/ro.d.ts +24 -1
- package/dist/src/intl/ro.d.ts.map +1 -1
- package/dist/src/intl/ro.js +20 -0
- package/dist/src/intl/sk.d.ts +24 -1
- package/dist/src/intl/sk.d.ts.map +1 -1
- package/dist/src/intl/sk.js +20 -0
- package/dist/src/intl/sl.d.ts +24 -1
- package/dist/src/intl/sl.d.ts.map +1 -1
- package/dist/src/intl/sl.js +20 -0
- package/dist/src/intl/sv.d.ts +24 -1
- package/dist/src/intl/sv.d.ts.map +1 -1
- package/dist/src/intl/sv.js +20 -0
- package/dist/src/intl/sw.d.ts +21 -0
- package/dist/src/intl/sw.d.ts.map +1 -1
- package/dist/src/intl/sw.js +18 -0
- package/dist/src/intl/ta.d.ts +24 -1
- package/dist/src/intl/ta.d.ts.map +1 -1
- package/dist/src/intl/ta.js +20 -0
- package/dist/src/intl/te.d.ts +24 -1
- package/dist/src/intl/te.d.ts.map +1 -1
- package/dist/src/intl/te.js +20 -0
- package/dist/src/intl/th.d.ts +24 -1
- package/dist/src/intl/th.d.ts.map +1 -1
- package/dist/src/intl/th.js +20 -0
- package/dist/src/intl/tr.d.ts +24 -1
- package/dist/src/intl/tr.d.ts.map +1 -1
- package/dist/src/intl/tr.js +20 -0
- package/dist/src/intl/uk.d.ts +80 -57
- package/dist/src/intl/uk.d.ts.map +1 -1
- package/dist/src/intl/uk.js +174 -149
- package/dist/src/intl/ur.d.ts +24 -1
- package/dist/src/intl/ur.d.ts.map +1 -1
- package/dist/src/intl/ur.js +20 -0
- package/dist/src/intl/vi.d.ts +24 -1
- package/dist/src/intl/vi.d.ts.map +1 -1
- package/dist/src/intl/vi.js +20 -0
- package/dist/src/intl/zh-CN.d.ts +24 -1
- package/dist/src/intl/zh-CN.d.ts.map +1 -1
- package/dist/src/intl/zh-CN.js +20 -0
- package/dist/src/intl/zh-TW.d.ts +24 -1
- package/dist/src/intl/zh-TW.d.ts.map +1 -1
- package/dist/src/intl/zh-TW.js +20 -0
- package/dist/src/local-first/Db.d.ts +52 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +412 -137
- package/dist/src/local-first/Evolu.d.ts +336 -211
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +102 -15
- package/dist/src/local-first/Owner.d.ts +13 -30
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +13 -30
- package/dist/src/local-first/Protocol.d.ts +95 -17
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +119 -39
- package/dist/src/local-first/Query.d.ts +8 -15
- package/dist/src/local-first/Query.d.ts.map +1 -1
- package/dist/src/local-first/Schema.d.ts +345 -21
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +214 -17
- package/dist/src/local-first/Shared.d.ts +537 -22
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +1437 -234
- package/dist/src/local-first/Storage.d.ts +192 -14
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +82 -21
- package/dist/src/local-first/Timestamp.d.ts +392 -41
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +404 -82
- package/dist/src/local-first/index.d.ts +0 -1
- package/dist/src/local-first/index.d.ts.map +1 -1
- package/dist/src/local-first/index.js +0 -1
- package/package.json +1 -1
- package/src/Assert.test.ts +2 -5
- package/src/{Binary.test.ts → Bytes.test.ts} +286 -1
- package/src/{Binary.ts → Bytes.ts} +652 -21
- package/src/Config.test.ts +668 -0
- package/src/Config.ts +410 -0
- package/src/Console.ts +62 -7
- package/src/Crypto.ts +76 -4
- package/src/Eq.test.ts +2 -3
- package/src/Error.test.ts +76 -3
- package/src/Error.ts +71 -0
- package/src/Fs.test.ts +105 -0
- package/src/Fs.ts +488 -0
- package/src/Identicon.ts +2 -2
- package/src/LeakDetector.ts +22 -3
- package/src/LockManager.ts +8 -0
- package/src/Number.test.ts +82 -18
- package/src/Number.ts +76 -8
- package/src/Object.test.ts +139 -10
- package/src/Object.ts +49 -0
- package/src/Platform.ts +50 -8
- package/src/Random.ts +25 -2
- package/src/Resource.test.ts +837 -0
- package/src/Resource.ts +235 -15
- package/src/Schedule.test.ts +50 -12
- package/src/Schedule.ts +24 -14
- package/src/Sqlite.ts +138 -18
- package/src/Task.test.ts +189 -8
- package/src/Task.ts +56 -17
- package/src/Test.ts +9 -0
- package/src/Time.test.ts +82 -11
- package/src/Time.ts +246 -24
- package/src/Type.test.ts +3994 -1119
- package/src/Type.ts +7258 -3842
- package/src/Types.test.ts +4 -14
- package/src/WebSocket.ts +313 -40
- package/src/Worker.ts +90 -8
- package/src/index.ts +18 -7
- package/src/intl/_en.ts +70 -0
- package/src/intl/ar.ts +71 -0
- package/src/intl/bn.ts +70 -0
- package/src/intl/ca.ts +70 -0
- package/src/intl/cs.ts +70 -0
- package/src/intl/da.ts +70 -0
- package/src/intl/de.ts +70 -0
- package/src/intl/el.ts +70 -0
- package/src/intl/es.ts +70 -0
- package/src/intl/fa.ts +70 -0
- package/src/intl/fi.ts +70 -0
- package/src/intl/fil.ts +70 -0
- package/src/intl/fr.ts +70 -0
- package/src/intl/he.ts +70 -0
- package/src/intl/hi.ts +70 -0
- package/src/intl/hr.ts +70 -0
- package/src/intl/hu.ts +69 -0
- package/src/intl/id.ts +70 -0
- package/src/intl/intl.test.ts +819 -1
- package/src/intl/it.ts +70 -0
- package/src/intl/ja.ts +70 -0
- package/src/intl/ko.ts +68 -0
- package/src/intl/ml.ts +70 -0
- package/src/intl/mr.ts +70 -0
- package/src/intl/ms.ts +71 -0
- package/src/intl/nb.ts +69 -0
- package/src/intl/nl.ts +70 -0
- package/src/intl/pa.ts +70 -0
- package/src/intl/pl.ts +63 -0
- package/src/intl/pt-BR.ts +70 -0
- package/src/intl/pt.ts +71 -0
- package/src/intl/ro.ts +70 -0
- package/src/intl/sk.ts +71 -0
- package/src/intl/sl.ts +70 -0
- package/src/intl/sv.ts +70 -0
- package/src/intl/sw.ts +62 -0
- package/src/intl/ta.ts +70 -0
- package/src/intl/te.ts +70 -0
- package/src/intl/th.ts +68 -0
- package/src/intl/tr.ts +70 -0
- package/src/intl/uk.ts +228 -155
- package/src/intl/ur.ts +70 -0
- package/src/intl/vi.ts +70 -0
- package/src/intl/zh-CN.ts +68 -0
- package/src/intl/zh-TW.ts +68 -0
- package/src/local-first/Db.ts +644 -339
- package/src/local-first/Evolu.test.ts +686 -21
- package/src/local-first/Evolu.ts +450 -228
- package/src/local-first/Owner.ts +13 -30
- package/src/local-first/Protocol.test.ts +618 -11
- package/src/local-first/Protocol.ts +197 -73
- package/src/local-first/Query.ts +8 -15
- package/src/local-first/Schema.test.ts +143 -0
- package/src/local-first/Schema.ts +374 -24
- package/src/local-first/Shared.test.ts +7731 -559
- package/src/local-first/Shared.ts +2036 -267
- package/src/local-first/Storage.ts +219 -33
- package/src/local-first/Timestamp.test.ts +344 -70
- package/src/local-first/Timestamp.ts +435 -119
- package/src/local-first/index.ts +0 -1
- package/dist/src/Binary.d.ts +0 -254
- package/dist/src/Binary.d.ts.map +0 -1
- package/dist/src/local-first/Error.d.ts +0 -12
- package/dist/src/local-first/Error.d.ts.map +0 -1
- package/dist/src/local-first/Error.js +0 -6
- package/dist/src/local-first/LocalAuth.d.ts +0 -150
- package/dist/src/local-first/LocalAuth.d.ts.map +0 -1
- package/dist/src/local-first/LocalAuth.js +0 -179
- package/src/local-first/Error.ts +0 -17
- package/src/local-first/LocalAuth.ts +0 -457
package/src/Worker.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { disposable } from "./Function.ts";
|
|
|
12
12
|
/**
|
|
13
13
|
* Typed, disposable Worker.
|
|
14
14
|
*
|
|
15
|
+
* @group Core
|
|
15
16
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Worker
|
|
16
17
|
*/
|
|
17
18
|
export interface Worker<Input, Output = never> extends MessagePort<
|
|
@@ -25,6 +26,7 @@ export interface Worker<Input, Output = never> extends MessagePort<
|
|
|
25
26
|
* A shared worker is shared across multiple clients (tabs, windows, iframes)
|
|
26
27
|
* and provides a port for bidirectional communication with each client.
|
|
27
28
|
*
|
|
29
|
+
* @group Core
|
|
28
30
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker
|
|
29
31
|
*/
|
|
30
32
|
export interface SharedWorker<Input, Output = never> extends Disposable {
|
|
@@ -41,6 +43,7 @@ export interface SharedWorker<Input, Output = never> extends Disposable {
|
|
|
41
43
|
* end periodically sends "alive" messages and stale ports are pruned after a
|
|
42
44
|
* timeout.
|
|
43
45
|
*
|
|
46
|
+
* @group Core
|
|
44
47
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MessagePort
|
|
45
48
|
*/
|
|
46
49
|
export interface MessagePort<Input, Output = never> extends Disposable {
|
|
@@ -92,6 +95,8 @@ export interface MessagePort<Input, Output = never> extends Disposable {
|
|
|
92
95
|
* Intentionally scoped to types Evolu uses. The web platform defines additional
|
|
93
96
|
* transferable types (`ImageBitmap`, `OffscreenCanvas`, `ReadableStream`, etc.)
|
|
94
97
|
* that can be added here if needed.
|
|
98
|
+
*
|
|
99
|
+
* @group Core
|
|
95
100
|
*/
|
|
96
101
|
export type Transferable = NativeMessagePort<any, any> | ArrayBuffer;
|
|
97
102
|
|
|
@@ -101,6 +106,8 @@ export type Transferable = NativeMessagePort<any, any> | ArrayBuffer;
|
|
|
101
106
|
* Exists because `postMessage` transfer requires the native object itself, not
|
|
102
107
|
* a wrapper. Ensures type-safe wiring between {@link MessagePort.native} and
|
|
103
108
|
* {@link CreateMessagePort} without exposing platform details.
|
|
109
|
+
*
|
|
110
|
+
* @group Core
|
|
104
111
|
*/
|
|
105
112
|
export type NativeMessagePort<
|
|
106
113
|
Input = unknown,
|
|
@@ -113,16 +120,29 @@ export type NativeMessagePort<
|
|
|
113
120
|
declare const nativeMessagePortInput: unique symbol;
|
|
114
121
|
declare const nativeMessagePortOutput: unique symbol;
|
|
115
122
|
|
|
116
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Factory function to create a {@link MessagePort} from a native port.
|
|
125
|
+
*
|
|
126
|
+
* @group Construction
|
|
127
|
+
*/
|
|
117
128
|
export type CreateMessagePort = <Input, Output = never>(
|
|
118
129
|
nativePort: NativeMessagePort<Input, Output>,
|
|
119
130
|
) => MessagePort<Input, Output>;
|
|
120
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Dependency wrapper for {@link CreateMessagePort}.
|
|
134
|
+
*
|
|
135
|
+
* @group Construction
|
|
136
|
+
*/
|
|
121
137
|
export interface CreateMessagePortDep {
|
|
122
138
|
readonly createMessagePort: CreateMessagePort;
|
|
123
139
|
}
|
|
124
140
|
|
|
125
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* Common dependencies for worker entry points.
|
|
143
|
+
*
|
|
144
|
+
* @group Core
|
|
145
|
+
*/
|
|
126
146
|
export type WorkerDeps = ConsoleDep &
|
|
127
147
|
ConsoleStoreOutputEntryDep &
|
|
128
148
|
CreateMessagePortDep;
|
|
@@ -221,6 +241,7 @@ export type WorkerDeps = ConsoleDep &
|
|
|
221
241
|
* ]);
|
|
222
242
|
* ```
|
|
223
243
|
*
|
|
244
|
+
* @group Core
|
|
224
245
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel
|
|
225
246
|
*/
|
|
226
247
|
export interface MessageChannel<Input, Output = never> extends Disposable {
|
|
@@ -231,12 +252,21 @@ export interface MessageChannel<Input, Output = never> extends Disposable {
|
|
|
231
252
|
readonly port2: MessagePort<Output, Input>;
|
|
232
253
|
}
|
|
233
254
|
|
|
234
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* Factory function to create a {@link MessageChannel}.
|
|
257
|
+
*
|
|
258
|
+
* @group Construction
|
|
259
|
+
*/
|
|
235
260
|
export type CreateMessageChannel = <Input, Output = never>() => MessageChannel<
|
|
236
261
|
Input,
|
|
237
262
|
Output
|
|
238
263
|
>;
|
|
239
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Dependency wrapper for {@link CreateMessageChannel}.
|
|
267
|
+
*
|
|
268
|
+
* @group Construction
|
|
269
|
+
*/
|
|
240
270
|
export interface CreateMessageChannelDep {
|
|
241
271
|
readonly createMessageChannel: CreateMessageChannel;
|
|
242
272
|
}
|
|
@@ -247,6 +277,7 @@ export interface CreateMessageChannelDep {
|
|
|
247
277
|
* Broadcast channels deliver messages to other channels opened with the same
|
|
248
278
|
* name. The sending channel does not receive its own messages.
|
|
249
279
|
*
|
|
280
|
+
* @group Core
|
|
250
281
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel
|
|
251
282
|
*/
|
|
252
283
|
export interface BroadcastChannel<Input, Output = Input> extends Disposable {
|
|
@@ -257,11 +288,20 @@ export interface BroadcastChannel<Input, Output = Input> extends Disposable {
|
|
|
257
288
|
onMessage: ((message: Output) => void) | null;
|
|
258
289
|
}
|
|
259
290
|
|
|
260
|
-
/**
|
|
291
|
+
/**
|
|
292
|
+
* Factory function to create a {@link BroadcastChannel}.
|
|
293
|
+
*
|
|
294
|
+
* @group Construction
|
|
295
|
+
*/
|
|
261
296
|
export type CreateBroadcastChannel = <Input, Output = Input>(
|
|
262
297
|
name: string,
|
|
263
298
|
) => BroadcastChannel<Input, Output>;
|
|
264
299
|
|
|
300
|
+
/**
|
|
301
|
+
* Dependency wrapper for {@link CreateBroadcastChannel}.
|
|
302
|
+
*
|
|
303
|
+
* @group Construction
|
|
304
|
+
*/
|
|
265
305
|
export interface CreateBroadcastChannelDep {
|
|
266
306
|
readonly createBroadcastChannel: CreateBroadcastChannel;
|
|
267
307
|
}
|
|
@@ -271,6 +311,8 @@ export interface CreateBroadcastChannelDep {
|
|
|
271
311
|
*
|
|
272
312
|
* This is the worker-side counterpart to {@link Worker} — a typed
|
|
273
313
|
* {@link MessagePort} that wraps `self` inside the worker.
|
|
314
|
+
*
|
|
315
|
+
* @group Core
|
|
274
316
|
*/
|
|
275
317
|
export interface WorkerSelf<Input, Output = never> extends MessagePort<
|
|
276
318
|
Output,
|
|
@@ -282,6 +324,8 @@ export interface WorkerSelf<Input, Output = never> extends MessagePort<
|
|
|
282
324
|
*
|
|
283
325
|
* This is the worker-side counterpart to {@link SharedWorker}. It wraps `self`
|
|
284
326
|
* inside the shared worker, providing typed `onConnect` callbacks.
|
|
327
|
+
*
|
|
328
|
+
* @group Core
|
|
285
329
|
*/
|
|
286
330
|
export interface SharedWorkerSelf<Input, Output = never> extends Disposable {
|
|
287
331
|
onConnect: ((port: MessagePort<Output, Input>) => void) | null;
|
|
@@ -292,6 +336,8 @@ export interface SharedWorkerSelf<Input, Output = never> extends Disposable {
|
|
|
292
336
|
*
|
|
293
337
|
* This is a memory-only fallback for platforms without native worker support.
|
|
294
338
|
* Message delivery is asynchronous in-process.
|
|
339
|
+
*
|
|
340
|
+
* @group Construction
|
|
295
341
|
*/
|
|
296
342
|
export const createWorker = <Input, Output = never>(
|
|
297
343
|
initWorker: (self: WorkerSelf<Input, Output>) => void,
|
|
@@ -309,6 +355,8 @@ export const createWorker = <Input, Output = never>(
|
|
|
309
355
|
* in-process.
|
|
310
356
|
*
|
|
311
357
|
* Intended usage is one shared worker instance per process/app runtime.
|
|
358
|
+
*
|
|
359
|
+
* @group Construction
|
|
312
360
|
*/
|
|
313
361
|
export const createSharedWorker = <Input, Output = never>(
|
|
314
362
|
initWorker: (self: SharedWorkerSelf<Input, Output>) => void,
|
|
@@ -329,6 +377,8 @@ export const createSharedWorker = <Input, Output = never>(
|
|
|
329
377
|
*
|
|
330
378
|
* This is a memory-only fallback for platforms without native MessageChannel
|
|
331
379
|
* support. Message delivery is asynchronous in-process.
|
|
380
|
+
*
|
|
381
|
+
* @group Construction
|
|
332
382
|
*/
|
|
333
383
|
export const createMessageChannel: CreateMessageChannel = <
|
|
334
384
|
Input,
|
|
@@ -386,6 +436,8 @@ export const createMessageChannel: CreateMessageChannel = <
|
|
|
386
436
|
*
|
|
387
437
|
* This is a memory-only fallback for platforms without native MessagePort
|
|
388
438
|
* support. Message delivery through returned ports is asynchronous in-process.
|
|
439
|
+
*
|
|
440
|
+
* @group Construction
|
|
389
441
|
*/
|
|
390
442
|
export const createMessagePort: CreateMessagePort = <Input, Output = never>(
|
|
391
443
|
nativePort: NativeMessagePort<Input, Output>,
|
|
@@ -400,6 +452,8 @@ export const createMessagePort: CreateMessagePort = <Input, Output = never>(
|
|
|
400
452
|
*
|
|
401
453
|
* This is a memory-only fallback for platforms without native BroadcastChannel
|
|
402
454
|
* support. Message delivery is asynchronous in-process.
|
|
455
|
+
*
|
|
456
|
+
* @group Construction
|
|
403
457
|
*/
|
|
404
458
|
export const createBroadcastChannel: CreateBroadcastChannel = <
|
|
405
459
|
Input,
|
|
@@ -468,6 +522,8 @@ const broadcastChannelDispatchesByName = new Map<
|
|
|
468
522
|
* Test {@link Worker} with access to its paired worker-side `self`.
|
|
469
523
|
*
|
|
470
524
|
* Use `self` to simulate messages and behavior from inside the worker.
|
|
525
|
+
*
|
|
526
|
+
* @group Testing
|
|
471
527
|
*/
|
|
472
528
|
export interface TestWorker<Input, Output = never> extends Worker<
|
|
473
529
|
Input,
|
|
@@ -482,6 +538,8 @@ export interface TestWorker<Input, Output = never> extends Worker<
|
|
|
482
538
|
*
|
|
483
539
|
* Call `connect()` to simulate a client connection and trigger
|
|
484
540
|
* `self.onConnect`.
|
|
541
|
+
*
|
|
542
|
+
* @group Testing
|
|
485
543
|
*/
|
|
486
544
|
export interface TestSharedWorker<Input, Output = never> extends SharedWorker<
|
|
487
545
|
Input,
|
|
@@ -491,7 +549,11 @@ export interface TestSharedWorker<Input, Output = never> extends SharedWorker<
|
|
|
491
549
|
readonly connect: () => void;
|
|
492
550
|
}
|
|
493
551
|
|
|
494
|
-
/**
|
|
552
|
+
/**
|
|
553
|
+
* {@link MessageChannel} with disposal tracking for testing.
|
|
554
|
+
*
|
|
555
|
+
* @group Testing
|
|
556
|
+
*/
|
|
495
557
|
export interface TestMessageChannel<
|
|
496
558
|
Input,
|
|
497
559
|
Output = never,
|
|
@@ -499,7 +561,11 @@ export interface TestMessageChannel<
|
|
|
499
561
|
readonly isDisposed: () => boolean;
|
|
500
562
|
}
|
|
501
563
|
|
|
502
|
-
/**
|
|
564
|
+
/**
|
|
565
|
+
* {@link BroadcastChannel} with disposal tracking for testing.
|
|
566
|
+
*
|
|
567
|
+
* @group Testing
|
|
568
|
+
*/
|
|
503
569
|
export interface TestBroadcastChannel<
|
|
504
570
|
Input,
|
|
505
571
|
Output = Input,
|
|
@@ -512,6 +578,8 @@ export interface TestBroadcastChannel<
|
|
|
512
578
|
*
|
|
513
579
|
* The returned worker includes its typed {@link TestWorker.self} counterpart, so
|
|
514
580
|
* tests can exercise dedicated worker communication without a real thread.
|
|
581
|
+
*
|
|
582
|
+
* @group Testing
|
|
515
583
|
*/
|
|
516
584
|
export const testCreateWorker = <Input, Output = never>(): TestWorker<
|
|
517
585
|
Input,
|
|
@@ -531,6 +599,8 @@ export const testCreateWorker = <Input, Output = never>(): TestWorker<
|
|
|
531
599
|
*
|
|
532
600
|
* The returned worker includes `self` and `connect` so tests can exercise the
|
|
533
601
|
* full worker ↔ client pipeline without a real worker thread.
|
|
602
|
+
*
|
|
603
|
+
* @group Testing
|
|
534
604
|
*/
|
|
535
605
|
export const testCreateSharedWorker = <
|
|
536
606
|
Input,
|
|
@@ -554,6 +624,8 @@ export const testCreateSharedWorker = <
|
|
|
554
624
|
*
|
|
555
625
|
* Both ports are registered in the native port registry so
|
|
556
626
|
* {@link testCreateMessagePort} can look them up by their native token.
|
|
627
|
+
*
|
|
628
|
+
* @group Testing
|
|
557
629
|
*/
|
|
558
630
|
export const testCreateMessageChannel = <
|
|
559
631
|
Input,
|
|
@@ -572,12 +644,20 @@ export const testCreateMessageChannel = <
|
|
|
572
644
|
};
|
|
573
645
|
};
|
|
574
646
|
|
|
575
|
-
/**
|
|
647
|
+
/**
|
|
648
|
+
* Creates an in-memory {@link CreateMessagePort} for testing.
|
|
649
|
+
*
|
|
650
|
+
* @group Testing
|
|
651
|
+
*/
|
|
576
652
|
export const testCreateMessagePort: CreateMessagePort = <Input, Output = never>(
|
|
577
653
|
nativePort: NativeMessagePort<Input, Output>,
|
|
578
654
|
): MessagePort<Input, Output> => createMessagePort(nativePort);
|
|
579
655
|
|
|
580
|
-
/**
|
|
656
|
+
/**
|
|
657
|
+
* Creates an in-memory {@link BroadcastChannel} for testing.
|
|
658
|
+
*
|
|
659
|
+
* @group Testing
|
|
660
|
+
*/
|
|
581
661
|
export const testCreateBroadcastChannel = <Input, Output = Input>(
|
|
582
662
|
name: string,
|
|
583
663
|
): TestBroadcastChannel<Input, Output> => {
|
|
@@ -605,6 +685,8 @@ export const testCreateBroadcastChannel = <Input, Output = Input>(
|
|
|
605
685
|
* This observes actual transport tasks instead of waiting for an arbitrary
|
|
606
686
|
* duration. It also waits through message handlers that schedule more worker
|
|
607
687
|
* tasks before the current microtask checkpoint completes.
|
|
688
|
+
*
|
|
689
|
+
* @group Testing
|
|
608
690
|
*/
|
|
609
691
|
export const testWaitForWorkerMessage = (): Promise<void> =>
|
|
610
692
|
new Promise((resolve) => {
|
package/src/index.ts
CHANGED
|
@@ -8,13 +8,15 @@ export * from "./Array.ts";
|
|
|
8
8
|
export * from "./Assert.ts";
|
|
9
9
|
export * from "./BigInt.ts";
|
|
10
10
|
export * from "./Brand.ts";
|
|
11
|
-
export * from "./
|
|
11
|
+
export * from "./Bytes.ts";
|
|
12
12
|
export * from "./Cache.ts";
|
|
13
13
|
export * from "./Callbacks.ts";
|
|
14
|
+
export * from "./Config.ts";
|
|
14
15
|
export * from "./Console.ts";
|
|
15
16
|
export * from "./Crypto.ts";
|
|
16
17
|
export * from "./Eq.ts";
|
|
17
18
|
export * from "./Error.ts";
|
|
19
|
+
export * from "./Fs.ts";
|
|
18
20
|
export * from "./Function.ts";
|
|
19
21
|
export * from "./Http.ts";
|
|
20
22
|
export * from "./Identicon.ts";
|
|
@@ -49,16 +51,16 @@ export * from "./WebSocket.ts";
|
|
|
49
51
|
export * from "./Worker.ts";
|
|
50
52
|
|
|
51
53
|
// Local-first essentials.
|
|
52
|
-
export type {
|
|
53
|
-
export { AppName, createEvolu } from "./local-first/Evolu.ts";
|
|
54
|
+
export type { UnsupportedDbVersionError } from "./local-first/Db.ts";
|
|
55
|
+
export { AppName, createEvolu, testAppName } from "./local-first/Evolu.ts";
|
|
54
56
|
export type {
|
|
55
57
|
AppNameError,
|
|
56
58
|
Evolu,
|
|
57
59
|
EvoluConfig,
|
|
58
60
|
EvoluDeps,
|
|
61
|
+
EvoluError,
|
|
59
62
|
UnuseOwner,
|
|
60
63
|
} from "./local-first/Evolu.ts";
|
|
61
|
-
export * from "./local-first/LocalAuth.ts";
|
|
62
64
|
export * from "./local-first/Owner.ts";
|
|
63
65
|
export type { SyncOwner } from "./local-first/Owner.ts";
|
|
64
66
|
export {
|
|
@@ -73,7 +75,17 @@ export {
|
|
|
73
75
|
type QueryRows,
|
|
74
76
|
type Row,
|
|
75
77
|
} from "./local-first/Query.ts";
|
|
76
|
-
export {
|
|
78
|
+
export {
|
|
79
|
+
createQueryBuilder,
|
|
80
|
+
QuarantineOrigin,
|
|
81
|
+
QuarantineReason,
|
|
82
|
+
testEvoluSchema,
|
|
83
|
+
testLocalOnlyEvoluSchema,
|
|
84
|
+
TestProjectId,
|
|
85
|
+
testProjectId,
|
|
86
|
+
TestTodoId,
|
|
87
|
+
testTodoId,
|
|
88
|
+
} from "./local-first/Schema.ts";
|
|
77
89
|
export type {
|
|
78
90
|
AnyStandardSchemaV1,
|
|
79
91
|
EvoluSchema,
|
|
@@ -86,6 +98,7 @@ export type {
|
|
|
86
98
|
OptionalColumnKeys,
|
|
87
99
|
RequiredColumnKeys,
|
|
88
100
|
TableSchema,
|
|
101
|
+
TestEvoluSchema,
|
|
89
102
|
UpdateValues,
|
|
90
103
|
UpsertValues,
|
|
91
104
|
} from "./local-first/Schema.ts";
|
|
@@ -102,8 +115,6 @@ export {
|
|
|
102
115
|
} from "./local-first/Timestamp.ts";
|
|
103
116
|
export type {
|
|
104
117
|
TimestampBytes,
|
|
105
|
-
TimestampCounterOverflowError,
|
|
106
118
|
TimestampDriftError,
|
|
107
119
|
TimestampError,
|
|
108
|
-
TimestampTimeOutOfRangeError,
|
|
109
120
|
} from "./local-first/Timestamp.ts";
|
package/src/intl/_en.ts
CHANGED
|
@@ -13,13 +13,21 @@
|
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import type { DurationLiteralError } from "../Time.ts";
|
|
17
|
+
import type { PercentageLiteralError } from "../Number.ts";
|
|
18
|
+
import type { ByteSizeLiteralError } from "../Bytes.ts";
|
|
16
19
|
import { assertNonNullable } from "../Assert.ts";
|
|
17
20
|
import { safelyStringifyUnknownValue } from "../String.ts";
|
|
18
21
|
import type {
|
|
19
22
|
ArrayError,
|
|
20
23
|
Base64UrlError,
|
|
24
|
+
BooleanFromStringError,
|
|
21
25
|
BetweenError,
|
|
26
|
+
IdentifierError,
|
|
22
27
|
CapitalizedError,
|
|
28
|
+
UncapitalizedError,
|
|
29
|
+
UppercasedError,
|
|
30
|
+
LowercasedError,
|
|
23
31
|
DateIsoError,
|
|
24
32
|
DateIsoFromDateError,
|
|
25
33
|
DecimalStringError,
|
|
@@ -32,6 +40,7 @@ import type {
|
|
|
32
40
|
Int64Error,
|
|
33
41
|
Int64StringError,
|
|
34
42
|
IntError,
|
|
43
|
+
IntFromStringError,
|
|
35
44
|
IdError,
|
|
36
45
|
JsonError,
|
|
37
46
|
JsonValueError,
|
|
@@ -63,6 +72,7 @@ import type {
|
|
|
63
72
|
RecordError,
|
|
64
73
|
RegexError,
|
|
65
74
|
SetError,
|
|
75
|
+
StartsWithError,
|
|
66
76
|
TableIdError,
|
|
67
77
|
TemplateLiteralError,
|
|
68
78
|
TrimmedError,
|
|
@@ -119,6 +129,12 @@ export const formatBigIntError: TypeErrorFormatter<TypeOfError<"BigInt">> =
|
|
|
119
129
|
export const formatBooleanError: TypeErrorFormatter<TypeOfError<"Boolean">> =
|
|
120
130
|
formatTypeOfError;
|
|
121
131
|
|
|
132
|
+
/** Formats a BooleanFromStringError in English. */
|
|
133
|
+
export const formatBooleanFromStringError: TypeErrorFormatter<
|
|
134
|
+
BooleanFromStringError
|
|
135
|
+
> = (error) =>
|
|
136
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a boolean. Use true or false.`;
|
|
137
|
+
|
|
122
138
|
/** Formats a Symbol TypeOfError in English. */
|
|
123
139
|
export const formatSymbolError: TypeErrorFormatter<TypeOfError<"Symbol">> =
|
|
124
140
|
formatTypeOfError;
|
|
@@ -182,16 +198,46 @@ export const formatInt64StringError: TypeErrorFormatter<Int64StringError> = (
|
|
|
182
198
|
) =>
|
|
183
199
|
`The value ${safelyStringifyUnknownValue(error.value)} is not a valid Int64 string.`;
|
|
184
200
|
|
|
201
|
+
/** Formats an IdentifierError in English. */
|
|
202
|
+
export const formatIdentifierError: TypeErrorFormatter<IdentifierError> = (
|
|
203
|
+
error,
|
|
204
|
+
) =>
|
|
205
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a ${error.casing} identifier.`;
|
|
206
|
+
|
|
185
207
|
/** Formats a CapitalizedError in English. */
|
|
186
208
|
export const formatCapitalizedError: TypeErrorFormatter<CapitalizedError> = (
|
|
187
209
|
error,
|
|
188
210
|
) =>
|
|
189
211
|
`The value ${safelyStringifyUnknownValue(error.value)} must be capitalized.`;
|
|
190
212
|
|
|
213
|
+
/** Formats an UncapitalizedError in English. */
|
|
214
|
+
export const formatUncapitalizedError: TypeErrorFormatter<
|
|
215
|
+
UncapitalizedError
|
|
216
|
+
> = (error) =>
|
|
217
|
+
`The value ${safelyStringifyUnknownValue(error.value)} must not start with an uppercase letter.`;
|
|
218
|
+
|
|
219
|
+
/** Formats an UppercasedError in English. */
|
|
220
|
+
export const formatUppercasedError: TypeErrorFormatter<UppercasedError> = (
|
|
221
|
+
error,
|
|
222
|
+
) =>
|
|
223
|
+
`The value ${safelyStringifyUnknownValue(error.value)} must be uppercased.`;
|
|
224
|
+
|
|
225
|
+
/** Formats a LowercasedError in English. */
|
|
226
|
+
export const formatLowercasedError: TypeErrorFormatter<LowercasedError> = (
|
|
227
|
+
error,
|
|
228
|
+
) =>
|
|
229
|
+
`The value ${safelyStringifyUnknownValue(error.value)} must be lowercased.`;
|
|
230
|
+
|
|
191
231
|
/** Formats a TrimmedError in English. */
|
|
192
232
|
export const formatTrimmedError: TypeErrorFormatter<TrimmedError> = (error) =>
|
|
193
233
|
`The value ${safelyStringifyUnknownValue(error.value)} must be trimmed.`;
|
|
194
234
|
|
|
235
|
+
/** Formats a StartsWithError in English. */
|
|
236
|
+
export const formatStartsWithError: TypeErrorFormatter<StartsWithError> = (
|
|
237
|
+
error,
|
|
238
|
+
) =>
|
|
239
|
+
`The value ${safelyStringifyUnknownValue(error.value)} must start with ${safelyStringifyUnknownValue(error.prefix)}.`;
|
|
240
|
+
|
|
195
241
|
/** Formats a MinLengthError in English. */
|
|
196
242
|
export const formatMinLengthError: TypeErrorFormatter<MinLengthError> = (
|
|
197
243
|
error,
|
|
@@ -282,6 +328,12 @@ export const formatNegativeDecimalStringError: TypeErrorFormatter<
|
|
|
282
328
|
export const formatIntError: TypeErrorFormatter<IntError> = (error) =>
|
|
283
329
|
`The value ${safelyStringifyUnknownValue(error.value)} must be a safe integer.`;
|
|
284
330
|
|
|
331
|
+
/** Formats an IntFromStringError in English. */
|
|
332
|
+
export const formatIntFromStringError: TypeErrorFormatter<
|
|
333
|
+
IntFromStringError
|
|
334
|
+
> = (error) =>
|
|
335
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a decimal integer.`;
|
|
336
|
+
|
|
285
337
|
/** Formats a GreaterThanError in English. */
|
|
286
338
|
export const formatGreaterThanError: TypeErrorFormatter<GreaterThanError> = (
|
|
287
339
|
error,
|
|
@@ -511,3 +563,21 @@ export const formatJsonValueError: TypeErrorFormatter<JsonValueError> = (
|
|
|
511
563
|
/** Formats a JsonError in English. */
|
|
512
564
|
export const formatJsonError: TypeErrorFormatter<JsonError> = (error) =>
|
|
513
565
|
`The value ${safelyStringifyUnknownValue(error.value)} cannot be parsed into a JsonValue.`;
|
|
566
|
+
|
|
567
|
+
/** Formats a {@link ByteSizeLiteralError}. */
|
|
568
|
+
export const formatByteSizeLiteralError: TypeErrorFormatter<
|
|
569
|
+
ByteSizeLiteralError
|
|
570
|
+
> = (error) =>
|
|
571
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a byte-size literal. Use a value such as "512KiB" or "1MiB".`;
|
|
572
|
+
|
|
573
|
+
/** Formats a {@link DurationLiteralError}. */
|
|
574
|
+
export const formatDurationLiteralError: TypeErrorFormatter<
|
|
575
|
+
DurationLiteralError
|
|
576
|
+
> = (error) =>
|
|
577
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a duration literal. Use a value such as "500ms" or "1.5s".`;
|
|
578
|
+
|
|
579
|
+
/** Formats a {@link PercentageLiteralError}. */
|
|
580
|
+
export const formatPercentageLiteralError: TypeErrorFormatter<
|
|
581
|
+
PercentageLiteralError
|
|
582
|
+
> = (error) =>
|
|
583
|
+
`The value ${safelyStringifyUnknownValue(error.value)} is not a percentage literal. Use a value such as "50%" or "12.5%".`;
|
package/src/intl/ar.ts
CHANGED
|
@@ -4,13 +4,21 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { DurationLiteralError } from "../Time.ts";
|
|
8
|
+
import type { PercentageLiteralError } from "../Number.ts";
|
|
9
|
+
import type { ByteSizeLiteralError } from "../Bytes.ts";
|
|
7
10
|
import { assertNonNullable } from "../Assert.ts";
|
|
8
11
|
import { safelyStringifyUnknownValue } from "../String.ts";
|
|
9
12
|
import type {
|
|
10
13
|
ArrayError,
|
|
11
14
|
Base64UrlError,
|
|
15
|
+
BooleanFromStringError,
|
|
12
16
|
BetweenError,
|
|
17
|
+
IdentifierError,
|
|
13
18
|
CapitalizedError,
|
|
19
|
+
UncapitalizedError,
|
|
20
|
+
UppercasedError,
|
|
21
|
+
LowercasedError,
|
|
14
22
|
DateIsoError,
|
|
15
23
|
DateIsoFromDateError,
|
|
16
24
|
DecimalStringError,
|
|
@@ -23,6 +31,7 @@ import type {
|
|
|
23
31
|
Int64Error,
|
|
24
32
|
Int64StringError,
|
|
25
33
|
IntError,
|
|
34
|
+
IntFromStringError,
|
|
26
35
|
IdError,
|
|
27
36
|
JsonError,
|
|
28
37
|
JsonValueError,
|
|
@@ -56,6 +65,7 @@ import type {
|
|
|
56
65
|
SetError,
|
|
57
66
|
TableIdError,
|
|
58
67
|
TemplateLiteralError,
|
|
68
|
+
StartsWithError,
|
|
59
69
|
TrimmedError,
|
|
60
70
|
TupleElementsError,
|
|
61
71
|
TupleError,
|
|
@@ -152,14 +162,45 @@ export const formatInt64StringError: TypeErrorFormatter<Int64StringError> = (
|
|
|
152
162
|
error,
|
|
153
163
|
) =>
|
|
154
164
|
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست سلسلة Int64 صالحة.`;
|
|
165
|
+
|
|
166
|
+
/** Formats an IdentifierError in Arabic. */
|
|
167
|
+
export const formatIdentifierError: TypeErrorFormatter<IdentifierError> = (
|
|
168
|
+
error,
|
|
169
|
+
) =>
|
|
170
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست معرّفًا بصيغة ${error.casing}.`;
|
|
171
|
+
|
|
155
172
|
/** Formats a CapitalizedError in Arabic. */
|
|
156
173
|
export const formatCapitalizedError: TypeErrorFormatter<CapitalizedError> = (
|
|
157
174
|
error,
|
|
158
175
|
) =>
|
|
159
176
|
`يجب أن تبدأ القيمة ${safelyStringifyUnknownValue(error.value)} بحرف كبير.`;
|
|
177
|
+
|
|
178
|
+
/** Formats an UncapitalizedError in Arabic. */
|
|
179
|
+
export const formatUncapitalizedError: TypeErrorFormatter<
|
|
180
|
+
UncapitalizedError
|
|
181
|
+
> = (error) =>
|
|
182
|
+
`يجب ألا تبدأ القيمة ${safelyStringifyUnknownValue(error.value)} بحرف كبير.`;
|
|
183
|
+
|
|
184
|
+
/** Formats an UppercasedError in Arabic. */
|
|
185
|
+
export const formatUppercasedError: TypeErrorFormatter<UppercasedError> = (
|
|
186
|
+
error,
|
|
187
|
+
) =>
|
|
188
|
+
`يجب أن تكون القيمة ${safelyStringifyUnknownValue(error.value)} بأحرف كبيرة.`;
|
|
189
|
+
|
|
190
|
+
/** Formats a LowercasedError in Arabic. */
|
|
191
|
+
export const formatLowercasedError: TypeErrorFormatter<LowercasedError> = (
|
|
192
|
+
error,
|
|
193
|
+
) =>
|
|
194
|
+
`يجب أن تكون القيمة ${safelyStringifyUnknownValue(error.value)} بأحرف صغيرة.`;
|
|
160
195
|
/** Formats a TrimmedError in Arabic. */
|
|
161
196
|
export const formatTrimmedError: TypeErrorFormatter<TrimmedError> = (error) =>
|
|
162
197
|
`يجب إزالة المسافات من بداية القيمة ${safelyStringifyUnknownValue(error.value)} ونهايتها.`;
|
|
198
|
+
/** Formats a StartsWithError in Arabic. */
|
|
199
|
+
export const formatStartsWithError: TypeErrorFormatter<StartsWithError> = (
|
|
200
|
+
error,
|
|
201
|
+
) =>
|
|
202
|
+
`يجب أن تبدأ القيمة ${safelyStringifyUnknownValue(error.value)} بـ ${safelyStringifyUnknownValue(error.prefix)}.`;
|
|
203
|
+
|
|
163
204
|
/** Formats a MinLengthError in Arabic. */
|
|
164
205
|
export const formatMinLengthError: TypeErrorFormatter<MinLengthError> = (
|
|
165
206
|
error,
|
|
@@ -265,6 +306,18 @@ export const formatMultipleOfError: TypeErrorFormatter<MultipleOfError> = (
|
|
|
265
306
|
export const formatBetweenError: TypeErrorFormatter<BetweenError> = (error) =>
|
|
266
307
|
`يجب أن تكون القيمة ${safelyStringifyUnknownValue(error.value)} بين ${error.min} و${error.max}، شاملةً.`;
|
|
267
308
|
|
|
309
|
+
/** Formats a BooleanFromStringError in Arabic. */
|
|
310
|
+
export const formatBooleanFromStringError: TypeErrorFormatter<
|
|
311
|
+
BooleanFromStringError
|
|
312
|
+
> = (error) =>
|
|
313
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست قيمة منطقية. استخدم true أو false.`;
|
|
314
|
+
|
|
315
|
+
/** Formats an IntFromStringError in Arabic. */
|
|
316
|
+
export const formatIntFromStringError: TypeErrorFormatter<
|
|
317
|
+
IntFromStringError
|
|
318
|
+
> = (error) =>
|
|
319
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست عددًا صحيحًا عشريًا.`;
|
|
320
|
+
|
|
268
321
|
/** Formats an ArrayError in Arabic. */
|
|
269
322
|
export const formatArrayError: TypeErrorFormatter<ArrayError> = (error) => {
|
|
270
323
|
if (error.reason.kind === "NotArray")
|
|
@@ -430,3 +483,21 @@ export const formatJsonValueError: TypeErrorFormatter<JsonValueError> = (
|
|
|
430
483
|
/** Formats a JsonError in Arabic. */
|
|
431
484
|
export const formatJsonError: TypeErrorFormatter<JsonError> = (error) =>
|
|
432
485
|
`لا يمكن تحليل القيمة ${safelyStringifyUnknownValue(error.value)} إلى JsonValue.`;
|
|
486
|
+
|
|
487
|
+
/** Formats a {@link ByteSizeLiteralError}. */
|
|
488
|
+
export const formatByteSizeLiteralError: TypeErrorFormatter<
|
|
489
|
+
ByteSizeLiteralError
|
|
490
|
+
> = (error) =>
|
|
491
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست قيمة حرفية لحجم بالبايت. استخدم قيمة مثل "512KiB" أو "1MiB".`;
|
|
492
|
+
|
|
493
|
+
/** Formats a {@link DurationLiteralError}. */
|
|
494
|
+
export const formatDurationLiteralError: TypeErrorFormatter<
|
|
495
|
+
DurationLiteralError
|
|
496
|
+
> = (error) =>
|
|
497
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست قيمة حرفية لمدة زمنية. استخدم قيمة مثل "500ms" أو "1.5s".`;
|
|
498
|
+
|
|
499
|
+
/** Formats a {@link PercentageLiteralError}. */
|
|
500
|
+
export const formatPercentageLiteralError: TypeErrorFormatter<
|
|
501
|
+
PercentageLiteralError
|
|
502
|
+
> = (error) =>
|
|
503
|
+
`القيمة ${safelyStringifyUnknownValue(error.value)} ليست قيمة حرفية لنسبة مئوية. استخدم قيمة مثل "50%" أو "12.5%".`;
|