@effect/platform 0.18.7 → 0.19.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/Command/dist/effect-platform-Command.cjs.dev.js +419 -26
- package/Command/dist/effect-platform-Command.cjs.prod.js +419 -26
- package/Command/dist/effect-platform-Command.esm.js +382 -9
- package/CommandExecutor/dist/effect-platform-CommandExecutor.cjs.dev.js +72 -7
- package/CommandExecutor/dist/effect-platform-CommandExecutor.cjs.prod.js +72 -7
- package/CommandExecutor/dist/effect-platform-CommandExecutor.esm.js +71 -2
- package/Effectify/dist/effect-platform-Effectify.cjs.dev.js +55 -3
- package/Effectify/dist/effect-platform-Effectify.cjs.prod.js +55 -3
- package/Effectify/dist/effect-platform-Effectify.esm.js +38 -2
- package/Error/dist/effect-platform-Error.cjs.dev.js +87 -5
- package/Error/dist/effect-platform-Error.cjs.prod.js +87 -5
- package/Error/dist/effect-platform-Error.esm.js +68 -2
- package/FileSystem/dist/effect-platform-FileSystem.cjs.dev.js +287 -20
- package/FileSystem/dist/effect-platform-FileSystem.cjs.prod.js +287 -20
- package/FileSystem/dist/effect-platform-FileSystem.esm.js +256 -9
- package/Http/App/dist/effect-platform-Http-App.cjs.dev.js +15 -0
- package/Http/App/dist/effect-platform-Http-App.cjs.mjs +6 -1
- package/Http/App/dist/effect-platform-Http-App.cjs.prod.js +15 -0
- package/Http/App/dist/effect-platform-Http-App.esm.js +6 -1
- package/Http/Body/dist/effect-platform-Http-Body.cjs.dev.js +4 -4
- package/Http/Body/dist/effect-platform-Http-Body.cjs.prod.js +4 -4
- package/Http/Body/dist/effect-platform-Http-Body.esm.js +4 -4
- package/Http/Client/dist/effect-platform-Http-Client.cjs.dev.js +6 -6
- package/Http/Client/dist/effect-platform-Http-Client.cjs.prod.js +6 -6
- package/Http/Client/dist/effect-platform-Http-Client.esm.js +6 -6
- package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.cjs.dev.js +5 -5
- package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.cjs.prod.js +5 -5
- package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.esm.js +5 -5
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.dev.js +4 -4
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.prod.js +4 -4
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.esm.js +4 -4
- package/Http/FormData/dist/effect-platform-Http-FormData.cjs.dev.js +3 -3
- package/Http/FormData/dist/effect-platform-Http-FormData.cjs.prod.js +3 -3
- package/Http/FormData/dist/effect-platform-Http-FormData.esm.js +3 -3
- package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.dev.js +2 -2
- package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.prod.js +2 -2
- package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js +2 -2
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.dev.js +11 -11
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.mjs +0 -1
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.prod.js +11 -11
- package/Http/Middleware/dist/effect-platform-Http-Middleware.esm.js +11 -10
- package/Http/Platform/dist/effect-platform-Http-Platform.cjs.dev.js +3 -3
- package/Http/Platform/dist/effect-platform-Http-Platform.cjs.prod.js +3 -3
- package/Http/Platform/dist/effect-platform-Http-Platform.esm.js +2 -2
- package/Http/Router/dist/effect-platform-Http-Router.cjs.dev.js +5 -5
- package/Http/Router/dist/effect-platform-Http-Router.cjs.prod.js +5 -5
- package/Http/Router/dist/effect-platform-Http-Router.esm.js +5 -5
- package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.cjs.dev.js +4 -4
- package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.cjs.prod.js +4 -4
- package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.esm.js +4 -4
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.dev.js +4 -4
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.prod.js +4 -4
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.esm.js +4 -4
- package/HttpClient/dist/effect-platform-HttpClient.cjs.dev.js +9 -9
- package/HttpClient/dist/effect-platform-HttpClient.cjs.prod.js +9 -9
- package/HttpClient/dist/effect-platform-HttpClient.esm.js +9 -9
- package/HttpServer/dist/effect-platform-HttpServer.cjs.dev.js +15 -15
- package/HttpServer/dist/effect-platform-HttpServer.cjs.prod.js +15 -15
- package/HttpServer/dist/effect-platform-HttpServer.esm.js +15 -15
- package/KeyValueStore/dist/effect-platform-KeyValueStore.cjs.dev.js +227 -18
- package/KeyValueStore/dist/effect-platform-KeyValueStore.cjs.prod.js +227 -18
- package/KeyValueStore/dist/effect-platform-KeyValueStore.esm.js +199 -10
- package/Path/dist/effect-platform-Path.cjs.dev.js +142 -9
- package/Path/dist/effect-platform-Path.cjs.prod.js +142 -9
- package/Path/dist/effect-platform-Path.esm.js +122 -7
- package/Runtime/dist/effect-platform-Runtime.cjs.dev.js +44 -4
- package/Runtime/dist/effect-platform-Runtime.cjs.prod.js +44 -4
- package/Runtime/dist/effect-platform-Runtime.esm.js +26 -3
- package/dist/App-18152f12.cjs.dev.js +93 -0
- package/dist/App-1ca51fa7.esm.js +65 -0
- package/dist/App-d8b904fa.cjs.prod.js +93 -0
- package/dist/{Body-ec1353f9.esm.js → Body-40ced606.esm.js} +1 -1
- package/dist/{Body-86ef2922.cjs.dev.js → Body-4a7ad057.cjs.dev.js} +1 -1
- package/dist/{Body-b77eac75.cjs.prod.js → Body-c26fa93f.cjs.prod.js} +1 -1
- package/dist/{Client-537f76ae.cjs.prod.js → Client-03fea3d9.cjs.prod.js} +3 -3
- package/dist/{Client-cdbd4ff7.esm.js → Client-55ef15d5.esm.js} +3 -3
- package/dist/{Client-0fbb38ab.cjs.dev.js → Client-c05eadcd.cjs.dev.js} +3 -3
- package/dist/{ClientRequest-fc429335.esm.js → ClientRequest-490c76cd.esm.js} +1 -1
- package/dist/{ClientRequest-750d8d59.cjs.prod.js → ClientRequest-a729f345.cjs.prod.js} +1 -1
- package/dist/{ClientRequest-00e89da8.cjs.dev.js → ClientRequest-c5336a28.cjs.dev.js} +1 -1
- package/dist/{ClientResponse-7e4fe7b5.esm.js → ClientResponse-6e84da40.esm.js} +1 -1
- package/dist/{ClientResponse-f9f19afb.cjs.prod.js → ClientResponse-c19fd519.cjs.prod.js} +1 -1
- package/dist/{ClientResponse-75423399.cjs.dev.js → ClientResponse-df62564e.cjs.dev.js} +1 -1
- package/dist/{FormData-ee0b1cf2.cjs.dev.js → FormData-6d030595.cjs.prod.js} +1 -1
- package/dist/{FormData-902afd18.cjs.prod.js → FormData-7ea13198.cjs.dev.js} +1 -1
- package/dist/{FormData-f54de878.esm.js → FormData-bd727d2f.esm.js} +1 -1
- package/dist/{Middleware-f9a073d7.cjs.prod.js → Middleware-6de1c21d.cjs.prod.js} +14 -20
- package/dist/{Middleware-e2edf820.cjs.dev.js → Middleware-b1d126b4.cjs.dev.js} +14 -20
- package/dist/{Middleware-240f91f6.esm.js → Middleware-d38ef616.esm.js} +15 -20
- package/dist/{Router-bf32317a.esm.js → Router-2ee665b4.esm.js} +2 -2
- package/dist/{Router-bd2b3014.cjs.dev.js → Router-43e62bd9.cjs.dev.js} +2 -2
- package/dist/{Router-6c80a4c9.cjs.prod.js → Router-53ec1aea.cjs.prod.js} +2 -2
- package/dist/{ServerRequest-03161edc.esm.js → ServerRequest-a641c507.esm.js} +1 -1
- package/dist/{ServerRequest-8d9c2c6b.cjs.dev.js → ServerRequest-cb289dae.cjs.dev.js} +1 -1
- package/dist/{ServerRequest-938f3ed0.cjs.prod.js → ServerRequest-ec4da01b.cjs.prod.js} +1 -1
- package/dist/{ServerResponse-93038062.esm.js → ServerResponse-03c252ea.esm.js} +2 -2
- package/dist/{ServerResponse-b63b7192.cjs.dev.js → ServerResponse-9af42ecb.cjs.dev.js} +2 -2
- package/dist/{ServerResponse-eae85b08.cjs.prod.js → ServerResponse-db87bde2.cjs.prod.js} +2 -2
- package/dist/{body-33521da5.cjs.prod.js → body-95276637.cjs.prod.js} +3 -3
- package/dist/{body-c7d7a944.cjs.dev.js → body-cea7c1c9.cjs.dev.js} +3 -3
- package/dist/{body-20d78ec1.esm.js → body-db8cfb3d.esm.js} +1 -1
- package/dist/{clientRequest-3e72ec54.cjs.prod.js → clientRequest-539df396.cjs.prod.js} +1 -1
- package/dist/{clientRequest-1e9e0b0d.esm.js → clientRequest-6121a7f6.esm.js} +1 -1
- package/dist/{clientRequest-423fd562.cjs.dev.js → clientRequest-dae0c34e.cjs.dev.js} +1 -1
- package/dist/declarations/src/Http/App.d.ts +28 -1
- package/dist/declarations/src/Http/App.d.ts.map +1 -1
- package/dist/declarations/src/Http/Middleware.d.ts +0 -5
- package/dist/declarations/src/Http/Middleware.d.ts.map +1 -1
- package/dist/declarations/src/index.d.ts.map +1 -1
- package/dist/effect-platform.cjs.dev.js +49 -68
- package/dist/effect-platform.cjs.prod.js +49 -68
- package/dist/effect-platform.esm.js +20 -58
- package/package.json +8 -5
- package/src/Http/App.ts +76 -3
- package/src/Http/Middleware.ts +0 -6
- package/src/index.ts +10 -10
- package/src/internal/http/middleware.ts +21 -19
- package/src/internal/http/router.ts +1 -1
- package/src/internal/http/serverResponse.ts +1 -1
- package/dist/App-0916639a.cjs.prod.js +0 -7
- package/dist/App-44aa3275.cjs.dev.js +0 -7
- package/dist/App-687366d8.esm.js +0 -5
- package/dist/Command-032c414c.cjs.dev.js +0 -446
- package/dist/Command-25ef5e94.cjs.prod.js +0 -446
- package/dist/Command-d8ab0c8d.esm.js +0 -403
- package/dist/CommandExecutor-158ea1d3.cjs.dev.js +0 -87
- package/dist/CommandExecutor-5807b66b.esm.js +0 -80
- package/dist/CommandExecutor-7fcae408.cjs.prod.js +0 -87
- package/dist/Effectify-2d8c3af9.cjs.dev.js +0 -66
- package/dist/Effectify-38757ba5.cjs.prod.js +0 -66
- package/dist/Effectify-e5a9d266.esm.js +0 -43
- package/dist/Error-09496a70.cjs.dev.js +0 -100
- package/dist/Error-2c4e6ce2.cjs.prod.js +0 -100
- package/dist/Error-3099667c.esm.js +0 -75
- package/dist/FileSystem-3d439a05.cjs.prod.js +0 -308
- package/dist/FileSystem-4c7daaf0.cjs.dev.js +0 -308
- package/dist/FileSystem-7e31dccd.esm.js +0 -271
- package/dist/HttpClient-44d9df26.cjs.prod.js +0 -26
- package/dist/HttpClient-5179b5b7.esm.js +0 -24
- package/dist/HttpClient-6782fcab.cjs.dev.js +0 -26
- package/dist/HttpServer-16159c3a.cjs.dev.js +0 -32
- package/dist/HttpServer-50f8df76.esm.js +0 -30
- package/dist/HttpServer-93c0fbb3.cjs.prod.js +0 -32
- package/dist/KeyValueStore-2f9a70bf.esm.js +0 -210
- package/dist/KeyValueStore-f6c5b981.cjs.prod.js +0 -244
- package/dist/KeyValueStore-f9c93610.cjs.dev.js +0 -244
- package/dist/Path-3574641f.cjs.prod.js +0 -154
- package/dist/Path-46f84ba7.esm.js +0 -128
- package/dist/Path-7ba7e370.cjs.dev.js +0 -154
- package/dist/Runtime-1edd577a.cjs.dev.js +0 -55
- package/dist/Runtime-515efccf.cjs.prod.js +0 -55
- package/dist/Runtime-7265fb98.esm.js +0 -31
- /package/dist/{clientResponse-47df36b8.esm.js → clientResponse-0ace0007.esm.js} +0 -0
- /package/dist/{clientResponse-2e4c45a9.cjs.dev.js → clientResponse-43bb73b9.cjs.dev.js} +0 -0
- /package/dist/{clientResponse-4d53f425.cjs.prod.js → clientResponse-82dae5d8.cjs.prod.js} +0 -0
|
@@ -1,15 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import 'effect/
|
|
4
|
-
import 'effect/
|
|
5
|
-
import 'effect/
|
|
6
|
-
import 'effect/
|
|
7
|
-
import 'effect
|
|
8
|
-
import '../../dist/
|
|
1
|
+
import * as Schema from '@effect/schema/Schema';
|
|
2
|
+
import * as Context from 'effect/Context';
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
import { dual, pipe } from 'effect/Function';
|
|
5
|
+
import * as Layer from 'effect/Layer';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
import { FileSystem } from '../../FileSystem/dist/effect-platform-FileSystem.esm.js';
|
|
8
|
+
import { Path } from '../../Path/dist/effect-platform-Path.esm.js';
|
|
9
9
|
import 'effect/Brand';
|
|
10
10
|
import 'effect/Sink';
|
|
11
11
|
import 'effect/Stream';
|
|
12
|
-
import '../../dist/Error
|
|
12
|
+
import '../../Error/dist/effect-platform-Error.esm.js';
|
|
13
13
|
import 'effect/Data';
|
|
14
|
-
import '../../dist/Path-46f84ba7.esm.js';
|
|
15
14
|
import 'path-browserify';
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
const TypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore");
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
const keyValueStoreTag = /*#__PURE__*/Context.Tag(TypeId$1);
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
const make$1 = impl => keyValueStoreTag.of({
|
|
24
|
+
[TypeId$1]: TypeId$1,
|
|
25
|
+
has: key => Effect.map(impl.get(key), Option.isSome),
|
|
26
|
+
isEmpty: Effect.map(impl.size, size => size === 0),
|
|
27
|
+
modify: (key, f) => Effect.flatMap(impl.get(key), o => {
|
|
28
|
+
if (Option.isNone(o)) {
|
|
29
|
+
return Effect.succeedNone;
|
|
30
|
+
}
|
|
31
|
+
const newValue = f(o.value);
|
|
32
|
+
return Effect.as(impl.set(key, newValue), Option.some(newValue));
|
|
33
|
+
}),
|
|
34
|
+
forSchema(schema) {
|
|
35
|
+
return makeSchemaStore(this, schema);
|
|
36
|
+
},
|
|
37
|
+
...impl
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
const prefix$1 = /*#__PURE__*/dual(2, (self, prefix) => ({
|
|
42
|
+
...self,
|
|
43
|
+
get: key => self.get(`${prefix}${key}`),
|
|
44
|
+
set: (key, value) => self.set(`${prefix}${key}`, value),
|
|
45
|
+
remove: key => self.remove(`${prefix}${key}`),
|
|
46
|
+
has: key => self.has(`${prefix}${key}`),
|
|
47
|
+
modify: (key, f) => self.modify(`${prefix}${key}`, f)
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
const SchemaStoreTypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform/KeyValueStore/SchemaStore");
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
const makeSchemaStore = (store, schema) => {
|
|
55
|
+
const jsonSchema = Schema.compose(Schema.ParseJson, schema);
|
|
56
|
+
const parse = Schema.parse(jsonSchema);
|
|
57
|
+
const encode = Schema.encode(jsonSchema);
|
|
58
|
+
const get = key => Effect.flatMap(store.get(key), Option.match({
|
|
59
|
+
onNone: () => Effect.succeedNone,
|
|
60
|
+
onSome: value => Effect.asSome(parse(value))
|
|
61
|
+
}));
|
|
62
|
+
const set = (key, value) => Effect.flatMap(encode(value), json => store.set(key, json));
|
|
63
|
+
const modify = (key, f) => Effect.flatMap(get(key), o => {
|
|
64
|
+
if (Option.isNone(o)) {
|
|
65
|
+
return Effect.succeedNone;
|
|
66
|
+
}
|
|
67
|
+
const newValue = f(o.value);
|
|
68
|
+
return Effect.as(set(key, newValue), Option.some(newValue));
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
[SchemaStoreTypeId$1]: SchemaStoreTypeId$1,
|
|
72
|
+
get,
|
|
73
|
+
set,
|
|
74
|
+
modify,
|
|
75
|
+
remove: store.remove,
|
|
76
|
+
clear: store.clear,
|
|
77
|
+
size: store.size,
|
|
78
|
+
has: store.has,
|
|
79
|
+
isEmpty: store.isEmpty
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** @internal */
|
|
84
|
+
const layerMemory$1 = /*#__PURE__*/Layer.sync(keyValueStoreTag, () => {
|
|
85
|
+
const store = new Map();
|
|
86
|
+
return make$1({
|
|
87
|
+
get: key => Effect.sync(() => Option.fromNullable(store.get(key))),
|
|
88
|
+
set: (key, value) => Effect.sync(() => store.set(key, value)),
|
|
89
|
+
remove: key => Effect.sync(() => store.delete(key)),
|
|
90
|
+
clear: Effect.sync(() => store.clear()),
|
|
91
|
+
size: Effect.sync(() => store.size)
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/** @internal */
|
|
96
|
+
const layerFileSystem$1 = directory => Layer.effect(keyValueStoreTag, Effect.gen(function* (_) {
|
|
97
|
+
const fs = yield* _(FileSystem);
|
|
98
|
+
const path = yield* _(Path);
|
|
99
|
+
const keyPath = key => path.join(directory, encodeURIComponent(key));
|
|
100
|
+
if (!(yield* _(fs.exists(directory)))) {
|
|
101
|
+
yield* _(fs.makeDirectory(directory, {
|
|
102
|
+
recursive: true
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
return make$1({
|
|
106
|
+
get: key => pipe(Effect.map(fs.readFileString(keyPath(key)), Option.some), Effect.catchTag("SystemError", sysError => sysError.reason === "NotFound" ? Effect.succeed(Option.none()) : Effect.fail(sysError))),
|
|
107
|
+
set: (key, value) => fs.writeFileString(keyPath(key), value),
|
|
108
|
+
remove: key => fs.remove(keyPath(key)),
|
|
109
|
+
has: key => fs.exists(keyPath(key)),
|
|
110
|
+
clear: Effect.zipRight(fs.remove(directory, {
|
|
111
|
+
recursive: true
|
|
112
|
+
}), fs.makeDirectory(directory, {
|
|
113
|
+
recursive: true
|
|
114
|
+
})),
|
|
115
|
+
size: Effect.map(fs.readDirectory(directory), files => files.length)
|
|
116
|
+
});
|
|
117
|
+
}));
|
|
118
|
+
|
|
119
|
+
/** @internal */
|
|
120
|
+
const layerSchema$1 = (schema, tagIdentifier) => {
|
|
121
|
+
const tag = Context.Tag(tagIdentifier);
|
|
122
|
+
const layer = Layer.effect(tag, Effect.map(keyValueStoreTag, store => store.forSchema(schema)));
|
|
123
|
+
return {
|
|
124
|
+
tag,
|
|
125
|
+
layer
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @since 1.0.0
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* @since 1.0.0
|
|
134
|
+
* @category type id
|
|
135
|
+
*/
|
|
136
|
+
const TypeId = TypeId$1;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @since 1.0.0
|
|
140
|
+
* @category type id
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @category models
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @since 1.0.0
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
* @category tags
|
|
155
|
+
*/
|
|
156
|
+
const KeyValueStore = keyValueStoreTag;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @since 1.0.0
|
|
160
|
+
* @category constructors
|
|
161
|
+
*/
|
|
162
|
+
const make = make$1;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @since 1.0.0
|
|
166
|
+
* @category combinators
|
|
167
|
+
*/
|
|
168
|
+
const prefix = prefix$1;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @since 1.0.0
|
|
172
|
+
* @category layers
|
|
173
|
+
*/
|
|
174
|
+
const layerMemory = layerMemory$1;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @since 1.0.0
|
|
178
|
+
* @category layers
|
|
179
|
+
*/
|
|
180
|
+
const layerFileSystem = layerFileSystem$1;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @since 1.0.0
|
|
184
|
+
* @category type id
|
|
185
|
+
*/
|
|
186
|
+
const SchemaStoreTypeId = SchemaStoreTypeId$1;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @since 1.0.0
|
|
190
|
+
* @category type id
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
* @category models
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @since 1.0.0
|
|
200
|
+
* @category layers
|
|
201
|
+
*/
|
|
202
|
+
const layerSchema = layerSchema$1;
|
|
203
|
+
|
|
204
|
+
export { KeyValueStore, SchemaStoreTypeId, TypeId, layerFileSystem, layerMemory, layerSchema, make, prefix };
|
|
@@ -2,16 +2,149 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('effect/
|
|
7
|
-
require('effect/
|
|
8
|
-
require('effect/
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
11
|
-
require('../../dist/Error-09496a70.cjs.dev.js');
|
|
5
|
+
var Context = require('effect/Context');
|
|
6
|
+
var Effect = require('effect/Effect');
|
|
7
|
+
var Function = require('effect/Function');
|
|
8
|
+
var Layer = require('effect/Layer');
|
|
9
|
+
var PathB = require('path-browserify');
|
|
10
|
+
var Error_dist_effectPlatformError = require('../../Error/dist/effect-platform-Error.cjs.dev.js');
|
|
12
11
|
require('effect/Data');
|
|
13
12
|
|
|
13
|
+
function _interopNamespace(e) {
|
|
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
|
+
}
|
|
14
30
|
|
|
31
|
+
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
|
|
32
|
+
var Layer__namespace = /*#__PURE__*/_interopNamespace(Layer);
|
|
33
|
+
var PathB__namespace = /*#__PURE__*/_interopNamespace(PathB);
|
|
15
34
|
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
/** @internal */
|
|
36
|
+
const Path$1 = /*#__PURE__*/Context.Tag("@effect/platform/Path");
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
const layer$1 = /*#__PURE__*/Layer__namespace.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
40
|
+
...PathB__namespace,
|
|
41
|
+
fromFileUrl,
|
|
42
|
+
toFileUrl,
|
|
43
|
+
toNamespacedPath: Function.identity
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The following functions are adapted from the Node.js source code:
|
|
48
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js
|
|
49
|
+
*
|
|
50
|
+
* The following license applies to these functions:
|
|
51
|
+
* - MIT
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
function fromFileUrl(url) {
|
|
55
|
+
if (url.protocol !== "file:") {
|
|
56
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
57
|
+
module: "Path",
|
|
58
|
+
method: "fromFileUrl",
|
|
59
|
+
message: "URL must be of scheme file"
|
|
60
|
+
}));
|
|
61
|
+
} else if (url.hostname !== "") {
|
|
62
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
63
|
+
module: "Path",
|
|
64
|
+
method: "fromFileUrl",
|
|
65
|
+
message: "Invalid file URL host"
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
const pathname = url.pathname;
|
|
69
|
+
for (let n = 0; n < pathname.length; n++) {
|
|
70
|
+
if (pathname[n] === "%") {
|
|
71
|
+
const third = pathname.codePointAt(n + 2) | 0x20;
|
|
72
|
+
if (pathname[n + 1] === "2" && third === 102) {
|
|
73
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
74
|
+
module: "Path",
|
|
75
|
+
method: "fromFileUrl",
|
|
76
|
+
message: "must not include encoded / characters"
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Effect__namespace.succeed(decodeURIComponent(pathname));
|
|
82
|
+
}
|
|
83
|
+
const CHAR_FORWARD_SLASH = 47;
|
|
84
|
+
function toFileUrl(filepath) {
|
|
85
|
+
const outURL = new URL("file://");
|
|
86
|
+
let resolved = PathB__namespace.resolve(filepath);
|
|
87
|
+
// path.resolve strips trailing slashes so we must add them back
|
|
88
|
+
const filePathLast = filepath.charCodeAt(filepath.length - 1);
|
|
89
|
+
if (filePathLast === CHAR_FORWARD_SLASH && resolved[resolved.length - 1] !== "/") {
|
|
90
|
+
resolved += "/";
|
|
91
|
+
}
|
|
92
|
+
outURL.pathname = encodePathChars(resolved);
|
|
93
|
+
return Effect__namespace.succeed(outURL);
|
|
94
|
+
}
|
|
95
|
+
const percentRegEx = /%/g;
|
|
96
|
+
const backslashRegEx = /\\/g;
|
|
97
|
+
const newlineRegEx = /\n/g;
|
|
98
|
+
const carriageReturnRegEx = /\r/g;
|
|
99
|
+
const tabRegEx = /\t/g;
|
|
100
|
+
function encodePathChars(filepath) {
|
|
101
|
+
if (filepath.includes("%")) {
|
|
102
|
+
filepath = filepath.replace(percentRegEx, "%25");
|
|
103
|
+
}
|
|
104
|
+
if (filepath.includes("\\")) {
|
|
105
|
+
filepath = filepath.replace(backslashRegEx, "%5C");
|
|
106
|
+
}
|
|
107
|
+
if (filepath.includes("\n")) {
|
|
108
|
+
filepath = filepath.replace(newlineRegEx, "%0A");
|
|
109
|
+
}
|
|
110
|
+
if (filepath.includes("\r")) {
|
|
111
|
+
filepath = filepath.replace(carriageReturnRegEx, "%0D");
|
|
112
|
+
}
|
|
113
|
+
if (filepath.includes("\t")) {
|
|
114
|
+
filepath = filepath.replace(tabRegEx, "%09");
|
|
115
|
+
}
|
|
116
|
+
return filepath;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
* @category model
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @since 1.0.0
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @since 1.0.0
|
|
134
|
+
* @category tag
|
|
135
|
+
*/
|
|
136
|
+
const Path = Path$1;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* An implementation of the Path interface that can be used in all environments
|
|
140
|
+
* (including browsers).
|
|
141
|
+
*
|
|
142
|
+
* It uses the POSIX standard for paths.
|
|
143
|
+
*
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @category layer
|
|
146
|
+
*/
|
|
147
|
+
const layer = layer$1;
|
|
148
|
+
|
|
149
|
+
exports.Path = Path;
|
|
150
|
+
exports.layer = layer;
|
|
@@ -2,16 +2,149 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('effect/
|
|
7
|
-
require('effect/
|
|
8
|
-
require('effect/
|
|
9
|
-
require('
|
|
10
|
-
require('
|
|
11
|
-
require('../../dist/Error-2c4e6ce2.cjs.prod.js');
|
|
5
|
+
var Context = require('effect/Context');
|
|
6
|
+
var Effect = require('effect/Effect');
|
|
7
|
+
var Function = require('effect/Function');
|
|
8
|
+
var Layer = require('effect/Layer');
|
|
9
|
+
var PathB = require('path-browserify');
|
|
10
|
+
var Error_dist_effectPlatformError = require('../../Error/dist/effect-platform-Error.cjs.prod.js');
|
|
12
11
|
require('effect/Data');
|
|
13
12
|
|
|
13
|
+
function _interopNamespace(e) {
|
|
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
|
+
}
|
|
14
30
|
|
|
31
|
+
var Effect__namespace = /*#__PURE__*/_interopNamespace(Effect);
|
|
32
|
+
var Layer__namespace = /*#__PURE__*/_interopNamespace(Layer);
|
|
33
|
+
var PathB__namespace = /*#__PURE__*/_interopNamespace(PathB);
|
|
15
34
|
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
/** @internal */
|
|
36
|
+
const Path$1 = /*#__PURE__*/Context.Tag("@effect/platform/Path");
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
const layer$1 = /*#__PURE__*/Layer__namespace.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
40
|
+
...PathB__namespace,
|
|
41
|
+
fromFileUrl,
|
|
42
|
+
toFileUrl,
|
|
43
|
+
toNamespacedPath: Function.identity
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The following functions are adapted from the Node.js source code:
|
|
48
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js
|
|
49
|
+
*
|
|
50
|
+
* The following license applies to these functions:
|
|
51
|
+
* - MIT
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
function fromFileUrl(url) {
|
|
55
|
+
if (url.protocol !== "file:") {
|
|
56
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
57
|
+
module: "Path",
|
|
58
|
+
method: "fromFileUrl",
|
|
59
|
+
message: "URL must be of scheme file"
|
|
60
|
+
}));
|
|
61
|
+
} else if (url.hostname !== "") {
|
|
62
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
63
|
+
module: "Path",
|
|
64
|
+
method: "fromFileUrl",
|
|
65
|
+
message: "Invalid file URL host"
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
const pathname = url.pathname;
|
|
69
|
+
for (let n = 0; n < pathname.length; n++) {
|
|
70
|
+
if (pathname[n] === "%") {
|
|
71
|
+
const third = pathname.codePointAt(n + 2) | 0x20;
|
|
72
|
+
if (pathname[n + 1] === "2" && third === 102) {
|
|
73
|
+
return Effect__namespace.fail(Error_dist_effectPlatformError.BadArgument({
|
|
74
|
+
module: "Path",
|
|
75
|
+
method: "fromFileUrl",
|
|
76
|
+
message: "must not include encoded / characters"
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return Effect__namespace.succeed(decodeURIComponent(pathname));
|
|
82
|
+
}
|
|
83
|
+
const CHAR_FORWARD_SLASH = 47;
|
|
84
|
+
function toFileUrl(filepath) {
|
|
85
|
+
const outURL = new URL("file://");
|
|
86
|
+
let resolved = PathB__namespace.resolve(filepath);
|
|
87
|
+
// path.resolve strips trailing slashes so we must add them back
|
|
88
|
+
const filePathLast = filepath.charCodeAt(filepath.length - 1);
|
|
89
|
+
if (filePathLast === CHAR_FORWARD_SLASH && resolved[resolved.length - 1] !== "/") {
|
|
90
|
+
resolved += "/";
|
|
91
|
+
}
|
|
92
|
+
outURL.pathname = encodePathChars(resolved);
|
|
93
|
+
return Effect__namespace.succeed(outURL);
|
|
94
|
+
}
|
|
95
|
+
const percentRegEx = /%/g;
|
|
96
|
+
const backslashRegEx = /\\/g;
|
|
97
|
+
const newlineRegEx = /\n/g;
|
|
98
|
+
const carriageReturnRegEx = /\r/g;
|
|
99
|
+
const tabRegEx = /\t/g;
|
|
100
|
+
function encodePathChars(filepath) {
|
|
101
|
+
if (filepath.includes("%")) {
|
|
102
|
+
filepath = filepath.replace(percentRegEx, "%25");
|
|
103
|
+
}
|
|
104
|
+
if (filepath.includes("\\")) {
|
|
105
|
+
filepath = filepath.replace(backslashRegEx, "%5C");
|
|
106
|
+
}
|
|
107
|
+
if (filepath.includes("\n")) {
|
|
108
|
+
filepath = filepath.replace(newlineRegEx, "%0A");
|
|
109
|
+
}
|
|
110
|
+
if (filepath.includes("\r")) {
|
|
111
|
+
filepath = filepath.replace(carriageReturnRegEx, "%0D");
|
|
112
|
+
}
|
|
113
|
+
if (filepath.includes("\t")) {
|
|
114
|
+
filepath = filepath.replace(tabRegEx, "%09");
|
|
115
|
+
}
|
|
116
|
+
return filepath;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
* @category model
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @since 1.0.0
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @since 1.0.0
|
|
134
|
+
* @category tag
|
|
135
|
+
*/
|
|
136
|
+
const Path = Path$1;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* An implementation of the Path interface that can be used in all environments
|
|
140
|
+
* (including browsers).
|
|
141
|
+
*
|
|
142
|
+
* It uses the POSIX standard for paths.
|
|
143
|
+
*
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @category layer
|
|
146
|
+
*/
|
|
147
|
+
const layer = layer$1;
|
|
148
|
+
|
|
149
|
+
exports.Path = Path;
|
|
150
|
+
exports.layer = layer;
|
|
@@ -1,8 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
import 'effect/
|
|
3
|
-
import 'effect/
|
|
4
|
-
import 'effect/
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import '../../dist/Error-3099667c.esm.js';
|
|
1
|
+
import { Tag } from 'effect/Context';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import { identity } from 'effect/Function';
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
import * as PathB from 'path-browserify';
|
|
6
|
+
import { BadArgument } from '../../Error/dist/effect-platform-Error.esm.js';
|
|
8
7
|
import 'effect/Data';
|
|
8
|
+
|
|
9
|
+
/** @internal */
|
|
10
|
+
const Path$1 = /*#__PURE__*/Tag("@effect/platform/Path");
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
14
|
+
...PathB,
|
|
15
|
+
fromFileUrl,
|
|
16
|
+
toFileUrl,
|
|
17
|
+
toNamespacedPath: identity
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The following functions are adapted from the Node.js source code:
|
|
22
|
+
* https://github.com/nodejs/node/blob/main/lib/internal/url.js
|
|
23
|
+
*
|
|
24
|
+
* The following license applies to these functions:
|
|
25
|
+
* - MIT
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
function fromFileUrl(url) {
|
|
29
|
+
if (url.protocol !== "file:") {
|
|
30
|
+
return Effect.fail(BadArgument({
|
|
31
|
+
module: "Path",
|
|
32
|
+
method: "fromFileUrl",
|
|
33
|
+
message: "URL must be of scheme file"
|
|
34
|
+
}));
|
|
35
|
+
} else if (url.hostname !== "") {
|
|
36
|
+
return Effect.fail(BadArgument({
|
|
37
|
+
module: "Path",
|
|
38
|
+
method: "fromFileUrl",
|
|
39
|
+
message: "Invalid file URL host"
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
const pathname = url.pathname;
|
|
43
|
+
for (let n = 0; n < pathname.length; n++) {
|
|
44
|
+
if (pathname[n] === "%") {
|
|
45
|
+
const third = pathname.codePointAt(n + 2) | 0x20;
|
|
46
|
+
if (pathname[n + 1] === "2" && third === 102) {
|
|
47
|
+
return Effect.fail(BadArgument({
|
|
48
|
+
module: "Path",
|
|
49
|
+
method: "fromFileUrl",
|
|
50
|
+
message: "must not include encoded / characters"
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return Effect.succeed(decodeURIComponent(pathname));
|
|
56
|
+
}
|
|
57
|
+
const CHAR_FORWARD_SLASH = 47;
|
|
58
|
+
function toFileUrl(filepath) {
|
|
59
|
+
const outURL = new URL("file://");
|
|
60
|
+
let resolved = PathB.resolve(filepath);
|
|
61
|
+
// path.resolve strips trailing slashes so we must add them back
|
|
62
|
+
const filePathLast = filepath.charCodeAt(filepath.length - 1);
|
|
63
|
+
if (filePathLast === CHAR_FORWARD_SLASH && resolved[resolved.length - 1] !== "/") {
|
|
64
|
+
resolved += "/";
|
|
65
|
+
}
|
|
66
|
+
outURL.pathname = encodePathChars(resolved);
|
|
67
|
+
return Effect.succeed(outURL);
|
|
68
|
+
}
|
|
69
|
+
const percentRegEx = /%/g;
|
|
70
|
+
const backslashRegEx = /\\/g;
|
|
71
|
+
const newlineRegEx = /\n/g;
|
|
72
|
+
const carriageReturnRegEx = /\r/g;
|
|
73
|
+
const tabRegEx = /\t/g;
|
|
74
|
+
function encodePathChars(filepath) {
|
|
75
|
+
if (filepath.includes("%")) {
|
|
76
|
+
filepath = filepath.replace(percentRegEx, "%25");
|
|
77
|
+
}
|
|
78
|
+
if (filepath.includes("\\")) {
|
|
79
|
+
filepath = filepath.replace(backslashRegEx, "%5C");
|
|
80
|
+
}
|
|
81
|
+
if (filepath.includes("\n")) {
|
|
82
|
+
filepath = filepath.replace(newlineRegEx, "%0A");
|
|
83
|
+
}
|
|
84
|
+
if (filepath.includes("\r")) {
|
|
85
|
+
filepath = filepath.replace(carriageReturnRegEx, "%0D");
|
|
86
|
+
}
|
|
87
|
+
if (filepath.includes("\t")) {
|
|
88
|
+
filepath = filepath.replace(tabRegEx, "%09");
|
|
89
|
+
}
|
|
90
|
+
return filepath;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @since 1.0.0
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @since 1.0.0
|
|
99
|
+
* @category model
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @since 1.0.0
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @since 1.0.0
|
|
108
|
+
* @category tag
|
|
109
|
+
*/
|
|
110
|
+
const Path = Path$1;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* An implementation of the Path interface that can be used in all environments
|
|
114
|
+
* (including browsers).
|
|
115
|
+
*
|
|
116
|
+
* It uses the POSIX standard for paths.
|
|
117
|
+
*
|
|
118
|
+
* @since 1.0.0
|
|
119
|
+
* @category layer
|
|
120
|
+
*/
|
|
121
|
+
const layer = layer$1;
|
|
122
|
+
|
|
123
|
+
export { Path, layer };
|