liminal 0.17.11 → 0.17.13

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.
Files changed (190) hide show
  1. package/{util/Accumulator.ts → Accumulator.ts} +2 -2
  2. package/{actor/Actor.ts → Actor.ts} +3 -3
  3. package/{actor/Audition.ts → Audition.ts} +2 -2
  4. package/CHANGELOG.md +18 -0
  5. package/{actor/Client.ts → Client.ts} +3 -3
  6. package/{actor/ClientDirectory.ts → ClientDirectory.ts} +4 -4
  7. package/{actor/Method.ts → Method.ts} +6 -6
  8. package/_diagnostic.ts +3 -0
  9. package/browser/BrowserActorNamespace.ts +213 -0
  10. package/browser/index.ts +1 -0
  11. package/dist/{util/Accumulator.js → Accumulator.js} +2 -2
  12. package/dist/Accumulator.js.map +1 -0
  13. package/dist/{actor/Actor.d.ts → Actor.d.ts} +1 -1
  14. package/dist/{actor/Actor.js → Actor.js} +2 -2
  15. package/dist/Actor.js.map +1 -0
  16. package/dist/ActorTransport.js.map +1 -0
  17. package/dist/{actor/Audition.js → Audition.js} +2 -2
  18. package/dist/Audition.js.map +1 -0
  19. package/dist/{actor/Client.js → Client.js} +3 -3
  20. package/dist/Client.js.map +1 -0
  21. package/dist/{actor/ClientDirectory.d.ts → ClientDirectory.d.ts} +1 -1
  22. package/dist/{actor/ClientDirectory.js → ClientDirectory.js} +3 -3
  23. package/dist/ClientDirectory.js.map +1 -0
  24. package/dist/ClientHandle.js.map +1 -0
  25. package/dist/F.js.map +1 -0
  26. package/dist/{actor/Method.d.ts → Method.d.ts} +4 -4
  27. package/dist/Method.js.map +1 -0
  28. package/dist/Protocol.js.map +1 -0
  29. package/dist/_diagnostic.d.ts +4 -0
  30. package/dist/_diagnostic.js +3 -0
  31. package/dist/_diagnostic.js.map +1 -0
  32. package/dist/_util/Mutex.js.map +1 -0
  33. package/dist/_util/phantom.js.map +1 -0
  34. package/dist/_util/schema.js.map +1 -0
  35. package/dist/{socket_util.js → _util/socket.js} +1 -1
  36. package/dist/_util/socket.js.map +1 -0
  37. package/dist/browser/BrowserActorNamespace.d.ts +16 -0
  38. package/dist/browser/BrowserActorNamespace.js +112 -0
  39. package/dist/browser/BrowserActorNamespace.js.map +1 -0
  40. package/dist/browser/index.d.ts +1 -0
  41. package/dist/browser/index.js +2 -0
  42. package/dist/browser/index.js.map +1 -0
  43. package/dist/errors.js.map +1 -0
  44. package/dist/index.d.ts +11 -12
  45. package/dist/index.js +11 -12
  46. package/dist/index.js.map +1 -1
  47. package/dist/package.json +12 -16
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/dist/workerd/WorkerdActorNamespace.d.ts +23 -0
  50. package/dist/{actor/ActorRegistry.js → workerd/WorkerdActorNamespace.js} +18 -19
  51. package/dist/workerd/WorkerdActorNamespace.js.map +1 -0
  52. package/dist/workerd/index.d.ts +1 -0
  53. package/dist/workerd/index.js +2 -0
  54. package/dist/workerd/index.js.map +1 -0
  55. package/index.ts +11 -12
  56. package/package.json +12 -16
  57. package/tsconfig.json +2 -1
  58. package/{actor/ActorRegistry.ts → workerd/WorkerdActorNamespace.ts} +44 -44
  59. package/workerd/index.ts +1 -0
  60. package/Ai.ts +0 -7
  61. package/Assets.ts +0 -21
  62. package/Binding.ts +0 -40
  63. package/D1.ts +0 -8
  64. package/DoState.ts +0 -3
  65. package/Hyperdrive.ts +0 -11
  66. package/Images.ts +0 -101
  67. package/Kv.ts +0 -65
  68. package/NativeRequest.ts +0 -3
  69. package/R2.ts +0 -7
  70. package/Worker.ts +0 -54
  71. package/WorkerLoader.ts +0 -29
  72. package/actor/index.ts +0 -11
  73. package/asset_forwarding.ts +0 -13
  74. package/commands/sync-env.ts +0 -30
  75. package/dist/Ai.d.ts +0 -6
  76. package/dist/Ai.js +0 -6
  77. package/dist/Ai.js.map +0 -1
  78. package/dist/Assets.d.ts +0 -11
  79. package/dist/Assets.js +0 -14
  80. package/dist/Assets.js.map +0 -1
  81. package/dist/Binding.d.ts +0 -2
  82. package/dist/Binding.js +0 -19
  83. package/dist/Binding.js.map +0 -1
  84. package/dist/D1.d.ts +0 -7
  85. package/dist/D1.js +0 -7
  86. package/dist/D1.js.map +0 -1
  87. package/dist/DoState.d.ts +0 -5
  88. package/dist/DoState.js +0 -4
  89. package/dist/DoState.js.map +0 -1
  90. package/dist/Hyperdrive.d.ts +0 -7
  91. package/dist/Hyperdrive.js +0 -7
  92. package/dist/Hyperdrive.js.map +0 -1
  93. package/dist/Images.d.ts +0 -39
  94. package/dist/Images.js +0 -60
  95. package/dist/Images.js.map +0 -1
  96. package/dist/Kv.d.ts +0 -17
  97. package/dist/Kv.js +0 -32
  98. package/dist/Kv.js.map +0 -1
  99. package/dist/NativeRequest.d.ts +0 -5
  100. package/dist/NativeRequest.js +0 -4
  101. package/dist/NativeRequest.js.map +0 -1
  102. package/dist/R2.d.ts +0 -6
  103. package/dist/R2.js +0 -6
  104. package/dist/R2.js.map +0 -1
  105. package/dist/Worker.d.ts +0 -14
  106. package/dist/Worker.js +0 -25
  107. package/dist/Worker.js.map +0 -1
  108. package/dist/WorkerLoader.d.ts +0 -9
  109. package/dist/WorkerLoader.js +0 -22
  110. package/dist/WorkerLoader.js.map +0 -1
  111. package/dist/actor/Actor.js.map +0 -1
  112. package/dist/actor/ActorRegistry.d.ts +0 -23
  113. package/dist/actor/ActorRegistry.js.map +0 -1
  114. package/dist/actor/ActorTransport.js.map +0 -1
  115. package/dist/actor/Audition.js.map +0 -1
  116. package/dist/actor/Client.js.map +0 -1
  117. package/dist/actor/ClientDirectory.js.map +0 -1
  118. package/dist/actor/ClientHandle.js.map +0 -1
  119. package/dist/actor/F.js.map +0 -1
  120. package/dist/actor/Method.js.map +0 -1
  121. package/dist/actor/Protocol.js.map +0 -1
  122. package/dist/actor/errors.js.map +0 -1
  123. package/dist/actor/index.d.ts +0 -11
  124. package/dist/actor/index.js +0 -12
  125. package/dist/actor/index.js.map +0 -1
  126. package/dist/asset_forwarding.d.ts +0 -4
  127. package/dist/asset_forwarding.js +0 -9
  128. package/dist/asset_forwarding.js.map +0 -1
  129. package/dist/commands/sync-env.d.ts +0 -8
  130. package/dist/commands/sync-env.js +0 -32
  131. package/dist/commands/sync-env.js.map +0 -1
  132. package/dist/main.d.ts +0 -2
  133. package/dist/main.js +0 -10
  134. package/dist/main.js.map +0 -1
  135. package/dist/platform/KeyValueStore.d.ts +0 -6
  136. package/dist/platform/KeyValueStore.js +0 -96
  137. package/dist/platform/KeyValueStore.js.map +0 -1
  138. package/dist/platform/index.d.ts +0 -1
  139. package/dist/platform/index.js +0 -2
  140. package/dist/platform/index.js.map +0 -1
  141. package/dist/socket_util.js.map +0 -1
  142. package/dist/util/Accumulator.js.map +0 -1
  143. package/dist/util/Diagnostic.d.ts +0 -5
  144. package/dist/util/Diagnostic.js +0 -10
  145. package/dist/util/Diagnostic.js.map +0 -1
  146. package/dist/util/Mutex.js.map +0 -1
  147. package/dist/util/boundLayer.d.ts +0 -2
  148. package/dist/util/boundLayer.js +0 -4
  149. package/dist/util/boundLayer.js.map +0 -1
  150. package/dist/util/logCause.d.ts +0 -2
  151. package/dist/util/logCause.js +0 -7
  152. package/dist/util/logCause.js.map +0 -1
  153. package/dist/util/phantom.js.map +0 -1
  154. package/dist/util/schema.js.map +0 -1
  155. package/main.ts +0 -19
  156. package/platform/KeyValueStore.ts +0 -112
  157. package/platform/index.ts +0 -1
  158. package/util/Diagnostic.ts +0 -16
  159. package/util/boundLayer.ts +0 -11
  160. package/util/logCause.ts +0 -8
  161. /package/{actor/ActorTransport.ts → ActorTransport.ts} +0 -0
  162. /package/{actor/ClientHandle.ts → ClientHandle.ts} +0 -0
  163. /package/{actor/F.ts → F.ts} +0 -0
  164. /package/{actor/Protocol.ts → Protocol.ts} +0 -0
  165. /package/{util → _util}/Mutex.ts +0 -0
  166. /package/{util → _util}/phantom.ts +0 -0
  167. /package/{util → _util}/schema.ts +0 -0
  168. /package/{socket_util.ts → _util/socket.ts} +0 -0
  169. /package/dist/{util/Accumulator.d.ts → Accumulator.d.ts} +0 -0
  170. /package/dist/{actor/ActorTransport.d.ts → ActorTransport.d.ts} +0 -0
  171. /package/dist/{actor/ActorTransport.js → ActorTransport.js} +0 -0
  172. /package/dist/{actor/Audition.d.ts → Audition.d.ts} +0 -0
  173. /package/dist/{actor/Client.d.ts → Client.d.ts} +0 -0
  174. /package/dist/{actor/ClientHandle.d.ts → ClientHandle.d.ts} +0 -0
  175. /package/dist/{actor/ClientHandle.js → ClientHandle.js} +0 -0
  176. /package/dist/{actor/F.d.ts → F.d.ts} +0 -0
  177. /package/dist/{actor/F.js → F.js} +0 -0
  178. /package/dist/{actor/Method.js → Method.js} +0 -0
  179. /package/dist/{actor/Protocol.d.ts → Protocol.d.ts} +0 -0
  180. /package/dist/{actor/Protocol.js → Protocol.js} +0 -0
  181. /package/dist/{util → _util}/Mutex.d.ts +0 -0
  182. /package/dist/{util → _util}/Mutex.js +0 -0
  183. /package/dist/{util → _util}/phantom.d.ts +0 -0
  184. /package/dist/{util → _util}/phantom.js +0 -0
  185. /package/dist/{util → _util}/schema.d.ts +0 -0
  186. /package/dist/{util → _util}/schema.js +0 -0
  187. /package/dist/{socket_util.d.ts → _util/socket.d.ts} +0 -0
  188. /package/dist/{actor/errors.d.ts → errors.d.ts} +0 -0
  189. /package/dist/{actor/errors.js → errors.js} +0 -0
  190. /package/{actor/errors.ts → errors.ts} +0 -0
package/Kv.ts DELETED
@@ -1,65 +0,0 @@
1
- import { Effect, Schema as S, Option, Context, Layer } from "effect"
2
-
3
- import * as Binding from "./Binding.ts"
4
-
5
- export interface Kv<
6
- Self,
7
- Id extends string,
8
- Key extends S.Top & { Encoded: string },
9
- Value extends S.Top,
10
- > extends Context.Service<Self, KVNamespace> {
11
- new (_: never): Context.ServiceClass<Self, Id, KVNamespace>
12
-
13
- ""?: [Key, Value]
14
-
15
- readonly put: (key: Key["Type"], value: Value["Type"]) => Effect.Effect<void, S.SchemaError, Self>
16
-
17
- readonly get: (key: Key["Type"]) => Effect.Effect<Option.Option<Value["Type"]>, S.SchemaError, Self>
18
-
19
- readonly remove: (key: Key["Type"]) => Effect.Effect<void, S.SchemaError, Self>
20
-
21
- readonly layer: (binding: string) => Layer.Layer<Self, S.SchemaError>
22
- }
23
-
24
- export const Kv =
25
- <Self>() =>
26
- <Id extends string, Key extends S.Top & { Encoded: string }, Value extends S.Top>(
27
- id: Id,
28
- definition: {
29
- readonly key: Key
30
- readonly value: Value
31
- },
32
- ): Kv<Self, Id, Key, Value> => {
33
- const tag = Context.Service<Self, KVNamespace>()(id)
34
-
35
- const { key, value } = definition
36
- const encodeKey = S.encodeEffect(key)
37
- const encodeValue = S.encodeEffect(S.fromJsonString(S.toCodecJson(value)))
38
- const decodeValue = S.decodeUnknownEffect(S.fromJsonString(S.toCodecJson(value)))
39
-
40
- const put = Effect.fnUntraced(function* (key: Key["Type"], value: Value["Type"]) {
41
- const kv = yield* tag
42
- const keyEncoded = yield* encodeKey(key)
43
- const valueEncoded = yield* encodeValue(value)
44
- yield* Effect.promise(() => kv.put(keyEncoded, valueEncoded))
45
- })
46
-
47
- const get = Effect.fnUntraced(function* (key: Key["Type"]) {
48
- const kv = yield* tag
49
- const keyEncoded = yield* encodeKey(key)
50
- const valueEncoded = yield* Effect.promise(() => kv.get(keyEncoded))
51
- if (valueEncoded) {
52
- return yield* decodeValue(valueEncoded).pipe(Effect.map(Option.some))
53
- }
54
- return Option.none()
55
- })
56
-
57
- const remove = Effect.fnUntraced(function* (key: Key["Type"]) {
58
- const kv = yield* tag
59
- const keyEncoded = yield* encodeKey(key)
60
- yield* Effect.promise(() => kv.delete(keyEncoded))
61
- })
62
-
63
- const layer = Binding.layer(tag, ["put", "get", "delete"])
64
- return Object.assign(tag, { definition, put, get, remove, layer }) as never
65
- }
package/NativeRequest.ts DELETED
@@ -1,3 +0,0 @@
1
- import { Context } from "effect"
2
-
3
- export class NativeRequest extends Context.Service<NativeRequest, Request>()("liminal/NativeRequest") {}
package/R2.ts DELETED
@@ -1,7 +0,0 @@
1
- import { Context } from "effect"
2
-
3
- import * as Binding from "./Binding.ts"
4
-
5
- export class R2 extends Context.Service<R2, R2Bucket>()("liminal/R2") {}
6
-
7
- export const layer = Binding.layer(R2, ["put", "get"])
package/Worker.ts DELETED
@@ -1,54 +0,0 @@
1
- import { env } from "cloudflare:workers"
2
- import { Context, Layer, Scope, Effect, ManagedRuntime, ConfigProvider } from "effect"
3
- import {
4
- HttpServerRequest,
5
- HttpServerResponse,
6
- HttpServerError,
7
- HttpClient,
8
- FetchHttpClient,
9
- } from "effect/unstable/http"
10
-
11
- import { NativeRequest } from "./NativeRequest.ts"
12
- import * as Diagnostic from "./util/Diagnostic.ts"
13
- import { logCause } from "./util/logCause.ts"
14
-
15
- const { span } = Diagnostic.module("cloudflare.Entry")
16
-
17
- export class ExecutionContext extends Context.Service<ExecutionContext, globalThis.ExecutionContext>()(
18
- "liminal/ExecutionContext",
19
- ) {}
20
-
21
- export interface WorkerConfig<ROut, E> {
22
- readonly prelude: Layer.Layer<ROut, E>
23
- readonly handler: Effect.Effect<
24
- HttpServerResponse.HttpServerResponse,
25
- HttpServerError.HttpServerError,
26
- ExecutionContext | HttpServerRequest.HttpServerRequest | HttpClient.HttpClient | NativeRequest | ROut | Scope.Scope
27
- >
28
- }
29
-
30
- export const make = <ROut, E>({ handler, prelude: layer }: WorkerConfig<ROut, E>) => {
31
- const runtime = ManagedRuntime.make(
32
- Layer.mergeAll(FetchHttpClient.layer, ConfigProvider.layer(ConfigProvider.fromUnknown(env))),
33
- )
34
- const fetch = (request: Request, _env: unknown, ctx: globalThis.ExecutionContext): Promise<Response> =>
35
- handler.pipe(
36
- Effect.map(HttpServerResponse.toWeb),
37
- Effect.provide([
38
- layer,
39
- Layer.succeed(ExecutionContext, ctx),
40
- Layer.succeed(NativeRequest, request),
41
- Layer.succeed(HttpServerRequest.HttpServerRequest, HttpServerRequest.fromWeb(request)),
42
- ]),
43
- Effect.scoped,
44
- Effect.tapCause(logCause),
45
- span("fetch"),
46
- // Solves crashes between HMRs.
47
- // Without this, in-flight requests use an old memoMap; new requests use a new one.
48
- // Aka. cross-contamination.
49
- // TODO: investigate whether better-solved by https://github.com/dmmulroy/effect-cloudflare/blob/main/src/internal/wrangler.ts
50
- Effect.provideService(Layer.CurrentMemoMap, runtime.memoMap),
51
- runtime.runPromise,
52
- )
53
- return { fetch }
54
- }
package/WorkerLoader.ts DELETED
@@ -1,29 +0,0 @@
1
- import { absurd, Effect, Context } from "effect"
2
- import { HttpServerResponse } from "effect/unstable/http"
3
-
4
- import * as Binding from "./Binding.ts"
5
-
6
- export class WorkerLoader extends Context.Service<WorkerLoader, globalThis.WorkerLoader>()("liminal/WorkerLoader") {}
7
-
8
- export const layer = Binding.layer(WorkerLoader, ["load"])
9
-
10
- export const load = (id: string, code: string) =>
11
- Effect.gen({ self: this }, function* () {
12
- const loader = yield* WorkerLoader
13
- return loader.get(id, () => ({
14
- compatibilityDate: "2026-04-21",
15
- mainModule: "main.js",
16
- modules: { "main.js": code },
17
- allowExperimental: true,
18
- globalOutbound: null,
19
- }))
20
- })
21
-
22
- export const run = (id: string, request: Request) =>
23
- Effect.gen({ self: this }, function* () {
24
- const loader = yield* WorkerLoader
25
- const worker = loader.get(id, () => absurd<never>(null!))
26
- return yield* Effect.tryPromise(() => worker.getEntrypoint().fetch(request)).pipe(
27
- Effect.map(HttpServerResponse.fromWeb),
28
- )
29
- })
package/actor/index.ts DELETED
@@ -1,11 +0,0 @@
1
- export * as Actor from "./Actor.ts"
2
- export * as ActorRegistry from "./ActorRegistry.ts"
3
- export * as Audition from "./Audition.ts"
4
- export * as Client from "./Client.ts"
5
- export * as ClientDirectory from "./ClientDirectory.ts"
6
- export * as ClientHandle from "./ClientHandle.ts"
7
- export * as Method from "./Method.ts"
8
- export * as Protocol from "./Protocol.ts"
9
- export * from "./ActorTransport.ts"
10
- export * from "./F.ts"
11
- export * from "./errors.ts"
@@ -1,13 +0,0 @@
1
- import { Effect, Layer } from "effect"
2
- import { HttpServerResponse } from "effect/unstable/http"
3
-
4
- import * as Assets from "./Assets.ts"
5
- import * as Worker from "./Worker.ts"
6
-
7
- export default Worker.make({
8
- handler: Assets.forward.pipe(
9
- Effect.provide(Assets.layer("ASSETS")),
10
- Effect.catch(() => Effect.succeed(HttpServerResponse.empty({ status: 500 }))),
11
- ),
12
- prelude: Layer.empty,
13
- })
@@ -1,30 +0,0 @@
1
- import { Config, Effect, Path, Redacted } from "effect"
2
- import { Argument, Command } from "effect/unstable/cli"
3
- import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process"
4
-
5
- export const syncEnv = Command.make("sync-env", {
6
- worker: Argument.directory("worker", { mustExist: true }),
7
- configFile: Argument.file("config-file", { mustExist: true }),
8
- configExport: Argument.string("config-export").pipe(Argument.withDefault("config")),
9
- }).pipe(
10
- Command.withHandler(
11
- Effect.fn(function* ({ worker, configFile, configExport }) {
12
- const path = yield* Path.Path
13
- const spawner = yield* ChildProcessSpawner.ChildProcessSpawner
14
- const url = yield* path.toFileUrl(path.resolve(configFile))
15
- const module = yield* Effect.tryPromise(() => import(url.href))
16
- const config = module[configExport] as Config.Config<Record<string, Redacted.Redacted<string>>>
17
- const env = yield* config
18
- for (const [name, value] of Object.entries(env)) {
19
- yield* spawner.spawn(
20
- ChildProcess.make({
21
- stdout: "inherit",
22
- stderr: "inherit",
23
- cwd: worker,
24
- })`pnpm wrangler secret put ${name} ${Redacted.value(value)}`,
25
- )
26
- yield* Effect.log(`Synced ${name} to ${worker}.`)
27
- }
28
- }),
29
- ),
30
- )
package/dist/Ai.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Context } from "effect";
2
- declare const Ai_base: Context.ServiceClass<Ai, "liminal/Ai", globalThis.Ai<AiModels>>;
3
- export declare class Ai extends Ai_base {
4
- }
5
- export declare const layer: (binding: string) => import("effect/Layer").Layer<Ai, import("effect/Schema").SchemaError, never>;
6
- export {};
package/dist/Ai.js DELETED
@@ -1,6 +0,0 @@
1
- import { Context } from "effect";
2
- import * as Binding from "./Binding.js";
3
- export class Ai extends Context.Service()("liminal/Ai") {
4
- }
5
- export const layer = Binding.layer(Ai, ["run"]);
6
- //# sourceMappingURL=Ai.js.map
package/dist/Ai.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Ai.js","sourceRoot":"","sources":["../Ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,OAAO,EAAG,SAAQ,OAAO,CAAC,OAAO,EAAqB,CAAC,YAAY,CAAC;CAAG;AAE7E,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA"}
package/dist/Assets.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Effect, Context } from "effect";
2
- import { HttpServerResponse } from "effect/unstable/http";
3
- import { NativeRequest } from "./NativeRequest.ts";
4
- declare const Assets_base: Context.ServiceClass<Assets, "liminal/Assets", {
5
- readonly fetch: typeof fetch;
6
- }>;
7
- export declare class Assets extends Assets_base {
8
- }
9
- export declare const layer: (binding: string) => import("effect/Layer").Layer<Assets, import("effect/Schema").SchemaError, never>;
10
- export declare const forward: Effect.Effect<HttpServerResponse.HttpServerResponse, never, Assets | NativeRequest>;
11
- export {};
package/dist/Assets.js DELETED
@@ -1,14 +0,0 @@
1
- import { Effect, Context } from "effect";
2
- import { HttpServerResponse } from "effect/unstable/http";
3
- import * as Binding from "./Binding.js";
4
- import { NativeRequest } from "./NativeRequest.js";
5
- export class Assets extends Context.Service()("liminal/Assets") {
6
- }
7
- export const layer = Binding.layer(Assets, ["fetch"]);
8
- export const forward = Effect.gen({ self: this }, function* () {
9
- const assets = yield* Assets;
10
- const request = yield* NativeRequest;
11
- const response = yield* Effect.promise(() => assets.fetch(request));
12
- return HttpServerResponse.fromWeb(response);
13
- });
14
- //# sourceMappingURL=Assets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Assets.js","sourceRoot":"","sources":["../Assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,OAAO,EAKxC,CAAC,gBAAgB,CAAC;CAAG;AAExB,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;AAErD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,CAAC;IACzD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAA;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,aAAa,CAAA;IACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IACnE,OAAO,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC7C,CAAC,CAAC,CAAA"}
package/dist/Binding.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Context, Layer, Schema as S } from "effect";
2
- export declare const layer: <Self, Identifier extends string, Shape, ROut = never, E = never, RIn = never>(tag: Context.ServiceClass<Self, Identifier, Shape>, keys: ReadonlyArray<string>, derive?: (resource: Shape) => Layer.Layer<ROut, E, RIn> | undefined) => (binding: string) => Layer.Layer<ROut | Self, E | S.SchemaError, RIn>;
package/dist/Binding.js DELETED
@@ -1,19 +0,0 @@
1
- import { env } from "cloudflare:workers";
2
- import { Context, Layer, Effect, Schema as S, SchemaIssue } from "effect";
3
- export const layer = (tag, keys, derive) => (binding) => Effect.gen(function* () {
4
- const resolved = env[binding];
5
- if (!resolved) {
6
- return yield* Effect.fail(new S.SchemaError(new SchemaIssue.Pointer([binding], new SchemaIssue.MissingKey({
7
- messageMissingKey: `Missing binding "${binding}" on env`,
8
- }))));
9
- }
10
- for (const key of keys) {
11
- if (!(key in resolved)) {
12
- return yield* Effect.fail(new S.SchemaError(new SchemaIssue.Pointer([key], new SchemaIssue.MissingKey({
13
- messageMissingKey: `Expected key \`${key}\` on binding \`${binding}\``,
14
- }))));
15
- }
16
- }
17
- return Layer.mergeAll(Layer.succeed(tag, resolved), derive?.(resolved) ?? Layer.empty);
18
- }).pipe(Layer.unwrap);
19
- //# sourceMappingURL=Binding.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Binding.js","sourceRoot":"","sources":["../Binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzE,MAAM,CAAC,MAAM,KAAK,GAChB,CACE,GAAkD,EAClD,IAA2B,EAC3B,MAAmE,EACnE,EAAE,CACJ,CAAC,OAAe,EAAE,EAAE,CAClB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAI,GAAa,CAAC,OAAO,CAAC,CAAA;IACxC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,CAAC,CAAC,WAAW,CACf,IAAI,WAAW,CAAC,OAAO,CACrB,CAAC,OAAO,CAAC,EACT,IAAI,WAAW,CAAC,UAAU,CAAC;YACzB,iBAAiB,EAAE,oBAAoB,OAAO,UAAU;SACzD,CAAC,CACH,CACF,CACF,CAAA;IACH,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,CAAC;YACvB,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,CAAC,CAAC,WAAW,CACf,IAAI,WAAW,CAAC,OAAO,CACrB,CAAC,GAAG,CAAC,EACL,IAAI,WAAW,CAAC,UAAU,CAAC;gBACzB,iBAAiB,EAAE,kBAAkB,GAAG,mBAAmB,OAAO,IAAI;aACvE,CAAC,CACH,CACF,CACF,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;AACxF,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}
package/dist/D1.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { D1Client } from "@effect/sql-d1";
2
- import { Context } from "effect";
3
- declare const D1_base: Context.ServiceClass<D1, "liminal/D1", D1Database>;
4
- export declare class D1 extends D1_base {
5
- }
6
- export declare const layer: (binding: string) => import("effect/Layer").Layer<D1 | D1Client.D1Client | import("effect/unstable/sql/SqlClient").SqlClient, import("effect/Config").ConfigError | import("effect/Schema").SchemaError, never>;
7
- export {};
package/dist/D1.js DELETED
@@ -1,7 +0,0 @@
1
- import { D1Client } from "@effect/sql-d1";
2
- import { Context } from "effect";
3
- import * as Binding from "./Binding.js";
4
- export class D1 extends Context.Service()("liminal/D1") {
5
- }
6
- export const layer = Binding.layer(D1, ["exec"], (db) => D1Client.layer({ db }));
7
- //# sourceMappingURL=D1.js.map
package/dist/D1.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"D1.js","sourceRoot":"","sources":["../D1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,OAAO,EAAG,SAAQ,OAAO,CAAC,OAAO,EAAkB,CAAC,YAAY,CAAC;CAAG;AAE1E,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA"}
package/dist/DoState.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { Context } from "effect";
2
- declare const DoState_base: Context.ServiceClass<DoState, "liminal/DoState", DurableObjectState<{}>>;
3
- export declare class DoState extends DoState_base {
4
- }
5
- export {};
package/dist/DoState.js DELETED
@@ -1,4 +0,0 @@
1
- import { Context } from "effect";
2
- export class DoState extends Context.Service()("liminal/DoState") {
3
- }
4
- //# sourceMappingURL=DoState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DoState.js","sourceRoot":"","sources":["../DoState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,MAAM,OAAO,OAAQ,SAAQ,OAAO,CAAC,OAAO,EAA8C,CAAC,iBAAiB,CAAC;CAAG"}
@@ -1,7 +0,0 @@
1
- import { Effect, Redacted, Context } from "effect";
2
- declare const Hyperdrive_base: Context.ServiceClass<Hyperdrive, "liminal/Hyperdrive", globalThis.Hyperdrive>;
3
- export declare class Hyperdrive extends Hyperdrive_base {
4
- }
5
- export declare const layer: (binding: string) => import("effect/Layer").Layer<Hyperdrive, import("effect/Schema").SchemaError, never>;
6
- export declare const connectionString: Effect.Effect<Redacted.Redacted<string>, never, Hyperdrive>;
7
- export {};
@@ -1,7 +0,0 @@
1
- import { Effect, Redacted, Context } from "effect";
2
- import * as Binding from "./Binding.js";
3
- export class Hyperdrive extends Context.Service()("liminal/Hyperdrive") {
4
- }
5
- export const layer = Binding.layer(Hyperdrive, ["connectionString"]);
6
- export const connectionString = Hyperdrive.asEffect().pipe(Effect.map(({ connectionString }) => Redacted.make(connectionString)));
7
- //# sourceMappingURL=Hyperdrive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Hyperdrive.js","sourceRoot":"","sources":["../Hyperdrive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAElD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,OAAO,UAAW,SAAQ,OAAO,CAAC,OAAO,EAAqC,CAAC,oBAAoB,CAAC;CAAG;AAE7G,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAA;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,IAAI,CACxD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CACtE,CAAA"}
package/dist/Images.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { Data, Context, Pipeable, Effect } from "effect";
2
- declare const Images_base: Context.ServiceClass<Images, "liminal/ImageTransformer", ImagesBinding>;
3
- export declare class Images extends Images_base {
4
- }
5
- export declare const layer: (binding: string) => import("effect/Layer").Layer<Images, import("effect/Schema").SchemaError, never>;
6
- declare const TypeId: "~liminal/Images/Transformation";
7
- export interface Steps extends Pipeable.Pipeable {
8
- readonly [TypeId]: typeof TypeId;
9
- readonly steps: ReadonlyArray<Step>;
10
- }
11
- export interface DrawOptions {
12
- image: ReadableStream<Uint8Array> | ImageTransformer;
13
- options?: ImageDrawOptions | undefined;
14
- }
15
- export type Step = Data.TaggedEnum<{
16
- Transform: {
17
- transform: ImageTransform;
18
- };
19
- Draw: DrawOptions;
20
- }>;
21
- export declare const empty: Steps;
22
- export declare const transform: {
23
- (transform: ImageTransform): (steps: Steps) => Steps;
24
- (steps: Steps, transform: ImageTransform): Steps;
25
- };
26
- export declare const draw: {
27
- (draw: DrawOptions): (steps: Steps) => Steps;
28
- (steps: Steps, draw: DrawOptions): Steps;
29
- };
30
- export interface ProcessConfig {
31
- readonly stream: ReadableStream<Uint8Array>;
32
- readonly inputOptions?: ImageInputOptions | undefined;
33
- readonly outputOptions: ImageOutputOptions;
34
- }
35
- export declare const process: {
36
- (config: ProcessConfig): (steps: Steps) => Effect.Effect<ImageTransformationResult, never, Images>;
37
- (steps: Steps, config: ProcessConfig): Effect.Effect<ImageTransformationResult, never, Images>;
38
- };
39
- export {};
package/dist/Images.js DELETED
@@ -1,60 +0,0 @@
1
- import { Data, Context, Pipeable, Function, Effect } from "effect";
2
- import * as Binding from "./Binding.js";
3
- export class Images extends Context.Service()("liminal/ImageTransformer") {
4
- }
5
- export const layer = Binding.layer(Images, ["transform", "draw", "output"]);
6
- const TypeId = "~liminal/Images/Transformation";
7
- export const empty = {
8
- [TypeId]: TypeId,
9
- steps: [],
10
- pipe() {
11
- return Pipeable.pipeArguments(this, arguments);
12
- },
13
- };
14
- export const transform = Function.dual(2, (steps, transform) => ({
15
- [TypeId]: TypeId,
16
- steps: [
17
- ...steps.steps,
18
- {
19
- _tag: "Transform",
20
- transform,
21
- },
22
- ],
23
- pipe() {
24
- return Pipeable.pipeArguments(this, arguments);
25
- },
26
- }));
27
- export const draw = Function.dual(2, (steps, draw) => ({
28
- [TypeId]: TypeId,
29
- steps: [
30
- ...steps.steps,
31
- {
32
- _tag: "Draw",
33
- ...draw,
34
- },
35
- ],
36
- pipe() {
37
- return Pipeable.pipeArguments(this, arguments);
38
- },
39
- }));
40
- export const process = Function.dual(2, Effect.fnUntraced(function* ({ steps }, { stream, inputOptions, outputOptions }) {
41
- const images = yield* Images;
42
- let transformer = images.input(stream, inputOptions);
43
- for (let i = 0; i < steps.length; i++) {
44
- const step = steps[i];
45
- switch (step._tag) {
46
- case "Draw": {
47
- const { image, options } = step;
48
- transformer = transformer.draw(image, options);
49
- break;
50
- }
51
- case "Transform": {
52
- const { transform } = step;
53
- transformer = transformer.transform(transform);
54
- break;
55
- }
56
- }
57
- }
58
- return yield* Effect.promise(() => transformer.output(outputOptions));
59
- }));
60
- //# sourceMappingURL=Images.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Images.js","sourceRoot":"","sources":["../Images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAElE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,OAAO,EAAoC,CAAC,0BAA0B,CAAC;CAAG;AAE9G,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE3E,MAAM,MAAM,GAAG,gCAAyC,CAAA;AAmBxD,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,CAAC,MAAM,CAAC,EAAE,MAAM;IAChB,KAAK,EAAE,EAAE;IACT,IAAI;QACF,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAChD,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAGlB,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAY,EAAE,SAAyB,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC,MAAM,CAAC,EAAE,MAAM;IAChB,KAAK,EAAE;QACL,GAAG,KAAK,CAAC,KAAK;QACd;YACE,IAAI,EAAE,WAAW;YAC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W,CAAC,CAAC,CAAC;gBACjB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;gBAC1B,WAAW,GAAG,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;gBAC9C,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAA;AACvE,CAAC,CAAC,CACH,CAAA"}
package/dist/Kv.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { Effect, Schema as S, Option, Context, Layer } from "effect";
2
- export interface Kv<Self, Id extends string, Key extends S.Top & {
3
- Encoded: string;
4
- }, Value extends S.Top> extends Context.Service<Self, KVNamespace> {
5
- new (_: never): Context.ServiceClass<Self, Id, KVNamespace>;
6
- ""?: [Key, Value];
7
- readonly put: (key: Key["Type"], value: Value["Type"]) => Effect.Effect<void, S.SchemaError, Self>;
8
- readonly get: (key: Key["Type"]) => Effect.Effect<Option.Option<Value["Type"]>, S.SchemaError, Self>;
9
- readonly remove: (key: Key["Type"]) => Effect.Effect<void, S.SchemaError, Self>;
10
- readonly layer: (binding: string) => Layer.Layer<Self, S.SchemaError>;
11
- }
12
- export declare const Kv: <Self>() => <Id extends string, Key extends S.Top & {
13
- Encoded: string;
14
- }, Value extends S.Top>(id: Id, definition: {
15
- readonly key: Key;
16
- readonly value: Value;
17
- }) => Kv<Self, Id, Key, Value>;
package/dist/Kv.js DELETED
@@ -1,32 +0,0 @@
1
- import { Effect, Schema as S, Option, Context, Layer } from "effect";
2
- import * as Binding from "./Binding.js";
3
- export const Kv = () => (id, definition) => {
4
- const tag = Context.Service()(id);
5
- const { key, value } = definition;
6
- const encodeKey = S.encodeEffect(key);
7
- const encodeValue = S.encodeEffect(S.fromJsonString(S.toCodecJson(value)));
8
- const decodeValue = S.decodeUnknownEffect(S.fromJsonString(S.toCodecJson(value)));
9
- const put = Effect.fnUntraced(function* (key, value) {
10
- const kv = yield* tag;
11
- const keyEncoded = yield* encodeKey(key);
12
- const valueEncoded = yield* encodeValue(value);
13
- yield* Effect.promise(() => kv.put(keyEncoded, valueEncoded));
14
- });
15
- const get = Effect.fnUntraced(function* (key) {
16
- const kv = yield* tag;
17
- const keyEncoded = yield* encodeKey(key);
18
- const valueEncoded = yield* Effect.promise(() => kv.get(keyEncoded));
19
- if (valueEncoded) {
20
- return yield* decodeValue(valueEncoded).pipe(Effect.map(Option.some));
21
- }
22
- return Option.none();
23
- });
24
- const remove = Effect.fnUntraced(function* (key) {
25
- const kv = yield* tag;
26
- const keyEncoded = yield* encodeKey(key);
27
- yield* Effect.promise(() => kv.delete(keyEncoded));
28
- });
29
- const layer = Binding.layer(tag, ["put", "get", "delete"]);
30
- return Object.assign(tag, { definition, put, get, remove, layer });
31
- };
32
- //# sourceMappingURL=Kv.js.map
package/dist/Kv.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Kv.js","sourceRoot":"","sources":["../Kv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAqBvC,MAAM,CAAC,MAAM,EAAE,GACb,GAAS,EAAE,CACX,CACE,EAAM,EACN,UAGC,EACyB,EAAE;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAqB,CAAC,EAAE,CAAC,CAAA;IAEpD,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,UAAU,CAAA;IACjC,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;I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AAE,GAAG,KAAK,CAAC,CAAC,GAAG,CAAA;QACrB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QACxC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC1D,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAU,CAAA;AAC7E,CAAC,CAAA"}
@@ -1,5 +0,0 @@
1
- import { Context } from "effect";
2
- declare const NativeRequest_base: Context.ServiceClass<NativeRequest, "liminal/NativeRequest", Request<unknown, CfProperties<unknown>>>;
3
- export declare class NativeRequest extends NativeRequest_base {
4
- }
5
- export {};
@@ -1,4 +0,0 @@
1
- import { Context } from "effect";
2
- export class NativeRequest extends Context.Service()("liminal/NativeRequest") {
3
- }
4
- //# sourceMappingURL=NativeRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeRequest.js","sourceRoot":"","sources":["../NativeRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,MAAM,OAAO,aAAc,SAAQ,OAAO,CAAC,OAAO,EAA0B,CAAC,uBAAuB,CAAC;CAAG"}
package/dist/R2.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Context } from "effect";
2
- declare const R2_base: Context.ServiceClass<R2, "liminal/R2", R2Bucket>;
3
- export declare class R2 extends R2_base {
4
- }
5
- export declare const layer: (binding: string) => import("effect/Layer").Layer<R2, import("effect/Schema").SchemaError, never>;
6
- export {};
package/dist/R2.js DELETED
@@ -1,6 +0,0 @@
1
- import { Context } from "effect";
2
- import * as Binding from "./Binding.js";
3
- export class R2 extends Context.Service()("liminal/R2") {
4
- }
5
- export const layer = Binding.layer(R2, ["put", "get"]);
6
- //# sourceMappingURL=R2.js.map
package/dist/R2.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"R2.js","sourceRoot":"","sources":["../R2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAEhC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,OAAO,EAAG,SAAQ,OAAO,CAAC,OAAO,EAAgB,CAAC,YAAY,CAAC;CAAG;AAExE,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAA"}
package/dist/Worker.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import { Context, Layer, Scope, Effect } from "effect";
2
- import { HttpServerRequest, HttpServerResponse, HttpServerError, HttpClient } from "effect/unstable/http";
3
- import { NativeRequest } from "./NativeRequest.ts";
4
- declare const ExecutionContext_base: Context.ServiceClass<ExecutionContext, "liminal/ExecutionContext", globalThis.ExecutionContext<unknown>>;
5
- export declare class ExecutionContext extends ExecutionContext_base {
6
- }
7
- export interface WorkerConfig<ROut, E> {
8
- readonly prelude: Layer.Layer<ROut, E>;
9
- readonly handler: Effect.Effect<HttpServerResponse.HttpServerResponse, HttpServerError.HttpServerError, ExecutionContext | HttpServerRequest.HttpServerRequest | HttpClient.HttpClient | NativeRequest | ROut | Scope.Scope>;
10
- }
11
- export declare const make: <ROut, E>({ handler, prelude: layer }: WorkerConfig<ROut, E>) => {
12
- fetch: (request: Request, _env: unknown, ctx: globalThis.ExecutionContext) => Promise<Response>;
13
- };
14
- export {};
package/dist/Worker.js DELETED
@@ -1,25 +0,0 @@
1
- import { env } from "cloudflare:workers";
2
- import { Context, Layer, Scope, Effect, ManagedRuntime, ConfigProvider } from "effect";
3
- import { HttpServerRequest, HttpServerResponse, HttpServerError, HttpClient, FetchHttpClient, } from "effect/unstable/http";
4
- import { NativeRequest } from "./NativeRequest.js";
5
- import * as Diagnostic from "./util/Diagnostic.js";
6
- import { logCause } from "./util/logCause.js";
7
- const { span } = Diagnostic.module("cloudflare.Entry");
8
- export class ExecutionContext extends Context.Service()("liminal/ExecutionContext") {
9
- }
10
- export const make = ({ handler, prelude: layer }) => {
11
- const runtime = ManagedRuntime.make(Layer.mergeAll(FetchHttpClient.layer, ConfigProvider.layer(ConfigProvider.fromUnknown(env))));
12
- const fetch = (request, _env, ctx) => handler.pipe(Effect.map(HttpServerResponse.toWeb), Effect.provide([
13
- layer,
14
- Layer.succeed(ExecutionContext, ctx),
15
- Layer.succeed(NativeRequest, request),
16
- Layer.succeed(HttpServerRequest.HttpServerRequest, HttpServerRequest.fromWeb(request)),
17
- ]), Effect.scoped, Effect.tapCause(logCause), span("fetch"),
18
- // Solves crashes between HMRs.
19
- // Without this, in-flight requests use an old memoMap; new requests use a new one.
20
- // Aka. cross-contamination.
21
- // TODO: investigate whether better-solved by https://github.com/dmmulroy/effect-cloudflare/blob/main/src/internal/wrangler.ts
22
- Effect.provideService(Layer.CurrentMemoMap, runtime.memoMap), runtime.runPromise);
23
- return { fetch };
24
- };
25
- //# sourceMappingURL=Worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Worker.js","sourceRoot":"","sources":["../Worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACtF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,eAAe,GAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB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U,CACnB,CAAA;IACH,OAAO,EAAE,KAAK,EAAE,CAAA;AAClB,CAAC,CAAA"}
@@ -1,9 +0,0 @@
1
- import { Effect, Context } from "effect";
2
- import { HttpServerResponse } from "effect/unstable/http";
3
- declare const WorkerLoader_base: Context.ServiceClass<WorkerLoader, "liminal/WorkerLoader", globalThis.WorkerLoader>;
4
- export declare class WorkerLoader extends WorkerLoader_base {
5
- }
6
- export declare const layer: (binding: string) => import("effect/Layer").Layer<WorkerLoader, import("effect/Schema").SchemaError, never>;
7
- export declare const load: (id: string, code: string) => Effect.Effect<WorkerStub, never, WorkerLoader>;
8
- export declare const run: (id: string, request: Request) => Effect.Effect<HttpServerResponse.HttpServerResponse, import("effect/Cause").UnknownError, WorkerLoader>;
9
- export {};