@livestore/utils 0.4.0 → 0.5.0-dev.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/.tsbuildinfo +1 -1
- package/dist/NoopTracer.d.ts +7 -8
- package/dist/NoopTracer.d.ts.map +1 -1
- package/dist/NoopTracer.js +3 -18
- package/dist/NoopTracer.js.map +1 -1
- package/dist/NoopTracer.test.d.ts +2 -0
- package/dist/NoopTracer.test.d.ts.map +1 -0
- package/dist/NoopTracer.test.js +17 -0
- package/dist/NoopTracer.test.js.map +1 -0
- package/dist/browser/Opfs/Opfs.d.ts +179 -29
- package/dist/browser/Opfs/Opfs.d.ts.map +1 -1
- package/dist/browser/Opfs/Opfs.js +132 -307
- package/dist/browser/Opfs/Opfs.js.map +1 -1
- package/dist/browser/Opfs/debug-utils.d.ts.map +1 -1
- package/dist/browser/Opfs/debug-utils.js +5 -4
- package/dist/browser/Opfs/debug-utils.js.map +1 -1
- package/dist/browser/Opfs/utils.d.ts +8 -8
- package/dist/browser/Opfs/utils.d.ts.map +1 -1
- package/dist/browser/Opfs/utils.js +35 -26
- package/dist/browser/Opfs/utils.js.map +1 -1
- package/dist/browser/QuotaExceededError.d.ts +10 -9
- package/dist/browser/QuotaExceededError.d.ts.map +1 -1
- package/dist/browser/WebChannelBrowser.d.ts.map +1 -1
- package/dist/browser/WebChannelBrowser.js +21 -10
- package/dist/browser/WebChannelBrowser.js.map +1 -1
- package/dist/browser/WebError.d.ts +54 -86
- package/dist/browser/WebError.d.ts.map +1 -1
- package/dist/browser/WebError.js +91 -84
- package/dist/browser/WebError.js.map +1 -1
- package/dist/browser/WebError.test.js +6 -6
- package/dist/browser/WebError.test.js.map +1 -1
- package/dist/browser/WebLock.d.ts.map +1 -1
- package/dist/browser/WebLock.js +13 -13
- package/dist/browser/WebLock.js.map +1 -1
- package/dist/effect/Debug.d.ts +4 -7
- package/dist/effect/Debug.d.ts.map +1 -1
- package/dist/effect/Debug.js +32 -36
- package/dist/effect/Debug.js.map +1 -1
- package/dist/effect/Effect.d.ts +31 -22
- package/dist/effect/Effect.d.ts.map +1 -1
- package/dist/effect/Effect.js +51 -47
- package/dist/effect/Effect.js.map +1 -1
- package/dist/effect/Effect.test.d.ts +2 -0
- package/dist/effect/Effect.test.d.ts.map +1 -0
- package/dist/effect/Effect.test.js +72 -0
- package/dist/effect/Effect.test.js.map +1 -0
- package/dist/effect/Error.d.ts +4 -6
- package/dist/effect/Error.d.ts.map +1 -1
- package/dist/effect/Logger.d.ts +0 -6
- package/dist/effect/Logger.d.ts.map +1 -1
- package/dist/effect/Logger.js +0 -32
- package/dist/effect/Logger.js.map +1 -1
- package/dist/effect/OtelTracer.d.ts +1 -1
- package/dist/effect/OtelTracer.d.ts.map +1 -1
- package/dist/effect/OtelTracer.js +2 -3
- package/dist/effect/OtelTracer.js.map +1 -1
- package/dist/effect/RpcClient.d.ts +7 -7
- package/dist/effect/RpcClient.d.ts.map +1 -1
- package/dist/effect/RpcClient.js +72 -52
- package/dist/effect/RpcClient.js.map +1 -1
- package/dist/effect/Schedule.d.ts +1 -1
- package/dist/effect/Schedule.d.ts.map +1 -1
- package/dist/effect/Schedule.js +2 -2
- package/dist/effect/Schedule.js.map +1 -1
- package/dist/effect/Schema/debug-diff.d.ts +1 -1
- package/dist/effect/Schema/debug-diff.d.ts.map +1 -1
- package/dist/effect/Schema/debug-diff.js +5 -7
- package/dist/effect/Schema/debug-diff.js.map +1 -1
- package/dist/effect/Schema/debug-diff.test.js +7 -4
- package/dist/effect/Schema/debug-diff.test.js.map +1 -1
- package/dist/effect/Schema/index.d.ts +28 -20
- package/dist/effect/Schema/index.d.ts.map +1 -1
- package/dist/effect/Schema/index.js +55 -28
- package/dist/effect/Schema/index.js.map +1 -1
- package/dist/effect/Stream.d.ts +13 -5
- package/dist/effect/Stream.d.ts.map +1 -1
- package/dist/effect/Stream.js +19 -12
- package/dist/effect/Stream.js.map +1 -1
- package/dist/effect/Stream.test.js +9 -9
- package/dist/effect/Stream.test.js.map +1 -1
- package/dist/effect/Subscribable.d.ts +9 -3
- package/dist/effect/Subscribable.d.ts.map +1 -1
- package/dist/effect/Subscribable.js +20 -35
- package/dist/effect/Subscribable.js.map +1 -1
- package/dist/effect/SubscriptionRef.d.ts +5 -6
- package/dist/effect/SubscriptionRef.d.ts.map +1 -1
- package/dist/effect/SubscriptionRef.js +2 -3
- package/dist/effect/SubscriptionRef.js.map +1 -1
- package/dist/effect/TaskTracing.d.ts +1 -1
- package/dist/effect/TaskTracing.d.ts.map +1 -1
- package/dist/effect/TaskTracing.js +12 -16
- package/dist/effect/TaskTracing.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.d.ts +7 -7
- package/dist/effect/WebChannel/WebChannel.d.ts.map +1 -1
- package/dist/effect/WebChannel/WebChannel.js +64 -43
- package/dist/effect/WebChannel/WebChannel.js.map +1 -1
- package/dist/effect/WebChannel/WebChannel.test.js +15 -15
- package/dist/effect/WebChannel/WebChannel.test.js.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.d.ts.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.js +16 -9
- package/dist/effect/WebChannel/broadcastChannelWithAck.js.map +1 -1
- package/dist/effect/WebChannel/common.d.ts +16 -17
- package/dist/effect/WebChannel/common.d.ts.map +1 -1
- package/dist/effect/WebChannel/common.js +6 -6
- package/dist/effect/WebChannel/common.js.map +1 -1
- package/dist/effect/WebSocket.d.ts +4 -6
- package/dist/effect/WebSocket.d.ts.map +1 -1
- package/dist/effect/WebSocket.js +4 -4
- package/dist/effect/WebSocket.js.map +1 -1
- package/dist/effect/WebSocket.test.js +2 -2
- package/dist/effect/WebSocket.test.js.map +1 -1
- package/dist/effect/mod.browser-build.test.d.ts +2 -0
- package/dist/effect/mod.browser-build.test.d.ts.map +1 -0
- package/dist/effect/mod.browser-build.test.js +18 -0
- package/dist/effect/mod.browser-build.test.js.map +1 -0
- package/dist/effect/mod.d.ts +13 -15
- package/dist/effect/mod.d.ts.map +1 -1
- package/dist/effect/mod.js +13 -18
- package/dist/effect/mod.js.map +1 -1
- package/dist/effect/spanEvent.d.ts.map +1 -1
- package/dist/effect/spanEvent.js +2 -2
- package/dist/effect/spanEvent.js.map +1 -1
- package/dist/effect/spanEvent.test.js +10 -13
- package/dist/effect/spanEvent.test.js.map +1 -1
- package/dist/fast-deep-equal.d.ts.map +1 -1
- package/dist/fast-deep-equal.js +1 -2
- package/dist/fast-deep-equal.js.map +1 -1
- package/dist/misc.js +2 -2
- package/dist/misc.js.map +1 -1
- package/dist/mod.d.ts +0 -35
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +0 -8
- package/dist/mod.js.map +1 -1
- package/dist/node/mod.d.ts +17 -11
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +23 -16
- package/dist/node/mod.js.map +1 -1
- package/dist/object/index.d.ts +0 -9
- package/dist/object/index.d.ts.map +1 -1
- package/dist/object/index.js +0 -9
- package/dist/object/index.js.map +1 -1
- package/dist/string.d.ts +0 -2
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +0 -2
- package/dist/string.js.map +1 -1
- package/package.json +18 -36
- package/src/NoopTracer.test.ts +20 -0
- package/src/NoopTracer.ts +18 -41
- package/src/browser/Opfs/Opfs.ts +304 -277
- package/src/browser/Opfs/debug-utils.ts +7 -6
- package/src/browser/Opfs/utils.ts +36 -26
- package/src/browser/QuotaExceededError.ts +13 -10
- package/src/browser/WebChannelBrowser.ts +25 -11
- package/src/browser/WebError.test.ts +6 -6
- package/src/browser/WebError.ts +107 -133
- package/src/browser/WebLock.ts +13 -14
- package/src/effect/Debug.ts +66 -59
- package/src/effect/Effect.test.ts +117 -0
- package/src/effect/Effect.ts +84 -71
- package/src/effect/Logger.ts +0 -48
- package/src/effect/OtelTracer.ts +2 -3
- package/src/effect/RpcClient.ts +80 -61
- package/src/effect/Schedule.ts +4 -5
- package/src/effect/Schema/debug-diff.test.ts +6 -6
- package/src/effect/Schema/debug-diff.ts +6 -8
- package/src/effect/Schema/index.ts +122 -61
- package/src/effect/Stream.test.ts +9 -9
- package/src/effect/Stream.ts +23 -16
- package/src/effect/Subscribable.ts +31 -42
- package/src/effect/SubscriptionRef.ts +8 -12
- package/src/effect/TaskTracing.ts +13 -16
- package/src/effect/WebChannel/WebChannel.test.ts +23 -23
- package/src/effect/WebChannel/WebChannel.ts +87 -55
- package/src/effect/WebChannel/broadcastChannelWithAck.ts +21 -11
- package/src/effect/WebChannel/common.ts +14 -15
- package/src/effect/WebSocket.test.ts +2 -2
- package/src/effect/WebSocket.ts +9 -6
- package/src/effect/mod.browser-build.test.ts +19 -0
- package/src/effect/mod.ts +35 -69
- package/src/effect/spanEvent.test.ts +10 -13
- package/src/effect/spanEvent.ts +5 -3
- package/src/fast-deep-equal.ts +1 -2
- package/src/misc.ts +2 -2
- package/src/mod.ts +0 -36
- package/src/node/mod.ts +26 -20
- package/src/object/index.ts +0 -24
- package/src/string.ts +0 -3
- package/dist/effect/BucketQueue.d.ts +0 -20
- package/dist/effect/BucketQueue.d.ts.map +0 -1
- package/dist/effect/BucketQueue.js +0 -34
- package/dist/effect/BucketQueue.js.map +0 -1
- package/dist/effect/Scheduler.d.ts +0 -4
- package/dist/effect/Scheduler.d.ts.map +0 -1
- package/dist/effect/Scheduler.js +0 -9
- package/dist/effect/Scheduler.js.map +0 -1
- package/dist/effect/ServiceContext.d.ts +0 -37
- package/dist/effect/ServiceContext.d.ts.map +0 -1
- package/dist/effect/ServiceContext.js +0 -55
- package/dist/effect/ServiceContext.js.map +0 -1
- package/dist/guards.d.ts +0 -20
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -20
- package/dist/guards.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts +0 -4
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js +0 -128
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts +0 -10
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js +0 -217
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts +0 -84
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js +0 -68
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts +0 -2
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js +0 -52
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts +0 -23
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts.map +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js +0 -138
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js.map +0 -1
- package/dist/object/omit.d.ts +0 -3
- package/dist/object/omit.d.ts.map +0 -1
- package/dist/object/omit.js +0 -14
- package/dist/object/omit.js.map +0 -1
- package/dist/object/pick.d.ts +0 -14
- package/dist/object/pick.d.ts.map +0 -1
- package/dist/object/pick.js +0 -17
- package/dist/object/pick.js.map +0 -1
- package/dist/time.d.ts +0 -12
- package/dist/time.d.ts.map +0 -1
- package/dist/time.js +0 -22
- package/dist/time.js.map +0 -1
- package/src/effect/BucketQueue.ts +0 -49
- package/src/effect/Scheduler.ts +0 -13
- package/src/effect/ServiceContext.ts +0 -108
- package/src/guards.ts +0 -23
- package/src/node/ChildProcessRunner/ChildProcessRunner.ts +0 -148
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.ts +0 -311
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/schema.ts +0 -78
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.ts +0 -65
- package/src/node/ChildProcessRunner/ChildProcessWorker.ts +0 -169
- package/src/object/omit.ts +0 -17
- package/src/object/pick.ts +0 -27
- package/src/time.ts +0 -25
|
@@ -21,15 +21,13 @@ declare const TypeId: "~@livestore/utils/WebError";
|
|
|
21
21
|
* })
|
|
22
22
|
*
|
|
23
23
|
* console.log(WebError.isWebError(someError)) // false
|
|
24
|
-
* console.log(WebError.isWebError(webError))
|
|
24
|
+
* console.log(WebError.isWebError(webError)) // true
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export declare const isWebError: (u: unknown) => u is WebError;
|
|
28
|
-
declare const EvalError_base: Schema.
|
|
29
|
-
readonly
|
|
30
|
-
}
|
|
31
|
-
cause: Schema.instanceOf<Error>;
|
|
32
|
-
}>;
|
|
28
|
+
declare const EvalError_base: Schema.Class<EvalError, Schema.TaggedStruct<"EvalError", {
|
|
29
|
+
readonly cause: Schema.instanceOf<Error, unknown>;
|
|
30
|
+
}>, import("effect/Cause").YieldableError>;
|
|
33
31
|
/**
|
|
34
32
|
* Error for the web standard "EvalError" simple exception.
|
|
35
33
|
*
|
|
@@ -41,11 +39,9 @@ declare const EvalError_base: Schema.TaggedErrorClass<EvalError, "EvalError", {
|
|
|
41
39
|
export declare class EvalError extends EvalError_base {
|
|
42
40
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
43
41
|
}
|
|
44
|
-
declare const RangeError_base: Schema.
|
|
45
|
-
readonly
|
|
46
|
-
}
|
|
47
|
-
cause: Schema.instanceOf<Error>;
|
|
48
|
-
}>;
|
|
42
|
+
declare const RangeError_base: Schema.Class<RangeError, Schema.TaggedStruct<"RangeError", {
|
|
43
|
+
readonly cause: Schema.instanceOf<Error, unknown>;
|
|
44
|
+
}>, import("effect/Cause").YieldableError>;
|
|
49
45
|
/**
|
|
50
46
|
* Error for the web standard "RangeError" simple exception.
|
|
51
47
|
*
|
|
@@ -57,11 +53,9 @@ declare const RangeError_base: Schema.TaggedErrorClass<RangeError, "RangeError",
|
|
|
57
53
|
export declare class RangeError extends RangeError_base {
|
|
58
54
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
59
55
|
}
|
|
60
|
-
declare const ReferenceError_base: Schema.
|
|
61
|
-
readonly
|
|
62
|
-
}
|
|
63
|
-
cause: Schema.instanceOf<Error>;
|
|
64
|
-
}>;
|
|
56
|
+
declare const ReferenceError_base: Schema.Class<ReferenceError, Schema.TaggedStruct<"ReferenceError", {
|
|
57
|
+
readonly cause: Schema.instanceOf<Error, unknown>;
|
|
58
|
+
}>, import("effect/Cause").YieldableError>;
|
|
65
59
|
/**
|
|
66
60
|
* Error for the web standard "ReferenceError" simple exception.
|
|
67
61
|
*
|
|
@@ -73,11 +67,9 @@ declare const ReferenceError_base: Schema.TaggedErrorClass<ReferenceError, "Refe
|
|
|
73
67
|
export declare class ReferenceError extends ReferenceError_base {
|
|
74
68
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
75
69
|
}
|
|
76
|
-
declare const TypeError_base: Schema.
|
|
77
|
-
readonly
|
|
78
|
-
}
|
|
79
|
-
cause: Schema.instanceOf<Error>;
|
|
80
|
-
}>;
|
|
70
|
+
declare const TypeError_base: Schema.Class<TypeError, Schema.TaggedStruct<"TypeError", {
|
|
71
|
+
readonly cause: Schema.instanceOf<Error, unknown>;
|
|
72
|
+
}>, import("effect/Cause").YieldableError>;
|
|
81
73
|
/**
|
|
82
74
|
* Error for the web standard "TypeError" simple exception.
|
|
83
75
|
*
|
|
@@ -89,11 +81,9 @@ declare const TypeError_base: Schema.TaggedErrorClass<TypeError, "TypeError", {
|
|
|
89
81
|
export declare class TypeError extends TypeError_base {
|
|
90
82
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
91
83
|
}
|
|
92
|
-
declare const URIError_base: Schema.
|
|
93
|
-
readonly
|
|
94
|
-
}
|
|
95
|
-
cause: Schema.instanceOf<Error>;
|
|
96
|
-
}>;
|
|
84
|
+
declare const URIError_base: Schema.Class<URIError, Schema.TaggedStruct<"URIError", {
|
|
85
|
+
readonly cause: Schema.instanceOf<Error, unknown>;
|
|
86
|
+
}>, import("effect/Cause").YieldableError>;
|
|
97
87
|
/**
|
|
98
88
|
* Error for the web standard "URIError" simple exception.
|
|
99
89
|
*
|
|
@@ -105,11 +95,9 @@ declare const URIError_base: Schema.TaggedErrorClass<URIError, "URIError", {
|
|
|
105
95
|
export declare class URIError extends URIError_base {
|
|
106
96
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
107
97
|
}
|
|
108
|
-
declare const QuotaExceededError_base: Schema.
|
|
109
|
-
readonly
|
|
110
|
-
}
|
|
111
|
-
cause: Schema.Union<[Schema.instanceOf<globalThis.QuotaExceededError> | typeof Schema.Never, Schema.filter<Schema.instanceOf<DOMException>>]>;
|
|
112
|
-
}>;
|
|
98
|
+
declare const QuotaExceededError_base: Schema.Class<QuotaExceededError, Schema.TaggedStruct<"QuotaExceededError", {
|
|
99
|
+
readonly cause: Schema.Union<readonly [Schema.instanceOf<globalThis.QuotaExceededError, unknown> | Schema.Never, Schema.instanceOf<DOMException, DOMException>]>;
|
|
100
|
+
}>, import("effect/Cause").YieldableError>;
|
|
113
101
|
/**
|
|
114
102
|
* Error for the web standard "QuotaExceededError" DOMException-derived error.
|
|
115
103
|
*
|
|
@@ -122,11 +110,9 @@ export declare class QuotaExceededError extends QuotaExceededError_base {
|
|
|
122
110
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
123
111
|
get message(): string;
|
|
124
112
|
}
|
|
125
|
-
declare const NoModificationAllowedError_base: Schema.
|
|
126
|
-
readonly
|
|
127
|
-
}
|
|
128
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
129
|
-
}>;
|
|
113
|
+
declare const NoModificationAllowedError_base: Schema.Class<NoModificationAllowedError, Schema.TaggedStruct<"NoModificationAllowedError", {
|
|
114
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
115
|
+
}>, import("effect/Cause").YieldableError>;
|
|
130
116
|
/**
|
|
131
117
|
* Error for the web standard "NoModificationAllowedError" DOMException.
|
|
132
118
|
*
|
|
@@ -139,11 +125,9 @@ export declare class NoModificationAllowedError extends NoModificationAllowedErr
|
|
|
139
125
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
140
126
|
get message(): string;
|
|
141
127
|
}
|
|
142
|
-
declare const NotFoundError_base: Schema.
|
|
143
|
-
readonly
|
|
144
|
-
}
|
|
145
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
146
|
-
}>;
|
|
128
|
+
declare const NotFoundError_base: Schema.Class<NotFoundError, Schema.TaggedStruct<"NotFoundError", {
|
|
129
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
130
|
+
}>, import("effect/Cause").YieldableError>;
|
|
147
131
|
/**
|
|
148
132
|
* Error for the web standard "NotFoundError" DOMException
|
|
149
133
|
*
|
|
@@ -156,11 +140,9 @@ export declare class NotFoundError extends NotFoundError_base {
|
|
|
156
140
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
157
141
|
get message(): string;
|
|
158
142
|
}
|
|
159
|
-
declare const NotAllowedError_base: Schema.
|
|
160
|
-
readonly
|
|
161
|
-
}
|
|
162
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
163
|
-
}>;
|
|
143
|
+
declare const NotAllowedError_base: Schema.Class<NotAllowedError, Schema.TaggedStruct<"NotAllowedError", {
|
|
144
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
145
|
+
}>, import("effect/Cause").YieldableError>;
|
|
164
146
|
/**
|
|
165
147
|
* Error for the web standard "NotAllowedError" DOMException
|
|
166
148
|
*
|
|
@@ -173,11 +155,9 @@ export declare class NotAllowedError extends NotAllowedError_base {
|
|
|
173
155
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
174
156
|
get message(): string;
|
|
175
157
|
}
|
|
176
|
-
declare const TypeMismatchError_base: Schema.
|
|
177
|
-
readonly
|
|
178
|
-
}
|
|
179
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
180
|
-
}>;
|
|
158
|
+
declare const TypeMismatchError_base: Schema.Class<TypeMismatchError, Schema.TaggedStruct<"TypeMismatchError", {
|
|
159
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
160
|
+
}>, import("effect/Cause").YieldableError>;
|
|
181
161
|
/**
|
|
182
162
|
* Error for the web standard "TypeMismatchError" DOMException.
|
|
183
163
|
*
|
|
@@ -190,11 +170,9 @@ export declare class TypeMismatchError extends TypeMismatchError_base {
|
|
|
190
170
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
191
171
|
get message(): string;
|
|
192
172
|
}
|
|
193
|
-
declare const InvalidStateError_base: Schema.
|
|
194
|
-
readonly
|
|
195
|
-
}
|
|
196
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
197
|
-
}>;
|
|
173
|
+
declare const InvalidStateError_base: Schema.Class<InvalidStateError, Schema.TaggedStruct<"InvalidStateError", {
|
|
174
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
175
|
+
}>, import("effect/Cause").YieldableError>;
|
|
198
176
|
/**
|
|
199
177
|
* Error for the web standard "InvalidStateError" DOMException.
|
|
200
178
|
*
|
|
@@ -207,11 +185,9 @@ export declare class InvalidStateError extends InvalidStateError_base {
|
|
|
207
185
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
208
186
|
get message(): string;
|
|
209
187
|
}
|
|
210
|
-
declare const AbortError_base: Schema.
|
|
211
|
-
readonly
|
|
212
|
-
}
|
|
213
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
214
|
-
}>;
|
|
188
|
+
declare const AbortError_base: Schema.Class<AbortError, Schema.TaggedStruct<"AbortError", {
|
|
189
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
190
|
+
}>, import("effect/Cause").YieldableError>;
|
|
215
191
|
/**
|
|
216
192
|
* Error for the web standard "AbortError" DOMException.
|
|
217
193
|
*
|
|
@@ -224,11 +200,9 @@ export declare class AbortError extends AbortError_base {
|
|
|
224
200
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
225
201
|
get message(): string;
|
|
226
202
|
}
|
|
227
|
-
declare const InvalidModificationError_base: Schema.
|
|
228
|
-
readonly
|
|
229
|
-
}
|
|
230
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
231
|
-
}>;
|
|
203
|
+
declare const InvalidModificationError_base: Schema.Class<InvalidModificationError, Schema.TaggedStruct<"InvalidModificationError", {
|
|
204
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
205
|
+
}>, import("effect/Cause").YieldableError>;
|
|
232
206
|
/**
|
|
233
207
|
* Error for the web standard "InvalidModificationError" DOMException.
|
|
234
208
|
*
|
|
@@ -241,11 +215,9 @@ export declare class InvalidModificationError extends InvalidModificationError_b
|
|
|
241
215
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
242
216
|
get message(): string;
|
|
243
217
|
}
|
|
244
|
-
declare const SecurityError_base: Schema.
|
|
245
|
-
readonly
|
|
246
|
-
}
|
|
247
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
248
|
-
}>;
|
|
218
|
+
declare const SecurityError_base: Schema.Class<SecurityError, Schema.TaggedStruct<"SecurityError", {
|
|
219
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
220
|
+
}>, import("effect/Cause").YieldableError>;
|
|
249
221
|
/**
|
|
250
222
|
* Error for the web standard "SecurityError" DOMException.
|
|
251
223
|
*
|
|
@@ -258,11 +230,9 @@ export declare class SecurityError extends SecurityError_base {
|
|
|
258
230
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
259
231
|
get message(): string;
|
|
260
232
|
}
|
|
261
|
-
declare const DataCloneError_base: Schema.
|
|
262
|
-
readonly
|
|
263
|
-
}
|
|
264
|
-
cause: Schema.filter<Schema.instanceOf<DOMException>>;
|
|
265
|
-
}>;
|
|
233
|
+
declare const DataCloneError_base: Schema.Class<DataCloneError, Schema.TaggedStruct<"DataCloneError", {
|
|
234
|
+
readonly cause: Schema.instanceOf<DOMException, DOMException>;
|
|
235
|
+
}>, import("effect/Cause").YieldableError>;
|
|
266
236
|
/**
|
|
267
237
|
* Error for the web standard "DataCloneError" DOMException.
|
|
268
238
|
*
|
|
@@ -275,14 +245,12 @@ export declare class DataCloneError extends DataCloneError_base {
|
|
|
275
245
|
readonly [TypeId]: "~@livestore/utils/WebError";
|
|
276
246
|
get message(): string;
|
|
277
247
|
}
|
|
278
|
-
declare const UnknownError_base: Schema.
|
|
279
|
-
readonly
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
cause: Schema.optional<typeof Schema.Defect>;
|
|
285
|
-
}>;
|
|
248
|
+
declare const UnknownError_base: Schema.Class<UnknownError, Schema.TaggedStruct<"UnknownError", {
|
|
249
|
+
readonly module: Schema.optional<Schema.String>;
|
|
250
|
+
readonly method: Schema.optional<Schema.String>;
|
|
251
|
+
readonly description: Schema.optional<Schema.String>;
|
|
252
|
+
readonly cause: Schema.optional<Schema.Defect>;
|
|
253
|
+
}>, import("effect/Cause").YieldableError>;
|
|
286
254
|
/**
|
|
287
255
|
* Catch-all error for unexpected runtime errors in web environments.
|
|
288
256
|
*
|
|
@@ -415,7 +383,7 @@ type WebErrorConstructor = (typeof WebError.members)[number];
|
|
|
415
383
|
* // anyError is typed as WebError (all possible error types)
|
|
416
384
|
* ```
|
|
417
385
|
*/
|
|
418
|
-
export declare function
|
|
419
|
-
export declare function
|
|
386
|
+
export declare function classifyWebError(value: unknown): WebError;
|
|
387
|
+
export declare function classifyWebError<BECs extends readonly WebErrorConstructor[]>(value: unknown, expected: BECs): InstanceType<BECs[number]> | UnknownError;
|
|
420
388
|
export {};
|
|
421
389
|
//# sourceMappingURL=WebError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebError.d.ts","sourceRoot":"","sources":["../../src/browser/WebError.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"WebError.d.ts","sourceRoot":"","sources":["../../src/browser/WebError.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAChC,OAAO,EAAa,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE1C;;GAEG;AACH,QAAA,MAAM,MAAM,EAAG,4BAAqC,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,QAA4C,CAAA;;;;AASzF;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,cAE7B;IACA,QAAQ,CAAC,CAAC,MAAM,CAAC,+BAAS;CAC3B;;;;AAED;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,eAE9B;IACA,QAAQ,CAAC,CAAC,MAAM,CAAC,+BAAS;CAC3B;;;;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,mBAElC;IACA,QAAQ,CAAC,CAAC,MAAM,CAAC,+BAAS;CAC3B;;;;AAED;;;;;;;GAOG;AACH,qBAAa,SAAU,SAAQ,cAE7B;IACA,QAAQ,CAAC,CAAC,MAAM,CAAC,+BAAS;CAC3B;;;;AAED;;;;;;;GAOG;AACH,qBAAa,QAAS,SAAQ,aAE5B;IACA,QAAQ,CAAC,CAAC,MAAM,CAAC,+BAAS;CAC3B;;;;AAkBD;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,uBAWvC;IACC,QAAQ,CAAC,CA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AS,mBAAmB,EAAE,EAC1E,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,IAAI,GACb,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,YAAY,CAAA"}
|
package/dist/browser/WebError.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./QuotaExceededError.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Predicate, Schema } from 'effect';
|
|
3
3
|
/**
|
|
4
4
|
* Unique identifier for web errors.
|
|
5
5
|
*/
|
|
@@ -21,7 +21,7 @@ const TypeId = '~@livestore/utils/WebError';
|
|
|
21
21
|
* })
|
|
22
22
|
*
|
|
23
23
|
* console.log(WebError.isWebError(someError)) // false
|
|
24
|
-
* console.log(WebError.isWebError(webError))
|
|
24
|
+
* console.log(WebError.isWebError(webError)) // true
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export const isWebError = (u) => Predicate.hasProperty(u, TypeId);
|
|
@@ -102,9 +102,9 @@ export class URIError extends Schema.TaggedError(`${TypeId}/URIError`)('URIError
|
|
|
102
102
|
//
|
|
103
103
|
// [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/DOMException)
|
|
104
104
|
// [Specification](https://webidl.spec.whatwg.org/#idl-DOMException-derived-predefineds)
|
|
105
|
-
const domExceptionWithName = (expectedName) => Schema.instanceOf(DOMException).
|
|
106
|
-
|
|
107
|
-
}
|
|
105
|
+
const domExceptionWithName = (expectedName) => Schema.instanceOf(DOMException).check(Schema.makeFilter((domException) => domException.name === expectedName
|
|
106
|
+
? undefined
|
|
107
|
+
: `Expected DOMException with name "${expectedName}", got "${domException.name}"`));
|
|
108
108
|
/**
|
|
109
109
|
* Error for the web standard "QuotaExceededError" DOMException-derived error.
|
|
110
110
|
*
|
|
@@ -114,11 +114,13 @@ const domExceptionWithName = (expectedName) => Schema.instanceOf(DOMException).p
|
|
|
114
114
|
* @see {@link https://webidl.spec.whatwg.org/#quotaexceedederror | Specification}
|
|
115
115
|
*/
|
|
116
116
|
export class QuotaExceededError extends Schema.TaggedError(`${TypeId}/QuotaExceededError`)('QuotaExceededError', {
|
|
117
|
-
cause: Schema.Union(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
cause: Schema.Union([
|
|
118
|
+
typeof globalThis.QuotaExceededError === 'function'
|
|
119
|
+
? Schema.instanceOf(globalThis.QuotaExceededError)
|
|
120
|
+
: Schema.Never,
|
|
121
|
+
// Deprecated but still in use in some browsers
|
|
122
|
+
domExceptionWithName('QuotaExceededError'),
|
|
123
|
+
]),
|
|
122
124
|
}) {
|
|
123
125
|
[TypeId] = TypeId;
|
|
124
126
|
get message() {
|
|
@@ -317,7 +319,7 @@ export class UnknownError extends Schema.TaggedError(`${TypeId}/UnknownError`)('
|
|
|
317
319
|
module: Schema.optional(Schema.String),
|
|
318
320
|
method: Schema.optional(Schema.String),
|
|
319
321
|
description: Schema.optional(Schema.String),
|
|
320
|
-
cause: Schema.optional(Schema.Defect),
|
|
322
|
+
cause: Schema.optional(Schema.Defect()),
|
|
321
323
|
}) {
|
|
322
324
|
[TypeId] = TypeId;
|
|
323
325
|
get message() {
|
|
@@ -335,82 +337,87 @@ export class UnknownError extends Schema.TaggedError(`${TypeId}/UnknownError`)('
|
|
|
335
337
|
* errors, ensuring type safety when handling errors from external sources or
|
|
336
338
|
* serialized data.
|
|
337
339
|
*/
|
|
338
|
-
export const WebError = Schema.Union(
|
|
339
|
-
// Simple Exception Errors
|
|
340
|
-
EvalError,
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
//
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (value instanceof globalThis.RangeError)
|
|
363
|
-
return new RangeError({ cause: value });
|
|
364
|
-
if (value instanceof globalThis.ReferenceError)
|
|
365
|
-
return new ReferenceError({ cause: value });
|
|
366
|
-
if (value instanceof globalThis.TypeError)
|
|
367
|
-
return new TypeError({ cause: value });
|
|
368
|
-
if (value instanceof globalThis.URIError)
|
|
369
|
-
return new URIError({ cause: value });
|
|
370
|
-
// Predefined DOMException Errors
|
|
371
|
-
if (typeof globalThis.QuotaExceededError === 'function' && value instanceof globalThis.QuotaExceededError) {
|
|
372
|
-
return new QuotaExceededError({ cause: value });
|
|
373
|
-
}
|
|
374
|
-
// Base DOMException Errors
|
|
375
|
-
if (value instanceof DOMException) {
|
|
376
|
-
switch (value.name) {
|
|
377
|
-
case 'QuotaExceededError':
|
|
378
|
-
return new QuotaExceededError({ cause: value });
|
|
379
|
-
case 'NoModificationAllowedError':
|
|
380
|
-
return new NoModificationAllowedError({ cause: value });
|
|
381
|
-
case 'NotFoundError':
|
|
382
|
-
return new NotFoundError({ cause: value });
|
|
383
|
-
case 'NotAllowedError':
|
|
384
|
-
return new NotAllowedError({ cause: value });
|
|
385
|
-
case 'TypeMismatchError':
|
|
386
|
-
return new TypeMismatchError({ cause: value });
|
|
387
|
-
case 'InvalidStateError':
|
|
388
|
-
return new InvalidStateError({ cause: value });
|
|
389
|
-
case 'AbortError':
|
|
390
|
-
return new AbortError({ cause: value });
|
|
391
|
-
case 'InvalidModificationError':
|
|
392
|
-
return new InvalidModificationError({ cause: value });
|
|
393
|
-
case 'SecurityError':
|
|
394
|
-
return new SecurityError({ cause: value });
|
|
395
|
-
case 'DataCloneError':
|
|
396
|
-
return new DataCloneError({ cause: value });
|
|
397
|
-
default:
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
if (value instanceof Error)
|
|
402
|
-
return new UnknownError({ description: value.message, cause: value });
|
|
403
|
-
return new UnknownError({ cause: value });
|
|
404
|
-
},
|
|
405
|
-
encode: (webError) => webError,
|
|
406
|
-
});
|
|
407
|
-
export function parseWebError(value, expected = []) {
|
|
408
|
-
const parsed = Schema.decodeUnknownSync(WebErrorFromUnknown)(value);
|
|
340
|
+
export const WebError = Schema.Union([
|
|
341
|
+
// Simple Exception Errors
|
|
342
|
+
EvalError,
|
|
343
|
+
RangeError,
|
|
344
|
+
ReferenceError,
|
|
345
|
+
TypeError,
|
|
346
|
+
URIError,
|
|
347
|
+
// Predefined DOMException Errors
|
|
348
|
+
QuotaExceededError,
|
|
349
|
+
// Base DOMException Errors
|
|
350
|
+
NoModificationAllowedError,
|
|
351
|
+
NotFoundError,
|
|
352
|
+
NotAllowedError,
|
|
353
|
+
TypeMismatchError,
|
|
354
|
+
InvalidStateError,
|
|
355
|
+
AbortError,
|
|
356
|
+
InvalidModificationError,
|
|
357
|
+
SecurityError,
|
|
358
|
+
DataCloneError,
|
|
359
|
+
// Custom Errors
|
|
360
|
+
UnknownError,
|
|
361
|
+
]);
|
|
362
|
+
export function classifyWebError(value, expected = []) {
|
|
363
|
+
const parsed = parseWebError(value);
|
|
409
364
|
if (expected.length === 0)
|
|
410
365
|
return parsed;
|
|
411
|
-
|
|
412
|
-
if (expectedTags.has(parsed._tag) === true)
|
|
366
|
+
if (expected.some((ErrorConstructor) => parsed instanceof ErrorConstructor) === true)
|
|
413
367
|
return parsed;
|
|
414
368
|
return parsed instanceof UnknownError ? parsed : new UnknownError({ cause: parsed });
|
|
415
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Converts web-native exception shapes to LiveStore's `WebError`
|
|
372
|
+
* classes while preserving the original value as `cause`.
|
|
373
|
+
*/
|
|
374
|
+
const parseWebError = (cause) => {
|
|
375
|
+
if (isWebError(cause) === true)
|
|
376
|
+
return cause;
|
|
377
|
+
// Simple Exception Errors
|
|
378
|
+
if (cause instanceof globalThis.EvalError)
|
|
379
|
+
return new EvalError({ cause: cause });
|
|
380
|
+
if (cause instanceof globalThis.RangeError)
|
|
381
|
+
return new RangeError({ cause: cause });
|
|
382
|
+
if (cause instanceof globalThis.ReferenceError)
|
|
383
|
+
return new ReferenceError({ cause: cause });
|
|
384
|
+
if (cause instanceof globalThis.TypeError)
|
|
385
|
+
return new TypeError({ cause: cause });
|
|
386
|
+
if (cause instanceof globalThis.URIError)
|
|
387
|
+
return new URIError({ cause: cause });
|
|
388
|
+
// Predefined DOMException Errors
|
|
389
|
+
if (typeof globalThis.QuotaExceededError === 'function' && cause instanceof globalThis.QuotaExceededError) {
|
|
390
|
+
return new QuotaExceededError({ cause: cause });
|
|
391
|
+
}
|
|
392
|
+
// Base DOMException Errors
|
|
393
|
+
if (cause instanceof DOMException) {
|
|
394
|
+
switch (cause.name) {
|
|
395
|
+
case 'QuotaExceededError':
|
|
396
|
+
return new QuotaExceededError({ cause: cause });
|
|
397
|
+
case 'NoModificationAllowedError':
|
|
398
|
+
return new NoModificationAllowedError({ cause: cause });
|
|
399
|
+
case 'NotFoundError':
|
|
400
|
+
return new NotFoundError({ cause: cause });
|
|
401
|
+
case 'NotAllowedError':
|
|
402
|
+
return new NotAllowedError({ cause: cause });
|
|
403
|
+
case 'TypeMismatchError':
|
|
404
|
+
return new TypeMismatchError({ cause: cause });
|
|
405
|
+
case 'InvalidStateError':
|
|
406
|
+
return new InvalidStateError({ cause: cause });
|
|
407
|
+
case 'AbortError':
|
|
408
|
+
return new AbortError({ cause: cause });
|
|
409
|
+
case 'InvalidModificationError':
|
|
410
|
+
return new InvalidModificationError({ cause: cause });
|
|
411
|
+
case 'SecurityError':
|
|
412
|
+
return new SecurityError({ cause: cause });
|
|
413
|
+
case 'DataCloneError':
|
|
414
|
+
return new DataCloneError({ cause: cause });
|
|
415
|
+
default:
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (cause instanceof Error)
|
|
420
|
+
return new UnknownError({ description: cause.message, cause: cause });
|
|
421
|
+
return new UnknownError({ cause: cause });
|
|
422
|
+
};
|
|
416
423
|
//# sourceMappingURL=WebError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebError.js","sourceRoot":"","sources":["../../src/browser/WebError.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"WebError.js","sourceRoot":"","sources":["../../src/browser/WebError.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE1C;;GAEG;AACH,MAAM,MAAM,GAAG,4BAAqC,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAU,EAAiB,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;AAEzF,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAC/E,EAAE;AACF,+HAA+H;AAC/H,wEAAwE;AAExE;;;;;;;GAOG;AACH,MAAM,OAAO,SAAU,SAAQ,MAAM,CAAC,WAAW,CAAY,GAAG,MAAM,YAAY,CAAC,CAAC,WAAW,EAAE;IAC/F,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC;CAC/C,CAAC;IACS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,CAAa,GAAG,MAAM,aAAa,CAAC,CAAC,YAAY,EAAE;IACnG,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC;CAChD,CAAC;IACS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,CAAiB,GAAG,MAAM,iBAAiB,CAAC,CAAC,gBAAgB,EAAE;IACnH,KAAK,EAAE,MAAM,CAAC,UAAU,C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AI,0BAA0B,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YACzD,KAAK,eAAe;gBAClB,OAAO,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC5C,KAAK,iBAAiB;gBACpB,OAAO,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC9C,KAAK,mBAAmB;gBACtB,OAAO,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAChD,KAAK,mBAAmB;gBACtB,OAAO,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAChD,KAAK,YAAY;gBACf,OAAO,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YACzC,KAAK,0BAA0B;gBAC7B,OAAO,IAAI,wBAAwB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YACvD,KAAK,eAAe;gBAClB,OAAO,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC5C,KAAK,gBAAgB;gBACnB,OAAO,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YAC7C;gBACE,MAAK;QACT,CAAC;IACH,CAAC;IAED,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,IAAI,YAAY,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAEjG,OAAO,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
|
@@ -4,38 +4,38 @@ Vitest.describe('parseWebError', () => {
|
|
|
4
4
|
Vitest.it('returns a WebError instance unchanged when no expectations are provided', () => {
|
|
5
5
|
const domException = new DOMException('missing node', 'NotFoundError');
|
|
6
6
|
const webError = new WebError.NotFoundError({ cause: domException });
|
|
7
|
-
const result = WebError.
|
|
7
|
+
const result = WebError.classifyWebError(webError);
|
|
8
8
|
Vitest.expect(result).toBeInstanceOf(WebError.NotFoundError);
|
|
9
9
|
Vitest.expect(result.cause).toBe(domException);
|
|
10
10
|
});
|
|
11
11
|
Vitest.it('maps native errors to the corresponding WebError when expected', () => {
|
|
12
12
|
const nativeError = new globalThis.TypeError('unsupported type');
|
|
13
|
-
const result = WebError.
|
|
13
|
+
const result = WebError.classifyWebError(nativeError, [WebError.TypeError]);
|
|
14
14
|
Vitest.expect(result).toBeInstanceOf(WebError.TypeError);
|
|
15
15
|
Vitest.expect(result.cause).toBe(nativeError);
|
|
16
16
|
});
|
|
17
17
|
Vitest.it('wraps parsed errors that are not in the expected list in UnknownError', () => {
|
|
18
18
|
const nativeError = new globalThis.RangeError('value out of range');
|
|
19
|
-
const result = WebError.
|
|
19
|
+
const result = WebError.classifyWebError(nativeError, [WebError.TypeError]);
|
|
20
20
|
Vitest.expect(result).toBeInstanceOf(WebError.UnknownError);
|
|
21
21
|
Vitest.expect(result.cause).toBeInstanceOf(WebError.RangeError);
|
|
22
22
|
});
|
|
23
23
|
Vitest.it('translates DOMException names into the matching WebError variant', () => {
|
|
24
24
|
const domException = new DOMException('permission denied', 'NotAllowedError');
|
|
25
|
-
const result = WebError.
|
|
25
|
+
const result = WebError.classifyWebError(domException, [WebError.NotAllowedError]);
|
|
26
26
|
Vitest.expect(result).toBeInstanceOf(WebError.NotAllowedError);
|
|
27
27
|
Vitest.expect(result.cause).toBe(domException);
|
|
28
28
|
});
|
|
29
29
|
Vitest.it('produces UnknownError for non-error values with the default message', () => {
|
|
30
30
|
const value = { reason: 'unexpected' };
|
|
31
|
-
const result = WebError.
|
|
31
|
+
const result = WebError.classifyWebError(value);
|
|
32
32
|
Vitest.expect(result).toBeInstanceOf(WebError.UnknownError);
|
|
33
33
|
Vitest.expect(result.cause).toBeDefined();
|
|
34
34
|
Vitest.expect(result.message).toBe('A web error occurred');
|
|
35
35
|
});
|
|
36
36
|
Vitest.it('returns UnknownError instances without altering their payload when expectations are provided', () => {
|
|
37
37
|
const existing = new WebError.UnknownError({ description: 'pre-parsed' });
|
|
38
|
-
const result = WebError.
|
|
38
|
+
const result = WebError.classifyWebError(existing, [WebError.TypeError]);
|
|
39
39
|
Vitest.expect(result).toBeInstanceOf(WebError.UnknownError);
|
|
40
40
|
if (!(result instanceof WebError.UnknownError)) {
|
|
41
41
|
throw new Error('Expected an UnknownError instance');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebError.test.js","sourceRoot":"","sources":["../../src/browser/WebError.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IACpC,MAAM,CAAC,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACxF,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;QACtE,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAA;QAEpE,MAAM,MAAM,GAAG,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"WebError.test.js","sourceRoot":"","sources":["../../src/browser/WebError.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AAExC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IACpC,MAAM,CAAC,EAAE,CAAC,yEAAyE,EAAE,GAAG,EAAE;QACxF,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;QACtE,MAAM,QAAQ,GAAG,IAA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AAC,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;QAE3D,IAAI,CAAC,CAAC,MAAM,YAAY,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;QACtD,CAAC;QAED,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACtD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebLock.d.ts","sourceRoot":"","sources":["../../src/browser/WebLock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebLock.d.ts","sourceRoot":"","sources":["../../src/browser/WebLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAa,MAAM,QAAQ,CAAA;AAGpD,eAAO,MAAM,QAAQ,GAClB,EAAE,EAAE,iCAIF;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;CACtC,MACA,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,CAiCpE,CAAA;AAEN,eAAO,MAAM,mBAAmB,GAAI,UAAU,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,MAAM,sCAqBnF,CAAA;AAEJ,eAAO,MAAM,kBAAkB,GAAI,UAAU,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,MAAM,yCAsBlF,CAAA;AAEJ,eAAO,MAAM,iBAAiB,GAAI,UAAU,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,MAAM,yCAmBjF,CAAA;AAEJ,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,sCAOxC,CAAA;AAEJ,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,sCA0CnD,CAAA"}
|