@postman-enricher/core 1.2.2 → 1.2.3

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.
@@ -8,12 +8,29 @@ export function organizeByResources(collection, config) {
8
8
  }
9
9
  const excludePathParams = config.excludePathParams ?? true;
10
10
  const maxDepth = config.nestingLevel || Infinity;
11
- const organized = buildResourceHierarchy(collection.item, excludePathParams, maxDepth);
11
+ // First, flatten all requests from existing structure
12
+ const flatRequests = flattenRequests(collection.item);
13
+ const organized = buildResourceHierarchy(flatRequests, excludePathParams, maxDepth);
12
14
  return {
13
15
  ...collection,
14
16
  item: organized.length > 0 ? organized : collection.item,
15
17
  };
16
18
  }
19
+ /**
20
+ * Recursively flatten all requests from a potentially nested structure
21
+ */
22
+ function flattenRequests(items) {
23
+ const requests = [];
24
+ for (const item of items) {
25
+ if (isRequest(item)) {
26
+ requests.push(item);
27
+ }
28
+ else if (item.item) {
29
+ requests.push(...flattenRequests(item.item));
30
+ }
31
+ }
32
+ return requests;
33
+ }
17
34
  function buildResourceHierarchy(items, excludePathParams, maxDepth) {
18
35
  const folderMap = new Map();
19
36
  items.forEach((item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postman-enricher/core",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Core enrichment logic for Postman Enricher",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "openapi-to-postmanv2": "^5.5.0",
19
19
  "yaml": "^2.8.1",
20
- "@postman-enricher/shared": "1.2.2"
20
+ "@postman-enricher/shared": "1.2.3"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@anolilab/semantic-release-pnpm": "^3.0.0",