@d19n/youfibre-odin-sdk 2.0.115 → 2.0.117
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.
|
@@ -107,6 +107,20 @@ export declare type KciDispatchDecision = {
|
|
|
107
107
|
dateFrom: string;
|
|
108
108
|
timeBlockFrom: string;
|
|
109
109
|
supplierReferenceFrom: string;
|
|
110
|
+
/**
|
|
111
|
+
* Optional co-effect — when present, the caller must ALSO apply a
|
|
112
|
+
* PROPERTY_WRITE on the named entity + properties after the
|
|
113
|
+
* schedule-appointment dispatch succeeds. Used by REAPPOINTED /
|
|
114
|
+
* AMENDED rows whose dto carries a new `provideServiceOrder.committedDate`
|
|
115
|
+
* for the rebooked appointment — without this co-effect the Order's
|
|
116
|
+
* CommittedDate would stay frozen at the ORIGINAL committed date and
|
|
117
|
+
* downstream consumers (Supply→Active cron, customer-facing dashboards)
|
|
118
|
+
* make decisions on stale data.
|
|
119
|
+
*/
|
|
120
|
+
propertyWrite?: {
|
|
121
|
+
entityKey: YfKciTargetEntity;
|
|
122
|
+
properties: ReadonlyArray<string>;
|
|
123
|
+
};
|
|
110
124
|
} | {
|
|
111
125
|
kind: 'PROPERTY_WRITE';
|
|
112
126
|
row: KciEffectRow;
|
|
@@ -193,12 +193,22 @@ exports.KCI_EFFECT_ROWS = [
|
|
|
193
193
|
timeBlockFrom: 'provideServiceOrder.appointmentTimeslot.classification',
|
|
194
194
|
supplierReferenceFrom: 'provideServiceOrder.appointmentReservationReference',
|
|
195
195
|
},
|
|
196
|
+
// Co-effect: REAPPOINTED's dto also carries an updated
|
|
197
|
+
// `provideServiceOrder.committedDate` for the rebooked appointment.
|
|
198
|
+
// Update Order.CommittedDate atomically with the schedule-appointment
|
|
199
|
+
// dispatch so downstream consumers (Supply→Active cron, dashboards)
|
|
200
|
+
// see the new supplier-committed date rather than the original.
|
|
201
|
+
propertyWrite: {
|
|
202
|
+
entityKey: 'OrderModule:Order',
|
|
203
|
+
properties: ['CommittedDate'],
|
|
204
|
+
},
|
|
196
205
|
notes: 'Supplier-confirmed reschedule. Bundled effect: WO Pending→Scheduled + ' +
|
|
197
|
-
'set appointment date + stamp supplier reservation reference
|
|
198
|
-
'scheduleAppointment service call handles
|
|
199
|
-
'
|
|
200
|
-
'
|
|
201
|
-
'
|
|
206
|
+
'set appointment date + stamp supplier reservation reference + write the ' +
|
|
207
|
+
'new Order.CommittedDate. Single scheduleAppointment service call handles ' +
|
|
208
|
+
'the WO transition + appointment write (skipSupplierBooking=true because ' +
|
|
209
|
+
'KCI is the commit, not a request); a follow-on PATCH on the Order writes ' +
|
|
210
|
+
'CommittedDate. Target WO resolved from dto.tenantWorkOrderReference; ' +
|
|
211
|
+
'field-service picks the right Scheduled-stage key per WO type.',
|
|
202
212
|
},
|
|
203
213
|
logAgainstOrder: true,
|
|
204
214
|
},
|
|
@@ -394,10 +404,41 @@ exports.KCI_EFFECT_ROWS = [
|
|
|
394
404
|
reasonCode: 'AMENDED',
|
|
395
405
|
serviceOrderKind: 'PROVIDE',
|
|
396
406
|
yfEffect: {
|
|
397
|
-
kind: '
|
|
398
|
-
|
|
407
|
+
kind: 'WO_SCHEDULE_APPOINTMENT',
|
|
408
|
+
scheduleAppointment: {
|
|
409
|
+
dateFrom: 'provideServiceOrder.appointmentTimeslot.timeslotStartDateTime',
|
|
410
|
+
timeBlockFrom: 'provideServiceOrder.appointmentTimeslot.classification',
|
|
411
|
+
supplierReferenceFrom: 'provideServiceOrder.appointmentReservationReference',
|
|
412
|
+
},
|
|
413
|
+
// Co-effect: AMENDED's dto carries the updated
|
|
414
|
+
// `provideServiceOrder.committedDate` reflecting the new appointment.
|
|
415
|
+
// Update Order.CommittedDate atomically with the WO transition so the
|
|
416
|
+
// YF Order tracks the supplier-committed date for the rebooked slot
|
|
417
|
+
// (same reason as REAPPOINTED — keeps downstream cron / dashboard
|
|
418
|
+
// decisions aligned with the supplier's current commitment).
|
|
419
|
+
propertyWrite: {
|
|
420
|
+
entityKey: 'OrderModule:Order',
|
|
421
|
+
properties: ['CommittedDate'],
|
|
422
|
+
},
|
|
423
|
+
notes: 'Supplier-confirmed amendment — new appointment locked in. Bundled ' +
|
|
424
|
+
'effect: WO Pending→Scheduled + set appointment date + stamp supplier ' +
|
|
425
|
+
'reservation reference + write the new Order.CommittedDate. The ' +
|
|
426
|
+
'scheduleAppointment service call handles the WO transition + ' +
|
|
427
|
+
'appointment write (skipSupplierBooking=true because NET has already ' +
|
|
428
|
+
'accepted the amendment server-side); a follow-on PATCH on the Order ' +
|
|
429
|
+
'writes CommittedDate. Target WO resolved from ' +
|
|
430
|
+
'dto.tenantWorkOrderReference; field-service picks the right ' +
|
|
431
|
+
'Scheduled-stage key per WO type. ' +
|
|
432
|
+
'AMENDED is the canonical "supplier has accepted an amendment with new ' +
|
|
433
|
+
'appointment details" signal — emitted whether the amendment was ' +
|
|
434
|
+
'YF-tenant-driven (customer rebooks via /schedule-appointment → YF ' +
|
|
435
|
+
'amends NET → NET responds AMENDED) or NET-autonomous (rare; NET ' +
|
|
436
|
+
'reserves + amends server-side). Same JSONPaths as REAPPOINTED — the ' +
|
|
437
|
+
'two rows differ only in semantics: REAPPOINTED = NET initiated, ' +
|
|
438
|
+
'AMENDED = amendment-accept confirmation (tenant or auto-amend path).',
|
|
399
439
|
},
|
|
400
440
|
logAgainstOrder: true,
|
|
441
|
+
specRef: 'fibrecafe-docs/pages/orderstate.md (AMENDED) + Frank 2026-05-12 spec quote',
|
|
401
442
|
},
|
|
402
443
|
{
|
|
403
444
|
id: 'provide-amendment-rejected',
|
|
@@ -480,13 +521,14 @@ function decideKciDispatch(dto) {
|
|
|
480
521
|
if (!row.yfEffect.scheduleAppointment) {
|
|
481
522
|
throw new Error(`bridge invariant: WO_SCHEDULE_APPOINTMENT row ${row.id} missing scheduleAppointment`);
|
|
482
523
|
}
|
|
483
|
-
return {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
524
|
+
return Object.assign({ kind: 'WO_SCHEDULE_APPOINTMENT', row, dateFrom: row.yfEffect.scheduleAppointment.dateFrom, timeBlockFrom: row.yfEffect.scheduleAppointment.timeBlockFrom, supplierReferenceFrom: row.yfEffect.scheduleAppointment.supplierReferenceFrom }, (row.yfEffect.propertyWrite
|
|
525
|
+
? {
|
|
526
|
+
propertyWrite: {
|
|
527
|
+
entityKey: row.yfEffect.propertyWrite.entityKey,
|
|
528
|
+
properties: row.yfEffect.propertyWrite.properties,
|
|
529
|
+
},
|
|
530
|
+
}
|
|
531
|
+
: {}));
|
|
490
532
|
case 'PROPERTY_WRITE':
|
|
491
533
|
if (!row.yfEffect.propertyWrite) {
|
|
492
534
|
throw new Error(`bridge invariant: PROPERTY_WRITE row ${row.id} missing propertyWrite`);
|