@relayfx/test 0.2.0 → 0.2.2

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 (2) hide show
  1. package/dist/index.js +13 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -16309,13 +16309,15 @@ var runWorkflow = Effect77.fn("ExecutionWorkflow.run")(function* (input) {
16309
16309
  };
16310
16310
  }).pipe(Effect77.catch((error5) => failWorkspace(startInput, error5).pipe(Effect77.flatMap(() => notifyParent(startInput, "failed", [])), Effect77.flatMap(() => Effect77.fail(error5)))));
16311
16311
  });
16312
- var awaitCanonicalWaitingResult = Effect77.fn("ExecutionWorkflow.awaitCanonicalWaitingResult")(function* (input, repository) {
16313
- const execution = yield* repository.get(input.execution_id).pipe(Effect77.mapError(mapRepositoryError10), Effect77.tap((record2) => record2?.status === "waiting" ? Effect77.void : Effect77.yieldNow), Effect77.repeat({ until: (record2) => record2?.status === "waiting" }));
16312
+ var awaitCanonicalSettledResult = Effect77.fn("ExecutionWorkflow.awaitCanonicalSettledResult")(function* (input, repository) {
16313
+ const execution = yield* repository.get(input.execution_id).pipe(Effect77.mapError(mapRepositoryError10), Effect77.tap((record2) => record2?.status === "waiting" || record2 !== undefined && terminalExecutionStatuses.has(record2.status) ? Effect77.void : Effect77.yieldNow), Effect77.repeat({
16314
+ until: (record2) => record2?.status === "waiting" || record2 !== undefined && terminalExecutionStatuses.has(record2.status)
16315
+ }));
16314
16316
  const canonicalWaitId = execution?.metadata?.wait_id;
16315
16317
  const waitId = typeof canonicalWaitId === "string" ? exports_ids_schema.WaitId.make(canonicalWaitId) : input.wait_id;
16316
16318
  const result = {
16317
16319
  execution_id: input.execution_id,
16318
- status: "waiting",
16320
+ status: execution?.status ?? "waiting",
16319
16321
  ...waitId === undefined ? {} : { wait_id: waitId },
16320
16322
  ...execution?.metadata === undefined ? {} : { metadata: execution.metadata }
16321
16323
  };
@@ -16325,9 +16327,11 @@ var awaitStartResult = Effect77.fn("ExecutionWorkflow.awaitStartResult")(functio
16325
16327
  while (true) {
16326
16328
  const result = yield* StartExecutionWorkflow.poll(workflowExecutionId).pipe(Effect77.tap((pollResult) => Option24.isSome(pollResult) ? Effect77.void : Effect77.yieldNow), Effect77.repeat({ until: Option24.isSome }), Effect77.map(Option24.getOrThrow));
16327
16329
  if (result._tag === "Suspended") {
16328
- const waiting = yield* awaitCanonicalWaitingResult(input, repository);
16330
+ const waiting = yield* awaitCanonicalSettledResult(input, repository);
16331
+ if (waiting.status !== "waiting")
16332
+ return waiting;
16329
16333
  const wait = waiting.wait_id === undefined ? undefined : yield* get12(waiting.wait_id).pipe(Effect77.mapError(mapWaitError2));
16330
- if (wait?.mode !== "child")
16334
+ if (wait?.mode !== "child" && (wait === undefined || wait.state === "open"))
16331
16335
  return waiting;
16332
16336
  yield* Effect77.yieldNow;
16333
16337
  continue;
@@ -16343,8 +16347,10 @@ var startRequest = Effect77.fn("ExecutionWorkflow.startRequest")(function* (inpu
16343
16347
  if (input.wait_id === undefined) {
16344
16348
  const repository2 = yield* exports_execution_repository.Service;
16345
16349
  const existing = yield* repository2.get(input.execution_id).pipe(Effect77.mapError(mapRepositoryError10));
16346
- if (existing === undefined)
16347
- return yield* start(input);
16350
+ if (existing === undefined) {
16351
+ const workflowExecutionId3 = yield* start(input, { discard: true });
16352
+ return yield* awaitStartResult(input, workflowExecutionId3, repository2);
16353
+ }
16348
16354
  const workflowExecutionId2 = yield* activeWorkflowExecutionIdForExecution(input.execution_id);
16349
16355
  const existingWaitId = existing.metadata?.wait_id;
16350
16356
  const waitId = typeof existingWaitId === "string" ? exports_ids_schema.WaitId.make(existingWaitId) : undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@relayfx/test",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "description": "Experimental deterministic test kit for Relay applications",
6
6
  "type": "module",
7
7
  "exports": {
@@ -36,7 +36,7 @@
36
36
  "typecheck": "bun tsc --noEmit"
37
37
  },
38
38
  "dependencies": {
39
- "@relayfx/sdk": "0.2.0",
39
+ "@relayfx/sdk": "0.2.2",
40
40
  "effect": "4.0.0-beta.93"
41
41
  },
42
42
  "peerDependencies": {