@elench/testkit 0.1.128 → 0.1.130

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.
@@ -246,7 +246,11 @@ function renderTemplate(value, context) {
246
246
  }
247
247
 
248
248
  function renderSql(statement, context) {
249
- return String(statement).replace(/\{([A-Za-z0-9_.[\]-]+)\}/g, (_match, key) => toSqlLiteral(readPath(context, key)));
249
+ const source = String(statement);
250
+ return source.replace(/\{([A-Za-z0-9_.[\]-]+)\}/g, (match, key, offset) => {
251
+ const value = readPath(context, key);
252
+ return isInsideSingleQuotedSqlString(source, offset) ? toSqlStringContent(value) : toSqlLiteral(value);
253
+ });
250
254
  }
251
255
 
252
256
  function readPath(source, path) {
@@ -262,7 +266,26 @@ function toSqlLiteral(value) {
262
266
  if (Array.isArray(value)) return `array[${value.map((entry) => toSqlLiteral(entry)).join(", ")}]`;
263
267
  if (typeof value === "number" && Number.isFinite(value)) return String(value);
264
268
  if (typeof value === "boolean") return value ? "true" : "false";
265
- return `'${String(value).replaceAll("'", "''")}'`;
269
+ return `'${toSqlStringContent(value)}'`;
270
+ }
271
+
272
+ function toSqlStringContent(value) {
273
+ if (value === null || value === undefined) return "";
274
+ if (Array.isArray(value)) return value.map((entry) => String(entry)).join(",");
275
+ return String(value).replaceAll("'", "''");
276
+ }
277
+
278
+ function isInsideSingleQuotedSqlString(source, offset) {
279
+ let inString = false;
280
+ for (let index = 0; index < offset; index += 1) {
281
+ if (source[index] !== "'") continue;
282
+ if (inString && source[index + 1] === "'") {
283
+ index += 1;
284
+ continue;
285
+ }
286
+ inString = !inString;
287
+ }
288
+ return inString;
266
289
  }
267
290
 
268
291
  function isExpectedStatus(status, expected) {
@@ -53,16 +53,24 @@ export function createSandboxId(options = {}) {
53
53
  }
54
54
 
55
55
  export function resolveFrontendBaseUrl(options = {}) {
56
+ const config = readUiAuthConfig();
56
57
  return resolveBaseUrl(
57
58
  options.frontendBaseUrl ||
58
59
  options.baseUrl ||
60
+ config.frontendBaseUrl ||
59
61
  process.env.TESTKIT_FRONTEND_BASE_URL ||
60
62
  process.env.BASE_URL
61
63
  );
62
64
  }
63
65
 
64
66
  export function resolveBackendBaseUrl(options = {}) {
65
- return resolveBaseUrl(options.backendBaseUrl || process.env.TESTKIT_BACKEND_BASE_URL || process.env.API_BASE_URL);
67
+ const config = readUiAuthConfig();
68
+ return resolveBaseUrl(
69
+ options.backendBaseUrl ||
70
+ config.backendBaseUrl ||
71
+ process.env.TESTKIT_BACKEND_BASE_URL ||
72
+ process.env.API_BASE_URL
73
+ );
66
74
  }
67
75
 
68
76
  export function assertSafeUiTarget(url, options = {}) {
@@ -243,6 +251,19 @@ function resolveBaseUrl(value) {
243
251
  return assertSafeUiTarget(normalized);
244
252
  }
245
253
 
254
+ function readUiAuthConfig(env = process.env) {
255
+ const raw = env.TESTKIT_UI_CONFIG_JSON;
256
+ if (!raw) return {};
257
+ try {
258
+ const parsed = JSON.parse(raw);
259
+ const root = parsed && typeof parsed === "object" ? parsed : {};
260
+ const auth = root.auth || root;
261
+ return auth && typeof auth === "object" ? auth : {};
262
+ } catch {
263
+ return {};
264
+ }
265
+ }
266
+
246
267
  function parseUrl(value) {
247
268
  try {
248
269
  return new URL(value);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "SWC-backed Next.js source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-bridge",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "Browser bridge helpers for testkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc -p tsconfig.json --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@elench/testkit-protocol": "0.1.128"
25
+ "@elench/testkit-protocol": "0.1.130"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "Shared browser protocol for testkit bridge and extension consumers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/ts-analysis",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "TypeScript compiler-backed source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "Assistant-first CLI for running, inspecting, and debugging local testkit suites",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -95,10 +95,10 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@babel/code-frame": "^7.29.0",
98
- "@elench/next-analysis": "0.1.128",
99
- "@elench/testkit-bridge": "0.1.128",
100
- "@elench/testkit-protocol": "0.1.128",
101
- "@elench/ts-analysis": "0.1.128",
98
+ "@elench/next-analysis": "0.1.130",
99
+ "@elench/testkit-bridge": "0.1.130",
100
+ "@elench/testkit-protocol": "0.1.130",
101
+ "@elench/ts-analysis": "0.1.130",
102
102
  "@oclif/core": "^4.10.6",
103
103
  "@playwright/test": "^1.52.0",
104
104
  "esbuild": "^0.25.11",