liminal 0.17.11 → 0.17.12
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/{util/Accumulator.ts → Accumulator.ts} +2 -2
- package/{actor/Actor.ts → Actor.ts} +3 -3
- package/{actor/Audition.ts → Audition.ts} +2 -2
- package/CHANGELOG.md +9 -0
- package/{actor/Client.ts → Client.ts} +3 -3
- package/{actor/ClientDirectory.ts → ClientDirectory.ts} +4 -4
- package/{actor/Method.ts → Method.ts} +6 -6
- package/_diagnostic.ts +3 -0
- package/browser/BrowserActorNamespace.ts +213 -0
- package/browser/index.ts +1 -0
- package/dist/{util/Accumulator.js → Accumulator.js} +2 -2
- package/dist/Accumulator.js.map +1 -0
- package/dist/{actor/Actor.d.ts → Actor.d.ts} +1 -1
- package/dist/{actor/Actor.js → Actor.js} +2 -2
- package/dist/Actor.js.map +1 -0
- package/dist/ActorTransport.js.map +1 -0
- package/dist/{actor/Audition.js → Audition.js} +2 -2
- package/dist/Audition.js.map +1 -0
- package/dist/{actor/Client.js → Client.js} +3 -3
- package/dist/Client.js.map +1 -0
- package/dist/{actor/ClientDirectory.d.ts → ClientDirectory.d.ts} +1 -1
- package/dist/{actor/ClientDirectory.js → ClientDirectory.js} +3 -3
- package/dist/ClientDirectory.js.map +1 -0
- package/dist/ClientHandle.js.map +1 -0
- package/dist/F.js.map +1 -0
- package/dist/{actor/Method.d.ts → Method.d.ts} +4 -4
- package/dist/Method.js.map +1 -0
- package/dist/Protocol.js.map +1 -0
- package/dist/_diagnostic.d.ts +4 -0
- package/dist/_diagnostic.js +3 -0
- package/dist/_diagnostic.js.map +1 -0
- package/dist/_util/Mutex.js.map +1 -0
- package/dist/_util/phantom.js.map +1 -0
- package/dist/_util/schema.js.map +1 -0
- package/dist/{socket_util.js → _util/socket.js} +1 -1
- package/dist/_util/socket.js.map +1 -0
- package/dist/browser/BrowserActorNamespace.d.ts +16 -0
- package/dist/browser/BrowserActorNamespace.js +112 -0
- package/dist/browser/BrowserActorNamespace.js.map +1 -0
- package/dist/browser/index.d.ts +1 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +11 -12
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/package.json +12 -16
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workerd/WorkerdActorNamespace.d.ts +23 -0
- package/dist/{actor/ActorRegistry.js → workerd/WorkerdActorNamespace.js} +18 -19
- package/dist/workerd/WorkerdActorNamespace.js.map +1 -0
- package/dist/workerd/index.d.ts +1 -0
- package/dist/workerd/index.js +2 -0
- package/dist/workerd/index.js.map +1 -0
- package/index.ts +11 -12
- package/package.json +12 -16
- package/tsconfig.json +2 -1
- package/{actor/ActorRegistry.ts → workerd/WorkerdActorNamespace.ts} +44 -44
- package/workerd/index.ts +1 -0
- package/Ai.ts +0 -7
- package/Assets.ts +0 -21
- package/Binding.ts +0 -40
- package/D1.ts +0 -8
- package/DoState.ts +0 -3
- package/Hyperdrive.ts +0 -11
- package/Images.ts +0 -101
- package/Kv.ts +0 -65
- package/NativeRequest.ts +0 -3
- package/R2.ts +0 -7
- package/Worker.ts +0 -54
- package/WorkerLoader.ts +0 -29
- package/actor/index.ts +0 -11
- package/asset_forwarding.ts +0 -13
- package/commands/sync-env.ts +0 -30
- package/dist/Ai.d.ts +0 -6
- package/dist/Ai.js +0 -6
- package/dist/Ai.js.map +0 -1
- package/dist/Assets.d.ts +0 -11
- package/dist/Assets.js +0 -14
- package/dist/Assets.js.map +0 -1
- package/dist/Binding.d.ts +0 -2
- package/dist/Binding.js +0 -19
- package/dist/Binding.js.map +0 -1
- package/dist/D1.d.ts +0 -7
- package/dist/D1.js +0 -7
- package/dist/D1.js.map +0 -1
- package/dist/DoState.d.ts +0 -5
- package/dist/DoState.js +0 -4
- package/dist/DoState.js.map +0 -1
- package/dist/Hyperdrive.d.ts +0 -7
- package/dist/Hyperdrive.js +0 -7
- package/dist/Hyperdrive.js.map +0 -1
- package/dist/Images.d.ts +0 -39
- package/dist/Images.js +0 -60
- package/dist/Images.js.map +0 -1
- package/dist/Kv.d.ts +0 -17
- package/dist/Kv.js +0 -32
- package/dist/Kv.js.map +0 -1
- package/dist/NativeRequest.d.ts +0 -5
- package/dist/NativeRequest.js +0 -4
- package/dist/NativeRequest.js.map +0 -1
- package/dist/R2.d.ts +0 -6
- package/dist/R2.js +0 -6
- package/dist/R2.js.map +0 -1
- package/dist/Worker.d.ts +0 -14
- package/dist/Worker.js +0 -25
- package/dist/Worker.js.map +0 -1
- package/dist/WorkerLoader.d.ts +0 -9
- package/dist/WorkerLoader.js +0 -22
- package/dist/WorkerLoader.js.map +0 -1
- package/dist/actor/Actor.js.map +0 -1
- package/dist/actor/ActorRegistry.d.ts +0 -23
- package/dist/actor/ActorRegistry.js.map +0 -1
- package/dist/actor/ActorTransport.js.map +0 -1
- package/dist/actor/Audition.js.map +0 -1
- package/dist/actor/Client.js.map +0 -1
- package/dist/actor/ClientDirectory.js.map +0 -1
- package/dist/actor/ClientHandle.js.map +0 -1
- package/dist/actor/F.js.map +0 -1
- package/dist/actor/Method.js.map +0 -1
- package/dist/actor/Protocol.js.map +0 -1
- package/dist/actor/errors.js.map +0 -1
- package/dist/actor/index.d.ts +0 -11
- package/dist/actor/index.js +0 -12
- package/dist/actor/index.js.map +0 -1
- package/dist/asset_forwarding.d.ts +0 -4
- package/dist/asset_forwarding.js +0 -9
- package/dist/asset_forwarding.js.map +0 -1
- package/dist/commands/sync-env.d.ts +0 -8
- package/dist/commands/sync-env.js +0 -32
- package/dist/commands/sync-env.js.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -10
- package/dist/main.js.map +0 -1
- package/dist/platform/KeyValueStore.d.ts +0 -6
- package/dist/platform/KeyValueStore.js +0 -96
- package/dist/platform/KeyValueStore.js.map +0 -1
- package/dist/platform/index.d.ts +0 -1
- package/dist/platform/index.js +0 -2
- package/dist/platform/index.js.map +0 -1
- package/dist/socket_util.js.map +0 -1
- package/dist/util/Accumulator.js.map +0 -1
- package/dist/util/Diagnostic.d.ts +0 -5
- package/dist/util/Diagnostic.js +0 -10
- package/dist/util/Diagnostic.js.map +0 -1
- package/dist/util/Mutex.js.map +0 -1
- package/dist/util/boundLayer.d.ts +0 -2
- package/dist/util/boundLayer.js +0 -4
- package/dist/util/boundLayer.js.map +0 -1
- package/dist/util/logCause.d.ts +0 -2
- package/dist/util/logCause.js +0 -7
- package/dist/util/logCause.js.map +0 -1
- package/dist/util/phantom.js.map +0 -1
- package/dist/util/schema.js.map +0 -1
- package/main.ts +0 -19
- package/platform/KeyValueStore.ts +0 -112
- package/platform/index.ts +0 -1
- package/util/Diagnostic.ts +0 -16
- package/util/boundLayer.ts +0 -11
- package/util/logCause.ts +0 -8
- /package/{actor/ActorTransport.ts → ActorTransport.ts} +0 -0
- /package/{actor/ClientHandle.ts → ClientHandle.ts} +0 -0
- /package/{actor/F.ts → F.ts} +0 -0
- /package/{actor/Protocol.ts → Protocol.ts} +0 -0
- /package/{util → _util}/Mutex.ts +0 -0
- /package/{util → _util}/phantom.ts +0 -0
- /package/{util → _util}/schema.ts +0 -0
- /package/{socket_util.ts → _util/socket.ts} +0 -0
- /package/dist/{util/Accumulator.d.ts → Accumulator.d.ts} +0 -0
- /package/dist/{actor/ActorTransport.d.ts → ActorTransport.d.ts} +0 -0
- /package/dist/{actor/ActorTransport.js → ActorTransport.js} +0 -0
- /package/dist/{actor/Audition.d.ts → Audition.d.ts} +0 -0
- /package/dist/{actor/Client.d.ts → Client.d.ts} +0 -0
- /package/dist/{actor/ClientHandle.d.ts → ClientHandle.d.ts} +0 -0
- /package/dist/{actor/ClientHandle.js → ClientHandle.js} +0 -0
- /package/dist/{actor/F.d.ts → F.d.ts} +0 -0
- /package/dist/{actor/F.js → F.js} +0 -0
- /package/dist/{actor/Method.js → Method.js} +0 -0
- /package/dist/{actor/Protocol.d.ts → Protocol.d.ts} +0 -0
- /package/dist/{actor/Protocol.js → Protocol.js} +0 -0
- /package/dist/{util → _util}/Mutex.d.ts +0 -0
- /package/dist/{util → _util}/Mutex.js +0 -0
- /package/dist/{util → _util}/phantom.d.ts +0 -0
- /package/dist/{util → _util}/phantom.js +0 -0
- /package/dist/{util → _util}/schema.d.ts +0 -0
- /package/dist/{util → _util}/schema.js +0 -0
- /package/dist/{socket_util.d.ts → _util/socket.d.ts} +0 -0
- /package/dist/{actor/errors.d.ts → errors.d.ts} +0 -0
- /package/dist/{actor/errors.js → errors.js} +0 -0
- /package/{actor/errors.ts → errors.ts} +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Effect, Layer } from "effect"
|
|
2
|
-
import { KeyValueStore } from "effect/unstable/persistence"
|
|
3
|
-
|
|
4
|
-
import { R2 } from "../R2.ts"
|
|
5
|
-
|
|
6
|
-
export const layerR2 = ({ root }: { readonly root?: string | undefined } = {}) => {
|
|
7
|
-
const prefix = root === undefined ? "" : root.endsWith("/") ? root : `${root}/`
|
|
8
|
-
const toKey = (key: string) => `${prefix}${key}`
|
|
9
|
-
const lsOptions = (cursor: string | undefined): R2ListOptions =>
|
|
10
|
-
cursor
|
|
11
|
-
? prefix
|
|
12
|
-
? { cursor, limit: 1000, prefix }
|
|
13
|
-
: { cursor, limit: 1000 }
|
|
14
|
-
: prefix
|
|
15
|
-
? { limit: 1000, prefix }
|
|
16
|
-
: { limit: 1000 }
|
|
17
|
-
|
|
18
|
-
return Layer.effect(
|
|
19
|
-
KeyValueStore.KeyValueStore,
|
|
20
|
-
Effect.gen(function* () {
|
|
21
|
-
const r2 = yield* R2
|
|
22
|
-
return KeyValueStore.make({
|
|
23
|
-
get: (key) =>
|
|
24
|
-
Effect.tryPromise({
|
|
25
|
-
try: async () => {
|
|
26
|
-
const object = await r2.get(toKey(key))
|
|
27
|
-
return object === null ? undefined : await object.text()
|
|
28
|
-
},
|
|
29
|
-
catch: (cause) =>
|
|
30
|
-
new KeyValueStore.KeyValueStoreError({
|
|
31
|
-
method: "get",
|
|
32
|
-
key,
|
|
33
|
-
message: `Unable to get item with key ${key}`,
|
|
34
|
-
cause,
|
|
35
|
-
}),
|
|
36
|
-
}),
|
|
37
|
-
getUint8Array: (key) =>
|
|
38
|
-
Effect.tryPromise({
|
|
39
|
-
try: async () => {
|
|
40
|
-
const object = await r2.get(toKey(key))
|
|
41
|
-
return object === null ? undefined : new Uint8Array(await object.arrayBuffer())
|
|
42
|
-
},
|
|
43
|
-
catch: (cause) =>
|
|
44
|
-
new KeyValueStore.KeyValueStoreError({
|
|
45
|
-
method: "getUint8Array",
|
|
46
|
-
key,
|
|
47
|
-
message: `Unable to get item with key ${key}`,
|
|
48
|
-
cause,
|
|
49
|
-
}),
|
|
50
|
-
}),
|
|
51
|
-
set: (key, value) =>
|
|
52
|
-
Effect.tryPromise({
|
|
53
|
-
try: () => r2.put(toKey(key), value),
|
|
54
|
-
catch: (cause) =>
|
|
55
|
-
new KeyValueStore.KeyValueStoreError({
|
|
56
|
-
method: "set",
|
|
57
|
-
key,
|
|
58
|
-
message: `Unable to set item with key ${key}`,
|
|
59
|
-
cause,
|
|
60
|
-
}),
|
|
61
|
-
}).pipe(Effect.asVoid),
|
|
62
|
-
remove: (key) =>
|
|
63
|
-
Effect.tryPromise({
|
|
64
|
-
try: () => r2.delete(toKey(key)),
|
|
65
|
-
catch: (cause) =>
|
|
66
|
-
new KeyValueStore.KeyValueStoreError({
|
|
67
|
-
method: "remove",
|
|
68
|
-
key,
|
|
69
|
-
message: `Unable to remove item with key ${key}`,
|
|
70
|
-
cause,
|
|
71
|
-
}),
|
|
72
|
-
}),
|
|
73
|
-
clear: Effect.tryPromise({
|
|
74
|
-
try: async () => {
|
|
75
|
-
let cursor: string | undefined
|
|
76
|
-
do {
|
|
77
|
-
const listed = await r2.list(lsOptions(cursor))
|
|
78
|
-
if (listed.objects.length > 0) {
|
|
79
|
-
await r2.delete(listed.objects.map((o) => o.key))
|
|
80
|
-
}
|
|
81
|
-
cursor = listed.truncated ? listed.cursor : undefined
|
|
82
|
-
} while (cursor)
|
|
83
|
-
},
|
|
84
|
-
catch: (cause) =>
|
|
85
|
-
new KeyValueStore.KeyValueStoreError({
|
|
86
|
-
method: "clear",
|
|
87
|
-
message: `Unable to clear storage`,
|
|
88
|
-
cause,
|
|
89
|
-
}),
|
|
90
|
-
}),
|
|
91
|
-
size: Effect.tryPromise({
|
|
92
|
-
try: async () => {
|
|
93
|
-
let total = 0
|
|
94
|
-
let cursor: string | undefined
|
|
95
|
-
do {
|
|
96
|
-
const listed = await r2.list(lsOptions(cursor))
|
|
97
|
-
total += listed.objects.length
|
|
98
|
-
cursor = listed.truncated ? listed.cursor : undefined
|
|
99
|
-
} while (cursor)
|
|
100
|
-
return total
|
|
101
|
-
},
|
|
102
|
-
catch: (cause) =>
|
|
103
|
-
new KeyValueStore.KeyValueStoreError({
|
|
104
|
-
method: "size",
|
|
105
|
-
message: `Unable to get size`,
|
|
106
|
-
cause,
|
|
107
|
-
}),
|
|
108
|
-
}),
|
|
109
|
-
})
|
|
110
|
-
}),
|
|
111
|
-
)
|
|
112
|
-
}
|
package/platform/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * as KeyValueStore from "./KeyValueStore.ts"
|
package/util/Diagnostic.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Effect, Tracer } from "effect"
|
|
2
|
-
|
|
3
|
-
export const module = (module: string) => ({
|
|
4
|
-
debug: (event: string, annotations?: Record<string, unknown>) =>
|
|
5
|
-
Effect.logDebug(event).pipe(
|
|
6
|
-
Effect.annotateLogs({
|
|
7
|
-
package: "liminal",
|
|
8
|
-
module,
|
|
9
|
-
...annotations,
|
|
10
|
-
}),
|
|
11
|
-
),
|
|
12
|
-
span:
|
|
13
|
-
(operation: string, options?: Tracer.SpanOptions | undefined) =>
|
|
14
|
-
<A, E, R>(effect: Effect.Effect<A, E, R>) =>
|
|
15
|
-
Effect.withSpan(effect, `liminal.${module}.${operation}`, options),
|
|
16
|
-
})
|
package/util/boundLayer.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { References, Effect, Layer } from "effect"
|
|
2
|
-
|
|
3
|
-
import { logCause } from "./logCause.ts"
|
|
4
|
-
|
|
5
|
-
export const boundLayer = (boundary: string) =>
|
|
6
|
-
Layer.provideMerge(
|
|
7
|
-
Layer.effect(
|
|
8
|
-
References.CurrentLogAnnotations,
|
|
9
|
-
Effect.map(References.CurrentLogAnnotations.asEffect(), (existing) => ({ ...existing, _boundary: boundary })),
|
|
10
|
-
).pipe(Layer.tapCause(logCause), Layer.provideMerge(Layer.succeed(References.MinimumLogLevel, "All"))),
|
|
11
|
-
)
|
package/util/logCause.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Cause, Effect, Schema as S, flow } from "effect"
|
|
2
|
-
|
|
3
|
-
const formatReason = <E>(reason: Cause.Reason<E>): unknown => {
|
|
4
|
-
const value = Cause.isFailReason(reason) ? reason.error : Cause.isDieReason(reason) ? reason.defect : reason
|
|
5
|
-
return S.isSchemaError(value) ? value.toString() : value
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const logCause = <E>(cause: Cause.Cause<E>) => Effect.forEach(cause.reasons, flow(formatReason, Effect.logError))
|
|
File without changes
|
|
File without changes
|
/package/{actor/F.ts → F.ts}
RENAMED
|
File without changes
|
|
File without changes
|
/package/{util → _util}/Mutex.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|