@pdfme/common 6.1.11 → 6.1.12-dev.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.
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Buffer } from "buffer";
3
3
  import { PDFName } from "@pdfme/pdf-lib";
4
4
  import * as acorn from "acorn";
5
5
  //#region src/version.ts
6
- var PDFME_VERSION = "6.1.11";
6
+ var PDFME_VERSION = "6.1.12";
7
7
  //#endregion
8
8
  //#region src/pageSize.ts
9
9
  var PAGE_SIZE_PRESETS = {
@@ -435,7 +435,7 @@ var isUrlSafeToFetch = (urlString) => {
435
435
  }
436
436
  return true;
437
437
  };
438
- var SAFE_LINK_URI_PROTOCOLS = new Set([
438
+ var SAFE_LINK_URI_PROTOCOLS = /* @__PURE__ */ new Set([
439
439
  "http:",
440
440
  "https:",
441
441
  "mailto:"
@@ -852,13 +852,14 @@ var evaluateAST = (node, context) => {
852
852
  const callNode = node;
853
853
  const callee = evaluateAST(callNode.callee, context);
854
854
  const args = callNode.arguments.map((argNode) => evaluateAST(argNode, context));
855
- if (typeof callee === "function") if (callNode.callee.type === "MemberExpression") {
856
- const memberExpr = callNode.callee;
857
- const obj = evaluateAST(memberExpr.object, context);
858
- if (obj !== null && (typeof obj === "object" || typeof obj === "number" || typeof obj === "string" || typeof obj === "boolean")) return callee.call(obj, ...args);
859
- else throw new Error("Invalid object in member function call");
860
- } else return callee(...args);
861
- else throw new Error("Attempted to call a non-function");
855
+ if (typeof callee === "function") {
856
+ if (callNode.callee.type === "MemberExpression") {
857
+ const memberExpr = callNode.callee;
858
+ const obj = evaluateAST(memberExpr.object, context);
859
+ if (obj !== null && (typeof obj === "object" || typeof obj === "number" || typeof obj === "string" || typeof obj === "boolean")) return callee.call(obj, ...args);
860
+ else throw new Error("Invalid object in member function call");
861
+ } else return callee(...args);
862
+ } else throw new Error("Attempted to call a non-function");
862
863
  }
863
864
  case "ArrowFunctionExpression": {
864
865
  const arrowFuncNode = node;
@@ -885,7 +886,8 @@ var evaluateAST = (node, context) => {
885
886
  if (typeof evaluatedKey !== "string" && typeof evaluatedKey !== "number") throw new Error("Object property keys must be strings or numbers");
886
887
  key = String(evaluatedKey);
887
888
  }
888
- objResult[key] = evaluateAST(propNode.value, context);
889
+ const value = evaluateAST(propNode.value, context);
890
+ objResult[key] = value;
889
891
  });
890
892
  return objResult;
891
893
  }
@@ -1131,7 +1133,8 @@ var getDynamicTemplate = async (arg) => {
1131
1133
  for (let i = 0; i < items.length; i += PARALLEL_LIMIT) {
1132
1134
  const chunk = items.slice(i, i + PARALLEL_LIMIT);
1133
1135
  const chunkResults = await Promise.all(chunk.map((item) => {
1134
- return getDynamicHeights(getSchemaValue(item.schema, input, template.schemas), {
1136
+ const value = getSchemaValue(item.schema, input, template.schemas);
1137
+ return getDynamicHeights(value, {
1135
1138
  schema: item.schema,
1136
1139
  basePdf,
1137
1140
  options,