@rkmodules/rules 0.0.172 → 0.0.173

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.cjs.js CHANGED
@@ -3580,10 +3580,11 @@ var Engine = /** @class */ (function () {
3580
3580
  };
3581
3581
  Engine.prototype.executeCall = function (fn_1, call_1, inputs_1, params_1, context_1, name_1, executionId_1, run_1, path_1) {
3582
3582
  return __awaiter(this, arguments, void 0, function (fn, call, inputs, params, context, name, executionId, run, path, root) {
3583
- var graphRunner, kind, hit, startTime, start, result, createdAt, impl, _a, endTime, event;
3583
+ var graphRunner, kind, hit, startTime, start, result, createdAt, started_1, activate, impl, endTime, event;
3584
+ var _this = this;
3584
3585
  if (root === void 0) { root = false; }
3585
- return __generator(this, function (_b) {
3586
- switch (_b.label) {
3586
+ return __generator(this, function (_a) {
3587
+ switch (_a.label) {
3587
3588
  case 0:
3588
3589
  this.cache.visit(run, path);
3589
3590
  graphRunner = this.graphRunners.get(fn);
@@ -3612,24 +3613,36 @@ var Engine = /** @class */ (function () {
3612
3613
  createdAt = hit.info.createdAt;
3613
3614
  return [3 /*break*/, 8];
3614
3615
  case 1:
3615
- context.activations[name] = true;
3616
+ context.activations[name] = false;
3617
+ started_1 = false;
3618
+ activate = function () {
3619
+ var _a;
3620
+ if (started_1)
3621
+ return;
3622
+ started_1 = true;
3623
+ (_a = run.onPrimitiveExecution) === null || _a === void 0 ? void 0 : _a.call(run);
3624
+ context.activations[name] = true;
3625
+ _this.fireEvent("functionCall", start);
3626
+ };
3616
3627
  impl = fn.impl;
3617
- console.log("Executing function call: ".concat(name));
3618
- _b.label = 2;
3628
+ _a.label = 2;
3619
3629
  case 2:
3620
- _b.trys.push([2, , 7, 8]);
3621
- this.fireEvent("functionCall", start);
3630
+ _a.trys.push([2, , 7, 8]);
3622
3631
  if (!graphRunner) return [3 /*break*/, 4];
3623
- return [4 /*yield*/, graphRunner(inputs, params, run, path)];
3632
+ return [4 /*yield*/, graphRunner(inputs, params, __assign(__assign({}, run), { onPrimitiveExecution: activate }), path)];
3624
3633
  case 3:
3625
- _a = (_b.sent()).result;
3634
+ // Traversal alone is not activity. Defer this graph's call
3635
+ // event until the first cache miss, including in nested graphs.
3636
+ result = (_a.sent()).result;
3626
3637
  return [3 /*break*/, 6];
3627
- case 4: return [4 /*yield*/, impl.call(fn, inputs, params, this, root ? null : context, name)];
3638
+ case 4:
3639
+ activate();
3640
+ console.log("Executing function call: ".concat(name));
3641
+ return [4 /*yield*/, impl.call(fn, inputs, params, this, root ? null : context, name)];
3628
3642
  case 5:
3629
- _a = _b.sent();
3630
- _b.label = 6;
3643
+ result = _a.sent();
3644
+ _a.label = 6;
3631
3645
  case 6:
3632
- result = _a;
3633
3646
  createdAt = Date.now();
3634
3647
  if (kind)
3635
3648
  this.cache.set(run, path, kind, fn, call, inputs, params, result, impl, createdAt);