@d19n/youfibre-odin-sdk 2.0.103-beta.14 → 2.0.103-beta.16

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.
@@ -28,7 +28,7 @@ export declare type KciServiceOrderKind = 'PROVIDE' | 'CEASE' | 'MODIFY' | 'UNSO
28
28
  * Allowed YF SDK composed action keys. Every value MUST grep-resolve as
29
29
  * `actionKey` in `packages/youfibre-odin-sdk/src/actions-v2/<Name>Dto.ts`.
30
30
  */
31
- export declare type YfWoComposedActionKey = 'MoveInstallWorkOrderToScheduled' | 'MoveInstallWorkOrderFromInProgressToPending' | 'MoveInstallWorkOrderFromPendingToInProgress' | 'MoveInstallWorkOrderToRemediation' | 'MoveInstallWorkOrderFromRemediationToInProgress' | 'CreateInstallRescheduledChangeReasonSupplier' | 'CompleteInstallWorkOrderFlow' | 'CancelInstallWorkOrderFlowSupplier' | 'CreateInstallCancelledChangeReasonSupplier';
31
+ export declare type YfWoComposedActionKey = 'MoveInstallWorkOrderToScheduled' | 'MoveInstallWorkOrderToEnRoute' | 'MoveInstallWorkOrderFromInProgressToPending' | 'MoveInstallWorkOrderFromPendingToInProgress' | 'MoveInstallWorkOrderToRemediation' | 'MoveInstallWorkOrderFromRemediationToInProgress' | 'CreateInstallRescheduledChangeReasonSupplier' | 'CompleteInstallWorkOrderFlow' | 'CancelInstallWorkOrderFlowSupplier' | 'CreateInstallCancelledChangeReasonSupplier' | 'MoveBusinessInstallToEnRoute' | 'MoveBusinessInstallToInProgress' | 'MoveRemediationWorkOrderToEnRoute' | 'MoveRemediationWorkOrderToInProgress' | 'MoveServiceWorkOrderFromAcceptedToScheduled' | 'MoveServiceWorkOrderToEnRoute' | 'MoveServiceWorkOrderToInProgress';
32
32
  export declare type YfKciEffectKind = 'LOG_KCI_ONLY' | 'WO_FLOW_ACTION' | 'PROPERTY_WRITE' | 'NO_OP_DOCUMENTED';
33
33
  export declare type YfKciTargetEntity = 'OrderModule:Order' | 'CrmModule:Address' | 'FieldServiceModule:WorkOrder';
34
34
  export interface YfKciEffect {
@@ -49,6 +49,14 @@ export interface KciEffectRow {
49
49
  readonly reasonCode: FibreCafeKciReasonCode;
50
50
  readonly serviceOrderKind: KciServiceOrderKind;
51
51
  readonly yfOrderStagePreconditions?: ReadonlyArray<string>;
52
+ /** Optional supplierCode discriminator — when set, the row only matches
53
+ * if the KCI's `supplierCodes[]` contains at least one of these. Used
54
+ * to differentiate UPDATE KCIs (NETOMNIA emits 8+ distinct UPDATE
55
+ * variants by supplierCode for INSTALL / BUSINESS / REMEDIATION /
56
+ * SERVICE WO state transitions). The walker prefers the most-specific
57
+ * matching row (with supplierCodes) over the generic fallback (no
58
+ * supplierCodes). */
59
+ readonly supplierCodes?: ReadonlyArray<string>;
52
60
  readonly yfEffect: YfKciEffect;
53
61
  /** Always true per rule #4. Field is explicit so future rows that
54
62
  * document an intentional skip can mark it false. */
@@ -189,7 +189,141 @@ exports.KCI_EFFECT_ROWS = [
189
189
  },
190
190
  logAgainstOrder: true,
191
191
  },
192
+ // ── PROVIDE — UPDATE supplierCode variants ───────────────────────
193
+ // NETOMNIA emits UPDATE KCIs differentiated by supplierCodes[0] for the
194
+ // 4 WO types it exposes (INSTALL / INSTALL_BUSINESS / REMEDIATION /
195
+ // SERVICE) × engineer state (Scheduled / EnRoute / InProgress). Walker
196
+ // matches most-specific (with supplierCodes) before falling through to
197
+ // the generic provide-update row. Source: NET KCI catalog 2026-05-09.
198
+ //
199
+ // INSTALL WO
200
+ {
201
+ id: 'provide-update-install-en-route',
202
+ reasonCode: 'UPDATE',
203
+ serviceOrderKind: 'PROVIDE',
204
+ supplierCodes: ['NETOMNIA_WORK_ORDER_EN_ROUTE'],
205
+ yfEffect: {
206
+ kind: 'WO_FLOW_ACTION',
207
+ woActionKey: 'MoveInstallWorkOrderToEnRoute',
208
+ notes: 'INSTALL engineer travelling to site.',
209
+ },
210
+ logAgainstOrder: true,
211
+ },
212
+ {
213
+ id: 'provide-update-install-in-progress',
214
+ reasonCode: 'UPDATE',
215
+ serviceOrderKind: 'PROVIDE',
216
+ supplierCodes: ['NETOMNIA_WORK_ORDER_IN_PROGRESS'],
217
+ yfEffect: {
218
+ kind: 'LOG_KCI_ONLY',
219
+ notes: 'INSTALL engineer on site. WO already at InProgress from earlier RESUMED ' +
220
+ 'or scheduling flow — informational only.',
221
+ },
222
+ logAgainstOrder: true,
223
+ },
224
+ // INSTALL_BUSINESS WO
225
+ {
226
+ id: 'provide-update-business-en-route',
227
+ reasonCode: 'UPDATE',
228
+ serviceOrderKind: 'PROVIDE',
229
+ supplierCodes: ['NETOMNIA_BUSINESS_INSTALL_WORK_ORDER_EN_ROUTE'],
230
+ yfEffect: {
231
+ kind: 'WO_FLOW_ACTION',
232
+ woActionKey: 'MoveBusinessInstallToEnRoute',
233
+ notes: 'Business INSTALL engineer travelling to site.',
234
+ },
235
+ logAgainstOrder: true,
236
+ },
237
+ {
238
+ id: 'provide-update-business-in-progress',
239
+ reasonCode: 'UPDATE',
240
+ serviceOrderKind: 'PROVIDE',
241
+ supplierCodes: ['NETOMNIA_BUSINESS_INSTALL_WORK_ORDER_IN_PROGRESS'],
242
+ yfEffect: {
243
+ kind: 'WO_FLOW_ACTION',
244
+ woActionKey: 'MoveBusinessInstallToInProgress',
245
+ notes: 'Business INSTALL engineer on site.',
246
+ },
247
+ logAgainstOrder: true,
248
+ },
249
+ // REMEDIATION WO (parent INSTALL stage unchanged — REM is its own WO)
250
+ {
251
+ id: 'provide-update-remediation-scheduled',
252
+ reasonCode: 'UPDATE',
253
+ serviceOrderKind: 'PROVIDE',
254
+ supplierCodes: ['NETOMNIA_REMEDIATION_WORK_ORDER_SCHEDULED'],
255
+ yfEffect: {
256
+ kind: 'LOG_KCI_ONLY',
257
+ notes: 'REMEDIATION WO scheduled. No SDK move-to-scheduled flow exposed; ' +
258
+ 'WO is at Scheduled by default after Accepted. Logged informationally.',
259
+ },
260
+ logAgainstOrder: true,
261
+ },
262
+ {
263
+ id: 'provide-update-remediation-en-route',
264
+ reasonCode: 'UPDATE',
265
+ serviceOrderKind: 'PROVIDE',
266
+ supplierCodes: ['NETOMNIA_REMEDIATION_WORK_ORDER_EN_ROUTE'],
267
+ yfEffect: {
268
+ kind: 'WO_FLOW_ACTION',
269
+ woActionKey: 'MoveRemediationWorkOrderToEnRoute',
270
+ notes: 'REMEDIATION engineer travelling to site.',
271
+ },
272
+ logAgainstOrder: true,
273
+ },
274
+ {
275
+ id: 'provide-update-remediation-in-progress',
276
+ reasonCode: 'UPDATE',
277
+ serviceOrderKind: 'PROVIDE',
278
+ supplierCodes: ['NETOMNIA_REMEDIATION_WORK_ORDER_IN_PROGRESS'],
279
+ yfEffect: {
280
+ kind: 'WO_FLOW_ACTION',
281
+ woActionKey: 'MoveRemediationWorkOrderToInProgress',
282
+ notes: 'REMEDIATION engineer on site.',
283
+ },
284
+ logAgainstOrder: true,
285
+ },
286
+ // SERVICE WO
287
+ {
288
+ id: 'provide-update-service-scheduled',
289
+ reasonCode: 'UPDATE',
290
+ serviceOrderKind: 'PROVIDE',
291
+ supplierCodes: ['NETOMNIA_SERVICE_WORK_ORDER_SCHEDULED'],
292
+ yfEffect: {
293
+ kind: 'WO_FLOW_ACTION',
294
+ woActionKey: 'MoveServiceWorkOrderFromAcceptedToScheduled',
295
+ notes: 'SERVICE WO scheduled.',
296
+ },
297
+ logAgainstOrder: true,
298
+ },
299
+ {
300
+ id: 'provide-update-service-en-route',
301
+ reasonCode: 'UPDATE',
302
+ serviceOrderKind: 'PROVIDE',
303
+ supplierCodes: ['NETOMNIA_SERVICE_WORK_ORDER_EN_ROUTE'],
304
+ yfEffect: {
305
+ kind: 'WO_FLOW_ACTION',
306
+ woActionKey: 'MoveServiceWorkOrderToEnRoute',
307
+ notes: 'SERVICE engineer travelling to site.',
308
+ },
309
+ logAgainstOrder: true,
310
+ },
311
+ {
312
+ id: 'provide-update-service-in-progress',
313
+ reasonCode: 'UPDATE',
314
+ serviceOrderKind: 'PROVIDE',
315
+ supplierCodes: ['NETOMNIA_SERVICE_WORK_ORDER_IN_PROGRESS'],
316
+ yfEffect: {
317
+ kind: 'WO_FLOW_ACTION',
318
+ woActionKey: 'MoveServiceWorkOrderToInProgress',
319
+ notes: 'SERVICE engineer on site.',
320
+ },
321
+ logAgainstOrder: true,
322
+ },
192
323
  // ── PROVIDE — informational / no-action ──────────────────────────
324
+ // Generic UPDATE row — fallback for KCIs that don't carry a recognized
325
+ // supplierCode. Walker matches this only after rejecting all
326
+ // supplierCode-keyed UPDATE rows above.
193
327
  {
194
328
  id: 'provide-update',
195
329
  reasonCode: 'UPDATE',
@@ -285,6 +419,7 @@ exports.detectKciKind = detectKciKind;
285
419
  * the gap explicitly.
286
420
  */
287
421
  function decideKciDispatch(dto) {
422
+ var _a;
288
423
  const kind = detectKciKind(dto);
289
424
  if (!kind) {
290
425
  return {
@@ -293,7 +428,16 @@ function decideKciDispatch(dto) {
293
428
  serviceOrderKind: 'PROVIDE',
294
429
  };
295
430
  }
296
- const row = exports.KCI_EFFECT_ROWS.find((r) => r.reasonCode === dto.reasonCode && r.serviceOrderKind === kind);
431
+ // Match priority: most-specific (with supplierCodes intersecting the
432
+ // KCI's supplierCodes[]) before generic (no supplierCodes). For UPDATE
433
+ // KCIs NETOMNIA emits 8+ variants discriminated by supplierCodes — the
434
+ // walker resolves each variant to its specific WO target action.
435
+ const candidates = exports.KCI_EFFECT_ROWS.filter((r) => r.reasonCode === dto.reasonCode && r.serviceOrderKind === kind);
436
+ const dtoSupplierCodes = (_a = dto.supplierCodes) !== null && _a !== void 0 ? _a : [];
437
+ const specificMatch = candidates.find((r) => r.supplierCodes !== undefined &&
438
+ r.supplierCodes.some((sc) => dtoSupplierCodes.includes(sc)));
439
+ const genericMatch = candidates.find((r) => r.supplierCodes === undefined);
440
+ const row = specificMatch !== null && specificMatch !== void 0 ? specificMatch : genericMatch;
297
441
  if (!row) {
298
442
  return { kind: 'NO_MATCH', reasonCode: dto.reasonCode, serviceOrderKind: kind };
299
443
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.103-beta.14",
3
+ "version": "2.0.103-beta.16",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -17,6 +17,11 @@
17
17
  "import": "./dist/wholesale-provider/index.js",
18
18
  "types": "./dist/wholesale-provider/index.d.ts"
19
19
  },
20
+ "./dist/wholesale-provider": {
21
+ "require": "./dist/wholesale-provider/index.js",
22
+ "import": "./dist/wholesale-provider/index.js",
23
+ "types": "./dist/wholesale-provider/index.d.ts"
24
+ },
20
25
  "./dist/*": {
21
26
  "require": "./dist/*.js",
22
27
  "import": "./dist/*.js",