@autometa/runner 1.0.0-rc.1 → 1.0.0-rc.3

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.
@@ -34,6 +34,16 @@ export interface RunnerBindingsSurface<_World> {
34
34
  * Can be used for advanced scenarios like manual registration.
35
35
  */
36
36
  readonly container: IContainer;
37
+ /**
38
+ * Assertion facade mirroring `steps().ensure`.
39
+ * Provided for convenience so bindings users can import `ensure` alongside
40
+ * the decorators without needing separate access to the steps environment.
41
+ *
42
+ * Note: This is intentionally typed as `unknown` to avoid leaking the builder's
43
+ * Ensure facet generics into the bindings surface. Runtime will be identical
44
+ * to `stepsEnvironment.ensure`.
45
+ */
46
+ readonly ensure: unknown;
37
47
  }
38
48
  /**
39
49
  * Creates the bindings surface for TypeScript experimental decorators.
package/dist/index.cjs CHANGED
@@ -1141,7 +1141,9 @@ function createBindingsTS(stepsEnvironment) {
1141
1141
  Injectable,
1142
1142
  Inject,
1143
1143
  LazyInject,
1144
- container: globalContainer
1144
+ container: globalContainer,
1145
+ // Expose assertions facade from the steps environment for bindings usage
1146
+ ensure: stepsEnvironment.ensure
1145
1147
  };
1146
1148
  }
1147
1149
  function coordinateRunnerFeature(options) {
@@ -1269,7 +1271,7 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1269
1271
  });
1270
1272
  }
1271
1273
  this.state.worldFactory = merged;
1272
- delete this.state.ensureFactory;
1274
+ clearEnsureFactory(this.state);
1273
1275
  invalidateCaches(this.state);
1274
1276
  return new _RunnerBuilderImpl(this.state);
1275
1277
  }
@@ -1305,7 +1307,7 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1305
1307
  return currentApp;
1306
1308
  };
1307
1309
  this.state.appFactory = chained;
1308
- delete this.state.ensureFactory;
1310
+ clearEnsureFactory(this.state);
1309
1311
  invalidateCaches(this.state);
1310
1312
  return new _RunnerBuilderImpl(this.state);
1311
1313
  }
@@ -1339,25 +1341,26 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1339
1341
  } else {
1340
1342
  this.state.worldFactory = async (_context) => ({});
1341
1343
  }
1342
- delete this.state.ensureFactory;
1344
+ clearEnsureFactory(this.state);
1343
1345
  invalidateCaches(this.state);
1344
1346
  return new _RunnerBuilderImpl(this.state);
1345
1347
  }
1346
1348
  app(app) {
1347
1349
  this.state.appFactory = normalizeAppFactory(app);
1348
- delete this.state.ensureFactory;
1350
+ clearEnsureFactory(this.state);
1349
1351
  invalidateCaches(this.state);
1350
1352
  return new _RunnerBuilderImpl(this.state);
1351
1353
  }
1352
1354
  assertions(setup) {
1353
1355
  this.state.ensureFactory = setup(assertions.ensure);
1356
+ delete this.state.assertionPlugins;
1354
1357
  invalidateCaches(this.state);
1355
1358
  return new _RunnerBuilderImpl(
1356
1359
  this.state
1357
1360
  );
1358
1361
  }
1359
1362
  assertionPlugins(plugins) {
1360
- return this.assertions(
1363
+ const builder = this.assertions(
1361
1364
  (ensureInvoke) => {
1362
1365
  const factory = assertions.createEnsureFactory(
1363
1366
  ensureInvoke,
@@ -1366,6 +1369,8 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1366
1369
  return createImplicitEnsureProxy(factory);
1367
1370
  }
1368
1371
  );
1372
+ this.state.assertionPlugins = plugins;
1373
+ return builder;
1369
1374
  }
1370
1375
  parameterTypes(definitions) {
1371
1376
  const current = this.state.options.parameterTypes ?? [];
@@ -1421,6 +1426,9 @@ function cloneBuilderState(source) {
1421
1426
  if (source.ensureFactory) {
1422
1427
  next.ensureFactory = source.ensureFactory;
1423
1428
  }
1429
+ if (source.assertionPlugins) {
1430
+ next.assertionPlugins = source.assertionPlugins;
1431
+ }
1424
1432
  return next;
1425
1433
  }
1426
1434
  function collectCurrentOptions(state) {
@@ -1446,7 +1454,7 @@ function applyOptions(state, options) {
1446
1454
  } else {
1447
1455
  delete state.worldFactory;
1448
1456
  }
1449
- delete state.ensureFactory;
1457
+ clearEnsureFactory(state);
1450
1458
  }
1451
1459
  invalidateCaches(state);
1452
1460
  }
@@ -1537,6 +1545,9 @@ function invalidateCaches(state) {
1537
1545
  delete state.decoratorsCache;
1538
1546
  delete state.bindingsTSCache;
1539
1547
  }
1548
+ function clearEnsureFactory(state) {
1549
+ delete state.ensureFactory;
1550
+ }
1540
1551
  function ensureSteps(state) {
1541
1552
  let cache = state.stepsCache;
1542
1553
  if (!cache) {
@@ -1698,6 +1709,16 @@ function resolveEnsureFactory(state) {
1698
1709
  if (state.ensureFactory) {
1699
1710
  return state.ensureFactory;
1700
1711
  }
1712
+ if (state.assertionPlugins) {
1713
+ const plugins = state.assertionPlugins;
1714
+ const factory2 = assertions.createEnsureFactory(
1715
+ assertions.ensure,
1716
+ plugins
1717
+ );
1718
+ const proxy2 = createImplicitEnsureProxy(factory2);
1719
+ state.ensureFactory = proxy2;
1720
+ return proxy2;
1721
+ }
1701
1722
  const factory = assertions.createDefaultEnsureFactory();
1702
1723
  const proxy = createImplicitEnsureProxy(factory);
1703
1724
  state.ensureFactory = proxy;