@rkmodules/rules 0.0.172 → 0.0.174

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