@gojinko/cli 1.3.0 → 2.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 +30 -5
- package/dist/commands/checkout.d.ts.map +1 -1
- package/dist/commands/checkout.js +2 -4
- package/dist/commands/checkout.js.map +1 -1
- package/dist/commands/exchange.d.ts.map +1 -1
- package/dist/commands/exchange.js +2 -0
- package/dist/commands/exchange.js.map +1 -1
- package/dist/commands/find-destination.d.ts +5 -0
- package/dist/commands/find-destination.d.ts.map +1 -1
- package/dist/commands/find-destination.js +89 -90
- package/dist/commands/find-destination.js.map +1 -1
- package/dist/commands/find-flight.d.ts.map +1 -1
- package/dist/commands/find-flight.js +45 -33
- package/dist/commands/find-flight.js.map +1 -1
- package/dist/commands/flight-calendar.d.ts.map +1 -1
- package/dist/commands/flight-calendar.js +31 -25
- package/dist/commands/flight-calendar.js.map +1 -1
- package/dist/commands/flight-search.d.ts.map +1 -1
- package/dist/commands/flight-search.js +52 -48
- package/dist/commands/flight-search.js.map +1 -1
- package/dist/commands/get-booking.d.ts.map +1 -1
- package/dist/commands/get-booking.js +16 -7
- package/dist/commands/get-booking.js.map +1 -1
- package/dist/commands/hotel-cancel.d.ts +4 -2
- package/dist/commands/hotel-cancel.d.ts.map +1 -1
- package/dist/commands/hotel-cancel.js +18 -14
- package/dist/commands/hotel-cancel.js.map +1 -1
- package/dist/commands/hotel-search.d.ts.map +1 -1
- package/dist/commands/hotel-search.js +65 -46
- package/dist/commands/hotel-search.js.map +1 -1
- package/dist/commands/price-monitoring.d.ts.map +1 -1
- package/dist/commands/price-monitoring.js +48 -33
- package/dist/commands/price-monitoring.js.map +1 -1
- package/dist/commands/select-ancillaries.d.ts.map +1 -1
- package/dist/commands/select-ancillaries.js +5 -7
- package/dist/commands/select-ancillaries.js.map +1 -1
- package/dist/commands/shared.d.ts +11 -0
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +17 -0
- package/dist/commands/shared.js.map +1 -1
- package/dist/commands/trip-status.d.ts.map +1 -1
- package/dist/commands/trip-status.js +2 -4
- package/dist/commands/trip-status.js.map +1 -1
- package/dist/commands/trip.d.ts.map +1 -1
- package/dist/commands/trip.js +2 -4
- package/dist/commands/trip.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/commands/hotel-lookup-booking.d.ts +0 -7
- package/dist/commands/hotel-lookup-booking.d.ts.map +0 -1
- package/dist/commands/hotel-lookup-booking.js +0 -20
- package/dist/commands/hotel-lookup-booking.js.map +0 -1
package/README.md
CHANGED
|
@@ -66,7 +66,8 @@ jinko auth logout # Clear stored credentials
|
|
|
66
66
|
|
|
67
67
|
| Command | Description |
|
|
68
68
|
|---|---|
|
|
69
|
-
| `get-booking` | Retrieve
|
|
69
|
+
| `get-booking` | Retrieve the whole booking (flight + hotel) by reference (booking ref + last-name guest-auth). No subcommands. (Previously `lookup-booking`, which is kept as a hidden deprecated alias.) |
|
|
70
|
+
| `hotel-cancel` | Cancel a hotel booking (idempotent, safe to retry). Guest auth (`--ref` + `--last-name`) or authenticated shortcut (`--provider-booking-id`). |
|
|
70
71
|
| `refund check` | Check refund eligibility for a booking |
|
|
71
72
|
| `refund commit` | Initiate a refund for a booking |
|
|
72
73
|
| `refund status` | Check the status of a previously committed refund |
|
|
@@ -94,13 +95,13 @@ Quote is automatic — `book` handles it internally. Payment happens on the Jink
|
|
|
94
95
|
|
|
95
96
|
```bash
|
|
96
97
|
# Live flight search by route + dates (returns trip_item_token directly)
|
|
97
|
-
jinko flight-search --
|
|
98
|
+
jinko flight-search --origin PAR --destination NYC --departure-date 2026-06-15
|
|
98
99
|
|
|
99
100
|
# Or price-check an offer_token from flight-calendar
|
|
100
101
|
jinko flight-search --offer-token <offer_token>
|
|
101
102
|
|
|
102
103
|
# Live hotel search (returns htl_* tokens that plug into trip the same way as flight tokens)
|
|
103
|
-
jinko hotel-search --city "Paris" --checkin 2026-07-15 --checkout 2026-07-18 --adults 2
|
|
104
|
+
jinko hotel-search --city-name "Paris" --country-code FR --checkin 2026-07-15 --checkout 2026-07-18 --adults 2
|
|
104
105
|
|
|
105
106
|
# Multi-domain cart: add flight + hotel to the same trip → one Stripe checkout
|
|
106
107
|
jinko trip --trip-item-token <flight_token> # returns trip_id
|
|
@@ -134,8 +135,8 @@ jinko refund commit --booking-ref <ref> --pnr <pnr> --reason "schedule change"
|
|
|
134
135
|
## Output Formats
|
|
135
136
|
|
|
136
137
|
```bash
|
|
137
|
-
jinko flight-search --
|
|
138
|
-
jinko flight-search --
|
|
138
|
+
jinko flight-search --origin PAR --destination NYC --departure-date 2026-06-15
|
|
139
|
+
jinko flight-search --origin PAR --destination NYC --departure-date 2026-06-15 --format table
|
|
139
140
|
```
|
|
140
141
|
|
|
141
142
|
## Schema Introspection
|
|
@@ -144,3 +145,27 @@ jinko flight-search --from PAR --to NYC --date 2026-06-15 --format table
|
|
|
144
145
|
jinko schema # List all tools
|
|
145
146
|
jinko schema flight-search # Show a tool's request/response schema
|
|
146
147
|
```
|
|
148
|
+
|
|
149
|
+
## Canonical flags & deprecated aliases (JIN-665)
|
|
150
|
+
|
|
151
|
+
CLI flags now match the canonical jinko-api request field names, kebab-cased
|
|
152
|
+
(e.g. `departure_dates` → `--departure-dates`, `star_rating`/`min_star_rating`
|
|
153
|
+
→ `--star-rating`). The previous flag spellings keep working as deprecated
|
|
154
|
+
aliases — they print a one-line `DEPRECATED` notice to stderr (never stdout, so
|
|
155
|
+
JSON output stays parseable) and will be removed in the next major release.
|
|
156
|
+
|
|
157
|
+
| Command | Canonical flag | Deprecated alias |
|
|
158
|
+
|---|---|---|
|
|
159
|
+
| `flight-search`, `price-monitoring` | `--origin` / `--destination` | `--from` / `--to` |
|
|
160
|
+
| `flight-search`, `price-monitoring` | `--departure-date` / `--return-date` | `--date` / `--return` |
|
|
161
|
+
| `flight-search`, `price-monitoring` | `--cabin-class` | `--cabin` |
|
|
162
|
+
| `flight-search`, `price-monitoring` | `--adults` | `--passengers` |
|
|
163
|
+
| `flight-calendar`, `find-flight` | `--origins` / `--destinations` | `--from` / `--to` |
|
|
164
|
+
| `find-flight` | `--departure-dates` / `--return-dates` | `--date` / `--return` |
|
|
165
|
+
| `find-flight` | `--cabin-class` / `--sort-by` / `--max-total` | `--cabin` / `--sort` / `--max-price` |
|
|
166
|
+
| `find-destination` | `--origins` / `--departure-dates` / `--max-total` / `--sort-by` … | `--from` / `--date` / `--max-price` / `--sort` … |
|
|
167
|
+
| `hotel-search` | `--city-name` / `--country-code` | `--city` / `--country` |
|
|
168
|
+
| `hotel-search` | `--latitude` / `--longitude` / `--radius-km` | `--lat` / `--lng` / `--radius` |
|
|
169
|
+
| `hotel-search` | `--guest-nationality` | `--nationality` |
|
|
170
|
+
| `hotel-search` | `--star-rating` / `--max-star-rating` | `--stars` / `--max-stars` |
|
|
171
|
+
| `get-booking`, `hotel-cancel` | `--booking-ref` | `--ref` |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAS1D"}
|
|
@@ -5,10 +5,8 @@ export function registerBookCommand(program) {
|
|
|
5
5
|
.description('Book a trip — schedules checkout and returns a Stripe payment URL, plus cart items and available ancillaries.')
|
|
6
6
|
.requiredOption('--trip-id <id>', 'trip ID (from trip command)')
|
|
7
7
|
.action(withClient(async (client, globals, opts) => {
|
|
8
|
-
const response = await client.
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
output(response.data, { format: globals.format });
|
|
8
|
+
const response = await client.book(opts.tripId);
|
|
9
|
+
output(response, { format: globals.format });
|
|
12
10
|
}));
|
|
13
11
|
}
|
|
14
12
|
//# sourceMappingURL=checkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,+GAA+G,CAAC;SAC5H,cAAc,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;SAC/D,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/commands/checkout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,+GAA+G,CAAC;SAC5H,cAAc,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;SAC/D,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../src/commands/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../src/commands/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmF9D"}
|
|
@@ -27,6 +27,7 @@ export function registerExchangeCommand(program) {
|
|
|
27
27
|
.option('--booking-ref <ref>', 'Jinko booking reference (guest auth, requires --last-name)')
|
|
28
28
|
.option('--last-name <name>', 'Last name of the primary traveler (guest auth)')
|
|
29
29
|
.option('--order-id <id>', 'DevPlatform order ID (authenticated auth)')
|
|
30
|
+
.option('--provider <provider>', 'override provider hint')
|
|
30
31
|
.option('--ticket-numbers <numbers...>', 'one or more ticket numbers')
|
|
31
32
|
.action(withClient(async (client, globals, opts) => {
|
|
32
33
|
const response = await client.exchangePrice({
|
|
@@ -43,6 +44,7 @@ export function registerExchangeCommand(program) {
|
|
|
43
44
|
.option('--booking-ref <ref>', 'Jinko booking reference (guest auth, requires --last-name)')
|
|
44
45
|
.option('--last-name <name>', 'Last name of the primary traveler (guest auth)')
|
|
45
46
|
.option('--order-id <id>', 'DevPlatform order ID (authenticated auth)')
|
|
47
|
+
.option('--provider <provider>', 'override provider hint')
|
|
46
48
|
.option('--ticket-numbers <numbers...>', 'one or more ticket numbers')
|
|
47
49
|
.action(withClient(async (client, globals, opts) => {
|
|
48
50
|
const response = await client.exchangeCommit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/commands/exchange.ts"],"names":[],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AAgD,CAAC;SAC9E,MAAM,CAAC,iBAAiB,EAAE,2CAA2C,CAAC;SACtE,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;SACzD,MAAM,CACL,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzC,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC;YAC3C,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;YAC/C,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;YACxD,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClD,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;SAClD,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -38,6 +38,11 @@ export interface FindDestinationOpts {
|
|
|
38
38
|
sort?: string;
|
|
39
39
|
}
|
|
40
40
|
export declare function applyDeprecatedAliases(opts: FindDestinationOpts): void;
|
|
41
|
+
/**
|
|
42
|
+
* Build the canonical FLAT find_destination body for jinko-api
|
|
43
|
+
* (POST /v1/find_destination). Every CLI flag maps 1:1 to a top-level JSON
|
|
44
|
+
* field — no nested `filters` / `passengers` wrapper any more.
|
|
45
|
+
*/
|
|
41
46
|
export declare function buildRequestBody(opts: FindDestinationOpts): Record<string, unknown>;
|
|
42
47
|
export declare function registerFindDestinationCommand(program: Command): void;
|
|
43
48
|
//# sourceMappingURL=find-destination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-destination.d.ts","sourceRoot":"","sources":["../../src/commands/find-destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"find-destination.d.ts","sourceRoot":"","sources":["../../src/commands/find-destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,MAAM,WAAW,mBAAmB;IAElC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA8CD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAiCtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkEnF;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwIrE"}
|
|
@@ -3,7 +3,7 @@ const DESCRIPTION = 'Discover travel destinations accessible from your departure
|
|
|
3
3
|
'Surface inspiration when a user knows where they want to leave from but not where they want to go. ' +
|
|
4
4
|
"Typical prompts include 'cheap beach getaways from New York' or 'weekend trips out of London under €200'. " +
|
|
5
5
|
'Results come back ranked by lowest available fare so the user can compare options before committing to a route. ' +
|
|
6
|
-
'Same call as `POST /
|
|
6
|
+
'Same call as `POST /v1/find_destination` — every CLI flag maps 1:1 to a JSON field.';
|
|
7
7
|
function parseDateRange(raw) {
|
|
8
8
|
const [start, end] = raw.split(':');
|
|
9
9
|
if (!start || !end) {
|
|
@@ -22,48 +22,34 @@ function warn(msg) {
|
|
|
22
22
|
process.stderr.write(`[jinko] DEPRECATED: ${msg}\n`);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* names (what users learn) and the BFF's current legacy leaf names.
|
|
25
|
+
* Apply canonical passenger fields onto a flat jinko-api request body.
|
|
27
26
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* Wave 6 (JIN-665): the public surface is FLAT and uses canonical leaf names
|
|
28
|
+
* (`adults`, `children`, `infants_in_lap`, …) at the top level — the BFF's
|
|
29
|
+
* legacy nested `passengers.adt` shape is gone from the client contract. This
|
|
30
|
+
* mutates `body` in place for brevity; the caller owns a fresh object.
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
|
-
adults: 'adt',
|
|
35
|
-
children: 'chd',
|
|
36
|
-
infants_in_lap: 'inf_lap',
|
|
37
|
-
infants_in_seat: 'inf_seat',
|
|
38
|
-
};
|
|
39
|
-
function buildPassengers(opts) {
|
|
40
|
-
const canonical = {};
|
|
32
|
+
function applyPassengers(body, opts) {
|
|
41
33
|
if (opts.adults !== undefined)
|
|
42
|
-
|
|
34
|
+
body.adults = Number(opts.adults);
|
|
43
35
|
if (opts.children !== undefined)
|
|
44
|
-
|
|
36
|
+
body.children = Number(opts.children);
|
|
45
37
|
if (opts.infantsInLap !== undefined)
|
|
46
|
-
|
|
38
|
+
body.infants_in_lap = Number(opts.infantsInLap);
|
|
47
39
|
if (opts.infantsInSeat !== undefined)
|
|
48
|
-
|
|
40
|
+
body.infants_in_seat = Number(opts.infantsInSeat);
|
|
49
41
|
if (opts.youth !== undefined)
|
|
50
|
-
|
|
42
|
+
body.youth = Number(opts.youth);
|
|
51
43
|
if (opts.student !== undefined)
|
|
52
|
-
|
|
44
|
+
body.student = Number(opts.student);
|
|
53
45
|
if (opts.ages?.length)
|
|
54
|
-
|
|
46
|
+
body.ages = opts.ages.map(Number);
|
|
55
47
|
if (opts.residencyCountry)
|
|
56
|
-
|
|
57
|
-
// Default to one adult so
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
// Apply Phase 1 legacy translation (adults→adt etc.). See PHASE_1_PASSENGER_LEGACY.
|
|
62
|
-
const out = {};
|
|
63
|
-
for (const [key, value] of Object.entries(canonical)) {
|
|
64
|
-
out[PHASE_1_PASSENGER_LEGACY[key] ?? key] = value;
|
|
48
|
+
body.residency_country = opts.residencyCountry;
|
|
49
|
+
// Default to one adult so the request isn't rejected for missing pax.
|
|
50
|
+
if (body.adults === undefined && body.children === undefined) {
|
|
51
|
+
body.adults = 1;
|
|
65
52
|
}
|
|
66
|
-
return out;
|
|
67
53
|
}
|
|
68
54
|
export function applyDeprecatedAliases(opts) {
|
|
69
55
|
if (opts.from && !opts.origins) {
|
|
@@ -99,59 +85,74 @@ export function applyDeprecatedAliases(opts) {
|
|
|
99
85
|
opts.sortBy = opts.sort;
|
|
100
86
|
}
|
|
101
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Build the canonical FLAT find_destination body for jinko-api
|
|
90
|
+
* (POST /v1/find_destination). Every CLI flag maps 1:1 to a top-level JSON
|
|
91
|
+
* field — no nested `filters` / `passengers` wrapper any more.
|
|
92
|
+
*/
|
|
102
93
|
export function buildRequestBody(opts) {
|
|
103
94
|
if (!opts.origins || opts.origins.length === 0) {
|
|
104
95
|
throw new Error('Missing required option: --origins.');
|
|
105
96
|
}
|
|
106
|
-
const
|
|
97
|
+
const body = { origins: opts.origins };
|
|
98
|
+
// Locations
|
|
107
99
|
if (opts.destinations?.length)
|
|
108
|
-
|
|
100
|
+
body.destinations = opts.destinations;
|
|
109
101
|
if (opts.originType)
|
|
110
|
-
|
|
102
|
+
body.origin_type = opts.originType;
|
|
111
103
|
if (opts.destinationType)
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
body.destination_type = opts.destinationType;
|
|
105
|
+
// Dates
|
|
114
106
|
if (opts.departureDates?.length)
|
|
115
|
-
|
|
107
|
+
body.departure_dates = opts.departureDates;
|
|
116
108
|
if (opts.departureDateRanges?.length) {
|
|
117
|
-
|
|
109
|
+
body.departure_date_ranges = opts.departureDateRanges.map(parseDateRange);
|
|
118
110
|
}
|
|
119
111
|
if (opts.returnDates?.length)
|
|
120
|
-
|
|
112
|
+
body.return_dates = opts.returnDates;
|
|
121
113
|
if (opts.returnDateRanges?.length) {
|
|
122
|
-
|
|
114
|
+
body.return_date_ranges = opts.returnDateRanges.map(parseDateRange);
|
|
123
115
|
}
|
|
124
116
|
if (opts.stayDays !== undefined)
|
|
125
|
-
|
|
117
|
+
body.stay_days = Number(opts.stayDays);
|
|
126
118
|
if (opts.stayDaysRange)
|
|
127
|
-
|
|
128
|
-
//
|
|
129
|
-
|
|
119
|
+
body.stay_days_range = parseIntRange(opts.stayDaysRange);
|
|
120
|
+
// find_destination REQUIRES at least one date — default to the next 12
|
|
121
|
+
// months when none was given.
|
|
122
|
+
const hasDate = body.departure_dates ||
|
|
123
|
+
body.departure_date_ranges ||
|
|
124
|
+
body.return_dates ||
|
|
125
|
+
body.return_date_ranges ||
|
|
126
|
+
body.stay_days ||
|
|
127
|
+
body.stay_days_range;
|
|
128
|
+
if (!hasDate) {
|
|
130
129
|
const today = new Date();
|
|
131
130
|
const start = today.toISOString().slice(0, 10);
|
|
132
131
|
const end = new Date(today.getFullYear() + 1, today.getMonth(), today.getDate())
|
|
133
|
-
.toISOString()
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
.toISOString()
|
|
133
|
+
.slice(0, 10);
|
|
134
|
+
body.departure_date_ranges = [{ start, end }];
|
|
135
|
+
}
|
|
136
|
+
// Trip + filters
|
|
137
|
+
body.trip_type =
|
|
138
|
+
opts.tripType ??
|
|
139
|
+
(opts.returnDates?.length || opts.returnDateRanges?.length ? 'roundtrip' : 'oneway');
|
|
139
140
|
if (opts.cabinClass)
|
|
140
|
-
|
|
141
|
+
body.cabin_class = opts.cabinClass;
|
|
141
142
|
if (opts.directOnly)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
// Phase 1 legacy: BFF leaf is `sort`; CLI canonical is `--sort-by`.
|
|
147
|
-
sort: opts.sortBy,
|
|
148
|
-
limit: Number(opts.limit) || 20,
|
|
149
|
-
flights_per_destination: opts.flightsPerDestination
|
|
150
|
-
? Number(opts.flightsPerDestination)
|
|
151
|
-
: 1,
|
|
152
|
-
};
|
|
143
|
+
body.direct_only = true;
|
|
144
|
+
// Passengers (canonical flat leaf names)
|
|
145
|
+
applyPassengers(body, opts);
|
|
146
|
+
// Price
|
|
153
147
|
if (opts.maxTotal)
|
|
154
|
-
body.
|
|
148
|
+
body.max_total = Number(opts.maxTotal);
|
|
149
|
+
// Presentation + pagination
|
|
150
|
+
if (opts.sortBy)
|
|
151
|
+
body.sort_by = opts.sortBy;
|
|
152
|
+
body.limit = Number(opts.limit) || 20;
|
|
153
|
+
body.flights_per_destination = opts.flightsPerDestination
|
|
154
|
+
? Number(opts.flightsPerDestination)
|
|
155
|
+
: 1;
|
|
155
156
|
if (opts.currency)
|
|
156
157
|
body.currency = opts.currency;
|
|
157
158
|
if (opts.locale)
|
|
@@ -165,39 +166,39 @@ export function registerFindDestinationCommand(program) {
|
|
|
165
166
|
.command('find-destination')
|
|
166
167
|
.description(DESCRIPTION)
|
|
167
168
|
// Location
|
|
168
|
-
.option('--origins <codes...>', 'IATA airport or city codes (e.g. JFK LGA). JSON: `
|
|
169
|
-
.option('--destinations <codes...>', 'IATA airport or city codes to filter to. Omit for global discovery. JSON: `
|
|
170
|
-
.option('--origin-type <type>', 'How to interpret --origins: `city` or `airport` (default: `city`). JSON: `
|
|
171
|
-
.option('--destination-type <type>', 'How to interpret --destinations: `city` or `airport` (default: `city`). JSON: `
|
|
169
|
+
.option('--origins <codes...>', 'IATA airport or city codes (e.g. JFK LGA). JSON: `origins[]`. Required.')
|
|
170
|
+
.option('--destinations <codes...>', 'IATA airport or city codes to filter to. Omit for global discovery. JSON: `destinations[]`.')
|
|
171
|
+
.option('--origin-type <type>', 'How to interpret --origins: `city` or `airport` (default: `city`). JSON: `origin_type`.')
|
|
172
|
+
.option('--destination-type <type>', 'How to interpret --destinations: `city` or `airport` (default: `city`). JSON: `destination_type`.')
|
|
172
173
|
// Dates
|
|
173
|
-
.option('--departure-dates <dates...>', 'Exact departure dates (YYYY-MM-DD), OR logic. JSON: `
|
|
174
|
-
.option('--departure-date-ranges <ranges...>', 'Flexible departure ranges, repeatable. Format: `YYYY-MM-DD:YYYY-MM-DD`. JSON: `
|
|
175
|
-
.option('--return-dates <dates...>', 'Exact return dates (YYYY-MM-DD), roundtrip only. JSON: `
|
|
176
|
-
.option('--return-date-ranges <ranges...>', 'Flexible return ranges, roundtrip only. Format: `YYYY-MM-DD:YYYY-MM-DD`. JSON: `
|
|
177
|
-
.option('--stay-days <n>', 'Exact stay length in days. JSON: `
|
|
178
|
-
.option('--stay-days-range <min:max>', 'Flexible stay range, e.g. `5:10`. JSON: `
|
|
174
|
+
.option('--departure-dates <dates...>', 'Exact departure dates (YYYY-MM-DD), OR logic. JSON: `departure_dates[]`.')
|
|
175
|
+
.option('--departure-date-ranges <ranges...>', 'Flexible departure ranges, repeatable. Format: `YYYY-MM-DD:YYYY-MM-DD`. JSON: `departure_date_ranges[]`.')
|
|
176
|
+
.option('--return-dates <dates...>', 'Exact return dates (YYYY-MM-DD), roundtrip only. JSON: `return_dates[]`.')
|
|
177
|
+
.option('--return-date-ranges <ranges...>', 'Flexible return ranges, roundtrip only. Format: `YYYY-MM-DD:YYYY-MM-DD`. JSON: `return_date_ranges[]`.')
|
|
178
|
+
.option('--stay-days <n>', 'Exact stay length in days. JSON: `stay_days`.')
|
|
179
|
+
.option('--stay-days-range <min:max>', 'Flexible stay range, e.g. `5:10`. JSON: `stay_days_range`.')
|
|
179
180
|
// Trip + filters
|
|
180
|
-
.option('--trip-type <type>', '`oneway` or `roundtrip` (inferred from --return-dates if omitted). JSON: `
|
|
181
|
-
.option('--cabin-class <class>', '`economy`, `premium_economy`, `business`, or `first` (default: `economy`). JSON: `
|
|
182
|
-
.option('--direct-only', 'Only return nonstop flights. JSON: `
|
|
183
|
-
// Passengers (canonical
|
|
184
|
-
.option('--adults <n>', 'Adult passengers (default: 1). JSON: `
|
|
185
|
-
.option('--children <n>', 'Child passengers. JSON: `
|
|
186
|
-
.option('--infants-in-lap <n>', 'Infants on lap (no seat). JSON: `
|
|
187
|
-
.option('--infants-in-seat <n>', 'Infants in own seat. JSON: `
|
|
181
|
+
.option('--trip-type <type>', '`oneway` or `roundtrip` (inferred from --return-dates if omitted). JSON: `trip_type`.')
|
|
182
|
+
.option('--cabin-class <class>', '`economy`, `premium_economy`, `business`, or `first` (default: `economy`). JSON: `cabin_class`.', 'economy')
|
|
183
|
+
.option('--direct-only', 'Only return nonstop flights. JSON: `direct_only`.')
|
|
184
|
+
// Passengers (canonical flat leaf names).
|
|
185
|
+
.option('--adults <n>', 'Adult passengers (default: 1). JSON: `adults`.')
|
|
186
|
+
.option('--children <n>', 'Child passengers. JSON: `children`.')
|
|
187
|
+
.option('--infants-in-lap <n>', 'Infants on lap (no seat). JSON: `infants_in_lap`.')
|
|
188
|
+
.option('--infants-in-seat <n>', 'Infants in own seat. JSON: `infants_in_seat`.')
|
|
188
189
|
.option('--youth <n>', 'Youth fare. JSON: `passengers.youth`.')
|
|
189
190
|
.option('--student <n>', 'Student fare. JSON: `passengers.student`.')
|
|
190
|
-
.option('--ages <ages...>', 'Explicit ages array (alternative to counts). JSON: `
|
|
191
|
-
.option('--residency-country <iso2>', 'Residency country, ISO 3166-1 alpha-2. JSON: `
|
|
191
|
+
.option('--ages <ages...>', 'Explicit ages array (alternative to counts). JSON: `ages[]`.')
|
|
192
|
+
.option('--residency-country <iso2>', 'Residency country, ISO 3166-1 alpha-2. JSON: `residency_country`.')
|
|
192
193
|
// Price
|
|
193
|
-
.option('--max-total <amount>', 'Maximum total price in --currency. JSON: `
|
|
194
|
+
.option('--max-total <amount>', 'Maximum total price in --currency. JSON: `max_total`.')
|
|
194
195
|
// Presentation + pagination
|
|
195
196
|
.option('--currency <code>', 'ISO 4217 currency code (default: USD). JSON: `currency`.')
|
|
196
197
|
.option('--locale <bcp47>', 'BCP 47 locale, e.g. `en-US`, `fr-FR` (default: `en-US`). JSON: `locale`.')
|
|
197
198
|
.option('--limit <n>', 'Maximum destinations (1-100, default 20). JSON: `limit`.', '20')
|
|
198
199
|
.option('--offset <n>', 'Pagination offset (default 0). JSON: `offset`.')
|
|
199
200
|
.option('--flights-per-destination <n>', 'Itineraries per destination (1-10, default 1). JSON: `flights_per_destination`.')
|
|
200
|
-
.option('--sort-by <strategy>', '`lowest` or `recommendation` (default: `lowest`). JSON: `
|
|
201
|
+
.option('--sort-by <strategy>', '`lowest` or `recommendation` (default: `lowest`). JSON: `sort_by`.', 'lowest')
|
|
201
202
|
// Deprecated aliases — Phase 1 transition, remove in next major.
|
|
202
203
|
.option('--from <origins...>', 'DEPRECATED: use --origins.')
|
|
203
204
|
.option('--date <date>', 'DEPRECATED: use --departure-dates.')
|
|
@@ -210,10 +211,8 @@ export function registerFindDestinationCommand(program) {
|
|
|
210
211
|
.action(withClient(async (client, globals, opts) => {
|
|
211
212
|
applyDeprecatedAliases(opts);
|
|
212
213
|
const body = buildRequestBody(opts);
|
|
213
|
-
const response = await client.
|
|
214
|
-
|
|
215
|
-
});
|
|
216
|
-
output(response.data, { format: globals.format });
|
|
214
|
+
const response = await client.findDestination(body);
|
|
215
|
+
output(response, { format: globals.format });
|
|
217
216
|
}));
|
|
218
217
|
}
|
|
219
218
|
//# sourceMappingURL=find-destination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-destination.js","sourceRoot":"","sources":["../../src/commands/find-destination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-destination.js","sourceRoot":"","sources":["../../src/commands/find-destination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,GACf,wEAAwE;IACxE,qGAAqG;IACrG,4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AK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAyB,EAAE,EAAE;QAC9D,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,IAAsC,CAAC,CAAC;QACtF,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-flight.d.ts","sourceRoot":"","sources":["../../src/commands/find-flight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"find-flight.d.ts","sourceRoot":"","sources":["../../src/commands/find-flight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8DhE"}
|
|
@@ -1,43 +1,55 @@
|
|
|
1
|
-
import { withClient, output } from './shared.js';
|
|
1
|
+
import { withClient, output, resolveDeprecatedFlag } from './shared.js';
|
|
2
2
|
export function registerFindFlightCommand(program) {
|
|
3
3
|
program
|
|
4
4
|
.command('find-flight')
|
|
5
5
|
.description('[legacy] Cached flight search by route + dates. Prefer `flight-search` — it returns live pricing and a bookable trip_item_token in one step.')
|
|
6
|
-
|
|
7
|
-
.
|
|
8
|
-
.
|
|
9
|
-
.option('--
|
|
10
|
-
.option('--
|
|
11
|
-
.option('--
|
|
12
|
-
.option('--
|
|
13
|
-
.option('--
|
|
14
|
-
.option('--
|
|
6
|
+
// Canonical flat discovery flags — match jinko-api FlightDiscoveryRequest.
|
|
7
|
+
.option('--origins <codes...>', 'origin IATA airport/city codes (e.g. PAR). JSON: `origins[]`.')
|
|
8
|
+
.option('--destinations <codes...>', 'destination IATA airport/city codes (e.g. NYC). JSON: `destinations[]`.')
|
|
9
|
+
.option('--departure-dates <dates...>', 'departure dates (YYYY-MM-DD). JSON: `departure_dates[]`.')
|
|
10
|
+
.option('--return-dates <dates...>', 'return dates for round-trip (YYYY-MM-DD). JSON: `return_dates[]`.')
|
|
11
|
+
.option('--cabin-class <class>', 'cabin class: economy, premium_economy, business, first (default: economy). JSON: `cabin_class`.')
|
|
12
|
+
.option('--direct-only', 'only show direct flights. JSON: `direct_only`.')
|
|
13
|
+
.option('--max-total <amount>', 'maximum total price filter. JSON: `max_total`.')
|
|
14
|
+
.option('--sort-by <strategy>', 'sort: lowest, recommendation (default: lowest). JSON: `sort_by`.')
|
|
15
|
+
.option('--limit <n>', 'max results. JSON: `limit`.', '10')
|
|
16
|
+
// Deprecated aliases — Phase 1 transition (JIN-665), remove in next major.
|
|
17
|
+
.option('--from <origin>', 'DEPRECATED: use --origins.')
|
|
18
|
+
.option('--to <destination>', 'DEPRECATED: use --destinations.')
|
|
19
|
+
.option('--date <date>', 'DEPRECATED: use --departure-dates.')
|
|
20
|
+
.option('--return <date>', 'DEPRECATED: use --return-dates.')
|
|
21
|
+
.option('--cabin <class>', 'DEPRECATED: use --cabin-class.')
|
|
22
|
+
.option('--max-price <amount>', 'DEPRECATED: use --max-total.')
|
|
23
|
+
.option('--sort <strategy>', 'DEPRECATED: use --sort-by.')
|
|
15
24
|
.action(withClient(async (client, globals, opts) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
// Resolve deprecated aliases onto canonical flags.
|
|
26
|
+
const origins = resolveDeprecatedFlag(opts.origins, opts.from ? [opts.from] : undefined, '--from', '--origins');
|
|
27
|
+
const destinations = resolveDeprecatedFlag(opts.destinations, opts.to ? [opts.to] : undefined, '--to', '--destinations');
|
|
28
|
+
const departureDates = resolveDeprecatedFlag(opts.departureDates, opts.date ? [opts.date] : undefined, '--date', '--departure-dates');
|
|
29
|
+
const returnDates = resolveDeprecatedFlag(opts.returnDates, opts.return ? [opts.return] : undefined, '--return', '--return-dates');
|
|
30
|
+
const cabinClass = resolveDeprecatedFlag(opts.cabinClass, opts.cabin, '--cabin', '--cabin-class') ?? 'economy';
|
|
31
|
+
const maxTotal = resolveDeprecatedFlag(opts.maxTotal, opts.maxPrice, '--max-price', '--max-total');
|
|
32
|
+
const sortBy = resolveDeprecatedFlag(opts.sortBy, opts.sort, '--sort', '--sort-by') ?? 'lowest';
|
|
33
|
+
if (!origins?.length || !destinations?.length || !departureDates?.length) {
|
|
34
|
+
console.error('Error: --origins, --destinations, and --departure-dates are required.');
|
|
35
|
+
process.exit(3);
|
|
36
|
+
}
|
|
37
|
+
// Canonical FLAT discovery body — jinko-api POST /v1/flight_calendar.
|
|
38
|
+
const request = {
|
|
39
|
+
origins,
|
|
40
|
+
destinations,
|
|
41
|
+
departure_dates: departureDates,
|
|
42
|
+
...(returnDates?.length ? { return_dates: returnDates } : {}),
|
|
43
|
+
trip_type: returnDates?.length ? 'roundtrip' : 'oneway',
|
|
44
|
+
cabin_class: cabinClass,
|
|
45
|
+
direct_only: opts.directOnly ?? false,
|
|
46
|
+
adults: 1,
|
|
47
|
+
sort_by: sortBy,
|
|
32
48
|
limit: Number(opts.limit) || 10,
|
|
49
|
+
...(maxTotal ? { max_total: Number(maxTotal) } : {}),
|
|
33
50
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const response = await client.raw.POST('/api/v1/flights/search', {
|
|
38
|
-
body,
|
|
39
|
-
});
|
|
40
|
-
output(response.data, { format: globals.format });
|
|
51
|
+
const response = await client.findFlight(request);
|
|
52
|
+
output(response, { format: globals.format });
|
|
41
53
|
}));
|
|
42
54
|
}
|
|
43
55
|
//# sourceMappingURL=find-flight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-flight.js","sourceRoot":"","sources":["../../src/commands/find-flight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find-flight.js","sourceRoot":"","sources":["../../src/commands/find-flight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,8IAA8I,CAAC;QAC5J,2EAA2E;SAC1E,MAAM,CAAC,sBAAsB,EAAE,+DAA+D,CAAC;SAC/F,MAAM,CAAC,2BAA2B,EAAE,yEAAyE,CAAC;SAC9G,MAAM,CAAC,8BAA8B,EAAE,0DAA0D,CAAC;SAClG,MAAM,CAAC,2BAA2B,EAAE,mEAAmE,CAAC;SACxG,MAAM,CAAC,uBAAuB,EAAE,iGAAiG,CAAC;SAClI,MAAM,CAAC,eAAe,EAAE,gDAAgD,CAAC;SACzE,MAAM,CAAC,sBAAsB,EAAE,gDAAgD,CAAC;SAChF,MAAM,CAAC,sBAAsB,EAAE,kEAAkE,CAAC;SAClG,MAAM,CAAC,aAAa,EAAE,6BAA6B,EAAE,IAAI,CAAC;QAC3D,2EAA2E;SAC1E,MAAM,CAAC,iBAAiB,EAAE,4BAA4B,CAAC;SACvD,MAAM,CAAC,oBAAoB,EAAE,iCAAiC,CAAC;SAC/D,MAAM,CAAC,eAAe,EAAE,oCAAoC,CAAC;SAC7D,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC;SAC5D,MAAM,CAAC,iBAAiB,EAAE,gCAAgC,CAAC;SAC3D,MAAM,CAAC,sBAAsB,EAAE,8BAA8B,CAAC;SAC9D,MAAM,CAAC,mBAAmB,EAAE,4BAA4B,CAAC;SACzD,MAAM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EnF,IAAI,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;YACzE,OAAO,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,sEAAsE;QACtE,MAAM,OAAO,GAAsB;YACjC,OAAO;YACP,YAAY;YACZ,eAAe,EAAE,cAAc;YAC/B,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7D,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ;YACvD,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK;YACrC,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,MAAM;YACf,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YAC/B,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACrD,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flight-calendar.d.ts","sourceRoot":"","sources":["../../src/commands/flight-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"flight-calendar.d.ts","sourceRoot":"","sources":["../../src/commands/flight-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6DpE"}
|