@livestore/utils-dev 0.0.0-snapshot-e5a7caabcf7660aefa55568a44ed0fe306d00597 → 0.0.0-snapshot-9d8807d2c51c95b4df3556744702cea55dc7ded3
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/dist/.tsbuildinfo.json +1 -1
- package/dist/node/mod.d.ts +13 -5
- package/dist/node/mod.d.ts.map +1 -1
- package/dist/node/mod.js +42 -67
- package/dist/node/mod.js.map +1 -1
- package/dist/node-vitest/mod.d.ts +1 -2
- package/dist/node-vitest/mod.d.ts.map +1 -1
- package/dist/node-vitest/mod.js +1 -2
- package/dist/node-vitest/mod.js.map +1 -1
- package/dist/node-vitest/polyfill.d.ts +2 -0
- package/dist/node-vitest/polyfill.d.ts.map +1 -0
- package/dist/node-vitest/{global.js → polyfill.js} +1 -1
- package/dist/node-vitest/polyfill.js.map +1 -0
- package/package.json +22 -16
- package/src/node/mod.ts +82 -81
- package/src/node-vitest/mod.ts +1 -3
- package/dist/node/DockerComposeService/DockerComposeService.d.ts +0 -58
- package/dist/node/DockerComposeService/DockerComposeService.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.js +0 -144
- package/dist/node/DockerComposeService/DockerComposeService.js.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts +0 -2
- package/dist/node/DockerComposeService/DockerComposeService.test.d.ts.map +0 -1
- package/dist/node/DockerComposeService/DockerComposeService.test.js +0 -64
- package/dist/node/DockerComposeService/DockerComposeService.test.js.map +0 -1
- package/dist/node/FileLogger.d.ts +0 -14
- package/dist/node/FileLogger.d.ts.map +0 -1
- package/dist/node/FileLogger.js +0 -151
- package/dist/node/FileLogger.js.map +0 -1
- package/dist/node/cmd-log.d.ts +0 -21
- package/dist/node/cmd-log.d.ts.map +0 -1
- package/dist/node/cmd-log.js +0 -50
- package/dist/node/cmd-log.js.map +0 -1
- package/dist/node/cmd.d.ts +0 -36
- package/dist/node/cmd.d.ts.map +0 -1
- package/dist/node/cmd.js +0 -234
- package/dist/node/cmd.js.map +0 -1
- package/dist/node/cmd.test.d.ts +0 -2
- package/dist/node/cmd.test.d.ts.map +0 -1
- package/dist/node/cmd.test.js +0 -101
- package/dist/node/cmd.test.js.map +0 -1
- package/dist/node-vitest/Vitest.d.ts +0 -52
- package/dist/node-vitest/Vitest.d.ts.map +0 -1
- package/dist/node-vitest/Vitest.js +0 -98
- package/dist/node-vitest/Vitest.js.map +0 -1
- package/dist/node-vitest/Vitest.test.d.ts +0 -2
- package/dist/node-vitest/Vitest.test.d.ts.map +0 -1
- package/dist/node-vitest/Vitest.test.js +0 -70
- package/dist/node-vitest/Vitest.test.js.map +0 -1
- package/dist/node-vitest/global.d.ts +0 -2
- package/dist/node-vitest/global.d.ts.map +0 -1
- package/dist/node-vitest/global.js.map +0 -1
- package/dist/wrangler/WranglerDevServer.d.ts +0 -52
- package/dist/wrangler/WranglerDevServer.d.ts.map +0 -1
- package/dist/wrangler/WranglerDevServer.js +0 -90
- package/dist/wrangler/WranglerDevServer.js.map +0 -1
- package/dist/wrangler/WranglerDevServer.test.d.ts +0 -2
- package/dist/wrangler/WranglerDevServer.test.d.ts.map +0 -1
- package/dist/wrangler/WranglerDevServer.test.js +0 -77
- package/dist/wrangler/WranglerDevServer.test.js.map +0 -1
- package/dist/wrangler/fixtures/cf-worker.d.ts +0 -8
- package/dist/wrangler/fixtures/cf-worker.d.ts.map +0 -1
- package/dist/wrangler/fixtures/cf-worker.js +0 -11
- package/dist/wrangler/fixtures/cf-worker.js.map +0 -1
- package/dist/wrangler/mod.d.ts +0 -2
- package/dist/wrangler/mod.d.ts.map +0 -1
- package/dist/wrangler/mod.js +0 -2
- package/dist/wrangler/mod.js.map +0 -1
- package/src/node/DockerComposeService/DockerComposeService.test.ts +0 -91
- package/src/node/DockerComposeService/DockerComposeService.ts +0 -328
- package/src/node/DockerComposeService/test-fixtures/docker-compose.yml +0 -4
- package/src/node/FileLogger.ts +0 -206
- package/src/node/cmd-log.ts +0 -92
- package/src/node/cmd.test.ts +0 -129
- package/src/node/cmd.ts +0 -419
- package/src/node-vitest/Vitest.test.ts +0 -112
- package/src/node-vitest/Vitest.ts +0 -238
- package/src/wrangler/WranglerDevServer.test.ts +0 -133
- package/src/wrangler/WranglerDevServer.ts +0 -180
- package/src/wrangler/fixtures/cf-worker.ts +0 -11
- package/src/wrangler/fixtures/wrangler.toml +0 -11
- package/src/wrangler/mod.ts +0 -6
- /package/src/node-vitest/{global.ts → polyfill.ts} +0 -0
package/dist/node/mod.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { Tracer } from '@livestore/utils/effect';
|
|
1
|
+
import type { CommandExecutor, PlatformError, Tracer } from '@livestore/utils/effect';
|
|
2
2
|
import { Effect, Layer, OtelTracer } from '@livestore/utils/effect';
|
|
3
3
|
import * as otel from '@opentelemetry/api';
|
|
4
|
-
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
5
4
|
export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
6
|
-
export
|
|
7
|
-
export { type DockerComposeArgs, DockerComposeError, type DockerComposeOperations, DockerComposeService, type LogsOptions, type StartOptions, startDockerComposeServicesScoped, } from './DockerComposeService/DockerComposeService.ts';
|
|
8
|
-
export * as FileLogger from './FileLogger.ts';
|
|
5
|
+
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
9
6
|
export declare const OtelLiveHttp: ({ serviceName, rootSpanName, rootSpanAttributes, parentSpan, skipLogUrl, traceNodeBootstrap, }?: {
|
|
10
7
|
serviceName?: string;
|
|
11
8
|
rootSpanName?: string;
|
|
@@ -16,4 +13,15 @@ export declare const OtelLiveHttp: ({ serviceName, rootSpanName, rootSpanAttribu
|
|
|
16
13
|
}) => Layer.Layer<OtelTracer.OtelTracer | Tracer.ParentSpan, never, never>;
|
|
17
14
|
export declare const logTraceUiUrlForSpan: (printMsg?: (url: string) => string) => (span: otel.Span) => Effect.Effect<string | undefined, never, never>;
|
|
18
15
|
export declare const getTracingBackendUrl: (span: otel.Span) => Effect.Effect<string | undefined, never, never>;
|
|
16
|
+
export declare const cmd: (commandInput: string | (string | undefined)[], options?: {
|
|
17
|
+
cwd?: string;
|
|
18
|
+
shell?: boolean;
|
|
19
|
+
env?: Record<string, string | undefined>;
|
|
20
|
+
} | undefined) => Effect.Effect<CommandExecutor.ExitCode, PlatformError.PlatformError, CommandExecutor.CommandExecutor>;
|
|
21
|
+
export declare const cmdText: (commandInput: string | (string | undefined)[], options?: {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
stderr?: 'inherit' | 'pipe';
|
|
24
|
+
runInShell?: boolean;
|
|
25
|
+
env?: Record<string, string | undefined>;
|
|
26
|
+
}) => Effect.Effect<string, PlatformError.PlatformError, CommandExecutor.CommandExecutor>;
|
|
19
27
|
//# sourceMappingURL=mod.d.ts.map
|
package/dist/node/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACrF,OAAO,EAAmB,MAAM,EAAY,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAE9F,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAM1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAE9E,eAAO,MAAM,YAAY,GAAI,iGAO1B;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,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SAAS,CAAC,CAAA;CACzC,KACE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,aAAa,EAAE,eAAe,CAAC,eAAe,CAwBtF,CAAA"}
|
package/dist/node/mod.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks';
|
|
2
2
|
import * as OtelNodeSdk from '@effect/opentelemetry/NodeSdk';
|
|
3
|
-
import { IS_BUN,
|
|
4
|
-
import { Config, Effect,
|
|
3
|
+
import { IS_BUN, isNotUndefined, shouldNeverHappen } from '@livestore/utils';
|
|
4
|
+
import { Command, Config, Effect, identity, Layer, OtelTracer } from '@livestore/utils/effect';
|
|
5
5
|
import { OtelLiveDummy } from '@livestore/utils/node';
|
|
6
6
|
import * as otel from '@opentelemetry/api';
|
|
7
7
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
8
8
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
9
9
|
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
10
10
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
11
|
-
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
12
11
|
export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
13
|
-
export
|
|
14
|
-
export { DockerComposeError, DockerComposeService, startDockerComposeServicesScoped, } from "./DockerComposeService/DockerComposeService.js";
|
|
15
|
-
export * as FileLogger from "./FileLogger.js";
|
|
12
|
+
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
16
13
|
export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, parentSpan, skipLogUrl, traceNodeBootstrap, } = {}) => Effect.gen(function* () {
|
|
17
14
|
const configRes = yield* Config.all({
|
|
18
|
-
exporterUrl: Config.string('OTEL_EXPORTER_OTLP_ENDPOINT')
|
|
15
|
+
exporterUrl: Config.string('OTEL_EXPORTER_OTLP_ENDPOINT'),
|
|
19
16
|
serviceName: serviceName
|
|
20
17
|
? Config.succeed(serviceName)
|
|
21
18
|
: Config.string('OTEL_SERVICE_NAME').pipe(Config.withDefault('livestore-utils-dev')),
|
|
@@ -25,7 +22,7 @@ export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, pa
|
|
|
25
22
|
}).pipe(Effect.option);
|
|
26
23
|
if (configRes._tag === 'None') {
|
|
27
24
|
const RootSpanLive = Layer.span('DummyRoot', {});
|
|
28
|
-
return RootSpanLive.pipe(Layer.
|
|
25
|
+
return RootSpanLive.pipe(Layer.provide(OtelLiveDummy));
|
|
29
26
|
}
|
|
30
27
|
const config = configRes.value;
|
|
31
28
|
const resource = { serviceName: config.serviceName };
|
|
@@ -37,18 +34,7 @@ export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, pa
|
|
|
37
34
|
resource,
|
|
38
35
|
metricReader,
|
|
39
36
|
spanProcessor: new BatchSpanProcessor(new OTLPTraceExporter({ url: `${config.exporterUrl}/v1/traces`, headers: {} }), { scheduledDelayMillis: 50 }),
|
|
40
|
-
}))
|
|
41
|
-
// If an OpenTelemetry backend is not available, the `OtelNodeSdk` layer
|
|
42
|
-
// will ignore the error when attempting to connect and emit a debug log
|
|
43
|
-
// stating the reason for the error (in this case `ECONNREFUSED`). This
|
|
44
|
-
// can cause problems for programs which rely on clean `stdout` (e.g.
|
|
45
|
-
// command-line applications). To remedy this, the below code sets the
|
|
46
|
-
// minimum log level `FiberRef` to `"None"` for the duration of the
|
|
47
|
-
// `OtelNodeSdk`'s layer constructor.
|
|
48
|
-
//
|
|
49
|
-
// This can likely be removed when Livestore is migrated to the Effect
|
|
50
|
-
// native Otlp exporters.
|
|
51
|
-
Layer.locally(FiberRef.currentMinimumLogLevel, LogLevel.None));
|
|
37
|
+
}));
|
|
52
38
|
const RootSpanLive = Layer.span(config.rootSpanName, {
|
|
53
39
|
attributes: { config, ...rootSpanAttributes },
|
|
54
40
|
onEnd: skipLogUrl ? undefined : (span) => logTraceUiUrlForSpan()(span.span),
|
|
@@ -62,7 +48,9 @@ export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, pa
|
|
|
62
48
|
yield* Effect.gen(function* () {
|
|
63
49
|
const tracer = yield* OtelTracer.OtelTracer;
|
|
64
50
|
const currentSpan = yield* OtelTracer.currentOtelSpan;
|
|
65
|
-
const
|
|
51
|
+
const nodeTiming = performance.nodeTiming;
|
|
52
|
+
// TODO get rid of this workaround for Bun once Bun properly supports performance.nodeTiming
|
|
53
|
+
const startTime = IS_BUN ? nodeTiming.startTime : performance.timeOrigin + nodeTiming.nodeStart;
|
|
66
54
|
const bootSpan = tracer.startSpan('node-bootstrap', {
|
|
67
55
|
startTime: nodeTiming.nodeStart,
|
|
68
56
|
attributes: {
|
|
@@ -70,10 +58,10 @@ export const OtelLiveHttp = ({ serviceName, rootSpanName, rootSpanAttributes, pa
|
|
|
70
58
|
'node.timing.environment': nodeTiming.environment,
|
|
71
59
|
'node.timing.bootstrapComplete': nodeTiming.bootstrapComplete,
|
|
72
60
|
'node.timing.loopStart': nodeTiming.loopStart,
|
|
73
|
-
'node.timing.duration':
|
|
61
|
+
'node.timing.duration': nodeTiming.duration,
|
|
74
62
|
},
|
|
75
63
|
}, otel.trace.setSpanContext(otel.context.active(), currentSpan.spanContext()));
|
|
76
|
-
bootSpan.end(
|
|
64
|
+
bootSpan.end(startTime + nodeTiming.duration);
|
|
77
65
|
}).pipe(Effect.provide(layer), Effect.orDie);
|
|
78
66
|
}
|
|
79
67
|
return layer;
|
|
@@ -109,48 +97,35 @@ export const getTracingBackendUrl = (span) => Effect.gen(function* () {
|
|
|
109
97
|
// TODO make dynamic via env var
|
|
110
98
|
return `${grafanaEndpoint}/explore?${searchParams.toString()}`;
|
|
111
99
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return bootstrapComplete;
|
|
144
|
-
return startAbs + 1;
|
|
145
|
-
})()
|
|
146
|
-
: startAbs + nodeTiming.duration;
|
|
147
|
-
// Duration attribute value for the span.
|
|
148
|
-
const durationAttr = IS_BUN
|
|
149
|
-
? (() => {
|
|
150
|
-
const { loopStart } = nodeTiming;
|
|
151
|
-
return typeof loopStart === 'number' && loopStart > 0 ? loopStart : 0;
|
|
152
|
-
})()
|
|
153
|
-
: nodeTiming.duration;
|
|
154
|
-
return { nodeTiming, startAbs, endAbs, durationAttr };
|
|
155
|
-
};
|
|
100
|
+
export const cmd = Effect.fn('cmd')(function* (commandInput, options) {
|
|
101
|
+
const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
|
|
102
|
+
const [command, ...args] = Array.isArray(commandInput) ? commandInput.filter(isNotUndefined) : commandInput.split(' ');
|
|
103
|
+
const debugEnvStr = Object.entries(options?.env ?? {})
|
|
104
|
+
.map(([key, value]) => `${key}=${value} `)
|
|
105
|
+
.join('');
|
|
106
|
+
const commandDebugStr = debugEnvStr + [command, ...args].join(' ');
|
|
107
|
+
yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'`);
|
|
108
|
+
yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, cwd, command, args });
|
|
109
|
+
return yield* Command.make(command, ...args).pipe(
|
|
110
|
+
// TODO don't forward abort signal to the command
|
|
111
|
+
Command.stdin('inherit'), // Forward stdin to the command
|
|
112
|
+
Command.stdout('inherit'), // Stream stdout to process.stdout
|
|
113
|
+
Command.stderr('inherit'), // Stream stderr to process.stderr
|
|
114
|
+
Command.workingDirectory(cwd), options?.shell ? Command.runInShell(true) : identity, Command.env(options?.env ?? {}), Command.exitCode, Effect.tap((exitCode) => (exitCode === 0 ? Effect.void : Effect.die(`${commandDebugStr} failed`))));
|
|
115
|
+
});
|
|
116
|
+
export const cmdText = Effect.fn('cmdText')(function* (commandInput, options) {
|
|
117
|
+
const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set');
|
|
118
|
+
const [command, ...args] = Array.isArray(commandInput)
|
|
119
|
+
? commandInput.filter(isNotUndefined)
|
|
120
|
+
: commandInput.split(' ');
|
|
121
|
+
const debugEnvStr = Object.entries(options?.env ?? {})
|
|
122
|
+
.map(([key, value]) => `${key}=${value} `)
|
|
123
|
+
.join('');
|
|
124
|
+
const commandDebugStr = debugEnvStr + [command, ...args].join(' ');
|
|
125
|
+
yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'`);
|
|
126
|
+
yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, command, cwd });
|
|
127
|
+
return yield* Command.make(command, ...args).pipe(
|
|
128
|
+
// inherit = Stream stderr to process.stderr, pipe = Stream stderr to process.stdout
|
|
129
|
+
Command.stderr(options?.stderr ?? 'inherit'), Command.workingDirectory(cwd), options?.runInShell ? Command.runInShell(true) : identity, Command.env(options?.env ?? {}), Command.string);
|
|
130
|
+
});
|
|
156
131
|
//# sourceMappingURL=mod.js.map
|
package/dist/node/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/node/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,MAAM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AC,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC,EAC/B,OAAO,CAAC,MAAM,CACf,CAAA;AACH,CAAC,CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/node-vitest/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/node-vitest/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA"}
|
package/dist/node-vitest/mod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/node-vitest/mod.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/node-vitest/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/node-vitest/polyfill.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/node-vitest/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/utils-dev",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-9d8807d2c51c95b4df3556744702cea55dc7ded3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
|
-
"./
|
|
7
|
-
"./dist/node-vitest/global.js"
|
|
6
|
+
"./dist/node-vitest/polyfill.js"
|
|
8
7
|
],
|
|
9
8
|
"exports": {
|
|
10
|
-
"./node":
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
"./node": {
|
|
10
|
+
"types": "./dist/node/mod.d.ts",
|
|
11
|
+
"default": "./dist/node/mod.js"
|
|
12
|
+
},
|
|
13
|
+
"./node-vitest": {
|
|
14
|
+
"types": "./dist/node-vitest/mod.d.ts",
|
|
15
|
+
"default": "./dist/node-vitest/mod.js"
|
|
16
|
+
},
|
|
17
|
+
"./node-vitest-polyfill": {
|
|
18
|
+
"types": "./dist/node-vitest/polyfill.d.ts",
|
|
19
|
+
"default": "./dist/node-vitest/polyfill.js"
|
|
20
|
+
}
|
|
13
21
|
},
|
|
14
22
|
"dependencies": {
|
|
15
|
-
"@effect/opentelemetry": "0.
|
|
16
|
-
"@effect/vitest": "0.
|
|
17
|
-
"@iarna/toml": "2.2.5",
|
|
23
|
+
"@effect/opentelemetry": "0.48.4",
|
|
24
|
+
"@effect/vitest": "0.22.2",
|
|
18
25
|
"@opentelemetry/api": "1.9.0",
|
|
19
|
-
"@opentelemetry/exporter-metrics-otlp-http": "0.
|
|
20
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
21
|
-
"@opentelemetry/sdk-metrics": "2.0.
|
|
22
|
-
"@opentelemetry/sdk-trace-base": "2.0.
|
|
23
|
-
"@opentelemetry/sdk-trace-node": "2.0.
|
|
24
|
-
"
|
|
25
|
-
"@livestore/utils": "0.0.0-snapshot-e5a7caabcf7660aefa55568a44ed0fe306d00597"
|
|
26
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.200.0",
|
|
27
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.200.0",
|
|
28
|
+
"@opentelemetry/sdk-metrics": "2.0.0",
|
|
29
|
+
"@opentelemetry/sdk-trace-base": "2.0.0",
|
|
30
|
+
"@opentelemetry/sdk-trace-node": "2.0.0",
|
|
31
|
+
"@livestore/utils": "0.0.0-snapshot-9d8807d2c51c95b4df3556744702cea55dc7ded3"
|
|
26
32
|
},
|
|
27
33
|
"devDependencies": {},
|
|
28
34
|
"files": [
|
package/src/node/mod.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { performance } from 'node:perf_hooks'
|
|
2
2
|
|
|
3
3
|
import * as OtelNodeSdk from '@effect/opentelemetry/NodeSdk'
|
|
4
|
-
import { IS_BUN,
|
|
5
|
-
import type { Tracer } from '@livestore/utils/effect'
|
|
6
|
-
import { Config, Effect,
|
|
4
|
+
import { IS_BUN, isNotUndefined, shouldNeverHappen } from '@livestore/utils'
|
|
5
|
+
import type { CommandExecutor, PlatformError, Tracer } from '@livestore/utils/effect'
|
|
6
|
+
import { Command, Config, Effect, identity, Layer, OtelTracer } from '@livestore/utils/effect'
|
|
7
7
|
import { OtelLiveDummy } from '@livestore/utils/node'
|
|
8
8
|
import * as otel from '@opentelemetry/api'
|
|
9
9
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
@@ -11,19 +11,8 @@ import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
|
|
|
11
11
|
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'
|
|
12
12
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'
|
|
13
13
|
|
|
14
|
-
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
15
14
|
export { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
18
|
-
type DockerComposeArgs,
|
|
19
|
-
DockerComposeError,
|
|
20
|
-
type DockerComposeOperations,
|
|
21
|
-
DockerComposeService,
|
|
22
|
-
type LogsOptions,
|
|
23
|
-
type StartOptions,
|
|
24
|
-
startDockerComposeServicesScoped,
|
|
25
|
-
} from './DockerComposeService/DockerComposeService.ts'
|
|
26
|
-
export * as FileLogger from './FileLogger.ts'
|
|
15
|
+
export { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http'
|
|
27
16
|
|
|
28
17
|
export const OtelLiveHttp = ({
|
|
29
18
|
serviceName,
|
|
@@ -42,9 +31,7 @@ export const OtelLiveHttp = ({
|
|
|
42
31
|
} = {}): Layer.Layer<OtelTracer.OtelTracer | Tracer.ParentSpan, never, never> =>
|
|
43
32
|
Effect.gen(function* () {
|
|
44
33
|
const configRes = yield* Config.all({
|
|
45
|
-
exporterUrl: Config.string('OTEL_EXPORTER_OTLP_ENDPOINT')
|
|
46
|
-
Config.validate({ message: 'OTEL_EXPORTER_OTLP_ENDPOINT must be set', validation: isNonEmptyString }),
|
|
47
|
-
),
|
|
34
|
+
exporterUrl: Config.string('OTEL_EXPORTER_OTLP_ENDPOINT'),
|
|
48
35
|
serviceName: serviceName
|
|
49
36
|
? Config.succeed(serviceName)
|
|
50
37
|
: Config.string('OTEL_SERVICE_NAME').pipe(Config.withDefault('livestore-utils-dev')),
|
|
@@ -55,7 +42,7 @@ export const OtelLiveHttp = ({
|
|
|
55
42
|
|
|
56
43
|
if (configRes._tag === 'None') {
|
|
57
44
|
const RootSpanLive = Layer.span('DummyRoot', {})
|
|
58
|
-
return RootSpanLive.pipe(Layer.
|
|
45
|
+
return RootSpanLive.pipe(Layer.provide(OtelLiveDummy))
|
|
59
46
|
}
|
|
60
47
|
|
|
61
48
|
const config = configRes.value
|
|
@@ -74,19 +61,7 @@ export const OtelLiveHttp = ({
|
|
|
74
61
|
new OTLPTraceExporter({ url: `${config.exporterUrl}/v1/traces`, headers: {} }),
|
|
75
62
|
{ scheduledDelayMillis: 50 },
|
|
76
63
|
),
|
|
77
|
-
}))
|
|
78
|
-
// If an OpenTelemetry backend is not available, the `OtelNodeSdk` layer
|
|
79
|
-
// will ignore the error when attempting to connect and emit a debug log
|
|
80
|
-
// stating the reason for the error (in this case `ECONNREFUSED`). This
|
|
81
|
-
// can cause problems for programs which rely on clean `stdout` (e.g.
|
|
82
|
-
// command-line applications). To remedy this, the below code sets the
|
|
83
|
-
// minimum log level `FiberRef` to `"None"` for the duration of the
|
|
84
|
-
// `OtelNodeSdk`'s layer constructor.
|
|
85
|
-
//
|
|
86
|
-
// This can likely be removed when Livestore is migrated to the Effect
|
|
87
|
-
// native Otlp exporters.
|
|
88
|
-
Layer.locally(FiberRef.currentMinimumLogLevel, LogLevel.None),
|
|
89
|
-
)
|
|
64
|
+
}))
|
|
90
65
|
|
|
91
66
|
const RootSpanLive = Layer.span(config.rootSpanName, {
|
|
92
67
|
attributes: { config, ...rootSpanAttributes },
|
|
@@ -104,7 +79,10 @@ export const OtelLiveHttp = ({
|
|
|
104
79
|
const tracer = yield* OtelTracer.OtelTracer
|
|
105
80
|
const currentSpan = yield* OtelTracer.currentOtelSpan
|
|
106
81
|
|
|
107
|
-
const
|
|
82
|
+
const nodeTiming = performance.nodeTiming
|
|
83
|
+
|
|
84
|
+
// TODO get rid of this workaround for Bun once Bun properly supports performance.nodeTiming
|
|
85
|
+
const startTime = IS_BUN ? nodeTiming.startTime : performance.timeOrigin + nodeTiming.nodeStart
|
|
108
86
|
|
|
109
87
|
const bootSpan = tracer.startSpan(
|
|
110
88
|
'node-bootstrap',
|
|
@@ -115,13 +93,13 @@ export const OtelLiveHttp = ({
|
|
|
115
93
|
'node.timing.environment': nodeTiming.environment,
|
|
116
94
|
'node.timing.bootstrapComplete': nodeTiming.bootstrapComplete,
|
|
117
95
|
'node.timing.loopStart': nodeTiming.loopStart,
|
|
118
|
-
'node.timing.duration':
|
|
96
|
+
'node.timing.duration': nodeTiming.duration,
|
|
119
97
|
},
|
|
120
98
|
},
|
|
121
99
|
otel.trace.setSpanContext(otel.context.active(), currentSpan.spanContext()),
|
|
122
100
|
)
|
|
123
101
|
|
|
124
|
-
bootSpan.end(
|
|
102
|
+
bootSpan.end(startTime + nodeTiming.duration)
|
|
125
103
|
}).pipe(Effect.provide(layer), Effect.orDie)
|
|
126
104
|
}
|
|
127
105
|
|
|
@@ -166,49 +144,72 @@ export const getTracingBackendUrl = (span: otel.Span) =>
|
|
|
166
144
|
return `${grafanaEndpoint}/explore?${searchParams.toString()}`
|
|
167
145
|
})
|
|
168
146
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
147
|
+
export const cmd: (
|
|
148
|
+
commandInput: string | (string | undefined)[],
|
|
149
|
+
options?:
|
|
150
|
+
| {
|
|
151
|
+
cwd?: string
|
|
152
|
+
shell?: boolean
|
|
153
|
+
env?: Record<string, string | undefined>
|
|
154
|
+
}
|
|
155
|
+
| undefined,
|
|
156
|
+
) => Effect.Effect<CommandExecutor.ExitCode, PlatformError.PlatformError, CommandExecutor.CommandExecutor> = Effect.fn(
|
|
157
|
+
'cmd',
|
|
158
|
+
)(function* (commandInput, options) {
|
|
159
|
+
const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set')
|
|
160
|
+
const [command, ...args] = Array.isArray(commandInput) ? commandInput.filter(isNotUndefined) : commandInput.split(' ')
|
|
161
|
+
|
|
162
|
+
const debugEnvStr = Object.entries(options?.env ?? {})
|
|
163
|
+
.map(([key, value]) => `${key}=${value} `)
|
|
164
|
+
.join('')
|
|
165
|
+
const commandDebugStr = debugEnvStr + [command, ...args].join(' ')
|
|
166
|
+
|
|
167
|
+
yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'`)
|
|
168
|
+
yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, cwd, command, args })
|
|
169
|
+
|
|
170
|
+
return yield* Command.make(command!, ...args).pipe(
|
|
171
|
+
// TODO don't forward abort signal to the command
|
|
172
|
+
Command.stdin('inherit'), // Forward stdin to the command
|
|
173
|
+
Command.stdout('inherit'), // Stream stdout to process.stdout
|
|
174
|
+
Command.stderr('inherit'), // Stream stderr to process.stderr
|
|
175
|
+
Command.workingDirectory(cwd),
|
|
176
|
+
options?.shell ? Command.runInShell(true) : identity,
|
|
177
|
+
Command.env(options?.env ?? {}),
|
|
178
|
+
Command.exitCode,
|
|
179
|
+
Effect.tap((exitCode) => (exitCode === 0 ? Effect.void : Effect.die(`${commandDebugStr} failed`))),
|
|
180
|
+
)
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
export const cmdText: (
|
|
184
|
+
commandInput: string | (string | undefined)[],
|
|
185
|
+
options?: {
|
|
186
|
+
cwd?: string
|
|
187
|
+
stderr?: 'inherit' | 'pipe'
|
|
188
|
+
runInShell?: boolean
|
|
189
|
+
env?: Record<string, string | undefined>
|
|
190
|
+
},
|
|
191
|
+
) => Effect.Effect<string, PlatformError.PlatformError, CommandExecutor.CommandExecutor> = Effect.fn('cmdText')(
|
|
192
|
+
function* (commandInput, options) {
|
|
193
|
+
const cwd = options?.cwd ?? process.env.WORKSPACE_ROOT ?? shouldNeverHappen('WORKSPACE_ROOT is not set')
|
|
194
|
+
const [command, ...args] = Array.isArray(commandInput)
|
|
195
|
+
? commandInput.filter(isNotUndefined)
|
|
196
|
+
: commandInput.split(' ')
|
|
197
|
+
const debugEnvStr = Object.entries(options?.env ?? {})
|
|
198
|
+
.map(([key, value]) => `${key}=${value} `)
|
|
199
|
+
.join('')
|
|
200
|
+
|
|
201
|
+
const commandDebugStr = debugEnvStr + [command, ...args].join(' ')
|
|
202
|
+
|
|
203
|
+
yield* Effect.logDebug(`Running '${commandDebugStr}' in '${cwd}'`)
|
|
204
|
+
yield* Effect.annotateCurrentSpan({ 'span.label': commandDebugStr, command, cwd })
|
|
205
|
+
|
|
206
|
+
return yield* Command.make(command!, ...args).pipe(
|
|
207
|
+
// inherit = Stream stderr to process.stderr, pipe = Stream stderr to process.stdout
|
|
208
|
+
Command.stderr(options?.stderr ?? 'inherit'),
|
|
209
|
+
Command.workingDirectory(cwd),
|
|
210
|
+
options?.runInShell ? Command.runInShell(true) : identity,
|
|
211
|
+
Command.env(options?.env ?? {}),
|
|
212
|
+
Command.string,
|
|
213
|
+
)
|
|
214
|
+
},
|
|
215
|
+
)
|
package/src/node-vitest/mod.ts
CHANGED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type CommandExecutor, Duration, Effect, type PlatformError, Schema, type Scope, Stream } from '@livestore/utils/effect';
|
|
2
|
-
declare const DockerComposeError_base: Schema.TaggedErrorClass<DockerComposeError, "DockerComposeError", {
|
|
3
|
-
readonly _tag: Schema.tag<"DockerComposeError">;
|
|
4
|
-
} & {
|
|
5
|
-
cause: typeof Schema.Defect;
|
|
6
|
-
note: typeof Schema.String;
|
|
7
|
-
}>;
|
|
8
|
-
export declare class DockerComposeError extends DockerComposeError_base {
|
|
9
|
-
}
|
|
10
|
-
export interface DockerComposeArgs {
|
|
11
|
-
readonly cwd: string;
|
|
12
|
-
readonly serviceName?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface StartOptions {
|
|
15
|
-
readonly detached?: boolean;
|
|
16
|
-
readonly env?: Record<string, string>;
|
|
17
|
-
readonly healthCheck?: {
|
|
18
|
-
readonly url: string;
|
|
19
|
-
readonly timeout?: Duration.Duration;
|
|
20
|
-
readonly interval?: Duration.Duration;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface LogsOptions {
|
|
24
|
-
readonly follow?: boolean;
|
|
25
|
-
readonly tail?: number;
|
|
26
|
-
readonly since?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface DockerComposeOperations {
|
|
29
|
-
readonly pull: Effect.Effect<void, DockerComposeError | PlatformError.PlatformError>;
|
|
30
|
-
readonly start: (options?: StartOptions) => Effect.Effect<void, DockerComposeError | PlatformError.PlatformError, Scope.Scope>;
|
|
31
|
-
readonly stop: Effect.Effect<void, DockerComposeError | PlatformError.PlatformError>;
|
|
32
|
-
readonly down: (options?: {
|
|
33
|
-
readonly env?: Record<string, string>;
|
|
34
|
-
readonly volumes?: boolean;
|
|
35
|
-
readonly removeOrphans?: boolean;
|
|
36
|
-
}) => Effect.Effect<void, DockerComposeError | PlatformError.PlatformError>;
|
|
37
|
-
readonly logs: (options?: LogsOptions) => Stream.Stream<string, DockerComposeError | PlatformError.PlatformError, Scope.Scope>;
|
|
38
|
-
}
|
|
39
|
-
declare const DockerComposeService_base: Effect.Service.Class<DockerComposeService, "DockerComposeService", {
|
|
40
|
-
readonly scoped: (args: DockerComposeArgs) => Effect.Effect<{
|
|
41
|
-
pull: Effect.Effect<undefined, PlatformError.PlatformError | DockerComposeError, never>;
|
|
42
|
-
start: (options?: StartOptions) => Effect.Effect<void, PlatformError.PlatformError | DockerComposeError, Scope.Scope>;
|
|
43
|
-
stop: Effect.Effect<void, PlatformError.PlatformError | DockerComposeError, never>;
|
|
44
|
-
down: (options?: {
|
|
45
|
-
readonly env?: Record<string, string>;
|
|
46
|
-
readonly volumes?: boolean;
|
|
47
|
-
readonly removeOrphans?: boolean;
|
|
48
|
-
}) => Effect.Effect<void, PlatformError.PlatformError | DockerComposeError, never>;
|
|
49
|
-
logs: (options?: LogsOptions) => Stream.Stream<string, DockerComposeError, never>;
|
|
50
|
-
}, never, CommandExecutor.CommandExecutor>;
|
|
51
|
-
}>;
|
|
52
|
-
export declare class DockerComposeService extends DockerComposeService_base {
|
|
53
|
-
}
|
|
54
|
-
export declare const startDockerComposeServicesScoped: (args: DockerComposeArgs & {
|
|
55
|
-
healthCheck?: StartOptions["healthCheck"];
|
|
56
|
-
}) => Effect.Effect<void, DockerComposeError | PlatformError.PlatformError, DockerComposeService | CommandExecutor.CommandExecutor | Scope.Scope>;
|
|
57
|
-
export {};
|
|
58
|
-
//# sourceMappingURL=DockerComposeService.d.ts.map
|