effect-start 0.23.1 → 0.26.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/package.json +18 -86
- package/src/Development.ts +3 -1
- package/src/Entity.ts +17 -0
- package/src/Fetch.ts +271 -0
- package/src/SqlIntrospect.ts +64 -70
- package/src/Start.ts +21 -24
- package/src/StartApp.ts +1 -1
- package/src/bun/BunServer.ts +42 -10
- package/src/hyper/HyperHtml.ts +0 -1
- package/src/sql/bun/index.ts +1 -1
- package/src/sql/index.ts +1 -0
- package/src/sql/libsql/index.ts +173 -0
- package/src/sql/libsql/libsql.d.ts +39 -0
- package/src/sql/mssql/index.ts +1 -1
- package/dist/BlobStore.d.ts +0 -80
- package/dist/BlobStore.js +0 -19
- package/dist/ChildProcess.d.ts +0 -60
- package/dist/ChildProcess.js +0 -30
- package/dist/Commander.d.ts +0 -100
- package/dist/Commander.js +0 -326
- package/dist/ContentNegotiation.d.ts +0 -12
- package/dist/ContentNegotiation.js +0 -359
- package/dist/Cookies.d.ts +0 -47
- package/dist/Cookies.js +0 -302
- package/dist/Development.d.ts +0 -39
- package/dist/Development.js +0 -58
- package/dist/Effectify.d.ts +0 -209
- package/dist/Effectify.js +0 -19
- package/dist/Entity.d.ts +0 -47
- package/dist/Entity.js +0 -224
- package/dist/FilePathPattern.d.ts +0 -29
- package/dist/FilePathPattern.js +0 -86
- package/dist/FileRouter.d.ts +0 -56
- package/dist/FileRouter.js +0 -148
- package/dist/FileRouterCodegen.d.ts +0 -18
- package/dist/FileRouterCodegen.js +0 -227
- package/dist/FileRouterPattern.d.ts +0 -9
- package/dist/FileRouterPattern.js +0 -35
- package/dist/FileSystem.d.ts +0 -158
- package/dist/FileSystem.js +0 -70
- package/dist/Http.d.ts +0 -37
- package/dist/Http.js +0 -88
- package/dist/HttpAppExtra.d.ts +0 -7
- package/dist/HttpAppExtra.js +0 -320
- package/dist/HttpUtils.d.ts +0 -3
- package/dist/HttpUtils.js +0 -11
- package/dist/PathPattern.d.ts +0 -134
- package/dist/PathPattern.js +0 -413
- package/dist/PlatformError.d.ts +0 -38
- package/dist/PlatformError.js +0 -25
- package/dist/PlatformRuntime.d.ts +0 -27
- package/dist/PlatformRuntime.js +0 -46
- package/dist/Route.d.ts +0 -97
- package/dist/Route.js +0 -100
- package/dist/RouteBody.d.ts +0 -47
- package/dist/RouteBody.js +0 -67
- package/dist/RouteError.d.ts +0 -98
- package/dist/RouteError.js +0 -55
- package/dist/RouteHook.d.ts +0 -12
- package/dist/RouteHook.js +0 -40
- package/dist/RouteHttp.d.ts +0 -21
- package/dist/RouteHttp.js +0 -258
- package/dist/RouteHttpTracer.d.ts +0 -10
- package/dist/RouteHttpTracer.js +0 -62
- package/dist/RouteMount.d.ts +0 -86
- package/dist/RouteMount.js +0 -63
- package/dist/RouteSchema.d.ts +0 -86
- package/dist/RouteSchema.js +0 -188
- package/dist/RouteSse.d.ts +0 -21
- package/dist/RouteSse.js +0 -79
- package/dist/RouteTree.d.ts +0 -57
- package/dist/RouteTree.js +0 -93
- package/dist/RouteTrie.d.ts +0 -20
- package/dist/RouteTrie.js +0 -152
- package/dist/RouterPattern.d.ts +0 -118
- package/dist/RouterPattern.js +0 -269
- package/dist/SchemaExtra.d.ts +0 -7
- package/dist/SchemaExtra.js +0 -74
- package/dist/Socket.d.ts +0 -27
- package/dist/Socket.js +0 -29
- package/dist/Sql.d.ts +0 -34
- package/dist/Sql.js +0 -5
- package/dist/SqlIntrospect.d.ts +0 -91
- package/dist/SqlIntrospect.js +0 -466
- package/dist/Start.d.ts +0 -44
- package/dist/Start.js +0 -49
- package/dist/StartApp.d.ts +0 -19
- package/dist/StartApp.js +0 -21
- package/dist/StreamExtra.d.ts +0 -28
- package/dist/StreamExtra.js +0 -100
- package/dist/System.d.ts +0 -7
- package/dist/System.js +0 -22
- package/dist/TuplePathPattern.d.ts +0 -9
- package/dist/TuplePathPattern.js +0 -68
- package/dist/Unique.d.ts +0 -50
- package/dist/Unique.js +0 -187
- package/dist/Values.d.ts +0 -27
- package/dist/Values.js +0 -36
- package/dist/bun/BunBlobStoreDisk.d.ts +0 -6
- package/dist/bun/BunBlobStoreDisk.js +0 -116
- package/dist/bun/BunBlobStoreS3.d.ts +0 -11
- package/dist/bun/BunBlobStoreS3.js +0 -89
- package/dist/bun/BunBlobWatcherDisk.d.ts +0 -6
- package/dist/bun/BunBlobWatcherDisk.js +0 -60
- package/dist/bun/BunBlobWatcherQueue.d.ts +0 -6
- package/dist/bun/BunBlobWatcherQueue.js +0 -17
- package/dist/bun/BunBundle.d.ts +0 -11
- package/dist/bun/BunBundle.js +0 -137
- package/dist/bun/BunChildProcessSpawner.d.ts +0 -3
- package/dist/bun/BunChildProcessSpawner.js +0 -103
- package/dist/bun/BunHttpServer.d.ts +0 -44
- package/dist/bun/BunHttpServer.js +0 -186
- package/dist/bun/BunHttpServer_web.d.ts +0 -60
- package/dist/bun/BunHttpServer_web.js +0 -252
- package/dist/bun/BunImportTrackerPlugin.d.ts +0 -13
- package/dist/bun/BunImportTrackerPlugin.js +0 -69
- package/dist/bun/BunPlatformHttpServer.d.ts +0 -10
- package/dist/bun/BunPlatformHttpServer.js +0 -53
- package/dist/bun/BunRoute.d.ts +0 -48
- package/dist/bun/BunRoute.js +0 -121
- package/dist/bun/BunRuntime.d.ts +0 -2
- package/dist/bun/BunRuntime.js +0 -31
- package/dist/bun/BunServer.d.ts +0 -40
- package/dist/bun/BunServer.js +0 -157
- package/dist/bun/BunServerRequest.d.ts +0 -60
- package/dist/bun/BunServerRequest.js +0 -252
- package/dist/bun/BunSql.d.ts +0 -4
- package/dist/bun/BunSql.js +0 -81
- package/dist/bun/BunVirtualFilesPlugin.d.ts +0 -4
- package/dist/bun/BunVirtualFilesPlugin.js +0 -40
- package/dist/bun/_BunEnhancedResolve.d.ts +0 -45
- package/dist/bun/_BunEnhancedResolve.js +0 -102
- package/dist/bun/index.d.ts +0 -5
- package/dist/bun/index.js +0 -5
- package/dist/bundler/Bundle.d.ts +0 -61
- package/dist/bundler/Bundle.js +0 -48
- package/dist/bundler/BundleFiles.d.ts +0 -13
- package/dist/bundler/BundleFiles.js +0 -96
- package/dist/bundler/BundleHttp.d.ts +0 -45
- package/dist/bundler/BundleHttp.js +0 -176
- package/dist/bundler/BundleRoute.d.ts +0 -27
- package/dist/bundler/BundleRoute.js +0 -51
- package/dist/client/Overlay.d.ts +0 -2
- package/dist/client/Overlay.js +0 -32
- package/dist/client/ScrollState.d.ts +0 -6
- package/dist/client/ScrollState.js +0 -94
- package/dist/client/index.d.ts +0 -6
- package/dist/client/index.js +0 -79
- package/dist/console/Console.d.ts +0 -6
- package/dist/console/Console.js +0 -26
- package/dist/console/ConsoleErrors.d.ts +0 -3
- package/dist/console/ConsoleErrors.js +0 -200
- package/dist/console/ConsoleLogger.d.ts +0 -3
- package/dist/console/ConsoleLogger.js +0 -47
- package/dist/console/ConsoleMetrics.d.ts +0 -3
- package/dist/console/ConsoleMetrics.js +0 -61
- package/dist/console/ConsoleProcess.d.ts +0 -3
- package/dist/console/ConsoleProcess.js +0 -49
- package/dist/console/ConsoleStore.d.ts +0 -144
- package/dist/console/ConsoleStore.js +0 -61
- package/dist/console/ConsoleTracer.d.ts +0 -3
- package/dist/console/ConsoleTracer.js +0 -94
- package/dist/console/Simulation.d.ts +0 -2
- package/dist/console/Simulation.js +0 -633
- package/dist/console/index.d.ts +0 -3
- package/dist/console/index.js +0 -3
- package/dist/console/routes/errors/route.d.ts +0 -10
- package/dist/console/routes/errors/route.js +0 -47
- package/dist/console/routes/fiberDetail.d.ts +0 -16
- package/dist/console/routes/fiberDetail.js +0 -38
- package/dist/console/routes/fibers/route.d.ts +0 -10
- package/dist/console/routes/fibers/route.js +0 -19
- package/dist/console/routes/git/route.d.ts +0 -11
- package/dist/console/routes/git/route.js +0 -33
- package/dist/console/routes/layout.d.ts +0 -9
- package/dist/console/routes/layout.js +0 -3
- package/dist/console/routes/logs/route.d.ts +0 -10
- package/dist/console/routes/logs/route.js +0 -32
- package/dist/console/routes/metrics/route.d.ts +0 -10
- package/dist/console/routes/metrics/route.js +0 -17
- package/dist/console/routes/route.d.ts +0 -6
- package/dist/console/routes/route.js +0 -5
- package/dist/console/routes/routes/route.d.ts +0 -6
- package/dist/console/routes/routes/route.js +0 -20
- package/dist/console/routes/services/route.d.ts +0 -6
- package/dist/console/routes/services/route.js +0 -12
- package/dist/console/routes/system/route.d.ts +0 -10
- package/dist/console/routes/system/route.js +0 -18
- package/dist/console/routes/traceDetail.d.ts +0 -16
- package/dist/console/routes/traceDetail.js +0 -14
- package/dist/console/routes/traces/route.d.ts +0 -10
- package/dist/console/routes/traces/route.js +0 -39
- package/dist/console/routes/tree.d.ts +0 -153
- package/dist/console/routes/tree.js +0 -29
- package/dist/console/ui/Errors.d.ts +0 -4
- package/dist/console/ui/Errors.js +0 -15
- package/dist/console/ui/Fibers.d.ts +0 -24
- package/dist/console/ui/Fibers.js +0 -121
- package/dist/console/ui/Git.d.ts +0 -20
- package/dist/console/ui/Git.js +0 -95
- package/dist/console/ui/Logs.d.ts +0 -4
- package/dist/console/ui/Logs.js +0 -25
- package/dist/console/ui/Metrics.d.ts +0 -4
- package/dist/console/ui/Metrics.js +0 -26
- package/dist/console/ui/Routes.d.ts +0 -8
- package/dist/console/ui/Routes.js +0 -70
- package/dist/console/ui/Services.d.ts +0 -10
- package/dist/console/ui/Services.js +0 -246
- package/dist/console/ui/Shell.d.ts +0 -10
- package/dist/console/ui/Shell.js +0 -7
- package/dist/console/ui/System.d.ts +0 -4
- package/dist/console/ui/System.js +0 -35
- package/dist/console/ui/Traces.d.ts +0 -12
- package/dist/console/ui/Traces.js +0 -179
- package/dist/datastar/actions/fetch.d.ts +0 -30
- package/dist/datastar/actions/fetch.js +0 -403
- package/dist/datastar/actions/peek.d.ts +0 -1
- package/dist/datastar/actions/peek.js +0 -13
- package/dist/datastar/actions/setAll.d.ts +0 -1
- package/dist/datastar/actions/setAll.js +0 -12
- package/dist/datastar/actions/toggleAll.d.ts +0 -1
- package/dist/datastar/actions/toggleAll.js +0 -12
- package/dist/datastar/attributes/attr.d.ts +0 -1
- package/dist/datastar/attributes/attr.js +0 -48
- package/dist/datastar/attributes/bind.d.ts +0 -1
- package/dist/datastar/attributes/bind.js +0 -175
- package/dist/datastar/attributes/class.d.ts +0 -1
- package/dist/datastar/attributes/class.js +0 -47
- package/dist/datastar/attributes/computed.d.ts +0 -1
- package/dist/datastar/attributes/computed.js +0 -26
- package/dist/datastar/attributes/effect.d.ts +0 -1
- package/dist/datastar/attributes/effect.js +0 -9
- package/dist/datastar/attributes/indicator.d.ts +0 -1
- package/dist/datastar/attributes/indicator.js +0 -30
- package/dist/datastar/attributes/init.d.ts +0 -1
- package/dist/datastar/attributes/init.js +0 -26
- package/dist/datastar/attributes/jsonSignals.d.ts +0 -1
- package/dist/datastar/attributes/jsonSignals.js +0 -30
- package/dist/datastar/attributes/on.d.ts +0 -1
- package/dist/datastar/attributes/on.js +0 -78
- package/dist/datastar/attributes/onIntersect.d.ts +0 -1
- package/dist/datastar/attributes/onIntersect.js +0 -53
- package/dist/datastar/attributes/onInterval.d.ts +0 -1
- package/dist/datastar/attributes/onInterval.js +0 -30
- package/dist/datastar/attributes/onSignalPatch.d.ts +0 -1
- package/dist/datastar/attributes/onSignalPatch.js +0 -42
- package/dist/datastar/attributes/ref.d.ts +0 -1
- package/dist/datastar/attributes/ref.js +0 -10
- package/dist/datastar/attributes/show.d.ts +0 -1
- package/dist/datastar/attributes/show.js +0 -31
- package/dist/datastar/attributes/signals.d.ts +0 -1
- package/dist/datastar/attributes/signals.js +0 -17
- package/dist/datastar/attributes/style.d.ts +0 -1
- package/dist/datastar/attributes/style.js +0 -50
- package/dist/datastar/attributes/text.d.ts +0 -1
- package/dist/datastar/attributes/text.js +0 -26
- package/dist/datastar/engine.d.ts +0 -162
- package/dist/datastar/engine.js +0 -999
- package/dist/datastar/happydom.d.ts +0 -1
- package/dist/datastar/happydom.js +0 -8
- package/dist/datastar/index.d.ts +0 -24
- package/dist/datastar/index.js +0 -24
- package/dist/datastar/load.d.ts +0 -24
- package/dist/datastar/load.js +0 -24
- package/dist/datastar/utils.d.ts +0 -51
- package/dist/datastar/utils.js +0 -202
- package/dist/datastar/watchers/patchElements.d.ts +0 -1
- package/dist/datastar/watchers/patchElements.js +0 -399
- package/dist/datastar/watchers/patchSignals.d.ts +0 -1
- package/dist/datastar/watchers/patchSignals.js +0 -14
- package/dist/experimental/EncryptedCookies.d.ts +0 -48
- package/dist/experimental/EncryptedCookies.js +0 -212
- package/dist/experimental/SseHttpResponse.d.ts +0 -7
- package/dist/experimental/SseHttpResponse.js +0 -28
- package/dist/experimental/index.d.ts +0 -1
- package/dist/experimental/index.js +0 -1
- package/dist/hyper/Hyper.d.ts +0 -25
- package/dist/hyper/Hyper.js +0 -23
- package/dist/hyper/HyperHtml.d.ts +0 -23
- package/dist/hyper/HyperHtml.js +0 -150
- package/dist/hyper/HyperHtml.test.d.ts +0 -1
- package/dist/hyper/HyperHtml.test.js +0 -197
- package/dist/hyper/HyperNode.d.ts +0 -14
- package/dist/hyper/HyperNode.js +0 -11
- package/dist/hyper/HyperRoute.d.ts +0 -8
- package/dist/hyper/HyperRoute.js +0 -32
- package/dist/hyper/HyperRoute.test.d.ts +0 -1
- package/dist/hyper/HyperRoute.test.js +0 -83
- package/dist/hyper/html.d.ts +0 -11
- package/dist/hyper/html.js +0 -30
- package/dist/hyper/index.d.ts +0 -6
- package/dist/hyper/index.js +0 -5
- package/dist/hyper/jsx-runtime.d.ts +0 -7
- package/dist/hyper/jsx-runtime.js +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/inference_check.d.ts +0 -1
- package/dist/inference_check.js +0 -15
- package/dist/lint/plugin.d.ts +0 -86
- package/dist/lint/plugin.js +0 -341
- package/dist/middlewares/BasicAuthMiddleware.d.ts +0 -8
- package/dist/middlewares/BasicAuthMiddleware.js +0 -22
- package/dist/middlewares/index.d.ts +0 -1
- package/dist/middlewares/index.js +0 -1
- package/dist/node/Effectify.d.ts +0 -209
- package/dist/node/Effectify.js +0 -19
- package/dist/node/FileSystem.d.ts +0 -7
- package/dist/node/FileSystem.js +0 -420
- package/dist/node/NodeFileSystem.d.ts +0 -7
- package/dist/node/NodeFileSystem.js +0 -410
- package/dist/node/NodeUtils.d.ts +0 -2
- package/dist/node/NodeUtils.js +0 -20
- package/dist/node/PlatformError.d.ts +0 -46
- package/dist/node/PlatformError.js +0 -43
- package/dist/node/Utils.d.ts +0 -1
- package/dist/node/Utils.js +0 -19
- package/dist/repro_fail.d.ts +0 -1
- package/dist/repro_fail.js +0 -14
- package/dist/sql/bun/index.d.ts +0 -3
- package/dist/sql/bun/index.js +0 -75
- package/dist/sql/mssql/docker.d.ts +0 -2
- package/dist/sql/mssql/docker.js +0 -67
- package/dist/sql/mssql/index.d.ts +0 -21
- package/dist/sql/mssql/index.js +0 -113
- package/dist/testing/TestHttpClient.d.ts +0 -13
- package/dist/testing/TestHttpClient.js +0 -68
- package/dist/testing/TestLogger.d.ts +0 -13
- package/dist/testing/TestLogger.js +0 -32
- package/dist/testing/index.d.ts +0 -2
- package/dist/testing/index.js +0 -2
- package/dist/testing/utils.d.ts +0 -9
- package/dist/testing/utils.js +0 -39
- package/dist/x/cloudflare/CloudflareTunnel.d.ts +0 -10
- package/dist/x/cloudflare/CloudflareTunnel.js +0 -30
- package/dist/x/cloudflare/index.d.ts +0 -1
- package/dist/x/cloudflare/index.js +0 -1
- package/dist/x/datastar/Datastar.d.ts +0 -6
- package/dist/x/datastar/Datastar.js +0 -47
- package/dist/x/datastar/index.d.ts +0 -1
- package/dist/x/datastar/index.js +0 -1
- package/dist/x/tailscale/TailscaleTunnel.d.ts +0 -15
- package/dist/x/tailscale/TailscaleTunnel.js +0 -68
- package/dist/x/tailscale/index.d.ts +0 -1
- package/dist/x/tailscale/index.js +0 -1
- package/dist/x/tailwind/TailwindPlugin.d.ts +0 -23
- package/dist/x/tailwind/TailwindPlugin.js +0 -219
- package/dist/x/tailwind/compile.d.ts +0 -19
- package/dist/x/tailwind/compile.js +0 -154
- package/dist/x/tailwind/plugin.d.ts +0 -2
- package/dist/x/tailwind/plugin.js +0 -15
- /package/src/{Sql.ts → sql/Sql.ts} +0 -0
package/dist/node/Effectify.d.ts
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
interface Callback<E, A> {
|
|
3
|
-
(err: E, a?: A): void;
|
|
4
|
-
}
|
|
5
|
-
type ArgsWithCallback<Args extends Array<any>, E, A> = [...args: Args, cb: Callback<E, A>];
|
|
6
|
-
type WithoutNull<A> = unknown extends A ? void : Exclude<A, null | undefined>;
|
|
7
|
-
type Effectify<T, E> = T extends {
|
|
8
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
9
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
10
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
11
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
12
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
13
|
-
(...args: ArgsWithCallback<infer Args6, infer _E6, infer A6>): infer _R6;
|
|
14
|
-
(...args: ArgsWithCallback<infer Args7, infer _E7, infer A7>): infer _R7;
|
|
15
|
-
(...args: ArgsWithCallback<infer Args8, infer _E8, infer A8>): infer _R8;
|
|
16
|
-
(...args: ArgsWithCallback<infer Args9, infer _E9, infer A9>): infer _R9;
|
|
17
|
-
(...args: ArgsWithCallback<infer Args10, infer _E10, infer A10>): infer _R10;
|
|
18
|
-
} ? {
|
|
19
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
20
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
21
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
22
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
23
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
24
|
-
(...args: Args6): Effect.Effect<WithoutNull<A6>, E>;
|
|
25
|
-
(...args: Args7): Effect.Effect<WithoutNull<A7>, E>;
|
|
26
|
-
(...args: Args8): Effect.Effect<WithoutNull<A8>, E>;
|
|
27
|
-
(...args: Args9): Effect.Effect<WithoutNull<A9>, E>;
|
|
28
|
-
(...args: Args10): Effect.Effect<WithoutNull<A10>, E>;
|
|
29
|
-
} : T extends {
|
|
30
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
31
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
32
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
33
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
34
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
35
|
-
(...args: ArgsWithCallback<infer Args6, infer _E6, infer A6>): infer _R6;
|
|
36
|
-
(...args: ArgsWithCallback<infer Args7, infer _E7, infer A7>): infer _R7;
|
|
37
|
-
(...args: ArgsWithCallback<infer Args8, infer _E8, infer A8>): infer _R8;
|
|
38
|
-
(...args: ArgsWithCallback<infer Args9, infer _E9, infer A9>): infer _R9;
|
|
39
|
-
} ? {
|
|
40
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
41
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
42
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
43
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
44
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
45
|
-
(...args: Args6): Effect.Effect<WithoutNull<A6>, E>;
|
|
46
|
-
(...args: Args7): Effect.Effect<WithoutNull<A7>, E>;
|
|
47
|
-
(...args: Args8): Effect.Effect<WithoutNull<A8>, E>;
|
|
48
|
-
(...args: Args9): Effect.Effect<WithoutNull<A9>, E>;
|
|
49
|
-
} : T extends {
|
|
50
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
51
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
52
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
53
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
54
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
55
|
-
(...args: ArgsWithCallback<infer Args6, infer _E6, infer A6>): infer _R6;
|
|
56
|
-
(...args: ArgsWithCallback<infer Args7, infer _E7, infer A7>): infer _R7;
|
|
57
|
-
(...args: ArgsWithCallback<infer Args8, infer _E8, infer A8>): infer _R8;
|
|
58
|
-
} ? {
|
|
59
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
60
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
61
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
62
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
63
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
64
|
-
(...args: Args6): Effect.Effect<WithoutNull<A6>, E>;
|
|
65
|
-
(...args: Args7): Effect.Effect<WithoutNull<A7>, E>;
|
|
66
|
-
(...args: Args8): Effect.Effect<WithoutNull<A8>, E>;
|
|
67
|
-
} : T extends {
|
|
68
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
69
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
70
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
71
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
72
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
73
|
-
(...args: ArgsWithCallback<infer Args6, infer _E6, infer A6>): infer _R6;
|
|
74
|
-
(...args: ArgsWithCallback<infer Args7, infer _E7, infer A7>): infer _R7;
|
|
75
|
-
} ? {
|
|
76
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
77
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
78
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
79
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
80
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
81
|
-
(...args: Args6): Effect.Effect<WithoutNull<A6>, E>;
|
|
82
|
-
(...args: Args7): Effect.Effect<WithoutNull<A7>, E>;
|
|
83
|
-
} : T extends {
|
|
84
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
85
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
86
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
87
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
88
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
89
|
-
(...args: ArgsWithCallback<infer Args6, infer _E6, infer A6>): infer _R6;
|
|
90
|
-
} ? {
|
|
91
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
92
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
93
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
94
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
95
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
96
|
-
(...args: Args6): Effect.Effect<WithoutNull<A6>, E>;
|
|
97
|
-
} : T extends {
|
|
98
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
99
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
100
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
101
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
102
|
-
(...args: ArgsWithCallback<infer Args5, infer _E5, infer A5>): infer _R5;
|
|
103
|
-
} ? {
|
|
104
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
105
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
106
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
107
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
108
|
-
(...args: Args5): Effect.Effect<WithoutNull<A5>, E>;
|
|
109
|
-
} : T extends {
|
|
110
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
111
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
112
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
113
|
-
(...args: ArgsWithCallback<infer Args4, infer _E4, infer A4>): infer _R4;
|
|
114
|
-
} ? {
|
|
115
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
116
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
117
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
118
|
-
(...args: Args4): Effect.Effect<WithoutNull<A4>, E>;
|
|
119
|
-
} : T extends {
|
|
120
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
121
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
122
|
-
(...args: ArgsWithCallback<infer Args3, infer _E3, infer A3>): infer _R3;
|
|
123
|
-
} ? {
|
|
124
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
125
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
126
|
-
(...args: Args3): Effect.Effect<WithoutNull<A3>, E>;
|
|
127
|
-
} : T extends {
|
|
128
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
129
|
-
(...args: ArgsWithCallback<infer Args2, infer _E2, infer A2>): infer _R2;
|
|
130
|
-
} ? {
|
|
131
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
132
|
-
(...args: Args2): Effect.Effect<WithoutNull<A2>, E>;
|
|
133
|
-
} : T extends {
|
|
134
|
-
(...args: ArgsWithCallback<infer Args1, infer _E1, infer A1>): infer _R1;
|
|
135
|
-
} ? {
|
|
136
|
-
(...args: Args1): Effect.Effect<WithoutNull<A1>, E>;
|
|
137
|
-
} : never;
|
|
138
|
-
type EffectifyError<T> = T extends {
|
|
139
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
140
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
141
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
142
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
143
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
144
|
-
(...args: ArgsWithCallback<infer _Args6, infer E6, infer _A6>): infer _R6;
|
|
145
|
-
(...args: ArgsWithCallback<infer _Args7, infer E7, infer _A7>): infer _R7;
|
|
146
|
-
(...args: ArgsWithCallback<infer _Args8, infer E8, infer _A8>): infer _R8;
|
|
147
|
-
(...args: ArgsWithCallback<infer _Args9, infer E9, infer _A9>): infer _R9;
|
|
148
|
-
(...args: ArgsWithCallback<infer _Args10, infer E10, infer _A10>): infer _R10;
|
|
149
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5 | E6 | E7 | E8 | E9 | E10> : T extends {
|
|
150
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
151
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
152
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
153
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
154
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
155
|
-
(...args: ArgsWithCallback<infer _Args6, infer E6, infer _A6>): infer _R6;
|
|
156
|
-
(...args: ArgsWithCallback<infer _Args7, infer E7, infer _A7>): infer _R7;
|
|
157
|
-
(...args: ArgsWithCallback<infer _Args8, infer E8, infer _A8>): infer _R8;
|
|
158
|
-
(...args: ArgsWithCallback<infer _Args9, infer E9, infer _A9>): infer _R9;
|
|
159
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5 | E6 | E7 | E8 | E9> : T extends {
|
|
160
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
161
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
162
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
163
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
164
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
165
|
-
(...args: ArgsWithCallback<infer _Args6, infer E6, infer _A6>): infer _R6;
|
|
166
|
-
(...args: ArgsWithCallback<infer _Args7, infer E7, infer _A7>): infer _R7;
|
|
167
|
-
(...args: ArgsWithCallback<infer _Args8, infer E8, infer _A8>): infer _R8;
|
|
168
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5 | E6 | E7 | E8> : T extends {
|
|
169
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
170
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
171
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
172
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
173
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
174
|
-
(...args: ArgsWithCallback<infer _Args6, infer E6, infer _A6>): infer _R6;
|
|
175
|
-
(...args: ArgsWithCallback<infer _Args7, infer E7, infer _A7>): infer _R7;
|
|
176
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5 | E6 | E7> : T extends {
|
|
177
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
178
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
179
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
180
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
181
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
182
|
-
(...args: ArgsWithCallback<infer _Args6, infer E6, infer _A6>): infer _R6;
|
|
183
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5 | E6> : T extends {
|
|
184
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
185
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
186
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
187
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
188
|
-
(...args: ArgsWithCallback<infer _Args5, infer E5, infer _A5>): infer _R5;
|
|
189
|
-
} ? NonNullable<E1 | E2 | E3 | E4 | E5> : T extends {
|
|
190
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
191
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
192
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
193
|
-
(...args: ArgsWithCallback<infer _Args4, infer E4, infer _A4>): infer _R4;
|
|
194
|
-
} ? NonNullable<E1 | E2 | E3 | E4> : T extends {
|
|
195
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
196
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
197
|
-
(...args: ArgsWithCallback<infer _Args3, infer E3, infer _A3>): infer _R3;
|
|
198
|
-
} ? NonNullable<E1 | E2 | E3> : T extends {
|
|
199
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
200
|
-
(...args: ArgsWithCallback<infer _Args2, infer E2, infer _A2>): infer _R2;
|
|
201
|
-
} ? NonNullable<E1 | E2> : T extends {
|
|
202
|
-
(...args: ArgsWithCallback<infer _Args1, infer E1, infer _A1>): infer _R1;
|
|
203
|
-
} ? NonNullable<E1> : never;
|
|
204
|
-
export declare const effectify: {
|
|
205
|
-
<F extends (...args: Array<any>) => any>(fn: F): Effectify<F, EffectifyError<F>>;
|
|
206
|
-
<F extends (...args: Array<any>) => any, E>(fn: F, onError: (error: EffectifyError<F>, args: Parameters<F>) => E): Effectify<F, E>;
|
|
207
|
-
<F extends (...args: Array<any>) => any, E, E2>(fn: F, onError: (error: EffectifyError<F>, args: Parameters<F>) => E, onSyncError: (error: unknown, args: Parameters<F>) => E2): Effectify<F, E | E2>;
|
|
208
|
-
};
|
|
209
|
-
export {};
|
package/dist/node/Effectify.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Adapted from @effect/platform
|
|
3
|
-
*/
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
export const effectify = ((fn, onError, onSyncError) => (...args) => Effect.async((resume) => {
|
|
6
|
-
try {
|
|
7
|
-
fn(...args, (err, result) => {
|
|
8
|
-
if (err) {
|
|
9
|
-
resume(Effect.fail(onError ? onError(err, args) : err));
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
resume(Effect.succeed(result));
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
resume(onSyncError ? Effect.fail(onSyncError(err, args)) : Effect.die(err));
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as FileSystem from "@effect/platform/FileSystem";
|
|
2
|
-
import * as Layer from "effect/Layer";
|
|
3
|
-
import * as NFS from "node:fs";
|
|
4
|
-
import * as PlatformError from "./PlatformError.ts";
|
|
5
|
-
export declare const layer: Layer.Layer<FileSystem.FileSystem, never, never>;
|
|
6
|
-
export { FileSystem, PlatformError as Error, };
|
|
7
|
-
export declare function handleErrnoException(module: PlatformError.SystemError["module"], method: string): (err: NodeJS.ErrnoException, [path]: [path: NFS.PathLike | number, ...args: Array<any>]) => PlatformError.PlatformError;
|
package/dist/node/FileSystem.js
DELETED
|
@@ -1,420 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Adapted from @effect/platform
|
|
3
|
-
*/
|
|
4
|
-
import * as FileSystem from "@effect/platform/FileSystem";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Function from "effect/Function";
|
|
7
|
-
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as Option from "effect/Option";
|
|
9
|
-
import * as Stream from "effect/Stream";
|
|
10
|
-
import * as NCrypto from "node:crypto";
|
|
11
|
-
import * as NFS from "node:fs";
|
|
12
|
-
import * as NOS from "node:os";
|
|
13
|
-
import * as NPath from "node:path";
|
|
14
|
-
import * as Effectify from "./Effectify.js";
|
|
15
|
-
import * as PlatformError from "./PlatformError.js";
|
|
16
|
-
const handleBadArgument = (method) => (cause) => new PlatformError.BadArgument({
|
|
17
|
-
module: "FileSystem",
|
|
18
|
-
method,
|
|
19
|
-
cause,
|
|
20
|
-
});
|
|
21
|
-
const access = (() => {
|
|
22
|
-
const nodeAccess = Effectify.effectify(NFS.access, handleErrnoException("FileSystem", "access"), handleBadArgument("access"));
|
|
23
|
-
return (path, options) => {
|
|
24
|
-
let mode = NFS.constants.F_OK;
|
|
25
|
-
if (options?.readable) {
|
|
26
|
-
mode |= NFS.constants.R_OK;
|
|
27
|
-
}
|
|
28
|
-
if (options?.writable) {
|
|
29
|
-
mode |= NFS.constants.W_OK;
|
|
30
|
-
}
|
|
31
|
-
return nodeAccess(path, mode);
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
const copy = (() => {
|
|
35
|
-
const nodeCp = Effectify.effectify(NFS.cp, handleErrnoException("FileSystem", "copy"), handleBadArgument("copy"));
|
|
36
|
-
return (fromPath, toPath, options) => nodeCp(fromPath, toPath, {
|
|
37
|
-
force: options?.overwrite ?? false,
|
|
38
|
-
preserveTimestamps: options?.preserveTimestamps ?? false,
|
|
39
|
-
recursive: true,
|
|
40
|
-
});
|
|
41
|
-
})();
|
|
42
|
-
const copyFile = (() => {
|
|
43
|
-
const nodeCopyFile = Effectify.effectify(NFS.copyFile, handleErrnoException("FileSystem", "copyFile"), handleBadArgument("copyFile"));
|
|
44
|
-
return (fromPath, toPath) => nodeCopyFile(fromPath, toPath);
|
|
45
|
-
})();
|
|
46
|
-
const chmod = (() => {
|
|
47
|
-
const nodeChmod = Effectify.effectify(NFS.chmod, handleErrnoException("FileSystem", "chmod"), handleBadArgument("chmod"));
|
|
48
|
-
return (path, mode) => nodeChmod(path, mode);
|
|
49
|
-
})();
|
|
50
|
-
const chown = (() => {
|
|
51
|
-
const nodeChown = Effectify.effectify(NFS.chown, handleErrnoException("FileSystem", "chown"), handleBadArgument("chown"));
|
|
52
|
-
return (path, uid, gid) => nodeChown(path, uid, gid);
|
|
53
|
-
})();
|
|
54
|
-
const link = (() => {
|
|
55
|
-
const nodeLink = Effectify.effectify(NFS.link, handleErrnoException("FileSystem", "link"), handleBadArgument("link"));
|
|
56
|
-
return (existingPath, newPath) => nodeLink(existingPath, newPath);
|
|
57
|
-
})();
|
|
58
|
-
const makeDirectory = (() => {
|
|
59
|
-
const nodeMkdir = Effectify.effectify(NFS.mkdir, handleErrnoException("FileSystem", "makeDirectory"), handleBadArgument("makeDirectory"));
|
|
60
|
-
return (path, options) => nodeMkdir(path, {
|
|
61
|
-
recursive: options?.recursive ?? false,
|
|
62
|
-
mode: options?.mode,
|
|
63
|
-
});
|
|
64
|
-
})();
|
|
65
|
-
const makeTempDirectoryFactory = (method) => {
|
|
66
|
-
const nodeMkdtemp = Effectify.effectify(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
67
|
-
return (options) => Effect.suspend(() => {
|
|
68
|
-
const prefix = options?.prefix ?? "";
|
|
69
|
-
const directory = typeof options?.directory === "string"
|
|
70
|
-
? NPath.join(options.directory, ".")
|
|
71
|
-
: NOS.tmpdir();
|
|
72
|
-
return nodeMkdtemp(prefix ? NPath.join(directory, prefix) : directory + "/");
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
const makeTempDirectory = makeTempDirectoryFactory("makeTempDirectory");
|
|
76
|
-
const removeFactory = (method) => {
|
|
77
|
-
const nodeRm = Effectify.effectify(NFS.rm, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
78
|
-
return (path, options) => nodeRm(path, {
|
|
79
|
-
recursive: options?.recursive ?? false,
|
|
80
|
-
force: options?.force ?? false,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
const remove = removeFactory("remove");
|
|
84
|
-
const makeTempDirectoryScoped = (() => {
|
|
85
|
-
const makeDirectory = makeTempDirectoryFactory("makeTempDirectoryScoped");
|
|
86
|
-
const removeDirectory = removeFactory("makeTempDirectoryScoped");
|
|
87
|
-
return (options) => Effect.acquireRelease(makeDirectory(options), (directory) => Effect.orDie(removeDirectory(directory, { recursive: true })));
|
|
88
|
-
})();
|
|
89
|
-
const openFactory = (method) => {
|
|
90
|
-
const nodeOpen = Effectify.effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
91
|
-
const nodeClose = Effectify.effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
92
|
-
return (path, options) => Function.pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => Effect.orDie(nodeClose(fd))), Effect.map((fd) => makeFile(FileSystem.FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
93
|
-
};
|
|
94
|
-
const open = openFactory("open");
|
|
95
|
-
const makeFile = (() => {
|
|
96
|
-
const nodeReadFactory = (method) => Effectify.effectify(NFS.read, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
97
|
-
const nodeRead = nodeReadFactory("read");
|
|
98
|
-
const nodeReadAlloc = nodeReadFactory("readAlloc");
|
|
99
|
-
const nodeStat = Effectify.effectify(NFS.fstat, handleErrnoException("FileSystem", "stat"), handleBadArgument("stat"));
|
|
100
|
-
const nodeTruncate = Effectify.effectify(NFS.ftruncate, handleErrnoException("FileSystem", "truncate"), handleBadArgument("truncate"));
|
|
101
|
-
const nodeSync = Effectify.effectify(NFS.fsync, handleErrnoException("FileSystem", "sync"), handleBadArgument("sync"));
|
|
102
|
-
const nodeWriteFactory = (method) => Effectify.effectify(NFS.write, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
103
|
-
const nodeWrite = nodeWriteFactory("write");
|
|
104
|
-
const nodeWriteAll = nodeWriteFactory("writeAll");
|
|
105
|
-
class FileImpl {
|
|
106
|
-
[FileSystem.FileTypeId];
|
|
107
|
-
fd;
|
|
108
|
-
append;
|
|
109
|
-
semaphore = Effect.unsafeMakeSemaphore(1);
|
|
110
|
-
position = 0n;
|
|
111
|
-
constructor(fd, append) {
|
|
112
|
-
this[FileSystem.FileTypeId] = FileSystem.FileTypeId;
|
|
113
|
-
this.fd = fd;
|
|
114
|
-
this.append = append;
|
|
115
|
-
}
|
|
116
|
-
get stat() {
|
|
117
|
-
return Effect.map(nodeStat(this.fd), makeFileInfo);
|
|
118
|
-
}
|
|
119
|
-
get sync() {
|
|
120
|
-
return nodeSync(this.fd);
|
|
121
|
-
}
|
|
122
|
-
seek(offset, from) {
|
|
123
|
-
const offsetSize = FileSystem.Size(offset);
|
|
124
|
-
return this.semaphore.withPermits(1)(Effect.sync(() => {
|
|
125
|
-
if (from === "start") {
|
|
126
|
-
this.position = offsetSize;
|
|
127
|
-
}
|
|
128
|
-
else if (from === "current") {
|
|
129
|
-
this.position = this.position + offsetSize;
|
|
130
|
-
}
|
|
131
|
-
return this.position;
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
read(buffer) {
|
|
135
|
-
return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeRead(this.fd, {
|
|
136
|
-
buffer,
|
|
137
|
-
position: this.position,
|
|
138
|
-
})), (bytesRead) => {
|
|
139
|
-
const sizeRead = FileSystem.Size(bytesRead);
|
|
140
|
-
this.position = this.position + sizeRead;
|
|
141
|
-
return sizeRead;
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
readAlloc(size) {
|
|
145
|
-
const sizeNumber = Number(size);
|
|
146
|
-
return this.semaphore.withPermits(1)(Effect.flatMap(Effect.sync(() => Buffer.allocUnsafeSlow(sizeNumber)), (buffer) => Effect.map(nodeReadAlloc(this.fd, {
|
|
147
|
-
buffer,
|
|
148
|
-
position: this.position,
|
|
149
|
-
}), (bytesRead) => {
|
|
150
|
-
if (bytesRead === 0) {
|
|
151
|
-
return Option.none();
|
|
152
|
-
}
|
|
153
|
-
this.position = this.position + BigInt(bytesRead);
|
|
154
|
-
if (bytesRead === sizeNumber) {
|
|
155
|
-
return Option.some(buffer);
|
|
156
|
-
}
|
|
157
|
-
const dst = Buffer.allocUnsafeSlow(bytesRead);
|
|
158
|
-
buffer.copy(dst, 0, 0, bytesRead);
|
|
159
|
-
return Option.some(dst);
|
|
160
|
-
})));
|
|
161
|
-
}
|
|
162
|
-
truncate(length) {
|
|
163
|
-
return this.semaphore.withPermits(1)(Effect.map(nodeTruncate(this.fd, length ? Number(length) : undefined), () => {
|
|
164
|
-
if (!this.append) {
|
|
165
|
-
const len = BigInt(length ?? 0);
|
|
166
|
-
if (this.position > len) {
|
|
167
|
-
this.position = len;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}));
|
|
171
|
-
}
|
|
172
|
-
write(buffer) {
|
|
173
|
-
return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeWrite(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(this.position))), (bytesWritten) => {
|
|
174
|
-
const sizeWritten = FileSystem.Size(bytesWritten);
|
|
175
|
-
if (!this.append) {
|
|
176
|
-
this.position = this.position + sizeWritten;
|
|
177
|
-
}
|
|
178
|
-
return sizeWritten;
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
|
-
writeAllChunk(buffer) {
|
|
182
|
-
return Effect.flatMap(Effect.suspend(() => nodeWriteAll(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(this.position))), (bytesWritten) => {
|
|
183
|
-
if (bytesWritten === 0) {
|
|
184
|
-
return Effect.fail(new PlatformError.SystemError({
|
|
185
|
-
module: "FileSystem",
|
|
186
|
-
method: "writeAll",
|
|
187
|
-
reason: "WriteZero",
|
|
188
|
-
pathOrDescriptor: this.fd,
|
|
189
|
-
description: "write returned 0 bytes written",
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
if (!this.append) {
|
|
193
|
-
this.position = this.position + BigInt(bytesWritten);
|
|
194
|
-
}
|
|
195
|
-
return bytesWritten < buffer.length
|
|
196
|
-
? this.writeAllChunk(buffer.subarray(bytesWritten))
|
|
197
|
-
: Effect.void;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
writeAll(buffer) {
|
|
201
|
-
return this.semaphore.withPermits(1)(this.writeAllChunk(buffer));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return (fd, append) => new FileImpl(fd, append);
|
|
205
|
-
})();
|
|
206
|
-
const makeTempFileFactory = (method) => {
|
|
207
|
-
const makeDirectory = makeTempDirectoryFactory(method);
|
|
208
|
-
const open = openFactory(method);
|
|
209
|
-
const randomHexString = (bytes) => Effect.sync(() => NCrypto.randomBytes(bytes).toString("hex"));
|
|
210
|
-
return (options) => Function.pipe(Effect.zip(makeDirectory(options), randomHexString(6)), Effect.map(([directory, random]) => NPath.join(directory, random + (options?.suffix ?? ""))), Effect.tap((path) => Effect.scoped(open(path, { flag: "w+" }))));
|
|
211
|
-
};
|
|
212
|
-
const makeTempFile = makeTempFileFactory("makeTempFile");
|
|
213
|
-
const makeTempFileScoped = (() => {
|
|
214
|
-
const makeFile = makeTempFileFactory("makeTempFileScoped");
|
|
215
|
-
const removeDirectory = removeFactory("makeTempFileScoped");
|
|
216
|
-
return (options) => Effect.acquireRelease(makeFile(options), (file) => Effect.orDie(removeDirectory(NPath.dirname(file), { recursive: true })));
|
|
217
|
-
})();
|
|
218
|
-
const readDirectory = (path, options) => Effect.tryPromise({
|
|
219
|
-
try: () => NFS.promises.readdir(path, options),
|
|
220
|
-
catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path]),
|
|
221
|
-
});
|
|
222
|
-
const readFile = (path) => Effect.async((resume, signal) => {
|
|
223
|
-
try {
|
|
224
|
-
NFS.readFile(path, { signal }, (err, data) => {
|
|
225
|
-
if (err) {
|
|
226
|
-
resume(Effect.fail(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
resume(Effect.succeed(data));
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
catch (err) {
|
|
234
|
-
resume(Effect.fail(handleBadArgument("readFile")(err)));
|
|
235
|
-
}
|
|
236
|
-
});
|
|
237
|
-
const readLink = (() => {
|
|
238
|
-
const nodeReadLink = Effectify.effectify(NFS.readlink, handleErrnoException("FileSystem", "readLink"), handleBadArgument("readLink"));
|
|
239
|
-
return (path) => nodeReadLink(path);
|
|
240
|
-
})();
|
|
241
|
-
const realPath = (() => {
|
|
242
|
-
const nodeRealPath = Effectify.effectify(NFS.realpath, handleErrnoException("FileSystem", "realPath"), handleBadArgument("realPath"));
|
|
243
|
-
return (path) => nodeRealPath(path);
|
|
244
|
-
})();
|
|
245
|
-
const rename = (() => {
|
|
246
|
-
const nodeRename = Effectify.effectify(NFS.rename, handleErrnoException("FileSystem", "rename"), handleBadArgument("rename"));
|
|
247
|
-
return (oldPath, newPath) => nodeRename(oldPath, newPath);
|
|
248
|
-
})();
|
|
249
|
-
const makeFileInfo = (stat) => ({
|
|
250
|
-
type: stat.isFile()
|
|
251
|
-
? "File"
|
|
252
|
-
: stat.isDirectory()
|
|
253
|
-
? "Directory"
|
|
254
|
-
: stat.isSymbolicLink()
|
|
255
|
-
? "SymbolicLink"
|
|
256
|
-
: stat.isBlockDevice()
|
|
257
|
-
? "BlockDevice"
|
|
258
|
-
: stat.isCharacterDevice()
|
|
259
|
-
? "CharacterDevice"
|
|
260
|
-
: stat.isFIFO()
|
|
261
|
-
? "FIFO"
|
|
262
|
-
: stat.isSocket()
|
|
263
|
-
? "Socket"
|
|
264
|
-
: "Unknown",
|
|
265
|
-
mtime: Option.fromNullable(stat.mtime),
|
|
266
|
-
atime: Option.fromNullable(stat.atime),
|
|
267
|
-
birthtime: Option.fromNullable(stat.birthtime),
|
|
268
|
-
dev: stat.dev,
|
|
269
|
-
rdev: Option.fromNullable(stat.rdev),
|
|
270
|
-
ino: Option.fromNullable(stat.ino),
|
|
271
|
-
mode: stat.mode,
|
|
272
|
-
nlink: Option.fromNullable(stat.nlink),
|
|
273
|
-
uid: Option.fromNullable(stat.uid),
|
|
274
|
-
gid: Option.fromNullable(stat.gid),
|
|
275
|
-
size: FileSystem.Size(stat.size),
|
|
276
|
-
blksize: Option.map(Option.fromNullable(stat.blksize), FileSystem.Size),
|
|
277
|
-
blocks: Option.fromNullable(stat.blocks),
|
|
278
|
-
});
|
|
279
|
-
const stat = (() => {
|
|
280
|
-
const nodeStat = Effectify.effectify(NFS.stat, handleErrnoException("FileSystem", "stat"), handleBadArgument("stat"));
|
|
281
|
-
return (path) => Effect.map(nodeStat(path), makeFileInfo);
|
|
282
|
-
})();
|
|
283
|
-
const symlink = (() => {
|
|
284
|
-
const nodeSymlink = Effectify.effectify(NFS.symlink, handleErrnoException("FileSystem", "symlink"), handleBadArgument("symlink"));
|
|
285
|
-
return (target, path) => nodeSymlink(target, path);
|
|
286
|
-
})();
|
|
287
|
-
const truncate = (() => {
|
|
288
|
-
const nodeTruncate = Effectify.effectify(NFS.truncate, handleErrnoException("FileSystem", "truncate"), handleBadArgument("truncate"));
|
|
289
|
-
return (path, length) => nodeTruncate(path, length !== undefined ? Number(length) : undefined);
|
|
290
|
-
})();
|
|
291
|
-
const utimes = (() => {
|
|
292
|
-
const nodeUtimes = Effectify.effectify(NFS.utimes, handleErrnoException("FileSystem", "utime"), handleBadArgument("utime"));
|
|
293
|
-
return (path, atime, mtime) => nodeUtimes(path, atime, mtime);
|
|
294
|
-
})();
|
|
295
|
-
const watchNode = (path, options) => Stream.asyncScoped((emit) => Effect.acquireRelease(Effect.sync(() => {
|
|
296
|
-
const watcher = NFS.watch(path, { recursive: options?.recursive }, (event, path) => {
|
|
297
|
-
if (!path)
|
|
298
|
-
return;
|
|
299
|
-
switch (event) {
|
|
300
|
-
case "rename": {
|
|
301
|
-
emit.fromEffect(Effect.matchEffect(stat(path), {
|
|
302
|
-
onSuccess: (_) => Effect.succeed(FileSystem.WatchEventCreate({ path })),
|
|
303
|
-
onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound"
|
|
304
|
-
? Effect.succeed(FileSystem.WatchEventRemove({ path }))
|
|
305
|
-
: Effect.fail(err),
|
|
306
|
-
}));
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
case "change": {
|
|
310
|
-
emit.single(FileSystem.WatchEventUpdate({ path }));
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
watcher.on("error", (error) => {
|
|
316
|
-
emit.fail(new PlatformError.SystemError({
|
|
317
|
-
module: "FileSystem",
|
|
318
|
-
reason: "Unknown",
|
|
319
|
-
method: "watch",
|
|
320
|
-
pathOrDescriptor: path,
|
|
321
|
-
cause: error,
|
|
322
|
-
}));
|
|
323
|
-
});
|
|
324
|
-
watcher.on("close", () => {
|
|
325
|
-
emit.end();
|
|
326
|
-
});
|
|
327
|
-
return watcher;
|
|
328
|
-
}), (watcher) => Effect.sync(() => watcher.close())));
|
|
329
|
-
const watch = (backend, path, options) => stat(path).pipe(Effect.map((stat) => backend.pipe(Option.flatMap((_) => _.register(path, stat, options)), Option.getOrElse(() => watchNode(path, options)))), Stream.unwrap);
|
|
330
|
-
const writeFile = (path, data, options) => Effect.async((resume, signal) => {
|
|
331
|
-
try {
|
|
332
|
-
NFS.writeFile(path, data, {
|
|
333
|
-
signal,
|
|
334
|
-
flag: options?.flag,
|
|
335
|
-
mode: options?.mode,
|
|
336
|
-
}, (err) => {
|
|
337
|
-
if (err) {
|
|
338
|
-
resume(Effect.fail(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
resume(Effect.void);
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
catch (err) {
|
|
346
|
-
resume(Effect.fail(handleBadArgument("writeFile")(err)));
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
const make = Effect.map(Effect.serviceOption(FileSystem.WatchBackend), (backend) => FileSystem.make({
|
|
350
|
-
access,
|
|
351
|
-
chmod,
|
|
352
|
-
chown,
|
|
353
|
-
copy,
|
|
354
|
-
copyFile,
|
|
355
|
-
link,
|
|
356
|
-
makeDirectory,
|
|
357
|
-
makeTempDirectory,
|
|
358
|
-
makeTempDirectoryScoped,
|
|
359
|
-
makeTempFile,
|
|
360
|
-
makeTempFileScoped,
|
|
361
|
-
open,
|
|
362
|
-
readDirectory,
|
|
363
|
-
readFile,
|
|
364
|
-
readLink,
|
|
365
|
-
realPath,
|
|
366
|
-
remove,
|
|
367
|
-
rename,
|
|
368
|
-
stat,
|
|
369
|
-
symlink,
|
|
370
|
-
truncate,
|
|
371
|
-
utimes,
|
|
372
|
-
watch(path, options) {
|
|
373
|
-
return watch(backend, path, options);
|
|
374
|
-
},
|
|
375
|
-
writeFile,
|
|
376
|
-
}));
|
|
377
|
-
export const layer = Layer.unwrapEffect(Effect
|
|
378
|
-
.gen(function* () {
|
|
379
|
-
const mod = yield* Effect.tryPromise(() => import("@effect/platform/FileSystem"));
|
|
380
|
-
return Layer.effect(mod.FileSystem, make);
|
|
381
|
-
})
|
|
382
|
-
.pipe(Effect.catchAll(() => Effect.die(new globalThis.Error("@effect/platform is not installed")))));
|
|
383
|
-
export { FileSystem, PlatformError as Error, };
|
|
384
|
-
export function handleErrnoException(module, method) {
|
|
385
|
-
return function (err, [path]) {
|
|
386
|
-
let reason = "Unknown";
|
|
387
|
-
switch (err.code) {
|
|
388
|
-
case "ENOENT":
|
|
389
|
-
reason = "NotFound";
|
|
390
|
-
break;
|
|
391
|
-
case "EACCES":
|
|
392
|
-
reason = "PermissionDenied";
|
|
393
|
-
break;
|
|
394
|
-
case "EEXIST":
|
|
395
|
-
reason = "AlreadyExists";
|
|
396
|
-
break;
|
|
397
|
-
case "EISDIR":
|
|
398
|
-
reason = "BadResource";
|
|
399
|
-
break;
|
|
400
|
-
case "ENOTDIR":
|
|
401
|
-
reason = "BadResource";
|
|
402
|
-
break;
|
|
403
|
-
case "EBUSY":
|
|
404
|
-
reason = "Busy";
|
|
405
|
-
break;
|
|
406
|
-
case "ELOOP":
|
|
407
|
-
reason = "BadResource";
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
return new PlatformError.SystemError({
|
|
411
|
-
reason,
|
|
412
|
-
module,
|
|
413
|
-
method,
|
|
414
|
-
pathOrDescriptor: path,
|
|
415
|
-
syscall: err.syscall,
|
|
416
|
-
description: err.message,
|
|
417
|
-
cause: err,
|
|
418
|
-
});
|
|
419
|
-
};
|
|
420
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as Layer from "effect/Layer";
|
|
2
|
-
import * as FileSystem from "../FileSystem.ts";
|
|
3
|
-
import * as NFS from "node:fs";
|
|
4
|
-
import * as PlatformError from "../PlatformError.ts";
|
|
5
|
-
export declare const layer: Layer.Layer<FileSystem.FileSystem, never, never>;
|
|
6
|
-
export { PlatformError as Error };
|
|
7
|
-
export declare function handleErrnoException(module: PlatformError.SystemError["module"], method: string): (err: NodeJS.ErrnoException, [path]: [path: NFS.PathLike | number, ...args: Array<any>]) => PlatformError.PlatformError;
|