@effect/platform-browser 4.0.0-beta.67 → 4.0.0-beta.68
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/BrowserCrypto.d.ts +23 -0
- package/dist/BrowserCrypto.d.ts.map +1 -0
- package/dist/BrowserCrypto.js +61 -0
- package/dist/BrowserCrypto.js.map +1 -0
- package/dist/BrowserHttpClient.d.ts +5 -5
- package/dist/BrowserHttpClient.js +4 -4
- package/dist/BrowserKeyValueStore.d.ts +3 -3
- package/dist/BrowserKeyValueStore.js +3 -3
- package/dist/BrowserSocket.d.ts +2 -2
- package/dist/BrowserSocket.js +2 -2
- package/dist/BrowserWorker.d.ts +2 -2
- package/dist/BrowserWorker.js +2 -2
- package/dist/BrowserWorkerRunner.d.ts +3 -3
- package/dist/BrowserWorkerRunner.js +3 -3
- package/dist/Clipboard.d.ts +5 -5
- package/dist/Clipboard.js +4 -4
- package/dist/Geolocation.d.ts +8 -8
- package/dist/Geolocation.js +6 -6
- package/dist/IndexedDb.d.ts +1 -1
- package/dist/IndexedDb.js +1 -1
- package/dist/IndexedDbQueryBuilder.d.ts +0 -1
- package/dist/IndexedDbQueryBuilder.d.ts.map +1 -1
- package/dist/IndexedDbQueryBuilder.js.map +1 -1
- package/dist/Permissions.d.ts +3 -3
- package/dist/Permissions.js +2 -2
- package/dist/index.d.ts +323 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +323 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/BrowserCrypto.ts +71 -0
- package/src/BrowserHttpClient.ts +5 -5
- package/src/BrowserKeyValueStore.ts +3 -3
- package/src/BrowserSocket.ts +2 -2
- package/src/BrowserWorker.ts +2 -2
- package/src/BrowserWorkerRunner.ts +3 -3
- package/src/Clipboard.ts +5 -5
- package/src/Geolocation.ts +8 -8
- package/src/IndexedDb.ts +1 -1
- package/src/IndexedDbQueryBuilder.ts +0 -1
- package/src/Permissions.ts +3 -3
- package/src/index.ts +324 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser platform implementation of the Crypto service.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Context from "effect/Context";
|
|
7
|
+
import * as EffectCrypto from "effect/Crypto";
|
|
8
|
+
import * as Layer from "effect/Layer";
|
|
9
|
+
/**
|
|
10
|
+
* Browser Web Crypto APIs used by the Crypto service implementation.
|
|
11
|
+
*
|
|
12
|
+
* @category models
|
|
13
|
+
* @since 1.0.0
|
|
14
|
+
*/
|
|
15
|
+
export declare const WebCrypto: Context.Reference<Crypto>;
|
|
16
|
+
/**
|
|
17
|
+
* A layer that directly interfaces with the Web Crypto API.
|
|
18
|
+
*
|
|
19
|
+
* @category layers
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*/
|
|
22
|
+
export declare const layer: Layer.Layer<EffectCrypto.Crypto>;
|
|
23
|
+
//# sourceMappingURL=BrowserCrypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCrypto.d.ts","sourceRoot":"","sources":["../src/BrowserCrypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC;;;;;GAKG;AACH,eAAO,MAAM,SAAS,2BAEpB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CA2ClD,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser platform implementation of the Crypto service.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Context from "effect/Context";
|
|
7
|
+
import * as EffectCrypto from "effect/Crypto";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as PlatformError from "effect/PlatformError";
|
|
11
|
+
/**
|
|
12
|
+
* Browser Web Crypto APIs used by the Crypto service implementation.
|
|
13
|
+
*
|
|
14
|
+
* @category models
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
export const WebCrypto = /*#__PURE__*/Context.Reference("@effect/platform-browser/Crypto/WebCrypto", {
|
|
18
|
+
defaultValue: () => globalThis.crypto
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* A layer that directly interfaces with the Web Crypto API.
|
|
22
|
+
*
|
|
23
|
+
* @category layers
|
|
24
|
+
* @since 1.0.0
|
|
25
|
+
*/
|
|
26
|
+
export const layer = /*#__PURE__*/Layer.effect(EffectCrypto.Crypto, /*#__PURE__*/Effect.gen(function* () {
|
|
27
|
+
const crypto = yield* WebCrypto;
|
|
28
|
+
if (!crypto) {
|
|
29
|
+
return yield* Effect.die(new Error("Web Crypto API is not available"));
|
|
30
|
+
}
|
|
31
|
+
const randomBytes = size => {
|
|
32
|
+
const bytes = new Uint8Array(size);
|
|
33
|
+
crypto.getRandomValues(bytes);
|
|
34
|
+
return bytes;
|
|
35
|
+
};
|
|
36
|
+
const digest = (algorithm, data) => {
|
|
37
|
+
if (typeof crypto.subtle.digest !== "function") {
|
|
38
|
+
return Effect.fail(PlatformError.systemError({
|
|
39
|
+
module: "Crypto",
|
|
40
|
+
method: "digest",
|
|
41
|
+
_tag: "Unknown",
|
|
42
|
+
description: "crypto.subtle.digest is not available"
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
return Effect.map(Effect.tryPromise({
|
|
46
|
+
try: () => crypto.subtle.digest(algorithm, new Uint8Array(data)),
|
|
47
|
+
catch: cause => PlatformError.systemError({
|
|
48
|
+
module: "Crypto",
|
|
49
|
+
method: "digest",
|
|
50
|
+
_tag: "Unknown",
|
|
51
|
+
description: "Could not compute digest",
|
|
52
|
+
cause
|
|
53
|
+
})
|
|
54
|
+
}), buffer => new Uint8Array(buffer));
|
|
55
|
+
};
|
|
56
|
+
return EffectCrypto.make({
|
|
57
|
+
randomBytes,
|
|
58
|
+
digest
|
|
59
|
+
});
|
|
60
|
+
}));
|
|
61
|
+
//# sourceMappingURL=BrowserCrypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCrypto.js","names":["Context","EffectCrypto","Effect","Layer","PlatformError","WebCrypto","Reference","defaultValue","globalThis","crypto","layer","effect","Crypto","gen","die","Error","randomBytes","size","bytes","Uint8Array","getRandomValues","digest","algorithm","data","subtle","fail","systemError","module","method","_tag","description","map","tryPromise","try","catch","cause","buffer","make"],"sources":["../src/BrowserCrypto.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,YAAY,MAAM,eAAe;AAC7C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,aAAa,MAAM,sBAAsB;AAErD;;;;;;AAMA,OAAO,MAAMC,SAAS,gBAAGL,OAAO,CAACM,SAAS,CAAS,2CAA2C,EAAE;EAC9FC,YAAY,EAAEA,CAAA,KAAMC,UAAU,CAACC;CAChC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAMC,KAAK,gBAAqCP,KAAK,CAACQ,MAAM,CACjEV,YAAY,CAACW,MAAM,eACnBV,MAAM,CAACW,GAAG,CAAC,aAAS;EAClB,MAAMJ,MAAM,GAAG,OAAOJ,SAAS;EAC/B,IAAI,CAACI,MAAM,EAAE;IACX,OAAO,OAAOP,MAAM,CAACY,GAAG,CAAC,IAAIC,KAAK,CAAC,iCAAiC,CAAC,CAAC;EACxE;EACA,MAAMC,WAAW,GAAIC,IAAY,IAAgB;IAC/C,MAAMC,KAAK,GAAG,IAAIC,UAAU,CAACF,IAAI,CAAC;IAClCR,MAAM,CAACW,eAAe,CAACF,KAAK,CAAC;IAC7B,OAAOA,KAAK;EACd,CAAC;EAED,MAAMG,MAAM,GAAkCA,CAACC,SAAS,EAAEC,IAAI,KAAI;IAChE,IAAI,OAAOd,MAAM,CAACe,MAAM,CAACH,MAAM,KAAK,UAAU,EAAE;MAC9C,OAAOnB,MAAM,CAACuB,IAAI,CAACrB,aAAa,CAACsB,WAAW,CAAC;QAC3CC,MAAM,EAAE,QAAQ;QAChBC,MAAM,EAAE,QAAQ;QAChBC,IAAI,EAAE,SAAS;QACfC,WAAW,EAAE;OACd,CAAC,CAAC;IACL;IACA,OAAO5B,MAAM,CAAC6B,GAAG,CACf7B,MAAM,CAAC8B,UAAU,CAAC;MAChBC,GAAG,EAAEA,CAAA,KAAMxB,MAAM,CAACe,MAAM,CAACH,MAAM,CAACC,SAAS,EAAE,IAAIH,UAAU,CAACI,IAAI,CAAC,CAAC;MAChEW,KAAK,EAAGC,KAAK,IACX/B,aAAa,CAACsB,WAAW,CAAC;QACxBC,MAAM,EAAE,QAAQ;QAChBC,MAAM,EAAE,QAAQ;QAChBC,IAAI,EAAE,SAAS;QACfC,WAAW,EAAE,0BAA0B;QACvCK;OACD;KACJ,CAAC,EACDC,MAAM,IAAK,IAAIjB,UAAU,CAACiB,MAAM,CAAC,CACnC;EACH,CAAC;EAED,OAAOnC,YAAY,CAACoC,IAAI,CAAC;IACvBrB,WAAW;IACXK;GACD,CAAC;AACJ,CAAC,CAAC,CACH","ignoreList":[]}
|
|
@@ -22,21 +22,21 @@ RequestInit } from "effect/unstable/http/FetchHttpClient";
|
|
|
22
22
|
/**
|
|
23
23
|
* Allowed response body modes for the browser XHR HTTP client.
|
|
24
24
|
*
|
|
25
|
-
* @category
|
|
25
|
+
* @category models
|
|
26
26
|
* @since 4.0.0
|
|
27
27
|
*/
|
|
28
28
|
export type XHRResponseType = "arraybuffer" | "text";
|
|
29
29
|
/**
|
|
30
30
|
* Reference that controls the `XMLHttpRequest.responseType` used by the browser XHR HTTP client, defaulting to `"text"`.
|
|
31
31
|
*
|
|
32
|
-
* @category
|
|
32
|
+
* @category references
|
|
33
33
|
* @since 4.0.0
|
|
34
34
|
*/
|
|
35
35
|
export declare const CurrentXHRResponseType: Context.Reference<XHRResponseType>;
|
|
36
36
|
/**
|
|
37
37
|
* Runs an effect with `CurrentXHRResponseType` set to `"arraybuffer"` so the XHR HTTP client receives response bodies as `ArrayBuffer` values.
|
|
38
38
|
*
|
|
39
|
-
* @category
|
|
39
|
+
* @category references
|
|
40
40
|
* @since 4.0.0
|
|
41
41
|
*/
|
|
42
42
|
export declare const withXHRArrayBuffer: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
@@ -44,7 +44,7 @@ declare const XMLHttpRequest_base: Context.ServiceClass<XMLHttpRequest, "@effect
|
|
|
44
44
|
/**
|
|
45
45
|
* Service tag for the `XMLHttpRequest` constructor used by the browser XHR HTTP client.
|
|
46
46
|
*
|
|
47
|
-
* @category
|
|
47
|
+
* @category services
|
|
48
48
|
* @since 4.0.0
|
|
49
49
|
*/
|
|
50
50
|
export declare class XMLHttpRequest extends XMLHttpRequest_base {
|
|
@@ -52,7 +52,7 @@ export declare class XMLHttpRequest extends XMLHttpRequest_base {
|
|
|
52
52
|
/**
|
|
53
53
|
* Layer that provides an `HttpClient` implementation backed by the browser `XMLHttpRequest` API.
|
|
54
54
|
*
|
|
55
|
-
* @category
|
|
55
|
+
* @category layers
|
|
56
56
|
* @since 4.0.0
|
|
57
57
|
*/
|
|
58
58
|
export declare const layerXMLHttpRequest: Layer.Layer<HttpClient.HttpClient>;
|
|
@@ -68,7 +68,7 @@ RequestInit } from "effect/unstable/http/FetchHttpClient";
|
|
|
68
68
|
/**
|
|
69
69
|
* Reference that controls the `XMLHttpRequest.responseType` used by the browser XHR HTTP client, defaulting to `"text"`.
|
|
70
70
|
*
|
|
71
|
-
* @category
|
|
71
|
+
* @category references
|
|
72
72
|
* @since 4.0.0
|
|
73
73
|
*/
|
|
74
74
|
export const CurrentXHRResponseType = /*#__PURE__*/Context.Reference("@effect/platform-browser/BrowserHttpClient/CurrentXHRResponseType", {
|
|
@@ -77,14 +77,14 @@ export const CurrentXHRResponseType = /*#__PURE__*/Context.Reference("@effect/pl
|
|
|
77
77
|
/**
|
|
78
78
|
* Runs an effect with `CurrentXHRResponseType` set to `"arraybuffer"` so the XHR HTTP client receives response bodies as `ArrayBuffer` values.
|
|
79
79
|
*
|
|
80
|
-
* @category
|
|
80
|
+
* @category references
|
|
81
81
|
* @since 4.0.0
|
|
82
82
|
*/
|
|
83
83
|
export const withXHRArrayBuffer = self => Effect.provideService(self, CurrentXHRResponseType, "arraybuffer");
|
|
84
84
|
/**
|
|
85
85
|
* Service tag for the `XMLHttpRequest` constructor used by the browser XHR HTTP client.
|
|
86
86
|
*
|
|
87
|
-
* @category
|
|
87
|
+
* @category services
|
|
88
88
|
* @since 4.0.0
|
|
89
89
|
*/
|
|
90
90
|
export class XMLHttpRequest extends /*#__PURE__*/Context.Service()("@effect/platform-browser/BrowserHttpClient/XMLHttpRequest") {}
|
|
@@ -330,7 +330,7 @@ class ClientResponseImpl extends IncomingMessageImpl {
|
|
|
330
330
|
/**
|
|
331
331
|
* Layer that provides an `HttpClient` implementation backed by the browser `XMLHttpRequest` API.
|
|
332
332
|
*
|
|
333
|
-
* @category
|
|
333
|
+
* @category layers
|
|
334
334
|
* @since 4.0.0
|
|
335
335
|
*/
|
|
336
336
|
export const layerXMLHttpRequest = /*#__PURE__*/HttpClient.layerMergedContext(/*#__PURE__*/Effect.succeed(makeXmlHttpRequest));
|
|
@@ -6,7 +6,7 @@ import { IndexedDb } from "./IndexedDb.ts";
|
|
|
6
6
|
*
|
|
7
7
|
* Values are stored between sessions.
|
|
8
8
|
*
|
|
9
|
-
* @category
|
|
9
|
+
* @category layers
|
|
10
10
|
* @since 4.0.0
|
|
11
11
|
*/
|
|
12
12
|
export declare const layerLocalStorage: Layer.Layer<KeyValueStore.KeyValueStore>;
|
|
@@ -15,15 +15,15 @@ export declare const layerLocalStorage: Layer.Layer<KeyValueStore.KeyValueStore>
|
|
|
15
15
|
*
|
|
16
16
|
* Values are stored only for the current session.
|
|
17
17
|
*
|
|
18
|
-
* @category
|
|
18
|
+
* @category layers
|
|
19
19
|
* @since 4.0.0
|
|
20
20
|
*/
|
|
21
21
|
export declare const layerSessionStorage: Layer.Layer<KeyValueStore.KeyValueStore>;
|
|
22
22
|
/**
|
|
23
23
|
* Creates a `KeyValueStore` layer backed by IndexedDB.
|
|
24
24
|
*
|
|
25
|
+
* @category layers
|
|
25
26
|
* @since 4.0.0
|
|
26
|
-
* @category Layers
|
|
27
27
|
*/
|
|
28
28
|
export declare const layerIndexedDb: (options?: {
|
|
29
29
|
readonly database?: string | undefined;
|
|
@@ -26,7 +26,7 @@ import { IndexedDb } from "./IndexedDb.js";
|
|
|
26
26
|
*
|
|
27
27
|
* Values are stored between sessions.
|
|
28
28
|
*
|
|
29
|
-
* @category
|
|
29
|
+
* @category layers
|
|
30
30
|
* @since 4.0.0
|
|
31
31
|
*/
|
|
32
32
|
export const layerLocalStorage = /*#__PURE__*/KeyValueStore.layerStorage(() => globalThis.localStorage);
|
|
@@ -35,15 +35,15 @@ export const layerLocalStorage = /*#__PURE__*/KeyValueStore.layerStorage(() => g
|
|
|
35
35
|
*
|
|
36
36
|
* Values are stored only for the current session.
|
|
37
37
|
*
|
|
38
|
-
* @category
|
|
38
|
+
* @category layers
|
|
39
39
|
* @since 4.0.0
|
|
40
40
|
*/
|
|
41
41
|
export const layerSessionStorage = /*#__PURE__*/KeyValueStore.layerStorage(() => globalThis.sessionStorage);
|
|
42
42
|
/**
|
|
43
43
|
* Creates a `KeyValueStore` layer backed by IndexedDB.
|
|
44
44
|
*
|
|
45
|
+
* @category layers
|
|
45
46
|
* @since 4.0.0
|
|
46
|
-
* @category Layers
|
|
47
47
|
*/
|
|
48
48
|
export const layerIndexedDb = options => Layer.effect(KeyValueStore.KeyValueStore)(Effect.gen(function* () {
|
|
49
49
|
const db = yield* Effect.acquireRelease(openDatabase(options?.database ?? "effect_key_value_store"), db => Effect.sync(() => db.close())).pipe(Effect.orDie);
|
package/dist/BrowserSocket.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ import * as Socket from "effect/unstable/socket/Socket";
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates a `Socket` layer connected to the given URL using the browser `WebSocket` constructor.
|
|
31
31
|
*
|
|
32
|
-
* @category
|
|
32
|
+
* @category layers
|
|
33
33
|
* @since 4.0.0
|
|
34
34
|
*/
|
|
35
35
|
export declare const layerWebSocket: (url: string, options?: {
|
|
@@ -38,7 +38,7 @@ export declare const layerWebSocket: (url: string, options?: {
|
|
|
38
38
|
/**
|
|
39
39
|
* Layer that provides a `WebSocketConstructor` service backed by `globalThis.WebSocket`.
|
|
40
40
|
*
|
|
41
|
-
* @category
|
|
41
|
+
* @category layers
|
|
42
42
|
* @since 4.0.0
|
|
43
43
|
*/
|
|
44
44
|
export declare const layerWebSocketConstructor: Layer.Layer<Socket.WebSocketConstructor>;
|
package/dist/BrowserSocket.js
CHANGED
|
@@ -29,14 +29,14 @@ import * as Socket from "effect/unstable/socket/Socket";
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates a `Socket` layer connected to the given URL using the browser `WebSocket` constructor.
|
|
31
31
|
*
|
|
32
|
-
* @category
|
|
32
|
+
* @category layers
|
|
33
33
|
* @since 4.0.0
|
|
34
34
|
*/
|
|
35
35
|
export const layerWebSocket = (url, options) => Layer.effect(Socket.Socket, Socket.makeWebSocket(url, options)).pipe(Layer.provide(layerWebSocketConstructor));
|
|
36
36
|
/**
|
|
37
37
|
* Layer that provides a `WebSocketConstructor` service backed by `globalThis.WebSocket`.
|
|
38
38
|
*
|
|
39
|
-
* @category
|
|
39
|
+
* @category layers
|
|
40
40
|
* @since 4.0.0
|
|
41
41
|
*/
|
|
42
42
|
export const layerWebSocketConstructor = Socket.layerWebSocketConstructorGlobal;
|
package/dist/BrowserWorker.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import * as Worker from "effect/unstable/workers/Worker";
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates browser worker layers by combining the default `WorkerPlatform` with a spawner for `Worker`, `SharedWorker`, or `MessagePort` instances.
|
|
5
5
|
*
|
|
6
|
-
* @category
|
|
6
|
+
* @category layers
|
|
7
7
|
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
export declare const layer: (spawn: (id: number) => Worker | SharedWorker | MessagePort) => Layer.Layer<Worker.WorkerPlatform | Worker.Spawner>;
|
|
10
10
|
/**
|
|
11
11
|
* Layer that provides the browser `WorkerPlatform` for `Worker`, `SharedWorker`, and `MessagePort` communication.
|
|
12
12
|
*
|
|
13
|
-
* @category
|
|
13
|
+
* @category layers
|
|
14
14
|
* @since 4.0.0
|
|
15
15
|
*/
|
|
16
16
|
export declare const layerPlatform: Layer.Layer<Worker.WorkerPlatform>;
|
package/dist/BrowserWorker.js
CHANGED
|
@@ -30,14 +30,14 @@ import { WorkerError, WorkerReceiveError } from "effect/unstable/workers/WorkerE
|
|
|
30
30
|
/**
|
|
31
31
|
* Creates browser worker layers by combining the default `WorkerPlatform` with a spawner for `Worker`, `SharedWorker`, or `MessagePort` instances.
|
|
32
32
|
*
|
|
33
|
-
* @category
|
|
33
|
+
* @category layers
|
|
34
34
|
* @since 4.0.0
|
|
35
35
|
*/
|
|
36
36
|
export const layer = spawn => Layer.merge(layerPlatform, Worker.layerSpawner(spawn));
|
|
37
37
|
/**
|
|
38
38
|
* Layer that provides the browser `WorkerPlatform` for `Worker`, `SharedWorker`, and `MessagePort` communication.
|
|
39
39
|
*
|
|
40
|
-
* @category
|
|
40
|
+
* @category layers
|
|
41
41
|
* @since 4.0.0
|
|
42
42
|
*/
|
|
43
43
|
export const layerPlatform = /*#__PURE__*/Layer.succeed(Worker.WorkerPlatform)(/*#__PURE__*/Worker.makePlatform()({
|
|
@@ -3,21 +3,21 @@ import * as WorkerRunner from "effect/unstable/workers/WorkerRunner";
|
|
|
3
3
|
/**
|
|
4
4
|
* Creates a `WorkerRunnerPlatform` service that runs worker handlers over a `MessagePort` or `Window`.
|
|
5
5
|
*
|
|
6
|
-
* @category
|
|
6
|
+
* @category constructors
|
|
7
7
|
* @since 4.0.0
|
|
8
8
|
*/
|
|
9
9
|
export declare const make: (self: MessagePort | Window) => WorkerRunner.WorkerRunnerPlatform["Service"];
|
|
10
10
|
/**
|
|
11
11
|
* Layer that provides a browser `WorkerRunnerPlatform` using the global `self` worker context.
|
|
12
12
|
*
|
|
13
|
-
* @category
|
|
13
|
+
* @category layers
|
|
14
14
|
* @since 4.0.0
|
|
15
15
|
*/
|
|
16
16
|
export declare const layer: Layer.Layer<WorkerRunner.WorkerRunnerPlatform>;
|
|
17
17
|
/**
|
|
18
18
|
* Layer that provides a `WorkerRunnerPlatform` using the supplied `MessagePort` or `Window`.
|
|
19
19
|
*
|
|
20
|
-
* @category
|
|
20
|
+
* @category layers
|
|
21
21
|
* @since 4.0.0
|
|
22
22
|
*/
|
|
23
23
|
export declare const layerMessagePort: (port: MessagePort | Window) => Layer.Layer<WorkerRunner.WorkerRunnerPlatform>;
|
|
@@ -40,7 +40,7 @@ if (typeof self !== "undefined" && "onconnect" in self) {
|
|
|
40
40
|
/**
|
|
41
41
|
* Creates a `WorkerRunnerPlatform` service that runs worker handlers over a `MessagePort` or `Window`.
|
|
42
42
|
*
|
|
43
|
-
* @category
|
|
43
|
+
* @category constructors
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
*/
|
|
46
46
|
export const make = self => ({
|
|
@@ -153,14 +153,14 @@ export const make = self => ({
|
|
|
153
153
|
/**
|
|
154
154
|
* Layer that provides a browser `WorkerRunnerPlatform` using the global `self` worker context.
|
|
155
155
|
*
|
|
156
|
-
* @category
|
|
156
|
+
* @category layers
|
|
157
157
|
* @since 4.0.0
|
|
158
158
|
*/
|
|
159
159
|
export const layer = /*#__PURE__*/Layer.sync(WorkerRunner.WorkerRunnerPlatform)(() => make(self));
|
|
160
160
|
/**
|
|
161
161
|
* Layer that provides a `WorkerRunnerPlatform` using the supplied `MessagePort` or `Window`.
|
|
162
162
|
*
|
|
163
|
-
* @category
|
|
163
|
+
* @category layers
|
|
164
164
|
* @since 4.0.0
|
|
165
165
|
*/
|
|
166
166
|
export const layerMessagePort = port => Layer.succeed(WorkerRunner.WorkerRunnerPlatform)(make(port));
|
package/dist/Clipboard.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const ErrorTypeId = "~@effect/platform-browser/Clipboard/ClipboardError"
|
|
|
25
25
|
/**
|
|
26
26
|
* Service interface for reading from, writing to, and clearing the browser clipboard.
|
|
27
27
|
*
|
|
28
|
-
* @category
|
|
28
|
+
* @category models
|
|
29
29
|
* @since 4.0.0
|
|
30
30
|
*/
|
|
31
31
|
export interface Clipboard {
|
|
@@ -43,7 +43,7 @@ declare const ClipboardError_base: new <A extends Record<string, any> = {}>(args
|
|
|
43
43
|
/**
|
|
44
44
|
* Tagged error raised when a browser clipboard operation fails.
|
|
45
45
|
*
|
|
46
|
-
* @category
|
|
46
|
+
* @category errors
|
|
47
47
|
* @since 4.0.0
|
|
48
48
|
*/
|
|
49
49
|
export declare class ClipboardError extends ClipboardError_base<{
|
|
@@ -55,21 +55,21 @@ export declare class ClipboardError extends ClipboardError_base<{
|
|
|
55
55
|
/**
|
|
56
56
|
* Service tag for the browser `Clipboard` service.
|
|
57
57
|
*
|
|
58
|
-
* @category
|
|
58
|
+
* @category services
|
|
59
59
|
* @since 4.0.0
|
|
60
60
|
*/
|
|
61
61
|
export declare const Clipboard: Context.Service<Clipboard, Clipboard>;
|
|
62
62
|
/**
|
|
63
63
|
* Builds a `Clipboard` service from primitive read and write operations, deriving `clear` and `writeBlob` helpers.
|
|
64
64
|
*
|
|
65
|
-
* @category
|
|
65
|
+
* @category constructors
|
|
66
66
|
* @since 4.0.0
|
|
67
67
|
*/
|
|
68
68
|
export declare const make: (impl: Omit<Clipboard, "clear" | "writeBlob" | typeof TypeId>) => Clipboard;
|
|
69
69
|
/**
|
|
70
70
|
* A layer that directly interfaces with the navigator.clipboard api
|
|
71
71
|
*
|
|
72
|
-
* @category
|
|
72
|
+
* @category layers
|
|
73
73
|
* @since 4.0.0
|
|
74
74
|
*/
|
|
75
75
|
export declare const layer: Layer.Layer<Clipboard>;
|
package/dist/Clipboard.js
CHANGED
|
@@ -26,7 +26,7 @@ const ErrorTypeId = "~@effect/platform-browser/Clipboard/ClipboardError";
|
|
|
26
26
|
/**
|
|
27
27
|
* Tagged error raised when a browser clipboard operation fails.
|
|
28
28
|
*
|
|
29
|
-
* @category
|
|
29
|
+
* @category errors
|
|
30
30
|
* @since 4.0.0
|
|
31
31
|
*/
|
|
32
32
|
export class ClipboardError extends /*#__PURE__*/Data.TaggedError("ClipboardError") {
|
|
@@ -35,14 +35,14 @@ export class ClipboardError extends /*#__PURE__*/Data.TaggedError("ClipboardErro
|
|
|
35
35
|
/**
|
|
36
36
|
* Service tag for the browser `Clipboard` service.
|
|
37
37
|
*
|
|
38
|
-
* @category
|
|
38
|
+
* @category services
|
|
39
39
|
* @since 4.0.0
|
|
40
40
|
*/
|
|
41
41
|
export const Clipboard = /*#__PURE__*/Context.Service(TypeId);
|
|
42
42
|
/**
|
|
43
43
|
* Builds a `Clipboard` service from primitive read and write operations, deriving `clear` and `writeBlob` helpers.
|
|
44
44
|
*
|
|
45
|
-
* @category
|
|
45
|
+
* @category constructors
|
|
46
46
|
* @since 4.0.0
|
|
47
47
|
*/
|
|
48
48
|
export const make = impl => Clipboard.of({
|
|
@@ -56,7 +56,7 @@ export const make = impl => Clipboard.of({
|
|
|
56
56
|
/**
|
|
57
57
|
* A layer that directly interfaces with the navigator.clipboard api
|
|
58
58
|
*
|
|
59
|
-
* @category
|
|
59
|
+
* @category layers
|
|
60
60
|
* @since 4.0.0
|
|
61
61
|
*/
|
|
62
62
|
export const layer = /*#__PURE__*/Layer.succeed(Clipboard, /*#__PURE__*/make({
|
package/dist/Geolocation.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ declare const ErrorTypeId = "~@effect/platform-browser/Geolocation/GeolocationEr
|
|
|
27
27
|
/**
|
|
28
28
|
* Service interface for browser geolocation, providing effects for the current position and streams of watched positions.
|
|
29
29
|
*
|
|
30
|
-
* @category
|
|
30
|
+
* @category models
|
|
31
31
|
* @since 4.0.0
|
|
32
32
|
*/
|
|
33
33
|
export interface Geolocation {
|
|
@@ -40,7 +40,7 @@ export interface Geolocation {
|
|
|
40
40
|
/**
|
|
41
41
|
* Service tag for the browser `Geolocation` service.
|
|
42
42
|
*
|
|
43
|
-
* @category
|
|
43
|
+
* @category services
|
|
44
44
|
* @since 4.0.0
|
|
45
45
|
*/
|
|
46
46
|
export declare const Geolocation: Context.Service<Geolocation, Geolocation>;
|
|
@@ -50,7 +50,7 @@ declare const GeolocationError_base: new <A extends Record<string, any> = {}>(ar
|
|
|
50
50
|
/**
|
|
51
51
|
* Tagged error wrapping a browser geolocation failure reason.
|
|
52
52
|
*
|
|
53
|
-
* @category
|
|
53
|
+
* @category errors
|
|
54
54
|
* @since 4.0.0
|
|
55
55
|
*/
|
|
56
56
|
export declare class GeolocationError extends GeolocationError_base<{
|
|
@@ -68,7 +68,7 @@ declare const PositionUnavailable_base: new <A extends Record<string, any> = {}>
|
|
|
68
68
|
/**
|
|
69
69
|
* Error reason for the browser geolocation `POSITION_UNAVAILABLE` failure.
|
|
70
70
|
*
|
|
71
|
-
* @category
|
|
71
|
+
* @category errors
|
|
72
72
|
* @since 4.0.0
|
|
73
73
|
*/
|
|
74
74
|
export declare class PositionUnavailable extends PositionUnavailable_base<{
|
|
@@ -82,7 +82,7 @@ declare const PermissionDenied_base: new <A extends Record<string, any> = {}>(ar
|
|
|
82
82
|
/**
|
|
83
83
|
* Error reason for the browser geolocation `PERMISSION_DENIED` failure.
|
|
84
84
|
*
|
|
85
|
-
* @category
|
|
85
|
+
* @category errors
|
|
86
86
|
* @since 4.0.0
|
|
87
87
|
*/
|
|
88
88
|
export declare class PermissionDenied extends PermissionDenied_base<{
|
|
@@ -96,7 +96,7 @@ declare const Timeout_base: new <A extends Record<string, any> = {}>(args: impor
|
|
|
96
96
|
/**
|
|
97
97
|
* Error reason for the browser geolocation `TIMEOUT` failure.
|
|
98
98
|
*
|
|
99
|
-
* @category
|
|
99
|
+
* @category errors
|
|
100
100
|
* @since 4.0.0
|
|
101
101
|
*/
|
|
102
102
|
export declare class Timeout extends Timeout_base<{
|
|
@@ -107,14 +107,14 @@ export declare class Timeout extends Timeout_base<{
|
|
|
107
107
|
/**
|
|
108
108
|
* Union of browser geolocation error reasons represented by the service.
|
|
109
109
|
*
|
|
110
|
-
* @category
|
|
110
|
+
* @category errors
|
|
111
111
|
* @since 4.0.0
|
|
112
112
|
*/
|
|
113
113
|
export type GeolocationErrorReason = PositionUnavailable | PermissionDenied | Timeout;
|
|
114
114
|
/**
|
|
115
115
|
* Layer that provides `Geolocation` using `navigator.geolocation`, with watched positions buffered in a sliding queue.
|
|
116
116
|
*
|
|
117
|
-
* @category
|
|
117
|
+
* @category layers
|
|
118
118
|
* @since 4.0.0
|
|
119
119
|
*/
|
|
120
120
|
export declare const layer: Layer.Layer<Geolocation>;
|
package/dist/Geolocation.js
CHANGED
|
@@ -29,14 +29,14 @@ const ErrorTypeId = "~@effect/platform-browser/Geolocation/GeolocationError";
|
|
|
29
29
|
/**
|
|
30
30
|
* Service tag for the browser `Geolocation` service.
|
|
31
31
|
*
|
|
32
|
-
* @category
|
|
32
|
+
* @category services
|
|
33
33
|
* @since 4.0.0
|
|
34
34
|
*/
|
|
35
35
|
export const Geolocation = /*#__PURE__*/Context.Service(TypeId);
|
|
36
36
|
/**
|
|
37
37
|
* Tagged error wrapping a browser geolocation failure reason.
|
|
38
38
|
*
|
|
39
|
-
* @category
|
|
39
|
+
* @category errors
|
|
40
40
|
* @since 4.0.0
|
|
41
41
|
*/
|
|
42
42
|
export class GeolocationError extends /*#__PURE__*/Data.TaggedError("GeolocationError") {
|
|
@@ -54,7 +54,7 @@ export class GeolocationError extends /*#__PURE__*/Data.TaggedError("Geolocation
|
|
|
54
54
|
/**
|
|
55
55
|
* Error reason for the browser geolocation `POSITION_UNAVAILABLE` failure.
|
|
56
56
|
*
|
|
57
|
-
* @category
|
|
57
|
+
* @category errors
|
|
58
58
|
* @since 4.0.0
|
|
59
59
|
*/
|
|
60
60
|
export class PositionUnavailable extends /*#__PURE__*/Data.TaggedError("PositionUnavailable") {
|
|
@@ -65,7 +65,7 @@ export class PositionUnavailable extends /*#__PURE__*/Data.TaggedError("Position
|
|
|
65
65
|
/**
|
|
66
66
|
* Error reason for the browser geolocation `PERMISSION_DENIED` failure.
|
|
67
67
|
*
|
|
68
|
-
* @category
|
|
68
|
+
* @category errors
|
|
69
69
|
* @since 4.0.0
|
|
70
70
|
*/
|
|
71
71
|
export class PermissionDenied extends /*#__PURE__*/Data.TaggedError("PermissionDenied") {
|
|
@@ -76,7 +76,7 @@ export class PermissionDenied extends /*#__PURE__*/Data.TaggedError("PermissionD
|
|
|
76
76
|
/**
|
|
77
77
|
* Error reason for the browser geolocation `TIMEOUT` failure.
|
|
78
78
|
*
|
|
79
|
-
* @category
|
|
79
|
+
* @category errors
|
|
80
80
|
* @since 4.0.0
|
|
81
81
|
*/
|
|
82
82
|
export class Timeout extends /*#__PURE__*/Data.TaggedError("Timeout") {
|
|
@@ -111,7 +111,7 @@ const makeQueue = options => Queue.sliding(options?.bufferSize ?? 16).pipe(Effec
|
|
|
111
111
|
/**
|
|
112
112
|
* Layer that provides `Geolocation` using `navigator.geolocation`, with watched positions buffered in a sliding queue.
|
|
113
113
|
*
|
|
114
|
-
* @category
|
|
114
|
+
* @category layers
|
|
115
115
|
* @since 4.0.0
|
|
116
116
|
*/
|
|
117
117
|
export const layer = /*#__PURE__*/Layer.succeed(Geolocation, /*#__PURE__*/Geolocation.of({
|
package/dist/IndexedDb.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare const AutoIncrement: Schema.Int;
|
|
|
62
62
|
/**
|
|
63
63
|
* Creates an `IndexedDb` service from an `IDBFactory` and `IDBKeyRange` constructor.
|
|
64
64
|
*
|
|
65
|
-
* @category
|
|
65
|
+
* @category constructors
|
|
66
66
|
* @since 4.0.0
|
|
67
67
|
*/
|
|
68
68
|
export declare const make: (impl: Omit<IndexedDb, typeof TypeId>) => IndexedDb;
|
package/dist/IndexedDb.js
CHANGED
|
@@ -61,7 +61,7 @@ export const AutoIncrement = /*#__PURE__*/Schema.Int.check(Schema.isBetween({
|
|
|
61
61
|
/**
|
|
62
62
|
* Creates an `IndexedDb` service from an `IDBFactory` and `IDBKeyRange` constructor.
|
|
63
63
|
*
|
|
64
|
-
* @category
|
|
64
|
+
* @category constructors
|
|
65
65
|
* @since 4.0.0
|
|
66
66
|
*/
|
|
67
67
|
export const make = impl => IndexedDb.of({
|
|
@@ -111,7 +111,6 @@ export type KeyPathNumber<TableSchema extends IndexedDbTable.AnySchemaStruct> =
|
|
|
111
111
|
/**
|
|
112
112
|
* Namespace containing the typed IndexedDB query model interfaces and helper types.
|
|
113
113
|
*
|
|
114
|
-
* @category models
|
|
115
114
|
* @since 4.0.0
|
|
116
115
|
*/
|
|
117
116
|
export declare namespace IndexedDbQuery {
|