@nagi-js/core 0.1.1-rc.22 → 0.1.1-rc.23
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/{chunk-PUAV56FC.js → chunk-DPTPJZEG.js} +16 -8
- package/dist/chunk-DPTPJZEG.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +28 -24
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +75 -1
- package/dist/testing.js.map +1 -1
- package/dist/{types-Ct5xHI4W.d.ts → types-CezUTCly.d.ts} +2 -5
- package/package.json +1 -1
- package/dist/chunk-PUAV56FC.js.map +0 -1
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as Millis,
|
|
1
|
+
import { P as Millis, aX as Store, b6 as Tx, ax as StandardSchemaV1 } from './types-CezUTCly.js';
|
|
2
2
|
|
|
3
3
|
declare function passthroughSchema<T>(): StandardSchemaV1<T, T>;
|
|
4
4
|
interface StoreContractHarness {
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Facts, isRunEnd, stepStateOf, InMemoryQueue, stepStatusOf, NagiConcurrencyConflictError } from './chunk-
|
|
1
|
+
import { Facts, isRunEnd, stepStateOf, InMemoryQueue, stepStatusOf, NagiConcurrencyConflictError } from './chunk-DPTPJZEG.js';
|
|
2
2
|
|
|
3
3
|
// src/testing.ts
|
|
4
4
|
function passthroughSchema() {
|
|
@@ -1341,6 +1341,80 @@ var storeContract = [
|
|
|
1341
1341
|
);
|
|
1342
1342
|
}
|
|
1343
1343
|
},
|
|
1344
|
+
{
|
|
1345
|
+
name: "a settle needs its attempt to have started: after a reset, a pre-reset attempt's completion, failure or cancel changes nothing in loadRunState or describe",
|
|
1346
|
+
async run(h) {
|
|
1347
|
+
const s = await h.makeStore({ leaseMs: LEASE_MS });
|
|
1348
|
+
const runId = rid();
|
|
1349
|
+
const t = (n) => new Date(17e11 + n * 1e3);
|
|
1350
|
+
const error = { name: "E", message: "stale" };
|
|
1351
|
+
const stale = (at) => [
|
|
1352
|
+
Facts.stepCompleted(runId, "s", A2, { stale: true }, at),
|
|
1353
|
+
Facts.stepFailed(runId, "s", A2, error, at),
|
|
1354
|
+
Facts.stepCanceled(runId, "s", A2, at, error)
|
|
1355
|
+
];
|
|
1356
|
+
await startRun(s, runId, { at: t(0) });
|
|
1357
|
+
await s.appendFact(
|
|
1358
|
+
runId,
|
|
1359
|
+
Facts.stepStarted(runId, "s", A1, "task", t(1))
|
|
1360
|
+
);
|
|
1361
|
+
await s.appendFact(
|
|
1362
|
+
runId,
|
|
1363
|
+
Facts.stepStarted(runId, "s", A2, "task", t(2))
|
|
1364
|
+
);
|
|
1365
|
+
await s.appendFact(
|
|
1366
|
+
runId,
|
|
1367
|
+
Facts.stepReset({ runId, stepId: "s", at: t(3) })
|
|
1368
|
+
);
|
|
1369
|
+
for (const fact of stale(t(4))) await s.appendFact(runId, fact);
|
|
1370
|
+
eq(
|
|
1371
|
+
stepStateOf(await s.loadRunState(runId), "s"),
|
|
1372
|
+
{ tag: "pending" },
|
|
1373
|
+
"loadRunState: a reset step ignores a settle before it restarts"
|
|
1374
|
+
);
|
|
1375
|
+
eq(
|
|
1376
|
+
await stepView(s, runId, "s"),
|
|
1377
|
+
void 0,
|
|
1378
|
+
"describe: a reset step ignores a settle before it restarts"
|
|
1379
|
+
);
|
|
1380
|
+
await s.appendFact(
|
|
1381
|
+
runId,
|
|
1382
|
+
Facts.stepStarted(runId, "s", A1, "task", t(5))
|
|
1383
|
+
);
|
|
1384
|
+
for (const fact of stale(t(6))) await s.appendFact(runId, fact);
|
|
1385
|
+
eq(
|
|
1386
|
+
stepStateOf(await s.loadRunState(runId), "s"),
|
|
1387
|
+
{ tag: "running", attempt: A1 },
|
|
1388
|
+
"loadRunState: a settle for an attempt that has not started is ignored"
|
|
1389
|
+
);
|
|
1390
|
+
eq(
|
|
1391
|
+
await stepView(s, runId, "s"),
|
|
1392
|
+
{ stepId: "s", attempt: A1, status: "running", startedAt: t(5) },
|
|
1393
|
+
"describe: a settle for an attempt that has not started is ignored"
|
|
1394
|
+
);
|
|
1395
|
+
await s.appendFact(
|
|
1396
|
+
runId,
|
|
1397
|
+
Facts.stepCompleted(runId, "s", A1, { fresh: true }, t(7))
|
|
1398
|
+
);
|
|
1399
|
+
eq(
|
|
1400
|
+
stepStateOf(await s.loadRunState(runId), "s"),
|
|
1401
|
+
{ tag: "completed", attempt: A1, output: { fresh: true } },
|
|
1402
|
+
"loadRunState: the restarted attempt settles"
|
|
1403
|
+
);
|
|
1404
|
+
eq(
|
|
1405
|
+
await stepView(s, runId, "s"),
|
|
1406
|
+
{
|
|
1407
|
+
stepId: "s",
|
|
1408
|
+
attempt: A1,
|
|
1409
|
+
status: "completed",
|
|
1410
|
+
startedAt: t(5),
|
|
1411
|
+
completedAt: t(7),
|
|
1412
|
+
output: { fresh: true }
|
|
1413
|
+
},
|
|
1414
|
+
"describe: the restarted attempt settles"
|
|
1415
|
+
);
|
|
1416
|
+
}
|
|
1417
|
+
},
|
|
1344
1418
|
{
|
|
1345
1419
|
name: "describe: a skipped step settles its view; a settled step changes only by reset",
|
|
1346
1420
|
async run(h) {
|