@testsmith/api-spector 0.3.5 → 0.3.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.
- package/bin/cli.js +11 -7
- package/out/main/agents.js +1 -1
- package/out/main/chunks/environments-iM3SUM-4.js +28 -0
- package/out/main/chunks/{handle-C0IQL-Vl.js → handle-BCnNIZZr.js} +6 -2
- package/out/main/chunks/{import-C5Ngq8hk.js → import-DUKaMYGO.js} +4 -4
- package/out/main/chunks/{recorder-DFxJgn9c.js → recorder-0Ij921El.js} +1 -1
- package/out/main/chunks/request-collection-CBuPjBwa.js +118 -0
- package/out/main/chunks/{request-collection-8TOVNXE0.js → request-exec-AQD6cEgT.js} +602 -146
- package/out/main/chunks/snapshots-NGkGQNZ4.js +1658 -0
- package/out/main/chunks/{soap-handler-B9x_YCtj.js → soap-handler-h0dWIjOK.js} +3 -3
- package/out/main/contract.js +508 -91
- package/out/main/index.js +112 -77
- package/out/main/record.js +3 -3
- package/out/main/runner.js +23 -20
- package/out/main/wsdl.js +4 -4
- package/out/preload/index.js +10 -2
- package/out/renderer/assets/{index-BFxRlU1d.js → index-SXJZlbGN.js} +1342 -214
- package/out/renderer/assets/index-mDBOHLZ5.css +2 -0
- package/out/renderer/index.html +2 -2
- package/package.json +1 -1
- package/readme.md +2 -2
- package/out/main/chunks/auth-builder-CUs9yzOF.js +0 -623
- package/out/main/chunks/snapshots-UFd3XgSS.js +0 -928
- package/out/renderer/assets/index-DuMAjIiI.css +0 -2
package/out/main/runner.js
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
const promises = require("fs/promises");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const
|
|
6
|
-
const requestCollection = require("./chunks/request-collection-
|
|
5
|
+
const requestExec = require("./chunks/request-exec-AQD6cEgT.js");
|
|
6
|
+
const requestCollection = require("./chunks/request-collection-CBuPjBwa.js");
|
|
7
|
+
const environments = require("./chunks/environments-iM3SUM-4.js");
|
|
7
8
|
const cliCommon = require("./chunks/cli-common-CDQY1erJ.js");
|
|
9
|
+
require("undici");
|
|
10
|
+
require("./chunks/handle-BCnNIZZr.js");
|
|
8
11
|
require("crypto");
|
|
9
|
-
require("http");
|
|
10
|
-
require("./chunks/handle-C0IQL-Vl.js");
|
|
11
12
|
require("dayjs");
|
|
12
13
|
require("vm");
|
|
13
|
-
require("undici");
|
|
14
14
|
require("tv4");
|
|
15
15
|
require("jsonpath-plus");
|
|
16
16
|
require("@xmldom/xmldom");
|
|
17
|
+
require("http");
|
|
17
18
|
require("ajv");
|
|
18
19
|
function buildJsonReport(results, summary, meta = {}) {
|
|
19
20
|
return JSON.stringify({
|
|
@@ -349,7 +350,7 @@ function printResult(r, verbose) {
|
|
|
349
350
|
if (r.testResults?.length) {
|
|
350
351
|
for (const t of r.testResults) {
|
|
351
352
|
const ti = t.passed ? cliCommon.color(" ✓", cliCommon.C.green) : cliCommon.color(" ✗", cliCommon.C.red);
|
|
352
|
-
console.log(`${ti} ${t.name}${t.error ? cliCommon.color(`
|
|
353
|
+
console.log(`${ti} ${t.name}${t.error ? cliCommon.color(` - ${t.error}`, cliCommon.C.red) : ""}`);
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
if (r.error) console.log(cliCommon.color(` Error: ${r.error}`, cliCommon.C.red));
|
|
@@ -384,23 +385,25 @@ async function main() {
|
|
|
384
385
|
console.error(cliCommon.color(`Error: could not read workspace file: ${wsPath}`, cliCommon.C.red));
|
|
385
386
|
process.exit(1);
|
|
386
387
|
}
|
|
387
|
-
await
|
|
388
|
+
await requestExec.loadGlobals(wsDir);
|
|
388
389
|
const collections = await cliCommon.loadCollections(workspace, wsDir, {
|
|
389
390
|
onError: (relPath) => console.error(cliCommon.color(` [warn] Could not load collection: ${relPath}`, cliCommon.C.yellow))
|
|
390
391
|
});
|
|
391
|
-
const environments = await cliCommon.loadEnvironments(workspace, wsDir);
|
|
392
|
-
const env =
|
|
392
|
+
const environments$1 = await cliCommon.loadEnvironments(workspace, wsDir);
|
|
393
|
+
const env = environments.selectEnvironment(workspace, environments$1, envName);
|
|
393
394
|
if (envName && !env) {
|
|
394
395
|
console.warn(cliCommon.color(`Warning: environment "${envName}" not found. Running without environment.`, cliCommon.C.yellow));
|
|
396
|
+
} else if (!envName && workspace.settings?.defaultEnvironment && !env) {
|
|
397
|
+
console.warn(cliCommon.color(`Warning: default environment "${workspace.settings.defaultEnvironment}" not found. Running without environment.`, cliCommon.C.yellow));
|
|
395
398
|
}
|
|
396
|
-
const version = `v${"0.3.
|
|
399
|
+
const version = `v${"0.3.7"}`;
|
|
397
400
|
console.log("");
|
|
398
401
|
console.log(cliCommon.color(" API Test Runner" + (version ? ` ${version}` : ""), cliCommon.C.bold, cliCommon.C.white));
|
|
399
402
|
console.log(cliCommon.color(` Workspace: ${wsPath}`, cliCommon.C.gray));
|
|
400
403
|
console.log(cliCommon.color(` Environment: ${env?.name ?? "(none)"}`, cliCommon.C.gray));
|
|
401
404
|
if (filterTags.length) console.log(cliCommon.color(` Tags: ${filterTags.join(", ")}`, cliCommon.C.gray));
|
|
402
405
|
console.log("");
|
|
403
|
-
const envVarsSnapshot = await
|
|
406
|
+
const envVarsSnapshot = await requestExec.buildEnvVars(env);
|
|
404
407
|
const secretValuesToMask = (env?.variables ?? []).filter((v) => v.secret && v.enabled).map((v) => envVarsSnapshot[v.key]).filter((v) => typeof v === "string" && v.length > 0);
|
|
405
408
|
function redact(s) {
|
|
406
409
|
let out = s;
|
|
@@ -414,14 +417,14 @@ async function main() {
|
|
|
414
417
|
...r,
|
|
415
418
|
sentRequest: r.sentRequest ? {
|
|
416
419
|
headers: Object.fromEntries(
|
|
417
|
-
Object.entries(
|
|
420
|
+
Object.entries(requestExec.maskHeaders(r.sentRequest.headers, piiPatterns)).map(([k, v]) => [k, redact(v)])
|
|
418
421
|
),
|
|
419
|
-
body: r.sentRequest.body != null ? redact(
|
|
422
|
+
body: r.sentRequest.body != null ? redact(requestExec.maskPii(r.sentRequest.body, piiPatterns)) : void 0
|
|
420
423
|
} : void 0,
|
|
421
424
|
receivedResponse: r.receivedResponse ? {
|
|
422
425
|
...r.receivedResponse,
|
|
423
|
-
headers:
|
|
424
|
-
body: redact(
|
|
426
|
+
headers: requestExec.maskHeaders(r.receivedResponse.headers, piiPatterns),
|
|
427
|
+
body: redact(requestExec.maskPii(r.receivedResponse.body, piiPatterns))
|
|
425
428
|
} : void 0
|
|
426
429
|
};
|
|
427
430
|
}
|
|
@@ -435,8 +438,8 @@ async function main() {
|
|
|
435
438
|
const items = requestCollection.buildRunPlan(col, null, filterTags);
|
|
436
439
|
if (items.length === 0) continue;
|
|
437
440
|
if (!firstColName) firstColName = col.name;
|
|
438
|
-
let runEnvVars = await
|
|
439
|
-
let runGlobals =
|
|
441
|
+
let runEnvVars = await requestExec.buildEnvVars(env);
|
|
442
|
+
let runGlobals = requestExec.getGlobals();
|
|
440
443
|
let runCollectionVars = { ...col.collectionVariables ?? {} };
|
|
441
444
|
let runLocalVars = {};
|
|
442
445
|
console.log(cliCommon.color(` ┌ ${col.name}`, cliCommon.C.bold, cliCommon.C.white));
|
|
@@ -455,8 +458,8 @@ async function main() {
|
|
|
455
458
|
}
|
|
456
459
|
let bailed = false;
|
|
457
460
|
let lastPrintedScope = null;
|
|
458
|
-
const skipTracker = new
|
|
459
|
-
const dispatcher = await
|
|
461
|
+
const skipTracker = new requestExec.HookSkipTracker();
|
|
462
|
+
const dispatcher = await requestExec.buildDispatcher(void 0, effectiveTls);
|
|
460
463
|
const onScriptOutput = (phase, lines, error) => {
|
|
461
464
|
if (verbose && lines.length) lines.forEach((l) => console.log(cliCommon.color(` [${phase}] ${l}`, cliCommon.C.gray)));
|
|
462
465
|
if (phase === "pre" && error) console.error(cliCommon.color(` [pre-script error] ${error}`, cliCommon.C.red));
|
|
@@ -479,7 +482,7 @@ async function main() {
|
|
|
479
482
|
scopePath: item.scopePath
|
|
480
483
|
};
|
|
481
484
|
} else {
|
|
482
|
-
const out = await
|
|
485
|
+
const out = await requestExec.executeRunnerRequest({
|
|
483
486
|
req: item.request,
|
|
484
487
|
collectionVars: { ...item.collectionVars, ...runCollectionVars },
|
|
485
488
|
envVars: runEnvVars,
|
package/out/main/wsdl.js
CHANGED
|
@@ -4,10 +4,10 @@ const promises = require("fs/promises");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const https = require("https");
|
|
6
6
|
const http = require("http");
|
|
7
|
-
const soapHandler = require("./chunks/soap-handler-
|
|
8
|
-
const _import = require("./chunks/import-
|
|
7
|
+
const soapHandler = require("./chunks/soap-handler-h0dWIjOK.js");
|
|
8
|
+
const _import = require("./chunks/import-DUKaMYGO.js");
|
|
9
9
|
const cliCommon = require("./chunks/cli-common-CDQY1erJ.js");
|
|
10
|
-
require("./chunks/handle-
|
|
10
|
+
require("./chunks/handle-BCnNIZZr.js");
|
|
11
11
|
require("@xmldom/xmldom");
|
|
12
12
|
require("uuid");
|
|
13
13
|
function fetchUrl(url) {
|
|
@@ -55,7 +55,7 @@ async function cmdDescribe(args) {
|
|
|
55
55
|
for (const op of parsed.operations) {
|
|
56
56
|
const name = op.name.slice(0, 37).padEnd(37);
|
|
57
57
|
const ver = op.soapVersion.padEnd(5);
|
|
58
|
-
const sa = (op.soapAction ?? "
|
|
58
|
+
const sa = (op.soapAction ?? "-").slice(0, 30);
|
|
59
59
|
console.log(` ${name} ${ver} ${sa}`);
|
|
60
60
|
}
|
|
61
61
|
console.log("");
|
package/out/preload/index.js
CHANGED
|
@@ -14,7 +14,9 @@ const IPC = {
|
|
|
14
14
|
saveEnvironment: "file:saveEnvironment",
|
|
15
15
|
deleteWorkspaceFile: "file:deleteWorkspaceFile",
|
|
16
16
|
saveMock: "file:saveMock",
|
|
17
|
-
loadMock: "file:loadMock"
|
|
17
|
+
loadMock: "file:loadMock",
|
|
18
|
+
loadHistory: "file:loadHistory",
|
|
19
|
+
saveHistory: "file:saveHistory"
|
|
18
20
|
},
|
|
19
21
|
// ─── Native dialogs ────────────────────────────────────────────────────────
|
|
20
22
|
dialog: {
|
|
@@ -104,7 +106,9 @@ const IPC = {
|
|
|
104
106
|
captureSnapshot: "contract:captureSnapshot",
|
|
105
107
|
listSnapshots: "contract:listSnapshots",
|
|
106
108
|
loadSnapshot: "contract:loadSnapshot",
|
|
107
|
-
deleteSnapshot: "contract:deleteSnapshot"
|
|
109
|
+
deleteSnapshot: "contract:deleteSnapshot",
|
|
110
|
+
recordResult: "contract:recordResult",
|
|
111
|
+
fuzz: "contract:fuzz"
|
|
108
112
|
},
|
|
109
113
|
// ─── Script hooks ──────────────────────────────────────────────────────────
|
|
110
114
|
script: {
|
|
@@ -166,6 +170,8 @@ const api = {
|
|
|
166
170
|
* environment / mock delete flows so the file is removed from disk, not
|
|
167
171
|
* just from the workspace manifest. */
|
|
168
172
|
deleteWorkspaceFile: (relPath) => electron.ipcRenderer.invoke(IPC.file.deleteWorkspaceFile, relPath),
|
|
173
|
+
loadHistory: () => electron.ipcRenderer.invoke(IPC.file.loadHistory),
|
|
174
|
+
saveHistory: (entries) => electron.ipcRenderer.invoke(IPC.file.saveHistory, entries),
|
|
169
175
|
// ─── HTTP execution ────────────────────────────────────────────────────────
|
|
170
176
|
sendRequest: (payload) => electron.ipcRenderer.invoke(IPC.request.send, payload),
|
|
171
177
|
// ─── Secrets (encrypted, master-key-based) ───────────────────────────────
|
|
@@ -247,6 +253,8 @@ const api = {
|
|
|
247
253
|
listContractSnapshots: (registered = []) => electron.ipcRenderer.invoke(IPC.contract.listSnapshots, registered),
|
|
248
254
|
loadContractSnapshot: (relPath) => electron.ipcRenderer.invoke(IPC.contract.loadSnapshot, relPath),
|
|
249
255
|
deleteContractSnapshot: (relPath) => electron.ipcRenderer.invoke(IPC.contract.deleteSnapshot, relPath),
|
|
256
|
+
recordContractResult: (opts) => electron.ipcRenderer.invoke(IPC.contract.recordResult, opts),
|
|
257
|
+
fuzzContracts: (payload) => electron.ipcRenderer.invoke(IPC.contract.fuzz, payload),
|
|
250
258
|
// ─── Script hooks ─────────────────────────────────────────────────────────
|
|
251
259
|
runScriptHook: (payload) => electron.ipcRenderer.invoke(IPC.script.runHook, payload),
|
|
252
260
|
// ─── Git ──────────────────────────────────────────────────────────────────
|