neuron-inspector 0.7.1 → 0.8.0

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 (99) hide show
  1. package/dist/compound-tools.js +2 -136
  2. package/dist/compound-tools.js.map +1 -1
  3. package/dist/monitor.js +208 -7
  4. package/dist/monitor.js.map +1 -1
  5. package/dist/recipe-tools.js +6 -39
  6. package/dist/recipe-tools.js.map +1 -1
  7. package/dist/recipes.d.ts +0 -4
  8. package/dist/recipes.js +3 -49
  9. package/dist/recipes.js.map +1 -1
  10. package/dist/server.js +53 -175
  11. package/dist/server.js.map +1 -1
  12. package/dist/tools.js +0 -26
  13. package/dist/tools.js.map +1 -1
  14. package/package.json +3 -4
  15. package/recipes/linkedin-outreach/learnings.md +1 -17
  16. package/recipes/planner/agent.md +1 -66
  17. package/recipes/planner/learnings.md +1 -49
  18. package/recipes/social-ops/learnings.md +13 -33
  19. package/dist/__tests__/monitor.test.d.ts +0 -1
  20. package/dist/__tests__/monitor.test.js +0 -286
  21. package/dist/__tests__/monitor.test.js.map +0 -1
  22. package/dist/__tests__/recipes.test.d.ts +0 -1
  23. package/dist/__tests__/recipes.test.js +0 -415
  24. package/dist/__tests__/recipes.test.js.map +0 -1
  25. package/dist/__tests__/scheduler.test.d.ts +0 -1
  26. package/dist/__tests__/scheduler.test.js +0 -316
  27. package/dist/__tests__/scheduler.test.js.map +0 -1
  28. package/dist/__tests__/session-state.test.d.ts +0 -1
  29. package/dist/__tests__/session-state.test.js +0 -335
  30. package/dist/__tests__/session-state.test.js.map +0 -1
  31. package/dist/collections/__tests__/assertions.test.d.ts +0 -1
  32. package/dist/collections/__tests__/assertions.test.js +0 -203
  33. package/dist/collections/__tests__/assertions.test.js.map +0 -1
  34. package/dist/collections/__tests__/dynamic-vars.test.d.ts +0 -1
  35. package/dist/collections/__tests__/dynamic-vars.test.js +0 -169
  36. package/dist/collections/__tests__/dynamic-vars.test.js.map +0 -1
  37. package/dist/collections/__tests__/execution.test.d.ts +0 -1
  38. package/dist/collections/__tests__/execution.test.js +0 -271
  39. package/dist/collections/__tests__/execution.test.js.map +0 -1
  40. package/dist/collections/__tests__/integration.test.d.ts +0 -1
  41. package/dist/collections/__tests__/integration.test.js +0 -478
  42. package/dist/collections/__tests__/integration.test.js.map +0 -1
  43. package/dist/collections/__tests__/resolver.test.d.ts +0 -1
  44. package/dist/collections/__tests__/resolver.test.js +0 -282
  45. package/dist/collections/__tests__/resolver.test.js.map +0 -1
  46. package/dist/collections/__tests__/scenario.test.d.ts +0 -1
  47. package/dist/collections/__tests__/scenario.test.js +0 -367
  48. package/dist/collections/__tests__/scenario.test.js.map +0 -1
  49. package/dist/collections/__tests__/scripts.test.d.ts +0 -1
  50. package/dist/collections/__tests__/scripts.test.js +0 -245
  51. package/dist/collections/__tests__/scripts.test.js.map +0 -1
  52. package/dist/collections/__tests__/store.test.d.ts +0 -1
  53. package/dist/collections/__tests__/store.test.js +0 -313
  54. package/dist/collections/__tests__/store.test.js.map +0 -1
  55. package/dist/collections/assertions.d.ts +0 -16
  56. package/dist/collections/assertions.js +0 -107
  57. package/dist/collections/assertions.js.map +0 -1
  58. package/dist/collections/dynamic-vars.d.ts +0 -75
  59. package/dist/collections/dynamic-vars.js +0 -187
  60. package/dist/collections/dynamic-vars.js.map +0 -1
  61. package/dist/collections/executor.d.ts +0 -100
  62. package/dist/collections/executor.js +0 -301
  63. package/dist/collections/executor.js.map +0 -1
  64. package/dist/collections/http.d.ts +0 -9
  65. package/dist/collections/http.js +0 -194
  66. package/dist/collections/http.js.map +0 -1
  67. package/dist/collections/index.d.ts +0 -12
  68. package/dist/collections/index.js +0 -27
  69. package/dist/collections/index.js.map +0 -1
  70. package/dist/collections/postman.d.ts +0 -10
  71. package/dist/collections/postman.js +0 -288
  72. package/dist/collections/postman.js.map +0 -1
  73. package/dist/collections/resolver.d.ts +0 -74
  74. package/dist/collections/resolver.js +0 -330
  75. package/dist/collections/resolver.js.map +0 -1
  76. package/dist/collections/scripts.d.ts +0 -20
  77. package/dist/collections/scripts.js +0 -225
  78. package/dist/collections/scripts.js.map +0 -1
  79. package/dist/collections/store.d.ts +0 -68
  80. package/dist/collections/store.js +0 -507
  81. package/dist/collections/store.js.map +0 -1
  82. package/dist/collections/tools.d.ts +0 -8
  83. package/dist/collections/tools.js +0 -1276
  84. package/dist/collections/tools.js.map +0 -1
  85. package/dist/collections/types.d.ts +0 -226
  86. package/dist/collections/types.js +0 -3
  87. package/dist/collections/types.js.map +0 -1
  88. package/dist/killswitch.d.ts +0 -8
  89. package/dist/killswitch.js +0 -304
  90. package/dist/killswitch.js.map +0 -1
  91. package/dist/resilience.d.ts +0 -112
  92. package/dist/resilience.js +0 -319
  93. package/dist/resilience.js.map +0 -1
  94. package/recipes/autopilot/agent.md +0 -316
  95. package/recipes/autopilot/learnings.md +0 -33
  96. package/recipes/autopilot/recipe.yaml +0 -96
  97. package/recipes/inbox-responder/agent.md +0 -268
  98. package/recipes/inbox-responder/learnings.md +0 -25
  99. package/recipes/inbox-responder/recipe.yaml +0 -82
@@ -1,301 +0,0 @@
1
- import { buildResolvedRequest, checkUnresolved } from "./resolver.js";
2
- import { dotGet } from "./assertions.js";
3
- // ── Single endpoint execution ───────────────────────────────────
4
- export async function executeEndpoint(opts) {
5
- let { collection, environment, folder, endpoint, httpExecutor, pipeline, assertionEvaluator, scriptRunner, extracted } = opts;
6
- let scriptVars = {};
7
- let preScriptLogs;
8
- // Run pre-request script
9
- if (scriptRunner && endpoint.pre_request) {
10
- const preResult = scriptRunner.runPreRequest(endpoint.pre_request, {
11
- variables: { ...(extracted ?? {}) },
12
- request: {
13
- method: endpoint.method,
14
- path: endpoint.path,
15
- headers: { ...(endpoint.headers ?? {}) },
16
- body: endpoint.body,
17
- cookies: { ...(endpoint.cookies ?? {}) },
18
- },
19
- environment: {
20
- name: collection.active_environment ?? "",
21
- base_url: environment.base_url,
22
- variables: environment.variables,
23
- },
24
- });
25
- scriptVars = preResult.variables;
26
- if (preResult.logs?.length)
27
- preScriptLogs = preResult.logs;
28
- // Apply mutations from pre-request script to the endpoint
29
- if (preResult.mutations) {
30
- const m = preResult.mutations;
31
- if (m.method)
32
- endpoint = { ...endpoint, method: m.method };
33
- if (m.path)
34
- endpoint = { ...endpoint, path: m.path };
35
- if (m.headers)
36
- endpoint = { ...endpoint, headers: { ...(endpoint.headers ?? {}), ...m.headers } };
37
- if (m.body !== undefined)
38
- endpoint = { ...endpoint, body: m.body };
39
- if (m.cookies)
40
- endpoint = { ...endpoint, cookies: { ...(endpoint.cookies ?? {}), ...m.cookies } };
41
- }
42
- }
43
- // Build resolved request (includes script-set vars)
44
- const resolved = buildResolvedRequest({
45
- collection,
46
- environment,
47
- folder,
48
- endpoint,
49
- pipeline,
50
- extracted,
51
- scriptVars,
52
- });
53
- // Check for unresolved variables (skip $-prefixed dynamic vars that returned placeholder text)
54
- const unresolved = checkUnresolved(resolved);
55
- if (unresolved.length > 0) {
56
- return {
57
- endpoint: { method: endpoint.method, path: endpoint.path, name: endpoint.name },
58
- request: { url: resolved.url, method: resolved.method },
59
- response: { status: 0, statusText: "error", headers: {}, body: null, timing: { total_ms: 0, ttfb_ms: 0 } },
60
- error: `Unresolved variables: ${unresolved.join(", ")}`,
61
- };
62
- }
63
- // Execute HTTP request
64
- const response = await httpExecutor.execute(resolved);
65
- // Parse body
66
- let parsedBody = response.body;
67
- if (response.body) {
68
- try {
69
- parsedBody = JSON.parse(response.body);
70
- }
71
- catch {
72
- // Keep as string
73
- }
74
- }
75
- const target = {
76
- status: response.status,
77
- headers: response.headers,
78
- body: parsedBody,
79
- timing: response.timing,
80
- };
81
- // Run post-response script
82
- let postScriptTests;
83
- let postScriptLogs;
84
- if (scriptRunner && endpoint.post_response) {
85
- const postResult = scriptRunner.runPostResponse(endpoint.post_response, target, {
86
- variables: { ...(extracted ?? {}), ...scriptVars },
87
- request: {
88
- method: endpoint.method,
89
- path: endpoint.path,
90
- headers: { ...(endpoint.headers ?? {}) },
91
- body: endpoint.body,
92
- cookies: { ...(endpoint.cookies ?? {}) },
93
- },
94
- environment: {
95
- name: collection.active_environment ?? "",
96
- base_url: environment.base_url,
97
- variables: environment.variables,
98
- },
99
- });
100
- Object.assign(scriptVars, postResult.variables);
101
- if (postResult.tests?.length)
102
- postScriptTests = postResult.tests;
103
- if (postResult.logs?.length)
104
- postScriptLogs = postResult.logs;
105
- }
106
- // Run assertions
107
- let assertions;
108
- if (endpoint.tests?.length) {
109
- assertions = endpoint.tests.map((t) => assertionEvaluator.evaluate(t, target));
110
- }
111
- // Extract variables
112
- let extractedVars;
113
- if (endpoint.extract) {
114
- extractedVars = {};
115
- for (const [varName, path] of Object.entries(endpoint.extract)) {
116
- const value = dotGet(parsedBody, path.replace(/^body\./, ""));
117
- if (value !== undefined && value !== null) {
118
- extractedVars[varName] = String(value);
119
- }
120
- }
121
- }
122
- // Merge script logs
123
- const allLogs = [...(preScriptLogs ?? []), ...(postScriptLogs ?? [])];
124
- return {
125
- endpoint: { method: endpoint.method, path: endpoint.path, name: endpoint.name },
126
- request: { url: resolved.url, method: resolved.method },
127
- response: {
128
- status: response.status,
129
- statusText: response.statusText,
130
- headers: response.headers,
131
- body: parsedBody,
132
- timing: response.timing,
133
- },
134
- assertions,
135
- extracted: {
136
- ...(extractedVars ?? {}),
137
- ...(Object.keys(scriptVars).length > 0 ? scriptVars : {}),
138
- },
139
- scriptTests: postScriptTests,
140
- scriptLogs: allLogs.length ? allLogs : undefined,
141
- error: response.status === 0 ? response.statusText : undefined,
142
- };
143
- }
144
- // ── Folder execution ────────────────────────────────────────────
145
- export async function executeFolder(opts) {
146
- const { folderKey, collection, environment, folder, httpExecutor, pipeline, assertionEvaluator, scriptRunner } = opts;
147
- const extracted = { ...(opts.extracted ?? {}) };
148
- const results = [];
149
- let passed = 0;
150
- let failed = 0;
151
- let errors = 0;
152
- for (const endpoint of folder.endpoints ?? []) {
153
- const result = await executeEndpoint({
154
- collection,
155
- environment,
156
- folder,
157
- endpoint,
158
- httpExecutor,
159
- pipeline,
160
- assertionEvaluator,
161
- scriptRunner,
162
- extracted,
163
- });
164
- // Accumulate extracted variables for subsequent endpoints
165
- if (result.extracted) {
166
- Object.assign(extracted, result.extracted);
167
- }
168
- // Count results
169
- if (result.error) {
170
- errors++;
171
- }
172
- else if (result.assertions?.some((a) => !a.passed)) {
173
- failed++;
174
- }
175
- else {
176
- passed++;
177
- }
178
- results.push(result);
179
- // Folder execution continues on failure (unlike scenarios)
180
- }
181
- return { folder: folderKey, results, passed, failed, errors };
182
- }
183
- // ── Collection execution ────────────────────────────────────────
184
- export async function executeCollection(opts) {
185
- const { collectionId, collection, environment, httpExecutor, pipeline, assertionEvaluator, scriptRunner } = opts;
186
- const folders = [];
187
- let totalPassed = 0;
188
- let totalFailed = 0;
189
- let totalErrors = 0;
190
- for (const [folderKey, folder] of Object.entries(collection.folders ?? {})) {
191
- const result = await executeFolder({
192
- folderKey,
193
- collection,
194
- environment,
195
- folder,
196
- httpExecutor,
197
- pipeline,
198
- assertionEvaluator,
199
- scriptRunner,
200
- });
201
- folders.push(result);
202
- totalPassed += result.passed;
203
- totalFailed += result.failed;
204
- totalErrors += result.errors;
205
- }
206
- return {
207
- collection: collectionId,
208
- environment: collection.active_environment ?? "unknown",
209
- folders,
210
- total_passed: totalPassed,
211
- total_failed: totalFailed,
212
- total_errors: totalErrors,
213
- };
214
- }
215
- // ── Scenario execution ──────────────────────────────────────────
216
- function resolveStepRef(collection, ref) {
217
- // ref format: "folder/endpoint-name"
218
- const slashIdx = ref.indexOf("/");
219
- if (slashIdx < 0)
220
- return null;
221
- const folderKey = ref.slice(0, slashIdx);
222
- const endpointName = ref.slice(slashIdx + 1);
223
- const folder = collection.folders?.[folderKey];
224
- if (!folder)
225
- return null;
226
- const endpoint = folder.endpoints?.find((ep) => ep.name === endpointName);
227
- if (!endpoint)
228
- return null;
229
- return { folderKey, folder, endpoint };
230
- }
231
- export async function executeScenario(opts) {
232
- const { scenarioKey, steps, collectionId, collection, environment, httpExecutor, pipeline, assertionEvaluator, scriptRunner } = opts;
233
- const extracted = {};
234
- const results = [];
235
- let halted = false;
236
- let haltedAt;
237
- for (let i = 0; i < steps.length; i++) {
238
- const step = steps[i];
239
- const resolved = resolveStepRef(collection, step.ref);
240
- if (!resolved) {
241
- results.push({
242
- step: i,
243
- ref: step.ref,
244
- endpoint: { method: "?", path: "?", name: step.ref },
245
- request: { url: "", method: "" },
246
- response: { status: 0, statusText: "error", headers: {}, body: null, timing: { total_ms: 0, ttfb_ms: 0 } },
247
- error: `Could not resolve step ref '${step.ref}'`,
248
- });
249
- halted = true;
250
- haltedAt = i;
251
- break;
252
- }
253
- // Apply step overrides
254
- let endpoint = { ...resolved.endpoint };
255
- if (step.overrides) {
256
- if (step.overrides.path)
257
- endpoint.path = step.overrides.path;
258
- if (step.overrides.headers)
259
- endpoint = { ...endpoint, headers: { ...endpoint.headers, ...step.overrides.headers } };
260
- if (step.overrides.body !== undefined)
261
- endpoint.body = step.overrides.body;
262
- if (step.overrides.tests)
263
- endpoint.tests = step.overrides.tests;
264
- if (step.overrides.variables)
265
- endpoint.variables = { ...endpoint.variables, ...step.overrides.variables };
266
- }
267
- const result = await executeEndpoint({
268
- collection,
269
- environment,
270
- folder: resolved.folder,
271
- endpoint,
272
- httpExecutor,
273
- scriptRunner,
274
- pipeline,
275
- assertionEvaluator,
276
- extracted,
277
- });
278
- // Accumulate extracted variables
279
- if (result.extracted) {
280
- Object.assign(extracted, result.extracted);
281
- }
282
- results.push({ ...result, step: i, ref: step.ref });
283
- // Check if this step failed (HTTP error or assertion failure)
284
- const stepFailed = result.error || result.assertions?.some((a) => !a.passed);
285
- if (stepFailed) {
286
- halted = true;
287
- haltedAt = i;
288
- break;
289
- }
290
- }
291
- return {
292
- scenario: scenarioKey,
293
- collection: collectionId,
294
- environment: collection.active_environment ?? "unknown",
295
- steps: results,
296
- passed: !halted,
297
- halted_at: haltedAt,
298
- extracted,
299
- };
300
- }
301
- //# sourceMappingURL=executor.js.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E,QAAQ;QACnB,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { HttpExecutor, ResolvedRequest, HttpResponse } from "./types.js";
2
- export declare class FetchHttpExecutor implements HttpExecutor {
3
- execute(request: ResolvedRequest): Promise<HttpResponse>;
4
- /**
5
- * Manual redirect loop that respects follow_original_method,
6
- * follow_authorization, and remove_referer settings.
7
- */
8
- private fetchWithManualRedirects;
9
- }
@@ -1,194 +0,0 @@
1
- const MAX_BODY_BYTES = 100 * 1024; // 100KB truncation limit
2
- const DEFAULT_MAX_REDIRECTS = 10;
3
- /** Status codes that trigger a redirect. */
4
- const REDIRECT_CODES = new Set([301, 302, 303, 307, 308]);
5
- /** Codes that preserve the original method by spec (307/308). 301/302/303 default to GET. */
6
- const METHOD_PRESERVING_CODES = new Set([307, 308]);
7
- export class FetchHttpExecutor {
8
- async execute(request) {
9
- const controller = new AbortController();
10
- const timer = setTimeout(() => controller.abort(), request.timeout_ms);
11
- const startTime = performance.now();
12
- let ttfbTime = 0;
13
- // Resolve settings with defaults
14
- const followRedirects = request.follow_redirects !== false;
15
- const maxRedirects = request.max_redirects ?? DEFAULT_MAX_REDIRECTS;
16
- const followOriginalMethod = request.follow_original_method === true;
17
- const followAuthorization = request.follow_authorization === true;
18
- const removeReferer = request.remove_referer === true;
19
- const encodeUrl = request.encode_url !== false; // default true
20
- // Optionally encode the URL
21
- let url = request.url;
22
- if (encodeUrl) {
23
- try {
24
- const parsed = new URL(url);
25
- // URL constructor auto-encodes; reconstruct to normalize
26
- url = parsed.href;
27
- }
28
- catch {
29
- // If URL parsing fails, leave as-is
30
- }
31
- }
32
- // Whether we need manual redirect handling
33
- const needsManualRedirects = followRedirects &&
34
- (followOriginalMethod || followAuthorization || removeReferer);
35
- // SSL verification — Node.js fetch uses a custom agent for this
36
- let agent;
37
- if (request.verify_ssl === false) {
38
- try {
39
- const https = await import("node:https");
40
- agent = new https.Agent({ rejectUnauthorized: false });
41
- }
42
- catch {
43
- // If https module isn't available, skip
44
- }
45
- }
46
- try {
47
- let res;
48
- if (needsManualRedirects) {
49
- res = await this.fetchWithManualRedirects({
50
- url,
51
- method: request.method,
52
- headers: { ...request.headers },
53
- body: request.body,
54
- signal: controller.signal,
55
- agent,
56
- maxRedirects,
57
- followOriginalMethod,
58
- followAuthorization,
59
- removeReferer,
60
- });
61
- }
62
- else {
63
- const fetchOpts = {
64
- method: request.method,
65
- headers: request.headers,
66
- body: request.body ?? undefined,
67
- signal: controller.signal,
68
- redirect: followRedirects ? "follow" : "manual",
69
- follow: maxRedirects,
70
- };
71
- if (agent)
72
- fetchOpts.agent = agent;
73
- res = await fetch(url, fetchOpts);
74
- }
75
- ttfbTime = performance.now() - startTime;
76
- // Read body with truncation
77
- let body = null;
78
- try {
79
- const raw = await res.text();
80
- if (raw.length > MAX_BODY_BYTES) {
81
- body = raw.slice(0, MAX_BODY_BYTES) + `\n...[truncated at ${MAX_BODY_BYTES} bytes]`;
82
- }
83
- else {
84
- body = raw;
85
- }
86
- }
87
- catch {
88
- body = null;
89
- }
90
- const totalTime = performance.now() - startTime;
91
- // Flatten response headers to Record<string, string>
92
- const headers = {};
93
- res.headers.forEach((value, key) => {
94
- headers[key.toLowerCase()] = value;
95
- });
96
- return {
97
- status: res.status,
98
- statusText: res.statusText,
99
- headers,
100
- body,
101
- timing: {
102
- total_ms: Math.round(totalTime),
103
- ttfb_ms: Math.round(ttfbTime),
104
- },
105
- };
106
- }
107
- catch (err) {
108
- const totalTime = performance.now() - startTime;
109
- clearTimeout(timer);
110
- if (err instanceof DOMException && err.name === "AbortError") {
111
- return {
112
- status: 0,
113
- statusText: "timeout",
114
- headers: {},
115
- body: null,
116
- timing: {
117
- total_ms: request.timeout_ms,
118
- ttfb_ms: 0,
119
- },
120
- };
121
- }
122
- // Connection refused, DNS failure, TLS errors, etc.
123
- const message = err instanceof Error ? err.message : String(err);
124
- return {
125
- status: 0,
126
- statusText: "error",
127
- headers: {},
128
- body: JSON.stringify({ error: message }),
129
- timing: {
130
- total_ms: Math.round(totalTime),
131
- ttfb_ms: 0,
132
- },
133
- };
134
- }
135
- finally {
136
- clearTimeout(timer);
137
- }
138
- }
139
- /**
140
- * Manual redirect loop that respects follow_original_method,
141
- * follow_authorization, and remove_referer settings.
142
- */
143
- async fetchWithManualRedirects(opts) {
144
- let { url, method, headers, body } = opts;
145
- const originalMethod = method;
146
- const originalHost = new URL(url).host;
147
- for (let i = 0; i <= opts.maxRedirects; i++) {
148
- const fetchOpts = {
149
- method,
150
- headers: { ...headers },
151
- body: method === "GET" || method === "HEAD" ? undefined : body,
152
- signal: opts.signal,
153
- redirect: "manual",
154
- };
155
- if (opts.agent)
156
- fetchOpts.agent = opts.agent;
157
- const res = await fetch(url, fetchOpts);
158
- if (!REDIRECT_CODES.has(res.status))
159
- return res;
160
- if (i === opts.maxRedirects)
161
- return res; // hit limit, return as-is
162
- const location = res.headers.get("location");
163
- if (!location)
164
- return res;
165
- // Resolve relative redirects
166
- url = new URL(location, url).href;
167
- const newHost = new URL(url).host;
168
- const crossHost = newHost !== originalHost;
169
- // Determine method for next request
170
- if (METHOD_PRESERVING_CODES.has(res.status)) {
171
- // 307/308 always preserve method
172
- }
173
- else if (opts.followOriginalMethod) {
174
- method = originalMethod;
175
- }
176
- else {
177
- method = "GET";
178
- body = undefined;
179
- }
180
- // Strip authorization on cross-host redirects unless told to keep it
181
- if (crossHost && !opts.followAuthorization) {
182
- delete headers["authorization"];
183
- delete headers["Authorization"];
184
- }
185
- // Remove referer header if configured
186
- if (opts.removeReferer) {
187
- delete headers["referer"];
188
- delete headers["Referer"];
189
- }
190
- }
191
- throw new Error(`Too many redirects (max ${opts.maxRedirects})`);
192
- }
193
- }
194
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/collections/http.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,yBAAyB;AAC5D,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AAG,SAAS,CAAC;YACnB,CAAC;YAED,qEAAqE;YACrE,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAC3C,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;gBAChC,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC;YAClC,CAAC;YAED,sCAAsC;YACtC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvB,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;gBAC1B,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IACnE,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- export type { CollectionToolDef } from "./tools.js";
2
- export declare const COLLECTION_TOOLS: import("./tools.js").CollectionToolDef[];
3
- export declare const handleCollectionTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
4
- export type { Collection, CollectionStore, CollectionSummary, Endpoint, Folder, Environment, Scenario, HttpExecutor, ResolverStep, ResolverContext, ResolvedRequest, HttpResponse, AssertionEvaluator, AssertionResult, AssertionTarget, DynamicVarProvider, ScriptRunner, } from "./types.js";
5
- export { YamlCollectionStore, slugify, generateEndpointName } from "./store.js";
6
- export { FetchHttpExecutor } from "./http.js";
7
- export { buildDefaultPipeline, buildResolvedRequest, resolveTemplate, checkUnresolved } from "./resolver.js";
8
- export { OperatorRegistry, dotGet, extractCheckValue } from "./assertions.js";
9
- export { buildDefaultRegistry, DynamicVarRegistry } from "./dynamic-vars.js";
10
- export { DeclarativeScriptRunner, JsScriptRunner } from "./scripts.js";
11
- export { executeEndpoint, executeFolder, executeCollection, executeScenario } from "./executor.js";
12
- export { fromPostmanV21, toPostmanV21 } from "./postman.js";
@@ -1,27 +0,0 @@
1
- import { YamlCollectionStore } from "./store.js";
2
- import { FetchHttpExecutor } from "./http.js";
3
- import { buildDefaultPipeline } from "./resolver.js";
4
- import { OperatorRegistry } from "./assertions.js";
5
- import { buildDefaultRegistry } from "./dynamic-vars.js";
6
- import { JsScriptRunner } from "./scripts.js";
7
- import { buildCollectionTools, buildCollectionHandler } from "./tools.js";
8
- // ── Composition root ────────────────────────────────────────────
9
- // All concrete implementations are wired here.
10
- // Nothing outside this file imports a concrete class directly.
11
- const store = new YamlCollectionStore();
12
- const httpExecutor = new FetchHttpExecutor();
13
- const dynamicVarRegistry = buildDefaultRegistry();
14
- const pipeline = buildDefaultPipeline(dynamicVarRegistry);
15
- const assertionEvaluator = new OperatorRegistry();
16
- const scriptRunner = new JsScriptRunner();
17
- export const COLLECTION_TOOLS = buildCollectionTools();
18
- export const handleCollectionTool = buildCollectionHandler(store, httpExecutor, pipeline, assertionEvaluator, scriptRunner);
19
- export { YamlCollectionStore, slugify, generateEndpointName } from "./store.js";
20
- export { FetchHttpExecutor } from "./http.js";
21
- export { buildDefaultPipeline, buildResolvedRequest, resolveTemplate, checkUnresolved } from "./resolver.js";
22
- export { OperatorRegistry, dotGet, extractCheckValue } from "./assertions.js";
23
- export { buildDefaultRegistry, DynamicVarRegistry } from "./dynamic-vars.js";
24
- export { DeclarativeScriptRunner, JsScriptRunner } from "./scripts.js";
25
- export { executeEndpoint, executeFolder, executeCollection, executeScenario } from "./executor.js";
26
- export { fromPostmanV21, toPostmanV21 } from "./postman.js";
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAA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+0,0 @@
1
- /**
2
- * Postman Collection v2.1 ↔ Neuron Collection converter.
3
- *
4
- * Two pure functions — no dependencies beyond the Collection types.
5
- */
6
- import type { Collection } from "./types.js";
7
- /** Parse a Postman v2.1 JSON object into a Neuron Collection. */
8
- export declare function fromPostmanV21(json: unknown): Collection;
9
- /** Convert a Neuron Collection to Postman v2.1 JSON. */
10
- export declare function toPostmanV21(collection: Collection, id: string): unknown;