@autometa/runner 1.0.0-rc.1 → 1.0.0-rc.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.
package/dist/index.js CHANGED
@@ -1138,7 +1138,9 @@ function createBindingsTS(stepsEnvironment) {
1138
1138
  Injectable,
1139
1139
  Inject,
1140
1140
  LazyInject,
1141
- container: globalContainer
1141
+ container: globalContainer,
1142
+ // Expose assertions facade from the steps environment for bindings usage
1143
+ ensure: stepsEnvironment.ensure
1142
1144
  };
1143
1145
  }
1144
1146
  function coordinateRunnerFeature(options) {
@@ -1266,7 +1268,7 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1266
1268
  });
1267
1269
  }
1268
1270
  this.state.worldFactory = merged;
1269
- delete this.state.ensureFactory;
1271
+ clearEnsureFactory(this.state);
1270
1272
  invalidateCaches(this.state);
1271
1273
  return new _RunnerBuilderImpl(this.state);
1272
1274
  }
@@ -1302,7 +1304,7 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1302
1304
  return currentApp;
1303
1305
  };
1304
1306
  this.state.appFactory = chained;
1305
- delete this.state.ensureFactory;
1307
+ clearEnsureFactory(this.state);
1306
1308
  invalidateCaches(this.state);
1307
1309
  return new _RunnerBuilderImpl(this.state);
1308
1310
  }
@@ -1336,25 +1338,26 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1336
1338
  } else {
1337
1339
  this.state.worldFactory = async (_context) => ({});
1338
1340
  }
1339
- delete this.state.ensureFactory;
1341
+ clearEnsureFactory(this.state);
1340
1342
  invalidateCaches(this.state);
1341
1343
  return new _RunnerBuilderImpl(this.state);
1342
1344
  }
1343
1345
  app(app) {
1344
1346
  this.state.appFactory = normalizeAppFactory(app);
1345
- delete this.state.ensureFactory;
1347
+ clearEnsureFactory(this.state);
1346
1348
  invalidateCaches(this.state);
1347
1349
  return new _RunnerBuilderImpl(this.state);
1348
1350
  }
1349
1351
  assertions(setup) {
1350
1352
  this.state.ensureFactory = setup(ensure);
1353
+ delete this.state.assertionPlugins;
1351
1354
  invalidateCaches(this.state);
1352
1355
  return new _RunnerBuilderImpl(
1353
1356
  this.state
1354
1357
  );
1355
1358
  }
1356
1359
  assertionPlugins(plugins) {
1357
- return this.assertions(
1360
+ const builder = this.assertions(
1358
1361
  (ensureInvoke) => {
1359
1362
  const factory = createEnsureFactory(
1360
1363
  ensureInvoke,
@@ -1363,6 +1366,8 @@ var RunnerBuilderImpl = class _RunnerBuilderImpl {
1363
1366
  return createImplicitEnsureProxy(factory);
1364
1367
  }
1365
1368
  );
1369
+ this.state.assertionPlugins = plugins;
1370
+ return builder;
1366
1371
  }
1367
1372
  parameterTypes(definitions) {
1368
1373
  const current = this.state.options.parameterTypes ?? [];
@@ -1418,6 +1423,9 @@ function cloneBuilderState(source) {
1418
1423
  if (source.ensureFactory) {
1419
1424
  next.ensureFactory = source.ensureFactory;
1420
1425
  }
1426
+ if (source.assertionPlugins) {
1427
+ next.assertionPlugins = source.assertionPlugins;
1428
+ }
1421
1429
  return next;
1422
1430
  }
1423
1431
  function collectCurrentOptions(state) {
@@ -1443,7 +1451,7 @@ function applyOptions(state, options) {
1443
1451
  } else {
1444
1452
  delete state.worldFactory;
1445
1453
  }
1446
- delete state.ensureFactory;
1454
+ clearEnsureFactory(state);
1447
1455
  }
1448
1456
  invalidateCaches(state);
1449
1457
  }
@@ -1534,6 +1542,9 @@ function invalidateCaches(state) {
1534
1542
  delete state.decoratorsCache;
1535
1543
  delete state.bindingsTSCache;
1536
1544
  }
1545
+ function clearEnsureFactory(state) {
1546
+ delete state.ensureFactory;
1547
+ }
1537
1548
  function ensureSteps(state) {
1538
1549
  let cache = state.stepsCache;
1539
1550
  if (!cache) {
@@ -1695,6 +1706,16 @@ function resolveEnsureFactory(state) {
1695
1706
  if (state.ensureFactory) {
1696
1707
  return state.ensureFactory;
1697
1708
  }
1709
+ if (state.assertionPlugins) {
1710
+ const plugins = state.assertionPlugins;
1711
+ const factory2 = createEnsureFactory(
1712
+ ensure,
1713
+ plugins
1714
+ );
1715
+ const proxy2 = createImplicitEnsureProxy(factory2);
1716
+ state.ensureFactory = proxy2;
1717
+ return proxy2;
1718
+ }
1698
1719
  const factory = createDefaultEnsureFactory();
1699
1720
  const proxy = createImplicitEnsureProxy(factory);
1700
1721
  state.ensureFactory = proxy;