@gojinko/cli 2.23.0 → 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 +45 -4
- package/SKILL.md +19 -5
- package/dist/commands/checkout.d.ts.map +1 -1
- package/dist/commands/checkout.js +5 -0
- package/dist/commands/checkout.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 +451 -45
- package/dist/commands/flight-search.js.map +1 -1
- package/dist/commands/get-booking.js +1 -1
- package/dist/commands/get-booking.js.map +1 -1
- package/dist/commands/hotel-cancel.js +1 -1
- package/dist/commands/hotel-cancel.js.map +1 -1
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +88 -24
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/shared.d.ts.map +1 -1
- package/dist/commands/shared.js +5 -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 +2 -0
- package/dist/commands/trip.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 +2 -2
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: {
|
|
@@ -26,33 +42,71 @@ const SCHEMAS = {
|
|
|
26
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.",
|
|
27
43
|
},
|
|
28
44
|
"flight-search": {
|
|
29
|
-
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).",
|
|
30
46
|
request: {
|
|
31
47
|
mode_a_search: {
|
|
32
|
-
origin: "string (IATA code)",
|
|
33
|
-
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?",
|
|
34
52
|
departure_date: "string (YYYY-MM-DD)",
|
|
35
53
|
return_date: "string? (YYYY-MM-DD)",
|
|
36
54
|
trip_type: "oneway | roundtrip",
|
|
37
|
-
cabin_class: "economy | premium_economy | business | first",
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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?",
|
|
41
88
|
},
|
|
42
89
|
mode_b_price_check: {
|
|
43
90
|
offer_token: "string (from flight-search or flight-calendar results)",
|
|
44
|
-
|
|
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",
|
|
45
97
|
},
|
|
46
98
|
},
|
|
47
99
|
response: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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",
|
|
51
105
|
},
|
|
52
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.",
|
|
53
107
|
},
|
|
54
108
|
"flight-calendar": {
|
|
55
|
-
description: "Cheapest prices across a date range (POST /
|
|
109
|
+
description: "Cheapest prices across a date range (POST /v1/flight_calendar).",
|
|
56
110
|
request: {
|
|
57
111
|
from: "string (IATA code, origin)",
|
|
58
112
|
to: "string (IATA code, destination)",
|
|
@@ -66,7 +120,7 @@ const SCHEMAS = {
|
|
|
66
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.",
|
|
67
121
|
},
|
|
68
122
|
trip: {
|
|
69
|
-
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).",
|
|
70
124
|
request: {
|
|
71
125
|
trip_id: "string? (omit to create new)",
|
|
72
126
|
add_item: "{ trip_item_token: string }? (from flight-search)",
|
|
@@ -75,17 +129,18 @@ const SCHEMAS = {
|
|
|
75
129
|
},
|
|
76
130
|
response: {
|
|
77
131
|
trip_id: "string",
|
|
78
|
-
status:
|
|
79
|
-
items:
|
|
132
|
+
status: TRIP_STATUS,
|
|
133
|
+
items: `[{ item_id, type, description, price, currency, ${IDENTITY_FIELDS} }]`,
|
|
80
134
|
travelers: "[...]",
|
|
81
135
|
contact: "{ email, phone }",
|
|
82
136
|
totals: "{ total, currency }",
|
|
83
137
|
actions_performed: "string[]",
|
|
84
138
|
},
|
|
139
|
+
error_codes: ERROR_CODES,
|
|
85
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.",
|
|
86
141
|
},
|
|
87
142
|
checkout: {
|
|
88
|
-
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.",
|
|
89
144
|
request: {
|
|
90
145
|
trip_id: "string (from trip command)",
|
|
91
146
|
},
|
|
@@ -96,27 +151,32 @@ const SCHEMAS = {
|
|
|
96
151
|
status: "ready | pending | failed",
|
|
97
152
|
total_amount: "{ amount: number, currency: string }? (amount is MAJOR units — display as-is)",
|
|
98
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)",
|
|
99
|
-
items:
|
|
154
|
+
items: `[{ item_id, kind, price, pax_count, ${IDENTITY_FIELDS}, hotel_terms?, available_ancillaries: [...], selected_ancillaries: [...] }]`,
|
|
155
|
+
"items[].hotel_terms": HOTEL_TERMS,
|
|
100
156
|
},
|
|
157
|
+
error_codes: ERROR_CODES,
|
|
101
158
|
},
|
|
102
159
|
"trip-status": {
|
|
103
|
-
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).",
|
|
104
161
|
request: {
|
|
105
162
|
trip_id: "string",
|
|
106
163
|
},
|
|
107
164
|
response: {
|
|
108
165
|
trip_id: "string",
|
|
109
|
-
status:
|
|
166
|
+
status: TRIP_STATUS,
|
|
110
167
|
travelers: "[...]",
|
|
111
168
|
contact: "{ email?, phone? }?",
|
|
112
|
-
items:
|
|
169
|
+
items: `[{ item_id, kind, price, pax_count, ${IDENTITY_FIELDS}, hotel_terms?, available_ancillaries, selected_ancillaries }]`,
|
|
170
|
+
"items[].hotel_terms": HOTEL_TERMS,
|
|
113
171
|
total_amount: "{ amount, currency }?",
|
|
114
172
|
quote: "{ quoted_cart_id, status, expires_at? }?",
|
|
115
173
|
fulfillment: "{ fulfillment_cart_id, status, phase?, scheduled_at? }?",
|
|
116
|
-
|
|
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} }]?`,
|
|
117
176
|
created_at: "string (ISO)",
|
|
118
177
|
updated_at: "string (ISO)",
|
|
119
178
|
},
|
|
179
|
+
error_codes: ERROR_CODES,
|
|
120
180
|
money_format: "price and price_per_unit are { amount, currency } in MAJOR units — display as-is. See docs.gojinko.com/concepts/money.",
|
|
121
181
|
},
|
|
122
182
|
"get-ancillaries": {
|
|
@@ -130,11 +190,13 @@ const SCHEMAS = {
|
|
|
130
190
|
quoted_cart_id: "number?",
|
|
131
191
|
expires_at: "string (ISO)?",
|
|
132
192
|
retry_after_seconds: "number? (present when status=pricing)",
|
|
133
|
-
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,
|
|
134
195
|
},
|
|
196
|
+
error_codes: ERROR_CODES,
|
|
135
197
|
},
|
|
136
198
|
"select-ancillaries": {
|
|
137
|
-
description: "Select bags / seats / meals for a trip item (POST /
|
|
199
|
+
description: "Select bags / seats / meals for a trip item (POST /v1/select_ancillaries).",
|
|
138
200
|
request: {
|
|
139
201
|
trip_id: "string",
|
|
140
202
|
item_id: "string",
|
|
@@ -160,10 +222,12 @@ const SCHEMAS = {
|
|
|
160
222
|
status: "string",
|
|
161
223
|
payment_verified: "boolean",
|
|
162
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.)",
|
|
163
226
|
checkout_url: "string? (hosted-checkout fallback, present only on a 3DS step-up / decline)",
|
|
164
227
|
recap_token: "string?",
|
|
165
228
|
},
|
|
166
229
|
},
|
|
230
|
+
error_codes: ERROR_CODES,
|
|
167
231
|
},
|
|
168
232
|
};
|
|
169
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,EAAE,MAAM,qBAAqB,CAAC;AAEvD
|
|
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,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,eAAe,GACnB,gGAAgG,CAAC;AAEnG,oDAAoD;AACpD,MAAM,WAAW,GACf,upBAAupB,CAAC;AAE1pB,gFAAgF;AAChF,MAAM,WAAW,GACf,2pBAA2pB,CAAC;AAE9pB,qDAAqD;AACrD,MAAM,WAAW,GACf,+HAA+H,CAAC;AAElI,MAAM,OAAO,GAWT;IACF,kBAAkB,EAAE;QAClB,WAAW,EACT,yEAAyE;QAC3E,OAAO,EAAE;YACP,UAAU,EAAE,iBAAiB;YAC7B,OAAO,EAAE;gBACP,SAAS,EAAE,uBAAuB;gBAClC,KAAK,EAAE,0DAA0D;gBACjE,SAAS,EAAE,oBAAoB;aAChC;YACD,uBAAuB,EAAE,qBAAqB;YAC9C,KAAK,EAAE,sBAAsB;YAC7B,iBAAiB,EAAE,yBAAyB;SAC7C;QACD,QAAQ,EAAE;YACR,MAAM,EAAE,wCAAwC;YAChD,YAAY,EAAE,yDAAyD;YACvE,UAAU,EAAE,qBAAqB;YACjC,KAAK,EAAE,QAAQ;SAChB;QACD,YAAY,EACV,mLAAmL;KACtL;IACD,eAAe,EAAE;QACf,WAAW,EACT,8EAA8E;QAChF,OAAO,EAAE;YACP,aAAa,EAAE;gBACb,MAAM,EAAE,oCAAoC;gBAC5C,WAAW,EAAE,oCAAoC;gBACjD,WAAW,EAAE,8DAA8D;gBAC3E,gBAAg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,oBAAoB,WAAW,gBAAgB,SAAS,EAAE,CAC3D,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,CAAC,EAAE,OAAO,EAAE,WAAW,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":"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,
|
|
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
|
@@ -31,7 +31,7 @@ export function exitWithError(err, globals) {
|
|
|
31
31
|
process.exit(2);
|
|
32
32
|
}
|
|
33
33
|
if (err instanceof ApiError) {
|
|
34
|
-
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);
|
|
35
35
|
process.exit(1);
|
|
36
36
|
}
|
|
37
37
|
outputError({ message: err instanceof Error ? err.message : String(err) }, globals);
|
|
@@ -126,7 +126,10 @@ export function withClient(handler) {
|
|
|
126
126
|
process.exit(2);
|
|
127
127
|
}
|
|
128
128
|
if (error instanceof ApiError) {
|
|
129
|
-
|
|
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);
|
|
130
133
|
process.exit(1);
|
|
131
134
|
}
|
|
132
135
|
if (error instanceof Error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAsB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAG/B,iEAAiE;AACjE,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,CAAS;IACtB,YAAY,OAAe,EAAE,IAAI,GAAG,eAAe;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,OAAsB;IAChE,IAAI,GAAG,YAAY,UAAU,EAAE,CAAC;QAC9B,WAAW,CAAC,EAAE,IAAI,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O,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-status.d.ts","sourceRoot":"","sources":["../../src/commands/trip-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"trip-status.d.ts","sourceRoot":"","sources":["../../src/commands/trip-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAahE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withClient, output } from './shared.js';
|
|
2
|
+
import { printPriceChangeNotices } from '../output/price-change.js';
|
|
2
3
|
export function registerTripStatusCommand(program) {
|
|
3
4
|
program
|
|
4
5
|
.command('trip-status')
|
|
@@ -8,6 +9,7 @@ export function registerTripStatusCommand(program) {
|
|
|
8
9
|
.action(withClient(async (client, globals, opts) => {
|
|
9
10
|
const response = await client.getTrip(opts.tripId);
|
|
10
11
|
output(response, { format: globals.format });
|
|
12
|
+
printPriceChangeNotices(response);
|
|
11
13
|
}));
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=trip-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip-status.js","sourceRoot":"","sources":["../../src/commands/trip-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"trip-status.js","sourceRoot":"","sources":["../../src/commands/trip-status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,OAAO,CAAC,6GAA6G,CAAC;SACtH,WAAW,CACV,qVAAqV,CACtV;SACA,cAAc,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;SACtD,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7C,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip.d.ts","sourceRoot":"","sources":["../../src/commands/trip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"trip.d.ts","sourceRoot":"","sources":["../../src/commands/trip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoE1D"}
|
package/dist/commands/trip.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { withClient, output, userIntentOption } from './shared.js';
|
|
2
|
+
import { printPriceChangeNotices } from '../output/price-change.js';
|
|
2
3
|
export function registerTripCommand(program) {
|
|
3
4
|
program
|
|
4
5
|
.command('trip')
|
|
@@ -48,6 +49,7 @@ export function registerTripCommand(program) {
|
|
|
48
49
|
}
|
|
49
50
|
const response = await client.trip(body);
|
|
50
51
|
output(response, { format: globals.format });
|
|
52
|
+
printPriceChangeNotices(response);
|
|
51
53
|
}));
|
|
52
54
|
}
|
|
53
55
|
//# sourceMappingURL=trip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trip.js","sourceRoot":"","sources":["../../src/commands/trip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"trip.js","sourceRoot":"","sources":["../../src/commands/trip.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,OAAO,CAAC,mFAAmF,CAAC;SAC5F,WAAW,CACV,2RAA2R,CAC5R;SACA,MAAM,CAAC,gBAAgB,EAAE,uCAAuC,CAAC;SACjE,MAAM,CAAC,2BAA2B,EAAE,wCAAwC,CAAC;SAC7E,MAAM,CACL,uBAAuB,EACvB,0KAA0K,CAC3K;SACA,MAAM,CACL,oBAAoB,EACpB,qMAAqM,CACtM;SACA,MAAM,CACL,kBAAkB,EAClB,6GAA6G,CAC9G;SACA,SAAS,CAAC,gBAAgB,EAAE,CAAC;SAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACjD,MAAM,IAAI,GAA4B,EAAE,CAAC;QAEzC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;gBAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CA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 +7,25 @@ export interface OutputOptions {
|
|
|
7
7
|
* Table format is for human consumption.
|
|
8
8
|
*/
|
|
9
9
|
export declare function output(data: unknown, options: OutputOptions): void;
|
|
10
|
+
export interface OutputErrorInput {
|
|
11
|
+
readonly code?: string;
|
|
12
|
+
readonly message: string;
|
|
13
|
+
readonly doc_url?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The envelope keys that travel BESIDE `error` rather than inside it
|
|
16
|
+
* (contract amendment D27) — `expires_at` on QUOTE_EXPIRED, `status` on
|
|
17
|
+
* TRIP_EXPIRED / TRIP_STATE_CONFLICT, `items` on PRICE_CHANGED.
|
|
18
|
+
*/
|
|
19
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
|
-
* Print an error in a structured way.
|
|
12
|
-
*
|
|
22
|
+
* Print an error in a structured way.
|
|
23
|
+
*
|
|
24
|
+
* JSON reproduces the wire envelope exactly — `error` plus the carried keys as
|
|
25
|
+
* its siblings — so a script gets the same shape whether it parses the CLI's
|
|
26
|
+
* stderr or the API response directly. Table format prints the code (the part a
|
|
27
|
+
* caller branches on), the message, the carried keys, and the one-line remedy
|
|
28
|
+
* for codes that have one.
|
|
13
29
|
*/
|
|
14
|
-
export declare function outputError(error:
|
|
15
|
-
code?: string;
|
|
16
|
-
message: string;
|
|
17
|
-
doc_url?: string;
|
|
18
|
-
}, options: OutputOptions): void;
|
|
30
|
+
export declare function outputError(error: OutputErrorInput, options: OutputOptions): void;
|
|
19
31
|
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAMlE;AAgFD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAqBjF"}
|
package/dist/output/formatter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
import { remedyFor } from './remedies.js';
|
|
2
3
|
/**
|
|
3
4
|
* Print data in the requested format. JSON is the default (agent-friendly).
|
|
4
5
|
* Table format is for human consumption.
|
|
@@ -83,18 +84,31 @@ function printTable(columns, rows) {
|
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
/**
|
|
86
|
-
* Print an error in a structured way.
|
|
87
|
-
*
|
|
87
|
+
* Print an error in a structured way.
|
|
88
|
+
*
|
|
89
|
+
* JSON reproduces the wire envelope exactly — `error` plus the carried keys as
|
|
90
|
+
* its siblings — so a script gets the same shape whether it parses the CLI's
|
|
91
|
+
* stderr or the API response directly. Table format prints the code (the part a
|
|
92
|
+
* caller branches on), the message, the carried keys, and the one-line remedy
|
|
93
|
+
* for codes that have one.
|
|
88
94
|
*/
|
|
89
95
|
export function outputError(error, options) {
|
|
96
|
+
const { details, ...envelope } = error;
|
|
90
97
|
if (options.format === 'json') {
|
|
91
|
-
console.error(JSON.stringify({ error }, null, 2));
|
|
98
|
+
console.error(JSON.stringify({ error: envelope, ...(details ?? {}) }, null, 2));
|
|
99
|
+
return;
|
|
92
100
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
const heading = error.code ? `Error [${error.code}]: ${error.message}` : `Error: ${error.message}`;
|
|
102
|
+
console.error(chalk.red(heading));
|
|
103
|
+
for (const [key, value] of Object.entries(details ?? {})) {
|
|
104
|
+
console.error(chalk.dim(` ${key}: ${formatCell(value)}`));
|
|
105
|
+
}
|
|
106
|
+
const remedy = remedyFor(error.code);
|
|
107
|
+
if (remedy) {
|
|
108
|
+
console.error(chalk.yellow(` → ${remedy}`));
|
|
109
|
+
}
|
|
110
|
+
if (error.doc_url) {
|
|
111
|
+
console.error(chalk.dim(` Docs: ${error.doc_url}`));
|
|
98
112
|
}
|
|
99
113
|
}
|
|
100
114
|
//# sourceMappingURL=formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAa,EAAE,OAAsB;IAC1D,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC/B,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;SAAM,CAAC;QACN,UAAU,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAa;IAC/B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,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C,CAAC;IAC/C,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price-change notices for trip and checkout responses (JIN-2086 S2).
|
|
3
|
+
*
|
|
4
|
+
* The platform charges the quote-time price and reports the difference rather
|
|
5
|
+
* than refusing the checkout, so a trip can come back priced differently from
|
|
6
|
+
* what the user was shown in search. Default output is JSON on stdout, where
|
|
7
|
+
* the `price_change` object is already present but easy to scroll past, and
|
|
8
|
+
* `--format table` renders it as a raw JSON cell. These notices state the move
|
|
9
|
+
* in one line per moved item.
|
|
10
|
+
*
|
|
11
|
+
* They go to STDERR, like the deprecation notices: stdout stays exactly the
|
|
12
|
+
* response body so `jinko checkout | jq` keeps working.
|
|
13
|
+
*/
|
|
14
|
+
interface Money {
|
|
15
|
+
readonly amount: number;
|
|
16
|
+
readonly currency: string;
|
|
17
|
+
readonly decimal_places?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ItemPriceChange {
|
|
20
|
+
/** The item the move belongs to, when the response named one. */
|
|
21
|
+
readonly itemId?: string;
|
|
22
|
+
readonly original: Money;
|
|
23
|
+
readonly current: Money;
|
|
24
|
+
/** `current` minus `original`, SIGNED: negative when the price fell. */
|
|
25
|
+
readonly delta: Money;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Reads every stated price move off a response body.
|
|
29
|
+
*
|
|
30
|
+
* Defensive on purpose: the CLI talks to whatever the deployed API is, and the
|
|
31
|
+
* item arrays it reads are typed `unknown[]` on two of the four responses. A
|
|
32
|
+
* block missing any of the three figures is dropped rather than half-reported
|
|
33
|
+
* — "changed from 100.00 to (unknown)" says less than nothing, and the item's
|
|
34
|
+
* own `price` is still in the body.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readPriceChanges(response: unknown): ItemPriceChange[];
|
|
37
|
+
/** One line per moved item; an empty array when no price moved. */
|
|
38
|
+
export declare function priceChangeNotices(response: unknown): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Writes the notices to stderr. Called after `output()` so the response body
|
|
41
|
+
* is already on stdout and the notices are the last thing a human reads.
|
|
42
|
+
*/
|
|
43
|
+
export declare function printPriceChangeNotices(response: unknown, write?: (line: string) => void): void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=price-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-change.d.ts","sourceRoot":"","sources":["../../src/output/price-change.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,UAAU,KAAK;IACb,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;CACvB;AAcD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,eAAe,EAAE,CAyBrE;AAgBD,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,CAU9D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,EACjB,KAAK,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAA2C,GACnE,IAAI,CAIN"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
function readMoney(value) {
|
|
3
|
+
if (!value || typeof value !== 'object')
|
|
4
|
+
return undefined;
|
|
5
|
+
const money = value;
|
|
6
|
+
if (typeof money.amount !== 'number' || !Number.isFinite(money.amount))
|
|
7
|
+
return undefined;
|
|
8
|
+
if (typeof money.currency !== 'string' || money.currency === '')
|
|
9
|
+
return undefined;
|
|
10
|
+
return {
|
|
11
|
+
amount: money.amount,
|
|
12
|
+
currency: money.currency,
|
|
13
|
+
...(typeof money.decimal_places === 'number' ? { decimal_places: money.decimal_places } : {}),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Reads every stated price move off a response body.
|
|
18
|
+
*
|
|
19
|
+
* Defensive on purpose: the CLI talks to whatever the deployed API is, and the
|
|
20
|
+
* item arrays it reads are typed `unknown[]` on two of the four responses. A
|
|
21
|
+
* block missing any of the three figures is dropped rather than half-reported
|
|
22
|
+
* — "changed from 100.00 to (unknown)" says less than nothing, and the item's
|
|
23
|
+
* own `price` is still in the body.
|
|
24
|
+
*/
|
|
25
|
+
export function readPriceChanges(response) {
|
|
26
|
+
if (!response || typeof response !== 'object')
|
|
27
|
+
return [];
|
|
28
|
+
const items = response.items;
|
|
29
|
+
if (!Array.isArray(items))
|
|
30
|
+
return [];
|
|
31
|
+
const changes = [];
|
|
32
|
+
for (const item of items) {
|
|
33
|
+
if (!item || typeof item !== 'object')
|
|
34
|
+
continue;
|
|
35
|
+
const record = item;
|
|
36
|
+
const block = record.price_change;
|
|
37
|
+
if (!block || typeof block !== 'object')
|
|
38
|
+
continue;
|
|
39
|
+
const change = block;
|
|
40
|
+
const original = readMoney(change.original);
|
|
41
|
+
const current = readMoney(change.current);
|
|
42
|
+
const delta = readMoney(change.delta);
|
|
43
|
+
if (!original || !current || !delta)
|
|
44
|
+
continue;
|
|
45
|
+
const itemId = record.item_id;
|
|
46
|
+
changes.push({
|
|
47
|
+
...(typeof itemId === 'string' && itemId !== '' ? { itemId } : {}),
|
|
48
|
+
original,
|
|
49
|
+
current,
|
|
50
|
+
delta,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return changes;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Formats one amount at `decimal_places` when the response states a scale, and
|
|
57
|
+
* at 2 otherwise — the trip responses carry major-unit money with no scale.
|
|
58
|
+
*/
|
|
59
|
+
function formatMoney(money) {
|
|
60
|
+
const digits = typeof money.decimal_places === 'number' ? money.decimal_places : 2;
|
|
61
|
+
return `${money.amount.toFixed(digits)} ${money.currency}`;
|
|
62
|
+
}
|
|
63
|
+
function formatDelta(delta) {
|
|
64
|
+
const digits = typeof delta.decimal_places === 'number' ? delta.decimal_places : 2;
|
|
65
|
+
return `${delta.amount > 0 ? '+' : ''}${delta.amount.toFixed(digits)} ${delta.currency}`;
|
|
66
|
+
}
|
|
67
|
+
/** One line per moved item; an empty array when no price moved. */
|
|
68
|
+
export function priceChangeNotices(response) {
|
|
69
|
+
return readPriceChanges(response).map((change) => {
|
|
70
|
+
const subject = change.itemId ? `item ${change.itemId}` : 'this item';
|
|
71
|
+
const direction = change.delta.amount < 0 ? 'down' : 'up';
|
|
72
|
+
return (`[jinko] PRICE CHANGED: ${subject} was ${formatMoney(change.original)} at search time, ` +
|
|
73
|
+
`now ${formatMoney(change.current)} (${formatDelta(change.delta)}, ${direction}). ` +
|
|
74
|
+
`You will be charged the current price.`);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Writes the notices to stderr. Called after `output()` so the response body
|
|
79
|
+
* is already on stdout and the notices are the last thing a human reads.
|
|
80
|
+
*/
|
|
81
|
+
export function printPriceChangeNotices(response, write = (line) => process.stderr.write(line)) {
|
|
82
|
+
for (const notice of priceChangeNotices(response)) {
|
|
83
|
+
write(`${chalk.yellow(notice)}\n`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=price-change.js.map
|
|
@@ -0,0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