@caido-utils/backend 0.5.4 → 0.5.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.
@@ -4,6 +4,7 @@ export type QueryRequestsOptions = {
4
4
  filter?: string;
5
5
  pageSize?: number;
6
6
  excludeStaticAssets?: boolean;
7
+ deduplicate?: boolean;
7
8
  onPage?: (items: RequestsConnectionItem[]) => void;
8
9
  };
9
10
  /**
@@ -94,5 +94,13 @@ export async function queryRequests(sdk, options) {
94
94
  break;
95
95
  }
96
96
  }
97
+ if (options?.deduplicate) {
98
+ const seen = /* @__PURE__ */ new Map();
99
+ for (const item of results) {
100
+ const key = `${item.request.getMethod()}|${item.request.getHost()}|${item.request.getPath()}`;
101
+ seen.set(key, item);
102
+ }
103
+ return Array.from(seen.values());
104
+ }
97
105
  return results;
98
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caido-utils/backend",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"