boostedtravel 0.2.4 → 1.0.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.
package/README.md CHANGED
@@ -1,81 +1,30 @@
1
- # BoostedTravel Agent-Native Flight Search & Booking (Node.js)
1
+ # ⚠️ boostedtravel has been renamed to **letsfg**
2
2
 
3
- Search 400+ airlines at raw airline prices **$20-50 cheaper** than Booking.com, Kayak, and other OTAs. Zero dependencies. Built for autonomous AI agents.
3
+ This package is a redirect. All development has moved to [`letsfg`](https://www.npmjs.com/package/letsfg).
4
4
 
5
- ## Install
5
+ ## Migration
6
6
 
7
7
  ```bash
8
- npm install boostedtravel
8
+ npm install letsfg
9
9
  ```
10
10
 
11
- ## Quick Start (SDK)
11
+ The new package is a drop-in replacement:
12
12
 
13
- ```typescript
14
- import { BoostedTravel, cheapestOffer, offerSummary } from 'boostedtravel';
13
+ ```ts
14
+ // Old (still works via this redirect)
15
+ import { BoostedTravel } from 'boostedtravel';
15
16
 
16
- // Register (one-time)
17
- const creds = await BoostedTravel.register('my-agent', 'agent@example.com');
18
- console.log(creds.api_key); // Save this
19
-
20
- // Use
21
- const bt = new BoostedTravel({ apiKey: 'trav_...' });
22
-
23
- // Search — FREE
24
- const flights = await bt.search('GDN', 'BER', '2026-03-03');
25
- const best = cheapestOffer(flights);
26
- console.log(offerSummary(best));
27
-
28
- // Unlock — $1
29
- const unlock = await bt.unlock(best.id);
30
-
31
- // Book — FREE after unlock
32
- const booking = await bt.book(
33
- best.id,
34
- [{
35
- id: flights.passenger_ids[0],
36
- given_name: 'John',
37
- family_name: 'Doe',
38
- born_on: '1990-01-15',
39
- gender: 'm',
40
- title: 'mr',
41
- email: 'john@example.com',
42
- }],
43
- 'john@example.com'
44
- );
45
- console.log(`PNR: ${booking.booking_reference}`);
46
- ```
47
-
48
- ## Quick Start (CLI)
49
-
50
- ```bash
51
- export BOOSTEDTRAVEL_API_KEY=trav_...
52
-
53
- boostedtravel search GDN BER 2026-03-03 --sort price
54
- boostedtravel search LON BCN 2026-04-01 --json # Machine-readable
55
- boostedtravel unlock off_xxx
56
- boostedtravel book off_xxx -p '{"id":"pas_xxx","given_name":"John",...}' -e john@example.com
17
+ // New (recommended)
18
+ import { LetsFG } from 'letsfg';
57
19
  ```
58
20
 
59
- ## API
60
-
61
- ### `new BoostedTravel({ apiKey, baseUrl?, timeout? })`
62
-
63
- ### `bt.search(origin, destination, dateFrom, options?)`
64
- ### `bt.resolveLocation(query)`
65
- ### `bt.unlock(offerId)`
66
- ### `bt.book(offerId, passengers, contactEmail, contactPhone?)`
67
- ### `bt.setupPayment(token?)`
68
- ### `bt.me()`
69
- ### `BoostedTravel.register(agentName, email, baseUrl?, ownerName?, description?)`
70
-
71
- ### Helpers
72
- - `offerSummary(offer)` — One-line string summary
73
- - `cheapestOffer(result)` — Get cheapest offer from search
74
-
75
- ## Zero Dependencies
76
-
77
- Uses native `fetch` (Node 18+). No `axios`, no `node-fetch`, nothing. Safe for sandboxed environments.
21
+ Both `BoostedTravel` and `LetsFG` class names work in the new package.
22
+ Both `BOOSTEDTRAVEL_API_KEY` and `LETSFG_API_KEY` environment variables are supported.
78
23
 
79
- ## License
24
+ ## Links
80
25
 
81
- MIT
26
+ - **New package**: [letsfg on npm](https://www.npmjs.com/package/letsfg)
27
+ - **MCP Server**: [letsfg-mcp on npm](https://www.npmjs.com/package/letsfg-mcp)
28
+ - **Python SDK**: [letsfg on PyPI](https://pypi.org/project/letsfg/)
29
+ - **GitHub**: [LetsFG/LetsFG](https://github.com/LetsFG/LetsFG)
30
+ - **Website**: [letsfg.co](https://letsfg.co)
package/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ⚠️ boostedtravel has been renamed to letsfg.
3
+ *
4
+ * Install the new package: npm install letsfg
5
+ * https://www.npmjs.com/package/letsfg
6
+ */
7
+ export * from 'letsfg';
8
+ export { default } from 'letsfg';
package/index.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ⚠️ boostedtravel has been renamed to letsfg.
3
+ *
4
+ * Install the new package: npm install letsfg
5
+ * https://www.npmjs.com/package/letsfg
6
+ *
7
+ * This module re-exports everything from letsfg for backward compatibility.
8
+ */
9
+ module.exports = require('letsfg');
package/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ⚠️ boostedtravel has been renamed to letsfg.
3
+ *
4
+ * Install the new package: npm install letsfg
5
+ * https://www.npmjs.com/package/letsfg
6
+ */
7
+ export * from 'letsfg';
8
+ export { default } from 'letsfg';
package/package.json CHANGED
@@ -1,50 +1,20 @@
1
1
  {
2
2
  "name": "boostedtravel",
3
- "version": "0.2.4",
4
- "description": "Agent-native flight search & booking. 53 airline connectors run locally + enterprise GDS/NDC APIs. Built for autonomous AI agents.",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "boostedtravel": "dist/cli.js"
10
- },
11
- "files": [
12
- "dist/",
13
- "README.md",
14
- "LICENSE"
15
- ],
16
- "scripts": {
17
- "build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts --clean",
18
- "prepublishOnly": "npm run build"
19
- },
20
- "keywords": [
21
- "flights",
22
- "travel",
23
- "booking",
24
- "agent",
25
- "ai",
26
- "cli",
27
- "autonomous",
28
- "mcp",
29
- "openai",
30
- "airline",
31
- "ndc",
32
- "search",
33
- "ndc"
34
- ],
35
- "author": "BoostedTravel",
3
+ "version": "1.0.0",
4
+ "description": "⚠️ This package has been renamed to 'letsfg'. Install letsfg instead: npm install letsfg https://www.npmjs.com/package/letsfg",
5
+ "main": "index.js",
6
+ "module": "index.mjs",
7
+ "types": "index.d.ts",
8
+ "keywords": ["travel", "flights", "booking", "ai", "agent", "mcp", "letsfg"],
9
+ "author": "LetsFG <hi@letsfg.co>",
36
10
  "license": "MIT",
37
11
  "repository": {
38
12
  "type": "git",
39
- "url": "https://github.com/boostedtravel/boostedtravel-js"
13
+ "url": "https://github.com/LetsFG/LetsFG"
40
14
  },
41
- "homepage": "https://boostedchat.com",
42
- "devDependencies": {
43
- "@types/node": "^25.3.3",
44
- "tsup": "^8.0.0",
45
- "typescript": "^5.3.0"
15
+ "homepage": "https://www.npmjs.com/package/letsfg",
16
+ "dependencies": {
17
+ "letsfg": "^1.0.0"
46
18
  },
47
- "engines": {
48
- "node": ">=18.0.0"
49
- }
19
+ "deprecated": "This package has been renamed to 'letsfg'. Install: npm install letsfg — https://www.npmjs.com/package/letsfg"
50
20
  }
@@ -1,352 +0,0 @@
1
- // src/index.ts
2
- var ErrorCode = {
3
- // Transient (safe to retry after short delay)
4
- SUPPLIER_TIMEOUT: "SUPPLIER_TIMEOUT",
5
- RATE_LIMITED: "RATE_LIMITED",
6
- SERVICE_UNAVAILABLE: "SERVICE_UNAVAILABLE",
7
- NETWORK_ERROR: "NETWORK_ERROR",
8
- // Validation (fix input, then retry)
9
- INVALID_IATA: "INVALID_IATA",
10
- INVALID_DATE: "INVALID_DATE",
11
- INVALID_PASSENGERS: "INVALID_PASSENGERS",
12
- UNSUPPORTED_ROUTE: "UNSUPPORTED_ROUTE",
13
- MISSING_PARAMETER: "MISSING_PARAMETER",
14
- INVALID_PARAMETER: "INVALID_PARAMETER",
15
- // Business (requires human decision)
16
- AUTH_INVALID: "AUTH_INVALID",
17
- PAYMENT_REQUIRED: "PAYMENT_REQUIRED",
18
- PAYMENT_DECLINED: "PAYMENT_DECLINED",
19
- OFFER_EXPIRED: "OFFER_EXPIRED",
20
- OFFER_NOT_UNLOCKED: "OFFER_NOT_UNLOCKED",
21
- FARE_CHANGED: "FARE_CHANGED",
22
- ALREADY_BOOKED: "ALREADY_BOOKED",
23
- BOOKING_FAILED: "BOOKING_FAILED"
24
- };
25
- var ErrorCategory = {
26
- TRANSIENT: "transient",
27
- VALIDATION: "validation",
28
- BUSINESS: "business"
29
- };
30
- var CODE_TO_CATEGORY = {
31
- [ErrorCode.SUPPLIER_TIMEOUT]: ErrorCategory.TRANSIENT,
32
- [ErrorCode.RATE_LIMITED]: ErrorCategory.TRANSIENT,
33
- [ErrorCode.SERVICE_UNAVAILABLE]: ErrorCategory.TRANSIENT,
34
- [ErrorCode.NETWORK_ERROR]: ErrorCategory.TRANSIENT,
35
- [ErrorCode.INVALID_IATA]: ErrorCategory.VALIDATION,
36
- [ErrorCode.INVALID_DATE]: ErrorCategory.VALIDATION,
37
- [ErrorCode.INVALID_PASSENGERS]: ErrorCategory.VALIDATION,
38
- [ErrorCode.UNSUPPORTED_ROUTE]: ErrorCategory.VALIDATION,
39
- [ErrorCode.MISSING_PARAMETER]: ErrorCategory.VALIDATION,
40
- [ErrorCode.INVALID_PARAMETER]: ErrorCategory.VALIDATION,
41
- [ErrorCode.AUTH_INVALID]: ErrorCategory.BUSINESS,
42
- [ErrorCode.PAYMENT_REQUIRED]: ErrorCategory.BUSINESS,
43
- [ErrorCode.PAYMENT_DECLINED]: ErrorCategory.BUSINESS,
44
- [ErrorCode.OFFER_EXPIRED]: ErrorCategory.BUSINESS,
45
- [ErrorCode.OFFER_NOT_UNLOCKED]: ErrorCategory.BUSINESS,
46
- [ErrorCode.FARE_CHANGED]: ErrorCategory.BUSINESS,
47
- [ErrorCode.ALREADY_BOOKED]: ErrorCategory.BUSINESS,
48
- [ErrorCode.BOOKING_FAILED]: ErrorCategory.BUSINESS
49
- };
50
- function inferErrorCode(statusCode, detail) {
51
- const d = detail.toLowerCase();
52
- if (statusCode === 401) return ErrorCode.AUTH_INVALID;
53
- if (statusCode === 402) return d.includes("declined") ? ErrorCode.PAYMENT_DECLINED : ErrorCode.PAYMENT_REQUIRED;
54
- if (statusCode === 410) return ErrorCode.OFFER_EXPIRED;
55
- if (statusCode === 422) {
56
- if (d.includes("iata") || d.includes("airport")) return ErrorCode.INVALID_IATA;
57
- if (d.includes("date")) return ErrorCode.INVALID_DATE;
58
- if (d.includes("passenger")) return ErrorCode.INVALID_PASSENGERS;
59
- if (d.includes("route")) return ErrorCode.UNSUPPORTED_ROUTE;
60
- return ErrorCode.INVALID_PARAMETER;
61
- }
62
- if (statusCode === 429) return ErrorCode.RATE_LIMITED;
63
- if (statusCode === 503) return ErrorCode.SERVICE_UNAVAILABLE;
64
- if (statusCode === 504) return ErrorCode.SUPPLIER_TIMEOUT;
65
- if (statusCode === 409) return ErrorCode.ALREADY_BOOKED;
66
- return statusCode >= 500 ? ErrorCode.BOOKING_FAILED : ErrorCode.INVALID_PARAMETER;
67
- }
68
- var BoostedTravelError = class extends Error {
69
- statusCode;
70
- response;
71
- errorCode;
72
- errorCategory;
73
- isRetryable;
74
- constructor(message, statusCode = 0, response = {}, errorCode = "") {
75
- super(message);
76
- this.name = "BoostedTravelError";
77
- this.statusCode = statusCode;
78
- this.response = response;
79
- this.errorCode = errorCode || response.error_code || "";
80
- this.errorCategory = CODE_TO_CATEGORY[this.errorCode] || ErrorCategory.BUSINESS;
81
- this.isRetryable = this.errorCategory === ErrorCategory.TRANSIENT;
82
- }
83
- };
84
- var AuthenticationError = class extends BoostedTravelError {
85
- constructor(message, response = {}) {
86
- super(message, 401, response, ErrorCode.AUTH_INVALID);
87
- this.name = "AuthenticationError";
88
- }
89
- };
90
- var PaymentRequiredError = class extends BoostedTravelError {
91
- constructor(message, response = {}) {
92
- const code = message.toLowerCase().includes("declined") ? ErrorCode.PAYMENT_DECLINED : ErrorCode.PAYMENT_REQUIRED;
93
- super(message, 402, response, code);
94
- this.name = "PaymentRequiredError";
95
- }
96
- };
97
- var OfferExpiredError = class extends BoostedTravelError {
98
- constructor(message, response = {}) {
99
- super(message, 410, response, ErrorCode.OFFER_EXPIRED);
100
- this.name = "OfferExpiredError";
101
- }
102
- };
103
- var ValidationError = class extends BoostedTravelError {
104
- constructor(message, statusCode = 422, response = {}, errorCode = "") {
105
- super(message, statusCode, response, errorCode || ErrorCode.INVALID_PARAMETER);
106
- this.name = "ValidationError";
107
- }
108
- };
109
- function routeStr(route) {
110
- if (!route.segments.length) return "";
111
- const codes = [route.segments[0].origin, ...route.segments.map((s) => s.destination)];
112
- return codes.join(" \u2192 ");
113
- }
114
- function durationHuman(seconds) {
115
- const h = Math.floor(seconds / 3600);
116
- const m = Math.floor(seconds % 3600 / 60);
117
- return `${h}h${m.toString().padStart(2, "0")}m`;
118
- }
119
- function offerSummary(offer) {
120
- const route = routeStr(offer.outbound);
121
- const dur = durationHuman(offer.outbound.total_duration_seconds);
122
- const airline = offer.owner_airline || offer.airlines[0] || "?";
123
- return `${offer.currency} ${offer.price.toFixed(2)} | ${airline} | ${route} | ${dur} | ${offer.outbound.stopovers} stop(s)`;
124
- }
125
- function cheapestOffer(result) {
126
- if (!result.offers.length) return null;
127
- return result.offers.reduce((min, o) => o.price < min.price ? o : min, result.offers[0]);
128
- }
129
- async function searchLocal(origin, destination, dateFrom, options = {}) {
130
- const { spawn } = await import("child_process");
131
- const params = JSON.stringify({
132
- origin: origin.toUpperCase(),
133
- destination: destination.toUpperCase(),
134
- date_from: dateFrom,
135
- adults: options.adults ?? 1,
136
- children: options.children ?? 0,
137
- currency: options.currency ?? "EUR",
138
- limit: options.limit ?? 50,
139
- return_date: options.returnDate,
140
- cabin_class: options.cabinClass
141
- });
142
- return new Promise((resolve, reject) => {
143
- const pythonCmd = process.platform === "win32" ? "python" : "python3";
144
- const child = spawn(pythonCmd, ["-m", "boostedtravel.local"], {
145
- stdio: ["pipe", "pipe", "pipe"]
146
- });
147
- let stdout = "";
148
- let stderr = "";
149
- child.stdout.on("data", (d) => {
150
- stdout += d.toString();
151
- });
152
- child.stderr.on("data", (d) => {
153
- stderr += d.toString();
154
- });
155
- child.on("close", (code) => {
156
- try {
157
- const data = JSON.parse(stdout);
158
- if (data.error) reject(new BoostedTravelError(data.error));
159
- else resolve(data);
160
- } catch {
161
- reject(new BoostedTravelError(
162
- `Python search failed (code ${code}): ${stdout || stderr}
163
- Make sure boostedtravel is installed: pip install boostedtravel && playwright install chromium`
164
- ));
165
- }
166
- });
167
- child.on("error", (err) => {
168
- reject(new BoostedTravelError(
169
- `Cannot start Python: ${err.message}
170
- Install: pip install boostedtravel && playwright install chromium`
171
- ));
172
- });
173
- child.stdin.write(params);
174
- child.stdin.end();
175
- });
176
- }
177
- var DEFAULT_BASE_URL = "https://api.boostedchat.com";
178
- var BoostedTravel = class {
179
- apiKey;
180
- baseUrl;
181
- timeout;
182
- constructor(config = {}) {
183
- this.apiKey = config.apiKey || process.env.BOOSTEDTRAVEL_API_KEY || "";
184
- this.baseUrl = (config.baseUrl || process.env.BOOSTEDTRAVEL_BASE_URL || DEFAULT_BASE_URL).replace(/\/$/, "");
185
- this.timeout = config.timeout || 3e4;
186
- }
187
- requireApiKey() {
188
- if (!this.apiKey) {
189
- throw new AuthenticationError(
190
- "API key required for this operation. Set apiKey in config or BOOSTEDTRAVEL_API_KEY env var.\nNote: searchLocal() works without an API key."
191
- );
192
- }
193
- }
194
- // ── Core methods ─────────────────────────────────────────────────────
195
- /**
196
- * Search for flights — FREE, unlimited.
197
- *
198
- * @param origin - IATA code (e.g., "GDN", "LON")
199
- * @param destination - IATA code (e.g., "BER", "BCN")
200
- * @param dateFrom - Departure date "YYYY-MM-DD"
201
- * @param options - Optional search parameters
202
- */
203
- async search(origin, destination, dateFrom, options = {}) {
204
- this.requireApiKey();
205
- const body = {
206
- origin: origin.toUpperCase(),
207
- destination: destination.toUpperCase(),
208
- date_from: dateFrom,
209
- adults: options.adults ?? 1,
210
- children: options.children ?? 0,
211
- infants: options.infants ?? 0,
212
- max_stopovers: options.maxStopovers ?? 2,
213
- currency: options.currency ?? "EUR",
214
- limit: options.limit ?? 20,
215
- sort: options.sort ?? "price"
216
- };
217
- if (options.returnDate) body.return_from = options.returnDate;
218
- if (options.cabinClass) body.cabin_class = options.cabinClass;
219
- return this.post("/api/v1/flights/search", body);
220
- }
221
- /**
222
- * Resolve a city/airport name to IATA codes.
223
- */
224
- async resolveLocation(query) {
225
- this.requireApiKey();
226
- const data = await this.get(`/api/v1/flights/locations/${encodeURIComponent(query)}`);
227
- if (Array.isArray(data)) return data;
228
- if (data && Array.isArray(data.locations)) return data.locations;
229
- return data ? [data] : [];
230
- }
231
- /**
232
- * Unlock a flight offer — $1 fee.
233
- * Confirms price, reserves for 30 minutes.
234
- */
235
- async unlock(offerId) {
236
- this.requireApiKey();
237
- return this.post("/api/v1/bookings/unlock", { offer_id: offerId });
238
- }
239
- /**
240
- * Book a flight — FREE after unlock.
241
- * Creates a real airline reservation with PNR.
242
- *
243
- * Always provide idempotencyKey to prevent double-bookings on retry.
244
- */
245
- async book(offerId, passengers, contactEmail, contactPhone = "", idempotencyKey = "") {
246
- this.requireApiKey();
247
- const body = {
248
- offer_id: offerId,
249
- booking_type: "flight",
250
- passengers,
251
- contact_email: contactEmail,
252
- contact_phone: contactPhone
253
- };
254
- if (idempotencyKey) body.idempotency_key = idempotencyKey;
255
- return this.post("/api/v1/bookings/book", body);
256
- }
257
- /**
258
- * Set up payment method (payment token).
259
- */
260
- async setupPayment(token = "tok_visa") {
261
- this.requireApiKey();
262
- return this.post("/api/v1/agents/setup-payment", { token });
263
- }
264
- /**
265
- * Get current agent profile and usage stats.
266
- */
267
- async me() {
268
- this.requireApiKey();
269
- return this.get("/api/v1/agents/me");
270
- }
271
- // ── Static methods ───────────────────────────────────────────────────
272
- /**
273
- * Register a new agent — no API key needed.
274
- */
275
- static async register(agentName, email, baseUrl, ownerName = "", description = "") {
276
- const url = (baseUrl || DEFAULT_BASE_URL).replace(/\/$/, "");
277
- const resp = await fetch(`${url}/api/v1/agents/register`, {
278
- method: "POST",
279
- headers: { "Content-Type": "application/json" },
280
- body: JSON.stringify({
281
- agent_name: agentName,
282
- email,
283
- owner_name: ownerName,
284
- description
285
- })
286
- });
287
- const data = await resp.json();
288
- if (!resp.ok) {
289
- throw new BoostedTravelError(
290
- data.detail || `Registration failed (${resp.status})`,
291
- resp.status,
292
- data
293
- );
294
- }
295
- return data;
296
- }
297
- // ── Internal ────────────────────────────────────────────────────────
298
- async post(path, body) {
299
- return this.request(path, {
300
- method: "POST",
301
- body: JSON.stringify(body)
302
- });
303
- }
304
- async get(path) {
305
- return this.request(path, { method: "GET" });
306
- }
307
- async request(path, init) {
308
- const controller = new AbortController();
309
- const timer = setTimeout(() => controller.abort(), this.timeout);
310
- try {
311
- const resp = await fetch(`${this.baseUrl}${path}`, {
312
- ...init,
313
- headers: {
314
- "Content-Type": "application/json",
315
- "X-API-Key": this.apiKey,
316
- "User-Agent": "boostedtravel-js/0.1.0",
317
- ...init.headers || {}
318
- },
319
- signal: controller.signal
320
- });
321
- const data = await resp.json();
322
- if (!resp.ok) {
323
- const detail = data.detail || `API error (${resp.status})`;
324
- const code = data.error_code || inferErrorCode(resp.status, detail);
325
- if (resp.status === 401) throw new AuthenticationError(detail, data);
326
- if (resp.status === 402) throw new PaymentRequiredError(detail, data);
327
- if (resp.status === 410) throw new OfferExpiredError(detail, data);
328
- if (resp.status === 422) throw new ValidationError(detail, resp.status, data, code);
329
- throw new BoostedTravelError(detail, resp.status, data, code);
330
- }
331
- return data;
332
- } finally {
333
- clearTimeout(timer);
334
- }
335
- }
336
- };
337
- var index_default = BoostedTravel;
338
-
339
- export {
340
- ErrorCode,
341
- ErrorCategory,
342
- BoostedTravelError,
343
- AuthenticationError,
344
- PaymentRequiredError,
345
- OfferExpiredError,
346
- ValidationError,
347
- offerSummary,
348
- cheapestOffer,
349
- searchLocal,
350
- BoostedTravel,
351
- index_default
352
- };
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
package/dist/cli.d.ts DELETED
@@ -1 +0,0 @@
1
- #!/usr/bin/env node