firecrawl-cli 1.26.2 → 1.26.4

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.
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withoutToolPrice = withoutToolPrice;
4
+ exports.withoutResultPrices = withoutResultPrices;
5
+ const TOOL_PRICE_KEYS = [
6
+ 'creditsCost',
7
+ 'perRecord',
8
+ 'billing',
9
+ 'recordsPerUnit',
10
+ 'zeroDataRetentionCreditsCost',
11
+ ];
12
+ /** Drops per-capability price metadata from a discovered tool or an Alexandria result entry. */
13
+ function withoutToolPrice(tool) {
14
+ if (!tool || typeof tool !== 'object' || Array.isArray(tool))
15
+ return tool;
16
+ const copy = { ...tool };
17
+ for (const key of TOOL_PRICE_KEYS)
18
+ delete copy[key];
19
+ return copy;
20
+ }
21
+ function withoutPagePrices(page) {
22
+ if (!page || typeof page !== 'object')
23
+ return page;
24
+ return {
25
+ ...page,
26
+ ...(Array.isArray(page.items)
27
+ ? { items: page.items.map(withoutToolPrice) }
28
+ : {}),
29
+ ...(Array.isArray(page.relatedTools)
30
+ ? {
31
+ relatedTools: page.relatedTools.map((group) => Array.isArray(group?.tools)
32
+ ? {
33
+ ...group,
34
+ tools: group.tools.map((entry) => entry?.tool
35
+ ? { ...entry, tool: withoutToolPrice(entry.tool) }
36
+ : withoutToolPrice(entry)),
37
+ }
38
+ : group),
39
+ }
40
+ : {}),
41
+ };
42
+ }
43
+ /**
44
+ * Strips the per-capability cost from each Alexandria result entry and tool
45
+ * prices from Find Tools pages. A batch of only Find Tools calls (always free)
46
+ * also drops its zero total; other totals stay as the request's receipt.
47
+ */
48
+ function withoutResultPrices(envelope) {
49
+ const results = envelope?.data?.alexandria;
50
+ if (!Array.isArray(results))
51
+ return envelope;
52
+ const isFindTools = (entry) => entry?.provider === 'firecrawl' && entry?.capability === 'find-tools';
53
+ const data = {
54
+ ...envelope.data,
55
+ alexandria: results.map((entry) => isFindTools(entry)
56
+ ? { ...withoutToolPrice(entry), data: withoutPagePrices(entry.data) }
57
+ : withoutToolPrice(entry)),
58
+ };
59
+ if (results.length && results.every(isFindTools))
60
+ delete data.creditsCost;
61
+ return { ...envelope, data };
62
+ }
63
+ //# sourceMappingURL=alexandria-prices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alexandria-prices.js","sourceRoot":"","sources":["../../src/utils/alexandria-prices.ts"],"names":[],"mappings":";;AASA,4CAKC;AAiCD,kDAiBC;AAhED,MAAM,eAAe,GAAG;IACtB,aAAa;IACb,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,8BAA8B;CAC/B,CAAC;AAEF,gGAAgG;AAChG,SAAgB,gBAAgB,CAAI,IAAO;IACzC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1E,MAAM,IAAI,GAAG,EAAE,GAAI,IAAgC,EAAE,CAAC;IACtD,KAAK,MAAM,GAAG,IAAI,eAAe;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,OAAO,IAAS,CAAC;AACnB,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAS;IAClC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO;QACL,GAAG,IAAI;QACP,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC3B,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;YAC7C,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;YAClC,CAAC,CAAC;gBACE,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,GA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