norn-cli 1.10.5 → 1.10.6

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 (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cli.js +28 -38
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ All notable changes to the "Norn" extension will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.10.6] - 2026-03-28
8
+
9
+ ### Fixed
10
+ - **Structured Variable Storage**:
11
+ - Kept structured runtime values as real objects instead of JSON strings so the debugger, assertions, and path access all see the same types.
12
+ - Preserved compatibility for existing string-backed values when resolving paths.
13
+
14
+ ### Changed
15
+ - **Docs**:
16
+ - Updated the advanced website docs to note that structured values stay as objects in memory.
17
+
7
18
  ## [1.10.5] - 2026-03-28
8
19
 
9
20
  ### Improved
package/dist/cli.js CHANGED
@@ -110487,13 +110487,7 @@ function resolveReturnExpression(expr, runtimeVariables) {
110487
110487
  return { key: varName, value: varValue };
110488
110488
  }
110489
110489
  try {
110490
- let current = varValue;
110491
- if (typeof current === "string") {
110492
- try {
110493
- current = JSON.parse(current);
110494
- } catch {
110495
- }
110496
- }
110490
+ let current = parseJsonBackedValue(varValue);
110497
110491
  const normalizedPath = pathPart.replace(/^\.|^\[/, (m) => m === "." ? "" : "[").replace(/\[(\d+)\]/g, ".$1");
110498
110492
  const parts = normalizedPath.split(".").filter((p) => p !== "");
110499
110493
  for (const part of parts) {
@@ -110536,7 +110530,7 @@ function buildParsedNamedRequest(requestContent, runtimeVariables, apiDefinition
110536
110530
  const resolvedParams = {};
110537
110531
  for (const [paramName, paramValue] of Object.entries(apiRequest.params)) {
110538
110532
  if (runtimeVariables[paramValue] !== void 0) {
110539
- resolvedParams[paramName] = String(runtimeVariables[paramValue]);
110533
+ resolvedParams[paramName] = valueToString2(runtimeVariables[paramValue]);
110540
110534
  } else {
110541
110535
  resolvedParams[paramName] = substituteVariables(paramValue, runtimeVariables);
110542
110536
  }
@@ -110843,6 +110837,16 @@ function bindSequenceArguments(params, args, runtimeVariables) {
110843
110837
  }
110844
110838
  return { variables: result };
110845
110839
  }
110840
+ function parseJsonBackedValue(value) {
110841
+ if (typeof value !== "string") {
110842
+ return value;
110843
+ }
110844
+ try {
110845
+ return JSON.parse(value);
110846
+ } catch {
110847
+ return value;
110848
+ }
110849
+ }
110846
110850
  function getVariableValueByPath(path14, variables) {
110847
110851
  const parts = path14.split(".");
110848
110852
  let current = variables;
@@ -110851,9 +110855,8 @@ function getVariableValueByPath(path14, variables) {
110851
110855
  return "";
110852
110856
  }
110853
110857
  if (typeof current === "string") {
110854
- try {
110855
- current = JSON.parse(current);
110856
- } catch {
110858
+ current = parseJsonBackedValue(current);
110859
+ if (typeof current === "string") {
110857
110860
  return "";
110858
110861
  }
110859
110862
  }
@@ -110862,10 +110865,7 @@ function getVariableValueByPath(path14, variables) {
110862
110865
  if (current === null || current === void 0) {
110863
110866
  return "";
110864
110867
  }
110865
- if (typeof current === "object") {
110866
- return JSON.stringify(current);
110867
- }
110868
- return String(current);
110868
+ return current;
110869
110869
  }
110870
110870
  function parseTagFilter(filterStr) {
110871
110871
  const match = filterStr.match(/^([a-zA-Z_][a-zA-Z0-9_-]*)(?:\(([^)]+)\))?$/);
@@ -111197,16 +111197,8 @@ function evaluateValueExpression(expr, runtimeVariables) {
111197
111197
  }
111198
111198
  const varValue = runtimeVariables[varName];
111199
111199
  if (pathPart) {
111200
- let dataToNavigate;
111201
- if (typeof varValue === "object" && varValue !== null) {
111202
- dataToNavigate = varValue;
111203
- } else if (typeof varValue === "string") {
111204
- try {
111205
- dataToNavigate = JSON.parse(varValue);
111206
- } catch {
111207
- return { value: varValue, error: `Cannot parse '${varName}' as JSON for path access` };
111208
- }
111209
- } else {
111200
+ const dataToNavigate = parseJsonBackedValue(varValue);
111201
+ if (typeof dataToNavigate !== "object" || dataToNavigate === null) {
111210
111202
  return { value: String(varValue), error: `Cannot access path on non-object value` };
111211
111203
  }
111212
111204
  const path14 = pathPart.replace(/^\./, "").replace(/\[(\d+)\]/g, ".$1");
@@ -112098,7 +112090,7 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
112098
112090
  duration: Date.now() - startTime
112099
112091
  };
112100
112092
  }
112101
- runtimeVariables[parsed.varName] = JSON.stringify(result.data);
112093
+ runtimeVariables[parsed.varName] = result.data;
112102
112094
  reportProgress(stepIdx, "json", `json: ${parsed.varName} = ${parsed.filePath}`, stepResult);
112103
112095
  continue;
112104
112096
  }
@@ -112131,9 +112123,10 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
112131
112123
  };
112132
112124
  }
112133
112125
  let jsonObj;
112134
- try {
112135
- jsonObj = JSON.parse(runtimeVariables[parsed.varName]);
112136
- } catch {
112126
+ const existingValue = parseJsonBackedValue(runtimeVariables[parsed.varName]);
112127
+ if (typeof existingValue === "object" && existingValue !== null) {
112128
+ jsonObj = existingValue;
112129
+ } else {
112137
112130
  errors.push(`Step ${stepIdx + 1}: Variable '${parsed.varName}' is not a valid JSON object`);
112138
112131
  return {
112139
112132
  name: "",
@@ -112154,12 +112147,9 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
112154
112147
  const pathPart = bareVarMatch[2] || "";
112155
112148
  let value = runtimeVariables[varName];
112156
112149
  if (typeof value === "string") {
112157
- try {
112158
- const parsed2 = JSON.parse(value);
112159
- if (typeof parsed2 === "object" && parsed2 !== null) {
112160
- value = parsed2;
112161
- }
112162
- } catch {
112150
+ const parsedValue = parseJsonBackedValue(value);
112151
+ if (typeof parsedValue === "object" && parsedValue !== null) {
112152
+ value = parsedValue;
112163
112153
  }
112164
112154
  }
112165
112155
  if (pathPart) {
@@ -112191,7 +112181,7 @@ async function runSequenceWithJar(sequenceContent, fileVariables, cookieJar, wor
112191
112181
  duration: Date.now() - startTime
112192
112182
  };
112193
112183
  }
112194
- runtimeVariables[parsed.varName] = JSON.stringify(jsonObj);
112184
+ runtimeVariables[parsed.varName] = jsonObj;
112195
112185
  reportProgress(stepIdx, "propAssign", `${parsed.varName}.${parsed.propertyPath} = ${parsed.value}`, void 0);
112196
112186
  continue;
112197
112187
  }
@@ -112904,7 +112894,7 @@ ${indentMultiline(userMessage)}`;
112904
112894
  body: response.body,
112905
112895
  headers: response.headers
112906
112896
  };
112907
- runtimeVariables[varName] = JSON.stringify(capturedResponse);
112897
+ runtimeVariables[varName] = capturedResponse;
112908
112898
  const relevantCaptures = captures.filter((c) => c.afterRequest === requestIndex);
112909
112899
  for (const capture of relevantCaptures) {
112910
112900
  const value = getValueByPath(response, capture.path);
@@ -113038,7 +113028,7 @@ ${indentMultiline(userMessage)}`;
113038
113028
  returnedObj[resolved.key] = resolved.value;
113039
113029
  }
113040
113030
  }
113041
- runtimeVariables[varName] = JSON.stringify(returnedObj);
113031
+ runtimeVariables[varName] = returnedObj;
113042
113032
  }
113043
113033
  } else {
113044
113034
  runtimeVariables[varName] = "";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "norn-cli",
3
3
  "displayName": "Norn - REST Client",
4
4
  "description": "A powerful REST client for making HTTP requests with sequences, variables, scripts, and cookie support",
5
- "version": "1.10.5",
5
+ "version": "1.10.6",
6
6
  "publisher": "Norn-PeterKrustanov",
7
7
  "author": {
8
8
  "name": "Peter Krastanov"