@lotics/app-sdk 0.123.6 → 0.123.7

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -802,6 +802,7 @@ var MAX_STRING_LENGTH = 1e7;
802
802
  var MAX_RANDOM_LENGTH = 1e3;
803
803
  var MAX_RUN_BUILT_BYTES = 512 * 1024 * 1024;
804
804
  var MAX_IN_PLACE_BYTES = 1024 * 1024;
805
+ var MAX_IN_PLACE_HELPER_BYTES = 8 * 1024;
805
806
  var MAX_PERSISTED_JSON_LENGTH = 64 * 1024 * 1024;
806
807
  var ExpressionLimitError = class extends Error {
807
808
  constructor(message2) {
@@ -7385,7 +7386,7 @@ var WorkflowExpressionBudgetError = class extends Error {
7385
7386
  };
7386
7387
  var ExpressionNotCheapError = class extends Error {
7387
7388
  constructor() {
7388
- super(`The expression walks or builds more than ${MAX_IN_PLACE_BYTES / 1024 / 1024}MB at once, past what an evaluation in place may.`);
7389
+ super(`The expression walks or builds more than ${MAX_IN_PLACE_BYTES / 1024 / 1024}MB at once, or hands a helper more than ${MAX_IN_PLACE_HELPER_BYTES / 1024}KB, past what an evaluation in place may.`);
7389
7390
  this.name = "ExpressionNotCheapError";
7390
7391
  }
7391
7392
  };
@@ -7510,11 +7511,14 @@ function parsedSize(text2) {
7510
7511
  return text2.length * CHAR_BYTES + nodes * PARSED_NODE_BYTES;
7511
7512
  }
7512
7513
  function assertCheap(budget, ...values2) {
7514
+ assertWithin(budget, MAX_IN_PLACE_BYTES, values2);
7515
+ }
7516
+ function assertWithin(budget, limit, values2) {
7513
7517
  if (!budget.bounded) return;
7514
7518
  let bytes = 0;
7515
7519
  for (const value of values2) {
7516
- bytes += writtenSize(value, MAX_IN_PLACE_BYTES - bytes);
7517
- if (bytes > MAX_IN_PLACE_BYTES) throw new ExpressionNotCheapError();
7520
+ bytes += writtenSize(value, limit - bytes);
7521
+ if (bytes > limit) throw new ExpressionNotCheapError();
7518
7522
  }
7519
7523
  }
7520
7524
  function charge(ctx, bytes) {
@@ -8116,6 +8120,7 @@ async function callAfter(helper, pending, ctx) {
8116
8120
  return callHelper(helper, values2, ctx);
8117
8121
  }
8118
8122
  function callHelper({ call, cost }, values2, ctx) {
8123
+ assertWithin(ctx.evaluation_budget, MAX_IN_PLACE_HELPER_BYTES, values2);
8119
8124
  if (cost === "parses") charge(ctx, parsedSize(values2[0]));
8120
8125
  const answer = Reflect.apply(call, void 0, values2);
8121
8126
  return answer instanceof Promise ? chargeAnswerAfter(cost, answer, values2, ctx) : chargeAnswer(cost, answer, values2, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.123.6",
3
+ "version": "0.123.7",
4
4
  "description": "The SDK a Lotics custom-code app reads and writes through — typed hooks over the host bridge, cell readers, mount() and AppRouter",
5
5
  "type": "module",
6
6
  "exports": {