@livestore/utils 0.3.0-dev.9 → 0.3.1-dev.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/LICENSE +201 -0
- package/dist/.tsbuildinfo.json +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/base64.d.ts.map +1 -1
- package/dist/bun/mod.d.ts +5 -0
- package/dist/bun/mod.d.ts.map +1 -0
- package/dist/bun/mod.js +10 -0
- package/dist/bun/mod.js.map +1 -0
- package/dist/cuid/cuid.browser.d.ts.map +1 -1
- package/dist/cuid/cuid.node.d.ts.map +1 -1
- package/dist/effect/BucketQueue.d.ts +15 -3
- package/dist/effect/BucketQueue.d.ts.map +1 -1
- package/dist/effect/BucketQueue.js +24 -7
- package/dist/effect/BucketQueue.js.map +1 -1
- package/dist/effect/Effect.d.ts +4 -2
- package/dist/effect/Effect.d.ts.map +1 -1
- package/dist/effect/Effect.js +21 -18
- package/dist/effect/Effect.js.map +1 -1
- package/dist/effect/Logger.d.ts +2 -0
- package/dist/effect/Logger.d.ts.map +1 -1
- package/dist/effect/Logger.js +16 -1
- package/dist/effect/Logger.js.map +1 -1
- package/dist/effect/Scheduler.d.ts.map +1 -1
- package/dist/effect/Schema/debug-diff.d.ts.map +1 -1
- package/dist/effect/Schema/index.d.ts +3 -0
- package/dist/effect/Schema/index.d.ts.map +1 -1
- package/dist/effect/Schema/index.js +19 -0
- package/dist/effect/Schema/index.js.map +1 -1
- package/dist/effect/Schema/msgpack.d.ts +1 -1
- package/dist/effect/Schema/msgpack.d.ts.map +1 -1
- package/dist/effect/ServiceContext.d.ts.map +1 -1
- package/dist/effect/Stream.d.ts.map +1 -1
- package/dist/effect/Subscribable.d.ts +3 -0
- package/dist/effect/Subscribable.d.ts.map +1 -1
- package/dist/effect/Subscribable.js +8 -3
- package/dist/effect/Subscribable.js.map +1 -1
- package/dist/effect/TaskTracing.d.ts.map +1 -1
- package/dist/effect/{WebChannel.d.ts → WebChannel/WebChannel.d.ts} +39 -17
- package/dist/effect/WebChannel/WebChannel.d.ts.map +1 -0
- package/dist/effect/WebChannel/WebChannel.js +300 -0
- package/dist/effect/WebChannel/WebChannel.js.map +1 -0
- package/dist/effect/WebChannel/WebChannel.test.d.ts +2 -0
- package/dist/effect/WebChannel/WebChannel.test.d.ts.map +1 -0
- package/dist/effect/WebChannel/WebChannel.test.js +62 -0
- package/dist/effect/WebChannel/WebChannel.test.js.map +1 -0
- package/dist/effect/WebChannel/broadcastChannelWithAck.d.ts +5 -6
- package/dist/effect/WebChannel/broadcastChannelWithAck.d.ts.map +1 -1
- package/dist/effect/WebChannel/broadcastChannelWithAck.js +12 -9
- package/dist/effect/WebChannel/broadcastChannelWithAck.js.map +1 -1
- package/dist/effect/WebChannel/common.d.ts +29 -1
- package/dist/effect/WebChannel/common.d.ts.map +1 -1
- package/dist/effect/WebChannel/common.js +26 -1
- package/dist/effect/WebChannel/common.js.map +1 -1
- package/dist/effect/WebChannel/mod.d.ts +4 -0
- package/dist/effect/WebChannel/mod.d.ts.map +1 -0
- package/dist/effect/WebChannel/mod.js +4 -0
- package/dist/effect/WebChannel/mod.js.map +1 -0
- package/dist/effect/WebLock.d.ts.map +1 -1
- package/dist/effect/WebSocket.d.ts +3 -2
- package/dist/effect/WebSocket.d.ts.map +1 -1
- package/dist/effect/WebSocket.js +45 -19
- package/dist/effect/WebSocket.js.map +1 -1
- package/dist/effect/WebSocket.test.d.ts +2 -0
- package/dist/effect/WebSocket.test.d.ts.map +1 -0
- package/dist/effect/WebSocket.test.js +11 -0
- package/dist/effect/WebSocket.test.js.map +1 -0
- package/dist/effect/index.d.ts +5 -3
- package/dist/effect/index.d.ts.map +1 -1
- package/dist/effect/index.js +6 -5
- package/dist/effect/index.js.map +1 -1
- package/dist/env.d.ts +4 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +7 -12
- package/dist/env.js.map +1 -1
- package/dist/fast-deep-equal.d.ts.map +1 -1
- package/dist/guards.d.ts.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/misc.d.ts +3 -0
- package/dist/misc.d.ts.map +1 -1
- package/dist/misc.js +23 -0
- package/dist/misc.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts +0 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js +21 -11
- package/dist/node/ChildProcessRunner/ChildProcessRunner.js.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts +2 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.d.ts.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js +39 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.js.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts +75 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.d.ts.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js +62 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/schema.js.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts +2 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.d.ts.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js +42 -0
- package/dist/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.js.map +1 -0
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts +1 -4
- package/dist/node/ChildProcessRunner/ChildProcessWorker.d.ts.map +1 -1
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js +1 -4
- package/dist/node/ChildProcessRunner/ChildProcessWorker.js.map +1 -1
- package/dist/node/mod.d.ts +3 -16
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +24 -75
- package/dist/node/mod.js.map +1 -1
- package/dist/object/index.d.ts.map +1 -1
- package/dist/object/omit.d.ts.map +1 -1
- package/dist/object/pick.d.ts.map +1 -1
- package/dist/promise.d.ts.map +1 -1
- package/dist/set.d.ts.map +1 -1
- package/dist/string.d.ts.map +1 -1
- package/dist/time.d.ts.map +1 -1
- package/package.json +52 -43
- package/src/bun/mod.ts +13 -0
- package/src/effect/BucketQueue.ts +32 -7
- package/src/effect/Effect.ts +33 -20
- package/src/effect/Logger.ts +23 -1
- package/src/effect/Schema/index.ts +27 -0
- package/src/effect/Subscribable.ts +12 -0
- package/src/effect/WebChannel/WebChannel.test.ts +106 -0
- package/src/effect/WebChannel/WebChannel.ts +502 -0
- package/src/effect/WebChannel/broadcastChannelWithAck.ts +86 -83
- package/src/effect/WebChannel/common.ts +61 -2
- package/src/effect/WebChannel/mod.ts +3 -0
- package/src/effect/WebSocket.test.ts +15 -0
- package/src/effect/WebSocket.ts +75 -36
- package/src/effect/index.ts +31 -2
- package/src/env.ts +9 -13
- package/src/index.ts +6 -12
- package/src/misc.ts +31 -0
- package/src/node/ChildProcessRunner/ChildProcessRunner.ts +40 -29
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/ChildProcessRunner.test.ts +52 -0
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/schema.ts +65 -0
- package/src/node/ChildProcessRunner/ChildProcessRunnerTest/serializedWorker.ts +53 -0
- package/src/node/ChildProcessRunner/ChildProcessWorker.ts +3 -6
- package/src/node/mod.ts +30 -103
- package/dist/effect/WebChannel.d.ts.map +0 -1
- package/dist/effect/WebChannel.js +0 -175
- package/dist/effect/WebChannel.js.map +0 -1
- package/dist/nanoid/index.browser.d.ts +0 -2
- package/dist/nanoid/index.browser.d.ts.map +0 -1
- package/dist/nanoid/index.browser.js +0 -3
- package/dist/nanoid/index.browser.js.map +0 -1
- package/src/effect/WebChannel.ts +0 -305
- package/src/nanoid/index.browser.ts +0 -2
- package/tmp/effect-deferred-repro.ts +0 -29
- package/tmp/effect-semaphore-repro.ts +0 -93
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as Runner from '@effect/platform/WorkerRunner'
|
|
2
|
+
import { Context, Effect, Layer, Option, Stream } from 'effect'
|
|
3
|
+
|
|
4
|
+
// import { NodeRuntime, NodeWorkerRunner } from '@effect/platform-node'
|
|
5
|
+
import { PlatformNode } from '../../mod.js'
|
|
6
|
+
import * as ChildProcessRunner from '../ChildProcessRunner.js'
|
|
7
|
+
import { Person, User, WorkerMessage } from './schema.js'
|
|
8
|
+
|
|
9
|
+
interface Name {
|
|
10
|
+
readonly _: unique symbol
|
|
11
|
+
}
|
|
12
|
+
const Name = Context.GenericTag<Name, string>('Name')
|
|
13
|
+
|
|
14
|
+
const WorkerLive = Runner.layerSerialized(WorkerMessage, {
|
|
15
|
+
GetPersonById: (req) => {
|
|
16
|
+
return Stream.make(
|
|
17
|
+
new Person({ id: req.id, name: 'test', data: new Uint8Array([1, 2, 3]) }),
|
|
18
|
+
new Person({ id: req.id, name: 'ing', data: new Uint8Array([4, 5, 6]) }),
|
|
19
|
+
)
|
|
20
|
+
},
|
|
21
|
+
GetUserById: (req) => Effect.map(Name, (name) => new User({ id: req.id, name })),
|
|
22
|
+
// InitialMessage: (req) => Layer.succeed(Name, req.name),
|
|
23
|
+
InitialMessage: (req) =>
|
|
24
|
+
Effect.gen(function* () {
|
|
25
|
+
yield* Effect.addFinalizer(() => Effect.log('closing worker scope'))
|
|
26
|
+
return Layer.succeed(Name, req.name)
|
|
27
|
+
}).pipe(Layer.unwrapScoped),
|
|
28
|
+
// InitialMessage: (req) =>
|
|
29
|
+
// Layer.scoped(
|
|
30
|
+
// Name,
|
|
31
|
+
// Effect.gen(function* () {
|
|
32
|
+
// yield* Effect.addFinalizer(() => Effect.log('closing worker scope'))
|
|
33
|
+
// return req.name
|
|
34
|
+
// }),
|
|
35
|
+
// ),
|
|
36
|
+
GetSpan: (_) =>
|
|
37
|
+
Effect.gen(function* (_) {
|
|
38
|
+
const span = yield* _(Effect.currentSpan, Effect.orDie)
|
|
39
|
+
return {
|
|
40
|
+
traceId: span.traceId,
|
|
41
|
+
spanId: span.spanId,
|
|
42
|
+
name: span.name,
|
|
43
|
+
parent: Option.map(span.parent, (span) => ({
|
|
44
|
+
traceId: span.traceId,
|
|
45
|
+
spanId: span.spanId,
|
|
46
|
+
})),
|
|
47
|
+
}
|
|
48
|
+
}).pipe(Effect.withSpan('GetSpan')),
|
|
49
|
+
RunnerInterrupt: () => Effect.interrupt,
|
|
50
|
+
}).pipe(Layer.provide(ChildProcessRunner.layer))
|
|
51
|
+
// }).pipe(Layer.provide(PlatformNode.NodeWorkerRunner.layer))
|
|
52
|
+
|
|
53
|
+
PlatformNode.NodeRuntime.runMain(Runner.launch(WorkerLive))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable prefer-arrow/prefer-arrow-functions */
|
|
2
2
|
|
|
3
|
-
import type * as ChildProcess from 'node:child_process'
|
|
4
|
-
|
|
5
3
|
import * as Worker from '@effect/platform/Worker'
|
|
6
4
|
import { WorkerError } from '@effect/platform/WorkerError'
|
|
5
|
+
// eslint-disable-next-line unicorn/prefer-node-protocol
|
|
6
|
+
import type * as ChildProcess from 'child_process'
|
|
7
7
|
import * as Deferred from 'effect/Deferred'
|
|
8
8
|
import * as Effect from 'effect/Effect'
|
|
9
9
|
import * as Exit from 'effect/Exit'
|
|
@@ -23,8 +23,8 @@ const platformWorkerImpl = Worker.makePlatform<ChildProcess.ChildProcess>()({
|
|
|
23
23
|
childProcess.send([1])
|
|
24
24
|
return Deferred.await(exitDeferred)
|
|
25
25
|
}).pipe(
|
|
26
|
-
Effect.interruptible,
|
|
27
26
|
Effect.timeout(5000),
|
|
27
|
+
Effect.interruptible,
|
|
28
28
|
Effect.catchAllCause(() => Effect.sync(() => childProcess.kill())),
|
|
29
29
|
),
|
|
30
30
|
),
|
|
@@ -55,12 +55,9 @@ const platformWorkerImpl = Worker.makePlatform<ChildProcess.ChildProcess>()({
|
|
|
55
55
|
},
|
|
56
56
|
})
|
|
57
57
|
|
|
58
|
-
/** @internal */
|
|
59
58
|
export const layerWorker = Layer.succeed(Worker.PlatformWorker, platformWorkerImpl)
|
|
60
59
|
|
|
61
|
-
/** @internal */
|
|
62
60
|
export const layerManager = Layer.provide(Worker.layerManager, layerWorker)
|
|
63
61
|
|
|
64
|
-
/** @internal */
|
|
65
62
|
export const layer = (spawn: (id: number) => ChildProcess.ChildProcess) =>
|
|
66
63
|
Layer.merge(layerManager, Worker.layerSpawner(spawn))
|
package/src/node/mod.ts
CHANGED
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import type * as otel from '@opentelemetry/api'
|
|
3
|
-
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
4
|
-
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
|
|
5
|
-
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'
|
|
6
|
-
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'
|
|
7
|
-
import { Config, Effect, Layer } from 'effect'
|
|
8
|
-
import type { ParentSpan } from 'effect/Tracer'
|
|
1
|
+
import * as http from 'node:http'
|
|
9
2
|
|
|
10
|
-
import {
|
|
11
|
-
import { OtelTracer } from '../effect/index.js'
|
|
12
|
-
import { makeNoopTracer } from '../NoopTracer.js'
|
|
3
|
+
import { Effect, Layer } from 'effect'
|
|
13
4
|
|
|
14
|
-
|
|
5
|
+
import { OtelTracer, UnknownError } from '../effect/index.js'
|
|
6
|
+
import { makeNoopTracer } from '../NoopTracer.js'
|
|
15
7
|
|
|
16
8
|
export * as Cli from '@effect/cli'
|
|
17
|
-
export * as PlatformBun from '@effect/platform-bun'
|
|
18
9
|
export * as PlatformNode from '@effect/platform-node'
|
|
19
|
-
export * as SocketServer from '@effect/
|
|
20
|
-
export * as OtelResource from '@effect/opentelemetry/Resource'
|
|
21
|
-
|
|
22
|
-
export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
|
|
23
|
-
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
24
|
-
export * as OtelNodeSdk from '@effect/opentelemetry/NodeSdk'
|
|
10
|
+
export * as SocketServer from '@effect/platform/SocketServer'
|
|
25
11
|
|
|
26
12
|
export * as ChildProcessRunner from './ChildProcessRunner/ChildProcessRunner.js'
|
|
27
13
|
export * as ChildProcessWorker from './ChildProcessRunner/ChildProcessWorker.js'
|
|
@@ -31,6 +17,31 @@ export * as ChildProcessWorker from './ChildProcessRunner/ChildProcessWorker.js'
|
|
|
31
17
|
|
|
32
18
|
// export const OtelLiveHttp = (args: any): Layer.Layer<never> => Layer.empty
|
|
33
19
|
|
|
20
|
+
export const getFreePort = Effect.async<number, UnknownError>((cb, signal) => {
|
|
21
|
+
const server = http.createServer()
|
|
22
|
+
|
|
23
|
+
signal.addEventListener('abort', () => {
|
|
24
|
+
server.close()
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Listen on port 0 to get an available port
|
|
28
|
+
server.listen(0, () => {
|
|
29
|
+
const address = server.address()
|
|
30
|
+
|
|
31
|
+
if (address && typeof address === 'object') {
|
|
32
|
+
const port = address.port
|
|
33
|
+
server.close(() => cb(Effect.succeed(port)))
|
|
34
|
+
} else {
|
|
35
|
+
server.close(() => cb(Effect.fail(new UnknownError({ cause: 'Failed to get a free port' }))))
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Error handling in case the server encounters an error
|
|
40
|
+
server.on('error', (err) => {
|
|
41
|
+
server.close(() => cb(Effect.fail(new UnknownError({ cause: err }))))
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
34
45
|
export const OtelLiveDummy: Layer.Layer<OtelTracer.OtelTracer> = Layer.suspend(() => {
|
|
35
46
|
const OtelTracerLive = Layer.succeed(OtelTracer.OtelTracer, makeNoopTracer())
|
|
36
47
|
|
|
@@ -40,87 +51,3 @@ export const OtelLiveDummy: Layer.Layer<OtelTracer.OtelTracer> = Layer.suspend((
|
|
|
40
51
|
|
|
41
52
|
return TracingLive
|
|
42
53
|
})
|
|
43
|
-
|
|
44
|
-
export const OtelLiveHttp = ({
|
|
45
|
-
serviceName,
|
|
46
|
-
rootSpanName,
|
|
47
|
-
skipLogUrl,
|
|
48
|
-
}: { serviceName?: string; rootSpanName?: string; skipLogUrl?: boolean } = {}): Layer.Layer<
|
|
49
|
-
OtelTracer.OtelTracer | ParentSpan,
|
|
50
|
-
never,
|
|
51
|
-
never
|
|
52
|
-
> =>
|
|
53
|
-
Effect.gen(function* () {
|
|
54
|
-
const config = yield* Config.all({
|
|
55
|
-
exporterUrlTracing: Config.string('OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'),
|
|
56
|
-
exporterUrlMracing: Config.string('OTEL_EXPORTER_OTLP_METRICS_ENDPOINT'),
|
|
57
|
-
serviceName: serviceName
|
|
58
|
-
? Config.succeed(serviceName)
|
|
59
|
-
: Config.string('OTEL_SERVICE_NAME').pipe(Config.withDefault('overtone-node-utils-default-service')),
|
|
60
|
-
rootSpanName: rootSpanName
|
|
61
|
-
? Config.succeed(rootSpanName)
|
|
62
|
-
: Config.string('OTEL_ROOT_SPAN_NAME').pipe(Config.withDefault('RootSpan')),
|
|
63
|
-
}).pipe(tapCauseLogPretty, Effect.orDie)
|
|
64
|
-
|
|
65
|
-
const resource = { serviceName: config.serviceName }
|
|
66
|
-
|
|
67
|
-
// METRICS
|
|
68
|
-
const metricExporter = new OTLPMetricExporter({ url: config.exporterUrlMracing })
|
|
69
|
-
|
|
70
|
-
const metricReader = new PeriodicExportingMetricReader({
|
|
71
|
-
exporter: metricExporter,
|
|
72
|
-
exportIntervalMillis: 1000,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
// TRACING
|
|
76
|
-
const OtelLive = OtelNodeSdk.layer(() => ({
|
|
77
|
-
resource,
|
|
78
|
-
metricReader,
|
|
79
|
-
spanProcessor: new BatchSpanProcessor(new OTLPTraceExporter({ url: config.exporterUrlTracing, headers: {} })),
|
|
80
|
-
}))
|
|
81
|
-
|
|
82
|
-
const RootSpanLive = Layer.span(config.rootSpanName, {
|
|
83
|
-
attributes: { config },
|
|
84
|
-
onEnd: skipLogUrl ? undefined : (span: any) => logTraceUiUrlForSpan()(span.span),
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
return RootSpanLive.pipe(Layer.provideMerge(OtelLive))
|
|
88
|
-
}).pipe(Layer.unwrapEffect) as any
|
|
89
|
-
|
|
90
|
-
export const logTraceUiUrlForSpan = (printMsg?: (url: string) => string) => (span: otel.Span) =>
|
|
91
|
-
getTracingBackendUrl(span).pipe(
|
|
92
|
-
Effect.tap((url) => {
|
|
93
|
-
if (url === undefined) {
|
|
94
|
-
console.warn('No tracing backend url found')
|
|
95
|
-
} else {
|
|
96
|
-
if (printMsg) {
|
|
97
|
-
console.log(printMsg(url))
|
|
98
|
-
} else {
|
|
99
|
-
console.log(`Trace URL: ${url}`)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}),
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
export const getTracingBackendUrl = (span: otel.Span) =>
|
|
106
|
-
Effect.gen(function* () {
|
|
107
|
-
const endpoint = yield* Config.string('TRACING_UI_ENDPOINT').pipe(Config.option, Effect.orDie)
|
|
108
|
-
if (endpoint._tag === 'None') return
|
|
109
|
-
|
|
110
|
-
const traceId = span.spanContext().traceId
|
|
111
|
-
|
|
112
|
-
// Grafana + Tempo
|
|
113
|
-
|
|
114
|
-
const grafanaEndpoint = endpoint.value
|
|
115
|
-
const searchParams = new URLSearchParams({
|
|
116
|
-
orgId: '1',
|
|
117
|
-
left: JSON.stringify({
|
|
118
|
-
datasource: 'tempo',
|
|
119
|
-
queries: [{ query: traceId, queryType: 'traceql', refId: 'A' }],
|
|
120
|
-
range: { from: 'now-1h', to: 'now' },
|
|
121
|
-
}),
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// TODO make dynamic via env var
|
|
125
|
-
return `${grafanaEndpoint}/explore?${searchParams.toString()}`
|
|
126
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebChannel.d.ts","sourceRoot":"","sources":["../../src/effect/WebChannel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAY,MAAM,EAA6B,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,wBAAwB,CAAA;AAE1E,cAAc,yCAAyC,CAAA;AAEvD,cAAc,wBAAwB,CAAA;AAEtC,eAAO,MAAM,WAAW,GAAI,SAAS,EAAE,OAAO,OAAK,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAa3F,CAAA;AAEJ,eAAO,MAAM,gBAAgB,GAAI,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,yCAGlF;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAA;CAC1E,KAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CA8BK,CAAA;AAEzE,eAAO,MAAM,aAAa,GAAI,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,kDAI/E;IACD,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,EA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,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,UACpE,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,cAAc,CAAC,KACxE;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAClD,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;CAIC,CAAA;AAE/C,MAAM,MAAM,iBAAiB,CAAC,SAAS,EAAE,OAAO,IAAI;IAClD,uCAAuC;IACvC,UAAU,EAAE,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAC1C;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC;;;OAGG;IACH,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;CACtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,EAAE,OAAO,4BAEjD;IACD,MAAM,EACF,MAAM,CAAC,MAAM,CAAC,SAAS,GAAG,OAAO,EAAE,GAAG,CAAC,GACvC;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAAE,CAAA;CACjF,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAwBvE,CAAA"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Deferred, Effect, Either, Option, Predicate, Queue } from 'effect';
|
|
2
|
-
import * as Schema from './Schema/index.js';
|
|
3
|
-
import * as Stream from './Stream.js';
|
|
4
|
-
import { WebChannelSymbol } from './WebChannel/common.js';
|
|
5
|
-
export * from './WebChannel/broadcastChannelWithAck.js';
|
|
6
|
-
export * from './WebChannel/common.js';
|
|
7
|
-
export const noopChannel = () => Effect.gen(function* () {
|
|
8
|
-
return {
|
|
9
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
10
|
-
send: () => Effect.void,
|
|
11
|
-
listen: Stream.never,
|
|
12
|
-
closedDeferred: yield* Deferred.make(),
|
|
13
|
-
schema: {
|
|
14
|
-
listen: Schema.Any,
|
|
15
|
-
send: Schema.Any,
|
|
16
|
-
},
|
|
17
|
-
supportsTransferables: false,
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
export const broadcastChannel = ({ channelName, schema: inputSchema, }) => Effect.gen(function* () {
|
|
21
|
-
const schema = mapSchema(inputSchema);
|
|
22
|
-
const channel = new BroadcastChannel(channelName);
|
|
23
|
-
yield* Effect.addFinalizer(() => Effect.try(() => channel.close()).pipe(Effect.ignoreLogged));
|
|
24
|
-
const send = (message) => Effect.gen(function* () {
|
|
25
|
-
const messageEncoded = yield* Schema.encode(schema.send)(message);
|
|
26
|
-
channel.postMessage(messageEncoded);
|
|
27
|
-
});
|
|
28
|
-
// TODO also listen to `messageerror` in parallel
|
|
29
|
-
const listen = Stream.fromEventListener(channel, 'message').pipe(Stream.map((_) => Schema.decodeEither(schema.listen)(_.data)));
|
|
30
|
-
const closedDeferred = yield* Deferred.make();
|
|
31
|
-
const supportsTransferables = false;
|
|
32
|
-
return {
|
|
33
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
34
|
-
send,
|
|
35
|
-
listen,
|
|
36
|
-
closedDeferred,
|
|
37
|
-
schema,
|
|
38
|
-
supportsTransferables,
|
|
39
|
-
};
|
|
40
|
-
}).pipe(Effect.withSpan(`WebChannel:broadcastChannel(${channelName})`));
|
|
41
|
-
export const windowChannel = ({ window, targetOrigin = '*', schema: inputSchema, }) => Effect.gen(function* () {
|
|
42
|
-
const schema = mapSchema(inputSchema);
|
|
43
|
-
const send = (message) => Effect.gen(function* () {
|
|
44
|
-
const [messageEncoded, transferables] = yield* Schema.encodeWithTransferables(schema.send)(message);
|
|
45
|
-
window.postMessage(messageEncoded, targetOrigin, transferables);
|
|
46
|
-
});
|
|
47
|
-
const listen = Stream.fromEventListener(window, 'message').pipe(Stream.map((_) => Schema.decodeEither(schema.listen)(_.data)));
|
|
48
|
-
const closedDeferred = yield* Deferred.make();
|
|
49
|
-
const supportsTransferables = true;
|
|
50
|
-
return {
|
|
51
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
52
|
-
send,
|
|
53
|
-
listen,
|
|
54
|
-
closedDeferred,
|
|
55
|
-
schema,
|
|
56
|
-
supportsTransferables,
|
|
57
|
-
};
|
|
58
|
-
}).pipe(Effect.withSpan(`WebChannel:windowChannel`));
|
|
59
|
-
export const messagePortChannel = ({ port, schema: inputSchema }) => Effect.gen(function* () {
|
|
60
|
-
const schema = mapSchema(inputSchema);
|
|
61
|
-
const send = (message) => Effect.gen(function* () {
|
|
62
|
-
const [messageEncoded, transferables] = yield* Schema.encodeWithTransferables(schema.send)(message);
|
|
63
|
-
port.postMessage(messageEncoded, transferables);
|
|
64
|
-
});
|
|
65
|
-
const listen = Stream.fromEventListener(port, 'message').pipe(Stream.map((_) => Schema.decodeEither(schema.listen)(_.data)));
|
|
66
|
-
port.start();
|
|
67
|
-
const closedDeferred = yield* Deferred.make();
|
|
68
|
-
const supportsTransferables = true;
|
|
69
|
-
yield* Effect.addFinalizer(() => Effect.try(() => port.close()).pipe(Effect.ignoreLogged));
|
|
70
|
-
return {
|
|
71
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
72
|
-
send,
|
|
73
|
-
listen,
|
|
74
|
-
closedDeferred,
|
|
75
|
-
schema,
|
|
76
|
-
supportsTransferables,
|
|
77
|
-
};
|
|
78
|
-
}).pipe(Effect.withSpan(`WebChannel:messagePortChannel`));
|
|
79
|
-
export const messagePortChannelWithAck = ({ port, schema: inputSchema }) => Effect.gen(function* () {
|
|
80
|
-
const schema = mapSchema(inputSchema);
|
|
81
|
-
const requestAckMap = new Map();
|
|
82
|
-
const ChannelRequest = Schema.TaggedStruct('ChannelRequest', {
|
|
83
|
-
id: Schema.String,
|
|
84
|
-
payload: Schema.Union(schema.listen, schema.send),
|
|
85
|
-
});
|
|
86
|
-
const ChannelRequestAck = Schema.TaggedStruct('ChannelRequestAck', {
|
|
87
|
-
reqId: Schema.String,
|
|
88
|
-
});
|
|
89
|
-
const ChannelMessage = Schema.Union(ChannelRequest, ChannelRequestAck);
|
|
90
|
-
const send = (message) => Effect.gen(function* () {
|
|
91
|
-
const id = crypto.randomUUID();
|
|
92
|
-
const [messageEncoded, transferables] = yield* Schema.encodeWithTransferables(ChannelMessage)({
|
|
93
|
-
_tag: 'ChannelRequest',
|
|
94
|
-
id,
|
|
95
|
-
payload: message,
|
|
96
|
-
});
|
|
97
|
-
const ack = yield* Deferred.make();
|
|
98
|
-
requestAckMap.set(id, ack);
|
|
99
|
-
port.postMessage(messageEncoded, transferables);
|
|
100
|
-
yield* ack;
|
|
101
|
-
requestAckMap.delete(id);
|
|
102
|
-
});
|
|
103
|
-
const listen = Stream.fromEventListener(port, 'message').pipe(Stream.map((_) => Schema.decodeEither(ChannelMessage)(_.data)), Stream.tap((msg) => Effect.gen(function* () {
|
|
104
|
-
if (msg._tag === 'Right') {
|
|
105
|
-
if (msg.right._tag === 'ChannelRequestAck') {
|
|
106
|
-
yield* Deferred.succeed(requestAckMap.get(msg.right.reqId), void 0);
|
|
107
|
-
}
|
|
108
|
-
else if (msg.right._tag === 'ChannelRequest') {
|
|
109
|
-
port.postMessage(Schema.encodeSync(ChannelMessage)({ _tag: 'ChannelRequestAck', reqId: msg.right.id }));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
})), Stream.filterMap((msg) => msg._tag === 'Left'
|
|
113
|
-
? Option.some(msg)
|
|
114
|
-
: msg.right._tag === 'ChannelRequest'
|
|
115
|
-
? Option.some(Either.right(msg.right.payload))
|
|
116
|
-
: Option.none()));
|
|
117
|
-
port.start();
|
|
118
|
-
const closedDeferred = yield* Deferred.make();
|
|
119
|
-
const supportsTransferables = true;
|
|
120
|
-
yield* Effect.addFinalizer(() => Effect.try(() => port.close()).pipe(Effect.ignoreLogged));
|
|
121
|
-
return {
|
|
122
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
123
|
-
send,
|
|
124
|
-
listen,
|
|
125
|
-
closedDeferred,
|
|
126
|
-
schema,
|
|
127
|
-
supportsTransferables,
|
|
128
|
-
};
|
|
129
|
-
}).pipe(Effect.withSpan(`WebChannel:messagePortChannelWithAck`));
|
|
130
|
-
export const mapSchema = (schema) => Predicate.hasProperty(schema, 'send') && Predicate.hasProperty(schema, 'listen')
|
|
131
|
-
? { send: schema.send, listen: schema.listen }
|
|
132
|
-
: { send: schema, listen: schema };
|
|
133
|
-
/**
|
|
134
|
-
* From the outside the `sendQueue` is only accessible read-only,
|
|
135
|
-
* and the `listenQueue` is only accessible write-only.
|
|
136
|
-
*/
|
|
137
|
-
export const queueChannelProxy = ({ schema: inputSchema, }) => Effect.gen(function* () {
|
|
138
|
-
const sendQueue = yield* Queue.unbounded().pipe(Effect.acquireRelease(Queue.shutdown));
|
|
139
|
-
const listenQueue = yield* Queue.unbounded().pipe(Effect.acquireRelease(Queue.shutdown));
|
|
140
|
-
const send = (message) => Queue.offer(sendQueue, message);
|
|
141
|
-
const listen = Stream.fromQueue(listenQueue).pipe(Stream.map(Either.right));
|
|
142
|
-
const closedDeferred = yield* Deferred.make();
|
|
143
|
-
const supportsTransferables = true;
|
|
144
|
-
const schema = mapSchema(inputSchema);
|
|
145
|
-
const webChannel = {
|
|
146
|
-
[WebChannelSymbol]: WebChannelSymbol,
|
|
147
|
-
send,
|
|
148
|
-
listen,
|
|
149
|
-
closedDeferred,
|
|
150
|
-
schema,
|
|
151
|
-
supportsTransferables,
|
|
152
|
-
};
|
|
153
|
-
return { webChannel, sendQueue, listenQueue };
|
|
154
|
-
});
|
|
155
|
-
// export const proxy = <MsgListen, MsgSend>({
|
|
156
|
-
// originWebChannel,
|
|
157
|
-
// proxyWebChannel,
|
|
158
|
-
// }: {
|
|
159
|
-
// originWebChannel: WebChannel<MsgListen, MsgSend>
|
|
160
|
-
// proxyWebChannel: QueueChannelProxy<MsgListen, MsgSend>
|
|
161
|
-
// }) =>
|
|
162
|
-
// Effect.gen(function* () {
|
|
163
|
-
// const proxyListen = originWebChannel.listen.pipe(
|
|
164
|
-
// Stream.flatten(),
|
|
165
|
-
// Stream.tap((_) => Queue.offer(proxyWebChannel.listenQueue, _)),
|
|
166
|
-
// Stream.runDrain,
|
|
167
|
-
// )
|
|
168
|
-
// const proxySend = proxyWebChannel.sendQueue.pipe(
|
|
169
|
-
// Stream.fromQueue,
|
|
170
|
-
// Stream.tap(originWebChannel.send),
|
|
171
|
-
// Stream.runDrain,
|
|
172
|
-
// )
|
|
173
|
-
// yield* Effect.all([proxyListen, proxySend], { concurrency: 2 })
|
|
174
|
-
// })
|
|
175
|
-
//# sourceMappingURL=WebChannel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebChannel.js","sourceRoot":"","sources":["../../src/effect/WebChannel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE3E,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,EAAmB,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE1E,cAAc,yCAAyC,CAAA;AAEvD,cAAc,wBAAwB,CAAA;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,GAAsE,EAAE,CACjG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,OAAO;QACL,CAAC,gBAAgB,CAAC,EAAE,gBAAgB;QACpC,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI;QACvB,MAAM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D,2DAA2D;AAC3D,QAAQ;AACR,8BAA8B;AAC9B,wDAAwD;AACxD,0BAA0B;AAC1B,wEAAwE;AACxE,yBAAyB;AACzB,QAAQ;AAER,wDAAwD;AACxD,0BAA0B;AAC1B,2CAA2C;AAC3C,yBAAyB;AACzB,QAAQ;AAER,sEAAsE;AACtE,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/nanoid/index.browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../src/nanoid/index.browser.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA"}
|