letsfg 1.4.1 → 1.6.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/dist/{chunk-7LYR3CHE.mjs → chunk-GXEB2JO2.mjs} +3 -14
- package/dist/cli.js +39 -59
- package/dist/cli.mjs +39 -55
- package/dist/index.d.mts +4 -23
- package/dist/index.d.ts +4 -23
- package/dist/index.js +3 -15
- package/dist/index.mjs +1 -3
- package/package.json +1 -1
|
@@ -106,12 +106,6 @@ var ValidationError = class extends LetsFGError {
|
|
|
106
106
|
this.name = "ValidationError";
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
var StarRequiredError = class extends LetsFGError {
|
|
110
|
-
constructor(message = "GitHub star required. Run: letsfg star --github <your-username>") {
|
|
111
|
-
super(message, 403, {}, "STAR_REQUIRED");
|
|
112
|
-
this.name = "StarRequiredError";
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
109
|
function routeStr(route) {
|
|
116
110
|
if (!route.segments.length) return "";
|
|
117
111
|
const codes = [route.segments[0].origin, ...route.segments.map((s) => s.destination)];
|
|
@@ -162,13 +156,8 @@ async function searchLocal(origin, destination, dateFrom, options = {}) {
|
|
|
162
156
|
child.on("close", (code) => {
|
|
163
157
|
try {
|
|
164
158
|
const data = JSON.parse(stdout);
|
|
165
|
-
if (data.error)
|
|
166
|
-
|
|
167
|
-
reject(new StarRequiredError(data.error));
|
|
168
|
-
} else {
|
|
169
|
-
reject(new LetsFGError(data.error));
|
|
170
|
-
}
|
|
171
|
-
} else resolve(data);
|
|
159
|
+
if (data.error) reject(new LetsFGError(data.error));
|
|
160
|
+
else resolve(data);
|
|
172
161
|
} catch {
|
|
173
162
|
reject(new LetsFGError(
|
|
174
163
|
`Python search failed (code ${code}): ${stdout || stderr}
|
|
@@ -402,6 +391,7 @@ var LetsFG = class {
|
|
|
402
391
|
"Content-Type": "application/json",
|
|
403
392
|
"X-API-Key": this.apiKey,
|
|
404
393
|
"User-Agent": "LetsFG-js/0.1.0",
|
|
394
|
+
"X-Client-Type": "js-sdk",
|
|
405
395
|
...init.headers || {}
|
|
406
396
|
},
|
|
407
397
|
signal: controller.signal
|
|
@@ -470,7 +460,6 @@ export {
|
|
|
470
460
|
PaymentRequiredError,
|
|
471
461
|
OfferExpiredError,
|
|
472
462
|
ValidationError,
|
|
473
|
-
StarRequiredError,
|
|
474
463
|
offerSummary,
|
|
475
464
|
cheapestOffer,
|
|
476
465
|
searchLocal,
|
package/dist/cli.js
CHANGED
|
@@ -131,12 +131,6 @@ var ValidationError = class extends LetsFGError {
|
|
|
131
131
|
this.name = "ValidationError";
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
var StarRequiredError = class extends LetsFGError {
|
|
135
|
-
constructor(message = "GitHub star required. Run: letsfg star --github <your-username>") {
|
|
136
|
-
super(message, 403, {}, "STAR_REQUIRED");
|
|
137
|
-
this.name = "StarRequiredError";
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
134
|
function routeStr(route) {
|
|
141
135
|
if (!route.segments.length) return "";
|
|
142
136
|
const codes = [route.segments[0].origin, ...route.segments.map((s) => s.destination)];
|
|
@@ -369,6 +363,7 @@ var LetsFG = class {
|
|
|
369
363
|
"Content-Type": "application/json",
|
|
370
364
|
"X-API-Key": this.apiKey,
|
|
371
365
|
"User-Agent": "LetsFG-js/0.1.0",
|
|
366
|
+
"X-Client-Type": "js-sdk",
|
|
372
367
|
...init.headers || {}
|
|
373
368
|
},
|
|
374
369
|
signal: controller.signal
|
|
@@ -610,44 +605,42 @@ async function cmdRegister(args) {
|
|
|
610
605
|
}
|
|
611
606
|
async function cmdStar(args) {
|
|
612
607
|
const jsonOut = hasFlag(args, "--json") || hasFlag(args, "-j");
|
|
608
|
+
const apiKey = getFlag(args, "--api-key", "-k");
|
|
609
|
+
const baseUrl = getFlag(args, "--base-url");
|
|
613
610
|
const github = getFlag(args, "--github", "-g");
|
|
614
611
|
if (!github) {
|
|
615
612
|
console.error("Usage: letsfg star --github <your-github-username>");
|
|
616
613
|
process.exit(1);
|
|
617
614
|
}
|
|
618
|
-
const
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
console.error("Install: pip install letsfg");
|
|
648
|
-
process.exit(1);
|
|
649
|
-
});
|
|
650
|
-
});
|
|
615
|
+
const bt = new LetsFG({ apiKey, baseUrl });
|
|
616
|
+
const result = await bt.linkGithub(github);
|
|
617
|
+
if (jsonOut) {
|
|
618
|
+
console.log(JSON.stringify(result, null, 2));
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
const status = result.status;
|
|
622
|
+
if (status === "verified") {
|
|
623
|
+
console.log(`
|
|
624
|
+
\u2713 GitHub star verified! Unlimited access granted.`);
|
|
625
|
+
console.log(` Username: ${result.github_username}`);
|
|
626
|
+
console.log(`
|
|
627
|
+
You're all set \u2014 search, unlock, and book for free.
|
|
628
|
+
`);
|
|
629
|
+
} else if (status === "already_verified") {
|
|
630
|
+
console.log(`
|
|
631
|
+
\u2713 Already verified! You have unlimited access.`);
|
|
632
|
+
console.log(` Username: ${result.github_username}
|
|
633
|
+
`);
|
|
634
|
+
} else if (status === "star_required") {
|
|
635
|
+
console.log(`
|
|
636
|
+
\u2717 Star not found for '${github}'.`);
|
|
637
|
+
console.log(` 1. Star the repo: https://github.com/LetsFG/LetsFG`);
|
|
638
|
+
console.log(` 2. Run this command again.
|
|
639
|
+
`);
|
|
640
|
+
} else {
|
|
641
|
+
console.error(` \u2717 Unexpected status: ${status}`);
|
|
642
|
+
process.exit(1);
|
|
643
|
+
}
|
|
651
644
|
}
|
|
652
645
|
async function cmdSetupPayment(args) {
|
|
653
646
|
const jsonOut = hasFlag(args, "--json") || hasFlag(args, "-j");
|
|
@@ -705,19 +698,16 @@ var HELP = `
|
|
|
705
698
|
LetsFG \u2014 Agent-native flight search & booking.
|
|
706
699
|
|
|
707
700
|
Search 400+ airlines at raw airline prices \u2014 $20-50 cheaper than OTAs.
|
|
708
|
-
|
|
709
|
-
**GitHub Star Required!**
|
|
710
|
-
Before using, you must:
|
|
711
|
-
1. Star https://github.com/LetsFG/LetsFG
|
|
712
|
-
2. Run: letsfg star --github <your-username>
|
|
701
|
+
100% FREE \u2014 just star our GitHub repo for unlimited access.
|
|
713
702
|
|
|
714
703
|
Commands:
|
|
715
|
-
|
|
716
|
-
search <origin> <dest> <date> Search for flights (FREE with star)
|
|
704
|
+
search <origin> <dest> <date> Search for flights (FREE)
|
|
717
705
|
locations <query> Resolve city name to IATA codes
|
|
718
|
-
|
|
719
|
-
|
|
706
|
+
star --github <username> Link GitHub \u2014 star repo for free access
|
|
707
|
+
unlock <offer_id> Unlock offer (FREE with GitHub star)
|
|
708
|
+
book <offer_id> --passenger ... Book flight (FREE after unlock)
|
|
720
709
|
register --name ... --email ... Register new agent
|
|
710
|
+
setup-payment Legacy payment setup
|
|
721
711
|
me Show agent profile
|
|
722
712
|
|
|
723
713
|
Options:
|
|
@@ -726,6 +716,7 @@ Options:
|
|
|
726
716
|
--base-url API URL (default: https://api.letsfg.co)
|
|
727
717
|
|
|
728
718
|
Examples:
|
|
719
|
+
letsfg register --name my-agent --email me@example.com
|
|
729
720
|
letsfg star --github octocat
|
|
730
721
|
letsfg search GDN BER 2026-03-03 --sort price
|
|
731
722
|
letsfg unlock off_xxx
|
|
@@ -772,17 +763,6 @@ async function main() {
|
|
|
772
763
|
process.exit(1);
|
|
773
764
|
}
|
|
774
765
|
} catch (e) {
|
|
775
|
-
if (e instanceof StarRequiredError) {
|
|
776
|
-
console.error(`
|
|
777
|
-
\u2B50 GitHub star required to use LetsFG!
|
|
778
|
-
`);
|
|
779
|
-
console.error(` 1. Star the repo: https://github.com/LetsFG/LetsFG`);
|
|
780
|
-
console.error(` 2. Run: letsfg star --github <your-username>
|
|
781
|
-
`);
|
|
782
|
-
console.error(` This is completely FREE \u2014 just a star to help us grow!
|
|
783
|
-
`);
|
|
784
|
-
process.exit(1);
|
|
785
|
-
}
|
|
786
766
|
if (e instanceof LetsFGError) {
|
|
787
767
|
console.error(`Error: ${e.message}`);
|
|
788
768
|
process.exit(1);
|
package/dist/cli.mjs
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
LetsFG,
|
|
4
4
|
LetsFGError,
|
|
5
|
-
StarRequiredError,
|
|
6
5
|
offerSummary
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GXEB2JO2.mjs";
|
|
8
7
|
|
|
9
8
|
// src/cli.ts
|
|
10
9
|
function getFlag(args, flag, alias) {
|
|
@@ -226,44 +225,42 @@ async function cmdRegister(args) {
|
|
|
226
225
|
}
|
|
227
226
|
async function cmdStar(args) {
|
|
228
227
|
const jsonOut = hasFlag(args, "--json") || hasFlag(args, "-j");
|
|
228
|
+
const apiKey = getFlag(args, "--api-key", "-k");
|
|
229
|
+
const baseUrl = getFlag(args, "--base-url");
|
|
229
230
|
const github = getFlag(args, "--github", "-g");
|
|
230
231
|
if (!github) {
|
|
231
232
|
console.error("Usage: letsfg star --github <your-github-username>");
|
|
232
233
|
process.exit(1);
|
|
233
234
|
}
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
console.error("Install: pip install letsfg");
|
|
264
|
-
process.exit(1);
|
|
265
|
-
});
|
|
266
|
-
});
|
|
235
|
+
const bt = new LetsFG({ apiKey, baseUrl });
|
|
236
|
+
const result = await bt.linkGithub(github);
|
|
237
|
+
if (jsonOut) {
|
|
238
|
+
console.log(JSON.stringify(result, null, 2));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const status = result.status;
|
|
242
|
+
if (status === "verified") {
|
|
243
|
+
console.log(`
|
|
244
|
+
\u2713 GitHub star verified! Unlimited access granted.`);
|
|
245
|
+
console.log(` Username: ${result.github_username}`);
|
|
246
|
+
console.log(`
|
|
247
|
+
You're all set \u2014 search, unlock, and book for free.
|
|
248
|
+
`);
|
|
249
|
+
} else if (status === "already_verified") {
|
|
250
|
+
console.log(`
|
|
251
|
+
\u2713 Already verified! You have unlimited access.`);
|
|
252
|
+
console.log(` Username: ${result.github_username}
|
|
253
|
+
`);
|
|
254
|
+
} else if (status === "star_required") {
|
|
255
|
+
console.log(`
|
|
256
|
+
\u2717 Star not found for '${github}'.`);
|
|
257
|
+
console.log(` 1. Star the repo: https://github.com/LetsFG/LetsFG`);
|
|
258
|
+
console.log(` 2. Run this command again.
|
|
259
|
+
`);
|
|
260
|
+
} else {
|
|
261
|
+
console.error(` \u2717 Unexpected status: ${status}`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
267
264
|
}
|
|
268
265
|
async function cmdSetupPayment(args) {
|
|
269
266
|
const jsonOut = hasFlag(args, "--json") || hasFlag(args, "-j");
|
|
@@ -321,19 +318,16 @@ var HELP = `
|
|
|
321
318
|
LetsFG \u2014 Agent-native flight search & booking.
|
|
322
319
|
|
|
323
320
|
Search 400+ airlines at raw airline prices \u2014 $20-50 cheaper than OTAs.
|
|
324
|
-
|
|
325
|
-
**GitHub Star Required!**
|
|
326
|
-
Before using, you must:
|
|
327
|
-
1. Star https://github.com/LetsFG/LetsFG
|
|
328
|
-
2. Run: letsfg star --github <your-username>
|
|
321
|
+
100% FREE \u2014 just star our GitHub repo for unlimited access.
|
|
329
322
|
|
|
330
323
|
Commands:
|
|
331
|
-
|
|
332
|
-
search <origin> <dest> <date> Search for flights (FREE with star)
|
|
324
|
+
search <origin> <dest> <date> Search for flights (FREE)
|
|
333
325
|
locations <query> Resolve city name to IATA codes
|
|
334
|
-
|
|
335
|
-
|
|
326
|
+
star --github <username> Link GitHub \u2014 star repo for free access
|
|
327
|
+
unlock <offer_id> Unlock offer (FREE with GitHub star)
|
|
328
|
+
book <offer_id> --passenger ... Book flight (FREE after unlock)
|
|
336
329
|
register --name ... --email ... Register new agent
|
|
330
|
+
setup-payment Legacy payment setup
|
|
337
331
|
me Show agent profile
|
|
338
332
|
|
|
339
333
|
Options:
|
|
@@ -342,6 +336,7 @@ Options:
|
|
|
342
336
|
--base-url API URL (default: https://api.letsfg.co)
|
|
343
337
|
|
|
344
338
|
Examples:
|
|
339
|
+
letsfg register --name my-agent --email me@example.com
|
|
345
340
|
letsfg star --github octocat
|
|
346
341
|
letsfg search GDN BER 2026-03-03 --sort price
|
|
347
342
|
letsfg unlock off_xxx
|
|
@@ -388,17 +383,6 @@ async function main() {
|
|
|
388
383
|
process.exit(1);
|
|
389
384
|
}
|
|
390
385
|
} catch (e) {
|
|
391
|
-
if (e instanceof StarRequiredError) {
|
|
392
|
-
console.error(`
|
|
393
|
-
\u2B50 GitHub star required to use LetsFG!
|
|
394
|
-
`);
|
|
395
|
-
console.error(` 1. Star the repo: https://github.com/LetsFG/LetsFG`);
|
|
396
|
-
console.error(` 2. Run: letsfg star --github <your-username>
|
|
397
|
-
`);
|
|
398
|
-
console.error(` This is completely FREE \u2014 just a star to help us grow!
|
|
399
|
-
`);
|
|
400
|
-
process.exit(1);
|
|
401
|
-
}
|
|
402
386
|
if (e instanceof LetsFGError) {
|
|
403
387
|
console.error(`Error: ${e.message}`);
|
|
404
388
|
process.exit(1);
|
package/dist/index.d.mts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LetsFG — Agent-native flight search & booking SDK for Node.js/TypeScript.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 75 airline connectors run locally via Python + backend API for enterprise GDS/NDC sources.
|
|
5
5
|
* Zero external JS dependencies. Uses native fetch (Node 18+).
|
|
6
6
|
*
|
|
7
|
-
* **GitHub Star Required!**
|
|
8
|
-
* Before using, you must:
|
|
9
|
-
* 1. Star https://github.com/LetsFG/LetsFG
|
|
10
|
-
* 2. Run: letsfg star --github <your-username>
|
|
11
|
-
*
|
|
12
7
|
* @example
|
|
13
8
|
* ```ts
|
|
14
9
|
* import { LetsFG, searchLocal } from 'letsfg';
|
|
15
10
|
*
|
|
16
|
-
* // Local search — FREE
|
|
11
|
+
* // Local search — FREE, no API key
|
|
17
12
|
* const local = await searchLocal('SHA', 'CTU', '2026-03-20');
|
|
18
13
|
*
|
|
19
14
|
* // Full API — search + unlock + book
|
|
@@ -188,25 +183,12 @@ declare class OfferExpiredError extends LetsFGError {
|
|
|
188
183
|
declare class ValidationError extends LetsFGError {
|
|
189
184
|
constructor(message: string, statusCode?: number, response?: Record<string, unknown>, errorCode?: string);
|
|
190
185
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Thrown when GitHub star verification is required.
|
|
193
|
-
* Users must star https://github.com/LetsFG/LetsFG and run:
|
|
194
|
-
* letsfg star --github <username>
|
|
195
|
-
*/
|
|
196
|
-
declare class StarRequiredError extends LetsFGError {
|
|
197
|
-
constructor(message?: string);
|
|
198
|
-
}
|
|
199
186
|
/** One-line offer summary */
|
|
200
187
|
declare function offerSummary(offer: FlightOffer): string;
|
|
201
188
|
/** Get cheapest offer from search results */
|
|
202
189
|
declare function cheapestOffer(result: FlightSearchResult): FlightOffer | null;
|
|
203
190
|
/**
|
|
204
|
-
* Search flights using
|
|
205
|
-
*
|
|
206
|
-
* **GitHub Star Required!**
|
|
207
|
-
* Before using, you must:
|
|
208
|
-
* 1. Star https://github.com/LetsFG/LetsFG
|
|
209
|
-
* 2. Run: letsfg star --github <your-username>
|
|
191
|
+
* Search flights using 73 local airline connectors — FREE, no API key needed.
|
|
210
192
|
*
|
|
211
193
|
* Requires: pip install letsfg && playwright install chromium
|
|
212
194
|
*
|
|
@@ -214,7 +196,6 @@ declare function cheapestOffer(result: FlightSearchResult): FlightOffer | null;
|
|
|
214
196
|
* @param destination - IATA code (e.g., "CTU")
|
|
215
197
|
* @param dateFrom - Departure date "YYYY-MM-DD"
|
|
216
198
|
* @param options - Optional: currency, adults, limit, etc.
|
|
217
|
-
* @throws {StarRequiredError} If GitHub star not verified
|
|
218
199
|
*/
|
|
219
200
|
declare function searchLocal(origin: string, destination: string, dateFrom: string, options?: Partial<SearchOptions>): Promise<FlightSearchResult>;
|
|
220
201
|
declare class LetsFG {
|
|
@@ -301,4 +282,4 @@ declare const BoostedTravel: typeof LetsFG;
|
|
|
301
282
|
declare const BoostedTravelError: typeof LetsFGError;
|
|
302
283
|
type BoostedTravelConfig = LetsFGConfig;
|
|
303
284
|
|
|
304
|
-
export { AuthenticationError, type BookingResult, BoostedTravel, type BoostedTravelConfig, BoostedTravelError, type CheckoutProgress, ErrorCategory, type ErrorCategoryType, ErrorCode, type ErrorCodeType, type FlightOffer, type FlightRoute, type FlightSearchResult, type FlightSegment, LetsFG, type LetsFGConfig, LetsFGError, OfferExpiredError, type Passenger, PaymentRequiredError, type SearchOptions,
|
|
285
|
+
export { AuthenticationError, type BookingResult, BoostedTravel, type BoostedTravelConfig, BoostedTravelError, type CheckoutProgress, ErrorCategory, type ErrorCategoryType, ErrorCode, type ErrorCodeType, type FlightOffer, type FlightRoute, type FlightSearchResult, type FlightSegment, LetsFG, type LetsFGConfig, LetsFGError, OfferExpiredError, type Passenger, PaymentRequiredError, type SearchOptions, type UnlockResult, ValidationError, cheapestOffer, LetsFG as default, systemInfo as getSystemInfo, searchLocal as localSearch, offerSummary, searchLocal, systemInfo };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* LetsFG — Agent-native flight search & booking SDK for Node.js/TypeScript.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 75 airline connectors run locally via Python + backend API for enterprise GDS/NDC sources.
|
|
5
5
|
* Zero external JS dependencies. Uses native fetch (Node 18+).
|
|
6
6
|
*
|
|
7
|
-
* **GitHub Star Required!**
|
|
8
|
-
* Before using, you must:
|
|
9
|
-
* 1. Star https://github.com/LetsFG/LetsFG
|
|
10
|
-
* 2. Run: letsfg star --github <your-username>
|
|
11
|
-
*
|
|
12
7
|
* @example
|
|
13
8
|
* ```ts
|
|
14
9
|
* import { LetsFG, searchLocal } from 'letsfg';
|
|
15
10
|
*
|
|
16
|
-
* // Local search — FREE
|
|
11
|
+
* // Local search — FREE, no API key
|
|
17
12
|
* const local = await searchLocal('SHA', 'CTU', '2026-03-20');
|
|
18
13
|
*
|
|
19
14
|
* // Full API — search + unlock + book
|
|
@@ -188,25 +183,12 @@ declare class OfferExpiredError extends LetsFGError {
|
|
|
188
183
|
declare class ValidationError extends LetsFGError {
|
|
189
184
|
constructor(message: string, statusCode?: number, response?: Record<string, unknown>, errorCode?: string);
|
|
190
185
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Thrown when GitHub star verification is required.
|
|
193
|
-
* Users must star https://github.com/LetsFG/LetsFG and run:
|
|
194
|
-
* letsfg star --github <username>
|
|
195
|
-
*/
|
|
196
|
-
declare class StarRequiredError extends LetsFGError {
|
|
197
|
-
constructor(message?: string);
|
|
198
|
-
}
|
|
199
186
|
/** One-line offer summary */
|
|
200
187
|
declare function offerSummary(offer: FlightOffer): string;
|
|
201
188
|
/** Get cheapest offer from search results */
|
|
202
189
|
declare function cheapestOffer(result: FlightSearchResult): FlightOffer | null;
|
|
203
190
|
/**
|
|
204
|
-
* Search flights using
|
|
205
|
-
*
|
|
206
|
-
* **GitHub Star Required!**
|
|
207
|
-
* Before using, you must:
|
|
208
|
-
* 1. Star https://github.com/LetsFG/LetsFG
|
|
209
|
-
* 2. Run: letsfg star --github <your-username>
|
|
191
|
+
* Search flights using 73 local airline connectors — FREE, no API key needed.
|
|
210
192
|
*
|
|
211
193
|
* Requires: pip install letsfg && playwright install chromium
|
|
212
194
|
*
|
|
@@ -214,7 +196,6 @@ declare function cheapestOffer(result: FlightSearchResult): FlightOffer | null;
|
|
|
214
196
|
* @param destination - IATA code (e.g., "CTU")
|
|
215
197
|
* @param dateFrom - Departure date "YYYY-MM-DD"
|
|
216
198
|
* @param options - Optional: currency, adults, limit, etc.
|
|
217
|
-
* @throws {StarRequiredError} If GitHub star not verified
|
|
218
199
|
*/
|
|
219
200
|
declare function searchLocal(origin: string, destination: string, dateFrom: string, options?: Partial<SearchOptions>): Promise<FlightSearchResult>;
|
|
220
201
|
declare class LetsFG {
|
|
@@ -301,4 +282,4 @@ declare const BoostedTravel: typeof LetsFG;
|
|
|
301
282
|
declare const BoostedTravelError: typeof LetsFGError;
|
|
302
283
|
type BoostedTravelConfig = LetsFGConfig;
|
|
303
284
|
|
|
304
|
-
export { AuthenticationError, type BookingResult, BoostedTravel, type BoostedTravelConfig, BoostedTravelError, type CheckoutProgress, ErrorCategory, type ErrorCategoryType, ErrorCode, type ErrorCodeType, type FlightOffer, type FlightRoute, type FlightSearchResult, type FlightSegment, LetsFG, type LetsFGConfig, LetsFGError, OfferExpiredError, type Passenger, PaymentRequiredError, type SearchOptions,
|
|
285
|
+
export { AuthenticationError, type BookingResult, BoostedTravel, type BoostedTravelConfig, BoostedTravelError, type CheckoutProgress, ErrorCategory, type ErrorCategoryType, ErrorCode, type ErrorCodeType, type FlightOffer, type FlightRoute, type FlightSearchResult, type FlightSegment, LetsFG, type LetsFGConfig, LetsFGError, OfferExpiredError, type Passenger, PaymentRequiredError, type SearchOptions, type UnlockResult, ValidationError, cheapestOffer, LetsFG as default, systemInfo as getSystemInfo, searchLocal as localSearch, offerSummary, searchLocal, systemInfo };
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,6 @@ __export(index_exports, {
|
|
|
39
39
|
LetsFGError: () => LetsFGError,
|
|
40
40
|
OfferExpiredError: () => OfferExpiredError,
|
|
41
41
|
PaymentRequiredError: () => PaymentRequiredError,
|
|
42
|
-
StarRequiredError: () => StarRequiredError,
|
|
43
42
|
ValidationError: () => ValidationError,
|
|
44
43
|
cheapestOffer: () => cheapestOffer,
|
|
45
44
|
default: () => index_default,
|
|
@@ -157,12 +156,6 @@ var ValidationError = class extends LetsFGError {
|
|
|
157
156
|
this.name = "ValidationError";
|
|
158
157
|
}
|
|
159
158
|
};
|
|
160
|
-
var StarRequiredError = class extends LetsFGError {
|
|
161
|
-
constructor(message = "GitHub star required. Run: letsfg star --github <your-username>") {
|
|
162
|
-
super(message, 403, {}, "STAR_REQUIRED");
|
|
163
|
-
this.name = "StarRequiredError";
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
159
|
function routeStr(route) {
|
|
167
160
|
if (!route.segments.length) return "";
|
|
168
161
|
const codes = [route.segments[0].origin, ...route.segments.map((s) => s.destination)];
|
|
@@ -213,13 +206,8 @@ async function searchLocal(origin, destination, dateFrom, options = {}) {
|
|
|
213
206
|
child.on("close", (code) => {
|
|
214
207
|
try {
|
|
215
208
|
const data = JSON.parse(stdout);
|
|
216
|
-
if (data.error)
|
|
217
|
-
|
|
218
|
-
reject(new StarRequiredError(data.error));
|
|
219
|
-
} else {
|
|
220
|
-
reject(new LetsFGError(data.error));
|
|
221
|
-
}
|
|
222
|
-
} else resolve(data);
|
|
209
|
+
if (data.error) reject(new LetsFGError(data.error));
|
|
210
|
+
else resolve(data);
|
|
223
211
|
} catch {
|
|
224
212
|
reject(new LetsFGError(
|
|
225
213
|
`Python search failed (code ${code}): ${stdout || stderr}
|
|
@@ -453,6 +441,7 @@ var LetsFG = class {
|
|
|
453
441
|
"Content-Type": "application/json",
|
|
454
442
|
"X-API-Key": this.apiKey,
|
|
455
443
|
"User-Agent": "LetsFG-js/0.1.0",
|
|
444
|
+
"X-Client-Type": "js-sdk",
|
|
456
445
|
...init.headers || {}
|
|
457
446
|
},
|
|
458
447
|
signal: controller.signal
|
|
@@ -523,7 +512,6 @@ var BoostedTravelError = LetsFGError;
|
|
|
523
512
|
LetsFGError,
|
|
524
513
|
OfferExpiredError,
|
|
525
514
|
PaymentRequiredError,
|
|
526
|
-
StarRequiredError,
|
|
527
515
|
ValidationError,
|
|
528
516
|
cheapestOffer,
|
|
529
517
|
getSystemInfo,
|
package/dist/index.mjs
CHANGED
|
@@ -8,14 +8,13 @@ import {
|
|
|
8
8
|
LetsFGError,
|
|
9
9
|
OfferExpiredError,
|
|
10
10
|
PaymentRequiredError,
|
|
11
|
-
StarRequiredError,
|
|
12
11
|
ValidationError,
|
|
13
12
|
cheapestOffer,
|
|
14
13
|
index_default,
|
|
15
14
|
offerSummary,
|
|
16
15
|
searchLocal,
|
|
17
16
|
systemInfo
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GXEB2JO2.mjs";
|
|
19
18
|
export {
|
|
20
19
|
AuthenticationError,
|
|
21
20
|
BoostedTravel,
|
|
@@ -26,7 +25,6 @@ export {
|
|
|
26
25
|
LetsFGError,
|
|
27
26
|
OfferExpiredError,
|
|
28
27
|
PaymentRequiredError,
|
|
29
|
-
StarRequiredError,
|
|
30
28
|
ValidationError,
|
|
31
29
|
cheapestOffer,
|
|
32
30
|
index_default as default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "letsfg",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Agent-native flight search & booking. 195 airline connectors run locally + enterprise GDS/NDC APIs. Built for autonomous AI agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|