@effect/platform-browser 0.7.7 → 0.8.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/Clipboard/dist/effect-platform-browser-Clipboard.cjs.dev.js +111 -8
- package/Clipboard/dist/effect-platform-browser-Clipboard.cjs.prod.js +111 -8
- package/Clipboard/dist/effect-platform-browser-Clipboard.esm.js +90 -5
- package/Effectify/dist/effect-platform-browser-Effectify.cjs.dev.js +2 -2
- package/Effectify/dist/effect-platform-browser-Effectify.cjs.prod.js +2 -2
- package/Error/dist/effect-platform-browser-Error.cjs.dev.js +6 -14
- package/Error/dist/effect-platform-browser-Error.cjs.mjs +1 -3
- package/Error/dist/effect-platform-browser-Error.cjs.prod.js +6 -14
- package/Error/dist/effect-platform-browser-Error.esm.js +1 -1
- package/HttpClient/dist/effect-platform-browser-HttpClient.cjs.dev.js +15 -15
- package/HttpClient/dist/effect-platform-browser-HttpClient.cjs.prod.js +15 -15
- package/KeyValueStore/dist/effect-platform-browser-KeyValueStore.cjs.dev.js +148 -11
- package/KeyValueStore/dist/effect-platform-browser-KeyValueStore.cjs.prod.js +148 -11
- package/KeyValueStore/dist/effect-platform-browser-KeyValueStore.esm.js +123 -5
- package/Runtime/dist/effect-platform-browser-Runtime.cjs.dev.js +44 -4
- package/Runtime/dist/effect-platform-browser-Runtime.cjs.prod.js +44 -4
- package/Runtime/dist/effect-platform-browser-Runtime.esm.js +26 -3
- package/dist/declarations/src/Error.d.ts +7 -6
- package/dist/declarations/src/Error.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/effect-platform-browser.cjs.dev.js +40 -30
- package/dist/effect-platform-browser.cjs.prod.js +40 -30
- package/dist/effect-platform-browser.esm.js +14 -23
- package/package.json +7 -4
- package/src/Error.ts +9 -6
- package/src/index.ts +7 -7
- package/dist/Clipboard-13e91d33.cjs.dev.js +0 -124
- package/dist/Clipboard-d7d71495.cjs.prod.js +0 -124
- package/dist/Clipboard-f4a0489a.esm.js +0 -97
- package/dist/Effectify-632740e0.esm.js +0 -12
- package/dist/Effectify-835ab94e.cjs.prod.js +0 -14
- package/dist/Effectify-bb2be397.cjs.dev.js +0 -14
- package/dist/Error-0d1e7da7.cjs.dev.js +0 -18
- package/dist/Error-0fa4dba0.esm.js +0 -16
- package/dist/Error-104397ab.cjs.prod.js +0 -18
- package/dist/HttpClient-00aa1aaf.cjs.prod.js +0 -52
- package/dist/HttpClient-55040ca2.cjs.dev.js +0 -52
- package/dist/HttpClient-654b6b51.esm.js +0 -24
- package/dist/KeyValueStore-02197867.cjs.dev.js +0 -172
- package/dist/KeyValueStore-4b4d9a2f.cjs.prod.js +0 -172
- package/dist/KeyValueStore-db2cee39.esm.js +0 -144
- package/dist/Path-61602feb.esm.js +0 -28
- package/dist/Path-a9ecae35.cjs.dev.js +0 -50
- package/dist/Path-b3260065.cjs.prod.js +0 -50
- package/dist/Runtime-800a5cc3.cjs.dev.js +0 -55
- package/dist/Runtime-95b50d4a.esm.js +0 -31
- package/dist/Runtime-a845fde1.cjs.prod.js +0 -55
|
@@ -2,14 +2,117 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('
|
|
7
|
-
require('effect/
|
|
8
|
-
require('effect/
|
|
9
|
-
require('effect/Layer');
|
|
5
|
+
var PlatformError = require('@effect/platform/Error');
|
|
6
|
+
var Context = require('effect/Context');
|
|
7
|
+
var Effect = require('effect/Effect');
|
|
8
|
+
var Layer = require('effect/Layer');
|
|
10
9
|
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n["default"] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
11
27
|
|
|
28
|
+
var PlatformError__namespace = /*#__PURE__*/_interopNamespace(PlatformError);
|
|
29
|
+
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
|
|
30
|
+
var Layer__namespace = /*#__PURE__*/_interopNamespace(Layer);
|
|
12
31
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
/** @internal */
|
|
33
|
+
const tag = /*#__PURE__*/Context.Tag("@effect/platform-browser/Clipboard");
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
const make$1 = impl => tag.of({
|
|
37
|
+
...impl,
|
|
38
|
+
clear: impl.writeString(""),
|
|
39
|
+
writeBlob: blob => impl.write([new ClipboardItem({
|
|
40
|
+
[blob.type]: blob
|
|
41
|
+
})])
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
const clipboardError = props => PlatformError__namespace.SystemError({
|
|
46
|
+
reason: "PermissionDenied",
|
|
47
|
+
module: "Clipboard",
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
const layer$1 = /*#__PURE__*/Layer__namespace.succeed(tag, /*#__PURE__*/make$1({
|
|
53
|
+
read: /*#__PURE__*/Effect__namespace.tryPromise({
|
|
54
|
+
try: navigator.clipboard.read,
|
|
55
|
+
catch: () => clipboardError({
|
|
56
|
+
"message": "Unable to read from clipboard",
|
|
57
|
+
"method": "read",
|
|
58
|
+
"pathOrDescriptor": "layer"
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
write: s => Effect__namespace.tryPromise({
|
|
62
|
+
try: () => navigator.clipboard.write(s),
|
|
63
|
+
catch: () => clipboardError({
|
|
64
|
+
"message": "Unable to write to clipboard",
|
|
65
|
+
"method": "write",
|
|
66
|
+
"pathOrDescriptor": "layer"
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
readString: /*#__PURE__*/Effect__namespace.tryPromise({
|
|
70
|
+
try: navigator.clipboard.readText,
|
|
71
|
+
catch: () => clipboardError({
|
|
72
|
+
"message": "Unable to read a string from clipboard",
|
|
73
|
+
"method": "readString",
|
|
74
|
+
"pathOrDescriptor": "layer"
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
writeString: text => Effect__namespace.tryPromise({
|
|
78
|
+
try: () => navigator.clipboard.writeText(text),
|
|
79
|
+
catch: () => clipboardError({
|
|
80
|
+
"message": "Unable to write a string to clipboard",
|
|
81
|
+
"method": "writeString",
|
|
82
|
+
"pathOrDescriptor": "layer"
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category interface
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @since 1.0.0
|
|
98
|
+
* @category constructor
|
|
99
|
+
*/
|
|
100
|
+
const make = make$1;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
* @category tag
|
|
105
|
+
*/
|
|
106
|
+
const Clipboard = tag;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A layer that directly interfaces with the navigator.clipboard api
|
|
110
|
+
*
|
|
111
|
+
* @since 1.0.0
|
|
112
|
+
* @category layers
|
|
113
|
+
*/
|
|
114
|
+
const layer = layer$1;
|
|
115
|
+
|
|
116
|
+
exports.Clipboard = Clipboard;
|
|
117
|
+
exports.layer = layer;
|
|
118
|
+
exports.make = make;
|
|
@@ -2,14 +2,117 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('
|
|
7
|
-
require('effect/
|
|
8
|
-
require('effect/
|
|
9
|
-
require('effect/Layer');
|
|
5
|
+
var PlatformError = require('@effect/platform/Error');
|
|
6
|
+
var Context = require('effect/Context');
|
|
7
|
+
var Effect = require('effect/Effect');
|
|
8
|
+
var Layer = require('effect/Layer');
|
|
10
9
|
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n["default"] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
11
27
|
|
|
28
|
+
var PlatformError__namespace = /*#__PURE__*/_interopNamespace(PlatformError);
|
|
29
|
+
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
|
|
30
|
+
var Layer__namespace = /*#__PURE__*/_interopNamespace(Layer);
|
|
12
31
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
/** @internal */
|
|
33
|
+
const tag = /*#__PURE__*/Context.Tag("@effect/platform-browser/Clipboard");
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
const make$1 = impl => tag.of({
|
|
37
|
+
...impl,
|
|
38
|
+
clear: impl.writeString(""),
|
|
39
|
+
writeBlob: blob => impl.write([new ClipboardItem({
|
|
40
|
+
[blob.type]: blob
|
|
41
|
+
})])
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
const clipboardError = props => PlatformError__namespace.SystemError({
|
|
46
|
+
reason: "PermissionDenied",
|
|
47
|
+
module: "Clipboard",
|
|
48
|
+
...props
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/** @internal */
|
|
52
|
+
const layer$1 = /*#__PURE__*/Layer__namespace.succeed(tag, /*#__PURE__*/make$1({
|
|
53
|
+
read: /*#__PURE__*/Effect__namespace.tryPromise({
|
|
54
|
+
try: navigator.clipboard.read,
|
|
55
|
+
catch: () => clipboardError({
|
|
56
|
+
"message": "Unable to read from clipboard",
|
|
57
|
+
"method": "read",
|
|
58
|
+
"pathOrDescriptor": "layer"
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
write: s => Effect__namespace.tryPromise({
|
|
62
|
+
try: () => navigator.clipboard.write(s),
|
|
63
|
+
catch: () => clipboardError({
|
|
64
|
+
"message": "Unable to write to clipboard",
|
|
65
|
+
"method": "write",
|
|
66
|
+
"pathOrDescriptor": "layer"
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
readString: /*#__PURE__*/Effect__namespace.tryPromise({
|
|
70
|
+
try: navigator.clipboard.readText,
|
|
71
|
+
catch: () => clipboardError({
|
|
72
|
+
"message": "Unable to read a string from clipboard",
|
|
73
|
+
"method": "readString",
|
|
74
|
+
"pathOrDescriptor": "layer"
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
writeString: text => Effect__namespace.tryPromise({
|
|
78
|
+
try: () => navigator.clipboard.writeText(text),
|
|
79
|
+
catch: () => clipboardError({
|
|
80
|
+
"message": "Unable to write a string to clipboard",
|
|
81
|
+
"method": "writeString",
|
|
82
|
+
"pathOrDescriptor": "layer"
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @since 1.0.0
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category interface
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @since 1.0.0
|
|
98
|
+
* @category constructor
|
|
99
|
+
*/
|
|
100
|
+
const make = make$1;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
* @category tag
|
|
105
|
+
*/
|
|
106
|
+
const Clipboard = tag;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A layer that directly interfaces with the navigator.clipboard api
|
|
110
|
+
*
|
|
111
|
+
* @since 1.0.0
|
|
112
|
+
* @category layers
|
|
113
|
+
*/
|
|
114
|
+
const layer = layer$1;
|
|
115
|
+
|
|
116
|
+
exports.Clipboard = Clipboard;
|
|
117
|
+
exports.layer = layer;
|
|
118
|
+
exports.make = make;
|
|
@@ -1,5 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import 'effect/
|
|
4
|
-
import 'effect/
|
|
5
|
-
|
|
1
|
+
import * as PlatformError from '@effect/platform/Error';
|
|
2
|
+
import { Tag } from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
const tag = /*#__PURE__*/Tag("@effect/platform-browser/Clipboard");
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
const make$1 = impl => tag.of({
|
|
11
|
+
...impl,
|
|
12
|
+
clear: impl.writeString(""),
|
|
13
|
+
writeBlob: blob => impl.write([new ClipboardItem({
|
|
14
|
+
[blob.type]: blob
|
|
15
|
+
})])
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
const clipboardError = props => PlatformError.SystemError({
|
|
20
|
+
reason: "PermissionDenied",
|
|
21
|
+
module: "Clipboard",
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(tag, /*#__PURE__*/make$1({
|
|
27
|
+
read: /*#__PURE__*/Effect.tryPromise({
|
|
28
|
+
try: navigator.clipboard.read,
|
|
29
|
+
catch: () => clipboardError({
|
|
30
|
+
"message": "Unable to read from clipboard",
|
|
31
|
+
"method": "read",
|
|
32
|
+
"pathOrDescriptor": "layer"
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
write: s => Effect.tryPromise({
|
|
36
|
+
try: () => navigator.clipboard.write(s),
|
|
37
|
+
catch: () => clipboardError({
|
|
38
|
+
"message": "Unable to write to clipboard",
|
|
39
|
+
"method": "write",
|
|
40
|
+
"pathOrDescriptor": "layer"
|
|
41
|
+
})
|
|
42
|
+
}),
|
|
43
|
+
readString: /*#__PURE__*/Effect.tryPromise({
|
|
44
|
+
try: navigator.clipboard.readText,
|
|
45
|
+
catch: () => clipboardError({
|
|
46
|
+
"message": "Unable to read a string from clipboard",
|
|
47
|
+
"method": "readString",
|
|
48
|
+
"pathOrDescriptor": "layer"
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
writeString: text => Effect.tryPromise({
|
|
52
|
+
try: () => navigator.clipboard.writeText(text),
|
|
53
|
+
catch: () => clipboardError({
|
|
54
|
+
"message": "Unable to write a string to clipboard",
|
|
55
|
+
"method": "writeString",
|
|
56
|
+
"pathOrDescriptor": "layer"
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @since 1.0.0
|
|
67
|
+
* @category interface
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @since 1.0.0
|
|
72
|
+
* @category constructor
|
|
73
|
+
*/
|
|
74
|
+
const make = make$1;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
* @category tag
|
|
79
|
+
*/
|
|
80
|
+
const Clipboard = tag;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A layer that directly interfaces with the navigator.clipboard api
|
|
84
|
+
*
|
|
85
|
+
* @since 1.0.0
|
|
86
|
+
* @category layers
|
|
87
|
+
*/
|
|
88
|
+
const layer = layer$1;
|
|
89
|
+
|
|
90
|
+
export { Clipboard, layer, make };
|
|
@@ -7,22 +7,14 @@ var PlatformError = require('@effect/platform/Error');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, 'BadArgument', {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, 'PlatformError', {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return PlatformError.PlatformError; }
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return PlatformError.BadArgument; }
|
|
16
12
|
});
|
|
17
13
|
Object.defineProperty(exports, 'PlatformErrorTypeId', {
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return PlatformError.PlatformErrorTypeId; }
|
|
20
16
|
});
|
|
21
17
|
Object.defineProperty(exports, 'SystemError', {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, 'SystemErrorReason', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return PlatformError.SystemErrorReason; }
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return PlatformError.SystemError; }
|
|
28
20
|
});
|
|
@@ -7,22 +7,14 @@ var PlatformError = require('@effect/platform/Error');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, 'BadArgument', {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, 'PlatformError', {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return PlatformError.PlatformError; }
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return PlatformError.BadArgument; }
|
|
16
12
|
});
|
|
17
13
|
Object.defineProperty(exports, 'PlatformErrorTypeId', {
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return PlatformError.PlatformErrorTypeId; }
|
|
20
16
|
});
|
|
21
17
|
Object.defineProperty(exports, 'SystemError', {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, 'SystemErrorReason', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () { return PlatformError.SystemErrorReason; }
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return PlatformError.SystemError; }
|
|
28
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BadArgument,
|
|
1
|
+
export { BadArgument, PlatformErrorTypeId, SystemError } from '@effect/platform/Error';
|
|
@@ -11,21 +11,21 @@ var Headers = require('@effect/platform/Http/Headers');
|
|
|
11
11
|
var UrlParams = require('@effect/platform/Http/UrlParams');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var Body__namespace = /*#__PURE__*/_interopNamespace(Body);
|
|
@@ -11,21 +11,21 @@ var Headers = require('@effect/platform/Http/Headers');
|
|
|
11
11
|
var UrlParams = require('@effect/platform/Http/UrlParams');
|
|
12
12
|
|
|
13
13
|
function _interopNamespace(e) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var Body__namespace = /*#__PURE__*/_interopNamespace(Body);
|
|
@@ -2,20 +2,157 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var PlatformError = require('@effect/platform/Error');
|
|
6
6
|
var KeyValueStore = require('@effect/platform/KeyValueStore');
|
|
7
|
-
require('
|
|
8
|
-
require('effect/
|
|
9
|
-
require('effect/
|
|
10
|
-
require('effect/Option');
|
|
7
|
+
var Effect = require('effect/Effect');
|
|
8
|
+
var Layer = require('effect/Layer');
|
|
9
|
+
var Option = require('effect/Option');
|
|
11
10
|
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n["default"] = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
12
28
|
|
|
29
|
+
var PlatformError__namespace = /*#__PURE__*/_interopNamespace(PlatformError);
|
|
30
|
+
var KeyValueStore__namespace = /*#__PURE__*/_interopNamespace(KeyValueStore);
|
|
31
|
+
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
|
|
32
|
+
var Layer__namespace = /*#__PURE__*/_interopNamespace(Layer);
|
|
33
|
+
var Option__namespace = /*#__PURE__*/_interopNamespace(Option);
|
|
13
34
|
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
const storageError = props => PlatformError__namespace.SystemError({
|
|
36
|
+
reason: "PermissionDenied",
|
|
37
|
+
module: "KeyValueStore",
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
const layerLocalStorage$1 = /*#__PURE__*/Layer__namespace.succeed(KeyValueStore__namespace.KeyValueStore, /*#__PURE__*/KeyValueStore__namespace.make({
|
|
43
|
+
get: key => Effect__namespace.try({
|
|
44
|
+
try: () => Option__namespace.fromNullable(localStorage.getItem(key)),
|
|
45
|
+
catch: () => storageError({
|
|
46
|
+
pathOrDescriptor: "layerLocalStorage",
|
|
47
|
+
method: "get",
|
|
48
|
+
message: `Unable to get item with key ${key}`
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
set: (key, value) => Effect__namespace.try({
|
|
52
|
+
try: () => localStorage.setItem(key, value),
|
|
53
|
+
catch: () => storageError({
|
|
54
|
+
pathOrDescriptor: "layerLocalStorage",
|
|
55
|
+
method: "set",
|
|
56
|
+
message: `Unable to set item with key ${key}`
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
remove: key => Effect__namespace.try({
|
|
60
|
+
try: () => localStorage.removeItem(key),
|
|
61
|
+
catch: () => storageError({
|
|
62
|
+
pathOrDescriptor: "layerLocalStorage",
|
|
63
|
+
method: "remove",
|
|
64
|
+
message: `Unable to remove item with key ${key}`
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
67
|
+
clear: /*#__PURE__*/Effect__namespace.try({
|
|
68
|
+
try: () => localStorage.clear(),
|
|
69
|
+
catch: () => storageError({
|
|
70
|
+
pathOrDescriptor: "layerLocalStorage",
|
|
71
|
+
method: "clear",
|
|
72
|
+
message: `Unable to clear storage`
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
size: /*#__PURE__*/Effect__namespace.try({
|
|
76
|
+
try: () => localStorage.length,
|
|
77
|
+
catch: () => storageError({
|
|
78
|
+
pathOrDescriptor: "layerLocalStorage",
|
|
79
|
+
method: "size",
|
|
80
|
+
message: `Unable to get size`
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
}));
|
|
84
|
+
|
|
85
|
+
/** @internal */
|
|
86
|
+
const layerSessionStorage$1 = /*#__PURE__*/Layer__namespace.succeed(KeyValueStore__namespace.KeyValueStore, /*#__PURE__*/KeyValueStore__namespace.make({
|
|
87
|
+
get: key => Effect__namespace.try({
|
|
88
|
+
try: () => Option__namespace.fromNullable(sessionStorage.getItem(key)),
|
|
89
|
+
catch: () => storageError({
|
|
90
|
+
pathOrDescriptor: "layerSessionStorage",
|
|
91
|
+
method: "get",
|
|
92
|
+
message: `Unable to get item with key ${key}`
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
set: (key, value) => Effect__namespace.try({
|
|
96
|
+
try: () => sessionStorage.setItem(key, value),
|
|
97
|
+
catch: () => storageError({
|
|
98
|
+
pathOrDescriptor: "layerSessionStorage",
|
|
99
|
+
method: "set",
|
|
100
|
+
message: `Unable to set item with key ${key}`
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
remove: key => Effect__namespace.try({
|
|
104
|
+
try: () => sessionStorage.removeItem(key),
|
|
105
|
+
catch: () => storageError({
|
|
106
|
+
pathOrDescriptor: "layerSessionStorage",
|
|
107
|
+
method: "remove",
|
|
108
|
+
message: `Unable to remove item with key ${key}`
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
clear: /*#__PURE__*/Effect__namespace.try({
|
|
112
|
+
try: () => sessionStorage.clear(),
|
|
113
|
+
catch: () => storageError({
|
|
114
|
+
pathOrDescriptor: "layerSessionStorage",
|
|
115
|
+
method: "clear",
|
|
116
|
+
message: `Unable to clear storage`
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
size: /*#__PURE__*/Effect__namespace.try({
|
|
120
|
+
try: () => sessionStorage.length,
|
|
121
|
+
catch: () => storageError({
|
|
122
|
+
pathOrDescriptor: "layerSessionStorage",
|
|
123
|
+
method: "size",
|
|
124
|
+
message: `Unable to get size`
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
*
|
|
132
|
+
* Also includes exports from [`@effect/platform/KeyValueStore`](https://effect-ts.github.io/platform/platform/KeyValueStore.ts.html).
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Creates a KeyValueStore layer that uses the browser's localStorage api. Values are stored between sessions.
|
|
137
|
+
*
|
|
138
|
+
* @since 1.0.0
|
|
139
|
+
* @category models
|
|
140
|
+
*/
|
|
141
|
+
const layerLocalStorage = layerLocalStorage$1;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Creates a KeyValueStore layer that uses the browser's sessionStorage api. Values are stored only for the current session.
|
|
145
|
+
*
|
|
146
|
+
* @since 1.0.0
|
|
147
|
+
* @category models
|
|
148
|
+
*/
|
|
149
|
+
const layerSessionStorage = layerSessionStorage$1;
|
|
150
|
+
|
|
151
|
+
exports.layerLocalStorage = layerLocalStorage;
|
|
152
|
+
exports.layerSessionStorage = layerSessionStorage;
|
|
16
153
|
Object.keys(KeyValueStore).forEach(function (k) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
154
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function () { return KeyValueStore[k]; }
|
|
157
|
+
});
|
|
21
158
|
});
|