@shivaedev/test-story 0.4.0 → 0.5.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +88 -0
  3. package/dist/server/internal/narration.d.ts +4 -1
  4. package/dist/server/internal/narration.d.ts.map +1 -1
  5. package/dist/server/internal/narration.js +11 -5
  6. package/dist/server/internal/narration.js.map +1 -1
  7. package/dist/server/internal/otlpProtobuf.d.ts +2 -0
  8. package/dist/server/internal/otlpProtobuf.d.ts.map +1 -0
  9. package/dist/server/internal/otlpProtobuf.js +107 -0
  10. package/dist/server/internal/otlpProtobuf.js.map +1 -0
  11. package/dist/server/internal/otlpReadout.d.ts +38 -0
  12. package/dist/server/internal/otlpReadout.d.ts.map +1 -0
  13. package/dist/server/internal/otlpReadout.js +45 -0
  14. package/dist/server/internal/otlpReadout.js.map +1 -0
  15. package/dist/server/internal/otlpValue.d.ts +22 -0
  16. package/dist/server/internal/otlpValue.d.ts.map +1 -0
  17. package/dist/server/internal/otlpValue.js +12 -0
  18. package/dist/server/internal/otlpValue.js.map +1 -0
  19. package/dist/server/internal/otlpWire.d.ts +7 -0
  20. package/dist/server/internal/otlpWire.d.ts.map +1 -0
  21. package/dist/server/internal/otlpWire.js +55 -0
  22. package/dist/server/internal/otlpWire.js.map +1 -0
  23. package/dist/server/internal/seed.d.ts +1 -0
  24. package/dist/server/internal/seed.d.ts.map +1 -1
  25. package/dist/server/internal/seed.js +2 -2
  26. package/dist/server/internal/seed.js.map +1 -1
  27. package/dist/server/internal/start.d.ts +2 -4
  28. package/dist/server/internal/start.d.ts.map +1 -1
  29. package/dist/server/internal/start.js +18 -16
  30. package/dist/server/internal/start.js.map +1 -1
  31. package/dist/server/internal/storyIt.d.ts.map +1 -1
  32. package/dist/server/internal/storyIt.js +10 -8
  33. package/dist/server/internal/storyIt.js.map +1 -1
  34. package/dist/server/otlpReceiver.d.ts +21 -0
  35. package/dist/server/otlpReceiver.d.ts.map +1 -0
  36. package/dist/server/otlpReceiver.js +50 -0
  37. package/dist/server/otlpReceiver.js.map +1 -0
  38. package/dist/server/storyKit.d.ts +1 -0
  39. package/dist/server/storyKit.d.ts.map +1 -1
  40. package/dist/server/storyKit.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/server/internal/narration.ts +11 -5
  43. package/src/server/internal/otlpProtobuf.ts +115 -0
  44. package/src/server/internal/otlpReadout.ts +59 -0
  45. package/src/server/internal/otlpValue.ts +24 -0
  46. package/src/server/internal/otlpWire.ts +57 -0
  47. package/src/server/internal/seed.ts +3 -2
  48. package/src/server/internal/start.ts +23 -16
  49. package/src/server/internal/storyIt.ts +10 -8
  50. package/src/server/otlpReceiver.ts +69 -0
  51. package/src/server/storyKit.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 - 2026-10-17
4
+
5
+ ### Added
6
+
7
+ - Export `otlpReceiver` from `otlpReceiver.ts`: a scoped local OTLP/HTTP JSON and protobuf receiver with decoded span readouts and raw export headers and body bytes. Export `OtlpSpan`, `OtlpExport` and `OtlpReceiverOptions` for story kit authors.
8
+ - Gate every story in a kit with the inferred definition's `runIf` boolean option. A false condition skips every `it` variant before setup, including `fails` and `only`, while preserving per-story skips and conditions.
9
+
10
+ ### Fixed
11
+
12
+ - Run every stage's `after` hook without the story's parent span, including its scoped teardown and finalizers, so hosts booted after deployment can start independent request traces while story verbs keep their story span.
13
+
14
+ ## 0.4.1 - 2026-10-17
15
+
16
+ ### Fixed
17
+
18
+ - Run engine creation without the story's parent span, so in-process HTTP handlers capture an independent context: requests without trace headers start root traces, and `traceparent` continues the supplied trace. Traits, steps and the story body retain their story span.
19
+
3
20
  ## 0.4.0 - 2026-10-17
4
21
 
5
22
  ### Added
package/README.md CHANGED
@@ -146,6 +146,80 @@ const app = storyKit({
146
146
 
147
147
  Routing uses the global dispatcher that Node's built-in `fetch` already uses. It is installed before `around`, creation, traits and the body, stays active during scoped cleanup, and restores the previous dispatcher after each story, including a failing story. Stories within one worker must run one at a time because that dispatcher is shared; parallelism belongs between workers or inside one story. The DOM environment uses the same routing for host-side Node fetch and document requests, including redirect destinations. It refuses external hosts even when the kit omits `outbound`.
148
148
 
149
+ #### Asserting on application traces
150
+
151
+ Start an in-process host in `create` or a stage's `after` hook, such as `after: { deployment }`. Creation and every `after` hook run without the ambient parent span, so an Effect HTTP handler that captures its context does not inherit a span placed around the story. Their scoped teardown and finalizers retain that detached context. The tracer, services and per-story Scope remain available. Traits, verbs, engine steps and assertions in the story body keep the span supplied by `around`.
152
+
153
+ This lets an application's story assert that a request starts its own trace: a request without trace headers starts a root trace, and a request with `traceparent` continues that trace. Host startup and cleanup do not join the story's trace.
154
+
155
+ A kit can collect spans with a native in-memory tracer, or start a fake OTLP receiver and point the application's exporter at it. Keep collection and any exporter flush or bounded wait in the kit's verbs. Assert only after the request span has ended. This small in-memory kit uses Effect's Web Request handler as its host:
156
+
157
+ ```ts
158
+ import { Effect, Tracer } from "effect";
159
+ import { HttpEffect, HttpServerResponse } from "effect/http";
160
+ import { expect } from "vitest";
161
+ import { storyKit } from "@shivaedev/test-story/storyKit.ts";
162
+
163
+ const spans: Tracer.NativeSpan[] = [];
164
+ const tracer = Tracer.make({
165
+ span: (options) => {
166
+ const span = new Tracer.NativeSpan(options);
167
+ spans.push(span);
168
+ return span;
169
+ },
170
+ });
171
+
172
+ const app = storyKit({
173
+ around: (effect) => effect.pipe(Effect.withSpan("story"), Effect.withTracer(tracer)),
174
+ *create() {
175
+ const context = yield* Effect.context<never>();
176
+ return HttpEffect.toWebHandlerWith(context)(Effect.succeed(HttpServerResponse.text("ok")));
177
+ },
178
+ name: "traced application",
179
+ stages: ["ready"],
180
+ verbs: (handler) => ({
181
+ request: (headers: HeadersInit = {}) => Effect.promise(async () => {
182
+ const response = await handler(new Request("http://app.test/", { headers }));
183
+ await response.text();
184
+ const span = spans.filter((span) => span.kind === "server").at(-1);
185
+ if (span === undefined) throw new Error("The request exported no server span");
186
+ return span;
187
+ }),
188
+ }),
189
+ });
190
+
191
+ app.it("a request is its own root trace", [], function* ({ request }) {
192
+ const storySpan = yield* Effect.currentSpan;
193
+ const span = yield* request();
194
+ expect(span.parent._tag).toBe("None");
195
+ expect(span.traceId).not.toBe(storySpan.traceId);
196
+ expect(span.status._tag).toBe("Ended");
197
+ });
198
+
199
+ app.it("a request continues its supplied trace", [], function* ({ request }) {
200
+ const span = yield* request({ traceparent: "00-1234567890abcdef1234567890abcdef-1234567890abcdef-01" });
201
+ expect(span.traceId).toBe("1234567890abcdef1234567890abcdef");
202
+ expect(span.parent).toMatchObject({ value: { spanId: "1234567890abcdef" } });
203
+ });
204
+ ```
205
+
206
+ The package's [tracing kit](https://github.com/ShivaeDev/platform/blob/main/packages/test-story/src/test-support/tracingApp.ts) and [stories](https://github.com/ShivaeDev/platform/blob/main/packages/test-story/src/server/hostTracing.spec.ts) also assert that two requests have different trace IDs, request work stays under its request span, and traits and engine steps stay under the story span. The [after-hook stories](https://github.com/ShivaeDev/platform/blob/main/packages/test-story/src/server/afterHostTracing.spec.ts) boot a loopback HTTP host after deployment and check its startup, requests and cleanup against the story trace, while its request verb remains a child of the story span. Detachment only removes the incoming parent: spans that application startup explicitly creates still follow native Effect semantics.
207
+
208
+ #### Reading OTLP exports
209
+
210
+ Use `otlpReceiver` from `@shivaedev/test-story/otlpReceiver.ts` in a kit's scoped `create` hook. It listens on an allocated loopback port and closes with the story scope. Point the application's real exporter at `${receiver.url}/v1/traces`, then flush the exporter before reading:
211
+
212
+ ```ts
213
+ import { otlpReceiver } from "@shivaedev/test-story/otlpReceiver.ts";
214
+
215
+ const receiver = yield* otlpReceiver();
216
+ yield* exportWork(`${receiver.url}/v1/traces`);
217
+ expect(receiver.spans).toContainEqual(expect.objectContaining({ name: "CountWords" }));
218
+ expect(receiver.requests.some(({ body }) => body.includes(Buffer.from("planted-secret")))).toBe(true);
219
+ ```
220
+
221
+ `exportWork` is the kit's verb that runs application work and flushes its exporter. The receiver accepts OTLP/HTTP JSON and protobuf. `spans` flattens all exports into decoded trace and span IDs, parent span IDs, names, numeric OTLP kinds and status codes, attributes, events and links. Attributes retain OTLP key/value objects, including lossless decimal strings for integers; each span also has `resourceAttributes`. `requests` retains every request's unmodified `body` Buffer, parsed `headers`, original `rawHeaders` pairs and `path`. Search all body bytes when checking that a secret was not exported. Optional `path`, `status` (a number or attempt callback) and `answer` configure collector responses for failure stories.
222
+
149
223
  ### 2. Once per feature: traits and verbs
150
224
 
151
225
  A trait is a line and a change, tagged with a stage:
@@ -258,6 +332,8 @@ The package wraps between words or JSON fields toward 120 columns and prints the
258
332
 
259
333
  Keep one kit in the application’s `test-support/`. `effect-test` owns Vitest registration, worker Layer acquisition, the per-test Scope, cancellation and clock selection. `test-story` owns engine creation, staged traits, verbs and narration. The application owns database lifecycle, migrations, isolation, seeds, actual server/client wiring and screen interactions.
260
334
 
335
+ Set `runIf: hasPostgres` in the kit definition to gate all its stories once, where `hasPostgres` is a boolean such as `process.env.PLATFORM_EFFECT_SQL_TEST_DATABASE_URL !== undefined`. When false, `it`, `it.fails`, `it.only`, `it.skip`, `it.runIf` and `it.skipIf` all register skipped stories without acquiring the worker Layer or running `around`, creation, traits or bodies. A skipped `it.only` does not focus the file. When true or omitted, each variant keeps its usual Vitest behavior, including explicit skips and `fails` inverting a failure. Per-story conditions can skip more stories; they cannot enable a disabled kit. The engine, traits, verbs and services remain inferred from the definition.
336
+
261
337
  The [order feature kit](https://github.com/ShivaeDev/platform/tree/main/packages/effect-react/src/test-support/order-example) runs the existing feature’s services, repository, contracts, JSON serialization and authentication middleware over a loopback HTTP listener. Its [stories](https://github.com/ShivaeDev/platform/blob/main/packages/effect-react/src/orderStory.dom.spec.tsx) test visible commits through a separate PostgreSQL pool, rollback of a rejected write without publication, cross-owner rejection, a native React action refreshing a list, and an editor retaining rejected input before a corrected save.
262
338
 
263
339
  ```ts
@@ -381,6 +457,18 @@ socialApp.it("a social sign-in returns with a cookie session", [], function* ({
381
457
 
382
458
  `domFetch` uses the current window and its cookie jar; it does not isolate multiple users. Run stories using that window serially, and let the application's cleanup end its sessions, restore the page location and close its host. Cookies follow hostnames, not listener ports, so a different loopback port alone does not isolate accounts.
383
459
 
460
+ ### API by module
461
+
462
+ Import each module with the prefix `@shivaedev/test-story/`; there is no root entry.
463
+
464
+ | Module | Exports |
465
+ | --- | --- |
466
+ | `storyKit.ts` | `storyKit`, `Trait`, `RunUntilOptions`, `Story`, `RunHooks`, `StoryKitDefinition`, `Told`, `StoryBody`, `StoryTest`, `StoryIt`, `StoryKit` |
467
+ | `domFetch.ts` | `domFetch(baseUrl)` |
468
+ | `domNavigate.ts` | `domNavigate(url?)` |
469
+ | `genreTags.ts` | `genreTags(...kitNames)`, `GenreTag` |
470
+ | `domEnvironment.config.ts` | Default Vitest environment preserving Node host globals and happy-dom document transport |
471
+
384
472
  ### Install and limits
385
473
 
386
474
  ```sh
@@ -17,7 +17,10 @@ export interface Subject<TEngine> {
17
17
  readonly inspect: ((engine: TEngine) => unknown) | undefined;
18
18
  readonly name: string;
19
19
  }
20
- export declare function narrate<TEngine>(subject: Subject<TEngine>, { onTestFailed }: Pick<TestContext, "onTestFailed">): Narration;
20
+ export declare function narrate<TEngine>(subject: Subject<TEngine>, { onTestFailed, task }: Pick<TestContext, "onTestFailed" | "task">): {
21
+ captureFailure: (stack: string | undefined) => void;
22
+ narration: Narration;
23
+ };
21
24
  export declare function tellGiven(narration: Narration, given: readonly {
22
25
  readonly line: string;
23
26
  readonly site: Error;
@@ -1 +1 @@
1
- {"version":3,"file":"narration.d.ts","sourceRoot":"","sources":["../../../src/server/internal/narration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAK1C,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,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AAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,KAAK,GAAG,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,OAAO,CAAC,OAAO;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,MAAM,CAAC;4BAwBpG,MAAM,GAAG,SAAS;;EAK3C;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,EAAE,GAAG,IAAI,CAKvH"}
@@ -1,7 +1,8 @@
1
1
  import { callSite } from "#internal/callSite.ts";
2
2
  import { failureReport } from "#internal/failureReport.ts";
3
3
  import { describeFailure } from "#internal/render.ts";
4
- export function narrate(subject, { onTestFailed }) {
4
+ export function narrate(subject, { onTestFailed, task }) {
5
+ let captured;
5
6
  const narration = {
6
7
  at: undefined,
7
8
  given: 0,
@@ -17,13 +18,18 @@ export function narrate(subject, { onTestFailed }) {
17
18
  narration.at = site;
18
19
  },
19
20
  };
20
- onTestFailed(({ task }) => {
21
- const failure = task.result?.errors?.[0];
21
+ onTestFailed(({ task: failedTask }) => {
22
+ const failure = failedTask.result?.errors?.[0];
22
23
  if (failure !== undefined) {
23
- failure.message = `${failure.message === "" ? describeFailure(failure) : failure.message}\n\n${failureReport(narration, subject, { file: task.file.filepath, name: task.name, stack: failure.stack })}`;
24
+ failure.message = `${failure.message === "" ? describeFailure(failure) : failure.message}\n\n${captured ?? failureReport(narration, subject, { file: task.file.filepath, name: task.name, stack: failure.stack })}`;
24
25
  }
25
26
  });
26
- return narration;
27
+ return {
28
+ captureFailure: (stack) => {
29
+ captured = failureReport(narration, subject, { file: task.file.filepath, name: task.name, stack });
30
+ },
31
+ narration,
32
+ };
27
33
  }
28
34
  export function tellGiven(narration, given) {
29
35
  for (const part of given) {
@@ -1 +1 @@
1
- {"version":3,"file":"narration.js","sourceRoot":"","sources":["../../../src/server/internal/narration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAuBtD,MAAM,UAAU,OAAO,CAAU,OAAyB,EAAE,EAAE,YAAY,EAAqC;IAC9G,MAAM,SAAS,GAAc;QAC5B,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,SAAS;QAClB,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;YACd,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAA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E,CAAC,KAAyB,EAAE,EAAE;YAC7C,QAAQ,GAAG,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACpG,CAAC;QACD,SAAS;KACT,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,SAAoB,EAAE,KAAiE;IAChH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function otlpProtobuf(bytes: Buffer): Record<string, unknown>;
2
+ //# sourceMappingURL=otlpProtobuf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpProtobuf.d.ts","sourceRoot":"","sources":["../../../src/server/internal/otlpProtobuf.ts"],"names":[],"mappings":"AAgHA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,2BAEzC"}
@@ -0,0 +1,107 @@
1
+ import { wireFields } from "#internal/otlpWire.ts";
2
+ const keyValue = { 1: ["key", "string"], 2: ["value", () => anyValue] };
3
+ const anyValue = {
4
+ 1: ["stringValue", "string"],
5
+ 2: ["boolValue", "boolean"],
6
+ 3: ["intValue", "integer"],
7
+ 4: ["doubleValue", "double"],
8
+ 5: ["arrayValue", () => ({ 1: ["values", () => anyValue, true] })],
9
+ 6: ["kvlistValue", () => ({ 1: ["values", () => keyValue, true] })],
10
+ 7: ["bytesValue", "base64"],
11
+ };
12
+ const event = { 1: ["timeUnixNano", "fixed64"], 2: ["name", "string"], 3: ["attributes", () => keyValue, true] };
13
+ const link = { 1: ["traceId", "hex"], 2: ["spanId", "hex"], 4: ["attributes", () => keyValue, true] };
14
+ const span = {
15
+ 1: ["traceId", "hex"],
16
+ 2: ["spanId", "hex"],
17
+ 4: ["parentSpanId", "hex"],
18
+ 5: ["name", "string"],
19
+ 6: ["kind", "number"],
20
+ 7: ["startTimeUnixNano", "fixed64"],
21
+ 8: ["endTimeUnixNano", "fixed64"],
22
+ 9: ["attributes", () => keyValue, true],
23
+ 11: ["events", () => event, true],
24
+ 13: ["links", () => link, true],
25
+ 15: ["status", () => ({ 2: ["message", "string"], 3: ["code", "number"] })],
26
+ };
27
+ const traces = {
28
+ 1: [
29
+ "resourceSpans",
30
+ () => ({
31
+ 1: ["resource", () => ({ 1: ["attributes", () => keyValue, true] })],
32
+ 2: ["scopeSpans", () => ({ 2: ["spans", () => span, true] }), true],
33
+ }),
34
+ true,
35
+ ],
36
+ };
37
+ function scalar(type, value) {
38
+ if (typeof value === "bigint") {
39
+ switch (type) {
40
+ case "number":
41
+ return Number(value);
42
+ case "integer":
43
+ return BigInt.asIntN(64, value).toString();
44
+ case "boolean":
45
+ return value !== 0n;
46
+ case "string":
47
+ case "hex":
48
+ case "base64":
49
+ case "double":
50
+ case "fixed64":
51
+ throw new Error(`Invalid OTLP protobuf ${type} field`);
52
+ }
53
+ }
54
+ switch (type) {
55
+ case "string":
56
+ return value.toString();
57
+ case "hex":
58
+ return value.toString("hex");
59
+ case "base64":
60
+ return value.toString("base64");
61
+ case "double":
62
+ return value.readDoubleLE();
63
+ case "fixed64":
64
+ return value.readBigUInt64LE().toString();
65
+ case "number":
66
+ case "integer":
67
+ case "boolean":
68
+ throw new Error(`Invalid OTLP protobuf ${type} field`);
69
+ }
70
+ }
71
+ function fieldValue(type, value) {
72
+ if (typeof type === "string") {
73
+ return scalar(type, value);
74
+ }
75
+ if (!Buffer.isBuffer(value)) {
76
+ throw new Error("Invalid OTLP protobuf message field");
77
+ }
78
+ return message(value, type());
79
+ }
80
+ function message(bytes, descriptor) {
81
+ const result = {};
82
+ for (const [name, , repeated] of Object.values(descriptor)) {
83
+ if (repeated) {
84
+ result[name] = [];
85
+ }
86
+ }
87
+ for (const field of wireFields(bytes)) {
88
+ const description = descriptor[field.number];
89
+ if (description === undefined) {
90
+ continue;
91
+ }
92
+ const [name, type, repeated] = description;
93
+ const value = fieldValue(type, field.value);
94
+ const previous = result[name];
95
+ if (repeated && Array.isArray(previous)) {
96
+ previous.push(value);
97
+ }
98
+ else {
99
+ result[name] = value;
100
+ }
101
+ }
102
+ return result;
103
+ }
104
+ export function otlpProtobuf(bytes) {
105
+ return message(bytes, traces);
106
+ }
107
+ //# sourceMappingURL=otlpProtobuf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpProtobuf.js","sourceRoot":"","sources":["../../../src/server/internal/otlpProtobuf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAOnE,MAAM,QAAQ,GAAe,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;AACpF,MAAM,QAAQ,GAAe;IAC5B,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC;IAC5B,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;IAC3B,CAAC,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC;IAC1B,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC;IAC5B,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE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,IAAI,EAAE,QAAQ,CAAC,GAAG,WAAW,CAAC;QAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACzC,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,38 @@
1
+ export declare function otlpReadout(bytes: Buffer, contentType: string): {
2
+ endTimeUnixNano?: string;
3
+ name: string;
4
+ parentSpanId?: string;
5
+ spanId: string;
6
+ startTimeUnixNano?: string;
7
+ traceId: string;
8
+ attributes: readonly {
9
+ readonly key: string;
10
+ readonly value: import("#internal/otlpValue.ts").OtlpValue;
11
+ }[];
12
+ events: {
13
+ name: string;
14
+ timeUnixNano?: string;
15
+ attributes: readonly {
16
+ readonly key: string;
17
+ readonly value: import("#internal/otlpValue.ts").OtlpValue;
18
+ }[];
19
+ }[];
20
+ kind: number;
21
+ links: {
22
+ spanId: string;
23
+ traceId: string;
24
+ attributes: readonly {
25
+ readonly key: string;
26
+ readonly value: import("#internal/otlpValue.ts").OtlpValue;
27
+ }[];
28
+ }[];
29
+ resourceAttributes: readonly {
30
+ readonly key: string;
31
+ readonly value: import("#internal/otlpValue.ts").OtlpValue;
32
+ }[];
33
+ status: {
34
+ message?: string;
35
+ code: number;
36
+ };
37
+ }[];
38
+ //# sourceMappingURL=otlpReadout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpReadout.d.ts","sourceRoot":"","sources":["../../../src/server/internal/otlpReadout.ts"],"names":[],"mappings":"AAyCA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiB7D"}
@@ -0,0 +1,45 @@
1
+ import { Schema } from "effect";
2
+ import { otlpProtobuf } from "#internal/otlpProtobuf.ts";
3
+ import { Attribute } from "#internal/otlpValue.ts";
4
+ const Attributes = Schema.optionalKey(Schema.Array(Attribute));
5
+ const Span = Schema.Struct({
6
+ attributes: Attributes,
7
+ endTimeUnixNano: Schema.optionalKey(Schema.String),
8
+ events: Schema.optionalKey(Schema.Array(Schema.Struct({ attributes: Attributes, name: Schema.String, timeUnixNano: Schema.optionalKey(Schema.String) }))),
9
+ kind: Schema.optionalKey(Schema.Number),
10
+ links: Schema.optionalKey(Schema.Array(Schema.Struct({ attributes: Attributes, spanId: Schema.String, traceId: Schema.String }))),
11
+ name: Schema.String,
12
+ parentSpanId: Schema.optionalKey(Schema.String),
13
+ spanId: Schema.String,
14
+ startTimeUnixNano: Schema.optionalKey(Schema.String),
15
+ status: Schema.optionalKey(Schema.Struct({ code: Schema.optionalKey(Schema.Number), message: Schema.optionalKey(Schema.String) })),
16
+ traceId: Schema.String,
17
+ });
18
+ const Payload = Schema.Struct({
19
+ resourceSpans: Schema.optionalKey(Schema.Array(Schema.Struct({
20
+ resource: Schema.optionalKey(Schema.Struct({ attributes: Attributes })),
21
+ scopeSpans: Schema.optionalKey(Schema.Array(Schema.Struct({ spans: Schema.optionalKey(Schema.Array(Span)) }))),
22
+ }))),
23
+ });
24
+ function normalizeIntegers(value) {
25
+ if (Array.isArray(value)) {
26
+ return value.map(normalizeIntegers);
27
+ }
28
+ if (typeof value !== "object" || value === null) {
29
+ return value;
30
+ }
31
+ return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, key === "intValue" ? String(item) : normalizeIntegers(item)]));
32
+ }
33
+ export function otlpReadout(bytes, contentType) {
34
+ const data = Schema.decodeUnknownSync(Payload)(normalizeIntegers(contentType === "application/x-protobuf" ? otlpProtobuf(bytes) : JSON.parse(bytes.toString())));
35
+ return (data.resourceSpans ?? []).flatMap((resource) => (resource.scopeSpans ?? []).flatMap((scope) => (scope.spans ?? []).map((span) => ({
36
+ ...span,
37
+ attributes: span.attributes ?? [],
38
+ events: (span.events ?? []).map((event) => ({ ...event, attributes: event.attributes ?? [] })),
39
+ kind: span.kind ?? 0,
40
+ links: (span.links ?? []).map((link) => ({ ...link, attributes: link.attributes ?? [] })),
41
+ resourceAttributes: resource.resource?.attributes ?? [],
42
+ status: { ...span.status, code: span.status?.code ?? 0 },
43
+ }))));
44
+ }
45
+ //# sourceMappingURL=otlpReadout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpReadout.js","sourceRoot":"","sources":["../../../src/server/internal/otlpReadout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU;IACtB,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAC7H;IACD,IAAI,E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C,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9F,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;QACpB,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;QACzF,kBAAkB,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE;QACvD,MAAM,EAAE,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,EAAE;KACxD,CAAC,CAAC,CACH,CACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Schema } from "effect";
2
+ export interface OtlpValue {
3
+ readonly arrayValue?: {
4
+ readonly values?: readonly OtlpValue[];
5
+ };
6
+ readonly boolValue?: boolean;
7
+ readonly bytesValue?: string;
8
+ readonly doubleValue?: number;
9
+ readonly intValue?: string;
10
+ readonly kvlistValue?: {
11
+ readonly values?: readonly {
12
+ readonly key: string;
13
+ readonly value: OtlpValue;
14
+ }[];
15
+ };
16
+ readonly stringValue?: string;
17
+ }
18
+ export declare const Attribute: Schema.Struct<{
19
+ readonly key: Schema.String;
20
+ readonly value: Schema.Codec<OtlpValue, OtlpValue, never, never>;
21
+ }>;
22
+ //# sourceMappingURL=otlpValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpValue.d.ts","sourceRoot":"","sources":["../../../src/server/internal/otlpValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;KAAE,CAAC;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS;YAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IAC5G,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAaD,eAAO,MAAM,SAAS;;;EAA0D,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Schema } from "effect";
2
+ const OtlpValue = Schema.suspend(() => Schema.Struct({
3
+ arrayValue: Schema.optionalKey(Schema.Struct({ values: Schema.optionalKey(Schema.Array(OtlpValue)) })),
4
+ boolValue: Schema.optionalKey(Schema.Boolean),
5
+ bytesValue: Schema.optionalKey(Schema.String),
6
+ doubleValue: Schema.optionalKey(Schema.Number),
7
+ intValue: Schema.optionalKey(Schema.String),
8
+ kvlistValue: Schema.optionalKey(Schema.Struct({ values: Schema.optionalKey(Schema.Array(Attribute)) })),
9
+ stringValue: Schema.optionalKey(Schema.String),
10
+ }));
11
+ export const Attribute = Schema.Struct({ key: Schema.String, value: OtlpValue });
12
+ //# sourceMappingURL=otlpValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpValue.js","sourceRoot":"","sources":["../../../src/server/internal/otlpValue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYhC,MAAM,SAAS,GAA4B,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAC9D,MAAM,CAAC,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IACtG,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7C,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IACvG,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;CAC9C,CAAC,CACF,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type WireValue = bigint | Buffer;
2
+ export declare function wireFields(bytes: Buffer): {
3
+ number: number;
4
+ value: WireValue;
5
+ wire: number;
6
+ }[];
7
+ //# sourceMappingURL=otlpWire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpWire.d.ts","sourceRoot":"","sources":["../../../src/server/internal/otlpWire.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AA4CxC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;YAEf,MAAM;WAAS,SAAS;UAAQ,MAAM;IAU9D"}
@@ -0,0 +1,55 @@
1
+ class WireReader {
2
+ offset = 0;
3
+ bytes;
4
+ constructor(bytes) {
5
+ this.bytes = bytes;
6
+ }
7
+ varint() {
8
+ let value = 0n;
9
+ for (let shift = 0n; shift < 70n && this.offset < this.bytes.length; shift += 7n) {
10
+ const byte = this.bytes.readUInt8(this.offset);
11
+ this.offset += 1;
12
+ value |= BigInt(byte & 127) << shift;
13
+ if (byte < 128) {
14
+ return value;
15
+ }
16
+ }
17
+ throw new Error("Invalid OTLP protobuf varint");
18
+ }
19
+ read(size) {
20
+ if (size < 0 || size > this.bytes.length - this.offset) {
21
+ throw new Error("Invalid OTLP protobuf field length or wire type");
22
+ }
23
+ const value = this.bytes.subarray(this.offset, this.offset + size);
24
+ this.offset += size;
25
+ return value;
26
+ }
27
+ field(wire) {
28
+ switch (wire) {
29
+ case 0:
30
+ return this.varint();
31
+ case 1:
32
+ return this.read(8);
33
+ case 2:
34
+ return this.read(Number(this.varint()));
35
+ case 5:
36
+ return this.read(4);
37
+ default:
38
+ throw new Error("Invalid OTLP protobuf wire type");
39
+ }
40
+ }
41
+ }
42
+ export function wireFields(bytes) {
43
+ const reader = new WireReader(bytes);
44
+ const fields = [];
45
+ while (reader.offset < bytes.length) {
46
+ const tag = Number(reader.varint());
47
+ if (tag < 8) {
48
+ throw new Error("Invalid OTLP protobuf field");
49
+ }
50
+ const wire = tag & 7;
51
+ fields.push({ number: tag >>> 3, value: reader.field(wire), wire });
52
+ }
53
+ return fields;
54
+ }
55
+ //# sourceMappingURL=otlpWire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otlpWire.js","sourceRoot":"","sources":["../../../src/server/internal/otlpWire.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU;IACf,MAAM,GAAG,CAAC,CAAC;IACF,KAAK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AAK,CAAC;gBACL,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACzC,KAAK,CAAC;gBACL,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACrB;gBACC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;CACD;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,MAAM,GAAyD,EAAE,CAAC;IACxE,OAAO,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACpC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -23,6 +23,7 @@ export interface LooseDefinition {
23
23
  readonly name: string;
24
24
  readonly outbound?: Readonly<Record<string, string>>;
25
25
  readonly run?: LooseRunHooks<unknown>;
26
+ readonly runIf?: boolean;
26
27
  readonly stages: readonly string[];
27
28
  readonly verbs: (engine: unknown, story: LooseStory) => object;
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../src/server/internal/seed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,C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AAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1G,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;CAC/D;AAED,eAAO,MAAM,IAAI,6IAuBf,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Cause, Effect } from "effect";
1
+ import { Cause, Context, Effect, Tracer } from "effect";
2
2
  import { refusal } from "#internal/errors.ts";
3
3
  import { hooked } from "#internal/hooked.ts";
4
4
  import { tellGiven } from "#internal/narration.ts";
@@ -20,7 +20,7 @@ export const seed = Effect.fnUntraced(function* (definition, engine, narration,
20
20
  }
21
21
  const after = definition.after?.[stage];
22
22
  if (after !== undefined) {
23
- yield* hooked(() => after(engine));
23
+ yield* hooked(() => after(engine)).pipe(Effect.updateContext(Context.omit(Tracer.ParentSpan)));
24
24
  }
25
25
  }
26
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"seed.js","sourceRo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AO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CACnD,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC3B,IAAI,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;wBACpC,OAAO,MAAM,CAAC,SAAS,CAAC;oBACzB,CAAC;oBACD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACnC,SAAS,CAAC,OAAO,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;oBAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;gBAChE,CAAC,CAAC,CACF,CAAC;YACH,CAAC;QACF,CAAC;QACD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAChG,CAAC;IACF,CAAC;AACF,CAAC,CAAC,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import { Effect } from "effect";
2
2
  import type { TestContext } from "vitest";
3
- import { type LooseDefinition, type LooseStory, type LooseTrait } from "#internal/seed.ts";
4
- export declare const start: (definition: LooseDefinition, given: readonly LooseTrait[], context: TestContext) => Effect.Effect<{
5
- story: LooseStory;
6
- }, unknown, unknown>;
3
+ import { type LooseDefinition, type LooseTrait } from "#internal/seed.ts";
4
+ export declare const start: (definition: LooseDefinition, given: readonly LooseTrait[], context: TestContext, body: (told: object) => Effect.Effect<unknown, unknown, unknown>) => Effect.Effect<unknown, unknown, unknown>;
7
5
  //# sourceMappingURL=start.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/server/internal/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAK1C,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAQ,MAAM,mBAAmB,CAAC;AAEjG,eAAO,MAAM,KAAK;;oBAehB,CAAC"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/server/internal/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAK1C,OAAO,EAAE,KAAK,eAAe,EAAmB,KAAK,UAAU,EAAQ,MAAM,mBAAmB,CAAC;AAEjG,eAAO,MAAM,KAAK,iGAIJ,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,6CAkB/D,CAAC"}