@testsmith/api-spector 0.7.7 → 0.7.8

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 (31) hide show
  1. package/bin/cli.js +4 -0
  2. package/out/main/chunks/{broker-client-Df4PpJqB.js → broker-client-BYpWeOWT.js} +4 -1
  3. package/out/main/chunks/{flow-engine-BVzjz4lJ.js → flow-engine-BxwjEy37.js} +66 -1
  4. package/out/main/chunks/{handle-Bz0C56Eq.js → handle-Crv1i9hb.js} +60 -0
  5. package/out/main/chunks/{import-BhGBiW7j.js → import-DTcZMRNu.js} +2 -2
  6. package/out/main/chunks/perf-report-ChaO3K0w.js +124 -0
  7. package/out/main/chunks/perf-run-uZBqnG3S.js +578 -0
  8. package/out/main/chunks/{request-collection-KGPuvN7o.js → request-collection-gkOYlWml.js} +68 -11
  9. package/out/main/chunks/{request-exec-B-F0K-pN.js → request-exec-Cv2jkrO1.js} +439 -12
  10. package/out/main/chunks/run-concurrent-468tH0AX.js +26 -0
  11. package/out/main/chunks/{soap-handler-DqIPcIQL.js → soap-handler-Brr7BPWO.js} +2 -2
  12. package/out/main/contract.js +6 -3
  13. package/out/main/flow.js +8 -5
  14. package/out/main/index.js +1338 -179
  15. package/out/main/lib.js +6 -3
  16. package/out/main/perf-worker.js +45 -0
  17. package/out/main/perf.js +253 -0
  18. package/out/main/runner.js +181 -7
  19. package/out/main/socketio.js +172 -0
  20. package/out/main/wsdl.js +3 -3
  21. package/out/preload/index.js +123 -0
  22. package/out/renderer/assets/{GraphQLEditor-BXpdmpn6.js → GraphQLEditor-Dv2K4wdd.js} +59 -14
  23. package/out/renderer/assets/{SoapEditor-De6WlP6E.js → SoapEditor-Cnz3M4Dz.js} +3 -3
  24. package/out/renderer/assets/ajv-CJPwFjiP.js +6718 -0
  25. package/out/renderer/assets/{codemirror-F6m3Hm1M.js → codemirror-CdIFBPs2.js} +1214 -1207
  26. package/out/renderer/assets/{index-Gcd_t6pX.js → index-CtCdFiRx.js} +15213 -12165
  27. package/out/renderer/assets/index-DkhdKzQJ.css +627 -0
  28. package/out/renderer/index.html +4 -4
  29. package/package.json +12 -6
  30. package/out/renderer/assets/ajv-2MAg6kGF.js +0 -6153
  31. package/out/renderer/assets/index-CYArpqm5.css +0 -627
@@ -25,6 +25,14 @@ function findFolder(root, id) {
25
25
  }
26
26
  return null;
27
27
  }
28
+ function folderChainTo(root, targetId) {
29
+ if (root.id === targetId) return [root];
30
+ for (const sub of root.folders) {
31
+ const chain = folderChainTo(sub, targetId);
32
+ if (chain.length > 0) return [root, ...chain];
33
+ }
34
+ return [];
35
+ }
28
36
  function flattenFolderRequests(folder, requests) {
29
37
  const out = [];
30
38
  for (const child of orderedChildren(folder)) {
@@ -38,11 +46,13 @@ function flattenFolderRequests(folder, requests) {
38
46
  }
39
47
  return out;
40
48
  }
41
- function makeHook(req, collectionVars, hookType, scopeId, scopeAncestors, scopePath, mainRequestId) {
42
- return { request: req, collectionVars, isHook: true, hookType, scopeId, scopeAncestors, scopePath, mainRequestId };
49
+ function makeHook(req, collectionVars, hookType, scopeId, scopeAncestors, scopePath, mainRequestId, folderVars, folderId) {
50
+ return { request: req, collectionVars, isHook: true, hookType, scopeId, scopeAncestors, scopePath, mainRequestId, folderVars, folderId };
43
51
  }
44
- function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId, ancestorIds, parentPath, wrappers, isRoot) {
52
+ function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId, ancestorIds, parentPath, wrappers, isRoot, inheritedFolderVars = {}) {
45
53
  const result = [];
54
+ const myFolderVars = { ...inheritedFolderVars, ...folder.variables ?? {} };
55
+ const myFolderId = folder.id;
46
56
  const scopePath = isRoot ? [] : [...parentPath, folder.name];
47
57
  const folderReqs = orderedChildren(folder).filter((c) => c.type === "request").map((c) => requests[c.id]).filter((r) => r && !r.disabled);
48
58
  const beforeAllHooks = [];
@@ -69,10 +79,10 @@ function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId,
69
79
  }
70
80
  }
71
81
  const regularReqs = folderReqs.filter((r) => !r.hookType);
72
- const myWrapper = { scopeId, ancestors: ancestorIds, scopePath, before: beforeHooks, after: afterHooks };
82
+ const myWrapper = { scopeId, ancestors: ancestorIds, scopePath, before: beforeHooks, after: afterHooks, folderVars: myFolderVars, folderId: myFolderId };
73
83
  const allWrappers = [...wrappers, myWrapper];
74
84
  for (const req of beforeAllHooks) {
75
- result.push(makeHook(req, collectionVars, "beforeAll", scopeId, ancestorIds, scopePath));
85
+ result.push(makeHook(req, collectionVars, "beforeAll", scopeId, ancestorIds, scopePath, void 0, myFolderVars, myFolderId));
76
86
  }
77
87
  const regularById = new Map(regularReqs.map((r) => [r.id, r]));
78
88
  const subById = new Map(folder.folders.map((f) => [f.id, f]));
@@ -84,13 +94,13 @@ function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId,
84
94
  if (filterTags.length > 0 && !filterTags.some((t) => tags.includes(t))) continue;
85
95
  for (const w of allWrappers) {
86
96
  for (const hookReq of w.before) {
87
- result.push(makeHook(hookReq, collectionVars, "before", w.scopeId, w.ancestors, w.scopePath, req.id));
97
+ result.push(makeHook(hookReq, collectionVars, "before", w.scopeId, w.ancestors, w.scopePath, req.id, w.folderVars, w.folderId));
88
98
  }
89
99
  }
90
- result.push({ request: req, collectionVars, scopeId, scopeAncestors: ancestorIds, scopePath });
100
+ result.push({ request: req, collectionVars, scopeId, scopeAncestors: ancestorIds, scopePath, folderVars: myFolderVars, folderId: myFolderId });
91
101
  for (const w of [...allWrappers].reverse()) {
92
102
  for (const hookReq of w.after) {
93
- result.push(makeHook(hookReq, collectionVars, "after", w.scopeId, w.ancestors, w.scopePath, req.id));
103
+ result.push(makeHook(hookReq, collectionVars, "after", w.scopeId, w.ancestors, w.scopePath, req.id, w.folderVars, w.folderId));
94
104
  }
95
105
  }
96
106
  } else {
@@ -108,12 +118,13 @@ function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId,
108
118
  [...ancestorIds, scopeId],
109
119
  scopePath,
110
120
  allWrappers,
111
- false
121
+ false,
122
+ myFolderVars
112
123
  ));
113
124
  }
114
125
  }
115
126
  for (const req of afterAllHooks) {
116
- result.push(makeHook(req, collectionVars, "afterAll", scopeId, ancestorIds, scopePath));
127
+ result.push(makeHook(req, collectionVars, "afterAll", scopeId, ancestorIds, scopePath, void 0, myFolderVars, myFolderId));
117
128
  }
118
129
  return result;
119
130
  }
@@ -185,7 +196,7 @@ function resolveInheritedAuthAndHeaders(requestId, collection) {
185
196
  function buildRunPlan(collection, folderId, filterTags) {
186
197
  const collectionVars = collection.collectionVariables ?? {};
187
198
  const tag = (items) => items.map((i) => ({ ...i, collection: collection.name }));
188
- {
199
+ if (!folderId) {
189
200
  return tag(buildFolderPlan(
190
201
  collection.rootFolder,
191
202
  collection.requests,
@@ -198,6 +209,52 @@ function buildRunPlan(collection, folderId, filterTags) {
198
209
  true
199
210
  ));
200
211
  }
212
+ const chain = folderChainTo(collection.rootFolder, folderId);
213
+ if (chain.length === 0) return [];
214
+ const targetFolder = chain[chain.length - 1];
215
+ const ancestors = chain.slice(0, -1);
216
+ const result = [];
217
+ const ancestorWrappers = [];
218
+ const ancestorIds = [];
219
+ for (const f of ancestors) {
220
+ const reqs = f.requestIds.map((id) => collection.requests[id]).filter((r) => r && !r.disabled);
221
+ const beforeAllH = reqs.filter((r) => r.hookType === "beforeAll");
222
+ const beforeH = reqs.filter((r) => r.hookType === "before");
223
+ const afterH = reqs.filter((r) => r.hookType === "after");
224
+ for (const req of beforeAllH) {
225
+ result.push(makeHook(req, collectionVars, "beforeAll", f.id, [...ancestorIds], []));
226
+ }
227
+ ancestorWrappers.push({
228
+ scopeId: f.id,
229
+ ancestors: [...ancestorIds],
230
+ scopePath: [],
231
+ // ancestor hooks render with no folder heading
232
+ before: beforeH,
233
+ after: afterH
234
+ });
235
+ ancestorIds.push(f.id);
236
+ }
237
+ result.push(...buildFolderPlan(
238
+ targetFolder,
239
+ collection.requests,
240
+ collectionVars,
241
+ filterTags,
242
+ targetFolder.id,
243
+ ancestorIds,
244
+ [],
245
+ ancestorWrappers,
246
+ true
247
+ ));
248
+ for (let i = ancestors.length - 1; i >= 0; i--) {
249
+ const f = ancestors[i];
250
+ const reqs = f.requestIds.map((id) => collection.requests[id]).filter((r) => r && !r.disabled);
251
+ const afterAllH = reqs.filter((r) => r.hookType === "afterAll");
252
+ const myAncestors = ancestorIds.slice(0, i);
253
+ for (const req of afterAllH) {
254
+ result.push(makeHook(req, collectionVars, "afterAll", f.id, myAncestors, []));
255
+ }
256
+ }
257
+ return tag(result);
201
258
  }
202
259
  function expandRunPlanWithData(items, ds) {
203
260
  if (!ds || ds.rows.length === 0) return items;