@gojinko/cli 2.22.1 → 2.24.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 +66 -10
- package/SKILL.md +28 -14
- package/dist/commands/agent-pay.d.ts.map +1 -1
- package/dist/commands/agent-pay.js +2 -1
- package/dist/commands/agent-pay.js.map +1 -1
- package/dist/commands/auth/index.d.ts.map +1 -1
- package/dist/commands/auth/index.js +51 -83
- package/dist/commands/auth/index.js.map +1 -1
- package/dist/commands/auth/prompt.d.ts +0 -9
- package/dist/commands/auth/prompt.d.ts.map +1 -1
- package/dist/commands/auth/prompt.js +0 -18
- package/dist/commands/auth/prompt.js.map +1 -1
- package/dist/commands/checkout.d.ts.map +1 -1
- package/dist/commands/checkout.js +8 -1
- package/dist/commands/checkout.js.map +1 -1
- package/dist/commands/exchange.d.ts.map +1 -1
- package/dist/commands/exchange.js +16 -18
- package/dist/commands/exchange.js.map +1 -1
- package/dist/commands/find-dates.d.ts.map +1 -1
- package/dist/commands/find-dates.js +2 -1
- package/dist/commands/find-dates.js.map +1 -1
- package/dist/commands/find-destination.d.ts.map +1 -1
- package/dist/commands/find-destination.js +2 -1
- package/dist/commands/find-destination.js.map +1 -1
- package/dist/commands/flight-calendar.d.ts.map +1 -1
- package/dist/commands/flight-calendar.js +2 -1
- package/dist/commands/flight-calendar.js.map +1 -1
- package/dist/commands/flight-search.d.ts +106 -0
- package/dist/commands/flight-search.d.ts.map +1 -1
- package/dist/commands/flight-search.js +452 -45
- 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 +3 -2
- package/dist/commands/get-booking.js.map +1 -1
- package/dist/commands/ground-search.d.ts +62 -0
- package/dist/commands/ground-search.d.ts.map +1 -0
- package/dist/commands/ground-search.js +236 -0
- package/dist/commands/ground-search.js.map +1 -0
- package/dist/commands/hotel-cancel.d.ts.map +1 -1
- package/dist/commands/hotel-cancel.js +3 -2
- package/dist/commands/hotel-cancel.js.map +1 -1
- package/dist/commands/hotel-search.d.ts +30 -0
- package/dist/commands/hotel-search.d.ts.map +1 -1
- package/dist/commands/hotel-search.js +83 -47
- package/dist/commands/hotel-search.js.map +1 -1
- package/dist/commands/lowest-fare.d.ts.map +1 -1
- package/dist/commands/lowest-fare.js +2 -1
- package/dist/commands/lowest-fare.js.map +1 -1
- package/dist/commands/price-monitoring.d.ts.map +1 -1
- package/dist/commands/price-monitoring.js +2 -1
- package/dist/commands/price-monitoring.js.map +1 -1
- package/dist/commands/refund.d.ts +7 -27
- package/dist/commands/refund.d.ts.map +1 -1
- package/dist/commands/refund.js +17 -52
- package/dist/commands/refund.js.map +1 -1
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +97 -27
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/select-ancillaries.d.ts.map +1 -1
- package/dist/commands/select-ancillaries.js +2 -1
- package/dist/commands/select-ancillaries.js.map +1 -1
- package/dist/commands/shared.d.ts +14 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +24 -2
- 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 -0
- package/dist/commands/trip-status.js.map +1 -1
- package/dist/commands/trip.d.ts.map +1 -1
- package/dist/commands/trip.js +4 -1
- package/dist/commands/trip.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/output/formatter.d.ts +19 -7
- package/dist/output/formatter.d.ts.map +1 -1
- package/dist/output/formatter.js +22 -8
- package/dist/output/formatter.js.map +1 -1
- package/dist/output/price-change.d.ts +45 -0
- package/dist/output/price-change.d.ts.map +1 -0
- package/dist/output/price-change.js +86 -0
- package/dist/output/price-change.js.map +1 -0
- package/dist/output/remedies.d.ts +30 -0
- package/dist/output/remedies.d.ts.map +1 -0
- package/dist/output/remedies.js +45 -0
- package/dist/output/remedies.js.map +1 -0
- package/package.json +3 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withClient, output, resolveDeprecatedFlag } from './shared.js';
|
|
1
|
+
import { withClient, output, resolveDeprecatedFlag, userIntentOption } from './shared.js';
|
|
2
2
|
// price_monitoring — cache-only flight price snapshot for a fixed OD +
|
|
3
3
|
// dates pair. JIN-256. Intended to be wired into a cron / scheduled job
|
|
4
4
|
// so partners can track a route over time. On cache miss the surface returns
|
|
@@ -25,6 +25,7 @@ export function registerPriceMonitoringCommand(program) {
|
|
|
25
25
|
.option('--max-price <amount>', 'upper bound on total fare. JSON: `max_price`.')
|
|
26
26
|
.option('--include-carriers <codes...>', 'whitelist IATA 2-letter carrier codes (e.g. AF KL). JSON: `include_carriers`.')
|
|
27
27
|
.option('--exclude-carriers <codes...>', 'blacklist IATA 2-letter carrier codes (e.g. FR U2). JSON: `exclude_carriers`.')
|
|
28
|
+
.addOption(userIntentOption())
|
|
28
29
|
// Deprecated aliases — Phase 1 transition (JIN-665), remove in next major.
|
|
29
30
|
.option('--from <origin>', 'DEPRECATED: use --origin.')
|
|
30
31
|
.option('--to <destination>', 'DEPRECATED: use --destination.')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price-monitoring.js","sourceRoot":"","sources":["../../src/commands/price-monitoring.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"price-monitoring.js","sourceRoot":"","sources":["../../src/commands/price-monitoring.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1F,uEAAuE;AACvE,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,6DAA6D;AAC7D,EAAE;AACF,8EAA8E;AAC9E,2DAA2D;AAC3D,MAAM,UAAU,8BAA8B,C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C,CAAC,CAAC,EAAE,CAAC;YAClD,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClD,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACjD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3E,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5E,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAEvD,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CACH,CAAC;AACN,CAAC"}
|
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* never propagate to the BFF as opaque 400s.
|
|
3
|
+
* Build a refund/exchange request body from CLI options.
|
|
5
4
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* - Guest: --booking-ref + --last-name (both required together)
|
|
9
|
-
*
|
|
10
|
-
* Throws a Commander-friendly string error (matches Commander's `.error()` /
|
|
11
|
-
* thrown-string conventions) on invalid input.
|
|
12
|
-
*/
|
|
13
|
-
export declare function validateAuthFields(opts: {
|
|
14
|
-
bookingRef?: string;
|
|
15
|
-
lastName?: string;
|
|
16
|
-
orderId?: string;
|
|
17
|
-
}): void;
|
|
18
|
-
/**
|
|
19
|
-
* Build a refund request body from CLI options, picking the right auth mode.
|
|
20
|
-
*
|
|
21
|
-
* Guest auth: --booking-ref + --last-name (public; validated by BFF).
|
|
22
|
-
* Authenticated: --order-id (DevPlatform OAuth / jnk_* keys).
|
|
23
|
-
*
|
|
24
|
-
* Exactly one mode must be provided — the BFF rejects mixed combinations.
|
|
5
|
+
* Auth is always `booking_ref` + `last_name` (required by the public spec —
|
|
6
|
+
* Commander enforces both via `requiredOption`, so they are guaranteed here).
|
|
25
7
|
*/
|
|
26
8
|
export declare function buildAuthFields(opts: {
|
|
27
|
-
bookingRef
|
|
28
|
-
lastName
|
|
29
|
-
orderId?: string;
|
|
9
|
+
bookingRef: string;
|
|
10
|
+
lastName: string;
|
|
30
11
|
provider?: string;
|
|
31
12
|
ticketNumbers?: string[];
|
|
32
13
|
}): {
|
|
33
14
|
ticket_numbers?: string[] | undefined;
|
|
34
15
|
provider?: string | undefined;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
order_id?: string | undefined;
|
|
16
|
+
booking_ref: string;
|
|
17
|
+
last_name: string;
|
|
38
18
|
};
|
|
39
19
|
export declare function registerRefundCommand(program: Command): void;
|
|
40
20
|
//# sourceMappingURL=refund.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../src/commands/refund.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"refund.d.ts","sourceRoot":"","sources":["../../src/commands/refund.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;;;;;EAOA;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyD5D"}
|
package/dist/commands/refund.js
CHANGED
|
@@ -1,47 +1,14 @@
|
|
|
1
|
-
import { withClient, output } from './shared.js';
|
|
2
|
-
const AUTH_MODE_ERROR = 'Provide either --order-id OR both --booking-ref and --last-name (guest mode). Exactly one auth mode is required.';
|
|
1
|
+
import { withClient, output, userIntentOption } from './shared.js';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
* never propagate to the BFF as opaque 400s.
|
|
3
|
+
* Build a refund/exchange request body from CLI options.
|
|
6
4
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - Guest: --booking-ref + --last-name (both required together)
|
|
10
|
-
*
|
|
11
|
-
* Throws a Commander-friendly string error (matches Commander's `.error()` /
|
|
12
|
-
* thrown-string conventions) on invalid input.
|
|
13
|
-
*/
|
|
14
|
-
export function validateAuthFields(opts) {
|
|
15
|
-
const hasOrderId = Boolean(opts.orderId);
|
|
16
|
-
const hasBookingRef = Boolean(opts.bookingRef);
|
|
17
|
-
const hasLastName = Boolean(opts.lastName);
|
|
18
|
-
const hasGuestPair = hasBookingRef && hasLastName;
|
|
19
|
-
const hasPartialGuest = (hasBookingRef || hasLastName) && !hasGuestPair;
|
|
20
|
-
if (hasOrderId && (hasBookingRef || hasLastName)) {
|
|
21
|
-
throw new Error(AUTH_MODE_ERROR);
|
|
22
|
-
}
|
|
23
|
-
if (!hasOrderId && !hasGuestPair) {
|
|
24
|
-
throw new Error(AUTH_MODE_ERROR);
|
|
25
|
-
}
|
|
26
|
-
if (hasPartialGuest) {
|
|
27
|
-
// Unreachable given the two checks above, but kept explicit for readability.
|
|
28
|
-
throw new Error(AUTH_MODE_ERROR);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Build a refund request body from CLI options, picking the right auth mode.
|
|
33
|
-
*
|
|
34
|
-
* Guest auth: --booking-ref + --last-name (public; validated by BFF).
|
|
35
|
-
* Authenticated: --order-id (DevPlatform OAuth / jnk_* keys).
|
|
36
|
-
*
|
|
37
|
-
* Exactly one mode must be provided — the BFF rejects mixed combinations.
|
|
5
|
+
* Auth is always `booking_ref` + `last_name` (required by the public spec —
|
|
6
|
+
* Commander enforces both via `requiredOption`, so they are guaranteed here).
|
|
38
7
|
*/
|
|
39
8
|
export function buildAuthFields(opts) {
|
|
40
|
-
validateAuthFields(opts);
|
|
41
9
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...(opts.lastName && { last_name: opts.lastName }),
|
|
10
|
+
booking_ref: opts.bookingRef,
|
|
11
|
+
last_name: opts.lastName,
|
|
45
12
|
...(opts.provider && { provider: opts.provider }),
|
|
46
13
|
...(opts.ticketNumbers && opts.ticketNumbers.length > 0 && { ticket_numbers: opts.ticketNumbers }),
|
|
47
14
|
};
|
|
@@ -54,11 +21,11 @@ export function registerRefundCommand(program) {
|
|
|
54
21
|
.command('check')
|
|
55
22
|
.summary('Check refund eligibility and estimated amount')
|
|
56
23
|
.description('Check refund eligibility and estimated amount.')
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
.option('--order-id <id>', 'DevPlatform order ID (authenticated auth) [required: authenticated mode]')
|
|
24
|
+
.requiredOption('--booking-ref <ref>', 'Jinko booking reference [required]')
|
|
25
|
+
.requiredOption('--last-name <name>', 'Last name of the primary traveler [required]')
|
|
60
26
|
.option('--provider <provider>', 'override provider hint')
|
|
61
27
|
.option('--ticket-numbers <numbers...>', 'one or more ticket numbers')
|
|
28
|
+
.addOption(userIntentOption())
|
|
62
29
|
.action(withClient(async (client, globals, opts) => {
|
|
63
30
|
const response = await client.refundCheck(buildAuthFields(opts));
|
|
64
31
|
output(response, { format: globals.format });
|
|
@@ -67,11 +34,11 @@ export function registerRefundCommand(program) {
|
|
|
67
34
|
.command('commit')
|
|
68
35
|
.summary('Initiate a refund for a booked flight')
|
|
69
36
|
.description('Initiate a refund for a booked flight.')
|
|
70
|
-
.
|
|
71
|
-
.
|
|
72
|
-
.option('--order-id <id>', 'DevPlatform order ID (authenticated auth) [required: authenticated mode]')
|
|
37
|
+
.requiredOption('--booking-ref <ref>', 'Jinko booking reference [required]')
|
|
38
|
+
.requiredOption('--last-name <name>', 'Last name of the primary traveler [required]')
|
|
73
39
|
.option('--provider <provider>', 'override provider hint')
|
|
74
40
|
.option('--ticket-numbers <numbers...>', 'one or more ticket numbers')
|
|
41
|
+
.addOption(userIntentOption())
|
|
75
42
|
.action(withClient(async (client, globals, opts) => {
|
|
76
43
|
const response = await client.refundCommit(buildAuthFields(opts));
|
|
77
44
|
output(response, { format: globals.format });
|
|
@@ -80,17 +47,15 @@ export function registerRefundCommand(program) {
|
|
|
80
47
|
.command('status')
|
|
81
48
|
.summary('Check the status of a refund')
|
|
82
49
|
.description('Poll the current status of a previously committed refund.')
|
|
83
|
-
.
|
|
84
|
-
.
|
|
85
|
-
.option('--order-id <id>', 'DevPlatform order ID (authenticated auth) [required: authenticated mode]')
|
|
50
|
+
.requiredOption('--booking-ref <ref>', 'Jinko booking reference [required]')
|
|
51
|
+
.requiredOption('--last-name <name>', 'Last name of the primary traveler [required]')
|
|
86
52
|
.option('--refund-reference <ref>', 'refund reference returned by `refund commit`')
|
|
87
53
|
.option('--provider <provider>', 'override provider hint')
|
|
54
|
+
.addOption(userIntentOption())
|
|
88
55
|
.action(withClient(async (client, globals, opts) => {
|
|
89
|
-
validateAuthFields(opts);
|
|
90
56
|
const response = await client.refundStatus({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
...(opts.lastName && { last_name: opts.lastName }),
|
|
57
|
+
booking_ref: opts.bookingRef,
|
|
58
|
+
last_name: opts.lastName,
|
|
94
59
|
...(opts.refundReference && { refund_reference: opts.refundReference }),
|
|
95
60
|
...(opts.provider && { provider: opts.provider }),
|
|
96
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refund.js","sourceRoot":"","sources":["../../src/commands/refund.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"refund.js","sourceRoot":"","sources":["../../src/commands/refund.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAK/B;IACC,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,UAAU;QAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ;QACxB,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjD,GAAG,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;KACnG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,uDAAuD,CAAC,CAAC;IAExE,MAAM;SACH,OAAO,CAAC,OAAO,CAAC;SAChB,OAAO,CAAC,+CAA+C,CAAC;SACxD,WAAW,CAAC,gDAAgD,CAAC;SAC7D,cAAc,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;SAC3E,cAAc,CAAC,oBAAoB,EAAE,8CAA8C,CAAC;SACpF,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;SACzD,MAAM,CAAC,+BAA+B,EAAE,4BAA4B,CAAC;SACrE,SAAS,CAAC,gBAAgB,EAAE,CAAC;SAC7B,MAAM,CACL,UAAU,C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7B,MAAM,CACL,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;YACzC,WAAW,EAAE,IAAI,CAAC,UAAU;YAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ;YACxB,GAAG,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;YACvE,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/commands/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/commands/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6RpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmC5D"}
|
package/dist/commands/schema.js
CHANGED
|
@@ -2,10 +2,26 @@ import { output } from "./shared.js";
|
|
|
2
2
|
import { getGlobalOptions } from "../config/config.js";
|
|
3
3
|
/**
|
|
4
4
|
* Schema definitions for CLI commands. Names match MCP tools 1:1.
|
|
5
|
+
*
|
|
6
|
+
* HAND-MAINTAINED. This table is prose about the contract, not generated from
|
|
7
|
+
* `public-api.yaml` or `generated.ts`, so a spec sync does NOT update it —
|
|
8
|
+
* update it here when the contract moves. Last aligned to contract 0.3.0.
|
|
5
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* The identity a submitted offer echoes back on every item and booking (C11,
|
|
12
|
+
* as narrowed by D29). Optional throughout, and per kind: flights carry
|
|
13
|
+
* `offer_id` + `trip_item_token`, hotels carry `offer_id` + `hotel_id`.
|
|
14
|
+
*/
|
|
15
|
+
const IDENTITY_FIELDS = "offer_id?, trip_item_token? (flights), hotel_id? (hotels — the same id hotel_search publishes)";
|
|
16
|
+
/** Terms captured for a quoted hotel item (C12). */
|
|
17
|
+
const HOTEL_TERMS = '{ terms_as_of: "search" | "quote", is_refundable?, free_cancellation_until?, board_type?, board_name?, room_name?, room_capacity?, payment_types?, taxes_breakdown: [{ name, amount, currency, included }], cancellation_schedule: [{ cancel_time, amount, currency }] }? — hotels only. terms_as_of "search" means the terms were captured at search and NOT re-confirmed at quote. Cancellation timestamps are RFC 3339 with the supplier offset; a deadline the supplier gave no timezone for is omitted rather than published without one, so an absent free_cancellation_until does not mean non-refundable and a cancellation_schedule can be shorter than the supplier\'s own.';
|
|
18
|
+
/** The closed public error enum (C15) — `error.code` is one of these twenty. */
|
|
19
|
+
const ERROR_CODES = "error.code is a closed enum: AUTH_REQUIRED, PAYMENT_REQUIRED, RATE_LIMITED, BAD_REQUEST, FORBIDDEN, NOT_FOUND, CONFLICT, GONE (410, the generic 410 beneath QUOTE_EXPIRED and OFFER_EXPIRED — what the request named is gone for good, so repeating it cannot succeed), QUOTE_EXPIRED (410, carries expires_at and a numeric quoted_cart_id naming which quote lapsed), TRIP_EXPIRED (409, carries status), TRIP_STATE_CONFLICT (409, carries status), OFFER_EXPIRED, OFFER_UNAVAILABLE, MISSING_CUSTOMER_DETAILS, CURRENCY_UNSUPPORTED, UPSTREAM_REJECTED, UPSTREAM_UNAVAILABLE, UPSTREAM_TIMEOUT, UPSTREAM_ERROR, INTERNAL. Carried keys are SIBLINGS of error, never nested inside it.";
|
|
20
|
+
/** Every lifecycle state a trip can report (C13). */
|
|
21
|
+
const TRIP_STATUS = "draft | quoting | quoted | fulfillment_prepared | fulfilling | fulfilled | partially_fulfilled | failed | cancelled | expired";
|
|
6
22
|
const SCHEMAS = {
|
|
7
23
|
"find-destination": {
|
|
8
|
-
description: "Discover destinations from origin airports (POST /
|
|
24
|
+
description: "Discover destinations from origin airports (POST /v1/find_destination).",
|
|
9
25
|
request: {
|
|
10
26
|
passengers: "{ adt: number }",
|
|
11
27
|
filters: {
|
|
@@ -23,34 +39,74 @@ const SCHEMAS = {
|
|
|
23
39
|
pagination: "{ next_page_token }",
|
|
24
40
|
total: "number",
|
|
25
41
|
},
|
|
42
|
+
money_format: "Money objects here are INTEGER MINOR UNITS: divide value by 10 ** decimal_places to display ({ value: 15977, decimal_places: 2 } is 159.77). See docs.gojinko.com/concepts/money.",
|
|
26
43
|
},
|
|
27
44
|
"flight-search": {
|
|
28
|
-
description: "Live flight search or price-check a specific offer (POST /
|
|
45
|
+
description: "Live flight search or price-check a specific offer (POST /v1/flight_search).",
|
|
29
46
|
request: {
|
|
30
47
|
mode_a_search: {
|
|
31
|
-
origin: "string (IATA code)",
|
|
32
|
-
destination: "string (IATA code)",
|
|
48
|
+
origin: "string (IATA city or airport code)",
|
|
49
|
+
destination: "string (IATA city or airport code)",
|
|
50
|
+
origin_type: "city | airport? (omit to let the platform classify the code)",
|
|
51
|
+
destination_type: "city | airport?",
|
|
33
52
|
departure_date: "string (YYYY-MM-DD)",
|
|
34
53
|
return_date: "string? (YYYY-MM-DD)",
|
|
35
54
|
trip_type: "oneway | roundtrip",
|
|
36
|
-
cabin_class: "economy | premium_economy | business | first",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
cabin_class: "economy | premium_economy | business | first (advisory — never appears in applied_filters)",
|
|
56
|
+
adults: "number (default 1)",
|
|
57
|
+
children: "number?",
|
|
58
|
+
infants: "number?",
|
|
59
|
+
max_stops: "number? (0 non-stop, 1, 2 — per leg)",
|
|
60
|
+
direct_only: "boolean? (DEPRECATED alias of max_stops: 0)",
|
|
61
|
+
multi_fare: "boolean? (branded fare ladder; default true)",
|
|
62
|
+
max_price: "number? (total for all passengers, in currency, major units)",
|
|
63
|
+
include_carriers: "string[]? (IATA 2-letter)",
|
|
64
|
+
exclude_carriers: "string[]? (IATA 2-letter, must not overlap include_carriers)",
|
|
65
|
+
departure_time_range: '{ earliest?: "HH:MM", latest?: "HH:MM" }? (outbound leg)',
|
|
66
|
+
arrival_time_range: "{ earliest?, latest? }? (outbound leg)",
|
|
67
|
+
return_departure_time_range: "{ earliest?, latest? }? (return leg)",
|
|
68
|
+
return_arrival_time_range: "{ earliest?, latest? }? (return leg)",
|
|
69
|
+
connection_time_min_minutes: "number? (must not exceed the max)",
|
|
70
|
+
connection_time_max_minutes: "number?",
|
|
71
|
+
max_total_duration_minutes: "number? (per leg, door to door)",
|
|
72
|
+
refundable_only: "boolean? (conservative — fares whose rules cannot be verified are dropped)",
|
|
73
|
+
changeable_only: "boolean? (conservative in the same way)",
|
|
74
|
+
checked_bag_included: "boolean?",
|
|
75
|
+
single_carrier_only: "boolean?",
|
|
76
|
+
via_airports: "string[]? (at least one connection must be one of them)",
|
|
77
|
+
exclude_via_airports: "string[]? (must not overlap via_airports)",
|
|
78
|
+
aircraft_types: "string[]? (IATA equipment codes, every segment)",
|
|
79
|
+
origin_alternate_airports: "string[]? (ADDITIONAL departure airports beside origin; airport anchor only — against a city anchor it comes back under `origin` in unapplied_filters)",
|
|
80
|
+
destination_alternate_airports: "string[]? (same rules, reported as `destination`)",
|
|
81
|
+
nearby_airports: "boolean? (widening)",
|
|
82
|
+
same_connection_airport_only: "boolean?",
|
|
83
|
+
same_origin_airport_only: "boolean?",
|
|
84
|
+
same_turnaround_airport_only: "boolean?",
|
|
85
|
+
limit: "number? (1-300 TOTAL flights, not a page size; search mode only)",
|
|
86
|
+
currency: "string? (ISO 4217)",
|
|
87
|
+
locale: "string?",
|
|
40
88
|
},
|
|
41
89
|
mode_b_price_check: {
|
|
42
90
|
offer_token: "string (from flight-search or flight-calendar results)",
|
|
43
|
-
|
|
91
|
+
adults: "number (default 1)",
|
|
92
|
+
children: "number?",
|
|
93
|
+
infants: "number?",
|
|
94
|
+
currency: "string?",
|
|
95
|
+
locale: "string?",
|
|
96
|
+
note: "search-mode fields are rejected beside offer_token",
|
|
44
97
|
},
|
|
45
98
|
},
|
|
46
99
|
response: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
100
|
+
offers: "[{ offer_id, provider, origin, destination, is_round_trip, total_duration_minutes, outbound, inbound, additional_legs, fares }]",
|
|
101
|
+
fares: "offers[].fares: [{ trip_item_token, brand_name, cabin_class, total_price, price_per_person, included_baggage, is_refundable, is_changeable, checked_bag_included }]",
|
|
102
|
+
exact_match_found: "boolean?",
|
|
103
|
+
applied_filters: "string[] — requested filters these results DO honor (alternate-airport lists reported per side as `origin` / `destination`)",
|
|
104
|
+
unapplied_filters: "[{ name, reason }] — requested filters these results do NOT honor; post-filter yourself or tell the user the constraint could not be met",
|
|
50
105
|
},
|
|
106
|
+
money_format: "Money objects here are INTEGER MINOR UNITS: divide value by 10 ** decimal_places to display ({ value: 15977, decimal_places: 2 } is 159.77). See docs.gojinko.com/concepts/money.",
|
|
51
107
|
},
|
|
52
108
|
"flight-calendar": {
|
|
53
|
-
description: "Cheapest prices across a date range (POST /
|
|
109
|
+
description: "Cheapest prices across a date range (POST /v1/flight_calendar).",
|
|
54
110
|
request: {
|
|
55
111
|
from: "string (IATA code, origin)",
|
|
56
112
|
to: "string (IATA code, destination)",
|
|
@@ -61,27 +117,30 @@ const SCHEMAS = {
|
|
|
61
117
|
response: {
|
|
62
118
|
itineraries: "[{ id, slices, total_amount, ... }]",
|
|
63
119
|
},
|
|
120
|
+
money_format: "Money objects here are INTEGER MINOR UNITS: divide value by 10 ** decimal_places to display ({ value: 15977, decimal_places: 2 } is 159.77). See docs.gojinko.com/concepts/money.",
|
|
64
121
|
},
|
|
65
122
|
trip: {
|
|
66
|
-
description: "Manage a trip: create, add/remove flight items, set travelers (POST /
|
|
123
|
+
description: "Manage a trip: create, add/remove flight items, set travelers (POST /v1/trip).",
|
|
67
124
|
request: {
|
|
68
125
|
trip_id: "string? (omit to create new)",
|
|
69
126
|
add_item: "{ trip_item_token: string }? (from flight-search)",
|
|
70
127
|
remove_item: "{ item_id: string }? (item_id from prior trip response items[].item_id; requires trip_id; can be combined with add_item to swap in one call)",
|
|
71
|
-
upsert_travelers: "{ travelers: [{ first_name, last_name, passenger_type, date_of_birth?, gender?, frequent_flyer?: { airline, number }, ... }], contact?: { email, phone } }? (travelers + contact email/phone required to book; date_of_birth + gender required for flights, optional for hotel-only; contact name taken from first traveler)",
|
|
128
|
+
upsert_travelers: "{ travelers: [{ first_name, last_name, passenger_type, date_of_birth?, gender?, frequent_flyer?: { airline, number }, known_traveler_number?, known_traveler_issuing_country?, redress_number?, redress_issuing_country?, ... }], contact?: { email, phone } }? (travelers + contact email/phone required to book; date_of_birth + gender required for flights, optional for hotel-only; KTN/redress issuing countries default to US; contact name taken from first traveler)",
|
|
72
129
|
},
|
|
73
130
|
response: {
|
|
74
131
|
trip_id: "string",
|
|
75
|
-
status:
|
|
76
|
-
items:
|
|
132
|
+
status: TRIP_STATUS,
|
|
133
|
+
items: `[{ item_id, type, description, price, currency, ${IDENTITY_FIELDS} }]`,
|
|
77
134
|
travelers: "[...]",
|
|
78
135
|
contact: "{ email, phone }",
|
|
79
136
|
totals: "{ total, currency }",
|
|
80
137
|
actions_performed: "string[]",
|
|
81
138
|
},
|
|
139
|
+
error_codes: ERROR_CODES,
|
|
140
|
+
money_format: "Amounts here are already MAJOR units (plain decimals, no decimal_places) — display as-is, do not divide. See docs.gojinko.com/concepts/money.",
|
|
82
141
|
},
|
|
83
142
|
checkout: {
|
|
84
|
-
description: "Checkout a trip — returns the web checkout_url a human opens to pay, the agent_spt_params an agent uses to pay programmatically, plus cart items and ancillaries (POST /
|
|
143
|
+
description: "Checkout a trip — returns the web checkout_url a human opens to pay, the agent_spt_params an agent uses to pay programmatically, plus cart items and ancillaries (POST /v1/checkout). `book` is a deprecated alias.",
|
|
85
144
|
request: {
|
|
86
145
|
trip_id: "string (from trip command)",
|
|
87
146
|
},
|
|
@@ -90,29 +149,35 @@ const SCHEMAS = {
|
|
|
90
149
|
checkout_url: "string (human payment URL)",
|
|
91
150
|
expires_at: "string? (ISO datetime)",
|
|
92
151
|
status: "ready | pending | failed",
|
|
93
|
-
total_amount: "{ amount: number, currency: string }?",
|
|
94
|
-
agent_spt_params: "{ max_amount: number, currency: string, stripe_profile?: string, expires_at?: string }? (mint an SPT scoped to these, then call agent-pay submit)",
|
|
95
|
-
items:
|
|
152
|
+
total_amount: "{ amount: number, currency: string }? (amount is MAJOR units — display as-is)",
|
|
153
|
+
agent_spt_params: "{ max_amount: number, currency: string, stripe_profile?: string, expires_at?: string }? (mint an SPT scoped to these, then call agent-pay submit; max_amount is an INTEGER in MINOR units per Stripe convention — the one exception to the no-decimal_places-means-major rule)",
|
|
154
|
+
items: `[{ item_id, kind, price, pax_count, ${IDENTITY_FIELDS}, hotel_terms?, available_ancillaries: [...], selected_ancillaries: [...] }]`,
|
|
155
|
+
"items[].hotel_terms": HOTEL_TERMS,
|
|
96
156
|
},
|
|
157
|
+
error_codes: ERROR_CODES,
|
|
97
158
|
},
|
|
98
159
|
"trip-status": {
|
|
99
|
-
description: "Full lifecycle state for a trip: cart, quote, fulfillment, bookings (GET /
|
|
160
|
+
description: "Full lifecycle state for a trip: cart, quote, fulfillment, bookings (GET /v1/trip/:trip_id).",
|
|
100
161
|
request: {
|
|
101
162
|
trip_id: "string",
|
|
102
163
|
},
|
|
103
164
|
response: {
|
|
104
165
|
trip_id: "string",
|
|
105
|
-
status:
|
|
166
|
+
status: TRIP_STATUS,
|
|
106
167
|
travelers: "[...]",
|
|
107
168
|
contact: "{ email?, phone? }?",
|
|
108
|
-
items:
|
|
169
|
+
items: `[{ item_id, kind, price, pax_count, ${IDENTITY_FIELDS}, hotel_terms?, available_ancillaries, selected_ancillaries }]`,
|
|
170
|
+
"items[].hotel_terms": HOTEL_TERMS,
|
|
109
171
|
total_amount: "{ amount, currency }?",
|
|
110
172
|
quote: "{ quoted_cart_id, status, expires_at? }?",
|
|
111
173
|
fulfillment: "{ fulfillment_cart_id, status, phase?, scheduled_at? }?",
|
|
112
|
-
|
|
174
|
+
booking_ref: "string? (the Jinko booking reference, JNK-XXXXXX — the value get-booking, hotel-cancel, refund and exchange take as --booking-ref, and the booking_ref every webhook event carries. Present as soon as a fulfillment cart exists for the trip — i.e. once fulfillment has been scheduled, which can be before payment completes (a hosted checkout still in progress, or an agent-pay submit that fell back to checkout_url, leaves the cart awaiting_payment). Presence does not mean paid: read fulfillment.status. The value never changes afterwards. One per trip.)",
|
|
175
|
+
bookings: `[{ item_id, kind, booking_reference (the SUPPLIER confirmation — airline record locator / hotel confirmation number, NOT the get-booking handle), pnr?, provider_status?, ${IDENTITY_FIELDS} }]?`,
|
|
113
176
|
created_at: "string (ISO)",
|
|
114
177
|
updated_at: "string (ISO)",
|
|
115
178
|
},
|
|
179
|
+
error_codes: ERROR_CODES,
|
|
180
|
+
money_format: "price and price_per_unit are { amount, currency } in MAJOR units — display as-is. See docs.gojinko.com/concepts/money.",
|
|
116
181
|
},
|
|
117
182
|
"get-ancillaries": {
|
|
118
183
|
description: "List the purchasable ancillaries for a trip (bags, seats, meals) without generating a checkout URL. Runs a quote transparently and polls until ready (GET /v1/trip/:id/ancillaries).",
|
|
@@ -125,11 +190,13 @@ const SCHEMAS = {
|
|
|
125
190
|
quoted_cart_id: "number?",
|
|
126
191
|
expires_at: "string (ISO)?",
|
|
127
192
|
retry_after_seconds: "number? (present when status=pricing)",
|
|
128
|
-
items:
|
|
193
|
+
items: `[{ item_id, kind, price, pax_count, ${IDENTITY_FIELDS}, hotel_terms?, available_ancillaries: [{ offer_id, type, label, display_label, price_per_unit, per_pax, max_quantity }], selected_ancillaries }]`,
|
|
194
|
+
"items[].hotel_terms": HOTEL_TERMS,
|
|
129
195
|
},
|
|
196
|
+
error_codes: ERROR_CODES,
|
|
130
197
|
},
|
|
131
198
|
"select-ancillaries": {
|
|
132
|
-
description: "Select bags / seats / meals for a trip item (POST /
|
|
199
|
+
description: "Select bags / seats / meals for a trip item (POST /v1/select_ancillaries).",
|
|
133
200
|
request: {
|
|
134
201
|
trip_id: "string",
|
|
135
202
|
item_id: "string",
|
|
@@ -139,6 +206,7 @@ const SCHEMAS = {
|
|
|
139
206
|
trip_id: "string",
|
|
140
207
|
items: "[...]",
|
|
141
208
|
},
|
|
209
|
+
money_format: "total_with_ancillaries is { amount: INTEGER MINOR units, currency, decimal_places } — divide amount by 10 ** decimal_places to display. See docs.gojinko.com/concepts/money.",
|
|
142
210
|
},
|
|
143
211
|
"agent-pay": {
|
|
144
212
|
description: "One-call programmatic payment with a Shared Payment Token — the alternative to opening `checkout`'s checkout URL. Get `agent_spt_params` from `checkout`, mint an SPT scoped to them, then `agent-pay submit` presents trip_id + the SPT: the BFF schedules the agent fulfillment and redeems the token (POST /v1/agent_payment/submit).",
|
|
@@ -154,10 +222,12 @@ const SCHEMAS = {
|
|
|
154
222
|
status: "string",
|
|
155
223
|
payment_verified: "boolean",
|
|
156
224
|
message: "string?",
|
|
225
|
+
booking_ref: "string? (the Jinko booking reference, JNK-XXXXXX, for the trip just paid — hand it to get-booking, hotel-cancel, refund or exchange as --booking-ref. Present when the token was authorized; absent when the payment could not be authorized and checkout_url is returned instead.)",
|
|
157
226
|
checkout_url: "string? (hosted-checkout fallback, present only on a 3DS step-up / decline)",
|
|
158
227
|
recap_token: "string?",
|
|
159
228
|
},
|
|
160
229
|
},
|
|
230
|
+
error_codes: ERROR_CODES,
|
|
161
231
|
},
|
|
162
232
|
};
|
|
163
233
|
export function registerSchemaCommand(program) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/commands/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EA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AW,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-ancillaries.d.ts","sourceRoot":"","sources":["../../src/commands/select-ancillaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"select-ancillaries.d.ts","sourceRoot":"","sources":["../../src/commands/select-ancillaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmCvE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { withClient, output } from './shared.js';
|
|
1
|
+
import { withClient, output, userIntentOption } from './shared.js';
|
|
2
2
|
export function registerSelectAncillariesCommand(program) {
|
|
3
3
|
program
|
|
4
4
|
.command('select-ancillaries')
|
|
@@ -9,6 +9,7 @@ export function registerSelectAncillariesCommand(program) {
|
|
|
9
9
|
.requiredOption('--select <ids>', 'comma-separated ancillary offer IDs [required]')
|
|
10
10
|
.option('--pax <ref>', 'passenger reference (for per-pax ancillaries)')
|
|
11
11
|
.option('--quantity <n>', 'quantity (default: 1)', '1')
|
|
12
|
+
.addOption(userIntentOption())
|
|
12
13
|
.action(withClient(async (client, globals, opts) => {
|
|
13
14
|
const parsedQuantity = parseInt(opts.quantity, 10);
|
|
14
15
|
if (Number.isNaN(parsedQuantity)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-ancillaries.js","sourceRoot":"","sources":["../../src/commands/select-ancillaries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,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AAc,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;SAC1D,CAAC,CAAC,CAAC;QAEJ,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;YAC9C,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,UAAU;SACX,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { Option, type Command } from 'commander';
|
|
2
2
|
import { type JinkoClient } from '@gojinko/api-client';
|
|
3
3
|
import { type GlobalOptions } from '../config/config.js';
|
|
4
4
|
import { output, outputError } from '../output/formatter.js';
|
|
@@ -30,6 +30,19 @@ export declare function exitWithError(err: unknown, globals: GlobalOptions): nev
|
|
|
30
30
|
* Returns the resolved canonical value so callers can use it inline.
|
|
31
31
|
*/
|
|
32
32
|
export declare function resolveDeprecatedFlag<T>(canonical: T | undefined, deprecated: T | undefined, oldFlag: string, newFlag: string): T | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Fresh `--user-intent` option for the intent-eligible commands — the CLI
|
|
35
|
+
* commands whose underlying API call is one of the 21 public POST operations
|
|
36
|
+
* that accept the optional `intent: { user_intent }` request-body envelope
|
|
37
|
+
* (IntentInput). Each eligible leaf registers its own instance via
|
|
38
|
+
* `.addOption(userIntentOption())`: Commander Options must not be shared
|
|
39
|
+
* across commands, and the docs generator only documents leaf options, so a
|
|
40
|
+
* root/global option would be invisible on the generated pages. withClient
|
|
41
|
+
* threads the parsed value into the api-client, which merges it into the
|
|
42
|
+
* POST body. Falls back to the JINKO_USER_INTENT env var when the flag is
|
|
43
|
+
* not given (Commander `.env()`).
|
|
44
|
+
*/
|
|
45
|
+
export declare function userIntentOption(): Option;
|
|
33
46
|
/**
|
|
34
47
|
* Build the source-native action string for the `X-Origin-Action` header: the
|
|
35
48
|
* invoked CLI command path (e.g. `flight-search`, `book`, `auth login`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAA0C,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAC/B,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,iEAAiE;AACjE,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBACV,OAAO,EAAE,MAAM,EAAE,IAAI,SAAkB;CAKpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK,CAkBzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,SAAS,EAAE,CAAC,GAAG,SAAS,EACxB,UAAU,EAAE,CAAC,GAAG,SAAS,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,CAAC,GAAG,SAAS,CAMf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAKzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAY/E;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,CACP,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,aAAa,EAEtB,OAAO,CAAC,EAAE,GAAG,EACb,GAAG,CAAC,EAAE,OAAO,KACV,OAAO,CAAC,IAAI,CAAC,IAGK,MAAM,OAAO,EAAE,GAAG,MAAM,GAAG,EAAE,mBAuCrD"}
|
package/dist/commands/shared.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
1
2
|
import { createJinkoClient, ApiError, AuthError } from '@gojinko/api-client';
|
|
2
3
|
import { getGlobalOptions } from '../config/config.js';
|
|
3
4
|
import { output, outputError } from '../output/formatter.js';
|
|
@@ -30,7 +31,7 @@ export function exitWithError(err, globals) {
|
|
|
30
31
|
process.exit(2);
|
|
31
32
|
}
|
|
32
33
|
if (err instanceof ApiError) {
|
|
33
|
-
outputError({ code: err.code, message: err.message, doc_url: err.docUrl }, globals);
|
|
34
|
+
outputError({ code: err.code, message: err.message, doc_url: err.docUrl, details: err.details }, globals);
|
|
34
35
|
process.exit(1);
|
|
35
36
|
}
|
|
36
37
|
outputError({ message: err instanceof Error ? err.message : String(err) }, globals);
|
|
@@ -53,6 +54,21 @@ export function resolveDeprecatedFlag(canonical, deprecated, oldFlag, newFlag) {
|
|
|
53
54
|
}
|
|
54
55
|
return canonical;
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Fresh `--user-intent` option for the intent-eligible commands — the CLI
|
|
59
|
+
* commands whose underlying API call is one of the 21 public POST operations
|
|
60
|
+
* that accept the optional `intent: { user_intent }` request-body envelope
|
|
61
|
+
* (IntentInput). Each eligible leaf registers its own instance via
|
|
62
|
+
* `.addOption(userIntentOption())`: Commander Options must not be shared
|
|
63
|
+
* across commands, and the docs generator only documents leaf options, so a
|
|
64
|
+
* root/global option would be invisible on the generated pages. withClient
|
|
65
|
+
* threads the parsed value into the api-client, which merges it into the
|
|
66
|
+
* POST body. Falls back to the JINKO_USER_INTENT env var when the flag is
|
|
67
|
+
* not given (Commander `.env()`).
|
|
68
|
+
*/
|
|
69
|
+
export function userIntentOption() {
|
|
70
|
+
return new Option('--user-intent <text>', "the end user's request in their own words, forwarded to Jinko for observability and relevance (avoid PII). Env fallback: JINKO_USER_INTENT. JSON: `intent.user_intent`.").env('JINKO_USER_INTENT');
|
|
71
|
+
}
|
|
56
72
|
/**
|
|
57
73
|
* Build the source-native action string for the `X-Origin-Action` header: the
|
|
58
74
|
* invoked CLI command path (e.g. `flight-search`, `book`, `auth login`),
|
|
@@ -98,6 +114,9 @@ export function withClient(handler) {
|
|
|
98
114
|
environment: globals.environment,
|
|
99
115
|
originSource: 'cli',
|
|
100
116
|
originAction: resolveCommandPath(cmd),
|
|
117
|
+
// Only intent-eligible commands register the flag (userIntentOption),
|
|
118
|
+
// so this stays undefined — and the body untouched — everywhere else.
|
|
119
|
+
userIntent: typeof cmdOpts?.userIntent === 'string' ? cmdOpts.userIntent : undefined,
|
|
101
120
|
});
|
|
102
121
|
await handler(client, globals, cmdOpts, cmd);
|
|
103
122
|
}
|
|
@@ -107,7 +126,10 @@ export function withClient(handler) {
|
|
|
107
126
|
process.exit(2);
|
|
108
127
|
}
|
|
109
128
|
if (error instanceof ApiError) {
|
|
110
|
-
|
|
129
|
+
// `details` carries the envelope keys that sit beside `error` (D27) —
|
|
130
|
+
// expires_at, status, items — which is what tells the caller what to do
|
|
131
|
+
// next about the code they just got.
|
|
132
|
+
outputError({ code: error.code, message: error.message, doc_url: error.docUrl, details: error.details }, globals);
|
|
111
133
|
process.exit(1);
|
|
112
134
|
}
|
|
113
135
|
if (error instanceof Error) {
|