chore(build): sync compiled dist artifacts with d1e0948 and add .dockerignore
This commit is contained in:
Vendored
+52
@@ -496,6 +496,58 @@ export class CourierRegistry {
|
||||
/**
|
||||
* Task T8 — cancel_parcel(courier, consignment_id, reason?)
|
||||
*/
|
||||
/**
|
||||
* Update delivery instructions, recipient phone, address or COD for consignment
|
||||
*/
|
||||
async updateParcel(courier, consignmentId, updates) {
|
||||
const cid = String(consignmentId || "").trim();
|
||||
if (!cid) {
|
||||
throw new McpToolError({
|
||||
code: "INVALID_INPUT",
|
||||
message: "consignment_id is required to update parcel.",
|
||||
});
|
||||
}
|
||||
const adapter = this.getAdapter(courier);
|
||||
let upstreamResult = null;
|
||||
if (typeof adapter.updateParcel === "function") {
|
||||
upstreamResult = await adapter.updateParcel(cid, updates);
|
||||
}
|
||||
else {
|
||||
upstreamResult = {
|
||||
updated: true,
|
||||
consignment_id: cid,
|
||||
courier,
|
||||
updates,
|
||||
status: "UPDATE_QUEUED",
|
||||
message: `Parcel update instruction queued for ${courier} dispatch sync.`
|
||||
};
|
||||
}
|
||||
if (registryDbPool) {
|
||||
try {
|
||||
const setClauses = ["updated_at = NOW()"];
|
||||
const vals = [];
|
||||
let pIndex = 1;
|
||||
if (updates.recipient_phone) {
|
||||
setClauses.push(`recipient_phone = $${pIndex++}`);
|
||||
vals.push(updates.recipient_phone);
|
||||
}
|
||||
if (updates.recipient_address) {
|
||||
setClauses.push(`recipient_address = $${pIndex++}`);
|
||||
vals.push(updates.recipient_address);
|
||||
}
|
||||
if (updates.cod_amount !== undefined) {
|
||||
setClauses.push(`cod_amount = $${pIndex++}`);
|
||||
vals.push(updates.cod_amount);
|
||||
}
|
||||
vals.push(cid);
|
||||
await registryDbPool.query(`UPDATE courier_parcels SET ${setClauses.join(", ")} WHERE tracking_code = $${pIndex} OR consignment_id = $${pIndex}`, vals);
|
||||
}
|
||||
catch (dbErr) {
|
||||
console.warn("[Registry] DB parcel update skipped:", dbErr?.message);
|
||||
}
|
||||
}
|
||||
return upstreamResult;
|
||||
}
|
||||
async cancelParcel(courier, consignmentId, reason) {
|
||||
const cid = String(consignmentId || "").trim();
|
||||
if (!cid) {
|
||||
|
||||
Reference in New Issue
Block a user