@lotics/app-sdk 0.128.6 → 0.128.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 +10 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -921,8 +921,12 @@ function ownText(value) {
921
921
  if (typeof value === "string") return value;
922
922
  if (value instanceof Date) return Date.prototype.toString.call(value);
923
923
  if (typeof value === "object" && value !== null) return Object.prototype.toString.call(value);
924
+ if (typeof value === "number") return numberText(value);
924
925
  return String(value);
925
926
  }
927
+ function numberText(value) {
928
+ return Number.isInteger(value) ? String(value) : String(Number(value.toPrecision(15)));
929
+ }
926
930
  function walkJoined(array, write2) {
927
931
  const joining = /* @__PURE__ */ new Set([array]);
928
932
  const stack = [{ array, at: 0 }];
@@ -2663,6 +2667,7 @@ function sortText(value) {
2663
2667
  if (typeof value === "string") return value;
2664
2668
  if (Array.isArray(value)) return textOf(value);
2665
2669
  if (typeof value === "object") return Object.prototype.toString.call(value);
2670
+ if (typeof value === "number") return numberText(value);
2666
2671
  return String(value);
2667
2672
  }
2668
2673
  function compareSortText(a, b) {
@@ -3113,7 +3118,7 @@ function join(arr, separator = ",") {
3113
3118
  if (typeof separator !== "string") {
3114
3119
  throw new ExpressionArgumentError("join: separator must be a string");
3115
3120
  }
3116
- const parts = arr.map(String);
3121
+ const parts = arr.map((element) => typeof element === "number" ? numberText(element) : String(element));
3117
3122
  const separatorsLength = Math.max(0, parts.length - 1) * separator.length;
3118
3123
  assertStringLength("join", parts.reduce((total, part) => total + part.length, separatorsLength));
3119
3124
  return parts.join(separator);
@@ -7276,7 +7281,8 @@ function figure2(name, args) {
7276
7281
  function parsedText(name, value) {
7277
7282
  if (value == null) return null;
7278
7283
  if (typeof value === "string") return value;
7279
- if (typeof value === "number" || typeof value === "boolean") return String(value);
7284
+ if (typeof value === "number") return numberText(value);
7285
+ if (typeof value === "boolean") return String(value);
7280
7286
  if (Array.isArray(value)) return textOf(value);
7281
7287
  throw new ExpressionArgumentError(`${name}: expected text or a number, got an object`);
7282
7288
  }
@@ -7313,7 +7319,7 @@ function objectFromEntries(...args) {
7313
7319
  for (const pair of pairs) {
7314
7320
  if (!Array.isArray(pair)) throw new ExpressionArgumentError("Object.fromEntries: every entry must be a [key, value] pair");
7315
7321
  const key = pair[0];
7316
- const text2 = typeof key === "string" ? key : Array.isArray(key) ? textOf(key) : String(key);
7322
+ const text2 = typeof key === "string" ? key : Array.isArray(key) ? textOf(key) : typeof key === "number" ? numberText(key) : String(key);
7317
7323
  if (isReservedObjectKey(text2)) throw new ExpressionArgumentError(`Object.fromEntries: a key cannot be "${text2}"`);
7318
7324
  defineOwn(result, text2, pair[1] ?? null);
7319
7325
  }
@@ -9696,7 +9702,7 @@ function resolveObjectKeyExpression(expr2, ctx) {
9696
9702
  }
9697
9703
  function objectKey(value) {
9698
9704
  if (typeof value === "string") return value;
9699
- if (typeof value === "number" && Number.isFinite(value)) return String(value);
9705
+ if (typeof value === "number" && Number.isFinite(value)) return numberText(value);
9700
9706
  throw new WorkflowEvalError(
9701
9707
  `Computed object key must evaluate to a string, got ${describeValue(value)}`,
9702
9708
  { kind: "read", at: "index" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/app-sdk",
3
- "version": "0.128.6",
3
+ "version": "0.128.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": {