effect-start 0.25.0 → 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/dist/ChildProcess.js +0 -42
- package/dist/Commander.js +0 -410
- package/dist/ContentNegotiation.js +0 -465
- package/dist/Cookies.js +0 -371
- package/dist/Development.js +0 -94
- package/dist/Effectify.js +0 -27
- package/dist/Entity.js +0 -289
- package/dist/Fetch.js +0 -192
- package/dist/FilePathPattern.js +0 -97
- package/dist/FileRouter.js +0 -204
- package/dist/FileRouterCodegen.js +0 -298
- package/dist/FileSystem.js +0 -132
- package/dist/Http.js +0 -107
- package/dist/PathPattern.js +0 -451
- package/dist/PlatformError.js +0 -40
- package/dist/PlatformRuntime.js +0 -71
- package/dist/Route.js +0 -143
- package/dist/RouteBody.js +0 -92
- package/dist/RouteError.js +0 -76
- package/dist/RouteHook.js +0 -64
- package/dist/RouteHttp.js +0 -367
- package/dist/RouteHttpTracer.js +0 -90
- package/dist/RouteMount.js +0 -86
- package/dist/RouteSchema.js +0 -271
- package/dist/RouteSse.js +0 -94
- package/dist/RouteTree.js +0 -119
- package/dist/RouteTrie.js +0 -179
- package/dist/SchemaExtra.js +0 -99
- package/dist/Socket.js +0 -40
- package/dist/SqlIntrospect.js +0 -515
- package/dist/Start.js +0 -79
- package/dist/StartApp.js +0 -3
- package/dist/StreamExtra.js +0 -135
- package/dist/System.js +0 -38
- package/dist/TuplePathPattern.js +0 -74
- package/dist/Unique.js +0 -226
- package/dist/Values.js +0 -52
- package/dist/bun/BunBundle.js +0 -186
- package/dist/bun/BunChildProcessSpawner.js +0 -142
- package/dist/bun/BunImportTrackerPlugin.js +0 -91
- package/dist/bun/BunRoute.js +0 -157
- package/dist/bun/BunRuntime.js +0 -41
- package/dist/bun/BunServer.js +0 -285
- package/dist/bun/BunVirtualFilesPlugin.js +0 -54
- package/dist/bun/_BunEnhancedResolve.js +0 -127
- package/dist/bun/index.js +0 -5
- package/dist/bundler/Bundle.js +0 -92
- package/dist/bundler/BundleFiles.js +0 -154
- package/dist/bundler/BundleRoute.js +0 -62
- package/dist/client/Overlay.js +0 -33
- package/dist/client/ScrollState.js +0 -106
- package/dist/client/index.js +0 -97
- package/dist/console/Console.js +0 -42
- package/dist/console/ConsoleErrors.js +0 -211
- package/dist/console/ConsoleLogger.js +0 -56
- package/dist/console/ConsoleMetrics.js +0 -72
- package/dist/console/ConsoleProcess.js +0 -59
- package/dist/console/ConsoleStore.js +0 -72
- package/dist/console/ConsoleTracer.js +0 -107
- package/dist/console/Simulation.js +0 -784
- package/dist/console/index.js +0 -3
- package/dist/console/routes/tree.js +0 -30
- package/dist/datastar/actions/fetch.js +0 -536
- package/dist/datastar/actions/peek.js +0 -13
- package/dist/datastar/actions/setAll.js +0 -19
- package/dist/datastar/actions/toggleAll.js +0 -19
- package/dist/datastar/attributes/attr.js +0 -49
- package/dist/datastar/attributes/bind.js +0 -194
- package/dist/datastar/attributes/class.js +0 -54
- package/dist/datastar/attributes/computed.js +0 -25
- package/dist/datastar/attributes/effect.js +0 -10
- package/dist/datastar/attributes/indicator.js +0 -33
- package/dist/datastar/attributes/init.js +0 -27
- package/dist/datastar/attributes/jsonSignals.js +0 -33
- package/dist/datastar/attributes/on.js +0 -81
- package/dist/datastar/attributes/onIntersect.js +0 -53
- package/dist/datastar/attributes/onInterval.js +0 -31
- package/dist/datastar/attributes/onSignalPatch.js +0 -51
- package/dist/datastar/attributes/ref.js +0 -11
- package/dist/datastar/attributes/show.js +0 -32
- package/dist/datastar/attributes/signals.js +0 -18
- package/dist/datastar/attributes/style.js +0 -57
- package/dist/datastar/attributes/text.js +0 -29
- package/dist/datastar/engine.js +0 -1145
- package/dist/datastar/index.js +0 -25
- package/dist/datastar/utils.js +0 -250
- package/dist/datastar/watchers/patchElements.js +0 -486
- package/dist/datastar/watchers/patchSignals.js +0 -14
- package/dist/experimental/EncryptedCookies.js +0 -328
- package/dist/experimental/index.js +0 -1
- package/dist/hyper/Hyper.js +0 -28
- package/dist/hyper/HyperHtml.js +0 -165
- package/dist/hyper/HyperNode.js +0 -13
- package/dist/hyper/HyperRoute.js +0 -45
- package/dist/hyper/html.js +0 -30
- package/dist/hyper/index.js +0 -5
- package/dist/hyper/jsx-runtime.js +0 -14
- package/dist/index.js +0 -8
- package/dist/node/NodeFileSystem.js +0 -675
- package/dist/node/NodeUtils.js +0 -23
- package/dist/sql/Sql.js +0 -8
- package/dist/sql/bun/index.js +0 -142
- package/dist/sql/index.js +0 -1
- package/dist/sql/libsql/index.js +0 -156
- package/dist/sql/mssql/docker.js +0 -110
- package/dist/sql/mssql/index.js +0 -194
- package/dist/testing/TestLogger.js +0 -42
- package/dist/testing/index.js +0 -2
- package/dist/testing/utils.js +0 -61
- package/dist/x/cloudflare/CloudflareTunnel.js +0 -63
- package/dist/x/cloudflare/index.js +0 -1
- package/dist/x/tailscale/TailscaleTunnel.js +0 -94
- package/dist/x/tailscale/index.js +0 -1
- package/dist/x/tailwind/TailwindPlugin.js +0 -294
- package/dist/x/tailwind/compile.js +0 -210
- package/dist/x/tailwind/plugin.js +0 -17
package/dist/Route.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import * as Context from "effect/Context"
|
|
2
|
-
import * as Effect from "effect/Effect"
|
|
3
|
-
import * as Layer from "effect/Layer"
|
|
4
|
-
import * as Pipeable from "effect/Pipeable"
|
|
5
|
-
import * as Predicate from "effect/Predicate"
|
|
6
|
-
import * as Entity from "./Entity.js"
|
|
7
|
-
import * as RouteBody from "./RouteBody.js"
|
|
8
|
-
import * as RouteTree from "./RouteTree.js"
|
|
9
|
-
|
|
10
|
-
export const RouteItems = Symbol()
|
|
11
|
-
export const RouteDescriptor = Symbol()
|
|
12
|
-
// only for structural type matching
|
|
13
|
-
export const RouteBindings = Symbol()
|
|
14
|
-
|
|
15
|
-
export const TypeId = Symbol.for("effect-start/RouteSet")
|
|
16
|
-
|
|
17
|
-
const Proto = {
|
|
18
|
-
[TypeId]: TypeId,
|
|
19
|
-
pipe() {
|
|
20
|
-
return Pipeable.pipeArguments(this, arguments)
|
|
21
|
-
},
|
|
22
|
-
*[Symbol.iterator]() {
|
|
23
|
-
yield* items(this)
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function isRouteSet(input) {
|
|
28
|
-
return Predicate.hasProperty(input, TypeId)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isRoute(input) {
|
|
32
|
-
return isRouteSet(input) && Predicate.hasProperty(input, "handler")
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function set(
|
|
36
|
-
items = [],
|
|
37
|
-
descriptor = {},
|
|
38
|
-
) {
|
|
39
|
-
return Object.assign(Object.create(Proto), {
|
|
40
|
-
[RouteItems]: items,
|
|
41
|
-
[RouteDescriptor]: descriptor,
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function make(
|
|
46
|
-
handler,
|
|
47
|
-
descriptor,
|
|
48
|
-
) {
|
|
49
|
-
const items = []
|
|
50
|
-
const route = Object.assign(Object.create(Proto), {
|
|
51
|
-
[RouteItems]: items,
|
|
52
|
-
[RouteDescriptor]: descriptor,
|
|
53
|
-
handler,
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
items.push(route)
|
|
57
|
-
|
|
58
|
-
return route
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export const empty = set()
|
|
62
|
-
|
|
63
|
-
export function describe(descriptor) {
|
|
64
|
-
return set([], descriptor)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function items(self) {
|
|
68
|
-
return self[RouteItems]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function descriptor(
|
|
72
|
-
self,
|
|
73
|
-
) {
|
|
74
|
-
if (RouteDescriptor in self) {
|
|
75
|
-
return self[RouteDescriptor]
|
|
76
|
-
}
|
|
77
|
-
return [...self].map((r) => r[RouteDescriptor])
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Shallow merge two object types.
|
|
81
|
-
// For overlapping keys, intersect the values.
|
|
82
|
-
|
|
83
|
-
export * from "./RouteHook.js"
|
|
84
|
-
export * from "./RouteSchema.js"
|
|
85
|
-
|
|
86
|
-
export { add, del, get, head, options, patch, post, put, use } from "./RouteMount.js"
|
|
87
|
-
|
|
88
|
-
export const text = RouteBody.build({
|
|
89
|
-
format: "text",
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
export const html = RouteBody.build({
|
|
93
|
-
format: "html",
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
export const json = RouteBody.build({
|
|
97
|
-
format: "json",
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
export const bytes = RouteBody.build({
|
|
101
|
-
format: "bytes",
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
export { render } from "./RouteBody.js"
|
|
105
|
-
|
|
106
|
-
export { sse } from "./RouteSse.js"
|
|
107
|
-
|
|
108
|
-
export function redirect(
|
|
109
|
-
url,
|
|
110
|
-
options,
|
|
111
|
-
) {
|
|
112
|
-
return Entity.make("", {
|
|
113
|
-
status: options?.status ?? 302,
|
|
114
|
-
headers: {
|
|
115
|
-
location: url instanceof URL ? url.href : url,
|
|
116
|
-
},
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export class Routes extends Context.Tag("effect-start/Routes")() {}
|
|
121
|
-
|
|
122
|
-
export function layer(routes) {
|
|
123
|
-
return Layer.sync(Routes, () => (RouteTree.isRouteTree(routes) ? routes : RouteTree.make(routes)))
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export { make as tree } from "./RouteTree.js"
|
|
127
|
-
|
|
128
|
-
export function lazy(
|
|
129
|
-
load,
|
|
130
|
-
) {
|
|
131
|
-
let cached
|
|
132
|
-
return Effect.suspend(() => {
|
|
133
|
-
if (cached !== undefined) {
|
|
134
|
-
return Effect.succeed(cached)
|
|
135
|
-
}
|
|
136
|
-
return Effect.promise(load).pipe(
|
|
137
|
-
Effect.map((mod) => {
|
|
138
|
-
cached = mod.default
|
|
139
|
-
return cached
|
|
140
|
-
}),
|
|
141
|
-
)
|
|
142
|
-
})
|
|
143
|
-
}
|
package/dist/RouteBody.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect"
|
|
2
|
-
import * as Entity from "./Entity.js"
|
|
3
|
-
import * as Route from "./Route.js"
|
|
4
|
-
|
|
5
|
-
const formatToContentType = {
|
|
6
|
-
text: "text/plain; charset=utf-8",
|
|
7
|
-
html: "text/html; charset=utf-8",
|
|
8
|
-
json: "application/json",
|
|
9
|
-
bytes: "application/octet-stream",
|
|
10
|
-
"*": undefined,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function handle(
|
|
14
|
-
handler,
|
|
15
|
-
) {
|
|
16
|
-
if (typeof handler === "function") {
|
|
17
|
-
return (
|
|
18
|
-
context,
|
|
19
|
-
next,
|
|
20
|
-
) => {
|
|
21
|
-
const result = (handler)(context, next)
|
|
22
|
-
const effect = Effect.isEffect(result)
|
|
23
|
-
? (result)
|
|
24
|
-
: (Effect.gen(function* () {
|
|
25
|
-
return yield* result
|
|
26
|
-
}))
|
|
27
|
-
return Effect.map(effect, normalizeToEntity)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (Effect.isEffect(handler)) {
|
|
31
|
-
return (_context, _next) =>
|
|
32
|
-
Effect.map(handler, normalizeToEntity)
|
|
33
|
-
}
|
|
34
|
-
if (Entity.isEntity(handler)) {
|
|
35
|
-
return (_context, _next) => Effect.succeed(handler)
|
|
36
|
-
}
|
|
37
|
-
return (_context, _next) => Effect.succeed(normalizeToEntity(handler))
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function normalizeToEntity(value) {
|
|
41
|
-
if (Entity.isEntity(value)) {
|
|
42
|
-
return value
|
|
43
|
-
}
|
|
44
|
-
return Entity.make(value, { status: 200 })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function build(descriptors) {
|
|
48
|
-
return function (handler) {
|
|
49
|
-
return function (self) {
|
|
50
|
-
const contentType = formatToContentType[descriptors.format]
|
|
51
|
-
const baseHandler = handle(handler)
|
|
52
|
-
const wrappedHandler = (ctx, next) =>
|
|
53
|
-
Effect.map(baseHandler(ctx, next), (entity) =>
|
|
54
|
-
entity.headers["content-type"]
|
|
55
|
-
? entity
|
|
56
|
-
: Entity.make(entity.body, {
|
|
57
|
-
status: entity.status,
|
|
58
|
-
url: entity.url,
|
|
59
|
-
headers: { ...entity.headers, "content-type": contentType },
|
|
60
|
-
}),
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
const route = Route.make(wrappedHandler, descriptors)
|
|
64
|
-
|
|
65
|
-
const items = [
|
|
66
|
-
...Route.items(self),
|
|
67
|
-
route,
|
|
68
|
-
]
|
|
69
|
-
|
|
70
|
-
return Route.set(
|
|
71
|
-
items,
|
|
72
|
-
Route.descriptor(self),
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function render(handler) {
|
|
79
|
-
return function (self) {
|
|
80
|
-
const route = Route.make(handle(handler), { format: "*" })
|
|
81
|
-
|
|
82
|
-
const items = [
|
|
83
|
-
...Route.items(self),
|
|
84
|
-
route,
|
|
85
|
-
]
|
|
86
|
-
|
|
87
|
-
return Route.set(
|
|
88
|
-
items,
|
|
89
|
-
Route.descriptor(self),
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
}
|
package/dist/RouteError.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema"
|
|
2
|
-
|
|
3
|
-
export class BadRequest extends Schema.TaggedError()("BadRequest", {
|
|
4
|
-
message: Schema.String,
|
|
5
|
-
}) {
|
|
6
|
-
static status = 400
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class Unauthorized extends Schema.TaggedError()("Unauthorized", {
|
|
10
|
-
message: Schema.String,
|
|
11
|
-
}) {
|
|
12
|
-
static status = 401
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class Forbidden extends Schema.TaggedError()("Forbidden", {
|
|
16
|
-
message: Schema.String,
|
|
17
|
-
}) {
|
|
18
|
-
static status = 403
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class NotFound extends Schema.TaggedError()("NotFound", {
|
|
22
|
-
message: Schema.String,
|
|
23
|
-
}) {
|
|
24
|
-
static status = 404
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class MethodNotAllowed extends Schema.TaggedError()("MethodNotAllowed", {
|
|
28
|
-
message: Schema.String,
|
|
29
|
-
}) {
|
|
30
|
-
static status = 405
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class Conflict extends Schema.TaggedError()("Conflict", {
|
|
34
|
-
message: Schema.String,
|
|
35
|
-
}) {
|
|
36
|
-
static status = 409
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class Gone extends Schema.TaggedError()("Gone", {
|
|
40
|
-
message: Schema.String,
|
|
41
|
-
}) {
|
|
42
|
-
static status = 410
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class UnprocessableEntity extends Schema.TaggedError()(
|
|
46
|
-
"UnprocessableEntity",
|
|
47
|
-
{ message: Schema.String },
|
|
48
|
-
) {
|
|
49
|
-
static status = 422
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export class TooManyRequests extends Schema.TaggedError()("TooManyRequests", {
|
|
53
|
-
message: Schema.String,
|
|
54
|
-
}) {
|
|
55
|
-
static status = 429
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export class InternalServerError extends Schema.TaggedError()(
|
|
59
|
-
"InternalServerError",
|
|
60
|
-
{ message: Schema.String },
|
|
61
|
-
) {
|
|
62
|
-
static status = 500
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export class NotImplemented extends Schema.TaggedError()("NotImplemented", {
|
|
66
|
-
message: Schema.String,
|
|
67
|
-
}) {
|
|
68
|
-
static status = 501
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export class ServiceUnavailable extends Schema.TaggedError()(
|
|
72
|
-
"ServiceUnavailable",
|
|
73
|
-
{ message: Schema.String },
|
|
74
|
-
) {
|
|
75
|
-
static status = 503
|
|
76
|
-
}
|
package/dist/RouteHook.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect"
|
|
2
|
-
import * as Entity from "./Entity.js"
|
|
3
|
-
import * as Route from "./Route.js"
|
|
4
|
-
|
|
5
|
-
export function filter(filterHandler) {
|
|
6
|
-
const normalized = normalizeFilterHandler(filterHandler)
|
|
7
|
-
|
|
8
|
-
return function (
|
|
9
|
-
self,
|
|
10
|
-
) {
|
|
11
|
-
const route = Route.make(
|
|
12
|
-
(context, next) =>
|
|
13
|
-
Effect.gen(function* () {
|
|
14
|
-
const filterResult = yield* normalized(context)
|
|
15
|
-
|
|
16
|
-
const mergedContext = filterResult ? { ...context, ...filterResult.context } : context
|
|
17
|
-
|
|
18
|
-
return yield* Entity.resolve(next(mergedContext))
|
|
19
|
-
}),
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
return Route.set(
|
|
23
|
-
[...Route.items(self), route],
|
|
24
|
-
Route.descriptor(self),
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function isGenerator(value) {
|
|
30
|
-
return (
|
|
31
|
-
typeof value === "object" &&
|
|
32
|
-
value !== null &&
|
|
33
|
-
Symbol.iterator in value &&
|
|
34
|
-
typeof (value).next === "function"
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function normalizeFilterHandler(
|
|
39
|
-
handler,
|
|
40
|
-
) {
|
|
41
|
-
if (typeof handler === "function") {
|
|
42
|
-
return (context) => {
|
|
43
|
-
const result = handler(context)
|
|
44
|
-
|
|
45
|
-
if (Effect.isEffect(result)) {
|
|
46
|
-
return result
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (isGenerator(result)) {
|
|
50
|
-
return Effect.gen(function* () {
|
|
51
|
-
return yield* result
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return Effect.succeed(result)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (Effect.isEffect(handler)) {
|
|
60
|
-
return (_context) => handler
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (_context) => Effect.succeed(handler)
|
|
64
|
-
}
|