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/RouterPattern.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
export type RouterPattern = `/${string}`;
|
|
2
|
-
export type ParamDelimiter = "_" | "-" | "." | "," | ";" | "!" | "@" | "~";
|
|
3
|
-
export type ParamPrefix = `${string}${ParamDelimiter}` | "";
|
|
4
|
-
export type ParamSuffix = `${ParamDelimiter}${string}` | "";
|
|
5
|
-
export type LiteralSegment<Value extends string = string> = {
|
|
6
|
-
_tag: "LiteralSegment";
|
|
7
|
-
value: Value;
|
|
8
|
-
};
|
|
9
|
-
export type ParamSegment<Name extends string = string, Optional extends boolean = boolean, Prefix extends ParamPrefix = "", Suffix extends ParamSuffix = ""> = {
|
|
10
|
-
_tag: "ParamSegment";
|
|
11
|
-
name: Name;
|
|
12
|
-
optional?: Optional;
|
|
13
|
-
prefix?: Prefix;
|
|
14
|
-
suffix?: Suffix;
|
|
15
|
-
};
|
|
16
|
-
export type RestSegment<Name extends string = string, Optional extends boolean = boolean> = {
|
|
17
|
-
_tag: "RestSegment";
|
|
18
|
-
name: Name;
|
|
19
|
-
optional?: Optional;
|
|
20
|
-
};
|
|
21
|
-
export type Segment = LiteralSegment | ParamSegment<string, boolean, ParamPrefix, ParamSuffix> | RestSegment;
|
|
22
|
-
/**
|
|
23
|
-
* Parses a route path string into a tuple of Segment types at compile time.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* ```ts
|
|
27
|
-
* type Usage = Segments<"/users/[id]/posts/[...rest]">
|
|
28
|
-
* type Expected = [
|
|
29
|
-
* LiteralSegment<"users">,
|
|
30
|
-
* ParamSegment<"id", false>,
|
|
31
|
-
* LiteralSegment<"posts">,
|
|
32
|
-
* RestSegment<"rest", false>
|
|
33
|
-
* ]
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* Supports:
|
|
37
|
-
* - Literals: `users` → `LiteralSegment<"users">`
|
|
38
|
-
* - Params: `[id]` → `ParamSegment<"id", false>`
|
|
39
|
-
* - Params (optional): `[[id]]` → `ParamSegment<"id", true>`
|
|
40
|
-
* - Rest: `[...rest]` → `RestSegment<"rest", false>`
|
|
41
|
-
* - Rest (optional): `[[...rest]]` → `RestSegment<"rest", true>`
|
|
42
|
-
* - {Pre,Suf}fixed params: `prefix_[id]_suffix` → `ParamSegment<"id", false, "prefix_", "_suffix">`
|
|
43
|
-
* - Malformed segments: `pk_[id]foo` → `undefined` (suffix must start with delimiter)
|
|
44
|
-
*
|
|
45
|
-
* @limit Paths with more than 48 segments in TypeScript 5.9.3 will fail with
|
|
46
|
-
* `TS2589: Type instantiation is excessively deep and possibly infinite`.
|
|
47
|
-
*/
|
|
48
|
-
export type Segments<Path extends string> = Path extends `/${infer PathRest}` ? Segments<PathRest> : Path extends `${infer Head}/${infer Tail}` ? [ExtractSegment<Head>, ...Segments<Tail>] : Path extends "" ? [] : [ExtractSegment<Path>];
|
|
49
|
-
export declare function parseSegment(segment: string): Segment | null;
|
|
50
|
-
export declare function parse(pattern: string): Segment[];
|
|
51
|
-
export declare function formatSegment(seg: Segment): string;
|
|
52
|
-
export declare function format(segments: Segment[]): `/${string}`;
|
|
53
|
-
/**
|
|
54
|
-
* Converts to colon-style path pattern (used by Hono, Bun, itty-router).
|
|
55
|
-
*
|
|
56
|
-
* - `[param]` → `:param`
|
|
57
|
-
* - `[[param]]` → `:param?`
|
|
58
|
-
* - `[...param]` → `*`
|
|
59
|
-
* - `[[...param]]` → `/`, `/*`
|
|
60
|
-
* - `pk_[id]` → `pk_:id`
|
|
61
|
-
*/
|
|
62
|
-
export declare function toColon(path: RouterPattern): string[];
|
|
63
|
-
export declare const toHono: typeof toColon;
|
|
64
|
-
/**
|
|
65
|
-
* Converts to Express path pattern.
|
|
66
|
-
*
|
|
67
|
-
* - `[param]` → `:param`
|
|
68
|
-
* - `[[param]]` → `{/:param}`
|
|
69
|
-
* - `[...param]` → `/*param`
|
|
70
|
-
* - `[[...param]]` → `/`, `/*param`
|
|
71
|
-
* - `pk_[id]` → `pk_:id`
|
|
72
|
-
*/
|
|
73
|
-
export declare function toExpress(path: RouterPattern): string[];
|
|
74
|
-
/**
|
|
75
|
-
* Converts to Effect HttpRouter/find-my-way path pattern.
|
|
76
|
-
*
|
|
77
|
-
* - `[param]` → `:param`
|
|
78
|
-
* - `[[param]]` → `:param?` (must be final segment)
|
|
79
|
-
* - `[...param]` → `*`
|
|
80
|
-
* - `[[...param]]` → `/`, `/*`
|
|
81
|
-
* - `pk_[id]` → `pk_:id`
|
|
82
|
-
*/
|
|
83
|
-
export declare function toEffect(path: RouterPattern): string[];
|
|
84
|
-
/**
|
|
85
|
-
* Converts to URLPattern path pattern.
|
|
86
|
-
*
|
|
87
|
-
* - `[param]` → `:param`
|
|
88
|
-
* - `[[param]]` → `:param?`
|
|
89
|
-
* - `[...param]` → `:param+`
|
|
90
|
-
* - `[[...param]]` → `:param*`
|
|
91
|
-
* - `pk_[id]` → `pk_:id`
|
|
92
|
-
*/
|
|
93
|
-
export declare function toURLPattern(path: RouterPattern): string[];
|
|
94
|
-
/**
|
|
95
|
-
* Converts to Remix path pattern.
|
|
96
|
-
*
|
|
97
|
-
* - `[param]` → `$param`
|
|
98
|
-
* - `[[param]]` → `($param)`
|
|
99
|
-
* - `[...param]` → `$`
|
|
100
|
-
* - `[[...param]]` → `/`, `$`
|
|
101
|
-
* - `pk_[id]` → (not supported, emits `pk_$id`)
|
|
102
|
-
*/
|
|
103
|
-
export declare function toRemix(path: RouterPattern): string[];
|
|
104
|
-
/**
|
|
105
|
-
* Converts to Bun.serve path pattern.
|
|
106
|
-
*
|
|
107
|
-
* Since Bun doesn't support optional params (`:param?`), optional segments
|
|
108
|
-
* are expanded into multiple routes recursively.
|
|
109
|
-
*
|
|
110
|
-
* - `[param]` → `:param`
|
|
111
|
-
* - `[[param]]` → `/`, `/:param` (two routes)
|
|
112
|
-
* - `[...param]` → `*`
|
|
113
|
-
* - `[[...param]]` → `/`, `/*` (two routes)
|
|
114
|
-
* - `pk_[id]` → `pk_:id`
|
|
115
|
-
*/
|
|
116
|
-
export declare function toBun(path: RouterPattern): string[];
|
|
117
|
-
type ExtractSegment<S extends string> = S extends `[[...${infer Name}]]` ? RestSegment<Name, true> : S extends `[...${infer Name}]` ? RestSegment<Name, false> : S extends `[[${infer Name}]]` ? ParamSegment<Name, true, "", ""> : S extends `${infer Pre extends `${string}${ParamDelimiter}`}[${infer Name}]${infer Suf}` ? Suf extends `${infer Delim extends ParamDelimiter}${infer SufRest}` ? ParamSegment<Name, false, Pre, `${Delim}${SufRest}`> : Suf extends "" ? ParamSegment<Name, false, Pre, ""> : undefined : S extends `[${infer Name}]${infer Suf extends `${ParamDelimiter}${string}`}` ? ParamSegment<Name, false, "", Suf> : S extends `[${infer Name}]` ? ParamSegment<Name, false, "", ""> : LiteralSegment<S>;
|
|
118
|
-
export {};
|
package/dist/RouterPattern.js
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
const PARAM_PATTERN = /^(?<prefix>.*[^a-zA-Z0-9])?\[(?<name>[^\]]+)\](?<suffix>[^a-zA-Z0-9].*)?$/;
|
|
2
|
-
export function parseSegment(segment) {
|
|
3
|
-
if (segment.startsWith("[[...")
|
|
4
|
-
&& segment.endsWith("]]")) {
|
|
5
|
-
return {
|
|
6
|
-
_tag: "RestSegment",
|
|
7
|
-
name: segment.slice(5, -2),
|
|
8
|
-
optional: true,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (segment.startsWith("[...")
|
|
12
|
-
&& segment.endsWith("]")) {
|
|
13
|
-
return {
|
|
14
|
-
_tag: "RestSegment",
|
|
15
|
-
name: segment.slice(4, -1),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
if (segment.startsWith("[[")
|
|
19
|
-
&& segment.endsWith("]]")) {
|
|
20
|
-
return {
|
|
21
|
-
_tag: "ParamSegment",
|
|
22
|
-
name: segment.slice(2, -2),
|
|
23
|
-
optional: true,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const match = segment.match(PARAM_PATTERN);
|
|
27
|
-
if (match?.groups) {
|
|
28
|
-
const { prefix, name, suffix } = match.groups;
|
|
29
|
-
return {
|
|
30
|
-
_tag: "ParamSegment",
|
|
31
|
-
name,
|
|
32
|
-
prefix: prefix || undefined,
|
|
33
|
-
suffix: suffix || undefined,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
if (/^[\p{L}\p{N}._~-]+$/u.test(segment)) {
|
|
37
|
-
return { _tag: "LiteralSegment", value: segment };
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
export function parse(pattern) {
|
|
42
|
-
const segments = pattern.split("/").filter(Boolean).map(parseSegment);
|
|
43
|
-
if (segments.some((seg) => seg === null)) {
|
|
44
|
-
throw new Error(`Invalid path segment in "${pattern}": contains invalid characters or format`);
|
|
45
|
-
}
|
|
46
|
-
return segments;
|
|
47
|
-
}
|
|
48
|
-
export function formatSegment(seg) {
|
|
49
|
-
switch (seg._tag) {
|
|
50
|
-
case "LiteralSegment":
|
|
51
|
-
return seg.value;
|
|
52
|
-
case "ParamSegment": {
|
|
53
|
-
const param = seg.optional ? `[[${seg.name}]]` : `[${seg.name}]`;
|
|
54
|
-
return (seg.prefix ?? "") + param + (seg.suffix ?? "");
|
|
55
|
-
}
|
|
56
|
-
case "RestSegment":
|
|
57
|
-
return seg.optional ? `[[...${seg.name}]]` : `[...${seg.name}]`;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export function format(segments) {
|
|
61
|
-
const joined = segments.map(formatSegment).join("/");
|
|
62
|
-
return (joined ? `/${joined}` : "/");
|
|
63
|
-
}
|
|
64
|
-
function buildPaths(segments, mapper, restWildcard) {
|
|
65
|
-
const optionalRestIndex = segments.findIndex((s) => s._tag === "RestSegment" && s.optional);
|
|
66
|
-
if (optionalRestIndex !== -1) {
|
|
67
|
-
const before = segments.slice(0, optionalRestIndex);
|
|
68
|
-
const beforeJoined = before.map(mapper).join("/");
|
|
69
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
70
|
-
const withWildcard = basePath === "/"
|
|
71
|
-
? restWildcard
|
|
72
|
-
: basePath + restWildcard;
|
|
73
|
-
return [basePath, withWildcard];
|
|
74
|
-
}
|
|
75
|
-
const joined = segments.map(mapper).join("/");
|
|
76
|
-
return [joined ? "/" + joined : "/"];
|
|
77
|
-
}
|
|
78
|
-
function colonParamSegment(segment) {
|
|
79
|
-
switch (segment._tag) {
|
|
80
|
-
case "LiteralSegment":
|
|
81
|
-
return segment.value;
|
|
82
|
-
case "ParamSegment": {
|
|
83
|
-
const param = `:${segment.name}${segment.optional ? "?" : ""}`;
|
|
84
|
-
return (segment.prefix ?? "") + param + (segment.suffix ?? "");
|
|
85
|
-
}
|
|
86
|
-
case "RestSegment":
|
|
87
|
-
return "*";
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Converts to colon-style path pattern (used by Hono, Bun, itty-router).
|
|
92
|
-
*
|
|
93
|
-
* - `[param]` → `:param`
|
|
94
|
-
* - `[[param]]` → `:param?`
|
|
95
|
-
* - `[...param]` → `*`
|
|
96
|
-
* - `[[...param]]` → `/`, `/*`
|
|
97
|
-
* - `pk_[id]` → `pk_:id`
|
|
98
|
-
*/
|
|
99
|
-
export function toColon(path) {
|
|
100
|
-
return buildPaths(parse(path), colonParamSegment, "/*");
|
|
101
|
-
}
|
|
102
|
-
export const toHono = toColon;
|
|
103
|
-
/**
|
|
104
|
-
* Converts to Express path pattern.
|
|
105
|
-
*
|
|
106
|
-
* - `[param]` → `:param`
|
|
107
|
-
* - `[[param]]` → `{/:param}`
|
|
108
|
-
* - `[...param]` → `/*param`
|
|
109
|
-
* - `[[...param]]` → `/`, `/*param`
|
|
110
|
-
* - `pk_[id]` → `pk_:id`
|
|
111
|
-
*/
|
|
112
|
-
export function toExpress(path) {
|
|
113
|
-
const segments = parse(path);
|
|
114
|
-
const optionalRestIndex = segments.findIndex((s) => s._tag === "RestSegment" && s.optional);
|
|
115
|
-
const mapper = (segment) => {
|
|
116
|
-
switch (segment._tag) {
|
|
117
|
-
case "LiteralSegment":
|
|
118
|
-
return segment.value;
|
|
119
|
-
case "ParamSegment": {
|
|
120
|
-
const param = `:${segment.name}`;
|
|
121
|
-
return (segment.prefix ?? "") + param + (segment.suffix ?? "");
|
|
122
|
-
}
|
|
123
|
-
case "RestSegment":
|
|
124
|
-
return `*${segment.name}`;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
if (optionalRestIndex !== -1) {
|
|
128
|
-
const before = segments.slice(0, optionalRestIndex);
|
|
129
|
-
const rest = segments[optionalRestIndex];
|
|
130
|
-
if (rest._tag !== "RestSegment")
|
|
131
|
-
throw new Error("unreachable");
|
|
132
|
-
const restName = rest.name;
|
|
133
|
-
const beforeJoined = before.map(mapper).join("/");
|
|
134
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
135
|
-
const withWildcard = basePath === "/"
|
|
136
|
-
? `/*${restName}`
|
|
137
|
-
: basePath + `/*${restName}`;
|
|
138
|
-
return [basePath, withWildcard];
|
|
139
|
-
}
|
|
140
|
-
let result = "";
|
|
141
|
-
for (let i = 0; i < segments.length; i++) {
|
|
142
|
-
const segment = segments[i];
|
|
143
|
-
const isFirst = i === 0;
|
|
144
|
-
switch (segment._tag) {
|
|
145
|
-
case "LiteralSegment":
|
|
146
|
-
result += "/" + segment.value;
|
|
147
|
-
break;
|
|
148
|
-
case "ParamSegment":
|
|
149
|
-
if (segment.optional && !segment.prefix && !segment.suffix) {
|
|
150
|
-
result += isFirst
|
|
151
|
-
? "/{/:$name}".replace("$name", segment.name)
|
|
152
|
-
: `{/:${segment.name}}`;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
const param = `:${segment.name}`;
|
|
156
|
-
result += "/"
|
|
157
|
-
+ (segment.prefix ?? "")
|
|
158
|
-
+ param
|
|
159
|
-
+ (segment.suffix ?? "");
|
|
160
|
-
}
|
|
161
|
-
break;
|
|
162
|
-
case "RestSegment":
|
|
163
|
-
result += `/*${segment.name}`;
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return [result || "/"];
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Converts to Effect HttpRouter/find-my-way path pattern.
|
|
171
|
-
*
|
|
172
|
-
* - `[param]` → `:param`
|
|
173
|
-
* - `[[param]]` → `:param?` (must be final segment)
|
|
174
|
-
* - `[...param]` → `*`
|
|
175
|
-
* - `[[...param]]` → `/`, `/*`
|
|
176
|
-
* - `pk_[id]` → `pk_:id`
|
|
177
|
-
*/
|
|
178
|
-
export function toEffect(path) {
|
|
179
|
-
return buildPaths(parse(path), colonParamSegment, "/*");
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Converts to URLPattern path pattern.
|
|
183
|
-
*
|
|
184
|
-
* - `[param]` → `:param`
|
|
185
|
-
* - `[[param]]` → `:param?`
|
|
186
|
-
* - `[...param]` → `:param+`
|
|
187
|
-
* - `[[...param]]` → `:param*`
|
|
188
|
-
* - `pk_[id]` → `pk_:id`
|
|
189
|
-
*/
|
|
190
|
-
export function toURLPattern(path) {
|
|
191
|
-
const segments = parse(path);
|
|
192
|
-
const joined = segments
|
|
193
|
-
.map((segment) => {
|
|
194
|
-
switch (segment._tag) {
|
|
195
|
-
case "LiteralSegment":
|
|
196
|
-
return segment.value;
|
|
197
|
-
case "ParamSegment": {
|
|
198
|
-
const param = `:${segment.name}${segment.optional ? "?" : ""}`;
|
|
199
|
-
return (segment.prefix ?? "") + param + (segment.suffix ?? "");
|
|
200
|
-
}
|
|
201
|
-
case "RestSegment":
|
|
202
|
-
return `:${segment.name}${segment.optional ? "*" : "+"}`;
|
|
203
|
-
}
|
|
204
|
-
})
|
|
205
|
-
.join("/");
|
|
206
|
-
return [joined ? "/" + joined : "/"];
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Converts to Remix path pattern.
|
|
210
|
-
*
|
|
211
|
-
* - `[param]` → `$param`
|
|
212
|
-
* - `[[param]]` → `($param)`
|
|
213
|
-
* - `[...param]` → `$`
|
|
214
|
-
* - `[[...param]]` → `/`, `$`
|
|
215
|
-
* - `pk_[id]` → (not supported, emits `pk_$id`)
|
|
216
|
-
*/
|
|
217
|
-
export function toRemix(path) {
|
|
218
|
-
const segments = parse(path);
|
|
219
|
-
const optionalRestIndex = segments.findIndex((s) => s._tag === "RestSegment" && s.optional);
|
|
220
|
-
const mapper = (segment) => {
|
|
221
|
-
switch (segment._tag) {
|
|
222
|
-
case "LiteralSegment":
|
|
223
|
-
return segment.value;
|
|
224
|
-
case "ParamSegment": {
|
|
225
|
-
const param = segment.optional
|
|
226
|
-
? `($${segment.name})`
|
|
227
|
-
: `$${segment.name}`;
|
|
228
|
-
return (segment.prefix ?? "") + param + (segment.suffix ?? "");
|
|
229
|
-
}
|
|
230
|
-
case "RestSegment":
|
|
231
|
-
return "$";
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
if (optionalRestIndex !== -1) {
|
|
235
|
-
const before = segments.slice(0, optionalRestIndex);
|
|
236
|
-
const beforeJoined = before.map(mapper).join("/");
|
|
237
|
-
const basePath = beforeJoined ? "/" + beforeJoined : "/";
|
|
238
|
-
const withWildcard = basePath === "/" ? "$" : basePath + "/$";
|
|
239
|
-
return [basePath, withWildcard];
|
|
240
|
-
}
|
|
241
|
-
const joined = segments.map(mapper).join("/");
|
|
242
|
-
return [joined ? "/" + joined : "/"];
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Converts to Bun.serve path pattern.
|
|
246
|
-
*
|
|
247
|
-
* Since Bun doesn't support optional params (`:param?`), optional segments
|
|
248
|
-
* are expanded into multiple routes recursively.
|
|
249
|
-
*
|
|
250
|
-
* - `[param]` → `:param`
|
|
251
|
-
* - `[[param]]` → `/`, `/:param` (two routes)
|
|
252
|
-
* - `[...param]` → `*`
|
|
253
|
-
* - `[[...param]]` → `/`, `/*` (two routes)
|
|
254
|
-
* - `pk_[id]` → `pk_:id`
|
|
255
|
-
*/
|
|
256
|
-
export function toBun(path) {
|
|
257
|
-
const segments = parse(path);
|
|
258
|
-
const optionalIndex = segments.findIndex((s) => (s._tag === "ParamSegment" || s._tag === "RestSegment") && s.optional);
|
|
259
|
-
if (optionalIndex === -1) {
|
|
260
|
-
return buildPaths(segments, colonParamSegment, "/*");
|
|
261
|
-
}
|
|
262
|
-
const before = segments.slice(0, optionalIndex);
|
|
263
|
-
const optional = { ...segments[optionalIndex], optional: false };
|
|
264
|
-
const after = segments.slice(optionalIndex + 1);
|
|
265
|
-
return [
|
|
266
|
-
...toBun(format(before)),
|
|
267
|
-
...toBun(format([...before, optional, ...after])),
|
|
268
|
-
];
|
|
269
|
-
}
|
package/dist/SchemaExtra.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type * as Schema from "effect/Schema";
|
|
2
|
-
import * as SchemaAST from "effect/SchemaAST";
|
|
3
|
-
export declare function getBaseSchemaAST(schema: Schema.Schema.Any): SchemaAST.AST;
|
|
4
|
-
export declare function isOptional(schema: Schema.Schema.Any): boolean;
|
|
5
|
-
export declare function schemaEqual(userSchema: Schema.Struct<any> | undefined, expectedSchema: Schema.Struct<any> | null): boolean;
|
|
6
|
-
export declare function getSchemaTypeName(schema: Schema.Schema.Any): string;
|
|
7
|
-
export declare function formatSchemaCode(schema: Schema.Struct<any>): string;
|
package/dist/SchemaExtra.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import * as SchemaAST from "effect/SchemaAST";
|
|
2
|
-
export function getBaseSchemaAST(schema) {
|
|
3
|
-
let current = schema.ast;
|
|
4
|
-
while (SchemaAST.isRefinement(current) || SchemaAST.isTransformation(current)) {
|
|
5
|
-
current = current.from;
|
|
6
|
-
}
|
|
7
|
-
return current;
|
|
8
|
-
}
|
|
9
|
-
export function isOptional(schema) {
|
|
10
|
-
const ast = schema.ast;
|
|
11
|
-
if (ast._tag === "Union") {
|
|
12
|
-
return ast.types.some((t) => t._tag === "UndefinedKeyword");
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
export function schemaEqual(userSchema, expectedSchema) {
|
|
17
|
-
if (!userSchema && !expectedSchema) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
if (!userSchema || !expectedSchema) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
const userFields = userSchema.fields;
|
|
24
|
-
const expectedFields = expectedSchema.fields;
|
|
25
|
-
const userKeys = Object.keys(userFields).sort();
|
|
26
|
-
const expectedKeys = Object.keys(expectedFields).sort();
|
|
27
|
-
if (userKeys.length !== expectedKeys.length) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
for (let i = 0; i < userKeys.length; i++) {
|
|
31
|
-
if (userKeys[i] !== expectedKeys[i]) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
for (const key of userKeys) {
|
|
36
|
-
const userFieldSchema = userFields[key];
|
|
37
|
-
const expectedFieldSchema = expectedFields[key];
|
|
38
|
-
const userOptional = isOptional(userFieldSchema);
|
|
39
|
-
const expectedOptional = isOptional(expectedFieldSchema);
|
|
40
|
-
if (userOptional !== expectedOptional) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
const userBaseAST = getBaseSchemaAST(userFieldSchema);
|
|
44
|
-
const expectedBaseAST = getBaseSchemaAST(expectedFieldSchema);
|
|
45
|
-
if (userBaseAST._tag !== expectedBaseAST._tag) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
export function getSchemaTypeName(schema) {
|
|
52
|
-
const baseAST = getBaseSchemaAST(schema);
|
|
53
|
-
switch (baseAST._tag) {
|
|
54
|
-
case "StringKeyword":
|
|
55
|
-
return "Schema.String";
|
|
56
|
-
case "NumberKeyword":
|
|
57
|
-
return "Schema.Number";
|
|
58
|
-
case "BooleanKeyword":
|
|
59
|
-
return "Schema.Boolean";
|
|
60
|
-
default:
|
|
61
|
-
return "Schema.String";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export function formatSchemaCode(schema) {
|
|
65
|
-
const fields = schema.fields;
|
|
66
|
-
const fieldStrings = [];
|
|
67
|
-
for (const [key, fieldSchema] of Object.entries(fields)) {
|
|
68
|
-
const optional = isOptional(fieldSchema);
|
|
69
|
-
const typeName = getSchemaTypeName(fieldSchema);
|
|
70
|
-
const fieldStr = optional ? `${key}?: ${typeName}` : `${key}: ${typeName}`;
|
|
71
|
-
fieldStrings.push(fieldStr);
|
|
72
|
-
}
|
|
73
|
-
return `{ ${fieldStrings.join(", ")} }`;
|
|
74
|
-
}
|
package/dist/Socket.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const SocketErrorTypeId: unique symbol;
|
|
2
|
-
export type SocketErrorTypeId = typeof SocketErrorTypeId;
|
|
3
|
-
export declare const isSocketError: (u: unknown) => u is SocketError;
|
|
4
|
-
export type SocketError = SocketGenericError | SocketCloseError;
|
|
5
|
-
declare const SocketGenericError_base: new <A extends Record<string, any>>(args: import("effect/Types").Simplify<A>) => import("effect/Cause").YieldableError & Record<typeof SocketErrorTypeId, typeof SocketErrorTypeId> & {
|
|
6
|
-
readonly _tag: "SocketError";
|
|
7
|
-
} & Readonly<A>;
|
|
8
|
-
export declare class SocketGenericError extends SocketGenericError_base<{
|
|
9
|
-
readonly reason: "Write" | "Read" | "Open" | "OpenTimeout";
|
|
10
|
-
readonly cause: unknown;
|
|
11
|
-
}> {
|
|
12
|
-
get message(): string;
|
|
13
|
-
}
|
|
14
|
-
declare const SocketCloseError_base: new <A extends Record<string, any>>(args: import("effect/Types").Simplify<A>) => import("effect/Cause").YieldableError & Record<typeof SocketErrorTypeId, typeof SocketErrorTypeId> & {
|
|
15
|
-
readonly _tag: "SocketError";
|
|
16
|
-
} & Readonly<A>;
|
|
17
|
-
export declare class SocketCloseError extends SocketCloseError_base<{
|
|
18
|
-
readonly reason: "Close";
|
|
19
|
-
readonly code: number;
|
|
20
|
-
readonly closeReason?: string | undefined;
|
|
21
|
-
}> {
|
|
22
|
-
static is(u: unknown): u is SocketCloseError;
|
|
23
|
-
static isClean(isClean: (code: number) => boolean): (u: unknown) => u is SocketCloseError;
|
|
24
|
-
get message(): string;
|
|
25
|
-
}
|
|
26
|
-
export declare const defaultCloseCodeIsError: (code: number) => boolean;
|
|
27
|
-
export {};
|
package/dist/Socket.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Adapted from @effect/platform
|
|
3
|
-
*/
|
|
4
|
-
import * as Predicate from "effect/Predicate";
|
|
5
|
-
import * as PlatformError from "./PlatformError.js";
|
|
6
|
-
export const SocketErrorTypeId = Symbol.for("@effect/platform/Socket/SocketError");
|
|
7
|
-
export const isSocketError = (u) => Predicate.hasProperty(u, SocketErrorTypeId);
|
|
8
|
-
export class SocketGenericError extends PlatformError.TypeIdError(SocketErrorTypeId, "SocketError") {
|
|
9
|
-
get message() {
|
|
10
|
-
return `An error occurred during ${this.reason}`;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export class SocketCloseError extends PlatformError.TypeIdError(SocketErrorTypeId, "SocketError") {
|
|
14
|
-
static is(u) {
|
|
15
|
-
return isSocketError(u) && u.reason === "Close";
|
|
16
|
-
}
|
|
17
|
-
static isClean(isClean) {
|
|
18
|
-
return function (u) {
|
|
19
|
-
return SocketCloseError.is(u) && isClean(u.code);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
get message() {
|
|
23
|
-
if (this.closeReason) {
|
|
24
|
-
return `${this.reason}: ${this.code}: ${this.closeReason}`;
|
|
25
|
-
}
|
|
26
|
-
return `${this.reason}: ${this.code}`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export const defaultCloseCodeIsError = (code) => code !== 1000 && code !== 1006;
|
package/dist/Sql.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context";
|
|
2
|
-
import type * as Effect from "effect/Effect";
|
|
3
|
-
import type * as Scope from "effect/Scope";
|
|
4
|
-
declare const SqlError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
|
|
5
|
-
readonly _tag: "SqlError";
|
|
6
|
-
} & Readonly<A>;
|
|
7
|
-
export declare class SqlError extends SqlError_base<{
|
|
8
|
-
readonly code: string;
|
|
9
|
-
readonly message: string;
|
|
10
|
-
readonly cause?: unknown;
|
|
11
|
-
}> {
|
|
12
|
-
}
|
|
13
|
-
export interface SqlQuery {
|
|
14
|
-
<T = any>(strings: TemplateStringsArray, ...values: Array<unknown>): Effect.Effect<ReadonlyArray<T>, SqlError>;
|
|
15
|
-
readonly unsafe: <T = any>(query: string, values?: Array<unknown>) => Effect.Effect<ReadonlyArray<T>, SqlError>;
|
|
16
|
-
readonly values: {
|
|
17
|
-
<T extends Record<string, unknown>>(obj: T | ReadonlyArray<T>): SqlHelper<T>;
|
|
18
|
-
<T extends Record<string, unknown>, K extends keyof T>(obj: T | ReadonlyArray<T>, ...columns: [K, ...Array<K>]): SqlHelper<Pick<T, K>>;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface SqlClient extends SqlQuery {
|
|
22
|
-
readonly withTransaction: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, SqlError | E, R>;
|
|
23
|
-
readonly reserve: Effect.Effect<SqlQuery, SqlError, Scope.Scope>;
|
|
24
|
-
readonly close: (options?: {
|
|
25
|
-
readonly timeout?: number;
|
|
26
|
-
}) => Effect.Effect<void, SqlError>;
|
|
27
|
-
readonly use: <T>(fn: (driver: any) => Promise<T> | T) => Effect.Effect<T, SqlError>;
|
|
28
|
-
}
|
|
29
|
-
export interface SqlHelper<T> {
|
|
30
|
-
readonly value: ReadonlyArray<T>;
|
|
31
|
-
readonly columns: ReadonlyArray<keyof T>;
|
|
32
|
-
}
|
|
33
|
-
export declare const SqlClient: Context.Tag<SqlClient, SqlClient>;
|
|
34
|
-
export {};
|
package/dist/Sql.js
DELETED
package/dist/SqlIntrospect.d.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
import * as Sql from "./Sql.ts";
|
|
4
|
-
export interface Column {
|
|
5
|
-
readonly tableSchema: string;
|
|
6
|
-
readonly tableName: string;
|
|
7
|
-
readonly columnName: string;
|
|
8
|
-
readonly ordinalPosition: number;
|
|
9
|
-
readonly columnDefault: string | null;
|
|
10
|
-
readonly isNullable: boolean;
|
|
11
|
-
readonly dataType: string;
|
|
12
|
-
readonly maxLength: number | null;
|
|
13
|
-
readonly isPrimaryKey: boolean;
|
|
14
|
-
readonly isAutoIncrement: boolean;
|
|
15
|
-
readonly isSortable: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface ForeignKey {
|
|
18
|
-
readonly constraintName: string;
|
|
19
|
-
readonly tableSchema: string;
|
|
20
|
-
readonly tableName: string;
|
|
21
|
-
readonly columnName: string;
|
|
22
|
-
readonly referencedSchema: string;
|
|
23
|
-
readonly referencedTable: string;
|
|
24
|
-
readonly referencedColumn: string;
|
|
25
|
-
readonly updateRule: string;
|
|
26
|
-
readonly deleteRule: string;
|
|
27
|
-
}
|
|
28
|
-
export interface Index {
|
|
29
|
-
readonly tableSchema: string;
|
|
30
|
-
readonly tableName: string;
|
|
31
|
-
readonly indexName: string;
|
|
32
|
-
readonly columnName: string;
|
|
33
|
-
readonly isUnique: boolean;
|
|
34
|
-
readonly ordinalPosition: number;
|
|
35
|
-
}
|
|
36
|
-
export interface Table {
|
|
37
|
-
readonly tableSchema: string;
|
|
38
|
-
readonly tableName: string;
|
|
39
|
-
readonly columns: ReadonlyArray<Column>;
|
|
40
|
-
readonly foreignKeys: ReadonlyArray<ForeignKey>;
|
|
41
|
-
readonly indexes: ReadonlyArray<Index>;
|
|
42
|
-
}
|
|
43
|
-
export interface DatabaseSchema {
|
|
44
|
-
readonly tables: ReadonlyArray<Table>;
|
|
45
|
-
}
|
|
46
|
-
export interface IntrospectOptions {
|
|
47
|
-
readonly foreignKeys?: boolean;
|
|
48
|
-
readonly indexes?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export type Dialect = "sqlite" | "postgres" | "mssql";
|
|
51
|
-
export declare const introspect: (dialect: Dialect, options?: IntrospectOptions) => Effect.Effect<DatabaseSchema, Sql.SqlError, Sql.SqlClient>;
|
|
52
|
-
export interface TableSchema {
|
|
53
|
-
readonly tableName: string;
|
|
54
|
-
readonly tableSchema: string;
|
|
55
|
-
readonly schema: Schema.Schema<any, any, never>;
|
|
56
|
-
readonly columns: ReadonlyArray<Column>;
|
|
57
|
-
}
|
|
58
|
-
export declare const tableToSchema: (table: Table) => TableSchema | null;
|
|
59
|
-
export declare const toSchemas: (db: DatabaseSchema) => ReadonlyArray<TableSchema>;
|
|
60
|
-
export interface SortOrder {
|
|
61
|
-
readonly column: string;
|
|
62
|
-
readonly reverse?: boolean;
|
|
63
|
-
}
|
|
64
|
-
export interface Filter {
|
|
65
|
-
readonly column: string;
|
|
66
|
-
readonly op: "eq" | "neq";
|
|
67
|
-
readonly value: unknown;
|
|
68
|
-
}
|
|
69
|
-
export interface FindAllOptions {
|
|
70
|
-
readonly limit?: number;
|
|
71
|
-
readonly offset?: number;
|
|
72
|
-
readonly sort?: ReadonlyArray<SortOrder>;
|
|
73
|
-
readonly filters?: ReadonlyArray<Filter>;
|
|
74
|
-
}
|
|
75
|
-
export interface TableReader {
|
|
76
|
-
readonly tableName: string;
|
|
77
|
-
readonly tableSchema: string;
|
|
78
|
-
readonly schema: Schema.Schema<any, any, never>;
|
|
79
|
-
readonly columns: ReadonlyArray<Column>;
|
|
80
|
-
readonly sortableColumns: ReadonlyArray<string>;
|
|
81
|
-
readonly findAll: (options?: FindAllOptions) => Effect.Effect<ReadonlyArray<unknown>, Sql.SqlError, Sql.SqlClient>;
|
|
82
|
-
readonly findById: (id: unknown) => Effect.Effect<unknown | null, Sql.SqlError, Sql.SqlClient>;
|
|
83
|
-
readonly count: (options?: {
|
|
84
|
-
readonly filters?: ReadonlyArray<Filter>;
|
|
85
|
-
}) => Effect.Effect<number, Sql.SqlError, Sql.SqlClient>;
|
|
86
|
-
}
|
|
87
|
-
export interface DatabaseReader {
|
|
88
|
-
readonly tables: ReadonlyArray<TableReader>;
|
|
89
|
-
readonly table: (name: string) => TableReader | undefined;
|
|
90
|
-
}
|
|
91
|
-
export declare const makeDatabaseReader: (db: DatabaseSchema) => DatabaseReader;
|