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.
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 +9 -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
@@ -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"
@@ -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
- })
@@ -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
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