@d19n/youfibre-odin-sdk 2.0.116 → 2.0.118
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,26 +404,26 @@ exports.KCI_EFFECT_ROWS = [
|
|
|
394
404
|
reasonCode: 'AMENDED',
|
|
395
405
|
serviceOrderKind: 'PROVIDE',
|
|
396
406
|
yfEffect: {
|
|
397
|
-
kind: '
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
supplierReferenceFrom: 'provideServiceOrder.appointmentReservationReference',
|
|
407
|
+
kind: 'PROPERTY_WRITE',
|
|
408
|
+
propertyWrite: {
|
|
409
|
+
entityKey: 'OrderModule:Order',
|
|
410
|
+
properties: ['CommittedDate'],
|
|
402
411
|
},
|
|
403
|
-
notes: 'Supplier
|
|
404
|
-
'
|
|
405
|
-
'
|
|
406
|
-
'
|
|
407
|
-
'
|
|
408
|
-
'
|
|
409
|
-
'
|
|
410
|
-
'
|
|
411
|
-
'
|
|
412
|
-
'
|
|
413
|
-
'
|
|
414
|
-
'
|
|
415
|
-
'
|
|
416
|
-
'
|
|
412
|
+
notes: 'Supplier confirmation that an amendment has been accepted with a new ' +
|
|
413
|
+
'appointment. In production this KCI always arrives AFTER the tenant ' +
|
|
414
|
+
'has driven the amendment — customer triggers YF /schedule-appointment ' +
|
|
415
|
+
'→ YF moves its WO Pending→Scheduled locally + calls NET amendOrder ' +
|
|
416
|
+
'→ NET responds with AMENDED. By the time AMENDED arrives at YF, the ' +
|
|
417
|
+
'WO is already at Scheduled with the new appointment data populated, ' +
|
|
418
|
+
'so the KCI carries no new state-change responsibility for the WO. ' +
|
|
419
|
+
'Only effect: update Order.CommittedDate from ' +
|
|
420
|
+
'provideServiceOrder.committedDate so the parent order tracks the ' +
|
|
421
|
+
'supplier-committed date for the rebooked slot (the initial COMMITTED ' +
|
|
422
|
+
'KCI set this on first commit; AMENDED overwrites with the post-amend ' +
|
|
423
|
+
'commitment). Earlier in this session a WO_SCHEDULE_APPOINTMENT bridge ' +
|
|
424
|
+
'was tried here but is wrong for production — it would cause a ' +
|
|
425
|
+
'double-amend cycle (YF amends NET → NET emits AMENDED → YF amends ' +
|
|
426
|
+
'NET again).',
|
|
417
427
|
},
|
|
418
428
|
logAgainstOrder: true,
|
|
419
429
|
specRef: 'fibrecafe-docs/pages/orderstate.md (AMENDED) + Frank 2026-05-12 spec quote',
|
|
@@ -499,13 +509,14 @@ function decideKciDispatch(dto) {
|
|
|
499
509
|
if (!row.yfEffect.scheduleAppointment) {
|
|
500
510
|
throw new Error(`bridge invariant: WO_SCHEDULE_APPOINTMENT row ${row.id} missing scheduleAppointment`);
|
|
501
511
|
}
|
|
502
|
-
return {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
512
|
+
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
|
|
513
|
+
? {
|
|
514
|
+
propertyWrite: {
|
|
515
|
+
entityKey: row.yfEffect.propertyWrite.entityKey,
|
|
516
|
+
properties: row.yfEffect.propertyWrite.properties,
|
|
517
|
+
},
|
|
518
|
+
}
|
|
519
|
+
: {}));
|
|
509
520
|
case 'PROPERTY_WRITE':
|
|
510
521
|
if (!row.yfEffect.propertyWrite) {
|
|
511
522
|
throw new Error(`bridge invariant: PROPERTY_WRITE row ${row.id} missing propertyWrite`);
|