@apiquest/fracture 1.0.2 → 1.0.5

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 (195) hide show
  1. package/README.md +207 -0
  2. package/bin/cli.js +2 -2
  3. package/dist/CollectionRunner.d.ts +2 -0
  4. package/dist/CollectionRunner.d.ts.map +1 -1
  5. package/dist/CollectionRunner.js +23 -5
  6. package/dist/CollectionRunner.js.map +1 -1
  7. package/dist/LibraryLoader.d.ts +49 -0
  8. package/dist/LibraryLoader.d.ts.map +1 -0
  9. package/dist/LibraryLoader.js +198 -0
  10. package/dist/LibraryLoader.js.map +1 -0
  11. package/dist/PluginLoader.d.ts.map +1 -1
  12. package/dist/PluginLoader.js +9 -6
  13. package/dist/PluginLoader.js.map +1 -1
  14. package/dist/PluginResolver.d.ts +1 -1
  15. package/dist/PluginResolver.d.ts.map +1 -1
  16. package/dist/PluginResolver.js +1 -1
  17. package/dist/PluginResolver.js.map +1 -1
  18. package/dist/ScriptEngine.d.ts +2 -1
  19. package/dist/ScriptEngine.d.ts.map +1 -1
  20. package/dist/ScriptEngine.js +19 -12
  21. package/dist/ScriptEngine.js.map +1 -1
  22. package/dist/cli/index.js +35 -3
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/cli/plugin-commands.d.ts.map +1 -1
  25. package/dist/cli/plugin-commands.js +48 -81
  26. package/dist/cli/plugin-commands.js.map +1 -1
  27. package/dist/cli/plugin-installer.d.ts +48 -0
  28. package/dist/cli/plugin-installer.d.ts.map +1 -0
  29. package/dist/cli/plugin-installer.js +136 -0
  30. package/dist/cli/plugin-installer.js.map +1 -0
  31. package/dist/cli/plugin-registry.d.ts +17 -0
  32. package/dist/cli/plugin-registry.d.ts.map +1 -0
  33. package/dist/cli/plugin-registry.js +77 -0
  34. package/dist/cli/plugin-registry.js.map +1 -0
  35. package/package.json +55 -50
  36. package/tsconfig.json +20 -20
  37. package/tsconfig.test.json +5 -5
  38. package/vitest.config.ts +22 -22
  39. package/dist/ExecutionTree.d.ts +0 -77
  40. package/dist/ExecutionTree.d.ts.map +0 -1
  41. package/dist/ExecutionTree.js +0 -265
  42. package/dist/ExecutionTree.js.map +0 -1
  43. package/dist/fracture/src/CollectionAnalyzer.d.ts +0 -17
  44. package/dist/fracture/src/CollectionAnalyzer.d.ts.map +0 -1
  45. package/dist/fracture/src/CollectionAnalyzer.js +0 -70
  46. package/dist/fracture/src/CollectionAnalyzer.js.map +0 -1
  47. package/dist/fracture/src/CollectionRunner.d.ts +0 -39
  48. package/dist/fracture/src/CollectionRunner.d.ts.map +0 -1
  49. package/dist/fracture/src/CollectionRunner.js +0 -802
  50. package/dist/fracture/src/CollectionRunner.js.map +0 -1
  51. package/dist/fracture/src/CollectionRunner.types.d.ts +0 -8
  52. package/dist/fracture/src/CollectionRunner.types.d.ts.map +0 -1
  53. package/dist/fracture/src/CollectionRunner.types.js +0 -2
  54. package/dist/fracture/src/CollectionRunner.types.js.map +0 -1
  55. package/dist/fracture/src/CollectionValidator.d.ts +0 -14
  56. package/dist/fracture/src/CollectionValidator.d.ts.map +0 -1
  57. package/dist/fracture/src/CollectionValidator.js +0 -145
  58. package/dist/fracture/src/CollectionValidator.js.map +0 -1
  59. package/dist/fracture/src/ConsoleReporter.d.ts +0 -24
  60. package/dist/fracture/src/ConsoleReporter.d.ts.map +0 -1
  61. package/dist/fracture/src/ConsoleReporter.js +0 -123
  62. package/dist/fracture/src/ConsoleReporter.js.map +0 -1
  63. package/dist/fracture/src/CookieJar.d.ts +0 -70
  64. package/dist/fracture/src/CookieJar.d.ts.map +0 -1
  65. package/dist/fracture/src/CookieJar.js +0 -233
  66. package/dist/fracture/src/CookieJar.js.map +0 -1
  67. package/dist/fracture/src/ExecutionTree.d.ts +0 -77
  68. package/dist/fracture/src/ExecutionTree.d.ts.map +0 -1
  69. package/dist/fracture/src/ExecutionTree.js +0 -258
  70. package/dist/fracture/src/ExecutionTree.js.map +0 -1
  71. package/dist/fracture/src/Logger.d.ts +0 -25
  72. package/dist/fracture/src/Logger.d.ts.map +0 -1
  73. package/dist/fracture/src/Logger.js +0 -78
  74. package/dist/fracture/src/Logger.js.map +0 -1
  75. package/dist/fracture/src/PluginLoader.d.ts +0 -23
  76. package/dist/fracture/src/PluginLoader.d.ts.map +0 -1
  77. package/dist/fracture/src/PluginLoader.js +0 -102
  78. package/dist/fracture/src/PluginLoader.js.map +0 -1
  79. package/dist/fracture/src/PluginManager.d.ts +0 -64
  80. package/dist/fracture/src/PluginManager.d.ts.map +0 -1
  81. package/dist/fracture/src/PluginManager.js +0 -162
  82. package/dist/fracture/src/PluginManager.js.map +0 -1
  83. package/dist/fracture/src/PluginResolver.d.ts +0 -35
  84. package/dist/fracture/src/PluginResolver.d.ts.map +0 -1
  85. package/dist/fracture/src/PluginResolver.js +0 -128
  86. package/dist/fracture/src/PluginResolver.js.map +0 -1
  87. package/dist/fracture/src/QuestAPI.d.ts +0 -9
  88. package/dist/fracture/src/QuestAPI.d.ts.map +0 -1
  89. package/dist/fracture/src/QuestAPI.js +0 -679
  90. package/dist/fracture/src/QuestAPI.js.map +0 -1
  91. package/dist/fracture/src/QuestAPI.types.d.ts +0 -35
  92. package/dist/fracture/src/QuestAPI.types.d.ts.map +0 -1
  93. package/dist/fracture/src/QuestAPI.types.js +0 -3
  94. package/dist/fracture/src/QuestAPI.types.js.map +0 -1
  95. package/dist/fracture/src/QuestTestAPI.d.ts +0 -12
  96. package/dist/fracture/src/QuestTestAPI.d.ts.map +0 -1
  97. package/dist/fracture/src/QuestTestAPI.js +0 -133
  98. package/dist/fracture/src/QuestTestAPI.js.map +0 -1
  99. package/dist/fracture/src/ScriptEngine.d.ts +0 -21
  100. package/dist/fracture/src/ScriptEngine.d.ts.map +0 -1
  101. package/dist/fracture/src/ScriptEngine.js +0 -183
  102. package/dist/fracture/src/ScriptEngine.js.map +0 -1
  103. package/dist/fracture/src/ScriptValidator.d.ts +0 -68
  104. package/dist/fracture/src/ScriptValidator.d.ts.map +0 -1
  105. package/dist/fracture/src/ScriptValidator.js +0 -351
  106. package/dist/fracture/src/ScriptValidator.js.map +0 -1
  107. package/dist/fracture/src/TestCounter.d.ts +0 -18
  108. package/dist/fracture/src/TestCounter.d.ts.map +0 -1
  109. package/dist/fracture/src/TestCounter.js +0 -82
  110. package/dist/fracture/src/TestCounter.js.map +0 -1
  111. package/dist/fracture/src/VariableResolver.d.ts +0 -20
  112. package/dist/fracture/src/VariableResolver.d.ts.map +0 -1
  113. package/dist/fracture/src/VariableResolver.js +0 -100
  114. package/dist/fracture/src/VariableResolver.js.map +0 -1
  115. package/dist/fracture/src/cli/index.d.ts +0 -3
  116. package/dist/fracture/src/cli/index.d.ts.map +0 -1
  117. package/dist/fracture/src/cli/index.js +0 -347
  118. package/dist/fracture/src/cli/index.js.map +0 -1
  119. package/dist/fracture/src/cli/plugin-commands.d.ts +0 -6
  120. package/dist/fracture/src/cli/plugin-commands.d.ts.map +0 -1
  121. package/dist/fracture/src/cli/plugin-commands.js +0 -263
  122. package/dist/fracture/src/cli/plugin-commands.js.map +0 -1
  123. package/dist/fracture/src/cli/plugin-discovery.d.ts +0 -11
  124. package/dist/fracture/src/cli/plugin-discovery.d.ts.map +0 -1
  125. package/dist/fracture/src/cli/plugin-discovery.js +0 -64
  126. package/dist/fracture/src/cli/plugin-discovery.js.map +0 -1
  127. package/dist/fracture/src/index.d.ts +0 -13
  128. package/dist/fracture/src/index.d.ts.map +0 -1
  129. package/dist/fracture/src/index.js +0 -17
  130. package/dist/fracture/src/index.js.map +0 -1
  131. package/dist/fracture/src/utils.d.ts +0 -28
  132. package/dist/fracture/src/utils.d.ts.map +0 -1
  133. package/dist/fracture/src/utils.js +0 -48
  134. package/dist/fracture/src/utils.js.map +0 -1
  135. package/dist/plugin-auth/src/apikey-auth.d.ts +0 -3
  136. package/dist/plugin-auth/src/apikey-auth.d.ts.map +0 -1
  137. package/dist/plugin-auth/src/apikey-auth.js +0 -73
  138. package/dist/plugin-auth/src/apikey-auth.js.map +0 -1
  139. package/dist/plugin-auth/src/basic-auth.d.ts +0 -3
  140. package/dist/plugin-auth/src/basic-auth.d.ts.map +0 -1
  141. package/dist/plugin-auth/src/basic-auth.js +0 -61
  142. package/dist/plugin-auth/src/basic-auth.js.map +0 -1
  143. package/dist/plugin-auth/src/bearer-auth.d.ts +0 -3
  144. package/dist/plugin-auth/src/bearer-auth.d.ts.map +0 -1
  145. package/dist/plugin-auth/src/bearer-auth.js +0 -49
  146. package/dist/plugin-auth/src/bearer-auth.js.map +0 -1
  147. package/dist/plugin-auth/src/helpers.d.ts +0 -3
  148. package/dist/plugin-auth/src/helpers.d.ts.map +0 -1
  149. package/dist/plugin-auth/src/helpers.js +0 -8
  150. package/dist/plugin-auth/src/helpers.js.map +0 -1
  151. package/dist/plugin-auth/src/index.d.ts +0 -10
  152. package/dist/plugin-auth/src/index.d.ts.map +0 -1
  153. package/dist/plugin-auth/src/index.js +0 -25
  154. package/dist/plugin-auth/src/index.js.map +0 -1
  155. package/dist/plugin-auth/src/oauth2-auth.d.ts +0 -35
  156. package/dist/plugin-auth/src/oauth2-auth.d.ts.map +0 -1
  157. package/dist/plugin-auth/src/oauth2-auth.js +0 -266
  158. package/dist/plugin-auth/src/oauth2-auth.js.map +0 -1
  159. package/dist/plugin-http/src/index.d.ts +0 -4
  160. package/dist/plugin-http/src/index.d.ts.map +0 -1
  161. package/dist/plugin-http/src/index.js +0 -266
  162. package/dist/plugin-http/src/index.js.map +0 -1
  163. package/dist/plugin-vault-file/src/index.d.ts +0 -67
  164. package/dist/plugin-vault-file/src/index.d.ts.map +0 -1
  165. package/dist/plugin-vault-file/src/index.js +0 -171
  166. package/dist/plugin-vault-file/src/index.js.map +0 -1
  167. package/dist/types.d.ts +0 -374
  168. package/dist/types.d.ts.map +0 -1
  169. package/dist/types.js +0 -13
  170. package/dist/types.js.map +0 -1
  171. package/src/CollectionAnalyzer.ts +0 -102
  172. package/src/CollectionRunner.ts +0 -1423
  173. package/src/CollectionRunner.types.ts +0 -9
  174. package/src/CollectionValidator.ts +0 -289
  175. package/src/ConsoleReporter.ts +0 -143
  176. package/src/CookieJar.ts +0 -258
  177. package/src/DagScheduler.ts +0 -439
  178. package/src/Logger.ts +0 -85
  179. package/src/PluginLoader.ts +0 -126
  180. package/src/PluginManager.ts +0 -208
  181. package/src/PluginResolver.ts +0 -154
  182. package/src/QuestAPI.ts +0 -764
  183. package/src/QuestAPI.types.ts +0 -33
  184. package/src/QuestTestAPI.ts +0 -164
  185. package/src/RequestFilter.ts +0 -224
  186. package/src/ScriptEngine.ts +0 -219
  187. package/src/ScriptValidator.ts +0 -428
  188. package/src/TaskGraph.ts +0 -598
  189. package/src/TestCounter.ts +0 -109
  190. package/src/VariableResolver.ts +0 -114
  191. package/src/cli/index.ts +0 -480
  192. package/src/cli/plugin-commands.ts +0 -341
  193. package/src/cli/plugin-discovery.ts +0 -44
  194. package/src/index.ts +0 -24
  195. package/src/utils.ts +0 -52
package/package.json CHANGED
@@ -1,50 +1,55 @@
1
- {
2
- "name": "@apiquest/fracture",
3
- "version": "1.0.2",
4
- "description": "Core collection runner engine for ApiQuest with integrated CLI",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "bin": {
9
- "apiquest": "bin/cli.js",
10
- "fracture": "bin/cli.js",
11
- "quest": "bin/cli.js"
12
- },
13
- "scripts": {
14
- "build": "tsc",
15
- "dev": "tsc --watch",
16
- "test": "vitest"
17
- },
18
- "keywords": [
19
- "api",
20
- "testing",
21
- "runner",
22
- "quest",
23
- "apiquest",
24
- "fracture",
25
- "cli"
26
- ],
27
- "author": "ApiQuest",
28
- "license": "AGPL-3.0-or-later",
29
- "dependencies": {
30
- "@apiquest/types": "workspace:*",
31
- "@types/graphlib": "^2.1.12",
32
- "@types/lodash": "^4.17.23",
33
- "acorn": "^8.11.0",
34
- "acorn-walk": "^8.3.0",
35
- "chai": "^6.2.2",
36
- "commander": "^11.1.0",
37
- "got": "^14.6.6",
38
- "graphlib": "^2.1.8",
39
- "lodash": "^4.17.23",
40
- "moment": "^2.30.1",
41
- "tough-cookie": "^6.0.0"
42
- },
43
- "devDependencies": {
44
- "@types/acorn": "^4.0.6",
45
- "@types/chai": "^5.2.3",
46
- "@types/node": "^25.1.0",
47
- "typescript": "^5.3.3",
48
- "vitest": "^4.0.18"
49
- }
50
- }
1
+ {
2
+ "name": "@apiquest/fracture",
3
+ "version": "1.0.5",
4
+ "description": "Core collection runner engine for ApiQuest with integrated CLI",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "bin": {
9
+ "apiquest": "bin/cli.js",
10
+ "fracture": "bin/cli.js",
11
+ "quest": "bin/cli.js"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/hh-apiquest/fracture.git",
16
+ "directory": "packages/fracture"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "dev": "tsc --watch",
21
+ "test": "vitest"
22
+ },
23
+ "keywords": [
24
+ "api",
25
+ "testing",
26
+ "runner",
27
+ "quest",
28
+ "apiquest",
29
+ "fracture",
30
+ "cli"
31
+ ],
32
+ "author": "ApiQuest",
33
+ "license": "AGPL-3.0-or-later",
34
+ "dependencies": {
35
+ "@apiquest/types": "workspace:*",
36
+ "@types/graphlib": "^2.1.12",
37
+ "@types/lodash": "^4.17.23",
38
+ "acorn": "^8.11.0",
39
+ "acorn-walk": "^8.3.0",
40
+ "chai": "^6.2.2",
41
+ "commander": "14.0.3",
42
+ "got": "^14.6.6",
43
+ "graphlib": "^2.1.8",
44
+ "lodash": "^4.17.23",
45
+ "moment": "^2.30.1",
46
+ "tough-cookie": "^6.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/acorn": "^4.0.6",
50
+ "@types/chai": "^5.2.3",
51
+ "@types/node": "^25.2.3",
52
+ "typescript": "^5.3.3",
53
+ "vitest": "^4.0.18"
54
+ }
55
+ }
package/tsconfig.json CHANGED
@@ -1,20 +1,20 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "Node16",
5
- "lib": ["ES2022"],
6
- "moduleResolution": "node16",
7
- "outDir": "./dist",
8
- "declaration": true,
9
- "declarationMap": true,
10
- "sourceMap": true,
11
- "strict": true,
12
- "esModuleInterop": true,
13
- "skipLibCheck": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "resolveJsonModule": true,
16
- "allowSyntheticDefaultImports": true
17
- },
18
- "include": ["src/**/*"],
19
- "exclude": ["node_modules", "dist", "tests"]
20
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "lib": ["ES2022"],
6
+ "moduleResolution": "node16",
7
+ "outDir": "./dist",
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "sourceMap": true,
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "allowSyntheticDefaultImports": true
17
+ },
18
+ "include": ["src/**/*"],
19
+ "exclude": ["node_modules", "dist", "tests"]
20
+ }
@@ -1,5 +1,5 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["tests/**/*"],
4
- "exclude": []
5
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["tests/**/*"],
4
+ "exclude": []
5
+ }
package/vitest.config.ts CHANGED
@@ -1,22 +1,22 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- environment: 'node',
7
- exclude: [
8
- '**/node_modules/**',
9
- '**/dist/**'
10
- ],
11
- coverage: {
12
- provider: 'v8',
13
- reporter: ['text', 'json', 'html'],
14
- exclude: [
15
- 'node_modules/',
16
- 'dist/',
17
- '**/*.d.ts',
18
- '**/*.config.*'
19
- ]
20
- }
21
- }
22
- });
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ exclude: [
8
+ '**/node_modules/**',
9
+ '**/dist/**'
10
+ ],
11
+ coverage: {
12
+ provider: 'v8',
13
+ reporter: ['text', 'json', 'html'],
14
+ exclude: [
15
+ 'node_modules/',
16
+ 'dist/',
17
+ '**/*.d.ts',
18
+ '**/*.config.*'
19
+ ]
20
+ }
21
+ }
22
+ });
@@ -1,77 +0,0 @@
1
- import type { Collection, Folder, Request, IterationData, ILogger, PathType, NodeType, Auth } from '@apiquest/types';
2
- /**
3
- * Represents a node in the collection tree
4
- * - Tree structure: parent/children for hierarchical organization
5
- * - Graph structure: dependencies for execution order
6
- */
7
- export declare class ExecutionNode {
8
- id: string;
9
- name: string;
10
- type: NodeType;
11
- item: Collection | Folder | Request;
12
- parent: ExecutionNode | null;
13
- children: ExecutionNode[];
14
- depth: number;
15
- path: PathType;
16
- /**
17
- * Scripts inherited from parent chain
18
- * Accumulated during tree construction for efficient execution
19
- */
20
- inheritedScripts: {
21
- collectionPre?: string;
22
- collectionPost?: string;
23
- folderPre?: string[];
24
- folderPost?: string[];
25
- preRequest?: string[];
26
- postRequest?: string[];
27
- };
28
- /**
29
- * Effective auth for this node (cascades from parents)
30
- * Request auth > Folder auth > Parent folder auth > Collection auth
31
- */
32
- effectiveAuth?: Auth;
33
- condition?: string;
34
- dependsOn: string[];
35
- constructor(type: NodeType, item: Collection | Folder | Request, parent: ExecutionNode | null);
36
- /**
37
- * Accumulate scripts from parent chain
38
- * All scripts stack (collected from parents during tree construction)
39
- */
40
- private inheritScripts;
41
- /**
42
- * Cascade auth from parent chain
43
- * Child auth overrides parent auth
44
- */
45
- private inheritAuth;
46
- addChild(child: ExecutionNode): void;
47
- }
48
- /**
49
- * Builds execution tree from collection JSON
50
- * Handles CLI --data override at construction time
51
- */
52
- export declare class TreeBuilder {
53
- private cliData;
54
- private logger;
55
- constructor(cliData?: IterationData[], logger?: ILogger);
56
- build(collection: Collection): ExecutionNode;
57
- private buildChildren;
58
- private countNodes;
59
- }
60
- /**
61
- * Dependency graph for request execution order
62
- * Flattens tree to request nodes only, topologically sorted by dependencies
63
- */
64
- export declare class DependencyGraph {
65
- private nodes;
66
- private edges;
67
- constructor(root: ExecutionNode, filterSet?: Set<string> | null);
68
- private buildGraph;
69
- /**
70
- * Topological sort: returns requests grouped by execution level
71
- * Requests in same level can execute in parallel
72
- */
73
- getExecutionLevels(): string[][];
74
- getNode(id: string): ExecutionNode | undefined;
75
- canRunInParallel(idA: string, idB: string): boolean;
76
- }
77
- //# sourceMappingURL=ExecutionTree.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExecutionTree.d.ts","sourceRoot":"","sources":["../src/ExecutionTree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAkB,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKrI;;;;GAIG;AACH,qBAAa,aAAa;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;IAEpC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;IAEf;;;OAGG;IACH,gBAAgB,EAAE;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IAEF;;;OAGG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC;IAGrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;gBAGlB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,EACnC,MAAM,EAAE,aAAa,GAAG,IAAI;IA6C9B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAuDtB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAoBnB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;CAGrC;AAED;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,CAAC,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO;IAKvD,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa;IAe5C,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,UAAU;CAOnB;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,KAAK,CAA2B;gBAE5B,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI;IAM/D,OAAO,CAAC,UAAU;IAkBlB;;;OAGG;IACH,kBAAkB,IAAI,MAAM,EAAE,EAAE;IAoChC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI9C,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO;CAMpD"}
@@ -1,265 +0,0 @@
1
- // Execution Tree & Dependency Graph
2
- // Separates collection structure (tree) from execution order (graph)
3
- import { LogLevel } from '@apiquest/types';
4
- import { Logger } from './Logger.js';
5
- import { isNullOrEmpty, isValidAuth } from './utils.js';
6
- /**
7
- * Represents a node in the collection tree
8
- * - Tree structure: parent/children for hierarchical organization
9
- * - Graph structure: dependencies for execution order
10
- */
11
- export class ExecutionNode {
12
- id;
13
- name;
14
- type;
15
- item;
16
- parent;
17
- children;
18
- depth;
19
- path;
20
- /**
21
- * Scripts inherited from parent chain
22
- * Accumulated during tree construction for efficient execution
23
- */
24
- inheritedScripts;
25
- /**
26
- * Effective auth for this node (cascades from parents)
27
- * Request auth > Folder auth > Parent folder auth > Collection auth
28
- */
29
- effectiveAuth;
30
- // Execution control (requests only)
31
- condition;
32
- dependsOn;
33
- constructor(type, item, parent) {
34
- this.type = type;
35
- this.item = item;
36
- this.parent = parent;
37
- this.children = [];
38
- this.depth = parent !== null ? parent.depth + 1 : 0;
39
- this.dependsOn = [];
40
- this.inheritedScripts = {};
41
- // Set ID and name
42
- if (type === 'collection') {
43
- this.id = item.info.id;
44
- this.name = item.info.name;
45
- }
46
- else {
47
- this.id = item.id;
48
- this.name = item.name;
49
- }
50
- // Build path using PathType format
51
- if (type === 'collection') {
52
- this.path = 'collection:/';
53
- }
54
- else if (parent?.type === 'collection') {
55
- // Direct child of collection
56
- this.path = `${type}:/${this.name}`;
57
- }
58
- else if (parent !== null) {
59
- // Nested within folders
60
- const basePath = parent.path.replace(/^(folder|request):\//, '');
61
- this.path = `${type}:/${basePath}/${this.name}`;
62
- }
63
- else {
64
- // Fallback (shouldn't happen)
65
- this.path = 'collection:/';
66
- }
67
- // Extract condition and dependencies (for requests)
68
- if (type === 'request') {
69
- const req = item;
70
- this.condition = req.condition;
71
- this.dependsOn = req.dependsOn ?? [];
72
- }
73
- this.inheritScripts();
74
- this.inheritAuth();
75
- }
76
- /**
77
- * Accumulate scripts from parent chain
78
- * All scripts stack (collected from parents during tree construction)
79
- */
80
- inheritScripts() {
81
- if (this.parent === null)
82
- return;
83
- this.inheritedScripts = {
84
- collectionPre: this.parent.inheritedScripts.collectionPre,
85
- collectionPost: this.parent.inheritedScripts.collectionPost,
86
- folderPre: this.parent.inheritedScripts.folderPre !== undefined ? [...this.parent.inheritedScripts.folderPre] : undefined,
87
- folderPost: this.parent.inheritedScripts.folderPost !== undefined ? [...this.parent.inheritedScripts.folderPost] : undefined,
88
- preRequest: this.parent.inheritedScripts.preRequest !== undefined ? [...this.parent.inheritedScripts.preRequest] : undefined,
89
- postRequest: this.parent.inheritedScripts.postRequest !== undefined ? [...this.parent.inheritedScripts.postRequest] : undefined
90
- };
91
- const parentItem = this.parent.item;
92
- if (this.parent.type === 'collection') {
93
- const coll = parentItem;
94
- if (!isNullOrEmpty(coll.collectionPreScript)) {
95
- this.inheritedScripts.collectionPre = coll.collectionPreScript;
96
- }
97
- if (!isNullOrEmpty(coll.collectionPostScript)) {
98
- this.inheritedScripts.collectionPost = coll.collectionPostScript;
99
- }
100
- if (!isNullOrEmpty(coll.preRequestScript)) {
101
- this.inheritedScripts.preRequest = this.inheritedScripts.preRequest ?? [];
102
- this.inheritedScripts.preRequest.push(coll.preRequestScript);
103
- }
104
- if (!isNullOrEmpty(coll.postRequestScript)) {
105
- this.inheritedScripts.postRequest = this.inheritedScripts.postRequest ?? [];
106
- this.inheritedScripts.postRequest.unshift(coll.postRequestScript);
107
- }
108
- }
109
- if (this.parent.type === 'folder') {
110
- const folder = parentItem;
111
- if (!isNullOrEmpty(folder.folderPreScript)) {
112
- this.inheritedScripts.folderPre = this.inheritedScripts.folderPre ?? [];
113
- this.inheritedScripts.folderPre.push(folder.folderPreScript);
114
- }
115
- if (!isNullOrEmpty(folder.folderPostScript)) {
116
- this.inheritedScripts.folderPost = this.inheritedScripts.folderPost ?? [];
117
- this.inheritedScripts.folderPost.unshift(folder.folderPostScript);
118
- }
119
- if (!isNullOrEmpty(folder.preRequestScript)) {
120
- this.inheritedScripts.preRequest = this.inheritedScripts.preRequest ?? [];
121
- this.inheritedScripts.preRequest.push(folder.preRequestScript);
122
- }
123
- if (!isNullOrEmpty(folder.postRequestScript)) {
124
- this.inheritedScripts.postRequest = this.inheritedScripts.postRequest ?? [];
125
- this.inheritedScripts.postRequest.unshift(folder.postRequestScript);
126
- }
127
- }
128
- }
129
- /**
130
- * Cascade auth from parent chain
131
- * Child auth overrides parent auth
132
- */
133
- inheritAuth() {
134
- // Start with parent's effective auth
135
- if (this.parent?.effectiveAuth !== undefined) {
136
- this.effectiveAuth = this.parent.effectiveAuth;
137
- }
138
- // Override with this node's own auth if it has one
139
- if (this.type === 'collection') {
140
- const coll = this.item;
141
- if (isValidAuth(coll.auth)) {
142
- this.effectiveAuth = coll.auth;
143
- }
144
- }
145
- else {
146
- const folderOrRequest = this.item;
147
- if (isValidAuth(folderOrRequest.auth)) {
148
- this.effectiveAuth = folderOrRequest.auth;
149
- }
150
- }
151
- }
152
- addChild(child) {
153
- this.children.push(child);
154
- }
155
- }
156
- /**
157
- * Builds execution tree from collection JSON
158
- * Handles CLI --data override at construction time
159
- */
160
- export class TreeBuilder {
161
- cliData;
162
- logger;
163
- constructor(cliData, logger) {
164
- this.cliData = cliData;
165
- this.logger = logger instanceof Logger ? logger : new Logger('TreeBuilder', LogLevel.INFO);
166
- }
167
- build(collection) {
168
- this.logger.debug(`Building execution tree for collection: ${collection.info.name}`);
169
- if (this.cliData !== undefined && this.cliData.length > 0) {
170
- this.logger.debug(`Overriding collection testData with CLI data (${this.cliData.length} iterations)`);
171
- collection = { ...collection, testData: this.cliData };
172
- }
173
- const root = new ExecutionNode('collection', collection, null);
174
- this.buildChildren(root, collection.items);
175
- this.logger.debug(`Execution tree built: ${this.countNodes(root)} total nodes`);
176
- return root;
177
- }
178
- buildChildren(parent, items) {
179
- for (const item of items) {
180
- const node = new ExecutionNode(item.type, item, parent);
181
- parent.addChild(node);
182
- this.logger.trace(`Added ${item.type} node: ${node.path}`);
183
- if (item.type === 'folder') {
184
- this.buildChildren(node, item.items);
185
- }
186
- }
187
- }
188
- countNodes(node) {
189
- let count = 1;
190
- for (const child of node.children) {
191
- count += this.countNodes(child);
192
- }
193
- return count;
194
- }
195
- }
196
- /**
197
- * Dependency graph for request execution order
198
- * Flattens tree to request nodes only, topologically sorted by dependencies
199
- */
200
- export class DependencyGraph {
201
- nodes;
202
- edges;
203
- constructor(root, filterSet) {
204
- this.nodes = new Map();
205
- this.edges = new Map();
206
- this.buildGraph(root, filterSet);
207
- }
208
- buildGraph(node, filterSet) {
209
- if (node.type === 'request') {
210
- // Include request if no filter or if in filter set
211
- if (filterSet === null || filterSet === undefined || filterSet.has(node.id)) {
212
- this.nodes.set(node.id, node);
213
- // Filter dependencies to only include those in the graph
214
- const filteredDeps = filterSet === null || filterSet === undefined
215
- ? node.dependsOn
216
- : node.dependsOn.filter(depId => filterSet.has(depId));
217
- this.edges.set(node.id, new Set(filteredDeps));
218
- }
219
- }
220
- for (const child of node.children) {
221
- this.buildGraph(child, filterSet);
222
- }
223
- }
224
- /**
225
- * Topological sort: returns requests grouped by execution level
226
- * Requests in same level can execute in parallel
227
- */
228
- getExecutionLevels() {
229
- const levels = [];
230
- const remaining = new Set(this.nodes.keys());
231
- const completed = new Set();
232
- while (remaining.size > 0) {
233
- const level = [];
234
- for (const nodeId of remaining) {
235
- const deps = this.edges.get(nodeId);
236
- if (deps === undefined)
237
- continue;
238
- const allDepsCompleted = Array.from(deps).every(dep => completed.has(dep));
239
- if (allDepsCompleted) {
240
- level.push(nodeId);
241
- }
242
- }
243
- if (level.length === 0 && remaining.size > 0) {
244
- throw new Error('Circular dependency detected');
245
- }
246
- for (const nodeId of level) {
247
- remaining.delete(nodeId);
248
- completed.add(nodeId);
249
- }
250
- if (level.length > 0) {
251
- levels.push(level);
252
- }
253
- }
254
- return levels;
255
- }
256
- getNode(id) {
257
- return this.nodes.get(id);
258
- }
259
- canRunInParallel(idA, idB) {
260
- const depsA = this.edges.get(idA);
261
- const depsB = this.edges.get(idB);
262
- return (depsA?.has(idB) ?? false) === false && (depsB?.has(idA) ?? false) === false;
263
- }
264
- }
265
- //# sourceMappingURL=ExecutionTree.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExecutionTree.js","sourceRoot":"","sources":["../src/ExecutionTree.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,qEAAqE;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A8B,CAAC,CAAC;YAClD,CAAC;YAED,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE,CAAC;gBAC3B,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBACzB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxB,CAAC;YAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,gBAAgB,CAAC,GAAW,EAAE,GAAW;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAElC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,CAAC;IACtF,CAAC;CACF"}
@@ -1,17 +0,0 @@
1
- import type { Collection } from '@apiquest/types';
2
- export interface PluginRequirements {
3
- protocols: Set<string>;
4
- authTypes: Set<string>;
5
- valueProviders: Set<string>;
6
- }
7
- export declare class CollectionAnalyzer {
8
- /**
9
- * Analyze a collection to determine which plugins are needed
10
- * Per schema: protocol is collection-level, auth can be at any level, variables can have providers
11
- */
12
- analyzeRequirements(collection: Collection): PluginRequirements;
13
- private scanItems;
14
- private scanAuth;
15
- private scanVariables;
16
- }
17
- //# sourceMappingURL=CollectionAnalyzer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CollectionAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/CollectionAnalyzer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAA2C,MAAM,iBAAiB,CAAC;AAG3F,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,qBAAa,kBAAkB;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,kBAAkB;IA4B/D,OAAO,CAAC,SAAS;IAqBjB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,aAAa;CActB"}
@@ -1,70 +0,0 @@
1
- // Collection Analyzer - Scans collection to determine required plugins
2
- // Extracted to improve code organization and enable selective plugin loading
3
- import { isNullOrEmpty, hasItems, isValidAuth, isValidAuthType } from './utils.js';
4
- export class CollectionAnalyzer {
5
- /**
6
- * Analyze a collection to determine which plugins are needed
7
- * Per schema: protocol is collection-level, auth can be at any level, variables can have providers
8
- */
9
- analyzeRequirements(collection) {
10
- const requirements = {
11
- protocols: new Set(),
12
- authTypes: new Set(),
13
- valueProviders: new Set()
14
- };
15
- // Protocol is at collection level (schema line 16-18)
16
- if (!isNullOrEmpty(collection.protocol)) {
17
- requirements.protocols.add(collection.protocol);
18
- }
19
- // Scan collection-level auth
20
- if (isValidAuth(collection.auth)) {
21
- this.scanAuth(collection.auth, requirements);
22
- }
23
- // Scan all items for folder/request-level auth
24
- if (hasItems(collection.items)) {
25
- this.scanItems(collection.items, requirements);
26
- }
27
- // Scan variables for provider field (schema line 123-126)
28
- this.scanVariables(collection, requirements);
29
- return requirements;
30
- }
31
- scanItems(items, requirements) {
32
- for (const item of items) {
33
- if (item.type === 'folder' && hasItems(item.items)) {
34
- // Scan folder-level auth
35
- if (isValidAuth(item.auth)) {
36
- this.scanAuth(item.auth, requirements);
37
- }
38
- // Recursively scan folder items
39
- this.scanItems(item.items, requirements);
40
- }
41
- else if (item.type === 'request') {
42
- const request = item;
43
- // Scan request-level auth
44
- if (isValidAuth(request.auth)) {
45
- this.scanAuth(request.auth, requirements);
46
- }
47
- }
48
- }
49
- }
50
- scanAuth(auth, requirements) {
51
- // Skip 'none' and 'inherit' - they're not plugin types
52
- if (isValidAuthType(auth.type)) {
53
- requirements.authTypes.add(auth.type);
54
- }
55
- }
56
- scanVariables(collection, requirements) {
57
- // Scan collection variables for provider field (variable objects, not just strings)
58
- const variables = collection.variables ?? {};
59
- for (const value of Object.values(variables)) {
60
- // Variables can be strings OR variable objects with provider field
61
- if (typeof value === 'object' && value !== null) {
62
- const varObj = value;
63
- if (varObj.provider !== null && varObj.provider !== undefined && varObj.provider !== '') {
64
- requirements.valueProviders.add(varObj.provider);
65
- }
66
- }
67
- }
68
- }
69
- }
70
- //# sourceMappingURL=CollectionAnalyzer.js.map